1 // Emacs style mode select -*- C++ -*-
2 //----------------------------------------------------------------------------
3 //
4 // $Id: t_prepro.h 1548 2020-09-29 10:26:04Z wesleyjohnson $
5 //
6 // Copyright(C) 2000 Simon Howard
7 // Copyright (C) 2001-2011 by DooM Legacy Team.
8 //
9 // This program is free software; you can redistribute it and/or modify
10 // it under the terms of the GNU General Public License as published by
11 // the Free Software Foundation; either version 2 of the License, or
12 // (at your option) any later version.
13 //
14 // This program is distributed in the hope that it will be useful,
15 // but WITHOUT ANY WARRANTY; without even the implied warranty of
16 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17 // GNU General Public License for more details.
18 //
19 // You should have received a copy of the GNU General Public License
20 // along with this program; if not, write to the Free Software
21 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
22 //
23 // $Log: t_prepro.h,v $
24 // Revision 1.4  2003/05/04 04:19:06  sburke
25 // Don't typedef label_t on Solaris.
26 //
27 // Revision 1.3  2003/01/19 21:24:26  bock
28 // Make sources buildable on FreeBSD 5-CURRENT.
29 //
30 // Revision 1.2  2001/05/16 22:33:34  bock
31 // Initial FreeBSD support.
32 //
33 // Revision 1.1  2000/11/02 17:57:28  stroggonmeth
34 // FraggleScript files...
35 //
36 // Revision 1.1.1.1  2000/04/30 19:12:09  fraggle
37 // initial import
38 //
39 //
40 //--------------------------------------------------------------------------
41 
42 
43 #ifndef T_PREPRO_H
44 #define T_PREPRO_H
45 
46 
47 #define SECTIONSLOTS 17
48 #define LABELSLOTS 17
49 
50 
51 void preprocess(script_t *script);
52 
53 /***** {} sections **********/
54 typedef struct fs_section_s fs_section_t;
55 
56 struct fs_section_s
57 {
58   char *start;    // offset of starting brace {
59   char *end;      // offset of ending brace   }
60   int type;       // section type: for() loop, while() loop etc
61 
62   union
63   {
64     struct
65     {
66       char *loopstart;  // positioned before the while()
67     } data_loop;
68   } data; // data for section
69 
70   fs_section_t *next;        // for hashing
71 };
72 
73 fs_section_t * find_section_start(char *brace);
74 fs_section_t * find_section_end(char *brace);
75 
76 
77 typedef enum    // section types
78 {
79   FSST_empty,       // none: empty {} braces
80   FSST_if,          // if() statement
81   FSST_elseif,      // elseif() statement
82   FSST_else,        // else() statement
83   FSST_loop,        // loop
84 } fs_section_e;
85 
86 /****** goto labels ***********/
87 
88 #if 0
89 // Unused, no body.
90 // label_t is not present on Linux, or other major OS.
91 
92 #ifdef FREEBSD
93 #if __FreeBSD__ < 5
94 #include <machine/types.h>
95 #endif
96 #if __FreeBSD__ > 4
97 typedef struct label_s label_t;
98 #endif
99 #endif
100 
101 #if !defined(FREEBSD) && !defined(SOLARIS)
102 typedef struct label_s label_t;
103 #endif
104 
105 label_t * labelforname(char *labelname);
106 #endif
107 
108 #endif
109