home *** CD-ROM | disk | FTP | other *** search
/ ProfitPress Mega CDROM2 …eeware (MSDOS)(1992)(Eng) / ProfitPress-MegaCDROM2.B6I / COMM / MISC / SRC26_2.ZIP / SRC / INDEXER.H < prev    next >
Encoding:
C/C++ Source or Header  |  1990-07-13  |  2.3 KB  |  89 lines

  1. /*
  2.  * indexer.h: tiny database index generation utility definitions
  3.  *
  4.  * Author: HIRAHO Satoshi
  5.  * (C) 1989  Halca Computer Science Laboratory TM
  6.  *
  7.  * Edition History:
  8.  * 1.1 89/07/14 Halca.Hirano creation for hterm set-up help system
  9.  * 1.2 89/07/28 Halca.Hirano change command system
  10.  *     ---- V2.4.0 distribution ----
  11.  *
  12.  * Desctiprion:
  13.  * Indexer generates index to pick up record from given key.
  14.  * There are three components for indexer.
  15.  *
  16.  * Record text; This is a plain text file including keys and appropriate
  17.  * records. e.g,
  18.  * 
  19.  *    comment
  20.  *    > key1
  21.  *    this is a text line. '>' means key.
  22.  *    And this is also test for key1.
  23.  *    < optional next key
  24.  *    comment
  25.  *    > key2
  26.  *    text lines for key2.
  27.  *    < optional next key
  28.  * Lines beginning with # character in record are written to a file
  29.  * after removed # character.
  30.  * 
  31.  * Database file; This is generated by indexer from Record text.
  32.  * Index information is included in head part of the file.
  33.  *
  34.  *    header
  35.  *    records
  36.  *    index part (key and index to records)
  37.  *
  38.  * Library; indexlib.c is a access facility to Database file.
  39.  * This is linked with users application program to use database.
  40.  *
  41.  */
  42.  
  43. #define I_VERSION    2
  44. #define I_REVISION    1
  45.  
  46. /*
  47.  * compress or plain data switch
  48.  */
  49. #define COMPRESS_DB
  50.  
  51. /*
  52.  * header part definition
  53.  */
  54. struct _header {
  55.     char    header[80];        /* header string        */
  56.     int        version;        /* version number        */
  57.     int        revision;        /* revision number        */
  58.     short    numIndex;        /* number of index        */
  59.     long    indexOffset;        /* offset to index part        */
  60.     /* record part here */
  61.     /* index part here */
  62. };
  63.  
  64. /*
  65.  * index part definition (simple binary-tree)
  66.  */
  67. #define KEY_LEN    20
  68.  
  69. typedef struct _index {
  70.     char    key[KEY_LEN];        /* key string                    */
  71.     char    nextKey[KEY_LEN];    /* next key string                */
  72.     long    offset;                /* file offset to the record    */
  73.     long    size;                /* size of the record            */
  74.     long    right;                /* to bigger key                */
  75.     long    left;                /* to smaller key                */
  76. } Index;
  77.  
  78. /*
  79.  * text file definitions
  80.  */
  81. #define KEY            '>'            /* '> key' key and start record    */
  82. #define KEY_END        '<'            /* '<' end record                 */
  83. #define STRIP        '#'            /* strip if strip mode            */
  84. #define KEY_PAREN2 '\"'            /* key can be rounded with "    */
  85. #define KEY_PAREN1 '\''            /* key can be rounded with '    */
  86. #define INCLUDE        '@'            /* include @file                */
  87.  
  88.  
  89.