diff options
Diffstat (limited to 'engines/sci/engine/savegame.c')
-rw-r--r-- | engines/sci/engine/savegame.c | 511 |
1 files changed, 506 insertions, 5 deletions
diff --git a/engines/sci/engine/savegame.c b/engines/sci/engine/savegame.c index 0537fcacd5..94011f3277 100644 --- a/engines/sci/engine/savegame.c +++ b/engines/sci/engine/savegame.c @@ -30,12 +30,12 @@ ** savegame.cfsml. If this doesn't solve your problem, contact the maintainer. */ -#include <sci_memory.h> -#include <gfx_operations.h> -#include <sfx_engine.h> -#include <engine.h> +#include "sci/include/sci_memory.h" +#include "sci/include/gfx_operations.h" +#include "sci/include/sfx_engine.h" +#include "sci/include/engine.h" #include <assert.h> -#include "heap.h" +#include "sci/engine/heap.h" #ifdef _MSC_VER #include <direct.h> @@ -183,9 +183,11 @@ typedef mem_obj_t *mem_obj_ptr; /* Auto-generated CFSML declaration and function block */ +#line 796 "savegame.cfsml" #define CFSML_SUCCESS 0 #define CFSML_FAILURE 1 +#line 102 "savegame.cfsml" #include <stdarg.h> /* We need va_lists */ #include <sci_memory.h> @@ -396,6 +398,7 @@ _cfsml_get_identifier(FILE *fd, int *line, int *hiteof, int *assignment) retval = (char *) sci_realloc(retval, mem += 1); retval[pos] = 0; /* Terminate string */ +#line 322 "savegame.cfsml" return _cfsml_last_identifier_retreived = retval; } @@ -443,181 +446,217 @@ _cfsml_get_value(FILE *fd, int *line, int *hiteof) retval = (char *) sci_realloc(retval, mem += 1); retval[pos] = 0; /* Terminate string */ +#line 379 "savegame.cfsml" return (_cfsml_last_value_retreived = (char *) sci_realloc(retval, strlen(retval) + 1)); /* Re-allocate; this value might be used for quite some while (if we are ** restoring a string) */ } +#line 431 "savegame.cfsml" static void _cfsml_write_synonym_t(FILE *fh, synonym_t* save_struc); static int _cfsml_read_synonym_t(FILE *fh, synonym_t* save_struc, char *lastval, int *line, int *hiteof); +#line 431 "savegame.cfsml" static void _cfsml_write_sfx_state_t(FILE *fh, sfx_state_t* save_struc); static int _cfsml_read_sfx_state_t(FILE *fh, sfx_state_t* save_struc, char *lastval, int *line, int *hiteof); +#line 431 "savegame.cfsml" static void _cfsml_write_clone_entry_t(FILE *fh, clone_entry_t* save_struc); static int _cfsml_read_clone_entry_t(FILE *fh, clone_entry_t* save_struc, char *lastval, int *line, int *hiteof); +#line 431 "savegame.cfsml" static void _cfsml_write_object_t(FILE *fh, object_t* save_struc); static int _cfsml_read_object_t(FILE *fh, object_t* save_struc, char *lastval, int *line, int *hiteof); +#line 431 "savegame.cfsml" static void _cfsml_write_string(FILE *fh, char ** save_struc); static int _cfsml_read_string(FILE *fh, char ** save_struc, char *lastval, int *line, int *hiteof); +#line 431 "savegame.cfsml" static void _cfsml_write_menubar_t(FILE *fh, menubar_t* save_struc); static int _cfsml_read_menubar_t(FILE *fh, menubar_t* save_struc, char *lastval, int *line, int *hiteof); +#line 431 "savegame.cfsml" static void _cfsml_write_size_t(FILE *fh, size_t* save_struc); static int _cfsml_read_size_t(FILE *fh, size_t* save_struc, char *lastval, int *line, int *hiteof); +#line 431 "savegame.cfsml" static void _cfsml_write_list_entry_t(FILE *fh, list_entry_t* save_struc); static int _cfsml_read_list_entry_t(FILE *fh, list_entry_t* save_struc, char *lastval, int *line, int *hiteof); +#line 431 "savegame.cfsml" static void _cfsml_write_int_hash_map_t(FILE *fh, int_hash_map_t* save_struc); static int _cfsml_read_int_hash_map_t(FILE *fh, int_hash_map_t* save_struc, char *lastval, int *line, int *hiteof); +#line 431 "savegame.cfsml" static void _cfsml_write_gint16(FILE *fh, gint16* save_struc); static int _cfsml_read_gint16(FILE *fh, gint16* save_struc, char *lastval, int *line, int *hiteof); +#line 431 "savegame.cfsml" static void _cfsml_write_song_t(FILE *fh, song_t* save_struc); static int _cfsml_read_song_t(FILE *fh, song_t* save_struc, char *lastval, int *line, int *hiteof); +#line 431 "savegame.cfsml" static void _cfsml_write_menu_item_t(FILE *fh, menu_item_t* save_struc); static int _cfsml_read_menu_item_t(FILE *fh, menu_item_t* save_struc, char *lastval, int *line, int *hiteof); +#line 431 "savegame.cfsml" static void _cfsml_write_node_entry_t(FILE *fh, node_entry_t* save_struc); static int _cfsml_read_node_entry_t(FILE *fh, node_entry_t* save_struc, char *lastval, int *line, int *hiteof); +#line 431 "savegame.cfsml" static void _cfsml_write_seg_id_t(FILE *fh, seg_id_t* save_struc); static int _cfsml_read_seg_id_t(FILE *fh, seg_id_t* save_struc, char *lastval, int *line, int *hiteof); +#line 431 "savegame.cfsml" static void _cfsml_write_dynmem_t(FILE *fh, dynmem_t* save_struc); static int _cfsml_read_dynmem_t(FILE *fh, dynmem_t* save_struc, char *lastval, int *line, int *hiteof); +#line 431 "savegame.cfsml" static void _cfsml_write_local_variables_t(FILE *fh, local_variables_t* save_struc); static int _cfsml_read_local_variables_t(FILE *fh, local_variables_t* save_struc, char *lastval, int *line, int *hiteof); +#line 431 "savegame.cfsml" static void _cfsml_write_state_t(FILE *fh, state_t* save_struc); static int _cfsml_read_state_t(FILE *fh, state_t* save_struc, char *lastval, int *line, int *hiteof); +#line 431 "savegame.cfsml" static void _cfsml_write_node_table_t(FILE *fh, node_table_t* save_struc); static int _cfsml_read_node_table_t(FILE *fh, node_table_t* save_struc, char *lastval, int *line, int *hiteof); +#line 431 "savegame.cfsml" static void _cfsml_write_sys_strings_t(FILE *fh, sys_strings_t* save_struc); static int _cfsml_read_sys_strings_t(FILE *fh, sys_strings_t* save_struc, char *lastval, int *line, int *hiteof); +#line 431 "savegame.cfsml" static void _cfsml_write_byte(FILE *fh, byte* save_struc); static int _cfsml_read_byte(FILE *fh, byte* save_struc, char *lastval, int *line, int *hiteof); +#line 431 "savegame.cfsml" static void _cfsml_write_node_t(FILE *fh, node_t* save_struc); static int _cfsml_read_node_t(FILE *fh, node_t* save_struc, char *lastval, int *line, int *hiteof); +#line 431 "savegame.cfsml" static void _cfsml_write_list_table_t(FILE *fh, list_table_t* save_struc); static int _cfsml_read_list_table_t(FILE *fh, list_table_t* save_struc, char *lastval, int *line, int *hiteof); +#line 431 "savegame.cfsml" static void _cfsml_write_class_t(FILE *fh, class_t* save_struc); static int _cfsml_read_class_t(FILE *fh, class_t* save_struc, char *lastval, int *line, int *hiteof); +#line 431 "savegame.cfsml" static void _cfsml_write_song_handle_t(FILE *fh, song_handle_t* save_struc); static int _cfsml_read_song_handle_t(FILE *fh, song_handle_t* save_struc, char *lastval, int *line, int *hiteof); +#line 431 "savegame.cfsml" static void _cfsml_write_int(FILE *fh, int* save_struc); static int _cfsml_read_int(FILE *fh, int* save_struc, char *lastval, int *line, int *hiteof); +#line 431 "savegame.cfsml" static void _cfsml_write_menu_t(FILE *fh, menu_t* save_struc); static int _cfsml_read_menu_t(FILE *fh, menu_t* save_struc, char *lastval, int *line, int *hiteof); +#line 431 "savegame.cfsml" static void _cfsml_write_long(FILE *fh, long* save_struc); static int _cfsml_read_long(FILE *fh, long* save_struc, char *lastval, int *line, int *hiteof); +#line 431 "savegame.cfsml" static void _cfsml_write_clone_table_t(FILE *fh, clone_table_t* save_struc); static int _cfsml_read_clone_table_t(FILE *fh, clone_table_t* save_struc, char *lastval, int *line, int *hiteof); +#line 431 "savegame.cfsml" static void _cfsml_write_clone_t(FILE *fh, clone_t* save_struc); static int _cfsml_read_clone_t(FILE *fh, clone_t* save_struc, char *lastval, int *line, int *hiteof); +#line 431 "savegame.cfsml" static void _cfsml_write_list_t(FILE *fh, list_t* save_struc); static int _cfsml_read_list_t(FILE *fh, list_t* save_struc, char *lastval, int *line, int *hiteof); +#line 431 "savegame.cfsml" static void _cfsml_write_sys_string_t(FILE *fh, sys_string_t* save_struc); static int _cfsml_read_sys_string_t(FILE *fh, sys_string_t* save_struc, char *lastval, int *line, int *hiteof); +#line 431 "savegame.cfsml" static void _cfsml_write_script_t(FILE *fh, script_t* save_struc); static int _cfsml_read_script_t(FILE *fh, script_t* save_struc, char *lastval, int *line, int *hiteof); +#line 431 "savegame.cfsml" static void _cfsml_write_seg_manager_t(FILE *fh, seg_manager_t* save_struc); static int _cfsml_read_seg_manager_t(FILE *fh, seg_manager_t* save_struc, char *lastval, int *line, int *hiteof); +#line 444 "savegame.cfsml" static void _cfsml_write_synonym_t(FILE *fh, synonym_t* save_struc) { int min, max, i; +#line 464 "savegame.cfsml" fprintf(fh, "{\n"); fprintf(fh, "replaceant = "); _cfsml_write_int(fh, (int*) &(save_struc->replaceant)); @@ -628,11 +667,13 @@ _cfsml_write_synonym_t(FILE *fh, synonym_t* save_struc) fprintf(fh, "}"); } +#line 538 "savegame.cfsml" static int _cfsml_read_synonym_t(FILE *fh, synonym_t* save_struc, char *lastval, int *line, int *hiteof) { char *token; int min, max, i; +#line 599 "savegame.cfsml" int assignment, closed, done; if (strcmp(lastval, "{")) { @@ -664,17 +705,20 @@ int min, max, i; return CFSML_FAILURE; } if (!strcmp(token, "replaceant")) { +#line 749 "savegame.cfsml" if (_cfsml_read_int(fh, (int*) &(save_struc->replaceant), value, line, hiteof)) { _cfsml_error("Token expected by _cfsml_read_int() for replaceant at line %d\n", *line); return CFSML_FAILURE; } } else if (!strcmp(token, "replacement")) { +#line 749 "savegame.cfsml" if (_cfsml_read_int(fh, (int*) &(save_struc->replacement), value, line, hiteof)) { _cfsml_error("Token expected by _cfsml_read_int() for replacement at line %d\n", *line); return CFSML_FAILURE; } } else +#line 758 "savegame.cfsml" { _cfsml_error("synonym_t: Assignment to invalid identifier '%s' in line %d\n", token, *line); return CFSML_FAILURE; @@ -684,11 +728,13 @@ int min, max, i; return CFSML_SUCCESS; } +#line 444 "savegame.cfsml" static void _cfsml_write_sfx_state_t(FILE *fh, sfx_state_t* save_struc) { int min, max, i; +#line 464 "savegame.cfsml" fprintf(fh, "{\n"); fprintf(fh, "songlib = "); write_songlib_t(fh, (songlib_t*) &(save_struc->songlib)); @@ -696,11 +742,13 @@ _cfsml_write_sfx_state_t(FILE *fh, sfx_state_t* save_struc) fprintf(fh, "}"); } +#line 538 "savegame.cfsml" static int _cfsml_read_sfx_state_t(FILE *fh, sfx_state_t* save_struc, char *lastval, int *line, int *hiteof) { char *token; int min, max, i; +#line 599 "savegame.cfsml" int assignment, closed, done; if (strcmp(lastval, "{")) { @@ -732,11 +780,13 @@ int min, max, i; return CFSML_FAILURE; } if (!strcmp(token, "songlib")) { +#line 749 "savegame.cfsml" if (read_songlib_t(fh, (songlib_t*) &(save_struc->songlib), value, line, hiteof)) { _cfsml_error("Token expected by read_songlib_t() for songlib at line %d\n", *line); return CFSML_FAILURE; } } else +#line 758 "savegame.cfsml" { _cfsml_error("sfx_state_t: Assignment to invalid identifier '%s' in line %d\n", token, *line); return CFSML_FAILURE; @@ -746,11 +796,13 @@ int min, max, i; return CFSML_SUCCESS; } +#line 444 "savegame.cfsml" static void _cfsml_write_clone_entry_t(FILE *fh, clone_entry_t* save_struc) { int min, max, i; +#line 464 "savegame.cfsml" fprintf(fh, "{\n"); fprintf(fh, "next_free = "); _cfsml_write_int(fh, (int*) &(save_struc->next_free)); @@ -761,11 +813,13 @@ _cfsml_write_clone_entry_t(FILE *fh, clone_entry_t* save_struc) fprintf(fh, "}"); } +#line 538 "savegame.cfsml" static int _cfsml_read_clone_entry_t(FILE *fh, clone_entry_t* save_struc, char *lastval, int *line, int *hiteof) { char *token; int min, max, i; +#line 599 "savegame.cfsml" int assignment, closed, done; if (strcmp(lastval, "{")) { @@ -797,17 +851,20 @@ int min, max, i; return CFSML_FAILURE; } if (!strcmp(token, "next_free")) { +#line 749 "savegame.cfsml" if (_cfsml_read_int(fh, (int*) &(save_struc->next_free), value, line, hiteof)) { _cfsml_error("Token expected by _cfsml_read_int() for next_free at line %d\n", *line); return CFSML_FAILURE; } } else if (!strcmp(token, "entry")) { +#line 749 "savegame.cfsml" if (_cfsml_read_clone_t(fh, (clone_t*) &(save_struc->entry), value, line, hiteof)) { _cfsml_error("Token expected by _cfsml_read_clone_t() for entry at line %d\n", *line); return CFSML_FAILURE; } } else +#line 758 "savegame.cfsml" { _cfsml_error("clone_entry_t: Assignment to invalid identifier '%s' in line %d\n", token, *line); return CFSML_FAILURE; @@ -817,11 +874,13 @@ int min, max, i; return CFSML_SUCCESS; } +#line 444 "savegame.cfsml" static void _cfsml_write_object_t(FILE *fh, object_t* save_struc) { int min, max, i; +#line 464 "savegame.cfsml" fprintf(fh, "{\n"); fprintf(fh, "flags = "); _cfsml_write_int(fh, (int*) &(save_struc->flags)); @@ -842,6 +901,7 @@ _cfsml_write_object_t(FILE *fh, object_t* save_struc) min = max = save_struc->variables_nr; if (!save_struc->variables) min = max = 0; /* Don't write if it points to NULL */ +#line 490 "savegame.cfsml" fprintf(fh, "[%d][\n", max); for (i = 0; i < min; i++) { write_reg_t(fh, &(save_struc->variables[i])); @@ -852,11 +912,13 @@ _cfsml_write_object_t(FILE *fh, object_t* save_struc) fprintf(fh, "}"); } +#line 538 "savegame.cfsml" static int _cfsml_read_object_t(FILE *fh, object_t* save_struc, char *lastval, int *line, int *hiteof) { char *token; int min, max, i; +#line 599 "savegame.cfsml" int assignment, closed, done; if (strcmp(lastval, "{")) { @@ -888,40 +950,47 @@ int min, max, i; return CFSML_FAILURE; } if (!strcmp(token, "flags")) { +#line 749 "savegame.cfsml" if (_cfsml_read_int(fh, (int*) &(save_struc->flags), value, line, hiteof)) { _cfsml_error("Token expected by _cfsml_read_int() for flags at line %d\n", *line); return CFSML_FAILURE; } } else if (!strcmp(token, "pos")) { +#line 749 "savegame.cfsml" if (read_reg_t(fh, (reg_t*) &(save_struc->pos), value, line, hiteof)) { _cfsml_error("Token expected by read_reg_t() for pos at line %d\n", *line); return CFSML_FAILURE; } } else if (!strcmp(token, "variables_nr")) { +#line 749 "savegame.cfsml" if (_cfsml_read_int(fh, (int*) &(save_struc->variables_nr), value, line, hiteof)) { _cfsml_error("Token expected by _cfsml_read_int() for variables_nr at line %d\n", *line); return CFSML_FAILURE; } } else if (!strcmp(token, "variable_names_nr")) { +#line 749 "savegame.cfsml" if (_cfsml_read_int(fh, (int*) &(save_struc->variable_names_nr), value, line, hiteof)) { _cfsml_error("Token expected by _cfsml_read_int() for variable_names_nr at line %d\n", *line); return CFSML_FAILURE; } } else if (!strcmp(token, "methods_nr")) { +#line 749 "savegame.cfsml" if (_cfsml_read_int(fh, (int*) &(save_struc->methods_nr), value, line, hiteof)) { _cfsml_error("Token expected by _cfsml_read_int() for methods_nr at line %d\n", *line); return CFSML_FAILURE; } } else if (!strcmp(token, "variables")) { +#line 663 "savegame.cfsml" if ((value[0] != '[') || (value[strlen(value) - 1] != '[')) { _cfsml_error("Opening brackets expected at line %d\n", *line); return CFSML_FAILURE; } +#line 673 "savegame.cfsml" /* Prepare to restore dynamic array */ max = strtol(value + 1, NULL, 0); if (max < 0) { @@ -938,9 +1007,11 @@ int min, max, i; } else save_struc->variables = NULL; +#line 699 "savegame.cfsml" done = i = 0; do { if (!(value = _cfsml_get_identifier(fh, line, hiteof, NULL))) { +#line 707 "savegame.cfsml" _cfsml_error("Token expected at line %d\n", *line); return 1; } @@ -957,6 +1028,7 @@ int min, max, i; } while (!done); save_struc->variables_nr = max ; /* Set array size accordingly */ } else +#line 758 "savegame.cfsml" { _cfsml_error("object_t: Assignment to invalid identifier '%s' in line %d\n", token, *line); return CFSML_FAILURE; @@ -966,9 +1038,11 @@ int min, max, i; return CFSML_SUCCESS; } +#line 444 "savegame.cfsml" static void _cfsml_write_string(FILE *fh, char ** save_struc) { +#line 454 "savegame.cfsml" if (!(*save_struc)) fprintf(fh, "\\null\\"); else { @@ -978,10 +1052,12 @@ _cfsml_write_string(FILE *fh, char ** save_struc) } } +#line 538 "savegame.cfsml" static int _cfsml_read_string(FILE *fh, char ** save_struc, char *lastval, int *line, int *hiteof) { char *token; +#line 577 "savegame.cfsml" if (strcmp(lastval, "\\null\\")) { /* null pointer? */ if (*lastval == '"') { /* Quoted string? */ @@ -1007,16 +1083,19 @@ _cfsml_read_string(FILE *fh, char ** save_struc, char *lastval, int *line, int * } } +#line 444 "savegame.cfsml" static void _cfsml_write_menubar_t(FILE *fh, menubar_t* save_struc) { int min, max, i; +#line 464 "savegame.cfsml" fprintf(fh, "{\n"); fprintf(fh, "menus = "); min = max = save_struc->menus_nr; if (!save_struc->menus) min = max = 0; /* Don't write if it points to NULL */ +#line 490 "savegame.cfsml" fprintf(fh, "[%d][\n", max); for (i = 0; i < min; i++) { _cfsml_write_menu_t(fh, &(save_struc->menus[i])); @@ -1027,11 +1106,13 @@ _cfsml_write_menubar_t(FILE *fh, menubar_t* save_struc) fprintf(fh, "}"); } +#line 538 "savegame.cfsml" static int _cfsml_read_menubar_t(FILE *fh, menubar_t* save_struc, char *lastval, int *line, int *hiteof) { char *token; int min, max, i; +#line 599 "savegame.cfsml" int assignment, closed, done; if (strcmp(lastval, "{")) { @@ -1063,10 +1144,12 @@ int min, max, i; return CFSML_FAILURE; } if (!strcmp(token, "menus")) { +#line 663 "savegame.cfsml" if ((value[0] != '[') || (value[strlen(value) - 1] != '[')) { _cfsml_error("Opening brackets expected at line %d\n", *line); return CFSML_FAILURE; } +#line 673 "savegame.cfsml" /* Prepare to restore dynamic array */ max = strtol(value + 1, NULL, 0); if (max < 0) { @@ -1083,9 +1166,11 @@ int min, max, i; } else save_struc->menus = NULL; +#line 699 "savegame.cfsml" done = i = 0; do { if (!(value = _cfsml_get_identifier(fh, line, hiteof, NULL))) { +#line 707 "savegame.cfsml" _cfsml_error("Token expected at line %d\n", *line); return 1; } @@ -1102,6 +1187,7 @@ int min, max, i; } while (!done); save_struc->menus_nr = max ; /* Set array size accordingly */ } else +#line 758 "savegame.cfsml" { _cfsml_error("menubar_t: Assignment to invalid identifier '%s' in line %d\n", token, *line); return CFSML_FAILURE; @@ -1111,16 +1197,19 @@ int min, max, i; return CFSML_SUCCESS; } +#line 444 "savegame.cfsml" static void _cfsml_write_size_t(FILE *fh, size_t* save_struc) { fprintf(fh, "%li", (long) *save_struc); } +#line 538 "savegame.cfsml" static int _cfsml_read_size_t(FILE *fh, size_t* save_struc, char *lastval, int *line, int *hiteof) { char *token; +#line 564 "savegame.cfsml" *save_struc = strtol(lastval, &token, 0); if ( (*save_struc == 0) && (token == lastval) ) { @@ -1134,11 +1223,13 @@ _cfsml_read_size_t(FILE *fh, size_t* save_struc, char *lastval, int *line, int * return CFSML_SUCCESS; } +#line 444 "savegame.cfsml" static void _cfsml_write_list_entry_t(FILE *fh, list_entry_t* save_struc) { int min, max, i; +#line 464 "savegame.cfsml" fprintf(fh, "{\n"); fprintf(fh, "next_free = "); _cfsml_write_int(fh, (int*) &(save_struc->next_free)); @@ -1149,11 +1240,13 @@ _cfsml_write_list_entry_t(FILE *fh, list_entry_t* save_struc) fprintf(fh, "}"); } +#line 538 "savegame.cfsml" static int _cfsml_read_list_entry_t(FILE *fh, list_entry_t* save_struc, char *lastval, int *line, int *hiteof) { char *token; int min, max, i; +#line 599 "savegame.cfsml" int assignment, closed, done; if (strcmp(lastval, "{")) { @@ -1185,17 +1278,20 @@ int min, max, i; return CFSML_FAILURE; } if (!strcmp(token, "next_free")) { +#line 749 "savegame.cfsml" if (_cfsml_read_int(fh, (int*) &(save_struc->next_free), value, line, hiteof)) { _cfsml_error("Token expected by _cfsml_read_int() for next_free at line %d\n", *line); return CFSML_FAILURE; } } else if (!strcmp(token, "entry")) { +#line 749 "savegame.cfsml" if (_cfsml_read_list_t(fh, (list_t*) &(save_struc->entry), value, line, hiteof)) { _cfsml_error("Token expected by _cfsml_read_list_t() for entry at line %d\n", *line); return CFSML_FAILURE; } } else +#line 758 "savegame.cfsml" { _cfsml_error("list_entry_t: Assignment to invalid identifier '%s' in line %d\n", token, *line); return CFSML_FAILURE; @@ -1205,17 +1301,20 @@ int min, max, i; return CFSML_SUCCESS; } +#line 444 "savegame.cfsml" static void _cfsml_write_int_hash_map_t(FILE *fh, int_hash_map_t* save_struc) { int min, max, i; +#line 464 "savegame.cfsml" fprintf(fh, "{\n"); fprintf(fh, "base_value = "); _cfsml_write_int(fh, (int*) &(save_struc->base_value)); fprintf(fh, "\n"); fprintf(fh, "nodes = "); min = max = DCS_INT_HASH_MAX+1; +#line 490 "savegame.cfsml" fprintf(fh, "[%d][\n", max); for (i = 0; i < min; i++) { write_int_hash_map_node_tp(fh, &(save_struc->nodes[i])); @@ -1226,11 +1325,13 @@ _cfsml_write_int_hash_map_t(FILE *fh, int_hash_map_t* save_struc) fprintf(fh, "}"); } +#line 538 "savegame.cfsml" static int _cfsml_read_int_hash_map_t(FILE *fh, int_hash_map_t* save_struc, char *lastval, int *line, int *hiteof) { char *token; int min, max, i; +#line 599 "savegame.cfsml" int assignment, closed, done; if (strcmp(lastval, "{")) { @@ -1262,21 +1363,25 @@ int min, max, i; return CFSML_FAILURE; } if (!strcmp(token, "base_value")) { +#line 749 "savegame.cfsml" if (_cfsml_read_int(fh, (int*) &(save_struc->base_value), value, line, hiteof)) { _cfsml_error("Token expected by _cfsml_read_int() for base_value at line %d\n", *line); return CFSML_FAILURE; } } else if (!strcmp(token, "nodes")) { +#line 663 "savegame.cfsml" if ((value[0] != '[') || (value[strlen(value) - 1] != '[')) { _cfsml_error("Opening brackets expected at line %d\n", *line); return CFSML_FAILURE; } /* Prepare to restore static array */ max = DCS_INT_HASH_MAX+1; +#line 699 "savegame.cfsml" done = i = 0; do { if (!(value = _cfsml_get_identifier(fh, line, hiteof, NULL))) { +#line 707 "savegame.cfsml" _cfsml_error("Token expected at line %d\n", *line); return 1; } @@ -1292,6 +1397,7 @@ int min, max, i; } else done = 1; } while (!done); } else +#line 758 "savegame.cfsml" { _cfsml_error("int_hash_map_t: Assignment to invalid identifier '%s' in line %d\n", token, *line); return CFSML_FAILURE; @@ -1301,16 +1407,19 @@ int min, max, i; return CFSML_SUCCESS; } +#line 444 "savegame.cfsml" static void _cfsml_write_gint16(FILE *fh, gint16* save_struc) { fprintf(fh, "%li", (long) *save_struc); } +#line 538 "savegame.cfsml" static int _cfsml_read_gint16(FILE *fh, gint16* save_struc, char *lastval, int *line, int *hiteof) { char *token; +#line 564 "savegame.cfsml" *save_struc = strtol(lastval, &token, 0); if ( (*save_struc == 0) && (token == lastval) ) { @@ -1324,11 +1433,13 @@ _cfsml_read_gint16(FILE *fh, gint16* save_struc, char *lastval, int *line, int * return CFSML_SUCCESS; } +#line 444 "savegame.cfsml" static void _cfsml_write_song_t(FILE *fh, song_t* save_struc) { int min, max, i; +#line 464 "savegame.cfsml" fprintf(fh, "{\n"); fprintf(fh, "handle = "); _cfsml_write_song_handle_t(fh, (song_handle_t*) &(save_struc->handle)); @@ -1357,11 +1468,13 @@ _cfsml_write_song_t(FILE *fh, song_t* save_struc) fprintf(fh, "}"); } +#line 538 "savegame.cfsml" static int _cfsml_read_song_t(FILE *fh, song_t* save_struc, char *lastval, int *line, int *hiteof) { char *token; int min, max, i; +#line 599 "savegame.cfsml" int assignment, closed, done; if (strcmp(lastval, "{")) { @@ -1393,53 +1506,62 @@ int min, max, i; return CFSML_FAILURE; } if (!strcmp(token, "handle")) { +#line 749 "savegame.cfsml" if (_cfsml_read_song_handle_t(fh, (song_handle_t*) &(save_struc->handle), value, line, hiteof)) { _cfsml_error("Token expected by _cfsml_read_song_handle_t() for handle at line %d\n", *line); return CFSML_FAILURE; } } else if (!strcmp(token, "resource_num")) { +#line 749 "savegame.cfsml" if (_cfsml_read_int(fh, (int*) &(save_struc->resource_num), value, line, hiteof)) { _cfsml_error("Token expected by _cfsml_read_int() for resource_num at line %d\n", *line); return CFSML_FAILURE; } } else if (!strcmp(token, "priority")) { +#line 749 "savegame.cfsml" if (_cfsml_read_int(fh, (int*) &(save_struc->priority), value, line, hiteof)) { _cfsml_error("Token expected by _cfsml_read_int() for priority at line %d\n", *line); return CFSML_FAILURE; } } else if (!strcmp(token, "status")) { +#line 749 "savegame.cfsml" if (_cfsml_read_int(fh, (int*) &(save_struc->status), value, line, hiteof)) { _cfsml_error("Token expected by _cfsml_read_int() for status at line %d\n", *line); return CFSML_FAILURE; } } else if (!strcmp(token, "restore_behavior")) { +#line 749 "savegame.cfsml" if (_cfsml_read_int(fh, (int*) &(save_struc->restore_behavior), value, line, hiteof)) { _cfsml_error("Token expected by _cfsml_read_int() for restore_behavior at line %d\n", *line); return CFSML_FAILURE; } } else if (!strcmp(token, "restore_time")) { +#line 749 "savegame.cfsml" if (_cfsml_read_int(fh, (int*) &(save_struc->restore_time), value, line, hiteof)) { _cfsml_error("Token expected by _cfsml_read_int() for restore_time at line %d\n", *line); return CFSML_FAILURE; } } else if (!strcmp(token, "loops")) { +#line 749 "savegame.cfsml" if (_cfsml_read_int(fh, (int*) &(save_struc->loops), value, line, hiteof)) { _cfsml_error("Token expected by _cfsml_read_int() for loops at line %d\n", *line); return CFSML_FAILURE; } } else if (!strcmp(token, "hold")) { +#line 749 "savegame.cfsml" if (_cfsml_read_int(fh, (int*) &(save_struc->hold), value, line, hiteof)) { _cfsml_error("Token expected by _cfsml_read_int() for hold at line %d\n", *line); return CFSML_FAILURE; } } else +#line 758 "savegame.cfsml" { _cfsml_error("song_t: Assignment to invalid identifier '%s' in line %d\n", token, *line); return CFSML_FAILURE; @@ -1449,11 +1571,13 @@ int min, max, i; return CFSML_SUCCESS; } +#line 444 "savegame.cfsml" static void _cfsml_write_menu_item_t(FILE *fh, menu_item_t* save_struc) { int min, max, i; +#line 464 "savegame.cfsml" fprintf(fh, "{\n"); fprintf(fh, "type = "); _cfsml_write_int(fh, (int*) &(save_struc->type)); @@ -1469,6 +1593,7 @@ _cfsml_write_menu_item_t(FILE *fh, menu_item_t* save_struc) fprintf(fh, "\n"); fprintf(fh, "said = "); min = max = MENU_SAID_SPEC_SIZE; +#line 490 "savegame.cfsml" fprintf(fh, "[%d][\n", max); for (i = 0; i < min; i++) { _cfsml_write_byte(fh, &(save_struc->said[i])); @@ -1500,11 +1625,13 @@ _cfsml_write_menu_item_t(FILE *fh, menu_item_t* save_struc) fprintf(fh, "}"); } +#line 538 "savegame.cfsml" static int _cfsml_read_menu_item_t(FILE *fh, menu_item_t* save_struc, char *lastval, int *line, int *hiteof) { char *token; int min, max, i; +#line 599 "savegame.cfsml" int assignment, closed, done; if (strcmp(lastval, "{")) { @@ -1536,39 +1663,46 @@ int min, max, i; return CFSML_FAILURE; } if (!strcmp(token, "type")) { +#line 749 "savegame.cfsml" if (_cfsml_read_int(fh, (int*) &(save_struc->type), value, line, hiteof)) { _cfsml_error("Token expected by _cfsml_read_int() for type at line %d\n", *line); return CFSML_FAILURE; } } else if (!strcmp(token, "keytext")) { +#line 749 "savegame.cfsml" if (_cfsml_read_string(fh, (char **) &(save_struc->keytext), value, line, hiteof)) { _cfsml_error("Token expected by _cfsml_read_string() for keytext at line %d\n", *line); return CFSML_FAILURE; } } else if (!strcmp(token, "keytext_size")) { +#line 749 "savegame.cfsml" if (_cfsml_read_int(fh, (int*) &(save_struc->keytext_size), value, line, hiteof)) { _cfsml_error("Token expected by _cfsml_read_int() for keytext_size at line %d\n", *line); return CFSML_FAILURE; } } else if (!strcmp(token, "flags")) { +#line 749 "savegame.cfsml" if (_cfsml_read_int(fh, (int*) &(save_struc->flags), value, line, hiteof)) { _cfsml_error("Token expected by _cfsml_read_int() for flags at line %d\n", *line); return CFSML_FAILURE; } } else if (!strcmp(token, "said")) { +#line 663 "savegame.cfsml" if ((value[0] != '[') || (value[strlen(value) - 1] != '[')) { _cfsml_error("Opening brackets expected at line %d\n", *line); return CFSML_FAILURE; } /* Prepare to restore static array */ max = MENU_SAID_SPEC_SIZE; +#line 699 "savegame.cfsml" done = i = 0; do { if (!(value = _cfsml_get_identifier(fh, line, hiteof, NULL))) { +#line 707 "savegame.cfsml" _cfsml_error("Token expected at line %d\n", *line); return 1; } @@ -1585,47 +1719,55 @@ int min, max, i; } while (!done); } else if (!strcmp(token, "said_pos")) { +#line 749 "savegame.cfsml" if (read_reg_t(fh, (reg_t*) &(save_struc->said_pos), value, line, hiteof)) { _cfsml_error("Token expected by read_reg_t() for said_pos at line %d\n", *line); return CFSML_FAILURE; } } else if (!strcmp(token, "text")) { +#line 749 "savegame.cfsml" if (_cfsml_read_string(fh, (char **) &(save_struc->text), value, line, hiteof)) { _cfsml_error("Token expected by _cfsml_read_string() for text at line %d\n", *line); return CFSML_FAILURE; } } else if (!strcmp(token, "text_pos")) { +#line 749 "savegame.cfsml" if (read_reg_t(fh, (reg_t*) &(save_struc->text_pos), value, line, hiteof)) { _cfsml_error("Token expected by read_reg_t() for text_pos at line %d\n", *line); return CFSML_FAILURE; } } else if (!strcmp(token, "modifiers")) { +#line 749 "savegame.cfsml" if (_cfsml_read_int(fh, (int*) &(save_struc->modifiers), value, line, hiteof)) { _cfsml_error("Token expected by _cfsml_read_int() for modifiers at line %d\n", *line); return CFSML_FAILURE; } } else if (!strcmp(token, "key")) { +#line 749 "savegame.cfsml" if (_cfsml_read_int(fh, (int*) &(save_struc->key), value, line, hiteof)) { _cfsml_error("Token expected by _cfsml_read_int() for key at line %d\n", *line); return CFSML_FAILURE; } } else if (!strcmp(token, "enabled")) { +#line 749 "savegame.cfsml" if (_cfsml_read_int(fh, (int*) &(save_struc->enabled), value, line, hiteof)) { _cfsml_error("Token expected by _cfsml_read_int() for enabled at line %d\n", *line); return CFSML_FAILURE; } } else if (!strcmp(token, "tag")) { +#line 749 "savegame.cfsml" if (_cfsml_read_int(fh, (int*) &(save_struc->tag), value, line, hiteof)) { _cfsml_error("Token expected by _cfsml_read_int() for tag at line %d\n", *line); return CFSML_FAILURE; } } else +#line 758 "savegame.cfsml" { _cfsml_error("menu_item_t: Assignment to invalid identifier '%s' in line %d\n", token, *line); return CFSML_FAILURE; @@ -1635,11 +1777,13 @@ int min, max, i; return CFSML_SUCCESS; } +#line 444 "savegame.cfsml" static void _cfsml_write_node_entry_t(FILE *fh, node_entry_t* save_struc) { int min, max, i; +#line 464 "savegame.cfsml" fprintf(fh, "{\n"); fprintf(fh, "next_free = "); _cfsml_write_int(fh, (int*) &(save_struc->next_free)); @@ -1650,11 +1794,13 @@ _cfsml_write_node_entry_t(FILE *fh, node_entry_t* save_struc) fprintf(fh, "}"); } +#line 538 "savegame.cfsml" static int _cfsml_read_node_entry_t(FILE *fh, node_entry_t* save_struc, char *lastval, int *line, int *hiteof) { char *token; int min, max, i; +#line 599 "savegame.cfsml" int assignment, closed, done; if (strcmp(lastval, "{")) { @@ -1686,17 +1832,20 @@ int min, max, i; return CFSML_FAILURE; } if (!strcmp(token, "next_free")) { +#line 749 "savegame.cfsml" if (_cfsml_read_int(fh, (int*) &(save_struc->next_free), value, line, hiteof)) { _cfsml_error("Token expected by _cfsml_read_int() for next_free at line %d\n", *line); return CFSML_FAILURE; } } else if (!strcmp(token, "entry")) { +#line 749 "savegame.cfsml" if (_cfsml_read_node_t(fh, (node_t*) &(save_struc->entry), value, line, hiteof)) { _cfsml_error("Token expected by _cfsml_read_node_t() for entry at line %d\n", *line); return CFSML_FAILURE; } } else +#line 758 "savegame.cfsml" { _cfsml_error("node_entry_t: Assignment to invalid identifier '%s' in line %d\n", token, *line); return CFSML_FAILURE; @@ -1706,16 +1855,19 @@ int min, max, i; return CFSML_SUCCESS; } +#line 444 "savegame.cfsml" static void _cfsml_write_seg_id_t(FILE *fh, seg_id_t* save_struc) { fprintf(fh, "%li", (long) *save_struc); } +#line 538 "savegame.cfsml" static int _cfsml_read_seg_id_t(FILE *fh, seg_id_t* save_struc, char *lastval, int *line, int *hiteof) { char *token; +#line 564 "savegame.cfsml" *save_struc = strtol(lastval, &token, 0); if ( (*save_struc == 0) && (token == lastval) ) { @@ -1729,11 +1881,13 @@ _cfsml_read_seg_id_t(FILE *fh, seg_id_t* save_struc, char *lastval, int *line, i return CFSML_SUCCESS; } +#line 444 "savegame.cfsml" static void _cfsml_write_dynmem_t(FILE *fh, dynmem_t* save_struc) { int min, max, i; +#line 464 "savegame.cfsml" fprintf(fh, "{\n"); fprintf(fh, "size = "); _cfsml_write_int(fh, (int*) &(save_struc->size)); @@ -1745,6 +1899,7 @@ _cfsml_write_dynmem_t(FILE *fh, dynmem_t* save_struc) min = max = save_struc->size; if (!save_struc->buf) min = max = 0; /* Don't write if it points to NULL */ +#line 490 "savegame.cfsml" fprintf(fh, "[%d][\n", max); for (i = 0; i < min; i++) { _cfsml_write_byte(fh, &(save_struc->buf[i])); @@ -1755,11 +1910,13 @@ _cfsml_write_dynmem_t(FILE *fh, dynmem_t* save_struc) fprintf(fh, "}"); } +#line 538 "savegame.cfsml" static int _cfsml_read_dynmem_t(FILE *fh, dynmem_t* save_struc, char *lastval, int *line, int *hiteof) { char *token; int min, max, i; +#line 599 "savegame.cfsml" int assignment, closed, done; if (strcmp(lastval, "{")) { @@ -1791,22 +1948,26 @@ int min, max, i; return CFSML_FAILURE; } if (!strcmp(token, "size")) { +#line 749 "savegame.cfsml" if (_cfsml_read_int(fh, (int*) &(save_struc->size), value, line, hiteof)) { _cfsml_error("Token expected by _cfsml_read_int() for size at line %d\n", *line); return CFSML_FAILURE; } } else if (!strcmp(token, "description")) { +#line 749 "savegame.cfsml" if (_cfsml_read_string(fh, (char **) &(save_struc->description), value, line, hiteof)) { _cfsml_error("Token expected by _cfsml_read_string() for description at line %d\n", *line); return CFSML_FAILURE; } } else if (!strcmp(token, "buf")) { +#line 663 "savegame.cfsml" if ((value[0] != '[') || (value[strlen(value) - 1] != '[')) { _cfsml_error("Opening brackets expected at line %d\n", *line); return CFSML_FAILURE; } +#line 673 "savegame.cfsml" /* Prepare to restore dynamic array */ max = strtol(value + 1, NULL, 0); if (max < 0) { @@ -1823,9 +1984,11 @@ int min, max, i; } else save_struc->buf = NULL; +#line 699 "savegame.cfsml" done = i = 0; do { if (!(value = _cfsml_get_identifier(fh, line, hiteof, NULL))) { +#line 707 "savegame.cfsml" _cfsml_error("Token expected at line %d\n", *line); return 1; } @@ -1842,6 +2005,7 @@ int min, max, i; } while (!done); save_struc->size = max ; /* Set array size accordingly */ } else +#line 758 "savegame.cfsml" { _cfsml_error("dynmem_t: Assignment to invalid identifier '%s' in line %d\n", token, *line); return CFSML_FAILURE; @@ -1851,11 +2015,13 @@ int min, max, i; return CFSML_SUCCESS; } +#line 444 "savegame.cfsml" static void _cfsml_write_local_variables_t(FILE *fh, local_variables_t* save_struc) { int min, max, i; +#line 464 "savegame.cfsml" fprintf(fh, "{\n"); fprintf(fh, "script_id = "); _cfsml_write_int(fh, (int*) &(save_struc->script_id)); @@ -1867,6 +2033,7 @@ _cfsml_write_local_variables_t(FILE *fh, local_variables_t* save_struc) min = max = save_struc->nr; if (!save_struc->locals) min = max = 0; /* Don't write if it points to NULL */ +#line 490 "savegame.cfsml" fprintf(fh, "[%d][\n", max); for (i = 0; i < min; i++) { write_reg_t(fh, &(save_struc->locals[i])); @@ -1877,11 +2044,13 @@ _cfsml_write_local_variables_t(FILE *fh, local_variables_t* save_struc) fprintf(fh, "}"); } +#line 538 "savegame.cfsml" static int _cfsml_read_local_variables_t(FILE *fh, local_variables_t* save_struc, char *lastval, int *line, int *hiteof) { char *token; int min, max, i; +#line 599 "savegame.cfsml" int assignment, closed, done; if (strcmp(lastval, "{")) { @@ -1913,22 +2082,26 @@ int min, max, i; return CFSML_FAILURE; } if (!strcmp(token, "script_id")) { +#line 749 "savegame.cfsml" if (_cfsml_read_int(fh, (int*) &(save_struc->script_id), value, line, hiteof)) { _cfsml_error("Token expected by _cfsml_read_int() for script_id at line %d\n", *line); return CFSML_FAILURE; } } else if (!strcmp(token, "nr")) { +#line 749 "savegame.cfsml" if (_cfsml_read_int(fh, (int*) &(save_struc->nr), value, line, hiteof)) { _cfsml_error("Token expected by _cfsml_read_int() for nr at line %d\n", *line); return CFSML_FAILURE; } } else if (!strcmp(token, "locals")) { +#line 663 "savegame.cfsml" if ((value[0] != '[') || (value[strlen(value) - 1] != '[')) { _cfsml_error("Opening brackets expected at line %d\n", *line); return CFSML_FAILURE; } +#line 673 "savegame.cfsml" /* Prepare to restore dynamic array */ max = strtol(value + 1, NULL, 0); if (max < 0) { @@ -1945,9 +2118,11 @@ int min, max, i; } else save_struc->locals = NULL; +#line 699 "savegame.cfsml" done = i = 0; do { if (!(value = _cfsml_get_identifier(fh, line, hiteof, NULL))) { +#line 707 "savegame.cfsml" _cfsml_error("Token expected at line %d\n", *line); return 1; } @@ -1964,6 +2139,7 @@ int min, max, i; } while (!done); save_struc->nr = max ; /* Set array size accordingly */ } else +#line 758 "savegame.cfsml" { _cfsml_error("local_variables_t: Assignment to invalid identifier '%s' in line %d\n", token, *line); return CFSML_FAILURE; @@ -1973,11 +2149,13 @@ int min, max, i; return CFSML_SUCCESS; } +#line 444 "savegame.cfsml" static void _cfsml_write_state_t(FILE *fh, state_t* save_struc) { int min, max, i; +#line 464 "savegame.cfsml" fprintf(fh, "{\n"); fprintf(fh, "savegame_version = "); _cfsml_write_int(fh, (int*) &(save_struc->savegame_version)); @@ -2007,6 +2185,7 @@ _cfsml_write_state_t(FILE *fh, state_t* save_struc) min = max = save_struc->classtable_size; if (!save_struc->classtable) min = max = 0; /* Don't write if it points to NULL */ +#line 490 "savegame.cfsml" fprintf(fh, "[%d][\n", max); for (i = 0; i < min; i++) { _cfsml_write_class_t(fh, &(save_struc->classtable[i])); @@ -2020,11 +2199,13 @@ _cfsml_write_state_t(FILE *fh, state_t* save_struc) fprintf(fh, "}"); } +#line 538 "savegame.cfsml" static int _cfsml_read_state_t(FILE *fh, state_t* save_struc, char *lastval, int *line, int *hiteof) { char *token; int min, max, i; +#line 599 "savegame.cfsml" int assignment, closed, done; if (strcmp(lastval, "{")) { @@ -2056,58 +2237,68 @@ int min, max, i; return CFSML_FAILURE; } if (!strcmp(token, "savegame_version")) { +#line 749 "savegame.cfsml" if (_cfsml_read_int(fh, (int*) &(save_struc->savegame_version), value, line, hiteof)) { _cfsml_error("Token expected by _cfsml_read_int() for savegame_version at line %d\n", *line); return CFSML_FAILURE; } } else if (!strcmp(token, "game_version")) { +#line 749 "savegame.cfsml" if (_cfsml_read_string(fh, (char **) &(save_struc->game_version), value, line, hiteof)) { _cfsml_error("Token expected by _cfsml_read_string() for game_version at line %d\n", *line); return CFSML_FAILURE; } } else if (!strcmp(token, "version")) { +#line 749 "savegame.cfsml" if (read_sci_version(fh, (sci_version_t*) &(save_struc->version), value, line, hiteof)) { _cfsml_error("Token expected by read_sci_version() for version at line %d\n", *line); return CFSML_FAILURE; } } else if (!strcmp(token, "menubar")) { +#line 749 "savegame.cfsml" if (read_menubar_tp(fh, (menubar_t **) &(save_struc->menubar), value, line, hiteof)) { _cfsml_error("Token expected by read_menubar_tp() for menubar at line %d\n", *line); return CFSML_FAILURE; } } else if (!strcmp(token, "status_bar_foreground")) { +#line 749 "savegame.cfsml" if (_cfsml_read_int(fh, (int*) &(save_struc->status_bar_foreground), value, line, hiteof)) { _cfsml_error("Token expected by _cfsml_read_int() for status_bar_foreground at line %d\n", *line); return CFSML_FAILURE; } } else if (!strcmp(token, "status_bar_background")) { +#line 749 "savegame.cfsml" if (_cfsml_read_int(fh, (int*) &(save_struc->status_bar_background), value, line, hiteof)) { _cfsml_error("Token expected by _cfsml_read_int() for status_bar_background at line %d\n", *line); return CFSML_FAILURE; } } else if (!strcmp(token, "seg_manager")) { +#line 749 "savegame.cfsml" if (_cfsml_read_seg_manager_t(fh, (seg_manager_t*) &(save_struc->seg_manager), value, line, hiteof)) { _cfsml_error("Token expected by _cfsml_read_seg_manager_t() for seg_manager at line %d\n", *line); return CFSML_FAILURE; } } else if (!strcmp(token, "classtable_size")) { +#line 749 "savegame.cfsml" if (_cfsml_read_int(fh, (int*) &(save_struc->classtable_size), value, line, hiteof)) { _cfsml_error("Token expected by _cfsml_read_int() for classtable_size at line %d\n", *line); return CFSML_FAILURE; } } else if (!strcmp(token, "classtable")) { +#line 663 "savegame.cfsml" if ((value[0] != '[') || (value[strlen(value) - 1] != '[')) { _cfsml_error("Opening brackets expected at line %d\n", *line); return CFSML_FAILURE; } +#line 673 "savegame.cfsml" /* Prepare to restore dynamic array */ max = strtol(value + 1, NULL, 0); if (max < 0) { @@ -2124,9 +2315,11 @@ int min, max, i; } else save_struc->classtable = NULL; +#line 699 "savegame.cfsml" done = i = 0; do { if (!(value = _cfsml_get_identifier(fh, line, hiteof, NULL))) { +#line 707 "savegame.cfsml" _cfsml_error("Token expected at line %d\n", *line); return 1; } @@ -2144,11 +2337,13 @@ int min, max, i; save_struc->classtable_size = max ; /* Set array size accordingly */ } else if (!strcmp(token, "sound")) { +#line 749 "savegame.cfsml" if (_cfsml_read_sfx_state_t(fh, (sfx_state_t*) &(save_struc->sound), value, line, hiteof)) { _cfsml_error("Token expected by _cfsml_read_sfx_state_t() for sound at line %d\n", *line); return CFSML_FAILURE; } } else +#line 758 "savegame.cfsml" { _cfsml_error("state_t: Assignment to invalid identifier '%s' in line %d\n", token, *line); return CFSML_FAILURE; @@ -2158,11 +2353,13 @@ int min, max, i; return CFSML_SUCCESS; } +#line 444 "savegame.cfsml" static void _cfsml_write_node_table_t(FILE *fh, node_table_t* save_struc) { int min, max, i; +#line 464 "savegame.cfsml" fprintf(fh, "{\n"); fprintf(fh, "entries_nr = "); _cfsml_write_int(fh, (int*) &(save_struc->entries_nr)); @@ -2180,6 +2377,7 @@ _cfsml_write_node_table_t(FILE *fh, node_table_t* save_struc) min = max = save_struc->entries_nr; if (!save_struc->table) min = max = 0; /* Don't write if it points to NULL */ +#line 490 "savegame.cfsml" fprintf(fh, "[%d][\n", max); for (i = 0; i < min; i++) { _cfsml_write_node_entry_t(fh, &(save_struc->table[i])); @@ -2190,11 +2388,13 @@ _cfsml_write_node_table_t(FILE *fh, node_table_t* save_struc) fprintf(fh, "}"); } +#line 538 "savegame.cfsml" static int _cfsml_read_node_table_t(FILE *fh, node_table_t* save_struc, char *lastval, int *line, int *hiteof) { char *token; int min, max, i; +#line 599 "savegame.cfsml" int assignment, closed, done; if (strcmp(lastval, "{")) { @@ -2226,34 +2426,40 @@ int min, max, i; return CFSML_FAILURE; } if (!strcmp(token, "entries_nr")) { +#line 749 "savegame.cfsml" if (_cfsml_read_int(fh, (int*) &(save_struc->entries_nr), value, line, hiteof)) { _cfsml_error("Token expected by _cfsml_read_int() for entries_nr at line %d\n", *line); return CFSML_FAILURE; } } else if (!strcmp(token, "first_free")) { +#line 749 "savegame.cfsml" if (_cfsml_read_int(fh, (int*) &(save_struc->first_free), value, line, hiteof)) { _cfsml_error("Token expected by _cfsml_read_int() for first_free at line %d\n", *line); return CFSML_FAILURE; } } else if (!strcmp(token, "entries_used")) { +#line 749 "savegame.cfsml" if (_cfsml_read_int(fh, (int*) &(save_struc->entries_used), value, line, hiteof)) { _cfsml_error("Token expected by _cfsml_read_int() for entries_used at line %d\n", *line); return CFSML_FAILURE; } } else if (!strcmp(token, "max_entry")) { +#line 749 "savegame.cfsml" if (_cfsml_read_int(fh, (int*) &(save_struc->max_entry), value, line, hiteof)) { _cfsml_error("Token expected by _cfsml_read_int() for max_entry at line %d\n", *line); return CFSML_FAILURE; } } else if (!strcmp(token, "table")) { +#line 663 "savegame.cfsml" if ((value[0] != '[') || (value[strlen(value) - 1] != '[')) { _cfsml_error("Opening brackets expected at line %d\n", *line); return CFSML_FAILURE; } +#line 673 "savegame.cfsml" /* Prepare to restore dynamic array */ max = strtol(value + 1, NULL, 0); if (max < 0) { @@ -2270,9 +2476,11 @@ int min, max, i; } else save_struc->table = NULL; +#line 699 "savegame.cfsml" done = i = 0; do { if (!(value = _cfsml_get_identifier(fh, line, hiteof, NULL))) { +#line 707 "savegame.cfsml" _cfsml_error("Token expected at line %d\n", *line); return 1; } @@ -2289,6 +2497,7 @@ int min, max, i; } while (!done); save_struc->entries_nr = max ; /* Set array size accordingly */ } else +#line 758 "savegame.cfsml" { _cfsml_error("node_table_t: Assignment to invalid identifier '%s' in line %d\n", token, *line); return CFSML_FAILURE; @@ -2298,14 +2507,17 @@ int min, max, i; return CFSML_SUCCESS; } +#line 444 "savegame.cfsml" static void _cfsml_write_sys_strings_t(FILE *fh, sys_strings_t* save_struc) { int min, max, i; +#line 464 "savegame.cfsml" fprintf(fh, "{\n"); fprintf(fh, "strings = "); min = max = SYS_STRINGS_MAX; +#line 490 "savegame.cfsml" fprintf(fh, "[%d][\n", max); for (i = 0; i < min; i++) { _cfsml_write_sys_string_t(fh, &(save_struc->strings[i])); @@ -2316,11 +2528,13 @@ _cfsml_write_sys_strings_t(FILE *fh, sys_strings_t* save_struc) fprintf(fh, "}"); } +#line 538 "savegame.cfsml" static int _cfsml_read_sys_strings_t(FILE *fh, sys_strings_t* save_struc, char *lastval, int *line, int *hiteof) { char *token; int min, max, i; +#line 599 "savegame.cfsml" int assignment, closed, done; if (strcmp(lastval, "{")) { @@ -2352,15 +2566,18 @@ int min, max, i; return CFSML_FAILURE; } if (!strcmp(token, "strings")) { +#line 663 "savegame.cfsml" if ((value[0] != '[') || (value[strlen(value) - 1] != '[')) { _cfsml_error("Opening brackets expected at line %d\n", *line); return CFSML_FAILURE; } /* Prepare to restore static array */ max = SYS_STRINGS_MAX; +#line 699 "savegame.cfsml" done = i = 0; do { if (!(value = _cfsml_get_identifier(fh, line, hiteof, NULL))) { +#line 707 "savegame.cfsml" _cfsml_error("Token expected at line %d\n", *line); return 1; } @@ -2376,6 +2593,7 @@ int min, max, i; } else done = 1; } while (!done); } else +#line 758 "savegame.cfsml" { _cfsml_error("sys_strings_t: Assignment to invalid identifier '%s' in line %d\n", token, *line); return CFSML_FAILURE; @@ -2385,16 +2603,19 @@ int min, max, i; return CFSML_SUCCESS; } +#line 444 "savegame.cfsml" static void _cfsml_write_byte(FILE *fh, byte* save_struc) { fprintf(fh, "%li", (long) *save_struc); } +#line 538 "savegame.cfsml" static int _cfsml_read_byte(FILE *fh, byte* save_struc, char *lastval, int *line, int *hiteof) { char *token; +#line 564 "savegame.cfsml" *save_struc = strtol(lastval, &token, 0); if ( (*save_struc == 0) && (token == lastval) ) { @@ -2408,11 +2629,13 @@ _cfsml_read_byte(FILE *fh, byte* save_struc, char *lastval, int *line, int *hite return CFSML_SUCCESS; } +#line 444 "savegame.cfsml" static void _cfsml_write_node_t(FILE *fh, node_t* save_struc) { int min, max, i; +#line 464 "savegame.cfsml" fprintf(fh, "{\n"); fprintf(fh, "pred = "); write_reg_t(fh, (reg_t*) &(save_struc->pred)); @@ -2429,11 +2652,13 @@ _cfsml_write_node_t(FILE *fh, node_t* save_struc) fprintf(fh, "}"); } +#line 538 "savegame.cfsml" static int _cfsml_read_node_t(FILE *fh, node_t* save_struc, char *lastval, int *line, int *hiteof) { char *token; int min, max, i; +#line 599 "savegame.cfsml" int assignment, closed, done; if (strcmp(lastval, "{")) { @@ -2465,29 +2690,34 @@ int min, max, i; return CFSML_FAILURE; } if (!strcmp(token, "pred")) { +#line 749 "savegame.cfsml" if (read_reg_t(fh, (reg_t*) &(save_struc->pred), value, line, hiteof)) { _cfsml_error("Token expected by read_reg_t() for pred at line %d\n", *line); return CFSML_FAILURE; } } else if (!strcmp(token, "succ")) { +#line 749 "savegame.cfsml" if (read_reg_t(fh, (reg_t*) &(save_struc->succ), value, line, hiteof)) { _cfsml_error("Token expected by read_reg_t() for succ at line %d\n", *line); return CFSML_FAILURE; } } else if (!strcmp(token, "key")) { +#line 749 "savegame.cfsml" if (read_reg_t(fh, (reg_t*) &(save_struc->key), value, line, hiteof)) { _cfsml_error("Token expected by read_reg_t() for key at line %d\n", *line); return CFSML_FAILURE; } } else if (!strcmp(token, "value")) { +#line 749 "savegame.cfsml" if (read_reg_t(fh, (reg_t*) &(save_struc->value), value, line, hiteof)) { _cfsml_error("Token expected by read_reg_t() for value at line %d\n", *line); return CFSML_FAILURE; } } else +#line 758 "savegame.cfsml" { _cfsml_error("node_t: Assignment to invalid identifier '%s' in line %d\n", token, *line); return CFSML_FAILURE; @@ -2497,11 +2727,13 @@ int min, max, i; return CFSML_SUCCESS; } +#line 444 "savegame.cfsml" static void _cfsml_write_list_table_t(FILE *fh, list_table_t* save_struc) { int min, max, i; +#line 464 "savegame.cfsml" fprintf(fh, "{\n"); fprintf(fh, "entries_nr = "); _cfsml_write_int(fh, (int*) &(save_struc->entries_nr)); @@ -2519,6 +2751,7 @@ _cfsml_write_list_table_t(FILE *fh, list_table_t* save_struc) min = max = save_struc->entries_nr; if (!save_struc->table) min = max = 0; /* Don't write if it points to NULL */ +#line 490 "savegame.cfsml" fprintf(fh, "[%d][\n", max); for (i = 0; i < min; i++) { _cfsml_write_list_entry_t(fh, &(save_struc->table[i])); @@ -2529,11 +2762,13 @@ _cfsml_write_list_table_t(FILE *fh, list_table_t* save_struc) fprintf(fh, "}"); } +#line 538 "savegame.cfsml" static int _cfsml_read_list_table_t(FILE *fh, list_table_t* save_struc, char *lastval, int *line, int *hiteof) { char *token; int min, max, i; +#line 599 "savegame.cfsml" int assignment, closed, done; if (strcmp(lastval, "{")) { @@ -2565,34 +2800,40 @@ int min, max, i; return CFSML_FAILURE; } if (!strcmp(token, "entries_nr")) { +#line 749 "savegame.cfsml" if (_cfsml_read_int(fh, (int*) &(save_struc->entries_nr), value, line, hiteof)) { _cfsml_error("Token expected by _cfsml_read_int() for entries_nr at line %d\n", *line); return CFSML_FAILURE; } } else if (!strcmp(token, "first_free")) { +#line 749 "savegame.cfsml" if (_cfsml_read_int(fh, (int*) &(save_struc->first_free), value, line, hiteof)) { _cfsml_error("Token expected by _cfsml_read_int() for first_free at line %d\n", *line); return CFSML_FAILURE; } } else if (!strcmp(token, "entries_used")) { +#line 749 "savegame.cfsml" if (_cfsml_read_int(fh, (int*) &(save_struc->entries_used), value, line, hiteof)) { _cfsml_error("Token expected by _cfsml_read_int() for entries_used at line %d\n", *line); return CFSML_FAILURE; } } else if (!strcmp(token, "max_entry")) { +#line 749 "savegame.cfsml" if (_cfsml_read_int(fh, (int*) &(save_struc->max_entry), value, line, hiteof)) { _cfsml_error("Token expected by _cfsml_read_int() for max_entry at line %d\n", *line); return CFSML_FAILURE; } } else if (!strcmp(token, "table")) { +#line 663 "savegame.cfsml" if ((value[0] != '[') || (value[strlen(value) - 1] != '[')) { _cfsml_error("Opening brackets expected at line %d\n", *line); return CFSML_FAILURE; } +#line 673 "savegame.cfsml" /* Prepare to restore dynamic array */ max = strtol(value + 1, NULL, 0); if (max < 0) { @@ -2609,9 +2850,11 @@ int min, max, i; } else save_struc->table = NULL; +#line 699 "savegame.cfsml" done = i = 0; do { if (!(value = _cfsml_get_identifier(fh, line, hiteof, NULL))) { +#line 707 "savegame.cfsml" _cfsml_error("Token expected at line %d\n", *line); return 1; } @@ -2628,6 +2871,7 @@ int min, max, i; } while (!done); save_struc->entries_nr = max ; /* Set array size accordingly */ } else +#line 758 "savegame.cfsml" { _cfsml_error("list_table_t: Assignment to invalid identifier '%s' in line %d\n", token, *line); return CFSML_FAILURE; @@ -2637,11 +2881,13 @@ int min, max, i; return CFSML_SUCCESS; } +#line 444 "savegame.cfsml" static void _cfsml_write_class_t(FILE *fh, class_t* save_struc) { int min, max, i; +#line 464 "savegame.cfsml" fprintf(fh, "{\n"); fprintf(fh, "script = "); _cfsml_write_int(fh, (int*) &(save_struc->script)); @@ -2652,11 +2898,13 @@ _cfsml_write_class_t(FILE *fh, class_t* save_struc) fprintf(fh, "}"); } +#line 538 "savegame.cfsml" static int _cfsml_read_class_t(FILE *fh, class_t* save_struc, char *lastval, int *line, int *hiteof) { char *token; int min, max, i; +#line 599 "savegame.cfsml" int assignment, closed, done; if (strcmp(lastval, "{")) { @@ -2688,17 +2936,20 @@ int min, max, i; return CFSML_FAILURE; } if (!strcmp(token, "script")) { +#line 749 "savegame.cfsml" if (_cfsml_read_int(fh, (int*) &(save_struc->script), value, line, hiteof)) { _cfsml_error("Token expected by _cfsml_read_int() for script at line %d\n", *line); return CFSML_FAILURE; } } else if (!strcmp(token, "reg")) { +#line 749 "savegame.cfsml" if (read_reg_t(fh, (reg_t*) &(save_struc->reg), value, line, hiteof)) { _cfsml_error("Token expected by read_reg_t() for reg at line %d\n", *line); return CFSML_FAILURE; } } else +#line 758 "savegame.cfsml" { _cfsml_error("class_t: Assignment to invalid identifier '%s' in line %d\n", token, *line); return CFSML_FAILURE; @@ -2708,16 +2959,19 @@ int min, max, i; return CFSML_SUCCESS; } +#line 444 "savegame.cfsml" static void _cfsml_write_song_handle_t(FILE *fh, song_handle_t* save_struc) { fprintf(fh, "%li", (long) *save_struc); } +#line 538 "savegame.cfsml" static int _cfsml_read_song_handle_t(FILE *fh, song_handle_t* save_struc, char *lastval, int *line, int *hiteof) { char *token; +#line 564 "savegame.cfsml" *save_struc = strtol(lastval, &token, 0); if ( (*save_struc == 0) && (token == lastval) ) { @@ -2731,16 +2985,19 @@ _cfsml_read_song_handle_t(FILE *fh, song_handle_t* save_struc, char *lastval, in return CFSML_SUCCESS; } +#line 444 "savegame.cfsml" static void _cfsml_write_int(FILE *fh, int* save_struc) { fprintf(fh, "%li", (long) *save_struc); } +#line 538 "savegame.cfsml" static int _cfsml_read_int(FILE *fh, int* save_struc, char *lastval, int *line, int *hiteof) { char *token; +#line 564 "savegame.cfsml" *save_struc = strtol(lastval, &token, 0); if ( (*save_struc == 0) && (token == lastval) ) { @@ -2754,11 +3011,13 @@ _cfsml_read_int(FILE *fh, int* save_struc, char *lastval, int *line, int *hiteof return CFSML_SUCCESS; } +#line 444 "savegame.cfsml" static void _cfsml_write_menu_t(FILE *fh, menu_t* save_struc) { int min, max, i; +#line 464 "savegame.cfsml" fprintf(fh, "{\n"); fprintf(fh, "title = "); _cfsml_write_string(fh, (char **) &(save_struc->title)); @@ -2773,6 +3032,7 @@ _cfsml_write_menu_t(FILE *fh, menu_t* save_struc) min = max = save_struc->items_nr; if (!save_struc->items) min = max = 0; /* Don't write if it points to NULL */ +#line 490 "savegame.cfsml" fprintf(fh, "[%d][\n", max); for (i = 0; i < min; i++) { _cfsml_write_menu_item_t(fh, &(save_struc->items[i])); @@ -2783,11 +3043,13 @@ _cfsml_write_menu_t(FILE *fh, menu_t* save_struc) fprintf(fh, "}"); } +#line 538 "savegame.cfsml" static int _cfsml_read_menu_t(FILE *fh, menu_t* save_struc, char *lastval, int *line, int *hiteof) { char *token; int min, max, i; +#line 599 "savegame.cfsml" int assignment, closed, done; if (strcmp(lastval, "{")) { @@ -2819,28 +3081,33 @@ int min, max, i; return CFSML_FAILURE; } if (!strcmp(token, "title")) { +#line 749 "savegame.cfsml" if (_cfsml_read_string(fh, (char **) &(save_struc->title), value, line, hiteof)) { _cfsml_error("Token expected by _cfsml_read_string() for title at line %d\n", *line); return CFSML_FAILURE; } } else if (!strcmp(token, "title_width")) { +#line 749 "savegame.cfsml" if (_cfsml_read_int(fh, (int*) &(save_struc->title_width), value, line, hiteof)) { _cfsml_error("Token expected by _cfsml_read_int() for title_width at line %d\n", *line); return CFSML_FAILURE; } } else if (!strcmp(token, "width")) { +#line 749 "savegame.cfsml" if (_cfsml_read_int(fh, (int*) &(save_struc->width), value, line, hiteof)) { _cfsml_error("Token expected by _cfsml_read_int() for width at line %d\n", *line); return CFSML_FAILURE; } } else if (!strcmp(token, "items")) { +#line 663 "savegame.cfsml" if ((value[0] != '[') || (value[strlen(value) - 1] != '[')) { _cfsml_error("Opening brackets expected at line %d\n", *line); return CFSML_FAILURE; } +#line 673 "savegame.cfsml" /* Prepare to restore dynamic array */ max = strtol(value + 1, NULL, 0); if (max < 0) { @@ -2857,9 +3124,11 @@ int min, max, i; } else save_struc->items = NULL; +#line 699 "savegame.cfsml" done = i = 0; do { if (!(value = _cfsml_get_identifier(fh, line, hiteof, NULL))) { +#line 707 "savegame.cfsml" _cfsml_error("Token expected at line %d\n", *line); return 1; } @@ -2876,6 +3145,7 @@ int min, max, i; } while (!done); save_struc->items_nr = max ; /* Set array size accordingly */ } else +#line 758 "savegame.cfsml" { _cfsml_error("menu_t: Assignment to invalid identifier '%s' in line %d\n", token, *line); return CFSML_FAILURE; @@ -2885,16 +3155,19 @@ int min, max, i; return CFSML_SUCCESS; } +#line 444 "savegame.cfsml" static void _cfsml_write_long(FILE *fh, long* save_struc) { fprintf(fh, "%li", (long) *save_struc); } +#line 538 "savegame.cfsml" static int _cfsml_read_long(FILE *fh, long* save_struc, char *lastval, int *line, int *hiteof) { char *token; +#line 564 "savegame.cfsml" *save_struc = strtol(lastval, &token, 0); if ( (*save_struc == 0) && (token == lastval) ) { @@ -2908,11 +3181,13 @@ _cfsml_read_long(FILE *fh, long* save_struc, char *lastval, int *line, int *hite return CFSML_SUCCESS; } +#line 444 "savegame.cfsml" static void _cfsml_write_clone_table_t(FILE *fh, clone_table_t* save_struc) { int min, max, i; +#line 464 "savegame.cfsml" fprintf(fh, "{\n"); fprintf(fh, "entries_nr = "); _cfsml_write_int(fh, (int*) &(save_struc->entries_nr)); @@ -2930,6 +3205,7 @@ _cfsml_write_clone_table_t(FILE *fh, clone_table_t* save_struc) min = max = save_struc->entries_nr; if (!save_struc->table) min = max = 0; /* Don't write if it points to NULL */ +#line 490 "savegame.cfsml" fprintf(fh, "[%d][\n", max); for (i = 0; i < min; i++) { _cfsml_write_clone_entry_t(fh, &(save_struc->table[i])); @@ -2940,11 +3216,13 @@ _cfsml_write_clone_table_t(FILE *fh, clone_table_t* save_struc) fprintf(fh, "}"); } +#line 538 "savegame.cfsml" static int _cfsml_read_clone_table_t(FILE *fh, clone_table_t* save_struc, char *lastval, int *line, int *hiteof) { char *token; int min, max, i; +#line 599 "savegame.cfsml" int assignment, closed, done; if (strcmp(lastval, "{")) { @@ -2976,34 +3254,40 @@ int min, max, i; return CFSML_FAILURE; } if (!strcmp(token, "entries_nr")) { +#line 749 "savegame.cfsml" if (_cfsml_read_int(fh, (int*) &(save_struc->entries_nr), value, line, hiteof)) { _cfsml_error("Token expected by _cfsml_read_int() for entries_nr at line %d\n", *line); return CFSML_FAILURE; } } else if (!strcmp(token, "first_free")) { +#line 749 "savegame.cfsml" if (_cfsml_read_int(fh, (int*) &(save_struc->first_free), value, line, hiteof)) { _cfsml_error("Token expected by _cfsml_read_int() for first_free at line %d\n", *line); return CFSML_FAILURE; } } else if (!strcmp(token, "entries_used")) { +#line 749 "savegame.cfsml" if (_cfsml_read_int(fh, (int*) &(save_struc->entries_used), value, line, hiteof)) { _cfsml_error("Token expected by _cfsml_read_int() for entries_used at line %d\n", *line); return CFSML_FAILURE; } } else if (!strcmp(token, "max_entry")) { +#line 749 "savegame.cfsml" if (_cfsml_read_int(fh, (int*) &(save_struc->max_entry), value, line, hiteof)) { _cfsml_error("Token expected by _cfsml_read_int() for max_entry at line %d\n", *line); return CFSML_FAILURE; } } else if (!strcmp(token, "table")) { +#line 663 "savegame.cfsml" if ((value[0] != '[') || (value[strlen(value) - 1] != '[')) { _cfsml_error("Opening brackets expected at line %d\n", *line); return CFSML_FAILURE; } +#line 673 "savegame.cfsml" /* Prepare to restore dynamic array */ max = strtol(value + 1, NULL, 0); if (max < 0) { @@ -3020,9 +3304,11 @@ int min, max, i; } else save_struc->table = NULL; +#line 699 "savegame.cfsml" done = i = 0; do { if (!(value = _cfsml_get_identifier(fh, line, hiteof, NULL))) { +#line 707 "savegame.cfsml" _cfsml_error("Token expected at line %d\n", *line); return 1; } @@ -3039,6 +3325,7 @@ int min, max, i; } while (!done); save_struc->entries_nr = max ; /* Set array size accordingly */ } else +#line 758 "savegame.cfsml" { _cfsml_error("clone_table_t: Assignment to invalid identifier '%s' in line %d\n", token, *line); return CFSML_FAILURE; @@ -3048,11 +3335,13 @@ int min, max, i; return CFSML_SUCCESS; } +#line 444 "savegame.cfsml" static void _cfsml_write_clone_t(FILE *fh, clone_t* save_struc) { int min, max, i; +#line 464 "savegame.cfsml" fprintf(fh, "{\n"); fprintf(fh, "flags = "); _cfsml_write_int(fh, (int*) &(save_struc->flags)); @@ -3073,6 +3362,7 @@ _cfsml_write_clone_t(FILE *fh, clone_t* save_struc) min = max = save_struc->variables_nr; if (!save_struc->variables) min = max = 0; /* Don't write if it points to NULL */ +#line 490 "savegame.cfsml" fprintf(fh, "[%d][\n", max); for (i = 0; i < min; i++) { write_reg_t(fh, &(save_struc->variables[i])); @@ -3083,11 +3373,13 @@ _cfsml_write_clone_t(FILE *fh, clone_t* save_struc) fprintf(fh, "}"); } +#line 538 "savegame.cfsml" static int _cfsml_read_clone_t(FILE *fh, clone_t* save_struc, char *lastval, int *line, int *hiteof) { char *token; int min, max, i; +#line 599 "savegame.cfsml" int assignment, closed, done; if (strcmp(lastval, "{")) { @@ -3119,40 +3411,47 @@ int min, max, i; return CFSML_FAILURE; } if (!strcmp(token, "flags")) { +#line 749 "savegame.cfsml" if (_cfsml_read_int(fh, (int*) &(save_struc->flags), value, line, hiteof)) { _cfsml_error("Token expected by _cfsml_read_int() for flags at line %d\n", *line); return CFSML_FAILURE; } } else if (!strcmp(token, "pos")) { +#line 749 "savegame.cfsml" if (read_reg_t(fh, (reg_t*) &(save_struc->pos), value, line, hiteof)) { _cfsml_error("Token expected by read_reg_t() for pos at line %d\n", *line); return CFSML_FAILURE; } } else if (!strcmp(token, "variables_nr")) { +#line 749 "savegame.cfsml" if (_cfsml_read_int(fh, (int*) &(save_struc->variables_nr), value, line, hiteof)) { _cfsml_error("Token expected by _cfsml_read_int() for variables_nr at line %d\n", *line); return CFSML_FAILURE; } } else if (!strcmp(token, "variable_names_nr")) { +#line 749 "savegame.cfsml" if (_cfsml_read_int(fh, (int*) &(save_struc->variable_names_nr), value, line, hiteof)) { _cfsml_error("Token expected by _cfsml_read_int() for variable_names_nr at line %d\n", *line); return CFSML_FAILURE; } } else if (!strcmp(token, "methods_nr")) { +#line 749 "savegame.cfsml" if (_cfsml_read_int(fh, (int*) &(save_struc->methods_nr), value, line, hiteof)) { _cfsml_error("Token expected by _cfsml_read_int() for methods_nr at line %d\n", *line); return CFSML_FAILURE; } } else if (!strcmp(token, "variables")) { +#line 663 "savegame.cfsml" if ((value[0] != '[') || (value[strlen(value) - 1] != '[')) { _cfsml_error("Opening brackets expected at line %d\n", *line); return CFSML_FAILURE; } +#line 673 "savegame.cfsml" /* Prepare to restore dynamic array */ max = strtol(value + 1, NULL, 0); if (max < 0) { @@ -3169,9 +3468,11 @@ int min, max, i; } else save_struc->variables = NULL; +#line 699 "savegame.cfsml" done = i = 0; do { if (!(value = _cfsml_get_identifier(fh, line, hiteof, NULL))) { +#line 707 "savegame.cfsml" _cfsml_error("Token expected at line %d\n", *line); return 1; } @@ -3188,6 +3489,7 @@ int min, max, i; } while (!done); save_struc->variables_nr = max ; /* Set array size accordingly */ } else +#line 758 "savegame.cfsml" { _cfsml_error("clone_t: Assignment to invalid identifier '%s' in line %d\n", token, *line); return CFSML_FAILURE; @@ -3197,11 +3499,13 @@ int min, max, i; return CFSML_SUCCESS; } +#line 444 "savegame.cfsml" static void _cfsml_write_list_t(FILE *fh, list_t* save_struc) { int min, max, i; +#line 464 "savegame.cfsml" fprintf(fh, "{\n"); fprintf(fh, "first = "); write_reg_t(fh, (reg_t*) &(save_struc->first)); @@ -3212,11 +3516,13 @@ _cfsml_write_list_t(FILE *fh, list_t* save_struc) fprintf(fh, "}"); } +#line 538 "savegame.cfsml" static int _cfsml_read_list_t(FILE *fh, list_t* save_struc, char *lastval, int *line, int *hiteof) { char *token; int min, max, i; +#line 599 "savegame.cfsml" int assignment, closed, done; if (strcmp(lastval, "{")) { @@ -3248,17 +3554,20 @@ int min, max, i; return CFSML_FAILURE; } if (!strcmp(token, "first")) { +#line 749 "savegame.cfsml" if (read_reg_t(fh, (reg_t*) &(save_struc->first), value, line, hiteof)) { _cfsml_error("Token expected by read_reg_t() for first at line %d\n", *line); return CFSML_FAILURE; } } else if (!strcmp(token, "last")) { +#line 749 "savegame.cfsml" if (read_reg_t(fh, (reg_t*) &(save_struc->last), value, line, hiteof)) { _cfsml_error("Token expected by read_reg_t() for last at line %d\n", *line); return CFSML_FAILURE; } } else +#line 758 "savegame.cfsml" { _cfsml_error("list_t: Assignment to invalid identifier '%s' in line %d\n", token, *line); return CFSML_FAILURE; @@ -3268,11 +3577,13 @@ int min, max, i; return CFSML_SUCCESS; } +#line 444 "savegame.cfsml" static void _cfsml_write_sys_string_t(FILE *fh, sys_string_t* save_struc) { int min, max, i; +#line 464 "savegame.cfsml" fprintf(fh, "{\n"); fprintf(fh, "name = "); _cfsml_write_string(fh, (char **) &(save_struc->name)); @@ -3286,11 +3597,13 @@ _cfsml_write_sys_string_t(FILE *fh, sys_string_t* save_struc) fprintf(fh, "}"); } +#line 538 "savegame.cfsml" static int _cfsml_read_sys_string_t(FILE *fh, sys_string_t* save_struc, char *lastval, int *line, int *hiteof) { char *token; int min, max, i; +#line 599 "savegame.cfsml" int assignment, closed, done; if (strcmp(lastval, "{")) { @@ -3322,23 +3635,27 @@ int min, max, i; return CFSML_FAILURE; } if (!strcmp(token, "name")) { +#line 749 "savegame.cfsml" if (_cfsml_read_string(fh, (char **) &(save_struc->name), value, line, hiteof)) { _cfsml_error("Token expected by _cfsml_read_string() for name at line %d\n", *line); return CFSML_FAILURE; } } else if (!strcmp(token, "max_size")) { +#line 749 "savegame.cfsml" if (_cfsml_read_int(fh, (int*) &(save_struc->max_size), value, line, hiteof)) { _cfsml_error("Token expected by _cfsml_read_int() for max_size at line %d\n", *line); return CFSML_FAILURE; } } else if (!strcmp(token, "value")) { +#line 749 "savegame.cfsml" if (_cfsml_read_string(fh, (char **) &(save_struc->value), value, line, hiteof)) { _cfsml_error("Token expected by _cfsml_read_string() for value at line %d\n", *line); return CFSML_FAILURE; } } else +#line 758 "savegame.cfsml" { _cfsml_error("sys_string_t: Assignment to invalid identifier '%s' in line %d\n", token, *line); return CFSML_FAILURE; @@ -3348,11 +3665,13 @@ int min, max, i; return CFSML_SUCCESS; } +#line 444 "savegame.cfsml" static void _cfsml_write_script_t(FILE *fh, script_t* save_struc) { int min, max, i; +#line 464 "savegame.cfsml" fprintf(fh, "{\n"); fprintf(fh, "nr = "); _cfsml_write_int(fh, (int*) &(save_struc->nr)); @@ -3388,6 +3707,7 @@ _cfsml_write_script_t(FILE *fh, script_t* save_struc) min = max = save_struc->objects_allocated; if (!save_struc->objects) min = max = 0; /* Don't write if it points to NULL */ +#line 490 "savegame.cfsml" fprintf(fh, "[%d][\n", max); for (i = 0; i < min; i++) { _cfsml_write_object_t(fh, &(save_struc->objects[i])); @@ -3407,11 +3727,13 @@ _cfsml_write_script_t(FILE *fh, script_t* save_struc) fprintf(fh, "}"); } +#line 538 "savegame.cfsml" static int _cfsml_read_script_t(FILE *fh, script_t* save_struc, char *lastval, int *line, int *hiteof) { char *token; int min, max, i; +#line 599 "savegame.cfsml" int assignment, closed, done; if (strcmp(lastval, "{")) { @@ -3443,70 +3765,82 @@ int min, max, i; return CFSML_FAILURE; } if (!strcmp(token, "nr")) { +#line 749 "savegame.cfsml" if (_cfsml_read_int(fh, (int*) &(save_struc->nr), value, line, hiteof)) { _cfsml_error("Token expected by _cfsml_read_int() for nr at line %d\n", *line); return CFSML_FAILURE; } } else if (!strcmp(token, "buf_size")) { +#line 749 "savegame.cfsml" if (_cfsml_read_size_t(fh, (size_t*) &(save_struc->buf_size), value, line, hiteof)) { _cfsml_error("Token expected by _cfsml_read_size_t() for buf_size at line %d\n", *line); return CFSML_FAILURE; } } else if (!strcmp(token, "script_size")) { +#line 749 "savegame.cfsml" if (_cfsml_read_size_t(fh, (size_t*) &(save_struc->script_size), value, line, hiteof)) { _cfsml_error("Token expected by _cfsml_read_size_t() for script_size at line %d\n", *line); return CFSML_FAILURE; } } else if (!strcmp(token, "heap_size")) { +#line 749 "savegame.cfsml" if (_cfsml_read_size_t(fh, (size_t*) &(save_struc->heap_size), value, line, hiteof)) { _cfsml_error("Token expected by _cfsml_read_size_t() for heap_size at line %d\n", *line); return CFSML_FAILURE; } } else if (!strcmp(token, "obj_indices")) { +#line 749 "savegame.cfsml" if (read_int_hash_map_tp(fh, (int_hash_map_t **) &(save_struc->obj_indices), value, line, hiteof)) { _cfsml_error("Token expected by read_int_hash_map_tp() for obj_indices at line %d\n", *line); return CFSML_FAILURE; } } else if (!strcmp(token, "exports_nr")) { +#line 749 "savegame.cfsml" if (_cfsml_read_int(fh, (int*) &(save_struc->exports_nr), value, line, hiteof)) { _cfsml_error("Token expected by _cfsml_read_int() for exports_nr at line %d\n", *line); return CFSML_FAILURE; } } else if (!strcmp(token, "synonyms_nr")) { +#line 749 "savegame.cfsml" if (_cfsml_read_int(fh, (int*) &(save_struc->synonyms_nr), value, line, hiteof)) { _cfsml_error("Token expected by _cfsml_read_int() for synonyms_nr at line %d\n", *line); return CFSML_FAILURE; } } else if (!strcmp(token, "lockers")) { +#line 749 "savegame.cfsml" if (_cfsml_read_int(fh, (int*) &(save_struc->lockers), value, line, hiteof)) { _cfsml_error("Token expected by _cfsml_read_int() for lockers at line %d\n", *line); return CFSML_FAILURE; } } else if (!strcmp(token, "objects_allocated")) { +#line 749 "savegame.cfsml" if (_cfsml_read_int(fh, (int*) &(save_struc->objects_allocated), value, line, hiteof)) { _cfsml_error("Token expected by _cfsml_read_int() for objects_allocated at line %d\n", *line); return CFSML_FAILURE; } } else if (!strcmp(token, "objects_nr")) { +#line 749 "savegame.cfsml" if (_cfsml_read_int(fh, (int*) &(save_struc->objects_nr), value, line, hiteof)) { _cfsml_error("Token expected by _cfsml_read_int() for objects_nr at line %d\n", *line); return CFSML_FAILURE; } } else if (!strcmp(token, "objects")) { +#line 663 "savegame.cfsml" if ((value[0] != '[') || (value[strlen(value) - 1] != '[')) { _cfsml_error("Opening brackets expected at line %d\n", *line); return CFSML_FAILURE; } +#line 673 "savegame.cfsml" /* Prepare to restore dynamic array */ max = strtol(value + 1, NULL, 0); if (max < 0) { @@ -3523,9 +3857,11 @@ int min, max, i; } else save_struc->objects = NULL; +#line 699 "savegame.cfsml" done = i = 0; do { if (!(value = _cfsml_get_identifier(fh, line, hiteof, NULL))) { +#line 707 "savegame.cfsml" _cfsml_error("Token expected at line %d\n", *line); return 1; } @@ -3543,23 +3879,27 @@ int min, max, i; save_struc->objects_allocated = max ; /* Set array size accordingly */ } else if (!strcmp(token, "locals_offset")) { +#line 749 "savegame.cfsml" if (_cfsml_read_int(fh, (int*) &(save_struc->locals_offset), value, line, hiteof)) { _cfsml_error("Token expected by _cfsml_read_int() for locals_offset at line %d\n", *line); return CFSML_FAILURE; } } else if (!strcmp(token, "locals_segment")) { +#line 749 "savegame.cfsml" if (_cfsml_read_int(fh, (int*) &(save_struc->locals_segment), value, line, hiteof)) { _cfsml_error("Token expected by _cfsml_read_int() for locals_segment at line %d\n", *line); return CFSML_FAILURE; } } else if (!strcmp(token, "marked_as_deleted")) { +#line 749 "savegame.cfsml" if (_cfsml_read_int(fh, (int*) &(save_struc->marked_as_deleted), value, line, hiteof)) { _cfsml_error("Token expected by _cfsml_read_int() for marked_as_deleted at line %d\n", *line); return CFSML_FAILURE; } } else +#line 758 "savegame.cfsml" { _cfsml_error("script_t: Assignment to invalid identifier '%s' in line %d\n", token, *line); return CFSML_FAILURE; @@ -3569,11 +3909,13 @@ int min, max, i; return CFSML_SUCCESS; } +#line 444 "savegame.cfsml" static void _cfsml_write_seg_manager_t(FILE *fh, seg_manager_t* save_struc) { int min, max, i; +#line 464 "savegame.cfsml" fprintf(fh, "{\n"); fprintf(fh, "id_seg_map = "); write_int_hash_map_tp(fh, (int_hash_map_t **) &(save_struc->id_seg_map)); @@ -3582,6 +3924,7 @@ _cfsml_write_seg_manager_t(FILE *fh, seg_manager_t* save_struc) min = max = save_struc->heap_size; if (!save_struc->heap) min = max = 0; /* Don't write if it points to NULL */ +#line 490 "savegame.cfsml" fprintf(fh, "[%d][\n", max); for (i = 0; i < min; i++) { write_mem_obj_tp(fh, &(save_struc->heap[i])); @@ -3619,11 +3962,13 @@ _cfsml_write_seg_manager_t(FILE *fh, seg_manager_t* save_struc) fprintf(fh, "}"); } +#line 538 "savegame.cfsml" static int _cfsml_read_seg_manager_t(FILE *fh, seg_manager_t* save_struc, char *lastval, int *line, int *hiteof) { char *token; int min, max, i; +#line 599 "savegame.cfsml" int assignment, closed, done; if (strcmp(lastval, "{")) { @@ -3655,16 +4000,19 @@ int min, max, i; return CFSML_FAILURE; } if (!strcmp(token, "id_seg_map")) { +#line 749 "savegame.cfsml" if (read_int_hash_map_tp(fh, (int_hash_map_t **) &(save_struc->id_seg_map), value, line, hiteof)) { _cfsml_error("Token expected by read_int_hash_map_tp() for id_seg_map at line %d\n", *line); return CFSML_FAILURE; } } else if (!strcmp(token, "heap")) { +#line 663 "savegame.cfsml" if ((value[0] != '[') || (value[strlen(value) - 1] != '[')) { _cfsml_error("Opening brackets expected at line %d\n", *line); return CFSML_FAILURE; } +#line 673 "savegame.cfsml" /* Prepare to restore dynamic array */ max = strtol(value + 1, NULL, 0); if (max < 0) { @@ -3681,9 +4029,11 @@ int min, max, i; } else save_struc->heap = NULL; +#line 699 "savegame.cfsml" done = i = 0; do { if (!(value = _cfsml_get_identifier(fh, line, hiteof, NULL))) { +#line 707 "savegame.cfsml" _cfsml_error("Token expected at line %d\n", *line); return 1; } @@ -3701,59 +4051,69 @@ int min, max, i; save_struc->heap_size = max ; /* Set array size accordingly */ } else if (!strcmp(token, "heap_size")) { +#line 749 "savegame.cfsml" if (_cfsml_read_int(fh, (int*) &(save_struc->heap_size), value, line, hiteof)) { _cfsml_error("Token expected by _cfsml_read_int() for heap_size at line %d\n", *line); return CFSML_FAILURE; } } else if (!strcmp(token, "reserved_id")) { +#line 749 "savegame.cfsml" if (_cfsml_read_int(fh, (int*) &(save_struc->reserved_id), value, line, hiteof)) { _cfsml_error("Token expected by _cfsml_read_int() for reserved_id at line %d\n", *line); return CFSML_FAILURE; } } else if (!strcmp(token, "exports_wide")) { +#line 749 "savegame.cfsml" if (_cfsml_read_int(fh, (int*) &(save_struc->exports_wide), value, line, hiteof)) { _cfsml_error("Token expected by _cfsml_read_int() for exports_wide at line %d\n", *line); return CFSML_FAILURE; } } else if (!strcmp(token, "sci1_1")) { +#line 749 "savegame.cfsml" if (_cfsml_read_int(fh, (int*) &(save_struc->sci1_1), value, line, hiteof)) { _cfsml_error("Token expected by _cfsml_read_int() for sci1_1 at line %d\n", *line); return CFSML_FAILURE; } } else if (!strcmp(token, "gc_mark_bits")) { +#line 749 "savegame.cfsml" if (_cfsml_read_int(fh, (int*) &(save_struc->gc_mark_bits), value, line, hiteof)) { _cfsml_error("Token expected by _cfsml_read_int() for gc_mark_bits at line %d\n", *line); return CFSML_FAILURE; } } else if (!strcmp(token, "mem_allocated")) { +#line 749 "savegame.cfsml" if (_cfsml_read_size_t(fh, (size_t*) &(save_struc->mem_allocated), value, line, hiteof)) { _cfsml_error("Token expected by _cfsml_read_size_t() for mem_allocated at line %d\n", *line); return CFSML_FAILURE; } } else if (!strcmp(token, "clones_seg_id")) { +#line 749 "savegame.cfsml" if (_cfsml_read_seg_id_t(fh, (seg_id_t*) &(save_struc->clones_seg_id), value, line, hiteof)) { _cfsml_error("Token expected by _cfsml_read_seg_id_t() for clones_seg_id at line %d\n", *line); return CFSML_FAILURE; } } else if (!strcmp(token, "lists_seg_id")) { +#line 749 "savegame.cfsml" if (_cfsml_read_seg_id_t(fh, (seg_id_t*) &(save_struc->lists_seg_id), value, line, hiteof)) { _cfsml_error("Token expected by _cfsml_read_seg_id_t() for lists_seg_id at line %d\n", *line); return CFSML_FAILURE; } } else if (!strcmp(token, "nodes_seg_id")) { +#line 749 "savegame.cfsml" if (_cfsml_read_seg_id_t(fh, (seg_id_t*) &(save_struc->nodes_seg_id), value, line, hiteof)) { _cfsml_error("Token expected by _cfsml_read_seg_id_t() for nodes_seg_id at line %d\n", *line); return CFSML_FAILURE; } } else +#line 758 "savegame.cfsml" { _cfsml_error("seg_manager_t: Assignment to invalid identifier '%s' in line %d\n", token, *line); return CFSML_FAILURE; @@ -3766,6 +4126,7 @@ int min, max, i; /* Auto-generated CFSML declaration and function block ends here */ /* Auto-generation performed by cfsml.pl 0.8.2 */ +#line 402 "savegame.cfsml" void write_songlib_t(FILE *fh, songlib_t *songlib) @@ -3780,10 +4141,12 @@ write_songlib_t(FILE *fh, songlib_t *songlib) while (seeker) { seeker->restore_time = seeker->it->get_timepos(seeker->it); +#line 877 "savegame.cfsml" /* Auto-generated CFSML data writer code */ _cfsml_write_song_t(fh, seeker); fprintf(fh, "\n"); /* End of auto-generated CFSML data writer code */ +#line 417 "savegame.cfsml" seeker = seeker->next; } fprintf(fh, "]\n"); @@ -3807,12 +4170,18 @@ read_songlib_t(FILE *fh, songlib_t *songlib, char *lastval, int *line, int *hite for (i = 0; i < songcount; i++) { /* Auto-generated CFSML data reader code */ +#line 823 "savegame.cfsml" { +#line 834 "savegame.cfsml" int _cfsml_eof = 0, _cfsml_error; int dummy; +#line 839 "savegame.cfsml" char *_cfsml_inp = lastval; +#line 847 "savegame.cfsml" _cfsml_error = read_song_tp(fh, &newsong, _cfsml_inp, &(*line), &_cfsml_eof); +#line 852 "savegame.cfsml" *hiteof = _cfsml_error; +#line 859 "savegame.cfsml" if (_cfsml_last_value_retreived) { free(_cfsml_last_value_retreived); _cfsml_last_value_retreived = NULL; @@ -3823,6 +4192,7 @@ read_songlib_t(FILE *fh, songlib_t *songlib, char *lastval, int *line, int *hite } } /* End of auto-generated CFSML data reader code */ +#line 440 "savegame.cfsml" song_lib_add(*songlib, newsong); } fscanf(fh, "]\n"); @@ -3864,19 +4234,23 @@ static int bucket_length; void write_int_hash_map_tp(FILE *fh, int_hash_map_t **foo) { +#line 877 "savegame.cfsml" /* Auto-generated CFSML data writer code */ _cfsml_write_int_hash_map_t(fh, *foo); fprintf(fh, "\n"); /* End of auto-generated CFSML data writer code */ +#line 482 "savegame.cfsml" } void write_song_tp(FILE *fh, song_t **foo) { +#line 877 "savegame.cfsml" /* Auto-generated CFSML data writer code */ _cfsml_write_song_t(fh, *foo); fprintf(fh, "\n"); /* End of auto-generated CFSML data writer code */ +#line 488 "savegame.cfsml" } song_iterator_t * @@ -3890,12 +4264,18 @@ read_song_tp(FILE *fh, song_t **foo, char *lastval, int *line, int *hiteof) *foo = (song_t*) malloc(sizeof(song_t)); token = _cfsml_get_identifier(fh, line, hiteof, &assignment); /* Auto-generated CFSML data reader code */ +#line 823 "savegame.cfsml" { +#line 834 "savegame.cfsml" int _cfsml_eof = 0, _cfsml_error; int dummy; +#line 839 "savegame.cfsml" char *_cfsml_inp = token; +#line 847 "savegame.cfsml" _cfsml_error = _cfsml_read_song_t(fh, (*foo), _cfsml_inp, &(*line), &_cfsml_eof); +#line 852 "savegame.cfsml" *hiteof = _cfsml_error; +#line 859 "savegame.cfsml" if (_cfsml_last_value_retreived) { free(_cfsml_last_value_retreived); _cfsml_last_value_retreived = NULL; @@ -3906,6 +4286,7 @@ read_song_tp(FILE *fh, song_t **foo, char *lastval, int *line, int *hiteof) } } /* End of auto-generated CFSML data reader code */ +#line 501 "savegame.cfsml" (*foo)->delay = 0; (*foo)->it = NULL; (*foo)->next_playing = (*foo)->next_stopping = (*foo)->next = NULL; @@ -3916,12 +4297,18 @@ read_int_hash_map_tp(FILE *fh, int_hash_map_t **foo, char *lastval, int *line, i { *foo = (int_hash_map_t*)malloc(sizeof(int_hash_map_t)); /* Auto-generated CFSML data reader code */ +#line 823 "savegame.cfsml" { +#line 834 "savegame.cfsml" int _cfsml_eof = 0, _cfsml_error; int dummy; +#line 839 "savegame.cfsml" char *_cfsml_inp = lastval; +#line 847 "savegame.cfsml" _cfsml_error = _cfsml_read_int_hash_map_t(fh, (*foo), _cfsml_inp, &(*line), &_cfsml_eof); +#line 852 "savegame.cfsml" *hiteof = _cfsml_error; +#line 859 "savegame.cfsml" if (_cfsml_last_value_retreived) { free(_cfsml_last_value_retreived); _cfsml_last_value_retreived = NULL; @@ -3932,6 +4319,7 @@ read_int_hash_map_tp(FILE *fh, int_hash_map_t **foo, char *lastval, int *line, i } } /* End of auto-generated CFSML data reader code */ +#line 511 "savegame.cfsml" (*foo)->holes = NULL; return 0; } @@ -3947,10 +4335,12 @@ write_int_hash_map_node_tp(FILE *fh, int_hash_map_node_t **foo) fprintf(fh,"[\n%d=>%d\n", (*foo)->name, (*foo)->value); if ((*foo)->next) { +#line 877 "savegame.cfsml" /* Auto-generated CFSML data writer code */ write_int_hash_map_node_tp(fh, &((*foo)->next)); fprintf(fh, "\n"); /* End of auto-generated CFSML data writer code */ +#line 527 "savegame.cfsml" } else fputc('L', fh); fputs("]", fh); } @@ -4004,10 +4394,12 @@ write_menubar_tp(FILE *fh, menubar_t **foo) { if (*foo) { +#line 877 "savegame.cfsml" /* Auto-generated CFSML data writer code */ _cfsml_write_menubar_t(fh, (*foo)); fprintf(fh, "\n"); /* End of auto-generated CFSML data writer code */ +#line 581 "savegame.cfsml" } else { /* Nothing to write */ fputs("\\null\\", fh); @@ -4025,12 +4417,18 @@ read_menubar_tp(FILE *fh, menubar_t **foo, char *lastval, int *line, int *hiteof *foo = (menubar_t *) sci_malloc(sizeof(menubar_t)); /* Auto-generated CFSML data reader code */ +#line 823 "savegame.cfsml" { +#line 834 "savegame.cfsml" int _cfsml_eof = 0, _cfsml_error; int dummy; +#line 839 "savegame.cfsml" char *_cfsml_inp = lastval; +#line 847 "savegame.cfsml" _cfsml_error = _cfsml_read_menubar_t(fh, (*foo), _cfsml_inp, &(*line), &_cfsml_eof); +#line 852 "savegame.cfsml" *hiteof = _cfsml_error; +#line 859 "savegame.cfsml" if (_cfsml_last_value_retreived) { free(_cfsml_last_value_retreived); _cfsml_last_value_retreived = NULL; @@ -4041,6 +4439,7 @@ read_menubar_tp(FILE *fh, menubar_t **foo, char *lastval, int *line, int *hiteof } } /* End of auto-generated CFSML data reader code */ +#line 598 "savegame.cfsml" } return *hiteof; @@ -4050,61 +4449,79 @@ void write_mem_obj_t(FILE *fh, mem_obj_t *foo) { fprintf(fh, "%s\n", mem_obj_string_names[foo->type].name); +#line 877 "savegame.cfsml" /* Auto-generated CFSML data writer code */ _cfsml_write_int(fh, &foo->segmgr_id); fprintf(fh, "\n"); /* End of auto-generated CFSML data writer code */ +#line 608 "savegame.cfsml" switch (foo->type) { case MEM_OBJ_SCRIPT: +#line 877 "savegame.cfsml" /* Auto-generated CFSML data writer code */ _cfsml_write_script_t(fh, &foo->data.script); fprintf(fh, "\n"); /* End of auto-generated CFSML data writer code */ +#line 612 "savegame.cfsml" break; case MEM_OBJ_CLONES: +#line 877 "savegame.cfsml" /* Auto-generated CFSML data writer code */ _cfsml_write_clone_table_t(fh, &foo->data.clones); fprintf(fh, "\n"); /* End of auto-generated CFSML data writer code */ +#line 615 "savegame.cfsml" break; case MEM_OBJ_LOCALS: +#line 877 "savegame.cfsml" /* Auto-generated CFSML data writer code */ _cfsml_write_local_variables_t(fh, &foo->data.locals); fprintf(fh, "\n"); /* End of auto-generated CFSML data writer code */ +#line 618 "savegame.cfsml" break; case MEM_OBJ_SYS_STRINGS: +#line 877 "savegame.cfsml" /* Auto-generated CFSML data writer code */ _cfsml_write_sys_strings_t(fh, &foo->data.sys_strings); fprintf(fh, "\n"); /* End of auto-generated CFSML data writer code */ +#line 621 "savegame.cfsml" break; case MEM_OBJ_STACK: +#line 877 "savegame.cfsml" /* Auto-generated CFSML data writer code */ _cfsml_write_int(fh, &foo->data.stack.nr); fprintf(fh, "\n"); /* End of auto-generated CFSML data writer code */ +#line 624 "savegame.cfsml" break; case MEM_OBJ_HUNK: break; case MEM_OBJ_LISTS: +#line 877 "savegame.cfsml" /* Auto-generated CFSML data writer code */ _cfsml_write_list_table_t(fh, &foo->data.lists); fprintf(fh, "\n"); /* End of auto-generated CFSML data writer code */ +#line 629 "savegame.cfsml" break; case MEM_OBJ_NODES: +#line 877 "savegame.cfsml" /* Auto-generated CFSML data writer code */ _cfsml_write_node_table_t(fh, &foo->data.nodes); fprintf(fh, "\n"); /* End of auto-generated CFSML data writer code */ +#line 632 "savegame.cfsml" break; case MEM_OBJ_DYNMEM: +#line 877 "savegame.cfsml" /* Auto-generated CFSML data writer code */ _cfsml_write_dynmem_t(fh, &foo->data.dynmem); fprintf(fh, "\n"); /* End of auto-generated CFSML data writer code */ +#line 635 "savegame.cfsml" break; } } @@ -4121,13 +4538,19 @@ read_mem_obj_t(FILE *fh, mem_obj_t *foo, char *lastval, int *line, int *hiteof) } /* Auto-generated CFSML data reader code */ +#line 823 "savegame.cfsml" { +#line 834 "savegame.cfsml" int _cfsml_eof = 0, _cfsml_error; int dummy; +#line 842 "savegame.cfsml" char *_cfsml_inp = _cfsml_get_identifier(fh, &(*line), &_cfsml_eof, &dummy); +#line 847 "savegame.cfsml" _cfsml_error = _cfsml_read_int(fh, &foo->segmgr_id, _cfsml_inp, &(*line), &_cfsml_eof); +#line 852 "savegame.cfsml" *hiteof = _cfsml_error; +#line 859 "savegame.cfsml" if (_cfsml_last_value_retreived) { free(_cfsml_last_value_retreived); _cfsml_last_value_retreived = NULL; @@ -4138,17 +4561,24 @@ read_mem_obj_t(FILE *fh, mem_obj_t *foo, char *lastval, int *line, int *hiteof) } } /* End of auto-generated CFSML data reader code */ +#line 651 "savegame.cfsml" switch (foo->type) { case MEM_OBJ_SCRIPT: /* Auto-generated CFSML data reader code */ +#line 823 "savegame.cfsml" { +#line 834 "savegame.cfsml" int _cfsml_eof = 0, _cfsml_error; int dummy; +#line 842 "savegame.cfsml" char *_cfsml_inp = _cfsml_get_identifier(fh, &(*line), &_cfsml_eof, &dummy); +#line 847 "savegame.cfsml" _cfsml_error = _cfsml_read_script_t(fh, &foo->data.script, _cfsml_inp, &(*line), &_cfsml_eof); +#line 852 "savegame.cfsml" *hiteof = _cfsml_error; +#line 859 "savegame.cfsml" if (_cfsml_last_value_retreived) { free(_cfsml_last_value_retreived); _cfsml_last_value_retreived = NULL; @@ -4159,16 +4589,23 @@ read_mem_obj_t(FILE *fh, mem_obj_t *foo, char *lastval, int *line, int *hiteof) } } /* End of auto-generated CFSML data reader code */ +#line 655 "savegame.cfsml" break; case MEM_OBJ_CLONES: /* Auto-generated CFSML data reader code */ +#line 823 "savegame.cfsml" { +#line 834 "savegame.cfsml" int _cfsml_eof = 0, _cfsml_error; int dummy; +#line 842 "savegame.cfsml" char *_cfsml_inp = _cfsml_get_identifier(fh, &(*line), &_cfsml_eof, &dummy); +#line 847 "savegame.cfsml" _cfsml_error = _cfsml_read_clone_table_t(fh, &foo->data.clones, _cfsml_inp, &(*line), &_cfsml_eof); +#line 852 "savegame.cfsml" *hiteof = _cfsml_error; +#line 859 "savegame.cfsml" if (_cfsml_last_value_retreived) { free(_cfsml_last_value_retreived); _cfsml_last_value_retreived = NULL; @@ -4179,16 +4616,23 @@ read_mem_obj_t(FILE *fh, mem_obj_t *foo, char *lastval, int *line, int *hiteof) } } /* End of auto-generated CFSML data reader code */ +#line 658 "savegame.cfsml" break; case MEM_OBJ_LOCALS: /* Auto-generated CFSML data reader code */ +#line 823 "savegame.cfsml" { +#line 834 "savegame.cfsml" int _cfsml_eof = 0, _cfsml_error; int dummy; +#line 842 "savegame.cfsml" char *_cfsml_inp = _cfsml_get_identifier(fh, &(*line), &_cfsml_eof, &dummy); +#line 847 "savegame.cfsml" _cfsml_error = _cfsml_read_local_variables_t(fh, &foo->data.locals, _cfsml_inp, &(*line), &_cfsml_eof); +#line 852 "savegame.cfsml" *hiteof = _cfsml_error; +#line 859 "savegame.cfsml" if (_cfsml_last_value_retreived) { free(_cfsml_last_value_retreived); _cfsml_last_value_retreived = NULL; @@ -4199,16 +4643,23 @@ read_mem_obj_t(FILE *fh, mem_obj_t *foo, char *lastval, int *line, int *hiteof) } } /* End of auto-generated CFSML data reader code */ +#line 661 "savegame.cfsml" break; case MEM_OBJ_SYS_STRINGS: /* Auto-generated CFSML data reader code */ +#line 823 "savegame.cfsml" { +#line 834 "savegame.cfsml" int _cfsml_eof = 0, _cfsml_error; int dummy; +#line 842 "savegame.cfsml" char *_cfsml_inp = _cfsml_get_identifier(fh, &(*line), &_cfsml_eof, &dummy); +#line 847 "savegame.cfsml" _cfsml_error = _cfsml_read_sys_strings_t(fh, &foo->data.sys_strings, _cfsml_inp, &(*line), &_cfsml_eof); +#line 852 "savegame.cfsml" *hiteof = _cfsml_error; +#line 859 "savegame.cfsml" if (_cfsml_last_value_retreived) { free(_cfsml_last_value_retreived); _cfsml_last_value_retreived = NULL; @@ -4219,16 +4670,23 @@ read_mem_obj_t(FILE *fh, mem_obj_t *foo, char *lastval, int *line, int *hiteof) } } /* End of auto-generated CFSML data reader code */ +#line 664 "savegame.cfsml" break; case MEM_OBJ_LISTS: /* Auto-generated CFSML data reader code */ +#line 823 "savegame.cfsml" { +#line 834 "savegame.cfsml" int _cfsml_eof = 0, _cfsml_error; int dummy; +#line 842 "savegame.cfsml" char *_cfsml_inp = _cfsml_get_identifier(fh, &(*line), &_cfsml_eof, &dummy); +#line 847 "savegame.cfsml" _cfsml_error = _cfsml_read_list_table_t(fh, &foo->data.lists, _cfsml_inp, &(*line), &_cfsml_eof); +#line 852 "savegame.cfsml" *hiteof = _cfsml_error; +#line 859 "savegame.cfsml" if (_cfsml_last_value_retreived) { free(_cfsml_last_value_retreived); _cfsml_last_value_retreived = NULL; @@ -4239,16 +4697,23 @@ read_mem_obj_t(FILE *fh, mem_obj_t *foo, char *lastval, int *line, int *hiteof) } } /* End of auto-generated CFSML data reader code */ +#line 667 "savegame.cfsml" break; case MEM_OBJ_NODES: /* Auto-generated CFSML data reader code */ +#line 823 "savegame.cfsml" { +#line 834 "savegame.cfsml" int _cfsml_eof = 0, _cfsml_error; int dummy; +#line 842 "savegame.cfsml" char *_cfsml_inp = _cfsml_get_identifier(fh, &(*line), &_cfsml_eof, &dummy); +#line 847 "savegame.cfsml" _cfsml_error = _cfsml_read_node_table_t(fh, &foo->data.nodes, _cfsml_inp, &(*line), &_cfsml_eof); +#line 852 "savegame.cfsml" *hiteof = _cfsml_error; +#line 859 "savegame.cfsml" if (_cfsml_last_value_retreived) { free(_cfsml_last_value_retreived); _cfsml_last_value_retreived = NULL; @@ -4259,16 +4724,23 @@ read_mem_obj_t(FILE *fh, mem_obj_t *foo, char *lastval, int *line, int *hiteof) } } /* End of auto-generated CFSML data reader code */ +#line 670 "savegame.cfsml" break; case MEM_OBJ_STACK: /* Auto-generated CFSML data reader code */ +#line 823 "savegame.cfsml" { +#line 834 "savegame.cfsml" int _cfsml_eof = 0, _cfsml_error; int dummy; +#line 842 "savegame.cfsml" char *_cfsml_inp = _cfsml_get_identifier(fh, &(*line), &_cfsml_eof, &dummy); +#line 847 "savegame.cfsml" _cfsml_error = _cfsml_read_int(fh, &foo->data.stack.nr, _cfsml_inp, &(*line), &_cfsml_eof); +#line 852 "savegame.cfsml" *hiteof = _cfsml_error; +#line 859 "savegame.cfsml" if (_cfsml_last_value_retreived) { free(_cfsml_last_value_retreived); _cfsml_last_value_retreived = NULL; @@ -4279,6 +4751,7 @@ read_mem_obj_t(FILE *fh, mem_obj_t *foo, char *lastval, int *line, int *hiteof) } } /* End of auto-generated CFSML data reader code */ +#line 673 "savegame.cfsml" foo->data.stack.entries = (reg_t *)sci_calloc(foo->data.stack.nr, sizeof(reg_t)); break; case MEM_OBJ_HUNK: @@ -4286,13 +4759,19 @@ read_mem_obj_t(FILE *fh, mem_obj_t *foo, char *lastval, int *line, int *hiteof) break; case MEM_OBJ_DYNMEM: /* Auto-generated CFSML data reader code */ +#line 823 "savegame.cfsml" { +#line 834 "savegame.cfsml" int _cfsml_eof = 0, _cfsml_error; int dummy; +#line 842 "savegame.cfsml" char *_cfsml_inp = _cfsml_get_identifier(fh, &(*line), &_cfsml_eof, &dummy); +#line 847 "savegame.cfsml" _cfsml_error = _cfsml_read_dynmem_t(fh, &foo->data.dynmem, _cfsml_inp, &(*line), &_cfsml_eof); +#line 852 "savegame.cfsml" *hiteof = _cfsml_error; +#line 859 "savegame.cfsml" if (_cfsml_last_value_retreived) { free(_cfsml_last_value_retreived); _cfsml_last_value_retreived = NULL; @@ -4303,6 +4782,7 @@ read_mem_obj_t(FILE *fh, mem_obj_t *foo, char *lastval, int *line, int *hiteof) } } /* End of auto-generated CFSML data reader code */ +#line 680 "savegame.cfsml" break; } @@ -4314,10 +4794,12 @@ write_mem_obj_tp(FILE *fh, mem_obj_t **foo) { if (*foo) { +#line 877 "savegame.cfsml" /* Auto-generated CFSML data writer code */ write_mem_obj_t(fh, (*foo)); fprintf(fh, "\n"); /* End of auto-generated CFSML data writer code */ +#line 692 "savegame.cfsml" } else { /* Nothing to write */ fputs("\\null\\", fh); @@ -4333,12 +4815,18 @@ read_mem_obj_tp(FILE *fh, mem_obj_t **foo, char *lastval, int *line, int *hiteof } else { *foo = (mem_obj_t *) sci_malloc(sizeof(mem_obj_t)); /* Auto-generated CFSML data reader code */ +#line 823 "savegame.cfsml" { +#line 834 "savegame.cfsml" int _cfsml_eof = 0, _cfsml_error; int dummy; +#line 839 "savegame.cfsml" char *_cfsml_inp = lastval; +#line 847 "savegame.cfsml" _cfsml_error = read_mem_obj_t(fh, (*foo), _cfsml_inp, &(*line), &_cfsml_eof); +#line 852 "savegame.cfsml" *hiteof = _cfsml_error; +#line 859 "savegame.cfsml" if (_cfsml_last_value_retreived) { free(_cfsml_last_value_retreived); _cfsml_last_value_retreived = NULL; @@ -4349,6 +4837,7 @@ read_mem_obj_tp(FILE *fh, mem_obj_t **foo, char *lastval, int *line, int *hiteof } } /* End of auto-generated CFSML data reader code */ +#line 707 "savegame.cfsml" return *hiteof; } return 0; @@ -4415,10 +4904,12 @@ gamestate_save(state_t *s, char *dirname) s->game_time = time(NULL) - s->game_start_time.tv_sec; SCI_MEMTEST; +#line 877 "savegame.cfsml" /* Auto-generated CFSML data writer code */ _cfsml_write_state_t(fh, s); fprintf(fh, "\n"); /* End of auto-generated CFSML data writer code */ +#line 774 "savegame.cfsml" SCI_MEMTEST; fclose(fh); @@ -4762,16 +5253,25 @@ gamestate_restore(state_t *s, char *dirname) retval->sound_volume = s->sound_volume; /* Auto-generated CFSML data reader code */ +#line 823 "savegame.cfsml" { +#line 826 "savegame.cfsml" int _cfsml_line_ctr = 0; +#line 831 "savegame.cfsml" struct _cfsml_pointer_refstruct **_cfsml_myptrrefptr = _cfsml_get_current_refpointer(); +#line 834 "savegame.cfsml" int _cfsml_eof = 0, _cfsml_error; int dummy; +#line 842 "savegame.cfsml" char *_cfsml_inp = _cfsml_get_identifier(fh, &(_cfsml_line_ctr), &_cfsml_eof, &dummy); +#line 847 "savegame.cfsml" _cfsml_error = _cfsml_read_state_t(fh, retval, _cfsml_inp, &(_cfsml_line_ctr), &_cfsml_eof); +#line 852 "savegame.cfsml" read_eof = _cfsml_error; +#line 856 "savegame.cfsml" _cfsml_free_pointer_references(_cfsml_myptrrefptr, _cfsml_error); +#line 859 "savegame.cfsml" if (_cfsml_last_value_retreived) { free(_cfsml_last_value_retreived); _cfsml_last_value_retreived = NULL; @@ -4782,6 +5282,7 @@ gamestate_restore(state_t *s, char *dirname) } } /* End of auto-generated CFSML data reader code */ +#line 1117 "savegame.cfsml" fclose(fh); |