mirror of
https://github.com/vishapoberon/compiler.git
synced 2026-04-05 23:22:25 +00:00
ulmTypes.Mod and ulmStreams.Mod modules ported.
This commit is contained in:
parent
4a4b3939a3
commit
af6746cd0f
15 changed files with 2972 additions and 10 deletions
4
makefile
4
makefile
|
|
@ -9,7 +9,7 @@ RELEASE = 1.0
|
|||
|
||||
INCLUDEPATH = -Isrc/lib/system/$(CCOMP)/$(TARCH)
|
||||
|
||||
SETPATH = CFLAGS=$(INCLUDEPATH) PATH=.:/bin:/usr/bin MODULES=.:src/lib:src/lib/v4:src/lib/system:src/lib/system/$(CCOMP):src/lib/system/$(CCOMP)/$(TARCH):src/lib/ulm:src/lib/ulm/gnuc:src/lib/ooc2:src/lib/ooc2/gnuc:src/lib/ooc:src/lib/ooc/lowlevel:src/voc:src/voc/gnuc:src/voc/gnuc/$(TARCH):src/tools/ocat:src/tools/browser:src/tools/vocparam:src/tools/coco:src/test
|
||||
SETPATH = CFLAGS=$(INCLUDEPATH) PATH=.:/bin:/usr/bin MODULES=.:src/lib:src/lib/v4:src/lib/system:src/lib/system/$(CCOMP):src/lib/system/$(CCOMP)/$(TARCH):src/lib/ulm:src/lib/ulm/$(CCOMP):src/lib/ulm/$(TARCH):src/lib/ooc2:src/lib/ooc2/$(CCOMP):src/lib/ooc:src/lib/ooc/$(CCOMP):src/voc:src/voc/$(CCOMP):src/voc/$(CCOMP)/$(TARCH):src/tools/ocat:src/tools/browser:src/tools/vocparam:src/tools/coco:src/test
|
||||
|
||||
VOC = voc
|
||||
VOCSTATIC = $(SETPATH) ./vocstatic
|
||||
|
|
@ -137,7 +137,7 @@ stage6:
|
|||
$(VOCSTATIC) -sP ulmASCII.Mod ulmSets.Mod
|
||||
$(VOCSTATIC) -sP ulmObjects.Mod ulmDisciplines.Mod
|
||||
$(VOCSTATIC) -sP ulmPriorities.Mod ulmServices.Mod ulmEvents.Mod ulmResources.Mod ulmForwarders.Mod ulmRelatedEvents.Mod
|
||||
$(VOCSTATIC) -sP ulmIO.Mod ulmProcess.Mod
|
||||
$(VOCSTATIC) -sP ulmIO.Mod ulmProcess.Mod ulmTypes.Mod ulmStreams.Mod
|
||||
|
||||
stage7:
|
||||
#objects := $(wildcard *.o)
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ RELEASE = 1.0
|
|||
|
||||
INCLUDEPATH = -Isrc/lib/system/$(CCOMP)/$(TARCH)
|
||||
|
||||
SETPATH = CFLAGS=$(INCLUDEPATH) PATH=.:/bin:/usr/bin MODULES=.:src/lib:src/lib/v4:src/lib/system:src/lib/system/$(CCOMP):src/lib/system/$(CCOMP)/$(TARCH):src/lib/ulm:src/lib/ulm/gnuc:src/lib/ooc2:src/lib/ooc2/gnuc:src/lib/ooc:src/lib/ooc/lowlevel:src/voc:src/voc/gnuc:src/voc/gnuc/$(TARCH):src/tools/ocat:src/tools/browser:src/tools/vocparam:src/tools/coco:src/test
|
||||
SETPATH = CFLAGS=$(INCLUDEPATH) PATH=.:/bin:/usr/bin MODULES=.:src/lib:src/lib/v4:src/lib/system:src/lib/system/$(CCOMP):src/lib/system/$(CCOMP)/$(TARCH):src/lib/ulm:src/lib/ulm/$(CCOMP):src/lib/ulm/$(TARCH):src/lib/ooc2:src/lib/ooc2/$(CCOMP):src/lib/ooc:src/lib/ooc/$(CCOMP):src/voc:src/voc/$(CCOMP):src/voc/$(CCOMP)/$(TARCH):src/tools/ocat:src/tools/browser:src/tools/vocparam:src/tools/coco:src/test
|
||||
|
||||
VOC = voc
|
||||
VOCSTATIC = $(SETPATH) ./vocstatic
|
||||
|
|
@ -137,7 +137,7 @@ stage6:
|
|||
$(VOCSTATIC) -sP ulmASCII.Mod ulmSets.Mod
|
||||
$(VOCSTATIC) -sP ulmObjects.Mod ulmDisciplines.Mod
|
||||
$(VOCSTATIC) -sP ulmPriorities.Mod ulmServices.Mod ulmEvents.Mod ulmResources.Mod ulmForwarders.Mod ulmRelatedEvents.Mod
|
||||
$(VOCSTATIC) -sP ulmIO.Mod ulmProcess.Mod
|
||||
$(VOCSTATIC) -sP ulmIO.Mod ulmProcess.Mod ulmTypes.Mod ulmStreams.Mod
|
||||
|
||||
stage7:
|
||||
#objects := $(wildcard *.o)
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ RELEASE = 1.0
|
|||
|
||||
INCLUDEPATH = -Isrc/lib/system/$(CCOMP)/$(TARCH)
|
||||
|
||||
SETPATH = CFLAGS=$(INCLUDEPATH) PATH=.:/bin:/usr/bin MODULES=.:src/lib:src/lib/v4:src/lib/system:src/lib/system/$(CCOMP):src/lib/system/$(CCOMP)/$(TARCH):src/lib/ulm:src/lib/ulm/gnuc:src/lib/ooc2:src/lib/ooc2/gnuc:src/lib/ooc:src/lib/ooc/lowlevel:src/voc:src/voc/gnuc:src/voc/gnuc/$(TARCH):src/tools/ocat:src/tools/browser:src/tools/vocparam:src/tools/coco:src/test
|
||||
SETPATH = CFLAGS=$(INCLUDEPATH) PATH=.:/bin:/usr/bin MODULES=.:src/lib:src/lib/v4:src/lib/system:src/lib/system/$(CCOMP):src/lib/system/$(CCOMP)/$(TARCH):src/lib/ulm:src/lib/ulm/$(CCOMP):src/lib/ulm/$(TARCH):src/lib/ooc2:src/lib/ooc2/$(CCOMP):src/lib/ooc:src/lib/ooc/$(CCOMP):src/voc:src/voc/$(CCOMP):src/voc/$(CCOMP)/$(TARCH):src/tools/ocat:src/tools/browser:src/tools/vocparam:src/tools/coco:src/test
|
||||
|
||||
VOC = voc
|
||||
VOCSTATIC = $(SETPATH) ./vocstatic
|
||||
|
|
@ -137,7 +137,7 @@ stage6:
|
|||
$(VOCSTATIC) -sP ulmASCII.Mod ulmSets.Mod
|
||||
$(VOCSTATIC) -sP ulmObjects.Mod ulmDisciplines.Mod
|
||||
$(VOCSTATIC) -sP ulmPriorities.Mod ulmServices.Mod ulmEvents.Mod ulmResources.Mod ulmForwarders.Mod ulmRelatedEvents.Mod
|
||||
$(VOCSTATIC) -sP ulmIO.Mod ulmProcess.Mod
|
||||
$(VOCSTATIC) -sP ulmIO.Mod ulmProcess.Mod ulmTypes.Mod ulmStreams.Mod
|
||||
|
||||
stage7:
|
||||
#objects := $(wildcard *.o)
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ RELEASE = 1.0
|
|||
|
||||
INCLUDEPATH = -Isrc/lib/system/$(CCOMP)/$(TARCH)
|
||||
|
||||
SETPATH = CFLAGS=$(INCLUDEPATH) PATH=.:/bin:/usr/bin MODULES=.:src/lib:src/lib/v4:src/lib/system:src/lib/system/$(CCOMP):src/lib/system/$(CCOMP)/$(TARCH):src/lib/ulm:src/lib/ulm/gnuc:src/lib/ooc2:src/lib/ooc2/gnuc:src/lib/ooc:src/lib/ooc/lowlevel:src/voc:src/voc/gnuc:src/voc/gnuc/$(TARCH):src/tools/ocat:src/tools/browser:src/tools/vocparam:src/tools/coco:src/test
|
||||
SETPATH = CFLAGS=$(INCLUDEPATH) PATH=.:/bin:/usr/bin MODULES=.:src/lib:src/lib/v4:src/lib/system:src/lib/system/$(CCOMP):src/lib/system/$(CCOMP)/$(TARCH):src/lib/ulm:src/lib/ulm/$(CCOMP):src/lib/ulm/$(TARCH):src/lib/ooc2:src/lib/ooc2/$(CCOMP):src/lib/ooc:src/lib/ooc/$(CCOMP):src/voc:src/voc/$(CCOMP):src/voc/$(CCOMP)/$(TARCH):src/tools/ocat:src/tools/browser:src/tools/vocparam:src/tools/coco:src/test
|
||||
|
||||
VOC = voc
|
||||
VOCSTATIC = $(SETPATH) ./vocstatic
|
||||
|
|
@ -137,7 +137,7 @@ stage6:
|
|||
$(VOCSTATIC) -sP ulmASCII.Mod ulmSets.Mod
|
||||
$(VOCSTATIC) -sP ulmObjects.Mod ulmDisciplines.Mod
|
||||
$(VOCSTATIC) -sP ulmPriorities.Mod ulmServices.Mod ulmEvents.Mod ulmResources.Mod ulmForwarders.Mod ulmRelatedEvents.Mod
|
||||
$(VOCSTATIC) -sP ulmIO.Mod ulmProcess.Mod
|
||||
$(VOCSTATIC) -sP ulmIO.Mod ulmProcess.Mod ulmTypes.Mod ulmStreams.Mod
|
||||
|
||||
stage7:
|
||||
#objects := $(wildcard *.o)
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ RELEASE = 1.0
|
|||
|
||||
INCLUDEPATH = -Isrc/lib/system/$(CCOMP)/$(TARCH)
|
||||
|
||||
SETPATH = CFLAGS=$(INCLUDEPATH) PATH=.:/bin:/usr/bin MODULES=.:src/lib:src/lib/v4:src/lib/system:src/lib/system/$(CCOMP):src/lib/system/$(CCOMP)/$(TARCH):src/lib/ulm:src/lib/ulm/gnuc:src/lib/ooc2:src/lib/ooc2/gnuc:src/lib/ooc:src/lib/ooc/lowlevel:src/voc:src/voc/gnuc:src/voc/gnuc/$(TARCH):src/tools/ocat:src/tools/browser:src/tools/vocparam:src/tools/coco:src/test
|
||||
SETPATH = CFLAGS=$(INCLUDEPATH) PATH=.:/bin:/usr/bin MODULES=.:src/lib:src/lib/v4:src/lib/system:src/lib/system/$(CCOMP):src/lib/system/$(CCOMP)/$(TARCH):src/lib/ulm:src/lib/ulm/$(CCOMP):src/lib/ulm/$(TARCH):src/lib/ooc2:src/lib/ooc2/$(CCOMP):src/lib/ooc:src/lib/ooc/$(CCOMP):src/voc:src/voc/$(CCOMP):src/voc/$(CCOMP)/$(TARCH):src/tools/ocat:src/tools/browser:src/tools/vocparam:src/tools/coco:src/test
|
||||
|
||||
VOC = voc
|
||||
VOCSTATIC = $(SETPATH) ./vocstatic
|
||||
|
|
@ -137,7 +137,7 @@ stage6:
|
|||
$(VOCSTATIC) -sP ulmASCII.Mod ulmSets.Mod
|
||||
$(VOCSTATIC) -sP ulmObjects.Mod ulmDisciplines.Mod
|
||||
$(VOCSTATIC) -sP ulmPriorities.Mod ulmServices.Mod ulmEvents.Mod ulmResources.Mod ulmForwarders.Mod ulmRelatedEvents.Mod
|
||||
$(VOCSTATIC) -sP ulmIO.Mod ulmProcess.Mod
|
||||
$(VOCSTATIC) -sP ulmIO.Mod ulmProcess.Mod ulmTypes.Mod ulmStreams.Mod
|
||||
|
||||
stage7:
|
||||
#objects := $(wildcard *.o)
|
||||
|
|
|
|||
188
makefile.gnuc.x86_64
Normal file
188
makefile.gnuc.x86_64
Normal file
|
|
@ -0,0 +1,188 @@
|
|||
#SHELL := /bin/bash
|
||||
BUILDID=$(shell date +%Y/%m/%d)
|
||||
TOS = linux
|
||||
TARCH = x86_64
|
||||
#TARCH = x86 x86_64 armv6j armv6j_hardfp armv7a_hardfp
|
||||
CCOMP = gnuc
|
||||
RELEASE = 1.0
|
||||
|
||||
|
||||
INCLUDEPATH = -Isrc/lib/system/$(CCOMP)/$(TARCH)
|
||||
|
||||
SETPATH = CFLAGS=$(INCLUDEPATH) PATH=.:/bin:/usr/bin MODULES=.:src/lib:src/lib/v4:src/lib/system:src/lib/system/$(CCOMP):src/lib/system/$(CCOMP)/$(TARCH):src/lib/ulm:src/lib/ulm/$(CCOMP):src/lib/ulm/$(TARCH):src/lib/ooc2:src/lib/ooc2/$(CCOMP):src/lib/ooc:src/lib/ooc/$(CCOMP):src/voc:src/voc/$(CCOMP):src/voc/$(CCOMP)/$(TARCH):src/tools/ocat:src/tools/browser:src/tools/vocparam:src/tools/coco:src/test
|
||||
|
||||
VOC = voc
|
||||
VOCSTATIC = $(SETPATH) ./vocstatic
|
||||
VOCPARAM = $(shell ./vocparam > voc.par)
|
||||
VERSION = GNU_Linux_$(TARCH)
|
||||
LIBNAME = VishapOberon
|
||||
LIBRARY = lib$(LIBNAME)
|
||||
|
||||
ifndef PREFIX
|
||||
PREFIX = /opt/voc-$(RELEASE)
|
||||
endif
|
||||
|
||||
CCOPT = -fPIC $(INCLUDEPATH) -g
|
||||
|
||||
CC = cc $(CCOPT) -c
|
||||
CL = cc $(CCOPT)
|
||||
LD = cc -shared -o $(LIBRARY).so
|
||||
# s is necessary to create index inside a archive
|
||||
ARCHIVE = ar rcs $(LIBRARY).a
|
||||
|
||||
#%.c: %.Mod
|
||||
#%.o: %.c
|
||||
# $(CC) $(input)
|
||||
|
||||
all: stage2 stage3 stage4 stage5 stage6 stage7
|
||||
|
||||
# when porting to new platform:
|
||||
# * put corresponding .par file into current directory. it can be generated on the target platform by compiling vocparam (stage0) and running (stage1)
|
||||
# * run make port0 - this will generate C source files for the target architecture
|
||||
# * move the source tree to the target machine, and compile (or compile here via crosscompiler) (port1)
|
||||
port0: stage2 stage3 stage4
|
||||
|
||||
# now compile C source files for voc, showdef and ocat on target machine (or by using crosscompiler)
|
||||
port1: stage5
|
||||
# after you have "voc" compiled for target architecture. replace vocstatic with it and run make on target platform to get everything compiled
|
||||
|
||||
# this builds binary which generates voc.par
|
||||
stage0: src/tools/vocparam/vocparam.c
|
||||
$(CL) -I src/lib -o vocparam src/tools/vocparam/vocparam.c
|
||||
|
||||
# this creates voc.par for a host architecture.
|
||||
# comment this out if you need to build a compiler for a different architecture.
|
||||
stage1:
|
||||
#rm voc.par
|
||||
#$(shell "./vocparam > voc.par")
|
||||
#./vocparam > voc.par
|
||||
$(VOCPARAM)
|
||||
|
||||
# this copies necessary voc.par to the current directory.
|
||||
# skip this if you are building compiler for the host architecture.
|
||||
stage2:
|
||||
cp src/par/voc.par.$(CCOMP).$(TARCH) voc.par
|
||||
# cp src/par/voc.par.gnu.x86_64 voc.par
|
||||
# cp src/par/voc.par.gnu.x86 voc.par
|
||||
# cp src/par/voc.par.gnu.armv6 voc.par
|
||||
# cp src/par/voc.par.gnu.armv7 voc.par
|
||||
|
||||
# this prepares modules necessary to build the compiler itself
|
||||
stage3:
|
||||
|
||||
$(VOCSTATIC) -siapxPS SYSTEM.Mod
|
||||
$(VOCSTATIC) -sPS Args.Mod Console.Mod Unix.Mod
|
||||
$(VOCSTATIC) -sPS oocOakStrings.Mod architecture.Mod version.Mod Kernel.Mod Modules.Mod
|
||||
$(VOCSTATIC) -sxPS Files.Mod
|
||||
$(VOCSTATIC) -sPS Reals.Mod CmdlnTexts.Mod errors.Mod
|
||||
|
||||
# build the compiler
|
||||
stage4:
|
||||
$(VOCSTATIC) -sPS extTools.Mod
|
||||
$(VOCSTATIC) -sPS OPM.cmdln.Mod
|
||||
$(VOCSTATIC) -sxPS OPS.Mod
|
||||
$(VOCSTATIC) -sPS OPT.Mod OPC.Mod OPV.Mod OPB.Mod OPP.Mod
|
||||
$(VOCSTATIC) -smPS voc.Mod
|
||||
$(VOCSTATIC) -smPS BrowserCmd.Mod
|
||||
$(VOCSTATIC) -smPS OCatCmd.Mod
|
||||
|
||||
#this is to build the compiler from C sources.
|
||||
#this is a way to create a bootstrap binary.
|
||||
stage5:
|
||||
$(CC) SYSTEM.c Args.c Console.c Modules.c Unix.c \
|
||||
oocOakStrings.c architecture.c version.c Kernel.c Files.c Reals.c CmdlnTexts.c \
|
||||
version.c extTools.c \
|
||||
OPM.c OPS.c OPT.c OPC.c OPV.c OPB.c OPP.c errors.c
|
||||
|
||||
$(CL) -static voc.c -o voc \
|
||||
SYSTEM.o Args.o Console.o Modules.o Unix.o \
|
||||
oocOakStrings.o architecture.o version.o Kernel.o Files.o Reals.o CmdlnTexts.o \
|
||||
extTools.o \
|
||||
OPM.o OPS.o OPT.o OPC.o OPV.o OPB.o OPP.o errors.o
|
||||
$(CL) BrowserCmd.c -o showdef \
|
||||
SYSTEM.o Args.o Console.o Modules.o Unix.o oocOakStrings.o architecture.o version.o Kernel.o Files.o Reals.o CmdlnTexts.o \
|
||||
OPM.o OPS.o OPT.o OPV.o OPC.o errors.o
|
||||
|
||||
$(CL) OCatCmd.c -o ocat \
|
||||
SYSTEM.o Args.o Console.o Modules.o Unix.o oocOakStrings.o architecture.o version.o Kernel.o Files.o Reals.o CmdlnTexts.o
|
||||
|
||||
|
||||
|
||||
# build all library files
|
||||
stage6:
|
||||
$(VOCSTATIC) -sP oocAscii.Mod
|
||||
$(VOCSTATIC) -sP oocStrings.Mod
|
||||
$(VOCSTATIC) -sP oocStrings2.Mod
|
||||
$(VOCSTATIC) -sP oocCharClass.Mod
|
||||
$(VOCSTATIC) -sP oocConvTypes.Mod
|
||||
$(VOCSTATIC) -sP oocIntConv.Mod
|
||||
$(VOCSTATIC) -sP oocIntStr.Mod
|
||||
$(VOCSTATIC) -sP oocSysClock.Mod
|
||||
$(VOCSTATIC) -sP oocTime.Mod
|
||||
# $(VOCSTATIC) -s oocLongStrings.Mod
|
||||
# $(CC) oocLongStrings.c
|
||||
# $(VOCSTATIC) -s oocMsg.Mod
|
||||
# $(CC) oocMsg.c
|
||||
|
||||
|
||||
$(VOCSTATIC) -sP ooc2Strings.Mod
|
||||
$(VOCSTATIC) -sP ooc2Ascii.Mod
|
||||
$(VOCSTATIC) -sP ooc2CharClass.Mod
|
||||
$(VOCSTATIC) -sP ooc2ConvTypes.Mod
|
||||
$(VOCSTATIC) -sP ooc2IntConv.Mod
|
||||
$(VOCSTATIC) -sP ooc2IntStr.Mod
|
||||
$(VOCSTATIC) -sP ooc2Real0.Mod
|
||||
$(VOCSTATIC) -sP oocwrapperlibc.Mod
|
||||
$(VOCSTATIC) -sP ulmSYSTEM.Mod
|
||||
$(VOCSTATIC) -sP ulmASCII.Mod ulmSets.Mod
|
||||
$(VOCSTATIC) -sP ulmObjects.Mod ulmDisciplines.Mod
|
||||
$(VOCSTATIC) -sP ulmPriorities.Mod ulmServices.Mod ulmEvents.Mod ulmResources.Mod ulmForwarders.Mod ulmRelatedEvents.Mod
|
||||
$(VOCSTATIC) -sP ulmIO.Mod ulmProcess.Mod ulmTypes.Mod ulmStreams.Mod
|
||||
|
||||
stage7:
|
||||
#objects := $(wildcard *.o)
|
||||
#$(LD) objects
|
||||
$(ARCHIVE) *.o
|
||||
#$(ARCHIVE) objects
|
||||
$(LD) *.o
|
||||
echo "$(PREFIX)/lib" > 05vishap.conf
|
||||
|
||||
clean:
|
||||
# rm_objects := rm $(wildcard *.o)
|
||||
# objects
|
||||
rm *.o
|
||||
rm *.sym
|
||||
rm *.h
|
||||
rm *.c
|
||||
rm *.a
|
||||
rm *.so
|
||||
|
||||
coco:
|
||||
$(JET) Sets.Mod Oberon.Mod CRS.Mod CRT.Mod CRA.Mod CRX.Mod CRP.Mod Coco.Mod -m
|
||||
$(CC) Sets.c Oberon.c CRS.c CRT.c CRA.c CRX.c CRP.c
|
||||
$(CL) -static -o Coco Coco.c Sets.o Oberon.o CRS.o CRT.o CRA.o CRX.o CRP.o CmdlnTexts.o SYSTEM.o Files.o -L. -lOberon -L/usr/lib -ldl
|
||||
|
||||
install:
|
||||
test -d $(PREFIX)/bin | mkdir -p $(PREFIX)/bin
|
||||
cp voc $(PREFIX)/bin/
|
||||
cp showdef $(PREFIX)/bin/
|
||||
cp ocat $(PREFIX)/bin/
|
||||
cp -a src $(PREFIX)/
|
||||
|
||||
test -d $(PREFIX)/lib/voc | mkdir -p $(PREFIX)/lib/voc
|
||||
test -d $(PREFIX)/lib/voc/ | mkdir -p $(PREFIX)/lib/voc
|
||||
test -d $(PREFIX)/lib/voc/obj | mkdir -p $(PREFIX)/lib/voc/obj
|
||||
test -d $(PREFIX)/lib/voc/sym | mkdir -p $(PREFIX)/lib/voc/sym
|
||||
|
||||
cp $(LIBRARY).so $(PREFIX)/lib
|
||||
cp $(LIBRARY).a $(PREFIX)/lib
|
||||
cp *.c $(PREFIX)/lib/voc/obj/
|
||||
cp *.h $(PREFIX)/lib/voc/obj/
|
||||
cp *.sym $(PREFIX)/lib/voc/sym/
|
||||
|
||||
cp 05vishap.conf /etc/ld.so.conf.d/
|
||||
ldconfig
|
||||
|
||||
# cp *.o $(PREFIX)/lib/voc/$(RELEASE)/obj/
|
||||
uninstall:
|
||||
rm -rf $(PREFIX)
|
||||
BIN
ocat
BIN
ocat
Binary file not shown.
BIN
showdef
BIN
showdef
Binary file not shown.
125
src/lib/ulm/armv6j/ulmTypes.Mod
Normal file
125
src/lib/ulm/armv6j/ulmTypes.Mod
Normal file
|
|
@ -0,0 +1,125 @@
|
|||
(* Ulm's Oberon Library
|
||||
Copyright (C) 1989-2000 by University of Ulm, SAI, D-89069 Ulm, Germany
|
||||
----------------------------------------------------------------------------
|
||||
Ulm's Oberon Library is free software; you can redistribute it
|
||||
and/or modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either version
|
||||
2 of the License, or (at your option) any later version.
|
||||
|
||||
Ulm's Oberon Library is distributed in the hope that it will be
|
||||
useful, but WITHOUT ANY WARRANTY; without even the implied warranty
|
||||
of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
----------------------------------------------------------------------------
|
||||
E-mail contact: oberon@mathematik.uni-ulm.de
|
||||
----------------------------------------------------------------------------
|
||||
$Id: Types.om,v 1.5 2000/12/13 10:03:00 borchert Exp $
|
||||
----------------------------------------------------------------------------
|
||||
$Log: Types.om,v $
|
||||
Revision 1.5 2000/12/13 10:03:00 borchert
|
||||
SetInt type used in msb constant
|
||||
|
||||
Revision 1.4 2000/12/13 09:51:57 borchert
|
||||
constants and types for the relationship of INTEGER and SET added
|
||||
|
||||
Revision 1.3 1998/09/25 15:23:09 borchert
|
||||
Real32..Real128 added
|
||||
|
||||
Revision 1.2 1994/07/01 11:08:04 borchert
|
||||
IntAddress, Int8/16/32, ToInt8/16/32 and bit/little endian stuff added
|
||||
|
||||
Revision 1.1 1994/02/22 20:12:14 borchert
|
||||
Initial revision
|
||||
|
||||
----------------------------------------------------------------------------
|
||||
AFB 9/93
|
||||
----------------------------------------------------------------------------
|
||||
*)
|
||||
|
||||
MODULE ulmTypes;
|
||||
|
||||
(* compiler-dependent type definitions;
|
||||
this version works for Ulm's Oberon Compilers on
|
||||
following architectures: m68k and sparc
|
||||
*)
|
||||
|
||||
IMPORT SYS := SYSTEM;
|
||||
|
||||
TYPE
|
||||
Address* = LONGINT (*SYS.ADDRESS*);
|
||||
UntracedAddress* = LONGINT; (*SYS.UNTRACEDADDRESS;*)
|
||||
Count* = LONGINT;
|
||||
Size* = Count;
|
||||
Byte* = SYS.BYTE;
|
||||
IntAddress* = LONGINT;
|
||||
Int8* = SHORTINT;
|
||||
Int16* = INTEGER;
|
||||
Int32* = LONGINT;
|
||||
Real32* = REAL;
|
||||
Real64* = LONGREAL;
|
||||
|
||||
CONST
|
||||
bigEndian* = 0; (* SPARC, M68K etc *)
|
||||
littleEndian* = 1; (* Intel 80x86, VAX etc *)
|
||||
byteorder* = littleEndian; (* machine-dependent constant *)
|
||||
TYPE
|
||||
ByteOrder* = SHORTINT; (* bigEndian or littleEndian *)
|
||||
|
||||
(* following constants and type definitions try to make
|
||||
conversions from INTEGER to SET and vice versa more portable
|
||||
to allow for bit operations on INTEGER values
|
||||
*)
|
||||
TYPE
|
||||
SetInt* = LONGINT; (* INTEGER type that corresponds to SET *)
|
||||
VAR msb* : SET;
|
||||
msbIsMax*, msbIs0*: SHORTINT;
|
||||
msbindex*, lsbindex*, nofbits*: LONGINT;
|
||||
|
||||
PROCEDURE ToInt8*(int: LONGINT) : Int8;
|
||||
BEGIN
|
||||
RETURN SHORT(SHORT(int))
|
||||
END ToInt8;
|
||||
|
||||
PROCEDURE ToInt16*(int: LONGINT) : Int16;
|
||||
BEGIN
|
||||
RETURN SYS.VAL(Int16, int)
|
||||
END ToInt16;
|
||||
|
||||
PROCEDURE ToInt32*(int: LONGINT) : Int32;
|
||||
BEGIN
|
||||
RETURN int
|
||||
END ToInt32;
|
||||
|
||||
PROCEDURE ToReal32*(real: LONGREAL) : Real32;
|
||||
BEGIN
|
||||
RETURN SHORT(real)
|
||||
END ToReal32;
|
||||
|
||||
PROCEDURE ToReal64*(real: LONGREAL) : Real64;
|
||||
BEGIN
|
||||
RETURN real
|
||||
END ToReal64;
|
||||
|
||||
BEGIN
|
||||
msb := SYS.VAL(SET, MIN(SetInt));
|
||||
(* most significant bit, converted to a SET *)
|
||||
(* we expect msbIsMax XOR msbIs0 to be 1;
|
||||
this is checked for by an assertion
|
||||
*)
|
||||
msbIsMax := SYS.VAL(SHORTINT, (msb = {MAX(SET)}));
|
||||
(* is 1, if msb equals {MAX(SET)} *)
|
||||
msbIs0 := SYS.VAL(SHORTINT, (msb = {0}));
|
||||
(* is 0, if msb equals {0} *)
|
||||
msbindex := msbIsMax * MAX(SET);
|
||||
(* set element that corresponds to the most-significant-bit *)
|
||||
lsbindex := MAX(SET) - msbindex;
|
||||
(* set element that corresponds to the lowest-significant-bit *)
|
||||
nofbits := MAX(SET) + 1;
|
||||
(* number of elements in SETs *)
|
||||
|
||||
ASSERT((msbIs0 = 1) & (msbIsMax = 0) OR (msbIs0 = 0) & (msbIsMax = 1));
|
||||
END ulmTypes.
|
||||
125
src/lib/ulm/armv6j_hardfp/ulmTypes.Mod
Normal file
125
src/lib/ulm/armv6j_hardfp/ulmTypes.Mod
Normal file
|
|
@ -0,0 +1,125 @@
|
|||
(* Ulm's Oberon Library
|
||||
Copyright (C) 1989-2000 by University of Ulm, SAI, D-89069 Ulm, Germany
|
||||
----------------------------------------------------------------------------
|
||||
Ulm's Oberon Library is free software; you can redistribute it
|
||||
and/or modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either version
|
||||
2 of the License, or (at your option) any later version.
|
||||
|
||||
Ulm's Oberon Library is distributed in the hope that it will be
|
||||
useful, but WITHOUT ANY WARRANTY; without even the implied warranty
|
||||
of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
----------------------------------------------------------------------------
|
||||
E-mail contact: oberon@mathematik.uni-ulm.de
|
||||
----------------------------------------------------------------------------
|
||||
$Id: Types.om,v 1.5 2000/12/13 10:03:00 borchert Exp $
|
||||
----------------------------------------------------------------------------
|
||||
$Log: Types.om,v $
|
||||
Revision 1.5 2000/12/13 10:03:00 borchert
|
||||
SetInt type used in msb constant
|
||||
|
||||
Revision 1.4 2000/12/13 09:51:57 borchert
|
||||
constants and types for the relationship of INTEGER and SET added
|
||||
|
||||
Revision 1.3 1998/09/25 15:23:09 borchert
|
||||
Real32..Real128 added
|
||||
|
||||
Revision 1.2 1994/07/01 11:08:04 borchert
|
||||
IntAddress, Int8/16/32, ToInt8/16/32 and bit/little endian stuff added
|
||||
|
||||
Revision 1.1 1994/02/22 20:12:14 borchert
|
||||
Initial revision
|
||||
|
||||
----------------------------------------------------------------------------
|
||||
AFB 9/93
|
||||
----------------------------------------------------------------------------
|
||||
*)
|
||||
|
||||
MODULE ulmTypes;
|
||||
|
||||
(* compiler-dependent type definitions;
|
||||
this version works for Ulm's Oberon Compilers on
|
||||
following architectures: m68k and sparc
|
||||
*)
|
||||
|
||||
IMPORT SYS := SYSTEM;
|
||||
|
||||
TYPE
|
||||
Address* = LONGINT (*SYS.ADDRESS*);
|
||||
UntracedAddress* = LONGINT; (*SYS.UNTRACEDADDRESS;*)
|
||||
Count* = LONGINT;
|
||||
Size* = Count;
|
||||
Byte* = SYS.BYTE;
|
||||
IntAddress* = LONGINT;
|
||||
Int8* = SHORTINT;
|
||||
Int16* = INTEGER;
|
||||
Int32* = LONGINT;
|
||||
Real32* = REAL;
|
||||
Real64* = LONGREAL;
|
||||
|
||||
CONST
|
||||
bigEndian* = 0; (* SPARC, M68K etc *)
|
||||
littleEndian* = 1; (* Intel 80x86, VAX etc *)
|
||||
byteorder* = littleEndian; (* machine-dependent constant *)
|
||||
TYPE
|
||||
ByteOrder* = SHORTINT; (* bigEndian or littleEndian *)
|
||||
|
||||
(* following constants and type definitions try to make
|
||||
conversions from INTEGER to SET and vice versa more portable
|
||||
to allow for bit operations on INTEGER values
|
||||
*)
|
||||
TYPE
|
||||
SetInt* = LONGINT; (* INTEGER type that corresponds to SET *)
|
||||
VAR msb* : SET;
|
||||
msbIsMax*, msbIs0*: SHORTINT;
|
||||
msbindex*, lsbindex*, nofbits*: LONGINT;
|
||||
|
||||
PROCEDURE ToInt8*(int: LONGINT) : Int8;
|
||||
BEGIN
|
||||
RETURN SHORT(SHORT(int))
|
||||
END ToInt8;
|
||||
|
||||
PROCEDURE ToInt16*(int: LONGINT) : Int16;
|
||||
BEGIN
|
||||
RETURN SYS.VAL(Int16, int)
|
||||
END ToInt16;
|
||||
|
||||
PROCEDURE ToInt32*(int: LONGINT) : Int32;
|
||||
BEGIN
|
||||
RETURN int
|
||||
END ToInt32;
|
||||
|
||||
PROCEDURE ToReal32*(real: LONGREAL) : Real32;
|
||||
BEGIN
|
||||
RETURN SHORT(real)
|
||||
END ToReal32;
|
||||
|
||||
PROCEDURE ToReal64*(real: LONGREAL) : Real64;
|
||||
BEGIN
|
||||
RETURN real
|
||||
END ToReal64;
|
||||
|
||||
BEGIN
|
||||
msb := SYS.VAL(SET, MIN(SetInt));
|
||||
(* most significant bit, converted to a SET *)
|
||||
(* we expect msbIsMax XOR msbIs0 to be 1;
|
||||
this is checked for by an assertion
|
||||
*)
|
||||
msbIsMax := SYS.VAL(SHORTINT, (msb = {MAX(SET)}));
|
||||
(* is 1, if msb equals {MAX(SET)} *)
|
||||
msbIs0 := SYS.VAL(SHORTINT, (msb = {0}));
|
||||
(* is 0, if msb equals {0} *)
|
||||
msbindex := msbIsMax * MAX(SET);
|
||||
(* set element that corresponds to the most-significant-bit *)
|
||||
lsbindex := MAX(SET) - msbindex;
|
||||
(* set element that corresponds to the lowest-significant-bit *)
|
||||
nofbits := MAX(SET) + 1;
|
||||
(* number of elements in SETs *)
|
||||
|
||||
ASSERT((msbIs0 = 1) & (msbIsMax = 0) OR (msbIs0 = 0) & (msbIsMax = 1));
|
||||
END ulmTypes.
|
||||
125
src/lib/ulm/armv7a_hardfp/ulmTypes.Mod
Normal file
125
src/lib/ulm/armv7a_hardfp/ulmTypes.Mod
Normal file
|
|
@ -0,0 +1,125 @@
|
|||
(* Ulm's Oberon Library
|
||||
Copyright (C) 1989-2000 by University of Ulm, SAI, D-89069 Ulm, Germany
|
||||
----------------------------------------------------------------------------
|
||||
Ulm's Oberon Library is free software; you can redistribute it
|
||||
and/or modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either version
|
||||
2 of the License, or (at your option) any later version.
|
||||
|
||||
Ulm's Oberon Library is distributed in the hope that it will be
|
||||
useful, but WITHOUT ANY WARRANTY; without even the implied warranty
|
||||
of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
----------------------------------------------------------------------------
|
||||
E-mail contact: oberon@mathematik.uni-ulm.de
|
||||
----------------------------------------------------------------------------
|
||||
$Id: Types.om,v 1.5 2000/12/13 10:03:00 borchert Exp $
|
||||
----------------------------------------------------------------------------
|
||||
$Log: Types.om,v $
|
||||
Revision 1.5 2000/12/13 10:03:00 borchert
|
||||
SetInt type used in msb constant
|
||||
|
||||
Revision 1.4 2000/12/13 09:51:57 borchert
|
||||
constants and types for the relationship of INTEGER and SET added
|
||||
|
||||
Revision 1.3 1998/09/25 15:23:09 borchert
|
||||
Real32..Real128 added
|
||||
|
||||
Revision 1.2 1994/07/01 11:08:04 borchert
|
||||
IntAddress, Int8/16/32, ToInt8/16/32 and bit/little endian stuff added
|
||||
|
||||
Revision 1.1 1994/02/22 20:12:14 borchert
|
||||
Initial revision
|
||||
|
||||
----------------------------------------------------------------------------
|
||||
AFB 9/93
|
||||
----------------------------------------------------------------------------
|
||||
*)
|
||||
|
||||
MODULE ulmTypes;
|
||||
|
||||
(* compiler-dependent type definitions;
|
||||
this version works for Ulm's Oberon Compilers on
|
||||
following architectures: m68k and sparc
|
||||
*)
|
||||
|
||||
IMPORT SYS := SYSTEM;
|
||||
|
||||
TYPE
|
||||
Address* = LONGINT (*SYS.ADDRESS*);
|
||||
UntracedAddress* = LONGINT; (*SYS.UNTRACEDADDRESS;*)
|
||||
Count* = LONGINT;
|
||||
Size* = Count;
|
||||
Byte* = SYS.BYTE;
|
||||
IntAddress* = LONGINT;
|
||||
Int8* = SHORTINT;
|
||||
Int16* = INTEGER;
|
||||
Int32* = LONGINT;
|
||||
Real32* = REAL;
|
||||
Real64* = LONGREAL;
|
||||
|
||||
CONST
|
||||
bigEndian* = 0; (* SPARC, M68K etc *)
|
||||
littleEndian* = 1; (* Intel 80x86, VAX etc *)
|
||||
byteorder* = littleEndian; (* machine-dependent constant *)
|
||||
TYPE
|
||||
ByteOrder* = SHORTINT; (* bigEndian or littleEndian *)
|
||||
|
||||
(* following constants and type definitions try to make
|
||||
conversions from INTEGER to SET and vice versa more portable
|
||||
to allow for bit operations on INTEGER values
|
||||
*)
|
||||
TYPE
|
||||
SetInt* = LONGINT; (* INTEGER type that corresponds to SET *)
|
||||
VAR msb* : SET;
|
||||
msbIsMax*, msbIs0*: SHORTINT;
|
||||
msbindex*, lsbindex*, nofbits*: LONGINT;
|
||||
|
||||
PROCEDURE ToInt8*(int: LONGINT) : Int8;
|
||||
BEGIN
|
||||
RETURN SHORT(SHORT(int))
|
||||
END ToInt8;
|
||||
|
||||
PROCEDURE ToInt16*(int: LONGINT) : Int16;
|
||||
BEGIN
|
||||
RETURN SYS.VAL(Int16, int)
|
||||
END ToInt16;
|
||||
|
||||
PROCEDURE ToInt32*(int: LONGINT) : Int32;
|
||||
BEGIN
|
||||
RETURN int
|
||||
END ToInt32;
|
||||
|
||||
PROCEDURE ToReal32*(real: LONGREAL) : Real32;
|
||||
BEGIN
|
||||
RETURN SHORT(real)
|
||||
END ToReal32;
|
||||
|
||||
PROCEDURE ToReal64*(real: LONGREAL) : Real64;
|
||||
BEGIN
|
||||
RETURN real
|
||||
END ToReal64;
|
||||
|
||||
BEGIN
|
||||
msb := SYS.VAL(SET, MIN(SetInt));
|
||||
(* most significant bit, converted to a SET *)
|
||||
(* we expect msbIsMax XOR msbIs0 to be 1;
|
||||
this is checked for by an assertion
|
||||
*)
|
||||
msbIsMax := SYS.VAL(SHORTINT, (msb = {MAX(SET)}));
|
||||
(* is 1, if msb equals {MAX(SET)} *)
|
||||
msbIs0 := SYS.VAL(SHORTINT, (msb = {0}));
|
||||
(* is 0, if msb equals {0} *)
|
||||
msbindex := msbIsMax * MAX(SET);
|
||||
(* set element that corresponds to the most-significant-bit *)
|
||||
lsbindex := MAX(SET) - msbindex;
|
||||
(* set element that corresponds to the lowest-significant-bit *)
|
||||
nofbits := MAX(SET) + 1;
|
||||
(* number of elements in SETs *)
|
||||
|
||||
ASSERT((msbIs0 = 1) & (msbIsMax = 0) OR (msbIs0 = 0) & (msbIsMax = 1));
|
||||
END ulmTypes.
|
||||
2149
src/lib/ulm/ulmStreams.Mod
Normal file
2149
src/lib/ulm/ulmStreams.Mod
Normal file
File diff suppressed because it is too large
Load diff
125
src/lib/ulm/x86/ulmTypes.Mod
Normal file
125
src/lib/ulm/x86/ulmTypes.Mod
Normal file
|
|
@ -0,0 +1,125 @@
|
|||
(* Ulm's Oberon Library
|
||||
Copyright (C) 1989-2000 by University of Ulm, SAI, D-89069 Ulm, Germany
|
||||
----------------------------------------------------------------------------
|
||||
Ulm's Oberon Library is free software; you can redistribute it
|
||||
and/or modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either version
|
||||
2 of the License, or (at your option) any later version.
|
||||
|
||||
Ulm's Oberon Library is distributed in the hope that it will be
|
||||
useful, but WITHOUT ANY WARRANTY; without even the implied warranty
|
||||
of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
----------------------------------------------------------------------------
|
||||
E-mail contact: oberon@mathematik.uni-ulm.de
|
||||
----------------------------------------------------------------------------
|
||||
$Id: Types.om,v 1.5 2000/12/13 10:03:00 borchert Exp $
|
||||
----------------------------------------------------------------------------
|
||||
$Log: Types.om,v $
|
||||
Revision 1.5 2000/12/13 10:03:00 borchert
|
||||
SetInt type used in msb constant
|
||||
|
||||
Revision 1.4 2000/12/13 09:51:57 borchert
|
||||
constants and types for the relationship of INTEGER and SET added
|
||||
|
||||
Revision 1.3 1998/09/25 15:23:09 borchert
|
||||
Real32..Real128 added
|
||||
|
||||
Revision 1.2 1994/07/01 11:08:04 borchert
|
||||
IntAddress, Int8/16/32, ToInt8/16/32 and bit/little endian stuff added
|
||||
|
||||
Revision 1.1 1994/02/22 20:12:14 borchert
|
||||
Initial revision
|
||||
|
||||
----------------------------------------------------------------------------
|
||||
AFB 9/93
|
||||
----------------------------------------------------------------------------
|
||||
*)
|
||||
|
||||
MODULE ulmTypes;
|
||||
|
||||
(* compiler-dependent type definitions;
|
||||
this version works for Ulm's Oberon Compilers on
|
||||
following architectures: m68k and sparc
|
||||
*)
|
||||
|
||||
IMPORT SYS := SYSTEM;
|
||||
|
||||
TYPE
|
||||
Address* = LONGINT (*SYS.ADDRESS*);
|
||||
UntracedAddress* = LONGINT; (*SYS.UNTRACEDADDRESS;*)
|
||||
Count* = LONGINT;
|
||||
Size* = Count;
|
||||
Byte* = SYS.BYTE;
|
||||
IntAddress* = LONGINT;
|
||||
Int8* = SHORTINT;
|
||||
Int16* = INTEGER;
|
||||
Int32* = LONGINT;
|
||||
Real32* = REAL;
|
||||
Real64* = LONGREAL;
|
||||
|
||||
CONST
|
||||
bigEndian* = 0; (* SPARC, M68K etc *)
|
||||
littleEndian* = 1; (* Intel 80x86, VAX etc *)
|
||||
byteorder* = littleEndian; (* machine-dependent constant *)
|
||||
TYPE
|
||||
ByteOrder* = SHORTINT; (* bigEndian or littleEndian *)
|
||||
|
||||
(* following constants and type definitions try to make
|
||||
conversions from INTEGER to SET and vice versa more portable
|
||||
to allow for bit operations on INTEGER values
|
||||
*)
|
||||
TYPE
|
||||
SetInt* = LONGINT; (* INTEGER type that corresponds to SET *)
|
||||
VAR msb* : SET;
|
||||
msbIsMax*, msbIs0*: SHORTINT;
|
||||
msbindex*, lsbindex*, nofbits*: LONGINT;
|
||||
|
||||
PROCEDURE ToInt8*(int: LONGINT) : Int8;
|
||||
BEGIN
|
||||
RETURN SHORT(SHORT(int))
|
||||
END ToInt8;
|
||||
|
||||
PROCEDURE ToInt16*(int: LONGINT) : Int16;
|
||||
BEGIN
|
||||
RETURN SYS.VAL(Int16, int)
|
||||
END ToInt16;
|
||||
|
||||
PROCEDURE ToInt32*(int: LONGINT) : Int32;
|
||||
BEGIN
|
||||
RETURN int
|
||||
END ToInt32;
|
||||
|
||||
PROCEDURE ToReal32*(real: LONGREAL) : Real32;
|
||||
BEGIN
|
||||
RETURN SHORT(real)
|
||||
END ToReal32;
|
||||
|
||||
PROCEDURE ToReal64*(real: LONGREAL) : Real64;
|
||||
BEGIN
|
||||
RETURN real
|
||||
END ToReal64;
|
||||
|
||||
BEGIN
|
||||
msb := SYS.VAL(SET, MIN(SetInt));
|
||||
(* most significant bit, converted to a SET *)
|
||||
(* we expect msbIsMax XOR msbIs0 to be 1;
|
||||
this is checked for by an assertion
|
||||
*)
|
||||
msbIsMax := SYS.VAL(SHORTINT, (msb = {MAX(SET)}));
|
||||
(* is 1, if msb equals {MAX(SET)} *)
|
||||
msbIs0 := SYS.VAL(SHORTINT, (msb = {0}));
|
||||
(* is 0, if msb equals {0} *)
|
||||
msbindex := msbIsMax * MAX(SET);
|
||||
(* set element that corresponds to the most-significant-bit *)
|
||||
lsbindex := MAX(SET) - msbindex;
|
||||
(* set element that corresponds to the lowest-significant-bit *)
|
||||
nofbits := MAX(SET) + 1;
|
||||
(* number of elements in SETs *)
|
||||
|
||||
ASSERT((msbIs0 = 1) & (msbIsMax = 0) OR (msbIs0 = 0) & (msbIsMax = 1));
|
||||
END ulmTypes.
|
||||
125
src/lib/ulm/x86_64/ulmTypes.Mod
Normal file
125
src/lib/ulm/x86_64/ulmTypes.Mod
Normal file
|
|
@ -0,0 +1,125 @@
|
|||
(* Ulm's Oberon Library
|
||||
Copyright (C) 1989-2000 by University of Ulm, SAI, D-89069 Ulm, Germany
|
||||
----------------------------------------------------------------------------
|
||||
Ulm's Oberon Library is free software; you can redistribute it
|
||||
and/or modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either version
|
||||
2 of the License, or (at your option) any later version.
|
||||
|
||||
Ulm's Oberon Library is distributed in the hope that it will be
|
||||
useful, but WITHOUT ANY WARRANTY; without even the implied warranty
|
||||
of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
----------------------------------------------------------------------------
|
||||
E-mail contact: oberon@mathematik.uni-ulm.de
|
||||
----------------------------------------------------------------------------
|
||||
$Id: Types.om,v 1.5 2000/12/13 10:03:00 borchert Exp $
|
||||
----------------------------------------------------------------------------
|
||||
$Log: Types.om,v $
|
||||
Revision 1.5 2000/12/13 10:03:00 borchert
|
||||
SetInt type used in msb constant
|
||||
|
||||
Revision 1.4 2000/12/13 09:51:57 borchert
|
||||
constants and types for the relationship of INTEGER and SET added
|
||||
|
||||
Revision 1.3 1998/09/25 15:23:09 borchert
|
||||
Real32..Real128 added
|
||||
|
||||
Revision 1.2 1994/07/01 11:08:04 borchert
|
||||
IntAddress, Int8/16/32, ToInt8/16/32 and bit/little endian stuff added
|
||||
|
||||
Revision 1.1 1994/02/22 20:12:14 borchert
|
||||
Initial revision
|
||||
|
||||
----------------------------------------------------------------------------
|
||||
AFB 9/93
|
||||
----------------------------------------------------------------------------
|
||||
*)
|
||||
|
||||
MODULE ulmTypes;
|
||||
|
||||
(* compiler-dependent type definitions;
|
||||
this version works for Ulm's Oberon Compilers on
|
||||
following architectures: m68k and sparc
|
||||
*)
|
||||
|
||||
IMPORT SYS := SYSTEM;
|
||||
|
||||
TYPE
|
||||
Address* = LONGINT (*SYS.ADDRESS*);
|
||||
UntracedAddress* = LONGINT; (*SYS.UNTRACEDADDRESS;*)
|
||||
Count* = LONGINT;
|
||||
Size* = Count;
|
||||
Byte* = SYS.BYTE;
|
||||
IntAddress* = LONGINT;
|
||||
Int8* = SHORTINT;
|
||||
Int16* = INTEGER; (* we don't have 16 bit integer in x86_64 version of voc *)
|
||||
Int32* = INTEGER;
|
||||
Real32* = REAL;
|
||||
Real64* = LONGREAL;
|
||||
|
||||
CONST
|
||||
bigEndian* = 0; (* SPARC, M68K etc *)
|
||||
littleEndian* = 1; (* Intel 80x86, VAX etc *)
|
||||
byteorder* = littleEndian; (* machine-dependent constant *)
|
||||
TYPE
|
||||
ByteOrder* = SHORTINT; (* bigEndian or littleEndian *)
|
||||
|
||||
(* following constants and type definitions try to make
|
||||
conversions from INTEGER to SET and vice versa more portable
|
||||
to allow for bit operations on INTEGER values
|
||||
*)
|
||||
TYPE
|
||||
SetInt* = LONGINT; (* INTEGER type that corresponds to SET *)
|
||||
VAR msb* : SET;
|
||||
msbIsMax*, msbIs0*: SHORTINT;
|
||||
msbindex*, lsbindex*, nofbits*: LONGINT;
|
||||
|
||||
PROCEDURE ToInt8*(int: LONGINT) : Int8;
|
||||
BEGIN
|
||||
RETURN SHORT(SHORT(int))
|
||||
END ToInt8;
|
||||
|
||||
PROCEDURE ToInt16*(int: LONGINT) : Int16;
|
||||
BEGIN
|
||||
RETURN SYS.VAL(Int16, int)
|
||||
END ToInt16;
|
||||
|
||||
PROCEDURE ToInt32*(int: LONGINT) : Int32;
|
||||
BEGIN
|
||||
RETURN SHORT(int)
|
||||
END ToInt32;
|
||||
|
||||
PROCEDURE ToReal32*(real: LONGREAL) : Real32;
|
||||
BEGIN
|
||||
RETURN SHORT(real)
|
||||
END ToReal32;
|
||||
|
||||
PROCEDURE ToReal64*(real: LONGREAL) : Real64;
|
||||
BEGIN
|
||||
RETURN real
|
||||
END ToReal64;
|
||||
|
||||
BEGIN
|
||||
msb := SYS.VAL(SET, MIN(SetInt));
|
||||
(* most significant bit, converted to a SET *)
|
||||
(* we expect msbIsMax XOR msbIs0 to be 1;
|
||||
this is checked for by an assertion
|
||||
*)
|
||||
msbIsMax := SYS.VAL(SHORTINT, (msb = {MAX(SET)}));
|
||||
(* is 1, if msb equals {MAX(SET)} *)
|
||||
msbIs0 := SYS.VAL(SHORTINT, (msb = {0}));
|
||||
(* is 0, if msb equals {0} *)
|
||||
msbindex := msbIsMax * MAX(SET);
|
||||
(* set element that corresponds to the most-significant-bit *)
|
||||
lsbindex := MAX(SET) - msbindex;
|
||||
(* set element that corresponds to the lowest-significant-bit *)
|
||||
nofbits := MAX(SET) + 1;
|
||||
(* number of elements in SETs *)
|
||||
|
||||
ASSERT((msbIs0 = 1) & (msbIsMax = 0) OR (msbIs0 = 0) & (msbIsMax = 1));
|
||||
END ulmTypes.
|
||||
BIN
voc
BIN
voc
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue