exec.h

Go to the documentation of this file.
00001 
00006 /*
00007  * This program is free software; you can redistribute it and/or modify
00008  * it under the terms of the GNU General Public License as published by
00009  * the Free Software Foundation; either version 2 of the License, or
00010  * (at your option) any later version.
00011  *
00012  * This program is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  * GNU Library General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU General Public License
00018  * along with this program; if not, write to the Free Software
00019  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
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  /*_EXEC_H_*/

Generated by  doxygen 1.6.2