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