home *** CD-ROM | disk | FTP | other *** search
/ The C Users' Group Library 1994 August / wc-cdrom-cusersgrouplibrary-1994-08.iso / vol_300 / 304_01 / roff5.lnk < prev    next >
Text File  |  1990-02-14  |  2KB  |  40 lines

  1. /*documentation of linked list structures used in roff4*/
  2. /*eeb jan 88*/
  3. /*all of dynamic usage (the heap) is found in area known as: */
  4. #define TRSIZ 2000
  5. char TRTBL[TRSIZ];
  6. typedef
  7. struct  {void *link;
  8.      char ident[1]; /*indefinitely long; terminated by \0 */
  9.     /*followed by integer, string, or pointer to structure*/
  10.     } entry ;  /*can be searched by find2()*/
  11. /*a series of intertwined linked lists are formed with last entries
  12.   pointed to by: */
  13. entry    *SLINK,    /* string substitution table */ /*insert(), showit()*/
  14.     *MLINK, /* macro substitution table */ /*minsert(),showm(),macq()*/
  15.         /*SLINK,MLINK table entries are following ident string
  16.             with second string used as replacement*/
  17.     *RLINK,    /* register substitution table;
  18.            ident string followed by int*/ /*showr(),regist()*/
  19.     *DLINK; /* diversion file table; ident string typically followed
  20.             by a pointer to divfd;  divfd contains
  21.             pointer to name, character count, line count, and
  22.             pointer returned by fopen() or NULL
  23.             if the associated file is not open*/
  24.         /*dodiv(),dsclose(),dclose(),showd()*/
  25.  
  26. entry   *TREND=(entry *)TRTBL;  /*used to know current end of
  27.                     TRTBL space usage*/
  28. /* addition of new entries consists of:
  29.     entry *pe;
  30.     char  *pc;
  31.     start();       {critical region}
  32.     pe = TREND;
  33.     pe->link = ?LINK;
  34.     pc = &pe.ident;
  35.     pc++ = stpcpy(pc, NAME);
  36.         Now pc points to where info should be placed;
  37.         Be sure to update TREND to point after last entry!
  38.         complete();   {end of critical region}
  39. */
  40.