#include #include #include #include #include #include #include #include #include #include #include #include #include void cattr_architecture_list_write(fp, name, this) output_ty *fp; char *name; cattr_architecture_list this; { size_t j; if (!this) return; trace(("cattr_architecture_list_write(name = \"%s\", this = %08lX)\n{\n"/*}*/, name, (long)this)); if (name) { output_fputs(fp, name); output_fputs(fp, " =\n"); } assert(this->length <= this->maximum); assert(!this->list == !this->maximum); output_fputs(fp, "[\n"/*]*/); for (j = 0; j < this->length; ++j) { string_write(fp, (char *)0, this->list[j]); output_fputs(fp, ",\n"); } output_fputs(fp, /*[*/"]"); if (name) output_fputs(fp, ";\n"); trace((/*{*/"}\n")); } static void *cattr_architecture_list_alloc _((void)); static void * cattr_architecture_list_alloc() { cattr_architecture_list result; trace(("cattr_architecture_list_alloc()\n{\n"/*}*/)); result = mem_alloc(sizeof(struct cattr_architecture_list)); 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 *)); static void cattr_architecture_list_free(that) void *that; { cattr_architecture_list this = that; size_t j; if (!this) return; trace(("cattr_architecture_list_free(this = %08lX)\n{\n"/*}*/, (long)this)); assert(this->length <= this->maximum); assert(!this->list == !this->maximum); for (j = 0; j < this->length; ++j) str_free(this->list[j]); if (this->list) mem_free(this->list); mem_free(this); trace((/*{*/"}\n")); } static void *cattr_architecture_list_parse _((void *, type_ty **)); static void * cattr_architecture_list_parse(that, type_pp) void *that; type_ty **type_pp; { cattr_architecture_list this = that; void *addr; trace(("cattr_architecture_list_parse(this = %08lX, type_pp = %08lX)\n{\n"/*}*/, (long)this, (long)type_pp)); assert(this->length <= this->maximum); assert(!this->list == !this->maximum); *type_pp = &string_type; trace_pointer(*type_pp); if (this->length >= this->maximum) { size_t nbytes; this->maximum = this->maximum * 2 + 16; nbytes = this->maximum * sizeof(this->list[0]); this->list = mem_change_size(this->list, nbytes); } addr = &this->list[this->length++]; trace(("return %08lX;\n", (long)addr)); trace((/*{*/"}\n")); return addr; } static rpt_value_ty *cattr_architecture_list_convert _((void *)); static rpt_value_ty * cattr_architecture_list_convert(that) void *that; { cattr_architecture_list this; rpt_value_ty *result; size_t j; rpt_value_ty *vp; this = *(cattr_architecture_list *)that; if (!this) return 0; trace(("cattr_architecture_list_convert(this = %08lX)\n{\n"/*}*/, (long)this)); assert(this->length <= this->maximum); assert(!this->list == !this->maximum); result = rpt_value_list(); for (j = 0; j < this->length; ++j) { vp = string_type.convert(&this->list[j]); assert(vp); rpt_value_list_append(result, vp); rpt_value_free(vp); } trace((/*{*/"}\n")); trace(("return %08lX;\n", (long)result)); return result; } type_ty 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(fp, name, this) output_ty *fp; char *name; cattr_copyright_years_list this; { size_t j; if (!this) return; trace(("cattr_copyright_years_list_write(name = \"%s\", this = %08lX)\n{\n"/*}*/, name, (long)this)); if (name) { output_fputs(fp, name); output_fputs(fp, " =\n"); } assert(this->length <= this->maximum); assert(!this->list == !this->maximum); output_fputs(fp, "[\n"/*]*/); for (j = 0; j < this->length; ++j) { integer_write(fp, (char *)0, this->list[j]); output_fputs(fp, ",\n"); } output_fputs(fp, /*[*/"]"); if (name) output_fputs(fp, ";\n"); trace((/*{*/"}\n")); } static void *cattr_copyright_years_list_alloc _((void)); static void * cattr_copyright_years_list_alloc() { cattr_copyright_years_list result; trace(("cattr_copyright_years_list_alloc()\n{\n"/*}*/)); result = mem_alloc(sizeof(struct cattr_copyright_years_list)); 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 *)); static void cattr_copyright_years_list_free(that) void *that; { cattr_copyright_years_list this = that; size_t j; if (!this) return; trace(("cattr_copyright_years_list_free(this = %08lX)\n{\n"/*}*/, (long)this)); assert(this->length <= this->maximum); assert(!this->list == !this->maximum); for (j = 0; j < this->length; ++j) ; if (this->list) mem_free(this->list); mem_free(this); trace((/*{*/"}\n")); } static void *cattr_copyright_years_list_parse _((void *, type_ty **)); static void * cattr_copyright_years_list_parse(that, type_pp) void *that; type_ty **type_pp; { cattr_copyright_years_list this = that; void *addr; trace(("cattr_copyright_years_list_parse(this = %08lX, type_pp = %08lX)\n{\n"/*}*/, (long)this, (long)type_pp)); assert(this->length <= this->maximum); assert(!this->list == !this->maximum); *type_pp = &integer_type; trace_pointer(*type_pp); if (this->length >= this->maximum) { size_t nbytes; this->maximum = this->maximum * 2 + 16; nbytes = this->maximum * sizeof(this->list[0]); this->list = mem_change_size(this->list, nbytes); } addr = &this->list[this->length++]; trace(("return %08lX;\n", (long)addr)); trace((/*{*/"}\n")); return addr; } static rpt_value_ty *cattr_copyright_years_list_convert _((void *)); static rpt_value_ty * cattr_copyright_years_list_convert(that) void *that; { cattr_copyright_years_list this; rpt_value_ty *result; size_t j; rpt_value_ty *vp; this = *(cattr_copyright_years_list *)that; if (!this) return 0; trace(("cattr_copyright_years_list_convert(this = %08lX)\n{\n"/*}*/, (long)this)); assert(this->length <= this->maximum); assert(!this->list == !this->maximum); result = rpt_value_list(); for (j = 0; j < this->length; ++j) { vp = integer_type.convert(&this->list[j]); assert(vp); rpt_value_list_append(result, vp); rpt_value_free(vp); } trace((/*{*/"}\n")); trace(("return %08lX;\n", (long)result)); return result; } type_ty 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(fp, this) output_ty *fp; cattr this; { if (!this) return; trace(("cattr_write(this = %08lX)\n{\n"/*}*/, this)); assert(((cattr)this)->reference_count > 0); trace(("rc = %d;\n", ((cattr)this)->reference_count)); string_write(fp, "brief_description", this->brief_description); string_write(fp, "description", this->description); change_cause_write(fp, "cause", this->cause); boolean_write(fp, "test_exempt", this->test_exempt); boolean_write(fp, "test_baseline_exempt", this->test_baseline_exempt); boolean_write(fp, "regression_test_exempt", this->regression_test_exempt); cattr_architecture_list_write(fp, "architecture", this->architecture); cattr_copyright_years_list_write(fp, "copyright_years", this->copyright_years); string_write(fp, "version_previous", this->version_previous); trace((/*{*/"}\n")); } static void *cattr_alloc _((void)); static void * cattr_alloc() { cattr this; trace(("cattr_alloc()\n{\n"/*}*/)); this = mem_alloc(sizeof(struct cattr)); this->reference_count = 1; this->mask = 0; this->brief_description = 0; this->description = 0; this->cause = 0; this->test_exempt = 0; this->test_baseline_exempt = 0; this->regression_test_exempt = 0; this->architecture = 0; this->copyright_years = 0; this->version_previous = 0; trace(("return %08lX;\n", (long)this)); trace((/*{*/"}\n")); return this; } cattr cattr_copy(this) cattr this; { trace(("cattr_copy()\n{\n"/*}*/)); this->reference_count++; trace(("return %08lX;\n", (long)this)); trace((/*{*/"}\n")); return this; } static void cattr_free _((void *)); static void cattr_free(that) void *that; { cattr this = that; if (!this) return; this->reference_count--; assert(this->reference_count >= 0); if (this->reference_count > 0) return; trace(("cattr_free(this = %08lX)\n{\n"/*}*/, (long)this)); str_free(this->brief_description); str_free(this->description); cattr_architecture_list_free(this->architecture); cattr_copyright_years_list_free(this->copyright_years); str_free(this->version_previous); mem_free(this); trace((/*{*/"}\n")); } static type_table_ty cattr_table[] = { { "brief_description", offsetof(struct cattr, brief_description), &string_type, cattr_brief_description_mask, }, { "description", offsetof(struct cattr, description), &string_type, cattr_description_mask, }, { "cause", offsetof(struct cattr, cause), &change_cause_type, cattr_cause_mask, }, { "test_exempt", offsetof(struct cattr, test_exempt), &boolean_type, cattr_test_exempt_mask, }, { "test_baseline_exempt", offsetof(struct cattr, test_baseline_exempt), &boolean_type, cattr_test_baseline_exempt_mask, }, { "regression_test_exempt", offsetof(struct cattr, regression_test_exempt), &boolean_type, cattr_regression_test_exempt_mask, }, { "architecture", offsetof(struct cattr, architecture), &cattr_architecture_list_type, cattr_architecture_mask, }, { "copyright_years", offsetof(struct cattr, copyright_years), &cattr_copyright_years_list_type, cattr_copyright_years_mask, }, { "version_previous", offsetof(struct cattr, version_previous), &string_type, cattr_version_previous_mask, }, }; static void *cattr_parse _((void *, string_ty *, type_ty **, unsigned long *)); static void * cattr_parse(this, name, type_pp, mask_p) void *this; string_ty *name; type_ty **type_pp; unsigned long *mask_p; { void *addr; trace(("cattr_parse(this = %08lX, name = %08lX, type_pp = %08lX)\n{\n"/*}*/, (long)this, (long)name, (long)type_pp)); assert(((cattr)this)->reference_count > 0); assert(sizeof(cattr) == sizeof(generic_struct_ty *)); addr = generic_struct_parse ( this, name, type_pp, mask_p, cattr_table, SIZEOF(cattr_table) ); trace((/*{*/"return %08lX;\n}\n", (long)addr)); return addr; } static string_ty *cattr_fuzzy _((string_ty *)); static string_ty * cattr_fuzzy(name) 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 struct rpt_value_ty *cattr_convert _((void *)); static struct rpt_value_ty * cattr_convert(this) void *this; { struct rpt_value_ty *result; trace(("cattr_convert(name = %08lX)\n{\n"/*}*/, (long)this)); assert(((cattr)this)->reference_count > 0); result = generic_struct_convert ( this, cattr_table, SIZEOF(cattr_table) ); trace(("return %08lX;\n", (long)result)); trace((/*{*/"}\n")); return result; } type_ty cattr_type = { "cattr", cattr_alloc, cattr_free, 0, /* enum_parse */ 0, /* list_parse */ cattr_parse, cattr_fuzzy, cattr_convert, generic_struct_is_set, }; cattr cattr_read_file(filename) string_ty *filename; { cattr result; trace(("cattr_read_file(filename = \"%s\")\n{\n"/*}*/, (filename ? filename->str_text : ""))); os_become_must_be_active(); result = parse(filename, &cattr_type); trace(("return %08lX;\n", result)); trace((/*{*/"}\n")); return result; } void cattr_write_file(filename, value, compress) string_ty *filename; cattr value; int compress; { output_ty *fp; trace(("cattr_write_file(filename = \"%s\", value = %08lX)\n{\n"/*}*/, (filename ? filename->str_text : ""), (long)value)); if (filename) os_become_must_be_active(); if (compress) { fp = output_file_binary_open(filename); fp = output_gzip(fp); } else { fp = output_file_text_open(filename); } fp = output_indent(fp); io_comment_emit(fp); cattr_write(fp, value); type_enum_option_clear(); output_delete(fp); trace((/*{*/"}\n")); } void cattr__rpt_init() { trace(("cattr__rpt_init()\n{\n"/*}*/)); trace((/*{*/"}\n")); }