From 558aa01322f1af8be09fcfc086864da0373823c5 Mon Sep 17 00:00:00 2001 From: compudj Date: Sat, 27 Sep 2003 22:59:58 +0000 Subject: [PATCH] bind lasy git-svn-id: http://ltt.polymtl.ca/svn@266 04897980-b3bd-0310-b5e0-8ef037075253 --- ltt/branches/poly/Makefile.am | 1 + ltt/branches/poly/lttv/module.c | 11 +++-- ltt/branches/poly/lttv/modules/Makefile.am | 4 +- .../poly/lttv/modules/gui/API/Makefile.am | 6 ++- .../modules/gui/mainWin/src/init_module.c | 4 +- .../poly/lttv/modules/guiControlFlow/CFV.c | 25 +++++----- .../poly/lttv/modules/guiControlFlow/CFV.h | 5 +- .../lttv/modules/guiControlFlow/Drawing.c | 8 +-- .../lttv/modules/guiControlFlow/Drawing.h | 11 +++-- .../lttv/modules/guiControlFlow/Event_Hooks.c | 13 +++-- .../lttv/modules/guiControlFlow/Event_Hooks.h | 2 +- .../lttv/modules/guiControlFlow/Makefile.am | 7 ++- .../modules/guiControlFlow/Process_List.c | 5 +- .../modules/guiControlFlow/Process_List.h | 6 +-- .../poly/lttv/modules/guiControlFlow/module.c | 49 ++++++++++++++----- .../modules/icons/hGuiControlFlowInsert.xpm | 2 +- 16 files changed, 101 insertions(+), 58 deletions(-) diff --git a/ltt/branches/poly/Makefile.am b/ltt/branches/poly/Makefile.am index cf1b609e..0dbabeb2 100644 --- a/ltt/branches/poly/Makefile.am +++ b/ltt/branches/poly/Makefile.am @@ -1,5 +1,6 @@ # WARNING : ltt must come before lttv, so that the traceread library is # up to date + SUBDIRS = ltt include lttv lttd diff --git a/ltt/branches/poly/lttv/module.c b/ltt/branches/poly/lttv/module.c index e6012f76..44ce77d0 100644 --- a/ltt/branches/poly/lttv/module.c +++ b/ltt/branches/poly/lttv/module.c @@ -78,7 +78,9 @@ module_load(const char *name, int argc, char **argv) for(i = 0 ; i < modulesPaths->len ; i++) { pathname = g_module_build_path(modulesPaths->pdata[i],name); - gm = g_module_open(pathname,0); + gm = g_module_open(pathname,G_MODULE_BIND_LAZY); + g_critical("module : %s", pathname); + g_critical("erreur : %s", g_module_error()); g_free(pathname); if(gm != NULL) break; @@ -88,12 +90,14 @@ module_load(const char *name, int argc, char **argv) if(gm == NULL) { pathname = g_module_build_path(NULL,name); - gm = g_module_open(pathname,0); + gm = g_module_open(pathname,G_MODULE_BIND_LAZY); + g_critical("module : %s", pathname); g_free(pathname); } /* Module cannot be found */ - + if(gm==NULL) + g_critical("module est null"); if(gm == NULL) return NULL; /* Check if the module was already opened using the hopefully canonical name @@ -138,7 +142,6 @@ LttvModule * lttv_module_load(const char *name, int argc, char **argv) { LttvModule *m = module_load(name, argc, argv); - if(m != NULL) m->load_count++; return m; } diff --git a/ltt/branches/poly/lttv/modules/Makefile.am b/ltt/branches/poly/lttv/modules/Makefile.am index 2b1ba0ce..1ebbe961 100644 --- a/ltt/branches/poly/lttv/modules/Makefile.am +++ b/ltt/branches/poly/lttv/modules/Makefile.am @@ -5,12 +5,12 @@ # # the gui subdir comes first : dependency -SUBDIRS = gui # guiControlFlow +SUBDIRS = gui guiControlFlow AM_CFLAGS = $(GLIB_CFLAGS) AM_CFLAGS += $(GTK_CFLAGS) LIBS += $(GLIB_LIBS) -LIBS += $(GTK_LIBS) -L${srcdir}/gui/API -lmainWinApi +LIBS += $(GTK_LIBS) -L${top_srcdir}/lttv/modules/gui/API -lmainWinApi libdir = ${lttvplugindir} diff --git a/ltt/branches/poly/lttv/modules/gui/API/Makefile.am b/ltt/branches/poly/lttv/modules/gui/API/Makefile.am index 2c289792..a4b646ae 100644 --- a/ltt/branches/poly/lttv/modules/gui/API/Makefile.am +++ b/ltt/branches/poly/lttv/modules/gui/API/Makefile.am @@ -11,7 +11,9 @@ AM_CFLAGS += $(GTK_CFLAGS) LIBS += $(GLIB_LIBS) LIBS += $(GTK_LIBS) -lib_LTLIBRARIES = libmainWinApi.la libcustomBox.la -libmainWinApi_la_SOURCES = toolbar.c menu.c gtkTraceSet.c +lib_LTLIBRARIES = libcustomBox.la libmainWinApi.la libcustomBox_la_SOURCES = gtkcustomhbox.c +libmainWinApi_la_SOURCES = toolbar.c menu.c gtkTraceSet.c +#libmainWinApi_la_LDFLAGS = -L${top_srcdir}/lttv/modules/gui/API -lcustomBox + EXTRA_DIST = diff --git a/ltt/branches/poly/lttv/modules/gui/mainWin/src/init_module.c b/ltt/branches/poly/lttv/modules/gui/mainWin/src/init_module.c index d72ac56c..4ed046f9 100644 --- a/ltt/branches/poly/lttv/modules/gui/mainWin/src/init_module.c +++ b/ltt/branches/poly/lttv/modules/gui/mainWin/src/init_module.c @@ -90,7 +90,7 @@ static gboolean Window_Creation_Hook(void *hook_data, void *call_data) /* Add the object's information to the module's array */ Main_Window_List = g_slist_append(Main_Window_List, mw); - g_critical("GUI init()"); + g_critical("GUI Window_Creation_Hook()"); #ifdef ENABLE_NLS bindtextdomain (GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR); bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); @@ -195,6 +195,8 @@ G_MODULE_EXPORT void init(LttvModule *self, int argc, char *argv[]) { LttvIAttribute *attributes = LTTV_IATTRIBUTE(lttv_global_attributes()); + g_critical("GUI init()"); + lttv_option_add("trace", 't', "add a trace to the trace set to analyse", "pathname of the directory containing the trace", diff --git a/ltt/branches/poly/lttv/modules/guiControlFlow/CFV.c b/ltt/branches/poly/lttv/modules/guiControlFlow/CFV.c index 9855da64..fe616048 100644 --- a/ltt/branches/poly/lttv/modules/guiControlFlow/CFV.c +++ b/ltt/branches/poly/lttv/modules/guiControlFlow/CFV.c @@ -7,15 +7,15 @@ #include "Drawing.h" #include "Process_List.h" -#include "../icons/hGuiControlFlowInsert.xpm" +extern GSList *gControl_Flow_Data_List; /***************************************************************************** * Control Flow Viewer class implementation * *****************************************************************************/ -typedef struct _ControlFlowData { +struct _ControlFlowData { GtkWidget *Drawing_Area_V; GtkWidget *Scrolled_Window_VC; @@ -29,8 +29,8 @@ typedef struct _ControlFlowData { GtkAdjustment *VAdjust_C ; /* Trace information */ - TraceSet *Trace_Set; - TraceStatistics *Trace_Statistics; + //TraceSet *Trace_Set; + //TraceStatistics *Trace_Statistics; /* Shown events information */ guint First_Event, Last_Event; @@ -43,11 +43,7 @@ typedef struct _ControlFlowData { gboolean Selected_Event ; guint Number_Of_Process; -} ControlFlowData ; - - -/** Array containing instanced objects. Used when module is unloaded */ -static GSList *sControl_Flow_Data_List = NULL ; +} ; /** @@ -79,7 +75,7 @@ GuiControlFlow(void) /* Create the Process list */ - //Control_Flow_Data->Process_List = ProcessList(); + //Control_Flow_Data->Process_List = ProcessList_contruct(); //Process_List_Widget = // ProcessList_getWidget(Control_Flow_Data->Process_List); @@ -146,8 +142,9 @@ GuiControlFlow(void) G_OBJECT(Control_Flow_Data->HBox_V), "Control_Flow_Data", Control_Flow_Data, - GuiControlFlow_Destructor); + (GDestroyNotify)GuiControlFlow_Destructor); + g_slist_append(gControl_Flow_Data_List,Control_Flow_Data); return Control_Flow_Data; @@ -164,9 +161,13 @@ GuiControlFlow_Destructor(ControlFlowData *Control_Flow_Data) ProcessList_destroy(Control_Flow_Data->Process_List); - g_slist_remove(sControl_Flow_Data_List,Control_Flow_Data); + g_slist_remove(gControl_Flow_Data_List,Control_Flow_Data); } //FIXME : call hGuiEvents_Destructor for corresponding data upon widget destroy +GtkWidget *GuiControlFlow_get_Widget(ControlFlowData *Control_Flow_Data) +{ + return Control_Flow_Data->HBox_V ; +} diff --git a/ltt/branches/poly/lttv/modules/guiControlFlow/CFV.h b/ltt/branches/poly/lttv/modules/guiControlFlow/CFV.h index 41cd7d1b..85eade56 100644 --- a/ltt/branches/poly/lttv/modules/guiControlFlow/CFV.h +++ b/ltt/branches/poly/lttv/modules/guiControlFlow/CFV.h @@ -5,6 +5,7 @@ typedef struct _ControlFlowData ControlFlowData; /* Control Flow Data constructor */ ControlFlowData *GuiControlFlow(void); - - +void +GuiControlFlow_Destructor(ControlFlowData *Control_Flow_Data); +GtkWidget *GuiControlFlow_get_Widget(ControlFlowData *Control_Flow_Data); #endif // _CFV_H diff --git a/ltt/branches/poly/lttv/modules/guiControlFlow/Drawing.c b/ltt/branches/poly/lttv/modules/guiControlFlow/Drawing.c index 46405eec..53873b70 100644 --- a/ltt/branches/poly/lttv/modules/guiControlFlow/Drawing.c +++ b/ltt/branches/poly/lttv/modules/guiControlFlow/Drawing.c @@ -72,10 +72,10 @@ void get_time_from_pixels( guint area_x, guint area_width, guint window_width, - ltt_time &window_time_begin, - ltt_time &window_time_end, - ltt_time &time_begin, - ltt_time &time_end) + ltt_time *window_time_begin, + ltt_time *window_time_end, + ltt_time *time_begin, + ltt_time *time_end) { ltt_time window_time_interval; diff --git a/ltt/branches/poly/lttv/modules/guiControlFlow/Drawing.h b/ltt/branches/poly/lttv/modules/guiControlFlow/Drawing.h index 00d928d4..a3c28e44 100644 --- a/ltt/branches/poly/lttv/modules/guiControlFlow/Drawing.h +++ b/ltt/branches/poly/lttv/modules/guiControlFlow/Drawing.h @@ -2,6 +2,7 @@ #define _DRAWING_H #include +#include typedef time_t ltt_time; @@ -16,7 +17,7 @@ typedef struct _Drawing_t Drawing_t; Drawing_t *Drawing(void); void Drawing_destroy(Drawing_t *Drawing); -void Drawing_Resize(Drawing_t *Drawing, guint h, guint, w); +void Drawing_Resize(Drawing_t *Drawing, guint h, guint w); @@ -24,10 +25,10 @@ void get_time_from_pixels( guint area_x, guint area_width, guint window_width, - ltt_time &window_time_begin, - ltt_time &window_time_end, - ltt_time &time_begin, - ltt_time &time_end); + ltt_time *window_time_begin, + ltt_time *window_time_end, + ltt_time *time_begin, + ltt_time *time_end); #endif // _DRAWING_H diff --git a/ltt/branches/poly/lttv/modules/guiControlFlow/Event_Hooks.c b/ltt/branches/poly/lttv/modules/guiControlFlow/Event_Hooks.c index 9a86826b..df7eb663 100644 --- a/ltt/branches/poly/lttv/modules/guiControlFlow/Event_Hooks.c +++ b/ltt/branches/poly/lttv/modules/guiControlFlow/Event_Hooks.c @@ -2,8 +2,11 @@ * Hooks to be called by the main window * *****************************************************************************/ -#include +#include +#include +#include +#include #include "CFV.h" @@ -16,11 +19,11 @@ * @return The widget created. */ GtkWidget * -hGuiControlFlow(GtkWidget *pmParentWindow) +hGuiControlFlow(mainWindow *pmParentWindow) { ControlFlowData* Control_Flow_Data = GuiControlFlow() ; - return Control_Flow_Data->HBox_V ; + return GuiControlFlow_get_Widget(Control_Flow_Data) ; } @@ -38,7 +41,7 @@ int Event_Selected_Hook(void *hook_data, void *call_data) } - +#ifdef DEBUG /* Hook called before drawing. Gets the initial context at the beginning of the * drawing interval and copy it to the context in Event_Request. */ @@ -87,4 +90,4 @@ int Draw_After_Hook(void *hook_data, void *call_data) g_free(Event_Request); return 0; } - +#endif diff --git a/ltt/branches/poly/lttv/modules/guiControlFlow/Event_Hooks.h b/ltt/branches/poly/lttv/modules/guiControlFlow/Event_Hooks.h index c279f88b..7b68c7a5 100644 --- a/ltt/branches/poly/lttv/modules/guiControlFlow/Event_Hooks.h +++ b/ltt/branches/poly/lttv/modules/guiControlFlow/Event_Hooks.h @@ -2,7 +2,7 @@ #ifndef _EVENT_HOOKS_H #define _EVENT_HOOKS_H -GtkWidget *hGuiControlFlow(GtkWidget *pmParentWindow); +GtkWidget *hGuiControlFlow(mainWindow *pmParentWindow); int Event_Selected_Hook(void *hook_data, void *call_data); diff --git a/ltt/branches/poly/lttv/modules/guiControlFlow/Makefile.am b/ltt/branches/poly/lttv/modules/guiControlFlow/Makefile.am index 6d04bb4b..569f92c8 100644 --- a/ltt/branches/poly/lttv/modules/guiControlFlow/Makefile.am +++ b/ltt/branches/poly/lttv/modules/guiControlFlow/Makefile.am @@ -7,10 +7,13 @@ AM_CFLAGS = $(GLIB_CFLAGS) AM_CFLAGS += $(GTK_CFLAGS) LIBS += $(GLIB_LIBS) -LIBS += $(GTK_LIBS) -L${top_srcdir}/lttv/modules/gui/API -lmainWinApi -lcustomBox +LIBS += $(GTK_LIBS) -L${top_srcdir}/lttv/modules/gui/API -lmainWinApi libdir = ${lttvplugindir} lib_LTLIBRARIES = libguiControlFlow.la libguiControlFlow_la_LDFLAGS = -module -libguiControlFlow_la_SOURCES = guiControlFlow.c +libguiControlFlow_la_SOURCES = module.c +# CFV.c Event_Hooks.c +#libguiControlFlow_la_DEPENDENCIES = CFV.h \ +# Event_Hooks.h diff --git a/ltt/branches/poly/lttv/modules/guiControlFlow/Process_List.c b/ltt/branches/poly/lttv/modules/guiControlFlow/Process_List.c index be5be638..6085a672 100644 --- a/ltt/branches/poly/lttv/modules/guiControlFlow/Process_List.c +++ b/ltt/branches/poly/lttv/modules/guiControlFlow/Process_List.c @@ -23,7 +23,7 @@ enum }; -ProcessList *ProcessList(void) +ProcessList *ProcessList_construct(void) { GtkTreeViewColumn *column; GtkCellRenderer *renderer; @@ -95,7 +95,7 @@ gint get_cell_height(GtkTreeView *TreeView) return height; } - +#ifdef 0 int ProcessList_add(Process *myproc, ProcessList *Process_List, guint *height) { // add proc to container @@ -116,3 +116,4 @@ int ProcessList_remove(Process *myproc, ProcessList *Process_List) return 0; } +#endif diff --git a/ltt/branches/poly/lttv/modules/guiControlFlow/Process_List.h b/ltt/branches/poly/lttv/modules/guiControlFlow/Process_List.h index b4924ce2..75bb05ab 100644 --- a/ltt/branches/poly/lttv/modules/guiControlFlow/Process_List.h +++ b/ltt/branches/poly/lttv/modules/guiControlFlow/Process_List.h @@ -3,10 +3,10 @@ typedef struct _ProcessList ProcessList; -ProcessList *ProcessList(void); +ProcessList *ProcessList_construct(void); void ProcessList_destroy(ProcessList *Process_List); GtkWidget *ProcessList_getWidget(ProcessList *Process_List); -int ProcessList_add(Process *myproc, ProcessList *Process_List, guint *height); -int ProcessList_remove(Process *myproc, ProcessList *Process_List); +//int ProcessList_add(Process *myproc, ProcessList *Process_List, guint *height); +//int ProcessList_remove(Process *myproc, ProcessList *Process_List); #endif // _PROCESS_LIST_H diff --git a/ltt/branches/poly/lttv/modules/guiControlFlow/module.c b/ltt/branches/poly/lttv/modules/guiControlFlow/module.c index b25ebcfe..fe6a2838 100644 --- a/ltt/branches/poly/lttv/modules/guiControlFlow/module.c +++ b/ltt/branches/poly/lttv/modules/guiControlFlow/module.c @@ -17,12 +17,24 @@ * Author : Mathieu Desnoyers, June 2003 */ +#include #include #include -#include +//#include + +//#include "CFV.h" +//#include "Event_Hooks.h" + +// #include "../icons/hGuiControlFlowInsert.xpm" + +LttvModule *Main_Win_Module; + + +/** Array containing instanced objects. Used when module is unloaded */ +//GSList *gControl_Flow_Data_List = NULL ; + + -#include "CFV.h" -#include "Event_Hooks.h" /***************************************************************************** * Functions for module loading/unloading * @@ -33,20 +45,30 @@ * This function initializes the Control Flow Viewer functionnality through the * gtkTraceSet API. */ -G_MODULE_EXPORT void init() { +G_MODULE_EXPORT void init(LttvModule *self, int argc, char *argv[]) { + + Main_Win_Module = lttv_module_require(self, "mainwin", argc, argv); + + if(Main_Win_Module == NULL) + { + g_critical("Can't load Control Flow Viewer : missing mainwin\n"); + return; + } + g_critical("GUI ControlFlow Viewer init()"); /* Register the toolbar insert button */ - ToolbarItemReg(guiEventsInsert_xpm, "Insert Control Flow Viewer", guiEvent); + //ToolbarItemReg(hGuiControlFlowInsert_xpm, "Insert Control Flow Viewer", + // hGuiControlFlow); /* Register the menu item insert entry */ - MenuItemReg("/", "Insert Control Flow Viewer", guiEvent); + //MenuItemReg("/", "Insert Control Flow Viewer", hGuiControlFlow); } void destroy_walk(gpointer data, gpointer user_data) { - GuiControlFlow_Destructor((ControlFlowData*)data); +// GuiControlFlow_Destructor((ControlFlowData*)data); } @@ -61,16 +83,19 @@ G_MODULE_EXPORT void destroy() { g_critical("GUI Control Flow Viewer destroy()"); int i; - ControlFlowData *Control_Flow_Data; +// ControlFlowData *Control_Flow_Data; g_critical("GUI Event Viewer destroy()"); - g_slist_foreach(sControl_Flow_Data_List, destroy_walk, NULL ); +// g_slist_foreach(gControl_Flow_Data_List, destroy_walk, NULL ); /* Unregister the toolbar insert button */ - //ToolbarItemUnreg(hGuiEvents); + //ToolbarItemUnreg(hGuiControlFlow); /* Unregister the menu item insert entry */ - //MenuItemUnreg(hGuiEvents); -} + //MenuItemUnreg(hGuiControlFlow); + + lttv_module_unload(Main_Win_Module); + +} diff --git a/ltt/branches/poly/lttv/modules/icons/hGuiControlFlowInsert.xpm b/ltt/branches/poly/lttv/modules/icons/hGuiControlFlowInsert.xpm index 630d0480..850b2999 100644 --- a/ltt/branches/poly/lttv/modules/icons/hGuiControlFlowInsert.xpm +++ b/ltt/branches/poly/lttv/modules/icons/hGuiControlFlowInsert.xpm @@ -1,5 +1,5 @@ /* XPM */ -static char *hGuiEventsInsert_xpm[] = { +static char *hGuiControlFlowInsert_xpm[] = { /* width height ncolors chars_per_pixel */ "32 32 16 1", /* colors */ -- 2.34.1