Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!utgpu!water!watmath!clyde!rutgers!mit-eddie!uw-beaver!uw-june!geops!rainy!harry From: harry@rainy.UUCP Newsgroups: comp.lang.c Subject: Re: Query: Implementation with non-zero NULL Message-ID: <106@rainy.UUCP> Date: Tue, 2-Jun-87 13:24:25 EDT Article-I.D.: rainy.106 Posted: Tue Jun 2 13:24:25 1987 Date-Received: Thu, 4-Jun-87 06:10:41 EDT References: <158@delftcc.UUCP> <20028@sun.uucp> <186@gass.UUCP> Organization: Dept. of Atmospheric Sciences, U. of Washington Lines: 39 Keywords: C, NULL, portability Summary: Prime NULL At rev 20.2.2 of Primos (and 2.0 of Primix) a NULL pointer has a value of 0. Also, pointers are now 32 bits long. However, sloppy C code still does not work because pointer arithmetic is different than integer arithmetic. The 32 bit C pointers on Prime are actually similar to Prime's 32 bit word pointers (one word is 16 bits). The structure of the pointer is as follows (with bit 0 being the lsb) bits 31 - Fault bit (1 => point fault is generated when this address is used) 30 - 29 - Ring bits 28 - 0 => left byte of word 1 => right byte of word 27 - 16 - segment number 15 - 0 - word number As you can see, if you treat a pointer as an integer and add 1, you increment it one word (two bytes). However, if it remains a pointer, the Prime will do the pointer arithmetic correctly. The other comments about I/O are correct. Prime stores ASCII files with the high order bit on for each byte. In addition, blanks are compressed (a byte of 220 (octal) followed a byte indicating the number of blanks). Finally lines in Prime ASCII files end with a 212 (octal) and are padded with a null is the line terminates in the middle of a word. The stdio is supposed to expand this automatically when reading if you tell it to. However, it is not bug free in Primix. For example, if you size an ASCII file using stat, open it and read to the end, and then size is again before closing, you end up with TWO different sizes for the same file :-( In general, working with Primix is a pain in the neck. The C compiler is okay, but the preprocessor cannot handle the "defined(A)" construct! Working with a real Unix machine is much easier! -- Harry Edmon UUCP: harry@erbe.geo.washington.edu or (206) 543-0547 uw-beaver!geops!rainy!harry Department of Atmospheric Sciences University of Washington BITNET: 24440@UWACDC