Jean Privat [Mon, 2 May 2016 00:45:07 +0000 (20:45 -0400)]
modelbuilder: add `try_get_mclass_by_qid` to handle qualified class names
Signed-off-by: Jean Privat <jean@pryen.org>
Jean Privat [Mon, 2 May 2016 00:42:34 +0000 (20:42 -0400)]
modelbuilder: fix hint on bad classnames
Signed-off-by: Jean Privat <jean@pryen.org>
Jean Privat [Thu, 28 Apr 2016 23:04:51 +0000 (19:04 -0400)]
Merge: Better Entity::full_name
This PR is a continuation of previous work on packages, model entities and namespaces. See #1069, #1092 or #1032 for the history.
The point of `full_name` is to offer the simpler canonical names possible that is:
* global. i.e. based on the package name.
* stable on modifications. i.e. the name of an entity does not change if other entities are added.
* human readable. i.e. some encoding but not binary.
* scalable. i.e. simple entities have simple names, complex entities have more complex names.
This PR add the following:
* no name collision on distinct kind of entities (packages, root groups, and default modules conflict no more).
* do not use characters that have a special semantic in URL (no more `#` and `/`).
* some bugfixes and simplifications.
* a complex test case with a lot of rare entity constructions (so complex names).
* a extended `test_model_visitor` that check and count names.
## Proposed full_name policy
### Common public entities
They are those you might look for in a doc.
They can appear in error messages.
In case of name conflict in programs, you might also use them to disambiguate things (in the future)
* packages have a simple name.
e.g. `core` or `nitcorn` (unchanged)
* groups, are separated by `>` (instead of `/`) and terminated by a trailing `>` (to distinguish them)
e.g. `core>` or `core>collection>`
* modules are just prefixed by their package, even the default module
e.g. `core::kernel` or `core::core`
* public classes are prefixed by their packages
e.g. `core::Object` or `core::Buffer` (unchanged)
* public global properties without refinement, are prefixed by their package and class
e.g. `core::Object::==` or `core::Buffer::add` (unchanged)
Because of modules and class refinement, things unusual in other languages must have a full_name:
Public global properties introduced by a refinement, require the module (between the package and the class)
e.g. `core::file::Sys::print`
Currently, the compiler allows that a same package refines a public class in two distinct modules, with two homonym properties.
I'm not sure this is a good idea, but the rare uses force us to accept them.
The most infamous are `nitc::nitc::ToolContext::opt_dir` and `nitc::nitdoc::ToolContext::opt_dir`.
Private classes and properties are only visible by their module, thus the module name is required in their full_name.
e.g. `core::hash_collection::HashNode` or `core::hash_collection::HashNode::key` (unchanged)
### Definitions
As you know, class definitions (introductions and refinements) and property definitions are distinguished from their global counterpart.
Most of the time, we try to avoid referring specifically to them when the global thing is sufficient.
Class definitions combine the information of a class and a module.
Property definitions combine the information of a class definition and a property.
Therefore, the quantity of information for the worst case of property definition can be quite large.
A `$` is used to separate the information (it was `#` previously).
A single `$` means a class definition and two `$` means a property definition.
Introductions (without refinement nor redefinition) are designated like global properties (`::` are just replaced by `$`).
* `core$Object` is the definition that introduces of `core::Object`
* `core$Buffer$add` is the definition that introduces `core::Buffer::add`
* `core::hash_collection$HashNode$key` is the definition that introduces `core::hash_collection::HashNode::key`.
For refinements of classes, the class part is prefixed by package and module information when they are needed.
As requested, the full_name of the refinement of a public class in the same package is more simple than the refinement of a private class in a different package.
* `core::file$Sys` is the refinement of Sys in `core::file`. `Sys` is unambiguously `core::Sys`
* `counter::counter$core::Collection` is the refinement of `core::Collection` in the module `counter::counter`
* `hash_debug::hash_debug$core::hash_collection::HashCollection` is the refinement of `HashCollection` (it's a private class) in `hash_debug`
* `pthreads::extra$::pthreads::NativePthread` is the refinement of the private class `NativePthread` in an extra module in the same package (`$::` means that the package name is the same).
For redefinitions of properties, the full_name for the class definition is used (see above), then the property part contains whatever package, module or class information is required.
* `core$Array$SimpleCollection::add` the redefinition of `SimpleCollection::add` into `Array`
* `core$String$::abstract_text::Text::substrings` the redefinition of the private method `Text::substrings` in `String`
For simple method refinements (refinement of the introduction), most of the information is already given by the module or the class, the property part is thus simple.
* `hash_debug::hash_debug$core::hash_collection::HashCollection$store` is the refinement of the private method `HashCollection::store` in the useful package `has_debug`.
Complex method redefinition of private things provide the worst full_name (3 package names, 3 module names, 2 class names and a property name).
* `ropes_debug::ropes_debug$core::ropes::Concat$::ropes_debug::Text::internal_to_dot` is the redefinition of `ropes_debug::ropes_debug::Text::internal_to_dot` in the class `core::ropes::Concat` by the module `ropes_debug::ropes_debug`.
Pull-Request: #2041
Reviewed-by: Alexis Laferrière <alexis.laf@xymus.net>
Jean Privat [Thu, 28 Apr 2016 23:04:49 +0000 (19:04 -0400)]
Merge: Faster ASCII-only strings
This simple PR re-introduces the concept of ASCII strings for faster no-overhead accesses to random characters in a string.
The class is private as it is to be used only internally, no client should care for the specific type of a String and all performance improvements will be automatic, should the optimization be possible.
Since we are dealing with UTF-8, the only case where O(1) access can efficiently and without much overhead (one `if` statement at creation) be determined, is when a string only contains ASCII characters.
Note that since the Buffer can change access semantics depending on what is appended during its lifetime, no ASCII-only FlatBuffer has been added.
This is implemented here by introducing two subclasses of FlatString, one for ASCII only strings, and one for regular Unicode strings (the old FlatString).
In terms of performance, in the compiler, there is a ~0.5% improvement, but in specific cases like JSON parsing for the `big_gov_data.json` (where not a single unicode character is present) bench, the difference amounts to ~35%.
Pull-Request: #2040
Reviewed-by: Jean Privat <jean@pryen.org>
Lucas Bajolet [Mon, 25 Apr 2016 15:12:08 +0000 (11:12 -0400)]
lib: Update text_stat and tests for new String types
Signed-off-by: Lucas Bajolet <r4pass@hotmail.com>
Lucas Bajolet [Mon, 25 Apr 2016 15:00:12 +0000 (11:00 -0400)]
lib: Fix serialization issue with string-oriented typing
Signed-off-by: Lucas Bajolet <r4pass@hotmail.com>
Lucas Bajolet [Mon, 25 Apr 2016 14:52:40 +0000 (10:52 -0400)]
tests: Updated sav for old tests
Signed-off-by: Lucas Bajolet <r4pass@hotmail.com>
Jean Privat [Tue, 26 Apr 2016 23:47:23 +0000 (19:47 -0400)]
nitls: do not add '/' since groups are ended by '>'
Signed-off-by: Jean Privat <jean@pryen.org>
Jean Privat [Wed, 27 Apr 2016 13:50:11 +0000 (09:50 -0400)]
tests: update because of new full_names
Signed-off-by: Jean Privat <jean@pryen.org>
Jean Privat [Sat, 23 Apr 2016 21:58:24 +0000 (17:58 -0400)]
tests: add new test package `names` for test_model_visitor
Signed-off-by: Jean Privat <jean@pryen.org>
Jean Privat [Sat, 23 Apr 2016 21:23:05 +0000 (17:23 -0400)]
nitc/test_model_visitor: check and count fullnames
Signed-off-by: Jean Privat <jean@pryen.org>
Jean Privat [Sat, 23 Apr 2016 21:21:55 +0000 (17:21 -0400)]
android: remove superfluous redefinitions of SELF
Signed-off-by: Jean Privat <jean@pryen.org>
Jean Privat [Sat, 23 Apr 2016 21:10:26 +0000 (17:10 -0400)]
model: simplify module name if package is enough for MPropdef::full_name
Signed-off-by: Jean Privat <jean@pryen.org>
Jean Privat [Sat, 23 Apr 2016 21:02:58 +0000 (17:02 -0400)]
model: avoid full_name conflict with global properties
Signed-off-by: Jean Privat <jean@pryen.org>
Jean Privat [Sat, 23 Apr 2016 20:49:16 +0000 (16:49 -0400)]
model: fullnames use `$` instead of `#` for classdefs and propdefs
`#` is a bad symbol to use in url
Signed-off-by: Jean Privat <jean@pryen.org>
Jean Privat [Sat, 23 Apr 2016 20:45:38 +0000 (16:45 -0400)]
model: use > in fullnames of groups. An add a trailing `>` to them distinct.
* `core` is a package
* `core>` its root groups
* `core>collection>` a subgroup
* `core::core` the default module
Signed-off-by: Jean Privat <jean@pryen.org>
Jean Privat [Sat, 23 Apr 2016 20:43:29 +0000 (16:43 -0400)]
model: double the name of the default module to make it distinct with the package.
E.g. `core` vs. `core::core`
Signed-off-by: Jean Privat <jean@pryen.org>
Jean Privat [Tue, 26 Apr 2016 00:20:57 +0000 (20:20 -0400)]
Merge: nitc: use Array instead of List
valgrind says we gain 2%
Pull-Request: #2039
Reviewed-by: Alexis Laferrière <alexis.laf@xymus.net>
Reviewed-by: Lucas Bajolet <r4pass@hotmail.com>
Jean Privat [Tue, 26 Apr 2016 00:20:55 +0000 (20:20 -0400)]
Merge: faster new factory
new factories are badly implemented.
They assume a stub temporary receiver exists.
This temporary receiver is required because it currently holds the method and the formal types.
However, this object could be reused if the formal types are the same.
It's what is doing the PR.
This is still a temporary workaround solution, doing things correctly need a lot of more work.
Asked by @R4PaSs
Pull-Request: #2038
Reviewed-by: Lucas Bajolet <r4pass@hotmail.com>
Jean Privat [Tue, 26 Apr 2016 00:20:50 +0000 (20:20 -0400)]
Merge: interpreter use the catch from the compiler
Previous PR #2011 introduced the `do ... catch ... end` bloc in the interpreter and the compiler.
This one makes it so the interpreter is using the mecanism (longjmp) from the compiler
Pull-Request: #2036
Reviewed-by: Jean Privat <jean@pryen.org>
Reviewed-by: Lucas Bajolet <r4pass@hotmail.com>
Jean Privat [Tue, 26 Apr 2016 00:20:48 +0000 (20:20 -0400)]
Merge: Continuous integration tests for Nitcorn
Test some of the main nitcorn features for regression. This would have caught the last bugs we experienced with nitcorn: #2023, the binary file bug, the file server directory access without the final /, etc. This structure could be used to add more tests in the future, for new or forgotten features and for existing clients like Tnitter and Opportunity.
Pull-Request: #2031
Reviewed-by: Jean Privat <jean@pryen.org>
Reviewed-by: Alexandre Terrasa <alexandre@moz-code.org>
Alexis Laferrière [Sat, 23 Apr 2016 13:43:12 +0000 (09:43 -0400)]
lib/pthreads: less warnings on OS X
unknown-attributes error are thrown by the inclusion of `gc.h`.
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Sat, 23 Apr 2016 14:00:23 +0000 (10:00 -0400)]
niti: simply use `cc` as compiler
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Sat, 23 Apr 2016 13:38:26 +0000 (09:38 -0400)]
niti: fix support for cflags from pkgconfig
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Jean Privat [Sat, 23 Apr 2016 08:31:31 +0000 (04:31 -0400)]
Merge: JSON serialization: write pretty JSON
Intro an option in `JsonSerializer` to write pretty indented JSON. By default, the generated JSON is somewhat minified, this could be improved if needed.
See the generated JSON in the tests below. I chose to leave the metadata and other special short objects non-indented as they are not intended for humans. The option `plain_json` is fully compatible with `pretty_json` (see alt4.res), I expect them to be used together often.
This was requested by @Morriar and it could allow us to deprecate the `json::static` writer API.
Pull-Request: #2035
Reviewed-by: Alexandre Terrasa <alexandre@moz-code.org>
Reviewed-by: Jean Privat <jean@pryen.org>
Jean Privat [Sat, 23 Apr 2016 08:31:28 +0000 (04:31 -0400)]
Merge: Hint to bad class names
Add hints when a class name cause an error.
Basically 3 cases are considered: spellign, bad visibility and not imported. e.g.
~~~
Error: class `Fail` not found in module `error_unk_class`.
Error: class `Boolean` not found in module `error_unk_class`. Did you mean `Bool`?
Error: class `core::list::ListNode` not visible in module `error_unk_class`.
Error: class `POSet` not found in module `error_unk_class`. Maybe import `poset`?
~~~
Pull-Request: #2034
Reviewed-by: Alexandre Terrasa <alexandre@moz-code.org>
Reviewed-by: Alexis Laferrière <alexis.laf@xymus.net>
Jean Privat [Sat, 23 Apr 2016 00:54:03 +0000 (20:54 -0400)]
nitc: use Array instead of List
valgrind says we gain 2%
Signed-off-by: Jean Privat <jean@pryen.org>
Jean Privat [Sat, 23 Apr 2016 00:08:05 +0000 (20:08 -0400)]
tests: add base_new_factory
Signed-off-by: Jean Privat <jean@pryen.org>
Jean Privat [Fri, 22 Apr 2016 23:50:18 +0000 (19:50 -0400)]
nitc: hack to fasten new factories
Signed-off-by: Jean Privat <jean@pryen.org>
Jean Privat [Fri, 22 Apr 2016 02:27:00 +0000 (22:27 -0400)]
tests: add tests for unknown class hints
Signed-off-by: Jean Privat <jean@pryen.org>
Jean Privat [Fri, 22 Apr 2016 02:11:03 +0000 (22:11 -0400)]
modelbuilder: propose hints when a class is not found
Signed-off-by: Jean Privat <jean@pryen.org>
Jean Privat [Fri, 22 Apr 2016 00:54:32 +0000 (20:54 -0400)]
modelize: get the Bool type faster
Signed-off-by: Jean Privat <jean@pryen.org>
Lucas Bajolet [Fri, 22 Apr 2016 20:08:31 +0000 (16:08 -0400)]
lib/core: Faster access to length in ropes
Signed-off-by: Lucas Bajolet <r4pass@hotmail.com>
Alexis Laferrière [Fri, 22 Apr 2016 13:04:53 +0000 (09:04 -0400)]
tests: test pretty JSON, with and without plain JSON
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Fri, 22 Apr 2016 13:42:26 +0000 (09:42 -0400)]
tests: update existing JSON serialization test to the more minified
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Lucas Bajolet [Fri, 22 Apr 2016 19:14:53 +0000 (15:14 -0400)]
lib/core: Made FlatString abstract and added fast version for ASCII-only Strings
Signed-off-by: Lucas Bajolet <r4pass@hotmail.com>
BlackMinou [Fri, 22 Apr 2016 18:43:09 +0000 (14:43 -0400)]
Interpreter use the catch from the compiler
Signed-off-by: BlackMinou <romain.chanoir@viacesi.fr>
Alexis Laferrière [Thu, 21 Apr 2016 13:44:27 +0000 (09:44 -0400)]
lib/nitcorn: FileServer sort files by name in directory listing
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Thu, 21 Apr 2016 13:37:55 +0000 (09:37 -0400)]
lib/nitcorn: return a 404 on a request matching not routes or virtual host
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Wed, 20 Apr 2016 17:48:02 +0000 (13:48 -0400)]
tests: test nitcorn
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Fri, 22 Apr 2016 12:55:41 +0000 (08:55 -0400)]
lib/json: intro setting to serialize to pretty JSON
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Fri, 22 Apr 2016 12:54:37 +0000 (08:54 -0400)]
lib/json: clear warnings
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Fri, 22 Apr 2016 12:53:37 +0000 (08:53 -0400)]
lib/json: warn on cycle when writing plain JSON
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Jean Privat [Fri, 22 Apr 2016 02:21:48 +0000 (22:21 -0400)]
Merge: model_collect: add more services
Just some services that work on flattened views of the model that I will need soon.
Pull-Request: #2025
Reviewed-by: Jean Privat <jean@pryen.org>
Jean Privat [Thu, 21 Apr 2016 21:51:21 +0000 (17:51 -0400)]
Merge: Codec refactor
Sub-part of #2006 since @privat asked for it to be split, here's one part concerning the addition of a few services to NativeString and Byte, along with the refactor of the Codec API
Pull-Request: #2012
Reviewed-by: Jean Privat <jean@pryen.org>
Jean Privat [Thu, 21 Apr 2016 21:51:19 +0000 (17:51 -0400)]
Merge: Pack Strings
Added convenience feature to `Text` objects: `pack`.
These new methods pack the content of a `Text` object into an array of `n` elements of length up to `ln`.
Pull-Request: #2033
Reviewed-by: Jean Privat <jean@pryen.org>
Jean Privat [Thu, 21 Apr 2016 21:51:14 +0000 (17:51 -0400)]
Merge: Poset: add clone, ==, hash and sub
Extends the POSet class with some useful methods to compare and (partially) copy posets.
Pull-Request: #2029
Reviewed-by: Alexandre Terrasa <alexandre@moz-code.org>
Alexandre Terrasa [Tue, 19 Apr 2016 01:18:35 +0000 (21:18 -0400)]
model_collect: collect MClass inits
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>
Alexandre Terrasa [Tue, 19 Apr 2016 01:18:21 +0000 (21:18 -0400)]
model_collect: collect all MClass inherited methods
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>
Alexandre Terrasa [Wed, 20 Apr 2016 23:46:18 +0000 (19:46 -0400)]
model_collect: collect importation poset for modules
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>
Alexandre Terrasa [Wed, 20 Apr 2016 23:46:01 +0000 (19:46 -0400)]
model_collect: collect more on MModule hierarchy
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>
Alexandre Terrasa [Fri, 18 Dec 2015 05:21:16 +0000 (00:21 -0500)]
model_views: build posets from mentities lists
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>
Alexandre Terrasa [Thu, 21 Apr 2016 21:35:02 +0000 (17:35 -0400)]
Merge branch 'subposet' of https://github.com/privat/mynit into privat-subposet
Lucas Bajolet [Thu, 21 Apr 2016 15:37:48 +0000 (11:37 -0400)]
tests: Added ISO8859-1 codec test
Signed-off-by: Lucas Bajolet <r4pass@hotmail.com>
Lucas Bajolet [Tue, 5 Apr 2016 20:39:02 +0000 (16:39 -0400)]
Codecs: Refactor API
Signed-off-by: Lucas Bajolet <r4pass@hotmail.com>
Alexis Laferrière [Wed, 20 Apr 2016 17:48:14 +0000 (13:48 -0400)]
lib/nitcorn: force all routes path to begin with a "/" once registered
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Lucas Bajolet [Thu, 21 Apr 2016 15:32:10 +0000 (11:32 -0400)]
lib/core: Added packing methods to `Text`
Signed-off-by: Lucas Bajolet <r4pass@hotmail.com>
Jean Privat [Thu, 21 Apr 2016 13:45:40 +0000 (09:45 -0400)]
lib/poset: add == and hash
Signed-off-by: Jean Privat <jean@pryen.org>
Jean Privat [Thu, 21 Apr 2016 13:20:45 +0000 (09:20 -0400)]
Merge: Fix more warnings
Everything is in the title, for the algorithm see #2027.
Spam box: @R4PaSs @xymus @privat and even @BlackMinou for ballz
Pull-Request: #2028
Reviewed-by: Jean Privat <jean@pryen.org>
Reviewed-by: Alexis Laferrière <alexis.laf@xymus.net>
Jean Privat [Thu, 21 Apr 2016 13:20:39 +0000 (09:20 -0400)]
Merge: nitweb: uml graphs route
Allows nitweb to display UML.
Thanks @R4PaSs!
Pull-Request: #2026
Reviewed-by: Jean Privat <jean@pryen.org>
Reviewed-by: Lucas Bajolet <r4pass@hotmail.com>
Jean Privat [Thu, 21 Apr 2016 13:20:36 +0000 (09:20 -0400)]
Merge: lib/core/bytes: add `Int::to_bytes` and `Bytes::to_i`
More nice services on bytes.
Pull-Request: #2013
Reviewed-by: Alexandre Terrasa <alexandre@moz-code.org>
Reviewed-by: Lucas Bajolet <r4pass@hotmail.com>
Jean Privat [Thu, 21 Apr 2016 01:33:07 +0000 (21:33 -0400)]
lib/poset: make POSet cCloneable
Signed-off-by: Jean Privat <jean@pryen.org>
Jean Privat [Thu, 21 Apr 2016 01:32:21 +0000 (21:32 -0400)]
lib/poset: add `sub` to build induced subposets
Signed-off-by: Jean Privat <jean@pryen.org>
Alexandre Terrasa [Wed, 20 Apr 2016 22:54:47 +0000 (18:54 -0400)]
nitweb: add /uml/:namespace route
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>
Alexandre Terrasa [Wed, 20 Apr 2016 06:33:32 +0000 (02:33 -0400)]
lib/template: fix init with signature warning
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>
Alexandre Terrasa [Wed, 20 Apr 2016 06:33:00 +0000 (02:33 -0400)]
lib: fix useless redef signature warnings
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>
Alexandre Terrasa [Wed, 20 Apr 2016 06:32:39 +0000 (02:32 -0400)]
lib: fix more call on nullable receiver warnings
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>
Alexandre Terrasa [Wed, 20 Apr 2016 06:31:59 +0000 (02:31 -0400)]
lib: missing fix documentation warnings
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>
Alexandre Terrasa [Wed, 20 Apr 2016 06:38:38 +0000 (02:38 -0400)]
src/doc: fix useless signature in redef warnings
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>
Alexandre Terrasa [Wed, 20 Apr 2016 06:38:15 +0000 (02:38 -0400)]
src/doc: fix call on nullable receiver warnings
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>
Alexandre Terrasa [Wed, 20 Apr 2016 06:37:33 +0000 (02:37 -0400)]
examples/mnit_ballz: fix call on nullable receiver warnings
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>
Alexandre Terrasa [Wed, 20 Apr 2016 06:37:09 +0000 (02:37 -0400)]
contrib: fix call on nullable receiver warnings
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>
Alexandre Terrasa [Wed, 20 Apr 2016 06:36:31 +0000 (02:36 -0400)]
contrib: fix useless signature in redef warning
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>
Alexandre Terrasa [Wed, 20 Apr 2016 22:40:33 +0000 (18:40 -0400)]
contrib/inkscape_tools: fix weird parenthesis
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>
Jean Privat [Wed, 20 Apr 2016 17:22:02 +0000 (13:22 -0400)]
Merge: nitcorn: fix path resolution for vararg routes
Routes with parameters like `/blog/articles/:articleId` where not matched correctly.
It worked until today and I'm not really sure how? Anyway, this PR resolve the route with request parameters before performing the match.
Also done some cleaning in warnings and doc.
Pull-Request: #2023
Reviewed-by: Alexis Laferrière <alexis.laf@xymus.net>
Jean Privat [Wed, 20 Apr 2016 17:22:01 +0000 (13:22 -0400)]
Merge: lib/core: fix `Text::is_int`
Fix #2019, `is_int` was always returning true. It was caused by the use of the wrong local variable.
Ping @R4PaSs and @Freddrickk.
Pull-Request: #2022
Reviewed-by: Frédéric Vachon <fredvac@gmail.com>
Reviewed-by: Jean Privat <jean@pryen.org>
Reviewed-by: Lucas Bajolet <r4pass@hotmail.com>
Reviewed-by: Alexandre Terrasa <alexandre@moz-code.org>
Jean Privat [Wed, 20 Apr 2016 17:21:58 +0000 (13:21 -0400)]
Merge: iOS and text: fix UTF-8 support on iOS and improve doc on FFI related text services
This PR fix the support for UTF-8 on iOS by simply updating the encoding and use the correct number of bytes. This does not completely resolve #1945 as the error messages are still present and I suspect that the UTF-8 cleaning does not work, however I'll update the issue (or open a different one) to reflect that.
Intro the service `to_s_with_copy_and_length` which complements `to_s_with_copy` and `to_s_with_length` . The name is a mouthful, but using optional parameters was not desirable since this service will often be used from a foreign language.
Also improves the doc of the existing services to get a Nit `String` from a `NativeString`. The new doc is more detailed and oriented towards users of the FFI by putting emphasis on where the raw data resides and wether it is cleaned or not.
Also note the removal of return type declarations in method refinements which was not consistent with the introduction.
Pull-Request: #2021
Reviewed-by: Lucas Bajolet <r4pass@hotmail.com>
Reviewed-by: Jean Privat <jean@pryen.org>
Reviewed-by: Alexandre Terrasa <alexandre@moz-code.org>
Jean Privat [Wed, 20 Apr 2016 17:21:55 +0000 (13:21 -0400)]
Merge: Interpreter FFI: fix running the interpreter FFI in the interpreter
Let's start with a bit of context, the interpreter supports only the light FFI, a subset of the full FFI supported by the compiler. The interpreter uses an heuristic to guess which extern methods are supported. The problem of #2018, was in this heuristic. The heuristic states that if a parameter of an extern method is a standard Nit class and not an universal or an extern class, then that method probably uses the full FFI. However, sometimes this is false, like in the interpreter where instances of Nit standard classes are stored as pointer in the C code, still without using the full FFI.
To fix #2018, this PR intro a new annotation `light_ffi` to be used on extern methods wrongly detected as full FFI. It bypasses the heuristic and force the interpreter to compile and run the method. (or it tries to) This annotation should not be used otherwise, the heuristic is pretty good at detecting when a method is supported or not.
Pull-Request: #2020
Reviewed-by: Romain Chanoir <romain.chanoir@viacesi.fr>
Reviewed-by: Jean Privat <jean@pryen.org>
Jean Privat [Wed, 20 Apr 2016 17:20:33 +0000 (13:20 -0400)]
lib/core/bytes: add `Int::to_bytes` and `Bytes::to_i`
Signed-off-by: Jean Privat <jean@pryen.org>
Alexis Laferrière [Mon, 18 Apr 2016 17:48:14 +0000 (13:48 -0400)]
tests: add test for the interpreter interpreting the interpreter with its FFI
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Wed, 20 Apr 2016 11:34:29 +0000 (07:34 -0400)]
lib/opts: report invalid integer passed to an OptionInt
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexandre Terrasa [Wed, 20 Apr 2016 06:35:06 +0000 (02:35 -0400)]
contrib/inkscape_tools: fix noinit in redef warning
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>
Alexandre Terrasa [Fri, 18 Dec 2015 05:18:12 +0000 (00:18 -0500)]
uml: fix not escaped names
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>
Alexandre Terrasa [Wed, 20 Apr 2016 04:54:35 +0000 (00:54 -0400)]
vararg_routes: improve module documentation
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>
Alexandre Terrasa [Wed, 20 Apr 2016 04:54:04 +0000 (00:54 -0400)]
nitcorn: remove warnings from reactor.nit
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>
Alexandre Terrasa [Wed, 20 Apr 2016 04:53:47 +0000 (00:53 -0400)]
nitcorn: fix path resolution for vararg routes
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>
Alexis Laferrière [Tue, 19 Apr 2016 17:44:06 +0000 (13:44 -0400)]
lib/core: fix `Text::is_int`
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Fri, 15 Apr 2016 21:33:50 +0000 (17:33 -0400)]
lib/cocoa: reading text from NSData should copy it to Nit memory
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Fri, 15 Apr 2016 21:06:24 +0000 (17:06 -0400)]
lib/cocoa: fix to_nsstring to use UTF-8 encoding
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Mon, 18 Apr 2016 19:01:32 +0000 (15:01 -0400)]
lib/core: remove duplicates and improve doc of `NativeString` related services
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Fri, 15 Apr 2016 22:01:35 +0000 (18:01 -0400)]
lib/core: intro to_s_with_copy_and_length
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Mon, 18 Apr 2016 17:23:36 +0000 (13:23 -0400)]
interpreter: use light_ffi to force support for the `instance` extern methods
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Mon, 18 Apr 2016 17:23:01 +0000 (13:23 -0400)]
interpreter: the annotation light_ffi identifies a method as light FFI only
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Jean Privat [Mon, 18 Apr 2016 12:51:54 +0000 (08:51 -0400)]
Merge: Split catalog into a lib and a program
As requested by @Morriar, the nitcatalog tool is now splited into a lib and a program.
Pull-Request: #2017
Reviewed-by: Alexandre Terrasa <alexandre@moz-code.org>
Jean Privat [Mon, 18 Apr 2016 12:51:53 +0000 (08:51 -0400)]
Merge: iOS: support apps with multiple windows, and a better ListLayout
Support multiple windows on iOS by using a UINavigationController as the root controller which shows the navigation bar at the top of the screen. The navigation bar shows the "Back" button automatically when switching windows. It has room for a title, which can be set manually. This is not ideal as pure portable apps don't define a title leaving the bar mostly empty. This could be fixed either by always asking for a title or by using the app names a default title.
Rewrite the implementation of the ListLayout using a UIStackView in a UIScrollView. This implementation is easier to adapt to different content, and it much more simple than the previous one which used a UITableView. The table view implementation has been kept as a different iOS specific control, but it may be removed in the future.
Pull-Request: #2016
Reviewed-by: Jean Privat <jean@pryen.org>
Jean Privat [Mon, 18 Apr 2016 12:51:51 +0000 (08:51 -0400)]
Merge: app.nit services to set the size and alignment of labels
Intro services to customize the size and alignment of text views. Only labels are supported on all platforms but Android also supports customizing text buttons. The behaviour on each platform varies a bit according to the available features. The goal is always to have the behaviour that is more natural on the platform instead of having the same exact look on each platform. Sticking to the recommended values should produce more consistent results, but using other values can create interesting effects.
For example, on Android and Linux, the text size is locked to a small/medium/large, but on iOS the size can be set to any variations relative to the default font size. On all platforms, 0.5 should result in a small font, 1.0 the default/medium size and 1.5 the large size. On iOS, other values will result in different text sizes.
I've used the same logic as `Text::justify` to set the alignment with a single float parameter.
Pull-Request: #2015
Reviewed-by: Alexandre Terrasa <alexandre@moz-code.org>
Reviewed-by: Jean Privat <jean@pryen.org>
Jean Privat [Mon, 18 Apr 2016 00:53:14 +0000 (20:53 -0400)]
nitcatalog: add a new class Person
Signed-off-by: Jean Privat <jean@pryen.org>
Jean Privat [Sun, 17 Apr 2016 01:49:14 +0000 (21:49 -0400)]
nitc: split nitcatalog into a lib and a program
Signed-off-by: Jean Privat <jean@pryen.org>
Alexis Laferrière [Sat, 2 Apr 2016 21:54:44 +0000 (17:54 -0400)]
lib/ios: implement `Label::size= & align=`
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Mon, 14 Mar 2016 20:53:06 +0000 (16:53 -0400)]
lib/ios: support multiple windows using a UINavigationController
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>