home *** CD-ROM | disk | FTP | other *** search
/ Club Amiga de Montreal - CAM / CAM_CD_1.iso / files / 411b.lha / UEdit_v2.6a / Config!R < prev    next >
Text File  |  1990-09-04  |  10KB  |  283 lines

  1. ======= AREXX CMDS ======
  2. Major modifications to this file by Kerry Zimmerman [71470,1340] 4/14/89
  3. o  Changed output buffer to 62, input buffer to 61 to avoid conflict with
  4.    Eric Kennedy's VI extensions.
  5. o  altctl-9 now displays current autotraffic status
  6. o  altctl-0 now asks for a command name and a list of macronums.
  7.    It adds these to the end of file U:REXXCOMM.  This file is a database
  8.    of macros understood by the new rexx autotraffic handler.
  9.  
  10. Edit Rexx output buffer 62
  11. <altCtl-1:
  12.     equateLoc(buf62,sPage,sFile)
  13.     editBuf(buf62) >
  14.  
  15. Edit Rexx input buffer 61
  16. <altCtl-2:
  17.     equateLoc(buf61,sPage,sFile)
  18.     editBuf(buf61) >
  19.  
  20. Send output buffer 62 to Rexx
  21. <altCtl-3:
  22.     equateNum(n98,0)                     .. 0 flag means send msg, not reply
  23.     rexxOut(buf62,all,0,n98,n99)   .. 0 ActionResult means default to RXCOMM
  24.     runKey(virtual-s) >
  25.  
  26. Fetch Rexx input into buffer 61
  27. <altCtl-4:
  28.     if (rexxIn(buf61,sFile,n97,n98,n99)) 
  29.         ..if (eqNum(n98,0)) {       .. if Msg
  30.             equateLoc(buf61,sPage,sFile)
  31.             editBuf(buf61)
  32.         ..}
  33.      runKey(virtual-r) >
  34.  
  35. Send hilite region to Rexx.
  36. <altCtl-5:
  37.     equateNum(n98,0)                               .. 0 means msg, not reply
  38.     rexxOut(curFile,hilite,0,n98,n99)  .. 0 means default to Action = RXCOMM
  39.     runKey(virtual-s) >
  40.  
  41. Fetch Rexx input at cursor
  42. <altCtl-6:
  43.     rexxIn(curFile,atCursor,n97,n98,n99)
  44.     runKey(virtual-r) >
  45.  
  46. Send an OK reply to Rexx  (NOTE: Amiga-ESC abort sends Failed reply.)
  47. <altCtl-7:
  48.     equateNum(n98,1)                               .. 1 means reply, not msg
  49.     rexxOut(" ",all,0,n98,n99)                           .. 0 is OKAY result
  50.     runKey(virtual-s) >
  51.  
  52. Send an OK reply to Rexx along with text in hilite region
  53. <altCtl-8:
  54.     equateNum(n98,1)
  55.     rexxOut(curFile,hilite,0,n98,n99) ..text NOT sent, if not RXFB_RESULT msg
  56.     runKey(virtual-s) >
  57.  
  58. Toggle flag to handle Rexx traffic automatically during idle periods.
  59. <altCtl-9:
  60.                                            .. set idletime back to old value
  61.     if (getFlag(curFile,userGlobalB)) {
  62.         equateNum(idleTime,n36)
  63.         putMsg("AutoTraffic is OFF")
  64.     }
  65.     else {                .. idleTime not 0, toggle to auto-traffic handling
  66.         equateNum(n36,idleTime)                     .. store idleTime in n36
  67.         equateNum(idleTime,0)                           .. set idleTime to 0
  68.         putMsg("AutoTraffic is ON")
  69.     }
  70.     flipFlag(curFile,userGlobalB)                             .. toggle flag
  71.     swapKey(idle,virtual-t)         .. swap in/out the auto-traffic idle cmd
  72. >
  73.  
  74.  
  75. Make an x.rexx program with commands to send to Uedit.
  76. <altCtl-0:
  77.     freebuf(buf35)
  78.     if (!loadfile("REXXCOMM")) loadfile("S:REXXCOMM")
  79.     movecursor(curFile,eFile)
  80.     putmsg("Enter new command's name")
  81.     freebuf(buf50)
  82.     inputString(buf50)
  83.     insertRgn(curFile,atCursor,buf50,all)
  84.     insertRgn(curFile,atCursor,"        |
  85. ",all)
  86.     movecursor(curFile,sChar)
  87.     movecursor(curFile,sChar)
  88.     updateDisplay
  89.     while (nothing) {
  90.         putMsg("Give desired inputs.  Amiga-ESC when done.  F2 to save.")
  91.         getKeyVal(macroNum,inputChar)
  92.         toWord(curFile,macroNum)
  93.         insertChar(curFile,"+")
  94.         toWord(curFile,inputChar)
  95.         insertChar(curFile," ")
  96.         updateDisplay
  97.         fileSize(curFile,n54) .. force pack, avoid mem-abort
  98.     }
  99. >
  100.  
  101. <virtual-t:
  102.     if (rexxIn(buf61,eFile,n97,n98,n99)) {           .. if fetched something
  103.          ..runKey(virtual-r)         .. show flags - slower if use this line
  104.         if (eqNum(n98,0)) {                   .. if recvd a Msg, not a Reply
  105.  
  106.             equateNum(n96,0)
  107.             push(n99,searchCaps)     .. (RS mod)
  108.             equateNum(searchCaps,0) .. turn off case sensitivity (RS mod)
  109.             runkey(virtual-y) 
  110.             pop(n99,searchCaps)      .. restore orig case sensitivity (RS mod)
  111.             freeBuf(buf61)
  112.             if(not eqNum(n96,0)) return .. comand already sent a reply
  113.             if(eqLoc(curFile,sInvert,eInvert)) goto label(50)
  114.             rexxOut(curFile,Invert,0,1,n99) .. search uses this as an example
  115.             return
  116.  
  117. label(50)   rexxOut(" ",all,0,1,n99)
  118.         }
  119.     }
  120. >
  121.  
  122. handle named macro messages
  123. <virtual-y:
  124.                 .. if buf35 doesn't contain the named commands yet
  125.                 .. read it in
  126.                     moveCursor(buf35,sfile)
  127.                     freeBuf(buf50)
  128.                     insertRgn(buf50,atCursor,"REXXCOMM",all)
  129.                       setSearch(buf50)
  130.                       if(not search(buf35,sHilite,eHilite,1)) {
  131.                         freeBuf(buf35)
  132.                         if(not insertFile(buf35,sfile,"REXXCOMM")) {
  133.                             putmsg("file REXXCOMM not found")
  134.                             returnFalse
  135.                         }
  136.                     }
  137.                     
  138.                 .. extract 1st word of buf61 which is the command
  139.                     moveCursor(buf61,sfile)
  140.                     equateLoc(buf61,sHilite,atCursor)
  141.                     moveCursor(buf61,eWord)
  142.                     equateLoc(buf61,eHilite,atCursor)
  143.                     freebuf(buf50)
  144.                     insertRgn(buf50,sFile,buf61,Hilite) ..save command
  145.  
  146.                     clearRgn(buf61,Hilite) ..erase command leaving any args
  147.                     while(is(buf61,whiteSpace))
  148.                         clearChar(buf61)
  149.                     setSearch(buf50)
  150.  
  151.                 .. search for this command in list of commands in buf35
  152.                     moveCursor(buf35,sfile)
  153.                     moveCursor(buf35,eLine) .. start search after 1st line
  154.                     if(not search(buf35,sHilite,eHilite,1)) {
  155.                         freeBuf(buf54)
  156.                         insertRgn(buf54,efile,"REXX command NOT found: ",all)
  157.                         insertRgn(buf54,efile,buf50,all)
  158.                         returnFalse
  159.                     }
  160.                     
  161.                 .. move to the first macronum
  162.                     moveCursor(buf35,eHilite)
  163.                 
  164.                 .. process each macronum+inputchar pair until "|" found
  165.            
  166.            label(10)
  167.                     while(is(buf35,whitespace))
  168.                         moveCursor(buf35,echar)
  169.                 .. return if end of commands
  170.                     if(is(buf35,"|") | is(buf35,eFile)) returnTrue
  171.                     
  172.                 .. convert xx+yy to macronum-xx, inputchar-yy
  173.                     eqNum(macroNum,0)
  174.                     eqNum(inputChar,0)
  175.                     if(is(buf35,digit)) {
  176.                         toNumber(macroNum,buf35)
  177.                         while(is(buf35,digit))
  178.                             moveCursor(buf35,echar)
  179.                         if(is(buf35,"+")){
  180.                             moveCursor(buf35,echar)
  181.                             if(is(buf35,digit)){
  182.                                 toNumber(inputChar,buf35)
  183.                                 while(is(buf35,digit))
  184.                                     moveCursor(buf35,echar)
  185.                             }
  186.                         }
  187.                     }
  188.                  .. run valid macroNum, or type valid inputChar
  189.                     if(inUse(macroNum)) runKey(macroNum)
  190.                     else if(gtNum(inputChar,0)) TypeChar(inputChar)
  191.                     goto label(10) >
  192.                     
  193.                     
  194. Show numbers for a received Arexx msg or reply
  195. <virtual-r:
  196.         if (not eqNum(n99,0)) runKey(virtual-m)           .. rexxIn() failed
  197.         else {                                         .. rexxIn() succeeded
  198.             if (eqNum(n98,0)) {              .. MSG: show action & modifiers
  199.                 and(n96,n97,0X0F000000)                .. get ACTION code
  200.                 and(n95,n97,0X000F0000)                .. get MODIFIER
  201.                 if(gtNum(n95,0)) div(n95,n95,0x10000)
  202.                 freeBuf(buf54)
  203.                 insertRgn(buf54,atCursor,"Msg fetched:  Action = ",all)
  204.                 toWord(buf54,n96)
  205.                 insertRgn(buf54,atCursor,"  Modifier = ",all)
  206.                 toWord(buf54,n95)
  207.                 ..insertRgn(buf54,atCursor,"  -- press return",all)
  208.                 putMsg(buf54)
  209.             } else {                                              .. REPLY:
  210.                 if (eqNum(n97,0)) putMsg("Reply fetched.  Result OKAY")
  211.                 else {
  212.                     freeBuf(buf54)
  213.                     insertRgn(buf54,atCursor,
  214.                         "Reply received:  Result = ERROR ",all)
  215.                     toWord(buf54,n97)
  216.                     ..insertRgn(buf54,atCursor,"  -- press return",all)
  217.                     putMsg(buf54)
  218.                 }
  219.             }
  220.         }
  221. ..getkey(n50)
  222. >
  223.  
  224. Show numbers for a sent ARexx msg or reply
  225. <virtual-s:
  226.         if (not eqNum(n99,0)) runKey(virtual-m)          .. rexxOut() failed
  227.         else {
  228.             if (eqNum(n98,0)) putMsg("Msg sent")
  229.             else              putMsg("Reply sent")
  230.         }
  231. >
  232.  
  233. Show returncode error msgs
  234. <virtual-m:
  235.     switch(n99) {
  236.     case(-1) { putMsg("ARexx not up") }
  237.     case(-2) { putMsg("No memory or no text") }
  238.     case(-3) { putMsg("Msg/reply > 65535 bytes") }
  239.     case(-4) { putMsg("Nothing to fetch or reply to") }
  240.     case(-5) { putMsg("Fetch reply before sending this msg/reply") }
  241.     }
  242.     returnFalse                   .. so virtual-r/-s above will return False
  243. >
  244.  
  245. ====================================================================
  246. Some useful functions for the arexx macros
  247.  
  248. The 'ask' macro.  Usage:  ask 'Do you want to continue?'
  249. ask a question and return true or false
  250. <virtual-i:
  251.         equateNum(n96,1)
  252.         if(askYesNo(buf61))
  253.             rexxOut("YES",all,0,1,n99)
  254.         else
  255.             rexxOut("NO",all,0,1,n99)
  256. >
  257.  
  258. the 'text' macro.  Usage:  text 'this will be inserted'
  259. insert text at cursor
  260. <virtual-h: insertRgn(curFile,atCursor,buf61,all) 
  261.             updatedisplay>
  262.  
  263. the 'loadfile' macro.  Usage: loadfile 'sys:myfile'
  264. edit given file
  265. <virtual-j:    loadfile(buf61)>
  266.  
  267. the 'gotoline' macro  Usage: gotoline 100
  268. goto line
  269. <virtual-n:    toNumber(n50,buf61)
  270.             lineToLoc(curFile,atCursor,n50) >
  271.  
  272. the 'searchfor' macro  Usage: searchfor pattern
  273. search for a given string
  274. <virtual-o:    push(buf99,buf61)
  275.             pop(buf99,buf49)
  276.             setsearch(buf49)
  277.             runkey(normal-f9) >
  278.  
  279. The 'message' macro  Usage: message 'my message'
  280. issue a message
  281. <virtual-p:    putmsg(buf61) >
  282.  
  283.