[Date Prev][Date Next][Subject Prev][Subject Next][ Date Index][ Subject Index]

Re: Military time (whoops!)



** Reply to message from "Patricia M. Godfrey"  on Sun, 18
Jun 2006 17:38:29 -0400


>> XPLeNCODE v2.0
>> b-gin [UNTITLED]
>> {<}SX01,{<}VA$MT{>}{>}[BX_]d mt=1[Q2_]{<}SX02,{<}VA$TM{>}{>}[
>> BX_]d mt={<}PV01{>}[Q2_]{<}SV01,{027}X{>}{<}SX03,{<}VA|02{>}{
>> {062}}{<}SV04,{>}{<}CUA,03{>}{<}XS02,01,,05,00{>}{<}IF{<}VA{021}0
>> 5{>}>0{>}{<}SX04,{<}IS04{>}+{<}IS05{>}{>}{<}EI{>}{<}SX02,{<}I
>> S00{>}{>}{<}LBA{>}{<}IF{<}VA|04{>}<4{>}{<}SX04,"0"+{<}IS04{>}
>> {>}{<}EI{>}{<}PR@04{>}{<}EX{>}[cr|lf]
>> -nd
>> XPLeNCODE

> This is just what I need, and I'm trying to understand
> it, hampered by the fact that I cannot seem to get to
> work on it in the AM to see how that affects the
> intermediate results. Two questions, if I may:
> 1. {<}SV01,{027}X{>}: This means that any character
> except any single character is saved to SG 02, no?

No. It means that any single character is saved to S/G 05 in the XS parse.

> That seems counter-intuitable, but apparently when SG 02 is
> then used as the parser

S/G 02 is the source string. S/G 01 is the separator. S/G 05 is the result.

> it results in the first char of
> the parsed string being saved to the parsing element
> (normally the 2d item in the parse code)??

The fourth item, always. The second item is the separator. The fourth item is
the result.

> A very neat trick, and how did you ever figure it out?

Basic parsing: evaluate a string character-by-character. We do this
repeatedly in U2 -- hundreds of times. U2 is truly a compendium of "neat
tricks", but this is just vanilla XS parsing.

> 2. What on earth does {<}CUA,03{>} mean? I've been
> through both manuals, Tyson's book, and XPL.TXT and
> cannot find it.

The Count Up usage is:

action<{LaBel}>

For example:

+2>

The CountUp procedure -- meaning, in the above example, all operations between
 -- is executed 4 times (because S/G 01 = 4). With each
iteration (execution), S/G 02 is incremented by 2. Result: S/G 02 = 8.

CountUp is a more succinct, faster way of doing the following (equivalent to
the above example):

+1>+2>{less
than}4>

-----------------------------
Robert Holmgren
holmgren@xxxxxxxx
-----------------------------