home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c185 / 2.ddi / OWLSRC.EXE / CSCAPE / SOURCE / BFDECL.H < prev    next >
Encoding:
C/C++ Source or Header  |  1989-09-06  |  2.9 KB  |  94 lines

  1. /*
  2.     bfdecl.h
  3.  
  4.     % block file header
  5.  
  6.     OWL 1.1
  7.     Copyright (c) 1988, by Oakland Group, Inc.
  8.     ALL RIGHTS RESERVED.
  9.  
  10.     Revision History:
  11.     -----------------
  12.     02/02/89 jdc    added bfile_Clear and added fflush() in bfile_Read()
  13.     07/27/89 jdc    renamed macros and removed static buffer
  14.      8/09/89 jdc    changed oslist_GetSym to oslist_Get
  15. */
  16.  
  17. /* in symldecl.h
  18. #define    OSLIST_BADNAME        -1    */
  19.  
  20. #define    BFILE_DIR            -2
  21. #define    BFILE_NOMORE        -3
  22.  
  23. #define COMM_LEN        50
  24. #define    BHEAD_LEN        11L
  25. #define    THEAD_LEN        7L
  26. #define    FHEAD_LEN        ((long)COMM_LEN + BHEAD_LEN)
  27.  
  28. typedef struct bfile_struct {
  29.  
  30.     unsigned int    block_size;
  31.     oslist_type        dir;
  32.  
  33.     FILE            *stream;
  34.     char            *path;
  35.  
  36.     int             freeb;
  37.  
  38.     int     current_name;    /* bfile_Push() and bfile_Pop() depend on          */
  39.     int     current_block;    /* the current order of elements in bfile_struct */
  40.     int     curnext_block;    /* changing the order will BREAK code              */
  41.  
  42.     unsigned int     curblock_size;
  43.     unsigned int    new_find;
  44.  
  45.     xarray            push;
  46.     int                pindex;
  47.  
  48.     char             *comment;
  49.  
  50. } *bfile_type;
  51.  
  52. extern bfile_type    bfile_Open(_arg3(char*, unsigned int, char*));
  53. extern boolean         bfile_Find(_arg3(bfile_type, char*, int));
  54. extern unsigned int    bfile_Read(_arg3(bfile_type, char*, unsigned int));
  55. extern unsigned int    _bfile_gets(_arg4(bfile_type, char*, unsigned int, char));
  56. extern boolean        bfile_Write(_arg3(bfile_type, char*, unsigned int));
  57. extern boolean        bfile_Push(_arg1(bfile_type));
  58. extern boolean        bfile_Pop(_arg1(bfile_type));
  59. extern void            bfile_Close(_arg1(bfile_type));
  60.  
  61. extern int            bfile_GetFreeB(_arg1(bfile_type));
  62. extern void            bfile_PutFreeB(_arg2(bfile_type, int));
  63. extern void            bfile_WriteDir(_arg1(bfile_type));
  64.  
  65. extern void            bfile_Del(_arg2(bfile_type, char*));
  66. extern boolean        bfile_FindEnd(_arg3(bfile_type, char*, int));
  67.  
  68. #define bfile_Gets(bf, buf, blen)    _bfile_gets(bf, buf, blen, '\n')
  69. #define    bfile_Clear(bfile)            ( bfile->current_name = OSLIST_BADNAME )
  70.  
  71. #define    bfwseek(bfile)    fseek((bfile)->stream,\
  72.     ( (long)(bfile)->current_block*( (long)(bfile)->block_size+BHEAD_LEN+THEAD_LEN ) ) + FHEAD_LEN,\
  73.     SEEK_SET)
  74.  
  75. #define    bfrseek(bfile)    fseek((bfile)->stream,\
  76.     ( (long)(bfile)->current_block*( (long)(bfile)->block_size+BHEAD_LEN+THEAD_LEN ) ) + FHEAD_LEN+THEAD_LEN,\
  77.     SEEK_SET)
  78.  
  79. #define    bfile_PutDir(bfile, s, d)     oslist_Put((bfile)->dir, s, (VOID *)(d))
  80. #define    bfile_GetDirName(bfile, h)    oslist_Get((bfile)->dir, h)
  81.  
  82. #define bfile_GetDirBlock(bfile, h) \
  83.     ( ((bfddata_type)oslist_GetData((bfile)->dir, h))->start )
  84.  
  85. #define bfile_GetDirType(bfile, h) \
  86.     ( ((bfddata_type)oslist_GetData((bfile)->dir, h))->type )
  87.  
  88. #define bfile_GetDirData(sym)        ((int *)sym_GetData(sym))
  89.  
  90. #define bfile_FindDir(bfile, name)        oslist_FindSymHandle((bfile)->dir, name)
  91. #define bfile_DirAlphaHandle(bfile, a)    oslist_AlphaHandle((bfile)->dir, a)
  92. #define bfile_CloseDir(bfile)            oslist_Close((bfile)->dir)
  93. #define bfile_GetDirSize(bfile)            oslist_GetSize((bfile)->dir)
  94.