home *** CD-ROM | disk | FTP | other *** search
/ vis-ftp.cs.umass.edu / vis-ftp.cs.umass.edu.tar / vis-ftp.cs.umass.edu / pub / Software / ASCENDER / ascender.tar.Z / ascender.tar / Triangulate / include / table.h < prev    next >
C/C++ Source or Header  |  1995-04-13  |  2KB  |  75 lines

  1. /* @(#)table.h    3.11  12/21/94 */
  2. #ifndef table_h
  3. #define table_h 
  4.  
  5. #ifndef DATADEF
  6. #define DATADEF
  7. typedef char *DATA;
  8. #endif
  9.  
  10. #include "rh_util.h"
  11. #include "list.h"
  12.  
  13. typedef struct TABLEENTRY
  14.    {
  15.    DATA data;
  16.    struct TABLEENTRY *tbl_left, *tbl_right;
  17.    char tbl_leftleaf, tbl_rightleaf;
  18.    char tbl_BF;
  19.    } TABLE, TABLEENTRY;
  20.  
  21. #define tbl_forall(type,x,y) tbl_forinorder(type,x,y)
  22.  
  23. #define tbl_forinorder(type,x,y)                     \
  24.     {                                \
  25.     register type x;                        \
  26.     register TABLEENTRY *tbl_cursor;                \
  27.     for(tbl_cursor=tbl_firstentry(y);                \
  28.         tbl_cursor?(x=(type)tbl_cursor->data,TRUE):FALSE;    \
  29.         tbl_cursor=tbl_nextentry(tbl_cursor))            \
  30.        {
  31.  
  32. #define tbl_forbackwards(type,x,y)                     \
  33.     {                                \
  34.     register type x;                        \
  35.     register TABLEENTRY *tbl_cursor;                \
  36.     for(tbl_cursor=tbl_lastentry(y);                \
  37.         tbl_cursor?(x=(type)tbl_cursor->data,TRUE):FALSE;    \
  38.         tbl_cursor=tbl_preventry(tbl_cursor))            \
  39.        {
  40.  
  41. #define tbl_forallentries(tbl_cursor,y)                 \
  42.     {                                \
  43.     register TABLEENTRY *tbl_cursor;                \
  44.     for(tbl_cursor=tbl_firstentry(y);                \
  45.         tbl_cursor;                        \
  46.         tbl_cursor=tbl_nextentry(tbl_cursor))            \
  47.        {
  48.  
  49. #define tbl_forpreorder(type,x,y)                     \
  50.     {                                \
  51.     register type x;                        \
  52.     register TABLEENTRY *tbl_cursor;                \
  53.     for(tbl_cursor=(y);                        \
  54.         tbl_cursor?(x=(type)tbl_cursor->data,TRUE):FALSE;    \
  55.         tbl_cursor=tbl_nextpreorder(tbl_cursor))        \
  56.        {
  57.  
  58. #define tbl_endall }}
  59.  
  60. #define tbl_free(atable)                        \
  61.     {                                \
  62.     tbl_forallentries (anentry, (atable))                \
  63.        free (anentry);                        \
  64.     tbl_endall                            \
  65.     atable = NULL;                            \
  66.     }
  67.  
  68. /*>>
  69. External function definitions.
  70. <<*/
  71.  
  72. #include "table.s"
  73.  
  74. #endif
  75.