Marvin Humphrey wrote on 1/6/11 10:10 PM:
> If we give allot_params() the task of extracting values, we can streamline
> away a lot of that calling code. Here's more or less what I'd like to see in
> the autogenerated XS binding code instead:
>
> lucy_Obj* query = NULL;
> uint32_t offset = 0;
> uint32_t num_wanted = 10
> lucy_SortSpec* sort_spec = NULL;
>
> chy_bool_t args_ok = XSBind_allot_params( &(ST(0)), 1,
> items, "Lucy::Search::Searcher::hits_PARAMS",
> ALLOT_OBJ(LUCY_OBJ, &query, "query", 5, true),
> ALLOT_U32(&offset, "offset", 6, false),
> ALLOT_U32(&num_wanted, "num_wanted", 10, false),
> ALLOT_OBJ(LUCY_SORTSPEC, "sort_spec", 9, false),
> NULL);
> if (!args_ok) {
> CFISH_RETHROW(LUCY_INCREF(cfish_Err_get_error()));
> }
>
> Consolidating extraction functionality in allot_params() should allow us to
> shrink the size of Lucy.xs substantially. That's important, because Lucy.xs
> is so big that it takes 30 seconds to compile on my MacBook Pro, and won't
> even compile on certain systems:
+1
It's also important because I find that code example above much easier to read
than the currently generated code.
--
Peter Karman . http://peknet.com/ . [email protected]