nit.git
7 years agotests: Added test for `fill_from` on `NativeString`
Lucas Bajolet [Thu, 19 May 2016 20:39:35 +0000 (16:39 -0400)]
tests: Added test for `fill_from` on `NativeString`

Signed-off-by: Lucas Bajolet <r4pass@hotmail.com>

7 years agolib/core: Perfized `copy_to_native` implementation on `Text` subclasses
Lucas Bajolet [Thu, 19 May 2016 20:39:20 +0000 (16:39 -0400)]
lib/core: Perfized `copy_to_native` implementation on `Text` subclasses

Signed-off-by: Lucas Bajolet <r4pass@hotmail.com>

7 years agolib/core: Added easy `fill_from` method to `NativeString`
Lucas Bajolet [Thu, 19 May 2016 20:40:32 +0000 (16:40 -0400)]
lib/core: Added easy `fill_from` method to `NativeString`

Signed-off-by: Lucas Bajolet <r4pass@hotmail.com>

7 years agoMerge: More nitunit improvement
Jean Privat [Thu, 19 May 2016 19:12:28 +0000 (15:12 -0400)]
Merge: More nitunit improvement

The point of this serie is to make nitunit more usable and make it more sexy than tests.sh (or ad hoc test scripts) for libraries and programs.

## Highlight

* black box tests with .res files
* --nitc of NITC to locate a specific binary to use
* testcases are executed with some ulimits (to limit timeouts)
* the XML generated is more robust

## Black Box Testing

Sometimes, it is easier to validate a `TestCase` by comparing its output with a text file containing the expected result.

For each TestCase `test_bar` of a TestSuite `test_mod.nit`, if the corresponding file `test_mod.sav/test_bar.res` exists, then the output of the test is compared with the file.

The `diff(1)` command is used to perform the comparison.
The test is failed if non-zero is returned by `diff`.

~~~nit
module test_mod is test_suite
class TestFoo
        fun test_bar do
                print "Hello!"
        end
end
~~~

Where `test_mod.sav/test_bar.res` contains

~~~raw
Hello!
~~~

## Option `--nitc`

nitc compiler to use.

By default, nitunit tries to locate the `nitc` program with the environment variable `NITC` or heuristics.
The option is used to indicate a specific nitc binary.

Pull-Request: #2107
Reviewed-by: Alexandre Terrasa <alexandre@moz-code.org>
Reviewed-by: Alexis Laferrière <alexis.laf@xymus.net>

7 years agoMerge: Mobile app for the Benitlux social network
Jean Privat [Thu, 19 May 2016 19:12:27 +0000 (15:12 -0400)]
Merge: Mobile app for the Benitlux social network

This is the long awaited Benitlux mobile app! This app lets you:

* View the current beer menu.
* Rate available beers.
* See ratings from the community and from your friends.
* Be notified of the daily beer menu.
* Be notified when a friend is on location.
* View a diff of the menu compared to your last visit.
* Debug the app and server by mixing in `src/client/features/debug.nit` at compilation.

The app is portable and fully adapted to Android and iOS. There's also a partially working GTK+ client for quick debugging, and makefile rules to get the pure prototype apps which useful for comparison and other relevant scientific purposes.

The adapted apps for Android and iOS varies depending on the features available on each platform:

* On Android, the app detects the wifi network of the bar and automatically notifies your friends that you are on location (if desired). It also launches a service at device boot to receive notifications from the server. These notifications are shown to the user using pure Java/Android APIs.

* On iOS, there is a button for the user to manually check in or out. There is also local user notifications, but they work only while the app is running. Both these features could be improved upon for a better user experience on iOS.

The source code is organized within `src/client` in two main folders. `views/`  holds the app windows and supporting views. `features/` holds the optional app features included differently per platform.

There is still a few issues to resolve. On iOS, the labels are not ellipsized correctly and the UI text is not updated after logging in. Some beer diffs are still weird and need to be tweaked. The server should be hardened against client version changes. Security should be double checked (This is for you @ppepos!). The GNU/Linux/GTK+ client does not support parallel HTTP request, so curl crashes on the main screen. There is also an ever increasing list of aesthetic changes!

The latest Benitlux features are not yet deployed on xymus.net. This will probably require to transfer data from the development DB to the production DB, or simply drop the development DB... So just so you are warned, the Android release app (the one on F-Droid) will not work right away.

Pull-Request: #2106
Reviewed-by: Jean Privat <jean@pryen.org>
Reviewed-by: Ait younes Mehdi Adel <overpex@gmail.com>

7 years agodocker/full: install android sdk/ndk
Jean Privat [Thu, 19 May 2016 19:06:16 +0000 (15:06 -0400)]
docker/full: install android sdk/ndk

Signed-off-by: Jean Privat <jean@pryen.org>

7 years agodocker/full: add nitunits
Jean Privat [Thu, 19 May 2016 19:04:51 +0000 (15:04 -0400)]
docker/full: add nitunits

Signed-off-by: Jean Privat <jean@pryen.org>

7 years agodocker/full: add postgresql
Jean Privat [Thu, 19 May 2016 19:04:27 +0000 (15:04 -0400)]
docker/full: add postgresql

Signed-off-by: Jean Privat <jean@pryen.org>

7 years agodocker: split into a basic and a full Docker
Jean Privat [Thu, 19 May 2016 19:02:56 +0000 (15:02 -0400)]
docker: split into a basic and a full Docker

Signed-off-by: Jean Privat <jean@pryen.org>

7 years agoMerge: doc: Fix a mispelled word in the parser’s README
Jean Privat [Thu, 19 May 2016 15:06:31 +0000 (11:06 -0400)]
Merge: doc: Fix a mispelled word in the parser’s README

Pull-Request: #2082
Reviewed-by: Jean Privat <jean@pryen.org>

7 years agoMerge: make the nitcatalog slightly more robust on person variations
Jean Privat [Thu, 19 May 2016 14:56:40 +0000 (10:56 -0400)]
Merge: make the nitcatalog slightly more robust on person variations

The various person-related fields were parsed verbatim.
So a slight change in spaces was enough to differentiate two persons.
Now the canonical person representation is used.

e.g. `Lucas Bajolet<r4pass@hotmail.com>` vs `Lucas Bajolet <r4pass@hotmail.com>
` is now the same person (hint: the change is the space between the `t` and the `<`).

Note that to present the original information,
 names/emails/url are still distinguished.

`Lucas Bajolet <r4pass@hotmail.com>`, `R4pass <r4pass@hotmail.com>
` and `Lucas Bajolet <lucas.bajolet@hotmail.com>
` are still 3 persons.

Pull-Request: #2103

7 years agoMerge: .gitignore: ignore .swo files
Jean Privat [Thu, 19 May 2016 14:56:38 +0000 (10:56 -0400)]
Merge: .gitignore: ignore .swo files

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

Pull-Request: #2102
Reviewed-by: Jean Privat <jean@pryen.org>

7 years agonitunit: document black box (.res) testing
Jean Privat [Thu, 19 May 2016 13:08:16 +0000 (09:08 -0400)]
nitunit: document black box (.res) testing

Signed-off-by: Jean Privat <jean@pryen.org>

7 years agotests: extends test_nitunit4 with diff-based tests
Jean Privat [Thu, 19 May 2016 13:07:27 +0000 (09:07 -0400)]
tests: extends test_nitunit4 with diff-based tests

Signed-off-by: Jean Privat <jean@pryen.org>

7 years agonitunit: teach test_suite to compare outputs with a saved result file
Jean Privat [Thu, 19 May 2016 12:56:42 +0000 (08:56 -0400)]
nitunit: teach test_suite to compare outputs with a saved result file

Signed-off-by: Jean Privat <jean@pryen.org>

7 years agonitunit: update manpage with `--nitc`
Jean Privat [Thu, 19 May 2016 03:58:01 +0000 (23:58 -0400)]
nitunit: update manpage with `--nitc`

Signed-off-by: Jean Privat <jean@pryen.org>

7 years agotnitter & calculator: update packages.ini
Alexis Laferrière [Thu, 19 May 2016 14:14:37 +0000 (10:14 -0400)]
tnitter & calculator: update packages.ini

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

7 years agocontrit/benitlux: update package.ini and intro F-Droid metadata
Alexis Laferrière [Thu, 19 May 2016 14:11:08 +0000 (10:11 -0400)]
contrit/benitlux: update package.ini and intro F-Droid metadata

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

7 years agocontrib/benitlux: update README
Alexis Laferrière [Wed, 18 May 2016 13:03:50 +0000 (09:03 -0400)]
contrib/benitlux: update README

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

7 years agocontrib/benitlux: intro iOS client
Alexis Laferrière [Mon, 14 Mar 2016 19:45:39 +0000 (15:45 -0400)]
contrib/benitlux: intro iOS client

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

7 years agocontrib/benitlux: intro Android apps, pure prototype and adapted
Alexis Laferrière [Wed, 18 May 2016 15:21:33 +0000 (11:21 -0400)]
contrib/benitlux: intro Android apps, pure prototype and adapted

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

7 years agocontrib/benitlux: intro Benitlux client prototype App
Alexis Laferrière [Sat, 12 Mar 2016 18:48:36 +0000 (13:48 -0500)]
contrib/benitlux: intro Benitlux client prototype App

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

7 years agocontrib/benitlux: move server specific modules to the server folder
Alexis Laferrière [Tue, 17 May 2016 19:08:36 +0000 (15:08 -0400)]
contrib/benitlux: move server specific modules to the server folder

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

7 years agotests: update nitunit tests
Jean Privat [Thu, 19 May 2016 03:50:11 +0000 (23:50 -0400)]
tests: update nitunit tests

Signed-off-by: Jean Privat <jean@pryen.org>

7 years agonitunit: filter the XML content (and trunc it if needed)
Jean Privat [Thu, 19 May 2016 03:49:54 +0000 (23:49 -0400)]
nitunit: filter the XML content (and trunc it if needed)

Signed-off-by: Jean Privat <jean@pryen.org>

7 years agonitunit: use a safe_exec function with high ulimits
Jean Privat [Thu, 19 May 2016 03:40:01 +0000 (23:40 -0400)]
nitunit: use a safe_exec function with high ulimits

Signed-off-by: Jean Privat <jean@pryen.org>

7 years agonitunit: add options to search the compiler
Jean Privat [Thu, 19 May 2016 02:36:33 +0000 (22:36 -0400)]
nitunit: add options to search the compiler

Signed-off-by: Jean Privat <jean@pryen.org>

7 years agonitunit: factorize the search of a compiler
Jean Privat [Thu, 19 May 2016 02:31:29 +0000 (22:31 -0400)]
nitunit: factorize the search of a compiler

Signed-off-by: Jean Privat <jean@pryen.org>

7 years agonitunit: prevent generated files to be part of the package
Jean Privat [Thu, 19 May 2016 02:24:14 +0000 (22:24 -0400)]
nitunit: prevent generated files to be part of the package

Signed-off-by: Jean Privat <jean@pryen.org>

7 years agolib/ios: fix ListLayout style
Alexis Laferrière [Fri, 15 Apr 2016 18:37:39 +0000 (14:37 -0400)]
lib/ios: fix ListLayout style

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

7 years agolib/ios: fix `pop_window` on iOS
Alexis Laferrière [Wed, 18 May 2016 18:47:51 +0000 (14:47 -0400)]
lib/ios: fix `pop_window` on iOS

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

7 years agolib/android: fix align to always be centered vertically
Alexis Laferrière [Sun, 1 May 2016 21:42:46 +0000 (17:42 -0400)]
lib/android: fix align to always be centered vertically

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

7 years agoMerge: app.nit: navigate between windows with the back button
Jean Privat [Tue, 17 May 2016 20:17:43 +0000 (16:17 -0400)]
Merge: app.nit: navigate between windows with the back button

This should be the last big feature of _app.nit_ needed for my thesis!

Intro services to navigate between multiple windows of the same app.
Windows are added to a stack and popped back to the visible state on pressing the back key.
This behavior was implemented for Android by intercepting events raised by the "hardware" back key.
iOS offers the same features natively so there is no adaptation needed as of now.
On GNU/Linux with GTK+, a button is added to the window header when there's a window to go back to.

These feature will probably have to be tweaked in the future, but they are enough for the Benilux client app. Notably, the life-cylce of each individual window has to be reconsidered and we will probably need some adaptation on iOS to have a better integration.

This PR also fixes a few bugs. The `EditText` losing focus in a `ListLayout` is fixed by a change to the Android manifest file, and vertical layout should now look better on iOS.

I took the opportunity to add other key events while working on the Android back key support.
These will be useful when migrating games from the old low-level implementation on the NDK to our custom `NitActivity.java`.

Pull-Request: #2100
Reviewed-by: Jean Privat <jean@pryen.org>
Reviewed-by: Romain Chanoir <romain.chanoir@viacesi.fr>

7 years agoMerge: app.nit: intro `ToggleEvent`
Jean Privat [Tue, 17 May 2016 20:17:38 +0000 (16:17 -0400)]
Merge: app.nit: intro `ToggleEvent`

This PR adds an event when a checkbox is toggled. `ToggleEvent` is similar to the only previously existing event, `ButtonPressEvent`.

Pull-Request: #2099
Reviewed-by: Jean Privat <jean@pryen.org>

7 years agoMerge: lib/core: Fix substring issue in `ASCIIFlatString`
Jean Privat [Tue, 17 May 2016 20:17:32 +0000 (16:17 -0400)]
Merge: lib/core: Fix substring issue in `ASCIIFlatString`

A bug in the validation part of `ASCIIFlatString::substring` caused some substrings to be created with a negative length, which could be the cause of various negative side-effects.

In the example added in the substring test, this caused `stdout` to close due to a call to `fwrite` with a negative count, which was in turn converted to unsigned (I suspect this is undefined behaviour), provoking the closure of the stream in the nit part.

Reported by @Morriar
Close #2089

Pull-Request: #2091
Reviewed-by: Alexandre Terrasa <alexandre@moz-code.org>
Reviewed-by: Jean Privat <jean@pryen.org>

7 years agoMerge: modelize: mark properties broken if they are a bad introduction (bad redef)
Jean Privat [Tue, 17 May 2016 20:17:28 +0000 (16:17 -0400)]
Merge: modelize: mark properties broken if they are a bad introduction (bad redef)

Some broken redefinitions of properties caused the modelize phase to crash.

An infrastructure exists to prevent the use of such broken entities: the `is_broken` attributes. But they have to be set and used to be effective.

So this PR sets the `is_broken` flag on some forgotten error paths, then prevents further processing if `is_broken` is set.

Pull-Request: #2078
Reviewed-by: Alexandre Terrasa <alexandre@moz-code.org>

7 years agoMerge: model: introduce model_json
Jean Privat [Tue, 17 May 2016 20:17:25 +0000 (16:17 -0400)]
Merge: model: introduce model_json

This PR makes all model entities Jsonable when `model_json` is imported.

Not sure if I was supposed to use the serialization process or not in this case? @xymus what do you think?

This is mostly hand picked services chosen to provide a comprehensive model representation usable by other tools like nitdoc, nitx, web tools or else.

Pull-Request: #2024
Reviewed-by: Jean Privat <jean@pryen.org>

7 years agomake the nitcatalog slightly more robust on person variations
Jean Privat [Tue, 17 May 2016 20:16:23 +0000 (16:16 -0400)]
make the nitcatalog slightly more robust on person variations

The various person-related fields were parsed verbatim.
So a slight change in spaces was enough to differentiate two persons.
Now the canonical person representation is used.

e.g. `Lucas Bajolet<r4pass@hotmail.com>` vs `Lucas Bajolet <r4pass@hotmail.com>
` is now the same person (hint: the change is the space between the `t` and the `<`).

Note that to present the original information,
 names/emails/url are still distinguished.

`Lucas Bajolet <r4pass@hotmail.com>`, `R4pass <r4pass@hotmail.com>
` and `Lucas Bajolet <lucas.bajolet@hotmail.com>
` are still 3 persons.

Signed-off-by: Jean Privat <jean@pryen.org>

7 years agomodel: introduce model_json
Alexandre Terrasa [Tue, 17 May 2016 16:03:18 +0000 (12:03 -0400)]
model: introduce model_json

Translates model entites to plain json

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

7 years agomodel_collect: collect modifiers for all MEntities
Alexandre Terrasa [Tue, 17 May 2016 18:22:15 +0000 (14:22 -0400)]
model_collect: collect modifiers for all MEntities

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

7 years ago.gitignore: ignore .swo files
Alexandre Terrasa [Tue, 17 May 2016 15:57:31 +0000 (11:57 -0400)]
.gitignore: ignore .swo files

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

7 years agolib/ios: layouts have different behavior according to the orientation
Alexis Laferrière [Fri, 15 Apr 2016 19:08:31 +0000 (15:08 -0400)]
lib/ios: layouts have different behavior according to the orientation

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

7 years agotnitter & calculator: update app.nit clients
Alexis Laferrière [Tue, 17 May 2016 13:53:33 +0000 (09:53 -0400)]
tnitter & calculator: update app.nit clients

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

7 years agolib/android: fix text input losing focus on selection in a list layout
Alexis Laferrière [Tue, 5 Apr 2016 20:29:07 +0000 (16:29 -0400)]
lib/android: fix text input losing focus on selection in a list layout

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

7 years agolib/android: implement back_button support using the "hardware" back key
Alexis Laferrière [Fri, 18 Mar 2016 20:17:59 +0000 (16:17 -0400)]
lib/android: implement back_button support using the "hardware" back key

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

7 years agolib/android: add onKey* callbacks to Nit_activity
Alexis Laferrière [Wed, 11 Nov 2015 16:47:27 +0000 (11:47 -0500)]
lib/android: add onKey* callbacks to Nit_activity

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

7 years agolib/linux: implement back button
Alexis Laferrière [Fri, 18 Mar 2016 19:12:23 +0000 (15:12 -0400)]
lib/linux: implement back button

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

7 years agolib/app: intro back_button abstraction with navigation for multiple windows
Alexis Laferrière [Fri, 18 Mar 2016 18:50:58 +0000 (14:50 -0400)]
lib/app: intro back_button abstraction with navigation for multiple windows

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

7 years agoMerge: Rubix: Fix package
Jean Privat [Tue, 17 May 2016 15:04:42 +0000 (11:04 -0400)]
Merge: Rubix: Fix package

Wrong email in the package, fixed with this PR

Pull-Request: #2097
Reviewed-by: Jean Privat <jean@pryen.org>

7 years agoMerge: nitunit: set the envvar NIT_TESTING
Jean Privat [Tue, 17 May 2016 15:04:37 +0000 (11:04 -0400)]
Merge: nitunit: set the envvar NIT_TESTING

Pull-Request: #2096
Reviewed-by: Alexandre Terrasa <alexandre@moz-code.org>
Reviewed-by: Romain Chanoir <romain.chanoir@viacesi.fr>

7 years agoMerge: Android: select the low-level implementations from other importations
Jean Privat [Tue, 17 May 2016 15:04:34 +0000 (11:04 -0400)]
Merge: Android: select the low-level implementations from other importations

This PR needs some context first: there is two low-level implementations for Nit apps on Android. The oldest is based on C code and `native_app_glue`, it is used by all our game engines. The new one is based on a custom Java class `NitActivity`, it is used to implement `app::ui` and should replace the oldest one when I have time to work on it.

Prior to this PR, importing `android` imported the old C implementation, and you had to import `android::ui` to get the Java implementation.

This PR changes this behavior and uses conditional importations to choose between the two low-level implementations. So importing `android` and `gamnit` uses the old C implementation (now `android::game`) and importing `android` and `app::ui` uses the new Java implementation (`android::nit_activity`).

This allows us to use the simple `nitc src/calculator.nit -m android`, instead of `nitc src/calculator.nit -m ../../lib/android/ui.nit`. And the most important is that the user doesn't have to chose between (or understand) the two low-level implementations.

Pull-Request: #2093
Reviewed-by: Jean Privat <jean@pryen.org>
Reviewed-by: Romain Chanoir <romain.chanoir@viacesi.fr>

7 years agoMerge: Wrap postgresql #1810
Jean Privat [Tue, 17 May 2016 15:04:29 +0000 (11:04 -0400)]
Merge: Wrap postgresql #1810

Started working on a wrapper for PostgresSQL as per issue: https://github.com/nitlang/nit/issues/1810

So far this wrapper provides basic functionality allowing:

* a connection to be made
* a statement to be executed
* creation of prepared statements
* executions of prepared statements
* connection status functions

according to the [PostgresSQL libpq interface](http://www.postgresql.org/docs/9.5/interactive/libpq.html). It's about equivalent to the `native_sqlite3.nit` class.

Just wondering how much more functionality we want to add and looking for some review on the usage of the FFI and style.

@xymus @privat

Pull-Request: #2051
Reviewed-by: Alexis Laferrière <alexis.laf@xymus.net>
Reviewed-by: Jean Privat <jean@pryen.org>

7 years agolib/linux: implement ToggleEvent
Alexis Laferrière [Tue, 17 May 2016 14:53:51 +0000 (10:53 -0400)]
lib/linux: implement ToggleEvent

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

7 years agolib/ios: implement ToggleEvent
Alexis Laferrière [Wed, 20 Apr 2016 18:22:51 +0000 (14:22 -0400)]
lib/ios: implement ToggleEvent

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

7 years agolib/android: implement ToggleEvent
Alexis Laferrière [Wed, 6 Apr 2016 02:04:20 +0000 (22:04 -0400)]
lib/android: implement ToggleEvent

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

7 years agolib/app: ToogleEvent
Alexis Laferrière [Wed, 6 Apr 2016 02:04:06 +0000 (22:04 -0400)]
lib/app: ToogleEvent

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

7 years agoFix package Rubix
Lucas Bajolet [Tue, 17 May 2016 14:08:01 +0000 (10:08 -0400)]
Fix package Rubix

Signed-off-by: Lucas Bajolet <r4pass@hotmail.com>

7 years agolib/android: portrait and landscape import the main module
Alexis Laferrière [Tue, 17 May 2016 11:27:10 +0000 (07:27 -0400)]
lib/android: portrait and landscape import the main module

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

7 years agoMerge: Asteronits: fix mobile on-screen controls
Jean Privat [Tue, 17 May 2016 11:20:25 +0000 (07:20 -0400)]
Merge: Asteronits: fix mobile on-screen controls

This is a long overdue update to Asteronits, the on-screen controls for mobiles devices were broken since the inverted Y axis incident. The problem is that a correct Y axis in 3D, when sharing world coordinates with the 2D, doesn't look right in 2D. The origin is at the bottom left of the screen, and positive angles are counter-clockwise. I don't like this representation in 2D, but I don't know to improve it, so let's update the clients of `gamnit::flat` instead!

Pull-Request: #2095
Reviewed-by: Jean Privat <jean@pryen.org>
Reviewed-by: Romain Chanoir <romain.chanoir@viacesi.fr>

7 years agoMerge: src/nitlight: Updated client to avoid crashes on unparsed modules
Jean Privat [Tue, 17 May 2016 11:20:22 +0000 (07:20 -0400)]
Merge: src/nitlight: Updated client to avoid crashes on unparsed modules

Since the loader has been upgraded, `nitlight` crashed when using the `--full` option since some modules were recognized by the model but left unparsed, causing the program to crash when fetching the `AModule` from `modelbuilder.mmodule2node`.

This PR fixes the issue by rendering only loaded and parsed modules from the importation chain.

Pull-Request: #2088
Reviewed-by: Jean Privat <jean@pryen.org>

7 years agonitunit: set the envvar NIT_TESTING
Jean Privat [Tue, 17 May 2016 11:19:49 +0000 (07:19 -0400)]
nitunit: set the envvar NIT_TESTING

Signed-off-by: Jean Privat <jean@pryen.org>

7 years agoMerge: SQLite: update and simplify wrapper
Jean Privat [Tue, 17 May 2016 01:22:59 +0000 (21:22 -0400)]
Merge: SQLite: update and simplify wrapper

This PR updates the SQLite wrapper so it is easier to understand and maintain, and as a bonus it is now compatible with the interpreter.

The C code and native layer now uses only `NativeString`, and the calls `to_cstring` and `NativeString::to_s` are moved to the Nit code and nity layer. The error code on opening a database is kept on the C side and retrieved only as needed. This removes a lot of callbacks which simplifies the code and makes the module compatible with the interpreter.

Pull-Request: #2092
Reviewed-by: Jean Privat <jean@pryen.org>

7 years agoMerge: Admin interface for Benitlux and fixes
Jean Privat [Tue, 17 May 2016 01:22:55 +0000 (21:22 -0400)]
Merge: Admin interface for Benitlux and fixes

This PR adds a RESTful admin interface to the Benitlux server. This interface is used to trigger sending out the daily menu notifications from an external program / cron.

As a fix to the diff showing everything as new on the menu, the server now standardizes the received dates to the format expected by SQLite. There is also a small fix to the library used by the code generated by nitrestful to correctly check for errors.

Pull-Request: #2090
Reviewed-by: Jean Privat <jean@pryen.org>
Reviewed-by: Lucas Bajolet <r4pass@hotmail.com>

7 years agoMerge: Add quality metrics to the nit catalog
Jean Privat [Tue, 17 May 2016 01:22:52 +0000 (21:22 -0400)]
Merge: Add quality metrics to the nit catalog

Three new metrics:

* number of errors (boo)
* number of warnings (and advices)
* percentage of documentation (with ponderation)

The 3 firsts commits was to make errors&warnings accessible without printing them.

Pull-Request: #2081
Reviewed-by: Alexandre Terrasa <alexandre@moz-code.org>
Reviewed-by: Lucas Bajolet <r4pass@hotmail.com>

7 years agoMerge: JSON: merge 2 services into `serialize_to_json` and isolate from `static`
Jean Privat [Tue, 17 May 2016 01:22:48 +0000 (21:22 -0400)]
Merge: JSON: merge 2 services into `serialize_to_json` and isolate from `static`

The first goal of this PR is to create a simple but customizable service to write Nit objects to JSON (replacing `to_json_string` and `to_plain_json`). It also clarifies how the serialization of a single object can be customized by refining `accept_json_serializer` which allows the same customization of the existing recursive `to_json` but on any `Serializable` objects.

The second goal is to isolate `json::serialization` from `json::static`. This allows to hide the complexity of `static` to clients of `serialization` and will help to deprecate the `static` writing services. After this PR, `serialization` uses really only one service from `static`, `String::to_json` which escapes strings. While `paser_json` uses the new @R4PaSs implementation. The types of `static` didn't add any useful services in the context of the `JsonDeserializer` (they only have writing services) and added both complexity and dependencies to the module.

All of this would make it easy (if there is still interest) to unify all JSON writing APIs and replace the current `Jsonable::to_json` with a single `Serializable::to_json` using the implementation of the new method `serialize_to_json`. And we can update the existing `redef fun to_json` to `redef fun accept_json_serializer`  writing to a stream instead of a string.

Pull-Request: #2068
Reviewed-by: Jean Privat <jean@pryen.org>
Reviewed-by: Lucas Bajolet <r4pass@hotmail.com>

7 years agolib/android: update import and doc of `sensors`
Alexis Laferrière [Tue, 17 May 2016 00:32:22 +0000 (20:32 -0400)]
lib/android: update import and doc of `sensors`

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

7 years agocontrib/asteronits: fix touch_ui (Mobile on screen controls)
Alexis Laferrière [Fri, 13 May 2016 16:31:53 +0000 (12:31 -0400)]
contrib/asteronits: fix touch_ui (Mobile on screen controls)

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

7 years agolib/sqlite3: update error management to be more simple use only the light FFI
Alexis Laferrière [Mon, 16 May 2016 17:22:00 +0000 (13:22 -0400)]
lib/sqlite3: update error management to be more simple use only the light FFI

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

7 years agolib/sqlite3: use only NativeString in the native layer
Alexis Laferrière [Fri, 8 Apr 2016 12:58:58 +0000 (08:58 -0400)]
lib/sqlite3: use only NativeString in the native layer

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

7 years agolib/android: update README with info on the 2 core implementations
Alexis Laferrière [Fri, 13 May 2016 16:26:24 +0000 (12:26 -0400)]
lib/android: update README with info on the 2 core implementations

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

7 years agocontrib & examples: update Android adaptations to the new entrypoint
Alexis Laferrière [Fri, 13 May 2016 16:07:50 +0000 (12:07 -0400)]
contrib & examples: update Android adaptations to the new entrypoint

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

7 years agolib/android: revamp entrypoint
Alexis Laferrière [Sun, 1 May 2016 19:11:35 +0000 (15:11 -0400)]
lib/android: revamp entrypoint

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

7 years agocontrib/benitlux: intro `BenitluxRESTAction::check_token`
Alexis Laferrière [Wed, 6 Apr 2016 02:17:41 +0000 (22:17 -0400)]
contrib/benitlux: intro `BenitluxRESTAction::check_token`

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

7 years agocontrib/benitlux: intro the admin server interface with daily notification
Alexis Laferrière [Tue, 5 Apr 2016 20:29:28 +0000 (16:29 -0400)]
contrib/benitlux: intro the admin server interface with daily notification

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

7 years agocontrib/benitlux: standardize dates on the server-side
Alexis Laferrière [Wed, 11 May 2016 13:34:19 +0000 (09:34 -0400)]
contrib/benitlux: standardize dates on the server-side

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

7 years agolib/sqlite3: intro `Text::to_sql_date_string`
Alexis Laferrière [Wed, 11 May 2016 13:33:48 +0000 (09:33 -0400)]
lib/sqlite3: intro `Text::to_sql_date_string`

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

7 years agotests: Updated `test_substring` for edge case in `ASCIIFlatString::substring`
Lucas Bajolet [Mon, 16 May 2016 20:01:36 +0000 (16:01 -0400)]
tests: Updated `test_substring` for edge case in `ASCIIFlatString::substring`

Signed-off-by: Lucas Bajolet <r4pass@hotmail.com>

7 years agolib/core: Fix substring in `ASCIIFlatString`
Lucas Bajolet [Mon, 16 May 2016 19:59:03 +0000 (15:59 -0400)]
lib/core: Fix substring in `ASCIIFlatString`

Signed-off-by: Lucas Bajolet <r4pass@hotmail.com>

7 years agosrc/nitlight: Updated client to avoid crashes on unparsed modules
Lucas Bajolet [Mon, 16 May 2016 18:41:42 +0000 (14:41 -0400)]
src/nitlight: Updated client to avoid crashes on unparsed modules

Signed-off-by: Lucas Bajolet <r4pass@hotmail.com>

7 years agostarted working on a wrapper for postgres
itsWill [Sun, 27 Dec 2015 08:27:03 +0000 (09:27 +0100)]
started working on a wrapper for postgres

Signed-off-by: itsWill <guilhermerpmansur@gmail.com>

7 years agolib/nitcorn: fix checking errors after deserialization in nitrestful lib
Alexis Laferrière [Tue, 5 Apr 2016 03:19:06 +0000 (23:19 -0400)]
lib/nitcorn: fix checking errors after deserialization in nitrestful lib

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

7 years agodoc: Fix a mispelled word in the parser’s README
jcbrinfo [Sat, 14 May 2016 15:58:56 +0000 (11:58 -0400)]
doc: Fix a mispelled word in the parser’s README

7 years agoMerge: Some nitunit love
Jean Privat [Sat, 14 May 2016 15:56:13 +0000 (11:56 -0400)]
Merge: Some nitunit love

Two small changes

* nitunit works on directories. e.g. `nitunit lib/ contrib/`
* static errors are shown with precise location.

~~~
test_doc3.nit:17,9--15: Syntax Error: unexpected identifier 'garbage'. To suppress this message, enclose the block with a fence tagged `nitish` or `raw` (see `man nitdoc`). (invalid-block)
#      *garbage*
        ^
~~~

runtime errors are a more complex beast to track. Two solutions:

* pragma to inject line informations in the generated test program. This need to find a syntax for line pragmas and teach the parser to use them
* post-error management that parse error messages and substitute the locations from the the generated program with the original locations in the real source. Doable but more code is needed.

Pull-Request: #2075
Reviewed-by: Alexis Laferrière <alexis.laf@xymus.net>

7 years agoMerge: CSV Benchmarks
Jean Privat [Sat, 14 May 2016 15:56:12 +0000 (11:56 -0400)]
Merge: CSV Benchmarks

This PR introduces a new benchmark script for CSV parsers.

Are tested here:

* Nit CSV Ad-hoc parser
* Go standard parser
* Java Apache Commons CSV parser
* Python - Pandas
* Python - Standard
* Ruby - Standard

Will upload some measurements later but *spoiler alert* Python - Pandas is the fastest on large files, Ruby is the slowest by far, Java is the second slower with a big margin from the rest.
Go/Nit/Python-Standard are almost equivalent.

Pull-Request: #2072
Reviewed-by: Jean Privat <jean@pryen.org>

7 years agoMerge: Add a Dockerfile to build a full image of a Nit install
Jean Privat [Sat, 14 May 2016 15:56:10 +0000 (11:56 -0400)]
Merge: Add a Dockerfile to build a full image of a Nit install

The image is based on Debian stable (jessie) with a lot of packages.
I'm not sure what is the point of such images for the end-users.

My objective was just to test a Nit installation on a fresh, full & reproductible base.

Image will be available in the docker hub: https://hub.docker.com/r/nitlang/nit/

The only tests that fails are:

* ballz_android dino_android shoot_android ui_test test_platform_android: no android
* emscripten_nodejs: no emstripten
* test_neo_args1 test_neo4j test_neo4j_batch: no neo4j
* mpi_simple: bizarre error messages
* simple_file_server: the user is root so 80 can be opened :/
* test_glsl_validation: not installed

nitunit need also to be run

Pull-Request: #2070
Reviewed-by: Jean-Philippe Caissy <jpcaissy@piji.ca>

7 years agomodelize: mark property broken is they are bad introduction
Jean Privat [Sat, 14 May 2016 15:23:21 +0000 (11:23 -0400)]
modelize: mark property broken is they are bad introduction

Signed-off-by: Jean Privat <jean@pryen.org>

7 years agolib/crypto: Introduce hamming distance on Bytes
Philippe Pepos Petitclerc [Fri, 13 May 2016 19:04:07 +0000 (15:04 -0400)]
lib/crypto: Introduce hamming distance on Bytes

New method to calculate the bitwise hamming distance on Bytes.

Signed-off-by: Philippe Pepos Petitclerc <ppeposp@gmail.com>

7 years agotests: update *light tests with more popup messages
Jean Privat [Sat, 14 May 2016 02:51:18 +0000 (22:51 -0400)]
tests: update *light tests with more popup messages

Signed-off-by: Jean Privat <jean@pryen.org>

7 years agotests: update catalog res with quality box
Jean Privat [Sat, 14 May 2016 02:50:48 +0000 (22:50 -0400)]
tests: update catalog res with quality box

Signed-off-by: Jean Privat <jean@pryen.org>

7 years agoMerge: Rubix cube - Catalog and documentation update
Jean Privat [Sat, 14 May 2016 02:19:43 +0000 (22:19 -0400)]
Merge: Rubix cube - Catalog and documentation update

A .ini file has been added for support in catalog, along with some module documentation for `lib/rubix.nit`

Close #2076.

Pull-Request: #2077
Reviewed-by: Jean Privat <jean@pryen.org>
Reviewed-by: Alexis Laferrière <alexis.laf@xymus.net>

7 years agoMerge: Promote location in MEntity
Jean Privat [Sat, 14 May 2016 02:19:34 +0000 (22:19 -0400)]
Merge: Promote location in MEntity

For some unknown historical reasons, the location was only provided to some specific model entities. By extending it to all entities, this simplify clients that need to process, visit or filter entities.

Location is not nullable for all entities. This is simpler but need some place-holder object for fictive location. ie some location objects that mean "no location".

Pull-Request: #2045
Reviewed-by: Alexandre Terrasa <alexandre@moz-code.org>

7 years agocatalog: add documentation score
Jean Privat [Sat, 14 May 2016 01:48:00 +0000 (21:48 -0400)]
catalog: add documentation score

Signed-off-by: Jean Privat <jean@pryen.org>

7 years agocatalog: count errors and warnings for each package
Jean Privat [Sat, 14 May 2016 01:28:47 +0000 (21:28 -0400)]
catalog: count errors and warnings for each package

Signed-off-by: Jean Privat <jean@pryen.org>

7 years agotoolcontext: also register messages to the source-files
Jean Privat [Sat, 14 May 2016 01:27:47 +0000 (21:27 -0400)]
toolcontext: also register messages to the source-files

Signed-off-by: Jean Privat <jean@pryen.org>

7 years agotoolcontext: attach messages to location, even if quieted
Jean Privat [Sat, 14 May 2016 01:26:59 +0000 (21:26 -0400)]
toolcontext: attach messages to location, even if quieted

Signed-off-by: Jean Privat <jean@pryen.org>

7 years agotoolcontext: add Message::level
Jean Privat [Sat, 14 May 2016 01:26:08 +0000 (21:26 -0400)]
toolcontext: add Message::level

Signed-off-by: Jean Privat <jean@pryen.org>

7 years agonitc/neo.nit: adapt code to promoted locations
Jean Privat [Fri, 13 May 2016 20:48:46 +0000 (16:48 -0400)]
nitc/neo.nit: adapt code to promoted locations

Signed-off-by: Jean Privat <jean@pryen.org>

7 years agonitc/model: add location to MType
Jean Privat [Sun, 1 May 2016 18:55:03 +0000 (14:55 -0400)]
nitc/model: add location to MType

Signed-off-by: Jean Privat <jean@pryen.org>

7 years agonitc: model_visitor shows the location
Jean Privat [Sun, 1 May 2016 15:58:50 +0000 (11:58 -0400)]
nitc: model_visitor shows the location

Signed-off-by: Jean Privat <jean@pryen.org>

7 years agomodel: add location to MClass and MProperty
Jean Privat [Sun, 1 May 2016 15:45:51 +0000 (11:45 -0400)]
model: add location to MClass and MProperty

Signed-off-by: Jean Privat <jean@pryen.org>