home *** CD-ROM | disk | FTP | other *** search
/ Frozen Fish 1: Amiga / FrozenFish-Apr94.iso / bbs / alib / d5xx / d583 / aroff.lha / ARoff / Sources / aroff.h < prev    next >
C/C++ Source or Header  |  1992-01-04  |  5KB  |  167 lines

  1. #ifndef AZTEC_C
  2.  
  3. #include <stdio.h>
  4. #include <sys/types.h>
  5. #include <ctype.h>
  6. #include <time.h>
  7. #include <string.h>
  8. #include <fcntl.h>
  9.  
  10. #endif
  11.  
  12. /**** Definitions des constantes ***/
  13.  
  14. #define LGMAXNDF 255
  15. #define LGMAXBUF 512
  16. #define LGMAXSTR 255
  17.  
  18. #define IM_FILLING 0x01     /* filling on */
  19. #define IM_RDMACRO 0x02     /* defining macro */
  20. #define IM_EXMACRO 0x04     /* executing macro */
  21. #define IM_RDARGS  0x08     /* reading args. of request */
  22. #define IM_TRANSP  0x10     /* transparent mode */
  23. #define IM_STRING  0x20     /* inserting string */
  24.  
  25. #define AM_BOTH    1        /* mode d'ajustement */
  26. #define AM_RIGHT   2
  27. #define AM_LEFT    3
  28. #define AM_CENTER  4
  29.  
  30. #define DEF_LINLEN 80        /* valeurs par defaut */
  31. #define DEF_PAGLEN 66
  32. #define DEF_TITLEN 80
  33. #define DEF_INDENT 0
  34. #define DEF_PAGNUM 1
  35. #define DEF_LINSPC 1
  36. #define DEF_PAGOFS 0
  37. #define DEF_TABLEN 8
  38. #define DEF_TABCHR ' '
  39. #define DEF_LINNUM 1
  40. #define DEF_PILE   256
  41. #define DEF_TITSEQ 6
  42.  
  43. #define F_WASBS    0x0001    /* prev. char. was '\'   */
  44. #define F_WASNL    0x0002    /* prev. char. was '\n'  */
  45. #define F_SKIPEOL  0x0004    /* ignore until EOL     */
  46. #define F_NOBRK    0x0008    /* desactive do_br()     */
  47. #define F_NEWPAR   0x0010    /* new section (2 \n)    */
  48. #define F_NOTI       0x0020    /* derniere req != "ti"  */
  49. #define F_BREAKED  0x0040    /* ligne "cassee" (.br)  */
  50. #define F_NUMBER   0x0080    /* numerote les lignes     */
  51. #define F_MACREQ   0x0100    /* exec requete/macro     */
  52. #define F_TRAP       0x0200    /* trappe declanchee     */
  53. #define F_SORTIE   0x0400    /* au moins 1 lig sortie */
  54. #define F_CONTINUE 0x0800    /* continue et non break */
  55. #define F_WASIF    0x1000    /* derniere req == 'if'  */
  56. #define F_WASFALSE 0x2000    /* dernier 'if' faux     */
  57. #define F_IFNOT    0x4000    /* .if ! <reste>     */
  58. #define F_LOADED   0x8000    /* option -l indiquee     */
  59.  
  60. #define SC_IGNORE  '\001'
  61. #define SC_FIXSPC  '\002'
  62. #define SC_EXPAND  '\003'
  63.  
  64. #define ERR_INTERNAL    0    /* erreur interne....  */
  65. #define ERR_PILEV    1    /* pile vide           */
  66. #define ERR_PILEP    2    /* pile pleine           */
  67. #define ERR_SYNTAX    3    /* erreur de syntaxe   */
  68. #define ERR_OVERFLOW    4    /* debordement table   */
  69. #define ERR_OPEN    5    /* err. ouverture fic. */
  70. #define ERR_ARGS    6    /* args. incorrects    */
  71. #define ERR_WRITE    7    /* erreur en ecriture  */
  72. #define ERR_MEMORY    8    /* plus de memoire     */
  73. #define ERR_IFELSE    9    /* else sans if        */
  74. #define ERR_SEEK       10    /* lseek() a echoue    */
  75. #define ERR_READ       11    /* erreur de lecture   */
  76. #define ERR_EMPTY      12    /* fichier vide        */
  77.  
  78. #define BSET( f , b ) f |= b
  79. #define BCLR( f , b ) f &= ~b
  80. #define Fatal( c ) FatalError( c , __LINE__ , __FILE__ )
  81.  
  82. /*****************************************************************/
  83.  
  84. struct Noeud
  85. {
  86.   struct Noeud *el_Suivant ;
  87.   struct Noeud *el_Precedant ;
  88. } ;
  89.  
  90. struct TeteListe
  91. {
  92.   struct Noeud *tl_Premier ;
  93.   struct Noeud *tl_Dernier ;
  94.   long        tl_NbrElem ;
  95. } ;
  96.  
  97. /************************************************************************/
  98.  
  99. struct MLine
  100. {
  101.   struct Noeud    ml_Node ;        /* ptr ligne suiv. */
  102.   long        ml_Len ;        /* taille ligne    */
  103.   unsigned char ml_Text[LGMAXSTR] ;    /* ligne elle-meme */
  104. } ;
  105.  
  106. struct Macro
  107. {
  108.   struct Noeud       m_Node ;    /* ptr macro suivante */
  109.   char           m_Name[3] ;    /* nom de cette macro */
  110.   long           m_Flag ;    /* indicateurs divers */
  111.   struct TeteListe m_Def ;    /* tete liste lignes  */
  112.   struct MLine      *m_NextL ;    /* ptr ligne a lire   */
  113.   long           m_NextC ;    /* ptr caract. a lire */
  114.   long           m_NbArg ;    /* nombre d'arguments */
  115.   unsigned char   *m_Arg[10] ;    /* args. */
  116. } ;
  117.  
  118. #define MF_TRAP 0x01    /* appele par une trappe */
  119. #define MF_WAIT 0x02    /* a une ligne en attente */
  120.  
  121. struct InputFile
  122. {
  123.   struct Noeud    if_Node ;    /* ptr fichier suivant */
  124.   char        *if_Name ;    /* nom de ce fichier   */
  125.   int        if_Desc ;    /* retourne par open() */
  126.   unsigned char *if_Buf ;    /* tampon de lecture   */
  127.   long        if_BufLen ;    /* nb de car. ds ifBuf */
  128.   long        if_NextC ;    /* ptr caract. a lire  */
  129.   long        if_Line ;    /* no ligne courante   */
  130.   long        if_Flag ;    /* indicateurs           */
  131. } ;
  132.  
  133. #define IFF_STDIN  0x01  /* fichier = entree standard */
  134. #define IFF_LOADED 0x02  /* fichier charge en memoire */
  135.  
  136. struct Command
  137. {
  138.   char *c_name ;
  139.   void (*c_func)() ;
  140. } ;
  141.  
  142. struct String
  143. {
  144.   long    s_pos ;
  145.   long    s_len ;
  146.   char    s_val[LGMAXSTR+1] ;
  147. } ;
  148.  
  149. struct Contexte
  150. {
  151.   union
  152.   {
  153.     struct InputFile c_file ;
  154.     struct Macro     c_macro ;
  155.     struct String    c_string ;
  156.   } src ;
  157.   long           c_ptr  ;
  158.   long           c_len  ;
  159.   long           c_olen ;
  160.   char           c_obuf[LGMAXBUF] ;
  161.   char           c_ibuf[LGMAXBUF] ;
  162.   long           c_seek ;
  163.   long           c_imod ;
  164.   long           c_flag ;
  165. } ;
  166.  
  167.