Home AMX User Forum NetLinx Studio

Another this shouldn't compile problem.

Want to semi-crash a master?
DEFINE_DEVICE
test=10128:1:0

DEFINE_CONSTANT
long test_timeline=10128

DEFINE_EVENT
timeline_event[test]
{}

I haven't tested whether it was the code inside the timeline_event using timeline.id that crashed it or not. That code right there might crash it on it's own. Stupid copy/paste mistake dropped the "_timeline" from my timeline events. The master appeared to be working fine, but the entire event table didn't appear to be running.

The help file for timeline ID's states:
The NetLinx compiler will not semantic check the type of the timeline ID, and the NetLinx runtime system will attempt to cast the contents of the timeline ID constant, to a long constant. A runtime error will occur if the cast is unsuccessful.

Kind of makes sense, but I never saw a runtime error. I'm assuming the compiler doesn't through an error because REBUILD_EVENT could change the timeline.id value. I would assume DEV's are constants and there could be some check if a timeline_event for a constant is used, make sure the constant is valid.

Wasted two hours thinking the TPC ipad app wasn't working right..

Kevin D.

Comments

  • DHawthorneDHawthorne Posts: 4,584
    Event definitions are overloaded though. They can accept DEVCHANs, DEVs, arrays, etc. ... if one of the overloaded functions behind it can resolve that word 'test' to some value, the compiler isn't even going to blink. It wouldn't shock me if it is using the ASCII value. Heck, if you used it as a variable elsewhere, there it is right there. This one doesn't really surprise me, because we don't have a full breakdown of the internals of the event handler (or perhaps we do, but I don't know of it :) ... could be in netlinx.axi or something).
  • a_riot42a_riot42 Posts: 1,624
    shr00m-dew wrote: »
    Wasted two hours thinking the TPC ipad app wasn't working right..

    Kevin D.

    Be grateful you only wasted two hours. I declared the ID as a variable, and lost the event table. Took me a day to figure that one out. Very frustrating but I won't be making that mistake again.
    Paul
  • shr00m-dew wrote: »
    Want to semi-crash a master?
    DEFINE_DEVICE
    test=10128:1:0
    
    DEFINE_CONSTANT
    long test_timeline=10128
    
    DEFINE_EVENT
    timeline_event[test]
    {}
    

    I haven't tested whether it was the code inside the timeline_event using timeline.id that crashed it or not. That code right there might crash it on it's own. Stupid copy/paste mistake dropped the "_timeline" from my timeline events. The master appeared to be working fine, but the entire event table didn't appear to be running.

    Just a shot in the dark but this could be because of the backward compatibility to AXcess where a device definition was an integer value, not a dps. You can still compile devices defined as integer values. Therefore maybe "test" evaluates at compile-time to both 10128 and 10128:1:0. But like I said this is just speculation.
Sign In or Register to comment.