Objective Systems, Inc.  
Home
About ASN.1
Products
Free Software
Documents
Services
Resources
Resellers
Customers
Careers
About Us
Contact Us
 

Google


Objective Systems, Inc.

rtMemory.h

Go to the documentation of this file.
00001 /* 00002 * Copyright (C) 1997-2004 by Objective Systems, Inc. 00003 * 00004 * This software is furnished under a license and may be used and copied 00005 * only in accordance with the terms of such license and with the 00006 * inclusion of the above copyright notice. This software or any other 00007 * copies thereof may not be provided or otherwise made available to any 00008 * other person. No title to and ownership of the software is hereby 00009 * transferred. 00010 * 00011 * The information in this software is subject to change without notice 00012 * and should not be construed as a commitment by Objective Systems, Inc. 00013 * 00014 * PROPRIETARY NOTICE 00015 * 00016 * This software is an unpublished work subject to a confidentiality agreement 00017 * and is protected by copyright and trade secret law. Unauthorized copying, 00018 * redistribution or other use of this work is prohibited. 00019 * 00020 * The above notice of copyright on this source code product does not indicate 00021 * any actual or intended publication of such source code. 00022 * 00023 *****************************************************************************/ 00028 #ifndef __RTMEMORY_H__ 00029 #define __RTMEMORY_H__ 00030 00031 #include "asn1type.h" 00032 00033 #define RT_MH_DONTKEEPFREE 0x1 00034 00035 #define OSRTMH_PROPID_DEFBLKSIZE 1 00036 #define OSRTMH_PROPID_SETFLAGS 2 00037 #define OSRTMH_PROPID_CLEARFLAGS 3 00038 00039 #define OSRTMH_PROPID_USER 10 00040 00054 #define rtMemAlloc(pctxt,nbytes) \ 00055 rtMemHeapAlloc(&(pctxt)->pTypeMemHeap,nbytes) 00056 00066 #define rtMemAllocZ(pctxt,nbytes) \ 00067 rtMemHeapAllocZ(&(pctxt)->pTypeMemHeap,nbytes) 00068 00083 #define rtMemRealloc(pctxt,mem_p,nbytes) \ 00084 rtMemHeapRealloc(&(pctxt)->pTypeMemHeap, (void*)mem_p, nbytes) 00085 00097 #define rtMemFreePtr(pctxt,mem_p) \ 00098 if (rtMemHeapCheckPtr (&(pctxt)->pTypeMemHeap, (void*)mem_p)) \ 00099 rtMemHeapFreePtr(&(pctxt)->pTypeMemHeap, (void*)mem_p) 00100 00109 #define rtMemFree(pctxt) \ 00110 rtMemHeapFreeAll(&(pctxt)->pTypeMemHeap) 00111 00126 #define rtMemReset(pctxt) \ 00127 rtMemHeapReset(&(pctxt)->pTypeMemHeap) 00128 00129 #ifdef __cplusplus 00130 extern "C" { 00131 #endif 00132 00133 /* Alias for __cdecl modifier; if __cdecl keyword is not supported, 00134 * redefine it as empty macro. */ 00135 00136 #if !defined(OSCDECL) 00137 #if defined(_MSC_VER) || defined(__BORLANDC__) 00138 #define OSCDECL __cdecl 00139 #else 00140 #define OSCDECL 00141 #endif 00142 #endif /* OSCDECL */ 00143 00144 /* Pointers to C Run-Time memory allocation functions * 00145 * (See rtMemSetAllocFuncs) */ 00146 00147 typedef void *(OSCDECL *OSMallocFunc ) (size_t size); 00148 typedef void *(OSCDECL *OSReallocFunc) (void *ptr, size_t size); 00149 typedef void (OSCDECL *OSFreeFunc ) (void *ptr); 00150 00151 EXTERNRT void rtMemHeapAddRef (void** ppvMemHeap); 00152 EXTERNRT void* rtMemHeapAlloc (void** ppvMemHeap, size_t nbytes); 00153 EXTERNRT void* rtMemHeapAllocZ (void** ppvMemHeap, size_t nbytes); 00154 EXTERNRT int rtMemHeapCheckPtr (void** ppvMemHeap, void* mem_p); 00155 EXTERNRT int rtMemHeapCreate (void** ppvMemHeap); 00156 EXTERNRT void rtMemHeapFreeAll (void** ppvMemHeap); 00157 EXTERNRT void rtMemHeapFreePtr (void** ppvMemHeap, void* mem_p); 00158 EXTERNRT void* rtMemHeapMarkSaved (void** ppvMemHeap, 00159 ASN1ConstVoidPtr mem_p, 00160 ASN1BOOL saved); 00161 00162 EXTERNRT void* rtMemHeapRealloc (void** ppvMemHeap, void* mem_p, size_t nbytes_); 00163 EXTERNRT void rtMemHeapRelease (void** ppvMemHeap); 00164 EXTERNRT void rtMemHeapReset (void** ppvMemHeap); 00165 EXTERNRT void rtMemHeapSetProperty (void** ppvMemHeap, 00166 ASN1UINT propId, void* pProp); 00167 00168 00169 00185 EXTERNRT void rtMemSetAllocFuncs (OSMallocFunc malloc_func, 00186 OSReallocFunc realloc_func, 00187 OSFreeFunc free_func); 00188 00189 EXTERNRT void rtMemFreeOpenSeqExt (ASN1CTXT* pctxt, Asn1RTDList *pElemList); 00190 00191 /* 00192 * This function sets flags to a heap. May be used to control the heap's 00193 * behavior. 00194 * 00195 * @param pctxt Pointer to a memory block structure that contains the 00196 * list of dynamic memory block maintained by these 00197 * functions. 00198 * @param flags The flags. 00199 */ 00200 EXTERNRT void rtMemHeapSetFlags (ASN1CTXT* pctxt, ASN1UINT flags); 00201 00202 /* 00203 * This function clears memory heap flags. 00204 * 00205 * @param pctxt Pointer to a memory block structure that contains the 00206 * list of dynamic memory block maintained by these 00207 * functions. 00208 * @param flags The flags 00209 */ 00210 EXTERNRT void rtMemHeapClearFlags (ASN1CTXT* pctxt, ASN1UINT flags); 00211 00225 EXTERNRT void rtMemHeapSetDefBlkSize (ASN1CTXT* pctxt, ASN1UINT blkSize); 00226 00232 EXTERNRT ASN1UINT rtMemHeapGetDefBlkSize (ASN1CTXT* pctxt); 00233 00234 #ifdef _STATIC_HEAP 00235 EXTERNRT void rtMemSetStaticBuf (void* memHeapBuf, ASN1UINT blkSize); 00236 #endif 00237 00238 #ifdef __cplusplus 00239 } 00240 #endif 00241 00244 #endif /*__RTMEMORY_H__*/

Copyright © 1997-2004 Objective Systems,Inc.
All Rights Reserved.
This document may be distributed in any form, electronic
or otherwise, provided that it is distributed in its entirety
and that the copyright and this notice are included.

This file was last modified on 1 Oct 2004.
ASN1C C/C++ Common Runtime, ASN1C v5.7x