home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 22 gnu / 22-gnu.zip / fweb153.zip / fweb-1.53 / web / tokens.hweb < prev    next >
Text File  |  1995-09-23  |  2KB  |  54 lines

  1. @z --- tokens.hweb ---
  2.  
  3. FWEB version 1.53 (September 23, 1995)
  4.  
  5. Based on version 0.5 of S. Levy's CWEB [copyright (C) 1987 Princeton University]
  6.  
  7. @x-----------------------------------------------------------------------------
  8.  
  9. @ A third large area of memory is used for sixteen-bit `tokens', which
  10. appear in short lists similar to the strings of characters in |byte_mem|.
  11. Token lists are used to contain the result of \cee\ code translated into
  12. \TeX\ form; further details about them will be explained later. A
  13. \&{text\_pointer} variable is an index into |tok_start|.
  14.  
  15. @D app(a) *(tok_ptr++)=a /* Ordinary token */
  16. @m APP_FLAG(type,top,base) app(type##_flag + PTR_DIFF(sixteen_bits,top,base))
  17. @d APP_ID APP_FLAG(id,id_lookup(id_first,id_loc,normal),name_dir)
  18. @D app1(a) APP_FLAG(tok,(a)->trans,tok_start) /* Store translation
  19.         as token list; should translate to the following: */
  20. @#if 0
  21. @d app1(a) *(tok_ptr++)=tok_flag+(a)->trans-tok_start 
  22. @#endif
  23.  
  24. @f token_pointer int
  25. @f text_pointer int
  26.  
  27. @<Typed...@>=
  28.  
  29. typedef sixteen_bits Token;
  30. typedef Token HUGE *token_pointer;
  31. typedef token_pointer HUGE *text_pointer;
  32.  
  33. @ The first position of |tok_mem| that is unoccupied by replacement text is
  34. called |tok_ptr|, and the first unused location of |tok_start| is called
  35. |text_ptr|.  Thus, we usually have |tok_start[text_ptr]=tok_ptr|.
  36.  
  37. @<Global...@>=
  38.  
  39. EXTERN long max_toks; /* number of symbols in \cee\ texts being parsed;
  40.   must be less than |@r 65536 == 2^16|. */
  41. EXTERN Token HUGE *tok_mem; // Dynamic array of tokens.
  42. EXTERN token_pointer tok_m_end; // End of |tok_mem|.
  43.  
  44. EXTERN long max_texts; /* number of phrases in \cee\ texts being parsed;
  45.   must be less than |ID_FLAG|. */
  46. EXTERN token_pointer HUGE *tok_start; // Dynamic directory into |tok_mem|.
  47. EXTERN text_pointer tok_end; // End of |tok_start|.
  48.  
  49. EXTERN token_pointer tok_ptr; // First unused position in |tok_mem|.
  50. EXTERN text_pointer text_ptr; // First unused position in |tok_start|.
  51.  
  52. EXTERN token_pointer mx_tok_ptr; // Largest value of |tok_ptr|.
  53. EXTERN text_pointer mx_text_ptr; // Largest value of |text_ptr|.
  54.