<table cellspacing="0" cellpadding="0" border="0" ><tr><td valign="top" style="font: inherit;">Hi all:<br>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?).<br>Thanks in advance<br><br>--- El <b>mar, 26/6/12, Dragiša Durić <i><dragisha@m3w.org></i></b> escribió:<br><blockquote style="border-left: 2px solid rgb(16, 16, 255); margin-left: 5px; padding-left: 5px;"><br>De: Dragiša Durić <dragisha@m3w.org><br>Asunto: [M3devel] AND (…, 16_ff)… Not serious - or so I hope!<br>Para: "m3devel" <m3devel@elegosoft.com><br>Fecha: martes, 26 de junio, 2012 05:18<br><br><div class="plainMail">This piece of code, from TextClass.m3, disturbs me… a lot.<br><br>If we are to use WIDECHAR, I think we must be a lot more serious
than this.<br><br>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.<br><br>Probably by someone whose mother tongue is fully writeable with ASCII :).<br><br>====<br>PROCEDURE GetChars (t: TEXT; VAR a: ARRAY OF CHAR; start: CARDINAL) =<br> VAR<br> info : Info;<br> cnt : INTEGER;<br> next : CARDINAL := 0;<br> buf : ARRAY [0..127] OF WIDECHAR;<br> BEGIN<br> t.get_info (info);<br> cnt := MIN (NUMBER (a), info.length - start);<br> WHILE (cnt > 0) DO<br> t.get_wide_chars (buf, start);<br> FOR i := FIRST (buf) TO LAST (buf) DO<br> IF (cnt = 0) THEN RETURN END;<br>
a[next] := VAL (Word.And (ORD (buf[i]), 16_ff), CHAR);<br> INC (next); DEC (cnt);<br> END;<br> INC (start, NUMBER (buf));<br> END;<br> END GetChars;<br>====<br><br></div></blockquote></td></tr></table>