Hash :
0cb58c05
Author :
Thomas de Grivel
Date :
2024-01-17T22:30:28
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156
/* c3
* Copyright 2022,2023 kmx.io <contact@kmx.io>
*
* Permission is hereby granted to use this software granted the above
* copyright notice and this permission paragraph are included in all
* copies and substantial portions of this software.
*
* THIS SOFTWARE IS PROVIDED "AS-IS" WITHOUT ANY GUARANTEE OF
* PURPOSE AND PERFORMANCE. IN NO EVENT WHATSOEVER SHALL THE
* AUTHOR BE CONSIDERED LIABLE FOR THE USE AND PERFORMANCE OF
* THIS SOFTWARE.
*/
/**
* @file buf_inspect.h
* @brief Inspect data into UTF-8.
*
* Structure to inspect data into UTF-8.
*/
#ifndef LIBC3_BUF_INSPECT_H
#define LIBC3_BUF_INSPECT_H
#include "types.h"
#define BUF_INSPECT_S_BASE_PROTOTYPES(bits, base) \
sw buf_inspect_s ## bits ## _ ## base (s_buf *buf, \
const s ## bits *s); \
sw buf_inspect_s ## bits ## _ ## base ## _size (const s ## bits *s)
#define BUF_INSPECT_S_PROTOTYPES(bits) \
sw buf_inspect_s ## bits (s_buf *buf, const s ## bits *s); \
sw buf_inspect_s ## bits ## _size (const s ## bits *s); \
BUF_INSPECT_S_BASE_PROTOTYPES(bits, binary); \
BUF_INSPECT_S_BASE_PROTOTYPES(bits, hexadecimal); \
BUF_INSPECT_S_BASE_PROTOTYPES(bits, octal)
#define BUF_INSPECT_U_BASE_PROTOTYPES(bits, base) \
sw buf_inspect_u ## bits ## _ ## base (s_buf *buf, \
const u ## bits *s); \
sw buf_inspect_u ## bits ## _ ## base ## _digits (const u##bits *s); \
sw buf_inspect_u ## bits ## _ ## base ## _size (const u ## bits *s)
#define BUF_INSPECT_U_PROTOTYPES(bits) \
sw buf_inspect_u ## bits (s_buf *buf, const u ## bits *u); \
sw buf_inspect_u ## bits ## _digits (const u ## bits *u); \
sw buf_inspect_u ## bits ## _size (const u ## bits *u); \
sw buf_inspect_u ## bits ## _base (s_buf *buf, const s_str *base, \
const u ## bits *u); \
sw buf_inspect_u ## bits ## _base_digits (const s_str *base, \
const u ## bits *u); \
sw buf_inspect_u ## bits ## _base_size (const s_str *base, \
const u ## bits *u); \
BUF_INSPECT_U_BASE_PROTOTYPES(bits, binary); \
BUF_INSPECT_U_BASE_PROTOTYPES(bits, hexadecimal); \
BUF_INSPECT_U_BASE_PROTOTYPES(bits, octal)
sw buf_inspect_array (s_buf *buf, const s_array *a);
sw buf_inspect_array_size (const s_array *a);
sw buf_inspect_bool (s_buf *buf, const bool *b);
sw buf_inspect_bool_size (const bool *b);
sw buf_inspect_call (s_buf *buf, const s_call *call);
sw buf_inspect_call_args (s_buf *buf, const s_list *args);
sw buf_inspect_call_brackets (s_buf *buf, const s_call *call);
sw buf_inspect_call_op (s_buf *buf, const s_call *call,
s8 op_precedence);
sw buf_inspect_call_op_size (const s_call *call, s8 op_precedence);
sw buf_inspect_call_op_unary (s_buf *buf, const s_call *call);
sw buf_inspect_call_op_unary_size (const s_call *call);
sw buf_inspect_call_paren (s_buf *buf, const s_call *call);
sw buf_inspect_call_paren_size (const s_call *call);
sw buf_inspect_call_size (const s_call *call);
sw buf_inspect_cast (s_buf *buf, const s_call *call);
sw buf_inspect_cast_size (const s_call *call);
sw buf_inspect_cfn (s_buf *buf, const s_cfn *cfn);
sw buf_inspect_cfn_size (const s_cfn *cfn);
sw buf_inspect_character (s_buf *buf, const character *c);
sw buf_inspect_character_size (const character *c);
sw buf_inspect_error_handler (s_buf *buf,
const s_error_handler *error_handler);
sw buf_inspect_f32 (s_buf *buf, const f32 *x);
sw buf_inspect_f32_size (const f32 *x);
sw buf_inspect_f64 (s_buf *buf, const f64 *x);
sw buf_inspect_f64_size (const f64 *x);
sw buf_inspect_f128 (s_buf *buf, const f128 *x);
sw buf_inspect_f128_size (const f128 *x);
sw buf_inspect_fact (s_buf *buf, const s_fact *fact);
sw buf_inspect_fact_size (const s_fact *fact);
sw buf_inspect_facts_spec (s_buf *buf, p_facts_spec spec);
sw buf_inspect_fn (s_buf *buf, const s_fn *fn);
sw buf_inspect_fn_algo (s_buf *buf, const s_list *algo);
sw buf_inspect_fn_algo_size (const s_list *algo);
sw buf_inspect_fn_clause (s_buf *buf, const s_fn_clause *clause);
sw buf_inspect_fn_clause_size (const s_fn_clause *clause);
sw buf_inspect_fn_pattern (s_buf *buf, const s_list *pattern);
sw buf_inspect_fn_pattern_size (const s_list *pattern);
sw buf_inspect_fn_size (const s_fn *fn);
sw buf_inspect_ident (s_buf *buf, const s_ident *ident);
sw buf_inspect_ident_reserved (s_buf *buf, const s_ident *ident);
sw buf_inspect_ident_reserved_size (const s_ident *ident);
sw buf_inspect_ident_size (const s_ident *ident);
sw buf_inspect_integer (s_buf *buf, const s_integer *x);
sw buf_inspect_integer_size (const s_integer *x);
sw buf_inspect_list (s_buf *buf, const s_list * const *list);
sw buf_inspect_list_paren (s_buf *buf, const s_list * const *list);
sw buf_inspect_list_size (const s_list * const *list);
sw buf_inspect_list_tag (s_buf *buf, const s_tag *tag);
sw buf_inspect_list_tag_size (const s_tag *tag);
sw buf_inspect_map (s_buf *buf, const s_map *map);
sw buf_inspect_map_size (const s_map *map);
sw buf_inspect_paren_sym (s_buf *buf, const s_sym *sym);
sw buf_inspect_paren_sym_size (const s_sym *sym);
sw buf_inspect_ptag (s_buf *buf, const p_tag *ptag);
sw buf_inspect_ptag_size (const p_tag *ptag);
sw buf_inspect_ptr (s_buf *buf, const u_ptr_w *ptr);
sw buf_inspect_ptr_free (s_buf *buf, const u_ptr_w *ptr_free);
sw buf_inspect_ptr_free_size (const u_ptr_w *ptr_free);
sw buf_inspect_ptr_size (const u_ptr_w *ptr);
sw buf_inspect_quote (s_buf *buf, const s_quote *quote);
sw buf_inspect_quote_size (const s_quote *quote);
BUF_INSPECT_S_PROTOTYPES(8);
BUF_INSPECT_S_PROTOTYPES(16);
BUF_INSPECT_S_PROTOTYPES(32);
BUF_INSPECT_S_PROTOTYPES(64);
BUF_INSPECT_S_PROTOTYPES(w);
sw buf_inspect_str (s_buf *buf, const s_str *str);
sw buf_inspect_str_byte (s_buf *buf, const u8 *byte);
sw buf_inspect_str_byte_size (const u8 *byte);
sw buf_inspect_str_character (s_buf *buf, const character *c);
sw buf_inspect_str_character_size (const character *c);
sw buf_inspect_str_reserved (s_buf *buf, const s_str *str);
sw buf_inspect_str_reserved_size (const s_str *str);
sw buf_inspect_str_size (const s_str *str);
sw buf_inspect_struct (s_buf *buf, const s_struct *s);
sw buf_inspect_struct_size (const s_struct *s);
sw buf_inspect_struct_type (s_buf *buf, const s_struct_type *st);
sw buf_inspect_struct_type_size (const s_struct_type *st);
sw buf_inspect_sym (s_buf *buf, const s_sym * const *sym);
sw buf_inspect_sym_reserved (s_buf *buf, const s_sym *sym);
sw buf_inspect_sym_reserved_size (const s_sym *sym);
sw buf_inspect_sym_size (const s_sym * const *sym);
sw buf_inspect_tag (s_buf *buf, const s_tag *tag);
sw buf_inspect_tag_size (const s_tag *tag);
sw buf_inspect_tag_type (s_buf *buf, e_tag_type type);
sw buf_inspect_tag_type_size (e_tag_type type);
sw buf_inspect_tuple (s_buf *buf, const s_tuple *tuple);
sw buf_inspect_tuple_size (const s_tuple *tuple);
BUF_INSPECT_U_PROTOTYPES(8);
BUF_INSPECT_U_PROTOTYPES(16);
BUF_INSPECT_U_PROTOTYPES(32);
BUF_INSPECT_U_PROTOTYPES(64);
BUF_INSPECT_U_PROTOTYPES(w);
sw buf_inspect_var (s_buf *buf, const s_tag *var);
sw buf_inspect_var_size (const s_tag *var);
sw buf_inspect_void (s_buf *buf, const void *_);
sw buf_inspect_void_size (const void *_);
#endif /* LIBC3_BUF_INSPECT_H */