clib: uses a macro to manage error printing, allowing customization

This will be used in the Android port to print errors in the standard
logging system.

The variadic macro format used by PRINT_ERROR is not in C89 but it is
in the standard C99.

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
ffi/android: display Nit errors on the system log

Redirect low level Nit error messages to the standard logging system
on android.

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
ffi: adds the FFI syntax to the grammar

The FFI allows the user to write all Nit and foreign code for a Nit module
within the same .nit file.

This syntax will be used by the FFI implementation.

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
misc: adapts gtksourceview/nit.lang to extern code use

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
misc: adds extern class type to vim syntax highlighting

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
misc: extends Vim syntax highlighting for the FFI

First, this recognizes the use of inline foreign code. It also switches
language highlighting for the inlined language. This commit supports only
inlined C and Python code, but more can easily be added.

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
lib: fix method FDStream::write_char

This function was only partially implemented in C without being defined in
Nit. This commits removes the partial implementation which triggered a warning
at compilation and replaces it by a working and accessible method using
the legacy native interface.

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
lib: check the return of calls to pipe(), report errors and abort on fail

This commits prevents compilation warnings and allows easier debugging.

Better solutions are still possible but will require to modifiy the API.

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
lib: adds base64 module and according tests

Implements the base64 encode and decode algorithms in Nit.

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
nitc: adds module name and license to separate_options

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
niti: adds tools to compile C code

It will be widely used by the native interface.

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
compiling: moves up the compiling_writer module to be used by the new FFI

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
nitc/ffi: adds the extern_inline module to manage foreign code blocks

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
nitc/ffi: adds a variable to know if a module uses the native interface

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
nitc/ffi: allows to declare C type of extern classes from Nit

This feature uses the FFI grammar but acts at the level of the native
interface. It allows the user to specify the C equivalent of a Nit
extern class. Instances of extern classes are automatically converted
to this type when passed to C. The equivalent C type must be a pointer
or compatible with a pointer type.

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
nitc/ffi: adds full FFI support for C to nitc

This commit adds all required features to use the nested C code, add it
to the compilation script and invoke it.

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
tests: adds tests for the FFI with C

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Merge remote-tracking branch 'alexis/ffi-in-nitc'
lib: add missing #include<stdio.h>

Commit adbf39fb9f8c2df3bc23b5de7dfba34f5058c1e4 forgot to add it

Signed-off-by: Jean Privat <jean@pryen.org>
Merge branch 'al-libs'