RE: Component Pascal wish list

From: Treutwein Bernhard <EX:/O=ZUV/OU=FIRST>
Date: Tue, 25 Jun 2002 12:33:32 +0000

----boundary-LibPST-iamunique-2021514370_-_-
Content-type: text/plain

> You are also right about Fortran lacking unsigned
> integers. I had gotten so used to them that I forgot.
> That doesn't help when you are trying to read a file of
> unsigned integers, but I have no doubt that Component
> Pascal has some typecasting method of reading such files.
>

if I understand you correct, you want to read a binary file
of unsigned integers (beware of the endian problem) into a
twodimensional array as image. That is definitely low level
stuff, but the casting might be done (very ugly and of course
low level) by:

MODULE PrivUgly;

IMPORT SYSTEM, Out;

TYPE
        Casting = RECORD [union]
                highword, unsigned : SHORTINT;
                signed : INTEGER
        END;
        
PROCEDURE Do*;
        VAR
                cast : Casting;
        BEGIN
                cast.highword := 0;
                cast.signed := MAX(SHORTINT) - MIN(SHORTINT);
                Out.String("MAX(unsigned16) = "); Out.Int(cast.signed, 0 ); Out.Ln
END Do;
                
END PrivUgly.Do

The Output is as expected:

MAX(unsigned16) = 65535

regards
--
	Bernhard Treutwein, IuK, Ref. III A 3
	Bernhard.Treutwein{([at]})nowhere.xy----boundary-LibPST-iamunique-2021514370_-_-
Content-type: application/rtf
Content-transfer-encoding: base64
Content-Disposition: attachment; filename="rtf-body.rtf"
e1xydGYxXGFuc2lcYW5zaWNwZzEyNTJcZnJvbXRleHQgXGRlZmYwe1xmb250dGJsDQp7XGYwXGZz
d2lzcyBBcmlhbDt9DQp7XGYxXGZtb2Rlcm4gQ291cmllciBOZXc7fQ0Ke1xmMlxmbmlsXGZjaGFy
c2V0MiBTeW1ib2w7fQ0Ke1xmM1xmbW9kZXJuXGZjaGFyc2V0MCBDb3VyaWVyIE5ldzt9fQ0Ke1xj
b2xvcnRibFxyZWQwXGdyZWVuMFxibHVlMDtccmVkMFxncmVlbjBcYmx1ZTI1NTt9DQpcdWMxXHBh
cmRccGxhaW5cZGVmdGFiMzYwIFxmMFxmczIwID4gICAgICAgICBZb3UgYXJlIGFsc28gcmlnaHQ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x0YWIgXHBh
cg0KUFJPQ0VEVVJFIERvKjtccGFyDQpcdGFiIFZBUlxwYXINClx0YWIgXHRhYiBjYXN0IDogQ2Fz
dGluZztccGFyDQpcdGFiIEJFR0lOXHBhcg0KXHRhYiBcdGFiIGNhc3QuaGlnaHdvcmQgOj0gMDtc
cGFyDQpcdGFiIFx0YWIgY2FzdC5zaWduZWQgOj0gTUFYKFNIT1JUSU5UKSAtIE1JTihTSE9SVElO
VCk7XHBhcg0KXHRhYiBcdGFiIE91dC5TdHJpbmcoIk1BWCh1bnNpZ25lZDE2KSA9ICIpOyBPdXQu
SW50KGNhc3Quc2lnbmVkLCAwICk7IE91dC5MblxwYXINCkVORCBEbztccGFyDQpcdGFiIFx0YWIg
XHBhcg0KRU5EIFByaXZVZ2x5LkRvXHBhcg0KXHBhcg0KVGhlIE91dHB1dCBpcyBhcyBleHBlY3Rl
ZDpccGFyDQpccGFyDQpNQVgodW5zaWduZWQxNikgPSA2NTUzNVxwYXINClxwYXINCnJlZ2FyZHNc
cGFyDQotLVxwYXINClx0YWIgQmVybmhhcmQgVHJldXR3ZWluLCBJdUssIFJlZi4gSUlJIEEgM1xw
YXINClx0YWIgQmVybmhhcmQuVHJldXR3ZWluQHZlcndhbHR1bmcudW5pLW11ZW5jaGVuLmRlfX0A
EQAAAA==
----boundary-LibPST-iamunique-2021514370_-_---
Received on Tue Jun 25 2002 - 14:33:32 UTC

This archive was generated by hypermail 2.3.0 : Thu Sep 26 2013 - 06:29:40 UTC