ref: f12188aeeb9d6cef0ce0c2a611b85e18a76eb672
parent: b3ea4473f2850dbd625848bdefa7c7ac943c301a
author: Ori Bernstein <[email protected]>
date: Sun Jul 22 20:50:29 EDT 2012
Strip the "-sysname" suffix from usefiles. This lets us compile portably.
--- a/bld.sh
+++ b/bld.sh
@@ -17,6 +17,7 @@
function use {
for i in $@; do
N=`basename $i .myr`
+ N=${N%%-$SYS}
echo $MU -o $N.use $i && \
$MU -o $N.use $i
@@ -40,10 +41,11 @@
ASM=syscall-$SYS.s
# Myrddin source must be specified in dependency order
-MYR="sys-$SYS.myr \
+MYR="\
types.myr \
- alloc.myr \
+ sys-$SYS.myr \
die.myr \
+ alloc.myr \
hello.myr"
OBJ="$(echo $ASM | sed 's/\.s/.o /g') $(echo $MYR | sed 's/\.myr/.o /g')"
assem $ASM
--- a/hello.myr
+++ b/hello.myr
@@ -2,7 +2,7 @@
use "alloc.use"
const main = {
- var x : int*
- x = std.alloc()
+ var x
+ x = std.bytealloc(32)
std.write(1, "Hello world\n")
}
--- a/sys-linux.myr
+++ b/sys-linux.myr
@@ -80,7 +80,7 @@
const write : (fd:int, buf:byte[,] -> int)
const lseek : (fd:int, off:uint, whence:int -> int)
const fstat : (fd:int, sb:statbuf* -> int)
- const munmap : (addr:byte*, len:uint -> int)
+ const munmap : (addr:byte*, len:size -> int)
const mmap : (addr:byte*, len:size, prot:mprot, flags:mopt, fd:int, off:off -> byte*)
;;
--- a/sys-osx.myr
+++ b/sys-osx.myr
@@ -80,7 +80,7 @@
const write : (fd:int, buf:byte[,] -> int)
const lseek : (fd:int, off:uint, whence:int -> int)
const fstat : (fd:int, sb:statbuf* -> int)
- const munmap : (addr:byte*, len:uint -> int)
+ const munmap : (addr:byte*, len:size -> int)
const mmap : (addr:byte*, len:size, prot:mprot, flags:mopt, fd:int, off:off -> byte*)
;;