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

Home » Public Forums » archive » Re: Octals
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: Octals [message #27128] Thu, 11 October 2001 12:48 Go to next message
george.mccabe is currently offline  george.mccabe
Messages: 10
Registered: October 2001
Junior Member
steve,

will byte value do? try string(42B) -

IDL> plot,indgen(1),title=string(42B)+" <- steve's muliplication symbol"

george, george.mccabe@gsfc.nasa.gov

Steve Cole <s.j.cole@ex.ac.uk> wrote in message news:<3BC5A7F1.718B0997@ex.ac.uk>...
> Does anybody know how to print a character or symbol by its octal value?
>
> (I am trying to put a multiplication sign in the title of a plot)
>
> Any help would be gratefully recieved.
>
> Thanks
>
> Steve Cole
> University of Exeter
Re: Octals [message #27131 is a reply to message #27128] Thu, 11 October 2001 11:37 Go to previous messageGo to next message
Martin Downing is currently offline  Martin Downing
Messages: 136
Registered: September 1998
Senior Member
"Reimar Bauer" <r.bauer@fz-juelich.de> wrote in message
news:3BC5C1D5.9FB46B1C@fz-juelich.de...
> Martin Downing wrote:
>>
>> IDL> title = "frequency " + string('52'Ob) + " wavelength"
>
> Normaly we should always use ' for strings.
>
> Because " with numbers gives an octal number, e.g.
>
> IDL> print, "10
> 8


Well if anyone reading my code misread "frequency" as an octal number,
then I humbly appollogise!
Your right though, but Im afraid use of double quotes for strings is deep
seated
for me from C/C++. NOw we are on the topic, I've got to say that
interpreting "01 as shorthand for
octal 01 was just a daft overload of the language, it really seems
half-baked, look at these examples for illustration:

IDL> help, "1034
<Expression> INT = 540
; OK....

IDL> help, "1034r
help, "1034r
^
% Syntax error.
; fair enough

IDL> help, "10349673
<Expression> INT = 540
; *&*&*??????
IDL> help, "910349673
<Expression> STRING = '910349673'

IDL LOGIC: "Digits 8 or 9 indicate that the string is indeed a string if
they appear first, if they appear later on then let's just discard them -
surely the programmer didnt want them anyway..."

cheers

Martin
Re: Octals [message #27141 is a reply to message #27131] Thu, 11 October 2001 09:01 Go to previous messageGo to next message
R.Bauer is currently offline  R.Bauer
Messages: 1424
Registered: November 1998
Senior Member
Steve Cole wrote:
>
> Does anybody know how to print a character or symbol by its octal value?
>
> (I am trying to put a multiplication sign in the title of a plot)

I like to understand why do want to print the '*' by it's octal value?


regards
Reimar

>
> Any help would be gratefully recieved.
>
> Thanks
>
> Steve Cole
> University of Exeter

--
Reimar Bauer

Institut fuer Stratosphaerische Chemie (ICG-1)
Forschungszentrum Juelich
email: R.Bauer@fz-juelich.de
http://www.fz-juelich.de/icg/icg1/
============================================================ ======
a IDL library at ForschungsZentrum Juelich
http://www.fz-juelich.de/icg/icg1/idl_icglib/idl_lib_intro.h tml

http://www.fz-juelich.de/zb/text/publikation/juel3786.html
============================================================ ======

read something about linux / windows
http://www.suse.de/de/news/hotnews/MS.html
Re: Octals [message #27142 is a reply to message #27141] Thu, 11 October 2001 08:59 Go to previous messageGo to next message
R.Bauer is currently offline  R.Bauer
Messages: 1424
Registered: November 1998
Senior Member
Martin Downing wrote:
>
> Steve,
>
> Lookup the values you want in the charsets, eg "*" is octal 52, which is
> written in IDL as '52'OB. To use it in a string use STRING():
>
> IDL> print, string('52'Ob)
> *
> IDL> title = "frequency " + string('52'Ob) + " wavelength"

Normaly we should always use ' for strings.

Because " with numbers gives an octal number, e.g.

IDL> print, "10
8

regards
Reimar

> IDL> print, title
> frequency * wavelength
> ; eg usage in a plot title
> IDL> plot, indgen(10), title=title
>
> Martin
>
> "Steve Cole" <s.j.cole@ex.ac.uk> wrote in message
> news:3BC5A7F1.718B0997@ex.ac.uk...
>> Does anybody know how to print a character or symbol by its octal value?
>>
>> (I am trying to put a multiplication sign in the title of a plot)
>>
>> Any help would be gratefully recieved.
>>
>> Thanks
>>
>> Steve Cole
>> University of Exeter
>>

--
Reimar Bauer

Institut fuer Stratosphaerische Chemie (ICG-1)
Forschungszentrum Juelich
email: R.Bauer@fz-juelich.de
http://www.fz-juelich.de/icg/icg1/
============================================================ ======
a IDL library at ForschungsZentrum Juelich
http://www.fz-juelich.de/icg/icg1/idl_icglib/idl_lib_intro.h tml

http://www.fz-juelich.de/zb/text/publikation/juel3786.html
============================================================ ======

read something about linux / windows
http://www.suse.de/de/news/hotnews/MS.html
Re: Octals [message #27143 is a reply to message #27142] Thu, 11 October 2001 08:48 Go to previous messageGo to next message
Steve Cole is currently offline  Steve Cole
Messages: 6
Registered: October 2001
Junior Member
Cheers guys thanks for the help.

Steve
Re: Octals [message #27146 is a reply to message #27143] Thu, 11 October 2001 08:11 Go to previous messageGo to next message
Martin Downing is currently offline  Martin Downing
Messages: 136
Registered: September 1998
Senior Member
Steve,

Lookup the values you want in the charsets, eg "*" is octal 52, which is
written in IDL as '52'OB. To use it in a string use STRING():

IDL> print, string('52'Ob)
*
IDL> title = "frequency " + string('52'Ob) + " wavelength"
IDL> print, title
frequency * wavelength
; eg usage in a plot title
IDL> plot, indgen(10), title=title


Martin

"Steve Cole" <s.j.cole@ex.ac.uk> wrote in message
news:3BC5A7F1.718B0997@ex.ac.uk...
> Does anybody know how to print a character or symbol by its octal value?
>
> (I am trying to put a multiplication sign in the title of a plot)
>
> Any help would be gratefully recieved.
>
> Thanks
>
> Steve Cole
> University of Exeter
>
Re: Octals [message #27147 is a reply to message #27146] Thu, 11 October 2001 07:40 Go to previous messageGo to next message
Jaco van Gorkom is currently offline  Jaco van Gorkom
Messages: 97
Registered: November 2000
Member
Steve Cole wrote:
> ...
> (I am trying to put a multiplication sign in the title of a plot)

... , title = TeXtoIDL('\cdot')
or
... , title = TeXtoIDL('\times')

TeXtoIDL can be found at http://physweb.mnstate.edu/mcraig/TeXtoIDL/ .

Cheers,
Jaco
Re: Octals [message #27210 is a reply to message #27141] Fri, 12 October 2001 02:20 Go to previous message
Steve Cole is currently offline  Steve Cole
Messages: 6
Registered: October 2001
Junior Member
Well I wanted a 'x' type symbol and didn't realise that it was actually in
the Math and Special font, also I was curious to find out how to print other
symbols by their octal numbers for future reference as I have only just
started using IDL and couldn't find it in the manuals that we have got. Hope
this clears it up for you!!!

Cheers

Steve Cole


Reimar Bauer wrote:

> Steve Cole wrote:
>>
>> Does anybody know how to print a character or symbol by its octal value?
>>
>> (I am trying to put a multiplication sign in the title of a plot)
>
> I like to understand why do want to print the '*' by it's octal value?
>
> regards
> Reimar
>
>>
>> Any help would be gratefully recieved.
>>
>> Thanks
>>
>> Steve Cole
>> University of Exeter
>
> --
> Reimar Bauer
>
> Institut fuer Stratosphaerische Chemie (ICG-1)
> Forschungszentrum Juelich
> email: R.Bauer@fz-juelich.de
> http://www.fz-juelich.de/icg/icg1/
> ============================================================ ======
> a IDL library at ForschungsZentrum Juelich
> http://www.fz-juelich.de/icg/icg1/idl_icglib/idl_lib_intro.h tml
>
> http://www.fz-juelich.de/zb/text/publikation/juel3786.html
> ============================================================ ======
>
> read something about linux / windows
> http://www.suse.de/de/news/hotnews/MS.html
Re: Octals [message #27211 is a reply to message #27128] Fri, 12 October 2001 02:07 Go to previous message
Steve Cole is currently offline  Steve Cole
Messages: 6
Registered: October 2001
Junior Member
Yes that is great problem is now sorted, thanks very much for your helpful comments.

George McCabe wrote:

> steve,
>
> will byte value do? try string(42B) -
>
> IDL> plot,indgen(1),title=string(42B)+" <- steve's muliplication symbol"
>
> george, george.mccabe@gsfc.nasa.gov
>
> Steve Cole <s.j.cole@ex.ac.uk> wrote in message news:<3BC5A7F1.718B0997@ex.ac.uk>...
>> Does anybody know how to print a character or symbol by its octal value?
>>
>> (I am trying to put a multiplication sign in the title of a plot)
>>
>> Any help would be gratefully recieved.
>>
>> Thanks
>>
>> Steve Cole
>> University of Exeter
Re: Octals [message #27213 is a reply to message #27131] Thu, 11 October 2001 22:20 Go to previous message
Craig Markwardt is currently offline  Craig Markwardt
Messages: 1869
Registered: November 1996
Senior Member
"Martin Downing" <martin.downing@ntlworld.com> writes:

> "Reimar Bauer" <r.bauer@fz-juelich.de> wrote in message
> news:3BC5C1D5.9FB46B1C@fz-juelich.de...
>> Martin Downing wrote:
>>>
>>> IDL> title = "frequency " + string('52'Ob) + " wavelength"
>>
>> Normaly we should always use ' for strings.
>>
>> Because " with numbers gives an octal number, e.g.
>>
>> IDL> print, "10
>> 8
>
>
> Well if anyone reading my code misread "frequency" as an octal number,
> then I humbly appollogise!
> Your right though, but Im afraid use of double quotes for strings is deep
> seated
> for me from C/C++. NOw we are on the topic, I've got to say that
> interpreting "01 as shorthand for
> octal 01 was just a daft overload of the language, it really seems
> half-baked, look at these examples for illustration:
> ... deleted ...

I wholeheartedly agree, the double-quotes-is-octal thing is definitely
a loser. The single-quotes-is-hexadecimal works for me, but somehow I
am pretty used to it. While I am always pretty much aligned with 100%
backwards compatibility, octal constants are one thing that I
definitely feel should be removed (except for the Mac OS X version?).

If you see them in new code, run, don't hide. If you see them in old
code, change them fast! They can be achieved much more reliably with
single quotes.

Craig

--
------------------------------------------------------------ --------------
Craig B. Markwardt, Ph.D. EMAIL: craigmnet@cow.physics.wisc.edu
Astrophysics, IDL, Finance, Derivatives | Remove "net" for better response
------------------------------------------------------------ --------------
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: Titles
Next Topic: Passing strings to CALL_EXTERNAL

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

Current Time: Wed Oct 08 13:47:01 PDT 2025

Total time taken to generate the page: 0.00702 seconds