======= InUse.nameFile ===============================

COPYRIGHT 1991
Robert A. Jenkins, Ph.D.
22901 Shagbark Lane
Miller Woods, IL 60411
(708) 758-0344
All Rights Reserved
Rick Stiles may distribute it as he pleases.

=============================================================================
While writing a whole new set of commands for a wordprocessor I found myself
with difficulties in keeping track of the keys that I had used and the files
in which I had used them.  I finally decided that it would be a good idea to
take the time to write commands to list the commands automatically.  It is so
much easier to do good work when the drudgery is taken care of by the
computer....
=============================================================================

List commands in curFile
<shftAltCtl-l:
   putMsg("Scanning, please wait....")
   equateNum(n0,curFile)
   getFileName(buf54,curFile)
   setSearch(":$/")
   moveCursor(buf54,eFile)
   if (search(buf54,sHilite,eHilite,-1)) {
      equateLoc(buf54,sHilite,sFile)
      clearRgn(buf54,hilite) }
   moveCursor(buf[n0],sFile)
   setSearch("<")
   while (search(buf[n0],sHilite,eHilite,1)) {
      moveCursor(buf[n0],sHilite)
      if (!is(buf[n0],sLine)) goto label(0)                      ..skip this <
      incLoc(buf[n0],sHilite)
      moveCursor(buf[n0],eHilite)
      while (!is(buf[n0],":")) {
         moveCursor(buf[n0],eChar)
         if (is(buf[n0],">")) goto label(0)                  ..skip if default
         if (is(buf[n0]," ")) goto label(0)            ..skip if illegal space
         if (is(buf[n0],eLine)) goto label(0) }        ..skip if no matching :
      equateLoc(buf[n0],eHilite,atCursor)
      ..clean, except it picks up <RAM:uejunk> in config!
      ..alertUser("Found KeyName")..debug
      insertRgn(buf41,eFile,buf[n0],hilite)
      ..add fileName
      moveCursor(buf41,eFile)
      locToCol(buf41,n54,atCursor)
      while (gtNum(25,n54)) {
         insertChar(buf41," ")
         locToCol(buf41,n54,atCursor) }
      insertRgn(buf41,eFile,buf54,all)
      ..add page#:line#
      insertChar(buf41," ")
      getPageRowCol(n54,n55,n56) ..of name in curFile
      toWord(buf41,n54)
      insertChar(buf41,":")
      toWord(buf41,n55)
      insertChar(buf41,eLine)
      LABEL(0) }
   nameBuffer(buf41,"RAD:commandList")
   putMsg("Done")
   >Friday 22-Feb-91 20:31:38

Pad page # and line # for correct sorting
<shftAltCtl-k:
   ..pad page# and line# to three digits
   ..first, pad "config!" to "config! "
   moveCursor(curFile,sFile)
   setSearch("config! ")
   while (search(curFile,sHilite,eHilite,1)) {
      moveCursor(curFile,eHilite)
      insertChar(curFile," ") }
   moveCursor(curFile,sFile)
   setSearch(":")
   while (search(curFile,sHilite,eHilite,1)) {
      getPageRowCol(n51,n52,n53)
      if (gtNum(37,n53)) { ..pad page#
         while (!is(curFile,whitespace)) moveCursor(curFile,sChar)
         moveCursor(curFile,eChar)
         sub(n50,37,n53)
         ..putMsg(n50) alertUser("ready to pad page#")
         do (n51,1,n50) insertChar(curFile,"0") }
      moveCursor(curFile,eLine)
      getPageRowCol(n51,n52,n53)
      if (gtNum(41,n53)) { ..pad line#
         while (!is(curFile,":")) moveCursor(curFile,sChar)
         moveCursor(curFile,eChar)
         sub(n50,41,n53)
         ..putMsg(n50) alertUser("ready to pad line#")
         do (n51,1,n50) insertChar(curFile,"0") } }
   putMsg("Done")
   refreshDisplay
   >Friday 22-Feb-91 21:33:56

List commands in given directory
<shftAltCtl-m:
   putMsg("Input dirpath containing config!? files:")
   inputString(buf57)  ..show last one
   freeBuf(buf55)
   insertRgn(buf55,sFile,buf57,all)
   insertRgn(buf55,sFile,"LIST ",all)
   insertRgn(buf55,eFile," QUICK ",all)
   freeBuf(buf42)
   execute (buf42,buf55)
   editBuf(buf42)
   ..delete everything except config!? files from list
   freeBuf(buf41)
   while (nothing) {
      if (is(curFile,eFile)) goto label(0)
      if (!is(curFile,sLine)) moveCursor(curFile,sLine)
      equateLoc(curFile,sHilite,atCursor)
      do (n0,1,7) moveCursor(curFile,eChar)
      equateLoc(curFile,eHilite,atCursor)
      freeBuf(buf43)
      insertRgn(buf43,sFile,curFile,hilite)
      setSearch("config!")
      ..alertUser("checking for config!")
      if (!search(buf43,sHilite,eHilite,-1)) {
            moveCursor(curFile,eLine)
            moveCursor(curFile,eChar)
            equateLoc(curFile,eHilite,atCursor)
            clearRgn(curFile,hilite) }
         else
            if (!moveCursor(curFile,downLine)) goto label(0) }          ..exit
   LABEL(0)
   runKey(alt-2)  ..del trailing white
   runKey(normal-bs) ..delete EOL on last line
   moveCursor(curFile,sFile)
   if (!askYesNo("List commands in these config! files?")) return
   while (nothing) {
      ..get a file name
      equateLoc(buf42,sHilite,atCursor)
      moveCursor(buf42,eLine)
      equateLoc(buf42,eHilite,atCursor)
      ..alertUser("got name of file")..debug
      ..create pathname
      freeBuf(buf55)
      insertRgn(buf55,sFile,buf57,all)
      if (!is(buf55,":")) insertChar(buf55,"/")
      insertRgn(buf55,eFile,buf42,hilite)
      loadFile(buf55)
      equateNum(n1,curFile) ..record buf# to delete later
      runKey(shftAltCtl-l)  ..list this file
      ..alertUser("current list")..debug
      freeBuf(buf[n1])
      if (!moveCursor(buf42,downLine)) goto label(1)                  ..exit
      moveCursor(buf42,sLine) }
   LABEL(1)
   editBuf(buf41)
   putMsg("Command list, padding page# and line#, please wait....")
   runKey(shftAltCtl-k)
   putMsg("Sorting, please wait....")
   runKey(shftAlt-s)  ..sort
   
   putMsg("Scanning for duplicates")
   moveCursor(buf41,sFile)
   LABEL(2)
   ..pick up a name
   if (!is(buf41,sLine)) moveCursor(buf41,sLine)
   equateLoc(buf41,sHilite,atCursor)
   do (n0,1,24) moveCursor(buf41,eChar)
   equateLoc(buf41,eHilite,atCursor)
   freeBuf(buf55)
   insertRgn(buf55,sFile,buf41,hilite)
   ..alertUser("first name")..debug
   moveCursor(buf41,eLine) moveCursor(curFile,downLine)
   ..alertUser("next line")..debug
   if (is(buf41,eFile)) {
      putMsg("Done")
      returnTrue }
   moveCursor(buf41,sLine)
   ..pick up next name
   equateLoc(buf41,sHilite,atCursor)
   do (n0,1,24) moveCursor(buf41,eChar)
   equateLoc(buf41,eHilite,atCursor)
   freeBuf(buf56)
   insertRgn(buf56,sFile,buf41,hilite)
   ..alertUser("checking this one")..debug
   setSearch(buf56)
   if (search(buf55,sHilite,eHilite,-1)) {
      vScroll(atCursor)
      if (askYesNo("DUPLICATE of line above, look for more?")) 
            goto label(2)
         else {
            putMsg(" ")
            return } }
   goto label(2)
   >Friday 22-Feb-91 22:24:57
