Numworks Epsilon  1.4.1
Graphing Calculator Operating System
qstr.c File Reference
#include <assert.h>
#include <string.h>
#include <stdio.h>
#include "py/mpstate.h"
#include "py/qstr.h"
#include "py/gc.h"
#include "genhdr/qstrdefs.generated.h"

Go to the source code of this file.

Macros

#define DEBUG_printf(...)   (void)0
 
#define Q_GET_ALLOC(q)   (MICROPY_QSTR_BYTES_IN_HASH + MICROPY_QSTR_BYTES_IN_LEN + Q_GET_LENGTH(q) + 1)
 
#define Q_GET_DATA(q)   ((q) + MICROPY_QSTR_BYTES_IN_HASH + MICROPY_QSTR_BYTES_IN_LEN)
 
#define QSTR_ENTER()
 
#define QSTR_EXIT()
 
#define QDEF(id, str)   str,
 
#define CONST_POOL   mp_qstr_const_pool
 

Functions

mp_uint_t qstr_compute_hash (const byte *data, size_t len)
 
void qstr_init (void)
 
STATIC const bytefind_qstr (qstr q)
 
STATIC qstr qstr_add (const byte *q_ptr)
 
qstr qstr_find_strn (const char *str, size_t str_len)
 
qstr qstr_from_str (const char *str)
 
qstr qstr_from_strn (const char *str, size_t len)
 
byteqstr_build_start (size_t len, byte **q_ptr)
 
qstr qstr_build_end (byte *q_ptr)
 
mp_uint_t qstr_hash (qstr q)
 
size_t qstr_len (qstr q)
 
const char * qstr_str (qstr q)
 
const byteqstr_data (qstr q, size_t *len)
 
void qstr_pool_info (size_t *n_pool, size_t *n_qstr, size_t *n_str_data_bytes, size_t *n_total_bytes)
 

Variables

const qstr_pool_t mp_qstr_const_pool
 

Macro Definition Documentation

◆ CONST_POOL

#define CONST_POOL   mp_qstr_const_pool

Definition at line 116 of file qstr.c.

◆ DEBUG_printf

#define DEBUG_printf (   ...)    (void)0

Definition at line 42 of file qstr.c.

◆ Q_GET_ALLOC

#define Q_GET_ALLOC (   q)    (MICROPY_QSTR_BYTES_IN_HASH + MICROPY_QSTR_BYTES_IN_LEN + Q_GET_LENGTH(q) + 1)

Definition at line 63 of file qstr.c.

◆ Q_GET_DATA

#define Q_GET_DATA (   q)    ((q) + MICROPY_QSTR_BYTES_IN_HASH + MICROPY_QSTR_BYTES_IN_LEN)

Definition at line 64 of file qstr.c.

◆ QDEF

#define QDEF (   id,
  str 
)    str,

◆ QSTR_ENTER

#define QSTR_ENTER ( )

Definition at line 79 of file qstr.c.

◆ QSTR_EXIT

#define QSTR_EXIT ( )

Definition at line 80 of file qstr.c.

Function Documentation

◆ find_qstr()

STATIC const byte* find_qstr ( qstr  q)

Definition at line 128 of file qstr.c.

◆ qstr_add()

STATIC qstr qstr_add ( const byte q_ptr)

Definition at line 141 of file qstr.c.

◆ qstr_build_end()

qstr qstr_build_end ( byte q_ptr)

Definition at line 253 of file qstr.c.

◆ qstr_build_start()

byte* qstr_build_start ( size_t  len,
byte **  q_ptr 
)

Definition at line 246 of file qstr.c.

◆ qstr_compute_hash()

mp_uint_t qstr_compute_hash ( const byte data,
size_t  len 
)

Definition at line 84 of file qstr.c.

◆ qstr_data()

const byte* qstr_data ( qstr  q,
size_t len 
)

Definition at line 283 of file qstr.c.

◆ qstr_find_strn()

qstr qstr_find_strn ( const char *  str,
size_t  str_len 
)

Definition at line 166 of file qstr.c.

◆ qstr_from_str()

qstr qstr_from_str ( const char *  str)

Definition at line 183 of file qstr.c.

◆ qstr_from_strn()

qstr qstr_from_strn ( const char *  str,
size_t  len 
)

Definition at line 187 of file qstr.c.

◆ qstr_hash()

mp_uint_t qstr_hash ( qstr  q)

Definition at line 269 of file qstr.c.

◆ qstr_init()

void qstr_init ( void  )

Definition at line 119 of file qstr.c.

◆ qstr_len()

size_t qstr_len ( qstr  q)

Definition at line 273 of file qstr.c.

◆ qstr_pool_info()

void qstr_pool_info ( size_t n_pool,
size_t n_qstr,
size_t n_str_data_bytes,
size_t n_total_bytes 
)

Definition at line 289 of file qstr.c.

◆ qstr_str()

const char* qstr_str ( qstr  q)

Definition at line 278 of file qstr.c.

Variable Documentation

◆ mp_qstr_const_pool

const qstr_pool_t mp_qstr_const_pool
Initial value:
= {
NULL,
0,
10,
{
#define QDEF(id, str)
},
}
#define NULL
Definition: stddef.h:4

Definition at line 98 of file qstr.c.