diff options
author | dos-reis <gdr@axiomatics.org> | 2008-04-21 15:16:32 +0000 |
---|---|---|
committer | dos-reis <gdr@axiomatics.org> | 2008-04-21 15:16:32 +0000 |
commit | a04a446805a1108cd19f633878ca367629c23f4b (patch) | |
tree | d7b057f8b144184299ae72c0f91ad12e320a6157 /src/interp | |
parent | b136bc01f60d2baa53148919ee04828dbe9e53b1 (diff) | |
download | open-axiom-a04a446805a1108cd19f633878ca367629c23f4b.tar.gz |
Add support for byte values, and byte buffers.
Diffstat (limited to 'src/interp')
-rw-r--r-- | src/interp/compiler.boot | 4 | ||||
-rw-r--r-- | src/interp/sys-macros.lisp | 36 | ||||
-rw-r--r-- | src/interp/sys-utility.boot | 24 | ||||
-rw-r--r-- | src/interp/types.boot | 25 |
4 files changed, 85 insertions, 4 deletions
diff --git a/src/interp/compiler.boot b/src/interp/compiler.boot index f8f6ca01..877749d2 100644 --- a/src/interp/compiler.boot +++ b/src/interp/compiler.boot @@ -527,9 +527,9 @@ getFormModemaps(form is [op,:argl],e) == ++ the same arity and must take flag argument in the same position. ++ Returns a vector of length `nargs' with positive entries indicating ++ flag arguments, and negative entries for normal argument passing. -checkCallingConvention: (%List,%Short) -> %Vector +checkCallingConvention: (%List,%Short) -> %SimpleArray %Short checkCallingConvention(sigs,nargs) == - v := GETZEROVEC nargs + v := makeFilledSimpleArray(%Short,nargs,0) for sig in sigs repeat for t in rest sig for i in 0.. repeat diff --git a/src/interp/sys-macros.lisp b/src/interp/sys-macros.lisp index a6d8dd9b..c74ada28 100644 --- a/src/interp/sys-macros.lisp +++ b/src/interp/sys-macros.lisp @@ -57,6 +57,17 @@ `(or (alpha-char-p ,x) (member ,x '(#\? #\% #\!) :test #'char=))) + +;; +;; -*- Byte -*- +;; + +(defmacro |byteLessThan| (|x| |y|) + `(< (the fixnum x) (the fixnum y))) + +(defmacro |byteGreaterEqual| (|x| |y|) + `(>= (the fixnum x) (the fixnum y))) + ;; ;; -*- BigFloat Constructors -*- ;; @@ -310,6 +321,31 @@ ;; -*- Association Lists -*- ;; + +;; +;; -*- Simple Arrays -*- +;; + +;; Note: these macros should probably be just ordinary functions. + +(defmacro |makeSimpleArray| (|t| |n|) + `(make-array ,|n| :element-type ,|t|)) + +(defmacro |makeFilledSimpleArray| (|t| |n| |v|) + `(make-array ,|n| :element-type ,|t| :initial-element ,|v|)) + +(defmacro |getSimpleArrayEntry| (|a| |i|) + `(aref (the simple-array ,|a|) (the fixnum ,|i|))) + +(defmacro |setSimpleArrayEntry| (|a| |i| |v|) + `(setf (aref (the simple-array ,|a|) (the fixnum ,|i|)) ,|v|)) + +(defmacro |sizeOfSimpleArray| (|a|) + `(the fixnum (length (the simple-array ,|a|)))) + +(defmacro |maxIndexOfSimpleArray| (|a|) + `(the fixnum (1- (the fixnum (length (the simple-array ,|a|)))))) + ;; ;; -*- Functions -*- ;; diff --git a/src/interp/sys-utility.boot b/src/interp/sys-utility.boot index 6bbb59a9..2fa80cb7 100644 --- a/src/interp/sys-utility.boot +++ b/src/interp/sys-utility.boot @@ -37,6 +37,30 @@ import '"sys-os" import '"vmlisp" )package "BOOT" + +--% + +++ getVMType returns an approximation of the underlying object type +++ representation of a domain, as a Lisp type specifier as seen by +++ the runtime system. +getVMType d == + case devaluate d of + Void => "%Void" + Boolean => "%Boolean" + Byte => "%Byte" + Character => "%Char" + SingleInteger => "%Short" + Integer => "%Integer" + String => "%String" + List => "%List" + Vector => "%Vector" + PrimitiveArray => "SIMPLE-ARRAY" + Pair => "%Pair" + otherwise => "%Thing" -- good enough, for now. + + +--% + setDynamicBinding: (%Symbol,%Thing) -> %Thing setDynamicBinding(s,v) == SETF(SYMBOL_-VALUE s,v) diff --git a/src/interp/types.boot b/src/interp/types.boot index e0aa5cd1..6061252e 100644 --- a/src/interp/types.boot +++ b/src/interp/types.boot @@ -34,18 +34,39 @@ import '"boot-pkg" )package "BOOT" -++ Basic types used throughout Boot codes. +--% Basic types used throughout Boot codes. + %Void <=> nil + %Boolean <=> BOOLEAN + +%Byte <=> + UNSIGNED_-BYTE 8 + +%Char <=> + CHARACTER + %Short <=> FIXNUM + %Integer <=> BIGNUM + %Number <=> NUMBER + %Symbol <=> SYMBOL + %String <=> STRING + %Atom <=> atom + %List <=> LIST -%Vector <=> VECTOR + +%SimpleArray a <=> + SIMPLE_-ARRAY a + +%Vector a <=> VECTOR a + %Thing <=> true + %Sequence <=> SEQUENCE %Pair <=> cons |