\hypertarget{eet-data-file_descriptor_02_8c-example}{\section{eet-\/data-\/file\+\_\+descriptor\+\_\+02.\+c}
}

\begin{DoxyCodeInclude}
\textcolor{comment}{//Compile with:}
\textcolor{comment}{// gcc -o eet-data-file\_descriptor\_02 eet-data-file\_descriptor\_02.c `pkg-config --cflags --libs eet eina`}

\textcolor{preprocessor}{#include <\hyperlink{Eina_8h}{Eina.h}>}
\textcolor{preprocessor}{#include <\hyperlink{Eet_8h}{Eet.h}>}
\textcolor{preprocessor}{#include <stdio.h>}
\textcolor{preprocessor}{#include <limits.h>}
\textcolor{preprocessor}{#include <sys/types.h>}
\textcolor{preprocessor}{#include <sys/stat.h>}
\textcolor{preprocessor}{#include <unistd.h>}

\textcolor{keyword}{typedef} \textcolor{keyword}{enum} \_Example\_Data\_Type      Example\_Data\_Type;
\textcolor{keyword}{typedef} \textcolor{keyword}{struct }\_Example\_Variant\_Type Example\_Variant\_Type;
\textcolor{keyword}{typedef} \textcolor{keyword}{struct }\_Example\_Variant      Example\_Variant;
\textcolor{keyword}{typedef} \textcolor{keyword}{struct }\_Example\_Union        Example\_Union;
\textcolor{keyword}{typedef} \textcolor{keyword}{struct }\_Example\_Struct1      Example\_Struct1;
\textcolor{keyword}{typedef} \textcolor{keyword}{struct }\_Example\_Struct2      Example\_Struct2;
\textcolor{keyword}{typedef} \textcolor{keyword}{struct }\_Example\_Struct3      Example\_Struct3;
\textcolor{keyword}{typedef} \textcolor{keyword}{struct }\_Example\_Lists        Example\_Lists;

\textcolor{keyword}{enum} \_Example\_Data\_Type
\{
   EET\_UNKNOWN = 0,
   EET\_STRUCT1,
   EET\_STRUCT2,
   EET\_STRUCT3,
   EET\_BASIC\_FLOAT,
   EET\_BASIC\_STRING
\};

\textcolor{keyword}{struct}
\{
   Example\_Data\_Type u;
   \textcolor{keyword}{const} \textcolor{keywordtype}{char}       *name;
\} eet\_mapping[] = \{
   \{ EET\_STRUCT1, \textcolor{stringliteral}{"ST1"} \},
   \{ EET\_STRUCT2, \textcolor{stringliteral}{"ST2"} \},
   \{ EET\_STRUCT3, \textcolor{stringliteral}{"ST3"} \},
   \{ EET\_BASIC\_FLOAT, \textcolor{stringliteral}{"float"} \},
   \{ EET\_BASIC\_STRING, \textcolor{stringliteral}{"string"} \},
   \{ EET\_UNKNOWN, NULL \}
\};

\textcolor{keyword}{struct }\_Example\_Struct1
\{
   \textcolor{keywordtype}{double}      val1;
   \textcolor{keywordtype}{int}         stuff;
   \textcolor{keyword}{const} \textcolor{keywordtype}{char} *s1;
\};

\textcolor{keyword}{struct }\_Example\_Struct2
\{
   \hyperlink{group__Eina__Types__Group_ga3fe0caf72e93b1bab1ca8ee3ccf3f226}{Eina\_Bool}          b1;
   \textcolor{keywordtype}{unsigned} \textcolor{keywordtype}{long} \textcolor{keywordtype}{long} v1;
\};

\textcolor{keyword}{struct }\_Example\_Struct3
\{
   \textcolor{keywordtype}{int} body;
\};

\textcolor{keyword}{struct }\_Example\_Union
\{
   Example\_Data\_Type type;

   \textcolor{keyword}{union }\{
      Example\_Struct1 st1;
      Example\_Struct2 st2;
      Example\_Struct3 st3;
      \textcolor{keywordtype}{float} f;
      \textcolor{keyword}{const} \textcolor{keywordtype}{char}* string;
   \} u;
\};

\textcolor{keyword}{struct }\_Example\_Variant\_Type
\{
   \textcolor{keyword}{const} \textcolor{keywordtype}{char} *type;
   \hyperlink{group__Eina__Types__Group_ga3fe0caf72e93b1bab1ca8ee3ccf3f226}{Eina\_Bool}   unknow : 1;
\};

\textcolor{keyword}{struct }\_Example\_Variant
\{
   Example\_Variant\_Type t;

   \textcolor{keywordtype}{void}                *data; \textcolor{comment}{/* differently than the union type, we}
\textcolor{comment}{                               * don't need to pre-allocate the memory}
\textcolor{comment}{                               * for the field*/}
\};

\textcolor{keyword}{struct }\_Example\_Lists
\{
   \hyperlink{struct__Eina__List}{Eina\_List} *union\_list;
   \hyperlink{struct__Eina__List}{Eina\_List} *variant\_list;
\};

\textcolor{keyword}{static} \textcolor{keywordtype}{void}
\_st1\_set(Example\_Struct1 *st1,
         \textcolor{keywordtype}{double}           v1,
         \textcolor{keywordtype}{int}              v2,
         \textcolor{keyword}{const} \textcolor{keywordtype}{char}      *v3)
\{
   st1->val1 = v1;
   st1->stuff = v2;
   st1->s1 = v3;
\} \textcolor{comment}{/* \_st1\_set */}

\textcolor{keyword}{static} \textcolor{keywordtype}{void}
\_st2\_set(Example\_Struct2   *st2,
         \hyperlink{group__Eina__Types__Group_ga3fe0caf72e93b1bab1ca8ee3ccf3f226}{Eina\_Bool}          v1,
         \textcolor{keywordtype}{unsigned} \textcolor{keywordtype}{long} \textcolor{keywordtype}{long} v2)
\{
   st2->b1 = v1;
   st2->v1 = v2;
\} \textcolor{comment}{/* \_st2\_set */}

\textcolor{keyword}{static} \textcolor{keywordtype}{void}
\_st3\_set(Example\_Struct3 *st3,
         \textcolor{keywordtype}{int}              v1)
\{
   st3->body = v1;
\} \textcolor{comment}{/* \_st3\_set */}

\textcolor{keyword}{static} \textcolor{keyword}{const} \textcolor{keywordtype}{char} *
\textcolor{comment}{/* union}
\textcolor{comment}{   type\_get() */}
\_union\_type\_get(\textcolor{keyword}{const} \textcolor{keywordtype}{void} *data,
                \hyperlink{group__Eina__Types__Group_ga3fe0caf72e93b1bab1ca8ee3ccf3f226}{Eina\_Bool}  *unknow)
\{
   \textcolor{keyword}{const} Example\_Data\_Type *u = data;
   \textcolor{keywordtype}{int} i;

   \textcolor{keywordflow}{if} (unknow)
     *unknow = \hyperlink{group__Eina__Types__Group_ga1feb115f8e9913e806e090d9bd5a7301}{EINA\_FALSE};

   \textcolor{keywordflow}{for} (i = 0; eet\_mapping[i].name != NULL; ++i)
     \textcolor{keywordflow}{if} (*u == eet\_mapping[i].u)
       \textcolor{keywordflow}{return} eet\_mapping[i].name;

   \textcolor{keywordflow}{if} (unknow)
     *unknow = \hyperlink{group__Eina__Types__Group_ga05c12dacc8b4058994df842b41be85fc}{EINA\_TRUE};

   \textcolor{keywordflow}{return} NULL;
\} \textcolor{comment}{/* \_union\_type\_get */}

\textcolor{keyword}{static} \hyperlink{group__Eina__Types__Group_ga3fe0caf72e93b1bab1ca8ee3ccf3f226}{Eina\_Bool}
\_union\_type\_set(\textcolor{keyword}{const} \textcolor{keywordtype}{char} *type,
                \textcolor{keywordtype}{void}       *data,
                \hyperlink{group__Eina__Types__Group_ga3fe0caf72e93b1bab1ca8ee3ccf3f226}{Eina\_Bool}   unknow)
\{
   Example\_Data\_Type *u = data;
   \textcolor{keywordtype}{int} i;

   \textcolor{keywordflow}{if} (unknow)
     \textcolor{keywordflow}{return} \hyperlink{group__Eina__Types__Group_ga1feb115f8e9913e806e090d9bd5a7301}{EINA\_FALSE};

   \textcolor{keywordflow}{for} (i = 0; eet\_mapping[i].name != NULL; ++i)
     \textcolor{keywordflow}{if} (strcmp(eet\_mapping[i].name, type) == 0)
       \{
          *u = eet\_mapping[i].u;
          \textcolor{keywordflow}{return} \hyperlink{group__Eina__Types__Group_ga05c12dacc8b4058994df842b41be85fc}{EINA\_TRUE};
       \}

   \textcolor{keywordflow}{return} \hyperlink{group__Eina__Types__Group_ga1feb115f8e9913e806e090d9bd5a7301}{EINA\_FALSE};
\} \textcolor{comment}{/* \_union\_type\_set */}

\textcolor{keyword}{static} \textcolor{keyword}{const} \textcolor{keywordtype}{char} *
\_variant\_type\_get(\textcolor{keyword}{const} \textcolor{keywordtype}{void} *data,
                  \hyperlink{group__Eina__Types__Group_ga3fe0caf72e93b1bab1ca8ee3ccf3f226}{Eina\_Bool}  *unknow)
\{
   \textcolor{keyword}{const} Example\_Variant\_Type *type = data;
   \textcolor{keywordtype}{int} i;

   \textcolor{keywordflow}{if} (unknow)
     *unknow = type->unknow;

   \textcolor{keywordflow}{for} (i = 0; eet\_mapping[i].name != NULL; ++i)
     \textcolor{keywordflow}{if} (strcmp(type->type, eet\_mapping[i].name) == 0)
       \textcolor{keywordflow}{return} eet\_mapping[i].name;

   \textcolor{keywordflow}{if} (unknow)
     *unknow = \hyperlink{group__Eina__Types__Group_ga1feb115f8e9913e806e090d9bd5a7301}{EINA\_FALSE};

   \textcolor{keywordflow}{return} type->type;
\} \textcolor{comment}{/* \_variant\_type\_get */}

\textcolor{keyword}{static} \hyperlink{group__Eina__Types__Group_ga3fe0caf72e93b1bab1ca8ee3ccf3f226}{Eina\_Bool}
\_variant\_type\_set(\textcolor{keyword}{const} \textcolor{keywordtype}{char} *type,
                  \textcolor{keywordtype}{void}       *data,
                  \hyperlink{group__Eina__Types__Group_ga3fe0caf72e93b1bab1ca8ee3ccf3f226}{Eina\_Bool}   unknow)
\{
   Example\_Variant\_Type *vt = data;

   vt->type = type;
   vt->unknow = unknow;
   \textcolor{keywordflow}{return} \hyperlink{group__Eina__Types__Group_ga05c12dacc8b4058994df842b41be85fc}{EINA\_TRUE};
\} \textcolor{comment}{/* \_variant\_type\_set */}

\textcolor{keyword}{static} \hyperlink{group__Eet__Data__Group_ga4baec0e840012480a0958c5c3bca276d}{Eet\_Data\_Descriptor} *
\_st1\_dd(\textcolor{keywordtype}{void})
\{
   \hyperlink{struct__Eet__Data__Descriptor__Class}{Eet\_Data\_Descriptor\_Class} eddc;
   \hyperlink{group__Eet__Data__Group_ga4baec0e840012480a0958c5c3bca276d}{Eet\_Data\_Descriptor} *res;

   \hyperlink{group__Eet__Data__Group_ga0bf94c07d8e69cfaac8dd2d615d7542c}{EET\_EINA\_FILE\_DATA\_DESCRIPTOR\_CLASS\_SET}(&eddc, Example\_Struct1);
   res = \hyperlink{group__Eet__Data__Group_ga2a7251edf1f60ced86c4860207331bb6}{eet\_data\_descriptor\_file\_new}(&eddc);
   \hyperlink{group__Eet__Data__Group_gac38ce778d7eba37cfca8a19efb7a9b3a}{EET\_DATA\_DESCRIPTOR\_ADD\_BASIC}(
     res, Example\_Struct1, \textcolor{stringliteral}{"val1"}, val1, \hyperlink{group__Eet__Data__Group_gac2d8336b1127fd382c65416cf45cd3e8}{EET\_T\_DOUBLE});
   \hyperlink{group__Eet__Data__Group_gac38ce778d7eba37cfca8a19efb7a9b3a}{EET\_DATA\_DESCRIPTOR\_ADD\_BASIC}(
     res, Example\_Struct1, \textcolor{stringliteral}{"stuff"}, stuff, \hyperlink{group__Eet__Data__Group_ga4e196733795867f14c6e387af7287baa}{EET\_T\_INT});
   \hyperlink{group__Eet__Data__Group_gac38ce778d7eba37cfca8a19efb7a9b3a}{EET\_DATA\_DESCRIPTOR\_ADD\_BASIC}(
     res, Example\_Struct1, \textcolor{stringliteral}{"s1"}, s1, \hyperlink{group__Eet__Data__Group_ga0d2cf409bf3f151156d74d18ac59e3d1}{EET\_T\_STRING});

   \textcolor{keywordflow}{return} res;
\} \textcolor{comment}{/* \_st1\_dd */}

\textcolor{keyword}{static} \hyperlink{group__Eet__Data__Group_ga4baec0e840012480a0958c5c3bca276d}{Eet\_Data\_Descriptor} *
\_st2\_dd(\textcolor{keywordtype}{void})
\{
   \hyperlink{struct__Eet__Data__Descriptor__Class}{Eet\_Data\_Descriptor\_Class} eddc;
   \hyperlink{group__Eet__Data__Group_ga4baec0e840012480a0958c5c3bca276d}{Eet\_Data\_Descriptor} *res;

   \hyperlink{group__Eet__Data__Group_ga0bf94c07d8e69cfaac8dd2d615d7542c}{EET\_EINA\_FILE\_DATA\_DESCRIPTOR\_CLASS\_SET}(&eddc, Example\_Struct2);
   res = \hyperlink{group__Eet__Data__Group_ga2a7251edf1f60ced86c4860207331bb6}{eet\_data\_descriptor\_file\_new}(&eddc);
   \hyperlink{group__Eet__Data__Group_gac38ce778d7eba37cfca8a19efb7a9b3a}{EET\_DATA\_DESCRIPTOR\_ADD\_BASIC}(
     res, Example\_Struct2, \textcolor{stringliteral}{"b1"}, b1, \hyperlink{group__Eet__Data__Group_ga09a1341cc158fda0ba60ad2386ecd795}{EET\_T\_UCHAR});
   \hyperlink{group__Eet__Data__Group_gac38ce778d7eba37cfca8a19efb7a9b3a}{EET\_DATA\_DESCRIPTOR\_ADD\_BASIC}(
     res, Example\_Struct2, \textcolor{stringliteral}{"v1"}, v1, \hyperlink{group__Eet__Data__Group_gac984c4b3f0ad353a14679cf39a70ebd7}{EET\_T\_ULONG\_LONG});

   \textcolor{keywordflow}{return} res;
\} \textcolor{comment}{/* \_st2\_dd */}

\textcolor{keyword}{static} \hyperlink{group__Eet__Data__Group_ga4baec0e840012480a0958c5c3bca276d}{Eet\_Data\_Descriptor} *
\_st3\_dd(\textcolor{keywordtype}{void})
\{
   \hyperlink{struct__Eet__Data__Descriptor__Class}{Eet\_Data\_Descriptor\_Class} eddc;
   \hyperlink{group__Eet__Data__Group_ga4baec0e840012480a0958c5c3bca276d}{Eet\_Data\_Descriptor} *res;

   \hyperlink{group__Eet__Data__Group_ga0bf94c07d8e69cfaac8dd2d615d7542c}{EET\_EINA\_FILE\_DATA\_DESCRIPTOR\_CLASS\_SET}(&eddc, Example\_Struct3);
   res = \hyperlink{group__Eet__Data__Group_ga2a7251edf1f60ced86c4860207331bb6}{eet\_data\_descriptor\_file\_new}(&eddc);
   \hyperlink{group__Eet__Data__Group_gac38ce778d7eba37cfca8a19efb7a9b3a}{EET\_DATA\_DESCRIPTOR\_ADD\_BASIC}(
     res, Example\_Struct3, \textcolor{stringliteral}{"body"}, body, \hyperlink{group__Eet__Data__Group_ga4e196733795867f14c6e387af7287baa}{EET\_T\_INT});

   \textcolor{keywordflow}{return} res;
\} \textcolor{comment}{/* \_st3\_dd */}

\textcolor{comment}{/* string that represents the entry in the eet file. you might like to}
\textcolor{comment}{ * have different profiles or so in the same file, this is possible}
\textcolor{comment}{ * with different strings}
\textcolor{comment}{ */}
\textcolor{keyword}{static} \textcolor{keyword}{const} \textcolor{keywordtype}{char} CACHE\_FILE\_ENTRY[] = \textcolor{stringliteral}{"cache"};

\textcolor{comment}{/* keep the descriptor static global, so it can be shared by different}
\textcolor{comment}{ * functions (load/save) of this and only this file.}
\textcolor{comment}{ */}
\textcolor{keyword}{static} \hyperlink{group__Eet__Data__Group_ga4baec0e840012480a0958c5c3bca276d}{Eet\_Data\_Descriptor} *\_lists\_descriptor;
\textcolor{keyword}{static} \hyperlink{group__Eet__Data__Group_ga4baec0e840012480a0958c5c3bca276d}{Eet\_Data\_Descriptor} *\_struct\_1\_descriptor;
\textcolor{keyword}{static} \hyperlink{group__Eet__Data__Group_ga4baec0e840012480a0958c5c3bca276d}{Eet\_Data\_Descriptor} *\_struct\_2\_descriptor;
\textcolor{keyword}{static} \hyperlink{group__Eet__Data__Group_ga4baec0e840012480a0958c5c3bca276d}{Eet\_Data\_Descriptor} *\_struct\_3\_descriptor;
\textcolor{keyword}{static} \hyperlink{group__Eet__Data__Group_ga4baec0e840012480a0958c5c3bca276d}{Eet\_Data\_Descriptor} *\_union\_descriptor;
\textcolor{keyword}{static} \hyperlink{group__Eet__Data__Group_ga4baec0e840012480a0958c5c3bca276d}{Eet\_Data\_Descriptor} *\_variant\_descriptor;
\textcolor{keyword}{static} \hyperlink{group__Eet__Data__Group_ga4baec0e840012480a0958c5c3bca276d}{Eet\_Data\_Descriptor} *\_union\_unified\_descriptor;
\textcolor{keyword}{static} \hyperlink{group__Eet__Data__Group_ga4baec0e840012480a0958c5c3bca276d}{Eet\_Data\_Descriptor} *\_variant\_unified\_descriptor;

\textcolor{comment}{/* keep file handle alive, so mmap()ed strings are all alive as}
\textcolor{comment}{ * well */}
\textcolor{keyword}{static} \hyperlink{group__Eet__File__Group_ga8d9779184a9870c1a225f1f40c76e8a7}{Eet\_File} *\_cache\_file = NULL;
\textcolor{keyword}{static} \hyperlink{group__Eet__File__Group_gaf0984c8280699ca5a3c4966f5580324c}{Eet\_Dictionary} *\_cache\_dict = NULL;

\textcolor{keyword}{static} \textcolor{keywordtype}{void}
\textcolor{comment}{/* declaring types */}
\_data\_descriptors\_init(\textcolor{keywordtype}{void})
\{
   \hyperlink{struct__Eet__Data__Descriptor__Class}{Eet\_Data\_Descriptor\_Class} eddc;

   \hyperlink{group__Eet__Data__Group_ga0bf94c07d8e69cfaac8dd2d615d7542c}{EET\_EINA\_FILE\_DATA\_DESCRIPTOR\_CLASS\_SET}(&eddc, Example\_Lists);
   \_lists\_descriptor = \hyperlink{group__Eet__Data__Group_ga2a7251edf1f60ced86c4860207331bb6}{eet\_data\_descriptor\_file\_new}(&eddc);

   \_struct\_1\_descriptor = \_st1\_dd();
   \_struct\_2\_descriptor = \_st2\_dd();
   \_struct\_3\_descriptor = \_st3\_dd();

   \textcolor{comment}{/* for union */}
   \hyperlink{group__Eet__Data__Group_ga0bf94c07d8e69cfaac8dd2d615d7542c}{EET\_EINA\_FILE\_DATA\_DESCRIPTOR\_CLASS\_SET}(&eddc, Example\_Union);
   \_union\_descriptor = \hyperlink{group__Eet__Data__Group_ga2a7251edf1f60ced86c4860207331bb6}{eet\_data\_descriptor\_file\_new}(&eddc);

   eddc.\hyperlink{struct__Eet__Data__Descriptor__Class_a4e3696014d6907dadd55840bf6008317}{version} = \hyperlink{group__Eet__Data__Group_ga61a090586eff90415b429f1017acf8a7}{EET\_DATA\_DESCRIPTOR\_CLASS\_VERSION};
   eddc.func.\hyperlink{struct__Eet__Data__Descriptor__Class_af71fcc4124973c0da6aa0e84dce426cb}{type\_get} = \_union\_type\_get;
   eddc.func.\hyperlink{struct__Eet__Data__Descriptor__Class_a1b6477a2a52b797a662c3fff9793f97e}{type\_set} = \_union\_type\_set;
   \_union\_unified\_descriptor = \hyperlink{group__Eet__Data__Group_ga2a7251edf1f60ced86c4860207331bb6}{eet\_data\_descriptor\_file\_new}(&eddc);

   \hyperlink{group__Eet__Data__Group_gad0daa543d93a64add80961ae5387d45a}{EET\_DATA\_DESCRIPTOR\_ADD\_MAPPING}(
     \_union\_unified\_descriptor, \textcolor{stringliteral}{"ST1"}, \_struct\_1\_descriptor);
   \hyperlink{group__Eet__Data__Group_gad0daa543d93a64add80961ae5387d45a}{EET\_DATA\_DESCRIPTOR\_ADD\_MAPPING}(
     \_union\_unified\_descriptor, \textcolor{stringliteral}{"ST2"}, \_struct\_2\_descriptor);
   \hyperlink{group__Eet__Data__Group_gad0daa543d93a64add80961ae5387d45a}{EET\_DATA\_DESCRIPTOR\_ADD\_MAPPING}(
     \_union\_unified\_descriptor, \textcolor{stringliteral}{"ST3"}, \_struct\_3\_descriptor);
   \hyperlink{group__Eet__Data__Group_gaaf153807a88cd2c3483c5c34bb920a95}{EET\_DATA\_DESCRIPTOR\_ADD\_MAPPING\_BASIC}(
     \_union\_unified\_descriptor, \textcolor{stringliteral}{"float"}, \hyperlink{group__Eet__Data__Group_ga447b1b41e09b24ac6b3fbbac8d3efb30}{EET\_T\_FLOAT});
   \hyperlink{group__Eet__Data__Group_gaaf153807a88cd2c3483c5c34bb920a95}{EET\_DATA\_DESCRIPTOR\_ADD\_MAPPING\_BASIC}(
     \_union\_unified\_descriptor, \textcolor{stringliteral}{"string"}, \hyperlink{group__Eet__Data__Group_ga0d2cf409bf3f151156d74d18ac59e3d1}{EET\_T\_STRING});

   \hyperlink{group__Eet__Data__Group_ga07b711dca3d4bcaa0ccb8ced48341b90}{EET\_DATA\_DESCRIPTOR\_ADD\_UNION}(
     \_union\_descriptor, Example\_Union, \textcolor{stringliteral}{"u"}, u, type,
     \_union\_unified\_descriptor);

   \hyperlink{group__Eet__Data__Group_gabb4c7833ba053f2322e6b667a9ec7f04}{EET\_DATA\_DESCRIPTOR\_ADD\_LIST}(
     \_lists\_descriptor, Example\_Lists, \textcolor{stringliteral}{"union\_list"}, union\_list,
     \_union\_descriptor);

   \textcolor{comment}{/* for variant */}
   \hyperlink{group__Eet__Data__Group_ga0bf94c07d8e69cfaac8dd2d615d7542c}{EET\_EINA\_FILE\_DATA\_DESCRIPTOR\_CLASS\_SET}(&eddc, Example\_Variant);
   \_variant\_descriptor = \hyperlink{group__Eet__Data__Group_ga2a7251edf1f60ced86c4860207331bb6}{eet\_data\_descriptor\_file\_new}(&eddc);

   eddc.\hyperlink{struct__Eet__Data__Descriptor__Class_a4e3696014d6907dadd55840bf6008317}{version} = \hyperlink{group__Eet__Data__Group_ga61a090586eff90415b429f1017acf8a7}{EET\_DATA\_DESCRIPTOR\_CLASS\_VERSION};
   eddc.func.\hyperlink{struct__Eet__Data__Descriptor__Class_af71fcc4124973c0da6aa0e84dce426cb}{type\_get} = \_variant\_type\_get;
   eddc.func.\hyperlink{struct__Eet__Data__Descriptor__Class_a1b6477a2a52b797a662c3fff9793f97e}{type\_set} = \_variant\_type\_set;
   \_variant\_unified\_descriptor = \hyperlink{group__Eet__Data__Group_gae300b4a97dbaab30a200edbb97f108c1}{eet\_data\_descriptor\_stream\_new}(&eddc);

   \hyperlink{group__Eet__Data__Group_gad0daa543d93a64add80961ae5387d45a}{EET\_DATA\_DESCRIPTOR\_ADD\_MAPPING}(
     \_variant\_unified\_descriptor, \textcolor{stringliteral}{"ST1"}, \_struct\_1\_descriptor);
   \hyperlink{group__Eet__Data__Group_gad0daa543d93a64add80961ae5387d45a}{EET\_DATA\_DESCRIPTOR\_ADD\_MAPPING}(
     \_variant\_unified\_descriptor, \textcolor{stringliteral}{"ST2"}, \_struct\_2\_descriptor);
   \hyperlink{group__Eet__Data__Group_gad0daa543d93a64add80961ae5387d45a}{EET\_DATA\_DESCRIPTOR\_ADD\_MAPPING}(
     \_variant\_unified\_descriptor, \textcolor{stringliteral}{"ST3"}, \_struct\_3\_descriptor);

   \hyperlink{group__Eet__Data__Group_ga8851a40b130061262a8dd009f0457a65}{EET\_DATA\_DESCRIPTOR\_ADD\_VARIANT}(
     \_variant\_descriptor, Example\_Variant, \textcolor{stringliteral}{"data"}, data, t,
     \_variant\_unified\_descriptor);

   \hyperlink{group__Eet__Data__Group_gabb4c7833ba053f2322e6b667a9ec7f04}{EET\_DATA\_DESCRIPTOR\_ADD\_LIST}(
     \_lists\_descriptor, Example\_Lists, \textcolor{stringliteral}{"variant\_list"}, variant\_list,
     \_variant\_descriptor);
\} \textcolor{comment}{/* \_data\_descriptors\_init */}

\textcolor{keyword}{static} \textcolor{keywordtype}{void}
\_data\_descriptors\_shutdown(\textcolor{keywordtype}{void})
\{
   \hyperlink{group__Eet__Data__Group_ga3e2b601720973d0e1f4683768a593c4d}{eet\_data\_descriptor\_free}(\_lists\_descriptor);
   \hyperlink{group__Eet__Data__Group_ga3e2b601720973d0e1f4683768a593c4d}{eet\_data\_descriptor\_free}(\_struct\_1\_descriptor);
   \hyperlink{group__Eet__Data__Group_ga3e2b601720973d0e1f4683768a593c4d}{eet\_data\_descriptor\_free}(\_struct\_2\_descriptor);
   \hyperlink{group__Eet__Data__Group_ga3e2b601720973d0e1f4683768a593c4d}{eet\_data\_descriptor\_free}(\_struct\_3\_descriptor);
   \hyperlink{group__Eet__Data__Group_ga3e2b601720973d0e1f4683768a593c4d}{eet\_data\_descriptor\_free}(\_union\_descriptor);
   \hyperlink{group__Eet__Data__Group_ga3e2b601720973d0e1f4683768a593c4d}{eet\_data\_descriptor\_free}(\_variant\_descriptor);
   \hyperlink{group__Eet__Data__Group_ga3e2b601720973d0e1f4683768a593c4d}{eet\_data\_descriptor\_free}(\_union\_unified\_descriptor);
   \hyperlink{group__Eet__Data__Group_ga3e2b601720973d0e1f4683768a593c4d}{eet\_data\_descriptor\_free}(\_variant\_unified\_descriptor);
\} \textcolor{comment}{/* \_data\_descriptors\_shutdown */}

\textcolor{comment}{/* need to check if the pointer came from mmap()ed area in}
\textcolor{comment}{ * eet\_dictionary or it was allocated with eina\_stringshare\_add()}
\textcolor{comment}{ */}
\textcolor{keyword}{static} \textcolor{keywordtype}{void}
\_string\_free(\textcolor{keyword}{const} \textcolor{keywordtype}{char} *str)
\{
   \textcolor{keywordflow}{if} (!str)
     \textcolor{keywordflow}{return};

   \textcolor{keywordflow}{if} ((\_cache\_dict) && (\hyperlink{group__Eet__File__Group_ga53290da52edb929b85e51f25e79d27c8}{eet\_dictionary\_string\_check}(\_cache\_dict, str)))
     \textcolor{keywordflow}{return};

   \hyperlink{group__Eina__Stringshare__Group_ga4453d2aff2b325c7b45048f30df9b1f5}{eina\_stringshare\_del}(str);
\} \textcolor{comment}{/* \_string\_free */}

\textcolor{keyword}{static} Example\_Union *
\_union\_1\_new(\textcolor{keyword}{const} \textcolor{keywordtype}{char} *v1,
             \textcolor{keyword}{const} \textcolor{keywordtype}{char} *v2,
             \textcolor{keyword}{const} \textcolor{keywordtype}{char} *v3)
\{
   Example\_Union *un = calloc(1, \textcolor{keyword}{sizeof}(Example\_Union));
   \textcolor{keywordflow}{if} (!un)
     \{
        fprintf(
          stderr, \textcolor{stringliteral}{"ERROR: could not allocate an Example\_Union struct.\(\backslash\)n"});
        \textcolor{keywordflow}{return} NULL;
     \}

   un->type = EET\_STRUCT1;
   \_st1\_set(&(un->u.st1), atof(v1), atoi(v2), \hyperlink{group__Eina__Stringshare__Group_gac7a3f073cafb7af63b2c7cc2eabd1c1f}{eina\_stringshare\_add}(v3));

   \textcolor{keywordflow}{return} un;
\}

\textcolor{keyword}{static} Example\_Union *
\_union\_2\_new(\textcolor{keyword}{const} \textcolor{keywordtype}{char} *v1,
             \textcolor{keyword}{const} \textcolor{keywordtype}{char} *v2)
\{
   Example\_Union *un = calloc(1, \textcolor{keyword}{sizeof}(Example\_Union));
   \textcolor{keywordflow}{if} (!un)
     \{
        fprintf(
          stderr, \textcolor{stringliteral}{"ERROR: could not allocate an Example\_Union struct.\(\backslash\)n"});
        \textcolor{keywordflow}{return} NULL;
     \}

   un->type = EET\_STRUCT2;
   \_st2\_set(&(un->u.st2), atoi(v1), atoi(v2));

   \textcolor{keywordflow}{return} un;
\}

\textcolor{keyword}{static} Example\_Union *
\_union\_3\_new(\textcolor{keyword}{const} \textcolor{keywordtype}{char} *v1)
\{
   Example\_Union *un = calloc(1, \textcolor{keyword}{sizeof}(Example\_Union));
   \textcolor{keywordflow}{if} (!un)
     \{
        fprintf(
          stderr, \textcolor{stringliteral}{"ERROR: could not allocate an Example\_Union struct.\(\backslash\)n"});
        \textcolor{keywordflow}{return} NULL;
     \}

   un->type = EET\_STRUCT3;
   \_st3\_set(&(un->u.st3), atoi(v1));

   \textcolor{keywordflow}{return} un;
\}

\textcolor{keyword}{static} Example\_Union *
\_union\_float\_new(\textcolor{keyword}{const} \textcolor{keywordtype}{char} *v1)
\{
   Example\_Union *un = calloc(1, \textcolor{keyword}{sizeof}(Example\_Union));
   \textcolor{keywordflow}{if} (!un)
     \{
        fprintf(
          stderr, \textcolor{stringliteral}{"ERROR: could not allocate an Example\_Union struct.\(\backslash\)n"});
        \textcolor{keywordflow}{return} NULL;
     \}

   un->type = EET\_BASIC\_FLOAT;
   un->u.f = atof(v1);

   \textcolor{keywordflow}{return} un;
\}

\textcolor{keyword}{static} Example\_Union *
\_union\_string\_new(\textcolor{keyword}{const} \textcolor{keywordtype}{char} *v1)
\{
   Example\_Union *un = calloc(1, \textcolor{keyword}{sizeof}(Example\_Union));
   \textcolor{keywordflow}{if} (!un)
     \{
        fprintf(
          stderr, \textcolor{stringliteral}{"ERROR: could not allocate an Example\_Union struct.\(\backslash\)n"});
        \textcolor{keywordflow}{return} NULL;
     \}

   un->type = EET\_BASIC\_STRING;
   un->u.string = v1;

   \textcolor{keywordflow}{return} un;
\}

\textcolor{keyword}{static} Example\_Variant *
\_variant\_1\_new(\textcolor{keyword}{const} \textcolor{keywordtype}{char} *v1,
               \textcolor{keyword}{const} \textcolor{keywordtype}{char} *v2,
               \textcolor{keyword}{const} \textcolor{keywordtype}{char} *v3)
\{
   Example\_Struct1 *st1;
   Example\_Variant *va = calloc(1, \textcolor{keyword}{sizeof}(Example\_Variant));
   \textcolor{keywordflow}{if} (!va)
     \{
        fprintf(
          stderr, \textcolor{stringliteral}{"ERROR: could not allocate an Example\_Variant struct.\(\backslash\)n"});
        \textcolor{keywordflow}{return} NULL;
     \}

   va = calloc(1, \textcolor{keyword}{sizeof} (Example\_Variant));
   va->t.type = eet\_mapping[0].name;
   st1 = calloc(1, \textcolor{keyword}{sizeof} (Example\_Struct1));
   \_st1\_set(st1, atof(v1), atoi(v2), \hyperlink{group__Eina__Stringshare__Group_gac7a3f073cafb7af63b2c7cc2eabd1c1f}{eina\_stringshare\_add}(v3));
   va->data = st1;

   \textcolor{keywordflow}{return} va;
\}

\textcolor{keyword}{static} Example\_Variant *
\_variant\_2\_new(\textcolor{keyword}{const} \textcolor{keywordtype}{char} *v1,
               \textcolor{keyword}{const} \textcolor{keywordtype}{char} *v2)
\{
   printf(\textcolor{stringliteral}{"varinant 2 new\(\backslash\)n"});

   Example\_Struct2 *st2;
   Example\_Variant *va = calloc(1, \textcolor{keyword}{sizeof}(Example\_Variant));
   \textcolor{keywordflow}{if} (!va)
     \{
        fprintf(
          stderr, \textcolor{stringliteral}{"ERROR: could not allocate an Example\_Variant struct.\(\backslash\)n"});
        \textcolor{keywordflow}{return} NULL;
     \}

   va = calloc(1, \textcolor{keyword}{sizeof} (Example\_Variant));

   va->t.type = eet\_mapping[1].name;

   printf(\textcolor{stringliteral}{"type gets %s\(\backslash\)n"}, va->t.type);

   st2 = calloc(1, \textcolor{keyword}{sizeof} (Example\_Struct2));
   \_st2\_set(st2, atoi(v1), atoi(v2));
   va->data = st2;

   \textcolor{keywordflow}{return} va;
\}

\textcolor{keyword}{static} Example\_Variant *
\_variant\_3\_new(\textcolor{keyword}{const} \textcolor{keywordtype}{char} *v1)
\{
   Example\_Struct3 *st3;
   Example\_Variant *va = calloc(1, \textcolor{keyword}{sizeof}(Example\_Variant));
   \textcolor{keywordflow}{if} (!va)
     \{
        fprintf(
          stderr, \textcolor{stringliteral}{"ERROR: could not allocate an Example\_Variant struct.\(\backslash\)n"});
        \textcolor{keywordflow}{return} NULL;
     \}

   va = calloc(1, \textcolor{keyword}{sizeof} (Example\_Variant));
   va->t.type = eet\_mapping[2].name;
   st3 = calloc(1, \textcolor{keyword}{sizeof} (Example\_Struct3));
   \_st3\_set(st3, atoi(v1));
   va->data = st3;

   \textcolor{keywordflow}{return} va;
\}

\textcolor{keyword}{static} Example\_Lists *
\_data\_new(\textcolor{keywordtype}{void})
\{
   Example\_Lists *example\_lists = calloc(1, \textcolor{keyword}{sizeof}(Example\_Lists));
   \textcolor{keywordflow}{if} (!example\_lists)
     \{
        fprintf(stderr, \textcolor{stringliteral}{"ERROR: could not allocate a Example\_Lists struct.\(\backslash\)n"});
        \textcolor{keywordflow}{return} NULL;
     \}

   \textcolor{keywordflow}{return} example\_lists;
\} \textcolor{comment}{/* \_data\_new */}

\textcolor{keyword}{static} \textcolor{keywordtype}{void}
\_union\_free(Example\_Union *un)
\{
   \textcolor{keywordflow}{if} (un->type == EET\_STRUCT1)
     \{
        Example\_Struct1 *st1 = &(un->u.st1);
        \_string\_free(st1->s1);
     \}

   free(un);
\}

\textcolor{keyword}{static} \textcolor{keywordtype}{void}
\_variant\_free(Example\_Variant *va)
\{
   \textcolor{keywordflow}{if} (!strcmp(va->t.type, eet\_mapping[0].name))
     \{
        Example\_Struct1 *st1 = va->data;
        \_string\_free(st1->s1);
     \}

   free(va->data);
   free(va);
\}

\textcolor{keyword}{static} \textcolor{keywordtype}{void}
\_data\_free(Example\_Lists *cache)
\{
   Example\_Union *un;
   Example\_Variant *va;

   \hyperlink{group__Eina__List__Group_gae27a2c686a0a11693f9b06957c9bba83}{EINA\_LIST\_FREE}(cache->union\_list, un)
     \_union\_free(un);

   \hyperlink{group__Eina__List__Group_gae27a2c686a0a11693f9b06957c9bba83}{EINA\_LIST\_FREE}(cache->variant\_list, va)
     \_variant\_free(va);

   free(cache);
\} \textcolor{comment}{/* \_data\_free */}

static Example\_Lists *
\_data\_load(const \textcolor{keywordtype}{char} *filename)
\{
   Example\_Lists *data;
   \hyperlink{group__Eet__File__Group_ga8d9779184a9870c1a225f1f40c76e8a7}{Eet\_File} *ef = \hyperlink{group__Eet__File__Group_ga5f55956b860aa2c77af9b1a880c4c256}{eet\_open}(filename, \hyperlink{group__Eet__File__Group_ggaa8e1a7af50fefaf15eb2f69543d24998a416f7e9a76b8131a44bbeedb13060c81}{EET\_FILE\_MODE\_READ});
   \textcolor{keywordflow}{if} (!ef)
     \{
        fprintf(stderr, \textcolor{stringliteral}{"ERROR: could not open '%s' for read\(\backslash\)n"}, filename);
        \textcolor{keywordflow}{return} NULL;
     \}

   data = \hyperlink{group__Eet__Data__Group_ga4d1807cbbc448304f22a8808318a3429}{eet\_data\_read}(ef, \_lists\_descriptor, CACHE\_FILE\_ENTRY);
   \textcolor{keywordflow}{if} (!data)
     \{
        \hyperlink{group__Eet__File__Group_ga1675fef1f6012c1e02ae313d13dc3e03}{eet\_close}(ef);
        \textcolor{keywordflow}{return} NULL;
     \}

   \textcolor{keywordflow}{if} (\_cache\_file)
     \hyperlink{group__Eet__File__Group_ga1675fef1f6012c1e02ae313d13dc3e03}{eet\_close}(\_cache\_file);

   \_cache\_file = ef;
   \_cache\_dict = \hyperlink{group__Eet__File__Group_gab45ad39596d2fb54a88fda93e7fa0b0f}{eet\_dictionary\_get}(ef);

   \textcolor{keywordflow}{return} data;
\} \textcolor{comment}{/* \_data\_load */}

\textcolor{keyword}{static} \hyperlink{group__Eina__Types__Group_ga3fe0caf72e93b1bab1ca8ee3ccf3f226}{Eina\_Bool}
\_data\_save(\textcolor{keyword}{const} Example\_Lists *cache,
           \textcolor{keyword}{const} \textcolor{keywordtype}{char}          *filename)
\{
   \textcolor{keywordtype}{char} tmp[PATH\_MAX];
   \hyperlink{group__Eet__File__Group_ga8d9779184a9870c1a225f1f40c76e8a7}{Eet\_File} *ef;
   \hyperlink{group__Eina__Types__Group_ga3fe0caf72e93b1bab1ca8ee3ccf3f226}{Eina\_Bool} ret;
   \textcolor{keywordtype}{unsigned} \textcolor{keywordtype}{int} i, len;
   \textcolor{keyword}{struct }stat st;

   len = \hyperlink{group__Eina__String__Group_ga6bda31d2e1b6d2737b7fe1784780cd2f}{eina\_strlcpy}(tmp, filename, \textcolor{keyword}{sizeof}(tmp));
   \textcolor{keywordflow}{if} (len + 12 >= (\textcolor{keywordtype}{int})\textcolor{keyword}{sizeof}(tmp))
     \{
        fprintf(stderr, \textcolor{stringliteral}{"ERROR: file name is too big: %s\(\backslash\)n"}, filename);
        \textcolor{keywordflow}{return} \hyperlink{group__Eina__Types__Group_ga1feb115f8e9913e806e090d9bd5a7301}{EINA\_FALSE};
     \}

   i = 0;
   \textcolor{keywordflow}{do}
     \{
        snprintf(tmp + len, 12, \textcolor{stringliteral}{".%u"}, i);
        i++;
     \}
   \textcolor{keywordflow}{while} (stat(tmp, &st) == 0);

   ef = \hyperlink{group__Eet__File__Group_ga5f55956b860aa2c77af9b1a880c4c256}{eet\_open}(tmp, \hyperlink{group__Eet__File__Group_ggaa8e1a7af50fefaf15eb2f69543d24998a8f395f56fba48be007c65be51d799ee9}{EET\_FILE\_MODE\_WRITE});
   \textcolor{keywordflow}{if} (!ef)
     \{
        fprintf(stderr, \textcolor{stringliteral}{"ERROR: could not open '%s' for write\(\backslash\)n"}, tmp);
        \textcolor{keywordflow}{return} \hyperlink{group__Eina__Types__Group_ga1feb115f8e9913e806e090d9bd5a7301}{EINA\_FALSE};
     \}

   ret = \hyperlink{group__Eet__Data__Group_gac66d1c49e3490bc5d803982d833ff8aa}{eet\_data\_write}
       (ef, \_lists\_descriptor, CACHE\_FILE\_ENTRY, cache, \hyperlink{group__Eina__Types__Group_ga05c12dacc8b4058994df842b41be85fc}{EINA\_TRUE});

   \hyperlink{group__Eet__File__Group_ga1675fef1f6012c1e02ae313d13dc3e03}{eet\_close}(ef);

   \textcolor{keywordflow}{if} (ret)
     \{
        unlink(filename);
        \hyperlink{evil__stdio_8h_ab92755272ef649e2c6e74ab80def85be}{rename}(tmp, filename);
     \}

   \textcolor{keywordflow}{return} ret;
\} \textcolor{comment}{/* \_data\_save */}

\textcolor{keyword}{static} \textcolor{keywordtype}{void}
\_print\_union(\textcolor{keyword}{const} Example\_Union *un)
\{
   printf(\textcolor{stringliteral}{"\(\backslash\)t  |   type: %s'\(\backslash\)n"}, eet\_mapping[un->type - 1].name);

   \textcolor{keywordflow}{switch} (un->type)
     \{
      \textcolor{keywordflow}{case} EET\_STRUCT1:
        printf(\textcolor{stringliteral}{"\(\backslash\)t\(\backslash\)t  val1: %f\(\backslash\)n"}, un->u.st1.val1);
        printf(\textcolor{stringliteral}{"\(\backslash\)t\(\backslash\)t  stuff: %d\(\backslash\)n"}, un->u.st1.stuff);
        printf(\textcolor{stringliteral}{"\(\backslash\)t\(\backslash\)t  s1: %s\(\backslash\)n"}, un->u.st1.s1);
        \textcolor{keywordflow}{break};

      \textcolor{keywordflow}{case} EET\_STRUCT2:
        printf(\textcolor{stringliteral}{"\(\backslash\)t\(\backslash\)t  val1: %i\(\backslash\)n"}, un->u.st2.b1);
        printf(\textcolor{stringliteral}{"\(\backslash\)t\(\backslash\)t  stuff: %lli\(\backslash\)n"}, un->u.st2.v1);
        \textcolor{keywordflow}{break};

      \textcolor{keywordflow}{case} EET\_STRUCT3:
        printf(\textcolor{stringliteral}{"\(\backslash\)t\(\backslash\)t  val1: %i\(\backslash\)n"}, un->u.st3.body);
        \textcolor{keywordflow}{break};

      \textcolor{keywordflow}{case} EET\_BASIC\_FLOAT:
        printf(\textcolor{stringliteral}{"\(\backslash\)t\(\backslash\)t  float: %f\(\backslash\)n"}, un->u.f);
        \textcolor{keywordflow}{break};

      \textcolor{keywordflow}{case} EET\_BASIC\_STRING:
        printf(\textcolor{stringliteral}{"\(\backslash\)t\(\backslash\)t  string: %s\(\backslash\)n"}, un->u.string);
        \textcolor{keywordflow}{break};

      \textcolor{keywordflow}{default}:
        \textcolor{keywordflow}{return};
     \}
\}

\textcolor{keyword}{static} \textcolor{keywordtype}{void}
\_print\_variant(\textcolor{keyword}{const} Example\_Variant *va)
\{
   printf(\textcolor{stringliteral}{"\(\backslash\)t  |   type: %s'\(\backslash\)n"}, va->t.type);

   \textcolor{keywordflow}{switch} (va->t.type[2])
     \{
      \textcolor{keywordflow}{case} \textcolor{charliteral}{'1'}:
      \{
         Example\_Struct1 *st1 = va->data;

         printf(\textcolor{stringliteral}{"\(\backslash\)t\(\backslash\)t  val1: %f\(\backslash\)n"}, st1->val1);
         printf(\textcolor{stringliteral}{"\(\backslash\)t\(\backslash\)t  stuff: %d\(\backslash\)n"}, st1->stuff);
         printf(\textcolor{stringliteral}{"\(\backslash\)t\(\backslash\)t  s1: %s\(\backslash\)n"}, st1->s1);
      \}
      \textcolor{keywordflow}{break};

      \textcolor{keywordflow}{case} \textcolor{charliteral}{'2'}:
      \{
         Example\_Struct2 *st2 = va->data;

         printf(\textcolor{stringliteral}{"\(\backslash\)t\(\backslash\)t  val1: %i\(\backslash\)n"}, st2->b1);
         printf(\textcolor{stringliteral}{"\(\backslash\)t\(\backslash\)t  stuff: %lli\(\backslash\)n"}, st2->v1);
      \}
      \textcolor{keywordflow}{break};

      \textcolor{keywordflow}{case} \textcolor{charliteral}{'3'}:
      \{
         Example\_Struct3 *st3 = va->data;

         printf(\textcolor{stringliteral}{"\(\backslash\)t\(\backslash\)t  val1: %i\(\backslash\)n"}, st3->body);
      \}
      \textcolor{keywordflow}{break};

      \textcolor{keywordflow}{default}:
        \textcolor{keywordflow}{return};
     \}
\}

\textcolor{keywordtype}{int}
main(\textcolor{keywordtype}{int}   argc,
     \textcolor{keywordtype}{char} *argv[])
\{
   Example\_Lists *data\_lists;
   \textcolor{keywordtype}{int} ret = 0;

   \textcolor{keywordflow}{if} (argc < 3)
     \{
        fprintf(stderr,
                \textcolor{stringliteral}{"Usage:\(\backslash\)n\(\backslash\)t%s <input> <output> [action action-params]\(\backslash\)n\(\backslash\)n"}
                \textcolor{stringliteral}{"where actions and their parameters are:\(\backslash\)n"}
                \textcolor{stringliteral}{"\(\backslash\)tunion <type> [fields]\(\backslash\)n"}
                \textcolor{stringliteral}{"\(\backslash\)tvariant <type> [fields]\(\backslash\)n"}
                \textcolor{stringliteral}{"\(\backslash\)n"},
                argv[0]);
        \textcolor{keywordflow}{return} -1;
     \}

   \hyperlink{group__Eina__Main__Group_gabf448ada5bc81a07342b66c6f818ee5e}{eina\_init}();
   \hyperlink{group__Eet__Group_ga9903687bfa20fe9a9e59d4c1d213e89a}{eet\_init}();
   \_data\_descriptors\_init();

   data\_lists = \_data\_load(argv[1]);
   \textcolor{keywordflow}{if} (!data\_lists)
     \{
        printf(\textcolor{stringliteral}{"Creating new data lists.\(\backslash\)n"});
        data\_lists = \_data\_new();
        \textcolor{keywordflow}{if} (!data\_lists)
          \{
             ret = -2;
             \textcolor{keywordflow}{goto} end;
          \}
     \}

   \textcolor{keywordflow}{if} (argc > 3)
     \{
        \textcolor{keywordflow}{if} (strcmp(argv[3], \textcolor{stringliteral}{"union"}) == 0)
          \{
             \textcolor{keywordflow}{if} (argc > 4)
               \{
                  \textcolor{keywordtype}{int} type = atoi(argv[4]);
                  Example\_Union *un;

                  \textcolor{keywordflow}{if} (type < EET\_STRUCT1 || type > EET\_BASIC\_STRING)
                    \{
                       fprintf(stderr,
                               \textcolor{stringliteral}{"ERROR: invalid type parameter (%s).\(\backslash\)n"},
                               argv[4]);
                       \textcolor{keywordflow}{goto} cont;
                    \}

                  \textcolor{keywordflow}{switch} (type)
                    \{
                     \textcolor{keywordflow}{case} 1:
                       \textcolor{keywordflow}{if} (argc != 8)
                         \{
                            fprintf(
                              stderr, \textcolor{stringliteral}{"ERROR: wrong number of parameters"}
                                      \textcolor{stringliteral}{" (%d).\(\backslash\)n"}, argc);
                            \textcolor{keywordflow}{goto} cont;
                         \}

                       un = \_union\_1\_new(
                           argv[5], argv[6], argv[7]);
                       \textcolor{keywordflow}{if} (!un)
                         \{
                            fprintf(
                              stderr, \textcolor{stringliteral}{"ERROR: could not create the "}
                                      \textcolor{stringliteral}{"requested union.\(\backslash\)n"});
                            \textcolor{keywordflow}{goto} cont;
                         \}
                       data\_lists->union\_list =
                         \hyperlink{group__Eina__List__Group_ga92ec14d1a1040a361c4d8cd0ab7b0ecc}{eina\_list\_append}(data\_lists->union\_list, un);
                       \textcolor{keywordflow}{break};

                     \textcolor{keywordflow}{case} 2:
                       \textcolor{keywordflow}{if} (argc != 7)
                         \{
                            fprintf(
                              stderr, \textcolor{stringliteral}{"ERROR: wrong number of parameters"}
                                      \textcolor{stringliteral}{" (%d).\(\backslash\)n"}, argc);
                            \textcolor{keywordflow}{goto} cont;
                         \}

                       un = \_union\_2\_new(argv[5], argv[6]);
                       \textcolor{keywordflow}{if} (!un)
                         \{
                            fprintf(
                              stderr, \textcolor{stringliteral}{"ERROR: could not create the "}
                                      \textcolor{stringliteral}{"requested union.\(\backslash\)n"});
                            \textcolor{keywordflow}{goto} cont;
                         \}
                       data\_lists->union\_list =
                         \hyperlink{group__Eina__List__Group_ga92ec14d1a1040a361c4d8cd0ab7b0ecc}{eina\_list\_append}(data\_lists->union\_list, un);
                       \textcolor{keywordflow}{break};

                     \textcolor{keywordflow}{case} 3:
                       \textcolor{keywordflow}{if} (argc != 6)
                         \{
                            fprintf(
                              stderr, \textcolor{stringliteral}{"ERROR: wrong number of parameters"}
                                      \textcolor{stringliteral}{" (%d).\(\backslash\)n"}, argc);
                            \textcolor{keywordflow}{goto} cont;
                         \}

                       un = \_union\_3\_new(argv[5]);
                       \textcolor{keywordflow}{if} (!un)
                         \{
                            fprintf(
                              stderr, \textcolor{stringliteral}{"ERROR: could not create the "}
                                      \textcolor{stringliteral}{"requested union.\(\backslash\)n"});
                            \textcolor{keywordflow}{goto} cont;
                         \}
                       data\_lists->union\_list =
                         \hyperlink{group__Eina__List__Group_ga92ec14d1a1040a361c4d8cd0ab7b0ecc}{eina\_list\_append}(data\_lists->union\_list, un);
                       \textcolor{keywordflow}{break};

                     \textcolor{keywordflow}{case} EET\_BASIC\_FLOAT:
                       \textcolor{keywordflow}{if} (argc != 6)
                         \{
                            fprintf(
                              stderr, \textcolor{stringliteral}{"ERROR: wrong number of parameters"}
                                      \textcolor{stringliteral}{" (%d).\(\backslash\)n"}, argc);
                            \textcolor{keywordflow}{goto} cont;
                         \}

                       un = \_union\_float\_new(argv[5]);
                       \textcolor{keywordflow}{if} (!un)
                         \{
                            fprintf(
                              stderr, \textcolor{stringliteral}{"ERROR: could not create the "}
                                      \textcolor{stringliteral}{"requested union.\(\backslash\)n"});
                            \textcolor{keywordflow}{goto} cont;
                         \}
                       data\_lists->union\_list =
                         \hyperlink{group__Eina__List__Group_ga92ec14d1a1040a361c4d8cd0ab7b0ecc}{eina\_list\_append}(data\_lists->union\_list, un);
                       \textcolor{keywordflow}{break};

                     \textcolor{keywordflow}{case} EET\_BASIC\_STRING:
                       \textcolor{keywordflow}{if} (argc != 6)
                         \{
                            fprintf(
                              stderr, \textcolor{stringliteral}{"ERROR: wrong number of parameters"}
                                      \textcolor{stringliteral}{" (%d).\(\backslash\)n"}, argc);
                            \textcolor{keywordflow}{goto} cont;
                         \}

                       un = \_union\_string\_new(argv[5]);
                       \textcolor{keywordflow}{if} (!un)
                         \{
                            fprintf(
                              stderr, \textcolor{stringliteral}{"ERROR: could not create the "}
                                      \textcolor{stringliteral}{"requested union.\(\backslash\)n"});
                            \textcolor{keywordflow}{goto} cont;
                         \}
                       data\_lists->union\_list =
                         \hyperlink{group__Eina__List__Group_ga92ec14d1a1040a361c4d8cd0ab7b0ecc}{eina\_list\_append}(data\_lists->union\_list, un);
                       \textcolor{keywordflow}{break};

                     \textcolor{keywordflow}{default}:
                       fprintf(
                         stderr, \textcolor{stringliteral}{"ERROR: bad type of of struct passed\(\backslash\)n"});
                       \textcolor{keywordflow}{goto} cont;
                    \}
               \}
             \textcolor{keywordflow}{else}
               fprintf(stderr,
                       \textcolor{stringliteral}{"ERROR: wrong number of parameters (%d).\(\backslash\)n"},
                       argc);
          \}
        \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (strcmp(argv[3], \textcolor{stringliteral}{"variant"}) == 0)
          \{
             \textcolor{keywordflow}{if} (argc > 4)
               \{
                  \textcolor{keywordtype}{int} type = atoi(argv[4]);
                  Example\_Variant *va;

                  \textcolor{keywordflow}{if} (type < EET\_STRUCT1 || type > EET\_STRUCT3)
                    \{
                       fprintf(stderr,
                               \textcolor{stringliteral}{"ERROR: invalid type parameter (%s).\(\backslash\)n"},
                               argv[4]);
                       \textcolor{keywordflow}{goto} cont;
                    \}

                  \textcolor{keywordflow}{switch} (type)
                    \{
                     \textcolor{keywordflow}{case} 1:
                       \textcolor{keywordflow}{if} (argc != 8)
                         \{
                            fprintf(
                              stderr, \textcolor{stringliteral}{"ERROR: wrong number of parameters"}
                                      \textcolor{stringliteral}{" (%d).\(\backslash\)n"}, argc);
                            \textcolor{keywordflow}{goto} cont;
                         \}

                       va = \_variant\_1\_new(
                           argv[5], argv[6], argv[7]);
                       \textcolor{keywordflow}{if} (!va)
                         \{
                            fprintf(
                              stderr, \textcolor{stringliteral}{"ERROR: could not create the "}
                                      \textcolor{stringliteral}{"requested variant.\(\backslash\)n"});
                            \textcolor{keywordflow}{goto} cont;
                         \}
                       data\_lists->variant\_list =
                         \hyperlink{group__Eina__List__Group_ga92ec14d1a1040a361c4d8cd0ab7b0ecc}{eina\_list\_append}(data\_lists->variant\_list, va);
                       \textcolor{keywordflow}{break};

                     \textcolor{keywordflow}{case} 2:
                       \textcolor{keywordflow}{if} (argc != 7)
                         \{
                            fprintf(
                              stderr, \textcolor{stringliteral}{"ERROR: wrong number of parameters"}
                                      \textcolor{stringliteral}{" (%d).\(\backslash\)n"}, argc);
                            \textcolor{keywordflow}{goto} cont;
                         \}

                       va = \_variant\_2\_new(argv[5], argv[6]);
                       \textcolor{keywordflow}{if} (!va)
                         \{
                            fprintf(
                              stderr, \textcolor{stringliteral}{"ERROR: could not create the "}
                                      \textcolor{stringliteral}{"requested variant.\(\backslash\)n"});
                            \textcolor{keywordflow}{goto} cont;
                         \}
                       data\_lists->variant\_list =
                         \hyperlink{group__Eina__List__Group_ga92ec14d1a1040a361c4d8cd0ab7b0ecc}{eina\_list\_append}(data\_lists->variant\_list, va);
                       \textcolor{keywordflow}{break};

                     \textcolor{keywordflow}{case} 3:
                       \textcolor{keywordflow}{if} (argc != 6)
                         \{
                            fprintf(
                              stderr, \textcolor{stringliteral}{"ERROR: wrong number of parameters"}
                                      \textcolor{stringliteral}{" (%d).\(\backslash\)n"}, argc);
                            \textcolor{keywordflow}{goto} cont;
                         \}

                       va = \_variant\_3\_new(argv[5]);
                       \textcolor{keywordflow}{if} (!va)
                         \{
                            fprintf(
                              stderr, \textcolor{stringliteral}{"ERROR: could not create the "}
                                      \textcolor{stringliteral}{"requested variant.\(\backslash\)n"});
                            \textcolor{keywordflow}{goto} cont;
                         \}
                       data\_lists->variant\_list =
                         \hyperlink{group__Eina__List__Group_ga92ec14d1a1040a361c4d8cd0ab7b0ecc}{eina\_list\_append}(data\_lists->variant\_list, va);
                       \textcolor{keywordflow}{break};

                     \textcolor{keywordflow}{default}:
                       fprintf(
                         stderr, \textcolor{stringliteral}{"ERROR: bad type of of struct passed\(\backslash\)n"});
                       \textcolor{keywordflow}{goto} cont;
                    \}
               \}
             \textcolor{keywordflow}{else}
               fprintf(stderr,
                       \textcolor{stringliteral}{"ERROR: wrong number of parameters (%d).\(\backslash\)n"},
                       argc);
          \}
        \textcolor{keywordflow}{else}
          fprintf(stderr, \textcolor{stringliteral}{"ERROR: unknown action '%s'\(\backslash\)n"}, argv[3]);
     \}

cont:
   printf(\textcolor{stringliteral}{"Cached data:\(\backslash\)n"});

   printf(\textcolor{stringliteral}{"\(\backslash\)tstats: unions=%u, variants=%u\(\backslash\)n"},
          \hyperlink{group__Eina__List__Group_ga301729054a498a2df09a5f1dd760697e}{eina\_list\_count}(data\_lists->union\_list),
          \hyperlink{group__Eina__List__Group_ga301729054a498a2df09a5f1dd760697e}{eina\_list\_count}(data\_lists->variant\_list));

   \textcolor{keywordflow}{if} (\hyperlink{group__Eina__List__Group_ga301729054a498a2df09a5f1dd760697e}{eina\_list\_count}(data\_lists->union\_list))
     \{
        \textcolor{keyword}{const} \hyperlink{struct__Eina__List}{Eina\_List} *l;
        \textcolor{keyword}{const} Example\_Union *un;
        printf(\textcolor{stringliteral}{"\(\backslash\)t  * union list:\(\backslash\)n"});

        \hyperlink{group__Eina__List__Group_gad02f746a08ee0b12b7ed66d4bc0d71d8}{EINA\_LIST\_FOREACH}(data\_lists->union\_list, l, un)
          \{
             \_print\_union(un);
          \}
     \}

   \textcolor{keywordflow}{if} (\hyperlink{group__Eina__List__Group_ga301729054a498a2df09a5f1dd760697e}{eina\_list\_count}(data\_lists->variant\_list))
     \{
        \textcolor{keyword}{const} \hyperlink{struct__Eina__List}{Eina\_List} *l;
        \textcolor{keyword}{const} Example\_Variant *un;
        printf(\textcolor{stringliteral}{"\(\backslash\)t  * variant list:\(\backslash\)n"});

        \hyperlink{group__Eina__List__Group_gad02f746a08ee0b12b7ed66d4bc0d71d8}{EINA\_LIST\_FOREACH}(data\_lists->variant\_list, l, un)
          \{
             \_print\_variant(un);
          \}
     \}

   printf(\textcolor{stringliteral}{"\(\backslash\)n"});

   \textcolor{keywordflow}{if} (!\_data\_save(data\_lists, argv[2]))
     ret = -3;

   \_data\_free(data\_lists);

end:
   \textcolor{keywordflow}{if} (\_cache\_file)
     \hyperlink{group__Eet__File__Group_ga1675fef1f6012c1e02ae313d13dc3e03}{eet\_close}(\_cache\_file);
   \_data\_descriptors\_shutdown();
   \hyperlink{group__Eet__Group_gacbc7583179399d3b3e7b003e911f866f}{eet\_shutdown}();
   \hyperlink{group__Eina__Main__Group_ga6741fcaba116e31e96ce14dcfa03f568}{eina\_shutdown}();

   \textcolor{keywordflow}{return} ret;
\} \textcolor{comment}{/* main */}

\end{DoxyCodeInclude}
 