[Tex/LaTex] Hieroglyphs numerals

#enumeratecountersnumbering

Can someone give me a hint how do I obtain hieroglyphs numerals 1–1000 in XeTeX?
I'm using this package:

\usepackage{hieroglf}

I need a macro with

\hg{\n} which prints \n in Hieroglyphs.

EDIT

Your solution is good, but for the fact that it already uses
incorrect character at number 1!

I need to accomplish these both things at once: to correct the starting number according to the snippet below and to extend the following sequence of roman,arabic,babyloniannum to
hieroglyphs. My base will be 10.

\renewcommand{\theenumi}{\roman{enumi}--\arabic{enumi}--\!\!\!\!\!\babyloniannum{\value{enumi}}\!\!\!}

enter image description here

Best Answer

UPDATE: Thanks for posting an MWE. Here is something that does that.

\documentclass{article}
\usepackage{hieroglf}
\newcounter{hieroaux}
\newcounter{hierocurr}
\newcommand{\HieroDigit}[1]{\ifcase#1
\or
\Hone
\or
\Hten
\or
\Hhundred
\or
\Hthousand
\or
\HXthousand
\or
\HCthousand
\or
\Hmillion
\fi}
\DeclareRobustCommand\hg[1]{\setcounter{hierocurr}{#1}%
\ifnum\value{hierocurr}>999999
 \setcounter{hieroaux}{0}%
 \loop\stepcounter{hieroaux}\textpmhg{\HieroDigit{7}}%
 \ifnum\value{hieroaux}<\the\numexpr(\value{hierocurr}-500000)/1000000\relax%
 \repeat%
 \setcounter{hierocurr}{\the\numexpr\value{hierocurr}-\value{hieroaux}*1000000}%
\fi
\ifnum\value{hierocurr}>99999
 \setcounter{hieroaux}{0}%
 \loop\stepcounter{hieroaux}\textpmhg{\HieroDigit{6}}%
 \ifnum\value{hieroaux}<\the\numexpr(\value{hierocurr}-50000)/100000\relax%
 \repeat%
 \setcounter{hierocurr}{\the\numexpr\value{hierocurr}-\value{hieroaux}*100000}%
\fi%
\ifnum\value{hierocurr}>9999
 \setcounter{hieroaux}{0}%
 \loop\stepcounter{hieroaux}\textpmhg{\HieroDigit{5}}%
 \ifnum\value{hieroaux}<\the\numexpr(\value{hierocurr}-5000)/10000\relax%
 \repeat%
 \setcounter{hierocurr}{\the\numexpr\value{hierocurr}-\value{hieroaux}*10000}%
\fi%
\ifnum\value{hierocurr}>999
 \setcounter{hieroaux}{0}%
 \loop\stepcounter{hieroaux}\textpmhg{\HieroDigit{4}}%
 \ifnum\value{hieroaux}<\the\numexpr(\value{hierocurr}-500)/1000\relax%
 \repeat%
 \setcounter{hierocurr}{\the\numexpr\value{hierocurr}-\value{hieroaux}*1000}%
\fi%
\ifnum\value{hierocurr}>99
 \setcounter{hieroaux}{0}%
 \loop\stepcounter{hieroaux}\textpmhg{\HieroDigit{3}}%
 \ifnum\value{hieroaux}<\the\numexpr(\value{hierocurr}-50)/100\relax%
 \repeat%
 \setcounter{hierocurr}{\the\numexpr\value{hierocurr}-\value{hieroaux}*100}%
\fi%
\ifnum\value{hierocurr}>9
 \setcounter{hieroaux}{0}%
 \loop\stepcounter{hieroaux}\textpmhg{\HieroDigit{2}}%
 \ifnum\value{hieroaux}<\the\numexpr(\value{hierocurr}-5)/10\relax%
 \repeat%
 \setcounter{hierocurr}{\the\numexpr\value{hierocurr}-\value{hieroaux}*10}%
\fi%
\ifnum\value{hierocurr}>0
 \setcounter{hieroaux}{0}%
 \loop\stepcounter{hieroaux}\textpmhg{\HieroDigit{1}}%
 \ifnum\value{hieroaux}<\value{hierocurr}\relax%
 \repeat%
\fi}
\begin{document}
\renewcommand{\thesection}{\hg{\value{section}}}
\section{Examples}

$5=\hg{5}$\par
$36=\hg{36}$\par
$2357468=\hg{2357468}$\par
$\hg{7}\cdot\hg{6}=\hg{42}$\par
$\displaystyle\frac{\hg{3131}}{\hg{101}}=\hg{31}$\par
$\pi=\hg{3}.\hg{14159}$


\section{Numbered lists}

\renewcommand{\theenumi}{\roman{enumi}--\arabic{enumi}--\hg{\value{enumi}}}
\begin{enumerate}
 \item A
 \item B
\end{enumerate}
\end{document}

enter image description here

OLD (AND COMPLETELY UNEGYTIAN) ANSWER: I'd like to start by saying that I have no idea whatsoever about hieroglyphs. This is just for fun. I copied some of the hieroglyphs from the hieroglf package source. Since there was a block of 74+1 of them, this gives you numerals with base 74. If you want another base, please provide an MWE from which I can learn what the appropriate digits and base are. Other than that I added a clumsy modulo and int function that does not need extra packages. If you want to make this more elegant, you may want to specify if you are OK with loading xint or pgf.

\documentclass{article}
\usepackage{hieroglf}
\newcommand\HieroGlf[1]{\ifcase#1
\Hdual
\or
\HAi
\or
\HAii
\or
\HAxxviii
\or
\HCxi
\or
\HDi
\or
\HDii
\or
\HDiv
\or
\HDxxi
\or
\HDxxxvi
\or
\HDxlvi
\or
\HDxlvii
\or
\HDl
\or
\HDliv
\or
\HDlviii
\or
\HExxiii
\or
\HFi
\or
\HFxx
\or
\HFxxxi
\or
\HFxxxiv
\or
\HFxl
\or
\HGi
\or
\HGxvii
\or
\HGxxvi
\or
\HGxxvis
\or
\HGxxvii
\or
\HGxxviii
\or
\HGxxxvi
\or
\HGxliii
\or
\HHviii
\or
\HIviii
\or
\HIix
\or
\HIx
\or
\HKi
\or
\HMiii
\or
\HMviii
\or
\HMxii
\or
\HMxvii
\or
\HNxxix
\or
\HNxxxv
\or
\HNxxxvii
\or
\HOi
\or
\HOiv
\or
\HOxxxiv
\or
\HQiii
\or
\HRvii
\or
\HSxii
\or
\HSxxix
\or
\HSxxxix
\or
\HSxli
\or
\HTiii
\or
\HTxiv
\or
\HUxxxvi
\or
\HVi
\or
\HViv
\or
\HVxiii
\or
\HVxx
\or
\HVxxiv
\or
\HVxxviii
\or
\HVxxxi
\or
\HWxi
\or
\HXi
\or
\HYiV
\or
\HYiv
\or
\HZi
\or
\HZii
\or
\HZiv
\or
\HZvi
\or
\HZvii
\or
\HZxi
\or
\HAai
\or
\HAaxii
\or
\HPWi
\or
\HPWii
\fi}
\newcommand{\hieronumeral}[1]{\edef\temp{#1}%
\ifnum\the\numexpr\temp/(74*74)>1%
\textpmhg{\HieroGlf{\the\numexpr\temp/(74*74)-1}}%
\edef\temp{\the\numexpr\temp-74*74*\the\numexpr\temp/(74*74)-1\relax}%
\fi%
\ifnum\the\numexpr(\temp+37)/74>1%
\textpmhg{\HieroGlf{\the\numexpr(\temp+37)/74-1}}%
\edef\temp{\the\numexpr\temp-74*\the\numexpr(\temp+37)/74-1\relax}%
\else%
\ifnum#1>74%
0%
\fi%
\fi%
\textpmhg{\HieroGlf{\temp}}}
\begin{document}
$123=\hieronumeral{123}$ 

\newcounter{iloop}
\setcounter{iloop}{0}
\loop\stepcounter{iloop}
$\number\value{iloop}=\hieronumeral{\number\value{iloop}}$,
\ifnum\number\value{iloop}<999\repeat%
$1000=\hieronumeral{1000}$
\end{document}

enter image description here