Alexandre Terrasa [Fri, 10 Jul 2015 00:05:06 +0000 (20:05 -0400)]
nitj: compile attributes accesses
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>
Alexandre Terrasa [Thu, 9 Jul 2015 23:58:53 +0000 (19:58 -0400)]
nitj: compile intern methods bodies
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>
Alexandre Terrasa [Tue, 14 Jul 2015 05:28:14 +0000 (01:28 -0400)]
typing: also type signature for intern methods
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>
Alexandre Terrasa [Thu, 9 Jul 2015 23:58:12 +0000 (19:58 -0400)]
nitj: compile concrete methods bodies
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>
Alexandre Terrasa [Mon, 6 Jul 2015 16:49:20 +0000 (12:49 -0400)]
nitj: implement instance initialization and ANewExprs
Attributes are not handled in this commit.
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>
Alexandre Terrasa [Mon, 13 Jul 2015 21:08:52 +0000 (17:08 -0400)]
nitj: avoid calls to abstract methods
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>
Alexandre Terrasa [Fri, 10 Jul 2015 05:38:35 +0000 (01:38 -0400)]
nitj: implements AReturnExprs
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>
Alexandre Terrasa [Mon, 6 Jul 2015 16:50:01 +0000 (12:50 -0400)]
nitj: shortcut calls on primitive instances
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>
Alexandre Terrasa [Fri, 17 Jul 2015 18:32:17 +0000 (14:32 -0400)]
nitj: implement static and polymorphic sends
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>
Alexandre Terrasa [Tue, 14 Jul 2015 06:08:08 +0000 (02:08 -0400)]
nitj: implement boxing for Java primitives
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>
Alexandre Terrasa [Fri, 17 Jul 2015 18:23:12 +0000 (14:23 -0400)]
nitj: implement variable declaration
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>
Alexandre Terrasa [Mon, 6 Jul 2015 15:33:04 +0000 (11:33 -0400)]
nitj: compile native instances of Int, Byte, Float, Char and Bool
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>
Alexandre Terrasa [Thu, 9 Jul 2015 23:20:44 +0000 (19:20 -0400)]
nitj: implement `self` accesses
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>
Alexandre Terrasa [Fri, 17 Jul 2015 18:06:57 +0000 (14:06 -0400)]
nitj: implement aborts
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>
Alexandre Terrasa [Thu, 9 Jul 2015 23:20:08 +0000 (19:20 -0400)]
nitj: implement static frame to handle calls
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>
Alexandre Terrasa [Mon, 13 Jul 2015 21:07:32 +0000 (17:07 -0400)]
nitj: prepare node visit of method bodies
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>
Alexandre Terrasa [Wed, 1 Jul 2015 00:02:58 +0000 (20:02 -0400)]
nitj: implement variable handling
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>
Alexandre Terrasa [Thu, 9 Jul 2015 23:55:32 +0000 (19:55 -0400)]
nitj: build naive type tables using Java HashMaps
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>
Alexandre Terrasa [Tue, 30 Jun 2015 19:48:51 +0000 (15:48 -0400)]
nitj: build naive vfts using Java HashMaps
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>
Alexandre Terrasa [Fri, 17 Jul 2015 17:44:32 +0000 (13:44 -0400)]
nitj: generate runtime mmethodef structure stubs
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>
Alexandre Terrasa [Fri, 17 Jul 2015 17:41:05 +0000 (13:41 -0400)]
nitj: generate runtime class structure stubs
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>
Alexandre Terrasa [Fri, 17 Jul 2015 17:37:50 +0000 (13:37 -0400)]
nitj: introduce JavaRuntimeModel used to represent Nit entities in Java runtime
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>
Alexandre Terrasa [Fri, 17 Jul 2015 17:31:48 +0000 (13:31 -0400)]
nitj: introduce JavaCompilerVisitor to generate java code
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>
Alexandre Terrasa [Mon, 20 Jul 2015 17:58:31 +0000 (13:58 -0400)]
nitj: add tests for the nitj engine
Reused tests from `nitg-e`.
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>
Alexandre Terrasa [Fri, 17 Jul 2015 17:16:49 +0000 (13:16 -0400)]
nitj: compile generated Java files using make and Javac
This will be used to compile generated files into an executable jar.
Also introduce a shell script to directly run the generated jar to come like it was a binary.
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>
Alexandre Terrasa [Fri, 17 Jul 2015 17:06:34 +0000 (13:06 -0400)]
nitj: introduce compiler to Java code
This commit only introduce a stub and a way to test it.
Code generation will be added in next commits.
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>
Jean Privat [Tue, 21 Jul 2015 20:42:03 +0000 (16:42 -0400)]
Merge: jwrapper accepts Jar archives
This PR modifies jwrapper to accept Jar archives and fix a bunch of bugs/limitations. This is probably the first of 2 PRs on jwrapper. This one targets the frontend to accept any Java classes (tested on over 25k classes) and to mass produce wrappers. It also ensures that both the generated nit code and jwrapper itself is debuggable.
Although the mass generated Nit code is syntactically valid, more work is needed so it can be usable. We will need to somehow apply Java namespace in generated Nit code, and revamp how new wrappers interact with older/custom wrappers. There is also a few missing features, such as copying the class hierarchy to Nit.
With this PR, jwrapper successfully parses 4 large Jar achives:
* OpenJDK 7 standard library `rt.jar` with 18568 classes.
* OpenJDK 7 tools `tools.jar` with 4144 classes.
* Android lib `android.jar` with 2767 classes.
* SableCC `sablecc-3-beta.3.altgen.
20041114/lib/sablecc.jar` with 495 classes.
Pull-Request: #1578
Reviewed-by: Jean Privat <jean@pryen.org>
Reviewed-by: Lucas Bajolet <r4pass@hotmail.com>
Reviewed-by: Alexandre Terrasa <alexandre@moz-code.org>
Jean Privat [Tue, 21 Jul 2015 20:23:52 +0000 (16:23 -0400)]
friendz: rely on conditional importation in platform
Signed-off-by: Jean Privat <jean@pryen.org>
Jean Privat [Tue, 21 Jul 2015 20:20:16 +0000 (16:20 -0400)]
calculator: rely on conditional importation in the Makefile
Signed-off-by: Jean Privat <jean@pryen.org>
Jean Privat [Tue, 21 Jul 2015 20:19:16 +0000 (16:19 -0400)]
lib/app: provide conditional importation of app extensions
Signed-off-by: Jean Privat <jean@pryen.org>
Jean Privat [Tue, 21 Jul 2015 20:16:52 +0000 (16:16 -0400)]
loader: restore -m with module name (eg -m android)
Signed-off-by: Jean Privat <jean@pryen.org>
Jean Privat [Tue, 21 Jul 2015 19:59:32 +0000 (15:59 -0400)]
modelbuilder: apply conditional_importations on mixins
Signed-off-by: Jean Privat <jean@pryen.org>
Jean Privat [Tue, 21 Jul 2015 18:27:11 +0000 (14:27 -0400)]
tests: add base_module_conditional*
Signed-off-by: Jean Privat <jean@pryen.org>
Jean Privat [Tue, 21 Jul 2015 18:25:19 +0000 (14:25 -0400)]
tests: add outputs for module_0 and module_1
Signed-off-by: Jean Privat <jean@pryen.org>
Jean Privat [Tue, 21 Jul 2015 18:10:09 +0000 (14:10 -0400)]
loader: basic implementation of conditional importations
Signed-off-by: Jean Privat <jean@pryen.org>
Jean Privat [Tue, 21 Jul 2015 18:08:49 +0000 (14:08 -0400)]
model: remove requirement unique_invocation of `MModule::set_imported_mmodules`
Signed-off-by: Jean Privat <jean@pryen.org>
Jean Privat [Tue, 21 Jul 2015 17:45:52 +0000 (13:45 -0400)]
loader: extract the resolution and the loading of module in `import` clauses
Signed-off-by: Jean Privat <jean@pryen.org>
Jean Privat [Tue, 21 Jul 2015 17:40:12 +0000 (13:40 -0400)]
loader: extract `load_module_path` from `get_mmodule_by_name`
Signed-off-by: Jean Privat <jean@pryen.org>
Lucas Bajolet [Fri, 10 Jul 2015 19:44:06 +0000 (15:44 -0400)]
lib/standard: Moved and rewrote [] and []= for RopeBuffer
Signed-off-by: Lucas Bajolet <r4pass@hotmail.com>
Lucas Bajolet [Fri, 10 Jul 2015 19:42:45 +0000 (15:42 -0400)]
lib/standard: Update functions of Flat to use char-oriented semantics
Signed-off-by: Lucas Bajolet <r4pass@hotmail.com>
Jean Privat [Tue, 21 Jul 2015 17:36:40 +0000 (13:36 -0400)]
src: move up `AExpr::as_id` from literal to parser_work
Signed-off-by: Jean Privat <jean@pryen.org>
Alexis Laferrière [Mon, 20 Jul 2015 16:28:03 +0000 (12:28 -0400)]
contrib/jwrapper: add test case and the check rule
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Mon, 20 Jul 2015 12:34:42 +0000 (08:34 -0400)]
contrib/jwrapper: apply dependencies in Makefile
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Mon, 20 Jul 2015 16:48:33 +0000 (12:48 -0400)]
contrib/jwrapper: update gitignore file
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Mon, 20 Jul 2015 12:34:21 +0000 (08:34 -0400)]
contrib/jwrapper main: revamp entry to support Jar and javap files
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Mon, 20 Jul 2015 12:33:59 +0000 (08:33 -0400)]
contrib/jwrapper main: revamp docs
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Sun, 19 Jul 2015 16:12:40 +0000 (12:12 -0400)]
contrib/jwrapper main: revamp options
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Mon, 20 Jul 2015 16:26:29 +0000 (12:26 -0400)]
contrib/jwrapper: generate doc above extern methods
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Mon, 20 Jul 2015 01:20:06 +0000 (21:20 -0400)]
contrib/jwrapper: do not look for existing Nit libs if NIT_DIR is not set
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Mon, 20 Jul 2015 03:34:36 +0000 (23:34 -0400)]
contrib/jwrapper: avoid Nit keywords and mangle generated method names
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Jean Privat [Tue, 21 Jul 2015 13:11:19 +0000 (09:11 -0400)]
lib/std: handle read errors in FileReader
Signed-off-by: Jean Privat <jean@pryen.org>
Jean Privat [Tue, 21 Jul 2015 13:08:14 +0000 (09:08 -0400)]
lib/std: rephrase some file errors
Signed-off-by: Jean Privat <jean@pryen.org>
Jean Privat [Mon, 20 Jul 2015 19:03:52 +0000 (15:03 -0400)]
tests: update sav/nitpick_args1.res because read_all_bytes is now documented
Signed-off-by: Jean Privat <jean@pryen.org>
Jean Privat [Mon, 20 Jul 2015 19:02:07 +0000 (15:02 -0400)]
lib/std: handle `last_error` for FileStat-related services in Path
Signed-off-by: Jean Privat <jean@pryen.org>
Jean Privat [Mon, 20 Jul 2015 18:53:22 +0000 (14:53 -0400)]
lib/std: improve doc of the class `Path`
Signed-off-by: Jean Privat <jean@pryen.org>
Jean Privat [Mon, 20 Jul 2015 18:53:00 +0000 (14:53 -0400)]
lib/std: rewrite `Path::rmdir`, `Path::files` and `Path::delete` to handle errors
Signed-off-by: Jean Privat <jean@pryen.org>
Jean Privat [Mon, 20 Jul 2015 18:51:40 +0000 (14:51 -0400)]
lib/std: add Path::last_error to aggregate errors on path services.
Signed-off-by: Jean Privat <jean@pryen.org>
Alexis Laferrière [Mon, 20 Jul 2015 02:48:40 +0000 (22:48 -0400)]
contrib/jwrapper: refactor `add_identifier`
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Mon, 20 Jul 2015 02:45:55 +0000 (22:45 -0400)]
contrib/jwrapper: use the prefix `Java`
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Mon, 20 Jul 2015 02:45:11 +0000 (22:45 -0400)]
contrib/jwrapper: minor style update in model
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Mon, 20 Jul 2015 02:49:06 +0000 (22:49 -0400)]
contrib/jwrapper: support wildcards with a default bound
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Sun, 19 Jul 2015 20:01:36 +0000 (16:01 -0400)]
contrib/jwrapper: main logic use `JavaModel` and support many files at once
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Sun, 19 Jul 2015 17:24:19 +0000 (13:24 -0400)]
contrib/jwrapper: intro `JavaModel`
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Sun, 19 Jul 2015 17:25:22 +0000 (13:25 -0400)]
contrib/jwrapper: revamp `gen_licence` to be more customizable
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Sun, 19 Jul 2015 16:38:41 +0000 (12:38 -0400)]
contrib/jwrapper: use a MultiHashMap to store methods and their signatures
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Sun, 19 Jul 2015 16:10:49 +0000 (12:10 -0400)]
contrib/jwrapper: separate comment vs stubs in generator logic
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Sun, 19 Jul 2015 16:08:09 +0000 (12:08 -0400)]
contrib/jwrapper: update constructors of `CodeGenerator` and `JavapVisitor`
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Sun, 19 Jul 2015 16:05:16 +0000 (12:05 -0400)]
contrib/jwrapper: remove illegal attribute generation
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Mon, 20 Jul 2015 00:19:28 +0000 (20:19 -0400)]
contrib/jwrapper: fix parameter-less methods right after the constructor
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Mon, 20 Jul 2015 11:12:09 +0000 (07:12 -0400)]
contrib/jwrapper grammar: fix generic types parameters with bounds
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Mon, 20 Jul 2015 11:11:48 +0000 (07:11 -0400)]
contrib/jwrapper grammar: accept generic constructors
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Mon, 20 Jul 2015 11:11:24 +0000 (07:11 -0400)]
contrib/jwrapper grammar: eat the strictfp keyword
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Mon, 20 Jul 2015 05:08:33 +0000 (01:08 -0400)]
contrib/jwrapper grammar: accept `-` in Java identifier, it can be used internally
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Mon, 20 Jul 2015 05:07:48 +0000 (01:07 -0400)]
contrib/jwrapper grammar: accept classes compiled from any file name
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Mon, 20 Jul 2015 05:07:16 +0000 (01:07 -0400)]
contrib/jwrapper grammar: fix parsing many files at once
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Mon, 20 Jul 2015 01:17:16 +0000 (21:17 -0400)]
contrib/jwrapper grammar: fix `implements` and `extends` behavior
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Mon, 20 Jul 2015 01:16:45 +0000 (21:16 -0400)]
contrib/jwrapper grammar: accept wildcards in generic parameters
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Mon, 20 Jul 2015 00:17:35 +0000 (20:17 -0400)]
contrib/jwrapper grammar: style clean up
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Mon, 20 Jul 2015 04:17:57 +0000 (00:17 -0400)]
lib/performance_analysis: keep the sum execution time
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Mon, 20 Jul 2015 04:17:31 +0000 (00:17 -0400)]
lib/performance_analysis: fix `PerfMap::to_s`
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Sun, 19 Jul 2015 19:51:59 +0000 (15:51 -0400)]
lib/opts: improve doc of `OptionEnum`
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Jean Privat [Mon, 20 Jul 2015 13:34:10 +0000 (09:34 -0400)]
Merge: Basic UDP socket
This PR intro `UDPSocket` and cleans up a bit of the native layer of socket to avoid using callbacks when possible.
`UDPSocket` support sending messages to remote sockets without a connection and more importantly receive message from any sender. However, as of yet it does not support connections or the stream API of Nit.
Some TODO with the sockets:
* Stop using `gethostbyname` :neutral_face:
* Decide on one or many APIs. The native layer has an API closed to the C API and to what is available in other languages, maybe it can be clean up further and exposed as is.
---
Please ignore the first 2 commits from #1573.
Pull-Request: #1574
Reviewed-by: Jean Privat <jean@pryen.org>
Jean Privat [Mon, 20 Jul 2015 13:34:04 +0000 (09:34 -0400)]
Merge: Faster write
Allow FlatString to be directly written to files without useless copy (`to_cstring`) or useless iterator (`substrings`)
Numbers, for `nitc nitc.nit`:
* before 5.796
* after 5.440 (-6%)
Close one check-box of #1298
Pull-Request: #1572
Reviewed-by: Lucas Bajolet <r4pass@hotmail.com>
Jean Privat [Mon, 20 Jul 2015 13:33:45 +0000 (09:33 -0400)]
Merge: Apply optional params in strip_extension, basename and join
Using optional parameters, the methods `strip_extension`, `basename` and `join` have a default behavior that fit most usage.
* `Collection::join` appends all elements of the collection by default, the same as `join("")`. This is the old behavior of `Collection::to_s`.
* `String::strip_extension` removes the rightmost extension by default, the same as `s.strip_extension("." + s.file_extension)`.
* `String::basename` does not strip the extension by default.
I haven't updated any users of `strip_extension` because the default behavior requires more work. Thus changing the already existing calls to something else would slow down the programs by a very small margin.
Pull-Request: #1575
Reviewed-by: Lucas Bajolet <r4pass@hotmail.com>
Reviewed-by: Jean Privat <jean@pryen.org>
Alexis Laferrière [Sat, 18 Jul 2015 13:43:53 +0000 (09:43 -0400)]
src & lib: use the default behavior of `basename` where applicable
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Fri, 17 Jul 2015 14:09:59 +0000 (10:09 -0400)]
lib/standard: revamp doc of `Map::join`
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Fri, 17 Jul 2015 14:01:23 +0000 (10:01 -0400)]
contrib & examples..: update users of `join("")`
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Fri, 17 Jul 2015 13:29:12 +0000 (09:29 -0400)]
lib/standard: the single parameter of `String::basename` is optional
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Jean Privat [Sat, 18 Jul 2015 01:42:35 +0000 (21:42 -0400)]
Merge: Protected setters
Setters of attributes are private by default. This cause some issue as they are exposed as initializers but still invisible in client modules.
The proposed solution to resolve this inconsistency is to make setters protected by default so they are visible in client modules but only usable in subclasses.
This is a change is the spec, to RFC label is set is people have comments on the sanity/usability/kiss/pola/etc.
Close #1552
Pull-Request: #1567
Reviewed-by: Lucas Bajolet <r4pass@hotmail.com>
Reviewed-by: Romain Chanoir <chanoir.romain@courrier.uqam.ca>
Jean Privat [Sat, 18 Jul 2015 01:41:54 +0000 (21:41 -0400)]
Merge: Fix autosuperinit
Rules are that a named constructor is expected to call super or the autosuperinit in order to be sanely attached to the inheritance hierarchy. If no such a call exists, an implicit call is injected (thus the name auto-super-init) or an error is displayed.
For some historical reasons, the rule was only enforced when a class inherits a concrete or a abstract class. But this restriction is buggy with the last spec of autoinit constructors.
The main change in src/ is just to remove the test the skip the work.
All other changes in the code are to enforce the rule (not that much); basically this means calling init with parameters instead of assigning attributes.
The remaining changes is to update the sav files because missing autosuperinit are now correctly injected.
Close #1550
Pull-Request: #1566
Reviewed-by: Lucas Bajolet <r4pass@hotmail.com>
Reviewed-by: Romain Chanoir <chanoir.romain@courrier.uqam.ca>
Jean Privat [Fri, 17 Jul 2015 21:03:25 +0000 (17:03 -0400)]
Merge: lib/noise: compatibility with 32 bits arch and noisier
This PR enables using noise maps in multiplayer multiplatform games.
The integers are limited to 30 bits in length to be compatible with 32 bits architectures with 2 bits for tagging. Forcing this limit allows to get the same results from the same seed on a 32 and 64 bits computers.
The random angle generation is better than previously, the repeated checker pattern is no more. However there is still a visible patterns on the main axes. Further work is need to fix it.
Pull-Request: #1576
Reviewed-by: Lucas Bajolet <r4pass@hotmail.com>
Reviewed-by: Jean Privat <jean@pryen.org>
Jean Privat [Fri, 17 Jul 2015 21:03:18 +0000 (17:03 -0400)]
Merge: Rename Container to Ref
The `Container` class is widely misunderstood and underused. However it can be very useful to implement a return parameter. This PR rename the class according to this usage. It will make some signatures easier to understand: (example inspired by a similar function from `UDPSocket`)
~~~nit
# This method has 3 outputs:
# * The received message written into `buffer`.
# * The number of bytes written as the return value.
# * The information on the sender of the message is stored in `sender_info`.
fun recv_from(buffer: NativeString, sender_info: Ref[nullable SocketAddress]): Int
~~~
### Bonus Ref tip!
`Ref` can also be used as a hackish equivalent to a `static` variable in C. This example use the dreaded `once` keyword to easily get a singleton, but it could be done cleaner with an attribute in `Sys`.
~~~nit
fun foo
...
# Count the number of times foo is executed
var counter = once new Ref[Int](0)
counter.item += 1
print "foo has been executed {counter.item} times"
end
~~~
Pull-Request: #1573
Reviewed-by: Lucas Bajolet <r4pass@hotmail.com>
Reviewed-by: Alexandre Terrasa <alexandre@moz-code.org>
Reviewed-by: Jean Privat <jean@pryen.org>
Jean Privat [Fri, 17 Jul 2015 21:03:12 +0000 (17:03 -0400)]
Merge: Separate code compilation for autobox
`autobox` (and and its cousin `autobox_extern`) where using RTA information when generating code in order to avoiding to use a C symbol (like a table identifier) that will not be defined in the final compiled program.
The problem is that the approach is incompatible with separate compilation principle where the generated code is independent or the program (thus independent of the liveness of the types of a given program).
The solution is to use symbols in the separate compilation, even for potential (or known) dead classes, and let the global phase define these symbols with invalid information.
Pull-Request: #1570
Reviewed-by: Alexis Laferrière <alexis.laf@xymus.net>
Reviewed-by: Alexandre Terrasa <alexandre@moz-code.org>
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>
Jean Privat [Fri, 17 Jul 2015 20:31:37 +0000 (16:31 -0400)]
niti: update intern implementation of `io_write`.
Signed-off-by: Jean Privat <jean@pryen.org>
Alexis Laferrière [Mon, 13 Jul 2015 16:01:17 +0000 (12:01 -0400)]
lib/noise: fix generation of generated pseudo-random angles
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Wed, 8 Jul 2015 19:50:19 +0000 (15:50 -0400)]
lib/noise: make compatible with 32 bit archs and a bit more random
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Thu, 2 Jul 2015 04:57:04 +0000 (00:57 -0400)]
lib/noise: fix the expected amplitude of the pseudo random value to be in [-1.0 .. 1.0]
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Fri, 17 Jul 2015 13:29:02 +0000 (09:29 -0400)]
lib/standard: the single parameter of `String::strip_extension` is optional
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Sat, 11 Jul 2015 17:25:22 +0000 (13:25 -0400)]
lib/standard: the single parameter of `Collection::join` is optional
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>