-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Multy cli support #16
Conversation
Signed-off-by: Matthias Gatto <[email protected]>
Signed-off-by: Matthias Gatto <[email protected]>
570adc3
to
f8da4b5
Compare
Signed-off-by: Matthias Gatto <[email protected]>
Signed-off-by: Matthias Gatto <[email protected]>
Signed-off-by: Matthias Gatto <[email protected]>
f8da4b5
to
9158ba5
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Clarifies some key points and correct grammar.
README.md
Outdated
@@ -3,13 +3,76 @@ | |||
|
|||
## Usage | |||
|
|||
configure COGNAC using `./configure`, then use either `cognac_gen.sh SOURCE DEST LANGUAGE` directly, or the Makefile. | |||
|
|||
*note: The main purpose of this repository is to generate source code. If your goal is to compile osc-sdk-c or oapi-cli, please use their respective repositories, which handle the code generation process for you.* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The primary purpose of this repository is to generate source code. If your goal is to compile osc-sdk-c
or oapi-cli
, please refer to their respective repositories, which handle the code generation process for you.
README.md
Outdated
*note: The main purpose of this repository is to generate source code. If your goal is to compile osc-sdk-c or oapi-cli, please use their respective repositories, which handle the code generation process for you.* | ||
|
||
### Brief | ||
|
||
configure COGNAC Makefile using `./configure` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To configure the COGNAC Makefile, use ./configure
.
README.md
Outdated
### Brief | ||
|
||
configure COGNAC Makefile using `./configure` | ||
you can use `cognac_gen.sh SOURCE DEST LANGUAGE` to generate a file from a template |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can use cognac_gen.sh SOURCE DEST LANGUAGE
to generate files from a template.
README.md
Outdated
|
||
configure COGNAC Makefile using `./configure` | ||
you can use `cognac_gen.sh SOURCE DEST LANGUAGE` to generate a file from a template | ||
the Makefile is here to help you generate all the files. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Makefile is designed to help you generate all the required files.
README.md
Outdated
configure COGNAC Makefile using `./configure` | ||
you can use `cognac_gen.sh SOURCE DEST LANGUAGE` to generate a file from a template | ||
the Makefile is here to help you generate all the files. | ||
if you want to generate everything, just call `make` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you want to generate everything, simply run make
.
README.md
Outdated
|
||
It use lot of small program interactive together, and is complet by a few utilities in bin/ that do some text handling. | ||
|
||
Makefile was create to... make files, and so Makefile is use that way. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Makefile was originally created to "make" files, and COGNAC uses it in that way.
README.md
Outdated
|
||
Makefile was create to... make files, and so Makefile is use that way. | ||
|
||
Scripts use by the makefile, do the job of creating the file, and the makefile check that they have been created, and that there's no need to rebuild them. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The scripts used by the Makefile handle the actual file creation, while the Makefile itself checks if files need to be rebuilt or not.
README.md
Outdated
### Templating | ||
|
||
the templating system cognac is homemade, it read SRC file and generate DEST file | ||
it uses multiple keyword, each surrounded by 4 underscore (example: `____api_version____`) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
COGNAC’s templating system is homemade. It reads SRC files and generates DEST files. It uses several keywords, each surrounded by four underscores (e.g., ____api_version____
).
README.md
Outdated
|
||
the templating system cognac is homemade, it read SRC file and generate DEST file | ||
it uses multiple keyword, each surrounded by 4 underscore (example: `____api_version____`) | ||
as an example, you can look at [lib.h](./lib.h) or [main_tpl.c](./main_tpl.c) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For example, you can check out lib.h or main_tpl.c.
README.md
Outdated
as an example, you can look at [lib.h](./lib.h) or [main_tpl.c](./main_tpl.c) | ||
|
||
Some rules support multiples languages sure as `____func_code____`, which will generate functions calls, | ||
and some are not. (like `____functions_proto____` which for now support only C) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some rules support multiple languages, like ____func_code____
, which generates function calls. Others, like ____functions_proto____
, currently support only C.
Signed-off-by: Matthias Gatto <[email protected]>
Signed-off-by: Matthias Gatto <[email protected]>
Signed-off-by: Matthias Gatto <[email protected]>
Signed-off-by: Matthias Gatto <[email protected]>
Signed-off-by: Matthias Gatto <[email protected]>
Signed-off-by: Matthias Gatto <[email protected]>
Signed-off-by: Matthias Gatto <[email protected]>
Signed-off-by: Matthias Gatto <[email protected]>
Signed-off-by: Matthias Gatto <[email protected]>
Signed-off-by: Matthias Gatto <[email protected]>
/* a is an array of "flexible size", v is the value to push, and pa | ||
* is use to store the pointer somewhere so we can free everything | ||
* esilly | ||
*/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a is an array with a flexible size, v is the value to push, and pa is used to store the pointer so that we can easily free everything later.
cognac_gen.sh
Outdated
cat <<EOF | ||
aditional=$(json-search -n additionalProperties <<< $componant) | ||
|
||
if [ "$aditional" == "null" -o "$aditional" == "false" ]; then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if [ "$aditional" == "null" || "$aditional" == "false" ]; then
cognac_gen.sh
Outdated
# no type check are made here, the aditional stuff is assumed to be a string | ||
cat <<EOF | ||
{ | ||
struct additional_strings *elem = malloc(sizeof *elem); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (!elem) {
fprintf(stderr, "Memory allocation failed");
return -1;
}
cognac_gen.sh
Outdated
{ | ||
fprintf(stderr, "'%s' not an argumemt of '$s'\n", str); | ||
return -1; | ||
} | ||
EOF | ||
else | ||
# no type check are made here, the aditional stuff is assumed to be a string |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no type checks are made here, the additional stuff is assumed to be a string
construct_data.c.sh
Outdated
aditional=$(json-search -n additionalProperties <<< $base) | ||
|
||
if [ "$aditional" != "null" -a "$aditional" != "false" ]; then | ||
# no type check are made here, the aditional stuff is assumed to be a string |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no type checks are made here, the additional stuff is assumed to be a string
construct_data.c.sh
Outdated
fi | ||
|
||
aditional=$(json-search -n additionalProperties <<< $base) | ||
|
||
if [ "$aditional" != "null" -a "$aditional" != "false" ]; then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if [ "$additional" != "null" ] && [ "$additional" != "false" ]; then
construct_data.c.sh
Outdated
if [ "$aditional" != "null" -a "$aditional" != "false" ]; then | ||
# no type check are made here, the aditional stuff is assumed to be a string | ||
cat <<EOF | ||
struct additional_strings **elems = args->additional_strs; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (!elems) {
fprintf(stderr, "Error: additional_strs is null");
return -1;
}
mk_args.c.sh
Outdated
@@ -75,6 +75,13 @@ write_struct() { | |||
|
|||
type_to_ctype "$t" "$snake_n" | |||
done | |||
aditional=$(json-search -n additionalProperties <<< $st_info) | |||
|
|||
if [ "$aditional" != "null" -a "$aditional" != "false" ]; then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if [ "$additional" != "null" ] && [ "$additional" != "false" ]; then
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why not, but why is it better ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
annyway, I change the code to use bash built-in [[
mk_args.c.sh
Outdated
aditional=$(json-search -n additionalProperties <<< $st_info) | ||
|
||
if [ "$aditional" != "null" -a "$aditional" != "false" ]; then | ||
# no type check are made here, the aditional stuff is assumed to be a string |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No type checks are made here; the additional stuff is assumed to be a string
Signed-off-by: Matthias Gatto <[email protected]>
Signed-off-by: Matthias Gatto <[email protected]>
Signed-off-by: Matthias Gatto <[email protected]>
No description provided.