home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 5 Edit / 05-Edit.zip / me34src.zip / me3 / util / dtable.h < prev    next >
C/C++ Source or Header  |  1995-01-14  |  862b  |  33 lines

  1. /* dtable.h : dynamic tables header file.
  2.  * See dtable.c for more info.
  3.  * All routines, macros, etc use pointers to dTables.
  4.  *
  5.  * C Durland    Public Domain
  6.  */
  7.  
  8. #ifndef __DTABLE_H_INCLUDED
  9. #define __DTABLE_H_INCLUDED
  10.  
  11. #define declare_dTable_of(blob) struct { DTABLE(blob); }
  12. #define declare_and_init_dTable(name,blob)    \
  13.     struct { DTABLE(blob); } name = initial_dTable_data(name)
  14.  
  15. #define sizeof_dTable(dtable)    (dtable)->num_items
  16. #define reset_dTable(dtable)    sizeof_dTable(dtable) = 0
  17.  
  18.  
  19. #define INIT_dTable(dtable)            \
  20.     initialize_dTable(dtable,dTable_BLOBSIZE(dtable))
  21.  
  22.  
  23.  
  24. #define initial_dTable_data(name) { 0,0, dTable_BLOBSIZE(&name) }
  25.  
  26. #define dTable_BLOBSIZE(dtable) sizeof((dtable)->table[0])
  27.  
  28. #define DTABLE(blob)    \
  29.     unsigned int num_items, max_items; int blob_size; blob *table
  30. typedef struct { DTABLE(char); } dTable;
  31.  
  32. #endif /* __DTABLE_H_INCLUDED */
  33.