lucy-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From b..@methodlogic.net
Subject Re: [lucy-dev] Tcl bindings
Date Tue, 23 Aug 2011 03:27:26 GMT
On Mon, Aug 22, 2011 at 08:10:39PM -0700, Marvin Humphrey wrote:
> On Mon, Aug 22, 2011 at 04:50:47AM +0000, bch@methodlogic.net wrote:
> > Find attached .c, .h, and Makefile; this does -not- actually link against
> > anything lucy atm, and in fact guesses at lucy-specific structs, etc. but
> > demonstrates a Tcl-ish approach to interfacing.
> 
> Excellent!  Thanks very much for this submission and for getting us out of the
> starting blocks.
> 
> I have committed the files you supplied as r1160531.
> 
> > Martin, the Perl XS* files looked to be working lower-level than I think
> > necessary to get Tcl bindings working; Perl code looked to be working
> > hard to marshal data back/forth; I'd like to get a specific API-call for
> > my Tcl/C code to work with and get that hammered out. IIUC, it shouldn't
> > be as "fiddly" as what the Perl interface appears to me as.
>  
> OK, that's why I think it makes sense to focus on TermQuery as a start, because
> it's comparatively easy to deal with in isolation.  TermQuery is just a simple
> container class with simple member variables -- you don't need to write or read
> an index to create and manipulate a TermQuery object.
> 
> TermQuery -- like *all* clownfish and Lucy objects -- is officially an opaque
> struct, but for the sake of clarity, here's what the struct definition looks
> like when we peek inside.
> 
>     struct lucy_TermQuery {
>         lucy_VTable* vtable;
>         lucy_ref_t ref;
>         float boost;
>         lucy_CharBuf* field;
>         lucy_Obj* term;
>     };

That's good to know; in case of hacking on it before actually linking against anything lucy-ish,
I can do some faking/stubbing.

> Here are prototypes for three functions I think we might work out Tcl wrappers
> for first:
> 
>     lucy_TermQuery*
>     lucy_TermQuery_new(const lucy_CharBuf* field, const lucy_Obj* term);
> 
>     static CHY_INLINE float
>     Lucy_TermQuery_Get_Boost(const lucy_TermQuery *self);
> 
>     static CHY_INLINE lucy_CharBuf*
>     Lucy_TermQuery_Get_Field(const lucy_TermQuery *self);
> 
> Is that the kind of interface information you're looking for?

Excellent, thanks.

> > Despite the guessiness of my work, in the spirit of "release early,
> > release often", find a mock Tcl interface that should compile w/ minimal
> > Makefile adjustments, and work w/ Tcl 8.4, 8.5, and 8.6.
> 
> I've committed the files without modification, then followed up immediately
> afterwards with commits adding the ALv2 license headers.  Stuff dealing with
> functionality, portability and style can always follow on later; getting the
> legal stuff right is first priority.
> 
> I've opened up an issue to track our Tcl efforts:
> 
>     https://issues.apache.org/jira/browse/LUCY-177
> 
> I know I told you on IRC that either mailing list or issue tracker would work
> for submitting files, but it will be cleaner if you create a JIRA account for 
> yourself and upload subsequent patches to that issue using the
> "more actions > attach files" feature.
> 
> FWIW, this is what I get right now when I run Make on my laptop running OS X
> Snow Leopard:
> 
> marvin@smokey:~/projects/lucysvn/tcl $ make
> cc -shared -fpic -o libtcllucy.so -I/usr/pkg/include -L/usr/pkg/library -Wl,-R/usr/pkg/library
./src/tcllucy.c
> ./src/tcllucy.c: In function ???new_termqueryObjCmd???:
> ./src/tcllucy.c:86: warning: assignment from incompatible pointer type

---^ I'll look at this...

> ld: warning: directory '/usr/pkg/library' following -L not found
> ld: unknown option: -R/usr/pkg/library

NetBSD specific, and about what I'd expected. Build system will be
something to be worked-out too. I'll work on that as part of the whole
project.

> collect2: ld returned 1 exit status
> make: *** [libtcllucy.so] Error 1
> marvin@smokey:~/projects/lucysvn/tcl $ 
> 
> 
> PS: My name is spelled c-r-e-a-m-y-g-o-o-d-n-e-s-s, but pronounced "Marvin",
> with a v.

;) Sorry about that, MarVin. I think muscle memory took over above.

> Cheers,

Cheers,

-- 
Brad Harder
Method Logic Digital Consulting
http://methodlogic.net/
http://twitter.com/bcharder


Mime
View raw message