[Date Prev][Date Next][Subject Prev][Subject Next][
Date Index][
Subject Index]
Re: XS rules
- Subject: Re: XS rules
- From: Robert Holmgren holmgren@xxxxxxxx
- Date: Sun, 18 Feb 1996 16:19:18 EST
> Is it possible to use an "OR" in the search string used within an XS
> function? If so what would be the syntax
>
> That is, in this statement can the 212 variable
> contain an OR function?
>
> Thanks
>
> Steve Shaw
> sshaw@xxxxxxxx
No. Consider: With XS, you are parsing a string *literal* into three
substring literals defined ("separated") by a "separator" string (S/G 212
in your example); there is only one possible solution. Or rather, two
solutions: successful|unsuccessful (exist|not exist). You can use masks
within the separator string; masks offer some of the fuzzy logic that you
probably want: {27}Alpha {27}Letter {27}Number {27}Separator
{27}Wild$_to_80_chars {27}X_any_character. But the only way to perform ORs
is to test first with conditionals, e.g.:
If source_string "abcdefghijk" contains separator_string "cde" then
abcdefghijk,cde,ab,cde,fghijk
end_if
..{<}SV01,abcdefghijk{>}{<}SV02,xyz{>}{<}IF{<}IS01{>}
{240}{<}IS02{>}{>}{<}XS01,02,03,04,05{>}{<}EI{>}...[cr|lf]
03=ab
04=cde
05=fghijk
This doesn't preclude building conditional logic into the XS command.
For example, suppose the separator string represents a choice
(made by user at runtime) -- let's ask the user to hit either the
Home key (#71), End key (#79), or Insert key (#82). First we construct
a source_string in S/G 01:
|79|...
...|82|>
Then we get the KeyCode, VA$KC, of user's keypress in S/G 02, and we
surround it with "|" delimiters. Then we parse S/G 01 apart using S/G 02
as our separator string, and we Put (execute) the result contained in
S/G 05. Notice that, if the user hit the Home key, S/G 05 would consist of
virtually the entirety of source_string S/G 01:
|79||82|
but that the after "You hit Home" terminates execution at the desired
point.
XPLeNCODE v1.8
b-gin TEMP$$$.FIL
[cr|lf]
{<}SV01,|71|{<}PR You hit Home{>}{<}EX{>}|79|{<}PR You
hit End{>}{<}EX{>}|82|{<}PR You hit Insert{>}{<}EX{>}{>};*;[cr|lf]
{<}PRHit Home, End, or Insert{>};*;[cr|lf]
{<}SX02,{<}RK{>}{>}
{<}SX02,{<}VA$KC{>}{>}{<}SX02,"|"+{<}IS02{>}+"|"{>};*;[cr|lf]
{<}XS01,02,03,04,05{>}{<}PV05{>}{<}EX{>};*;[cr|lf]
-nd
XPLeNCODE
Designed differently, 05 could be a very complex action, e.g. a bunch of
functions, instead of a moronic PRompt message. Play with it.
-----------
Robert Holmgren
holmgren@xxxxxxxx
-----------