#include #include #include #include #include #include #include #include #include #include #include #include void rptidx_where_write(fp, name, this) output_ty *fp; char *name; rptidx_where this; { if (!this) return; trace(("rptidx_where_write(name = \"%s\", this = %08lX)\n{\n"/*}*/, name, (long)this)); assert(((rptidx_where)this)->reference_count > 0); trace(("rc = %d;\n", ((rptidx_where)this)->reference_count)); if (name) { output_fputs(fp, name); output_fputs(fp, " =\n"); } output_fputs(fp, "{\n"/*}*/); string_write(fp, "name", this->name); string_write(fp, "description", this->description); string_write(fp, "filename", this->filename); output_fputs(fp, /*{*/"}"); if (name) output_fputs(fp, ";\n"); trace((/*{*/"}\n")); } static void *rptidx_where_alloc _((void)); static void * rptidx_where_alloc() { rptidx_where this; trace(("rptidx_where_alloc()\n{\n"/*}*/)); this = mem_alloc(sizeof(struct rptidx_where)); this->reference_count = 1; this->mask = 0; this->name = 0; this->description = 0; this->filename = 0; trace(("return %08lX;\n", (long)this)); trace((/*{*/"}\n")); return this; } rptidx_where rptidx_where_copy(this) rptidx_where this; { trace(("rptidx_where_copy()\n{\n"/*}*/)); this->reference_count++; trace(("return %08lX;\n", (long)this)); trace((/*{*/"}\n")); return this; } static void rptidx_where_free _((void *)); static void rptidx_where_free(that) void *that; { rptidx_where this = that; if (!this) return; this->reference_count--; assert(this->reference_count >= 0); if (this->reference_count > 0) return; trace(("rptidx_where_free(this = %08lX)\n{\n"/*}*/, (long)this)); str_free(this->name); str_free(this->description); str_free(this->filename); mem_free(this); trace((/*{*/"}\n")); } static type_table_ty rptidx_where_table[] = { { "name", offsetof(struct rptidx_where, name), &string_type, rptidx_where_name_mask, }, { "description", offsetof(struct rptidx_where, description), &string_type, rptidx_where_description_mask, }, { "filename", offsetof(struct rptidx_where, filename), &string_type, rptidx_where_filename_mask, }, }; static void *rptidx_where_parse _((void *, string_ty *, type_ty **, unsigned long *)); static void * rptidx_where_parse(this, name, type_pp, mask_p) void *this; string_ty *name; type_ty **type_pp; unsigned long *mask_p; { void *addr; trace(("rptidx_where_parse(this = %08lX, name = %08lX, type_pp = %08lX)\n{\n"/*}*/, (long)this, (long)name, (long)type_pp)); assert(((rptidx_where)this)->reference_count > 0); assert(sizeof(rptidx_where) == sizeof(generic_struct_ty *)); addr = generic_struct_parse ( this, name, type_pp, mask_p, rptidx_where_table, SIZEOF(rptidx_where_table) ); trace((/*{*/"return %08lX;\n}\n", (long)addr)); return addr; } static string_ty *rptidx_where_fuzzy _((string_ty *)); static string_ty * rptidx_where_fuzzy(name) string_ty *name; { string_ty *result; trace(("rptidx_where_fuzzy(name = %08lX)\n{\n"/*}*/, (long)name)); result = generic_struct_fuzzy ( name, rptidx_where_table, SIZEOF(rptidx_where_table) ); trace(("return %08lX;\n", (long)result)); trace((/*{*/"}\n")); return result; } static struct rpt_value_ty *rptidx_where_convert _((void *)); static struct rpt_value_ty * rptidx_where_convert(this) void *this; { struct rpt_value_ty *result; trace(("rptidx_where_convert(name = %08lX)\n{\n"/*}*/, (long)this)); assert(((rptidx_where)this)->reference_count > 0); result = generic_struct_convert ( this, rptidx_where_table, SIZEOF(rptidx_where_table) ); trace(("return %08lX;\n", (long)result)); trace((/*{*/"}\n")); return result; } type_ty rptidx_where_type = { "rptidx_where", rptidx_where_alloc, rptidx_where_free, 0, /* enum_parse */ 0, /* list_parse */ rptidx_where_parse, rptidx_where_fuzzy, rptidx_where_convert, generic_struct_is_set, }; #include void rptidx_where_list_write(fp, name, this) output_ty *fp; char *name; rptidx_where_list this; { size_t j; if (!this) return; trace(("rptidx_where_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) { rptidx_where_write(fp, (char *)0, this->list[j]); output_fputs(fp, ",\n"); } output_fputs(fp, /*[*/"]"); if (name) output_fputs(fp, ";\n"); trace((/*{*/"}\n")); } static void *rptidx_where_list_alloc _((void)); static void * rptidx_where_list_alloc() { rptidx_where_list result; trace(("rptidx_where_list_alloc()\n{\n"/*}*/)); result = mem_alloc(sizeof(struct rptidx_where_list)); result->list = 0; result->length = 0; result->maximum = 0; trace(("return %08lX;\n", (long)result)); trace((/*{*/"}\n")); return result; } static void rptidx_where_list_free _((void *)); static void rptidx_where_list_free(that) void *that; { rptidx_where_list this = that; size_t j; if (!this) return; trace(("rptidx_where_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) rptidx_where_free(this->list[j]); if (this->list) mem_free(this->list); mem_free(this); trace((/*{*/"}\n")); } static void *rptidx_where_list_parse _((void *, type_ty **)); static void * rptidx_where_list_parse(that, type_pp) void *that; type_ty **type_pp; { rptidx_where_list this = that; void *addr; trace(("rptidx_where_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 = &rptidx_where_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 *rptidx_where_list_convert _((void *)); static rpt_value_ty * rptidx_where_list_convert(that) void *that; { rptidx_where_list this; rpt_value_ty *result; size_t j; rpt_value_ty *vp; this = *(rptidx_where_list *)that; if (!this) return 0; trace(("rptidx_where_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 = rptidx_where_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 rptidx_where_list_type = { "rptidx_where_list", rptidx_where_list_alloc, rptidx_where_list_free, 0, /* enum_parse */ rptidx_where_list_parse, 0, /* struct_parse */ 0, /* fuzzy */ rptidx_where_list_convert, generic_struct_is_set, }; void rptidx_write(fp, this) output_ty *fp; rptidx this; { if (!this) return; trace(("rptidx_write(this = %08lX)\n{\n"/*}*/, this)); assert(((rptidx)this)->reference_count > 0); trace(("rc = %d;\n", ((rptidx)this)->reference_count)); rptidx_where_list_write(fp, "where", this->where); trace((/*{*/"}\n")); } static void *rptidx_alloc _((void)); static void * rptidx_alloc() { rptidx this; trace(("rptidx_alloc()\n{\n"/*}*/)); this = mem_alloc(sizeof(struct rptidx)); this->reference_count = 1; this->mask = 0; this->where = 0; trace(("return %08lX;\n", (long)this)); trace((/*{*/"}\n")); return this; } rptidx rptidx_copy(this) rptidx this; { trace(("rptidx_copy()\n{\n"/*}*/)); this->reference_count++; trace(("return %08lX;\n", (long)this)); trace((/*{*/"}\n")); return this; } static void rptidx_free _((void *)); static void rptidx_free(that) void *that; { rptidx this = that; if (!this) return; this->reference_count--; assert(this->reference_count >= 0); if (this->reference_count > 0) return; trace(("rptidx_free(this = %08lX)\n{\n"/*}*/, (long)this)); rptidx_where_list_free(this->where); mem_free(this); trace((/*{*/"}\n")); } static type_table_ty rptidx_table[] = { { "where", offsetof(struct rptidx, where), &rptidx_where_list_type, rptidx_where_mask, }, }; static void *rptidx_parse _((void *, string_ty *, type_ty **, unsigned long *)); static void * rptidx_parse(this, name, type_pp, mask_p) void *this; string_ty *name; type_ty **type_pp; unsigned long *mask_p; { void *addr; trace(("rptidx_parse(this = %08lX, name = %08lX, type_pp = %08lX)\n{\n"/*}*/, (long)this, (long)name, (long)type_pp)); assert(((rptidx)this)->reference_count > 0); assert(sizeof(rptidx) == sizeof(generic_struct_ty *)); addr = generic_struct_parse ( this, name, type_pp, mask_p, rptidx_table, SIZEOF(rptidx_table) ); trace((/*{*/"return %08lX;\n}\n", (long)addr)); return addr; } static string_ty *rptidx_fuzzy _((string_ty *)); static string_ty * rptidx_fuzzy(name) string_ty *name; { string_ty *result; trace(("rptidx_fuzzy(name = %08lX)\n{\n"/*}*/, (long)name)); result = generic_struct_fuzzy ( name, rptidx_table, SIZEOF(rptidx_table) ); trace(("return %08lX;\n", (long)result)); trace((/*{*/"}\n")); return result; } static struct rpt_value_ty *rptidx_convert _((void *)); static struct rpt_value_ty * rptidx_convert(this) void *this; { struct rpt_value_ty *result; trace(("rptidx_convert(name = %08lX)\n{\n"/*}*/, (long)this)); assert(((rptidx)this)->reference_count > 0); result = generic_struct_convert ( this, rptidx_table, SIZEOF(rptidx_table) ); trace(("return %08lX;\n", (long)result)); trace((/*{*/"}\n")); return result; } type_ty rptidx_type = { "rptidx", rptidx_alloc, rptidx_free, 0, /* enum_parse */ 0, /* list_parse */ rptidx_parse, rptidx_fuzzy, rptidx_convert, generic_struct_is_set, }; rptidx rptidx_read_file(filename) string_ty *filename; { rptidx result; trace(("rptidx_read_file(filename = \"%s\")\n{\n"/*}*/, (filename ? filename->str_text : ""))); os_become_must_be_active(); result = parse(filename, &rptidx_type); trace(("return %08lX;\n", result)); trace((/*{*/"}\n")); return result; } void rptidx_write_file(filename, value, compress) string_ty *filename; rptidx value; int compress; { output_ty *fp; trace(("rptidx_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); rptidx_write(fp, value); type_enum_option_clear(); output_delete(fp); trace((/*{*/"}\n")); } void rptidx__rpt_init() { trace(("rptidx__rpt_init()\n{\n"/*}*/)); trace((/*{*/"}\n")); }