Permalink
Browse files

resolve conflict in opsc

  • Loading branch information...
1 parent 2ee457e commit c59b533b05f0c37059194f6060734948cfab40e4 luben committed with Reini Urban May 28, 2011
Showing with 9 additions and 58 deletions.
  1. +0 −1 MANIFEST
  2. +7 −47 compilers/opsc/ops2c.nqp
  3. +1 −9 compilers/opsc/src/Ops/Compiler/Actions.pm
  4. +1 −1 compilers/opsc/src/Ops/File.pm
View
@@ -81,7 +81,6 @@ compilers/opsc/src/Ops/Op.pm [opsc]
compilers/opsc/src/Ops/OpLib.pm [opsc]
compilers/opsc/src/Ops/Trans.pm [opsc]
compilers/opsc/src/Ops/Trans/C.pm [opsc]
-compilers/opsc/src/Ops/Util.pm [opsc]
compilers/opsc/src/builtins.pir [opsc]
compilers/pct/Defines.mak [pct]
compilers/pct/PCT.pir [pct]
View
@@ -58,54 +58,17 @@ sub MAIN() {
)
!! undef;
- my $f;
- my $do_dump_file := 0;
- my $do_load := 1;
- my $dump_file := $core ?? 'src/ops/ops.dump' !! @files[0] ~ ".dump";
- if $opts<dump> {
- try {
- my $fh := open($dump_file, :r, :bin);
- my $dump := $fh.readall;
- $fh.close();
-
- $f := pir::thaw__ps($dump);
- $do_load := 0;
-
- CATCH {
- $quiet || pir::say("# Caught $!");
- $do_dump_file := 1;
- $f := undef;
- };
- }
- }
-
- if $do_load {
- $f := Ops::File.new(|@files,
- :oplib($lib),
- :core($core),
- :quiet($quiet),
- );
- }
-
- if $do_dump_file {
- $quiet || say("Dumping");
- my $capture := Ops::Util::strip_source($f);
- my $frozen := pir::freeze__sp($capture);
-
- my $fh := open($dump_file, :w, :bin);
- $fh.print($frozen);
- $fh.close();
- }
+ my $f := Ops::File.new(|@files, :oplib($lib), :core($core), :quiet($quiet));
$quiet || say("# Ops parsed in { pir::sprintf__ssp("%.3f", [pir::time__N() - $start_time] ) } seconds.");
+
+ my $emitter := Ops::Emitter.new(
+ :ops_file($f), :trans($trans),
+ :script('ops2c.nqp'), :file(@files[0]),
+ :flags( hash( core => $core, quiet => $quiet ) ),
+ );
unless $debug {
- my $emitter := Ops::Emitter.new(
- :ops_file($f), :trans($trans),
- :script('ops2c.nqp'), :file(@files[0]),
- :flags( hash( core => $core, quiet => $quiet ) ),
- );
-
$emitter.print_ops_num_files() if $core;
$emitter.print_c_header_files();
$emitter.print_c_source_file();
@@ -135,9 +98,6 @@ sub get_options() {
# suppress timing and debug output on stdout
$getopts.add_option('quiet', 'q');
- # Use .dump files with parsed ops.
- $getopts.add_option('dump', 'D');
-
$getopts.get_options(pir::getinterp__p()[2]);
}
@@ -104,7 +104,7 @@ method op ($/, $key?) {
my @variants := expand_args(pir::clone__PP($OP<normalized_args>));
if @variants {
for @variants {
- my $new_op := deep_clone($OP);
+ my $new_op := pir::clone__PP($OP);
$new_op<arg_types> := $_;
$past.push($new_op);
}
@@ -117,12 +117,6 @@ method op ($/, $key?) {
}
}
-sub deep_clone($thingy) {
- Ops::Util::process_recursive($thingy, -> $_ {
- $_.WHAT.new;
- });
-}
-
# Normalize args
# For each arg produce LoL of all available variants
# E.g. "in" will produce "i" and "ic" variants
@@ -173,8 +167,6 @@ sub normalize_args(@args) {
$res<direction> := 'o';
}
- #$arg<type> := $res<type>;
-
@result.push($res);
}
@result;
@@ -181,7 +181,7 @@ ops file.
=end
-method new(*@files, :$oplib, :$core, :$nolines, :$quiet? = 0) {
+method new(*@files, :$oplib, :$core!, :$nolines, :$quiet? = 0) {
self<files> := @files;
self<core> := $core;
self<ops> := list(); # Ops

0 comments on commit c59b533

Please sign in to comment.