You can subscribe to this list here.
2003 |
Jan
(30) |
Feb
(20) |
Mar
(151) |
Apr
(86) |
May
(23) |
Jun
(25) |
Jul
(107) |
Aug
(141) |
Sep
(55) |
Oct
(85) |
Nov
(65) |
Dec
(2) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2004 |
Jan
(22) |
Feb
(18) |
Mar
(3) |
Apr
(16) |
May
(69) |
Jun
(3) |
Jul
(1) |
Aug
(3) |
Sep
(1) |
Oct
|
Nov
(6) |
Dec
(1) |
2005 |
Jan
(2) |
Feb
(16) |
Mar
|
Apr
|
May
|
Jun
(47) |
Jul
(1) |
Aug
|
Sep
(6) |
Oct
(4) |
Nov
|
Dec
(34) |
2006 |
Jan
(39) |
Feb
|
Mar
(2) |
Apr
|
May
|
Jun
(1) |
Jul
|
Aug
|
Sep
(5) |
Oct
|
Nov
(4) |
Dec
|
2007 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(1) |
2008 |
Jan
|
Feb
|
Mar
(26) |
Apr
(1) |
May
(1) |
Jun
|
Jul
(5) |
Aug
(2) |
Sep
(8) |
Oct
(8) |
Nov
(22) |
Dec
(30) |
2009 |
Jan
(10) |
Feb
(13) |
Mar
(14) |
Apr
(14) |
May
(32) |
Jun
(25) |
Jul
(36) |
Aug
(10) |
Sep
(2) |
Oct
|
Nov
|
Dec
(10) |
2010 |
Jan
(9) |
Feb
(4) |
Mar
(2) |
Apr
(1) |
May
(2) |
Jun
(2) |
Jul
(1) |
Aug
(4) |
Sep
|
Oct
(1) |
Nov
|
Dec
|
From: <kr_...@us...> - 2003-10-03 12:54:43
|
Update of /cvsroot/htoolkit/gio/src/examples/life In directory sc8-pr-cvs1:/tmp/cvs-serv6742 Modified Files: Main.hs Log Message: update Index: Main.hs =================================================================== RCS file: /cvsroot/htoolkit/gio/src/examples/life/Main.hs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Main.hs 13 Jul 2003 10:32:12 -0000 1.1 --- Main.hs 3 Oct 2003 12:54:39 -0000 1.2 *************** *** 33,41 **** mopts <- menu [title =: "Options"] mainMenu msizes <- menu [title =: "Cell Size"] mopts ! rg <- menuRadioGroup [] msizes ! sequence [menuRadioItem [ title =: mkTitle size ! , on command =: onNewSize size w ref] rg | size <- [1..8]] ! set rg [selected =: 7] mcmd <- menu [title =: "Commands"] mainMenu --- 33,41 ---- mopts <- menu [title =: "Options"] mainMenu msizes <- menu [title =: "Cell Size"] mopts ! items <- sequence [menuRadioItem [ title =: mkTitle size ! , on command =: onNewSize size w ref] msizes | size <- [1..8]] ! setMenuRadioGroup items ! set (items !! 6) [checked =: True] mcmd <- menu [title =: "Commands"] mainMenu *************** *** 60,64 **** let render can = drawCells (drawCell size) next can >> drawCells (eraseCell size) died can writeIORef ref (life{gen=next}) ! drawInWindow UnBuffered w render onAbout = do --- 60,64 ---- let render can = drawCells (drawCell size) next can >> drawCells (eraseCell size) died can writeIORef ref (life{gen=next}) ! paintIn w UnBuffered render onAbout = do *************** *** 74,88 **** let cell = makeLifeCell pos (cellSize life) writeIORef ref (life{gen=removeCell cell (gen life)}) ! drawInWindow UnBuffered w (eraseCell (cellSize life) cell) | mods == noModifiers = do life <- readIORef ref let cell = makeLifeCell pos (cellSize life) writeIORef ref (life{gen=insertCell cell (gen life)}) ! drawInWindow UnBuffered w (drawCell (cellSize life) cell) onMouse w ref (MouseDrag pos mods) = do life <- readIORef ref let cell = makeLifeCell pos (cellSize life) writeIORef ref (life{gen=insertCell cell (gen life)}) ! drawInWindow UnBuffered w (drawCell (cellSize life) cell) onMouse w ref _ = return () --- 74,88 ---- let cell = makeLifeCell pos (cellSize life) writeIORef ref (life{gen=removeCell cell (gen life)}) ! paintIn w UnBuffered (eraseCell (cellSize life) cell) | mods == noModifiers = do life <- readIORef ref let cell = makeLifeCell pos (cellSize life) writeIORef ref (life{gen=insertCell cell (gen life)}) ! paintIn w UnBuffered (drawCell (cellSize life) cell) onMouse w ref (MouseDrag pos mods) = do life <- readIORef ref let cell = makeLifeCell pos (cellSize life) writeIORef ref (life{gen=insertCell cell (gen life)}) ! paintIn w UnBuffered (drawCell (cellSize life) cell) onMouse w ref _ = return () *************** *** 103,116 **** set mplay [enabled =: False] set mstep [enabled =: False] ! set mhalt [enabled =: True ] ! set timer [enabled =: True ] -- onHalt stops the computation of successive generations, but does not change the current generation. onHalt :: MenuItem -> MenuItem -> MenuItem -> Timer -> IO () onHalt mplay mstep mhalt timer = do ! set mplay [enabled =: True] ! set mstep [enabled =: True] ! set mhalt [enabled =: False] ! set timer [enabled =: False] -- onNewSize changes the size in which life cells are rendered and redraws the window. --- 103,116 ---- set mplay [enabled =: False] set mstep [enabled =: False] ! set mhalt [enabled =: True ] ! set timer [enabled =: True ] -- onHalt stops the computation of successive generations, but does not change the current generation. onHalt :: MenuItem -> MenuItem -> MenuItem -> Timer -> IO () onHalt mplay mstep mhalt timer = do ! set mplay [enabled =: True ] ! set mstep [enabled =: True ] ! set mhalt [enabled =: False] ! set timer [enabled =: False] -- onNewSize changes the size in which life cells are rendered and redraws the window. |
From: <kr_...@us...> - 2003-10-02 22:31:43
|
Update of /cvsroot/htoolkit/port/src/cbits/GTK In directory sc8-pr-cvs1:/tmp/cvs-serv14885/src/cbits/GTK Modified Files: Button.c CheckBox.c EditBox.c Internals.h Label.c RadioBox.c Window.c Log Message: bugfix Index: Button.c =================================================================== RCS file: /cvsroot/htoolkit/port/src/cbits/GTK/Button.c,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** Button.c 1 Oct 2003 21:47:15 -0000 1.9 --- Button.c 2 Oct 2003 22:31:39 -0000 1.10 *************** *** 36,49 **** { gchar *szText = toMnemonicString(txt); - GtkWidget *window = gtk_widget_get_parent(gtk_widget_get_parent(gtk_widget_get_parent(button))); gtk_button_set_label(GTK_BUTTON(button), szText); - handleContainerReLayout(window); rfree(szText); }; void osChangeButtonFont(WindowHandle button, FontHandle font) { - GtkWidget *window = gtk_widget_get_parent(gtk_widget_get_parent(gtk_widget_get_parent(button))); gtk_widget_modify_font(button, font->font_descr); ! handleContainerReLayout(window); }; --- 36,47 ---- { gchar *szText = toMnemonicString(txt); gtk_button_set_label(GTK_BUTTON(button), szText); rfree(szText); + osForceContainerReLayout(button); }; void osChangeButtonFont(WindowHandle button, FontHandle font) { gtk_widget_modify_font(button, font->font_descr); ! osForceContainerReLayout(button); }; Index: CheckBox.c =================================================================== RCS file: /cvsroot/htoolkit/port/src/cbits/GTK/CheckBox.c,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** CheckBox.c 1 Oct 2003 21:47:15 -0000 1.8 --- CheckBox.c 2 Oct 2003 22:31:39 -0000 1.9 *************** *** 35,42 **** { gchar *szText = toMnemonicString(txt); - GtkWidget *window = gtk_widget_get_parent(gtk_widget_get_parent(gtk_widget_get_parent(button))); gtk_button_set_label(GTK_BUTTON(button), szText); - handleContainerReLayout(window); rfree(szText); }; --- 35,41 ---- { gchar *szText = toMnemonicString(txt); gtk_button_set_label(GTK_BUTTON(button), szText); rfree(szText); + osForceContainerReLayout(button); }; Index: EditBox.c =================================================================== RCS file: /cvsroot/htoolkit/port/src/cbits/GTK/EditBox.c,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** EditBox.c 1 Oct 2003 21:47:15 -0000 1.10 --- EditBox.c 2 Oct 2003 22:31:39 -0000 1.11 *************** *** 55,60 **** void osChangeEditBoxFont(WindowHandle entry, FontHandle font) { ! gtk_widget_modify_font(entry, font->font_descr); ! // pango_layout_set_font_description(gtk_entry_get_layout(GTK_ENTRY(entry)), font->font_descr); ! handleContainerReLayout(gtk_widget_get_toplevel(entry)); }; --- 55,59 ---- void osChangeEditBoxFont(WindowHandle entry, FontHandle font) { ! gtk_widget_modify_font(entry, font->font_descr); ! osForceContainerReLayout(entry); }; Index: Internals.h =================================================================== RCS file: /cvsroot/htoolkit/port/src/cbits/GTK/Internals.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Internals.h 1 Oct 2003 21:47:15 -0000 1.5 --- Internals.h 2 Oct 2003 22:31:39 -0000 1.6 *************** *** 27,29 **** --- 27,31 ---- extern void *rmalloc(unsigned long bytes); + void osForceContainerReLayout(GtkWidget *widget); + #endif Index: Label.c =================================================================== RCS file: /cvsroot/htoolkit/port/src/cbits/GTK/Label.c,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** Label.c 1 Oct 2003 21:47:15 -0000 1.8 --- Label.c 2 Oct 2003 22:31:39 -0000 1.9 *************** *** 33,47 **** { gchar *szText = toMnemonicString(txt); - GtkWidget *window = gtk_widget_get_parent(gtk_widget_get_parent(gtk_widget_get_parent(label))); gtk_label_set_text_with_mnemonic(GTK_LABEL(label), szText); - handleContainerReLayout(window); rfree(szText); }; void osChangeLabelFont(WindowHandle label, FontHandle font) { - GtkWidget *window = gtk_widget_get_parent(gtk_widget_get_parent(gtk_widget_get_parent(label))); gtk_widget_modify_font(label, font->font_descr); ! //pango_layout_set_font_description(gtk_label_get_layout(GTK_LABEL(label)), font->font_descr); ! handleContainerReLayout(window); }; --- 33,44 ---- { gchar *szText = toMnemonicString(txt); gtk_label_set_text_with_mnemonic(GTK_LABEL(label), szText); rfree(szText); + osForceContainerReLayout(label); }; void osChangeLabelFont(WindowHandle label, FontHandle font) { gtk_widget_modify_font(label, font->font_descr); ! osForceContainerReLayout(label); }; Index: RadioBox.c =================================================================== RCS file: /cvsroot/htoolkit/port/src/cbits/GTK/RadioBox.c,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** RadioBox.c 1 Oct 2003 21:47:15 -0000 1.9 --- RadioBox.c 2 Oct 2003 22:31:39 -0000 1.10 *************** *** 37,44 **** { gchar *szText = toMnemonicString(txt); - GtkWidget *window = gtk_widget_get_parent(gtk_widget_get_parent(gtk_widget_get_parent(button))); gtk_button_set_label(GTK_BUTTON(button), szText); - handleContainerReLayout(window); rfree(szText); }; --- 37,43 ---- { gchar *szText = toMnemonicString(txt); gtk_button_set_label(GTK_BUTTON(button), szText); rfree(szText); + osForceContainerReLayout(button); }; Index: Window.c =================================================================== RCS file: /cvsroot/htoolkit/port/src/cbits/GTK/Window.c,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** Window.c 1 Oct 2003 21:47:15 -0000 1.29 --- Window.c 2 Oct 2003 22:31:39 -0000 1.30 *************** *** 833,834 **** --- 833,848 ---- } } + + void osForceContainerReLayout(GtkWidget *widget) + { + while (widget) + { + widget = gtk_widget_get_parent(gtk_widget_get_parent(widget)); + + if (!GTK_IS_FRAME(widget) && !GTK_IS_NOTEBOOK(gtk_widget_get_parent(widget))) + { + handleContainerReLayout(widget); + break; + } + } + } |
From: <kr_...@us...> - 2003-10-01 22:30:02
|
Update of /cvsroot/htoolkit/port/src/cbits/GTK In directory sc8-pr-cvs1:/tmp/cvs-serv32230/src/cbits/GTK Modified Files: GroupBox.c Log Message: better implementation for osGetGroupBoxReqSize Index: GroupBox.c =================================================================== RCS file: /cvsroot/htoolkit/port/src/cbits/GTK/GroupBox.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** GroupBox.c 1 Oct 2003 21:47:15 -0000 1.2 --- GroupBox.c 1 Oct 2003 22:29:59 -0000 1.3 *************** *** 8,12 **** GtkWidget *groupbox; ! groupbox = gtk_frame_new("kkkk"); gtk_container_add(GTK_CONTAINER(groupbox), port_layout_new(NULL,NULL)); port_layout_put(PORT_LAYOUT(GTK_BIN(window)->child), groupbox); --- 8,12 ---- GtkWidget *groupbox; ! groupbox = gtk_frame_new(""); gtk_container_add(GTK_CONTAINER(groupbox), port_layout_new(NULL,NULL)); port_layout_put(PORT_LAYOUT(GTK_BIN(window)->child), groupbox); *************** *** 18,25 **** void osGetGroupBoxBordersSize(WindowHandle groupbox, int *res) { ! res [0] = 0; ! res [1] = 0; ! res [2] = 10; ! res [3] = 20; } --- 18,29 ---- void osGetGroupBoxBordersSize(WindowHandle groupbox, int *res) { ! GtkRequisition requisition; ! ! gtk_widget_size_request (groupbox, &requisition); ! ! res[0] = 0; ! res[1] = 0; ! res[2] = requisition.width; ! res[3] = requisition.height; } |
From: <kr_...@us...> - 2003-10-01 22:09:05
|
Update of /cvsroot/htoolkit/port/src/cbits/GTK In directory sc8-pr-cvs1:/tmp/cvs-serv28296/src/cbits/GTK Modified Files: Notebook.c Log Message: Thanks to the PortLayout widget the implementation of osGetNotebookReqSize is now simple and efficient. Index: Notebook.c =================================================================== RCS file: /cvsroot/htoolkit/port/src/cbits/GTK/Notebook.c,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Notebook.c 1 Oct 2003 21:47:15 -0000 1.5 --- Notebook.c 1 Oct 2003 22:09:00 -0000 1.6 *************** *** 31,62 **** void osGetNotebookReqSize(WindowHandle notebook, int *res) { - int w,h; GtkRequisition requisition; - int i, count; - GtkWidget *label; - - w = 0; h = 0; - count = gtk_notebook_get_n_pages(GTK_NOTEBOOK(notebook)); - for (i = 0; i < count; i++) - { - label = gtk_notebook_get_tab_label(GTK_NOTEBOOK(notebook), - gtk_notebook_get_nth_page(GTK_NOTEBOOK(notebook), i)); - gtk_widget_size_request(label, &requisition); ! switch (gtk_notebook_get_tab_pos(GTK_NOTEBOOK(notebook))) ! { ! case GTK_POS_LEFT: ! case GTK_POS_RIGHT: ! if (w < requisition.width) w = requisition.width; ! break; ! case GTK_POS_TOP: ! case GTK_POS_BOTTOM: ! if (h < requisition.height) h = requisition.height; ! break; ! } ! } ! res[0] = w+12; ! res[1] = h+6; } --- 31,44 ---- void osGetNotebookReqSize(WindowHandle notebook, int *res) { GtkRequisition requisition; ! // The size requisition of PortLayout is always 0. That means that the size request of notebook ! // will be equal to the external size of the notebook (i.e. the size consumed from borders and from ! // page labels. This is exactly what we need. In the haskell world to the external size is added ! // the size required to fit the pages of the notebook. ! gtk_widget_size_request (notebook, &requisition); ! res[0] = requisition.width; ! res[1] = requisition.height; } |
From: <kr_...@us...> - 2003-10-01 21:59:00
|
Update of /cvsroot/htoolkit/port In directory sc8-pr-cvs1:/tmp/cvs-serv26777 Modified Files: makefile Log Message: Add LayoutContainer.c to the list of source files. Index: makefile =================================================================== RCS file: /cvsroot/htoolkit/port/makefile,v retrieving revision 1.41 retrieving revision 1.42 diff -C2 -d -r1.41 -r1.42 *** makefile 9 Sep 2003 13:34:39 -0000 1.41 --- makefile 1 Oct 2003 21:58:57 -0000 1.42 *************** *** 53,57 **** CSRCS += MenuHandlesMap.c DockBar.c else ! CSRCS += gtkdropdownbutton.c gtkdropdowntoolbutton.c endif --- 53,57 ---- CSRCS += MenuHandlesMap.c DockBar.c else ! CSRCS += gtkdropdownbutton.c gtkdropdowntoolbutton.c LayoutContainer.c endif *************** *** 179,184 **** $(COBJS): $(COUTDIR)/%.c.o: %.c $(CC) -o $@ -c $< $(CC-OPTIONS) -MD $(INCDIRS) ! @#move dependendcy files only needed for gcc 2.xx ! @#@mv $(*F).d $(COUTDIR)/$(*F).c.d #-------------------------------------------------------------------------- --- 179,184 ---- $(COBJS): $(COUTDIR)/%.c.o: %.c $(CC) -o $@ -c $< $(CC-OPTIONS) -MD $(INCDIRS) ! @#move dependendcy files only needed for gcc 2.xx ! @#@mv $(*F).d $(COUTDIR)/$(*F).c.d #-------------------------------------------------------------------------- |
From: <kr_...@us...> - 2003-10-01 21:47:22
|
Update of /cvsroot/htoolkit/port/src/cbits/GTK In directory sc8-pr-cvs1:/tmp/cvs-serv20621 Modified Files: Button.c CheckBox.c EditBox.c GroupBox.c Internals.h Label.c ListBox.c Notebook.c PopUp.c ProgressBar.c RadioBox.c Slider.c Window.c Added Files: LayoutContainer.c LayoutContainer.h Log Message: Added PortLayout widget. The new widget is used insted of GtkFixed in the implementations of all containers in Port. The widget can be placed directly in the GtkScrolledWindow without need of GtkViewport. This makes the implementations of containers simple and more efficient. The PortLayout calls handleContainerReLayout in responce of "size_allocate" event. The new scheme of "size_allocate" handling is more simple and more accurate. --- NEW FILE: LayoutContainer.c --- #include "LayoutContainer.h" #include "Handlers_stub.h" enum { PROP_0, PROP_HADJUSTMENT, PROP_VADJUSTMENT, PROP_WIDTH, PROP_HEIGHT }; static void port_layout_class_init (PortLayoutClass *class); static void port_layout_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec); static void port_layout_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec); static GObject *port_layout_constructor (GType type, guint n_properties, GObjectConstructParam *properties); static void port_layout_init (PortLayout *layout); static void port_layout_finalize (GObject *object); static void port_layout_realize (GtkWidget *widget); static void port_layout_unrealize (GtkWidget *widget); static void port_layout_map (GtkWidget *widget); static void port_layout_size_request (GtkWidget *widget, GtkRequisition *requisition); static void port_layout_size_allocate (GtkWidget *widget, GtkAllocation *allocation); static gint port_layout_expose (GtkWidget *widget, GdkEventExpose *event); static void port_layout_remove (GtkContainer *container, GtkWidget *widget); static void port_layout_forall (GtkContainer *container, gboolean include_internals, GtkCallback callback, gpointer callback_data); static void port_layout_set_adjustments (PortLayout *layout, GtkAdjustment *hadj, GtkAdjustment *vadj); static void port_layout_adjustment_changed (GtkAdjustment *adjustment, PortLayout *layout); static void port_layout_style_set(GtkWidget *widget, GtkStyle *old_style); static void port_layout_set_adjustment_upper (GtkAdjustment *adj, gdouble upper, gboolean always_emit_changed); static GtkWidgetClass *parent_class = NULL; GtkWidget* port_layout_new (GtkAdjustment *hadjustment, GtkAdjustment *vadjustment) { GtkLayout *layout; layout = g_object_new (PORT_TYPE_LAYOUT, "hadjustment", hadjustment, "vadjustment", vadjustment, NULL); return GTK_WIDGET (layout); } GtkAdjustment* port_layout_get_hadjustment (PortLayout *layout) { g_return_val_if_fail (PORT_IS_LAYOUT (layout), NULL); return layout->hadjustment; } GtkAdjustment* port_layout_get_vadjustment (PortLayout *layout) { g_return_val_if_fail (PORT_IS_LAYOUT (layout), NULL); return layout->vadjustment; } static GtkAdjustment *new_default_adjustment (void) { return GTK_ADJUSTMENT(gtk_adjustment_new (0.0, 0.0, 0.0, 0.0, 0.0, 0.0)); } static void port_layout_set_adjustments (PortLayout *layout, GtkAdjustment *hadj, GtkAdjustment *vadj) { gboolean need_adjust = FALSE; g_return_if_fail (PORT_IS_LAYOUT (layout)); if (hadj) g_return_if_fail (GTK_IS_ADJUSTMENT (hadj)); else if (layout->hadjustment) hadj = new_default_adjustment (); if (vadj) g_return_if_fail (GTK_IS_ADJUSTMENT (vadj)); else if (layout->vadjustment) vadj = new_default_adjustment (); if (layout->hadjustment && (layout->hadjustment != hadj)) { g_signal_handlers_disconnect_by_func (layout->hadjustment, port_layout_adjustment_changed, layout); g_object_unref (layout->hadjustment); } if (layout->vadjustment && (layout->vadjustment != vadj)) { g_signal_handlers_disconnect_by_func (layout->vadjustment, port_layout_adjustment_changed, layout); g_object_unref (layout->vadjustment); } if (layout->hadjustment != hadj) { layout->hadjustment = hadj; g_object_ref (layout->hadjustment); gtk_object_sink (GTK_OBJECT (layout->hadjustment)); port_layout_set_adjustment_upper (layout->hadjustment, layout->width, FALSE); g_signal_connect (layout->hadjustment, "value_changed", G_CALLBACK (port_layout_adjustment_changed), layout); need_adjust = TRUE; } if (layout->vadjustment != vadj) { layout->vadjustment = vadj; g_object_ref (layout->vadjustment); gtk_object_sink (GTK_OBJECT (layout->vadjustment)); port_layout_set_adjustment_upper (layout->vadjustment, layout->height, FALSE); g_signal_connect (layout->vadjustment, "value_changed", G_CALLBACK (port_layout_adjustment_changed), layout); need_adjust = TRUE; } /* vadj or hadj can be NULL while constructing; don't emit a signal then */ if (need_adjust && vadj && hadj) port_layout_adjustment_changed (NULL, layout); } static void port_layout_finalize (GObject *object) { PortLayout *layout = PORT_LAYOUT (object); g_object_unref (layout->hadjustment); g_object_unref (layout->vadjustment); G_OBJECT_CLASS (parent_class)->finalize (object); } void port_layout_set_hadjustment(PortLayout *layout, GtkAdjustment *adjustment) { g_return_if_fail (PORT_IS_LAYOUT (layout)); port_layout_set_adjustments (layout, adjustment, layout->vadjustment); g_object_notify (G_OBJECT (layout), "hadjustment"); } void port_layout_set_vadjustment (PortLayout *layout, GtkAdjustment *adjustment) { g_return_if_fail (PORT_IS_LAYOUT (layout)); port_layout_set_adjustments (layout, layout->hadjustment, adjustment); g_object_notify (G_OBJECT (layout), "vadjustment"); } void port_layout_put (PortLayout *layout, GtkWidget *child_widget) { g_return_if_fail (PORT_IS_LAYOUT (layout)); g_return_if_fail (GTK_IS_WIDGET (child_widget)); layout->children = g_list_append (layout->children, child_widget); if (GTK_WIDGET_REALIZED (layout)) gtk_widget_set_parent_window (child_widget, layout->bin_window); gtk_widget_set_parent (child_widget, GTK_WIDGET (layout)); } static void port_layout_set_adjustment_upper (GtkAdjustment *adj, gdouble upper, gboolean always_emit_changed) { gboolean changed = FALSE; gboolean value_changed = FALSE; gdouble min = MAX (0., upper - adj->page_size); if (upper != adj->upper) { adj->upper = upper; changed = TRUE; } if (adj->value > min) { adj->value = min; value_changed = TRUE; } if (changed || always_emit_changed) gtk_adjustment_changed (adj); if (value_changed) gtk_adjustment_value_changed (adj); } void port_layout_set_domain(PortLayout *layout, guint width, guint height) { GtkWidget *widget; g_return_if_fail (PORT_IS_LAYOUT (layout)); widget = GTK_WIDGET (layout); g_object_freeze_notify (G_OBJECT (layout)); if (width != layout->width) { layout->width = width; g_object_notify (G_OBJECT (layout), "width"); } if (height != layout->height) { layout->height = height; g_object_notify (G_OBJECT (layout), "height"); } g_object_thaw_notify (G_OBJECT (layout)); if (layout->hadjustment) port_layout_set_adjustment_upper (layout->hadjustment, layout->width, FALSE); if (layout->vadjustment) port_layout_set_adjustment_upper (layout->vadjustment, layout->height, FALSE); if (GTK_WIDGET_REALIZED (layout)) { width = MAX (width, widget->allocation.width); height = MAX (height, widget->allocation.height); gdk_window_resize (layout->bin_window, width, height); } } void port_layout_get_domain(PortLayout *layout, guint *width, guint *height) { g_return_if_fail (PORT_IS_LAYOUT (layout)); if (width) *width = layout->width; if (height) *height = layout->height; } /* Basic Object handling procedures */ GType port_layout_get_type (void) { static GType layout_type = 0; if (!layout_type) { static const GTypeInfo layout_info = { sizeof (PortLayoutClass), NULL, /* base_init */ NULL, /* base_finalize */ (GClassInitFunc) port_layout_class_init, NULL, /* class_finalize */ NULL, /* class_data */ sizeof (PortLayout), 0, /* n_preallocs */ (GInstanceInitFunc) port_layout_init, }; layout_type = g_type_register_static (GTK_TYPE_CONTAINER, "PortLayout", &layout_info, 0); } return layout_type; } void _gtk_marshal_VOID__OBJECT_OBJECT (GClosure *closure, GValue *return_value, guint n_param_values, const GValue *param_values, gpointer invocation_hint, gpointer marshal_data) { typedef void (*GMarshalFunc_VOID__OBJECT_OBJECT) (gpointer data1, gpointer arg_1, gpointer arg_2, gpointer data2); register GMarshalFunc_VOID__OBJECT_OBJECT callback; register GCClosure *cc = (GCClosure*) closure; register gpointer data1, data2; g_return_if_fail (n_param_values == 3); if (G_CCLOSURE_SWAP_DATA (closure)) { data1 = closure->data; data2 = g_value_peek_pointer (param_values + 0); } else { data1 = g_value_peek_pointer (param_values + 0); data2 = closure->data; } callback = (GMarshalFunc_VOID__OBJECT_OBJECT) (marshal_data ? marshal_data : cc->callback); callback (data1, g_value_get_object (param_values + 1), g_value_get_object (param_values + 2), data2); } static void port_layout_class_init (PortLayoutClass *class) { GObjectClass *gobject_class; GtkWidgetClass *widget_class; GtkContainerClass *container_class; gobject_class = (GObjectClass*) class; widget_class = (GtkWidgetClass*) class; container_class = (GtkContainerClass*) class; parent_class = g_type_class_peek_parent (class); gobject_class->set_property = port_layout_set_property; gobject_class->get_property = port_layout_get_property; gobject_class->finalize = port_layout_finalize; gobject_class->constructor = port_layout_constructor; g_object_class_install_property (gobject_class, PROP_HADJUSTMENT, g_param_spec_object ("hadjustment", _("Horizontal adjustment"), _("The GtkAdjustment for the horizontal position"), GTK_TYPE_ADJUSTMENT, G_PARAM_READWRITE)); g_object_class_install_property (gobject_class, PROP_VADJUSTMENT, g_param_spec_object ("vadjustment", _("Vertical adjustment"), _("The GtkAdjustment for the vertical position"), GTK_TYPE_ADJUSTMENT, G_PARAM_READWRITE)); g_object_class_install_property (gobject_class, PROP_WIDTH, g_param_spec_uint ("width", _("Width"), _("The width of the layout"), 0, G_MAXINT, 100, G_PARAM_READWRITE)); g_object_class_install_property (gobject_class, PROP_HEIGHT, g_param_spec_uint ("height", _("Height"), _("The height of the layout"), 0, G_MAXINT, 100, G_PARAM_READWRITE)); widget_class->realize = port_layout_realize; widget_class->unrealize = port_layout_unrealize; widget_class->map = port_layout_map; widget_class->size_request = port_layout_size_request; widget_class->size_allocate = port_layout_size_allocate; widget_class->expose_event = port_layout_expose; widget_class->style_set = port_layout_style_set; container_class->remove = port_layout_remove; container_class->forall = port_layout_forall; class->set_scroll_adjustments = port_layout_set_adjustments; widget_class->set_scroll_adjustments_signal = g_signal_new ("set_scroll_adjustments", G_OBJECT_CLASS_TYPE (gobject_class), G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION, G_STRUCT_OFFSET (PortLayoutClass, set_scroll_adjustments), NULL, NULL, _gtk_marshal_VOID__OBJECT_OBJECT, G_TYPE_NONE, 2, GTK_TYPE_ADJUSTMENT, GTK_TYPE_ADJUSTMENT); } static void port_layout_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec) { PortLayout *layout = PORT_LAYOUT (object); switch (prop_id) { case PROP_HADJUSTMENT: g_value_set_object (value, layout->hadjustment); break; case PROP_VADJUSTMENT: g_value_set_object (value, layout->vadjustment); break; case PROP_WIDTH: g_value_set_uint (value, layout->width); break; case PROP_HEIGHT: g_value_set_uint (value, layout->height); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; } } static void port_layout_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec) { PortLayout *layout = PORT_LAYOUT (object); switch (prop_id) { case PROP_HADJUSTMENT: port_layout_set_hadjustment (layout, (GtkAdjustment*) g_value_get_object (value)); break; case PROP_VADJUSTMENT: port_layout_set_vadjustment (layout, (GtkAdjustment*) g_value_get_object (value)); break; case PROP_WIDTH: port_layout_set_domain (layout, g_value_get_uint (value), layout->height); break; case PROP_HEIGHT: port_layout_set_domain (layout, layout->width, g_value_get_uint (value)); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; } } static void port_layout_init (PortLayout *layout) { layout->children = NULL; layout->width = 100; layout->height = 100; layout->hadjustment = NULL; layout->vadjustment = NULL; layout->bin_window = NULL; layout->scroll_x = 0; layout->scroll_y = 0; layout->visibility = GDK_VISIBILITY_PARTIAL; } static GObject *port_layout_constructor (GType type, guint n_properties, GObjectConstructParam *properties) { PortLayout *layout; GObject *object; GtkAdjustment *hadj, *vadj; object = G_OBJECT_CLASS (parent_class)->constructor (type, n_properties, properties); layout = PORT_LAYOUT (object); hadj = layout->hadjustment ? layout->hadjustment : new_default_adjustment (); vadj = layout->vadjustment ? layout->vadjustment : new_default_adjustment (); if (!layout->hadjustment || !layout->vadjustment) port_layout_set_adjustments (layout, hadj, vadj); return object; } static void port_layout_realize (GtkWidget *widget) { GList *tmp_list; PortLayout *layout; GdkWindowAttr attributes; gint attributes_mask; g_return_if_fail (PORT_IS_LAYOUT (widget)); layout = PORT_LAYOUT (widget); GTK_WIDGET_SET_FLAGS (layout, GTK_REALIZED); attributes.window_type = GDK_WINDOW_CHILD; attributes.x = widget->allocation.x; attributes.y = widget->allocation.y; attributes.width = widget->allocation.width; attributes.height = widget->allocation.height; attributes.wclass = GDK_INPUT_OUTPUT; attributes.visual = gtk_widget_get_visual (widget); attributes.colormap = gtk_widget_get_colormap (widget); attributes.event_mask = GDK_VISIBILITY_NOTIFY_MASK; attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP; widget->window = gdk_window_new (gtk_widget_get_parent_window (widget), &attributes, attributes_mask); gdk_window_set_user_data (widget->window, widget); attributes.x = - layout->hadjustment->value, attributes.y = - layout->vadjustment->value; attributes.width = MAX (layout->width, widget->allocation.width); attributes.height = MAX (layout->height, widget->allocation.height); attributes.event_mask = GDK_EXPOSURE_MASK | GDK_SCROLL_MASK | GDK_BUTTON_RELEASE_MASK | GDK_POINTER_MOTION_MASK | GDK_ENTER_NOTIFY_MASK | GDK_LEAVE_NOTIFY_MASK | gtk_widget_get_events (widget); layout->bin_window = gdk_window_new (widget->window, &attributes, attributes_mask); gdk_window_set_user_data (layout->bin_window, widget); widget->style = gtk_style_attach (widget->style, widget->window); gtk_style_set_background (widget->style, widget->window, GTK_STATE_NORMAL); gtk_style_set_background (widget->style, layout->bin_window, GTK_STATE_NORMAL); tmp_list = layout->children; while (tmp_list) { GtkWidget *child_widget = tmp_list->data; tmp_list = tmp_list->next; gtk_widget_set_parent_window (child_widget, layout->bin_window); } } static void port_layout_style_set (GtkWidget *widget, GtkStyle *old_style) { if (GTK_WIDGET_CLASS (parent_class)->style_set) (* GTK_WIDGET_CLASS (parent_class)->style_set) (widget, old_style); if (GTK_WIDGET_REALIZED (widget)) { gtk_style_set_background (widget->style, PORT_LAYOUT (widget)->bin_window, GTK_STATE_NORMAL); } } static void port_layout_map (GtkWidget *widget) { GList *tmp_list; PortLayout *layout; g_return_if_fail (PORT_IS_LAYOUT (widget)); layout = PORT_LAYOUT (widget); GTK_WIDGET_SET_FLAGS (widget, GTK_MAPPED); tmp_list = layout->children; while (tmp_list) { GtkWidget *child_widget = tmp_list->data; tmp_list = tmp_list->next; if (GTK_WIDGET_VISIBLE (child_widget)) { if (!GTK_WIDGET_MAPPED (child_widget)) gtk_widget_map (child_widget); } } gdk_window_show (layout->bin_window); gdk_window_show (widget->window); } static void port_layout_unrealize (GtkWidget *widget) { PortLayout *layout; g_return_if_fail (PORT_IS_LAYOUT (widget)); layout = PORT_LAYOUT (widget); gdk_window_set_user_data (layout->bin_window, NULL); gdk_window_destroy (layout->bin_window); layout->bin_window = NULL; if (GTK_WIDGET_CLASS (parent_class)->unrealize) (* GTK_WIDGET_CLASS (parent_class)->unrealize) (widget); } static void port_layout_size_request (GtkWidget *widget, GtkRequisition *requisition) { GList *tmp_list; GtkLayout *layout; g_return_if_fail (PORT_IS_LAYOUT (widget)); layout = PORT_LAYOUT (widget); requisition->width = 0; requisition->height = 0; tmp_list = layout->children; while (tmp_list) { GtkWidget *child_widget = tmp_list->data; GtkRequisition child_requisition; tmp_list = tmp_list->next; gtk_widget_size_request(child_widget, &child_requisition); } } static void port_layout_size_allocate (GtkWidget *widget, GtkAllocation *allocation) { PortLayout *layout; g_return_if_fail (PORT_IS_LAYOUT (widget)); layout = PORT_LAYOUT(widget); widget->allocation = *allocation; if (GTK_WIDGET_REALIZED (widget)) { gdk_window_move_resize (widget->window, allocation->x, allocation->y, allocation->width, allocation->height); gdk_window_resize (layout->bin_window, MAX (layout->width, allocation->width), MAX (layout->height, allocation->height)); } layout->hadjustment->page_size = allocation->width; layout->hadjustment->page_increment = allocation->width * 0.9; layout->hadjustment->lower = 0; /* set_adjustment_upper() emits ::changed */ port_layout_set_adjustment_upper (layout->hadjustment, MAX (allocation->width, layout->width), TRUE); layout->vadjustment->page_size = allocation->height; layout->vadjustment->page_increment = allocation->height * 0.9; layout->vadjustment->lower = 0; layout->vadjustment->upper = MAX (allocation->height, layout->height); port_layout_set_adjustment_upper (layout->vadjustment, MAX (allocation->height, layout->height), TRUE); handleWindowResize(gtk_widget_get_parent(widget),allocation->width,allocation->height); handleContainerReLayout(gtk_widget_get_parent(widget)); } static gint port_layout_expose (GtkWidget *widget, GdkEventExpose *event) { PortLayout *layout; g_return_val_if_fail (PORT_IS_LAYOUT (widget), FALSE); layout = PORT_LAYOUT (widget); if (event->window != layout->bin_window) return FALSE; (* GTK_WIDGET_CLASS (parent_class)->expose_event) (widget, event); return FALSE; } static void port_layout_remove (GtkContainer *container, GtkWidget *widget) { PortLayout *layout; g_return_val_if_fail (PORT_IS_LAYOUT (container), FALSE); layout = PORT_LAYOUT (container); layout->children = g_list_remove(layout->children, widget); gtk_widget_unparent (widget); } static void port_layout_forall (GtkContainer *container, gboolean include_internals, GtkCallback callback, gpointer callback_data) { GtkWidget *widget; GList *tmp_list; g_return_if_fail (PORT_IS_LAYOUT (container)); g_return_if_fail (callback != NULL); tmp_list = PORT_LAYOUT (container)->children; while (tmp_list) { widget = tmp_list->data; tmp_list = tmp_list->next; (* callback) (widget, callback_data); } } /* Callbacks */ static void port_layout_adjustment_changed (GtkAdjustment *adjustment, PortLayout *layout) { GtkWidget *widget; widget = GTK_WIDGET (layout); if (GTK_WIDGET_REALIZED (layout)) { gdk_window_move (layout->bin_window, - layout->hadjustment->value, - layout->vadjustment->value); gdk_window_process_updates (layout->bin_window, TRUE); } } --- NEW FILE: LayoutContainer.h --- #ifndef __PORT_LAYOUT_H #define __PORT_LAYOUT_H #include "Types.h" #define PORT_TYPE_LAYOUT (port_layout_get_type ()) #define PORT_LAYOUT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), PORT_TYPE_LAYOUT, PortLayout)) #define PORT_LAYOUT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PORT_TYPE_LAYOUT, PortLayoutClass)) #define PORT_IS_LAYOUT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PORT_TYPE_LAYOUT)) #define PORT_IS_LAYOUT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PORT_TYPE_LAYOUT)) #define PORT_LAYOUT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PORT_TYPE_LAYOUT, PortLayoutClass)) typedef struct _PortLayout PortLayout; typedef struct _PortLayoutClass PortLayoutClass; struct _PortLayout { GtkContainer container; GList *children; guint width; guint height; GtkAdjustment *hadjustment; GtkAdjustment *vadjustment; /*< public >*/ GdkWindow *bin_window; /*< private >*/ GdkVisibilityState visibility; gint scroll_x; gint scroll_y; }; struct _PortLayoutClass { GtkContainerClass parent_class; void (*set_scroll_adjustments) (GtkLayout *layout, GtkAdjustment *hadjustment, GtkAdjustment *vadjustment); }; GType port_layout_get_type (void) G_GNUC_CONST; GtkWidget* port_layout_new (GtkAdjustment *hadjustment, GtkAdjustment *vadjustment); void port_layout_put (PortLayout *layout, GtkWidget *child_widget); void port_layout_set_domain (PortLayout *layout, guint width, guint height); void port_layout_get_domain (PortLayout *layout, guint *width, guint *height); GtkAdjustment* port_layout_get_hadjustment (PortLayout *layout); GtkAdjustment* port_layout_get_vadjustment (PortLayout *layout); void port_layout_set_hadjustment (PortLayout *layout, GtkAdjustment *adjustment); void port_layout_set_vadjustment (PortLayout *layout, GtkAdjustment *adjustment); #endif /* __PORT_LAYOUT_H */ Index: Button.c =================================================================== RCS file: /cvsroot/htoolkit/port/src/cbits/GTK/Button.c,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** Button.c 24 Aug 2003 21:07:48 -0000 1.8 --- Button.c 1 Oct 2003 21:47:15 -0000 1.9 *************** *** 12,16 **** GTK_SIGNAL_FUNC(handleControlCommand), NULL); ! gtk_fixed_put(GTK_FIXED(GTK_BIN(GTK_BIN(window)->child)->child), button, 0, 0); gtk_widget_show(button); --- 12,16 ---- GTK_SIGNAL_FUNC(handleControlCommand), NULL); ! port_layout_put(PORT_LAYOUT(GTK_BIN(window)->child), button); gtk_widget_show(button); *************** *** 20,30 **** void osGetButtonReqSize(WindowHandle button, int *res) { - int w,h; GtkRequisition requisition; - gtk_widget_get_size_request(button, &w,&h); - gtk_widget_set_size_request(button, -1,-1); gtk_widget_size_request(button, &requisition); - gtk_widget_set_size_request(button, w, h); res[0] = requisition.width; --- 20,26 ---- Index: CheckBox.c =================================================================== RCS file: /cvsroot/htoolkit/port/src/cbits/GTK/CheckBox.c,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** CheckBox.c 24 Aug 2003 21:07:48 -0000 1.7 --- CheckBox.c 1 Oct 2003 21:47:15 -0000 1.8 *************** *** 8,12 **** check_btn = gtk_check_button_new_with_mnemonic(""); ! gtk_fixed_put(GTK_FIXED(GTK_BIN(GTK_BIN(window)->child)->child), check_btn, 0, 0); gtk_signal_connect (GTK_OBJECT (check_btn), "toggled", GTK_SIGNAL_FUNC(handleControlCommand), --- 8,12 ---- check_btn = gtk_check_button_new_with_mnemonic(""); ! port_layout_put(PORT_LAYOUT(GTK_BIN(window)->child), check_btn); gtk_signal_connect (GTK_OBJECT (check_btn), "toggled", GTK_SIGNAL_FUNC(handleControlCommand), *************** *** 19,29 **** void osGetCheckBoxReqSize(WindowHandle checkbox, int *res) { - int w,h; GtkRequisition requisition; - gtk_widget_get_size_request(checkbox, &w,&h); - gtk_widget_set_size_request(checkbox, -1,-1); gtk_widget_size_request(checkbox, &requisition); - gtk_widget_set_size_request(checkbox, w, h); res[0] = requisition.width; --- 19,25 ---- Index: EditBox.c =================================================================== RCS file: /cvsroot/htoolkit/port/src/cbits/GTK/EditBox.c,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** EditBox.c 24 Aug 2003 21:07:48 -0000 1.9 --- EditBox.c 1 Oct 2003 21:47:15 -0000 1.10 *************** *** 8,12 **** entry = gtk_entry_new(); ! gtk_fixed_put(GTK_FIXED(GTK_BIN(GTK_BIN(window)->child)->child), entry, 0, 0); gtk_widget_show(entry); return entry; --- 8,12 ---- entry = gtk_entry_new(); ! port_layout_put(PORT_LAYOUT(GTK_BIN(window)->child), entry); gtk_widget_show(entry); return entry; *************** *** 15,25 **** void osGetEditReqSize(WindowHandle edit, int *res) { - int w,h; GtkRequisition requisition; - gtk_widget_get_size_request(edit, &w,&h); - gtk_widget_set_size_request(edit, -1,-1); gtk_widget_size_request(edit, &requisition); - gtk_widget_set_size_request(edit, w, h); res[0] = requisition.width; --- 15,21 ---- Index: GroupBox.c =================================================================== RCS file: /cvsroot/htoolkit/port/src/cbits/GTK/GroupBox.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** GroupBox.c 3 Sep 2003 17:05:28 -0000 1.1 --- GroupBox.c 1 Oct 2003 21:47:15 -0000 1.2 *************** *** 2,23 **** #include "Internals.h" #include "Handlers_stub.h" ! static void groupbox_size_allocate_handler(GtkWidget *widget, GtkAllocation *allocation, gpointer user_data) ! { ! handleContainerReLayout(widget); ! }; ! ! WindowHandle osCreateGroupBox(WindowHandle form) { ! GtkWidget *page, *groupbox; ! groupbox = gtk_frame_new(""); ! gtk_fixed_put(GTK_FIXED(GTK_BIN(GTK_BIN(form)->child)->child), groupbox, 0, 0); ! page = gtk_viewport_new(NULL,NULL); ! gtk_container_add(GTK_CONTAINER(groupbox), page); ! gtk_container_add(GTK_CONTAINER(page), gtk_fixed_new()); ! gtk_signal_connect (GTK_OBJECT(groupbox), "size-allocate", ! GTK_SIGNAL_FUNC(groupbox_size_allocate_handler), ! NULL); gtk_widget_show_all(groupbox); --- 2,14 ---- #include "Internals.h" #include "Handlers_stub.h" + #include "Window.h" ! WindowHandle osCreateGroupBox(WindowHandle window) { ! GtkWidget *groupbox; ! groupbox = gtk_frame_new("kkkk"); ! gtk_container_add(GTK_CONTAINER(groupbox), port_layout_new(NULL,NULL)); ! port_layout_put(PORT_LAYOUT(GTK_BIN(window)->child), groupbox); gtk_widget_show_all(groupbox); Index: Internals.h =================================================================== RCS file: /cvsroot/htoolkit/port/src/cbits/GTK/Internals.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Internals.h 5 Jul 2003 11:01:16 -0000 1.4 --- Internals.h 1 Oct 2003 21:47:15 -0000 1.5 *************** *** 3,6 **** --- 3,7 ---- #include <config.h> + #include "LayoutContainer.h" extern BOOL gInKey; Index: Label.c =================================================================== RCS file: /cvsroot/htoolkit/port/src/cbits/GTK/Label.c,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** Label.c 24 Aug 2003 21:07:48 -0000 1.7 --- Label.c 1 Oct 2003 21:47:15 -0000 1.8 *************** *** 1,4 **** ! #include <Types.h> ! #include <Label.h> #include "Internals.h" #include "Handlers_stub.h" --- 1,3 ---- ! #include "Label.h" #include "Internals.h" #include "Handlers_stub.h" *************** *** 11,15 **** text = gtk_label_new(""); gtk_label_set_line_wrap(GTK_LABEL(text), gtk_false()); ! gtk_fixed_put(GTK_FIXED(GTK_BIN(GTK_BIN(window)->child)->child), text, 0, 0); gtk_widget_show(text); return text; --- 10,14 ---- text = gtk_label_new(""); gtk_label_set_line_wrap(GTK_LABEL(text), gtk_false()); ! port_layout_put(PORT_LAYOUT(GTK_BIN(window)->child), text); gtk_widget_show(text); return text; *************** *** 18,28 **** void osGetLabelReqSize(WindowHandle label, int *res) { - int w,h; GtkRequisition requisition; - gtk_widget_get_size_request(label, &w,&h); - gtk_widget_set_size_request(label, -1,-1); gtk_widget_size_request(label, &requisition); - gtk_widget_set_size_request(label, w, h); res[0] = requisition.width; --- 17,23 ---- Index: ListBox.c =================================================================== RCS file: /cvsroot/htoolkit/port/src/cbits/GTK/ListBox.c,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** ListBox.c 12 Jul 2003 08:41:38 -0000 1.8 --- ListBox.c 1 Oct 2003 21:47:15 -0000 1.9 *************** *** 46,50 **** sw); ! gtk_fixed_put(GTK_FIXED(GTK_BIN(GTK_BIN(window)->child)->child), sw, 0, 0); gtk_widget_show_all(sw); return sw; --- 46,50 ---- sw); ! port_layout_put(PORT_LAYOUT(GTK_BIN(window)->child), sw); gtk_widget_show_all(sw); return sw; Index: Notebook.c =================================================================== RCS file: /cvsroot/htoolkit/port/src/cbits/GTK/Notebook.c,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Notebook.c 31 Aug 2003 13:22:32 -0000 1.4 --- Notebook.c 1 Oct 2003 21:47:15 -0000 1.5 *************** *** 23,27 **** gtk_notebook_set_scrollable(GTK_NOTEBOOK(notebook), gtk_true()); gtk_notebook_popup_enable(GTK_NOTEBOOK(notebook)); ! gtk_fixed_put(GTK_FIXED(GTK_BIN(GTK_BIN(window)->child)->child), notebook, 0, 0); gtk_widget_show(notebook); --- 23,27 ---- gtk_notebook_set_scrollable(GTK_NOTEBOOK(notebook), gtk_true()); gtk_notebook_popup_enable(GTK_NOTEBOOK(notebook)); ! port_layout_put(PORT_LAYOUT(GTK_BIN(window)->child), notebook); gtk_widget_show(notebook); *************** *** 95,103 **** }; - static void notebook_page_size_allocate_handler(GtkWidget *widget, GtkAllocation *allocation, gpointer user_data) - { - handleContainerReLayout(widget); - }; - WindowHandle osInsertNotebookPage(WindowHandle notebook, int pos) { --- 95,98 ---- *************** *** 106,113 **** gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW(page), GTK_POLICY_NEVER, GTK_POLICY_NEVER); ! gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(page), gtk_fixed_new()); ! gtk_signal_connect (GTK_OBJECT(page), "size-allocate", ! GTK_SIGNAL_FUNC(notebook_page_size_allocate_handler), ! NULL); gtk_widget_show_all(page); --- 101,105 ---- gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW(page), GTK_POLICY_NEVER, GTK_POLICY_NEVER); ! gtk_container_add(GTK_CONTAINER(page), port_layout_new(NULL,NULL)); gtk_widget_show_all(page); Index: PopUp.c =================================================================== RCS file: /cvsroot/htoolkit/port/src/cbits/GTK/PopUp.c,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** PopUp.c 9 Jul 2003 17:17:00 -0000 1.6 --- PopUp.c 1 Oct 2003 21:47:15 -0000 1.7 *************** *** 19,23 **** GTK_SIGNAL_FUNC(handleLBoxClick), popup); ! gtk_fixed_put(GTK_FIXED(GTK_BIN(GTK_BIN(window)->child)->child), popup, 0, 0); gtk_widget_show(popup); return popup; --- 19,23 ---- GTK_SIGNAL_FUNC(handleLBoxClick), popup); ! port_layout_put(PORT_LAYOUT(GTK_BIN(window)->child), popup); gtk_widget_show(popup); return popup; Index: ProgressBar.c =================================================================== RCS file: /cvsroot/htoolkit/port/src/cbits/GTK/ProgressBar.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ProgressBar.c 29 Mar 2003 08:12:18 -0000 1.2 --- ProgressBar.c 1 Oct 2003 21:47:15 -0000 1.3 *************** *** 11,15 **** gtk_progress_bar_set_bar_style(GTK_PROGRESS_BAR(bar), bSmooth ? GTK_PROGRESS_CONTINUOUS : GTK_PROGRESS_DISCRETE); ! gtk_fixed_put(GTK_FIXED(GTK_BIN(GTK_BIN(window)->child)->child), bar, 0, 0); gtk_widget_show(bar); --- 11,15 ---- gtk_progress_bar_set_bar_style(GTK_PROGRESS_BAR(bar), bSmooth ? GTK_PROGRESS_CONTINUOUS : GTK_PROGRESS_DISCRETE); ! port_layout_put(PORT_LAYOUT(GTK_BIN(window)->child), bar); gtk_widget_show(bar); *************** *** 25,29 **** gtk_progress_bar_set_bar_style(GTK_PROGRESS_BAR(bar), bSmooth ? GTK_PROGRESS_CONTINUOUS : GTK_PROGRESS_DISCRETE); ! gtk_fixed_put(GTK_FIXED(GTK_BIN(GTK_BIN(window)->child)->child), bar, 0, 0); gtk_widget_show(bar); --- 25,29 ---- gtk_progress_bar_set_bar_style(GTK_PROGRESS_BAR(bar), bSmooth ? GTK_PROGRESS_CONTINUOUS : GTK_PROGRESS_DISCRETE); ! port_layout_put(PORT_LAYOUT(GTK_BIN(window)->child), bar); gtk_widget_show(bar); *************** *** 33,43 **** void osGetProgressBarReqSize(WindowHandle bar, int *res) { - int w,h; GtkRequisition requisition; - gtk_widget_get_size_request(bar, &w,&h); - gtk_widget_set_size_request(bar, -1,-1); gtk_widget_size_request(bar, &requisition); - gtk_widget_set_size_request(bar, w, h); res[0] = requisition.width; --- 33,39 ---- Index: RadioBox.c =================================================================== RCS file: /cvsroot/htoolkit/port/src/cbits/GTK/RadioBox.c,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** RadioBox.c 26 Aug 2003 20:00:55 -0000 1.8 --- RadioBox.c 1 Oct 2003 21:47:15 -0000 1.9 *************** *** 10,14 **** GTK_TOGGLE_BUTTON (radio_btn)->active = FALSE; ! gtk_fixed_put(GTK_FIXED(GTK_BIN(GTK_BIN(window)->child)->child), radio_btn, 0, 0); gtk_signal_connect (GTK_OBJECT (radio_btn), "toggled", GTK_SIGNAL_FUNC(handleControlCommand), --- 10,14 ---- GTK_TOGGLE_BUTTON (radio_btn)->active = FALSE; ! port_layout_put(PORT_LAYOUT(GTK_BIN(window)->child), radio_btn); gtk_signal_connect (GTK_OBJECT (radio_btn), "toggled", GTK_SIGNAL_FUNC(handleControlCommand), *************** *** 21,31 **** void osGetRadioBoxReqSize(WindowHandle radio, int *res) { - int w,h; GtkRequisition requisition; - gtk_widget_get_size_request(radio, &w,&h); - gtk_widget_set_size_request(radio, -1,-1); gtk_widget_size_request(radio, &requisition); - gtk_widget_set_size_request(radio, w, h); res[0] = requisition.width; --- 21,27 ---- Index: Slider.c =================================================================== RCS file: /cvsroot/htoolkit/port/src/cbits/GTK/Slider.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Slider.c 29 Mar 2003 08:12:18 -0000 1.2 --- Slider.c 1 Oct 2003 21:47:15 -0000 1.3 *************** *** 16,21 **** GTK_SIGNAL_FUNC(slider_adjustment_value_changed_handler), slider); - gtk_fixed_put(GTK_FIXED(GTK_BIN(GTK_BIN(window)->child)->child), slider, 0, 0); gtk_widget_show(slider); --- 16,21 ---- GTK_SIGNAL_FUNC(slider_adjustment_value_changed_handler), slider); + port_layout_put(PORT_LAYOUT(GTK_BIN(window)->child), slider); gtk_widget_show(slider); *************** *** 31,36 **** GTK_SIGNAL_FUNC(slider_adjustment_value_changed_handler), slider); ! ! gtk_fixed_put(GTK_FIXED(GTK_BIN(GTK_BIN(window)->child)->child), slider, 0, 0); gtk_widget_show(slider); --- 31,35 ---- GTK_SIGNAL_FUNC(slider_adjustment_value_changed_handler), slider); ! port_layout_put(PORT_LAYOUT(GTK_BIN(window)->child), slider); gtk_widget_show(slider); *************** *** 40,50 **** void osGetSliderReqSize(WindowHandle slider, int *res) { - int w,h; GtkRequisition requisition; - gtk_widget_get_size_request(slider, &w,&h); - gtk_widget_set_size_request(slider, -1,-1); gtk_widget_size_request(slider, &requisition); - gtk_widget_set_size_request(slider, w, h); res[0] = requisition.width; --- 39,45 ---- Index: Window.c =================================================================== RCS file: /cvsroot/htoolkit/port/src/cbits/GTK/Window.c,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** Window.c 25 Aug 2003 17:35:50 -0000 1.28 --- Window.c 1 Oct 2003 21:47:15 -0000 1.29 *************** *** 11,30 **** static void getWindowClipRect(GtkWidget *window, GdkRegion *region) { ! GtkFixed *fixed = GTK_FIXED(GTK_BIN(GTK_BIN(window)->child)->child); ! GList *childrens = gtk_container_get_children(GTK_CONTAINER(fixed)); while (childrens) { - GValue v; - GtkRequisition requisition; - GtkWidget *widget = (GtkWidget *) childrens->data; GdkRectangle rectangle; ! v.g_type = G_TYPE_INT; gtk_container_child_get_property(GTK_CONTAINER(fixed), widget, "x", &v); rectangle.x = v.data[0].v_int; ! v.g_type = G_TYPE_INT; gtk_container_child_get_property(GTK_CONTAINER(fixed), widget, "y", &v); rectangle.y = v.data[0].v_int; ! gtk_widget_size_request (widget, &requisition); ! rectangle.width = requisition.width; ! rectangle.height = requisition.height; ! gdk_region_subtract(region, gdk_region_rectangle (&rectangle)); --- 11,25 ---- static void getWindowClipRect(GtkWidget *window, GdkRegion *region) { ! GList *childrens = gtk_container_get_children(GTK_CONTAINER(GTK_BIN(window)->child)); while (childrens) { GdkRectangle rectangle; + GtkWidget *widget = (GtkWidget *) childrens->data; ! rectangle.x = widget->allocation.x; ! rectangle.y = widget->allocation.y; ! rectangle.width = widget->allocation.width; ! rectangle.height = widget->allocation.height; gdk_region_subtract(region, gdk_region_rectangle (&rectangle)); *************** *** 47,55 **** CanvasHandle canvas; GtkWidget *window = (GtkWidget *) user_data; ! GtkWidget *fixed = GTK_BIN(GTK_BIN(window)->child)->child; GdkGC *gc; gc = gdk_gc_new(event->window); ! gdk_gc_set_foreground(gc, &(gtk_widget_get_style(fixed)->bg[GTK_STATE_NORMAL])); gdk_gc_set_clip_region(gc, event->region); --- 42,50 ---- CanvasHandle canvas; GtkWidget *window = (GtkWidget *) user_data; ! GtkWidget *layout = GTK_BIN(window)->child; GdkGC *gc; gc = gdk_gc_new(event->window); ! gdk_gc_set_foreground(gc, &(gtk_widget_get_style(layout)->bg[GTK_STATE_NORMAL])); gdk_gc_set_clip_region(gc, event->region); *************** *** 188,208 **** } - static void window_size_allocate_handler (GtkWidget *widget, GtkAllocation *allocation, gpointer user_data) - { - static GtkWidget *last_widget = NULL; - static GtkAllocation last_allocation = {0,0}; - if (last_widget != widget || last_allocation.width != allocation->width || last_allocation.height != allocation->height) - { - last_allocation = *allocation; - last_widget = widget; - - handleWindowResize(widget,allocation->width-4,allocation->height-4); - handleContainerReLayout(widget); - } - }; - static WindowHandle create_generic_window() { ! GtkWidget *fixed, *sw, *viewport; /* Create a Scrolled Window */ --- 183,189 ---- } static WindowHandle create_generic_window() { ! GtkWidget *layout, *sw; /* Create a Scrolled Window */ *************** *** 214,220 **** GTK_SIGNAL_FUNC(window_delete_handler), NULL); - gtk_signal_connect (GTK_OBJECT(sw), "size-allocate", - GTK_SIGNAL_FUNC(window_size_allocate_handler), - NULL); gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw), --- 195,198 ---- *************** *** 224,254 **** /* Create a Fixed Container */ ! fixed = gtk_fixed_new(); ! gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(sw), fixed); ! ! viewport = GTK_BIN(sw)->child; ! gtk_widget_show(fixed); /* Signals */ ! gtk_signal_connect (GTK_OBJECT(fixed), "expose-event", GTK_SIGNAL_FUNC(window_expose_handler), sw); ! gtk_signal_connect (GTK_OBJECT(viewport), "button-press-event", GTK_SIGNAL_FUNC(window_button_press_handler), sw); ! gtk_signal_connect (GTK_OBJECT(viewport), "button-release-event", GTK_SIGNAL_FUNC(window_button_release_handler), sw); ! gtk_signal_connect (GTK_OBJECT(viewport), "motion_notify_event", GTK_SIGNAL_FUNC(window_motion_notify_handler), sw); ! gtk_signal_connect (GTK_OBJECT (gtk_viewport_get_hadjustment (GTK_VIEWPORT(viewport))), "value-changed", GTK_SIGNAL_FUNC(frame_adjustment_value_changed_handler), sw); ! gtk_signal_connect (GTK_OBJECT (gtk_viewport_get_vadjustment (GTK_VIEWPORT(viewport))), "value-changed", GTK_SIGNAL_FUNC(frame_adjustment_value_changed_handler), sw); ! return sw; } --- 202,230 ---- /* Create a Fixed Container */ ! layout = port_layout_new(NULL,NULL); ! gtk_container_add(GTK_CONTAINER(sw), layout); ! gtk_widget_show(layout); /* Signals */ ! gtk_signal_connect (GTK_OBJECT(layout), "expose-event", GTK_SIGNAL_FUNC(window_expose_handler), sw); ! gtk_signal_connect (GTK_OBJECT(layout), "button-press-event", GTK_SIGNAL_FUNC(window_button_press_handler), sw); ! gtk_signal_connect (GTK_OBJECT(layout), "button-release-event", GTK_SIGNAL_FUNC(window_button_release_handler), sw); ! gtk_signal_connect (GTK_OBJECT(layout), "motion_notify_event", GTK_SIGNAL_FUNC(window_motion_notify_handler), sw); ! gtk_signal_connect (GTK_OBJECT (port_layout_get_hadjustment (PORT_LAYOUT(layout))), "value-changed", GTK_SIGNAL_FUNC(frame_adjustment_value_changed_handler), sw); ! gtk_signal_connect (GTK_OBJECT (port_layout_get_vadjustment (PORT_LAYOUT(layout))), "value-changed", GTK_SIGNAL_FUNC(frame_adjustment_value_changed_handler), sw); ! return sw; } *************** *** 256,260 **** WindowHandle osCreateWindow() { ! GtkWidget *sw, *viewport; if (gDocumentInterface == 1 && gClientWidget != NULL) --- 232,236 ---- WindowHandle osCreateWindow() { ! GtkWidget *sw, *layout; if (gDocumentInterface == 1 && gClientWidget != NULL) *************** *** 262,266 **** sw = create_generic_window(); ! viewport = GTK_BIN(sw)->child; if (gDocumentInterface == 2) --- 238,242 ---- sw = create_generic_window(); ! layout = GTK_BIN(sw)->child; if (gDocumentInterface == 2) *************** *** 272,282 **** } - gtk_widget_realize(viewport); - gdk_window_set_events(viewport->window, gdk_window_get_events(viewport->window) - | GDK_BUTTON_RELEASE_MASK - | GDK_POINTER_MOTION_MASK - | GDK_ENTER_NOTIFY_MASK - | GDK_LEAVE_NOTIFY_MASK); - return sw; } --- 248,251 ---- *************** *** 367,371 **** WindowHandle osCreateDialog(WindowHandle parent) { ! GtkWidget *sw, *viewport, *frame; if (parent == NULL) --- 336,340 ---- WindowHandle osCreateDialog(WindowHandle parent) { ! GtkWidget *sw, *frame; if (parent == NULL) *************** *** 393,403 **** sw = create_generic_window(); - viewport = GTK_BIN(sw)->child; - gtk_container_add(GTK_CONTAINER(frame), sw); - gtk_widget_realize(viewport); - gdk_window_set_events(viewport->window, - gdk_window_get_events(viewport->window) | GDK_BUTTON_RELEASE_MASK | GDK_POINTER_MOTION_MASK | GDK_ENTER_NOTIFY_MASK | GDK_LEAVE_NOTIFY_MASK); return sw; } --- 362,367 ---- *************** *** 405,420 **** WindowHandle osCreateCompoundControl(WindowHandle form) { ! GtkWidget *sw, *viewport; sw = create_generic_window(); ! gtk_fixed_put(GTK_FIXED(GTK_BIN(GTK_BIN(form)->child)->child), sw, 0, 0); - viewport = GTK_BIN(sw)->child; - gtk_widget_realize(viewport); - gdk_window_set_events(viewport->window, gdk_window_get_events(viewport->window) - | GDK_BUTTON_RELEASE_MASK - | GDK_POINTER_MOTION_MASK - | GDK_ENTER_NOTIFY_MASK - | GDK_LEAVE_NOTIFY_MASK); gtk_widget_show_all(sw); --- 369,377 ---- WindowHandle osCreateCompoundControl(WindowHandle form) { ! GtkWidget *sw; sw = create_generic_window(); ! port_layout_put(PORT_LAYOUT(GTK_BIN(form)->child), sw); gtk_widget_show_all(sw); *************** *** 433,438 **** GdkColor fcolor; ! GtkWidget *fixed = GTK_BIN(GTK_BIN(window)->child)->child; ! GList *childrens = gtk_container_get_children(GTK_CONTAINER(fixed)); bcolor.pixel = 0; --- 390,395 ---- GdkColor fcolor; ! GtkWidget *layout = GTK_BIN(window)->child; ! GList *childrens = gtk_container_get_children(GTK_CONTAINER(layout)); bcolor.pixel = 0; *************** *** 446,450 **** fcolor.blue = ((foreColor >> 16) & 0xFF)*257; ! gtk_widget_modify_bg(fixed, GTK_STATE_NORMAL, &bcolor); while (childrens) --- 403,407 ---- fcolor.blue = ((foreColor >> 16) & 0xFF)*257; ! gtk_widget_modify_bg(layout, GTK_STATE_NORMAL, &bcolor); while (childrens) *************** *** 631,645 **** void osSetWindowDomainSize(WindowHandle window, int cx, int cy) { ! GtkAdjustment *adjustment; ! ! gtk_widget_set_size_request(GTK_BIN(GTK_BIN(window)->child)->child,cx,cy); ! ! adjustment = gtk_scrolled_window_get_hadjustment (GTK_SCROLLED_WINDOW(window)); ! adjustment->upper = cx; ! gtk_adjustment_changed(adjustment); ! ! adjustment = gtk_scrolled_window_get_vadjustment (GTK_SCROLLED_WINDOW(window)); ! adjustment->upper = cy; ! gtk_adjustment_changed(adjustment); } --- 588,592 ---- void osSetWindowDomainSize(WindowHandle window, int cx, int cy) { ! port_layout_set_domain(PORT_LAYOUT(GTK_BIN(window)->child), cx, cy); } *************** *** 783,803 **** void osMoveResizeControl(WindowHandle ctrl, int x, int y, int w, int h) { ! GtkWidget *fixed = gtk_widget_get_parent(ctrl); ! gtk_fixed_move(GTK_FIXED(fixed), ctrl, x, y); ! gtk_widget_set_size_request(ctrl, w, h); } void osGetControlRect(WindowHandle ctrl, int *res) { ! GValue v; ! GtkRequisition requisition; ! GtkContainer *container = GTK_CONTAINER(gtk_widget_get_parent(ctrl)); ! ! v.g_type = G_TYPE_INT; gtk_container_child_get_property(container, ctrl, "x", &v); res[0] = v.data[0].v_int; ! v.g_type = G_TYPE_INT; gtk_container_child_get_property(container, ctrl, "y", &v); res[1] = v.data[0].v_int; ! gtk_widget_size_request (ctrl, &requisition); ! res[2] = requisition.width; ! res[3] = requisition.height; } --- 730,748 ---- void osMoveResizeControl(WindowHandle ctrl, int x, int y, int w, int h) { ! GtkAllocation child_allocation; ! child_allocation.x = x; ! child_allocation.y = y; ! child_allocation.width = w; ! child_allocation.height = h; ! gtk_widget_size_allocate (ctrl, &child_allocation); } void osGetControlRect(WindowHandle ctrl, int *res) { ! res[0] = ctrl->allocation.x; ! res[1] = ctrl->allocation.y; ! res[2] = ctrl->allocation.width; ! res[3] = ctrl->allocation.height; } |
From: <kr_...@us...> - 2003-09-30 17:04:06
|
Update of /cvsroot/htoolkit/port In directory sc8-pr-cvs1:/tmp/cvs-serv8847 Modified Files: configure Log Message: Remove trace message from configure Index: configure =================================================================== RCS file: /cvsroot/htoolkit/port/configure,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** configure 9 Sep 2003 13:34:39 -0000 1.20 --- configure 30 Sep 2003 17:04:03 -0000 1.21 *************** *** 334,338 **** # create list of extra include directories needed, comma seperated and quoted. # expects $cincflags to be in the form: -Idir1 -Idir2 ... - echo $cincflags incdirs="\"$libdir/include\"" incopts="" --- 334,337 ---- |
From: <kr_...@us...> - 2003-09-27 09:49:33
|
Update of /cvsroot/htoolkit/HSQL/ODBC In directory sc8-pr-cvs1:/tmp/cvs-serv32583/ODBC Modified Files: HSQL.hsc Log Message: Add 'finally' to the import list in order to compile modified helper functions Index: HSQL.hsc =================================================================== RCS file: /cvsroot/htoolkit/HSQL/ODBC/HSQL.hsc,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** HSQL.hsc 27 Sep 2003 09:44:13 -0000 1.7 --- HSQL.hsc 27 Sep 2003 09:49:19 -0000 1.8 *************** *** 42,46 **** import qualified Foreign.Concurrent as C import Control.Monad(when,unless) ! import Control.Exception (throwDyn, catchDyn, dynExceptions, Exception(..)) import System.IO.Unsafe import System.Time --- 42,46 ---- import qualified Foreign.Concurrent as C import Control.Monad(when,unless) ! import Control.Exception (throwDyn, catchDyn, dynExceptions, Exception(..), finally) import System.IO.Unsafe import System.Time |
From: <kr_...@us...> - 2003-09-27 09:49:33
|
Update of /cvsroot/htoolkit/HSQL/MySQL In directory sc8-pr-cvs1:/tmp/cvs-serv32583/MySQL Modified Files: HSQL.hsc Log Message: Add 'finally' to the import list in order to compile modified helper functions Index: HSQL.hsc =================================================================== RCS file: /cvsroot/htoolkit/HSQL/MySQL/HSQL.hsc,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** HSQL.hsc 27 Sep 2003 09:44:13 -0000 1.9 --- HSQL.hsc 27 Sep 2003 09:49:19 -0000 1.10 *************** *** 31,35 **** import Foreign.C import Control.Monad(when,unless) ! import Control.Exception (throwDyn, catchDyn, dynExceptions, Exception(..)) import System.Time import System.IO.Unsafe --- 31,35 ---- import Foreign.C import Control.Monad(when,unless) ! import Control.Exception (throwDyn, catchDyn, dynExceptions, Exception(..), finally) import System.Time import System.IO.Unsafe |
From: <kr_...@us...> - 2003-09-27 09:49:33
|
Update of /cvsroot/htoolkit/HSQL/PostgreSQL In directory sc8-pr-cvs1:/tmp/cvs-serv32583/PostgreSQL Modified Files: HSQL.hsc Log Message: Add 'finally' to the import list in order to compile modified helper functions Index: HSQL.hsc =================================================================== RCS file: /cvsroot/htoolkit/HSQL/PostgreSQL/HSQL.hsc,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** HSQL.hsc 27 Sep 2003 09:44:13 -0000 1.9 --- HSQL.hsc 27 Sep 2003 09:49:19 -0000 1.10 *************** *** 41,45 **** import Foreign import Foreign.C ! import Control.Exception (throwDyn, catchDyn, dynExceptions, Exception(..)) import Control.Monad(when,unless,mplus) import System.Time --- 41,45 ---- import Foreign import Foreign.C ! import Control.Exception (throwDyn, catchDyn, dynExceptions, Exception(..), finally) import Control.Monad(when,unless,mplus) import System.Time |
From: <kr_...@us...> - 2003-09-27 09:44:27
|
Update of /cvsroot/htoolkit/HSQL/MySQL In directory sc8-pr-cvs1:/tmp/cvs-serv30505/MySQL Modified Files: HSQL.hsc Log Message: The helper functions now closes the statement even if the processing action raises an exeption Index: HSQL.hsc =================================================================== RCS file: /cvsroot/htoolkit/HSQL/MySQL/HSQL.hsc,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** HSQL.hsc 27 Sep 2003 09:12:13 -0000 1.8 --- HSQL.hsc 27 Sep 2003 09:44:13 -0000 1.9 *************** *** 475,499 **** -- | The 'forEachRow' function iterates through the result set in 'Statement' and ! -- executes the given action for each row in the set. After processing the last row ! -- the statement is automatically closed. forEachRow :: (Statement -> s -> IO s) -- ^ an action -> Statement -- ^ the statement -> s -- ^ initial state -> IO s -- ^ final state ! forEachRow f stmt s = do ! success <- fetch stmt ! if success then f stmt s >>= forEachRow f stmt else closeStatement stmt >> return s -- | The 'forEachRow\'' function is analogous to 'forEachRow' but doesn't provide state. forEachRow' :: (Statement -> IO ()) -> Statement -> IO () ! forEachRow' f stmt = do ! success <- fetch stmt ! if success then f stmt >> forEachRow' f stmt else closeStatement stmt -- | The 'collectRows' function iterates through the result set in 'Statement' and -- executes the given action for each row in the set. The values returned from action ! -- are collected and returned as list. collectRows :: (Statement -> IO a) -> Statement -> IO [a] ! collectRows f stmt = loop where loop = do --- 475,506 ---- -- | The 'forEachRow' function iterates through the result set in 'Statement' and ! -- executes the given action for each row in the set. The function closes the 'Statement' ! -- after the last row processing or if the given action raises an exception. forEachRow :: (Statement -> s -> IO s) -- ^ an action -> Statement -- ^ the statement -> s -- ^ initial state -> IO s -- ^ final state ! forEachRow f stmt s = loop s `finally` closeStatement stmt ! where ! loop s = do ! success <- fetch stmt ! if success then f stmt s >>= loop else return s -- | The 'forEachRow\'' function is analogous to 'forEachRow' but doesn't provide state. + -- The function closes the 'Statement' after the last row processing or if the given + -- action raises an exception. forEachRow' :: (Statement -> IO ()) -> Statement -> IO () ! forEachRow' f stmt = loop `finally` closeStatement stmt ! where ! loop = do ! success <- fetch stmt ! when success (f stmt >> loop) -- | The 'collectRows' function iterates through the result set in 'Statement' and -- executes the given action for each row in the set. The values returned from action ! -- are collected and returned as list. The function closes the 'Statement' after the ! -- last row processing or if the given action raises an exception. collectRows :: (Statement -> IO a) -> Statement -> IO [a] ! collectRows f stmt = loop `finally` closeStatement stmt where loop = do *************** *** 504,506 **** xs <- loop return (x:xs) ! else closeStatement stmt >> return [] --- 511,513 ---- xs <- loop return (x:xs) ! else return [] |
From: <kr_...@us...> - 2003-09-27 09:44:27
|
Update of /cvsroot/htoolkit/HSQL/PostgreSQL In directory sc8-pr-cvs1:/tmp/cvs-serv30505/PostgreSQL Modified Files: HSQL.hsc Log Message: The helper functions now closes the statement even if the processing action raises an exeption Index: HSQL.hsc =================================================================== RCS file: /cvsroot/htoolkit/HSQL/PostgreSQL/HSQL.hsc,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** HSQL.hsc 27 Sep 2003 09:42:28 -0000 1.8 --- HSQL.hsc 27 Sep 2003 09:44:13 -0000 1.9 *************** *** 623,647 **** -- | The 'forEachRow' function iterates through the result set in 'Statement' and ! -- executes the given action for each row in the set. After processing the last row ! -- the statement is automatically closed. forEachRow :: (Statement -> s -> IO s) -- ^ an action -> Statement -- ^ the statement -> s -- ^ initial state -> IO s -- ^ final state ! forEachRow f stmt s = do ! success <- fetch stmt ! if success then f stmt s >>= forEachRow f stmt else closeStatement stmt >> return s -- | The 'forEachRow\'' function is analogous to 'forEachRow' but doesn't provide state. forEachRow' :: (Statement -> IO ()) -> Statement -> IO () ! forEachRow' f stmt = do ! success <- fetch stmt ! if success then f stmt >> forEachRow' f stmt else closeStatement stmt -- | The 'collectRows' function iterates through the result set in 'Statement' and -- executes the given action for each row in the set. The values returned from action ! -- are collected and returned as list. collectRows :: (Statement -> IO a) -> Statement -> IO [a] ! collectRows f stmt = loop where loop = do --- 623,654 ---- -- | The 'forEachRow' function iterates through the result set in 'Statement' and ! -- executes the given action for each row in the set. The function closes the 'Statement' ! -- after the last row processing or if the given action raises an exception. forEachRow :: (Statement -> s -> IO s) -- ^ an action -> Statement -- ^ the statement -> s -- ^ initial state -> IO s -- ^ final state ! forEachRow f stmt s = loop s `finally` closeStatement stmt ! where ! loop s = do ! success <- fetch stmt ! if success then f stmt s >>= loop else return s -- | The 'forEachRow\'' function is analogous to 'forEachRow' but doesn't provide state. + -- The function closes the 'Statement' after the last row processing or if the given + -- action raises an exception. forEachRow' :: (Statement -> IO ()) -> Statement -> IO () ! forEachRow' f stmt = loop `finally` closeStatement stmt ! where ! loop = do ! success <- fetch stmt ! when success (f stmt >> loop) -- | The 'collectRows' function iterates through the result set in 'Statement' and -- executes the given action for each row in the set. The values returned from action ! -- are collected and returned as list. The function closes the 'Statement' after the ! -- last row processing or if the given action raises an exception. collectRows :: (Statement -> IO a) -> Statement -> IO [a] ! collectRows f stmt = loop `finally` closeStatement stmt where loop = do *************** *** 652,654 **** xs <- loop return (x:xs) ! else closeStatement stmt >> return [] --- 659,661 ---- xs <- loop return (x:xs) ! else return [] |
From: <kr_...@us...> - 2003-09-27 09:44:27
|
Update of /cvsroot/htoolkit/HSQL/ODBC In directory sc8-pr-cvs1:/tmp/cvs-serv30505/ODBC Modified Files: HSQL.hsc Log Message: The helper functions now closes the statement even if the processing action raises an exeption Index: HSQL.hsc =================================================================== RCS file: /cvsroot/htoolkit/HSQL/ODBC/HSQL.hsc,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** HSQL.hsc 27 Sep 2003 09:35:04 -0000 1.6 --- HSQL.hsc 27 Sep 2003 09:44:13 -0000 1.7 *************** *** 532,557 **** -- | The 'forEachRow' function iterates through the result set in 'Statement' and ! -- executes the given action for each row in the set. After processing the last row ! -- the statement is automatically closed. forEachRow :: (Statement -> s -> IO s) -- ^ an action -> Statement -- ^ the statement -> s -- ^ initial state -> IO s -- ^ final state ! forEachRow f stmt s = do ! success <- fetch stmt ! if success then f stmt s >>= forEachRow f stmt else closeStatement stmt >> return s -- | The 'forEachRow\'' function is analogous to 'forEachRow' but doesn't provide state. forEachRow' :: (Statement -> IO ()) -> Statement -> IO () ! forEachRow' f stmt = do ! success <- fetch stmt ! if success then f stmt >> forEachRow' f stmt else closeStatement stmt -- | The 'collectRows' function iterates through the result set in 'Statement' and -- executes the given action for each row in the set. The values returned from action ! -- are collected and returned as list. collectRows :: (Statement -> IO a) -> Statement -> IO [a] ! collectRows f stmt = loop ! where loop = do success <- fetch stmt --- 532,564 ---- -- | The 'forEachRow' function iterates through the result set in 'Statement' and ! -- executes the given action for each row in the set. The function closes the 'Statement' ! -- after the last row processing or if the given action raises an exception. forEachRow :: (Statement -> s -> IO s) -- ^ an action -> Statement -- ^ the statement -> s -- ^ initial state -> IO s -- ^ final state ! forEachRow f stmt s = loop s `finally` closeStatement stmt ! where ! loop s = do ! success <- fetch stmt ! if success then f stmt s >>= loop else return s -- | The 'forEachRow\'' function is analogous to 'forEachRow' but doesn't provide state. + -- The function closes the 'Statement' after the last row processing or if the given + -- action raises an exception. forEachRow' :: (Statement -> IO ()) -> Statement -> IO () ! forEachRow' f stmt = loop `finally` closeStatement stmt ! where ! loop = do ! success <- fetch stmt ! when success (f stmt >> loop) -- | The 'collectRows' function iterates through the result set in 'Statement' and -- executes the given action for each row in the set. The values returned from action ! -- are collected and returned as list. The function closes the 'Statement' after the ! -- last row processing or if the given action raises an exception. collectRows :: (Statement -> IO a) -> Statement -> IO [a] ! collectRows f stmt = loop `finally` closeStatement stmt ! where loop = do success <- fetch stmt *************** *** 561,563 **** xs <- loop return (x:xs) ! else closeStatement stmt >> return [] --- 568,570 ---- xs <- loop return (x:xs) ! else return [] |
From: <kr_...@us...> - 2003-09-27 09:42:42
|
Update of /cvsroot/htoolkit/HSQL/PostgreSQL In directory sc8-pr-cvs1:/tmp/cvs-serv30391 Modified Files: HSQL.hsc Log Message: formatting Index: HSQL.hsc =================================================================== RCS file: /cvsroot/htoolkit/HSQL/PostgreSQL/HSQL.hsc,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** HSQL.hsc 25 Sep 2003 17:20:01 -0000 1.7 --- HSQL.hsc 27 Sep 2003 09:42:28 -0000 1.8 *************** *** 14,40 **** module Database.PostgreSQL.HSQL ( SqlBind(..), SqlError(..), SqlType(..), Connection, Statement ! , catchSql -- :: IO a -> (SqlError -> IO a) -> IO a ! , handleSql -- :: (SqlError -> IO a) -> IO a -> IO a ! , sqlExceptions -- :: Exception -> Maybe SqlError ! , connect -- :: String -> String -> String -> IO Connection ! , disconnect -- :: Connection -> IO () ! , execute -- :: Connection -> String -> IO Statement ! , query -- :: Connection -> String -> IO () ! , closeStatement -- :: Statement -> IO () ! , fetch -- :: Statement -> IO Bool ! , inTransaction -- :: Connection -> (Connection -> IO a) -> IO a ! , getFieldValueMB -- :: SqlBind a => Statement -> String -> IO (Maybe a) ! , getFieldValue -- :: SqlBind a => Statement -> String -> IO a ! , getFieldValue' -- :: SqlBind a => Statement -> String -> a -> IO a ! , getFieldValueType -- :: Statement -> String -> (SqlType, Bool) ! , getFieldsTypes -- :: Statement -> [(String, SqlType, Bool)] ! , forEachRow -- :: (Statement -> s -> IO s) -> Statement -> s -> IO s ! , forEachRow' -- :: (Statement -> IO ()) -> Statement -> IO () ! , collectRows -- :: (Statement -> IO s) -> Statement -> IO [s] , Point(..), Line(..), Path(..), Box(..), Circle(..), Polygon(..) , INetAddr(..), MacAddr(..) ) where - import Data.Dynamic import Data.IORef --- 14,39 ---- module Database.PostgreSQL.HSQL ( SqlBind(..), SqlError(..), SqlType(..), Connection, Statement ! , catchSql -- :: IO a -> (SqlError -> IO a) -> IO a ! , handleSql -- :: (SqlError -> IO a) -> IO a -> IO a ! , sqlExceptions -- :: Exception -> Maybe SqlError ! , connect -- :: String -> String -> String -> IO Connection ! , disconnect -- :: Connection -> IO () ! , execute -- :: Connection -> String -> IO Statement ! , query -- :: Connection -> String -> IO () ! , closeStatement -- :: Statement -> IO () ! , fetch -- :: Statement -> IO Bool ! , inTransaction -- :: Connection -> (Connection -> IO a) -> IO a ! , getFieldValueMB -- :: SqlBind a => Statement -> String -> IO (Maybe a) ! , getFieldValue -- :: SqlBind a => Statement -> String -> IO a ! , getFieldValue' -- :: SqlBind a => Statement -> String -> a -> IO a ! , getFieldValueType -- :: Statement -> String -> (SqlType, Bool) ! , getFieldsTypes -- :: Statement -> [(String, SqlType, Bool)] ! , forEachRow -- :: (Statement -> s -> IO s) -> Statement -> s -> IO s ! , forEachRow' -- :: (Statement -> IO ()) -> Statement -> IO () ! , collectRows -- :: (Statement -> IO s) -> Statement -> IO [s] , Point(..), Line(..), Path(..), Box(..), Circle(..), Polygon(..) , INetAddr(..), MacAddr(..) ) where import Data.Dynamic import Data.IORef *************** *** 82,90 **** data Statement = Statement ! { pRes :: !PGresult , tupleIndex :: IORef Int ! , countTuples:: !Int ! , connection :: !Connection ! , fields :: ![FieldDef] } --- 81,89 ---- data Statement = Statement ! { pRes :: !PGresult , tupleIndex :: IORef Int ! , countTuples :: !Int ! , connection :: !Connection ! , fields :: ![FieldDef] } *************** *** 231,268 **** mkSqlType :: Oid -> Int -> SqlType ! mkSqlType (#const BPCHAROID) size = SqlChar (size-4) ! mkSqlType (#const VARCHAROID) size = SqlVarChar (size-4) ! mkSqlType (#const NAMEOID) size = SqlVarChar 31 ! mkSqlType (#const TEXTOID) size = SqlText ! mkSqlType (#const NUMERICOID) size = SqlNumeric ((size-4) `div` 0x10000) ((size-4) `mod` 0x10000) ! mkSqlType (#const INT2OID) size = SqlSmallInt ! mkSqlType (#const INT4OID) size = SqlInteger ! mkSqlType (#const FLOAT4OID) size = SqlReal ! mkSqlType (#const FLOAT8OID) size = SqlDouble ! mkSqlType (#const BOOLOID) size = SqlBool ! mkSqlType (#const BITOID) size = SqlBit size ! mkSqlType (#const VARBITOID) size = SqlVarBit size ! mkSqlType (#const BYTEAOID) size = SqlTinyInt ! mkSqlType (#const INT8OID) size = SqlBigInt ! mkSqlType (#const DATEOID) size = SqlDate ! mkSqlType (#const TIMEOID) size = SqlTime ! mkSqlType (#const TIMETZOID) size = SqlTimeTZ ! mkSqlType (#const ABSTIMEOID) size = SqlAbsTime ! mkSqlType (#const RELTIMEOID) size = SqlRelTime ! mkSqlType (#const INTERVALOID) size = SqlTimeInterval ! mkSqlType (#const TINTERVALOID) size = SqlAbsTimeInterval ! mkSqlType (#const TIMESTAMPOID) size = SqlTimeStamp ! mkSqlType (#const CASHOID) size = SqlMoney ! mkSqlType (#const INETOID) size = SqlINetAddr ! mkSqlType (#const 829) size = SqlMacAddr -- hack ! mkSqlType (#const CIDROID) size = SqlCIDRAddr ! mkSqlType (#const POINTOID) size = SqlPoint ! mkSqlType (#const LSEGOID) size = SqlLSeg ! mkSqlType (#const PATHOID) size = SqlPath ! mkSqlType (#const BOXOID) size = SqlBox ! mkSqlType (#const POLYGONOID) size = SqlPolygon ! mkSqlType (#const LINEOID) size = SqlLine ! mkSqlType (#const CIRCLEOID) size = SqlCircle ! mkSqlType (#const UNKNOWNOID) size = SqlUnknown -- | 'fetch' fetches the next rowset of data from the result set. --- 230,267 ---- mkSqlType :: Oid -> Int -> SqlType ! mkSqlType (#const BPCHAROID) size = SqlChar (size-4) ! mkSqlType (#const VARCHAROID) size = SqlVarChar (size-4) ! mkSqlType (#const NAMEOID) size = SqlVarChar 31 ! mkSqlType (#const TEXTOID) size = SqlText ! mkSqlType (#const NUMERICOID) size = SqlNumeric ((size-4) `div` 0x10000) ((size-4) `mod` 0x10000) ! mkSqlType (#const INT2OID) size = SqlSmallInt ! mkSqlType (#const INT4OID) size = SqlInteger ! mkSqlType (#const FLOAT4OID) size = SqlReal ! mkSqlType (#const FLOAT8OID) size = SqlDouble ! mkSqlType (#const BOOLOID) size = SqlBool ! mkSqlType (#const BITOID) size = SqlBit size ! mkSqlType (#const VARBITOID) size = SqlVarBit size ! mkSqlType (#const BYTEAOID) size = SqlTinyInt ! mkSqlType (#const INT8OID) size = SqlBigInt ! mkSqlType (#const DATEOID) size = SqlDate ! mkSqlType (#const TIMEOID) size = SqlTime ! mkSqlType (#const TIMETZOID) size = SqlTimeTZ ! mkSqlType (#const ABSTIMEOID) size = SqlAbsTime ! mkSqlType (#const RELTIMEOID) size = SqlRelTime ! mkSqlType (#const INTERVALOID) size = SqlTimeInterval ! mkSqlType (#const TINTERVALOID) size = SqlAbsTimeInterval ! mkSqlType (#const TIMESTAMPOID) size = SqlTimeStamp ! mkSqlType (#const CASHOID) size = SqlMoney ! mkSqlType (#const INETOID) size = SqlINetAddr ! mkSqlType (#const 829) size = SqlMacAddr -- hack ! mkSqlType (#const CIDROID) size = SqlCIDRAddr ! mkSqlType (#const POINTOID) size = SqlPoint ! mkSqlType (#const LSEGOID) size = SqlLSeg ! mkSqlType (#const PATHOID) size = SqlPath ! mkSqlType (#const BOXOID) size = SqlBox ! mkSqlType (#const POLYGONOID) size = SqlPolygon ! mkSqlType (#const LINEOID) size = SqlLine ! mkSqlType (#const CIRCLEOID) size = SqlCircle ! mkSqlType (#const UNKNOWNOID) size = SqlUnknown -- | 'fetch' fetches the next rowset of data from the result set. |
From: <kr_...@us...> - 2003-09-27 09:35:18
|
Update of /cvsroot/htoolkit/HSQL/ODBC In directory sc8-pr-cvs1:/tmp/cvs-serv29223 Modified Files: HSQL.hsc Log Message: formatting Index: HSQL.hsc =================================================================== RCS file: /cvsroot/htoolkit/HSQL/ODBC/HSQL.hsc,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** HSQL.hsc 25 Sep 2003 17:20:01 -0000 1.5 --- HSQL.hsc 27 Sep 2003 09:35:04 -0000 1.6 *************** *** 14,35 **** module Database.ODBC.HSQL ( SqlBind(..), SqlError(..), SqlType(..), Connection, Statement ! , catchSql -- :: IO a -> (SqlError -> IO a) -> IO a ! , handleSql -- :: (SqlError -> IO a) -> IO a -> IO a ! , sqlExceptions -- :: Exception -> Maybe SqlError ! , connect -- :: String -> String -> String -> IO Connection ! , disconnect -- :: Connection -> IO () ! , execute -- :: Connection -> String -> IO () ! , query -- :: Connection -> String -> IO Statement , closeStatement -- :: Statement -> IO () ! , fetch -- :: Statement -> IO Bool ! , inTransaction -- :: Connection -> (Connection -> IO a) -> IO a ! , getFieldValueMB -- :: SqlBind a => Statement -> String -> IO (Maybe a) ! , getFieldValue -- :: SqlBind a => Statement -> String -> IO a ! , getFieldValue' -- :: SqlBind a => Statement -> String -> a -> IO a ! , getFieldValueType -- :: Statement -> String -> (SqlType, Bool) ! , getFieldsTypes -- :: Statement -> [(String, SqlType, Bool)] ! , forEachRow -- :: (Statement -> s -> IO s) -> Statement -> s -> IO s ! , forEachRow' -- :: (Statement -> IO ()) -> Statement -> IO () ! , collectRows -- :: (Statement -> IO s) -> Statement -> IO [s] ) where --- 14,35 ---- module Database.ODBC.HSQL ( SqlBind(..), SqlError(..), SqlType(..), Connection, Statement ! , catchSql -- :: IO a -> (SqlError -> IO a) -> IO a ! , handleSql -- :: (SqlError -> IO a) -> IO a -> IO a ! , sqlExceptions -- :: Exception -> Maybe SqlError ! , connect -- :: String -> String -> String -> IO Connection ! , disconnect -- :: Connection -> IO () ! , execute -- :: Connection -> String -> IO () ! , query -- :: Connection -> String -> IO Statement , closeStatement -- :: Statement -> IO () ! , fetch -- :: Statement -> IO Bool ! , inTransaction -- :: Connection -> (Connection -> IO a) -> IO a ! , getFieldValueMB -- :: SqlBind a => Statement -> String -> IO (Maybe a) ! , getFieldValue -- :: SqlBind a => Statement -> String -> IO a ! , getFieldValue' -- :: SqlBind a => Statement -> String -> a -> IO a ! , getFieldValueType -- :: Statement -> String -> (SqlType, Bool) ! , getFieldsTypes -- :: Statement -> [(String, SqlType, Bool)] ! , forEachRow -- :: (Statement -> s -> IO s) -> Statement -> s -> IO s ! , forEachRow' -- :: (Statement -> IO ()) -> Statement -> IO () ! , collectRows -- :: (Statement -> IO s) -> Statement -> IO [s] ) where *************** *** 133,137 **** | SqlNeedData | SqlBadTypeCast ! { seFieldName :: String , seFieldType :: SqlType } --- 133,137 ---- | SqlNeedData | SqlBadTypeCast ! { seFieldName :: String , seFieldType :: SqlType } *************** *** 288,309 **** mkSqlType :: SQLSMALLINT -> SQLULEN -> SQLSMALLINT -> (SqlType, SQLINTEGER) ! mkSqlType (#const SQL_CHAR) size _ = (SqlChar (fromIntegral size), (#const sizeof(SQLCHAR))*(fromIntegral size+1)) ! mkSqlType (#const SQL_VARCHAR) size _ = (SqlVarChar (fromIntegral size), (#const sizeof(SQLCHAR))*(fromIntegral size+1)) ! mkSqlType (#const SQL_LONGVARCHAR) size _ = (SqlLongVarChar (fromIntegral size), 1) -- dummy bufSize ! mkSqlType (#const SQL_DECIMAL) size prec = (SqlDecimal (fromIntegral size) (fromIntegral prec), (#const sizeof(SQLDOUBLE))) ! mkSqlType (#const SQL_NUMERIC) size prec = (SqlNumeric (fromIntegral size) (fromIntegral prec), (#const sizeof(SQLDOUBLE))) ! mkSqlType (#const SQL_SMALLINT) _ _ = (SqlSmallInt, (#const sizeof(SQLSMALLINT))) ! mkSqlType (#const SQL_INTEGER) _ _ = (SqlInteger, (#const sizeof(SQLINTEGER))) ! mkSqlType (#const SQL_REAL) _ _ = (SqlReal, (#const sizeof(SQLDOUBLE))) ! mkSqlType (#const SQL_DOUBLE) _ _ = (SqlDouble, (#const sizeof(SQLDOUBLE))) ! mkSqlType (#const SQL_BIT) _ _ = (SqlBit, (#const sizeof(SQLINTEGER))) ! mkSqlType (#const SQL_TINYINT) _ _ = (SqlTinyInt, (#const sizeof(SQLSMALLINT))) ! mkSqlType (#const SQL_BIGINT) _ _ = (SqlBigInt, (#const sizeof(SQLINTEGER))) ! mkSqlType (#const SQL_BINARY) size _ = (SqlBinary (fromIntegral size), (#const sizeof(SQLCHAR))*(fromIntegral size+1)) ! mkSqlType (#const SQL_VARBINARY) size _ = (SqlVarBinary (fromIntegral size), (#const sizeof(SQLCHAR))*(fromIntegral size+1)) ! mkSqlType (#const SQL_LONGVARBINARY)size _ = (SqlLongVarBinary (fromIntegral size), 1) -- dummy bufSize ! mkSqlType (#const SQL_DATE) _ _ = (SqlDate, (#const sizeof(SQL_DATE_STRUCT))) ! mkSqlType (#const SQL_TIME) _ _ = (SqlTime, (#const sizeof(SQL_TIME_STRUCT))) ! mkSqlType (#const SQL_TIMESTAMP) _ _ = (SqlTimeStamp, (#const sizeof(SQL_TIMESTAMP_STRUCT))) --- 288,309 ---- mkSqlType :: SQLSMALLINT -> SQLULEN -> SQLSMALLINT -> (SqlType, SQLINTEGER) ! mkSqlType (#const SQL_CHAR) size _ = (SqlChar (fromIntegral size), (#const sizeof(SQLCHAR))*(fromIntegral size+1)) ! mkSqlType (#const SQL_VARCHAR) size _ = (SqlVarChar (fromIntegral size), (#const sizeof(SQLCHAR))*(fromIntegral size+1)) ! mkSqlType (#const SQL_LONGVARCHAR) size _ = (SqlLongVarChar (fromIntegral size), 1) -- dummy bufSize ! mkSqlType (#const SQL_DECIMAL) size prec = (SqlDecimal (fromIntegral size) (fromIntegral prec), (#const sizeof(SQLDOUBLE))) ! mkSqlType (#const SQL_NUMERIC) size prec = (SqlNumeric (fromIntegral size) (fromIntegral prec), (#const sizeof(SQLDOUBLE))) ! mkSqlType (#const SQL_SMALLINT) _ _ = (SqlSmallInt, (#const sizeof(SQLSMALLINT))) ! mkSqlType (#const SQL_INTEGER) _ _ = (SqlInteger, (#const sizeof(SQLINTEGER))) ! mkSqlType (#const SQL_REAL) _ _ = (SqlReal, (#const sizeof(SQLDOUBLE))) ! mkSqlType (#const SQL_DOUBLE) _ _ = (SqlDouble, (#const sizeof(SQLDOUBLE))) ! mkSqlType (#const SQL_BIT) _ _ = (SqlBit, (#const sizeof(SQLINTEGER))) ! mkSqlType (#const SQL_TINYINT) _ _ = (SqlTinyInt, (#const sizeof(SQLSMALLINT))) ! mkSqlType (#const SQL_BIGINT) _ _ = (SqlBigInt, (#const sizeof(SQLINTEGER))) ! mkSqlType (#const SQL_BINARY) size _ = (SqlBinary (fromIntegral size), (#const sizeof(SQLCHAR))*(fromIntegral size+1)) ! mkSqlType (#const SQL_VARBINARY) size _ = (SqlVarBinary (fromIntegral size), (#const sizeof(SQLCHAR))*(fromIntegral size+1)) ! mkSqlType (#const SQL_LONGVARBINARY)size _ = (SqlLongVarBinary (fromIntegral size), 1) -- dummy bufSize ! mkSqlType (#const SQL_DATE) _ _ = (SqlDate, (#const sizeof(SQL_DATE_STRUCT))) ! mkSqlType (#const SQL_TIME) _ _ = (SqlTime, (#const sizeof(SQL_TIME_STRUCT))) ! mkSqlType (#const SQL_TIMESTAMP) _ _ = (SqlTimeStamp, (#const sizeof(SQL_TIMESTAMP_STRUCT))) *************** *** 431,435 **** score = showChar '-' space = showChar ' ' ! colon = showChar ':' foreign import ccall unsafe mktime :: Ptr () -> IO CTime --- 431,435 ---- score = showChar '-' space = showChar ' ' ! colon = showChar ':' foreign import ccall unsafe mktime :: Ptr () -> IO CTime *************** *** 469,490 **** targetType = case sqlType of ! SqlBit -> (#const SQL_C_BIT) ! SqlTinyInt -> (#const SQL_C_UTINYINT) ! SqlSmallInt -> (#const SQL_C_SSHORT) ! SqlInteger -> (#const SQL_C_SLONG) ! SqlReal -> (#const SQL_C_FLOAT) ! SqlDouble -> (#const SQL_C_DOUBLE) ! SqlDate -> (#const SQL_C_TIMESTAMP) ! SqlTime -> (#const SQL_C_TIMESTAMP) ! SqlTimeStamp -> (#const SQL_C_TIMESTAMP) ! SqlNumeric _ _ -> (#const SQL_C_DOUBLE) ! SqlDecimal _ _ -> (#const SQL_C_DOUBLE) ! SqlBigInt -> (#const SQL_C_CHAR) ! SqlChar _ -> (#const SQL_C_CHAR) ! SqlVarChar _ -> (#const SQL_C_CHAR) ! SqlBinary _ -> (#const SQL_C_BINARY) ! SqlVarBinary _ -> (#const SQL_C_BINARY) ! SqlLongVarChar _ -> (#const SQL_C_CHAR) ! SqlLongVarBinary _ -> (#const SQL_C_BINARY) -- | Retrieves the value of field with the specified name. --- 469,490 ---- targetType = case sqlType of ! SqlBit -> (#const SQL_C_BIT) ! SqlTinyInt -> (#const SQL_C_UTINYINT) ! SqlSmallInt -> (#const SQL_C_SSHORT) ! SqlInteger -> (#const SQL_C_SLONG) ! SqlReal -> (#const SQL_C_FLOAT) ! SqlDouble -> (#const SQL_C_DOUBLE) ! SqlDate -> (#const SQL_C_TIMESTAMP) ! SqlTime -> (#const SQL_C_TIMESTAMP) ! SqlTimeStamp -> (#const SQL_C_TIMESTAMP) ! SqlNumeric _ _ -> (#const SQL_C_DOUBLE) ! SqlDecimal _ _ -> (#const SQL_C_DOUBLE) ! SqlBigInt -> (#const SQL_C_CHAR) ! SqlChar _ -> (#const SQL_C_CHAR) ! SqlVarChar _ -> (#const SQL_C_CHAR) ! SqlBinary _ -> (#const SQL_C_BINARY) ! SqlVarBinary _ -> (#const SQL_C_BINARY) ! SqlLongVarChar _ -> (#const SQL_C_CHAR) ! SqlLongVarBinary _ -> (#const SQL_C_BINARY) -- | Retrieves the value of field with the specified name. |
From: <kr_...@us...> - 2003-09-27 09:12:26
|
Update of /cvsroot/htoolkit/HSQL/MySQL In directory sc8-pr-cvs1:/tmp/cvs-serv25038 Modified Files: HSQL.hsc Log Message: Fix encoding for SQL string. The fix allows to pass strings with zeros to MySQL Index: HSQL.hsc =================================================================== RCS file: /cvsroot/htoolkit/HSQL/MySQL/HSQL.hsc,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** HSQL.hsc 27 Sep 2003 09:10:09 -0000 1.7 --- HSQL.hsc 27 Sep 2003 09:12:13 -0000 1.8 *************** *** 317,320 **** --- 317,321 ---- mapChar '\r' s = '\\':'r' :s mapChar '\t' s = '\\':'t' :s + mapChar '\NUL' s = '\\':'0' :s mapChar c s = c :s |
From: <kr_...@us...> - 2003-09-27 09:10:25
|
Update of /cvsroot/htoolkit/HSQL/MySQL In directory sc8-pr-cvs1:/tmp/cvs-serv24891 Modified Files: HSQL.hsc Log Message: formatting Index: HSQL.hsc =================================================================== RCS file: /cvsroot/htoolkit/HSQL/MySQL/HSQL.hsc,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** HSQL.hsc 25 Sep 2003 17:51:32 -0000 1.6 --- HSQL.hsc 27 Sep 2003 09:10:09 -0000 1.7 *************** *** 3,25 **** module Database.MySQL.HSQL ( SqlBind(..), SqlError(..), SqlType(..), Connection, Statement ! , catchSql -- :: IO a -> (SqlError -> IO a) -> IO a ! , handleSql -- :: (SqlError -> IO a) -> IO a -> IO a ! , sqlExceptions -- :: Exception -> Maybe SqlError ! , connect -- :: String -> String -> String -> IO Connection ! , disconnect -- :: Connection -> IO () ! , execute -- :: Connection -> String -> IO () ! , query -- :: Connection -> String -> IO Statement ! , closeStatement -- :: Statement -> IO () ! , fetch -- :: Statement -> IO Bool ! , inTransaction -- :: Connection -> (Connection -> IO a) -> IO a ! , getFieldValueMB -- :: SqlBind a => Statement -> String -> IO (Maybe a) ! , getFieldValue -- :: SqlBind a => Statement -> String -> IO a ! , getFieldValue' -- :: SqlBind a => Statement -> String -> a -> IO a ! , getFieldValueType -- :: Statement -> String -> (SqlType, Bool) ! , getFieldsTypes -- :: Statement -> [(String, SqlType, Bool)] ! , forEachRow -- :: (Statement -> s -> IO s) -> Statement -> s -> IO s ! , forEachRow' -- :: (Statement -> IO ()) -> Statement -> IO () ! , collectRows -- :: (Statement -> IO s) -> Statement -> IO [s] ! ) where --- 3,25 ---- module Database.MySQL.HSQL ( SqlBind(..), SqlError(..), SqlType(..), Connection, Statement ! , catchSql -- :: IO a -> (SqlError -> IO a) -> IO a ! , handleSql -- :: (SqlError -> IO a) -> IO a -> IO a ! , sqlExceptions -- :: Exception -> Maybe SqlError ! , connect -- :: String -> String -> String -> IO Connection ! , disconnect -- :: Connection -> IO () ! , execute -- :: Connection -> String -> IO () ! , query -- :: Connection -> String -> IO Statement ! , closeStatement -- :: Statement -> IO () ! , fetch -- :: Statement -> IO Bool ! , inTransaction -- :: Connection -> (Connection -> IO a) -> IO a ! , getFieldValueMB -- :: SqlBind a => Statement -> String -> IO (Maybe a) ! , getFieldValue -- :: SqlBind a => Statement -> String -> IO a ! , getFieldValue' -- :: SqlBind a => Statement -> String -> a -> IO a ! , getFieldValueType -- :: Statement -> String -> (SqlType, Bool) ! , getFieldsTypes -- :: Statement -> [(String, SqlType, Bool)] ! , forEachRow -- :: (Statement -> s -> IO s) -> Statement -> s -> IO s ! , forEachRow' -- :: (Statement -> IO ()) -> Statement -> IO () ! , collectRows -- :: (Statement -> IO s) -> Statement -> IO [s] ! ) where *************** *** 65,72 **** data Statement = Statement ! { pRes :: !MYSQL_RES ! , connection :: !Connection ! , fields :: ![FieldDef] ! , currRow :: IORef (MYSQL_ROW, MYSQL_LENGTHS) } --- 65,72 ---- data Statement = Statement ! { pRes :: !MYSQL_RES ! , connection :: !Connection ! , fields :: ![FieldDef] ! , currRow :: IORef (MYSQL_ROW, MYSQL_LENGTHS) } *************** *** 75,81 **** data SqlType ! = SqlChar Int ! | SqlVarChar Int ! | SqlNumeric Int Int | SqlSmallInt | SqlMedInt --- 75,81 ---- data SqlType ! = SqlChar Int ! | SqlVarChar Int ! | SqlNumeric Int Int | SqlSmallInt | SqlMedInt *************** *** 199,221 **** mkSqlType :: Int -> Int -> Int -> SqlType ! mkSqlType (#const FIELD_TYPE_STRING ) size _ = SqlChar size ! mkSqlType (#const FIELD_TYPE_VAR_STRING) size _ = SqlVarChar size ! mkSqlType (#const FIELD_TYPE_DECIMAL) size prec = SqlNumeric size prec ! mkSqlType (#const FIELD_TYPE_SHORT) _ _ = SqlSmallInt ! mkSqlType (#const FIELD_TYPE_INT24) _ _ = SqlMedInt ! mkSqlType (#const FIELD_TYPE_LONG) _ _ = SqlInteger ! mkSqlType (#const FIELD_TYPE_FLOAT) _ _ = SqlReal ! mkSqlType (#const FIELD_TYPE_DOUBLE ) _ _ = SqlDouble ! mkSqlType (#const FIELD_TYPE_TINY) _ _ = SqlTinyInt ! mkSqlType (#const FIELD_TYPE_LONGLONG) _ _ = SqlBigInt ! mkSqlType (#const FIELD_TYPE_DATE ) _ _ = SqlDate ! mkSqlType (#const FIELD_TYPE_TIME ) _ _ = SqlTime ! mkSqlType (#const FIELD_TYPE_TIMESTAMP ) _ _ = SqlTimeStamp ! mkSqlType (#const FIELD_TYPE_DATETIME) _ _ = SqlDateTime ! mkSqlType (#const FIELD_TYPE_YEAR) _ _ = SqlYear ! mkSqlType (#const FIELD_TYPE_BLOB) _ _ = SqlBLOB ! mkSqlType (#const FIELD_TYPE_SET) _ _ = SqlSET ! mkSqlType (#const FIELD_TYPE_ENUM) _ _ = SqlENUM ! mkSqlType (#const FIELD_TYPE_NULL) _ _ = SqlUnknown -- | 'fetch' fetches the next rowset of data from the result set. --- 199,221 ---- mkSqlType :: Int -> Int -> Int -> SqlType ! mkSqlType (#const FIELD_TYPE_STRING) size _ = SqlChar size ! mkSqlType (#const FIELD_TYPE_VAR_STRING) size _ = SqlVarChar size ! mkSqlType (#const FIELD_TYPE_DECIMAL) size prec = SqlNumeric size prec ! mkSqlType (#const FIELD_TYPE_SHORT) _ _ = SqlSmallInt ! mkSqlType (#const FIELD_TYPE_INT24) _ _ = SqlMedInt ! mkSqlType (#const FIELD_TYPE_LONG) _ _ = SqlInteger ! mkSqlType (#const FIELD_TYPE_FLOAT) _ _ = SqlReal ! mkSqlType (#const FIELD_TYPE_DOUBLE) _ _ = SqlDouble ! mkSqlType (#const FIELD_TYPE_TINY) _ _ = SqlTinyInt ! mkSqlType (#const FIELD_TYPE_LONGLONG) _ _ = SqlBigInt ! mkSqlType (#const FIELD_TYPE_DATE) _ _ = SqlDate ! mkSqlType (#const FIELD_TYPE_TIME) _ _ = SqlTime ! mkSqlType (#const FIELD_TYPE_TIMESTAMP) _ _ = SqlTimeStamp ! mkSqlType (#const FIELD_TYPE_DATETIME) _ _ = SqlDateTime ! mkSqlType (#const FIELD_TYPE_YEAR) _ _ = SqlYear ! mkSqlType (#const FIELD_TYPE_BLOB) _ _ = SqlBLOB ! mkSqlType (#const FIELD_TYPE_SET) _ _ = SqlSET ! mkSqlType (#const FIELD_TYPE_ENUM) _ _ = SqlENUM ! mkSqlType (#const FIELD_TYPE_NULL) _ _ = SqlUnknown -- | 'fetch' fetches the next rowset of data from the result set. *************** *** 312,321 **** toSqlValue s = '\'' : foldr mapChar "'" s where ! mapChar '\\' s = '\\':'\\':s ! mapChar '\'' s = '\\':'\'':s ! mapChar '\n' s = '\\':'n':s ! mapChar '\r' s = '\\':'r':s ! mapChar '\t' s = '\\':'t':s ! mapChar c s = c:s instance SqlBind Double where --- 312,321 ---- toSqlValue s = '\'' : foldr mapChar "'" s where ! mapChar '\\' s = '\\':'\\':s ! mapChar '\'' s = '\\':'\'':s ! mapChar '\n' s = '\\':'n' :s ! mapChar '\r' s = '\\':'r' :s ! mapChar '\t' s = '\\':'t' :s ! mapChar c s = c :s instance SqlBind Double where *************** *** 331,339 **** unsafePerformIO $ do allocaBytes (#const sizeof(struct tm)) $ \ p_tm -> do ! (#poke struct tm,tm_sec ) p_tm (fromIntegral sec :: CInt) ! (#poke struct tm,tm_min ) p_tm (fromIntegral min :: CInt) (#poke struct tm,tm_hour ) p_tm (fromIntegral hour :: CInt) ! (#poke struct tm,tm_mday) p_tm (fromIntegral mday :: CInt) ! (#poke struct tm,tm_mon ) p_tm (fromIntegral (mon-1) :: CInt) (#poke struct tm,tm_year ) p_tm (fromIntegral (year-1900) :: CInt) (#poke struct tm,tm_isdst) p_tm (-1 :: CInt) --- 331,339 ---- unsafePerformIO $ do allocaBytes (#const sizeof(struct tm)) $ \ p_tm -> do ! (#poke struct tm,tm_sec ) p_tm (fromIntegral sec :: CInt) ! (#poke struct tm,tm_min ) p_tm (fromIntegral min :: CInt) (#poke struct tm,tm_hour ) p_tm (fromIntegral hour :: CInt) ! (#poke struct tm,tm_mday ) p_tm (fromIntegral mday :: CInt) ! (#poke struct tm,tm_mon ) p_tm (fromIntegral (mon-1) :: CInt) (#poke struct tm,tm_year ) p_tm (fromIntegral (year-1900) :: CInt) (#poke struct tm,tm_isdst) p_tm (-1 :: CInt) *************** *** 427,434 **** then return Nothing else do ! mv <- fromNonNullSqlCStringLen sqlType pValue len ! case mv of ! Just v -> return (Just v) ! Nothing -> throwDyn (SqlBadTypeCast name sqlType) -- | Retrieves the value of field with the specified name. --- 427,434 ---- then return Nothing else do ! mv <- fromNonNullSqlCStringLen sqlType pValue len ! case mv of ! Just v -> return (Just v) ! Nothing -> throwDyn (SqlBadTypeCast name sqlType) -- | Retrieves the value of field with the specified name. *************** *** 441,445 **** case mb_v of Nothing -> throwDyn (SqlFetchNull name) ! Just a -> return a -- | Retrieves the value of field with the specified name. --- 441,445 ---- case mb_v of Nothing -> throwDyn (SqlFetchNull name) ! Just a -> return a -- | Retrieves the value of field with the specified name. *************** *** 467,471 **** findFieldInfo name (fieldDef@(name',sqlType,nullable):fields) colNumber | name == name' = (sqlType,nullable,colNumber) ! | otherwise = findFieldInfo name fields $! (colNumber+1) ----------------------------------------------------------------------------------------- --- 467,471 ---- findFieldInfo name (fieldDef@(name',sqlType,nullable):fields) colNumber | name == name' = (sqlType,nullable,colNumber) ! | otherwise = findFieldInfo name fields $! (colNumber+1) ----------------------------------------------------------------------------------------- |
From: <kr_...@us...> - 2003-09-25 17:51:36
|
Update of /cvsroot/htoolkit/HSQL/MySQL In directory sc8-pr-cvs1:/tmp/cvs-serv15123 Modified Files: HSQL.hsc Log Message: Allow fetching of strings with null characters. As side effect this will speedup fetching of columns of type Int. Index: HSQL.hsc =================================================================== RCS file: /cvsroot/htoolkit/HSQL/MySQL/HSQL.hsc,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** HSQL.hsc 25 Sep 2003 17:20:01 -0000 1.5 --- HSQL.hsc 25 Sep 2003 17:51:32 -0000 1.6 *************** *** 44,47 **** --- 44,48 ---- type MYSQL_FIELD = Ptr () type MYSQL_ROW = Ptr CString + type MYSQL_LENGTHS = Ptr CULong foreign import ccall "mysql.h mysql_init" mysql_init :: MYSQL -> IO MYSQL *************** *** 55,58 **** --- 56,63 ---- foreign import ccall "mysql.h mysql_free_result" mysql_free_result :: MYSQL_RES -> IO () foreign import ccall "mysql.h mysql_fetch_row" mysql_fetch_row :: MYSQL_RES -> IO MYSQL_ROW + foreign import ccall "mysql.h mysql_fetch_lengths" mysql_fetch_lengths :: MYSQL_RES -> IO MYSQL_LENGTHS + + foreign import ccall "stdlib.h atoi" c_atoi :: CString -> IO Int + foreign import ccall "stdlib.h strtoll" c_strtoll :: CString -> Ptr CString -> Int -> IO Int64 newtype Connection = Connection MYSQL *************** *** 61,67 **** = Statement { pRes :: !MYSQL_RES ! , connection :: !Connection ! , fields :: ![FieldDef] ! , currRow :: IORef MYSQL_ROW } --- 66,72 ---- = Statement { pRes :: !MYSQL_RES ! , connection :: !Connection ! , fields :: ![FieldDef] ! , currRow :: IORef (MYSQL_ROW, MYSQL_LENGTHS) } *************** *** 168,172 **** res <- withCString query (mysql_query pMYSQL) when (res /= 0) (handleSqlError pMYSQL) ! currRow <- newIORef nullPtr pRes <- mysql_use_result pMYSQL if (pRes == nullPtr) --- 173,177 ---- res <- withCString query (mysql_query pMYSQL) when (res /= 0) (handleSqlError pMYSQL) ! currRow <- newIORef (nullPtr, nullPtr) pRes <- mysql_use_result pMYSQL if (pRes == nullPtr) *************** *** 221,225 **** | otherwise = do pRow <- mysql_fetch_row pRes ! writeIORef currRow pRow return (pRow /= nullPtr) --- 226,231 ---- | otherwise = do pRow <- mysql_fetch_row pRes ! pLengths <- mysql_fetch_lengths pRes ! writeIORef currRow (pRow, pLengths) return (pRow /= nullPtr) *************** *** 252,261 **** --- 258,298 ---- class SqlBind a where + -- This allows for faster conversion for eq. integral numeric types, etc. + -- Default version uses fromSqlValue. + fromNonNullSqlCStringLen :: SqlType -> CString -> Int -> IO (Maybe a) + fromNonNullSqlCStringLen sqlType cstr cstrLen = do + str <- peekCStringLen (cstr, cstrLen) + return (fromSqlValue sqlType str) + fromSqlValue :: SqlType -> String -> Maybe a toSqlValue :: a -> String instance SqlBind Int where + fromNonNullSqlCStringLen sqlType cstr cstrLen = do + if sqlType==SqlInteger || sqlType==SqlSmallInt + then do + val <- c_atoi cstr + return (Just val) + else + return Nothing + + fromSqlValue SqlInteger s = Just (read s) + fromSqlValue SqlSmallInt s = Just (read s) + fromSqlValue _ s = Nothing + + toSqlValue val = show val + + instance SqlBind Int64 where + fromNonNullSqlCStringLen sqlType cstr cstrLen = do + if sqlType==SqlInteger || sqlType==SqlSmallInt || sqlType==SqlBigInt + then do + val <- c_strtoll cstr nullPtr 10 + return (Just val) + else + return Nothing + fromSqlValue SqlInteger s = Just (read s) fromSqlValue SqlSmallInt s = Just (read s) + fromSqlValue SqlBigInt s = Just (read s) fromSqlValue _ s = Nothing *************** *** 379,400 **** -- | Retrieves the value of field with the specified name. -- The returned value is Nothing if the field value is @null@. ! getFieldValueMB :: SqlBind a => Statement ! -> String -- ^ Field name ! -> IO (Maybe a) -- ^ Field value or Nothing getFieldValueMB (Statement {currRow=currRow, fields=fieldDefs}) name = do ! row <- readIORef currRow let (sqlType,nullable,colNumber) = findFieldInfo name fieldDefs 0 pValue <- peekElemOff row colNumber if pValue == nullPtr then return Nothing else do ! value <- peekCString pValue ! case fromSqlValue sqlType value of ! Just v -> return (Just v) ! Nothing -> throwDyn (SqlBadTypeCast name sqlType) -- | Retrieves the value of field with the specified name. -- If the field value is @null@ then the function will throw 'SqlFetchNull' exception. ! getFieldValue :: SqlBind a => Statement -> String -- ^ Field name -> IO a -- ^ Field value --- 416,438 ---- -- | Retrieves the value of field with the specified name. -- The returned value is Nothing if the field value is @null@. ! getFieldValueMB :: SqlBind a => Statement ! -> String -- ^ Field name ! -> IO (Maybe a) -- ^ Field value or Nothing getFieldValueMB (Statement {currRow=currRow, fields=fieldDefs}) name = do ! (row, lengths) <- readIORef currRow let (sqlType,nullable,colNumber) = findFieldInfo name fieldDefs 0 pValue <- peekElemOff row colNumber + len <- fmap fromIntegral (peekElemOff lengths colNumber) if pValue == nullPtr then return Nothing else do ! mv <- fromNonNullSqlCStringLen sqlType pValue len ! case mv of ! Just v -> return (Just v) ! Nothing -> throwDyn (SqlBadTypeCast name sqlType) -- | Retrieves the value of field with the specified name. -- If the field value is @null@ then the function will throw 'SqlFetchNull' exception. ! getFieldValue :: SqlBind a => Statement -> String -- ^ Field name -> IO a -- ^ Field value *************** *** 407,411 **** -- | Retrieves the value of field with the specified name. -- If the field value is @null@ then the function will return the default value. ! getFieldValue' :: SqlBind a => Statement -> String -- ^ Field name -> a -- ^ Default field value --- 445,449 ---- -- | Retrieves the value of field with the specified name. -- If the field value is @null@ then the function will return the default value. ! getFieldValue' :: SqlBind a => Statement -> String -- ^ Field name -> a -- ^ Default field value |
From: <kr_...@us...> - 2003-09-25 17:20:05
|
Update of /cvsroot/htoolkit/HSQL/PostgreSQL In directory sc8-pr-cvs1:/tmp/cvs-serv31537/PostgreSQL Modified Files: HSQL.hsc Log Message: bugfix Index: HSQL.hsc =================================================================== RCS file: /cvsroot/htoolkit/HSQL/PostgreSQL/HSQL.hsc,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** HSQL.hsc 25 Sep 2003 16:45:30 -0000 1.6 --- HSQL.hsc 25 Sep 2003 17:20:01 -0000 1.7 *************** *** 606,610 **** getFieldValueType stmt name = sqlType where ! (sqlType,colNumber) = findFieldInfo name (fields stmt) 1 -- | Returns the list of fields with their types and @nullable@ flags --- 606,610 ---- getFieldValueType stmt name = sqlType where ! (sqlType,colNumber) = findFieldInfo name (fields stmt) 0 -- | Returns the list of fields with their types and @nullable@ flags |
From: <kr_...@us...> - 2003-09-25 17:20:05
|
Update of /cvsroot/htoolkit/HSQL/ODBC In directory sc8-pr-cvs1:/tmp/cvs-serv31537/ODBC Modified Files: HSQL.hsc Log Message: bugfix Index: HSQL.hsc =================================================================== RCS file: /cvsroot/htoolkit/HSQL/ODBC/HSQL.hsc,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** HSQL.hsc 25 Sep 2003 16:45:30 -0000 1.4 --- HSQL.hsc 25 Sep 2003 17:20:01 -0000 1.5 *************** *** 515,519 **** getFieldValueType stmt name = (sqlType, nullable) where ! (sqlType,nullable,colNumber) = findFieldInfo name (fields stmt) 1 -- | Returns the list of fields with their types and @nullable@ flags --- 515,519 ---- getFieldValueType stmt name = (sqlType, nullable) where ! (sqlType,nullable,colNumber) = findFieldInfo name (fields stmt) 0 -- | Returns the list of fields with their types and @nullable@ flags |
From: <kr_...@us...> - 2003-09-25 17:20:05
|
Update of /cvsroot/htoolkit/HSQL/MySQL In directory sc8-pr-cvs1:/tmp/cvs-serv31537/MySQL Modified Files: HSQL.hsc Log Message: bugfix Index: HSQL.hsc =================================================================== RCS file: /cvsroot/htoolkit/HSQL/MySQL/HSQL.hsc,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** HSQL.hsc 25 Sep 2003 16:45:30 -0000 1.4 --- HSQL.hsc 25 Sep 2003 17:20:01 -0000 1.5 *************** *** 419,423 **** getFieldValueType stmt name = (sqlType, nullable) where ! (sqlType,nullable,colNumber) = findFieldInfo name (fields stmt) 1 -- | Returns the list of fields with their types and @nullable@ flags --- 419,423 ---- getFieldValueType stmt name = (sqlType, nullable) where ! (sqlType,nullable,colNumber) = findFieldInfo name (fields stmt) 0 -- | Returns the list of fields with their types and @nullable@ flags |
From: <kr_...@us...> - 2003-09-25 16:45:35
|
Update of /cvsroot/htoolkit/HSQL/PostgreSQL In directory sc8-pr-cvs1:/tmp/cvs-serv17503/PostgreSQL Modified Files: HSQL.hsc Log Message: Force strict evaluation in findFieldInfo Index: HSQL.hsc =================================================================== RCS file: /cvsroot/htoolkit/HSQL/PostgreSQL/HSQL.hsc,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** HSQL.hsc 7 Sep 2003 22:57:25 -0000 1.5 --- HSQL.hsc 25 Sep 2003 16:45:30 -0000 1.6 *************** *** 616,620 **** findFieldInfo name (fieldDef@(name',sqlType):fields) colNumber | name == name' = (sqlType,colNumber) ! | otherwise = findFieldInfo name fields (colNumber+1) --- 616,620 ---- findFieldInfo name (fieldDef@(name',sqlType):fields) colNumber | name == name' = (sqlType,colNumber) ! | otherwise = findFieldInfo name fields $! (colNumber+1) |
From: <kr_...@us...> - 2003-09-25 16:45:34
|
Update of /cvsroot/htoolkit/HSQL/MySQL In directory sc8-pr-cvs1:/tmp/cvs-serv17503/MySQL Modified Files: HSQL.hsc Log Message: Force strict evaluation in findFieldInfo Index: HSQL.hsc =================================================================== RCS file: /cvsroot/htoolkit/HSQL/MySQL/HSQL.hsc,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** HSQL.hsc 25 Sep 2003 16:32:49 -0000 1.3 --- HSQL.hsc 25 Sep 2003 16:45:30 -0000 1.4 *************** *** 429,433 **** findFieldInfo name (fieldDef@(name',sqlType,nullable):fields) colNumber | name == name' = (sqlType,nullable,colNumber) ! | otherwise = findFieldInfo name fields (colNumber+1) ----------------------------------------------------------------------------------------- --- 429,433 ---- findFieldInfo name (fieldDef@(name',sqlType,nullable):fields) colNumber | name == name' = (sqlType,nullable,colNumber) ! | otherwise = findFieldInfo name fields $! (colNumber+1) ----------------------------------------------------------------------------------------- |
From: <kr_...@us...> - 2003-09-25 16:45:34
|
Update of /cvsroot/htoolkit/HSQL/ODBC In directory sc8-pr-cvs1:/tmp/cvs-serv17503/ODBC Modified Files: HSQL.hsc Log Message: Force strict evaluation in findFieldInfo Index: HSQL.hsc =================================================================== RCS file: /cvsroot/htoolkit/HSQL/ODBC/HSQL.hsc,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** HSQL.hsc 7 Sep 2003 22:57:25 -0000 1.3 --- HSQL.hsc 25 Sep 2003 16:45:30 -0000 1.4 *************** *** 525,529 **** findFieldInfo name (fieldDef@(name',sqlType,nullable):fields) colNumber | name == name' = (sqlType,nullable,colNumber) ! | otherwise = findFieldInfo name fields (colNumber+1) ----------------------------------------------------------------------------------------- --- 525,529 ---- findFieldInfo name (fieldDef@(name',sqlType,nullable):fields) colNumber | name == name' = (sqlType,nullable,colNumber) ! | otherwise = findFieldInfo name fields $! (colNumber+1) ----------------------------------------------------------------------------------------- |
From: <kr_...@us...> - 2003-09-25 16:32:53
|
Update of /cvsroot/htoolkit/HSQL/MySQL In directory sc8-pr-cvs1:/tmp/cvs-serv14750 Modified Files: HSQL.hsc Log Message: Remove unused imports Index: HSQL.hsc =================================================================== RCS file: /cvsroot/htoolkit/HSQL/MySQL/HSQL.hsc,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** HSQL.hsc 7 Sep 2003 22:57:25 -0000 1.2 --- HSQL.hsc 25 Sep 2003 16:32:49 -0000 1.3 *************** *** 36,43 **** import Text.ParserCombinators.ReadP import Text.Read - #ifdef ENABLED_GUI - import Graphics.UI.HGUI.BasicTypes - import Graphics.UI.HGUI.BasicClasses - #endif #include <mysql.h> --- 36,39 ---- |