CPF file parsing

Hello,

I have seen following problem during CPF file parsing:

according to cpf.dtd

an simple element can be of type short, so I defined :


0xC0

the configuration of the task going well without any errors/warnings

0.006 [ Info ][PropertyLoader:configure] Configuring TaskContext 'RoverController' with 'deployment/RoverController.cpf'.
0.006 [ Info ][DeploymentComponent::configureComponents] Configured Properties of RoverController
0.006 [ Info ][DeploymentComponent::configureComponents] Setting activity of RoverController
0.006 [ Info ][ExecutionEngine::setActivity] RoverController is not periodic.
0.006 [ Info ][DeploymentComponent::configureComponents] configure hook
0.006 [ Info ][DeploymentComponent::configureComponents] Configuration successful.

but, the referenced property was set to 0 ( the default value was overwritten !!! )

I am not sure, if it is a bug or the parsing of hex values is just not implemented ?

-vitali

CPF file parsing

On Wednesday 11 February 2009 14:50:49 vitali [..] ... wrote:
> Hello,
>
> I have seen following problem during CPF file parsing:
>
> according to cpf.dtd
>
> <!ATTLIST simple name CDATA #IMPLIED type
> (boolean|char|double|float|short|long|objref|octet|string|ulong|ushort)
> #REQUIRED>
>
> an simple element can be of type short, so I defined :
>
> <simple name="X" type="short">
> <value>0xC0</value>
> </simple>
>
> the configuration of the task going well without any errors/warnings
>
> 0.006 [ Info ][PropertyLoader:configure] Configuring TaskContext
> 'RoverController' with 'deployment/RoverController.cpf'. 0.006 [ Info
> ][DeploymentComponent::configureComponents] Configured Properties of
> RoverController 0.006 [ Info ][DeploymentComponent::configureComponents]
> Setting activity of RoverController 0.006 [ Info
> ][ExecutionEngine::setActivity] RoverController is not periodic. 0.006 [
> Info ][DeploymentComponent::configureComponents] configure hook 0.006 [
> Info ][DeploymentComponent::configureComponents] Configuration
> successful.
>
> but, the referenced property was set to 0 ( the default value was
> overwritten !!! )
>
> I am not sure, if it is a bug or the parsing of hex values is just not
> implemented ?

Parsing of hex values is not implemented, or at least not tested. Not in XML
and not in scripting.

If it can't understand 0x... syntax, I would expect an error at least, for
excample from TinyDemarshaller.cpp:
&#10;else if ( type == &quot;long&quot; || type == &quot;short&quot;)&#10;{&#10;        int v;&#10;        if ( sscanf(value_string.c_str(), &quot;%d&quot;, &amp;v) == 1)&#10;               bag_stack.top().first-&gt;add( new Property&lt;int&gt;( name, &#10;description, v ) );&#10;        else {&#10;               log(Error) &lt;&lt; &quot;Wrong value for property &#039;&quot;+type+&quot;&#039;.&quot; \&#10;                                    &quot; Value should contain an integer value, &#10;got &#039;&quot;+ value_string +&quot;&#039;.&quot; &lt;&lt; endlog();&#10;               return false;&#10;        }&#10;}&#10;

I also believe that the property writing will always be in decimal notation
and not in hex.

Peter

CPF file parsing

sspr wrote:

On Wednesday 11 February 2009 14:50:49
Parsing of hex values is not implemented, or at least not tested. Not in XML
and not in scripting.

If it can't understand 0x... syntax, I would expect an error at least, for
excample from TinyDemarshaller.cpp:

you will get an error if you try to use C0 instead of 0xCO,
but no error if you specifiy 0xC0 , it is just parsed as 0

-vitali