Opened 12 years ago

Closed 12 years ago

Last modified 12 years ago

#2043 closed defect (fixed)

NFSCodeDependency fails on Modelica_DeviceDrivers

Reported by: Martin Sjölund Owned by: Per Östlund
Priority: high Milestone: 1.9.0
Component: Frontend Version: trunk
Keywords: Cc:

Description

NFSCodeDependency fails on:

loadModel(Modelica_DeviceDrivers);getErrorString();
instantiateModel(Modelica_DeviceDrivers.Blocks.Examples.TestSerialPackager_UDP);getErrorString();

No error message indicates what goes wrong.

Library: https://www.modelica.org/libraries/modelica_devicedrivers
Note: Remove package.order files and rename 2 file to make the package parse

From the forums

Change History (4)

comment:1 by Per Östlund, 12 years ago

Resolution: fixed
Status: newclosed

The library is not correct. The class Packaging.SerialPackager extends from ExternalObject, but it also extends from Utilities.Icons.PackagerIcon as well as having ~20 functions besides the constructor and destructor. The specification states:

An external object class shall be directly extended from ExternalObject, shall have exactly two function
definitions, called "constructor" and "destructor", and shall not contain other elements.

So this class, which is used by the example, is a very illegal external object. The dependency analysis didn't handle this gracefully though, the external object checking didn't handle extends clauses. I have fixed this in r15038, so now you get an error instead:

Modelica_DeviceDrivers/Packaging/SerialPackager.mo:2:1-193:19:writable] Error: Invalid external object Modelica_DeviceDrivers.Packaging.SerialPackager, contains invalid elements: extends Modelica_DeviceDrivers.Utilities.Icons.PackagerIcon, addReal, addInteger, addString, addBoolean, setPackage, setPos, getPackage, getPos, getReal, getInteger, getString, getBoolean, resetPointer, clear, getBufferSize, print, integerBitUnpack, integerBitPack.

comment:2 by Martin Sjölund, 12 years ago

The extends should be legal in an external object, I think (because extending from icons usually only add annotations; no elements). Or is that a major problem?

in reply to:  2 comment:3 by Per Östlund, 12 years ago

Replying to sjoelund.se:

The extends should be legal in an external object, I think (because extending from icons usually only add annotations; no elements). Or is that a major problem?

I'm not sure what kind of problems can occur with external objects, but the specification is pretty clear that an external object is not allowed to contain any other elements than the three given. And the spec says that extends clauses are elements, so in this case I just follow the spec and forbid them.

comment:4 by Martin Sjölund, 12 years ago

Fair enough

Note: See TracTickets for help on using tickets.