[Gnucash-changes] Prepare for wrapping gnc-hooks APIs.

Derek Atkins warlord at cvs.gnucash.org
Sun Jun 12 15:05:27 EDT 2005


Log Message:
-----------
Prepare for wrapping gnc-hooks APIs.

	* src/engine/gw-engine-spec.scm:
	  use gnc-hooks-scm.h header
	* src/engine/gnc-hooks.[ch]:
	  Fix APIs..  Even though we return 'const' don't say we do.

Tags:
----
gnucash-gnome2-dev

Modified Files:
--------------
    gnucash:
        ChangeLog
    gnucash/src/engine:
        gnc-hooks.c
        gnc-hooks.h
        gw-engine-spec.scm

Revision Data
-------------
Index: ChangeLog
===================================================================
RCS file: /home/cvs/cvsroot/gnucash/ChangeLog,v
retrieving revision 1.1487.2.227
retrieving revision 1.1487.2.228
diff -LChangeLog -LChangeLog -u -r1.1487.2.227 -r1.1487.2.228
--- ChangeLog
+++ ChangeLog
@@ -8,6 +8,11 @@
 	* src/engine/gnc-hooks.c:
 	  Use ENTER/LEAVE macros instead of commented printfs
 
+	* src/engine/gw-engine-spec.scm:
+	  use gnc-hooks-scm.h header
+	* src/engine/gnc-hooks.[ch]:
+	  Fix APIs..  Even though we return 'const' don't say we do.
+
 2005-06-11  David Hampton  <hampton at employees.org>
 
 	* src/gnome-utils/gnc-plugin-manager.[ch]: Take ownership of
Index: gw-engine-spec.scm
===================================================================
RCS file: /home/cvs/cvsroot/gnucash/src/engine/gw-engine-spec.scm,v
retrieving revision 1.53.4.9
retrieving revision 1.53.4.10
diff -Lsrc/engine/gw-engine-spec.scm -Lsrc/engine/gw-engine-spec.scm -u -r1.53.4.9 -r1.53.4.10
--- src/engine/gw-engine-spec.scm
+++ src/engine/gw-engine-spec.scm
@@ -38,7 +38,7 @@
     "#include <qofbackend.h>\n"
     "#include <qofbook.h>\n"
     "#include <qofsession.h>\n"
-    "#include <gnc-hooks.h>\n"
+    "#include <gnc-hooks-scm.h>\n"
     "#include <engine-helpers.h>\n")))
 
 (gw:wrapset-add-cs-initializers!
@@ -2491,10 +2491,14 @@
  '(((gw:glist-of (<gw:mchars> callee-owned) callee-owned) choices))
  "Takes a list of installed Finance::Quote souces and records it internally.")
 
-  (gw:wrap-function
-   ws
-   'gnc:run-c-hook
-   '<gw:void>
-   "gnc_hook_run"
-   '(((<gw:mchars> caller-owned) name) (<gw:void*> data))
-   "Run a callback hook in the C domain.")
+;;
+;; gnc-hooks-scm.h
+;;   (and gnc-hooks.h)
+;;
+(gw:wrap-function
+ ws
+ 'gnc:run-c-hook
+ '<gw:void>
+ "gnc_hook_run"
+ '(((<gw:mchars> caller-owned) name) (<gw:void*> data))
+ "Run a callback hook in the C domain.")
Index: gnc-hooks.h
===================================================================
RCS file: /home/cvs/cvsroot/gnucash/src/engine/Attic/gnc-hooks.h,v
retrieving revision 1.1.2.5
retrieving revision 1.1.2.6
diff -Lsrc/engine/gnc-hooks.h -Lsrc/engine/gnc-hooks.h -u -r1.1.2.5 -r1.1.2.6
--- src/engine/gnc-hooks.h
+++ src/engine/gnc-hooks.h
@@ -30,13 +30,13 @@
  * The returned string is just the 'name' argument,
  * which belongs to the caller.
  */
-const gchar * gnc_hook_create(const gchar *name, const gchar *desc);
+gchar * gnc_hook_create(const gchar *name, const gchar *desc);
 
 /**
  * lookup the description of a hook.  returned description belongs to
  * the hook and not the caller
  */
-const gchar * gnc_hook_get_description(const gchar *name);
+gchar * gnc_hook_get_description(const gchar *name);
 
 /**
  * add and remove C-style dangers from a hook.  The callback is called
Index: gnc-hooks.c
===================================================================
RCS file: /home/cvs/cvsroot/gnucash/src/engine/Attic/gnc-hooks.c,v
retrieving revision 1.1.2.5
retrieving revision 1.1.2.6
diff -Lsrc/engine/gnc-hooks.c -Lsrc/engine/gnc-hooks.c -u -r1.1.2.5 -r1.1.2.6
--- src/engine/gnc-hooks.c
+++ src/engine/gnc-hooks.c
@@ -46,7 +46,7 @@
   SCM		proc;
 } GncScmDangler;
 
-const gchar *
+gchar *
 gnc_hook_create (const gchar *name, const gchar *desc)
 {
   GncHook *hook_list;
@@ -63,7 +63,7 @@
   hook_list = g_hash_table_lookup(gnc_hooks_list, name);
   if (hook_list) {
     LEAVE("List %s(%p) already exists", name, hook_list);
-    return(name);
+    return((gchar*)name);
   }
 
   hook_list = g_new0(GncHook, 1);
@@ -75,7 +75,7 @@
   g_hash_table_insert(gnc_hooks_list, (gchar *)name, hook_list);
 
   LEAVE("created list %s(%p)", name, hook_list);
-  return name;
+  return (gchar *)name;
 }
 
 static GncHook *
@@ -94,7 +94,7 @@
   return(hook);
 }
 
-const gchar *
+gchar *
 gnc_hook_get_description(const gchar *name)
 {
   GncHook *hook;
@@ -107,7 +107,7 @@
   }
 
   LEAVE("desc: %s", hook->desc);
-  return hook->desc;
+  return (gchar*) hook->desc;
 }
 
 void


More information about the gnucash-changes mailing list