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
Username:
Password:
Save Password
Forgot your Password? | Admin Options

 All Forums
 Origin Forum for Programming
 Forum for Origin C
 How to generate a command error?
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

Mike Buess

USA
3037 Posts

Posted - 12/20/2003 :  12:50:19 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
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

Mike Buess

USA
3037 Posts

Posted - 12/22/2003 :  01:16:28 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
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
Go to Top of Page

rlewis

Canada
253 Posts

Posted - 12/22/2003 :  02:23:03 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
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 ..
Go to Top of Page

cpyang

USA
1406 Posts

Posted - 12/22/2003 :  06:00:45 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
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


Go to Top of Page

Mike Buess

USA
3037 Posts

Posted - 12/22/2003 :  08:36:44 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi CP,

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

Mike Buess
Origin WebRing Member
Go to Top of Page

Mike Buess

USA
3037 Posts

Posted - 12/22/2003 :  11:09:25 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
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
Go to Top of Page
  Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000