PTRUTIL is a set os Pascal/iX procedures that can move date into/out-of 32-bit or 64-bit pointers. This allows languages like COBOL and FORTRAN to make use of short-mapped and long-mapped files. Author: Stan Sieler, Allegro Consultants, Inc. 1994/03/24 sieler@allegrosupport.com Contributed to the Interex CSL Notes: 1) All routines have a "status" parameter. For COBOL/FORTRAN calls, the address of a 32-bit integer should be passed in. The code *always* initializes the status value to 0, so you don't have to. 2) All of these routines assume that the destination and the source do not overlap. 3) If a trap is encountered (e.g.: illegal address), then the TRY/RECOVERs *may* succeed in preventing your process from being aborted. In this case, the status parameter will report information about the trap. 4) A call to HPERRMSG can display a "english" message on $STDLIST describing a trap as follows: call hperrmsg (2, 1, , status, , , altstatus) Where altstatus is another 32-bit integer variable (whose value you don't care about) 5) All parameters are by reference, since this makes calling from COBOL or FORTRAN easier. Note: in the "p" variation of the routines (see #7 below), the source and destination are addresses passed by address; in the non-"p" variations, they are data passed by address. 6) Formal parameter checking is restricted to checking just the number of parameters, not their types. 7) The main routines come in two variants: a) movefrom##pto##p (note extra "p" letters) In this form the source and dest parameters are addresses passed by REFERENCE. (In Pascal terms, var source : localanyptr). To use these, you *must* calculate/determine the address of the data area you want to move from/to, and place these addresses in 4-byte or 8-byte variables, and then pass these variables by reference (e.g: call ... using ...,source32_addr, ...) b) movefrom##to## In this form, the source and dest parameters are simple addresses e.g.: (call ... using ..., source_buffer, dest_buffer,...) If your language does not have an 8-byte (64-bit) integer, then the "64" bit variants will be difficult to use. 8) Two helper routines are in this module: a) movefromdummytoaddr32 This routine takes the address of the "dummy" parameter (the second parameter) and returns it in the "addr32" parameter (the third parameter). This means that: integer*4 foo_addr_32, istatus call movefromdummytoaddr32 (istatus, foo, foo_addr_32) is equivalent to: foo_addr_32 = .loc. (foo) a) movefromdummytoaddr64 This routine takes the address of the "dummy" parameter (the second parameter), converts it from a 32-bit address to a 64-bit address, and returns it in the "addr64" parameter (the third parameter). There is no FORTRAN or COBOL equivalent, since the resulting address is a 64-bit address. Normally, no one needs to use this routine. 9) Other errors: In addition to "traps", three other errors could be returned in the status parameter: -1 ... a negative #bytes value was given. -2 ... the destination address was nil (0). -3 ... the source address was nil (0). To generate a useful HPERRMSG call, you would want to do: if -1 <= status <= -3 then ...display one of the above 3 errors else hperrmsg (2, 1, , status, , , altstatus);