[M3devel] AND (…, 16_ff)… Not serious - or so I hope!

Daniel Alejandro Benavides D. dabenavidesd at yahoo.es
Tue Jun 26 14:47:31 CEST 2012


Hi all:
copied that, but interface TextClass GetChars is kind of different from GetChar in Text. I can't see the interrelation
Thanks in advance

--- El mar, 26/6/12, Dragiša Durić <dragisha at m3w.org> escribió:

De: Dragiša Durić <dragisha at m3w.org>
Asunto: Re: [M3devel] AND (…, 16_ff)… Not serious - or so I hope!
Para: "Daniel Alejandro Benavides D." <dabenavidesd at yahoo.es>
CC: "m3devel" <m3devel at elegosoft.com>
Fecha: martes, 26 de junio, 2012 07:27

If you cared to read, for example Text.i3, you would see this is exactly what cm3 people meant to be.
On Jun 26, 2012, at 2:12 PM, Daniel Alejandro Benavides D. wrote:
Hi all:
Maybe is a left over of older code (almost just used a decade ago) but if not, then this meant to be just a partial implementation? If we are to get serious about memory usage seems over strict (or just in case you don't need system NIL terminated widechars be checked?).
Thanks in advance

--- El mar, 26/6/12, Dragiša Durić <dragisha at m3w.org> escribió:

De: Dragiša Durić <dragisha at m3w.org>
Asunto: [M3devel] AND (…, 16_ff)… Not serious - or so I hope!
Para: "m3devel" <m3devel at elegosoft.com>
Fecha: martes, 26 de junio, 2012 05:18

This piece of code, from TextClass.m3, disturbs me… a lot.

If we are to use WIDECHAR, I think we must be a lot more serious
 than this.

Probably, text pieces are limited to 128 bytes by design, somewhere. But - whose idea was to "narrow" by ignoring everything except 8 LSB's? By mapping set of 2^20 elements to set of 2^8 elements.

Probably by someone whose mother tongue is fully writeable with ASCII :).

====
PROCEDURE GetChars (t: TEXT;  VAR a: ARRAY OF CHAR;  start: CARDINAL) =
 VAR
   info : Info;
   cnt  : INTEGER;
   next : CARDINAL := 0;
   buf  : ARRAY [0..127] OF WIDECHAR;
 BEGIN
   t.get_info (info);
   cnt := MIN (NUMBER (a), info.length - start);
   WHILE (cnt > 0) DO
     t.get_wide_chars (buf, start);
     FOR i := FIRST (buf) TO LAST (buf) DO
       IF (cnt = 0) THEN RETURN END;
   
    a[next] := VAL (Word.And (ORD (buf[i]), 16_ff), CHAR);
       INC (next);  DEC (cnt);
     END;
     INC (start, NUMBER (buf));
   END;
 END GetChars;
====


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://m3lists.elegosoft.com/pipermail/m3devel/attachments/20120626/4cf3329f/attachment-0002.html>


More information about the M3devel mailing list