New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SYSTEM.THISREC, SYSTEM.THISARR and SYSTEM.TYP support #104
Comments
BlackBox suggests the undocumented functions *SYSTEM.THISRECORD* and
*SYSTEM.THISARRAY* . I implemented their full support in Ofront+. I also
implemented *SYSTEM.TYP*.
Sounds interesting. Is there any documentation on these new functions?
…On Wed, 28 Jul 2021 at 10:53, Oleg N. Cher ***@***.***> wrote:
To prevent the introduction of dangerous code, where even this is not very
clearly noticeable, in -7, - C and -3 modes were removed:
1. Compatibility a value of any type with ARRAY OF [SYSTEM].BYTE:
PROCEDURE Unpack (VAR d: ARRAY OF BYTE); (* In Oberon/Oberon-2 it is SYSTEM.BYTE *)
END Unpack;
PROCEDURE ConvertH* (VAR d: ARRAY OF SHORTCHAR); (* In Oberon/Oberon-2 it is ARRAY OF CHAR *)
BEGIN
(* Ofront/ voc and ETH Oberon allow such code. BlackBox does not: *)
Unpack(d) (* <-- err 66: element types of actual array and formal open array differ *)
END ConvertH;
1. Compatibility of any ARRAY with ARRAY OF [SYSTEM].BYTE:
PROCEDURE ReadBuf* (VAR b: ARRAY OF BYTE); (* In Oberon/Oberon-2 it is SYSTEM.BYTE *)
END ReadBuf;
PROCEDURE Read* (VAR ch: SHORTCHAR);
BEGIN
(* Ofront/ voc and ETH Oberon allow such code. BlackBox does not: *)
ReadBuf(SYSTEM.VAL(BYTE, ch)); (* <-- err 67: actual parameter corresponding to open array is not an array *)
END Read;
Allowing of such tricks can be justified by the fact that the BYTE type in
Oberon/Oberon-2 is system, but not in Component Pascal and Oberon-07.
Therefore, we should keep the ability to pass arrays of incompatible types
and simple elements as arrays, but we will do it more explicitly. BlackBox
suggests the undocumented functions *SYSTEM.THISRECORD* and
*SYSTEM.THISARRAY* . I implemented their full support in Ofront+. I also
implemented *SYSTEM.TYP*.
Advantages:
- improved compatibility with BlackBox;
- removed warnings when build the Ofront+ library.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#104>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAHULDJQ6IF3XMYK6UXASNLTZ5WMBANCNFSM5BDN6SMQ>
.
|
SYSTEM.THISARRAY(adr: ADRINT; len: INTEGER): ARRAY OF ... - used in a list of actual parameters. Allows to pass the memory area at the address adr as array of expected type. The element type will match the required element type of the array parameter. The length of the array (the number of elements) will be len. SYSTEM.THISRECORD(adr, type_tag: ADRINT): RECORD ... - allows to pass the memory area as record of the specified type. See example in BlackBox/System/Meta |
Eh... I like the names THISARR / THISREC better than THISARRAY / THISRECORD. But for compatibility with BlackBox, I need to follow the second way. Although in the BlackBox itself there is ANYREC type, and not ANYRECORD. |
To prevent the introduction of dangerous code, where even this is not very clearly noticeable, in -7, - C and -3 modes were removed:
Allowing of such tricks can be justified by the fact that the BYTE type in Oberon/Oberon-2 is system, but not in Component Pascal and Oberon-07. Therefore, we should keep the ability to pass arrays of incompatible types and simple elements as arrays, but we will do it more explicitly. BlackBox suggests the undocumented functions SYSTEM.THISRECORD and SYSTEM.THISARRAY. I implemented their full support in Ofront+. I also implemented SYSTEM.TYP.
Advantages:
The text was updated successfully, but these errors were encountered: