[Xapian-devel] GSoC: PHP bindings

riadh chtara riadh.chtara at gmail.com
Thu Apr 5 07:10:49 BST 2012


Hello
this is the project details that i will put in my proposal , please tell me
what you think.

Project Details
The project will be composed of two parts: the first one is reimplementing
SWIG's PHP backend, and the second one is improving Xapian's PHP API. I
have changed the order of the parts to avoid spending a lot of time on the
easy part, and not having enough time to finish the second part.
Reimplementing SWIG's PHP backend:
The current SWIG version seems to support the conversions of the C++
classes to PHP classes. But, in the reality, it doesn’t have a native
support for C++ classes, it supports only functions. It simulates C++
classes for PHP by creating a function for every class method and then
generating a new PHP file in which it implements the class.
To avoid this unnecessary work, a native class support will need to be
implemented for SWIG.
PHP/Zend C API will be used: PHP/Zend C API is an API that allows using C
and C++ functions, variables and the most important for use classes in PHP.
Classes made by PHP/Zend C API don’t need a PHP wrapper. So this library is
perfect for us.
To use this library, a set of configuration code need to be added to the C
or C++ files. This code includes for example each thing that would be
accessible in PHP.
When a file is sent to SWIG, the first thing it does is the prepossessing
work. Then, it starts parsing and it creates a tree with all objects. This
tree is very important. It could be used to generate the PHP/Zend C API
code. This code will be inserted into our file and then if the user
compiles the code, he will be able to use it without a wrapper.
Improving Xapian's PHP API:
This is will be the second part of the project. At that time, I will become
familiar with the project and I will code fast.
The purpose of this part is to make the Xapian API more easy to use for PHP
developer.
This includes:
Creating for example new iterator: the current version of Xapian, the
iterator are used as there are C++ iterator and not PHP iterator
Fixing the integer problem with function that takes float parameter
What is new or different about your approach which hasn't been done or
wasn't possible before?
For the first part, PHP/Zend C API hasn’t been used because its lack of
documentation, but now it is. So it’s possible to use it.
For the second part, I think the developers haven’t the time to do that
which I have.
Do you have any preliminary findings or results which suggest that your
approach is possible and likely to succeed?
For the first part, I have discussed this detail with same mentors and
developers the mailing list and irc channel, and one of them (Olly Betts).
I also saw the code of SWIG for PHP, and I think that this will work.
Please note any uncertainties or aspects which depend on further research
or investigation.
For the second part, the list of functions that need to be changed
How useful will your results be when not everything works out exactly as
planned?
The project will be very useful. It will allow saving time not only for
Xapian learner (the second part) but also for PHP application that use
SWIG.
Project Timeline
April 30 - May 20:
Checking the Coding guidelines
Installing Development environment
Reading and understanding deeply the source of SWIG and wrapped API
Discussing with mentors about the final details of the project
May 21 - May 29: Defining the changes needed in SWIG
May 28 – July 7: Using SWIG objects tree to generate the PHP/Zend C API code
July 8 - July 13: Inserting generated the Code into the files
JULY 13: MID TERM EVALUATION Dead line
July 13 - July 16:  Testing SWIG (including having tests with testsuite)
July 17- July 19:  Writing documentation for SWIG
July 20- July 26:  Defining the change needed for the Xapian PHP API, with
the mentors and Xapian users
July 27 - August 5: Improving the Xapian PHP API by changing the code and
implementing the new feature into it.
August 5- August 10: Testing the new version of the Xapian
August 11- August 13: Writing the documentation for Xapian API

I have submitted my proposition
http://www.google-melange.com/gsoc/proposal/review/google/gsoc2012/riadh/14001

So pleas if you have a comment about it tell me.

Yours sincerely
Riadh
2012/4/4 riadh chtara <riadh.chtara at gmail.com>

> Hello
> I'm sorry because what I said has no sence: i didn't  know how swig works
> before.
> I have been reading how swig works
> http://www.swig.org/Doc2.0/Extending.html#Extending_nn5 and I started
> understanding.
>
> I didn't have the time to read the hole documentation of swig, however I
> think that the best moment to include use implement the zend api is in
> the prepossessing: when preprocessor   reads the collection of
> configuration files , we will then translate these config file to zend api
> code .
> In the code generation phase, we will not generate wrapper code since we
> don't need anymore.
> What do you  think please?
>
> Yours sincerely
> Riadh
>
>
> 2012/4/4 Olly Betts <olly at survex.com>
>
>> On Tue, Apr 03, 2012 at 02:12:56PM +0200, riadh chtara wrote:
>> >  I will take you comment suggestion about timing in consideration.
>> > What do you thing about this Schedule?
>> >
>> >    1. April 30 ? May 20 : Checking the Coding guidelines, Installing
>> >    development environment, Reading and understanding deeply the source
>> >     SWIG   and  wrapped API , Discussing with mentors about the final
>> >    details of the project
>> >    2. May 21 ? May 29: Defining the changes needed in  SWIG
>> >    3. May 28 - July 13:   adding new function to SWIG
>>
>> You need much more detail here - that's 6 weeks with a really vague one
>> phrase description.  In mid-June, how can we tell you are doing?  Even
>> on July 13th, how can we tell how you are doing?
>>
>> >    4. JULY 13
>> >    5. MID TERM EVALUATION Dead line
>> >    6. July 13 ?July 22:  adding new function to SWIG, Testing SWIG,
>> >    Writing the documentation for SWIGo
>>
>> I think you need to investigate how SWIG's PHP backend currently
>> works, and think about what you would change about that to make
>> the change from defining the PHP classes in a generated PHP wrapper
>> script to doing this in the generated C++ wrapper code using PHP's
>> Zend API.  And what a logical order to tackle these changes would
>> be.
>>
>> SWIG already has an extensive testsuite, which I think all currently
>> passes for PHP - certainly most of it does.  So you have a natural
>> measure of progress here - how much of SWIG's testsuite passes with your
>> changes to the SWIG PHP backend?
>>
>> >    7. July 23 ? August 15: Improving the xapian php api
>> >    8. August 16-August 20: Testing the new version of the xapian
>> >    api, Writing the documentation for it
>>
>> Much too vague, and you really want to implement, test, and document
>> each improvement in turn.
>>
>> > For the mid term evaluation do I need to make a deliverable?
>>
>> Ideally the project should provide a series of deliverables, not
>> just one in the middle and one at the end.
>>
>> On Wed, Apr 04, 2012 at 12:37:55AM +0200, riadh chtara wrote:
>> > I have an approach for handling php with swig.
>> > Swig needs to act like this when we use it for php
>> >
>> >    -  first it analyses the code
>> >    -  then it inserts the zend api instuctions into the code
>> >    - finally it generates and compiles  the zend extensions
>> >
>> > What do you think?
>> > I that couldn't work , please tell me how could I make that.
>>
>> You really need to make this fit with how SWIG already works, so trying
>> to think about how to implement this without having looked at that is
>> rather futile.
>>
>> Cheers,
>>    Olly
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.xapian.org/pipermail/xapian-devel/attachments/20120405/78f8ba69/attachment-0001.htm>


More information about the Xapian-devel mailing list