nit.git
8 years agoreadme: add information section
Jean Privat [Fri, 18 Dec 2015 13:57:14 +0000 (08:57 -0500)]
readme: add information section

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

8 years agotests: rm sav/niti/fixme/test_intern_extern.res from #1898 because #1902 fixed it
Jean Privat [Thu, 17 Dec 2015 16:05:57 +0000 (11:05 -0500)]
tests: rm sav/niti/fixme/test_intern_extern.res from #1898 because #1902 fixed it

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

8 years agoMerge: FFI: Fix extern methods in generic classes with the interpreter, and complex...
Jean Privat [Thu, 17 Dec 2015 16:03:02 +0000 (11:03 -0500)]
Merge: FFI: Fix extern methods in generic classes with the interpreter, and complex types with nith

A kind of resolve was missing so the name of the generated C function was different between the call and its implementation.

Fix #1899.

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

8 years agoMerge: Alternative intern
Jean Privat [Thu, 17 Dec 2015 16:02:55 +0000 (11:02 -0500)]
Merge: Alternative intern

Improve the handling of alternative of intern methods since an extern body can be used as a fallback.

~~~
redef class Int
   fun foo is intern `{ return foo(self) `}
end
~~~

Moreover, NativeArray intern alternatives is now fixed with nitc.

There is still an issue with the extern methods of NativeArray in the interpreter.

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

8 years agoMerge: Asteronits: add sounds and decouple app::audio from mnit
Jean Privat [Thu, 17 Dec 2015 16:02:44 +0000 (11:02 -0500)]
Merge: Asteronits: add sounds and decouple app::audio from mnit

Add some sound effects to Asteronits, when opening fire, on asteroid explosion and on collisions with the ship. There is no sound for the thruster because the pause feature is currently broken on Android and inexistant on GNU/Linux.

Also update app::soounds so they no longer depend on mnit and now rely only on app.nit.

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

8 years agoFFI nith: fix using `void*` for generics and nullables types in the light FFI
Alexis Laferrière [Thu, 17 Dec 2015 15:11:55 +0000 (10:11 -0500)]
FFI nith: fix using `void*` for generics and nullables types in the light FFI

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

8 years agoFFI niti: fix extern methods in generic classes
Alexis Laferrière [Thu, 17 Dec 2015 14:50:24 +0000 (09:50 -0500)]
FFI niti: fix extern methods in generic classes

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

8 years agotests: add a test for extern methods in generic classes
Alexis Laferrière [Thu, 17 Dec 2015 14:49:32 +0000 (09:49 -0500)]
tests: add a test for extern methods in generic classes

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

8 years agonitni: can mangle all formal type, not just virtual ones
Jean Privat [Tue, 15 Dec 2015 22:22:34 +0000 (17:22 -0500)]
nitni: can mangle all formal type, not just virtual ones

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

8 years agoMerge: nitrpg: avoid race conditions in tests that imply database
Jean Privat [Wed, 16 Dec 2015 20:07:39 +0000 (15:07 -0500)]
Merge: nitrpg: avoid race conditions in tests that imply database

As asked by @privat, the nitrpg test suite now uses random db names

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

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

8 years agoMerge: Qualified class identifiers
Jean Privat [Wed, 16 Dec 2015 17:12:30 +0000 (12:12 -0500)]
Merge: Qualified class identifiers

Extends the parsed and the AST to handle qualified class identifiers.

Now you can parse

~~~nit
redef class m0::A
        super m1::S
        redef type m2::B::T: Int
        fun foo: m3::G[m4::C] do end
end
~~~

Currently, the class qualifiers, if any, are just ignored by semantic phases. Like with method qualifiers.

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

8 years agoMerge: niunit: fix after/before test calls
Jean Privat [Wed, 16 Dec 2015 17:12:22 +0000 (12:12 -0500)]
Merge: niunit: fix after/before test calls

The specification of `nitunit` states that before and after methods can be called to initialize or clean test related things:

~~~nit
module my_test_suite

class MyTestSuite
    super TestSuite

    redef fun before_test do
          # complex things to set up the test
    end

    redef fun after_test do
          # complex things to tear down the test
    end

    fun test_foo do end
    fun test_bar do end
end
~~~

In the above example, `nitunit` will call the methods precisely in this order:

~~~nit
test_before
test_foo
test_after
test_before
test_bar
test_after
~~~

Before this PR, the before and after methods were only call if a redefinition of the before/after method exists locally in the test suite. Inheritance was not considered:

~~~nit
module my_test_suite

class TestBase
    super TestSuite

    redef fun before_test do # ...
    redef fun after_test do # ...
end

class MyTestSuite
    super TestBase

    fun test_foo do end
    fun test_bar do end
end
~~~

So the output was only:

~~~nit
test_foo
test_bar
~~~

This PR fixes that behavior.

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

8 years agoMerge: gamnit: simple 2D API, input events and the game Asteronits
Jean Privat [Wed, 16 Dec 2015 17:12:20 +0000 (12:12 -0500)]
Merge: gamnit: simple 2D API, input events and the game Asteronits

You should probably read this PR commit by commit, it is a bit long but it's mostly due to the sample game, a big XML file and changes to indentation.

The new API provided by `simple_2d` is meant to replace mnit for writing 2D games.
Client modules only have to create instances of `Sprite` which will be displayed as long as they are in `App::sprites`.

At this point, the `simple_2d` API is not optimized and you may see a slowdown at the insertion of new sprites. However, we could improve the performance by preallocating buffer space for more sprites, and by caching sprites state on the GPU to avoid unnecessary updates.

This PR also adds support for input events for Linux and Android. It uses the existing services from `mnit::input`, `sdl` and `android::input_events`.

Finally, the game Asteronits is an example for the `simple_2d` API. In this game, the player controls a ship, avoids asteroids and destroys them. The gameplay and UI is limited by design to be a simple example. Note that the `touch_ui` variant is used on Android only but it also works on Linux.

The tool texture_atlas_parser reads XML TextureAtlas files and produces Nit classes with one attribute per subtexture. We could move this tool if it is useful for any other projects.

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

8 years agoMerge: Json Ad-Hoc string parser
Jean Privat [Wed, 16 Dec 2015 17:12:13 +0000 (12:12 -0500)]
Merge: Json Ad-Hoc string parser

Simple ad-hoc JSON parser working in a similar way as `DOMXmlParser` or `SExpParser`, on the simple  example, the runtime now is around 1.5 seconds.

Once #1885 is merged however, the runtime is ~0.65 seconds, which is nice.

Depends on #1884

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

8 years agotests: Update sav without escaped `/` characters in a string
Lucas Bajolet [Sun, 13 Dec 2015 18:57:07 +0000 (13:57 -0500)]
tests: Update sav without escaped `/` characters in a string

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

8 years agotests: Added ad-hoc json parser test
Lucas Bajolet [Tue, 8 Dec 2015 19:20:23 +0000 (14:20 -0500)]
tests: Added ad-hoc json parser test

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

8 years agolib/json: Added ad-hoc string parser for JSON
Lucas Bajolet [Fri, 11 Dec 2015 21:35:53 +0000 (16:35 -0500)]
lib/json: Added ad-hoc string parser for JSON

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

8 years agolib/android: fix frenglish doc
Alexis Laferrière [Tue, 15 Dec 2015 22:35:18 +0000 (17:35 -0500)]
lib/android: fix frenglish doc

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

8 years agocontrib/asteronits: intro Android version with vibration
Alexis Laferrière [Tue, 15 Dec 2015 22:34:47 +0000 (17:34 -0500)]
contrib/asteronits: intro Android version with vibration

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

8 years agocontrib/asteronits: add sound effects
Alexis Laferrière [Tue, 15 Dec 2015 16:41:51 +0000 (11:41 -0500)]
contrib/asteronits: add sound effects

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

8 years agolib/linux: audio has no more needs for mnit
Alexis Laferrière [Tue, 15 Dec 2015 15:35:46 +0000 (10:35 -0500)]
lib/linux: audio has no more needs for mnit

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

8 years agolib: move assets_dir
Alexis Laferrière [Wed, 7 Oct 2015 15:38:34 +0000 (11:38 -0400)]
lib: move assets_dir

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

8 years agocontrib/asteronits: fix android rules dependency on pre-build
Alexis Laferrière [Wed, 16 Dec 2015 13:21:14 +0000 (08:21 -0500)]
contrib/asteronits: fix android rules dependency on pre-build

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

8 years agotests: update sav for AST-related tests
Jean Privat [Wed, 16 Dec 2015 05:16:38 +0000 (00:16 -0500)]
tests: update sav for AST-related tests

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

8 years agonitc: update code to use qclassids
Jean Privat [Wed, 16 Dec 2015 04:23:10 +0000 (23:23 -0500)]
nitc: update code to use qclassids

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

8 years agoparser: regenerate (with qclassid)
Jean Privat [Wed, 16 Dec 2015 04:22:37 +0000 (23:22 -0500)]
parser: regenerate (with qclassid)

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

8 years agoparser: use qualified class ids in the AST (changes API)
Jean Privat [Wed, 16 Dec 2015 04:22:07 +0000 (23:22 -0500)]
parser: use qualified class ids in the AST (changes API)

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

8 years agoparser: expose qualified class id (qclassid)
Jean Privat [Wed, 16 Dec 2015 04:21:17 +0000 (23:21 -0500)]
parser: expose qualified class id (qclassid)

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

8 years agocontrib/asteronits: fix dependency on inkscape_tools
Alexis Laferrière [Tue, 15 Dec 2015 23:18:04 +0000 (18:18 -0500)]
contrib/asteronits: fix dependency on inkscape_tools

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

8 years agonitrpg: avoid race conditions in tests that imply database
Alexandre Terrasa [Tue, 15 Dec 2015 01:58:49 +0000 (20:58 -0500)]
nitrpg: avoid race conditions in tests that imply database

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

8 years agotest: add test_intern_extern.nit
Jean Privat [Tue, 15 Dec 2015 22:28:32 +0000 (17:28 -0500)]
test: add test_intern_extern.nit

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

8 years agointerpreter: a method can be extern and intern, extern is used as a fallback
Jean Privat [Tue, 15 Dec 2015 22:24:25 +0000 (17:24 -0500)]
interpreter: a method can be extern and intern, extern is used as a fallback

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

8 years agonitni: can mangle all formal type, not just virtual ones
Jean Privat [Tue, 15 Dec 2015 22:22:34 +0000 (17:22 -0500)]
nitni: can mangle all formal type, not just virtual ones

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

8 years agocompiler: a method can be extern and intern, extern is used as a fallback
Jean Privat [Tue, 15 Dec 2015 22:07:06 +0000 (17:07 -0500)]
compiler: a method can be extern and intern, extern is used as a fallback

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

8 years agonitunit: always call before/after methods
Alexandre Terrasa [Tue, 15 Dec 2015 22:04:23 +0000 (17:04 -0500)]
nitunit: always call before/after methods

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

8 years agonitunit: add a test to show how non-local redefinition of before/after methods should...
Alexandre Terrasa [Tue, 15 Dec 2015 22:04:02 +0000 (17:04 -0500)]
nitunit: add a test to show how non-local redefinition of before/after methods should work

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

8 years agocompiler: intern methods on NativeArray can fallback instead of no-op
Jean Privat [Tue, 15 Dec 2015 21:59:38 +0000 (16:59 -0500)]
compiler: intern methods on NativeArray can fallback instead of no-op

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

8 years agonitunit: clean warnings for testing_suite
Alexandre Terrasa [Tue, 15 Dec 2015 21:56:43 +0000 (16:56 -0500)]
nitunit: clean warnings for testing_suite

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

8 years agoMerge: nitweb: nitcorn based API to access model and source code
Jean Privat [Tue, 15 Dec 2015 19:19:47 +0000 (14:19 -0500)]
Merge: nitweb: nitcorn based API to access model and source code

Description from man page:

# NAME

nitweb - provide a web API to nit model and source code.

# SYNOPSIS

nitweb [*options*] FILE...

# DESCRIPTION

`nitweb` use `nitcorn` actions to provide an API to loaded model and source code.

Usage:

~~~sh
nitweb --host localhost --port 3000 lib/core/
~~~

### `GET /` HOME
Show the home page of the webserver.
Display all the loaded model entities in a tree.

### `GET /search/:namespace` SEARCH BY NAMESPACE
Search all model entities matching `namespace`.

It is possible to retrieve the result as a JsonArray instead of raw html
using the uri param `json=true` (default `false`).

### `GET /code/:namespace` SHOW SOURCE CODE
Display the source code of the entity matching `namespace`.

### `GET /doc/:namespace` DOCUMENTATION PAGE
Display a short documentation page about the entity matching `namespace`.

### `GET /random/` RANDOM LIST
Display a random list of entities found in the model.

The list is parametrable with the following uri params:
* `n=10` size of the list (default `10`)
* `k=modules` kind of entities in the list (default `modules`)

It is possible to retrieve the result as a JsonArray instead of raw html
using the uri param `json=true` (default `false`).

# OPTIONS

### `--host`
The host to bind the web server on.

### `--port`
Port number to use

### `-h`, `-?`, `--help`
Show Help (the list of options).

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

8 years agoMerge: Add simple proxy action
Jean Privat [Tue, 15 Dec 2015 18:42:10 +0000 (13:42 -0500)]
Merge: Add simple proxy action

For now anything proxied using this action is blocking.

close #1845

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

8 years agoMerge: Make all Sets cloneable
Jean Privat [Tue, 15 Dec 2015 14:31:27 +0000 (09:31 -0500)]
Merge: Make all Sets cloneable

Since there is no reason to forbid it (or I have not seen one at the very least), here's a simple `clone` method that should work on any `Set`

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

8 years agocontrib/asteronits: fix check rule
Alexis Laferrière [Tue, 15 Dec 2015 13:09:12 +0000 (08:09 -0500)]
contrib/asteronits: fix check rule

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

8 years agolib/gamnit: fix not executing gamnit programs when testing
Alexis Laferrière [Mon, 14 Dec 2015 20:04:06 +0000 (15:04 -0500)]
lib/gamnit: fix not executing gamnit programs when testing

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

8 years agocontrib: move lib/gamnit/examples/asteronits to contrib/
Alexis Laferrière [Mon, 14 Dec 2015 17:46:18 +0000 (12:46 -0500)]
contrib: move lib/gamnit/examples/asteronits to contrib/

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

8 years agolib/gamnit: tweak the world_camera to support devices with small depth buffer
Alexis Laferrière [Mon, 14 Dec 2015 16:46:08 +0000 (11:46 -0500)]
lib/gamnit: tweak the world_camera to support devices with small depth buffer

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

8 years agolib/gamnit: make controls larger in asteronits
Alexis Laferrière [Mon, 14 Dec 2015 16:44:56 +0000 (11:44 -0500)]
lib/gamnit: make controls larger in asteronits

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

8 years agolib/gamnit: intro README.md
Alexis Laferrière [Sun, 13 Dec 2015 18:29:02 +0000 (13:29 -0500)]
lib/gamnit: intro README.md

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

8 years agolib/gamnit: intro the asteronit example
Alexis Laferrière [Sat, 12 Dec 2015 00:19:06 +0000 (19:19 -0500)]
lib/gamnit: intro the asteronit example

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

8 years agolib/gamnit: intro `accept_events` and other input related services
Alexis Laferrière [Thu, 10 Dec 2015 22:10:34 +0000 (17:10 -0500)]
lib/gamnit: intro `accept_events` and other input related services

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

8 years agolib/gamnit: intro `simple_2d` and API for easy 2D games programming
Alexis Laferrière [Sat, 26 Sep 2015 18:40:14 +0000 (14:40 -0400)]
lib/gamnit: intro `simple_2d` and API for easy 2D games programming

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

8 years agolib/gamnit: intro `EulerCamera::reset_to_fit`
Alexis Laferrière [Sun, 13 Dec 2015 17:25:00 +0000 (12:25 -0500)]
lib/gamnit: intro `EulerCamera::reset_to_fit`

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

8 years agolib/gamnit: intro `UICamera`
Alexis Laferrière [Sat, 12 Dec 2015 00:25:28 +0000 (19:25 -0500)]
lib/gamnit: intro `UICamera`

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

8 years agolib/gamnit: add a non-null display argument to frame_core
Alexis Laferrière [Sat, 12 Dec 2015 16:16:38 +0000 (11:16 -0500)]
lib/gamnit: add a non-null display argument to frame_core

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

8 years agolib/gamnit: make `all_root_textures` public
Alexis Laferrière [Sat, 12 Dec 2015 04:48:18 +0000 (23:48 -0500)]
lib/gamnit: make `all_root_textures` public

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

8 years agolib/gamnit: fix offsets in textures to be lazy
Alexis Laferrière [Sat, 12 Dec 2015 00:26:08 +0000 (19:26 -0500)]
lib/gamnit: fix offsets in textures to be lazy

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

8 years agolib/android: fix `AndroidKeyEvent::to_c` to return a `nullable Char`
Alexis Laferrière [Sat, 12 Dec 2015 16:28:03 +0000 (11:28 -0500)]
lib/android: fix `AndroidKeyEvent::to_c` to return a `nullable Char`

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

8 years agolib/mnit: update doc and style of the `input` module
Alexis Laferrière [Thu, 10 Dec 2015 22:10:24 +0000 (17:10 -0500)]
lib/mnit: update doc and style of the `input` module

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

8 years agolib/mnit & implementations: move up `is_move` from Android to abstract
Alexis Laferrière [Sun, 13 Dec 2015 01:22:48 +0000 (20:22 -0500)]
lib/mnit & implementations: move up `is_move` from Android to abstract

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

8 years agotests: Updated error message (different line) in sav
Lucas Bajolet [Sun, 13 Dec 2015 17:06:56 +0000 (12:06 -0500)]
tests: Updated error message (different line) in sav

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

8 years agolib/core: Make all `Set` cloneable
Lucas Bajolet [Sat, 12 Dec 2015 18:39:19 +0000 (13:39 -0500)]
lib/core: Make all `Set` cloneable

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

8 years agocontrib/inkscape_tools: update support for gamnit
Alexis Laferrière [Sat, 12 Dec 2015 02:17:53 +0000 (21:17 -0500)]
contrib/inkscape_tools: update support for gamnit

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

8 years agolib/opts: `OptionContext::parse` use `args` by default
Alexis Laferrière [Fri, 11 Dec 2015 23:24:56 +0000 (18:24 -0500)]
lib/opts: `OptionContext::parse` use `args` by default

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

8 years agonitweb: add man page
Alexandre Terrasa [Wed, 9 Dec 2015 20:14:57 +0000 (15:14 -0500)]
nitweb: add man page

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

8 years agotests: add nitweb
Alexandre Terrasa [Wed, 9 Dec 2015 20:02:59 +0000 (15:02 -0500)]
tests: add nitweb

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

8 years agonitweb: introduce nitweb binary
Alexandre Terrasa [Wed, 9 Dec 2015 06:54:46 +0000 (01:54 -0500)]
nitweb: introduce nitweb binary

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

8 years agonitweb: introduce web actions
Alexandre Terrasa [Wed, 9 Dec 2015 06:54:32 +0000 (01:54 -0500)]
nitweb: introduce web actions

Basic services for now.

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

8 years agonitweb: introduce views used to render information
Alexandre Terrasa [Wed, 9 Dec 2015 06:53:53 +0000 (01:53 -0500)]
nitweb: introduce views used to render information

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

8 years agonitweb: render model entities to html
Alexandre Terrasa [Wed, 9 Dec 2015 06:53:15 +0000 (01:53 -0500)]
nitweb: render model entities to html

Actually move up common html templates from
doc::html_templates::html_model.

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

8 years agosrc: introduce a new tool called nitweb
Alexandre Terrasa [Wed, 9 Dec 2015 06:52:24 +0000 (01:52 -0500)]
src: introduce a new tool called nitweb

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

8 years agomodelize: introduce ModelBuilder::mentity2node method
Alexandre Terrasa [Fri, 11 Dec 2015 19:05:24 +0000 (14:05 -0500)]
modelize: introduce ModelBuilder::mentity2node method

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

8 years agoAdd simple proxy action
Philippe Pepos Petitclerc [Sat, 28 Nov 2015 23:59:58 +0000 (18:59 -0500)]
Add simple proxy action

Signed-off-by: Philippe Pepos Petitclerc <ppeposp@gmail.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 agomodel_collect: allow collect by full namespace
Alexandre Terrasa [Wed, 9 Dec 2015 06:53:01 +0000 (01:53 -0500)]
model_collect: allow collect by full namespace

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

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>