From 6cb0dc4a2050e8191f61e42a365ec77dd9a3e051 Mon Sep 17 00:00:00 2001 From: dos-reis Date: Thu, 26 Mar 2009 14:06:40 +0000 Subject: * boot/ast.boot (nativeType): Accept int16 and int32. (getFFIDatatype): Accept ReadWrite modifier. * algebra/data.spad.pamphlet (Int32): New. (UInt64): Likewise. * algebra/Makefile.pamphlet (axiom_algebra_layer_7): Include INT64 and UINT64. --- src/interp/compiler.boot | 16 +++++++++++----- src/interp/sys-constants.boot | 1 + 2 files changed, 12 insertions(+), 5 deletions(-) (limited to 'src/interp') diff --git a/src/interp/compiler.boot b/src/interp/compiler.boot index 399e6a5e..f567db1f 100644 --- a/src/interp/compiler.boot +++ b/src/interp/compiler.boot @@ -1271,25 +1271,31 @@ bootDenotation s == getBasicFFIType: %Mode -> %Symbol getBasicFFIType t == t = $Byte => bootDenotation "byte" + t = $Int16 => bootDenotation "int16" t = $Int32 => bootDenotation "int32" - t = $Int64 => bootDenotation "int64" +-- t = $Int64 => bootDenotation "int64" t = $SingleInteger => bootDenotation "int" t = $SingleFloat => bootDenotation "float" t = $DoubleFloat => bootDenotation "double" t = $String => bootDenotation "string" nil + +++ List of admissible type modifiers in an FFI import declaration. +$FFITypeModifier == '(ReadOnly WriteOnly ReadWrite) + ++ Return the Boot denotation of an FFI datatype. This is either ++ a basic VM type, or a simple array of sized integer or floating ++ point type. getFFIDatatype: %Mode -> %Form getFFIDatatype t == x := getBasicFFIType t => x - t is [m,["PrimitiveArray",t']] and m in '(ReadOnly WriteOnly) and - member(t',[$Byte,$Int32,$Int64,$SingleFloat,$DoubleFloat]) => + t is [m,["PrimitiveArray",t']] and m in $FFITypeModifier and + member(t',[$Byte,$Int16,$Int32,$SingleFloat,$DoubleFloat]) => m' := m = "ReadOnly" => bootDenotation "readonly" - bootDenotation "writeonly" + m = "WriteOnly" => bootDenotation "writeonly" + bootDenotation "readwrite" [m',[bootDenotation "buffer",getBasicFFIType t']] nil @@ -1342,7 +1348,7 @@ checkExternalEntity(id,type,lang,e) == ++ Remove possible modifiers in the FFI type expression `t'. removeModifiers t == for (ts := [x,:.]) in tails t repeat - x is [m,t'] and m in '(ReadOnly WriteOnly) => + x is [m,t'] and m in $FFITypeModifier => rplac(first ts,t') t diff --git a/src/interp/sys-constants.boot b/src/interp/sys-constants.boot index 1277504e..51bdfea0 100644 --- a/src/interp/sys-constants.boot +++ b/src/interp/sys-constants.boot @@ -364,6 +364,7 @@ $Boolean == '(Boolean) $Byte == '(Byte) +$Int16 == '(Int16) $Int32 == '(Int32) $Int64 == '(Int64) -- cgit v1.2.3