Revision: 56811
          http://sourceforge.net/p/brlcad/code/56811
Author:   starseeker
Date:     2013-08-13 21:20:26 +0000 (Tue, 13 Aug 2013)
Log Message:
-----------
Start inching towards the new db_search API.  Move the to-be-deprecated search 
header contents into their own file.  Can't flag them yet because they are 
still used.

Modified Paths:
--------------
    brlcad/trunk/include/CMakeLists.txt
    brlcad/trunk/include/raytrace.h
    brlcad/trunk/src/librt/search.c

Added Paths:
-----------
    brlcad/trunk/include/raytrace_deprecated_db_search.h

Modified: brlcad/trunk/include/CMakeLists.txt
===================================================================
--- brlcad/trunk/include/CMakeLists.txt 2013-08-13 20:52:19 UTC (rev 56810)
+++ brlcad/trunk/include/CMakeLists.txt 2013-08-13 21:20:26 UTC (rev 56811)
@@ -8,6 +8,7 @@
   magic.h
   pstdint.h
   raytrace.h
+  raytrace_deprecated_db_search.h
   rt/defines.h
   rtfunc.h
   rtgeom.h

Modified: brlcad/trunk/include/raytrace.h
===================================================================
--- brlcad/trunk/include/raytrace.h     2013-08-13 20:52:19 UTC (rev 56810)
+++ brlcad/trunk/include/raytrace.h     2013-08-13 21:20:26 UTC (rev 56811)
@@ -3651,101 +3651,11 @@
 RT_EXPORT extern int db_full_path_search(const struct db_full_path *a,
                                         const struct directory *dp);
 
-/**
- * search the database using a supplied list of filter criteria.
- * db_search_full_paths returns a bu_list of db_full_path structs to
- * instances of objects matching the filter criteria.  Note that this is
- * a full path tree search of the entire database, not just the toplevel
- * objects that would be reported by the ls command.  E.g., a
- * database with the following objects:
- *
- *       r1            r2
- *       |             |
- *       s1            s1
- *
- * would, if searched from the top level for s1,  return both
- *
- *  /r1/s1
- *
- * and
- *
- *  /r2/s1
- *
- * instead of just s1.  To iterate over the results, see examples of
- * iterating over bu_list structures.  (Bear in mind the db_full_path
- * structures in the list are individually malloced.)
- *
- * To return only unique objects, use
- * db_search_unique_objects, which would return just
- *
- * s1
- *
- * in the above example.  db_search_unique_objects returns a bu_ptbl of
- * (struct directory *) pointers.  To iterate over this list use
- * BU_PTBL_LEN to get the size of the table and BU_PTBL_GET in a for
- * loop to access each element.
- *
- */
 
-/* search.c */
+/* Include the following until the old search API has been properly deprecated 
*/
+#include "raytrace_deprecated_db_search.h"
 
-struct db_full_path_list {
-    struct bu_list l;
-    struct db_full_path *path;
-    int local;
-};
-
 /**
- * Add an object to the db_full_path_list based on its database object name
- */
-RT_EXPORT extern int db_full_path_list_add(const char *path, int local, struct 
db_i *dbip, struct db_full_path_list *path_list);
-
-/**
- * Free all entries and the list of a db_full_path_list
- */
-RT_EXPORT extern void db_free_full_path_list(struct db_full_path_list 
*path_list);
-
-/**
- * Low level command to process the command line and create a "plan" 
corresponding to the
- * command arguments.
- */
-RT_EXPORT extern void *db_search_formplan(char **argv,
-                                         struct db_i *dbip,
-                                         struct rt_wdb *wdbp);
-
-/**
- * release memory for the formulated plan returned by
- * db_search_formplan().
- */
-RT_EXPORT extern void db_search_freeplan(void **plan);
-
-/**
- * Low level routines for invocation of search plans
- */
-RT_EXPORT extern struct db_full_path_list *db_search_full_paths(void 
*searchplan,
-                                                               struct 
db_full_path_list *path_list,
-                                                               struct db_i 
*dbip,
-                                                               struct rt_wdb 
*wdbp);
-
-RT_EXPORT extern struct bu_ptbl *db_search_unique_objects(void *searchplan,
-                                                         struct 
db_full_path_list *path_list,
-                                                         struct db_i *dbip,
-                                                         struct rt_wdb *wdbp);
-
-/**
- * Use the string form of a search plan to build and execute a search
- */
-RT_EXPORT extern struct db_full_path_list *db_search_full_paths_strplan(const 
char *plan_string,
-                                                               struct 
db_full_path_list *path_list,
-                                                               struct db_i 
*dbip,
-                                                               struct rt_wdb 
*wdbp);
-
-RT_EXPORT extern struct bu_ptbl *db_search_unique_objects_strplan(const char 
*plan_string,
-                                                         struct 
db_full_path_list *path_list,
-                                                         struct db_i *dbip,
-                                                         struct rt_wdb *wdbp);
-
-/**
  * TODO:  PROPOSED API for search functionality
  *
  * This is the proposed replacement to all of the preceding search 
functionality -
@@ -3803,6 +3713,7 @@
                                           struct rt_wdb *wdbp,
                                           int search_type);
 
+
 /* db_open.c */
 /**
  * D B _ S Y N C

Added: brlcad/trunk/include/raytrace_deprecated_db_search.h
===================================================================
--- brlcad/trunk/include/raytrace_deprecated_db_search.h                        
        (rev 0)
+++ brlcad/trunk/include/raytrace_deprecated_db_search.h        2013-08-13 
21:20:26 UTC (rev 56811)
@@ -0,0 +1,98 @@
+/* Deprecated search API, included by raytrace.h until time to remove it */
+
+
+/**
+ * search the database using a supplied list of filter criteria.
+ * db_search_full_paths returns a bu_list of db_full_path structs to
+ * instances of objects matching the filter criteria.  Note that this is
+ * a full path tree search of the entire database, not just the toplevel
+ * objects that would be reported by the ls command.  E.g., a
+ * database with the following objects:
+ *
+ *       r1            r2
+ *       |             |
+ *       s1            s1
+ *
+ * would, if searched from the top level for s1,  return both
+ *
+ *  /r1/s1
+ *
+ * and
+ *
+ *  /r2/s1
+ *
+ * instead of just s1.  To iterate over the results, see examples of
+ * iterating over bu_list structures.  (Bear in mind the db_full_path
+ * structures in the list are individually malloced.)
+ *
+ * To return only unique objects, use
+ * db_search_unique_objects, which would return just
+ *
+ * s1
+ *
+ * in the above example.  db_search_unique_objects returns a bu_ptbl of
+ * (struct directory *) pointers.  To iterate over this list use
+ * BU_PTBL_LEN to get the size of the table and BU_PTBL_GET in a for
+ * loop to access each element.
+ *
+ */
+
+/* search.c */
+
+struct db_full_path_list {
+    struct bu_list l;
+    struct db_full_path *path;
+    int local;
+};
+
+/**
+ * Add an object to the db_full_path_list based on its database object name
+ */
+RT_EXPORT extern int db_full_path_list_add(const char *path, int local, struct 
db_i *dbip, struct db_full_path_list *path_list);
+
+/**
+ * Free all entries and the list of a db_full_path_list
+ */
+RT_EXPORT extern void db_free_full_path_list(struct db_full_path_list 
*path_list);
+
+/**
+ * Low level command to process the command line and create a "plan" 
corresponding to the
+ * command arguments.
+ */
+RT_EXPORT extern void *db_search_formplan(char **argv,
+                                         struct db_i *dbip,
+                                         struct rt_wdb *wdbp);
+
+/**
+ * release memory for the formulated plan returned by
+ * db_search_formplan().
+ */
+RT_EXPORT extern void db_search_freeplan(void **plan);
+
+/**
+ * Low level routines for invocation of search plans
+ */
+RT_EXPORT extern struct db_full_path_list *db_search_full_paths(void 
*searchplan,
+                                                               struct 
db_full_path_list *path_list,
+                                                               struct db_i 
*dbip,
+                                                               struct rt_wdb 
*wdbp);
+
+RT_EXPORT extern struct bu_ptbl *db_search_unique_objects(void *searchplan,
+                                                         struct 
db_full_path_list *path_list,
+                                                         struct db_i *dbip,
+                                                         struct rt_wdb *wdbp);
+
+/**
+ * Use the string form of a search plan to build and execute a search
+ */
+RT_EXPORT extern struct db_full_path_list *db_search_full_paths_strplan(const 
char *plan_string,
+                                                               struct 
db_full_path_list *path_list,
+                                                               struct db_i 
*dbip,
+                                                               struct rt_wdb 
*wdbp);
+
+RT_EXPORT extern struct bu_ptbl *db_search_unique_objects_strplan(const char 
*plan_string,
+                                                         struct 
db_full_path_list *path_list,
+                                                         struct db_i *dbip,
+                                                         struct rt_wdb *wdbp);
+
+


Property changes on: brlcad/trunk/include/raytrace_deprecated_db_search.h
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Modified: brlcad/trunk/src/librt/search.c
===================================================================
--- brlcad/trunk/src/librt/search.c     2013-08-13 20:52:19 UTC (rev 56810)
+++ brlcad/trunk/src/librt/search.c     2013-08-13 21:20:26 UTC (rev 56811)
@@ -2264,8 +2264,38 @@
     return results;
 }
 
+/*
+struct bu_ptbl *
+db_search(const char *plan_string,
+       const char *path_strings[],
+       struct rt_wdb *wdbp,
+       int search_type)
+{
+    struct bu_ptbl *search_results = NULL;
+    void *dbplan;
+    char **plan_argv = (char **)bu_calloc(strlen(plan_string) + 1, sizeof(char 
*), "plan argv");
+    struct bu_vls plan_string_vls;
+    bu_vls_init(&plan_string_vls);
+    bu_vls_sprintf(&plan_string_vls, "%s", plan_string);
+    bu_argv_from_string(&plan_argv[0], strlen(plan_string), 
bu_vls_addr(&plan_string_vls));
+    dbplan = db_search_formplan(plan_argv, wdbp->dbip, wdbp);
+    switch (search_type) {
+       case DB_SEARCH_STANDARD:
+           break;
+       case DB_SEARCH_UNIQ_OBJ:
+           break;
+       case DB_SEARCH_FLAT:
+           break;
+       default:
+           break;
+    }
+    bu_vls_free(&plan_string_vls);
+    bu_free((char *)plan_argv, "free plan argv");
+    db_search_freeplan(&dbplan);
+    return search_results;
+}
+*/
 
-
 /*
  * Local Variables:
  * tab-width: 8

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


------------------------------------------------------------------------------
Get 100% visibility into Java/.NET code with AppDynamics Lite!
It's a free troubleshooting tool designed for production.
Get down to code-level detail for bottlenecks, with <2% overhead. 
Download for free and get started troubleshooting in minutes. 
http://pubads.g.doubleclick.net/gampad/clk?id=48897031&iu=/4140/ostg.clktrk
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits

Reply via email to