home *** CD-ROM | disk | FTP | other *** search
- /* $VER: GoFetchRexx.aed 1.1 (28.10.94)
- **
- ** ARexx script for AmokEd to invoke FetchRefs.
- */
-
- OPTIONS RESULTS
- caller = ADDRESS()
-
- /* Static part of the editor's ARexx port name. That is, the name before any
- * suffixes (like '.1') are appended.
- */
- editorname = 'AmokEd'
-
- /* Exit if we're not called from the editor */
- IF (LEFT(caller, LENGTH(editorname)) ~= editorname) then
- EXIT 10
-
- /* Get the function name from editor (get current word). */
- "scanf `%[abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890_#?]s'"
- 'getval $scanf'
- function = result
-
- /* Define a temporary filename to put the reference into */
- cutat = VERIFY(function, "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890_")
- if cutat > 0 THEN
- basename = LEFT(function, cutat - 1)
- ELSE
- basename = function
-
- filename = 'T:FR_ 'basename
-
- /* It doesn't matter whether we want a taglist, varargs og whatever function */
- IF RIGHT(function, 7) = "TagList" THEN
- function = LEFT(function, LENGTH(function) - 7)
- ELSE IF RIGHT(function, 4) = "Tags" THEN
- function = LEFT(function, LENGTH(function) - 4)
- ELSE IF RIGHT(function, 1) = "A" THEN
- function = LEFT(function, LENGTH(function) - 1)
-
- /* Now actually get the reference */
- ADDRESS 'FETCHREFS'
- FR_GET function || '(%|Tags|TagList|A)' filename CASE FILEREF
- gotoline = rc2
-
- /* Address editor again to load the file or report error */
- ADDRESS VALUE caller
-
- IF rc ~= 0 THEN DO
- /* Skip if the error was '...!' (actually 'Aborted!'). This occours
- * whenever the 'select from what file' window is closed, which is
- * not really an error.
- */
- IF RIGHT(rc2, 1) = '!' THEN
- EXIT 0
-
- /* Report the error (obtained from FetchRefs) in the editor. */
- Title '('RC2')'
-
- /* Return that it was a failure */
- EXIT 10
- END
- ELSE DO
- /* Make the editor open a new window and load the autodoc into it. */
- NewWindow
- Ping 9 Pong 9 /* AmokEd bug fix; kludge to activate the new window */
- NewFile filename
-
- /* Jump to the provided line */
- IF gotoline ~= 0 THEN
- 'Goto' gotoline
-
- /* Delete the autodoc file */
- ADDRESS COMMAND 'C:Delete >NIL:' filename
-
- EXIT 0
- END
-
-