[Oberon] identity of two VARs

Wehrli Lior wehrlil at student.ethz.ch
Wed Sep 14 18:08:58 CEST 2005


I think this should be better:
IF SYSTEM.ADR(source[0]) = SYSTEM.ADR(target[0]) THEN...

Lior

-----Original Message-----
From: oberon-bounces at lists.inf.ethz.ch on behalf of Gérard Meunier
Sent: Wed 9/14/2005 6:06 PM
To: ETH Oberon and related systems
Subject: Re: [Oberon] identity of two VARs
 
shark at gulfnet.sd64.bc.ca a écrit :

>Here is a simple problem which I've never had to solve until now.
>
>PROCEDURE Identical*(VAR source, target: ARRAY OF CHAR):integer;
>(* Return 0, 1, 2 or 3 according to identity of location and 
>   identity of content strings. *)
>VAR 
>	identicallocation, identicalcontent: INTEGER;
>BEGIN
>	IF ?? THEN (* source and target are the same array *)
>		identicallocation := 1 ELSE identicallocation := 0 
>	END;
>	IF source = target THEN (* the strings in source and target match. *)
>		identicalcontent := 1 ELSE identicalcontent := 0 
>	END;
>	RETURN((2*identicalcontent)+identicallocation)
>END Identical;
>
>More briefly,
>PROCEDURE Identical*(VAR source, target: ARRAY OF CHAR):integer;
>BEGIN
>	RETURN((2*(source=target))+??)
>END Identical;.
>
>What should I put in place of ?? to have this work?
>
>Thanks,        ... Peter E.
>
>
>Desktops.OpenDoc  http://carnot.pathology.ubc.ca/
>
>--
>Oberon at lists.inf.ethz.ch mailing list for ETH Oberon and related systems
>https://www.mail.inf.ethz.ch/lists/listinfo/oberon
>  
>
Hello Peter,

IF SYSTEM.ADR(source) = SYSTEM.ADR(target) THEN...

should work, I suppose.

Cheers.

Gérard
--
Oberon at lists.inf.ethz.ch mailing list for ETH Oberon and related systems
https://www.mail.inf.ethz.ch/lists/listinfo/oberon




More information about the Oberon mailing list