mirror of
https://github.com/nasa/trick.git
synced 2024-12-24 07:16:41 +00:00
f2e93ac490
* Fix for assigning to non-existent variables (#1708) This fix modifies Trick's convert_swig script. It adds a directive to not accept dynamic attributes. The directive will ensure that modelers do not assign to non-existent parameter in their input files. The prior fix (issues #1288 and/or #1603) did not cover C structures, so this commit is really an addendum to that fix. With this commit, the convert_swig script will generate a non-dynamic directive foreach class and structure. This fix also stops generating swig interface code for typedef structure definitions since swig only produces an interface to the actual typedef name. For example, with this typedef: typedef struct StructureName { double main_engine_thrust; /* N Thrust of main engine */ struct StructureName* next; /* ** Next pointer */ } TypeDefName; swig creates an interface for "TypeDefName", and not "StructureName", so there is no need for Trick to produce anything in regards "StructureName". * Fix for issue with classes defined in ifndef SWIG block convert_swig takes in the raw header and does no preprocessing, so blocks of c/c++ header code which are meant to be skipped by Swig are processed by convert_swig. This causes an issue with the generated python code that try to access classes that are ifndef SWIGed out. To fix this, check for class existence in the generated python code e.g: if 'MomMom' in globals(): MomMom.__setattr__ = _swig_setattr_nondynamic_instance_variable(object.__setattr__) * Fix for assignment to swig_double and swig_int primitives The previous commit(s) on this branch fixed bad assignments like (misspell position an attribute of BSTATE_IN): ball.state.input.positiaaaan = 4.0 This commit fixes bad assignments to leaf/primitive attributes like (try to add attribute to primitive/leaf double type): ball.state.input.position.fred = 4.0 * Moved _swig_setattr_nondynamic_instance_variable to right after each class in process_class and removed duplicate _swig_setattr_nondynamic_instance_variable blocks for classes that are not in a namespace. * Add the call for __setattr__ for class templates. --------- Co-authored-by: Hong Chen <hong.chen-1@nasa.gov> |
||
---|---|---|
.. | ||
codegen/Interface_Code_Gen | ||
data_products | ||
er7_utils | ||
java | ||
sim_services | ||
trick_swig | ||
trick_utils | ||
web | ||
.gitignore |