comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Naming batch files and main-level programs
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Naming batch files and main-level programs [message #50997] Wed, 01 November 2006 23:49 Go to next message
Robi is currently offline  Robi
Messages: 9
Registered: October 2006
Junior Member
Hey there everybody,

I've been using batch files and main-level programs a ton lately and I
wondered if anyone has any naming conventions for these files? It's
nice to name them with a suffix of .pro so that IDL will search for
them in !PATH. But then you've got batch files and main-level programs
mixed in with routines; if you .run batch_file.pro you're in for
trouble and if you @main_level.pro you're in for even worse.

My advisor came up with a scheme where he names batch files
name.idl.pro and main-level programs name.idlprc.pro. I have NO IDEA
where he came up with these (especially the latter!); he claims they
were some kind of standard naming convention way, way back in the day,
but I'm extremely dubious. I can't find anything in the online help
about file-naming conventions for batch files and main-level programs;
in fact, the documentation for batch files suggests just throwing a
.pro on the end, but that's it.

Just wondering. -Tim.
Re: Naming batch files and main-level programs [message #51068 is a reply to message #50997] Thu, 02 November 2006 15:52 Go to previous message
Robi is currently offline  Robi
Messages: 9
Registered: October 2006
Junior Member
Hi there Jean,

>>> But if your routine is called 'fred' and you save it in a file called
>>> fred.idl.pro, when you call fred, IDL will be looking for fred.pro...
>>> and therefore not find it.
>>
>> Right, you'd have to do @fred.bat or .run fred.main
>
> No, he means that if you have a function/procedure "foo", it must be
> saved in the file foo.pro if you want IDL to find it. If you save it in
> bar.pro, IDL will not find it.

Ah, right, that's true, but I'm not suggesting that. Routines named
routine_name should be stored in filed name routine_name.pro. That
whole .idl thing was for batch files... I'm not, and never was,
suggesting that a *routine* be stored in routine_name.idl.pro.

> For a batch file, it would work... not that in this case it is uselless
> to save as a .pro... You can save it as foo.idl and type @foo.idl
> the good point of .pro extension is that you don't have to type it...
> @foo = @foo.pro

I completely disagree with your assertion that it is useless to save a
batch file as a .pro file. It is true that the file can be named
foo.idl and that @foo.idl would work, but ONLY if (a) you are in the
directory in which foo.idl is stored, (b) that directory was explicitly
added to !PATH, or (c) there happens to be a .sav or .pro file in that
directory so that it was added to !PATH via the "+" mechanism.
Moreover, one of the suggestions was to store all the batch files in a
directory named batch/ ... well, there ya go... that entire directory
would be skipped by the "+" path expansion because there would be no
.pro files in it. So you'd have to be in that directory to use those
batch files, or worse, have to execute them with a fully-qualified path
to the batch file.

> Now for your question, yes, you can have multiple points...

Great, thanks for confirming that.

> Here is another suggestion, close to Greg's one:
> why don't you call your files b_name.pro for the batch files and
> name.pro for the routines? elegant, small, obivous...

Certainly true, good idea; maybe, in my mind, not as obvious to someone
who didn't create the files as the .bat.pro or .main.pro suffixes.

Anyway, it sounds like this is just not something most people have
encountered. I guess I can go back to assuming I'm the only one
worrying about this oddity.

Best -Tim.
Re: Naming batch files and main-level programs [message #51070 is a reply to message #50997] Thu, 02 November 2006 13:34 Go to previous message
Jean H. is currently offline  Jean H.
Messages: 472
Registered: July 2006
Senior Member
>> But if your routine is called 'fred' and you save it in a file called
>> fred.idl.pro, when you call fred, IDL will be looking for fred.pro...
>> and therefore not find it.
>
> Right, you'd have to do @fred.bat or .run fred.main

No, he means that if you have a function/procedure "foo", it must be
saved in the file foo.pro if you want IDL to find it. If you save it in
bar.pro, IDL will not find it.

>>If I had this problem, I'd either just put the batch files in their own
>> directory which tells what they are (maybe called 'batch'), or tag the
>> batch files and leave the rest alone (although probably better with a
>> '_' separator than a '.', for the reason above. You can also use a file
>> with no extension to indicate a batch file - that's fine on UNIX; not
>> ideal on Windows.
>
>
> Hmm, I don't know Windows well at all... I wonder if the above would
> work... i.e., if you named a batch file fred.bat.pro and then did
> @fred.bat ... can you have multiple periods in a Windows file name or
> do you have to use underscores everywhere?
>
> Thanks for the ideas. Best -Tim.

For a batch file, it would work... not that in this case it is uselless
to save as a .pro... You can save it as foo.idl and type @foo.idl
the good point of .pro extension is that you don't have to type it...
@foo = @foo.pro

Now for your question, yes, you can have multiple points...

Here is another suggestion, close to Greg's one:
why don't you call your files b_name.pro for the batch files and
name.pro for the routines? elegant, small, obivous...

Jean
Re: Naming batch files and main-level programs [message #51072 is a reply to message #50997] Thu, 02 November 2006 13:22 Go to previous message
Robi is currently offline  Robi
Messages: 9
Registered: October 2006
Junior Member
Hey there Greg,

> But if your routine is called 'fred' and you save it in a file called
> fred.idl.pro, when you call fred, IDL will be looking for fred.pro...
> and therefore not find it.

Right, you'd have to do @fred.bat or .run fred.main

> If I had this problem, I'd either just put the batch files in their own
> directory which tells what they are (maybe called 'batch'), or tag the
> batch files and leave the rest alone (although probably better with a
> '_' separator than a '.', for the reason above. You can also use a file
> with no extension to indicate a batch file - that's fine on UNIX; not
> ideal on Windows.

Hmm, I don't know Windows well at all... I wonder if the above would
work... i.e., if you named a batch file fred.bat.pro and then did
@fred.bat ... can you have multiple periods in a Windows file name or
do you have to use underscores everywhere?

Thanks for the ideas. Best -Tim.
Re: Naming batch files and main-level programs [message #51089 is a reply to message #50997] Thu, 02 November 2006 05:35 Go to previous message
greg michael is currently offline  greg michael
Messages: 163
Registered: January 2006
Senior Member
Sorry - didn't catch the main-level part - I never use it myself. So
then you're using the full name anyway, so it would be found.

regards,
Greg
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: an envi question- extracting the pixel values of seveal points with lat-lon values
Next Topic: dialog_pickfile problem

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 17:43:57 PDT 2025

Total time taken to generate the page: 0.00987 seconds