home *** CD-ROM | disk | FTP | other *** search
/ The Developer Connection…ice Driver Kit for OS/2 3 / DEV3-D1.ISO / devtools / sbl / sbleval / grep.sbl < prev    next >
Encoding:
Text File  |  1993-04-08  |  1.8 KB  |  72 lines

  1. REM    **********************************************************************
  2. REM    **************** Exclusive Property of Softbridge ********************
  3. REM    **********************************************************************
  4.  
  5.  
  6.  
  7. '------------------------- Subprogram Grep -------------------------
  8. sub grep
  9.      Dim message$
  10.      Dim finds%
  11.  
  12.   do
  13.      begin dialog GrepDialog 100,60
  14.           caption "GREP search"
  15.           text 5,7,40,10,"GREP for:"
  16.           textbox 40,5,55,13,.text
  17.           checkbox 20,18,70,13,"case sensitive",.case
  18.           text 5,50,90,10,message$
  19.           ButtonGroup .button
  20.           Button 5,33,40,15,"GREP"
  21.           Button 55,33,40,15,"Exit"
  22.      end dialog
  23.      
  24.      dim sf as SearchFind
  25.      dim ed as Edit
  26.      Dim gd as GrepDialog
  27.      
  28.      Dialog gd
  29.      if (gd.button = 1) then exit do     
  30.      if (gd.text = "") then
  31.           message$="Nothing to GREP for."
  32.           goto nextDo
  33.      end if
  34.      
  35.      finds = 0
  36.      
  37.      ed.selStart = 0
  38.      ed.selEnd = 0
  39.      Edit ed                       ' Go to top of text
  40.      
  41.      sf.searchFor = gd.text
  42.      sf.forward = 1
  43.      sf.caseSensitive = gd.case
  44.      sf.quiet = 1
  45.      SearchFind sf
  46.      do
  47.           GetCurValues sf
  48.           if (sf.found <> 0) then
  49.                finds = finds + 1
  50.                SearchFind sf
  51.           end if
  52.      loop while sf.found <> 0
  53.  
  54.      select case finds
  55.           case 0
  56.                message$="Didn't find '"+sf.searchFor+"'."
  57.           case 1
  58.                message$="Found '"+sf.searchFor+"' 1 time."
  59.           case else
  60.                message$="Found '"+sf.searchFor+"'"+str$(finds)+" times."
  61.      end select
  62.      
  63. nextDo:
  64.      
  65.   loop
  66. end sub
  67.  
  68. '------------------------------ MAIN --------------------------------------
  69. sub Main
  70.      Call Grep    
  71. end sub
  72.