Go to the documentation of this file.00001
00002
00003
00004
00005 #ifndef DLB_H
00006 #define DLB_H
00007
00008
00009 #ifdef DLB
00010
00011
00012 #ifdef MAC
00013 # define DLBRSRC
00014 #else
00015 # define DLBLIB
00016 #endif
00017
00018 #ifdef DLBLIB
00019
00020 typedef struct dlb_directory {
00021 char *fname;
00022 long foffset;
00023 long fsize;
00024 char handling;
00025 } libdir;
00026
00027
00028 typedef struct dlb_library {
00029 FILE *fdata;
00030 long fmark;
00031 libdir *dir;
00032 char *sspace;
00033 long nentries;
00034 long rev;
00035 long strsize;
00036 } library;
00037
00038
00039 # ifndef DLBFILE
00040 # define DLBFILE "nhdat"
00041 # endif
00042 # ifndef FILENAME_CMP
00043 # define FILENAME_CMP strcmp
00044 # endif
00045
00046 #endif
00047
00048
00049 typedef struct dlb_handle {
00050 FILE *fp;
00051 #ifdef DLBLIB
00052 library *lib;
00053 long start;
00054 long size;
00055 long mark;
00056 #endif
00057 #ifdef DLBRSRC
00058 int fd;
00059 #endif
00060 } dlb;
00061
00062 #if defined(ULTRIX_PROTO) && !defined(__STDC__)
00063
00064
00065
00066 #define DLB_P struct dlb_handle *
00067 #else
00068 #define DLB_P dlb *
00069 #endif
00070
00071 boolean NDECL(dlb_init);
00072 void NDECL(dlb_cleanup);
00073
00074 dlb *FDECL(dlb_fopen, (const char *,const char *));
00075 int FDECL(dlb_fclose, (DLB_P));
00076 int FDECL(dlb_fread, (char *,int,int,DLB_P));
00077 int FDECL(dlb_fseek, (DLB_P,long,int));
00078 char *FDECL(dlb_fgets, (char *,int,DLB_P));
00079 int FDECL(dlb_fgetc, (DLB_P));
00080 long FDECL(dlb_ftell, (DLB_P));
00081
00082
00083
00084 #ifdef DLBRSRC
00085 boolean rsrc_dlb_init(void);
00086 void rsrc_dlb_cleanup(void);
00087 boolean rsrc_dlb_fopen(dlb *dp, const char *name, const char *mode);
00088 int rsrc_dlb_fclose(dlb *dp);
00089 int rsrc_dlb_fread(char *buf, int size, int quan, dlb *dp);
00090 int rsrc_dlb_fseek(dlb *dp, long pos, int whence);
00091 char *rsrc_dlb_fgets(char *buf, int len, dlb *dp);
00092 int rsrc_dlb_fgetc(dlb *dp);
00093 long rsrc_dlb_ftell(dlb *dp);
00094 #endif
00095
00096
00097 #else
00098
00099 # define dlb FILE
00100
00101 # define dlb_init()
00102 # define dlb_cleanup()
00103
00104 # define dlb_fopen fopen
00105 # define dlb_fclose fclose
00106 # define dlb_fread fread
00107 # define dlb_fseek fseek
00108 # define dlb_fgets fgets
00109 # define dlb_fgetc fgetc
00110 # define dlb_ftell ftell
00111
00112 #endif
00113
00114
00115
00116
00117 #ifndef SEEK_SET
00118 # define SEEK_SET 0
00119 #endif
00120 #ifndef SEEK_CUR
00121 # define SEEK_CUR 1
00122 #endif
00123 #ifndef SEEK_END
00124 # define SEEK_END 2
00125 #endif
00126
00127 #define RDTMODE "r"
00128 #if (defined(MSDOS) || defined(WIN32) || defined(TOS) || defined(OS2)) && defined(DLB)
00129 #define WRTMODE "w+b"
00130 #else
00131 #define WRTMODE "w+"
00132 #endif
00133 #if (defined(MICRO) && !defined(AMIGA)) || defined(THINK_C) || defined(__MWERKS__) || defined(WIN32)
00134 # define RDBMODE "rb"
00135 # define WRBMODE "w+b"
00136 #else
00137 # define RDBMODE "r"
00138 # define WRBMODE "w+"
00139 #endif
00140
00141 #endif