home *** CD-ROM | disk | FTP | other *** search
- /*
- bfdecl.h
-
- % block file header
-
- OWL 1.1
- Copyright (c) 1988, by Oakland Group, Inc.
- ALL RIGHTS RESERVED.
-
- Revision History:
- -----------------
- 02/02/89 jdc added bfile_Clear and added fflush() in bfile_Read()
- 07/27/89 jdc renamed macros and removed static buffer
- 8/09/89 jdc changed oslist_GetSym to oslist_Get
- */
-
- /* in symldecl.h
- #define OSLIST_BADNAME -1 */
-
- #define BFILE_DIR -2
- #define BFILE_NOMORE -3
-
- #define COMM_LEN 50
- #define BHEAD_LEN 11L
- #define THEAD_LEN 7L
- #define FHEAD_LEN ((long)COMM_LEN + BHEAD_LEN)
-
- typedef struct bfile_struct {
-
- unsigned int block_size;
- oslist_type dir;
-
- FILE *stream;
- char *path;
-
- int freeb;
-
- int current_name; /* bfile_Push() and bfile_Pop() depend on */
- int current_block; /* the current order of elements in bfile_struct */
- int curnext_block; /* changing the order will BREAK code */
-
- unsigned int curblock_size;
- unsigned int new_find;
-
- xarray push;
- int pindex;
-
- char *comment;
-
- } *bfile_type;
-
- extern bfile_type bfile_Open(_arg3(char*, unsigned int, char*));
- extern boolean bfile_Find(_arg3(bfile_type, char*, int));
- extern unsigned int bfile_Read(_arg3(bfile_type, char*, unsigned int));
- extern unsigned int _bfile_gets(_arg4(bfile_type, char*, unsigned int, char));
- extern boolean bfile_Write(_arg3(bfile_type, char*, unsigned int));
- extern boolean bfile_Push(_arg1(bfile_type));
- extern boolean bfile_Pop(_arg1(bfile_type));
- extern void bfile_Close(_arg1(bfile_type));
-
- extern int bfile_GetFreeB(_arg1(bfile_type));
- extern void bfile_PutFreeB(_arg2(bfile_type, int));
- extern void bfile_WriteDir(_arg1(bfile_type));
-
- extern void bfile_Del(_arg2(bfile_type, char*));
- extern boolean bfile_FindEnd(_arg3(bfile_type, char*, int));
-
- #define bfile_Gets(bf, buf, blen) _bfile_gets(bf, buf, blen, '\n')
- #define bfile_Clear(bfile) ( bfile->current_name = OSLIST_BADNAME )
-
- #define bfwseek(bfile) fseek((bfile)->stream,\
- ( (long)(bfile)->current_block*( (long)(bfile)->block_size+BHEAD_LEN+THEAD_LEN ) ) + FHEAD_LEN,\
- SEEK_SET)
-
- #define bfrseek(bfile) fseek((bfile)->stream,\
- ( (long)(bfile)->current_block*( (long)(bfile)->block_size+BHEAD_LEN+THEAD_LEN ) ) + FHEAD_LEN+THEAD_LEN,\
- SEEK_SET)
-
- #define bfile_PutDir(bfile, s, d) oslist_Put((bfile)->dir, s, (VOID *)(d))
- #define bfile_GetDirName(bfile, h) oslist_Get((bfile)->dir, h)
-
- #define bfile_GetDirBlock(bfile, h) \
- ( ((bfddata_type)oslist_GetData((bfile)->dir, h))->start )
-
- #define bfile_GetDirType(bfile, h) \
- ( ((bfddata_type)oslist_GetData((bfile)->dir, h))->type )
-
- #define bfile_GetDirData(sym) ((int *)sym_GetData(sym))
-
- #define bfile_FindDir(bfile, name) oslist_FindSymHandle((bfile)->dir, name)
- #define bfile_DirAlphaHandle(bfile, a) oslist_AlphaHandle((bfile)->dir, a)
- #define bfile_CloseDir(bfile) oslist_Close((bfile)->dir)
- #define bfile_GetDirSize(bfile) oslist_GetSize((bfile)->dir)
-