#include #include #include #include #include #include #include #include #include #include #include #include #include void pattr_copyright_years_list_write(fp, name, this) output_ty *fp; char *name; pattr_copyright_years_list this; { size_t j; if (!this) return; trace(("pattr_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 *pattr_copyright_years_list_alloc _((void)); static void * pattr_copyright_years_list_alloc() { pattr_copyright_years_list result; trace(("pattr_copyright_years_list_alloc()\n{\n"/*}*/)); result = mem_alloc(sizeof(struct pattr_copyright_years_list)); result->list = 0; result->length = 0; result->maximum = 0; trace(("return %08lX;\n", (long)result)); trace((/*{*/"}\n")); return result; } static void pattr_copyright_years_list_free _((void *)); static void pattr_copyright_years_list_free(that) void *that; { pattr_copyright_years_list this = that; size_t j; if (!this) return; trace(("pattr_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 *pattr_copyright_years_list_parse _((void *, type_ty **)); static void * pattr_copyright_years_list_parse(that, type_pp) void *that; type_ty **type_pp; { pattr_copyright_years_list this = that; void *addr; trace(("pattr_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 *pattr_copyright_years_list_convert _((void *)); static rpt_value_ty * pattr_copyright_years_list_convert(that) void *that; { pattr_copyright_years_list this; rpt_value_ty *result; size_t j; rpt_value_ty *vp; this = *(pattr_copyright_years_list *)that; if (!this) return 0; trace(("pattr_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 pattr_copyright_years_list_type = { "pattr_copyright_years_list", pattr_copyright_years_list_alloc, pattr_copyright_years_list_free, 0, /* enum_parse */ pattr_copyright_years_list_parse, 0, /* struct_parse */ 0, /* fuzzy */ pattr_copyright_years_list_convert, generic_struct_is_set, }; static char *pattr_develop_end_action_s[] = { "goto_being_reviewed", "goto_awaiting_review", "goto_awaiting_integration", }; static string_ty *pattr_develop_end_action_f[SIZEOF(pattr_develop_end_action_s)]; char * pattr_develop_end_action_ename(this) pattr_develop_end_action_ty this; { static char buffer[20]; if ((int)this >= 0 && (int)this < 3) return pattr_develop_end_action_s[this]; sprintf(buffer, "%d", (int)this); return buffer; } void pattr_develop_end_action_write(fp, name, this) output_ty *fp; const char *name; pattr_develop_end_action_ty this; { if (name) { if (this == 0 && type_enum_option_query()) return; output_fputs(fp, name); output_fputs(fp, " = "); } output_fputs(fp, pattr_develop_end_action_s[this]); if (name) output_fputs(fp, ";\n"); } static int pattr_develop_end_action_parse _((string_ty *)); static int pattr_develop_end_action_parse(name) string_ty *name; { int j; slow_to_fast(pattr_develop_end_action_s, pattr_develop_end_action_f, SIZEOF(pattr_develop_end_action_s)); for (j = 0; j < SIZEOF(pattr_develop_end_action_f); ++j) { if (str_equal(name, pattr_develop_end_action_f[j])) return j; } return -1; } static string_ty *pattr_develop_end_action_fuzzy _((string_ty *)); static string_ty * pattr_develop_end_action_fuzzy(name) string_ty *name; { return generic_enum_fuzzy ( name, pattr_develop_end_action_f, SIZEOF(pattr_develop_end_action_f) ); } static struct rpt_value_ty *pattr_develop_end_action_convert _((void *)); static struct rpt_value_ty * pattr_develop_end_action_convert(this) void *this; { if (!pattr_develop_end_action_f[0]) slow_to_fast(pattr_develop_end_action_s, pattr_develop_end_action_f, SIZEOF(pattr_develop_end_action_s)); return generic_enum_convert ( this, pattr_develop_end_action_f, SIZEOF(pattr_develop_end_action_f) ); } type_ty pattr_develop_end_action_type = { "pattr_develop_end_action", 0, /* alloc */ 0, /* free */ pattr_develop_end_action_parse, 0, /* list_parse */ 0, /* struct_parse */ pattr_develop_end_action_fuzzy, pattr_develop_end_action_convert, generic_enum_is_set, }; void pattr_write(fp, this) output_ty *fp; pattr this; { if (!this) return; trace(("pattr_write(this = %08lX)\n{\n"/*}*/, this)); assert(((pattr)this)->reference_count > 0); trace(("rc = %d;\n", ((pattr)this)->reference_count)); string_write(fp, "description", this->description); boolean_write(fp, "developer_may_review", this->developer_may_review); boolean_write(fp, "developer_may_integrate", this->developer_may_integrate); boolean_write(fp, "reviewer_may_integrate", this->reviewer_may_integrate); boolean_write(fp, "developers_may_create_changes", this->developers_may_create_changes); string_write(fp, "forced_develop_begin_notify_command", this->forced_develop_begin_notify_command); string_write(fp, "develop_end_notify_command", this->develop_end_notify_command); string_write(fp, "develop_end_undo_notify_command", this->develop_end_undo_notify_command); string_write(fp, "review_begin_notify_command", this->review_begin_notify_command); string_write(fp, "review_begin_undo_notify_command", this->review_begin_undo_notify_command); string_write(fp, "review_pass_notify_command", this->review_pass_notify_command); string_write(fp, "review_pass_undo_notify_command", this->review_pass_undo_notify_command); string_write(fp, "review_fail_notify_command", this->review_fail_notify_command); string_write(fp, "integrate_pass_notify_command", this->integrate_pass_notify_command); string_write(fp, "integrate_fail_notify_command", this->integrate_fail_notify_command); string_write(fp, "default_development_directory", this->default_development_directory); integer_write(fp, "umask", this->umask); boolean_write(fp, "default_test_exemption", this->default_test_exemption); pattr_copyright_years_list_write(fp, "copyright_years", this->copyright_years); integer_write(fp, "minimum_change_number", this->minimum_change_number); boolean_write(fp, "reuse_change_numbers", this->reuse_change_numbers); integer_write(fp, "minimum_branch_number", this->minimum_branch_number); boolean_write(fp, "skip_unlucky", this->skip_unlucky); boolean_write(fp, "compress_database", this->compress_database); pattr_develop_end_action_write(fp, "develop_end_action", this->develop_end_action); trace((/*{*/"}\n")); } static void *pattr_alloc _((void)); static void * pattr_alloc() { pattr this; trace(("pattr_alloc()\n{\n"/*}*/)); this = mem_alloc(sizeof(struct pattr)); this->reference_count = 1; this->mask = 0; this->description = 0; this->developer_may_review = 0; this->developer_may_integrate = 0; this->reviewer_may_integrate = 0; this->developers_may_create_changes = 0; this->forced_develop_begin_notify_command = 0; this->develop_end_notify_command = 0; this->develop_end_undo_notify_command = 0; this->review_begin_notify_command = 0; this->review_begin_undo_notify_command = 0; this->review_pass_notify_command = 0; this->review_pass_undo_notify_command = 0; this->review_fail_notify_command = 0; this->integrate_pass_notify_command = 0; this->integrate_fail_notify_command = 0; this->default_development_directory = 0; this->umask = 0; this->default_test_exemption = 0; this->copyright_years = 0; this->minimum_change_number = 0; this->reuse_change_numbers = 0; this->minimum_branch_number = 0; this->skip_unlucky = 0; this->compress_database = 0; this->develop_end_action = 0; trace(("return %08lX;\n", (long)this)); trace((/*{*/"}\n")); return this; } pattr pattr_copy(this) pattr this; { trace(("pattr_copy()\n{\n"/*}*/)); this->reference_count++; trace(("return %08lX;\n", (long)this)); trace((/*{*/"}\n")); return this; } static void pattr_free _((void *)); static void pattr_free(that) void *that; { pattr this = that; if (!this) return; this->reference_count--; assert(this->reference_count >= 0); if (this->reference_count > 0) return; trace(("pattr_free(this = %08lX)\n{\n"/*}*/, (long)this)); str_free(this->description); str_free(this->forced_develop_begin_notify_command); str_free(this->develop_end_notify_command); str_free(this->develop_end_undo_notify_command); str_free(this->review_begin_notify_command); str_free(this->review_begin_undo_notify_command); str_free(this->review_pass_notify_command); str_free(this->review_pass_undo_notify_command); str_free(this->review_fail_notify_command); str_free(this->integrate_pass_notify_command); str_free(this->integrate_fail_notify_command); str_free(this->default_development_directory); pattr_copyright_years_list_free(this->copyright_years); mem_free(this); trace((/*{*/"}\n")); } static type_table_ty pattr_table[] = { { "description", offsetof(struct pattr, description), &string_type, pattr_description_mask, }, { "developer_may_review", offsetof(struct pattr, developer_may_review), &boolean_type, pattr_developer_may_review_mask, }, { "developer_may_integrate", offsetof(struct pattr, developer_may_integrate), &boolean_type, pattr_developer_may_integrate_mask, }, { "reviewer_may_integrate", offsetof(struct pattr, reviewer_may_integrate), &boolean_type, pattr_reviewer_may_integrate_mask, }, { "developers_may_create_changes", offsetof(struct pattr, developers_may_create_changes), &boolean_type, pattr_developers_may_create_changes_mask, }, { "forced_develop_begin_notify_command", offsetof(struct pattr, forced_develop_begin_notify_command), &string_type, pattr_forced_develop_begin_notify_command_mask, }, { "develop_end_notify_command", offsetof(struct pattr, develop_end_notify_command), &string_type, pattr_develop_end_notify_command_mask, }, { "develop_end_undo_notify_command", offsetof(struct pattr, develop_end_undo_notify_command), &string_type, pattr_develop_end_undo_notify_command_mask, }, { "review_begin_notify_command", offsetof(struct pattr, review_begin_notify_command), &string_type, pattr_review_begin_notify_command_mask, }, { "review_begin_undo_notify_command", offsetof(struct pattr, review_begin_undo_notify_command), &string_type, pattr_review_begin_undo_notify_command_mask, }, { "review_pass_notify_command", offsetof(struct pattr, review_pass_notify_command), &string_type, pattr_review_pass_notify_command_mask, }, { "review_pass_undo_notify_command", offsetof(struct pattr, review_pass_undo_notify_command), &string_type, pattr_review_pass_undo_notify_command_mask, }, { "review_fail_notify_command", offsetof(struct pattr, review_fail_notify_command), &string_type, pattr_review_fail_notify_command_mask, }, { "integrate_pass_notify_command", offsetof(struct pattr, integrate_pass_notify_command), &string_type, pattr_integrate_pass_notify_command_mask, }, { "integrate_fail_notify_command", offsetof(struct pattr, integrate_fail_notify_command), &string_type, pattr_integrate_fail_notify_command_mask, }, { "default_development_directory", offsetof(struct pattr, default_development_directory), &string_type, pattr_default_development_directory_mask, }, { "umask", offsetof(struct pattr, umask), &integer_type, pattr_umask_mask, }, { "default_test_exemption", offsetof(struct pattr, default_test_exemption), &boolean_type, pattr_default_test_exemption_mask, }, { "copyright_years", offsetof(struct pattr, copyright_years), &pattr_copyright_years_list_type, pattr_copyright_years_mask, }, { "minimum_change_number", offsetof(struct pattr, minimum_change_number), &integer_type, pattr_minimum_change_number_mask, }, { "reuse_change_numbers", offsetof(struct pattr, reuse_change_numbers), &boolean_type, pattr_reuse_change_numbers_mask, }, { "minimum_branch_number", offsetof(struct pattr, minimum_branch_number), &integer_type, pattr_minimum_branch_number_mask, }, { "skip_unlucky", offsetof(struct pattr, skip_unlucky), &boolean_type, pattr_skip_unlucky_mask, }, { "compress_database", offsetof(struct pattr, compress_database), &boolean_type, pattr_compress_database_mask, }, { "develop_end_action", offsetof(struct pattr, develop_end_action), &pattr_develop_end_action_type, pattr_develop_end_action_mask, }, }; static void *pattr_parse _((void *, string_ty *, type_ty **, unsigned long *)); static void * pattr_parse(this, name, type_pp, mask_p) void *this; string_ty *name; type_ty **type_pp; unsigned long *mask_p; { void *addr; trace(("pattr_parse(this = %08lX, name = %08lX, type_pp = %08lX)\n{\n"/*}*/, (long)this, (long)name, (long)type_pp)); assert(((pattr)this)->reference_count > 0); assert(sizeof(pattr) == sizeof(generic_struct_ty *)); addr = generic_struct_parse ( this, name, type_pp, mask_p, pattr_table, SIZEOF(pattr_table) ); trace((/*{*/"return %08lX;\n}\n", (long)addr)); return addr; } static string_ty *pattr_fuzzy _((string_ty *)); static string_ty * pattr_fuzzy(name) string_ty *name; { string_ty *result; trace(("pattr_fuzzy(name = %08lX)\n{\n"/*}*/, (long)name)); result = generic_struct_fuzzy ( name, pattr_table, SIZEOF(pattr_table) ); trace(("return %08lX;\n", (long)result)); trace((/*{*/"}\n")); return result; } static struct rpt_value_ty *pattr_convert _((void *)); static struct rpt_value_ty * pattr_convert(this) void *this; { struct rpt_value_ty *result; trace(("pattr_convert(name = %08lX)\n{\n"/*}*/, (long)this)); assert(((pattr)this)->reference_count > 0); result = generic_struct_convert ( this, pattr_table, SIZEOF(pattr_table) ); trace(("return %08lX;\n", (long)result)); trace((/*{*/"}\n")); return result; } type_ty pattr_type = { "pattr", pattr_alloc, pattr_free, 0, /* enum_parse */ 0, /* list_parse */ pattr_parse, pattr_fuzzy, pattr_convert, generic_struct_is_set, }; pattr pattr_read_file(filename) string_ty *filename; { pattr result; trace(("pattr_read_file(filename = \"%s\")\n{\n"/*}*/, (filename ? filename->str_text : ""))); os_become_must_be_active(); result = parse(filename, &pattr_type); trace(("return %08lX;\n", result)); trace((/*{*/"}\n")); return result; } void pattr_write_file(filename, value, compress) string_ty *filename; pattr value; int compress; { output_ty *fp; trace(("pattr_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); pattr_write(fp, value); type_enum_option_clear(); output_delete(fp); trace((/*{*/"}\n")); } void pattr__rpt_init() { trace(("pattr__rpt_init()\n{\n"/*}*/)); generic_enum__init(pattr_develop_end_action_s, SIZEOF(pattr_develop_end_action_s)); trace((/*{*/"}\n")); }