home *** CD-ROM | disk | FTP | other *** search
- /* $VER: GoFetchRexx.ged 1.1 (28.10.94)
- **
- ** ARexx script to invoke FetchRefs from GoldED.
- */
-
- /* Static part of the editor's ARexx port name. That is, the name before any
- * suffixes (like '.1') are appended.
- */
- editorname = 'GOLDED'
-
- /* Set some options of ARexx */
- OPTIONS RESULTS
- OPTIONS FAILAT 21
- SIGNAL ON SYNTAX
-
- /* Get the name of the ARexx port of the caller and return an error if it
- * is not like the 'editorname' variable above.
- */
- caller = ADDRESS()
- IF (LEFT(caller, LENGTH(editorname)) ~= editorname) THEN
- EXIT 10
-
- /* Get the current line and cursor position from the editor. */
- 'Lock Current'
- IF (rc ~= 0) THEN
- EXIT 0
- 'Query Buffer'
- line = result
- 'Query Column'
- position = result
-
- /* Isolate the actual word */
- function = line
- function = RIGHT(function, LENGTH(function) - position + 1)
- cutat = VERIFY(function, "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890_#?")
-
- IF cutat > 0 THEN
- function = LEFT(function, cutat - 1)
-
- /* 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 */
- ADDRESS VALUE caller
-
- IF rc ~= 0 THEN DO
- /* Skip if the error was '.....!'. This occours whenever the 'select
- * from what file' window is closed, which is not really an error, so
- * I don't want it reported.
- */
- IF RIGHT(rc2, 1) = '!' THEN DO
- 'UnLock'
- EXIT 0
- END
-
- /* Report the error (obtained from FetchRefs) in the editor. */
- Request Status '"'RC2'"'
-
- /* Return to editor. */
- 'Unlock'
- EXIT 0
- END
- ELSE DO
- /* Make the editor open a new window and load the reference into it. */
- 'Open New Name' filename
-
- /* If FetchRefs provided us with a goto line then we jump to that line. */
- IF gotoline ~= 0 THEN
- 'Goto' gotoline
- 'Unlock'
-
- /* Delete the temporary file */
- ADDRESS COMMAND 'Run >NIL: C:Delete >NIL:' filename
-
- EXIT 0
- END
-
- SYNTAX:
- ADDRESS VALUE caller
- 'Unlock'
- EXIT 0
-
-