ESBMC
Efficient SMT-based Context-Bounded Model Checker
Loading...
Searching...
No Matches
string.c File Reference
#include <ctype.h>
#include <limits.h>
#include <stddef.h>
#include <string.h>
#include "python_types.h"
Include dependency graph for string.c:

Functions

_Bool __python_char_isalpha (int c)
long __python_str_hash (const char *s)
size_t __python_strnlen_bounded (const char *s, size_t max_len)
_Bool __python_str_isalpha (const char *s)
static void __python_str_normalize_range (int *start, int *end, size_t len_s)
_Bool __python_char_isdigit (int c)
_Bool __python_str_isdigit (const char *s)
_Bool __python_str_isalnum (const char *s)
_Bool __python_str_isspace (const char *s)
const char * __python_str_lstrip (const char *s)
const char * __python_str_rstrip (const char *s)
const char * __python_str_strip (const char *s)
const char * __python_str_strip_chars (const char *s, const char *chars)
const char * __python_str_lstrip_chars (const char *s, const char *chars)
const char * __python_str_rstrip_chars (const char *s, const char *chars)
_Bool __python_char_islower (int c)
_Bool __python_str_islower (const char *s)
_Bool __python_str_isupper (const char *s)
int __python_char_lower (int c)
int __python_char_upper (int c)
char * __python_str_lower (const char *s)
char * __python_str_upper (const char *s)
char * __python_str_swapcase (const char *s)
char * __python_str_capitalize (const char *s)
char * __python_str_title (const char *s)
size_t __python_str_count (const char *s, const char *sub)
int __python_str_find (const char *s1, const char *s2)
int __python_str_find_range (const char *s1, const char *s2, int start, int end)
int __python_str_rfind (const char *s1, const char *s2)
int __python_str_rfind_range (const char *s1, const char *s2, int start, int end)
char * __python_str_replace (const char *s, const char *old_sub, const char *new_sub, int count)
static _Bool __python_str_split_isspace (char c)
static void __python_str_split_emit (PyObject *items, size_t *count, const char *str, size_t start, size_t end)
struct __ESBMC_PyListObj * __python_str_split (const char *str, const char *sep, long long maxsplit)
static int __python_digit_value (unsigned char c)
 Value of c as an alphanumeric digit (0-9, a-z, A-Z), or -1 when it is not one.
static _Bool __python_is_space (char c)
static const char * __python_skip_space (const char *s)
static _Bool __python_has_prefix (const char *s, char lower)
 Whether s starts with 0 and the prefix letter lower in either case.
static _Bool __python_takes_prefix (const char *s, int *base, int prefix_base)
 Whether s starts with the prefix of prefix_base, which then becomes *base if it was still 0.
static const char * __python_base_prefix (const char *s, int *base)
 Resolves base 0 from the literal's prefix and skips a prefix that matches *base; returns the first character after it.
static int __python_parse_digits (const char **sp, int base, _Bool prefix_consumed, long long *result)
 Folds the digits at *sp into *result, advancing *sp past them and any trailing whitespace; returns the parse status (see __python_int).
static long long __python_int_parse (const char *s, int base, int *status)
long long __python_int (const char *s, int base)
_Bool __python_str_is_int (const char *s, int base)
static int __python_scan_digit_run (const char *s, size_t len, size_t *i, double *value)
 Scan a run of decimal digits starting at s[*i], folding them into *value and advancing *i past the run.
static _Bool __python_parse_float (const char *s, double *out)
double __python_str_to_float (const char *s)
_Bool __python_str_is_float (const char *s)
char * __python_chr (int codepoint)
char * __python_str_repr (const char *s)
int __python_ord (const char *s)
char * __python_str_concat (const char *s1, const char *s2)
char * __python_str_join (const char *sep, struct __ESBMC_PyListObj *list, size_t int_type_id, size_t float_type_id, size_t bool_type_id)
char * __python_str_repeat (const char *s, long long count)
char * __python_str_slice (const char *s, long long start, long long end, long long step)
char * __python_int_to_str (long long v)
char * __python_int_to_bin (long long v)
char * __python_int_to_hex (long long v)
char * __python_int_to_oct (long long v)
char * __python_bool_to_str (_Bool b)
char * __python_float_to_str (double v)
char * __python_float_to_fixed_str (double v, long long prec)

Function Documentation

◆ __python_base_prefix()

const char * __python_base_prefix ( const char * s,
int * base )
static

Resolves base 0 from the literal's prefix and skips a prefix that matches *base; returns the first character after it.

◆ __python_bool_to_str()

char * __python_bool_to_str ( _Bool b)

◆ __python_char_isalpha()

_Bool __python_char_isalpha ( int c)

◆ __python_char_isdigit()

_Bool __python_char_isdigit ( int c)

◆ __python_char_islower()

_Bool __python_char_islower ( int c)

◆ __python_char_lower()

int __python_char_lower ( int c)

◆ __python_char_upper()

int __python_char_upper ( int c)

◆ __python_chr()

char * __python_chr ( int codepoint)

◆ __python_digit_value()

int __python_digit_value ( unsigned char c)
static

Value of c as an alphanumeric digit (0-9, a-z, A-Z), or -1 when it is not one.

The caller applies the base bound.

◆ __python_float_to_fixed_str()

char * __python_float_to_fixed_str ( double v,
long long prec )

◆ __python_float_to_str()

char * __python_float_to_str ( double v)

◆ __python_has_prefix()

_Bool __python_has_prefix ( const char * s,
char lower )
static

Whether s starts with 0 and the prefix letter lower in either case.

◆ __python_int()

long long __python_int ( const char * s,
int base )

◆ __python_int_parse()

long long __python_int_parse ( const char * s,
int base,
int * status )
static

◆ __python_int_to_bin()

char * __python_int_to_bin ( long long v)

◆ __python_int_to_hex()

char * __python_int_to_hex ( long long v)

◆ __python_int_to_oct()

char * __python_int_to_oct ( long long v)

◆ __python_int_to_str()

char * __python_int_to_str ( long long v)

◆ __python_is_space()

_Bool __python_is_space ( char c)
static

◆ __python_ord()

int __python_ord ( const char * s)

◆ __python_parse_digits()

int __python_parse_digits ( const char ** sp,
int base,
_Bool prefix_consumed,
long long * result )
static

Folds the digits at *sp into *result, advancing *sp past them and any trailing whitespace; returns the parse status (see __python_int).

◆ __python_parse_float()

_Bool __python_parse_float ( const char * s,
double * out )
static

◆ __python_scan_digit_run()

int __python_scan_digit_run ( const char * s,
size_t len,
size_t * i,
double * value )
static

Scan a run of decimal digits starting at s[*i], folding them into *value and advancing *i past the run.

PEP 515 allows a single underscore between two digits of the run; a leading, trailing or doubled one is rejected. Returns the digit count, or -1 on a misplaced underscore.

◆ __python_skip_space()

const char * __python_skip_space ( const char * s)
static

◆ __python_str_capitalize()

char * __python_str_capitalize ( const char * s)

◆ __python_str_concat()

char * __python_str_concat ( const char * s1,
const char * s2 )

◆ __python_str_count()

size_t __python_str_count ( const char * s,
const char * sub )

◆ __python_str_find()

int __python_str_find ( const char * s1,
const char * s2 )

◆ __python_str_find_range()

int __python_str_find_range ( const char * s1,
const char * s2,
int start,
int end )

◆ __python_str_hash()

long __python_str_hash ( const char * s)

◆ __python_str_is_float()

_Bool __python_str_is_float ( const char * s)

◆ __python_str_is_int()

_Bool __python_str_is_int ( const char * s,
int base )

◆ __python_str_isalnum()

_Bool __python_str_isalnum ( const char * s)

◆ __python_str_isalpha()

_Bool __python_str_isalpha ( const char * s)

◆ __python_str_isdigit()

_Bool __python_str_isdigit ( const char * s)

◆ __python_str_islower()

_Bool __python_str_islower ( const char * s)

◆ __python_str_isspace()

_Bool __python_str_isspace ( const char * s)

◆ __python_str_isupper()

_Bool __python_str_isupper ( const char * s)

◆ __python_str_join()

char * __python_str_join ( const char * sep,
struct __ESBMC_PyListObj * list,
size_t int_type_id,
size_t float_type_id,
size_t bool_type_id )

◆ __python_str_lower()

char * __python_str_lower ( const char * s)

◆ __python_str_lstrip()

const char * __python_str_lstrip ( const char * s)

◆ __python_str_lstrip_chars()

const char * __python_str_lstrip_chars ( const char * s,
const char * chars )

◆ __python_str_normalize_range()

void __python_str_normalize_range ( int * start,
int * end,
size_t len_s )
static

◆ __python_str_repeat()

char * __python_str_repeat ( const char * s,
long long count )

◆ __python_str_replace()

char * __python_str_replace ( const char * s,
const char * old_sub,
const char * new_sub,
int count )

◆ __python_str_repr()

char * __python_str_repr ( const char * s)

◆ __python_str_rfind()

int __python_str_rfind ( const char * s1,
const char * s2 )

◆ __python_str_rfind_range()

int __python_str_rfind_range ( const char * s1,
const char * s2,
int start,
int end )

◆ __python_str_rstrip()

const char * __python_str_rstrip ( const char * s)

◆ __python_str_rstrip_chars()

const char * __python_str_rstrip_chars ( const char * s,
const char * chars )

◆ __python_str_slice()

char * __python_str_slice ( const char * s,
long long start,
long long end,
long long step )

◆ __python_str_split()

struct __ESBMC_PyListObj * __python_str_split ( const char * str,
const char * sep,
long long maxsplit )

◆ __python_str_split_emit()

void __python_str_split_emit ( PyObject * items,
size_t * count,
const char * str,
size_t start,
size_t end )
static

◆ __python_str_split_isspace()

_Bool __python_str_split_isspace ( char c)
static

◆ __python_str_strip()

const char * __python_str_strip ( const char * s)

◆ __python_str_strip_chars()

const char * __python_str_strip_chars ( const char * s,
const char * chars )

◆ __python_str_swapcase()

char * __python_str_swapcase ( const char * s)

◆ __python_str_title()

char * __python_str_title ( const char * s)

◆ __python_str_to_float()

double __python_str_to_float ( const char * s)

◆ __python_str_upper()

char * __python_str_upper ( const char * s)

◆ __python_strnlen_bounded()

size_t __python_strnlen_bounded ( const char * s,
size_t max_len )

◆ __python_takes_prefix()

_Bool __python_takes_prefix ( const char * s,
int * base,
int prefix_base )
static

Whether s starts with the prefix of prefix_base, which then becomes *base if it was still 0.