home *** CD-ROM | disk | FTP | other *** search
/ Magazyn Exec 5 / CD_Magazyn_EXEC_nr_5.iso / Programy / Programowanie / FetchRefs2.1.lha / FetchRefs2.1 / Scripts / FetchRefs.Amitex < prev    next >
Encoding:
Text File  |  2001-01-28  |  3.0 KB  |  106 lines

  1. /*   $VER: FetchRefs.amitex 1.03 (25/01/2001)
  2. ** Version 1.00 (15 Février 1997)
  3. ** Version 1.01 (23 Mai 1999): modification appel fonction ASK
  4. ** Version 1.02 (27 Juin 1999): suppression appel Cpu060 (Fetchrefs 2.00)
  5. ** Version 1.03 (25 janvier 2001): ajout sauvegarde fonction dans clip
  6. **   Script ARexx pour appeler FetchRefs.
  7. */
  8.  
  9. signal on syntax
  10.  
  11. editorname = 'AMITEX'
  12.  
  13. OPTIONS RESULTS
  14.  
  15. caller = ADDRESS()
  16. if (left(caller, length(editorname)) ~= editorname) then
  17.     exit 10
  18.  
  19. /* Get the function name from editor (get current word). */
  20. 'BLOCK(1)'          /* lecture numéro de ligne début de bloc */
  21. ld = result
  22. if ld<=0 then do
  23.     'WORD(0)'
  24.     function = result
  25. end
  26. else do
  27.     'BLOCK(3)'          /* lecture numéro de ligne de fin */
  28.     lf = result
  29.     if ld ~= lf then do
  30.     'MESSAGE("Sélection incorrecte")'
  31.     exit
  32.     end
  33.     'TEXTMARK(-1)'      /* lecture du bloc marqué */
  34.     function = result
  35. end
  36.  
  37. if function="" then do
  38.     function = getclip(fetchref)
  39.     'ASKTEXT("Fonction à chercher ?", "'function'")'
  40.     function = result
  41. end
  42. if function="" then exit
  43. a = setclip(fetchref,function)
  44.  
  45. /* Définition d'un fichier temporaire pour charger la référence */
  46. cutat = VERIFY(function, "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890_")
  47. if cutat > 0 THEN
  48.     basename = LEFT(function, cutat - 1)
  49. ELSE
  50.     basename = function
  51.  
  52. filename = 'T:FR_'basename
  53.  
  54. /* It doesn''t matter whether we want a taglist, varargs og whatever function */
  55. IF RIGHT(function, 7) = "TagList" THEN
  56.     function = LEFT(function, LENGTH(function) - 7)
  57. ELSE IF RIGHT(function, 4) = "Tags" THEN
  58.     function = LEFT(function, LENGTH(function) - 4)
  59. ELSE IF RIGHT(function, 1) = "A" THEN
  60.     function = LEFT(function, LENGTH(function) - 1)
  61.  
  62. /* Now actually get the reference */
  63. address command
  64. if ~show(p, "FETCHREFS") then do
  65.     'run > nil:' "Prog:docs/FetchRefs/FetchRefs Prog:docs/FetchRefs/FetchRefs.index"
  66.     waitforport "FETCHREFS"
  67. end
  68.  
  69. ADDRESS 'FETCHREFS'
  70. FR_GET function || '(%|Tags|TagList|A)' filename CASE FILEREF
  71. gotoline = rc2
  72. resultat = rc
  73.  
  74. /* Address editor again to load the file */
  75. address value caller
  76. if resultat~=0 then do
  77.     /* Skip if the error was '...!' (actually 'Aborted!'). This occours
  78.      * whenever the 'select from what file' window is closed, which is
  79.      * not really an error.
  80.      */
  81.     if right(rc2, 1) ~='!' then
  82.         /* Reporte l'erreur (passée par FetchRefs) */
  83.         'MESSAGE("Recherche 'function'"+CHR(10)+"'RC2'")'
  84. end
  85. else do
  86.     /* Make the editor open a new window and load the autodoc into it. */
  87.     'OPEN("'filename'")'
  88.  
  89.     /* If FetchRefs provided us with a goto line (it does for .h files
  90.      * only - as it only makes sense for them) then we jump to that line.
  91.      */
  92.     if gotoline ~= 0 then
  93.         'GOTO(1,'gotoline')'
  94.  
  95.     /* Delete the autodoc file */
  96.     ADDRESS COMMAND 'C:Delete >NIL:' filename
  97. end
  98. exit
  99.  
  100. /* Traitement des erreurs, interruption du programme */
  101. syntax:
  102. erreur=RC
  103. 'MESSAGE("Script FetchRefs.Amitex"+CHR(10)+"Erreur de syntaxe"+CHR(10)+"en ligne 'SIGL'"+CHR(10)+"'errortext(erreur)'")'
  104. address command
  105. exit
  106.