nit.git
8 years agocontrib/objcwrapper: intro `ObjcMethod::is_init`
Alexis Laferrière [Wed, 26 Aug 2015 14:09:46 +0000 (10:09 -0400)]
contrib/objcwrapper: intro `ObjcMethod::is_init`

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

8 years agocontrib/objcwrapper: replace `init_with_alloc` by a command line option
Alexis Laferrière [Wed, 26 Aug 2015 13:09:29 +0000 (09:09 -0400)]
contrib/objcwrapper: replace `init_with_alloc` by a command line option

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

8 years agocontrib/objcwrapper: replace `type_convector` by a singleton and `to_nit_type`
Alexis Laferrière [Wed, 26 Aug 2015 12:45:11 +0000 (08:45 -0400)]
contrib/objcwrapper: replace `type_convector` by a singleton and `to_nit_type`

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

8 years agoMerge: New loader policy that features project.ini
Jean Privat [Wed, 26 Aug 2015 18:27:03 +0000 (14:27 -0400)]
Merge: New loader policy that features project.ini

This introduce the new loader policy by adapting the existing loader.
The API it still as bad as before but the behavior is expected to be better. Close #1250

The changes impact two decisions made by the loader:

* how to find the project a module belongs to? ie get the root project of an arbitrary file.
* how to find a named module in a project? ie get (and load) the module named `foo` in a mproject object.

The new loader use a recursive directory search for both answers, whereas the older loader only looked at some specific paths.
By the way, the new code use `String::files` and `String::file_stat` (they where unneeded by the previous loader, life was simpler back then). The light FFI used by the bootstrap make this possible.

Here is a detail of the new policy:

* A project is a directory identified with a `project.ini` file.
  Only the existence of the `.ini` file matter, the content is not used yet.
* A group is just a sub-directory of a project; there is no more naming or structural convention (ie hack).
* A module either belongs to a project, or is a standalone module (also called singleton project). This one is not new.

To know the project a module belongs to, its directory is recursively searched up to the `/` directory.
If a project is found, then the module belongs to it.
If no project is found, then the module is a standalone module.

Note: to simplify the migration from the previous loader, a special file `projects.ini` (with a plural) in a directory indicates that sub-directories are projects, even without a `project.ini` file.
These files simplify the PR as only some `projects.ini` files are needed (eg `lib/projects.ini`)

To search for a module in a project, the named module is searched in the directory and subdirectories of the project.

This PR also expose some vocabulary for the end user. Maybe some terms could be improved before the PR is merged. Some propositions:

* rename `project` as `package` (so `package.ini` instead of `project.ini`). Might be non-POLA from people coming from a Java ecosystem.
* rename `group` as `directory`. With the new policy, groups are more transparent than ever and are only here for the programmer to group modules as he prefers.

Pull-Request: #1654
Reviewed-by: Lucas Bajolet <r4pass@hotmail.com>
Reviewed-by: Alexis Laferrière <alexis.laf@xymus.net>
Reviewed-by: Alexandre Terrasa <alexandre@moz-code.org>

8 years agoinscape_tool: isolate the test directory since generated files are broken
Jean Privat [Tue, 25 Aug 2015 19:37:57 +0000 (15:37 -0400)]
inscape_tool: isolate the test directory since generated files are broken

See #1657

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

8 years agoplatform/android: the root group is no more src, thus no need to `..` from it.
Jean Privat [Tue, 25 Aug 2015 18:29:29 +0000 (14:29 -0400)]
platform/android: the root group is no more src, thus no need to `..` from it.

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

8 years agotests: update some error messages because of the new loader policy
Jean Privat [Mon, 24 Aug 2015 20:27:54 +0000 (16:27 -0400)]
tests: update some error messages because of the new loader policy

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

8 years agotests: improve loader test with a more complex project1 directory
Jean Privat [Mon, 24 Aug 2015 20:04:23 +0000 (16:04 -0400)]
tests: improve loader test with a more complex project1 directory

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

8 years agoloader: change get_mgroup policy and search for a `project.ini` in parent directories
Jean Privat [Mon, 24 Aug 2015 19:57:45 +0000 (15:57 -0400)]
loader: change get_mgroup policy and search for a `project.ini` in parent directories

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

8 years agoCreate empty `projects.ini` and `project.ini` for the new loader policy
Jean Privat [Mon, 24 Aug 2015 20:08:45 +0000 (16:08 -0400)]
Create empty `projects.ini` and `project.ini` for the new loader policy

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

8 years agoloader: get_mgroup check and assign the `project.ini` file to projects
Jean Privat [Mon, 24 Aug 2015 19:55:11 +0000 (15:55 -0400)]
loader: get_mgroup check and assign the `project.ini` file to projects

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

8 years agoloader: get_mgroup filter out non-directories
Jean Privat [Mon, 24 Aug 2015 19:49:17 +0000 (15:49 -0400)]
loader: get_mgroup filter out non-directories

This was implicit because non-directories do not match the heuristics

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

8 years agoloader: projects might have a ini file associated
Jean Privat [Mon, 24 Aug 2015 19:46:40 +0000 (15:46 -0400)]
loader: projects might have a ini file associated

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

8 years agoloader: identify_file distinguishes singleton projects in the verbose message
Jean Privat [Mon, 24 Aug 2015 19:47:28 +0000 (15:47 -0400)]
loader: identify_file distinguishes singleton projects in the verbose message

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

8 years agoloader: use `mmodule_paths_by_name` to simplify `search_mmodule_by_name` and `search_...
Jean Privat [Mon, 24 Aug 2015 19:41:15 +0000 (15:41 -0400)]
loader: use `mmodule_paths_by_name` to simplify `search_mmodule_by_name` and `search_module_in_paths`

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

8 years agoloader: introduce `MGroup::mmodule_paths_by_name` to search for modules
Jean Privat [Mon, 24 Aug 2015 19:40:35 +0000 (15:40 -0400)]
loader: introduce `MGroup::mmodule_paths_by_name` to search for modules

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

8 years agoloader: scan_group does not recursively scan in case of nested project
Jean Privat [Mon, 24 Aug 2015 19:37:59 +0000 (15:37 -0400)]
loader: scan_group does not recursively scan in case of nested project

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

8 years agoMerge: Beefup check contrib
Jean Privat [Mon, 24 Aug 2015 17:56:56 +0000 (13:56 -0400)]
Merge: Beefup check contrib

This change make the caller pass the additional `make` rules to execute. So now `check` or `android` can be given to mass build projects that expose such rules.

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

8 years agoMerge: Fix app.nit Calc example
Jean Privat [Mon, 24 Aug 2015 17:56:50 +0000 (13:56 -0400)]
Merge: Fix app.nit Calc example

Partial revert of cbbb5225 because the Android version of Calc need only `android::ui` and not `android`. The default entry point of `android` use `native_app_glue` as base activity/framework, whereas UI apps use `nit_activity`. This caused the apk file to show 2 activities in the launch menu.

Also recent changes (probably) make calling `to_i` and thus `to_n` on empty strings crash. I've updated the calculator to avoid this with a new friendlier behavior in such cases.

I've also updated `to_n` to return 0 on empty strings. This preserve the old behavior, it is a neutral fallback value and it fits with `"".is_numeric == true`. I did not touch `to_i`.

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

8 years agoMerge: Report check contrib
Jean Privat [Mon, 24 Aug 2015 17:56:46 +0000 (13:56 -0400)]
Merge: Report check contrib

Thanks to `misc/jenkins/check_contrib.sh`, programs in contrib can be tested for regressions.
Unfortunately, sometime the result of the test is not reported (only printed on screen). This PR update some of these to really report things.

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

8 years agoMerge: Benchmark strings update
Jean Privat [Mon, 24 Aug 2015 17:56:44 +0000 (13:56 -0400)]
Merge: Benchmark strings update

Update on the benchmarks for String, four micro-benchmarks are now available:

* chain_concat: measures the performance of concatenation
* index_bench: measures random access in a String
* iteration_bench: measures the performance of iteration on a string
* substr_bench: measures the performance of substring on a string

The logic for the benches has changed a lot, instead of working locally with the different structures and having a directory with all the variations (more to come in a near future), now a patch directory is included with the benches for Strings, and will work with all the variants one by one on the chosen benchmark.

Pull-Request: #1640
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 agolib/markdown: ignore generated nitmd command
Jean Privat [Mon, 24 Aug 2015 14:19:07 +0000 (10:19 -0400)]
lib/markdown: ignore generated nitmd command

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

8 years agolib/json: make build nitcc if required
Jean Privat [Mon, 24 Aug 2015 14:17:40 +0000 (10:17 -0400)]
lib/json: make build nitcc if required

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

8 years agolib/standard: `Text::to_n` returns 0 as failsafe when receiver is empty
Alexis Laferrière [Fri, 21 Aug 2015 18:41:12 +0000 (14:41 -0400)]
lib/standard: `Text::to_n` returns 0 as failsafe when receiver is empty

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

8 years agolib/app: add FIXME to the conditional importation of android::ui
Alexis Laferrière [Fri, 21 Aug 2015 18:25:40 +0000 (14:25 -0400)]
lib/app: add FIXME to the conditional importation of android::ui

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

8 years agoexamples/calculator: add a debug option
Alexis Laferrière [Fri, 21 Aug 2015 18:16:38 +0000 (14:16 -0400)]
examples/calculator: add a debug option

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

8 years agoexamples/calculator: avoid crash from call to `to_n` on empty strings
Alexis Laferrière [Fri, 21 Aug 2015 18:16:22 +0000 (14:16 -0400)]
examples/calculator: avoid crash from call to `to_n` on empty strings

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

8 years agoexamples/calculator: fix Android version to use nit_activity only
Alexis Laferrière [Fri, 21 Aug 2015 17:49:29 +0000 (13:49 -0400)]
examples/calculator: fix Android version to use nit_activity only

This is a partial revert of cbbb5225. The entrypoint of `android` use
`native_app_glue`, which led to craming 2 activities in the apk file.

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

8 years agoMerge: Text::is_int bugfix
Jean Privat [Sat, 22 Aug 2015 02:59:08 +0000 (22:59 -0400)]
Merge: Text::is_int bugfix

Fix a bug that caused an assert failed when accessing an empty string in `Text::is_int`

Reported by @xymus with PR #1649

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

8 years agocheck_contrib: additional rules are given by arguments. beefup_check_contrib
Jean Privat [Sat, 22 Aug 2015 02:56:56 +0000 (22:56 -0400)]
check_contrib: additional rules are given by arguments.

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

8 years agocheck_contrib: also check lib
Jean Privat [Sat, 22 Aug 2015 02:54:58 +0000 (22:54 -0400)]
check_contrib: also check lib

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

8 years agoMerge: GitHub nitlang
Jean Privat [Fri, 21 Aug 2015 23:31:44 +0000 (19:31 -0400)]
Merge: GitHub nitlang

Migrate references from https://github.com/privat/nit to https://github.com/nitlang/nit

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

8 years agovarious lib and contrib doc: points to new github repo
Jean Privat [Fri, 21 Aug 2015 21:54:41 +0000 (17:54 -0400)]
various lib and contrib doc: points to new github repo

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

8 years agolib/github: use new github repo nitlang/nit in doc and tests
Jean Privat [Fri, 21 Aug 2015 21:53:34 +0000 (17:53 -0400)]
lib/github: use new github repo nitlang/nit in doc and tests

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

8 years agonitrpg: use new github repo
Jean Privat [Fri, 21 Aug 2015 21:52:17 +0000 (17:52 -0400)]
nitrpg: use new github repo

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

8 years agogithub_merge: use new github repo
Jean Privat [Fri, 21 Aug 2015 21:51:53 +0000 (17:51 -0400)]
github_merge: use new github repo

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

8 years agofdroid: update metadata with new github repo
Jean Privat [Fri, 21 Aug 2015 21:51:26 +0000 (17:51 -0400)]
fdroid: update metadata with new github repo

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

8 years agoMakefile: link generated doc with new github repo
Jean Privat [Fri, 21 Aug 2015 21:50:53 +0000 (17:50 -0400)]
Makefile: link generated doc with new github repo

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

8 years agolib/standard/fixed_ints: Added extra check on is_int to avoid crashing on indexed...
Lucas Bajolet [Fri, 21 Aug 2015 21:22:37 +0000 (17:22 -0400)]
lib/standard/fixed_ints: Added extra check on is_int to avoid crashing on indexed access

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

8 years agobenchs/strings: Makefile update
Lucas Bajolet [Fri, 21 Aug 2015 20:16:32 +0000 (16:16 -0400)]
benchs/strings: Makefile update

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

8 years agogitattributes: Stop watching for whitespaces in patch files
Lucas Bajolet [Wed, 19 Aug 2015 18:02:48 +0000 (14:02 -0400)]
gitattributes: Stop watching for whitespaces in patch files

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

8 years agobenchmarks/string: Added variants of lib to benchmarks
Lucas Bajolet [Tue, 18 Aug 2015 18:50:17 +0000 (14:50 -0400)]
benchmarks/string: Added variants of lib to benchmarks

* linear_substring: old version of String::substring
* buffered_ns: Perl-like over-allocation when concatenating Strings

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

8 years agoMerge: objcwrapper: wrapper generator to access Objective-C services from Nit
Jean Privat [Fri, 21 Aug 2015 19:48:25 +0000 (15:48 -0400)]
Merge: objcwrapper: wrapper generator to access Objective-C services from Nit

This PR introduces *objcwrapper*, a wrapper generator to access Objective-C services from Nit. At this point, *objcwrapper* can parse large Objective-C header files from Apple, and generate valid Nit code to wrap simple classes.

This PR contains the work of @Tagachi (as the first commit), some of my refactoring and new features. Because of this, there is some rewrite between commits. I chose to keep them as-is because it may be useful to debug regressions in the future. Actually, some of the refactoring remove a few features (such as super class declaration parsing), they will be brought back in future PRs.

This is a good base for future work but also a work in progress. Please restrain comments to structural and algorithmic problems, the doc and manual will be completed with the missing features.

Working features:
- [x] Generate a Nit extern class for each Objective-C `@interface` block.
- [x] Generate Nit extern methods to wrap Objective-C methods (`- `).
- [x] Generate getters for attributes `@property`.
- [x] Basic type conversion from Objective-C to Nit.
- [x] Partial detection of supported and unsupported types.

Todo features:
- [ ] Static functions (`+`) as top-level methods.
- [ ] Attribute setter (when not `readonly`).
- [ ] Intro and use an `ObjcType` instead of a `String`.
- [ ] Reproduce class hierarchy.
- [ ] Reuse wrapped classes (serialize the model alongside the wrapper).
- [ ] Deal with incompatible types: function pointers and others.
- [ ] Print a report on unsupported services.
- [ ] Support parsing GNUstep classes.
- [ ] Generate valid Nit code with Apple classes.
- [ ] Merge with *jwrapper*?

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

8 years agoMerge: lib/code/standard: hash no more divides object_id by 8
Jean Privat [Fri, 21 Aug 2015 19:22:36 +0000 (15:22 -0400)]
Merge: lib/code/standard: hash no more divides object_id by 8

Since objects are allocated on 64bit word boundaries, it made scene to remove the three 000 lower bits and increase the entropy of the hashcode.
Unfortunately, primitive objects like low Int values or Bool have a object_id lower than 8. shifting the 3 last bits was thus a bad idea.

Therefore, programs that used Int or Bool as keys (or part of keys) did have a lot of hash collisions.
For instance, before, for lib/ai/examples/puzzle.nit:

* number of collisions: 525428 (84.49%)
* average length of collisions: 12.44

After:

* number of collisions: 256223 (41.20%)
* average length of collisions: 3.16

The change have a limiting effect on programs that mainly use standard objects as keys.

Before, for nitc:

* number of collisions: 661715 (16.18%)
* average length of collisions: 2.24

After:

* number of collisions: 711614 (17.40%)
* average length of collisions: 2.25

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

8 years agonitiwiki: update results and report test error
Jean Privat [Fri, 21 Aug 2015 19:07:01 +0000 (15:07 -0400)]
nitiwiki: update results and report test error

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

8 years agocontrib/objcwrapper: write import only once per file
Alexis Laferrière [Fri, 21 Aug 2015 15:36:36 +0000 (11:36 -0400)]
contrib/objcwrapper: write import only once per file

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

8 years agocontrib/objcwrapper: refactor services and update style of CodeGenerator
Alexis Laferrière [Fri, 21 Aug 2015 15:47:35 +0000 (11:47 -0400)]
contrib/objcwrapper: refactor services and update style of CodeGenerator

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

8 years agocontrib/objcwrapper: revamp the AST visitor
Alexis Laferrière [Fri, 21 Aug 2015 15:29:19 +0000 (11:29 -0400)]
contrib/objcwrapper: revamp the AST visitor

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

8 years agocontrib/objcwrapper: rename a few AST nodes to 'parameter'
Alexis Laferrière [Thu, 20 Aug 2015 20:23:33 +0000 (16:23 -0400)]
contrib/objcwrapper: rename a few AST nodes to 'parameter'

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

8 years agocontrib/objcwrapper: add the -o option to specify the output file
Alexis Laferrière [Thu, 20 Aug 2015 20:02:16 +0000 (16:02 -0400)]
contrib/objcwrapper: add the -o option to specify the output file

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

8 years agocontrib/objcwrapper: intro basic framework for command line options
Alexis Laferrière [Thu, 20 Aug 2015 20:58:20 +0000 (16:58 -0400)]
contrib/objcwrapper: intro basic framework for command line options

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

8 years agocontrib/objcwrapper: refactor `init_with_alloc` as an attribute
Alexis Laferrière [Thu, 20 Aug 2015 20:01:28 +0000 (16:01 -0400)]
contrib/objcwrapper: refactor `init_with_alloc` as an attribute

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

8 years agocontrib/objcwrapper: merge some type-related tokens in grammar
Alexis Laferrière [Thu, 20 Aug 2015 16:30:18 +0000 (12:30 -0400)]
contrib/objcwrapper: merge some type-related tokens in grammar

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

8 years agocontrib/objcwrapper: move header_static to local folders
Alexis Laferrière [Wed, 12 Aug 2015 20:30:39 +0000 (16:30 -0400)]
contrib/objcwrapper: move header_static to local folders

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

8 years agocontrib/objcwrapper: add a new line at the end of the generated file
Alexis Laferrière [Wed, 12 Aug 2015 20:20:08 +0000 (16:20 -0400)]
contrib/objcwrapper: add a new line at the end of the generated file

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

8 years agocontrib/objcwrapper: report parsing errors
Alexis Laferrière [Tue, 11 Aug 2015 22:29:01 +0000 (18:29 -0400)]
contrib/objcwrapper: report parsing errors

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

8 years agocontrib/objcwrapper: add some doc and license
Alexis Laferrière [Tue, 11 Aug 2015 21:11:52 +0000 (17:11 -0400)]
contrib/objcwrapper: add some doc and license

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

8 years agocontrib/objcwrapper: add the check rule with a few tests
Alexis Laferrière [Fri, 7 Aug 2015 16:27:39 +0000 (12:27 -0400)]
contrib/objcwrapper: add the check rule with a few tests

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

8 years agocontrib/objcwrapper: add git structure and Makefile
Alexis Laferrière [Fri, 7 Aug 2015 16:05:35 +0000 (12:05 -0400)]
contrib/objcwrapper: add git structure and Makefile

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

8 years agocontrib/objcwrapper: intro objcwrapper base code
Arthur Delamare [Mon, 13 Apr 2015 22:42:20 +0000 (18:42 -0400)]
contrib/objcwrapper: intro objcwrapper base code

Signed-off-by: Arthur Delamare <arthur.delamare@viacesi.fr>
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

8 years agocontrib/refund: report test error
Jean Privat [Fri, 21 Aug 2015 19:01:57 +0000 (15:01 -0400)]
contrib/refund: report test error

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

8 years agopep8analysis: report test errors
Jean Privat [Fri, 21 Aug 2015 19:01:33 +0000 (15:01 -0400)]
pep8analysis: report test errors

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

8 years agobenchs/strings: Updated bench_strings, simplified code
Lucas Bajolet [Tue, 18 Aug 2015 18:42:45 +0000 (14:42 -0400)]
benchs/strings: Updated bench_strings, simplified code

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

8 years agobenchs/strings: Update string basic functions benchmarks
Lucas Bajolet [Mon, 17 Aug 2015 15:02:28 +0000 (11:02 -0400)]
benchs/strings: Update string basic functions benchmarks

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

8 years agoMerge: Better module doc within Vim
Jean Privat [Thu, 20 Aug 2015 20:22:40 +0000 (16:22 -0400)]
Merge: Better module doc within Vim

When searching for a module, generate list of introduced classes and properties to add to the user module documentation.

So from within vim, when entering `:Nit opts`, it shows:
~~~
# opts

Management of options on the command line

## Introduced classes
* Option: Super class of all option's class
* OptionArray: An option with an array as parameter
* OptionBool: A boolean option, `true` when present, `false` if not
* OptionContext: Context where the options process
* OptionCount: A count option. Count the number of time this option is present
* OptionEnum: An option to choose from an enumeration
* OptionFloat: An option with a Float as parameter
* OptionInt: An option with an Int as parameter
* OptionParameter: Option with one parameter (mandatory by default)
* OptionString: An option with a `String` as parameter
* OptionText: Not really an option. Just add a line of text when displaying the usage

## Introduced properties
+ VALUE  # Type of the value of the option
+ add_aliases(names: String...)  # Add new aliases for this option
+ default_value: VALUE  # Default value of this option
+ default_value=(default_value: VALUE)  # Default value of this option
+ errors: Array[String]  # Gathering errors during parsing
~ errors=(errors: Array[String])  # Gathering errors during parsing
+ helptext: String  # Human readable description of the option
~ helptext=(helptext: String)  # Human readable description of the option
+ hidden: Bool  # Is this option hidden from `usage`?
+ hidden=(hidden: Bool)  # Is this option hidden from `usage`?
+ init(help: String, default: VALUE, names: nullable Array[String])  # Create a new option
[...]
~~~

The list of properties can be long, but it is useful to search by keywords.

As usual, use `:pc` to **c**lose the **p**review window showing the doc.

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

8 years agolib/code/standard: hash no more divides object_id by 8
Jean Privat [Thu, 20 Aug 2015 16:50:50 +0000 (12:50 -0400)]
lib/code/standard: hash no more divides object_id by 8

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

8 years agovim doc: show introduced classes and props in the module doc
Alexis Laferrière [Thu, 20 Aug 2015 15:36:44 +0000 (11:36 -0400)]
vim doc: show introduced classes and props in the module doc

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

8 years agovim doc: extract writing the synopsis of a property
Alexis Laferrière [Thu, 20 Aug 2015 15:35:58 +0000 (11:35 -0400)]
vim doc: extract writing the synopsis of a property

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

8 years agovim doc: fix constructor names in generated doc
Alexis Laferrière [Thu, 20 Aug 2015 15:35:15 +0000 (11:35 -0400)]
vim doc: fix constructor names in generated doc

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

8 years agoMerge: Performance update on Buffer
Jean Privat [Thu, 20 Aug 2015 15:04:44 +0000 (11:04 -0400)]
Merge: Performance update on Buffer

This PR is essentially the same as #1632, which has been invalidated by some black magic.

This PR heavily improves the performance on FlatBuffer by introducing cache mechanisms on indexed access.

This is possible through removal of byte-level manipulation on Buffers and re-introduction of a constant-time length attribute on Buffer.

nitmd is now practicable again and should no longer take too much time when running benches.

This PR still depends on #1628, and as such will not pass no tests as long as it is not integrated

Pull-Request: #1644

8 years agotests: Update test_string_bytes
Lucas Bajolet [Tue, 11 Aug 2015 20:54:31 +0000 (16:54 -0400)]
tests: Update test_string_bytes

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

8 years agolib/binary: Fix binary lib to properly use Bytes instead of FlatBuffer
Lucas Bajolet [Tue, 11 Aug 2015 20:53:59 +0000 (16:53 -0400)]
lib/binary: Fix binary lib to properly use Bytes instead of FlatBuffer

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

8 years agolib/standard/text: Mutualized cache mechanism to FlatText
Lucas Bajolet [Tue, 11 Aug 2015 14:27:50 +0000 (10:27 -0400)]
lib/standard/text: Mutualized cache mechanism to FlatText

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

8 years agolib/standard/text: Removed byte-level modification on Buffers
Lucas Bajolet [Tue, 11 Aug 2015 14:13:54 +0000 (10:13 -0400)]
lib/standard/text: Removed byte-level modification on Buffers

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

8 years agoMerge: Intro Codec
Jean Privat [Thu, 20 Aug 2015 14:45:44 +0000 (10:45 -0400)]
Merge: Intro Codec

As UTF-8 is now part of Nit, the standard imposes conforming implementations to properly handle borderline cases like overlong sequences and such.

The codec defined here sanitizes an input before letting Nit play with it, avoiding potential security [issues](https://www.owasp.org/index.php/Canonicalization,_locale_and_Unicode)

The codec architecture can also be used later to handle different codings for source files (that or we decide that all that is not UTF-8 is to be rejected/misinterpreted) or text.

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

8 years agoMerge: Cleanup loader
Jean Privat [Thu, 20 Aug 2015 10:22:39 +0000 (06:22 -0400)]
Merge: Cleanup loader

Because #1250 is starting to stall and that my rewrite of the loader is not going well, I started last night an alternative approach: improve the existing loader in small steps.

This PR contains small cleaning on the loader, mainly documentation, small refactorization and bugfixes.
This is a small part of bigger modification still in progress, but I expect these commits to be good enough to be merged.

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

8 years agoMerge: simplify glslangValidator test to support different versions of the tool
Jean Privat [Thu, 20 Aug 2015 02:30:47 +0000 (22:30 -0400)]
Merge: simplify glslangValidator test to support different versions of the tool

As reported in #1537, different versions of glslangValidator do not output the same error messages as they do not use the same default type for undeclared variables. This PR removes an error from the glsl code (or fix it if you prefer) so different versions of the tools have the same output. There are still many more errors to check that the integration of the tool within nitc works.

Fix #1537.

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

8 years agoMerge: Fix light FFI in interpreter on OS X
Jean Privat [Thu, 20 Aug 2015 02:30:39 +0000 (22:30 -0400)]
Merge: Fix light FFI in interpreter on OS X

Fix #1623 by removing the soname declaration (the soname was more of a placeholder at this time anyway). Also take this opportunity to remove the `-g` flag.

The fixes to the md5 modules update it to the latest style and use the nity/native pattern to avoid callbacks so it is light FFI compatible. This was used to test the interpreter on OS X.

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

8 years agotests: remove todo on soname error
Alexis Laferrière [Wed, 19 Aug 2015 19:07:01 +0000 (15:07 -0400)]
tests: remove todo on soname error

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

8 years agolib/md5: improve doc
Alexis Laferrière [Wed, 19 Aug 2015 18:46:47 +0000 (14:46 -0400)]
lib/md5: improve doc

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

8 years agotests: simplify glslValidator test to support different versions
Alexis Laferrière [Wed, 19 Aug 2015 19:22:46 +0000 (15:22 -0400)]
tests: simplify glslValidator test to support different versions

Fix #1537.

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

8 years agoMerge: Friendly jenkins checks
Jean Privat [Wed, 19 Aug 2015 19:02:06 +0000 (15:02 -0400)]
Merge: Friendly jenkins checks

Improve scripts to make jenkins error friendlier about licenses, signed-off-bys and whitespaces.

Scripts now write sentences and add a final note in case of error to explain how to solve the issues.
Once #1639 is merged, the life of new contributors will never be that easy.

Examples of new messages:

* `./checklicense.sh v0.7 63e0f2c` gives:

~~~
checklicense v0.7 (68561eb8d91800ccb3fa289bff6721ddd11dbe25) .. 63e0f2c (63e0f2c7cd96f4c40366d92614785b1006e52367)
These files are missing their licence:

benchmarks/polygons/nit/bench_polygon.nit

Please double check that the licence text (i.e. `This file is part of NIT...`) is included at the begin of these files.
~~~

* `./checksignedoffby.sh origin/master 63e0f2c7cd96f4c40366d92614785b1006e52367` gives:

~~~
checksignedoffby origin/master (b144984d92908662f47a251f1cca1fd8e57b2594) .. 63e0f2c7cd96f4c40366d92614785b1006e52367 (63e0f2c7cd96f4c40366d92614785b1006e52367)

Bad or missing Signed-off-by for commit
63e0f2c lib/graphs: add module for directed graphs
Expected (from local git config):
Signed-off-by: Alexandre Blondin Massé <alexandre.blondin.masse@gmail.com>
Got:
Signed-off-by: Alexandre Blondin Massé <blondin_masse.alexandre@uqam.ca>

Please check that each commit contains a `Signed-off-by:` statement that matches the author's name and email.
Note that existing commits should be amended; pushing new commit is not sufficient.
~~~

* `./checkwhitespaces.sh origin/master e6cfa93` gives:

~~~
checkwhitespaces origin/master (b144984d92908662f47a251f1cca1fd8e57b2594) .. e6cfa93 (e6cfa93970687e33784c0251cf4da2f6e13d9f2c)

Found whitespace errors in commit
e6cfa93 Started documenting the digraph module.
lib/graphs/digraph.nit:5: trailing whitespace.
+#
lib/graphs/digraph.nit:13: trailing whitespace.
+#
lib/graphs/digraph.nit:18: trailing whitespace.
+#
lib/graphs/digraph.nit:21: trailing whitespace.
+#

Found whitespace errors in commit
e5c4311 Moved modules to lib/graphs.
lib/graphs/digraph.nit:313: trailing whitespace.
+ for

Found whitespace errors in commit
5e7bf24 Started MatrixDigraph.
lib/digraph.nit:313: trailing whitespace.
+ for

Found whitespace errors in commit
e6fd4d4 Basic methods for digraphs.
tests/test_graph.nit:34: new blank line at EOF.

Please check that each file in each commit does not contain whitespace errors.
Note that existing commits should be amended; pushing new commit is not sufficient.
Hint: use "git log --check" to see whitespace errors.
~~~

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

8 years agoMerge: jenkins: name command test results with `cmd` instead of `run`
Jean Privat [Wed, 19 Aug 2015 19:02:02 +0000 (15:02 -0400)]
Merge: jenkins: name command test results with `cmd` instead of `run`

The infamous bug that caused some tests result to silently make Jenkins go mad is found.
The issue was to have a junit package named `run`; unfortunately, package names are used as is in URL by Jenkins and `run` in URL seems to have a special buggy behavior. Eg

* http://gresil.org/jenkins/job/CI_github/lastCompletedBuild/testReport/run/foo
* http://gresil.org/jenkins/job/CI_github/lastCompletedBuild/testReport/notrun/foo

The solution is to name the pseudo-package `cmd` instead.

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

8 years agolib/md5: update to only rely on the light FFI
Alexis Laferrière [Wed, 19 Aug 2015 18:44:11 +0000 (14:44 -0400)]
lib/md5: update to only rely on the light FFI

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

8 years agonit: do not specify an soname (or -g) for JIT FFI libraries
Alexis Laferrière [Wed, 19 Aug 2015 18:34:57 +0000 (14:34 -0400)]
nit: do not specify an soname (or -g) for JIT FFI libraries

Fix #1623

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

8 years agojenkins: unitrun.sh does not generate empty system-out and system-err blocks
Jean Privat [Wed, 19 Aug 2015 18:33:05 +0000 (14:33 -0400)]
jenkins: unitrun.sh does not generate empty system-out and system-err blocks

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

8 years agojenkins: add checkwhitespace to be a more explicit and friendly `git log --check`
Jean Privat [Wed, 19 Aug 2015 06:56:36 +0000 (02:56 -0400)]
jenkins: add checkwhitespace to be a more explicit and friendly `git log --check`

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

8 years agojenkins: improve checksignedoffby to be more explicit and friendly
Jean Privat [Wed, 19 Aug 2015 06:55:53 +0000 (02:55 -0400)]
jenkins: improve checksignedoffby to be more explicit and friendly

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

8 years agojenkins: improve checklicense to be more explicit and friendly
Jean Privat [Wed, 19 Aug 2015 06:55:14 +0000 (02:55 -0400)]
jenkins: improve checklicense to be more explicit and friendly

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

8 years agoMerge: extends nitmd to handle manpages output format
Jean Privat [Wed, 19 Aug 2015 05:41:04 +0000 (01:41 -0400)]
Merge: extends nitmd to handle manpages output format

A lot of things are done here:

* extension of nitmd to handle more output formats
* new man decorator to transform markdown into basic groff suitable for manpages. Close #1506
* remove dubious usage of definition list in our markdown. Close #1594
* remove the use of pandoc and use nitmd to generate our manpages. Close #824

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

8 years agomanpages: use nitmd instead of pandoc
Jean Privat [Wed, 19 Aug 2015 05:33:14 +0000 (01:33 -0400)]
manpages: use nitmd instead of pandoc

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

8 years agoloader: document ` identify_file`
Jean Privat [Tue, 18 Aug 2015 12:47:14 +0000 (08:47 -0400)]
loader: document ` identify_file`

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

8 years agoloader: identify_file do really return null is the path does not exists
Jean Privat [Tue, 18 Aug 2015 12:45:17 +0000 (08:45 -0400)]
loader: identify_file do really return null is the path does not exists

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

8 years agoloader: single module group `is_interesting` if the module is not the default one
Jean Privat [Tue, 18 Aug 2015 12:31:50 +0000 (08:31 -0400)]
loader: single module group `is_interesting` if the module is not the default one

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

8 years agoMerge: Graph theory in Nit
Jean Privat [Tue, 18 Aug 2015 17:59:22 +0000 (13:59 -0400)]
Merge: Graph theory in Nit

Close #1386

Pull-Request: #1404
Reviewed-by: Jean Privat <jean@pryen.org>
Reviewed-by: Alexandre Terrasa <alexandre@moz-code.org>
Reviewed-by: Lucas Bajolet <r4pass@hotmail.com>

8 years agolib/graphs: adds module for directed graphs.
Alexandre Blondin Massé [Tue, 25 Nov 2014 22:17:54 +0000 (17:17 -0500)]
lib/graphs: adds module for directed graphs.

Signed-off-by: Alexandre Blondin Massé <alexandre.blondin.masse@gmail.com>

8 years agojenkins: name command test results with `cmd` instead of `run`
Jean Privat [Tue, 18 Aug 2015 15:56:56 +0000 (11:56 -0400)]
jenkins: name command test results with `cmd` instead of `run`

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

8 years agoloader: scan_group do not rescan
Jean Privat [Tue, 18 Aug 2015 12:30:47 +0000 (08:30 -0400)]
loader: scan_group do not rescan

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

8 years agoloader: rename (and document) `visit_group` as `scan_group`
Jean Privat [Tue, 18 Aug 2015 12:29:22 +0000 (08:29 -0400)]
loader: rename (and document) `visit_group` as `scan_group`

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

8 years agoloader: identify_file use the absence of '/' for special behavior
Jean Privat [Tue, 18 Aug 2015 12:20:08 +0000 (08:20 -0400)]
loader: identify_file use the absence of '/' for special behavior

Now `./standard` and `standard` have a different meaning

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