Skip to content

Releases: xaxys/bubbler

v0.7.1

17 Oct 13:15
Compare
Choose a tag to compare

Ban different method (return / param) type of same method

From 0.7.1 on, getter and setter methods with the same name must return and accept the same type.
Because we are using property feature in C# to generate code like this:

// CustomGetterSetter: TemperaturePercent
public double TemperaturePercent
{
    get => ((this.temperature / 10) - 40);
    set => this.temperature = (ushort)((value == 0) ? 0 : ((value + 40) * 10));
}

If we allow users define method like this, then we are not able to use property any more.

struct RovSensorCabTempHumidPressData2 {
    uint16 temperature[2] {
        get temperature_percent(float64): value / 10 - 40;
        set temperature_percent(int32): (uint16)(value == 0 ? 0 : (value + 40) * 10);
    };
}

Bugfix

  • Fix getter & setter format, remove redundant empty line for C# target.
  • Fix wrong order in the error info while method name conflicting with field name.

Changelog

  • f3ef12b Ban different method type of same method. Fix C# getter setter format. Fix error info

v0.7.0

17 Oct 10:35
Compare
Choose a tag to compare

C# Language Target is Supported!

Now you can use csharp as language target, like this:

bubbler -t csharp -o /path/to/mydir/ ./example.bb
C# target support -single option to combine all structure into one .cs file.
C# target support -signext=shift option and default to it as sign-bit extension method.
C# target has its special option csharp_namespace. If it is set, the generated code will use the specified namespace in the generated C# code. But please note that the folder structure WILL NOT be affected, which is different from Java target.

Changelog

v0.6.0

12 Jun 05:50
Compare
Choose a tag to compare

CommonJS Language Target is Supported!

Now you can use commonjs as language target, like this:

bubbler -t commonjs -o /path/to/mydir/ ./example.bb

CommonJS target also support -single option to combine all structure into one js file.

Please note that generated structure accept Number for basic type below 32-bit, but only accept BigInt for 64-bit type (uint64, int64)

Changelog

  • 0fd42c6 Add commonjs language support
  • 8e83504 Remove redundant template data
  • 33743c5 Fix format for Java

v0.5.2

06 Jun 13:19
Compare
Choose a tag to compare

Changelog

  • d6e06cf Fix enum decode in Java
  • dd2e221 Suppress "RedundantIfStatement" warning for Java

v0.5.1

06 Jun 12:29
Compare
Choose a tag to compare

Override equals() and hashCode() in Java

Changelog

  • 07b42d9 Override equals() and hashCode() in Java
  • 645412e Update README

v0.5.0

06 Jun 05:23
Compare
Choose a tag to compare

Java Language Target is Supported!

Now you can use java as language target, like this:

bubbler -t java -o /path/to/mydir/ ./example.bb

Remember, you can use java_package option in .bb file to rename generated package.

option java_package = "com.example.myproject.mypackage";

Changelog

  • 385fd00 Add java language support
  • 87338f6 Fix field namestyle in expr gen & Fix literal gen in const field
  • 849cbd5 Fix identation format

Snapshot v0.4.0-9b7df46-dev

09 May 08:25
Compare
Choose a tag to compare
Pre-release
Update option usage

Signed-off-by: xaxys <tpnnghd@163.com>

v0.4.0

04 May 18:14
Compare
Choose a tag to compare

Struct As Array Element is Supported!

Now you can embed a struct into a array, like this:

struct TestStructArrayElement {
  int32 a[2];
}

struct TestStructArray {
  TestStructArrayElement<10> a;
  TestStructArrayElement<10> b [order = "big"];
}

Huge Refactor of Generator!

Use text/template as template engine for easier support of new target language.

Refactor lots of definition for a clearer structure.

-minimal & -single generate option are separated from target now, with more generate option added!

Options

  • -t <target>: Target language
  • -o <output>: Output Path
  • -inner: Generate Inner Class (Nested Struct)
  • -single: Generate Single File (Combine all definitions into one file, instead of one generated file per source file)
  • -minimal: Generate Minimal Code (Usually without default getter/setter methods)
  • -decnum: Force Generate Decimal Format for Constant Value (Translate 0xFF to 255, 0b1111 to 15, etc.)
  • -signext: Sign Extension Method used for Integer Field (Options: shift, arith)

Syntax Changes

Method name is no more allowed to be duplicate with another method or field in same struct.

Method name sytle camelCase is not recommended any more. Use snake_case instead.

Changelog

  • 43155e9 Refactor code generator. Update README & examples
  • 2f91179 Fix c_single generator standard name
  • be2adcf Fix python enum initial value

v0.3.0

06 Dec 02:51
Compare
Choose a tag to compare
v0.3.0 Pre-release
Pre-release

Package Statements are Useful Now!

Use the package keyword to define the package name. For example:

package com.example.rovlink;

The package name is used to generate the output file name. For example, if the package name is com.example.rovlink, the output file name is rovlink.xxx and is placed in the ${Output Path}/com/example/ directory.

Only one package statement is allowed in a .bb file, and it can not be duplicated globally.

More Target Languages Added!

Python fully SUPPORTED! Multiple-file generation SUPPORTED!

Targets:
  dump
  c
  c-single [c_single]
  c_minimal [c-minimal, c_min, c-min]
  c_minimal_single [c-minimal-single, c_min_single, c-min-single]
  python [py]
  python_single [python-single, py-single, py_single]

When selecting the target language, you can use the aliases inside []. For example, c_minimal can be abbreviated as c-min, c_min, or c_minimal.

  • dump: Output the parse tree (intermediate representation) of the .bb file.
  • c: C language, output one .bb.h file and one .bb.c file for each .bb file.
  • c-single: C language, output one file that includes all definitions for all .bb files. The output file name (including the extension) is determined by the -o option.
  • c_minimal: C language, output one .bb.h file and one .bb.c file for each .bb file. Do not generate getter/setter methods for fields.
  • c_minimal_single: C language, output one file that includes all definitions for all .bb files. The output file name (including the extension) is determined by the -o option. Do not generate getter/setter methods for fields.
  • python: Python language, output one _bb.py file for each .bb file.
  • python-single: Python language, output one file that includes all definitions for all .bb files. The output file name (including the extension) is determined by the -o option.

Snapshot v0.2.0-c7af254-dev

06 Dec 02:17
Compare
Choose a tag to compare
Pre-release
Multiple file generation support for python

Signed-off-by: xaxys <tpnnghd@163.com>