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