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

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

some improvements and corrections in some .pro file according to
aspell and idldoc log file

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