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

Re: Re typing allergy



Reply to note from Patricia M Godfrey  Mon, 19 Jan
2004 18:33:14 -0500

Patricia:

> you could embed code in a text doc and have it run. That is
> also said in CTRLCHARS, in connection with the power of PV.
> Well, how does one go about that?

Several approaches are possible. I think you're on the right track
with your SEarch procedure.

See below for a simple way (RUNEM), which uses a SEarch   specially
configured NoTes   RUNCODE. RUNEM executes XPL embedded in certain
non-printing NoTes in the current file, SEarching for such NoTes from
the cursor position to the End_of_File. The required format for each
NoTe is:

«NT![your code here]»

Note the "!"; it's a must. Make sure that there is no white space between the "!" and the start of your code. An underlying assumption is that after each NoTe! executes, the cursor will end up somewhere *after* the end of the just-executed NoTe! and *before* the beginning of the next NoTe! to be executed; it's the user's responsibility to supply, in each NoTe!, whatever additional code is needed to position the cursor so that when that NoTe! is done, the next following NoTe! will be executed. If all your embedded code does is MErge a file at each NoTe! location, you'll be OK. A second routine, DELEM, deletes all NoTes! () from CursorPosition to End_of_File. I think it's safest and simplest to keep the two procedures -- running embedded code and deleting embedded code -- separate. Here's what to do: DECODE the encoded material below, DeFine the entire block, and add it to U2 (ADD2U2). Embed NoTes! wherever desired in your subject file; to take one of your examples, . Then, with the subject file in the current window and the cursor at Top_of_File (if you want to execute all embedded NoTes!), issue RUNEM. When you're satisfied that you don't need the NoTes! anymore, issue DELEM to DELete thEM. > Can and may one use U2 routines in one's own code Absolutely! Calls to XyWWWeb routines can be used in any of your personal programs, whether they're RUN as freestanding files, LDPMed to a key, added to your personal section of U2, etc. (The main potential issue is Save/Get clashes between your program and the called U2 routine, but these are manageable.) > how would one embed the equivalent of the HELPKEY? The Helpkey (frame PrsCMline) is only needed to launch routines from the CMline. In XPL, the basic call is: JM 2.routinenameQ2 If the routine takes an argument, put it in Save/Get 50; for example: JM 2.reverseQ2 ;*; returns "edcba" in S/G 50 For a real-life example, see the call to RUNCODE in frame RUNEM, below. See also the many examples in the "Common Resources" section of XYWWWEB.INF; issue HELP COMMON to go there. Have fun, and lemme know.
XPLeNCODE v2.0 b-gin [UNTITLED] {{;5runem}} RUN XPL embedded in NoTes (format: ) in current file (CP to EOF) [CLD 1/19/04][cr|lf]{002} [XH_][BX_]es 1[Q2_]{<}LBa{>}[WG_]{<}IF{<}VA$DT{>}>1{>}[MK_]{< }EI{>}[BX_]se [w<]NT![Q2_]{<}IF@not({<}ER{>}){>}[TG_][CL_][Y D_][DF_][BX_]seb [w<]NT![Q2_][CR_][CR_][CR_][CR_][DF_][DE_][ CR_][JM_]2.runcode[Q2_]{<}GLa{>}{<}EI{>}[DO_][FF_]{002}[cr|lf ][cr|lf]{{;5delem}} Delete RUNEM NoTes in current file (CP to EOF) [CLD 1/19/04][cr|lf]{002}[XH_][BX_]es 1[Q2_][WG_]{<}IF{ <}VA$DT{>}>1{>}[MK_]{<}EI{>}{<}SX01,{<}VAEP{>}{>}[BX_]d ep=0, 0,0,0,0,0,0[Q2_]{<}LBa{>}[BX_]se [w<]NT![Q2_]{<}IF@not({<}ER {>}){>}[CL_][RC_]{<}GLa{>}{<}EI{>}[BX_]d ep={<}PV01{>}[Q2_][D O_][FF_]{002}[cr|lf][cr|lf] -nd XPLeNCODE -- Carl Distefano cld@xxxxxxxx