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 EXTERN_C_START() typedef struct guththila_stack_s
00028 {
00029
00030
00031 int
00032 top;
00033
00034
00035 int
00036 max;
00037 void **
00038 data;
00039
00040 }
00041 guththila_stack_t;
00042
00043 #ifndef GUTHTHILA_STACK_SIZE
00044 #define GUTHTHILA_STACK_SIZE(_stack) ((_stack).top)
00045 #endif
00046
00047 #ifndef GUTHTHILA_STACK_TOP_INDEX
00048 #define GUTHTHILA_STACK_TOP_INDEX(_stack) (((_stack).top - 1))
00049 #endif
00050 int GUTHTHILA_CALL
00051 guththila_stack_init(
00052 guththila_stack_t * stack,
00053 const axutil_env_t * env);
00054 void GUTHTHILA_CALL
00055 guththila_stack_free(
00056 guththila_stack_t * stack,
00057 const axutil_env_t * env);
00058 void GUTHTHILA_CALL
00059 guththila_stack_un_init(
00060 guththila_stack_t * stack,
00061 const axutil_env_t * env);
00062 void *
00063 GUTHTHILA_CALL
00064 guththila_stack_pop(
00065 guththila_stack_t * stack,
00066 const axutil_env_t * env);
00067 int GUTHTHILA_CALL
00068 guththila_stack_push(
00069 guththila_stack_t * stack,
00070 void *data,
00071 const axutil_env_t * env);
00072 void *
00073 GUTHTHILA_CALL
00074 guththila_stack_peek(
00075 guththila_stack_t * stack,
00076 const axutil_env_t * env);
00077 void *
00078 GUTHTHILA_CALL
00079 guththila_stack_get_by_index(
00080 guththila_stack_t * stack,
00081 int index,
00082 const axutil_env_t * env);
00083 int GUTHTHILA_CALL
00084 guththila_stack_del_top(
00085 guththila_stack_t * stack,
00086 const axutil_env_t * env);
00087 int GUTHTHILA_CALL
00088 guththila_stack_is_empty(
00089 guththila_stack_t * stack,
00090 const axutil_env_t * env);
00091 EXTERN_C_END()
00092 #endif
00093