Skip to content
This repository has been archived by the owner on Feb 3, 2021. It is now read-only.

Commit

Permalink
Turn proccess_args into NQP.
Browse files Browse the repository at this point in the history
  • Loading branch information
jnthn committed Jan 9, 2011
1 parent 3a05d0d commit 2ac9555
Showing 1 changed file with 11 additions and 23 deletions.
34 changes: 11 additions & 23 deletions src/HLL/Compiler.pm
Original file line number Diff line number Diff line change
Expand Up @@ -415,29 +415,17 @@ class HLL::Compiler {
}

method process_args(@args) {
Q:PIR {
load_bytecode 'Getopt/Obj.pbc'
.local pmc args
args = find_lex '@args'
.local string arg0
arg0 = shift args
self.'compiler_progname'(arg0)
.local pmc getopts
getopts = new ['Getopt';'Obj']
getopts.'notOptStop'(1)
$P0 = getattribute self, '@!cmdoptions'
.local pmc it
it = iter $P0
getopts_loop:
unless it goto getopts_end
$S0 = shift it
push getopts, $S0
goto getopts_loop
getopts_end:
.tailcall getopts.'get_options'(args)
};
# First argument is the program name.
self.compiler_progname(@args.shift);

# Use Getopt::Obj to proccess the rest.
pir::load_bytecode('Getopt/Obj.pbc');
my $getopts := Q:PIR { %r = new ['Getopt';'Obj'] };
$getopts.notOptStop(1);
for @!cmdoptions {
pir::push__vPs($getopts, $_)
}
$getopts.get_options(@args);
}

method evalfiles(@files, *@args, *%adverbs) {
Expand Down

0 comments on commit 2ac9555

Please sign in to comment.