summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: d4878ea)
raw | patch | inline | side by side (parent: d4878ea)
author | DeaDDooMER <deaddoomer@deadsoftware.ru> | |
Fri, 15 Sep 2017 18:06:19 +0000 (21:06 +0300) | ||
committer | DeaDDooMER <deaddoomer@deadsoftware.ru> | |
Fri, 15 Sep 2017 18:06:19 +0000 (21:06 +0300) |
Test.obn | patch | blob | history | |
notes | patch | blob | history | |
obn-run.sh | patch | blob | history | |
rtl/Oberon.obn | patch | blob | history | |
rtl/java/Files.java | patch | blob | history | |
rtl/java/SYSTEM.java | patch | blob | history |
diff --git a/Test.obn b/Test.obn
index 950aa0a9ca7e9993974152c16cfff3bc01beb0fc..6fae5299c4ceb508ddf3708622d39e419e562a12 100644 (file)
--- a/Test.obn
+++ b/Test.obn
MODULE Test;
-IMPORT Out;
-
-TYPE
- Name = ARRAY 16 OF CHAR;
-
-VAR
- key : ARRAY 128 OF Name;
- name : Name;
-
-BEGIN
- IF name > name THEN Out.Ln; END;
END Test.
index bdd35e2be8039ea3715369b5d9969b9c962661d5..3656a8651495460e27a9c1633f553fed5bacb96f 100644 (file)
--- a/notes
+++ b/notes
- Нужно передавать информацию о файле и строках в кодогенератор.
- Нет процедур привязанных к типм (10.2)
- Не полная реализация модуля Files
+ * Нет процедур ReadNum WriteReal WriteLReal WriteNum WriteSet WriteBool
- Разршить отсутсвие RETURN в функциях без BEGIN
С вкорячиванием трапа, естественно.
diff --git a/obn-run.sh b/obn-run.sh
index 9514a22a4b2d741e8f1fcb7fd5d80d3e2605b50c..93f2da8400ce666ebad82f275a50585bac847fc3 100755 (executable)
--- a/obn-run.sh
+++ b/obn-run.sh
set -e
-java -ea -cp classes Launcher $1
+java -ea -cp classes Launcher $*
diff --git a/rtl/Oberon.obn b/rtl/Oberon.obn
index 6282f4e4acd3bc1ab45cf0a56c6cb24f3877e948..3316b850ea9e30bfd4b0c82eac8f77994fb0a1b3 100644 (file)
--- a/rtl/Oberon.obn
+++ b/rtl/Oberon.obn
i := 1;
WHILE i < Args.count DO
Args.GetArg(i, str); Texts.WriteString(W, str); Texts.Write(W, " ");
+ Out.String("Param "); Out.Int(i, 0); Out.Char(" "); Out.String(str); Out.Ln;
INC(i)
END;
Texts.Append(Par.text, W.buf);
END
END LogNotifier;
-PROCEDURE StubNotifier(T: Texts.Text; op: INTEGER; beg, end: LONGINT);
-BEGIN
-END StubNotifier;
-
BEGIN
NEW(Par);
NEW(Par.text);
- Par.text.notify := StubNotifier;
Par.pos := 0;
Texts.Open(Par.text, "");
PopulateParams;
diff --git a/rtl/java/Files.java b/rtl/java/Files.java
index 9864ca57c1d7a26e4ab3981afc5b8cb13cad281e..c201940c21cbb37cc41a3f0b85ee546288cea4b9 100644 (file)
--- a/rtl/java/Files.java
+++ b/rtl/java/Files.java
public static void WriteInt(RECORD1 R[], int R$, short x)
{
- SYSTEM.TRAP(-3);
+ byte[][] i = new byte[1][2];
+ i[0][0] = (byte) ((x >>> 8) & 0xff);
+ i[0][1] = (byte) ((x) & 0xff);
+ WriteBytes(R, R$, i, 0, 2);
}
public static void WriteLInt(RECORD1 R[], int R$, int x)
{
- SYSTEM.TRAP(-3);
+ byte[][] i = new byte[1][4];
+ i[0][0] = (byte) ((x >>> 24) & 0xff);
+ i[0][1] = (byte) ((x >>> 16) & 0xff);
+ i[0][2] = (byte) ((x >>> 8) & 0xff);
+ i[0][3] = (byte) ((x) & 0xff);
+ WriteBytes(R, R$, i, 0, 4);
}
public static void WriteReal(RECORD1 R[], int R$, float x)
public static void WriteString(RECORD1 R[], int R$, byte x[])
{
- SYSTEM.TRAP(-3);
+ byte[][] i = new byte[1][];
+ i[0] = x;
+ WriteBytes(R, R$, i, 0, SYSTEM.LEN(x));
}
public static void WriteSet(RECORD1 R[], int R$, int x)
public static void WriteBytes(RECORD1 r[], int r$, byte[][] x, int x$, int n)
{
- SYSTEM.TRAP(-3);
+ RECORD1 rider = r[r$];
+ RandomAccessFile desc = rider.base.desc;
+
+ try
+ {
+ rider.base.SetActive(rider);
+ desc.write(x[x$], 0, n);
+ rider.position += n;
+ }
+ catch(IOException e)
+ {
+ rider.res[0] = n;
+ rider.eof[0] = true;
+ }
}
public static void BEGIN()
diff --git a/rtl/java/SYSTEM.java b/rtl/java/SYSTEM.java
index e1105c0aa3abd3c9fb3c5efe2253550300cf7bb5..7e6a0f8d7308e854443f588c1373a3dd08f8554e 100644 (file)
--- a/rtl/java/SYSTEM.java
+++ b/rtl/java/SYSTEM.java
public static void COPY(String x, byte[] v)
{
- COPY(x.getBytes(), v);
+ int ix = x.length();
+ int iv = v.length - 1;
+
+ int i = 0;
+ int len = (ix < iv) ? (ix) : (iv);
+ while(i < len)
+ {
+ v[i] = (byte) x.charAt(i);
+ i += 1;
+ }
+ v[i] = 0;
}
public static int STRCMP(byte[] a, byte[] b)