# # Awk script for generating a .c file from a .mdf file # BEGIN { printf("/* Automatically generated - do not edit! */\n"); printf("\n"); printf("#include \n"); printf("#include \n"); printf("\n"); firsttime = 1 } # for run-time loadable modules, dynamic is set to 1 by the calling script { if (firsttime > 0) { if (dynamic > 0) printf("DXEntry()\n"); else printf("_dxf_user_modules()\n"); printf("{\n"); firsttime = 0; } } # comments in the .mdf file start with '#' in the first column /^#/ { next } # output the previous module definition when the next module definition starts # (for the first module definition, there is no previous module definition, # and at the end of file, the last module definition must be output.) /^MODULE/ { if (module!="") { printf(" {\n") printf(" extern Error %s(Object *, Object *);\n", funcname) printf(" DXAddModule(\"%s\", %s, ", module, funcname) if (flags=="") printf("0") else printf("\n %s", flags) printf(",\n %d", ninputs + input_repeat*20) for (i=0; i 1) { split(a[2], b, " "); outboard_host = b[1] } # this finds either a string in quotes or a single token # in the new version of awk only. the match() function # doesn't exist on some of the other supported platforms #if (match(a[1], "\".+\"") > 0) # outboard_exec = substr($0, RSTART+1, RLENGTH-2) #else { # split(a[1], b, " ") # outboard_exec = b[2] #} # attempt at straight awk replacement code if (a[1] ~ /\".+\"/) { ns = split(a[1], b, "\"") outboard_exec = b[2] for (i=3; i=2) count = $2+0 else count = 1 if (noutputs==0) input_repeat = count else output_repeat = count } # output last module definition. this code must match the code in the # /^MODULE/ section (plus a final '}' to end the subroutine.) END { if (module!="") { printf(" {\n") printf(" extern Error %s(Object *, Object *);\n", funcname) printf(" DXAddModule(\"%s\", %s, ", module, funcname) if (flags=="") printf("0") else printf("\n %s", flags) printf(",\n %d", ninputs + input_repeat*20) for (i=0; i