diff --git a/bin/make_ci.pike b/bin/make_ci.pike index 3c9dfe849a8014c60d1b0a8dd56a109c1da3e652..ebe22962657bb9655b626379cae62f8a3625896c 100644 --- a/bin/make_ci.pike +++ b/bin/make_ci.pike @@ -1,5 +1,7 @@ +#! /usr/bin/env pike + /* - * $Id: make_ci.pike,v 1.9 2003/02/10 12:27:16 mast Exp $ + * $Id: make_ci.pike,v 1.10 2003/11/19 16:47:46 nilsson Exp $ * * Creates the file case_info.h * @@ -20,11 +22,11 @@ int main(int argc, array(string) argv) array(array(int)) ci = ({({ 0, CIM_NONE, 0 })}); int prevchar = 0; - if (argc < 2) { - werror("Missing argument.\n" + if (argc < 2 || argv[1]=="--help" ) { + werror("Creates case info file by reading the unicode database from\n" + "stdin and outputs it to a file.\n" "\n" - "Usage:\n" - "\t%s case_info.h\n", argv[0]); + "Usage: make_ci.pike output_file.h\n"); exit(1); } @@ -110,7 +112,7 @@ int main(int argc, array(string) argv) outfile-> write(sprintf("/*\n" " * Created by\n" - " * $Id: make_ci.pike,v 1.9 2003/02/10 12:27:16 mast Exp $\n" + " * $Id: make_ci.pike,v 1.10 2003/11/19 16:47:46 nilsson Exp $\n" " * on %s" " *\n" " * Table used for looking up the case of\n" diff --git a/bin/make_interpret_functions.pike b/bin/make_interpret_functions.pike index 822f371bc718e05d1130474b0771861ef6a5b1d5..2db61cabdeb6c2b6e062f02b06aa80bc1981f1ea 100644 --- a/bin/make_interpret_functions.pike +++ b/bin/make_interpret_functions.pike @@ -1,12 +1,5 @@ #! /usr/bin/env pike -#ifdef OLD -import OLD; -#define PC Pike -#else /* !OLD */ -#define PC Parser.Pike -#endif /* OLD */ - mapping ops=([]); array fixit2(array x) @@ -18,7 +11,7 @@ array fixit2(array x) if(objectp(x[e]) && ops[(string)x[e]]) { opcodes+=x[e..e]+fixit2(x[e+1])[0]; - array tmp=fixit2((x[e+1]/ ({ PC.Token(",") }) )[-1][0]); + array tmp=fixit2((x[e+1]/ ({ Parser.Pike.Token(",") }) )[-1][0]); ret+=({ tmp[0] }); opcodes+=tmp[1]; @@ -69,7 +62,7 @@ array fixit(array x) array filter_out_cases(array x) { - array y=x/({ PC.Token("CASE") }); + array y=x/({ Parser.Pike.Token("CASE") }); for(int e=1;e<sizeof(y);e++) y[e]=y[e][1..]; return y*({}); } @@ -82,25 +75,25 @@ array fix_cases(array x) while(1) { - int casepos=search(x,PC.Token("CASE"), start); - //werror("%O\n",PC.simple_reconstitute(x[casepos..casepos+1])); + int casepos=search(x,Parser.Pike.Token("CASE"), start); + //werror("%O\n",Parser.Pike.simple_reconstitute(x[casepos..casepos+1])); if(casepos == -1) break; - int donepos=search(x,PC.Token("DONE"),casepos+1); + int donepos=search(x,Parser.Pike.Token("DONE"),casepos+1); ret+=x[undone..casepos-1]+ ({ - PC.Token("OPCODE0"), + Parser.Pike.Token("OPCODE0"), ({ - PC.Token("("), + Parser.Pike.Token("("), x[casepos+1][1], - PC.Token(","), - PC.Token(sprintf("%O",(string)x[casepos+1][1])), - PC.Token(","), - ({ PC.Token("{") })+ + Parser.Pike.Token(","), + Parser.Pike.Token(sprintf("%O",(string)x[casepos+1][1])), + Parser.Pike.Token(","), + ({ Parser.Pike.Token("{") })+ filter_out_cases(x[casepos+2..donepos-1])+ - ({ PC.Token("}") }), - PC.Token(")"), - PC.Token(";"), + ({ Parser.Pike.Token("}") }), + Parser.Pike.Token(")"), + Parser.Pike.Token(";"), }) }); @@ -113,12 +106,18 @@ array fix_cases(array x) int main(int argc, array(string) argv) { + if(argc<2 || argv[1]=="--help") { + werror("Generates interpret_functions_fixed.h from interpret_functions.h\n" + "Usage: make_interpret_functions.pike interpret_functions.h > outfile\n"); + return 1; + } + string file=argv[1]; mixed x=Stdio.read_file(file); - x=PC.split(x); - x=PC.tokenize(x,file); - x=PC.hide_whitespaces(x); - x=PC.group(x); + x=Parser.Pike.split(x); + x=Parser.Pike.tokenize(x,file); + x=Parser.Pike.hide_whitespaces(x); + x=Parser.Pike.group(x); for(int e=0;e<=2;e++) { foreach( ({"","TAIL"}), string tail) { @@ -130,13 +129,11 @@ int main(int argc, array(string) argv) } } -// werror("%O\n",ops); - x=fix_cases(x); x=fixit(x); if(getenv("PIKE_DEBUG_PRECOMPILER")) - write(PC.simple_reconstitute(x)); + write(Parser.Pike.simple_reconstitute(x)); else - write(PC.reconstitute_with_line_numbers(x)); + write(Parser.Pike.reconstitute_with_line_numbers(x)); }