[comp.lang.modula2] Sun Modula-2 Concat

allen@brc.ubc.ca (11/29/90)

Has anyone else had problems with the Concat function on
the Sparc series of SUN workstations (SUNOS4.1)?
Modula-2 Version 2.2.2

Try this code:
----------------------
MODULE t;
FROM String IMPORT Assign,Concat;
FROM SimpleIO IMPORT WriteString,WriteLn;
VAR
  result:ARRAY [0..255] OF CHAR;
  rcode:BOOLEAN;
BEGIN
  Assign("bbb",result,rcode);
  WriteString(result);
  WriteLn;

  Concat("aaa",result,result,rcode);

  IF NOT rcode THEN
    WriteString("Failed");
    WriteLn;
  END;

  WriteString(result);
  WriteLn;
END t.
----------------------

The Concat function returns false and fails, corrupting the result
string, on a sparc. The same code succeeds on a SUN 3/60.

Does anyone have an in with SUN to know if a patch is available.

-- 
Allen Delaney (allen@brc.ubc.ca)
Biomedical Research Centre, U.B.C., Vancouver, B.C. Canada, V6T 1W5

aubrey@ccwf.cc.utexas.edu (Aubrey McIntosh) (11/29/90)

In article <1990Nov28.210844.10063@brc.ubc.ca> allen@brc.ubc.ca () writes:
>Has anyone else had problems with the Concat function on
>the Sparc series of SUN workstations (SUNOS4.1)?
>Modula-2 Version 2.2.2
>
>Try this code:

Here's a workaround in case your Concat is pervasive and you
don't want to muck in your source too much.

--------------------------------------------------------------------------

MODULE t;
FROM String IMPORT Assign;
IMPORT String;
FROM SimpleIO IMPORT WriteString,WriteLn;

(*
 * ...so then the C programmer says:
 * "if you make them VAR parameters,
 *  it'll run 10 times faster!"
 * :-)
 *)

PROCEDURE Concat(     first, second : ARRAY OF CHAR;
	          VAR out : ARRAY OF CHAR;
                      ok  : BOOLEAN );
BEGIN
  String.Concat( first, second, out, ok)
END Concat;

(*===============================================*)

VAR
  result:ARRAY [0..255] OF CHAR;
  rcode:BOOLEAN;
BEGIN
  Assign("bbb",result,rcode);
  WriteString(result);
  WriteLn;

  Concat("aaa",result,result,rcode);

  IF NOT rcode THEN
    WriteString("Failed");
    WriteLn;
  END;

  WriteString(result);
  WriteLn;
END t.
-- 
Aubrey McIntosh  /  Chemistry  /  University of Texas  /  Austin, TX 78712

Most people on USENET will know you only by what you say and how well you
  say it.   --- chuq@sun.COM (Chuq Von Rospach)