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

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

modification of some headers (+some corrections) to prepare usage of the new idldoc

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