Skip to content

Commit

Permalink
Update README
Browse files Browse the repository at this point in the history
Signed-off-by: xaxys <tpnnghd@163.com>
  • Loading branch information
xaxys committed Oct 17, 2024
1 parent 226c7c5 commit 9728ec5
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
11 changes: 8 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ Run `bubbler` to see the list of supported target languages.
```text
Targets:
c
commonjs
csharp [cs]
commonjs [cjs]
java
python [py]
Expand All @@ -63,6 +64,9 @@ When selecting the target language, you can use the aliases inside `[]`. For exa
- With `-single`: Output one file that includes all definitions for all `.bb` files. The output file name (including the extension) is determined by the `-o` option.
- With `-minimal`: No generation of getter/setter methods for fields.

- `csharp`: C# language, output one `.cs` file for each structure defined in each `.bb` file.
- With `-single`: Output one file that includes all definitions for all `.bb` files. The output file name (including the extension) is determined by the `-o` option.

- `commonjs`: CommonJS module, output one `.bb.js` file for each `.bb` file. (Please note that `BigInt` is used for `int64` and `uint64` fields, which is not supported in some environments.)
- With `-single`: Output one file that includes all definitions for all `.bb` files. The output file name (including the extension) is determined by the `-o` option.

Expand Down Expand Up @@ -97,6 +101,7 @@ Use the `option` keyword to define options. For example:
option omit_empty = true;
option go_package = "example.com/rovlink";
option cpp_namespace = "com::example::rovlink";
option csharp_namespace = "Example.Rovlink";
```

The option statement cannot be duplicated in a `.bb` file.
Expand Down Expand Up @@ -138,11 +143,11 @@ If `cpp_namespace` is set, the generated code will use the specified namespace i

##### `csharp_namespace`

If `csharp_namespace` is set, the generated code will use the specified namespace in the generated C# code.
If `csharp_namespace` is set, the generated code will use the specified namespace in the generated C# code. The folder structure will not be affected.

##### `java_package`

If `java_package` is set, the generated code will use the specified package name in the generated Java code.
If `java_package` is set, the generated code will use the specified package name in the generated Java code. The generated folder structure will be based on the package name.

### Import Statements

Expand Down
11 changes: 8 additions & 3 deletions README_cn.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ bubbler -t py -decnum -signext=arith -o output example.bb
```text
Targets:
c
commonjs
csharp [cs]
commonjs [cjs]
java
python [py]
Expand All @@ -63,6 +64,9 @@ Targets:
- 使用 `-single`:输出单个文件,其中包含所有 `.bb` 文件的所有定义。输出文件名(包括扩展名)由`-o`选项确定。
- 使用 `-minimal`:不为字段生成默认的getter/setter方法函数。

- `csharp`:C# 语言,为每个 `.bb` 文件输出一个 `.bb.cs` 文件。
- 使用 `-single`:输出单个文件,其中包含所有 `.bb` 文件的所有定义。输出文件名(包括扩展名)由 `-o` 选项确定。

- `commonjs`:CommonJS模块,为每个 `.bb` 文件输出一个 `.bb.js` 文件。(请注意,`int64``uint64` 字段使用了 `BigInt`,在某些环境中可能不支持)
- 使用 `-single`:输出单个文件,其中包含所有 `.bb` 文件的所有定义。输出文件名(包括扩展名)由 `-o` 选项确定。

Expand Down Expand Up @@ -99,6 +103,7 @@ package com.example.rovlink;
option omit_empty = true;
option go_package = "example.com/rovlink";
option cpp_namespace = "com::example::rovlink";
option csharp_namespace = "Example.Rovlink";
```

`.bb` 文件中,选项语句不能重复。
Expand Down Expand Up @@ -140,11 +145,11 @@ import "sensor.bb";

##### `csharp_namespace`

如果设置了 `csharp_namespace`,生成的代码将在生成的 C# 代码中使用指定的命名空间。
如果设置了 `csharp_namespace`,生成的代码将在生成的 C# 代码中使用指定的命名空间,但是文件夹结构不会受到影响

##### `java_package`

如果设置了 `java_package`,生成的代码将在生成的 Java 代码中使用指定的包名。
如果设置了 `java_package`,生成的代码将在生成的 Java 代码中使用指定的包名,并且生成的文件夹结构将会根据该包名生成

### 导入语句

Expand Down

0 comments on commit 9728ec5

Please sign in to comment.