=== modified file 'bin/aat.awk' --- bin/aat.awk 2014-06-29 04:36:59 +0000 +++ bin/aat.awk 2014-06-25 11:06:56 +0000 @@ -8,15 +8,6 @@ T_AWK = 3; type_names[3] = "awk" T_FUNC = 4; type_names[4] = "func" tok_type = T_TEXT - - # get current directory - "pwd" | getline PWD - close("pwd") - - # empty the depency file - if ("AAT_DEP" in ENVIRON) { - printf "" >ENVIRON["AAT_DEP"] - } } # Append 'content' to array of tokens. Token type is taken from current value @@ -38,9 +29,6 @@ # Print file dependencies for makefile usage function print_dep(str) { - if(str !~ /^\//) { - str = PWD "/" str - } if ("AAT_DEP" in ENVIRON) { print str >>ENVIRON["AAT_DEP"] } else { @@ -48,98 +36,33 @@ } } -function die(msg) { - print msg >>"/dev/stderr" - exit 1 -} - -function sh_escape(str) { - gsub(/["$\\]/, "\\&", str) - return "\"" str "\"" -} - -# find a file relative to current filename and overwrite that variable -function find_file(name) { - # TODO: include search path - if(name ~ /^\//) { - # absolute path - filename = name - } else { - # relative path - if(match(filename, "/[^/]*$")) { - filename = substr(filename, 1, RSTART) name - } else { - filename = name - } - } - - if(system("test -f " sh_escape(filename)) != 0) - { - die("could not find requested file: " sh_escape(filename) " (" name ") PWD: " PWD) - } - - print_dep(filename) -} - -function macro_readinto(args, varname) { - varname = sub(/[ \t].*$/, "", args) - find_file(sub(/^[^ \t]+[ \t]+/, "", args)) - tok_type=T_AWK - while(getline