home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / comp / lang / modula2 / 1546 next >
Encoding:
Internet Message Format  |  1992-12-11  |  940 b 

  1. Path: sparky!uunet!cs.utexas.edu!zaphod.mps.ohio-state.edu!pacific.mps.ohio-state.edu!linac!att!ucbvax!ESSEX.STFX.CA!andrea
  2. From: andrea@ESSEX.STFX.CA (John Andrea)
  3. Newsgroups: comp.lang.modula2
  4. Subject: RE: DOS compilers
  5. Message-ID: <00964EF9.ED4454E0.16140@esseX.stfx.ca>
  6. Date: 11 Dec 92 19:29:38 GMT
  7. Sender: daemon@ucbvax.BERKELEY.EDU
  8. Reply-To: Modula2 List <INFO-M2%UCF1VM.BITNET@uga.cc.uga.edu>
  9. Distribution: world
  10. Organization: The Internet
  11. Lines: 25
  12.  
  13. >Woody  asks
  14. >I need a DOS Modula-2 compiler that will pack subranges, for example,
  15. >[0..255] would be stored in 1 BYTE.  The compiler that I ues store it as an
  16. >INTEGER.
  17.  
  18. For a case like this i just use an ordinary character as a byte value
  19. then do the conversions with the standard built in functions.
  20.  
  21. VAR
  22.   c :CHAR;
  23.   i :CARDINAL;
  24.  
  25. BEGIN
  26.  
  27.   i := 100;
  28.  
  29.   c := CHR( i );
  30.  
  31.   i := ORD( c );
  32.  
  33.   WriteCard( i, 0 );
  34.     -----------> should show "100"
  35.  
  36. John Andrea
  37. andrea@essex.stfx.ca
  38.