// // This file is generated by fmtgen from "libaegis/tstrslt.def". // If you want to change the contents of this file // you need to edit libaegis/tstrslt.def // or you need to enhance fmtgen. // #include #include #include #include #include #include #include #include #include #include #include #include void tstrslt_test_result_write(const output::pointer &fp, const char *name, tstrslt_test_result_ty *this_thing) { if (!this_thing) return; trace(("tstrslt_test_result_write(name = \"%s\", this_thing = %08lX)\n{\n", name, (long)this_thing)); assert(((tstrslt_test_result_ty *)this_thing)->reference_count > 0); trace(("rc = %ld;\n", ((tstrslt_test_result_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); integer_write(fp, "exit_status", this_thing->exit_status, 0); string_write(fp, "architecture", this_thing->architecture); fp->fputs("}"); if (name) fp->fputs(";\n"); trace(("}\n")); } void tstrslt_test_result_write_xml(const output::pointer &fp, const char *name, tstrslt_test_result_ty *this_thing) { if (!this_thing) return; trace(("tstrslt_test_result_write_xml(name = \"%s\", this_thing = %08lX)\n{\n", name, (long)this_thing)); assert(name); assert(((tstrslt_test_result_ty *)this_thing)->reference_count > 0); trace(("rc = %ld;\n", ((tstrslt_test_result_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); integer_write_xml(fp, "exit_status", this_thing->exit_status, 0); string_write_xml(fp, "architecture", this_thing->architecture); fp->fputs("fputs(name); fp->fputs(">\n"); } static void * tstrslt_test_result_alloc(void) { tstrslt_test_result_ty *this_thing; trace(("tstrslt_test_result_alloc()\n{\n")); this_thing = (tstrslt_test_result_ty *)mem_alloc(sizeof(tstrslt_test_result_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->exit_status = (long)0; this_thing->architecture = (string_ty *)0; trace(("return %08lX;\n", (long)this_thing)); trace(("}\n")); return this_thing; } tstrslt_test_result_ty * tstrslt_test_result_copy(tstrslt_test_result_ty *this_thing) { trace(("tstrslt_test_result_copy()\n{\n")); this_thing->reference_count++; trace(("return %08lX;\n", (long)this_thing)); trace(("}\n")); return this_thing; } tstrslt_test_result_ty * tstrslt_test_result_clone(tstrslt_test_result_ty *this_thing) { if (!this_thing) return 0; trace(("tstrslt_test_result_clone()\n{\n")); tstrslt_test_result_ty *result = (tstrslt_test_result_ty *)tstrslt_test_result_alloc(); result->file_name = str_copy(this_thing->file_name); result->exit_status = this_thing->exit_status; result->architecture = str_copy(this_thing->architecture); trace(("return %08lX;\n", (long)result)); trace(("}\n")); return result; } #ifdef DEBUG void tstrslt_test_result_trace_real(const char *name, const tstrslt_test_result_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_long_real("exit_status", &value->exit_status); trace_string_real("architecture", value->architecture); trace_printf("}"); } trace_printf((name && *name) ? ";\n" : ",\n"); } #endif // DEBUG static void tstrslt_test_result_free(void *that) { tstrslt_test_result_ty *this_thing; this_thing = (tstrslt_test_result_ty *)that; if (!this_thing) return; this_thing->reference_count--; assert(this_thing->reference_count >= 0); if (this_thing->reference_count > 0) return; trace(("tstrslt_test_result_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->architecture); mem_free(this_thing); trace(("}\n")); } static type_table_ty tstrslt_test_result_table[] = { { "file_name", offsetof(tstrslt_test_result_ty, file_name), &string_type, tstrslt_test_result_file_name_mask, 0, // redefinition not ok 0, // fast_name }, { "exit_status", offsetof(tstrslt_test_result_ty, exit_status), &integer_type, tstrslt_test_result_exit_status_mask, 0, // redefinition not ok 0, // fast_name }, { "architecture", offsetof(tstrslt_test_result_ty, architecture), &string_type, tstrslt_test_result_architecture_mask, 0, // redefinition not ok 0, // fast_name }, }; static void * tstrslt_test_result_parse(void *this_thing, string_ty *name, meta_type **type_pp, unsigned long *mask_p, int *redef_p) { void *addr; trace(("tstrslt_test_result_parse(this_thing = %08lX, name = %08lX, type_pp = %08lX)\n{\n", (long)this_thing, (long)name, (long)type_pp)); assert(((tstrslt_test_result_ty *)this_thing)->reference_count > 0); addr = generic_struct_parse ( this_thing, name, type_pp, mask_p, redef_p, tstrslt_test_result_table, SIZEOF(tstrslt_test_result_table) ); trace(("return %08lX;\n}\n", (long)addr)); return addr; } static string_ty * tstrslt_test_result_fuzzy(string_ty *name) { string_ty *result; trace(("tstrslt_test_result_fuzzy(name = %08lX)\n{\n", (long)name)); result = generic_struct_fuzzy ( name, tstrslt_test_result_table, SIZEOF(tstrslt_test_result_table) ); trace(("return %08lX;\n", (long)result)); trace(("}\n")); return result; } static rpt_value::pointer tstrslt_test_result_convert(void *this_thing) { trace(("tstrslt_test_result_convert(name = %08lX)\n{\n", (long)this_thing)); assert(((tstrslt_test_result_ty *)this_thing)->reference_count > 0); rpt_value::pointer result = generic_struct_convert ( this_thing, tstrslt_test_result_table, SIZEOF(tstrslt_test_result_table) ); trace(("return %08lX;\n", (long)result.get())); trace(("}\n")); return result; } meta_type tstrslt_test_result_type = { "tstrslt_test_result", tstrslt_test_result_alloc, tstrslt_test_result_free, 0, // enum_parse 0, // list_parse tstrslt_test_result_parse, tstrslt_test_result_fuzzy, tstrslt_test_result_convert, generic_struct_is_set, }; #include void tstrslt_test_result_list_write(const output::pointer &fp, const char *name, tstrslt_test_result_list_ty *this_thing) { size_t j; if (!this_thing) return; trace(("tstrslt_test_result_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) { tstrslt_test_result_write(fp, (const char *)0, this_thing->list[j]); fp->fputs(",\n"); } fp->fputs("]"); if (name) fp->fputs(";\n"); trace(("}\n")); } void tstrslt_test_result_list_write_xml(const output::pointer &fp, const char *name, tstrslt_test_result_list_ty *this_thing) { size_t j; if (!this_thing) return; trace(("tstrslt_test_result_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) { tstrslt_test_result_write_xml(fp, "tstrslt_test_result", this_thing->list[j]); } fp->fputs("fputs(name); fp->fputs(">\n"); trace(("}\n")); } static void * tstrslt_test_result_list_alloc(void) { tstrslt_test_result_list_ty *result; trace(("tstrslt_test_result_list_alloc()\n{\n")); result = (tstrslt_test_result_list_ty *)mem_alloc(sizeof(tstrslt_test_result_list_ty)); result->list = 0; result->length = 0; result->maximum = 0; trace(("return %08lX;\n", (long)result)); trace(("}\n")); return result; } static void tstrslt_test_result_list_free(void *that) { tstrslt_test_result_list_ty *this_thing; size_t j; this_thing = (tstrslt_test_result_list_ty *)that; if (!this_thing) return; trace(("tstrslt_test_result_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) tstrslt_test_result_free(this_thing->list[j]); delete [] this_thing->list; mem_free(this_thing); trace(("}\n")); } static void * tstrslt_test_result_list_parse(void *that, meta_type **type_pp) { tstrslt_test_result_list_ty *this_thing; void *addr; this_thing = (tstrslt_test_result_list_ty *)that; trace(("tstrslt_test_result_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 = &tstrslt_test_result_type; trace_pointer(*type_pp); if (this_thing->length >= this_thing->maximum) { this_thing->maximum = this_thing->maximum * 2 + 16; tstrslt_test_result_ty * *new_list = new tstrslt_test_result_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 tstrslt_test_result_list_convert(void *that) { tstrslt_test_result_list_ty *this_thing; size_t j; rpt_value::pointer vp; this_thing = *(tstrslt_test_result_list_ty **)that; if (!this_thing) return rpt_value::pointer(); trace(("tstrslt_test_result_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 = tstrslt_test_result_type.convert(&this_thing->list[j]); assert(vp); p->append(vp); } trace(("}\n")); trace(("return %08lX;\n", (long)result.get())); return result; } tstrslt_test_result_list_ty * tstrslt_test_result_list_copy(tstrslt_test_result_list_ty *from) { size_t j; tstrslt_test_result_list_ty *result; if (!from) return 0; trace(("tstrslt_test_result_list_copy(from = %08lX)\n{\n", (long)from)); result = (tstrslt_test_result_list_ty *)tstrslt_test_result_list_alloc(); assert(from->length <= from->maximum); assert(!from->list == !from->maximum); for (j = 0; j < from->length; ++j) { tstrslt_test_result_ty * mp; tstrslt_test_result_ty * *mpp; meta_type *bogus; mp = from->list[j]; mpp = (tstrslt_test_result_ty **)tstrslt_test_result_list_parse(result, &bogus); *mpp = tstrslt_test_result_copy(mp); } trace(("return %8.8lX\n", (long)result)); trace(("}\n")); return result; } tstrslt_test_result_list_ty * tstrslt_test_result_list_clone(tstrslt_test_result_list_ty *from) { return tstrslt_test_result_list_copy(from); } #ifdef DEBUG void tstrslt_test_result_list_trace_real(const char *name, const tstrslt_test_result_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) { tstrslt_test_result_ty * mp = value->list[j]; tstrslt_test_result_trace_real("", mp); } trace_printf("]"); } trace_printf((name && *name) ? ";\n" : ",\n"); } #endif // DEBUG meta_type tstrslt_test_result_list_type = { "tstrslt_test_result_list", tstrslt_test_result_list_alloc, tstrslt_test_result_list_free, 0, // enum_parse tstrslt_test_result_list_parse, 0, // struct_parse 0, // fuzzy tstrslt_test_result_list_convert, generic_struct_is_set, }; void tstrslt_write(const output::pointer &fp, tstrslt_ty *this_thing) { if (!this_thing) return; trace(("tstrslt_write(this_thing = %08lX)\n{\n", (long)this_thing)); assert(((tstrslt_ty *)this_thing)->reference_count > 0); trace(("rc = %ld;\n", ((tstrslt_ty *)this_thing)->reference_count)); tstrslt_test_result_list_write(fp, "test_result", this_thing->test_result); trace(("}\n")); } void tstrslt_write_xml(const output::pointer &fp, tstrslt_ty *this_thing) { if (!this_thing) return; trace(("tstrslt_write_xml(this_thing = %08lX)\n{\n", (long)this_thing)); assert(((tstrslt_ty *)this_thing)->reference_count > 0); trace(("rc = %ld;\n", ((tstrslt_ty *)this_thing)->reference_count)); fp->fputs("\n"); tstrslt_test_result_list_write_xml(fp, "test_result", this_thing->test_result); fp->fputs("\n"); } static void * tstrslt_alloc(void) { tstrslt_ty *this_thing; trace(("tstrslt_alloc()\n{\n")); this_thing = (tstrslt_ty *)mem_alloc(sizeof(tstrslt_ty)); this_thing->reference_count = 1; this_thing->mask = 0; this_thing->errpos = str_copy(lex_position()); this_thing->test_result = (tstrslt_test_result_list_ty *)0; trace(("return %08lX;\n", (long)this_thing)); trace(("}\n")); return this_thing; } tstrslt_ty * tstrslt_copy(tstrslt_ty *this_thing) { trace(("tstrslt_copy()\n{\n")); this_thing->reference_count++; trace(("return %08lX;\n", (long)this_thing)); trace(("}\n")); return this_thing; } tstrslt_ty * tstrslt_clone(tstrslt_ty *this_thing) { if (!this_thing) return 0; trace(("tstrslt_clone()\n{\n")); tstrslt_ty *result = (tstrslt_ty *)tstrslt_alloc(); result->test_result = tstrslt_test_result_list_clone(this_thing->test_result); trace(("return %08lX;\n", (long)result)); trace(("}\n")); return result; } #ifdef DEBUG void tstrslt_trace_real(const char *name, const tstrslt_ty *value) { if (name && *name) { trace_printf("%s = ", name); } if (!value) { trace_printf("NULL"); } else { trace_printf("{\n"); tstrslt_test_result_list_trace_real("test_result", value->test_result); trace_printf("}"); } trace_printf((name && *name) ? ";\n" : ",\n"); } #endif // DEBUG static void tstrslt_free(void *that) { tstrslt_ty *this_thing; this_thing = (tstrslt_ty *)that; if (!this_thing) return; this_thing->reference_count--; assert(this_thing->reference_count >= 0); if (this_thing->reference_count > 0) return; trace(("tstrslt_free(this_thing = %08lX)\n{\n", (long)this_thing)); if (this_thing->errpos) { str_free(this_thing->errpos); this_thing->errpos = 0; } tstrslt_test_result_list_free(this_thing->test_result); mem_free(this_thing); trace(("}\n")); } static type_table_ty tstrslt_table[] = { { "test_result", offsetof(tstrslt_ty, test_result), &tstrslt_test_result_list_type, tstrslt_test_result_mask, 0, // redefinition not ok 0, // fast_name }, }; static void * tstrslt_parse(void *this_thing, string_ty *name, meta_type **type_pp, unsigned long *mask_p, int *redef_p) { void *addr; trace(("tstrslt_parse(this_thing = %08lX, name = %08lX, type_pp = %08lX)\n{\n", (long)this_thing, (long)name, (long)type_pp)); assert(((tstrslt_ty *)this_thing)->reference_count > 0); addr = generic_struct_parse ( this_thing, name, type_pp, mask_p, redef_p, tstrslt_table, SIZEOF(tstrslt_table) ); trace(("return %08lX;\n}\n", (long)addr)); return addr; } static string_ty * tstrslt_fuzzy(string_ty *name) { string_ty *result; trace(("tstrslt_fuzzy(name = %08lX)\n{\n", (long)name)); result = generic_struct_fuzzy ( name, tstrslt_table, SIZEOF(tstrslt_table) ); trace(("return %08lX;\n", (long)result)); trace(("}\n")); return result; } static rpt_value::pointer tstrslt_convert(void *this_thing) { trace(("tstrslt_convert(name = %08lX)\n{\n", (long)this_thing)); assert(((tstrslt_ty *)this_thing)->reference_count > 0); rpt_value::pointer result = generic_struct_convert ( this_thing, tstrslt_table, SIZEOF(tstrslt_table) ); trace(("return %08lX;\n", (long)result.get())); trace(("}\n")); return result; } meta_type tstrslt_type = { "tstrslt", tstrslt_alloc, tstrslt_free, 0, // enum_parse 0, // list_parse tstrslt_parse, tstrslt_fuzzy, tstrslt_convert, generic_struct_is_set, }; tstrslt_ty * tstrslt_read_file(const nstring &filename) { return tstrslt_read_file(filename.get_ref()); } tstrslt_ty * tstrslt_read_file(string_ty *filename) { tstrslt_ty *result; trace(("tstrslt_read_file(filename = \"%s\")\n{\n", (filename ? filename->str_text : ""))); os_become_must_be_active(); result = (tstrslt_ty *)parse(filename, &tstrslt_type); trace(("return %08lX;\n", (long)result)); trace(("}\n")); return result; } void tstrslt_write_file(const nstring &filename, tstrslt_ty *value, bool comp) { tstrslt_write_file(filename.get_ref(), value, comp); } void tstrslt_write_file(string_ty *filename, tstrslt_ty *value, int needs_compression) { trace(("tstrslt_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); tstrslt_write(fp, value); type_enum_option_clear(); trace(("}\n")); } void tstrslt__rpt_init(void) { trace(("tstrslt__rpt_init()\n{\n")); trace(("}\n")); }