home *** CD-ROM | disk | FTP | other *** search
- /* This script opens the FetchRefs requester for any reference
- * $VER: ReqFetchRefs 1.00 (© R.Florac, 27/01/01) */
-
- signal on syntax
-
- editorname = 'AMITEX'
-
- OPTIONS RESULTS
-
- caller = ADDRESS()
- if (left(caller, length(editorname)) ~= editorname) then
- exit 10
-
- /* Get the function name from editor (get current word). */
- 'BLOCK(1)' /* lecture numéro de ligne début de bloc */
- ld = result
- if ld<=0 then do
- 'WORD(0)'
- function = result
- end
- else do
- 'BLOCK(3)' /* lecture numéro de ligne de fin */
- lf = result
- if ld ~= lf then do
- 'MESSAGE("Sélection incorrecte")'
- exit
- end
- 'TEXTMARK(-1)' /* lecture du bloc marqué */
- function = result
- end
-
- if function="" then do
- function = getclip(fetchref)
- 'ASKTEXT("Fonction à chercher ?", "'function'")'
- function = result
- end
- if function="" then exit
- a = setclip(fetchref,function)
-
- /* Définition d'un fichier temporaire pour charger la référence */
- 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 command
- if ~show(p, "FETCHREFS") then do
- 'run > nil:' "Prog:docs/FetchRefs/FetchRefs Prog:docs/FetchRefs/FetchRefs.index"
- waitforport "FETCHREFS"
- end
-
- ADDRESS 'FETCHREFS'
- FR_REQ function || '(%|Tags|TagList|A)' filename CASE FILEREF
- gotoline = rc2
- resultat = rc
-
- /* Address editor again to load the file */
- address value caller
- if resultat~=0 then do
- /* Skip if the error was '...!' (actually 'Aborted!'). This occours
- * whenever the 'select from what file' window is closed, which is
- * not really an error.
- */
- if right(rc2, 1) ~='!' then
- /* Reporte l'erreur (passée par FetchRefs) */
- 'MESSAGE("Recherche 'function'"+CHR(10)+"'RC2'")'
- end
- else do
- /* Make the editor open a new window and load the autodoc into it. */
- 'OPEN("'filename'")'
-
- /* If FetchRefs provided us with a goto line (it does for .h files
- * only - as it only makes sense for them) then we jump to that line.
- */
- if gotoline ~= 0 then
- 'GOTO(1,'gotoline')'
-
- /* Delete the autodoc file */
- ADDRESS COMMAND 'C:Delete >NIL:' filename
- end
- exit
-
- /* Traitement des erreurs, interruption du programme */
- syntax:
- erreur=RC
- 'MESSAGE("Script GetFileref.Amitex"+CHR(10)+"Erreur de syntaxe"+CHR(10)+"en ligne 'SIGL'"+CHR(10)+"'errortext(erreur)'")'
- address command
- exit
-