Oops there's a bug.
Right after the line that starts OFFSET += 1 should be yet another OFFSET += 1
so the corrected version should read
IF VERB = 'RUN' OR VERB = 'RAID' THEN
OFFSET += 1 ; N.FILE = FIELD(SENT,' ',OFFSET)
OFFSET += 1
END ELSE OFFSET += 2 ; N.FILE = 'BP'
-----Original Message-----
From: Wjhonson <[email protected]>
To: donr_work <[email protected]>; u2-users <[email protected]>
Sent: Fri, Aug 24, 2012 3:40 pm
Subject: Re: [U2] Variable Interpolation
FFT.BP 'TRY' BASIC 27 lines Level: 9
*
* Run any BASIC code typed at TCL
* Writen Aug 2012 by Will Johnson based on a comment by Don Robinson
* Released under CC-BY-2.0 license
*
SENT = @SENTENCE
OFFSET = 1 ; VERB = FIELD(SENT,' ',OFFSET)
IF VERB = 'RUN' OR VERB = 'RAID' THEN
OFFSET += 1 ; N.FILE = FIELD(SENT,' ',OFFSET)
END ELSE OFFSET += 2 ; N.FILE = 'BP'
OPEN N.FILE TO F.FILE ELSE
DISPLAY 'Cannot open file "':N.FILE:'"'
END
OFFSET += 1 ; WHAT = FIELD(SENT,' ',OFFSET) ; C.WHAT = COL2()+1
L.SENT = LEN(SENT) ; WHAT = SENT[C.WHAT,L.SENT]
WRITE WHAT:@AM:"END" ON F.FILE,'TRYCODE'
EXECUTE 'BASIC ':N.FILE:' TRYCODE'
EXECUTE 'RUN ':N.FILE:' TRYCODE'
*
END
-----Original Message-----
From: Don Robinson <[email protected]>
To: U2 Users List <[email protected]>
Sent: Fri, Aug 24, 2012 12:20 pm
Subject: Re: [U2] Variable Interpolation
Guys,
I may be way off base but I have a program that takes basic code from the
command line, compiles and runs it.
For example:
>01 RUNBASIC CRT SYSTEM(2) ; CRT SYSTEM(3)
====================================================
79
24
>
RUNBASIC is the program and CRT SYSTEM(2) ; CRT SYSTEM(3)
is the code in this example. 79 and 24 are the answers.
The string of = signs are just for looks.
This could be EXECUTEd from within a program but why?
It is quite handy for testing bits of code at TCL and might be useful in a proc.
RUNBASIC will do anything you can do with one line of code using ; to separate
statements including
FOR ... NEXT and LOOP ... REPEAT.
Code is free as long as you don't critisize it.
Don Robinson
From: Wjhonson <[email protected]>
To: [email protected]
Sent: Friday, August 24, 2012 1:38 PM
Subject: Re: [U2] Variable Interpolation
The impression I get from this thread is something like
Oh I've just read on the HELP pages that System(2) tells me the width of my CRT
screen.
Let me ask my process what it has as the value for System(2).
Oops I have to write a program just to tell me that.... that's too much trouble.
Why can't it just have a way to *tell* me ?
Why!!!!
-----Original Message-----
From: Martin Phillips <[email protected]>
To: 'U2 Users List' <[email protected]>
Sent: Fri, Aug 24, 2012 10:11 am
Subject: Re: [U2] Variable Interpolation
Hi,
I am intrigued by this thread, mostly because I have not understood why I would
want it.
If I can write
CALL @"SUB FOO(X,Y);Y=X+1;RETURN"( 3, VAL )
as suggested, why don't I just write the code inline in my program. What have I
missed?
Martin Phillips
Ladybridge Systems Ltd
17b Coldstream Lane, Hardingstone, Northampton NN4 6DB, England
+44 (0)1604-709200
_______________________________________________
U2-Users mailing list
[email protected]
http://listserver.u2ug.org/mailman/listinfo/u2-users
_______________________________________________
U2-Users mailing list
[email protected]
http://listserver.u2ug.org/mailman/listinfo/u2-users
_______________________________________________
U2-Users mailing list
[email protected]
http://listserver.u2ug.org/mailman/listinfo/u2-users
_______________________________________________
U2-Users mailing list
[email protected]
http://listserver.u2ug.org/mailman/listinfo/u2-users
_______________________________________________
U2-Users mailing list
[email protected]
http://listserver.u2ug.org/mailman/listinfo/u2-users