home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 5 Edit / 05-Edit.zip / parsomat.zip / exampl15.pom < prev    next >
Text File  |  2001-07-15  |  2KB  |  64 lines

  1. ;
  2. ;   First, we must obtain the input file name.
  3. ;
  4. ;   $COMMAND will look something like this:
  5. ;   C:\POM\POM.EXE EXAMPL15.POM EXAMPL01.TXT EXAMPL15.LST
  6. ;
  7. ;   Thus, we want to parse out what is between the second and third spaces.
  8. ;
  9. SET      cmd = $COMMAND
  10. PARSE    fname cmd "2* " "3* "
  11. ;
  12. ;   Skip this file if it isn't one of the ones we want.
  13. ;   We do this using a "does not contain" comparison.
  14. ;
  15. NEXTFILE "XMPDAT01.TXT XMPDAT04.TXT XMPDAT07.TXT" ~ fname
  16. ;
  17. ;   Output the file name at the beginning of a new input file.
  18. ;   Note that lastcmd is null ("") until it is first set.
  19. ;
  20. BEGIN cmd <> lastcmd
  21.   SOUND "PIP"
  22.   ;
  23.   ;   Get the input file name and set up the underline
  24.   ;
  25.   SETLEN   flen  fname
  26.   SET      uline = ""
  27.   PAD      uline "L" "-" flen
  28.   ;
  29.   ;   Unless this is the first file, output three linefeeds.
  30.   ;
  31.   OUTEND   lastcmd <> "" |
  32.   OUTEND   lastcmd <> "" |
  33.   OUTEND   lastcmd <> "" |
  34.   ;
  35.   ;   Output the title (i.e. the file name)
  36.   ;
  37.   OUTEND   |{fname}
  38.   OUTEND   |{uline}
  39.   OUTEND   |
  40.   SET      lastcmd = $COMMAND
  41. END
  42. ;
  43. ;   Allow null lines
  44. ;
  45. MINLEN   "0"
  46. ;
  47. ;   The file XMPDAT07.TXT contains tab characters, so we will replace
  48. ;   each one with two spaces.  
  49. ;
  50. BEGIN fname = "XMPDAT07.TXT"
  51.   CHANGE   $FLINE  $TAB  "  "
  52.   ;
  53.   ;   On lines with an even number of characters in the first column,
  54.   ;   we end up with an extra space in column 23, so we will remove it.
  55.   ;
  56.   BEGIN $FLINE[23] = " "
  57.     APPEND $FLINE $FLINE[1 22] $FLINE[24 80]
  58.   END
  59. END
  60. ;
  61. ;   Output the file data
  62. ;
  63. OUTEND   |{$FLINE}
  64.