Opened 12 years ago

Closed 12 years ago

#2133 closed defect (duplicate)

OMEdit: Handling multiple class definitions in one file

Reported by: Per Östlund Owned by: somebody
Priority: high Milestone: 1.9.0
Component: Interactive Environment Version: trunk
Keywords: Cc:

Description

OMEdit allows the user to open a file that contains multiple class definitions, e.g. a file that contains:

model A end A;
model B end B;

Opening such a file simply adds the classes to the top scope. However, if you open one of the classes and save it, then OMEdit overwrites the file and saves only that class. This means that the other classes in the file are lost.

The specification says this however (section 13.2.2.2):

A nonstructured entity [e.g. the file A.mo] shall contain only a stored-definition that defines a class [A] with a name matching the name of the nonstructured entity.

So defining multiple top-level classes in one file is not really allowed, even though both OM and Dymola allows it.

So we should either forbid it completely (but tell the user why), or make sure that OMEdit saves all models in the file.

Change History (2)

comment:1 by Adeel Asghar, 12 years ago

Component: OMEditInteractive Environment
Owner: changed from Adeel Asghar to somebody

Yes, I have already reported this issue,
https://trac.openmodelica.org/OpenModelica/ticket/2122

This should be handled at compiler level instead of inside OMEdit. If its fixed in compiler then all client applications will be happy.

comment:2 by Per Östlund, 12 years ago

Resolution: duplicate
Status: newclosed
Note: See TracTickets for help on using tickets.