home *** CD-ROM | disk | FTP | other *** search
/ Gold Fish 3 / goldfish_volume_3.bin / files / text / edit / macro / devkit / getautodocs.ged next >
Text File  |  1994-05-05  |  3KB  |  96 lines

  1. /* $VER: 0.4 19-04-94                                                   */
  2. /* (1994) Krzysztof P. Jasiutowicz. GetAutoDocs Arexx macro for GoldED  */
  3. /* Requirements!!!                                                      */
  4. /* 1. GetAutodocs - part of DevKit available on Fish disks              */
  5. /* 2. AutoDocs: assign - where AutoDocs reside                          */
  6. /* 3. Arexx                                                             */
  7. /* Adapted from ©1989 Peter Cherna CED<->rexx script Lookup.ced         */
  8.  
  9. OPTIONS RESULTS                             /* enable return codes      */
  10.  
  11. if (LEFT(ADDRESS(), 6) ~= "GOLDED") then    /* not started by GoldEd ?  */
  12.     address 'GOLDED.1'
  13.  
  14. 'LOCK CURRENT'                              /* lock GUI, gain access    */
  15. OPTIONS FAILAT 6                            /* ignore warnings          */
  16. SIGNAL ON SYNTAX                            /* ensure clean exit        */
  17.  
  18.  
  19.  /* get word under cursor */
  20. 'QUERY WORD VAR FUNC'
  21. startpos=pos('=', FUNC )+1
  22.  
  23. FUNC=substr(FUNC,startpos)
  24.  
  25.  /* status bar message       */
  26. 'REQUEST STATUS="Searching for autodoc ..."'
  27.  
  28.  /* build filename */
  29. filename = 'T:' || FUNC || '.autodoc'
  30.  
  31.  /* calling GetAutoDoc by © 1989 Peter Cherna          */
  32. address command 'GetAutoDoc >' || filename || ' ' || FUNC
  33.  
  34.  /* can't find resulting autodoc entry */
  35. if open('autodocfile',filename) = 0 then
  36.    DO
  37.     'REQUEST BODY="GetAutoDoc failed !"'
  38.     'UNLOCK'
  39.     exit
  40.    END
  41.         /* main processing */
  42.         else
  43.              DO
  44.                 line = readln('autodocfile')
  45.                 call close 'autodocfile'
  46.                 if left(line,1) = '-' then
  47.                     DO
  48.                         address command 'delete >NIL:' filename
  49.                         'REQUEST BODY="'FUNC' definition not found"'
  50.                         UNLOCK
  51.                         exit
  52.                     END
  53.                 ELSE
  54.                     DO
  55.  
  56.                         'QUERY WINDOWS VAR NUMWINS'
  57.  
  58.                         /* get the name of the adoc file */
  59.                         adocfile= getclip('adocwindow')
  60.  
  61.                         /* get the name of the file in the current window */
  62.                         'QUERY FILE '
  63.  
  64.                         /* we're in the helpwindow itself*/
  65.                         if RESULT~=adocfile THEN
  66.                          DO
  67.                                /* cycle through */
  68.                             DO NUMWINS=NUMWINS TO 1 BY -1 until RESULT = adocfile
  69.  
  70.                                 'WINDOW NEXT'
  71.                                 'QUERY FILE'
  72.                             END
  73.                          END
  74.                            /* if we haven't got a helpwindow */
  75.                           if RESULT~=adocfile then
  76.                               DO
  77.                                     'MORE'
  78.                               END
  79.                     END
  80.  
  81.                  'OPEN NAME 'filename' QUIET'
  82.                  'QUERY FILE'
  83.                  call setclip 'adocwindow',RESULT
  84.  
  85.        /* delete left-overs */
  86.        address command 'delete >NIL:' filename
  87.  
  88. 'UNLOCK' /* VERY important: unlock GUI */
  89. EXIT
  90.  
  91. SYNTAX:
  92.  
  93. SAY "Sorry, error line" SIGL ":" ERRORTEXT(RC) ":-("
  94. 'UNLOCK'
  95. EXIT
  96.