FS2_Open
Open source remastering of the Freespace 2 engine
|
#include "cfile/cfile.h"
#include "globalincs/globals.h"
#include "globalincs/pstypes.h"
#include <exception>
Go to the source code of this file.
Classes | |
class | parse::ParseException |
Namespaces | |
parse | |
Macros | |
#define | MISSION_TEXT_SIZE 1000000 |
#define | COMMENT_CHAR (char)';' |
#define | EOF_CHAR (char)-128 |
#define | EOLN (char)0x0a |
#define | F_NAME 1 |
#define | F_DATE 2 |
#define | F_NOTES 3 |
#define | F_FILESPEC 4 |
#define | F_MULTITEXTOLD 5 |
#define | F_SEXP 6 |
#define | F_PATHNAME 7 |
#define | F_SHIPCHOICE 8 |
#define | F_MESSAGE 9 |
#define | F_MULTITEXT 10 |
#define | F_RAW 11 |
#define | F_LNAME 12 |
#define | PARSE_BUF_SIZE 4096 |
#define | SHIP_TYPE 0 |
#define | SHIP_INFO_TYPE 1 |
#define | WEAPON_LIST_TYPE 2 |
#define | RAW_INTEGER_TYPE 3 |
#define | WEAPON_POOL_TYPE 4 |
#define | NOT_SET_BY_SEXP_VARIABLE -1 |
#define | MISSION_LOADOUT_SHIP_LIST 0 |
#define | MISSION_LOADOUT_WEAPON_LIST 1 |
#define | CAMPAIGN_LOADOUT_SHIP_LIST 2 |
#define | CAMPAIGN_LOADOUT_WEAPON_LIST 3 |
#define | SEXP_SAVE_MODE 1 |
#define | SEXP_ERROR_CHECK_MODE 2 |
#define | PARSING_FOUND_STRING 0 |
#define | PARSING_FOUND_VARIABLE 1 |
Functions | |
bool | end_string_at_first_hash_symbol (char *src) |
bool | end_string_at_first_hash_symbol (SCP_string &src) |
char * | get_pointer_to_first_hash_symbol (char *src) |
const char * | get_pointer_to_first_hash_symbol (const char *src) |
int | get_index_of_first_hash_symbol (SCP_string &src) |
int | is_white_space (char ch) |
void | ignore_white_space () |
void | drop_trailing_white_space (char *str) |
void | drop_leading_white_space (char *str) |
char * | drop_white_space (char *str) |
void | drop_trailing_white_space (SCP_string &str) |
void | drop_leading_white_space (SCP_string &str) |
void | drop_white_space (SCP_string &str) |
int | is_gray_space (char ch) |
void | ignore_gray_space () |
int | get_line_num () |
char * | next_tokens () |
void | diag_printf (char *format,...) |
void | error_display (int error_level, char *format,...) |
int | skip_to_string (char *pstr, char *end=NULL) |
int | skip_to_start_of_string (char *pstr, char *end=NULL) |
int | skip_to_start_of_string_either (char *pstr1, char *pstr2, char *end=NULL) |
void | advance_to_eoln (char *terminators) |
void | skip_token () |
int | optional_string (const char *pstr) |
int | optional_string_either (char *str1, char *str2) |
int | optional_string_one_of (int arg_count,...) |
int | required_string (const char *pstr) |
int | required_string_either (char *str1, char *str2) |
Checks for one of two required strings. More... | |
int | required_string_one_of (int arg_count,...) |
Checks for one of any of the given required strings. More... | |
void | copy_to_eoln (char *outstr, char *more_terminators, char *instr, int max) |
void | copy_text_until (char *outstr, char *instr, char *endstr, int max_chars) |
void | stuff_string_white (char *outstr, int len=0) |
void | stuff_string_until (char *outstr, char *endstr, int len=0) |
void | stuff_string (char *outstr, int type, int len, char *terminators=NULL) |
void | stuff_string_line (char *outstr, int len) |
void | copy_to_eoln (SCP_string &outstr, char *more_terminators, char *instr) |
void | copy_text_until (SCP_string &outstr, char *instr, char *endstr) |
void | stuff_string_white (SCP_string &outstr) |
void | stuff_string_until (SCP_string &outstr, char *endstr) |
void | stuff_string (SCP_string &outstr, int type, char *terminators=NULL) |
void | stuff_string_line (SCP_string &outstr) |
char * | alloc_block (char *startstr, char *endstr, int extra_chars=0) |
char * | stuff_and_malloc_string (int type, char *terminators=NULL) |
void | stuff_malloc_string (char **dest, int type, char *terminators=NULL) |
void | stuff_float (float *f) |
int | stuff_float_optional (float *f, bool raw=false) |
int | stuff_int_optional (int *i, bool raw=false) |
void | stuff_int (int *i) |
void | stuff_ubyte (ubyte *i) |
int | stuff_string_list (SCP_vector< SCP_string > &slp) |
int | stuff_string_list (char slp[][NAME_LENGTH], int max_strings) |
int | parse_string_flag_list (int *dest, flag_def_list defs[], int defs_size) |
int | stuff_int_list (int *ilp, int max_ints, int lookup_type=RAW_INTEGER_TYPE) |
int | stuff_float_list (float *flp, int max_floats) |
int | stuff_vec3d_list (vec3d *vlp, int max_vecs) |
int | stuff_vec3d_list (SCP_vector< vec3d > &vec_list) |
int | stuff_bool_list (bool *blp, int max_bools) |
void | stuff_vec3d (vec3d *vp) |
void | stuff_matrix (matrix *mp) |
int | string_lookup (char *str1, char *strlist[], int max, char *description=NULL, int say_errors=0) |
void | find_and_stuff (char *id, int *addr, int f_type, char *strlist[], int max, char *description) |
void | find_and_stuff_optional (char *id, int *addr, int f_type, char *strlist[], int max, char *description) |
int | match_and_stuff (int f_type, char *strlist[], int max, char *description) |
void | find_and_stuff_or_add (char *id, int *addr, int f_type, char *strlist[], int *total, int max, char *description) |
int | get_string (char *str, int max=-1) |
void | get_string (SCP_string &str) |
void | stuff_parenthesized_vec3d (vec3d *vp) |
void | stuff_boolean (int *i, bool a_to_eol=true) |
void | stuff_boolean (bool *b, bool a_to_eol=true) |
void | stuff_boolean_flag (int *i, int flag, bool a_to_eol=true) |
int | check_for_string (const char *pstr) |
int | check_for_string_raw (const char *pstr) |
int | check_for_eof () |
int | check_for_eoln () |
void | parse_float_list (float *plist, int size) |
void | parse_int_list (int *ilist, int size) |
void | reset_parse (char *text=NULL) |
void | display_parse_diagnostics () |
void | pause_parse () |
void | unpause_parse () |
void | stop_parse () |
void | mark_int_list (int *ilp, int max_ints, int lookup_type) |
void | compact_multitext_string (char *str) |
void | compact_multitext_string (SCP_string &str) |
void | read_file_text (const char *filename, int mode=CF_TYPE_ANY, char *processed_text=NULL, char *raw_text=NULL) |
void | read_file_text_from_array (const char *array, char *processed_text=NULL, char *raw_text=NULL) |
void | read_raw_file_text (const char *filename, int mode=CF_TYPE_ANY, char *raw_text=NULL) |
void | process_raw_file_text (char *processed_text=NULL, char *raw_text=NULL) |
void | debug_show_mission_text () |
void | convert_sexp_to_string (SCP_string &dest, int cur_node, int mode) |
char * | split_str_once (char *src, int max_pixel_w) |
int | split_str (const char *src, int max_pixel_w, int *n_chars, const char **p_str, int max_lines, char ignore_char=-1) |
int | split_str (const char *src, int max_pixel_w, SCP_vector< int > &n_chars, SCP_vector< const char * > &p_str, char ignore_char) |
int | required_string_fred (char *pstr, char *end=NULL) |
int | required_string_either_fred (char *str1, char *str2) |
int | optional_string_fred (char *pstr, char *end=NULL, char *end2=NULL) |
int | replace_one (char *str, char *oldstr, char *newstr, unsigned int max_len, int range=0) |
SCP_string & | replace_one (SCP_string &context, const SCP_string &from, const SCP_string &to) |
SCP_string & | replace_one (SCP_string &context, const char *from, const char *to) |
int | replace_all (char *str, char *oldstr, char *newstr, unsigned int max_len, int range=0) |
SCP_string & | replace_all (SCP_string &context, const SCP_string &from, const SCP_string &to) |
SCP_string & | replace_all (SCP_string &context, const char *from, const char *to) |
const char * | stristr (const char *str, const char *substr) |
char * | stristr (char *str, const char *substr) |
bool | can_construe_as_integer (const char *text) |
void | vsprintf (SCP_string &dest, const char *format, va_list ap) |
void | sprintf (SCP_string &dest, const char *format,...) |
int | subsystem_stricmp (const char *str1, const char *str2) |
int | strextcmp (const char *s1, const char *s2) |
bool | drop_extension (char *str) |
bool | drop_extension (SCP_string &str) |
void | backspace (char *src) |
void | format_integer_with_commas (char *buf, int integer, bool use_comma_with_four_digits) |
int | scan_fso_version_string (const char *text, int *major, int *minor, int *build, int *revis) |
void | truncate_message_lines (SCP_string &text, int num_allowed_lines) |
void | parse_advance (int s) |
int | parse_modular_table (const char *name_check, void(*parse_callback)(const char *filename), int path_type=CF_TYPE_TABLES, int sort_type=CF_SORT_REVERSE) |
int | stuff_loadout_list (int *ilp, int max_ints, int lookup_type) |
int | get_string_or_variable (char *str) |
int | get_string_or_variable (SCP_string &str) |
Variables | |
char * | Mission_text |
char * | Mission_text_raw |
char * | Mp |
const char * | token_found |
int | fred_parse_flag |
int | Token_found_flag |
bool | Parsing_modular_table |
void advance_to_eoln | ( | char * | terminators | ) |
Definition at line 335 of file parselo.cpp.
char* alloc_block | ( | char * | startstr, |
char * | endstr, | ||
int | extra_chars = 0 |
||
) |
Definition at line 1014 of file parselo.cpp.
void backspace | ( | char * | src | ) |
Definition at line 4069 of file parselo.cpp.
bool can_construe_as_integer | ( | const char * | text | ) |
Definition at line 3778 of file parselo.cpp.
int check_for_eof | ( | ) |
Definition at line 492 of file parselo.cpp.
int check_for_eoln | ( | ) |
Returns 1 if it finds a newline character precded by any amount of grayspace.
Definition at line 505 of file parselo.cpp.
int check_for_string | ( | const char * | pstr | ) |
Definition at line 517 of file parselo.cpp.
int check_for_string_raw | ( | const char * | pstr | ) |
Definition at line 528 of file parselo.cpp.
void compact_multitext_string | ( | char * | str | ) |
Definition at line 1438 of file parselo.cpp.
void compact_multitext_string | ( | SCP_string & | str | ) |
Definition at line 1462 of file parselo.cpp.
void convert_sexp_to_string | ( | SCP_string & | dest, |
int | cur_node, | ||
int | mode | ||
) |
Definition at line 923 of file parselo.cpp.
void copy_text_until | ( | SCP_string & | outstr, |
char * | instr, | ||
char * | endstr | ||
) |
Definition at line 950 of file parselo.cpp.
Definition at line 786 of file parselo.cpp.
void copy_to_eoln | ( | SCP_string & | outstr, |
char * | more_terminators, | ||
char * | instr | ||
) |
Definition at line 814 of file parselo.cpp.
void debug_show_mission_text | ( | ) |
Definition at line 2280 of file parselo.cpp.
void diag_printf | ( | char * | format, |
... | |||
) |
Definition at line 229 of file parselo.cpp.
void display_parse_diagnostics | ( | ) |
Definition at line 3320 of file parselo.cpp.
bool drop_extension | ( | char * | str | ) |
Definition at line 4043 of file parselo.cpp.
bool drop_extension | ( | SCP_string & | str | ) |
Definition at line 4056 of file parselo.cpp.
void drop_leading_white_space | ( | char * | str | ) |
Definition at line 115 of file parselo.cpp.
void drop_leading_white_space | ( | SCP_string & | str | ) |
Definition at line 135 of file parselo.cpp.
void drop_trailing_white_space | ( | char * | str | ) |
Definition at line 93 of file parselo.cpp.
void drop_trailing_white_space | ( | SCP_string & | str | ) |
Definition at line 104 of file parselo.cpp.
char* drop_white_space | ( | char * | str | ) |
Definition at line 159 of file parselo.cpp.
void drop_white_space | ( | SCP_string & | str | ) |
Definition at line 183 of file parselo.cpp.
bool end_string_at_first_hash_symbol | ( | char * | src | ) |
Definition at line 3833 of file parselo.cpp.
bool end_string_at_first_hash_symbol | ( | SCP_string & | src | ) |
Definition at line 3852 of file parselo.cpp.
Definition at line 308 of file parselo.cpp.
void find_and_stuff | ( | char * | id, |
int * | addr, | ||
int | f_type, | ||
char * | strlist[], | ||
int | max, | ||
char * | description | ||
) |
Definition at line 3207 of file parselo.cpp.
void find_and_stuff_optional | ( | char * | id, |
int * | addr, | ||
int | f_type, | ||
char * | strlist[], | ||
int | max, | ||
char * | description | ||
) |
Definition at line 3229 of file parselo.cpp.
void find_and_stuff_or_add | ( | char * | id, |
int * | addr, | ||
int | f_type, | ||
char * | strlist[], | ||
int * | total, | ||
int | max, | ||
char * | description | ||
) |
Definition at line 3251 of file parselo.cpp.
Definition at line 4084 of file parselo.cpp.
int get_index_of_first_hash_symbol | ( | SCP_string & | src | ) |
Definition at line 3882 of file parselo.cpp.
int get_line_num | ( | ) |
Definition at line 261 of file parselo.cpp.
char* get_pointer_to_first_hash_symbol | ( | char * | src | ) |
Definition at line 3868 of file parselo.cpp.
const char* get_pointer_to_first_hash_symbol | ( | const char * | src | ) |
Definition at line 3875 of file parselo.cpp.
Stuff a string (" chars ") into *str, return length. Accepts an optional max length parameter. If it is omitted or negative, then no max length is enforced.
Definition at line 1157 of file parselo.cpp.
void get_string | ( | SCP_string & | str | ) |
Stuff a string (" chars ") into str.
Definition at line 1176 of file parselo.cpp.
int get_string_or_variable | ( | char * | str | ) |
Definition at line 1084 of file parselo.cpp.
int get_string_or_variable | ( | SCP_string & | str | ) |
Definition at line 1119 of file parselo.cpp.
void ignore_gray_space | ( | ) |
Definition at line 83 of file parselo.cpp.
void ignore_white_space | ( | ) |
Definition at line 77 of file parselo.cpp.
int is_gray_space | ( | char | ch | ) |
Definition at line 65 of file parselo.cpp.
int is_white_space | ( | char | ch | ) |
Definition at line 59 of file parselo.cpp.
Definition at line 3022 of file parselo.cpp.
Definition at line 3243 of file parselo.cpp.
char* next_tokens | ( | ) |
Definition at line 245 of file parselo.cpp.
int optional_string | ( | const char * | pstr | ) |
Definition at line 539 of file parselo.cpp.
int optional_string_either | ( | char * | str1, |
char * | str2 | ||
) |
Definition at line 551 of file parselo.cpp.
int optional_string_fred | ( | char * | pstr, |
char * | end = NULL , |
||
char * | end2 = NULL |
||
) |
Definition at line 630 of file parselo.cpp.
Definition at line 567 of file parselo.cpp.
Definition at line 4182 of file parselo.cpp.
Definition at line 4194 of file parselo.cpp.
int parse_modular_table | ( | const char * | name_check, |
void(*)(const char *filename) | parse_callback, | ||
int | path_type = CF_TYPE_TABLES , |
||
int | sort_type = CF_SORT_REVERSE |
||
) |
Definition at line 4205 of file parselo.cpp.
int parse_string_flag_list | ( | int * | dest, |
flag_def_list | defs[], | ||
int | defs_size | ||
) |
Definition at line 2665 of file parselo.cpp.
void pause_parse | ( | ) |
Definition at line 3272 of file parselo.cpp.
void process_raw_file_text | ( | char * | processed_text = NULL , |
char * | raw_text = NULL |
||
) |
Definition at line 2194 of file parselo.cpp.
void read_file_text | ( | const char * | filename, |
int | mode = CF_TYPE_ANY , |
||
char * | processed_text = NULL , |
||
char * | raw_text = NULL |
||
) |
Definition at line 1995 of file parselo.cpp.
void read_file_text_from_array | ( | const char * | array, |
char * | processed_text = NULL , |
||
char * | raw_text = NULL |
||
) |
Definition at line 2022 of file parselo.cpp.
void read_raw_file_text | ( | const char * | filename, |
int | mode = CF_TYPE_ANY , |
||
char * | raw_text = NULL |
||
) |
Definition at line 2127 of file parselo.cpp.
Definition at line 3941 of file parselo.cpp.
SCP_string& replace_all | ( | SCP_string & | context, |
const SCP_string & | from, | ||
const SCP_string & | to | ||
) |
Definition at line 3979 of file parselo.cpp.
SCP_string& replace_all | ( | SCP_string & | context, |
const char * | from, | ||
const char * | to | ||
) |
Definition at line 3995 of file parselo.cpp.
Definition at line 3889 of file parselo.cpp.
SCP_string& replace_one | ( | SCP_string & | context, |
const SCP_string & | from, | ||
const SCP_string & | to | ||
) |
Definition at line 3958 of file parselo.cpp.
SCP_string& replace_one | ( | SCP_string & | context, |
const char * | from, | ||
const char * | to | ||
) |
Definition at line 3968 of file parselo.cpp.
int required_string | ( | const char * | pstr | ) |
Definition at line 468 of file parselo.cpp.
int required_string_either | ( | char * | str1, |
char * | str2 | ||
) |
Checks for one of two required strings.
0 | for str1 match |
1 | for str2 match |
parse::ParseException | If neither strings were found |
Advances the Mp until a string is found or exceeds RS_MAX_TRIES. Once a string is found, Mp is located at the start of the found string.
Definition at line 673 of file parselo.cpp.
int required_string_either_fred | ( | char * | str1, |
char * | str2 | ||
) |
Definition at line 758 of file parselo.cpp.
int required_string_fred | ( | char * | pstr, |
char * | end = NULL |
||
) |
Definition at line 593 of file parselo.cpp.
Checks for one of any of the given required strings.
By ngld, with some tweaks by MageKing17.
Definition at line 708 of file parselo.cpp.
void reset_parse | ( | char * | text = NULL | ) |
Definition at line 3305 of file parselo.cpp.
int scan_fso_version_string | ( | const char * | text, |
int * | major, | ||
int * | minor, | ||
int * | build, | ||
int * | revis | ||
) |
Definition at line 4126 of file parselo.cpp.
int skip_to_start_of_string | ( | char * | pstr, |
char * | end = NULL |
||
) |
Definition at line 404 of file parselo.cpp.
int skip_to_start_of_string_either | ( | char * | pstr1, |
char * | pstr2, | ||
char * | end = NULL |
||
) |
Definition at line 433 of file parselo.cpp.
int skip_to_string | ( | char * | pstr, |
char * | end = NULL |
||
) |
Definition at line 375 of file parselo.cpp.
void skip_token | ( | ) |
Definition at line 219 of file parselo.cpp.
int split_str | ( | const char * | src, |
int | max_pixel_w, | ||
int * | n_chars, | ||
const char ** | p_str, | ||
int | max_lines, | ||
char | ignore_char = -1 |
||
) |
Definition at line 3412 of file parselo.cpp.
int split_str | ( | const char * | src, |
int | max_pixel_w, | ||
SCP_vector< int > & | n_chars, | ||
SCP_vector< const char * > & | p_str, | ||
char | ignore_char | ||
) |
Definition at line 3534 of file parselo.cpp.
char* split_str_once | ( | char * | src, |
int | max_pixel_w | ||
) |
Definition at line 3330 of file parselo.cpp.
void sprintf | ( | SCP_string & | dest, |
const char * | format, | ||
... | |||
) |
Definition at line 3824 of file parselo.cpp.
void stop_parse | ( | ) |
Definition at line 2071 of file parselo.cpp.
int strextcmp | ( | const char * | s1, |
const char * | s2 | ||
) |
Definition at line 4013 of file parselo.cpp.
int string_lookup | ( | char * | str1, |
char * | strlist[], | ||
int | max, | ||
char * | description = NULL , |
||
int | say_errors = 0 |
||
) |
Definition at line 3187 of file parselo.cpp.
const char* stristr | ( | const char * | str, |
const char * | substr | ||
) |
Definition at line 3680 of file parselo.cpp.
char* stristr | ( | char * | str, |
const char * | substr | ||
) |
Definition at line 3729 of file parselo.cpp.
char* stuff_and_malloc_string | ( | int | type, |
char * | terminators = NULL |
||
) |
Definition at line 1406 of file parselo.cpp.
Definition at line 2591 of file parselo.cpp.
Definition at line 2519 of file parselo.cpp.
void stuff_boolean | ( | bool * | b, |
bool | a_to_eol = true |
||
) |
Definition at line 2543 of file parselo.cpp.
Definition at line 2529 of file parselo.cpp.
Definition at line 2328 of file parselo.cpp.
Definition at line 2988 of file parselo.cpp.
Definition at line 2343 of file parselo.cpp.
Definition at line 2372 of file parselo.cpp.
int stuff_int_list | ( | int * | ilp, |
int | max_ints, | ||
int | lookup_type = RAW_INTEGER_TYPE |
||
) |
Definition at line 2782 of file parselo.cpp.
Definition at line 2387 of file parselo.cpp.
Definition at line 2881 of file parselo.cpp.
Definition at line 1419 of file parselo.cpp.
Definition at line 3174 of file parselo.cpp.
Definition at line 3089 of file parselo.cpp.
Definition at line 1189 of file parselo.cpp.
void stuff_string | ( | SCP_string & | outstr, |
int | type, | ||
char * | terminators = NULL |
||
) |
Definition at line 1276 of file parselo.cpp.
Definition at line 1354 of file parselo.cpp.
void stuff_string_line | ( | SCP_string & | outstr | ) |
Definition at line 1381 of file parselo.cpp.
int stuff_string_list | ( | SCP_vector< SCP_string > & | slp | ) |
Definition at line 2689 of file parselo.cpp.
Definition at line 2725 of file parselo.cpp.
Definition at line 988 of file parselo.cpp.
void stuff_string_until | ( | SCP_string & | outstr, |
char * | endstr | ||
) |
Definition at line 1000 of file parselo.cpp.
Definition at line 969 of file parselo.cpp.
void stuff_string_white | ( | SCP_string & | outstr | ) |
Definition at line 980 of file parselo.cpp.
Definition at line 2646 of file parselo.cpp.
Definition at line 3082 of file parselo.cpp.
Definition at line 3114 of file parselo.cpp.
int stuff_vec3d_list | ( | SCP_vector< vec3d > & | vec_list | ) |
Definition at line 3147 of file parselo.cpp.
int subsystem_stricmp | ( | const char * | str1, |
const char * | str2 | ||
) |
Definition at line 3648 of file parselo.cpp.
void truncate_message_lines | ( | SCP_string & | text, |
int | num_allowed_lines | ||
) |
Definition at line 4154 of file parselo.cpp.
void unpause_parse | ( | ) |
Definition at line 3289 of file parselo.cpp.
void vsprintf | ( | SCP_string & | dest, |
const char * | format, | ||
va_list | ap | ||
) |
Definition at line 3800 of file parselo.cpp.
int fred_parse_flag |
Definition at line 43 of file parselo.cpp.
char* Mission_text |
Definition at line 46 of file parselo.cpp.
char* Mission_text_raw |
Definition at line 47 of file parselo.cpp.
char* Mp |
Definition at line 48 of file parselo.cpp.
bool Parsing_modular_table |
Definition at line 34 of file parselo.cpp.
const char* token_found |
Definition at line 49 of file parselo.cpp.
int Token_found_flag |
Definition at line 44 of file parselo.cpp.