1 /*
2  * Copyright (c) 2014-2020 Pavel Kalvoda <me@pavelkalvoda.com>
3  *
4  * libcbor is free software; you can redistribute it and/or modify
5  * it under the terms of the MIT license. See LICENSE for details.
6  */
7 
8 #ifndef LIBCBOR_STACK_H
9 #define LIBCBOR_STACK_H
10 
11 #include "cbor/common.h"
12 
13 #ifdef __cplusplus
14 extern "C" {
15 #endif
16 
17 /** Simple stack record for the parser */
18 struct _cbor_stack_record {
19   struct _cbor_stack_record *lower;
20   cbor_item_t *item;
21   size_t subitems;
22 };
23 
24 /** Stack handle - contents and size */
25 struct _cbor_stack {
26   struct _cbor_stack_record *top;
27   size_t size;
28 };
29 
30 struct _cbor_stack _cbor_stack_init();
31 
32 void _cbor_stack_pop(struct _cbor_stack *);
33 
34 struct _cbor_stack_record *_cbor_stack_push(struct _cbor_stack *, cbor_item_t *,
35                                             size_t);
36 
37 #ifdef __cplusplus
38 }
39 #endif
40 
41 #endif  // LIBCBOR_STACK_H
42