nit.git
6 years agoMerge: location: fix located_in behavior
Jean Privat [Fri, 19 Jan 2018 18:09:08 +0000 (13:09 -0500)]
Merge: location: fix located_in behavior

Before this PR, asking if `1,12--1,12` was in `1,1--2,1` returned `false`.

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

Pull-Request: #2606

6 years agoMerge: Gamnit: rewrite Android lifecycle support
Jean Privat [Fri, 19 Jan 2018 18:09:07 +0000 (13:09 -0500)]
Merge: Gamnit: rewrite Android lifecycle support

Rewrite much of the Android support to better deal with system state changes. This includes handling out of order lifecycle messages, temporarily invalid OpenGL display surfaces, and recreating the OpenGL context when it is released by the system.

In practice, this PR recreates in `gamnit::gamnit_android` a better version than what is in `android::game`. The old `android::game` could probably be removed with `mnit` and a small clean up.

As a bonus:
* Into portable* services to lock the device orientation. (The iOS variant will be in another PR when #2605 is merged.)
* Ask for 4x antialiasing, it should be available on all target platforms.
* Compile Android apps using gcc, it appears to compile a more stable GC. We can probably tweak a few defines to use clang instead.
* Fix numeric version numbers using the local time, causing surprises when compiled in the cloud.

Pull-Request: #2607

6 years agotests: don't use the readlink option -f when not available (macOS)
Alexis Laferrière [Fri, 19 Jan 2018 13:46:02 +0000 (08:46 -0500)]
tests: don't use the readlink option -f when not available (macOS)

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

6 years agotests: use en_US.UTF-8 locale on macOS
Alexis Laferrière [Fri, 19 Jan 2018 13:43:38 +0000 (08:43 -0500)]
tests: use en_US.UTF-8 locale on macOS

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

6 years agotests: fix superfluous option in call to xargs, was broken on macOS
Alexis Laferrière [Fri, 19 Jan 2018 13:42:28 +0000 (08:42 -0500)]
tests: fix superfluous option in call to xargs, was broken on macOS

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

6 years agotests: nitce crashes compiling test_platform_ios on the unavailble 'system'
Alexis Laferrière [Thu, 18 Jan 2018 18:32:48 +0000 (13:32 -0500)]
tests: nitce crashes compiling test_platform_ios on the unavailble 'system'

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

6 years agoios: accept spaces in path to the Nit project
Alexis Laferrière [Thu, 18 Jan 2018 13:56:36 +0000 (08:56 -0500)]
ios: accept spaces in path to the Nit project

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

6 years agotests: skip some tests failing weirdly on macOS
Alexis Laferrière [Wed, 17 Jan 2018 21:44:56 +0000 (16:44 -0500)]
tests: skip some tests failing weirdly on macOS

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

6 years agogamnit: import gamnit_android from android19 for a clear linearisation
Alexis Laferrière [Thu, 18 Jan 2018 00:33:44 +0000 (19:33 -0500)]
gamnit: import gamnit_android from android19 for a clear linearisation

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

6 years agoasteronits, action_nitro & model_viewer: use gamnit::landscape
Alexis Laferrière [Wed, 20 Dec 2017 13:07:58 +0000 (08:07 -0500)]
asteronits, action_nitro & model_viewer: use gamnit::landscape

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

6 years agotests: test_platform_ios produces an empty assets folder
Alexis Laferrière [Wed, 17 Jan 2018 21:44:39 +0000 (16:44 -0500)]
tests: test_platform_ios produces an empty assets folder

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

6 years agoshare: use BASH_SOURCE to reliably detect the script folder
Alexis Laferrière [Wed, 17 Jan 2018 21:44:05 +0000 (16:44 -0500)]
share: use BASH_SOURCE to reliably detect the script folder

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

6 years agopthreads: fix thread/gc support on iOS
Alexis Laferrière [Sun, 14 Jan 2018 16:42:06 +0000 (11:42 -0500)]
pthreads: fix thread/gc support on iOS

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

6 years agoasteronits, action_nitro & model_view: add makefile rules for iOS
Alexis Laferrière [Mon, 11 Dec 2017 04:19:12 +0000 (23:19 -0500)]
asteronits, action_nitro & model_view: add makefile rules for iOS

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

6 years agoiOS: add support for bdgwc/libgc
Alexis Laferrière [Tue, 12 Dec 2017 16:42:48 +0000 (11:42 -0500)]
iOS: add support for bdgwc/libgc

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

6 years agonitc ios: xcode support per file cflags
Alexis Laferrière [Wed, 13 Dec 2017 18:49:35 +0000 (13:49 -0500)]
nitc ios: xcode support per file cflags

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

6 years agogamnit: intro basic input event supports for iOS
Alexis Laferrière [Tue, 12 Dec 2017 18:20:11 +0000 (13:20 -0500)]
gamnit: intro basic input event supports for iOS

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

6 years agoios: implement app::audio for iOS
Alexis Laferrière [Wed, 20 Dec 2017 22:38:57 +0000 (17:38 -0500)]
ios: implement app::audio for iOS

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

6 years agoios: implement TextAsset for iOS
Alexis Laferrière [Fri, 15 Dec 2017 20:47:12 +0000 (15:47 -0500)]
ios: implement TextAsset for iOS

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

6 years agogamnit: intro core gamnit graphics services for iOS
Alexis Laferrière [Mon, 11 Dec 2017 03:32:15 +0000 (22:32 -0500)]
gamnit: intro core gamnit graphics services for iOS

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

6 years agogamnit: move landscape & portrait from the android package to gamnit
Alexis Laferrière [Fri, 15 Dec 2017 19:54:19 +0000 (14:54 -0500)]
gamnit: move landscape & portrait from the android package to gamnit

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

6 years agonitc: use GMT as numeric version instead of local time
Alexis Laferrière [Fri, 29 Dec 2017 17:43:44 +0000 (12:43 -0500)]
nitc: use GMT as numeric version instead of local time

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

6 years agogamnit: request 4x antialiasing
Alexis Laferrière [Wed, 8 Nov 2017 16:59:43 +0000 (11:59 -0500)]
gamnit: request 4x antialiasing

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

6 years agogamnit: rewrite android support
Alexis Laferrière [Tue, 3 Oct 2017 20:15:52 +0000 (16:15 -0400)]
gamnit: rewrite android support

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

6 years agogamnit: differentiate create_display and recreate_gamnit from create_gamnit
Alexis Laferrière [Fri, 3 Nov 2017 18:49:28 +0000 (14:49 -0400)]
gamnit: differentiate create_display and recreate_gamnit from create_gamnit

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

6 years agoandroid: add poll_looper_pause
Alexis Laferrière [Sun, 15 Oct 2017 02:18:07 +0000 (22:18 -0400)]
android: add poll_looper_pause

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

6 years agoandroid: use the gcc toolchain
Alexis Laferrière [Sun, 12 Nov 2017 22:53:25 +0000 (17:53 -0500)]
android: use the gcc toolchain

At this point, using the GCC toolchain compiles a more stable GC.

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

6 years agolocation: fix located_in behavior
Alexandre Terrasa [Mon, 15 Jan 2018 20:38:03 +0000 (15:38 -0500)]
location: fix located_in behavior

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

6 years agoios: intro GLKit services
Alexis Laferrière [Mon, 11 Dec 2017 03:39:04 +0000 (22:39 -0500)]
ios: intro GLKit services

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

6 years agonitc: support iOS assets
Alexis Laferrière [Mon, 11 Dec 2017 04:56:44 +0000 (23:56 -0500)]
nitc: support iOS assets

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

6 years agoglesv2: alternative include directive for iOS
Alexis Laferrière [Tue, 7 Apr 2015 19:47:02 +0000 (15:47 -0400)]
glesv2: alternative include directive for iOS

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

6 years agolib/realtime: use our custom clock_gettime when targetting < iOS 10
Alexis Laferrière [Wed, 13 Dec 2017 16:07:05 +0000 (11:07 -0500)]
lib/realtime: use our custom clock_gettime when targetting < iOS 10

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

6 years agogamnit: document how to get glslangValidator on macOS
Alexis Laferrière [Sun, 7 Jan 2018 01:42:16 +0000 (20:42 -0500)]
gamnit: document how to get glslangValidator on macOS

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

6 years agogamnit: don't delete simple_2d_program at on_stop, in case of restart
Alexis Laferrière [Sun, 7 Jan 2018 01:43:21 +0000 (20:43 -0500)]
gamnit: don't delete simple_2d_program at on_stop, in case of restart

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

6 years agogamnit: don't check status of the FBO at 0, breaks on iOS
Alexis Laferrière [Wed, 20 Dec 2017 21:22:20 +0000 (16:22 -0500)]
gamnit: don't check status of the FBO at 0, breaks on iOS

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

6 years agogamnit: intro and use indirection to bind the screen framebuffer
Alexis Laferrière [Tue, 12 Dec 2017 05:13:41 +0000 (00:13 -0500)]
gamnit: intro and use indirection to bind the screen framebuffer

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

6 years agogamnit: don't touch the dynamic_resolution FBO if it is not used
Alexis Laferrière [Sun, 14 Jan 2018 14:57:27 +0000 (09:57 -0500)]
gamnit: don't touch the dynamic_resolution FBO if it is not used

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

6 years agogamnit: reset the dynamic_resolution context when gamnit is recreated
Alexis Laferrière [Tue, 7 Nov 2017 15:13:34 +0000 (10:13 -0500)]
gamnit: reset the dynamic_resolution context when gamnit is recreated

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

6 years agoMerge: niti: fix constructors with an empty return
Jean Privat [Sat, 13 Jan 2018 16:13:48 +0000 (11:13 -0500)]
Merge: niti: fix constructors with an empty return

fixes #2546

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

6 years agoMerge: exec: display system error after failed fork
Jean Privat [Sat, 13 Jan 2018 16:13:47 +0000 (11:13 -0500)]
Merge: exec: display system error after failed fork

This PR modifies `basic_exec_execute` to add a call to `perror` to display the error message before exiting when a fork fails.

Pull-Request: #2603

6 years agotests: remove fixed *fixme* files for niti/constructor
Jean Privat [Fri, 12 Jan 2018 13:51:28 +0000 (08:51 -0500)]
tests: remove fixed *fixme* files for niti/constructor

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

6 years agoMerge: core: add `Sequence::get_or_default` and `get_or_null`
Jean Privat [Fri, 12 Jan 2018 13:34:38 +0000 (08:34 -0500)]
Merge: core: add `Sequence::get_or_default` and `get_or_null`

I though these existed. They do but only for `Map`s.

I just wanted to get an optional commande line argument without having to do an if.

~~~nit
# get the 2th command line argument, or else get null
var arg2 = args.get_nor_null(1)
~~~

I'm not fan of the names, but at least they are. If someone have better. Initially, I named it `try`, like `var arg2 = args.try(1)`.

Pull-Request: #2594

6 years agoMerge: benches: add a simple microbenches for nit try/catch
Jean Privat [Fri, 12 Jan 2018 13:34:38 +0000 (08:34 -0500)]
Merge: benches: add a simple microbenches for nit try/catch

It's just the program, not the bench scripts. Maybe also compare with other languages try/catch

Pull-Request: #2595
Reviewed-by: Romain Chanoir <romain.chanoir@viacesi.fr>

6 years agoMerge: gamnit: bug fixes, updated doc and prepare iOS support
Jean Privat [Fri, 12 Jan 2018 13:34:37 +0000 (08:34 -0500)]
Merge: gamnit: bug fixes, updated doc and prepare iOS support

This PR brings miscellaneous improvements to the `gamnit` graphics framework, see each commit description for more details.

Pull-Request: #2597
Reviewed-by: Romain Chanoir <romain.chanoir@viacesi.fr>

6 years agoMerge: Android: fix issues in the audio support
Jean Privat [Fri, 12 Jan 2018 13:34:36 +0000 (08:34 -0500)]
Merge: Android: fix issues in the audio support

Refactor the loading of sounds and music to use the same logic and order, and to fix trying to load invalid resource ids (the errors on 0x00000000). Update the documentation to the currently recommended usage. And close the file descriptors after use/dup.

Pull-Request: #2598

6 years agogamnit: fix parsing .obj models without an explicit object declaration
Alexis Laferrière [Fri, 22 Dec 2017 00:14:02 +0000 (19:14 -0500)]
gamnit: fix parsing .obj models without an explicit object declaration

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

6 years agodocker: add zipalign to support compiling Android apps in release mode
Alexis Laferrière [Sat, 9 Dec 2017 20:07:50 +0000 (15:07 -0500)]
docker: add zipalign to support compiling Android apps in release mode

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

6 years agogamnit: print gl_MAX_TEXTURE_SIZE with other driver data
Alexis Laferrière [Sat, 16 Dec 2017 14:56:15 +0000 (09:56 -0500)]
gamnit: print gl_MAX_TEXTURE_SIZE with other driver data

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

6 years agogamnit: fix draw order of the DPad background
Alexis Laferrière [Tue, 12 Dec 2017 04:20:56 +0000 (23:20 -0500)]
gamnit: fix draw order of the DPad background

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

6 years agogamnit: fix doc of `ModelAsset` to represent the current API
Alexis Laferrière [Sun, 17 Dec 2017 15:21:34 +0000 (10:21 -0500)]
gamnit: fix doc of `ModelAsset` to represent the current API

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

6 years agoexec: display system error after failed fork
Alexandre Terrasa [Thu, 21 Dec 2017 19:17:52 +0000 (14:17 -0500)]
exec: display system error after failed fork

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

6 years agogamnit: lapse clock on resume, so `update` ignores the time in the background
Alexis Laferrière [Mon, 4 Dec 2017 18:06:08 +0000 (13:06 -0500)]
gamnit: lapse clock on resume, so `update` ignores the time in the background

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

6 years agogamnit: set resolution at 1080p for splash screens (as the doc says)
Alexis Laferrière [Tue, 17 Oct 2017 00:24:46 +0000 (20:24 -0400)]
gamnit: set resolution at 1080p for splash screens (as the doc says)

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

6 years agogamnit: don't delete uninitialized programs
Alexis Laferrière [Wed, 29 Nov 2017 19:06:11 +0000 (14:06 -0500)]
gamnit: don't delete uninitialized programs

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

6 years agoglesv2: check for null pointers in glGetString
Alexis Laferrière [Tue, 26 Sep 2017 19:27:07 +0000 (15:27 -0400)]
glesv2: check for null pointers in glGetString

glGetString may return NULL pointers when OpenGL has not been correctly
initialized. This assert makes such errors easier to debug on mobile
devices when there's no stacktrace.

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

6 years agoniti: fix constructors with an empty return
Jean Privat [Wed, 20 Dec 2017 14:20:23 +0000 (09:20 -0500)]
niti: fix constructors with an empty return

fixes #2546

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

6 years agobenches: add a simple microbenches for nit try/catch
Jean Privat [Mon, 4 Dec 2017 15:36:16 +0000 (10:36 -0500)]
benches: add a simple microbenches for nit try/catch

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

6 years agocore: add `Sequence::get_or_default` and `get_or_null`
Jean Privat [Mon, 4 Dec 2017 13:59:27 +0000 (08:59 -0500)]
core: add `Sequence::get_or_default` and `get_or_null`

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

6 years agoMerge: nitx: use doc commands
Jean Privat [Tue, 19 Dec 2017 15:17:37 +0000 (10:17 -0500)]
Merge: nitx: use doc commands

Three things in this PR:
* `nitx` now uses doc-commands (and related cleaning), bye bye the heavy `DocModel` with pre built `DocPages`
* More tests for `nitx`
* Move `nitx` to the `doc` tools suite, the group is now known as `doc::term`

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

6 years agoMerge: nitweb: use doc-commands
Jean Privat [Tue, 19 Dec 2017 15:17:35 +0000 (10:17 -0500)]
Merge: nitweb: use doc-commands

Migrate nitweb to the doc-commands system.

Changes:
* moved the group to `doc::api`
* use doc-commands (backend and frontend changes)
* limited the size of produced json at the maximum
* API accepts "?pretty" parameter

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

6 years agocore: fix README for new doc-commands names
Alexandre Terrasa [Tue, 28 Nov 2017 18:28:18 +0000 (13:28 -0500)]
core: fix README for new doc-commands names

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

6 years agomodel: move model_json to doc/templates
Alexandre Terrasa [Fri, 10 Nov 2017 20:47:03 +0000 (15:47 -0500)]
model: move model_json to doc/templates

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

6 years agomodel/json: fix model json tests after update
Alexandre Terrasa [Wed, 25 Oct 2017 19:31:08 +0000 (15:31 -0400)]
model/json: fix model json tests after update

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

6 years agodoc/commands: fix commands json tests after update
Alexandre Terrasa [Wed, 25 Oct 2017 19:30:55 +0000 (15:30 -0400)]
doc/commands: fix commands json tests after update

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

6 years agonitweb: migrate frontend to new json/commands
Alexandre Terrasa [Wed, 25 Oct 2017 19:03:22 +0000 (15:03 -0400)]
nitweb: migrate frontend to new json/commands

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

6 years agodoc/api: migrate api to new doc-commands
Alexandre Terrasa [Tue, 28 Nov 2017 18:30:05 +0000 (13:30 -0500)]
doc/api: migrate api to new doc-commands

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

6 years agonitx: use AnsiHighlightVisitor
Alexandre Terrasa [Fri, 8 Dec 2017 20:30:43 +0000 (15:30 -0500)]
nitx: use AnsiHighlightVisitor

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

6 years agoshare/man: update manpage for the nitx --catalog option
Alexandre Terrasa [Fri, 8 Dec 2017 19:54:55 +0000 (14:54 -0500)]
share/man: update manpage for the nitx --catalog option

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

6 years agonitx: update bin tests
Alexandre Terrasa [Tue, 14 Nov 2017 22:52:46 +0000 (17:52 -0500)]
nitx: update bin tests

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

6 years agonitx: add command tests
Alexandre Terrasa [Thu, 26 Oct 2017 00:01:49 +0000 (20:01 -0400)]
nitx: add command tests

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

6 years agoandroid: update example in audio
Alexis Laferrière [Wed, 18 Oct 2017 19:35:45 +0000 (15:35 -0400)]
android: update example in audio

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

6 years agoandroid: close file descriptors of sound & music after use
Alexis Laferrière [Sat, 16 Dec 2017 17:10:34 +0000 (12:10 -0500)]
android: close file descriptors of sound & music after use

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

6 years agoandroid: refactor music/sounds and fix trying to use invalid music resource
Alexis Laferrière [Wed, 18 Oct 2017 15:04:56 +0000 (11:04 -0400)]
android: refactor music/sounds and fix trying to use invalid music resource

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

6 years agonitx: nitx use doc commands
Alexandre Terrasa [Thu, 26 Oct 2017 00:01:31 +0000 (20:01 -0400)]
nitx: nitx use doc commands

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

6 years agodoc/commands: parser stores commands usage and help
Alexandre Terrasa [Tue, 7 Nov 2017 19:24:42 +0000 (14:24 -0500)]
doc/commands: parser stores commands usage and help

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

6 years agomodel/json: simplify the basic rendering at a maximum level
Alexandre Terrasa [Wed, 25 Oct 2017 19:01:27 +0000 (15:01 -0400)]
model/json: simplify the basic rendering at a maximum level

No more nested objects and cross-references.

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

6 years agonitweb: move `web` group to `doc::api`
Alexandre Terrasa [Tue, 28 Nov 2017 18:12:15 +0000 (13:12 -0500)]
nitweb: move `web` group to `doc::api`

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

6 years agomodel: fix mdoc_or_fallback for nullables types
Alexandre Terrasa [Wed, 25 Oct 2017 19:00:28 +0000 (15:00 -0400)]
model: fix mdoc_or_fallback for nullables types

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

6 years agonitweb: allows client to precise ?pretty in request args
Alexandre Terrasa [Thu, 17 Aug 2017 20:32:06 +0000 (16:32 -0400)]
nitweb: allows client to precise ?pretty in request args

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

6 years agolib/popcorn: to_json accept serialization parameters
Alexandre Terrasa [Thu, 17 Aug 2017 20:33:33 +0000 (16:33 -0400)]
lib/popcorn: to_json accept serialization parameters

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

6 years agoMerge: annotations: introduce `example` annotation
Jean Privat [Mon, 4 Dec 2017 14:07:40 +0000 (09:07 -0500)]
Merge: annotations: introduce `example` annotation

## Motivations

When looking at the nit libraries, it's not rare to find external files used only to store examples that cannot be expressed as docunit.

The `example` annotation aims at tag pieces of code that may be considered as examples and thus be:
1. ignored be the compilation tools
2. used by documentation tools (and testing tools)

## Why a new annotation?

Rather than the `examples/` folder convention?

1. Examples can now be included directly in the module code if needed
2. Makes it easier to separate real code example from helper code and example tests
3. More flexibility in project organization and namming
4. To be coherent with the `test` annotation

## How to use it?

Simply tag the MEntity with `example`:

~~~nit
module my_example_module is example
~~~

Can also be applied on classes and methods:

~~~nit
module my_module # is not example

# Abstract class A, we should provide an example of subclass...
# So let's see `ExampleA`.
abstract class A
end

# This class provides an example of how to sublass A.
class ExampleA is example
   super A
end

class C
    # This method provides an example of how to instantiate `A` sublcasses
    fun example_init_a is example do
        var a: A = new ExampleA
    end
end
~~~

## Incoming work

This PR only introduces the annotation and applies it to the existing source code.

Next PR will make tools like nitweb, nitdoc and nitx use it (via commands #2580).

Pull-Request: #2581
Reviewed-by: Alexandre Blondin Massé <alexandre.blondin.masse@gmail.com>
Reviewed-by: Jean Privat <jean@pryen.org>

6 years agolib/ai: fix raw code in now tested docunit for puzzle test module
Alexandre Terrasa [Fri, 1 Dec 2017 16:39:38 +0000 (11:39 -0500)]
lib/ai: fix raw code in now tested docunit for puzzle test module

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

6 years agotests: fix tests for model json
Alexandre Terrasa [Thu, 30 Nov 2017 16:32:19 +0000 (11:32 -0500)]
tests: fix tests for model json

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

6 years agoMerge: highlight with ansi color (for console)
Jean Privat [Thu, 30 Nov 2017 01:50:40 +0000 (20:50 -0500)]
Merge: highlight with ansi color (for console)

Because the nit interactive interpreter and nitx might want it

![capture du 2017-11-29 14-05-07](https://user-images.githubusercontent.com/135828/33395803-abb12fdc-d514-11e7-9921-75a3a1ec00bb.png)

This provides a new `AnsiHighlightVisitor` than can do stuff

Note: colors are currently hard-coded and only comments, keywords, classnames and literals are highlighted. However, since this reuse the full highlighting infrastructure, a lot of semantic things can be added.

Pull-Request: #2593

6 years agonitlight: update manpage
Jean Privat [Thu, 30 Nov 2017 00:51:05 +0000 (19:51 -0500)]
nitlight: update manpage

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

6 years agonitlight: add --txt for text-based highlighting
Jean Privat [Wed, 29 Nov 2017 18:48:57 +0000 (13:48 -0500)]
nitlight: add --txt for text-based highlighting

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

6 years agohighlight: extract HTML stuff from highlight into htmlight
Jean Privat [Wed, 29 Nov 2017 18:48:16 +0000 (13:48 -0500)]
highlight: extract HTML stuff from highlight into htmlight

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

6 years agohighlight: remove useless `self` parameter (some crazy previous refactor?)
Jean Privat [Wed, 29 Nov 2017 19:28:19 +0000 (14:28 -0500)]
highlight: remove useless `self` parameter (some crazy previous refactor?)

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

6 years agohighlight: move hightlightcode inside HighlightVisitor
Jean Privat [Wed, 29 Nov 2017 19:27:40 +0000 (14:27 -0500)]
highlight: move hightlightcode inside HighlightVisitor

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

6 years agohighlight: rename enter_visit and htmlize (and fix spell of hightlight)
Jean Privat [Wed, 29 Nov 2017 18:44:16 +0000 (13:44 -0500)]
highlight: rename enter_visit and htmlize (and fix spell of hightlight)

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

6 years agoMerge: gamnit: new services and a lot of bug fixes and performance improvements
Jean Privat [Wed, 29 Nov 2017 15:40:53 +0000 (10:40 -0500)]
Merge: gamnit: new services and a lot of bug fixes and performance improvements

This PR groups small fixes to gamnit and related packages. It is a general cleanup in preparation for optimizations to the gamnit depth 3D API.

Intro a few new services:
* `ParticleSystem::clear` to remove all live particles.
* `CustomTexture` can be modified and reloaded in GPU memory after the first call to `load`.
* Don't apply dynamic resolution to UI sprites as they are usually lightweight and any change in resolution is easily noticable.

Optimizations:
* Matrix creation and manipulation, in both gamnit and the matrix package.
* Free pixel data from both Nit and Java memory after loading them from the assets folder into the GPU memory.
* Avoids using mallocs in `realtime` services.

Fixes:
* Fix the left and right anchors of the `UICamera`.
* Fix a constant used to ask for antialiasing in the `egl` package.
* Avoid long attribute names in Blinn-Phong shader in case their name is truncated or the attribute is optimized out.
* Fix pointer to the parent GPU texture name in subtextures.
* Improve a few API doc.

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

6 years agoMerge: android: adaptive icons, free memory on demand and use same package in debug...
Jean Privat [Wed, 29 Nov 2017 15:40:51 +0000 (10:40 -0500)]
Merge: android: adaptive icons, free memory on demand and use same package in debug mode

This PR extends the new Android compilation toolchain:

* Add support for adaptive icons from Android 8 Oreo (and the older `roundIcon`), see https://developer.android.com/guide/practices/ui_guidelines/icon_design_adaptive.html. It should detect the icons structure generated by Android Studio 3.

* Tweak the GC compilation options to make it more stable and support releasing memory when the Android system sends the `onLowMemory` message.

* Don't change the app name and package/namespace when compiling in debug mode. While this allowed to easily install both the release and the debug version of the same app on a device, it could be unexpected and it was not compatible with some Google services linked to a precise package name. The old behavior can be reproduced in standard Nit code by using a debug variant like so:
  ~~~
  module asteronits_debug is
      app_name "Asteronits debug"
      app_namespace "org.nitlanguage.asteronits_debug"
  end

  import asteronits
  ~~~

Pull-Request: #2589

6 years agoMerge: tests: force a utf8 locale because gradle don't like pure ascii
Jean Privat [Wed, 29 Nov 2017 15:40:49 +0000 (10:40 -0500)]
Merge: tests: force a utf8 locale because gradle don't like pure ascii

this should fix the CI tests when people with international names make PR.

ref: https://github.com/gradle/gradle/issues/3117

Pull-Request: #2590

6 years agotests: update some sav because uft8 locale
Jean Privat [Wed, 29 Nov 2017 13:52:31 +0000 (08:52 -0500)]
tests: update some sav because uft8 locale

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

6 years agotests: force a utf8 locale because gradle don't like pure ascii
Jean Privat [Tue, 28 Nov 2017 15:49:10 +0000 (10:49 -0500)]
tests: force a utf8 locale because gradle don't like pure ascii

this should fix the CI tests when people with international names make PR.

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

6 years agotests: fix tests for sort_perf
Alexandre Terrasa [Thu, 23 Nov 2017 16:01:30 +0000 (11:01 -0500)]
tests: fix tests for sort_perf

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

6 years agotests: fix tests for neo
Alexandre Terrasa [Wed, 22 Nov 2017 00:35:40 +0000 (19:35 -0500)]
tests: fix tests for neo

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

6 years agotests: fix tests for nitls
Alexandre Terrasa [Wed, 22 Nov 2017 00:35:36 +0000 (19:35 -0500)]
tests: fix tests for nitls

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

6 years agotests: fix tests for nitdoc
Alexandre Terrasa [Wed, 22 Nov 2017 00:35:30 +0000 (19:35 -0500)]
tests: fix tests for nitdoc

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

6 years agotests: fix tests for nitsmells
Alexandre Terrasa [Wed, 22 Nov 2017 00:35:22 +0000 (19:35 -0500)]
tests: fix tests for nitsmells

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