incubator-lucy-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Marvin Humphrey <>
Subject Re: OO Design -- type checking
Date Thu, 21 Dec 2006 02:50:55 GMT
On Dec 18, 2006, at 11:08 PM, David Balmain wrote:

> I need to think a little more about this but a code generator seems
> like the best way to go so +1.

While you were away I wrote one in Perl called "" and  
integrated it into KinoSearch.  The implementation turned out to be  
somewhat more elaborate than I'd originally planned, because it  
parses all header files and builds a model of the entire object  
hierarchy before generating any code.  However, once it was mostly  
finished, all of a sudden everything else got a lot easier.  :)

Note that because this is a code generator which produces  
deterministic output directly from C source code, Perl is only  
required on the developer's system (and there are no dependencies  
other than Perl 5.6).  I thought about using Ruby or Java, because I  
didn't want to appear partisan, but oh well. :)  It could be re- 
implemented if need be, though there's a lot of the kind of text  
wrangling which is Perl's strong suit.

Here's some generated code, for the TopDocCollector class: 

The TopDocCollector.h header file which fed 

The TopDocCollector C file, which makes use of a couple HitQueue  
Search/TopDocCollector.c itself (POD documentation at the end)...

If you change out every kino_, Kino_, KINO_ and KinoSearch for lucy_,  
Lucy, LUCY, and Lucy, that TopDocCollector code is basically what I'd  
like to see in our source repository.


Marvin Humphrey
Rectangular Research

View raw message