Hi,
Author of OBNC here.
Post by d***@gmail.comI am using Ubuntu 16.04.2 x86_64. The install went very smoothly.
I'm glad to hear that.
Post by d***@gmail.com1. What is the bit size for INTEGER and REAL on my machine? If they are
not 64 and 80 bits, is there any way to get data of that size?
INTEGER maps to int and REAL to double. You can see the generated C
files in the hidden .obnc directory. INTEGER, REAL and BYTE are the only
numeric types available in OBNC.
Post by d***@gmail.comIs there a workaround for the functionality of HALT, EXIT and
SIZE in Oberon 2 ?
As mentioned by Chris, HALT has been eliminated in favor of ASSERT(FALSE).
A LOOP statement (with EXIT) can be rewritten as a WHILE statement with
a loop guard named `done' or similar.
For implementations which support the (optional) module SYSTEM you
typically get the size of a type with SYSTEM.SIZE. OBNC, however, does
not implement a SYSTEM module because all low-level/non-portable code is
supposed to be written in C.
Below is an example of how to get the size of INTEGER and REAL using
OBNC. You can get a template for Limits.c by copying .obnc/Limits.c to
the current directory. See also the section "Interfacing to C" in `man
obnc'.
Limits.obn:
MODULE Limits;
VAR
integerSize*: INTEGER;
realSize*: INTEGER;
END Limits.
Limits.c:
#include <obnc/OBNC.h>
#include ".obnc/Limits.h"
int Limits_integerSize_;
int Limits_realSize_;
void Limits_Init(void)
{
Limits_integerSize_ = sizeof (int);
Limits_realSize_ = sizeof (double);
}
Test.obn:
MODULE test;
IMPORT Limits, Out;
BEGIN
Out.String("size of INTEGER: ");
Out.Int(Limits.integerSize, 0);
Out.Ln;
Out.String("size of REAL: ");
Out.Int(Limits.realSize, 0);
Out.Ln;
END test.
Regards,
Karl