#include #include #include #include #include #include #include #include #include #include #include #include #include void ustate_own_changes_list_write(fp, name, this) output_ty *fp; char *name; ustate_own_changes_list this; { size_t j; if (!this) return; trace(("ustate_own_changes_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 *ustate_own_changes_list_alloc _((void)); static void * ustate_own_changes_list_alloc() { ustate_own_changes_list result; trace(("ustate_own_changes_list_alloc()\n{\n"/*}*/)); result = mem_alloc(sizeof(struct ustate_own_changes_list)); result->list = 0; result->length = 0; result->maximum = 0; trace(("return %08lX;\n", (long)result)); trace((/*{*/"}\n")); return result; } static void ustate_own_changes_list_free _((void *)); static void ustate_own_changes_list_free(that) void *that; { ustate_own_changes_list this = that; size_t j; if (!this) return; trace(("ustate_own_changes_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 *ustate_own_changes_list_parse _((void *, type_ty **)); static void * ustate_own_changes_list_parse(that, type_pp) void *that; type_ty **type_pp; { ustate_own_changes_list this = that; void *addr; trace(("ustate_own_changes_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 *ustate_own_changes_list_convert _((void *)); static rpt_value_ty * ustate_own_changes_list_convert(that) void *that; { ustate_own_changes_list this; rpt_value_ty *result; size_t j; rpt_value_ty *vp; this = *(ustate_own_changes_list *)that; if (!this) return 0; trace(("ustate_own_changes_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 ustate_own_changes_list_type = { "ustate_own_changes_list", ustate_own_changes_list_alloc, ustate_own_changes_list_free, 0, /* enum_parse */ ustate_own_changes_list_parse, 0, /* struct_parse */ 0, /* fuzzy */ ustate_own_changes_list_convert, generic_struct_is_set, }; void ustate_own_write(fp, name, this) output_ty *fp; char *name; ustate_own this; { if (!this) return; trace(("ustate_own_write(name = \"%s\", this = %08lX)\n{\n"/*}*/, name, (long)this)); assert(((ustate_own)this)->reference_count > 0); trace(("rc = %d;\n", ((ustate_own)this)->reference_count)); if (name) { output_fputs(fp, name); output_fputs(fp, " =\n"); } output_fputs(fp, "{\n"/*}*/); string_write(fp, "project_name", this->project_name); ustate_own_changes_list_write(fp, "changes", this->changes); output_fputs(fp, /*{*/"}"); if (name) output_fputs(fp, ";\n"); trace((/*{*/"}\n")); } static void *ustate_own_alloc _((void)); static void * ustate_own_alloc() { ustate_own this; trace(("ustate_own_alloc()\n{\n"/*}*/)); this = mem_alloc(sizeof(struct ustate_own)); this->reference_count = 1; this->mask = 0; this->project_name = 0; this->changes = 0; trace(("return %08lX;\n", (long)this)); trace((/*{*/"}\n")); return this; } ustate_own ustate_own_copy(this) ustate_own this; { trace(("ustate_own_copy()\n{\n"/*}*/)); this->reference_count++; trace(("return %08lX;\n", (long)this)); trace((/*{*/"}\n")); return this; } static void ustate_own_free _((void *)); static void ustate_own_free(that) void *that; { ustate_own this = that; if (!this) return; this->reference_count--; assert(this->reference_count >= 0); if (this->reference_count > 0) return; trace(("ustate_own_free(this = %08lX)\n{\n"/*}*/, (long)this)); str_free(this->project_name); ustate_own_changes_list_free(this->changes); mem_free(this); trace((/*{*/"}\n")); } static type_table_ty ustate_own_table[] = { { "project_name", offsetof(struct ustate_own, project_name), &string_type, ustate_own_project_name_mask, }, { "changes", offsetof(struct ustate_own, changes), &ustate_own_changes_list_type, ustate_own_changes_mask, }, }; static void *ustate_own_parse _((void *, string_ty *, type_ty **, unsigned long *)); static void * ustate_own_parse(this, name, type_pp, mask_p) void *this; string_ty *name; type_ty **type_pp; unsigned long *mask_p; { void *addr; trace(("ustate_own_parse(this = %08lX, name = %08lX, type_pp = %08lX)\n{\n"/*}*/, (long)this, (long)name, (long)type_pp)); assert(((ustate_own)this)->reference_count > 0); assert(sizeof(ustate_own) == sizeof(generic_struct_ty *)); addr = generic_struct_parse ( this, name, type_pp, mask_p, ustate_own_table, SIZEOF(ustate_own_table) ); trace((/*{*/"return %08lX;\n}\n", (long)addr)); return addr; } static string_ty *ustate_own_fuzzy _((string_ty *)); static string_ty * ustate_own_fuzzy(name) string_ty *name; { string_ty *result; trace(("ustate_own_fuzzy(name = %08lX)\n{\n"/*}*/, (long)name)); result = generic_struct_fuzzy ( name, ustate_own_table, SIZEOF(ustate_own_table) ); trace(("return %08lX;\n", (long)result)); trace((/*{*/"}\n")); return result; } static struct rpt_value_ty *ustate_own_convert _((void *)); static struct rpt_value_ty * ustate_own_convert(this) void *this; { struct rpt_value_ty *result; trace(("ustate_own_convert(name = %08lX)\n{\n"/*}*/, (long)this)); assert(((ustate_own)this)->reference_count > 0); result = generic_struct_convert ( this, ustate_own_table, SIZEOF(ustate_own_table) ); trace(("return %08lX;\n", (long)result)); trace((/*{*/"}\n")); return result; } type_ty ustate_own_type = { "ustate_own", ustate_own_alloc, ustate_own_free, 0, /* enum_parse */ 0, /* list_parse */ ustate_own_parse, ustate_own_fuzzy, ustate_own_convert, generic_struct_is_set, }; void ustate_own_list_write(fp, name, this) output_ty *fp; char *name; ustate_own_list this; { size_t j; if (!this) return; trace(("ustate_own_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) { ustate_own_write(fp, (char *)0, this->list[j]); output_fputs(fp, ",\n"); } output_fputs(fp, /*[*/"]"); if (name) output_fputs(fp, ";\n"); trace((/*{*/"}\n")); } static void *ustate_own_list_alloc _((void)); static void * ustate_own_list_alloc() { ustate_own_list result; trace(("ustate_own_list_alloc()\n{\n"/*}*/)); result = mem_alloc(sizeof(struct ustate_own_list)); result->list = 0; result->length = 0; result->maximum = 0; trace(("return %08lX;\n", (long)result)); trace((/*{*/"}\n")); return result; } static void ustate_own_list_free _((void *)); static void ustate_own_list_free(that) void *that; { ustate_own_list this = that; size_t j; if (!this) return; trace(("ustate_own_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) ustate_own_free(this->list[j]); if (this->list) mem_free(this->list); mem_free(this); trace((/*{*/"}\n")); } static void *ustate_own_list_parse _((void *, type_ty **)); static void * ustate_own_list_parse(that, type_pp) void *that; type_ty **type_pp; { ustate_own_list this = that; void *addr; trace(("ustate_own_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 = &ustate_own_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 *ustate_own_list_convert _((void *)); static rpt_value_ty * ustate_own_list_convert(that) void *that; { ustate_own_list this; rpt_value_ty *result; size_t j; rpt_value_ty *vp; this = *(ustate_own_list *)that; if (!this) return 0; trace(("ustate_own_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 = ustate_own_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 ustate_own_list_type = { "ustate_own_list", ustate_own_list_alloc, ustate_own_list_free, 0, /* enum_parse */ ustate_own_list_parse, 0, /* struct_parse */ 0, /* fuzzy */ ustate_own_list_convert, generic_struct_is_set, }; void ustate_write(fp, this) output_ty *fp; ustate this; { if (!this) return; trace(("ustate_write(this = %08lX)\n{\n"/*}*/, this)); assert(((ustate)this)->reference_count > 0); trace(("rc = %d;\n", ((ustate)this)->reference_count)); ustate_own_list_write(fp, "own", this->own); trace((/*{*/"}\n")); } static void *ustate_alloc _((void)); static void * ustate_alloc() { ustate this; trace(("ustate_alloc()\n{\n"/*}*/)); this = mem_alloc(sizeof(struct ustate)); this->reference_count = 1; this->mask = 0; this->own = 0; trace(("return %08lX;\n", (long)this)); trace((/*{*/"}\n")); return this; } ustate ustate_copy(this) ustate this; { trace(("ustate_copy()\n{\n"/*}*/)); this->reference_count++; trace(("return %08lX;\n", (long)this)); trace((/*{*/"}\n")); return this; } static void ustate_free _((void *)); static void ustate_free(that) void *that; { ustate this = that; if (!this) return; this->reference_count--; assert(this->reference_count >= 0); if (this->reference_count > 0) return; trace(("ustate_free(this = %08lX)\n{\n"/*}*/, (long)this)); ustate_own_list_free(this->own); mem_free(this); trace((/*{*/"}\n")); } static type_table_ty ustate_table[] = { { "own", offsetof(struct ustate, own), &ustate_own_list_type, ustate_own_mask, }, }; static void *ustate_parse _((void *, string_ty *, type_ty **, unsigned long *)); static void * ustate_parse(this, name, type_pp, mask_p) void *this; string_ty *name; type_ty **type_pp; unsigned long *mask_p; { void *addr; trace(("ustate_parse(this = %08lX, name = %08lX, type_pp = %08lX)\n{\n"/*}*/, (long)this, (long)name, (long)type_pp)); assert(((ustate)this)->reference_count > 0); assert(sizeof(ustate) == sizeof(generic_struct_ty *)); addr = generic_struct_parse ( this, name, type_pp, mask_p, ustate_table, SIZEOF(ustate_table) ); trace((/*{*/"return %08lX;\n}\n", (long)addr)); return addr; } static string_ty *ustate_fuzzy _((string_ty *)); static string_ty * ustate_fuzzy(name) string_ty *name; { string_ty *result; trace(("ustate_fuzzy(name = %08lX)\n{\n"/*}*/, (long)name)); result = generic_struct_fuzzy ( name, ustate_table, SIZEOF(ustate_table) ); trace(("return %08lX;\n", (long)result)); trace((/*{*/"}\n")); return result; } static struct rpt_value_ty *ustate_convert _((void *)); static struct rpt_value_ty * ustate_convert(this) void *this; { struct rpt_value_ty *result; trace(("ustate_convert(name = %08lX)\n{\n"/*}*/, (long)this)); assert(((ustate)this)->reference_count > 0); result = generic_struct_convert ( this, ustate_table, SIZEOF(ustate_table) ); trace(("return %08lX;\n", (long)result)); trace((/*{*/"}\n")); return result; } type_ty ustate_type = { "ustate", ustate_alloc, ustate_free, 0, /* enum_parse */ 0, /* list_parse */ ustate_parse, ustate_fuzzy, ustate_convert, generic_struct_is_set, }; ustate ustate_read_file(filename) string_ty *filename; { ustate result; trace(("ustate_read_file(filename = \"%s\")\n{\n"/*}*/, (filename ? filename->str_text : ""))); os_become_must_be_active(); result = parse(filename, &ustate_type); trace(("return %08lX;\n", result)); trace((/*{*/"}\n")); return result; } void ustate_write_file(filename, value, compress) string_ty *filename; ustate value; int compress; { output_ty *fp; trace(("ustate_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); ustate_write(fp, value); type_enum_option_clear(); output_delete(fp); trace((/*{*/"}\n")); } void ustate__rpt_init() { trace(("ustate__rpt_init()\n{\n"/*}*/)); trace((/*{*/"}\n")); }