Re: Referencing structure inline [message #89837 is a reply to message #89836] |
Tue, 09 December 2014 02:56  |
Helder Marchetto
Messages: 520 Registered: November 2011
|
Senior Member |
|
|
On Tuesday, December 9, 2014 11:55:02 AM UTC+1, Helder wrote:
> On Tuesday, December 9, 2014 9:42:57 AM UTC+1, Heinz Stege wrote:
>> Seems to be a bug in your IDL version. The following works in IDL 8.0:
>>
>> IDL> help,file_info(!dir)
>> ** Structure FILE_INFO, 21 tags, length=64, data length=63:
>> NAME STRING 'C:\idl\idl80'
>> EXISTS BYTE 1
>> READ BYTE 1
>> WRITE BYTE 1
>> EXECUTE BYTE 1
>> REGULAR BYTE 0
>> DIRECTORY BYTE 1
>> BLOCK_SPECIAL BYTE 0
>> CHARACTER_SPECIAL
>> BYTE 0
>> NAMED_PIPE BYTE 0
>> SETUID BYTE 0
>> SETGID BYTE 0
>> SOCKET BYTE 0
>> STICKY_BIT BYTE 0
>> SYMLINK BYTE 0
>> DANGLING_SYMLINK
>> BYTE 0
>> MODE LONG 511
>> ATIME LONG64 1418112222
>> CTIME LONG64 1299161262
>> MTIME LONG64 1349551389
>> SIZE LONG64 0
>> IDL> print,(file_info(!dir)).name
>> C:\idl\idl80
>> IDL> print,(file_info(!dir)).ctime
>> 1299161262
>> IDL> print,!version
>> { x86 Win32 Windows Microsoft Windows 8.0.1 Oct 5 2010 32
>> 64}
>
>
> Hi,
> If this is a bug then it's still out there. Implied print seems to be the problem:
>
> IDL> ({x:1,y:2}).x
> % Object reference type required in this context: <STRUCT Array[1]>.
> % Execution halted at: $MAIN$
> IDL> print, ({x:1,y:2}).x
> 1
> IDL> !version
> {
> "ARCH": "x86_64",
> "OS": "Win32",
> "OS_FAMILY": "Windows",
> "OS_NAME": "MicrosoftWindows",
> "RELEASE": "8.4",
> "BUILD_DATE": "Sep272014",
> "MEMORY_BITS": 64,
> "FILE_OFFSET_BITS": 64
> }
>
> In other words, such indexing does not work with implied print.
>
> I also tried this with a function:
>
> function testPrintFunction
> return, {x:1,y:2}
> end
>
> IDL> (testPrintFunction()).x
> % Object reference type required in this context: <STRUCT Array[1]>.
> % Execution halted at: $MAIN$
> IDL> print, (testPrintFunction()).x
> 1
>
> Cheers,
> Helder
Here is a link with some explanation. I'm sure it falls under the same problem pointed out by Chris T.
https://groups.google.com/d/msg/comp.lang.idl-pvwave/rbleuyI 6GfA/vIi09AwC0rEJ
Cheers,
Helder
|
|
|