// // This file is generated by fmtgen from "libaegis/cattr.def". // If you want to change the contents of this file // you need to edit libaegis/cattr.def // or you need to enhance fmtgen. // #include #include #include #include #include #include #include #include #include #include #include #include #include void cattr_architecture_list_write(const output::pointer &fp, const char *name, cattr_architecture_list_ty *this_thing) { size_t j; if (!this_thing) return; trace(("cattr_architecture_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 cattr_architecture_list_write_xml(const output::pointer &fp, const char *name, cattr_architecture_list_ty *this_thing) { size_t j; if (!this_thing) return; trace(("cattr_architecture_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 * cattr_architecture_list_alloc(void) { cattr_architecture_list_ty *result; trace(("cattr_architecture_list_alloc()\n{\n")); result = (cattr_architecture_list_ty *)mem_alloc(sizeof(cattr_architecture_list_ty)); result->list = 0; result->length = 0; result->maximum = 0; trace(("return %08lX;\n", (long)result)); trace(("}\n")); return result; } static void cattr_architecture_list_free(void *that) { cattr_architecture_list_ty *this_thing; size_t j; this_thing = (cattr_architecture_list_ty *)that; if (!this_thing) return; trace(("cattr_architecture_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 * cattr_architecture_list_parse(void *that, meta_type **type_pp) { cattr_architecture_list_ty *this_thing; void *addr; this_thing = (cattr_architecture_list_ty *)that; trace(("cattr_architecture_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 cattr_architecture_list_convert(void *that) { cattr_architecture_list_ty *this_thing; size_t j; rpt_value::pointer vp; this_thing = *(cattr_architecture_list_ty **)that; if (!this_thing) return rpt_value::pointer(); trace(("cattr_architecture_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; } cattr_architecture_list_ty * cattr_architecture_list_copy(cattr_architecture_list_ty *from) { size_t j; cattr_architecture_list_ty *result; if (!from) return 0; trace(("cattr_architecture_list_copy(from = %08lX)\n{\n", (long)from)); result = (cattr_architecture_list_ty *)cattr_architecture_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 **)cattr_architecture_list_parse(result, &bogus); *mpp = string_copy(mp); } trace(("return %8.8lX\n", (long)result)); trace(("}\n")); return result; } cattr_architecture_list_ty * cattr_architecture_list_clone(cattr_architecture_list_ty *from) { return cattr_architecture_list_copy(from); } #ifdef DEBUG void cattr_architecture_list_trace_real(const char *name, const cattr_architecture_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 cattr_architecture_list_type = { "cattr_architecture_list", cattr_architecture_list_alloc, cattr_architecture_list_free, 0, // enum_parse cattr_architecture_list_parse, 0, // struct_parse 0, // fuzzy cattr_architecture_list_convert, generic_struct_is_set, }; void cattr_copyright_years_list_write(const output::pointer &fp, const char *name, cattr_copyright_years_list_ty *this_thing) { size_t j; if (!this_thing) return; trace(("cattr_copyright_years_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) { integer_write(fp, (const char *)0, this_thing->list[j], 1); fp->fputs(",\n"); } fp->fputs("]"); if (name) fp->fputs(";\n"); trace(("}\n")); } void cattr_copyright_years_list_write_xml(const output::pointer &fp, const char *name, cattr_copyright_years_list_ty *this_thing) { size_t j; if (!this_thing) return; trace(("cattr_copyright_years_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) { integer_write_xml(fp, "integer", this_thing->list[j], 1); } fp->fputs("fputs(name); fp->fputs(">\n"); trace(("}\n")); } static void * cattr_copyright_years_list_alloc(void) { cattr_copyright_years_list_ty *result; trace(("cattr_copyright_years_list_alloc()\n{\n")); result = (cattr_copyright_years_list_ty *)mem_alloc(sizeof(cattr_copyright_years_list_ty)); result->list = 0; result->length = 0; result->maximum = 0; trace(("return %08lX;\n", (long)result)); trace(("}\n")); return result; } static void cattr_copyright_years_list_free(void *that) { cattr_copyright_years_list_ty *this_thing; size_t j; this_thing = (cattr_copyright_years_list_ty *)that; if (!this_thing) return; trace(("cattr_copyright_years_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) ; delete [] this_thing->list; mem_free(this_thing); trace(("}\n")); } static void * cattr_copyright_years_list_parse(void *that, meta_type **type_pp) { cattr_copyright_years_list_ty *this_thing; void *addr; this_thing = (cattr_copyright_years_list_ty *)that; trace(("cattr_copyright_years_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 = &integer_type; trace_pointer(*type_pp); if (this_thing->length >= this_thing->maximum) { this_thing->maximum = this_thing->maximum * 2 + 16; long *new_list = new long [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 cattr_copyright_years_list_convert(void *that) { cattr_copyright_years_list_ty *this_thing; size_t j; rpt_value::pointer vp; this_thing = *(cattr_copyright_years_list_ty **)that; if (!this_thing) return rpt_value::pointer(); trace(("cattr_copyright_years_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 = integer_type.convert(&this_thing->list[j]); assert(vp); p->append(vp); } trace(("}\n")); trace(("return %08lX;\n", (long)result.get())); return result; } cattr_copyright_years_list_ty * cattr_copyright_years_list_copy(cattr_copyright_years_list_ty *from) { size_t j; cattr_copyright_years_list_ty *result; if (!from) return 0; trace(("cattr_copyright_years_list_copy(from = %08lX)\n{\n", (long)from)); result = (cattr_copyright_years_list_ty *)cattr_copyright_years_list_alloc(); assert(from->length <= from->maximum); assert(!from->list == !from->maximum); for (j = 0; j < from->length; ++j) { long mp; long *mpp; meta_type *bogus; mp = from->list[j]; mpp = (long*)cattr_copyright_years_list_parse(result, &bogus); *mpp = integer_copy(mp); } trace(("return %8.8lX\n", (long)result)); trace(("}\n")); return result; } cattr_copyright_years_list_ty * cattr_copyright_years_list_clone(cattr_copyright_years_list_ty *from) { return cattr_copyright_years_list_copy(from); } #ifdef DEBUG void cattr_copyright_years_list_trace_real(const char *name, const cattr_copyright_years_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) { long mp = value->list[j]; trace_long_real("", &mp); } trace_printf("]"); } trace_printf((name && *name) ? ";\n" : ",\n"); } #endif // DEBUG meta_type cattr_copyright_years_list_type = { "cattr_copyright_years_list", cattr_copyright_years_list_alloc, cattr_copyright_years_list_free, 0, // enum_parse cattr_copyright_years_list_parse, 0, // struct_parse 0, // fuzzy cattr_copyright_years_list_convert, generic_struct_is_set, }; void cattr_write(const output::pointer &fp, cattr_ty *this_thing) { if (!this_thing) return; trace(("cattr_write(this_thing = %08lX)\n{\n", (long)this_thing)); assert(((cattr_ty *)this_thing)->reference_count > 0); trace(("rc = %ld;\n", ((cattr_ty *)this_thing)->reference_count)); string_write(fp, "brief_description", this_thing->brief_description); string_write(fp, "description", this_thing->description); change_cause_write(fp, "cause", this_thing->cause, 1); boolean_write(fp, "test_exempt", this_thing->test_exempt, 1); boolean_write(fp, "test_baseline_exempt", this_thing->test_baseline_exempt, 1); boolean_write(fp, "regression_test_exempt", this_thing->regression_test_exempt, 1); cattr_architecture_list_write(fp, "architecture", this_thing->architecture); cattr_copyright_years_list_write(fp, "copyright_years", this_thing->copyright_years); string_write(fp, "version_previous", this_thing->version_previous); attributes_list_write(fp, "attribute", this_thing->attribute); trace(("}\n")); } void cattr_write_xml(const output::pointer &fp, cattr_ty *this_thing) { if (!this_thing) return; trace(("cattr_write_xml(this_thing = %08lX)\n{\n", (long)this_thing)); assert(((cattr_ty *)this_thing)->reference_count > 0); trace(("rc = %ld;\n", ((cattr_ty *)this_thing)->reference_count)); fp->fputs("\n"); string_write_xml(fp, "brief_description", this_thing->brief_description); string_write_xml(fp, "description", this_thing->description); change_cause_write_xml(fp, "cause", this_thing->cause, 0); boolean_write_xml(fp, "test_exempt", this_thing->test_exempt, 0); boolean_write_xml(fp, "test_baseline_exempt", this_thing->test_baseline_exempt, 0); boolean_write_xml(fp, "regression_test_exempt", this_thing->regression_test_exempt, 0); cattr_architecture_list_write_xml(fp, "architecture", this_thing->architecture); cattr_copyright_years_list_write_xml(fp, "copyright_years", this_thing->copyright_years); string_write_xml(fp, "version_previous", this_thing->version_previous); attributes_list_write_xml(fp, "attribute", this_thing->attribute); fp->fputs("\n"); } static void * cattr_alloc(void) { cattr_ty *this_thing; trace(("cattr_alloc()\n{\n")); this_thing = (cattr_ty *)mem_alloc(sizeof(cattr_ty)); this_thing->reference_count = 1; this_thing->mask = 0; this_thing->errpos = str_copy(lex_position()); this_thing->brief_description = (string_ty *)0; this_thing->description = (string_ty *)0; this_thing->cause = (change_cause_ty)0; this_thing->test_exempt = (bool)0; this_thing->test_baseline_exempt = (bool)0; this_thing->regression_test_exempt = (bool)0; this_thing->architecture = (cattr_architecture_list_ty *)0; this_thing->copyright_years = (cattr_copyright_years_list_ty *)0; this_thing->version_previous = (string_ty *)0; this_thing->attribute = (attributes_list_ty *)0; trace(("return %08lX;\n", (long)this_thing)); trace(("}\n")); return this_thing; } cattr_ty * cattr_copy(cattr_ty *this_thing) { trace(("cattr_copy()\n{\n")); this_thing->reference_count++; trace(("return %08lX;\n", (long)this_thing)); trace(("}\n")); return this_thing; } cattr_ty * cattr_clone(cattr_ty *this_thing) { if (!this_thing) return 0; trace(("cattr_clone()\n{\n")); cattr_ty *result = (cattr_ty *)cattr_alloc(); result->brief_description = str_copy(this_thing->brief_description); result->description = str_copy(this_thing->description); result->cause = this_thing->cause; result->test_exempt = this_thing->test_exempt; result->test_baseline_exempt = this_thing->test_baseline_exempt; result->regression_test_exempt = this_thing->regression_test_exempt; result->architecture = cattr_architecture_list_clone(this_thing->architecture); result->copyright_years = cattr_copyright_years_list_clone(this_thing->copyright_years); result->version_previous = str_copy(this_thing->version_previous); result->attribute = attributes_list_clone(this_thing->attribute); trace(("return %08lX;\n", (long)result)); trace(("}\n")); return result; } #ifdef DEBUG void cattr_trace_real(const char *name, const cattr_ty *value) { if (name && *name) { trace_printf("%s = ", name); } if (!value) { trace_printf("NULL"); } else { trace_printf("{\n"); trace_string_real("brief_description", value->brief_description); trace_string_real("description", value->description); trace_printf("cause = %s;\n", change_cause_ename(value->cause)); trace_bool_real("test_exempt", value->test_exempt); trace_bool_real("test_baseline_exempt", value->test_baseline_exempt); trace_bool_real("regression_test_exempt", value->regression_test_exempt); cattr_architecture_list_trace_real("architecture", value->architecture); cattr_copyright_years_list_trace_real("copyright_years", value->copyright_years); trace_string_real("version_previous", value->version_previous); attributes_list_trace_real("attribute", value->attribute); trace_printf("}"); } trace_printf((name && *name) ? ";\n" : ",\n"); } #endif // DEBUG static void cattr_free(void *that) { cattr_ty *this_thing; this_thing = (cattr_ty *)that; if (!this_thing) return; this_thing->reference_count--; assert(this_thing->reference_count >= 0); if (this_thing->reference_count > 0) return; trace(("cattr_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->brief_description); str_free(this_thing->description); cattr_architecture_list_free(this_thing->architecture); cattr_copyright_years_list_free(this_thing->copyright_years); str_free(this_thing->version_previous); attributes_list_type.free(this_thing->attribute); mem_free(this_thing); trace(("}\n")); } static type_table_ty cattr_table[] = { { "brief_description", offsetof(cattr_ty, brief_description), &string_type, cattr_brief_description_mask, 0, // redefinition not ok 0, // fast_name }, { "description", offsetof(cattr_ty, description), &string_type, cattr_description_mask, 0, // redefinition not ok 0, // fast_name }, { "cause", offsetof(cattr_ty, cause), &change_cause_type, cattr_cause_mask, 0, // redefinition not ok 0, // fast_name }, { "test_exempt", offsetof(cattr_ty, test_exempt), &boolean_type, cattr_test_exempt_mask, 0, // redefinition not ok 0, // fast_name }, { "test_baseline_exempt", offsetof(cattr_ty, test_baseline_exempt), &boolean_type, cattr_test_baseline_exempt_mask, 0, // redefinition not ok 0, // fast_name }, { "regression_test_exempt", offsetof(cattr_ty, regression_test_exempt), &boolean_type, cattr_regression_test_exempt_mask, 0, // redefinition not ok 0, // fast_name }, { "architecture", offsetof(cattr_ty, architecture), &cattr_architecture_list_type, cattr_architecture_mask, 0, // redefinition not ok 0, // fast_name }, { "copyright_years", offsetof(cattr_ty, copyright_years), &cattr_copyright_years_list_type, cattr_copyright_years_mask, 0, // redefinition not ok 0, // fast_name }, { "version_previous", offsetof(cattr_ty, version_previous), &string_type, cattr_version_previous_mask, 0, // redefinition not ok 0, // fast_name }, { "attribute", offsetof(cattr_ty, attribute), &attributes_list_type, cattr_attribute_mask, 0, // redefinition not ok 0, // fast_name }, }; static void * cattr_parse(void *this_thing, string_ty *name, meta_type **type_pp, unsigned long *mask_p, int *redef_p) { void *addr; trace(("cattr_parse(this_thing = %08lX, name = %08lX, type_pp = %08lX)\n{\n", (long)this_thing, (long)name, (long)type_pp)); assert(((cattr_ty *)this_thing)->reference_count > 0); addr = generic_struct_parse ( this_thing, name, type_pp, mask_p, redef_p, cattr_table, SIZEOF(cattr_table) ); trace(("return %08lX;\n}\n", (long)addr)); return addr; } static string_ty * cattr_fuzzy(string_ty *name) { string_ty *result; trace(("cattr_fuzzy(name = %08lX)\n{\n", (long)name)); result = generic_struct_fuzzy ( name, cattr_table, SIZEOF(cattr_table) ); trace(("return %08lX;\n", (long)result)); trace(("}\n")); return result; } static rpt_value::pointer cattr_convert(void *this_thing) { trace(("cattr_convert(name = %08lX)\n{\n", (long)this_thing)); assert(((cattr_ty *)this_thing)->reference_count > 0); rpt_value::pointer result = generic_struct_convert ( this_thing, cattr_table, SIZEOF(cattr_table) ); trace(("return %08lX;\n", (long)result.get())); trace(("}\n")); return result; } meta_type cattr_type = { "cattr", cattr_alloc, cattr_free, 0, // enum_parse 0, // list_parse cattr_parse, cattr_fuzzy, cattr_convert, generic_struct_is_set, }; cattr_ty * cattr_read_file(const nstring &filename) { return cattr_read_file(filename.get_ref()); } cattr_ty * cattr_read_file(string_ty *filename) { cattr_ty *result; trace(("cattr_read_file(filename = \"%s\")\n{\n", (filename ? filename->str_text : ""))); os_become_must_be_active(); result = (cattr_ty *)parse(filename, &cattr_type); trace(("return %08lX;\n", (long)result)); trace(("}\n")); return result; } void cattr_write_file(const nstring &filename, cattr_ty *value, bool comp) { cattr_write_file(filename.get_ref(), value, comp); } void cattr_write_file(string_ty *filename, cattr_ty *value, int needs_compression) { trace(("cattr_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); cattr_write(fp, value); type_enum_option_clear(); trace(("}\n")); } void cattr__rpt_init(void) { trace(("cattr__rpt_init()\n{\n")); trace(("}\n")); }