Permalink
Commits on Sep 18, 2017
  1. Merge: core: intro BytesWriter and BytesReader

    privat committed Sep 18, 2017
    Intro the classes `BytesReader` and `BytesWriter` to support byte read/writer operations directly on `Bytes` in memory.
    
    The new classes are now super classes to `StringReader` (converting the `String` source to `Bytes` in the constructor) and `StringWriter`(cleaning the UTF-8 string in `to_s` only). The only differences between the string and bytes streams are the behavior of `StringWriter::to_s` and the `String` parameter expected by the constructor of `StringReader`.
    
    `BytesWriter` supports writing any bytes, including composing UTF-8 characters byte by byte, a behavior also useful for `StringWriter`:
    ~~~
    var writer = new BytesWriter
    
    # Write just the character first half
    writer.write_byte 0xC2u8
    assert writer.to_s == "\\xC2"
    assert writer.bytes.to_s == "�"
    
    # Complete the character
    writer.write_byte 0xA2u8
    assert writer.to_s == "\\xC2\\xA2"
    assert writer.bytes.to_s == "¢"
    ~~~
    
    `BytesReader` also supports reading any bytes, including the bytes composing an UTF-8 character for `StringReader`:
    
    ~~~
    var reader = new BytesReader(b"a…b")
    assert reader.read_char == 'a'
    assert reader.read_byte == 0xE2u8 # 1st byte of '…'
    assert reader.read_byte == 0x80u8 # 2nd byte of '…'
    assert reader.read_char == '�' # Reads the last byte as an invalid char
    assert reader.read_all_bytes == b"b"
    ~~~
    
    Pull-Request: #2539
    Reviewed-by: Jean Privat <jean@pryen.org>
    Reviewed-by: Lucas Bajolet <r4pass@hotmail.com>
  2. Merge: app.nit: easier root window selection and other misc improvements

    privat committed Sep 18, 2017
    Intro the hook `root_window` for clients to set the desired root (or home) window. It is much shorter than the previous redef of `on_create`. Plus, in very simple apps, the client can simple redef `Window` instead of subclassing it.
    
    Refactor `data_store` structure, replacing the interface and subclasses by refinements of a single class. It follows more closely the strategy used by the UI API while not changing anything to the `data_store` API. The data store now drops potentially partially deserialized objects to avoid hard to report crash at runtime, this could be improved upon in the future as the current implementation is not ideal.
    
    Otherwise, this PR brings general improvements to the framework influenced by the creation of [paninit.com](http://paninit.com/): revamp the documentation, add unit tests, fix the scientific calculator icon and add an option to report errors in `hightlightcode`.
    
    Pull-Request: #2547
    Reviewed-by: Jean Privat <jean@pryen.org>
Commits on Sep 15, 2017
  1. core: Bytes have a minimum capacity of 16 bytes

    xymus committed Sep 8, 2017
    Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
  2. core: optimize Bytes::append_text using redefs in Text subclasses

    xymus committed Sep 8, 2017
    Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
  3. core: protect access to _items in empty strings

    xymus committed Sep 7, 2017
    Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Commits on Sep 8, 2017
  1. calculator: don't use fonts in the icon source

    xymus committed Sep 7, 2017
    Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
  2. app: add code example to data_store, http_request and ui

    xymus committed Sep 7, 2017
    Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
  3. app: report errors in DataStore and fix a warning

    xymus committed Sep 6, 2017
    Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
  4. app: make DataStore a class and refine on each platform

    xymus committed Sep 6, 2017
    Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
  5. app: tweak UI API doc

    xymus committed Sep 6, 2017
    Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
  6. app: update clients to use `root_window`

    xymus committed Sep 6, 2017
    Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
  7. app: intro `root_window` to select the first visible window

    xymus committed Sep 6, 2017
    Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
  8. stream: intro `BytesWriter` and `BytesReader`

    xymus committed Jul 25, 2017
    Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Commits on Sep 7, 2017
  1. app: update UI example language and android style

    xymus committed Sep 4, 2017
    Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
  2. highlight: optionally print errors when highlighting

    xymus committed Sep 7, 2017
    Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
  3. Merge: Nitmetric fixes

    privat committed Sep 7, 2017
    Avoid some nitmetric crashes
    
    Pull-Request: #2533
  4. Merge: Nitweb: boost response time and some improvements

    privat committed Sep 7, 2017
    The main objective of this PR is to shorten the frontend response time.
    The major culprit was that the full documentation was serialized in each response.
    This PR makes nitweb return only the synopsis and lets the frontend ask for the full documentation if needed.
    
    Also uniformizes and cleans tabs for entities:
    * Moved data between tabs (such as inheritance data to the inheritance tab)
    * Added missing tabs for packages and groups (http://nitweb.moz-code.org/doc/core%3Ecollection%3E/defs)
    
    Demo: http://nitweb.moz-code.org/
    
    Pull-Request: #2536
    Reviewed-by: Jean Privat <jean@pryen.org>
  5. Merge: json: move up general services, support Byte and more

    privat committed Sep 7, 2017
    This PR is a general clean up of the `json` package to prepare the support of two new serialization engines, add small new features and fix some issues in code. It should not change its behavior for existing clients.
    
    * Move up some general deserialization services from `json` to `serialization` in order to make them available to other engines. This includes the class name manipulation services and safety services controlling which types are deserialized, including `class_inheritance_metamodel`.
    
    * Support writing and reading `Byte` as either a plain JSON string or a special object with metadata.
    
    * Support reading `Char` and `Byte` from plain JSON input using simple heuristics.
    
    * Test the deserialization of plain generated JSON and fix a typo in the tests.
    
    * Fix other minor issues in code.
    
    Pull-Request: #2538
  6. Merge: gamnit: shadow mapping

    privat committed Sep 7, 2017
    Intro a basic API and the shaders for 3D actors to cast shadows. This feature is off by default, it can be activated by using a sun-like light with: `app.light = new ParallelLight`. This will require additional work to improve the performance, add more kind of lights (point, spotlight, ambient, etc.), support many lights and accept colored lights.
    
    Many values can be tweaked to achieve the best performance tradeoff:
    
    * `ParallelLight` is always centered on the `world_camera` to show shadows only around the player. Its attributes `width, height, depth` are in world coordinates and identify a prism where shadows are computed. Higher values show shadows further away and lower values show shadows in higher resolution.
    * `App::shadow_resolution` sets the resolution of the depth texture. Higher is prettier but slower, there's also an upper limit depending on the hardware configuration. It is now hardcoded (but refinable) to 4096x4096 pixels, with is probably too high for some mobiles devices. More experimentation is needed to find a safe default value.
    * For softer shadow edges, the shader applies a kind of antialiasing by tapping the depth texture many times for each fragment. It is currently hardcoded to 4 taps per fragment but it could be changed for better performances or smoother edges. I don't know where to expose this value in the API, it could be on the light, the material or even global. It can also be optimized by the hardware.
    
    ### Screenshots from Jump 'n' Gun
    
    Looking down at the player's shadow:
    
    ![screenshot from 2017-08-29 10-31-48](https://user-images.githubusercontent.com/208057/29829419-62b27cfa-8cad-11e7-9d95-696e594f4490.png)
    
    Complex shadows from a turret and a shield projector:
    
    ![screenshot from 2017-08-29 10-35-45](https://user-images.githubusercontent.com/208057/29829415-5f08d5c2-8cad-11e7-87ca-5e4566d2432b.png)
    
    Pull-Request: #2543
Commits on Aug 31, 2017
  1. json: fixme interpreter bug in constructors with return (#2546)

    xymus committed Aug 31, 2017
    Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
  2. serialization: move StrictHashMap related services

    xymus committed Jul 27, 2017
    Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
  3. serialization: move up deser. safety services from `json`

    xymus committed Jul 26, 2017
    Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
  4. Merge: nitc: loader skip dot (hidden) directory

    privat committed Aug 31, 2017
    This will improve the loading time when there is a very
    deep .git directory around.
    
    Pull-Request: #2534
  5. Merge: gamnit audio: control sound channels and don't crash if there'…

    privat committed Aug 31, 2017
    …s no sound card
    
    Desktop clients can now control playing sounds with the new services from SDL2 mixer. The equivalent was already implemented for Android but not GNU/Linux. The new services still need to be fully exposed in the `app::audio` API.
    
    This PR also removes the requirement to have a working sound card to launch a gamnit game.
    
    Pull-Request: #2537
    Reviewed-by: Jean Privat <jean@pryen.org>
  6. Merge: json: remove the old nitcc parser

    privat committed Aug 31, 2017
    Improve performances of the `json` package by removing the old nitcc parser to use only the custom string parser. It is faster at runtime and the nitcc parser classes were included with the JSON serialization services, slowing down compilation time even when not used.
    
    The nitcc parser was still used only by a few clients, the only differences for the clients should be the error message, conflicts on the `Location` class, and improved performances.
    
    It may be hard to see in the diff but the only differences in the `json` package are: the removal of the nitcc parser, move the string_parser in `static` (they are highly coupled), and make a few services private.
    
    Note that the JSON nitcc grammar is still available in the nitcc project folder.
    
    Warning: Until there's a service like `full_class_name`, deserializing classes with a name conflict is broken. I don't think that the 2-3 cases in the PR deserialize the generated JSON, so it should be OK for now.
    
    Pull-Request: #2540
  7. Merge: dom: fix two possible out of bounds string accesses

    privat committed Aug 31, 2017
    Pull-Request: #2542
    Reviewed-by: Lucas Bajolet <r4pass@hotmail.com>
  8. Merge: lib/markdown: fix crash of the parser when parsing unfinished …

    privat committed Aug 31, 2017
    …refs
    
    Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>
    
    Pull-Request: #2544
    Reviewed-by: Jean Privat <jean@pryen.org>
  9. Merge: lib/mongodb: fix database_names test

    privat committed Aug 31, 2017
    Pull-Request: #2545
  10. gamnit: don't crash if there is no sound

    xymus committed Jul 29, 2017
    Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
  11. linux::audio: extract `play_channel`

    xymus committed Jul 13, 2017
    Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
  12. sdl2: add more `mixer` services

    xymus committed Jul 12, 2017
    Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
  13. serialization: move up type name manipulation services out of `json`

    xymus committed Jul 26, 2017
    Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
  14. json: test deser. from plain JSON and fix typo

    xymus committed Jul 27, 2017
    Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
  15. gamnit: intro basic shadow mapping

    xymus committed Aug 19, 2017
    Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
  16. tests: udate more tests testing or depending on the JSON parser

    xymus committed Aug 31, 2017
    Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>