Skip to content

Commit

Permalink
Add in compat code to make db_search change minimally impacting, depr…
Browse files Browse the repository at this point in the history
…ecate old signature

This is a breaking change if we just yank the old db_search_context type and
change the db_search signature, so we'll put in the older code under the
db_search_old name, list it in CHANGES, and do the deprecation for the previous
signature.  This lets us have our code use the new signature while still
allowing a regex to keep the old code working for a while.
  • Loading branch information
starseeker committed Nov 25, 2024
1 parent 2a0a53f commit e7084c3
Show file tree
Hide file tree
Showing 7 changed files with 2,976 additions and 2 deletions.
8 changes: 8 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,13 @@ generally listed for reference.
Items marked with a "'" (single quote) are undocumented and may be
removed at any time.

7.42
----
include/raytrace librt
db_search_context removed in favor of new db_search params -
old db_search function signature can temporarily be obtained
under the name db_search_old

7.40
----
include/bu/process.h
Expand Down Expand Up @@ -1726,3 +1733,4 @@ s/ambSlow=[0-9]*//g
----
s/bv_mesh_lod_custom_key/bu_data_hash/g
s/x/solid_report/g
s/db_search\(/db_search_old\(/g
2 changes: 2 additions & 0 deletions doc/legal/embedded/search.txt
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,6 @@ SUCH DAMAGE.

file:/src/librt/search.cpp
file:/src/librt/search.h
file:/src/librt/search_old.cpp
file:/src/librt/search_old.h

19 changes: 19 additions & 0 deletions include/rt/search.h
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,25 @@ RT_EXPORT extern size_t db_ls(const struct db_i *dbip,
RT_EXPORT extern int db_cyclic_paths(struct bu_ptbl *cyclic_paths, const struct db_i *dbip, struct directory *sdp);


/* Deprecated */
typedef int(*db_search_callback_t)(int, const char*[],void*);
struct db_search_context {
db_search_callback_t _e_callback; /**< @brief A function that evaluates an array of strings and returns a boolean. */
void *_e_userdata; /**< @brief A pointer that will be passed to the callback, usually a pointer to an interpreter. */
};
RT_EXPORT extern struct db_search_context *db_search_context_create(void); /* FIXME: is this really needed? why not just use the struct directly from the stack or let the user handle allocation? */
RT_EXPORT extern void db_search_context_destroy(struct db_search_context *ctx);
RT_EXPORT extern void db_search_register_exec(struct db_search_context *, db_search_callback_t);
RT_EXPORT extern void db_search_register_data(struct db_search_context *, void *);
RT_EXPORT extern int db_search_old(struct bu_ptbl *results,
int flags,
const char *filter,
int path_c,
struct directory **path_v,
struct db_i *dbip,
struct db_search_context *ctx
);

__END_DECLS

#endif /* RT_SEARCH_H*/
Expand Down
2 changes: 2 additions & 0 deletions src/librt/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,7 @@ set(
regionfix.c
roots.c
search.cpp
search_old.cpp
shoot.c
timer.cpp
tol.c
Expand Down Expand Up @@ -304,6 +305,7 @@ set(
primitives/tgc/tgc_shot.cl
primitives/tor/tor_shot.cl
search.h
search_old.h
subd_test_bot.asc
test_bot2nurbs.cpp
test_brepreport.cpp
Expand Down
2 changes: 0 additions & 2 deletions src/librt/search.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2725,8 +2725,6 @@ db_search(struct bu_ptbl *search_results,
return result_cnt;
}



// Local Variables:
// tab-width: 8
// mode: C++
Expand Down
Loading

0 comments on commit e7084c3

Please sign in to comment.