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
 Forum for Origin C
 How to generate a command error?

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
Mike Buess Posted - 12/20/2003 : 12:50:19 PM
How do you generate a command error in Origin C? I have an OC function, func(), that I want to use as a command in a LabTalk script.

- commands -
func arg;
- more commands -

I want to stop the script when certain conditions are met during execution of func(). In LabTalk you can use 'break 1' to generate a command error that will do the job, but LT_execute("break 1") doesn't work. I'd like to avoid testing for values returned by func()...

if( func(arg) ) break 1;

but is there any way around that?

...I should add that I want this to work in Origin 7.0 SR4 and higher.

Mike Buess
Origin WebRing Member

Edited by - Mike Buess on 12/20/2003 12:55:11 PM

Edited by - Mike Buess on 12/20/2003 12:59:20 PM
5   L A T E S T    R E P L I E S    (Newest First)
Mike Buess Posted - 12/22/2003 : 11:09:25 PM
I think this is still a reasonable request for a 7.5 SR or 8.0... an Origin C method for generating a LabTalk command error. It would make Origin C functions even more useful as extended Labtalk commands.

Mike Buess
Origin WebRing Member
Mike Buess Posted - 12/22/2003 : 08:36:44 AM
Hi CP,

Hopefully the error condition will occur infrequently so a few unknown errors are probably tolerable. Thanks.

Mike Buess
Origin WebRing Member
cpyang Posted - 12/22/2003 : 06:00:45 AM
I see no solution so far. You can generate runtime error, but extra error messages will appear in most of them, there might be one that we "forgot" to show error message, but I can not think of one now, for example

void func()
{
Dataset junk;
junk[0] = 1;
}


So any type of usage of illegal usage of class object should generate runtime error and will stop labtalk, but as you had pointed out, extra error messages will appear in script window.

CP


rlewis Posted - 12/22/2003 : 02:23:03 AM
Innovative approach ...
It does seem to have some interesting quirks though.

func 2;
//generates a LT command error which terminates execution of a LT script

but ...

MyVar= func 2;
// Generates a run time OriginC error NOT a LabTalk command error. LT script execution continues ..
Mike Buess Posted - 12/22/2003 : 01:16:28 AM
This works but generates extra "unknown" errors...

int func( int arg )
{
if(- error conditions -)
return 0/0;
else
return 0;
}

func 2;
unknown error
unknown error
Command Error!

Is there a better way?


Mike Buess
Origin WebRing Member

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