allow tagging of exe's

SVN revision: 17032
This commit is contained in:
Carsten Haitzler 2005-09-28 13:09:09 +00:00
parent 0fc27f512b
commit ea6d0fb19c
3 changed files with 57 additions and 10 deletions

View File

@ -175,16 +175,18 @@ extern "C" {
#ifndef WIN32
EAPI Ecore_Exe *ecore_exe_run(const char *exe_cmd, const void *data);
EAPI void *ecore_exe_free(Ecore_Exe *exe);
EAPI pid_t ecore_exe_pid_get(Ecore_Exe *exe);
EAPI void *ecore_exe_data_get(Ecore_Exe *exe);
EAPI void ecore_exe_pause(Ecore_Exe *exe);
EAPI void ecore_exe_continue(Ecore_Exe *exe);
EAPI void ecore_exe_terminate(Ecore_Exe *exe);
EAPI void ecore_exe_kill(Ecore_Exe *exe);
EAPI void ecore_exe_signal(Ecore_Exe *exe, int num);
EAPI void ecore_exe_hup(Ecore_Exe *exe);
EAPI Ecore_Exe *ecore_exe_run(const char *exe_cmd, const void *data);
EAPI void *ecore_exe_free(Ecore_Exe *exe);
EAPI pid_t ecore_exe_pid_get(Ecore_Exe *exe);
EAPI void ecore_exe_tag_set(Ecore_Exe *exe, const char *tag);
EAPI char *ecore_exe_tag_get(Ecore_Exe *exe);
EAPI void *ecore_exe_data_get(Ecore_Exe *exe);
EAPI void ecore_exe_pause(Ecore_Exe *exe);
EAPI void ecore_exe_continue(Ecore_Exe *exe);
EAPI void ecore_exe_terminate(Ecore_Exe *exe);
EAPI void ecore_exe_kill(Ecore_Exe *exe);
EAPI void ecore_exe_signal(Ecore_Exe *exe, int num);
EAPI void ecore_exe_hup(Ecore_Exe *exe);
#endif
EAPI Ecore_Idler *ecore_idler_add(int (*func) (void *data), const void *data);

View File

@ -52,6 +52,49 @@ ecore_exe_run(const char *exe_cmd, const void *data)
return NULL;
}
/**
* Sets the string tag for the given process handle
*
* @param exe The given process handle.
* @param tag The string tag to set on the process handle.
* @ingroup Ecore_Exe_Basic_Group
*/
void
ecore_exe_tag_set(Ecore_Exe *exe, const char *tag)
{
if (!ECORE_MAGIC_CHECK(exe, ECORE_MAGIC_EXE))
{
ECORE_MAGIC_FAIL(exe, ECORE_MAGIC_EXE,
"ecore_exe_tag_set");
return NULL;
}
if (exe->tag) free(exe->tag);
exe->tag = NULL;
if (tag) exe->tag = strdup(tag);
}
/**
* Retrieves the tag attached to the given process handle. There is no need to
* free it as it just returns the internal pointer value. This value is only
* valid as long as the @p exe is valid or until the tag is set to something
* else on this @p exe.
*
* @param exe The given process handle.
* @return The string attached to @p exe.
* @ingroup Ecore_Exe_Basic_Group
*/
char *
ecore_exe_tag_get(Ecore_Exe *exe)
{
if (!ECORE_MAGIC_CHECK(exe, ECORE_MAGIC_EXE))
{
ECORE_MAGIC_FAIL(exe, ECORE_MAGIC_EXE,
"ecore_exe_tag_get");
return NULL;
}
return exe->tag;
}
/**
* Frees the given process handle.
*
@ -253,6 +296,7 @@ _ecore_exe_free(Ecore_Exe *exe)
data = exe->data;
exes = _ecore_list2_remove(exes, exe);
ECORE_MAGIC_SET(exe, ECORE_MAGIC_NONE);
if (exe->tag) free(exe->tag);
free(exe);
return data;
}

View File

@ -137,6 +137,7 @@ struct _Ecore_Exe
ECORE_MAGIC;
pid_t pid;
void *data;
char *tag;
};
#endif