[Nice-commit] Nice/stdlib/nice/getopt options.nice,1.5,1.6 gnugetopt.nice,1.2,1.3 getopt.nice,1.15,1
Brought to you by:
bonniot
From: <bo...@us...> - 2003-06-11 12:21:31
|
Update of /cvsroot/nice/Nice/stdlib/nice/getopt In directory sc8-pr-cvs1:/tmp/cvs-serv18530/stdlib/nice/getopt Modified Files: options.nice gnugetopt.nice getopt.nice Log Message: char is no longer a subtype of int. Index: options.nice =================================================================== RCS file: /cvsroot/nice/Nice/stdlib/nice/getopt/options.nice,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** options.nice 22 Jan 2003 17:10:13 -0000 1.5 --- options.nice 11 Jun 2003 12:21:27 -0000 1.6 *************** *** 50,54 **** String longName; String purpose; ! int optval = 0; // the int value of shortName boolean visible; --- 50,54 ---- String longName; String purpose; ! char optval = '\0'; boolean visible; Index: gnugetopt.nice =================================================================== RCS file: /cvsroot/nice/Nice/stdlib/nice/getopt/gnugetopt.nice,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** gnugetopt.nice 28 Apr 2003 23:28:47 -0000 1.2 --- gnugetopt.nice 11 Jun 2003 12:21:27 -0000 1.3 *************** *** 37,41 **** private boolean endparse = false; private boolean opterr = true; ! private int optopt = '?'; private int optind = 0; private int longind = 0; --- 37,41 ---- private boolean endparse = false; private boolean opterr = true; ! private char optopt = '?'; private int optind = 0; private int longind = 0; *************** *** 99,103 **** } ! public int getOptopt() = optopt; public int getLongind() = longind; --- 99,103 ---- } ! public char getOptopt() = optopt; public int getLongind() = longind; *************** *** 152,156 **** } ! private int checkLongOption() { ?LongOpt pfound = null; --- 152,156 ---- } ! private char checkLongOption() { ?LongOpt pfound = null; *************** *** 201,207 **** nextchar = ""; ! optopt = 0; ++optind; ! return('?'); } --- 201,207 ---- nextchar = ""; ! optopt = '\0'; ++optind; ! return '?'; } *************** *** 233,237 **** nextchar = ""; optopt = pfound.val; ! return('?'); } } // if (nameend) --- 233,237 ---- nextchar = ""; optopt = pfound.val; ! return '?'; } } // if (nameend) *************** *** 260,264 **** sb.setLength(0); sb.append(pfound.val); ! return(0); } --- 260,264 ---- sb.setLength(0); sb.append(pfound.val); ! return '\0'; } *************** *** 268,280 **** longopt_handled = false; ! return(0); } ! public int getopt() { optarg = null; if (endparse == true) ! return(-1); if ((nextchar == null) || (nextchar.equals(""))) --- 268,280 ---- longopt_handled = false; ! return '\0'; } ! public char getopt() { optarg = null; if (endparse == true) ! return '\1'; if ((nextchar == null) || (nextchar.equals(""))) *************** *** 333,337 **** optind = first_nonopt; ! return(-1); } --- 333,337 ---- optind = first_nonopt; ! return '\1'; } *************** *** 342,349 **** { if (ordering == REQUIRE_ORDER) ! return(-1); optarg = argv[optind++]; ! return(1); } --- 342,349 ---- { if (ordering == REQUIRE_ORDER) ! return '\1'; optarg = argv[optind++]; ! return '\2'; } *************** *** 374,381 **** (optstring.indexOf(argv[optind].charAt(1)) == -1))))) { ! int c = this.checkLongOption(); if (longopt_handled) ! return(c); // Can't find it as a long option. If this is not getopt_long_only, --- 374,381 ---- (optstring.indexOf(argv[optind].charAt(1)) == -1))))) { ! char c = this.checkLongOption(); if (longopt_handled) ! return c; // Can't find it as a long option. If this is not getopt_long_only, *************** *** 396,406 **** nextchar = ""; ++optind; ! optopt = 0; ! return('?'); } } // if (longopts) // Look at and handle the next short option-character */ ! int c = (nextchar || "").charAt(0); //**** Do we need to check for empty str? if ((nextchar || "").length() > 1) nextchar = (nextchar || "").substring(1); --- 396,406 ---- nextchar = ""; ++optind; ! optopt = '\0'; ! return '?'; } } // if (longopts) // Look at and handle the next short option-character */ ! char c = notNull(nextchar).charAt(0); //**** Do we need to check for empty str? if ((nextchar || "").length() > 1) nextchar = (nextchar || "").substring(1); *************** *** 422,426 **** System.err.println(progname+": illegal option -- "+this.toString()); else ! System.err.println(progname+": invalid option -- "+char(c).toString()); } --- 422,426 ---- System.err.println(progname+": illegal option -- "+this.toString()); else ! System.err.println(progname+": invalid option -- "+c.toString()); } *************** *** 440,444 **** { if (opterr) ! System.err.println(progname+": option '"+char(c).toString()+"' doesn't allow an argument"); optopt = c; --- 440,444 ---- { if (opterr) ! System.err.println(progname+": option '"+c.toString()+"' doesn't allow an argument"); optopt = c; *************** *** 493,497 **** { if (opterr) ! System.err.println(progname+": option requires an argument -- "+char(c).toString()); optopt = c; --- 493,497 ---- { if (opterr) ! System.err.println(progname+": option requires an argument -- "+c.toString()); optopt = c; *************** *** 513,517 **** { if (opterr) ! System.err.println(progname+": option requires an argument -- "+char(c).toString()); optopt = c; --- 513,517 ---- { if (opterr) ! System.err.println(progname+": option requires an argument -- "+c.toString()); optopt = c; *************** *** 550,554 **** private int has_arg; private ?StringBuffer flag = null; ! private int val; public void initLongOpt() //throws IllegalArgumentException --- 550,554 ---- private int has_arg; private ?StringBuffer flag = null; ! private char val; public void initLongOpt() //throws IllegalArgumentException *************** *** 568,572 **** public ?StringBuffer getFlag() = flag; ! public int getVal() = val; } // Class LongOpt --- 568,572 ---- public ?StringBuffer getFlag() = flag; ! public char getVal() = val; } // Class LongOpt Index: getopt.nice =================================================================== RCS file: /cvsroot/nice/Nice/stdlib/nice/getopt/getopt.nice,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** getopt.nice 31 Mar 2003 19:15:11 -0000 1.15 --- getopt.nice 11 Jun 2003 12:21:27 -0000 1.16 *************** *** 31,35 **** { uniqId = uniqId+1; ! l = new LongOpt(name:o.longName, has_arg:optType(o), val:uniqId); } else --- 31,35 ---- { uniqId = uniqId+1; ! l = new LongOpt(name:o.longName, has_arg:optType(o), val:char(uniqId)); } else *************** *** 49,57 **** longOpts[i] = longOptions.get(i); Getopt g = new Getopt(progname: progName, argv: args, optstring: shortOptions, ! long_options: cast(longOpts)); g.initGetopt(); // Parsing loop ! int c = g.getopt(); ! while (c != -1) { ?Option chosen = options.find(Option o => o.optval == c); --- 49,57 ---- longOpts[i] = longOptions.get(i); Getopt g = new Getopt(progname: progName, argv: args, optstring: shortOptions, ! long_options: elementsNotNull(longOpts)); g.initGetopt(); // Parsing loop ! char c = g.getopt(); ! while (c != '\1') { ?Option chosen = options.find(Option o => o.optval == c); |