119dacda2b02bb08c0ffb649f84526b249c749279The Android Open Source Project/^command_table / { 219dacda2b02bb08c0ffb649f84526b249c749279The Android Open Source Project cmdtbl = $2; 319dacda2b02bb08c0ffb649f84526b249c749279The Android Open Source Project printf "/* %s.c - automatically generated from %s.ct */\n", \ 419dacda2b02bb08c0ffb649f84526b249c749279The Android Open Source Project rootname, rootname > outfile 519dacda2b02bb08c0ffb649f84526b249c749279The Android Open Source Project print "#include <ss/ss.h>" > outfile 619dacda2b02bb08c0ffb649f84526b249c749279The Android Open Source Project print "" >outfile 719dacda2b02bb08c0ffb649f84526b249c749279The Android Open Source Project} 819dacda2b02bb08c0ffb649f84526b249c749279The Android Open Source Project 919dacda2b02bb08c0ffb649f84526b249c749279The Android Open Source Project/^BOR$/ { 1019dacda2b02bb08c0ffb649f84526b249c749279The Android Open Source Project cmdnum++ 1119dacda2b02bb08c0ffb649f84526b249c749279The Android Open Source Project options = 0 1219dacda2b02bb08c0ffb649f84526b249c749279The Android Open Source Project cmdtab = "" 1319dacda2b02bb08c0ffb649f84526b249c749279The Android Open Source Project printf "static char const * const ssu%05d[] = {\n", cmdnum > outfile 1419dacda2b02bb08c0ffb649f84526b249c749279The Android Open Source Project} 1519dacda2b02bb08c0ffb649f84526b249c749279The Android Open Source Project 1619dacda2b02bb08c0ffb649f84526b249c749279The Android Open Source Project/^sub/ { 1719dacda2b02bb08c0ffb649f84526b249c749279The Android Open Source Project subr = substr($0, 6, length($0)-5) 1819dacda2b02bb08c0ffb649f84526b249c749279The Android Open Source Project} 1919dacda2b02bb08c0ffb649f84526b249c749279The Android Open Source Project 2019dacda2b02bb08c0ffb649f84526b249c749279The Android Open Source Project/^hlp/ { 2119dacda2b02bb08c0ffb649f84526b249c749279The Android Open Source Project help = substr($0, 6, length($0)-5) 2219dacda2b02bb08c0ffb649f84526b249c749279The Android Open Source Project} 2319dacda2b02bb08c0ffb649f84526b249c749279The Android Open Source Project 2419dacda2b02bb08c0ffb649f84526b249c749279The Android Open Source Project/^cmd/ { 2519dacda2b02bb08c0ffb649f84526b249c749279The Android Open Source Project cmd = substr($0, 6, length($0)-5) 2619dacda2b02bb08c0ffb649f84526b249c749279The Android Open Source Project printf "%s\"%s\",\n", cmdtab, cmd > outfile 2719dacda2b02bb08c0ffb649f84526b249c749279The Android Open Source Project cmdtab = " " 2819dacda2b02bb08c0ffb649f84526b249c749279The Android Open Source Project} 2919dacda2b02bb08c0ffb649f84526b249c749279The Android Open Source Project 3019dacda2b02bb08c0ffb649f84526b249c749279The Android Open Source Project/^opt/ { 3119dacda2b02bb08c0ffb649f84526b249c749279The Android Open Source Project opt = substr($0, 6, length($0)-5) 3219dacda2b02bb08c0ffb649f84526b249c749279The Android Open Source Project if (opt == "dont_list") { 3319dacda2b02bb08c0ffb649f84526b249c749279The Android Open Source Project options += 1 3419dacda2b02bb08c0ffb649f84526b249c749279The Android Open Source Project } 3519dacda2b02bb08c0ffb649f84526b249c749279The Android Open Source Project if (opt == "dont_summarize") { 3619dacda2b02bb08c0ffb649f84526b249c749279The Android Open Source Project options += 2 3719dacda2b02bb08c0ffb649f84526b249c749279The Android Open Source Project } 3819dacda2b02bb08c0ffb649f84526b249c749279The Android Open Source Project} 3919dacda2b02bb08c0ffb649f84526b249c749279The Android Open Source Project 4019dacda2b02bb08c0ffb649f84526b249c749279The Android Open Source Project/^EOR/ { 4119dacda2b02bb08c0ffb649f84526b249c749279The Android Open Source Project print " (char const *)0" > outfile 4219dacda2b02bb08c0ffb649f84526b249c749279The Android Open Source Project print "};" > outfile 4319dacda2b02bb08c0ffb649f84526b249c749279The Android Open Source Project printf "extern void %s __SS_PROTO;\n", subr > outfile 4419dacda2b02bb08c0ffb649f84526b249c749279The Android Open Source Project # Work around a bug in gawk 3.0.5 4519dacda2b02bb08c0ffb649f84526b249c749279The Android Open Source Project awk_bug = cmdnum 4619dacda2b02bb08c0ffb649f84526b249c749279The Android Open Source Project subr_tab[awk_bug] = subr 4719dacda2b02bb08c0ffb649f84526b249c749279The Android Open Source Project options_tab[awk_bug] = options 4819dacda2b02bb08c0ffb649f84526b249c749279The Android Open Source Project help_tab[awk_bug] = help 4919dacda2b02bb08c0ffb649f84526b249c749279The Android Open Source Project} 5019dacda2b02bb08c0ffb649f84526b249c749279The Android Open Source Project 5119dacda2b02bb08c0ffb649f84526b249c749279The Android Open Source Project/^[0-9]/ { 5219dacda2b02bb08c0ffb649f84526b249c749279The Android Open Source Project linenum = $1; 5319dacda2b02bb08c0ffb649f84526b249c749279The Android Open Source Project} 5419dacda2b02bb08c0ffb649f84526b249c749279The Android Open Source Project 5519dacda2b02bb08c0ffb649f84526b249c749279The Android Open Source Project/^ERROR/ { 5619dacda2b02bb08c0ffb649f84526b249c749279The Android Open Source Project error = substr($0, 8, length($0)-7) 5719dacda2b02bb08c0ffb649f84526b249c749279The Android Open Source Project printf "Error in line %d: %s\n", linenum, error 5819dacda2b02bb08c0ffb649f84526b249c749279The Android Open Source Project print "#__ERROR_IN_FILE__" > outfile 5919dacda2b02bb08c0ffb649f84526b249c749279The Android Open Source Project} 6019dacda2b02bb08c0ffb649f84526b249c749279The Android Open Source Project 6119dacda2b02bb08c0ffb649f84526b249c749279The Android Open Source ProjectEND { 6219dacda2b02bb08c0ffb649f84526b249c749279The Android Open Source Project printf "static ss_request_entry ssu%05d[] = {\n", cmdnum+1 > outfile 6319dacda2b02bb08c0ffb649f84526b249c749279The Android Open Source Project for (i=1; i <= cmdnum; i++) { 6419dacda2b02bb08c0ffb649f84526b249c749279The Android Open Source Project printf " { ssu%05d,\n", i > outfile 6519dacda2b02bb08c0ffb649f84526b249c749279The Android Open Source Project printf " %s,\n", subr_tab[i] > outfile 6619dacda2b02bb08c0ffb649f84526b249c749279The Android Open Source Project printf " \"%s\",\n", help_tab[i] > outfile 6719dacda2b02bb08c0ffb649f84526b249c749279The Android Open Source Project printf " %d },\n", options_tab[i] > outfile 6819dacda2b02bb08c0ffb649f84526b249c749279The Android Open Source Project } 6919dacda2b02bb08c0ffb649f84526b249c749279The Android Open Source Project print " { 0, 0, 0, 0 }" > outfile 7019dacda2b02bb08c0ffb649f84526b249c749279The Android Open Source Project print "};" > outfile 7119dacda2b02bb08c0ffb649f84526b249c749279The Android Open Source Project print "" > outfile 7219dacda2b02bb08c0ffb649f84526b249c749279The Android Open Source Project printf "ss_request_table %s = { 2, ssu%05d };\n", \ 7319dacda2b02bb08c0ffb649f84526b249c749279The Android Open Source Project cmdtbl, cmdnum+1 > outfile 7419dacda2b02bb08c0ffb649f84526b249c749279The Android Open Source Project} 7519dacda2b02bb08c0ffb649f84526b249c749279The Android Open Source Project 76