home *** CD-ROM | disk | FTP | other *** search
/ The Datafile PD-CD 4 / DATAFILE_PDCD4.iso / utilities / utilst / zapupdates / Filters / FiltLibDoc < prev    next >
Text File  |  1995-09-22  |  4KB  |  140 lines

  1. FilterLib
  2. Library for FILTERSEL filter programs
  3. Written by Darren Salt
  4. Version 1.00, 9 Sep 1995
  5.  
  6. Comments and extensions welcome!
  7.  
  8.  
  9. All internal variables begin with ` unless LOCAL
  10.  
  11.  
  12. PROCfilter_initialise(delete_flag%,filter_name$)
  13.     This must be called before using any other FilterLib routine.
  14.     It sets up:
  15.         the file handles, in% and out%
  16.         the file names, in$ and out$
  17.         the argument string, arg$ (less redirection operators)
  18.         a buffer for the argument list (filled in by PROCgetargs)
  19.         some machine code routines
  20.         an error handler
  21.         the filter name, filter_name$
  22.         delete flag, used on error
  23.             if TRUE, then output file is deleted on error
  24.  
  25.  
  26. PROCfilter_error
  27.     Standard error handler
  28.     Closes standard input & output files if open
  29.     Deletes output file if present AND del% is TRUE
  30.  
  31. PROCreport(error_msg$)
  32. PROCreportb(error_block%)
  33.     Standard error report routines
  34.  
  35.  
  36. FNaddswitch(switch_name$)
  37.     Adds a switch to the list of allowed arguments, eg. -dummy
  38.     Returns a number which can be passed to FNswitch
  39.  
  40. FNaddval(switch_name$,key%)
  41.     Adds a switch to the list of allowed arguments, eg. -dummy 123
  42.     key% is TRUE if the switch is not to be auto-assigned a value
  43.     Returns a number which can be passed to FNswitch
  44.  
  45. FNaddstring(switch_name$)
  46.     Adds a switch to the list of allowed args, eg. -dummy "Hello world"
  47.     key% as above
  48.     Returns a number which can be passed to FNswitch
  49.  
  50.  
  51. PROCgetargs
  52.     Scan supplied arguments using syntax string built with FNaddswitch,
  53.     FNaddval and FNaddstring
  54.  
  55.  
  56. FNswitch(argument_number%)
  57.     Used for switches without parameters
  58.     Returns TRUE/FALSE
  59.     argument_number% is a number returned by FNaddswitch()
  60.  
  61. FNval(argument_number%)
  62.     Used for switches with numeric (evaluated) parameters
  63.     Returns parameter value
  64.     argument_number% is a number returned by FNaddval()
  65.  
  66. FNstring(argument_number%)
  67.     Used for switches with string parameters
  68.     Returns string
  69.     argument_number% is a number returned by FNaddstring()
  70.  
  71.  
  72. FNstring0(address%)
  73.     Returns the null-terminated string at address
  74.  
  75. FNstringLF(address%)
  76.     Returns the LF-terminated string at address
  77.  
  78. FNstringc(address%)
  79.     Returns the ctrl-code-terminated string at address
  80.  
  81. FNstringx(address%, terminating_code%)
  82.     Returns the string at address - you specify the terminator
  83.     These functions will only return up to 255 characters
  84.  
  85.  
  86. FNlen0(address%)
  87.     Length of the null-terminated string at address
  88.  
  89. FNlenLF(address%)
  90.     Length of the LF-terminated string at address
  91.  
  92. FNlenc(address%)
  93.     Length of the ctrl-code-terminated string at address
  94.  
  95. FNlenx(address%, terminating_code%)
  96.     Length of the string at address - you specify the terminator
  97.  
  98.  
  99. These functions will only return up to 255 characters:
  100. PROCopenin    Opens the input file (sets in% to the file handle)
  101. PROCopenout    Opens the output file (sets out% to the file handle)
  102. PROCclosein    Closes the input file
  103. PROCcloseout    Closes the output file
  104.  
  105.  
  106. PROCloadin(RETURN address%, RETURN length%)
  107.     Claim memory for, and load input file
  108.     Ensures that buffer is followed by a line feed and a null
  109.  
  110. PROCsaveout(address%, length%)
  111.     Save output file (will fail if the file is open)
  112.     File type is 'text'
  113.  
  114.  
  115. FNgetblock(address%, length%)
  116.     Read length% bytes from input file (must be opened using PROCopenin)
  117.     Returns 0 if successful, else number of bytes not read
  118.  
  119. FNputblock(address%, length%)
  120.     Read length% bytes from input file (must be opened using PROCopenin)
  121.     Returns 0 if successful, else number of bytes not read
  122.     (More likely 0 or error report)
  123.  
  124.  
  125. FNclaim(size%)
  126.     Claim size% bytes from free memory
  127.     Note this is NOT a heap (yet), so memory claims are fixed
  128.     All claims are word-aligned
  129.     NOTE: Negative claims are allowed...
  130.  
  131. PROCflush
  132.     Release all workspace (except that required by BASIC)
  133.  
  134.  
  135. FNlosearg(argument_string$)
  136.     Returns argument string without first argument
  137.  
  138. FNstripspaces(string$)
  139.     Removes excess spaces at start and end of string
  140.