[Oberon] identity of two VARs

Dan Parnete dan.parnete at fastwebnet.it
Wed Sep 14 19:14:15 CEST 2005


Douglas G. Danforth wrote:

> Folks,
> One benefit of Component Pascal over Oberon is this distinction on 
> strings. The symbol '$' is introduced to designate the contents of a 
> string array as contrasted to the pointer to the array.  If x is a 
> pointer to an array of characters then x$ are the characters to which 
> x points.  Hence comparisons of the type x=y and x$=y$ are different!
> -Doug
>
> Wehrli Lior wrote:
>
>> 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
>>
>> -- 
>> Oberon at lists.inf.ethz.ch mailing list for ETH Oberon and related systems
>> https://www.mail.inf.ethz.ch/lists/listinfo/oberon
>>
>>
> -- 
> Oberon at lists.inf.ethz.ch mailing list for ETH Oberon and related systems
> https://www.mail.inf.ethz.ch/lists/listinfo/oberon
>
Is the same for Oberon if you use x, y: POINTER TO ARRAY OF CHAR.
x = y is different of x^ = y^, isn't it?

Dan Parnete



More information about the Oberon mailing list