FILE   : wpmprt.WPM
HEADING: convert to WP characters

{;} TX.wpm - Convert WPMPRT DOS text file in WP to characters~
{;}          copyright 1991, L.Dunn, Micro Management Systems~
{DISPLAY ON}
{Home}{Home}{Home}{Up}{;}              got to top of document~

{LABEL}START~
   {ASSIGN}1~~{;}                      clear {VAR 1}~
   {ASSIGN}2~~{;}                      clear {VAR 2}~
   {ASSIGN}3~~{;}                      clear {VAR 3}~
   {ASSIGN}4~~{;}                      clear {VAR 4}~
   {ASSIGN}9~~{;}                      clear {VAR 9}~

   {Search}[{Search}{;}                search for open bracket~
   {Block}{Right}{;}                   block the following char code~
   {Macro Commands}31{Enter}{;}        save in {VAR 1}~
   {Block}{Right}{;}                   block next character~
   {Macro Commands}32{Enter}{;}        save -- should be colon~
   {IF}"{VAR 2}"!=":"~{;}              if not colon~
      {GO}START~{;}                       not a compose char~
      {END IF}
   {Block}{Right}{;}                   character set number~
   {Macro Commands}33{Enter}{;}        store in {VAR 3}~
   {IF}"{VAR 3}"<"0"|"{VAR 3}">"9"~{;} numeric digit?~
      {GO}START~{;}                       if not, no compose~
      {END IF}{;}                         try again~

   {LABEL}NUM1~{;}                     get character set number~
      {Block}{Right}{;}                   block next char~
      {Macro Commands}39{Enter}{;}        save in {VAR 9}~
      {IF}"{VAR 9}"<"0"|"{VAR 9}">"9"~{;}   if not a number~
         {GO}NONUM1~{;}                      try next character~
         {END IF}
      {ASSIGN}3~({VAR 3}*10)+{VAR 9}~{;}   add to char set number~
      {GO}NUM1~{;}                        try for another digit~

   {LABEL}NONUM1~{;}                   got char set number~
      {IF}"{VAR 9}"!=","~{;}           if not comma~
         {GO}START~{;}                    not a compose cmd~
         {END IF}

      {Block}{Right}{;}                block next character~
      {Macro Commands}34{Enter}{;}     store in {VAR 4}~
      {IF}"{VAR 4}"<"0"|"{VAR 4}">"9"~{;} is not numeric digit?
         {GO}START~{;}                    not compose~
         {END IF}

   {LABEL}NUM2~{;}                     get character number~
      {Block}{Right}{;}                   block next character~
      {Macro Commands}39{Enter}{;}        store in {VAR 9}~
      {IF}"{VAR 9}"<"0"|"{VAR 9}">"9"~{;}   not numeric digit~
         {GO}NONUM2~{;}                      got number~
         {END IF}
      {ASSIGN}4~({VAR 4}*10)+{VAR 9}~{;}       add to number~
      {GO}NUM2~{;}                        get next char~

   {LABEL}NONUM2~{;}                   got character number~
   {Block}{Search Left}[{Search Left}{;}block left~
   {Left}{Del}y{;}                     include [ and delete~
   {^V}{VAR 3},{VAR 4}{Enter}{;}       compose the character~
   {GO}START~{;}                       try for another~ 