source: trunk/SRC/Utilities/routine_name.pro @ 224

Last change on this file since 224 was 224, checked in by pinsard, 17 years ago

improvements/corrections of some *.pro headers

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 2.5 KB
RevLine 
[2]1;------------------------------------------------------------
2;------------------------------------------------------------
3;------------------------------------------------------------
4;+
5;
[136]6; @file_comments
[133]7; Give us the name of the routine (procedure or function) where we are.
[2]8;
[224]9; @categories
[157]10; Utilities
[2]11;
[163]12; @param PILINGNUM {in}{optional}
[136]13; A whole number which give us how many level we have to reascend
14; in the piling up of routines and subroutines to find the looked for routine.
[2]15;
[136]16; @returns
17; a string giving either the full name of the routine (with the path) or
18; '$MAIN$'
[2]19;
[136]20; @restrictions
21; This function use the keyword OUTPUT in help.pro and it is specified
[163]22; in the on-line help that the return syntax of this word can change in
[136]23; function of the version of the code. This version works with IDL 5.2.
24;
25; @examples
26; IDL> print, routine_name()
[2]27;  /usr1/com/smasson/IDL_RD/UTILITAIRE/report.pro
28;  IDL> print, routine_name(1)
29;  /usr1/com/smasson/IDL_RD/PLOTS/DIVERS/determineminmax.pro
30;  IDL> print, routine_name(2)
31;  /usr1/com/smasson/IDL_RD/PLOTS/DESSINE/plt.pro
32;  IDL> print, routine_name(3)
33;  $MAIN$
34;  IDL> print, routine_name(4)
35;  $MAIN$
36;
[224]37; @history
38; Sebastien Masson (smasson\@lodyc.jussieu.fr)
[2]39;                      21/10/1999
[133]40;
[224]41; @version
42; $Id$
[133]43;
[2]44;-
45;------------------------------------------------------------
46;------------------------------------------------------------
47;------------------------------------------------------------
[133]48FUNCTION routine_name,  pilingnum
[2]49;
[114]50;
51  compile_opt idl2, strictarrsubs
52;
[11]53  help,  /traceback, output = name
[136]54  name = strtrim(name, 1)       ; we remove blanks at the beginning of lines and
55;                               we put elements of the vector stuck ones with
[133]56;                               each others to make an unique string.
[11]57  allnames = ''
58  for i = 0, n_elements(name)-1 do allnames = allnames+name[i]
[2]59;
[136]60  name = str_sep(allnames, '%') ; we cut it out again.
[133]61  name = strtrim(name, 2)     ; we remouve blanks in front of and behind
62  name = strcompress(name)      ; we compress blanks
[136]63; we do not hold back the two first elements who are a blanck  and the line concerning
64; routine_name.
[11]65  name = name[2: n_elements(name)-1]
[133]66; we choose the line which concern us.
67  if NOT keyword_set(pilingnum) then pilingnum = 0
68  if pilingnum GE n_elements(name) then return,  '$MAIN$'
69  name = name[pilingnum]
[11]70  if strpos(name, '$MAIN$') NE -1 then return,  '$MAIN$'
71  name = str_sep(name, ' ')
72  if n_elements(name) LT 3  then name = name[0] ELSE name = 'L.'+name[1]+' '+name[2]
73;
74  return, name
[2]75end
Note: See TracBrowser for help on using the repository browser.