[ 
https://issues.apache.org/jira/browse/LUCY-248?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13540281#comment-13540281
 ] 

Marvin Humphrey commented on LUCY-248:
--------------------------------------

> Here is a status update on my work in the c-bindings-wip1 branch.

You've been super productive, Nick -- a lot of great work here.  I'll try to
respond via replies to individual commits, except for this:

> In order to create the Makefile with Charmonizer, it would be nice to have
> the possibility to scan directories recursively for source files. But there
> isn't a cross-platform way to do that. We actually use Charmonizer itself to
> detect how to handle directories on the current platform. So there might be
> some trouble bootstrapping this feature.

I can think of two approaches.

First, we could recompile charmonizer.c (or compile a second separate file),
but include charmony.h this time -- and therefore include the results from the
probe.  The directory reading stuff could be conditionally compiled based on
whether the probe symbols were available.

(As an aside, maybe we should rename "charmonizer.main" to "charmonizer.c" and
`#include "charmonizer_amalgam.c"` within charmonizer.c instead of embedding
the literal amalgam code.)

The downside of that approach is that writing recursive directory reading code
in C is verbose and gnarly, especially when you need portability.  We have
that code written for Lucy; I'm not real excited about duping it into
Charmonizer.

Instead, what I think we might try is wrapping shell commands within
charmonizer.c and invoking `system`.  For POSIX shells, the command would be
`find DIR -print`.  On Windows, maybe "dir /b /s" or a FOR loop like on this
page: [http://rosettacode.org/wiki/Walk_a_directory/Recursively].

It's a dumb hack, but since the requirements are straightforward, the number
of shells is limited, and portability issues are scoped to a single function,
I think we can get it to work consistently.
                
> Implement C bindings
> --------------------
>
>                 Key: LUCY-248
>                 URL: https://issues.apache.org/jira/browse/LUCY-248
>             Project: Lucy
>          Issue Type: Task
>            Reporter: Nick Wellnhofer
>            Assignee: Nick Wellnhofer
>
> Unless someone else wants to work on this, I'm willing to work on the C 
> bindings for Lucy.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to