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

Re: XPL best practices



Robert Holmgren wrote:

That was my first thought too. I don't understand how XyWrite can confuse a
plain-text "IF" for an «IF...». Not possible. But if you put your code in
true form, e.g. in XPLCODE form so we could DECODE it... >
Unfortunately, I seem to have thrown away that version;
cannot find it anywhere. And now when I try to
re-create it, I'm not getting the error message about
unbalanced ifs. I suppose it's possible that I had a
fake guillemet in there (it's happened before: I hit
CTRL-SHIFT . instead of Ctrl ., the first yielding the
3-byter, the second the regular one), though I usually
check by switching into draft mode before doing
RUNCODE, and then the fake shows up.
>Clearly, DELAY 2 gobbles up 2/3 of the extra time
that you're complaining about;
Except that the DELAY command is simply being written
to the batfile, not executed yet.


OK, here are two version XPLncoded and with comment:

Common routines:
Fully qualified filename of curently open file (which it the one that we want to convert to WP) is saved to SG 50, then to SG01. It is then parsed on the period (yes, need to make sure there are no periods in any of the directories in the fqp; I said it needs more work, esp. error-trapping; I also need to check that there's a file open and no text defined), and the fq filename of the desired converted file, with extension .wp, is saved to SG02. The fqp of the Filters directory is saved to SG 03, and any file in that dir named xytowp.bat is erased, and a new one created.
Version 1: merges a preexisting file called xytowp.cod,
which contains the batchfile Robert gave me years ago
for converting using the Hungarian filters, then runs
CI commands to replace the batfile parameters %1 with
SG01, and %2 with SG 02, and stores the file.

XPLeNCODE v2.0
b-gin [UNTITLED]
{<}LBVersion 1{>}[ZT_]{<}SX50,{<}VA$FP{>}{>}{<}SX01,{<}IS50{>
}{>}{<}SV51,.{>}[JM_]2.XSR[Q2_]{<}SX02,{<}IS52{>}+".wp"{>}{<}
SX03,{<}VAWW{>}{>}[BX_]default EP=0 [Q2_][BX_]exist {<}PV03{> }xytowp.bat[Q2_]{<}IF@NOT({<}ER{>}){>}[BX_]ERNV {<}PV03{>}xyt owp.bat[Q2_][BX_]wait[Q2_]{<}EI{>}[BX_]ne {<}PV03{>}xytowp.ba t[Q2_][BX_]merge xy2wp2.cod[Q2_][GT_][TF_][BC_]ci /%1/{<}PV01 {>}/[XC_][TF_][BC_]ci /%2/{<}PV02{>}/[XC_][BX_]store [Q2_]{<}
SX10,{<}VA$ET{>}{>}{<}PR@10{>}[cr|lf]
-nd
XPLeNCODE

(Sorry about the raggedness of that; artifact of Tbird.)

Content of xytowp.cod:
@echo off
cd d:\xyw4dos\filters
echo Export XyWrite %1 to WordPerfect v6 %2
W4W17F.EXE %1 /N /V2
DELAY.EXE 2
if exist %2 del %2
REM /V1=WordPerfect v6.0; TRY also /V2 switch for v6.1
W4W48T.EXE %2 /N /V1
Version 2: Writes the command directly to the batfile from the program, inserting the appropriate SGs in their proper place. This version has the advantage of using SG 03, whereas V. 1 has the path to the filters hardcoded in xy2wp2.cod. I should fix that, but haven't time right now.

XPLeNCODE v2.0
b-gin [UNTITLED]
{<}LBVersion 2{>}[ZT_]{<}SX50,{<}VA$FP{>}{>}{<}SX01,{<}IS50{>
}{>}{<}SV51,.{>}[JM_]2.XSR[Q2_]{<}SX02,{<}IS52{>}+".wp"{>}{<}
SX03,{<}VAWW{>}{>}[BX_]default EP=0 [Q2_][BX_]exist {<}PV03{> }xytowp.bat[Q2_]{<}IF@NOT({<}ER{>}){>}[BX_]ERNV {<}PV03{>}xyt owp.bat[Q2_][BX_]wait[Q2_]{<}EI{>}[BX_]ne {<}PV03{>}xytowp.ba t[Q2_][GT_]@echo off[cr|lf]cd {<}PV03{>}[cr|lf]W4W17F.EXE {<} PV01{>} /N /V2[cr|lf]DELAY.EXE 2 >nul[cr|lf]if exist {<}PV02{ {062}} del {<}PV02{>}[cr|lf]W4W48T.EXE {<}PV02{>}[cr|lf]@echo off [BX_]store [Q2_][BX_]default EP=1,1,1,1,1,1,1[Q2_]{<}SX10,{<}
VA$ET{>}{>}{<}PR@10{>}
-nd
XPLeNCODE
See how much time each takes on your machines. The only explanation that occurs to me--probably balderdash--is that the Merge and CI version is in part making calls to the already compiled native Xy functions, whereas version 2 is using XPL throughout, which is interpreted, no?
--
Patricia M. Godfrey
PriscaMG@xxxxxxxx