home *** CD-ROM | disk | FTP | other *** search
/ Fresh Fonts 1 / freshfonts1.bin / programs / amiga / tpp / rexx / getxref.tpl < prev    next >
Text File  |  1993-10-06  |  2KB  |  111 lines

  1. /** $VER: GetXRef.tpl 1.0 (27.05.92)
  2.  ** Written by Martin Steppler
  3.  **
  4.  ** Written by David N. Junod
  5.  **
  6.  ** Display the hypertext Autodoc page for the word currently under the
  7.  ** cursor.
  8.  **
  9.  ** Add the following lines to your S:user-startup file.
  10.  **
  11.  **   RX "AddLib('amigaguide.library',0,-30)"
  12.  **   RX "LoadXRef('autodocs.xref')"
  13.  **
  14.  **/
  15.  
  16. OPTIONS RESULTS
  17. PARSE ARG mode word
  18.  
  19. ADDRESS 'TextPlus'
  20.  
  21. IF ~SHOW('L','amigaguide.library') THEN
  22.    CALL ADDLIB('amigaguide.library',0,-30)
  23.  
  24. /* Did they pass a word? */
  25. IF word = "" THEN DO
  26.  
  27.   /* Get the word from under the cursor */
  28.   'GetWord'
  29.   word = RESULT
  30.   /* strip off anything beyond '(' */
  31.   /* e.g. CloseScreen(Screen) --> CloseScreen */
  32.   brace_pos = POS('(', word)
  33.   IF brace_pos > 1 THEN
  34.      word = LEFT(word, brace_pos - 1)
  35.   END
  36.  
  37. /* See if the Autodoc cross-reference table is loaded */
  38. line = GetXRef("OpenWindow()")
  39. IF line = 10 THEN DO
  40.  
  41.    /* Show that we're doing something */
  42.    message = 'Loading cross-reference file...'
  43.    'Display' message
  44.  
  45.    /* The Autodoc table wasn't loaded, so load it. */
  46.    LoadXRef(autodocs.xref)
  47.    END
  48.  
  49. /* See if the word is in the cross-reference table */
  50. function = word
  51. xref = 0
  52. line = GetXRef(function)
  53. IF line = 10 THEN DO
  54.   /* Add the parens to the name */
  55.   function = word||"()"
  56.  
  57.   /* Try again */
  58.   line = GetXRef(function)
  59.   IF line = 10 THEN DO
  60.      function = word
  61.      END
  62.   ELSE DO
  63.      xref = 1
  64.      END
  65.   END
  66. ELSE DO
  67.   xref = 1
  68.   END
  69.  
  70. /* Show that we're doing something */
  71. message = 'Loading '||function||'...'
  72. 'Display' message
  73.  
  74. /* get screen name */
  75. 'GetScreenName'
  76. pub_name = result
  77.  
  78. /* See if we have an Autodoc viewing window open */
  79. IF ~SHOW('P','AUTODOCS') THEN DO
  80.  
  81.   /* See if we are trying to load a database or a document */
  82.   IF xref = 0 THEN
  83.      cmd = "run SYS:Utilities/AmigaGuide "||function||" portname AUTODOCS pubscreen "||pub_name
  84.   ELSE
  85.      cmd = "run SYS:Utilities/AmigaGuide document "||function||" portname AUTODOCS pubscreen "||pub_name
  86.  
  87.   ADDRESS COMMAND cmd
  88.  
  89.   END
  90.  
  91. ELSE DO
  92.  
  93.   /* What command do we use to show the node */
  94.   link = "Link"
  95.   IF mode = "ASYNC" THEN
  96.      link = "ALink"
  97.  
  98.   /* See if we are trying to load a database or a document */
  99.   IF xref = 0 THEN
  100.      cmd = link||" "||function||"/main"
  101.   ELSE
  102.      cmd = link||" "||function
  103.  
  104.   /* Align the window */
  105.   ADDRESS AUTODOCS cmd
  106.  
  107.   /* I want it to come to the front, because I have limited space */
  108.   ADDRESS AUTODOCS "windowtofront"
  109.  
  110.   END
  111.