Ecore Library Public A\+P\+I Calls

These routines are used for Ecore Library interaction

\begin{DoxyDate}{Date}
2000 (created)
\end{DoxyDate}
\hypertarget{eina_cxx_main_toc}{}\section{Table of Contents}\label{eina_cxx_main_toc}
\begin{DoxyItemize}
\item \hyperlink{ecore_main_ecore_main_intro}{Introduction} \item \hyperlink{ecore_main_ecore_main_compiling}{How to compile} \item \hyperlink{ecore_main_ecore_main_next_steps}{Next Steps} \item \hyperlink{ecore_main_ecore_main_intro_example}{Introductory Examples}\end{DoxyItemize}
\hypertarget{ecore_main_ecore_main_intro}{}\section{Introduction}\label{ecore_main_ecore_main_intro}
Ecore is a library of convenience functions. A brief explanation of how to use it can be found in \hyperlink{Ecore_Main_Loop_Page}{The Ecore Main Loop}.

The Ecore library provides the following modules\+: \begin{DoxyItemize}
\item \hyperlink{group__Ecore__Init__Group}{Ecore initialization, shutdown functions and reset on fork.} \item \hyperlink{group__Ecore__Getopt__Group}{Ecore Getopt} \item \hyperlink{group__Ecore__Main__Loop__Group}{Ecore main loop} \item \hyperlink{group__Ecore__System__Events}{System Events} \item \hyperlink{group__Ecore__Time__Group}{Ecore time functions} \item \hyperlink{group__Ecore__Thread__Group}{Ecore Thread functions} \item \hyperlink{group__Ecore__Pipe__Group}{Pipe wrapper} \item \hyperlink{group__Ecore__Application__Group}{Ecore Application functions} \item \hyperlink{group__Ecore__Throttle__Group}{Ecore Throttle functions} \item \hyperlink{group__Ecore__Job__Group}{Ecore Job functions} \item \hyperlink{group__Ecore__File__Group}{Ecore\+\_\+\+File -\/ Files and directories convenience functions} \item \hyperlink{group__Ecore__Con__Group}{Ecore\+\_\+\+Con -\/ Connection functions} \item \hyperlink{group__Ecore__Evas__Group}{Ecore\+\_\+\+Evas wrapper/helper set of functions} \item \hyperlink{group__Ecore__FB__Group}{Ecore\+\_\+\+F\+B -\/ Frame buffer convenience functions.} \item \hyperlink{group__Ecore__Input__Group}{Ecore Input} \item \hyperlink{group__Ecore__IMF__Lib__Group}{Ecore\+\_\+\+I\+M\+F -\/ Ecore Input Method Library Functions} \item \hyperlink{group__Ecore__IPC__Group}{Ecore\+\_\+\+I\+P\+C -\/ Ecore inter-\/process communication functions.} \item \hyperlink{Ecore__X_8h}{Ecore\+\_\+\+X -\/ X Windows System wrapper. } \item \hyperlink{group__Ecore__Win32__Group}{Ecore\+\_\+\+Win32 library} \item \hyperlink{group__Ecore__Audio__Group}{Ecore\+\_\+\+Audio -\/ Convenience audio A\+P\+I} \item \hyperlink{group__Ecore__Avahi__Group}{Ecore\+\_\+\+Avahi -\/ Avahi main loop integration function.} \item \hyperlink{group__Ecore__Drm__Group}{Ecore\+\_\+\+Drm -\/ Drm Integration} \item \hyperlink{group__Ecore__Wl__Group}{Ecore\+\_\+\+Wayland -\/ Wayland integration}\end{DoxyItemize}
For more info on Ecore usage, there are these \hyperlink{ecore_examples}{Ecore Examples}.\hypertarget{ecore_main_ecore_main_compiling}{}\section{How to compile}\label{ecore_main_ecore_main_compiling}
Ecore is a library your application links to. The procedure for this is very simple. You simply have to compile your application with the appropriate compiler flags that the {\ttfamily pkg-\/config} script outputs. Note that each module is separate in pkg-\/config. For example using Ecore\+\_\+\+Evas\+\_\+\+Group\+:

Compiling C or C++ files into object files\+:

\begin{DoxyVerb}gcc -c -o main.o main.c `pkg-config --cflags ecore ecore-evas`
\end{DoxyVerb}


Linking object files into a binary executable\+:

\begin{DoxyVerb}gcc -o my_application main.o `pkg-config --libs ecore ecore-evas`
\end{DoxyVerb}


See \hyperlink{pkgconfig}{pkgconfig}\hypertarget{ecore_main_ecore_main_next_steps}{}\section{Next Steps}\label{ecore_main_ecore_main_next_steps}
After you understood what Ecore is and installed it in your system you should proceed understanding the programming interface. We'd recommend you to take a while to learn \hyperlink{group__Eina}{Eina} as it is very convenient and optimized, and Ecore uses it extensively.

Recommended reading\+:

\begin{DoxyItemize}
\item \hyperlink{group__Ecore__Timer__Group}{Ecore Timer functions} \item \hyperlink{group__Ecore__Idle__Group}{Ecore Idle functions} \item \hyperlink{group__Ecore__FD__Handler__Group}{File Descriptor Handling Functions} \item \hyperlink{group__Ecore__Event__Group}{Ecore Event functions} \item \hyperlink{group__Ecore__Exe__Group}{Process Spawning Functions} \item \hyperlink{group__Ecore__Animator__Group}{Ecore Animator functions} \item \hyperlink{group__Ecore__Poller__Group}{Ecore Poll functions}\end{DoxyItemize}
\hypertarget{ecore_main_ecore_main_intro_example}{}\section{Introductory Examples}\label{ecore_main_ecore_main_intro_example}

\begin{DoxyCodeInclude}
\textcolor{comment}{//Compile with:}
\textcolor{comment}{// gcc -o ecore\_timer\_example ecore\_timer\_example.c `pkg-config --libs --cflags ecore`}

\textcolor{preprocessor}{#include <Ecore.h>}
\textcolor{preprocessor}{#include <unistd.h>}

\textcolor{preprocessor}{#define TIMEOUT\_1 1.0 // interval for timer1}
\textcolor{preprocessor}{#define TIMEOUT\_2 3.0 // timer2 - delay timer1}
\textcolor{preprocessor}{#define TIMEOUT\_3 8.2 // timer3 - pause timer1}
\textcolor{preprocessor}{#define TIMEOUT\_4 11.0 // timer4 - resume timer1}
\textcolor{preprocessor}{#define TIMEOUT\_5 14.0 // timer5 - change interval of timer1}
\textcolor{preprocessor}{#define TIMEOUT\_6 18.0 // top timer1 and start timer7 and timer8 with changed precision}
\textcolor{preprocessor}{#define TIMEOUT\_7 1.1 // interval for timer7}
\textcolor{preprocessor}{#define TIMEOUT\_8 1.2 // interval for timer8}
\textcolor{preprocessor}{#define DELAY\_1   3.0 // delay time for timer1 - used by timer2}
\textcolor{preprocessor}{#define INTERVAL1 2.0 // new interval for timer1 - used by timer5}

\textcolor{keyword}{static} \textcolor{keywordtype}{double} \_initial\_time = 0;

\textcolor{keyword}{struct }context   \textcolor{comment}{// helper struct to give some context to the callbacks}
\{
   \hyperlink{group__Ecore__Timer__Group_gaf96ffb609956658ec038e54bd39f46f0}{Ecore\_Timer} *timer1;
   \hyperlink{group__Ecore__Timer__Group_gaf96ffb609956658ec038e54bd39f46f0}{Ecore\_Timer} *timer2;
   \hyperlink{group__Ecore__Timer__Group_gaf96ffb609956658ec038e54bd39f46f0}{Ecore\_Timer} *timer3;
   \hyperlink{group__Ecore__Timer__Group_gaf96ffb609956658ec038e54bd39f46f0}{Ecore\_Timer} *timer4;
   \hyperlink{group__Ecore__Timer__Group_gaf96ffb609956658ec038e54bd39f46f0}{Ecore\_Timer} *timer5;
   \hyperlink{group__Ecore__Timer__Group_gaf96ffb609956658ec038e54bd39f46f0}{Ecore\_Timer} *timer6;
   \hyperlink{group__Ecore__Timer__Group_gaf96ffb609956658ec038e54bd39f46f0}{Ecore\_Timer} *timer7;
   \hyperlink{group__Ecore__Timer__Group_gaf96ffb609956658ec038e54bd39f46f0}{Ecore\_Timer} *timer8;
\};

\textcolor{keyword}{static} \textcolor{keywordtype}{double}
\_get\_current\_time(\textcolor{keywordtype}{void})
\{
   \textcolor{keywordflow}{return} \hyperlink{group__Ecore__Time__Group_ga98f2439b5d3e7114a75bfe2f0c22c4e9}{ecore\_time\_get}() - \_initial\_time;
\}

\textcolor{keyword}{static} \hyperlink{group__Eina__Types__Group_ga3fe0caf72e93b1bab1ca8ee3ccf3f226}{Eina\_Bool}
\_timer1\_cb(\textcolor{keywordtype}{void} *data EINA\_UNUSED)
\{
   printf(\textcolor{stringliteral}{"Timer1 expired after %0.3f seconds.\(\backslash\)n"}, \_get\_current\_time());
   \textcolor{keywordflow}{return} \hyperlink{group__Ecore__Main__Loop__Group_ga1ee9db07f9a46a8b20fb83e1c6dbed09}{ECORE\_CALLBACK\_RENEW};
\}

\textcolor{keyword}{static} \hyperlink{group__Eina__Types__Group_ga3fe0caf72e93b1bab1ca8ee3ccf3f226}{Eina\_Bool}
\_timer2\_cb(\textcolor{keywordtype}{void} *data)
\{
   \textcolor{keyword}{struct }context *ctxt = data;
   printf(\textcolor{stringliteral}{"Timer2 expired after %0.3f seconds. "}
          \textcolor{stringliteral}{"Adding delay of %0.3f seconds to timer1.\(\backslash\)n"},
          \_get\_current\_time(), DELAY\_1);

   ecore\_timer\_delay(ctxt->timer1, DELAY\_1);

   ctxt->timer2 = NULL;
   \textcolor{keywordflow}{return} \hyperlink{group__Ecore__Main__Loop__Group_gae0c653baad8836232c0dc27f91f875d6}{ECORE\_CALLBACK\_CANCEL};
\}

\textcolor{keyword}{static} \hyperlink{group__Eina__Types__Group_ga3fe0caf72e93b1bab1ca8ee3ccf3f226}{Eina\_Bool}
\_timer3\_cb(\textcolor{keywordtype}{void} *data)
\{
   \textcolor{keyword}{struct }context *ctxt = data;
   printf(\textcolor{stringliteral}{"Timer3 expired after %0.3f seconds. "}
          \textcolor{stringliteral}{"Freezing timer1.\(\backslash\)n"}, \_get\_current\_time());

   ecore\_timer\_freeze(ctxt->timer1);

   ctxt->timer3 = NULL;
   \textcolor{keywordflow}{return} \hyperlink{group__Ecore__Main__Loop__Group_gae0c653baad8836232c0dc27f91f875d6}{ECORE\_CALLBACK\_CANCEL};
\}

\textcolor{keyword}{static} \hyperlink{group__Eina__Types__Group_ga3fe0caf72e93b1bab1ca8ee3ccf3f226}{Eina\_Bool}
\_timer4\_cb(\textcolor{keywordtype}{void} *data)
\{
   \textcolor{keyword}{struct }context *ctxt = data;
   printf(\textcolor{stringliteral}{"Timer4 expired after %0.3f seconds. "}
          \textcolor{stringliteral}{"Resuming timer1, which has %0.3f seconds left to expire.\(\backslash\)n"},
          \_get\_current\_time(), ecore\_timer\_pending\_get(ctxt->timer1));

   ecore\_timer\_thaw(ctxt->timer1);

   ctxt->timer4 = NULL;
   \textcolor{keywordflow}{return} \hyperlink{group__Ecore__Main__Loop__Group_gae0c653baad8836232c0dc27f91f875d6}{ECORE\_CALLBACK\_CANCEL};
\}

\textcolor{keyword}{static} \hyperlink{group__Eina__Types__Group_ga3fe0caf72e93b1bab1ca8ee3ccf3f226}{Eina\_Bool}
\_timer5\_cb(\textcolor{keywordtype}{void} *data)
\{
   \textcolor{keyword}{struct }context *ctxt = data;
   \textcolor{keywordtype}{double} interval = ecore\_timer\_interval\_get(ctxt->timer1);

   printf(\textcolor{stringliteral}{"Timer5 expired after %0.3f seconds. "}
          \textcolor{stringliteral}{"Changing interval of timer1 from %0.3f to %0.3f seconds.\(\backslash\)n"},
          \_get\_current\_time(), interval, INTERVAL1);

   ecore\_timer\_interval\_set(ctxt->timer1, INTERVAL1);

   ctxt->timer5 = NULL;
   \textcolor{keywordflow}{return} \hyperlink{group__Ecore__Main__Loop__Group_gae0c653baad8836232c0dc27f91f875d6}{ECORE\_CALLBACK\_CANCEL};
\}

\textcolor{keyword}{static} \hyperlink{group__Eina__Types__Group_ga3fe0caf72e93b1bab1ca8ee3ccf3f226}{Eina\_Bool}
\_timer7\_cb(\textcolor{keywordtype}{void} *data)
\{
   \textcolor{keyword}{struct }context *ctxt = data;
   printf(\textcolor{stringliteral}{"Timer7 expired after %0.3f seconds.\(\backslash\)n"}, \_get\_current\_time());

   ctxt->timer7 = NULL;
   \textcolor{keywordflow}{return} \hyperlink{group__Ecore__Main__Loop__Group_gae0c653baad8836232c0dc27f91f875d6}{ECORE\_CALLBACK\_CANCEL};
\}

\textcolor{keyword}{static} \hyperlink{group__Eina__Types__Group_ga3fe0caf72e93b1bab1ca8ee3ccf3f226}{Eina\_Bool}
\_timer8\_cb(\textcolor{keywordtype}{void} *data)
\{
   \textcolor{keyword}{struct }context *ctxt = data;
   printf(\textcolor{stringliteral}{"Timer8 expired after %0.3f seconds.\(\backslash\)n"}, \_get\_current\_time());

   ctxt->timer8 = NULL;
   \textcolor{keywordflow}{return} \hyperlink{group__Ecore__Main__Loop__Group_gae0c653baad8836232c0dc27f91f875d6}{ECORE\_CALLBACK\_CANCEL};
\}

\textcolor{keyword}{static} \hyperlink{group__Eina__Types__Group_ga3fe0caf72e93b1bab1ca8ee3ccf3f226}{Eina\_Bool}
\_timer6\_cb(\textcolor{keywordtype}{void} *data)
\{
   \textcolor{keyword}{struct }context *ctxt = data;
   printf(\textcolor{stringliteral}{"Timer6 expired after %0.3f seconds.\(\backslash\)n"}, \_get\_current\_time());

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

   \hyperlink{group__Ecore__Timer__Group_gaba2b599c7aabe3ab664dc3d47f62a33a}{ecore\_timer\_del}(ctxt->timer1);
   ctxt->timer1 = NULL;

   printf(\textcolor{stringliteral}{"Starting timer7 (%0.3fs) and timer8 (%0.3fs).\(\backslash\)n"},
          TIMEOUT\_7, TIMEOUT\_8);

   ctxt->timer7 = ecore\_timer\_add(TIMEOUT\_7, \_timer7\_cb, ctxt);
   ctxt->timer8 = ecore\_timer\_add(TIMEOUT\_8, \_timer8\_cb, ctxt);

   \hyperlink{group__Ecore__Timer__Group_gaf7d0f56778f5614c63a69d4cfbee7b3d}{ecore\_timer\_precision\_set}(0.2);

   ctxt->timer6 = NULL;
   \textcolor{keywordflow}{return} \hyperlink{group__Ecore__Main__Loop__Group_gae0c653baad8836232c0dc27f91f875d6}{ECORE\_CALLBACK\_CANCEL};
\}

\textcolor{keywordtype}{int}
main(\textcolor{keywordtype}{void})
\{
   \textcolor{keyword}{struct }context ctxt = \{0\};

   \textcolor{keywordflow}{if} (!\hyperlink{group__Ecore__Init__Group_ga77757609684a2c922dc5ec398274751b}{ecore\_init}())
     \{
        printf(\textcolor{stringliteral}{"ERROR: Cannot init Ecore!\(\backslash\)n"});
        \textcolor{keywordflow}{return} -1;
     \}

   \_initial\_time = \hyperlink{group__Ecore__Time__Group_ga98f2439b5d3e7114a75bfe2f0c22c4e9}{ecore\_time\_get}();

   ctxt.timer1 = ecore\_timer\_add(TIMEOUT\_1, \_timer1\_cb, &ctxt);
   ctxt.timer2 = ecore\_timer\_add(TIMEOUT\_2, \_timer2\_cb, &ctxt);
   ctxt.timer3 = ecore\_timer\_add(TIMEOUT\_3, \_timer3\_cb, &ctxt);
   ctxt.timer4 = ecore\_timer\_add(TIMEOUT\_4, \_timer4\_cb, &ctxt);
   ctxt.timer5 = ecore\_timer\_add(TIMEOUT\_5, \_timer5\_cb, &ctxt);
   ctxt.timer6 = ecore\_timer\_add(TIMEOUT\_6, \_timer6\_cb, &ctxt);

   printf(\textcolor{stringliteral}{"start the main loop.\(\backslash\)n"});

   \hyperlink{group__Ecore__Main__Loop__Group_gaf103b9f668bb3e4fed12e52c6180132d}{ecore\_main\_loop\_begin}();

   \textcolor{keywordflow}{if} (ctxt.timer1)
     \hyperlink{group__Ecore__Timer__Group_gaba2b599c7aabe3ab664dc3d47f62a33a}{ecore\_timer\_del}(ctxt.timer1);
   \textcolor{keywordflow}{if} (ctxt.timer2)
     \hyperlink{group__Ecore__Timer__Group_gaba2b599c7aabe3ab664dc3d47f62a33a}{ecore\_timer\_del}(ctxt.timer2);
   \textcolor{keywordflow}{if} (ctxt.timer3)
     \hyperlink{group__Ecore__Timer__Group_gaba2b599c7aabe3ab664dc3d47f62a33a}{ecore\_timer\_del}(ctxt.timer3);
   \textcolor{keywordflow}{if} (ctxt.timer4)
     \hyperlink{group__Ecore__Timer__Group_gaba2b599c7aabe3ab664dc3d47f62a33a}{ecore\_timer\_del}(ctxt.timer4);
   \textcolor{keywordflow}{if} (ctxt.timer5)
     \hyperlink{group__Ecore__Timer__Group_gaba2b599c7aabe3ab664dc3d47f62a33a}{ecore\_timer\_del}(ctxt.timer5);
   \textcolor{keywordflow}{if} (ctxt.timer6)
     \hyperlink{group__Ecore__Timer__Group_gaba2b599c7aabe3ab664dc3d47f62a33a}{ecore\_timer\_del}(ctxt.timer6);
   \textcolor{keywordflow}{if} (ctxt.timer7)
     \hyperlink{group__Ecore__Timer__Group_gaba2b599c7aabe3ab664dc3d47f62a33a}{ecore\_timer\_del}(ctxt.timer7);
   \textcolor{keywordflow}{if} (ctxt.timer8)
     \hyperlink{group__Ecore__Timer__Group_gaba2b599c7aabe3ab664dc3d47f62a33a}{ecore\_timer\_del}(ctxt.timer8);

   \hyperlink{group__Ecore__Init__Group_ga768298b932f18d7e7593a447493e5cde}{ecore\_shutdown}();

   \textcolor{keywordflow}{return} 0;
\}

\end{DoxyCodeInclude}


More examples can be found at \hyperlink{ecore_examples}{Ecore Examples}. 