home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 5 Edit / 05-Edit.zip / txict100.zip / texicvt1.00 / source / info.h < prev    next >
C/C++ Source or Header  |  1997-03-31  |  6KB  |  216 lines

  1. /*
  2. ================================================================================
  3.                         Texinfo converting Tools
  4.                          Release 1.00 28.03.97
  5.                        (c) 1996 by Andreas Kaiser
  6.                     (c) 1997 by Karl Heinz Marbaise
  7. ================================================================================
  8.  
  9. Discription:
  10.     Header which is used for all converters
  11.     (should be changed)
  12.  
  13. Authors:
  14.    Andreas Kaiser
  15.    Karl Heinz Marbaise
  16.  
  17. e-mail:
  18.    Internet: KHMarbaise@p69.ks.fido.de
  19.    Fido-net: 2:2452/117.69
  20.  
  21. Bugs, question:
  22.    to above e-mail adress.
  23.  
  24. Register:
  25.    Please send a e-mail to above adress to register.
  26.    (include the release you want to register)
  27.    This registration should be done to let me
  28.    know how many people using these tools and
  29.    if it is worth to invest more time in continuing
  30.    development these tools or let the first release
  31.    of them be the last.
  32.    That is the only reason to make a registration.
  33.    I think a e-mail is not to much, isn't it?
  34.  
  35. License:
  36.    The "Texinfo converting tools" are free software;
  37.    you can redistribute it and/or modify it under the terms of
  38.    the GNU General Public License as published by the Free
  39.    Software Foundation; either version 2, or (at your option)
  40.    any later version.
  41.  
  42.    The "Texinfo converting tools" are distributed in the hope that
  43.    they will be useful, but WITHOUT ANY WARRANTY; without even the
  44.    implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
  45.    PURPOSE.  See the GNU General Public License for more details.
  46.  
  47.    You should have received a copy of the GNU General Public License
  48.    along with the "Texinfo converting tools" ; see the file COPYING.
  49.    If not, write to the:
  50.    Free Software Foundation,
  51.    59 Temple Place - Suite 330,
  52.    Boston, MA 02111-1307, USA.
  53.  
  54.    See \texicvt1.00\COPYING for details.
  55.  
  56. ================================================================================
  57. */
  58.  
  59. #include <iostream.h>
  60. #if defined (__EMX__)
  61. #include <Strng.h>
  62. #else
  63. #include <String.h>
  64. #endif
  65. #include <stdlib.h>
  66. #include <string.h> /* default C string lib */
  67.  
  68. #define FontSize    "17x10"
  69.  
  70. const int    MaxW    = 20;
  71.  
  72. #ifndef EXTERN
  73.  #define EXTERN extern
  74.  #define INIT(x)
  75. #endif
  76.  
  77. struct Name {
  78.     Name (int i, int d = 0, int l = 0)  { id = i; defined = d; level = l; }
  79.     int    defined;
  80.     int    id;
  81.     int    level;
  82. };
  83.  
  84. struct XItem {
  85.     XItem ()            : title("?") { id = 0; }
  86.     XItem (String& str, int num)    : title(str) { id = num; }
  87.     String title;
  88.     int id;
  89. };
  90.  
  91. //#include "XItem_SLBag.h"
  92. #include "xi_slbag.h"
  93.  
  94. typedef class XItemSLBag XEntry;
  95.  
  96. //#include "String_XEntry_AVLMap.h"
  97. #include "strxeavl.h"
  98.  
  99. typedef class StringXEntryAVLMap XClassT;
  100.  
  101. struct XClass {
  102.     XClass () : entries(XEntry()) {}
  103.     XClassT entries;
  104. };
  105.  
  106. //#include "String_XClass_VHMap.h"
  107. #include "strxcvhm.h"
  108.  
  109. typedef class StringXClassVHMap Index;
  110.  
  111. typedef class StringNameAVLMap Table;
  112. typedef class StringStringAVLMap Flags;
  113.  
  114. //#include "String_Name_AVLMap.h"
  115. #include "strnavlm.h"
  116. //#include "String_String_AVLMap.h"
  117. #include "strsavlm.h"
  118.  
  119. EXTERN int    fnid    INIT(0);        // footnote id
  120. EXTERN int    hdid    INIT(0);        // heading id
  121.  
  122. EXTERN String    node_name;            // name of last node
  123. EXTERN int    node_id;            // heading id of last node
  124.  
  125. EXTERN String    panel_name;            // heading name of last panel
  126. EXTERN int    panel_id;            // heading id of last panel
  127.  
  128. EXTERN int    yylineno INIT(1);        // input line number
  129.  
  130. EXTERN Flags    flags    INIT(Flags(String((const char *)"")));    // TexInfo flags
  131. EXTERN Table    table    INIT(Table(Name(0, 0, 0)));    // table of menu nodes
  132. EXTERN Index    indexes    INIT(Index(XClass(), 10));    // 2-dim index
  133.  
  134. EXTERN ostream *out    INIT(&cout);        // current output stream
  135.                         
  136. EXTERN String    w[MaxW];            // result of words()
  137. EXTERN String    null    INIT("");        // the null string
  138.  
  139. EXTERN int    debug;                // trace parser
  140. EXTERN int    f_node;                // use chapters(0) or nodes(1)
  141. EXTERN int    f_index;            // create INF index
  142.  
  143. EXTERN int      IncludeFile;
  144.     // scan.l
  145. extern int    yylex();
  146. extern void    newline();
  147.  
  148.     // util.cc
  149. extern void    words(String&);
  150. extern void    spaced(String&);
  151. extern void    heading(int level, const char *s);
  152. extern void    footnote();
  153. extern void    item_begin (const char *beg, int it, char *ic);
  154. extern void    item_end (const char *end);
  155. extern void    node(String name, String next, String prev, String up);
  156. extern void    xref(char *see, String name, String entry, String topic, String file, String manual);
  157. extern void    define(String& s, int xflag, const char *index, int typeflag, int argflag, const char *category);
  158.  
  159. extern void    font(const char *name, const char *size = FontSize);
  160. extern void    beg_example(const char *);
  161. extern void    end_example();
  162. extern int    margin(int);
  163. extern void    single_word(const char *text);
  164. extern void    para();
  165.  
  166. extern void    indexref(const char *name, const String& text);
  167. extern void    printindex(String& name);
  168.  
  169. extern void    setflag(String&);
  170.  
  171. struct Item {
  172.     Item (char *name = 0, int num = 0, char *text = 0)
  173.         { fontname = name; hpnumber = num; delimiter = text; }
  174.     char *    fontname;    // item font
  175.     int    hpnumber;    // :hp number
  176.     char *    delimiter;    // delimiter text
  177. };
  178.  
  179. struct ItemType {
  180.     Item    beg;        // before item
  181.     Item    end;        // after item
  182.     int    type;        // 'o' = ordered list, 'l' = unordered list,
  183.                 // 'p' = parameters
  184.     char *    cat;        // "Function", "Variable", 0
  185.     short    indent;        // indentation level
  186.     short    nested;        // is nested
  187.     short    count;        // item counter
  188.  
  189.     void item (const char *text);
  190. };
  191.  
  192. struct Menu {
  193.     String    line;
  194.     void    flush();
  195. };
  196.  
  197. EXTERN Menu    menu;
  198.  
  199. EXTERN int    nofill;                // don't care about paragraphs
  200.  
  201. EXTERN ItemType   istack[50];
  202. EXTERN ItemType * istackp INIT(istack);
  203.  
  204. EXTERN int    plines[10];            // line number where arg starts
  205. EXTERN int    plevel;                // scanner level (index to plines)
  206. EXTERN int    newpara;            // new paragraph required
  207. EXTERN int    lastnl;                // last is newline
  208.  
  209. #define PUT(x)    {*out << x; lastnl = 0;}
  210. #define PUTS(x)    {if (newpara) para(); *out << x; lastnl = 0;}
  211. #define PUTA(x)    {if (!plevel) { if (newpara) para(); *out << x; lastnl = 0;}}
  212. #define PUTL()    {*out << endl; lastnl = 1;}
  213.  
  214.  
  215.  
  216.