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 2010/11/03 21:33:36 UTC

[lucy-commits] svn commit: r1030654 - in /incubator/lucy/trunk: clownfish/lib/Clownfish/Binding/Core/Aliases.pm perl/xs/XSBind.c perl/xs/XSBind.h

Author: marvin
Date: Wed Nov  3 20:33:35 2010
New Revision: 1030654

URL: http://svn.apache.org/viewvc?rev=1030654&view=rev
Log:
Migrate XSBind.[ch] to Clownfish namespace, as it belongs to Clownfish more
than it belongs to Lucy's search code.

Modified:
    incubator/lucy/trunk/clownfish/lib/Clownfish/Binding/Core/Aliases.pm
    incubator/lucy/trunk/perl/xs/XSBind.c
    incubator/lucy/trunk/perl/xs/XSBind.h

Modified: incubator/lucy/trunk/clownfish/lib/Clownfish/Binding/Core/Aliases.pm
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/clownfish/lib/Clownfish/Binding/Core/Aliases.pm?rev=1030654&r1=1030653&r2=1030654&view=diff
==============================================================================
--- incubator/lucy/trunk/clownfish/lib/Clownfish/Binding/Core/Aliases.pm (original)
+++ incubator/lucy/trunk/clownfish/lib/Clownfish/Binding/Core/Aliases.pm Wed Nov  3 20:33:35 2010
@@ -25,8 +25,10 @@ our %aliases = (
     cfish_super_method => 'kino_super_method',
 
     cfish_Obj                => 'kino_Obj',
+    CFISH_OBJ                => 'KINO_OBJ',
     Cfish_Obj_Dump           => 'Kino_Obj_Dump',
     Cfish_Obj_Get_Class_Name => 'Kino_Obj_Get_Class_Name',
+    Cfish_Obj_Is_A           => 'Kino_Obj_Is_A',
     Cfish_Obj_Load           => 'Kino_Obj_Load',
     Cfish_Obj_To_F64         => 'Kino_Obj_To_F64',
     Cfish_Obj_To_I64         => 'Kino_Obj_To_I64',
@@ -34,27 +36,55 @@ our %aliases = (
     Cfish_Obj_Dec_RefCount   => 'Kino_Obj_Dec_RefCount',
     Cfish_Obj_Inc_RefCount   => 'Kino_Obj_Inc_RefCount',
 
-    cfish_CharBuf       => 'kino_CharBuf',
-    CFISH_CHARBUF       => 'KINO_CHARBUF',
-    cfish_CB_newf       => 'kino_CB_newf',
-    Cfish_CB_Clone      => 'Kino_CB_Clone',
-    cfish_ZombieCharBuf => 'kino_ZombieCharBuf',
-    CFISH_ZOMBIECHARBUF => 'KINO_ZOMBIECHARBUF',
-    cfish_ZCB_size      => 'kino_ZCB_size',
+    cfish_ByteBuf     => 'kino_ByteBuf',
+    CFISH_BYTEBUF     => 'KINO_BYTEBUF',
+    Cfish_BB_Get_Size => 'Kino_BB_Get_Size',
+    Cfish_BB_Get_Buf  => 'Kino_BB_Get_Buf',
+
+    cfish_CharBuf                  => 'kino_CharBuf',
+    CFISH_CHARBUF                  => 'KINO_CHARBUF',
+    cfish_CB_newf                  => 'kino_CB_newf',
+    cfish_CB_new_from_trusted_utf8 => 'kino_CB_new_from_trusted_utf8',
+    Cfish_CB_Clone                 => 'Kino_CB_Clone',
+    cfish_ZombieCharBuf            => 'kino_ZombieCharBuf',
+    CFISH_ZOMBIECHARBUF            => 'KINO_ZOMBIECHARBUF',
+    CFISH_VIEWCHARBUF              => 'KINO_VIEWCHARBUF',
+    cfish_ZCB_size                 => 'kino_ZCB_size',
+    cfish_ZCB_wrap_str             => 'kino_ZCB_wrap_str',
+    Cfish_CB_Get_Ptr8              => 'Kino_CB_Get_Ptr8',
+    Cfish_CB_Get_Size              => 'Kino_CB_Get_Size',
+
+    CFISH_FLOATNUM  => 'KINO_FLOATNUM',
+    CFISH_INTNUM    => 'KINO_INTNUM',
+    CFISH_INTEGER32 => 'KINO_INTEGER32',
+    CFISH_INTEGER64 => 'KINO_INTEGER64',
+    CFISH_FLOAT32   => 'KINO_FLOAT32',
+    CFISH_FLOAT64   => 'KINO_FLOAT64',
 
     CFISH_ERR => 'KINO_ERR',
 
     cfish_Hash           => 'kino_Hash',
     CFISH_HASH           => 'KINO_HASH',
     cfish_Hash_new       => 'kino_Hash_new',
+    Cfish_Hash_Iterate   => 'Kino_Hash_Iterate',
+    Cfish_Hash_Next      => 'Kino_Hash_Next',
     Cfish_Hash_Fetch_Str => 'Kino_Hash_Fetch_Str',
     Cfish_Hash_Store_Str => 'Kino_Hash_Store_Str',
 
+    cfish_VArray      => 'kino_VArray',
+    CFISH_VARRAY      => 'KINO_VARRAY',
+    cfish_VA_new      => 'kino_VA_new',
+    Cfish_VA_Fetch    => 'Kino_VA_Fetch',
+    Cfish_VA_Get_Size => 'Kino_VA_Get_Size',
+    Cfish_VA_Resize   => 'Kino_VA_Resize',
+    Cfish_VA_Store    => 'Kino_VA_Store',
+
     cfish_VTable                  => 'kino_VTable',
     CFISH_VTABLE                  => 'KINO_VTABLE',
     cfish_VTable_add_to_registry  => 'kino_VTable_add_to_registry',
     cfish_VTable_offset_of_parent => 'kino_VTable_offset_of_parent',
     cfish_VTable_singleton        => 'kino_VTable_singleton',
+    Cfish_VTable_Get_Name         => 'Kino_VTable_Get_Name',
     Cfish_VTable_Make_Obj         => 'Kino_VTable_Make_Obj',
 
     cfish_Host_callback      => 'kino_Host_callback',

Modified: incubator/lucy/trunk/perl/xs/XSBind.c
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/perl/xs/XSBind.c?rev=1030654&r1=1030653&r2=1030654&view=diff
==============================================================================
--- incubator/lucy/trunk/perl/xs/XSBind.c (original)
+++ incubator/lucy/trunk/perl/xs/XSBind.c Wed Nov  3 20:33:35 2010
@@ -21,27 +21,27 @@
 
 // Convert a Perl hash into a Clownfish Hash.  Caller takes responsibility for
 // a refcount.
-static kino_Hash*
+static cfish_Hash*
 S_perl_hash_to_cfish_hash(HV *phash);
 
 // Convert a Perl array into a Clownfish VArray.  Caller takes responsibility
 // for a refcount.
-static kino_VArray*
+static cfish_VArray*
 S_perl_array_to_cfish_array(AV *parray);
 
 // Convert a VArray to a Perl array.  Caller takes responsibility for a
 // refcount.
 static SV*
-S_cfish_array_to_perl_array(kino_VArray *varray);
+S_cfish_array_to_perl_array(cfish_VArray *varray);
 
 // Convert a Hash to a Perl hash.  Caller takes responsibility for a refcount.
 static SV*
-S_cfish_hash_to_perl_hash(kino_Hash *hash);
+S_cfish_hash_to_perl_hash(cfish_Hash *hash);
 
-kino_Obj*
+cfish_Obj*
 XSBind_new_blank_obj(SV *either_sv)
 {
-    kino_VTable *vtable;
+    cfish_VTable *vtable;
 
     // Get a VTable. 
     if (   sv_isobject(either_sv) 
@@ -49,72 +49,72 @@ XSBind_new_blank_obj(SV *either_sv)
     ) {
         // Use the supplied object's VTable. 
         IV iv_ptr = SvIV(SvRV(either_sv));
-        kino_Obj *self = INT2PTR(kino_Obj*, iv_ptr);
+        cfish_Obj *self = INT2PTR(cfish_Obj*, iv_ptr);
         vtable = self->vtable;
     }
     else {
         // Use the supplied class name string to find a VTable. 
         STRLEN len;
         char *ptr = SvPVutf8(either_sv, len);
-        kino_ZombieCharBuf *klass = CFISH_ZCB_WRAP_STR(ptr, len);
-        vtable = kino_VTable_singleton((kino_CharBuf*)klass, NULL);
+        cfish_ZombieCharBuf *klass = CFISH_ZCB_WRAP_STR(ptr, len);
+        vtable = cfish_VTable_singleton((cfish_CharBuf*)klass, NULL);
     }
 
     // Use the VTable to allocate a new blank object of the right size. 
-    return Kino_VTable_Make_Obj(vtable);
+    return Cfish_VTable_Make_Obj(vtable);
 }
 
-kino_Obj*
-XSBind_sv_to_cfish_obj(SV *sv, kino_VTable *vtable, void *allocation)
+cfish_Obj*
+XSBind_sv_to_cfish_obj(SV *sv, cfish_VTable *vtable, void *allocation)
 {
-    kino_Obj *retval = XSBind_maybe_sv_to_cfish_obj(sv, vtable, allocation);
+    cfish_Obj *retval = XSBind_maybe_sv_to_cfish_obj(sv, vtable, allocation);
     if (!retval) {
-        THROW(KINO_ERR, "Not a %o", Kino_VTable_Get_Name(vtable));
+        THROW(CFISH_ERR, "Not a %o", Cfish_VTable_Get_Name(vtable));
     }
     return retval;
 }
 
-kino_Obj*
-XSBind_maybe_sv_to_cfish_obj(SV *sv, kino_VTable *vtable, void *allocation)
+cfish_Obj*
+XSBind_maybe_sv_to_cfish_obj(SV *sv, cfish_VTable *vtable, void *allocation)
 {
-    kino_Obj *retval = NULL;
+    cfish_Obj *retval = NULL;
     if (XSBind_sv_defined(sv)) {
         if (   sv_isobject(sv) 
             && sv_derived_from(sv, 
-                 (char*)Kino_CB_Get_Ptr8(Kino_VTable_Get_Name(vtable)))
+                 (char*)Cfish_CB_Get_Ptr8(Cfish_VTable_Get_Name(vtable)))
         ) {
-            // Unwrap a real KinoSearch object. 
+            // Unwrap a real Clownfish object. 
             IV tmp = SvIV( SvRV(sv) );
-            retval = INT2PTR(kino_Obj*, tmp);
+            retval = INT2PTR(cfish_Obj*, tmp);
         }
         else if (   allocation &&
-                 (  vtable == KINO_ZOMBIECHARBUF
-                 || vtable == KINO_VIEWCHARBUF
-                 || vtable == KINO_CHARBUF
-                 || vtable == KINO_OBJ)
+                 (  vtable == CFISH_ZOMBIECHARBUF
+                 || vtable == CFISH_VIEWCHARBUF
+                 || vtable == CFISH_CHARBUF
+                 || vtable == CFISH_OBJ)
         ) {
             // Wrap the string from an ordinary Perl scalar inside a
             // ZombieCharBuf.
             STRLEN size;
             char *ptr = SvPVutf8(sv, size);
-            retval = (kino_Obj*)kino_ZCB_wrap_str(allocation, ptr, size);
+            retval = (cfish_Obj*)cfish_ZCB_wrap_str(allocation, ptr, size);
         }
         else if (SvROK(sv)) {
-            // Attempt to convert Perl hashes and arrays into their KinoSearch
+            // Attempt to convert Perl hashes and arrays into their Clownfish
             // analogues.
             SV *inner = SvRV(sv);
-            if (SvTYPE(inner) == SVt_PVAV && vtable == KINO_VARRAY) {
-                retval = (kino_Obj*)S_perl_array_to_cfish_array((AV*)inner);
+            if (SvTYPE(inner) == SVt_PVAV && vtable == CFISH_VARRAY) {
+                retval = (cfish_Obj*)S_perl_array_to_cfish_array((AV*)inner);
             }
-            else if (SvTYPE(inner) == SVt_PVHV && vtable == KINO_HASH) {
-                retval = (kino_Obj*)S_perl_hash_to_cfish_hash((HV*)inner);
+            else if (SvTYPE(inner) == SVt_PVHV && vtable == CFISH_HASH) {
+                retval = (cfish_Obj*)S_perl_hash_to_cfish_hash((HV*)inner);
             }
 
             if(retval) {
                 // Mortalize the converted object -- which is somewhat
                 // dangerous, but is the only way to avoid requiring that the
                 // caller take responsibility for a refcount.
-                SV *mortal = (SV*)Kino_Obj_To_Host(retval);
+                SV *mortal = (SV*)Cfish_Obj_To_Host(retval);
                 LUCY_DECREF(retval);
                 sv_2mortal(mortal);
             }
@@ -125,82 +125,82 @@ XSBind_maybe_sv_to_cfish_obj(SV *sv, kin
 }
 
 SV*
-XSBind_cfish_to_perl(kino_Obj *obj)
+XSBind_cfish_to_perl(cfish_Obj *obj)
 {
     if (obj == NULL) {
         return newSV(0);
     }
-    else if (Kino_Obj_Is_A(obj, KINO_CHARBUF)) {
-        return XSBind_cb_to_sv((kino_CharBuf*)obj);
+    else if (Cfish_Obj_Is_A(obj, CFISH_CHARBUF)) {
+        return XSBind_cb_to_sv((cfish_CharBuf*)obj);
     }
-    else if (Kino_Obj_Is_A(obj, KINO_BYTEBUF)) {
-        return XSBind_bb_to_sv((kino_ByteBuf*)obj);
+    else if (Cfish_Obj_Is_A(obj, CFISH_BYTEBUF)) {
+        return XSBind_bb_to_sv((cfish_ByteBuf*)obj);
     }
-    else if (Kino_Obj_Is_A(obj, KINO_VARRAY)) {
-        return S_cfish_array_to_perl_array((kino_VArray*)obj);
+    else if (Cfish_Obj_Is_A(obj, CFISH_VARRAY)) {
+        return S_cfish_array_to_perl_array((cfish_VArray*)obj);
     }
-    else if (Kino_Obj_Is_A(obj, KINO_HASH)) {
-        return S_cfish_hash_to_perl_hash((kino_Hash*)obj);
+    else if (Cfish_Obj_Is_A(obj, CFISH_HASH)) {
+        return S_cfish_hash_to_perl_hash((cfish_Hash*)obj);
     }
-    else if (Kino_Obj_Is_A(obj, KINO_FLOATNUM)) {
-        return newSVnv(Kino_Obj_To_F64(obj));
+    else if (Cfish_Obj_Is_A(obj, CFISH_FLOATNUM)) {
+        return newSVnv(Cfish_Obj_To_F64(obj));
     }
-    else if (sizeof(IV) == 8 && Kino_Obj_Is_A(obj, KINO_INTNUM)) {
-        int64_t num = Kino_Obj_To_I64(obj);
+    else if (sizeof(IV) == 8 && Cfish_Obj_Is_A(obj, CFISH_INTNUM)) {
+        int64_t num = Cfish_Obj_To_I64(obj);
         return newSViv((IV)num);
     }
-    else if (sizeof(IV) == 4 && Kino_Obj_Is_A(obj, KINO_INTEGER32)) {
-        int32_t num = (int32_t)Kino_Obj_To_I64(obj);
+    else if (sizeof(IV) == 4 && Cfish_Obj_Is_A(obj, CFISH_INTEGER32)) {
+        int32_t num = (int32_t)Cfish_Obj_To_I64(obj);
         return newSViv((IV)num);
     }
-    else if (sizeof(IV) == 4 && Kino_Obj_Is_A(obj, KINO_INTEGER64)) {
-        int64_t num = Kino_Obj_To_I64(obj);
+    else if (sizeof(IV) == 4 && Cfish_Obj_Is_A(obj, CFISH_INTEGER64)) {
+        int64_t num = Cfish_Obj_To_I64(obj);
         return newSVnv((double)num); // lossy 
     }
     else {
-        return (SV*)Kino_Obj_To_Host(obj);
+        return (SV*)Cfish_Obj_To_Host(obj);
     }
 }
 
-kino_Obj*
+cfish_Obj*
 XSBind_perl_to_cfish(SV *sv)
 {
-    kino_Obj *retval = NULL;
+    cfish_Obj *retval = NULL;
 
     if (XSBind_sv_defined(sv)) {
         if (SvROK(sv)) {
             // Deep conversion of references. 
             SV *inner = SvRV(sv);
             if (SvTYPE(inner) == SVt_PVAV) {
-                retval = (kino_Obj*)S_perl_array_to_cfish_array((AV*)inner);
+                retval = (cfish_Obj*)S_perl_array_to_cfish_array((AV*)inner);
             }
             else if (SvTYPE(inner) == SVt_PVHV) {
-                retval = (kino_Obj*)S_perl_hash_to_cfish_hash((HV*)inner);
+                retval = (cfish_Obj*)S_perl_hash_to_cfish_hash((HV*)inner);
             }
             else if (   sv_isobject(sv) 
                      && sv_derived_from(sv, "KinoSearch::Object::Obj")
             ) {
                 IV tmp = SvIV(inner);
-                retval = INT2PTR(kino_Obj*, tmp);
+                retval = INT2PTR(cfish_Obj*, tmp);
                 (void)LUCY_INCREF(retval);
             }
         }
 
-        // It's either a plain scalar or a non-KinoSearch Perl object, so
+        // It's either a plain scalar or a non-Clownfish Perl object, so
         // stringify.
         if (!retval) {
             STRLEN len;
             char *ptr = SvPVutf8(sv, len);
-            retval = (kino_Obj*)kino_CB_new_from_trusted_utf8(ptr, len);
+            retval = (cfish_Obj*)cfish_CB_new_from_trusted_utf8(ptr, len);
         }
     }
     else if (sv) {
         // Deep conversion of raw AVs and HVs. 
         if (SvTYPE(sv) == SVt_PVAV) {
-            retval = (kino_Obj*)S_perl_array_to_cfish_array((AV*)sv);
+            retval = (cfish_Obj*)S_perl_array_to_cfish_array((AV*)sv);
         }
         else if (SvTYPE(sv) == SVt_PVHV) {
-            retval = (kino_Obj*)S_perl_hash_to_cfish_hash((HV*)sv);
+            retval = (cfish_Obj*)S_perl_hash_to_cfish_hash((HV*)sv);
         }
     }
 
@@ -208,31 +208,31 @@ XSBind_perl_to_cfish(SV *sv)
 }
 
 SV*
-XSBind_bb_to_sv(const kino_ByteBuf *bb) 
+XSBind_bb_to_sv(const cfish_ByteBuf *bb) 
 {
     return bb 
-        ? newSVpvn(Kino_BB_Get_Buf(bb), Kino_BB_Get_Size(bb)) 
+        ? newSVpvn(Cfish_BB_Get_Buf(bb), Cfish_BB_Get_Size(bb)) 
         : newSV(0);
 }
 
 SV*
-XSBind_cb_to_sv(const kino_CharBuf *cb) 
+XSBind_cb_to_sv(const cfish_CharBuf *cb) 
 {
     if (!cb) { 
         return newSV(0);
     }
     else {
-        SV *sv = newSVpvn((char*)Kino_CB_Get_Ptr8(cb), Kino_CB_Get_Size(cb));
+        SV *sv = newSVpvn((char*)Cfish_CB_Get_Ptr8(cb), Cfish_CB_Get_Size(cb));
         SvUTF8_on(sv);
         return sv;
     }
 }
 
-static kino_Hash*
+static cfish_Hash*
 S_perl_hash_to_cfish_hash(HV *phash)
 {
-    uint32_t  num_keys = hv_iterinit(phash);
-    kino_Hash *retval   = kino_Hash_new(num_keys);
+    uint32_t    num_keys = hv_iterinit(phash);
+    cfish_Hash *retval   = cfish_Hash_new(num_keys);
 
     while (num_keys--) {
         char *key;
@@ -256,45 +256,45 @@ S_perl_hash_to_cfish_hash(HV *phash)
         }
 
         // Recurse for each value. 
-        Kino_Hash_Store_Str(retval, key, key_len, 
+        Cfish_Hash_Store_Str(retval, key, key_len, 
             XSBind_perl_to_cfish(value_sv));
     }
 
     return retval;
 }
 
-static kino_VArray*
+static cfish_VArray*
 S_perl_array_to_cfish_array(AV *parray)
 {
-    const uint32_t size = av_len(parray) + 1;
-    kino_VArray *retval = kino_VA_new(size);
+    const uint32_t  size   = av_len(parray) + 1;
+    cfish_VArray   *retval = cfish_VA_new(size);
     uint32_t i;
 
     // Iterate over array elems. 
     for (i = 0; i < size; i++) {
         SV **elem_sv = av_fetch(parray, i, false);
         if (elem_sv) {
-            kino_Obj *elem = XSBind_perl_to_cfish(*elem_sv);
-            if (elem) { Kino_VA_Store(retval, i, elem); }
+            cfish_Obj *elem = XSBind_perl_to_cfish(*elem_sv);
+            if (elem) { Cfish_VA_Store(retval, i, elem); }
         }
     }
-    Kino_VA_Resize(retval, size); // needed if last elem is NULL 
+    Cfish_VA_Resize(retval, size); // needed if last elem is NULL 
 
     return retval;
 }
 
 static SV*
-S_cfish_array_to_perl_array(kino_VArray *varray)
+S_cfish_array_to_perl_array(cfish_VArray *varray)
 {
     AV *perl_array = newAV();
-    uint32_t num_elems = Kino_VA_Get_Size(varray);
+    uint32_t num_elems = Cfish_VA_Get_Size(varray);
 
     // Iterate over array elems. 
     if (num_elems) {
         uint32_t i;
         av_fill(perl_array, num_elems - 1);
         for (i = 0; i < num_elems; i++) {
-            kino_Obj *val = Kino_VA_Fetch(varray, i);
+            cfish_Obj *val = Cfish_VA_Fetch(varray, i);
             if (val == NULL) {
                 continue;
             }
@@ -310,31 +310,31 @@ S_cfish_array_to_perl_array(kino_VArray 
 }
 
 static SV*
-S_cfish_hash_to_perl_hash(kino_Hash *hash)
+S_cfish_hash_to_perl_hash(cfish_Hash *hash)
 {
     HV *perl_hash = newHV();
     SV *key_sv    = newSV(1);
-    kino_CharBuf *key;
-    kino_Obj     *val;
+    cfish_CharBuf *key;
+    cfish_Obj     *val;
 
     // Prepare the SV key. 
     SvPOK_on(key_sv);
     SvUTF8_on(key_sv);
 
     // Iterate over key-value pairs. 
-    Kino_Hash_Iterate(hash);
-    while (Kino_Hash_Next(hash, (kino_Obj**)&key, &val)) {
+    Cfish_Hash_Iterate(hash);
+    while (Cfish_Hash_Next(hash, (cfish_Obj**)&key, &val)) {
         // Recurse for each value. 
         SV *val_sv = XSBind_cfish_to_perl(val);
-        if (!Kino_Obj_Is_A((kino_Obj*)key, KINO_CHARBUF)) {
-            CFISH_THROW(KINO_ERR, 
+        if (!Cfish_Obj_Is_A((cfish_Obj*)key, CFISH_CHARBUF)) {
+            CFISH_THROW(CFISH_ERR, 
                 "Can't convert a key of class %o to a Perl hash key",
-                Kino_Obj_Get_Class_Name((kino_Obj*)key));
+                Cfish_Obj_Get_Class_Name((cfish_Obj*)key));
         }
         else {
-            STRLEN key_size = Kino_CB_Get_Size(key);
+            STRLEN key_size = Cfish_CB_Get_Size(key);
             char *key_sv_ptr = SvGROW(key_sv, key_size + 1); 
-            memcpy(key_sv_ptr, Kino_CB_Get_Ptr8(key), key_size);
+            memcpy(key_sv_ptr, Cfish_CB_Get_Ptr8(key), key_size);
             SvCUR_set(key_sv, key_size);
             *SvEND(key_sv) = '\0';
             hv_store_ent(perl_hash, key_sv, val_sv, 0);
@@ -370,13 +370,13 @@ XSBind_allot_params(SV** stack, int32_t 
 
     // Retrieve the params hash, which must be a package global. 
     if (params_hash == NULL) {
-        THROW(KINO_ERR, "Can't find hash named %s", params_hash_name);
+        THROW(CFISH_ERR, "Can't find hash named %s", params_hash_name);
     }
 
     // Verify that our args come in pairs. Bail if there are no args. 
     if (num_stack_elems == start) { return; }
     if ((num_stack_elems - start) % 2 != 0) {
-        THROW(KINO_ERR, "Expecting hash-style params, got odd number of args");
+        THROW(CFISH_ERR, "Expecting hash-style params, got odd number of args");
     }
 
     // Validate param names. 
@@ -385,7 +385,7 @@ XSBind_allot_params(SV** stack, int32_t 
         STRLEN key_len;
         const char *key = SvPV(key_sv, key_len); // assume ASCII labels 
         if (!hv_exists(params_hash, key, key_len)) {
-            THROW(KINO_ERR, "Invalid parameter: '%s'", key);
+            THROW(CFISH_ERR, "Invalid parameter: '%s'", key);
         }
     }
 

Modified: incubator/lucy/trunk/perl/xs/XSBind.h
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/perl/xs/XSBind.h?rev=1030654&r1=1030653&r2=1030654&view=diff
==============================================================================
--- incubator/lucy/trunk/perl/xs/XSBind.h (original)
+++ incubator/lucy/trunk/perl/xs/XSBind.h Wed Nov  3 20:33:35 2010
@@ -14,11 +14,11 @@
  * limitations under the License.
  */
 
-/* XSBind.h -- Functions to help bind KinoSearch to Perl XS api.
+/* XSBind.h -- Functions to help bind Clownfish to Perl XS api.
  */
 
-#ifndef H_KINO_XSBIND
-#define H_KINO_XSBIND 1
+#ifndef H_CFISH_XSBIND
+#define H_CFISH_XSBIND 1
 
 #ifdef __cplusplus
 extern "C" {
@@ -42,16 +42,16 @@ extern "C" {
 #include "ppport.h"
 
 /** Given either a class name or a perl object, manufacture a new KS
- * object suitable for supplying to a kino_Foo_init() function.
+ * object suitable for supplying to a cfish_Foo_init() function.
  */
-kino_Obj*
-kino_XSBind_new_blank_obj(SV *either_sv);
+cfish_Obj*
+cfish_XSBind_new_blank_obj(SV *either_sv);
 
 /** Test whether an SV is defined.  Handles "get" magic, unlike SvOK on its
  * own.
  */
 static CHY_INLINE chy_bool_t
-kino_XSBind_sv_defined(SV *sv)
+cfish_XSBind_sv_defined(SV *sv)
 {
     if (!sv || !SvANY(sv)) { return false; }
     if (SvGMAGICAL(sv)) { mg_get(sv); }
@@ -65,15 +65,15 @@ kino_XSBind_sv_defined(SV *sv)
  * <code>allocation</code>, assign the SV's string to it, and return that
  * instead.  If all else fails, throw an exception.
  */
-kino_Obj*
-kino_XSBind_sv_to_cfish_obj(SV *sv, kino_VTable *vtable, void *allocation);
+cfish_Obj*
+cfish_XSBind_sv_to_cfish_obj(SV *sv, cfish_VTable *vtable, void *allocation);
 
 /** As XSBind_sv_to_cfish_obj above, but returns NULL instead of throwing an
  * exception.
  */
-kino_Obj*
-kino_XSBind_maybe_sv_to_cfish_obj(SV *sv, kino_VTable *vtable,
-                                  void *allocation);
+cfish_Obj*
+cfish_XSBind_maybe_sv_to_cfish_obj(SV *sv, cfish_VTable *vtable,
+                                   void *allocation);
 
 
 /** Derive an SV from a KinoSearch object.  If the KS object is NULL, the SV
@@ -83,26 +83,26 @@ kino_XSBind_maybe_sv_to_cfish_obj(SV *sv
  * responsibility.
  */
 static CHY_INLINE SV*
-kino_XSBind_cfish_obj_to_sv(kino_Obj *obj)
+cfish_XSBind_cfish_obj_to_sv(cfish_Obj *obj)
 {
-    return obj ? (SV*)Kino_Obj_To_Host(obj) : newSV(0);
+    return obj ? (SV*)Cfish_Obj_To_Host(obj) : newSV(0);
 }
 
 /** XSBind_cfish_obj_to_sv, with a cast. 
  */
-#define CFISH_OBJ_TO_SV(_obj) kino_XSBind_cfish_obj_to_sv((kino_Obj*)_obj)
+#define CFISH_OBJ_TO_SV(_obj) cfish_XSBind_cfish_obj_to_sv((cfish_Obj*)_obj)
 
 /** As XSBind_cfish_obj_to_sv above, except decrements the object's refcount
  * after creating the SV. This is useful when the KS expression creates a new
  * refcount, e.g.  a call to a constructor.
  */
 static CHY_INLINE SV*
-kino_XSBind_cfish_obj_to_sv_noinc(kino_Obj *obj)
+cfish_XSBind_cfish_obj_to_sv_noinc(cfish_Obj *obj)
 {
     SV *retval;
     if (obj) {
-        retval = (SV*)Kino_Obj_To_Host(obj);
-        Kino_Obj_Dec_RefCount(obj);
+        retval = (SV*)Cfish_Obj_To_Host(obj);
+        Cfish_Obj_Dec_RefCount(obj);
     }
     else {
         retval = newSV(0);
@@ -113,42 +113,42 @@ kino_XSBind_cfish_obj_to_sv_noinc(kino_O
 /** XSBind_cfish_obj_to_sv_noinc, with a cast. 
  */
 #define CFISH_OBJ_TO_SV_NOINC(_obj) \
-    kino_XSBind_cfish_obj_to_sv_noinc((kino_Obj*)_obj)
+    cfish_XSBind_cfish_obj_to_sv_noinc((cfish_Obj*)_obj)
 
 /** Deep conversion of Clownfish objects to Perl objects -- CharBufs to UTF-8
  * SVs, ByteBufs to SVs, VArrays to Perl array refs, Hashes to Perl hashrefs,
  * and any other object to a Perl object wrapping the Clownfish Obj.
  */
 SV*
-kino_XSBind_cfish_to_perl(kino_Obj *obj);
+cfish_XSBind_cfish_to_perl(cfish_Obj *obj);
 
 /** Deep conversion of Perl data structures to Clownfish objects -- Perl hash
  * to Hash, Perl array to VArray, Clownfish objects stripped of their
  * wrappers, and everything else stringified and turned to a CharBuf.
  */
-kino_Obj*
-kino_XSBind_perl_to_cfish(SV *sv);
+cfish_Obj*
+cfish_XSBind_perl_to_cfish(SV *sv);
 
 /** Convert a ByteBuf into a new string SV.
  */
 SV*
-kino_XSBind_bb_to_sv(const kino_ByteBuf *bb);
+cfish_XSBind_bb_to_sv(const cfish_ByteBuf *bb);
 
 /** Convert a CharBuf into a new UTF-8 string SV.
  */
 SV*
-kino_XSBind_cb_to_sv(const kino_CharBuf *cb);
+cfish_XSBind_cb_to_sv(const cfish_CharBuf *cb);
 
 /** Turn on overloading for the supplied Perl object and its class.
  */
 void
-kino_XSBind_enable_overload(void *pobj);
+cfish_XSBind_enable_overload(void *pobj);
 
 /** Process hash-style params passed to an XS subroutine.  The varargs must
  * come batched in groups of three: an SV**, the name of the parameter, and
  * length of the paramter name.  A NULL pointer terminates the list:
  *
- *     kino_XSBind_allot_params(stack, start, num_stack_elems, 
+ *     cfish_XSBind_allot_params(stack, start, num_stack_elems, 
  *         "KinoSearch::Search::TermQuery::new_PARAMS", 
  *          &field_sv, "field", 5,
  *          &term_sv, "term", 4,
@@ -166,9 +166,9 @@ kino_XSBind_enable_overload(void *pobj);
  * labels which are not present in this hash will trigger an exception.
  */
 void
-kino_XSBind_allot_params(SV** stack, int32_t start, 
-                         int32_t num_stack_elems, 
-                         char* params_hash_name, ...);
+cfish_XSBind_allot_params(SV** stack, int32_t start, 
+                          int32_t num_stack_elems, 
+                          char* params_hash_name, ...);
 
 /* Define short names for all the functions in this file.  Note that these
  * short names are ALWAYS in effect, since they are only used for Perl and we
@@ -176,18 +176,18 @@ kino_XSBind_allot_params(SV** stack, int
  * full symbols nevertheless in case someone else defines e.g. a function
  * named "XSBind_sv_defined".)
  */
-#define XSBind_new_blank_obj           kino_XSBind_new_blank_obj
-#define XSBind_sv_defined              kino_XSBind_sv_defined
-#define XSBind_sv_to_cfish_obj         kino_XSBind_sv_to_cfish_obj
-#define XSBind_maybe_sv_to_cfish_obj   kino_XSBind_maybe_sv_to_cfish_obj
-#define XSBind_cfish_obj_to_sv         kino_XSBind_cfish_obj_to_sv
-#define XSBind_cfish_obj_to_sv_noinc   kino_XSBind_cfish_obj_to_sv_noinc
-#define XSBind_cfish_to_perl           kino_XSBind_cfish_to_perl
-#define XSBind_perl_to_cfish           kino_XSBind_perl_to_cfish
-#define XSBind_bb_to_sv                kino_XSBind_bb_to_sv
-#define XSBind_cb_to_sv                kino_XSBind_cb_to_sv
-#define XSBind_enable_overload         kino_XSBind_enable_overload
-#define XSBind_allot_params            kino_XSBind_allot_params
+#define XSBind_new_blank_obj           cfish_XSBind_new_blank_obj
+#define XSBind_sv_defined              cfish_XSBind_sv_defined
+#define XSBind_sv_to_cfish_obj         cfish_XSBind_sv_to_cfish_obj
+#define XSBind_maybe_sv_to_cfish_obj   cfish_XSBind_maybe_sv_to_cfish_obj
+#define XSBind_cfish_obj_to_sv         cfish_XSBind_cfish_obj_to_sv
+#define XSBind_cfish_obj_to_sv_noinc   cfish_XSBind_cfish_obj_to_sv_noinc
+#define XSBind_cfish_to_perl           cfish_XSBind_cfish_to_perl
+#define XSBind_perl_to_cfish           cfish_XSBind_perl_to_cfish
+#define XSBind_bb_to_sv                cfish_XSBind_bb_to_sv
+#define XSBind_cb_to_sv                cfish_XSBind_cb_to_sv
+#define XSBind_enable_overload         cfish_XSBind_enable_overload
+#define XSBind_allot_params            cfish_XSBind_allot_params
 
 /* Strip the prefix from some common ClownFish symbols where we know there's
  * no conflict with Perl.  It's a little inconsistent to do this rather than
@@ -200,6 +200,6 @@ kino_XSBind_allot_params(SV** stack, int
 }
 #endif
 
-#endif // H_KINO_XSBIND 
+#endif // H_CFISH_XSBIND