[Oberon] identity of two VARs

Gérard Meunier gemeu at free.fr
Wed Sep 14 18:06:17 CEST 2005


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



More information about the Oberon mailing list