[svn:parrot] r44670 - in branches/ops_pct/compilers/opsc: src/Ops t
bacek at svn.parrot.org
bacek at svn.parrot.org
Fri Mar 5 23:51:03 UTC 2010
Author: bacek
Date: Fri Mar 5 23:51:02 2010
New Revision: 44670
URL: https://trac.parrot.org/parrot/changeset/44670
Log:
Emit preamble
Modified:
branches/ops_pct/compilers/opsc/src/Ops/Emitter.pm
branches/ops_pct/compilers/opsc/t/06-emitter.t
Modified: branches/ops_pct/compilers/opsc/src/Ops/Emitter.pm
==============================================================================
--- branches/ops_pct/compilers/opsc/src/Ops/Emitter.pm Fri Mar 5 23:50:36 2010 (r44669)
+++ branches/ops_pct/compilers/opsc/src/Ops/Emitter.pm Fri Mar 5 23:51:02 2010 (r44670)
@@ -26,7 +26,6 @@
self<include> := "parrot/oplib/$base_ops_h";
self<header> := (~%flags<dir>) ~ "include/" ~ self<include>;
-
self;
};
@@ -48,6 +47,8 @@
self._emit_guard_prefix($fh);
+ self._emit_preamble($fh);
+
self._emit_guard_suffix($fh);
self._emit_coda($fh);
@@ -98,4 +99,17 @@
|);
}
+method _emit_preamble($fh) {
+ $fh.print(qq|
+/* ex: set ro:
+ * !!!!!!! DO NOT EDIT THIS FILE !!!!!!!
+ *
+ * This file is generated automatically from '{self<file>}' (and possibly other
+ * .ops files). by {self<script>}.
+ *
+ * Any changes made here will be lost!
+ *
+ */
+|);
+}
# vim: expandtab shiftwidth=4 ft=perl6:
Modified: branches/ops_pct/compilers/opsc/t/06-emitter.t
==============================================================================
--- branches/ops_pct/compilers/opsc/t/06-emitter.t Fri Mar 5 23:50:36 2010 (r44669)
+++ branches/ops_pct/compilers/opsc/t/06-emitter.t Fri Mar 5 23:51:02 2010 (r44670)
@@ -3,7 +3,7 @@
pir::load_bytecode("compilers/opsc/opsc.pbc");
pir::load_bytecode("nqp-settings.pbc");
-plan(5);
+plan(6);
my $trans := Ops::Trans::C.new();
@@ -26,7 +26,8 @@
ok( $emitter<header> ~~ /^tmp/, 'header file in tmp');
say('# ' ~ $emitter<header>);
-#my $header := $emitter.print_c_header_file();
+#$emitter.print_c_header_file();
+
my $fh := pir::new__Ps('StringHandle');
$fh.open('header.h', 'w');
$emitter.emit_c_header_file($fh);
@@ -36,5 +37,6 @@
ok($header ~~ /define \s PARROT_OPLIB_CORE_OPS_H_GUARD/, 'Guard generated');
ok($header ~~ /endif/, 'Close guard generated');
+ok($header ~~ /DO \s NOT \s EDIT \s THIS \s FILE/, 'Preamble generated');
# vim: expandtab shiftwidth=4 ft=perl6:
More information about the parrot-commits
mailing list