source: trunk/SRC/Utilities/protype.pro @ 97

Last change on this file since 97 was 97, checked in by pinsard, 18 years ago

start to modify headers of Obsolete *.pro files for better idldoc output

File size: 1.5 KB
Line 
1;------------------------------------------------------------
2;------------------------------------------------------------
3;------------------------------------------------------------
4;+
5; @file_comments test is a ".pro" file corresponds to an IDL procedure,
6;          function or batch file.
7;
8; @categories utilities
9;
10; @param file {in} A scalar of string type, the name of the ".pro" file to be tested
11;    if necessary, the input name is completed with '.pro'
12;     and its path found in !path
13;
14; @returns A scalar of string type: 'proc', 'func' or 'batch'
15;
16; @examples
17;
18;      IDL> print, protype('protype')
19;      func
20;      IDL> print, protype('protype.pro')
21;      func
22;      IDL> print, protype('init')
23;      batch
24;      IDL> print, protype('plt')
25;      proc
26;
27; @history Sebastien Masson (smasson\@lodyc.jussieu.fr)
28;                       Feb 2006
29;-
30;------------------------------------------------------------
31;------------------------------------------------------------
32;------------------------------------------------------------
33FUNCTION protype, file
34;
35  filepro = (find(file[0], /onlypro, /firstfound))[0]
36  if filepro EQ 'NOT FOUND' then return, -1
37  name = file_basename(filepro, '.pro')
38;
39  allines = getfile(filepro)
40  CASE 1 OF
41; this is a procedure
42    max(stregex(allines, '^ *pro ?' + name, /fold_case, /boolean)):RETURN, 'proc'
43; this is a function
44    max(stregex(allines, '^ *function ?' + name, /fold_case, /boolean)):RETURN, 'func'
45; this is an IDL batch file
46    ELSE:RETURN, 'batch'
47  ENDCASE
48 
49  RETURN, -1
50END
Note: See TracBrowser for help on using the repository browser.