[Date Prev][Date Next][Subject Prev][Subject Next][
Date Index][
Subject Index]
RE: Programming Ques - Passing arguments with RUN
- Subject: RE: Programming Ques - Passing arguments with RUN
- From: "Marc O'Connor" marc@xxxxxxxx
- Date: Fri, 09 Jan 2004 12:02:30 +1300
Carl,
Of course - I don't know what I was thinking...split to first separator,
then to second separator with another XS...must have been a 'blonde' moment.
However, I still cannot get my head around the XY4 pgms you guys include in
emails.
I can usually work thru the code, but there are obviously extra codes and
functions included with version 4.
Thanks again for clarifying the separator with the XS function.
Cheers
Marc
-----Original Message-----
From: owner-xywrite@xxxxxxxx
[mailto:owner-xywrite@xxxxxxxx] On Behalf Of Carl Distefano
Sent: Thursday, 8 January 2004 7:38 p.m.
To: XyWrite List
Subject: Re: Programming Ques - Passing arguments with RUN
Reply to note from marc@xxxxxxxx Thu, 08 Jan 2004 17:55:15 +1300
(NZDT)
Marc:
> If you wanted to pass a third arg, you would need to use
> another different seperator and a different set of S/Gs
Not necessarily a different separator! You can use the same
separator (e.g., a space) between each argument: arg1 arg2 arg3 etc.
Just keep on parsing with XS.
In fact (thanks to discoveries made by Robert Holmgren 10+ years
ago), you can take an *indefinite* number of arguments and parse
each arg into its own Save/Get -- by "manufacturing" a new Save/Get
for each argument on the fly! Here's a demo; see if you can puzzle
out the code.
RUN MULTIARG.PM against itself. If, for example, you command
RUN MULTIARG.PM red green blue yellow, it parses "red" into
S/G 21, "green" into S/G 22, "blue" into S/G 23, and so forth. Add
another argument and it "manufactures" the next Save/Get in the
series. The listing created at the bottom of the file is for
confirmation only; these Save/Get values are _actually present in
memory and available for further use_, something you can verify by
taking an "exit poll" of Save/Gets with content:
XPOLL RUN MULTIARG.PM red green blue yellow.
Fascinating stuff (for programmers, anyway).
XPLeNCODE v2.0
b-gin [UNTITLED]
;*; MULTIARG.PM -- CLD 1/8/04[cr|lf];*; Parse arg1 arg2 arg3{032}
{046}.. into Save/Gets 21, 22, 23, etc.[cr|lf];*; (S/Gs 21 etc.{032}
manufactured by concantenation)[cr|lf];*; Demo for Xy4+[cr|lf
];*;[cr|lf];*; Usage:[cr|lf];*; With MULTIARG.PM in current w
indow:[cr|lf];*; RUN MULTIARG.PM arg1 arg2 arg3 arg4 ... [cr|lf];*;[cr|lf];*; Saves "arg1" to S/G 21, "arg2" to S/G
22, etc.[cr|lf];*;[cr|lf]{<}SX01,{<}IS00{>}{>}{<}SV02, {>}{<
}SX03,20{>};*;[cr|lf]{<}SU04,{<}SX05,"{<}XS01,02,"+{<}IS03{>}
+",06,07{>}{<}SX01,{<}IS07{>}{>}{<}GT03{>}={<}GT"+{<}IS03{>}+
"{>}[255+048+068]"{>}{<}PV05{>}{>};*;[cr|lf][BF_][255+048+068
];*;[cr|lf]{<}LBa{>}{<}SX03,{<}PV03{>}+1{>}{<}SX03,{<}IS03{>}
{>}{<}IF{<}IS01{>}{240}" "{>}{<}GT04{>}{<}GLa{>}{<}EI{>};*;[c
r|lf]{<}SX05,"{<}SX"+{<}IS03{>}+",{<}IS01{>}{>}{<}GT03{>}={<}
GT"+{<}IS03{>}+"{>}[255+048+068]"{>}{<}PV05{>}{<}PRDone!{>}{<
}EX{>}[cr|lf][cr|lf]
-nd
XPLeNCODE
--
Carl Distefano
cld@xxxxxxxx