// // This file is generated by fmtgen from "libaegis/fstate.def". // If you want to change the contents of this file // you need to edit libaegis/fstate.def // or you need to enhance fmtgen. // #include #include #include #include #include #include #include #include #include #include #include #include void fingerprint_write(const output::pointer &fp, const char *name, fingerprint_ty *this_thing) { if (!this_thing) return; trace(("fingerprint_write(name = \"%s\", this_thing = %08lX)\n{\n", name, (long)this_thing)); assert(((fingerprint_ty *)this_thing)->reference_count > 0); trace(("rc = %ld;\n", ((fingerprint_ty *)this_thing)->reference_count)); if (name) { fp->fputs(name); fp->fputs(" =\n"); } fp->fputs("{\n"); time_write(fp, "youngest", this_thing->youngest, 0); time_write(fp, "oldest", this_thing->oldest, 0); string_write(fp, "crypto", this_thing->crypto); fp->fputs("}"); if (name) fp->fputs(";\n"); trace(("}\n")); } void fingerprint_write_xml(const output::pointer &fp, const char *name, fingerprint_ty *this_thing) { if (!this_thing) return; trace(("fingerprint_write_xml(name = \"%s\", this_thing = %08lX)\n{\n", name, (long)this_thing)); assert(name); assert(((fingerprint_ty *)this_thing)->reference_count > 0); trace(("rc = %ld;\n", ((fingerprint_ty *)this_thing)->reference_count)); assert(name); fp->fputc('<'); fp->fputs(name); fp->fputs(">\n"); time_write_xml(fp, "youngest", this_thing->youngest, 0); time_write_xml(fp, "oldest", this_thing->oldest, 0); string_write_xml(fp, "crypto", this_thing->crypto); fp->fputs("fputs(name); fp->fputs(">\n"); } static void * fingerprint_alloc(void) { fingerprint_ty *this_thing; trace(("fingerprint_alloc()\n{\n")); this_thing = (fingerprint_ty *)mem_alloc(sizeof(fingerprint_ty)); this_thing->reference_count = 1; this_thing->mask = 0; this_thing->errpos = str_copy(lex_position()); this_thing->youngest = (time_t)0; this_thing->oldest = (time_t)0; this_thing->crypto = (string_ty *)0; trace(("return %08lX;\n", (long)this_thing)); trace(("}\n")); return this_thing; } fingerprint_ty * fingerprint_copy(fingerprint_ty *this_thing) { trace(("fingerprint_copy()\n{\n")); this_thing->reference_count++; trace(("return %08lX;\n", (long)this_thing)); trace(("}\n")); return this_thing; } fingerprint_ty * fingerprint_clone(fingerprint_ty *this_thing) { if (!this_thing) return 0; trace(("fingerprint_clone()\n{\n")); fingerprint_ty *result = (fingerprint_ty *)fingerprint_alloc(); result->youngest = this_thing->youngest; result->oldest = this_thing->oldest; result->crypto = str_copy(this_thing->crypto); trace(("return %08lX;\n", (long)result)); trace(("}\n")); return result; } #ifdef DEBUG void fingerprint_trace_real(const char *name, const fingerprint_ty *value) { if (name && *name) { trace_printf("%s = ", name); } if (!value) { trace_printf("NULL"); } else { trace_printf("{\n"); trace_time_real("youngest", value->youngest); trace_time_real("oldest", value->oldest); trace_string_real("crypto", value->crypto); trace_printf("}"); } trace_printf((name && *name) ? ";\n" : ",\n"); } #endif // DEBUG static void fingerprint_free(void *that) { fingerprint_ty *this_thing; this_thing = (fingerprint_ty *)that; if (!this_thing) return; this_thing->reference_count--; assert(this_thing->reference_count >= 0); if (this_thing->reference_count > 0) return; trace(("fingerprint_free(this_thing = %08lX)\n{\n", (long)this_thing)); if (this_thing->errpos) { str_free(this_thing->errpos); this_thing->errpos = 0; } str_free(this_thing->crypto); mem_free(this_thing); trace(("}\n")); } static type_table_ty fingerprint_table[] = { { "youngest", offsetof(fingerprint_ty, youngest), &time_type, fingerprint_youngest_mask, 0, // redefinition not ok 0, // fast_name }, { "oldest", offsetof(fingerprint_ty, oldest), &time_type, fingerprint_oldest_mask, 0, // redefinition not ok 0, // fast_name }, { "crypto", offsetof(fingerprint_ty, crypto), &string_type, fingerprint_crypto_mask, 0, // redefinition not ok 0, // fast_name }, }; static void * fingerprint_parse(void *this_thing, string_ty *name, meta_type **type_pp, unsigned long *mask_p, int *redef_p) { void *addr; trace(("fingerprint_parse(this_thing = %08lX, name = %08lX, type_pp = %08lX)\n{\n", (long)this_thing, (long)name, (long)type_pp)); assert(((fingerprint_ty *)this_thing)->reference_count > 0); addr = generic_struct_parse ( this_thing, name, type_pp, mask_p, redef_p, fingerprint_table, SIZEOF(fingerprint_table) ); trace(("return %08lX;\n}\n", (long)addr)); return addr; } static string_ty * fingerprint_fuzzy(string_ty *name) { string_ty *result; trace(("fingerprint_fuzzy(name = %08lX)\n{\n", (long)name)); result = generic_struct_fuzzy ( name, fingerprint_table, SIZEOF(fingerprint_table) ); trace(("return %08lX;\n", (long)result)); trace(("}\n")); return result; } static rpt_value::pointer fingerprint_convert(void *this_thing) { trace(("fingerprint_convert(name = %08lX)\n{\n", (long)this_thing)); assert(((fingerprint_ty *)this_thing)->reference_count > 0); rpt_value::pointer result = generic_struct_convert ( this_thing, fingerprint_table, SIZEOF(fingerprint_table) ); trace(("return %08lX;\n", (long)result.get())); trace(("}\n")); return result; } meta_type fingerprint_type = { "fingerprint", fingerprint_alloc, fingerprint_free, 0, // enum_parse 0, // list_parse fingerprint_parse, fingerprint_fuzzy, fingerprint_convert, generic_struct_is_set, }; void fstate_src_architecture_times_write(const output::pointer &fp, const char *name, fstate_src_architecture_times_ty *this_thing) { if (!this_thing) return; trace(("fstate_src_architecture_times_write(name = \"%s\", this_thing = %08lX)\n{\n", name, (long)this_thing)); assert(((fstate_src_architecture_times_ty *)this_thing)->reference_count > 0); trace(("rc = %ld;\n", ((fstate_src_architecture_times_ty *)this_thing)->reference_count)); if (name) { fp->fputs(name); fp->fputs(" =\n"); } fp->fputs("{\n"); string_write(fp, "variant", this_thing->variant); time_write(fp, "test_time", this_thing->test_time, 0); time_write(fp, "test_baseline_time", this_thing->test_baseline_time, 0); fp->fputs("}"); if (name) fp->fputs(";\n"); trace(("}\n")); } void fstate_src_architecture_times_write_xml(const output::pointer &fp, const char *name, fstate_src_architecture_times_ty *this_thing) { if (!this_thing) return; trace(("fstate_src_architecture_times_write_xml(name = \"%s\", this_thing = %08lX)\n{\n", name, (long)this_thing)); assert(name); assert(((fstate_src_architecture_times_ty *)this_thing)->reference_count > 0); trace(("rc = %ld;\n", ((fstate_src_architecture_times_ty *)this_thing)->reference_count)); assert(name); fp->fputc('<'); fp->fputs(name); fp->fputs(">\n"); string_write_xml(fp, "variant", this_thing->variant); time_write_xml(fp, "test_time", this_thing->test_time, 0); time_write_xml(fp, "test_baseline_time", this_thing->test_baseline_time, 0); fp->fputs("fputs(name); fp->fputs(">\n"); } static void * fstate_src_architecture_times_alloc(void) { fstate_src_architecture_times_ty *this_thing; trace(("fstate_src_architecture_times_alloc()\n{\n")); this_thing = (fstate_src_architecture_times_ty *)mem_alloc(sizeof(fstate_src_architecture_times_ty)); this_thing->reference_count = 1; this_thing->mask = 0; this_thing->errpos = str_copy(lex_position()); this_thing->variant = (string_ty *)0; this_thing->test_time = (time_t)0; this_thing->test_baseline_time = (time_t)0; trace(("return %08lX;\n", (long)this_thing)); trace(("}\n")); return this_thing; } fstate_src_architecture_times_ty * fstate_src_architecture_times_copy(fstate_src_architecture_times_ty *this_thing) { trace(("fstate_src_architecture_times_copy()\n{\n")); this_thing->reference_count++; trace(("return %08lX;\n", (long)this_thing)); trace(("}\n")); return this_thing; } fstate_src_architecture_times_ty * fstate_src_architecture_times_clone(fstate_src_architecture_times_ty *this_thing) { if (!this_thing) return 0; trace(("fstate_src_architecture_times_clone()\n{\n")); fstate_src_architecture_times_ty *result = (fstate_src_architecture_times_ty *)fstate_src_architecture_times_alloc(); result->variant = str_copy(this_thing->variant); result->test_time = this_thing->test_time; result->test_baseline_time = this_thing->test_baseline_time; trace(("return %08lX;\n", (long)result)); trace(("}\n")); return result; } #ifdef DEBUG void fstate_src_architecture_times_trace_real(const char *name, const fstate_src_architecture_times_ty *value) { if (name && *name) { trace_printf("%s = ", name); } if (!value) { trace_printf("NULL"); } else { trace_printf("{\n"); trace_string_real("variant", value->variant); trace_time_real("test_time", value->test_time); trace_time_real("test_baseline_time", value->test_baseline_time); trace_printf("}"); } trace_printf((name && *name) ? ";\n" : ",\n"); } #endif // DEBUG static void fstate_src_architecture_times_free(void *that) { fstate_src_architecture_times_ty *this_thing; this_thing = (fstate_src_architecture_times_ty *)that; if (!this_thing) return; this_thing->reference_count--; assert(this_thing->reference_count >= 0); if (this_thing->reference_count > 0) return; trace(("fstate_src_architecture_times_free(this_thing = %08lX)\n{\n", (long)this_thing)); if (this_thing->errpos) { str_free(this_thing->errpos); this_thing->errpos = 0; } str_free(this_thing->variant); mem_free(this_thing); trace(("}\n")); } static type_table_ty fstate_src_architecture_times_table[] = { { "variant", offsetof(fstate_src_architecture_times_ty, variant), &string_type, fstate_src_architecture_times_variant_mask, 0, // redefinition not ok 0, // fast_name }, { "test_time", offsetof(fstate_src_architecture_times_ty, test_time), &time_type, fstate_src_architecture_times_test_time_mask, 0, // redefinition not ok 0, // fast_name }, { "test_baseline_time", offsetof(fstate_src_architecture_times_ty, test_baseline_time), &time_type, fstate_src_architecture_times_test_baseline_time_mask, 0, // redefinition not ok 0, // fast_name }, }; static void * fstate_src_architecture_times_parse(void *this_thing, string_ty *name, meta_type **type_pp, unsigned long *mask_p, int *redef_p) { void *addr; trace(("fstate_src_architecture_times_parse(this_thing = %08lX, name = %08lX, type_pp = %08lX)\n{\n", (long)this_thing, (long)name, (long)type_pp)); assert(((fstate_src_architecture_times_ty *)this_thing)->reference_count > 0); addr = generic_struct_parse ( this_thing, name, type_pp, mask_p, redef_p, fstate_src_architecture_times_table, SIZEOF(fstate_src_architecture_times_table) ); trace(("return %08lX;\n}\n", (long)addr)); return addr; } static string_ty * fstate_src_architecture_times_fuzzy(string_ty *name) { string_ty *result; trace(("fstate_src_architecture_times_fuzzy(name = %08lX)\n{\n", (long)name)); result = generic_struct_fuzzy ( name, fstate_src_architecture_times_table, SIZEOF(fstate_src_architecture_times_table) ); trace(("return %08lX;\n", (long)result)); trace(("}\n")); return result; } static rpt_value::pointer fstate_src_architecture_times_convert(void *this_thing) { trace(("fstate_src_architecture_times_convert(name = %08lX)\n{\n", (long)this_thing)); assert(((fstate_src_architecture_times_ty *)this_thing)->reference_count > 0); rpt_value::pointer result = generic_struct_convert ( this_thing, fstate_src_architecture_times_table, SIZEOF(fstate_src_architecture_times_table) ); trace(("return %08lX;\n", (long)result.get())); trace(("}\n")); return result; } meta_type fstate_src_architecture_times_type = { "fstate_src_architecture_times", fstate_src_architecture_times_alloc, fstate_src_architecture_times_free, 0, // enum_parse 0, // list_parse fstate_src_architecture_times_parse, fstate_src_architecture_times_fuzzy, fstate_src_architecture_times_convert, generic_struct_is_set, }; #include void fstate_src_architecture_times_list_write(const output::pointer &fp, const char *name, fstate_src_architecture_times_list_ty *this_thing) { size_t j; if (!this_thing) return; trace(("fstate_src_architecture_times_list_write(name = \"%s\", this_thing = %08lX)\n{\n", name, (long)this_thing)); if (name) { fp->fputs(name); fp->fputs(" =\n"); } assert(this_thing->length <= this_thing->maximum); assert(!this_thing->list == !this_thing->maximum); fp->fputs("[\n"); for (j = 0; j < this_thing->length; ++j) { fstate_src_architecture_times_write(fp, (const char *)0, this_thing->list[j]); fp->fputs(",\n"); } fp->fputs("]"); if (name) fp->fputs(";\n"); trace(("}\n")); } void fstate_src_architecture_times_list_write_xml(const output::pointer &fp, const char *name, fstate_src_architecture_times_list_ty *this_thing) { size_t j; if (!this_thing) return; trace(("fstate_src_architecture_times_list_write_xml(name = \"%s\", this_thing = %08lX)\n{\n", name, (long)this_thing)); assert(name); fp->fputc('<'); fp->fputs(name); fp->fputs(">\n"); assert(this_thing->length <= this_thing->maximum); assert(!this_thing->list == !this_thing->maximum); for (j = 0; j < this_thing->length; ++j) { fstate_src_architecture_times_write_xml(fp, "fstate_src_architecture_times", this_thing->list[j]); } fp->fputs("fputs(name); fp->fputs(">\n"); trace(("}\n")); } static void * fstate_src_architecture_times_list_alloc(void) { fstate_src_architecture_times_list_ty *result; trace(("fstate_src_architecture_times_list_alloc()\n{\n")); result = (fstate_src_architecture_times_list_ty *)mem_alloc(sizeof(fstate_src_architecture_times_list_ty)); result->list = 0; result->length = 0; result->maximum = 0; trace(("return %08lX;\n", (long)result)); trace(("}\n")); return result; } static void fstate_src_architecture_times_list_free(void *that) { fstate_src_architecture_times_list_ty *this_thing; size_t j; this_thing = (fstate_src_architecture_times_list_ty *)that; if (!this_thing) return; trace(("fstate_src_architecture_times_list_free(this_thing = %08lX)\n{\n", (long)this_thing)); assert(this_thing->length <= this_thing->maximum); assert(!this_thing->list == !this_thing->maximum); for (j = 0; j < this_thing->length; ++j) fstate_src_architecture_times_free(this_thing->list[j]); delete [] this_thing->list; mem_free(this_thing); trace(("}\n")); } static void * fstate_src_architecture_times_list_parse(void *that, meta_type **type_pp) { fstate_src_architecture_times_list_ty *this_thing; void *addr; this_thing = (fstate_src_architecture_times_list_ty *)that; trace(("fstate_src_architecture_times_list_parse(this_thing = %08lX, type_pp = %08lX)\n{\n", (long)this_thing, (long)type_pp)); assert(this_thing->length <= this_thing->maximum); assert(!this_thing->list == !this_thing->maximum); *type_pp = &fstate_src_architecture_times_type; trace_pointer(*type_pp); if (this_thing->length >= this_thing->maximum) { this_thing->maximum = this_thing->maximum * 2 + 16; fstate_src_architecture_times_ty * *new_list = new fstate_src_architecture_times_ty * [this_thing->maximum]; for (size_t j = 0; j < this_thing->length; ++j) new_list[j] = this_thing->list[j]; delete [] this_thing->list; this_thing->list = new_list; } addr = &this_thing->list[this_thing->length++]; trace(("return %08lX;\n", (long)addr)); trace(("}\n")); return addr; } static rpt_value::pointer fstate_src_architecture_times_list_convert(void *that) { fstate_src_architecture_times_list_ty *this_thing; size_t j; rpt_value::pointer vp; this_thing = *(fstate_src_architecture_times_list_ty **)that; if (!this_thing) return rpt_value::pointer(); trace(("fstate_src_architecture_times_list_convert(this_thing = %08lX)\n{\n", (long)this_thing)); assert(this_thing->length <= this_thing->maximum); assert(!this_thing->list == !this_thing->maximum); rpt_value_list *p = new rpt_value_list(); rpt_value::pointer result(p); for (j = 0; j < this_thing->length; ++j) { vp = fstate_src_architecture_times_type.convert(&this_thing->list[j]); assert(vp); p->append(vp); } trace(("}\n")); trace(("return %08lX;\n", (long)result.get())); return result; } fstate_src_architecture_times_list_ty * fstate_src_architecture_times_list_copy(fstate_src_architecture_times_list_ty *from) { size_t j; fstate_src_architecture_times_list_ty *result; if (!from) return 0; trace(("fstate_src_architecture_times_list_copy(from = %08lX)\n{\n", (long)from)); result = (fstate_src_architecture_times_list_ty *)fstate_src_architecture_times_list_alloc(); assert(from->length <= from->maximum); assert(!from->list == !from->maximum); for (j = 0; j < from->length; ++j) { fstate_src_architecture_times_ty * mp; fstate_src_architecture_times_ty * *mpp; meta_type *bogus; mp = from->list[j]; mpp = (fstate_src_architecture_times_ty **)fstate_src_architecture_times_list_parse(result, &bogus); *mpp = fstate_src_architecture_times_copy(mp); } trace(("return %8.8lX\n", (long)result)); trace(("}\n")); return result; } fstate_src_architecture_times_list_ty * fstate_src_architecture_times_list_clone(fstate_src_architecture_times_list_ty *from) { return fstate_src_architecture_times_list_copy(from); } #ifdef DEBUG void fstate_src_architecture_times_list_trace_real(const char *name, const fstate_src_architecture_times_list_ty *value) { if (name && *name) { trace_printf("%s = ", name); } if (!value) { trace_printf("NULL"); } else { trace_printf("[\n"); trace_printf("// length = %ld\n", (long)value->length); trace_printf("// maximum = %ld\n", (long)value->maximum); assert(value->length <= value->maximum); assert(!value->list == !value->maximum); for (size_t j = 0; j < value->length; ++j) { fstate_src_architecture_times_ty * mp = value->list[j]; fstate_src_architecture_times_trace_real("", mp); } trace_printf("]"); } trace_printf((name && *name) ? ";\n" : ",\n"); } #endif // DEBUG meta_type fstate_src_architecture_times_list_type = { "fstate_src_architecture_times_list", fstate_src_architecture_times_list_alloc, fstate_src_architecture_times_list_free, 0, // enum_parse fstate_src_architecture_times_list_parse, 0, // struct_parse 0, // fuzzy fstate_src_architecture_times_list_convert, generic_struct_is_set, }; void fstate_src_test_list_write(const output::pointer &fp, const char *name, fstate_src_test_list_ty *this_thing) { size_t j; if (!this_thing) return; trace(("fstate_src_test_list_write(name = \"%s\", this_thing = %08lX)\n{\n", name, (long)this_thing)); if (name) { fp->fputs(name); fp->fputs(" =\n"); } assert(this_thing->length <= this_thing->maximum); assert(!this_thing->list == !this_thing->maximum); fp->fputs("[\n"); for (j = 0; j < this_thing->length; ++j) { string_write(fp, (const char *)0, this_thing->list[j]); fp->fputs(",\n"); } fp->fputs("]"); if (name) fp->fputs(";\n"); trace(("}\n")); } void fstate_src_test_list_write_xml(const output::pointer &fp, const char *name, fstate_src_test_list_ty *this_thing) { size_t j; if (!this_thing) return; trace(("fstate_src_test_list_write_xml(name = \"%s\", this_thing = %08lX)\n{\n", name, (long)this_thing)); assert(name); fp->fputc('<'); fp->fputs(name); fp->fputs(">\n"); assert(this_thing->length <= this_thing->maximum); assert(!this_thing->list == !this_thing->maximum); for (j = 0; j < this_thing->length; ++j) { string_write_xml(fp, "string", this_thing->list[j]); } fp->fputs("fputs(name); fp->fputs(">\n"); trace(("}\n")); } static void * fstate_src_test_list_alloc(void) { fstate_src_test_list_ty *result; trace(("fstate_src_test_list_alloc()\n{\n")); result = (fstate_src_test_list_ty *)mem_alloc(sizeof(fstate_src_test_list_ty)); result->list = 0; result->length = 0; result->maximum = 0; trace(("return %08lX;\n", (long)result)); trace(("}\n")); return result; } static void fstate_src_test_list_free(void *that) { fstate_src_test_list_ty *this_thing; size_t j; this_thing = (fstate_src_test_list_ty *)that; if (!this_thing) return; trace(("fstate_src_test_list_free(this_thing = %08lX)\n{\n", (long)this_thing)); assert(this_thing->length <= this_thing->maximum); assert(!this_thing->list == !this_thing->maximum); for (j = 0; j < this_thing->length; ++j) str_free(this_thing->list[j]); delete [] this_thing->list; mem_free(this_thing); trace(("}\n")); } static void * fstate_src_test_list_parse(void *that, meta_type **type_pp) { fstate_src_test_list_ty *this_thing; void *addr; this_thing = (fstate_src_test_list_ty *)that; trace(("fstate_src_test_list_parse(this_thing = %08lX, type_pp = %08lX)\n{\n", (long)this_thing, (long)type_pp)); assert(this_thing->length <= this_thing->maximum); assert(!this_thing->list == !this_thing->maximum); *type_pp = &string_type; trace_pointer(*type_pp); if (this_thing->length >= this_thing->maximum) { this_thing->maximum = this_thing->maximum * 2 + 16; string_ty * *new_list = new string_ty * [this_thing->maximum]; for (size_t j = 0; j < this_thing->length; ++j) new_list[j] = this_thing->list[j]; delete [] this_thing->list; this_thing->list = new_list; } addr = &this_thing->list[this_thing->length++]; trace(("return %08lX;\n", (long)addr)); trace(("}\n")); return addr; } static rpt_value::pointer fstate_src_test_list_convert(void *that) { fstate_src_test_list_ty *this_thing; size_t j; rpt_value::pointer vp; this_thing = *(fstate_src_test_list_ty **)that; if (!this_thing) return rpt_value::pointer(); trace(("fstate_src_test_list_convert(this_thing = %08lX)\n{\n", (long)this_thing)); assert(this_thing->length <= this_thing->maximum); assert(!this_thing->list == !this_thing->maximum); rpt_value_list *p = new rpt_value_list(); rpt_value::pointer result(p); for (j = 0; j < this_thing->length; ++j) { vp = string_type.convert(&this_thing->list[j]); assert(vp); p->append(vp); } trace(("}\n")); trace(("return %08lX;\n", (long)result.get())); return result; } fstate_src_test_list_ty * fstate_src_test_list_copy(fstate_src_test_list_ty *from) { size_t j; fstate_src_test_list_ty *result; if (!from) return 0; trace(("fstate_src_test_list_copy(from = %08lX)\n{\n", (long)from)); result = (fstate_src_test_list_ty *)fstate_src_test_list_alloc(); assert(from->length <= from->maximum); assert(!from->list == !from->maximum); for (j = 0; j < from->length; ++j) { string_ty * mp; string_ty * *mpp; meta_type *bogus; mp = from->list[j]; mpp = (string_ty **)fstate_src_test_list_parse(result, &bogus); *mpp = string_copy(mp); } trace(("return %8.8lX\n", (long)result)); trace(("}\n")); return result; } fstate_src_test_list_ty * fstate_src_test_list_clone(fstate_src_test_list_ty *from) { return fstate_src_test_list_copy(from); } #ifdef DEBUG void fstate_src_test_list_trace_real(const char *name, const fstate_src_test_list_ty *value) { if (name && *name) { trace_printf("%s = ", name); } if (!value) { trace_printf("NULL"); } else { trace_printf("[\n"); trace_printf("// length = %ld\n", (long)value->length); trace_printf("// maximum = %ld\n", (long)value->maximum); assert(value->length <= value->maximum); assert(!value->list == !value->maximum); for (size_t j = 0; j < value->length; ++j) { string_ty * mp = value->list[j]; trace_string_real("", mp); } trace_printf("]"); } trace_printf((name && *name) ? ";\n" : ",\n"); } #endif // DEBUG meta_type fstate_src_test_list_type = { "fstate_src_test_list", fstate_src_test_list_alloc, fstate_src_test_list_free, 0, // enum_parse fstate_src_test_list_parse, 0, // struct_parse 0, // fuzzy fstate_src_test_list_convert, generic_struct_is_set, }; void fstate_src_write(const output::pointer &fp, const char *name, fstate_src_ty *this_thing) { if (!this_thing) return; trace(("fstate_src_write(name = \"%s\", this_thing = %08lX)\n{\n", name, (long)this_thing)); assert(((fstate_src_ty *)this_thing)->reference_count > 0); trace(("rc = %ld;\n", ((fstate_src_ty *)this_thing)->reference_count)); if (name) { fp->fputs(name); fp->fputs(" =\n"); } fp->fputs("{\n"); string_write(fp, "file_name", this_thing->file_name); string_write(fp, "uuid", this_thing->uuid); file_action_write(fp, "action", this_thing->action, 1); history_version_write(fp, "edit", this_thing->edit); string_write(fp, "edit_number", this_thing->edit_number); history_version_write(fp, "edit_origin", this_thing->edit_origin); string_write(fp, "edit_number_origin", this_thing->edit_number_origin); history_version_write(fp, "edit_origin_new", this_thing->edit_origin_new); string_write(fp, "edit_number_origin_new", this_thing->edit_number_origin_new); file_usage_write(fp, "usage", this_thing->usage, 1); fingerprint_write(fp, "file_fp", this_thing->file_fp); fingerprint_write(fp, "diff_file_fp", this_thing->diff_file_fp); fingerprint_write(fp, "idiff_file_fp", this_thing->idiff_file_fp); fstate_src_architecture_times_list_write(fp, "architecture_times", this_thing->architecture_times); string_write(fp, "move", this_thing->move); integer_write(fp, "locked_by", this_thing->locked_by, 0); integer_write(fp, "about_to_be_created_by", this_thing->about_to_be_created_by, 0); integer_write(fp, "about_to_be_copied_by", this_thing->about_to_be_copied_by, 0); integer_write(fp, "deleted_by", this_thing->deleted_by, 0); fstate_src_test_list_write(fp, "test", this_thing->test); metric_list_write(fp, "metrics", this_thing->metrics); boolean_write(fp, "executable", this_thing->executable, 0); attributes_list_write(fp, "attribute", this_thing->attribute); fp->fputs("}"); if (name) fp->fputs(";\n"); trace(("}\n")); } void fstate_src_write_xml(const output::pointer &fp, const char *name, fstate_src_ty *this_thing) { if (!this_thing) return; trace(("fstate_src_write_xml(name = \"%s\", this_thing = %08lX)\n{\n", name, (long)this_thing)); assert(name); assert(((fstate_src_ty *)this_thing)->reference_count > 0); trace(("rc = %ld;\n", ((fstate_src_ty *)this_thing)->reference_count)); assert(name); fp->fputc('<'); fp->fputs(name); fp->fputs(">\n"); string_write_xml(fp, "file_name", this_thing->file_name); string_write_xml(fp, "uuid", this_thing->uuid); file_action_write_xml(fp, "action", this_thing->action, 0); history_version_write_xml(fp, "edit", this_thing->edit); string_write_xml(fp, "edit_number", this_thing->edit_number); history_version_write_xml(fp, "edit_origin", this_thing->edit_origin); string_write_xml(fp, "edit_number_origin", this_thing->edit_number_origin); history_version_write_xml(fp, "edit_origin_new", this_thing->edit_origin_new); string_write_xml(fp, "edit_number_origin_new", this_thing->edit_number_origin_new); file_usage_write_xml(fp, "usage", this_thing->usage, 0); fingerprint_write_xml(fp, "file_fp", this_thing->file_fp); fingerprint_write_xml(fp, "diff_file_fp", this_thing->diff_file_fp); fingerprint_write_xml(fp, "idiff_file_fp", this_thing->idiff_file_fp); fstate_src_architecture_times_list_write_xml(fp, "architecture_times", this_thing->architecture_times); string_write_xml(fp, "move", this_thing->move); integer_write_xml(fp, "locked_by", this_thing->locked_by, 0); integer_write_xml(fp, "about_to_be_created_by", this_thing->about_to_be_created_by, 0); integer_write_xml(fp, "about_to_be_copied_by", this_thing->about_to_be_copied_by, 0); integer_write_xml(fp, "deleted_by", this_thing->deleted_by, 0); fstate_src_test_list_write_xml(fp, "test", this_thing->test); metric_list_write_xml(fp, "metrics", this_thing->metrics); boolean_write_xml(fp, "executable", this_thing->executable, 0); attributes_list_write_xml(fp, "attribute", this_thing->attribute); fp->fputs("fputs(name); fp->fputs(">\n"); } static void * fstate_src_alloc(void) { fstate_src_ty *this_thing; trace(("fstate_src_alloc()\n{\n")); this_thing = (fstate_src_ty *)mem_alloc(sizeof(fstate_src_ty)); this_thing->reference_count = 1; this_thing->mask = 0; this_thing->errpos = str_copy(lex_position()); this_thing->file_name = (string_ty *)0; this_thing->uuid = (string_ty *)0; this_thing->action = (file_action_ty)0; this_thing->edit = (history_version_ty *)0; this_thing->edit_number = (string_ty *)0; this_thing->edit_origin = (history_version_ty *)0; this_thing->edit_number_origin = (string_ty *)0; this_thing->edit_origin_new = (history_version_ty *)0; this_thing->edit_number_origin_new = (string_ty *)0; this_thing->usage = (file_usage_ty)0; this_thing->file_fp = (fingerprint_ty *)0; this_thing->diff_file_fp = (fingerprint_ty *)0; this_thing->idiff_file_fp = (fingerprint_ty *)0; this_thing->architecture_times = (fstate_src_architecture_times_list_ty *)0; this_thing->move = (string_ty *)0; this_thing->locked_by = (long)0; this_thing->about_to_be_created_by = (long)0; this_thing->about_to_be_copied_by = (long)0; this_thing->deleted_by = (long)0; this_thing->test = (fstate_src_test_list_ty *)0; this_thing->metrics = (metric_list_ty *)0; this_thing->executable = (bool)0; this_thing->attribute = (attributes_list_ty *)0; trace(("return %08lX;\n", (long)this_thing)); trace(("}\n")); return this_thing; } fstate_src_ty * fstate_src_copy(fstate_src_ty *this_thing) { trace(("fstate_src_copy()\n{\n")); this_thing->reference_count++; trace(("return %08lX;\n", (long)this_thing)); trace(("}\n")); return this_thing; } fstate_src_ty * fstate_src_clone(fstate_src_ty *this_thing) { if (!this_thing) return 0; trace(("fstate_src_clone()\n{\n")); fstate_src_ty *result = (fstate_src_ty *)fstate_src_alloc(); result->file_name = str_copy(this_thing->file_name); result->uuid = str_copy(this_thing->uuid); result->action = this_thing->action; result->edit = history_version_clone(this_thing->edit); result->edit_number = str_copy(this_thing->edit_number); result->edit_origin = history_version_clone(this_thing->edit_origin); result->edit_number_origin = str_copy(this_thing->edit_number_origin); result->edit_origin_new = history_version_clone(this_thing->edit_origin_new); result->edit_number_origin_new = str_copy(this_thing->edit_number_origin_new); result->usage = this_thing->usage; result->file_fp = fingerprint_clone(this_thing->file_fp); result->diff_file_fp = fingerprint_clone(this_thing->diff_file_fp); result->idiff_file_fp = fingerprint_clone(this_thing->idiff_file_fp); result->architecture_times = fstate_src_architecture_times_list_clone(this_thing->architecture_times); result->move = str_copy(this_thing->move); result->locked_by = this_thing->locked_by; result->about_to_be_created_by = this_thing->about_to_be_created_by; result->about_to_be_copied_by = this_thing->about_to_be_copied_by; result->deleted_by = this_thing->deleted_by; result->test = fstate_src_test_list_clone(this_thing->test); result->metrics = metric_list_clone(this_thing->metrics); result->executable = this_thing->executable; result->attribute = attributes_list_clone(this_thing->attribute); trace(("return %08lX;\n", (long)result)); trace(("}\n")); return result; } #ifdef DEBUG void fstate_src_trace_real(const char *name, const fstate_src_ty *value) { if (name && *name) { trace_printf("%s = ", name); } if (!value) { trace_printf("NULL"); } else { trace_printf("{\n"); trace_string_real("file_name", value->file_name); trace_string_real("uuid", value->uuid); trace_printf("action = %s;\n", file_action_ename(value->action)); history_version_trace_real("edit", value->edit); trace_string_real("edit_number", value->edit_number); history_version_trace_real("edit_origin", value->edit_origin); trace_string_real("edit_number_origin", value->edit_number_origin); history_version_trace_real("edit_origin_new", value->edit_origin_new); trace_string_real("edit_number_origin_new", value->edit_number_origin_new); trace_printf("usage = %s;\n", file_usage_ename(value->usage)); fingerprint_trace_real("file_fp", value->file_fp); fingerprint_trace_real("diff_file_fp", value->diff_file_fp); fingerprint_trace_real("idiff_file_fp", value->idiff_file_fp); fstate_src_architecture_times_list_trace_real("architecture_times", value->architecture_times); trace_string_real("move", value->move); trace_long_real("locked_by", &value->locked_by); trace_long_real("about_to_be_created_by", &value->about_to_be_created_by); trace_long_real("about_to_be_copied_by", &value->about_to_be_copied_by); trace_long_real("deleted_by", &value->deleted_by); fstate_src_test_list_trace_real("test", value->test); metric_list_trace_real("metrics", value->metrics); trace_bool_real("executable", value->executable); attributes_list_trace_real("attribute", value->attribute); trace_printf("}"); } trace_printf((name && *name) ? ";\n" : ",\n"); } #endif // DEBUG static void fstate_src_free(void *that) { fstate_src_ty *this_thing; this_thing = (fstate_src_ty *)that; if (!this_thing) return; this_thing->reference_count--; assert(this_thing->reference_count >= 0); if (this_thing->reference_count > 0) return; trace(("fstate_src_free(this_thing = %08lX)\n{\n", (long)this_thing)); if (this_thing->errpos) { str_free(this_thing->errpos); this_thing->errpos = 0; } str_free(this_thing->file_name); str_free(this_thing->uuid); history_version_type.free(this_thing->edit); str_free(this_thing->edit_number); history_version_type.free(this_thing->edit_origin); str_free(this_thing->edit_number_origin); history_version_type.free(this_thing->edit_origin_new); str_free(this_thing->edit_number_origin_new); fingerprint_free(this_thing->file_fp); fingerprint_free(this_thing->diff_file_fp); fingerprint_free(this_thing->idiff_file_fp); fstate_src_architecture_times_list_free(this_thing->architecture_times); str_free(this_thing->move); fstate_src_test_list_free(this_thing->test); metric_list_type.free(this_thing->metrics); attributes_list_type.free(this_thing->attribute); mem_free(this_thing); trace(("}\n")); } static type_table_ty fstate_src_table[] = { { "file_name", offsetof(fstate_src_ty, file_name), &string_type, fstate_src_file_name_mask, 0, // redefinition not ok 0, // fast_name }, { "uuid", offsetof(fstate_src_ty, uuid), &string_type, fstate_src_uuid_mask, 0, // redefinition not ok 0, // fast_name }, { "action", offsetof(fstate_src_ty, action), &file_action_type, fstate_src_action_mask, 0, // redefinition not ok 0, // fast_name }, { "edit", offsetof(fstate_src_ty, edit), &history_version_type, fstate_src_edit_mask, 0, // redefinition not ok 0, // fast_name }, { "edit_number", offsetof(fstate_src_ty, edit_number), &string_type, fstate_src_edit_number_mask, 0, // redefinition not ok 0, // fast_name }, { "edit_origin", offsetof(fstate_src_ty, edit_origin), &history_version_type, fstate_src_edit_origin_mask, 0, // redefinition not ok 0, // fast_name }, { "edit_number_origin", offsetof(fstate_src_ty, edit_number_origin), &string_type, fstate_src_edit_number_origin_mask, 0, // redefinition not ok 0, // fast_name }, { "edit_origin_new", offsetof(fstate_src_ty, edit_origin_new), &history_version_type, fstate_src_edit_origin_new_mask, 0, // redefinition not ok 0, // fast_name }, { "edit_number_origin_new", offsetof(fstate_src_ty, edit_number_origin_new), &string_type, fstate_src_edit_number_origin_new_mask, 0, // redefinition not ok 0, // fast_name }, { "usage", offsetof(fstate_src_ty, usage), &file_usage_type, fstate_src_usage_mask, 0, // redefinition not ok 0, // fast_name }, { "file_fp", offsetof(fstate_src_ty, file_fp), &fingerprint_type, fstate_src_file_fp_mask, 0, // redefinition not ok 0, // fast_name }, { "diff_file_fp", offsetof(fstate_src_ty, diff_file_fp), &fingerprint_type, fstate_src_diff_file_fp_mask, 0, // redefinition not ok 0, // fast_name }, { "idiff_file_fp", offsetof(fstate_src_ty, idiff_file_fp), &fingerprint_type, fstate_src_idiff_file_fp_mask, 0, // redefinition not ok 0, // fast_name }, { "architecture_times", offsetof(fstate_src_ty, architecture_times), &fstate_src_architecture_times_list_type, fstate_src_architecture_times_mask, 0, // redefinition not ok 0, // fast_name }, { "move", offsetof(fstate_src_ty, move), &string_type, fstate_src_move_mask, 0, // redefinition not ok 0, // fast_name }, { "locked_by", offsetof(fstate_src_ty, locked_by), &integer_type, fstate_src_locked_by_mask, 0, // redefinition not ok 0, // fast_name }, { "about_to_be_created_by", offsetof(fstate_src_ty, about_to_be_created_by), &integer_type, fstate_src_about_to_be_created_by_mask, 0, // redefinition not ok 0, // fast_name }, { "about_to_be_copied_by", offsetof(fstate_src_ty, about_to_be_copied_by), &integer_type, fstate_src_about_to_be_copied_by_mask, 0, // redefinition not ok 0, // fast_name }, { "deleted_by", offsetof(fstate_src_ty, deleted_by), &integer_type, fstate_src_deleted_by_mask, 0, // redefinition not ok 0, // fast_name }, { "test", offsetof(fstate_src_ty, test), &fstate_src_test_list_type, fstate_src_test_mask, 0, // redefinition not ok 0, // fast_name }, { "metrics", offsetof(fstate_src_ty, metrics), &metric_list_type, fstate_src_metrics_mask, 0, // redefinition not ok 0, // fast_name }, { "executable", offsetof(fstate_src_ty, executable), &boolean_type, fstate_src_executable_mask, 0, // redefinition not ok 0, // fast_name }, { "attribute", offsetof(fstate_src_ty, attribute), &attributes_list_type, fstate_src_attribute_mask, 0, // redefinition not ok 0, // fast_name }, }; static void * fstate_src_parse(void *this_thing, string_ty *name, meta_type **type_pp, unsigned long *mask_p, int *redef_p) { void *addr; trace(("fstate_src_parse(this_thing = %08lX, name = %08lX, type_pp = %08lX)\n{\n", (long)this_thing, (long)name, (long)type_pp)); assert(((fstate_src_ty *)this_thing)->reference_count > 0); addr = generic_struct_parse ( this_thing, name, type_pp, mask_p, redef_p, fstate_src_table, SIZEOF(fstate_src_table) ); trace(("return %08lX;\n}\n", (long)addr)); return addr; } static string_ty * fstate_src_fuzzy(string_ty *name) { string_ty *result; trace(("fstate_src_fuzzy(name = %08lX)\n{\n", (long)name)); result = generic_struct_fuzzy ( name, fstate_src_table, SIZEOF(fstate_src_table) ); trace(("return %08lX;\n", (long)result)); trace(("}\n")); return result; } static rpt_value::pointer fstate_src_convert(void *this_thing) { trace(("fstate_src_convert(name = %08lX)\n{\n", (long)this_thing)); assert(((fstate_src_ty *)this_thing)->reference_count > 0); rpt_value::pointer result = generic_struct_convert ( this_thing, fstate_src_table, SIZEOF(fstate_src_table) ); trace(("return %08lX;\n", (long)result.get())); trace(("}\n")); return result; } meta_type fstate_src_type = { "fstate_src", fstate_src_alloc, fstate_src_free, 0, // enum_parse 0, // list_parse fstate_src_parse, fstate_src_fuzzy, fstate_src_convert, generic_struct_is_set, }; void fstate_src_list_write(const output::pointer &fp, const char *name, fstate_src_list_ty *this_thing) { size_t j; if (!this_thing) return; trace(("fstate_src_list_write(name = \"%s\", this_thing = %08lX)\n{\n", name, (long)this_thing)); if (name) { fp->fputs(name); fp->fputs(" =\n"); } assert(this_thing->length <= this_thing->maximum); assert(!this_thing->list == !this_thing->maximum); fp->fputs("[\n"); for (j = 0; j < this_thing->length; ++j) { fstate_src_write(fp, (const char *)0, this_thing->list[j]); fp->fputs(",\n"); } fp->fputs("]"); if (name) fp->fputs(";\n"); trace(("}\n")); } void fstate_src_list_write_xml(const output::pointer &fp, const char *name, fstate_src_list_ty *this_thing) { size_t j; if (!this_thing) return; trace(("fstate_src_list_write_xml(name = \"%s\", this_thing = %08lX)\n{\n", name, (long)this_thing)); assert(name); fp->fputc('<'); fp->fputs(name); fp->fputs(">\n"); assert(this_thing->length <= this_thing->maximum); assert(!this_thing->list == !this_thing->maximum); for (j = 0; j < this_thing->length; ++j) { fstate_src_write_xml(fp, "fstate_src", this_thing->list[j]); } fp->fputs("fputs(name); fp->fputs(">\n"); trace(("}\n")); } static void * fstate_src_list_alloc(void) { fstate_src_list_ty *result; trace(("fstate_src_list_alloc()\n{\n")); result = (fstate_src_list_ty *)mem_alloc(sizeof(fstate_src_list_ty)); result->list = 0; result->length = 0; result->maximum = 0; trace(("return %08lX;\n", (long)result)); trace(("}\n")); return result; } static void fstate_src_list_free(void *that) { fstate_src_list_ty *this_thing; size_t j; this_thing = (fstate_src_list_ty *)that; if (!this_thing) return; trace(("fstate_src_list_free(this_thing = %08lX)\n{\n", (long)this_thing)); assert(this_thing->length <= this_thing->maximum); assert(!this_thing->list == !this_thing->maximum); for (j = 0; j < this_thing->length; ++j) fstate_src_free(this_thing->list[j]); delete [] this_thing->list; mem_free(this_thing); trace(("}\n")); } static void * fstate_src_list_parse(void *that, meta_type **type_pp) { fstate_src_list_ty *this_thing; void *addr; this_thing = (fstate_src_list_ty *)that; trace(("fstate_src_list_parse(this_thing = %08lX, type_pp = %08lX)\n{\n", (long)this_thing, (long)type_pp)); assert(this_thing->length <= this_thing->maximum); assert(!this_thing->list == !this_thing->maximum); *type_pp = &fstate_src_type; trace_pointer(*type_pp); if (this_thing->length >= this_thing->maximum) { this_thing->maximum = this_thing->maximum * 2 + 16; fstate_src_ty * *new_list = new fstate_src_ty * [this_thing->maximum]; for (size_t j = 0; j < this_thing->length; ++j) new_list[j] = this_thing->list[j]; delete [] this_thing->list; this_thing->list = new_list; } addr = &this_thing->list[this_thing->length++]; trace(("return %08lX;\n", (long)addr)); trace(("}\n")); return addr; } static rpt_value::pointer fstate_src_list_convert(void *that) { fstate_src_list_ty *this_thing; size_t j; rpt_value::pointer vp; this_thing = *(fstate_src_list_ty **)that; if (!this_thing) return rpt_value::pointer(); trace(("fstate_src_list_convert(this_thing = %08lX)\n{\n", (long)this_thing)); assert(this_thing->length <= this_thing->maximum); assert(!this_thing->list == !this_thing->maximum); rpt_value_list *p = new rpt_value_list(); rpt_value::pointer result(p); for (j = 0; j < this_thing->length; ++j) { vp = fstate_src_type.convert(&this_thing->list[j]); assert(vp); p->append(vp); } trace(("}\n")); trace(("return %08lX;\n", (long)result.get())); return result; } fstate_src_list_ty * fstate_src_list_copy(fstate_src_list_ty *from) { size_t j; fstate_src_list_ty *result; if (!from) return 0; trace(("fstate_src_list_copy(from = %08lX)\n{\n", (long)from)); result = (fstate_src_list_ty *)fstate_src_list_alloc(); assert(from->length <= from->maximum); assert(!from->list == !from->maximum); for (j = 0; j < from->length; ++j) { fstate_src_ty * mp; fstate_src_ty * *mpp; meta_type *bogus; mp = from->list[j]; mpp = (fstate_src_ty **)fstate_src_list_parse(result, &bogus); *mpp = fstate_src_copy(mp); } trace(("return %8.8lX\n", (long)result)); trace(("}\n")); return result; } fstate_src_list_ty * fstate_src_list_clone(fstate_src_list_ty *from) { return fstate_src_list_copy(from); } #ifdef DEBUG void fstate_src_list_trace_real(const char *name, const fstate_src_list_ty *value) { if (name && *name) { trace_printf("%s = ", name); } if (!value) { trace_printf("NULL"); } else { trace_printf("[\n"); trace_printf("// length = %ld\n", (long)value->length); trace_printf("// maximum = %ld\n", (long)value->maximum); assert(value->length <= value->maximum); assert(!value->list == !value->maximum); for (size_t j = 0; j < value->length; ++j) { fstate_src_ty * mp = value->list[j]; fstate_src_trace_real("", mp); } trace_printf("]"); } trace_printf((name && *name) ? ";\n" : ",\n"); } #endif // DEBUG meta_type fstate_src_list_type = { "fstate_src_list", fstate_src_list_alloc, fstate_src_list_free, 0, // enum_parse fstate_src_list_parse, 0, // struct_parse 0, // fuzzy fstate_src_list_convert, generic_struct_is_set, }; void fstate_write(const output::pointer &fp, fstate_ty *this_thing) { if (!this_thing) return; trace(("fstate_write(this_thing = %08lX)\n{\n", (long)this_thing)); assert(((fstate_ty *)this_thing)->reference_count > 0); trace(("rc = %ld;\n", ((fstate_ty *)this_thing)->reference_count)); fstate_src_list_write(fp, "src", this_thing->src); trace(("}\n")); } void fstate_write_xml(const output::pointer &fp, fstate_ty *this_thing) { if (!this_thing) return; trace(("fstate_write_xml(this_thing = %08lX)\n{\n", (long)this_thing)); assert(((fstate_ty *)this_thing)->reference_count > 0); trace(("rc = %ld;\n", ((fstate_ty *)this_thing)->reference_count)); fp->fputs("\n"); fstate_src_list_write_xml(fp, "src", this_thing->src); fp->fputs("\n"); } static void * fstate_alloc(void) { fstate_ty *this_thing; trace(("fstate_alloc()\n{\n")); this_thing = (fstate_ty *)mem_alloc(sizeof(fstate_ty)); this_thing->reference_count = 1; this_thing->mask = 0; this_thing->errpos = str_copy(lex_position()); this_thing->src = (fstate_src_list_ty *)0; trace(("return %08lX;\n", (long)this_thing)); trace(("}\n")); return this_thing; } fstate_ty * fstate_copy(fstate_ty *this_thing) { trace(("fstate_copy()\n{\n")); this_thing->reference_count++; trace(("return %08lX;\n", (long)this_thing)); trace(("}\n")); return this_thing; } fstate_ty * fstate_clone(fstate_ty *this_thing) { if (!this_thing) return 0; trace(("fstate_clone()\n{\n")); fstate_ty *result = (fstate_ty *)fstate_alloc(); result->src = fstate_src_list_clone(this_thing->src); trace(("return %08lX;\n", (long)result)); trace(("}\n")); return result; } #ifdef DEBUG void fstate_trace_real(const char *name, const fstate_ty *value) { if (name && *name) { trace_printf("%s = ", name); } if (!value) { trace_printf("NULL"); } else { trace_printf("{\n"); fstate_src_list_trace_real("src", value->src); trace_printf("}"); } trace_printf((name && *name) ? ";\n" : ",\n"); } #endif // DEBUG static void fstate_free(void *that) { fstate_ty *this_thing; this_thing = (fstate_ty *)that; if (!this_thing) return; this_thing->reference_count--; assert(this_thing->reference_count >= 0); if (this_thing->reference_count > 0) return; trace(("fstate_free(this_thing = %08lX)\n{\n", (long)this_thing)); if (this_thing->errpos) { str_free(this_thing->errpos); this_thing->errpos = 0; } fstate_src_list_free(this_thing->src); mem_free(this_thing); trace(("}\n")); } static type_table_ty fstate_table[] = { { "src", offsetof(fstate_ty, src), &fstate_src_list_type, fstate_src_mask, 0, // redefinition not ok 0, // fast_name }, }; static void * fstate_parse(void *this_thing, string_ty *name, meta_type **type_pp, unsigned long *mask_p, int *redef_p) { void *addr; trace(("fstate_parse(this_thing = %08lX, name = %08lX, type_pp = %08lX)\n{\n", (long)this_thing, (long)name, (long)type_pp)); assert(((fstate_ty *)this_thing)->reference_count > 0); addr = generic_struct_parse ( this_thing, name, type_pp, mask_p, redef_p, fstate_table, SIZEOF(fstate_table) ); trace(("return %08lX;\n}\n", (long)addr)); return addr; } static string_ty * fstate_fuzzy(string_ty *name) { string_ty *result; trace(("fstate_fuzzy(name = %08lX)\n{\n", (long)name)); result = generic_struct_fuzzy ( name, fstate_table, SIZEOF(fstate_table) ); trace(("return %08lX;\n", (long)result)); trace(("}\n")); return result; } static rpt_value::pointer fstate_convert(void *this_thing) { trace(("fstate_convert(name = %08lX)\n{\n", (long)this_thing)); assert(((fstate_ty *)this_thing)->reference_count > 0); rpt_value::pointer result = generic_struct_convert ( this_thing, fstate_table, SIZEOF(fstate_table) ); trace(("return %08lX;\n", (long)result.get())); trace(("}\n")); return result; } meta_type fstate_type = { "fstate", fstate_alloc, fstate_free, 0, // enum_parse 0, // list_parse fstate_parse, fstate_fuzzy, fstate_convert, generic_struct_is_set, }; fstate_ty * fstate_read_file(const nstring &filename) { return fstate_read_file(filename.get_ref()); } fstate_ty * fstate_read_file(string_ty *filename) { fstate_ty *result; trace(("fstate_read_file(filename = \"%s\")\n{\n", (filename ? filename->str_text : ""))); os_become_must_be_active(); result = (fstate_ty *)parse(filename, &fstate_type); trace(("return %08lX;\n", (long)result)); trace(("}\n")); return result; } void fstate_write_file(const nstring &filename, fstate_ty *value, bool comp) { fstate_write_file(filename.get_ref(), value, comp); } void fstate_write_file(string_ty *filename, fstate_ty *value, int needs_compression) { trace(("fstate_write_file(filename = \"%s\", value = %08lX)\n{\n", (filename ? filename->str_text : ""), (long)value)); if (filename) os_become_must_be_active(); output::pointer fp; if (needs_compression) { fp = output_file::binary_open(filename); fp = output_gzip::create(fp); } else { fp = output_file::text_open(filename); } fp = output_indent::create(fp); io_comment_emit(fp); fstate_write(fp, value); type_enum_option_clear(); trace(("}\n")); } void fstate__rpt_init(void) { trace(("fstate__rpt_init()\n{\n")); trace(("}\n")); }