The Origin Forum
File Exchange
Try Origin for Free
The Origin Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ | Send File to Tech support
 All Forums
 Origin Forum for Programming
 LabTalk Forum
 typesetting brackets in control flow statements

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

Screensize:
UserName:
Password:
Anti-Spam Code:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkUpload FileInsert Image Insert CodeInsert QuoteInsert List
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
tom3m Posted - 06/26/2002 : 2:06:26 PM
I have a question/comment/observation concerning bracket positioning in control flow statements for labtalk. I have noticed on several occasions that Origin (6.1) encounters a run-time error while executing a script depending on the typesetting of brackets in the input labtalk script file. For example, compare the following two code fragments


loop(ip,1,10)
{
loop(jp,1,10)
{
Type My loopstuff goes here;
};
};


versus the following

loop(ip,1,10){
loop(jp,1,10){
Type My loopstuff goes here;};};


Note that these code fragments are too simple to produce the errors I have encountered. I hope they are sufficient to illustrate the formatting style difference.

I have found that Origin will often produce run-time errors, sometimes so catastrophic that the Origin session terminates completely, when I use the former method of typesetting the script, but not when I use the latter method of typesetting the script. Personally, I find the former method to be much easier to read and debug, especially when loops and if/else statements span many editor screen pages.

I have also noted that the crash is more likely to occur if the script is run from a user-defined button instead of from the script window.

I am pretty sure the error is not due to general program logic error (script bug), lack of semi-colons where they should be, etc. I have had this type of run-time error occur so many times under different circumstances that I now just typeset my Origin code using the latter method and everything is ok. I would still like to be able to use the former typesetting format, though.

Has anyone else noticed this?


1   L A T E S T    R E P L I E S    (Newest First)
CStorey Posted - 06/26/2002 : 2:55:34 PM
I normally use the first methode shown, and never get the kinds of errors you mention.

You should be aware that there is a limit as to how many lines/characters you can but between a set of brackets. I believe it is less than 1024 characters. No error will be reported if this limit is exceeded, Origin simply crashes. Usually crashes and displays two error messages. To avoid this problem break you r code up into sections and use run.section() calls for large segments inside conditionals.

Example:


[Main] // Main section
loop(ip,1,10)
{
run.section(,SecondSection);
};

[SecondSection]
loop(jp,1,10)
{
Type My loopstuff goes here;
};


Note that the run.section(, x); notation refers to section x in the same file. You can also refer to sections in other files by using run.section(FullFilePath, x);

Hope this solves your problems.


Craig Storey
Origin WebRing Member - http://g.webring.com/hub?ring=originwebring

The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000