home *** CD-ROM | disk | FTP | other *** search
/ Power GUI Programming with VisualAge C++ / powergui.iso / trialva / ibmcppw / include / symtab.h < prev    next >
Encoding:
C/C++ Source or Header  |  1996-01-24  |  2.7 KB  |  109 lines

  1. /*
  2.  *   COMPONENT_NAME: somc
  3.  *
  4.  *   ORIGINS: 27
  5.  *
  6.  *
  7.  *   10H9767, 10H9769  (C) COPYRIGHT International Business Machines Corp. 1992,1994
  8.  *   All Rights Reserved
  9.  *   Licensed Materials - Property of IBM
  10.  *   US Government Users Restricted Rights - Use, duplication or
  11.  *   disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  12.  */
  13. /* %Z% %I% %W% %G% %U% [%H% %T%] */
  14.  
  15. /*
  16.  */
  17.  
  18. /*
  19.  *         File:    symtab.h.
  20.  *     Contents:    Header file for generic symbol table routines.
  21.  *                  [12/06/93] Free up unused symbol tables #1112
  22.  */
  23.  
  24. #ifndef symtab_h
  25. #define symtab_h
  26.  
  27. #include <smcidl.h>
  28.  
  29. #ifndef bool
  30. #define bool boolean
  31. #endif
  32.  
  33. #define SepNULL     (Sep *) NULL
  34.  
  35. /*
  36.  * Forward referenc the Symbol table:
  37.  */
  38. struct Stab;
  39.  
  40. /*
  41.  * Default Entry for a symbol table
  42.  */
  43. _typedef struct SEntry {
  44.     char *name;
  45. } _name(SEntry);
  46.  
  47. /*
  48.  * Keyword structure.
  49.  */
  50. _typedef struct KeyTabEntry {
  51.     char *kword;
  52.     long token;
  53. } _name(KeytabEntry);
  54.  
  55. /*
  56.  * Symbol table entry linked list
  57.  */
  58. _typedef struct Sep {
  59.     size_t posn;
  60.     SEntry *ep;
  61.     struct Sep *next;
  62. } _name(Sep);
  63.  
  64. /*
  65.  *  MemBuf is the structure used to allocate new memory in contiguous blocks.
  66.  *  We can use it for unique strings too if the uniq flag is set when calling
  67.  *  somtcreateMemBuf().
  68.  */
  69. _typedef struct MemBuf {
  70.     char *base;
  71.     size_t size;
  72.     size_t nelms;
  73.     char *cur;
  74.     _struct Stab *stab;
  75. } _name(MemBuf);
  76.  
  77. /*
  78.  * Basic Symbol Table (STab) structure.
  79.  */
  80. _typedef struct Stab {
  81.     size_t size;
  82.     long entrysize;
  83.     size_t nelms;
  84.     Sep *base;
  85.     Sep *limit;
  86.     Sep *buf;
  87.     MemBuf *membuf;
  88.     bool ignorecase;
  89. } _name(Stab);
  90.  
  91. #ifndef __SOMIDL__
  92. SOMEXTERN char *somtallocBuf(MemBuf *membuf, void *buf, long len);
  93. SOMEXTERN char *somtuniqString(MemBuf *membuf, char *s);
  94. SOMEXTERN long somtkeyword(KeytabEntry *keytab, char *kword, long keytabsize);
  95. SOMEXTERN void *somtaddEntry(Stab *stab, char *name, void *ep);
  96. SOMEXTERN void *somtgetEntry(Stab *stab, char *name);
  97. SOMEXTERN void *somtstabFirst(Stab *stab, Sep **sepp);
  98. SOMEXTERN void *somtstabFirstName(Stab *stab, char *name, Sep **sepp);
  99. SOMEXTERN void *somtstabNext(Stab *stab, Sep **sepp);
  100. SOMEXTERN void *somtstabNextName(Stab *stab, Sep **sepp);
  101. SOMEXTERN void somtcreateMemBuf(MemBuf **membufp, size_t bufsize, long stabsize);
  102. SOMEXTERN void somtcreateStab(Stab *stab, long stabsize, long entrysize);
  103. SOMEXTERN int somticstrcmp(char *s, char *t);
  104. SOMEXTERN void *somtaddEntryBuf(Stab *stab, char *name, void *ep, void *buf, size_t len);
  105. SOMEXTERN void somtFreeStab(Stab *stab, bool freeEp);
  106. #endif  /* __SOMIDL__ */
  107.  
  108. #endif                                 /* symtab_h */
  109.