nit.git
8 years agobenchs: Added submodule reference to ujson4c
Lucas Bajolet [Thu, 10 Dec 2015 15:40:57 +0000 (10:40 -0500)]
benchs: Added submodule reference to ujson4c

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

8 years agoMerge: gamnit: intro textures, programs, camera and the globe example
Jean Privat [Fri, 11 Dec 2015 00:32:20 +0000 (19:32 -0500)]
Merge: gamnit: intro textures, programs, camera and the globe example

Intro 3 core modules for gamnit with a lot of features:

* textures: Provices portable services to load textures. Textures are organized as trees where only the roots have the pixels data and subtextures relay load calls to the root. This structure should remain as is but more features need to be implemented, namely automating the use of offsets in the subtexture, auto reloading textures when invalidated and services to unload the textures.

* programs: Structures to organize GL programs and shaders and to facilitate access to shader variables. The main advantages of this API are static types on shader variables and the gamnit programs that can be specialized.

  I'm not 100% satisfied with the structure of GamnitProgram and GamnitProgramFromSource, but I don't have a better idea on how to organize it. Also I will probably review the implementation of how `GamnitProgram::attributes` and `uniforms` are populated, but it shouldn't change the API much.

* cameras: Add an abstract Camera class and a simple EulerCamera based on euler angles, perfect for FPS type games or top-down strategy games. These camera main feature is to produce the MVP matrix.

  More camera should be implemented, they should also be considered objects attachable to a scene when we have scenes. The EulerCamera lacks some feature, like the usual `look_at`.

These services are independent, it's clean but maybe it's not the best idea. We can't pass a camera to a mat4 shader variable, we have to manually extract the MVP matrix from the camera and pass it to the shader. Also to assign a texture to a sampler2d shader variable, we have to load the texture, assign its GL id to a texture unit and assign the unit's index as the shader variable value. This last issue could be simplified by more code in gamnit itself, but it will add coupling, it will be for a next PR.

The globe examples should replace the triangle example as the "minimal" example for gamnit. However I plan on updating it as I integrate more code into gamnit services allowing me to remove custom calls to OpenGL ES 2.0 from the example.

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

8 years agoMerge: engine: handle the compilation/interpretation of multiple varargs
Jean Privat [Fri, 11 Dec 2015 00:32:17 +0000 (19:32 -0500)]
Merge: engine: handle the compilation/interpretation of multiple varargs

While working on new constructors #1800, it appeared that the compilation of signatures with more than one vararg was broken.

The current engines never compile execute such a signature; signatures with multiple varargs only exists in the model to validate the arguments of the `new` syntax. The bug cannot be exhibited (so no specific tests).

Most of the changes are the same pattern: ask each parameter if it is a vararg instead of waiting a specific one.

Pull-Request: #1891

8 years agoMerge: check_contrib: filter-out contrib/nitc when checking Makefile of projects
Jean Privat [Fri, 11 Dec 2015 00:31:31 +0000 (19:31 -0500)]
Merge: check_contrib: filter-out contrib/nitc when checking Makefile of projects

src/Makefile is already executed at the begin of the tests, so a double execution is mostly useless and time-expensive.

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

8 years agoengine: handle the compilation/interpretation of multiple varargs
Jean Privat [Thu, 10 Dec 2015 21:32:51 +0000 (16:32 -0500)]
engine: handle the compilation/interpretation of multiple varargs

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

8 years agolib/gamnit: intro the globe examples
Alexis Laferrière [Sun, 6 Dec 2015 01:07:31 +0000 (20:07 -0500)]
lib/gamnit: intro the globe examples

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

8 years agolib/gamnit: intro graphic programs abstraction layer
Alexis Laferrière [Wed, 30 Sep 2015 01:10:13 +0000 (21:10 -0400)]
lib/gamnit: intro graphic programs abstraction layer

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

8 years agolib/gamnit: intro the cameras module
Alexis Laferrière [Wed, 30 Sep 2015 01:09:41 +0000 (21:09 -0400)]
lib/gamnit: intro the cameras module

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

8 years agolib/gamnit: intro texture support
Alexis Laferrière [Thu, 17 Sep 2015 13:47:47 +0000 (09:47 -0400)]
lib/gamnit: intro texture support

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

8 years agolib/gamnit: do not execute gamnit clients when testing
Alexis Laferrière [Sun, 6 Dec 2015 01:05:17 +0000 (20:05 -0500)]
lib/gamnit: do not execute gamnit clients when testing

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

8 years agolib/gamnit: intro `GamnitDisplay::aspect_ratio`
Alexis Laferrière [Tue, 29 Sep 2015 20:49:40 +0000 (16:49 -0400)]
lib/gamnit: intro `GamnitDisplay::aspect_ratio`

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

8 years agolib/android: demultiply pixel data from alpha value on request only
Alexis Laferrière [Mon, 7 Dec 2015 04:13:21 +0000 (23:13 -0500)]
lib/android: demultiply pixel data from alpha value on request only

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

8 years agolib/c: intro CUInt16Array
Alexis Laferrière [Sun, 6 Dec 2015 01:04:03 +0000 (20:04 -0500)]
lib/c: intro CUInt16Array

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

8 years agolib/glesv2: intro glGet* and GL_MAX_* macros
Alexis Laferrière [Sun, 6 Dec 2015 17:00:02 +0000 (12:00 -0500)]
lib/glesv2: intro glGet* and GL_MAX_* macros

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

8 years agoMerge: Cleanup auto_super_init
Jean Privat [Wed, 9 Dec 2015 03:51:14 +0000 (22:51 -0500)]
Merge: Cleanup auto_super_init

Constructors have a long history of attempted specifications, therefore a lot of complex cases and code was still present to avoid breaking thing.

Here, we simplify the code of `auto_super_init` that deal with injecting implicit call to various semantic of `super` in a constructor.

Now, there is only two remaining cases:

* the constructor is a redefinition, then a genuine call to `super` (polymorphic and linearized) injected
* the constructor is the introduction of a named constructor, then a call to the auto `init` is injected iff there is no conflict and no arguments.

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

8 years agoMerge: Inline binops
Jean Privat [Wed, 9 Dec 2015 03:51:04 +0000 (22:51 -0500)]
Merge: Inline binops

This PR re-introduces several binary operations implemented as intern to avoid indirection through FFI in some specific cases to improve performance notably in `core/text/native`

Also a style change for `abs` which could easily be inlined and burned by eyes when I saw it, I can remove the commit if someone objects to the modification

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

8 years agoMerge: gamnit: use the same code to limit fps than mnit and fix errors
Jean Privat [Wed, 9 Dec 2015 03:50:20 +0000 (22:50 -0500)]
Merge: gamnit: use the same code to limit fps than mnit and fix errors

Fixed a few bugs in `mnit::mnit_fps`, a typo invalidated the value of `current_fps` and the use of long Ints were broken probably since they are tagged. Using floats should fix this last issue.

Finally, the goal of this PR is to copy the module `mnit::mnit_fps` to `gamnit::limit_fps` and adapt it to the gamnit framework. There is some code duplication, but the mnit version should be deleted with the engine when gamnit is completed.

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

8 years agoMerge: Added new `is_hexdigit` service on `Char`
Jean Privat [Tue, 8 Dec 2015 21:19:58 +0000 (16:19 -0500)]
Merge: Added new `is_hexdigit` service on `Char`

Simple addition to the services of `Char`, might be useful

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

8 years agoMerge: Removed useless `buffered_ropes` package
Jean Privat [Tue, 8 Dec 2015 21:18:56 +0000 (16:18 -0500)]
Merge: Removed useless `buffered_ropes` package

Since the package was experimental and did not bring anything but woes to the maintainer of the `text` package, I'd suggest we remove it

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

8 years agoMerge: Use `as` casts to implicitly type class attributes
Jean Privat [Tue, 8 Dec 2015 21:18:48 +0000 (16:18 -0500)]
Merge: Use `as` casts to implicitly type class attributes

Until now, implicit types for class attributes are defined by literal types or new calls. This PR extends the support to `as` casts. So when an expression setting an attribute ends with a cast such as `.as(String)`, we can safely define the type of the attribute as `String`.

~~~
class A
    # Before
    var s: String = data_store["s"].as(String)

    # After
    var s = data_store["s"].as(String)
end
~~~

I did not modify the error messages by choice, to avoid making more complex the already long error messages with a rare use case. Also since `as` casts are unsafe by definition, I would not recommend to abuse this feature.

This does not apply to `as(not null)`.

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

8 years agoMerge: nitcorn server for nitiwiki
Jean Privat [Tue, 8 Dec 2015 21:18:45 +0000 (16:18 -0500)]
Merge: nitcorn server for nitiwiki

This PR contains the initial work of @ablondin and integrates it further with nitiwiki.

Intro a simple nitcorn server to publish the static files generated by nitiwiki and allow modifications from a web form. It is already applied on http://xymus.net/ to manage the main page.

The server reads the `config.ini` of the target to find the path to the public files. It writes the new markdown to the source folder and regenerates the wiki on each modification. The modification forms apply the template of the current wiki. (with some imperfections)

I've added a basic password authentication system using a list of hashed passwords in a simple text file. It should be enough for simple deployment of the server and this file can be ignored by git.

Limitations:
* Not integrated with all configuration of a nitiwiki server.
* Creating new files is supported by manually changing the path in the URI, but creating parent folders of a file is not supported.
* Some paths configuration may cause problems, the `edit/` page must be at the root of the server and other similar restrictions were not fully tested.
* There's no integration with git.

Closes #1832

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

8 years agocheck_contrib: filter-out contrib/nitc when checking projects.
Jean Privat [Tue, 8 Dec 2015 20:49:31 +0000 (15:49 -0500)]
check_contrib: filter-out contrib/nitc when checking projects.

It was already executed.

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

8 years agoexamples: update users of `mnit::mnit_fps`
Alexis Laferrière [Tue, 8 Dec 2015 17:31:04 +0000 (12:31 -0500)]
examples: update users of `mnit::mnit_fps`

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

8 years agotests: update *init* related tests
Jean Privat [Tue, 8 Dec 2015 17:34:17 +0000 (12:34 -0500)]
tests: update *init* related tests

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

8 years agoautosuper: remove most historic heuristics on implicitly injected `super`-call in...
Jean Privat [Wed, 25 Nov 2015 16:47:12 +0000 (11:47 -0500)]
autosuper: remove most historic heuristics on implicitly injected `super`-call in constructors.

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

8 years agoautosuper: remove heuristic where a homonymous named constructor is implicitly called
Jean Privat [Wed, 25 Nov 2015 14:30:41 +0000 (09:30 -0500)]
autosuper: remove heuristic where a homonymous named constructor is implicitly called

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

8 years agocode: various update to clean declaration or usage of constructors
Jean Privat [Tue, 8 Dec 2015 17:34:07 +0000 (12:34 -0500)]
code: various update to clean declaration or usage of constructors

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

8 years agocode: explicitly call init in some named constructors
Jean Privat [Wed, 25 Nov 2015 16:54:06 +0000 (11:54 -0500)]
code: explicitly call init in some named constructors

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

8 years agotests: Update with introduction of new methods in `kernel`
Lucas Bajolet [Tue, 8 Dec 2015 19:19:25 +0000 (14:19 -0500)]
tests: Update with introduction of new methods in `kernel`

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

8 years agolib/core: Added new `is_hexdigit` service on `Char`
Lucas Bajolet [Tue, 8 Dec 2015 19:15:37 +0000 (14:15 -0500)]
lib/core: Added new `is_hexdigit` service on `Char`

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

8 years agolib: Removed useless `buffered_ropes` package
Lucas Bajolet [Tue, 8 Dec 2015 17:07:07 +0000 (12:07 -0500)]
lib: Removed useless `buffered_ropes` package

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

8 years agolib/core: Inlined implementation of `abs`
Lucas Bajolet [Tue, 8 Dec 2015 17:10:07 +0000 (12:10 -0500)]
lib/core: Inlined implementation of `abs`

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

8 years agolib/core: Re-implemented some frequently used binops for primitive types as intern...
Lucas Bajolet [Tue, 8 Dec 2015 17:09:38 +0000 (12:09 -0500)]
lib/core: Re-implemented some frequently used binops for primitive types as intern with a FFI fallback

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

8 years agosrc: as casts define the type of class attributes
Alexis Laferrière [Mon, 7 Dec 2015 00:38:38 +0000 (19:38 -0500)]
src: as casts define the type of class attributes

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

8 years agolib/gamnit: copy and update `mnit::mnit_fps` as `gamnit::limit_fps`
Alexis Laferrière [Sun, 6 Dec 2015 22:47:37 +0000 (17:47 -0500)]
lib/gamnit: copy and update `mnit::mnit_fps` as `gamnit::limit_fps`

This duplication could probably be avoided as only the name of the method
`frame_full` changes. But the doal is also to fully replace `mnit` so
the old module should be removed soon...

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

8 years agolib/mnit: use floats to count fps to avoid long size problems
Alexis Laferrière [Tue, 8 Dec 2015 15:54:32 +0000 (10:54 -0500)]
lib/mnit: use floats to count fps to avoid long size problems

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

8 years agolib/mnit: fix broken `mnit_fps::App::current_fps`
Alexis Laferrière [Sun, 6 Dec 2015 22:47:04 +0000 (17:47 -0500)]
lib/mnit: fix broken `mnit_fps::App::current_fps`

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

8 years agolib/core: intro `Float::sleep`
Alexis Laferrière [Sat, 21 Nov 2015 21:57:58 +0000 (16:57 -0500)]
lib/core: intro `Float::sleep`

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

8 years agolib/core: fix segfaults in `String::realpath` and remove fixed FIXME
Alexis Laferrière [Tue, 8 Dec 2015 15:09:34 +0000 (10:09 -0500)]
lib/core: fix segfaults in `String::realpath` and remove fixed FIXME

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

8 years agocontrib/nitiwiki: use absolute paths to detect access outside the source dir
Alexis Laferrière [Tue, 8 Dec 2015 13:28:48 +0000 (08:28 -0500)]
contrib/nitiwiki: use absolute paths to detect access outside the source dir

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

8 years agoMerge: glesv2: new services for uniforms, query info and glDrawElements! also update...
Jean Privat [Tue, 8 Dec 2015 02:28:57 +0000 (21:28 -0500)]
Merge: glesv2: new services for uniforms, query info and glDrawElements! also update the API

As usual, the new features and changes aim to follow as closely as possible the C API.

With this PR, we have pretty much all the OpenGL ES 2.0 features needed for mineit and for a first version of gamnit.

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

8 years agolib/glesv2 & gamnit: update examples
Alexis Laferrière [Thu, 1 Oct 2015 03:12:04 +0000 (23:12 -0400)]
lib/glesv2 & gamnit: update examples

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

8 years agolib/glesv2: intro glDrawElements
Alexis Laferrière [Sun, 6 Dec 2015 17:00:59 +0000 (12:00 -0500)]
lib/glesv2: intro glDrawElements

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

8 years agolib/glesv2: allocate native strings with the GC instead of malloc
Alexis Laferrière [Sun, 6 Dec 2015 16:59:11 +0000 (11:59 -0500)]
lib/glesv2: allocate native strings with the GC instead of malloc

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

8 years agolib/glesv2: add missing uniform functions
Alexis Laferrière [Sun, 6 Dec 2015 16:58:11 +0000 (11:58 -0500)]
lib/glesv2: add missing uniform functions

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

8 years agolib/glesv2: revamp the API to get logs
Alexis Laferrière [Sun, 6 Dec 2015 16:56:57 +0000 (11:56 -0500)]
lib/glesv2: revamp the API to get logs

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

8 years agolib/glesv2: flatten hierarchy and update API style of GLDataTypes
Alexis Laferrière [Mon, 5 Oct 2015 17:31:29 +0000 (13:31 -0400)]
lib/glesv2: flatten hierarchy and update API style of GLDataTypes

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

8 years agolib/glesv2: intro glGetProgramiv and glGetShaderiv, and clean related services
Alexis Laferrière [Thu, 17 Sep 2015 01:11:22 +0000 (21:11 -0400)]
lib/glesv2: intro glGetProgramiv and glGetShaderiv, and clean related services

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

8 years agoxymus.net: reorder top-menu elements
Alexis Laferrière [Sat, 5 Dec 2015 13:48:27 +0000 (08:48 -0500)]
xymus.net: reorder top-menu elements

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

8 years agolib/nitcorn: add a wiki modification form to xymus.net
Alexis Laferrière [Sat, 5 Dec 2015 03:58:58 +0000 (22:58 -0500)]
lib/nitcorn: add a wiki modification form to xymus.net

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

8 years agocontrib/nitiwiki: add doc about nitiwiki_server to the README
Alexis Laferrière [Fri, 4 Dec 2015 22:32:04 +0000 (17:32 -0500)]
contrib/nitiwiki: add doc about nitiwiki_server to the README

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

8 years agocontrib/nitiwiki: complete the nitcorn server to modify a nitiwiki
Alexis Laferrière [Fri, 4 Dec 2015 17:45:31 +0000 (12:45 -0500)]
contrib/nitiwiki: complete the nitcorn server to modify a nitiwiki

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

8 years agoMerge: Perfize nitcc_runtime
Jean Privat [Sat, 5 Dec 2015 21:52:51 +0000 (16:52 -0500)]
Merge: Perfize nitcc_runtime

Slight improvement of the work of nitcc.

Numbers with raw parsing of a 30MB json file from nitrpg (only the AST creation, no further analysis)

Before: 0m5.700s ; 25.1 GIr
After: 0m3.540s (-38%) ; 20.3 GIr (-19%)

There is still a lot (99?) of improvements to make before having reasonable numbers, but the nitcc_runtime part ain't one.

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

8 years agolib/markdown: ignore carriage return (fix error when received from Web)
Alexis Laferrière [Fri, 4 Dec 2015 19:37:54 +0000 (14:37 -0500)]
lib/markdown: ignore carriage return (fix error when received from Web)

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

8 years agoAllowing user edit in Nitiwiki (not finished).
Alexandre Blondin Massé [Sun, 29 Nov 2015 06:21:30 +0000 (01:21 -0500)]
Allowing user edit in Nitiwiki (not finished).

Signed-off-by: Alexandre Blondin Massé <alexandre.blondin.masse@gmail.com>

8 years agoMerge: nitrpg: data management uses `mongodb` instead of `json_store`
Jean Privat [Fri, 4 Dec 2015 20:40:25 +0000 (15:40 -0500)]
Merge: nitrpg: data management uses `mongodb` instead of `json_store`

Depends on #1759, #1760 and #1761.

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

8 years agoMerge: Introduces JoinTask, joinabale tasks
Jean Privat [Fri, 4 Dec 2015 20:40:14 +0000 (15:40 -0500)]
Merge: Introduces JoinTask, joinabale tasks

JoinTask prototype

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

8 years agonitcc: generate a faster DFA::trans sequence of `if`
Jean Privat [Fri, 4 Dec 2015 19:31:46 +0000 (14:31 -0500)]
nitcc: generate a faster DFA::trans sequence of `if`

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

8 years agonitcc_runtime: use an Array instead of a List for the DephIterator
Jean Privat [Fri, 4 Dec 2015 18:49:31 +0000 (13:49 -0500)]
nitcc_runtime: use an Array instead of a List for the DephIterator

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

8 years agonitcc_runtime: use `push` instead of `add`
Jean Privat [Fri, 4 Dec 2015 18:48:13 +0000 (13:48 -0500)]
nitcc_runtime: use `push` instead of `add`

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

8 years agonitcc: simplify the code of trans generation into two steps
Jean Privat [Fri, 4 Dec 2015 18:47:29 +0000 (13:47 -0500)]
nitcc: simplify the code of trans generation into two steps

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

8 years agoadding example for joinTask
BlackMinou [Sun, 29 Nov 2015 23:32:34 +0000 (18:32 -0500)]
adding example for joinTask

Signed-off-by: BlackMinou <romain.chanoir@viacesi.fr>

8 years agoIntroduces JoinTask, joinabale tasks
BlackMinou [Sat, 28 Nov 2015 20:21:24 +0000 (15:21 -0500)]
Introduces JoinTask, joinabale tasks

Signed-off-by: BlackMinou <romain.chanoir@viacesi.fr>

8 years agolib/json: update files generated by nitcc
Jean Privat [Fri, 4 Dec 2015 14:13:26 +0000 (09:13 -0500)]
lib/json: update files generated by nitcc

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

8 years agonitcc: move the responsibility of making the substring to the automatom
Jean Privat [Fri, 4 Dec 2015 14:03:39 +0000 (09:03 -0500)]
nitcc: move the responsibility of making the substring to the automatom

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

8 years agonitcc: move up `text` of token earlier to improve generated code
Jean Privat [Fri, 4 Dec 2015 13:59:13 +0000 (08:59 -0500)]
nitcc: move up `text` of token earlier to improve generated code

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

8 years agonitcc_rt: do not create ignored tokens
Jean Privat [Fri, 4 Dec 2015 13:58:07 +0000 (08:58 -0500)]
nitcc_rt: do not create ignored tokens

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

8 years agonitcc_rt: make the depth visitor lazy
Jean Privat [Fri, 4 Dec 2015 13:54:09 +0000 (08:54 -0500)]
nitcc_rt: make the depth visitor lazy

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

8 years agonitcc_rt: use CircularArray
Jean Privat [Fri, 4 Dec 2015 13:52:12 +0000 (08:52 -0500)]
nitcc_rt: use CircularArray

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

8 years agoMerge: Intro of nitrestful a RESTful API generator
Jean Privat [Fri, 4 Dec 2015 00:01:47 +0000 (19:01 -0500)]
Merge: Intro of nitrestful a RESTful API generator

This tool generate a Nit module which implements `Action::answer` to redirect request to a static Nit method. It checks the presence of args, their types, deserialize objects as needed and calls the target method.

Missing arguments or arguments with errors (wrong type, failed deserialization, etc.) are replaced by `null` when the corresponding parameter is `nullable`. If the parameter is non-nullable, or if there is any other error, the generated code calls `super` from `answer` for the user code to handle exceptions and errors.

With the `restful` annotation we can write a normal method with static types such as: (from the example)
~~~
# User code
class MyAction
super RestfulAction

# Method answering requests like `foo?s=some_string&i=42&b=true`
fun foo(s: String, i: Int, b: Bool): HttpResponse is restful do
var resp = new HttpResponse(200)
resp.body = "foo {s} {i} {b}"
return resp
end
...
~~~

And nitrestful will generate for use the wrapper extracting the args from the request and call the method `foo`:
~~~
# Generated code by `nitrestful`
redef class MyAction
redef fun answer(request, truncated_uri)
do
var verbs = truncated_uri.split("/")
if verbs.not_empty and verbs.first.is_empty then verbs.shift
if verbs.length != 1 then return super
var verb = verbs.first

if verb == "foo" then
var in_s = request.string_arg("s")
var out_s = in_s

var in_i = request.string_arg("i")
var out_i = deserialize_arg(in_i)

var in_b = request.string_arg("b")
var out_b = deserialize_arg(in_b)

if not out_s isa String or not out_i isa Int or not out_b isa Bool then
return super
end
return foo(out_s, out_i, out_b)
end
return super
end
end
~~~

This is an early version of this tool. More work is needed to test different types, different usages, error management, and improve the docs and examples.

close #1852

Pull-Request: #1863
Reviewed-by: Jean Privat <jean@pryen.org>
Reviewed-by: Romain Chanoir <romain.chanoir@viacesi.fr>
Reviewed-by: Jean-Philippe Caissy <jpcaissy@piji.ca>

8 years agoMerge: Stringify Bytes
Jean Privat [Thu, 3 Dec 2015 20:59:29 +0000 (15:59 -0500)]
Merge: Stringify Bytes

This PR adds some String-like functions to Bytes, along with an abstraction for Byte-based patterns.

Also, a bug was found within `Bytes::is_empty` and `FlatText` is now public since there was no real rationale to keep it private

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

8 years agoMerge: new core datastructure: CircularArray
Jean Privat [Thu, 3 Dec 2015 20:59:26 +0000 (15:59 -0500)]
Merge: new core datastructure: CircularArray

`lib/core` is extended with CircularArray for an array with efficient push/pop/shift/unshift

Some number with bench_seq. I used valgrind with n=1000

push (Ir/call)
* list: 383
* unrolled list: 188
* circular array: 135
* array: 85

pop
* unroll: 180
* list: 79
* array: 66
* circ: 47

unshift
* array: 31,755 (because memmove)
* list: 385
* unroll: 322
* circ: 127

shift
* array: 36,168 (because memmove)
* unroll: 180
* list: 79
* circ: 50

insert:
* circ: 179,811 (because manual copy item by item)
* array: 27,282
* unroll: 12,235
* list: 11,500

Pull-Request: #1875
Reviewed-by: Lucas Bajolet <r4pass@hotmail.com>
Reviewed-by: Jean-Philippe Caissy <jpcaissy@piji.ca>

8 years agoMerge: Nitiwiki: fix isues with relative paths and the root href
Jean Privat [Thu, 3 Dec 2015 20:59:23 +0000 (15:59 -0500)]
Merge: Nitiwiki: fix isues with relative paths and the root href

close #1872

Can you try it @Morriar ?

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

8 years agosrc/astvalidation: use a CircularArray instead of an Array
Jean Privat [Thu, 3 Dec 2015 19:57:09 +0000 (14:57 -0500)]
src/astvalidation: use a CircularArray instead of an Array

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

8 years agotests: extends test_seq and bench_seq with CircularArray
Jean Privat [Thu, 3 Dec 2015 19:29:21 +0000 (14:29 -0500)]
tests: extends test_seq and bench_seq with CircularArray

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

8 years agocore: add circular_array
Jean Privat [Thu, 3 Dec 2015 19:27:06 +0000 (14:27 -0500)]
core: add circular_array

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

8 years agonitiwiki/examples: update templates
Jean Privat [Thu, 3 Dec 2015 02:10:20 +0000 (21:10 -0500)]
nitiwiki/examples: update templates

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

8 years agonitiwiki: add root_href if the wiki need it
Jean Privat [Thu, 3 Dec 2015 02:09:44 +0000 (21:09 -0500)]
nitiwiki: add root_href if the wiki need it

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

8 years agonitiwiki: add a dhref helper function
Jean Privat [Thu, 3 Dec 2015 02:08:24 +0000 (21:08 -0500)]
nitiwiki: add a dhref helper function

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

8 years agoMerge: Small perf improvments of array
Jean Privat [Thu, 3 Dec 2015 19:20:48 +0000 (14:20 -0500)]
Merge: Small perf improvments of array

Factorize and improve some code related to the Array (and fix a bug)

A NativeArray::memmove method is also added, but without an intern implementation for boostrap reason.

The improvement should mainly concern client of `shift`, `unshift` and `insert` (not that many in fact).
Using the new test bench_seq (with only the array and an argument of 5000)
Before: 0m1.828s
After:  0m0.292s (-84%)

Pull-Request: #1871
Reviewed-by: Lucas Bajolet <r4pass@hotmail.com>
Reviewed-by: Alexis Laferrière <alexis.laf@xymus.net>

8 years agonitrpg: fix warnings
Alexandre Terrasa [Sun, 29 Nov 2015 08:59:40 +0000 (03:59 -0500)]
nitrpg: fix warnings

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

8 years agonitrpg: init web instance from mongo
Alexandre Terrasa [Mon, 10 Aug 2015 22:23:31 +0000 (18:23 -0400)]
nitrpg: init web instance from mongo

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

8 years agonitrpg: add nitunits
Alexandre Terrasa [Thu, 25 Jun 2015 02:51:20 +0000 (22:51 -0400)]
nitrpg: add nitunits

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

8 years agonitrpg: migrate data management from `json_store` to `mongodb`
Alexandre Terrasa [Thu, 25 Jun 2015 02:40:43 +0000 (22:40 -0400)]
nitrpg: migrate data management from `json_store` to `mongodb`

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

8 years agotests: update sav/test_new_native_alt1.res because line change in array
Jean Privat [Wed, 2 Dec 2015 20:30:02 +0000 (15:30 -0500)]
tests: update sav/test_new_native_alt1.res because line change in array

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

8 years agotests: add bench_seq
Jean Privat [Wed, 2 Dec 2015 19:09:15 +0000 (14:09 -0500)]
tests: add bench_seq

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

8 years agocore/array: provide a better implementation of `copy_to` (not native yet)
Jean Privat [Tue, 1 Dec 2015 20:36:38 +0000 (15:36 -0500)]
core/array: provide a better implementation of `copy_to` (not native yet)

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

8 years agoMerge: core/list: add length as attribute
Jean Privat [Wed, 2 Dec 2015 19:25:12 +0000 (14:25 -0500)]
Merge: core/list: add length as attribute

this should have been done a long time ago

Pull-Request: #1870
Reviewed-by: Alexis Laferrière <alexis.laf@xymus.net>
Reviewed-by: Lucas Bajolet <r4pass@hotmail.com>

8 years agocore/array: fix implementation of naive copy_to to avoid overwriting
Jean Privat [Wed, 2 Dec 2015 18:22:42 +0000 (13:22 -0500)]
core/array: fix implementation of naive copy_to to avoid overwriting

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

8 years agocore/list: add length as attribute
Jean Privat [Wed, 2 Dec 2015 00:53:30 +0000 (19:53 -0500)]
core/list: add length as attribute

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

8 years agocore/array: use `copy_to` to factorize some code
Jean Privat [Tue, 1 Dec 2015 20:15:01 +0000 (15:15 -0500)]
core/array: use `copy_to` to factorize some code

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

8 years agoMerge: Adds a module for logging requests
Jean Privat [Tue, 1 Dec 2015 14:07:35 +0000 (09:07 -0500)]
Merge: Adds a module for logging requests

Title pretty much says it all

Pull-Request: #1869
Reviewed-by: Alexis Laferrière <alexis.laf@xymus.net>
Reviewed-by: Jean Privat <jean@pryen.org>
Reviewed-by: Lucas Bajolet <r4pass@hotmail.com>

8 years agoMerge: Modelize check visibility
Jean Privat [Mon, 30 Nov 2015 18:39:36 +0000 (13:39 -0500)]
Merge: Modelize check visibility

Forces modelize to check that the return types of methods are legal with regard to visibility.

Also fixes some code where such issues occur.

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

8 years agoandroid: make native audio_manager access private
Jean Privat [Mon, 30 Nov 2015 16:42:16 +0000 (11:42 -0500)]
android: make native audio_manager access private

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

8 years agotests: update sav because changes in visibility
Jean Privat [Sun, 29 Nov 2015 01:24:52 +0000 (20:24 -0500)]
tests: update sav because changes in visibility

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

8 years agotests: improve base_prot_sig
Jean Privat [Sun, 29 Nov 2015 01:17:20 +0000 (20:17 -0500)]
tests: improve base_prot_sig

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

8 years agomodelize: always check visibility of return types
Jean Privat [Sun, 29 Nov 2015 00:49:54 +0000 (19:49 -0500)]
modelize: always check visibility of return types

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

8 years agosrc/rta: import csv publicly.
Jean Privat [Sun, 29 Nov 2015 01:14:08 +0000 (20:14 -0500)]
src/rta: import csv publicly.

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

8 years agonitc/ffi: make private some top-level methods
Jean Privat [Sun, 29 Nov 2015 01:13:35 +0000 (20:13 -0500)]
nitc/ffi: make private some top-level methods

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

8 years agocore/text: Text::substrings is private
Jean Privat [Sun, 29 Nov 2015 01:12:56 +0000 (20:12 -0500)]
core/text: Text::substrings is private

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