Re: Really really long format keywords [message #27377] |
Mon, 22 October 2001 14:04 |
Paul van Delst
Messages: 364 Registered: March 1997
|
Senior Member |
|
|
Sean Raffuse wrote:
>
> Hehe. The longest a line of source code can be is 256 characters
Oh, that's more than enough. If you can't fit stuff into a line 256 columns long, you should
change your approach.
Keep in mind I'm a feller who thinks anything past column 72 is a plus. :o)
paulv
--
Paul van Delst Religious and cultural
CIMSS @ NOAA/NCEP purity is a fundamentalist
Ph: (301)763-8000 x7274 fantasy
Fax:(301)763-8545 V.S.Naipaul
|
|
|
Re: Really really long format keywords [message #27382 is a reply to message #27377] |
Mon, 22 October 2001 12:59  |
Sean Raffuse
Messages: 46 Registered: July 2001
|
Member |
|
|
Hehe. The longest a line of source code can be is 256 characters
Paul van Delst <paul.vandelst@noaa.gov> wrote in message
news:3BD471CF.3F9DA66@noaa.gov...
> Sean Raffuse wrote:
>>
>> I would like to write formatted output to a file. My problem is that my
>> format specifications are too long to fit on one line in IDL, yet I
would
>> like all of the data to be written to one line.
>>
>> eg.
>>
>> printf, lun, data, format = '(a5, 5x, f5.2, f5.2 . . . . . and so on . .
.
>> . . . . . .)
>>
>> Is there a character that I can use that works like the '$' character
inside
>> this string?
>
> Assuming the format isn't going to change too much and there are
repeatable format specifiers,
> what about:
>
> printf, lun, data, format = '(a5, 5x, 2(1x,f5.2), 7(1x,i10), etc..)'
>
> How long *is* one line allowed to be in IDL source code anyway?
>
> paulv
>
> --
> Paul van Delst Religious and cultural
> CIMSS @ NOAA/NCEP purity is a fundamentalist
> Ph: (301)763-8000 x7274 fantasy
> Fax:(301)763-8545 V.S.Naipaul
|
|
|
Re: Really really long format keywords [message #27383 is a reply to message #27382] |
Mon, 22 October 2001 12:21  |
Paul van Delst
Messages: 364 Registered: March 1997
|
Senior Member |
|
|
Sean Raffuse wrote:
>
> I would like to write formatted output to a file. My problem is that my
> format specifications are too long to fit on one line in IDL, yet I would
> like all of the data to be written to one line.
>
> eg.
>
> printf, lun, data, format = '(a5, 5x, f5.2, f5.2 . . . . . and so on . . .
> . . . . . .)
>
> Is there a character that I can use that works like the '$' character inside
> this string?
Assuming the format isn't going to change too much and there are repeatable format specifiers,
what about:
printf, lun, data, format = '(a5, 5x, 2(1x,f5.2), 7(1x,i10), etc..)'
How long *is* one line allowed to be in IDL source code anyway?
paulv
--
Paul van Delst Religious and cultural
CIMSS @ NOAA/NCEP purity is a fundamentalist
Ph: (301)763-8000 x7274 fantasy
Fax:(301)763-8545 V.S.Naipaul
|
|
|
Re: Really really long format keywords [message #27385 is a reply to message #27383] |
Mon, 22 October 2001 12:26  |
John-David T. Smith
Messages: 384 Registered: January 2000
|
Senior Member |
|
|
"Liam E. Gumley" wrote:
>
> Sean Raffuse wrote:
>> I would like to write formatted output to a file. My problem is that my
>> format specifications are too long to fit on one line in IDL, yet I would
>> like all of the data to be written to one line.
>>
>> eg.
>>
>> printf, lun, data, format = '(a5, 5x, f5.2, f5.2 . . . . . and so on . . .
>> . . . . . .)
>>
>> Is there a character that I can use that works like the '$' character inside
>> this string?
>
> printf, lun, data, format = '(a5, 5x, f5.2,' + $
> 'f5.2, a20, i13.3)'
By the way, did you know IDLWAVE will do this for you? [M-Ret] is the
continuation keystroke. In a regular line, it will insert `$' and move
to the next line (indented appropriately of course). Inside of a
string, it will close the string, insert "+ $", and start the string
again on the next line. It even works for existing strings.
Example:
a= 'Now is the time for all good men to come to the aid.'
positioning on the g in good and hit [M-Ret] yields:
a= 'Now is the time for all ' + $
'good men to come to the aid.'
This is especially useful when a line which formerly fit gets moved over
by indentation changes (another enclosing if block, anyone?).
JD
|
|
|
Re: Really really long format keywords [message #27387 is a reply to message #27383] |
Mon, 22 October 2001 11:40  |
Liam E. Gumley
Messages: 378 Registered: January 2000
|
Senior Member |
|
|
Sean Raffuse wrote:
> I would like to write formatted output to a file. My problem is that my
> format specifications are too long to fit on one line in IDL, yet I would
> like all of the data to be written to one line.
>
> eg.
>
> printf, lun, data, format = '(a5, 5x, f5.2, f5.2 . . . . . and so on . . .
> . . . . . .)
>
> Is there a character that I can use that works like the '$' character inside
> this string?
printf, lun, data, format = '(a5, 5x, f5.2,' + $
'f5.2, a20, i13.3)'
Cheers,
Liam.
Practical IDL Programming
http://www.gumley.com/
|
|
|
Re: Really really long format keywords [message #27389 is a reply to message #27387] |
Mon, 22 October 2001 11:42  |
Randall Skelton
Messages: 169 Registered: October 2000
|
Senior Member |
|
|
What about just concatenating strings...
a = '(a5, 5x, '
b = 'f5.2, f5.2)'
ab = a + b
printf, lun, data, format = ab
On Mon, 22 Oct 2001, Sean Raffuse wrote:
> I would like to write formatted output to a file. My problem is that my
> format specifications are too long to fit on one line in IDL, yet I would
> like all of the data to be written to one line.
>
> eg.
>
> printf, lun, data, format = '(a5, 5x, f5.2, f5.2 . . . . . and so on . . .
> . . . . . .)
>
> Is there a character that I can use that works like the '$' character inside
> this string?
>
> Thanks,
>
> Sean Raffuse
|
|
|