bassosimone/libight — pull request #6 by bassosimone (2014-06-06 18:56:32+00:00)
Title: Remove wrappers from C++ to C and Python

The wrappers from C++ to C and Python were added to LibNeubot following this rationale:

1. LibNeubot was to be written in C++ for SWIG to generate more-easily-usable NDK/JNI code (compared to the one generated from C code);

2. The C interface (automatically generated from `libight.json` specification) allowed Python to use LibNeubot via `ctypes` and the Python generator used `libight.json` to wrap the `ctypes` plumbing with nicer Pythonic porcelain. In turn, this was done because I wanted to use LibNeubot both on mobiles and on PCs.

After the discussion with @hellais that led to Libight, the scope of Libight was narrowed to include only 1., because Libight is meant to support Neubot and OONI on mobile platforms only (Android first, then others).

Therefore (and, also, because the wrappers are on my way now that I am working on a OONI http-invalid-request-line nettest that uses `std::function` and other C++11 goodies), I suggest that we remove the *optional complexity* represented by 2. to develop more quickly / with less constraints.

In fact, if 2. is not a Libight objective, my time is better spent working on the C++ core rather than working to keep 2. up to date (especially because I think there is value in experimenting with C++11 anonymous functions and `std::bind`, two features to which 2. should be adapted).

---

So, let's dispose of most of the 2. legacy with this initial diff; more patches can be added to the pull request if there is consensus on getting rid of 2.

In particular, note that I cannot fully remove `ight_wrappers.{cpp,h}` because there are portions of Libight written in C (in particular the Poller, the Pollable and some tests) that depend on such files and/or use such files. The Poller should and will be rewritten in C++11 (maybe in another pull request), the Pollable should probably go (this can be done in this pull request), and the tests could be adapted not to use the wrappers (again in this pull request).

Also, I am aware that this diff removes some Python based tests. If there is consensus on the proposal to remove 2., I am happy to add to this pull request patches that rewrite such tests in C++.

---

I tested this change on Slackware current, by rebuilding everything as in `make distclean; autoreconf -i; ./configure; make V=0 check`, without breakages or warnings.