# guththila_stack.h

    00001
    00002 /*
    00003  * Licensed to the Apache Software Foundation (ASF) under one or more
    00004  * contributor license agreements.  See the NOTICE file distributed with
    00005  * this work for additional information regarding copyright ownership.
    00006  * The ASF licenses this file to You under the Apache License, Version 2.0
    00007  * (the "License"); you may not use this file except in compliance with
    00008  * the License.  You may obtain a copy of the License at
    00009  *
    00010  *      http://www.apache.org/licenses/LICENSE-2.0
    00011  *
    00012  * Unless required by applicable law or agreed to in writing, software
    00013  * distributed under the License is distributed on an "AS IS" BASIS,
    00014  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    00015  * See the License for the specific language governing permissions and
    00016  * limitations under the License.
    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     /* Number of Items in the stack */
    00033     int top;
    00034     /* Max number of Items that can be hold in data */
    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