\hypertarget{group__Eina__Convert__Group}{}\section{Convert}
\label{group__Eina__Convert__Group}\index{Convert@{Convert}}


These functions allow you to convert integer or real numbers to string or conversely.  


\subsection*{Functions}
\begin{DoxyCompactItemize}
\item 
\hyperlink{group__Elua_ga3db3556eec8ef18cb8ddb43816974ac8}{E\+A\+P\+I} int \hyperlink{group__Eina__Convert__Group_gafe831a6e2a4017b2fae5c29d60d53586}{eina\+\_\+convert\+\_\+itoa} (int n, char $\ast$s) \hyperlink{group__Eina__Types__Group_ga1a066aa3069f7e43279021cc1e378fac}{E\+I\+N\+A\+\_\+\+A\+R\+G\+\_\+\+N\+O\+N\+N\+U\+L\+L}(2)
\begin{DoxyCompactList}\small\item\em Convert an integer number to a string in decimal base. \end{DoxyCompactList}\item 
\hyperlink{group__Elua_ga3db3556eec8ef18cb8ddb43816974ac8}{E\+A\+P\+I} int \hyperlink{group__Eina__Convert__Group_gae539636184d2c4e80c2e29bf26f40be1}{eina\+\_\+convert\+\_\+xtoa} (unsigned int n, char $\ast$s) \hyperlink{group__Eina__Types__Group_ga1a066aa3069f7e43279021cc1e378fac}{E\+I\+N\+A\+\_\+\+A\+R\+G\+\_\+\+N\+O\+N\+N\+U\+L\+L}(2)
\begin{DoxyCompactList}\small\item\em Convert an integer number to a string in hexadecimal base. \end{DoxyCompactList}\item 
\hyperlink{group__Elua_ga3db3556eec8ef18cb8ddb43816974ac8}{E\+A\+P\+I} int \hyperlink{group__Eina__Convert__Group_ga033cc5d08cc40bd61943b38273dc5c33}{eina\+\_\+convert\+\_\+dtoa} (double d, char $\ast$des) \hyperlink{group__Eina__Types__Group_ga1a066aa3069f7e43279021cc1e378fac}{E\+I\+N\+A\+\_\+\+A\+R\+G\+\_\+\+N\+O\+N\+N\+U\+L\+L}(2)
\begin{DoxyCompactList}\small\item\em Convert a double to a string. \end{DoxyCompactList}\item 
\hyperlink{group__Elua_ga3db3556eec8ef18cb8ddb43816974ac8}{E\+A\+P\+I} \hyperlink{group__Eina__Types__Group_ga3fe0caf72e93b1bab1ca8ee3ccf3f226}{Eina\+\_\+\+Bool} \hyperlink{group__Eina__Convert__Group_gae19e891bfefff785bc42c9ec72bdb224}{eina\+\_\+convert\+\_\+atod} (const char $\ast$src, int length, long long $\ast$m, long $\ast$e) \hyperlink{group__Eina__Types__Group_ga1a066aa3069f7e43279021cc1e378fac}{E\+I\+N\+A\+\_\+\+A\+R\+G\+\_\+\+N\+O\+N\+N\+U\+L\+L}(1
\begin{DoxyCompactList}\small\item\em Convert a string to a double. \end{DoxyCompactList}\item 
\hyperlink{group__Elua_ga3db3556eec8ef18cb8ddb43816974ac8}{E\+A\+P\+I} \hyperlink{group__Eina__Types__Group_ga3fe0caf72e93b1bab1ca8ee3ccf3f226}{Eina\+\_\+\+Bool} \hyperlink{group__Elua_ga3db3556eec8ef18cb8ddb43816974ac8}{E\+A\+P\+I} int \hyperlink{group__Eina__Convert__Group_gaec03d1cb47203e9b66090b4388e40ff3}{eina\+\_\+convert\+\_\+fptoa} (\hyperlink{group__Eina__Fp__Group_ga5264584bb5c6d81dd71d36f9e4e517f1}{Eina\+\_\+\+F32p32} fp, char $\ast$des) \hyperlink{group__Eina__Types__Group_ga1a066aa3069f7e43279021cc1e378fac}{E\+I\+N\+A\+\_\+\+A\+R\+G\+\_\+\+N\+O\+N\+N\+U\+L\+L}(2)
\begin{DoxyCompactList}\small\item\em Convert a 32.\+32 fixed point number to a string. \end{DoxyCompactList}\item 
\hyperlink{group__Elua_ga3db3556eec8ef18cb8ddb43816974ac8}{E\+A\+P\+I} \hyperlink{group__Eina__Types__Group_ga3fe0caf72e93b1bab1ca8ee3ccf3f226}{Eina\+\_\+\+Bool} \hyperlink{group__Eina__Convert__Group_gad78818286f5d7c3a0dc06eb50f2a133e}{eina\+\_\+convert\+\_\+atofp} (const char $\ast$src, int length, \hyperlink{group__Eina__Fp__Group_ga5264584bb5c6d81dd71d36f9e4e517f1}{Eina\+\_\+\+F32p32} $\ast$fp) \hyperlink{group__Eina__Types__Group_ga1a066aa3069f7e43279021cc1e378fac}{E\+I\+N\+A\+\_\+\+A\+R\+G\+\_\+\+N\+O\+N\+N\+U\+L\+L}(1
\begin{DoxyCompactList}\small\item\em Convert a string to a 32.\+32 fixed point number. \end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Variables}
\begin{DoxyCompactItemize}
\item 
\hypertarget{group__Eina__Convert__Group_gabffa0e511b7f490b1b5aef7297970a33}{}\hyperlink{group__Elua_ga3db3556eec8ef18cb8ddb43816974ac8}{E\+A\+P\+I} \hyperlink{group__Eina__Error__Group_ga95b3cbb33e987e7d92a81ea785001686}{Eina\+\_\+\+Error} \hyperlink{group__Eina__Convert__Group_gabffa0e511b7f490b1b5aef7297970a33}{E\+I\+N\+A\+\_\+\+E\+R\+R\+O\+R\+\_\+\+C\+O\+N\+V\+E\+R\+T\+\_\+\+P\+\_\+\+N\+O\+T\+\_\+\+F\+O\+U\+N\+D}\label{group__Eina__Convert__Group_gabffa0e511b7f490b1b5aef7297970a33}

\begin{DoxyCompactList}\small\item\em Not used, perhaps a placeholder? Defined as 0 in eina\+\_\+convert.\+c. \end{DoxyCompactList}\item 
\hypertarget{group__Eina__Convert__Group_ga8d6d0c014cab017e97c3a383bcf0300c}{}\hyperlink{group__Elua_ga3db3556eec8ef18cb8ddb43816974ac8}{E\+A\+P\+I} \hyperlink{group__Eina__Error__Group_ga95b3cbb33e987e7d92a81ea785001686}{Eina\+\_\+\+Error} \hyperlink{group__Eina__Convert__Group_ga8d6d0c014cab017e97c3a383bcf0300c}{E\+I\+N\+A\+\_\+\+E\+R\+R\+O\+R\+\_\+\+C\+O\+N\+V\+E\+R\+T\+\_\+0\+X\+\_\+\+N\+O\+T\+\_\+\+F\+O\+U\+N\+D}\label{group__Eina__Convert__Group_ga8d6d0c014cab017e97c3a383bcf0300c}

\begin{DoxyCompactList}\small\item\em Not used, perhaps a placeholder? Defined as 0 in eina\+\_\+convert.\+c. \end{DoxyCompactList}\item 
\hypertarget{group__Eina__Convert__Group_ga9a0ed4d1300fb636797b638124c0cbe6}{}\hyperlink{group__Elua_ga3db3556eec8ef18cb8ddb43816974ac8}{E\+A\+P\+I} \hyperlink{group__Eina__Error__Group_ga95b3cbb33e987e7d92a81ea785001686}{Eina\+\_\+\+Error} \hyperlink{group__Eina__Convert__Group_ga9a0ed4d1300fb636797b638124c0cbe6}{E\+I\+N\+A\+\_\+\+E\+R\+R\+O\+R\+\_\+\+C\+O\+N\+V\+E\+R\+T\+\_\+\+O\+U\+T\+R\+U\+N\+\_\+\+S\+T\+R\+I\+N\+G\+\_\+\+L\+E\+N\+G\+T\+H}\label{group__Eina__Convert__Group_ga9a0ed4d1300fb636797b638124c0cbe6}

\begin{DoxyCompactList}\small\item\em Not used, perhaps a placeholder? Defined as 0 in eina\+\_\+convert.\+c. \end{DoxyCompactList}\end{DoxyCompactItemize}


\subsection{Detailed Description}
These functions allow you to convert integer or real numbers to string or conversely. 

To use these functions, you have to call \hyperlink{group__Eina__Main__Group_gabf448ada5bc81a07342b66c6f818ee5e}{eina\+\_\+init()} first, and \hyperlink{group__Eina__Main__Group_ga6741fcaba116e31e96ce14dcfa03f568}{eina\+\_\+shutdown()} when eina is not used anymore.\hypertarget{group__Eina__Convert__Group_Eina_Convert_From_Integer_To_Sring}{}\subsection{Conversion from integer to string}\label{group__Eina__Convert__Group_Eina_Convert_From_Integer_To_Sring}
To convert an integer to a string in the decimal base, \hyperlink{group__Eina__Convert__Group_gafe831a6e2a4017b2fae5c29d60d53586}{eina\+\_\+convert\+\_\+itoa()} should be used. If the hexadecimal base is wanted, \hyperlink{group__Eina__Convert__Group_gae539636184d2c4e80c2e29bf26f40be1}{eina\+\_\+convert\+\_\+xtoa()} should be used. They all need a buffer sufficiently large to store all the cyphers.

Here is an example of use\+:


\begin{DoxyCode}
\textcolor{preprocessor}{#include <stdlib.h>}
\textcolor{preprocessor}{#include <stdio.h>}

\textcolor{preprocessor}{#include <\hyperlink{Eina_8h}{Eina.h}>}

\textcolor{keywordtype}{int} main(\textcolor{keywordtype}{void})
\{
   \textcolor{keywordtype}{char} tmp[128];

   \textcolor{keywordflow}{if} (!\hyperlink{group__Eina__Main__Group_gabf448ada5bc81a07342b66c6f818ee5e}{eina\_init}())
   \{
       printf (\textcolor{stringliteral}{"Error during the initialization of eina.\(\backslash\)n"});
       \textcolor{keywordflow}{return} EXIT\_FAILURE;
   \}

   \hyperlink{group__Eina__Convert__Group_gafe831a6e2a4017b2fae5c29d60d53586}{eina\_convert\_itoa}(45, tmp);
   printf(\textcolor{stringliteral}{"value: %s\(\backslash\)n"}, tmp);
   \hyperlink{group__Eina__Convert__Group_gae539636184d2c4e80c2e29bf26f40be1}{eina\_convert\_xtoa}(0xA1, tmp);
   printf(\textcolor{stringliteral}{"value: %s\(\backslash\)n"}, tmp);

   \hyperlink{group__Eina__Main__Group_ga6741fcaba116e31e96ce14dcfa03f568}{eina\_shutdown}();

   \textcolor{keywordflow}{return} EXIT\_SUCCESS;
\}
\end{DoxyCode}


Compile this code with the following command\+:


\begin{DoxyCode}
gcc -Wall -o test\_eina\_convert test\_eina.c `pkg-config --cflags --libs eina`
\end{DoxyCode}


\begin{DoxyNote}{Note}
The alphabetical cyphers are in lower case.
\end{DoxyNote}
\hypertarget{group__Eina__Convert__Group_Eina_Convert_Double}{}\subsection{Conversion double / string}\label{group__Eina__Convert__Group_Eina_Convert_Double}
To convert a double to a string, \hyperlink{group__Eina__Convert__Group_ga033cc5d08cc40bd61943b38273dc5c33}{eina\+\_\+convert\+\_\+dtoa()} should be used. Like with the integer functions, a buffer must be used. The resulting string has the following format (which is the result obtained with snprintf() and the \%a modifier)\+:


\begin{DoxyCode}
[-]0xh.hhhhhp[+-]e
\end{DoxyCode}


To convert a string to a double, \hyperlink{group__Eina__Convert__Group_gae19e891bfefff785bc42c9ec72bdb224}{eina\+\_\+convert\+\_\+atod()} should be used. The format of the string must be as above. Then, the double has the following mantiss and exponent\+:


\begin{DoxyCode}
mantiss  : [-]hhhhhh
exponent : 2^([+-]e - 4 * n)
\end{DoxyCode}


with n being number of cypers after the point in the string format. To obtain the double number from the mantiss and exponent, use ldexp().

Here is an example of use\+:


\begin{DoxyCode}
\textcolor{preprocessor}{#include <stdlib.h>}
\textcolor{preprocessor}{#include <stdio.h>}
\textcolor{preprocessor}{#include <math.h>}

\textcolor{preprocessor}{#include <\hyperlink{Eina_8h}{Eina.h}>}

\textcolor{keywordtype}{int} main(\textcolor{keywordtype}{void})
\{
   \textcolor{keywordtype}{char}      tmp[128];
   \textcolor{keywordtype}{long} \textcolor{keywordtype}{long} \textcolor{keywordtype}{int} m = 0;
   \textcolor{keywordtype}{long} \textcolor{keywordtype}{int}  e = 0;
   \textcolor{keywordtype}{double}    r;

   \textcolor{keywordflow}{if} (!\hyperlink{group__Eina__Main__Group_gabf448ada5bc81a07342b66c6f818ee5e}{eina\_init}())
   \{
       printf (\textcolor{stringliteral}{"Error during the initialization of eina.\(\backslash\)n"});
       \textcolor{keywordflow}{return} EXIT\_FAILURE;
   \}

   printf(\textcolor{stringliteral}{"initial value : 40.56\(\backslash\)n"});
   \hyperlink{group__Eina__Convert__Group_ga033cc5d08cc40bd61943b38273dc5c33}{eina\_convert\_dtoa}(40.56, tmp);
   printf(\textcolor{stringliteral}{"result dtoa   : %s\(\backslash\)n"}, tmp);

   \hyperlink{group__Eina__Convert__Group_gae19e891bfefff785bc42c9ec72bdb224}{eina\_convert\_atod}(tmp, 128, &m, &e);
   r = ldexp((\textcolor{keywordtype}{double})m, e);
   printf(\textcolor{stringliteral}{"result atod   : %f\(\backslash\)n"}, r);

   \hyperlink{group__Eina__Main__Group_ga6741fcaba116e31e96ce14dcfa03f568}{eina\_shutdown}();

   \textcolor{keywordflow}{return} EXIT\_SUCCESS;
\}
\end{DoxyCode}


Compile this code with the following command\+:


\begin{DoxyCode}
gcc -Wall -o test\_eina\_convert test\_eina.c `pkg-config --cflags --libs eina` -lm
\end{DoxyCode}
 

\subsection{Function Documentation}
\hypertarget{group__Eina__Convert__Group_gafe831a6e2a4017b2fae5c29d60d53586}{}\index{Convert@{Convert}!eina\+\_\+convert\+\_\+itoa@{eina\+\_\+convert\+\_\+itoa}}
\index{eina\+\_\+convert\+\_\+itoa@{eina\+\_\+convert\+\_\+itoa}!Convert@{Convert}}
\subsubsection[{eina\+\_\+convert\+\_\+itoa(int n, char $\ast$s) E\+I\+N\+A\+\_\+\+A\+R\+G\+\_\+\+N\+O\+N\+N\+U\+L\+L(2)}]{\setlength{\rightskip}{0pt plus 5cm}{\bf E\+A\+P\+I} int eina\+\_\+convert\+\_\+itoa (
\begin{DoxyParamCaption}
\item[{int}]{n, }
\item[{char $\ast$}]{s}
\end{DoxyParamCaption}
)}\label{group__Eina__Convert__Group_gafe831a6e2a4017b2fae5c29d60d53586}


Convert an integer number to a string in decimal base. 


\begin{DoxyParams}{Parameters}
{\em n} & The integer to convert. \\
\hline
{\em s} & The buffer to store the converted integer. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
The length of the string, including the nul terminated character.
\end{DoxyReturn}
This function converts {\ttfamily n} to a nul terminated string. The converted string is in decimal base. As no check is done, {\ttfamily s} must be a buffer that is sufficiently large to store the integer.

The returned value is the length of the string, including the nul terminated character. 

Referenced by eet\+\_\+node\+\_\+dump(), eina\+\_\+convert\+\_\+dtoa(), eina\+\_\+convert\+\_\+fptoa(), and eina\+\_\+xattr\+\_\+int\+\_\+set().

\hypertarget{group__Eina__Convert__Group_gae539636184d2c4e80c2e29bf26f40be1}{}\index{Convert@{Convert}!eina\+\_\+convert\+\_\+xtoa@{eina\+\_\+convert\+\_\+xtoa}}
\index{eina\+\_\+convert\+\_\+xtoa@{eina\+\_\+convert\+\_\+xtoa}!Convert@{Convert}}
\subsubsection[{eina\+\_\+convert\+\_\+xtoa(unsigned int n, char $\ast$s) E\+I\+N\+A\+\_\+\+A\+R\+G\+\_\+\+N\+O\+N\+N\+U\+L\+L(2)}]{\setlength{\rightskip}{0pt plus 5cm}{\bf E\+A\+P\+I} int eina\+\_\+convert\+\_\+xtoa (
\begin{DoxyParamCaption}
\item[{unsigned int}]{n, }
\item[{char $\ast$}]{s}
\end{DoxyParamCaption}
)}\label{group__Eina__Convert__Group_gae539636184d2c4e80c2e29bf26f40be1}


Convert an integer number to a string in hexadecimal base. 


\begin{DoxyParams}{Parameters}
{\em n} & The integer to convert. \\
\hline
{\em s} & The buffer to store the converted integer. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
The length of the string, including the nul terminated character.
\end{DoxyReturn}
This function converts {\ttfamily n} to a nul terminated string. The converted string is in hexadecimal base and the alphabetical cyphers are in lower case. As no check is done, {\ttfamily s} must be a buffer that is sufficiently large to store the integer.

The returned value is the length of the string, including the nul terminated character. \hypertarget{group__Eina__Convert__Group_ga033cc5d08cc40bd61943b38273dc5c33}{}\index{Convert@{Convert}!eina\+\_\+convert\+\_\+dtoa@{eina\+\_\+convert\+\_\+dtoa}}
\index{eina\+\_\+convert\+\_\+dtoa@{eina\+\_\+convert\+\_\+dtoa}!Convert@{Convert}}
\subsubsection[{eina\+\_\+convert\+\_\+dtoa(double d, char $\ast$des) E\+I\+N\+A\+\_\+\+A\+R\+G\+\_\+\+N\+O\+N\+N\+U\+L\+L(2)}]{\setlength{\rightskip}{0pt plus 5cm}{\bf E\+A\+P\+I} int eina\+\_\+convert\+\_\+dtoa (
\begin{DoxyParamCaption}
\item[{double}]{d, }
\item[{char $\ast$}]{des}
\end{DoxyParamCaption}
)}\label{group__Eina__Convert__Group_ga033cc5d08cc40bd61943b38273dc5c33}


Convert a double to a string. 


\begin{DoxyParams}{Parameters}
{\em d} & The double to convert. \\
\hline
{\em des} & The destination buffer to store the converted double. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
\hyperlink{group__Eina__Types__Group_ga05c12dacc8b4058994df842b41be85fc}{E\+I\+N\+A\+\_\+\+T\+R\+U\+E} on success, \hyperlink{group__Eina__Types__Group_ga1feb115f8e9913e806e090d9bd5a7301}{E\+I\+N\+A\+\_\+\+F\+A\+L\+S\+E} otherwise.
\end{DoxyReturn}
This function converts the double {\ttfamily d} to a string. The string is stored in the buffer pointed by {\ttfamily des} and must be sufficiently large to contain the converted double. The returned string is nul terminated and has the following format\+:


\begin{DoxyCode}
1 [-]0xh.hhhhhp[+-]e
\end{DoxyCode}


where the h are the hexadecimal cyphers of the mantiss and e the exponent (a decimal number).

The returned value is the length of the string, including the nul character. 

References eina\+\_\+convert\+\_\+itoa(), and E\+I\+N\+A\+\_\+\+F\+A\+L\+S\+E.



Referenced by eina\+\_\+xattr\+\_\+double\+\_\+set().

\hypertarget{group__Eina__Convert__Group_gae19e891bfefff785bc42c9ec72bdb224}{}\index{Convert@{Convert}!eina\+\_\+convert\+\_\+atod@{eina\+\_\+convert\+\_\+atod}}
\index{eina\+\_\+convert\+\_\+atod@{eina\+\_\+convert\+\_\+atod}!Convert@{Convert}}
\subsubsection[{eina\+\_\+convert\+\_\+atod(const char $\ast$src, int length, long long $\ast$m, long $\ast$e) E\+I\+N\+A\+\_\+\+A\+R\+G\+\_\+\+N\+O\+N\+N\+U\+L\+L(1}]{\setlength{\rightskip}{0pt plus 5cm}{\bf E\+A\+P\+I} {\bf Eina\+\_\+\+Bool} eina\+\_\+convert\+\_\+atod (
\begin{DoxyParamCaption}
\item[{const char $\ast$}]{src, }
\item[{int}]{length, }
\item[{long long $\ast$}]{m, }
\item[{long $\ast$}]{e}
\end{DoxyParamCaption}
)}\label{group__Eina__Convert__Group_gae19e891bfefff785bc42c9ec72bdb224}


Convert a string to a double. 


\begin{DoxyParams}{Parameters}
{\em src} & The string to convert. \\
\hline
{\em length} & The length of the string. \\
\hline
{\em m} & The mantisse. \\
\hline
{\em e} & The exponent. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
\hyperlink{group__Eina__Types__Group_ga05c12dacc8b4058994df842b41be85fc}{E\+I\+N\+A\+\_\+\+T\+R\+U\+E} on success, \hyperlink{group__Eina__Types__Group_ga1feb115f8e9913e806e090d9bd5a7301}{E\+I\+N\+A\+\_\+\+F\+A\+L\+S\+E} otherwise.
\end{DoxyReturn}
This function converts the string {\ttfamily s} of length {\ttfamily length} that represent a double in hexadecimal base to a double. It is used to replace the use of snprintf() with the \%a modifier, which is missing on some platform (like Windows (tm) or Open\+B\+S\+D).

The string must have the following format\+:


\begin{DoxyCode}
1 [-]0xh.hhhhhp[+-]e
\end{DoxyCode}


where the h are the hexadecimal cyphers of the mantiss and e the exponent (a decimal number). If n is the number of cypers after the point, the returned mantiss and exponents are\+:


\begin{DoxyCode}
1 mantiss  : [-]hhhhhh
2 exponent : 2^([+-]e - 4 * n)
\end{DoxyCode}


The mantiss and exponent are stored in the buffers pointed respectively by {\ttfamily m} and {\ttfamily e}.

If the string is invalid \hyperlink{group__Eina__Types__Group_ga1feb115f8e9913e806e090d9bd5a7301}{E\+I\+N\+A\+\_\+\+F\+A\+L\+S\+E} is returned, otherwise \hyperlink{group__Eina__Types__Group_ga05c12dacc8b4058994df842b41be85fc}{E\+I\+N\+A\+\_\+\+T\+R\+U\+E} is returned. 

Referenced by eina\+\_\+xattr\+\_\+double\+\_\+get().

\hypertarget{group__Eina__Convert__Group_gaec03d1cb47203e9b66090b4388e40ff3}{}\index{Convert@{Convert}!eina\+\_\+convert\+\_\+fptoa@{eina\+\_\+convert\+\_\+fptoa}}
\index{eina\+\_\+convert\+\_\+fptoa@{eina\+\_\+convert\+\_\+fptoa}!Convert@{Convert}}
\subsubsection[{eina\+\_\+convert\+\_\+fptoa(\+Eina\+\_\+\+F32p32 fp, char $\ast$des) E\+I\+N\+A\+\_\+\+A\+R\+G\+\_\+\+N\+O\+N\+N\+U\+L\+L(2)}]{\setlength{\rightskip}{0pt plus 5cm}{\bf E\+A\+P\+I} {\bf Eina\+\_\+\+Bool} {\bf E\+A\+P\+I} int eina\+\_\+convert\+\_\+fptoa (
\begin{DoxyParamCaption}
\item[{{\bf Eina\+\_\+\+F32p32}}]{fp, }
\item[{char $\ast$}]{des}
\end{DoxyParamCaption}
)}\label{group__Eina__Convert__Group_gaec03d1cb47203e9b66090b4388e40ff3}


Convert a 32.\+32 fixed point number to a string. 


\begin{DoxyParams}{Parameters}
{\em fp} & The fixed point number to convert. \\
\hline
{\em des} & The destination buffer to store the converted fixed point number. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
\hyperlink{group__Eina__Types__Group_ga05c12dacc8b4058994df842b41be85fc}{E\+I\+N\+A\+\_\+\+T\+R\+U\+E} on success, \hyperlink{group__Eina__Types__Group_ga1feb115f8e9913e806e090d9bd5a7301}{E\+I\+N\+A\+\_\+\+F\+A\+L\+S\+E} otherwise.
\end{DoxyReturn}
This function converts the 32.\+32 fixed point number {\ttfamily fp} to a string. The string is stored in the buffer pointed by {\ttfamily des} and must be sufficiently large to contain the converted fixed point number. The returned string is terminated and has the following format\+:


\begin{DoxyCode}
1 [-]0xh.hhhhhp[+-]e
\end{DoxyCode}


where the h are the hexadecimal cyphers of the mantiss and e the exponent (a decimal number).

The returned value is the length of the string, including the nul character.

\begin{DoxyNote}{Note}
The code is the same than \hyperlink{group__Eina__Convert__Group_ga033cc5d08cc40bd61943b38273dc5c33}{eina\+\_\+convert\+\_\+dtoa()} except that it implements the frexp() function for fixed point numbers and does some optimisations. 
\end{DoxyNote}


References eina\+\_\+convert\+\_\+itoa(), and E\+I\+N\+A\+\_\+\+F\+A\+L\+S\+E.

\hypertarget{group__Eina__Convert__Group_gad78818286f5d7c3a0dc06eb50f2a133e}{}\index{Convert@{Convert}!eina\+\_\+convert\+\_\+atofp@{eina\+\_\+convert\+\_\+atofp}}
\index{eina\+\_\+convert\+\_\+atofp@{eina\+\_\+convert\+\_\+atofp}!Convert@{Convert}}
\subsubsection[{eina\+\_\+convert\+\_\+atofp(const char $\ast$src, int length, Eina\+\_\+\+F32p32 $\ast$fp) E\+I\+N\+A\+\_\+\+A\+R\+G\+\_\+\+N\+O\+N\+N\+U\+L\+L(1}]{\setlength{\rightskip}{0pt plus 5cm}{\bf E\+A\+P\+I} {\bf Eina\+\_\+\+Bool} eina\+\_\+convert\+\_\+atofp (
\begin{DoxyParamCaption}
\item[{const char $\ast$}]{src, }
\item[{int}]{length, }
\item[{{\bf Eina\+\_\+\+F32p32} $\ast$}]{fp}
\end{DoxyParamCaption}
)}\label{group__Eina__Convert__Group_gad78818286f5d7c3a0dc06eb50f2a133e}


Convert a string to a 32.\+32 fixed point number. 


\begin{DoxyParams}{Parameters}
{\em src} & The string to convert. \\
\hline
{\em length} & The length of the string. \\
\hline
{\em fp} & The fixed point number. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
\hyperlink{group__Eina__Types__Group_ga05c12dacc8b4058994df842b41be85fc}{E\+I\+N\+A\+\_\+\+T\+R\+U\+E} on success, \hyperlink{group__Eina__Types__Group_ga1feb115f8e9913e806e090d9bd5a7301}{E\+I\+N\+A\+\_\+\+F\+A\+L\+S\+E} otherwise.
\end{DoxyReturn}
This function converts the string {\ttfamily src} of length {\ttfamily length} that represent a double in hexadecimal base to a 32.\+32 fixed point number stored in {\ttfamily fp}. The function always tries to convert the string with \hyperlink{group__Eina__Convert__Group_gae19e891bfefff785bc42c9ec72bdb224}{eina\+\_\+convert\+\_\+atod()}.

The string must have the following format\+:


\begin{DoxyCode}
1 [-]0xh.hhhhhp[+-]e
\end{DoxyCode}


where the h are the hexadecimal cyphers of the mantiss and e the exponent (a decimal number). If n is the number of cypers after the point, the returned mantiss and exponents are\+:


\begin{DoxyCode}
1 mantiss  : [-]hhhhhh
2 exponent : 2^([+-]e - 4 * n)
\end{DoxyCode}


The mantiss and exponent are stored in the buffers pointed respectively by {\ttfamily m} and {\ttfamily e}.

If the string is invalid, \hyperlink{group__Eina__Types__Group_ga1feb115f8e9913e806e090d9bd5a7301}{E\+I\+N\+A\+\_\+\+F\+A\+L\+S\+E} is returned, otherwise {\ttfamily fp} is computed and \hyperlink{group__Eina__Types__Group_ga05c12dacc8b4058994df842b41be85fc}{E\+I\+N\+A\+\_\+\+T\+R\+U\+E} is returned.

\begin{DoxyNote}{Note}
The code uses \hyperlink{group__Eina__Convert__Group_gae19e891bfefff785bc42c9ec72bdb224}{eina\+\_\+convert\+\_\+atod()} and do the correct bit shift to compute the fixed point number. 
\end{DoxyNote}
