From 7fb7062638f05c3748a7aaace55d50cb1ac87fb0 Mon Sep 17 00:00:00 2001 From: dos-reis Date: Sat, 5 Sep 2009 20:48:21 +0000 Subject: * algebra/data.spad.pamphlet: Cleanup. * interp/compiler.boot (getBasicFFIType): Handle 64-bit integer types. --- src/ChangeLog | 5 +++++ src/algebra/data.spad.pamphlet | 44 ++++++++++++++++++++++-------------------- src/interp/compiler.boot | 5 ++++- src/interp/sys-constants.boot | 7 +++++++ 4 files changed, 39 insertions(+), 22 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index de9f95f4..c187df16 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2009-09-05 Gabriel Dos Reis + + * algebra/data.spad.pamphlet: Cleanup. + * interp/compiler.boot (getBasicFFIType): Handle 64-bit integer types. + 2009-09-03 Gabriel Dos Reis * boot/ast.boot (bfAlternative): New. Move single assignment in diff --git a/src/algebra/data.spad.pamphlet b/src/algebra/data.spad.pamphlet index 6bc803dd..95feee21 100644 --- a/src/algebra/data.spad.pamphlet +++ b/src/algebra/data.spad.pamphlet @@ -37,18 +37,18 @@ Byte(): Public == Private where ++ \spad{sample} gives a sample datum of type Byte. Private == SubDomain(NonNegativeInteger, #1 < 256) add byte(x: NonNegativeInteger): % == per x - sample = 0$Lisp + sample = 0$Foreign(Builtin) coerce(c: Character) == per ord c coerce(x: %): Character == char rep x - x = y == byteEqual(x,y)$Lisp - x < y == byteLessThan(x,y)$Lisp - x > y == byteGreaterThan(x,y)$Lisp - x <= y == byteLessEqual(x,y)$Lisp - x >= y == byteGreaterEqual(x,y)$Lisp + x = y == byteEqual(x,y)$Foreign(Builtin) + x < y == byteLessThan(x,y)$Foreign(Builtin) + x > y == byteGreaterThan(x,y)$Foreign(Builtin) + x <= y == byteLessEqual(x,y)$Foreign(Builtin) + x >= y == byteGreaterEqual(x,y)$Foreign(Builtin) min() == per 0 max() == per 255 - bitand(x,y) == bitand(x,y)$Lisp - bitior(x,y) == bitior(x,y)$Lisp + bitand(x,y) == bitand(x,y)$Foreign(Builtin) + bitior(x,y) == bitior(x,y)$Foreign(Builtin) @ @@ -65,10 +65,10 @@ ByteOrder(): Public == Private where bigEndian: % ++ \spad{bigEndian} describes big endian host unknownEndian: % ++ \spad{unknownEndian} for none of the above. Private == add - unknownEndian == %unknownEndian$Lisp - littleEndian == %littleEndian$Lisp - bigEndian == %bigEndian$Lisp - x = y == EQ(x,y)$Lisp + unknownEndian == %unknownEndian$Foreign(Builtin) + littleEndian == %littleEndian$Foreign(Builtin) + bigEndian == %bigEndian$Foreign(Builtin) + x = y == EQ(x,y)$Foreign(Builtin) coerce(x: %): OutputForm == outputForm x = littleEndian => 'litteEndian @@ -182,8 +182,8 @@ SystemNonNegativeInteger(N: PositiveInteger): Public == Private where min == per 0 max == per((shift(1,N)-1)::NonNegativeInteger) sample == min - bitand(x,y) == BOOLE(BOOLE_-AND$Lisp,x,y)$Lisp - bitior(x,y) == BOOLE(BOOLE_-IOR$Lisp,x,y)$Lisp + bitand(x,y) == BOOLE(BOOLE_-AND$Foreign(Builtin),x,y)$Foreign(Builtin) + bitior(x,y) == BOOLE(BOOLE_-IOR$Foreign(Builtin),x,y)$Foreign(Builtin) @ @@ -279,13 +279,13 @@ ByteBuffer(): Public == Private where Rep == Record(ary: PrimitiveArray Byte, sz: NonNegativeInteger) makeByteBuffer(n: NonNegativeInteger): % == - per [makeByteBuffer(n)$Lisp,n]$Rep + per [makeByteBuffer(n)$Foreign(Builtin),n]$Rep byteBuffer n == makeByteBuffer n empty() == byteBuffer 0 - new(n,b) == per [makeByteBuffer(n,b)$Lisp,n]$Rep + new(n,b) == per [makeByteBuffer(n,b)$Foreign(Builtin),n]$Rep # buf == rep(buf).sz @@ -319,7 +319,7 @@ ByteBuffer(): Public == Private where rep(buf).ary coerce(buf: %): String == - s: String := MAKE_-STRING(#buf)$Lisp + s: String := MAKE_-STRING(#buf)$Foreign(Builtin) for i in 0..maxIndex buf repeat qsetelt!(s,i + 1,qelt(buf,i)::Character)$String s @@ -363,16 +363,16 @@ DataArray(N: PositiveInteger, T: SetCategory): Public == Private where ++ Indexing is 0-based. Private == add new() == - makeSimpleArray(getVMType(T)$Lisp,N)$Lisp + makeSimpleArray(getVMType(T)$Foreign(Builtin),N)$Foreign(Builtin) qelt(b,i) == - getSimpleArrayEntry(b,i)$Lisp + getSimpleArrayEntry(b,i)$Foreign(Builtin) qsetelt(b,i,x) == - setSimpleArrayEntry(b,i,x)$Lisp + setSimpleArrayEntry(b,i,x)$Foreign(Builtin) x = y == - EQUAL(x,y)$Lisp + EQUAL(x,y)$Foreign(Builtin) coerce(b: %): OutputForm == bracket([qelt(b,i)::OutputForm for i in 0..(N-1)]) @@ -424,11 +424,13 @@ DataArray(N: PositiveInteger, T: SetCategory): Public == Private where <> <> <> +<> <> <> <> <> +<> @ diff --git a/src/interp/compiler.boot b/src/interp/compiler.boot index baea9aa2..f2ced87a 100644 --- a/src/interp/compiler.boot +++ b/src/interp/compiler.boot @@ -1331,8 +1331,11 @@ getBasicFFIType: %Mode -> %Symbol getBasicFFIType t == t = $Byte => bootDenotation "byte" t = $Int16 => bootDenotation "int16" + t = $UInt16 => bootDenotation "uint16" t = $Int32 => bootDenotation "int32" --- t = $Int64 => bootDenotation "int64" + t = $UInt32 => bootDenotation "uint32" + t = $Int64 => bootDenotation "int64" + t = $UInt64 => bootDenotation "uint64" t = $SingleInteger => bootDenotation "int" t = $SingleFloat => bootDenotation "float" t = $DoubleFloat => bootDenotation "double" diff --git a/src/interp/sys-constants.boot b/src/interp/sys-constants.boot index bb8c8575..02d6d4b2 100644 --- a/src/interp/sys-constants.boot +++ b/src/interp/sys-constants.boot @@ -373,9 +373,16 @@ $Boolean == '(Boolean) $Byte == '(Byte) + +++ Sized integer types, mostly for system-level programming. $Int16 == '(Int16) +$UInt16 == '(UInt16) + $Int32 == '(Int32) +$UInt32 == '(UInt32) + $Int64 == '(Int64) +$UInt64 == '(UInt64) ++ The SmallInteger domain constructor form $SmallInteger == -- cgit v1.2.3