Alexis Laferrière [Thu, 8 Dec 2016 20:25:41 +0000 (15:25 -0500)]
update all indirect references to native strings
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Tue, 13 Dec 2016 04:02:45 +0000 (23:02 -0500)]
tests: update to use `CString`
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Thu, 8 Dec 2016 20:15:49 +0000 (15:15 -0500)]
core: update doc of `CString`
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Thu, 8 Dec 2016 20:12:51 +0000 (15:12 -0500)]
rename `NativeString` to `CString`
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Jean Privat [Mon, 5 Dec 2016 20:53:37 +0000 (15:53 -0500)]
Merge: nitweb: rewritte stars
Upgrade the feedback stars form.
More stars and more details:
![image](https://cloud.githubusercontent.com/assets/583144/
20892546/
b0155e34-badc-11e6-8f89-
726959021e5f.png)
Demo here: http://nitweb.moz-code.org/
Pull-Request: #2341
Jean Privat [Mon, 5 Dec 2016 20:53:36 +0000 (15:53 -0500)]
Merge: nitweb: misc fixes
Should fix more points from #2177
* Sort list by alphabetical order
* Remove useless links on doc location
* Remove useless code tabs when the code linearization tab exists
Demo here: http://nitweb.moz-code.org/
Pull-Request: #2340
Jean Privat [Mon, 5 Dec 2016 20:53:32 +0000 (15:53 -0500)]
Merge: proposal: lib/config
We often need basic option handling in our app.
Here a minimalist proposal that covers the basics:
* options holder
* default values
* loading options from ini file
Extract from doc:
# Configuration options for nit tools and apps
This module provides basic services for options handling in your nit programs.
## Basic configuration holder
The `Config` class can be used as a simple option holder and processor:
~~~nit
import config
# Create a new config option
var opt_my = new OptionString("My option", "--my")
# Create the config and add the option
var config = new Config
config.add_option(opt_my)
# Parse the program arguments, usually `args`
config.parse_options(["--my", "myOption", "arg1", "arg2"])
# Access the options and args
assert opt_my.value == "myOption"
assert config.args == ["arg1", "arg2"]
~~~
## Custom configuration class
Instead of using basic `Config` instances, it is better to define new sublcasses
to store options and define custom services.
~~~nit
import config
class MyConfig
super Config
var opt_my = new OptionString("My option", "--my")
init do
super
tool_description = "Usage: MyExample [OPTION]... [ARGS]..."
add_option(opt_my)
end
fun my: String do return opt_my.value or else "Default value"
end
var config = new MyConfig
config.parse_options(["--my", "myOption", "arg1", "arg2"])
assert config.my == "myOption"
assert config.args == ["arg1", "arg2"]
~~~
We define the `my` method to provide an elegant shortcut to `opt_my.value`
and define the default value if the option was not set by the user.
The `tool_description` attribute is used to set the `usage` header printed when
the user request the `help` message.
~~~nit
config.parse_options(["-h"])
if config.help then
config.usage
exit 0
end
~~~
This will display the tool usage like this:
~~~raw
Usage: MyExample [OPTION]... [ARGS]...
-h, --help Show this help message
--my My option
~~~
## Configuration with `ini` file
The `IniConfig` class provides an easy way to link your configuration to an ini
file.
~~~nit
class MyIniConfig
super IniConfig
var opt_my = new OptionString("My option", "--my")
init do
super
tool_description = "Usage: MyExample [OPTION]... [ARGS]..."
opts.add_option(opt_my)
end
fun my: String do return opt_my.value or else ini["my"] or else "Default"
end
~~~
This time, we define the `my` method to return the option value or the ini
if no option was passed. Finally, if no ini value can be found, we return the
default value.
By default, `IniConfig` looks at a `config.ini` file in the execution directory.
This can be overrided in multiple ways.
First by the app user by setting the `--config` option:
~~~nit
var config = new MyIniConfig
config.parse_options(["--config", "my_config.ini"])
assert config.config_file == "my_config.ini"
~~~
Default config file can also be changed by the library client through the
`default_config_file` attribute:
~~~nit
config = new MyIniConfig
config.default_config_file = "my_config.ini"
config.parse_options(["arg"])
assert config.config_file == "my_config.ini"
~~~
Or by the library developper in the custom config class:
~~~nit
class MyCustomIniConfig
super IniConfig
redef var default_config_file = "my_config.ini"
end
var config = new MyCustomIniConfig
config.parse_options(["arg"])
assert config.config_file == "my_config.ini"
~~~
Pull-Request: #2339
Reviewed-by: Jean Privat <jean@pryen.org>
Jean Privat [Mon, 5 Dec 2016 20:53:28 +0000 (15:53 -0500)]
Merge: nitweb: encode URIs
Closes #2164
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>
Pull-Request: #2338
Reviewed-by: Jean-Christophe Beaupré <jcbrinfo.public@gmail.com>
Alexandre Terrasa [Mon, 5 Dec 2016 18:23:09 +0000 (13:23 -0500)]
tests: fix model_json output with alphabetical order
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>
Alexandre Terrasa [Mon, 5 Dec 2016 15:42:05 +0000 (10:42 -0500)]
tests: fix nitrpg tests
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>
Alexandre Terrasa [Sat, 3 Dec 2016 04:15:51 +0000 (23:15 -0500)]
nitweb: migrate to config
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>
Alexandre Terrasa [Sat, 3 Dec 2016 04:15:30 +0000 (23:15 -0500)]
popcorn: pop_repos use config
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>
Alexandre Terrasa [Sat, 3 Dec 2016 04:14:58 +0000 (23:14 -0500)]
popcorn: pop_config use config
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>
Alexandre Terrasa [Sat, 3 Dec 2016 03:45:03 +0000 (22:45 -0500)]
lib: introduce basic config classes
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>
Alexandre Terrasa [Thu, 25 Aug 2016 20:36:52 +0000 (16:36 -0400)]
nitweb: remove useless links on locations
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>
Alexandre Terrasa [Thu, 25 Aug 2016 20:34:28 +0000 (16:34 -0400)]
nitweb: remove useless code tabs for propdefs and classdefs
Since the code is already loaded in the linearization list
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>
Alexandre Terrasa [Thu, 25 Aug 2016 20:33:11 +0000 (16:33 -0400)]
nitweb: sort mentities list by name
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>
Alexandre Terrasa [Thu, 25 Aug 2016 20:20:04 +0000 (16:20 -0400)]
nitweb: clean defs list rendering
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>
Alexandre Terrasa [Mon, 28 Nov 2016 21:49:28 +0000 (16:49 -0500)]
nitweb: show grade overview in specific page
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>
Alexandre Terrasa [Thu, 4 Aug 2016 18:48:52 +0000 (14:48 -0400)]
nitweb: show grades in user page
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>
Alexandre Terrasa [Thu, 4 Aug 2016 18:48:03 +0000 (14:48 -0400)]
nitweb: rewrite stars display
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>
Alexandre Terrasa [Sun, 14 Aug 2016 21:46:13 +0000 (17:46 -0400)]
nitweb: rewrite ratings to allow dimensions (like code, feature, examples...)
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>
Alexandre Terrasa [Thu, 18 Aug 2016 02:08:30 +0000 (22:08 -0400)]
nitweb: avoid linearization errors
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>
Alexandre Terrasa [Mon, 5 Dec 2016 15:54:12 +0000 (10:54 -0500)]
nitweb: encode URIs
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>
Jean Privat [Sat, 3 Dec 2016 13:11:30 +0000 (08:11 -0500)]
Merge: Fix model_json and nitweb
Was broken since #2312
* Migrate `model_json` to new serialization API
* Add tests to `model_json` to ensure this doesn't happen anymore
* Migrate `web` package and `nitweb` to new API
@xymus a lot of serialization for you. Note: for each entity, I needed two deserialization version `full` and no full. Wasn't sure on how to handle this concern properly with your API
Pull-Request: #2327
Reviewed-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexandre Terrasa [Fri, 4 Nov 2016 00:39:07 +0000 (20:39 -0400)]
nitweb: migrate to new json serialization API
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>
Alexandre Terrasa [Wed, 23 Nov 2016 21:32:08 +0000 (16:32 -0500)]
model: add nitunit for model_json
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>
Alexandre Terrasa [Thu, 3 Nov 2016 23:02:23 +0000 (19:02 -0400)]
model: migrate model_json to new serialization API
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>
Alexandre Terrasa [Fri, 18 Nov 2016 18:35:54 +0000 (13:35 -0500)]
opts: fix weird indent
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>
Jean Privat [Fri, 2 Dec 2016 15:13:46 +0000 (10:13 -0500)]
Merge: mongo: More queries
* Fix query prefixes
* Add Array related queries
Pull-Request: #2336
Jean Privat [Fri, 2 Dec 2016 15:13:45 +0000 (10:13 -0500)]
Merge: nitweb: /random apply limit after random
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>
Pull-Request: #2335
Jean Privat [Fri, 2 Dec 2016 15:13:43 +0000 (10:13 -0500)]
Merge: src/model: collect package modules
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>
Pull-Request: #2334
Jean Privat [Fri, 2 Dec 2016 15:13:42 +0000 (10:13 -0500)]
Merge: lib/github: load more user data
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>
Pull-Request: #2333
Jean Privat [Fri, 2 Dec 2016 15:13:40 +0000 (10:13 -0500)]
Merge: lib/math: fix some nitunits
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>
Pull-Request: #2332
Jean Privat [Fri, 2 Dec 2016 15:13:38 +0000 (10:13 -0500)]
Merge: nitunit: set NIT_TESTING_PATH
When working with test suites, one can now use `NIT_TESTING_PATH` to retrieve the test suite path.
It can be used to access files based on the current test suite location:
~~~nit
class MyTest
super TestSuite
fun test_suite_path do
assert "NIT_TESTING_PATH".environ.basename == "my_test_suite.nit"
end
end
~~~
Useful for test suites based on model loading like in #2327.
Pull-Request: #2331
Alexandre Terrasa [Mon, 28 Nov 2016 22:30:42 +0000 (17:30 -0500)]
mongo: add array related queries
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>
Alexandre Terrasa [Mon, 28 Nov 2016 22:30:19 +0000 (17:30 -0500)]
mongo: fix query prefixes
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>
Alexandre Terrasa [Wed, 31 Aug 2016 14:27:05 +0000 (10:27 -0400)]
nitweb: /random apply limit after random
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>
Alexandre Terrasa [Wed, 31 Aug 2016 14:26:29 +0000 (10:26 -0400)]
src/model: collect package modules
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>
Alexandre Terrasa [Mon, 28 Nov 2016 22:10:43 +0000 (17:10 -0500)]
lib/github: load more user data
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>
Alexandre Terrasa [Wed, 31 Aug 2016 14:03:24 +0000 (10:03 -0400)]
lib/math: fix some nitunits
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>
Alexandre Terrasa [Mon, 28 Nov 2016 21:11:59 +0000 (16:11 -0500)]
man: document `NIT_TESTING_PATH`
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>
Alexandre Terrasa [Mon, 28 Nov 2016 21:11:38 +0000 (16:11 -0500)]
tests: test nitunit `NIT_TESTING_PATH`
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>
Alexandre Terrasa [Mon, 28 Nov 2016 21:11:16 +0000 (16:11 -0500)]
nitunit: set NIT_TESTING_PATH before running a test suite
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>
Alexandre Terrasa [Mon, 28 Nov 2016 21:10:47 +0000 (16:10 -0500)]
nitunit: remove warnings from testing_suite (and uniformize the style)
Haters gonna hate.
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>
Alexandre Terrasa [Mon, 28 Nov 2016 21:09:55 +0000 (16:09 -0500)]
nitunit: toolcontext set `NIT_TESTING_PATH`
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>
Alexandre Terrasa [Mon, 28 Nov 2016 21:09:15 +0000 (16:09 -0500)]
nitunit: remove warnings from testing_base
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>
Jean Privat [Thu, 24 Nov 2016 19:21:56 +0000 (14:21 -0500)]
Merge: Updates some tests and the tests.sh script for compatibility with Windows
This is part of the ongoing effort to make Nit work under Windows using msys2 / mingw64, this time we look at tests and support tools.
* Tweak tests.sh to work correctly on Windows: diff ignore CR, don't use -s on hostname from coreutils and don't use the $tmp variable as it overwrites an environment variable.
* Make the very badly named test a bit less bad so its path is valid on Windows.
* Fix the pkg-config annotation behavior on multiple arguments and fix its broken tests. (This is not directly related to Windows support, but valid tests will help to debug.)
* As a bonus, fix the repeated typo *boostrap*.
Pull-Request: #2330
Reviewed-by: Jean-Christophe Beaupré <jcbrinfo.public@gmail.com>
Reviewed-by: Romain Chanoir <romain.chanoir@viacesi.fr>
Alexis Laferrière [Sat, 19 Nov 2016 18:31:39 +0000 (13:31 -0500)]
src: fix the scary typo boostrap
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Thu, 17 Nov 2016 14:22:25 +0000 (09:22 -0500)]
tests: fix test_annot_pkgconfig.nit so it actually works
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Sat, 19 Nov 2016 00:26:36 +0000 (19:26 -0500)]
pkgconfig annot: try all args before giving up
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Thu, 17 Nov 2016 10:34:47 +0000 (05:34 -0500)]
tests.sh: don't use -s on coreutils hostname
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Thu, 17 Nov 2016 10:19:48 +0000 (05:19 -0500)]
tests.sh: rename $tmp to avoid conflict with the $tmp env var
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Tue, 16 Aug 2016 15:22:02 +0000 (11:22 -0400)]
tests.sh: ignore end of line characters
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Sat, 19 Nov 2016 00:35:46 +0000 (19:35 -0500)]
tests: make the very bad name test compatible with windows
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Jean Privat [Fri, 11 Nov 2016 18:46:05 +0000 (13:46 -0500)]
Merge: Delete the debugger from the interpreter
This PR removes the entire debugger from the interpreter including the client/server debugger. The debugger is not maintained and was never fully completed in the first place. There is a consensus that it should be rewritten from scratch if needed.
As discussed with @R4PaSs and @privat.
Pull-Request: #2329
Reviewed-by: Lucas Bajolet <r4pass@hotmail.com>
Reviewed-by: Jean-Christophe Beaupré <jcbrinfo.public@gmail.com>
Jean Privat [Fri, 11 Nov 2016 18:46:03 +0000 (13:46 -0500)]
Merge: lib/github: update unit test for change in Github API behavior
Update a Github API unit test for recent changes in the remote API behavior. I couldn't find any information on this change, so it may also be a temporary problem.
This commit was originally in #2326.
Pull-Request: #2328
Reviewed-by: Jean Privat <jean@pryen.org>
Alexis Laferrière [Wed, 9 Nov 2016 18:28:42 +0000 (13:28 -0500)]
nit: purge the debugger from the interpreter
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Sat, 29 Oct 2016 14:11:00 +0000 (10:11 -0400)]
lib/github: update for Github API changes
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Jean Privat [Wed, 2 Nov 2016 12:28:45 +0000 (08:28 -0400)]
Merge: pkgconfig annotation: improve error on missing dev package
This is an attempt to improve the error message on a missing development package. The current error stumps everyone on the first occurrence. The new version puts an emphasis on three things:
- it needs the _dev_ package,
- a possible solution by mentioning apt-get and brew, and
- that it may be a problem with pkg-config itself.
I chose to mention apt-get and brew as I consider that they are the best known package manager on Linux and macOS..
Pull-Request: #2325
Reviewed-by: Lucas Bajolet <r4pass@hotmail.com>
Reviewed-by: Jean-Christophe Beaupré <jcbrinfo.public@gmail.com>
Alexis Laferrière [Mon, 24 Oct 2016 17:08:31 +0000 (13:08 -0400)]
pkgconfig: more precise error on missing dev package
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Jean Privat [Mon, 24 Oct 2016 18:48:10 +0000 (14:48 -0400)]
Merge: serialization: subtype check attributes & serialize part of the metamodel
This PR is a bit out of the ordinary, it tackles 2 issues with serialization:
1. Avoid deserializing unwanted types to fix a security hole where a refined attribute setter could be abused to cause side effects in the running program.
The solution inserts 2 checks in the deserialization process, for JSON only:
1. Check the dynamic type of the Nit object to create from a JSON object against the static type of the attribute. It is created and deserialized only if the dynamic type is a subtype of the static type. This check is activated by default, it can be turned off for some rare use case.
2. A whitelist lists the accepted dynamic types to deserialize. It can add an extra level of security above the subtype check, or manually replace it when it can't be used. If the whitelist is empty, this check is disabled, the default.
Pseudo-code algo:
~~~
for name, value in json_object_as_hash_map do
if value isa json_object_as_hash_map do
# Existing: find the dynamic type from __class, class_name_heuristic or fallbacks on the static type
var dynamic_type = heuristic_dynamic_type(value)
# New
check whitelist.has(dynamic_type)
check dynamic_type isa static_type
end
end
~~~
Note that attributes typed by `Object` still accept anything (as expected). But there is also a security hole with attributes typed by a virtual type bound to `Object`. We don't have runtime access to the precise type of the virtual attribute so we always use the upper bound `Object`. So `Array` and the like are still a vulnerable point.
2. Ask for a specific static type at serialization while preserving polymorphism.
The solution adds an argument `static_type` to `JsonDeserializer::deserialize` to ask for a specific type. The deserialized object will be a subclass of `static_type`, or `null` on error.
This should be preferred to calling directly `from_deserializer` as it allows for subclasses and return null on fatal errors.
~~~
var engine = new JsonDeserializer("""{"item": 4}""")
var obj = engine.deserialize("Ref[Int]")
assert engine.errors.not_empty
assert obj isa Ref[Int]
~~~
These features rely on a new intern service `class_inheritance_metamodel_json` (I'm not convinced by the name but at least it is private). This method returns a `POSet[String]` serialized to JSON representing the inheritance graph of the running program. The compiler stores the JSON string in the generated C code, it takes about 200kb for a small program.
It would be pretty easy to add other services to read the metamodel, as needed. However, there is a strong coupling between the JsonDeserializer and `class_inheritance_metamodel_json`, this could be solved by adding a few modules with abstract services.
Future work:
* Do the same in the binary serialization engine.
* Move the metamodel services out of the `json` package.
* With a runtime access to the precise type of virtual types (`V.class_name`),
fix hole with attributes bound to a `nullable Object` static type.
* Do a full subtype check, not only subclass check (for generic classes).
* Use full qualified names in the serialized metamodel to avoid name conflicts.
@ppepos Did I correctly isolate the security issue? There is an example of the vulnerability in the test.
Pull-Request: #2311
Reviewed-by: Lucas Bajolet <r4pass@hotmail.com>
Reviewed-by: Romain Chanoir <romain.chanoir@viacesi.fr>
Reviewed-by: Jean Privat <jean@pryen.org>
Jean Privat [Mon, 24 Oct 2016 13:35:10 +0000 (09:35 -0400)]
Merge: nitcorn: handle SIGINT and SIGTERM
Intercept SIGINT and SIGTERM to close the server cleanly. The first signal request a clean exit from libevent, so it waits to complete the active events before closing. The second signal reverts to the default signal handler and quits instantly.
Fix #2294.
Pull-Request: #2323
Reviewed-by: Jean Privat <jean@pryen.org>
Reviewed-by: Ait younes Mehdi Adel <overpex@gmail.com>
Jean Privat [Mon, 24 Oct 2016 13:35:07 +0000 (09:35 -0400)]
Merge: nitcorn: decode GET args from percent encoding
While POST data was decoded from percent encoding, GET args were not. Some clients (`shibuqam`) manually decoded that args while others (`benitlux`) hung on requests with spaces.
There is still an issue in the HTTP request parsing where request URL with a space are broken. I'm not fixing this right away because there is no current issue associated to this problem and I have a larger rewrite of nitcorn in the works that will solve this.
Pull-Request: #2322
Jean Privat [Mon, 24 Oct 2016 13:35:04 +0000 (09:35 -0400)]
Merge: nitrestful: rename resources and restrict HTTP methods
The `restful` annotation makes a method accessible by HTTP requests. It saves a ton of boilerplate code by taking care of simple routes, deserializing the arguments and handling error management. It is already in use by the Benitlux server.
This PR adds documentation for the `restful` annotation and updates the example. It also improves the `restful` annotations by adding the support for two kind of arguments:
* String literals rename or add an alias for the HTTP resource. By default, the name of the HTTP resource is the name of the `restful` method. The first string literal replaces the default name, while additional strings literals add aliases.
* Ids such as `GET`, `POST`, `PUT` and `DELETE` restrict which HTTP methods are accepted. By default, all HTTP methods are accepted.
Once #2311 is merged, we will be able to update `nitrestful` to better support plain JSON objects as input.
Pull-Request: #2321
Alexis Laferrière [Thu, 20 Oct 2016 05:33:41 +0000 (01:33 -0400)]
metrics: don't visit annotation nodes
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Tue, 18 Oct 2016 20:18:55 +0000 (16:18 -0400)]
libevent: fix compatibility with light FFI and global/semi-global
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Fri, 14 Oct 2016 20:02:41 +0000 (16:02 -0400)]
nitc: only serialize the type model if `json::serialization_read` is imported
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Mon, 12 Sep 2016 20:02:31 +0000 (16:02 -0400)]
tests: update error_unk_class2 sav with change in linearisation
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Mon, 12 Sep 2016 17:25:24 +0000 (13:25 -0400)]
tests: update nitserial test
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Sat, 10 Sep 2016 17:56:21 +0000 (13:56 -0400)]
tests: add test_json_deserilizer_safe
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Sat, 10 Sep 2016 20:41:06 +0000 (16:41 -0400)]
lib serialization: `deserialize` accepts the name of the static type as argument
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Fri, 14 Oct 2016 19:22:50 +0000 (15:22 -0400)]
json::serialization: check before deserializing an object if it is a subtype
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Fri, 14 Oct 2016 19:21:09 +0000 (15:21 -0400)]
json::serialization: intro services to get the class hierarchy from the engine
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Fri, 14 Oct 2016 19:19:44 +0000 (15:19 -0400)]
json::serialization: whitelist deserializable classes
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Thu, 8 Sep 2016 17:32:00 +0000 (13:32 -0400)]
nitc & niti: support intern method to generate serialization_metadata
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Sat, 10 Sep 2016 18:35:45 +0000 (14:35 -0400)]
interpreter: remove duplicated intern methods
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Thu, 8 Sep 2016 17:31:15 +0000 (13:31 -0400)]
src: complete some missing doc
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Thu, 8 Sep 2016 17:30:37 +0000 (13:30 -0400)]
lib/poset: implement serialization compatible with nith
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Thu, 8 Sep 2016 18:35:25 +0000 (14:35 -0400)]
lib/poset: fix warnings and a typo
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Sat, 10 Sep 2016 18:27:23 +0000 (14:27 -0400)]
frontend serialization: resolve type before using their static name
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Sat, 10 Sep 2016 14:50:55 +0000 (10:50 -0400)]
frontend serialization: don't create `core_serialize_to` if it exists
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Fri, 14 Oct 2016 19:18:23 +0000 (15:18 -0400)]
json::serialization: fix use null when an instance is not serializable
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Wed, 12 Oct 2016 17:36:42 +0000 (13:36 -0400)]
nitcorn: clean exit on SIGINT & SIGTERM
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Wed, 12 Oct 2016 19:07:50 +0000 (15:07 -0400)]
libevent: intro basic event and signals support
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Thu, 13 Oct 2016 17:51:34 +0000 (13:51 -0400)]
libevent: rename `exit_loop` and `destroy` to their C names
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Wed, 12 Oct 2016 17:36:27 +0000 (13:36 -0400)]
lib/signals: silence C warning
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Wed, 12 Oct 2016 16:47:13 +0000 (12:47 -0400)]
nitcorn: test a url-encoded GET arg with a space
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Wed, 12 Oct 2016 15:55:29 +0000 (11:55 -0400)]
benitlux: percent encode GET args
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Wed, 12 Oct 2016 15:45:06 +0000 (11:45 -0400)]
shibuqam: we can use `string_arg` directly
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Wed, 12 Oct 2016 15:44:37 +0000 (11:44 -0400)]
nitcorn: fix decoding GET args from percent encoding
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Tue, 11 Oct 2016 20:09:14 +0000 (16:09 -0400)]
nitrestful: update tests results
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Tue, 11 Oct 2016 18:34:05 +0000 (14:34 -0400)]
nitcorn: document the `restful` annotation
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Tue, 11 Oct 2016 03:01:52 +0000 (23:01 -0400)]
nitcorn: update nitrestful example
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Mon, 30 Nov 2015 17:37:27 +0000 (12:37 -0500)]
nitrestful: support custom resource name and HTTP methods/verbs
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Tue, 11 Oct 2016 01:54:59 +0000 (21:54 -0400)]
nitrestful: fix naming of "resources" as recommended
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Tue, 11 Oct 2016 01:41:42 +0000 (21:41 -0400)]
libevent: intro enable_debug_mode
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Jean Privat [Fri, 7 Oct 2016 19:40:30 +0000 (15:40 -0400)]
Merge: iOS: complete support for the UI API
This PR complete the iOS support of the _app.nit_ UI API and fixes a few bugs:
* Fix `ListLayout` (the scrolling view) so its content fits in the horizontal limits of the screen. (The solution was the "-0-" in the constraint string!)
* Fix detecting when the user taps the system "back" button to correctly resume the previous window.
* Implement `size=` and `align=` on `TextInput` and `Button`. There is some code duplication because the Objective-C properties are not the same.
* Add `TextInput::placeholder=`, the placeholder is often used to identify a text field without using a label on iOS.
* Intro more color related services to extern classes, including a constructor to get the default light gray color used in the background of system menus.
* Bypass the Unicode validity checks so that Unicode characters are left as is, a workaround for #1945. This will cause problems on invalid Unicode strings, but it does work for valid Unicode strings.
* As a bonus, update the resolutions of the icons generated by `inkscape_tools`. Dropping support for older iOS versions and adding support for newer versions.
Pull-Request: #2320
Reviewed-by: Lucas Bajolet <r4pass@hotmail.com>
Jean Privat [Fri, 7 Oct 2016 19:40:27 +0000 (15:40 -0400)]
Merge: android: click event on button release, better errors and safer `JavaString::to_s`
Some small tweaks to the Android support:
* `JavaString::to_s` used to crash (at the JNI level) if the associated Java string was null. This was a counterintuitive behavior when the Nit object is non-nullable. This PR prevents this error by returning something similar to the default `Object::to_s` when the underlying Java value is null (for `JavaString` and others). This makes it crash proof, but one should still check if `JavaString::is_java_null` before using the value returned by `to_s` when an actual string is expected.
* Some Java exceptions raised by the Android implementation of `http_get` do not have a message. This PR looks through the causes of such exceptions to find the first available message.
* Also, fix `on_click & ButtonPressEvent` to be raised only when a button is released (instead of at the initial touch).
Pull-Request: #2319
Reviewed-by: Romain Chanoir <romain.chanoir@viacesi.fr>
Reviewed-by: Ait younes Mehdi Adel <overpex@gmail.com>
Alexis Laferrière [Fri, 23 Sep 2016 15:00:12 +0000 (11:00 -0400)]
inkscape_tools: update the format of icons generated of iOS
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>