.. | ||
ac | ||
bin | ||
lib | ||
m4 | ||
mod | ||
pkgs | ||
samples | ||
scripts | ||
t | ||
tools | ||
aclocal.m4 | ||
configure | ||
configure.ac | ||
Makefile.am | ||
Makefile.in | ||
README.md |
Hawk
Language
Hawk implements most of the AWK programming language elements with extensions.
Entry Point
You may change the entry point of your script by setting a function name with @pragma entry.
@pragma entry main function main () { print "hello, world"; }
Value
- unitialized value
- integer
- floating-point number
- string
- byte string
- array
Module
Incompatibility with AWK
Parameter passing
In AWK, the caller can pass an uninitialized variable as a function parameter and get a changed value if the callled function sets it to an array.
function q(a) {a[1]=20; a[2]=30;} BEGIN { q(x); for (i in x) print i, x[i]; }
In Hawk, you can prefix the pramater name with & to indicate call-by-reference for the same effect.
function q(&a) {a[1]=20; a[2]=30;} BEGIN { q(x); for (i in x) print i, x[i]; }
Alternatively, you may form an array before passing it to a function.
function q(a) {a[1]=20; a[2]=30;} BEGIN { x[3]=99; q(x); for (i in x) print i, x[i]; }'