dbio.h
pennmush-1.8.3p3/hdrs/dbio.h · 1.4 KB
From the archive pennmush-1.8.3p3.tar.gz
Download the archive « Back to the archive contents
/**
* \file dbio.h
*
* \brief header files for functions for reading/writing database files
*/
#ifndef __DBIO_H
#define __DBIO_H
#include <setjmp.h>
#include <stdio.h>
#ifdef HAVE_STDINT_H
#include <stdint.h>
#endif
extern jmp_buf db_err;
/** Run a function, and jump if error */
#define OUTPUT(fun) do { if ((fun) < 0) longjmp(db_err, 1); } while (0)
/* Output */
void putref(FILE * f, long int ref);
void putstring(FILE * f, const char *s);
void db_write_labeled_string(FILE * f, char const *label, char const *value);
void db_write_labeled_int(FILE * f, char const *label, int value);
void db_write_labeld_uint32(FILE *, char const *, uint32_t);
void db_write_labeled_dbref(FILE * f, char const *label, dbref value);
dbref db_write(FILE * f, int flag);
int db_paranoid_write(FILE * f, int flag);
/* Input functions */
char *getstring_noalloc(FILE * f);
long getref(FILE * f);
void db_read_this_labeled_string(FILE * f, const char *label, char **val);
void db_read_labeled_string(FILE * f, char **label, char **val);
void db_read_this_labeled_int(FILE * f, const char *label, int *val);
void db_read_this_labeled_uint32(FILE * f, const char *lable, uint32_t * val);
void db_read_labeled_int(FILE * f, char **label, int *val);
void db_read_labeled_uint32(FILE * f, char **label, uint32_t * val);
void db_read_this_labeled_dbref(FILE * f, const char *label, dbref *val);
void db_read_labeled_dbref(FILE * f, char **label, dbref *val);
dbref db_read(FILE * f);
#endif