2002-02-21 06:59:25 +03:00
|
|
|
# $NetBSD: extest.awk,v 1.6 2002/02/21 03:59:25 mrg Exp $
|
1999-05-11 23:14:50 +04:00
|
|
|
|
|
|
|
BEGIN {
|
|
|
|
first = 1;
|
|
|
|
|
2000-03-06 21:51:57 +03:00
|
|
|
printf("#include <sys/types.h>\n")
|
1999-05-11 23:14:50 +04:00
|
|
|
printf("#include <sys/extent.h>\n\n")
|
2000-03-06 21:51:57 +03:00
|
|
|
printf("#include <stdio.h>\n")
|
2000-07-03 08:02:34 +04:00
|
|
|
printf("#include <stdlib.h>\n")
|
2000-06-06 21:30:41 +04:00
|
|
|
printf("#include <string.h>\n")
|
|
|
|
printf("int main(void) {\n")
|
1999-05-11 23:14:50 +04:00
|
|
|
printf("struct extent *ex; int error; long result;\n")
|
|
|
|
}
|
|
|
|
|
|
|
|
END {
|
|
|
|
printf("exit (0);\n")
|
|
|
|
printf("}\n")
|
|
|
|
}
|
|
|
|
|
|
|
|
$1 == "extent" {
|
|
|
|
if (first == 0) {
|
|
|
|
printf("extent_destroy(ex);\n")
|
|
|
|
}
|
|
|
|
|
|
|
|
align = "EX_NOALIGN";
|
|
|
|
boundary = "EX_NOBOUNDARY";
|
|
|
|
|
|
|
|
printf("printf(\"output for %s\\n\");\n", $2)
|
|
|
|
|
|
|
|
if ($5 == "") {
|
|
|
|
flags = "0";
|
|
|
|
} else {
|
|
|
|
flags = $5;
|
|
|
|
}
|
|
|
|
printf("ex = extent_create(\"%s\", %s, %s, 0, 0, 0, %s);\n",
|
|
|
|
$2, $3, $4, flags)
|
|
|
|
|
|
|
|
first = 0;
|
|
|
|
}
|
|
|
|
|
2000-06-16 22:50:45 +04:00
|
|
|
$1 == "align" {
|
|
|
|
align = $2;
|
|
|
|
}
|
|
|
|
|
|
|
|
$1 == "boundary" {
|
|
|
|
boundary = $2;
|
|
|
|
}
|
|
|
|
|
1999-05-11 23:14:50 +04:00
|
|
|
$1 == "alloc_region" {
|
|
|
|
printf("error = extent_alloc_region(ex, %s, %s, 0);\n",
|
|
|
|
$2, $3)
|
|
|
|
printf("if (error)\n\tprintf(\"error: %%s\\n\", strerror(error));\n")
|
|
|
|
}
|
|
|
|
|
|
|
|
$1 == "alloc_subregion" {
|
|
|
|
printf("error = extent_alloc_subregion1(ex, %s, %s, %s,\n",
|
|
|
|
$2, $3, $4)
|
|
|
|
printf("\t%s, 0, %s, 0, &result);\n", align, boundary)
|
|
|
|
printf("if (error)\n\tprintf(\"error: %%s\\n\", strerror(error));\n")
|
2000-06-06 21:30:41 +04:00
|
|
|
printf("else\n\tprintf(\"result: 0x%%lx\\n\", result);\n")
|
1999-05-11 23:14:50 +04:00
|
|
|
}
|
|
|
|
|
2002-02-21 06:59:25 +03:00
|
|
|
$1 == "free" {
|
|
|
|
printf("error = extent_free(ex, %s, %s, 0);\n", $2, $3)
|
|
|
|
printf("if (error)\n\tprintf(\"error: %%s\\n\", strerror(error));\n")
|
|
|
|
}
|
|
|
|
|
1999-05-11 23:14:50 +04:00
|
|
|
$1 == "print" {
|
|
|
|
printf("extent_print(ex);\n")
|
|
|
|
}
|