[Oberon] PO2013 - Show Heap Blocks

John R. Strohm strohm at airmail.net
Sat Jun 20 00:22:49 CEST 2020


I think Wojciech was being sarcastic in that comment.

--- fp at vonck.nl wrote:

From: Frans-Pieter Vonck <fp at vonck.nl>
To: ETH Oberon and related systems <oberon at lists.inf.ethz.ch>
Subject: Re: [Oberon] PO2013 - Show Heap Blocks
Date: Fri, 19 Jun 2020 21:48:41 +0200

> It would be very useful for importing the .h files into Oberon modules. 
> Being able to #define the constant addresses and other constants in the 
> sysdef.h > and then #include'ing it in low level modules would help to 
> elegantly clean the mess which low level Oberon modules are right now.

Please don't.
Look how the low level modules are written in Astrobe.
They are readable.
For a better insight how external compilers can complicate things, join 
the tinygo slack channel.
Better to invest time in writing a writer in Oberon than importing C.

Could you give an example of the messy lowlevel modules your are 
mentioning?

Greets,
F.P. Vocnk

Skulski, Wojciech schreef op 2020-06-19 18:19:
> Joerg:
> 
> nice!
> 
> Did you also implement #include ? It would be very useful for
> importing the .h files into Oberon modules. Being able to #define the
> constant addresses and other constants in the sysdef.h and then
> #include'ing it in low level modules would help to elegantly clean the
> mess which low level Oberon modules are right now.
> 
> I am looking forward to see the implementation!
> 
> Wojtek
> ________________________________________
> From: Oberon [oberon-bounces at lists.inf.ethz.ch] on behalf of Jörg
> [joerg.straube at iaeth.ch]
> Sent: Friday, June 19, 2020 11:43 AM
> To: ETH Oberon and related systems
> Subject: [EXTERNAL]  Re: [Oberon] PO2013 - Show Heap Blocks
> 
> John
> 
> In case you're interested, here the code:
> 
> PROCEDURE printf*(s: ARRAY OF CHAR; i1, i2: INTEGER; str: ARRAY OF 
> CHAR);
>         (* supported format %[length]type, type = d, i, x or s, and
> escape characters \n, \t *)
>         VAR n, j, len, par, x: INTEGER; ch, nxCh: CHAR; imm: BOOLEAN;
>         BEGIN
>                 imm := immediate; immediate := FALSE;
>                 par := 1; n := 0; ch := s[0];
>                 WHILE (ch # 0X) & (n < LEN(s)) DO
>                         j := n+1; nxCh := s[j];
>                         IF ch = "%" THEN
>  (* handle format *)
>                                 len := 0;
>                                 WHILE ("0" <= nxCh) & (nxCh <= "9") DO
> len := len * 10 + ORD(nxCh) - ORD("0"); INC(j); nxCh := s[j] END;
>                                 IF nxCh = "s" THEN String(str); INC(j)
>                                 ELSIF (nxCh # "d") & (nxCh # "i") &
> (nxCh # "x") THEN Char("%")
>                                 ELSE
>                                         x := i2; IF par = 1 THEN x :=
> i1 END; INC(par);
>                                         IF nxCh = "x" THEN Hex(x) ELSE
> (* i, d *) Int(x, len) END;
>                                         INC(j)
>                                 END
>                         ELSIF ch = "\" THEN                     (*
> handle escape characters *)
>                                 IF nxCh = "n" THEN Ln; INC(j)
>                                 ELSIF nxCh = "t" THEN Char(9X); INC(j)
>                                 ELSE Char("\")
>                                 END
>                         ELSE
>                                 Char(ch)
>                         END;
>                         n := j; ch := s[n]
>                 END;
>                 immediate := imm
>         END printf;
> 
> Am 19.06.20, 17:23 schrieb "Joerg" <joerg.straube at iaeth.ch>:
> 
>     John
> 
>     Seems like variadic but it is not.
>     printf() has fix 4 arguments as I found out that this is enough
> for most cases. the first is the string with formatting commands, then
> two INTEGERs and one string (for a filename or so)
> 
>     If after a % there is a number, d, h or s it’s interpreted as
> argument else it’s just a %.
> 
>     br
>     Jörg
> 
>     > Am 19.06.2020 um 16:56 schrieb John R. Strohm 
> <strohm at airmail.net>:
>     >
>     > Out.printf(), with VARIADIC arguments, in Oberon???
>     >
>     > And that %d%) bothers me, for some reason...
>     >
>     > --- joerg.straube at iaeth.ch wrote:
>     >
>     > From: Jörg <joerg.straube at iaeth.ch>
>     > To: ETH Oberon and related systems <oberon at lists.inf.ethz.ch>
>     > Subject: Re: [Oberon] PO2013 - Show Heap Blocks
>     > Date: Fri, 19 Jun 2020 10:37:08 +0200
>     >
>     > Tomas
>     >
>     > The following line will give you the stats as well:
>     >  Out.printf(“Heap space used: %d bytes (=%d%)\n“,
>     >    Kernel.allocated,
>     >    Kernel.allocated * 100 DIV (Kernel.heapLim - Kernel.heapOrg), 
> ““);
>     >
>     > That‘s basically what System.Watch does.
>     >
>     > br
>     > Jörg
> 
> --
> Oberon at lists.inf.ethz.ch mailing list for ETH Oberon and related 
> systems
> https://lists.inf.ethz.ch/mailman/listinfo/oberon
--
Oberon at lists.inf.ethz.ch mailing list for ETH Oberon and related systems
https://lists.inf.ethz.ch/mailman/listinfo/oberon




More information about the Oberon mailing list