nv-cli-make-simple-pod
v1.0.1
Published
nv-cli-make-simple-pod ========== - cli tool - generate a c-struct from a json-config - auto fill explicit padding
Downloads
104
Readme
nv-cli-make-simple-pod
cli tool
generate a c-struct from a json-config
auto fill explicit padding
only support pod
not support bit-field
install
- npm install nv-cli-make-simple-pod -g
usage
Usage: nv_cli_make_simple_pod [options]
Options:
-n, --name struct name : default MyPod
-i, --input input string ,default stdin
-o, --output output string,default stdout
-l, --list_supported_leaf_types list supported leaf type names
-h, --help usageexample
#nv_cli_make_simple_pod -i
{
a :"int", //4 +4
"b[3][2]":"double", //8 +48
"c[2]" : { //56 +24
x: "char*",
"y[10]": "char"
},
e : {},
"f[0]" : "int",
"g" : "std::vector<int>" ,
"h" : "int32_t"
}
struct MyPod {
int a; /*{offset:0 , sizeof:4, alignof:4} */
uint8_t ___pad_aft_a[4];
double b[3][2]; /*{offset:8 , sizeof:48, alignof:8} */
struct {
char* x; /*{offset:0 , sizeof:8, alignof:8} */
char y[10]; /*{offset:8 , sizeof:10, alignof:1} */
uint8_t ___pad_aft_y[6];
} c[2]; /*{offset:56 , sizeof:24, alignof:8} */
[[no_unique_address]] struct {} e; /*{offset:80 , sizeof:0, alignof:1} */
int f[0]; /*{offset:80 , sizeof:0, alignof:4} */
std::vector<int> g; /*{offset:80 , sizeof:24, alignof:8} */
int32_t h; /*{offset:104 , sizeof:4, alignof:4} */
uint8_t ___pad_aft_h[4];
};/*{sizeof:112, sizeof:8}*/supported
#nv_cli_make_simple_pod -l
[
'signed char', 'unsigned char',
'short', 'short int',
'signed short', 'signed short int',
'unsigned short', 'unsigned short int',
'int', 'signed',
'signed int', 'unsigned',
'unsigned int', 'long',
'long int', 'signed long',
'signed long int', 'unsigned long',
'unsigned long int', 'long long',
'signed long long', 'signed long long int',
'unsigned long long', 'unsigned long long int',
'std::nullptr_t', 'uint8_t',
'uint16_t', 'uint32_t',
'uint64_t', 'long long unsigned int',
'int8_t', 'int16_t',
'int32_t', 'int64_t',
'long long int', 'bool',
'float', 'double',
'long double', 'char',
'char8_t', 'char16_t',
'char32_t', 'wchar_t',
'std::float16_t', 'std::bfloat16_t',
'std::float32_t', 'std::float64_t',
'std::float128_t'
]LICENSE
- ISC
