Pajdeg  0.2.2
Pajdeg
pd_stack.h
Go to the documentation of this file.
1 //
2 // pd_stack.h
3 //
4 // Copyright (c) 2012 - 2015 Karl-Johan Alm (http://github.com/kallewoof)
5 //
6 // Permission is hereby granted, free of charge, to any person obtaining a copy
7 // of this software and associated documentation files (the "Software"), to deal
8 // in the Software without restriction, including without limitation the rights
9 // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 // copies of the Software, and to permit persons to whom the Software is
11 // furnished to do so, subject to the following conditions:
12 //
13 // The above copyright notice and this permission notice shall be included in
14 // all copies or substantial portions of the Software.
15 //
16 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 // THE SOFTWARE.
23 //
24 
42 #ifndef INCLUDED_pd_stack_h
43 #define INCLUDED_pd_stack_h
44 
45 #include <sys/types.h>
46 #include "PDDefines.h"
47 
55 extern void pd_stack_set_global_preserve_flag(PDBool preserve);
56 
58 
65 extern void pd_stack_push_key(pd_stack *stack, char *key);
66 
73 extern void pd_stack_push_identifier(pd_stack *stack, PDID identifier);
74 
81 extern void pd_stack_push_freeable(pd_stack *stack, void *info);
82 
91 extern void pd_stack_push_stack(pd_stack *stack, pd_stack pstack);
92 
99 extern void pd_stack_push_object(pd_stack *stack, void *ob);
100 
114 extern void pd_stack_unshift_stack(pd_stack *stack, pd_stack sstack);
115 
124 extern pd_stack pd_stack_copy(pd_stack stack);
125 
127 
133 extern void pd_stack_destroy(pd_stack *stack);
134 
140 extern char *pd_stack_pop_key(pd_stack *stack);
141 
147 extern PDID pd_stack_pop_identifier(pd_stack *stack);
148 
154 extern pd_stack pd_stack_pop_stack(pd_stack *stack);
155 
161 extern void *pd_stack_pop_object(pd_stack *stack);
162 
168 extern void *pd_stack_pop_freeable(pd_stack *stack);
169 
175 extern PDSize pd_stack_pop_size(pd_stack *stack);
176 
182 extern PDInteger pd_stack_pop_int(pd_stack *stack);
183 
192 extern void pd_stack_assert_expected_key(pd_stack *stack, const char *key);
193 
202 extern void pd_stack_assert_expected_int(pd_stack *stack, PDInteger i);
203 
209 extern PDInteger pd_stack_peek_int(pd_stack stack);
210 
212 
220 
227 extern void pd_stack_pop_into(pd_stack *dest, pd_stack *source);
228 
237 #define pd_stack_for_each(stack, iter) for (iter = stack; iter; iter = iter->prev)
238 
247 extern pd_stack pd_stack_get_dict_key(pd_stack dictStack, const char *key, PDBool remove);
248 
263 extern PDBool pd_stack_get_next_dict_key(pd_stack *iterStack, char **key, char **value);
264 
275 extern pd_stack pd_stack_get_arr(pd_stack arrStack);
276 
284 extern void pd_stack_replace_info_object(pd_stack stack, char type, void *info);
285 
292 extern pd_stack pd_stack_create_from_definition(const void **defs);
293 
295 
301 extern void pd_stack_print(pd_stack stack);
307 extern void pd_stack_show(pd_stack stack);
308 
319 
323 #define PDDeallocateViaStackDealloc(ob) pd_stack_dealloc(ob)
324 
325 #endif
void pd_stack_push_freeable(pd_stack *stack, void *info)
Definition: pd_stack.c:62
pd_stack pd_stack_get_arr(pd_stack arrStack)
Definition: pd_stack.c:461
void pd_stack_push_object(pd_stack *stack, void *ob)
Definition: pd_stack.c:97
void * pd_stack_pop_freeable(pd_stack *stack)
Definition: pd_stack.c:218
long PDInteger
Definition: PDDefines.h:184
void pd_stack_show(pd_stack stack)
Definition: pd_stack.c:612
unsigned char PDBool
Definition: PDDefines.h:207
void pd_stack_pop_into(pd_stack *dest, pd_stack *source)
Definition: pd_stack.c:229
const char ** PDID
Definition: PDDefines.h:284
PDSize pd_stack_pop_size(pd_stack *stack)
Definition: pd_stack.c:152
void pd_stack_replace_info_object(pd_stack stack, char type, void *info)
Definition: pd_stack.c:291
PDInteger pd_stack_pop_int(pd_stack *stack)
Definition: pd_stack.c:165
pd_stack pd_stack_pop_stack(pd_stack *stack)
Definition: pd_stack.c:196
void pd_stack_push_stack(pd_stack *stack, pd_stack pstack)
Definition: pd_stack.c:71
void * pd_stack_pop_object(pd_stack *stack)
Definition: pd_stack.c:207
size_t PDSize
Definition: PDDefines.h:213
pd_stack pd_stack_create_from_definition(const void **defs)
Definition: pd_stack.c:499
void pd_stack_assert_expected_key(pd_stack *stack, const char *key)
Definition: pd_stack.c:118
PDInteger pd_stack_get_count(pd_stack stack)
Definition: pd_stack.c:453
void pd_stack_assert_expected_int(pd_stack *stack, PDInteger i)
Definition: pd_stack.c:137
PDDeallocator pd_stack_dealloc
Definition: pd_stack.c:32
void pd_stack_print(pd_stack stack)
Definition: pd_stack.c:559
Definition: pd_internal.h:544
void pd_stack_push_key(pd_stack *stack, char *key)
Definition: pd_stack.c:53
PDBool pd_stack_get_next_dict_key(pd_stack *iterStack, char **key, char **value)
Definition: pd_stack.c:357
Definitions for the Pajdeg interface.
pd_stack pd_stack_get_dict_key(pd_stack dictStack, const char *key, PDBool remove)
Definition: pd_stack.c:316
pd_stack pd_stack_copy(pd_stack stack)
Definition: pd_stack.c:242
void pd_stack_set_global_preserve_flag(PDBool preserve)
Definition: pd_stack.c:36
PDID pd_stack_pop_identifier(pd_stack *stack)
Definition: pd_stack.c:107
void pd_stack_push_identifier(pd_stack *stack, PDID identifier)
Definition: pd_stack.c:44
PDInteger pd_stack_peek_int(pd_stack stack)
Definition: pd_stack.c:178
char * pd_stack_pop_key(pd_stack *stack)
Definition: pd_stack.c:185
void pd_stack_destroy(pd_stack *stack)
Definition: pd_stack.c:310
void(* PDDeallocator)(void *ob)
Definition: PDDefines.h:299
void pd_stack_unshift_stack(pd_stack *stack, pd_stack sstack)
Definition: pd_stack.c:80