You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucy.apache.org by ma...@apache.org on 2012/03/27 02:01:20 UTC
[lucy-commits] svn commit: r1305683 - in /lucy/trunk: clownfish/src/
perl/buildlib/Lucy/Build/Binding/ perl/xs/
Author: marvin
Date: Tue Mar 27 00:01:19 2012
New Revision: 1305683
URL: http://svn.apache.org/viewvc?rev=1305683&view=rev
Log:
Remove PARAMS hash arg to allot_params().
Change the interface to XSBind_allot_params(), eliminating the name of the
PARAMS hash.
Modified:
lucy/trunk/clownfish/src/CFCPerlSub.c
lucy/trunk/perl/buildlib/Lucy/Build/Binding/Analysis.pm
lucy/trunk/perl/buildlib/Lucy/Build/Binding/Document.pm
lucy/trunk/perl/buildlib/Lucy/Build/Binding/Index.pm
lucy/trunk/perl/buildlib/Lucy/Build/Binding/Object.pm
lucy/trunk/perl/xs/XSBind.c
lucy/trunk/perl/xs/XSBind.h
Modified: lucy/trunk/clownfish/src/CFCPerlSub.c
URL: http://svn.apache.org/viewvc/lucy/trunk/clownfish/src/CFCPerlSub.c?rev=1305683&r1=1305682&r2=1305683&view=diff
==============================================================================
--- lucy/trunk/clownfish/src/CFCPerlSub.c (original)
+++ lucy/trunk/clownfish/src/CFCPerlSub.c Tue Mar 27 00:01:19 2012
@@ -222,8 +222,7 @@ CFCPerlSub_build_allot_params(CFCPerlSub
allot_params
= CFCUtil_cat(allot_params,
"chy_bool_t args_ok = XSBind_allot_params(\n"
- " &(ST(0)), 1, items, \"",
- self->perl_name, "_PARAMS\",\n", NULL);
+ " &(ST(0)), 1, items, ", NULL);
for (size_t i = 1; i < num_vars; i++) {
CFCVariable *var = arg_vars[i];
const char *val = arg_inits[i];
Modified: lucy/trunk/perl/buildlib/Lucy/Build/Binding/Analysis.pm
URL: http://svn.apache.org/viewvc/lucy/trunk/perl/buildlib/Lucy/Build/Binding/Analysis.pm?rev=1305683&r1=1305682&r2=1305683&view=diff
==============================================================================
--- lucy/trunk/perl/buildlib/Lucy/Build/Binding/Analysis.pm (original)
+++ lucy/trunk/perl/buildlib/Lucy/Build/Binding/Analysis.pm Tue Mar 27 00:01:19 2012
@@ -117,7 +117,6 @@ CODE:
SV *text_sv = NULL;
chy_bool_t args_ok
= XSBind_allot_params(&(ST(0)), 1, items,
- "Lucy::Analysis::Inversion::new_PARAMS",
ALLOT_SV(&text_sv, "text", 4, false),
NULL);
if (!args_ok) {
@@ -352,7 +351,6 @@ CODE:
chy_bool_t args_ok
= XSBind_allot_params(&(ST(0)), 1, items,
- "Lucy::Analysis::Token::new_PARAMS",
ALLOT_SV(&text_sv, "text", 4, true),
ALLOT_U32(&start_off, "start_offset", 12, true),
ALLOT_U32(&end_off, "end_offset", 10, true),
Modified: lucy/trunk/perl/buildlib/Lucy/Build/Binding/Document.pm
URL: http://svn.apache.org/viewvc/lucy/trunk/perl/buildlib/Lucy/Build/Binding/Document.pm?rev=1305683&r1=1305682&r2=1305683&view=diff
==============================================================================
--- lucy/trunk/perl/buildlib/Lucy/Build/Binding/Document.pm (original)
+++ lucy/trunk/perl/buildlib/Lucy/Build/Binding/Document.pm Tue Mar 27 00:01:19 2012
@@ -62,7 +62,6 @@ CODE:
int32_t doc_id = 0;
chy_bool_t args_ok
= XSBind_allot_params(&(ST(0)), 1, items,
- "Lucy::Document::Doc::new_PARAMS",
ALLOT_SV(&fields_sv, "fields", 6, false),
ALLOT_I32(&doc_id, "doc_id", 6, false),
NULL);
@@ -141,7 +140,6 @@ CODE:
float score = 0.0f;
chy_bool_t args_ok
= XSBind_allot_params(&(ST(0)), 1, items,
- "Lucy::Document::HitDoc::new_PARAMS",
ALLOT_SV(&fields_sv, "fields", 6, false),
ALLOT_I32(&doc_id, "doc_id", 6, false),
ALLOT_F32(&score, "score", 5, false),
Modified: lucy/trunk/perl/buildlib/Lucy/Build/Binding/Index.pm
URL: http://svn.apache.org/viewvc/lucy/trunk/perl/buildlib/Lucy/Build/Binding/Index.pm?rev=1305683&r1=1305682&r2=1305683&view=diff
==============================================================================
--- lucy/trunk/perl/buildlib/Lucy/Build/Binding/Index.pm (original)
+++ lucy/trunk/perl/buildlib/Lucy/Build/Binding/Index.pm Tue Mar 27 00:01:19 2012
@@ -575,7 +575,6 @@ PPCODE:
else if (items > 2) {
chy_bool_t args_ok
= XSBind_allot_params(&(ST(0)), 1, items,
- "Lucy::Index::Indexer::add_doc_PARAMS",
ALLOT_SV(&doc_sv, "doc", 3, true),
ALLOT_F32(&boost, "boost", 5, false),
NULL);
@@ -1110,7 +1109,6 @@ CODE:
int32_t ord = 0;
chy_bool_t args_ok
= XSBind_allot_params(&(ST(0)), 1, items,
- "Lucy::Index::SortCache::value_PARAMS",
ALLOT_I32(&ord, "ord", 3, false),
NULL);
if (!args_ok) {
Modified: lucy/trunk/perl/buildlib/Lucy/Build/Binding/Object.pm
URL: http://svn.apache.org/viewvc/lucy/trunk/perl/buildlib/Lucy/Build/Binding/Object.pm?rev=1305683&r1=1305682&r2=1305683&view=diff
==============================================================================
--- lucy/trunk/perl/buildlib/Lucy/Build/Binding/Object.pm (original)
+++ lucy/trunk/perl/buildlib/Lucy/Build/Binding/Object.pm Tue Mar 27 00:01:19 2012
@@ -391,7 +391,6 @@ CODE:
chy_bool_t args_ok
= XSBind_allot_params(&(ST(0)), 1, items,
- "Lucy::Object::I32Array::new_PARAMS",
ALLOT_SV(&ints_sv, "ints", 4, true),
NULL);
if (!args_ok) {
@@ -829,7 +828,6 @@ CODE:
lucy_VTable *parent = NULL;
chy_bool_t args_ok
= XSBind_allot_params(&(ST(0)), 1, items,
- "Lucy::Object::VTable::singleton_PARAMS",
ALLOT_OBJ(&class_name, "class_name", 10, true,
LUCY_CHARBUF, alloca(cfish_ZCB_size())),
ALLOT_OBJ(&parent, "parent", 6, false,
Modified: lucy/trunk/perl/xs/XSBind.c
URL: http://svn.apache.org/viewvc/lucy/trunk/perl/xs/XSBind.c?rev=1305683&r1=1305682&r2=1305683&view=diff
==============================================================================
--- lucy/trunk/perl/xs/XSBind.c (original)
+++ lucy/trunk/perl/xs/XSBind.c Tue Mar 27 00:01:19 2012
@@ -472,8 +472,7 @@ S_extract_from_sv(SV *value, void *targe
}
chy_bool_t
-XSBind_allot_params(SV** stack, int32_t start, int32_t num_stack_elems,
- char *unused, ...) {
+XSBind_allot_params(SV** stack, int32_t start, int32_t num_stack_elems, ...) {
va_list args;
int32_t args_left = (num_stack_elems - start) / 2;
void *verified_labels = alloca(sizeof(int64_t) + num_stack_elems / 64);
@@ -489,7 +488,7 @@ XSBind_allot_params(SV** stack, int32_t
}
void *target;
- va_start(args, unused);
+ va_start(args, num_stack_elems);
while (NULL != (target = va_arg(args, void*))) {
char *label = va_arg(args, char*);
int label_len = va_arg(args, int);
Modified: lucy/trunk/perl/xs/XSBind.h
URL: http://svn.apache.org/viewvc/lucy/trunk/perl/xs/XSBind.h?rev=1305683&r1=1305682&r2=1305683&view=diff
==============================================================================
--- lucy/trunk/perl/xs/XSBind.h (original)
+++ lucy/trunk/perl/xs/XSBind.h Tue Mar 27 00:01:19 2012
@@ -145,7 +145,6 @@ cfish_XSBind_enable_overload(void *pobj)
* a NULL-terminated series of ALLOT_ macros.
*
* cfish_XSBind_allot_params(stack, start, num_stack_elems,
- * "Lucy::Search::TermQuery::new_PARAMS",
* ALLOT_OBJ(&field, "field", 5, LUCY_CHARBUF, true, alloca(cfish_ZCB_size()),
* ALLOT_OBJ(&term, "term", 4, LUCY_CHARBUF, true, alloca(cfish_ZCB_size()),
* NULL);
@@ -176,8 +175,8 @@ cfish_XSBind_enable_overload(void *pobj)
* keylen -- The length of the parameter name in bytes.
* required -- A boolean indicating whether the parameter is required.
*
- * If a required parameter is not present, allot_params() will immediately
- * cease processing of parameters, set Err_error and return false.
+ * If a required parameter is not present, allot_params() will set Err_error
+ * and return false.
*
* Use the following macro if a Clownfish object is desired:
*
@@ -192,19 +191,20 @@ cfish_XSBind_enable_overload(void *pobj)
*
* ALLOT_SV(ptr, key, keylen, required)
*
+ * All possible valid param names must be passed via the ALLOT_ macros; if a
+ * user-supplied param cannot be matched up with an ALLOT_ macro,
+ * allot_params() will set Err_error and return false.
+ *
* @param stack The Perl stack.
* @param start Where on the Perl stack to start looking for params. For
* methods, this would typically be 1; for functions, most likely 0.
* @param num_stack_elems The number of arguments passed to the Perl function
* (generally, the XS variable "items").
- * @param params_hash_name The name of a package global hash. Any param
- * labels which are not present in this hash will trigger an exception.
* @return true on success, false on failure (sets Err_error).
*/
chy_bool_t
cfish_XSBind_allot_params(SV** stack, int32_t start,
- int32_t num_stack_elems,
- char* params_hash_name, ...);
+ int32_t num_stack_elems, ...);
#define XSBIND_WANT_I8 0x1
#define XSBIND_WANT_I16 0x2