Changeset View
Changeset View
Standalone View
Standalone View
source/blender/makesrna/intern/makesrna.c
| Show First 20 Lines • Show All 1,207 Lines • ▼ Show 20 Lines | case PROP_POINTER: { | ||||
| StructRNA *type = (pprop->type) ? rna_find_struct((const char *)pprop->type) : NULL; | StructRNA *type = (pprop->type) ? rna_find_struct((const char *)pprop->type) : NULL; | ||||
| if (type && (type->flag & STRUCT_ID)) { | if (type && (type->flag & STRUCT_ID)) { | ||||
| fprintf(f, " if (value.data) {\n"); | fprintf(f, " if (value.data) {\n"); | ||||
| fprintf(f, " id_lib_extern((ID *)value.data);\n"); | fprintf(f, " id_lib_extern((ID *)value.data);\n"); | ||||
| fprintf(f, " }\n"); | fprintf(f, " }\n"); | ||||
| } | } | ||||
| } | } | ||||
| fprintf(f, " data->%s = value.data;\n", dp->dnaname); | fprintf(f, " data->%s = (%s *)value.data;\n", dp->dnaname, dp->dnatype); | ||||
| } | } | ||||
| fprintf(f, "}\n\n"); | fprintf(f, "}\n\n"); | ||||
| break; | break; | ||||
| } | } | ||||
| default: | default: | ||||
| if (prop->arraydimension) { | if (prop->arraydimension) { | ||||
| if (prop->flag & PROP_DYNAMIC) { | if (prop->flag & PROP_DYNAMIC) { | ||||
| fprintf(f, "void %s(PointerRNA *ptr, const %s values[])\n", func, rna_type_type(prop)); | fprintf(f, "void %s(PointerRNA *ptr, const %s values[])\n", func, rna_type_type(prop)); | ||||
| ▲ Show 20 Lines • Show All 554 Lines • ▼ Show 20 Lines | fprintf(f, | ||||
| rna_safe_id(item_name_prop->identifier)); | rna_safe_id(item_name_prop->identifier)); | ||||
| fprintf(f, " if (strcmp(namebuf, key) == 0) {\n"); | fprintf(f, " if (strcmp(namebuf, key) == 0) {\n"); | ||||
| fprintf(f, " found = true;\n"); | fprintf(f, " found = true;\n"); | ||||
| fprintf(f, " *r_ptr = iter.ptr;\n"); | fprintf(f, " *r_ptr = iter.ptr;\n"); | ||||
| fprintf(f, " break;\n"); | fprintf(f, " break;\n"); | ||||
| fprintf(f, " }\n"); | fprintf(f, " }\n"); | ||||
| fprintf(f, " }\n"); | fprintf(f, " }\n"); | ||||
| fprintf(f, " else {\n"); | fprintf(f, " else {\n"); | ||||
| fprintf(f, " name = MEM_mallocN(namelen+1, \"name string\");\n"); | fprintf(f, " name = (char *)MEM_mallocN(namelen+1, \"name string\");\n"); | ||||
| fprintf(f, | fprintf(f, | ||||
| " %s_%s_get(&iter.ptr, name);\n", | " %s_%s_get(&iter.ptr, name);\n", | ||||
| item_name_base->identifier, | item_name_base->identifier, | ||||
| rna_safe_id(item_name_prop->identifier)); | rna_safe_id(item_name_prop->identifier)); | ||||
| fprintf(f, " if (strcmp(name, key) == 0) {\n"); | fprintf(f, " if (strcmp(name, key) == 0) {\n"); | ||||
| fprintf(f, " MEM_freeN(name);\n\n"); | fprintf(f, " MEM_freeN(name);\n\n"); | ||||
| fprintf(f, " found = true;\n"); | fprintf(f, " found = true;\n"); | ||||
| fprintf(f, " *r_ptr = iter.ptr;\n"); | fprintf(f, " *r_ptr = iter.ptr;\n"); | ||||
| ▲ Show 20 Lines • Show All 101 Lines • ▼ Show 20 Lines | else if (STREQ(dp->dnatype, "double")) { | ||||
| prop->flag_internal |= PROP_INTERN_RAW_ACCESS; | prop->flag_internal |= PROP_INTERN_RAW_ACCESS; | ||||
| } | } | ||||
| } | } | ||||
| static void rna_set_raw_offset(FILE *f, StructRNA *srna, PropertyRNA *prop) | static void rna_set_raw_offset(FILE *f, StructRNA *srna, PropertyRNA *prop) | ||||
| { | { | ||||
| PropertyDefRNA *dp = rna_find_struct_property_def(srna, prop); | PropertyDefRNA *dp = rna_find_struct_property_def(srna, prop); | ||||
| fprintf(f, "\toffsetof(%s, %s), %d", dp->dnastructname, dp->dnaname, prop->rawtype); | fprintf(f, | ||||
| "\toffsetof(%s, %s), RNA_RAWPROPERTYTYPE(%d)", | |||||
| dp->dnastructname, | |||||
| dp->dnaname, | |||||
| prop->rawtype); | |||||
| } | } | ||||
| static void rna_def_property_funcs(FILE *f, StructRNA *srna, PropertyDefRNA *dp) | static void rna_def_property_funcs(FILE *f, StructRNA *srna, PropertyDefRNA *dp) | ||||
| { | { | ||||
| PropertyRNA *prop; | PropertyRNA *prop; | ||||
| prop = dp->prop; | prop = dp->prop; | ||||
| ▲ Show 20 Lines • Show All 1,556 Lines • ▼ Show 20 Lines | static void rna_generate_internal_property_prototypes(BlenderRNA *UNUSED(brna), | ||||
| PropertyRNA *prop; | PropertyRNA *prop; | ||||
| StructRNA *base; | StructRNA *base; | ||||
| base = srna->base; | base = srna->base; | ||||
| while (base) { | while (base) { | ||||
| fprintf(f, "\n"); | fprintf(f, "\n"); | ||||
| for (prop = base->cont.properties.first; prop; prop = prop->next) { | for (prop = base->cont.properties.first; prop; prop = prop->next) { | ||||
| fprintf(f, | fprintf(f, | ||||
| "%s%s rna_%s_%s;\n", | "%s %s rna_%s_%s;\n", | ||||
| "extern ", | "RNA_EXTERN", | ||||
| rna_property_structname(prop->type), | rna_property_structname(prop->type), | ||||
| base->identifier, | base->identifier, | ||||
| prop->identifier); | prop->identifier); | ||||
| } | } | ||||
| base = base->base; | base = base->base; | ||||
| } | } | ||||
| if (srna->cont.properties.first) { | if (srna->cont.properties.first) { | ||||
| fprintf(f, "\n"); | fprintf(f, "\n"); | ||||
| } | } | ||||
| for (prop = srna->cont.properties.first; prop; prop = prop->next) { | for (prop = srna->cont.properties.first; prop; prop = prop->next) { | ||||
| fprintf(f, | fprintf(f, | ||||
| "%s rna_%s_%s;\n", | "%s %s rna_%s_%s;\n", | ||||
| "RNA_EXTERN", | |||||
| rna_property_structname(prop->type), | rna_property_structname(prop->type), | ||||
| srna->identifier, | srna->identifier, | ||||
| prop->identifier); | prop->identifier); | ||||
| } | } | ||||
| fprintf(f, "\n"); | fprintf(f, "\n"); | ||||
| } | } | ||||
| static void rna_generate_parameter_prototypes(BlenderRNA *UNUSED(brna), | static void rna_generate_parameter_prototypes(BlenderRNA *UNUSED(brna), | ||||
| ▲ Show 20 Lines • Show All 545 Lines • ▼ Show 20 Lines | static void rna_generate_property(FILE *f, StructRNA *srna, const char *nest, PropertyRNA *prop) | ||||
| rna_print_c_string(f, prop->name); | rna_print_c_string(f, prop->name); | ||||
| fprintf(f, ",\n\t"); | fprintf(f, ",\n\t"); | ||||
| rna_print_c_string(f, prop->description); | rna_print_c_string(f, prop->description); | ||||
| fprintf(f, ",\n\t"); | fprintf(f, ",\n\t"); | ||||
| fprintf(f, "%d, ", prop->icon); | fprintf(f, "%d, ", prop->icon); | ||||
| rna_print_c_string(f, prop->translation_context); | rna_print_c_string(f, prop->translation_context); | ||||
| fprintf(f, ",\n"); | fprintf(f, ",\n"); | ||||
| fprintf(f, | fprintf(f, | ||||
| "\t%s, %s | %s, %s, %u, {%u, %u, %u}, %u,\n", | "\t%s, RNA_SUBTYPE(%s | %s), %s, %u, {%u, %u, %u}, %u,\n", | ||||
| RNA_property_typename(prop->type), | RNA_property_typename(prop->type), | ||||
| rna_property_subtypename(prop->subtype), | rna_property_subtypename(prop->subtype), | ||||
| rna_property_subtype_unit(prop->subtype), | rna_property_subtype_unit(prop->subtype), | ||||
| rna_function_string(prop->getlength), | rna_function_string(prop->getlength), | ||||
| prop->arraydimension, | prop->arraydimension, | ||||
| prop->arraylength[0], | prop->arraylength[0], | ||||
| prop->arraylength[1], | prop->arraylength[1], | ||||
| prop->arraylength[2], | prop->arraylength[2], | ||||
| prop->totarraylength); | prop->totarraylength); | ||||
| fprintf(f, | fprintf(f, | ||||
| "\t%s%s, %d, %s, %s, %s, %s, %s,\n", | "\t%s%s, %d, %s, %s, %s, %s, %s,\n", | ||||
| (prop->flag & PROP_CONTEXT_UPDATE) ? "(UpdateFunc)" : "", | (prop->flag & PROP_CONTEXT_UPDATE) ? "(UpdateFunc)" : "", | ||||
| rna_function_string(prop->update), | rna_function_string(prop->update), | ||||
| prop->noteflag, | prop->noteflag, | ||||
| rna_function_string(prop->editable), | rna_function_string(prop->editable), | ||||
| rna_function_string(prop->itemeditable), | rna_function_string(prop->itemeditable), | ||||
| rna_function_string(prop->override_diff), | rna_function_string(prop->override_diff), | ||||
| rna_function_string(prop->override_store), | rna_function_string(prop->override_store), | ||||
| rna_function_string(prop->override_apply)); | rna_function_string(prop->override_apply)); | ||||
| if (prop->flag_internal & PROP_INTERN_RAW_ACCESS) { | if (prop->flag_internal & PROP_INTERN_RAW_ACCESS) { | ||||
| rna_set_raw_offset(f, srna, prop); | rna_set_raw_offset(f, srna, prop); | ||||
| } | } | ||||
| else { | else { | ||||
| fprintf(f, "\t0, -1"); | fprintf(f, "\t0, RNA_RAWPROPERTYTYPE(-1)"); | ||||
| } | } | ||||
| /* our own type - collections/arrays only */ | /* our own type - collections/arrays only */ | ||||
| if (prop->srna) { | if (prop->srna) { | ||||
| fprintf(f, ", &RNA_%s", (const char *)prop->srna); | fprintf(f, ", &RNA_%s", (const char *)prop->srna); | ||||
| } | } | ||||
| else { | else { | ||||
| fprintf(f, ", NULL"); | fprintf(f, ", NULL"); | ||||
| Show All 32 Lines | case PROP_INT: { | ||||
| rna_function_string(iprop->getarray), | rna_function_string(iprop->getarray), | ||||
| rna_function_string(iprop->setarray), | rna_function_string(iprop->setarray), | ||||
| rna_function_string(iprop->range), | rna_function_string(iprop->range), | ||||
| rna_function_string(iprop->get_ex), | rna_function_string(iprop->get_ex), | ||||
| rna_function_string(iprop->set_ex), | rna_function_string(iprop->set_ex), | ||||
| rna_function_string(iprop->getarray_ex), | rna_function_string(iprop->getarray_ex), | ||||
| rna_function_string(iprop->setarray_ex), | rna_function_string(iprop->setarray_ex), | ||||
| rna_function_string(iprop->range_ex)); | rna_function_string(iprop->range_ex)); | ||||
| fprintf(f, "RNA_PROPERTYSCALETYPE("); | |||||
| rna_int_print(f, iprop->ui_scale_type); | rna_int_print(f, iprop->ui_scale_type); | ||||
| fprintf(f, ")"); | |||||
| fprintf(f, ", "); | fprintf(f, ", "); | ||||
| rna_int_print(f, iprop->softmin); | rna_int_print(f, iprop->softmin); | ||||
| fprintf(f, ", "); | fprintf(f, ", "); | ||||
| rna_int_print(f, iprop->softmax); | rna_int_print(f, iprop->softmax); | ||||
| fprintf(f, ", "); | fprintf(f, ", "); | ||||
| rna_int_print(f, iprop->hardmin); | rna_int_print(f, iprop->hardmin); | ||||
| fprintf(f, ", "); | fprintf(f, ", "); | ||||
| rna_int_print(f, iprop->hardmax); | rna_int_print(f, iprop->hardmax); | ||||
| Show All 19 Lines | case PROP_FLOAT: { | ||||
| rna_function_string(fprop->getarray), | rna_function_string(fprop->getarray), | ||||
| rna_function_string(fprop->setarray), | rna_function_string(fprop->setarray), | ||||
| rna_function_string(fprop->range), | rna_function_string(fprop->range), | ||||
| rna_function_string(fprop->get_ex), | rna_function_string(fprop->get_ex), | ||||
| rna_function_string(fprop->set_ex), | rna_function_string(fprop->set_ex), | ||||
| rna_function_string(fprop->getarray_ex), | rna_function_string(fprop->getarray_ex), | ||||
| rna_function_string(fprop->setarray_ex), | rna_function_string(fprop->setarray_ex), | ||||
| rna_function_string(fprop->range_ex)); | rna_function_string(fprop->range_ex)); | ||||
| fprintf(f, "RNA_PROPERTYSCALETYPE("); | |||||
| rna_float_print(f, fprop->ui_scale_type); | rna_float_print(f, fprop->ui_scale_type); | ||||
| fprintf(f, ")"); | |||||
| fprintf(f, ", "); | fprintf(f, ", "); | ||||
| rna_float_print(f, fprop->softmin); | rna_float_print(f, fprop->softmin); | ||||
| fprintf(f, ", "); | fprintf(f, ", "); | ||||
| rna_float_print(f, fprop->softmax); | rna_float_print(f, fprop->softmax); | ||||
| fprintf(f, ", "); | fprintf(f, ", "); | ||||
| rna_float_print(f, fprop->hardmin); | rna_float_print(f, fprop->hardmin); | ||||
| fprintf(f, ", "); | fprintf(f, ", "); | ||||
| rna_float_print(f, fprop->hardmax); | rna_float_print(f, fprop->hardmax); | ||||
| Show All 10 Lines | case PROP_FLOAT: { | ||||
| else { | else { | ||||
| fprintf(f, "NULL\n"); | fprintf(f, "NULL\n"); | ||||
| } | } | ||||
| break; | break; | ||||
| } | } | ||||
| case PROP_STRING: { | case PROP_STRING: { | ||||
| StringPropertyRNA *sprop = (StringPropertyRNA *)prop; | StringPropertyRNA *sprop = (StringPropertyRNA *)prop; | ||||
| fprintf(f, | fprintf(f, | ||||
| "\t%s, %s, %s, %s, %s, %s, %s, %d, %d, ", | "\t%s, %s, %s, %s, %s, %s, %s, RNA_STRINGPROPERTYSEARCHFLAG(%d), %d, ", | ||||
| rna_function_string(sprop->get), | rna_function_string(sprop->get), | ||||
| rna_function_string(sprop->length), | rna_function_string(sprop->length), | ||||
| rna_function_string(sprop->set), | rna_function_string(sprop->set), | ||||
| rna_function_string(sprop->get_ex), | rna_function_string(sprop->get_ex), | ||||
| rna_function_string(sprop->length_ex), | rna_function_string(sprop->length_ex), | ||||
| rna_function_string(sprop->set_ex), | rna_function_string(sprop->set_ex), | ||||
| rna_function_string(sprop->search), | rna_function_string(sprop->search), | ||||
| (int)sprop->search_flag, | (int)sprop->search_flag, | ||||
| ▲ Show 20 Lines • Show All 333 Lines • ▼ Show 20 Lines | static RNAProcessItem PROCESS_ITEMS[] = { | ||||
| {"rna_pose.c", "rna_pose_api.c", RNA_def_pose}, | {"rna_pose.c", "rna_pose_api.c", RNA_def_pose}, | ||||
| {"rna_curveprofile.c", NULL, RNA_def_profile}, | {"rna_curveprofile.c", NULL, RNA_def_profile}, | ||||
| {"rna_lightprobe.c", NULL, RNA_def_lightprobe}, | {"rna_lightprobe.c", NULL, RNA_def_lightprobe}, | ||||
| {"rna_render.c", NULL, RNA_def_render}, | {"rna_render.c", NULL, RNA_def_render}, | ||||
| {"rna_rigidbody.c", NULL, RNA_def_rigidbody}, | {"rna_rigidbody.c", NULL, RNA_def_rigidbody}, | ||||
| {"rna_scene.c", "rna_scene_api.c", RNA_def_scene}, | {"rna_scene.c", "rna_scene_api.c", RNA_def_scene}, | ||||
| {"rna_screen.c", NULL, RNA_def_screen}, | {"rna_screen.c", NULL, RNA_def_screen}, | ||||
| {"rna_sculpt_paint.c", NULL, RNA_def_sculpt_paint}, | {"rna_sculpt_paint.c", NULL, RNA_def_sculpt_paint}, | ||||
| {"rna_sequencer.c", "rna_sequencer_api.c", RNA_def_sequencer}, | {"rna_sequencer.cc", "rna_sequencer_api.cc", RNA_def_sequencer}, | ||||
| #ifdef WITH_SIMULATION_DATABLOCK | #ifdef WITH_SIMULATION_DATABLOCK | ||||
| {"rna_simulation.c", NULL, RNA_def_simulation}, | {"rna_simulation.c", NULL, RNA_def_simulation}, | ||||
| #endif | #endif | ||||
| {"rna_space.c", "rna_space_api.c", RNA_def_space}, | {"rna_space.c", "rna_space_api.c", RNA_def_space}, | ||||
| {"rna_speaker.c", NULL, RNA_def_speaker}, | {"rna_speaker.c", NULL, RNA_def_speaker}, | ||||
| {"rna_test.c", NULL, RNA_def_test}, | {"rna_test.c", NULL, RNA_def_test}, | ||||
| {"rna_text.c", "rna_text_api.c", RNA_def_text}, | {"rna_text.c", "rna_text_api.c", RNA_def_text}, | ||||
| {"rna_timeline.c", NULL, RNA_def_timeline_marker}, | {"rna_timeline.c", NULL, RNA_def_timeline_marker}, | ||||
| {"rna_sound.c", "rna_sound_api.c", RNA_def_sound}, | {"rna_sound.cc", "rna_sound_api.c", RNA_def_sound}, | ||||
| {"rna_ui.c", "rna_ui_api.c", RNA_def_ui}, | {"rna_ui.c", "rna_ui_api.c", RNA_def_ui}, | ||||
| {"rna_userdef.c", NULL, RNA_def_userdef}, | {"rna_userdef.c", NULL, RNA_def_userdef}, | ||||
| {"rna_vfont.c", "rna_vfont_api.c", RNA_def_vfont}, | {"rna_vfont.c", "rna_vfont_api.c", RNA_def_vfont}, | ||||
| {"rna_volume.c", NULL, RNA_def_volume}, | {"rna_volume.c", NULL, RNA_def_volume}, | ||||
| {"rna_wm.c", "rna_wm_api.c", RNA_def_wm}, | {"rna_wm.c", "rna_wm_api.c", RNA_def_wm}, | ||||
| {"rna_wm_gizmo.c", "rna_wm_gizmo_api.c", RNA_def_wm_gizmo}, | {"rna_wm_gizmo.c", "rna_wm_gizmo_api.c", RNA_def_wm_gizmo}, | ||||
| {"rna_workspace.c", "rna_workspace_api.c", RNA_def_workspace}, | {"rna_workspace.c", "rna_workspace_api.c", RNA_def_workspace}, | ||||
| {"rna_world.c", NULL, RNA_def_world}, | {"rna_world.c", NULL, RNA_def_world}, | ||||
| Show All 34 Lines | static void rna_generate(BlenderRNA *brna, FILE *f, const char *filename, const char *api_filename) | ||||
| fprintf(f, "#include \"BKE_context.h\"\n"); | fprintf(f, "#include \"BKE_context.h\"\n"); | ||||
| fprintf(f, "#include \"BKE_lib_id.h\"\n"); | fprintf(f, "#include \"BKE_lib_id.h\"\n"); | ||||
| fprintf(f, "#include \"BKE_main.h\"\n"); | fprintf(f, "#include \"BKE_main.h\"\n"); | ||||
| fprintf(f, "#include \"BKE_report.h\"\n"); | fprintf(f, "#include \"BKE_report.h\"\n"); | ||||
| fprintf(f, "#include \"RNA_define.h\"\n"); | fprintf(f, "#include \"RNA_define.h\"\n"); | ||||
| fprintf(f, "#include \"RNA_types.h\"\n"); | fprintf(f, "#include \"RNA_types.h\"\n"); | ||||
| fprintf(f, "#include \"rna_internal.h\"\n\n"); | fprintf(f, "#include \"rna_internal.h\"\n\n"); | ||||
| fprintf(f, "#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n"); | |||||
| /* include the generated prototypes header */ | /* include the generated prototypes header */ | ||||
| fprintf(f, "#include \"rna_prototypes_gen.h\"\n\n"); | fprintf(f, "#include \"rna_prototypes_gen.h\"\n\n"); | ||||
| fprintf(f, "#ifdef __cplusplus\n}\n#endif\n\n"); | |||||
| if (filename) { | if (filename) { | ||||
| fprintf(f, "#include \"%s\"\n", filename); | fprintf(f, "#include \"%s\"\n", filename); | ||||
| } | } | ||||
| if (api_filename) { | if (api_filename) { | ||||
| fprintf(f, "#include \"%s\"\n", api_filename); | fprintf(f, "#include \"%s\"\n", api_filename); | ||||
| } | } | ||||
| fprintf(f, "\n"); | fprintf(f, "\n"); | ||||
| /* we want the included C files to have warnings enabled but for the generated code | /* we want the included C files to have warnings enabled but for the generated code | ||||
| * ignore unused-parameter warnings which are hard to prevent */ | * ignore unused-parameter warnings which are hard to prevent */ | ||||
| #if defined(__GNUC__) || defined(__clang__) | #if defined(__GNUC__) || defined(__clang__) | ||||
| fprintf(f, "#pragma GCC diagnostic ignored \"-Wunused-parameter\"\n\n"); | fprintf(f, "#pragma GCC diagnostic ignored \"-Wunused-parameter\"\n\n"); | ||||
| #endif | #endif | ||||
| fprintf(f, "/* Auto-generated Functions. */\n\n"); | fprintf(f, "/* Auto-generated Functions. */\n\n"); | ||||
| fprintf(f, "#ifdef __cplusplus\n"); | |||||
| fprintf(f, "# define RNA_EXTERN extern \"C\"\n"); | |||||
| fprintf(f, "# define RNA_SUBTYPE(x) PropertySubType(x)\n"); | |||||
| fprintf(f, "# define RNA_RAWPROPERTYTYPE(x) RawPropertyType(x)\n"); | |||||
| fprintf(f, "# define RNA_PROPERTYSCALETYPE(x) PropertyScaleType(x)\n"); | |||||
campbellbarton: Not sure this is worth wrapping each cast with a define, couldn't C-style casts be used for… | |||||
| fprintf(f, "# define RNA_STRINGPROPERTYSEARCHFLAG(x) eStringPropertySearchFlag(x)\n"); | |||||
| fprintf(f, "#else\n"); | |||||
| fprintf(f, "# define RNA_EXTERN extern\n"); | |||||
| fprintf(f, "# define RNA_SUBTYPE(x) (x)\n"); | |||||
| fprintf(f, "# define RNA_RAWPROPERTYTYPE(x) (x)\n"); | |||||
| fprintf(f, "# define RNA_PROPERTYSCALETYPE(x) (x)\n"); | |||||
Done Inline Actions*picky*, use (x) instead of x, to avoid accidents. campbellbarton: *picky*, use `(x)` instead of `x`, to avoid accidents. | |||||
| fprintf(f, "# define RNA_STRINGPROPERTYSEARCHFLAG(x) (x)\n"); | |||||
| fprintf(f, "#endif\n"); | |||||
| for (ds = DefRNA.structs.first; ds; ds = ds->cont.next) { | for (ds = DefRNA.structs.first; ds; ds = ds->cont.next) { | ||||
| if (!filename || ds->filename == filename) { | if (!filename || ds->filename == filename) { | ||||
| rna_generate_internal_property_prototypes(brna, ds->srna, f); | rna_generate_internal_property_prototypes(brna, ds->srna, f); | ||||
| rna_generate_function_prototypes(brna, ds->srna, f); | rna_generate_function_prototypes(brna, ds->srna, f); | ||||
| } | } | ||||
| } | } | ||||
| for (ds = DefRNA.structs.first; ds; ds = ds->cont.next) { | for (ds = DefRNA.structs.first; ds; ds = ds->cont.next) { | ||||
| ▲ Show 20 Lines • Show All 709 Lines • ▼ Show 20 Lines | else { | ||||
| fclose(file); | fclose(file); | ||||
| status = (DefRNA.error != 0); | status = (DefRNA.error != 0); | ||||
| } | } | ||||
| /* create rna_gen_*.c files */ | /* create rna_gen_*.c files */ | ||||
| for (i = 0; PROCESS_ITEMS[i].filename; i++) { | for (i = 0; PROCESS_ITEMS[i].filename; i++) { | ||||
| strcpy(deffile, outfile); | strcpy(deffile, outfile); | ||||
| strcat(deffile, PROCESS_ITEMS[i].filename); | strcat(deffile, PROCESS_ITEMS[i].filename); | ||||
| const bool is_cpp_file = (deffile[strlen(deffile) - 1] == 'c' && | |||||
| deffile[strlen(deffile) - 2] == 'c'); | |||||
| if (is_cpp_file) { | |||||
| deffile[strlen(deffile) - 3] = '\0'; | |||||
| strcat(deffile, "_gen.cc" TMP_EXT); | |||||
| } | |||||
| else { | |||||
| deffile[strlen(deffile) - 2] = '\0'; | deffile[strlen(deffile) - 2] = '\0'; | ||||
| strcat(deffile, "_gen.c" TMP_EXT); | strcat(deffile, "_gen.c" TMP_EXT); | ||||
| } | |||||
| if (status) { | if (status) { | ||||
| make_bad_file(deffile, __LINE__); | make_bad_file(deffile, __LINE__); | ||||
| } | } | ||||
| else { | else { | ||||
| file = fopen(deffile, "w"); | file = fopen(deffile, "w"); | ||||
| if (!file) { | if (!file) { | ||||
| ▲ Show 20 Lines • Show All 108 Lines • Show Last 20 Lines | |||||
Not sure this is worth wrapping each cast with a define, couldn't C-style casts be used for both?