\hypertarget{eet-data-file_descriptor_01_8c-example}{}\doxysection{eet-\/data-\/file\+\_\+descriptor\+\_\+01.\+c}

\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{\textcolor{comment}{//Compile\ with:}}
\DoxyCodeLine{\textcolor{comment}{//\ gcc\ -\/o\ eet-\/data-\/file\_descriptor\_01\ eet-\/data-\/file\_descriptor\_01.c\ `pkg-\/config\ -\/-\/cflags\ -\/-\/libs\ eet\ eina`}}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{preprocessor}{\#include\ <\mbox{\hyperlink{Eina_8h}{Eina.h}}>}}
\DoxyCodeLine{\textcolor{preprocessor}{\#include\ <\mbox{\hyperlink{Eet_8h}{Eet.h}}>}}
\DoxyCodeLine{\textcolor{preprocessor}{\#include\ <stdio.h>}}
\DoxyCodeLine{\textcolor{preprocessor}{\#include\ <limits.h>}}
\DoxyCodeLine{\textcolor{preprocessor}{\#include\ <sys/types.h>}}
\DoxyCodeLine{\textcolor{preprocessor}{\#include\ <sys/stat.h>}}
\DoxyCodeLine{\textcolor{preprocessor}{\#include\ <unistd.h>}}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{comment}{//\ complex\ real-\/world\ structures\ based\ on\ elmdentica\ database}}
\DoxyCodeLine{\textcolor{keyword}{typedef}\ \textcolor{keyword}{struct}}
\DoxyCodeLine{\{}
\DoxyCodeLine{\ \ \ \textcolor{keyword}{const}\ \textcolor{keywordtype}{char}\ \ *screen\_name;}
\DoxyCodeLine{\ \ \ \textcolor{keyword}{const}\ \textcolor{keywordtype}{char}\ \ *name;}
\DoxyCodeLine{\ \ \ \textcolor{keyword}{const}\ \textcolor{keywordtype}{char}\ \ *message;}
\DoxyCodeLine{\ \ \ \textcolor{keywordtype}{unsigned}\ \textcolor{keywordtype}{int}\ id;}
\DoxyCodeLine{\ \ \ \textcolor{keywordtype}{unsigned}\ \textcolor{keywordtype}{int}\ status\_id;}
\DoxyCodeLine{\ \ \ \textcolor{keywordtype}{unsigned}\ \textcolor{keywordtype}{int}\ date;}
\DoxyCodeLine{\ \ \ \textcolor{keywordtype}{unsigned}\ \textcolor{keywordtype}{int}\ timeline;}
\DoxyCodeLine{\}\ My\_Message;}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{keyword}{typedef}\ \textcolor{keyword}{struct}}
\DoxyCodeLine{\{}
\DoxyCodeLine{\ \ \ \textcolor{keyword}{const}\ \textcolor{keywordtype}{char}\ *dm\_to;}
\DoxyCodeLine{\ \ \ \textcolor{keyword}{const}\ \textcolor{keywordtype}{char}\ *message;}
\DoxyCodeLine{\}\ My\_Post;}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{keyword}{typedef}\ \textcolor{keyword}{struct}}
\DoxyCodeLine{\{}
\DoxyCodeLine{\ \ \ \textcolor{keywordtype}{unsigned}\ \textcolor{keywordtype}{int}\ id;}
\DoxyCodeLine{\ \ \ \textcolor{keyword}{const}\ \textcolor{keywordtype}{char}\ \ *name;}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{struct__Eina__List}{Eina\_List}}\ \ \ *messages;}
\DoxyCodeLine{\ \ \ My\_Post\ \ \ \ \ *posts;}
\DoxyCodeLine{\ \ \ \textcolor{keywordtype}{int}\ \ \ \ \ \ \ \ \ \ posts\_count;}
\DoxyCodeLine{\}\ My\_Account;}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{keyword}{typedef}\ \textcolor{keyword}{struct}}
\DoxyCodeLine{\{}
\DoxyCodeLine{\ \ \ \textcolor{keywordtype}{unsigned}\ \textcolor{keywordtype}{int}\ version;\ \textcolor{comment}{//\ it\ is\ recommended\ to\ use\ versioned\ configuration!}}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Eina__Hash__Group_ga9a89d7d3ee260d3a60572ebf651b07e0}{Eina\_Hash}}\ \ \ *accounts;}
\DoxyCodeLine{\}\ My\_Cache;}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{comment}{//\ string\ that\ represents\ the\ entry\ in\ eet\ file,\ you\ might\ like\ to\ have}}
\DoxyCodeLine{\textcolor{comment}{//\ different\ profiles\ or\ so\ in\ the\ same\ file,\ this\ is\ possible\ with}}
\DoxyCodeLine{\textcolor{comment}{//\ different\ strings}}
\DoxyCodeLine{\textcolor{keyword}{static}\ \textcolor{keyword}{const}\ \textcolor{keywordtype}{char}\ MY\_CACHE\_FILE\_ENTRY[]\ =\ \textcolor{stringliteral}{"{}cache"{}};}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{comment}{//\ keep\ the\ descriptor\ static\ global,\ so\ it\ can\ be}}
\DoxyCodeLine{\textcolor{comment}{//\ shared\ by\ different\ functions\ (load/save)\ of\ this\ and\ only\ this}}
\DoxyCodeLine{\textcolor{comment}{//\ file.}}
\DoxyCodeLine{\textcolor{keyword}{static}\ \mbox{\hyperlink{group__Eet__Data__Group_ga4baec0e840012480a0958c5c3bca276d}{Eet\_Data\_Descriptor}}\ *\_my\_cache\_descriptor;}
\DoxyCodeLine{\textcolor{keyword}{static}\ \mbox{\hyperlink{group__Eet__Data__Group_ga4baec0e840012480a0958c5c3bca276d}{Eet\_Data\_Descriptor}}\ *\_my\_account\_descriptor;}
\DoxyCodeLine{\textcolor{keyword}{static}\ \mbox{\hyperlink{group__Eet__Data__Group_ga4baec0e840012480a0958c5c3bca276d}{Eet\_Data\_Descriptor}}\ *\_my\_message\_descriptor;}
\DoxyCodeLine{\textcolor{keyword}{static}\ \mbox{\hyperlink{group__Eet__Data__Group_ga4baec0e840012480a0958c5c3bca276d}{Eet\_Data\_Descriptor}}\ *\_my\_post\_descriptor;}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{comment}{//\ keep\ file\ handle\ alive,\ so\ mmap()ed\ strings\ are\ all\ alive\ as\ well}}
\DoxyCodeLine{\textcolor{keyword}{static}\ \mbox{\hyperlink{group__Eet__File__Group_ga8d9779184a9870c1a225f1f40c76e8a7}{Eet\_File}}\ *\_my\_cache\_file\ =\ NULL;}
\DoxyCodeLine{\textcolor{keyword}{static}\ \mbox{\hyperlink{group__Eet__File__Group_gaf0984c8280699ca5a3c4966f5580324c}{Eet\_Dictionary}}\ *\_my\_cache\_dict\ =\ NULL;}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{keyword}{static}\ \textcolor{keywordtype}{void}}
\DoxyCodeLine{\_my\_cache\_descriptor\_init(\textcolor{keywordtype}{void})}
\DoxyCodeLine{\{}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{struct__Eet__Data__Descriptor__Class}{Eet\_Data\_Descriptor\_Class}}\ eddc;}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ \textcolor{comment}{//\ The\ FILE\ variant\ is\ good\ for\ caches\ and\ things\ that\ are\ just}}
\DoxyCodeLine{\ \ \ \textcolor{comment}{//\ appended,\ but\ needs\ to\ take\ care\ when\ changing\ strings\ and\ files\ must}}
\DoxyCodeLine{\ \ \ \textcolor{comment}{//\ be\ kept\ open\ so\ mmap()ed\ strings\ will\ be\ kept\ alive.}}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Eet__Data__Group_ga0bf94c07d8e69cfaac8dd2d615d7542c}{EET\_EINA\_FILE\_DATA\_DESCRIPTOR\_CLASS\_SET}}(\&eddc,\ My\_Cache);}
\DoxyCodeLine{\ \ \ \_my\_cache\_descriptor\ =\ \mbox{\hyperlink{group__Eet__Data__Group_gaa613c638dfb72d3f9bd2bd1d4c1bf844}{eet\_data\_descriptor\_file\_new}}(\&eddc);}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Eet__Data__Group_ga0bf94c07d8e69cfaac8dd2d615d7542c}{EET\_EINA\_FILE\_DATA\_DESCRIPTOR\_CLASS\_SET}}(\&eddc,\ My\_Account);}
\DoxyCodeLine{\ \ \ \_my\_account\_descriptor\ =\ \mbox{\hyperlink{group__Eet__Data__Group_gaa613c638dfb72d3f9bd2bd1d4c1bf844}{eet\_data\_descriptor\_file\_new}}(\&eddc);}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Eet__Data__Group_ga0bf94c07d8e69cfaac8dd2d615d7542c}{EET\_EINA\_FILE\_DATA\_DESCRIPTOR\_CLASS\_SET}}(\&eddc,\ My\_Message);}
\DoxyCodeLine{\ \ \ \_my\_message\_descriptor\ =\ \mbox{\hyperlink{group__Eet__Data__Group_gaa613c638dfb72d3f9bd2bd1d4c1bf844}{eet\_data\_descriptor\_file\_new}}(\&eddc);}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Eet__Data__Group_ga0bf94c07d8e69cfaac8dd2d615d7542c}{EET\_EINA\_FILE\_DATA\_DESCRIPTOR\_CLASS\_SET}}(\&eddc,\ My\_Post);}
\DoxyCodeLine{\ \ \ \_my\_post\_descriptor\ =\ \mbox{\hyperlink{group__Eet__Data__Group_gaa613c638dfb72d3f9bd2bd1d4c1bf844}{eet\_data\_descriptor\_file\_new}}(\&eddc);}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ \textcolor{comment}{//\ Describe\ the\ members\ to\ be\ saved:}}
\DoxyCodeLine{\ \ \ \textcolor{comment}{//\ Use\ a\ temporary\ macro\ so\ we\ don't\ type\ a\ lot,\ also\ avoid\ errors:}}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{preprocessor}{\#define\ ADD\_BASIC(member,\ eet\_type)\ \(\backslash\)}}
\DoxyCodeLine{\textcolor{preprocessor}{\ \ EET\_DATA\_DESCRIPTOR\_ADD\_BASIC\ \ \ \ \ \(\backslash\)}}
\DoxyCodeLine{\textcolor{preprocessor}{\ \ \ \ (\_my\_message\_descriptor,\ My\_Message,\ \#\ member,\ member,\ eet\_type)}}
\DoxyCodeLine{\ \ \ ADD\_BASIC(screen\_name,\ \mbox{\hyperlink{group__Eet__Data__Group_ga0d2cf409bf3f151156d74d18ac59e3d1}{EET\_T\_STRING}});}
\DoxyCodeLine{\ \ \ ADD\_BASIC(name,\ \mbox{\hyperlink{group__Eet__Data__Group_ga0d2cf409bf3f151156d74d18ac59e3d1}{EET\_T\_STRING}});}
\DoxyCodeLine{\ \ \ ADD\_BASIC(message,\ \mbox{\hyperlink{group__Eet__Data__Group_ga0d2cf409bf3f151156d74d18ac59e3d1}{EET\_T\_STRING}});}
\DoxyCodeLine{\ \ \ ADD\_BASIC(\textcolor{keywordtype}{id},\ \mbox{\hyperlink{group__Eet__Data__Group_gacf6a3c9f06e10e20be5b02cd8c6a220b}{EET\_T\_UINT}});}
\DoxyCodeLine{\ \ \ ADD\_BASIC(status\_id,\ \mbox{\hyperlink{group__Eet__Data__Group_gacf6a3c9f06e10e20be5b02cd8c6a220b}{EET\_T\_UINT}});}
\DoxyCodeLine{\ \ \ ADD\_BASIC(date,\ \mbox{\hyperlink{group__Eet__Data__Group_gacf6a3c9f06e10e20be5b02cd8c6a220b}{EET\_T\_UINT}});}
\DoxyCodeLine{\ \ \ ADD\_BASIC(timeline,\ \mbox{\hyperlink{group__Eet__Data__Group_gacf6a3c9f06e10e20be5b02cd8c6a220b}{EET\_T\_UINT}});}
\DoxyCodeLine{\textcolor{preprocessor}{\#undef\ ADD\_BASIC}}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{preprocessor}{\#define\ ADD\_BASIC(member,\ eet\_type)\ \(\backslash\)}}
\DoxyCodeLine{\textcolor{preprocessor}{\ \ EET\_DATA\_DESCRIPTOR\_ADD\_BASIC\ \ \ \ \ \(\backslash\)}}
\DoxyCodeLine{\textcolor{preprocessor}{\ \ \ \ (\_my\_post\_descriptor,\ My\_Post,\ \#\ member,\ member,\ eet\_type)}}
\DoxyCodeLine{\ \ \ ADD\_BASIC(dm\_to,\ \mbox{\hyperlink{group__Eet__Data__Group_ga0d2cf409bf3f151156d74d18ac59e3d1}{EET\_T\_STRING}});}
\DoxyCodeLine{\ \ \ ADD\_BASIC(message,\ \mbox{\hyperlink{group__Eet__Data__Group_ga0d2cf409bf3f151156d74d18ac59e3d1}{EET\_T\_STRING}});}
\DoxyCodeLine{\textcolor{preprocessor}{\#undef\ ADD\_BASIC}}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{preprocessor}{\#define\ ADD\_BASIC(member,\ eet\_type)\ \(\backslash\)}}
\DoxyCodeLine{\textcolor{preprocessor}{\ \ EET\_DATA\_DESCRIPTOR\_ADD\_BASIC\ \ \ \ \ \(\backslash\)}}
\DoxyCodeLine{\textcolor{preprocessor}{\ \ \ \ (\_my\_account\_descriptor,\ My\_Account,\ \#\ member,\ member,\ eet\_type)}}
\DoxyCodeLine{\ \ \ ADD\_BASIC(name,\ \mbox{\hyperlink{group__Eet__Data__Group_ga0d2cf409bf3f151156d74d18ac59e3d1}{EET\_T\_STRING}});}
\DoxyCodeLine{\ \ \ ADD\_BASIC(\textcolor{keywordtype}{id},\ \mbox{\hyperlink{group__Eet__Data__Group_gacf6a3c9f06e10e20be5b02cd8c6a220b}{EET\_T\_UINT}});}
\DoxyCodeLine{\textcolor{preprocessor}{\#undef\ ADD\_BASIC}}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Eet__Data__Group_gabb4c7833ba053f2322e6b667a9ec7f04}{EET\_DATA\_DESCRIPTOR\_ADD\_LIST}}}
\DoxyCodeLine{\ \ \ \ \ (\_my\_account\_descriptor,\ My\_Account,\ \textcolor{stringliteral}{"{}messages"{}},\ messages,}
\DoxyCodeLine{\ \ \ \ \ \_my\_message\_descriptor);}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Eet__Data__Group_ga7adad32d2eba76566533353632f00ae4}{EET\_DATA\_DESCRIPTOR\_ADD\_VAR\_ARRAY}}}
\DoxyCodeLine{\ \ \ \ \ (\_my\_account\_descriptor,\ My\_Account,\ \textcolor{stringliteral}{"{}posts"{}},\ posts,}
\DoxyCodeLine{\ \ \ \ \ \_my\_post\_descriptor);}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{preprocessor}{\#define\ ADD\_BASIC(member,\ eet\_type)\ \(\backslash\)}}
\DoxyCodeLine{\textcolor{preprocessor}{\ \ EET\_DATA\_DESCRIPTOR\_ADD\_BASIC\ \ \ \ \ \(\backslash\)}}
\DoxyCodeLine{\textcolor{preprocessor}{\ \ \ \ (\_my\_cache\_descriptor,\ My\_Cache,\ \#\ member,\ member,\ eet\_type)}}
\DoxyCodeLine{\ \ \ ADD\_BASIC(version,\ \mbox{\hyperlink{group__Eet__Data__Group_gacf6a3c9f06e10e20be5b02cd8c6a220b}{EET\_T\_UINT}});}
\DoxyCodeLine{\textcolor{preprocessor}{\#undef\ ADD\_BASIC}}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Eet__Data__Group_gad5e348ead4ba0b441c1e020f9bf23365}{EET\_DATA\_DESCRIPTOR\_ADD\_HASH}}}
\DoxyCodeLine{\ \ \ \ \ (\_my\_cache\_descriptor,\ My\_Cache,\ \textcolor{stringliteral}{"{}accounts"{}},\ accounts,}
\DoxyCodeLine{\ \ \ \ \ \_my\_account\_descriptor);}
\DoxyCodeLine{\}\ \textcolor{comment}{/*\ \_my\_cache\_descriptor\_init\ */}}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{keyword}{static}\ \textcolor{keywordtype}{void}}
\DoxyCodeLine{\_my\_cache\_descriptor\_shutdown(\textcolor{keywordtype}{void})}
\DoxyCodeLine{\{}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Eet__Data__Group_ga3e2b601720973d0e1f4683768a593c4d}{eet\_data\_descriptor\_free}}(\_my\_cache\_descriptor);}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Eet__Data__Group_ga3e2b601720973d0e1f4683768a593c4d}{eet\_data\_descriptor\_free}}(\_my\_account\_descriptor);}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Eet__Data__Group_ga3e2b601720973d0e1f4683768a593c4d}{eet\_data\_descriptor\_free}}(\_my\_message\_descriptor);}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Eet__Data__Group_ga3e2b601720973d0e1f4683768a593c4d}{eet\_data\_descriptor\_free}}(\_my\_post\_descriptor);}
\DoxyCodeLine{\}\ \textcolor{comment}{/*\ \_my\_cache\_descriptor\_shutdown\ */}}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{comment}{//\ need\ to\ check\ if\ the\ pointer\ came\ from\ mmaped\ area\ in\ eet\_dictionary}}
\DoxyCodeLine{\textcolor{comment}{//\ or\ it\ was\ allocated\ with\ eina\_stringshare\_add()}}
\DoxyCodeLine{\textcolor{keyword}{static}\ \textcolor{keywordtype}{void}}
\DoxyCodeLine{\_eet\_string\_free(\textcolor{keyword}{const}\ \textcolor{keywordtype}{char}\ *str)}
\DoxyCodeLine{\{}
\DoxyCodeLine{\ \ \ \textcolor{keywordflow}{if}\ (!str)}
\DoxyCodeLine{\ \ \ \ \ \textcolor{keywordflow}{return};}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ \textcolor{keywordflow}{if}\ ((\_my\_cache\_dict)\ \&\&\ (\mbox{\hyperlink{group__Eet__File__Group_ga53290da52edb929b85e51f25e79d27c8}{eet\_dictionary\_string\_check}}(\_my\_cache\_dict,\ str)))}
\DoxyCodeLine{\ \ \ \ \ \textcolor{keywordflow}{return};}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Eina__Stringshare__Group_ga5538b4a134987b8a01744fad1a845ba4}{eina\_stringshare\_del}}(str);}
\DoxyCodeLine{\}\ \textcolor{comment}{/*\ \_eet\_string\_free\ */}}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{keyword}{static}\ My\_Message\ *}
\DoxyCodeLine{\_my\_message\_new(\textcolor{keyword}{const}\ \textcolor{keywordtype}{char}\ *message)}
\DoxyCodeLine{\{}
\DoxyCodeLine{\ \ \ My\_Message\ *msg\ =\ calloc(1,\ \textcolor{keyword}{sizeof}(My\_Message));}
\DoxyCodeLine{\ \ \ \textcolor{keywordflow}{if}\ (!msg)}
\DoxyCodeLine{\ \ \ \ \ \{}
\DoxyCodeLine{\ \ \ \ \ \ \ \ fprintf(stderr,\ \textcolor{stringliteral}{"{}ERROR:\ could\ not\ calloc\ My\_Message\(\backslash\)n"{}});}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ NULL;}
\DoxyCodeLine{\ \ \ \ \ \}}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ msg-\/>message\ =\ \mbox{\hyperlink{group__Eina__Stringshare__Group_ga4e3ce40744291c1fb8574e26883c0bf2}{eina\_stringshare\_add}}(message);}
\DoxyCodeLine{\ \ \ \textcolor{keywordflow}{return}\ msg;}
\DoxyCodeLine{\}\ \textcolor{comment}{/*\ \_my\_message\_new\ */}}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{keyword}{static}\ \textcolor{keywordtype}{void}}
\DoxyCodeLine{\_my\_message\_free(My\_Message\ *msg)}
\DoxyCodeLine{\{}
\DoxyCodeLine{\ \ \ \_eet\_string\_free(msg-\/>screen\_name);}
\DoxyCodeLine{\ \ \ \_eet\_string\_free(msg-\/>name);}
\DoxyCodeLine{\ \ \ \_eet\_string\_free(msg-\/>message);}
\DoxyCodeLine{\ \ \ free(msg);}
\DoxyCodeLine{\}\ \textcolor{comment}{/*\ \_my\_message\_free\ */}}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{keyword}{static}\ \mbox{\hyperlink{group__Eina__Types__Group_ga3fe0caf72e93b1bab1ca8ee3ccf3f226}{Eina\_Bool}}}
\DoxyCodeLine{\_my\_post\_add(My\_Account\ *acc,}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keyword}{const}\ \textcolor{keywordtype}{char}\ *message)}
\DoxyCodeLine{\{}
\DoxyCodeLine{\ \ \ \textcolor{keywordtype}{int}\ new\_count\ =\ acc-\/>posts\_count\ +\ 1;}
\DoxyCodeLine{\ \ \ My\_Post\ *post\ =\ realloc(acc-\/>posts,\ new\_count\ *\ \textcolor{keyword}{sizeof}(My\_Post));}
\DoxyCodeLine{\ \ \ \textcolor{keywordflow}{if}\ (!post)}
\DoxyCodeLine{\ \ \ \ \ \{}
\DoxyCodeLine{\ \ \ \ \ \ \ \ fprintf(stderr,\ \textcolor{stringliteral}{"{}ERROR:\ could\ add\ My\_Post\(\backslash\)n"{}});}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ \mbox{\hyperlink{group__Eina__Types__Group_ga1feb115f8e9913e806e090d9bd5a7301}{EINA\_FALSE}};}
\DoxyCodeLine{\ \ \ \ \ \}}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ post[acc-\/>posts\_count].message\ =\ \mbox{\hyperlink{group__Eina__Stringshare__Group_ga4e3ce40744291c1fb8574e26883c0bf2}{eina\_stringshare\_add}}(message);}
\DoxyCodeLine{\ \ \ post[acc-\/>posts\_count].dm\_to\ =\ NULL;}
\DoxyCodeLine{\ \ \ acc-\/>posts\_count\ =\ new\_count;}
\DoxyCodeLine{\ \ \ acc-\/>posts\ =\ post;}
\DoxyCodeLine{\ \ \ \textcolor{keywordflow}{return}\ \mbox{\hyperlink{group__Eina__Types__Group_ga05c12dacc8b4058994df842b41be85fc}{EINA\_TRUE}};}
\DoxyCodeLine{\}\ \textcolor{comment}{/*\ \_my\_post\_new\ */}}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{keyword}{static}\ \textcolor{keywordtype}{void}}
\DoxyCodeLine{\_my\_post\_free(My\_Post\ *post)}
\DoxyCodeLine{\{}
\DoxyCodeLine{\ \ \ \_eet\_string\_free(post-\/>dm\_to);}
\DoxyCodeLine{\ \ \ \_eet\_string\_free(post-\/>message);}
\DoxyCodeLine{\}\ \textcolor{comment}{/*\ \_my\_post\_free\ */}}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{keyword}{static}\ My\_Account\ *}
\DoxyCodeLine{\_my\_account\_new(\textcolor{keyword}{const}\ \textcolor{keywordtype}{char}\ *name)}
\DoxyCodeLine{\{}
\DoxyCodeLine{\ \ \ My\_Account\ *acc\ =\ calloc(1,\ \textcolor{keyword}{sizeof}(My\_Account));}
\DoxyCodeLine{\ \ \ \textcolor{keywordflow}{if}\ (!acc)}
\DoxyCodeLine{\ \ \ \ \ \{}
\DoxyCodeLine{\ \ \ \ \ \ \ \ fprintf(stderr,\ \textcolor{stringliteral}{"{}ERROR:\ could\ not\ calloc\ My\_Account\(\backslash\)n"{}});}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ NULL;}
\DoxyCodeLine{\ \ \ \ \ \}}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ acc-\/>name\ =\ \mbox{\hyperlink{group__Eina__Stringshare__Group_ga4e3ce40744291c1fb8574e26883c0bf2}{eina\_stringshare\_add}}(name);}
\DoxyCodeLine{\ \ \ \textcolor{keywordflow}{return}\ acc;}
\DoxyCodeLine{\}\ \textcolor{comment}{/*\ \_my\_account\_new\ */}}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{keyword}{static}\ \textcolor{keywordtype}{void}}
\DoxyCodeLine{\_my\_account\_free(My\_Account\ *acc)}
\DoxyCodeLine{\{}
\DoxyCodeLine{\ \ \ My\_Message\ *m;}
\DoxyCodeLine{\ \ \ \textcolor{keywordtype}{int}\ i;}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ \_eet\_string\_free(acc-\/>name);}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Eina__List__Group_gae27a2c686a0a11693f9b06957c9bba83}{EINA\_LIST\_FREE}}(acc-\/>messages,\ m)}
\DoxyCodeLine{\ \ \ \ \ \_my\_message\_free(m);}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ \textcolor{keywordflow}{for}\ (i\ =\ 0;\ i\ <\ acc-\/>posts\_count;\ i++)}
\DoxyCodeLine{\ \ \ \ \ \_my\_post\_free(\&acc-\/>posts[i]);}
\DoxyCodeLine{\ \ \ free(acc-\/>posts);}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ free(acc);}
\DoxyCodeLine{\}\ \textcolor{comment}{/*\ \_my\_account\_free\ */}}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{keyword}{static}\ My\_Cache\ *}
\DoxyCodeLine{\_my\_cache\_new(\textcolor{keywordtype}{void})}
\DoxyCodeLine{\{}
\DoxyCodeLine{\ \ \ My\_Cache\ *my\_cache\ =\ calloc(1,\ \textcolor{keyword}{sizeof}(My\_Cache));}
\DoxyCodeLine{\ \ \ \textcolor{keywordflow}{if}\ (!my\_cache)}
\DoxyCodeLine{\ \ \ \ \ \{}
\DoxyCodeLine{\ \ \ \ \ \ \ \ fprintf(stderr,\ \textcolor{stringliteral}{"{}ERROR:\ could\ not\ calloc\ My\_Cache\(\backslash\)n"{}});}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ NULL;}
\DoxyCodeLine{\ \ \ \ \ \}}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ my\_cache-\/>accounts\ =\ \mbox{\hyperlink{group__Eina__Hash__Group_ga96bbbf394fb34d7e1f57d261de638e69}{eina\_hash\_string\_small\_new}}(NULL);}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ my\_cache-\/>version\ =\ 1;}
\DoxyCodeLine{\ \ \ \textcolor{keywordflow}{return}\ my\_cache;}
\DoxyCodeLine{\}\ \textcolor{comment}{/*\ \_my\_cache\_new\ */}}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{keyword}{static}\ \mbox{\hyperlink{group__Eina__Types__Group_ga3fe0caf72e93b1bab1ca8ee3ccf3f226}{Eina\_Bool}}}
\DoxyCodeLine{\_my\_cache\_account\_free\_cb(\textcolor{keyword}{const}\ \mbox{\hyperlink{group__Eina__Hash__Group_ga9a89d7d3ee260d3a60572ebf651b07e0}{Eina\_Hash}}\ *hash\ \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}},}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keyword}{const}\ \textcolor{keywordtype}{void}\ \ \ \ \ \ *key\ \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}},}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{void}\ \ \ \ \ \ \ \ \ \ \ \ *data,}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{void}\ \ \ \ \ \ \ \ \ \ \ \ *fdata\ \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}})}
\DoxyCodeLine{\{}
\DoxyCodeLine{\ \ \ \_my\_account\_free(data);}
\DoxyCodeLine{\ \ \ \textcolor{keywordflow}{return}\ \mbox{\hyperlink{group__Eina__Types__Group_ga05c12dacc8b4058994df842b41be85fc}{EINA\_TRUE}};}
\DoxyCodeLine{\}}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{keyword}{static}\ \textcolor{keywordtype}{void}}
\DoxyCodeLine{\_my\_cache\_free(My\_Cache\ *my\_cache)}
\DoxyCodeLine{\{}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Eina__Hash__Group_ga9237dbade8e59ac827992c7a5146cb20}{eina\_hash\_foreach}}(my\_cache-\/>accounts,\ \_my\_cache\_account\_free\_cb,\ NULL);}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Eina__Hash__Group_ga76829f09c99852b1536efc813d99fc78}{eina\_hash\_free}}(my\_cache-\/>accounts);}
\DoxyCodeLine{\ \ \ free(my\_cache);}
\DoxyCodeLine{\}\ \textcolor{comment}{/*\ \_my\_cache\_free\ */}}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{keyword}{static}\ My\_Account\ *}
\DoxyCodeLine{\_my\_cache\_account\_find(My\_Cache\ \ \ *my\_cache,}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keyword}{const}\ \textcolor{keywordtype}{char}\ *name)}
\DoxyCodeLine{\{}
\DoxyCodeLine{\ \ \ \textcolor{keywordflow}{return}\ \mbox{\hyperlink{group__Eina__Hash__Group_ga6e9dc02a249e1fcdb64e38e7dc47afb3}{eina\_hash\_find}}(my\_cache-\/>accounts,\ name);}
\DoxyCodeLine{\}\ \textcolor{comment}{/*\ \_my\_cache\_account\_find\ */}}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{keyword}{static}\ My\_Cache\ *}
\DoxyCodeLine{\_my\_cache\_load(\textcolor{keyword}{const}\ \textcolor{keywordtype}{char}\ *filename)}
\DoxyCodeLine{\{}
\DoxyCodeLine{\ \ \ My\_Cache\ *my\_cache;}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Eet__File__Group_ga8d9779184a9870c1a225f1f40c76e8a7}{Eet\_File}}\ *ef\ =\ \mbox{\hyperlink{group__Eet__File__Group_ga675160a758832ee812edf7f64ed30ee6}{eet\_open}}(filename,\ \mbox{\hyperlink{group__Eet__File__Group_ggaa8e1a7af50fefaf15eb2f69543d24998a416f7e9a76b8131a44bbeedb13060c81}{EET\_FILE\_MODE\_READ}});}
\DoxyCodeLine{\ \ \ \textcolor{keywordflow}{if}\ (!ef)}
\DoxyCodeLine{\ \ \ \ \ \{}
\DoxyCodeLine{\ \ \ \ \ \ \ \ fprintf(stderr,\ \textcolor{stringliteral}{"{}ERROR:\ could\ not\ open\ '\%s'\ for\ read\(\backslash\)n"{}},\ filename);}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ NULL;}
\DoxyCodeLine{\ \ \ \ \ \}}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ my\_cache\ =\ \mbox{\hyperlink{group__Eet__Data__Group_ga4c09f4dfb051baabc0c0551ea98b6830}{eet\_data\_read}}(ef,\ \_my\_cache\_descriptor,\ MY\_CACHE\_FILE\_ENTRY);}
\DoxyCodeLine{\ \ \ \textcolor{keywordflow}{if}\ (!my\_cache)}
\DoxyCodeLine{\ \ \ \ \ \{}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \mbox{\hyperlink{group__Eet__File__Group_ga1675fef1f6012c1e02ae313d13dc3e03}{eet\_close}}(ef);}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ NULL;}
\DoxyCodeLine{\ \ \ \ \ \}}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ \textcolor{keywordflow}{if}\ (my\_cache-\/>version\ <\ 1)}
\DoxyCodeLine{\ \ \ \ \ \{}
\DoxyCodeLine{\ \ \ \ \ \ \ \ fprintf(stderr,}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{stringliteral}{"{}WARNING:\ version\ \%\#x\ was\ too\ old,\ upgrading\ it\ to\ \%\#x\(\backslash\)n"{}},}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ my\_cache-\/>version,\ 1);}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ \ \ \ \ \ my\_cache-\/>version\ =\ 1;}
\DoxyCodeLine{\ \ \ \ \ \}}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ \textcolor{keywordflow}{if}\ (\_my\_cache\_file)}
\DoxyCodeLine{\ \ \ \ \ \mbox{\hyperlink{group__Eet__File__Group_ga1675fef1f6012c1e02ae313d13dc3e03}{eet\_close}}(\_my\_cache\_file);}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ \_my\_cache\_file\ =\ ef;}
\DoxyCodeLine{\ \ \ \_my\_cache\_dict\ =\ \mbox{\hyperlink{group__Eet__File__Group_gabac3fef94bb732840b9ac9cc2917c4c6}{eet\_dictionary\_get}}(ef);}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ \textcolor{keywordflow}{return}\ my\_cache;}
\DoxyCodeLine{\}\ \textcolor{comment}{/*\ \_my\_cache\_load\ */}}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{keyword}{static}\ \mbox{\hyperlink{group__Eina__Types__Group_ga3fe0caf72e93b1bab1ca8ee3ccf3f226}{Eina\_Bool}}}
\DoxyCodeLine{\_my\_cache\_save(\textcolor{keyword}{const}\ My\_Cache\ *my\_cache,}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keyword}{const}\ \textcolor{keywordtype}{char}\ \ \ \ \ *filename)}
\DoxyCodeLine{\{}
\DoxyCodeLine{\ \ \ \textcolor{keywordtype}{char}\ tmp[PATH\_MAX];}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Eet__File__Group_ga8d9779184a9870c1a225f1f40c76e8a7}{Eet\_File}}\ *ef;}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Eina__Types__Group_ga3fe0caf72e93b1bab1ca8ee3ccf3f226}{Eina\_Bool}}\ ret;}
\DoxyCodeLine{\ \ \ \textcolor{keywordtype}{unsigned}\ \textcolor{keywordtype}{int}\ i,\ len;}
\DoxyCodeLine{\ \ \ \textcolor{keyword}{struct\ }stat\ st;}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ len\ =\ \mbox{\hyperlink{group__Eina__String__Group_gae28caa0c42c4e76ae584f22bd3615723}{eina\_strlcpy}}(tmp,\ filename,\ \textcolor{keyword}{sizeof}(tmp));}
\DoxyCodeLine{\ \ \ \textcolor{keywordflow}{if}\ (len\ +\ 12\ >=\ (\textcolor{keywordtype}{int})\textcolor{keyword}{sizeof}(tmp))}
\DoxyCodeLine{\ \ \ \ \ \{}
\DoxyCodeLine{\ \ \ \ \ \ \ \ fprintf(stderr,\ \textcolor{stringliteral}{"{}ERROR:\ file\ name\ is\ too\ big:\ \%s\(\backslash\)n"{}},\ filename);}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ \mbox{\hyperlink{group__Eina__Types__Group_ga1feb115f8e9913e806e090d9bd5a7301}{EINA\_FALSE}};}
\DoxyCodeLine{\ \ \ \ \ \}}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ i\ =\ 0;}
\DoxyCodeLine{\ \ \ \textcolor{keywordflow}{do}}
\DoxyCodeLine{\ \ \ \ \ \{}
\DoxyCodeLine{\ \ \ \ \ \ \ \ snprintf(tmp\ +\ len,\ 12,\ \textcolor{stringliteral}{"{}.\%u"{}},\ i);}
\DoxyCodeLine{\ \ \ \ \ \ \ \ i++;}
\DoxyCodeLine{\ \ \ \ \ \}}
\DoxyCodeLine{\ \ \ \textcolor{keywordflow}{while}\ (stat(tmp,\ \&st)\ ==\ 0);}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ ef\ =\ \mbox{\hyperlink{group__Eet__File__Group_ga675160a758832ee812edf7f64ed30ee6}{eet\_open}}(tmp,\ \mbox{\hyperlink{group__Eet__File__Group_ggaa8e1a7af50fefaf15eb2f69543d24998a8f395f56fba48be007c65be51d799ee9}{EET\_FILE\_MODE\_WRITE}});}
\DoxyCodeLine{\ \ \ \textcolor{keywordflow}{if}\ (!ef)}
\DoxyCodeLine{\ \ \ \ \ \{}
\DoxyCodeLine{\ \ \ \ \ \ \ \ fprintf(stderr,\ \textcolor{stringliteral}{"{}ERROR:\ could\ not\ open\ '\%s'\ for\ write\(\backslash\)n"{}},\ tmp);}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ \mbox{\hyperlink{group__Eina__Types__Group_ga1feb115f8e9913e806e090d9bd5a7301}{EINA\_FALSE}};}
\DoxyCodeLine{\ \ \ \ \ \}}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ ret\ =\ \mbox{\hyperlink{group__Eet__Data__Group_gac66d1c49e3490bc5d803982d833ff8aa}{eet\_data\_write}}}
\DoxyCodeLine{\ \ \ \ \ \ \ (ef,\ \_my\_cache\_descriptor,\ MY\_CACHE\_FILE\_ENTRY,\ my\_cache,\ \mbox{\hyperlink{group__Eina__Types__Group_ga05c12dacc8b4058994df842b41be85fc}{EINA\_TRUE}});}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ \textcolor{comment}{//\ VERY\ IMPORTANT\ NOTE:}}
\DoxyCodeLine{\ \ \ \textcolor{comment}{//\ after\ eet\_close(),\ all\ strings\ mmaped\ from\ file\ will\ be\ GONE,\ invalid!}}
\DoxyCodeLine{\ \ \ \textcolor{comment}{//\ you'll\ need\ to\ free\ the\ old\ cache\ and\ open\ the\ new\ one.}}
\DoxyCodeLine{\ \ \ \textcolor{comment}{//\ For\ cache\ this\ is\ okay,\ as\ you\ should\ be\ saving\ not\ so\ often\ or\ just}}
\DoxyCodeLine{\ \ \ \textcolor{comment}{//\ at\ end.}}
\DoxyCodeLine{\ \ \ \textcolor{comment}{//}}
\DoxyCodeLine{\ \ \ \textcolor{comment}{//\ This\ is\ a\ trade\ off,\ you\ save\ memory\ by\ using\ mmap()ed\ strings,\ but}}
\DoxyCodeLine{\ \ \ \textcolor{comment}{//\ you\ have\ to\ care\ about\ this.}}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Eet__File__Group_ga1675fef1f6012c1e02ae313d13dc3e03}{eet\_close}}(ef);}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ \textcolor{keywordflow}{if}\ (ret)}
\DoxyCodeLine{\ \ \ \ \ \{}
\DoxyCodeLine{\ \ \ \ \ \ \ \ unlink(filename);}
\DoxyCodeLine{\ \ \ \ \ \ \ \ rename(tmp,\ filename);}
\DoxyCodeLine{\ \ \ \ \ \}}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ \textcolor{keywordflow}{return}\ ret;}
\DoxyCodeLine{\}\ \textcolor{comment}{/*\ \_my\_cache\_save\ */}}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{keywordtype}{int}}
\DoxyCodeLine{main(\textcolor{keywordtype}{int}\ \ \ argc,}
\DoxyCodeLine{\ \ \ \ \ \textcolor{keywordtype}{char}\ *argv[])}
\DoxyCodeLine{\{}
\DoxyCodeLine{\ \ \ My\_Cache\ *my\_cache;}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{struct__Eina__Iterator}{Eina\_Iterator}}\ *it;}
\DoxyCodeLine{\ \ \ My\_Account\ *acc;}
\DoxyCodeLine{\ \ \ \textcolor{keywordtype}{int}\ ret\ =\ 0;}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ \textcolor{keywordflow}{if}\ (argc\ <\ 3)}
\DoxyCodeLine{\ \ \ \ \ \{}
\DoxyCodeLine{\ \ \ \ \ \ \ \ fprintf(stderr,}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{stringliteral}{"{}Usage:\(\backslash\)n\(\backslash\)t\%s\ <input>\ <output>\ [action]\ [action-\/params]\(\backslash\)n\(\backslash\)n"{}}}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{stringliteral}{"{}Where\ actions\ and\ their\ parameters:\(\backslash\)n"{}}}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{stringliteral}{"{}\(\backslash\)tacc\ <name>\(\backslash\)n"{}}}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{stringliteral}{"{}\(\backslash\)tpost\ <account-\/name>\ <message>\(\backslash\)n"{}}}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{stringliteral}{"{}\(\backslash\)tmessage\ <account-\/name>\ <message>\(\backslash\)n"{}}}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{stringliteral}{"{}\(\backslash\)n"{}},}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ argv[0]);}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ -\/1;}
\DoxyCodeLine{\ \ \ \ \ \}}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Eina__Main__Group_ga81b8137665b8a4d2cb38ca50017d4c74}{eina\_init}}();}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Eet__Group_ga9903687bfa20fe9a9e59d4c1d213e89a}{eet\_init}}();}
\DoxyCodeLine{\ \ \ \_my\_cache\_descriptor\_init();}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ my\_cache\ =\ \_my\_cache\_load(argv[1]);}
\DoxyCodeLine{\ \ \ \textcolor{keywordflow}{if}\ (!my\_cache)}
\DoxyCodeLine{\ \ \ \ \ \{}
\DoxyCodeLine{\ \ \ \ \ \ \ \ printf(\textcolor{stringliteral}{"{}creating\ new\ cache.\(\backslash\)n"{}});}
\DoxyCodeLine{\ \ \ \ \ \ \ \ my\_cache\ =\ \_my\_cache\_new();}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (!my\_cache)}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \{}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ ret\ =\ -\/2;}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{goto}\ end;}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{\ \ \ \ \ \}}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ \textcolor{keywordflow}{if}\ (argc\ >\ 3)}
\DoxyCodeLine{\ \ \ \ \ \{}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (strcmp(argv[3],\ \textcolor{stringliteral}{"{}acc"{}})\ ==\ 0)}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \{}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (argc\ ==\ 5)}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \{}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ My\_Account\ *acc\_\ =\ \_my\_cache\_account\_find(my\_cache,\ argv[4]);}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (!acc\_)}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \{}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ acc\_\ =\ \_my\_account\_new(argv[4]);}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \mbox{\hyperlink{group__Eina__Hash__Group_ga84a3b957ede675cb03f3c344695c1282}{eina\_hash\_direct\_add}}(my\_cache-\/>accounts,\ acc\_-\/>name,\ acc\_);}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{else}}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ fprintf(stderr,\ \textcolor{stringliteral}{"{}ERROR:\ account\ '\%s'\ already\ exists.\(\backslash\)n"{}},}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ argv[4]);}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{else}}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ fprintf(stderr,}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{stringliteral}{"{}ERROR:\ wrong\ number\ of\ parameters\ (\%d).\(\backslash\)n"{}},}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ argc);}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \textcolor{keywordflow}{else}\ \textcolor{keywordflow}{if}\ (strcmp(argv[3],\ \textcolor{stringliteral}{"{}post"{}})\ ==\ 0)}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \{}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (argc\ ==\ 6)}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \{}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ My\_Account\ *acc\_\ =\ \_my\_cache\_account\_find(my\_cache,\ argv[4]);}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (acc\_)}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \{}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \_my\_post\_add(acc\_,\ argv[5]);}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{else}}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ fprintf(stderr,\ \textcolor{stringliteral}{"{}ERROR:\ unknown\ account:\ '\%s'\(\backslash\)n"{}},\ argv[4]);}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{else}}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ fprintf(stderr,}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{stringliteral}{"{}ERROR:\ wrong\ number\ of\ parameters\ (\%d).\(\backslash\)n"{}},}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ argc);}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \textcolor{keywordflow}{else}\ \textcolor{keywordflow}{if}\ (strcmp(argv[3],\ \textcolor{stringliteral}{"{}message"{}})\ ==\ 0)}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \{}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (argc\ ==\ 6)}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \{}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ My\_Account\ *acc\_\ =\ \_my\_cache\_account\_find(my\_cache,\ argv[4]);}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (acc\_)}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \{}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ My\_Message\ *msg\ =\ \_my\_message\_new(argv[5]);}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ acc\_-\/>messages\ =\ \mbox{\hyperlink{group__Eina__List__Group_ga625698a383dda8fc0db245a1c7608c49}{eina\_list\_append}}(acc\_-\/>messages,\ msg);}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{else}}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ fprintf(stderr,\ \textcolor{stringliteral}{"{}ERROR:\ unknown\ account:\ '\%s'\(\backslash\)n"{}},\ argv[4]);}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{else}}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ fprintf(stderr,}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{stringliteral}{"{}ERROR:\ wrong\ number\ of\ parameters\ (\%d).\(\backslash\)n"{}},}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ argc);}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \textcolor{keywordflow}{else}}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ fprintf(stderr,\ \textcolor{stringliteral}{"{}ERROR:\ unknown\ action\ '\%s'\(\backslash\)n"{}},\ argv[2]);}
\DoxyCodeLine{\ \ \ \ \ \}}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ printf(\textcolor{stringliteral}{"{}My\_Cache:\(\backslash\)n"{}}}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \textcolor{stringliteral}{"{}\(\backslash\)tversion.:\ \%\#x\(\backslash\)n"{}}}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \textcolor{stringliteral}{"{}\(\backslash\)taccounts:\ \%u\(\backslash\)n"{}},}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ my\_cache-\/>version,}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \mbox{\hyperlink{group__Eina__Hash__Group_ga4bdeb2a1699703c62db697f229efe32d}{eina\_hash\_population}}(my\_cache-\/>accounts));}
\DoxyCodeLine{\ \ \ it\ =\ \mbox{\hyperlink{group__Eina__Hash__Group_ga1fa6b5d170d65706416bfb1446d7b1b8}{eina\_hash\_iterator\_data\_new}}(my\_cache-\/>accounts);}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Eina__Iterator__Group_gac7314580e18868ef229f5d2814562794}{EINA\_ITERATOR\_FOREACH}}(it,\ acc)}
\DoxyCodeLine{\ \ \ \ \ \{}
\DoxyCodeLine{\ \ \ \ \ \ \ \ printf(\textcolor{stringliteral}{"{}\(\backslash\)t\ \ >\ \%-\/\#8x\ '\%.20s'\ stats:\ m=\%u,\ p=\%u\(\backslash\)n"{}},}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ acc-\/>id,\ acc-\/>name\ ?\ acc-\/>name\ :\ \textcolor{stringliteral}{"{}"{}},}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ eina\_list\_count(acc-\/>messages),}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ acc-\/>posts\_count);}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (eina\_list\_count(acc-\/>messages))}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \{}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keyword}{const}\ \mbox{\hyperlink{struct__Eina__List}{Eina\_List}}\ *l;}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keyword}{const}\ My\_Message\ *msg;}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ printf(\textcolor{stringliteral}{"{}\(\backslash\)t\ \ |messages:\(\backslash\)n"{}});}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \mbox{\hyperlink{group__Eina__List__Group_gac6efafc19f526d916cdb9757240a8773}{EINA\_LIST\_FOREACH}}(acc-\/>messages,\ l,\ msg)}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \{}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ printf(\textcolor{stringliteral}{"{}\(\backslash\)t\ \ |\ \ \ \%-\/8x\ '\%s'\ [\%s]:\ '\%.20s'\(\backslash\)n"{}},}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ msg-\/>id,}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ msg-\/>name\ ?\ msg-\/>name\ :\ \textcolor{stringliteral}{"{}"{}},}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ msg-\/>screen\_name\ ?\ msg-\/>screen\_name\ :\ \textcolor{stringliteral}{"{}"{}},}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ msg-\/>message\ ?\ msg-\/>message\ :\ \textcolor{stringliteral}{"{}"{}});}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (acc-\/>posts\_count)}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \{}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keyword}{const}\ My\_Post\ *post;}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{int}\ i;}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ printf(\textcolor{stringliteral}{"{}\(\backslash\)t\ \ |posts:\(\backslash\)n"{}});}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{for}\ (i\ =\ 0;\ i\ <\ acc-\/>posts\_count;\ i++)}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \{}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ post\ =\ \&acc-\/>posts[i];}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (post-\/>dm\_to)}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ printf(\textcolor{stringliteral}{"{}\(\backslash\)t\ \ |\ \ @\%s:\ '\%.20s'\(\backslash\)n"{}},\ post-\/>dm\_to,\ post-\/>message);}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{else}}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ printf(\textcolor{stringliteral}{"{}\(\backslash\)t\ \ |\ \ '\%.20s'\(\backslash\)n"{}},\ post-\/>message);}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ \ \ \ \ \ printf(\textcolor{stringliteral}{"{}\(\backslash\)n"{}});}
\DoxyCodeLine{\ \ \ \ \ \}}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Eina__Iterator__Group_ga50da005e8d26c0a043d0d1c025bc9008}{eina\_iterator\_free}}(it);}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ \textcolor{keywordflow}{if}\ (!\_my\_cache\_save(my\_cache,\ argv[2]))}
\DoxyCodeLine{\ \ \ \ \ ret\ =\ -\/3;}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ \_my\_cache\_free(my\_cache);}
\DoxyCodeLine{}
\DoxyCodeLine{end:}
\DoxyCodeLine{\ \ \ \textcolor{keywordflow}{if}\ (\_my\_cache\_file)}
\DoxyCodeLine{\ \ \ \ \ \mbox{\hyperlink{group__Eet__File__Group_ga1675fef1f6012c1e02ae313d13dc3e03}{eet\_close}}(\_my\_cache\_file);}
\DoxyCodeLine{\ \ \ \_my\_cache\_descriptor\_shutdown();}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Eet__Group_gacbc7583179399d3b3e7b003e911f866f}{eet\_shutdown}}();}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Eina__Main__Group_ga5bf35513199d5220341437c05696285d}{eina\_shutdown}}();}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ \textcolor{keywordflow}{return}\ ret;}
\DoxyCodeLine{\}\ \textcolor{comment}{/*\ main\ */}}
\DoxyCodeLine{}

\end{DoxyCodeInclude}
 