* Last processed by NICE on 12-Jun-2000 15:44:00 * Customized for : IEEE, LINUX, UNIX, MOTIF, F77 C----------------------------------------------------------------- c c All addresses, either returned by the system following a call to c SIC_GETVM, or computed using the loc() function, are conveyed in c the program(s) as an offset in an array of INTEGERS named MEMORY. c c The software is built on 4-byte integers and reals, and SIC_GETVM c allocates memory by multiples of 4 bytes. Usually one computes the c offset as c INCLUDE 'inc:memory.inc' c INTEGER(KIND=NATURAL_SIZE_OF_THE_MACHINE) IP,POINTER,ADDRESS c ( ... ) c IP=POINTER(ADDRESS,MEMORY) c Afterwards, the adress is "recalled" as MEMORY(IP). c It is possible to perform some algebra on the adresses (ADDRESS) or c the pointers (IP), such as IP=IP+1 => MEMORY(IP) will point c 1*4 bytes later, i.e., on another R*4 if IP was already "remembering" c the address of an R*4. c c It would have been equivalent to compute ADDRESS=ADDRESS+4, then c IP=POINTER(ADDRESS,MEMORY). c It is then evident that working on adresses and IPs is NOT the c same. Since the POINTER/MEMORY mechanism converts an adress to c an offset in the array MEMORY, It is possible to get rid of the c notion of adresses: c The functions IP=GET_MEMORY(SIZE) and IERROR=FREE_MEMORY(IP) c will respectively allocate and deallocate Virtual Memory but c pass the address already as an OFFSET in the array MEMORY, c defined in this include file. We have equivalenced the MEMORY (I4) c array with a byte array MEMBYT for the rare case where the address c returned does not fall naturally on a 32-byte word in memory c c Note: VM allocation SHOULD provide this alignement -- through c tricks in the C code of SIC_GETVM and GET_MEMORY -- for the rare c 16 bit computers. The case in point here is the address of an c internal character array (got by locstr) or function address c (got by locwrd), which can be 8 or 16 bit aligned on some machines. c In that case, one uses IP = BYTPNT (ADDRESS,MEMBYT) and MEMBYT(IP). c So IPs are offsets in a byte array, and dawdling with these IPs is c highly unrecommended. To alleviate potential problems, the routine c POINTER will complain if it cannot translate an address to an offset c in a I*4 array on computer not 32 bit aligned. It will be then up to c the programmer to use BYTPNT and additional arithmetics instead c of POINTER. c C--------------------------------------------------------------------- REAL*8 MEMOR8(1) INTEGER*1 MEMBYT(8) INTEGER*4 MEMORY(2) CHARACTER MEMCHAR(8) EQUIVALENCE (MEMORY,MEMBYT) EQUIVALENCE (MEMOR8,MEMORY) EQUIVALENCE (MEMCHAR,MEMORY) * The whole thing is is common now COMMON /OURPOINTERREF/ MEMORY