[Oberon] Win32 Plugin Oberon, status report II

John Drake jmdrake_98 at yahoo.com
Mon Mar 17 17:52:29 CET 2003


--- Felix Friedrich <friedrich at gsf.de> wrote:
> I am currently working at the core of the new
> PluginOberon, parts are 
> AosIO, Filesystems etc., so I think when this is
> done, porting WebDAV 
> shouldn't make any problems (hopefully).
> I would have expected, that AosIO works with
> NativeOberon also, since it 
> doesn't contain any active Object keywords (like
> AWAIT, EXCLUSIVE etc.)
> What kind of problems occured when you tried to
> assign the Sender variable ?
> 
> Cheers, Felix.

AosIO does include the active oberon specific
keyword "DELEGATE".  It's easy to miss this 
because it has (apparently) nothing to do with
multitasking.  Instead it's used to allow
assigning of procedure variables to methods.
Specifically:

TYPE
  Sender* = PROCEDURE {DELEGATE} (VAR buf......)

In my port of AosIO I defined Sender using the
normal Oberon procedure type syntax:

TYPE
  Sender* = PROCEDURE (VAR buf.....)

But in retrospect I probably should have just
taken Sender and Receiver out of the port to
avoid confusion.

Anyway the "workaround" is to simply not
use procedure variables and just use the
built in type hierarchy.  For example AosIO
defines and object class Writer.  The
constructor InitWriter takes a sender 
variable:

PROCEDURE &InitWriter(send: Sender; size: LONGINT);

I ignore the sender variable and redefine
this as:

PROCEDURE &InitWriter(size: LONGINT);

Instead of passing the sender procedure to
the object at creation, I just use the sender
and receiver methods defined inside the
object.  While assigning procedure variable
to method variables might add flexibility,
it seems redundant to me and a throwback
to Oberon-1.  Anyway it just doesn't work
under Native Oberon.  I tested module
AosFS (which I also ported) just to make
sure that my ideas worked.  Here's the
code:

MODULE TestAosFS;

IMPORT
  AosFS, Out,  AosIO;

CONST
  filename = "TestAosFS.Mod";
		
PROCEDURE Do*;
VAR
  f: AosFS.File; r: AosFS.Reader; ch : CHAR;
  count : INTEGER;
	
BEGIN
  count := 0;
  f := AosFS.Old(filename);
  IF f # NIL THEN
    AosFS.OpenReader(r, f, 0);
    LOOP
      AosIO.Read(r, ch);
      IF r.res # AosIO.Ok THEN EXIT END;
      IF ch = ";" THEN INC(count); END;
    END;
  END;
  Out.Int(count, 5); Out.Ln();
END Do;

END TestAosFS.
TestAosFS.Do

All this does is counts the number of
semicolons in a text file.  While this
is not very useful, it does show that
the AosFS port does work even without
using the Sender and Receiver procedure
types.

Regards,

John M. Drake

__________________________________________________
Do you Yahoo!?
Yahoo! Web Hosting - establish your business online
http://webhosting.yahoo.com



More information about the Oberon mailing list