home *** CD-ROM | disk | FTP | other *** search
- /*********
- *
- * DEALLOC.C
- *
- * by Leonard Zerman
- *
- * Placed in the public domain by Tom Rettig Associates, 10/22/1990.
- *
- * Syntax: DEALLOC( <expC>, <expN> )
- * Return: <expL> .T. if successful else .F..
- * <expC> ::= HEX address string.
- * <expN> ::= nbr of bytes orginally allocated.
- *********/
- #include "trlib.h"
- #define MK_FP(seg,ofs) ((void far *)(((unsigned long)(seg) << 16) | (ofs)))
-
- TRTYPE dealloc()
- {
- char *address, *ptr, *ret;
- unsigned int size;
- char seg[5];
- char off[5];
-
- if ( PCOUNT==2 && ISCHAR(1) && ISNUM(2) )
- {
- address = _parc(1);
- size = _parni(2);
- _tr_strncpy(seg,address,4);
- _tr_strncpy(off,&address[4],4);
- seg[4] = 0;
- off[4] = 0;
- ptr = MK_FP(_tr_htoi(seg),_tr_htoi(off));
- _tr_freemem(ptr,(unsigned)size+1);
- _retl(TRUE);
- }
- else
- _retl(FALSE);
- }
- /* eof */
-