home *** CD-ROM | disk | FTP | other *** search
/ PC PowerPlay 11 / PCPP11.iso / utils / frogbit / fb-097.exe / MATCHING.FB < prev    next >
Encoding:
Text File  |  1997-02-04  |  786 b   |  37 lines

  1.  
  2. // example: the 'matches' operator
  3.  
  4.  
  5. input "example.ini"
  6.  
  7. // 'section' keeps track of the current section
  8. set section equal to ""
  9.  
  10. // scan the .INI file ...
  11. do while (someLeft input)
  12.  
  13.   // read a line from the .INI file
  14.   read
  15.  
  16.   // ignore blank lines
  17.   if (line="")
  18.     // (do nothing)
  19.  
  20.   // extract section from "[...]" lines
  21.   elseif (line matches "[~(section)]")
  22.     // (nothing else to do ù 'section' has been set)
  23.  
  24.   // process "variable=value" lines
  25.   elseif (line matches "~(variable)=~(value)")
  26.     error "setting found before first section name" if (section="")
  27.     write (section ":" variable ":" value)
  28.  
  29.   else
  30.     error ("unrecognised line: " line)
  31.   endif
  32.  
  33.   // comment out the next line to make the program run faster
  34.   refresh
  35.  
  36. loop
  37.