Open SCAP Library
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Macros | Typedefs | Functions
sexp-manip.h File Reference

Detailed Description

S-expression object manipulation functions - public header.

Author
"Daniel Kopecek" dkope.nosp@m.cek@.nosp@m.redha.nosp@m.t.co.nosp@m.m
#include <stdarg.h>
#include <stddef.h>
#include <stdint.h>
#include <stdbool.h>
#include <sexp-types.h>
#include <helpers.h>
#include <stdlib.h>

Go to the source code of this file.

Macros

#define SEXP_MANIP_H
 
#define SEXP_number_newi   SEXP_number_newi_32
 Create a new sexp object from an integer. More...
 
#define SEXP_number_geti   SEXP_number_geti_32
 Get integer value from a sexp object. More...
 
#define SEXP_number_newu   SEXP_number_newu_32
 Create a new sexp object from an unsigned integer. More...
 
#define SEXP_number_getu   SEXP_number_getu_32
 Get unsigned integer value from a sexp object. More...
 
#define SEXP_IT_RECURSIVE   0x01
 
#define SEXP_IT_HARDREF   0x02
 
#define SEXP_free(ptr)   __SEXP_free (ptr, __FILE__, __LINE__, __PRETTY_FUNCTION__)
 
#define SEXP_vfree(...)   __SEXP_vfree (__FILE__, __LINE__, __PRETTY_FUNCTION__, PP_NARG(__VA_ARGS__), __VA_ARGS__)
 
#define SEXP_VALIDATE(s)   __SEXP_VALIDATE(s, __FILE__, __LINE__, __PRETTY_FUNCTION__)
 

Typedefs

typedef struct SEXP_it SEXP_it_t
 
typedef struct SEXP_list_it SEXP_list_it
 

Functions

SEXP_tSEXP_number_new (SEXP_numtype_t t, const void *n) __attribute__((nonnull(2)))
 Create a new sexp object from a value and a number type. More...
 
SEXP_tSEXP_number_newb (bool n)
 Create a new sexp object from a boolean value. More...
 
SEXP_tSEXP_number_newi_8 (int8_t n)
 Create a new sexp object from an integer. More...
 
SEXP_tSEXP_number_newu_8 (uint8_t n)
 Create a new sexp object from an unsigned integer. More...
 
uint8_t SEXP_number_getu_8 (const SEXP_t *s_exp)
 Get unsigned integer value from a sexp object. More...
 
SEXP_tSEXP_number_newi_16 (int16_t n)
 Create a new sexp object from an integer. More...
 
SEXP_tSEXP_number_newu_16 (uint16_t n)
 Create a new sexp object from an unsigned integer. More...
 
SEXP_tSEXP_number_newi_32 (int32_t n)
 Create a new sexp object from an integer. More...
 
int32_t SEXP_number_geti_32 (const SEXP_t *s_exp)
 Get integer value from a sexp object. More...
 
bool SEXP_number_getb (const SEXP_t *s_exp)
 Get boolean value from a sexp object. More...
 
SEXP_tSEXP_number_newu_32 (uint32_t n)
 Create a new sexp object from an unsigned integer. More...
 
uint32_t SEXP_number_getu_32 (const SEXP_t *s_exp)
 Get unsigned integer value from a sexp object. More...
 
SEXP_tSEXP_number_newi_64 (int64_t n)
 Create a new sexp object from an integer. More...
 
int64_t SEXP_number_geti_64 (const SEXP_t *s_exp)
 Get integer value from a sexp object. More...
 
SEXP_tSEXP_number_newu_64 (uint64_t n)
 Create a new sexp object from an unsigned integer. More...
 
uint64_t SEXP_number_getu_64 (const SEXP_t *s_exp)
 Get unsigned integer value from a sexp object. More...
 
SEXP_tSEXP_number_newf (double n)
 Create a new sexp object from an floating point value. More...
 
double SEXP_number_getf (const SEXP_t *s_exp)
 Get floating point value from a sexp object. More...
 
int SEXP_number_get (const SEXP_t *s_exp, void *dst, SEXP_numtype_t type)
 Get a value from a sexp object according to a specified type. More...
 
uint16_t SEXP_number_getu_16 (const SEXP_t *s_exp)
 Get unsigned integer value from a sexp object. More...
 
void SEXP_number_free (SEXP_t *s_exp)
 Free the specified sexp object. More...
 
bool SEXP_numberp (const SEXP_t *s_exp)
 Check whether the provided sexp object is a number. More...
 
SEXP_numtype_t SEXP_number_type (const SEXP_t *sexp)
 Get the number type of an object. More...
 
SEXP_tSEXP_string_new (const void *string, size_t strlen) __attribute__((nonnull(1)))
 Create a new sexp object from a string. More...
 
SEXP_tSEXP_string_newf (const char *format,...) __attribute__((format(printf
 Create a new sexp object from a format string. More...
 
SEXP_t nonnull (1)))
 
void SEXP_string_free (SEXP_t *s_exp)
 Free the specified sexp object. More...
 
bool SEXP_stringp (const SEXP_t *s_exp)
 Check whether the provided sexp object is a string. More...
 
size_t SEXP_string_length (const SEXP_t *s_exp)
 Get the length of a string in a sexp object. More...
 
int SEXP_strcmp (const SEXP_t *s_exp, const char *str) __attribute__((nonnull(2)))
 Compare a string in a sexp object with a C string. More...
 
int SEXP_strncmp (const SEXP_t *s_exp, const char *str, size_t n) __attribute__((nonnull(2)))
 Compare a string in a sexp object with a C string. More...
 
int SEXP_string_nth (const SEXP_t *s_exp, size_t n)
 Get the n-th byte of a string. More...
 
char * SEXP_string_cstr (const SEXP_t *s_exp)
 Get a C string from a sexp object.
 
size_t SEXP_string_cstr_r (const SEXP_t *s_exp, char *buf, size_t len) __attribute__((nonnull(2)))
 Get a C string from a sexp object. More...
 
char * SEXP_string_cstrp (const SEXP_t *s_exp)
 Obsolete function.
 
char * SEXP_string_subcstr (const SEXP_t *s_exp, size_t beg, size_t len)
 Get a C substring from a sexp object. More...
 
int SEXP_string_cmp (const SEXP_t *str_a, const SEXP_t *str_b)
 Compare two sexp strings. More...
 
bool SEXP_string_getb (const SEXP_t *s_exp)
 Try to cast the supplied sexp string to a boolean. More...
 
SEXP_tSEXP_list_new (SEXP_t *memb,...)
 Create a new sexp list, optionally initialized with the provided sexp arguments. More...
 
void SEXP_list_free (SEXP_t *s_exp)
 Free the specified sexp object. More...
 
bool SEXP_listp (const SEXP_t *s_exp)
 Check whether the provided sexp object is a list. More...
 
size_t SEXP_list_length (const SEXP_t *s_exp)
 Get the length of the sexp list. More...
 
SEXP_tSEXP_list_first (const SEXP_t *list)
 Get the first element of a list. More...
 
SEXP_tSEXP_list_rest (const SEXP_t *list)
 Get the rest of a list. More...
 
SEXP_tSEXP_list_last (const SEXP_t *list)
 Get the last element of a list. More...
 
SEXP_tSEXP_list_nth (const SEXP_t *list, uint32_t n)
 Get the n-th element of a list. More...
 
SEXP_tSEXP_list_add (SEXP_t *list, const SEXP_t *s_exp)
 Add an element to a list. More...
 
SEXP_tSEXP_list_join (const SEXP_t *list_a, const SEXP_t *list_b)
 Create a new list containing the concatenated contents of two lists. More...
 
SEXP_tSEXP_list_push (SEXP_t *list, const SEXP_t *s_exp)
 Push an element to the head of a list. More...
 
SEXP_tSEXP_list_pop (SEXP_t *list)
 Extract the first element of a list. More...
 
SEXP_tSEXP_list_sort (SEXP_t *list, int(*compare)(const SEXP_t *, const SEXP_t *))
 Sort a list using `compare' as the comparison function.
 
SEXP_tSEXP_list_replace (SEXP_t *list, uint32_t n, const SEXP_t *s_exp)
 Replace the n-th element of a list. More...
 
SEXP_tSEXP_listref_first (SEXP_t *list)
 Get the first element of a list. More...
 
SEXP_tSEXP_listref_rest (SEXP_t *list)
 Get the rest of a list. More...
 
SEXP_tSEXP_listref_last (SEXP_t *list)
 Get the last element of a list. More...
 
SEXP_tSEXP_listref_nth (SEXP_t *list, uint32_t n)
 Get the n-th element of a list. More...
 
SEXP_it_t * SEXP_listit_new (const SEXP_t *list, int flags)
 
SEXP_tSEXP_listit_next (SEXP_it_t *it)
 
SEXP_tSEXP_listit_prev (SEXP_it_t *it)
 
SEXP_tSEXP_listit_length (SEXP_it_t *it)
 
SEXP_tSEXP_listit_seek (SEXP_it_t *it, uint32_t n)
 
void SEXP_listit_free (SEXP_it_t *it)
 
SEXP_list_itSEXP_list_it_new (const SEXP_t *list)
 
SEXP_tSEXP_list_it_next (SEXP_list_it *it)
 
void SEXP_list_it_free (SEXP_list_it *it)
 
SEXP_tSEXP_new (void)
 
bool SEXP_emptyp (SEXP_t *sexp)
 
SEXP_tSEXP_ref (const SEXP_t *s_exp)
 Create a new reference to a sexp object. More...
 
SEXP_tSEXP_unref (SEXP_t *s_exp_o)
 
SEXP_tSEXP_softref (SEXP_t *s_exp)
 Create a new soft reference to a sexp object. More...
 
bool SEXP_softrefp (const SEXP_t *s_exp)
 Check whether an S-exp reference is a "soft" reference. More...
 
uint32_t SEXP_refs (const SEXP_t *ref)
 Return the value of the reference counter. More...
 
bool SEXP_eq (const SEXP_t *a, const SEXP_t *b)
 
int SEXP_refcmp (const SEXP_t *a, const SEXP_t *b)
 Compare reference pointers.
 
bool SEXP_deepcmp (const SEXP_t *a, const SEXP_t *b)
 
void __SEXP_free (SEXP_t *s_exp, const char *file, uint32_t line, const char *func)
 
void __SEXP_vfree (const char *file, uint32_t line, const char *func, int n, SEXP_t *s_exp,...)
 
const char * SEXP_datatype (const SEXP_t *s_exp)
 Get the user data type of a sexp object. More...
 
int SEXP_datatype_set (SEXP_t *s_exp, const char *name) __attribute__((nonnull(2)))
 Set the user data type of a sexp object. More...
 
int SEXP_datatype_set_nth (SEXP_t *list, uint32_t n, const char *name) __attribute__((nonnull(3)))
 Set the user data type of the nth sexp object in a list. More...
 
SEXP_type_t SEXP_typeof (const SEXP_t *s_exp)
 Get the type of a sexp object. More...
 
const char * SEXP_strtype (const SEXP_t *s_exp)
 Get a text description of the sexp object's type. More...
 
SEXP_tSEXP_build (const char *s_str,...)
 
size_t SEXP_sizeof (const SEXP_t *s_exp)
 
void __SEXP_VALIDATE (const SEXP_t *s_exp, const char *file, uint32_t line, const char *func)