nit.git
8 years agolib/android/toast: remove some callbacks
Alexis Laferrière [Fri, 11 Mar 2016 18:54:09 +0000 (13:54 -0500)]
lib/android/toast: remove some callbacks

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

8 years agolib/android: intro `app::native_context` and use in `dalvik`
Alexis Laferrière [Fri, 11 Mar 2016 18:50:47 +0000 (13:50 -0500)]
lib/android: intro `app::native_context` and use in `dalvik`

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

8 years agoMerge: Benitlux: Minor improvements to the server
Jean Privat [Fri, 11 Mar 2016 05:10:42 +0000 (00:10 -0500)]
Merge: Benitlux: Minor improvements to the server

This is in preparation to the introduction of all the social network features.

I expect to have some .sav to update because of the commit removing the check of NIT_TESTING.

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

8 years agoMerge: nitcc open class
Jean Privat [Thu, 10 Mar 2016 04:55:52 +0000 (23:55 -0500)]
Merge: nitcc open class

Accept open classes in regular expression in nitcc.

I thought that the feature was already here, since it is in SableCC4 and already handled by the current nitcc engine.

For information, this allows to indicate an open range of accepted characters.

~~~
a = 'A'...; // `a` can match "A", "B" or "䕫" and a lot other character
~~~

It is basically equivalent to

~~~
a = Any - (#0 .. '@');
~~~

It is also used by the grammar to extends the range of possible literals and enable language description with phoenician keyword and complex emoji-based regular expressions.

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

8 years agoMerge: app.nit UI: Intro an attribute to toggle password entry on TextFields
Jean Privat [Thu, 10 Mar 2016 04:55:45 +0000 (23:55 -0500)]
Merge: app.nit UI: Intro an attribute to toggle password entry on TextFields

The attribute `TextField::is_password` toggles hiding the content of the field using platform specific services. So on Android, not only is the text hidden but it also notifies the soft keyboard to behave accordingly.

In the future, we could add alternative modes for email entry and more.

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

8 years agoMerge: Misc text: some improvement on `join` and `to_base`
Jean Privat [Thu, 10 Mar 2016 04:55:35 +0000 (23:55 -0500)]
Merge: Misc text: some improvement on `join` and `to_base`

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

8 years agoMerge: Interpreter FFI: custom compile_dir, use /tmp/ by default, and delete after...
Jean Privat [Thu, 10 Mar 2016 04:55:19 +0000 (23:55 -0500)]
Merge: Interpreter FFI: custom compile_dir, use /tmp/ by default, and delete after execution

Generate native files in the `/tmp/` directory and delete them after execution. The directory can be customized using `--compile-dir`.

This should fix #1974 and #1975.

To support some other OS, we will need to use something other than `getpid` and `/tmp/`. We could also improve upon this by reusing the generated libraries between executions.

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

8 years agolib/core/text: move `to_base` to the main base module and remove the useless `signed...
Jean Privat [Mon, 7 Mar 2016 17:07:06 +0000 (12:07 -0500)]
lib/core/text: move `to_base` to the main base module and remove the useless `signed` parameter

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

8 years agolib/core/text: add a last_separator to `Collection::join`
Jean Privat [Mon, 7 Mar 2016 16:02:58 +0000 (11:02 -0500)]
lib/core/text: add a last_separator to `Collection::join`

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

8 years agonitcc: test open class
Jean Privat [Wed, 9 Mar 2016 04:57:44 +0000 (23:57 -0500)]
nitcc: test open class

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

8 years agonitcc: do not limit accepted literal char to `~`
Jean Privat [Wed, 9 Mar 2016 05:00:30 +0000 (00:00 -0500)]
nitcc: do not limit accepted literal char to `~`

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

8 years agonitcc: add open-class regexp for tokens.
Jean Privat [Wed, 9 Mar 2016 04:59:36 +0000 (23:59 -0500)]
nitcc: add open-class regexp for tokens.

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

8 years agocontrib: do not check for NIT_TESTING, nitcorn already checks
Alexis Laferrière [Wed, 9 Mar 2016 18:15:52 +0000 (13:15 -0500)]
contrib: do not check for NIT_TESTING, nitcorn already checks

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

8 years agocontrib/benitlux: use result based rules to compose the server rule
Alexis Laferrière [Mon, 2 Nov 2015 20:33:20 +0000 (15:33 -0500)]
contrib/benitlux: use result based rules to compose the server rule

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

8 years agocontrib/benitlux: move the iface declaration to the toplevel for use with -D
Alexis Laferrière [Sun, 1 Nov 2015 15:34:15 +0000 (10:34 -0500)]
contrib/benitlux: move the iface declaration to the toplevel for use with -D

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

8 years agocontrib/benitlux: add `Beer::id`
Alexis Laferrière [Sun, 25 Oct 2015 17:30:47 +0000 (13:30 -0400)]
contrib/benitlux: add `Beer::id`

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

8 years agolib/ios: implement `TextInput::is_password`
Alexis Laferrière [Thu, 3 Mar 2016 16:11:21 +0000 (11:11 -0500)]
lib/ios: implement `TextInput::is_password`

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

8 years agolib/android: implement `TextInput::is_password`
Alexis Laferrière [Thu, 3 Mar 2016 16:11:04 +0000 (11:11 -0500)]
lib/android: implement `TextInput::is_password`

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

8 years agoniti FFI: create compile_dir with permissions 0o700
Alexis Laferrière [Mon, 7 Mar 2016 19:34:46 +0000 (14:34 -0500)]
niti FFI: create compile_dir with permissions 0o700

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

8 years agolib/core: add optional mode parameter to mkdir
Alexis Laferrière [Mon, 7 Mar 2016 19:23:05 +0000 (14:23 -0500)]
lib/core: add optional mode parameter to mkdir

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

8 years agoMerge: FFI: use more c_name and protect some macros for global compilation
Jean Privat [Sat, 5 Mar 2016 23:14:34 +0000 (18:14 -0500)]
Merge: FFI: use more c_name and protect some macros for global compilation

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

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: Faster text get
Jean Privat [Fri, 4 Mar 2016 14:01:34 +0000 (09:01 -0500)]
Merge: Faster text get

Try to improve the efficiency of the FlatText[] method by shortcuting some common and easy cases.

using benchmarks/json:

![bench_json](https://cloud.githubusercontent.com/assets/135828/13518437/bc07c954-e19b-11e5-9ddf-8f69307fcd0a.png)

Ping @R4PaSs for review

Pull-Request: #1973

8 years agoMerge: lib/markdown: improve performance a bit
Jean Privat [Fri, 4 Mar 2016 14:00:28 +0000 (09:00 -0500)]
Merge: lib/markdown: improve performance a bit

Using benchmarks/markdown:

* nitmd_master is before
* nitmd_md is this now
* nitmd_md_fast is with #1973 in addition
* the 3 same avain with with --semi-global
* 2 Java libs: txtmark, markdown4j

![bench_markdown](https://cloud.githubusercontent.com/assets/135828/13517453/b008a7fe-e191-11e5-80c8-d17cd85df6be.png)

There is still a lot of performance improvements to do anyway.

Pull-Request: #1972
Reviewed-by: Alexandre Terrasa <alexandre@moz-code.org>

8 years agotests: update sav//test_text_stat.res
Jean Privat [Fri, 4 Mar 2016 06:24:48 +0000 (01:24 -0500)]
tests: update sav//test_text_stat.res

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

8 years agolib/markdown: allow to ignore the MDlocation on Tokens
Jean Privat [Fri, 4 Mar 2016 06:22:51 +0000 (01:22 -0500)]
lib/markdown: allow to ignore the MDlocation on Tokens

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

8 years agotext/flat: FlatText::[] handle statistically common cases first
Jean Privat [Fri, 4 Mar 2016 02:47:09 +0000 (21:47 -0500)]
text/flat: FlatText::[] handle statistically common cases first

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

8 years agotext/flat: FlatText::char_to_byte_index shortcut length_of_char_at if possible
Jean Privat [Fri, 4 Mar 2016 02:40:57 +0000 (21:40 -0500)]
text/flat: FlatText::char_to_byte_index shortcut length_of_char_at if possible

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

8 years agotext/flat: FlatText::char_to_byte_index do the +1 first (and 0 last)
Jean Privat [Fri, 4 Mar 2016 02:40:27 +0000 (21:40 -0500)]
text/flat: FlatText::char_to_byte_index do the +1 first (and 0 last)

Because stats!

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

8 years agotext/flat: FlatText::char_to_byte_index factorize `item` accessor
Jean Privat [Fri, 4 Mar 2016 02:39:44 +0000 (21:39 -0500)]
text/flat: FlatText::char_to_byte_index factorize `item` accessor

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

8 years agotext/flat: faster NativeString::set_char_at
Jean Privat [Fri, 4 Mar 2016 02:38:34 +0000 (21:38 -0500)]
text/flat: faster NativeString::set_char_at

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

8 years agolib/markdown: use a break label instead of a local flag
Jean Privat [Fri, 4 Mar 2016 02:30:44 +0000 (21:30 -0500)]
lib/markdown: use a break label instead of a local flag

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

8 years agolib/markdown: avoid useless `to_s` on Chars
Jean Privat [Thu, 3 Mar 2016 21:15:27 +0000 (16:15 -0500)]
lib/markdown: avoid useless `to_s` on Chars

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

8 years agocontrib/benitlux: use the latest entry as reference for the current offering
Alexis Laferrière [Sat, 22 Aug 2015 21:35:18 +0000 (17:35 -0400)]
contrib/benitlux: use the latest entry as reference for the current offering

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

8 years agocontrib/benitlux: accept more date formats
Alexis Laferrière [Sat, 22 Aug 2015 21:34:26 +0000 (17:34 -0400)]
contrib/benitlux: accept more date formats

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

8 years agolib/app & linux: intro `TextInput::is_password`
Alexis Laferrière [Wed, 25 Nov 2015 21:18:14 +0000 (16:18 -0500)]
lib/app & linux: intro `TextInput::is_password`

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 agosrc/ffi: protect friendly macro names in type check and casts for global comp
Alexis Laferrière [Sat, 17 Oct 2015 15:16:52 +0000 (11:16 -0400)]
src/ffi: protect friendly macro names in type check and casts for global comp

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

8 years agosrc/ffi: fix use of c_name for mangled names
Alexis Laferrière [Sat, 17 Oct 2015 15:16:21 +0000 (11:16 -0400)]
src/ffi: fix use of c_name for mangled names

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>