home *** CD-ROM | disk | FTP | other *** search
/ Stars of Shareware: Programmierung / SOURCE.mdf / programm / windows / c / xlisp21w / bin / xlisp.cmd next >
Encoding:
Text File  |  1993-04-10  |  1.2 KB  |  49 lines

  1. ;       Macro for XLisp - parenthesis searcher
  2.  
  3. store-procedure search-par
  4.     !if &equal $curchar 40
  5.         set %actchar 40
  6.         set %findchar 41 
  7.         set %direction 1
  8.     !else
  9.     !if &equal $curchar 41
  10.         set %actchar 41
  11.         set %findchar 40
  12.         set %direction 0
  13.     !else
  14.         print $curchar
  15.         !return
  16.     !endif
  17.     !endif
  18.     set %actctr 0       ;counter of the actual characters
  19.     !while 1
  20.         !if %direction
  21.             !force 1 forward-character
  22.             !if ¬ $status
  23.                 print "No matching )"
  24.                 !return
  25.             !endif
  26.         !else
  27.             !force 1 backward-character
  28.             !if ¬ $status
  29.                 print "No matching ("
  30.                 !return
  31.             !endif    
  32.         !endif 
  33.         !if &equal $curchar %findchar
  34.             !if &equal %actctr 0
  35.                 !return
  36.             !else
  37.                 set %actctr &sub %actctr 1
  38.             !endif
  39.         !else
  40.         !if &equal $curchar %actchar                       
  41.             set %actctr &add %actctr 1
  42.         !endif
  43.         !endif
  44.     !endwhile
  45. !endm
  46.  
  47. macro-to-key    search-par  A-Z
  48.     
  49.