├── BUSY
├── CppKeywordDetector.cpp
├── Font2.qrc
├── LICENSE.GPL2
├── LICENSE.GPL3
├── NamedThingsMdl.cpp
├── NamedThingsMdl.h
├── OBNCPP.pro
├── OBNLC.pro
├── OBNLJLIB.pro
├── OBXLJ.pro
├── OBXLJ.qrc
├── OBXMC.pro
├── OBXMC.qrc
├── ObAst.cpp
├── ObAst.h
├── ObAstEval.cpp
├── ObAstEval.h
├── ObAstValidator.cpp
├── ObAstValidator.h
├── ObCodeModel.cpp
├── ObCodeModel.h
├── ObCppGen.cpp
├── ObCppGen.h
├── ObErrors.cpp
├── ObErrors.h
├── ObFileCache.cpp
├── ObFileCache.h
├── ObLexer.cpp
├── ObLexer.h
├── ObLjLib.cpp
├── ObLjLib.h
├── ObLjLibFfi.c
├── ObLjProject.cpp
├── ObLjProject.h
├── ObLjbcGen.cpp
├── ObLjbcGen.h
├── ObLuaGen.cpp
├── ObLuaGen.h
├── ObLuaGen2.cpp
├── ObLuaGen2.h
├── ObObxGen.cpp
├── ObObxGen.h
├── ObParser.cpp
├── ObParser.h
├── ObRowCol.cpp
├── ObRowCol.h
├── ObSynTree.cpp
├── ObSynTree.h
├── ObSysInnerLib.cpp
├── ObSysInnerLib.h
├── ObToken.cpp
├── ObToken.h
├── ObTokenType.cpp
├── ObTokenType.h
├── Oberon.pri
├── OberonIde.cpp
├── OberonIde.h
├── OberonIde.pro
├── OberonIde.qrc
├── OberonViewer.cpp
├── OberonViewer.h
├── ObnCppMain.cpp
├── ObnHighlighter.cpp
├── ObnHighlighter.h
├── ObnLjEditor.cpp
├── ObnLjEditor.h
├── ObnLjEditor.pro
├── ObnLjEditor.qrc
├── ObnViewer.pro
├── ObnViewerMain.cpp
├── ObnlcMain.cpp
├── ObsDisplay.cpp
├── ObsDisplay.h
├── ObsFiles.cpp
├── ObsFiles.h
├── ObxAst.cpp
├── ObxAst.h
├── ObxCGen.cpp
├── ObxCGen.h
├── ObxCGen2.cpp
├── ObxCGen2.h
├── ObxCilGen.cpp
├── ObxCilGen.h
├── ObxEvaluator.cpp
├── ObxEvaluator.h
├── ObxIde.cpp
├── ObxIde.h
├── ObxIde.pro
├── ObxIde.qrc
├── ObxIde2.cpp
├── ObxIde2.h
├── ObxIde2.pro
├── ObxIde2.qrc
├── ObxIlEmitter.cpp
├── ObxIlEmitter.h
├── ObxLibFfi.cpp
├── ObxLibFfi.h
├── ObxLjMain.cpp
├── ObxLjRuntime.cpp
├── ObxLjRuntime.h
├── ObxLjbcGen.cpp
├── ObxLjbcGen.h
├── ObxMcMain.cpp
├── ObxModel.cpp
├── ObxModel.h
├── ObxPackage.cpp
├── ObxPackage.h
├── ObxParser.cpp
├── ObxParser.h
├── ObxParser.pri
├── ObxPelibGen.cpp
├── ObxPelibGen.h
├── ObxProject.cpp
├── ObxProject.h
├── ObxValidator.cpp
├── ObxValidator.h
├── README.md
├── README_old.md
├── _Global-Template.h
├── documentation
└── Readme.md
├── examples
├── Collections.obx
├── Drawing.obx
├── Example.obxpro
├── Fibonacci.obx
├── ListTest.obx
├── Lists.obx
├── Lists2.obx
├── See_also
├── Test.obxpro
├── Unicode.obx
├── traditional_syntax
│ ├── Collections.obx
│ ├── Drawing.obx
│ ├── Example.obxpro
│ ├── Fibonacci.obx
│ ├── Lists.obx
│ └── Unicode.obx
└── wikipedia_example_in_Oberon+
│ ├── Figures.mod
│ ├── Lists_v0.mod
│ ├── Lists_v1.mod
│ ├── Lists_v2.mod
│ ├── Lists_v3.mod
│ ├── Lists_v4.mod
│ └── Rectangles.mod
├── font
├── DejaVu.license
├── DejaVuSansMono.ttf
├── Noto.license
└── NotoSans.ttf
├── images
├── alias.png
├── alias_priv.png
├── break-marker.png
├── breakpoint.png
├── class.png
├── class_priv.png
├── close.png
├── definition.png
├── exclamation-circle.png
├── exclamation-red.png
├── folder.png
├── func.png
├── func_priv.png
├── marker.png
├── module.png
├── struct.png
├── struct_priv.png
├── var.png
├── var_priv.png
└── var_prot.png
├── oakwood
├── Coroutines.Def
├── Files.Def
├── In.Def
├── Input.Def
├── Math.Def
├── MathL.Def
├── Out.Def
├── Strings.Def
└── XYplane.Def
├── runtime
├── Coroutines.cs
├── Coroutines.lua
├── Dll
│ ├── Coroutines.dll
│ ├── Files.dll
│ ├── In.dll
│ ├── Input.dll
│ ├── Math.dll
│ ├── MathL.dll
│ ├── OBX.Runtime.dll
│ ├── ObFiles.dll
│ ├── Out.dll
│ ├── Readme.md
│ ├── Strings.dll
│ └── XYplane.dll
├── Files.c
├── Files.cs
├── Files.h
├── Files.lua
├── GPL 2 and 3 Runtime Library Exception
├── In.c
├── In.cs
├── In.h
├── In.lua
├── Input.c
├── Input.cs
├── Input.h
├── Input.lua
├── LICENSE.LGPLv21
├── LICENSE.LGPLv3
├── LICENSE.MPLv2
├── Math.c
├── Math.cs
├── Math.h
├── Math.lua
├── MathL.c
├── MathL.cs
├── MathL.h
├── MathL.lua
├── OBX.Runtime.c
├── OBX.Runtime.cs
├── OBX.Runtime.h
├── Obs
│ ├── Display.lua
│ ├── FileDir.lua
│ ├── Files.lua
│ ├── Input.lua
│ ├── Kernel.lua
│ ├── Modules.lua
│ ├── ObFiles.c
│ ├── ObFiles.cs
│ ├── ObFiles.h
│ └── ObsX.cs
├── Out.c
├── Out.cs
├── Out.h
├── Out.lua
├── Pal
│ ├── BUSY
│ ├── Display.cpp
│ ├── File.cpp
│ ├── Math.cpp
│ ├── ObxPalApi.h
│ └── Readme.md
├── Strings.c
├── Strings.cs
├── Strings.h
├── Strings.lua
├── XYPlane.lua
├── XYplane.c
├── XYplane.cs
├── XYplane.h
├── obnlj.lua
├── obnljlib.lua
└── obxlj.lua
├── syntax
├── Oberon.ebnf
├── Oberon.keywords
├── ObxVariation1.ebnf
├── ObxVariation1.keywords
├── Parser.frame
└── run_coco
├── testcases
├── Are-we-fast-yet
│ ├── Are-we-fast-yet_results.ods
│ ├── Are-we-fast-yet_results_linux.pdf
│ ├── Are-we-fast-yet_results_windows.pdf
│ └── Readme.md
├── Gen2Tests
│ ├── OBNC-Tests.obnpro
│ ├── T1ConstantDeclarations.obn
│ ├── T2TypeDeclarations.obn
│ ├── T3VariableDeclarations.obn
│ ├── T4Expressions.obn
│ ├── T5Statements.obn
│ └── T6ProcedureDeclarations.obn
├── Gen4Tests
│ ├── Readme.md
│ ├── T1-6.obxpro
│ ├── T1ConstantDeclarations.obn
│ ├── T2TypeDeclarations.obn
│ ├── T3VariableDeclarations.obn
│ ├── T4Expressions.obn
│ ├── T5Statements.obn
│ ├── T6ProcedureDeclarations.obn
│ ├── T7.obxpro
│ ├── T7Modules.obn
│ └── imports
│ │ ├── A.obn
│ │ ├── B.obn
│ │ ├── C.obn
│ │ ├── D.obn
│ │ ├── OBNC.obn
│ │ ├── a dir
│ │ └── E.Mod
│ │ ├── lib
│ │ ├── Local.obn
│ │ └── libE.obn
│ │ └── lib1
│ │ ├── Local.obn
│ │ └── lib1M.obn
├── Hennessy.Mod
├── Hennessy.obnpro
├── Hennessy
│ ├── Bubble.obx
│ ├── Hennessy.obxpro
│ ├── Intmm.obx
│ ├── Main.obx
│ ├── Mm.obx
│ ├── Oscar.obx
│ ├── Perm.obx
│ ├── Queens.obx
│ ├── Quick.obx
│ ├── Readme.md
│ ├── Towers.obx
│ ├── Trees.obx
│ └── Util.obx
├── Hennessy_Results
├── NAppGUI
│ ├── BuildHelper
│ │ ├── NAppGUI.def
│ │ ├── NAppGUI.pro
│ │ ├── Readme.md
│ │ ├── res_assert.c
│ │ └── res_assert.h
│ ├── DrawHello.obx
│ ├── DrawHello.obxpro
│ ├── Fractals.obx
│ ├── Fractals.obxpro
│ ├── Fractals2.obx
│ ├── Fractals2.obxpro
│ ├── Hello.obx
│ ├── Hello.obxpro
│ ├── Hello2.obx
│ ├── Hello2.obxpro
│ ├── HelloGui
│ │ ├── Buttons.obx
│ │ ├── GuiHello.obx
│ │ ├── HelloGui.obxpro
│ │ ├── Icons.obx
│ │ ├── Labels.obx
│ │ └── Popups.obx
│ ├── NApp1.obxpro
│ ├── NAppCore.obx
│ ├── NAppDraw.obx
│ ├── NAppGUI.obx
│ ├── NAppWidgets.obx
│ ├── Resources
│ │ ├── Image.obx
│ │ ├── Readme.md
│ │ └── image.jpg
│ ├── Test.obxpro
│ ├── Test1.obx
│ ├── Test2.obx
│ ├── Test3.obx
│ ├── Test3b.obx
│ ├── Test4.obx
│ ├── Test5.obx
│ └── Utf8.obx
├── ObnParser_compatibility_results
├── ObxTests
│ ├── All.obxpro
│ ├── Anyrec1.obx
│ ├── Arrays.obx
│ ├── Arrays2.obx
│ ├── Arrays3.obx
│ ├── Arrays4.obx
│ ├── Arrays5.obx
│ ├── ByteInt8Compat.obx
│ ├── ByteTrick.obx
│ ├── Bytes.obx
│ ├── Circular1.obx
│ ├── CompCon1.obx
│ ├── CompCon2.obx
│ ├── CompCon3.obx
│ ├── Consts1.obx
│ ├── Enum1.obx
│ ├── Enum2.obx
│ ├── Fibonacci.obx
│ ├── FloatingPoint1.obx
│ ├── Flow.obx
│ ├── Generic1.obx
│ ├── Generic2.obx
│ ├── Generic3.obx
│ ├── Generic4.obx
│ ├── Generic5.obx
│ ├── Generic6.obx
│ ├── Generic7.obx
│ ├── GenericTest1.obx
│ ├── GenericTest2.obx
│ ├── GenericTest3.obx
│ ├── GenericTest3.obxpro
│ ├── GenericTest4.obx
│ ├── GenericTest5.obx
│ ├── GenericTest6.obx
│ ├── GenericTest7.obx
│ ├── GenericTest8.obx
│ ├── GenericTest9.obx
│ ├── Havlak.obx
│ ├── Hello.obx
│ ├── Hello.obxpro
│ ├── Import1.obx
│ ├── Import2.obx
│ ├── Imported1a.obx
│ ├── Imported1b.obx
│ ├── Imported2a.obx
│ ├── Imported2b.obx
│ ├── Load1.obx
│ ├── LogOps1.obx
│ ├── LogOps2.obx
│ ├── LogOps3.obx
│ ├── Loops.obx
│ ├── Loops2.obx
│ ├── Minimal.obx
│ ├── Minimal2.obx
│ ├── NBody.obx
│ ├── NestedLoops.obx
│ ├── Oakwood.obxpro
│ ├── Oakwood1.obx
│ ├── Oakwood2.obx
│ ├── Oakwood3.obx
│ ├── Oakwood4.obx
│ ├── Oakwood5.obx
│ ├── Overflow1.obx
│ ├── OverflowTest.obx
│ ├── Pcall1.obx
│ ├── Pcall2.obx
│ ├── Proc10.obx
│ ├── Proc11.obx
│ ├── ProcType1.obx
│ ├── ProcType2.obx
│ ├── ProcType3.obx
│ ├── Procs1.obx
│ ├── Procs2.obx
│ ├── Procs3.obx
│ ├── Procs4.obx
│ ├── Procs5.obx
│ ├── Procs5b.obx
│ ├── Procs6.obx
│ ├── Procs7.obx
│ ├── Procs7b.obx
│ ├── Procs7c.obx
│ ├── Procs7d.obx
│ ├── Procs7e.obx
│ ├── Procs7f.obx
│ ├── Procs8.obx
│ ├── Procs9.obx
│ ├── RecReturnTest.obx
│ ├── Record1.obx
│ ├── Record2.obx
│ ├── Record3.obx
│ ├── SYSTEM.obx
│ ├── System1.obx
│ ├── System2.obx
│ ├── TestDll
│ │ ├── Test.cpp
│ │ ├── Test.h
│ │ ├── Test.pro
│ │ └── test_global.h
│ ├── Tests.obx
│ ├── Tests.obxpro
│ ├── Towers.obx
│ ├── TryToAssertJit.obx
│ ├── Umlaut.obx
│ ├── Unsafe.obxpro
│ ├── Unsafe1.obx
│ ├── Unsafe2.obx
│ ├── Unsafe3.obx
│ ├── Unsafe4.obx
│ ├── UnsafeImport1.obx
│ ├── UnsafeImport2.obx
│ ├── Vla1.obx
│ ├── Vla2.obx
│ ├── Vla3.obx
│ └── With.obx
└── SDL2
│ ├── Draw.obx
│ ├── Draw.obxpro
│ ├── OBX.obx
│ ├── Readme.md
│ ├── SDL.obx
│ ├── SDL.obxpro
│ ├── Test.obx
│ └── lena.bmp
└── tools
└── ExtractVirtDisk
├── ExtractVirtDisk.cpp
├── ExtractVirtDisk.h
└── ExtractVirtDisk.pro
/Font2.qrc:
--------------------------------------------------------------------------------
1 |
2 |
3 | font/NotoSans.ttf
4 |
5 |
6 |
--------------------------------------------------------------------------------
/OBNCPP.pro:
--------------------------------------------------------------------------------
1 | #/*
2 | #* Copyright 2019 Rochus Keller
3 | #*
4 | #* This file is part of the Oberon parser/code model library.
5 | #*
6 | #* The following is the license that applies to this copy of the
7 | #* library. For a license to use the library under conditions
8 | #* other than those described here, please email to me@rochus-keller.ch.
9 | #*
10 | #* GNU General Public License Usage
11 | #* This file may be used under the terms of the GNU General Public
12 | #* License (GPL) versions 2.0 or 3.0 as published by the Free Software
13 | #* Foundation and appearing in the file LICENSE.GPL included in
14 | #* the packaging of this file. Please review the following information
15 | #* to ensure GNU General Public Licensing requirements will be met:
16 | #* http://www.fsf.org/licensing/licenses/info/GPLv2.html and
17 | #* http://www.gnu.org/copyleft/gpl.html.
18 | #*/
19 |
20 | QT += core
21 | QT -= gui
22 |
23 | greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
24 |
25 | TARGET = OberonTest
26 | TEMPLATE = app
27 |
28 | INCLUDEPATH += ..
29 |
30 | SOURCES += \
31 | ObnCppMain.cpp \
32 | ObCppGen.cpp \
33 | CppKeywordDetector.cpp
34 |
35 | HEADERS += \
36 | ObCppGen.h
37 |
38 | include( Oberon.pri )
39 |
40 | CONFIG(debug, debug|release) {
41 | DEFINES += _DEBUG
42 | }
43 |
44 | QMAKE_CXXFLAGS += -Wno-reorder -Wno-unused-parameter -Wno-unused-function -Wno-unused-variable
45 |
46 |
47 |
48 |
49 |
50 |
--------------------------------------------------------------------------------
/OBNLJLIB.pro:
--------------------------------------------------------------------------------
1 | QT -= gui
2 |
3 | TARGET = obnljlib
4 | TEMPLATE = lib
5 |
6 | DEFINES += OBNLJLIB_LIBRARY
7 |
8 | INCLUDEPATH += .. ../LuaJIT/src
9 |
10 | SOURCES += ObLjLib.cpp
11 |
12 | HEADERS += ObLjLib.h
13 |
14 | unix {
15 | target.path = /usr/lib
16 | INSTALLS += target
17 | }
18 |
--------------------------------------------------------------------------------
/OBXLJ.qrc:
--------------------------------------------------------------------------------
1 |
2 |
3 | oakwood/Coroutines.Def
4 | oakwood/Files.Def
5 | oakwood/In.Def
6 | oakwood/Input.Def
7 | oakwood/Math.Def
8 | oakwood/Out.Def
9 | oakwood/Strings.Def
10 | oakwood/XYplane.Def
11 | runtime/Coroutines.lua
12 | runtime/Files.lua
13 | runtime/In.lua
14 | runtime/Input.lua
15 | runtime/Math.lua
16 | runtime/obxlj.lua
17 | runtime/Out.lua
18 | runtime/Strings.lua
19 | runtime/XYPlane.lua
20 | runtime/Obs/Display.lua
21 | runtime/Obs/FileDir.lua
22 | runtime/Obs/Files.lua
23 | runtime/Obs/Input.lua
24 | runtime/Obs/Kernel.lua
25 | runtime/Obs/Modules.lua
26 |
27 |
28 |
--------------------------------------------------------------------------------
/OBXMC.pro:
--------------------------------------------------------------------------------
1 | #/*
2 | #* Copyright 2021 Rochus Keller
3 | #*
4 | #* This file is part of the Oberon to Mono CLI compiler.
5 | #*
6 | #* The following is the license that applies to this copy of the
7 | #* application. For a license to use the application under conditions
8 | #* other than those described here, please email to me@rochus-keller.ch.
9 | #*
10 | #* GNU General Public License Usage
11 | #* This file may be used under the terms of the GNU General Public
12 | #* License (GPL) versions 2.0 or 3.0 as published by the Free Software
13 | #* Foundation and appearing in the file LICENSE.GPL included in
14 | #* the packaging of this file. Please review the following information
15 | #* to ensure GNU General Public Licensing requirements will be met:
16 | #* http://www.fsf.org/licensing/licenses/info/GPLv2.html and
17 | #* http://www.gnu.org/copyleft/gpl.html.
18 | #*/
19 |
20 | QT += core
21 |
22 | QT -= gui
23 |
24 | TARGET = OBXMC
25 | CONFIG += console
26 | CONFIG -= app_bundle
27 |
28 | TEMPLATE = app
29 |
30 | DEFINES += OBX_BBOX _OBX_USE_NEW_FFI_
31 |
32 | INCLUDEPATH += ..
33 |
34 | SOURCES += \
35 | ObxMcMain.cpp \
36 | ObxIlEmitter.cpp \
37 | ObxPelibGen.cpp \
38 | ObxCilGen.cpp \
39 | ../MonoTools/MonoMdbGen.cpp \
40 | ObxCGen2.cpp
41 |
42 | HEADERS += \
43 | ObxIlEmitter.h \
44 | ObxPelibGen.h \
45 | ObxCilGen.h \
46 | ../MonoTools/MonoMdbGen.h \
47 | ObxCGen2.h
48 |
49 | include( ../PeLib/PeLib.pri )
50 | include( ObxParser.pri )
51 |
52 |
53 | !win32 {
54 | QMAKE_CXXFLAGS += -Wno-reorder -Wno-unused-parameter -Wno-unused-function -Wno-unused-variable
55 | }
56 |
57 | CONFIG(debug, debug|release) {
58 | DEFINES += _DEBUG
59 | }
60 |
61 | RESOURCES += \
62 | OBXMC.qrc
63 |
64 |
--------------------------------------------------------------------------------
/OBXMC.qrc:
--------------------------------------------------------------------------------
1 |
2 |
3 | oakwood/Coroutines.Def
4 | oakwood/Files.Def
5 | oakwood/In.Def
6 | oakwood/Input.Def
7 | oakwood/Math.Def
8 | oakwood/Out.Def
9 | oakwood/Strings.Def
10 | oakwood/XYplane.Def
11 | oakwood/MathL.Def
12 | runtime/Dll/In.dll
13 | runtime/Dll/Input.dll
14 | runtime/Dll/Math.dll
15 | runtime/Dll/MathL.dll
16 | runtime/Dll/OBX.Runtime.dll
17 | runtime/Dll/Out.dll
18 | runtime/Dll/Coroutines.dll
19 | runtime/Dll/Strings.dll
20 | runtime/Dll/Files.dll
21 | runtime/Dll/XYplane.dll
22 | runtime/Files.c
23 | runtime/In.c
24 | runtime/Input.c
25 | runtime/Math.c
26 | runtime/MathL.c
27 | runtime/OBX.Runtime.c
28 | runtime/Out.c
29 | runtime/Strings.c
30 | runtime/XYplane.c
31 | runtime/Files.h
32 | runtime/In.h
33 | runtime/Input.h
34 | runtime/Math.h
35 | runtime/MathL.h
36 | runtime/OBX.Runtime.h
37 | runtime/Out.h
38 | runtime/Strings.h
39 | runtime/XYplane.h
40 |
41 |
42 |
--------------------------------------------------------------------------------
/ObAstValidator.h:
--------------------------------------------------------------------------------
1 | #ifndef OBASTVALIDATOR_H
2 | #define OBASTVALIDATOR_H
3 |
4 | /*
5 | * Copyright 2019, 2020 Rochus Keller
6 | *
7 | * This file is part of the Oberon parser/code model library.
8 | *
9 | * The following is the license that applies to this copy of the
10 | * library. For a license to use the library under conditions
11 | * other than those described here, please email to me@rochus-keller.ch.
12 | *
13 | * GNU General Public License Usage
14 | * This file may be used under the terms of the GNU General Public
15 | * License (GPL) versions 2.0 or 3.0 as published by the Free Software
16 | * Foundation and appearing in the file LICENSE.GPL included in
17 | * the packaging of this file. Please review the following information
18 | * to ensure GNU General Public Licensing requirements will be met:
19 | * http://www.fsf.org/licensing/licenses/info/GPLv2.html and
20 | * http://www.gnu.org/copyleft/gpl.html.
21 | */
22 |
23 | #include
24 |
25 | namespace Ob
26 | {
27 | class Errors;
28 |
29 | namespace Ast
30 | {
31 | struct Module;
32 | class Model;
33 |
34 | class Validator : public QObject
35 | {
36 | public:
37 |
38 | static bool validate( Model*, Module*, Errors* );
39 | private:
40 | Validator();
41 | };
42 | }
43 | }
44 |
45 | #endif // OBASTVALIDATOR_H
46 |
--------------------------------------------------------------------------------
/ObLjbcGen.h:
--------------------------------------------------------------------------------
1 | #ifndef OBLJBCGEN_H
2 | #define OBLJBCGEN_H
3 |
4 | /*
5 | * Copyright 2019, 2020 Rochus Keller
6 | *
7 | * This file is part of the Oberon parser/code model library.
8 | *
9 | * The following is the license that applies to this copy of the
10 | * library. For a license to use the library under conditions
11 | * other than those described here, please email to me@rochus-keller.ch.
12 | *
13 | * GNU General Public License Usage
14 | * This file may be used under the terms of the GNU General Public
15 | * License (GPL) versions 2.0 or 3.0 as published by the Free Software
16 | * Foundation and appearing in the file LICENSE.GPL included in
17 | * the packaging of this file. Please review the following information
18 | * to ensure GNU General Public Licensing requirements will be met:
19 | * http://www.fsf.org/licensing/licenses/info/GPLv2.html and
20 | * http://www.gnu.org/copyleft/gpl.html.
21 | */
22 |
23 | #include
24 | class QIODevice;
25 |
26 | namespace Ob
27 | {
28 | class Errors;
29 |
30 | namespace Ast
31 | {
32 | struct Module;
33 | class Model;
34 | }
35 | class LjbcGen
36 | {
37 | public:
38 | static bool translate(Ast::Model*,const QString& outdir, const QString& mod, Errors* = 0 );
39 | static bool translate( Ast::Module*, QIODevice* out, Errors* = 0 );
40 | private:
41 | LjbcGen();
42 | };
43 | }
44 |
45 | #endif // OBLJBCGEN_H
46 |
--------------------------------------------------------------------------------
/ObLuaGen2.h:
--------------------------------------------------------------------------------
1 | #ifndef OBLUAGEN2_H
2 | #define OBLUAGEN2_H
3 |
4 | /*
5 | * Copyright 2019, 2020 Rochus Keller
6 | *
7 | * This file is part of the Oberon parser/code model library.
8 | *
9 | * The following is the license that applies to this copy of the
10 | * library. For a license to use the library under conditions
11 | * other than those described here, please email to me@rochus-keller.ch.
12 | *
13 | * GNU General Public License Usage
14 | * This file may be used under the terms of the GNU General Public
15 | * License (GPL) versions 2.0 or 3.0 as published by the Free Software
16 | * Foundation and appearing in the file LICENSE.GPL included in
17 | * the packaging of this file. Please review the following information
18 | * to ensure GNU General Public Licensing requirements will be met:
19 | * http://www.fsf.org/licensing/licenses/info/GPLv2.html and
20 | * http://www.gnu.org/copyleft/gpl.html.
21 | */
22 |
23 | #include
24 | class QIODevice;
25 |
26 | namespace Ob
27 | {
28 | class Errors;
29 |
30 | namespace Ast
31 | {
32 | class Module;
33 | class Model;
34 | class Named;
35 | }
36 | class LuaGen2
37 | {
38 | public:
39 | static QByteArray toName( Ast::Named* id);
40 | static bool translate(Ast::Model*,const QString& outdir, const QString& mod, Errors* = 0 );
41 | static bool translate( Ast::Module*, QIODevice* out, Errors* = 0 );
42 | private:
43 | LuaGen2();
44 | };
45 | }
46 |
47 | #endif // OBLUAGEN2_H
48 |
--------------------------------------------------------------------------------
/ObRowCol.cpp:
--------------------------------------------------------------------------------
1 | #include "ObRowCol.h"
2 | #include
3 | using namespace Ob;
4 |
5 | RowCol::RowCol(quint32 row, quint32 col)
6 | {
7 | if( !setRowCol(row,col) )
8 | qWarning() << "invalid row or column number";
9 | }
10 |
11 | bool RowCol::setRowCol(quint32 row, quint32 col)
12 | {
13 | static const quint32 maxRow = ( 1 << ROW_BIT_LEN ) - 1;
14 | static const quint32 maxCol = ( 1 << COL_BIT_LEN ) - 1;
15 | int err = 0;
16 | if( row > maxRow )
17 | {
18 | d_row = maxRow;
19 | err++;
20 | }else if( row == 0 )
21 | {
22 | d_row = 1;
23 | err++;
24 | }else
25 | d_row = row;
26 | if( col > maxCol )
27 | {
28 | d_col = maxCol;
29 | err++;
30 | }else if( col == 0 )
31 | {
32 | d_col = 1;
33 | err++;
34 | }else
35 | d_col = col;
36 | return err == 0;
37 | }
38 |
--------------------------------------------------------------------------------
/ObRowCol.h:
--------------------------------------------------------------------------------
1 | #ifndef OBROWCOL_H
2 | #define OBROWCOL_H
3 |
4 | #include
5 |
6 | namespace Ob
7 | {
8 | struct RowCol
9 | {
10 | enum { ROW_BIT_LEN = 19, COL_BIT_LEN = 32 - ROW_BIT_LEN - 1, MSB = 0x80000000 };
11 | uint d_row : ROW_BIT_LEN; // supports 524k lines
12 | uint d_col : COL_BIT_LEN; // supports 4k chars per line
13 | uint unused : 1;
14 | RowCol():d_row(0),d_col(0),unused(0) {}
15 | RowCol( quint32 row, quint32 col );
16 | bool setRowCol( quint32 row, quint32 col );
17 | bool isValid() const { return d_row > 0 && d_col > 0; } // valid lines and cols start with 1; 0 is invalid
18 | quint32 packed() const { return ( d_row << COL_BIT_LEN ) | d_col | MSB; }
19 | static bool isPacked( quint32 rowCol ) { return rowCol & MSB; }
20 | static quint32 unpackCol(quint32 rowCol ) { return rowCol & ( ( 1 << COL_BIT_LEN ) -1 ); }
21 | static quint32 unpackCol2(quint32 rowCol ) { return isPacked(rowCol) ? unpackCol(rowCol) : 1; }
22 | static quint32 unpackRow(quint32 rowCol ) { return ( ( rowCol & ~MSB ) >> COL_BIT_LEN ); }
23 | static quint32 unpackRow2(quint32 rowCol ) { return isPacked(rowCol) ? unpackRow(rowCol) : rowCol; }
24 | quint32 line() const { return d_row; }
25 | bool operator==( const RowCol& rhs ) const { return d_row == rhs.d_row && d_col == rhs.d_col; }
26 | };
27 |
28 | struct Loc : public RowCol
29 | {
30 | Loc( quint32 row, quint32 col, const QString& f ):RowCol( row, col ),d_file(f) {}
31 | Loc( const RowCol& r, const QString& f):RowCol(r),d_file(f) {}
32 | QString d_file;
33 | };
34 | }
35 |
36 | #endif // OBROWCOL_H
37 |
--------------------------------------------------------------------------------
/ObToken.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019, 2020 Rochus Keller
3 | *
4 | * This file is part of the Oberon parser/code model library.
5 | *
6 | * The following is the license that applies to this copy of the
7 | * library. For a license to use the library under conditions
8 | * other than those described here, please email to me@rochus-keller.ch.
9 | *
10 | * GNU General Public License Usage
11 | * This file may be used under the terms of the GNU General Public
12 | * License (GPL) versions 2.0 or 3.0 as published by the Free Software
13 | * Foundation and appearing in the file LICENSE.GPL included in
14 | * the packaging of this file. Please review the following information
15 | * to ensure GNU General Public Licensing requirements will be met:
16 | * http://www.fsf.org/licensing/licenses/info/GPLv2.html and
17 | * http://www.gnu.org/copyleft/gpl.html.
18 | */
19 |
20 | #include "ObToken.h"
21 | using namespace Ob;
22 |
23 | bool Token::isValid() const
24 | {
25 | return d_type != Tok_Eof && d_type != Tok_Invalid;
26 | }
27 |
28 | bool Token::isEof() const
29 | {
30 | return d_type == Tok_Eof;
31 | }
32 |
33 | const char*Token::getName() const
34 | {
35 | return tokenTypeName( d_type );
36 | }
37 |
38 | const char*Token::getString() const
39 | {
40 | return tokenTypeString(d_type);
41 | }
42 |
43 |
--------------------------------------------------------------------------------
/Oberon.pri:
--------------------------------------------------------------------------------
1 | #/*
2 | #* Copyright 2019, 2020 Rochus Keller
3 | #*
4 | #* This file is part of the Oberon parser/code model library.
5 | #*
6 | #* The following is the license that applies to this copy of the
7 | #* library. For a license to use the library under conditions
8 | #* other than those described here, please email to me@rochus-keller.ch.
9 | #*
10 | #* GNU General Public License Usage
11 | #* This file may be used under the terms of the GNU General Public
12 | #* License (GPL) versions 2.0 or 3.0 as published by the Free Software
13 | #* Foundation and appearing in the file LICENSE.GPL included in
14 | #* the packaging of this file. Please review the following information
15 | #* to ensure GNU General Public Licensing requirements will be met:
16 | #* http://www.fsf.org/licensing/licenses/info/GPLv2.html and
17 | #* http://www.gnu.org/copyleft/gpl.html.
18 | #*/
19 |
20 | INCLUDEPATH += ..
21 |
22 | SOURCES += \
23 | $$PWD/ObSynTree.cpp \
24 | $$PWD/ObTokenType.cpp \
25 | $$PWD/ObParser.cpp \
26 | $$PWD/ObToken.cpp \
27 | $$PWD/ObLexer.cpp \
28 | $$PWD/ObFileCache.cpp \
29 | $$PWD/ObErrors.cpp \
30 | $$PWD/ObCodeModel.cpp \
31 | $$PWD/ObAst.cpp \
32 | $$PWD/ObAstEval.cpp \
33 | $$PWD/ObAstValidator.cpp \
34 | $$PWD/ObRowCol.cpp
35 |
36 | HEADERS += \
37 | $$PWD/ObSynTree.h \
38 | $$PWD/ObTokenType.h \
39 | $$PWD/ObParser.h \
40 | $$PWD/ObToken.h \
41 | $$PWD/ObLexer.h \
42 | $$PWD/ObFileCache.h \
43 | $$PWD/ObErrors.h \
44 | $$PWD/ObCodeModel.h \
45 | $$PWD/ObAst.h \
46 | $$PWD/ObAstEval.h \
47 | $$PWD/ObAstValidator.h \
48 | $$PWD/ObRowCol.h
49 |
50 |
--------------------------------------------------------------------------------
/OberonIde.qrc:
--------------------------------------------------------------------------------
1 |
2 |
3 | images/close.png
4 | images/exclamation-circle.png
5 | images/exclamation-red.png
6 | runtime/obnlj.lua
7 | oakwood/Files.Def
8 | oakwood/In.Def
9 | oakwood/Input.Def
10 | oakwood/Math.Def
11 | oakwood/Out.Def
12 | oakwood/Strings.Def
13 | oakwood/XYplane.Def
14 | oakwood/Coroutines.Def
15 | runtime/Out.lua
16 | runtime/Strings.lua
17 | runtime/XYPlane.lua
18 | runtime/Coroutines.lua
19 | runtime/Files.lua
20 | runtime/In.lua
21 | runtime/Input.lua
22 | runtime/Math.lua
23 |
24 |
25 |
--------------------------------------------------------------------------------
/ObnLjEditor.qrc:
--------------------------------------------------------------------------------
1 |
2 |
3 | runtime/obnlj.lua
4 | oakwood/Coroutines.Def
5 | oakwood/Files.Def
6 | oakwood/In.Def
7 | oakwood/Input.Def
8 | oakwood/Math.Def
9 | oakwood/Out.Def
10 | oakwood/Strings.Def
11 | oakwood/XYplane.Def
12 | runtime/Out.lua
13 | runtime/XYPlane.lua
14 | runtime/Strings.lua
15 | runtime/Math.lua
16 | runtime/Input.lua
17 | runtime/In.lua
18 | runtime/Files.lua
19 | runtime/Coroutines.lua
20 | runtime/obxlj.lua
21 |
22 |
23 |
--------------------------------------------------------------------------------
/ObnViewer.pro:
--------------------------------------------------------------------------------
1 | #/*
2 | #* Copyright 2019 Rochus Keller
3 | #*
4 | #* This file is part of the Oberon Viewer application.
5 | #*
6 | #* The following is the license that applies to this copy of the
7 | #* library. For a license to use the library under conditions
8 | #* other than those described here, please email to me@rochus-keller.ch.
9 | #*
10 | #* GNU General Public License Usage
11 | #* This file may be used under the terms of the GNU General Public
12 | #* License (GPL) versions 2.0 or 3.0 as published by the Free Software
13 | #* Foundation and appearing in the file LICENSE.GPL included in
14 | #* the packaging of this file. Please review the following information
15 | #* to ensure GNU General Public Licensing requirements will be met:
16 | #* http://www.fsf.org/licensing/licenses/info/GPLv2.html and
17 | #* http://www.gnu.org/copyleft/gpl.html.
18 | #*/
19 |
20 | QT += core gui
21 |
22 | greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
23 |
24 | TARGET = OberonViewer
25 | TEMPLATE = app
26 |
27 | INCLUDEPATH += ..
28 |
29 | SOURCES += \
30 | ObnViewerMain.cpp \
31 | OberonViewer.cpp \
32 | ObnHighlighter.cpp \
33 | NamedThingsMdl.cpp \
34 | CppKeywordDetector.cpp \
35 | ObCppGen.cpp \
36 | ObObxGen.cpp
37 |
38 | include( Oberon.pri )
39 |
40 | CONFIG(debug, debug|release) {
41 | DEFINES += _DEBUG
42 | }
43 |
44 | !win32{
45 | QMAKE_CXXFLAGS += -Wno-reorder -Wno-unused-parameter -Wno-unused-function -Wno-unused-variable
46 | }
47 |
48 | HEADERS += \
49 | OberonViewer.h \
50 | ObnHighlighter.h \
51 | NamedThingsMdl.h \
52 | ObCppGen.h \
53 | ObObxGen.h
54 |
55 |
56 |
57 |
58 |
--------------------------------------------------------------------------------
/ObsFiles.h:
--------------------------------------------------------------------------------
1 | #ifndef OBSFILES_H
2 | #define OBSFILES_H
3 |
4 | /*
5 | * Copyright 2021 Rochus Keller
6 | *
7 | * This file is part of the Oberon+ parser/compiler library.
8 | *
9 | * The following is the license that applies to this copy of the
10 | * library. For a license to use the library under conditions
11 | * other than those described here, please email to me@rochus-keller.ch.
12 | *
13 | * GNU General Public License Usage
14 | * This file may be used under the terms of the GNU General Public
15 | * License (GPL) versions 2.0 or 3.0 as published by the Free Software
16 | * Foundation and appearing in the file LICENSE.GPL included in
17 | * the packaging of this file. Please review the following information
18 | * to ensure GNU General Public Licensing requirements will be met:
19 | * http://www.fsf.org/licensing/licenses/info/GPLv2.html and
20 | * http://www.gnu.org/copyleft/gpl.html.
21 | */
22 |
23 | #include
24 |
25 | namespace Obs
26 | {
27 | struct Files
28 | {
29 | static void setFileSystemRoot( const QString& dirPath );
30 | };
31 | }
32 | #endif // OBSFILES_H
33 |
34 |
--------------------------------------------------------------------------------
/ObxCGen.h:
--------------------------------------------------------------------------------
1 | #ifndef OBXCGEN_H
2 | #define OBXCGEN_H
3 |
4 | /*
5 | * Copyright 2021 Rochus Keller
6 | *
7 | * This file is part of the Oberon+ parser/compiler library.
8 | *
9 | * The following is the license that applies to this copy of the
10 | * library. For a license to use the library under conditions
11 | * other than those described here, please email to me@rochus-keller.ch.
12 | *
13 | * GNU General Public License Usage
14 | * This file may be used under the terms of the GNU General Public
15 | * License (GPL) versions 2.0 or 3.0 as published by the Free Software
16 | * Foundation and appearing in the file LICENSE.GPL included in
17 | * the packaging of this file. Please review the following information
18 | * to ensure GNU General Public Licensing requirements will be met:
19 | * http://www.fsf.org/licensing/licenses/info/GPLv2.html and
20 | * http://www.gnu.org/copyleft/gpl.html.
21 | */
22 |
23 | #include
24 | class QIODevice;
25 |
26 | namespace Ob
27 | {
28 | class Errors;
29 | }
30 | namespace Obx
31 | {
32 | class Model;
33 | struct Module;
34 | struct Type;
35 | struct ProcType;
36 |
37 | class CGen
38 | {
39 | public:
40 | static bool generateLjFfiBinding(Module*, QIODevice* out, Ob::Errors* = 0 );
41 | static bool generateHeader(Module*, QIODevice* out, Ob::Errors* = 0 );
42 | static bool renderNameType(Type*, QByteArray& name, const QByteArray& pfx = QByteArray() , bool vla = false);
43 | static QByteArray renderBasicType( Type* );
44 | static QByteArray renderFormals( ProcType*, const QByteArray& pfx = QByteArray() );
45 | private:
46 | CGen();
47 | };
48 | }
49 |
50 | #endif // OBXCGEN_H
51 |
--------------------------------------------------------------------------------
/ObxCGen2.h:
--------------------------------------------------------------------------------
1 | #ifndef OBXCGEN2_H
2 | #define OBXCGEN2_H
3 |
4 | /*
5 | * Copyright 2021 Rochus Keller
6 | *
7 | * This file is part of the Oberon+ parser/compiler library.
8 | *
9 | * The following is the license that applies to this copy of the
10 | * library. For a license to use the library under conditions
11 | * other than those described here, please email to me@rochus-keller.ch.
12 | *
13 | * GNU General Public License Usage
14 | * This file may be used under the terms of the GNU General Public
15 | * License (GPL) versions 2.0 or 3.0 as published by the Free Software
16 | * Foundation and appearing in the file LICENSE.GPL included in
17 | * the packaging of this file. Please review the following information
18 | * to ensure GNU General Public Licensing requirements will be met:
19 | * http://www.fsf.org/licensing/licenses/info/GPLv2.html and
20 | * http://www.gnu.org/copyleft/gpl.html.
21 | */
22 |
23 | #include
24 | #include
25 | class QIODevice;
26 |
27 | namespace Ob
28 | {
29 | class Errors;
30 | }
31 | namespace Obx
32 | {
33 | class Model;
34 | class Project;
35 | struct Module;
36 | class IlEmitter;
37 |
38 | class CGen2
39 | {
40 | public:
41 | static bool translateAll(Project*, bool debug, const QString& where );
42 | static bool translate(QIODevice* header, QIODevice* body, Module*, bool debug, Ob::Errors* = 0 );
43 | static bool generateMain(QIODevice*, const QByteArray& callMod,
44 | const QByteArray& callFunc,
45 | const QByteArrayList& allMods );
46 | static bool generateMain(QIODevice*, const QByteArrayList& callMods,
47 | const QByteArrayList& allMods );
48 | private:
49 | CGen2();
50 | };
51 | }
52 |
53 | #endif // OBXCGEN2_H
54 |
--------------------------------------------------------------------------------
/ObxCilGen.h:
--------------------------------------------------------------------------------
1 | #ifndef OBXCILGEN_H
2 | #define OBXCILGEN_H
3 |
4 | /*
5 | * Copyright 2021 Rochus Keller
6 | *
7 | * This file is part of the Oberon+ parser/compiler library.
8 | *
9 | * The following is the license that applies to this copy of the
10 | * library. For a license to use the library under conditions
11 | * other than those described here, please email to me@rochus-keller.ch.
12 | *
13 | * GNU General Public License Usage
14 | * This file may be used under the terms of the GNU General Public
15 | * License (GPL) versions 2.0 or 3.0 as published by the Free Software
16 | * Foundation and appearing in the file LICENSE.GPL included in
17 | * the packaging of this file. Please review the following information
18 | * to ensure GNU General Public Licensing requirements will be met:
19 | * http://www.fsf.org/licensing/licenses/info/GPLv2.html and
20 | * http://www.gnu.org/copyleft/gpl.html.
21 | */
22 |
23 | #include
24 | #include
25 | class QIODevice;
26 |
27 | namespace Ob
28 | {
29 | class Errors;
30 | }
31 | namespace Obx
32 | {
33 | class Model;
34 | class Project;
35 | struct Module;
36 | class IlEmitter;
37 |
38 | class CilGen
39 | {
40 | public:
41 | enum How { Ilasm, Fastasm, IlOnly, Pelib };
42 | // all true on success, false on error
43 | static bool translateAll(Project*, How how, bool debug, const QString& where, bool forceGen = false );
44 | static bool translate(Module*, IlEmitter* out, bool debug, Ob::Errors* = 0 );
45 | static bool generateMain(IlEmitter* out, const QByteArray& thisMod,
46 | const QByteArray& callMod = QByteArray(), const QByteArray& callFunc = QByteArray());
47 | static bool generateMain(IlEmitter* out, const QByteArray& thisMod, const QByteArrayList& callMods );
48 | private:
49 | CilGen();
50 | };
51 | }
52 |
53 | #endif // OBXCILGEN_H
54 |
--------------------------------------------------------------------------------
/ObxEvaluator.h:
--------------------------------------------------------------------------------
1 | #ifndef OBXEVALUATOR_H
2 | #define OBXEVALUATOR_H
3 |
4 | /*
5 | * Copyright 2020-2021 Rochus Keller
6 | *
7 | * This file is part of the OBX parser/code model library.
8 | *
9 | * The following is the license that applies to this copy of the
10 | * library. For a license to use the library under conditions
11 | * other than those described here, please email to me@rochus-keller.ch.
12 | *
13 | * GNU General Public License Usage
14 | * This file may be used under the terms of the GNU General Public
15 | * License (GPL) versions 2.0 or 3.0 as published by the Free Software
16 | * Foundation and appearing in the file LICENSE.GPL included in
17 | * the packaging of this file. Please review the following information
18 | * to ensure GNU General Public Licensing requirements will be met:
19 | * http://www.fsf.org/licensing/licenses/info/GPLv2.html and
20 | * http://www.gnu.org/copyleft/gpl.html.
21 | */
22 |
23 | #include
24 | #include
25 |
26 | namespace Obx
27 | {
28 | class Evaluator : public QObject // for tr()
29 | {
30 | public:
31 |
32 | struct Result
33 | {
34 | QVariant d_value;
35 | uint d_vtype : 7; // Literal::ValueType
36 | uint d_strLen : 22;
37 | uint d_wide : 1; // mark WSTRING and WCHAR, double vs float, longint vs integer
38 | uint d_minInt : 1;
39 | uint d_dyn : 1;
40 | Result():d_vtype(Literal::NoValue),d_wide(false),d_strLen(0),d_dyn(0),d_minInt(0){}
41 | };
42 |
43 | static Result eval( Expression*, Scope*, bool supportVla = false, Ob::Errors* = 0 );
44 |
45 | private:
46 | Evaluator();
47 | };
48 | }
49 |
50 | #endif // OBXEVALUATOR_H
51 |
--------------------------------------------------------------------------------
/ObxLibFfi.h:
--------------------------------------------------------------------------------
1 | #ifndef OBXLIBFFI_H
2 | #define OBXLIBFFI_H
3 |
4 | /*
5 | * Copyright 2021 Rochus Keller
6 | *
7 | * This file is part of the OBX parser/code model library.
8 | *
9 | * The following is the license that applies to this copy of the
10 | * library. For a license to use the library under conditions
11 | * other than those described here, please email to me@rochus-keller.ch.
12 | *
13 | * GNU General Public License Usage
14 | * This file may be used under the terms of the GNU General Public
15 | * License (GPL) versions 2.0 or 3.0 as published by the Free Software
16 | * Foundation and appearing in the file LICENSE.GPL included in
17 | * the packaging of this file. Please review the following information
18 | * to ensure GNU General Public Licensing requirements will be met:
19 | * http://www.fsf.org/licensing/licenses/info/GPLv2.html and
20 | * http://www.gnu.org/copyleft/gpl.html.
21 | */
22 |
23 | #include
24 |
25 | typedef struct lua_State lua_State;
26 |
27 | namespace Obx
28 | {
29 | typedef void (*SendToLog)( const QString& );
30 |
31 | struct LibFfi
32 | {
33 | static void setSendToLog(SendToLog);
34 | static void install(lua_State *L);
35 | };
36 | }
37 |
38 | #endif // OBXLIBFFI_H
39 |
40 |
--------------------------------------------------------------------------------
/ObxLjbcGen.h:
--------------------------------------------------------------------------------
1 | #ifndef OBXLJBCGEN_H
2 | #define OBXLJBCGEN_H
3 |
4 | /*
5 | * Copyright 2021 Rochus Keller
6 | *
7 | * This file is part of the Oberon+ parser/compiler library.
8 | *
9 | * The following is the license that applies to this copy of the
10 | * library. For a license to use the library under conditions
11 | * other than those described here, please email to me@rochus-keller.ch.
12 | *
13 | * GNU General Public License Usage
14 | * This file may be used under the terms of the GNU General Public
15 | * License (GPL) versions 2.0 or 3.0 as published by the Free Software
16 | * Foundation and appearing in the file LICENSE.GPL included in
17 | * the packaging of this file. Please review the following information
18 | * to ensure GNU General Public Licensing requirements will be met:
19 | * http://www.fsf.org/licensing/licenses/info/GPLv2.html and
20 | * http://www.gnu.org/copyleft/gpl.html.
21 | */
22 |
23 | #include
24 | class QIODevice;
25 |
26 | namespace Ob
27 | {
28 | class Errors;
29 | }
30 | namespace Obx
31 | {
32 | class Model;
33 | struct Module;
34 | struct Type;
35 |
36 | class LjbcGen
37 | {
38 | public:
39 | // static bool translate(Model*,const QString& outdir, const QString& mod, bool strip = false, Ob::Errors* = 0 );
40 | static bool allocateSlots(Module*me, QIODevice* out = 0);
41 | static bool translate(Module*, QIODevice* out, bool strip = false, Ob::Errors* = 0 );
42 | // static bool allocateDef(Module*, QIODevice* out,Ob::Errors* = 0);
43 | private:
44 | LjbcGen();
45 | };
46 | }
47 |
48 | #endif // OBXLJBCGEN_H
49 |
--------------------------------------------------------------------------------
/ObxPackage.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2021 Rochus Keller
3 | *
4 | * This file is part of the Oberon+ parser/compiler library.
5 | *
6 | * The following is the license that applies to this copy of the
7 | * library. For a license to use the library under conditions
8 | * other than those described here, please email to me@rochus-keller.ch.
9 | *
10 | * GNU General Public License Usage
11 | * This file may be used under the terms of the GNU General Public
12 | * License (GPL) versions 2.0 or 3.0 as published by the Free Software
13 | * Foundation and appearing in the file LICENSE.GPL included in
14 | * the packaging of this file. Please review the following information
15 | * to ensure GNU General Public Licensing requirements will be met:
16 | * http://www.fsf.org/licensing/licenses/info/GPLv2.html and
17 | * http://www.gnu.org/copyleft/gpl.html.
18 | */
19 |
20 | #include "ObxPackage.h"
21 | using namespace Obx;
22 |
23 |
24 |
--------------------------------------------------------------------------------
/ObxPackage.h:
--------------------------------------------------------------------------------
1 | #ifndef OBXPACKAGE_H
2 | #define OBXPACKAGE_H
3 |
4 | /*
5 | * Copyright 2021 Rochus Keller
6 | *
7 | * This file is part of the Oberon+ parser/compiler library.
8 | *
9 | * The following is the license that applies to this copy of the
10 | * library. For a license to use the library under conditions
11 | * other than those described here, please email to me@rochus-keller.ch.
12 | *
13 | * GNU General Public License Usage
14 | * This file may be used under the terms of the GNU General Public
15 | * License (GPL) versions 2.0 or 3.0 as published by the Free Software
16 | * Foundation and appearing in the file LICENSE.GPL included in
17 | * the packaging of this file. Please review the following information
18 | * to ensure GNU General Public Licensing requirements will be met:
19 | * http://www.fsf.org/licensing/licenses/info/GPLv2.html and
20 | * http://www.gnu.org/copyleft/gpl.html.
21 | */
22 |
23 | #include
24 | #include
25 |
26 | namespace Obx
27 | {
28 | typedef QByteArrayList VirtualPath;
29 | // A virtual path is a hierarchical name to identify a Package or a Module
30 | // either the complete path of a virtual dir or a module in it
31 |
32 | // A Package is just a bunch of physical module files which are associated with the same VirtualPath
33 | struct Package
34 | {
35 | VirtualPath d_path;
36 | QStringList d_files; // list of absolute module file paths belonging to the package
37 | };
38 | typedef QList PackageList;
39 |
40 | }
41 |
42 | #endif // OBXPACKAGE_H
43 |
--------------------------------------------------------------------------------
/ObxParser.pri:
--------------------------------------------------------------------------------
1 | #/*
2 | #* Copyright 2019, 2020, 2021 Rochus Keller
3 | #*
4 | #* This file is part of the Oberon+ parser/code model library.
5 | #*
6 | #* The following is the license that applies to this copy of the
7 | #* library. For a license to use the library under conditions
8 | #* other than those described here, please email to me@rochus-keller.ch.
9 | #*
10 | #* GNU General Public License Usage
11 | #* This file may be used under the terms of the GNU General Public
12 | #* License (GPL) versions 2.0 or 3.0 as published by the Free Software
13 | #* Foundation and appearing in the file LICENSE.GPL included in
14 | #* the packaging of this file. Please review the following information
15 | #* to ensure GNU General Public Licensing requirements will be met:
16 | #* http://www.fsf.org/licensing/licenses/info/GPLv2.html and
17 | #* http://www.gnu.org/copyleft/gpl.html.
18 | #*/
19 |
20 | INCLUDEPATH += ..
21 |
22 | DEFINES += _HAS_GENERICS OBX_BBOX
23 |
24 | SOURCES += \
25 | $$PWD/ObToken.cpp \
26 | $$PWD/ObLexer.cpp \
27 | $$PWD/ObFileCache.cpp \
28 | $$PWD/ObErrors.cpp \
29 | $$PWD/ObRowCol.cpp \
30 | $$PWD/ObxValidator.cpp \
31 | $$PWD/ObxProject.cpp \
32 | $$PWD/ObxParser.cpp \
33 | $$PWD/ObxPackage.cpp \
34 | $$PWD/ObxModel.cpp \
35 | $$PWD/ObxEvaluator.cpp \
36 | $$PWD/ObxAst.cpp \
37 | $$PWD/ObTokenType.cpp
38 |
39 | HEADERS += \
40 | $$PWD/ObToken.h \
41 | $$PWD/ObLexer.h \
42 | $$PWD/ObFileCache.h \
43 | $$PWD/ObErrors.h \
44 | $$PWD/ObRowCol.h \
45 | $$PWD/ObxValidator.h \
46 | $$PWD/ObxProject.h \
47 | $$PWD/ObxParser.h \
48 | $$PWD/ObxPackage.h \
49 | $$PWD/ObxModel.h \
50 | $$PWD/ObxEvaluator.h \
51 | $$PWD/ObxAst.h \
52 | $$PWD/ObTokenType.h
53 |
54 |
--------------------------------------------------------------------------------
/documentation/Readme.md:
--------------------------------------------------------------------------------
1 | Moved the programming languages specification to https://github.com/oberon-lang/specification.
2 |
--------------------------------------------------------------------------------
/examples/Collections.obx:
--------------------------------------------------------------------------------
1 | module Collections(T)
2 | type Deque* = pointer to record
3 | data: pointer to array of T
4 | size: integer end
5 | proc createDeque*(): Deque
6 | const initial_len = 50
7 | var this: Deque // this is initialized to nil
8 | begin
9 | new(this); new(this.data,initial_len) // semicolon is optional
10 | return this
11 | end createDeque
12 |
13 | proc (this: Deque) append*(in element: T)
14 | begin
15 | if this.size = len(this.data) then assert(false) end
16 | this.data[this.size] := element inc(this.size)
17 | end append
18 |
19 | type Iterator* = record end
20 | proc (var this: Iterator) apply*(in element: T) end
21 |
22 | proc (this: Deque) forEach*(var iter: Iterator)
23 | var i: integer
24 | begin
25 | for i := 0 to this.size-1 do iter.apply(this.data[i]) end
26 | end forEach
27 | end Collections
28 |
--------------------------------------------------------------------------------
/examples/Drawing.obx:
--------------------------------------------------------------------------------
1 | module Drawing
2 | import F := Fibonacci
3 | type Figure* = pointer to record
4 | position: record x,y: integer end
5 | end
6 | proc (this: Figure) draw*() end
7 |
8 | type
9 | Circle* = pointer to record (Figure) diameter: integer end
10 | Square* = pointer to record (Figure) width: integer end
11 | proc (this: Circle) draw*() end
12 | proc (this: Square) draw*() end
13 |
14 | import C := Collections(Figure)
15 |
16 | var figures: C.Deque
17 | circle: Circle
18 | square: Square
19 |
20 | proc drawAll*()
21 | type I = record(C.Iterator) count: integer end
22 | proc (var this: I) apply( in figure: Figure )
23 | begin figure.draw(); inc(this.count) end apply
24 | var i: I // count is initialized to zero
25 | begin
26 | figures.forEach(i)
27 | assert(i.count = 2)
28 | end drawAll
29 | begin
30 | figures := C.createDeque()
31 | new(circle)
32 | circle.position.x := F.calc(3); circle.position.y := F.calc(4)
33 | circle.diameter := 3
34 | figures.append(circle)
35 | new(square)
36 | square.position.x := F.calc(5); square.position.y := F.calc(6)
37 | square.width := 4
38 | figures.append(square)
39 | drawAll()
40 | end Drawing
41 |
--------------------------------------------------------------------------------
/examples/Example.obxpro:
--------------------------------------------------------------------------------
1 | [General]
2 | BuiltInOakwood=true
3 | BuiltInObSysInner=false
4 | MainModule=@ByteArray()
5 | MainProc=@ByteArray()
6 | Suffixes=@Invalid()
7 | WorkingDir=
8 |
9 | [.]
10 | size=0
11 |
12 | [Modules]
13 | 1\AbsPath=/home/me/Entwicklung/Modules/Oberon/examples/Collections.obx
14 | 1\RelPath=Collections.obx
15 | 2\AbsPath=/home/me/Entwicklung/Modules/Oberon/examples/Drawing.obx
16 | 2\RelPath=Drawing.obx
17 | 3\AbsPath=/home/me/Entwicklung/Modules/Oberon/examples/Fibonacci.obx
18 | 3\RelPath=Fibonacci.obx
19 | 4\AbsPath=/home/me/Entwicklung/Modules/Oberon/examples/Unicode.obx
20 | 4\RelPath=Unicode.obx
21 | 5\AbsPath=/home/me/Entwicklung/Modules/Oberon/examples/Lists.obx
22 | 5\RelPath=Lists.obx
23 | 6\AbsPath=/home/me/Entwicklung/Modules/Oberon/examples/ListTest.obx
24 | 6\RelPath=ListTest.obx
25 | 7\AbsPath=/home/me/Entwicklung/Modules/Oberon/examples/Lists2.obx
26 | 7\RelPath=Lists2.obx
27 | size=7
28 |
29 | [Packages]
30 | 1\Name=@ByteArray()
31 | 2\Name=@ByteArray()
32 | size=2
33 |
--------------------------------------------------------------------------------
/examples/Fibonacci.obx:
--------------------------------------------------------------------------------
1 | module Fibonacci
2 | proc calc*( n : integer ): integer
3 | var a, b: integer // comma is optional
4 | begin
5 | if n > 1 then
6 | a := calc( n - 1 )
7 | b := calc( n - 2 )
8 | return a + b
9 | elsif n = 0 then
10 | return 0
11 | else
12 | return 1
13 | end
14 | end calc
15 | var res: integer
16 | begin
17 | res := calc(21)
18 | assert( res = 10946 )
19 | end Fibonacci
20 |
--------------------------------------------------------------------------------
/examples/ListTest.obx:
--------------------------------------------------------------------------------
1 | module ListTest
2 | import
3 | L := Lists(integer)
4 | var
5 | l : L.List
6 | begin
7 | new(l)
8 | l.value := 123
9 | l.Add(456)
10 | l.Print()
11 | l.next.Print()
12 | end ListTest
13 |
--------------------------------------------------------------------------------
/examples/Lists.obx:
--------------------------------------------------------------------------------
1 | module Lists(T)
2 | type
3 | List* = ^record
4 | value* : T
5 | next* : List
6 | end
7 |
8 | proc (l : List) Add* (v : T)
9 | begin
10 | new( l.next )
11 | l.next.value := v
12 | end Add
13 |
14 | proc (l : List) Print*()
15 | begin
16 | println(l.value)
17 | end Print
18 | end Lists
19 |
--------------------------------------------------------------------------------
/examples/Lists2.obx:
--------------------------------------------------------------------------------
1 | // TODO: this is an example adopted from Wikipedia, but List.Add makes no sense; fix it
2 | module Lists2
3 | import Out
4 | type
5 | List* = ^record
6 | value : integer
7 | next : List
8 | end
9 |
10 | proc (l : List) Add* (v : integer)
11 | begin
12 | if l = nil then
13 | new(l) // create record instance
14 | l.value := v
15 | else
16 | l.next.Add(v)
17 | end
18 | end Add
19 |
20 | proc (t: List) Write*
21 | begin
22 | Out.Int(t.value,8); Out.Ln
23 | if t.next # nil then t.next.Write end
24 | end Write
25 |
26 | end Lists2
27 |
--------------------------------------------------------------------------------
/examples/See_also:
--------------------------------------------------------------------------------
1 | testcases
2 | Are-we-fast-yet
3 | Hennessy
4 |
5 | https://github.com/rochus-keller/BlackboxFramework/tree/master/Minimal
6 |
--------------------------------------------------------------------------------
/examples/Test.obxpro:
--------------------------------------------------------------------------------
1 | [General]
2 | BuildDir=
3 | BuiltInOakwood=true
4 | BuiltInObSysInner=false
5 | MainModule=@ByteArray()
6 | MainProc=@ByteArray()
7 | Suffixes=@Invalid()
8 | WorkingDir=
9 |
10 | [Modules]
11 | 1\AbsPath=/home/me/Entwicklung/Modules/Oberon/examples/Lists2.obx
12 | 1\RelPath=Lists2.obx
13 | size=1
14 |
15 | [Packages]
16 | 1\Name=@ByteArray()
17 | size=1
18 |
--------------------------------------------------------------------------------
/examples/Unicode.obx:
--------------------------------------------------------------------------------
1 | module Unicode
2 | var
3 | str: array 32 of char
4 | ustr: array 32 of wchar
5 | begin
6 | str := "Isto é português"
7 | ustr := "美丽的世界,你好!" + " " + str
8 | println(ustr) // prints "美丽的世界,你好! Isto é português"
9 | end Unicode
10 |
--------------------------------------------------------------------------------
/examples/traditional_syntax/Collections.obx:
--------------------------------------------------------------------------------
1 | MODULE Collections(T);
2 |
3 | TYPE Deque* = POINTER TO RECORD
4 | data: POINTER TO ARRAY OF T;
5 | size: INTEGER END;
6 | Iterator* = RECORD END;
7 |
8 | PROCEDURE createDeque*(): Deque;
9 | CONST initial_len = 50;
10 | VAR this: Deque; // this is initialized to nil
11 | BEGIN
12 | NEW(this); NEW(this.data,initial_len); // semicolon is optional
13 | RETURN this
14 | END createDeque;
15 |
16 | PROCEDURE (this: Deque) append*(IN element: T);
17 | BEGIN
18 | IF this.size = LEN(this.data) THEN ASSERT(FALSE) END;
19 | this.data[this.size] := element INC(this.size);
20 | END append;
21 |
22 | PROCEDURE (VAR this: Iterator) apply*(IN element: T) END;
23 |
24 | PROCEDURE (this: Deque) forEach*(VAR iter: Iterator);
25 | VAR i: INTEGER;
26 | BEGIN
27 | FOR i := 0 TO this.size-1 DO iter.apply(this.data[i]) END;
28 | END forEach
29 | END Collections.
30 |
--------------------------------------------------------------------------------
/examples/traditional_syntax/Drawing.obx:
--------------------------------------------------------------------------------
1 | MODULE Drawing;
2 | IMPORT F := Fibonacci,
3 | C := Collections(Figure);
4 |
5 | TYPE Figure* = POINTER TO RECORD
6 | position: RECORD x,y: INTEGER END
7 | END;
8 | Circle* = POINTER TO RECORD (Figure) diameter: INTEGER END;
9 | Square* = POINTER TO RECORD (Figure) width: INTEGER END;
10 |
11 | VAR figures: C.Deque;
12 | circle: Circle;
13 | square: Square;
14 |
15 | PROCEDURE (this: Figure) draw*() END;
16 | PROCEDURE (this: Circle) draw*() END;
17 | PROCEDURE (this: Square) draw*() END;
18 |
19 | PROCEDURE drawAll*();
20 | TYPE I = RECORD(C.Iterator) count: INTEGER END;
21 | VAR i: I; // count is initialized to zero
22 | PROCEDURE (VAR this: I) apply( IN figure: Figure );
23 | BEGIN figure.draw(); INC(this.count)
24 | END apply;
25 | BEGIN
26 | figures.forEach(i);
27 | ASSERT(i.count = 2);
28 | END drawAll;
29 | BEGIN
30 | figures := C.createDeque();
31 | NEW(circle);
32 | circle.position.x := F.calc(3); circle.position.y := F.calc(4);
33 | circle.diameter := 3;
34 | figures.append(circle);
35 | NEW(square);
36 | square.position.x := F.calc(5); square.position.y := F.calc(6);
37 | square.width := 4;
38 | figures.append(square);
39 | drawAll();
40 | END Drawing.
41 |
--------------------------------------------------------------------------------
/examples/traditional_syntax/Example.obxpro:
--------------------------------------------------------------------------------
1 | [General]
2 | BuiltInOakwood=true
3 | BuiltInObSysInner=false
4 | MainModule=@ByteArray()
5 | MainProc=@ByteArray()
6 | Suffixes=@Invalid()
7 | WorkingDir=
8 |
9 | [.]
10 | size=0
11 |
12 | [Modules]
13 | 1\AbsPath=/home/me/Entwicklung/Modules/Oberon/examples/traditional_syntax/Collections.obx
14 | 1\RelPath=Collections.obx
15 | 2\AbsPath=/home/me/Entwicklung/Modules/Oberon/examples/traditional_syntax/Drawing.obx
16 | 2\RelPath=Drawing.obx
17 | 3\AbsPath=/home/me/Entwicklung/Modules/Oberon/examples/traditional_syntax/Fibonacci.obx
18 | 3\RelPath=Fibonacci.obx
19 | 4\AbsPath=/home/me/Entwicklung/Modules/Oberon/examples/traditional_syntax/Unicode.obx
20 | 4\RelPath=Unicode.obx
21 | 5\AbsPath=/home/me/Entwicklung/Modules/Oberon/examples/traditional_syntax/Lists.obx
22 | 5\RelPath=Lists.obx
23 | size=5
24 |
25 | [Packages]
26 | 1\Name=@ByteArray()
27 | 2\Name=@ByteArray()
28 | size=2
29 |
--------------------------------------------------------------------------------
/examples/traditional_syntax/Fibonacci.obx:
--------------------------------------------------------------------------------
1 | MODULE Fibonacci;
2 | VAR res: INTEGER;
3 | PROCEDURE calc*( n : INTEGER ): INTEGER;
4 | VAR a, b: INTEGER;
5 | BEGIN
6 | IF n > 1 THEN
7 | a := calc(n - 1);
8 | b := calc(n - 2);
9 | RETURN a + b
10 | ELSIF n = 0 THEN
11 | RETURN 0
12 | ELSE
13 | RETURN 1
14 | END
15 | END calc;
16 | BEGIN
17 | res := calc(21);
18 | ASSERT( res = 10946 )
19 | END Fibonacci.
20 |
--------------------------------------------------------------------------------
/examples/traditional_syntax/Lists.obx:
--------------------------------------------------------------------------------
1 | MODULE Lists;
2 | IMPORT Out;
3 | TYPE
4 | List* = POINTER TO ListNode;
5 | ListNode = RECORD
6 | value : INTEGER;
7 | next : List;
8 | END;
9 |
10 | PROCEDURE (l : List) Add* (v : INTEGER);
11 | BEGIN
12 | IF l = NIL THEN
13 | NEW(l); (* create record instance *)
14 | l.value := v
15 | ELSE
16 | l.next.Add(v)
17 | END
18 | END Add;
19 |
20 | PROCEDURE (t: List) Write*;
21 | BEGIN
22 | Out.Int(t.value,8); Out.Ln;
23 | IF t.next # NIL THEN t.next.Write END;
24 | END Write;
25 | END Lists.
26 |
--------------------------------------------------------------------------------
/examples/traditional_syntax/Unicode.obx:
--------------------------------------------------------------------------------
1 | MODULE Unicode;
2 | VAR
3 | str: ARRAY 32 OF CHAR;
4 | ustr: ARRAY 32 OF WCHAR;
5 | BEGIN
6 | str := "Isto é português";
7 | ustr := "美丽的世界,你好!" + " " + str;
8 | PRINTLN(ustr) // prints "美丽的世界,你好! Isto é português"
9 | END Unicode.
10 |
--------------------------------------------------------------------------------
/examples/wikipedia_example_in_Oberon+/Figures.mod:
--------------------------------------------------------------------------------
1 | (* Example from https://en.wikipedia.org/wiki/Oberon_(programming_language)
2 | changed to Oberon+ syntax *)
3 |
4 | module Figures; // Abstract module
5 |
6 | type
7 | Figure* = pointer to FigureDesc;
8 | Interface* = pointer to InterfaceDesc;
9 |
10 | InterfaceDesc* = record
11 | draw* : procedure (f : Figure);
12 | clear* : procedure (f : Figure);
13 | mark* : procedure (f : Figure);
14 | move* : procedure (f : Figure; dx, dy : integer);
15 | end;
16 |
17 | FigureDesc* = record
18 | if_: Interface;
19 | end;
20 |
21 | procedure Init* (f : Figure; if_ : Interface);
22 | begin
23 | f.if_ := if_;
24 | end Init;
25 |
26 | procedure Draw* (f : Figure);
27 | begin
28 | f.if_.draw(f);
29 | end Draw;
30 |
31 | // Other procedures here
32 |
33 | end Figures.
34 |
--------------------------------------------------------------------------------
/examples/wikipedia_example_in_Oberon+/Lists_v0.mod:
--------------------------------------------------------------------------------
1 | (* example from https://en.wikipedia.org/wiki/Oberon-2,
2 | modified Get for Oberon-07 compatibility *)
3 |
4 | MODULE Lists;
5 |
6 | (*** declare global constants, types and variables ***)
7 |
8 | TYPE
9 | List* = POINTER TO ListNode;
10 | ListNode = RECORD
11 | value : Integer;
12 | next : List;
13 | END;
14 |
15 | (*** declare procedures ***)
16 |
17 | PROCEDURE (l : List) Add* (v : Integer);
18 | BEGIN
19 | IF l = NIL THEN
20 | NEW(l); (* create record instance *)
21 | l.value := v
22 | ELSE
23 | l.next.Add(v) (* recursive call to .add(n) *)
24 | END
25 | END Add;
26 |
27 | PROCEDURE (l : List) Get* () : Integer;
28 | VAR
29 | v : Integer;
30 | BEGIN
31 | IF l # NIL THEN
32 | v := l.value; (* this line will crash if l is NIL *)
33 | l := l.next;
34 | END;
35 | RETURN v
36 | END Get;
37 |
38 | END Lists.
39 |
40 |
--------------------------------------------------------------------------------
/examples/wikipedia_example_in_Oberon+/Lists_v1.mod:
--------------------------------------------------------------------------------
1 | (* example from https://en.wikipedia.org/wiki/Oberon-2,
2 | v0 + lower-caps keywords *)
3 |
4 | module Lists;
5 |
6 | (*** declare global constants, types and variables ***)
7 |
8 | type
9 | List* = pointer to ListNode;
10 | ListNode = record
11 | value : integer;
12 | next : List;
13 | end;
14 |
15 | (*** declare procedures ***)
16 |
17 | procedure (l : List) Add* (v : integer);
18 | begin
19 | if l = NIL then
20 | new(l); (* create record instance *)
21 | l.value := v
22 | else
23 | l.next.Add(v) (* recursive call to .add(n) *)
24 | end
25 | end Add;
26 |
27 | procedure (l : List) Get* () : integer;
28 | var
29 | v : integer;
30 | begin
31 | if l # NIL then
32 | v := l.value; (* this line will crash if l is NIL *)
33 | l := l.next;
34 | end;
35 | return v
36 | end Get;
37 |
38 | end Lists.
39 |
40 |
--------------------------------------------------------------------------------
/examples/wikipedia_example_in_Oberon+/Lists_v2.mod:
--------------------------------------------------------------------------------
1 | (* example from https://en.wikipedia.org/wiki/Oberon-2,
2 | v1 + short keywords + line comments *)
3 |
4 | module Lists;
5 |
6 | // declare global constants, types and variables
7 |
8 | type
9 | List* = ^ListNode;
10 | ListNode = record
11 | value : integer;
12 | next : List;
13 | end;
14 |
15 | // declare procedures
16 |
17 | proc (l : List) Add* (v : integer);
18 | do
19 | if l = NIL then
20 | new(l); // create record instance
21 | l.value := v
22 | else
23 | l.next.Add(v) // recursive call to .add(n)
24 | end
25 | end Add;
26 |
27 | proc (l : List) Get* () : integer;
28 | var
29 | v : integer;
30 | do
31 | if l # NIL then
32 | v := l.value; // this line will crash if l is NIL
33 | l := l.next;
34 | end;
35 | return v
36 | end Get;
37 |
38 | end Lists.
39 |
40 |
--------------------------------------------------------------------------------
/examples/wikipedia_example_in_Oberon+/Lists_v3.mod:
--------------------------------------------------------------------------------
1 | (* example from https://en.wikipedia.org/wiki/Oberon-2,
2 | v2 + left out semicolons and terminating dot *)
3 |
4 | module Lists
5 |
6 | // declare global constants, types and variables
7 |
8 | type
9 | List* = ^ListNode
10 | ListNode = record
11 | value : integer
12 | next : List
13 | end
14 |
15 | // declare procedures
16 |
17 | proc (l : List) Add* (v : integer)
18 | do
19 | if l = NIL then
20 | new(l) // create record instance
21 | l.value := v
22 | else
23 | l.next.Add(v) // recursive call to .add(n)
24 | end
25 | end Add
26 |
27 | proc (l : List) Get* () : integer
28 | var
29 | v : integer
30 | do
31 | if l # NIL then
32 | v := l.value // this line will crash if l is NIL
33 | l := l.next
34 | end
35 | return v
36 | end Get
37 |
38 | end Lists
39 |
40 |
--------------------------------------------------------------------------------
/examples/wikipedia_example_in_Oberon+/Lists_v4.mod:
--------------------------------------------------------------------------------
1 | (* Example from https://en.wikipedia.org/wiki/Oberon-2,
2 | v3 + generics and left out unused ListNode type *)
3 |
4 | module Lists(T)
5 |
6 | // declare global constants, types and variables:
7 |
8 | type
9 | List* = ^record
10 | value : T
11 | next : List
12 | end
13 |
14 | // declare procedures:
15 |
16 | proc (l : List) Add* (v : T)
17 | begin
18 | if l = nil then
19 | new(l) // create record instance
20 | l.value := v
21 | else
22 | l.next.Add(v) // recursive call to .add(n)
23 | end
24 | end Add
25 |
26 | proc (l : List) Get* () : T
27 | var
28 | v : T
29 | begin
30 | if l # nil then
31 | v := l.value // this line will crash if l is nil
32 | l := l.next
33 | end
34 | return v
35 | end Get
36 |
37 | end Lists
38 |
--------------------------------------------------------------------------------
/examples/wikipedia_example_in_Oberon+/Rectangles.mod:
--------------------------------------------------------------------------------
1 | module Rectangles;
2 |
3 | import Figures;
4 |
5 | type
6 | Rectangle* = pointer to RectangleDesc;
7 |
8 | RectangleDesc* = record
9 | (Figures.FigureDesc)
10 | x, y, w, h : integer;
11 | end;
12 |
13 | var
14 | if_ : Figures.Interface;
15 |
16 | procedure New* (var r : Rectangle);
17 | begin
18 | new(r);
19 | Figures.Init(r, if_);
20 | end New;
21 |
22 | procedure Draw* (f : Figures.Figure);
23 | var
24 | r : Rectangle;
25 | begin
26 | r := f(Rectangle); (* f AS Rectangle *)
27 | (* ... *)
28 | end Draw;
29 |
30 | (* Other procedures here *)
31 |
32 | begin (* Module initialisation *)
33 | New(if_);
34 | if_.draw := Draw;
35 | (*if_.clear := Clear;
36 | if_.mark := Mark;
37 | if_.move := Move;*)
38 | end Rectangles.
39 |
--------------------------------------------------------------------------------
/font/DejaVuSansMono.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rochus-keller/Oberon/e59a729bd13513f2d454fd2ce364ab01ecefeb70/font/DejaVuSansMono.ttf
--------------------------------------------------------------------------------
/font/NotoSans.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rochus-keller/Oberon/e59a729bd13513f2d454fd2ce364ab01ecefeb70/font/NotoSans.ttf
--------------------------------------------------------------------------------
/images/alias.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rochus-keller/Oberon/e59a729bd13513f2d454fd2ce364ab01ecefeb70/images/alias.png
--------------------------------------------------------------------------------
/images/alias_priv.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rochus-keller/Oberon/e59a729bd13513f2d454fd2ce364ab01ecefeb70/images/alias_priv.png
--------------------------------------------------------------------------------
/images/break-marker.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rochus-keller/Oberon/e59a729bd13513f2d454fd2ce364ab01ecefeb70/images/break-marker.png
--------------------------------------------------------------------------------
/images/breakpoint.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rochus-keller/Oberon/e59a729bd13513f2d454fd2ce364ab01ecefeb70/images/breakpoint.png
--------------------------------------------------------------------------------
/images/class.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rochus-keller/Oberon/e59a729bd13513f2d454fd2ce364ab01ecefeb70/images/class.png
--------------------------------------------------------------------------------
/images/class_priv.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rochus-keller/Oberon/e59a729bd13513f2d454fd2ce364ab01ecefeb70/images/class_priv.png
--------------------------------------------------------------------------------
/images/close.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rochus-keller/Oberon/e59a729bd13513f2d454fd2ce364ab01ecefeb70/images/close.png
--------------------------------------------------------------------------------
/images/definition.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rochus-keller/Oberon/e59a729bd13513f2d454fd2ce364ab01ecefeb70/images/definition.png
--------------------------------------------------------------------------------
/images/exclamation-circle.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rochus-keller/Oberon/e59a729bd13513f2d454fd2ce364ab01ecefeb70/images/exclamation-circle.png
--------------------------------------------------------------------------------
/images/exclamation-red.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rochus-keller/Oberon/e59a729bd13513f2d454fd2ce364ab01ecefeb70/images/exclamation-red.png
--------------------------------------------------------------------------------
/images/folder.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rochus-keller/Oberon/e59a729bd13513f2d454fd2ce364ab01ecefeb70/images/folder.png
--------------------------------------------------------------------------------
/images/func.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rochus-keller/Oberon/e59a729bd13513f2d454fd2ce364ab01ecefeb70/images/func.png
--------------------------------------------------------------------------------
/images/func_priv.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rochus-keller/Oberon/e59a729bd13513f2d454fd2ce364ab01ecefeb70/images/func_priv.png
--------------------------------------------------------------------------------
/images/marker.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rochus-keller/Oberon/e59a729bd13513f2d454fd2ce364ab01ecefeb70/images/marker.png
--------------------------------------------------------------------------------
/images/module.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rochus-keller/Oberon/e59a729bd13513f2d454fd2ce364ab01ecefeb70/images/module.png
--------------------------------------------------------------------------------
/images/struct.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rochus-keller/Oberon/e59a729bd13513f2d454fd2ce364ab01ecefeb70/images/struct.png
--------------------------------------------------------------------------------
/images/struct_priv.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rochus-keller/Oberon/e59a729bd13513f2d454fd2ce364ab01ecefeb70/images/struct_priv.png
--------------------------------------------------------------------------------
/images/var.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rochus-keller/Oberon/e59a729bd13513f2d454fd2ce364ab01ecefeb70/images/var.png
--------------------------------------------------------------------------------
/images/var_priv.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rochus-keller/Oberon/e59a729bd13513f2d454fd2ce364ab01ecefeb70/images/var_priv.png
--------------------------------------------------------------------------------
/images/var_prot.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rochus-keller/Oberon/e59a729bd13513f2d454fd2ce364ab01ecefeb70/images/var_prot.png
--------------------------------------------------------------------------------
/oakwood/Coroutines.Def:
--------------------------------------------------------------------------------
1 | (* Source: The Oakwood Guidelines for Oberon-2 Compiler Developers, Revision: 1A First Issue, Oct. 1995 *)
2 | (* replaced LONGINT by INT32 *)
3 | DEFINITION Coroutines;
4 | TYPE
5 | Coroutine = RECORD END;
6 | Body = PROCEDURE;
7 | PROCEDURE Init (body: Body; stackSize: INT32; VAR cor: Coroutine);
8 | PROCEDURE Transfer (VAR from, to: Coroutine);
9 | END Coroutines.
10 |
--------------------------------------------------------------------------------
/oakwood/In.Def:
--------------------------------------------------------------------------------
1 | (* Source: The Oakwood Guidelines for Oberon-2 Compiler Developers, Revision: 1A First Issue, Oct. 1995 *)
2 | DEFINITION In;
3 | VAR Done: BOOLEAN;
4 | PROCEDURE Open;
5 | PROCEDURE Char (VAR ch: CHAR);
6 | PROCEDURE Int (VAR i: INT32);
7 | PROCEDURE LongInt (VAR i: INT64);
8 | PROCEDURE Real (VAR x: REAL);
9 | PROCEDURE LongReal (VAR y: LONGREAL);
10 | PROCEDURE String (VAR str: ARRAY OF CHAR);
11 | PROCEDURE Name (VAR name: ARRAY OF CHAR);
12 | END In.
13 |
--------------------------------------------------------------------------------
/oakwood/Input.Def:
--------------------------------------------------------------------------------
1 | (* Source: The Oakwood Guidelines for Oberon-2 Compiler Developers, Revision: 1A First Issue, Oct. 1995 *)
2 | (* replaced all LONGINT by INT32, TimeUnit is CONST *)
3 | DEFINITION Input;
4 | CONST TimeUnit = 1000000;
5 | PROCEDURE Available (): INT32;
6 | PROCEDURE Read (VAR ch: CHAR);
7 | PROCEDURE Mouse (VAR keys: SET; VAR x, y: INT32);
8 | PROCEDURE SetMouseLimits (w, h: INT32);
9 | PROCEDURE Time (): INT32;
10 | END Input.
11 |
--------------------------------------------------------------------------------
/oakwood/Math.Def:
--------------------------------------------------------------------------------
1 | (* Source: The Oakwood Guidelines for Oberon-2 Compiler Developers, Revision: 1A First Issue, Oct. 1995 *)
2 | DEFINITION Math;
3 | CONST
4 | pi = 3.14159265358979323846;
5 | e = 2.71828182845904523536;
6 | PROCEDURE sqrt (x : REAL) : REAL;
7 | PROCEDURE power (x,base : REAL) : REAL;
8 | PROCEDURE exp (x : REAL): REAL;
9 | PROCEDURE ln (x : REAL) : REAL;
10 | PROCEDURE log (x,base : REAL) : REAL;
11 | PROCEDURE round (x : REAL) : REAL;
12 | PROCEDURE sin (x : REAL) : REAL;
13 | PROCEDURE cos (x : REAL) : REAL;
14 | PROCEDURE tan (x : REAL) : REAL;
15 | PROCEDURE arcsin (x : REAL) : REAL;
16 | PROCEDURE arccos (x : REAL) : REAL;
17 | PROCEDURE arctan (x : REAL) : REAL;
18 | PROCEDURE arctan2(x,y : REAL): REAL;
19 | PROCEDURE sinh (x:REAL):REAL;
20 | PROCEDURE cosh (x:REAL):REAL;
21 | PROCEDURE tanh (x:REAL):REAL;
22 | PROCEDURE arcsinh(x:REAL):REAL;
23 | PROCEDURE arccosh(x:REAL):REAL;
24 | PROCEDURE arctanh(x:REAL):REAL;
25 | END Math.
26 |
--------------------------------------------------------------------------------
/oakwood/MathL.Def:
--------------------------------------------------------------------------------
1 | (* Source: The Oakwood Guidelines for Oberon-2 Compiler Developers, Revision: 1A First Issue, Oct. 1995 *)
2 | DEFINITION MathL;
3 | CONST
4 | pi = 3.14159265358979323846;
5 | e = 2.71828182845904523536;
6 | PROCEDURE sqrt (x : LONGREAL) : LONGREAL;
7 | PROCEDURE power (x,base : LONGREAL) : LONGREAL;
8 | PROCEDURE exp (x : LONGREAL): LONGREAL;
9 | PROCEDURE ln (x : LONGREAL) : LONGREAL;
10 | PROCEDURE log (x,base : LONGREAL) : LONGREAL;
11 | PROCEDURE round (x : LONGREAL) : LONGREAL;
12 | PROCEDURE sin (x : LONGREAL) : LONGREAL;
13 | PROCEDURE cos (x : LONGREAL) : LONGREAL;
14 | PROCEDURE tan (x : LONGREAL) : LONGREAL;
15 | PROCEDURE arcsin (x : LONGREAL) : LONGREAL;
16 | PROCEDURE arccos (x : LONGREAL) : LONGREAL;
17 | PROCEDURE arctan (x : LONGREAL) : LONGREAL;
18 | PROCEDURE arctan2(x,y : LONGREAL): LONGREAL;
19 | PROCEDURE sinh (x:LONGREAL):LONGREAL;
20 | PROCEDURE cosh (x:LONGREAL):LONGREAL;
21 | PROCEDURE tanh (x:LONGREAL):LONGREAL;
22 | PROCEDURE arcsinh(x:LONGREAL):LONGREAL;
23 | PROCEDURE arccosh(x:LONGREAL):LONGREAL;
24 | PROCEDURE arctanh(x:LONGREAL):LONGREAL;
25 | END MathL.
26 |
--------------------------------------------------------------------------------
/oakwood/Out.Def:
--------------------------------------------------------------------------------
1 | (* Source: The Oakwood Guidelines for Oberon-2 Compiler Developers, Revision: 1A First Issue, Oct. 1995 *)
2 | DEFINITION Out;
3 | PROCEDURE Open;
4 | PROCEDURE Char (ch: CHAR);
5 | PROCEDURE String (IN str: ARRAY OF CHAR);
6 | PROCEDURE Int (i: INT64;n: INT32);
7 | PROCEDURE Real (x: REAL; n: INT32);
8 | PROCEDURE LongReal (x: LONGREAL; n: INT32);
9 | PROCEDURE Ln;
10 | END Out.
11 |
12 |
--------------------------------------------------------------------------------
/oakwood/Strings.Def:
--------------------------------------------------------------------------------
1 | (* Source: The Oakwood Guidelines for Oberon-2 Compiler Developers, Revision: 1A First Issue, Oct. 1995 *)
2 | DEFINITION Strings;
3 | PROCEDURE Length (IN s: ARRAY OF CHAR): INT32;
4 | PROCEDURE Insert (IN source: ARRAY OF CHAR; pos: INT32; VAR dest: ARRAY OF CHAR);
5 | PROCEDURE Append (IN extra: ARRAY OF CHAR; VAR dest: ARRAY OF CHAR);
6 | PROCEDURE Delete (VAR s: ARRAY OF CHAR; pos, n: INT32);
7 | PROCEDURE Replace (IN source: ARRAY OF CHAR; pos: INT32; VAR dest: ARRAY OF CHAR);
8 | PROCEDURE Extract (IN source: ARRAY OF CHAR; pos, n: INT32; VAR dest: ARRAY OF CHAR);
9 | PROCEDURE Pos (IN pattern, s: ARRAY OF CHAR; pos: INT32): INT32;
10 | PROCEDURE Cap (VAR s: ARRAY OF CHAR);
11 | END Strings.
12 |
--------------------------------------------------------------------------------
/oakwood/XYplane.Def:
--------------------------------------------------------------------------------
1 | (* Source: The Oakwood Guidelines for Oberon-2 Compiler Developers, Revision: 1A First Issue, Oct. 1995 *)
2 | DEFINITION XYplane;
3 | CONST draw = 1; erase = 0;
4 | VAR X-, Y-, W-, H-: INT32;
5 | PROCEDURE Open;
6 | PROCEDURE Clear;
7 | PROCEDURE Dot (x, y, mode: INT32);
8 | PROCEDURE IsDot (x, y: INT32): BOOLEAN;
9 | PROCEDURE Key (): CHAR;
10 | END XYplane.
11 |
--------------------------------------------------------------------------------
/runtime/Coroutines.cs:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2021 Rochus Keller
3 | *
4 | * This file is part of the Oberon+ parser/compiler library.
5 | *
6 | * The following is the license that applies to this copy of the
7 | * file. For a license to use the file under conditions
8 | * other than those described here, please email to me@rochus-keller.ch.
9 | *
10 | * This file may be used under the terms of the GNU Lesser
11 | * General Public License version 2.1 or version 3 as published by the Free
12 | * Software Foundation and appearing in the file LICENSE.LGPLv21 and
13 | * LICENSE.LGPLv3 included in the packaging of this file. Please review the
14 | * following information to ensure the GNU Lesser General Public License
15 | * requirements will be met: https://www.gnu.org/licenses/lgpl.html and
16 | * http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.*/
17 |
18 | public class Coroutines
19 | {
20 | public class Coroutine
21 | {
22 | // TODO
23 | }
24 |
25 | //Body = PROCEDURE;
26 |
27 | //PROCEDURE Init (body: Body; stackSize: INTEGER; VAR cor: Coroutine);
28 | //PROCEDURE Transfer (VAR from, to: Coroutine);
29 | }
30 |
--------------------------------------------------------------------------------
/runtime/Coroutines.lua:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rochus-keller/Oberon/e59a729bd13513f2d454fd2ce364ab01ecefeb70/runtime/Coroutines.lua
--------------------------------------------------------------------------------
/runtime/Dll/Coroutines.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rochus-keller/Oberon/e59a729bd13513f2d454fd2ce364ab01ecefeb70/runtime/Dll/Coroutines.dll
--------------------------------------------------------------------------------
/runtime/Dll/Files.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rochus-keller/Oberon/e59a729bd13513f2d454fd2ce364ab01ecefeb70/runtime/Dll/Files.dll
--------------------------------------------------------------------------------
/runtime/Dll/In.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rochus-keller/Oberon/e59a729bd13513f2d454fd2ce364ab01ecefeb70/runtime/Dll/In.dll
--------------------------------------------------------------------------------
/runtime/Dll/Input.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rochus-keller/Oberon/e59a729bd13513f2d454fd2ce364ab01ecefeb70/runtime/Dll/Input.dll
--------------------------------------------------------------------------------
/runtime/Dll/Math.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rochus-keller/Oberon/e59a729bd13513f2d454fd2ce364ab01ecefeb70/runtime/Dll/Math.dll
--------------------------------------------------------------------------------
/runtime/Dll/MathL.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rochus-keller/Oberon/e59a729bd13513f2d454fd2ce364ab01ecefeb70/runtime/Dll/MathL.dll
--------------------------------------------------------------------------------
/runtime/Dll/OBX.Runtime.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rochus-keller/Oberon/e59a729bd13513f2d454fd2ce364ab01ecefeb70/runtime/Dll/OBX.Runtime.dll
--------------------------------------------------------------------------------
/runtime/Dll/ObFiles.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rochus-keller/Oberon/e59a729bd13513f2d454fd2ce364ab01ecefeb70/runtime/Dll/ObFiles.dll
--------------------------------------------------------------------------------
/runtime/Dll/Out.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rochus-keller/Oberon/e59a729bd13513f2d454fd2ce364ab01ecefeb70/runtime/Dll/Out.dll
--------------------------------------------------------------------------------
/runtime/Dll/Readme.md:
--------------------------------------------------------------------------------
1 | These files are generated by mcs from the corresponding cs files in the
2 | runtime directory and redundantly kept here for convenience.
3 |
--------------------------------------------------------------------------------
/runtime/Dll/Strings.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rochus-keller/Oberon/e59a729bd13513f2d454fd2ce364ab01ecefeb70/runtime/Dll/Strings.dll
--------------------------------------------------------------------------------
/runtime/Dll/XYplane.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rochus-keller/Oberon/e59a729bd13513f2d454fd2ce364ab01ecefeb70/runtime/Dll/XYplane.dll
--------------------------------------------------------------------------------
/runtime/Files.lua:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rochus-keller/Oberon/e59a729bd13513f2d454fd2ce364ab01ecefeb70/runtime/Files.lua
--------------------------------------------------------------------------------
/runtime/GPL 2 and 3 Runtime Library Exception:
--------------------------------------------------------------------------------
1 | This version was derived from https://www.gnu.org/licenses/gcc-exception-3.1.en.html
2 | Same idea, just applied to the Oberon runtime library
3 |
4 | Grant of Additional Permission.
5 |
6 | You have permission to propagate a work of Target Code formed by combining the Runtime Library with Independent Modules, even if such propagation would otherwise violate the terms of GPL 2 or 3, provided that all Target Code was generated by Eligible Compilation Processes. You may then convey such a combination under terms of your choice, consistent with the licensing of the Independent Modules.
7 |
8 | No Weakening of GCC Copyleft.
9 |
10 | The availability of this Exception does not imply any general presumption that third-party software is unaffected by the copyleft requirements of the license.
11 |
--------------------------------------------------------------------------------
/runtime/In.h:
--------------------------------------------------------------------------------
1 | #ifndef _OBX_IN_
2 | #define _OBX_IN_
3 |
4 | /*
5 | * Copyright 2021 Rochus Keller
6 | *
7 | * This file is part of the Oberon+ parser/compiler library.
8 | *
9 | * The following is the license that applies to this copy of the
10 | * file. For a license to use the file under conditions
11 | * other than those described here, please email to me@rochus-keller.ch.
12 | *
13 | * This file may be used under the terms of the GNU Lesser
14 | * General Public License version 2.1 or version 3 as published by the Free
15 | * Software Foundation and appearing in the file LICENSE.LGPLv21 and
16 | * LICENSE.LGPLv3 included in the packaging of this file. Please review the
17 | * following information to ensure the GNU Lesser General Public License
18 | * requirements will be met: https://www.gnu.org/licenses/lgpl.html and
19 | * http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
20 | *
21 | * Alternatively this file may be used under the terms of the Mozilla
22 | * Public License. If a copy of the MPL was not distributed with this
23 | * file, You can obtain one at https://mozilla.org/MPL/2.0/.
24 | */
25 |
26 | #include "OBX.Runtime.h"
27 |
28 | extern int In$Done;
29 |
30 | //PROCEDURE Open;
31 | extern void In$Open();
32 |
33 | //PROCEDURE Char (VAR ch: CHAR);
34 | extern void In$Char(char* ch);
35 | //PROCEDURE Int (VAR i: INTEGER);
36 | extern void In$Int(int32_t* i);
37 | extern void In$LongInt(int64_t* i);
38 | //PROCEDURE Real (VAR x: REAL);
39 | extern void In$Real(float* x);
40 | extern void In$LongReal(double* x);
41 | //PROCEDURE String (VAR str: ARRAY OF CHAR);
42 | extern void In$String(struct OBX$Array$1 str);
43 | //PROCEDURE Name (VAR name: ARRAY OF CHAR);
44 | extern void In$Name(struct OBX$Array$1 name);
45 |
46 | extern void In$init$();
47 | extern OBX$Cmd In$cmd$(const char*);
48 |
49 | #endif
50 |
--------------------------------------------------------------------------------
/runtime/In.lua:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rochus-keller/Oberon/e59a729bd13513f2d454fd2ce364ab01ecefeb70/runtime/In.lua
--------------------------------------------------------------------------------
/runtime/Input.h:
--------------------------------------------------------------------------------
1 | #ifndef _OBX_INPUT_
2 | #define _OBX_INPUT_
3 |
4 | /*
5 | * Copyright 2021 Rochus Keller
6 | *
7 | * This file is part of the Oberon+ parser/compiler library.
8 | *
9 | * The following is the license that applies to this copy of the
10 | * file. For a license to use the file under conditions
11 | * other than those described here, please email to me@rochus-keller.ch.
12 | *
13 | * This file may be used under the terms of the GNU Lesser
14 | * General Public License version 2.1 or version 3 as published by the Free
15 | * Software Foundation and appearing in the file LICENSE.LGPLv21 and
16 | * LICENSE.LGPLv3 included in the packaging of this file. Please review the
17 | * following information to ensure the GNU Lesser General Public License
18 | * requirements will be met: https://www.gnu.org/licenses/lgpl.html and
19 | * http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
20 | *
21 | * Alternatively this file may be used under the terms of the Mozilla
22 | * Public License. If a copy of the MPL was not distributed with this
23 | * file, You can obtain one at https://mozilla.org/MPL/2.0/.
24 | */
25 |
26 | #include "OBX.Runtime.h"
27 |
28 | // TODO complete
29 |
30 | //PROCEDURE Available (): INTEGER;
31 | extern int Input$Available();
32 |
33 | //PROCEDURE Read (VAR ch: CHAR);
34 | extern void Input$Read(char* ch);
35 |
36 | //PROCEDURE Mouse (VAR keys: SET; VAR x, y: INTEGER);
37 | extern void Input$Mouse( int32_t* keys, int32_t* x, int32_t* y);
38 |
39 | //PROCEDURE SetMouseLimits (w, h: INTEGER);
40 | extern void Input$SetMouseLimits(int32_t w, int32_t h);
41 |
42 | extern int32_t Input$Time();
43 |
44 | extern void Input$init$();
45 | extern OBX$Cmd Input$cmd$(const char*);
46 |
47 | #endif
48 |
--------------------------------------------------------------------------------
/runtime/Input.lua:
--------------------------------------------------------------------------------
1 | local module = {}
2 | local clock = os.clock
3 |
4 | function module.Time()
5 | return clock() * 1000.0 * 1000.0
6 | end
7 |
8 | -- NOTE: these numbers are allocated by ObxLjbcGen and need to be updated if Input.Def changes!
9 | --module[0] = module.Available
10 | --module[1] = module.Read
11 | --module[2] = module.Mouse
12 | --module[3] = module.SetMouseLimits
13 | module[4] = module.Time
14 |
15 | return module
16 |
--------------------------------------------------------------------------------
/runtime/Math.lua:
--------------------------------------------------------------------------------
1 | local module = {}
2 | local math = require("math")
3 |
4 | -- TODO
5 |
6 | function module.round(x)
7 | return math.floor(x+0.5)
8 | end
9 |
10 | -- NOTE: these numbers are allocated by ObxLjbcGen and need to be updated if Math.Def changes!
11 | module[0] = math.sqrt
12 | module[1] = math.pow
13 | module[2] = math.exp
14 | module[3] = math.log
15 | module[4] = module.log -- TODO
16 | module[5] = module.round
17 | module[6] = math.sin
18 | module[7] = math.cos
19 | module[8] = math.tan
20 | module[9] = math.asin
21 | module[10] = math.acos
22 | module[11] = math.atan
23 | module[12] = math.atan2
24 | module[13] = math.sinh
25 | module[14] = math.cosh
26 | module[15] = math.tanh
27 | module[16] = module.arcsinh -- TODO
28 | module[17] = module.arccosh -- TODO
29 | module[18] = module.arctanh -- TODO
30 |
31 | return module
32 |
--------------------------------------------------------------------------------
/runtime/MathL.lua:
--------------------------------------------------------------------------------
1 | local module = {}
2 | local math = require("math")
3 |
4 | -- TODO
5 |
6 | function module.round(x)
7 | return math.floor(x+0.5)
8 | end
9 |
10 | -- NOTE: these numbers are allocated by ObxLjbcGen and need to be updated if Math.Def changes!
11 | module[0] = math.sqrt
12 | module[1] = math.pow
13 | module[2] = math.exp
14 | module[3] = math.log
15 | module[4] = module.log -- TODO
16 | module[5] = module.round
17 | module[6] = math.sin
18 | module[7] = math.cos
19 | module[8] = math.tan
20 | module[9] = math.asin
21 | module[10] = math.acos
22 | module[11] = math.atan
23 | module[12] = math.atan2
24 | module[13] = math.sinh
25 | module[14] = math.cosh
26 | module[15] = math.tanh
27 | module[16] = module.arcsinh -- TODO
28 | module[17] = module.arccosh -- TODO
29 | module[18] = module.arctanh -- TODO
30 |
31 | return module
32 |
--------------------------------------------------------------------------------
/runtime/Obs/Kernel.lua:
--------------------------------------------------------------------------------
1 | --[[
2 | * Copyright 2021 Rochus Keller
3 | *
4 | * This file is part of the Oberon+ parser/compiler library.
5 | *
6 | * The following is the license that applies to this copy of the
7 | * file. For a license to use the file under conditions
8 | * other than those described here, please email to me@rochus-keller.ch.
9 | *
10 | * This file may be used under the terms of the GNU Lesser
11 | * General Public License version 2.1 or version 3 as published by the Free
12 | * Software Foundation and appearing in the file LICENSE.LGPLv21 and
13 | * LICENSE.LGPLv3 included in the packaging of this file. Please review the
14 | * following information to ensure the GNU Lesser General Public License
15 | * requirements will be met: https://www.gnu.org/licenses/lgpl.html and
16 | * http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
17 | ]]--
18 |
19 | local module = {}
20 |
21 | local ffi = require 'ffi'
22 | local C = ffi.C
23 |
24 | ffi.cdef[[
25 | uint32_t ObsDisplay_getTime();
26 | int ObsDisplay_getClock();
27 | void ObsDisplay_setClock(int dt);
28 | ]]
29 |
30 | function module.Time()
31 | return C.ObsDisplay_getTime()
32 | end
33 |
34 | function module.Clock()
35 | return C.ObsDisplay_getClock()
36 | end
37 |
38 | function module.SetClock(dt)
39 | C.ObsDisplay_setClock(dt)
40 | end
41 |
42 | -- NOTE: these numbers are allocated by ObxLjbcGen and need to be updated if Kernel.Def changes!
43 | module[0] = module.Time -- procedure
44 | module[1] = module.Clock -- procedure
45 | module[2] = module.SetClock -- procedure
46 | module[3] = 0 -- allocated -- variable
47 | module[4] = 0 -- NofSectors -- variable
48 | module[5] = 0 -- heapOrg -- variable
49 | module[6] = 0 -- heapLim -- variable
50 | module[7] = 0 -- stackOrg -- variable
51 |
52 |
53 | Kernel = module -- make it globally visible
54 |
55 | return module
56 |
--------------------------------------------------------------------------------
/runtime/Out.c:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2021 Rochus Keller
3 | *
4 | * This file is part of the Oberon+ parser/compiler library.
5 | *
6 | * The following is the license that applies to this copy of the
7 | * file. For a license to use the file under conditions
8 | * other than those described here, please email to me@rochus-keller.ch.
9 | *
10 | * This file may be used under the terms of the GNU Lesser
11 | * General Public License version 2.1 or version 3 as published by the Free
12 | * Software Foundation and appearing in the file LICENSE.LGPLv21 and
13 | * LICENSE.LGPLv3 included in the packaging of this file. Please review the
14 | * following information to ensure the GNU Lesser General Public License
15 | * requirements will be met: https://www.gnu.org/licenses/lgpl.html and
16 | * http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
17 | *
18 | * Alternatively this file may be used under the terms of the Mozilla
19 | * Public License. If a copy of the MPL was not distributed with this
20 | * file, You can obtain one at https://mozilla.org/MPL/2.0/.
21 | */
22 |
23 | #include "Out.h"
24 |
25 | void Out$Int(int64_t i, int32_t n)
26 | {
27 | printf("%*lld", n, i);
28 | }
29 |
30 | void Out$Real(float x, int32_t n)
31 | {
32 | printf("%*e", n, x);
33 | }
34 |
35 | void Out$LongReal(double x, int32_t n)
36 | {
37 | printf("%*e", n, x);
38 | }
39 |
40 | void Out$Ln()
41 | {
42 | printf("\n");
43 | }
44 |
45 | void Out$Char(char c)
46 | {
47 | printf("%c", c );
48 | }
49 |
50 | void Out$String(const struct OBX$Array$1 str)
51 | {
52 | OBX$PrintA(0,(const char*)str.$a);
53 | }
54 |
55 | void Out$init$()
56 | {
57 | }
58 |
59 | void Out$Open()
60 | {
61 | }
62 |
63 | OBX$Cmd Out$cmd$(const char* name)
64 | {
65 | if(name==0) return Out$init$;
66 | return 0;
67 | }
68 |
--------------------------------------------------------------------------------
/runtime/Out.h:
--------------------------------------------------------------------------------
1 | #ifndef _OBX_OUT_
2 | #define _OBX_OUT_
3 |
4 | /*
5 | * Copyright 2021 Rochus Keller
6 | *
7 | * This file is part of the Oberon+ parser/compiler library.
8 | *
9 | * The following is the license that applies to this copy of the
10 | * file. For a license to use the file under conditions
11 | * other than those described here, please email to me@rochus-keller.ch.
12 | *
13 | * This file may be used under the terms of the GNU Lesser
14 | * General Public License version 2.1 or version 3 as published by the Free
15 | * Software Foundation and appearing in the file LICENSE.LGPLv21 and
16 | * LICENSE.LGPLv3 included in the packaging of this file. Please review the
17 | * following information to ensure the GNU Lesser General Public License
18 | * requirements will be met: https://www.gnu.org/licenses/lgpl.html and
19 | * http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
20 | *
21 | * Alternatively this file may be used under the terms of the Mozilla
22 | * Public License. If a copy of the MPL was not distributed with this
23 | * file, You can obtain one at https://mozilla.org/MPL/2.0/.
24 | */
25 |
26 | #include "OBX.Runtime.h"
27 |
28 | extern void Out$Int(int64_t i, int32_t n);
29 | extern void Out$Ln();
30 | extern void Out$Char(char);
31 | extern void Out$Open();
32 | extern void Out$String(const struct OBX$Array$1 str);
33 | extern void Out$Real(float x, int32_t n);
34 | extern void Out$LongReal(double x, int32_t n);
35 |
36 | extern void Out$init$();
37 | extern OBX$Cmd Out$cmd$(const char*);
38 |
39 | #endif
40 |
--------------------------------------------------------------------------------
/runtime/Out.lua:
--------------------------------------------------------------------------------
1 | local tochar = require("string").char
2 | local ffi = require("ffi")
3 | local module = {}
4 |
5 | -- just a quick first implementation
6 |
7 | function module.Open()
8 | end
9 |
10 | function module.Char(ch)
11 | if type(ch) == "number" then
12 | io.stdout:write(tochar(ch))
13 | else
14 | io.stdout:write(tostring(ch))
15 | end
16 | end
17 |
18 | function module.String(s)
19 | if type(s) == "cdata" then
20 | io.stdout:write(ffi.string(s))
21 | else
22 | io.stdout:write(tostring(s))
23 | end
24 | end
25 |
26 | function module.Int(i,n)
27 | io.stdout:write(string.format("%"..tostring(n).."d",i))
28 | -- io.stdout:write(string.format("%d",i) )
29 | end
30 |
31 | function module.Real(x,n)
32 | -- io.stdout:write(x) -- effect of n not properly specified
33 | io.stdout:write(string.format("%"..tostring(n).."e",x))
34 | end
35 |
36 | function module.Ln()
37 | io.stdout:write("\n")
38 | end
39 |
40 | -- NOTE: these numbers are allocated by ObxLjbcGen and need to be updated if Out.Def changes!
41 | module[0] = module.Open
42 | module[1] = module.Char
43 | module[2] = module.String
44 | module[3] = module.Int
45 | module[4] = module.Real
46 | module[5] = module.Ln
47 |
48 | return module
49 |
--------------------------------------------------------------------------------
/runtime/Pal/BUSY:
--------------------------------------------------------------------------------
1 |
2 |
3 | submod qt = ../../../LeanQt (HAVE_GUI)
4 |
5 | let so64_conf : Config {
6 | .cflags += [ "-O2" "-fPIC" ]
7 | }
8 |
9 | if (build_mode == `optimized) && (target_os == `linux) && (target_wordsize == `64) {
10 | set_defaults(target_toolchain,so64_conf)
11 | }
12 |
13 | let Pal ! : Library {
14 | .lib_type = `shared
15 | .configs += [ qt.qt_client_config ]
16 | .deps += [ qt.libqt ]
17 | .sources = [
18 | ./File.cpp
19 | ./Display.cpp
20 | ./Math.cpp
21 | ]
22 | }
23 |
--------------------------------------------------------------------------------
/runtime/Pal/Math.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2023 Rochus Keller
3 | *
4 | * This file is part of the Oberon+ parser/compiler library.
5 | *
6 | * The following is the license that applies to this copy of the
7 | * file. For a license to use the file under conditions
8 | * other than those described here, please email to me@rochus-keller.ch.
9 | *
10 | * This file may be used under the terms of the GNU Lesser
11 | * General Public License version 2.1 or version 3 as published by the Free
12 | * Software Foundation and appearing in the file LICENSE.LGPLv21 and
13 | * LICENSE.LGPLv3 included in the packaging of this file. Please review the
14 | * following information to ensure the GNU Lesser General Public License
15 | * requirements will be met: https://www.gnu.org/licenses/lgpl.html and
16 | * http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
17 | */
18 |
19 | extern "C" {
20 | #include "ObxPalApi.h"
21 | #include
22 |
23 | double PAL_sin(double x)
24 | {
25 | return sin(x);
26 | }
27 |
28 | double PAL_cos(double x)
29 | {
30 | return cos(x);
31 | }
32 |
33 | double PAL_arctan(double x)
34 | {
35 | return atan(x);
36 | }
37 |
38 | double PAL_sqrt(double x)
39 | {
40 | return sqrt(x);
41 | }
42 |
43 | double PAL_ln(double x)
44 | {
45 | return log(x);
46 | }
47 |
48 | double PAL_exp(double x)
49 | {
50 | return exp(x);
51 | }
52 |
53 | double PAL_pow(double x, double e)
54 | {
55 | return pow(x,e);
56 | }
57 |
58 | }
59 |
--------------------------------------------------------------------------------
/runtime/Pal/Readme.md:
--------------------------------------------------------------------------------
1 | This is a Platform Abstraction Layer (PAL) with a C API which can be used instead of SDL2 to implement cross-platform Oberon applications.
2 |
3 | The Oberon+ compiler and IDE depend on LeanQt anyway, so it seems natural to also use LeanQt to implement this PAL. Integrating the PAL with the Oberon BUSY build is easy and the C API is compatible with the Oberon+ FFI.
4 |
--------------------------------------------------------------------------------
/runtime/Strings.lua:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rochus-keller/Oberon/e59a729bd13513f2d454fd2ce364ab01ecefeb70/runtime/Strings.lua
--------------------------------------------------------------------------------
/runtime/XYPlane.lua:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rochus-keller/Oberon/e59a729bd13513f2d454fd2ce364ab01ecefeb70/runtime/XYPlane.lua
--------------------------------------------------------------------------------
/runtime/XYplane.h:
--------------------------------------------------------------------------------
1 | #ifndef _OBX_XYPLANE_
2 | #define _OBX_XYPLANE_
3 |
4 | /*
5 | * Copyright 2021 Rochus Keller
6 | *
7 | * This file is part of the Oberon+ parser/compiler library.
8 | *
9 | * The following is the license that applies to this copy of the
10 | * file. For a license to use the file under conditions
11 | * other than those described here, please email to me@rochus-keller.ch.
12 | *
13 | * This file may be used under the terms of the GNU Lesser
14 | * General Public License version 2.1 or version 3 as published by the Free
15 | * Software Foundation and appearing in the file LICENSE.LGPLv21 and
16 | * LICENSE.LGPLv3 included in the packaging of this file. Please review the
17 | * following information to ensure the GNU Lesser General Public License
18 | * requirements will be met: https://www.gnu.org/licenses/lgpl.html and
19 | * http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
20 | *
21 | * Alternatively this file may be used under the terms of the Mozilla
22 | * Public License. If a copy of the MPL was not distributed with this
23 | * file, You can obtain one at https://mozilla.org/MPL/2.0/.
24 | */
25 |
26 | #include "OBX.Runtime.h"
27 |
28 | extern int32_t XYplane$X, XYplane$Y, XYplane$W, XYplane$H;
29 |
30 | //PROCEDURE Open;
31 | extern void XYplane$Open();
32 | //PROCEDURE Clear;
33 | extern void XYplane$Clear();
34 | //PROCEDURE Dot (x, y, mode: INTEGER);
35 | extern void XYplane$Dot(int32_t x, int32_t y, int32_t mode);
36 | //PROCEDURE IsDot (x, y: INTEGER): BOOLEAN;
37 | extern uint8_t XYplane$IsDot(int32_t x, int32_t y);
38 | //PROCEDURE Key (): CHAR;
39 | extern char XYplane$Key();
40 |
41 | extern void XYplane$GetMouseState( int32_t* keys, int32_t* x, int32_t* y );
42 | extern int XYplane$Available();
43 | extern char XYplane$Dequeue();
44 |
45 | extern void XYplane$init$();
46 | extern OBX$Cmd XYplane$cmd$(const char*);
47 |
48 | #endif
49 |
--------------------------------------------------------------------------------
/runtime/obnljlib.lua:
--------------------------------------------------------------------------------
1 | --[[
2 | * Copyright 2019 Rochus Keller
3 | *
4 | * This file is part of the Oberon+ parser/compiler library.
5 | *
6 | * The following is the license that applies to this copy of the
7 | * file. For a license to use the file under conditions
8 | * other than those described here, please email to me@rochus-keller.ch.
9 | *
10 | * This file may be used under the terms of the GNU Lesser
11 | * General Public License version 2.1 or version 3 as published by the Free
12 | * Software Foundation and appearing in the file LICENSE.LGPLv21 and
13 | * LICENSE.LGPLv3 included in the packaging of this file. Please review the
14 | * following information to ensure the GNU Lesser General Public License
15 | * requirements will be met: https://www.gnu.org/licenses/lgpl.html and
16 | * http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.]]--
17 |
18 | local lib = {}
19 |
20 | return lib
21 |
--------------------------------------------------------------------------------
/syntax/Oberon.keywords:
--------------------------------------------------------------------------------
1 | ARRAY
2 | IMPORT
3 | THEN
4 | BEGIN
5 | IN
6 | TO
7 | BY
8 | IS
9 | TRUE
10 | CASE
11 | MOD
12 | TYPE
13 | CONST
14 | MODULE
15 | UNTIL
16 | DIV
17 | NIL
18 | VAR
19 | DO
20 | OF
21 | WHILE
22 | ELSE
23 | OR
24 | ELSIF
25 | POINTER
26 | END
27 | PROCEDURE
28 | FALSE
29 | RECORD
30 | FOR
31 | REPEAT
32 | IF
33 | RETURN
34 | DEFINITION
35 | PROC
36 | WITH
37 | LOOP
38 | EXIT
39 | OUT
40 | CLOSE
41 | UNSAFE
42 | CSTRUCT
43 | CUNION
44 | CARRAY
45 | CPOINTER
46 | WEAK
47 |
--------------------------------------------------------------------------------
/syntax/ObxVariation1.keywords:
--------------------------------------------------------------------------------
1 | ARRAY
2 | IMPORT
3 | THEN
4 | BEGIN
5 | IN
6 | TO
7 | BY
8 | IS
9 | TRUE
10 | CASE
11 | MOD
12 | TYPE
13 | CONST
14 | MODULE
15 | UNTIL
16 | DIV
17 | NIL
18 | VAR
19 | DO
20 | OF
21 | WHILE
22 | ELSE
23 | OR
24 | ELSIF
25 | POINTER
26 | END
27 | PROCEDURE
28 | FALSE
29 | RECORD
30 | FOR
31 | REPEAT
32 | IF
33 | RETURN
34 | DEFINITION
35 | PROC
36 | WITH
37 | LOOP
38 | EXIT
39 | OUT
40 | CLOSE
41 | UNSAFE
42 | CSTRUCT
43 | CUNION
44 | CARRAY
45 |
--------------------------------------------------------------------------------
/syntax/run_coco:
--------------------------------------------------------------------------------
1 | ../../Coco/Coco ./Oberon.atg -trace FP -o . -namespace Ob > ./coco_out.txt
2 |
3 | mv ./Parser.h ../ObParser.h
4 | mv ./Parser.cpp ../ObParser.cpp
5 |
6 | mv ./ObSynTree.h ..
7 | mv ./ObSynTree.cpp ..
8 |
9 | mv ./ObTokenType.h ..
10 | mv ./ObTokenType.cpp ..
11 |
--------------------------------------------------------------------------------
/testcases/Are-we-fast-yet/Are-we-fast-yet_results.ods:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rochus-keller/Oberon/e59a729bd13513f2d454fd2ce364ab01ecefeb70/testcases/Are-we-fast-yet/Are-we-fast-yet_results.ods
--------------------------------------------------------------------------------
/testcases/Are-we-fast-yet/Are-we-fast-yet_results_linux.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rochus-keller/Oberon/e59a729bd13513f2d454fd2ce364ab01ecefeb70/testcases/Are-we-fast-yet/Are-we-fast-yet_results_linux.pdf
--------------------------------------------------------------------------------
/testcases/Are-we-fast-yet/Are-we-fast-yet_results_windows.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rochus-keller/Oberon/e59a729bd13513f2d454fd2ce364ab01ecefeb70/testcases/Are-we-fast-yet/Are-we-fast-yet_results_windows.pdf
--------------------------------------------------------------------------------
/testcases/Are-we-fast-yet/Readme.md:
--------------------------------------------------------------------------------
1 | Note that the source code has been moved to https://github.com/rochus-keller/Are-we-fast-yet/tree/main/Oberon.
2 |
--------------------------------------------------------------------------------
/testcases/Gen2Tests/OBNC-Tests.obnpro:
--------------------------------------------------------------------------------
1 | [General]
2 | BuiltInOakwood=true
3 | MainModule=@ByteArray()
4 | MainProc=@ByteArray()
5 | Suffixes=.Mod, .obn
6 |
7 | [Modules]
8 | 1\AbsPath=/home/me/Entwicklung/Modules/Oberon/testcases/Gen2Tests/T6ProcedureDeclarations.obn
9 | 1\RelPath=T6ProcedureDeclarations.obn
10 | 2\AbsPath=/home/me/Entwicklung/Modules/Oberon/testcases/Gen2Tests/T3VariableDeclarations.obn
11 | 2\RelPath=T3VariableDeclarations.obn
12 | 3\AbsPath=/home/me/Entwicklung/Modules/Oberon/testcases/Gen2Tests/T5Statements.obn
13 | 3\RelPath=T5Statements.obn
14 | 4\AbsPath=/home/me/Entwicklung/Modules/Oberon/testcases/Gen2Tests/T4Expressions.obn
15 | 4\RelPath=T4Expressions.obn
16 | 5\AbsPath=/home/me/Entwicklung/Modules/Oberon/testcases/Gen2Tests/T1ConstantDeclarations.obn
17 | 5\RelPath=T1ConstantDeclarations.obn
18 | 6\AbsPath=/home/me/Entwicklung/Modules/Oberon/testcases/Gen2Tests/T2TypeDeclarations.obn
19 | 6\RelPath=T2TypeDeclarations.obn
20 | size=6
21 |
--------------------------------------------------------------------------------
/testcases/Gen2Tests/T1ConstantDeclarations.obn:
--------------------------------------------------------------------------------
1 | (*Copyright (C) 2017, 2018, 2019 Karl Landstrom
2 |
3 | This file is part of OBNC.
4 |
5 | OBNC is free software: you can redistribute it and/or modify
6 | it under the terms of the GNU General Public License as published by
7 | the Free Software Foundation, either version 3 of the License, or
8 | (at your option) any later version.
9 |
10 | OBNC is distributed in the hope that it will be useful,
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | GNU General Public License for more details.
14 |
15 | You should have received a copy of the GNU General Public License
16 | along with OBNC. If not, see .*)
17 |
18 | MODULE T1ConstantDeclarations;
19 |
20 | CONST
21 | (* null = NIL; rochus *)
22 | valid = FALSE;
23 | singleCharStr = "x";
24 | lineFeed = 0AX;
25 | quotes = 22X;
26 | backslash = "\";
27 | nonAscii = 80X;
28 | (* letterA = CHR(ORD("A")); rochus *)
29 | sevenDigits = "1234567";
30 | count = 37;
31 | pi = 3.14;
32 | (*inf = 1.0E+1000;*)
33 | (*nan = 0.0 / 0.0;*)
34 | lastDigits = {0, 2 .. 3, 5};
35 |
36 | VAR
37 | p: PROCEDURE;
38 | b: BOOLEAN;
39 | ch: CHAR;
40 | s: ARRAY 8 OF CHAR;
41 | i: INTEGER;
42 | x: REAL;
43 | j: BYTE;
44 | A: SET;
45 |
46 | BEGIN
47 | (* p := null; rochus *)
48 | b := valid;
49 | ch := singleCharStr;
50 | ch := lineFeed;
51 | ch := quotes;
52 | ch := backslash;
53 | ch := nonAscii;
54 | (* ch := letterA; rochus *)
55 | s := singleCharStr;
56 | s := lineFeed;
57 | s := quotes;
58 | s := backslash;
59 | s := sevenDigits;
60 | i := count;
61 | j := count;
62 | x := pi;
63 | (*x := inf;*)
64 | (*x := nan;*)
65 | A := lastDigits
66 | END T1ConstantDeclarations.
67 |
--------------------------------------------------------------------------------
/testcases/Gen2Tests/T3VariableDeclarations.obn:
--------------------------------------------------------------------------------
1 | (*Copyright (C) 2017, 2018, 2019 Karl Landstrom
2 |
3 | This file is part of OBNC.
4 |
5 | OBNC is free software: you can redistribute it and/or modify
6 | it under the terms of the GNU General Public License as published by
7 | the Free Software Foundation, either version 3 of the License, or
8 | (at your option) any later version.
9 |
10 | OBNC is distributed in the hope that it will be useful,
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | GNU General Public License for more details.
14 |
15 | You should have received a copy of the GNU General Public License
16 | along with OBNC. If not, see .*)
17 |
18 | MODULE T3VariableDeclarations;
19 |
20 | TYPE
21 | Vector = RECORD
22 | x, y: REAL
23 | END;
24 |
25 | ShapeDesc = RECORD
26 | pos: Vector
27 | END;
28 |
29 | Rectangle = POINTER TO RectangleDesc;
30 | RectangleDesc = RECORD (ShapeDesc)
31 | size: Vector
32 | END;
33 |
34 | PROCEDURE TestInitialization;
35 | VAR s: ShapeDesc;
36 | r: RectangleDesc;
37 | rs: ARRAY 10 OF RectangleDesc;
38 | rp: Rectangle;
39 |
40 | PROCEDURE AssertVector(VAR v: Vector);
41 | BEGIN
42 | ASSERT(v IS Vector)
43 | END AssertVector;
44 |
45 | BEGIN
46 | AssertVector(s.pos);
47 | AssertVector(r.pos);
48 | AssertVector(r.size);
49 | AssertVector(rs[0].pos);
50 | AssertVector(rs[0].size);
51 |
52 | NEW(rp);
53 | ASSERT(rp IS Rectangle);
54 | AssertVector(rp.pos);
55 | AssertVector(rp.size);
56 | END TestInitialization;
57 |
58 | BEGIN
59 | TestInitialization
60 | END T3VariableDeclarations.
61 |
--------------------------------------------------------------------------------
/testcases/Gen4Tests/Readme.md:
--------------------------------------------------------------------------------
1 | Downloaded from https://miasap.se/obnc/
2 | version 0.16, accessed Jan. 2020
3 | modified for OBX compatibility
4 |
--------------------------------------------------------------------------------
/testcases/Gen4Tests/T1-6.obxpro:
--------------------------------------------------------------------------------
1 | [General]
2 | BuildDir=/home/me/Entwicklung/Modules/build-ObxIde2-Qt_5_4_2-Debug/build
3 | BuiltInOakwood=true
4 | BuiltInObSysInner=false
5 | MainModule=@ByteArray()
6 | MainProc=@ByteArray()
7 | Suffixes=@Invalid()
8 | WorkingDir=
9 |
10 | [Modules]
11 | 1\AbsPath=/home/me/Entwicklung/Modules/Oberon/testcases/Gen4Tests/T6ProcedureDeclarations.obn
12 | 1\RelPath=T6ProcedureDeclarations.obn
13 | 2\AbsPath=/home/me/Entwicklung/Modules/Oberon/testcases/Gen4Tests/T3VariableDeclarations.obn
14 | 2\RelPath=T3VariableDeclarations.obn
15 | 3\AbsPath=/home/me/Entwicklung/Modules/Oberon/testcases/Gen4Tests/T2TypeDeclarations.obn
16 | 3\RelPath=T2TypeDeclarations.obn
17 | 4\AbsPath=/home/me/Entwicklung/Modules/Oberon/testcases/Gen4Tests/T1ConstantDeclarations.obn
18 | 4\RelPath=T1ConstantDeclarations.obn
19 | 5\AbsPath=/home/me/Entwicklung/Modules/Oberon/testcases/Gen4Tests/T5Statements.obn
20 | 5\RelPath=T5Statements.obn
21 | 6\AbsPath=/home/me/Entwicklung/Modules/Oberon/testcases/Gen4Tests/T4Expressions.obn
22 | 6\RelPath=T4Expressions.obn
23 | size=6
24 |
25 | [Packages]
26 | 1\Name=@ByteArray()
27 | size=1
28 |
--------------------------------------------------------------------------------
/testcases/Gen4Tests/T1ConstantDeclarations.obn:
--------------------------------------------------------------------------------
1 | (*Copyright (C) 2017, 2018, 2019 Karl Landstrom
2 |
3 | This file is part of OBNC.
4 |
5 | OBNC is free software: you can redistribute it and/or modify
6 | it under the terms of the GNU General Public License as published by
7 | the Free Software Foundation, either version 3 of the License, or
8 | (at your option) any later version.
9 |
10 | OBNC is distributed in the hope that it will be useful,
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | GNU General Public License for more details.
14 |
15 | You should have received a copy of the GNU General Public License
16 | along with OBNC. If not, see .*)
17 |
18 | MODULE T1ConstantDeclarations;
19 |
20 | CONST
21 | null = NIL;
22 | valid = FALSE;
23 | singleCharStr = "x";
24 | lineFeed = 0AX;
25 | quotes = 22X;
26 | backslash = "\";
27 | nonAscii = 80X;
28 | letterA = CHR(ORD("A"));
29 | sevenDigits = "1234567";
30 | count = 37;
31 | pi = 3.14;
32 | (*inf = 1.0E+1000;*)
33 | (*nan = 0.0 / 0.0;*)
34 | lastDigits = {0, 2 .. 3, 5};
35 |
36 | VAR
37 | p: PROCEDURE;
38 | b: BOOLEAN;
39 | ch: CHAR;
40 | s: ARRAY 8 OF CHAR;
41 | i: INTEGER;
42 | x: REAL;
43 | j: BYTE;
44 | A: SET;
45 |
46 | BEGIN
47 | PRINTLN("start T1");
48 | p := null;
49 | b := valid;
50 | ch := singleCharStr;
51 | ch := lineFeed;
52 | ch := quotes;
53 | ch := backslash;
54 | ch := nonAscii;
55 | ch := letterA;
56 | s := singleCharStr;
57 | s := lineFeed;
58 | s := quotes;
59 | s := backslash;
60 | s := sevenDigits;
61 | i := count;
62 | j := count;
63 | x := pi;
64 | (*x := inf;*)
65 | (*x := nan;*)
66 | A := lastDigits;
67 | PRINTLN("done T1");
68 | END T1ConstantDeclarations.
69 |
--------------------------------------------------------------------------------
/testcases/Gen4Tests/T7.obxpro:
--------------------------------------------------------------------------------
1 | [General]
2 | BuildDir=/home/me/Entwicklung/Modules/build-ObxIde2-Qt_5_4_2-Debug/build
3 | BuiltInOakwood=true
4 | BuiltInObSysInner=false
5 | MainModule=@ByteArray()
6 | MainProc=@ByteArray()
7 | Suffixes=@Invalid()
8 | WorkingDir=
9 |
10 | [.]
11 | size=0
12 |
13 | [.lib]
14 | 1\AbsPath=/home/me/Entwicklung/Modules/Oberon/testcases/Gen4Tests/imports/lib/Local.obn
15 | 1\RelPath=imports/lib/Local.obn
16 | size=1
17 |
18 | [.lib1]
19 | 1\AbsPath=/home/me/Entwicklung/Modules/Oberon/testcases/Gen4Tests/imports/lib1/Local.obn
20 | 1\RelPath=imports/lib1/Local.obn
21 | size=1
22 |
23 | [Modules]
24 | 1\AbsPath=/home/me/Entwicklung/Modules/Oberon/testcases/Gen4Tests/T7Modules.obn
25 | 1\RelPath=T7Modules.obn
26 | 2\AbsPath=/home/me/Entwicklung/Modules/Oberon/testcases/Gen4Tests/imports/A.obn
27 | 2\RelPath=imports/A.obn
28 | 3\AbsPath=/home/me/Entwicklung/Modules/Oberon/testcases/Gen4Tests/imports/B.obn
29 | 3\RelPath=imports/B.obn
30 | 4\AbsPath=/home/me/Entwicklung/Modules/Oberon/testcases/Gen4Tests/imports/C.obn
31 | 4\RelPath=imports/C.obn
32 | 5\AbsPath=/home/me/Entwicklung/Modules/Oberon/testcases/Gen4Tests/imports/D.obn
33 | 5\RelPath=imports/D.obn
34 | 6\AbsPath=/home/me/Entwicklung/Modules/Oberon/testcases/Gen4Tests/imports/a dir/E.Mod
35 | 6\RelPath=imports/a dir/E.Mod
36 | 7\AbsPath=/home/me/Entwicklung/Modules/Oberon/testcases/Gen4Tests/imports/lib/libE.obn
37 | 7\RelPath=imports/lib/libE.obn
38 | 8\AbsPath=/home/me/Entwicklung/Modules/Oberon/testcases/Gen4Tests/imports/lib1/lib1M.obn
39 | 8\RelPath=imports/lib1/lib1M.obn
40 | 9\AbsPath=/home/me/Entwicklung/Modules/Oberon/testcases/Gen4Tests/imports/OBNC.obn
41 | 9\RelPath=imports/OBNC.obn
42 | size=9
43 |
44 | [Packages]
45 | 1\Name=@ByteArray()
46 | 2\Name=@ByteArray()
47 | 3\Name=@ByteArray(lib1)
48 | 4\Name=@ByteArray(lib)
49 | size=4
50 |
--------------------------------------------------------------------------------
/testcases/Gen4Tests/imports/B.obn:
--------------------------------------------------------------------------------
1 | (*Copyright (C) 2017, 2018, 2019 Karl Landstrom
2 |
3 | This file is part of OBNC.
4 |
5 | OBNC is free software: you can redistribute it and/or modify
6 | it under the terms of the GNU General Public License as published by
7 | the Free Software Foundation, either version 3 of the License, or
8 | (at your option) any later version.
9 |
10 | OBNC is distributed in the hope that it will be useful,
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | GNU General Public License for more details.
14 |
15 | You should have received a copy of the GNU General Public License
16 | along with OBNC. If not, see .*)
17 |
18 | MODULE B;
19 |
20 | IMPORT C1 := C;
21 |
22 | TYPE
23 | T* = RECORD (C1.T) END;
24 | P1* = POINTER TO RECORD (C1.P0) END;
25 | U* = POINTER TO UDesc;
26 | UDesc* = RECORD f*: INTEGER END;
27 | CTAlias* = C1.T;
28 |
29 | PROCEDURE P*(VAR x: CTAlias);
30 | END P;
31 |
32 | END B.
33 |
--------------------------------------------------------------------------------
/testcases/Gen4Tests/imports/C.obn:
--------------------------------------------------------------------------------
1 | (*Copyright (C) 2017, 2018, 2019 Karl Landstrom
2 |
3 | This file is part of OBNC.
4 |
5 | OBNC is free software: you can redistribute it and/or modify
6 | it under the terms of the GNU General Public License as published by
7 | the Free Software Foundation, either version 3 of the License, or
8 | (at your option) any later version.
9 |
10 | OBNC is distributed in the hope that it will be useful,
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | GNU General Public License for more details.
14 |
15 | You should have received a copy of the GNU General Public License
16 | along with OBNC. If not, see .*)
17 |
18 | MODULE C;
19 |
20 | TYPE
21 | T* = RECORD END;
22 | P0* = POINTER TO RECORD END;
23 |
24 | END C.
25 |
--------------------------------------------------------------------------------
/testcases/Gen4Tests/imports/D.obn:
--------------------------------------------------------------------------------
1 | (*Copyright (C) 2017, 2018, 2019 Karl Landstrom
2 |
3 | This file is part of OBNC.
4 |
5 | OBNC is free software: you can redistribute it and/or modify
6 | it under the terms of the GNU General Public License as published by
7 | the Free Software Foundation, either version 3 of the License, or
8 | (at your option) any later version.
9 |
10 | OBNC is distributed in the hope that it will be useful,
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | GNU General Public License for more details.
14 |
15 | You should have received a copy of the GNU General Public License
16 | along with OBNC. If not, see .*)
17 |
18 | MODULE D;
19 |
20 | CONST b* = TRUE;
21 |
22 | END D.
23 |
--------------------------------------------------------------------------------
/testcases/Gen4Tests/imports/OBNC.obn:
--------------------------------------------------------------------------------
1 | (*Copyright (C) 2017, 2018, 2019 Karl Landstrom
2 |
3 | This file is part of OBNC.
4 |
5 | OBNC is free software: you can redistribute it and/or modify
6 | it under the terms of the GNU General Public License as published by
7 | the Free Software Foundation, either version 3 of the License, or
8 | (at your option) any later version.
9 |
10 | OBNC is distributed in the hope that it will be useful,
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | GNU General Public License for more details.
14 |
15 | You should have received a copy of the GNU General Public License
16 | along with OBNC. If not, see .*)
17 |
18 | MODULE OBNC; (*should not cause a conflict with system C module OBNC*)
19 |
20 | (*generated identifiers with suffixes should not conflict with identifiers declared in system module OBNC*)
21 |
22 | CONST b* = TRUE;
23 |
24 | TYPE
25 | OBNC = RECORD f: INTEGER END;
26 |
27 | VAR
28 | a: ARRAY 1 OF INTEGER;
29 | x: OBNC;
30 |
31 | PROCEDURE Q(OBNC: ARRAY OF INTEGER);
32 | END Q;
33 |
34 | BEGIN
35 | Q(a);
36 | x.f := 0
37 | END OBNC.
38 |
--------------------------------------------------------------------------------
/testcases/Gen4Tests/imports/a dir/E.Mod:
--------------------------------------------------------------------------------
1 | (*Copyright (C) 2017, 2018, 2019 Karl Landstrom
2 |
3 | This file is part of OBNC.
4 |
5 | OBNC is free software: you can redistribute it and/or modify
6 | it under the terms of the GNU General Public License as published by
7 | the Free Software Foundation, either version 3 of the License, or
8 | (at your option) any later version.
9 |
10 | OBNC is distributed in the hope that it will be useful,
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | GNU General Public License for more details.
14 |
15 | You should have received a copy of the GNU General Public License
16 | along with OBNC. If not, see .*)
17 |
18 | MODULE E;
19 |
20 | CONST b* = TRUE;
21 |
22 | END E.
23 |
--------------------------------------------------------------------------------
/testcases/Gen4Tests/imports/lib/Local.obn:
--------------------------------------------------------------------------------
1 | (*Copyright (C) 2017, 2018, 2019 Karl Landstrom
2 |
3 | This file is part of OBNC.
4 |
5 | OBNC is free software: you can redistribute it and/or modify
6 | it under the terms of the GNU General Public License as published by
7 | the Free Software Foundation, either version 3 of the License, or
8 | (at your option) any later version.
9 |
10 | OBNC is distributed in the hope that it will be useful,
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | GNU General Public License for more details.
14 |
15 | You should have received a copy of the GNU General Public License
16 | along with OBNC. If not, see .*)
17 |
18 | MODULE Local;
19 |
20 | TYPE
21 | T* = RECORD f*: INTEGER END;
22 |
23 | VAR
24 | x*: INTEGER;
25 |
26 | PROCEDURE P*;
27 | END P;
28 |
29 | END Local.
30 |
--------------------------------------------------------------------------------
/testcases/Gen4Tests/imports/lib/libE.obn:
--------------------------------------------------------------------------------
1 | (*Copyright (C) 2017, 2018, 2019 Karl Landstrom
2 |
3 | This file is part of OBNC.
4 |
5 | OBNC is free software: you can redistribute it and/or modify
6 | it under the terms of the GNU General Public License as published by
7 | the Free Software Foundation, either version 3 of the License, or
8 | (at your option) any later version.
9 |
10 | OBNC is distributed in the hope that it will be useful,
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | GNU General Public License for more details.
14 |
15 | You should have received a copy of the GNU General Public License
16 | along with OBNC. If not, see .*)
17 |
18 | MODULE libE;
19 |
20 | IMPORT lib.Local;
21 |
22 | CONST b* = TRUE;
23 |
24 | VAR
25 | x: Local.T;
26 |
27 | BEGIN
28 | x.f := 0
29 | END libE.
30 |
--------------------------------------------------------------------------------
/testcases/Gen4Tests/imports/lib1/Local.obn:
--------------------------------------------------------------------------------
1 | (*Copyright (C) 2017, 2018, 2019 Karl Landstrom
2 |
3 | This file is part of OBNC.
4 |
5 | OBNC is free software: you can redistribute it and/or modify
6 | it under the terms of the GNU General Public License as published by
7 | the Free Software Foundation, either version 3 of the License, or
8 | (at your option) any later version.
9 |
10 | OBNC is distributed in the hope that it will be useful,
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | GNU General Public License for more details.
14 |
15 | You should have received a copy of the GNU General Public License
16 | along with OBNC. If not, see .*)
17 |
18 | MODULE Local;
19 |
20 | TYPE
21 | T1* = RECORD f*: INTEGER END;
22 |
23 | VAR
24 | y*: INTEGER;
25 |
26 | PROCEDURE Q*;
27 | END Q;
28 |
29 | END Local.
30 |
--------------------------------------------------------------------------------
/testcases/Gen4Tests/imports/lib1/lib1M.obn:
--------------------------------------------------------------------------------
1 | (*Copyright (C) 2017, 2018, 2019 Karl Landstrom
2 |
3 | This file is part of OBNC.
4 |
5 | OBNC is free software: you can redistribute it and/or modify
6 | it under the terms of the GNU General Public License as published by
7 | the Free Software Foundation, either version 3 of the License, or
8 | (at your option) any later version.
9 |
10 | OBNC is distributed in the hope that it will be useful,
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | GNU General Public License for more details.
14 |
15 | You should have received a copy of the GNU General Public License
16 | along with OBNC. If not, see .*)
17 |
18 | MODULE lib1M;
19 |
20 | IMPORT lib1.Local;
21 |
22 | CONST b* = TRUE;
23 |
24 | VAR
25 | x: Local.T1;
26 |
27 | BEGIN
28 | x.f := 0;
29 | Local.Q;
30 | END lib1M.
31 |
--------------------------------------------------------------------------------
/testcases/Hennessy.obnpro:
--------------------------------------------------------------------------------
1 | [General]
2 | BuiltInOakwood=true
3 | MainModule=@ByteArray()
4 | MainProc=@ByteArray()
5 | Suffixes=.Mod, .obn
6 |
7 | [Modules]
8 | 1\AbsPath=/home/me/Entwicklung/Modules/Oberon/testcases/Hennessy.Mod
9 | 1\RelPath=Hennessy.Mod
10 | size=1
11 |
--------------------------------------------------------------------------------
/testcases/Hennessy/Bubble.obx:
--------------------------------------------------------------------------------
1 | // see Main.obx
2 | module Bubble
3 |
4 | import Util
5 |
6 | // Sorts an array using bubblesort
7 |
8 | const
9 | sortelements = 5000
10 | srtelements = 500
11 |
12 | var
13 | sortlist: array sortelements + 1 of integer
14 | biggest, littlest,
15 | top: integer
16 |
17 | proc bInitarr()
18 | var
19 | i, temp: integer
20 | begin
21 | Util.Initrand()
22 | biggest := 0
23 | littlest := 0
24 | i := 1
25 | while i <= srtelements do
26 | temp := Util.Rand()
27 | sortlist[i] := temp - (temp div 100000) * 100000 - 50000
28 | if sortlist[i] > biggest then
29 | biggest := sortlist[i]
30 | elsif sortlist[i] < littlest then
31 | littlest := sortlist[i]
32 | end
33 | inc(i)
34 | end
35 | end bInitarr
36 |
37 | proc Run*()
38 | var
39 | i, j: integer
40 | begin
41 | bInitarr()
42 | top := srtelements
43 | while top > 1 do
44 | i := 1
45 | while i < top do
46 | if sortlist[i] > sortlist[i + 1] then
47 | j := sortlist[i]
48 | sortlist[i] := sortlist[i + 1]
49 | sortlist[i + 1] := j
50 | end
51 | i := i + 1
52 | end
53 | top := top - 1
54 | end
55 | if (sortlist[1] # littlest) or (sortlist[srtelements] # biggest) then
56 | Util.Str("Error3 in Bubble.$")
57 | end
58 | end Run
59 |
60 | end Bubble
61 |
--------------------------------------------------------------------------------
/testcases/Hennessy/Hennessy.obxpro:
--------------------------------------------------------------------------------
1 | [General]
2 | BuildDir=/home/me/Entwicklung/Modules/build-ObxIde2-Qt_5_4_2-Debug/build
3 | BuiltInOakwood=true
4 | BuiltInObSysInner=false
5 | MainModule=@ByteArray()
6 | MainProc=@ByteArray()
7 | Suffixes=@Invalid()
8 | WorkingDir=
9 |
10 | [Modules]
11 | 1\AbsPath=/home/me/Entwicklung/Modules/Oberon/testcases/Hennessy/Towers.obx
12 | 1\RelPath=Towers.obx
13 | 10\AbsPath=/home/me/Entwicklung/Modules/Oberon/testcases/Hennessy/Intmm.obx
14 | 10\RelPath=Intmm.obx
15 | 11\AbsPath=/home/me/Entwicklung/Modules/Oberon/testcases/Hennessy/Oscar.obx
16 | 11\RelPath=Oscar.obx
17 | 2\AbsPath=/home/me/Entwicklung/Modules/Oberon/testcases/Hennessy/Queens.obx
18 | 2\RelPath=Queens.obx
19 | 3\AbsPath=/home/me/Entwicklung/Modules/Oberon/testcases/Hennessy/Mm.obx
20 | 3\RelPath=Mm.obx
21 | 4\AbsPath=/home/me/Entwicklung/Modules/Oberon/testcases/Hennessy/Trees.obx
22 | 4\RelPath=Trees.obx
23 | 5\AbsPath=/home/me/Entwicklung/Modules/Oberon/testcases/Hennessy/Util.obx
24 | 5\RelPath=Util.obx
25 | 6\AbsPath=/home/me/Entwicklung/Modules/Oberon/testcases/Hennessy/Quick.obx
26 | 6\RelPath=Quick.obx
27 | 7\AbsPath=/home/me/Entwicklung/Modules/Oberon/testcases/Hennessy/Bubble.obx
28 | 7\RelPath=Bubble.obx
29 | 8\AbsPath=/home/me/Entwicklung/Modules/Oberon/testcases/Hennessy/Main.obx
30 | 8\RelPath=Main.obx
31 | 9\AbsPath=/home/me/Entwicklung/Modules/Oberon/testcases/Hennessy/Perm.obx
32 | 9\RelPath=Perm.obx
33 | size=11
34 |
35 | [Packages]
36 | 1\Name=@ByteArray()
37 | size=1
38 |
--------------------------------------------------------------------------------
/testcases/Hennessy/Intmm.obx:
--------------------------------------------------------------------------------
1 | // see Main.obx
2 | module Intmm
3 |
4 | import Util
5 |
6 | // Multiplies two integer matrices.
7 |
8 | const
9 | rowsize = 40
10 |
11 | type
12 | intmatrix = array rowsize + 1, rowsize + 1 of integer
13 |
14 | var
15 | ima, imb, imr: intmatrix // Nun lokal definiert PM 24.09.94
16 |
17 | proc Initmatrix(var m: intmatrix)
18 | var
19 | temp, i, j: integer
20 | begin
21 | i := 1
22 | while i <= rowsize do
23 | j := 1
24 | while j <= rowsize do
25 | temp := Util.Rand()
26 | m[i][j] := temp - (temp div 120) * 120 - 60
27 | inc(j)
28 | end
29 | inc(i)
30 | end
31 | end Initmatrix
32 |
33 | proc Innerproduct(var result: integer; var a, b: intmatrix; row, column: integer)
34 | var
35 | i: integer
36 | // computes the inner product of A[row,*] and B[*,column]
37 | begin
38 | result := 0
39 | i := 1
40 | while i <= rowsize do
41 | result := result + a[row][i] * b[i][column]
42 | inc(i)
43 | end
44 | end Innerproduct
45 |
46 | proc Run*()
47 | var // ima, imb, imr: intmatrix;
48 | i, j: integer
49 | begin
50 | Util.Initrand()
51 | Initmatrix(ima)
52 | Initmatrix(imb)
53 | i := 1
54 | while i <= rowsize do
55 | j := 1
56 | while j <= rowsize do
57 | Innerproduct(imr[i][j], ima, imb, i, j)
58 | inc(j)
59 | end
60 | inc(i)
61 | end
62 | end Run
63 |
64 | end Intmm
65 |
--------------------------------------------------------------------------------
/testcases/Hennessy/Main.obx:
--------------------------------------------------------------------------------
1 | module Main
2 | (* This is a suite of benchmarks that are relatively short, both in program
3 | size and execution time. It requires no input, and prints the execution
4 | time for each program, using the system- dependent routine Getclock,
5 | below, to find out the current CPU time. It does a rudimentary check to
6 | make sure each program gets the right output. These programs were
7 | gathered by John Hennessy and modified by Peter Nye.
8 |
9 | Oberon: J.Templ 26.2.90
10 | native Oberon: pm 09.12.95
11 | native Oberon OP2: pm 12.02.96
12 |
13 | 2019-10-06 Rochus: Oberon-07 and Oakwood compatibility
14 | 2021-03-10 Rochus: Oberon+ migration
15 | *)
16 |
17 | import Util, Out,
18 | Perm, Towers, Queens, Quick,
19 | Intmm, Mm, Bubble, Trees, Oscar
20 |
21 | type Proc = proc
22 |
23 | proc Time(in s: array of char; p: Proc)
24 | var
25 | timer: integer
26 | i: integer
27 | begin
28 | Util.Str(s)
29 | i := 0
30 | timer := Util.Getclock()
31 | while i < 10 do // TEST orig 10
32 | p
33 | inc(i)
34 | end
35 | timer := (Util.Getclock() - timer)
36 | Out.Int(timer, 8)
37 | Out.Ln
38 | end Time
39 |
40 | begin
41 | println("******** start")
42 | // BEGIN Benchmarks
43 | Time("Perm", Perm.Run)
44 | Time("Towers", Towers.Run)
45 | Time("Queens", Queens.Run)
46 | Time("Intmm", Intmm.Run)
47 | Time("Mm", Mm.Run)
48 | // TODO Puzzle missing
49 | Time("Quick", Quick.Run)
50 | Time("Bubble", Bubble.Run)
51 | Time("Trees", Trees.Run)
52 | Time("FFT", Oscar.Run)
53 |
54 | // END Benchmarks
55 | println("******** done")
56 | end Main
57 |
--------------------------------------------------------------------------------
/testcases/Hennessy/Mm.obx:
--------------------------------------------------------------------------------
1 | // see Main.obx
2 | module Mm
3 |
4 | import Util
5 |
6 | // Multiplies two real matrices.
7 |
8 | const
9 | rowsize = 40
10 |
11 | type
12 | realmatrix = array rowsize + 1, rowsize + 1 of longreal
13 |
14 | var
15 | rma, rmb, rmr: realmatrix
16 |
17 | proc rInitmatrix(var m: realmatrix)
18 | var
19 | temp, i, j: integer
20 | begin
21 | i := 1
22 | while i <= rowsize do
23 | j := 1
24 | while j <= rowsize do
25 | temp := Util.Rand()
26 | m[i][j] := flt((temp - (temp div 120) * 120 - 60) div 3)
27 | inc(j)
28 | end
29 | inc(i)
30 | end
31 | end rInitmatrix
32 |
33 | proc rInnerproduct(var result: longreal; var a, b: realmatrix; row, column: integer)
34 | // computes the inner product of A[row,*] and B[*,column]
35 | var
36 | i: integer
37 | begin
38 | result := 0.0
39 | i := 1
40 | while i <= rowsize do
41 | result := result + a[row][i] * b[i][column]
42 | inc(i)
43 | end
44 | end rInnerproduct
45 |
46 | proc Run*()
47 | var // rma, rmb, rmr: realmatrix;
48 | i, j: integer
49 | begin
50 | Util.Initrand()
51 | rInitmatrix(rma)
52 | rInitmatrix(rmb)
53 | i := 1
54 | while i <= rowsize do
55 | j := 1
56 | while j <= rowsize do
57 | rInnerproduct(rmr[i][j], rma, rmb, i, j)
58 | inc(j)
59 | end
60 | inc(i)
61 | end
62 | end Run
63 | end Mm
64 |
65 |
--------------------------------------------------------------------------------
/testcases/Hennessy/Perm.obx:
--------------------------------------------------------------------------------
1 | // see Main.obx
2 | module Perm
3 |
4 | import Util
5 |
6 | const
7 | permrange = (* 0 .. *)10
8 |
9 | var
10 | permarray: array permrange + 1 of integer
11 | pctr: integer
12 |
13 | proc Swap(var a, b: integer)
14 | var
15 | t: integer
16 | begin
17 | t := a
18 | a := b
19 | b := t
20 | end Swap
21 |
22 | proc Initialize()
23 | var
24 | i: integer
25 | begin
26 | i := 1
27 | while i <= 7 do
28 | permarray[i] := i - 1
29 | inc(i)
30 | end
31 | end Initialize
32 |
33 | // TODO: the performance varies by factor 20 in sequential runs
34 | proc Permute(n: integer)
35 | var
36 | k: integer
37 | begin
38 | pctr := pctr + 1
39 | if (n # 1) then
40 | Permute(n - 1)
41 | k := n - 1
42 | while k >= 1 do
43 | Swap(permarray[n], permarray[k])
44 | Permute(n - 1)
45 | Swap(permarray[n], permarray[k])
46 | dec(k)
47 | end
48 | end
49 | end Permute
50 |
51 | proc Run*()
52 | var
53 | i: integer
54 | begin
55 | pctr := 0
56 | i := 1
57 | while i <= 5 do
58 | Initialize()
59 | Permute(7)
60 | inc(i)
61 | end
62 | if pctr # 43300 then
63 | Util.Str(" Error in Perm.$")
64 | end
65 | end Run
66 |
67 | end Perm
68 |
69 |
--------------------------------------------------------------------------------
/testcases/Hennessy/Readme.md:
--------------------------------------------------------------------------------
1 | This is the Oberon+ version of Hennessy.Mod.
2 | It was first converted using OberonViewer and then manually
3 | modified and split into separate modules per benchmark.
4 |
--------------------------------------------------------------------------------
/testcases/Hennessy/Util.obx:
--------------------------------------------------------------------------------
1 | // see Main.obx
2 | module Util
3 |
4 | import
5 | Input, Out
6 |
7 | var
8 | seed*: integer
9 |
10 | proc Str*(in s: array of char)
11 | var
12 | i: integer
13 | begin
14 | i := 0
15 | while s[i] # 0x do
16 | if s[i] = "$" then
17 | Out.Ln
18 | else
19 | Out.Char(s[i])
20 | end
21 | inc(i)
22 | end
23 | end Str
24 |
25 | proc Getclock*(): integer
26 | begin
27 | return Input.Time()
28 | end Getclock
29 |
30 | proc Initrand*()
31 | begin
32 | seed := 74755
33 | end Initrand
34 |
35 | proc Rand*(): integer
36 | begin
37 | seed := (seed * 1309 + 13849) mod 65535
38 | return (seed)
39 | end Rand
40 |
41 | end Util
42 |
--------------------------------------------------------------------------------
/testcases/NAppGUI/BuildHelper/Readme.md:
--------------------------------------------------------------------------------
1 | Follow the https://github.com/frang75/nappgui_src/blob/main/README.md to download
2 | the NAppGUI source code;
3 |
4 | then copy this BuildHelper folder to the nappgui_sdk folder and run qmake with the
5 | NAppGUI.pro file;
6 |
7 | then run make to build the shared library version of NAppGUI required by Oberon+.
8 |
--------------------------------------------------------------------------------
/testcases/NAppGUI/BuildHelper/res_assert.h:
--------------------------------------------------------------------------------
1 | /* Automatic generated by NAppGUI Resource Compiler (nrc-v3326) */
2 |
3 | #include "core.hxx"
4 |
5 | __EXTERN_C
6 |
7 | /* Messages */
8 | extern ResId ASSERT_CRASH;
9 | extern ResId ASSERT_INFO;
10 | extern ResId CONTACT_INFO;
11 | extern ResId FILE_TEXT;
12 | extern ResId LINE_TEXT;
13 | extern ResId SHOW_ASSERT;
14 | extern ResId ASSERT_LOG;
15 | extern ResId ASSERT_TITLE;
16 | extern ResId DEBUG_TEXT;
17 | extern ResId CONTINUE_TEXT;
18 | extern ResId EXIT_TEXT;
19 |
20 | /* Files */
21 | extern ResId BOMB_PNG;
22 | extern ResId BOMB_DARK_PNG;
23 | extern ResId CONFUSED_PNG;
24 | extern ResId CONFUSED_DARK_PNG;
25 | extern ResId LOGO_PNG;
26 | extern ResId LOGO_DARK_PNG;
27 |
28 | ResPack *res_assert_respack(const char_t *locale);
29 |
30 | __END_C
31 |
--------------------------------------------------------------------------------
/testcases/NAppGUI/DrawHello.obxpro:
--------------------------------------------------------------------------------
1 | [General]
2 | BuildDir=%APPDIR%/build
3 | BuiltInOakwood=false
4 | BuiltInObSysInner=false
5 | MainModule=@ByteArray()
6 | MainProc=@ByteArray()
7 | Suffixes=@Invalid()
8 | WorkingDir=
9 |
10 | [.]
11 | size=0
12 |
13 | [Modules]
14 | 1\AbsPath=/home/me/Entwicklung/Modules/Oberon/testcases/NAppGUI/DrawHello.obx
15 | 1\RelPath=DrawHello.obx
16 | 2\AbsPath=/home/me/Entwicklung/Modules/Oberon/testcases/NAppGUI/NAppCore.obx
17 | 2\RelPath=NAppCore.obx
18 | 3\AbsPath=/home/me/Entwicklung/Modules/Oberon/testcases/NAppGUI/NAppDraw.obx
19 | 3\RelPath=NAppDraw.obx
20 | 4\AbsPath=/home/me/Entwicklung/Modules/Oberon/testcases/NAppGUI/NAppWidgets.obx
21 | 4\RelPath=NAppWidgets.obx
22 | 5\AbsPath=/home/me/Entwicklung/Modules/Oberon/testcases/NAppGUI/Utf8.obx
23 | 5\RelPath=Utf8.obx
24 | 6\AbsPath=/home/me/Entwicklung/Modules/Oberon/testcases/NAppGUI/Resources/Image.obx
25 | 6\RelPath=Resources/Image.obx
26 | size=6
27 |
28 | [Packages]
29 | 1\Name=@ByteArray()
30 | 2\Name=@ByteArray()
31 | size=2
32 |
--------------------------------------------------------------------------------
/testcases/NAppGUI/Fractals.obxpro:
--------------------------------------------------------------------------------
1 | [General]
2 | BuildDir=%APPDIR%/build
3 | BuiltInOakwood=false
4 | BuiltInObSysInner=false
5 | MainModule=@ByteArray()
6 | MainProc=@ByteArray()
7 | Suffixes=@Invalid()
8 | WorkingDir=
9 |
10 | [.]
11 | size=0
12 |
13 | [Modules]
14 | 1\AbsPath=/home/me/Entwicklung/Modules/Oberon/testcases/NAppGUI/NAppCore.obx
15 | 1\RelPath=NAppCore.obx
16 | 2\AbsPath=/home/me/Entwicklung/Modules/Oberon/testcases/NAppGUI/NAppDraw.obx
17 | 2\RelPath=NAppDraw.obx
18 | 3\AbsPath=/home/me/Entwicklung/Modules/Oberon/testcases/NAppGUI/NAppWidgets.obx
19 | 3\RelPath=NAppWidgets.obx
20 | 4\AbsPath=/home/me/Entwicklung/Modules/Oberon/testcases/NAppGUI/Fractals.obx
21 | 4\RelPath=Fractals.obx
22 | size=4
23 |
24 | [Packages]
25 | 1\Name=@ByteArray()
26 | 2\Name=@ByteArray()
27 | size=2
28 |
--------------------------------------------------------------------------------
/testcases/NAppGUI/Fractals2.obxpro:
--------------------------------------------------------------------------------
1 | [General]
2 | BuildDir=%APPDIR%/build
3 | BuiltInOakwood=false
4 | BuiltInObSysInner=false
5 | MainModule=@ByteArray()
6 | MainProc=@ByteArray()
7 | Suffixes=@Invalid()
8 | WorkingDir=
9 |
10 | [.]
11 | size=0
12 |
13 | [Modules]
14 | 1\AbsPath=/home/me/Entwicklung/Modules/Oberon/testcases/NAppGUI/Fractals2.obx
15 | 1\RelPath=Fractals2.obx
16 | 2\AbsPath=/home/me/Entwicklung/Modules/Oberon/testcases/NAppGUI/NAppGUI.obx
17 | 2\RelPath=NAppGUI.obx
18 | size=2
19 |
20 | [Packages]
21 | 1\Name=@ByteArray()
22 | 2\Name=@ByteArray()
23 | size=2
24 |
--------------------------------------------------------------------------------
/testcases/NAppGUI/Hello.obxpro:
--------------------------------------------------------------------------------
1 | [General]
2 | BuildDir=%APPDIR%/build
3 | BuiltInOakwood=false
4 | BuiltInObSysInner=false
5 | MainModule=@ByteArray(Hello)
6 | MainProc=@ByteArray()
7 | Suffixes=@Invalid()
8 | WorkingDir=
9 |
10 | [.]
11 | size=0
12 |
13 | [Modules]
14 | 1\AbsPath=/home/me/Entwicklung/Modules/Oberon/testcases/NAppGUI/NAppCore.obx
15 | 1\RelPath=NAppCore.obx
16 | 2\AbsPath=/home/me/Entwicklung/Modules/Oberon/testcases/NAppGUI/NAppDraw.obx
17 | 2\RelPath=NAppDraw.obx
18 | 3\AbsPath=/home/me/Entwicklung/Modules/Oberon/testcases/NAppGUI/NAppWidgets.obx
19 | 3\RelPath=NAppWidgets.obx
20 | 4\AbsPath=/home/me/Entwicklung/Modules/Oberon/testcases/NAppGUI/Hello.obx
21 | 4\RelPath=Hello.obx
22 | size=4
23 |
24 | [Packages]
25 | 1\Name=@ByteArray()
26 | 2\Name=@ByteArray()
27 | size=2
28 |
--------------------------------------------------------------------------------
/testcases/NAppGUI/Hello2.obxpro:
--------------------------------------------------------------------------------
1 | [General]
2 | BuildDir=%APPDIR%/build
3 | BuiltInOakwood=false
4 | BuiltInObSysInner=false
5 | MainModule=@ByteArray(Hello)
6 | MainProc=@ByteArray()
7 | Suffixes=@Invalid()
8 | WorkingDir=
9 |
10 | [.]
11 | size=0
12 |
13 | [Modules]
14 | 1\AbsPath=/home/me/Entwicklung/Modules/Oberon/testcases/NAppGUI/NAppCore.obx
15 | 1\RelPath=NAppCore.obx
16 | 2\AbsPath=/home/me/Entwicklung/Modules/Oberon/testcases/NAppGUI/NAppDraw.obx
17 | 2\RelPath=NAppDraw.obx
18 | 3\AbsPath=/home/me/Entwicklung/Modules/Oberon/testcases/NAppGUI/NAppWidgets.obx
19 | 3\RelPath=NAppWidgets.obx
20 | 4\AbsPath=/home/me/Entwicklung/Modules/Oberon/testcases/NAppGUI/Hello2.obx
21 | 4\RelPath=Hello2.obx
22 | size=4
23 |
24 | [Packages]
25 | 1\Name=@ByteArray()
26 | 2\Name=@ByteArray()
27 | size=2
28 |
--------------------------------------------------------------------------------
/testcases/NAppGUI/HelloGui/HelloGui.obxpro:
--------------------------------------------------------------------------------
1 | [General]
2 | BuildDir=%APPDIR%/build
3 | BuiltInOakwood=false
4 | BuiltInObSysInner=false
5 | MainModule=@ByteArray()
6 | MainProc=@ByteArray()
7 | Suffixes=@Invalid()
8 | WorkingDir=
9 |
10 | [.]
11 | size=0
12 |
13 | [Modules]
14 | 1\AbsPath=/home/me/Entwicklung/Modules/Oberon/testcases/NAppGUI/NAppCore.obx
15 | 1\RelPath=../NAppCore.obx
16 | 2\AbsPath=/home/me/Entwicklung/Modules/Oberon/testcases/NAppGUI/NAppDraw.obx
17 | 2\RelPath=../NAppDraw.obx
18 | 3\AbsPath=/home/me/Entwicklung/Modules/Oberon/testcases/NAppGUI/NAppWidgets.obx
19 | 3\RelPath=../NAppWidgets.obx
20 | 4\AbsPath=/home/me/Entwicklung/Modules/Oberon/testcases/NAppGUI/HelloGui/GuiHello.obx
21 | 4\RelPath=GuiHello.obx
22 | 5\AbsPath=/home/me/Entwicklung/Modules/Oberon/testcases/NAppGUI/HelloGui/Labels.obx
23 | 5\RelPath=Labels.obx
24 | 6\AbsPath=/home/me/Entwicklung/Modules/Oberon/testcases/NAppGUI/HelloGui/Buttons.obx
25 | 6\RelPath=Buttons.obx
26 | 7\AbsPath=/home/me/Entwicklung/Modules/Oberon/testcases/NAppGUI/HelloGui/Icons.obx
27 | 7\RelPath=Icons.obx
28 | 8\AbsPath=/home/me/Entwicklung/Modules/Oberon/testcases/NAppGUI/HelloGui/Popups.obx
29 | 8\RelPath=Popups.obx
30 | 9\AbsPath=/home/me/Entwicklung/Modules/Oberon/testcases/NAppGUI/Utf8.obx
31 | 9\RelPath=../Utf8.obx
32 | size=9
33 |
34 | [Packages]
35 | 1\Name=@ByteArray()
36 | 2\Name=@ByteArray()
37 | size=2
38 |
--------------------------------------------------------------------------------
/testcases/NAppGUI/NApp1.obxpro:
--------------------------------------------------------------------------------
1 | [General]
2 | BuildDir=%APPDIR%/build
3 | BuiltInOakwood=false
4 | BuiltInObSysInner=false
5 | MainModule=@ByteArray()
6 | MainProc=@ByteArray()
7 | Suffixes=@Invalid()
8 | WorkingDir=
9 |
10 | [.]
11 | size=0
12 |
13 | [Modules]
14 | 1\AbsPath=/home/me/Entwicklung/Modules/Oberon/testcases/NAppGUI/NAppCore.obx
15 | 1\RelPath=NAppCore.obx
16 | 2\AbsPath=/home/me/Entwicklung/Modules/Oberon/testcases/NAppGUI/Test1.obx
17 | 2\RelPath=Test1.obx
18 | 3\AbsPath=/home/me/Entwicklung/Modules/Oberon/testcases/NAppGUI/NAppDraw.obx
19 | 3\RelPath=NAppDraw2d.obx
20 | 4\AbsPath=/home/me/Entwicklung/Modules/Oberon/testcases/NAppGUI/NAppWidgets.obx
21 | 4\RelPath=NAppWidgets.obx
22 | size=4
23 |
24 | [Packages]
25 | 1\Name=@ByteArray()
26 | 2\Name=@ByteArray()
27 | size=2
28 |
--------------------------------------------------------------------------------
/testcases/NAppGUI/Resources/Readme.md:
--------------------------------------------------------------------------------
1 | convert binary files like image.jpg with the following Linux command
2 | to a hex string
3 | hexdump -v -e '16/1 "%02X " "\n"' image.jpg
4 |
--------------------------------------------------------------------------------
/testcases/NAppGUI/Resources/image.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rochus-keller/Oberon/e59a729bd13513f2d454fd2ce364ab01ecefeb70/testcases/NAppGUI/Resources/image.jpg
--------------------------------------------------------------------------------
/testcases/NAppGUI/Test.obxpro:
--------------------------------------------------------------------------------
1 | [General]
2 | BuildDir=%APPDIR%/build
3 | BuiltInOakwood=false
4 | BuiltInObSysInner=false
5 | MainModule=@ByteArray()
6 | MainProc=@ByteArray()
7 | Suffixes=@Invalid()
8 | WorkingDir=
9 |
10 | [.]
11 | size=0
12 |
13 | [Modules]
14 | 1\AbsPath=/home/me/Entwicklung/Modules/Oberon/testcases/NAppGUI/NAppCore.obx
15 | 1\RelPath=NAppCore.obx
16 | 2\AbsPath=/home/me/Entwicklung/Modules/Oberon/testcases/NAppGUI/Test3b.obx
17 | 2\RelPath=Test3b.obx
18 | size=2
19 |
20 | [Packages]
21 | 1\Name=@ByteArray()
22 | 2\Name=@ByteArray()
23 | size=2
24 |
--------------------------------------------------------------------------------
/testcases/NAppGUI/Test1.obx:
--------------------------------------------------------------------------------
1 | module Test1
2 | import C := NAppCore
3 |
4 | begin
5 | println( C.min_u32(123,234) )
6 | end Test1
7 |
--------------------------------------------------------------------------------
/testcases/NAppGUI/Test2.obx:
--------------------------------------------------------------------------------
1 | module Test2
2 |
3 | import C := NAppCore
4 | var
5 | clock: *C.Clock
6 | tmp: array 1 of *C.Clock
7 |
8 | begin
9 | clock := C.clock_create(0)
10 |
11 | tmp[0] := clock
12 | C.clock_destroy(tmp)
13 | clock := nil
14 | end Test2
15 |
--------------------------------------------------------------------------------
/testcases/NAppGUI/Test3.obx:
--------------------------------------------------------------------------------
1 | module Test3
2 | import C := NAppCore
3 |
4 | type
5 | Data = cstruct count: integer end
6 |
7 | proc fibonacci( n : integer ): longint
8 | var a,b: longint
9 | begin
10 | if n > 1 then
11 | a := fibonacci( n - 1 )
12 | b := fibonacci( n - 2 )
13 | return ( a + b )
14 | elsif n = 0 then
15 | return 0
16 | else
17 | return 1
18 | end
19 | end fibonacci
20 |
21 | proc worker(data: *void): integer
22 | type DataPtr = *Data
23 | var
24 | p: DataPtr
25 | begin
26 | println("start worker")
27 | p := cast(DataPtr,data)
28 | println(p.count)
29 | println(fibonacci(p.count))
30 | println("end worker")
31 | return 0
32 | end worker
33 |
34 | const
35 | numOfThreads = 4
36 |
37 | var
38 | t: carray numOfThreads of *C.Thread
39 | i: integer
40 | d: carray numOfThreads of Data
41 | begin
42 | println("start Test3")
43 | C.core_start()
44 | for i := 0 to numOfThreads-1 do
45 | d[i].count := 35 + i
46 | t[i] := C.bthread_create_imp(worker, d[i])
47 | end
48 | for i := 0 to numOfThreads-1 do
49 | C.bthread_wait(t[i])
50 | end
51 | //C.bthread_sleep(2000)
52 | C.core_finish()
53 | println("end Test3")
54 | end Test3
55 |
--------------------------------------------------------------------------------
/testcases/NAppGUI/Test3b.obx:
--------------------------------------------------------------------------------
1 | module Test3b
2 | import C := NAppCore
3 |
4 | type
5 | Data = cstruct count: integer end
6 |
7 | proc fibonacci( n : integer ): longint
8 | var a,b: longint
9 | begin
10 | if n > 1 then
11 | a := fibonacci( n - 1 )
12 | b := fibonacci( n - 2 )
13 | return ( a + b )
14 | elsif n = 0 then
15 | return 0
16 | else
17 | return 1
18 | end
19 | end fibonacci
20 |
21 | proc worker(data: *void): integer
22 | type DataPtr = *Data
23 | var
24 | p: DataPtr
25 | begin
26 | println("start worker")
27 | p := cast(DataPtr,data)
28 | println(p.count)
29 | println(fibonacci(p.count))
30 | println("end worker")
31 | return 0
32 | end worker
33 |
34 | var
35 | //t0,t1: *C.Thread // works
36 | t : carray 2 of *C.Thread
37 | //d0,d1,d2: Data // works
38 | d : carray 2 of Data // works
39 | begin
40 | println("start Test3")
41 | C.core_start()
42 | d[0].count := 35
43 | t[0] := C.bthread_create_imp(worker, d[0])
44 | d[1].count := 36
45 | t[1] := C.bthread_create_imp(worker, d[1])
46 |
47 | C.bthread_wait(t[0])
48 | C.bthread_wait(t[1])
49 |
50 | C.core_finish()
51 | println("end Test3")
52 | end Test3b
53 |
--------------------------------------------------------------------------------
/testcases/NAppGUI/Test4.obx:
--------------------------------------------------------------------------------
1 | module Test4
2 | import C := NAppCore, T := NAppCore
3 |
4 | type
5 | Data = cstruct count: integer end
6 |
7 | proc fibonacci( n : integer ): longint
8 | var a,b: longint
9 | begin
10 | if n > 1 then
11 | a := fibonacci( n - 1 )
12 | b := fibonacci( n - 2 )
13 | return ( a + b )
14 | elsif n = 0 then
15 | return 0
16 | else
17 | return 1
18 | end
19 | end fibonacci
20 |
21 | proc worker(data: *void): integer
22 | type DataPtr = *Data
23 | var
24 | p: DataPtr
25 | res: longint
26 | count: integer
27 | begin
28 | C.log_printf("start worker")
29 | p := cast(DataPtr,data)
30 | count := p.count
31 | count := 35
32 | res := fibonacci(count)
33 | C.log_printf("count %d, result %lld", p.count, res )
34 | C.log_printf("end worker")
35 | return 0
36 | end worker
37 |
38 | var
39 | t: *T.Thread
40 | i: integer
41 | d: Data
42 | begin
43 | println("start Test4")
44 | C.core_start()
45 | d.count := 35
46 | // check https://bugzilla.xamarin.com/15/15695/bug.html
47 | t := T.bthread_create_imp(worker, d)
48 | println("thread started")
49 | T.bthread_wait(t)
50 | //C.bthread_sleep(2000)
51 | C.core_finish()
52 | println("end Test4")
53 | end Test4
54 |
--------------------------------------------------------------------------------
/testcases/NAppGUI/Test5.obx:
--------------------------------------------------------------------------------
1 | module Test5
2 | import T := NAppCore
3 | proc worker(data: *void): integer
4 | begin
5 | println("hello from worker")
6 | return 0
7 | end worker
8 | var t: *T.Thread
9 | begin
10 | println("start Test4")
11 | t := T.bthread_create_imp(worker, nil)
12 | println("thread created")
13 | T.bthread_wait(t)
14 | println("end Test4")
15 | end Test5
16 |
--------------------------------------------------------------------------------
/testcases/ObnParser_compatibility_results:
--------------------------------------------------------------------------------
1 | 2020-11-21/RK
2 |
3 | OK
4 | --
5 | hostess-tests, http://hostess.sourceforge.net/
6 | all ok
7 |
8 | ETH Oberon V3, https://web.archive.org/web/20080912211720if_/http://claudio.ch:80/V4/ProjectOberon-Older/
9 | all ok
10 | but OCS.Mod line 315 is a syntax error
11 |
12 | ETH Oberon V4, https://web.archive.org/web/20080912211720if_/http://claudio.ch:80/V4/ProjectOberon/
13 | all ok
14 | but Printmaps.Def line 1 is a syntax error
15 |
16 | oberonc tests, https://github.com/lboasso/oberonc/tree/master/tests
17 | all ok
18 |
19 | Project Oberon 2013, http://www.projectoberon.com/
20 | System incl. Network, Compiler, Graph
21 | all ok
22 |
23 | obnc passing, https://miasap.se/obnc/downloads/obnc_0.16.1.tar.gz
24 | all ok
25 |
26 | ofront, https://github.com/jtempl/ofront
27 | all ok
28 |
29 |
30 | NOK
31 | ---
32 | Linz Oberon V4 1.3.04, ftp://ftp.ssw.uni-linz.ac.at/pub/Oberon/Linux/oberon.tgz
33 | incompatible file formats (folds)
34 |
--------------------------------------------------------------------------------
/testcases/ObxTests/Anyrec1.obx:
--------------------------------------------------------------------------------
1 | module Anyrec1
2 |
3 | // var n: anyrec // compiler error
4 |
5 | // type R = record f: anyrec end compiler error
6 |
7 | // proc P(p: anyrec) var l: anyrec begin end P // compiler error
8 |
9 | proc Q(in p: anyrec)
10 | begin
11 | assert(p is TT)
12 | end Q
13 |
14 | proc F(): pointer to anyrec
15 | var t: pointer to T
16 | begin
17 | new(t)
18 | return t
19 | end F
20 |
21 | type T = record i: integer end
22 | TT = pointer to T
23 | T2 = record(anyrec) i: integer end // ok
24 |
25 | var p: pointer to anyrec
26 | t: T
27 |
28 | begin
29 | println("begin Anyrec1")
30 |
31 | p := F()
32 | assert( p is TT )
33 |
34 | Q(p)
35 | Q(t)
36 |
37 | println("end Anyrec1")
38 | end Anyrec1
39 |
--------------------------------------------------------------------------------
/testcases/ObxTests/Arrays.obx:
--------------------------------------------------------------------------------
1 | module Arrays
2 |
3 | type
4 | S = record c: array 4 of T end
5 | R = record(S) a,b: integer end
6 | T = record s: array 10 of char end
7 | var a : array 20 of shortint
8 | c : array 10 of char
9 | d : array 3 of R
10 | e : array 10 of byte
11 |
12 | proc sub
13 | var b : array 10 of byte
14 | begin
15 | b[1] := 30
16 | println(b[1])
17 | a[4] := 50
18 | end sub
19 | begin
20 | println("Arrays start")
21 | a[3] := 42
22 | sub
23 | println(a[3])
24 | println(a[4])
25 | c := "test"
26 | println(c)
27 | println(c[3])
28 |
29 | d[1].a := 5
30 | println(d[1].a)
31 | e := $20616263$
32 | println(e[2])
33 | println("Arrays done")
34 | end Arrays
--------------------------------------------------------------------------------
/testcases/ObxTests/Arrays2.obx:
--------------------------------------------------------------------------------
1 | module Arrays2
2 |
3 | type A = array 4 of shortint
4 | AA = array 4,10 of char
5 | var a,b : A
6 | c : AA
7 |
8 | proc P( a: array of shortint )
9 | var i : integer
10 | begin
11 | for i := 0 to len(a) - 1 do
12 | println( a[i] )
13 | end
14 | end P
15 |
16 | begin
17 | println("Arrays2 start")
18 | a[0] := -2
19 | a[1] := -1
20 | a[2] := 1
21 | a[3] := 2
22 | b := a
23 | println(b[0])
24 | println(b[1])
25 | println(b[2])
26 | println(b[3])
27 |
28 | println(c[2])
29 | c[0] := "alpha"
30 | c[1] := "beta"
31 | c[2] := "gamma"
32 | println(c[2])
33 | P(a)
34 |
35 | println("Arrays2 done")
36 | end Arrays2
--------------------------------------------------------------------------------
/testcases/ObxTests/Arrays3.obx:
--------------------------------------------------------------------------------
1 | module Arrays3
2 |
3 | type A = ^[4]integer // ^[4] -> pointer to array 4 of
4 | B = pointer to []longint // [] -> array of
5 | C = ^[][]char // pointer to array of array of -> ^[][]
6 | var a : A
7 | b : B
8 | c : C
9 | begin
10 | println("Arrays3 start")
11 | new(a)
12 | new(b,5)
13 | new(c,3,10)
14 |
15 | b[3] := 33
16 | println(b[3])
17 | println(a[2])
18 |
19 |
20 | c[2] := "test"
21 | println(c[2])
22 |
23 | println( len(a) )
24 | println( len(b) )
25 | println( len(c) )
26 | println("Arrays3 done")
27 | end Arrays3
--------------------------------------------------------------------------------
/testcases/ObxTests/Arrays4.obx:
--------------------------------------------------------------------------------
1 | module Arrays4
2 |
3 | type A = array 3, 4 of integer
4 | B = array 5 of integer
5 | C = array 5 of B
6 | var a : A
7 | b: array 10 of pointer to record
8 | a: array 10 of integer
9 | f: proc (): integer
10 | end
11 | c: C
12 |
13 |
14 | begin
15 | println("Arrays4 start")
16 | a[1,2] := 33
17 | println(a[1][2])
18 |
19 | c[1,3] := 44
20 | println(c[1,3])
21 |
22 | new(b[0])
23 | b[0].a[0] := 1
24 | println(b[0].a[0])
25 | assert(b[0].a[0] = 1)
26 | println("Arrays4 done")
27 | end Arrays4
28 |
--------------------------------------------------------------------------------
/testcases/ObxTests/Arrays5.obx:
--------------------------------------------------------------------------------
1 | module Arrays5
2 |
3 | type A = array 10 of pointer to array of integer
4 | var a: A
5 |
6 | begin
7 | println("Arrays5 start")
8 | new(a[0],3)
9 | new(a[1],4)
10 | new(a[2],5)
11 |
12 | a[1][2] := 33
13 | println(a[1,2])
14 |
15 | a[2,0] := 44
16 | println(a[2][0])
17 |
18 | println("Arrays5 done")
19 | end Arrays5
20 |
--------------------------------------------------------------------------------
/testcases/ObxTests/ByteInt8Compat.obx:
--------------------------------------------------------------------------------
1 | module ByteInt8Compat
2 |
3 | var
4 | b: byte
5 | i: int8
6 | i2: int16
7 |
8 | begin
9 | b := 123
10 | i := b
11 | println(i)
12 |
13 | i := -100
14 | b := cast(byte,i) // ldsfld int8 'i', conv.u1, stind.i1
15 | i := cast(int8,b)
16 | i2 := cast(int8,b)
17 | println(i) // -100
18 | println(i2) // -100
19 | println(b) // 156
20 |
21 | i := -100
22 | b := i // ldsfld int8 'i', conv.ovf.u1, stind.i1, raises overflow exception
23 | println(b) // also 156
24 |
25 | i2 := -12345
26 | b := i2 // ldsfld int16 'i2', conv.ovf.u1, stind.i1, raises overflow exception
27 | i := i2 // ldsfld int16 'i2', conv.ovf.i1, stind.i1, raises overflow exception
28 | println(i) // -57
29 | i := cast(int8,i2) // ldsfld int16 'i2', conv.i1, stind.i1
30 | println(i) // -57
31 | println(b) // 199
32 |
33 | i2 := -123
34 | b := i2 // ldsfld int16 'i2', conv.ovf.u1, stind.i1, raises overflow exception
35 | i := i2 // ldsfld int16 'i2', conv.ovf.i1, stind.i1, ok
36 | println(i) // -123
37 | println(b) // 133
38 |
39 |
40 | end ByteInt8Compat
41 |
--------------------------------------------------------------------------------
/testcases/ObxTests/ByteTrick.obx:
--------------------------------------------------------------------------------
1 | module ByteTrick
2 |
3 | var
4 | str : array 32 of char
5 | ch : char
6 |
7 | proc getByte(var b: byte)
8 | begin
9 | b := 123
10 | end getByte
11 |
12 | proc getArray(var a: array of byte)
13 | begin
14 | a[1] := 45
15 | a[2] := 123
16 | end getArray
17 |
18 | begin
19 |
20 | getByte(ch)
21 | println(ord(ch)) // prints 123
22 |
23 | getArray(str)
24 | println(ord(str[0])) // prints 11520 !!!
25 | println(ord(str[1])) // prints 123
26 | println(ord(str[2])) // prints 0
27 | println(ord(str[3])) // prints 0
28 |
29 | end ByteTrick
30 |
--------------------------------------------------------------------------------
/testcases/ObxTests/Bytes.obx:
--------------------------------------------------------------------------------
1 | module Bytes
2 |
3 | var
4 | a: array 8 of byte
5 | s: array 8 of char
6 | i: array 8 of int8
7 | i8: int8
8 | i16: int16
9 | i32: int32
10 | i64: int64
11 | r4: real
12 | r8: longreal
13 | begin
14 | i8 := 123
15 | bytes(a,i8)
16 | println("i8")
17 | println(a[0])
18 | number(i8,a)
19 | println(i8)
20 |
21 | i16 := 12345
22 | bytes(a,i16)
23 | println("i16")
24 | println(a[0])
25 | println(a[1])
26 | number(i16,a)
27 | println(i16)
28 |
29 | i32 := 1234567890
30 | bytes(a,i32)
31 | println("i32 byte")
32 | println(a[0])
33 | println(a[1])
34 | println(a[2])
35 | println(a[3])
36 | number(i32,a)
37 | println(i32)
38 |
39 | bytes(s,1234567890)
40 | println("i32 char")
41 | println(ord(s[0]))
42 | println(ord(s[1]))
43 | println(ord(s[2]))
44 | println(ord(s[3]))
45 | number(i32,s)
46 | println(i32)
47 |
48 | bytes(i,1234567890)
49 | println("i32 int8")
50 | println(i[0])
51 | println(i[1])
52 | println(i[2])
53 | println(i[3])
54 | number(i32,i)
55 | println(i32)
56 |
57 | i64 := 1234567890321654987
58 | bytes(a,i64)
59 | println("i64")
60 | println(a[0])
61 | println(a[1])
62 | println(a[2])
63 | println(a[3])
64 | println(a[4])
65 | println(a[5])
66 | println(a[6])
67 | println(a[7])
68 | number(i64,a)
69 | println(i64)
70 |
71 | r4 := 1234.567
72 | bytes(a,r4)
73 | println("r4")
74 | println(a[0])
75 | println(a[1])
76 | println(a[2])
77 | println(a[3])
78 | number(r4,a)
79 | println(r4)
80 |
81 | r8 := 12345.67890
82 | bytes(a,r8)
83 | println("r8")
84 | println(a[0])
85 | println(a[1])
86 | println(a[2])
87 | println(a[3])
88 | println(a[4])
89 | println(a[5])
90 | println(a[6])
91 | println(a[7])
92 | number(r8,a)
93 | println(r8)
94 |
95 | end Bytes
96 |
--------------------------------------------------------------------------------
/testcases/ObxTests/Circular1.obx:
--------------------------------------------------------------------------------
1 | module Circular1
2 |
3 | type
4 | A = record b: pointer to B // error if b is B, not pointer to B
5 | d: pointer to array 3 of B // error if d is array, not pointer to array
6 | c: integer end
7 | B = record c: C end
8 | C = record a: A end
9 |
10 | var
11 | a: A
12 | begin
13 | a.c := 333
14 | println(a.c)
15 | end Circular1
16 |
--------------------------------------------------------------------------------
/testcases/ObxTests/CompCon1.obx:
--------------------------------------------------------------------------------
1 | module CompCon1
2 |
3 | begin
4 | println("start CompCon1")
5 | <* B+ *>
6 |
7 | <* if A then *>
8 | println("A")
9 | <* elsif B then *>
10 | println("B")
11 | <* elsif C then *>
12 | println("C")
13 | <* else *>
14 | println("D")
15 | <* end *>
16 |
17 | println("end CompCon1")
18 | end CompCon1
19 |
--------------------------------------------------------------------------------
/testcases/ObxTests/CompCon2.obx:
--------------------------------------------------------------------------------
1 | module CompCon2
2 |
3 | begin
4 | println("start CompCon2")
5 | //<* B+ *>
6 | //<* B2+ *>
7 |
8 | <* if A then *>
9 | println("A")
10 | <* elsif B then *>
11 | <* if B1 then *>
12 | println("B1")
13 | <* elsif B2 then *>
14 | println("B2")
15 | <* elsif B3 then *>
16 | println("B3")
17 | <* else *>
18 | println("B")
19 | <* end *>
20 | <* elsif C then *>
21 | println("C")
22 | <* else *>
23 | println("D")
24 | <* end *>
25 |
26 | println("end CompCon2")
27 | end CompCon2
28 |
--------------------------------------------------------------------------------
/testcases/ObxTests/CompCon3.obx:
--------------------------------------------------------------------------------
1 | module CompCon3
2 | begin
3 | println("start CompCon3")
4 | <* C+ *>
5 | //<* Z+ *>
6 |
7 | <* if A or B or Z then *>
8 | println("hit1")
9 | <* elsif C & ~Z then *>
10 | println("hit2")
11 | <* else *>
12 | println("not hit")
13 | <* end *>
14 |
15 | println("end CompCon3")
16 | end CompCon3
17 |
--------------------------------------------------------------------------------
/testcases/ObxTests/Consts1.obx:
--------------------------------------------------------------------------------
1 | module Consts1
2 |
3 | const
4 | a = "abcd" + "efgh"
5 | b = 061x + 062x
6 | c = "これは日本語です。" + "cdef " + 20b9x
7 | d = 20b9x
8 | e = 1234i
9 | f = 4567l
10 | g = 0ffhl
11 | h = -20
12 | i = max(integer)+1l
13 | begin
14 | println(a)
15 | println(b)
16 | println(c)
17 | println(d)
18 | println(max(integer))
19 | println(max(integer)+1l)
20 | println(long(max(integer))+1)
21 | println(i)
22 | println(max(longint))
23 | println(h)
24 | println(-20)
25 | println(i)
26 | end Consts1
27 |
--------------------------------------------------------------------------------
/testcases/ObxTests/Enum1.obx:
--------------------------------------------------------------------------------
1 | module Enum1
2 |
3 | import I := Imported1b
4 |
5 | type
6 | T = ( A, B, C D E )
7 | var
8 | t : T
9 |
10 | begin
11 | println("Enum1 start")
12 | //println(I.C)
13 | t := B
14 | println(t)
15 | println(I.blue)
16 | println("upwards:")
17 | for t := A to E do
18 | println(t)
19 | end
20 | println("downwards:")
21 | for t := D to B do
22 | println(t)
23 | end
24 | println("inc dec:")
25 | t := B
26 | // t := I.blue gives an error as expected
27 | inc(t)
28 | println( t )
29 | t := D
30 | dec(t)
31 | println( t )
32 | println( max(T) )
33 | println( min(T) )
34 | println("Enum1 done")
35 | end Enum1
36 |
--------------------------------------------------------------------------------
/testcases/ObxTests/Enum2.obx:
--------------------------------------------------------------------------------
1 | module Enum2
2 |
3 | type
4 | T = ( A, B, C D E )
5 | T2 = ( G, H, I )
6 | var
7 | t : T
8 |
9 | begin
10 | println("start Enum2")
11 | t := C
12 |
13 | case t of
14 | | A: println("A")
15 | | B..C: println("B")
16 | | D: println("D")
17 | else
18 | println("case else")
19 | end
20 |
21 | if t = A then println("A")
22 | elsif t = B then println("B")
23 | elsif t = C then println("C")
24 | else
25 | println("nop")
26 | end
27 | println("end Enum2")
28 | end Enum2
29 |
--------------------------------------------------------------------------------
/testcases/ObxTests/Fibonacci.obx:
--------------------------------------------------------------------------------
1 | module Fibonacci
2 |
3 | proc calc( n : integer ): integer
4 | var a,b: integer
5 | begin
6 | if n > 1 then
7 | a := calc( n - 1 )
8 | b := calc( n - 2 )
9 | return ( a + b )
10 | elsif n = 0 then
11 | return 0
12 | else
13 | return 1
14 | end
15 | end calc
16 |
17 | var res: integer
18 | begin
19 | res := calc(21)
20 | assert( res = 10946 )
21 | println("Fibonacci done")
22 | end Fibonacci
23 |
--------------------------------------------------------------------------------
/testcases/ObxTests/FloatingPoint1.obx:
--------------------------------------------------------------------------------
1 | module FloatingPoint1
2 |
3 | import M := MathL
4 |
5 | begin
6 |
7 | println(M.pi)
8 | println(M.pi/M.e)
9 | println(short(M.pi))
10 | println(short(M.pi)/short(M.e))
11 | println(M.sqrt(M.pi))
12 |
13 | end FloatingPoint1
14 |
--------------------------------------------------------------------------------
/testcases/ObxTests/Flow.obx:
--------------------------------------------------------------------------------
1 | module Flow
2 | var i : integer
3 | begin
4 | println("Flow start")
5 | i := 1
6 | if i = 1 then
7 | println("a")
8 | elsif i = 2 then
9 | println("b")
10 | else
11 | println("c")
12 | end
13 | println("Flow done")
14 | end Flow
15 |
--------------------------------------------------------------------------------
/testcases/ObxTests/Generic1.obx:
--------------------------------------------------------------------------------
1 | module Generic1(T)
2 |
3 | type
4 | List* = pointer to record
5 | value* : T
6 | next* : List
7 | end
8 | end Generic1
9 |
--------------------------------------------------------------------------------
/testcases/ObxTests/Generic2.obx:
--------------------------------------------------------------------------------
1 | module Generic2(T)
2 |
3 | type
4 | List* = pointer to record
5 | value* : T
6 | next* : List
7 | end
8 |
9 | proc ( this: List ) Print*()
10 | begin
11 | println(this.value)
12 | end Print
13 |
14 | end Generic2
15 |
--------------------------------------------------------------------------------
/testcases/ObxTests/Generic3.obx:
--------------------------------------------------------------------------------
1 | module Generic3(T)
2 |
3 | type
4 | Element = record
5 | value* : T
6 | end
7 | // illegal: Element2 = record(T) end
8 |
9 | List* = pointer to record (Element)
10 | next* : List
11 | end
12 |
13 | Printer = proc( in elem: T );
14 |
15 | var test : integer
16 |
17 | proc (in this: Element) print*(p: Printer)
18 | begin
19 | p(this.value)
20 | end print
21 |
22 | proc (var this: Element) setValue*( in v: T )
23 | begin
24 | this.value := v
25 | test := 3
26 | end setValue
27 |
28 | end Generic3
29 |
--------------------------------------------------------------------------------
/testcases/ObxTests/Generic4.obx:
--------------------------------------------------------------------------------
1 | module Generic4(T)
2 |
3 | type
4 | Element = record
5 | value* : T
6 | end
7 |
8 | List* = pointer to record (Element)
9 | next* : List
10 | end
11 |
12 | proc (in this: Element) print*()
13 | begin
14 | println(this.value)
15 | end print
16 |
17 | proc (var this: Element) setValue*( in v: T )
18 | begin
19 | this.value := v
20 | end setValue
21 |
22 | end Generic4
23 |
--------------------------------------------------------------------------------
/testcases/ObxTests/Generic5.obx:
--------------------------------------------------------------------------------
1 | module Generic5 (T: Super; const l: integer)
2 |
3 | const i* = l
4 |
5 | type Super* = record end
6 |
7 | proc (var this: Super) hello*()
8 | begin
9 | end hello
10 |
11 | type
12 | List* = pointer to record
13 | value* : T
14 | next* : List
15 | end
16 |
17 | proc (this: List) iterate*()
18 | begin
19 | this.value.hello()
20 | if this.next # nil then this.next.iterate() end
21 | end iterate
22 |
23 | end Generic5
--------------------------------------------------------------------------------
/testcases/ObxTests/Generic6.obx:
--------------------------------------------------------------------------------
1 | module Generic6(T; const eq: EQ)
2 |
3 | type EQ* = proc(in lhs,rhs: T):boolean;
4 |
5 | List* = pointer to record
6 | value* : T
7 | next* : List
8 | end
9 |
10 | proc (this: List)contains*(in what: T):boolean
11 | var res: boolean
12 | begin
13 | if eq(this.value,what) then res := true end
14 | if ~res & (this.next # nil) then res := this.next.contains(what) end
15 | return res
16 | end contains
17 |
18 | end Generic6
19 |
--------------------------------------------------------------------------------
/testcases/ObxTests/Generic7.obx:
--------------------------------------------------------------------------------
1 | module Generic7(T; const eq: EQ)
2 |
3 | import G := Generic6(T,eq)
4 |
5 | type EQ* = proc(in lhs,rhs: T):boolean;
6 |
7 | type List* = G.List
8 |
9 | end Generic7
10 |
--------------------------------------------------------------------------------
/testcases/ObxTests/GenericTest1.obx:
--------------------------------------------------------------------------------
1 | module GenericTest1
2 |
3 | import IL := Generic1(integer)
4 |
5 | var
6 | IntList : IL.List
7 |
8 | begin
9 | println("GenericTest1 start")
10 | new(IntList)
11 | IntList.value := 33
12 | println(IntList.value)
13 | println("GenericTest1 done")
14 | end GenericTest1
15 |
--------------------------------------------------------------------------------
/testcases/ObxTests/GenericTest2.obx:
--------------------------------------------------------------------------------
1 | module GenericTest2
2 |
3 | import
4 | SL := Generic1(String)
5 |
6 |
7 | type
8 | String = array 20 of char
9 |
10 | var
11 | l1 : SL.List
12 |
13 | begin
14 | println("GenericTest2 start")
15 | new(l1)
16 | l1.value := "hello!"
17 | println(l1.value)
18 | println("GenericTest2 done")
19 | end GenericTest2
20 |
--------------------------------------------------------------------------------
/testcases/ObxTests/GenericTest3.obx:
--------------------------------------------------------------------------------
1 | module GenericTest3
2 |
3 | import
4 | SL := Generic1(String),
5 | IL := Generic1(integer)
6 |
7 |
8 | type
9 | String = array 20 of char
10 |
11 | var
12 | l1 : SL.List
13 | l2 : IL.List
14 |
15 | begin
16 | println("GenericTest3 start")
17 | new(l1)
18 | l1.value := "hello!" // with dotnet generics this fails because value is initialized to null
19 | println(l1.value)
20 | new(l2)
21 | l2.value := 44
22 | println(l2.value)
23 | println("GenericTest3 done")
24 | end GenericTest3
25 |
--------------------------------------------------------------------------------
/testcases/ObxTests/GenericTest3.obxpro:
--------------------------------------------------------------------------------
1 | [General]
2 | BuildDir=
3 | BuiltInOakwood=false
4 | BuiltInObSysInner=false
5 | IntegerIsInt16=false
6 | MainModule=@ByteArray()
7 | MainProc=@ByteArray()
8 | Options=@ByteArray()
9 | Suffixes=@Invalid()
10 | WorkingDir=
11 |
12 | [.]
13 | size=0
14 |
15 | [Modules]
16 | 1\AbsPath=/home/me/Entwicklung/Modules/Oberon/testcases/ObxTests/Generic6.obx
17 | 1\RelPath=Generic6.obx
18 | 2\AbsPath=/home/me/Entwicklung/Modules/Oberon/testcases/ObxTests/Generic7.obx
19 | 2\RelPath=Generic7.obx
20 | 3\AbsPath=/home/me/Entwicklung/Modules/Oberon/testcases/ObxTests/GenericTest8.obx
21 | 3\RelPath=GenericTest8.obx
22 | size=3
23 |
24 | [Packages]
25 | 1\Name=@ByteArray()
26 | 2\Name=@ByteArray()
27 | size=2
28 |
--------------------------------------------------------------------------------
/testcases/ObxTests/GenericTest4.obx:
--------------------------------------------------------------------------------
1 | module GenericTest4
2 |
3 | import
4 | SL := Generic2(String)
5 |
6 |
7 | type
8 | String = array 20 of char
9 |
10 | var
11 | l1 : SL.List
12 |
13 | begin
14 | println("GenericTest4 start")
15 | new(l1)
16 | l1.value := "hello!"
17 | l1.Print()
18 | println("GenericTest4 done")
19 | end GenericTest4
20 |
--------------------------------------------------------------------------------
/testcases/ObxTests/GenericTest5.obx:
--------------------------------------------------------------------------------
1 | module GenericTest5
2 |
3 | import
4 | IL := Generic4(integer),
5 | SL := Generic4(String)
6 |
7 | var
8 | IntList : IL.List
9 |
10 | const
11 | StrLen = 20
12 |
13 | type
14 | String = array StrLen of char
15 |
16 | var
17 | StrList : SL.List
18 |
19 | begin
20 | println("GenericTest5 start")
21 | new(IntList)
22 | IntList.setValue( long(long(55)) )
23 | IntList.print()
24 | new(StrList)
25 | StrList.setValue( "tata!" )
26 | StrList.print()
27 | println("GenericTest5 done")
28 | end GenericTest5
29 |
--------------------------------------------------------------------------------
/testcases/ObxTests/GenericTest6.obx:
--------------------------------------------------------------------------------
1 | module GenericTest6
2 |
3 | import
4 | RL := Generic3(R)
5 |
6 | type
7 | R = record
8 | name: array 32 of char
9 | age: integer
10 | end
11 |
12 |
13 | var
14 | l : RL.List
15 | r : R
16 |
17 | proc print( in elem: R )
18 | begin
19 | println(elem.name)
20 | println(elem.age)
21 | end print
22 | begin
23 | new(l)
24 | r.name := "So long"
25 | r.age := 52
26 | l.setValue( r )
27 | println(l.value.name)
28 | println(l.value.age)
29 | l.print(print)
30 | println("GenericTest6 done")
31 | end GenericTest6
32 |
--------------------------------------------------------------------------------
/testcases/ObxTests/GenericTest7.obx:
--------------------------------------------------------------------------------
1 | module GenericTest7
2 |
3 | import G := Generic5(Sub,33)
4 |
5 | type
6 | Sub = record(G.Super) i: integer end
7 |
8 | proc (var this: Sub) hello*()
9 | begin
10 | println(this.i)
11 | end hello
12 |
13 | var
14 | l: G.List
15 |
16 | begin
17 | println("Begin GenericTest7")
18 | new(l)
19 | l.value.i := G.i
20 | new(l.next)
21 | l.next.value.i := 44
22 | new(l.next.next)
23 | l.next.next.value.i := 55
24 | l.iterate()
25 | println("End GenericTest7")
26 | end GenericTest7
--------------------------------------------------------------------------------
/testcases/ObxTests/GenericTest8.obx:
--------------------------------------------------------------------------------
1 | module GenericTest8
2 | import H := Generic7(integer,eq)
3 |
4 | type
5 | proc eq(in lhs,rhs: integer):boolean
6 | begin
7 | return lhs = rhs
8 | end eq
9 |
10 | var
11 | l: H.List
12 | i: integer
13 | begin
14 | println("Begin GenericTest8")
15 | new(l)
16 | l.value := 33
17 | new(l.next)
18 | l.next.value := 44
19 | new(l.next.next)
20 | l.next.next.value := 55
21 | i := 44
22 | if l.contains(i) then println(i) end
23 | println("End GenericTest8")
24 | end GenericTest8
25 |
--------------------------------------------------------------------------------
/testcases/ObxTests/GenericTest9.obx:
--------------------------------------------------------------------------------
1 | module GenericTest9
2 |
3 | import
4 | L := Generic6(integer,eq1)
5 | H := Generic7(L.List,eq2)
6 |
7 | type
8 | proc eq1(in lhs,rhs: integer):boolean
9 | begin
10 | return lhs = rhs
11 | end eq1
12 |
13 | proc eq2(in lhs,rhs: L.List):boolean
14 | begin
15 | return false;
16 | end eq2
17 | var
18 | l: H.List
19 | i: L.List
20 | begin
21 | println("Begin GenericTest9")
22 | new(l)
23 | //l.value := 33
24 | new(l.next)
25 | //l.next.value := 44
26 | new(l.next.next)
27 | //l.next.next.value := 55
28 | new(i)
29 | if l.contains(i) then println(i) end
30 | println("End GenericTest9")
31 | end GenericTest9
32 |
--------------------------------------------------------------------------------
/testcases/ObxTests/Hello.obx:
--------------------------------------------------------------------------------
1 | module Hello
2 | const
3 | str1 = "これは日本語です。"
4 | str2 = "Isto é português"
5 | var
6 | tmp : array 32 of wchar
7 | tmp2 : array 32 of char
8 |
9 | proc Str( in str: array of wchar )
10 | begin
11 | println(str)
12 | end Str
13 | begin
14 | print("Hello")print(" ")println("start")
15 | println("Ölförderung für Äthiopien")
16 | Str("美丽的世界,你好!") // 这就是中国人
17 | tmp := str1
18 | println(tmp)
19 | tmp := str2
20 | println(tmp)
21 | tmp2 := str2
22 | println(tmp2)
23 | tmp2 := "Parlons aux Français"
24 | println(tmp2)
25 | println("alpha" + "beta" + "gamma")
26 | tmp := "**and**"
27 | println("moin " + str1 + " " + str2 + " " + tmp + " " + "welcome 你好!")
28 | println("Hello done")
29 | end Hello
--------------------------------------------------------------------------------
/testcases/ObxTests/Hello.obxpro:
--------------------------------------------------------------------------------
1 | [General]
2 | BuildDir=
3 | BuiltInOakwood=false
4 | BuiltInObSysInner=false
5 | IntegerIsInt16=false
6 | MainModule=@ByteArray()
7 | MainProc=@ByteArray()
8 | Options=@ByteArray()
9 | Suffixes=@Invalid()
10 | WorkingDir=
11 |
12 | [Modules]
13 | 1\AbsPath=/home/me/Entwicklung/Modules/Oberon/testcases/ObxTests/Hello.obx
14 | 1\RelPath=Hello.obx
15 | size=1
16 |
17 | [Packages]
18 | 1\Name=@ByteArray()
19 | size=1
20 |
--------------------------------------------------------------------------------
/testcases/ObxTests/Import1.obx:
--------------------------------------------------------------------------------
1 | module Import1
2 |
3 | import i1 := Imported1a
4 |
5 | type
6 | T1 = T
7 | T = record end
8 |
9 | var t : i1.T1
10 | t1 : T1
11 | begin
12 | println("Import1 start")
13 | i1.Do
14 | println("Import1 done")
15 | end Import1
16 |
--------------------------------------------------------------------------------
/testcases/ObxTests/Import2.obx:
--------------------------------------------------------------------------------
1 | module Import2
2 |
3 | import I := Imported2a
4 |
5 | var
6 | r : I.T
7 | p : I.P
8 |
9 | begin
10 | println("Import2 start")
11 |
12 | r.f := 33
13 | println(r.f)
14 |
15 | new(p)
16 | p.f := 44
17 | println(p.f)
18 |
19 | println("Import2 done")
20 | end Import2
21 |
--------------------------------------------------------------------------------
/testcases/ObxTests/Imported1a.obx:
--------------------------------------------------------------------------------
1 | module Imported1a
2 | import i2 := Imported1b
3 |
4 | type T* = record (i2.T1) end
5 | T1* = T
6 | proc Do*
7 | begin
8 | println("do")
9 | i2.It
10 | end Do
11 |
12 | begin
13 | println("Imported1a")
14 | end Imported1a
15 |
--------------------------------------------------------------------------------
/testcases/ObxTests/Imported1b.obx:
--------------------------------------------------------------------------------
1 | module Imported1b
2 | const
3 | C* = 123
4 | type T = record end
5 | T1* = T
6 | Color* = (red, green, blue)
7 | proc It*
8 | begin
9 | println("it")
10 | end It
11 | begin
12 | println("Imported1b")
13 | end Imported1b
14 |
--------------------------------------------------------------------------------
/testcases/ObxTests/Imported2a.obx:
--------------------------------------------------------------------------------
1 | module Imported2a
2 |
3 | import I := Imported2b
4 |
5 | type
6 | T* = I.R
7 | P* = pointer to I.T
8 | var
9 | p: P
10 |
11 | begin
12 | new(p)
13 |
14 | end Imported2a
15 |
--------------------------------------------------------------------------------
/testcases/ObxTests/Imported2b.obx:
--------------------------------------------------------------------------------
1 | module Imported2b
2 |
3 | type
4 | R* = record
5 | f* : integer
6 | end
7 | T* = R
8 |
9 | end Imported2b
10 |
--------------------------------------------------------------------------------
/testcases/ObxTests/Load1.obx:
--------------------------------------------------------------------------------
1 | module Load1
2 |
3 | var
4 | p : proc
5 | begin
6 | println("begin Load1")
7 | if LDMOD("Imported1a") then
8 | p := LDCMD("Imported1a","Do")
9 | if p # nil then
10 | p
11 | end
12 | end
13 | println("end Load1")
14 | end Load1
15 |
--------------------------------------------------------------------------------
/testcases/ObxTests/LogOps1.obx:
--------------------------------------------------------------------------------
1 | module LogOps1
2 |
3 | var
4 | b: longint
5 | c: integer
6 | begin
7 | b := bitshl(1234l,32)
8 | println(b)
9 | c := 1234
10 | println(bitor(b,c))
11 | b := bitshl(0ffh,16)
12 | println(b)
13 | b := bitshr(b,8)
14 | println(b)
15 | println(asr(1024,4))
16 | println(asr(-1024,4))
17 | println(asr(-1024,-4))
18 | println(lsl(100,2))
19 | end LogOps1
20 |
--------------------------------------------------------------------------------
/testcases/ObxTests/LogOps2.obx:
--------------------------------------------------------------------------------
1 | module LogOps2
2 |
3 | begin
4 | println("begin LogOps2")
5 | // source hostess-tests HOTBuiltinASH1.Ref
6 |
7 | assert(ASH(4,-1)=2)
8 | assert(ASH(2,-1)=1)
9 | assert(ASH(1,-1)=0)
10 |
11 | assert(ASH(3,-1)=1)
12 | assert(ASH(1,-1)=0)
13 | assert(ASH(0,-1)=0)
14 |
15 | assert(ASH(0,-1)=0)
16 |
17 | assert(ASH(-3,-1)=-2)
18 | assert(ASH(-2,-1)=-1)
19 | assert(ASH(-1,-1)=-1)
20 |
21 | assert(ASH(-2,1)=-4)
22 | assert(ASH(-4,1)=-8)
23 |
24 | assert(ASH(0,1)=0)
25 |
26 | assert(ASH(1,1)=2)
27 |
28 | assert(ASH(-3,-2)=-1)
29 | assert(ASH(-1,-2)=-1)
30 |
31 | assert(ASH(5,-2)=1)
32 | assert(ASH(1,-2)=0)
33 |
34 | assert(ASH(3,0)=3)
35 |
36 | assert(ASH(-3,0)=-3)
37 |
38 | println("end LogOps2")
39 | end LogOps2
40 |
--------------------------------------------------------------------------------
/testcases/ObxTests/LogOps3.obx:
--------------------------------------------------------------------------------
1 | module LogOps3
2 |
3 |
4 | const
5 | KMOD_CTRL = bitor(KMOD_LCTRL, KMOD_RCTRL)
6 |
7 | const
8 | KMOD_LCTRL = 64
9 | KMOD_RCTRL = 128
10 |
11 | end LogOps3
12 |
--------------------------------------------------------------------------------
/testcases/ObxTests/Loops.obx:
--------------------------------------------------------------------------------
1 | module Loops
2 | var i : integer
3 | begin
4 | println("Loops start")
5 | i := 3
6 | while i < 10 do
7 | println(i)
8 | i := i + 1
9 | elsif i = 11 do
10 | println("elsif")
11 | end
12 |
13 | i := 1
14 | repeat
15 | println(i)
16 | i := i + 1
17 | until i >= 10
18 |
19 | i := 0
20 | loop
21 | println(i)
22 | i := i + 1
23 | if i >= 5 then
24 | exit
25 | end
26 | end
27 |
28 | for
29 | i := 1
30 | to 10
31 | by 2
32 | do
33 | println(i)
34 | end
35 |
36 | for
37 | i := 10
38 | to 0
39 | by -3
40 | do
41 | println(i)
42 | end
43 |
44 | println("Loops done")
45 | end Loops
--------------------------------------------------------------------------------
/testcases/ObxTests/Loops2.obx:
--------------------------------------------------------------------------------
1 | module Loops2
2 | var n, n1: integer
3 | begin
4 | println("Loops2 start")
5 | n := 4;
6 | n1 := 6;
7 | WHILE n > n1 DO
8 | println("while")
9 | n := n - n1
10 | println(n)
11 | ELSIF n1 > n DO
12 | println("elsif")
13 | n1 := n1 - n
14 | println(n1)
15 | END;
16 | ASSERT(n = 2);
17 | ASSERT(n1 = 2);
18 | n := 5;
19 | n1 := 6;
20 | WHILE n > n1 DO
21 | n := n - n1
22 | ELSIF n1 > n DO
23 | n1 := n1 - n
24 | END;
25 | ASSERT(n = 1);
26 | ASSERT(n1 = 1);
27 | println("Loops2 done")
28 | end Loops2
29 |
--------------------------------------------------------------------------------
/testcases/ObxTests/Minimal.obx:
--------------------------------------------------------------------------------
1 | module Minimal
2 |
3 | begin
4 | println("Minimal start")
5 | println("Hello" + " World!")
6 |
7 | assert(FLOOR(123.45)=ENTIER(123.45))
8 |
9 | println("Minimal done")
10 | end Minimal
11 |
--------------------------------------------------------------------------------
/testcases/ObxTests/Minimal2.obx:
--------------------------------------------------------------------------------
1 | module Minimal2
2 |
3 | proc doit( in str: array of char )
4 | proc inner( a,b: integer )
5 | begin
6 | println( a * b DIV 3 )
7 | end inner
8 | var str2: array 53 of char
9 | begin
10 | //trap()
11 | inner( 44, 55 )
12 | str2 := str
13 | println(str2)
14 | end doit
15 |
16 | begin
17 | println("Minimal start")
18 | doit("Hello" + " World!")
19 | println("Minimal done")
20 | end Minimal2
21 |
--------------------------------------------------------------------------------
/testcases/ObxTests/NestedLoops.obx:
--------------------------------------------------------------------------------
1 | module NestedLoops
2 |
3 | var
4 | begin
5 | println("start")
6 | loop
7 | println("1.0.0")
8 | loop
9 | println("1.1.0")
10 | exit
11 | println("nop")
12 | end
13 | println("2.0.0")
14 |
15 |
16 | loop
17 | println("2.1.0")
18 | loop
19 | println("2.1.1")
20 | exit
21 | println("noop")
22 | end
23 | println("2.2.0")
24 | exit
25 | println("nops")
26 | end
27 | println("3.0.0")
28 |
29 | exit
30 | println("this is not printed")
31 | end
32 | println("end")
33 | end NestedLoops
34 |
--------------------------------------------------------------------------------
/testcases/ObxTests/Oakwood.obxpro:
--------------------------------------------------------------------------------
1 | [General]
2 | BuildDir=/home/me/Entwicklung/Modules/build-ObxIde2-Qt_5_4_2-Debug/build
3 | BuiltInOakwood=true
4 | BuiltInObSysInner=false
5 | MainModule=@ByteArray()
6 | MainProc=@ByteArray()
7 | Suffixes=@Invalid()
8 | WorkingDir=
9 |
10 | [.]
11 | size=0
12 |
13 | [Modules]
14 | 1\AbsPath=/home/me/Entwicklung/Modules/Oberon/testcases/ObxTests/Oakwood3.obx
15 | 1\RelPath=Oakwood3.obx
16 | 2\AbsPath=/home/me/Entwicklung/Modules/Oberon/testcases/ObxTests/Oakwood2.obx
17 | 2\RelPath=Oakwood2.obx
18 | 3\AbsPath=/home/me/Entwicklung/Modules/Oberon/testcases/ObxTests/Oakwood1.obx
19 | 3\RelPath=Oakwood1.obx
20 | 4\AbsPath=/home/me/Entwicklung/Modules/Oberon/testcases/ObxTests/Oakwood5.obx
21 | 4\RelPath=Oakwood5.obx
22 | 5\AbsPath=/home/me/Entwicklung/Modules/Oberon/testcases/ObxTests/Oakwood5.obx
23 | 5\RelPath=Oakwood5.obx
24 | size=4
25 |
26 | [Packages]
27 | 1\Name=@ByteArray()
28 | 2\Name=@ByteArray()
29 | size=2
30 |
--------------------------------------------------------------------------------
/testcases/ObxTests/Oakwood1.obx:
--------------------------------------------------------------------------------
1 | module Oakwood1
2 |
3 | import P := XYplane, I := Input, Out
4 |
5 | var
6 | ch : char
7 | start, i, x, y, oldx, oldy : integer
8 | keys: set
9 | begin
10 | start := I.Time()
11 | P.Open
12 | // I.SetMouseLimits(640,480)
13 | for i := 0 to P.H-1 do P.Dot(P.H-1-i,i,1) end
14 | i := 0
15 | loop
16 | P.Dot(i,i,1)
17 | inc(i)
18 | //ch := P.Key()
19 | I.Read(ch)
20 | if ch # 0x then Out.String("pressed: ") Out.Char(ch) Out.Ln end
21 | I.Mouse(keys,x,y)
22 | if (x # oldx) or (y # oldy) then
23 | Out.String("mouse: ") Out.Int(x,0) Out.String(" ") Out.Int(y,0) Out.Ln
24 | oldx := x
25 | oldy := y
26 | end
27 | if (I.Time() - start) > 10000000 then exit end
28 | end
29 | end Oakwood1
30 |
--------------------------------------------------------------------------------
/testcases/ObxTests/Oakwood2.obx:
--------------------------------------------------------------------------------
1 | module Oakwood2
2 | import Strings
3 |
4 | var
5 | s1,s2,s3: array 64 of char
6 | i: integer
7 | begin
8 | println("begin Oakwood2")
9 | s1 := "123456789"
10 | assert(Strings.Length(s1)=9)
11 |
12 | s2 := "abcdef"
13 | Strings.Insert(s2,3,s1)
14 | assert(s1="123abcdef456789")
15 |
16 | s3 := "9876"
17 | Strings.Append(s3,s2)
18 | assert(s2="abcdef9876")
19 |
20 | Strings.Delete(s1,6,6)
21 | assert(s1="123abc789")
22 |
23 | Strings.Replace("hik",3,s2)
24 | assert(s2="abchik9876")
25 |
26 | Strings.Extract(s1,6,4,s2)
27 | assert(s2="789")
28 |
29 | Strings.Cap(s1)
30 | assert(s1="123ABC789")
31 |
32 | i := Strings.Pos("C7", s1, 0)
33 | assert(i=5)
34 |
35 | println("done Oakwood2")
36 | end Oakwood2
37 |
--------------------------------------------------------------------------------
/testcases/ObxTests/Oakwood3.obx:
--------------------------------------------------------------------------------
1 | module Oakwood3
2 |
3 | import F := Files
4 |
5 | var
6 | f : F.File
7 | r : F.Rider
8 | res : integer
9 | res2 : real
10 | res3 : longint
11 | res4 : longreal
12 | str : array 32 of char
13 | begin
14 | println("begin Oakwood3")
15 | f := F.New("obx_test_file")
16 | F.Set(r,f,0)
17 | F.WriteInt(r,33)
18 | F.WriteInt(r,44)
19 | F.WriteLInt(r,55)
20 | F.WriteReal(r,123.45)
21 | F.WriteLReal(r,234.56)
22 | F.WriteString(r,"hello world")
23 | F.Register(f)
24 | F.Close(f)
25 |
26 | F.Rename("obx_test_file", "obx_test_file2", res)
27 | assert(res = 0)
28 |
29 | f := F.Old("obx_test_file2")
30 | F.Set(r,f,0)
31 | F.ReadInt(r,res)
32 | assert(res=33)
33 | F.ReadInt(r,res)
34 | assert(res=44)
35 | F.ReadLInt(r,res3)
36 | assert(res3=55)
37 | F.ReadReal(r,res2)
38 | println(res2) // prints 123.449996948242; why?
39 | assert(res2-123.45<0.001)
40 | F.ReadLReal(r,res4)
41 | assert(res4-234.56<0.00000001)
42 | F.ReadString(r,str)
43 | assert(str="hello world")
44 | F.Delete("obx_test_file2",res)
45 | assert(res=0)
46 | f := F.Old("obx_test_file2")
47 | assert(f=nil)
48 | println("end Oakwood3")
49 | end Oakwood3
50 |
--------------------------------------------------------------------------------
/testcases/ObxTests/Oakwood4.obx:
--------------------------------------------------------------------------------
1 | module Oakwood4
2 |
3 | import In
4 |
5 | var
6 | ch: char
7 | i: integer
8 | f: real
9 | s: array 32 of char
10 | begin
11 | println("begin Oakwood4")
12 | In.Char(ch)
13 | assert(ch="a")
14 | In.Char(ch)
15 | assert(ch="A")
16 | //In.Name(s)
17 | //assert(s="aA")
18 | In.Int(i)
19 | assert(i=0abcdh)
20 | In.Int(i)
21 | assert(i=-12345)
22 | In.Real(f)
23 | //assert(f=123.45)
24 | In.Real(f)
25 | assert(f=-1.234e3)
26 | In.String(s)
27 | assert(s="this is a string")
28 | In.Name(s)
29 | assert(s="Hello")
30 | In.Name(s)
31 | assert(s="World")
32 | assert(In.Done)
33 |
34 | println("end Oakwood4")
35 | end Oakwood4
36 |
--------------------------------------------------------------------------------
/testcases/ObxTests/Oakwood5.obx:
--------------------------------------------------------------------------------
1 | module Oakwood5
2 |
3 | import Math, MathL
4 |
5 | var
6 | l: longint
7 | begin
8 | println("begin Oakwood5")
9 |
10 | println( Math.power(3,2) )
11 | println( MathL.power(3,2) )
12 |
13 | println( odd(123) )
14 | println( odd(123456l) )
15 | l := 43
16 | println( odd(l) )
17 |
18 | println("end Oakwood5")
19 | end Oakwood5
20 |
--------------------------------------------------------------------------------
/testcases/ObxTests/Overflow1.obx:
--------------------------------------------------------------------------------
1 | module Overflow1
2 |
3 | var
4 | i: integer
5 | s: shortint
6 | b: byte
7 | begin
8 | s := max(shortint)
9 | i := s+1 // throws overflow exception if debugging enabled
10 | println(i)
11 | i := 0ffffffffh
12 | println(i)
13 | b := -1
14 | println(b)
15 | s := 0ffffh
16 | println(s)
17 | end Overflow1
18 |
--------------------------------------------------------------------------------
/testcases/ObxTests/OverflowTest.obx:
--------------------------------------------------------------------------------
1 | module Test
2 |
3 | const
4 | pinsize = 10; offset = 2;
5 | TimeUnit = 1000;
6 | Sleep = 100;
7 |
8 | var i: int16
9 | t: int32
10 |
11 | proc time(): int32
12 | return 123456
13 | end time
14 |
15 | begin
16 |
17 | //i := -pinsize + 1 - offset
18 | //println(i)
19 |
20 | //t := 500I * TimeUnit DIV 1000; // 500 * TimeUnit is 500000 which is too big for INT16
21 | //println(t)
22 |
23 | t := time() + Sleep * TimeUnit DIV 1000I
24 | println(t)
25 |
26 | end Test
27 |
--------------------------------------------------------------------------------
/testcases/ObxTests/Pcall1.obx:
--------------------------------------------------------------------------------
1 | module Pcall1
2 |
3 | type Ex = record end
4 |
5 | proc Hello()
6 | var e:^Ex
7 | begin
8 | println("Hello")
9 | new(e)
10 | raise(e)
11 | println("this shall not be printed")
12 | end Hello
13 |
14 | proc Hello2(IN str: array of char)
15 | begin
16 | println(str)
17 | raise()
18 | end Hello2
19 |
20 | proc Test(): ^anyrec return nil
21 | end
22 |
23 | var
24 | test: integer
25 | res: ^anyrec
26 | test2: ^Ex
27 | h: proc
28 | h2: proc(IN str: array of char)
29 | begin
30 | pcall(res,Hello)
31 | with res: Ex do println("exception has occured")
32 | else
33 | if res = nil then println("all good")
34 | else println("unknown exception")
35 | end
36 | end
37 |
38 | //new(test2)
39 | //raise(test2)
40 | //raise()
41 |
42 | pcall(res, Hello2, "gugus")
43 | h := Hello
44 | pcall(res,h)
45 | h2 := Hello2
46 | pcall(res, h2, "asdf")
47 | case res of
48 | | Ex: println("Ex exception")
49 | | anyrec: println("anyrec exception")
50 | | nil: println("no exception")
51 | else
52 | println("unknown exception")
53 | end
54 | end Pcall1
55 |
--------------------------------------------------------------------------------
/testcases/ObxTests/Pcall2.obx:
--------------------------------------------------------------------------------
1 | module Pcall2
2 |
3 | proc Sub()
4 | type Exception = record end
5 |
6 | proc Print(IN str: array of char)
7 | var e: pointer to Exception
8 | begin
9 | i := 33
10 | println(str)
11 | new(e)
12 | raise(e)
13 | println("this should not be printed")
14 | end Print
15 |
16 | var
17 | res: pointer to anyrec
18 | i: integer
19 |
20 | begin
21 | i := 22
22 | pcall(res, Print, "Hello World")
23 | case res of
24 | | Exception: println("got Exception")
25 | | anyrec: println("got anyrec")
26 | | nil: println("all ok")
27 | else
28 | println("unknown exception")
29 | end
30 | println(i) // CLR prints 33, C prints 22
31 | end Sub
32 |
33 | begin
34 |
35 | Sub();
36 |
37 | end Pcall2
38 |
--------------------------------------------------------------------------------
/testcases/ObxTests/Proc10.obx:
--------------------------------------------------------------------------------
1 | module Procs10
2 |
3 | type
4 | A = pointer to record a: integer end
5 | B = record b: integer end
6 |
7 | proc (this: A) test( v: B )
8 | begin
9 | assert(this.a = 33)
10 | assert(v.b = 44)
11 | println(this.a)
12 | println(v.b)
13 | end test
14 |
15 | proc (this: A) test2( var v: B )
16 | begin
17 | v.b := 55
18 | end test2
19 |
20 | proc (this: A) test3( var v: B): integer
21 | begin
22 | v.b := 66
23 | return 77
24 | end test3
25 |
26 | var a: A
27 | b: B
28 | begin
29 | println("Procs10 start")
30 | new(a)
31 | a.a := 33
32 |
33 | b.b := 44
34 | a.test(b)
35 |
36 | a.test2(b)
37 | assert(b.b = 55)
38 | assert( a.test3(b) = 77 )
39 | assert( b.b = 66 )
40 |
41 | println("Procs10 done")
42 | end Procs10
43 |
--------------------------------------------------------------------------------
/testcases/ObxTests/Proc11.obx:
--------------------------------------------------------------------------------
1 | module Proc11
2 |
3 | PROCEDURE Asdf (OUT, s:SET);
4 | BEGIN
5 | END Asdf;
6 |
7 |
8 | end Proc11
9 |
--------------------------------------------------------------------------------
/testcases/ObxTests/ProcType1.obx:
--------------------------------------------------------------------------------
1 | module ProcType1
2 |
3 | var p : proc (in str: array of char)
4 | m, n : proc (^)(in str: array of char)
5 |
6 |
7 | proc outer()
8 | proc inner(in str: array of char)
9 | begin
10 | println("hello from inner:")
11 | println(str)
12 | end inner
13 | type T = record end
14 | proc (var this: T)sayHello(in str: array of char)
15 | begin
16 | println("hello from method:")
17 | println(str)
18 | end sayHello
19 | var t1: T
20 | t2: pointer to T
21 | begin
22 | p := inner
23 | t1.sayHello("0000")
24 | //m := t1.sayHello // t1 can go out of scope, illegal
25 | new(t2)
26 | m := t2.sayHello // t2 remains valid even if outer ends, legal
27 | // m := inner // illegal
28 | // p := t2.sayHello // illegal
29 | end outer
30 |
31 | begin
32 | println("ProcType1 start")
33 | outer()
34 | p("1234")
35 | m("5679")
36 | n := m
37 | n("abcd")
38 |
39 | println("ProcType1 done")
40 | end ProcType1
41 |
--------------------------------------------------------------------------------
/testcases/ObxTests/ProcType2.obx:
--------------------------------------------------------------------------------
1 | module ProcType2
2 |
3 | type T = record end
4 | proc (var this: T)sayHello(in str: array of char)
5 | begin
6 | println("hello from method:")
7 | println(str)
8 | end sayHello
9 |
10 | proc sayHello(in str: array of char)
11 | begin
12 | println("hello from proc:")
13 | println(str)
14 | end sayHello
15 |
16 | type P = proc (in str: array of char)
17 | M = proc (pointer)(in str: array of char)
18 | K = proc (pointer)
19 |
20 | proc test1( p: P )
21 | begin
22 | p("1234")
23 | end test1
24 |
25 | proc test2( m: M )
26 | begin
27 | m("5678")
28 | end test2
29 |
30 | proc (var this: T)test3()
31 | begin
32 | println("test3")
33 | end test3
34 |
35 | var t: pointer to T
36 | k: K
37 | begin
38 | println("ProcType2 start")
39 |
40 | test1(sayHello)
41 | new(t)
42 | test2(t.sayHello)
43 |
44 | k := t.test3
45 | k
46 |
47 | println("ProcType2 done")
48 | end ProcType2
49 |
--------------------------------------------------------------------------------
/testcases/ObxTests/ProcType3.obx:
--------------------------------------------------------------------------------
1 | module ProcType3
2 |
3 | type P = proc (in str: array of char)
4 | M = proc (^)(in str: array of char)
5 |
6 | proc generate1():P
7 | proc sayHello(in str: array of char)
8 | begin
9 | println("hello from proc:")
10 | println(str)
11 | end sayHello
12 | begin
13 | return sayHello
14 | end generate1
15 |
16 | proc generate2():M
17 | type T = record end
18 | proc (var this: T)sayHello(in str: array of char)
19 | begin
20 | println("hello from method:")
21 | println(str)
22 | end sayHello
23 | var t: pointer to T
24 | begin
25 | new(t)
26 | return t.sayHello
27 | end generate2
28 |
29 | var p: P
30 | m: M
31 | begin
32 | println("ProcType3 start")
33 | generate1()("1234")
34 |
35 | generate2()("3456")
36 |
37 | p := generate1()
38 | p("5678")
39 |
40 | m := generate2()
41 | m("7890")
42 |
43 | println("ProcType3 done")
44 | end ProcType3
45 |
--------------------------------------------------------------------------------
/testcases/ObxTests/Procs1.obx:
--------------------------------------------------------------------------------
1 | module Procs1
2 |
3 | proc Proc1(): integer
4 | var i : integer
5 | begin
6 | i := 1
7 | i := 2
8 | return i
9 | i := 3
10 | i := 4
11 | end Proc1
12 |
13 | proc Proc2():integer
14 | var i : integer
15 | proc Proc3(a,b:integer):integer
16 | return a + b
17 | end
18 | begin
19 | i := Proc3(40, 2)
20 | return i
21 | end Proc2
22 |
23 | proc Proc3( in str: array of char )
24 | begin
25 | println(str)
26 | end Proc3
27 |
28 | var x : integer
29 | proc Proc4( var x : integer )
30 | begin
31 | x := 13
32 | end Proc4
33 |
34 | begin
35 | println("Procs1 start")
36 | println( Proc1() )
37 | println( Proc2() )
38 | Proc3("Test")
39 | x := 12
40 | Proc4(x)
41 | println(x)
42 | println("Procs1 done")
43 | end Procs1
--------------------------------------------------------------------------------
/testcases/ObxTests/Procs2.obx:
--------------------------------------------------------------------------------
1 | module Procs2
2 | type A = array 4 of shortint
3 | var a : A
4 | i : integer
5 | ap : pointer to A
6 |
7 | proc P1( var c : A )
8 | begin
9 | c[2] := 22
10 | end P1
11 |
12 | proc P2( c : A )
13 | begin
14 | c[2] := 33
15 | println(c[2])
16 | end P2
17 |
18 | proc P3( var ap: pointer to A )
19 | begin
20 | new(ap)
21 | ap[3] := 44
22 | end P3
23 |
24 | begin
25 | println("Procs2 start")
26 | a[0] := -4
27 | a[1] := -3
28 | a[2] := -2
29 | a[3] := -1
30 | P1(a)
31 | println(a[2])
32 | P2(a)
33 | println(a[2])
34 | i := 1
35 | inc(i)
36 | println(i)
37 | dec(i)
38 | println(i)
39 | P3(ap)
40 | println(ap[3])
41 | println("Procs2 done")
42 | end Procs2
--------------------------------------------------------------------------------
/testcases/ObxTests/Procs3.obx:
--------------------------------------------------------------------------------
1 | module Procs3
2 |
3 | type D = array 3,4 of integer
4 | var d : D
5 | i,j: integer
6 |
7 | proc Q( d: array of array of integer )
8 | proc Inner( d: array of array of integer )
9 | var i,j: integer
10 | begin
11 | d[2,3] := 12
12 | println(d[2,3])
13 | end Inner
14 | begin
15 | Inner(d)
16 | end Q
17 |
18 | proc Str( s: array of char )
19 | begin
20 | println(s)
21 | end Str
22 |
23 | begin
24 | println("Procs3 start")
25 | for i := 0 to len(d)-1 do
26 | for j := 0 to len(d[0])-1 do
27 | d[i,j] := i + j + i * j
28 | end
29 | end
30 | println(d[2,3])
31 | Q(d)
32 | println(d[2,3])
33 |
34 | Str("Test")
35 |
36 | println("Procs3 done")
37 | end Procs3
38 |
--------------------------------------------------------------------------------
/testcases/ObxTests/Procs4.obx:
--------------------------------------------------------------------------------
1 | module Procs4
2 |
3 | var a : array 1 of real
4 | const eps = 0.01
5 | var i : integer
6 |
7 | proc ReturnZero(var i : integer):integer
8 | begin
9 | inc(i)
10 | return 0
11 | end ReturnZero
12 | begin
13 | println("Procs4 start")
14 | a[0] := 1.0
15 | i := 0
16 | pack(a[ReturnZero(i)], 2);
17 | println(i)
18 | assert(a[0] >= 4.0 - eps);
19 | assert(a[0] <= 4.0 + eps);
20 | println("Procs4 done")
21 | end Procs4
22 |
--------------------------------------------------------------------------------
/testcases/ObxTests/Procs5.obx:
--------------------------------------------------------------------------------
1 | module Procs5
2 |
3 | type
4 | Superclass = record end
5 | Class = record (Superclass) end
6 |
7 | var inst : Class
8 |
9 | proc ( var this : Superclass ) Hello()
10 | begin
11 | println("Hello Superclass!")
12 | end Hello
13 |
14 | proc ( var this : Superclass ) Hello2(in str: array of char)
15 | begin
16 | println("Hello2 Superclass!")
17 | println(str)
18 | end Hello2
19 |
20 | proc ( var this : Class ) Hello()
21 | begin
22 | this.Hello^
23 | println("Hello Class!")
24 | end Hello
25 |
26 | proc ( var this : Class ) Hello2(in str: array of char)
27 | begin
28 | this.Hello2^(str)
29 | println("Hello2 Class!")
30 | end Hello2
31 |
32 | begin
33 | println("Procs5 start")
34 | inst.Hello
35 | inst.Hello2("this is a string")
36 | println("Procs5 done")
37 | end Procs5
38 |
--------------------------------------------------------------------------------
/testcases/ObxTests/Procs5b.obx:
--------------------------------------------------------------------------------
1 | module Procs5b
2 | type
3 | Superclass = pointer to record end
4 | Class = pointer to record (Superclass) end
5 |
6 | var inst : Class
7 |
8 | proc ( this : Superclass ) Hello()
9 | begin
10 | println("Hello Superclass!")
11 | end Hello
12 |
13 | proc ( this : Superclass ) Hello2(in str: array of char)
14 | begin
15 | println("Hello2 Superclass!")
16 | println(str)
17 | end Hello2
18 |
19 | proc ( this : Class ) Hello()
20 | begin
21 | this.Hello^
22 | println("Hello Class!")
23 | end Hello
24 |
25 | proc ( this : Class ) Hello2(in str: array of char)
26 | begin
27 | this.Hello2^(str)
28 | println("Hello2 Class!")
29 | end Hello2
30 |
31 | begin
32 | println("Procs5b start")
33 | new(inst)
34 | inst.Hello
35 | inst.Hello2("this is a string")
36 | println("Procs5b done")
37 | end Procs5b
38 |
--------------------------------------------------------------------------------
/testcases/ObxTests/Procs6.obx:
--------------------------------------------------------------------------------
1 | module Procs6
2 |
3 | type
4 | Super = ^record end
5 | A = ^record (Super) end
6 | B = ^record (Super) end
7 |
8 | proc (this: Super) Hello(var i : integer):integer return 0 end
9 |
10 | proc (this: A) Hello(var i : integer):integer
11 | begin
12 | println("Hello from A")
13 | i := 22;
14 | return 33
15 | end Hello
16 |
17 | proc (this: B) Hello(var i : integer):integer
18 | begin
19 | println("Hello from B")
20 | i := 44
21 | return 55
22 | end Hello
23 |
24 | proc SayHello( obj : Super )
25 | var a,b : integer
26 | begin
27 | a := obj.Hello(b)
28 | println(b)
29 | println(a)
30 | end SayHello
31 |
32 | var
33 | a : A
34 | b : B
35 |
36 | begin
37 | println("Procs6 start")
38 | new(a)
39 | new(b)
40 | SayHello(a)
41 | SayHello(b)
42 | println("Procs6 done")
43 | end Procs6
44 |
--------------------------------------------------------------------------------
/testcases/ObxTests/Procs7.obx:
--------------------------------------------------------------------------------
1 | module Procs7
2 |
3 | // check non-local access
4 |
5 | proc Outer()
6 | var a,b,c: integer
7 |
8 | proc Mid1( i: integer )
9 | var d: integer
10 |
11 | proc Inner( i: integer )
12 | begin
13 | a := a + i
14 | d := i
15 | Mid2(11)
16 | end Inner
17 |
18 | begin
19 | b := b + i
20 | Inner(12)
21 | end Mid1
22 |
23 | proc Mid2( i: integer )
24 | begin
25 | c := c + i
26 | end Mid2
27 |
28 | begin
29 | println("begin Procs7")
30 | a := 0
31 | b := 0
32 | c := 0
33 | Mid1( 13 ) // Mid1 -> Inner -> Mid2
34 | Mid2( 14 )
35 | println(a) // 12
36 | println(b) // 13
37 | println(c) // 11 + 14 = 25
38 | println("end Procs7")
39 | end Outer
40 |
41 | begin
42 | Outer
43 | end Procs7
44 |
--------------------------------------------------------------------------------
/testcases/ObxTests/Procs7b.obx:
--------------------------------------------------------------------------------
1 | module Procs7b
2 |
3 | // check non-local access
4 |
5 | proc Outer()
6 | var a,b: array 3 of integer
7 | c: pointer to array 3 of integer
8 |
9 | proc Mid1( i: integer )
10 | var d: array 2 of integer
11 |
12 | proc Inner( i: integer )
13 | begin
14 | a[1] := a[1] + i
15 | d[0] := i
16 | new(c)
17 | Mid2(11)
18 | end Inner
19 |
20 | begin
21 | b[2] := b[2] + i
22 | Inner(12)
23 | end Mid1
24 |
25 | proc Mid2( i: integer )
26 | begin
27 | c[0] := c[0] + i
28 | end Mid2
29 |
30 | begin
31 | println("begin Procs7b")
32 | Mid1( 13 ) // Mid1 -> Inner -> Mid2
33 | Mid2( 14 )
34 | println(a[1]) // 12
35 | println(b[2]) // 13
36 | println(c[0]) // 11 + 14 = 25
37 | println("end Procs7b")
38 | end Outer
39 |
40 | begin
41 | Outer
42 | end Procs7b
43 |
--------------------------------------------------------------------------------
/testcases/ObxTests/Procs7c.obx:
--------------------------------------------------------------------------------
1 | module Procs7c
2 |
3 | // check non-local access
4 |
5 | proc Outer()
6 | type R = record i: integer end
7 | var a,b: R
8 | c: pointer to R
9 |
10 | proc Mid1( i: integer )
11 | var d: R
12 |
13 | proc Inner( i: integer )
14 | begin
15 | a.i := a.i + i
16 | d.i := i
17 | new(c)
18 | Mid2(11)
19 | end Inner
20 |
21 | begin
22 | b.i := b.i + i
23 | Inner(12)
24 | end Mid1
25 |
26 | proc Mid2( i: integer )
27 | begin
28 | c.i := c.i + i
29 | end Mid2
30 |
31 | begin
32 | println("begin Procs7c")
33 | Mid1( 13 ) // Mid1 -> Inner -> Mid2
34 | Mid2( 14 )
35 | println(a.i) // 12
36 | println(b.i) // 13
37 | println(c.i) // 11 + 14 = 25
38 | println("end Procs7c")
39 | end Outer
40 |
41 | begin
42 | Outer
43 | end Procs7c
44 |
--------------------------------------------------------------------------------
/testcases/ObxTests/Procs7d.obx:
--------------------------------------------------------------------------------
1 | module Procs7d
2 |
3 | var a,b: array 3 of integer
4 | c,d: pointer to array of integer
5 |
6 | proc Outer(aa: array of integer; var bb: array of integer; in aaa: array of integer)
7 | proc Inner( i: integer )
8 | begin
9 | aa[1] := aa[1] + 2*i
10 | bb[0] := bb[0] + 3*i
11 | // aaa[2] := 44 // compiler error
12 | println(aaa[2]*2) // 22
13 | end Inner
14 | begin
15 | Inner(33)
16 | println(aa[1]) // 66
17 | end Outer
18 |
19 | proc Outer2(cc: pointer to array of integer; var dd: pointer to array of integer;
20 | in ccc: pointer to array of integer)
21 | proc Inner2( i: integer )
22 | begin
23 | cc[1] := cc[1] + 2*i
24 | new(dd,3)
25 | dd[0] := dd[0] + 3*i
26 | //ccc[2] := 44 // compiler error
27 | println(ccc[2]*2) // 22
28 | end Inner2
29 | begin
30 | Inner2(33)
31 | end Outer2
32 |
33 | begin
34 | println("begin Procs7d")
35 |
36 | a[2] := 11
37 | Outer(a,b,a)
38 | println(a[1]) // 0
39 | println(b[0]) // 99
40 |
41 | println("****")
42 |
43 | new(c,3)
44 | c[2] := 11
45 | Outer2(c,d,c)
46 | println(c[1]) // 66
47 | println(d[0]) // 99
48 | println("end Procs7d")
49 | end Procs7d
50 |
--------------------------------------------------------------------------------
/testcases/ObxTests/Procs7e.obx:
--------------------------------------------------------------------------------
1 | module Procs7e
2 | type R = record i: integer end
3 | var a,b: R
4 | c,d: pointer to R
5 |
6 | proc Outer(aa: R; var bb: R; in aaa: R)
7 | proc Inner( i: integer )
8 | begin
9 | aa.i := aa.i + 2*i
10 | bb.i := bb.i + 3*i
11 | //aaa.i := 44 // compiler error
12 | println(aaa.i*2) // 22
13 | end Inner
14 | begin
15 | Inner(33)
16 | println(aa.i) // 77
17 | end Outer
18 |
19 | proc Outer2(cc: pointer to R; var dd: pointer to R; in ccc: pointer to R)
20 | proc Inner2( i: integer )
21 | begin
22 | cc.i := cc.i + 2*i
23 | new(dd)
24 | dd.i := dd.i + 3*i
25 | //ccc.i := 44 // compiler error
26 | println(ccc.i*2) // 22
27 | end Inner2
28 | begin
29 | Inner2(33)
30 | end Outer2
31 |
32 | begin
33 | println("begin Procs7e")
34 |
35 | a.i := 11
36 | Outer(a,b,a)
37 | println(a.i) // 11
38 | println(b.i) // 99
39 |
40 | println("****")
41 |
42 | new(c)
43 | c.i := 11
44 | Outer2(c,d,c)
45 | println(c.i) // 66
46 | println(d.i) // 99
47 |
48 | println("end Procs7e")
49 | end Procs7e
50 |
--------------------------------------------------------------------------------
/testcases/ObxTests/Procs7f.obx:
--------------------------------------------------------------------------------
1 | module Procs7f
2 |
3 | var a,b: integer
4 |
5 | proc Outer(aa: integer; var bb: integer; in aaa: integer)
6 | proc Inner( i: integer )
7 | begin
8 | aa := aa + 2*i
9 | bb := bb + 3*i
10 | // aaa := 44 // compiler error
11 | println(aaa*2) // 22
12 | end Inner
13 | begin
14 | Inner(33)
15 | println(aa) // 77
16 | end Outer
17 |
18 | begin
19 | println("begin Procs7f")
20 |
21 | a := 11
22 | Outer(a,b,a)
23 | println(a) // 11
24 | println(b) // 99
25 |
26 | println("end Procs7f")
27 | end Procs7f
--------------------------------------------------------------------------------
/testcases/ObxTests/Procs8.obx:
--------------------------------------------------------------------------------
1 | module Procs8
2 |
3 | proc test(ch: char)
4 | begin
5 | println(ch)
6 | end test
7 |
8 | proc test2():char
9 | begin
10 | return "A"
11 | end test2
12 |
13 | var ch: char
14 | begin
15 | println("Procs8 start")
16 | ch := test2()
17 | test(41x)
18 | test("B")
19 | println("Procs8 done")
20 | end Procs8
21 |
--------------------------------------------------------------------------------
/testcases/ObxTests/Procs9.obx:
--------------------------------------------------------------------------------
1 | module Procs9
2 |
3 | type
4 | CallSign = record value: integer end
5 | Aircraft = record callsign: CallSign; position: Vector3D; i : integer end
6 | Vector3D = record x,y,z: longreal end
7 |
8 | proc test(): Aircraft
9 | var a: Aircraft
10 | begin
11 | a.callsign.value := 5
12 | a.position.x := 6
13 | a.position.y := 7
14 | a.position.z := 8
15 | return a
16 | end test
17 |
18 | proc test2(a: Aircraft)
19 | begin
20 | assert( a.position.z = 4.0 )
21 | a.position.z := 5
22 | end test2
23 |
24 | proc test3(in a: Aircraft)
25 | begin
26 | assert( a.position.z = 4.0 )
27 | // a.i := 3 // cannot modify read-only desig
28 | // a.position.z := 5 // is an error
29 | end test3
30 |
31 | proc test4(var a: Aircraft)
32 | begin
33 | assert( a.position.z = 4.0 )
34 | a.position.z := 6
35 | end test4
36 |
37 | var a1, a2: Aircraft
38 |
39 | begin
40 | println("Procs9 start")
41 | a1.callsign.value := 1
42 | a1.position.x := 2
43 | a1.position.y := 3
44 | a1.position.z := 4
45 | a2 := a1
46 | assert( a2.position.z = a1.position.z )
47 | a2.position.z := 10
48 | assert( a2.position.z # a1.position.z )
49 |
50 | test2(a1)
51 | assert( a1.position.z = 4.0 )
52 |
53 | test4(a1)
54 | assert( a1.position.z = 6.0)
55 | a1.position.z := 4
56 |
57 | test3(a1)
58 | assert( a1.position.z = 4.0)
59 |
60 | a2 := test()
61 | assert( a2.position.z = 8.0 )
62 |
63 | println("Procs9 done")
64 | end Procs9
65 |
--------------------------------------------------------------------------------
/testcases/ObxTests/RecReturnTest.obx:
--------------------------------------------------------------------------------
1 | module Test
2 |
3 | type T = record a*, b: integer; c: array 3 of char end
4 |
5 | proc x():T
6 | var t: T
7 | begin
8 | return t
9 | end x
10 |
11 | proc y():^T
12 | begin
13 | return nil
14 | end y
15 |
16 | var t: T
17 |
18 | begin
19 |
20 | //t := x()
21 | //x() := t
22 | y().a := 33
23 | y().c[2] := "a"
24 |
25 | end Test
26 |
--------------------------------------------------------------------------------
/testcases/ObxTests/Record1.obx:
--------------------------------------------------------------------------------
1 | module Record1
2 |
3 | type
4 | A = record i,j: integer end
5 | B = record (A) str: array 10 of char end
6 | C = record (A) flag: boolean end
7 | PA = pointer to A
8 | PB = pointer to B
9 | PC = pointer to C
10 |
11 | var
12 | a: pointer to A
13 | b: pointer to B
14 | c: pointer to C
15 |
16 | begin
17 | println("start Record1")
18 | new(b)
19 | a := b
20 |
21 | assert(a is PA)
22 | assert(a is PB)
23 | assert(~(a is PC))
24 |
25 | println("end Record1")
26 | end Record1
27 |
--------------------------------------------------------------------------------
/testcases/ObxTests/Record2.obx:
--------------------------------------------------------------------------------
1 | module Record2
2 |
3 | type
4 | A = record i,j: integer end
5 | B = record (A) str: array 10 of char end
6 | C = record (A) flag: boolean end
7 |
8 | proc P1( var x: A )
9 | begin
10 | assert(x is A)
11 | end P1
12 |
13 | proc P2( var x: A )
14 | begin
15 | assert(~(x is C))
16 | end P2
17 |
18 | var
19 | a: A
20 | b: B
21 | c: C
22 |
23 | begin
24 | println("start Record2")
25 |
26 | P1(a)
27 | P1(b)
28 | P2(b)
29 |
30 | println("end Record2")
31 | end Record2
--------------------------------------------------------------------------------
/testcases/ObxTests/Record3.obx:
--------------------------------------------------------------------------------
1 | module Record3
2 |
3 | type T = record a,b: integer end
4 |
5 | var
6 | a : array 2 of array 3 of array 4 of T
7 | begin
8 |
9 | a[1][2][3].a := 33
10 | println(a[1][2][3].a)
11 |
12 | end Record3
13 |
--------------------------------------------------------------------------------
/testcases/ObxTests/SYSTEM.obx:
--------------------------------------------------------------------------------
1 | module SYSTEM
2 |
3 | proc SayHello*()
4 | begin
5 | println("Hello!")
6 | end SayHello
7 |
8 | end SYSTEM
9 |
--------------------------------------------------------------------------------
/testcases/ObxTests/System1.obx:
--------------------------------------------------------------------------------
1 | module System1
2 |
3 | import SYSTEM
4 |
5 | var i: integer
6 |
7 | begin
8 |
9 | i := SYSTEM.VAL(INTEGER,3)
10 |
11 | println(i)
12 |
13 | end System1
14 |
--------------------------------------------------------------------------------
/testcases/ObxTests/System2.obx:
--------------------------------------------------------------------------------
1 | module System2
2 |
3 | import SYSTEM
4 |
5 | begin
6 | println("System2 start")
7 |
8 | SYSTEM.SayHello
9 |
10 | println("System2 done")
11 | end System2
12 |
--------------------------------------------------------------------------------
/testcases/ObxTests/TestDll/Test.h:
--------------------------------------------------------------------------------
1 | #ifndef TEST_H
2 | #define TEST_H
3 |
4 | #include "test_global.h"
5 |
6 |
7 | #endif // TEST_H
8 |
--------------------------------------------------------------------------------
/testcases/ObxTests/TestDll/Test.pro:
--------------------------------------------------------------------------------
1 | #-------------------------------------------------
2 | #
3 | # Project created by QtCreator 2021-10-15T03:19:03
4 | #
5 | #-------------------------------------------------
6 |
7 | QT -= gui
8 |
9 | TARGET = Test
10 | TEMPLATE = lib
11 |
12 | DEFINES += TEST_LIBRARY
13 |
14 | SOURCES += Test.cpp
15 |
16 | HEADERS += Test.h\
17 | test_global.h
18 |
19 | unix {
20 | target.path = /usr/lib
21 | INSTALLS += target
22 | }
23 |
--------------------------------------------------------------------------------
/testcases/ObxTests/TestDll/test_global.h:
--------------------------------------------------------------------------------
1 | #ifndef TEST_GLOBAL_H
2 | #define TEST_GLOBAL_H
3 |
4 | #include
5 |
6 | #if defined(TEST_LIBRARY)
7 | # define TESTSHARED_EXPORT Q_DECL_EXPORT
8 | #else
9 | # define TESTSHARED_EXPORT Q_DECL_IMPORT
10 | #endif
11 |
12 | #endif // TEST_GLOBAL_H
13 |
--------------------------------------------------------------------------------
/testcases/ObxTests/Tests.obx:
--------------------------------------------------------------------------------
1 | module Tests
2 |
3 | type
4 | CallSign = record value: integer end
5 | Aircraft = record callsign: CallSign; position: Vector3D end
6 | Vector3D = record x,y,z: longreal end
7 |
8 | proc test(): Aircraft
9 | var a: Aircraft
10 | begin
11 | a.callsign.value := 5
12 | a.position.x := 6
13 | a.position.y := 7
14 | a.position.z := 8
15 | return a
16 | end test
17 |
18 | proc test2(a: Aircraft)
19 | begin
20 | assert( a.position.z = 4.0 )
21 | a.position.z := 5
22 | end test2
23 |
24 | proc test3(in a: Aircraft)
25 | begin
26 | assert( a.position.z = 4.0 )
27 | //a.position.z := 5 // is an error
28 | end test3
29 |
30 | proc test4(var a: Aircraft)
31 | begin
32 | assert( a.position.z = 4.0 )
33 | a.position.z := 6
34 | end test4
35 |
36 | var a1, a2: Aircraft
37 |
38 | begin
39 | println("Procs9 start")
40 | a1.callsign.value := 1
41 | a1.position.x := 2
42 | a1.position.y := 3
43 | a1.position.z := 4
44 | a2 := a1
45 | assert( a2.position.z = a1.position.z )
46 | a2.position.z := 10
47 | assert( a2.position.z # a1.position.z )
48 |
49 | test2(a1)
50 | assert( a1.position.z = 4.0 )
51 |
52 | test4(a1)
53 | assert( a1.position.z = 6.0)
54 | a1.position.z := 4
55 |
56 | test3(a1)
57 | assert( a1.position.z = 4.0)
58 |
59 | a2 := test()
60 | assert( a2.position.z = 8.0 )
61 |
62 | println("Procs9 done")
63 | end Tests
64 |
--------------------------------------------------------------------------------
/testcases/ObxTests/Tests.obxpro:
--------------------------------------------------------------------------------
1 | [General]
2 | BuildDir=/home/me/Entwicklung/Modules/build-ObxIde2-Qt_5_4_2-Debug/build
3 | BuiltInOakwood=true
4 | BuiltInObSysInner=false
5 | IntegerIsInt16=false
6 | MainModule=@ByteArray()
7 | MainProc=@ByteArray()
8 | Options=@ByteArray()
9 | Suffixes=@Invalid()
10 | WorkingDir=
11 |
12 | [.]
13 | size=0
14 |
15 | [Modules]
16 | 1\AbsPath=/home/me/Entwicklung/Modules/Oberon/testcases/ObxTests/RecReturnTest.obx
17 | 1\RelPath=RecReturnTest.obx
18 | size=1
19 |
20 | [Packages]
21 | 1\Name=@ByteArray()
22 | 2\Name=@ByteArray()
23 | size=2
24 |
--------------------------------------------------------------------------------
/testcases/ObxTests/TryToAssertJit.obx:
--------------------------------------------------------------------------------
1 | module TryToAssertJit
2 |
3 | (*
4 | proc Test(var i: integer )
5 | begin
6 | println("gugus")
7 | for i := 0 to 1000 do
8 | println(i)
9 | end
10 | end Test *)
11 |
12 | type
13 | T = ( A, B, C D E )
14 |
15 | proc Dummy(t:T) end
16 |
17 | var i: integer
18 | t : T
19 |
20 | begin
21 |
22 | (*
23 | println("upwards:") // all down to ENDDDD crashes after 9
24 | for t := A to E do
25 | println(t)
26 | end
27 |
28 | println("downwards:") // crashes after 16
29 | for t := D to B do
30 | println(t)
31 | end
32 |
33 | println("inc dec:") // crashes after 32
34 | t := B
35 | inc(t)
36 |
37 | println( t ) // no crash
38 | t := D
39 | dec(t)
40 | println( t )
41 |
42 | println( max(T) )
43 | println( min(T) )
44 | /// ENDDDD
45 | *)
46 |
47 |
48 | (* crashes after 32 in rec_check_slots J->framedepth == depth*)
49 | println("inc dec:")
50 | t := B
51 | inc(t)
52 | println( t )
53 | t := D
54 | dec(t)
55 | println( t )
56 |
57 | println( max(T) )
58 | println( min(T) )
59 | // doesn't crash anymore after fix on 2021-07-11; there was a slot bought and not sold
60 | // in builtin proc calls; apparently that confuses the JIT; not the first time I observe this
61 |
62 | (* crashes after 46 in rec_check_slots J->framedepth == depth
63 | println("inc dec:")
64 | t := B
65 | inc(t)
66 | println( t )
67 | t := D
68 | dec(t)
69 | println( t )
70 |
71 | Dummy( max(T) )
72 | Dummy( min(T) )*)
73 |
74 |
75 | (* still no assert at 1650
76 | println("inc dec:")
77 | t := B
78 | inc(t)
79 | println( t )
80 | t := D
81 | dec(t)
82 | println( t )
83 |
84 | t := max(T)
85 | println( t )
86 | t := min(T)
87 | println( t ) *)
88 |
89 | end TryToAssertJit
90 |
--------------------------------------------------------------------------------
/testcases/ObxTests/Umlaut.obx:
--------------------------------------------------------------------------------
1 | module Umlaut
2 |
3 | begin
4 |
5 | println(ORD("Ä"))
6 |
7 | end Umlaut
8 |
--------------------------------------------------------------------------------
/testcases/ObxTests/Unsafe.obxpro:
--------------------------------------------------------------------------------
1 | [General]
2 | BuildDir=/home/me/Entwicklung/Modules/build-ObxIde2-Qt_5_4_2-Debug/build
3 | BuiltInOakwood=true
4 | BuiltInObSysInner=false
5 | MainModule=@ByteArray()
6 | MainProc=@ByteArray()
7 | Suffixes=@Invalid()
8 | WorkingDir=
9 |
10 | [.]
11 | size=0
12 |
13 | [Modules]
14 | 1\AbsPath=/home/me/Entwicklung/Modules/Oberon/testcases/ObxTests/UnsafeImport1.obx
15 | 1\RelPath=UnsafeImport1.obx
16 | 2\AbsPath=/home/me/Entwicklung/Modules/Oberon/testcases/ObxTests/Unsafe1.obx
17 | 2\RelPath=Unsafe1.obx
18 | 3\AbsPath=/home/me/Entwicklung/Modules/Oberon/testcases/ObxTests/Unsafe2.obx
19 | 3\RelPath=Unsafe2.obx
20 | 4\AbsPath=/home/me/Entwicklung/Modules/Oberon/testcases/ObxTests/UnsafeImport2.obx
21 | 4\RelPath=UnsafeImport2.obx
22 | size=3
23 |
24 | [Packages]
25 | 1\Name=@ByteArray()
26 | 2\Name=@ByteArray()
27 | size=2
28 |
--------------------------------------------------------------------------------
/testcases/ObxTests/Unsafe2.obx:
--------------------------------------------------------------------------------
1 | module Unsafe2
2 | import I := UnsafeImport1
3 | //I2 := UnsafeImport2
4 |
5 | proc test4()
6 | var l: I.L
7 | p: *I.P
8 | begin
9 | l.a.x := 1
10 | l.a.y := 2
11 | l.a.z := 3
12 | l.b.x := 4
13 | l.b.y := 5
14 | l.b.z := 6
15 | l.w := 123.456
16 | p := l.a
17 | println(p)
18 | //trap()
19 | I.doit8(p)
20 | println(l.a.x)
21 | println(l.b.y)
22 | println(l.w)
23 | end test4
24 |
25 | proc test5()
26 | var s: carray 10 of char
27 | begin
28 | s := "gugus"
29 | //trap()
30 | println(s)
31 | end test5
32 | var
33 | t: I.T
34 | str: carray 10 of char
35 | begin
36 | println("begin Unsafe2")
37 |
38 | test4
39 | test5
40 | //(*
41 | t.a := 1
42 | t.s := "gugus"
43 | t.d := 2
44 | t.e := 3
45 | //trap()
46 | println(t)
47 | I.doit2(t)
48 | println(t.a)
49 | println(t.s)
50 | println(t.d)
51 | println(t.e)
52 |
53 | t.s := "my number is %d"+0dx
54 | I.doit11(t.s,33)
55 | I.doit11(t.s,88)
56 | t.s := "now for %d bottles of %s"+0dx
57 | str := "beer"
58 | I.doit11(t.s,22, str)
59 | t.s := "alle meine entchen %d"+0dx
60 | I.doit11_int(t.s,42)
61 |
62 | //I2.printf_int("test", 44)
63 | //*)
64 | println("end Unsafe2")
65 | end Unsafe2
66 |
--------------------------------------------------------------------------------
/testcases/ObxTests/Unsafe3.obx:
--------------------------------------------------------------------------------
1 | module Unsafe3
2 |
3 | type
4 | T = cstruct a,b: integer end
5 |
6 | (* generates error:
7 | proc p1(var t: T)
8 | begin
9 | t.a := 55
10 | end p1
11 | *)
12 |
13 | proc p2(t: *T)
14 | begin
15 | t.a := 66
16 | end p2
17 |
18 | var
19 | t : T
20 | pt : cpointer to T
21 |
22 | begin
23 | t.a := 33
24 | t.b := 44
25 | pt := t
26 | println(pt.a)
27 | p2(pt)
28 | println(t.a)
29 |
30 | end Unsafe3
31 |
--------------------------------------------------------------------------------
/testcases/ObxTests/Unsafe4.obx:
--------------------------------------------------------------------------------
1 | module Unsafe4
2 |
3 | type
4 | ThData = cstruct
5 | fct: longreal
6 | end
7 |
8 | T2 = cstruct
9 | x: shortint
10 | arr: carray 3 of cstruct
11 | a: integer
12 | b: shortint
13 | end
14 | y: byte
15 | end
16 |
17 |
18 | var
19 | data: carray 1 of ThData
20 | t2 : T2
21 | begin
22 | t2.arr[1].a := 33
23 | println(t2.arr[1].a)
24 | data[0].fct := 1.0
25 | println(data[0].fct)
26 | end Unsafe4
27 |
--------------------------------------------------------------------------------
/testcases/ObxTests/UnsafeImport1.obx:
--------------------------------------------------------------------------------
1 | definition UnsafeImport1 [ extern 'C', dll 'Test' ]
2 |
3 | type
4 | T = cstruct
5 | a,b: integer
6 | s: carray 29 of char
7 | d: integer
8 | e: shortint
9 | end
10 | P = cstruct x,y,z: integer end
11 | L = cstruct a,b: P; w: real end
12 | CB = proc(s: *T):integer
13 |
14 | proc doit(str: *[]char; a: integer): integer
15 | proc hello(): integer [ prefix 'SDL_' ]
16 |
17 | proc doit2( t: *T ): integer
18 | proc doit3( i: *[]integer; count: integer ): integer
19 | proc doit6( out: *[]*T ): integer // cpointer to carray 1 of cpointer to T
20 | proc doit7():*T
21 | proc doit8(p:P):integer
22 | proc doit9(x,y,z:integer):P
23 |
24 | proc doit10(cb: CB):integer
25 |
26 | proc doit11( format: *[]char) [ varargs ]
27 | proc doit11_int( format: *[]char; i: integer) [ alias "doit11" ]
28 |
29 | end UnsafeImport1
30 |
--------------------------------------------------------------------------------
/testcases/ObxTests/UnsafeImport2.obx:
--------------------------------------------------------------------------------
1 | definition UnsafeImport2 [ extern 'C', dll 'Unknown' ]
2 |
3 | proc printf( format: *[]char) [ varargs ]
4 | proc printf_int( format: *[]char; i: integer) [ alias "printf" ]
5 |
6 | end UnsafeImport2
7 |
--------------------------------------------------------------------------------
/testcases/ObxTests/Vla1.obx:
--------------------------------------------------------------------------------
1 | module Vla1
2 |
3 | var s: integer
4 | // compiler error:
5 | // type A = array var s of integer
6 |
7 | proc Test(n: integer)
8 | var i: integer
9 | a: array var n of integer
10 | begin
11 | for i := 0 to n -1 do
12 | a[i] := i*2
13 | end
14 | println(a[2])
15 | Test2(a)
16 | Test3(a)
17 | end Test
18 |
19 | proc Test2(in a: array of integer)
20 | begin
21 | println(a[2])
22 | end Test2
23 |
24 | proc Test3(var p: array of integer)
25 | // compiler error:
26 | // type A = array var n of integer
27 | var a, b: array var len(p) of integer
28 | // compiler error:
29 | // c: array 1 of array var n of integer
30 | d: array var 1 of array var len(p) of integer // ok
31 | e: array var 1,len(p) of integer // ok
32 | f: array 10 of integer
33 | begin
34 | a := b // works like open arrays
35 | f := a
36 | a := f
37 | d[0] := p
38 | a := p
39 | p := a
40 | println(p[3])
41 | end Test3
42 |
43 | begin
44 | println("Vla1 start")
45 | Test(12)
46 | println("Vla1 done")
47 | end Vla1
48 |
--------------------------------------------------------------------------------
/testcases/ObxTests/Vla2.obx:
--------------------------------------------------------------------------------
1 | module Vla2
2 |
3 | proc Test(n, m: integer)
4 | var i,j: integer
5 | a: array var n, m of integer
6 | begin
7 | for i := 0 to n -1 do
8 | for j := 0 to m-1 do
9 | a[i,j] := i*j*2
10 | end
11 | end
12 | println(a[2,3])
13 | end Test
14 |
15 | begin
16 | println("Vla2 start")
17 | Test(4,5)
18 | println("Vla2 done")
19 | end Vla2
20 |
--------------------------------------------------------------------------------
/testcases/ObxTests/Vla3.obx:
--------------------------------------------------------------------------------
1 | module Vla3
2 |
3 | proc Test(n: integer)
4 | var i: integer
5 | a: carray var n of integer
6 | begin
7 | for i := 0 to n -1 do
8 | a[i] := i*2
9 | end
10 | println(a[2])
11 | Test2(a)
12 | end Test
13 |
14 | proc Test2(a: *[]integer)
15 | begin
16 | println(a[2])
17 | end Test2
18 |
19 | begin
20 | println("Vla3 start")
21 | Test(12)
22 | println("Vla3 done")
23 | end Vla3
24 |
--------------------------------------------------------------------------------
/testcases/ObxTests/With.obx:
--------------------------------------------------------------------------------
1 | MODULE With;
2 | TYPE
3 | T0 = POINTER TO RECORD END;
4 | T1 = POINTER TO RECORD(T0) i: INTEGER END;
5 | VAR t : T1; v: T0;
6 | BEGIN
7 | PRINTLN(v IS T1) // FALSE because v is NIL
8 | WITH v: T1 DO PRINTLN("OK") ELSE PRINTLN("NOK") END // NOK becauase v is NIL
9 | CASE v OF
10 | | T0: PRINTLN("T0")
11 | | T1: PRINTLN("T1")
12 | ELSE
13 | PRINTLN("NIL")
14 | END
15 |
16 | NEW(t);
17 | v := t;
18 | WITH v: T1 DO v.i := 3 END;
19 | PRINTLN(t.i); // prints 3
20 | IF v IS T1 THEN v(T1).i := 4 END;
21 | PRINTLN(t.i); // prints 4
22 | END With.
23 |
--------------------------------------------------------------------------------
/testcases/SDL2/Draw.obxpro:
--------------------------------------------------------------------------------
1 | [General]
2 | BuildDir=/home/me/Entwicklung/Modules/build-ObxIde2-Qt_5_4_2-Debug/build
3 | BuiltInOakwood=true
4 | BuiltInObSysInner=false
5 | IntegerIsInt16=false
6 | MainModule=@ByteArray()
7 | MainProc=@ByteArray()
8 | Options=@ByteArray()
9 | Suffixes=@Invalid()
10 | WorkingDir=
11 |
12 | [Modules]
13 | 1\AbsPath=/home/me/Entwicklung/Modules/Oberon/testcases/SDL2/Draw.obx
14 | 1\RelPath=Draw.obx
15 | 2\AbsPath=/home/me/Entwicklung/Modules/Oberon/testcases/SDL2/SDL.obx
16 | 2\RelPath=SDL.obx
17 | size=2
18 |
19 | [Packages]
20 | 1\Name=@ByteArray()
21 | size=1
22 |
--------------------------------------------------------------------------------
/testcases/SDL2/OBX.obx:
--------------------------------------------------------------------------------
1 | definition OBX [ extern "C", prefix "ObxFfi_" ]
2 |
3 | type
4 | Ticker = proc(time: integer)
5 |
6 | proc addTimer( tick: Ticker; msec: integer ): integer
7 | proc removeTimer( timer: integer )
8 | proc DBGTRACE( msg: *[]char )
9 | proc printString( msg: *[]char )
10 | proc processEvents(delay: integer)
11 |
12 | end OBX
13 |
--------------------------------------------------------------------------------
/testcases/SDL2/Readme.md:
--------------------------------------------------------------------------------
1 | This module was generated using [C2OBX](https://github.com/rochus-keller/C2OBX) from the (nearly) original SDL2 (v2.0.2) header files.
2 |
--------------------------------------------------------------------------------
/testcases/SDL2/SDL.obxpro:
--------------------------------------------------------------------------------
1 | [General]
2 | BuildDir=/home/me/Entwicklung/Modules/build-ObxIde2-Qt_5_4_2-Debug/build
3 | BuiltInOakwood=true
4 | BuiltInObSysInner=false
5 | MainModule=@ByteArray()
6 | MainProc=@ByteArray()
7 | Suffixes=@Invalid()
8 | WorkingDir=
9 |
10 | [.]
11 | size=0
12 |
13 | [Modules]
14 | 1\AbsPath=/home/me/Entwicklung/Modules/Oberon/testcases/SDL2/SDL.obx
15 | 1\RelPath=SDL.obx
16 | 2\AbsPath=/home/me/Entwicklung/Modules/Oberon/testcases/SDL2/Test.obx
17 | 2\RelPath=Test.obx
18 | 3\AbsPath=/home/me/Entwicklung/Modules/Oberon/testcases/SDL2/OBX.obx
19 | 3\RelPath=OBX.obx
20 | size=2
21 |
22 | [Packages]
23 | 1\Name=@ByteArray()
24 | 2\Name=@ByteArray()
25 | size=2
26 |
--------------------------------------------------------------------------------
/testcases/SDL2/lena.bmp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rochus-keller/Oberon/e59a729bd13513f2d454fd2ce364ab01ecefeb70/testcases/SDL2/lena.bmp
--------------------------------------------------------------------------------
/tools/ExtractVirtDisk/ExtractVirtDisk.pro:
--------------------------------------------------------------------------------
1 | #-------------------------------------------------
2 | #
3 | # Project created by QtCreator 2023-10-13T17:35:53
4 | #
5 | #-------------------------------------------------
6 |
7 | QT += core
8 |
9 | QT -= gui
10 |
11 | TARGET = ExtractVirtDisk
12 | CONFIG += console
13 | CONFIG -= app_bundle
14 |
15 | TEMPLATE = app
16 |
17 |
18 | SOURCES += \
19 | ExtractVirtDisk.cpp
20 |
21 | HEADERS += \
22 | ExtractVirtDisk.h
23 |
--------------------------------------------------------------------------------