10 * Revision 1.1 2002/05/03 03:28:12 root
14 * 14 9/13/99 10:40a Mikeb
15 * Bumped up MISSION_TEXT_SIZE from 380000 to 390000 for ships.tbl ship
18 * 13 8/02/99 4:19p Andsager
19 * Bump up MISSION_TEXT_SIZE to 380000 for ships.tbl
21 * 12 5/03/99 10:10a Davidg
22 * DA: Bump Mission_text_size to handle large ship.tbl
24 * 11 2/19/99 11:10a Jasen
25 * Upped MISSION_TEXT_SIZE to 300000 (for souper cap)
27 * 10 2/03/99 6:06p Dave
28 * Groundwork for FS2 PXO usertracker support. Gametracker support next.
30 * 9 1/07/99 1:52p Andsager
31 * Initial check in of Sexp_variables
33 * 8 11/05/98 4:18p Dave
34 * First run nebula support. Beefed up localization a bit. Removed all
35 * conditional compiles for foreign versions. Modified mission file
38 * 7 10/26/98 9:42a Dave
39 * Early flak gun support.
41 * 6 10/22/98 6:14p Dave
42 * Optimized some #includes in Anim folder. Put in the beginnings of
43 * parse/localization support for externalized strings and tstrings.tbl
45 * 5 10/16/98 1:22p Andsager
46 * clean up header files
48 * 4 10/14/98 1:15p Andsager
51 * 3 10/14/98 12:25p Andsager
52 * Cleaned up and removed unnecessary include files
54 * 2 10/07/98 10:53a Dave
57 * 1 10/07/98 10:50a Dave
59 * 54 6/10/98 6:47p Lawrance
60 * Increase allowed mission length to 512, to accommodate longer French
63 * 53 5/20/98 2:27a Sandeep
65 * 52 4/30/98 4:53p John
66 * Restructured and cleaned up cfile code. Added capability to read off
67 * of CD-ROM drive and out of multiple pack files.
69 * 51 4/03/98 10:31a John
70 * Made briefing and debriefing arrays be malloc'd
72 * 50 3/30/98 6:22p Hoffoss
73 * Added a new parsing function.
75 * 49 3/29/98 12:55a Lawrance
76 * Get demo build working with limited set of data.
78 * 48 2/02/98 4:59p Hoffoss
79 * Added a promotion text field to rank.tbl and code to support it in
82 * 47 11/03/97 10:11p Hoffoss
83 * Added new split_str_once() function. Works similar to split_str(),
84 * only it only splits a string into 2 lines.
86 * 46 10/29/97 9:02a Jasen
87 * Raised MISSION_TEXT_SIZE limit to 128000.
89 * 45 10/17/97 3:12p Hoffoss
90 * Added a whitespace elimination function, and utilized it in briefing
93 * 44 10/15/97 4:46p Lawrance
94 * add drop_leading_whitespace() function
96 * 43 10/08/97 4:48p Dave
97 * Moved file id function into missionparse (from parselo). Finished
98 * tracker logging in and out of games. Changed how file checksumming
101 * 42 10/07/97 5:08p Dave
102 * Added file versioning/checksumming for multiplayer situations. Began
103 * master tracker changes for finalized version.
105 * 41 10/01/97 5:07p Hoffoss
106 * Weapon loadout load and save from fsm files added.
108 * 40 9/22/97 5:47p Lawrance
109 * re-write split_str() to allow special control words that don't get
110 * considered as part of printable string
112 * 39 9/09/97 3:39p Sandeep
113 * warning level 4 bugs
115 * 38 8/17/97 12:47p Hoffoss
116 * Changed code so I can force missions to load from the missions
117 * directory regardless of it's extension.
119 * 37 8/13/97 10:54a Hoffoss
120 * Added function to help extract only parts of a mission file.
122 * 36 7/22/97 5:38p Jasen
123 * Fixed bug with sexp error checking code. Wasn't accounting for player
124 * names in ship name lookup.
126 * 35 6/23/97 12:02p Lawrance
127 * move split_str() here, support \n's.
129 * 34 6/11/97 6:14p Hoffoss
130 * Made messages able to be longer.
132 * 33 4/28/97 3:30p Hoffoss
133 * Changed mission saving to not rely on required strings being present in
134 * mission files being overwritten.
136 * 32 4/22/97 4:50p Hoffoss
137 * Added some flexibility to stuff_string().
139 * 31 4/21/97 5:02p Hoffoss
140 * Player/player status editing supported, and both saved and loaded from
143 * 30 3/09/97 2:23p Allender
144 * Major changes to player messaging system. Added messages.tbl. Made
145 * all currently player messages go through new system. Not done yet.
147 * 29 3/04/97 11:19a Lawrance
148 * added stuff_booleanI() that recognizes 1/0 and YES/NO
150 * 28 2/18/97 9:52a Adam
151 * Raised parsing text max size limit (Jason)
153 * 27 1/31/97 12:07p John
154 * Add turret gun type on end of $subsystem line. Changed match_and_find
155 * to return index rather than stuffing it.
157 * 26 1/30/97 5:15p Mike
159 * Better named AI classes.
160 * Optional override of AI class in fsm file.
162 * 25 1/29/97 2:59p Mike
163 * Table-driven support for John's laser rendering.
164 * Null hook for AVI weapons.
166 * 24 1/17/97 3:50p Hoffoss
167 * Fred bug fixes and slight improvements in order to be able to create
170 * 23 12/12/96 3:06p Mike
171 * Fix bug in parsing code created by adding support for optional
172 * terminators in required_string.
174 * 22 12/12/96 2:35p Mike
177 * 21 12/11/96 3:31p Hoffoss
178 * Added support for more flexible ship cargos.
180 * 20 12/09/96 9:47a Hoffoss
181 * Fixed silly error. #define was in wrong file, so I moved it.
183 * 19 12/03/96 2:44p Mike
184 * Support for ship class and ship specific AI abilities: evasion,
185 * courage, patience, accuracy
187 * 18 11/15/96 1:43p Hoffoss
188 * Improvements to the Ship Dialog editor window. It is now an
189 * independant window that updates data correctly.
191 * 17 11/07/96 1:56p Allender
192 * externed function for use in sexp.cpp
194 * 16 10/30/96 9:05a Hoffoss
195 * Expanded mission file max size to 32k
197 * 15 10/29/96 3:28p Allender
198 * added stuff_string_list function.
200 * 14 10/28/96 12:18p Allender
201 * added a couple of functions to deal with getting and moving past
202 * strings on a whitespace only basis (instead ot to EOL)
204 * 13 10/23/96 11:06a Mike
206 * Revision 1.4 1996/09/24 13:50:41 mike
207 * Clean up some low level code in parselo.c.
208 * Add support for Player info in mission.txt.
210 * Revision 1.3 1996/09/23 20:42:03 allender
211 * added filename as parameter to read_mission_text
213 * Revision 1.2 1996/09/23 17:18:39 mike
214 * Split parse.h into parse.h and parselo.h
216 * Revision 1.1 1996/09/23 17:11:36 mike
228 #define MISSION_TEXT_SIZE 390000
230 extern char Mission_text[MISSION_TEXT_SIZE];
231 extern char Mission_text_raw[MISSION_TEXT_SIZE];
233 extern char *token_found;
234 extern int fred_parse_flag;
235 extern int Token_found_flag;
236 extern jmp_buf parse_abort;
239 #define COMMENT_CHAR (char)';'
240 #define EOF_CHAR (char)-128
241 #define EOLN (char)0x0a
247 #define F_MULTITEXTOLD 5 // needed for backwards compatability with old briefing format
250 #define F_SHIPCHOICE 8
251 #define F_MESSAGE 9 // this is now obsolete for mission messages - all messages in missions should now use $MessageNew and stuff strings as F_MULTITEXT
252 #define F_MULTITEXT 10
254 #define PATHNAME_LENGTH 192
255 #define NAME_LENGTH 32
256 #define SEXP_LENGTH 128
257 #define DATE_LENGTH 32
258 #define TIME_LENGTH 16
259 #define DATE_TIME_LENGTH 48
260 #define NOTES_LENGTH 1024
261 #define MULTITEXT_LENGTH 1024
262 #define FILESPEC_LENGTH 64
263 #define MESSAGE_LENGTH 512
265 #define SHIP_TYPE 0 // used to identify which kind of array to do a search for a name in
266 #define SHIP_INFO_TYPE 1
267 #define WEAPON_LIST_TYPE 2 // to parse an int_list of weapons
268 #define RAW_INTEGER_TYPE 3 // to parse a list of integers
269 #define WEAPON_POOL_TYPE 4
271 #define SEXP_SAVE_MODE 1
272 #define SEXP_ERROR_CHECK_MODE 2
275 extern int is_white_space(char ch);
276 extern void ignore_white_space();
277 extern void drop_trailing_white_space(char *str);
278 extern void drop_leading_white_space(char *str);
279 extern char *drop_white_space(char *str);
282 void ignore_gray_space();
285 extern int get_line_num();
286 extern char *next_tokens();
287 extern void diag_printf(char *format, ...);
288 extern void error_display(int error_level, char *format, ...);
291 extern int skip_to_string(char *pstr, char *end = NULL);
292 extern int skip_to_start_of_strings(char *pstr1, char *pstr2);
293 extern void advance_to_eoln(char *terminators);
294 extern void skip_token();
297 extern int required_string(char *pstr);
298 extern int optional_string(char *pstr);
299 extern int required_string_either(char *str1, char *str2);
300 extern int required_string_3(char *str1, char *str2, char *str3);
303 extern void copy_to_eoln(char *outstr, char *more_terminators, char *instr, int max);
304 extern void copy_text_until(char *outstr, char *instr, char *endstr, int max_chars);
305 extern void stuff_string_white(char *pstr);
306 extern void stuff_string(char *pstr, int type, char *terminators, int len = 0);
307 extern void stuff_string_line(char *pstr, int len);
309 // Exactly the same as stuff string only Malloc's the buffer.
310 // Supports various FreeSpace primitive types. If 'len' is supplied, it will override
311 // the default string length if using the F_NAME case.
312 char *stuff_and_malloc_string( int type, char *terminators, int len);
313 extern void stuff_float(float *f);
314 extern void stuff_int(int *i);
315 extern void stuff_byte(ubyte *i);
316 extern int stuff_string_list(char slp[][NAME_LENGTH], int max_strings);
317 extern int stuff_int_list(int *ilp, int max_ints, int lookup_type);
318 extern int stuff_vector_list(vector *vlp, int max_vecs);
319 extern void stuff_vector(vector *vp);
320 extern void stuff_matrix(matrix *mp);
321 extern int string_lookup(char *str1, char *strlist[], int max, char *description = NULL, int say_errors = 0);
322 extern void find_and_stuff(char *id, int *addr, int f_type, char *strlist[], int max, char *description);
323 extern int match_and_stuff(int f_type, char *strlist[], int max, char *description);
324 extern void find_and_stuff_or_add(char *id, int *addr, int f_type, char *strlist[], int *total,
325 int max, char *description);
326 extern int get_string(char *str);
327 extern void stuff_parenthesized_vector(vector *vp);
328 void stuff_boolean(int *i);
329 int check_for_string(char *pstr);
330 int check_for_string_raw(char *pstr);
333 extern void init_parse();
334 extern void reset_parse();
335 extern void display_parse_diagnostics();
336 extern void parse_main();
339 extern void mark_int_list(int *ilp, int max_ints, int lookup_type);
340 extern void compact_multitext_string(char *str);
341 extern void read_file_text(char *filename, int mode = CF_TYPE_ANY );
342 extern void debug_show_mission_text();
343 extern void convert_sexp_to_string(int cur_node, char *outstr, int mode);
344 char *split_str_once(char *src, int max_pixel_w);
345 int split_str(char *src, int max_pixel_w, int *n_chars, char **p_str, int max_lines, char ignore_char = -1);
348 extern int required_string_fred(char *pstr, char *end = NULL);
349 extern int required_string_either_fred(char *str1, char *str2);
350 extern int optional_string_fred(char *pstr, char *end = NULL, char *end2 = NULL);