Author |
Topic  |
|
Mike Buess
USA
3037 Posts |
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 |
|
Mike Buess
USA
3037 Posts |
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 |
 |
|
rlewis
Canada
253 Posts |
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 .. |
 |
|
cpyang
USA
1406 Posts |
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
|
 |
|
Mike Buess
USA
3037 Posts |
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 |
 |
|
Mike Buess
USA
3037 Posts |
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 |
 |
|
|
Topic  |
|