rtxIntStack.h
Go to the documentation of this file.00001 /* 00002 * Copyright (c) 2003-2016 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 _RTXINTSTACK_ 00029 #define _RTXINTSTACK_ 00030 00031 #include "rtxsrc/rtxContext.h" 00032 00045 #define OSRTISTK_DEFAULT_CAPACITY 100 00046 00052 typedef struct _OSRTIntStack { 00053 OSCTXT* pctxt; /* context pointer */ 00054 OSINT32* pdata; /* stack data */ 00055 size_t index; /* index to top element */ 00056 size_t size; /* current size of the stack */ 00057 } OSRTIntStack; 00058 00059 #ifdef __cplusplus 00060 extern "C" { 00061 #endif 00062 00079 EXTERNRT int rtxIntStackInit 00080 (OSCTXT* pctxt, OSRTIntStack* pstack, size_t capacity); 00081 00091 EXTERNRT int rtxIntStackPush (OSRTIntStack* pstack, OSINT32 value); 00092 00103 EXTERNRT int rtxIntStackPeek (OSRTIntStack* pstack, OSINT32* pvalue); 00104 00115 EXTERNRT int rtxIntStackPop (OSRTIntStack* pstack, OSINT32* pvalue); 00116 00122 #define rtxIntStackIsEmpty(stack) (OSBOOL)((stack).index == 0) 00123 00127 #ifdef __cplusplus 00128 } 00129 #endif 00130 00131 #endif