Open SCAP Library
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
sexp-manip_r.h
1 /*
2  * Copyright 2011 Red Hat Inc., Durham, North Carolina.
3  * All Rights Reserved.
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18  *
19  * Authors:
20  * Daniel Kopecek <dkopecek@redhat.com>
21  */
22 
23 #ifndef SEXP_MANIP_R_H
24 #define SEXP_MANIP_R_H
25 
26 #include <stdarg.h>
27 #include <stddef.h>
28 #include <stdint.h>
29 #include <stdbool.h>
30 #include "sexp-types.h"
31 
32 #ifdef __cplusplus
33 extern "C" {
34 #endif
35 
36 #if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ > 4)
37 #define _GNUC_PRINTF( format_idx, arg_idx ) \
38  __attribute__((__format__ (__printf__, format_idx, arg_idx)))
39 #else /* !__GNUC__ */
40 #define _GNUC_PRINTF( format_idx, arg_idx )
41 #endif /* __GNUC__ */
42 
43 SEXP_t *SEXP_init(SEXP_t *sexp_mem);
44 
45 SEXP_t *SEXP_number_newb_r(SEXP_t *sexp_mem, bool n);
46 #define SEXP_number_newi_r SEXP_number_newi_32_r
47 SEXP_t *SEXP_number_newi_32_r(SEXP_t *sexp_mem, int32_t n);
48 SEXP_t *SEXP_number_newu_32_r(SEXP_t *sexp_mem, uint32_t n);
49 SEXP_t *SEXP_number_newu_64_r(SEXP_t *sexp_mem, uint64_t n);
50 SEXP_t *SEXP_number_newi_64_r(SEXP_t *sexp_mem, int64_t n);
51 SEXP_t *SEXP_number_newf_r(SEXP_t *sexp_mem, double n);
52 
53 SEXP_t *SEXP_string_new_r(SEXP_t *sexp_mem, const void *string, size_t length);
54 SEXP_t *SEXP_string_newf_r(SEXP_t *sexp_mem, const char *format, ...) _GNUC_PRINTF (2,3);
55 SEXP_t *SEXP_string_newf_rv(SEXP_t *sexp_mem, const char *format, va_list ap);
56 
57 SEXP_t *SEXP_list_new_rv(SEXP_t *sexp_mem, SEXP_t *memb, va_list alist);
58 SEXP_t *SEXP_list_new_r(SEXP_t *sexp_mem, SEXP_t *memb, ...);
59 
60 SEXP_t *SEXP_list_rest_r (SEXP_t *rest, const SEXP_t *list);
61 
62 int SEXP_unref_r(SEXP_t *s_exp);
63 
64 #if defined(NDEBUG)
65 void SEXP_free_r (SEXP_t *s_exp);
66 #else
67 #include <stdint.h>
68 void __SEXP_free_r(SEXP_t *s_exp, const char *file, uint32_t line, const char *func);
69 
70 __attribute__ ((unused)) static void SEXP_free_r(SEXP_t *sexp)
71 {
72  __SEXP_free_r(sexp, __FILE__, __LINE__, __PRETTY_FUNCTION__);
73 }
74 
75 #define SEXP_free_r(ptr) __SEXP_free_r(ptr, __FILE__, __LINE__, __PRETTY_FUNCTION__)
76 
77 #endif
78 
79 #ifdef __cplusplus
80 }
81 #endif
82 
83 #endif /* SEXP_MANIP_R_H */
Definition: _sexp-value.h:42
Definition: sexp-types.h:82