home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / ctb_291.zip / include / table.h < prev    next >
C/C++ Source or Header  |  1996-08-14  |  1KB  |  78 lines

  1. /*
  2. ** Module   :TABLE.H
  3. ** Abstract :Name table imlementation
  4. **
  5. ** Copyright (C) Sergey I. Yevtushenko
  6. ** Log:
  7. ** Update :Fri  10-05-96
  8. ** Update :Wed  06-16-93
  9. ** Update :Mon  27-04-92
  10. */
  11.  
  12. #ifndef __cplusplus
  13. #error Types "name" and "table" supported only in C++
  14. #else
  15.  
  16. #include <string.h>
  17. #include <stdlib.h>
  18.  
  19. #ifndef __TABLE_H
  20. #define __TABLE_H
  21.  
  22. class link;
  23. class method;
  24. class Name
  25. {
  26.     public:
  27.         Name * next;
  28.         char *str;
  29.         char declaration_file[_MAX_FNAME];
  30.         long declaration_line;
  31.         link *base;
  32.         link *childs;
  33.         method *funcs;
  34.         char used;
  35.  
  36.         Name(char *, Name *);
  37.         ~Name();
  38. };
  39. class link
  40. {
  41.     public:
  42.         Name * name;
  43.         link *next;
  44.  
  45.         link(Name * nm, link * ln = 0) { name = nm;next = ln;}
  46.     friend link* Sort(link *);
  47. };
  48.  
  49. class method
  50. {
  51.     public:
  52.         int flags;
  53.         char *name;
  54.         method* next;
  55.  
  56.         method(char *, method *);
  57.         ~method() { delete name;}
  58. };
  59.  
  60. class Table
  61. {
  62.         Name **tbl;
  63.         int size;
  64.     public:
  65.         Table(int sz = 101);
  66.         ~Table();
  67.  
  68.         Name *look(char *, int = 0);
  69.         Name *insert(char *s) { return look(s, 1);}
  70.         Prepare(Name *);
  71.         void show();
  72.         void show(Name *, int = 1);
  73.         void show_tree(char* =0, char* =0);
  74.         void show_tree(Name *);
  75. };
  76. #endif
  77. #endif
  78.