00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef GUTHTHILA_STACK_H
00019 #define GUTHTHILA_STACK_H
00020
00021 #include <stdio.h>
00022 #include <stdlib.h>
00023
00024 #include <guththila_defines.h>
00025 #include <axutil_utils.h>
00026 #define GUTHTHILA_STACK_DEFAULT 16
00027
00028 EXTERN_C_START()
00029
00030 typedef struct guththila_stack_s
00031 {
00032
00033 int top;
00034
00035 int max;
00036 void ** data;
00037 } guththila_stack_t;
00038
00039 #ifndef GUTHTHILA_STACK_SIZE
00040 #define GUTHTHILA_STACK_SIZE(_stack) ((_stack).top)
00041 #endif
00042
00043 #ifndef GUTHTHILA_STACK_TOP_INDEX
00044 #define GUTHTHILA_STACK_TOP_INDEX(_stack) (((_stack).top - 1))
00045 #endif
00046
00047 int GUTHTHILA_CALL
00048 guththila_stack_init(
00049 guththila_stack_t * stack,
00050 const axutil_env_t * env);
00051
00052 void GUTHTHILA_CALL
00053 guththila_stack_free(
00054 guththila_stack_t * stack,
00055 const axutil_env_t * env);
00056
00057 void GUTHTHILA_CALL
00058 guththila_stack_un_init(
00059 guththila_stack_t * stack,
00060 const axutil_env_t * env);
00061
00062 void * GUTHTHILA_CALL
00063 guththila_stack_pop(
00064 guththila_stack_t * stack,
00065 const axutil_env_t * env);
00066
00067 int GUTHTHILA_CALL
00068 guththila_stack_push(
00069 guththila_stack_t * stack,
00070 void *data,
00071 const axutil_env_t * env);
00072
00073 void * GUTHTHILA_CALL
00074 guththila_stack_peek(
00075 guththila_stack_t * stack,
00076 const axutil_env_t * env);
00077
00078 void * GUTHTHILA_CALL
00079 guththila_stack_get_by_index(
00080 guththila_stack_t * stack,
00081 int index,
00082 const axutil_env_t * env);
00083
00084 int GUTHTHILA_CALL
00085 guththila_stack_del_top(
00086 guththila_stack_t * stack,
00087 const axutil_env_t * env);
00088
00089 int GUTHTHILA_CALL
00090 guththila_stack_is_empty(
00091 guththila_stack_t * stack,
00092 const axutil_env_t * env);
00093
00094 EXTERN_C_END()
00095 #endif
00096