exec.h
Go to the documentation of this file.00001
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef _EXEC_H_
00023 #define _EXEC_H_
00024
00025 #include <string>
00026 #include <gtk/gtk.h>
00027
00029 typedef void (*ExecFunc) (void *, void*);
00030
00031 typedef enum
00032 {
00033 RUNNING = 0, SKIPPED, CANCELLED, FAILED, COMPLETED
00034 } ExecState;
00035
00036 typedef struct
00037 {
00038 GPtrArray *args;
00039 GPid pid;
00040 gint exit_code;
00041 ExecState state;
00042 GMutex *state_mutex;
00043 ExecFunc lib_proc;
00044 ExecFunc pre_proc;
00045 ExecFunc read_proc;
00046 ExecFunc post_proc;
00047 gchar *working_dir;
00048 gboolean piped;
00049 gpointer exec;
00050 gboolean parse_progress;
00051 } ExecCmd;
00052
00053 typedef struct
00054 {
00055 gchar *process_title;
00056 gchar *process_description;
00057 GList *cmds;
00058 GError *err;
00059 gdouble fraction;
00060 ExecState outcome;
00061 } Exec;
00062
00063 Exec *exec_new (const gchar *process_title, const gchar *process_description);
00064 ExecCmd *exec_cmd_new (Exec **e);
00065 void exec_delete (Exec *self);
00066 void exec_run (Exec *e);
00067 void exec_stop (Exec *e);
00068 void exec_cmd_add_arg (ExecCmd *e, const gchar *format, ...);
00069 void exec_cmd_update_arg (ExecCmd *e, const gchar *arg_start, const gchar *format, ...);
00070 gint exec_run_cmd (const std::string& cmd, gchar **output, const std::string& working_dir);
00071 ExecState exec_cmd_get_state (ExecCmd *e);
00072 ExecState exec_cmd_set_state (ExecCmd *e, ExecState state);
00073 gint exec_count_operations (const Exec *e);
00074 GList* exec_get_cmd_list (void);
00075
00076 #endif