From b7022e94d2ab62d522b0a7c2886cce3afaff6872 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Sun, 14 May 2000 14:05:10 +0000 Subject: vastly improved awk based code generator now handles recursive function definitions, unions etc it is sufficient for some basic types like UNISTR2 and BUFFER5 to be defined in the *.struct file and used successfully this generator uses templates (in *.tpl files) for all code generation, allowing easy replacement of the backend functions (This used to be commit 14ded82dc92ae6eff7639351f391a33b9cc31c0d) --- source3/aparser/util.awk | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 source3/aparser/util.awk (limited to 'source3/aparser/util.awk') diff --git a/source3/aparser/util.awk b/source3/aparser/util.awk new file mode 100644 index 0000000000..93f9a4dcd2 --- /dev/null +++ b/source3/aparser/util.awk @@ -0,0 +1,33 @@ +function isaptr(elem) +{ + if (substr(elem, 1, 1) == "*") { + return 1; + } + return 0; +} + +function noptr(elem) +{ + if (!isaptr(elem)) return elem; + return substr(elem, 2); +} + +function xprintf(f, fmt, v1, v2, v3, v4, v5, v6, v7) +{ + printf(fmt, v1, v2, v3, v4, v5, v6) > f; +} + +function fatal(why) +{ + printf("FATAL: %s\n", why); + exit 1; +} + +function numlines(fname, + LOCAL, line, count) +{ + count=0; + while ((getline line < fname) > 0) count++; + close(fname); + return count; +} -- cgit