1 /*
2   Copyright (C) 1999, 2000 Florian Schintke
3   Copyright (C) 1999       Martin Kammerhofer for the CGI feature
4   Copyright (C) 2000       Rob Ewan           for the indexing feature
5 
6   This is free software; you can redistribute it and/or modify it under
7   the terms of the GNU General Public License as published by the Free
8   Software Foundation; either version 2, or (at your option) any later
9   version.
10 
11   This is distributed in the hope that it will be useful, but WITHOUT
12   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13   FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
14   for more details.
15 
16   You should have received a copy of the GNU General Public License with
17   the c2html, java2html, pas2html or perl2html source package as the
18   file COPYING. If not, write to the Free Software Foundation, Inc.,
19   59 Temple Place - Suite 330, Boston, MA
20   02111-1307, USA.
21 */
22 
23 /* This .h file contains some functions implemented in
24    .l file from the lex scanner or in the mymain.c */
25 
26 /*
27   Functions implemented in the .l file and called
28   from mymain.c
29 */
30 extern void StartNewYylex(FILE * in, FILE * out);
31 
32 /*
33   Functions implemented in the mymain.c file and called
34   from the .l file
35 */
36 enum weight_enum {NO_CHANGE, NORMAL, BOLD};
37 typedef enum weight_enum weight_type;
38 
39 typedef struct {
40   /* This variables are initialized in MyMain() in mymain.c */
41   int   nocgi;       /* != 0 must not generate HTTP headers; set with -c */
42   int   noheaders;   /* != 0 suppress html headers;          set with -s */
43   int   linelabeling;/* != 0 label lines with numbers;       set with -n */
44   int   width;       /* width of output (default 80);        set with -w */
45   int   indexOnly;   /* != 0, only output generated NAME's   set with -i */
46   char  *title;      /* title of the generated html file;    set with -t */
47   char  *prog;       /* name of the program running                      */
48   char  *headfile;   /* file inserted before converting;     set with -h */
49   char  *bottomfile; /* file inserted after converting;      set with -b */
50   /* internally used while converting files */
51   /* the following part must be reinitialized if we start a new file */
52   /* this is done in the function StartNewYylex() */
53   int         lineNumber;
54   int         needLabel;
55   char        *currentColor;
56   weight_type currentWeight;
57   int         suppressOutput; /* Variable - used to control output for -i */
58 } config_type;
59 
60 extern config_type config;
61 int
62 MyMain(int argc, char *argv[]);
63 void
64 MyStringOutput(FILE *, char *);
65 
66 void
67 EndLabelTag( FILE *, char *); /* For indexing */
68 
69 /* Add a label a function */
70 /* Therefor search for the first opening parenthesis */
71 /* and use the word before as label name. */
72 void
73 AddLabelForFunction(FILE *, char *);
74 
75 /* Add a label for a class */
76 void
77 AddLabelForClass(FILE *, char *);
78 
79 /* Add a label for a struct */
80 void
81 AddLabelForStruct(FILE *, char *);
82 
83 /* Change the font and the weight
84  * If color is a NULL pointer the FONT will be closed if
85  * one is opened.
86  * Generate the tags alway so that FONT is contained in an
87  * STRONG if weight is BOLD.
88  * Generate the tags in a flat structure (no nested fonts)
89  */
90 void
91 ChangeFontTo(FILE *out, char *color, weight_type weight);
92 
93 /*
94   Functions implemented in the mymain.c file and called
95   from the mymain.c file
96 */
97 
98 /*
99  * insert the file "filename" in the current directory (or if given the
100  * complete path this file) into the output "outfile".
101  */
102 int
103 Insert (FILE * outfile, char *filename);
104 
105 /*
106  * print usage information
107  */
108 void
109 PrintUsage();
110 
111 /*
112  * Parse parameters and set the configuration in global
113  * variable config. Return the number of commandline
114  * parameters parsed, so the caller can skip them.
115  */
116 int
117 ParseParameters(int argc,char *argv[]);
118 
119 /*
120  * print the current configuration
121  */
122 void
123 PrintConfig(FILE * output);
124 
125 /*
126  * decide whether CGI script or not
127  */
128 int
129 IsCGI();
130 
131 /*
132  * write CGI header
133  */
134 void
135 PrintCGIHeader();
136 
137 /*
138  * write html headers if necessary
139  * insert head and bottom file if recommended
140  * convert the file from actin and give it to actout
141  * use name as title if title is not set explicit
142  * use "stdin" as title if name is NULL
143  */
144 void
145 ConvertFile(char * name);
146