nit.git
6 years agolib: intro `prompt`, basic Apache 2.0 service to display a prompt
Alexis Laferrière [Wed, 14 Feb 2018 13:22:37 +0000 (08:22 -0500)]
lib: intro `prompt`, basic Apache 2.0 service to display a prompt

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

6 years agoMerge: nitc: check pkg-config packages availability later
Jean Privat [Fri, 26 Jan 2018 21:12:15 +0000 (16:12 -0500)]
Merge: nitc: check pkg-config packages availability later

The `pkgconfig` annotation tells the compiler to use the `pkg-config` command in order to get the C compiler and linker options required to build the user C code. The availability of each package was tested twice, once at reading the annotation and once in the generated Makefile. This PR moves the first check later, with the generation of the Makefile. There is still two checks, one by the Nit compiler with a prettier output, and one by the Makefile in case it is distributed with the generated C source files.

This fixes an issue we've had when compiling for Android and iOS, where the result of the annotation was not used but still blocked the compilation if the host did not have the package. And leaving the check to the Makefile give a chance to the programmer to tweak it before the C compilation when cross-compiling.

The error message thrown by the Makefile is less user-friendly as we lose the reference to the Nit source file and line number. This should not be much on an issue since it is rarely a programming error, more of a system configuration error, but it could be improved upon if it becomes an issue.

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

6 years agotests: test_syntax now reports other errors before the pkgconfig error
Alexis Laferrière [Tue, 23 Jan 2018 18:53:28 +0000 (13:53 -0500)]
tests: test_syntax now reports other errors before the pkgconfig error

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

6 years agonitc & niti: move the duplicated pkg-config checks to the pkgconfig module
Alexis Laferrière [Tue, 23 Jan 2018 18:48:32 +0000 (13:48 -0500)]
nitc & niti: move the duplicated pkg-config checks to the pkgconfig module

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

6 years agoMerge: Gamnit on iOS
Jean Privat [Thu, 25 Jan 2018 20:16:37 +0000 (15:16 -0500)]
Merge: Gamnit on iOS

Support iOS as a target for Gamnit games, including:

* GC on iOS and Xcode assets folder support in the compiler.
* iOS view controller and OpenGL view using the GLKit services.
* Loading of assets: sound, texture and text (and thus 3D models and fonts).
* iOS touch event and orientation change support.
* A few bug fix and tweaks to Gamnit.
* Minimal makefile rules to target iOS.

The game `asteronits` works as expected, here it is on iPad (With controls that are way too big):

![screen shot 2018-01-14 at 10 11 17](https://user-images.githubusercontent.com/208057/34918201-187b8b4a-f91d-11e7-86a2-6b891b237316.png)

Limitations:
* By default, the compiler generates an app for the simulator. To compile for a physical device, in practice, I run `nitc -m ios --compile-dir nit_compile` to generate the iOS project and view errors in Nit or in the custom Objective-C code. And then I launch Xcode with `open -a xcode nit_compile/ios/my_project.xcodeproj` to compile and run on a device from there.

* The depth API (3D) does not work on iOS with this PR because of known bugs in the current implementation. I have a rewrite of the depth API that fixes these bugs and bring a much needed performance boost.

* A `Sound` instance can't be played more than once concurrently. This could be improved by using `AVPlayer` as kind of sound channel and an `AVPlayerItem` for each sound instance, instead of the current `AVAudioPlayer`.

* iOS does not support exactly the same format for assets than Android. Sounds in mp3 format should work on both platforms. PNG files work on both platforms but iOS is more picky on the color palette, I've had an issue with a greyscale PNG, RGBA PNG files should be safe.

  You can always use the `app_files` annotation to include platform-specific assets.

* `gamnit::selection` does not work on iOS because we can't read the screen pixels. It should be updated to use an FBO.

* We still need a portable API for locking the screen orientation.

* Compiling Gamnit games for iOS fails at a missing pkg-config package. The package is not used and in can be safely ignored by removing the "pkgconfig" line in `lib/glesv2/glesv2.nit`. I'll need to find a clean fix for this...

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

6 years agoMerge: doc/commands: extract CmdCode superclass
Jean Privat [Thu, 25 Jan 2018 20:16:35 +0000 (15:16 -0500)]
Merge: doc/commands: extract CmdCode superclass

Provides a common super class to factorize code rendering services for doc commands.

Changes:
* renamed `CmdComment::render` to `render_comment` to avoid name conflicts with multiple inheritance
* extracted `CmdCode` command to factorize code related services
* introduced new class `CmdEntityCode`, in place of the old `CmdCode` class
* updated nitx/nitweb clients
* updated tests

Pull-Request: #2609

6 years agoMerge: Remove the packages `glesv1`, `mnit` and `sdl` (1.2), and their clients
Jean Privat [Thu, 25 Jan 2018 20:16:34 +0000 (15:16 -0500)]
Merge: Remove the packages `glesv1`, `mnit` and `sdl` (1.2), and their clients

This PR removes the packages for OpenGL ES 1.0, most of the graphics engine `mnit` and the SDL 1.2 wrapper `sdl`, as well as their clients: crazy_moles, friendz, memory, mnit_ballz, mnit_dino, shoot and the 2D client of Tinks!.

This purge is mainly motivated by the declining support for OpenGL ES 1.0, it is not available on macOS and on some recent GNU/Linux distributions (including on our test servers). Plus, all the libraries have been replaced by well-supported alternatives: `glesv2` for OpenGL ES 2.0, the graphics engine `gamnit` and `sdl2`. The new libraries are even more portable, adding support for Windows and iOS alongside GNU/Linux and Android.

Some of the deleted games were quite good, it is sad to simply let them go. If anyone is willing to put in the work, most of these games can still be updated to `gamnit` by reverting the commit and writing some code!

@privat  Could you somehow lock the APK files on the F-Droid server so the games live on? They all had Android variants except for `shoot`.

Pull-Request: #2611

6 years agoandroid: update the `sensors` module to use gamnit
Alexis Laferrière [Thu, 25 Jan 2018 14:05:16 +0000 (09:05 -0500)]
android: update the `sensors` module to use gamnit

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

6 years agotests: don't TODO Darwin errors for OpenGL ES 1.0
Alexis Laferrière [Sun, 7 Jan 2018 14:38:48 +0000 (09:38 -0500)]
tests: don't TODO Darwin errors for OpenGL ES 1.0

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

6 years agoinkscape_tools: remove `mnit` support
Alexis Laferrière [Fri, 12 Jan 2018 03:11:57 +0000 (22:11 -0500)]
inkscape_tools: remove `mnit` support

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

6 years agoinkscape_tools: delete mnit based test applications
Alexis Laferrière [Fri, 12 Jan 2018 03:09:15 +0000 (22:09 -0500)]
inkscape_tools: delete mnit based test applications

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

6 years agolib: clear all references to mnit from memory
Alexis Laferrière [Fri, 12 Jan 2018 03:02:33 +0000 (22:02 -0500)]
lib: clear all references to mnit from memory

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

6 years agolib: delete the `sdl` package (there's still SDL2)
Alexis Laferrière [Fri, 12 Jan 2018 02:54:33 +0000 (21:54 -0500)]
lib: delete the `sdl` package (there's still SDL2)

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

6 years agolib: delete most of the mnit package (keeping input.nit)
Alexis Laferrière [Sun, 7 Jan 2018 14:30:39 +0000 (09:30 -0500)]
lib: delete most of the mnit package (keeping input.nit)

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

6 years agotinks: delete the old 2D mnit client
Alexis Laferrière [Fri, 12 Jan 2018 02:47:53 +0000 (21:47 -0500)]
tinks: delete the old 2D mnit client

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

6 years agoexamples: delete the `shoot` game
Alexis Laferrière [Sun, 7 Jan 2018 14:50:55 +0000 (09:50 -0500)]
examples: delete the `shoot` game

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

6 years agocontrib: delete the friendz game
Alexis Laferrière [Sun, 7 Jan 2018 14:41:31 +0000 (09:41 -0500)]
contrib: delete the friendz game

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

6 years agocontrib: delete the memory game
Alexis Laferrière [Sun, 7 Jan 2018 14:28:05 +0000 (09:28 -0500)]
contrib: delete the memory game

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

6 years agoexamples: delete mnit_ballz
Alexis Laferrière [Sun, 7 Jan 2018 14:26:50 +0000 (09:26 -0500)]
examples: delete mnit_ballz

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

6 years agoexamples: remove mnit_dino
Alexis Laferrière [Wed, 24 Jan 2018 18:03:39 +0000 (13:03 -0500)]
examples: remove mnit_dino

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

6 years agocontrib: remove crazy_moles
Alexis Laferrière [Wed, 24 Jan 2018 18:03:51 +0000 (13:03 -0500)]
contrib: remove crazy_moles

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

6 years agocontrib: remove mnit_test
Alexis Laferrière [Sun, 7 Jan 2018 14:26:33 +0000 (09:26 -0500)]
contrib: remove mnit_test

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

6 years agonitc: document the phase detecting the annots `platform` and `pkgconfig`
Alexis Laferrière [Tue, 23 Jan 2018 14:04:04 +0000 (09:04 -0500)]
nitc: document the phase detecting the annots `platform` and `pkgconfig`

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

6 years agodoc/commands: update tests
Alexandre Terrasa [Mon, 22 Jan 2018 20:24:51 +0000 (15:24 -0500)]
doc/commands: update tests

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

6 years agodoc/commands: extract `CmdCode` super class
Alexandre Terrasa [Mon, 22 Jan 2018 20:24:38 +0000 (15:24 -0500)]
doc/commands: extract `CmdCode` super class

So we can factorize code related queries even if they are not related to a specific MEntity

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

6 years agodoc/commands: rename `CmdComment::render` to `render_comment` to avoid name conflicts
Alexandre Terrasa [Mon, 22 Jan 2018 20:23:01 +0000 (15:23 -0500)]
doc/commands: rename `CmdComment::render` to `render_comment` to avoid name conflicts

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

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>