* \hexstringtonumber{..}
@ 2006-06-24 15:29 Peter Münster
2006-06-24 16:05 ` \hexstringtonumber{..} Taco Hoekwater
0 siblings, 1 reply; 3+ messages in thread
From: Peter Münster @ 2006-06-24 15:29 UTC (permalink / raw)
Hello Hans,
what is the purpose of \hexstringtonumber{..}?
I would expect something like:
\unprotect
\setvalue{@@uc@@a}{10} \setvalue{@@uc@@A}{10}
\setvalue{@@uc@@b}{11} \setvalue{@@uc@@B}{11}
\setvalue{@@uc@@c}{12} \setvalue{@@uc@@C}{12}
\setvalue{@@uc@@d}{13} \setvalue{@@uc@@D}{13}
\setvalue{@@uc@@e}{14} \setvalue{@@uc@@E}{14}
\setvalue{@@uc@@f}{15} \setvalue{@@uc@@F}{15}
\def\dohexstringtonumber#1#2% FF
{\the\numexpr\csname @@uc@@#1\endcsname * 16 +
\csname @@uc@@#2\endcsname\relax}
\protect
\starttext
\hexstringtonumber{1E}
\hexstringtonumber{f5}
\stoptext
But your version just adds a " to the string...
Cheers, Peter
--
http://pmrb.free.fr/contact/
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: \hexstringtonumber{..}
2006-06-24 15:29 \hexstringtonumber{..} Peter Münster
@ 2006-06-24 16:05 ` Taco Hoekwater
2006-06-24 18:05 ` \hexstringtonumber{..} Peter Münster
0 siblings, 1 reply; 3+ messages in thread
From: Taco Hoekwater @ 2006-06-24 16:05 UTC (permalink / raw)
Peter Münster wrote:
> Hello Hans,
>
> what is the purpose of \hexstringtonumber{..}?
I am not Hans, of course, but:
Your macro is making the thing harder then needed, this
works just as well:
\starttext
\number\hexstringtonumber{1F}
\number\hexstringtonumber{f5}
\stoptext
However, like you, I would have expected it to return
a decimal value directly, like this:
\def\hexstringtonumber#1%
{\number\dohexstringtonumber#1}
Cheers, Taco
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: \hexstringtonumber{..}
2006-06-24 16:05 ` \hexstringtonumber{..} Taco Hoekwater
@ 2006-06-24 18:05 ` Peter Münster
0 siblings, 0 replies; 3+ messages in thread
From: Peter Münster @ 2006-06-24 18:05 UTC (permalink / raw)
On Sat, 24 Jun 2006, Taco Hoekwater wrote:
> Your macro is making the thing harder then needed, this
> works just as well:
>
> \starttext
> \number\hexstringtonumber{1F}
> \number\hexstringtonumber{f5}
> \stoptext
Hello Taco,
thanks for your answer! (I mentioned Hans, because he is the author of
syst-con.tex)
Now I understand the meaning of the " character: interpret the following
number as hex-value. With this knowledge, my macro becomes as easy as this:
\def\HexToNum#1{\number"#1}
since I only need uppercase hex-values.
Thanks for your enlightenment!
Cheers, Peter
--
http://pmrb.free.fr/contact/
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2006-06-24 18:05 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-06-24 15:29 \hexstringtonumber{..} Peter Münster
2006-06-24 16:05 ` \hexstringtonumber{..} Taco Hoekwater
2006-06-24 18:05 ` \hexstringtonumber{..} Peter Münster
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).