On Sun, 24 Oct 2004, Leopold Toetsch wrote:
> We have since quite a time the support for creating native executables
> on some platforms. This functionality is not tested at all. The Makefile
> has just one very simple rule to create a "Hello world"-like program
> with "make testexec".
The Makefile target attempts to create a simple file containing:
print "Hello World\n"
end
Alas, it's hard to create that file portably. In particular,
echo 'print "Hello World\n"'
gives different results with different 'echo' commands. The
default bash behavior is to pass the \n on through. The default
ksh behavior is to interpolate the \n and replace it by an actual
newline. Adding the -e flag to bash's echo command forces it to
act like ksh, but ksh complains about the unrecognized -e option.
The symptom of this is the following rather mysterious error message:
error:imcc:op not found 'print' (print<0>)
in file 'hello.pasm' line 1
We could use a perl one-liner in place of echo, but getting all the quotes
right across different operating systems is still hard.
This patch takes a simpler approach: it creates a new file
examples/assembly/hello.pasm, and just uses that.
It still doesn't work on Solaris/SPARC. I now get
error:imcc:main: can't produce object file*** Error code 1
but that's to be expected because the code simply isn't written yet to
produce native executables on this platform.
diff -r -u -N parrot-orig/MANIFEST parrot-andy/MANIFEST
--- parrot-orig/MANIFEST Mon Oct 25 10:56:52 2004
+++ parrot-andy/MANIFEST Tue Oct 26 13:04:53 2004
@@ -378,6 +378,7 @@
examples/assembly/fact.pasm [main]doc
examples/assembly/getopt_demo.imc [main]doc
examples/assembly/hanoi.pasm [main]doc
+examples/assembly/hello.pasm [main]doc
examples/assembly/hello-dwim.imc [main]doc
examples/assembly/io1.pasm [main]doc
examples/assembly/io2.pasm [main]doc
diff -r -u -N parrot-orig/config/gen/makefiles/root.in
parrot-andy/config/gen/makefiles/root.in
--- parrot-orig/config/gen/makefiles/root.in Tue Oct 12 08:40:16 2004
+++ parrot-andy/config/gen/makefiles/root.in Tue Oct 26 13:03:28 2004
@@ -1280,16 +1280,12 @@
testexec: hello-parrot hello-clean
hello-clean:
- @$(RM_F) hello.pasm hello$(O) hello
+ @$(RM_F) hello.pbc hello$(O) hello
hello-parrot: hello
-hello.pasm:
- echo 'print "Hello World\n"' > hello.pasm
- echo 'end' >> hello.pasm
-
-hello.pbc: hello.pasm
- ./parrot -o hello.pbc hello.pasm
+hello.pbc: examples/assembly/hello.pasm
+ ./parrot -o hello.pbc examples/assembly/hello.pasm
hello$(O): hello.pbc
./parrot -o hello$(O) hello.pbc
diff -r -u -N parrot-orig/examples/assembly/hello.pasm
parrot-andy/examples/assembly/hello.pasm
--- parrot-orig/examples/assembly/hello.pasm Wed Dec 31 19:00:00 1969
+++ parrot-andy/examples/assembly/hello.pasm Tue Oct 26 13:04:11 2004
@@ -0,0 +1,2 @@
+print "Hello World\n"
+end
diff -r -u -N parrot-orig/hello.pasm parrot-andy/hello.pasm
--- parrot-orig/hello.pasm Wed Dec 31 19:00:00 1969
+++ parrot-andy/hello.pasm Tue Oct 26 15:56:02 2004
@@ -0,0 +1,3 @@
+print "Hello World
+"
+end
--
Andy Dougherty [EMAIL PROTECTED]