[Date Prev][Date Next][Subject Prev][Subject Next][
Date Index][
Subject Index]
Re: Much easier way to do file comparison -- revised
- Subject: Re: Much easier way to do file comparison -- revised
- From: "Robert Holmgren" holmgren@xxxxxxxx
- Date: Sun, 6 Nov 2005 15:08:17 -0500
** Reply to message from Harry Binswanger on Sun, 06 Nov 2005
02:13:22 -0500
This is a bit tighter... squelched a wee bug... plus clearer commenting of the
code. Presented this way, it looks like a huge program; but it's actually only
375 bytes:
XPLeNCODE v2.0
b-gin [UNTITLED]
{<}SV01,FIRST{>}{<}SU02,{<}SX03,{<}IS01{>}+" file to compare?
(Y/n)"{>}{>}{<}SX04,2{>};*; Setup the PRompt string just onc
e (issue it twice)[cr|lf];*;[cr|lf]{<}CUB,04{>};*; CountUp lo
op, executed 2 times per value in , between an
d [cr|lf];*;[cr|lf]{<}GT02{>}{<}PR@03{>}{<}SX03,{<}RC{>}
{>}{<}IF@UPR({<}IS03{>}){240}"N"{>};*; If Aborting...[cr|lf];
*;[cr|lf]{<}IF{<}IS01{>}{240}"E"{>};*; If "sEcond" window dis
played...[cr|lf];*;[cr|lf]{<}LBA{>}[TF_][WG_][AS_][TF_][WG_]{
<}EI{>};*; ...restore status ante[cr|lf];*;[cr|lf]{<}EX{>}{<}
EI{>};*; Quit[cr|lf];*;[cr|lf][XH_][YD_][XD_][XP_][TF_][SI_][
DO_][FF_][AS_]{<}SV01,SECOND{>};*; Initialize each file to co
mpare: kill menus, kill any existing DeFined state, switch to
eXPanded view, go TopFile, SetInsert cursor state, Force_reF
reshed screen, toggle to AdjacentScreen, adjust the PRompt fo
r the second go-round[cr|lf];*;[cr|lf]{<}LBB{>};*; End of Cou
ntUp loop[cr|lf];*;[cr|lf]{<}SX01,{<}VA$MA{>}{>}[BX_]d MA=1{>
}[Q2_];*; Set FD/FM "MAtch" sensitivity to 1 character[cr|lf]
;*;[cr|lf];*; Begin processing:[cr|lf];*;[cr|lf]{<}LBC{>};*;{032}
Beginning of main FD/FM compare loop[cr|lf];*;[cr|lf]{<}IF{<}
VA$FE{>}<1{>};*; Have we reached FileEnd yet? No=0|Yes=1[cr|l
f];*;[cr|lf][FD_]{<}MD+26{>};*; Find differences in Doc #1, b
egin to display them GREEN[cr|lf];*;[cr|lf][AS_][DF_];*; Star
t DeFining differences in Doc #2[cr|lf];*;[cr|lf][AS_][FM_]{<
}MD-26{>};*; End of differences in Doc #1, quit GREEN[cr|lf];
*;[cr|lf][AS_][DF_]{<}IF{<}VA$DS{>}<{<}VA$DN{>}{>};*; Toggle{032}
to Doc #2, stop DeFining text, see if the DF block has any le
ngth (i.e. do differences exist?)...[cr|lf];*;[cr|lf][AS_]{<}
MD+20{>}[CP_]{<}MD-20{>};*; If there *are* differences in Doc
#2, CoPy them to Doc #1 and display them in RED[cr|lf];*;[cr
|lf][AS_]{<}EI{>}[XD_][AS_]{<}GLC{>}{<}EI{>};*; End of main F
D/FM compare loop[cr|lf];*;[cr|lf]
[BX_]d MA={<}PV01{>}[Q2_];*; Restore original "MAtch" sensiti
vity[cr|lf];*;[cr|lf][AS_]{<}GLA{>} Share identical code at <
LBA>[cr|lf]
-nd
XPLeNCODE
-----------------------------
Robert Holmgren
holmgren@xxxxxxxx
-----------------------------