\doxysubsubsection{Convert}
\hypertarget{group__Eina__Convert__Group}{}\label{group__Eina__Convert__Group}\index{Convert@{Convert}}
\doxysubsubsubsubsection*{Functions}
\begin{DoxyCompactItemize}
\item 
\mbox{\hyperlink{group__Eina__Types__Group_ga6ac08753ba12bc9c7a0390cf67868f4f}{EINA\+\_\+\+API}} int \mbox{\hyperlink{group__Eina__Convert__Group_ga3e89edac8e4955fb645e4690ba05f0a4}{eina\+\_\+convert\+\_\+itoa}} (int n, char \texorpdfstring{$\ast$}{*}s)
\begin{DoxyCompactList}\small\item\em Converts an integer number to a string in decimal base. \end{DoxyCompactList}\item 
\mbox{\hyperlink{group__Eina__Types__Group_ga6ac08753ba12bc9c7a0390cf67868f4f}{EINA\+\_\+\+API}} int \mbox{\hyperlink{group__Eina__Convert__Group_gab010ab5bc75b33ebeb488ce3b9056a5d}{eina\+\_\+convert\+\_\+xtoa}} (unsigned int n, char \texorpdfstring{$\ast$}{*}s)
\begin{DoxyCompactList}\small\item\em Converts an integer number to a string in hexadecimal base. \end{DoxyCompactList}\item 
\mbox{\hyperlink{group__Eina__Types__Group_ga6ac08753ba12bc9c7a0390cf67868f4f}{EINA\+\_\+\+API}} int \mbox{\hyperlink{group__Eina__Convert__Group_ga55a2b35ee9143ec75a49d26a635ac137}{eina\+\_\+convert\+\_\+dtoa}} (double d, char \texorpdfstring{$\ast$}{*}des)
\begin{DoxyCompactList}\small\item\em Converts a double to a string. \end{DoxyCompactList}\item 
\mbox{\hyperlink{group__Eina__Types__Group_ga6ac08753ba12bc9c7a0390cf67868f4f}{EINA\+\_\+\+API}} \mbox{\hyperlink{group__Eina__Types__Group_ga3fe0caf72e93b1bab1ca8ee3ccf3f226}{Eina\+\_\+\+Bool}} \mbox{\hyperlink{group__Eina__Convert__Group_gaab0e72ea3f1dd41c559e84dd6c6a7eea}{eina\+\_\+convert\+\_\+atod}} (const char \texorpdfstring{$\ast$}{*}src, int length, long long \texorpdfstring{$\ast$}{*}m, long \texorpdfstring{$\ast$}{*}e)
\begin{DoxyCompactList}\small\item\em Converts a string to a double. \end{DoxyCompactList}\item 
\mbox{\hyperlink{group__Eina__Types__Group_ga6ac08753ba12bc9c7a0390cf67868f4f}{EINA\+\_\+\+API}} int \mbox{\hyperlink{group__Eina__Convert__Group_gacd163754c9a7b1fff76b5189b7daf09d}{eina\+\_\+convert\+\_\+fptoa}} (\mbox{\hyperlink{group__Eina__Fp__Group_ga5264584bb5c6d81dd71d36f9e4e517f1}{Eina\+\_\+\+F32p32}} fp, char \texorpdfstring{$\ast$}{*}des)
\begin{DoxyCompactList}\small\item\em Converts a 32.\+32 fixed point number to a string. \end{DoxyCompactList}\item 
\mbox{\hyperlink{group__Eina__Types__Group_ga6ac08753ba12bc9c7a0390cf67868f4f}{EINA\+\_\+\+API}} \mbox{\hyperlink{group__Eina__Types__Group_ga3fe0caf72e93b1bab1ca8ee3ccf3f226}{Eina\+\_\+\+Bool}} \mbox{\hyperlink{group__Eina__Convert__Group_ga1d5668d605211f997f621461e6ee3be2}{eina\+\_\+convert\+\_\+atofp}} (const char \texorpdfstring{$\ast$}{*}src, int length, \mbox{\hyperlink{group__Eina__Fp__Group_ga5264584bb5c6d81dd71d36f9e4e517f1}{Eina\+\_\+\+F32p32}} \texorpdfstring{$\ast$}{*}fp)
\begin{DoxyCompactList}\small\item\em Converts a string to a 32.\+32 fixed point number. \end{DoxyCompactList}\item 
\mbox{\hyperlink{group__Eina__Types__Group_ga6ac08753ba12bc9c7a0390cf67868f4f}{EINA\+\_\+\+API}} double \mbox{\hyperlink{group__Eina__Convert__Group_ga14620d75594abe8365b54c4ff6e8ea58}{eina\+\_\+convert\+\_\+strtod\+\_\+c}} (const char \texorpdfstring{$\ast$}{*}nptr, char \texorpdfstring{$\ast$}{*}\texorpdfstring{$\ast$}{*}endptr)
\begin{DoxyCompactList}\small\item\em Converts a string to a floating point number. \end{DoxyCompactList}\end{DoxyCompactItemize}
\doxysubsubsubsubsection*{Variables}
\begin{DoxyCompactItemize}
\item 
\Hypertarget{group__Eina__Convert__Group_gab39d348658d24c3c9e4f851fc09b9060}\label{group__Eina__Convert__Group_gab39d348658d24c3c9e4f851fc09b9060} 
\mbox{\hyperlink{group__Eina__Types__Group_ga6ac08753ba12bc9c7a0390cf67868f4f}{EINA\+\_\+\+API}} \mbox{\hyperlink{group__Eina__Error__Group_ga95b3cbb33e987e7d92a81ea785001686}{Eina\+\_\+\+Error}} {\bfseries EINA\+\_\+\+ERROR\+\_\+\+CONVERT\+\_\+\+P\+\_\+\+NOT\+\_\+\+FOUND}
\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_ga7882154b2b0f496859110da2c8a98d3a}\label{group__Eina__Convert__Group_ga7882154b2b0f496859110da2c8a98d3a} 
\mbox{\hyperlink{group__Eina__Types__Group_ga6ac08753ba12bc9c7a0390cf67868f4f}{EINA\+\_\+\+API}} \mbox{\hyperlink{group__Eina__Error__Group_ga95b3cbb33e987e7d92a81ea785001686}{Eina\+\_\+\+Error}} {\bfseries EINA\+\_\+\+ERROR\+\_\+\+CONVERT\+\_\+0\+X\+\_\+\+NOT\+\_\+\+FOUND}
\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_gac84ce0abbd23dcb6a6634b28dcb8b780}\label{group__Eina__Convert__Group_gac84ce0abbd23dcb6a6634b28dcb8b780} 
\mbox{\hyperlink{group__Eina__Types__Group_ga6ac08753ba12bc9c7a0390cf67868f4f}{EINA\+\_\+\+API}} \mbox{\hyperlink{group__Eina__Error__Group_ga95b3cbb33e987e7d92a81ea785001686}{Eina\+\_\+\+Error}} {\bfseries EINA\+\_\+\+ERROR\+\_\+\+CONVERT\+\_\+\+OUTRUN\+\_\+\+STRING\+\_\+\+LENGTH}
\begin{DoxyCompactList}\small\item\em Not used, perhaps a placeholder? Defined as 0 in eina\+\_\+convert.\+c. \end{DoxyCompactList}\end{DoxyCompactItemize}


\doxysubsubsubsection{Detailed Description}


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

To use these functions, you have to call \doxylink{group__Eina__Main__Group_ga81b8137665b8a4d2cb38ca50017d4c74}{eina\+\_\+init()} first, and \doxylink{group__Eina__Main__Group_ga5bf35513199d5220341437c05696285d}{eina\+\_\+shutdown()} when eina is not used anymore.\hypertarget{group__Eina__Convert__Group_Eina_Convert_From_Integer_To_String}{}\doxysubsubsubsection{\texorpdfstring{Conversion from integer to string}{Conversion from integer to string}}\label{group__Eina__Convert__Group_Eina_Convert_From_Integer_To_String}
To convert an integer to a string in the decimal base, \doxylink{group__Eina__Convert__Group_ga3e89edac8e4955fb645e4690ba05f0a4}{eina\+\_\+convert\+\_\+itoa()} should be used. If the hexadecimal base is wanted, \doxylink{group__Eina__Convert__Group_gab010ab5bc75b33ebeb488ce3b9056a5d}{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}{0}
\DoxyCodeLine{\textcolor{preprocessor}{\#include\ <stdlib.h>}}
\DoxyCodeLine{\textcolor{preprocessor}{\#include\ <stdio.h>}}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{preprocessor}{\#include\ <\mbox{\hyperlink{Eina_8h}{Eina.h}}>}}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{keywordtype}{int}\ main(\textcolor{keywordtype}{void})}
\DoxyCodeLine{\{}
\DoxyCodeLine{\ \ \ \textcolor{keywordtype}{char}\ tmp[128];}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ \textcolor{keywordflow}{if}\ (!\mbox{\hyperlink{group__Eina__Main__Group_ga81b8137665b8a4d2cb38ca50017d4c74}{eina\_init}}())}
\DoxyCodeLine{\ \ \ \{}
\DoxyCodeLine{\ \ \ \ \ \ \ printf\ (\textcolor{stringliteral}{"{}Error\ during\ the\ initialization\ of\ eina.\(\backslash\)n"{}});}
\DoxyCodeLine{\ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ EXIT\_FAILURE;}
\DoxyCodeLine{\ \ \ \}}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Eina__Convert__Group_ga3e89edac8e4955fb645e4690ba05f0a4}{eina\_convert\_itoa}}(45,\ tmp);}
\DoxyCodeLine{\ \ \ printf(\textcolor{stringliteral}{"{}value:\ \%s\(\backslash\)n"{}},\ tmp);}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Eina__Convert__Group_gab010ab5bc75b33ebeb488ce3b9056a5d}{eina\_convert\_xtoa}}(0xA1,\ tmp);}
\DoxyCodeLine{\ \ \ printf(\textcolor{stringliteral}{"{}value:\ \%s\(\backslash\)n"{}},\ tmp);}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Eina__Main__Group_ga5bf35513199d5220341437c05696285d}{eina\_shutdown}}();}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ \textcolor{keywordflow}{return}\ EXIT\_SUCCESS;}
\DoxyCodeLine{\}}

\end{DoxyCode}


Compile this code with the following command\+:


\begin{DoxyCode}{0}
\DoxyCodeLine{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}{}\doxysubsubsubsection{\texorpdfstring{Conversion double / string}{Conversion double / string}}\label{group__Eina__Convert__Group_Eina_Convert_Double}
To convert a double to a string, \doxylink{group__Eina__Convert__Group_ga55a2b35ee9143ec75a49d26a635ac137}{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}{0}
\DoxyCodeLine{[-\/]0xh.hhhhhp[+-\/]e}

\end{DoxyCode}


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


\begin{DoxyCode}{0}
\DoxyCodeLine{mantissa\ \ :\ [-\/]hhhhhh}
\DoxyCodeLine{exponent\ :\ 2\string^([+-\/]e\ -\/\ 4\ *\ n)}

\end{DoxyCode}


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

Here is an example of use\+:


\begin{DoxyCode}{0}
\DoxyCodeLine{\textcolor{preprocessor}{\#include\ <stdlib.h>}}
\DoxyCodeLine{\textcolor{preprocessor}{\#include\ <stdio.h>}}
\DoxyCodeLine{\textcolor{preprocessor}{\#include\ <math.h>}}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{preprocessor}{\#include\ <\mbox{\hyperlink{Eina_8h}{Eina.h}}>}}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{keywordtype}{int}\ main(\textcolor{keywordtype}{void})}
\DoxyCodeLine{\{}
\DoxyCodeLine{\ \ \ \textcolor{keywordtype}{char}\ \ \ \ \ \ tmp[128];}
\DoxyCodeLine{\ \ \ \textcolor{keywordtype}{long}\ \textcolor{keywordtype}{long}\ \textcolor{keywordtype}{int}\ m\ =\ 0;}
\DoxyCodeLine{\ \ \ \textcolor{keywordtype}{long}\ \textcolor{keywordtype}{int}\ \ e\ =\ 0;}
\DoxyCodeLine{\ \ \ \textcolor{keywordtype}{double}\ \ \ \ r;}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ \textcolor{keywordflow}{if}\ (!\mbox{\hyperlink{group__Eina__Main__Group_ga81b8137665b8a4d2cb38ca50017d4c74}{eina\_init}}())}
\DoxyCodeLine{\ \ \ \{}
\DoxyCodeLine{\ \ \ \ \ \ \ printf\ (\textcolor{stringliteral}{"{}Error\ during\ the\ initialization\ of\ eina.\(\backslash\)n"{}});}
\DoxyCodeLine{\ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ EXIT\_FAILURE;}
\DoxyCodeLine{\ \ \ \}}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ printf(\textcolor{stringliteral}{"{}initial\ value\ :\ 40.56\(\backslash\)n"{}});}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Eina__Convert__Group_ga55a2b35ee9143ec75a49d26a635ac137}{eina\_convert\_dtoa}}(40.56,\ tmp);}
\DoxyCodeLine{\ \ \ printf(\textcolor{stringliteral}{"{}result\ dtoa\ \ \ :\ \%s\(\backslash\)n"{}},\ tmp);}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Eina__Convert__Group_gaab0e72ea3f1dd41c559e84dd6c6a7eea}{eina\_convert\_atod}}(tmp,\ 128,\ \&m,\ \&e);}
\DoxyCodeLine{\ \ \ r\ =\ ldexp((\textcolor{keywordtype}{double})m,\ e);}
\DoxyCodeLine{\ \ \ printf(\textcolor{stringliteral}{"{}result\ atod\ \ \ :\ \%f\(\backslash\)n"{}},\ r);}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Eina__Main__Group_ga5bf35513199d5220341437c05696285d}{eina\_shutdown}}();}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ \textcolor{keywordflow}{return}\ EXIT\_SUCCESS;}
\DoxyCodeLine{\}}

\end{DoxyCode}


Compile this code with the following command\+:


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

\end{DoxyCode}
 

\doxysubsubsubsection{Function Documentation}
\Hypertarget{group__Eina__Convert__Group_ga3e89edac8e4955fb645e4690ba05f0a4}\label{group__Eina__Convert__Group_ga3e89edac8e4955fb645e4690ba05f0a4} 
\index{Convert@{Convert}!eina\_convert\_itoa@{eina\_convert\_itoa}}
\index{eina\_convert\_itoa@{eina\_convert\_itoa}!Convert@{Convert}}
\doxysubsubsubsubsection{\texorpdfstring{eina\_convert\_itoa()}{eina\_convert\_itoa()}}
{\footnotesize\ttfamily \mbox{\hyperlink{group__Eina__Types__Group_ga6ac08753ba12bc9c7a0390cf67868f4f}{EINA\+\_\+\+API}} int eina\+\_\+convert\+\_\+itoa (\begin{DoxyParamCaption}\item[{int}]{n,  }\item[{char \texorpdfstring{$\ast$}{*}}]{s }\end{DoxyParamCaption})}



Converts an integer number to a string in decimal base. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em n} & The integer to convert. \\
\hline
\mbox{\texttt{ out}}  & {\em s} & The buffer to store the converted integer. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
The length of the string, including the null terminated character.
\end{DoxyReturn}
This function converts {\ttfamily n} to a null 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 null terminated character. 

References \mbox{\hyperlink{group__Eina__Safety__Checks__Group_gab2b07061fc6500dedd9cd41c8d16f95d}{EINA\+\_\+\+SAFETY\+\_\+\+ON\+\_\+\+NULL\+\_\+\+RETURN\+\_\+\+VAL}}.



Referenced by \mbox{\hyperlink{group__Eet__Node__Group_gaee8ca9757bf5fc55dadc90fa6590af6e}{eet\+\_\+node\+\_\+dump()}}, \mbox{\hyperlink{group__Eina__Convert__Group_ga55a2b35ee9143ec75a49d26a635ac137}{eina\+\_\+convert\+\_\+dtoa()}}, \mbox{\hyperlink{group__Eina__Convert__Group_gacd163754c9a7b1fff76b5189b7daf09d}{eina\+\_\+convert\+\_\+fptoa()}}, and \mbox{\hyperlink{group__Eina__Xattr__Group_ga633b77b639fbd8a2f61f12afc40ab30d}{eina\+\_\+xattr\+\_\+int\+\_\+set()}}.

\Hypertarget{group__Eina__Convert__Group_gab010ab5bc75b33ebeb488ce3b9056a5d}\label{group__Eina__Convert__Group_gab010ab5bc75b33ebeb488ce3b9056a5d} 
\index{Convert@{Convert}!eina\_convert\_xtoa@{eina\_convert\_xtoa}}
\index{eina\_convert\_xtoa@{eina\_convert\_xtoa}!Convert@{Convert}}
\doxysubsubsubsubsection{\texorpdfstring{eina\_convert\_xtoa()}{eina\_convert\_xtoa()}}
{\footnotesize\ttfamily \mbox{\hyperlink{group__Eina__Types__Group_ga6ac08753ba12bc9c7a0390cf67868f4f}{EINA\+\_\+\+API}} int eina\+\_\+convert\+\_\+xtoa (\begin{DoxyParamCaption}\item[{unsigned int}]{n,  }\item[{char \texorpdfstring{$\ast$}{*}}]{s }\end{DoxyParamCaption})}



Converts an integer number to a string in hexadecimal base. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em n} & The integer to convert. \\
\hline
\mbox{\texttt{ out}}  & {\em s} & The buffer to store the converted integer. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
The length of the string, including the null terminated character.
\end{DoxyReturn}
This function converts {\ttfamily n} to a null 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. 

References \mbox{\hyperlink{group__Eina__Safety__Checks__Group_gab2b07061fc6500dedd9cd41c8d16f95d}{EINA\+\_\+\+SAFETY\+\_\+\+ON\+\_\+\+NULL\+\_\+\+RETURN\+\_\+\+VAL}}.

\Hypertarget{group__Eina__Convert__Group_ga55a2b35ee9143ec75a49d26a635ac137}\label{group__Eina__Convert__Group_ga55a2b35ee9143ec75a49d26a635ac137} 
\index{Convert@{Convert}!eina\_convert\_dtoa@{eina\_convert\_dtoa}}
\index{eina\_convert\_dtoa@{eina\_convert\_dtoa}!Convert@{Convert}}
\doxysubsubsubsubsection{\texorpdfstring{eina\_convert\_dtoa()}{eina\_convert\_dtoa()}}
{\footnotesize\ttfamily \mbox{\hyperlink{group__Eina__Types__Group_ga6ac08753ba12bc9c7a0390cf67868f4f}{EINA\+\_\+\+API}} int eina\+\_\+convert\+\_\+dtoa (\begin{DoxyParamCaption}\item[{double}]{d,  }\item[{char \texorpdfstring{$\ast$}{*}}]{des }\end{DoxyParamCaption})}



Converts a double to a string. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em d} & The double to convert. \\
\hline
\mbox{\texttt{ out}}  & {\em des} & The destination buffer to store the converted double. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
\doxylink{group__Eina__Types__Group_ga05c12dacc8b4058994df842b41be85fc}{EINA\+\_\+\+TRUE} on success, \doxylink{group__Eina__Types__Group_ga1feb115f8e9913e806e090d9bd5a7301}{EINA\+\_\+\+FALSE} 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 null terminated and has the following format\+:


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

\end{DoxyCode}


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

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

References \mbox{\hyperlink{group__Eina__Convert__Group_ga3e89edac8e4955fb645e4690ba05f0a4}{eina\+\_\+convert\+\_\+itoa()}}, \mbox{\hyperlink{group__Eina__Safety__Checks__Group_gae7cf7b1d66fa9022242e09fd53c06bb2}{EINA\+\_\+\+SAFETY\+\_\+\+ON\+\_\+\+FALSE\+\_\+\+RETURN\+\_\+\+VAL}}, and \mbox{\hyperlink{group__Eina__Safety__Checks__Group_gab2b07061fc6500dedd9cd41c8d16f95d}{EINA\+\_\+\+SAFETY\+\_\+\+ON\+\_\+\+NULL\+\_\+\+RETURN\+\_\+\+VAL}}.



Referenced by \mbox{\hyperlink{group__Eina__Xattr__Group_gad2153afd2c0a93648fc87cd958110869}{eina\+\_\+xattr\+\_\+double\+\_\+set()}}.

\Hypertarget{group__Eina__Convert__Group_gaab0e72ea3f1dd41c559e84dd6c6a7eea}\label{group__Eina__Convert__Group_gaab0e72ea3f1dd41c559e84dd6c6a7eea} 
\index{Convert@{Convert}!eina\_convert\_atod@{eina\_convert\_atod}}
\index{eina\_convert\_atod@{eina\_convert\_atod}!Convert@{Convert}}
\doxysubsubsubsubsection{\texorpdfstring{eina\_convert\_atod()}{eina\_convert\_atod()}}
{\footnotesize\ttfamily \mbox{\hyperlink{group__Eina__Types__Group_ga6ac08753ba12bc9c7a0390cf67868f4f}{EINA\+\_\+\+API}} \mbox{\hyperlink{group__Eina__Types__Group_ga3fe0caf72e93b1bab1ca8ee3ccf3f226}{Eina\+\_\+\+Bool}} eina\+\_\+convert\+\_\+atod (\begin{DoxyParamCaption}\item[{const char \texorpdfstring{$\ast$}{*}}]{src,  }\item[{int}]{length,  }\item[{long long \texorpdfstring{$\ast$}{*}}]{m,  }\item[{long \texorpdfstring{$\ast$}{*}}]{e }\end{DoxyParamCaption})}



Converts a string to a double. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em src} & The string to convert. \\
\hline
\mbox{\texttt{ in}}  & {\em length} & The length of the string. \\
\hline
\mbox{\texttt{ out}}  & {\em m} & The mantissa. \\
\hline
\mbox{\texttt{ out}}  & {\em e} & The exponent. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
\doxylink{group__Eina__Types__Group_ga05c12dacc8b4058994df842b41be85fc}{EINA\+\_\+\+TRUE} on success, \doxylink{group__Eina__Types__Group_ga1feb115f8e9913e806e090d9bd5a7301}{EINA\+\_\+\+FALSE} 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\+BSD).

The string must have the following format\+:


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

\end{DoxyCode}


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


\begin{DoxyCode}{0}
\DoxyCodeLine{mantissa\ \ :\ [-\/]hhhhhh}
\DoxyCodeLine{exponent\ :\ 2\string^([+-\/]e\ -\/\ 4\ *\ n)}

\end{DoxyCode}


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

If the string is invalid \doxylink{group__Eina__Types__Group_ga1feb115f8e9913e806e090d9bd5a7301}{EINA\+\_\+\+FALSE} is returned, otherwise \doxylink{group__Eina__Types__Group_ga05c12dacc8b4058994df842b41be85fc}{EINA\+\_\+\+TRUE} is returned. 

References \mbox{\hyperlink{group__Eina__Types__Group_ga1feb115f8e9913e806e090d9bd5a7301}{EINA\+\_\+\+FALSE}}, \mbox{\hyperlink{group__Eina__Safety__Checks__Group_gab2b07061fc6500dedd9cd41c8d16f95d}{EINA\+\_\+\+SAFETY\+\_\+\+ON\+\_\+\+NULL\+\_\+\+RETURN\+\_\+\+VAL}}, and \mbox{\hyperlink{group__Eina__Types__Group_ga05c12dacc8b4058994df842b41be85fc}{EINA\+\_\+\+TRUE}}.



Referenced by \mbox{\hyperlink{group__Eina__Convert__Group_ga1d5668d605211f997f621461e6ee3be2}{eina\+\_\+convert\+\_\+atofp()}}, and \mbox{\hyperlink{group__Eina__Xattr__Group_gada5c22930dcb1d4399c743732e997ed3}{eina\+\_\+xattr\+\_\+double\+\_\+get()}}.

\Hypertarget{group__Eina__Convert__Group_gacd163754c9a7b1fff76b5189b7daf09d}\label{group__Eina__Convert__Group_gacd163754c9a7b1fff76b5189b7daf09d} 
\index{Convert@{Convert}!eina\_convert\_fptoa@{eina\_convert\_fptoa}}
\index{eina\_convert\_fptoa@{eina\_convert\_fptoa}!Convert@{Convert}}
\doxysubsubsubsubsection{\texorpdfstring{eina\_convert\_fptoa()}{eina\_convert\_fptoa()}}
{\footnotesize\ttfamily \mbox{\hyperlink{group__Eina__Types__Group_ga6ac08753ba12bc9c7a0390cf67868f4f}{EINA\+\_\+\+API}} int eina\+\_\+convert\+\_\+fptoa (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{group__Eina__Fp__Group_ga5264584bb5c6d81dd71d36f9e4e517f1}{Eina\+\_\+\+F32p32}}}]{fp,  }\item[{char \texorpdfstring{$\ast$}{*}}]{des }\end{DoxyParamCaption})}



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


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em fp} & The fixed point number to convert. \\
\hline
\mbox{\texttt{ out}}  & {\em des} & The destination buffer to store the converted fixed point number. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
\doxylink{group__Eina__Types__Group_ga05c12dacc8b4058994df842b41be85fc}{EINA\+\_\+\+TRUE} on success, \doxylink{group__Eina__Types__Group_ga1feb115f8e9913e806e090d9bd5a7301}{EINA\+\_\+\+FALSE} 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}{0}
\DoxyCodeLine{[-\/]0xh.hhhhhp[+-\/]e}

\end{DoxyCode}


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

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

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


References \mbox{\hyperlink{group__Eina__Convert__Group_ga3e89edac8e4955fb645e4690ba05f0a4}{eina\+\_\+convert\+\_\+itoa()}}, \mbox{\hyperlink{group__Eina__Types__Group_ga1feb115f8e9913e806e090d9bd5a7301}{EINA\+\_\+\+FALSE}}, and \mbox{\hyperlink{group__Eina__Safety__Checks__Group_gab2b07061fc6500dedd9cd41c8d16f95d}{EINA\+\_\+\+SAFETY\+\_\+\+ON\+\_\+\+NULL\+\_\+\+RETURN\+\_\+\+VAL}}.

\Hypertarget{group__Eina__Convert__Group_ga1d5668d605211f997f621461e6ee3be2}\label{group__Eina__Convert__Group_ga1d5668d605211f997f621461e6ee3be2} 
\index{Convert@{Convert}!eina\_convert\_atofp@{eina\_convert\_atofp}}
\index{eina\_convert\_atofp@{eina\_convert\_atofp}!Convert@{Convert}}
\doxysubsubsubsubsection{\texorpdfstring{eina\_convert\_atofp()}{eina\_convert\_atofp()}}
{\footnotesize\ttfamily \mbox{\hyperlink{group__Eina__Types__Group_ga6ac08753ba12bc9c7a0390cf67868f4f}{EINA\+\_\+\+API}} \mbox{\hyperlink{group__Eina__Types__Group_ga3fe0caf72e93b1bab1ca8ee3ccf3f226}{Eina\+\_\+\+Bool}} eina\+\_\+convert\+\_\+atofp (\begin{DoxyParamCaption}\item[{const char \texorpdfstring{$\ast$}{*}}]{src,  }\item[{int}]{length,  }\item[{\mbox{\hyperlink{group__Eina__Fp__Group_ga5264584bb5c6d81dd71d36f9e4e517f1}{Eina\+\_\+\+F32p32}} \texorpdfstring{$\ast$}{*}}]{fp }\end{DoxyParamCaption})}



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


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em src} & The string to convert. \\
\hline
\mbox{\texttt{ in}}  & {\em length} & The length of the string. \\
\hline
\mbox{\texttt{ out}}  & {\em fp} & The fixed point number. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
\doxylink{group__Eina__Types__Group_ga05c12dacc8b4058994df842b41be85fc}{EINA\+\_\+\+TRUE} on success, \doxylink{group__Eina__Types__Group_ga1feb115f8e9913e806e090d9bd5a7301}{EINA\+\_\+\+FALSE} 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 \doxylink{group__Eina__Convert__Group_gaab0e72ea3f1dd41c559e84dd6c6a7eea}{eina\+\_\+convert\+\_\+atod()}.

The string must have the following format\+:


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

\end{DoxyCode}


where the h\textquotesingle{}s are the hexadecimal cyphers of the mantissas and e the exponent (a decimal number). If n is the number of cyphers after the point, the returned mantissas and exponents are\+:


\begin{DoxyCode}{0}
\DoxyCodeLine{mantissa\ \ :\ [-\/]hhhhhh}
\DoxyCodeLine{exponent\ :\ 2\string^([+-\/]e\ -\/\ 4\ *\ n)}

\end{DoxyCode}


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

If the string is invalid, \doxylink{group__Eina__Types__Group_ga1feb115f8e9913e806e090d9bd5a7301}{EINA\+\_\+\+FALSE} is returned, otherwise {\ttfamily fp} is computed and \doxylink{group__Eina__Types__Group_ga05c12dacc8b4058994df842b41be85fc}{EINA\+\_\+\+TRUE} is returned.

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


References \mbox{\hyperlink{group__Eina__Convert__Group_gaab0e72ea3f1dd41c559e84dd6c6a7eea}{eina\+\_\+convert\+\_\+atod()}}, \mbox{\hyperlink{group__Eina__Types__Group_ga1feb115f8e9913e806e090d9bd5a7301}{EINA\+\_\+\+FALSE}}, and \mbox{\hyperlink{group__Eina__Types__Group_ga05c12dacc8b4058994df842b41be85fc}{EINA\+\_\+\+TRUE}}.

\Hypertarget{group__Eina__Convert__Group_ga14620d75594abe8365b54c4ff6e8ea58}\label{group__Eina__Convert__Group_ga14620d75594abe8365b54c4ff6e8ea58} 
\index{Convert@{Convert}!eina\_convert\_strtod\_c@{eina\_convert\_strtod\_c}}
\index{eina\_convert\_strtod\_c@{eina\_convert\_strtod\_c}!Convert@{Convert}}
\doxysubsubsubsubsection{\texorpdfstring{eina\_convert\_strtod\_c()}{eina\_convert\_strtod\_c()}}
{\footnotesize\ttfamily \mbox{\hyperlink{group__Eina__Types__Group_ga6ac08753ba12bc9c7a0390cf67868f4f}{EINA\+\_\+\+API}} double eina\+\_\+convert\+\_\+strtod\+\_\+c (\begin{DoxyParamCaption}\item[{const char \texorpdfstring{$\ast$}{*}}]{nptr,  }\item[{char \texorpdfstring{$\ast$}{*}\texorpdfstring{$\ast$}{*}}]{endptr }\end{DoxyParamCaption})}



Converts a string to a floating point number. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em nptr} & a string to convert. It shouldn\textquotesingle{}t be NULL. \\
\hline
\mbox{\texttt{ out}}  & {\em endptr} & If {\ttfamily endptr} is not NULL, a pointer to the character after the last character used in the conversion is stored in the location referenced by endptr. If {\ttfamily nptr} is NULL, this will also be set to NULL. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
a double type floating point number.
\end{DoxyReturn}
This function returns converted floating point number with locale-\/independency. Actually, it use "{}\+C"{} locale for strtod\+\_\+l function internally. If you need strtod without locale-\/dependency, this function can replace strtod. For more information, please refer documents of strtod, strtod\+\_\+l. 

References \mbox{\hyperlink{group__Eina__Safety__Checks__Group_gab2b07061fc6500dedd9cd41c8d16f95d}{EINA\+\_\+\+SAFETY\+\_\+\+ON\+\_\+\+NULL\+\_\+\+RETURN\+\_\+\+VAL}}.

