{"size":22,"ext":"awk","lang":"Awk","max_stars_count":1.0,"content":"$0=2^gsub(\/[TDLF]\/,0)\n","avg_line_length":11.0,"max_line_length":21,"alphanum_fraction":0.5} {"size":309,"ext":"awk","lang":"Awk","max_stars_count":4.0,"content":"\/^start$\/ {initflag =1}\nNF ==2 && initflag == 1 {\n testname = $1\n pass[testname]=0\n tests[testname]=0\n flag = 1\n}\nNF ==1 && flag == 1 && \/0|1\/{\n pass[testname]+=$1\n tests[testname]++\n}\nEND { for (test in tests)\n print \"Passed \" pass[test] \" of \" tests[test] \" in section \" test\n}","avg_line_length":22.0714285714,"max_line_length":78,"alphanum_fraction":0.5275080906} {"size":10,"ext":"awk","lang":"Awk","max_stars_count":16.0,"content":"$0 >= \"M\"\n","avg_line_length":5.0,"max_line_length":9,"alphanum_fraction":0.2} {"size":783,"ext":"awk","lang":"Awk","max_stars_count":null,"content":"# path = resources\/explore\/awk\n\n#echo \"problem 06: list, by users, # of sessions, total connect time, \"\n#echo \"total input and output bandwidth usage in packets\"\n#awk -f \/maynard06.awk \/data06\n\n\/User-Name\/ {\n user = $3\n}\n\n\/Acct-Status-Type = Stop\/ {\n sessions[user]++\n}\n\n\/Acct-Session-Time\/ {\n connect[user] += $3\n}\n\n\/Acct-Input-Packets\/ {\n inpack[user] += $3\n}\n\n\/Acct-Output-Packets\/ {\n outpack[user] += $3\n}\n\n\/Framed-Address\/ {\n user = \"\"\n}\n\nEND{\n for ( usr in sessions ) {\n print \"User:\\t\\t\\t\" usr\n print \"Number of Sessions:\\t\" sessions[usr]\n print \"Total Connect Time:\\t\" connect[usr]\n print \"Input Bandwidth Usage:\\t\" inpack[usr]\n print \"Output Bandwidth Usage:\\t\" outpack[usr]\n print\n }\n}\n\n","avg_line_length":18.6428571429,"max_line_length":71,"alphanum_fraction":0.595146871} {"size":12261,"ext":"awk","lang":"Awk","max_stars_count":null,"content":"#!\/usr\/bin\/awk -f\n\n#-\n# Copyright (c) 1992, 1993\n# The Regents of the University of California. All rights reserved.\n#\n# Redistribution and use in source and binary forms, with or without\n# modification, are permitted provided that the following conditions\n# are met:\n# 1. Redistributions of source code must retain the above copyright\n# notice, this list of conditions and the following disclaimer.\n# 2. Redistributions in binary form must reproduce the above copyright\n# notice, this list of conditions and the following disclaimer in the\n# documentation and\/or other materials provided with the distribution.\n# 4. Neither the name of the University nor the names of its contributors\n# may be used to endorse or promote products derived from this software\n# without specific prior written permission.\n#\n# THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n# ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n# SUCH DAMAGE.\n#\n# From @(#)vnode_if.sh 8.1 (Berkeley) 6\/10\/93\n# From @(#)makedevops.sh 1.1 1998\/06\/14 13:53:12 dfr Exp $\n# From @(#)makedevops.sh ?.? 1998\/10\/05\n# From src\/sys\/kern\/makedevops.pl,v 1.12 1999\/11\/22 14:40:04 n_hibma Exp\n# From src\/sys\/kern\/makeobjops.pl,v 1.8 2001\/11\/16 02:02:42 joe Exp\n#\n# $FreeBSD: soc2013\/dpl\/head\/sys\/tools\/makeobjops.awk 227666 2011-11-09 13:26:59Z ed $\n\n#\n# Script to produce kobj front-end sugar.\n#\n\nfunction usage ()\n{\n\tprint \"usage: makeobjops.awk [-d] [-p] [-l ] [-c|-h]\";\n\tprint \"where -c produce only .c files\";\n\tprint \" -h produce only .h files\";\n\tprint \" -p use the path component in the source file for destination dir\";\n\tprint \" -l set line width for output files [80]\";\n\tprint \" -d switch on debugging\";\n\texit 1;\n}\n\nfunction warn (msg)\n{\n\tprint \"makeobjops.awk:\", msg > \"\/dev\/stderr\";\n}\n\nfunction warnsrc (msg)\n{\n\twarn(src \":\" lineno \": \" msg);\n}\n\nfunction debug (msg)\n{\n\tif (opt_d)\n\t\twarn(msg);\n}\n\nfunction die (msg)\n{\n\twarn(msg);\n\texit 1;\n}\n\n# These are just for convenience ...\nfunction printc(s) {if (opt_c) print s > ctmpfilename;}\nfunction printh(s) {if (opt_h) print s > htmpfilename;}\n\n#\n# If a line exceeds maxlength, split it into multiple\n# lines at commas. Subsequent lines are indented by\n# the specified number of spaces.\n#\n# In other words: Lines are split by replacing \", \"\n# by \",\\n\" plus indent spaces.\n#\n\nfunction format_line (line, maxlength, indent)\n{\n\trline = \"\";\n\n\twhile (length(line) > maxlength) {\n\t\t#\n\t\t# Find the rightmost \", \" so that the part\n\t\t# to the left of it is just within maxlength.\n\t\t# If there is none, give up and leave it as-is.\n\t\t#\n\t\tif (!match(substr(line, 1, maxlength + 1), \/^.*, \/))\n\t\t\tbreak;\n\t\trline = rline substr(line, 1, RLENGTH - 1) \"\\n\";\n\t\tline = sprintf(\"%*s\", indent, \"\") substr(line, RLENGTH + 1);\n\t}\n\treturn rline line;\n}\n\n#\n# Join an array into a string.\n#\n\nfunction join (separator, array, num)\n{\n\t_result = \"\"\n\tif (num) {\n\t\twhile (num > 1)\n\t\t\t_result = separator array[num--] _result;\n\t\t_result = array[1] _result;\n\t}\n\treturn _result;\n}\n\n#\n# Execute a system command and report if it failed.\n#\n\nfunction system_check (cmd)\n{\n\tif ((rc = system(cmd)))\n\t\twarn(cmd \" failed (\" rc \")\");\n}\n\n#\n# Handle \"INTERFACE\" line.\n#\n\nfunction handle_interface ()\n{\n\tintname = $2;\n\tsub(\/;$\/, \"\", intname);\n\tif (intname !~ \/^[a-z_][a-z0-9_]*$\/) {\n\t\tdebug($0);\n\t\twarnsrc(\"Invalid interface name '\" intname \"', use [a-z_][a-z0-9_]*\");\n\t\terror = 1;\n\t\treturn;\n\t}\n\tif (!\/;[ \t]*$\/)\n\t\twarnsrc(\"Semicolon missing at end of line, no problem\");\n\n\tdebug(\"Interface \" intname);\n\n\tprinth(\"#ifndef _\" intname \"_if_h_\");\n\tprinth(\"#define _\" intname \"_if_h_\\n\");\n\tprintc(\"#include \\\"\" intname \"_if.h\\\"\\n\");\n}\n\n#\n# Pass doc comments through to the C file\n#\nfunction handle_doc ()\n{\n\tdoc = \"\"\n\twhile (!\/\\*\\\/\/) {\n\t\tdoc = doc $0 \"\\n\";\n\t\tgetline < src;\n\t\tlineno++;\n\t}\n\tdoc = doc $0 \"\\n\";\n\treturn doc;\n}\n\n#\n# Handle \"CODE\" and \"HEADER\" sections.\n# Returns the code as-is.\n#\n\nfunction handle_code ()\n{\n\tcode = \"\\n\";\n\tgetline < src;\n\tindent = $0;\n\tsub(\/[^\t ].*$\/, \"\", indent);\t# find the indent used\n\twhile (!\/^}\/) {\n\t\tsub(\"^\" indent, \"\");\t# remove the indent\n\t\tcode = code $0 \"\\n\";\n\t\tgetline < src;\n\t\tlineno++;;\n\t}\n\treturn code;\n}\n\n#\n# Handle \"METHOD\" and \"STATICMETHOD\" sections.\n#\n\nfunction handle_method (static, doc)\n{\n\t#\n\t# Get the return type and function name and delete that from\n\t# the line. What is left is the possibly first function argument\n\t# if it is on the same line.\n\t#\n\tif (!intname) {\n\t\twarnsrc(\"No interface name defined\");\n\t\terror = 1;\n\t\treturn;\n\t}\n\tsub(\/^[^ \t]+[ \t]+\/, \"\");\n\tret = $0;\n\tsub(\/[ \t]*\\{.*$\/, \"\", ret);\n\tname = ret;\n\tsub(\/^.*[ \t]\/, \"\", name);\t# last element is name of method\n\tsub(\/[ \t]+[^ \t]+$\/, \"\", ret);\t# return type\n\tdebug(\"Method: name=\" name \" return type=\" ret);\n\n\tsub(\/^[^\\{]*\\{[\t ]*\/, \"\");\n\n\tif (!name || !ret) {\n\t\tdebug($0);\n\t\twarnsrc(\"Invalid method specification\");\n\t\terror = 1;\n\t\treturn;\n\t}\n\n\tif (name !~ \/^[a-z_][a-z_0-9]*$\/) {\n\t\twarnsrc(\"Invalid method name '\" name \"', use [a-z_][a-z0-9_]*\");\n\t\terror = 1;\n\t\treturn;\n\t}\n\n\tif (methods[name]) {\n\t\twarnsrc(\"Duplicate method name\");\n\t\terror = 1;\n\t\treturn;\n\t}\n\tmethods[name] = name;\n\n\tline = $0;\n\twhile (line !~ \/\\}\/ && (getline < src) > 0) {\n\t\tline = line \" \" $0;\n\t\tlineno++\n\t}\n\n\tdefault_function = \"\";\n\tif (!match(line, \/\\};?\/)) {\n\t\twarnsrc(\"Premature end of file\");\n\t\terror = 1;\n\t\treturn;\n\t}\n\textra = substr(line, RSTART + RLENGTH);\n\tif (extra ~ \/[\t ]*DEFAULT[ \t]*[a-zA-Z_][a-zA-Z_0-9]*[ \t]*;\/) {\n\t\tdefault_function = extra;\n\t\tsub(\/.*DEFAULT[\t ]*\/, \"\", default_function);\n\t\tsub(\/[; \t]+.*$\/, \"\", default_function);\n\t}\n\telse if (extra && opt_d) {\n\t\t# Warn about garbage at end of line.\n\t\twarnsrc(\"Ignored '\" extra \"'\");\n\t}\n\tsub(\/\\};?.*$\/, \"\", line);\n\n\t#\n\t# Create a list of variables without the types prepended.\n\t#\n\tsub(\/^[\t ]+\/, \"\", line);\t# remove leading ...\n\tsub(\/[ \t]+$\/, \"\", line);\t# ... and trailing whitespace\n\tgsub(\/[\t ]+\/, \" \", line);\t# remove double spaces\n\n\tnum_arguments = split(line, arguments, \/ *; *\/) - 1;\n\tdelete varnames;\t\t# list of varnames\n\tnum_varnames = 0;\n\tfor (i = 1; i <= num_arguments; i++) {\n\t\tif (!arguments[i])\n\t\t\tcontinue;\t# skip argument if argument is empty\n\t\tnum_ar = split(arguments[i], ar, \/[* \t]+\/);\n\t\tif (num_ar < 2) {\t# only 1 word in argument?\n\t\t\twarnsrc(\"no type for '\" arguments[i] \"'\");\n\t\t\terror = 1;\n\t\t\treturn;\n\t\t}\n\t\t# Last element is name of variable.\n\t\tvarnames[++num_varnames] = ar[num_ar];\n\t}\n\n\targument_list = join(\", \", arguments, num_arguments);\n\tvarname_list = join(\", \", varnames, num_varnames);\n\n\tif (opt_d) {\n\t\twarn(\"Arguments: \" argument_list);\n\t\twarn(\"Varnames: \" varname_list);\n\t}\n\n\tmname = intname \"_\" name;\t# method name\n\tumname = toupper(mname);\t# uppercase method name\n\n\tfirstvar = varnames[1];\n\n\tif (default_function == \"\")\n\t\tdefault_function = \"kobj_error_method\";\n\n\t# the method description \n\tprinth(\"\/** @brief Unique descriptor for the \" umname \"() method *\/\");\n\tprinth(\"extern struct kobjop_desc \" mname \"_desc;\");\n\t# the method typedef\n\tprinth(\"\/** @brief A function implementing the \" umname \"() method *\/\");\n\tprototype = \"typedef \" ret \" \" mname \"_t(\";\n\tprinth(format_line(prototype argument_list \");\",\n\t line_width, length(prototype)));\n\n\t# Print out the method desc\n\tprintc(\"struct kobjop_desc \" mname \"_desc = {\");\n\tprintc(\"\\t0, { &\" mname \"_desc, (kobjop_t)\" default_function \" }\");\n\tprintc(\"};\\n\");\n\n\t# Print out the method itself\n\tprinth(doc);\n\tif (0) {\t\t# haven't chosen the format yet\n\t\tprinth(\"static __inline \" ret \" \" umname \"(\" varname_list \")\");\n\t\tprinth(\"\\t\" join(\";\\n\\t\", arguments, num_arguments) \";\");\n\t}\n\telse {\n\t\tprototype = \"static __inline \" ret \" \" umname \"(\";\n\t\tprinth(format_line(prototype argument_list \")\",\n\t\t line_width, length(prototype)));\n\t}\n\tprinth(\"{\");\n\tprinth(\"\\tkobjop_t _m;\");\n\tif (!static)\n\t\tfirstvar = \"((kobj_t)\" firstvar \")\";\n\tprinth(\"\\tKOBJOPLOOKUP(\" firstvar \"->ops,\" mname \");\");\n\tretrn = (ret != \"void\") ? \"return \" : \"\";\n\tprinth(\"\\t\" retrn \"((\" mname \"_t *) _m)(\" varname_list \");\");\n\tprinth(\"}\\n\");\n}\n\n#\n# Begin of the main program.\n#\n\nBEGIN {\n\nline_width = 80;\ngerror = 0;\n\n#\n# Process the command line.\n#\n\nnum_files = 0;\n\nfor (i = 1; i < ARGC; i++) {\n\tif (ARGV[i] ~ \/^-\/) {\n\t\t#\n\t\t# awk doesn't have getopt(), so we have to do it ourselves.\n\t\t# This is a bit clumsy, but it works.\n\t\t#\n\t\tfor (j = 2; j <= length(ARGV[i]); j++) {\n\t\t\to = substr(ARGV[i], j, 1);\n\t\t\tif\t(o == \"c\")\topt_c = 1;\n\t\t\telse if\t(o == \"h\")\topt_h = 1;\n\t\t\telse if\t(o == \"p\")\topt_p = 1;\n\t\t\telse if\t(o == \"d\")\topt_d = 1;\n\t\t\telse if\t(o == \"l\") {\n\t\t\t\tif (length(ARGV[i]) > j) {\n\t\t\t\t\topt_l = substr(ARGV[i], j + 1);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tif (++i < ARGC)\n\t\t\t\t\t\topt_l = ARGV[i];\n\t\t\t\t\telse\n\t\t\t\t\t\tusage();\n\t\t\t\t}\n\t\t\t}\n\t\t\telse\n\t\t\t\tusage();\n\t\t}\n\t}\n\telse if (ARGV[i] ~ \/\\.m$\/)\n\t\tfilenames[num_files++] = ARGV[i];\n\telse\n\t\tusage();\n}\n\nif (!num_files || !(opt_c || opt_h))\n\tusage();\n\nif (opt_p)\n\tdebug(\"Will produce files in original not in current directory\");\n\nif (opt_l) {\n\tif (opt_l !~ \/^[0-9]+$\/ || opt_l < 1)\n\t\tdie(\"Invalid line width '\" opt_l \"'\");\n\tline_width = opt_l;\n\tdebug(\"Line width set to \" line_width);\n}\n\nfor (i = 0; i < num_files; i++)\n\tdebug(\"Filename: \" filenames[i]);\n\nfor (file_i = 0; file_i < num_files; file_i++) {\n\tsrc = filenames[file_i];\n\tcfilename = hfilename = src;\n\tsub(\/\\.m$\/, \".c\", cfilename);\n\tsub(\/\\.m$\/, \".h\", hfilename);\n\tif (!opt_p) {\n\t\tsub(\/^.*\\\/\/, \"\", cfilename);\n\t\tsub(\/^.*\\\/\/, \"\", hfilename);\n\t}\n\n\tdebug(\"Processing from \" src \" to \" cfilename \" \/ \" hfilename);\n\n\tctmpfilename = cfilename \".tmp\";\n\thtmpfilename = hfilename \".tmp\";\n\n\tcommon_head = \\\n\t \"\/*\\n\" \\\n\t \" * This file is produced automatically.\\n\" \\\n\t \" * Do not modify anything in here by hand.\\n\" \\\n\t \" *\\n\" \\\n\t \" * Created from source file\\n\" \\\n\t \" * \" src \"\\n\" \\\n\t \" * with\\n\" \\\n\t \" * makeobjops.awk\\n\" \\\n\t \" *\\n\" \\\n\t \" * See the source file for legal information\\n\" \\\n\t \" *\/\\n\";\n\n\tprintc(common_head \"\\n\" \\\n\t \"#include \\n\" \\\n\t \"#include \\n\" \\\n\t \"#include \\n\" \\\n\t \"#include \");\n\n\tprinth(common_head);\n\n\tdelete methods;\t\t# clear list of methods\n\tintname = \"\";\n\tlineno = 0;\n\terror = 0;\t\t# to signal clean up and gerror setting\n\tlastdoc = \"\";\n\n\twhile (!error && (getline < src) > 0) {\n\t\tlineno++;\n\n\t\t#\n\t\t# Take special notice of include directives.\n\t\t#\n\t\tif (\/^#[ \t]*include[ \t]+[\"<][^\">]+[\">]\/) {\n\t\t\tincld = $0;\n\t\t\tsub(\/^#[ \t]*include[ \t]+\/, \"\", incld);\n\t\t\tdebug(\"Included file: \" incld);\n\t\t\tprintc(\"#include \" incld);\n\t\t}\n\n\t\tsub(\/#.*\/, \"\");\t\t# remove comments\n\t\tsub(\/^[\t ]+\/, \"\");\t# remove leading ...\n\t\tsub(\/[ \t]+$\/, \"\");\t# ... and trailing whitespace\n\n\t\tif (\/^$\/) {\t\t# skip empty lines\n\t\t}\n\t\telse if (\/^\\\/\\*\\*\/)\n\t\t\tlastdoc = handle_doc();\n\t\telse if (\/^INTERFACE[ \t]+[^ \t;]*[ \t]*;?[ \t]*$\/) {\n\t\t\tprinth(lastdoc);\n\t\t\tlastdoc = \"\";\n\t\t\thandle_interface();\n\t\t} else if (\/^CODE[ \t]*{$\/)\n\t\t\tprintc(handle_code());\n\t\telse if (\/^HEADER[\t ]*{$\/)\n\t\t\tprinth(handle_code());\n\t\telse if (\/^METHOD\/) {\n\t\t\thandle_method(0, lastdoc);\n\t\t\tlastdoc = \"\";\n\t\t} else if (\/^STATICMETHOD\/) {\n\t\t\thandle_method(1, lastdoc);\n\t\t\tlastdoc = \"\";\n\t\t} else {\n\t\t\tdebug($0);\n\t\t\twarnsrc(\"Invalid line encountered\");\n\t\t\terror = 1;\n\t\t}\n\t}\n\n\t#\n\t# Print the final '#endif' in the header file.\n\t#\n\tprinth(\"#endif \/* _\" intname \"_if_h_ *\/\");\n\n\tclose (ctmpfilename);\n\tclose (htmpfilename);\n\n\tif (error) {\n\t\twarn(\"Output skipped\");\n\t\tsystem_check(\"rm -f \" ctmpfilename \" \" htmpfilename);\n\t\tgerror = 1;\n\t}\n\telse {\n\t\tif (opt_c)\n\t\t\tsystem_check(\"mv -f \" ctmpfilename \" \" cfilename);\n\t\tif (opt_h)\n\t\t\tsystem_check(\"mv -f \" htmpfilename \" \" hfilename);\n\t}\n}\n\nexit gerror;\n\n}\n","avg_line_length":24.1358267717,"max_line_length":86,"alphanum_fraction":0.5978305195} {"size":553,"ext":"awk","lang":"Awk","max_stars_count":2.0,"content":"# Reduce Shaep output to two columns.\n# Assumes that input has no header-line\nBEGIN {\n OFS=\"\\t\"\n print \"name\\tvalues\" # Insert headers for the table\n}\n{\n # First column has molecule's name\n # Remove _entry... from name\n sub(\/_entry.*\/, \"\", $1)\n # Some names have _0... (DUD-E, LIGPREP, PLANTS?)\n sub(\/_0.*\/, \"\", $1)\n # Remove colons (and suffix)\n sub(\/:.*\/, \"\", $1)\n # Now all instances of a ligand have identical name\n if (!a[$1] || $2>a[$1]) a[$1]=$2 # Pick only the largest value from every ligand\n}\nEND {\n for (f in a) print f,a[f]\n}\n","avg_line_length":26.3333333333,"max_line_length":82,"alphanum_fraction":0.6075949367} {"size":171,"ext":"awk","lang":"Awk","max_stars_count":null,"content":"#!\/usr\/bin\/gawk\nBEGIN{\nindx=0\nprev=NULL\n }\n{\n indx=indx+1\n if($1==NULL||length($1)!=16||prev==$1){\n print indx \" Previous line is \" prev\n } \n prev=$1\n}\n","avg_line_length":13.1538461538,"max_line_length":43,"alphanum_fraction":0.5263157895} {"size":3621,"ext":"awk","lang":"Awk","max_stars_count":91.0,"content":"#\n# Copyright (c) 2001-2003\n# Fraunhofer Institute for Open Communication Systems (FhG Fokus).\n# \tAll rights reserved.\n#\n# Redistribution and use in source and binary forms, with or without\n# modification, are permitted provided that the following conditions\n# are met:\n# 1. Redistributions of source code must retain the above copyright\n# notice, this list of conditions and the following disclaimer.\n# 2. Redistributions in binary form must reproduce the above copyright\n# notice, this list of conditions and the following disclaimer in the\n# documentation and\/or other materials provided with the distribution.\n#\n# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n# SUCH DAMAGE.\n#\n# Author: Hartmut Brandt \n#\n# $Begemot: libunimsg\/netnatm\/msg\/geniec.awk,v 1.4 2003\/10\/10 14:50:05 hbb Exp $\n#\n# Generate table for IE parsing.\n#\n# This function is called before the first line\n#\nfunction begin() {\n\tfor(i = 0; i < 256; i++) {\n\t\tfor(j = 0; j < 4; j++) {\n\t\t\tdecl[i,j] = \"\"\n\t\t}\n\t}\n}\n\n#\n# This function is called after the last line.\n#\nfunction end() {\n\tprint \"\"\n\tprint \"const struct iedecl *uni_ietable[256][4] = {\"\n\tfor(i = 0; i < 256; i++) {\n\t\tprintf \"\\t{\"\n\t\tfor(j = 0; j < 4; j++) {\n\t\t\tif(decl[i,j] == \"\") {\n\t\t\t\tprintf \" NULL,\"\n\t\t\t} else {\n\t\t\t\tprintf \" &%s,\", decl[i,j]\n\t\t\t}\n\t\t}\n\t\tprintf \" }, \/* 0x%02x *\/\\n\", i\n\t}\n\tprint \"};\"\n}\n\n#\n# This function is called just when the first information element was found\n#\nfunction first_element() {\n\tprint \"\/* This file was created automatically\"\n\tprint \" * Source file: \" id\n\tprint \" *\/\"\n\tprint \"\"\n}\n\n#\n# This is called, when the information element is defaulted (there is\n# only the name and the coding scheme\n#\nfunction element_default() {\n\tprint \"\"\n\tprint \"static const struct iedecl decl_\" coding \"_\" ie \" = {\"\n\tprint \"\\tUNIFL_DEFAULT,\"\n\tprint \"\\t0,\"\n\tprint \"\\t(uni_print_f)NULL,\"\n\tprint \"\\t(uni_check_f)NULL,\"\n\tprint \"\\t(uni_encode_f)NULL,\"\n\tprint \"\\t(uni_decode_f)NULL\"\n\tprint \"};\"\n\tdecl[number,ncoding] = \"decl_\" coding \"_\" ie\n}\n\n#\n# This is found for a real, non-default IE\n#\nfunction element() {\n\tprint \"\"\n\tprint \"static void uni_ie_print_\" coding \"_\" ie \"(struct uni_ie_\" ie \" *, struct unicx *);\"\n\tprint \"static int uni_ie_check_\" coding \"_\" ie \"(struct uni_ie_\" ie \" *, struct unicx *);\"\n\tprint \"static int uni_ie_encode_\" coding \"_\" ie \"(struct uni_msg *, struct uni_ie_\" ie \" *, struct unicx *);\"\n\tprint \"static int uni_ie_decode_\" coding \"_\" ie \"(struct uni_ie_\" ie \" *, struct uni_msg *, u_int, struct unicx *);\"\n\tprint \"\"\n\tprint \"static struct iedecl decl_\" coding \"_\" ie \" = {\"\n\tif(access)\tprint \"\\tUNIFL_ACCESS,\"\n\telse\t\tprint \"\\t0,\"\n\tprint \"\\t\" len \",\"\n\tprint \"\\t(uni_print_f)uni_ie_print_\" coding \"_\" ie \",\"\n\tprint \"\\t(uni_check_f)uni_ie_check_\" coding \"_\" ie \",\"\n\tprint \"\\t(uni_encode_f)uni_ie_encode_\" coding \"_\" ie \",\"\n\tprint \"\\t(uni_decode_f)uni_ie_decode_\" coding \"_\" ie \"\"\n\tprint \"};\"\n\tdecl[number,ncoding] = \"decl_\" coding \"_\" ie\n}\n","avg_line_length":32.6216216216,"max_line_length":117,"alphanum_fraction":0.6920740127} {"size":77,"ext":"awk","lang":"Awk","max_stars_count":18.0,"content":"\/|\/{gsub(\/ \/, \"\", $0); print \"insert into tx_ledger values ('\"$1\"', \"$2\");\"}\n","avg_line_length":38.5,"max_line_length":76,"alphanum_fraction":0.4805194805} {"size":220,"ext":"awk","lang":"Awk","max_stars_count":null,"content":"BEGIN {\n print \"type a number\";\n}\n{\n print factorial($1);\n exit;\n}\nEND { print \"Done.\"; }\n\nfunction factorial( n ){\n if (n == 1){\n return 1;\n }\n else {\n return n * factorial(n-1);\n }\n}\n","avg_line_length":12.2222222222,"max_line_length":34,"alphanum_fraction":0.4681818182} {"size":5048,"ext":"awk","lang":"Awk","max_stars_count":17.0,"content":"# by Hagen Tilgner for mapping of pacBio reads : Jan 8th, 2011\n# expects to get \n# - an annotation file sorted by position piped in\n# -v sortedAnno=\n# -v intronGFF=\n# -v feature=\n# -v transIdColumn=\n# -v task=\n\n\n\nfunction d(x,y){\n split(x,X,\"_\"); \n split(y,Y,\"_\");\n\n if(X[1]!=Y[1]){\n\tprint \"ERROR:\"X[1]\"!=\"Y[1] > \"\/dev\/stderr\";\n\texit(0);\n }\n if(X[4]!=Y[4]){\n\tprint \"ERROR:\"X[4]\"!=\"Y[4] > \"\/dev\/stderr\";\n\texit(0);\n } \n\n if(X[3] \"\/dev\/stderr\";\n if(!sortedAnno){print \"ERROR: no value for sortedAnno\" > \"\/dev\/stderr\";exit(0);}\n if(!intronGFF){print \"ERROR: no value for intronGFF\" > \"\/dev\/stderr\";exit(0);}\n if(!feature){print \"ERROR: no value for feature\" > \"\/dev\/stderr\";exit(0);}\n if(!transIdColumn){print \"ERROR: no value for transIdColumn\" > \"\/dev\/stderr\";exit(0);}\n if(!geneIdColumn){print \"ERROR: no value for geneIdColumn\" > \"\/dev\/stderr\";exit(0);}\n \n\n print \"## A. parsing file2=\"intronGFF > \"\/dev\/stderr\"\n comm=\"cat \"intronGFF;\n while(comm | getline){\t\n\n\tsplit($9,a,\"transcript_id_with_chr=\");\n\tsplit(a[2],b,\"@\");\n\treadID=b[1];\t\n\tread2Gene[readID]=\"\";\n\n\tl1=$4-1;\n\tkey1=$1\"_\"l1\"_\"$7;\n\t\n\tif(key1 in endSite2Read){endSite2Read[key1]=endSite2Read[key1]\";\"readID}\n\telse{endSite2Read[key1]=readID;}\n \n\tl2=$5+1;\n\tkey2=$1\"_\"l2\"_\"$7;\n\t\n\tif(key2 in startSite2Read){startSite2Read[key2]=startSite2Read[key2]\";\"readID}\n\telse{startSite2Read[key2]=readID;}\n\n }\n\n\n \n\n\n print \"## B. parsing annotation: \" > \"\/dev\/stderr\"\n comm=\"cat \"sortedAnno;\n while(comm | getline){\n\n\tif(feature && $3!=feature){continue;}\n if(lastColumn4 && $4 \"\/dv\/stderr\";\n exit(0);\n }\n\tif($7!=\"+\" && $7!=\"-\"){\n\t print \"ERROR: cannot deal with strand=\"$7 > \"\/dev\/stderr\";\n\t exit(0);\n\t}\n\tif($transIdColumn in strand && strand[$transIdColumn]!=$7){\n\t print \"ERROR: strands do no match:\"strand[$transIdColumn]\"!=\"$7 > \"\/dev\/stderr\";\n\t exit(0);\n\t}\n\tif($transIdColumn in chr && chr[$transIdColumn]!=$1){\n\t print \"ERROR: chroms do no match:\"chr[$transIdColumn]\"!=\"$1 > \"\/dev\/stderr\";\n\t exit(0);\n\t}\n\tsplit($geneIdColumn,G,\"\\\"\");\n\tgene[$transIdColumn]=G[2];\n\tn[$transIdColumn]++;\n\texon[$transIdColumn\"\\t\"n[$transIdColumn]]=$1\"_\"$4\"_\"$5\"_\"$7;\t\n\tstrand[$transIdColumn]=$7;\n\tchr[$transIdColumn]=$1;\n\tlastColumn4=$4;\n }\n \n print \"## C. going over all annotated transcripts: \" > \"\/dev\/stderr\";\n for(tr in strand){\n \t\n\t# going over all exons of this transcript\n\tfor(i=1;i<=n[tr];i++){\n\t \n\t split(exon[tr\"\\t\"i],a,\"_\");\n\t keyStart=a[1]\"_\"a[2]\"_\"a[4];\n\t keyEnd=a[1]\"_\"a[3]\"_\"a[4];\n\t \n\n\t if(keyEnd in endSite2Read && i1 && !(gene[tr]\"\\t\"keyStart\"\\t\"\"start\" in geneSpliceSitePair) ){\n\t\tm=split(startSite2Read[keyStart],b,\";\");\n\t\tfor(j=1;j<=m;j++){\n\t\t read2Gene[b[j]]=read2Gene[b[j]]\";\"gene[tr];\n\t\t}\n\t\t#sitesStart[keyStart\"\\t\"gene[tr]]=1;\n\t }\n\t if(i>1){\n\t\tgeneSpliceSitePair[gene[tr]\"\\t\"keyStart\"\\t\"\"start\"]=1;\t\t\n\t }\n \t\t\t \n\t}\t \n }\n print \"## D. counting the number of splice sites per gene:\" > \"\/dev\/stderr\";\n for(k in geneSpliceSitePair){\n\tx=split(k,a,\"\\t\");\n\tif(x!=3){\n\t print \"ERROR: \"k\" is not a valid key in geneSpliceSitePair\" > \"\/dev\/stderr\";\n\t exit(0);\n\t}\n\tspliceSiteNumber[a[1]]++;\n\n\tif(a[2]\"\\t\"a[3] in spliceSite2Gene){\n\t problematicGene[a[1]]=\"\"; #print a[1] > problematicGeneOutFile;\n\t problematicGene[spliceSite2Gene[a[2]\"\\t\"a[3]]]=\"\"; #print spliceSite2Gene[a[2]\"\\t\"a[3]] > problematicGeneOutFile;\n\t}\n\telse{\n\t spliceSite2Gene[a[2]\"\\t\"a[3]]=a[1];\n\t}\n }\n \n\n print \"## E. checking whether a read has equal numbers of splice sites with multiple genes: \" > \"\/dev\/stderr\" \n for(r in read2Gene){\n\t#if(r!=\"m121212_085615_00126_c100418772550000001523036412191280_s1_p0\/47403\/ccs.path1\"){\n\t# continue;\n\t#}\n\tfor(k in h){\n\t #print \"deleting \"k\" from h\"; \n\t delete h[k];\n\t}\n\tm=split(read2Gene[r],b,\";\");\n\t#print \"m=\"m;\n\tfor(i=2;i<=m;i++){\n\t #print \"i=\"i\"; b[i]=\"b[i]\n\t h[b[i]]++;\n\t}\t\n\tg=\"none\";\n\tv=-1;\n\tproblemRead=\"fineRead\";\n\tproblemGene=\"fineGene\";\n\tfor(k in h){\n\t if(h[k]>v){\n\t\tproblemRead=\"fineRead\";\n\t\tif(k in problematicGene){\n\t\t problemGene=\"problematicGene\";\n\t\t}\n\t\telse{\n\t\t problemGene=\"fineGene\";\n\t\t}\n\t\tg=k;\n\t\tv=h[k];\n\t\tcontinue;\n\t }\n\t if(h[k]==v){\n\t\tproblemRead=\"problematicRead\";\n\t\tif(k in problematicGene){\n\t\t problemGene=\"problematicGene\";\n\t\t}\n\t\tg=g\"@;@\"k;\n\t\tv=h[k];\n\t }\n\t}\t\n\tprint r\"\\t\"g\"\\t\"problemRead\"\\t\"problemGene;\n }\n\n\n\n}\n\n\n","avg_line_length":24.6243902439,"max_line_length":118,"alphanum_fraction":0.5792393027} {"size":393,"ext":"awk","lang":"Awk","max_stars_count":1.0,"content":"# Awk file to read PG.out and generate a compact parserr.i\nstate == 2 {\n if (substr($1,1,1)==\"'\") printf(\" '%s\", $1 )\n else printf(\" %s\", $1 )\n count++\n if (count == nerrs) {print \"');\" ; state = 1}\n next\n }\nstate == 1 {\n errno = $1; nerrs = $2; count = 0\n if (errno==0) {exit}\n printf(\" %d: writeln(errout,'\", errno)\n state = 2\n }\n$(NF) == \"lxmax\" {state = 1}\n {next}\n","avg_line_length":23.1176470588,"max_line_length":58,"alphanum_fraction":0.5038167939} {"size":873,"ext":"awk","lang":"Awk","max_stars_count":null,"content":"BEGIN{ \n\trecvdSize = 0;\n\ttxsize = 0;\n\tdrpSize = 0;\n\tstartTime = 400;\n\tstopTime = 0;\n\tthru = 0; \n} \n\n{\n\n#Assign the columns \nevent = $1;\ntime = $2;\nnode_id = $3; \npkt_size = $8; \n\n \n# Store start time \nif ($4 == \"RTR\" && event == \"s\"){ \n\tif (time < startTime){ \n\t\tstartTime = time \n\t\t} \n\tpkt_size = pkt_size % 400 \n\ttxsize++ # Store transmitted packet\u2019s size\n\t} \n# Update total received packets\u2019 size and store packets arrival time \nif ($4 == \"RTR\" && event == \"r\"){\n \tif (time > stopTime){ \n\t\tstopTime = time \n\t} \n\t# Rip off the header \n\thdr_size = pkt_size % 400 \n\t# Store received packet\u2019s size \n\trecvdSize++ \n\tthru=(recvdSize\/txsize) \n\tprintf(\" %.2f %.2f \\n\" ,time,thru) > \"abc2.tr\" \n\t} \nif ($4 == \"AGT\" && event == \"d\" ){ \n\tpkt_size = pkt_size % 400 \n \tdrpSize++ \n\t} \n}\n \nEND{ \n printf(\"Average Throughput[kbps] = %.2f kbps \\n\",(recvdSize\/(stopTime- startTime))) \n} \n","avg_line_length":18.1875,"max_line_length":86,"alphanum_fraction":0.5864833906} {"size":2730,"ext":"awk","lang":"Awk","max_stars_count":1349.0,"content":"# From arnold@f7.net Sun Sep 5 12:30:53 2004\n# Date: Fri, 3 Sep 2004 00:54:32 -0400 (EDT)\n# From: William J Poser \n# To: arnold@skeeve.com\n# Subject: gawk bug\n# Message-ID: <20040903004347.W80049@lorax.ldc.upenn.edu>\n# \n# Here is a revised version of my previous message, modified to describe\n# the accompanying files.\n# \n# IhSplit.awk should replicate every record with exactly one entry in the\n# IH field, delete records lacking an IH field, and produce as many copies\n# of records with two or more entries in the IH field as there are entries.\n# In the latter case, the original IH field should be relabelled OIH and\n# a new IH field be added at the beginning of the record.\n# \n# This has worked properly for many years, since at least 1997. It worked properly with gawk 3.0.5\n# and possibly later versions. Unfortunately I didn't keep track of exactly what version it\n# broke on, but it was whatever came with Mandrake Linux 9.0. It continued to fail with version\n# 3.1.2. However, the problem was eliminated with version 3.1.3 and remains\n# eliminated in version 3.1.4.\n# \n# The problem was that an apparently random subset of records would loose some\n# or all of their fields. Running the script on the same input always produces\n# the same output with the same errors.\n# \n# The file Input is a subset of a real lexicon that produces errors using\n# gawk 3.1.2. GoodOutput is the expected output. BadOutput is the erroneous\n# output. A diff will show that there are actually two errors. One record\n# has fields stripped as described above. Another is omitted in its entirety.\n# \n# \n# Bill Poser, Linguistics, University of Pennsylvania\n# http:\/\/www.ling.upenn.edu\/~wjposer\/ billposer@alum.mit.edu\n# ----------------------------------------------------------------------------\n#For each record that contains multiple items in its inverse headword (IH)\n#field, generate a set of new records each containing exactly one item\n#in the inverse headword field, otherwise copies of the original.\n\nfunction CleanUp() #Clean up for next input record.\n{\n for(i in rec) delete rec[i];\n}\n\nBEGIN {\nRS = \"\";\nFS = \"\\n?%\"\n}\n{\n\n# First, create an associative array with the tags as indices.\n for(i = 2; i <= NF; i++) { # The leading FS creates an initial empty field\n split($i, f, \":\");\n rec[f[1]]=substr($i,index($i,\":\")+1);\n }\n\n if(!(\"IH\" in rec)) next;\n\n# Parse out the inverse headwords\n\n items = split(rec[\"IH\"],ihs,\"\/\");\n\n# Replace the old IH field.\n\n sub(\/%IH:\/,\"%OIH:\",$0);\n\n# Generate a new copy of the record for each inverse headword\n\n for(i = 1; i <= items; i++){\n\t entries+=1;\n printf(\"%%IH:%s\\n\",ihs[i]);\n printf(\"%s\\n\\n\",$0);\n }\n CleanUp();\n }\n","avg_line_length":35.9210526316,"max_line_length":98,"alphanum_fraction":0.6802197802} {"size":2426,"ext":"awk","lang":"Awk","max_stars_count":null,"content":"BEGIN {\n\tdmax=100\n\tif (!(linespeed > 0)) linespeed = 128\n\tFS=\":\"\n\tn = 0\n}\n\n($1 != \"\") {\n\tn++\n\tclass[n] = $1\n\tprio[n] = $2\n\tavgrate[n] = ($3 * linespeed \/ 100)\n\tpktsize[n] = $4\n\tdelay[n] = $5\n\tmaxrate[n] = ($6 * linespeed \/ 100)\n\tqdisc[n] = $7\n\tfilter[n] = $8\n}\n\nEND {\n\tallocated = 0\n\tmaxdelay = 0\n\n\tfor (i = 1; i <= n; i++) {\n\t\t# set defaults\n\t\tif (!(pktsize[i] > 0)) pktsize[i] = 1500\n\t\tif (!(prio[i] > 0)) prio[i] = 1\n\n\t\tallocated += avgrate[i]\n\t\tsum_prio += prio[i]\n\t\tif ((avgrate[i] > 0) && !(delay[i] > 0)) {\n\t\t\tsum_rtprio += prio[i]\n\t\t}\n\t}\n\n\t# allocation of m1 in rt classes:\n\t# sum(d * m1) must not exceed dmax * (linespeed - allocated)\n\tdmax = 0\n\tfor (i = 1; i <= n; i++) {\n\t\tif (avgrate[i] > 0) {\n\t\t\trtm2[i] = avgrate[i]\n\t\t\tif (delay[i] > 0) {\n\t\t\t\td[i] = delay[i]\n\t\t\t} else {\n\t\t\t\td[i] = 2 * pktsize[i] * 1000 \/ (linespeed * 1024)\n\t\t\t\tif (d[i] > dmax) dmax = d[i]\n\t\t\t}\n\t\t}\n\t}\n\n\tds_avail = dmax * (linespeed - allocated)\n\tfor (i = 1; i <= n; i++) {\n\t\tlsm1[i] = 0\n\t\trtm1[i] = 0\n\t\tlsm2[i] = linespeed * prio[i] \/ sum_prio\n\t\tif ((avgrate[i] > 0) && (d[i] > 0)) {\n\t\t\tif (!(delay[i] > 0)) {\n\t\t\t\tds = ds_avail * prio[i] \/ sum_rtprio\n\t\t\t\tds_avail -= ds\n\t\t\t\trtm1[i] = rtm2[i] + ds\/d[i]\n\t\t\t}\n\t\t\tlsm1[i] = rtm1[i]\n\t\t}\n\t\telse {\n\t\t\td[i] = 0\n\t\t}\n\t}\n\n\t# main qdisc\n\tfor (i = 1; i <= n; i++) {\n\t\tprintf \"tc class add dev \"device\" parent 1:1 classid 1:\"class[i]\"0 hfsc\"\n\t\tif (rtm1[i] > 0) {\n\t\t\tprintf \" rt m1 \" int(rtm1[i]) \"kbit d \" int(d[i] * 1000) \"us m2 \" int(rtm2[i])\"kbit\"\n\t\t}\n\t\tprintf \" ls m1 \" int(lsm1[i]) \"kbit d \" int(d[i] * 1000) \"us m2 \" int(lsm2[i]) \"kbit\"\n\t\tprint \" ul rate \" int(maxrate[i]) \"kbit\"\n\t}\n\n\t# leaf qdisc\n\tavpkt = 1200\n\tfor (i = 1; i <= n; i++) {\n\t\tprint \"tc qdisc add dev \"device\" parent 1:\"class[i]\"0 handle \"class[i]\"00: fq_codel limit 800 quantum 300 noecn\"\n\t}\n\n\t# filter rule\n\tfor (i = 1; i <= n; i++) {\n\t\tfilter_cmd = \"tc filter add dev \"device\" parent 1: prio %d protocol ip handle %s fw flowid 1:%d0\\n\";\n\t\tif (direction == \"up\") {\n\t\t\tfilter_1 = sprintf(\"0x%x0\/0xf0\", class[i])\n\t\t\tfilter_2 = sprintf(\"0x0%x\/0x0f\", class[i])\n\t\t} else {\n\t\t\tfilter_1 = sprintf(\"0x0%x\/0x0f\", class[i])\n\t\t\tfilter_2 = sprintf(\"0x%x0\/0xf0\", class[i])\n\t\t}\n\n\t\tprintf filter_cmd, class[i] * 2, filter_1, class[i]\n\t\tprintf filter_cmd, class[i] * 2 + 1, filter_2, class[i]\n\n\t\tfilterc=1\n\t\tif (filter[i] != \"\") {\n\t\t\tprint \" tc filter add dev \"device\" parent \"class[i]\"00: handle \"filterc\"0 \"filter[i]\n\t\t\tfilterc=filterc+1\n\t\t}\n\t}\n}\n\n","avg_line_length":22.6728971963,"max_line_length":114,"alphanum_fraction":0.5350370981} {"size":440,"ext":"awk","lang":"Awk","max_stars_count":16.0,"content":"# form.gen - generate form letters\n# input: prototype file letter.text; data lines\n# output: one form letter per data line\n\nBEGIN {\n FS = \":\"\n while (getline <\"letter.text\" > 0) # read form letter\n form[++n] = $0\n}\n\n{ for (i = 1; i <= n; i++) { # read data lines\n temp = form[i] # each line generates a letter\n for (j = 1; j <= NF; j++)\n gsub(\"#\" j, $j, temp)\n print temp\n }\n}\n","avg_line_length":24.4444444444,"max_line_length":61,"alphanum_fraction":0.5113636364} {"size":133,"ext":"awk","lang":"Awk","max_stars_count":37.0,"content":"#! \/usr\/bin\/env awk\n{\n if (($1==\"####\")&&($3==\"##########################\")) {\n\tprintf \"%s \", $2\n }\n}\n\nEND {\n printf \"\\n\"\n}\n","avg_line_length":12.0909090909,"max_line_length":59,"alphanum_fraction":0.2556390977} {"size":2389,"ext":"awk","lang":"Awk","max_stars_count":null,"content":"#awk -f phasematch.awk order_reference.txt order_mapped.txt >order_mapped_in_reference_phase.txt\n#\nBEGIN{\n}\n(NR==FNR && \/^[^#]\/){\n\tfor (f = 7; f < NF; f+=3)\n\t\trefdata[$1, f] = $f\t\n\tif (numF != \"\" && numF != NF) {\n\t\tprint \"Error: different number of columns in the input orders\" > \"\/dev\/stderr\"\n\t\texit 1\n\t}\n\tnumF = NF\n}\n\n(NR!=FNR){\n\tif (\/^[#]\/)\n\t\t;\n\telse {\n\t\tif (numF != NF) {\n\t\t\tprint \"Error: different number of columns in the input orders\" > \"\/dev\/stderr\"\n\t\t\texit 1\n\t\t}\n\t}\n\tdata[FNR]=$0\n}\n\nEND{\n\tfor (i = 1; i <= FNR; ++i) {\n\t\t$0 = data[i]\n\t\tif (\/^[#]\/)\n\t\t\t;\n\t\telse {\n\t\t\tfor (f = 7; f < NF; f+=3) {\n\t\t\t\tif (($1 SUBSEP f) in refdata) {\n\t\t\t\t\tham1[f] += hamming1($f, refdata[$1, f])\n\t\t\t\t\tmaxham1[f] += maxh\n\t\t\t\t\tham2[f] += hamming2($f, refdata[$1, f])\n\t\t\t\t\tmaxham2[f] += maxh\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t}\nfor (f = 7; f < NF; f+=3) {\n\t\tprint \"***\" > \"\/dev\/stderr\"\n\t\tprint \"hamming distance1 is \" ham1[f] \" of \" maxham1[f] \" (\" abs(ham1[f])\/(maxham1[f]+0.000000000000000001) \") for family \" ++family > \"\/dev\/stderr\"\n\t\tprint \"hamming distance2 is \" ham2[f] \" of \" maxham2[f] \" (\" abs(ham2[f])\/(maxham2[f]+0.000000000000000001) \") for family \" family > \"\/dev\/stderr\"\n\t}\n\n\tfor (i = 1; i <= FNR; ++i) {\n\t\t$0 = data[i]\n\t\tif (\/^[#]\/)\n\t\t\tprint\n\t\telse {\n\t\t\tfor (f = 7; f < NF; f+=3) {\n\t\t\t\tn = length($f) \/ 2\n\t\t\t\tp1 = substr($f, 1, n)\n\t\t\t\tp2 = substr($f, n + 1)\n\t\t\t\tif (ham1[f] < 0) \n\t\t\t\t\tp1 = flip(p1)\n\t\t\t\tif (ham2[f] < 0) \n\t\t\t\t\tp2 = flip(p2)\n\t\t\t\t$f = p1 p2\n\t\t\t}\n\t\t\t\n\n\t\t\ts = $1 \"\\t\" $2 \"\\t\" $3 \"\\t\" $4 \" \" $5 \" \" $6\n\t\t\tfor (f = 7; f < NF; f+=3)\n\t\t\t\ts = s \"\\t\" $f \" \" $(f+1) \" \" $(f+2)\n\t\t\tprint s\n\t\t}\n\t\t\n\t}\n}\nfunction abs(x) {\n\tif (x < 0)\n\t\treturn -x\n\treturn x\n}\n\nfunction flip(x) {\n\tgsub(\/0\/, \"x\", x)\n\tgsub(\/1\/, \"0\", x)\n\tgsub(\/x\/, \"1\", x)\n\treturn x\n}\n\nfunction hamming1(x, y ,i,xi,yi,ret, n)\n{\n\tn = length(y)\n\tif (length(x) < n)\n\t\tn = length(x)\n#\tprint x \" \" y\n\tret = 0\n\tmaxh = 0\n\tn = n \/ 2\n\tfor (i = 1; i <= n; ++i) {\n\t\txi = substr(x, i, 1)\n\t\tyi = substr(y, i, 1)\n\t\tif (yi != \"-\" && xi != \"-\") {\n\t\t\t++maxh\n\t\t\tif (xi == yi) {\n\t\t\t\t++ret\n\t\t\t}\n\t\t\telse\n\t\t\t\t--ret\n\t\t}\n\t}\n\treturn ret\n}\nfunction hamming2(x, y ,i,xi,yi,ret, n)\n{\n\tn = length(y)\n\tif (length(x) < n)\n\t\tn = length(x)\n#\tprint x \" \" y\n\tret = 0\n\tmaxh = 0\n\tfor (i = n \/ 2 + 1; i <= n; ++i) {\n\t\txi = substr(x, i, 1)\n\t\tyi = substr(y, i, 1)\n\t\tif (yi != \"-\" && xi != \"-\") {\n\t\t\t++maxh\n\t\t\tif (xi == yi) {\n\t\t\t\t++ret\n\t\t\t}\n\t\t\telse\n\t\t\t\t--ret\n\t\t}\n\t}\n\treturn ret\n}\n\n","avg_line_length":17.828358209,"max_line_length":150,"alphanum_fraction":0.4654667225} {"size":541,"ext":"awk","lang":"Awk","max_stars_count":15.0,"content":"function ltrim(s) { sub(\/^[ \\t\\r\\n]+\/, \"\", s); return s }\nfunction rtrim(s) { sub(\/[ \\t\\r\\n]+$\/, \"\", s); return s }\nfunction trim(s) { return rtrim(ltrim(s)); }\n\nBEGIN {\n RS=\"#\";\n FS=\":\";\n printf \"[\";\n}\n\nNR==1 { next }\n\n{\n group=trim($1);\n split($2, parts, \"\\n\")\n description=trim(parts[1]);\n shortcut=trim(parts[2]);\n sub(\/-\/, \"+\", shortcut)\n printf \"%s{\\\"group\\\": \\\"%s\\\", \\\"description\\\": \\\"%s\\\", \\\"keyCombination\\\": \\\"%s\\\"}\", seperator, group, description, shortcut\n seperator=\",\"\n}\n\nEND {\n printf \"]\"\n}\n","avg_line_length":20.8076923077,"max_line_length":128,"alphanum_fraction":0.5009242144} {"size":163,"ext":"awk","lang":"Awk","max_stars_count":212.0,"content":"#! \/usr\/bin\/awk -f\n\nfunction sum1( file1 ) {\n\twhile (1 == (getline < file1)) {\n\t\treturn_value += $1\n\t}\n\treturn return_value\n}\nBEGIN {\n\tsum1( \"..\/..\/src\/rn100\" )\n}\n","avg_line_length":13.5833333333,"max_line_length":33,"alphanum_fraction":0.5705521472} {"size":77,"ext":"awk","lang":"Awk","max_stars_count":null,"content":"{ print \"{\\\"name\\\": \\\"keyword.cpptraj\\\", \\\"match\\\": \\\"\\\\\\\\b\" $1 \"\\\\\\\\b\\\"},\" }","avg_line_length":77.0,"max_line_length":77,"alphanum_fraction":0.4025974026} {"size":78,"ext":"awk","lang":"Awk","max_stars_count":10.0,"content":"BEGIN {\n Output = 0\n}\n$2 == \"Command\" { Output = 1 }\nEND { print Output }\n\n","avg_line_length":11.1428571429,"max_line_length":30,"alphanum_fraction":0.5256410256} {"size":1181,"ext":"awk","lang":"Awk","max_stars_count":null,"content":"#!\/usr\/bin\/awk -E\n\n# PURPOSE: Form fill templates\n# USAGE:\n# awk templatefile recordsfile\n# Template file is typically an idf file that has '#N' placeholders.\n# The 'templates' is a tab separated data file. For each row, a new instance of the template is created.\nBEGIN {\n FS = \"\\t\"\n # awk program name counts as the first argument.\n if (ARGC < 2) {\n print \"2 Arguments required.\\n\\nUSAGE:\\nawk -f file template records\"\n exit 1\n }\n\n template = ARGV[1]\n ARGV[1] = \"\"\n\n while (getline < template > 0 ) {\n form[++n] = $0\n }\n}\n\n# Each line in the input\/records file creates a new template,\n# so this serves like another for loop.\n{\n # Loop over lines of the template\n for (i = 1; i <= n; i++) {\n temp = form[i]\n\n # Go backwards, in case there are multiple digit substiuttions.\n # Example, if you did #1 befor #10, you'd be left with the #1\n # substitution with a 0 populated at the end.\n for (j = NF; j >= 1; j--) {\n\n # Clean commas from substitution (this is for numbers like 1,000)\n gsub(\/,\/, \"\", $j)\n\n gsub(\"#\" j, $j, temp)\n }\n\n print temp\n }\n}\n","avg_line_length":26.2444444444,"max_line_length":104,"alphanum_fraction":0.5800169348} {"size":853,"ext":"awk","lang":"Awk","max_stars_count":3428.0,"content":"#!\/usr\/bin\/env awk -f\n#\n# @license Apache-2.0\n#\n# Copyright (c) 2017 The Stdlib Authors.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# http:\/\/www.apache.org\/licenses\/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\n# Computes the minimum value.\n#\n# Usage: min\n#\n# Input:\n# - a column of numbers\n#\n# Output:\n# - minimum value\n\n!i++ {\n\t# Only for the first record:\n\tmin = $1\n}\n{\n\tif ($1 < min) {\n\t\tmin = $1\n\t}\n}\nEND {\n\tprint min\n}\n","avg_line_length":20.8048780488,"max_line_length":74,"alphanum_fraction":0.6928487691} {"size":3502,"ext":"awk","lang":"Awk","max_stars_count":3.0,"content":"#\t$NetBSD: checktab.awk,v 1.3 1999\/11\/10 20:32:31 kleink Exp $\n\n# Check tz tables for consistency.\n\n# @(#)checktab.awk\t1.6\n\n# Contributed by Paul Eggert .\n\nBEGIN {\n\tFS = \"\\t\"\n\n\tif (!iso_table) iso_table = \"iso3166.tab\"\n\tif (!zone_table) zone_table = \"zone.tab\"\n\tif (!want_warnings) want_warnings = -1\n\n\twhile (getline >\"\/dev\/stderr\"\n\t\t\tstatus = 1\n\t\t}\n\t\tcc = $1\n\t\tname = $2\n\t\tif (cc !~ \/^[A-Z][A-Z]$\/) {\n\t\t\tprintf \"%s:%d: invalid country code `%s'\\n\", \\\n\t\t\t\tiso_table, iso_NR, cc >>\"\/dev\/stderr\"\n\t\t\tstatus = 1\n\t\t}\n\t\tif (cc <= cc0) {\n\t\t\tif (cc == cc0) {\n\t\t\t\ts = \"duplicate\";\n\t\t\t} else {\n\t\t\t\ts = \"out of order\";\n\t\t\t}\n\n\t\t\tprintf \"%s:%d: country code `%s' is %s\\n\", \\\n\t\t\t\tiso_table, iso_NR, cc, s \\\n\t\t\t\t>>\"\/dev\/stderr\"\n\t\t\tstatus = 1\n\t\t}\n\t\tcc0 = cc\n\t\tif (name2cc[name]) {\n\t\t\tprintf \"%s:%d: `%s' and `%s' have the sname name\\n\", \\\n\t\t\t\tiso_table, iso_NR, name2cc[name], cc \\\n\t\t\t\t>>\"\/dev\/stderr\"\n\t\t\tstatus = 1\n\t\t}\n\t\tname2cc[name] = cc\n\t\tcc2name[cc] = name\n\t\tcc2NR[cc] = iso_NR\n\t}\n\n\tzone_table = \"zone.tab\"\n\tcc0 = \"\"\n\n\twhile (getline >\"\/dev\/stderr\"\n\t\t\tstatus = 1\n\t\t}\n\t\tcc = $1\n\t\tcoordinates = $2\n\t\ttz = $3\n\t\tcomments = $4\n\t\tif (cc < cc0) {\n\t\t\tprintf \"%s:%d: country code `%s' is out of order\\n\", \\\n\t\t\t\tzone_table, zone_NR, cc >>\"\/dev\/stderr\"\n\t\t\tstatus = 1\n\t\t}\n\t\tcc0 = cc\n\t\tif (tz2cc[tz]) {\n\t\t\tprintf \"%s:%d: %s: duplicate TZ column\\n\", \\\n\t\t\t\tzone_table, zone_NR, tz >>\"\/dev\/stderr\"\n\t\t\tstatus = 1\n\t\t}\n\t\ttz2cc[tz] = cc\n\t\ttz2comments[tz] = comments\n\t\ttz2NR[tz] = zone_NR\n\t\tif (cc2name[cc]) {\n\t\t\tcc_used[cc]++\n\t\t} else {\n\t\t\tprintf \"%s:%d: %s: unknown country code\\n\", \\\n\t\t\t\tzone_table, zone_NR, cc >>\"\/dev\/stderr\"\n\t\t\tstatus = 1\n\t\t}\n\t\tif (coordinates !~ \/^[-+][0-9][0-9][0-5][0-9][-+][01][0-9][0-9][0-5][0-9]$\/ \\\n\t\t && coordinates !~ \/^[-+][0-9][0-9][0-5][0-9][0-5][0-9][-+][01][0-9][0-9][0-5][0-9][0-5][0-9]$\/) {\n\t\t\tprintf \"%s:%d: %s: invalid coordinates\\n\", \\\n\t\t\t\tzone_table, zone_NR, coordinates >>\"\/dev\/stderr\"\n\t\t\tstatus = 1\n\t\t}\n\t}\n\n\tfor (tz in tz2cc) {\n\t\tif (cc_used[tz2cc[tz]] == 1) {\n\t\t\tif (tz2comments[tz]) {\n\t\t\t\tprintf \"%s:%d: unnecessary comment `%s'\\n\", \\\n\t\t\t\t\tzone_table, tz2NR[tz], tz2comments[tz] \\\n\t\t\t\t\t>>\"\/dev\/stderr\"\n\t\t\t\tstatus = 1\n\t\t\t}\n\t\t} else {\n\t\t\tif (!tz2comments[tz]) {\n\t\t\t\tprintf \"%s:%d: missing comment\\n\", \\\n\t\t\t\t\tzone_table, tz2NR[tz] >>\"\/dev\/stderr\"\n\t\t\t\tstatus = 1\n\t\t\t}\n\t\t}\n\t}\n\n\tFS = \" \"\n}\n\n{\n\ttz = \"\"\n\tif ($1 == \"Zone\") tz = $2\n\tif ($1 == \"Link\") {\n\t\t# Ignore Link commands if source and destination basenames\n\t\t# are identical, e.g. Europe\/Istanbul versus Asia\/Istanbul.\n\t\tsrc = $2\n\t\tdst = $3\n\t\twhile ((i = index(src, \"\/\"))) src = substr(src, i+1)\n\t\twhile ((i = index(dst, \"\/\"))) dst = substr(dst, i+1)\n\t\tif (src != dst) tz = $3\n\t}\n\tif (tz && tz ~ \/\\\/\/) {\n\t\tif (!tz2cc[tz]) {\n\t\t\tprintf \"%s: no data for `%s'\\n\", zone_table, tz \\\n\t\t\t\t>>\"\/dev\/stderr\"\n\t\t\tstatus = 1\n\t\t}\n\t\tzoneSeen[tz] = 1\n\t}\n}\n\nEND {\n\tfor (tz in tz2cc) {\n\t\tif (!zoneSeen[tz]) {\n\t\t\tprintf \"%s:%d: no Zone table for `%s'\\n\", \\\n\t\t\t\tzone_table, tz2NR[tz], tz >>\"\/dev\/stderr\"\n\t\t\tstatus = 1\n\t\t}\n\t}\n\n\tif (0 < want_warnings) {\n\t\tfor (cc in cc2name) {\n\t\t\tif (!cc_used[cc]) {\n\t\t\t\tprintf \"%s:%d: warning: \" \\\n\t\t\t\t\t\"no Zone entries for %s (%s)\\n\", \\\n\t\t\t\t\tiso_table, cc2NR[cc], cc, cc2name[cc]\n\t\t\t}\n\t\t}\n\t}\n\n\texit status\n}\n","avg_line_length":21.6172839506,"max_line_length":103,"alphanum_fraction":0.5308395203} {"size":321,"ext":"awk","lang":"Awk","max_stars_count":null,"content":"#!\/usr\/bin\/awk -f\nBEGIN {\n FS = \"[ \/^]+\"\n while ((\"git ls-remote \" ARGV[1] \"| sort -Vk2\") | getline) {\n if (!sha)\n sha = substr($0, 1, 7)\n tag = $3\n }\n while ((\"curl -s \" ARGV[1] \"\/releases\/tag\/\" tag) | getline)\n if ($3 ~ \"commits\")\n com = $2\n printf com ? \"%s-%s-g%s\\n\" : \"%s\\n\", tag, com, sha\n}\n","avg_line_length":22.9285714286,"max_line_length":62,"alphanum_fraction":0.46105919} {"size":642,"ext":"awk","lang":"Awk","max_stars_count":286.0,"content":"# This awk file converts a windows ini format file to an XML file\n# with root CustomNameTranslation, section names as XML tags and \n# included key=value pairs as value<\/key> under those tags.\n#\nBEGIN {\n print \"\"\n print \"\"\n tag=\"\"\n}\n\/^#\/{ next }\n\/^$\/{ next }\n\/\\[.*\\]\/{ \n if (tag != \"\")\n print \" <\/\" tag \">\";\n\n gsub(\/\\[\/, \"\");\n gsub(\/\\]\/, \"\");\n tag = $1;\n print \" <\" tag \">\";\n}\n\/.*=.*\/ { \n gsub(\/=\/, \" \");\n print \" <\" $1 \">\" $2 \"<\/\" $1 \">\"; \n}\nEND {\n if (tag != \"\")\n print \" <\/\" tag \">\";\n print \"<\/CustomNameTranslation>\"\n}\n","avg_line_length":21.4,"max_line_length":65,"alphanum_fraction":0.4828660436} {"size":2758,"ext":"awk","lang":"Awk","max_stars_count":1.0,"content":"# Description: awk script to translate a pair of object files to the corresponding pair of library archives, given a database of object files and archives\n# Usage: awk -f object_archive.awk -vdb=database_file < object-pair-list\n# Inputs: database_file has lines like \"obj.o libx.a\", input has lines like \"obj1.o obj2.o\"\n# Output: \"libx.a liby.a\" if database has \"obj1.o libx.a\" and \"obj2.o liby.a\", and input is \"obj1.o obj2.o\"\n# Application: convert partial ordering of object files generated by lorder into a partial ordering of library archives\n\n# The following license covers this software, including makefiles and documentation:\n\n# This software is covered by the zlib\/libpng license.\n# The zlib\/libpng license is a recognized open source license by the\n# Open Source Initiative: http:\/\/opensource.org\/licenses\/Zlib\n# The zlib\/libpng license is a recognized \"\\\"free\\\"\" software license by the\n# Free Software Foundation: https:\/\/directory.fsf.org\/wiki\/License:Zlib\n# ****************** Copyright notice (part of the license) *******************\n# $Id: ~\\|^` @(#)%M% copyright 2016 %Q%\\ object_archive.awk $\n# This software is provided 'as-is', without any express or implied warranty.\n# In no event will the authors be held liable for any damages arising from the\n# use of this software.\n#\n# Permission is granted to anyone to use this software for any purpose,\n# including commercial applications, and to alter it and redistribute it freely,\n# subject to the following restrictions:\n#\n# 1. The origin of this software must not be misrepresented; you must not claim\n# that you wrote the original software. If you use this software in a\n# product, an acknowledgment in the product documentation would be\n# appreciated but is not required.\n#\n# 2. Altered source versions must be plainly marked as such, and must not be\n# misrepresented as being the original software.\n#\n# 3. This notice may not be removed or altered from any source distribution.\n# ****************************** (end of license) ******************************\n# This is %M% version %I% dated %O%\n# You may send bug reports to %Y% with subject \"object_archive.awk\".\n# *****************************************************************************\n# maintenance note: master file %P%\n\nBEGIN {\n\tscript = \"%M% %I%\"\n\tif (script ~ \/[%]M[%] [%]I[%]\/)\n\t\tscript = \"object_archive.awk\"\n\tif (1 > length(db)) {\n\t\tprintf \"%s: database file (db) required\\n\", script >> \"\/dev\/stderr\"\n\t\texit 1\n\t}\n\twhile (0 < getline < db) {\n\t\tif ($0 ~ \/^[ \\t]*[#]\/) # ignore comment lines\n\t\t\tcontinue\n\t\tif ($0 ~ \/^[ \\t]*$\/) # ignore whitespace-only lines\n\t\t\tcontinue\n\t\tif (2 != NF) # ignore malformed input\n\t\t\tcontinue\n\t\tarch[$1 \"\"] = $2\n\t}\n}\n\n{\n\tprintf \"%s %s\\n\", arch[$1 \"\"], arch[$2 \"\"]\n\tnext\n}\n\nEND {\n}\n","avg_line_length":42.4307692308,"max_line_length":154,"alphanum_fraction":0.6649746193} {"size":626,"ext":"awk","lang":"Awk","max_stars_count":null,"content":"BEGIN { OFS=\"\\t\" }\n\n\/Invoice\/ {\n invoice=$2\n}\n\n\n\/[1-9].*Fuel.*100LL.*West\/ {\n invoice_line=$1\n nnumber=$6\n quantity=$7\n price=$11\n}\n\n\/Delivered\/ {\n date=$2\n time=$4\n getline;\n if($1!=\"Subtotal\") {\n gsub(\/^[ \\t]+\/, \"\", $0)\n gsub(\/[ \\t]+$\/,\"\",$0)\n gsub(\/Fuel requested by \/,\"\",$0)\n gsub(\/ - Pilot\/,\"\",$0)\n notes=$0\n }\n}\n\n# \/Pilot\/ {\n# notes=$0\n# }\n\n# \/Fuel requested by\/ {\n# notes=$0\n# }\n\n\/Total Due\/ {\n total=$3\n price=total\/quantity\n print date,time,invoice,invoice_line,\"KHPN\",\"Ross Aviation\",nnumber,quantity,price,total,notes,RPTNAME\n}\n\n\n\n\n\n","avg_line_length":13.6086956522,"max_line_length":106,"alphanum_fraction":0.4952076677} {"size":5146,"ext":"awk","lang":"Awk","max_stars_count":3.0,"content":"BEGIN {\n\t# $1 Book name\n\t# $2 Book abbreviation\n\t# $3 Book number\n\t# $4 Chapter number\n\t# $5 Verse number\n\t# $6 Verse\n\tFS = \"\\t\"\n\n\tMAX_WIDTH = 80\n\tif (ENVIRON[\"DRB_MAX_WIDTH\"] ~ \/^[0-9]+$\/) {\n\t\tif (int(ENVIRON[\"DRB_MAX_WIDTH\"]) < MAX_WIDTH) {\n\t\t\tMAX_WIDTH = int(ENVIRON[\"DRB_MAX_WIDTH\"])\n\t\t}\n\t}\n\n\tif (cmd == \"ref\") {\n\t\tmode = parseref(ref, p)\n\t\tp[\"book\"] = cleanbook(p[\"book\"])\n\t}\n}\n\ncmd == \"list\" {\n\tif (!($2 in seen_books)) {\n\t\tprintf(\"%s (%s)\\n\", $1, $2)\n\t\tseen_books[$2] = 1\n\t}\n}\n\nfunction parseref(ref, arr) {\n\t# 1. \n\t# 2. :?\n\t# 3. :?:\n\t# 3a. :?:[,]...\n\t# 4. :?-\n\t# 5. :?:-\n\t# 6. :?:-:\n\t# 7. \/\n\t# 8. \/search\n\t# 9. :?\/search\n\n\tif (match(ref, \"^[1-9]?[a-zA-Z ]+\")) {\n\t\t# 1, 2, 3, 3a, 4, 5, 6, 8, 9\n\t\tarr[\"book\"] = substr(ref, 1, RLENGTH)\n\t\tref = substr(ref, RLENGTH + 1)\n\t} else if (match(ref, \"^\/\")) {\n\t\t# 7\n\t\tarr[\"search\"] = substr(ref, 2)\n\t\treturn \"search\"\n\t} else {\n\t\treturn \"unknown\"\n\t}\n\n\tif (match(ref, \"^:?[1-9]+[0-9]*\")) {\n\t\t# 2, 3, 3a, 4, 5, 6, 9\n\t\tif (sub(\"^:\", \"\", ref)) {\n\t\t\tarr[\"chapter\"] = int(substr(ref, 1, RLENGTH - 1))\n\t\t\tref = substr(ref, RLENGTH)\n\t\t} else {\n\t\t\tarr[\"chapter\"] = int(substr(ref, 1, RLENGTH))\n\t\t\tref = substr(ref, RLENGTH + 1)\n\t\t}\n\t} else if (match(ref, \"^\/\")) {\n\t\t# 8\n\t\tarr[\"search\"] = substr(ref, 2)\n\t\treturn \"search\"\n\t} else if (ref == \"\") {\n\t\t# 1\n\t\treturn \"exact\"\n\t} else {\n\t\treturn \"unknown\"\n\t}\n\n\tif (match(ref, \"^:[1-9]+[0-9]*\")) {\n\t\t# 3, 3a, 5, 6\n\t\tarr[\"verse\"] = int(substr(ref, 2, RLENGTH - 1))\n\t\tref = substr(ref, RLENGTH + 1)\n\t} else if (match(ref, \"^-[1-9]+[0-9]*$\")) {\n\t\t# 4\n\t\tarr[\"chapter_end\"] = int(substr(ref, 2))\n\t\treturn \"range\"\n\t} else if (match(ref, \"^\/\")) {\n\t\t# 9\n\t\tarr[\"search\"] = substr(ref, 2)\n\t\treturn \"search\"\n\t} else if (ref == \"\") {\n\t\t# 2\n\t\treturn \"exact\"\n\t} else {\n\t\treturn \"unknown\"\n\t}\n\n\tif (match(ref, \"^-[1-9]+[0-9]*$\")) {\n\t\t# 5\n\t\tarr[\"verse_end\"] = int(substr(ref, 2))\n\t\treturn \"range\"\n\t} else if (match(ref, \"-[1-9]+[0-9]*\")) {\n\t\t# 6\n\t\tarr[\"chapter_end\"] = int(substr(ref, 2, RLENGTH - 1))\n\t\tref = substr(ref, RLENGTH + 1)\n\t} else if (ref == \"\") {\n\t\t# 3\n\t\treturn \"exact\"\n\t} else if (match(ref, \"^,[1-9]+[0-9]*\")) {\n\t\t# 3a\n\t\tarr[\"verse\", arr[\"verse\"]] = 1\n\t\tdelete arr[\"verse\"]\n\t\tdo {\n\t\t\tarr[\"verse\", substr(ref, 2, RLENGTH - 1)] = 1\n\t\t\tref = substr(ref, RLENGTH + 1)\n\t\t} while (match(ref, \"^,[1-9]+[0-9]*\"))\n\n\t\tif (ref != \"\") {\n\t\t\treturn \"unknown\"\n\t\t}\n\n\t\treturn \"exact_set\"\n\t} else {\n\t\treturn \"unknown\"\n\t}\n\n\tif (match(ref, \"^:[1-9]+[0-9]*$\")) {\n\t\t# 6\n\t\tarr[\"verse_end\"] = int(substr(ref, 2))\n\t\treturn \"range_ext\"\n\t} else {\n\t\treturn \"unknown\"\n\t}\n}\n\nfunction cleanbook(book) {\n\tbook = tolower(book)\n\tgsub(\" +\", \"\", book)\n\treturn book\n}\n\nfunction bookmatches(book, bookabbr, query) {\n\tbook = cleanbook(book)\n\tif (book == query) {\n\t\treturn book\n\t}\n\n\tbookabbr = cleanbook(bookabbr)\n\tif (bookabbr == query) {\n\t\treturn book\n\t}\n\n\tif (substr(book, 1, length(query)) == query) {\n\t\treturn book\n\t}\n}\n\nfunction printverse(verse, word_count, characters_printed) {\n\tif (ENVIRON[\"DRB_NOLINEWRAP\"] != \"\" && ENVIRON[\"DRB_NOLINEWRAP\"] != \"0\") {\n\t\tprintf(\"%s\\n\", verse)\n\t\treturn\n\t}\n\n\tword_count = split(verse, words, \" \")\n\tfor (i = 1; i <= word_count; i++) {\n\t\tif (characters_printed + length(words[i]) + (characters_printed > 0 ? 1 : 0) > MAX_WIDTH - 8) {\n\t\t\tprintf(\"\\n\\t\")\n\t\t\tcharacters_printed = 0\n\t\t}\n\t\tif (characters_printed > 0) {\n\t\t\tprintf(\" \")\n\t\t\tcharacters_printed++\n\t\t}\n\t\tprintf(\"%s\", words[i])\n\t\tcharacters_printed += length(words[i])\n\t}\n\tprintf(\"\\n\")\n}\n\nfunction processline() {\n\tif (last_book_printed != $2) {\n\t\tprint $1\n\t\tlast_book_printed = $2\n\t}\n\n\tif ($5 == \"\") {\n\t\tprintf(\"%d\\t\", $4)\n\t}\n\telse {\n\t\tprintf(\"%d:%d\\t\", $4, $5)\n\t}\n\tprintverse($6)\n\toutputted_records++\n}\n\ncmd == \"ref\" && mode == \"exact\" && bookmatches($1, $2, p[\"book\"]) && (p[\"chapter\"] == \"\" || $4 == p[\"chapter\"]) && (p[\"verse\"] == \"\" || $5 == p[\"verse\"]) {\n\tprocessline()\n}\n\ncmd == \"ref\" && mode == \"exact_set\" && bookmatches($1, $2, p[\"book\"]) && (p[\"chapter\"] == \"\" || $4 == p[\"chapter\"]) && p[\"verse\", $5] {\n\tprocessline()\n}\n\ncmd == \"ref\" && mode == \"range\" && bookmatches($1, $2, p[\"book\"]) && ((p[\"chapter_end\"] == \"\" && $4 == p[\"chapter\"]) || ($4 >= p[\"chapter\"] && $4 <= p[\"chapter_end\"])) && (p[\"verse\"] == \"\" || $5 >= p[\"verse\"]) && (p[\"verse_end\"] == \"\" || $5 <= p[\"verse_end\"]) {\n\tprocessline()\n}\n\ncmd == \"ref\" && mode == \"range_ext\" && bookmatches($1, $2, p[\"book\"]) && (($4 == p[\"chapter\"] && $5 >= p[\"verse\"] && p[\"chapter\"] != p[\"chapter_end\"]) || ($4 > p[\"chapter\"] && $4 < p[\"chapter_end\"]) || ($4 == p[\"chapter_end\"] && $5 <= p[\"verse_end\"] && p[\"chapter\"] != p[\"chapter_end\"]) || (p[\"chapter\"] == p[\"chapter_end\"] && $4 == p[\"chapter\"] && $5 >= p[\"verse\"] && $5 <= p[\"verse_end\"])) {\n\tprocessline()\n}\n\ncmd == \"ref\" && mode == \"search\" && (p[\"book\"] == \"\" || bookmatches($1, $2, p[\"book\"])) && (p[\"chapter\"] == \"\" || $4 == p[\"chapter\"]) && match(tolower($6), tolower(p[\"search\"])) {\n\tprocessline()\n}\n\nEND {\n\tif (cmd == \"ref\" && outputted_records == 0) {\n\t\tprint \"Unknown reference: \" ref\n\t}\n}\n","avg_line_length":23.8240740741,"max_line_length":393,"alphanum_fraction":0.5215701516} {"size":836,"ext":"awk","lang":"Awk","max_stars_count":null,"content":"#!\/usr\/bin\/awk -f\n\n# Usage: .\/process1.awk input | grep YAY | wc -l\n\nfunction ltrim(s) { sub(\/^[ \\t\\r\\n]+\/, \"\", s); return s }\nfunction rtrim(s) { sub(\/[ \\t\\r\\n]+$\/, \"\", s); return s }\nfunction trim(s) { return rtrim(ltrim(s)); }\n\nBEGIN {\nFS = \": \"\nprint \"\"\n}\n\n{\n print $1, \"|\", $2\n spacePos = index($1, \" \")\n countRange = substr($1,0,spacePos)\n letter = substr($1, spacePos+1)\n print countRange, letter\n split($2, chars, \"\")\n letterCount = 0\n for (i=1; i <= length($2); i++) {\n if (chars[i] == letter) {\n letterCount++\n }\n }\n print letterCount\n split(countRange, minmax, \"-\")\n min = int(minmax[1])\n max = int(minmax[2])\n print min, max\n if (letterCount >= min && letterCount <= max) {\n print \"YAY\"\n } else {\n print \"boo\"\n }\n}\n\nEND {\nprint \"\"\n}\n","avg_line_length":19.9047619048,"max_line_length":57,"alphanum_fraction":0.5059808612} {"size":92,"ext":"awk","lang":"Awk","max_stars_count":1.0,"content":"BEGIN {\n for (i= 2; i <= 8; i = i + 2) {\n print i\n }\n print \"Ain't never too late!\"\n}\n","avg_line_length":13.1428571429,"max_line_length":33,"alphanum_fraction":0.4565217391} {"size":364,"ext":"awk","lang":"Awk","max_stars_count":1349.0,"content":"#!\/bin\/awk -f\n\nfunction crash () {\n exit 1\n}\n\nfunction true (a,b,c) {\n return 1\n}\n\nBEGIN {\n if (ARGV[2] == 1) {\n print \" true(1, crash()) => crash properly.\"\n true(1, crash())\n\t# ADR: Added:\n\tdelete ARGV[2]\n }\n}\n\n{\n print \" true(1, crash()) => do not crash properly.\"\n true(1, crash())\n}\n\n# FdF\n","avg_line_length":14.0,"max_line_length":73,"alphanum_fraction":0.510989011} {"size":279,"ext":"awk","lang":"Awk","max_stars_count":460.0,"content":"# This file is part of the Astrometry.net suite.\n# Licensed under a 3-clause BSD style license - see LICENSE\n\n{\nprint \"{ .is_ngc = \" ($1 ? \"TRUE\" : \"FALSE\") \",\";\nprint \" .id = \" $2 \",\";\nprint \" .ra = \" $3 \",\";\nprint \" .dec = \" $4 \",\";\nprint \" .size = \" $5 \",\";\nprint \"},\";\n}\n","avg_line_length":23.25,"max_line_length":59,"alphanum_fraction":0.5161290323} {"size":62,"ext":"awk","lang":"Awk","max_stars_count":null,"content":"BEGIN {\n \"date\" | getline\n close(\"date\")\n print $0\n}\n","avg_line_length":10.3333333333,"max_line_length":20,"alphanum_fraction":0.5} {"size":5662,"ext":"awk","lang":"Awk","max_stars_count":1.0,"content":"# TAXDIFF.AWK compares a variable in two output files that are format\n# like Internet-TAXSIM generated output files\n# NOTE: this file must be in same directory as the taxdiffs.tcl file.\n# USAGE: awk -f taxdiff.awk -v col=NUM outfile1 outfile2 [dump=1]\n# NOTE: (a) the outfiles must have identical var[1] id variables;\n# (b) the outfiles must have at least NUM output variables per line;\n# (c) the difference is the variable value in outfile1 minus the\n# variable value in outfile2; and\n# (d) the maxdiff amount is the signed value of the largest absolute\n# value of all the variable differences.\n\nBEGIN {\n DUMP_MIN = 1 # absolute value of ovar4 difference must exceed this to dump\n file_number = 0\n file_name = \"\"\n if ( col == \"4-25\" ) {\n min_num_vars = 25\n col = 4\n net_eitc = 1\n } else {\n min_num_vars = col\n net_eitc = 0\n }\n error = 0\n if ( col < 2 || col > 28 ) {\n printf( \"ERROR: col=%d not in [2,28] range\\n\", col ) > \"\/dev\/stderr\"\n error = 1\n exit\n }\n}\nerror==1 { exit }\n\nFILENAME!=file_name {\n file_number++\n if ( file_number > 2 ) {\n printf( \"ERROR: more than two tax output files\\n\" ) > \"\/dev\/stderr\"\n error = 1\n exit\n }\n file_name = FILENAME\n}\n\nfile_number==1 {\n i1++\n if ( NF < min_num_vars ) {\n printf( \"ERROR: line %d in %s has fewer than %d variables\\n\",\n i1, file_name, min_num_vars ) > \"\/dev\/stderr\"\n error = 1\n exit\n }\n id1[i1] = $1\n if ( net_eitc == 1 ) {\n tax1[i1] = $4 + $25\n var1[i1] = $col + $25\n } else {\n tax1[i1] = $4\n var1[i1] = $col\n }\n}\n\nfile_number==2 {\n i2++\n if ( NF < min_num_vars ) {\n printf( \"ERROR: line %d in %s has fewer than %d variables\\n\",\n i2, file_name, min_num_vars ) > \"\/dev\/stderr\"\n error = 1\n exit\n }\n id2[i2] = $1\n if ( net_eitc == 1 ) {\n tax2[i2] = $4 + $25\n var2[i2] = $col + $25\n } else {\n tax2[i2] = $4\n var2[i2] = $col\n }\n}\n\nEND {\n if ( error==1 ) exit\n if ( i1 != i2 ) {\n printf( \"ERROR: %s %d != %s %d\\n\",\n \"first-output-file row count \", i1,\n \"second-output-file row count \", i2 ) > \"\/dev\/stderr\"\n exit\n }\n n = i2\n for ( i = 1; i <= n; i++ ) {\n if ( id1[i] != id2[i] ) {\n printf( \"ERROR: %s %d != %s %d on row %d\\n\",\n \"first-output-file id \", id1[i],\n \"second-output-file id \", id2[i], i ) > \"\/dev\/stderr\"\n exit\n }\n }\n num_diffs = 0\n num_small_diffs = 0\n num_big_vardiff_with_big_taxdiff = 0\n max_abs_vardiff = 0.0\n if ( col == 7 || col == 9 ) {\n smallamt = 0.011 # one-hundredth of a percentage point\n } else {\n smallamt = DUMP_MIN\n }\n small_taxdiff = DUMP_MIN\n for ( i = 1; i <= n; i++ ) {\n if ( var1[i] != var2[i] ) {\n diff = var1[i] - var2[i]\n if ( -smallamt <= diff && diff <= smallamt ) {\n num_small_diffs++\n } else {\n taxdiff = tax1[i] - tax2[i]\n if ( -small_taxdiff <= taxdiff && taxdiff <= small_taxdiff ) {\n # taxdiff is relatively small\n } else {\n num_big_vardiff_with_big_taxdiff++\n }\n }\n num_diffs++\n if ( diff < 0.0 ) abs_vardiff = -diff; else abs_vardiff = diff\n if ( col == 4 && dump == 1 && abs_vardiff > DUMP_MIN ) {\n printf( \"OVAR4-DUMP_MIN(%d):id,diff= %6d %9.2f\\n\",\n DUMP_MIN, id1[i], diff )\n }\n if ( abs_vardiff > max_abs_vardiff ) {\n max_abs_vardiff = abs_vardiff\n if ( diff < 0.0 ) {\n max_abs_vardiff_positive = 0\n } else {\n max_abs_vardiff_positive = 1\n }\n max_abs_vardiff_id = id1[i]\n }\n }\n } # end for i loop\n if ( net_eitc == 1 ) {\n colstr = \"4-\"\n } else {\n colstr = sprintf(\"%2s\", col)\n }\n if ( num_diffs > 0 ) {\n if ( max_abs_vardiff_positive == 1 ) {\n signed_max_abs_vardiff = max_abs_vardiff\n } else {\n signed_max_abs_vardiff = -max_abs_vardiff\n }\n printf( \"%s= %s %6d %6d %9.2f [%d]\\n\",\n \"TAXDIFF:ovar,#diffs,#smdiffs,maxdiff[id]\",\n colstr,\n num_diffs,\n num_small_diffs,\n signed_max_abs_vardiff,\n max_abs_vardiff_id )\n if ( num_big_vardiff_with_big_taxdiff > 0 ) {\n if ( col == 4 ) {\n num_big_diffs = num_diffs - num_small_diffs\n if ( num_big_vardiff_with_big_taxdiff != num_big_diffs ) {\n printf( \"ERROR: %s=%d != %s=%d\\n\",\n \"num_big_diffs\",\n num_big_diffs,\n \"num_big_vardiff_with_big_taxdiff\",\n num_big_vardiff_with_big_taxdiff )\n }\n printf( \"%s= %16d\\n\",\n \" #big_inctax_diffs\",\n num_big_diffs )\n } else {\n printf( \"%s= %16d\\n\",\n \" #big_vardiffs_with_big_inctax_diff\",\n num_big_vardiff_with_big_taxdiff )\n }\n }\n } else {\n printf( \"TAXDIFF:ovar= %s no-diffs\\n\",\n colstr )\n }\n}\n","avg_line_length":31.808988764,"max_line_length":78,"alphanum_fraction":0.4675026492} {"size":7933,"ext":"awk","lang":"Awk","max_stars_count":null,"content":"#! \/usr\/bin\/gawk -f\n###############################################################################\n# script name: filter_unicellular_ncbi.awk\n# path on oxygen: ?\n# developed by: Savvas Paragkamian\n# framework: PREGO - WP4\n###############################################################################\n# GOAL:\n# This script creates a tsv file with all the NCBI ids that are multicellular taxa and\n# thus have to be hidden from the PREGO interface.\n# This is the reverse script of the filter_multicellular_ncbi.awk. \n# The only difference between them is the negation in the line 139.\n###############################################################################\n# How to run\n# .\/filter_unicellular_ncbi.awk \\\n# \/data\/dictionary\/METdb_GENOMIC_REFERENCE_DATABASE_FOR_MARINE_SPECIES.csv \\\n# \/data\/dictionary\/database_groups.tsv > \/data\/dictionary\/prego_unicellular_ncbi.tsv\n###############################################################################\n\nBEGIN {\n\n ## Two conditional field separators. CAREFUL! \n FS=\"[\\t,]\"\n\n ## Bacteria and Archaea\n selected_microbe_high_level_taxa[2]=1; # tax id 2 stands for Bacteria\n selected_microbe_high_level_taxa[2157]=1; # tax id 2157 stands for Archea\n\n ## Unicellular Eukaryotes\n\n ## From supergroup Excavata\n\n selected_microbe_high_level_taxa[5719]=1; # tax id 5719 stands for phylum Parabasalia\n selected_microbe_high_level_taxa[5738]=1; # tax id 5738 stands for order Diplomonadida\n selected_microbe_high_level_taxa[66288]=1; # tax id 66288 stands for order Oxymonadida\n selected_microbe_high_level_taxa[193075]=1; # tax id 193075 stands for family Retortamonadidae\n selected_microbe_high_level_taxa[2611341]=1; # tax id 2611341 stands for clade Metamonada\n selected_microbe_high_level_taxa[207245]=1; # tax id 207245 stands for plylum Fornicata\n selected_microbe_high_level_taxa[136087]=1; # tax id 136087 stands for family Malawimonadidae\n selected_microbe_high_level_taxa[85705]=1; # tax id 85705 stands for family Ancyromonadidae\n selected_microbe_high_level_taxa[1294546]=1; # tax id 1294546 stands for family Planomonadidae\n\n\n ### From supergroup Excavata, clade Discoba (Discristates)\n selected_microbe_high_level_taxa[33682]=1; # tax id 2157 stands for phylum Euglenozoa\n selected_microbe_high_level_taxa[5752]=1; # tax id 5752 stands for phylum Heterolobosea (includes Percolomonadidae)\n selected_microbe_high_level_taxa[556282]=1; # tax id 556282 stands for order Jakobida\n selected_microbe_high_level_taxa[2711297]=1; # tax id 2711297 stands for order Tsukubamonadida\n\n ## From supergroup Archaeplastida\n\n selected_microbe_high_level_taxa[38254]=1; # tax id 38254 stands for class Glaucocystophyceae\n \n ### Rhodophycea, red algae\n selected_microbe_high_level_taxa[265318]=1; # tax id 265318 stands for order Cyanidiales\n selected_microbe_high_level_taxa[2798]=1; # tax id 2798 stands for order Porphyridiales\n selected_microbe_high_level_taxa[661027]=1; # tax id 661027 stands for class Rhodellophyceae\n selected_microbe_high_level_taxa[446134]=1; # tax id 446134 stands for class Stylonematophyceae\n\n ## From Chloroplastida \/ Viridiplantae\n selected_microbe_high_level_taxa[3166]=1; # tax id 3166 stands for class Chloropphyceae\n selected_microbe_high_level_taxa[2201463]=1; # tax id 2201463 stands for class Palmophyllophyceae, synonym of Prasinophyceae\n selected_microbe_high_level_taxa[3166]=1; # tax id 3166 stands for class Chloropphyceae\n selected_microbe_high_level_taxa[3166]=1; # tax id 3166 stands for class Chloropphyceae\n\n ## From Chromalveolata\n\n ### Alveolata\n \n selected_microbe_high_level_taxa[2864]=1; # tax id 2864 stands for class Dinophyceae\n selected_microbe_high_level_taxa[5794]=1; # tax id 5794 stands for class Apicomplexa\n selected_microbe_high_level_taxa[5878]=1; # tax id 5878 stands for phylum Ciliophora\n\n ### Stramenopiles\n \n selected_microbe_high_level_taxa[238765]=1; # tax id 238765 stands for class Actinophryidae\n selected_microbe_high_level_taxa[33849]=1; # tax id 33849 stands for class Bacillariophyceae\n selected_microbe_high_level_taxa[35131]=1; # tax id 35131 stands for class Labyrinthulomycetes\n selected_microbe_high_level_taxa[33651]=1; # tax id 33651 stands for order Bicosoecida\n\n ### Chromobionta\n selected_microbe_high_level_taxa[2833]=1; # tax id 2833 stands for class Xanthophyceae\n selected_microbe_high_level_taxa[38410]=1; # tax id 38410 stands for class Raphidophyceae\n selected_microbe_high_level_taxa[157124]=1; # tax id 157124 stands for class Pinguiophyceae\n selected_microbe_high_level_taxa[33849]=1; # tax id 33849 stands for class Bacillariophyceae\n selected_microbe_high_level_taxa[589449]=1; # tax id 589449 stands for class Mediophyceae\n selected_microbe_high_level_taxa[33836]=1; # tax id 33836 stands for class Coscinodiscophyceae\n selected_microbe_high_level_taxa[91989]=1; # tax id 91989 stands for class Bolidophyceae\n selected_microbe_high_level_taxa[35675]=1; # tax id 35675 stands for class Pelagophyceae\n selected_microbe_high_level_taxa[2825]=1; # tax id 2825 stands for class Chrysophyceae\n selected_microbe_high_level_taxa[33859]=1; # tax id 33859 stands for class Synurophyceae\n selected_microbe_high_level_taxa[557229]=1; # tax id 557229 stands for class Synchromophyceae\n selected_microbe_high_level_taxa[2825]=1; # tax id 2825 stands for class Chrysophyceae\n selected_microbe_high_level_taxa[39119]=1; # tax id 39119 stands for class Dictyochophyceae\n\n ### Haptophyta\n selected_microbe_high_level_taxa[2830]=1; # tax id 2830 stands for class Haptophyta\n\n ## Unikonts\n\n ### Opistrhokonta\n\n selected_microbe_high_level_taxa[127916]=1; # tax id 127916 stands for class Ichthyosporea (Mesomycetozoa)\n selected_microbe_high_level_taxa[6029]=1; # tax id 6029 stands for class Microsporidia (unicellular Fungi)\n selected_microbe_high_level_taxa[4890]=1; # tax id 4890 stands for phylum Ascomycota (they contain some multicellular)\n selected_microbe_high_level_taxa[28009]=1; # tax id 28009 stands for class Choanoflagellata\n\n ### Amoebozoa\n \n selected_microbe_high_level_taxa[555369]=1; # tax id 555369 stands for phylum Tubulinea (Lobosea)\n selected_microbe_high_level_taxa[555406]=1; # tax id 555406 stands for clade Archamoebae\n selected_microbe_high_level_taxa[142796]=1; # tax id 142796 stands for class Mycetozoa (Eumycetozoa, they contain some multicellular)\n\n ## Cryptobionta\n\n selected_microbe_high_level_taxa[3027]=1; # tax id 3027 stands for class Cryptophyceae\n selected_microbe_high_level_taxa[339960]=1; # tax id 339960 stands for order Kathablepharidacea\n selected_microbe_high_level_taxa[419944]=1; # tax id 419944 stands for phylum Picozoa\n\n ## Rhizaria\n \n selected_microbe_high_level_taxa[543769]=1; # tax id 543769 stands for clade Rhizaria\n\n}\n# Load the METdb A GENOMIC REFERENCE DATABASE FOR MARINE SPECIES data in associative array.\n(ARGIND==1 && NR>1){\n \n gsub(\/\"\/,\"\",$10)\n selected_microbe_high_level_taxa[$10]=1;\n\n}\n# load the database_groups.tsv from the dictionary\n# and check if parent microbes are in the selected_microbe_high_level_taxa\n# and print keep the children column (second)\n(ARGIND==2 && $1==-2){\n\n all_taxa[$2]=1;\n\n if ($4 in selected_microbe_high_level_taxa){\n\n microbe_taxa[$2]=1;\n\n }\n\n}\nEND{\n\n # Print all taxa if and only if they are included in the microbe taxa array.\n for (tax_id in all_taxa){\n\n if (tax_id in microbe_taxa){\n\n print -2 \"\\t\" tax_id;\n\n }\n }\n # Print the ids for the parent taxa of unicellular microbes\n for (selected_microbes in selected_microbe_high_level_taxa){\n\n print -2 \"\\t\" selected_microbes;\n\n }\n}\n","avg_line_length":48.3719512195,"max_line_length":139,"alphanum_fraction":0.7278457078} {"size":303,"ext":"awk","lang":"Awk","max_stars_count":2.0,"content":"BEGIN{\n OFS=\",\";\n}\nNR==1{\n print $0;\n}\nNR>1&&$1!=\"\"{\n split($4, report_date, \"\\\/\");\n split($5, confirm_date, \"\\\/\");\n printf \"%d,%s,%s,%04d-%02d-%02d,%04d-%02d-%02d,\", $1, $2, $3, report_date[1], report_date[2],report_date[3],\n confirm_date[1],confirm_date[2],confirm_date[3];\n print $6, $7, $8;\n}","avg_line_length":23.3076923077,"max_line_length":110,"alphanum_fraction":0.5577557756} {"size":12409,"ext":"awk","lang":"Awk","max_stars_count":1.0,"content":"####################################################################\n# Translate.awk #\n####################################################################\n\nfunction provides(engineName) {\n Translator[tolower(engineName)] = TRUE\n}\n\nfunction engineMethod(methodName, engine, translator) {\n if (!Translator[Option[\"engine\"]]) {\n # case-insensitive match engine name\n engine = tolower(Option[\"engine\"])\n if (!Translator[engine]) # fuzzy match engine name\n for (translator in Translator)\n if (Translator[translator] && # there IS such a translator\n translator ~ \"^\"engine) {\n engine = translator\n break\n }\n if (!Translator[engine]) {\n e(\"[ERROR] Translator not found: \" Option[\"engine\"] \"\\n\" \\\n \" Run '-list-engines \/ -S' to see a list of available engines.\")\n exit 1\n }\n Option[\"engine\"] = engine\n }\n return Option[\"engine\"] methodName\n}\n\n# Detect external audio player (mplayer, mpv, mpg123).\nfunction initAudioPlayer() {\n AudioPlayer = !system(\"mpv\" SUPOUT SUPERR) ?\n \"mpv --no-config\" :\n (!system(\"mplayer\" SUPOUT SUPERR) ?\n \"mplayer\" :\n (!system(\"mpg123 --version\" SUPOUT SUPERR) ?\n \"mpg123\" :\n \"\"))\n}\n\n# Detect external speech synthesizer (say, espeak).\nfunction initSpeechSynthesizer() {\n SpeechSynthesizer = !system(\"say ''\" SUPOUT SUPERR) ?\n \"say\" :\n (!system(\"espeak ''\" SUPOUT SUPERR) ?\n \"espeak\" :\n \"\")\n}\n\n# Detect external terminal pager (less, more, most).\nfunction initPager() {\n Pager = !system(\"less -V\" SUPOUT SUPERR) ?\n \"less\" :\n (!system(\"more -V\" SUPOUT SUPERR) ?\n \"more\" :\n (!system(\"most\" SUPOUT SUPERR) ?\n \"most\" :\n \"\"))\n}\n\n# Initialize `HttpService`.\nfunction initHttpService() {\n _Init()\n\n if (Option[\"proxy\"]) {\n match(Option[\"proxy\"], \/^(http:\\\/*)?(([^:]+):([^@]+)@)?([^\\\/]*):([^\\\/:]*)\/, HttpProxySpec)\n HttpAuthUser = HttpProxySpec[3]\n HttpAuthPass = HttpProxySpec[4]\n HttpAuthCredentials = base64(unquote(HttpAuthUser) \":\" HttpAuthPass)\n HttpService = \"\/inet\/tcp\/0\/\" HttpProxySpec[5] \"\/\" HttpProxySpec[6]\n HttpPathPrefix = HttpProtocol HttpHost\n } else {\n HttpService = \"\/inet\/tcp\/0\/\" HttpHost \"\/\" HttpPort\n HttpPathPrefix = \"\"\n }\n}\n\n# Pre-process string (URL-encode before send).\nfunction preprocess(text) {\n return quote(text)\n}\n\n# [OBSOLETE] Is this function still relevant?\n# Post-process string (remove any redundant whitespace).\nfunction postprocess(text) {\n text = gensub(\/ ([.,;:?!\"])\/, \"\\\\1\", \"g\", text)\n text = gensub(\/([\"]) \/, \"\\\\1\", \"g\", text)\n return text\n}\n\n# Send an HTTP GET request and get response from an online translator.\nfunction getResponse(text, sl, tl, hl,\n ####\n content, header, isBody, url, group, status, location) {\n url = _RequestUrl(text, sl, tl, hl)\n\n header = \"GET \" url \" HTTP\/1.1\\r\\n\" \\\n \"Host: \" HttpHost \"\\r\\n\" \\\n \"Connection: close\\r\\n\"\n if (Option[\"user-agent\"])\n header = header \"User-Agent: \" Option[\"user-agent\"] \"\\r\\n\"\n if (Cookie)\n header = header \"Cookie: \" Cookie \"\\r\\n\"\n if (HttpAuthUser && HttpAuthPass)\n # TODO: digest auth\n header = header \"Proxy-Authorization: Basic \" HttpAuthCredentials \"\\r\\n\"\n\n content = NULLSTR; isBody = 0\n print header |& HttpService\n while ((HttpService |& getline) > 0) {\n if (isBody)\n content = content ? content \"\\n\" $0 : $0\n else if (length($0) <= 1)\n isBody = 1\n else { # interesting fields in header\n match($0, \/^HTTP[^ ]* ([^ ]*)\/, group)\n if (RSTART) status = group[1]\n match($0, \/^Location: (.*)\/, group)\n if (RSTART) location = squeeze(group[1]) # squeeze the URL!\n }\n l(sprintf(\"%4s bytes > %s\", length($0), $0))\n }\n close(HttpService)\n\n if ((status == \"301\" || status == \"302\") && location)\n content = curl(location)\n\n return assert(content, \"[ERROR] Null response.\")\n}\n\n# Send an HTTP POST request and return response from an online translator.\nfunction postResponse(text, sl, tl, hl, type,\n ####\n content, contentLength, contentType, group,\n header, isBody, reqBody, url, status, location) {\n url = _PostRequestUrl(text, sl, tl, hl, type)\n contentType = _PostRequestContentType(text, sl, tl, hl, type)\n reqBody = _PostRequestBody(text, sl, tl, hl, type)\n if (DumpContentengths[reqBody])\n contentLength = DumpContentengths[reqBody]\n else\n contentLength = DumpContentengths[reqBody] = dump(reqBody, group)\n\n header = \"POST \" url \" HTTP\/1.1\\r\\n\" \\\n \"Host: \" HttpHost \"\\r\\n\" \\\n \"Connection: close\\r\\n\" \\\n \"Content-Length: \" contentLength \"\\r\\n\" \\\n \"Content-Type: \" contentType \"\\r\\n\" # must!\n if (Option[\"user-agent\"])\n header = header \"User-Agent: \" Option[\"user-agent\"] \"\\r\\n\"\n if (Cookie)\n header = header \"Cookie: \" Cookie \"\\r\\n\"\n if (HttpAuthUser && HttpAuthPass)\n # TODO: digest auth\n header = header \"Proxy-Authorization: Basic \" HttpAuthCredentials \"\\r\\n\"\n\n content = NULLSTR; isBody = 0\n print (header \"\\r\\n\" reqBody) |& HttpService\n while ((HttpService |& getline) > 0) {\n if (isBody)\n content = content ? content \"\\n\" $0 : $0\n else if (length($0) <= 1)\n isBody = 1\n else { # interesting fields in header\n match($0, \/^HTTP[^ ]* ([^ ]*)\/, group)\n if (RSTART) status = group[1]\n match($0, \/^Location: (.*)\/, group)\n if (RSTART) location = squeeze(group[1]) # squeeze the URL!\n }\n l(sprintf(\"%4s bytes > %s\", length($0), $0))\n }\n close(HttpService)\n\n if (status == \"404\") {\n e(\"[ERROR] 404 Not Found\")\n exit 1\n }\n if ((status == \"301\" || status == \"302\") && location) {\n url = \"https\" substr(url, 5) # switch to HTTPS; don't use location!\n content = curlPost(url, reqBody)\n }\n\n return content\n}\n\n# Print a string (to output file or terminal pager).\nfunction p(string) {\n if (Option[\"view\"])\n print string | Option[\"pager\"]\n else\n print string > Option[\"output\"]\n}\n\n# Play using a Text-to-Speech engine.\nfunction play(text, tl, url) {\n url = _TTSUrl(text, tl)\n\n # Don't use getline from pipe here - the same pipe will be run only once for each AWK script!\n system(Option[\"player\"] \" \" parameterize(url) SUPOUT SUPERR)\n}\n\n# Download audio from a Text-to-Speech engine.\nfunction download_audio(text, tl, url, output) {\n url = _TTSUrl(text, tl)\n\n if (Option[\"download-audio-as\"])\n output = Option[\"download-audio-as\"]\n else\n output = text \" [\" Option[\"engine\"] \"] (\" Option[\"narrator\"] \").ts\"\n\n if (url ~ \/^\\\/\/)\n system(\"mv -- \" parameterize(url) \" \" parameterize(output))\n else\n curl(url, output)\n}\n\n# Get the translation of a string.\nfunction getTranslation(text, sl, tl, hl,\n isVerbose, toSpeech, returnPlaylist, returnIl) {\n return _Translate(text, sl, tl, hl,\n isVerbose, toSpeech, returnPlaylist, returnIl)\n}\n\n# Translate a file.\nfunction fileTranslation(uri, group, temp1, temp2) {\n temp1 = Option[\"input\"]\n temp2 = Option[\"verbose\"]\n\n match(uri, \/^file:\\\/\\\/(.*)\/, group)\n Option[\"input\"] = group[1]\n Option[\"verbose\"] = 0\n\n translateMain()\n\n Option[\"input\"] = temp1\n Option[\"verbose\"] = temp2\n}\n\n# Start a browser session and translate a web page.\nfunction webTranslation(uri, sl, tl, hl, temp) {\n temp = _WebTranslateUrl(uri, sl, tl, hl)\n if (temp)\n system(Option[\"browser\"] \" \" parameterize(temp) SUPOUT SUPERR)\n}\n\n# Translate the source text (into all target languages).\nfunction translate(text, inline,\n ####\n i, j, playlist, il, saveSortedIn) {\n\n if (!getCode(Option[\"hl\"])) {\n # Check if home language is supported\n w(\"[WARNING] Unknown language code: \" Option[\"hl\"] \", fallback to English: en\")\n Option[\"hl\"] = \"en\" # fallback to English\n } else if (isRTL(Option[\"hl\"])) {\n # Check if home language is R-to-L\n if (!FriBidi)\n w(\"[WARNING] \" getName(Option[\"hl\"]) \" is a right-to-left language, but FriBidi is not found.\")\n }\n\n if (!getCode(Option[\"sl\"])) {\n # Check if source language is supported\n w(\"[WARNING] Unknown source language code: \" Option[\"sl\"])\n } else if (isRTL(Option[\"sl\"])) {\n # Check if source language is R-to-L\n if (!FriBidi)\n w(\"[WARNING] \" getName(Option[\"sl\"]) \" is a right-to-left language, but FriBidi is not found.\")\n }\n\n saveSortedIn = PROCINFO[\"sorted_in\"]\n PROCINFO[\"sorted_in\"] = \"@ind_num_asc\"\n for (i in Option[\"tl\"]) {\n # Non-interactive verbose mode: separator between targets\n if (!Option[\"interactive\"])\n if (Option[\"verbose\"] && i > 1)\n p(prettify(\"target-seperator\", replicate(Option[\"chr-target-seperator\"], Option[\"width\"])))\n\n if (inline &&\n startsWithAny(text, UriSchemes) == \"file:\/\/\") {\n # translate URL only from command-line parameters (inline)\n fileTranslation(text)\n } else if (inline &&\n startsWithAny(text, UriSchemes) == \"http:\/\/\" ||\n startsWithAny(text, UriSchemes) == \"https:\/\/\") {\n # translate URL only from command-line parameters (inline)\n webTranslation(text, Option[\"sl\"], Option[\"tl\"][i], Option[\"hl\"])\n } else {\n if (!Option[\"no-translate\"])\n p(getTranslation(text, Option[\"sl\"], Option[\"tl\"][i], Option[\"hl\"], Option[\"verbose\"], Option[\"play\"] || Option[\"download-audio\"], playlist, il))\n else\n il[0] = Option[\"sl\"] == \"auto\" ? \"en\" : Option[\"sl\"]\n\n if (Option[\"play\"] == 1) {\n if (Option[\"player\"])\n for (j in playlist)\n play(playlist[j][\"text\"], playlist[j][\"tl\"])\n else if (SpeechSynthesizer)\n for (j in playlist)\n print playlist[j][\"text\"] | SpeechSynthesizer\n } else if (Option[\"play\"] == 2) {\n if (Option[\"player\"])\n play(text, il[0])\n else if (SpeechSynthesizer)\n print text | SpeechSynthesizer\n }\n\n if (Option[\"download-audio\"] == 1) {\n # Download the translation unless used with -sp or -no-trans\n if (Option[\"play\"] != 2 && !Option[\"no-translate\"])\n download_audio(playlist[length(playlist) - 1][\"text\"], \\\n playlist[length(playlist) - 1][\"tl\"])\n else\n download_audio(text, il[0])\n }\n }\n }\n PROCINFO[\"sorted_in\"] = saveSortedIn\n}\n\n# Read from input and translate each line.\nfunction translateMain( i, line) {\n if (Option[\"interactive\"])\n prompt()\n\n if (Option[\"input\"] == STDIN || fileExists(Option[\"input\"])) {\n i = 0\n while (getline line < Option[\"input\"])\n if (line) {\n # Non-interactive verbose mode: separator between sources\n if (!Option[\"interactive\"])\n if (Option[\"verbose\"] && i++ > 0)\n p(prettify(\"source-seperator\",\n replicate(Option[\"chr-source-seperator\"],\n Option[\"width\"])))\n\n if (Option[\"interactive\"])\n repl(line)\n else\n translate(line)\n } else {\n # Non-interactive brief mode: preserve line breaks\n if (!Option[\"interactive\"])\n if (!Option[\"verbose\"])\n p(line)\n }\n } else\n e(\"[ERROR] File not found: \" Option[\"input\"])\n}\n","avg_line_length":35.5558739255,"max_line_length":161,"alphanum_fraction":0.5272785881} {"size":2871,"ext":"awk","lang":"Awk","max_stars_count":4.0,"content":"# USB Header script\n#\n# Copyright 2006-2012, Haiku.\n# Distributed under the terms of the MIT License.\n#\n# Authors:\n#\t\tJohn Drinkwater, john@nextraweb.com\n#\n# Use with http:\/\/www.linux-usb.org\/usb.ids\n# run as: awk -v HEADERFILE=usbhdr.h -f usb-header.awk usb.ids\n\nBEGIN {\n\n\t# field separator, defining because user could have overridden\n\tFS = \" \"\n\n\t# Pass this in from outside with -v HEADERFILE=filenametouse\n\t# we require usbhdr.h for our system\n\tofile = HEADERFILE\n\n\t# possibly use this in the future\n\tcleanvalues = \"[^A-Za-z0-9{}\\\"'&@?!*.,:;+<> \\\\t\\\\\/_\\\\[\\\\]=#()-]\"\n\t# ToDo: currently IDs aren't checked, we dumbly assume the source is clean\n\n\t# descriptive output header\n\tprint \"#if 0\" > ofile\n\tprint \"#\\tUSBHDR.H: USB Vendors, Devices\\n#\" > ofile\n\tprint \"#\\tGenerated by usb-header.awk, source data from the following URI:\\n#\\thttp:\/\/www.linux-usb.org\/usb.ids\\n#\" > ofile\n\tprint \"#\\tHeader created on \" strftime( \"%A, %d %b %Y %H:%M:%S %Z\", systime() ) > ofile\n\tprint \"#endif\" > ofile\n\n\t# and we start with vendors..\n\tprint \"\\ntypedef struct _USB_VENTABLE\\n{\\n\\tunsigned short\\tVenId ;\\n\\tconst char *\\tVenName ;\\n} USB_VENTABLE, *PUSB_VENTABLE ;\\n\" > ofile\n\tprint \"USB_VENTABLE\\tUsbVenTable [] =\\n{\" > ofile\n}\n\n# matches vendor - starts with an id as first thing on the line\n# because this occurs first in the header file, we output it without worry\n\/^[[:xdigit:]][[:xdigit:]][[:xdigit:]][[:xdigit:]] \/ { \n\n\tif ( vendorcount++ > 0 ) { \n\t\tformatting = \",\\n\"\n\t} else {\n\t\tformatting = \"\"\n\t}\n\n\t# store vendor ID for possible devices afterwards\n\tvendorid = $1\n\tvendor = substr($0, 7)\n\tgsub( \/\\\"\/, \"&&\", vendor )\n\n\tprintf formatting \"\\t{ 0x\" vendorid \", \\\"\" vendor \"\\\" }\" > ofile\n}\n\n# matches device \n\/^\\t[[:xdigit:]][[:xdigit:]][[:xdigit:]][[:xdigit:]] \/ { \n\n\tdevice = substr($0, 8)\n\tgsub( \/\\\\\/, \"&&\", device )\n\tgsub( \/\\\"\/, \"&&\", device )\n\n\t# store device ID for possible devices afterwards\n\tdeviceid = $1\n\tdevicecount++\n\tdevices[devicecount, 1] = vendorid\n\tdevices[devicecount, 2] = $1\n\tdevices[devicecount, 3] = device \n}\n\n# We've processed the file, now output.\nEND {\n\n\tprint \"\\n};\\n\\n\/\/ Use this value for loop control during searching:\\n#define\\tUSB_VENTABLE_LEN\\t(sizeof(UsbVenTable)\/sizeof(USB_VENTABLE))\\n\" > ofile\n\n\tif ( devicecount > 0 ) {\n\n\t\tprint \"typedef struct _USB_DEVTABLE\\n{\\n\\tunsigned short\tVenId ;\\n\\tunsigned short\tDevId ;\\n\\tconst char *\\tChipDesc ;\\n} USB_DEVTABLE, *PUSB_DEVTABLE ;\\n\" > ofile\n\t\tprint \"USB_DEVTABLE\\tUsbDevTable [] =\\n{\" > ofile\n\t\tfor (i = 1; i <= devicecount; i++) {\n\n\t\t\tif (i != 1) {\n\t\t\t\tformatting = \",\\n\"\n\t\t\t} else {\n\t\t\t\tformatting = \"\"\n\t\t\t}\n\t\t\tprintf formatting \"\\t{ 0x\" devices[i, 1] \", 0x\" devices[i, 2] \", \\\"\" devices[i, 3] \"\\\" }\" > ofile\n\t\t}\n\t\tprint \"\\n} ;\\n\\n\/\/ Use this value for loop control during searching:\\n#define\tUSB_DEVTABLE_LEN\t(sizeof(UsbDevTable)\/sizeof(USB_DEVTABLE))\\n\" > ofile\n\n\t}\n\t\n\tclose(ofile)\n}\n\n\n","avg_line_length":29.90625,"max_line_length":167,"alphanum_fraction":0.6478578892} {"size":1713,"ext":"awk","lang":"Awk","max_stars_count":null,"content":"# PURPOSE: Modify baseline EnergyPlus idf file in order to add energy\n# conservation measures (ECM).\n#\n# This is accomplished by using the following two markers:\n#\n# 1. Replace ECMXX ::\n# 2. Delete ECMXX ::\n#\n# 'XX' is normally a two digit ECM measure number. This allows one to easily have\n# several ECMs accounted for in a single file.\n#\n#\n# USAGE:\n# awk -f ecm_replace.awk -v ecm=01 file\n#\n# OPTIONS:\n# inc = Make this anything besides 0 to include all 'previous' measures\n#\nBEGIN {\n replace_text = \"Replace ECM\"\n replace_text_length = length(replace_text)\n ecm = ecm + 0\n}\n\n{\n match_index = match($0, replace_text \"[0-9]*\")\n\n if (match_index) {\n found_ecm = substr($0, RSTART + replace_text_length, RLENGTH - replace_text_length) + 0\n\n # inc is a passed in variable for 'including' previous ecms.\n # Many programs like to have a stacked savings approach.\n matches_ecm = inc + 0 ? found_ecm <= ecm : found_ecm == ecm\n\n print (matches_ecm ? substr($0, RSTART + RLENGTH + 4) : $0)\n }\n else {\n\n match_delete_index = match($0, \/Delete ECM[0-9]*\/)\n\n if (match_delete_index) {\n found_ecm = substr($0, RSTART + replace_text_length, RLENGTH - replace_text_length) + 0\n # inc is a passed in variable for 'including' previous ecms.\n # Many programs like to have a stacked savings approach.\n matches_ecm = inc ? found_ecm <= ecm : found_ecm == ecm\n\n # If it doesn't apply, print the line\n if (!matches_ecm) { print }\n }\n else {\n # If we don't match a delete, then it's just an ordinary line\n # and print it out.\n print\n }\n }\n}\n","avg_line_length":30.0526315789,"max_line_length":99,"alphanum_fraction":0.6205487449} {"size":2407,"ext":"awk","lang":"Awk","max_stars_count":4.0,"content":"#!\/usr\/bin\/awk -f\n\nBEGIN {\n\t_bitwise_init();\n}\n\n# NOTE: we want to \"normalize\" all the parsed line as binary operation so that\n# evaluation is easier to implement, so assignation and bitwise complement are\n# actually rewritten in an equivalent binary operation.\n\n# assign\n\/^([a-z]+|[0-9]+) -> [a-z]+$\/ {\n\tsrc = $1;\n\tdest = $3;\n\t# x & 0xffff == x\n\toperation[dest] = \"AND\" FS src FS 65535; # 0xffff\n}\n\n# unary op\n\/^NOT ([a-z]+|[0-9]+) -> [a-z]+$\/ {\n\tsrc = $2;\n\tdest = $4;\n\t# x ^ 0xffff == ~x\n\toperation[dest] = \"XOR\" FS src FS 65535; # 0xffff\n}\n\n# binary op\n\/^([a-z]+|[0-9]+) (AND|OR|LSHIFT|RSHIFT) ([a-z]+|[0-9]+) -> [a-z]+$\/ {\n\tlhs = $1;\n\top = $2;\n\trhs = $3;\n\tdest = $5;\n\toperation[dest] = op FS lhs FS rhs;\n}\n\nEND {\n\tprint solve(\"a\");\n}\n\nfunction solve(x, expr, rhs, lhs) {\n\tif (x ~ \/[0-9]+\/)\n\t\treturn int(x);\n\t# if we already know the signal for x we don't need to compute it.\n\tif (signal[x])\n\t\treturn signal[x];\n\tsplit(operation[x], expr);\n\t# expr is now like [\"AND\", \"42\", \"y\"]\n\tlhs = solve(expr[2]);\n\trhs = solve(expr[3]);\n\treturn signal[x] = eval(lhs, expr[1], rhs);\n}\n\n# actually evaluate the result of the operator op applied to lhs and rhs.\nfunction eval(lhs, op, rhs) {\n\tif (op == \"AND\")\n\t\treturn bw_and(lhs, rhs);\n\telse if (op == \"OR\")\n\t\treturn bw_or(lhs, rhs);\n\telse if (op == \"XOR\")\n\t\treturn bw_xor(lhs, rhs);\n\telse if (op == \"LSHIFT\")\n\t\treturn bw_lshift(lhs, rhs) % (2 ^ 16);\n\telse if (op == \"RSHIFT\")\n\t\treturn bw_rshift(lhs, rhs);\n}\n\nfunction bw_rshift(x, n) {\n\treturn int(x \/ (2 ^ n));\n}\n\nfunction bw_lshift(x, n) {\n\treturn x * (2 ^ n);\n}\n\nfunction bw_and(x, y, i, r) {\n\tfor (i = 0; i < 16; i += 4) {\n\t\tr = r \/ (2 ^ 4) + bw_lookup[\"and\", x % 16, y % 16] * (2 ^ 12);\n\t\tx = int(x \/ (2 ^ 4));\n\t\ty = int(y \/ (2 ^ 4));\n\t}\n\treturn r;\n}\n\nfunction bw_or(x, y, i, r) {\n\tfor (i = 0; i < 16; i += 4) {\n\t\tr = r \/ (2 ^ 4) + bw_lookup[\"or\", x % 16, y % 16] * (2 ^ 12);\n\t\tx = int(x \/ (2 ^ 4));\n\t\ty = int(y \/ (2 ^ 4));\n\t}\n\treturn r;\n}\n\nfunction bw_xor(x, y) {\n\treturn (x + y - 2 * bw_and(x, y));\n}\n\nfunction _bitwise_init( a, b, x, y, i) {\n\t# generate the bw_lookup table used by bw_and() and bw_or().\n\tfor (a = 0; a < 16; a++) {\n\t\tfor (b = 0; b < 16; b++) {\n\t\t\tx = a;\n\t\t\ty = b;\n\t\t\tfor (i = 0; i < 4; i++) {\n\t\t\t\tbw_lookup[\"and\", a, b] += ((x % 2) && (y % 2)) * (2 ^ i);\n\t\t\t\tbw_lookup[\"or\", a, b] += ((x % 2) || (y % 2)) * (2 ^ i);\n\t\t\t\tx = int(x \/ 2);\n\t\t\t\ty = int(y \/ 2);\n\t\t\t}\n\t\t}\n\t}\n}\n","avg_line_length":21.4910714286,"max_line_length":78,"alphanum_fraction":0.5164104695} {"size":1790,"ext":"awk","lang":"Awk","max_stars_count":null,"content":"#\n# SPDX-License-Identifier: BSD-2-Clause-FreeBSD\n#\n# Copyright 2016 Baptiste Daroussin \n#\n# Redistribution and use in source and binary forms, with or without\n# modification, are permitted provided that the following conditions\n# are met:\n# 1. Redistributions of source code must retain the above copyright\n# notice, this list of conditions and the following disclaimer.\n# 2. Redistributions in binary form must reproduce the above copyright\n# notice, this list of conditions and the following disclaimer in the\n# documentation and\/or other materials provided with the distribution.\n#\n# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n# SUCH DAMAGE.\n#\n# $FreeBSD$\n\nBEGIN {\n\tprint \"# Warning: Do not edit. This is automatically extracted\"\n\tprint \"# from CLDR project data, obtained from http:\/\/cldr.unicode.org\/\"\n\tprint \"# -----------------------------------------------------------------------------\"\n}\n$1 == \"comment_char\" { print }\n$1 == \"escape_char\" { print }\n$1 == \"LC_COLLATE\" { doprint = 1 }\ndoprint == 1 { print }\n$1 == \"END\" && $2 == \"LC_COLLATE\" { exit 0 }\n","avg_line_length":45.8974358974,"max_line_length":88,"alphanum_fraction":0.7162011173} {"size":393,"ext":"awk","lang":"Awk","max_stars_count":null,"content":"BEGIN { FS=OFS=\",\" }\n\n{\n\n # Remove all quoting\n gsub(\"\\\"\", \"\")\n\n header = $1\n\n numwords = split($2, keywords, \"|\")\n numtypes = split($3, type, \"|\")\n\n for (i = 1; i <= numwords; i++) {\n\n keyword = keywords[i]\n\n numsplit = split(keyword, ind_keys, \/\\.+\/)\n\n for (j = 1; j <= numsplit; j++) {\n print header, ind_keys[j], type[i]\n }\n }\n}\n","avg_line_length":16.375,"max_line_length":50,"alphanum_fraction":0.4478371501} {"size":30509,"ext":"awk","lang":"Awk","max_stars_count":7.0,"content":"#!\/bin\/gawk\n# Checks that a file is valid.\n\nfunction error(fname, linum, msg) {\n printf \"%s:%d: %s\\n\", fname, linum, msg;\n if (0) print; # for debug\n}\nfunction _matchFile(fname) {\n return fname ~ \"\/mondrian\/\" \\\n || fname ~ \"\/org\/olap4j\/\" \\\n || fname ~ \"\/aspen\/\" \\\n || fname ~ \"\/farrago\/\" \\\n || fname ~ \"\/fennel\/\" \\\n || fname ~ \"\/extensions\/\" \\\n || fname ~ \"\/com\/sqlstream\/\" \\\n || fname ~ \"\/linq4j\/\" \\\n || fname ~ \"\/lambda\/\" \\\n || fname ~ \"\/optiq\/\" \\\n || strict > 0;\n}\nfunction _isCpp(fname) {\n return fname ~ \/\\.(cpp|h)$\/;\n}\nfunction _isJava(fname) {\n return fname ~ \/\\.(java|jj)$\/;\n}\nfunction _isMondrian(fname) {\n return fname ~ \/mondrian\/;\n}\nfunction _isOlap4j(fname) {\n return fname ~ \"\/org\/olap4j\/\";\n}\nfunction push(val) {\n switchStack[switchStackLen++] = val;\n}\nfunction pop() {\n --switchStackLen\n val = switchStack[switchStackLen];\n delete switchStack[switchStackLen];\n return val;\n}\nfunction afterFile() {\n # Compute basename. If fname=\"\/foo\/bar\/baz.txt\" then basename=\"baz.txt\".\n basename = fname;\n gsub(\".*\/\", \"\", basename);\n gsub(lf, \"\", lastNonEmptyLine);\n terminator = \"\/\/ End \" basename;\n if (matchFile && (lastNonEmptyLine != terminator)) {\n error(fname, FNR, sprintf(\"Last line should be %c%s%c\", 39, terminator, 39));\n }\n}\n# Returns whether there are unmatched open parentheses.\n# unmatchedOpenParens(\"if ()\") returns false.\n# unmatchedOpenParens(\"if (\") returns true.\n# unmatchedOpenParens(\"if (foo) bar(\") returns false\nfunction unmatchedOpenParens(s) {\n i = index(s, \"(\");\n if (i == 0) {\n return 0;\n }\n openCount = 1;\n while (++i <= length(s)) {\n c = substr(s, i, 1);\n if (c == \"(\") {\n ++openCount;\n }\n if (c == \")\") {\n if (--openCount == 0) {\n return 0;\n }\n }\n }\n return 1;\n}\n\nfunction openMinusClose(s) {\n o = 0;\n i = 0;\n while (++i <= length(s)) {\n c = substr(s, i, 1);\n if (c == \"(\") {\n ++o;\n }\n if (c == \")\") {\n --o;\n }\n }\n return o;\n}\n\nfunction countLeadingSpaces(str) {\n i = 0;\n while (i < length(str) && substr(str, i + 1, 1) == \" \") {\n ++i;\n }\n return i;\n}\n\nfunction checkIndent(str) {\n return str % indent == 0;\n}\n\nfunction startsWith(s, p) {\n return length(s) > length(p) \\\n && substr(s, 1, length(p)) == p;\n}\n\nBEGIN {\n # pre-compute regexp for quotes, linefeed\n apos = sprintf(\"%c\", 39);\n quot = sprintf(\"%c\", 34);\n lf = sprintf(\"%c\", 13);\n pattern = apos \"(\\\\\" apos \"|[^\" apos \"])\" apos;\n if (0) printf \"maxLineLength=%s strict=%s\\n\", maxLineLength, strict;\n}\nFNR == 1 {\n if (fname) {\n afterFile();\n }\n fname = FILENAME;\n matchFile = _matchFile(fname);\n isCpp = _isCpp(fname);\n isJava = _isJava(fname);\n mondrian = _isMondrian(fname);\n prevImport = \"\";\n prevImportGroup = \"\";\n indent = (fname ~ \/avatica\/ || fname ~ \/linq4j\/ || fname ~ \/optiq\/ || fname ~ \/eigenbase\/) ? 2 : 4;\n cindent = 4;\n publicClassBraceLine = 0;\n publicClassSeen = 0;\n\n delete headers;\n headerSkip = 0;\n headerCount = 0;\n if ($0 ~ \/Generated By:JavaCC\/ \\\n || $0 ~ \/This class is generated\/) {\n # generated; skip whole file\n nextfile\n } else if (fname ~ \/XmlaOlap4jDriverVersion.java\/ \\\n || fname ~ \/package-info.java\/ \\\n || fname ~ \/MondrianOlap4jDriverVersion.java\/ \\\n || fname ~ \/MondrianTestRunner.java\/ \\\n || fname ~ \/MondrianResultPrinter.java\/) {\n # generated; does not contain standard header\n } else if (mondrian) {\n headers[headerCount++] = \"\/\\\\*$\";\n headers[headerCount++] = \"\/\/ This software is subject to the terms of the Eclipse Public License v1.0$\";\n headers[headerCount++] = \"\/\/ Agreement, available at the following URL:$\";\n headers[headerCount++] = \"\/\/ http:\/\/www.eclipse.org\/legal\/epl-v10.html.$\";\n headers[headerCount++] = \"\/\/ You must accept the terms of that agreement to use this software.$\";\n headers[headerCount++] = \"\/\/$\";\n headers[headerCount++] = \"\/\/ Copyright \\\\(C\\\\) [0-9]*-[0-9]* Pentaho\";\n headers[headerCount++] = \"\/\/ All Rights Reserved.$\";\n } else if (1) {\n headers[headerCount++] = \"\/\\\\*$\";\n headers[headerCount++] = \"\/\/ Licensed to Julian Hyde under one or more contributor license$\";\n headers[headerCount++] = \"\/\/ agreements. See the NOTICE file distributed with this work for$\";\n headers[headerCount++] = \"\/\/ additional information regarding copyright ownership.$\";\n headers[headerCount++] = \"\/\/$\";\n headers[headerCount++] = \"\/\/ Julian Hyde licenses this file to you under the Apache License,$\";\n headers[headerCount++] = \"\/\/ Version 2.0 \\\\(the \\\"License\\\"\\\\); you may not use this file except in$\";\n headers[headerCount++] = \"\/\/ compliance with the License. You may obtain a copy of the License at:$\";\n headers[headerCount++] = \"\/\/$\";\n headers[headerCount++] = \"\/\/ http:\/\/www.apache.org\/licenses\/LICENSE-2.0$\";\n headers[headerCount++] = \"\/\/$\";\n headers[headerCount++] = \"\/\/ Unless required by applicable law or agreed to in writing, software$\";\n headers[headerCount++] = \"\/\/ distributed under the License is distributed on an \\\"AS IS\\\" BASIS,$\";\n headers[headerCount++] = \"\/\/ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.$\";\n headers[headerCount++] = \"\/\/ See the License for the specific language governing permissions and$\";\n headers[headerCount++] = \"\/\/ limitations under the License.$\";\n headers[headerCount++] = \"*\/$\";\n }\n}\nFNR - headerSkip <= headerCount {\n if ($0 !~ headers[FNR - headerSkip - 1]) {\n if ($0 ~ \/Copyright\/) {\n ++headerSkip;\n } else {\n error(fname, FNR, \"Does not match expected header line: \" headers[FNR - headerSkip - 1] \"\\n\");\n printf \"0: [%s]\\n\", $0;\n headerCount = 0; # prevent further errors from this file\n }\n }\n}\npublicClassBraceLine && FNR == publicClassBraceLine + 1 {\n # Adopt indent=2 if the first line in the first public class seems\n # to have indent 2.\n if (indent == 4 && $0 ~ \/^ [^ ]\/) {\n indent = 2;\n }\n}\n\/\\\\n\" \\+\/ {\n if (strict > 1) {\n error(fname, FNR, \"Linefeed in string should be at end of line\");\n }\n}\n\/^ +{\/ {\n if (indent != cindent) {\n error(fname, FNR, \"Open brace should be at end of previous line\");\n }\n}\n\/@author\/ {\n if (indent != cindent) {\n error(fname, FNR, \"@author tag not allowed\");\n }\n}\n{\n if (previousLineEndedInCloseBrace > 0) {\n --previousLineEndedInCloseBrace;\n }\n if (previousLineEndedInOpenBrace > 0) {\n --previousLineEndedInOpenBrace;\n }\n if (previousLineWasEmpty > 0) {\n --previousLineWasEmpty;\n }\n s = $0;\n # remove DOS linefeeds\n gsub(lf, \"\", s);\n # replace strings\n gsub(\/\"(\\\\\"|[^\"\\\\]|\\\\[^\"])*\"\/, \"string\", s);\n # replace single-quoted strings\n gsub(pattern, \"string\", s);\n # replace {: and :} in .cup files\n if (fname ~ \/\\.cup$\/) {\n gsub(\/{:\/, \"{\", s);\n gsub(\/:}\/, \"}\", s);\n gsub(\/:\/, \" : \", s);\n }\n if (inComment && s ~ \/\\*\\\/\/) {\n # end of multiline comment \"*\/\"\n inComment = 0;\n gsub(\/^.*\\*\\\/\/, \"\/* comment *\/\", s);\n } else if (inComment) {\n s = \"\/* comment *\/\";\n } else if (s ~ \/\\\/\\*\/ && s !~ \/\\\/\\*.*\\*\\\/\/) {\n # beginning of multiline comment \"\/*\"\n inComment = 1;\n if (strict > 1 && FNR > 1 && s !~ \/\\\/\\*\\*\/ && s !~ \/^\\\/\\*\/) {\n error(fname, FNR, \"Multi-line c-style comment not allowed\" s);\n }\n gsub(\/\\\/\\*.*$\/, \"\/* comment *\/\", s);\n } else {\n # mask out \/* *\/ comments\n gsub(\/\\\/\\*.*\\*\\\/\/, \"\/* comment *\/\", s);\n }\n if (mondrian && s ~ \/\\\/\\\/\\$NON-NLS\/) {\n error(fname, FNR, \"NON-NLS not allowed\");\n }\n if (s ~ \/\\\/\\\/[A-Za-z]\/ && strict > 1) {\n if (s ~ \/noinspection\/) {} # e.g. '\/\/noinspection unchecked'\n else if (s ~ \/;$\/) {} # e.g. '\/\/int dummy = 0;'\n else if (s ~ \/:\\\/\\\/\/) {} # e.g. '\/\/ http:\/\/'\n else error(fname, FNR, \"Need space after \/\/\");\n }\n # mask out \/\/ comments\n gsub(\/\\\/\\\/.*$\/, \"\/\/ comment\", s);\n # line starts with string or plus?\n if (s ~ \/^ *string\/ \\\n && openMinusClose(s) >= 0)\n {\n# error(fname, FNR, \"start string\");\n stringCol = index(s, \"string\");\n } else if (s ~ \/^ *[+] \/) {\n# error(fname, FNR, \"in string\" stringCol);\n if (stringCol != 0 && index(s, \"+\") != stringCol) {\n error(fname, FNR, \"String '+' must be aligned with string on line above\");\n }\n } else if (s ~ \/comment\/) {\n # in comment; string target carries forward\n } else {\n# error(fname, FNR, \"not in string \" s)\n stringCol = 0;\n }\n\n # Is the line indented as expected?\n if (nextIndent > 0) {\n x = countLeadingSpaces(s);\n if (x != nextIndent) {\n error(fname, FNR, \"Incorrect indent for first line of arg list\");\n }\n }\n nextIndent = -1;\n}\n\/ $\/ {\n error(fname, FNR, \"Line ends in space\");\n}\n\/[\\t]\/ {\n if (matchFile) {\n error(fname, FNR, \"Tab character\");\n }\n}\n\/[\\r]\/ {\n if (matchFile) {\n error(fname, FNR, \"Carriage return character (file is in DOS format?)\");\n }\n}\n\/.\/ {\n lastNonEmptyLine = $0;\n}\n{\n # Rules beyond this point only apply to Java and C++.\n if (!isCpp && !isJava) {\n next;\n }\n}\n\n\/^package \/ {\n thisPackage = $2;\n}\n\/^package \/ && previousLineWasEmpty {\n error(fname, FNR, \"'package' declaration must not occur after empty line\");\n}\n\/^import \/ {\n if (previousLineWasEmpty) {\n prevImport = \"\";\n } else {\n if (!prevImport) {\n error(fname, FNR, \"Expected blank line before first import\");\n }\n }\n thisImport = $2;\n gsub(\/;\/, \"\", thisImport);\n gsub(\/\\*\/, \"\", thisImport);\n if (thisPackage ~ \/^mondrian.*\/ && thisImport ~ \/^mondrian.*\/) {\n importGroup = \"a:mondrian\";\n } else if (thisPackage ~ \/^net.hydromatic.*\/ && thisImport ~ \/^net.hydromatic.*\/) {\n importGroup = \"a:net.hydromatic\";\n } else if (thisPackage ~ \/^org.olap4j.*\/ && thisImport ~ \/^org.olap4j.*\/) {\n importGroup = \"a:org.olap4j\";\n } else if (thisImport ~ \/^static\/) {\n importGroup = \"z:static\";\n } else if (thisImport ~ \/^java.*\/) {\n if (thisPackage ~ \/^org.eigenbase.*\/) {\n importGroup = \"aa:java\";\n } else {\n importGroup = \"y:java\";\n }\n } else if (thisImport ~ \/^junit.*\/) {\n importGroup = \"b:junit\";\n } else if (thisImport ~ \/^mondrian.*\/) {\n importGroup = \"bb:mondrian\";\n } else if (thisImport ~ \/^org.olap4j.xmla.server.*\/) {\n importGroup = \"bc:org.olap4j.xmla.server\";\n } else if (thisImport ~ \/^openjava.*\/) {\n importGroup = \"cc:openjava\";\n } else if (thisImport ~ \/^org.apache.*\/) {\n importGroup = \"c:org.apache\";\n } else if (thisImport ~ \/^org.eigenbase.*\/) {\n importGroup = \"d:org.eigenbase\";\n } else if (thisImport ~ \/^org.olap4j.*\/) {\n importGroup = \"e:org.olap4j\";\n } else {\n importGroup = \"f:other\";\n }\n if (importGroup != prevImportGroup \\\n && prevImportGroup)\n {\n if (!previousLineWasEmpty) {\n error(fname, FNR, \"Expected blank line between import groups\");\n } else if (prevImportGroup > importGroup) {\n error(fname, FNR, \"Import group out of sequence (should precede \" \\\n substr(prevImportGroup, index(prevImportGroup, \":\") + 1) \")\");\n }\n } else if (prevImport \\\n && prevImport > thisImport \\\n && !startsWith(prevImport, thisImport) \\\n && !startsWith(thisImport, prevImport))\n {\n error(fname, FNR, \"Import out of sorted order\");\n }\n prevImport = thisImport;\n prevImportGroup = importGroup;\n lastImport = FNR;\n}\n\/.\/ && !\/^import\/ && lastImport {\n if (lastImport != FNR - 2 && strict > 1) {\n error(fname, FNR, \"need precisely 1 blank line after last import\");\n }\n lastImport = 0;\n}\n\/^\\\/\\\/ Copyright .* Pentaho\/ && strict > 1 {\n # We assume that '--strict' is only invoked on files currently being\n # edited. Therefore we would expect the copyright to be current.\n if ($0 !~ \/-2014\/) {\n error(fname, FNR, \"copyright is not current\");\n }\n}\n\/(static|public|private|protected|final|abstract)\/ && !\/import\/ && strict > 1 {\n # Order of qualifiers: \"public\/private\/protected static final abstract class ...\"\n s2 = s;\n gsub(\/\\(.*$\/, \"\", s2);\n if (s2 ~ \/abstract .*final \/) {\n error(fname, FNR, \"'final' must come before 'abstract'\");\n }\n if (s2 ~ \/final .*static \/) {\n error(fname, FNR, \"'static' must come before 'final'\");\n }\n if (s2 ~ \/abstract .*static \/) {\n error(fname, FNR, \"'static' must come before 'abstract'\");\n }\n if (s2 ~ \/static .*(public|protected|private) \/) {\n error(fname, FNR, \"'public\/private\/protected' must come before 'static'\");\n }\n if (s2 ~ \/final .*(public|protected|private) \/) {\n error(fname, FNR, \"'public\/private\/protected' must come before 'final'\");\n }\n if (s2 ~ \/abstract .*(public|protected|private) \/) {\n error(fname, FNR, \"'public\/private\/protected' must come before 'abstract'\");\n }\n}\n\/^$\/ {\n if (matchFile && previousLineEndedInOpenBrace) {\n error(fname, FNR, \"Empty line following open brace\");\n }\n}\n\/^ +}( catch| finally| while|[;,)])\/ ||\n\/^ +}$\/ {\n if (matchFile && previousLineWasEmpty) {\n error(fname, FNR - 1, \"Empty line before close brace\");\n }\n}\ns ~ \/\\.*;$\/ {\n if (!matchFile) {}\n else {\n error(fname, FNR, \"if followed by statement on same line\");\n }\n}\ns ~ \/\\<(if) *\\(\/ {\n if (!matchFile) {\n } else if (s !~ \/\\<(if) \/) {\n error(fname, FNR, \"if must be followed by space\");\n } else if (s ~ \/ else if \/) {\n } else if (s ~ \/^#if \/) {\n } else if (!checkIndent(s)) {\n error(fname, FNR, \"if must be correctly indented\");\n }\n}\ns ~ \/\\<(while) *\\(\/ {\n if (!matchFile) {\n } else if (s !~ \/\\<(while) \/) {\n error(fname, FNR, \"while must be followed by space\");\n } else if (s ~ \/} while \/) {\n } else if (!checkIndent(s)) {\n error(fname, FNR, \"while must be correctly indented\");\n }\n}\ns ~ \/\\<(for|switch|synchronized|} catch) *\\(\/ {\n if (!matchFile) {}\n else if (!checkIndent(s)) {\n error(fname, FNR, \"for\/switch\/synchronized\/catch must be correctly indented\");\n } else if (s !~ \/\\<(for|switch|synchronized|} catch) \/) {\n error(fname, FNR, \"for\/switch\/synchronized\/catch must be followed by space\");\n }\n}\ns ~ \/\\<(if|while|for|switch|catch)\\>\/ {\n # Check single-line if statements, such as\n # if (condition) return;\n # We recognize such statements because there are equal numbers of open and\n # close parentheses.\n opens = s;\n gsub(\/[^(]\/, \"\", opens);\n closes = s;\n gsub(\/[^)]\/, \"\", closes);\n if (!matchFile) {\n } else if (s ~ \/{( *\\\/\\\/ comment)?$\/) {\n # lines which end with { and optional comment are ok\n } else if (s ~ \/{.*\\\\$\/ && isCpp) {\n # lines which end with backslash are ok in c++ macros\n } else if (s ~ \/} while\/) {\n # lines like \"} while (foo);\" are ok\n } else if (s ~ \/^#\/) {\n # lines like \"#if 0\" are ok\n } else if (s ~ \/if \\(true|false\\)\/) {\n # allow \"if (true)\" and \"if (false)\" because they are\n # used for commenting\n } else if (!unmatchedOpenParens(s) \\\n && length($0) != 79 \\\n && length($0) != 80)\n {\n error(fname, FNR, \"single-line if\/while\/for\/switch\/catch must end in {\");\n }\n}\ns ~ \/[[:alnum:]]\\(\/ &&\ns !~ \/\\<(if|while|for|switch|assert)\\>\/ {\n ss = s;\n while (match(ss, \/[[:alnum:]]\\(\/)) {\n ss = substr(ss, RSTART + RLENGTH - 1);\n parens = ss;\n gsub(\/[^()]\/, \"\", parens);\n while (substr(parens, 1, 2) == \"()\") {\n parens = substr(parens, 3);\n }\n opens = parens;\n gsub(\/[^(]\/, \"\", opens);\n closes = parens;\n gsub(\/[^)]\/, \"\", closes);\n if (length(opens) > length(closes)) {\n if (ss ~ \/,$\/) {\n bras = ss;\n gsub(\/[^<]\/, \"\", bras);\n kets = ss;\n gsub(\/->\/, \"\", kets);\n gsub(\/[^>]\/, \"\", kets);\n if (length(bras) > length(kets)) {\n # Ignore case like 'for (Map.Entry entry : ...'\n } else if (s ~ \/ for \/) {\n # Ignore case like 'for (int i = 1,{nl} j = 2; i < j; ...'\n } else if (indent == cindent) {\n error( \\\n fname, FNR, \\\n \"multi-line parameter list should start with newline\");\n break;\n }\n } else if (s ~ \/[;(]( *\\\\)?$\/) {\n # If open paren is at end of line (with optional backslash\n # for macros), we're fine.\n } else if (s ~ \/@.*\\({\/) {\n # Ignore Java annotations.\n } else if (indent == cindent) {\n error( \\\n fname, FNR, \\\n \"Open parenthesis should be at end of line (function call spans several lines)\");\n break;\n }\n }\n ss = substr(ss, 2); # remove initial \"(\"\n }\n}\ns ~ \/\\\/ {\n push(switchCol);\n switchCol = index($0, \"switch\");\n}\ns ~ \/{\/ {\n braceCol = index($0, \"{\");\n if (braceCol == switchCol) {\n push(switchCol);\n }\n}\ns ~ \/}\/ {\n braceCol = index($0, \"}\");\n if (braceCol == switchCol) {\n switchCol = pop();\n }\n}\ns ~ \/\\<(case|default)\\>\/ {\n caseDefaultCol = match($0, \/case|default\/);\n if (!matchFile) {}\n else if (caseDefaultCol != switchCol) {\n error(fname, FNR, \"case\/default must be aligned with switch\");\n }\n}\ns ~ \/\\\/ {\n if (!matchFile) {}\n else if (isCpp) {} # rule only applies to java\n else if (!checkIndent(s)) {\n error(fname, FNR, \"assert must be correctly indented\");\n } else if (s !~ \/\\\/ {\n if (!matchFile) {}\n else if (isCpp && s ~ \/^#\/) {\n # ignore macros\n } else if (!checkIndent(s)) {\n error(fname, FNR, \"return must be correctly indented\");\n } else if (s !~ \/\\\/ {\n if (!matchFile) {}\n else if (isCpp) {\n # cannot yet handle C++ cases like 'void foo() throw(int)'\n } else if (!checkIndent(s)) {\n error(fname, FNR, \"throw must be correctly indented\");\n } else if (s !~ \/\\\/ {\n if (!matchFile) {}\n else if (isCpp && s ~ \/^# *else$\/) {} # ignore \"#else\"\n else if (!checkIndent(s)) {\n error(fname, FNR, \"else must be correctly indented\");\n } else if (s !~ \/^ +} else (if |{$|{ *\\\/\\\/|{ *\\\/\\*)\/) {\n error(fname, FNR, \"else must be preceded by } and followed by { or if\");\n }\n}\ns ~ \/\\\/ {\n if (!matchFile) {}\n else if (!checkIndent(s)) {\n error(fname, FNR, \"do must be correctly indented\");\n } else if (s !~ \/^ *do {\/) {\n error(fname, FNR, \"do must be followed by space {\");\n }\n}\ns ~ \/\\\/ {\n if (!matchFile) {}\n else if (!checkIndent(s)) {\n error(fname, FNR, \"try must be correctly indented\");\n } else if (s !~ \/^ +try {\/) {\n error(fname, FNR, \"try must be followed by space {\");\n }\n}\ns ~ \/\\\/ {\n if (!matchFile) {}\n else if (!checkIndent(s)) {\n error(fname, FNR, \"catch must be correctly indented\");\n } else if (s !~ \/^ +} catch \/) {\n error(fname, FNR, \"catch must be preceded by } and followed by space\");\n }\n}\ns ~ \/\\\/ {\n if (!matchFile) {}\n else if (!checkIndent(s)) {\n error(fname, FNR, \"finally must be correctly indented\");\n } else if (s !~ \/^ +} finally {\/) {\n error(fname, FNR, \"finally must be preceded by } and followed by space {\");\n }\n}\ns ~ \/\\($\/ {\n nextIndent = countLeadingSpaces(s) + cindent;\n if (s ~ \/ (if|while) .*\\(.*\\(\/ && indent == cindent) {\n nextIndent += indent;\n }\n}\nmatch(s, \/([]A-Za-z0-9()])(+|-|\\*|\\^|\\\/|%|=|==|+=|-=|\\*=|\\\/=|>=|<=|!=|&|&&|\\||\\|\\||^|\\?|:) *[A-Za-z0-9(]\/, a) {\n # < and > are not handled here - they have special treatment below\n if (!matchFile) {}\n# else if (s ~ \/<.*>\/) {} # ignore templates\n else if (a[2] == \"-\" && s ~ \/\\(-\/) {} # ignore case \"foo(-1)\"\n else if (a[2] == \"-\" && s ~ \/[eE][+-][0-9]\/) {} # ignore e.g. 1e-5\n else if (a[2] == \"+\" && s ~ \/[eE][+-][0-9]\/) {} # ignore e.g. 1e+5\n else if (a[2] == \":\" && s ~ \/(case.*|default):$\/) {} # ignore e.g. \"case 5:\"\n else if (isCpp && s ~ \/[^ ][*&]\/) {} # ignore e.g. \"Foo* p;\" in c++ - debatable\n else if (isCpp && s ~ \/\\\" in c++\n else {\n error(fname, FNR, \"operator '\" a[2] \"' must be preceded by space\");\n }\n}\nmatch(s, \/([]A-Za-z0-9() ] *)(+|-|\\*|\\^|\\\/|%|=|==|+=|-=|\\*=|\\\/=|>=|<=|!=|&|&&|\\||\\|\\||^|\\?|:|,)[A-Za-z0-9(]\/, a) {\n if (!matchFile) {}\n# else if (s ~ \/<.*>\/) {} # ignore templates\n else if (a[2] == \"-\" && s ~ \/(\\(|return |case |= )-\/) {} # ignore prefix -\n else if (a[2] == \":\" && s ~ \/(case.*|default):$\/) {} # ignore e.g. \"case 5:\"\n else if (s ~ \/, *-\/) {} # ignore case \"foo(x, -1)\"\n else if (s ~ \/-[^ ]\/ && s ~ \/[^A-Za-z0-9] -\/) {} # ignore case \"x + -1\" but not \"x -1\" or \"3 -1\"\n else if (a[2] == \"-\" && s ~ \/[eE][+-][0-9]\/) {} # ignore e.g. 1e-5\n else if (a[2] == \"+\" && s ~ \/[eE][+-][0-9]\/) {} # ignore e.g. 1e+5\n else if (a[2] == \"*\" && isCpp && s ~ \/\\*[^ ]\/) {} # ignore e.g. \"Foo *p;\" in c++\n else if (a[2] == \"&\" && isCpp && s ~ \/&[^ ]\/) {} # ignore case \"foo(&x)\" in c++\n else if (isCpp && s ~ \/\\\" in c++\n else if (strict < 2 && fname ~ \/(fennel)\/ && a[1] = \",\") {} # not enabled yet\n else {\n error(fname, FNR, \"operator '\" a[2] \"' must be followed by space\");\n }\n}\nmatch(s, \/( )(,)\/, a) {\n # (, < and > are not handled here - they have special treatment below\n if (!matchFile) {}\n else {\n error(fname, FNR, \"operator '\" a[2] \"' must not be preceded by space\");\n }\n}\nmatch(s, \/ (+|-|\\*|\\\/|==|>=|<=|!=|<<|<<<|>>|&|&&|\\|\\||\\?|:)$\/, a) || \\\nmatch(s, \/(\\.|->)$\/, a) {\n if (strict < 2 && fname ~ \/(aspen)\/ && a[1] != \":\") {} # not enabled yet\n else if (strict < 2 && fname ~ \/(fennel|farrago|aspen)\/ && a[1] = \"+\") {} # not enabled yet\n else if (a[1] == \":\" && s ~ \/(case.*|default):$\/) {\n # ignore e.g. \"case 5:\"\n } else if ((a[1] == \"*\" || a[1] == \"&\") && isCpp && s ~ \/^[[:alnum:]:_ ]* [*&]$\/) {\n # ignore e.g. \"const int *\\nClass::Subclass2::method(int x)\"\n } else {\n error(fname, FNR, \"operator '\" a[1] \"' must not be at end of line\");\n }\n}\nmatch(s, \/^ *(=) \/, a) {\n error(fname, FNR, \"operator '\" a[1] \"' must not be at start of line\");\n}\nmatch(s, \/([[:alnum:]~]+)( )([(])\/, a) {\n # (, < and > are not handled here - they have special treatment below\n if (!matchFile) {}\n else if (isJava && a[1] ~ \/\\<(if|while|for|catch|switch|case|return|throw|synchronized|assert)\\>\/) {}\n else if (isCpp && a[1] ~ \/\\<(if|while|for|catch|switch|case|return|throw|operator|void|PBuffer)\\>\/) {}\n else if (isCpp && s ~ \/^#define \/) {}\n else {\n error(fname, FNR, \"there must be no space before '\" a[3] \"' in fun call or fun decl\");\n }\n}\ns ~ \/\\<[[:digit:][:lower:]][[:alnum:]_]*<\/ {\n # E.g. \"p<\" but not \"Map<\"\n if (!matchFile) {}\n else if (isCpp) {} # in C++ 'xyz<5>' could be a template\n else {\n error(fname, FNR, \"operator '<' must be preceded by space\");\n }\n}\ns ~ \/\\<[[:digit:][:lower:]][[:alnum:]_]*>\/ {\n # E.g. \"g>\" but not \"String>\" as in \"List\"\n if (!matchFile) {}\n else if (isCpp) {} # in C++ 'xyz' could be a template\n else {\n error(fname, FNR, \"operator '>' must be preceded by space\");\n }\n}\nmatch(s, \/<([[:digit:][:lower:]][[:alnum:].]*)\\>\/, a) {\n if (!matchFile) {}\n else if (isCpp) {\n # in C++, template and include generate too many false positives\n } else if (isJava && a[1] ~ \/(int|char|long|boolean|byte|double|float)\/) {\n # Allow e.g. 'List'\n } else if (isJava && a[1] ~ \/^[[:lower:]]+\\.\/) {\n # Allow e.g. 'List'\n } else {\n error(fname, FNR, \"operator '<' must be followed by space\");\n }\n}\nmatch(s, \/^(.*[^-])>([[:digit:][:lower:]][[:alnum:]]*)\\>\/, a) {\n if (!matchFile) {}\n else if (isJava && a[1] ~ \/.*\\.<.*\/) {\n # Ignore 'Collections.member'\n } else {\n error(fname, FNR, \"operator '>' must be followed by space\");\n }\n}\ns ~ \/[[(] \/ {\n if (!matchFile) {}\n else if (s ~ \/[[(] +\\\\$\/) {} # ignore '#define foo( \\'\n else {\n error(fname, FNR, \"( or [ must not be followed by space\");\n }\n}\ns ~ \/ [])]\/ {\n if (!matchFile) {}\n else if (s ~ \/^ *\\)\/ && previousLineEndedInCloseBrace) {} # ignore \"bar(new Foo() { } );\"\n else {\n error(fname, FNR, \") or ] must not be preceded by space\");\n }\n}\ns ~ \/}\/ {\n if (!matchFile) {}\n else if (s !~ \/}( |;|,|$|\\)|\\.)\/) {\n error(fname, FNR, \"} must be followed by space\");\n } else if (s !~ \/^ *}\/) {\n # not at start of line - ignore\n } else if (!checkIndent(s)) {\n error(fname, FNR, \"} must be correctly indented\");\n }\n}\n$0 ~ \/\\* @param [A-Za-z0-9_]+$\/ && strict > 1 {\n error(fname, FNR, \"Empty javadoc param\");\n}\n$0 ~ \/\\* @return *$\/ && strict > 1 {\n error(fname, FNR, \"Empty javadoc return\");\n}\ns ~ \/{\/ {\n if (!matchFile) {}\n else if (s ~ \/(\\]\\)?|=) *{\/) {} # ignore e.g. \"(int[]) {1, 2}\" or \"int[] x = {1, 2}\"\n else if (s ~ \/\\({\/) {} # ignore e.g. @SuppressWarnings({\"unchecked\"})\n else if (s ~ \/{ *(\\\/\\\/|\\\/\\*)\/) {} # ignore e.g. \"do { \/\/ a comment\"\n else if (s ~ \/ \\{\\}$\/) {} # ignore e.g. \"Constructor() {}\"\n else if (s ~ \/ },$\/) {} # ignore e.g. \"{ yada },\"\n else if (s ~ \/ };$\/) {} # ignore e.g. \"{ yada };\"\n else if (s ~ \/ \\{\\};$\/) {} # ignore e.g. \"template <> class Foo {};\"\n else if (s ~ \/ },? *\\\/\\\/.*$\/) {} # ignore e.g. \"{ yada }, \/\/ comment\"\n else if (s ~ \/\\\\$\/) {} # ignore multiline macros\n else if (s ~ \/{}\/) { # e.g. \"Constructor(){}\"\n error(fname, FNR, \"{} must be preceded by space and at end of line\");\n } else if (isCpp && s ~ \/{ *\\\\$\/) {\n # ignore - \"{\" can be followed by \"\\\" in c macro\n } else if (s !~ \/{$\/) {\n error(fname, FNR, \"{ must be at end of line\");\n } else if (s !~ \/(^| ){\/) {\n error(fname, FNR, \"{ must be preceded by space or at start of line\");\n } else {\n opens = s;\n gsub(\/[^(]\/, \"\", opens);\n closes = s;\n gsub(\/[^)]\/, \"\", closes);\n if (0 && strict < 2 && fname ~ \/aspen\/) {} # not enabled\n else if (length(closes) > length(opens) && indent == cindent) {\n error(fname, FNR, \"Open brace should be on new line (function call\/decl spans several lines)\");\n }\n }\n}\ns ~ \/(^| )(class|interface|enum) \/ ||\ns ~ \/(^| )namespace \/ && isCpp {\n if (isCpp && s ~ \/;$\/) {} # ignore type declaration\n else {\n classDeclStartLine = FNR;\n t = s;\n gsub(\/.*(class|interface|enum|namespace) \/, \"\", t);\n gsub(\/ .*$\/, \"\", t);\n if (s ~ \/template\/) {\n # ignore case \"template static void foo()\"\n classDeclStartLine = 0;\n } else if (t ~ \/[[:upper:]][[:upper:]][[:upper:]][[:upper:]]\/ \\\n && t !~ \/LRU\/ \\\n && t !~ \/WAL\/ \\\n && t !~ \/classUUID\/ \\\n && t !~ \/classSQLException\/ \\\n && t !~ \/BBRC\/ \\\n && t !~ \/_\/ \\\n && t !~ \/EncodedSqlInterval\/)\n {\n error(fname, FNR, \"Class name \" t \" has consecutive uppercase letters\");\n }\n }\n}\ns ~ \/ throws\\>\/ {\n if (s ~ \/\\(\/) {\n funDeclStartLine = FNR;\n } else {\n funDeclStartLine = FNR - 1;\n }\n}\nlength($0) > maxLineLength \\\n&& $0 !~ \/@(throws|see|link)\/ \\\n&& $0 !~ \/\\$Id: \/ \\\n&& $0 !~ \/^import \/ \\\n&& $0 !~ \/http:\/ \\\n&& $0 !~ \/https:\/ \\\n&& $0 !~ \/\\\/\\\/ Expect \"\/ \\\n&& s !~ \/^ *(\\+ |<< |: |\\?)?string\\)*[;,]?$\/ {\n error( \\\n fname, \\\n FNR, \\\n \"Line length (\" length($0) \") exceeds \" maxLineLength \" chars\");\n}\n\/^public \/ || \/^class \/ || \/^interface \/ {\n publicClassSeen = 1;\n}\npublicClassSeen && !publicClassBraceLine && \/{$\/ {\n publicClassBraceLine = FNR\n}\n\/}$\/ {\n previousLineEndedInCloseBrace = 2;\n}\n\/;$\/ {\n funDeclStartLine = 0;\n}\n\/{$\/ {\n # Ignore open brace if it is part of class or interface declaration.\n if (classDeclStartLine) {\n if (classDeclStartLine < FNR \\\n && $0 !~ \/^ *{$\/ \\\n && indent == cindent)\n {\n error(fname, FNR, \"Open brace should be on new line (class decl spans several lines)\");\n }\n classDeclStartLine = 0;\n } else {\n previousLineEndedInOpenBrace = 2;\n }\n if (funDeclStartLine) {\n if (funDeclStartLine < FNR \\\n && $0 !~ \/^ *{$\/)\n {\n if (strict < 2 && fname ~ \/aspen\/) {} # not enabled\n else if (cindent != indent) {}\n else error(fname, FNR, \"Open brace should be on new line (function decl spans several lines)\");\n }\n funDeclStartLine = 0;\n }\n}\n\/^$\/ {\n previousLineWasEmpty = 2;\n}\n{\n next;\n}\nEND {\n afterFile();\n}\n\n# End checkFile.awk\n","avg_line_length":34.6299659478,"max_line_length":114,"alphanum_fraction":0.4914943132} {"size":160,"ext":"awk","lang":"Awk","max_stars_count":1.0,"content":"{\nif ($1 != t) {\n print $1, $5, $2, $3, $4\n} else {\n if (($2 != s) || ($3 != u) || ($4 != v)) {\n print $1, $5, $2, $3, $4\n }\n}\nt=$1\ns=$2\nu=$3\nv=$4\nr=$5\n}\n","avg_line_length":10.6666666667,"max_line_length":44,"alphanum_fraction":0.2875} {"size":1101,"ext":"awk","lang":"Awk","max_stars_count":null,"content":"{\n pos= $3 \",\" $4;\n type=substr($7,3,1);\n id=substr($7 $8,5,10);\n rss=$10;\n if (type == 0) {\n if (!lastpos) {\n aposlength = 0;\n }\n if (lastpos != pos) {\n aposlength++;\n apos[aposlength] = pos;\n posmap[pos] = aposlength\n lastpos=pos\n }\n mr = maxrss[aposlength \"_\" id]\n maxrss[aposlength \"_\" id] = (mr && mr > rss ? mr : rss)\n }\n}\nEND {\n printf (\"%2s %2s \", \"x\", \"y\")\n for (i=1;i<=20;i++) {\n id = sprintf (\"fafafa00%02x\", i)\n printf (\"%10s \", id)\n }\n print \"\"\n for (x=0; x<30; x++) {\n for (y=0; y<22; y++) {\n pos=x \",\" y\n if ((p=posmap[pos]) || fill) {\n printf (\"%2d %2d \", x, y)\n for (i=1;i<=20;i++) {\n id = sprintf (\"fafafa00%02x\", i)\n mr = maxrss[p \"_\" id] \n if (!mr) {\n mr=-999\n }\n printf (\"%10d \", mr)\n }\n print \"\"\n }\n }\n }\n}\n","avg_line_length":24.4666666667,"max_line_length":63,"alphanum_fraction":0.3287920073} {"size":1452,"ext":"awk","lang":"Awk","max_stars_count":3.0,"content":"BEGIN {\n FS=\"\\r\"\n IGNORECASE = 1\n}\n\nfunction logLine(user,action,message,channel,type) {\n sub(\/^:\/,\"\",user)\n sub(\/\\r\/,\"\",message)\n split(user, userParts, \"[!@]\")\n\n if (length(channel) == 0) {\n dir=logDir \"\/\" strftime(\"%Y\/%m\", systime(), 1)\n }\n else {\n dir=logDir \"\/\" channel strftime(\"\/%Y\/%m\", systime(), 1)\n }\n\n system(\"mkdir -p '\" dir \"'\")\n file=dir \"\/\" strftime(\"%d\", systime(), 1) \"_\" type\n printf(\"%d\\r%s\\r%s\\r%s\\r%s\\r%s\\n\", systime(), userParts[1], userParts[2], userParts[3], action, message) >> file\n fflush(file)\n}\n\n\/^privmsg\\r\/ {\n message=$4\n if (message ~ \/\u0001ACTION.*\u0001$\/) {\n action = \"action\"\n sub(\/^\u0001ACTION\\s\/,\"\",message)\n sub(\/\u0001$\/,\"\",message)\n }\n else {\n action = \"message\"\n }\n if (length($2) == 0) {\n prefix=shellbyHostname\n } else {\n prefix=$2\n }\n\n logLine(prefix, action, message, $3, \"message\")\n}\n\n\/^notice\\r\/ {\n if (! $3 ~ \/^[$*]+$\/) {\n logLine($2, \"notice\", $4, $3, \"message\")\n }\n}\n\n\/^(part|join)\\r\/ {\n logLine($2, tolower($1), $4, $3, \"user\")\n}\n\n\/^kick\\r\/ {\n message=$5\n formattedMessage=$4 \" reason: \" message\n logLine($2, \"kick\", formattedMessage, $3, \"user\")\n}\n\n\/^quit\\r\/ {\n logLine($2, \"quit\", $3, \"\", \"all\")\n}\n\n\/^nick\\r\/ {\n message=substr($3,3)\n user=$2\n sub(\/^:\/,\"\",user)\n nick=user\n sub(\/!.*$\/,\"\",nick)\n # huh?\n logLine($2, \"nick\", $3, \"\", \"all\")\n}\n\n\/^kill\\r\/ {\n message=$4\n formattedMessage=$3 \"\\r\" message\n logLine($2, \"kill\", formattedMessage, \"\", \"all\")\n}\n","avg_line_length":18.6153846154,"max_line_length":114,"alphanum_fraction":0.5261707989} {"size":400,"ext":"awk","lang":"Awk","max_stars_count":9.0,"content":"\n# ---------- Units\/csv\/check.awk\n# Will check to see if its a multiline record\n\n# Multi-Line String\n(!csvrecord && \/\"\/ && !\/^([^\"]|\"[^\"]*\")*$\/) || (csvrecord && \/^([^\"]|\"[^\"]*\")*$\/) {\n csvrecord = csvrecord $0 ORS; NR--; next\n}\n\n\nEND {\n divider = \"---------------------------\"\n\n if (csvrecord) {\n\tprintf(\"Unterminated record\\t%i\\n%sRecord:\\n%s\\n\\n\",NR,divider,csvrecord) > \"\/dev\/stderr\"\n\texit 1\n }\n}","avg_line_length":22.2222222222,"max_line_length":90,"alphanum_fraction":0.5075} {"size":194,"ext":"awk","lang":"Awk","max_stars_count":null,"content":"#!\/usr\/bin\/awk -f\n\nNR > 1 {\n print ($1+$7+$13+$19+$25)\/5 \" \" ($2+$8+$14+$20+$26)\/5 \" \" ($3+$9+$15+$21+$27)\/5 \" \" ($4+$10+$16+$22+$28)\/5 \" \" ($5+$11+$17+$23+$29)\/5 \" \" ($6+$12+$18+$24+$30)\/5;\n}\n","avg_line_length":32.3333333333,"max_line_length":163,"alphanum_fraction":0.3865979381} {"size":702,"ext":"gawk","lang":"Awk","max_stars_count":3.0,"content":"#!\/usr\/local\/bin\/gawk -f\n#\n# uniq-ngram-counts --\n#\tCollapse identical successive N-grams in counts file\n#\n# $Header: \/home\/srilm\/CVS\/srilm\/utils\/src\/uniq-ngram-counts.gawk,v 1.2 2007\/07\/13 23:50:28 stolcke Exp $\n#\n{\n\tif (NF == 1) {\n\t ngram = \" \";\n\t} else {\n\t ngram = \"\";\n\t}\n\n\tfor (i = 1; i < NF; i ++) {\n\t\tngram = ngram \" \" $i;\n\t}\n\n\t# starting ngrams with space character forces string comparison\n\tif (ngram != last_ngram) {\n\t if (last_ngram != \"\") {\n\t\t# avoid outputting initial space\n\t\tprint substr(last_ngram, 2), total_count;\n\t }\n\t total_count = 0;\n\t last_ngram = ngram;\n\t}\n\n\ttotal_count += $NF;\n}\n\nEND {\n\tif (last_ngram != \"\") {\n\t\tprint substr(last_ngram, 2), total_count;\n\t}\n}\n","avg_line_length":18.972972973,"max_line_length":105,"alphanum_fraction":0.6025641026} {"size":27334,"ext":"awk","lang":"Awk","max_stars_count":null,"content":"#!\/usr\/bin\/awk -f\n#\t$Id: updatefig.awk,v 1.2 2007\/06\/12 05:12:31 fang Exp $\n\n# \"mk\/updatefig.awk'\n# Fang's *crude* fig hack\n# stream-edits fig objects of all types\n# works whether or not input is stripped of header, \n# output will include header if input had header\n# match_* arguments can be strings or ints\n# update_* arguments can be strings or ints\n\n# DOCUMENTATION:\n#\tscattered throughout this file...\n\n# global unconditional transforms:\n# update_global_dx, _dy -- Cartesian translation\n\n# other useful variables to pass in:\n# suppress -- if set to anything, will delete the matching objects\n\nBEGIN {\n\tdone_header = 0;\n}\n\n\/#FIG\/ {\n\t# eventually merge headers....\n\t# parse and echo out header\n\tif (!done_header) print;\n\tfor (i=1; i<9; i++) {\n\t\t# header line count = 9\n\t\tgetline;\n\t\t# but may contain additional comments\n\t\tif (match($0, \"^#\")) --i;\n\t\tif (!done_header) print;\n\t}\n\tdone_header = 1;\n}\n\n# for all objects\n\/^0 \/ { parse_pseudo_object($0);\t}\n\n# could use parse_fig_object()...\n\/^1 \/ { parse_ellipse($0);\t\t}\n\/^2 \/ { parse_polyline($0);\t\t}\n\/^3 \/ { parse_spline($0);\t\t}\n\/^4 \/ { parse_text($0);\t\t\t}\n\/^5 \/ { parse_arc($0);\t\t\t}\n\/^6 \/ { parse_compound($0);\t\t}\n\n!\/^[0-6] \/ {\nif (0) {\n\t# ignore everything else\n\tprint \"# unknown object?\";\n}}\n\n######################## utility functions ####################################\n\n# returns true if no match string is specified\nfunction null_or_match(src, tgt) {\n\treturn (src == \"\" || src == tgt);\n}\n\n# range is in format: [min,max], where either min\/max are optional\n# also accepts just a plain number for exact match\n# optional '!' to prefix means the inverse\n# be sure to compare numerical values, not string values!\nfunction null_or_range_match(src, tgt, \n\t# local vars\n\tsrc_copy, min, max, inv, lb, cm, rb, ret ) {\n#\tprint \"# null_or_range_match(\" src \",\" tgt \")\";\n\tsrc_copy = src;\n\tif (src == \"\")\treturn 1;\n\t# extract inclusive bounds\n\tinv = match(src,\"[!]\");\n\tlb = match(src,\"[[]\");\n\tcm = match(src,\",\");\n\trb = match(src,\"[]]\");\n\tif (lb && cm && rb) {\n\t\tmin = substr(src, lb+1, cm-lb-1);\n\t\tmax = substr(src, cm+1, rb-cm-1);\n\t} else if (!lb && !cm && !rb) {\n\t\tgsub(\"[!]\", \"\", src_copy);\n\t\tmin = src_copy;\n\t\tmax = src_copy;\n\t} else {\n\t\tprint \"# updatefig.awk: bad range argument.\";\n\t\texit 1;\n\t}\n#\tprint \"# MIN = \" min;\n#\tprint \"# MAX = \" max;\n\tret = ((min == \"\" || min+0 <= tgt+0)&&(max == \"\" || max+0 >= tgt+0));\n#\tprint \"# return \" ret;\n\tif (inv) return !ret;\n\telse return ret;\n}\n\nfunction null_or_regexp_match(src, tgt) {\n\treturn (src == \"\" || match(tgt, src));\n}\n\nfunction update_field(fmt_str, oldval, update_str) {\n\tprintf(fmt_str, (update_str == \"\") ? oldval : update_str);\n}\n\n# relative change in integer value\nfunction update_field_int_rel(fmt_str, oldval, update_diff) {\n\tprintf(fmt_str, (update_diff == \"\") ? oldval : oldval+update_diff);\n}\n\n# cartesian transformation\n# xin, yin -- input coordinates\n# origin -- origin\/center of transformation of the form (x,y)\n# matrix -- transformation of the form [[xx,xy],[yx,yy]] (no spaces)\n# dx, dy -- post transformation offset\n# prints a fixed format-string \"%d %d\"\nfunction update_xy_transform(xin, yin, origin, matrix, dx, dy, \n\t# local vars\n\tox, oy, tx, ty, xout, yout, xx, xy, yx, yy, lp, cmx, mb, cmy, rp) {\n\tif (origin != \"\") {\n\t\tlp = match(origin,\"[(]\");\n\t\tcmx = match(origin,\",\");\n\t\trp = match(origin,\"[)]\");\n\t\tif (lp && cmx && rp) {\n\t\t\tox = substr(origin, lp+1, cmx-lp-1) +0;\n\t\t\toy = substr(origin, cmx+1, rp-cmx-1) +0;\n#\t\t\tprint \"# origin = \" ox \" \" oy;\n\t\t} else {\n\t\t\tprint \"# updatefig.awk: bad origin argument.\";\n\t\t\texit 1;\n\t\t}\n\t} else {\n\t\tox = 0;\t\toy = 0;\n\t}\n\tif (matrix != \"\") {\n\t\t# dangerous parsing here\n\t\tlp = match(matrix,\"[[][[]\");\n\t\tcmx = match(matrix,\"[,]\");\n\t\tmb = match(matrix,\"[]],[[]\");\n\t\tcmy = mb+2 +match(substr(matrix,mb+3),\"[,]\");\n\t\trp = match(matrix,\"[]][]]\");\n#\t\tprint \"# delimiters = \" lp \" \" cmx \" \" mb \" \" cmy \" \" rp;\n\t\tif (lp && cmx && mb && cmy && rp) {\n\t\t\txx = substr(matrix, lp+2, cmx-lp-2) +0.0;\n\t\t\txy = substr(matrix, cmx+1, mb-cmx-1) +0.0;\n\t\t\tyx = substr(matrix, mb+3, cmy-mb-3) +0.0;\n\t\t\tyy = substr(matrix, cmy+1, rp-cmy-1) +0.0;\n#\t\t\tprint \"# coeffs = \" xx \" \" xy \" \" yx \" \" yy;\n\t\t} else {\n\t\t\tprint \"# updatefig.awk: bad matrix argument.\";\n\t\t\texit 1;\n\t\t}\n\t} else {\n\t\txx = 1.0;\txy = 0.0;\n\t\tyx = 0.0;\tyy = 1.0;\n\t}\n\ttx = xin -ox;\n\tty = yin -oy;\n#\tprint \"# tx, ty = \" tx \" \" ty;\n\txout = xx*tx +xy*ty +ox;\n\tyout = yx*tx +yy*ty +oy;\n#\tprint \"# dx, dy = \" dx \" \" dy;\n\tif (dx != \"\")\txout += dx;\n\tif (dy != \"\")\tyout += dy;\n#\tprint \"# xout, yout = \" xout \" \" yout;\n\tprintf(\"%d %d\", xout, yout);\n\t# note: no trailing space\n}\n\n##################### parse-and-update routines ###############################\n# main function:\nfunction parse_fig_object(str, \n\t# local varaiables\n\ttokens, n) {\n# top level, recursive routine... parses one object at this level\n\tn = split(str, tokens);\n\t# can't have pseudo-objects in compound.\n\tif (tokens[1] == 1) {\n\t\tparse_ellipse(str);\n\t} else if (tokens[1] == 2) {\n\t\tparse_polyline(str);\n\t} else if (tokens[1] == 3) {\n\t\tparse_spline(str);\n\t} else if (tokens[1] == 4) {\n\t\tparse_text(str);\n\t} else if (tokens[1] == 5) {\n\t\tparse_arc(str);\n\t} else if (tokens[1] == 6) {\n\t\tparse_compound(str);\n\t} else {\n#\t\tprint \"# unknown object?\";\n#\t\tempty block, awk will core dump...\n\t}\n\treturn tokens[1];\t# return the type of the object\n}\n\nfunction parse_pseudo_object(str) {\n\tprint str;\t\t\t# echo back out for now\n}\n\n# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #\n# (3.3) COMPOUND\n# First line:\n# \ttype\tname\t\t\t(brief description)\n# \t----\t----\t\t\t-------------------\n# \tint\tobject_code\t\t(always 6)\n# \tint\tupperright_corner_x\t(Fig units)\n# \tint\tupperright_corner_y\t(Fig units)\n# \tint\tlowerleft_corner_x\t(Fig units)\n# \tint\tlowerleft_corner_y\t(Fig units)\n# \n# Subsequent lines:\n# \tobjects\n\nfunction parse_compound(str, \n\t# local variables\n\ttype, n, tokens) {\n# recursive descent\n#\tprint str;\t\t\t# contains box corner bounds\n\tn = split(str, tokens);\n\tif (tokens[1] != 6 || n != 5) exit;\t\t# sanity check\n\tupdate_field(\"%d \",tokens[1],\"\");\n\tupdate_field_int_rel(\"%d \", tokens[2], update_global_dx);\n\tupdate_field_int_rel(\"%d \", tokens[3], update_global_dy);\n\tupdate_field_int_rel(\"%d \", tokens[4], update_global_dx);\n\tupdate_field_int_rel(\"%d\", tokens[5], update_global_dy);\n\tprint \"\";\n\ttype = 0;\n\twhile(type != -6) {\n\t\tgetline;\n\t\ttype = parse_fig_object($0);\n\t}\n\tprint type;\t\t# -6 end compound object\n}\n\n# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #\n# (3.5) POLYLINE\n# First line:\n# \ttype\tname (brief description)\n# \t----\t---- -------------------\n# $1\tint\tobject_code\t\t(always 2)\n# $2\tint\tsub_type\t\t(1: polyline\n# \t\t\t\t\t 2: box\n# \t\t\t\t\t 3: polygon\n# \t\t\t\t\t 4: arc-box)\n# \t\t\t\t\t 5: imported-picture bounding-box)\n# $3\tint\tline_style\t\t(enumeration type)\n# $4\tint\tthickness\t\t(1\/80 inch)\n# $5\tint\tpen_color\t\t(enumeration type, pen color)\n# $6\tint\tfill_color\t\t(enumeration type, fill color)\n# $7\tint\tdepth\t\t\t(enumeration type)\n# $8\tint\tpen_style\t\t(pen style, not used)\n# $9\tint\tarea_fill\t\t(enumeration type, -1 = no fill)\n# $10\tfloat\tstyle_val\t\t(1\/80 inch)\n# $11\tint\tjoin_style\t\t(enumeration type)\n# $12\tint\tcap_style\t\t(enumeration type, \n# \t\t\t\t\t\tonly used for POLYLINE)\n# $13\tint\tradius\t\t\t(1\/80 inch, radius of arc-boxes)\n# $14\tint\tforward_arrow\t\t(0: off, 1: on)\n# $15\tint\tbackward_arrow\t\t(0: off, 1: on)\n# $16\tint\tnpoints\t\t\t(number of points in line)\n# \n\nfunction parse_polyline(str,\n\t\t# local variables\n\t\tmatch_condition, n, tokens) {\n\tn = split(str, tokens);\n\tif (tokens[1] != 2 || n != 16) exit;\t\t# sanity check\n\t# check for matching condition, defaults to matching ALL\n\t# right now, no way of matching point positions,\n\t# wrong position in input stream... :(\n\tmatch_condition = ( \\\n\t\tnull_or_match(match_object_code, tokens[1]) &&\n\t\tnull_or_match(match_sub_type, tokens[2]) &&\n\t\tnull_or_match(match_line_style, tokens[3]) &&\n\t\tnull_or_match(match_thickness, tokens[4]) &&\n\t\tnull_or_match(match_pen_color, tokens[5]) &&\n\t\tnull_or_match(match_fill_color, tokens[6]) &&\n\t\tnull_or_range_match(match_depth, tokens[7]) &&\n\t\tnull_or_match(match_pen_style, tokens[8]) &&\n\t\tnull_or_match(match_area_fill, tokens[9]) &&\n\t\tnull_or_match(match_style_val, tokens[10]) &&\n\t\tnull_or_match(match_join_style, tokens[11]) &&\n\t\tnull_or_match(match_cap_style, tokens[12]) &&\n\t\tnull_or_match(match_radius, tokens[13]) &&\n\t\tnull_or_match(match_forward_arrow, tokens[14]) &&\n\t\tnull_or_match(match_backward_arrow, tokens[15]) &&\n\t\tnull_or_match(match_npoints, tokens[16]) );\n\tif (match_condition) {\n\t# if match, apply changes\n\t\tupdate_field(\"%d \",tokens[1],\"\");\t# can't change\n\t\tupdate_field(\"%d \",tokens[2],\"\");\t# can't change\n\t\tupdate_field(\"%d \",tokens[3],update_line_style);\n\t\tupdate_field(\"%d \",tokens[4],update_thickness);\n\t\tupdate_field(\"%d \",tokens[5],update_pen_color);\n\t\tupdate_field(\"%d \",tokens[6],update_fill_color);\n\t\tupdate_field(\"%d \",tokens[7],update_depth);\n\t\tupdate_field(\"%d \",tokens[8],update_pen_style);\n\t\tupdate_field(\"%d \",tokens[9],update_area_fill);\n\t\tupdate_field(\"%.3f \",tokens[10],update_style_val);\n\t\tupdate_field(\"%d \",tokens[11],update_join_style);\n\t\tupdate_field(\"%d \",tokens[12],update_cap_style);\n\t\tupdate_field(\"%d \",tokens[13],update_radius);\n\t\tupdate_field(\"%d \",tokens[14],update_forward_arrow);\n\t\tupdate_field(\"%d \",tokens[15],update_backward_arrow);\n\t\tupdate_field(\"%d\", tokens[16],\"\");\t# can't change\n\t\tprint \"\";\n\t} else {\n\t# doesn't match, keep unmodified\n\t\tprint str;\n\t# all dependent lines for this object (arrows, points)\n\t}\n\t# check for old arrow lines\n\tif (tokens[14] == 1) {\n\t\tparse_arrow(match_condition);\n\t}\n\tif (tokens[15] == 1) {\n\t\tparse_arrow(match_condition);\n\t}\n\t# always has points\n\tparse_points(match_condition, tokens[16]);\n}\n\n# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #\n# Forward arrow line (Optional; absent if forward_arrow is 0):\n# \ttype\tname\t\t\t(brief description)\n# \t----\t----\t\t\t-------------------\n# \tint\tarrow_type\t\t(enumeration type)\n# \tint\tarrow_style\t\t(enumeration type)\n# \tfloat\tarrow_thickness\t\t(1\/80 inch)\n# \tfloat\tarrow_width\t\t(Fig units)\n# \tfloat\tarrow_height\t\t(Fig units)\n# \n# Backward arrow line is analogous\n\nfunction parse_arrow(match_condition, \n\t# local variables\n\tarrow_match_condition, n, tokens) {\n# right now, never modifies, later update this function...\n\tgetline;\n\tn = split($0, tokens);\n\tarrow_match_condition = \\\n\t\tmatch_condition &&\n\t\tnull_or_match(match_arrow_type, tokens[1]) &&\n\t\tnull_or_match(match_arrow_style, tokens[2]) &&\n\t\tnull_or_match(match_arrow_thickness, tokens[3]) &&\n\t\tnull_or_match(match_arrow_width, tokens[4]) &&\n\t\tnull_or_match(match_arrow_height, tokens[5]);\n\tif (arrow_match_condition) {\n\t\tprintf(\"\\t\");\n\t# if match, apply changes\n\t\tupdate_field(\"%d \",tokens[1],update_arrow_type);\n\t\tupdate_field(\"%d \",tokens[2],update_arrow_style);\n\t\tupdate_field(\"%.3f \",tokens[3],update_arrow_thickness);\n\t\tupdate_field(\"%.3f \",tokens[4],update_arrow_width);\n\t\tupdate_field(\"%.3f\",tokens[5],update_arrow_height);\n\t\tprint \"\";\n\t} else {\n\t\tprint;\n\t}\n}\n\n# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #\n# Points line:\n# \ttype name (brief description)\n# \t---- ---- -------------------\n# \tint\tx1, y1\t\t\t(Fig units)\n# \tint\tx2, y2\t\t\t(Fig units)\n# \t...\n# \tint\txnpoints ynpoints\t(this will be the same as the 1st\n# \t\t\t\t\tpoint for polygon and box)\n\nfunction parse_points(match_condition, np, \n\t# local vars:\n\t\tsp, i, p, xy_tokens, x_array, y_array) {\n\tsp = 0;\n\twhile (sp < np) {\t# scanned points < expected points\n\t\t# assume points come in pairs!\n\t\tgetline;\n\t\tp = split($0, xy_tokens);\n\t\tfor (i=1; i<=(p\/2); i++) {\n\t\t\tsp++;\n\t\t\t# unconditional global update\n\t\t\tx_array[sp] = xy_tokens[2*i-1] +update_global_dx;\n\t\t\ty_array[sp] = xy_tokens[2*i] +update_global_dy;\n\t\t}\n\t}\n\t# all points stored in x_array and y_array\n\t# print out all on one line, forget formatting\n\tprintf(\"\\t\");\n\tif (match_condition) {\n\tfor (i=1; i<=np; i++) {\n\t\tprintf(\" %d %d\", \n\t\t\tx_array[i] +update_points_dx, \n\t\t\ty_array[i] +update_points_dy);\n\t}} else {\n\tfor (i=1; i<=np; i++) {\n\t\tprintf(\" %d %d\", x_array[i], y_array[i]);\n\t}}\n\tprint \"\";\n}\n\n# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #\n# (3.7) TEXT\n#\ttype\tname\t\t(brief description)\n#\t----\t----\t\t-------------------\n# $1\tint\tobject\t\t(always 4)\n# $2\tint\tsub_type\t(0: Left justified\n#\t\t\t\t 1: Center justified\n#\t\t\t\t 2: Right justified)\n# $3\tint\tcolor\t\t(enumeration type)\n# $4\tint\tdepth\t\t(enumeration type)\n# $5\tint\tpen_style\t(enumeration , not used)\n# $6\tint\tfont\t\t(enumeration type)\n# $7\tfloat\tfont_size\t(font size in points)\n# $8\tfloat\tangle\t\t(radians, the angle of the text)\n# $9\tint\tfont_flags\t(bit vector)\n# $10\tfloat\theight\t\t(Fig units)\n# $11\tfloat\tlength\t\t(Fig units)\n# $12\tint\tx, y\t\t(Fig units, coordinate of the origin\n# $13\t\t\t\t of the string. If sub_type = 0, it is\n#\t\t\t\t the lower left corner of the string.\n#\t\t\t\t If sub_type = 1, it is the lower\n#\t\t\t\t center. Otherwise it is the lower\n#\t\t\t\t right corner of the string.)\n# remainder\n#\tchar\tstring[]\t(ASCII characters; starts after a blank\n#\t\t\t\t character following the last number and\n#\t\t\t\t ends before the sequence '\\001'. This\n#\t\t\t\t sequence is not part of the string.\n#\t\t\t\t Characters above octal 177 are\n#\t\t\t\t represented by \\xxx where xxx is the\n#\t\t\t\t octal value. This permits fig files to\n#\t\t\t\t be edited with 7-bit editors and sent\n#\t\t\t\t by e-mail without data loss.\n#\t\t\t\t Note that the string may contain '\\n'.)\n\nfunction parse_text(str,\n\t\t# local variables\n\t\tfig_text, match_condition, n, tokens) {\n\tn = split(str, tokens);\n\tfig_text = extract_fig_string($0);\n\tif (tokens[1] != 4 || n < 14) exit;\t\t# sanity check\n\t# check for matching condition, defaults to matching ALL\n\tmatch_condition = ( \\\n\t\tnull_or_match(match_object_code, tokens[1]) &&\n\t\tnull_or_match(match_sub_type, tokens[2]) &&\t# justification\n\t\tnull_or_match(match_color, tokens[3]) &&\n\t\tnull_or_range_match(match_depth, tokens[4]) &&\n\t\tnull_or_match(match_pen_style, tokens[5]) &&\n\t\tnull_or_match(match_font, tokens[6]) &&\n\t\tnull_or_match(match_font_size, tokens[7]) &&\n\t\tnull_or_match(match_angle, tokens[8]) &&\n\t\tnull_or_match(match_font_flags, tokens[9]) &&\n\t\tnull_or_match(match_height, tokens[10]) &&\n\t\tnull_or_match(match_length, tokens[11]) &&\n\t\tnull_or_range_match(match_x_range, tokens[12]) &&\n\t\tnull_or_range_match(match_y_range, tokens[13]) &&\n\t\tnull_or_regexp_match(match_regexp, fig_text));\n\t# unconditional global update\n\ttokens[12] += update_global_dx;\n\ttokens[13] += update_global_dy;\n\tif (match_condition) {\n\t# if match, apply changes\n\t# if suppress, just filter out\n\t\tif (!length(suppress)) {\n\t\tupdate_field(\"%d \",tokens[1],\"\");\t# can't change\n\t\tupdate_field(\"%d \",tokens[2],update_sub_type);\t# justification\n\t\tupdate_field(\"%d \",tokens[3],update_color);\n\t\tupdate_field(\"%d \",tokens[4],update_depth);\n\t\tupdate_field(\"%d \",tokens[5],update_pen_style);\n\t\tupdate_field(\"%d \",tokens[6],update_font);\n\t\tupdate_field(\"%d \",tokens[7],update_font_size);\n\t\tupdate_field(\"%.4f \",tokens[8],update_angle);\n\t\tupdate_field(\"%d \",tokens[9],update_font_flags);\n\t\tupdate_field(\"%d \",tokens[10],update_height);\n\t\tupdate_field(\"%d \",tokens[11],update_length);\n\t\tupdate_xy_transform(tokens[12], tokens[13], transform_origin, \n\t\t\ttransform_matrix, update_dx, update_dy);\n\t\tprintf(\" \");\n#\t\tupdate_field_int_rel(\"%d \",tokens[12],update_dx);\n#\t\tupdate_field_int_rel(\"%d \",tokens[13],update_dy);\n\t\tupdate_field(\"%s\\\\001\",fig_text,\"\");\n\t\t\t# fixed for now, enable update_text later\n\t\t\t# later, enable string substitution of fig_text\n\t\tprint \"\";\n\t\t}\n\t} else {\n\t# doesn't match, keep unmodified\n\t\tprint str;\n\t}\n}\n\n# extracts only the text\nfunction extract_fig_string(str) {\n\text_str = substr(str, skip_non_text(str))\n\treturn substr(ext_str,1,length(ext_str)-4);\t# loses trailing \\001\n}\n\n# returns position of start of text string of text object\nfunction skip_non_text(str) {\n\tsplit(str, skip_tokens);\n\tskip_count = 1;\n\tfor (i=1; i<=13; i++)\n\t\tskip_count += length(skip_tokens[i]) +1;\n\treturn skip_count;\n}\n\n# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #\n# (3.4) ELLIPSE\n# First line:\n# \ttype\tname\t\t\t(brief description)\n# \t----\t----\t\t\t-------------------\n# $1\tint\tobject_code\t\t(always 1)\n# $2\tint\tsub_type\t\t(1: ellipse defined by radiuses\n# \t\t\t\t\t 2: ellipse defined by diameters\n# \t\t\t\t\t 3: circle defined by radius\n# \t\t\t\t\t 4: circle defined by diameter)\n# $3\tint\tline_style\t\t(enumeration type)\n# $4\tint\tthickness\t\t(1\/80 inch)\n# $5\tint\tpen_color\t\t(enumeration type, pen color)\n# $6\tint\tfill_color\t\t(enumeration type, fill color)\n# $7\tint\tdepth\t\t\t(enumeration type)\n# $8\tint\tpen_style\t\t(pen style, not used)\n# $9\tint\tarea_fill\t\t(enumeration type, -1 = no fill)\n# $10\tfloat\tstyle_val\t\t(1\/80 inch)\n# $11\tint\tdirection\t\t(always 1)\n# $12\tfloat\tangle\t\t\t(radians, the angle of the x-axis)\n# $13\tint\tcenter_x, center_y\t(Fig units)\n# $15\tint\tradius_x, radius_y\t(Fig units)\n# $17\tint\tstart_x, start_y\t(Fig units; the 1st point entered)\n# $19\tint\tend_x, end_y\t\t(Fig units; the last point entered)\n# (total 20 args)\n\nfunction parse_ellipse(str, \n\t\t# local variables\n\t\tmatch_condition, n, tokens) {\n\tn = split(str, tokens);\n\tif (tokens[1] != 1 || n != 20) exit;\t\t# sanity check\n\t# check for matching condition, defaults to matching ALL\n\tmatch_condition = ( \\\n\t\tnull_or_match(match_object_code, tokens[1]) &&\n\t\tnull_or_match(match_sub_type, tokens[2]) &&\n\t\tnull_or_match(match_line_style, tokens[3]) &&\n\t\tnull_or_match(match_thickness, tokens[4]) &&\n\t\tnull_or_match(match_pen_color, tokens[5]) &&\n\t\tnull_or_match(match_fill_color, tokens[6]) &&\n\t\tnull_or_range_match(match_depth, tokens[7]) &&\n\t\tnull_or_match(match_pen_style, tokens[8]) &&\n\t\tnull_or_match(match_area_fill, tokens[9]) &&\n\t\tnull_or_match(match_style_val, tokens[10]) &&\n\t\tnull_or_match(match_direction, tokens[11]) &&\n\t\tnull_or_match(match_angle, tokens[12]) &&\n\t\tnull_or_match(match_center_x, tokens[13]) &&\n\t\tnull_or_match(match_center_y, tokens[14]) &&\n\t\tnull_or_match(match_radius_x, tokens[15]) &&\n\t\tnull_or_match(match_radius_y, tokens[16]) &&\n\t\tnull_or_match(match_start_x, tokens[17]) &&\n\t\tnull_or_match(match_start_y, tokens[18]) &&\n\t\tnull_or_match(match_end_x, tokens[19]) &&\n\t\tnull_or_match(match_end_y, tokens[20]) );\n\t# unconditional global changes\n\ttokens[13] += update_global_dx;\n\ttokens[14] += update_global_dy;\n\ttokens[15] += update_global_dx;\n\ttokens[16] += update_global_dy;\n\ttokens[17] += update_global_dx;\n\ttokens[18] += update_global_dy;\n\ttokens[19] += update_global_dx;\n\ttokens[20] += update_global_dy;\n\tif (match_condition) {\n\t# if match, apply changes\n\t\tupdate_field(\"%d \",tokens[1],\"\");\t# can't change\n\t\tupdate_field(\"%d \",tokens[2],update_sub_type);\n\t\tupdate_field(\"%d \",tokens[3],update_line_style);\n\t\tupdate_field(\"%d \",tokens[4],update_thickness);\n\t\tupdate_field(\"%d \",tokens[5],update_pen_color);\n\t\tupdate_field(\"%d \",tokens[6],update_fill_color);\n\t\tupdate_field(\"%d \",tokens[7],update_depth);\n\t\tupdate_field(\"%d \",tokens[8],update_pen_style);\n\t\tupdate_field(\"%d \",tokens[9],update_area_fill);\n\t\tupdate_field(\"%.3f \",tokens[10],update_style_val);\n\t\tupdate_field(\"%d \",tokens[11],update_direction);\n\t\tupdate_field(\"%.4f \",tokens[12],update_angle);\n\t\tupdate_field(\"%d \",tokens[13],update_center_x);\n\t\tupdate_field(\"%d \",tokens[14],update_center_y);\n\t\tupdate_field(\"%d \",tokens[15],update_radius_x);\n\t\tupdate_field(\"%d \",tokens[16],update_radius_y);\n\t\tupdate_field(\"%d \",tokens[17],update_start_x);\n\t\tupdate_field(\"%d \",tokens[18],update_start_y);\n\t\tupdate_field(\"%d \",tokens[19],update_end_x);\n\t\tupdate_field(\"%d\", tokens[20],update_end_y);\n\t\tprint \"\";\n\t} else {\n\t# doesn't match, keep unmodified\n\t\tprint str;\n\t}\n}\n\n\n# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #\n# (3.6) SPLINE\n# First line:\n# \ttype\tname\t\t\t(brief description)\n# \t----\t----\t\t\t-------------------\n# $1\tint\tobject_code\t\t(always 3)\n# $2\tint\tsub_type\t\t(0: opened approximated spline\n# \t\t\t\t\t 1: closed approximated spline\n# \t\t\t\t\t 2: opened interpolated spline\n# \t\t\t\t\t 3: closed interpolated spline\n# \t\t\t\t\t 4: opened x-spline\n# \t\t\t\t\t 5: closed x-spline)\n# $3\tint\tline_style\t\t(See the end of this section)\n# $4\tint\tthickness\t\t(1\/80 inch)\n# $5\tint\tpen_color\t\t(enumeration type, pen color)\n# $6\tint\tfill_color\t\t(enumeration type, fill color)\n# $7\tint\tdepth\t\t\t(enumeration type)\n# $8\tint\tpen_style\t\t(pen style, not used)\n# $9\tint\tarea_fill\t\t(enumeration type, -1 = no fill)\n# $10\tfloat\tstyle_val\t\t(1\/80 inch)\n# $11\tint\tcap_style\t\t(enumeration type, \n# \t\t\t\t\t only used for open splines)\n# $12\tint\tforward_arrow\t\t(0: off, 1: on)\n# $13\tint\tbackward_arrow\t\t(0: off, 1: on)\n# $14\tint\tnpoints\t\t\t(number of control points in spline)\n# \n# Control points line :\n# There is one shape factor for each point. The value of this factor\n# must be between -1 (which means that the spline is interpolated at\n# this point) and 1 (which means that the spline is approximated at\n# this point). The spline is always smooth in the neighbourhood of a\n# control point, except when the value of the factor is 0 for which\n# there is a first-order discontinuity (i.e. angular point).\n\nfunction parse_spline(str,\n\t\t# local variables\n\t\tmatch_condition, n, tokens) {\n\tn = split(str, tokens);\n\tif (tokens[1] != 3 || n != 14) exit;\t\t# sanity check\n\t# check for matching condition, defaults to matching ALL\n\tmatch_condition = ( \\\n\t\tnull_or_match(match_object_code, tokens[1]) &&\n\t\tnull_or_match(match_sub_type, tokens[2]) &&\n\t\tnull_or_match(match_line_style, tokens[3]) &&\n\t\tnull_or_match(match_thickness, tokens[4]) &&\n\t\tnull_or_match(match_pen_color, tokens[5]) &&\n\t\tnull_or_match(match_fill_color, tokens[6]) &&\n\t\tnull_or_range_match(match_depth, tokens[7]) &&\n\t\tnull_or_match(match_pen_style, tokens[8]) &&\n\t\tnull_or_match(match_area_fill, tokens[9]) &&\n\t\tnull_or_match(match_style_val, tokens[10]) &&\n\t\tnull_or_match(match_cap_style, tokens[11]) &&\n\t\tnull_or_match(match_forward_arrow, tokens[12]) &&\n\t\tnull_or_match(match_backward_arrow, tokens[13]) &&\n\t\tnull_or_match(match_npoints, tokens[14]) );\n\tif (match_condition) {\n\t# if match, apply changes\n\t\tupdate_field(\"%d \",tokens[1],\"\");\t# can't change\n\t\tupdate_field(\"%d \",tokens[2],update_sub_type);\n\t\tupdate_field(\"%d \",tokens[3],update_line_style);\n\t\tupdate_field(\"%d \",tokens[4],update_thickness);\n\t\tupdate_field(\"%d \",tokens[5],update_pen_color);\n\t\tupdate_field(\"%d \",tokens[6],update_fill_color);\n\t\tupdate_field(\"%d \",tokens[7],update_depth);\n\t\tupdate_field(\"%d \",tokens[8],update_pen_style);\n\t\tupdate_field(\"%d \",tokens[9],update_area_fill);\n\t\tupdate_field(\"%.3f \",tokens[10],update_style_val);\n\t\tupdate_field(\"%d \",tokens[11],update_cap_style);\n\t\tupdate_field(\"%d \",tokens[12],update_forward_arrow);\n\t\tupdate_field(\"%d \",tokens[13],update_backward_arrow);\n\t\tupdate_field(\"%d\", tokens[14],\"\");\t# can't change\n\t\tprint \"\";\n\t} else {\n\t# doesn't match, keep unmodified\n\t\tprint str;\n\t# all dependent lines for this object (arrows, points)\n\t}\n\t# check for old arrow lines\n\tif (tokens[12] == 1) {\n\t\tparse_arrow(match_condition);\n\t}\n\tif (tokens[13] == 1) {\n\t\tparse_arrow(match_condition);\n\t}\n\t# always has points and control points\n\tparse_points(match_condition, tokens[14]);\n\tparse_control_points(match_condition, tokens[14]);\n}\n\nfunction parse_control_points(match_condition, np) {\n# for now, never changes\n\tgetline;\n\tprint;\n}\n\n# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #\n# (3.2) ARC\n# First line:\n# \ttype\tname\t\t\t(brief description)\n# \t----\t----\t\t\t-------------------\n# $1\tint\tobject_code\t\t(always 5)\n# $2\tint\tsub_type\t\t(0: pie-wedge (closed)\n# \t\t\t\t\t 1: open ended arc)\n# $3\tint\tline_style\t\t(enumeration type)\n# $4\tint\tthickness\t\t(1\/80 inch)\n# $5\tint\tpen_color\t\t(enumeration type, pen color)\n# $6\tint\tfill_color\t\t(enumeration type, fill color)\n# $7\tint\tdepth\t\t\t(enumeration type)\n# $8\tint\tpen_style\t\t(pen style, not used)\n# $9\tint\tarea_fill\t\t(enumeration type, -1 = no fill)\n# $10\tfloat\tstyle_val\t\t(1\/80 inch)\n# $11\tint\tcap_style\t\t(enumeration type)\n# $12\tint\tdirection\t\t(0: clockwise, 1: counterclockwise)\n# $13\tint\tforward_arrow\t\t(0: no forward arrow, 1: on)\n# $14\tint\tbackward_arrow\t\t(0: no forward arrow, 1: on)\n# $15\tfloat\tcenter_x, center_y\t(center of the arc)\n# $17\tint\tx1, y1\t\t\t(Fig units, the 1st point user entered)\n# $19\tint\tx2, y2\t\t\t(Fig units, the 2nd point)\n# $21\tint\tx3, y3\t\t\t(Fig units, the last point)\n\nfunction parse_arc(str,\n\t\t# local variables\n\t\tmatch_condition, n, tokens) {\n\tn = split(str, tokens);\n\tif (tokens[1] != 5 || n != 22) exit;\t\t# sanity check\n\t# check for matching condition, defaults to matching ALL\n\tmatch_condition = ( \\\n\t\tnull_or_match(match_object_code, tokens[1]) &&\n\t\tnull_or_match(match_sub_type, tokens[2]) &&\n\t\tnull_or_match(match_line_style, tokens[3]) &&\n\t\tnull_or_match(match_thickness, tokens[4]) &&\n\t\tnull_or_match(match_pen_color, tokens[5]) &&\n\t\tnull_or_match(match_fill_color, tokens[6]) &&\n\t\tnull_or_range_match(match_depth, tokens[7]) &&\n\t\tnull_or_match(match_pen_style, tokens[8]) &&\n\t\tnull_or_match(match_area_fill, tokens[9]) &&\n\t\tnull_or_match(match_style_val, tokens[10]) &&\n\t\tnull_or_match(match_cap_style, tokens[11]) &&\n\t\tnull_or_match(match_direction, tokens[12]) &&\n\t\tnull_or_match(match_forward_arrow, tokens[13]) &&\n\t\tnull_or_match(match_backward_arrow, tokens[14]) &&\n\t\tnull_or_match(match_center_x, tokens[15]) &&\n\t\tnull_or_match(match_center_y, tokens[16]) &&\n\t\tnull_or_match(match_x1, tokens[17]) &&\n\t\tnull_or_match(match_y1, tokens[18]) &&\n\t\tnull_or_match(match_x2, tokens[19]) &&\n\t\tnull_or_match(match_y2, tokens[20]) &&\n\t\tnull_or_match(match_x3, tokens[21]) &&\n\t\tnull_or_match(match_y3, tokens[22]) );\n\t# unconditional global update\n\ttokens[15] += update_global_dx;\n\ttokens[16] += update_global_dy;\n\ttokens[17] += update_global_dx;\n\ttokens[18] += update_global_dy;\n\ttokens[19] += update_global_dx;\n\ttokens[20] += update_global_dy;\n\ttokens[21] += update_global_dx;\n\ttokens[22] += update_global_dy;\n\tif (match_condition) {\n\t# if match, apply changes\n\t\tupdate_field(\"%d \",tokens[1],\"\");\t# can't change\n\t\tupdate_field(\"%d \",tokens[2],update_sub_type);\n\t\tupdate_field(\"%d \",tokens[3],update_line_style);\n\t\tupdate_field(\"%d \",tokens[4],update_thickness);\n\t\tupdate_field(\"%d \",tokens[5],update_pen_color);\n\t\tupdate_field(\"%d \",tokens[6],update_fill_color);\n\t\tupdate_field(\"%d \",tokens[7],update_depth);\n\t\tupdate_field(\"%d \",tokens[8],update_pen_style);\n\t\tupdate_field(\"%d \",tokens[9],update_area_fill);\n\t\tupdate_field(\"%.4f \",tokens[10],update_style_val);\n\t\tupdate_field(\"%d \",tokens[11],update_cap_style);\n\t\tupdate_field(\"%d \",tokens[12],update_direction);\n\t\tupdate_field(\"%d \",tokens[13],update_forward_arrow);\n\t\tupdate_field(\"%d \",tokens[14],update_backward_arrow);\n\t\tupdate_field(\"%.4f \",tokens[15],update_center_x);\n\t\tupdate_field(\"%.4f \",tokens[16],update_center_y);\n\t\tupdate_field(\"%d \",tokens[17],update_x1);\n\t\tupdate_field(\"%d \",tokens[18],update_y1);\n\t\tupdate_field(\"%d \",tokens[19],update_x2);\n\t\tupdate_field(\"%d \",tokens[20],update_y2);\n\t\tupdate_field(\"%d \",tokens[21],update_x3);\n\t\tupdate_field(\"%d\" ,tokens[22],update_y3);\n\t\tprint \"\";\n\t} else {\n\t# doesn't match, keep unmodified\n\t\tprint str;\n\t# all dependent lines for this object (arrows, points)\n\t}\n\t# check for old arrow lines\n\tif (tokens[13] == 1) {\n\t\tparse_arrow(match_condition);\n\t}\n\tif (tokens[14] == 1) {\n\t\tparse_arrow(match_condition);\n\t}\n}\n\n# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #\n# end of file\n\n","avg_line_length":34.1675,"max_line_length":79,"alphanum_fraction":0.6494841589} {"size":3006,"ext":"awk","lang":"Awk","max_stars_count":1.0,"content":"#!\/usr\/bin\/env awk -f\n\/(inp [w-z])|(((add)|(mul)|(div)|(mod)|(eql)) [w-z] [w-z])\/ { program[NR] = $0; next }\n\/((add)|(mul)|(div)|(mod)|(eql)) [w-z] -?[0-9]+\/ { program[NR] = $0; var[$3] = $3+0; next }\n{ print \"DATA ERROR\"; exit _exit=1 }\nfunction run(program, from, to, input) {\n # print \"z =\", var[\"z\"], \"input =\", input\n for (pc = from+0; pc <= to+0; ++pc) {\n # print pc, \":\", program[pc]\n split(program[pc], op); switch (op[1]) {\n case \"inp\": var[op[2]] = input; break\n case \"add\": var[op[2]] += var[op[3]]; break\n case \"mul\": var[op[2]] *= var[op[3]]; break\n case \"div\": if (!var[op[3]]) { print \"CODE ERROR\"; exit _exit=1 }; var[op[2]] = int(var[op[2]] \/ var[op[3]]); break\n case \"mod\": if (!var[op[3]]) { print \"CODE ERROR\"; exit _exit=1 }; var[op[2]] = var[op[2]] % var[op[3]]; break\n case \"eql\": var[op[2]] = var[op[2]] == var[op[3]]; break\n default: print \"CODE ERROR\"; exit _exit=1\n }\n }\n # print \"z =\", var[\"z\"]\n}\n# function f2(z, step, digit) { return (z % 26 == digit - B[step]) ? int(z\/A[step]) : int(z\/A[step]) * 26 + digit + C[step] }\nfunction forward(z, step, digit) { var[\"z\"]=z; run(program, inp[step], inp[step+1]-1, digit); return var[\"z\"] }\nfunction backward(zz, step, digit, z, i, find) {\n # cases where (z % 26 + B == digit)\n z = zz * A[step]\n if (digit >= B[step] && digit - B[step] < 26) {\n if (z % 26 == digit - B[step]) zs[step][z] = 1\n if (A[step] == 26) zs[step][z + digit - B[step]] = 1\n }\n # cases where (z % 26 + B != digit)\n z = (zz - digit - C[step])\n if (z >= 0 && z % 26 == 0) {\n z = int(z \/ 26) * A[step]\n if (z % 26 != digit - B[step]) zs[step][z] = 1\n if (A[step] == 26) for (i = 0; i < 26; ++i) if (i != digit - B[step]) zs[step][z+i] = 1\n }\n}\nEND {\n if (_exit) exit\n var[\"w\"] = var[\"x\"] = var[\"y\"] = var[\"z\"] = 0\n for (pc in program) if (program[pc] ~ \/^inp\/) inp[++digits] = pc+0\n if (digits != 14) { print \"CODE ERROR\"; exit _exit=1 }\n inp[15] = NR + 1\n for (d = 1; d <= digits; ++d) {\n split(program[inp[d] + 4], op); A[d] = op[3]\n split(program[inp[d] + 5], op); B[d] = op[3]\n split(program[inp[d] + 15], op); C[d] = op[3]\n }\n zs[15][0] = 1\n for (step = 14; step >= 1; --step) for (z in zs[step+1]) for (d = 1; d <= 9; ++d) backward(z, step, d)\n\n number = \"\"\n z = 0\n # print 0, \":\", z\n for (step = 1; step <= 14; ++step) {\n for (digit = 1; digit <= 9; ++digit) {\n zz = forward(z, step, digit)\n if (zz in zs[step+1]) break\n }\n # print step, \":\", z, \",\", digit, \"->\", A[step], B[step], C[step], \"->\", zz\n if (digit < 1) { print \"CODE ERROR\"; exit _exit=1 }\n number = number digit\n z = zz\n }\n print number\n split(number, n, \"\")\n var[\"z\"] = 0\n for (i in n) run(program, inp[i], inp[i+1]-1, n[i])\n if (var[\"z\"]) { print \"CODE ERROR\"; exit _exit=1 }\n}\n","avg_line_length":42.338028169,"max_line_length":127,"alphanum_fraction":0.4650698603} {"size":31316,"ext":"awk","lang":"Awk","max_stars_count":11.0,"content":"#!\/bin\/awk -f\n# scripts\/options.awk - library build configuration control\n#\n# last changed in libpng version 1.5.7 - December 15, 2011\n#\n# Copyright (c) 2011 Glenn Randers-Pehrson\n#\n# This code is released under the libpng license.\n# For conditions of distribution and use, see the disclaimer\n# and license in png.h\n\n# The output of this script is written to the file given by\n# the variable 'out'. The script is run twice, once with\n# an intermediate output file, 'options.tmp' then again on\n# that file to produce the final output:\n#\n# awk -f scripts\/options.awk out=options.tmp scripts\/options.dfa 1>&2\n# awk -f scripts\/options.awk out=options.dfn options.tmp 1>&2\n#\n# Some options may be specified on the command line:\n#\n# deb=1 Causes debugging to be output\n# logunsupported=1 Causes all options to be recorded in the output\n# everything=off Causes all options to be disabled by default\n# everything=on Causes all options to be enabled by default\n#\n# If awk fails on your platform, try nawk instead.\n#\n# These options may also be specified in the original input file (and\n# are copied to the preprocessed file).\n\nBEGIN{\n out=\"\" # intermediate, preprocessed, file\n pre=-1 # preprocess (first line)\n version=\"libpng version unknown\" # version information\n version_file=\"\" # where to find the version\n err=0 # in-line exit sets this\n # The following definitions prevent the C preprocessor noticing the lines\n # that will be in the final output file. Some C preprocessors tokenise\n # the lines, for example by inserting spaces around operators, and all\n # C preprocessors notice lines that start with '#', most remove comments.\n # The technique adopted here is to make the final output lines into\n # C strings (enclosed in double quotes), preceeded by PNG_DFN. As a\n # consequence the output cannot contain a 'raw' double quote - instead put\n # @' in, this will be replaced by a single \" afterward. See the parser\n # script dfn.awk for more capabilities (not required here). Note that if\n # you need a \" in a 'setting' in pnglibconf.dfa it must also be @'!\n dq=\"@'\" # For a single double quote\n start=\" PNG_DFN \\\"\" # Start stuff to output (can't contain a \"!)\n end=\"\\\" \" # End stuff to output\n subs=\"@\\\" \" # Substitute start (substitute a C macro)\n sube=\" \\\"@\" # Substitute end\n comment=start \"\/*\" # Comment start\n cend=\"*\/\" end # Comment end\n def=start \"#define PNG_\" # Arbitrary define\n sup=\"_SUPPORTED\" end # end supported option\n und=comment \"#undef PNG_\" # Unsupported option\n une=\"_SUPPORTED\" cend # end unsupported option\n error=start \"ERROR:\" # error message, terminate with 'end'\n\n # Variables\n deb=0 # debug - set on command line\n everything=\"\" # do not override defaults\n logunsupported=0 # write unsupported options too\n\n # Precreate arrays\n # for each option:\n option[\"\"] = \"\" # list of all options: default enabled\/disabled\n done[\"\"] = 1 # marks option as having been output\n requires[\"\"] = \"\" # requires by option\n iffs[\"\"] = \"\" # if by option\n enabledby[\"\"] = \"\" # options that enable it by option\n sets[\"\"] = \"\" # settings set by each option\n setval[\"\"] = \"\" # value to set (indexed: 'option sets[option]')\n # for each setting:\n setting[\"\"] = \"\" # requires by setting\n defaults[\"\"] = \"\" # used for a defaulted value\n doneset[\"\"] = 1 # marks setting as having been output\n r[\"\"] = \"\" # Temporary array\n\n # For decorating the output file\n protect = \"\"\n}\n\n# The output file must be specified before any input:\nout == \"\" {\n print \"out=output.file must be given on the command line\"\n err = 1\n exit 1\n}\n\n# The very first line indicates whether we are reading pre-processed\n# input or not, this must come *first* because 'PREPROCESSED' needs\n# to be the very first line in the temporary file.\npre == -1{\n if ($0 == \"PREPROCESSED\") {\n pre = 0\n next\n } else {\n pre = 1\n print \"PREPROCESSED\" >out\n # And fall through to continue processing\n }\n}\n\n# While pre-processing if version is set to \"search\" look for a version string\n# in the following file.\npre && version == \"search\" && version_file == \"\"{\n version_file = FILENAME\n}\n\npre && version == \"search\" && version_file != FILENAME{\n print \"version string not found in\", version_file\n err = 1\n exit 1\n}\n\npre && version == \"search\" && $0 ~ \/^ \\* libpng version\/{\n version = substr($0, 4)\n print \"version =\", version >out\n next\n}\n\npre && FILENAME == version_file{\n next\n}\n\n# variable=value\n# Sets the given variable to the given value (the syntax is fairly\n# free form, except for deb (you are expected to understand how to\n# set the debug variable...)\n#\n# This happens before the check on 'pre' below skips most of the\n# rest of the actions, so the variable settings happen during\n# preprocessing but are recorded in the END action too. This\n# allows them to be set on the command line too.\n$0 ~ \/^[ \t]*version[ \t]*=\/{\n sub(\/^[ ]*version[ ]*=[ ]*\/, \"\")\n version = $0\n next\n}\n$0 ~ \/^[ \t]*everything[ \t=]*off[ \t]*$\/{\n everything = \"off\"\n next\n}\n$0 ~ \/^[ \t]*everything[ \t=]*on[ \t]*$\/{\n everything = \"on\"\n next\n}\n$0 ~ \/^[ \t]*logunsupported[ \t=]*0[ \t]*$\/{\n logunsupported = 0\n next\n}\n$0 ~ \/^[ \t]*logunsupported[ \t=]*1[ \t]*$\/{\n logunsupported = 1\n next\n}\n$1 == \"deb\" && $2 == \"=\" && NF == 3{\n deb = $3\n next\n}\n\n# Preprocessing - this just copies the input file with lines\n# that need preprocessing (just chunk at present) expanded\n# The bare \"pre\" instead of \"pre != 0\" crashes under Sunos awk\npre && $1 != \"chunk\"{\n print >out\n next\n}\n\n# The first characters of the line determine how it is processed,\n# leading spaces are ignored. In general tokens that are not\n# keywords are the names of options. An option 'name' is\n# controlled by the definition of the corresponding macros:\n#\n# PNG_name_SUPPORTED The option is turned on\n# PNG_NO_name\n# PNG_NO_name_SUPPORTED If the first macro is not defined\n# either of these will turn the option off\n#\n# If none of these macros are defined the option is turned on, unless\n# the keyword 'off' is given in a line relating to the option. The\n# keyword 'on' can also be given, but it will be ignored (since it is\n# the default.)\n#\n# In the syntax below a 'name' is indicated by \"NAME\", other macro\n# values are indicated by \"MACRO\", as with \"NAME\" the leading \"PNG_\"\n# is omitted, but in this case the \"NO_\" prefix and the \"_SUPPORTED\"\n# suffix are never used.\n#\n# Each line is introduced by a keyword - the first non-space characters\n# on the line. A line starting with a '#' is a comment - it is totally\n# ignored. Keywords are as follows, a NAME, is simply a macro name\n# without the leading PNG_, PNG_NO_ or the trailing _SUPPORTED.\n\n$1 ~ \/^#\/ || $0 ~ \/^[ \t]*$\/{\n next\n}\n\n# com \n# The whole line is placed in the output file as a comment with\n# the preceding 'com' removed\n$1 == \"com\"{\n if (NF > 1) {\n # sub(\/^[ \t]*com[ \t]*\/, \"\")\n $1 = \"\"\n print comment $0, cend >out\n } else\n print start end >out\n next\n}\n\n# version\n# Inserts a version comment\n$1 == \"version\" && NF == 1{\n if (version == \"\") {\n print \"ERROR: no version string set\"\n err = 1 # prevent END{} running\n exit 1\n }\n\n print comment, version, cend >out\n next\n}\n\n# file output input protect\n# Informational: the official name of the input file (without\n# make generated local directories), the official name of the\n# output file and, if required, a name to use in a protection\n# macro for the contents.\n$1 == \"file\" && NF >= 2{\n print comment, $2, cend >out\n print comment, \"Machine generated file: DO NOT EDIT\", cend >out\n if (NF >= 3)\n print comment, \"Derived from:\", $3, cend >out\n protect = $4\n if (protect != \"\") {\n print start \"#ifndef\", protect end >out\n print start \"#define\", protect end >out\n }\n next\n}\n\n# option NAME ( (requires|enables|if) NAME* | on | off | disabled |\n# sets SETTING VALUE+ )*\n# \n# Declares an option 'NAME' and describes its default setting (disabled)\n# and its relationship to other options. The option is disabled\n# unless *all* the options listed after 'requires' are set and at\n# least one of the options listed after 'if' is set. If the\n# option is set then it turns on all the options listed after 'enables'.\n#\n# Note that \"enables\" takes priority over the required\/if\/disabled\/off\n# setting of the target option.\n#\n# The definition file may list an option as 'disabled': off by default,\n# otherwise the option is enabled: on by default. A later (and it must\n# be later) entry may turn an option on or off explicitly.\n\n$1 == \"option\" && NF >= 2{\n opt = $2\n sub(\/,$\/,\"\",opt)\n onoff = option[opt] # records current (and the default is \"\", enabled)\n key = \"\"\n istart = 3\n do {\n if (istart == 1) { # continuation line\n val = getline\n\n if (val != 1) { # error reading it\n if (val == 0)\n print \"option\", opt \": ERROR: missing contination line\"\n else\n print \"option\", opt \": ERROR: error reading continuation line\"\n\n # This is a hard error\n err = 1 # prevent END{} running\n exit 1\n }\n }\n\n for (i=istart; i<=NF; ++i) {\n val=$(i)\n sub(\/,$\/,\"\",val)\n if (val == \"on\" || val == \"off\" || val == \"disabled\") {\n key = \"\"\n if (onoff != val) {\n # on or off can zap disabled or enabled:\n if (onoff == \"\" || (onoff == \"disabled\" || onoff == \"enabled\") &&\n (val == \"on\" || val == \"off\")) {\n # It's easy to mis-spell the option when turning it\n # on or off, so warn about it here:\n if (onoff == \"\" && (val == \"on\" || val == \"off\")) {\n print \"option\", opt \": ERROR: turning unrecognized option\", val\n # For the moment error out - it is safer\n err = 1 # prevent END{} running\n exit 1\n }\n onoff = val\n } else {\n # Print a message, otherwise the error\n # below is incomprehensible\n print \"option\", opt \": currently\", onoff \": attempt to turn\", val\n break\n }\n }\n } else if (val == \"requires\" || val == \"if\" || val == \"enables\" || val ==\"sets\") {\n key = val\n } else if (key == \"requires\") {\n requires[opt] = requires[opt] \" \" val\n } else if (key == \"if\") {\n iffs[opt] = iffs[opt] \" \" val\n } else if (key == \"enables\") {\n enabledby[val] = enabledby[val] \" \" opt\n } else if (key == \"sets\") {\n sets[opt] = sets[opt] \" \" val\n key = \"setval\"\n set = val\n } else if (key == \"setval\") {\n setval[opt \" \" set] = setval[opt \" \" set] \" \" val\n } else\n break # bad line format\n }\n\n istart = 1\n } while (i > NF && $0 ~ \/,$\/)\n\n if (i > NF) {\n # Set the option, defaulting to 'enabled'\n if (onoff == \"\") onoff = \"enabled\"\n option[opt] = onoff\n next\n }\n # Else fall through to the error handler\n}\n\n# chunk NAME [requires OPT] [enables LIST] [on|off|disabled]\n# Expands to the 'option' settings appropriate to the reading and\n# writing of an ancilliary PNG chunk 'NAME':\n#\n# option READ_NAME requires READ_ANCILLARY_CHUNKS [READ_OPT]\n# option READ_NAME enables NAME LIST\n# [option READ_NAME off]\n# option WRITE_NAME requires WRITE_ANCILLARY_CHUNKS [WRITE_OPT]\n# option WRITE_NAME enables NAME LIST\n# [option WRITE_NAME off]\n\npre != 0 && $1 == \"chunk\" && NF >= 2{\n # 'chunk' is handled on the first pass by writing appropriate\n # 'option' lines into the intermediate file.\n opt = $2\n sub(\/,$\/,\"\",opt)\n onoff = \"\"\n reqread = \"\"\n reqwrite = \"\"\n enables = \"\"\n req = 0\n istart = 3\n do {\n if (istart == 1) { # continuation line\n val = getline\n\n if (val != 1) { # error reading it\n if (val == 0)\n print \"chunk\", opt \": ERROR: missing contination line\"\n else\n print \"chunk\", opt \": ERROR: error reading continuation line\"\n\n # This is a hard error\n err = 1 # prevent END{} running\n exit 1\n }\n }\n\n # read the keywords\/additional OPTS\n for (i=istart; i<=NF; ++i) {\n val = $(i)\n sub(\/,$\/,\"\",val)\n if (val == \"on\" || val == \"off\" || val == \"disabled\") {\n if (onoff != val) {\n if (onoff == \"\")\n onoff = val\n else\n break # on\/off conflict\n }\n req = 0\n } else if (val == \"requires\")\n req = 1\n else if (val == \"enables\")\n req = 2\n else if (req == 1){\n reqread = reqread \" READ_\" val\n reqwrite = reqwrite \" WRITE_\" val\n } else if (req == 2)\n enables = enables \" \" val\n else\n break # bad line: handled below\n }\n\n istart = 1\n } while (i > NF && $0 ~ \/,$\/)\n\n if (i > NF) {\n # Output new 'option' lines to the intermediate file (out)\n print \"option READ_\" opt, \"requires READ_ANCILLARY_CHUNKS\" reqread, \"enables\", opt enables , onoff >out\n print \"option WRITE_\" opt, \"requires WRITE_ANCILLARY_CHUNKS\" reqwrite, \"enables\", opt enables, onoff >out\n next\n }\n # Else hit the error handler below - bad line format!\n}\n\n# setting MACRO ( requires MACRO* )* [ default VALUE ]\n# Behaves in a similar way to 'option' without looking for NO_ or\n# _SUPPORTED; the macro is enabled if it is defined so long as all\n# the 'requires' macros are also defined. The definitions may be\n# empty, an error will be issued if the 'requires' macros are\n# *not* defined. If given the 'default' value is used if the\n# macro is not defined. The default value will be re-tokenised.\n# (BTW: this is somewhat restrictive, it mainly exists for the\n# support of non-standard configurations and numeric parameters,\n# see the uses in scripts\/options.dat\n\n$1 == \"setting\" && (NF == 2 || NF >= 3 && ($3 == \"requires\" || $3 == \"default\")){\n reqs = \"\"\n deflt = \"\"\n isdef = 0\n key = \"\"\n for (i=3; i<=NF; ++i)\n if ($(i) == \"requires\" || $(i) == \"default\") {\n key = $(i)\n if (key == \"default\") isdef = 1\n } else if (key == \"requires\")\n reqs = reqs \" \" $(i)\n else if (key == \"default\")\n deflt = deflt \" \" $(i)\n else\n break # Format error, handled below\n\n setting[$2] = reqs\n # NOTE: this overwrites a previous value silently\n if (isdef && deflt == \"\")\n deflt = \" \" # as a flag to force output\n defaults[$2] = deflt\n next\n}\n\n# The order of the dependency lines (option, chunk, setting) is irrelevant\n# - the 'enables', 'requires' and 'if' settings will be used to determine\n# the correct order in the output and the final values in pnglibconf.h are\n# not order dependent. 'requires' and 'if' entries take precedence over\n# 'enables' from other options; if an option requires another option it\n# won't be set regardless of any options that enable it unless the other\n# option is also enabled.\n#\n# Similarly 'enables' trumps a NO_ definition in CFLAGS or pngusr.h\n#\n# For simplicity cycles in the definitions are regarded as errors,\n# even if they are not ambiguous.\n# A given NAME can be specified in as many 'option' lines as required, the\n# definitions are additive.\n\n# For backwards compatibility equivalent macros may be listed thus:\n#\n# = [NO_]NAME MACRO\n# Makes -DMACRO equivalent to -DPNG_NO_NAME or -DPNG_NAME_SUPPORTED\n# as appropriate.\n#\n# The definition is injected into the C compiler input when encountered\n# in the second pass (so all these definitions appear *after* the @\n# lines!)\n#\n# 'NAME' is as above, but 'MACRO' is the full text of the equivalent\n# old, deprecated, macro.\n\n$1 == \"=\" && NF == 3{\n print \"#ifdef PNG_\" $3 >out\n if ($2 ~ \/^NO_\/)\n print \"# define PNG_\" $2 >out\n else\n print \"# define PNG_\" $2 \"_SUPPORTED\" >out\n print \"#endif\" >out\n next\n}\n\n# Lines may be injected into the C compiler input by preceding them\n# with an \"@\" character. The line is copied with just the leading\n# @ removed.\n\n$1 ~ \/^@\/{\n # sub(\/^[ \t]*@\/, \"\")\n $1 = substr($1, 2)\n print >out\n next\n}\n\n# Check for unreognized lines, because of the preprocessing chunk\n# format errors will be detected on the first pass independent of\n# any other format errors.\n{\n print \"options.awk: bad line (\" NR \"):\", $0\n err = 1 # prevent END{} running\n exit 1\n}\n\n# For checking purposes names that start with \"ok_\" or \"fail_\" are\n# not output to pnglibconf.h and must be either enabled or disabled\n# respectively for the build to succeed. This allows interdependencies\n# between options of the form \"at least one of\" or \"at most one of\"\n# to be checked. For example:\n#\n# option FLOATING_POINT enables ok_math\n# option FIXED_POINT enables ok_math\n# This ensures that at least one of FLOATING_POINT and FIXED_POINT\n# must be set for the build to succeed.\n#\n# option fail_math requires FLOATING_POINT FIXED_POINT\n# This means the build will fail if *both* FLOATING_POINT and\n# FIXED_POINT are set (this is an example; in fact both are allowed.)\n#\n# If all these options were given the build would require exactly one\n# of the names to be enabled.\n\nEND{\n # END{} gets run on an exit (a traditional awk feature)\n if (err) exit 1\n\n if (pre) {\n # Record the final value of the variables\n print \"deb =\", deb >out\n if (everything != \"\") {\n print \"everything =\", everything >out\n }\n print \"logunsupported =\", logunsupported >out\n exit 0\n }\n\n # Do the options first (allowing options to set settings). The dependency\n # tree is thus:\n #\n # name > name\n # name requires name\n # name if name\n # name enabledby name\n #\n # First build a list 'tree' by option of all the things on which\n # it depends.\n print \"\" >out\n print \"\/* OPTIONS *\/\" >out\n print comment, \"options\", cend >out\n for (opt in enabledby) tree[opt] = 1 # may not be explicit options\n for (opt in option) if (opt != \"\") {\n o = option[opt]\n # option should always be one of the following values\n if (o != \"on\" && o != \"off\" && o != \"disabled\" && o != \"enabled\") {\n print \"internal option error (\" o \")\"\n exit 1\n }\n tree[opt] = \"\" # so unlisted options marked\n }\n for (opt in tree) if (opt != \"\") {\n if (tree[opt] == 1) {\n tree[opt] = \"\"\n if (option[opt] != \"\") {\n print \"internal error (1)\"\n exit 1\n }\n # Macros only listed in 'enables' remain off unless\n # one of the enabling macros is on.\n option[opt] = \"disabled\"\n }\n\n split(\"\", list) # clear 'list'\n # Now add every requires, iffs or enabledby entry to 'list'\n # so that we can add a unique list of requirements to tree[i]\n split(requires[opt] iffs[opt] enabledby[opt], r)\n for (i in r) list[r[i]] = 1\n for (i in list) tree[opt] = tree[opt] \" \" i\n }\n\n # print the tree for extreme debugging\n if (deb > 2) for (i in tree) if (i != \"\") print i, \"depends-on\" tree[i]\n\n # Ok, now check all options marked explicitly 'on' or 'off':\n #\n # If an option[opt] is 'on' then turn on all requires[opt]\n # If an option[opt] is 'off' then turn off all enabledby[opt]\n #\n # Error out if we have to turn 'on' an 'off' option or vice versa.\n npending = 0\n for (opt in option) if (opt != \"\") {\n if (option[opt] == \"on\" || option[opt] == \"off\") {\n pending[++npending] = opt\n }\n }\n\n err = 0 # set on error\n while (npending > 0) {\n opt = pending[npending--]\n if (option[opt] == \"on\") {\n nreqs = split(requires[opt], r)\n for (j=1; j<=nreqs; ++j) {\n if (option[r[j]] == \"off\") {\n print \"option\", opt, \"turned on, but requirement\", r[j], \"is turned off\"\n err = 1\n } else if (option[r[j]] != \"on\") {\n option[r[j]] = \"on\"\n pending[++npending] = r[j]\n }\n }\n } else {\n if (option[opt] != \"off\") {\n print \"internal error (2)\"\n exit 1\n }\n nreqs = split(enabledby[opt], r)\n for (j=1; j<=nreqs; ++j) {\n if (option[r[j]] == \"on\") {\n print \"option\", opt, \"turned off, but enabled by\", r[j], \"which is turned on\"\n err = 1\n } else if (option[r[j]] != \"off\") {\n option[r[j]] = \"off\"\n pending[++npending] = r[j]\n }\n }\n }\n }\n if (err) exit 1\n\n # Sort options:\n print \"PNG_DFN_START_SORT 2\" >out\n\n # option[i] is now the complete list of all the tokens we may\n # need to output, go through it as above, depth first.\n finished = 0\n while (!finished) {\n finished = 1\n movement = 0 # done nothing\n for (i in option) if (!done[i]) {\n nreqs = split(tree[i], r)\n if (nreqs > 0) {\n for (j=1; j<=nreqs; ++j) if (!done[r[j]]) {\n break\n }\n if (j<=nreqs) {\n finished = 0\n continue # next option\n }\n }\n\n # All the requirements have been processed, output\n # this option. An option is _SUPPORTED if:\n #\n # all 'requires' are _SUPPORTED AND\n # at least one of the 'if' options are _SUPPORTED AND\n # EITHER:\n # The name is _SUPPORTED (on the command line)\n # OR:\n # an 'enabledby' is _SUPPORTED\n # OR:\n # NO_name is not defined AND\n # the option is not disabled; an option is disabled if:\n # option == off\n # option == disabled && everything != on\n # option == \"\" && everything == off\n if (deb) print \"option\", i\n print \"\" >out\n print \"\/* option:\", i, option[i] >out\n print \" * requires: \" requires[i] >out\n print \" * if: \" iffs[i] >out\n print \" * enabled-by:\" enabledby[i] >out\n print \" * sets: \" sets[i], \"*\/\" >out\n print \"#undef PNG_on\" >out\n print \"#define PNG_on 1\" >out\n\n # requires\n nreqs = split(requires[i], r)\n for (j=1; j<=nreqs; ++j) {\n print \"#ifndef PNG_\" r[j] \"_SUPPORTED\" >out\n print \"# undef PNG_on \/*!\" r[j] \"*\/\" >out\n # this error appears in the final output if something\n # was switched 'on' but the processing above to force\n # the requires did not work\n if (option[i] == \"on\") {\n print error, i, \"requires\", r[j] end >out\n }\n print \"#endif\" >out\n }\n\n # if\n nreqs = split(iffs[i], r)\n print \"#undef PNG_no_if\" >out\n if (nreqs > 0) {\n print \"\/* if\" iffs[i], \"*\/\" >out\n print \"#define PNG_no_if 1\" >out\n for (j=1; j<=nreqs; ++j) {\n print \"#ifdef PNG_\" r[j] \"_SUPPORTED\" >out\n print \"# undef PNG_no_if \/*\" r[j] \"*\/\" >out\n print \"#endif\" >out\n }\n print \"#ifdef PNG_no_if \/*missing if*\/\" >out\n print \"# undef PNG_on\" >out\n # There is no checking above for this, because we\n # don't know which 'if' to choose, so whine about\n # it here:\n if (option[i] == \"on\") {\n print error, i, \"needs one of:\", iffs[i] end >out\n }\n print \"#endif\" >out\n }\n\n print \"#ifdef PNG_on \/*requires, if*\/\" >out\n # enables\n print \"# undef PNG_not_enabled\" >out\n print \"# define PNG_not_enabled 1\" >out\n print \" \/* enabled by\" enabledby[i], \"*\/\" >out\n nreqs = split(enabledby[i], r)\n for (j=1; j<=nreqs; ++j) {\n print \"#ifdef PNG_\" r[j] \"_SUPPORTED\" >out\n print \"# undef PNG_not_enabled \/*\" r[j] \"*\/\" >out\n # Oops, probably not intended (should be factored\n # out by the checks above).\n if (option[i] == \"off\") {\n print error, i, \"enabled by:\", r[j] end >out\n }\n print \"#endif\" >out\n }\n\n print \"# ifndef PNG_\" i \"_SUPPORTED \/*!command line*\/\" >out\n print \"# ifdef PNG_not_enabled \/*!enabled*\/\" >out\n if (option[i] == \"off\" || option[i] == \"disabled\" && everything != \"on\" || option[i] == \"enabled\" && everything == \"off\") {\n print \"# undef PNG_on \/*default off*\/\" >out\n } else {\n print \"# ifdef PNG_NO_\" i >out\n print \"# undef PNG_on \/*turned off*\/\" >out\n print \"# endif\" >out\n print \"# ifdef PNG_NO_\" i \"_SUPPORTED\" >out\n print \"# undef PNG_on \/*turned off*\/\" >out\n print \"# endif\" >out\n }\n print \"# endif \/*!enabled*\/\" >out\n print \"# ifdef PNG_on\" >out\n # The _SUPPORTED macro must be defined so that dependent\n # options output later work.\n print \"# define PNG_\" i \"_SUPPORTED\" >out\n print \"# endif\" >out\n print \"# endif \/*!command line*\/\" >out\n # If PNG_on is still set the option should be defined in\n # pnglibconf.h\n print \"# ifdef PNG_on\" >out\n if (i ~ \/^fail_\/) {\n print error, i, \"is on: enabled by:\" iffs[i] enabledby[i] \", requires\" requires[i] end >out\n } else if (i !~ \/^ok_\/) {\n print def i sup >out\n # Supported option, set required settings\n nreqs = split(sets[i], r)\n for (j=1; j<=nreqs; ++j) {\n print \"# ifdef PNG_set_\" r[j] >out\n # Some other option has already set a value:\n print error, i, \"sets\", r[j] \": duplicate setting\" end >out\n print error, \" previous value: \" end \"PNG_set_\" r[j] >out\n print \"# else\" >out\n # Else set the default: note that this won't accept arbitrary\n # values, the setval string must be acceptable to all the C\n # compilers we use. That means it must be VERY simple; a number,\n # a name or a string.\n print \"# define PNG_set_\" r[j], setval[i \" \" r[j]] >out\n print \"# endif\" >out\n }\n }\n print \"# endif \/* definition *\/\" >out\n print \"#endif \/*requires, if*\/\" >out\n if (logunsupported || i ~ \/^ok_\/) {\n print \"#ifndef PNG_on\" >out\n if (logunsupported) {\n print und i une >out\n }\n if (i ~ \/^ok_\/) {\n print error, i, \"not enabled: requires:\" requires[i] \", enabled by:\" iffs[i] enabledby[i] end >out\n }\n print \"#endif\" >out\n }\n\n done[i] = 1\n ++movement\n }\n\n if (!finished && !movement) {\n print \"option: loop or missing option in dependency tree, cannot process:\"\n for (i in option) if (!done[i]) {\n print \" option\", i, \"depends on\" tree[i], \"needs:\"\n nreqs = split(tree[i], r)\n if (nreqs > 0) for (j=1; j<=nreqs; ++j) if (!done[r[j]]) {\n print \" \" r[j]\n }\n }\n exit 1\n }\n }\n print \"PNG_DFN_END_SORT\" >out\n print comment, \"end of options\", cend >out\n\n # Do the 'setting' values second, the algorithm the standard\n # tree walk (O(1)) done in an O(2) while\/for loop; interations\n # settings x depth, outputing the deepest required macros\n # first.\n print \"\" >out\n print \"\/* SETTINGS *\/\" >out\n print comment, \"settings\", cend >out\n # Sort (in dfn.awk) on field 2, the setting name\n print \"PNG_DFN_START_SORT 2\" >out\n finished = 0\n while (!finished) {\n finished = 1\n movement = 0 # done nothing\n for (i in setting) if (!doneset[i]) {\n nreqs = split(setting[i], r)\n if (nreqs > 0) {\n # By default assume the requires values are options, but if there\n # is no option with that name check for a setting\n for (j=1; j<=nreqs; ++j) if (option[r[j]] == \"\" && !doneset[r[j]]) {\n break\n }\n if (j<=nreqs) {\n finished = 0\n continue # try a different setting\n }\n }\n\n # All the requirements have been processed, output\n # this setting.\n if (deb) print \"setting\", i\n deflt = defaults[i]\n # Remove any spurious trailing spaces\n sub(\/ *$\/,\"\",deflt)\n # A leading @ means leave it unquoted so the preprocessor\n # can substitute the build time value\n if (deflt ~ \/^ @\/)\n deflt = \" \" subs substr(deflt, 3) sube\n print \"\" >out\n print \"\/* setting: \", i >out\n print \" * requires:\" setting[i] >out\n print \" * default: \", defaults[i] deflt, \"*\/\" >out\n for (j=1; j<=nreqs; ++j) {\n if (option[r[j]] != \"\")\n print \"#ifndef PNG_\" r[j] \"_SUPPORTED\" >out\n else\n print \"#ifndef PNG_\" r[j] >out\n print error, i, \"requires\", r[j] end >out\n print \"# endif\" >out\n }\n # The precedence is:\n #\n # 1) External definition; trumps:\n # 2) Option 'sets' value; trumps:\n # 3) Setting 'default'\n #\n print \"#ifdef PNG_\" i >out\n # PNG_ is defined, so substitute the value:\n print def i, subs \"PNG_\" i sube end >out\n print \"#else \/* use default *\/\" >out\n print \"# ifdef PNG_set_\" i >out\n # Value from an option 'sets' argument\n print def i, subs \"PNG_set_\" i sube end >out\n # This is so that subsequent tests on the setting work:\n print \"# define PNG_\" i, \"1\" >out\n if (defaults[i] != \"\") {\n print \"# else \/*default*\/\" >out\n print def i deflt end >out\n print \"# define PNG_\" i, \"1\" >out\n }\n print \"# endif \/* defaults *\/\" >out\n print \"#endif \/* setting\", i, \"*\/\" >out\n\n doneset[i] = 1\n ++movement\n }\n\n if (!finished && !movement) {\n print \"setting: loop or missing setting in 'requires', cannot process:\"\n for (i in setting) if (!doneset[i]) {\n print \" setting\", i, \"requires\" setting[i]\n }\n exit 1\n }\n }\n print \"PNG_DFN_END_SORT\" >out\n print comment, \"end of settings\", cend >out\n\n # Regular end - everything looks ok\n if (protect != \"\") {\n print start \"#endif\", \"\/*\", protect, \"*\/\" end >out\n }\n}\n","avg_line_length":35.029082774,"max_line_length":132,"alphanum_fraction":0.5513794865} {"size":457,"ext":"awk","lang":"Awk","max_stars_count":null,"content":"BEGIN {\n FS = \"|\"\n cntZero = 0\n cntNull = 0\n}\n\n{ \n # Z\n z = $10\n gsub(\/ \/, \"\", z)\n if (z == \"\")\n printf \"null\"\n else \n printf \"%s\", z\n\n printf \"\\n\"\n\n if (z == \"\")\n cntNull = cntNull + 1\n else {\n if (z == 0) cntZero = cntZero + 1\n }\n}\n\nEND {\n if (cntNull > 0)\n printf \"WARN, %d stars have z values of null\\n\", cntNull\n if (cntZero > 0)\n printf \"WARN, %d stars have z values of zero\\n\", cntZero\n}\n","avg_line_length":14.7419354839,"max_line_length":62,"alphanum_fraction":0.4595185996} {"size":379,"ext":"awk","lang":"Awk","max_stars_count":59.0,"content":"# Written by Aleksey Cheusov , public domain\n#\n# This awk module is a part of RunAWK distribution,\n# http:\/\/sourceforge.net\/projects\/runawk\n# \n############################################################\n\n# =head2 isnum.awk\n#\n# =over 2\n#\n# =item I\n#\n# returns 1 if an argument is a number\n#\n# =back\n#\n\nfunction isnum (v){\n\treturn v == v + 0\n}\n","avg_line_length":17.2272727273,"max_line_length":60,"alphanum_fraction":0.5356200528} {"size":5554,"ext":"awk","lang":"Awk","max_stars_count":1.0,"content":"# Licensed to the Apache Software Foundation (ASF) under one or more\n# contributor license agreements. See the NOTICE file distributed with\n# this work for additional information regarding copyright ownership.\n# The ASF licenses this file to You under the Apache License, Version 2.0\n# (the \"License\"); you may not use this file except in compliance with\n# the License. You may obtain a copy of the License at\n#\n# http:\/\/www.apache.org\/licenses\/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\nBEGIN {\n \n A[\"ServerRoot\"] = \"SYS:\/\"BDIR\n A[\"Port\"] = PORT\n A[\"SSLPort\"] = SSLPORT\n A[\"cgidir\"] = \"cgi-bin\"\n A[\"logfiledir\"] = \"logs\"\n A[\"htdocsdir\"] = \"htdocs\"\n A[\"sysconfdir\"] = \"conf\"\n A[\"iconsdir\"] = \"icons\"\n A[\"manualdir\"] = \"manual\"\n A[\"runtimedir\"] = \"logs\"\n A[\"errordir\"] = \"error\"\n A[\"proxycachedir\"] = \"proxy\"\n\n B[\"htdocsdir\"] = A[\"ServerRoot\"]\"\/\"A[\"htdocsdir\"]\n B[\"iconsdir\"] = A[\"ServerRoot\"]\"\/\"A[\"iconsdir\"]\n B[\"manualdir\"] = A[\"ServerRoot\"]\"\/\"A[\"manualdir\"]\n B[\"errordir\"] = A[\"ServerRoot\"]\"\/\"A[\"errordir\"]\n B[\"proxycachedir\"] = A[\"ServerRoot\"]\"\/\"A[\"proxycachedir\"]\n B[\"cgidir\"] = A[\"ServerRoot\"]\"\/\"A[\"cgidir\"]\n B[\"logfiledir\"] = A[\"logfiledir\"]\n B[\"sysconfdir\"] = A[\"sysconfdir\"]\n B[\"runtimedir\"] = A[\"runtimedir\"]\n}\n\n\/@@LoadModule@@\/ {\n print \"#LoadModule actions_module modules\/actions.nlm\"\n print \"#LoadModule auth_basic_module modules\/authbasc.nlm\"\n print \"#LoadModule auth_digest_module modules\/authdigt.nlm\"\n print \"#LoadModule authn_anon_module modules\/authnano.nlm\"\n print \"#LoadModule authn_dbd_module modules\/authndbd.nlm\"\n print \"#LoadModule authn_dbm_module modules\/authndbm.nlm\"\n print \"#LoadModule authn_default_module modules\/authndef.nlm\"\n print \"#LoadModule authn_file_module modules\/authnfil.nlm\"\n print \"#LoadModule authz_dbd_module modules\/authzdbd.nlm\"\n print \"#LoadModule authz_dbm_module modules\/authzdbm.nlm\"\n print \"#LoadModule authz_default_module modules\/authzdef.nlm\"\n print \"#LoadModule authz_groupfile_module modules\/authzgrp.nlm\"\n print \"#LoadModule authz_user_module modules\/authzusr.nlm\"\n print \"#LoadModule authnz_ldap_module modules\/authnzldap.nlm\"\n print \"#LoadModule ldap_module modules\/utilldap.nlm\"\n print \"#LoadModule asis_module modules\/mod_asis.nlm\"\n print \"LoadModule autoindex_module modules\/autoindex.nlm\"\n print \"#LoadModule cern_meta_module modules\/cernmeta.nlm\"\n print \"#LoadModule cgi_module modules\/mod_cgi.nlm\"\n print \"#LoadModule dav_module modules\/mod_dav.nlm\"\n print \"#LoadModule dav_fs_module modules\/moddavfs.nlm\"\n print \"#LoadModule dav_lock_module modules\/moddavlk.nlm\"\n print \"#LoadModule expires_module modules\/expires.nlm\"\n print \"#LoadModule ext_filter_module modules\/extfiltr.nlm\"\n print \"#LoadModule file_cache_module modules\/filecach.nlm\"\n print \"#LoadModule headers_module modules\/headers.nlm\"\n print \"#LoadModule ident_module modules\/modident.nlm\"\n print \"#LoadModule imagemap_module modules\/imagemap.nlm\"\n print \"#LoadModule info_module modules\/info.nlm\"\n print \"#LoadModule log_forensic_module modules\/forensic.nlm\"\n print \"#LoadModule logio_module modules\/modlogio.nlm\"\n print \"#LoadModule mime_magic_module modules\/mimemagi.nlm\"\n print \"#LoadModule proxy_module modules\/proxy.nlm\"\n print \"#LoadModule proxy_connect_module modules\/proxycon.nlm\"\n print \"#LoadModule proxy_http_module modules\/proxyhtp.nlm\"\n print \"#LoadModule proxy_ftp_module modules\/proxyftp.nlm\"\n print \"#LoadModule rewrite_module modules\/rewrite.nlm\"\n print \"#LoadModule speling_module modules\/speling.nlm\"\n print \"#LoadModule status_module modules\/status.nlm\"\n print \"#LoadModule unique_id_module modules\/uniqueid.nlm\"\n print \"#LoadModule usertrack_module modules\/usertrk.nlm\"\n print \"#LoadModule version_module modules\/modversion.nlm\"\n print \"#LoadModule userdir_module modules\/userdir.nlm\"\n print \"#LoadModule vhost_alias_module modules\/vhost.nlm\"\n if (MODSSL) {\n print \"#LoadModule ssl_module modules\/mod_ssl.nlm\"\n }\n print \"\"\n next\n}\n\nmatch ($0,\/^#SSLSessionCache +\"dbm:\/) {\n sub(\/^#\/, \"\")\n}\n\nmatch ($0,\/^SSLSessionCache +\"shmcb:\/) {\n sub(\/^SSLSessionCache\/, \"#SSLSessionCache\")\n}\n\nmatch ($0,\/^SSLMutex +\"file:@exp_runtimedir@\\\/ssl_mutex\"\/) {\n sub(\/\"file:@exp_runtimedir@\\\/ssl_mutex\"\/, \"default\")\n}\n\nmatch ($0,\/@@.*@@\/) {\n s=substr($0,RSTART+2,RLENGTH-4)\n sub(\/@@.*@@\/,A[s],$0)\n}\n\nmatch ($0,\/@rel_.*@\/) {\n s=substr($0,RSTART+5,RLENGTH-6)\n sub(\/@rel_.*@\/,A[s],$0)\n}\n\nmatch ($0,\/@exp_.*@\/) {\n s=substr($0,RSTART+5,RLENGTH-6)\n sub(\/@exp_.*@\/,B[s],$0)\n}\n\nmatch ($0,\/@nonssl_.*@\/) {\n s=substr($0,RSTART+8,RLENGTH-9)\n sub(\/@nonssl_.*@\/,B[s],$0)\n}\n\n{\n print\n}\n\n\nEND {\n if ((ARGV[1] ~ \/httpd.conf.in\/) && !BSDSKT) { \n print \"\"\n print \"#\"\n print \"# SecureListen: Allows you to securely bind Apache to specific IP addresses \"\n print \"# and\/or ports.\"\n print \"#\"\n print \"# Change this to SecureListen on specific IP addresses as shown below to \"\n print \"# prevent Apache from glomming onto all bound IP addresses (0.0.0.0)\"\n print \"#\"\n print \"#SecureListen \"SSLPORT\" \\\"SSL CertificateDNS\\\"\"\n print \"\"\n }\n}\n","avg_line_length":38.3034482759,"max_line_length":91,"alphanum_fraction":0.6948145481} {"size":1189,"ext":"awk","lang":"Awk","max_stars_count":null,"content":"#converts a genotype file (transpose of linkage file with marker names) to posterior\n#awk [-verror=0.001] -f genotype2post.awk genotypes >genotypes.post\nfunction alleles2Index(a, b)\n{\n\tif (b == 1)\n\t\treturn a\n\tif (b == 2)\n\t\treturn 3 + a\n\tif (b == 3)\n\t\treturn 5 + a\n\treturn 10\n}\nfunction allele1(code)\n{\n\tif (code <= 4)\n\t\treturn 1\n\tif (code <= 7)\n\t\treturn 2\n\tif (code <= 9)\n\t\treturn 3\n\treturn 4\n}\nfunction allele2(code)\n{\n\tif (code <= 4)\n\t\treturn code\n\tif (code <= 7)\n\t\treturn code - 3\n\tif (code <= 9)\n\t\treturn code - 5\n\treturn 4\n}\n\nfunction distance(code1, code2 ,a1,a2,b1,b2)\n{\n\tif (code1 == code2)\n\t\treturn 0\n\ta1 = allele1(code1)\n\ta2 = allele2(code1)\n\n\tb1 = allele1(code2)\n\tb2 = allele2(code2)\n\n\tif (a1 == b1 || a1 == b2 || a2 == b1 || a2 == b2)\n\t\treturn 1\n\treturn 2\n}\n\n\n\nBEGIN{\n\tFS=\"\\t\"\n\tOFS=\"\\t\"\n\tif (error == \"\")\n\t\terror = 0.001\n\n\tcode = 1\n\tfor (i = 1; i <= 4; ++i)\n\t\tfor (j = i; j <= 4; ++j) {\n\t\t\ts = \"\"\n\t\t\tfor (k = 1; k <= 10; ++k)\n\t\t\t\ts = s \" \" error ** distance(code, k)\n\t\t\tmap[i \" \" j] = substr(s, 2)\n\t\t\tmap[j \" \" i] = map[i \" \" j]\n\t\t\t++code\n\t\t}\n\n\tmap[\"0 0\"] = \"1 1 1 1 1 1 1 1 1 1\"\n}\n\n($1 !~ \/^#\/) {\n\tif (++line > 6)\n\t\tfor (i = 3; i <= NF; ++i)\n\t\t\t$i = map[$i]\n\tprint\n} \n\n\n","avg_line_length":15.0506329114,"max_line_length":84,"alphanum_fraction":0.5239697225} {"size":118,"ext":"awk","lang":"Awk","max_stars_count":null,"content":"BEGIN {\n RS = \"&\"\n FS = \"=\"\n print \"{\"\n}\n\n{\n printf \"\\t\\\"%s\\\": \\\"%s\\\"\\n\", $1, $2\n}\n\nEND {\n print \"}\"\n}\n","avg_line_length":8.4285714286,"max_line_length":39,"alphanum_fraction":0.2881355932} {"size":335,"ext":"awk","lang":"Awk","max_stars_count":4.0,"content":"BEGIN { FS=\",\"; FPAT = \"([^,]*)|(\\\"[^\\\"]+\\\")\"}\n {\n suff=\"-column\"\n ext=\".csv\"\nif((ARGV[1]==\"ncvoter.csv\" && NF==71) || (ARGV[1]==\"openaddress.csv\" && NF==11))\n{\nfor(i = 1; i <= NF; i++)\n { gsub(\/\"\/, \"\", $i);\n gsub(\/^[ \\t]+\/,\"\",$i);\n if (length($i)>0) \n {printf $i\"\\n\" >> gensub(ext,suff i ext,\"g\",ARGV[1]);} \n }\n }\n}","avg_line_length":23.9285714286,"max_line_length":80,"alphanum_fraction":0.3940298507} {"size":769,"ext":"awk","lang":"Awk","max_stars_count":26.0,"content":"#!\/usr\/bin\/awk -f\n\n#----------------------------------------------------------------------\n#\n# usage: gdb-org.sh < gdb frame > gdb.org\n#\n# Generates org-mode file \"gdb.org\" containing stack frame with links\n# that can be opened with C-c C-o in emacs with org-mode installed.\n#\n#----------------------------------------------------------------------\n\n\nBEGIN {\n print \"* GDB stack frame [\/]\";\n c=0;\n ferror = 0;\n}\n\/^#\/ {\n enum=$1\n}\n\/ at \/ {\n n=length($0)\n i=index($0,\" at \")\n s = substr($0,i+4,n-i)\n t=s\n i=index(t,\"\/\")\n while (i != 0) {\n\t# remove all chars left of right-most '\/'\n\tn=length(t)\n\tt=substr(t,i+1,n-i);\n\ti=index(t,\"\/\")\n }\n gsub(\/:\/,\"::\",s)\n gsub(\/build\/,\"src\",s)\n \n print \"** TODO\",enum,\"[[file:\" s \"][\" t \"]]\"\n}\n","avg_line_length":20.2368421053,"max_line_length":71,"alphanum_fraction":0.4148244473} {"size":2231,"ext":"awk","lang":"Awk","max_stars_count":445.0,"content":"BEGIN\t{\n\t FS=\"\\\"\";\n\t print \"\/* ==> Do not modify this file!! \" \\\n\t\t\"-*- buffer-read-only: t -*- vi\" \\\n\t\t\":set ro:\";\n\t print \" It is created automatically by copying.awk.\";\n\t print \" Modify copying.awk instead. <== *\/\";\n\t print \"\"\n\t print \"#include \\\"defs.h\\\"\"\n\t print \"#include \\\"command.h\\\"\"\n\t print \"#include \\\"gdbcmd.h\\\"\"\n\t print \"\"\n\t print \"static void show_copying_command (const char *, int);\"\n\t print \"\"\n\t print \"static void show_warranty_command (const char *, int);\"\n\t print \"\"\n\t print \"static void\";\n\t print \"show_copying_command (const char *ignore, int from_tty)\";\n\t print \"{\";\n\t}\nNR == 1,\/^[ \t]*15\\. Disclaimer of Warranty\\.[ \t]*$\/\t{\n\t if ($0 ~ \/\f\/)\n\t {\n\t printf \" printf_filtered (\\\"\\\\n\\\");\\n\";\n\t }\n\t else if ($0 !~ \/^[ \t]*15\\. Disclaimer of Warranty\\.[ \t]*$\/) \n\t {\n\t printf \" printf_filtered (\\\"\";\n\t for (i = 1; i < NF; i++)\n\t\tprintf \"%s\\\\\\\"\", $i;\n\t printf \"%s\\\\n\\\");\\n\", $NF;\n\t }\n\t}\n\/^[\t ]*15\\. Disclaimer of Warranty\\.[ \t]*$\/\t{\n\t print \"}\";\n\t print \"\";\n\t print \"static void\";\n\t print \"show_warranty_command (const char *ignore, int from_tty)\";\n\t print \"{\";\n\t}\n\/^[ \t]*15\\. Disclaimer of Warranty\\.[ \t]*$\/, \/^[ \t]*END OF TERMS AND CONDITIONS[ \t]*$\/{ \n\t if (! ($0 ~ \/^[ \t]*END OF TERMS AND CONDITIONS[ \t]*$\/)) \n\t {\n\t printf \" printf_filtered (\\\"\";\n\t for (i = 1; i < NF; i++)\n\t\tprintf \"%s\\\\\\\"\", $i;\n\t printf \"%s\\\\n\\\");\\n\", $NF;\n\t }\n\t}\nEND\t{\n\t print \"}\";\n\t print \"\";\n\t print \"void\"\n\t print \"_initialize_copying (void)\";\n\t print \"{\";\n\t print \" add_cmd (\\\"copying\\\", no_set_class, show_copying_command,\";\n\t print \"\t _(\\\"Conditions for redistributing copies of GDB.\\\"),\";\n\t print \"\t &showlist);\";\n\t print \" add_cmd (\\\"warranty\\\", no_set_class, show_warranty_command,\";\n\t print \"\t _(\\\"Various kinds of warranty you do not have.\\\"),\";\n\t print \"\t &showlist);\";\n\t print \"\";\n\t print \" \/* For old-timers, allow \\\"info copying\\\", etc. *\/\";\n\t print \" add_info (\\\"copying\\\", show_copying_command,\";\n\t print \"\t _(\\\"Conditions for redistributing copies of GDB.\\\"));\";\n\t print \" add_info (\\\"warranty\\\", show_warranty_command,\";\n\t print \"\t _(\\\"Various kinds of warranty you do not have.\\\"));\";\n\t print \"}\";\n\t}\n","avg_line_length":31.8714285714,"max_line_length":89,"alphanum_fraction":0.5369789332} {"size":1167,"ext":"awk","lang":"Awk","max_stars_count":null,"content":"# exstatus.awk - Extract status codes from status.h\n#\tCopyright (C) 2007 Free Software Foundation, Inc.\n#\n# This file is part of GnuPG.\n#\n# GnuPG is free software; you can redistribute it and\/or modify\n# it under the terms of the GNU General Public License as published by\n# the Free Software Foundation; either version 3 of the License, or\n# (at your option) any later version.\n#\n# GnuPG is distributed in the hope that it will be useful,\n# but WITHOUT ANY WARRANTY; without even the implied warranty of\n# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n# GNU General Public License for more details.\n#\n# You should have received a copy of the GNU General Public License\n# along with this program; if not, see .\n\nBEGIN {\n print \"# Created by exstatus.awk - DO NOT EDIT.\"\n topheader = 0;\n code = 0;\n}\n\ntopheader == 0 && \/^\\\/\\*\/ { topheader = 1 }\ntopheader == 1 { print $0 }\ntopheader == 1 && \/\\*\\\/\/ { topheader = 2; print \"\" }\n\n\/^[ \\t]+STATUS_[A-Za-z_]+\/ {\n sub (\/[,\\\/\\*]+\/, \"\", $1);\n desc = substr($1,8);\n printf \"%d\\t%s\\t%s\\n\", code, $1, desc;\n code++;\n}\n\n\nEND {\n print \"# end of status codes.\"\n}\n","avg_line_length":29.175,"max_line_length":70,"alphanum_fraction":0.6572407883} {"size":2061,"ext":"awk","lang":"Awk","max_stars_count":1.0,"content":"# MAINTAINER: ports@FreeBSD.org\n# $FreeBSD: head\/Mk\/Scripts\/cargo-crates.awk 446198 2017-07-19 14:00:16Z tobik $\n\nBEGIN {\n\tgh_tuple_len = 0\n\tcrates_len = 0\n\tpackage_name = \"\"\n}\n\n\/^\"checksum .* .* \\(registry\\+.*\\)\" = \".*\"\/ {\n\t# $2: crate\n\t# $3: version\n\t# $4: url\n\t# $6: checksum\n\tcrates[crates_len++] = sprintf(\"%s-%s\", $2, $3)\n}\n\n\/^name = \".*\"\/ {\n\tpackage_name = $3\n\tgsub(\"[^a-zA-Z_]\", \"\", package_name)\n}\n\nfunction split_url(s) {\n\t# scheme:[\/\/[user[:password]@]host[:port]][\/path][?query][#fragment]\n\tsplit(s, url_scheme, \":\/\/\")\n\turl[\"scheme\"] = url_scheme[1]\n\n\tsplit(url_scheme[2], url_fragment, \"#\")\n\turl[\"fragment\"] = url_fragment[2]\n\n\tsplit(url_fragment[1], url_query, \"?\")\n\turl[\"query\"] = url_query[2]\n\n\tsplit(url_query[1], url_authority, \"\/\")\n\turl[\"path\"] = substr(url_query[1], length(url_authority[1]) + 1)\n\n\tsplit(url_authority[1], url_auth, \"@\")\n\n\tif (length(url_auth) == 2) {\n\t\tsplit(url_auth[1], url_user, \":\")\n\t\turl[\"user\"] = url_user[1]\n\t\turl[\"password\"] = url_user[2]\n\t\tsplit(url_auth[2], url_host, \":\")\n\t} else {\n\t\turl[\"user\"] = \"\"\n\t\turl[\"password\"] = \"\"\n\t\tsplit(url_auth[1], url_host, \":\")\n\t}\n\turl[\"host\"] = url_host[1]\n\turl[\"port\"] = url_host[2]\n}\n\n\/^source = \"git\\+(https|http|git):\\\/\\\/github.com\\\/.*#.*\"\/ {\n\tsplit_url(substr($3, 1, length($3) - 1))\n\t\n\tsplit(url[\"path\"], path, \"\/\")\n\taccount = path[2]\n\tproject = path[3]\n\tgsub(\"\\.git$\", \"\", project)\n\t\n\tif (match(url[\"query\"], \"^tag=\")) {\n\t\tsplit(url[\"query\"], tag_, \"=\")\n\t\ttag = tag_[2]\n\t} else {\n\t\ttag = url[\"fragment\"]\n\t}\n\tgh_tuple[gh_tuple_len++] = sprintf(\\\n\t\t\"%s:%s:%s:%s\", account, project, tag, package_name)\n}\n\nfunction print_array(start, arr, arrlen) {\n\tend = \" \\\\\\n\"\n\tfor (i = 0; i < arrlen; i++) {\n\t\tif (i == arrlen - 1) {\n\t\t\tend = \"\\n\"\n\t\t}\n\t\tprintf \"%s\\t%s%s\", start, arr[i], end\n\t\tstart = \"\\t\"\n\t}\n}\n\nEND {\n\tif (gh_tuple_len > 0 && ENVIRON[\"USE_GITHUB\"] == \"\") {\n\t\tprintf \"USE_GITHUB=\\tnodefault\\n\"\n\t}\n\tprint_array(\"GH_TUPLE=\", gh_tuple, gh_tuple_len)\n\tprint_array(\"CARGO_CRATES=\", crates, crates_len)\n\tif (gh_tuple_len > 0) {\n\t\tprintf \"CARGO_USE_GITHUB=\\tyes\\n\"\n\t}\n}\n","avg_line_length":22.402173913,"max_line_length":80,"alphanum_fraction":0.5875788452} {"size":13244,"ext":"awk","lang":"Awk","max_stars_count":null,"content":"#!\/usr\/bin\/awk -f\n#\n# Copyright (c) 2008-2009 Ariff Abdullah \n# All rights reserved.\n#\n# Redistribution and use in source and binary forms, with or without\n# modification, are permitted provided that the following conditions\n# are met:\n# 1. Redistributions of source code must retain the above copyright\n# notice, this list of conditions and the following disclaimer.\n# 2. Redistributions in binary form must reproduce the above copyright\n# notice, this list of conditions and the following disclaimer in the\n# documentation and\/or other materials provided with the distribution.\n#\n# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n# SUCH DAMAGE.\n#\n# $FreeBSD: soc2013\/dpl\/head\/sys\/tools\/sound\/feeder_eq_mkfilter.awk 193932 2009-06-10 06:49:45Z ariff $\n#\n\n#\n# Biquad coefficients generator for Parametric Software Equalizer. Not as ugly\n# as 'feeder_rate_mkfilter.awk'\n#\n# Based on:\n#\n# \"Cookbook formulae for audio EQ biquad filter coefficients\"\n# by Robert Bristow-Johnson \n#\n# - http:\/\/www.musicdsp.org\/files\/Audio-EQ-Cookbook.txt\n#\n\n\n\n#\n# Some basic Math functions.\n#\nfunction abs(x)\n{\n\treturn (((x < 0) ? -x : x) + 0);\n}\n\nfunction fabs(x)\n{\n\treturn (((x < 0.0) ? -x : x) + 0.0);\n}\n\nfunction floor(x, r)\n{\n\tr = int(x);\n\tif (r > x)\n\t\tr--;\n\treturn (r + 0);\n}\n\nfunction pow(x, y)\n{\n\treturn (exp(1.0 * y * log(1.0 * x)));\n}\n\n#\n# What the hell...\n#\nfunction shl(x, y)\n{\n\twhile (y > 0) {\n\t\tx *= 2;\n\t\ty--;\n\t}\n\treturn (x);\n}\n\nfunction feedeq_w0(fc, rate)\n{\n\treturn ((2.0 * M_PI * fc) \/ (1.0 * rate));\n}\n\nfunction feedeq_A(gain, A)\n{\n\tif (FEEDEQ_TYPE == FEEDEQ_TYPE_PEQ || FEEDEQ_TYPE == FEEDEQ_TYPE_SHELF)\n\t\tA = pow(10, gain \/ 40.0);\n\telse\n\t\tA = sqrt(pow(10, gain \/ 20.0));\n\n\treturn (A);\n}\n\nfunction feedeq_alpha(w0, A, QS)\n{\n\tif (FEEDEQ_TYPE == FEEDEQ_TYPE_PEQ)\n\t\talpha = sin(w0) \/ (2.0 * QS);\n\telse if (FEEDEQ_TYPE == FEEDEQ_TYPE_SHELF)\n\t\talpha = sin(w0) * 0.5 * sqrt(A + ((1.0 \/ A) *\t\t\\\n\t\t ((1.0 \/ QS) - 1.0)) + 2.0);\n\telse\n\t\talpha = 0.0;\n\n\treturn (alpha);\n}\n\nfunction feedeq_fx_floor(v, r)\n{\n\tif (fabs(v) < fabs(smallest))\n\t\tsmallest = v;\n\tif (fabs(v) > fabs(largest))\n\t\tlargest = v;\n\n\tr = floor((v * FEEDEQ_COEFF_ONE) + 0.5);\n\n\tif (r < INT32_MIN || r > INT32_MAX)\n\t\tprintf(\"\\n#error overflow v=%f, \"\t\t\t\\\n\t\t \"please reduce FEEDEQ_COEFF_SHIFT\\n\", v);\n\n\treturn (r);\n}\n\nfunction feedeq_gen_biquad_coeffs(coeffs, rate, gain,\t\t\t\\\n w0, A, alpha, a0, a1, a2, b0, b1, b2)\n{\n\tw0 = feedeq_w0(FEEDEQ_TREBLE_SFREQ, 1.0 * rate);\n\tA = feedeq_A(1.0 * gain);\n\talpha = feedeq_alpha(w0, A, FEEDEQ_TREBLE_SLOPE);\n\n\tif (FEEDEQ_TYPE == FEEDEQ_TYPE_PEQ) {\n\t\tb0 = 1.0 + (alpha * A);\n\t\tb1 = -2.0 * cos(w0);\n\t\tb2 = 1.0 - (alpha * A);\n\t\ta0 = 1.0 + (alpha \/ A);\n\t\ta1 = -2.0 * cos(w0);\n\t\ta2 = 1.0 - (alpha \/ A);\n\t} else if (FEEDEQ_TYPE == FEEDEQ_TYPE_SHELF) {\n\t\tb0 = A*((A+1.0)+((A-1.0)*cos(w0))+(2.0*sqrt(A)*alpha));\n\t\tb1 = -2.0*A*((A-1.0)+((A+1.0)*cos(w0)) );\n\t\tb2 = A*((A+1.0)+((A-1.0)*cos(w0))-(2.0*sqrt(A)*alpha));\n\t\ta0 = (A+1.0)-((A-1.0)*cos(w0))+(2.0*sqrt(A)*alpha );\n\t\ta1 = 2.0 * ((A-1.0)-((A+1.0)*cos(w0)) );\n\t\ta2 = (A+1.0)-((A-1.0)*cos(w0))-(2.0*sqrt(A)*alpha );\n\t} else\n\t\tb0 = b1 = b2 = a0 = a1 = a2 = 0.0;\n\n\tb0 \/= a0;\n\tb1 \/= a0;\n\tb2 \/= a0;\n\ta1 \/= a0;\n\ta2 \/= a0;\n\n\tcoeffs[\"treble\", gain, 0] = feedeq_fx_floor(a0);\n\tcoeffs[\"treble\", gain, 1] = feedeq_fx_floor(a1);\n\tcoeffs[\"treble\", gain, 2] = feedeq_fx_floor(a2);\n\tcoeffs[\"treble\", gain, 3] = feedeq_fx_floor(b0);\n\tcoeffs[\"treble\", gain, 4] = feedeq_fx_floor(b1);\n\tcoeffs[\"treble\", gain, 5] = feedeq_fx_floor(b2);\n\n\tw0 = feedeq_w0(FEEDEQ_BASS_SFREQ, 1.0 * rate);\n\tA = feedeq_A(1.0 * gain);\n\talpha = feedeq_alpha(w0, A, FEEDEQ_BASS_SLOPE);\n\n\tif (FEEDEQ_TYPE == FEEDEQ_TYPE_PEQ) {\n\t\tb0 = 1.0 + (alpha * A);\n\t\tb1 = -2.0 * cos(w0);\n\t\tb2 = 1.0 - (alpha * A);\n\t\ta0 = 1.0 + (alpha \/ A);\n\t\ta1 = -2.0 * cos(w0);\n\t\ta2 = 1.0 - (alpha \/ A);\n\t} else if (FEEDEQ_TYPE == FEEDEQ_TYPE_SHELF) {\n\t\tb0 = A*((A+1.0)-((A-1.0)*cos(w0))+(2.0*sqrt(A)*alpha));\n\t\tb1 = 2.0*A*((A-1.0)-((A+1.0)*cos(w0)) );\n\t\tb2 = A*((A+1.0)-((A-1.0)*cos(w0))-(2.0*sqrt(A)*alpha));\n\t\ta0 = (A+1.0)+((A-1.0)*cos(w0))+(2.0*sqrt(A)*alpha );\n\t\ta1 = -2.0 * ((A-1.0)+((A+1.0)*cos(w0)) );\n\t\ta2 = (A+1.0)+((A-1.0)*cos(w0))-(2.0*sqrt(A)*alpha );\n\t} else\n\t\tb0 = b1 = b2 = a0 = a1 = a2 = 0.0;\n\n\tb0 \/= a0;\n\tb1 \/= a0;\n\tb2 \/= a0;\n\ta1 \/= a0;\n\ta2 \/= a0;\n\n\tcoeffs[\"bass\", gain, 0] = feedeq_fx_floor(a0);\n\tcoeffs[\"bass\", gain, 1] = feedeq_fx_floor(a1);\n\tcoeffs[\"bass\", gain, 2] = feedeq_fx_floor(a2);\n\tcoeffs[\"bass\", gain, 3] = feedeq_fx_floor(b0);\n\tcoeffs[\"bass\", gain, 4] = feedeq_fx_floor(b1);\n\tcoeffs[\"bass\", gain, 5] = feedeq_fx_floor(b2);\n}\n\nfunction feedeq_gen_freq_coeffs(frq, g, i, v)\n{\n\tcoeffs[0] = 0;\n\n\tfor (g = (FEEDEQ_GAIN_MIN * FEEDEQ_GAIN_DIV);\t\t\t\\\n\t g <= (FEEDEQ_GAIN_MAX * FEEDEQ_GAIN_DIV);\t\t\t\\\n\t g += FEEDEQ_GAIN_STEP) {\n\t\tfeedeq_gen_biquad_coeffs(coeffs, frq,\t\t\t\\\n\t\t g * FEEDEQ_GAIN_RECIPROCAL);\n\t}\n\n\tprintf(\"\\nstatic struct feed_eq_coeff eq_%d[%d] \"\t\t\\\n\t \"= {\\n\", frq, FEEDEQ_LEVELS);\n\tfor (g = (FEEDEQ_GAIN_MIN * FEEDEQ_GAIN_DIV);\t\t\t\\\n\t g <= (FEEDEQ_GAIN_MAX * FEEDEQ_GAIN_DIV);\t\t\t\\\n\t g += FEEDEQ_GAIN_STEP) {\n\t\tprintf(\" {{ \");\n\t\tfor (i = 1; i < 6; i++) {\n\t\t\tv = coeffs[\"treble\", g * FEEDEQ_GAIN_RECIPROCAL, i];\n\t\t\tprintf(\"%s0x%08x%s\",\t\t\t\t\\\n\t\t\t (v < 0) ? \"-\" : \" \", abs(v),\t\t\\\n\t\t\t (i == 5) ? \" \" : \", \");\n\t\t}\n\t\tprintf(\"},\\n { \");\n\t\tfor (i = 1; i < 6; i++) {\n\t\t\tv = coeffs[\"bass\", g * FEEDEQ_GAIN_RECIPROCAL, i];\n\t\t\tprintf(\"%s0x%08x%s\",\t\t\t\t\\\n\t\t\t (v < 0) ? \"-\" : \" \", abs(v),\t\t\\\n\t\t\t (i == 5) ? \" \" : \", \");\n\t\t}\n\t\tprintf(\"}}%s\\n\",\t\t\t\t\t\\\n\t\t (g < (FEEDEQ_GAIN_MAX * FEEDEQ_GAIN_DIV)) ? \",\" : \"\");\n\t}\n\tprintf(\"};\\n\");\n}\n\nfunction feedeq_calc_preamp(norm, gain, shift, mul, bit, attn)\n{\n\tshift = FEEDEQ_PREAMP_SHIFT;\n\n\tif (floor(FEEDEQ_PREAMP_BITDB) == 6 &&\t\t\t\t\\\n\t (1.0 * floor(gain)) == gain && (floor(gain) % 6) == 0) {\n\t\tmul = 1;\n\t\tshift = floor(floor(gain) \/ 6);\n\t} else {\n\t\tbit = 32.0 - ((1.0 * gain) \/ (1.0 * FEEDEQ_PREAMP_BITDB));\n\t\tattn = pow(2.0, bit) \/ pow(2.0, 32.0);\n\t\tmul = floor((attn * FEEDEQ_PREAMP_ONE) + 0.5);\n\t}\n\n\twhile ((mul % 2) == 0 && shift > 0) {\n\t\tmul = floor(mul \/ 2);\n\t\tshift--;\n\t}\n\n\tnorm[\"mul\"] = mul;\n\tnorm[\"shift\"] = shift;\n}\n\nBEGIN {\n\tM_PI = atan2(0.0, -1.0);\n\n\tINT32_MAX = 1 + ((shl(1, 30) - 1) * 2);\n\tINT32_MIN = -1 - INT32_MAX;\n\n\tFEEDEQ_TYPE_PEQ = 0;\n\tFEEDEQ_TYPE_SHELF = 1;\n\n\tFEEDEQ_TYPE = FEEDEQ_TYPE_PEQ;\n\n\tFEEDEQ_COEFF_SHIFT = 24;\n\tFEEDEQ_COEFF_ONE = shl(1, FEEDEQ_COEFF_SHIFT);\n\n\tFEEDEQ_PREAMP_SHIFT = 31;\n\tFEEDEQ_PREAMP_ONE = shl(1, FEEDEQ_PREAMP_SHIFT);\n\tFEEDEQ_PREAMP_BITDB = 6; # 20.0 * (log(2.0) \/ log(10.0));\n\n\tFEEDEQ_GAIN_DIV = 10;\n\ti = 0;\n\tj = 1;\n\twhile (j < FEEDEQ_GAIN_DIV) {\n\t\tj *= 2;\n\t\ti++;\n\t}\n\tFEEDEQ_GAIN_SHIFT = i;\n\tFEEDEQ_GAIN_FMASK = shl(1, FEEDEQ_GAIN_SHIFT) - 1;\n\n\tFEEDEQ_GAIN_RECIPROCAL = 1.0 \/ FEEDEQ_GAIN_DIV;\n\n\tif (ARGC == 2) {\n\t\ti = 1;\n\t\tsplit(ARGV[1], arg, \":\");\n\t\twhile (match(arg[i], \"^[^0-9]*$\")) {\n\t\t\tif (arg[i] == \"PEQ\") {\n\t\t\t\tFEEDEQ_TYPE = FEEDEQ_TYPE_PEQ;\n\t\t\t} else if (arg[i] == \"SHELF\") {\n\t\t\t\tFEEDEQ_TYPE = FEEDEQ_TYPE_SHELF;\n\t\t\t}\n\t\t\ti++;\n\t\t}\n\t\tsplit(arg[i++], subarg, \",\");\n\t\tFEEDEQ_TREBLE_SFREQ = 1.0 * subarg[1];\n\t\tFEEDEQ_TREBLE_SLOPE = 1.0 * subarg[2];\n\t\tsplit(arg[i++], subarg, \",\");\n\t\tFEEDEQ_BASS_SFREQ = 1.0 * subarg[1];\n\t\tFEEDEQ_BASS_SLOPE = 1.0 * subarg[2];\n\t\tsplit(arg[i++], subarg, \",\");\n\t\tFEEDEQ_GAIN_MIN = floor(1.0 * subarg[1]);\n\t\tFEEDEQ_GAIN_MAX = floor(1.0 * subarg[2]);\n\t\tif (length(subarg) > 2) {\n\t\t\tj = floor(1.0 * FEEDEQ_GAIN_DIV * subarg[3]);\n\t\t\tif (j < 2)\n\t\t\t\tj = 1;\n\t\t\telse if (j < 5)\n\t\t\t\tj = 2;\n\t\t\telse if (j < 10)\n\t\t\t\tj = 5;\n\t\t\telse\n\t\t\t\tj = 10;\n\t\t\tif (j > FEEDEQ_GAIN_DIV || (FEEDEQ_GAIN_DIV % j) != 0)\n\t\t\t\tj = FEEDEQ_GAIN_DIV;\n\t\t\tFEEDEQ_GAIN_STEP = j;\n\t\t} else\n\t\t\tFEEDEQ_GAIN_STEP = FEEDEQ_GAIN_DIV;\n\t\tsplit(arg[i], subarg, \",\");\n\t\tfor (i = 1; i <= length(subarg); i++)\n\t\t\tallfreq[i - 1] = floor(1.0 * subarg[i]);\n\t} else {\n\t\tFEEDEQ_TREBLE_SFREQ = 16000.0;\n\t\tFEEDEQ_TREBLE_SLOPE = 0.25;\n\t\tFEEDEQ_BASS_SFREQ = 62.0;\n\t\tFEEDEQ_BASS_SLOPE = 0.25;\n\n\t\tFEEDEQ_GAIN_MIN = -9;\n\t\tFEEDEQ_GAIN_MAX = 9;\n\n\t\tFEEDEQ_GAIN_STEP = FEEDEQ_GAIN_DIV;\n\n\n\t\tallfreq[0] = 44100;\n\t\tallfreq[1] = 48000;\n\t\tallfreq[2] = 88200;\n\t\tallfreq[3] = 96000;\n\t\tallfreq[4] = 176400;\n\t\tallfreq[5] = 192000;\n\t}\n\n\tFEEDEQ_LEVELS = ((FEEDEQ_GAIN_MAX - FEEDEQ_GAIN_MIN) *\t\t\\\n\t floor(FEEDEQ_GAIN_DIV \/ FEEDEQ_GAIN_STEP)) + 1;\n\n\tFEEDEQ_ERR_CLIP = 0;\n\n\tsmallest = 10.000000;\n\tlargest = 0.000010;\n\n\tprintf(\"#ifndef _FEEDER_EQ_GEN_H_\\n\");\n\tprintf(\"#define _FEEDER_EQ_GEN_H_\\n\\n\");\n\tprintf(\"\/*\\n\");\n\tprintf(\" * Generated using feeder_eq_mkfilter.awk, heaven, wind and awesome.\\n\");\n\tprintf(\" *\\n\");\n\tprintf(\" * DO NOT EDIT!\\n\");\n\tprintf(\" *\/\\n\\n\");\n\tprintf(\"\/*\\n\");\n\tprintf(\" * EQ: %s\\n\", (FEEDEQ_TYPE == FEEDEQ_TYPE_SHELF) ?\t\\\n\t \"Shelving\" : \"Peaking EQ\");\n\tprintf(\" *\/\\n\");\n\tprintf(\"#define FEEDER_EQ_PRESETS\\t\\\"\");\n\tprintf(\"%s:%d,%.4f,%d,%.4f:%d,%d,%.1f:\",\t\t\t\\\n\t (FEEDEQ_TYPE == FEEDEQ_TYPE_SHELF) ? \"SHELF\" : \"PEQ\",\t\\\n\t FEEDEQ_TREBLE_SFREQ, FEEDEQ_TREBLE_SLOPE,\t\t\t\\\n\t FEEDEQ_BASS_SFREQ, FEEDEQ_BASS_SLOPE,\t\t\t\\\n\t FEEDEQ_GAIN_MIN, FEEDEQ_GAIN_MAX,\t\t\t\t\\\n\t FEEDEQ_GAIN_STEP * FEEDEQ_GAIN_RECIPROCAL);\n\tfor (i = 0; i < length(allfreq); i++) {\n\t\tif (i != 0)\n\t\t\tprintf(\",\");\n\t\tprintf(\"%d\", allfreq[i]);\n\t}\n\tprintf(\"\\\"\\n\\n\");\n\tprintf(\"struct feed_eq_coeff_tone {\\n\");\n\tprintf(\"\\tint32_t a1, a2;\\n\");\n\tprintf(\"\\tint32_t b0, b1, b2;\\n\");\n\tprintf(\"};\\n\\n\");\n\tprintf(\"struct feed_eq_coeff {\\n\");\n\t#printf(\"\\tstruct {\\n\");\n\t#printf(\"\\t\\tint32_t a1, a2;\\n\");\n\t#printf(\"\\t\\tint32_t b0, b1, b2;\\n\");\n\t#printf(\"\\t} treble, bass;\\n\");\n\tprintf(\"\\tstruct feed_eq_coeff_tone treble;\\n\");\n\tprintf(\"\\tstruct feed_eq_coeff_tone bass;\\n\");\n\t#printf(\"\\tstruct {\\n\");\n\t#printf(\"\\t\\tint32_t a1, a2;\\n\");\n\t#printf(\"\\t\\tint32_t b0, b1, b2;\\n\");\n\t#printf(\"\\t} bass;\\n\");\n\tprintf(\"};\\n\");\n\tfor (i = 0; i < length(allfreq); i++)\n\t\tfeedeq_gen_freq_coeffs(allfreq[i]);\n\tprintf(\"\\n\");\n\tprintf(\"static const struct {\\n\");\n\tprintf(\"\\tuint32_t rate;\\n\");\n\tprintf(\"\\tstruct feed_eq_coeff *coeff;\\n\");\n\tprintf(\"} feed_eq_tab[] = {\\n\");\n\tfor (i = 0; i < length(allfreq); i++) {\n\t\tprintf(\"\\t{ %6d, eq_%-6d },\\n\", allfreq[i], allfreq[i]);\n\t}\n\tprintf(\"};\\n\");\n\n\tprintf(\"\\n#define FEEDEQ_RATE_MIN\\t\\t%d\\n\", allfreq[0]);\n\tprintf(\"#define FEEDEQ_RATE_MAX\\t\\t%d\\n\", allfreq[length(allfreq) - 1]);\n\tprintf(\"\\n#define FEEDEQ_TAB_SIZE\\t\\t\\t\\t\\t\\t\\t\\\\\\n\");\n\tprintf(\"\\t((int32_t)(sizeof(feed_eq_tab) \/ sizeof(feed_eq_tab[0])))\\n\");\n\n\tprintf(\"\\nstatic const struct {\\n\");\n\tprintf(\"\\tint32_t mul, shift;\\n\");\n\tprintf(\"} feed_eq_preamp[] = {\\n\");\n\tfor (i = (FEEDEQ_GAIN_MAX * 2 * FEEDEQ_GAIN_DIV); i >= 0;\t\\\n\t i -= FEEDEQ_GAIN_STEP) {\n\t\tfeedeq_calc_preamp(norm, i * FEEDEQ_GAIN_RECIPROCAL);\n\t\tdbgain = ((FEEDEQ_GAIN_MAX * FEEDEQ_GAIN_DIV) - i) *\t\\\n\t\t FEEDEQ_GAIN_RECIPROCAL;\n\t\tprintf(\"\\t{ 0x%08x, 0x%08x },\\t\/* %+5.1f dB *\/\\n\",\t\\\n\t\t norm[\"mul\"], norm[\"shift\"], dbgain);\n\t}\n\tprintf(\"};\\n\");\n\n\tprintf(\"\\n#define FEEDEQ_GAIN_MIN\\t\\t%d\", FEEDEQ_GAIN_MIN);\n\tprintf(\"\\n#define FEEDEQ_GAIN_MAX\\t\\t%d\\n\", FEEDEQ_GAIN_MAX);\n\n\tprintf(\"\\n#define FEEDEQ_GAIN_SHIFT\\t%d\\n\", FEEDEQ_GAIN_SHIFT);\n\tprintf(\"#define FEEDEQ_GAIN_DIV\\t\\t%d\\n\", FEEDEQ_GAIN_DIV);\n\tprintf(\"#define FEEDEQ_GAIN_FMASK\\t0x%08x\\n\", FEEDEQ_GAIN_FMASK);\n\tprintf(\"#define FEEDEQ_GAIN_STEP\\t%d\\n\", FEEDEQ_GAIN_STEP);\n\n\t#printf(\"\\n#define FEEDEQ_PREAMP_MIN\\t-%d\\n\",\t\t\t\\\n\t# shl(FEEDEQ_GAIN_MAX, FEEDEQ_GAIN_SHIFT));\n\t#printf(\"#define FEEDEQ_PREAMP_MAX\\t%d\\n\",\t\t\t\\\n\t# shl(FEEDEQ_GAIN_MAX, FEEDEQ_GAIN_SHIFT));\n\n\tprintf(\"\\n#define FEEDEQ_COEFF_SHIFT\\t%d\\n\", FEEDEQ_COEFF_SHIFT);\n\n\t#feedeq_calc_preamp(norm, FEEDEQ_GAIN_MAX);\n\n\t#printf(\"#define FEEDEQ_COEFF_NORM(v)\\t(\");\n\t#if (norm[\"mul\"] == 1)\n\t#\tprintf(\"(v) >> %d\", norm[\"shift\"]);\n\t#else\n\t#\tprintf(\"(0x%xLL * (v)) >> %d\", norm[\"mul\"], norm[\"shift\"]);\n\t#printf(\")\\n\");\n\n\t#printf(\"\\n#define FEEDEQ_LEVELS\\t\\t%d\\n\", FEEDEQ_LEVELS);\n\tif (FEEDEQ_ERR_CLIP != 0)\n\t\tprintf(\"\\n#define FEEDEQ_ERR_CLIP\\t\\t%d\\n\", FEEDEQ_ERR_CLIP);\n\tprintf(\"\\n\/*\\n\");\n\tprintf(\" * volume level mapping (0 - 100):\\n\");\n\tprintf(\" *\\n\");\n\n\tfor (i = 0; i <= 100; i++) {\n\t\tind = floor((i * FEEDEQ_LEVELS) \/ 100);\n\t\tif (ind >= FEEDEQ_LEVELS)\n\t\t\tind = FEEDEQ_LEVELS - 1;\n\t\tprintf(\" *\\t%3d -> %3d (%+5.1f dB)\\n\",\t\t\\\n\t\t i, ind, FEEDEQ_GAIN_MIN +\t\t\t\t\\\n\t\t (ind * (FEEDEQ_GAIN_RECIPROCAL * FEEDEQ_GAIN_STEP)));\n\t}\n\n\tprintf(\" *\/\\n\");\n\tprintf(\"\\n\/*\\n * smallest: %.32f\\n * largest: %.32f\\n *\/\\n\",\t\\\n\t smallest, largest);\n\tprintf(\"\\n#endif\\t\/* !_FEEDER_EQ_GEN_H_ *\/\\n\");\n}\n","avg_line_length":28.2991452991,"max_line_length":103,"alphanum_fraction":0.5971760797} {"size":5093,"ext":"awk","lang":"Awk","max_stars_count":null,"content":"BEGIN {\n\t# $1 Book name\n\t# $2 Book abbreviation\n\t# $3 Book number\n\t# $4 Chapter number\n\t# $5 Verse number\n\t# $6 Verse\n\tFS = \"\\t\"\n\n\tMAX_WIDTH = 80\n\tif (ENVIRON[\"WOG_MAX_WIDTH\"] ~ \/^[0-9]+$\/) {\n\t\tif (int(ENVIRON[\"WOG_MAX_WIDTH\"]) < MAX_WIDTH) {\n\t\t\tMAX_WIDTH = int(ENVIRON[\"WOG_MAX_WIDTH\"])\n\t\t}\n\t}\n\n\tif (cmd == \"ref\") {\n\t\tmode = parseref(ref, p)\n\t\tp[\"book\"] = cleanbook(p[\"book\"])\n\t}\n}\n\ncmd == \"list\" {\n\tif (!($2 in seen_books)) {\n\t\tprintf(\"%s (%s)\\n\", $1, $2)\n\t\tseen_books[$2] = 1\n\t}\n}\n\nfunction parseref(ref, arr) {\n\t# 1. \n\t# 2. :?\n\t# 3. :?:\n\t# 3a. :?:[,]...\n\t# 4. :?-\n\t# 5. :?:-\n\t# 6. :?:-:\n\t# 7. \/\n\t# 8. \/search\n\t# 9. :?\/search\n\n\tif (match(ref, \"^[1-9]?[a-zA-Z ]+\")) {\n\t\t# 1, 2, 3, 3a, 4, 5, 6, 8, 9\n\t\tarr[\"book\"] = substr(ref, 1, RLENGTH)\n\t\tref = substr(ref, RLENGTH + 1)\n\t} else if (match(ref, \"^\/\")) {\n\t\t# 7\n\t\tarr[\"search\"] = substr(ref, 2)\n\t\treturn \"search\"\n\t} else {\n\t\treturn \"unknown\"\n\t}\n\n\tif (match(ref, \"^:?[1-9]+[0-9]*\")) {\n\t\t# 2, 3, 3a, 4, 5, 6, 9\n\t\tif (sub(\"^:\", \"\", ref)) {\n\t\t\tarr[\"chapter\"] = int(substr(ref, 1, RLENGTH - 1))\n\t\t\tref = substr(ref, RLENGTH)\n\t\t} else {\n\t\t\tarr[\"chapter\"] = int(substr(ref, 1, RLENGTH))\n\t\t\tref = substr(ref, RLENGTH + 1)\n\t\t}\n\t} else if (match(ref, \"^\/\")) {\n\t\t# 8\n\t\tarr[\"search\"] = substr(ref, 2)\n\t\treturn \"search\"\n\t} else if (ref == \"\") {\n\t\t# 1\n\t\treturn \"exact\"\n\t} else {\n\t\treturn \"unknown\"\n\t}\n\n\tif (match(ref, \"^:[1-9]+[0-9]*\")) {\n\t\t# 3, 3a, 5, 6\n\t\tarr[\"verse\"] = int(substr(ref, 2, RLENGTH - 1))\n\t\tref = substr(ref, RLENGTH + 1)\n\t} else if (match(ref, \"^-[1-9]+[0-9]*$\")) {\n\t\t# 4\n\t\tarr[\"chapter_end\"] = int(substr(ref, 2))\n\t\treturn \"range\"\n\t} else if (match(ref, \"^\/\")) {\n\t\t# 9\n\t\tarr[\"search\"] = substr(ref, 2)\n\t\treturn \"search\"\n\t} else if (ref == \"\") {\n\t\t# 2\n\t\treturn \"exact\"\n\t} else {\n\t\treturn \"unknown\"\n\t}\n\n\tif (match(ref, \"^-[1-9]+[0-9]*$\")) {\n\t\t# 5\n\t\tarr[\"verse_end\"] = int(substr(ref, 2))\n\t\treturn \"range\"\n\t} else if (match(ref, \"-[1-9]+[0-9]*\")) {\n\t\t# 6\n\t\tarr[\"chapter_end\"] = int(substr(ref, 2, RLENGTH - 1))\n\t\tref = substr(ref, RLENGTH + 1)\n\t} else if (ref == \"\") {\n\t\t# 3\n\t\treturn \"exact\"\n\t} else if (match(ref, \"^,[1-9]+[0-9]*\")) {\n\t\t# 3a\n\t\tarr[\"verse\", arr[\"verse\"]] = 1\n\t\tdelete arr[\"verse\"]\n\t\tdo {\n\t\t\tarr[\"verse\", substr(ref, 2, RLENGTH - 1)] = 1\n\t\t\tref = substr(ref, RLENGTH + 1)\n\t\t} while (match(ref, \"^,[1-9]+[0-9]*\"))\n\n\t\tif (ref != \"\") {\n\t\t\treturn \"unknown\"\n\t\t}\n\n\t\treturn \"exact_set\"\n\t} else {\n\t\treturn \"unknown\"\n\t}\n\n\tif (match(ref, \"^:[1-9]+[0-9]*$\")) {\n\t\t# 6\n\t\tarr[\"verse_end\"] = int(substr(ref, 2))\n\t\treturn \"range_ext\"\n\t} else {\n\t\treturn \"unknown\"\n\t}\n}\n\nfunction cleanbook(book) {\n\tbook = tolower(book)\n\tgsub(\" +\", \"\", book)\n\treturn book\n}\n\nfunction bookmatches(book, bookabbr, query) {\n\tbook = cleanbook(book)\n\tif (book == query) {\n\t\treturn book\n\t}\n\n\tbookabbr = cleanbook(bookabbr)\n\tif (bookabbr == query) {\n\t\treturn book\n\t}\n\n\tif (substr(book, 1, length(query)) == query) {\n\t\treturn book\n\t}\n}\n\nfunction printverse(verse, word_count, characters_printed) {\n\tif (ENVIRON[\"WOG_NOLINEWRAP\"] != \"\" && ENVIRON[\"WOG_NOLINEWRAP\"] != \"0\") {\n\t\tprintf(\"%s\\n\", verse)\n\t\treturn\n\t}\n\n\tword_count = split(verse, words, \" \")\n\tfor (i = 1; i <= word_count; i++) {\n\t\tif (characters_printed + length(words[i]) + (characters_printed > 0 ? 1 : 0) > MAX_WIDTH - 8) {\n\t\t\tprintf(\"\\n\\t\")\n\t\t\tcharacters_printed = 0\n\t\t}\n\t\tif (characters_printed > 0) {\n\t\t\tprintf(\" \")\n\t\t\tcharacters_printed++\n\t\t}\n\t\tprintf(\"%s\", words[i])\n\t\tcharacters_printed += length(words[i])\n\t}\n\tprintf(\"\\n\")\n}\n\nfunction processline() {\n\tif (last_book_printed != $2) {\n\t\tprint $1\n\t\tlast_book_printed = $2\n\t}\n\n\tprintf(\"%d:%d\\t\", $4, $5)\n\tprintverse($6)\n\toutputted_records++\n}\n\ncmd == \"ref\" && mode == \"exact\" && bookmatches($1, $2, p[\"book\"]) && (p[\"chapter\"] == \"\" || $4 == p[\"chapter\"]) && (p[\"verse\"] == \"\" || $5 == p[\"verse\"]) {\n\tprocessline()\n}\n\ncmd == \"ref\" && mode == \"exact_set\" && bookmatches($1, $2, p[\"book\"]) && (p[\"chapter\"] == \"\" || $4 == p[\"chapter\"]) && p[\"verse\", $5] {\n\tprocessline()\n}\n\ncmd == \"ref\" && mode == \"range\" && bookmatches($1, $2, p[\"book\"]) && ((p[\"chapter_end\"] == \"\" && $4 == p[\"chapter\"]) || ($4 >= p[\"chapter\"] && $4 <= p[\"chapter_end\"])) && (p[\"verse\"] == \"\" || $5 >= p[\"verse\"]) && (p[\"verse_end\"] == \"\" || $5 <= p[\"verse_end\"]) {\n\tprocessline()\n}\n\ncmd == \"ref\" && mode == \"range_ext\" && bookmatches($1, $2, p[\"book\"]) && (($4 == p[\"chapter\"] && $5 >= p[\"verse\"] && p[\"chapter\"] != p[\"chapter_end\"]) || ($4 > p[\"chapter\"] && $4 < p[\"chapter_end\"]) || ($4 == p[\"chapter_end\"] && $5 <= p[\"verse_end\"] && p[\"chapter\"] != p[\"chapter_end\"]) || (p[\"chapter\"] == p[\"chapter_end\"] && $4 == p[\"chapter\"] && $5 >= p[\"verse\"] && $5 <= p[\"verse_end\"])) {\n\tprocessline()\n}\n\ncmd == \"ref\" && mode == \"search\" && (p[\"book\"] == \"\" || bookmatches($1, $2, p[\"book\"])) && (p[\"chapter\"] == \"\" || $4 == p[\"chapter\"]) && match(tolower($6), tolower(p[\"search\"])) {\n\tprocessline()\n}\n\nEND {\n\tif (cmd == \"ref\" && outputted_records == 0) {\n\t\tprint \"Unknown reference: \" ref\n\t}\n}\n","avg_line_length":24.1374407583,"max_line_length":393,"alphanum_fraction":0.5238562733} {"size":434,"ext":"awk","lang":"Awk","max_stars_count":12.0,"content":"# Redirecting odd records to a file and even ones to another\n# Example: awk -f even_odd.awk files\/lorem.dat\n#\n# The modulo function (%) finds the remainder after division for the current Record Number NR divided by two.\n# As far as we now yet, in awk 1 is True and 0 False. We redirect our output evaluating this fact.\n\nBEGIN{\n EVEN=\"files\/even.dat.tmp\"\n ODD=\"files\/odd.dat.tmp\"\n }\n\nNR%2{print > EVEN\n next\n }\n{print > ODD}","avg_line_length":28.9333333333,"max_line_length":109,"alphanum_fraction":0.7073732719} {"size":1345,"ext":"awk","lang":"Awk","max_stars_count":2.0,"content":"#\n# matching the following output specified as a pattern that verifies\n# that the numerical values conform to a specific pattern, rather than\n# specific values.\n#\n# S0 S1 E O M CCS YGC YGCT FGC FGCT CGC CGCT GCT\n# 0.00 93.76 28.80 1.82 77.74 68.02 1 0.005 0 0.000 0 0.000 0.005\n# 0.00 93.76 73.04 1.82 77.74 68.02 1 0.005 0 0.000 0 0.000 0.005\n# 0.00 93.76 73.04 1.82 77.74 68.02 1 0.005 0 0.000 0 0.000 0.005\n# 0.00 93.76 73.04 1.82 77.74 68.02 1 0.005 0 0.000 0 0.000 0.005\n# 0.00 93.76 75.00 1.82 77.74 68.02 1 0.005 0 0.000 0 0.000 0.005\n\nBEGIN\t{\n\t headerlines=0; datalines=0; totallines=0\n\t}\n\n\/^ S0 S1 E O M CCS YGC YGCT FGC FGCT CGC CGCT GCT $\/\t{\n\t headerlines++;\n\t}\n\n\/^[ ]*[0-9]+\\.[0-9]+[ ]*[0-9]+\\.[0-9]+[ ]*[0-9]+\\.[0-9]+[ ]*[0-9]+\\.[0-9]+[ ]*[0-9]+\\.[0-9]+[ ]*([0-9]+\\.[0-9]+)|-[ ]*[0-9]+[ ]*[0-9]+\\.[0-9]+[ ]*[0-9]+[ ]*[0-9]+\\.[0-9]+[ ]*[0-9]+[ ]*[0-9]+\\.[0-9]+[ ]*[0-9]+\\.[0-9]+$\/\t{\n\t datalines++;\n\t}\n\n\t{ totallines++; print $0 }\n\nEND\t{\n\t if ((headerlines == 1) && (datalines == 5)) {\n\t exit 0\n }\n else {\n\t exit 1\n }\n\t}\n","avg_line_length":38.4285714286,"max_line_length":220,"alphanum_fraction":0.4178438662} {"size":65,"ext":"awk","lang":"Awk","max_stars_count":1.0,"content":"#!\/usr\/bin\/awk -f\n{print\"The length of this line is \"length($0)}\n","avg_line_length":21.6666666667,"max_line_length":46,"alphanum_fraction":0.6615384615} {"size":996,"ext":"awk","lang":"Awk","max_stars_count":null,"content":"BEGIN {\n FS = \"\"\n}\n\n{\n # Spectrum\n spectrum = sprintf(\"%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s\", $128, $129,\n $130, $131, $132, $133, $134, $135, $136, $137, $138, $139, $140,\n $141, $142, $143, $144, $145, $146, $147)\n gsub(\/^ +\/, \"\", spectrum)\n gsub(\/ +$\/, \"\", spectrum)\n if (spectrum == \"\")\n printf \"null\" \n else\n printf \"\\\"%s\\\"\", spectrum\n\n # SpectrumCode - depends on Spectrum\n spectrumcode = $148\n if (spectrum == \"\")\n printf \",null\" \n else\n printf \",\\'%s\\'\", spectrumcode\n\n printf \"\\n\"\n\n hr = sprintf(\"%s%s%s%s\", $1, $2, $3, $4)\n gsub(\/ \/, \"\", hr)\n\n if ((spectrum == \"\") && (spectrumcode != \" \"))\n printf \"WARN, spectrumcode (%s) found when no spectrum for hr %s\\n\",\n spectrumcode, hr\n\n if (spectrum != \"\") {\n if ((spectrumcode != \"e\") && (spectrumcode != \"v\") && (spectrumcode != \"t\") && (spectrumcode != \" \"))\n printf \"WARN, bad spectrumcode (%s) found\\n\", spectrumcode\n }\n}\n","avg_line_length":26.2105263158,"max_line_length":107,"alphanum_fraction":0.483935743} {"size":8767,"ext":"awk","lang":"Awk","max_stars_count":null,"content":"#\n# Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# http:\/\/www.apache.org\/licenses\/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\nfunction print_hdrs()\n{\n print \"\\\n\/*\\n\\\n * Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved.\\n\\\n *\\n\\\n * NVIDIA CORPORATION and its licensors retain all intellectual property\\n\\\n * and proprietary rights in and to this software, related documentation\\n\\\n * and any modifications thereto. Any use, reproduction, disclosure or\\n\\\n * distribution of this software and related documentation without an express\\n\\\n * license agreement from NVIDIA CORPORATION is strictly prohibited.\\n\\\n *\\n\\\n *\/\\n\\\n\\n\\n\\\n\/*\\n\\\n *\\n\\\n * WARNING - this file is automatically generated. DO NOT EDIT.\\n\\\n *\\n\\\n *\/\\n\\\n\\n\\\n#include \\\"mth_intrinsics.h\\\"\\n\\\n#include \\\"mth_tbldefs.h\\\"\\n\\\n#include \\n\\\n\\n\\\n\"\n}\n\nfunction init_target()\n{\n if (MAX_VREG_SIZE == 128) {\n VLS = 4\n VLD = 2\n VL_XYZ = \"x\"\n } else if (MAX_VREG_SIZE == 256) {\n VLS = 8\n VLD = 4\n VL_XYZ = \"y\"\n } else {\n VLS = 16\n VLD = 8\n VL_XYZ = \"z\"\n }\n\n frps[\"f\"]= \"\"\n frps[\"r\"]= \"\"\n frps[\"p\"]= \"\"\n sds[\"s\"]= \"\"\n sds[\"d\"]= \"\"\n sds[\"c\"]= \"\"\n sds[\"z\"]= \"\"\n iks[\"i\"]= \"\"\n iks[\"k\"]= \"\"\n\n # Vector types\n vts[\"s\"] = \"vrs\" VLS \"_t\"\n vts[\"d\"] = \"vrd\" VLD \"_t\"\n vts[\"c\"] = \"vcs\" VLS\/2 \"_t\"\n vts[\"z\"] = \"vcd\" VLD\/2 \"_t\" # 128 -> _1v\n vts[\"i\"] = \"vis\" VLS \"_t\"\n vts[\"iby2\"] = \"vis\" VLS\/2 \"_t\"\n vts[\"k\"] = \"vid\" VLD \"_t\"\n\n # Scalar types\n sts[\"s\"] = \"float\"\n sts[\"d\"] = \"double\"\n sts[\"c\"] = \"float _Complex\"\n sts[\"z\"] = \"double _Complex\"\n sts[\"i\"] = \"int32_t\"\n sts[\"k\"] = \"long long\"\n\n vls[\"s\"] = VLS\n vls[\"d\"] = VLD\n vls[\"c\"] = VLS\/2\n vls[\"z\"] = VLD\/2\n vls[\"i\"] = VLS\n vls[\"k\"] = VLD\n\n vs[\"s\"] = \"vr4\"\n vs[\"d\"] = \"vr8\"\n vs[\"c\"] = \"vc4\"\n vs[\"z\"] = \"vc8\"\n vs[\"i\"] = \"vi4\"\n vs[\"k\"] = \"vi8\"\n vs[\"i1\"] = \"si4\"\n vs[\"k1\"] = \"si8\"\n\n one_arg = 0\n two_args = 1\n is_power = TARGET == \"POWER\"\n is_x8664 = TARGET == \"X8664\"\n is_arm64 = TARGET == \"ARM64\"\n is_generic = TARGET == \"GENERIC\"\n\n}\n\nfunction func_rr_def(name, frp, sd, yarg)\n{\n print \"\\n\" vts[sd]\n print \"__g\" sd \"_\" name \"_\" (MAX_VREG_SIZE == 128 && sd == \"z\" ? \"1v\" : vls[sd] \"\") \\\n \"_\" frp \"(\" vts[sd] \" x\" (yarg != 0 ? \", \" vts[sd] \" y\" : \"\") \")\"\n print \"{\"\n print \" \" sts[sd] \" (*fptr)(\" sts[sd] (yarg != 0 ? \", \" sts[sd] : \"\") \");\"\n print \" fptr = (\" sts[sd] \"(*)(\" sts[sd] (yarg != 0 ? \", \" sts[sd] : \"\") \\\n \"))MTH_DISPATCH_TBL[func_\" name \"][sv_\" sd \"s][frp_\" frp \"];\"\n\n print \" return __ZGV\" VL_XYZ \"N\" vls[sd] \"v\" (yarg != 0 ? \"v\" : \"\")\\\n \"__mth_i_\" vs[sd] (yarg != 0 ? vs[sd] : \"\") \"( x\"\\\n\t(yarg != 0 ? \", y\": \"\") \", fptr);\"\n print \"}\"\n}\n\n\nfunction old_do_all_rr(name, yarg)\n{\n for (frp in frps) {\n for (sd in sds) {\n func_rr_def(name, frp, sd, yarg)\n }\n }\n}\n\nfunction do_all_rr()\n{\n for (frp in frps) {\n for (sd in sds) {\n func_rr_def(\"acos\", frp, sd, one_arg)\n func_rr_def(\"asin\", frp, sd, one_arg)\n func_rr_def(\"atan\", frp, sd, one_arg)\n func_rr_def(\"atan2\", frp, sd, two_args)\n func_rr_def(\"cos\", frp, sd, one_arg)\n func_rr_def(\"sin\", frp, sd, one_arg)\n func_rr_def(\"tan\", frp, sd, one_arg)\n#incorrect func_rr_def(\"sincos\", frp, sd, one_arg)\n func_rr_def(\"cosh\", frp, sd, one_arg)\n func_rr_def(\"sinh\", frp, sd, one_arg)\n func_rr_def(\"tanh\", frp, sd, one_arg)\n func_rr_def(\"exp\", frp, sd, one_arg)\n func_rr_def(\"log\", frp, sd, one_arg)\n func_rr_def(\"log10\", frp, sd, one_arg)\n func_rr_def(\"pow\", frp, sd, two_args)\n func_rr_def(\"div\", frp, sd, two_args)\n func_rr_def(\"sqrt\", frp, sd, one_arg)\n func_rr_def(\"mod\", frp, sd, two_args)\n func_rr_def(\"aint\", frp, sd, one_arg)\n func_rr_def(\"ceil\", frp, sd, one_arg)\n func_rr_def(\"floor\", frp, sd, one_arg)\n }\n }\n}\n\nfunction func_pow_decl_scalar(name, frp, sd, ik)\n{\n print \"\\n\" vts[sd]\n #\n # Another inconsistency. For all but double precision complex, the\n # entry point is: __g_pow1_\n # But for double precision complex we have\n # entry point is: __gz_pow_1v\n # That is there is no \"1\" after and is hardcoded to \"1v\"\n #\n print \"__g\" sd \"_\" name ik (sd == \"z\" ? \"\" : \"1\") \"_\" \\\n (MAX_VREG_SIZE == 128 && sd == \"z\" ? \"1v\" : vls[sd] \"\") \\\n \"_\" frp \"(\" vts[sd] \" x, \" sts[ik] \" iy)\"\n print \"{\"\n print \" \" sts[sd] \" (*fptr)(\" sts[sd] \", \" sts[ik] \");\"\n print \" fptr = (\" sts[sd] \"(*)(\" sts[sd] \", \" sts[ik]\\\n \"))MTH_DISPATCH_TBL[func_\" name ik \"1][sv_\" sd \"s][frp_\" frp \"];\"\n\n print \" return __ZGV\" VL_XYZ \"N\" vls[sd] \"v\"\\\n \"__mth_i_\" vs[sd] vs[ik\"1\"] \"(x, iy, fptr);\"\n\t\n print \"}\"\n}\n\n#vcd1_t\n#__gz_powi_1v(vcd1_t x, int iy)\n#{\n# return(__ZGVxN1v__mth_i_vc8si4(x, iy, __mth_i_cdpowi_c99));\n#}\n#\n#vcd1_t\n#__gz_powk_1v(vcd1_t x, long long iy)\n#{\n# return(__ZGVxN1v__mth_i_vc8si8(x, iy, __mth_i_cdpowk_c99));\n#}\n\n\nfunction func_pow_decl_vect(name, frp, sd, ik)\n{\n print \"\\n\" vts[sd]\n print \"__g\" sd \"_\" name ik \"_\" vls[sd] \\\n \"_\" frp \"(\" vts[sd] \" x, \" \\\n ((sd == \"d\" && ik == \"i\") ? (VLS == 4 ? vts[ik] : vts[\"iby2\"]) : vts[ik])\\\n \" iy)\"\n print \"{\"\n print \" \" sts[sd] \" (*fptr)(\" sts[sd] \", \" sts[ik] \");\"\n print \" fptr = (\" sts[sd] \"(*)(\" sts[sd] \", \" sts[ik]\\\n \"))MTH_DISPATCH_TBL[func_\" name ik \"][sv_\" sd \"s][frp_\" frp \"];\"\n\n print \" return __ZGV\" VL_XYZ \"N\" vls[sd] \"vv\"\\\n \"__mth_i_\" vs[sd] vs[ik] \"(x, iy, fptr);\"\n print \"}\"\n}\n\nfunction func_pow_decl_vect_sk(name, frp)\n{\n print \"\\n\" vts[\"s\"]\n print \"__gs_\" name ik \"_\" vls[\"s\"] \\\n \"_\" frp \"(\" vts[\"s\"] \" x, \" vts[\"k\"] \" iyu, \" vts[\"k\"] \" iyl)\"\n print \"{\"\n print \" \" sts[\"s\"] \" (*fptr)(\" sts[\"s\"] \", \" sts[\"k\"] \");\"\n print \" fptr = (\" sts[\"s\"] \"(*)(\" sts[\"s\"] \", \" sts[\"k\"]\\\n \"))MTH_DISPATCH_TBL[func_\" name \"k][sv_ss][frp_\" frp \"];\"\n print \" return __ZGV\" VL_XYZ \"N\" vls[\"s\"] \"vv\"\\\n \"__mth_i_\" vs[sd] \"vi8(x, iyu, iyl, fptr);\"\n print \"}\"\n}\n\nfunction func_pow_def(name, frp, sd, is_scalar, ik)\n{\n if (is_scalar) {\n func_pow_decl_scalar(name, frp, sd, ik)\n } else {\n # Four variants of R(:)**I(:)\n # 1) sd == \"d\" && ik == \"k\" - trivial both args same size(VLD)\n # 2) sd == \"s\" && ik == \"i\" - trivial both args same size(VLS)\n # 3) sd == \"d\" && ik == \"i\" - x is VLD, iy is effectively VLS\/2\n # 4) sd == \"s\" && ik == \"k\" - x is VLS, iy is effectively VLS*2\n\n # Trivial first\n # Because POWER does not have a type for VLS\/2 we have to use VLS for ik.\n # Cases 1..3 can be handled by func_pow_decl_vect().\n #\n if (sd == \"s\" && ik == \"k\") {\n func_pow_decl_vect_sk(name, frp)\n } else {\n func_pow_decl_vect(name, frp, sd, ik)\n }\n }\n}\n\nfunction do_all_pow_r2i()\n{\n for (frp in frps) {\n for (sd in sds) {\n if ((sd == \"c\") || (sd == \"z\" && VLS != 4)) { continue; }\n for (ik in iks) {\n func_pow_def(\"pow\", frp, sd, 1, ik)\n if (sd == \"z\") { continue; } # No vector version\n func_pow_def(\"pow\", frp, sd, 0, ik)\n }\n }\n }\n}\n\nBEGIN {\n # Some quick runtime tests.\n if (TARGET == \"POWER\") {\n if (MAX_VREG_SIZE != 128) {\n print \"TARGET == POWER, MAX_VREG_SIZE must be 128\"\n exit(1)\n }\n } else if (TARGET == \"ARM64\") {\n if (MAX_VREG_SIZE != 128) {\n print \"TARGET == ARM64, MAX_VREG_SIZE must be 128\"\n exit(1)\n }\n } else if (MAX_VREG_SIZE != 128 && MAX_VREG_SIZE != 256 && MAX_VREG_SIZE != 512) {\n print \"TARGET == X8664, MAX_VREG_SIZE must be either 128, 256, or 512\"\n exit(1)\n }\n\n# Initialize some associative arrays and constants\n init_target()\n\n print_hdrs()\n\n\nif (0) {\n old_do_all_rr(\"acos\", one_arg)\n old_do_all_rr(\"asin\", one_arg)\n old_do_all_rr(\"atan\", one_arg)\n old_do_all_rr(\"atan2\", two_args)\n old_do_all_rr(\"cos\", one_arg)\n old_do_all_rr(\"sin\", one_arg)\n old_do_all_rr(\"tan\", one_arg)\n old_do_all_rr(\"sincos\", one_arg)\n old_do_all_rr(\"cosh\", one_arg)\n old_do_all_rr(\"sinh\", one_arg)\n old_do_all_rr(\"tanh\", one_arg)\n old_do_all_rr(\"exp\", one_arg)\n old_do_all_rr(\"log\", one_arg)\n old_do_all_rr(\"log10\", one_arg)\n old_do_all_rr(\"pow\", two_args)\n old_do_all_rr(\"div\", two_args)\n old_do_all_rr(\"sqrt\", one_arg)\n old_do_all_rr(\"mod\", two_args)\n\n}\n# if (MAX_VREG_SIZE == 128) {\n do_all_rr()\n do_all_pow_r2i()\n# }\n}\n","avg_line_length":27.3115264798,"max_line_length":87,"alphanum_fraction":0.5654157637} {"size":3124,"ext":"awk","lang":"Awk","max_stars_count":null,"content":"# eucjp-ms.awk -- Generate a translation table for eucJP-ms.\n# Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011\n# National Institute of Advanced Industrial Science and Technology (AIST)\n# Registration Number H13PRO009\n\n# This file is part of GNU Emacs.\n\n# GNU Emacs is free software: you can redistribute it and\/or modify\n# it under the terms of the GNU General Public License as published by\n# the Free Software Foundation, either version 3 of the License, or\n# (at your option) any later version.\n\n# GNU Emacs is distributed in the hope that it will be useful,\n# but WITHOUT ANY WARRANTY; without even the implied warranty of\n# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n# GNU General Public License for more details.\n\n# You should have received a copy of the GNU General Public License\n# along with GNU Emacs. If not, see .\n\n# Commentary:\n\n# eucJP-ms is one of eucJP-open encoding defined at this page:\n# http:\/\/home.m05.itscom.net\/numa\/cde\/ucs-conv\/appendix.html\n# This program reads the mapping file EUC-JP-MS (of glibc) and\n# generates the Elisp file eucjp-ms.el that defines two translation\n# tables `eucjp-ms-decode' and `eucjp-ms-encode'.\n\nBEGIN {\n FS = \"[ \\t][ \\t]*\"\n\n # STATE: 0\/ignore, 1\/JISX0208, 2\/JISX0208 target range\n # 3\/JISX0212 4\/JISX0212 target range\n state = 0;\n\n JISX0208_FROM1 = \"\/xad\/xa1\";\n JISX0208_TO1 = \"\/xad\/xfc\";\n JISX0208_FROM2 = \"\/xf5\/xa1\";\n JISX0212_FROM = \"\/x8f\/xf3\/xf3\";\n\n print \";;; eucjp-ms.el -- translation table for eucJP-ms. -*- no-byte-compile: t -*-\";\n print \";;; Automatically generated from \/usr\/share\/i18n\/charmaps\/EUC-JP-MS.gz\";\n print \"(let ((map\";\n print \" '(;JISEXT<->UNICODE\";\n}\n\nfunction write_entry (unicode) {\n if (state == 1) {\n\tif ($2 == JISX0208_FROM1 || $2 == JISX0208_FROM2)\n\t state = 2;\n } else if (state == 3) {\n\tif ($2 == JISX0212_FROM)\n\t state = 4;\n }\n if (state == 2) {\n\tjis = $2\n\tgsub(\"\/x\", \"\", jis);\n\tprintf \"\\n\t (#x%s . #x%s)\", jis, unicode;\n\tif ($2 == JISX0208_TO1)\n\t state = 1;\n } else if (state == 4) {\n\tjis = substr($2, 5, 8);\n\tgsub(\"\/x\", \"\", jis);\n\tprintf \"\\n\t (#x%s #x%s)\", jis, unicode;\n }\n}\n\n\n\/^% JIS X 0208\/ {\n state = 1;\n next;\n}\n\n\/^% JIS X 0212\/ {\n state = 3;\n next;\n}\n\n\/^END CHARMAP\/ {\n state = 0;\n next;\n}\n\n\/^\/ {\n if (state > 0)\n\twrite_entry(substr($1, 3, 4));\n}\n\n\/^%IRREVERSIBLE%\/ {\n if (state > 0)\n\twrite_entry(substr($1, 17, 4));\n}\n\nEND {\n print \")))\";\n print \" (mapc #'(lambda (x)\";\n print \"\t (let ((code (logand (car x) #x7F7F)))\";\n print \"\t (if (integerp (cdr x))\";\n print \"\t\t (setcar x (decode-char 'japanese-jisx0208 code))\";\n print \"\t\t(setcar x (decode-char 'japanese-jisx0212 code))\";\n print \"\t\t(setcdr x (cadr x)))))\";\n print \"\tmap)\";\n print \" (define-translation-table 'eucjp-ms-decode map)\";\n print \" (mapc #'(lambda (x)\";\n print \"\t (let ((tmp (car x)))\";\n print \"\t (setcar x (cdr x)) (setcdr x tmp)))\";\n print \"\tmap)\";\n print \" (define-translation-table 'eucjp-ms-encode map))\";\n}\n\n","avg_line_length":28.1441441441,"max_line_length":88,"alphanum_fraction":0.6193982074} {"size":4481,"ext":"awk","lang":"Awk","max_stars_count":3.0,"content":"# Copyright (C) 2003,2004 Free Software Foundation, Inc.\n# Contributed by Kelley Cook, June 2004.\n# Original code from Neil Booth, May 2003.\n#\n# This program is free software; you can redistribute it and\/or modify it\n# under the terms of the GNU General Public License as published by the\n# Free Software Foundation; either version 2, or (at your option) any\n# later version.\n# \n# This program is distributed in the hope that it will be useful,\n# but WITHOUT ANY WARRANTY; without even the implied warranty of\n# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n# GNU General Public License for more details.\n# \n# You should have received a copy of the GNU General Public License\n# along with this program; if not, write to the Free Software\n# Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.\n\n# This Awk script reads in the option records generated from \n# opt-gather.awk, combines the flags of duplicat options and generates a\n# C file.\n#\n# This program uses functions from opt-functions.awk\n#\n# Usage: awk -f opt-functions.awk -f optc-gen.awk \\\n# [-v header_name=header.h] < inputfile > options.c\n\nBEGIN {\n\tn_opts = 0\n\tn_langs = 0\n quote = \"\\042\"\n\tcomma = \",\"\n\tFS=SUBSEP\n\t# Default the name of header created from opth-gen.awk to options.h\n\tif (header_name == \"\") header_name=\"options.h\"\n}\n\n# Collect the text and flags of each option into an array\n\t{\n\t\tif ($1 == \"Language\") {\n\t\t\tlangs[n_langs] = $2\n\t\t\tn_langs++;\n\t\t}\n\t\telse {\n\t\t\tname = opt_args(\"Mask\", $1)\n\t\t\tif (name == \"\") {\n\t\t\t\topts[n_opts] = $1\n\t\t\t\tflags[n_opts] = $2\n\t\t\t\thelp[n_opts] = $3\n\t\t\t\tn_opts++;\n\t\t\t}\n\t\t}\n\t}\n\n# Dump that array of options into a C file.\nEND {\nprint \"\/* This file is auto-generated by opts.sh. *\/\"\nprint \"\"\nn_headers = split(header_name, headers, \" \")\nfor (i = 1; i <= n_headers; i++)\n\tprint \"#include \" quote headers[i] quote\nprint \"#include \" quote \"opts.h\" quote\nprint \"#include \" quote \"intl.h\" quote\nprint \"\"\n\nfor (i = 0; i < n_opts; i++) {\n\tname = var_name(flags[i]);\n\tif (name == \"\")\n\t\tcontinue;\n\n\tif (flag_set_p(\"VarExists\", flags[i]))\n\t\tcontinue;\n\n\tinit = opt_args(\"Init\", flags[i])\n\tif (init != \"\")\n\t\tinit = \" = \" init;\n\telse if (name in var_seen)\n\t\tcontinue;\n\n\tprint \"\/* Set by -\" opts[i] \".\"\n\tprint \" \" help[i] \" *\/\"\n\tprint var_type(flags[i]) name init \";\"\n\tprint \"\"\n\n\tvar_seen[name] = 1;\n}\n\nprint \"\"\nprint \"\/* Local state variables. *\/\"\nfor (i = 0; i < n_opts; i++) {\n\tname = static_var(opts[i], flags[i]);\n\tif (name != \"\")\n\t\tprint \"static \" var_type(flags[i]) name \";\"\n}\nprint \"\"\n\nprint \"const char * const lang_names[] =\\n{\"\nfor (i = 0; i < n_langs; i++) {\n\tmacros[i] = \"CL_\" langs[i]\n\tgsub( \"[^A-Za-z0-9_]\", \"X\", macros[i] )\n\ts = substr(\" \", length (macros[i]))\n\tprint \" \" quote langs[i] quote \",\"\n }\n\nprint \" 0\\n};\\n\"\nprint \"const unsigned int cl_options_count = N_OPTS;\\n\"\n\nprint \"const struct cl_option cl_options[] =\\n{\"\n\nfor (i = 0; i < n_opts; i++)\n\tback_chain[i] = \"N_OPTS\";\n\nfor (i = 0; i < n_opts; i++) {\n\t# Combine the flags of identical switches. Switches\n\t# appear many times if they are handled by many front\n\t# ends, for example.\n\twhile( i + 1 != n_opts && opts[i] == opts[i + 1] ) {\n\t\tflags[i + 1] = flags[i] \" \" flags[i + 1];\n\t\ti++;\n\t}\n\n\tlen = length (opts[i]);\n\tenum = \"OPT_\" opts[i]\n\tif (opts[i] == \"finline-limit=\")\n\t\tenum = enum \"eq\"\n\tgsub (\"[^A-Za-z0-9]\", \"_\", enum)\n\n\t# If this switch takes joined arguments, back-chain all\n\t# subsequent switches to it for which it is a prefix. If\n\t# a later switch S is a longer prefix of a switch T, T\n\t# will be back-chained to S in a later iteration of this\n\t# for() loop, which is what we want.\n\tif (flag_set_p(\"Joined.*\", flags[i])) {\n\t\tfor (j = i + 1; j < n_opts; j++) {\n\t\t\tif (substr (opts[j], 1, len) != opts[i])\n\t\t\t\tbreak;\n\t\t\tback_chain[j] = enum;\n\t\t}\n\t}\n\n\ts = substr(\" \", length (opts[i]))\n\tif (i + 1 == n_opts)\n\t\tcomma = \"\"\n\n\tif (help[i] == \"\")\n\t\thlp = \"0\"\n\telse\n\t\thlp = quote help[i] quote;\n\n\tprintf(\" { %c-%s%c,\\n %s,\\n %s, %u,\\n\",\n\t quote, opts[i], quote, hlp, back_chain[i], len)\n\tcondition = opt_args(\"Condition\", flags[i])\n\tcl_flags = switch_flags(flags[i])\n\tif (condition != \"\")\n\t\tprintf(\"#if %s\\n\" \\\n\t\t \" %s,\\n\" \\\n\t\t \"#else\\n\" \\\n\t\t \" CL_DISABLED,\\n\" \\\n\t\t \"#endif\\n\",\n\t\t condition, cl_flags, cl_flags)\n\telse\n\t\tprintf(\" %s,\\n\", cl_flags)\n\tprintf(\" %s, %s }%s\\n\", var_ref(opts[i], flags[i]),\n\t var_set(flags[i]), comma)\n}\n\nprint \"};\"\n}\n","avg_line_length":26.5147928994,"max_line_length":74,"alphanum_fraction":0.6056683776} {"size":1788,"ext":"awk","lang":"Awk","max_stars_count":null,"content":"#! \/usr\/bin\/gawk\r\n# 10_EditHTML_Deux_SubSystem_10.awk\r\n# gawk.exe -f AWKScripts\/01_UPDATE\/03_SubSystem\/10_EditHTML_Deux_SubSystem_10.awk\r\n\r\n# ------------------------------------------------------------------------------------------------------------------------\r\n\r\n# Copyright 2019 The LOTLTHNBR Project Authors, GinSanaduki.\r\n# All rights reserved.\r\n# Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.\r\n# TB3DS Scripts provides a function to obtain a list of teachers became a disciplinary dismissal disposal\r\n# and to inquire by license number.\r\n# This Scripts needs GAWK(the GNU implementation of the AWK programming language) version 4.0 or later \r\n# and BusyBox developed by Erik Andersen, Rob Landley, Denys Vlasenko and others.\r\n# GAWK 5.0.1 Download ezwinports from SourceForge.net\r\n# https:\/\/sourceforge.net\/projects\/ezwinports\/files\/gawk-5.0.1-w32-bin.zip\/download\r\n# BusyBox Official\r\n# https:\/\/www.busybox.net\/\r\n# BusyBox -w32\r\n# http:\/\/frippery.org\/busybox\/\r\n# Download\r\n# http:\/\/frippery.org\/files\/busybox\/busybox.exe\r\n# BusyBox Wildcard expansion\r\n# https:\/\/frippery.org\/busybox\/globbing.html\r\n# Download\r\n# https:\/\/frippery.org\/files\/busybox\/busybox_glob.exe\r\n\r\n# ------------------------------------------------------------------------------------------------------------------------\r\n\r\nBEGIN{\r\n\tFS = \"\\t\";\r\n}\r\n\r\n{\r\n\tsplit($2,Arrays,\"\u3001\");\r\n\tlen = length(Arrays);\r\n\tif(len < 2){\r\n\t\tprint $1\"\\t\"$2\"\\t\"$3\"\\t\"$4\"\\t\"$4;\r\n\t\tdelete Arrays;\r\n\t\tnext;\r\n\t}\r\n\tfor(i in Arrays){\r\n\t\tmat = match(Arrays[i],\/\u6559\u80b2\u8077\u54e1\u514d\u8a31\u72b6\/);\r\n\t\tif(mat > 0){\r\n\t\t\tif(i == len){\r\n\t\t\t\tprint $1\"\\t\"$2\"\\t\"$3\"\\t\"$4\"\\t\"$4;\r\n\t\t\t\tdelete Arrays;\r\n\t\t\t\tnext;\r\n\t\t\t} else {\r\n\t\t\t\tprint $1\"\\t\"$2\"\\t\"$3\"\\t\"$4\"\\t\"Arrays[i + 1];\r\n\t\t\t\tdelete Arrays;\r\n\t\t\t\tnext;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}\r\n\r\n","avg_line_length":31.3684210526,"max_line_length":123,"alphanum_fraction":0.5799776286} {"size":5613,"ext":"awk","lang":"Awk","max_stars_count":null,"content":"#!\/usr\/bin\/awk -f\n#****h* utils\/gen_summary_csv\n# NAME\n# gen_summary_csv\n# DESCRIPTION\n# Script to summarize the results of each experiment\n# AUTHOR\n# Masaki Waga\n# HISTORY\n# - 2021\/06\/17: initial version\n# COPYRIGHT\n# Copyright (c) 2021 Masaki Waga\n# Released under the MIT license\n# https:\/\/opensource.org\/licenses\/mit-license.php\n#\n# USAGE\n# .\/gen_summary_csv [file1 file2 ...]\n#\n#******\n\nBEGIN {\n # Initialize the variables\n num_falsifications = 0\n min_total_simulation = 9999999\n min_total_time = 99999999\n min_eq_simulation = 9999999\n min_simulation_time = 9999999\n\n # Configuration on the structure\n FS = \",\"\n OFS = \",\"\n # Constants\n MAX_TOTAL_SIMULATION = 300\n # Print the header\n print \"\\\"system\\\",\\\"property\\\",\\\"mean total simulations\\\",\\\"sdev total simulations\\\",\\\"min total simulations\\\",\\\"max total simulations\\\",\\\"mean total time\\\",\\\"sdev total time\\\",\\\"min total time\\\",\\\"max total time\\\",\\\"mean simulations for equivalence testing\\\",\\\"sdev simulations for equivalence testing\\\",\\\"min simulations for equivalence testing\\\",\\\"max simulations for equivalence testing\\\",\\\"mean simulation time\\\",\\\"sdev simulation time\\\",\\\"min simulation time\\\",\\\"max simulation time\\\",\\\"num falsified\\\"\"\n}\n\n# remove the header\nFNR == 1 {\n next\n}\n\n# Validate the system and property\nNR == 2 {\n system_name = $1\n property = $2\n gsub(\"\\\"\", \"\", system_name)\n gsub(\"\\\"\", \"\", property)\n}\n\n{\n current_system_name = $1\n current_property = $2\n gsub(\"\\\"\", \"\", current_system_name)\n gsub(\"\\\"\", \"\", current_property)\n}\n\nsystem_name != current_system_name || property != current_property {\n print \"Error: inconsistent system or property!\" > \"\/dev\/stderr\"\n printf \"Expected %s %s\\n\", system_name, property > \"\/dev\/stderr\"\n exit 1\n}\n\n## Node on the input format: \"$system\" \"$property\" \"$total_simulations\" \"$total_time\" \"$eq_simulations\" \"$simulation_time\" \"$falsified\" \"$input\"\n# cast relevant fields to int\n{\n total_simulation = $3\n total_time = $4\n eq_simulation = $5\n simulation_time = $6\n \n # remove quotation\n gsub(\"\\\"\", \"\", total_simulation)\n gsub(\"\\\"\", \"\", total_time)\n gsub(\"\\\"\", \"\", eq_simulation)\n gsub(\"\\\"\", \"\", simulation_time)\n\n # cast to number\n total_simulation *= 1.0\n total_time *= 1.0\n eq_simulation *= 1.0\n simulation_time *= 1.0\n}\n\n# Ignore the experiments with too many simulations (and failed experiments)\ntotal_simulation > MAX_TOTAL_SIMULATION || total_simulation == 0 {\n next\n}\n\n## Update the variables\n# update the minimum values\ntotal_simulation < min_total_simulation {\n min_total_simulation = total_simulation\n}\ntotal_time < min_total_time {\n min_total_time = total_time\n}\neq_simulation < min_eq_simulation {\n min_eq_simulation = eq_simulation\n}\nsimulation_time < min_simulation_time {\n min_simulation_time = simulation_time\n}\n# update the maximum values\ntotal_simulation > max_total_simulation {\n max_total_simulation = total_simulation\n}\ntotal_time > max_total_time {\n max_total_time = total_time\n}\neq_simulation > max_eq_simulation {\n max_eq_simulation = eq_simulation\n}\nsimulation_time > max_simulation_time {\n max_simulation_time = simulation_time\n}\n# accumulate the values\n{\n num_falsified += 1\n # Sum\n sum_total_simulation += total_simulation\n sum_total_time += total_time\n sum_eq_simulation += eq_simulation\n sum_simulation_time += simulation_time\n # Square sum\n sq_sum_total_simulation += total_simulation * total_simulation\n sq_sum_total_time += total_time * total_time\n sq_sum_eq_simulation += eq_simulation * eq_simulation\n sq_sum_simulation_time += simulation_time * simulation_time\n}\n\nEND {\n if (num_falsified > 0) {\n # Compute mean\n mean_total_simulation = sum_total_simulation \/ num_falsified\n mean_total_time = sum_total_time \/ num_falsified\n mean_eq_simulation = sum_eq_simulation \/ num_falsified\n mean_simulation_time = sum_simulation_time \/ num_falsified\n\n # Compute sdev\n sdev_total_simulation = sqrt((sq_sum_total_simulation \/ num_falsified) - (mean_total_simulation * mean_total_simulation))\n sdev_total_time = sqrt((sq_sum_total_time \/ num_falsified) - (mean_total_time * mean_total_time))\n sdev_eq_simulation = sqrt((sq_sum_eq_simulation \/ num_falsified) - (mean_eq_simulation * mean_eq_simulation))\n sdev_simulation_time = sqrt((sq_sum_simulation_time \/ num_falsified) - (mean_simulation_time * mean_simulation_time))\n } else {\n # When we failed to falsify, we let everything 0.\n mean_total_simulation = 0\n mean_total_time = 0\n mean_eq_simulation = 0\n mean_simulation_time = 0\n\n sdev_total_simulation = 0\n sdev_total_time = 0\n sdev_eq_simulation = 0\n sdev_simulation_time = 0\n \n min_total_simulation = 0\n min_total_time = 0\n min_eq_simulation = 0\n min_simulation_time = 0\n }\n\n # Output the summary\n printf \"\\\"%s\\\",\\\"%s\\\",\", system_name, property\n printf \"\\\"%g\\\",\\\"%g\\\",\\\"%d\\\",\\\"%d\\\",\",\n mean_total_simulation, sdev_total_simulation, min_total_simulation, max_total_simulation\n printf \"\\\"%g\\\",\\\"%g\\\",\\\"%d\\\",\\\"%d\\\",\",\n mean_total_time, sdev_total_time, min_total_time, max_total_time\n printf \"\\\"%g\\\",\\\"%g\\\",\\\"%d\\\",\\\"%d\\\",\",\n mean_eq_simulation, sdev_eq_simulation, min_eq_simulation, max_eq_simulation\n printf \"\\\"%g\\\",\\\"%g\\\",\\\"%d\\\",\\\"%d\\\",\",\n mean_simulation_time, sdev_simulation_time, min_simulation_time, max_simulation_time\n printf \"\\\"%d\\\"\\n\", num_falsified\n}\n","avg_line_length":32.0742857143,"max_line_length":513,"alphanum_fraction":0.6869766613} {"size":80939,"ext":"awk","lang":"Awk","max_stars_count":null,"content":"#!\/usr\/bin\/awk -f\n#* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\n#* *\n#* This file is part of the program and library *\n#* SCIP --- Solving Constraint Integer Programs *\n#* *\n#* *\n#* Copyright (C) 2002-2016 Konrad-Zuse-Zentrum *\n#* fuer Informationstechnik Berlin *\n#* *\n#* SCIP is distributed under the terms of the ZIB Academic License. *\n#* *\n#* You should have received a copy of the ZIB Academic License *\n#* along with SCIP; see the file COPYING. If not email to scip@zib.de. *\n#* *\n#* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\n#\n#@file cmpres.awk\n#@brief SCIP Check Comparison Report Generator\n#@author Tobias Achterberg\n#@author Robert Waniek\n#@author Marc Pfetsch\n#@author Timo Berthold\n#\nfunction abs(x)\n{\n return x < 0 ? -x : x;\n}\n\nfunction min(x,y)\n{\n return (x) < (y) ? (x) : (y);\n}\n\nfunction max(x,y)\n{\n return (x) > (y) ? (x) : (y);\n}\n\nfunction max3(x,y,z)\n{\n return (x) >= (y) ? max(x,z) : max(y,z);\n}\n\nfunction ceil(x)\n{\n return (x == int(x) ? x : (x < 0 ? int(x) : int(x+1)));\n}\n\nfunction floor(x)\n{\n return (x == int(x) ? x : (x < 0 ? int(x-1) : int(x)));\n}\n\nfunction fracceil(x,f)\n{\n return ceil(x\/f)*f;\n}\n\nfunction fracfloor(x,f)\n{\n return floor(x\/f)*f;\n}\n\nfunction sign(x)\n{\n return (x >= 0 ? 1.0 : -1.0);\n}\n\nfunction mod(x,m)\n{\n return (x - m*floor(x\/m));\n}\n\nfunction printhline(nsolver,short, printsoltimes)\n{\n for( s = 0; s < nsolver; ++s )\n {\n\n if( s == 0 )\n printf(\"------------------------------+-+---------+--------+\");\n else\n {\n if( !short )\n printf(\"-+---------+--------+------+------+\");\n else\n printf(\"-+---------+--------+\");\n }\n if( printsoltimes )\n {\n if( s == 0 )\n printf(\"---------+--------+\");\n else\n printf(\"------+------+\");\n }\n }\n printf(\"-------------\\n\");\n}\n\nfunction isfaster(t,reft,tol)\n{\n return (t < 1.0\/tol*reft && t <= reft - 0.2);\n}\n\nfunction isslower(t,reft,tol)\n{\n return isfaster(reft, t, tol);\n}\n\nfunction texcompstr(val,refval, x,s,t)\n{\n x = floor(100*(val\/refval-1.0)+0.5);\n s = \"\";\n t = \"\";\n if( x < 0 )\n {\n if( x <= -texcolorlimit )\n {\n s = \"\\\\textcolor{red}{\\\\raisebox{0.25ex}{\\\\tiny $-$}\";\n t = \"}\";\n }\n else\n s = \"\\\\raisebox{0.25ex}{\\\\tiny $-$}\";\n }\n else if( x > 0 )\n {\n if( x >= +texcolorlimit )\n {\n s = \"\\\\textcolor{blue}{\\\\raisebox{0.25ex}{\\\\tiny $+$}\";\n t = \"}\";\n }\n else\n s = \"\\\\raisebox{0.25ex}{\\\\tiny $+$}\";\n }\n\n return sprintf(\"%s%d%s\", s, abs(x), t);\n}\n\nfunction texstring(s, ts)\n{\n ts = s;\n gsub(\/_\/, \"\\\\_\", ts);\n\n return ts;\n}\n\nfunction texint(x, ts,r)\n{\n ts = \"\";\n x = floor(x);\n while( x != 0 )\n {\n r = mod(x, 1000);\n x = floor(x\/1000);\n if( ts != \"\" )\n ts = \"\\\\,\" ts;\n\n if ( x > 0 )\n ts = sprintf(\"%03d\", r) \"\" ts;\n else\n ts = r \"\" ts;\n }\n\n return ts;\n}\n\nfunction texsolvername(s, sname)\n{\n sname = solvername[s];\n if( setname[sname] != \"\" )\n sname = setname[sname];\n else\n {\n sub(\/.*:\/, \"\", sname);\n sub(\/.*_\/, \"\", sname);\n if( length(sname) > 12 )\n sname = substr(sname, length(sname)-11, 12);\n }\n\n return sname;\n}\n\n# McNemar statistical test\n#\n# input: two arrays of Boolean values whose difference should be tested for statistical significance and the length of\n# both arrays\n#\n# output: the chi_squared value, (which needs to be transformed to the desired p-value, see also function chi_to_p\nfunction mcnemar(ref_array, solver_array, problistlen)\n{\n chi_squared = 0.0;\n b = 0;\n c = 0;\n\n # count the number of entries for which both arrays differ,\n # separately for both possible differences (TRUE\/FALSE and FALSE\/TRUE)\n for( i = 0; i < problistlen; ++i )\n {\n if( ref_array[i] && !solver_array[i] )\n b++;\n else if( !ref_array[i] && solver_array[i] )\n c++;\n }\n\n # textbook McNemar formula, the square of the differences of both counters divided by their sum is supposed to be\n # chi-square distributed for a random experiment\n if( b + c > 0 )\n chi_squared = (b-c)*(b-c)\/(1.0*(b+c));\n\n return chi_squared;\n}\n\n# check significance of chi-square distribution with degree 1 using quantiles\nfunction chi_to_p(chi)\n{\n if ( chi < 3.841 )\n printf(\", 0.05 < p X\");\n else if ( 3.841 <= chi && chi < 5.024 ) # quantile for 1 - 0.05 = 0.95\n printf(\", p ~ (0.025, 0.05] !\");\n else if ( 5.024 <= chi && chi < 6.635 ) # quantile for 1 - 0.025 = 0.975\n printf(\", p ~ (0.01, 0.025] !!\");\n else if ( 6.635 <= chi && chi < 7.879 ) # quantile for 1 - 0.01 = 0.99\n printf(\", p ~ (0.005, 0.01]!!!\");\n else if ( 7.879 <= chi && chi < 12.116 ) # quantile for 1 - 0.005 = 0.995\n printf(\", p ~(0.0005,0.005]!!!\");\n else # quantile for 1 - 0.0005 = 0.9995\n printf(\", p <= 0.0005 !!!\");\n}\n\n# swaps position i and j of array a\nfunction swap(a, i, j) {\n t = a[i]; a[i] = a[j]; a[j] = t;\n}\n\n\n# quicksort algorithm that sorts by the absolute values in non-increasing order\nfunction qsort(a, left, right)\n{\n # stop recursion\n if (left >= right)\n return;\n\n # use a random pivot element\n swap(a, left, left+int((right-left+1)*rand()));\n last = left;\n\n for( i = left+1; i <= right; i++ )\n {\n if( abs(a[i]) < abs(a[left]) )\n swap(a, ++last, i);\n }\n\n # swap back pivot, recursive calls\n swap(a, left, last);\n qsort(a, left, last-1);\n qsort(a, last+1, right);\n}\n\n# copy time array\nfunction parse_time(ref_array,solver_array,time,o,printorder,probidx,problistlen)\n{\n s = printorder[o];\n p0 = printorder[0];\n n = 0;\n\n for( i = 0; i < problistlen; i++ )\n {\n p = problist[i];\n if(probidx[p,p0] != \"\" && probidx[p,s] != \"\")\n {\n ref_array[n] = time[p0,probidx[p,p0]];\n solver_array[n] = time[s,probidx[p,s]];\n n++;\n }\n }\n}\n\n# copy node array\nfunction parse_nodes(ref_array,solver_array,nodes,o,probidx,problistlen,status,infinity)\n{\n s = printorder[o];\n p0 = printorder[0];\n n = 0;\n\n for( i = 0; i < problistlen; i++ )\n {\n p = problist[i];\n if(probidx[p,p0] != \"\" && probidx[p,s] != \"\")\n {\n if( status[p0,probidx[p,p0]] == \"timeout\" || status[p0,probidx[p,p0]] == \"memlimit\" )\n ref_array[n] = infinity;\n else\n ref_array[n] = nodes[p0,probidx[p,p0]];\n\n if( status[s,probidx[p,s]] == \"timeout\" || status[s,probidx[p,s]] == \"memlimit\" )\n solver_array[n] = infinity;\n else\n solver_array[n] = nodes[s,probidx[p,s]];\n\n n++;\n }\n }\n}\n\n# filter results for Wilcoxon test, only keep data for instances for which both, the relative difference and the\n# absolute difference are larger than the given thresholds rel_epsilon and abs_delta\nfunction filter(ref_array, solver_array, problistlen, rel_epsilon, abs_delta)\n{\n n = 0;\n\n for( i = 0; i < problistlen; i++ )\n {\n diff = abs(solver_array[i] - ref_array[i]);\n if( diff > abs_delta && diff \/ max3(abs(solver_array[i]), abs(ref_array[i]), 1.0) > rel_epsilon )\n {\n ref_array[n] = ref_array[i];\n solver_array[n] = solver_array[i];\n n++;\n }\n }\n\n return n;\n}\n\n# computes the improvement\/degradation factors (always >= 1) and marks them by opposite signs\n# (negative sign if solver_array[i] is faster than ref_array[i])\nfunction factorize(ref_array, solver_array, n, maxval)\n{\n for( i = 0; i < n; ++i )\n {\n if( ref_array[i] >= maxval && solver_array[i] < maxval )\n ref_array[i] = -1.0 * maxval;\n else if( ref_array[i] < maxval && solver_array[i] >= maxval )\n ref_array[i] = 1.0 * maxval;\n else if( ref_array[i] == 0.0 && solver_array[i] == 0.0 )\n ref_array[i] = 0.0;\n else if( ref_array[i] == 0.0 )\n ref_array[i] = 1.0 * maxval;\n else if( solver_array[i] == 0.0 )\n ref_array[i] = -1.0 * maxval;\n else if( solver_array[i] \/ ref_array[i] < 1.0 )\n ref_array[i] = -1.0 * ref_array[i] \/ solver_array[i];\n else\n ref_array[i] = solver_array[i] \/ ref_array[i];\n\n solver_array[i] = 0.0;\n }\n}\n\n\n# Wilcoxon signed rank test\n#\n# input: two arrays of real values whose difference should be tested for statistical significance, the length of\n# both arrays, and the employed timelimit (to rank instances for which one solver hit the timelimit equally)\n#\n# output: the z value, (which needs to be transformed to the desired p-value, see also function z_to_p\n#\n# note: to get meaningful results, some form of filtering should be applied to remove nearly-identical results from the\n# test set, see also the filter() function\nfunction wilcoxon(ref_array, solver_array, problistlen, timelimit)\n{\n w_minus = 0;\n w_plus = 0;\n\n # avoid degenerate case\n if ( problistlen == 0 )\n return 0.0;\n\n # calculate difference\n for( i = 0; i < problistlen; i++ )\n {\n differences[i] = ref_array[i] - solver_array[i];\n if( (ref_array[i] >= timelimit) != (solver_array[i] >= timelimit) )\n differences[i] = sign(differences[i]) * timelimit;\n }\n\n # sort differences by their absolute values\n qsort(differences, 0, problistlen-1);\n\n i = 0;\n\n # calculate rank sums\n while( i < problistlen )\n {\n i_start = i;\n i_end = i;\n i_sum = 0;\n\n # use average in case of tied samples (identical differences) - always executed once\n while ( i_end < problistlen && abs((abs(differences[i_start]) - abs(differences[i_end]))) < 1e-06 )\n {\n i_sum += i_end;\n i_end++;\n }\n\n i_sum = i_sum\/(i_end - i_start);\n\n # add (average) rank values to rank sums\n #\n # in the default case that the value is unique, this loop and the previous loop are traversed exactly once, s.t.\n # the value is simply added to one of the sums\n while ( i < i_end )\n {\n if( differences[i] < 0 )\n w_minus += (i_sum+1);\n else if( differences[i] > 0 )\n w_plus += (i_sum+1);\n i++;\n }\n }\n\n # apply Wilcoxon formula\n w = 1.0 * min(w_minus, w_plus);\n\n # apply correction for small number of instances\n if ( problistlen <= 60 )\n z = (abs(w - 0.25 * problistlen * (problistlen + 1.0)) - 0.5) \/ sqrt(problistlen * (problistlen+1) * (2*problistlen + 1.0)\/24.0);\n else\n z = (w - 0.25 * problistlen * (problistlen + 1.0)) \/ sqrt(problistlen * (problistlen + 1.0) * (2*problistlen + 1.0)\/24.0);\n\n return z;\n}\n\n# check significance of z-value with respect to the normal distribution with mean 0 and variance 1\nfunction z_to_p(z)\n{\n # check whether z lies in (1 - 0.05) quantile -> null hypothesis is accepted\n if ( -1.960 <= z && z <= 1.960 ) # quantile for 1 - 0.05\n printf(\", 0.05 <= p X\");\n else if ( -2.241 <= z && z <= 2.241 ) # quantile for 1 - 0.025\n printf(\", p ~ [0.025, 0.05) !\");\n else if ( - 2.576 <= z && z <= 2.576 ) # quantile for 1 - 0.01\n printf(\", p ~ [0.01, 0.025) !!\");\n else if ( - 2.807 <= z && z <= 2.807 ) # quantile for 1 - 0.005\n printf(\", p ~ [0.005, 0.01)!!!\");\n else if ( - 3.481 <= z && z <= 3.481 ) # quantile for 1 - 0.0005\n printf(\", p ~[0.0005,0.005)!!!\");\n else # quantile for 1 - 0.0005 = 0.9995\n printf(\", p < 0.0005 !!!\");\n}\n\n\nBEGIN {\n\n short = 0; #for each non reference solver, only absolute time and number of nodes are printed\n printsoltimes = 0; # for reference solver, absolute time to first and best solution are printed, for other solvers the corresponding ratios\n #! please NOTE that this additional output is currently only available for SCIP .res-files created with the evalcheck.sh script and\n # the flag printsoltimes = 1 set in check.awk. If other solvers are involved, leave this flag set to 0.\n printgap = 0; # if timeout, then print absolute gap at termination in time column, if gap is finite\n printsoltimes = !short && printsoltimes; # short deactivates the detailed solution times output\n infinity = 1e+20;\n timegeomshift = 10.0;\n nodegeomshift = 100.0;\n mintime = 0.5;\n wintolerance = 1.1;\n markbettertime = 1.1;\n markworsetime = 1.1;\n markbetternodes = 5.0;\n markworsenodes = 5.0;\n onlymarked = 0;\n onlyprocessed = 0;\n maxscore = 10.0;\n consistency = 1;\n onlyfeasible = 0;\n onlyinfeasible = 0;\n onlyfail = 0;\n exclude = \"\";\n texfile = \"\";\n texincfile = \"\";\n texsummaryfile = \"\";\n texsummaryheader = 0;\n texsummaryweight = 0;\n texsummaryshifted = 0;\n texcolorlimit = 5;\n textestset = \"\";\n texcmpfile = \"\";\n texcmpfiledir = \"\";\n texcmpfilename = \"\";\n diagramfile = \"\";\n diagramnsteps = 5; # number of steps at the time line\n diagramyellowbg = 0; # Should the background be colored in SCIP-HP-yellow ?\n diagramgerman = 0; # Soll die Beschriftung deutsch sein?\n thesisnames = 0;\n nsetnames = 0;\n onlygroup = 0;\n group = \"default\";\n\n problistlen = 0;\n nsolver = 0;\n nprobs[nsolver] = 0;\n fulltotaltime = 0.0;\n}\n\/^=group=\/ {\n group = $2;\n}\n\/^=setname= \/ {\n if( setorder[$2] == 0 )\n {\n nsetnames++;\n setorder[$2] = nsetnames;\n setname[$2] = $3;\n for( i = 4; i <= NF; i++ )\n setname[$2] = setname[$2]\" \"$i;\n }\n setingroup[$2,group] = 1;\n}\n\/^@02 timelimit: \/ {\n timelimit[nsolver] = $3;\n}\n\/^@01 \/ {\n if( onlygroup == 0 || setingroup[$2,onlygroup] )\n {\n solvername[nsolver] = $2;\n nsolver++;\n }\n nprobs[nsolver] = 0;\n}\n\/\/ {\n statuses[\"ok\"];\n statuses[\"timeout\"];\n statuses[\"unknown\"];\n statuses[\"abort\"];\n statuses[\"fail\"];\n statuses[\"readerror\"];\n statuses[\"better\"];\n statuses[\"solved\"];\n statuses[\"sollimit\"];\n statuses[\"gaplimit\"];\n statuses[\"memlimit\"];\n statuses[\"nodelimit\"];\n\n name[nsolver,nprobs[nsolver]] = $1;\n validline = 0;\n # check if this is a useable line\n if( $10 in statuses ) # BLIS, SYMPHONY\n {\n # collect data (line with problem size and simplex iterations)\n type[nsolver,nprobs[nsolver]] = \"?\";\n conss[nsolver,nprobs[nsolver]] = $2;\n vars[nsolver,nprobs[nsolver]] = $3;\n dualbound[nsolver,nprobs[nsolver]] = max(min($4, +infinity), -infinity);\n primalbound[nsolver,nprobs[nsolver]] = max(min($5, +infinity), -infinity);\n gap[nsolver,nprobs[nsolver]] = $6;\n iters[nsolver,nprobs[nsolver]] = $7;\n nodes[nsolver,nprobs[nsolver]] = max($8,1);\n time[nsolver,nprobs[nsolver]] = fracceil(max($9,mintime),0.1);\n status[nsolver,nprobs[nsolver]] = $10;\n printsoltimes = 0; # additional output is only available for SCIP-.res files\n validline = 1;\n }\n if( $11 in statuses ) # from NLP-trace-files\n {\n # collect data (line with problem type, problem size and simplex iterations)\n type[nsolver,nprobs[nsolver]] = $2;\n conss[nsolver,nprobs[nsolver]] = $3;\n vars[nsolver,nprobs[nsolver]] = $4;\n dualbound[nsolver,nprobs[nsolver]] = max(min($5, +infinity), -infinity);\n primalbound[nsolver,nprobs[nsolver]] = max(min($6, +infinity), -infinity);\n gap[nsolver,nprobs[nsolver]] = $7;\n iters[nsolver,nprobs[nsolver]] = $8;\n nodes[nsolver,nprobs[nsolver]] = max($9,1);\n time[nsolver,nprobs[nsolver]] = fracceil(max($10,mintime),0.1);\n status[nsolver,nprobs[nsolver]] = $11;\n printsoltimes = 0; # additional output is only available for SCIP-.res files\n validline = 1;\n }\n if( $12 in statuses ) # GUROBI, CBC\n {\n # collect data (line with original and presolved problem size and simplex iterations)\n type[nsolver,nprobs[nsolver]] = \"?\";\n conss[nsolver,nprobs[nsolver]] = $4;\n vars[nsolver,nprobs[nsolver]] = $5;\n dualbound[nsolver,nprobs[nsolver]] = max(min($6, +infinity), -infinity);\n primalbound[nsolver,nprobs[nsolver]] = max(min($7, +infinity), -infinity);\n gap[nsolver,nprobs[nsolver]] = $8;\n iters[nsolver,nprobs[nsolver]] = $9;\n nodes[nsolver,nprobs[nsolver]] = max($10,1);\n time[nsolver,nprobs[nsolver]] = fracceil(max($11,mintime),0.1);\n status[nsolver,nprobs[nsolver]] = $12;\n printsoltimes = 0; # additional output is only available for SCIP-.res files\n validline = 1;\n }\n if( $13 in statuses ) # GLPK, CPLEX, SCIP without columns displaying times to first and best solution\n {\n # collect data (line with problem type, original and presolved problem size and simplex iterations)\n type[nsolver,nprobs[nsolver]] = $2;\n conss[nsolver,nprobs[nsolver]] = $5;\n vars[nsolver,nprobs[nsolver]] = $6;\n dualbound[nsolver,nprobs[nsolver]] = max(min($7, +infinity), -infinity);\n primalbound[nsolver,nprobs[nsolver]] = max(min($8, +infinity), -infinity);\n gap[nsolver,nprobs[nsolver]] = $9;\n iters[nsolver,nprobs[nsolver]] = $10;\n nodes[nsolver,nprobs[nsolver]] = max($11,1);\n time[nsolver,nprobs[nsolver]] = fracceil(max($12,mintime),0.1);\n status[nsolver,nprobs[nsolver]] = $13;\n printsoltimes = 0; # additional output is only available for SCIP-.res files\n validline = 1;\n }\n\n if( $15 in statuses ) # SCIP with solution times to first\/last\n {\n # collect data (line with problem type, original and presolved problem size and simplex iterations)\n type[nsolver,nprobs[nsolver]] = $2;\n conss[nsolver,nprobs[nsolver]] = $5;\n vars[nsolver,nprobs[nsolver]] = $6;\n dualbound[nsolver,nprobs[nsolver]] = max(min($7, +infinity), -infinity);\n primalbound[nsolver,nprobs[nsolver]] = max(min($8, +infinity), -infinity);\n gap[nsolver,nprobs[nsolver]] = $9;\n iters[nsolver,nprobs[nsolver]] = $10;\n nodes[nsolver,nprobs[nsolver]] = max($11,1);\n time[nsolver,nprobs[nsolver]] = fracceil(max($12,mintime),0.1);\n timetofirst[nsolver,nprobs[nsolver]] = fracceil(max($13,mintime),0.1);\n timetobest[nsolver, nprobs[nsolver]] = fracceil(max($14, mintime), 0.1);\n status[nsolver,nprobs[nsolver]] = $15;\n validline = 1;\n }\n\n if( validline )\n {\n # postprocessing of information\n if( status[nsolver,nprobs[nsolver]] == \"better\" )\n status[nsolver,nprobs[nsolver]] = \"timeout\";\n if( status[nsolver,nprobs[nsolver]] == \"sollimit\" || status[nsolver,nprobs[nsolver]] == \"gaplimit\" || status[nsolver,nprobs[nsolver]] == \"solved\" )\n status[nsolver,nprobs[nsolver]] = \"ok\";\n\n if( status[nsolver,nprobs[nsolver]] == \"timeout\" || status[nsolver,nprobs[nsolver]] == \"nodelimit\" || status[nsolver,nprobs[nsolver]] == \"memlimit\")\n hitlimit[nsolver,nprobs[nsolver]] = 1;\n else\n hitlimit[nsolver,nprobs[nsolver]] = 0;\n probidx[$1,nsolver] = nprobs[nsolver];\n probcnt[$1]++;\n nprobs[nsolver]++;\n if( probcnt[$1] == 1 )\n {\n problist[problistlen] = $1;\n problistlen++;\n }\n }\n}\nEND {\n if( onlygroup > 0 && nsolver == 1 && solvername[1] == \"SCIP:default\" )\n {\n printf(\"only SCIP:default setting found\\n\");\n exit 1;\n }\n if( nsolver == 0 )\n {\n printf(\"no instances found in log file\\n\");\n exit 1;\n }\n\n # tex comparison file: either directly as 'texcmpfile' or as pair 'texcmpfiledir\/texcmpfilename'\n if( texcmpfile == \"\" && texcmpfiledir != \"\" && texcmpfilename != \"\" )\n texcmpfile = texcmpfiledir \"\/\" texcmpfilename;\n\n # process exclude string\n n = split(exclude, a, \",\");\n for( i = 1; i <= n; i++ )\n excluded[a[i]] = 1;\n\n # initialize means\n for( s = 0; s < nsolver; ++s )\n {\n # cat: -1 - all within time limit, 0 - all, 1 - different path, 2 - equal path, 3 - all timeout\n for( cat = -1; cat <= 3; cat++ )\n {\n nevalprobs[s,cat] = 0;\n nprocessedprobs[s,cat] = 0;\n timetotal[s,cat] = 0.0;\n nodetotal[s,cat] = 0.0;\n timegeom[s,cat] = 1.0;\n nodegeom[s,cat] = 1.0;\n timeshiftedgeom[s,cat] = timegeomshift;\n timetofirstgeom[s,cat] = 1.0;\n timetofirstshiftedgeom[s,cat] = timegeomshift;\n timetobestgeom[s,cat] = 1.0;\n timetobestshiftedgeom[s,cat] = timegeomshift;\n nodeshiftedgeom[s,cat] = nodegeomshift;\n reftimetotal[s,cat] = 0.0;\n refnodetotal[s,cat] = 0.0;\n reftimegeom[s,cat] = 1.0;\n reftimetofirstgeom[s,cat] = 1.0;\n reftimetobestgeom[s,cat] = 1.0;\n refnodegeom[s,cat] = 1.0;\n reftimeshiftedgeom[s,cat] = timegeomshift;\n refnodeshiftedgeom[s,cat] = nodegeomshift;\n reftimetofirstshiftedgeom[s,cat] = timegeomshift;\n reftimetobestshiftedgeom[s,cat] = timegeomshift;\n\n wins[s,cat] = 0;\n nsolved[s,cat] = 0;\n ntimeouts[s,cat] = 0;\n nfails[s,cat] = 0;\n better[s,cat] = 0;\n worse[s,cat] = 0;\n betterobj[s,cat] = 0;\n worseobj[s,cat] = 0;\n feasibles[s,cat] = 0;\n score[s,cat] = 1.0;\n }\n }\n besttimegeom = 1.0;\n besttimetofirstgeom = 1.0;\n besttimetobestgeom = 1.0;\n bestnodegeom = 1.0;\n besttimeshiftedgeom = timegeomshift;\n besttimetofirstshiftedgeom = timegeomshift;\n besttimetobestshiftedgeom = timegeomshift;\n bestnodeshiftedgeom = nodegeomshift;\n bestnsolved = 0;\n bestntimeouts = 0;\n bestnfails = 0;\n bestbetter = 0;\n bestbetterobj = 0;\n bestfeasibles = 0;\n\n # calculate the order in which the columns should be printed: BARON first, default < non-default\n for( s = 0; s < nsolver; ++s )\n {\n sname = solvername[s];\n for( o = 0; o < s; ++o )\n {\n i = printorder[o];\n iname = solvername[i];\n if( nsetnames > 0 )\n {\n # use order given by =setname= entries\n if( setorder[sname] < setorder[iname] )\n break;\n }\n else\n {\n # use alphabetical order, but put BARON first and \"default\" before all others\n if( substr(sname, 1, 5) == \"BARON\" && substr(iname, 1, 5) != \"BARON\" )\n break;\n if( substr(sname, 1, 5) == substr(iname, 1, 5) &&\n match(sname, \"default\") != 0 && match(iname, \"default\") == 0 )\n break;\n if( substr(sname, 1, 5) == substr(iname, 1, 5) &&\n (match(sname, \"default\") == 0) == (match(iname, \"default\") == 0) &&\n sname < iname )\n break;\n }\n }\n for( j = s-1; j >= o; --j )\n printorder[j+1] = printorder[j];\n printorder[o] = s;\n }\n\n # print headers\n for( o = 0; o < nsolver; ++o )\n {\n s = printorder[o];\n sname = solvername[s];\n if( o == 0 )\n {\n if( printsoltimes )\n {\n if ( length(sname) <= 58 )\n printf(\" %58s |\", sname);\n else\n printf(\" *%57s |\", substr(sname, length(sname)-58));\n }\n else\n {\n if ( length(sname) <= 49 )\n printf(\" %49s |\", sname)\n else\n printf(\" *%48s |\", substr(sname, length(sname)-39));\n }\n }\n else\n {\n if( short )\n {\n if( length(sname) <= 19 )\n printf(\"%19s |\", sname);\n else\n printf(\"*%16s |\", substr(sname, length(sname)-17));\n }\n else if( printsoltimes )\n {\n if( length(sname) <= 47 )\n printf(\"%47s |\", sname);\n else\n printf(\"*%46s |\", substr(sname, length(sname)-47));\n }\n else\n {\n if( length(sname) <= 33 )\n printf(\"%33s |\", sname);\n else\n printf(\"*%30s |\", substr(sname, length(sname)-31));\n }\n }\n }\n printf(\"\\n\");\n printhline(nsolver,short, printsoltimes);\n printf(\" Name |\");\n for( s = 0; s < nsolver; ++s )\n {\n if( s == 0 || short )\n printf(\"F| Nodes | Time |\");\n else\n printf(\"F| Nodes | Time | NodQ | TimQ |\");\n if( printsoltimes )\n {\n if( s == 0 )\n printf(\" ToFirst | ToLast |\");\n else\n printf(\" FirQ | LasQ |\");\n }\n }\n printf(\" bounds check\\n\");\n printhline(nsolver,short, printsoltimes);\n\n # tex comparison headers\n if( texcmpfile != \"\" )\n {\n printf(\"{\\\\sffamily\\n\") > texcmpfile;\n printf(\"\\\\scriptsize\\n\") > texcmpfile;\n printf(\"\\\\setlength{\\\\extrarowheight}{1pt}\\n\") > texcmpfile;\n printf(\"\\\\setlength{\\\\tabcolsep}{2pt}\\n\") > texcmpfile;\n printf(\"\\\\newcommand{\\\\g}{\\\\raisebox{0.25ex}{\\\\tiny $>$}}\\n\") > texcmpfile;\n printf(\"\\\\newcommand{\\\\spc}{\\\\hspace{2em}}\\n\") > texcmpfile;\n\n # add names of solvers\n for ( o = 0; o < nsolver; ++o )\n {\n s = printorder[o];\n solverextension = solverextension \"i\";\n printf(\"\\\\newcommand{\\\\solvername%s}{%s}\\n\", solverextension, solvername[s]) > texcmpfile;\n }\n\n printf(\"\\\\begin{tabular*}{\\\\columnwidth}{@{\\\\extracolsep{\\\\fill}}l\") > texcmpfile;\n for( s = 0; s < nsolver; ++s )\n printf(\"@{\\\\spc}rr\") > texcmpfile;\n printf(\"@{}}\\n\") > texcmpfile;\n printf(\"\\\\toprule\\n\") > texcmpfile;\n solverextension = \"\";\n for( o = 0; o < nsolver; ++o )\n {\n s = printorder[o];\n solverextension = solverextension \"i\";\n printf(\"& \\\\multicolumn{2}{@{\\\\spc}c%s}{\\\\solvername%s} \", o < nsolver-1 ? \"@{\\\\spc}\" : \"\", solverextension) > texcmpfile;\n }\n printf(\"\\\\\\\\\\n\") > texcmpfile;\n for( o = 0; o < nsolver; ++o )\n printf(\"& Nodes & Time \") > texcmpfile;\n printf(\"\\\\\\\\\\n\") > texcmpfile;\n printf(\"\\\\midrule\\n\") > texcmpfile;\n }\n\n # display the problem results and calculate mean values\n for( i = 0; i < problistlen; ++i )\n {\n p = problist[i];\n if( length(p) > 28 )\n shortp = substr(p, length(p)-27, 28);\n else\n shortp = p;\n\n line = sprintf(\"%-28s\", shortp);\n fail = 0;\n readerror = 0;\n unprocessed = 0;\n mindb = +infinity;\n maxdb = -infinity;\n minpb = +infinity;\n maxpb = -infinity;\n itercomp = -1;\n nodecomp = -1;\n timecomp = -1;\n timetofirstcomp = -1;\n timetobestcomp = -1;\n besttime = +infinity;\n besttimetofirst = +infinity;\n besttimetobest = +infinity;\n bestnodes = +infinity;\n worsttime = -infinity;\n worstnodes = -infinity;\n worstiters = -infinity;\n worsttimetofirst = -infinity;\n worsttimetobest = -infinity;\n nthisunprocessed = 0;\n nthissolved = 0;\n nthistimeouts = 0;\n nthisfails = 0;\n ismini = 0;\n ismaxi = 0;\n mark = \" \";\n marker = \" \";\n notimeout = 1;\n\n # check for exclusion\n if( excluded[p] )\n unprocessed = 1;\n\n # find best and worst run and check whether this instance should be counted in overall statistics\n for( s = 0; s < nsolver; ++s )\n {\n pidx = probidx[p,s];\n processed = (pidx != \"\");\n\n # make sure, nodes and time are non-zero for geometric means\n nodes[s,pidx] = max(nodes[s,pidx], 1);\n time[s,pidx] = max(time[s,pidx], mintime);\n fulltotaltime += time[s,pidx];\n\n # If we got a timeout although the time limit has not been reached (e.g., due to a memory limit),\n # we assume that the run would have been continued with the same nodes\/sec.\n # Set the time to the time limit and increase the nodes accordingly.\n # if( status[s,pidx] == \"timeout\" && time[s,pidx] < timelimit[s] )\n # {\n # nodes[s,pidx] *= timelimit[s]\/time[s,pidx];\n # time[s,pidx] = timelimit[s];\n # }\n\n # if the solver exceeded the timelimit, set status accordingly\n if( (status[s,pidx] == \"ok\" || status[s,pidx] == \"unknown\") && timelimit[s] > 0.0 && time[s,pidx] > timelimit[s] )\n {\n status[s,pidx] = \"timeout\";\n time[s,pidx] = timelimit[s];\n }\n\n # check if all solvers processed the problem\n if( !processed )\n {\n marker = \"?\";\n unprocessed = 1;\n }\n\n # check if solver ran successfully (i.e., no abort nor fail)\n if( processed && (status[s,pidx] == \"ok\" || status[s,pidx] == \"unknown\" || status[s,pidx] == \"timeout\" || status[s,pidx] == \"nodelimit\" || status[s,pidx] == \"memlimit\") )\n {\n besttime = min(besttime, time[s,pidx]);\n bestnodes = min(bestnodes, nodes[s,pidx]);\n besttimetofirst = min(besttimetofirst, timetofirst[s,pidx]);\n besttimetobest = min(besttimetobest, timetobest[s,pidx]);\n worsttime = max(worsttime, time[s,pidx]);\n worstnodes = max(worstnodes, nodes[s,pidx]);\n worstiters = max(worstiters, iters[s,pidx]);\n worsttimetofirst = max(worsttimetofirst, timetofirst[s, pidx]);\n worsttimetobest = max(worsttimetobest, timetobest[s, pidx]);\n }\n }\n worsttime = max(worsttime, mintime);\n worsttimetofirst = max(worsttimetofirst, mintime);\n worsttimetobest = max(worsttimetobest, mintime);\n worstnodes = max(worstnodes, 1);\n worstiters = max(worstiters, 0);\n\n # check for each solver if it has same path as reference solver -> category\n for( o = 0; o < nsolver; ++o )\n {\n s = printorder[o];\n pidx = probidx[p,s];\n processed = (pidx != \"\");\n\n if( !processed )\n {\n notimeout = 0;\n continue;\n }\n else\n {\n if ( status[s,pidx] == \"timeout\" )\n {\n # If memory limit was exceeded or we hit a hard time\/memory limit,\n # replace time and nodes by worst time and worst nodes of all runs.\n # Note this also takes action if the time limits of the runs are\n # different: in this case we set the values to the worst case.\n # if ( time[s,pidx] < 0.99*worsttime || nodes[s,pidx] <= 1 )\n # {\n # iters[s,pidx] = worstiters+s; # make sure this is not treated as equal path\n # nodes[s,pidx] = worstnodes;\n # time[s,pidx] = worsttime;\n # }\n }\n }\n\n if( nodecomp == -1 )\n {\n itercomp = iters[s,pidx];\n nodecomp = nodes[s,pidx];\n timecomp = time[s,pidx];\n timeoutcomp = hitlimit[s,pidx];\n timetofirstcomp = max(mintime, timetofirst[s,pidx]);\n timetobestcomp = max(mintime, timetobest[s,pidx]);\n }\n iseqpath = (iters[s,pidx] == itercomp && nodes[s,pidx] == nodecomp);\n hastimeout = timeoutcomp || hitlimit[s,pidx];\n notimeout = notimeout && !timeoutcomp && !hitlimit[s,pidx];\n\n # which category?\n if( hastimeout )\n category[s] = 3;\n else if( iseqpath )\n category[s] = 2;\n else\n category[s] = 1;\n }\n\n # evaluate instance for all solvers\n for( o = 0; o < nsolver; ++o )\n {\n s = printorder[o];\n pidx = probidx[p,s];\n processed = (pidx != \"\");\n\n # arrays for applying McNemar tests\n solfound[s,pidx] = 0;\n optproven[s,pidx] = 0;\n\n if( processed && name[s,pidx] != p )\n printf(\"Error: solver %d, probidx %d, <%s> != <%s>\\n\", solvername[s], pidx, name[s,pidx], p);\n\n # check if solver ran successfully (i.e., no abort nor fail)\n if( processed )\n {\n if( status[s,pidx] == \"ok\" || status[s,pidx] == \"unknown\" )\n {\n marker = \" \";\n if( !unprocessed )\n {\n if ( notimeout )\n nsolved[s,-1]++;\n nsolved[s,0]++;\n nsolved[s,category[s]]++;\n nthissolved++;\n # fill array for McNemar test \"optimality proven?\"\n optproven[s,pidx] = 1;\n }\n }\n else if( hitlimit[s,pidx] )\n {\n marker = \">\";\n notimeout = 0;\n if( !unprocessed )\n {\n ntimeouts[s,0]++;\n ntimeouts[s,category[s]]++;\n nthistimeouts++;\n }\n }\n else\n {\n marker = \"!\";\n fail = 1;\n notimeout = 0;\n if( status[s,pidx] == \"readerror\" )\n readerror = 1;\n if( !unprocessed )\n {\n nfails[s,0]++;\n nfails[s,category[s]]++;\n nthisfails++;\n }\n }\n }\n\n if( primalbound[s,pidx] < infinity )\n {\n feasmark = \" \";\n # fill the array for McNemar test \"solution found?\"\n solfound[s,pidx] = 1;\n }\n else\n feasmark = \"#\";\n\n if( processed && !fail )\n {\n mindb = min(mindb, dualbound[s,pidx]);\n maxdb = max(maxdb, dualbound[s,pidx]);\n minpb = min(minpb, primalbound[s,pidx]);\n maxpb = max(maxpb, primalbound[s,pidx]);\n ismini = ismini || (primalbound[s,pidx] > dualbound[s,pidx] + 1e-06);\n ismaxi = ismaxi || (primalbound[s,pidx] < dualbound[s,pidx] - 1e-06);\n }\n\n # print statistics\n if( !processed )\n line = sprintf(\"%s - -\", line);\n else\n {\n if( printgap && hitlimit[s,pidx] && gap[s,pidx] != \"--\" && gap[s,pidx] != \"Large\" )\n line = sprintf(\"%s %s%10d %7.2f%%\", line, feasmark, nodes[s,pidx], gap[s,pidx]);\n else\n line = sprintf(\"%s %s%10d %s%7.1f\", line, feasmark, nodes[s,pidx], marker, time[s,pidx]);\n if( printsoltimes && o == 0 )\n line = sprintf(\"%s %8.1f %8.1f\", line, timetofirst[s,pidx], timetobest[s, pidx] );\n }\n if( o > 0 && !short )\n {\n if( !processed )\n line = sprintf(\"%s -\", line);\n else if( nodes[s,pidx]\/nodecomp > 999.99 )\n line = sprintf(\"%s Large\", line);\n else\n line = sprintf(\"%s %6.2f\", line, nodes[s,pidx]\/nodecomp);\n if( !processed )\n line = sprintf(\"%s -\", line);\n else if( time[s,pidx]\/timecomp > 999.99 )\n line = sprintf(\"%s Large\", line);\n else\n line = sprintf(\"%s %6.2f\", line, time[s,pidx]\/timecomp);\n if( processed &&\n (timeoutcomp != hitlimit[s,pidx] ||\n nodes[s,pidx] > markworsenodes * nodecomp ||\n nodes[s,pidx] < 1.0\/markbetternodes * nodecomp ||\n isfaster(time[s,pidx], timecomp, markbettertime) ||\n isslower(time[s,pidx], timecomp, markworsetime)) )\n mark = \"*\";\n }\n if( o > 0 && printsoltimes )\n {\n if( !processed )\n line = sprintf(\"%s -\", line);\n else if( timetofirst[s,pidx]\/timetofirstcomp > 999.99 )\n line = sprintf(\"%s Large\", line);\n else\n line = sprintf(\"%s %6.2f\", line, timetofirst[s,pidx]\/timetofirstcomp);\n if( !processed )\n line = sprintf(\"%s -\", line);\n else if( timetobest[s,pidx]\/timetobestcomp > 999.99 )\n line = sprintf(\"%s Large\", line);\n else\n line = sprintf(\"%s %6.2f\", line, timetobest[s,pidx]\/timetobestcomp);\n }\n }\n\n # update the best status information\n if( nthissolved > 0 )\n bestnsolved++;\n else if( nthistimeouts > 0 )\n bestntimeouts++;\n else if( nthisfails == nsolver - nthisunprocessed )\n bestnfails++;\n\n # check for inconsistency in the primal and dual bounds\n if( readerror )\n {\n line = sprintf(\"%s readerror\", line);\n mark = \" \";\n }\n else if( fail )\n {\n line = sprintf(\"%s fail\", line);\n mark = \" \";\n }\n else if( consistency &&\n ((ismini && ismaxi) ||\n (ismini && maxdb - minpb > 1e-3 * max(max(abs(maxdb), abs(minpb)), 1.0)) ||\n (ismaxi && maxpb - mindb > 1e-3 * max(max(abs(maxpb), abs(mindb)), 1.0)) ||\n (!ismini && !ismaxi && abs(maxpb - minpb) > 1e-3 * max(abs(maxpb), 1.0))) )\n {\n line = sprintf(\"%s inconsistent (maxdb=%g, minpb=%g)\", line, maxdb, minpb);\n fail = 1;\n mark = \" \";\n }\n else if( excluded[p] )\n {\n line = sprintf(\"%s excluded\", line);\n mark = \" \";\n }\n else if( unprocessed )\n {\n line = sprintf(\"%s unprocessed\", line);\n mark = \" \";\n }\n else\n line = sprintf(\"%s ok\", line);\n\n # calculate number of instances for which feasible solution has been found\n hasfeasible = 0;\n if( !unprocessed )\n {\n for( s = 0; s < nsolver; ++s )\n {\n if ( notimeout )\n nprocessedprobs[s,-1]++;\n nprocessedprobs[s,0]++;\n nprocessedprobs[s,category[s]]++;\n pidx = probidx[p,s];\n if( primalbound[s,pidx] < infinity )\n {\n if ( notimeout )\n feasibles[s,-1]++;\n feasibles[s,0]++;\n feasibles[s,category[s]]++;\n hasfeasible = 1;\n }\n }\n if( hasfeasible )\n bestfeasibles++;\n }\n\n if( (!onlymarked || mark == \"*\") && (!onlyprocessed || !unprocessed) &&\n (!onlyfeasible || hasfeasible) && (!onlyinfeasible || !hasfeasible) &&\n (!onlyfail || fail) )\n {\n printf(\"%s %s\\n\", mark, line);\n\n # tex comparison file\n if( texcmpfile != \"\" )\n {\n printf(\"%s \", texstring(p)) > texcmpfile;\n ref = printorder[0];\n refnodes = nodes[ref,probidx[p,ref]];\n reftime = time[ref,probidx[p,ref]];\n refstatus = status[ref,probidx[p,ref]];\n refhitlimit = hitlimit[ref,probidx[p,ref]];\n for( o = 0; o < nsolver; ++o )\n {\n s = printorder[o];\n pidx = probidx[p,s];\n\n if( hitlimit[s,pidx] )\n timeoutmarker = \"\\\\g\";\n else\n timeoutmarker = \" \";\n\n if( nodes[s,pidx] <= 0.5*refnodes && !hitlimit[s,pidx] )\n nodecolor = \"red\";\n else if( nodes[s,pidx] >= 2.0*refnodes && !refhitlimit )\n nodecolor = \"blue\";\n else\n nodecolor = \"black\";\n\n if( (time[s,pidx] <= 0.5*reftime && !hitlimit[s,pidx]) ||\n (!hitlimit[s,pidx] && refhitlimit) )\n timecolor = \"red\";\n else if( (time[s,pidx] >= 2.0*reftime && !refhitlimit) ||\n (hitlimit[s,pidx] && !refhitlimit) )\n timecolor = \"blue\";\n else\n timecolor = \"black\";\n\n if( status[s,pidx] == \"ok\" || status[s,pidx] == \"unknown\" || status[s,pidx] == \"timeout\" || status[s,pidx] == \"memlimit\" || status[s,pidx] == \"nodelimit\" )\n printf(\"&\\\\textcolor{%s}{%s %8s} &\\\\textcolor{%s}{%s %8.1f} \",\n nodecolor, timeoutmarker, texint(nodes[s,pidx]), timecolor, timeoutmarker, time[s,pidx]) > texcmpfile;\n else\n printf(\"& --- & --- \") > texcmpfile;\n }\n printf(\"\\\\\\\\\\n\") > texcmpfile;\n\n\n }\n }\n\n # calculate totals and means for instances where no solver failed\n if( !fail && !unprocessed &&\n (!onlyfeasible || hasfeasible) && (!onlyinfeasible || !hasfeasible) )\n {\n reftime = time[printorder[0],probidx[p,printorder[0]]];\n refhitlimit = hitlimit[printorder[0],probidx[p,printorder[0]]];\n refnodes = nodes[printorder[0],probidx[p,printorder[0]]];\n refobj = primalbound[printorder[0],probidx[p,printorder[0]]];\n reftimetofirst = timetofirst[printorder[0],probidx[p,printorder[0]]];\n reftimetobest = timetobest[printorder[0],probidx[p,printorder[0]]];\n hasbetter = 0;\n hasbetterobj = 0;\n for( s = 0; s < nsolver; ++s )\n {\n pidx = probidx[p,s];\n for( cat = 0; cat <= 3; cat = 3*cat + category[s] )\n {\n nevalprobs[s,cat]++;\n nep = nevalprobs[s,cat];\n timetotal[s,cat] += time[s,pidx];\n timetofirsttotal[s,cat] += timetofirst[s,pidx];\n timetobesttotal[s, cat] += timetobest[s, pidx];\n nodetotal[s,cat] += nodes[s,pidx];\n timegeom[s,cat] = timegeom[s,cat]^((nep-1)\/nep) * time[s,pidx]^(1.0\/nep);\n timetofirstgeom[s,cat] = timetofirstgeom[s,cat]^((nep-1)\/nep) * max(timetofirst[s,pidx], mintime)^(1.0\/nep);\n timetobestgeom[s,cat] = timetobestgeom[s,cat]^((nep-1)\/nep) * max(timetobest[s,pidx])^(1.0\/nep);\n nodegeom[s,cat] = nodegeom[s,cat]^((nep-1)\/nep) * nodes[s,pidx]^(1.0\/nep);\n timeshiftedgeom[s,cat] = timeshiftedgeom[s,cat]^((nep-1)\/nep) * (time[s,pidx]+timegeomshift)^(1.0\/nep);\n timetofirstshiftedgeom[s,cat] = timetofirstshiftedgeom[s,cat]^((nep-1)\/nep) * max(timetofirst[s,pidx]+timegeomshift, 1.0)^(1.0\/nep);\n timetobestshiftedgeom[s,cat] = timetobestshiftedgeom[s,cat]^((nep-1)\/nep) * max(timetobest[s,pidx]+timegeomshift, 1.0)^(1.0\/nep);\n nodeshiftedgeom[s,cat] = nodeshiftedgeom[s,cat]^((nep-1)\/nep) * (nodes[s,pidx]+nodegeomshift)^(1.0\/nep);\n reftimetotal[s,cat] += reftime;\n reftimetofirsttotal[s,cat] += reftimetofirst;\n reftimetobesttotal[s,cat] += reftimetobest;\n refnodetotal[s,cat] += refnodes;\n reftimegeom[s,cat] = reftimegeom[s,cat]^((nep-1)\/nep) * reftime^(1.0\/nep);\n reftimetofirstgeom[s,cat] = reftimetofirstgeom[s,cat]^((nep-1)\/nep) * reftimetofirst^(1.0\/nep);\n reftimetobestgeom[s,cat] = reftimetobestgeom[s,cat]^((nep-1)\/nep) * reftimetobest^(1.0\/nep);\n refnodegeom[s,cat] = refnodegeom[s,cat]^((nep-1)\/nep) * refnodes^(1.0\/nep);\n reftimeshiftedgeom[s,cat] = reftimeshiftedgeom[s,cat]^((nep-1)\/nep) * (reftime+timegeomshift)^(1.0\/nep);\n reftimetofirstshiftedgeom[s,cat] = reftimetofirstshiftedgeom[s,cat]^((nep-1)\/nep) * (reftimetofirst+timegeomshift)^(1.0\/nep);\n reftimetobestshiftedgeom[s,cat] = reftimetobestshiftedgeom[s,cat]^((nep-1)\/nep) * (reftimetobest+timegeomshift)^(1.0\/nep);\n refnodeshiftedgeom[s,cat] = refnodeshiftedgeom[s,cat]^((nep-1)\/nep) * (refnodes+nodegeomshift)^(1.0\/nep);\n if( time[s,pidx] <= wintolerance*besttime )\n wins[s,cat]++;\n if( !hitlimit[s,pidx] && (isfaster(time[s,pidx], reftime, wintolerance) || refhitlimit))\n {\n better[s,cat]++;\n hasbetter = 1;\n }\n else if( !refhitlimit && (isslower(time[s,pidx], reftime, wintolerance) || (hitlimit[s,pidx])))\n worse[s,cat]++;\n pb = primalbound[s,pidx];\n if( (ismini && pb - refobj < -0.01 * max(max(abs(refobj), abs(pb)), 1.0)) ||\n (ismaxi && pb - refobj > +0.01 * max(max(abs(refobj), abs(pb)), 1.0)) ) {\n betterobj[s,cat]++;\n hasbetterobj = 1;\n }\n else if( (ismini && pb - refobj > +0.01 * max(max(abs(refobj), abs(pb)), 1.0)) ||\n (ismaxi && pb - refobj < -0.01 * max(max(abs(refobj), abs(pb)), 1.0)) )\n worseobj[s,cat]++;\n thisscore = reftime\/time[s,pidx];\n thisscore = max(thisscore, 1\/maxscore);\n thisscore = min(thisscore, maxscore);\n score[s,cat] = score[s,cat]^((nep-1)\/nep) * thisscore^(1.0\/nep);\n }\n }\n s = printorder[0];\n besttimegeom = besttimegeom^((nevalprobs[s,0]-1)\/nevalprobs[s,0]) * besttime^(1.0\/nevalprobs[s,0]);\n bestnodegeom = bestnodegeom^((nevalprobs[s,0]-1)\/nevalprobs[s,0]) * bestnodes^(1.0\/nevalprobs[s,0]);\n besttimeshiftedgeom = besttimeshiftedgeom^((nevalprobs[s,0]-1)\/nevalprobs[s,0]) * (besttime+timegeomshift)^(1.0\/nevalprobs[s,0]);\n bestnodeshiftedgeom = bestnodeshiftedgeom^((nevalprobs[s,0]-1)\/nevalprobs[s,0]) * (bestnodes+nodegeomshift)^(1.0\/nevalprobs[s,0]);\n if( hasbetter )\n bestbetter++;\n if( hasbetterobj )\n bestbetterobj++;\n\n # once again for the case in which all instances have been solved to optimality\n if ( notimeout )\n {\n for( s = 0; s < nsolver; ++s )\n {\n pidx = probidx[p,s];\n cat = -1;\n nevalprobs[s,cat]++;\n nep = nevalprobs[s,cat];\n timetotal[s,cat] += time[s,pidx];\n nodetotal[s,cat] += nodes[s,pidx];\n timegeom[s,cat] = timegeom[s,cat]^((nep-1)\/nep) * time[s,pidx]^(1.0\/nep);\n nodegeom[s,cat] = nodegeom[s,cat]^((nep-1)\/nep) * nodes[s,pidx]^(1.0\/nep);\n timeshiftedgeom[s,cat] = timeshiftedgeom[s,cat]^((nep-1)\/nep) * (time[s,pidx]+timegeomshift)^(1.0\/nep);\n nodeshiftedgeom[s,cat] = nodeshiftedgeom[s,cat]^((nep-1)\/nep) * (nodes[s,pidx]+nodegeomshift)^(1.0\/nep);\n reftimetotal[s,cat] += reftime;\n refnodetotal[s,cat] += refnodes;\n reftimegeom[s,cat] = reftimegeom[s,cat]^((nep-1)\/nep) * reftime^(1.0\/nep);\n refnodegeom[s,cat] = refnodegeom[s,cat]^((nep-1)\/nep) * refnodes^(1.0\/nep);\n reftimeshiftedgeom[s,cat] = reftimeshiftedgeom[s,cat]^((nep-1)\/nep) * (reftime+timegeomshift)^(1.0\/nep);\n refnodeshiftedgeom[s,cat] = refnodeshiftedgeom[s,cat]^((nep-1)\/nep) * (refnodes+nodegeomshift)^(1.0\/nep);\n if( time[s,pidx] <= wintolerance*besttime )\n wins[s,cat]++;\n if( isfaster(time[s,pidx], reftime, wintolerance) )\n better[s,cat]++;\n else if( isslower(time[s,pidx], reftime, wintolerance) )\n worse[s,cat]++;\n pb = primalbound[s,pidx];\n if( (ismini && pb - refobj < -0.01 * max(max(abs(refobj), abs(pb)), 1.0)) ||\n (ismaxi && pb - refobj > +0.01 * max(max(abs(refobj), abs(pb)), 1.0)) ) {\n betterobj[s,cat]++;\n }\n else if( (ismini && pb - refobj > +0.01 * max(max(abs(refobj), abs(pb)), 1.0)) ||\n (ismaxi && pb - refobj < -0.01 * max(max(abs(refobj), abs(pb)), 1.0)) )\n worseobj[s,cat]++;\n thisscore = reftime\/time[s,pidx];\n thisscore = max(thisscore, 1\/maxscore);\n thisscore = min(thisscore, maxscore);\n score[s,cat] = score[s,cat]^((nep-1)\/nep) * thisscore^(1.0\/nep);\n }\n }\n }\n }\n printhline(nsolver,short, printsoltimes);\n\n # make sure total time and nodes is not zero\n for( s = 0; s < nsolver; ++s )\n {\n for( cat = -1; cat <= 3; cat++ )\n {\n nodetotal[s,cat] = max(nodetotal[s,cat], 1);\n refnodetotal[s,cat] = max(refnodetotal[s,cat], 1);\n timetotal[s,cat] = max(timetotal[s,cat], mintime);\n reftimetotal[s,cat] = max(reftimetotal[s,cat], mintime);\n }\n }\n\n # print solvers' overall statistics\n probnumstr = \"(\"nevalprobs[printorder[0],0]\")\";\n printf(\"%-24s %5s\", \"total\", probnumstr);\n for( o = 0; o < nsolver; ++o )\n {\n s = printorder[o];\n if( o == 0 || short )\n {\n printf(\" %11d %8d\", nodetotal[s,0], timetotal[s,0]);\n if( o == 0 && printsoltimes )\n printf(\" %9d %8d\" , timetofirsttotal[s,0], timetobesttotal[s,0]);\n }\n else\n {\n printf(\" %11d %8d \", nodetotal[s,0], timetotal[s,0]);\n if( printsoltimes )\n {\n referencesolvername = printorder[0];\n comptimetofirst = timetofirsttotal[s,0]\/(max(timetofirsttotal[referencesolvername,0], 1));\n comptimetobest = timetobesttotal[s,0]\/(max(timetobesttotal[referencesolvername,0], 1));\n printf(\"%7.2f %6.2f\", comptimetofirst, comptimetobest);\n }\n }\n }\n printf(\"\\n\");\n printf(\"%-30s\", \"geom. mean\");\n nodegeomcomp = -1;\n timegeomcomp = -1;\n nodetotalcomp = -1;\n timetotalcomp = -1;\n timetofirstcomp = -1;\n timetobestcomp = -1;\n timetofirstgeomcomp = -1;\n timetobestgeomcomp = -1;\n\n for( o = 0; o < nsolver; ++o )\n {\n s = printorder[o];\n if( o == 0 || short )\n {\n printf(\" %11d %8.1f\", nodegeom[s,0], timegeom[s,0]);\n if( o == 0 && printsoltimes )\n printf(\" %9.1f %8.1f\", timetofirstgeom[s,0], timetobestgeom[s,0]);\n\n if( nodegeomcomp < 0 )\n nodegeomcomp = nodegeom[s,0];\n if( timegeomcomp < 0 )\n timegeomcomp = timegeom[s,0];\n if( nodetotalcomp < 0 )\n nodetotalcomp = nodetotal[s,0];\n if( timetotalcomp < 0 )\n timetotalcomp = timetotal[s,0];\n if( timetofirstcomp < 0 )\n timetofirstcomp = timetofirsttotal[s,0];\n if( timetobestcomp < 0 )\n timetobestcomp = timetobesttotal[s,0];\n if( timetofirstgeomcomp < 0 )\n timetofirstgeomcomp = timetofirstgeom[s,0];\n if( timetobestgeomcomp < 0 )\n timetobestgeomcomp = timetobestgeom[s,0];\n }\n else\n {\n printf(\" %11d %8.1f %6.2f %6.2f\", nodegeom[s,0], timegeom[s,0], nodegeom[s,0]\/nodegeomcomp, timegeom[s,0]\/timegeomcomp);\n\n if( printsoltimes )\n printf(\" %6.2f %6.2f\", timetofirstgeom[s,0]\/timetofirstgeomcomp, timetobestgeom[s,0]\/timetobestgeomcomp);\n }\n }\n printf(\"\\n\");\n printf(\"%-30s\", \"shifted geom.\");\n nodeshiftedgeomcomp = -1;\n timeshiftedgeomcomp = -1;\n timetofirstshiftedgeomcomp = -1;\n timetobestshiftedgeomcomp = -1;\n for( o = 0; o < nsolver; ++o )\n {\n s = printorder[o];\n for( cat = -1; cat <= 3; cat++ )\n {\n nodeshiftedgeom[s,cat] -= nodegeomshift;\n timeshiftedgeom[s,cat] -= timegeomshift;\n timetofirstshiftedgeom[s,cat] -= timegeomshift;\n timetobestshiftedgeom[s,cat] -= timegeomshift;\n nodeshiftedgeom[s,cat] = max(nodeshiftedgeom[s,cat], 1);\n timeshiftedgeom[s,cat] = max(timeshiftedgeom[s,cat], mintime);\n timetofirstshiftedgeom[s,cat] = max(timetofirstshiftedgeom[s,cat], mintime);\n timetobestshiftedgeom[s,cat] = max(timetobestshiftedgeom[s,cat], mintime);\n refnodeshiftedgeom[s,cat] -= nodegeomshift;\n reftimeshiftedgeom[s,cat] -= timegeomshift;\n refnodeshiftedgeom[s,cat] = max(refnodeshiftedgeom[s,cat], mintime);\n reftimeshiftedgeom[s,cat] = max(reftimeshiftedgeom[s,cat], mintime);\n }\n if( o == 0 || short )\n {\n printf(\" %11d %8.1f\", nodeshiftedgeom[s,0], timeshiftedgeom[s,0]);\n\n if( o == 0 && printsoltimes )\n printf(\" %9.1f %8.1f\", timetofirstshiftedgeom[s,0], timetobestshiftedgeom[s,0]);\n\n if( nodeshiftedgeomcomp < 0 )\n nodeshiftedgeomcomp = nodeshiftedgeom[s,0];\n if( timeshiftedgeomcomp < 0 )\n timeshiftedgeomcomp = timeshiftedgeom[s,0];\n if( timetofirstshiftedgeomcomp < 0 )\n timetofirstshiftedgeomcomp = timetofirstshiftedgeom[s,0];\n if( timetobestshiftedgeomcomp < 0 )\n timetobestshiftedgeomcomp = timetobestshiftedgeom[s,0];\n }\n else\n {\n printf(\" %11d %8.1f %6.2f %6.2f\", nodeshiftedgeom[s,0], timeshiftedgeom[s,0],\n nodeshiftedgeom[s,0]\/nodeshiftedgeomcomp, timeshiftedgeom[s,0]\/timeshiftedgeomcomp);\n\n if( printsoltimes )\n printf(\" %6.2f %6.2f\", timetofirstshiftedgeom[s,0]\/timetofirstshiftedgeomcomp, timetobestshiftedgeom[s,0]\/timetobestshiftedgeomcomp);\n }\n }\n bestnodeshiftedgeom -= nodegeomshift;\n besttimeshiftedgeom -= timegeomshift;\n bestnodeshiftedgeom = max(bestnodeshiftedgeom, 1.0);\n besttimeshiftedgeom = max(besttimeshiftedgeom, 1.0);\n\n printf(\"\\n\");\n printhline(nsolver,short, printsoltimes);\n\n # compute and print result for McNemar test to \"solution found?\" w.r.t. reference setting\n printf(\"%-30s \",\"McNemar (feas)\");\n printf(\"%-18s \",\" \");\n for( o = 1; o < nsolver; ++o )\n {\n # copy two-indexed arrays to one-indexed arrays\n for( i = 0; i < problistlen; ++i )\n {\n s = printorder[o];\n ref_array[i] = solfound[printorder[0],i];\n solver_array[i] = solfound[s,i];\n }\n\n # compute chi-squared value and convert to p-value\n chi_squared = mcnemar(ref_array, solver_array, problistlen);\n printf(\" x2 %7.4f\",chi_squared);\n chi_to_p(chi_squared);\n }\n printf(\"\\n\");\n\n # compute and print result for McNemar test to \"optimality proven?\" w.r.t. reference setting\n printf(\"%-30s \",\"McNemar (opt)\");\n printf(\"%-18s \",\" \");\n for( o = 1; o < nsolver; ++o )\n {\n # copy two-indexed arrays to one-indexed arrays\n for( i = 0; i < problistlen; ++i )\n {\n s = printorder[o];\n ref_array[i] = optproven[printorder[0],i];\n solver_array[i] = optproven[s,i];\n }\n\n # compute chi-squared value and convert to p-value\n chi_squared = mcnemar(ref_array, solver_array, problistlen);\n printf(\" x2 %7.4f\",chi_squared);\n chi_to_p(chi_squared);\n }\n printf(\"\\n\");\n\n # compute and print result for Wilcoxon signed rank test for time to optimality w.r.t. reference setting\n printf(\"%-30s \",\"Wilcoxon (time)\");\n printf(\"%-18s \",\" \");\n for( o = 1; o < nsolver; ++o )\n {\n s = printorder[o];\n\n parse_time(ref_array,solver_array,time,o,printorder,probidx,problistlen);\n n = filter(ref_array, solver_array, problistlen, 0.01, 0.01);\n factorize(ref_array, solver_array, n, timelimit[s])\n\n z = wilcoxon(ref_array, solver_array, n, timelimit[s]);\n printf(\" z %8.4f\",z);\n z_to_p(z);\n }\n printf(\"\\n\");\n\n\n # compute and print result for Wilcoxon signed rank test for time to first solution w.r.t. reference setting\n if( printsoltimes )\n {\n printf(\"%-30s \",\"Wilcoxon (first)\");\n printf(\"%-18s \",\" \");\n for( o = 1; o < nsolver; ++o )\n {\n s = printorder[o];\n\n parse_time(ref_array,solver_array,timetofirst,o,printorder,probidx,problistlen);\n n = filter(ref_array, solver_array, problistlen, 0.01, 0.01);\n factorize(ref_array, solver_array, n, timelimit[s])\n\n z = wilcoxon(ref_array, solver_array, n, timelimit[s]);\n printf(\" z %8.4f\",z);\n z_to_p(z);\n }\n printf(\"\\n\");\n }\n\n # compute and print result for Wilcoxon signed rank test for number of nodes w.r.t. reference setting\n printf(\"%-30s \",\"Wilcoxon (nodes)\");\n printf(\"%-18s \",\" \");\n for( o = 1; o < nsolver; ++o )\n {\n parse_nodes(ref_array,solver_array,nodes,o,probidx,problistlen,status,infinity);\n n = filter(ref_array, solver_array, problistlen, 0.01, 0.01);\n factorize(ref_array, solver_array, n, infinity)\n\n z = wilcoxon(ref_array, solver_array, n, infinity);\n printf(\" z %8.4f\",z);\n z_to_p(z);\n }\n printf(\"\\n\");\n\n\n\n #since the rows of the quotients are not printed, print the quotients of the geometric means\n if( short )\n {\n printf(\"quot. geom. mean \");\n for( o = 0; o < nsolver; ++o )\n {\n if( o > 0 )\n {\n s = printorder[o];\n printf(\" %6.2f %6.2f\",nodegeom[s,0]\/nodegeomcomp, timegeom[s,0]\/timegeomcomp);\n }\n }\n printf(\"\\n\");\n printf(\"quot. sh. geom. mean \");\n for( o = 0; o < nsolver; ++o )\n {\n if( o > 0 )\n {\n s = printorder[o];\n printf(\" %6.2f %6.2f\",nodeshiftedgeom[s,0]\/nodeshiftedgeomcomp, timeshiftedgeom[s,0]\/timeshiftedgeomcomp);\n }\n }\n printf(\"\\n\");\n printf(\"percent not solved \");\n for( o = 0; o < nsolver; ++o )\n {\n s = printorder[o];\n printf(\"%6.2f\",100-100*nsolved[s,0]\/nprocessedprobs[s,0]);\n printf(\" \");\n }\n printf(\"\\n\");\n }\n printhline(nsolver,short, printsoltimes);\n\n # tex comparison footer\n if( texcmpfile != \"\" )\n {\n # all problems\n printf(\"\\\\midrule\\n\") > texcmpfile;\n printf(\"geom. mean \") > texcmpfile;\n for( o = 0; o < nsolver; ++o )\n {\n s = printorder[o];\n printf(\"& %8s & %8.1f\", texint(nodegeom[s,0]), timegeom[s,0]) > texcmpfile;\n }\n printf(\"\\\\\\\\\\n\") > texcmpfile;\n printf(\"sh. geom. mean \") > texcmpfile;\n for( o = 0; o < nsolver; ++o )\n {\n s = printorder[o];\n printf(\"& %8s & %8.1f\", texint(nodeshiftedgeom[s,0]), timeshiftedgeom[s,0]) > texcmpfile;\n }\n printf(\"\\\\\\\\\\n\") > texcmpfile;\n printf(\"arithm. mean \") > texcmpfile;\n for( o = 0; o < nsolver; ++o )\n {\n s = printorder[o];\n printf(\"& %8s & %8.1f\", texint(nodetotal[s,0]\/max(1,nevalprobs[s,0])), timetotal[s,0]\/max(1,nevalprobs[s,0])) > texcmpfile;\n }\n printf(\"\\\\\\\\\\n\") > texcmpfile;\n\n # add statistics for problems solved to optimality\n printf(\"\\\\midrule\\n\") > texcmpfile;\n printf(\"\\\\multicolumn{%d}{@{}l}{all optimal}\\\\\\\\\\n\", 1 + 2 * nsolver) > texcmpfile;\n printf(\"geom. mean \") > texcmpfile;\n for( o = 0; o < nsolver; ++o )\n {\n s = printorder[o];\n printf(\"& %8s & %8.1f\", texint(nodegeom[s,-1]), timegeom[s,-1]) > texcmpfile;\n }\n printf(\"\\\\\\\\\\n\") > texcmpfile;\n printf(\"sh. geom. mean \") > texcmpfile;\n for( o = 0; o < nsolver; ++o )\n {\n s = printorder[o];\n printf(\"& %8s & %8.1f\", texint(nodeshiftedgeom[s,-1]), timeshiftedgeom[s,-1]) > texcmpfile;\n }\n printf(\"\\\\\\\\\\n\") > texcmpfile;\n printf(\"arithm. mean \") > texcmpfile;\n for( o = 0; o < nsolver; ++o )\n {\n s = printorder[o];\n printf(\"& %8s & %8.1f\", texint(nodetotal[s,-1]\/max(1,nevalprobs[s,-1])), timetotal[s,-1]\/max(1,nevalprobs[s,-1])) > texcmpfile;\n }\n printf(\"\\\\\\\\\\n\") > texcmpfile;\n printf(\"\\\\bottomrule\\n\") > texcmpfile;\n printf(\"\\\\end{tabular*}\\n\") > texcmpfile;\n printf(\"}\\n\") > texcmpfile;\n }\n\n if( !short )\n {\n for( cat = 0; cat <= 3; cat++ )\n {\n# if( nprocessedprobs[cat] == 0 )\n# continue;\n\n header = (cat == -1 ? \"optimal\" : (cat == 0 ? \"all\" : (cat == 1 ? \"diff\" : (cat == 2 ? \"equal\" : \"timeout\"))));\n printf(\"\\n\");\n printf(\"%-7s proc eval fail time solv wins bett wors bobj wobj feas gnodes shnodes gnodesQ shnodesQ gtime shtime gtimeQ shtimeQ score\\n\",\n header);\n\n for( o = 0; o < nsolver; ++o )\n {\n s = printorder[o];\n sname = solvername[s];\n if( o == 0 )\n {\n nodegeomcomp = nodegeom[s,cat];\n timegeomcomp = timegeom[s,cat];\n nodeshiftedgeomcomp = nodeshiftedgeom[s,cat];\n timeshiftedgeomcomp = timeshiftedgeom[s,cat];\n }\n if( (o > 0 || cat == 0 || cat == -1) && nevalprobs[s,cat] > 0 )\n {\n if ( length(sname) <= 50 )\n printf(\"%-50s %4d %4d %4d %4d %4d %4d\", sname, nprocessedprobs[s,cat], nevalprobs[s,cat], nfails[s,cat],\n ntimeouts[s,cat], nsolved[s,cat], wins[s,cat]);\n else\n printf(\"*%-49s %4d %4d %4d %4d %4d %4d\", substr(sname, length(sname)-48), nprocessedprobs[s,cat], nevalprobs[s,cat], nfails[s,cat],\n ntimeouts[s,cat], nsolved[s,cat], wins[s,cat]);\n\n printf(\" %4d %4d\", better[s,cat], worse[s,cat]);\n printf(\" %4d %4d %4d %9d %9d %9.2f %9.2f %7.1f %7.1f %7.2f %7.2f %7.2f\\n\",\n betterobj[s,cat], worseobj[s,cat], feasibles[s,cat],\n nodegeom[s,cat], nodeshiftedgeom[s,cat], nodegeom[s,cat]\/refnodegeom[s,cat],\n nodeshiftedgeom[s,cat]\/refnodeshiftedgeom[s,cat],\n timegeom[s,cat], timeshiftedgeom[s,cat], timegeom[s,cat]\/reftimegeom[s,cat],\n timeshiftedgeom[s,cat]\/reftimeshiftedgeom[s,cat], score[s,cat]);\n }\n }\n if( cat == 0 )\n {\n printf(\"%-50s %4d %4d %4d %4s\", \"optimal auto settings\", bestnfails, bestntimeouts, bestnsolved, \"\");\n printf(\" %4d %4s\", bestbetter, \"\");\n printf(\" %4d %4s %4d %9d %9d %9.2f %9.2f %7.1f %7.1f %7.2f %7.2f %7s\\n\",\n bestbetterobj, \"\", bestfeasibles,\n bestnodegeom, bestnodeshiftedgeom, bestnodegeom\/nodegeomcomp, bestnodeshiftedgeom\/nodeshiftedgeomcomp,\n besttimegeom, besttimeshiftedgeom, besttimegeom\/timegeomcomp, besttimeshiftedgeom\/timeshiftedgeomcomp,\n \"\");\n }\n }\n\n # output the all optimal case\n header = \"all optimal\";\n printf(\"\\n\");\n printf(\"%-11s proc eval fail time solv wins bett wors bobj wobj feas gnodes shnodes gnodesQ shnodesQ gtime shtime gtimeQ shtimeQ score\\n\", header);\n cat = -1;\n for( o = 0; o < nsolver; ++o )\n {\n s = printorder[o];\n sname = solvername[s];\n if( o == 0 )\n {\n nodegeomcomp = nodegeom[s,cat];\n timegeomcomp = timegeom[s,cat];\n nodeshiftedgeomcomp = nodeshiftedgeom[s,cat];\n timeshiftedgeomcomp = timeshiftedgeom[s,cat];\n }\n if( (o > 0 || cat == 0 || cat == -1) && nevalprobs[s,cat] > 0 )\n {\n if ( length(sname) <= 50 )\n printf(\"%-50s %4d %4d %4d %4d %4d %4d\", sname, nprocessedprobs[s,cat], nevalprobs[s,cat], nfails[s,cat],\n ntimeouts[s,cat], nsolved[s,cat], wins[s,cat]);\n else\n printf(\"*%-49s %4d %4d %4d %4d %4d %4d\", substr(sname, length(sname)-48), nprocessedprobs[s,cat], nevalprobs[s,cat], nfails[s,cat],\n ntimeouts[s,cat], nsolved[s,cat], wins[s,cat]);\n printf(\" %4d %4d\", better[s,cat], worse[s,cat]);\n printf(\" %4d %4d %4d %9d %9d %9.2f %9.2f %7.1f %7.1f %7.2f %7.2f %7.2f\\n\",\n betterobj[s,cat], worseobj[s,cat], feasibles[s,cat],\n nodegeom[s,cat], nodeshiftedgeom[s,cat], nodegeom[s,cat]\/refnodegeom[s,cat],\n nodeshiftedgeom[s,cat]\/refnodeshiftedgeom[s,cat],\n timegeom[s,cat], timeshiftedgeom[s,cat], timegeom[s,cat]\/reftimegeom[s,cat],\n timeshiftedgeom[s,cat]\/reftimeshiftedgeom[s,cat], score[s,cat]);\n }\n }\n if( cat == 0 )\n {\n printf(\"%-50s %4d %4d %4d %4s\", \"optimal auto settings\", bestnfails, bestntimeouts, bestnsolved, \"\");\n printf(\" %4d %4s\", bestbetter, \"\");\n printf(\" %4d %4s %4d %9d %9d %9.2f %9.2f %7.1f %7.1f %7.2f %7.2f %7s\\n\",\n bestbetterobj, \"\", bestfeasibles,\n bestnodegeom, bestnodeshiftedgeom, bestnodegeom\/nodegeomcomp, bestnodeshiftedgeom\/nodeshiftedgeomcomp,\n besttimegeom, besttimeshiftedgeom, besttimegeom\/timegeomcomp, besttimeshiftedgeom\/timeshiftedgeomcomp,\n \"\");\n }\n }\n\n printf(\"\\n\");\n printf(\"total time over all settings: %.1f sec = %.1f hours = %.1f days = %.1f weeks = %.1f months\\n\",\n fulltotaltime, fulltotaltime\/3600.0, fulltotaltime\/(3600.0*24), fulltotaltime\/(3600.0*24*7),\n fulltotaltime\/(3600.0*24*30));\n\n # generate tex file\n if( texfile != \"\" )\n {\n hasequalpath = 0;\n for( o = 0; o < nsolver; ++o )\n {\n if( nevalprobs[s,2] > 0 )\n {\n hasequalpath = 1;\n break;\n }\n }\n\n printf(\"generating tex file <%s>\\n\", texfile);\n printf(\"{\\\\sffamily\\n\") > texfile;\n printf(\"\\\\scriptsize\\n\") > texfile;\n printf(\"\\\\setlength{\\\\extrarowheight}{1pt}\\n\") > texfile;\n printf(\"\\\\setlength{\\\\tabcolsep}{2pt}\\n\") > texfile;\n printf(\"\\\\newcommand{\\\\spc}{\\\\hspace{%dem}}\\n\", 2-hasequalpath) > texfile;\n\n printf(\"\\\\begin{tabular*}{\\\\columnwidth}{@{\\\\extracolsep{\\\\fill}}lrrr@{\\\\spc}rrrrrr@{\\\\spc}rrrr\") > texfile;\n if( hasequalpath )\n printf(\"@{\\\\spc}rrrr\") > texfile;\n printf(\"@{}}\\n\") > texfile;\n\n printf(\"\\\\toprule\\n\") > texfile;\n\n printf(\"& & & & \\\\multicolumn{6}{c@{\\\\spc}}{all instances (%d)} & \\\\multicolumn{4}{c@{\\\\spc}}{different path}\",\n nevalprobs[printorder[0],0]) > texfile;\n if( hasequalpath )\n printf(\"& \\\\multicolumn{4}{c}{equal path}\") > texfile;\n printf(\"\\\\\\\\\\n\") > texfile;\n\n printf(\"setting & T & fst & slw & $\\\\textit{n}_\\\\textit{gm}$ & $\\\\textit{n}_\\\\textit{sgm}$ & $\\\\textit{n}_\\\\textit{tot}$ & $\\\\textit{t}_\\\\textit{gm}$ & $\\\\textit{t}_\\\\textit{sgm}$ & $\\\\textit{t}_\\\\textit{tot}$ & \\\\# & $\\\\textit{t}_\\\\textit{gm}$ & $\\\\textit{t}_\\\\textit{sgm}$ & $\\\\textit{t}_\\\\textit{tot}$\") > texfile;\n if( hasequalpath )\n printf(\"& \\\\# & $\\\\textit{t}_\\\\textit{gm}$ & $\\\\textit{t}_\\\\textit{sgm}$ & $\\\\textit{t}_\\\\textit{tot}$\") > texfile;\n printf(\"\\\\\\\\\\n\") > texfile;\n\n printf(\"\\\\midrule\\n\") > texfile;\n\n for( o = 0; o < nsolver; ++o )\n {\n s = printorder[o];\n printf(\"%-45s & %4d & %3d & %3d\", texsolvername(s), ntimeouts[s,0], better[s,0], worse[s,0]) > texfile;\n printf(\" & %5s & %5s & %5s & %5s & %5s & %5s\",\n texcompstr(nodegeom[s,0], refnodegeom[s,0]),\n texcompstr(nodeshiftedgeom[s,0], refnodeshiftedgeom[s,0]),\n texcompstr(nodetotal[s,0], refnodetotal[s,0]),\n texcompstr(timegeom[s,0], reftimegeom[s,0]),\n texcompstr(timeshiftedgeom[s,0], reftimeshiftedgeom[s,0]),\n texcompstr(timetotal[s,0], reftimetotal[s,0])) > texfile;\n if( nevalprobs[s,1] > 0 )\n {\n printf(\" & %2d & %5s & %5s & %5s\",\n nevalprobs[s,1],\n texcompstr(timegeom[s,1], reftimegeom[s,1]),\n texcompstr(timeshiftedgeom[s,1], reftimeshiftedgeom[s,1]),\n texcompstr(timetotal[s,1], reftimetotal[s,1])) > texfile;\n }\n else\n printf(\" & 0 & --- & --- & ---\") > texfile;\n if( hasequalpath )\n {\n if( nevalprobs[s,2] > 0 )\n {\n printf(\" & %2d & %5s & %5s & %5s\",\n nevalprobs[s,2],\n texcompstr(timegeom[s,2], reftimegeom[s,2]),\n texcompstr(timeshiftedgeom[s,2], reftimeshiftedgeom[s,2]),\n texcompstr(timetotal[s,2], reftimetotal[s,2])) > texfile;\n }\n else\n printf(\" & 0 & --- & --- & ---\") > texfile;\n }\n printf(\" \\\\\\\\\\n\") > texfile;\n }\n\n printf(\"\\\\bottomrule\\n\") > texfile;\n printf(\"\\\\end{tabular*}\\n\") > texfile;\n printf(\"}\\n\") > texfile;\n\n # extend tex include file\n if( texincfile != \"\" )\n {\n n = split(texfile, a, \"\/\");\n texpath = \"\";\n for( i = 1; i < n; i++ )\n texpath = texpath a[i] \"\/\";\n texbase = a[n];\n sub(\/\\.tex\/, \"\", texbase);\n n = split(texbase, a, \"_\");\n texsetname = a[2];\n texgroupname = a[3];\n textestname = a[4];\n\n printf(\"\\n\") >> texincfile;\n printf(\"\\\\begin{table}[hp]\\n\") > texincfile;\n printf(\"\\\\input{Tables\/mip\/auto\/%s}\\n\", texbase) > texincfile;\n printf(\"\\\\smalltabcaption{\\\\label{table_%s_%s_%s}\\n\", texsetname, texgroupname, textestname) > texincfile;\n printf(\"Evaluation of \\\\setting%s%s on test set \\\\testset{%s}.}\\n\", texsetname, texgroupname, textestname) > texincfile;\n printf(\"\\\\end{table}\\n\") > texincfile;\n printf(\"\\n\") > texincfile;\n }\n }\n\n # generate (or extend) tex summary file\n if( texsummaryfile != \"\" )\n {\n n = split(texsummaryfile, a, \"\/\");\n texsummarypath = \"\";\n for( i = 1; i < n; i++ )\n texsummarypath = texsummarypath a[i] \"\/\";\n texsummarybase = a[n];\n sub(\/\\.tex\/, \"\", texsummarybase);\n texsummaryfiletime = texsummarypath texsummarybase \"_time.tex\";\n texsummaryfilenodes = texsummarypath texsummarybase \"_nodes.tex\";\n if( texsummaryheader > 0 )\n {\n printf(\"{\\\\sffamily\\n\") > texsummaryfile;\n printf(\"\\\\scriptsize\\n\") > texsummaryfile;\n printf(\"\\\\setlength{\\\\extrarowheight}{1pt}\\n\") > texsummaryfile;\n printf(\"\\\\setlength{\\\\tabcolsep}{2pt}\\n\") > texsummaryfile;\n printf(\"\\\\newcommand{\\\\spc}{\\\\hspace{1em}}\\n\") > texsummaryfile;\n for( si = 0; si <= 2; si++ )\n {\n printf(\"\\\\ifthenelse{\\\\summaryinfo = %d}{\\n\", si) > texsummaryfile;\n printf(\"\\\\begin{tabular*}{\\\\columnwidth}{@{}ll@{\\\\extracolsep{\\\\fill}}\") > texsummaryfile;\n for( o = 1; o < nsolver; o++ )\n printf(\"r\") > texsummaryfile;\n printf(\"@{}}\\n\") > texsummaryfile;\n printf(\"\\\\toprule\\n\") > texsummaryfile;\n printf(\"& test set\") > texsummaryfile;\n if( nsolver >= 9 )\n {\n for( o = 1; o < nsolver; o++ )\n printf(\" & %s\", texsolvername(printorder[o])) > texsummaryfile;\n }\n else\n {\n for( o = 1; o < nsolver; o++ )\n printf(\" & \\\\makebox[0em][r]{%s}\", texsolvername(printorder[o])) > texsummaryfile;\n }\n printf(\" \\\\\\\\\\n\") > texsummaryfile;\n if( si == 0 || si == 1 )\n {\n printf(\"\\\\midrule\\n\") > texsummaryfile;\n printf(\"\\\\input{Tables\/mip\/auto\/%s_time}\\n\", texsummarybase) > texsummaryfile;\n }\n if( si == 0 || si == 2 )\n {\n printf(\"\\\\midrule\\n\") > texsummaryfile;\n printf(\"\\\\input{Tables\/mip\/auto\/%s_nodes}\\n\", texsummarybase) > texsummaryfile;\n }\n printf(\"\\\\bottomrule\\n\") >> texsummaryfile;\n printf(\"\\\\end{tabular*}\\n\") >> texsummaryfile;\n printf(\"}{}\\n\") >> texsummaryfile;\n }\n printf(\"}\\n\") > texsummaryfile;\n printf(\"\\\\raisebox{-%.1fex}[0em][0em]{\\\\rotatebox{90}{\\\\makebox[3em]{time}}}\",\n 1.5*(texsummaryheader+1)) > texsummaryfiletime;\n printf(\"\\\\raisebox{-%.1fex}[0em][0em]{\\\\rotatebox{90}{\\\\makebox[3em]{nodes}}}\",\n 1.5*(texsummaryheader+1)) > texsummaryfilenodes;\n }\n printf(\"& \\\\testset{%s}\", textestset) >> texsummaryfiletime;\n for( o = 1; o < nsolver; o++ )\n {\n s = printorder[o];\n if( texsummaryshifted )\n printf(\" & %s\", texcompstr(timeshiftedgeom[s,0], reftimeshiftedgeom[s,0])) > texsummaryfiletime;\n else\n printf(\" & %s\", texcompstr(timegeom[s,0], reftimegeom[s,0])) > texsummaryfiletime;\n }\n printf(\"\\\\\\\\\\n\") > texsummaryfiletime;\n printf(\"& \\\\testset{%s}\", textestset) >> texsummaryfilenodes;\n for( o = 1; o < nsolver; o++ )\n {\n s = printorder[o];\n if( texsummaryshifted )\n printf(\" & %s\", texcompstr(nodeshiftedgeom[s,0], refnodeshiftedgeom[s,0])) > texsummaryfilenodes;\n else\n printf(\" & %s\", texcompstr(nodegeom[s,0], refnodegeom[s,0])) > texsummaryfilenodes;\n }\n printf(\"\\\\\\\\\\n\") > texsummaryfilenodes;\n\n # add tex comment to summary file which is later be used to generate overall statistics\n for( o = 1; o < nsolver; o++ )\n {\n s = printorder[o];\n weight = (texsummaryweight == 0 ? nevalprobs[s,0] : texsummaryweight);\n if( texsummaryshifted )\n printf(\"%% =mean= %s %.4f %.4f %g\\n\", solvername[s],\n timeshiftedgeom[s,0]\/reftimeshiftedgeom[s,0], nodeshiftedgeom[s,0]\/refnodeshiftedgeom[s,0],\n weight) >> texsummaryfile;\n else\n printf(\"%% =mean= %s %.4f %.4f %g\\n\", solvername[s],\n timegeom[s,0]\/reftimegeom[s,0], nodegeom[s,0]\/refnodegeom[s,0], weight) >> texsummaryfile;\n }\n }\n\n if( diagramfile != \"\" )\n {\n refsolver = 0;\n mintime = timeshiftedgeom[0,0];\n maxtime = timeshiftedgeom[0,0];\n for( s = 0; s < nsolver; ++s )\n {\n if( substr(solvername[s], 1, 4) == \"SCIP\" )\n refsolver = s;\n\n if( timeshiftedgeom[s,0] < mintime )\n mintime = timeshiftedgeom[s,0];\n else if( timeshiftedgeom[s,0] > mintime )\n maxtime = timeshiftedgeom[s,0];\n }\n # bound, over which solvers get cut off\n upperbound = diagramnsteps*timeshiftedgeom[refsolver,0];\n\n yscale = 3000\/upperbound;\n\n printf(\"\\\\documentclass{article}\\n\\\\usepackage{tikz}\\n\\\\pagestyle{empty}\\n\\\\begin{document}\\n\\n\") > diagramfile;\n\n printf(\"\\\\definecolor{c1}{HTML}{000060}\\n\") > diagramfile;\n printf(\"\\\\definecolor{c2}{HTML}{0000FF}\\n\") > diagramfile;\n printf(\"\\\\definecolor{c3}{HTML}{36648B}\\n\") > diagramfile;\n printf(\"\\\\definecolor{c4}{HTML}{4682B4}\\n\") > diagramfile;\n printf(\"\\\\definecolor{c5}{HTML}{5CACEE}\\n\") > diagramfile;\n printf(\"\\\\definecolor{c6}{HTML}{00FFFF}\\n\") > diagramfile;\n #printf(\"\\\\definecolor{c7}{HTML}{A0FFFF}\\n\") > diagramfile;\n printf(\"\\\\definecolor{c7}{HTML}{008888}\\n\") > diagramfile;\n printf(\"\\\\definecolor{c8}{HTML}{00DD99}\\n\") > diagramfile;\n printf(\"\\\\definecolor{c9}{HTML}{527B10}\\n\") > diagramfile;\n printf(\"\\\\definecolor{c10}{HTML}{7BC618}\\n\") > diagramfile;\n printf(\"\\\\definecolor{c11}{HTML}{A00060}\\n\") > diagramfile;\n printf(\"\\\\definecolor{c12}{HTML}{A000FF}\\n\") > diagramfile;\n printf(\"\\\\definecolor{c13}{HTML}{E6648B}\\n\") > diagramfile;\n printf(\"\\\\definecolor{c14}{HTML}{F682B4}\\n\") > diagramfile;\n printf(\"\\\\definecolor{c15}{HTML}{DCACEE}\\n\") > diagramfile;\n printf(\"\\\\definecolor{c16}{HTML}{A0FFFF}\\n\") > diagramfile;\n #printf(\"\\\\definecolor{c7}{HTML}{A0FFFF}\\n\") > diagramfile;\n printf(\"\\\\definecolor{c17}{HTML}{A08888}\\n\") > diagramfile;\n printf(\"\\\\definecolor{c18}{HTML}{A0DD99}\\n\") > diagramfile;\n printf(\"\\\\definecolor{c19}{HTML}{D27B10}\\n\") > diagramfile;\n printf(\"\\\\definecolor{c20}{HTML}{FBC618}\\n\") > diagramfile;\n\n printf(\"\\\\definecolor{darkgreen}{HTML}{006600}\\n\") > diagramfile;\n if( diagramyellowbg )\n printf(\"\\\\definecolor{background}{HTML}{FFFFE6}\\n\\n\") > diagramfile;\n else\n printf(\"\\\\definecolor{background}{HTML}{FFFFFF}\\n\\n\") > diagramfile;\n\n printf(\"\\\\begin{tikzpicture}[auto,scale=0.8,yscale=%1.2f]\\n\",yscale) > diagramfile;\n printf(\"\\n%% tikz styles\\n\") > diagramfile;\n printf(\"\\\\tikzstyle{box} +=[draw=black,rectangle,inner sep=0mm, minimum size = 2.5mm,left];\\n\") > diagramfile;\n printf(\"\\\\tikzstyle{legend} +=[inner sep=1mm, right];\\n\") > diagramfile;\n printf(\"\\\\tikzstyle{tic} +=[left];\\n\") > diagramfile;\n printf(\"\\\\tikzstyle{bel} +=[below,inner sep=0.8mm];\\n\") > diagramfile;\n printf(\"\\\\tikzstyle{abo} +=[above,inner sep=0.3mm];\\n\\n\") > diagramfile;\n\n #extendedub = (1+1\/(2*diagramnsteps-2))*upperbound;\n extendedub = 1.2*upperbound;\n printf(\"\\\\draw[background,fill=background] (-1.5,-0.3) rectangle (%1.2f,%1.2f);\\n\",nsolver+6.5,extendedub\/1000.0+0.1) > diagramfile;\n\n printf(\"%% Beschriftungen und Hoehenlinien\\n\") > diagramfile;\n for( i = 0; i < diagramnsteps; ++i )\n {\n perc = i\/(diagramnsteps-1.0)*upperbound\/1000.0;\n printf(\"\\\\node () at (0.2,%1.2f) [tic] {\\\\small %d};\\n\",perc,perc*1000) > diagramfile;\n printf(\"\\\\draw[dotted] (0.2,%1.2f) -- (%1.2f,%1.2f);\\n\",perc,nsolver+0.8,perc) > diagramfile;\n }\n if( diagramgerman )\n printf(\"\\\\node () at (-1,%1.2f) [rotate=90]{\\\\footnotesize Zeit in Sekunden};\\n\",extendedub\/2000.0) > diagramfile;\n else\n printf(\"\\\\node () at (-1,%1.2f) [rotate=90]{\\\\footnotesize time in seconds};\\n\",extendedub\/2000.0) > diagramfile;\n printf(\"\\\\draw[] (0.2,0) rectangle (%1.2f,%1.2f);\\n\\n\",nsolver+0.8,extendedub\/1000.0) > diagramfile;\n\n printf(\"%% BALKEN\\n\") > diagramfile;\n for( i = 1; i <= nsolver; ++i )\n {\n pos[i] = i-1;\n if( timeshiftedgeom[pos[i],0] >= upperbound)\n printf(\"\\\\draw[fill=c%d] (%d.5,0) rectangle (%d.5,%1.3f);\\n\",i,i-1,i,extendedub\/1000.0) > diagramfile;\n else\n printf(\"\\\\draw[fill=c%d] (%d.5,0) rectangle (%d.5,%1.3f);\\n\",i,i-1,i,timeshiftedgeom[pos[i],0]\/1000.0) > diagramfile;\n }\n printf(\"\\n\") > diagramfile;\n\n printf(\"%% TRENNLINIEN\\n\") > diagramfile;\n upperbreak = 0.92 * extendedub\/1000.0;\n lowerbreak = 0.90 * extendedub\/1000.0;\n printf(\"\\\\fill[background] (0.1,%1.4f) rectangle (%d.5,%1.4f);\\n\",lowerbreak,nsolver,upperbreak) > diagramfile;\n printf(\"\\\\draw[black] (0.1,%1.4f) -- (0.3,%1.4f);\\n\",lowerbreak,lowerbreak) > diagramfile;\n printf(\"\\\\draw[black] (0.1,%1.4f) -- (0.3,%1.4f);\\n\",upperbreak,upperbreak) > diagramfile;\n\n printf(\"%% BALKENBESCHRIFTUNG \\n\") > diagramfile;\n printf(\"\\\\draw[c%d] (0.2,%1.3f) -- (%1.2f,%1.3f);\\n\",refsolver+1,timeshiftedgeom[refsolver,0]\/1000.0,\n nsolver+0.8,timeshiftedgeom[refsolver,0]\/1000.0) > diagramfile;\n\n for( i = 1; i <= nsolver; ++i )\n {\n if( timeshiftedgeom[pos[i],0] >= upperbound )\n printf(\"\\\\node () at (%d,%1.3f) [bel,inner sep=0.3mm] {\\\\footnotesize\\\\textcolor{white}{%2.1fx}};\\n\",i,\n extendedub\/1000.0,timeshiftedgeom[pos[i],0]\/timeshiftedgeom[refsolver,0]) > diagramfile;\n else if( pos[i] == refsolver )\n printf(\"\\\\node () at (%d,%1.3f) [abo] {\\\\footnotesize\\\\textbf{%1.2fx}};\\n\",i,\n timeshiftedgeom[pos[i],0]\/1000.0,timeshiftedgeom[pos[i],0]\/timeshiftedgeom[refsolver,0]) > diagramfile;\n else\n printf(\"\\\\node () at (%d,%1.3f) [abo] {\\\\footnotesize %1.2fx};\\n\",i,\n timeshiftedgeom[pos[i],0]\/1000.0,timeshiftedgeom[pos[i],0]\/timeshiftedgeom[refsolver,0]) > diagramfile;\n }\n printf(\"\\n\") > diagramfile;\n\n printf(\"%% NOT SOLVED\\n\") > diagramfile;\n if( diagramgerman )\n printf(\"\\\\node () at (-0.4, %1.3f) [bel]{\\\\footnotesize\\\\textcolor{blue}{Nicht gel\\\\\\\"ost}};\\n\", -upperbound\/6000.0) > diagramfile;\n else\n printf(\"\\\\node () at (-0.4, %1.3f) [bel]{\\\\footnotesize\\\\textcolor{blue}{not solved}};\\n\", -upperbound\/6000.0) > diagramfile;\n for( i = 1; i <= nsolver; ++i )\n printf(\"\\\\node () at (%d, %1.3f) [bel]{\\\\footnotesize\\\\textcolor{blue}{%2.0f\\\\%}};\\n\",i,-upperbound\/6000.0,100.0-100.0*((nsolved[pos[i],0]+0.0)\/(nprocessedprobs[pos[i],0]+0.0))) > diagramfile;\n printf(\"\\n\") > diagramfile;\n\n printf(\"%% LEGEND\\n\") > diagramfile;\n for( i = 1; i <= nsolver; ++i )\n {\n perc = (nsolver-i)\/(nsolver-1.0)*extendedub\/1000.0;\n if( pos[i] == refsolver )\n printf(\"\\\\node () at (%1.4f,%1.4f) [legend]{\\\\small \\\\textbf{%s}};\\n\",nsolver+1.4,perc,solvername[pos[i]]) > diagramfile;\n else\n printf(\"\\\\node () at (%1.4f,%1.4f) [legend]{\\\\small %s};\\n\",nsolver+1.4,perc,solvername[pos[i]]) > diagramfile;\n printf(\"\\\\node () at (%1.4f,%1.4f) [box,color=c%d,fill=c%d]{};\\n\",nsolver+1.4,perc,i,i) > diagramfile;\n }\n printf(\"\\\\node () at (%1.4f,%1.3f) [legend]{\\\\footnotesize timings w.r.t. %d instances};\\n\",nsolver+1.4,-upperbound\/6000.0,nevalprobs[printorder[0],0]) > diagramfile;\n printf(\"\\\\end{tikzpicture}\\n\") > diagramfile;\n printf(\"\\n\\\\end{document}\\n\") > diagramfile;\n }\n}\n","avg_line_length":37.9283036551,"max_line_length":323,"alphanum_fraction":0.527125366} {"size":590,"ext":"awk","lang":"Awk","max_stars_count":1.0,"content":"#!\/usr\/bin\/awk -f\n\nBEGIN { FS=\"\\t\"; OFS=\"|\" }\nNR == 1 { next }\n{ for(i=1; i<=NF; i++) if($i ~ \/^ *$\/) $i = \"NA\" }; { print \">\" $1\"(\"$71\")\", $10, $12, $14, \"fam-\"$16, \"subfam-\"$18, \"tri-NA\", \"gs-\"$20, \"sp-\"$22, \"subsp-\"$24, \"country-\"$55,\"exactsite-\"$59, \"lat_\"$47, \"lon_\"$48, \"elev-\"$51, \"l-\" $83 \"\\n\" $82 }\n\n#$ awk 'BEGIN { FS=\"\\t\"; OFS=\"|\" } ; NR == 1 { next } { print \">\" $1, $14, \"gs-\"$20, \"sp-\"$22, \"subsp-\"$24, \"country-\"$55,\"exactsite-\"$59, \"lat_\"$47, \"lon_\"$48, \"elev-\"$51, \"l-\" $83 \"\\n\" $82 }' COI_all_data.tsv | less\n#{ for(i=1; i<=NF; i++) if($i ~ \/^ *$\/) $i = \"NA\" }; 1' file\n","avg_line_length":65.5555555556,"max_line_length":245,"alphanum_fraction":0.4423728814} {"size":76,"ext":"awk","lang":"Awk","max_stars_count":1.0,"content":"BEGIN {\n val = 0\n do {\n val++\n print val\n } while( val % 6 != 0)\n}\n","avg_line_length":9.5,"max_line_length":24,"alphanum_fraction":0.4210526316} {"size":3932,"ext":"awk","lang":"Awk","max_stars_count":1167.0,"content":"# $Id: mk-hdr.awk,v 1.4 2013\/08\/03 23:09:42 tom Exp $\n##############################################################################\n# Copyright (c) 2007-2010,2013 Free Software Foundation, Inc. #\n# #\n# Permission is hereby granted, free of charge, to any person obtaining a #\n# copy of this software and associated documentation files (the \"Software\"), #\n# to deal in the Software without restriction, including without limitation #\n# the rights to use, copy, modify, merge, publish, distribute, distribute #\n# with modifications, sublicense, and\/or sell copies of the Software, and to #\n# permit persons to whom the Software is furnished to do so, subject to the #\n# following conditions: #\n# #\n# The above copyright notice and this permission notice shall be included in #\n# all copies or substantial portions of the Software. #\n# #\n# THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR #\n# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, #\n# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL #\n# THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER #\n# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING #\n# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER #\n# DEALINGS IN THE SOFTWARE. #\n# #\n# Except as contained in this notice, the name(s) of the above copyright #\n# holders shall not be used in advertising or otherwise to promote the sale, #\n# use or other dealings in this Software without prior written #\n# authorization. #\n##############################################################################\n#\n# Author: Thomas E. Dickey\t2007\n#\n# Generate install\/uninstall rules for header files\n# Variables:\n#\tsubset\t (\"none\", \"base\", \"base+ext_funcs\" or \"termlib\", etc.)\n#\tcompat\t (\"yes\" or \"no\", flag to add link to curses.h\n#\nfunction basename(path) {\n\tsub(\/^.*\\\/\/,\"\",path)\n\treturn path;\n}\nBEGIN\t{\n\t\tfound = 0\n\t\tusing = 1\n\t\tcount = 0\n\t}\n\t\/^@\/ {\n\t\tusing = 0\n\t\tif (subset == \"none\") {\n\t\t\tusing = 1\n\t\t} else if (index(subset,$2) > 0) {\n\t\t\tusing = 1\n\t\t} else {\n\t\t\tusing = 0\n\t\t}\n\t}\n\t\/^[@#]\/ {\n\t\tnext\n\t}\n\t{\n\t\tif (using && NF != 0) {\n\t\t\tif (found == 0) {\n\t\t\t\tprint \"\"\n\t\t\t\tprint \"# generated by mk-hdr.awk\"\n\t\t\t\tprintf \"# subset: %s\\n\", subset \n\t\t\t\tprintf \"# compat: %s\\n\", compat \n\t\t\t\tprint \"\"\n\t\t\t\tfound = 1\n\t\t\t}\n\t\t\tdata[count] = $1\n\t\t\tcount = count + 1\n\t\t}\n\t}\nEND\t{\n\t\tif ( count > 0 )\n\t\t{\n\t\t\tprint \"${INCLUDEDIR} :\"\n\t\t\tprint \"\tmkdir -p $@\"\n\t\t\tprint \"\"\n\t\t\tprint \"install \\\\\"\n\t\t\tprint \"install.libs \\\\\"\n\t\t\tprint \"install.includes :: ${AUTO_SRC} ${INCLUDEDIR} \\\\\"\n\n\t\t\tfor (i = 0; i < count - 1; ++i) {\n\t\t\t\tprintf \"\t\t%s \\\\\\n\", data[i]\n\t\t\t}\n\t\t\tprintf \"\t\t%s\\n\", data[count - 1]\n\n\t\t\tfor (i = 0; i < count; ++i) {\n\t\t\t\tprintf \"\t@ (cd ${INCLUDEDIR} && rm -f %s) ; ..\/headers.sh ${INSTALL_DATA} ${INCLUDEDIR} ${srcdir} %s\\n\", basename(data[i]), data[i]\n\t\t\t\tif (data[i] == \"curses.h\" && compat == \"yes\") {\n\t\t\t\t\tprintf \"\t@ (cd ${INCLUDEDIR} && rm -f ncurses.h && ${LN_S} %s ncurses.h)\\n\", data[i]\n\t\t\t\t}\n\t\t\t}\n\t\t\tprint \"\"\n\t\t\tprint \"uninstall \\\\\"\n\t\t\tprint \"uninstall.libs \\\\\"\n\t\t\tprint \"uninstall.includes ::\"\n\n\t\t\tfor (i = 0; i < count; ++i) {\n\t\t\t\tprintf \"\t-@ (cd ${INCLUDEDIR} && rm -f %s)\\n\", basename(data[i])\n\t\t\t\tif (data[i] == \"curses.h\" && compat == \"yes\") {\n\t\t\t\t\tprintf \"\t-@ (cd ${INCLUDEDIR} && rm -f ncurses.h)\\n\"\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n# vile:ts=4 sw=4\n","avg_line_length":36.4074074074,"max_line_length":135,"alphanum_fraction":0.5048321465} {"size":47,"ext":"awk","lang":"Awk","max_stars_count":11.0,"content":"BEGIN {FS=\"\\t\"}\n{if ($1~\/.*[\u0451].*\/) {print $0}}\n","avg_line_length":15.6666666667,"max_line_length":30,"alphanum_fraction":0.3829787234} {"size":409,"ext":"awk","lang":"Awk","max_stars_count":20.0,"content":"BEGIN {\n FS = \" \";\n controlcount = 0;\n}\n\n\/[+]= new .*[(].*[)];[\\r]?$\/ { # eliminate event handlers\n next;\n}\n\n\/[.]ie[^ .]+[.]Item =\/ { # eliminate an item editor's Item property\n next;\n}\n\n\/^[[:space:]]*this[.]TabName = \\\".*\\\";[\\r]?$\/ { # eliminate a PropertyPages.IThing's TabName property\n next;\n}\n\n{ # keep every line (with perhaps a few substitutions)\n gsub(\"ThemedTabPage\", \"TabPage\");\n print $0;\n}\n","avg_line_length":18.5909090909,"max_line_length":101,"alphanum_fraction":0.564792176} {"size":1432,"ext":"awk","lang":"Awk","max_stars_count":1.0,"content":"# usage awk -f checkCellReadsStats.awk CellReads.stats barcodes.tsv matrix.mtx\nfunction funAbs(x) {\n return (x>0 ? x : -x);\n};\n\nBEGIN {\n OFS=\"\\t\";\n}\n\n(ARGIND==1) {\nif (NR==1) {\n for (ff=1; ff<=NF; ff++) {\n fn[ff]=$ff;\n fi[$ff]=ff;\n };\n next;\n};\n\nnuu=$(fi[\"nUMIunique\"]);\nngu=$(fi[\"nGenesUnique\"]);\nnum=$(fi[\"nUMImulti\"]);\nngm=$(fi[\"nGenesMulti\"]);\n\nif (nuu>0) {\n nGenes[$1]=ngu;\n nUMI[$1]=nuu;\n};\nif (nuu+num>0) {\n nGenesTot[$1]=ngu+ngm;\n nUMItot[$1]=nuu+num;\n};\n\n}\n\n(ARGIND==2) {#barcodes.tsv\n CB[FNR]=$1;\n}\n\n(ARGIND==3 && FNR>3) {#matrix mtx\n matGenes[CB[$2]]++;\n matUMI[CB[$2]]+=$3;\n}\n\n(ARGIND==4 && FNR>3) {#matrix mtx\n matGenesTot[CB[$2]]++;\n matUMItot[CB[$2]]+=$3;\n}\n\n\nEND {\n\n #for (cb in matUMI)\n # print cb,matUMI[cb],matGenes[cb];\n\n #exit;\n\n print length(nGenes), length(matGenes);\n\n for (cb in matGenes) {\n if (nGenes[cb]!=matGenes[cb])\n print \"G\",cb,nGenes[cb]+0,matGenes[cb]+0;\n if (nUMI[cb]!=matUMI[cb])\n print \"U\",cb,nUMI[cb]+0,matUMI[cb]+0;\n };\n\n if (ARGC>4) {\n print length(nGenesTot), length(matGenesTot);\n\n for (cb in matGenesTot) {\n if (nGenesTot[cb]!=matGenesTot[cb])\n print \"G\",cb,nGenesTot[cb]+0,matGenesTot[cb]+0;\n if (funAbs(nUMItot[cb]-matUMItot[cb])>0.0001)\n print \"U\",cb,nUMItot[cb]+0,matUMItot[cb]+0;\n };\n };\n\n}\n","avg_line_length":18.358974359,"max_line_length":78,"alphanum_fraction":0.5167597765} {"size":291,"ext":"awk","lang":"Awk","max_stars_count":17.0,"content":"BEGIN {\r\n FS=\"\\t\"\r\n}\r\n\r\n{\r\n if ($0 !~ \/^;\/)\r\n {\r\n printf \"%s\\n\",$1\r\n\r\n n = split ($9,a,\" \")\r\n\r\n for (i=1 ; i<=n ; i++)\r\n if (substr(a[i],1,1) == \"\\\\\" || \\\r\n a[i] ~ \/[Bb][Ll][Dd][Hh][Oo][Mm][Ee][Dd][Ii][Rr]\/)\r\n printf \"%s\\n\",a[i]\r\n }\r\n}\r\n","avg_line_length":16.1666666667,"max_line_length":64,"alphanum_fraction":0.2749140893} {"size":8799,"ext":"awk","lang":"Awk","max_stars_count":1.0,"content":"#!\/usr\/bin\/awk -f \n#\n# File: spice.awk\n# \n# This file is part of XSCHEM,\n# a schematic capture and Spice\/Vhdl\/Verilog netlisting tool for circuit \n# simulation.\n# Copyright (C) 1998-2020 Stefan Frederik Schippers\n# \n# This program is free software; you can redistribute it and\/or modify\n# it under the terms of the GNU General Public License as published by\n# the Free Software Foundation; either version 2 of the License, or\n# (at your option) any later version.\n# \n# This program is distributed in the hope that it will be useful,\n# but WITHOUT ANY WARRANTY; without even the implied warranty of\n# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n# GNU General Public License for more details.\n# \n# You should have received a copy of the GNU General Public License\n# along with this program; if not, write to the Free Software\n# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA\n\n\nBEGIN{\n lines = 0;\n first=1\n user_code=0 #20180129\n\n while( ARGV[1] ~ \/^[-]\/) {\n if(ARGV[1] == \"-hspice\") hspice = 1\n if(ARGV[1] == \"-xyce\") { xyce = 1} \n for(i=2; i<= ARGC;i++) {\n ARGV[i-1] = ARGV[i]\n }\n ARGC--\n }\n}\n\n# join split lines\n{\n if($0 ~ \/^[+]\/) {\n yy = yy \" \" substr($0,2)\n next\n }\n else {\n zz = yy\n yy = $0\n $0 = zz\n if(first) { \n first=0\n next\n }\n line[lines++] = $0\n }\n}\n\nEND{\n $0=yy\n line[lines++] = $0\n\n ## resolve parametric instance name vector multiplicity\n substitute_instance_param()\n \n for(i=0; i R1[10],R1[9],...,R1[5]\n## before further processing netlist.\nfunction substitute_instance_param( i, j, name, first, last)\n{\n IGNORECASE=1\n for(i = 0;i < lines; i++) {\n $0 = line[i]\n if($0 ~\/^\\.param\/) {\n gsub(\/ *= *\/, \"=\")\n for(j = 2; j <= NF; j++) {\n param = value = $j\n sub(\/=.*\/, \"\", param)\n sub(\/.*=\/,\"\", value)\n par[param] = value\n # print \"*** \" param \" = \" value\n }\n }\n }\n for(i = 0;i < lines; i++) {\n $0 = line[i]\n if($1 ~ \/^[a-zA-Z][^\\[\\]:]+\\[[a-zA-Z_][a-zA-Z0-9_]*:[a-zA-Z_][a-zA-Z0-9_]*\\]$\/) {\n name = first = last = $1\n sub(\/\\[.*\/, \"\", name)\n sub(\/^.*\\[\/, \"\", first)\n sub(\/:.*\/,\"\", first)\n sub(\/^.*:\/,\"\", last)\n sub(\/\\]\/,\"\", last)\n if(first in par) first = par[first]\n if(last in par) last = par[last]\n\n n=\"\"\n for(j= first;;) {\n if(j!=first) n = n \",\"\n n = n name \"[\" j \"]\"\n if(j == last) break\n j+= sign(last - first)\n }\n # print \"*** \" n\n $1 = n\n line[i] = $0\n }\n }\n IGNORECASE=0\n}\n\n\nfunction sign(x) \n{\n return x<0 ? -1 : x>0 ? 1 : 0\n}\n\nfunction process( i, iprefix)\n{\n\n if($0 ~\/\\*\\*\\*\\* end_element\/){\n spiceprefix=\"\"\n return\n }\n if($0 ~\/\\*\\*\\*\\* spice_prefix\/){\n spiceprefix=$3\n return\n }\n if($0 ~\/\\*\\*\\*\\* begin user architecture code\/){ #20180129\n user_code=1\n print\n return\n }\n if($0 ~\/\\*\\*\\*\\* end user architecture code\/){ #20180129\n user_code=0\n print\n return\n }\n if(user_code) { #20180129\n print\n return\n }\n\n # 20181208 do not process commented lines\n if($1 ~\/^\\*\/) {\n print\n return\n }\n\n #20150922 handle the case of pmos elements that netlist also a diode\n # format=\"@name @pinlist @model w=@w l=@l geomod=0 m=@m\n # #dx#name 0 @@b dnwell area=... pj=...\"\n # replace #dx#name with dx prefix added on all @name elements \n # example:\n # m6[3] GWL WLDECF[3] WL[3] HDD phv w=50u l=10u geomod=0 m=1 \n # m6[2] GWL WLDECF[2] WL[2] HDD phv w=50u l=10u geomod=0 m=1 \n # m6[1] GWL WLDECF[1] WL[1] HDD phv w=50u l=10u geomod=0 m=1 \n # m6[0] GWL WLDECF[0] WL[0] HDD phv w=50u l=10u geomod=0 m=1 \n # dxm6[3] 0 HDD dnwell area='(50u + 73u)*(10u + 32u)' pj='2*(50u +73u)+2*(10u +32u)' \n # dxm6[2] 0 HDD dnwell area='(50u + 73u)*(10u + 32u)' pj='2*(50u +73u)+2*(10u +32u)' \n # dxm6[1] 0 HDD dnwell area='(50u + 73u)*(10u + 32u)' pj='2*(50u +73u)+2*(10u +32u)' \n # dxm6[0] 0 HDD dnwell area='(50u + 73u)*(10u + 32u)' pj='2*(50u +73u)+2*(10u +32u)' \n #20151027 do this for all fields\n for(i=1; i<=NF;i++) {\n if($i ~\/^#[a-zA-Z_0-9]+#[a-zA-Z_]+\/) {\n iprefix=$i\n sub(\/^#\/,\"\",iprefix)\n sub(\/#.*\/,\"\",iprefix)\n sub(\"#\" iprefix \"#\", iprefix,$i)\n gsub(\/,\/, \",\" iprefix,$i)\n ## 20160301 add '?1' if missing in format string\n if(i>1 && ( $(i-1) !~\/^\\?\/) ) {\n $i = \"?1 \" $i\n } \n $0 = $0 # reparse input line \n }\n }\n if(hspice) {\n ## 20140506 do not transform {} of variation groups\n ## nmos N {\n ## ...\n ## }\n if($0 ~ \/=\/) gsub(\/[{}]\/,\"'\")\n gsub(\/PARAM:\/,\"\") # stefan 20110627\n\n if($0 ~\/^[gG]\/) {\n IGNORECASE=1\n sub(\/ value=\/,\" cur=\")\n IGNORECASE=0\n }\n if($0 ~\/^[eE]\/) {\n IGNORECASE=1\n sub(\/ value=\/,\" vol=\")\n IGNORECASE=0\n }\n if($0 ~\/^[rR]\/) {\n IGNORECASE=1\n sub(\/ value=\/,\" r=\")\n IGNORECASE=0\n }\n if($0 ~\/^[cC]\/) {\n IGNORECASE=1\n sub(\/ value=\/,\" c=\")\n IGNORECASE=0\n }\n gsub(\/ value=\/,\" \")\n gsub(\/ VALUE=\/,\" \")\n if($0 ~ \/^D\/ ) sub(\/PERI[ \\t]*=\/,\"PJ=\")\n }\n\n # Xyce\n # .print tran v( ?1 DL[3],DL[2],DL[1],DL[0] , ?1 WL[3],WL{2],WL[1],WL[0] )\n # ............ .......... --> matches ?n and ?-n\n if(tolower($1) ==\".print\" && $4 ~\/^\\?-?[0-9]+$\/ && $7 ~\/^\\?-?[0-9]+$\/ && NF==9) {\n num1=split($5,name,\",\")\n num2=split($8,name2,\",\")\n\n num = num1>num2? num1: num2\n for(i=1;i<=num;i++) {\n print $1 \" \" $2 \" \" $3 \" \" name[(i-1)%num1+1] \" , \" name2[(i-1)%num2+1] \" \" $9 \n }\n\n # Ngspice\n # .save v( ?1 DL[3],DL[2],DL[1],DL[0] , ?1 WL[3],WL{2],WL[1],WL[0] )\n # ............ .......... --> matches ?n and ?-n\n } else if(tolower($1) ==\".save\" && $3 ~\/^\\?-?[0-9]+$\/ && $6 ~\/^\\?-?[0-9]+$\/ && NF==8) {\n num1=split($4,name,\",\")\n num2=split($7,name2,\",\")\n\n num = num1>num2? num1: num2\n for(i=1;i<=num;i++) {\n print $1 \" \" $2 \" \" name[(i-1)%num1+1] \" , \" name2[(i-1)%num2+1] \" \" $8\n }\n\n # Xyce\n # .print tran v( ?1 LDY1_B[1],LDY1_B[0] )\n # ............ --> matches ?n and ?-n\n } else if(tolower($1) ==\".print\" && $4 ~\/^\\?-?[0-9]+$\/ && NF==6) {\n num=split($5,name,\",\")\n for(i=1;i<=num;i++) {\n print $1 \" \" $2 \" \" $3 \" \" name[i] \" \" $6\n }\n\n # Ngspice\n # .save v( ?1 LDY1_B[1],LDY1_B[0] )\n # ............ --> matches ?n and ?-n\n } else if(tolower($1) ==\".save\" && $3 ~\/^\\?-?[0-9]+$\/ && NF==5) {\n num=split($4,name,\",\")\n for(i=1;i<=num;i++) { \n print $1 \" \" $2 \" \" name[i] \" \" $5\n }\n\n # .save i( v1[15],v1[14],v1[13],v1[12],v1[11],v1[10],v1[9],v1[8],v1[7],v1[6],v1[5],v1[4],v1[3],v1[2],v1[1],v1[0] )\n } else if(tolower($0) ~ \/^[ \\t]*\\.(print|save) +.* +[ivx] *\\(.*\\)\/) {\n num=$0\n sub(\/.*\\( *\/,\"\",num)\n sub(\/ *\\).*\/,\"\",num)\n sub(\/^\\?[0-9]+\/,\"\", num) # .print tran file=test1.raw format=raw v(?1 C2) <-- remove ?1\n num=split(num,name,\",\")\n num1 = $0\n sub(\/^.*save *\/,\"\",num1)\n sub(\/^.*print *\/,\"\",num1)\n sub(\/\\(.*\/,\"(\",num1)\n for(i=1;i<=num;i++) {\n print $1 \" \" num1 name[i] \")\"\n }\n } else if( $1 ~ \/^\\*\\.(ipin|opin|iopin)\/ ) {\n num=split($2,name,\",\")\n for(i=1;i<=num;i++) print $1 \" \" name[i]\n } else if( $1 ~ \/\\.subckt\/) {\n # remove m=.. from subcircuit definition since m= is a multiplier not a param\n sub(\/ m=[0-9]+\/,\" \",$0)\n gsub(\",\",\" \",$0)\n print $0\n } else {\n num=split($1,name,\",\")\n if(num==0) print \"\"\n\n \n for(j=2;j<=NF;j+=1) \t\t# start from 2 not from 3 20070221\n {\n # ............ --> matches ?n and ?-n \n if($j ~\/^\\?-?[0-9]+$\/) continue\t# handle the case that $2 not pinlist 20070221\n arg_num[j]=split($j,tmp,\",\")\n for(k=1;k<=arg_num[j]; k++) {\n arg_name[j,k]=tmp[k]\n }\n }\n for(i=1;i<=num;i++)\n {\n printf \"%s \", spiceprefix name[i]\n\n for(j=2;j<=NF;j++)\n {\n # ............ --> matches ?n and ?-n\n if($j !~ \/^\\?-?[0-9]+$\/)\n {\n printf \"%s \", $j # if not a node just print it\n }\n else\n {\n nmult=$(j++)\n sub(\/\\?\/,\"\",nmult)\n if(nmult+0==-1) nmult=arg_num[j]\n for(l=0;l&2\"\n exit 1\n }\n\n print \"enum ControllerState {\";\n print \" A, C, B, D\"\n print \"};\"\n print \"enum PreAction {\"\n print \" tau,\"\n\n for(i=0; i\"\n print \" (exists SpecState q2. DeltaSpec(a, p2, q2) & bisimulates(q1, q2))) &\"\n print \" (forall Action b, SpecState r2.\"\n print \" DeltaSpec(b, p2, r2) ->\"\n print \" (exists SchedState r1. DeltaSched(b, p1, r1) & bisimulates(r1, r2)));\"\n print \"\"\n print \"#cex\"\n print \"forall SchedState s, SpecState t.\"\n print \" StartOfSched(s) & StartOfSpec(t) -> bisimulates(s,t);\"\n print \"\"\n print \"#reset all;\"\n print \"#print statistics;\"\n}\n","avg_line_length":27.5416666667,"max_line_length":84,"alphanum_fraction":0.5239536056} {"size":296,"ext":"awk","lang":"Awk","max_stars_count":1.0,"content":"#!\/usr\/bin\/awk -f\nBEGIN {\n if (ARGC != 2) {\n print \"git-latest-remote-tag.awk https:\/\/github.com\/greenpeace\/planet4-docker\"\n exit\n }\n FS = \"[ \/^]+\"\n while (\"git ls-remote \" ARGV[1] \"| sort -Vk2\" | getline) {\n if ($2~\/tags\/ && $3~\/^v[0-9]+\/)\n tag = $3\n }\n printf \"%s\\n\", tag\n}\n","avg_line_length":21.1428571429,"max_line_length":82,"alphanum_fraction":0.5135135135} {"size":338,"ext":"awk","lang":"Awk","max_stars_count":55.0,"content":"\n# \/^[a-z]*$\/ {\n\n split($0, letters, \"\");\n key = \"\"\n asort(letters, sorted)\n for (i in sorted) {\n key = key sorted[i]\n }\n if (words[key])\n words[key] = words[key] \",\" $0\n else\n words[key] = $0\n}\n\nEND {\n for (key in words) {\n if (words[key] ~ \/,\/)\n print words[key]\n }\n}\n\n\n\n\n","avg_line_length":13.0,"max_line_length":38,"alphanum_fraction":0.4142011834} {"size":138,"ext":"awk","lang":"Awk","max_stars_count":null,"content":"BEGIN { i = 0 }\n{\n \tif (! \/SENDER\/ )\n\t{\n\t\tprintf \"%f%s\", $(column), OFS\n# $12\n\t\tif ((NR-1) % evaluations == 0)\n\t\t{\n\t\t\tprint ORS\n\t\t}\n\t}\n}\n","avg_line_length":10.6153846154,"max_line_length":32,"alphanum_fraction":0.4275362319} {"size":5076,"ext":"awk","lang":"Awk","max_stars_count":null,"content":"# $Id: mk-test.awk,v 1.17 2017\/09\/04 00:50:49 tom Exp $\n##############################################################################\n# Copyright (c) 2006-2015,2017 Free Software Foundation, Inc. #\n# #\n# Permission is hereby granted, free of charge, to any person obtaining a #\n# copy of this software and associated documentation files (the \"Software\"), #\n# to deal in the Software without restriction, including without limitation #\n# the rights to use, copy, modify, merge, publish, distribute, distribute #\n# with modifications, sublicense, and\/or sell copies of the Software, and to #\n# permit persons to whom the Software is furnished to do so, subject to the #\n# following conditions: #\n# #\n# The above copyright notice and this permission notice shall be included in #\n# all copies or substantial portions of the Software. #\n# #\n# THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR #\n# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, #\n# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL #\n# THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER #\n# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING #\n# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER #\n# DEALINGS IN THE SOFTWARE. #\n# #\n# Except as contained in this notice, the name(s) of the above copyright #\n# holders shall not be used in advertising or otherwise to promote the sale, #\n# use or other dealings in this Software without prior written #\n# authorization. #\n##############################################################################\n#\n# Author: Thomas E. Dickey\n#\n# generate Makefile for ncurses tests.\nBEGIN\t{\n\t\tfirst = 1;\n\t\tcount = 0;\n\t}\n\/^#\/\t{\n\t\tnext;\n\t}\n\/^$\/\t{\n\t\tnext;\n\t}\n\t{\n\t\tif (first) {\n\t\t\tprint \"# generated by mk-test.awk\\n\";\n\t\t\tfirst = 0;\n\t\t}\n\t\tprogs[count] = $1;\n\t\tflags[count] = $2;\n\t\tusing[count] = $3;\n\t\tfiles[count] = \"\";\n\t\tfor (n = 4; n <= NF; ++n) {\n\t\t\tfiles[count] = sprintf(\"%s $(MODEL)\/%s$o\", files[count], $n);\n\t\t}\n\t\tcount = count + 1;\n\t}\nEND\t{\n\tfor (n = 0; n < count; ++n) {\n\t\tif (n == 0) {\n\t\t\tprintf \"TESTS\\t= \";\n\t\t} else {\n\t\t\tprintf \"\\t \";\n\t\t}\n\t\tprintf \"$(destdir)%s$x\", progs[n];\n\t\tif (n < count - 1) {\n\t\t\tprintf \" \\\\\";\n\t\t}\n\t\tprint \"\";\n\t}\n\tprint\t\"DATAFILES = $(srcdir)\/*.x* $(srcdir)\/*.dat\"\n\tprint\t\"\"\n\tprint\t\"all: $(TESTS)\"\n\tprint\t\"\"\n\tprint\t\"sources:\"\n\tprint\t\"\"\n\tprint\t\"tags:\"\n\tprint\t\"\t$(CTAGS) *.[ch]\"\n\tprint\t\"\"\n\tprint\t\"# no libraries here\"\n\tprint\t\"libs \\\\\"\n\tprint\t\"install.libs \\\\\"\n\tprint\t\"uninstall.libs:\"\n\tprint\t\"\"\n\tif (INSTALL == \"yes\") {\n\t\tprint\t\"# we might install the test-programs\"\n\t\tprint\t\"install \\\\\"\n\t\tprint\t\"install.test: $(BINDIR) $(DATADIR) $(TESTS)\"\n\t\tprint\t\"\t@$(SHELL) -c 'for src in $(TESTS); do \\\\\"\n\t\tprint\t\"\tdst=`echo $$src | $(TRANSFORM)`; \\\\\"\n\t\tprint\t\"\techo \\\"installing $$src -> $(BINDIR)\/$$dst\\\"; \\\\\"\n\t\tprint\t\"\t$(INSTALL_PROG) $$src $(BINDIR)\/$$dst; \\\\\"\n\t\tprint\t\"\tdone'\"\n\t\tprint\t\"\t@$(SHELL) -c 'for src in $(DATAFILES); do \\\\\"\n\t\tprint\t\"\tdst=`echo $$src | sed -e 's,^.*\/,,'`; \\\\\"\n\t\tprint\t\"\techo \\\"installing $$src -> $(DATADIR)\/$$dst\\\"; \\\\\"\n\t\tprint\t\"\t$(INSTALL_DATA) $$src $(DATADIR)\/$$dst; \\\\\"\n\t\tprint\t\"\tdone'\"\n\t\tprint\t\"\"\n\t\tprint\t\"uninstall \\\\\"\n\t\tprint\t\"uninstall.test:\"\n\t\tprint\t\"\t@$(SHELL) -c 'for src in $(TESTS); do \\\\\"\n\t\tprint\t\"\tdst=`echo $$src | $(TRANSFORM)`; \\\\\"\n\t\tprint\t\"\trm -f $(BINDIR)\/$$dst; \\\\\"\n\t\tprint\t\"\tdone'\"\n\t\tprint\t\"\t@$(SHELL) -c 'for src in $(DATAFILES); do \\\\\"\n\t\tprint\t\"\tdst=`echo $$src | sed -e 's,^.*\/,,'`; \\\\\"\n\t\tprint\t\"\trm -f $(DATADIR)\/$$dst; \\\\\"\n\t\tprint\t\"\tdone'\"\n\t} else {\n\t\tprint\t\"install \\\\\"\n\t\tprint\t\"install.test \\\\\"\n\t\tprint\t\"uninstall \\\\\"\n\t\tprint\t\"uninstall.test:\"\n\t}\n\tprint\t\"\"\n\tprint\t\"mostlyclean ::\"\n\tprint\t\"\t-rm -f core tags TAGS *~ *.bak *.i *.ln *.atac trace\"\n\tprint\t\"\"\n\tprint\t\"clean :: mostlyclean\"\n\tprint\t\"\t-$(SHELL) -c \\\"if test -n '$x' ; then $(MAKE) clean x=''; fi\\\"\"\n\tprint\t\"\t-rm -rf *$o screendump *.lis $(TESTS) .libs *.dSYM\"\n\tprint\t\"\"\n\tprint\t\"distclean :: clean\"\n\tprint\t\"\t-rm -f Makefile ncurses_cfg.h config.status config.log\"\n\tprint\t\"\"\n\tprint\t\"realclean :: distclean\"\n\tprint\t\"\"\n\tprint\t\"lint:\"\n\tprint\t\"\t$(SHELL) -c 'for N in $(TESTS); do echo LINT:$$N; $(LINT) $(LINT_OPTS) $(CPPFLAGS) $(srcdir)\/$$N.c $(LINT_LIBS); done'\"\n\tprint\t\"$(BINDIR) $(DATADIR) :\"\n\tprint\t\"\tmkdir -p $@\"\n\n\n\tif (ECHO_LINK != \"\") {\n\t\tECHO_LINK=\"@ echo linking $@ ... ;\"\n\t}\n\tfor (n = 0; n < count; ++n) {\n\t\tprint \"\";\n\t\tprintf \"$(destdir)%s$x:%s %s\\n\", progs[n], files[n], using[n];\n\t\tprintf \"\\t%s$(LINK) -o $@%s %s\\n\", ECHO_LINK, files[n], flags[n];\n\t}\n\n\t}\n","avg_line_length":35.25,"max_line_length":128,"alphanum_fraction":0.5222616233} {"size":1988,"ext":"awk","lang":"Awk","max_stars_count":32.0,"content":"#!\/usr\/bin\/env -S awk -f\n# SPDX-License-Identifier: Apache-2.0 OR MIT\n# Based on https:\/\/codereview.stackexchange.com\/questions\/194986\/print-code-fenced-sections-of-a-markdown-document\/195030#195030\nBEGIN {\n in_code_block = 0;\n tag = \"\";\n operation_id = \"\";\n}\n\nfunction slug(value) {\n head = \"\";\n tail = value;\n while ( match(tail,\/[[:upper:]][[:lower:]]\/) ) {\n tgt = substr(tail,RSTART,1);\n if ( substr(tail,RSTART-1,1) ~ \/[[:lower:]]\/ || RSTART > 1 ) {\n tgt = \"-\" tolower(tgt);\n }\n head = head substr(tail,1,RSTART-1) tgt;\n tail = substr(tail,RSTART+1);\n }\n return tolower(head) tail;\n}\n\nfunction camel(value) {\n gsub(\"_ip_\", \"_iP_\", value);\n gsub(\"_id_\", \"_iD_\", value);\n\n head = toupper(substr(value,0,1)) substr(value,2);\n while ( match(head, \/_([a-z])\/) ) {\n head = substr(head,0,RSTART-1) toupper(substr(head,RSTART+1, 1)) substr(head,RSTART+2)\n }\n # NOTE special cases for all caps groups which we can't handle otherwise\n gsub(\"Aws\", \"AWS\", head);\n gsub(\"Gcp\", \"GCP\", head);\n return head;\n}\n\n\/^# datadog_api_client\\.v[0-9]*\\.(.+)Api\/ {\n tag = slug(substr($2, 23, length($2)-25));\n}\n\/^##? \\*\\*.+\\*\\*\/ {\n operation_id = camel(substr($2, 3, length($2)-4));\n}\n\/^```python\/ {\n if (in_code_block == 0) {\n in_code_block = 1;\n if (out_file) {\n close(out_file);\n }\n system(\"mkdir -p \" output \"\/\" tag);\n out_file=output \"\/\" tag \"\/\" operation_id \".pybeta\";\n if (system(\"[ -f \" out_file \" ]\") == 0) {\n printf \"skipped: \"\n in_code_block = 0;\n }\n print out_file;\n } else {\n print \"Can't parse \" FILENAME > \"\/dev\/stderr\"\n exit 1\n }\n next;\n}\n\/^```\/ {\n in_code_block = 0;\n}\n\nin_code_block {\n # Make sure that the file is newly created\n if (in_code_block == 1) {\n in_code_block = 2;\n print > out_file;\n } else {\n print >> out_file;\n }\n}\n","avg_line_length":26.1578947368,"max_line_length":128,"alphanum_fraction":0.5347082495} {"size":437,"ext":"awk","lang":"Awk","max_stars_count":2.0,"content":"BEGIN{\n etot = 0.0;\n ekin = 0.0;\n epot = 0.0;\n ethm = 0.0;\n}\n{\n mass = $3;\n xvel = $7;\n yvel = $8;\n zvel = $9;\n uene = $13;\n pot = $25;\n\n ikin = 0.5 * mass * (xvel**2 + yvel**2 + zvel**2);\n ipot = 0.5 * mass * pot;\n ithm = mass * uene;\n\n ekin += ikin;\n epot += ipot;\n ethm += ithm;\n etot += (ikin + ipot + ithm);\n}\nEND{\n printf(\"%+e %+e %+e %+e\\n\", etot, ekin, epot, ethm);\n}\n","avg_line_length":16.1851851852,"max_line_length":56,"alphanum_fraction":0.4118993135} {"size":358,"ext":"awk","lang":"Awk","max_stars_count":null,"content":"#!\/usr\/bin\/env .\/au\nfunction has(i,f,k) { return has0(i, f?f:\"List\", k?k:1+length(i[k])) }\nfunction has0(i,f,k) { i[k][0]; @f(i[k]); delete i[k][0]; return k }\nfunction List(i) { split(\"\",i,\"\") }\nfunction is(i,x) { if(\"is\" in i) i[\"super\"]=x; i[\"is\"]=x; ++i[\"id\"] }\n\nfunction Num(i) { \n Col(i)\n is(i,\"Num\")\n has(i,\"fred\",\"all\")\n}\nBEGIN {print 1}\n","avg_line_length":27.5384615385,"max_line_length":73,"alphanum_fraction":0.5195530726} {"size":7849,"ext":"awk","lang":"Awk","max_stars_count":null,"content":"# PHONSYL.AWK\n\n# EPW\n\n# This script returns the syllabified phonemic transcription of the word, \n# without any stress markers, in any of the formats (SAM-PA, CELEX, CPA)\n# specified on the command line \n\nBEGIN {\n\n if (ARGC <= 2) {\n printf \"insufficient number of arguments! (%d)\\n\", ARGC-1\n printf \"USAGE !!\\n awk -f phonsyl.awk file LexField_file1 (SP|CX|CP)\\n\"\n exit(-1)\n\t }\n\n if (ARGC == 4 && ARGV[3] !~ \/^(SP|CX|CP)$\/) {\n printf \"Incorrect 4th argument given\\n\"\n printf \"USAGE !!\\n awk -f phon.awk file LexField_file1 (SP|CX|CP)\\n\"\n exit(-1)\n\t }\n\n FS=\"\\\\\";\n\n while(getline < ARGV[1]){\n\t LexInfo_1 = $ARGV[2];\n\n if (ARGV[3] == \"\") {\n Charset = ARGV[3];\n LexInfo_1 = StripStressMarkers(LexInfo_1);\n\t }\n else if (ARGV[3] == \"CP\") {\n Charset = ARGV[3];\n LexInfo_1 = ChangeRepresentation(SyllableMarkersToFullStops(StripStressMarkers(LexInfo_1)));\n\t }\n else if (ARGV[3] == \"CX\" || ARGV[3] == \"SP\") {\n Charset = ARGV[3];\n LexInfo_1 = ChangeRepresentation(StripStressMarkers(LexInfo_1));\n\t }\n\t printf(\"%s\\n\",LexInfo_1);\n }\n}\n\n\nfunction StripStressMarkers(String)\n{\n gsub(\"['\\\"]\",\"\",String);\n return(String);\n}\n\nfunction SyllableMarkersToFullStops(String)\n{\n gsub(\"-\",\".\",String);\n return(String);\n}\n\nfunction ChangeRepresentation(String) {\n gsub(\/.\/,\"&\\034\",String);\n nc = split(String,StringArray,\"\\034\");\n String = \"\";\n\n SPArray[\"p\"] = \"p\";\n SPArray[\"b\"] = \"b\";\n SPArray[\"t\"] = \"t\";\n SPArray[\"d\"] = \"d\";\n SPArray[\"k\"] = \"k\";\n SPArray[\"g\"] = \"g\";\n SPArray[\"N\"] = \"N\";\n SPArray[\"m\"] = \"m\";\n SPArray[\"n\"] = \"n\";\n SPArray[\"l\"] = \"l\";\n SPArray[\"r\"] = \"r\";\n SPArray[\"f\"] = \"f\";\n SPArray[\"v\"] = \"v\";\n SPArray[\"T\"] = \"T\";\n SPArray[\"D\"] = \"D\";\n SPArray[\"s\"] = \"s\";\n SPArray[\"z\"] = \"z\";\n SPArray[\"S\"] = \"S\";\n SPArray[\"Z\"] = \"Z\";\n SPArray[\"j\"] = \"j\";\n SPArray[\"x\"] = \"x\";\n SPArray[\"G\"] = \"G\";\n SPArray[\"h\"] = \"h\";\n SPArray[\"w\"] = \"w\";\n SPArray[\"+\"] = \"pf\";\n SPArray[\"=\"] = \"ts\";\n SPArray[\"J\"] = \"tS\";\n SPArray[\"_\"] = \"dZ\";\n SPArray[\"C\"] = \"N,\";\n SPArray[\"F\"] = \"m,\";\n SPArray[\"H\"] = \"n,\";\n SPArray[\"P\"] = \"l,\";\n SPArray[\"R\"] = \"r*\";\n SPArray[\"i\"] = \"i:\";\n SPArray[\"!\"] = \"i::\";\n SPArray[\"#\"] = \"A:\";\n SPArray[\"a\"] = \"a:\";\n SPArray[\"$\"] = \"O:\";\n SPArray[\"u\"] = \"u:\";\n SPArray[\"3\"] = \"3:\";\n SPArray[\"y\"] = \"y:\";\n SPArray[\"(\"] = \"y::\";\n SPArray[\")\"] = \"E:\";\n SPArray[\"*\"] = \"\/:\";\n SPArray[\"<\"] = \"Q:\";\n SPArray[\"e\"] = \"e:\";\n SPArray[\"|\"] = \"|:\";\n SPArray[\"o\"] = \"o:\";\n SPArray[\"1\"] = \"eI\";\n SPArray[\"2\"] = \"aI\";\n SPArray[\"4\"] = \"OI\";\n SPArray[\"5\"] = \"@U\";\n SPArray[\"6\"] = \"aU\";\n SPArray[\"7\"] = \"I@\";\n SPArray[\"8\"] = \"E@\";\n SPArray[\"9\"] = \"U@\";\n SPArray[\"K\"] = \"EI\";\n SPArray[\"L\"] = \"\/I\";\n SPArray[\"M\"] = \"Au\";\n SPArray[\"W\"] = \"ai\";\n SPArray[\"B\"] = \"au\";\n SPArray[\"X\"] = \"Oy\";\n SPArray[\"I\"] = \"I\";\n SPArray[\"Y\"] = \"Y\";\n SPArray[\"E\"] = \"E\";\n SPArray[\"\/\"] = \"\/\";\n SPArray[\"{\"] = \"{\";\n SPArray[\"&\"] = \"a\";\n SPArray[\"A\"] = \"A\";\n SPArray[\"Q\"] = \"Q\";\n SPArray[\"V\"] = \"V\";\n SPArray[\"O\"] = \"O\";\n SPArray[\"U\"] = \"U\";\n SPArray[\"}\"] = \"}\";\n SPArray[\"@\"] = \"@\";\n SPArray[\"^\"] = \"\/~:\";\n SPArray[\"c\"] = \"{~\";\n SPArray[\"q\"] = \"A~:\";\n SPArray[\"0\"] = \"{~:\";\n SPArray[\"~\"] = \"O~:\";\n SPArray[\"-\"] = \"-\";\n SPArray[\"'\"] = \"\\\"\";\n SPArray[\"\\\"\"] = \"%\";\n SPArray[\".\"] = \".\";\n\n CXArray[\"p\"] = \"p\";\n CXArray[\"b\"] = \"b\";\n CXArray[\"t\"] = \"t\";\n CXArray[\"d\"] = \"d\";\n CXArray[\"k\"] = \"k\";\n CXArray[\"g\"] = \"g\";\n CXArray[\"N\"] = \"N\";\n CXArray[\"m\"] = \"m\";\n CXArray[\"n\"] = \"n\";\n CXArray[\"l\"] = \"l\";\n CXArray[\"r\"] = \"r\";\n CXArray[\"f\"] = \"f\";\n CXArray[\"v\"] = \"v\";\n CXArray[\"T\"] = \"T\";\n CXArray[\"D\"] = \"D\";\n CXArray[\"s\"] = \"s\";\n CXArray[\"z\"] = \"z\";\n CXArray[\"S\"] = \"S\";\n CXArray[\"Z\"] = \"Z\";\n CXArray[\"j\"] = \"j\";\n CXArray[\"x\"] = \"x\";\n CXArray[\"G\"] = \"G\";\n CXArray[\"h\"] = \"h\";\n CXArray[\"w\"] = \"w\";\n CXArray[\"+\"] = \"pf\";\n CXArray[\"=\"] = \"ts\";\n CXArray[\"J\"] = \"tS\";\n CXArray[\"_\"] = \"dZ\";\n CXArray[\"C\"] = \"N,\";\n CXArray[\"F\"] = \"m,\";\n CXArray[\"H\"] = \"n,\";\n CXArray[\"P\"] = \"l,\";\n CXArray[\"R\"] = \"r*\";\n CXArray[\"i\"] = \"i:\";\n CXArray[\"!\"] = \"i::\";\n CXArray[\"#\"] = \"A:\";\n CXArray[\"a\"] = \"a:\";\n CXArray[\"$\"] = \"O:\";\n CXArray[\"u\"] = \"u:\";\n CXArray[\"3\"] = \"3:\";\n CXArray[\"y\"] = \"y:\";\n CXArray[\"(\"] = \"y::\";\n CXArray[\")\"] = \"E:\";\n CXArray[\"*\"] = \"U:\";\n CXArray[\"<\"] = \"O:\";\n CXArray[\"e\"] = \"e:\";\n CXArray[\"|\"] = \"&:\";\n CXArray[\"o\"] = \"o:\";\n CXArray[\"1\"] = \"eI\";\n CXArray[\"2\"] = \"aI\";\n CXArray[\"4\"] = \"OI\";\n CXArray[\"5\"] = \"@U\";\n CXArray[\"6\"] = \"aU\";\n CXArray[\"7\"] = \"I@\";\n CXArray[\"8\"] = \"E@\";\n CXArray[\"9\"] = \"U@\";\n CXArray[\"K\"] = \"EI\";\n CXArray[\"L\"] = \"UI\";\n CXArray[\"M\"] = \"AU\";\n CXArray[\"W\"] = \"ai\";\n CXArray[\"B\"] = \"au\";\n CXArray[\"X\"] = \"Oy\";\n CXArray[\"I\"] = \"I\";\n CXArray[\"Y\"] = \"Y\";\n CXArray[\"E\"] = \"E\";\n CXArray[\"\/\"] = \"Q\";\n CXArray[\"{\"] = \"&\";\n CXArray[\"&\"] = \"a\";\n CXArray[\"A\"] = \"A\";\n CXArray[\"Q\"] = \"O\";\n CXArray[\"V\"] = \"V\";\n CXArray[\"O\"] = \"O\";\n CXArray[\"U\"] = \"U\";\n CXArray[\"}\"] = \"U\";\n CXArray[\"@\"] = \"@\";\n CXArray[\"^\"] = \"Q~:\";\n CXArray[\"c\"] = \"&~\";\n CXArray[\"q\"] = \"A~:\";\n CXArray[\"0\"] = \"&~:\";\n CXArray[\"~\"] = \"O~:\";\n CXArray[\"-\"] = \"-\";\n CXArray[\"'\"] = \"'\";\n CXArray[\"\\\"\"] = \"\\\"\";\n CXArray[\".\"] = \".\";\n\n CPArray[\"p\"] = \"p\";\n CPArray[\"b\"] = \"b\";\n CPArray[\"t\"] = \"t\";\n CPArray[\"d\"] = \"d\";\n CPArray[\"k\"] = \"k\";\n CPArray[\"g\"] = \"g\";\n CPArray[\"N\"] = \"N\";\n CPArray[\"m\"] = \"m\";\n CPArray[\"n\"] = \"n\";\n CPArray[\"l\"] = \"l\";\n CPArray[\"r\"] = \"r\";\n CPArray[\"f\"] = \"f\";\n CPArray[\"v\"] = \"v\";\n CPArray[\"T\"] = \"T\";\n CPArray[\"D\"] = \"D\";\n CPArray[\"s\"] = \"s\";\n CPArray[\"z\"] = \"z\";\n CPArray[\"S\"] = \"S\";\n CPArray[\"Z\"] = \"Z\";\n CPArray[\"j\"] = \"j\";\n CPArray[\"x\"] = \"x\";\n CPArray[\"G\"] = \"G\";\n CPArray[\"h\"] = \"h\";\n CPArray[\"w\"] = \"w\";\n CPArray[\"+\"] = \"pf\";\n CPArray[\"=\"] = \"C\/\";\n CPArray[\"J\"] = \"T\/\";\n CPArray[\"_\"] = \"J\/\";\n CPArray[\"C\"] = \"N,\";\n CPArray[\"F\"] = \"m,\";\n CPArray[\"H\"] = \"n,\";\n CPArray[\"P\"] = \"l,\";\n CPArray[\"R\"] = \"r*\";\n CPArray[\"i\"] = \"i:\";\n CPArray[\"!\"] = \"i::\";\n CPArray[\"#\"] = \"A:\";\n CPArray[\"a\"] = \"a:\";\n CPArray[\"$\"] = \"O:\";\n CPArray[\"u\"] = \"u:\";\n CPArray[\"3\"] = \"@:\";\n CPArray[\"y\"] = \"y:\";\n CPArray[\"(\"] = \"y::\";\n CPArray[\")\"] = \"E:\";\n CPArray[\"*\"] = \"Q:\";\n CPArray[\"<\"] = \"o:\";\n CPArray[\"e\"] = \"e:\";\n CPArray[\"|\"] = \"q:\";\n CPArray[\"o\"] = \"o:\";\n CPArray[\"1\"] = \"e\/\";\n CPArray[\"2\"] = \"a\/\";\n CPArray[\"4\"] = \"o\/\";\n CPArray[\"5\"] = \"O\/\";\n CPArray[\"6\"] = \"A\/\";\n CPArray[\"7\"] = \"I\/\";\n CPArray[\"8\"] = \"E\/\";\n CPArray[\"9\"] = \"U\/\";\n CPArray[\"K\"] = \"y\/\";\n CPArray[\"L\"] = \"q\/\";\n CPArray[\"M\"] = \"A\/\";\n CPArray[\"W\"] = \"a\/\";\n CPArray[\"B\"] = \"A\/\";\n CPArray[\"X\"] = \"o\/\";\n CPArray[\"I\"] = \"I\";\n CPArray[\"Y\"] = \"Y\";\n CPArray[\"E\"] = \"E\";\n CPArray[\"\/\"] = \"Q\";\n CPArray[\"{\"] = \"^\/\";\n CPArray[\"&\"] = \"a\";\n CPArray[\"A\"] = \"A\";\n CPArray[\"Q\"] = \"O\";\n CPArray[\"V\"] = \"^\";\n CPArray[\"O\"] = \"O\";\n CPArray[\"U\"] = \"U\";\n CPArray[\"}\"] = \"Y\/\";\n CPArray[\"@\"] = \"@\";\n CPArray[\"^\"] = \"Q~:\";\n CPArray[\"c\"] = \"^\/~\";\n CPArray[\"q\"] = \"A~:\";\n CPArray[\"0\"] = \"~\/~:\";\n CPArray[\"~\"] = \"O~:\";\n CPArray[\"-\"] = \".\";\n CPArray[\"'\"] = \"'\";\n CPArray[\"\\\"\"] = \"\\\"\";\n CPArray[\".\"] = \".\";\n \n if (Charset == \"SP\") {\n for (i=1; i <= nc; i++) {\n StringArray[i] = SPArray[StringArray[i]];\n String = String StringArray[i];\n }\n } \n if (Charset == \"CX\") {\n for (i=1; i <= nc; i++) {\n StringArray[i] = CXArray[StringArray[i]];\n String = String StringArray[i];\n }\n } \n if (Charset == \"CP\") {\n for (i=1; i <= nc; i++) {\n StringArray[i] = CPArray[StringArray[i]];\n String = String StringArray[i];\n }\n } \n return(String);\n}\n","avg_line_length":23.2908011869,"max_line_length":106,"alphanum_fraction":0.4203083195} {"size":1700,"ext":"awk","lang":"Awk","max_stars_count":1.0,"content":"# syntax: GAWK -f KNIGHTS_TOUR.AWK [-v sr=x] [-v sc=x]\n#\n# examples:\n# GAWK -f KNIGHTS_TOUR.AWK (default)\n# GAWK -f KNIGHTS_TOUR.AWK -v sr=1 -v sc=1 start at top left (default)\n# GAWK -f KNIGHTS_TOUR.AWK -v sr=1 -v sc=8 start at top right\n# GAWK -f KNIGHTS_TOUR.AWK -v sr=8 -v sc=8 start at bottom right\n# GAWK -f KNIGHTS_TOUR.AWK -v sr=8 -v sc=1 start at bottom left\n#\nBEGIN {\n N = 8 # board size\n if (sr == \"\") { sr = 1 } # starting row\n if (sc == \"\") { sc = 1 } # starting column\n split(\"2 2 -2 -2 1 1 -1 -1\",X,\" \")\n split(\"1 -1 1 -1 2 -2 2 -2\",Y,\" \")\n printf(\"\\n%dx%d board: starting row=%d col=%d\\n\",N,N,sr,sc)\n move(sr,sc,0)\n exit(1)\n}\nfunction move(x,y,m) {\n if (cantMove(x,y)) {\n return(0)\n }\n P[x,y] = ++m\n if (m == N ^ 2) {\n printBoard()\n exit(0)\n }\n tryBestMove(x,y,m)\n}\nfunction cantMove(x,y) {\n return( P[x,y] || x<1 || x>N || y<1 || y>N )\n}\nfunction tryBestMove(x,y,m, i) {\n i = bestMove(x,y)\n move(x+X[i],y+Y[i],m)\n}\nfunction bestMove(x,y, arg1,arg2,c,i,min,out) {\n# Warnsdorff's rule: go to where there are fewest next moves\n min = N ^ 2 + 1\n for (i in X) {\n arg1 = x + X[i]\n arg2 = y + Y[i]\n if (!cantMove(arg1,arg2)) {\n c = countNext(arg1,arg2)\n if (c < min) {\n min = c\n out = i\n }\n }\n }\n return(out)\n}\nfunction countNext(x,y, i,out) {\n for (i in X) {\n out += (!cantMove(x+X[i],y+Y[i]))\n }\n return(out)\n}\nfunction printBoard( i,j,leng) {\n leng = length(N*N)\n for (i=1; i<=N; i++) {\n for (j=1; j<=N; j++) {\n printf(\" %*d\",leng,P[i,j])\n }\n printf(\"\\n\")\n }\n}\n","avg_line_length":24.6376811594,"max_line_length":74,"alphanum_fraction":0.4911764706} {"size":436,"ext":"awk","lang":"Awk","max_stars_count":null,"content":"# s[] is array of match strings\n# r[] is array of match patterns\n\nNR > lines { next }\n\n{\n\tif (s[NR]) {\n\t\tif ($0 == s[NR])\n\t\t\tnext\n\t\tprint \"Line \" NR \" does not match expected string: \" s[NR]\n\t} else {\n\t\tif (match($0, r[NR]))\n\t\t\tnext\n\t\tprint \"Line \" NR \" does not match expected pattern: \" r[NR]\n\t}\n\n\tfail = 1\n}\n\nEND {\n\tif (fail == 0 && NR != lines) {\n\t\tfail = 1\n\t\tprint \"Expected \" lines \" lines, found \" NR \" line(s).\"\n\t}\n\texit fail\n}\n","avg_line_length":16.1481481481,"max_line_length":61,"alphanum_fraction":0.5527522936} {"size":114,"ext":"awk","lang":"Awk","max_stars_count":10.0,"content":"\n# TIME NVM AWK\n\n# See time-nvm.sh\n\nBEGIN {\n total = 0;\n}\n\n{ total = total + $4; }\n\nEND {\n print(total \/ NR);\n}\n","avg_line_length":7.6,"max_line_length":23,"alphanum_fraction":0.5175438596} {"size":259,"ext":"awk","lang":"Awk","max_stars_count":1.0,"content":"# sum the counts of the subsequent mask lines\nBEGIN {\n getline;\n count=$1;\n mask=$2;\n}\n{\n if ($2 == mask) {\n count += $1;\n } else {\n print count, mask;\n count = $1;\n mask = $2;\n }\n}\nEND {\n print count, mask;\n}\n","avg_line_length":13.6315789474,"max_line_length":45,"alphanum_fraction":0.4555984556} {"size":5471,"ext":"awk","lang":"Awk","max_stars_count":14.0,"content":"function abn_cmp(bna, bnb, bna_n, bnb_n, i) {\n sub(\/^0+\/, \"\", bna);\n sub(\/^0+\/, \"\", bnb);\n bna_n = length(bna)\n bnb_n = length(bnb)\n if(bna_n > bnb_n) {\n return 1;\n } else\n if(bnb_n > bna_n) {\n return -1\n } else {\n for(i = 1; i <= bna_n; i++) {\n if(substr(bna, i, 1) > substr(bnb, i, 1)) {\n return 1;\n } else\n if(substr(bnb, i, 1) > substr(bna, i, 1)) {\n return -1;\n }\n }\n }\n\n return 0;\n}\n\nfunction abn_divmod(bn_n, bn_d, bs_n,bs_d,QR) {\n if(bn_d == 0) return;\n\n bs_n = abn_d2b(bn_n)\n bs_d = abn_d2b(bn_d)\n split(abn_bdivmod(bs_n, bs_d), QR, \/,\/)\n return abn_b2d(QR[1])\",\"abn_b2d(QR[2])\n}\n\nfunction abn_sum(a, b) {\n return a+b;\n}\n\nfunction abn_exp(a, c) {\n return a ** c;\n}\n\nfunction abn_divmod_o(bn, d, bn_n,i,x,r,q,z,Q) {\n if(d == 0) return;\n\n r = 0\n q = \"\";\n bn_n = length(bn);\n for(i = 1; i <= bn_n; i++) {\n r = r substr(bn, 1, 1)\n bn = substr(bn, 2)\n if(r+0 >= d+0) {\n z = r % d\n q = q (r - z)\/d\n r = z\n } else {\n q = q \"0\"\n }\n }\n \n Q = q;\n bn = r;\n\n sub(\/^0+\/, \"\", Q);\n if(Q == \"\") {\n Q = 0;\n }\n sub(\/^0+\/, \"\", bn);\n if(bn == \"\") {\n bn = 0;\n }\n\n return Q\",\"bn\n}\n\nfunction abn_div(bn, d, q) {\n q = abn_divmod(bn, d);\n sub(\/,.*\/, \"\", q);\n return q\n}\n\nfunction abn_mod(bn, d, r) {\n r = abn_divmod(bn, d);\n sub(\/.*,\/, \"\", r);\n return r\n}\n\n\nfunction abn_b2d(bs, bs_n,s,i) {\n bs_n = length(bs)\n\n s = \"0\"\n for(i = 1; i <= bs_n; i++) {\n x = abn_exp(\"2\", bs_n-i)\n if(0+substr(bs, i, 1)) {\n s = abn_sum(s, x);\n }\n }\n\n return s\n}\n\nfunction abn_d2b(bn, bs,qr,QR,r) {\n bs = \"\";\n\n while(bn != \"0\") {\n qr = abn_divmod_o(bn, 2);\n split(qr, QR, \/,\/)\n bn = QR[1]\n r = QR[2]\n bs = r bs\n }\n \n return bs\n}\n\nfunction abn_bsl(bs, n) {\n for(; n > 0; n--) {\n bs = bs \"0\" \n }\n return bs;\n}\n\nfunction abn_bsr(bs, n, bs_n) {\n bs_n = length(bs)\n for(; n > 0; n--) {\n bs_n--;\n bs = substr(bs, 1, bs_n)\n }\n return bs\n}\n\nfunction abn_badd(bs_a, bs_b, c,bs_p,n,bs_r,a,i) {\n bs_p = abn_bpad(bs_a, bs_b)\n split(bs_p, BS, \/,\/)\n bs_a = BS[1]\n bs_b = BS[2]\n n = length(bs_a)\n c = 0\n bs_r = \"\"\n for(i = n; i > 0; i--) {\n a = substr(bs_a, i, 1) + substr(bs_b, i, 1) + c\n pc = c;\n c = 0;\n if(a == 2) {\n c = 1\n a = 0\n } else if(a == 3) {\n c = 1\n a = 1\n }\n\n bs_r = a bs_r;\n }\n\n return c bs_r;\n}\n\nfunction abn_bsub(bs_a, bs_b, bs_r,bs_p,BS) {\n bs_p = abn_bpad(\"0\"bs_a, \"0\"bs_b)\n split(bs_p, BS, \/,\/)\n bs_a = BS[1]\n bs_b = abn_badd(abn_bnot(BS[2]), \"1\")\n bs_r = substr(abn_badd(bs_a, bs_b), 3)\n sub(\/^0+\/, \"\", bs_r);\n return bs_r;\n}\n\nfunction abn_bmul(bs_a, bs_b, bs_a_n,bs_b_n,bs_x,bs_y,bs_x_n,s,i) {\n bs_a_n = length(bs_a)\n bs_b_n = length(bs_b)\n if(bs_a_n>bs_b_n) {\n bs_x_n = bs_b_n;\n bs_x = bs_b;\n bs_y = bs_a;\n } else {\n bs_x_n = bs_a_n;\n bs_x = bs_a;\n bs_y = bs_b;\n }\n\n s = \"0\"\n for(i = 1; i <= bs_x_n; i++) {\n if(0+substr(bs_x,i,1)) {\n s = abn_badd(abn_bsl(bs_y, bs_x_n-i), s);\n }\n }\n\n return s;\n}\n\nfunction abn_bdivmod(bs_n, bs_d, q,r,bs_n_n,bn_n_n,i,x) {\n if(bs_d == 0) return;\n\n bs_n_n = length(bs_n)\n q = \"0\"\n r = \"0\"\n for(i = 1; i <= bs_n_n; i++) {\n r = r substr(bs_n, i, 1)\n if(abn_cmp(r, bs_d) >= 0) {\n r = abn_bsub(r, bs_d);\n q = q \"1\"\n } else {\n q = q \"0\"\n }\n }\n\n if(r == \"\") {\n r = 0\n }\n\n return q\",\"r\n}\n\nfunction abn_bmod(bs, d, r) {\n r = abn_bdivmod(bs, d);\n sub(\/.*,\/, \"\", r);\n return r\n}\n\nfunction abn_bpad(bs_a, bs_b, i,delta,bs_a_n,bs_b_n) {\n bs_a_n = length(bs_a)\n bs_b_n = length(bs_b)\n\n delta = bs_a_n - bs_b_n\n\n if(delta != 0) {\n if(delta > 0) {\n first = 0\n bs_b_n += delta;\n } else {\n first = 1\n delta = -1*delta\n bs_a_n += delta;\n }\n\n for(i = 0; i < delta; i++) {\n if(first) {\n bs_a = \"0\" bs_a\n } else {\n bs_b = \"0\" bs_b\n }\n }\n }\n\n return bs_a\",\"bs_b\n}\n\nfunction abn_bnot(bs, bsn,i) {\n bs_n = length(bs)\n bsn = \"\";\n for(i = 1; i <= bs_n; i++) {\n bsn = bsn ((substr(bs,i,1)+0)?\"0\":\"1\")\n }\n return bsn\n}\n\nfunction abn_bor(bs, bsb) {\n}\n\nfunction abn_dec(bn, i,bn_n,x,y) {\n\n bn_n = length(bn)\n\n for(i = bn_n; i > 0; i--) {\n x = 0+substr(bn, i, 1)\n if(x == 0) {\n y = abn_dec(substr(bn, 1, i-1)) \"9\"\n sub(\/^0+\/, \"\", y);\n return y\n } else {\n y = substr(bn, 1, i-1) (x-1);\n sub(\/^0+\/, \"\", y);\n return y\n }\n }\n}\n\nfunction abn_bmodexp(b, e, m, i,r,bs,B,n) {\n r = 1\n\n n = split(e, B, \/\/)\n\n for(i = n; i > 0; i--) {\n if(B[i]+0 == 1) {\n r = abn_bmod(abn_bmul(r, b), m)\n }\n b = abn_bmod(abn_bmul(b, b), m)\n }\n\n sub(\/^0+\/, \"\", r);\n return r\n}\n\nfunction abn_modexp(b, e, m) {\n return abn_b2d(abn_bmodexp(abn_d2b(b), abn_d2b(e), abn_d2b(m)))\n}\n\n#BEGIN{\n{\n #print abn_divmod_o(404, 50)\n #print abn_d2b(21)\n #print abn_b2d(abn_bmul(abn_d2b(21), abn_d2b(21)))\n #print abn_divmod_o(11, 2)\n #print abn_divmod_o(404, 50)\n #print abn_divmod_o(2, 2)\n #print abn_d2b(1002)\n\n# Nx = 10000\n# Nx = 0\n# for(i = 0; i < Nx; i++) {\n# x = abn_b2d(abn_bmul(abn_d2b(i), abn_d2b(i)))\n# if(i*i == x) {\n# } else {\n# print i, x, i*i, \"BAD\"; break;\n# }\n# }\n\n #srand()\n ## b^(p-1) = 1 (mod p)\n #p = $1\n #pd = abn_dec(p)\n #R = 1\n #for(i = 0; i < 4; i++) {\n # b = int(1+ rand() * 10)\n # R *= abn_modexp(b, pd, p)==1?1:0\n #}\n #print R\n print abn_modexp($1,$2, $3)\n}\n","avg_line_length":16.5787878788,"max_line_length":69,"alphanum_fraction":0.4704807165} {"size":435,"ext":"awk","lang":"Awk","max_stars_count":1648.0,"content":"#!\/usr\/bin\/awk -f\n\nBEGIN {\n\tFS=\",\"\n\tformat_string=\"%s,%s,%s,%s\\n\"\n\tif (ARGV[1] == \"-t\") {\n\t\tformat_string=\"%-30s\\t%s\\t%13s\\t%13s\\n\"\n\t\tdelete ARGV[1]\n\t}\n\tprintf format_string, \"function\", \"count\", \"tot lat\", \"self lat\"\n}\n{\n\tif (NR==0) { next }\n\tnames[$1] = $1\n\tcounts[$1] += 1\n\tfnlat[$1] += $3 \/ 1000\n\tselflat[$1] += $4 \/ 1000\n}\nEND {\n\tfor (n in names) {\n\t\tf = fnlat[n]\n\t\ts = selflat[n]\n\t\tprintf format_string, n, counts[n], f, s\n\t}\n}\n\n","avg_line_length":16.1111111111,"max_line_length":65,"alphanum_fraction":0.5356321839}