hawk/hawk
2020-03-04 13:59:03 +00:00
..
ac updated lib/Makefile.am 2020-02-27 07:49:04 +00:00
bin fixed a bug handling -v in bin/main.c 2020-03-04 13:59:03 +00:00
lib fixed a bug handling -v in bin/main.c 2020-03-04 13:59:03 +00:00
m4 updated lib/Makefile.am 2020-02-27 07:49:04 +00:00
mod some code touch up 2020-03-03 12:00:13 +00:00
pkgs modified pkgs/hawk.spec.in 2020-01-22 10:14:18 +00:00
samples added a new global variable SCRIPTNAME which intends to store the first script name loaded 2020-03-03 08:03:04 +00:00
scripts changed the unary bitwise negation operator to a single tilde which overlaps with the regex match operator 2020-03-04 09:54:38 +00:00
t updated lib/Makefile.am 2020-02-27 07:49:04 +00:00
tools updated lib/Makefile.am 2020-02-27 07:49:04 +00:00
aclocal.m4 fixed the bug of having omitted setting an error message when given wrong handle. 2020-01-06 08:53:31 +00:00
configure updated lib/Makefile.am 2020-02-27 07:49:04 +00:00
configure.ac updated ax_pthread.m4 to the latest 2020-02-26 18:42:31 +00:00
Makefile.am enhanced build files for rpm packaging 2020-01-22 09:46:17 +00:00
Makefile.in updated lib/Makefile.am 2020-02-27 07:49:04 +00:00
README.md changed the unary bitwise negation operator to a single tilde which overlaps with the regex match operator 2020-03-04 09:54:38 +00:00

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]; }'

Basic Modules

sys

ffi

mysql

Embedding Guide