proposed fix: http://git.mah.priv.at/gitweb/emc2-dev.git/commitdiff/f3b037184e9e4e3a16dd764e1dd05e57d218d12d
now the test.hal script 'properly fails' to link the signal of the wrong type, as the original signal definition remains intact: $ halcmd -f -k test.hal Signals: Type Value Name (linked to) s32 0 mysig test.hal:8: Signal 'mysig' of type 's32' cannot add pin 'passthrough.out' of type 'float' Signals: Type Value Name (linked to) s32 0 mysig -m Am 19.09.2012 um 10:16 schrieb Michael Haberler: > so far I thought HAL pins and params belong to components and go away when > the component exits whereas signals are first class objects which exist > independently of any component. (NB: hal_sig_t in src/hal/hal_priv.c has NO > owner_ptr member but params and pins DO have them.). > > If this is so, then the behaviour exhibited below is an error - signals > created by halcmd are deleted before a user component is loaded (internally > hal_exit() is called which deletes the signals which have erroneously been > 'associated' with the temporary component created by halcmd). > > I would think deleting signals by a hal_exit() is an error; however, this is > potentially a far-reaching change so I thought I better hear opinions before > fixing thos. > > - Michael > > ---- test.hal: > > newsig mysig s32 # note type > show sig mysig > > # this creates the passthrough.out *float* pin > loadusr -Wn passthrough python passthrough.py > > net mysig passthrough.out > #---^^^^^^^^^^^^^^^^^^^^^ so this should fail with a type error > # > # mysig magically mutated to a float: > show sig mysig > > -------- > > passthrough.py is the example from here: > http://www.linuxcnc.org/docs/devel/html/hal/halmodule.html > > $ halrun -v -V -f test.hal > HAL: initializing hal_lib > HAL: initializing component 'halcmd15311' > HAL: component 'halcmd15311' initialized, ID = 02 > HAL: creating signal 'mysig' > Signals: > Type Value Name (linked to) > s32 0 mysig > > HAL: removing component 02 <---------------- this > deletes the signals defined so far!! > HAL: component 02 removed, name = 'halcmd15311' > HAL: initializing hal_lib > HAL: initializing component 'halcmd15311' > HAL: component 'halcmd15311' initialized, ID = 04 > python passthrough.py > test.hal:6: Component 'passthrough' ready > test.hal:6: Program 'python' started > HAL: creating signal 'mysig' <---------------- signal mysig > implicitly created by net command > HAL: linking pin 'passthrough.out' to 'mysig' > test.hal:8: Pin 'passthrough.out' linked to signal 'mysig' > Signals: > Type Value Name (linked to) > float 0 mysig > <== passthrough.out > > HAL: removing component 04 > HAL: component 04 removed, name = 'halcmd15311' > > > ------------------------------------------------------------------------------ > Live Security Virtual Conference > Exclusive live event will cover all the ways today's security and > threat landscape has changed and how IT managers can respond. Discussions > will include endpoint security, mobile security and the latest in malware > threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ > _______________________________________________ > Emc-developers mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/emc-developers ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ _______________________________________________ Emc-developers mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/emc-developers
