home *** CD-ROM | disk | FTP | other *** search
/ Club Amiga de Montreal - CAM / CAM_CD_1.iso / files / 211.lha / Spiff / line.h.orig < prev    next >
Text File  |  1996-02-14  |  4KB  |  114 lines

  1. /*                        Copyright (c) 1988 Bellcore
  2. **                            All Rights Reserved
  3. **       Permission is granted to copy or use this program, EXCEPT that it
  4. **       may not be sold for profit, the copyright notice must be reproduced
  5. **       on copies, and credit should be given to Bellcore where it is due.
  6. **       BELLCORE MAKES NO WARRANTY AND ACCEPTS NO LIABILITY FOR THIS PROGRAM.
  7. */
  8.  
  9.  
  10. #ifndef L_INCLUDED
  11.  
  12. #define _L_MAXLINES    10000
  13.  
  14. /*
  15. **    oh god, is this an ugly implementation.
  16. **    I really should have a two dimensional array of structures
  17. **        the history of the current arrangement is too long
  18. **        and ugly to record here.
  19. **        Someday when I have too much time on my hands . . .
  20. */
  21.  
  22. extern char *_L_al[];    /* storage for text in first file */
  23. extern char *_L_bl[];    /* storage for text in second file */
  24.  
  25. extern int _L_ai[];    /* pointer from token line to first token */
  26. extern int _L_bi[];
  27.  
  28. extern int _L_ac[];    /* number of tokens on a given token line */
  29. extern int _L_bc[];
  30.  
  31. extern int _L_aclindex[]; /* mapping from content lines to real lines */
  32. extern int _L_bclindex[];
  33.  
  34. extern int _L_atlindex[]; /* mapping from lines with tokens to content lines */
  35. extern int _L_btlindex[];
  36.  
  37. extern int _L_arlm;    /* count of real lines */
  38. extern int _L_brlm;
  39.  
  40. extern int _L_aclm;    /* count of content lines */
  41. extern int _L_bclm;
  42.  
  43. extern int _L_atlm;    /* count of lines with tokens */
  44. extern int _L_btlm;
  45.  
  46. /*
  47. **    routines to set up mappings from token lines to content lines
  48. **      and from content lines to real lines
  49. */
  50. #define L_setclindex(file,content,real) (file?(_L_bclindex[content]=real):\
  51.                          (_L_aclindex[content]=real))
  52.  
  53. #define L_settlindex(file,token,content) (file?(_L_btlindex[token]=content):\
  54.                           (_L_atlindex[token]=content))
  55. /*
  56. **    get line number X from file
  57. */
  58. #define L_getrline(file, X)     (file?(_L_bl[X]):(_L_al[X]))
  59. #define L_getcline(file, X)     (file?(_L_bl[_L_bclindex[X]]):\
  60.                        (_L_al[_L_aclindex[X]]))
  61. #define L_gettline(file, X)     (file?(_L_bl[_L_bclindex[_L_btlindex[X]]]):\
  62.                        (_L_al[_L_aclindex[_L_atlindex[X]]]))
  63.  
  64. #define L_cl2rl(file, X)     (file?(_L_bclindex[X]):\
  65.                        (_L_aclindex[X]))
  66. #define L_tl2cl(file, X)     (file?(_L_btlindex[X]):\
  67.                        (_L_atlindex[X]))
  68. #define L_tl2rl(file, X)     (file?(_L_bclindex[_L_btlindex[X]]):\
  69.                        (_L_aclindex[_L_atlindex[X]]))
  70.  
  71. /*
  72. **    get number of first token on line X of the file
  73. */
  74. #define L_getindex(file,X)    (file?(_L_bi[X]):(_L_ai[X]))
  75.  
  76. /*
  77. **    get count of number of tokens on line X of first file
  78. */
  79. #define L_getcount(file,X)    (file?(_L_bc[X]):(_L_ac[X]))
  80.  
  81. /*
  82. **    save number of first token for line X of file
  83. */
  84. #define L_setindex(file,index,value)    (file?(_L_bi[index]=value):(_L_ai[index]=value))
  85. /*
  86. **    save count of tokens on line X of file
  87. */
  88. #define L_setcount(file,index,value)    (file?(_L_bc[index]=value):(_L_ac[index]=value))
  89. #define    L_inccount(file,index)        (file?(_L_bc[index]++):(_L_ac[index]++))
  90.  
  91. /*
  92. **    retrieve line and token counts
  93. */
  94. #define L_getrlmax(file)    (file?_L_brlm:_L_arlm)
  95. #define L_getclmax(file)    (file?_L_bclm:_L_aclm)
  96. #define L_gettlmax(file)    (file?_L_btlm:_L_atlm)
  97.  
  98. /*
  99. **    set line and token counts
  100. */
  101. #define _L_setrlmx(file,value)    (file?(_L_brlm=(value)):(_L_arlm=(value)))
  102. #define L_setclmax(file,value)    (file?(_L_bclm=(value)):(_L_aclm=(value)))
  103. #define L_settlmax(file,value)    (file?(_L_btlm=(value)):(_L_atlm=(value)))
  104.  
  105. /*
  106. **    increment line and token counts
  107. */
  108. #define    _L_incrlmx(file)        (file?(_L_brlm++):(_L_arlm++))
  109. #define    L_incclmax(file)        (file?(_L_bclm++):(_L_aclm++))
  110. #define    L_inctlmax(file)        (file?(_L_btlm++):(_L_atlm++))
  111.  
  112. #define L_INCLUDED
  113. #endif
  114.