jdeans289 / icg2

Interface Code Generator 2: Electric Boogaloo
Other
0 stars 2 forks source link

IO and Unit annotations #9

Open jdeans289 opened 1 year ago

jdeans289 commented 1 year ago

An important feature of Trick is being able to mark input/output permissions and unit specifications of each variable in code. Currently, this is done through comments, like so:

double x;                 /**< trick_io(**) trick_units(s) */

We certainly need to support these capabilities and the same method of specification. This shouldn't be difficult to implement. We will need to define and add some kind of object(s) containing these fields and attach it to the "StructMember" and/or "AllocInfo" type (I do need to double check that this is the only way that these permissions are set. Maybe not. I need to review the original design.), and check them appropriately in the visitors.

BUT. I hate that we parse comments and I would like to provide an alternative, probably along with an automatic conversion script.

I haven't put much thought into this yet, but I feel like we could do something clever with C++ attributes.