Go to previous topic
Go to next topic
Last Post 11 Jan 2007 01:24 PM by  mikea@logicpd.com
problems with scripting
 2 Replies
Author Messages
ggirzon
New Member
New Member
Posts:


--
10 Jan 2007 04:04 PM
    Having problems with scripting using LoLo 2.05 and 2.06. I need to read several registers in memory and then execute a different lolo string. However, even more fundamental operations don't work.

    losh> bit12 = 0; sum2 = 0; if $bit12 echo non-zero; sum2 = 1; else echo zero; endif; echo $sum2
    zero
    1 <---------- should be 0!

    losh> bit12 = 1; sum2 = 0; if $bit12 echo non-zero; sum2 = 1; else echo zero; endif; echo $sum2
    non-zero
    1

    What operations are allowed inside an if-then-else? Can I nest if- statements?

    Also, the method suggested in http://www.logicpd.com/su.../viewtopic.php?t=991 does not work

    losh> if ( $? == 0 )
    error: parser: syntax error
    error: parser: syntax error
    error: parser: syntax error
    error: parser: syntax error

    Thanks,

    Gary
    ashwinb@logicpd.com
    New Member
    New Member
    Posts:


    --
    11 Jan 2007 01:08 PM
    Gary,

    The parsing of the 'sum2=1" in the "if" portion might a bug in that the expected if-else-endif syntax might be enforcing something like..

    if (expression) <if-action> ; else <else-action> endif.

    When the <if-action> is actually two commands separated by ';' it might be jumping to process an "else" clause and then continuing to process whatever is in the real <else-action> as well. My reading of the document and the behavior would suggest that this is a bug.

    I will have someone look at this with ready access to LoLo and create a bug report if it is indeed that..
    mikea@logicpd.com
    New Member
    New Member
    Posts:


    --
    11 Jan 2007 01:24 PM
    Gary,
    I think there was a scripting bug related to this in 2.0.5 and 2.0.6.

    Try this instead (as a work around for now)

    losh> bit12 = 0; sum2 = 0; if $bit12 echo non-zero; setvar sum2 1; else echo zero; endif; echo $sum2
    zero

    Thanks,
    -Mike


    ---