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

Home » Public Forums » archive » Re: procedure name quirk
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
Re: procedure name quirk [message #49072] Tue, 13 June 2006 08:03
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Martin Rother writes:

> ah, instructive...
> so with
> (in file !.pro):
> PRO !,_&print,_&END & FUNCTION _,_&return,!$+_&END
> I can do
> (X). .r !
> (X). defsysv,'!$','!'
> (X). _='!'&!,_(_)
> !!
> (X).
> (but, of course, I shouldn't :-)

NOW, I remember you! Fourth grade, Mr. Holland's class, right?
After he suffered his nervous breakdown and you had to move
away, I always wondered what had happened to you! Good to
see you again!

Cheers,

David

--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Re: procedure name quirk [message #49074 is a reply to message #49072] Tue, 13 June 2006 07:00 Go to previous message
rother is currently offline  rother
Messages: 9
Registered: April 2000
Junior Member
Hi,

On Jun13 11:44, F?LDY Lajos wrote:
> A quick check shows that other characters are not accepted:
> for i=32b,127b do $
> if ( idl_validname(string(i)) ne '' ) then $
> print, string(i)
> prints only _, ! and letters.

ah, instructive...
so with
(in file !.pro):
PRO !,_&print,_&END & FUNCTION _,_&return,!$+_&END
I can do
(X). .r !
(X). defsysv,'!$','!'
(X). _='!'&!,_(_)
!!
(X).
(but, of course, I shouldn't :-)
thanks,
martin.
--
Martin Rother (rother@gfz-potsdam.de) +331 / 288-1272 Section 2.3
GeoForschungsZentrum Potsdam, Germany
Re: procedure name quirk [message #49075 is a reply to message #49074] Tue, 13 June 2006 02:44 Go to previous message
Foldy Lajos is currently offline  Foldy Lajos
Messages: 268
Registered: October 2001
Senior Member
Hi,

it's all about identifiers. Variable names, function/procedure names,
structure names are identifiers.

In theory, the IDL 6.3 manual says:

Each identifier must begin with a letter and can contain from 1 to 128
characters. The second and subsequent characters can be letters, digits,
the underscore character, or the dollar sign.

In practice, _ (for _extra) and ! (for system variables) are also
permitted as leading character. (The manual even lists _INIT as
unacceptable variable name, but IDL happily accepts it :-)

A quick check shows that other characters are not accepted:

for i=32b,127b do $
if ( idl_validname(string(i)) ne '' ) then $
print, string(i)

prints only _, ! and letters.

The 8-bit version of this test is left to the reader :-)
just an example:

IDL> Ö=1 ; character 214
IDL> help
% At $MAIN$
V INT = 1

Ö is converted to char 86 (ie highest bit masked).

regards,
lajos


On Tue, 13 Jun 2006, Martin Rother wrote:

> it is possible to write a procedure named '!'.
Re: procedure name quirk [message #49076 is a reply to message #49075] Tue, 13 June 2006 01:59 Go to previous message
greg michael is currently offline  greg michael
Messages: 163
Registered: January 2006
Senior Member
ha! I like that.

Greg
Re: procedure name quirk [message #49081 is a reply to message #49076] Mon, 12 June 2006 17:33 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Martin Rother writes:

> as I had just failed to keep myself in lurking mode,
> I want to come with a funny question (seems to
> be difficult to search for by google):
>
> it is possible to write a procedure named '!'.

Sigh... I'm really getting much too old. :-(

Cheers,

David

--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: structures still confusing
Next Topic: Re: structures still confusing

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

Current Time: Wed Oct 08 13:44:55 PDT 2025

Total time taken to generate the page: 0.00487 seconds