home *** CD-ROM | disk | FTP | other *** search
/ BCI NET 2 / BCI NET 2.iso / archives / applications / wp / macro28.lha / Macro / FinsGold / Modula / GetM2XRef.ged < prev    next >
Encoding:
Text File  |  1994-04-20  |  4.3 KB  |  153 lines

  1. /** $VER: GetM2XRef.ged 0.1 (20. Apr. '94)
  2.  **
  3.  ** Written by Fin Schuppenhauer
  4.  **
  5.  ** Displays the definition module where the word under the cursor
  6.  ** was defined.
  7.  ** This script uses the cross-reference table, created by "Def2AG".
  8.  ** If you don't have that program, you can order it at the address
  9.  ** given below. Please include some money for my expenses. "Def2AG"
  10.  ** may also be available in the Aminet.
  11.  **
  12.  **                                 ***
  13.  **
  14.  ** Zeigt das Definitionsmodul an, in dem das Wort unter dem Cursor
  15.  ** definiert wurde.
  16.  ** Dieses Skript arbeitet mit der von "Def2AG" erzeugten Cross-
  17.  ** Referenz-Tabelle. Das Programm kann, wenn nicht vorhanden, für
  18.  ** einen Unkosten-Beitrag von 10 DM an der unten angegebenen Adresse
  19.  ** bezogen werden. "Def2AG" kann auch im Aminet verfügbar sein.
  20.  **
  21.  **
  22.  ** My address/Meine Adresse:
  23.  **
  24.  **   Fin Schuppenhauer
  25.  **   Brausspark 10
  26.  **   D-20537 Hamburg
  27.  **   (Germany)
  28.  **
  29.  ** E-Mail: 1schuppe@rzdspc2.informatik.uni-hamburg.de
  30.  **
  31.  ** This script is FREEWARE.
  32.  **
  33.  ** Thanks to:
  34.  **   Dietmar Eilert for his GoldED
  35.  **   David N. Junod (this script is based on his "getxref.ttx")
  36.  **/
  37.  
  38. OPTIONS RESULTS                             /* enable return codes     */
  39.  
  40. if (LEFT(ADDRESS(), 6) ~= "GOLDED") then    /* not started by GoldEd ? */
  41.     address 'GOLDED.1'
  42.  
  43. 'LOCK CURRENT'                              /* lock GUI, gain access   */
  44. OPTIONS FAILAT 6                            /* ignore warnings         */
  45. SIGNAL ON SYNTAX                            /* ensure clean exit       */
  46.  
  47.  
  48. /* ------------------------ INSERT YOUR CODE HERE: ------------------- */
  49.  
  50.  
  51. 'QUERY CAT'
  52. isGerman = (result = "deutsch")
  53.  
  54. /* amigaguide.library öffnen (falls dies noch nicht geschehen ist): */
  55. if ~show('L','amigaguide.library') then
  56.    if ~addlib('amigaguide.library',0,-30) then do
  57.       if isGerman then
  58.          'REQUEST BODY="Keine amigaguide.library vorhanden!" BUTTON=Abbrechen'
  59.       else
  60.          'REQUEST BODY="amigaguide.library not available!" BUTTON=Cancel'
  61.       'UNLOCK'
  62.       EXIT
  63.    end
  64.  
  65. /* Wort unter dem Cursor ermitteln: */
  66. 'QUERY WORD VAR WORT'
  67.  
  68. if isGerman then
  69.    'REQUEST BODY="Informationen laden für:" OLD='wort' STRING VAR=WORT'
  70. else
  71.    'REQUEST BODY="Loading information for:" OLD='wort' STRING VAR=WORT'
  72. if rc ~= 0 then do
  73.    'UNLOCK'
  74.    EXIT
  75. end
  76.  
  77. /* Autodoc cross-reference table laden, wenn noch nicht vorhanden: */
  78. line = GetXRef("OpenWindow")
  79. if line = 10 then do
  80.    if isGerman then
  81.       'REQUEST STATUS="Lade Cross-Reference Datei ..."'
  82.    else
  83.       'REQUEST STATUS="Loading cross-reference file ..."'
  84.    LoadXRef(modula.xref)
  85. end
  86.  
  87. /* Gibt es das Wort in der cross-reference-table? */
  88. xrefinfo = GetXRef(wort)
  89. if xrefinfo = 10 then do
  90.    /** Nein, aber vielleicht soll <wort> ein Modul (also eine
  91.     ** Main-Node bezeichnen.
  92.     **/
  93.    modul = 1
  94.    database = wort
  95.    node = 'Main'
  96. end
  97. else do
  98.    modul = 0
  99.    database = strip(Word(xrefinfo, 2), 'B', '"')
  100.    node = strip(Word(xrefinfo, 1), 'B', '"')
  101.    line = Word(xrefinfo, 4)
  102. end
  103.  
  104. if isGerman then
  105.    'REQUEST STATUS="Lade ' || database || '/' || node || ' ..."'
  106. else
  107.    'REQUEST STATUS="Loading ' || database || '/' || node || ' ..."'
  108.  
  109. /* Haben wir schon ein Autodoc-Fenster geöffnet? */
  110. if ~show('P','MODULAXREF') then do
  111.    if modul = 0 then
  112.       /* Hyper-Quelltext laden und auf gewünschtes Wort plazieren: */
  113.       cmd = "run >NIL: AmigaGuide " || database || " document Modul Line " || line || " portname MODULAXREF pubscreen GOLDED.1"
  114.    else
  115.       /* <wort> ist vermutlich der Name eines Moduls: */
  116.       cmd = "run >NIL: AmigaGuide "||database||" portname MODULAXREF pubscreen GOLDED.1 requester"
  117.  
  118.    ADDRESS COMMAND cmd
  119. end
  120. else do
  121.    link = "Link"
  122.  
  123.    if modul = 0 then
  124.       /* Hyper-Quelltext anzeigen und auf <wort> platzieren: */
  125.       cmd = link' 'database'/Modul 'line
  126.    else
  127.       cmd = link' 'database'/Main'
  128.  
  129.    OPTIONS FAILAT 21
  130.    ADDRESS MODULAXREF cmd
  131.    if rc = 20 then
  132.       if isGerman then
  133.          'REQUEST BODY="Keine Information für|'''function''' vorhanden." BUTTON=Ok'
  134.       else
  135.          'REQUEST BODY="No information for|'''function''' available." BUTTON=Ok'
  136.    else
  137.       ADDRESS MODULAXREF "windowtofront"
  138. end
  139.  
  140.  
  141. /* ---------------------------- END OF YOUR CODE --------------------- */
  142.  
  143. 'UNLOCK' /* VERY important: unlock GUI */
  144. EXIT
  145.  
  146. SYNTAX:
  147.  
  148. SAY "Sorry, error line" SIGL ":" ERRORTEXT(RC) ":-("
  149. 'UNLOCK'
  150. EXIT
  151.  
  152.  
  153.