®GLA¯®LM0¯®RM255¯
CHNGBLOK.PM v2.1
Global "CIA"-style Search-and-Replace within DeFined Blocks Only
For XyWrite III+.  R. J. Holmgren  9/86 (rev 10/28/89)

INSTRUCTIONS:  (main program; another version is coded within LaBel
  ÿAELB-ALTERNATIVE VERSIONÿAF, at the end of this file.  Remove it from the
  LaBel, and write it to disk as an independent file, or load it in OODLES)

ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ

First, DeFine the text block at both ends (doesn't matter where you leave
  the cursor)
Second, manually input the global Search-&-Replace command on the CM line:
  e.g.  "cia /that/which/"  ÄÄ input MUST be in ABSOLUTE "cia" form,
  NOT "ci" or "cv"                                          =
Third, instead of giving an Ù³XC (eXeCute) instruction, RUN this PM with
  a .KeyBoarD file key assignment, or loaded on a Save/Get.  As you can
  see, the procedure is "ordinary" with this last exception

An alternative version, suitable for OODLES, is coded at the end ÄÄ less of a
  kludge, and much faster.  Input of SEARCH and REPLACE strings is handled by
  this alternative program; the drawback is that string input is not
  correctible.

Enjoy!

®LBA¯®SX04,.5¯®SX01,®VA$DS¯¯®SX05,®VA$DN¯¯®IF®PV05¯==0!®PV05¯==®PV01¯¯ÿ€}®PRBad define block Ä Abort¯®EX¯®EI¯ÿ�Aÿ�ÿ€ãÿ€mÿ€wÿ€Ïÿ€Ïÿ€Ïÿ€Ïcva ÿ€mÿ€wjmp ®PV05¯ ÿ�	®SU03,®LBB¯ÿ�+®SX07,®PV07¯-1¯®IF®PV07¯>0¯®GLB¯®EI¯ÿ�£¯®SU08,®SX07,@SIZ(®IS01¯)+5¯ÿ€mÿ€wjmp ®PV01¯ ÿ�	ÿ€m®PV03¯ÿ�£¯®SX07,@SIZ(®IS05¯)+5¯ÿ€m®PV03¯ÿ€mÿ€wes 1 ÿ�	ÿ€m®SX07,5¯®PV03¯®PV08¯®LBC¯ÿ�	®IF®ER¯¯®GLD¯®EI¯®SX02,®CP¯¯®IF®PV02¯<=®PV05¯¯®GLE¯®EI¯a®LBD¯®IF®PV04¯==.5¯ÿ€ñÿ�se  ÿ�	ÿ�+®EI¯ÿ�es 0ÿ�	ÿ�jmp ®PV05¯ ÿ�	ÿ€kÿ�jmp ®PV01¯ ÿ�?ÿ�;ÿ�	ÿ€kÿ�cia ®PRDone¯®EX¯®LBE¯y®IF®PV04¯==.5¯ÿ€mÿ€wse   ÿ�	ÿ�+®SX04,®CP¯-®PV05¯¯®SX07,6¯ÿ€m®PV03¯®EI¯ÿ€mÿ€wjmp ®PV02¯ ÿ�	®SX07,@SIZ(®IS02¯)+5¯ÿ€m®PV03¯®SX05,®PV05¯+®PV04¯¯®GLC¯


Alternative Version (for OODLES):

First, DeFine the text block at both ends
Then RUN this version.  Input of both SEARCH and REPLACE strings is handled
  by the program, and EACH string terminates with function XC -- NOT <cr>
  (the carriage return key) [this enables you to put a carriage return in the
  Search³Replace string].  Func XC is usually mapped to F9

®LB-ALTERNATIVE VERSION:
®LB-BEGIN COPY:¯®LBA¯®SX01,®VA$DS¯¯®SX05,®VA$DN¯¯®IF®PV05¯==0¯ÿ�Bad define block®GLD¯®EI¯ÿ€ã®SV03,ÿ�	¯®SV04,¯®SV08,¯®SV07,¯ÿ�cia ü®LBB¯®PRSearch $? (XC; `Esc' aborts)¯®SX09,®RC¯¯®IF®IS09¯==®IS07¯¯®LBC¯ÿ�®LBD¯ÿ€}®PRQuit¯®EX¯®EI¯®IF®IS09¯î®IS03¯>-1¯®GLE¯®EI¯®IF@SIZ(®IS09¯)<3¯®PV09¯®SX04,®IS04¯+®IS09¯¯®EI¯®GLB¯

®LBE¯ü®LBF¯®PRReplace $? (XC; `Esc' aborts)¯®SX09,®RC¯¯®IF®IS09¯==®IS07¯¯®GLC¯®EI¯®IF®IS09¯î®IS03¯>-1¯®GLG¯®EI¯®IF@SIZ(®IS09¯)<3¯®PV09¯®SX08,®IS08¯+®IS09¯¯®EI¯®GLF¯

®LBG¯®SX09,@SIZ(®IS04¯)¯®SX06,@SIZ(®IS08¯)¯®IF®PV09¯==0&®PV06¯==0¯ÿ�No strings®GLD¯®EI¯ÿ�Aÿ�es 1ÿ�	ÿ�jmp ®PV01¯ÿ�	ÿ�®LBH¯ÿ�cva ü®PV04¯ü®PV08¯üÿ�	®IF®ER¯¯®GLI¯®EI¯®SX02,®CP¯¯®IF®PV02¯<=®PV05¯¯®GLJ¯®EI¯a®LBI¯ÿ�es 0ÿ�	ÿ�jmp ®PV05¯ÿ�	ÿ€kÿ�jmp ®PV01¯ÿ�?ÿ�;ÿ�	ÿ€k®GLA¯

®LBJ¯y®SX05,®PV05¯+®PV06¯-®PV09¯¯ÿ�jmp ®PV02¯ÿ�	®GLH¯ÿ�£®LB-END COPY¯¯