summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 10288ed)
raw | patch | inline | side by side (parent: 10288ed)
author | DeaDDooMER <deaddoomer@deadsoftware.ru> | |
Tue, 22 Aug 2017 21:34:13 +0000 (00:34 +0300) | ||
committer | DeaDDooMER <deaddoomer@deadsoftware.ru> | |
Tue, 22 Aug 2017 21:34:13 +0000 (00:34 +0300) |
rtl/java/Files.java | patch | blob | history | |
src/oberon.c | patch | blob | history |
diff --git a/rtl/java/Files.java b/rtl/java/Files.java
index 5fe0074ca6293714b95895c070a78113ee14fcbe..5ccfa25acacc8822278fce3aa1f2039837e6fd59 100644 (file)
--- a/rtl/java/Files.java
+++ b/rtl/java/Files.java
try
{
- filepath = File.createTempFile(RandomString(8), "tmp");
+ filepath = File.createTempFile(SYSTEM.STRING(name), "tmp");
fileregpath = new File(SYSTEM.STRING(name));
filedesc = new RandomAccessFile(filepath, "rw");
}
file = new RECORD0();
file.path = filepath;
- file.regpath = fileregpath;
+ file.regpath = fileregpath.getAbsoluteFile();
file.desc = filedesc;
return file;
}
public static void Register(RECORD0 f)
+ throws
+ IOException
{
- f.path.renameTo(f.regpath);
+ java.nio.file.Files.move(
+ java.nio.file.Paths.get(f.path.getPath()),
+ java.nio.file.Paths.get(f.regpath.getPath()),
+ java.nio.file.StandardCopyOption.REPLACE_EXISTING
+ );
f.path = f.regpath;
}
public static void Write(RECORD1 r[], int r$, byte x)
{
- SYSTEM.TRAP(-3);
+ RECORD1 rider = r[r$];
+ RandomAccessFile desc = rider.base.desc;
+
+ try
+ {
+ rider.base.SetActive(rider);
+ desc.write(x);
+ rider.position += 1;
+ }
+ catch(IOException e)
+ {
+ rider.res[0] = 1;
+ rider.eof[0] = true;
+ }
}
public static void WriteInt(RECORD1 R[], int R$, short x)
diff --git a/src/oberon.c b/src/oberon.c
index 4a740d8130db2be573d6c197eadc2ee767244d3c..f6bd09e68cc85998290d4ed9fd8c94f3b5c2d6d1 100644 (file)
--- a/src/oberon.c
+++ b/src/oberon.c
@@ -1995,7 +1995,7 @@ oberon_make_bin_op(oberon_context_t * ctx, int token, oberon_expr_t * a, oberon_
expr = oberon_new_operator(OP_DIV, result, a, b);
break;
case MOD:
- expr = oberon_new_operator(OP_DIV, result, a, b);
+ expr = oberon_new_operator(OP_MOD, result, a, b);
break;
default:
printf("token %i line %i\n", token, ctx -> loc.line);