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

Home » Public Forums » archive » Re: the type parser
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: the type parser [message #44072 is a reply to message #44071] Sun, 15 May 2005 09:03 Go to previous messageGo to previous message
R.Bauer is currently offline  R.Bauer
Messages: 1424
Registered: November 1998
Senior Member
Christopher Lee wrote:

> In article <d674k0$3dl$1@zam602.zam.kfa-juelich.de>, "Reimar Bauer"
> <R.Bauer@fz-juelich.de> wrote:
>
>
>> Dear all
>> I am searching for the function which tells idl what kind of type a
>> variable gets by it's assignment. e.g.
>> ....
>> cheers
>> Reimar
>
> Hi Reimar ,
>
> I'm not sure I understand, do you want the type of a constant value? (e.g
> 1, 2.3, 50000 ). Wouldn't SIZE or SIZE(/type) do this for you?
>
> size(1, /type) -> 2 ;INT
> size(50000, /type) -> 3 ;LONG
> size(1.0, /type) -> 4 ;FLOAT
> compile_opt idl2
> size(1,/type) -> 3 ;LONG
>
> Chris.

Hi Chris,

I look for the opposite direction. If I have a text file e.g.

[call_read]
a=1
b=50000
c=1.0
d='some text'
e=[1,2,3,4]

then I have strings and want to know which type is needed if they would be
assigned to variables.

With the read_ini() from our library* I could read this easily into a
structure using simple types. At the moment I do determine between float,
long or string. But I don't do it the same way as idl it did.
I am intereseted how idl it did and if it is implemented somewhere without
the usage of EXECUTE. For example if it is named type:

IDL> print,type('1B')
IDL> 1
IDL> print,type('1')
IDL> 2
IDL> print,type('50000')
IDL> 3
IDL> print,type('1.0')
IDL> 4
IDL> print,type('some text')
IDL> 7
IDL> print,type('[1,2,3,4]')
IDL> 2 2 2 2

One way could be to call type in a different idl session and to use the file
as input like a journal. But I don't like to do this.

*The read_ini()/write_ini will be published with the next version in
probably two months.

cheers
Reimar



--
Forschungszentrum Juelich
email: R.Bauer@fz-juelich.de
http://www.fz-juelich.de/icg/icg-i/
============================================================ ======
a IDL library at ForschungsZentrum Juelich
http://www.fz-juelich.de/icg/icg-i/idl_icglib/idl_lib_intro. html
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: launching many widgets at the same time
Next Topic: Locating IDL source code file

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

Current Time: Thu Oct 09 19:54:44 PDT 2025

Total time taken to generate the page: 0.87594 seconds