55 STATIC char get_fmt_type(
const char **fmt) {
85 STATIC size_t calc_size_items(
const char *fmt,
size_t *total_sz) {
86 char fmt_type = get_fmt_type(&fmt);
89 for (size = 0; *fmt; fmt++) {
92 cnt = get_fmt_num(&fmt);
104 size = (size + align - 1) & ~(align - 1);
116 calc_size_items(fmt, &size);
128 size_t num_items = calc_size_items(fmt, &total_sz);
129 char fmt_type = get_fmt_type(&fmt);
142 offset = bufinfo.
len + offset;
151 if (p + total_sz > end_p) {
155 for (
size_t i = 0; i < num_items;) {
158 cnt = get_fmt_num(&fmt);
164 res->
items[i++] = item;
168 res->
items[i++] = item;
180 char fmt_type = get_fmt_type(&fmt);
183 for (i = 0; i < n_args;) {
190 cnt = get_fmt_num(&fmt);
197 if (bufinfo.
len < to_copy) {
198 to_copy = bufinfo.
len;
201 memset(p + to_copy, 0, cnt - to_copy);
205 while (cnt-- && i < n_args) {
220 struct_pack_into_internal(
args[0], p, n_args - 1, &
args[1]);
242 if (p + sz > end_p) {
246 struct_pack_into_internal(
args[0], p, n_args - 3, &
args[3]);
void * memset(void *b, int c, size_t len)
void mp_binary_set_val(char struct_type, char val_type, mp_obj_t val_in, byte **ptr)
mp_obj_t mp_obj_new_tuple(size_t n, const mp_obj_t *items)
#define MP_DEFINE_CONST_DICT(dict_name, table_name)
void vstr_init_len(vstr_t *vstr, size_t len)
#define MP_OBJ_FROM_PTR(p)
size_t mp_binary_get_size(char struct_type, char val_type, mp_uint_t *palign)
const mp_obj_module_t mp_module_ustruct
const mp_obj_type_t mp_type_bytes
mp_int_t mp_obj_get_int(mp_const_obj_t arg)
bool unichar_isdigit(unichar c)
#define MP_OBJ_SMALL_INT_VALUE(o)
#define MP_DEFINE_CONST_FUN_OBJ_1(obj_name, fun_name)
#define MP_OBJ_NEW_SMALL_INT(small_int)
mp_obj_t mp_obj_new_bytes(const byte *data, size_t len)
#define MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(obj_name, n_args_min, n_args_max, fun_name)
mp_obj_t mp_obj_new_str_from_vstr(const mp_obj_type_t *type, vstr_t *vstr)
NORETURN void mp_raise_ValueError(const char *msg)
void mp_get_buffer_raise(mp_obj_t obj, mp_buffer_info_t *bufinfo, mp_uint_t flags)
const char * mp_obj_str_get_str(mp_obj_t self_in)
const mp_obj_type_t mp_type_module
#define MP_OBJ_FUN_ARGS_MAX
mp_obj_t mp_parse_num_integer(const char *restrict str_, size_t len, int base, mp_lexer_t *lex)
mp_obj_t mp_binary_get_val(char struct_type, char val_type, byte **ptr)
void * memcpy(void *dst, const void *src, size_t n)