comp.lang.idl-pvwave archive - RDF feed
type: channel
description: Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado
items: finding out if program exists (newproc.pro)

finding out if program exists (newproc.pro)
type: item
description: Hello, there has been some discusion lately (actually since a while) that it is difficult to make sure that when you a name a routine, that the name you picked doesn't already exist. Well, here at SMA, we have a program, newproc.pro, that helps us out with this. It takes one parameter, the name of the routine you would like to create. For example, if you want to create the program plot_drop.pro, do the following: idl>newproc,'plot_drop.pro' if the file exists, a warning such as the following is displayed: Procedure with the same name already exists in /tools/idl/lib/idlmeteo/pro Please choose another name If it doesn't exist, the template.pro program is copied into your current directory with the file name you requested. Then you can started editing, or simple exit, and edit the program at your leisure later. (see Using this,below, for a breif discussion of the template file.) SHORT comings: until now, this routine doesn't check for routine names that come with the IDL system. SO if you typed newproc,'min.pro' the file min.pro will be created (in your current directory) despite the fact that min is a built in IDL function. So, if someone would like to add the functionality of checking for IDL system routine, it would be appreciated. Using this: The following line needs to be changed so that it contains the correct path to some header template, called template.pro, you use. If you currently use no template, I have included our template.pro at the end of this posting. spawn, ['cp',!DIR+'/lib/idlmeteo/pro/template.pro',proc], /NOSHELL So make sure you change the above line. Then put this program in a directory that is in the IDL_PATH, and place the template.pro program at the place you just indicated in the changed line above. Okay, here is the program: newproc.pro \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ cut here \\\\\\\\\\\\\\\\\\\\\\ ; ;+ ; NAME: ; NEWPROC ; ; PURPOSE: ; Creating of new procedure. Checks first if a procedure with the ; same name already exists. If not…
creator: stl
date: 1994-06-27T11:32:38-00:00