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/
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
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/
participants (2)
-
Peter Münster
-
Taco Hoekwater