home *** CD-ROM | disk | FTP | other *** search
- /**
- *
- * Name utabsptr -- Return the absolute value of a pointer
- *
- * Synopsis absval = utabsptr(ptr,pads);
- *
- * unsigned long absval The absolute address represented by
- * the specified pointer, ptr.
- * char *ptr The pointer whose absolute address is
- * computed.
- * ADS *pads An ADS structure containing the offset
- * and segment of the absolute address
- * pointed to by pointer.
- *
- * Description This function returns the absolute address of the
- * location pointed to by ptr. The result is returned as
- * an unsigned long integer. A segment/offset address of
- * the pointer is returned in the ADS structure.
- *
- * For large data models, pointers are 32-bit quantities
- * representing both segment and offset, but for small data
- * models, pointers are offsets within the default data
- * segment.
- *
- * Returns absval The absolute address of *ptr
- * *pads An ADS variable representing the
- * location of *ptr.
- *
- * Version 3.0 (C)Copyright Blaise Computing Inc. 1984, 1985, 1986
- *
- **/
-
- #include <butility.h>
-
- #if MSC300 & LDATA
- #include <dos.h> /* For FP_SEG, FP_OFF symbols */
- #endif
-
- unsigned long utabsptr(ptr,pads)
- char *ptr;
- ADS *pads;
- {
- unsigned long absptr;
-
- #if LDATA
- #else
- unsigned cs,ss,ds,es;
- #endif
-
- #if CI201A & LDATA
- unsigned long ptrtoabs();
- #endif
-
- absptr = (unsigned long)ptr;
- #if LDATA
- #if CI201A
- absptr = ptrtoabs(ptr);
- #endif /* CI201A */
- #if MSC300
- pads->s = FP_SEG(ptr);
- pads->r = FP_OFF(ptr);
- #else /* not MSC300 */
- pads->s = (unsigned)((absptr & 0xffff0L) >> 4L);
- pads->r = (unsigned)(absptr & 0xfL);
- #endif /* MSC300 */
- #else /* not LDATA */
- utsreg(&cs,&ss,&ds,&es);
- pads->s = ds;
- pads->r = (unsigned)ptr;
- #endif /* LDATA */
-
- return(absptr);
- }