[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Beta: oo2c with LONGCHAR



I have uploaded a test version of oo2c with LONGCHAR to

  http://pweb.de.uu.net/vanacken.do/ooc/beta

Both a full version and a patch relative to 1.4.0 (~150K) are
available.  Access to this site should be good from most parts of the
world.  Please drop me a note if you can't connect to it.

My own tests show that the compiler still compiles itself, and also
that VO seems to be in working order, even after the extensive
LONGCHAR changes to the compiler's infrastructure.  I intend to turn
this version into oo2c-1.4.1 in a few weeks.  Please give it a try.


The list of new features:

o Extended CAP(CHAR) to deal with the full range of ISO-Latin-1.  

o Added concatenation of string constants using the operator `+'.

o Added support of LONGCHAR character type.  See Eric's summary on the
  mailing list for the details.

o Added module `LongStrings'.

o New optimization that checks if a value parameter of structured type
  can be accessed without creating a local copy for the called
  procedure.  This can greatly improve the execution time of
  procedures from modules `Strings' and `LongStrings'.

o Introduced system flag `NO_COPY'.  This is the manual version of the
  optimization described above.  When set for a value parameter of
  structured type, invocation of the procedure will not create a local
  copy of the parameter.  Used in some I/O modules to avoid multiple,
  but completely useless, copies of string argument during execution
  of, e.g., Out.String.

o Some fixes for oo2c_64 running on Digital Unix systems.  There are
  still some problems remaining, though.  I hope to get access to an
  Alpha machine, so that I can solve these problems in the near
  future.

Attached are two modules showing what can and what can't be done with
LONGCHAR and wide string constants.

-- mva



MODULE TestLongChar0; (* some things that can't be done with LONGCHAR *)

IMPORT
  Out;
  
CONST
  char8* = "A";
  char16* = 0C0ACX;

CONST
  string8 = "ab cd";
  string16 = 0C0ACX + 0C6A9X + " " + 0C2E4X + 0D328X;

CONST
  badConst = SHORT (string16);   (* not a valid string8 *)
  badConst8 = SHORT (string8);   (* can't get shorter *)
  badConst16 = LONG (string16);  (* can't get longer *)

VAR
  var8: CHAR; array8: ARRAY 16 OF CHAR;
  var16: LONGCHAR; array16: ARRAY 16 OF LONGCHAR;
BEGIN
  var8 := char16;  (* can't assign LONGCHAR to CHAR *)
  var8 := 0C0ACX;  (* can't assign LONGCHAR to CHAR *)
  
  array8 := string16;  (* can't assign string16 to string8 *)
  COPY (string16, array8);  (* can't assign string16 to string8 *)
  
  Out.Bool (array16 < array8); (* can't compare string8 with string16 *)
END TestLongChar0.


MODULE TestLongChar1; (* some things that can be done with LONGCHAR *)

IMPORT
  Out, LongStrings;
  
CONST
  char8* = "A";
  char16* = 0C0ACX;

CONST
  cChar8* = SHORT (LONG (char8));
  cChar16* = LONG (char8);
  
CONST
  string8* = "ab cd";
  string8x* = 0FFX+0FFX;
  string16* = 0C0ACX + 0C6A9X + " " + 0C2E4X + 0D328X;
  string16x* = 0FFF0X+0FFF0X;

CONST
  cString8* = SHORT (LONG (string8));
  cString16* = LONG (string8);

CONST
  boolEql0* = char8 = char8;
  boolEql1* = char8 = char16;
  boolEql2* = char16 = char8;
  boolEql3* = char16 = char16;
  boolEql4* = string8 = string8;
  boolEql5* = string8 = string16;
  boolEql6* = string16 = string8;
  boolEql7* = string16 = string16;
  
CONST
  boolLss0* = char8 < char8;
  boolLss1* = char8 < char16;
  boolLss2* = char16 < char8;
  boolLss3* = char16 < char16;
  boolLss4* = string8 < string8;
  boolLss5* = string8 < string16;
  boolLss6* = string16 < string8;
  boolLss7* = string16 < string16;
  boolLss8* = string8x < string16;
  boolLss9* = string16x > string8x;


VAR
  var8: CHAR; array8: ARRAY 16 OF CHAR;
  var16: LONGCHAR; array16: ARRAY 16 OF LONGCHAR;
BEGIN
  var8 := "a"; var8 := char8;
  var16 := "a"; var16 := char16;
  
  var16 := char8;
  var16 := var8;
  
  Out.LongInt (ORD (var8), 0); Out.Ln;
  Out.LongInt (ORD (var16), 0); Out.Ln;
  
  array8 := "a";
  array8 := char8;
  array8 := string8;
  array8 := string8x;
  array8 := cString8;
  
  array16 := "a";
  array16 := char16;
  array16 := string16;
  array16 := string16x;
  array16 := cString16;
  
  COPY ("a", array16);
  COPY (char8, array16);
  COPY (0C0ACX, array16);
  COPY (char16, array16);
  
  Out.LongInt (ORD (array8[0]), 0); Out.Ln;
  Out.LongInt (ORD (array16[0]), 0); Out.Ln;

  COPY (string8, array16);
  COPY (string16, array16);
  
  Out.LongInt (ORD (array8[0]), 0); Out.Ln;
  Out.LongInt (ORD (array16[0]), 0); Out.Ln;

  Out.Bool (array8 < 20X); Out.Ln;
  Out.Bool (array16 < 20X); Out.Ln;
  
  Out.Int (LongStrings.Length (string16), 0); Out.Ln;
END TestLongChar1.