home *** CD-ROM | disk | FTP | other *** search
/ Aminet 33 / Aminet 33 - October 1999.iso / Aminet / dev / misc / FetchRefs1.3.lha / FetchRefs1.3 / Scripts / GoFetchRefs.ged < prev    next >
Encoding:
Text File  |  1996-02-24  |  2.2 KB  |  88 lines

  1. /*   $VER: GoFetchRexx.ged 1.2 (24.2.96)
  2. **
  3. **   ARexx script to invoke FetchRefs from GoldED.
  4. */
  5.  
  6. /* Static part of the ARexx port name of the editor. That is, the name before 
  7.  * any suffixes (like '.1') are appended.
  8.  */
  9. editorname = 'GOLDED'
  10.  
  11. /* Set some options of ARexx */
  12. OPTIONS RESULTS
  13. OPTIONS FAILAT 21
  14. SIGNAL ON SYNTAX
  15.  
  16. /* Get the name of the ARexx port of the caller and return an error if it
  17.  * is not like the 'editorname' variable above.
  18.  */
  19. caller = ADDRESS()
  20. IF (LEFT(caller, LENGTH(editorname)) ~= editorname) THEN
  21.     EXIT 10
  22.  
  23. /* Get the current line and cursor position from the editor. */
  24. 'Lock Current'
  25. IF (rc ~= 0) THEN
  26.     EXIT 0
  27. 'Query Buffer'
  28. line = result
  29. 'Query Column'
  30. position = result
  31.  
  32. /* Isolate the actual word */
  33. function = line
  34. function = RIGHT(function, LENGTH(function) - position + 1)
  35. cutat = VERIFY(function, "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890_")
  36. IF cutat > 0 THEN
  37.     function = LEFT(function, cutat - 1)
  38.  
  39. /* Define a temporary filename to put the reference into */
  40. filename = 'T:FR_' function
  41.  
  42. /* It doesn't matter whether we want a taglist, varargs og whatever function */
  43. IF RIGHT(function, 7) = "TagList" THEN
  44.     function = LEFT(function, LENGTH(function) - 7)
  45. ELSE IF RIGHT(function, 4) = "Tags" THEN
  46.     function = LEFT(function, LENGTH(function) - 4)
  47. ELSE IF RIGHT(function, 1) = "A" THEN
  48.     function = LEFT(function, LENGTH(function) - 1)
  49.  
  50. /* Now actually get the reference */
  51. ADDRESS 'FETCHREFS'
  52. FR_GET function || '(%|Tags|TagList|A)' filename FILEREF
  53. gotoline = rc2
  54.  
  55. /* Address editor again to load the file */
  56. ADDRESS VALUE caller
  57.  
  58. IF rc ~= 0 THEN DO
  59.     /* Some kind of error happend. Report it. This may be a simple
  60.      * "Aborted" or "No reference" message.
  61.      */
  62.     Request Status '"'RC2'"'
  63.  
  64.     /* Return to editor. */
  65.     'Unlock'
  66.     EXIT 0
  67. END
  68. ELSE DO
  69.     /* Make the editor open a new window and load the reference into it. */
  70.     'Open New Name' filename
  71.  
  72.     /* If FetchRefs provided us with a goto line then we jump to that line. */
  73.     IF gotoline ~= 0 THEN
  74.     'Goto' gotoline
  75.     'Unlock'
  76.  
  77.     /* Delete the temporary file */
  78.     ADDRESS COMMAND 'Run >NIL: C:Delete >NIL:' filename
  79.  
  80.     EXIT 0
  81. END
  82.  
  83. SYNTAX:
  84.     ADDRESS VALUE caller
  85.     'Unlock'
  86.     EXIT 0
  87.  
  88.