Changeset 13858


Ignore:
Timestamp:
Oct 25, 2019 1:23:39 PM (4 weeks ago)
Author:
jwedin
Message:

Updated a JUnit test. Updated a method for code generation to use a consistent printing style. Renamed jmi_destruct_external_objs to model_destruct_external_objects to avoid confusion with jmi_destruct_external_objects. #5863

Location:
branches/dev-cw-2613
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • branches/dev-cw-2613/Compiler/ModelicaCBackEnd/src/jastadd/CCodeGen/CCodeGenGlobals.jrag

    r13830 r13858  
    545545            String strName = v.type().name() + ".destructor";
    546546            FCallable c = getName().lookupFCallable(strName);
    547             str.formatln("%sif (%s != NULL) {", indent, FExp.global_C(v.nameUnderscore()));
    548             str.print(indent, c.funcNameUnderscore(C_SUFFIX_DEF), "(", FExp.global_C(v.nameUnderscore()), ");\n");
    549             str.formatln("%s%s = NULL;", p.indent(indent), FExp.global_C(v.nameUnderscore()));
    550             str.formatln("%s}", indent);
     547            str.print(indent, "if (", FExp.global_C(v.nameUnderscore()), " != NULL) {\n");
     548            str.print(p.indent(indent), c.funcNameUnderscore(C_SUFFIX_DEF), "(", FExp.global_C(v.nameUnderscore()), ");\n");
     549            str.print(p.indent(indent), FExp.global_C(v.nameUnderscore()), " = NULL;\n");
     550            str.print(indent, "}");
    551551        }
    552552    }
  • branches/dev-cw-2613/Compiler/ModelicaCBackEnd/templates/FMIBase/base.c

    r12878 r13858  
    183183}
    184184
    185 int jmi_destruct_external_objs(jmi_t* jmi) {
     185int model_destruct_external_objects(jmi_t* jmi) {
    186186$C_destruct_external_object$
    187187    return 0;
  • branches/dev-cw-2613/Compiler/ModelicaCBackEnd/test/modelica/CCodeGenGlobalsTests.mo

    r13491 r13858  
    13771377    jmi_extobj_t CCodeGenGlobalsTests_GlobalVariables_GlobalConstantExternalObject1_P_eo1;
    13781378
     1379
    13791380jmi_extobj_t jmi_global_tmp_1(jmi_t* jmi) {
    13801381    JMI_DYNAMIC_INIT()
     
    13891390    return tmp_1;
    13901391}
    1391 
    13921392int model_init_eval_independent_globals_0(jmi_t* jmi) {
    13931393    int ef = 0;
     
    14501450
    14511451
    1452     func_CCodeGenGlobalsTests_GlobalVariables_GlobalConstantExternalObject1_P_EO_destructor_def1(JMI_GLOBAL(CCodeGenGlobalsTests_GlobalVariables_GlobalConstantExternalObject1_P_eo));
     1452    if (JMI_GLOBAL(CCodeGenGlobalsTests_GlobalVariables_GlobalConstantExternalObject1_P_eo) != NULL) {
     1453        func_CCodeGenGlobalsTests_GlobalVariables_GlobalConstantExternalObject1_P_EO_destructor_def1(JMI_GLOBAL(CCodeGenGlobalsTests_GlobalVariables_GlobalConstantExternalObject1_P_eo));
     1454        JMI_GLOBAL(CCodeGenGlobalsTests_GlobalVariables_GlobalConstantExternalObject1_P_eo) = NULL;
     1455    }
    14531456")})));
    14541457end GlobalConstantExternalObject1;
  • branches/dev-cw-2613/RuntimeLibrary/src/jmi/jmi.c

    r12796 r13858  
    607607
    608608int jmi_destruct_external_objects(jmi_t* jmi) {
    609     return jmi_generic_func(jmi, jmi_destruct_external_objs);
     609    return jmi_generic_func(jmi, model_destruct_external_objects);
    610610}
    611611
  • branches/dev-cw-2613/RuntimeLibrary/src/jmi/jmi.h

    r11759 r13858  
    512512 * @return Error code.
    513513 */
    514 int jmi_destruct_external_objs(jmi_t* jmi);
     514int model_destruct_external_objects(jmi_t* jmi);
    515515
    516516/**
     
    637637 * \brief Destroys external objects
    638638 */
    639 int jmi_destruct_external_objects(jmi_t* jmi);
     639int model_destruct_external_objects(jmi_t* jmi);
    640640
    641641/* Sample delay blocks
Note: See TracChangeset for help on using the changeset viewer.