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

Supporting all gawk functions #9

Open
prRZ5F4LXZ opened this issue Jul 1, 2021 · 2 comments
Open

Supporting all gawk functions #9

prRZ5F4LXZ opened this issue Jul 1, 2021 · 2 comments

Comments

@prRZ5F4LXZ
Copy link

It seems that some gawk functions are not supported by awka. Could those functions be supported?

$ awk 'BEGIN { x=x; print typeof(x) }'
unassigned
$ awka 'BEGIN { x=x; print typeof(x) }' > a.c
$ gcc -lawka a.c
a.c:16:44: error: implicit declaration of function 'typeof_fn' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
  awka_print(NULL, 0, 0, awka_arg1(a_TEMP, typeof_fn(awka_arg1(a_TEMP, x_awk))));
                                           ^
a.c:16:44: warning: incompatible integer to pointer conversion passing 'int' to parameter of type 'a_VAR *' [-Wint-conversion]
  awka_print(NULL, 0, 0, awka_arg1(a_TEMP, typeof_fn(awka_arg1(a_TEMP, x_awk))));
                                           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/local/include/libawka.h:1405:35: note: passing argument to parameter here
a_VARARG * awka_arg1(char, a_VAR *);
                                  ^
1 warning and 1 error generated.
@jlp765
Copy link

jlp765 commented Jul 18, 2021

typeof() and isarry() added in #12

@prRZ5F4LXZ
Copy link
Author

typeof() is still not fully compatible. See below.

main.sh> awk_code='BEGIN { x=x; print typeof(x) }'
main.sh> awka "$awk_code" > "$tmpdir"/a.c
main.sh> gcc -lawka -o "$tmpdir"/a.out "$tmpdir"/a.c
main.sh> gawk "$awk_code"
unassigned
main.sh> "$tmpdir"/a.out
untyped

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants