Opened 12 years ago

Closed 12 years ago

Last modified 12 years ago

#2252 closed enhancement (fixed)

OMEdit: compiler (omc) flags

Reported by: Lennart Ochel Owned by: Adeel Asghar
Priority: high Milestone: 1.9.0
Component: OMEdit Version: trunk
Keywords: Cc: Per Östlund

Description

I would like to pass flags to omc using OMEdit. I guess this is not possible in the current version. There is only the possibility to pass flags to the gcc, right? Can we add also this feature for omc flags?

Change History (11)

comment:1 by Lennart Ochel, 12 years ago

It would be reasonable if Tools -> Options -> Simulation contains an additional item that allows me to set debug flag, which will be uesed for the entire session.

comment:2 by Adeel Asghar, 12 years ago

From r16503 you can set the OMC flags via Tools->Options->Simulation. The only bad thing is that the options that are set can not be cleared.

It would be great if setCommandLineOptions can also clear the flags e.g,

setCommandLineOptions("")

should set all the flags to default values OR we can add a new API,

clearCommandLineOptions()

I am keeping this ticket open until we fix it properly.

comment:3 by Lennart Ochel, 12 years ago

Yes, I was aware of that. Anyway, it is great that we can set those flags now.

comment:4 by Adrian Pop, 12 years ago

Cc: Per Östlund added

Adding Per to CC as he implemented most of the flags infrastructure so maybe he has some pointers.

in reply to:  4 comment:5 by Per Östlund, 12 years ago

Replying to adrpo:

Adding Per to CC as he implemented most of the flags infrastructure so maybe he has some pointers.

I'll add some API commands to clear flags, it's easy to implement.

comment:6 by Adrian Pop, 12 years ago

Thanks Per.
I think in addition to clearing flags we should also have some way of storing/restoring a state of the flags.
There are several ways of doing this. One is to save the flags internally (in a stack for flags state):

saveFlags();
// do whatever
restoreFlags();

Another way is to get all the flags state and save it in a local variable or externally:

x = getFlagsSatus()
// do whatever
setFlagsStatus(x);

Here x could be an list of "flag",flagState.

I really don't have any idea which might be better. Any comments?

comment:7 by Per Östlund, 12 years ago

clearCommandLineOptions has now been added in r16504. I reorganized the flag code a bit, so we now have Flags.resetConfigFlags and Flags.resetDebugFlags, and clearCommandLineOptions simply call those two. But if anyone wants to implement an API call that only resets one kind of flag it's trivial to do so now.

comment:8 by Adrian Pop, 12 years ago

I think is OK for now. We'll see if we need save/restore later on.

comment:9 by Adeel Asghar, 12 years ago

Resolution: fixed
Status: newclosed

Fixed in r16511. Thanks to Per for adding the clearCommandLineOptions API.

comment:10 by Lennart Ochel, 12 years ago

If I remove the flags and restart OMEdit again, they are still there. Is this a bug? … or do I not know how to use this new feature proper.
If we have this set/clear functionality, we should include it in the simulation dialogue (as new tab) the same way as for simulation flags. This would be much smarter in the case of enabling/disabling some flags for the same model again and again … Also we should provide some checkboxes for the most important flags. (But not too much, because this can be confusing. I guess, we should also remove some flags from the simulation flag dialogue. But we can discuss this in the next OMDev meeting.)
But, probably we should keep this functionality also in the Tools -> Options -> Simulation window, because we may use some flags for instantiateModel as well.

comment:11 by Adeel Asghar, 12 years ago

I think I made mistake earlier. Try r16513.
Yes, we can discuss more about it in the next meeting.

Note: See TracTickets for help on using tickets.