nit.git
8 years agotests: update deserializations tests with nitce because fixed autoinit fix things
Jean Privat [Fri, 17 Jul 2015 20:55:52 +0000 (16:55 -0400)]
tests: update deserializations tests with nitce because fixed autoinit fix things

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

8 years agolib/neo4j: use `nosuper` in named constructors to avoid the initialization of `intern...
Jean Privat [Tue, 14 Jul 2015 14:37:48 +0000 (10:37 -0400)]
lib/neo4j: use `nosuper` in named constructors to avoid the initialization of `internal_properties`

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

8 years agolib/geometry: named constructors use autoinit
Jean Privat [Tue, 14 Jul 2015 12:33:07 +0000 (08:33 -0400)]
lib/geometry: named constructors use autoinit

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

8 years agolib/date: named constructors use autoinit
Jean Privat [Tue, 14 Jul 2015 12:32:32 +0000 (08:32 -0400)]
lib/date: named constructors use autoinit

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

8 years agorefund: `Dollar::from_float` use the autoinit constructor
Jean Privat [Mon, 13 Jul 2015 20:04:51 +0000 (16:04 -0400)]
refund: `Dollar::from_float` use the autoinit constructor

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

8 years agonitrpg: `from_json` constructors use the autoinit constructor
Jean Privat [Mon, 13 Jul 2015 20:04:24 +0000 (16:04 -0400)]
nitrpg: `from_json` constructors use the autoinit constructor

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

8 years agonitcc: make the autoinit constructor of Automation without parameter
Jean Privat [Mon, 13 Jul 2015 20:03:44 +0000 (16:03 -0400)]
nitcc: make the autoinit constructor of Automation without parameter

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

8 years agotests: update sav for enforced superautoinit
Jean Privat [Mon, 13 Jul 2015 16:44:12 +0000 (12:44 -0400)]
tests: update sav for enforced superautoinit

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

8 years agoautosuperinit: constructors can be defined in interface, so autosuperinit should...
Jean Privat [Mon, 13 Jul 2015 15:40:30 +0000 (11:40 -0400)]
autosuperinit: constructors can be defined in interface, so autosuperinit should search for them

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

8 years agotests: update example_hanoi with saner constructor
Jean Privat [Mon, 13 Jul 2015 16:43:24 +0000 (12:43 -0400)]
tests: update example_hanoi with saner constructor

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

8 years agosrc/niti: PrimitiveNativeFile use autoinit in named inits
Jean Privat [Mon, 13 Jul 2015 16:42:31 +0000 (12:42 -0400)]
src/niti: PrimitiveNativeFile use autoinit in named inits

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

8 years agolib/sqlite3: use autoinit in named init `open`
Jean Privat [Mon, 13 Jul 2015 16:41:43 +0000 (12:41 -0400)]
lib/sqlite3: use autoinit in named init `open`

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

8 years agosrc/location: use `nosuper in some specific named constructors
Jean Privat [Mon, 13 Jul 2015 15:38:19 +0000 (11:38 -0400)]
src/location: use `nosuper in some specific named constructors

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

8 years agolib/string: named constructors call the autoinit explicitly
Jean Privat [Mon, 13 Jul 2015 15:37:48 +0000 (11:37 -0400)]
lib/string: named constructors call the autoinit explicitly

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

8 years agoMerge: Some bugfixes and small improvements for nitiwiki
Jean Privat [Thu, 9 Jul 2015 20:10:22 +0000 (16:10 -0400)]
Merge: Some bugfixes and small improvements for nitiwiki

Pull-Request: #1558
Reviewed-by: Alexandre Terrasa <alexandre@moz-code.org>
Reviewed-by: Lucas Bajolet <r4pass@hotmail.com>

8 years agotests: update sav for nitiwiki
Jean Privat [Thu, 9 Jul 2015 18:42:32 +0000 (14:42 -0400)]
tests: update sav for nitiwiki

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

8 years agoMerge: Bytes migration
Jean Privat [Thu, 9 Jul 2015 18:12:46 +0000 (14:12 -0400)]
Merge: Bytes migration

As a penultimate step to finish #1262, here are some byte-oriented operations on both `NativeString` and `Text`

Next to come in the infamous Unicode series, a reroll of #1277.

Pull-Request: #1551
Reviewed-by: Alexis Laferrière <alexis.laf@xymus.net>
Reviewed-by: Jean Privat <jean@pryen.org>

8 years agonitiwiki: remove `-s` as short `--status` because it is already short `--rsync`
Jean Privat [Thu, 9 Jul 2015 17:51:53 +0000 (13:51 -0400)]
nitiwiki: remove `-s` as short `--status` because it is already short `--rsync`

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

8 years agonitiwiki: custom config messages are less verbose
Jean Privat [Thu, 9 Jul 2015 17:19:09 +0000 (13:19 -0400)]
nitiwiki: custom config messages are less verbose

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

8 years agonitiwiki: error on --rsync if wiki.rsync_dir is not configured
Jean Privat [Thu, 9 Jul 2015 17:16:21 +0000 (13:16 -0400)]
nitiwiki: error on --rsync if wiki.rsync_dir is not configured

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

8 years agonitiwiki: protect arguments of sys.system
Jean Privat [Thu, 9 Jul 2015 17:15:42 +0000 (13:15 -0400)]
nitiwiki: protect arguments of sys.system

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

8 years agonitiwiki: improve rendering messages with name and paths.
Jean Privat [Thu, 9 Jul 2015 15:57:09 +0000 (11:57 -0400)]
nitiwiki: improve rendering messages with name and paths.

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

8 years agonitiwiki: remove completely root_url as everything is now relative
Jean Privat [Thu, 9 Jul 2015 15:44:41 +0000 (11:44 -0400)]
nitiwiki: remove completely root_url as everything is now relative

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

8 years agonitiwiki: reintroduce `allow absolute wikilinks` (c2802e0b4) broken by 98a42459
Jean Privat [Thu, 9 Jul 2015 15:40:57 +0000 (11:40 -0400)]
nitiwiki: reintroduce `allow absolute wikilinks` (c2802e0b4) broken by 98a42459

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

8 years agonitiwiki: reintroduce `make wikilink relative` (d03b2d99f) broken by 98a42459
Jean Privat [Thu, 9 Jul 2015 15:40:15 +0000 (11:40 -0400)]
nitiwiki: reintroduce `make wikilink relative` (d03b2d99f) broken by 98a42459

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

8 years agotests: Update for new NativeString and Byte views
Lucas Bajolet [Wed, 8 Jul 2015 20:46:32 +0000 (16:46 -0400)]
tests: Update for new NativeString and Byte views

Signed-off-by: Lucas Bajolet <r4pass@hotmail.com>

8 years agosrc: Compiler and interpreter updates for NativeString
Lucas Bajolet [Wed, 8 Jul 2015 20:46:06 +0000 (16:46 -0400)]
src: Compiler and interpreter updates for NativeString

Signed-off-by: Lucas Bajolet <r4pass@hotmail.com>

8 years agobase64/websocket: Rewrite for clarity and compliance to Byte-oriented NativeString
Lucas Bajolet [Wed, 8 Jul 2015 20:45:43 +0000 (16:45 -0400)]
base64/websocket: Rewrite for clarity and compliance to Byte-oriented NativeString

Signed-off-by: Lucas Bajolet <r4pass@hotmail.com>

8 years agolib/standard: NativeString operations are now Byte-oriented instead of Char
Lucas Bajolet [Wed, 8 Jul 2015 20:45:15 +0000 (16:45 -0400)]
lib/standard: NativeString operations are now Byte-oriented instead of Char

Signed-off-by: Lucas Bajolet <r4pass@hotmail.com>

8 years agolib/binary: Update modules to work more with Bytes now
Lucas Bajolet [Wed, 8 Jul 2015 20:42:59 +0000 (16:42 -0400)]
lib/binary: Update modules to work more with Bytes now

Signed-off-by: Lucas Bajolet <r4pass@hotmail.com>

8 years agolib/standard/text: Most chars operations are no longer working on NativeString
Lucas Bajolet [Wed, 8 Jul 2015 20:41:27 +0000 (16:41 -0400)]
lib/standard/text: Most chars operations are no longer working on NativeString

Signed-off-by: Lucas Bajolet <r4pass@hotmail.com>

8 years agolib/io: Changed the semantics of read/write byte to use Byte instead of Int
Lucas Bajolet [Wed, 8 Jul 2015 20:38:25 +0000 (16:38 -0400)]
lib/io: Changed the semantics of read/write byte to use Byte instead of Int

Signed-off-by: Lucas Bajolet <r4pass@hotmail.com>

8 years agolib/standard/ropes: Substrings now work with FlatStrings
Lucas Bajolet [Wed, 8 Jul 2015 19:57:07 +0000 (15:57 -0400)]
lib/standard/ropes: Substrings now work with FlatStrings

Signed-off-by: Lucas Bajolet <r4pass@hotmail.com>

8 years agolib/standard/text: Intro bytes services on Text
Lucas Bajolet [Wed, 8 Jul 2015 19:56:27 +0000 (15:56 -0400)]
lib/standard/text: Intro bytes services on Text

Signed-off-by: Lucas Bajolet <r4pass@hotmail.com>

8 years agolib/standard/text: Intro bytelen in abstract_text
Lucas Bajolet [Wed, 8 Jul 2015 19:52:44 +0000 (15:52 -0400)]
lib/standard/text: Intro bytelen in abstract_text

Signed-off-by: Lucas Bajolet <r4pass@hotmail.com>

8 years agoMerge: Rosetta Code: S-Expressions
Jean Privat [Wed, 8 Jul 2015 19:04:13 +0000 (15:04 -0400)]
Merge: Rosetta Code: S-Expressions

Simple S-Expressions parser, take only the two last commits into account, as the rest belongs to #1448.

Pull-Request: #1471
Reviewed-by: Jean Privat <jean@pryen.org>
Reviewed-by: Istvan SZALAÏ <szalai972@gmail.com>

8 years agoMerge: lib/geometry: intro more services on points and for angles
Jean Privat [Wed, 8 Jul 2015 18:02:23 +0000 (14:02 -0400)]
Merge: lib/geometry: intro more services on points and for angles

Some useful services for games and other geometry heavy applications.

I must say that I'm getting tired of the points API. Dealing with both the numeric complexity and the 2/3D is unpleasant. I will probably remove/separate the 3D part in the near future.

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

8 years agoMerge: Intro HashMap23::has, Timespec::millisec|microsec and misc clean up
Jean Privat [Wed, 8 Jul 2015 18:02:21 +0000 (14:02 -0400)]
Merge: Intro HashMap23::has, Timespec::millisec|microsec and misc clean up

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

8 years agoMerge: Intro the performance_analysis module to gather perf stats by categories
Jean Privat [Wed, 8 Jul 2015 18:02:19 +0000 (14:02 -0400)]
Merge: Intro the performance_analysis module to gather perf stats by categories

This modules provides simple stats (avg, min, max, count) on the execution time of categories. I use this module in my games to detect performance bottlenecks.

If anyone has an idea for a better name, I'm open to suggestions.

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

8 years agoMerge: contrib/inkscape_tools: Report invalid files and cleaner Makefile
Jean Privat [Wed, 8 Jul 2015 18:02:18 +0000 (14:02 -0400)]
Merge: contrib/inkscape_tools: Report invalid files and cleaner Makefile

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

8 years agoMerge: Binary serialization
Jean Privat [Wed, 8 Jul 2015 18:02:15 +0000 (14:02 -0400)]
Merge: Binary serialization

Introducing the binary serialization services! (In use in both WBTW and Tinks!) Also fix a few bugs in the serialization phase...

The serialization format is somewhat similar to BSON. The main differences are the support for instances, the precise instance types (as in `Array[MyClass]`), different data types id because we don't have the same data types and that we don't start off with the length of the stream. But we use a similar grammar, null-terminated lists and objects, as well as both a null-terminated string and a block which support UTF8.

The errors system can still be improved. There is too much noise but one can only look at the first error and it is usually enough.

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

8 years agoexamples/rosettacode: Added s_expression task
Lucas Bajolet [Tue, 7 Jul 2015 14:27:17 +0000 (10:27 -0400)]
examples/rosettacode: Added s_expression task

Signed-off-by: Lucas Bajolet <r4pass@hotmail.com>

8 years agolib/parsers: Added S-Expression parser
Lucas Bajolet [Wed, 10 Jun 2015 17:20:51 +0000 (13:20 -0400)]
lib/parsers: Added S-Expression parser

Signed-off-by: Lucas Bajolet <r4pass@hotmail.com>

8 years agoMerge: nitdoc: Use wikilinks on README files
Jean Privat [Tue, 7 Jul 2015 23:14:14 +0000 (19:14 -0400)]
Merge: nitdoc: Use wikilinks on README files

This PR introduce the use of wikilinks in README files.

It's mainly a request for comments on what you want, what you need and what you like from Nitdoc and README writting.

0f6ff78 gives an example of README file written using wikilinks. The processed result by nitdoc is visible [here](http://gresil.org/jenkins/job/CI-nitdoc/ws/doc/stdlib/group_github.html).

Supported commands for now:

* `[[doc:MEntity]]`: include the documentation article or an MEntity
* `[[list:MEntity]]`: list classes or methods from than MEntity

Old API pages still available, there are prefixed with `api_`.

Demos from [Jenkins::CI-nitdoc](http://gresil.org/jenkins/job/CI-nitdoc):
* [Standard library](http://gresil.org/jenkins/job/CI-nitdoc/ws/doc/stdlib/index.html)
* [Nit compilers and tools](http://gresil.org/jenkins/job/CI-nitdoc/ws/doc/nitc/index.html)

Some question still need to be answered:
* What to do with old API page (http://gresil.org/jenkins/job/CI-nitdoc/ws/doc/stdlib/api_group_github.html)
* What comment to display in API page (http://gresil.org/jenkins/job/CI-nitdoc/ws/doc/stdlib/api_group_github.html)
* What commands should be supported by wikilinks directive?

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

8 years agolib/geometry: add few services for angles
Alexis Laferrière [Tue, 30 Jun 2015 21:18:43 +0000 (17:18 -0400)]
lib/geometry: add few services for angles

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

8 years agolib/geomerty: intro Point::dist, dist2, lerp and ==
Alexis Laferrière [Tue, 30 Jun 2015 21:18:33 +0000 (17:18 -0400)]
lib/geomerty: intro Point::dist, dist2, lerp and ==

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

8 years agolib/realtime: intro micro|millisec
Alexis Laferrière [Sat, 13 Jun 2015 22:58:54 +0000 (18:58 -0400)]
lib/realtime: intro micro|millisec

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

8 years agolib/serialization: do not abort when deserializing an unknown class
Alexis Laferrière [Tue, 7 Jul 2015 14:42:45 +0000 (10:42 -0400)]
lib/serialization: do not abort when deserializing an unknown class

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

8 years agotests: add test for `binary::serialization`
Alexis Laferrière [Tue, 19 May 2015 17:52:20 +0000 (13:52 -0400)]
tests: add test for `binary::serialization`

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

8 years agogithub: enhance Github documentation as example for Nitdoc README files
Alexandre Terrasa [Tue, 9 Jun 2015 20:34:17 +0000 (16:34 -0400)]
github: enhance Github documentation as example for Nitdoc README files

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

8 years agonitdoc: update tests
Alexandre Terrasa [Tue, 9 Jun 2015 20:36:31 +0000 (16:36 -0400)]
nitdoc: update tests

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

8 years agonitdoc: generate README file doc pages
Alexandre Terrasa [Thu, 4 Jun 2015 15:36:20 +0000 (11:36 -0400)]
nitdoc: generate README file doc pages

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

8 years agolib/binary: intro `BinarySerializer` and `BinaryDeserializer`
Alexis Laferrière [Tue, 19 May 2015 14:01:00 +0000 (10:01 -0400)]
lib/binary: intro `BinarySerializer` and `BinaryDeserializer`

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

8 years agolib/more_collections: intro `HashMap[2|3]::has`
Alexis Laferrière [Thu, 2 Jul 2015 02:09:37 +0000 (22:09 -0400)]
lib/more_collections: intro `HashMap[2|3]::has`

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

8 years agolib/pthreads: relay error on init from C to Nit
Alexis Laferrière [Tue, 7 Jul 2015 14:02:32 +0000 (10:02 -0400)]
lib/pthreads: relay error on init from C to Nit

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

8 years agolib/opengles1: clean up C warning
Alexis Laferrière [Thu, 2 Jul 2015 02:09:17 +0000 (22:09 -0400)]
lib/opengles1: clean up C warning

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

8 years agolib/geometry: points_and_lines are serializable
Alexis Laferrière [Thu, 2 Jul 2015 03:46:20 +0000 (23:46 -0400)]
lib/geometry: points_and_lines are serializable

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

8 years agolib: intro performance_analysis
Alexis Laferrière [Sat, 4 Jul 2015 02:24:46 +0000 (22:24 -0400)]
lib: intro performance_analysis

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

8 years agolib/mnit: fix `KeyEvent::is_up`
Alexis Laferrière [Thu, 2 Jul 2015 02:09:00 +0000 (22:09 -0400)]
lib/mnit: fix `KeyEvent::is_up`

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

8 years agosrc/serialization: use how_serialize to fix generation of call to constructor
Alexis Laferrière [Thu, 2 Jul 2015 03:56:39 +0000 (23:56 -0400)]
src/serialization: use how_serialize to fix generation of call to constructor

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

8 years agosrc/serialization: call constructor only on concrete classes
Alexis Laferrière [Thu, 2 Jul 2015 03:54:19 +0000 (23:54 -0400)]
src/serialization: call constructor only on concrete classes

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

8 years agosrc/serialization: extract annotation search logic to AClassDef::how_serialize
Alexis Laferrière [Thu, 2 Jul 2015 03:53:23 +0000 (23:53 -0400)]
src/serialization: extract annotation search logic to AClassDef::how_serialize

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

8 years agoversion 0.7.6 v0.7.6
Jean Privat [Mon, 6 Jul 2015 16:07:58 +0000 (12:07 -0400)]
version 0.7.6

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

8 years agocontrib/inkscape_tools: better error message on invalid input files
Alexis Laferrière [Tue, 30 Jun 2015 21:40:26 +0000 (17:40 -0400)]
contrib/inkscape_tools: better error message on invalid input files

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

8 years agocontrib/inkscape_tools: clean up Makefile
Alexis Laferrière [Thu, 2 Jul 2015 02:06:52 +0000 (22:06 -0400)]
contrib/inkscape_tools: clean up Makefile

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

8 years agoMerge: Use the DOM parser in the RSS Downloader contrib
Jean Privat [Tue, 30 Jun 2015 18:07:07 +0000 (14:07 -0400)]
Merge: Use the DOM parser in the RSS Downloader contrib

`rss_downloader` now uses the DOM XML parser instead of regex to read RSS files. It is also easier to customize its behavior from the config class.

This PR also adds a few services to the DOM parser and fix a few bugs.

---

This PR is based on #1448 with fixed line endings.

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

8 years agoMerge: Remove niti hacks on NativeString and NativeFile
Jean Privat [Tue, 30 Jun 2015 18:06:58 +0000 (14:06 -0400)]
Merge: Remove niti hacks on NativeString and NativeFile

Previously, the interpreter used a FlatBuffer to implement NativeString and a File to implement NativeFile. This caused issues with applications using (mostly) `is_address_null` which could not be implemented correctly with these implementations.

This PR uses a real NativeString and NativeFile to implement the same class. For NativeFile, it is handled by the FFI so removing the old code is enough. For NativeString, many of its methods are intern so they had to be updated.

Pull-Request: #1543
Reviewed-by: Alexandre Terrasa <alexandre@moz-code.org>
Reviewed-by: Jean Privat <jean@pryen.org>

8 years agoMerge: nitdoc: use svg instead of png
Jean Privat [Tue, 30 Jun 2015 18:06:55 +0000 (14:06 -0400)]
Merge: nitdoc: use svg instead of png

NItdoc asks `dot` to render svg format instead of png.

Advantages:
* better performances
* less files
* better image quality
* css-able

Benchmarks against nitdoc-next (#1446):
![image](https://cloud.githubusercontent.com/assets/583144/8102371/88a6ed90-0fed-11e5-953b-cd0fa34b8f10.png)

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

8 years agocontrib/rss: fix using the short filename to build patterns
Alexis Laferrière [Fri, 26 Jun 2015 20:48:53 +0000 (16:48 -0400)]
contrib/rss: fix using the short filename to build patterns

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

8 years agocontrib/rss: do not check for previously downloaded files
Alexis Laferrière [Fri, 26 Jun 2015 20:48:28 +0000 (16:48 -0400)]
contrib/rss: do not check for previously downloaded files

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

8 years agocontrib/rss: extract action applied to selected elements
Alexis Laferrière [Fri, 26 Jun 2015 17:59:52 +0000 (13:59 -0400)]
contrib/rss: extract action applied to selected elements

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

8 years agocontrib/rss: use the dom parser
Alexis Laferrière [Fri, 26 Jun 2015 17:30:22 +0000 (13:30 -0400)]
contrib/rss: use the dom parser

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

8 years agolib/file: fix doc of `Path::filename`
Alexis Laferrière [Fri, 26 Jun 2015 17:59:00 +0000 (13:59 -0400)]
lib/file: fix doc of `Path::filename`

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

8 years agolib/dom: intro `XMLStartTag::data`
Alexis Laferrière [Fri, 26 Jun 2015 17:29:37 +0000 (13:29 -0400)]
lib/dom: intro `XMLStartTag::data`

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

8 years agolib/dom: intro `XMLEntity::[]`
Alexis Laferrière [Fri, 26 Jun 2015 17:29:22 +0000 (13:29 -0400)]
lib/dom: intro `XMLEntity::[]`

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

8 years agosrc/nitc: ignore SIGPIPE
Alexis Laferrière [Sun, 28 Jun 2015 13:55:10 +0000 (09:55 -0400)]
src/nitc: ignore SIGPIPE

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

8 years agoMerge: Deserialization manage errors & easily create Nit object from pure JSON
Jean Privat [Tue, 30 Jun 2015 11:42:50 +0000 (07:42 -0400)]
Merge: Deserialization manage errors & easily create Nit object from pure JSON

This PR intro better error management to the deserialization phase, the abstract engine and the JSON implementation. Deserialization of a malformed JSON string or a JSON serialized object from a different program version do not crash the program anymore, it will instead raise errors. When errors are raised, the deserialized object may be inconsistent with uninitialized attribute. Depending on the context, the object may have to be discarded or, usually with the user consent, it can be used with possible fatal failures later.

### Cool bonus part
This PR also lighten the JSON format expected by the deserializer. This allow for nicer custom creation of Nit objects from JSON.

For example, given a Opportunity-like Web app using the Nit class `MeetupConfig` declared like so:

~~~nit
class MeetupConfig
    serialize

    var description: String
    var max_participants: nullable Int
    var answers: Array[FlatString]
end
~~~

On the client-side JavaScript code, one can create a JSON object that will be converted to a Nit instance of `MeetupConfig` by the JSON deserialization services:

~~~json
{"__class": "MeetupConfig", "description": "My Awesome Meetup",
 "max_participants": null, "answers": ["Pepperoni", "Chicken"]}
~~~

### Future work

* We may need to precise the types of a few errors. Especially to differentiate between fatal errors and errors that can be overlooked. There is already `IOError` and `AttributeTypeError` that should be considered fatal.
* Infer advanced array type, such as `Array[MeetupConfig]`. As of now, only arrays of string, int, float, objects and their nullable variants are created.

Pull-Request: #1544
Reviewed-by: Alexandre Terrasa <alexandre@moz-code.org>
Reviewed-by: Jean Privat <jean@pryen.org>

8 years agoMerge: Minor Improvements to the Parallelisation Phase
Jean Privat [Tue, 30 Jun 2015 11:42:45 +0000 (07:42 -0400)]
Merge: Minor Improvements to the Parallelisation Phase

Support modules without a module declaration and nullable types in threaded methods.

---
Don't worry, it's the last PR for today and my dev branches are getting short.

Pull-Request: #1546
Reviewed-by: Jean Privat <jean@pryen.org>
Reviewed-by: Romain Chanoir <chanoir.romain@courrier.uqam.ca>

8 years agoMerge: Fix issues in tests introduced by previous series
Jean Privat [Tue, 30 Jun 2015 11:42:27 +0000 (07:42 -0400)]
Merge: Fix issues in tests introduced by previous series

The main issue was that args where no more tested because of a bad variable scoping in bash

Pull-Request: #1547
Reviewed-by: Romain Chanoir <chanoir.romain@courrier.uqam.ca>
Reviewed-by: Alexis Laferrière <alexis.laf@xymus.net>

8 years agoMerge: mongodb: auto generate ObjectId for inserted and saved documents
Jean Privat [Tue, 30 Jun 2015 00:48:48 +0000 (20:48 -0400)]
Merge: mongodb: auto generate ObjectId for inserted and saved documents

This PR enables the generation of unique ObjectIds for new JsonObject added to collection.

Example when inserting a document:
~~~nit
var obj = new JsonObject
obj["foo"] = "bar"
print obj.to_json
~~~

Object before insertion:
~~~json
{
   "foo": "bar"
}
~~~

After insertion:
~~~nit
collection.insert(obj)
print obj.to_json
~~~
~~~json
{
   "_id": {"$oid": "5578e5e5f34422650c27af01"},
   "foo": "bar"
}
~~~

Pull-Request: #1500
Reviewed-by: Jean Privat <jean@pryen.org>
Reviewed-by: Romain Chanoir <chanoir.romain@courrier.uqam.ca>
Reviewed-by: Lucas Bajolet <r4pass@hotmail.com>

8 years agoMerge: lib/markdown: add some tests for xml parsing inside a markdown block.
Jean Privat [Tue, 30 Jun 2015 00:48:41 +0000 (20:48 -0400)]
Merge: lib/markdown: add some tests for xml parsing inside a markdown block.

Added some test in the hope to reproduce #1059 bug. Everything is working as expected.

Closes: #1059 (can't reproduce)

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

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

8 years agoMerge: examples: add json example from rosetta code
Jean Privat [Tue, 30 Jun 2015 00:48:34 +0000 (20:48 -0400)]
Merge: examples: add json example from rosetta code

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

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

8 years agoMerge: DOM XML
Jean Privat [Tue, 30 Jun 2015 00:48:27 +0000 (20:48 -0400)]
Merge: DOM XML

Hi,

As Nit programmers, we might have to parse XML sometimes for one use or another.

We already had a SAX parser in library for the cases when one wanted to parse a long XML document in a memory-conscious way, often at the expense of the simplicity of the end-program.

This PR adds a very simple DOM parser that will need to be improved and robustified later, but who right now does the basics and should parse valid xml documents.

There is still a long way to get a full spec-compliant XML parser, but this is one base.

Pull-Request: #1448
Reviewed-by: Jean Privat <jean@pryen.org>
Reviewed-by: Alexis Laferrière <alexis.laf@xymus.net>
Reviewed-by: Alexandre Terrasa <alexandre@moz-code.org>

8 years agotests: niti does not report the same line than nitc
Alexis Laferrière [Mon, 29 Jun 2015 22:57:33 +0000 (18:57 -0400)]
tests: niti does not report the same line than nitc

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

8 years agotests: update json serialization test results
Alexis Laferrière [Mon, 29 Jun 2015 20:47:05 +0000 (16:47 -0400)]
tests: update json serialization test results

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

8 years agotests: test a custom JsonDeserializer::class_name_heuristic
Alexis Laferrière [Mon, 29 Jun 2015 14:41:28 +0000 (10:41 -0400)]
tests: test a custom JsonDeserializer::class_name_heuristic

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

8 years agolib/json: add hook to customize the deserialization of plain JSON objects
Alexis Laferrière [Mon, 29 Jun 2015 14:28:48 +0000 (10:28 -0400)]
lib/json: add hook to customize the deserialization of plain JSON objects

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

8 years agolib/json: document deserializing custom JSON code to Nit objects
Alexis Laferrière [Mon, 29 Jun 2015 12:35:27 +0000 (08:35 -0400)]
lib/json: document deserializing custom JSON code to Nit objects

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

8 years agotests: test the tolerance of the JSON deserializer on custom JSON code
Alexis Laferrière [Mon, 29 Jun 2015 01:31:00 +0000 (21:31 -0400)]
tests: test the tolerance of the JSON deserializer on custom JSON code

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

8 years agotests: tests.sh do not grep on inexisting file to avoid warnings
Jean Privat [Mon, 29 Jun 2015 21:47:57 +0000 (17:47 -0400)]
tests: tests.sh do not grep on inexisting file to avoid warnings

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

8 years agotests: tests. use local variable in functions to avoid scope issues
Jean Privat [Mon, 29 Jun 2015 21:44:03 +0000 (17:44 -0400)]
tests: tests. use local variable in functions to avoid scope issues

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

8 years agosrc/parellalization_phase: minor style tweaks
Alexis Laferrière [Mon, 1 Jun 2015 13:14:32 +0000 (09:14 -0400)]
src/parellalization_phase: minor style tweaks

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

8 years agosrc/parallelisation_phase: do not rely on module name declaration
Alexis Laferrière [Mon, 1 Jun 2015 13:11:12 +0000 (09:11 -0400)]
src/parallelisation_phase: do not rely on module name declaration

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

8 years agosrc/parellalization_phase: support nullable parameters in threaded methods
Alexis Laferrière [Sun, 31 May 2015 23:06:26 +0000 (19:06 -0400)]
src/parellalization_phase: support nullable parameters in threaded methods

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

8 years agosrc/parallelisation_phase: remove superfluous if block
Alexis Laferrière [Sun, 31 May 2015 23:01:11 +0000 (19:01 -0400)]
src/parallelisation_phase: remove superfluous if block

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

8 years agolib/markdown: add some tests for xml parsing inside a markdown block.
Alexandre Terrasa [Mon, 29 Jun 2015 15:20:39 +0000 (11:20 -0400)]
lib/markdown: add some tests for xml parsing inside a markdown block.

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

8 years agolib/mongodb: check null receiver when accessing names collection
Alexandre Terrasa [Mon, 29 Jun 2015 15:16:54 +0000 (11:16 -0400)]
lib/mongodb: check null receiver when accessing names collection

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

8 years agolib/mongodb: set automatic last id when inserting or saving a JsonObject
Alexandre Terrasa [Mon, 29 Jun 2015 15:16:28 +0000 (11:16 -0400)]
lib/mongodb: set automatic last id when inserting or saving a JsonObject

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

8 years agotests: Added tests for DOM XML parser
Lucas Bajolet [Mon, 29 Jun 2015 15:02:59 +0000 (11:02 -0400)]
tests: Added tests for DOM XML parser

Signed-off-by: Lucas Bajolet <r4pass@hotmail.com>

8 years agolib/json: infer type of simple JSON array at deserialization
Alexis Laferrière [Mon, 29 Jun 2015 10:53:46 +0000 (06:53 -0400)]
lib/json: infer type of simple JSON array at deserialization

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