nit.git
8 years agoniti FFI: delete the nit_compile directory after execution
Alexis Laferrière [Fri, 4 Mar 2016 19:21:05 +0000 (14:21 -0500)]
niti FFI: delete the nit_compile directory after execution

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

8 years agoniti FFI: cmd line option to change the nit_compile dir and default to /tmp/
Alexis Laferrière [Fri, 4 Mar 2016 19:19:05 +0000 (14:19 -0500)]
niti FFI: cmd line option to change the nit_compile dir and default to /tmp/

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

8 years agoMerge: fix Int::is_prime
Jean Privat [Thu, 3 Mar 2016 07:35:26 +0000 (02:35 -0500)]
Merge: fix Int::is_prime

Primality test should also test the sqrt of the number.

Pull-Request: #1970
Reviewed-by: Lucas Bajolet <r4pass@hotmail.com>

8 years agoMerge: nitc: don't crash when checking if a broken method can be inlined
Jean Privat [Thu, 3 Mar 2016 07:35:23 +0000 (02:35 -0500)]
Merge: nitc: don't crash when checking if a broken method can be inlined

Pull-Request: #1968

8 years agoMerge: New `optional` annotation on attributes
Jean Privat [Thu, 3 Mar 2016 07:35:09 +0000 (02:35 -0500)]
Merge: New `optional` annotation on attributes

As requested at #1843 by @R4PaSs, a new annotation `optional` is now available on attributes.

~~~nit
class A
    var x: Int = 99 is optional
   # Because of `optional`, the automatic signature of the A constructor is `init(x: nullable Int)`
end

var a = new A
print a.x # outputs 99
var b = new A(4)
print b.x # output 4
~~~

In the model, the `optional` annotation only affects the signature and the behavior of the setter.
It transforms the argument to a `nullable` one and use the provided value if `null` is given as a parameter.

The `nullable` parameter is then propagated to the automatic constructors in the usual way.

Basically, the previous example is equivalent to having written:

~~~
class A
    var x: Int is noautoinit
    fun x=(x: nullable Int) is autoinit do if x != null then self.x = x else self.x = 99
end
~~~

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

8 years agoMerge: typing: include a hook to enable more precise error information on 'expected...
Jean Privat [Thu, 3 Mar 2016 07:35:01 +0000 (02:35 -0500)]
Merge: typing: include a hook to enable more precise error information on 'expected expression' errors

The point is to help to solve the second part of #1392

Before:

~~~
print (-1).to_s
^
test.nit:2,1--10: Error: expected an expression.
~~~

After:

~~~
print (-1).to_s
^
test.nit:2,1--10: Error: expected an expression to be the receiver of `to_s`
~~~

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

8 years agofix Int::is_prime
Jean Privat [Wed, 2 Mar 2016 20:24:38 +0000 (15:24 -0500)]
fix Int::is_prime

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

8 years agonitc: don't crash when checking if a broken method can be inlined
Alexis Laferrière [Sat, 17 Oct 2015 15:17:41 +0000 (11:17 -0400)]
nitc: don't crash when checking if a broken method can be inlined

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

8 years agotests: add base_attr_optional.nit
Jean Privat [Fri, 26 Feb 2016 21:06:56 +0000 (16:06 -0500)]
tests: add base_attr_optional.nit

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

8 years agoengine: handle new attribute annotation `is_optional`
Jean Privat [Fri, 26 Feb 2016 21:01:29 +0000 (16:01 -0500)]
engine: handle new attribute annotation `is_optional`

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

8 years agomodelize: new attribute annotation `is optional`
Jean Privat [Fri, 26 Feb 2016 21:00:58 +0000 (16:00 -0500)]
modelize: new attribute annotation `is optional`

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

8 years agomodelize: use the signature of the setter in the initializer
Jean Privat [Fri, 26 Feb 2016 21:00:26 +0000 (16:00 -0500)]
modelize: use the signature of the setter in the initializer

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

8 years agoMerge: examples/calculator: fix missing icon in Android
Jean Privat [Fri, 26 Feb 2016 13:34:56 +0000 (08:34 -0500)]
Merge: examples/calculator: fix missing icon in Android

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

8 years agotyping: include a hook to enable more precise error information on 'expected expressi...
Jean Privat [Thu, 25 Feb 2016 19:11:57 +0000 (14:11 -0500)]
typing: include a hook to enable more precise error information on 'expected expression' errors

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

8 years agoexamples/calculator: fix missing icon in Android
Alexis Laferrière [Thu, 25 Feb 2016 21:16:09 +0000 (16:16 -0500)]
examples/calculator: fix missing icon in Android

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

8 years agoMerge: core/list: fix `List::clear` so it resets `length` to 0
Jean Privat [Thu, 25 Feb 2016 14:02:28 +0000 (09:02 -0500)]
Merge: core/list: fix `List::clear` so it resets `length` to 0

This bug lead to segmentation faults when iterating over the items of a list after a call to `clear`.

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

8 years agoMerge: contrib/opportunity: fix usage of % format, now indexed from 0
Jean Privat [Thu, 25 Feb 2016 14:02:25 +0000 (09:02 -0500)]
Merge: contrib/opportunity: fix usage of % format, now indexed from 0

http://xymus.net/opportunity/ has already been updated with the fix.

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

8 years agoMerge: lib/sdl: workaround to avoid constructor callback bug
Jean Privat [Thu, 25 Feb 2016 14:02:23 +0000 (09:02 -0500)]
Merge: lib/sdl: workaround to avoid constructor callback bug

This was first a temporary fix for #1941 to repair Nit games on the deskop. But it is also a nice cleanup, it brings to Nit the instantiation and the implicit cast to a more general and nullable type. The casts themselves were not very pretty using FFI callbacks.

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

8 years agoMerge: Opportunity and Tnitter logos
Jean Privat [Thu, 25 Feb 2016 14:02:19 +0000 (09:02 -0500)]
Merge: Opportunity and Tnitter logos

This PR intro 2 logos for Opportunity (in English and French) and a new wide icon for Tnitter. These news icons are already in use on http://xymus.net/opportunity.

Note that even if the large Opportunity logo on the landing page is vectorial, it should not be the file included in the `art/` directory for a production server. That file has both logos, more assets and uses fonts, all of which should be stripped for a production server. It is still good enough for local debugging.

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

8 years agoMerge: Minor fix to atan2 and triangulate
Jean Privat [Thu, 25 Feb 2016 14:02:17 +0000 (09:02 -0500)]
Merge: Minor fix to atan2 and triangulate

Fix reversed axes in `atan2`, but since it is actually just a change in the name of the variables (and doc) it should not break the clients.

Also sorting points of a polygon in `triangulate` completely invalidated some complex polygons.

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

8 years agoMerge: Minor tweaks and fixes for Android
Jean Privat [Thu, 25 Feb 2016 14:02:13 +0000 (09:02 -0500)]
Merge: Minor tweaks and fixes for Android

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

8 years agolib/core: fix `List::clear` not setting `length` to 0
Alexis Laferrière [Thu, 25 Feb 2016 04:08:42 +0000 (23:08 -0500)]
lib/core: fix `List::clear` not setting `length` to 0

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

8 years agocontrib/opportunity: fix usage of % format indexed at 0
Alexis Laferrière [Tue, 23 Feb 2016 20:06:17 +0000 (15:06 -0500)]
contrib/opportunity: fix usage of % format indexed at 0

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Reported-by: Lucas Bajolet <r4pass@hotmail.com>

8 years agoxymus.net: point to subfolders instead of subdomains to share the cache
Alexis Laferrière [Mon, 15 Feb 2016 13:34:30 +0000 (08:34 -0500)]
xymus.net: point to subfolders instead of subdomains to share the cache

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

8 years agoxymus.net: track more pages with google analytics
Alexis Laferrière [Sun, 14 Feb 2016 21:32:13 +0000 (16:32 -0500)]
xymus.net: track more pages with google analytics

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

8 years agoxymus.net: use opportunity and tnitter branding in header
Alexis Laferrière [Sun, 14 Feb 2016 03:32:27 +0000 (22:32 -0500)]
xymus.net: use opportunity and tnitter branding in header

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

8 years agocontrib/tnitter: intro wide icon for the web client
Alexis Laferrière [Sun, 14 Feb 2016 14:29:42 +0000 (09:29 -0500)]
contrib/tnitter: intro wide icon for the web client

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

8 years agocontrib/opportunity: revamp style of welcome page and use branding
Alexis Laferrière [Sun, 14 Feb 2016 02:25:21 +0000 (21:25 -0500)]
contrib/opportunity: revamp style of welcome page and use branding

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

8 years agocontrib/opportunity: intro branding source file
Alexis Laferrière [Sun, 14 Feb 2016 02:16:34 +0000 (21:16 -0500)]
contrib/opportunity: intro branding source file

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

8 years agolib/core: fix order of the params of `atan(y, x)`
Alexis Laferrière [Tue, 23 Feb 2016 16:20:04 +0000 (11:20 -0500)]
lib/core: fix order of the params of `atan(y, x)`

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

8 years agolib/geometry: do not sort points as it invalidates the shape of the polygon
Alexis Laferrière [Mon, 22 Feb 2016 17:39:03 +0000 (12:39 -0500)]
lib/geometry: do not sort points as it invalidates the shape of the polygon

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

8 years agoMerge: Recover `recover_with`
Jean Privat [Mon, 22 Feb 2016 13:54:40 +0000 (08:54 -0500)]
Merge: Recover `recover_with`

close #1767

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

8 years agoMerge: more work on nitcc
Jean Privat [Mon, 22 Feb 2016 13:54:38 +0000 (08:54 -0500)]
Merge: more work on nitcc

Random nitpicks

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

8 years agotest_regex_check.nit: use the shorter `join`
Jean Privat [Mon, 22 Feb 2016 13:51:49 +0000 (08:51 -0500)]
test_regex_check.nit: use the shorter `join`

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

8 years agolib/core/collection: improve the default `has_all` for basic cases
Jean Privat [Fri, 19 Feb 2016 15:34:15 +0000 (10:34 -0500)]
lib/core/collection: improve the default `has_all` for basic cases

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

8 years agonitcc: improve perf by caching the result of cmangle
Jean Privat [Fri, 19 Feb 2016 15:33:02 +0000 (10:33 -0500)]
nitcc: improve perf by caching the result of cmangle

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

8 years agonitcc: fixup the .lr.out file
Jean Privat [Fri, 19 Feb 2016 15:32:36 +0000 (10:32 -0500)]
nitcc: fixup the .lr.out file

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

8 years agolib/sdl: fix for constructor callback bug
Alexis Laferrière [Sat, 20 Feb 2016 16:47:24 +0000 (11:47 -0500)]
lib/sdl: fix for constructor callback bug

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

8 years agocontrib: use add_all instead of recover_with
Jean Privat [Sun, 21 Feb 2016 15:03:52 +0000 (10:03 -0500)]
contrib: use add_all instead of recover_with

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

8 years agonitc: do not define be32toh when it exists on Android
Alexis Laferrière [Thu, 18 Feb 2016 17:34:09 +0000 (12:34 -0500)]
nitc: do not define be32toh when it exists on Android

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

8 years agolib/android: use the more general NativeContext with annotations
Alexis Laferrière [Fri, 19 Feb 2016 23:41:36 +0000 (18:41 -0500)]
lib/android: use the more general NativeContext with annotations

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

8 years agolib/android: pin Nit buttons from Java callbacks
Alexis Laferrière [Wed, 25 Nov 2015 21:36:10 +0000 (16:36 -0500)]
lib/android: pin Nit buttons from Java callbacks

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

8 years agolib/android: fix ListLayout by pinning the adapter in the Java GC
Alexis Laferrière [Tue, 24 Nov 2015 14:48:19 +0000 (09:48 -0500)]
lib/android: fix ListLayout by pinning the adapter in the Java GC

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

8 years agocode: update clients of the former `recover_with`
Jean Privat [Fri, 19 Feb 2016 15:56:52 +0000 (10:56 -0500)]
code: update clients of the former `recover_with`

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

8 years agolib/core: rename `recover_with` as `add_all`
Jean Privat [Fri, 19 Feb 2016 15:56:19 +0000 (10:56 -0500)]
lib/core: rename `recover_with` as `add_all`

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

8 years agoMerge: OSX: disable non-working tests, and tests cocoa
Jean Privat [Thu, 18 Feb 2016 23:31:15 +0000 (18:31 -0500)]
Merge: OSX: disable non-working tests, and tests cocoa

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

8 years agotests: add ncurses and x11 to OSX toto
Jean Privat [Thu, 18 Feb 2016 15:18:53 +0000 (10:18 -0500)]
tests: add ncurses and  x11 to OSX toto

So tests pass with *todo* (instead of *fai*l)

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

8 years agotests: enable testing cococa on OSX
Jean Privat [Thu, 18 Feb 2016 15:07:10 +0000 (10:07 -0500)]
tests: enable testing cococa on OSX

What was to point to disable cocoa on OSX anyway?

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

8 years agoMerge: Use a subfolder `android` for Android related files like `res` and `libs`
Jean Privat [Thu, 18 Feb 2016 06:23:03 +0000 (01:23 -0500)]
Merge: Use a subfolder `android` for Android related files like `res` and `libs`

Move Android specific files of each projects to a subfolder `android`. This includes the `res` folder with custom resources and icons, as well as the `libs` folder storing Android libraries (jar files). It is a followup to the iOS support where platform specific icons are stored in the subfolder `ios`.

Also remove the quiet option (`-q`) from the call to ant, because it often hid error messages. Besides, the call to ndk-build is already very verbose, so a longer output from ant is not that bad. In the future, for a cleaner output, we could try to replace ant with gradle.

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

8 years agoMerge: nitcc fix issue when a DFA node has only a single Any transition
Jean Privat [Thu, 18 Feb 2016 06:23:00 +0000 (01:23 -0500)]
Merge: nitcc fix issue when a DFA node has only a single Any transition

Pull-Request: #1953
Reviewed-by: Lucas Bajolet <r4pass@hotmail.com>

8 years agonitcc: add test/lexer-any.sablecc
Jean Privat [Wed, 17 Feb 2016 21:26:17 +0000 (16:26 -0500)]
nitcc: add test/lexer-any.sablecc

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

8 years agonitcc: Handle case of DFA state with a unique Any transition
Jean Privat [Wed, 17 Feb 2016 21:24:31 +0000 (16:24 -0500)]
nitcc: Handle case of DFA state with a unique Any transition

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

8 years agocontrib & examples: update Android apps
Alexis Laferrière [Wed, 17 Feb 2016 14:13:53 +0000 (09:13 -0500)]
contrib & examples: update Android apps

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

8 years agonitc android: do not use quiet the call to ant as it hides some errors
Alexis Laferrière [Wed, 17 Feb 2016 18:02:36 +0000 (13:02 -0500)]
nitc android: do not use quiet the call to ant as it hides some errors

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

8 years agonitc android: move android specific folders (res/libs) to an android folder
Alexis Laferrière [Wed, 17 Feb 2016 13:52:00 +0000 (08:52 -0500)]
nitc android: move android specific folders (res/libs) to an android folder

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

8 years agoMerge: Revamp `Text::format`
Jean Privat [Tue, 16 Feb 2016 19:52:37 +0000 (14:52 -0500)]
Merge: Revamp `Text::format`

Change the behavior of `Text::format` so it uses an index from 0 (instead of 1), and the escape sequence to a double percentage sign (ex, `%%4` to get `%4`). Also, now `format` ignores `%` that are not followed by a number.

There were problems with the previous escape sequence (using `\%`):
1. In literal strings, the `\` itself has to be escaped, so a whole escaped sequence look like `\\%4`.
2. The extra `\\` were not removed from the resulting string, so it was still impossible to produce a `%4` because `\\%4` resulted in `\\%4`.

These changes were prompted by an error in the code generated the i18n phase on a lone `%` not related to the `format` method. Also, the index beginning at 1 were always confusing to me, it was a different behavior than `Array` and other

@R4PaSs I would like your opinion on this.

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

8 years agoMerge: nitcorn: cache served files, custom JS for FileServer and do not depend on...
Jean Privat [Tue, 16 Feb 2016 19:52:35 +0000 (14:52 -0500)]
Merge: nitcorn: cache served files, custom JS for FileServer and do not depend on curl

This PR extends `FileServer` with caching of served files and custom JavaScript code for the header. The caching is set to 1h by default, but it can be customized.

Removing the default import of the `proxy` module with nitcorn, it depends on curl, and thus adds a (small) overhead to all nitcorn programs and need the library. This could be reverted when `proxy` is updated to use only libevent.

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

8 years agoMerge: iOS icon support and fix black bars on physical devices
Jean Privat [Tue, 16 Feb 2016 19:52:33 +0000 (14:52 -0500)]
Merge: iOS icon support and fix black bars on physical devices

This PR adds support for custom icons on iOS by adding an `Assets.xcassets` folder to the generated Xcode project. It is used to store a user provided icon specified in the `ios/AppIcon.appiconset` folder from the root of the Nit project. This is similar to the Android support where the icon files are stored in the `res` folder.

Also adds `LaunchScreen.storyboard` to the generated project. This file defines a kind of splash screen displayed while the app loads. The main advantage of this file is that it fixes a bug on physical devices where black bars were visible at the top and bottom of the screen.

The launch screen shows the app name in the center with _app.nit_ at the bottom. This is the default format provided by Xcode but it does not follow the official guidelines. In the future we may want an option for the user to provide a custom file.

To generete these icons, this PR update `svg_to_icons` with support for the icon formats expected by Xcode.

As examples and test, both Tnitter and calculator are updated with icons for iOS.

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

8 years agotests: niti and nitvm don't support iOS
Alexis Laferrière [Tue, 16 Feb 2016 13:47:42 +0000 (08:47 -0500)]
tests: niti and nitvm don't support iOS

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

8 years agotests: update iOS tests with files generated from the LaunchScreen
Alexis Laferrière [Tue, 16 Feb 2016 04:54:05 +0000 (23:54 -0500)]
tests: update iOS tests with files generated from the LaunchScreen

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

8 years agonitc: add -Wno-trigraph to CFLAGS
Alexis Laferrière [Tue, 16 Feb 2016 01:08:00 +0000 (20:08 -0500)]
nitc: add -Wno-trigraph to CFLAGS

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

8 years agocontrib/tnitter: add icon for iOS
Alexis Laferrière [Sat, 13 Feb 2016 20:25:44 +0000 (15:25 -0500)]
contrib/tnitter: add icon for iOS

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

8 years agocontrib/tnitter: convert font to path for portability
Alexis Laferrière [Sat, 13 Feb 2016 03:35:29 +0000 (22:35 -0500)]
contrib/tnitter: convert font to path for portability

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

8 years agoexamples/calculator: intro icon for iOS
Alexis Laferrière [Sat, 13 Feb 2016 18:55:48 +0000 (13:55 -0500)]
examples/calculator: intro icon for iOS

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

8 years agocontrib/inkscape_tools: update README
Alexis Laferrière [Sat, 13 Feb 2016 21:29:38 +0000 (16:29 -0500)]
contrib/inkscape_tools: update README

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

8 years agocontrib/inkscape_tools: create target folder if it does not exists
Alexis Laferrière [Sat, 13 Feb 2016 20:44:16 +0000 (15:44 -0500)]
contrib/inkscape_tools: create target folder if it does not exists

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

8 years agocontrib/inkscape_tools: add iOS target format
Alexis Laferrière [Sat, 13 Feb 2016 03:23:48 +0000 (22:23 -0500)]
contrib/inkscape_tools: add iOS target format

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

8 years agolib/ios: document how to set an app icon
Alexis Laferrière [Sat, 13 Feb 2016 21:02:30 +0000 (16:02 -0500)]
lib/ios: document how to set an app icon

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

8 years agolib/ios: fix unicode whitespace, was reported as a warning by clang
Alexis Laferrière [Sat, 13 Feb 2016 20:33:34 +0000 (15:33 -0500)]
lib/ios: fix unicode whitespace, was reported as a warning by clang

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

8 years agofrontend/i18n: escape % in internationalized strings
Alexis Laferrière [Mon, 15 Feb 2016 20:16:37 +0000 (15:16 -0500)]
frontend/i18n: escape % in internationalized strings

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

8 years agolib/text: `Text::format` harder to break and using `%%` as escape
Alexis Laferrière [Mon, 15 Feb 2016 20:15:50 +0000 (15:15 -0500)]
lib/text: `Text::format` harder to break and using `%%` as escape

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

8 years agolib/text: `Text::format` uses an index starting at 0, as `Array` does
Alexis Laferrière [Mon, 15 Feb 2016 20:11:33 +0000 (15:11 -0500)]
lib/text: `Text::format` uses an index starting at 0, as `Array` does

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

8 years agolib/text: `FlatString::substring` returns "" on count == 0 or less
Alexis Laferrière [Mon, 15 Feb 2016 20:12:06 +0000 (15:12 -0500)]
lib/text: `FlatString::substring` returns "" on count == 0 or less

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

8 years agonitc/ios: add Assets.xcassets
Alexis Laferrière [Sat, 13 Feb 2016 18:59:59 +0000 (13:59 -0500)]
nitc/ios: add Assets.xcassets

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

8 years agolib/nitcorn: cache files served by `FileServer` for 1 hour
Alexis Laferrière [Mon, 15 Feb 2016 02:39:29 +0000 (21:39 -0500)]
lib/nitcorn: cache files served by `FileServer` for 1 hour

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

8 years agolib/nitcorn: intro the attribute `FileServer::javascript_header`
Alexis Laferrière [Sun, 14 Feb 2016 21:31:44 +0000 (16:31 -0500)]
lib/nitcorn: intro the attribute `FileServer::javascript_header`

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

8 years agolib/nitcorn: do not include `proxy` with nitcorn by default (it requires curl)
Alexis Laferrière [Sun, 14 Feb 2016 03:13:08 +0000 (22:13 -0500)]
lib/nitcorn: do not include `proxy` with nitcorn by default (it requires curl)

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

8 years agonitc/ios: add LoadingScreen.storyboard
Alexis Laferrière [Sat, 13 Feb 2016 18:59:22 +0000 (13:59 -0500)]
nitc/ios: add LoadingScreen.storyboard

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

8 years agonitc/ios: remove superfluous content of the generated PBX project file
Alexis Laferrière [Sat, 13 Feb 2016 18:57:52 +0000 (13:57 -0500)]
nitc/ios: remove superfluous content of the generated PBX project file

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

8 years agoMerge: iOS: implement data_store and missing life cycle callbacks
Jean Privat [Fri, 12 Feb 2016 20:47:52 +0000 (15:47 -0500)]
Merge: iOS: implement data_store and missing life cycle callbacks

Implement the main missing features of _app.nit_ on iOS: `data_store` and life-cycle hooks (like `on_save_state`). These changes can be seen on the calculator app, as it preserves its context using the `data_store`.

`data_store` is implemented with `NSUserDefaults` to store objects sertialized to Json. It is very similar to Android's implementation using shared preferences. This may be a bit limited as it is not meant to hold large strings, and some data objects (like game saves) should instead be saved to a file.

This PR also implements all life-cycle callbacks in iOS, until now only `on_create` was implemented. We may have to update _app.nit_ life-cycle to fit better with the life-cycle of iOS, the states between a running app and a fully stopped app are different between iOS and Android. I'm thinking of removing the two callbacks on_start/on_stop and keep only the more general callbacks on_create/on_destroy and on_resume/on_pause, and the services on_restore_state/on_save_state.

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

8 years agolib/serialization: serialize all insances of Text as we did with srings
Alexis Laferrière [Fri, 12 Feb 2016 19:28:54 +0000 (14:28 -0500)]
lib/serialization: serialize all insances of Text as we did with srings

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

8 years agolib/ios: execute missing callbacks of app.nit on iOS
Alexis Laferrière [Thu, 11 Feb 2016 20:25:15 +0000 (15:25 -0500)]
lib/ios: execute missing callbacks of app.nit on iOS

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

8 years agolib/ios: implement data_store using NSUserDefaults
Alexis Laferrière [Thu, 11 Feb 2016 20:24:44 +0000 (15:24 -0500)]
lib/ios: implement data_store using NSUserDefaults

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

8 years agolib/ios: wrap NSUserDefaults
Alexis Laferrière [Thu, 11 Feb 2016 20:24:54 +0000 (15:24 -0500)]
lib/ios: wrap NSUserDefaults

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

8 years agoMerge: Small cleanups related to constructors
Jean Privat [Fri, 12 Feb 2016 17:22:35 +0000 (12:22 -0500)]
Merge: Small cleanups related to constructors

Nothing fancy. Just small things extracted from a massive wip branch

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

8 years agoMerge: Android support: better doc and libgc compilation service support latest NDK
Jean Privat [Fri, 12 Feb 2016 05:15:06 +0000 (00:15 -0500)]
Merge: Android support: better doc and libgc compilation service support latest NDK

Update the doc of the Android package with better instructions on how to configure the host system before compiling Nit applications for Android. Also fix the libgc build script to support the latest NDKs.

@privat The change to the script may require to install the latest NDK on the test server. Current users of the Android compilation should not have to do anything, only new installations should require to also install the latest NDK.

Pull-Request: #1944

8 years agoMerge: Intro support for async HTTP requests and ListLayout for iOS
Jean Privat [Fri, 12 Feb 2016 05:15:03 +0000 (00:15 -0500)]
Merge: Intro support for async HTTP requests and ListLayout for iOS

This PR completes the implementation app::UI for iOS by implementing `ListLayout` using a `UITableView`. It also introduces the implementation of `http_request` using services from the foundation framework.

These features enable the Tnitter portable application to be compiled for iOS without modification.

The remaining API of app.nit still missing on IOS are `data_store`, `audio` and maybe `assets`.  At this point, only `data_store` is required for fully featured portable applications using the native UI.

---

As with #1942, some generated code has been commented so it can be reactivated when useful and when the needed types are also wrapped.

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

8 years agorta: improve code for methods of classes
Jean Privat [Fri, 12 Feb 2016 02:54:32 +0000 (21:54 -0500)]
rta: improve code for methods of classes

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

8 years agoniti: rename `args` as `arguments` in `call`
Jean Privat [Fri, 12 Feb 2016 02:52:02 +0000 (21:52 -0500)]
niti: rename `args` as `arguments` in `call`

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

8 years agonitc: remove the redundant property `mfree_init`
Jean Privat [Fri, 12 Feb 2016 02:50:33 +0000 (21:50 -0500)]
nitc: remove the redundant property `mfree_init`

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

8 years agosdl: remove old style init
Jean Privat [Fri, 12 Feb 2016 02:46:00 +0000 (21:46 -0500)]
sdl: remove old style init

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

8 years agodino: remove old style init
Jean Privat [Fri, 12 Feb 2016 02:45:34 +0000 (21:45 -0500)]
dino: remove old style init

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

8 years agocontrib/tnitter: add iOS app rule
Alexis Laferrière [Sun, 15 Nov 2015 16:10:29 +0000 (11:10 -0500)]
contrib/tnitter: add iOS app rule

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

8 years agolib/ios: implement `app::http_request`
Alexis Laferrière [Sat, 14 Nov 2015 17:48:28 +0000 (12:48 -0500)]
lib/ios: implement `app::http_request`

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

8 years agolib/ios: complete implementation of app::ui with support for ListLayout
Alexis Laferrière [Tue, 9 Feb 2016 04:51:47 +0000 (23:51 -0500)]
lib/ios: complete implementation of app::ui with support for ListLayout

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

8 years agolib/cocoa: intro wrappers for NSData, NSError and NSIndexPath
Alexis Laferrière [Mon, 16 Nov 2015 16:51:16 +0000 (11:51 -0500)]
lib/cocoa: intro wrappers for NSData, NSError and NSIndexPath

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

8 years agolib/cocoa: intro `NSString::nil
Alexis Laferrière [Wed, 10 Feb 2016 23:26:27 +0000 (18:26 -0500)]
lib/cocoa: intro `NSString::nil

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

8 years agonitc: add permission for HTTP requests to iOS apps
Alexis Laferrière [Wed, 10 Feb 2016 23:27:53 +0000 (18:27 -0500)]
nitc: add permission for HTTP requests to iOS apps

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

8 years agolib/pthreads: do not include libgc on iOS
Alexis Laferrière [Sun, 15 Nov 2015 16:10:55 +0000 (11:10 -0500)]
lib/pthreads: do not include libgc on iOS

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

8 years agoshare/libgc: update tools_dir to support the latest Android NDK
Alexis Laferrière [Thu, 11 Feb 2016 16:23:10 +0000 (11:23 -0500)]
share/libgc: update tools_dir to support the latest Android NDK

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