Revision: 62172
          http://sourceforge.net/p/brlcad/code/62172
Author:   starseeker
Date:     2014-08-15 15:43:31 +0000 (Fri, 15 Aug 2014)
Log Message:
-----------
Will need a way to associate user hook functions with variables that doesn't 
involve an all-up structparse table

Modified Paths:
--------------
    brlcad/branches/dm-work/include/bu/parse.h
    brlcad/branches/dm-work/src/mged/dm-ogl.c

Modified: brlcad/branches/dm-work/include/bu/parse.h
===================================================================
--- brlcad/branches/dm-work/include/bu/parse.h  2014-08-15 15:33:15 UTC (rev 
62171)
+++ brlcad/branches/dm-work/include/bu/parse.h  2014-08-15 15:43:31 UTC (rev 
62172)
@@ -152,6 +152,20 @@
 
 #define BU_STRUCTPARSE_FUNC_NULL ((void(*)(const struct bu_structparse *, 
const char *, void *, const char *, void *))0)
 
+/* There are situations (such as the usage pattern in libdm)
+ * where applications may want to associate structparse
+ * functions with variables but not set up a full structparse
+ * table. */
+struct bu_structparse_map {
+    const char *sp_name;
+    void (*sp_hook)(const struct bu_structparse *,
+                   const char *,
+                   void *,
+                   const char *,
+                   void *);    /**< Optional hooked function, or indir ptr */
+    void *data; /* Data (if any) needed by hook function */
+};
+
 /**
  * assert the integrity of a bu_structparse struct.
  */

Modified: brlcad/branches/dm-work/src/mged/dm-ogl.c
===================================================================
--- brlcad/branches/dm-work/src/mged/dm-ogl.c   2014-08-15 15:33:15 UTC (rev 
62171)
+++ brlcad/branches/dm-work/src/mged/dm-ogl.c   2014-08-15 15:43:31 UTC (rev 
62172)
@@ -94,6 +94,21 @@
 static void bound_hook(const struct bu_structparse *, const char *, void *, 
const char *, void *);
 static void boundFlag_hook(const struct bu_structparse *, const char *, void 
*, const char *, void *);
 
+struct bu_structparse_map ogl_vparse_map[] = {
+    {"depthcue",       Ogl_colorchange,        NULL },
+    {"zclip",          zclip_hook,             NULL },
+    {"zbuffer",                establish_zbuffer,      NULL },
+    {"lighting",       establish_lighting,     NULL },
+    {"transparency",   establish_transparency, NULL },
+    {"fastfog",                do_fogHint,             NULL },
+    {"density",                dirty_hook,             NULL },
+    {"debug",          debug_hook,             NULL },
+    {"log",            logfile_hook,           NULL },
+    {"bound",          bound_hook,             NULL },
+    {"useBound",       boundFlag_hook,         NULL },
+    {(char *)0,                BU_STRUCTPARSE_FUNC_NULL, NULL }
+};
+
 struct bu_structparse Ogl_vparse[] = {
     {"%d",  1, "depthcue",             Ogl_MV_O(cueing_on),    
Ogl_colorchange, NULL, NULL },
     {"%d",  1, "zclip",                Ogl_MV_O(zclipping_on), zclip_hook, 
NULL, NULL },

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits

Reply via email to