Skip to content
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

Line check #14

Merged
merged 3 commits into from
Jul 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions cognac_gen.sh
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ ${indent_plus} } else {
${indent_plus} TRY(!aa, "$a argument missing\n");
${indent_plus} s->${snake_a}_str = aa;
${indent_plus} }
$indent_base } else if (!(aret = strcmp(str, "$a[]")) || aret == '=') {
$indent_base } else if (!(aret = argcmp(str, "$a[]")) || aret == '=') {
${indent_plus} TRY(!aa, "$a[] argument missing\n");
${indent_plus} SET_NEXT(s->${snake_a}, ${convertor}(aa), pa);
$indent_base } else
Expand Down Expand Up @@ -311,7 +311,7 @@ EOF
t=$(get_type2 "$s" "$a")
snake_n=$(to_snakecase <<< $a)

echo " if ((aret = strcmp(str, \"$a\")) == 0 || aret == '=' || aret == '.') {"
echo " if ((aret = argcmp(str, \"$a\")) == 0 || aret == '=' || aret == '.') {"
cli_c_type_parser "$a" "$t" " "
done
cat <<EOF
Expand Down Expand Up @@ -385,7 +385,7 @@ EOF
snake_a=$(to_snakecase <<< $a)

cat <<EOF
if ((aret = strcmp(next_a, "$a")) == 0 || aret == '=' || aret == '.') {
if ((aret = argcmp(next_a, "$a")) == 0 || aret == '=' || aret == '.') {
char *eq_ptr = strchr(next_a, '=');
if (eq_ptr) {
TRY((!*eq_ptr), "$a argument missing\n");
Expand Down
2 changes: 1 addition & 1 deletion configure
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ EOF
fi
if [ "--wget-json-search" = $( echo "$arg" | cut -d '=' -f 1) ]; then
rm json-search-x86_64.AppImage
wget https://github.com/cosmo-ray/json-search/releases/download/0.2/json-search-x86_64.AppImage
wget https://github.com/cosmo-ray/json-search/releases/download/0.3.1/json-search-x86_64.AppImage
chmod +x json-search-x86_64.AppImage
JSON_SEARCH="./json-search-x86_64.AppImage"
elif [ "--list-api-versions" = $arg ]; then
Expand Down
4 changes: 2 additions & 2 deletions helper.sh
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ get_type_direct() {
elif [ "$sub_type" == 'null' ]; then
local osub_ref=$(json-search -R '$ref' <<< ${arg_info})
local sub_ref=$(cut -d '/' -f 4 <<< $osub_ref 2> /dev/null)
local sub_ref_properties=$(jq $osub_ref.properties < osc-api.json 2> /dev/null)
osub_ref=$(cut -c 2- <<< $osub_ref | sed 's|/|.|g')
if [ "$sub_ref_properties" == '' ]; then
local sub_ref_properties=$(jq $osub_ref.properties < osc-api.json 2> /dev/null)
if [ "$sub_ref_properties" == 'null' ] || [ "$sub_ref_properties" == '' ]; then
local arg_info="$(jq $osub_ref < osc-api.json)"
local dtypes=$(json-search $limit -R type 2> /dev/null <<< $arg_info)
types="array $dtypes"
Expand Down
6 changes: 5 additions & 1 deletion main_tpl.c
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,11 @@ static int argcmp2(const char *s1, const char *s2, char dst)

static int argcmp(const char *s1, const char *s2)
{
return argcmp2(s1, s2, '.');
while (*s1 == *s2 && *s1 && *s2) {
s1++;
s2++;
}
return *s1 - *s2;
}

#define MAX_FILES_PER_CMD 64
Expand Down
Loading