OberonCore
https://forum.oberoncore.ru/

B01: HostFiles.NewWriter
https://forum.oberoncore.ru/viewtopic.php?f=130&t=6169
Страница 1 из 1

Автор:  Zinn [ Суббота, 18 Ноябрь, 2017 10:34 ]
Заголовок сообщения:  B01: HostFiles.NewWriter

I recommend to cancel the change in HostFiles.NewWriter and use the original version.

Why? See discussion at
http://forum.blackboxframework.org/view ... riter#p708

Add instead in HostFiles

PROCEDURE (f: File) Closed(): BOOLEAN;
BEGIN
RETURN f.state = closed
END Closed;

PROCEDURE (f: File) Shared(): BOOLEAN;
BEGIN
RETURN f.state = shared
END Shared;

and add in Files

PROCEDURE (f: File) Closed* (): BOOLEAN, NEW, ABSTRACT;
PROCEDURE (f: File) Shared* (): BOOLEAN, NEW, ABSTRACT;

- Helmut

Автор:  Евгений Темиргалеев [ Воскресенье, 19 Ноябрь, 2017 16:08 ]
Заголовок сообщения:  Re: B01: HostFiles.NewWriter

The B01 is error correction corresponding to original interface, but extenting Files interface is a feature.

There is a way to introduce this feature by adding new procedures & leave existing unchanged.

Add in Files to get the File state.
PROCEDURE (f: File) Closed* (): BOOLEAN, NEW, ABSTRACT;
PROCEDURE (f: File) Shared* (): BOOLEAN, NEW, ABSTRACT;
or
PROCEDURE (f: File) State* (): SET, NEW, ABSTRACT; ?

And leave File.NewWriter unchanged.
You can't write to the file which is trapping with NewWriter. You can't write to the file which is returning NIL-writer similary (NIL deref trap when accessing the wirter).

Цитата:
By checking the return value NIL you cannot see if the file is writable or not.
Why? Because if the system is running out of memory it also returns NIL when you call NEW.
And this is not correct. When the System returns out of memory NIL you shall get a NIL deref trap in NewWriter accessing w fields.
Код:
         IF (old # NIL) & (old IS Writer) THEN w := old(Writer) ELSE NEW(w) END;
         IF w.base # f THEN <-- here

Автор:  Евгений Темиргалеев [ Воскресенье, 19 Ноябрь, 2017 19:24 ]
Заголовок сообщения:  Re: B01: HostFiles.NewWriter

One more decision. Such Files.File interface change requires rewriting all extensions (not only HostFiles.File) and recompiling all clients.
This is serious price. But we don't need nor Shared() nor Closed() at all, for example.

Do you have an examples using such file state request, Helmut?

Автор:  Zinn [ Понедельник, 20 Ноябрь, 2017 12:58 ]
Заголовок сообщения:  Re: B01: HostFiles.NewWriter

My aim is to minimize the difference between Core, Center and CPC version. I realize there are different opinions. Now I have to decide which way to follow.
The current CPC version here is equal to the Center way. But I think your arguments are better and I will change the CPC edition to the Core solution.
That means I will change procedure NewWriter as you have done and delete the procedure Shared & Closed.

Автор:  Евгений Темиргалеев [ Вторник, 21 Ноябрь, 2017 18:43 ]
Заголовок сообщения:  Re: B01: HostFiles.NewWriter

Thank you, Helmut.

Now I see this correction made at 2015 and it's present in all 1.7 versions.

Код:
compiling "ipuiK86"
  Closed not implemented in File^
  Shared not implemented in File^
compiling "ipuiK128"
  Closed not implemented in File^
  Shared not implemented in File^
This is an amazed and important fact.

Автор:  Zinn [ Среда, 22 Ноябрь, 2017 00:27 ]
Заголовок сообщения:  Re: B01: HostFiles.NewWriter

Yes, it is a compatibility problem. Adding Closed and Shared means recompiling all subsystem and linking.
But this works only when you first link BlackBox, second recompile all module, third link BlackBox again. Otherwise link BlackBox doesn't work. Also all application subsystem outside BlackBox must be recompile.
The question is to be compatible with Center or not?

Автор:  Евгений Темиргалеев [ Среда, 22 Ноябрь, 2017 12:54 ]
Заголовок сообщения:  Re: B01: HostFiles.NewWriter

Zinn писал(а):
Also all application subsystem outside BlackBox must be recompile.
The question is to be compatible with Center or not?
And all file implementations outside BlackBox must be rewritten to include unnecessary Closed() & Shared(). As ipuiK86 & ipuiK128, for example.

We are thinking that the compatibility with Center is not a dogma. Therefor we maintaining OberoCore assembly for our own work.
http://oberoncore.ru/en/blackbox/oberon ... l_position

Автор:  Zinn [ Четверг, 23 Ноябрь, 2017 10:18 ]
Заголовок сообщения:  Re: B01: HostFiles.NewWriter

I have both version running and document the difference in B01-en
The Core changes are in green lines and the Center changes are in red lines.
How to improve this document?

Cpc-Edition 1.7.1711 build 154 uses the Center solution of B01
CPC-Edition 1.7.1711 build 155 uses the Core solution of B01

everything else is the same state and equivalent to Center Edition 1.7.1

Nothing is uploaded to CPC, but if you would like to have them for testing I can do it.

Вложения:
Комментарий к файлу: Draft of english documentation of B01
B01-en.odc [28.25 КБ]
Скачиваний: 365

Автор:  Евгений Темиргалеев [ Воскресенье, 26 Ноябрь, 2017 17:20 ]
Заголовок сообщения:  Re: B01: HostFiles.NewWriter

Zinn писал(а):
I have both version running and document the difference in B01-en
The Core changes are in green lines and the Center changes are in red lines.
How to improve this document?
I see the description of another solution. This is an improvement to have it in any delta.

But there is one detail. You change set description are based on another base set of documents.
OberonCore deltas Base = Ominc BlackBox or "Standard" (as we call) BlackBox.
But your change set describes Files64 changes, etc.

So, what do you mean with "improve", Helmut?

I can put you translation to our repository & include you description into main B01 doc.

Автор:  Zinn [ Понедельник, 27 Ноябрь, 2017 13:04 ]
Заголовок сообщения:  Re: B01: HostFiles.NewWriter

Sorry, improve is wrong word. I mean, I add some infos to the description and you may correct it in the way as you like.
But before you do that, please download the latest version of B01-en from http://www.zinnamturm.eu/downloads.htm
It would be nice when you insert it into your change folder.

Well, normally the change description should be based on BlackBox 1.6. That you have done in the first part of B01-en. Here I add to B01-en the documentation about the different solution between Core and Center. You may add some words why we prefer the Core solution.

Автор:  Евгений Темиргалеев [ Четверг, 30 Ноябрь, 2017 16:07 ]
Заголовок сообщения:  Re: B01: HostFiles.NewWriter

Цитата:
According to the specification (System/Docu/Files) in case of read-only files (shared) NewWriter should return NIL. The current implementation, however, generates a TRAP.

Then you open the file in shared mode with Files.dir.Old(), the file have an read-only property (or it is "immutable" as in specification).
But the reverse isn't true. The file with read-only property may be created by Files.dir.Old(), may be not.

Or one can say that for one specification you can have many implementations. So:
Цитата:
The Oberon Core solution (B01, green lines below) aligned the implementation (HostFiles) with the specification (Files).

The Center solution (Issue-#22, red lines below) aligned the specification (Files) with the implementation (HostFiles)...

I made some corrections to B01-en & upload it with change-list archive.

Автор:  Евгений Темиргалеев [ Понедельник, 22 Апрель, 2019 18:30 ]
Заголовок сообщения:  Re: B01: HostFiles.NewWriter

Товарищи, поделитесь опытом, пожалуйста.

Есть у кого-то реальные задачи, в которых проверяется состояние файла "только чтение" (f.NewWriter() = NIL) по эталонной документации.
Код:
IF f.NewWriter() = NIL THEN .... ELSE .... END


Существуют ли задачи для которых требуется проверять, что передан невалидный закрытый файл?
Код:
IF Закрыт(f) THEN .... ELSE .... END

Страница 1 из 1 Часовой пояс: UTC + 3 часа
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/