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:

else if ( type == "long" || type == "short")
{
        int v;
        if ( sscanf(value_string.c_str(), "%d", &v) == 1)
               bag_stack.top().first->add( new Property<int>( name, 
description, v ) );
        else {
               log(Error) << "Wrong value for property '"+type+"'." \
                                    " Value should contain an integer value, 
got '"+ value_string +"'." << endlog();
               return false;
        }
}

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