Changeset 133 for trunk/SRC/Utilities/routine_name.pro
- Timestamp:
- 07/07/06 11:57:27 (18 years ago)
- File:
-
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/SRC/Utilities/routine_name.pro
r132 r133 3 3 ;------------------------------------------------------------ 4 4 ;+ 5 ; NAME:routine_name,remonte6 5 ; 7 ; PURPOSE:retourne le nom de la routine (procedure ou function) ds8 ; lequel on se trouve6 ; @file_comments 7 ; Give us the name of the routine (procedure or function) where we are. 9 8 ; 10 ; CATEGORY:utilitaire 9 ; @categories utilities 10 ; 11 ; @param pilingnum {in}{optional} A whole number which give us how many level we have to reascend 12 ; in the piling up of routines and subroutines to find the looked for routine. 11 13 ; 12 ; CALLING SEQUENCE:res=routine_name([remonte])13 ;14 ; INPUTS: remonte: un entier qui donne de combien de niveau on doit15 ; remonter ds l''empillement des routines ewt sous-routines pour16 ; retrouver le nom de la routine cherchee17 14 ; 18 ; KEYWORD PARAMETERS:15 ; @returns a string giving either the full name of the routine (with the path) or '$MAIN$' 19 16 ; 20 ; OUTPUTS:un string donnant soit le nom de la routine en entier (avec 21 ; le path) soit '$MAIN$' 17 ; @restriction This function use the keyword OUTPUT in help.pro and it is specified 18 ; in the online help that the return syntax of this word can change in 19 ; function of the version of the code. This version works with IDL 5.2. 22 20 ; 23 ; COMMON BLOCKS: 24 ; 25 ; SIDE EFFECTS: 26 ; 27 ; RESTRICTIONS: 28 ; cette fonction utilise le mot cle OUTPUT ds help.pro et il est 29 ; specifie ds l''aide en ligne que la syntaxe du retour de ce mot cle 30 ; peut changer suivant la version du code. Cette version marche avec 31 ; IDL 5.2 32 ; 33 ; EXAMPLE: 34 ; 35 ; IDL> print, routine_name() 21 ; @example IDL> print, routine_name() 36 22 ; /usr1/com/smasson/IDL_RD/UTILITAIRE/report.pro 37 23 ; IDL> print, routine_name(1) … … 44 30 ; $MAIN$ 45 31 ; 46 ; MODIFICATION HISTORY:Sebastien Masson (smasson@lodyc.jussieu.fr)32 ; @history Sebastien Masson (smasson@lodyc.jussieu.fr) 47 33 ; 21/10/1999 34 ; 35 ; @version $Id$ 36 ; 48 37 ;- 49 38 ;------------------------------------------------------------ 50 39 ;------------------------------------------------------------ 51 40 ;------------------------------------------------------------ 52 FUNCTION routine_name, remonte41 FUNCTION routine_name, pilingnum 53 42 ; 54 43 ; … … 56 45 ; 57 46 help, /traceback, output = name 58 name = strtrim(name, 1) ; on enleve les blancs en debut de ligne59 ; on va mettre les elements du vecteur bout a bout pour former un60 ; unique sring47 name = strtrim(name, 1) ; we remove blanks at the beginning of lines and 48 ; we put elements of the vector stuck ones with 49 ; each others to make an unique string. 61 50 allnames = '' 62 51 for i = 0, n_elements(name)-1 do allnames = allnames+name[i] 63 52 ; 64 name = str_sep(allnames, '%') ; on le redecoupe65 name = strtrim(name, 2) ; on eleve les blancs devant et derriere66 name = strcompress(name) ; on compresse les blancs67 ; on ne retient pas les 2 premiers elements qui sont 1 un vide et la68 ; ligne concernant routine_name53 name = str_sep(allnames, '%') ; we cut it out again. 54 name = strtrim(name, 2) ; we remouve blanks in front of and behind 55 name = strcompress(name) ; we compress blanks 56 ; we do not hold back the two first elements who are a blanck and the line concerning 57 ; routine_name. 69 58 name = name[2: n_elements(name)-1] 70 ; on choisit la ligne qui nous concerne71 if NOT keyword_set( remonte) then remonte= 072 if remonteGE n_elements(name) then return, '$MAIN$'73 name = name[ remonte]59 ; we choose the line which concern us. 60 if NOT keyword_set(pilingnum) then pilingnum = 0 61 if pilingnum GE n_elements(name) then return, '$MAIN$' 62 name = name[pilingnum] 74 63 if strpos(name, '$MAIN$') NE -1 then return, '$MAIN$' 75 64 name = str_sep(name, ' ')
Note: See TracChangeset
for help on using the changeset viewer.