summaryrefslogtreecommitdiff
path: root/web/tango-weevil/tango.h
blob: 834c0a02a54781ff004257219da8f9b39be6ec7c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
/*
    Tango/Weevil - A WEB Tangler and Weaver
    Copyright (C) 1995 Corey Minyard

    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

    Corey Minyard - minyard@metronet.com
*/


#define MAXLINESIZE 200

typedef struct linelist
{
   char *line;
   struct linelist *next;
} t_linelist;

typedef struct namelist
{
   char *name;
   struct namelist *next;
   union
   {
      int nest_val;
   } u;
} t_namelist;

typedef int bool;
#define TRUE 1
#define FALSE 0



typedef struct lpmac
{
   char *name;
   t_linelist *firstline;
   t_linelist *lastline;
   struct lpmac *next;
   char *filename;
   int  startline;
   t_namelist *staticdefs;
   t_namelist *globaldefs;
   t_namelist *pounddefs;
   t_namelist *uses;
} t_lpmac;

struct s_lptangodat;

typedef void (*input_scanner)(struct s_lptangodat *lptd,
			      char         *line,
			      int          length,
			      int          lineno);

typedef void (*linenum_output)(struct s_lptangodat *lptd,
			       int          lineno,
                               char         *filename);

typedef void (*scanner_init)(struct s_lptangodat *lptd);

typedef struct s_lptangodat
{
   FILE *infile;
   FILE *outfile;
   FILE *xreffile;
   char line[MAXLINESIZE];
   int outstate;
   char *curr_filename;
   int maxlinesize;
   int curr_lineno;
   t_lpmac *curr_macro;
   t_linelist *curr_line;
   t_lpmac *macros;
   char *start_macro;
   bool do_xref;
   bool auto_xref;
   bool instring;
   bool in_comment;
   bool do_linenums;
   void *code_info; /* Language-dependant info. */
   input_scanner scan_input;
   linenum_output output_linenum;
   int  retcode;    /* Program return code. */
} t_lptangodat;


void list_insert_unique(t_lptangodat *lptd,
			t_namelist   **list,
			t_namelist   *item);

t_namelist *find_name_in_list(t_lptangodat *lptd,
			      t_namelist *list,
			      t_namelist *item);

char *r_strtok(char *data,
	       char *sstr,
	       char **next_data);

char *stralloc(char *str,
	       int  length);

void free_namelist_item(t_lptangodat *lptd,
			t_namelist   *item);

t_namelist *create_namelist_item(t_lptangodat *lptd,
				 char         *str,
				 int          length);