Releases: xaxys/bubbler
v0.7.1
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
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
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
v0.5.2
v0.5.1
v0.5.0
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
Snapshot v0.4.0-9b7df46-dev
Update option usage Signed-off-by: xaxys <[email protected]>
v0.4.0
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 (Translate0xFF
to255
,0b1111
to15
, 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
v0.3.0
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
Multiple file generation support for python Signed-off-by: xaxys <[email protected]>