home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 15 / 15.iso / s / s053 / 9.ddi / usr / include / table.h next >
Encoding:
Text File  |  1990-12-08  |  3.0 KB  |  108 lines

  1. /*    Copyright (c) 1990 UNIX System Laboratories, Inc.    */
  2. /*    Copyright (c) 1984, 1986, 1987, 1988, 1989, 1990 AT&T    */
  3. /*      All Rights Reserved      */
  4.  
  5. /*    THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF         */
  6. /*    UNIX System Laboratories, Inc.                         */
  7. /*    The copyright notice above does not evidence any       */
  8. /*    actual or intended publication of such source code.    */
  9.  
  10. #ident    "@(#)/usr/include/table.h.sl 1.1 4.0 12/08/90 23353 AT&T-USL"
  11. /*
  12.     This file contains all structure definitions for the table
  13.     management library.
  14. */
  15.  
  16. /*
  17.     #DEFINES
  18. */
  19. /* Maximum values of various things */
  20. #define TL_MAXTABLES 20
  21. #define    TL_MAXFIELDS 32
  22. #define    TL_MAXLINESZ 512
  23. #define    TLCOMMENT    (unsigned char *)"<COMMENT>"
  24. #define TLTRAILING    (unsigned char *)"<TRAILING>"
  25.  
  26. /* Search Operations */
  27. #define    TLEQ    -1
  28. #define    TLNE    -2
  29. #define    TLLT    -3
  30. #define TLGT    -4
  31. #define    TLLE    -5
  32. #define    TLGE    -6
  33. #define TLMATCH    -7
  34. #define    TLNMATCH    -8
  35. #define    TLNUMEQ    -9
  36. #define    TLNUMNE    -10
  37. #define    TLNUMLT    -11
  38. #define TLNUMGT    -12
  39. #define    TLNUMLE    -13
  40. #define    TLNUMGE    -14
  41.  
  42. /* Search how_to_match argument values */
  43. #define    TL_AND    1
  44. #define    TL_NAND    2
  45. #define    TL_OR    3
  46. #define    TL_NOR    4
  47.  
  48. /* NOTE: Entryno must have at least TLBITS + 2 number of bits */
  49. typedef    int entryno_t;
  50.  
  51. #define    TLBITS        14
  52. #define    TLBEGIN        0
  53. #define    TLEND        (1<<(TLBITS + 2))    /* This is NOT portable */
  54.  
  55. /* 
  56.     RETURN CODES
  57. */
  58. #define    TLSUBSTITUTION -11 /* Text to be used in a field contains one or more
  59.     field separatiors, end-of-entry characters, or comment characters */
  60. #define    TLBADFIELD    -10    /* Non-existent field */
  61. #define    TLNOMEMORY    -9    /* A malloc() failed */
  62. #define    TLBADENTRY    -8    /* Entry does not exist */
  63. #define    TLBADFORMAT    -7    /* Format in table description has bad syntax */
  64. #define    TLBADID    -6    /* Invalid tid given to a library routine */
  65. #define    TLTOOMANY    -5    /* Attempting to open too many tables */
  66. #define TLDESCRIPTION    -4    /* Semantic ambiguity in a table description */
  67. #define TLTOOLONG    -3    /* An Entry in the table is too long */
  68. #define    TLARGS    -2
  69. #define    TLFAILED    -1
  70. #define    TLOK    0
  71. #define    TLBADFS    1    /* Field Separator in TLopen() call differs from
  72.                     that in the table */
  73. #define    TLDIFFFORMAT    2    /* Format in TLopen() call or entry argument
  74.                             differs from that in the table */
  75.  
  76. /*
  77.     Typedefs
  78. */
  79.  
  80. /*
  81.     This structure describes what a table is supposed to look like.
  82. */
  83. typedef struct TLdesc {
  84.     unsigned char td_fs;    /* field separator - default ":" */
  85.     unsigned char td_eoe;    /* End of entry - default "\n" */
  86.     unsigned char td_comment;    /* comment character - default "#" */
  87.     unsigned char *td_format;    /* entry format */
  88. } TLdesc_t;
  89.  
  90. /* This hides the implementation of an ENTRY from applications */
  91. typedef    long ENTRY;
  92.  
  93. /*
  94.     This structure describes search operations.
  95. */
  96. typedef    struct TLsearch    {
  97.     unsigned char *ts_fieldname;
  98.     unsigned char *ts_pattern;
  99.     int    (*ts_operation)();
  100. } TLsearch_t;
  101.  
  102. /* Declarations */
  103. int TLopen(), TLsync(), TLclose(), TLread(), TLwrite(), TLdelete();
  104. int TLappend(), TLassign(), TLsubst(), TLfreeentry(), TLsearch1();
  105. ENTRY TLgetentry();
  106. unsigned char *TLgetfield();
  107.  
  108.