p2  0.0
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
string.c File Reference

internals of utf-8 and byte strings More...

#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include "p2.h"
#include "internal.h"
#include "khash.h"
#include "table.h"
+ Include dependency graph for string.c:

Go to the source code of this file.

Macros

#define BYTES_FACTOR   1 / 8 * 9
#define BYTES_CHUNK   32
#define BYTES_ALIGN(len)   PN_ALIGN(len + sizeof(struct PNBytes), BYTES_CHUNK) - sizeof(struct PNBytes)

Functions

void potion_add_str (Potion *P, PN s)
PN potion_lookup_str (Potion *P, const char *str)
PN potion_str (Potion *P, const char *str)
PN potion_str2 (Potion *P, char *str, size_t len)
PN potion_strcat (Potion *P, char *str, char *str2)
PN potion_str_format (Potion *P, const char *format,...)
static size_t potion_utf8char_offset (const char *s, size_t index)
static PN potion_str_slice_index (PN index, size_t len, int nilvalue)
PN potion_byte_str (Potion *P, const char *str)
PN potion_byte_str2 (Potion *P, const char *str, size_t len)
PN potion_bytes (Potion *P, size_t len)
PN_SIZE pn_printf (Potion *P, PN bytes, const char *format,...)
void potion_bytes_obj_string (Potion *P, PN bytes, PN obj)
void potion_str_hash_init (Potion *P)
void potion_str_init (Potion *P)

Detailed Description

internals of utf-8 and byte strings

See Also
PNString class members
PNBytes class members

Definition in file string.c.

Macro Definition Documentation

#define BYTES_FACTOR   1 / 8 * 9

Definition at line 16 of file string.c.

#define BYTES_CHUNK   32

Definition at line 17 of file string.c.

#define BYTES_ALIGN (   len)    PN_ALIGN(len + sizeof(struct PNBytes), BYTES_CHUNK) - sizeof(struct PNBytes)

Definition at line 18 of file string.c.

Function Documentation

void potion_add_str ( Potion P,
PN  s 
)

Definition at line 20 of file string.c.

PN potion_lookup_str ( Potion P,
const char *  str 
)

Definition at line 26 of file string.c.

PN potion_str ( Potion P,
const char *  str 
)

Definition at line 33 of file string.c.

PN potion_str2 ( Potion P,
char *  str,
size_t  len 
)

Definition at line 47 of file string.c.

PN potion_strcat ( Potion P,
char *  str,
char *  str2 
)

Definition at line 63 of file string.c.

PN potion_str_format ( Potion P,
const char *  format,
  ... 
)

Definition at line 80 of file string.c.

static size_t potion_utf8char_offset ( const char *  s,
size_t  index 
)
static

Definition at line 143 of file string.c.

static PN potion_str_slice_index ( PN  index,
size_t  len,
int  nilvalue 
)
inlinestatic

Definition at line 152 of file string.c.

PN potion_byte_str ( Potion P,
const char *  str 
)

Definition at line 228 of file string.c.

PN potion_byte_str2 ( Potion P,
const char *  str,
size_t  len 
)

Definition at line 232 of file string.c.

PN potion_bytes ( Potion P,
size_t  len 
)

Definition at line 239 of file string.c.

PN_SIZE pn_printf ( Potion P,
PN  bytes,
const char *  format,
  ... 
)

Definition at line 247 of file string.c.

void potion_bytes_obj_string ( Potion P,
PN  bytes,
PN  obj 
)

Definition at line 270 of file string.c.

void potion_str_hash_init ( Potion P)

Definition at line 371 of file string.c.

void potion_str_init ( Potion P)

Definition at line 375 of file string.c.