Source:NetHack 3.2.0/dlb.h

Below is the full text to dlb.h from the source code of NetHack 3.2.0. To link to a particular line, write [[NetHack 3.2.0/dlb.h#line123 ]], for example.

Warning! This is the source code from an old release. For the latest release, see Source code

1.   /*	SCCS Id: @(#)dlb.h	3.2	94/12/30	*/ 2.   /* Copyright (c) Kenneth Lorber, Bethesda, Maryland, 1993. */ 3.    /* NetHack may be freely redistributed. See license for details. */ 4.     5.    #ifndef DLB_H 6.   #define DLB_H 7.   /* definitions for data library */ 8.    9.    #ifdef DLB 10.   11.   /* directory structure in memory */ 12.  typedef struct { 13.      char *fname;	/* file name as seen from calling code */ 14.      long foffset;	/* offset in lib file to start of this file */ 15.      long fsize;		/* file size */ 16.      char handling;	/* how to handle the file (compression, etc) */ 17.  } libdir; 18.   19.   /* information about each open library */ 20.  typedef struct { 21.      FILE *fdata;	/* opened data file */ 22.      long fmark;		/* current file mark */ 23.      libdir *dir;	/* directory of library file */ 24.      char *sspace;	/* pointer to string space */ 25.      long nentries;	/* # of files in directory */ 26.      long rev;		/* dlb file revision */ 27.      long strsize;	/* dlb file string size */ 28.  } library; 29.   30.   typedef struct { 31.      FILE *fp;		/* pointer to an external file, use if non-null */ 32.      library *lib;	/* pointer to library structure */ 33.      long start;		/* offset of start of file */ 34.      long size;		/* size of file */ 35.      long mark;		/* current file marker */ 36.  } dlb; 37.   38.   boolean NDECL(dlb_init); 39.  void NDECL(dlb_cleanup); 40.   41.   dlb *FDECL(dlb_fopen,(const char *, const char *)); 42.  int FDECL(dlb_fclose,(dlb *)); 43.  int FDECL(dlb_fread,(char *, int, int, dlb *)); 44.  int FDECL(dlb_fseek,(dlb *, long, int)); 45.  char *FDECL(dlb_fgets,(char *, int, dlb *)); 46.  int FDECL(dlb_fgetc,(dlb *)); 47.  long FDECL(dlb_ftell,(dlb *)); 48.   49.   /* data librarian definitions */ 50.  # ifndef DLBFILE 51.  #  define DLBFILE	"nhdat"			/* name of library */ 52.  # endif 53.  # ifndef FILENAME_CMP 54.  #  define FILENAME_CMP	strcmp			/* case sensitive */ 55.  # endif 56.   57.   #else /* DLB */ 58.   59.   # define dlb FILE 60.   61.   # define dlb_init 62.  # define dlb_cleanup 63.   64.   # define dlb_fopen	fopen 65.  # define dlb_fclose	fclose 66.  # define dlb_fread	fread 67.  # define dlb_fseek	fseek 68.  # define dlb_fgets	fgets 69.  # define dlb_fgetc	fgetc 70.  # define dlb_ftell	ftell 71.   72.   #endif /* DLB */ 73.   74.    75.   /* various other I/O stuff we don't want to replicate everywhere */ 76.   77.   #ifndef SEEK_SET 78.  # define SEEK_SET 0 79.  #endif 80.  #ifndef SEEK_CUR 81.  # define SEEK_CUR 1 82.  #endif 83.  #ifndef SEEK_END 84.  # define SEEK_END 2 85.  #endif 86.   87.   #define RDTMODE "r" 88.  #if (defined(MSDOS) || defined(WIN32)) && defined(DLB) 89.  #define WRTMODE "w+b" 90.  #else 91.  #define WRTMODE "w+" 92.  #endif 93.  #if (defined(MICRO) && !defined(AMIGA)) || defined(THINK_C) || defined(__MWERKS__) 94.  # define RDBMODE "rb" 95.  # define WRBMODE "w+b" 96.  #else 97.  # define RDBMODE "r" 98.  # define WRBMODE "w+" 99.  #endif 100.  101.  #endif	/* DLB_H */