potion  0.2
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
PNBytes Struct Reference

byte strings are raw character data, volatile, may be appended/changed. More...

#include <potion.h>

Public Member Functions

#define PN_STR_PTR(x)   potion_str_ptr(x)
 
#define PN_STR_B(x)   potion_bytes_string(P, PN_NIL, x)
 
static PN potion_str_ord (Potion *P, PN cl, PN self, PN index)
 
PN potion_bytes_clone (Potion *P, PN cl, PN self)
 
PN potion_bytes_append (Potion *P, PN cl, PN self, PN str)
 
static PN potion_bytes_length (Potion *P, PN cl, PN self)
 
PN potion_bytes_string (Potion *P, PN cl, PN self)
 
static PN potion_bytes_print (Potion *P, PN cl, PN self)
 
static PN potion_bytes_each (Potion *P, PN cl, PN self, PN block)
 
static PN potion_bytes_at (Potion *P, PN cl, PN self, PN index)
 

Data Fields

 PN_OBJECT_HEADER
 PNType vt; PNUniq uniq. More...
 
PN_SIZE len
 
PN_SIZE siz
 
char chars []
 

Detailed Description

byte strings are raw character data, volatile, may be appended/changed.

Definition at line 338 of file potion.h.

Member Function Documentation

static PN potion_str_ord ( Potion P,
PN  cl,
PN  self,
PN  index 
)

"ord" method for PNString and PNBytes. return nil on strings longer than 1 char

Parameters
indexint (optional, default: 0)
Returns
PNInteger

Definition at line 315 of file string.c.

PN potion_bytes_clone ( Potion P,
PN  cl,
PN  self 
)

"clone" returns a copy of the byte buffer

Returns
PNBytes

Definition at line 353 of file string.c.

PN potion_bytes_append ( Potion P,
PN  cl,
PN  self,
PN  str 
)

"append" method.

Parameters
strPNBytes or PNString
Returns
PNBytes

Definition at line 392 of file string.c.

static PN potion_bytes_length ( Potion P,
PN  cl,
PN  self 
)

"length" method. Number of bytes, not chars.

Returns
PNInteger

Definition at line 412 of file string.c.

PN potion_bytes_string ( Potion P,
PN  cl,
PN  self 
)

"string" method.

Definition at line 420 of file string.c.

static PN potion_bytes_print ( Potion P,
PN  cl,
PN  self 
)

"print" method.

Definition at line 435 of file string.c.

static PN potion_bytes_each ( Potion P,
PN  cl,
PN  self,
PN  block 
)

"each" method. call block on all bytes

Parameters
block=&
Returns
PN_NIL

Definition at line 447 of file string.c.

static PN potion_bytes_at ( Potion P,
PN  cl,
PN  self,
PN  index 
)

type_call_is() for PNBytes. (?)

Parameters
indexPNInteger
Returns
PNString substring index .. index+1

Definition at line 461 of file string.c.

Field Documentation

PNBytes::PN_OBJECT_HEADER

PNType vt; PNUniq uniq.

Definition at line 339 of file potion.h.

PN_SIZE PNBytes::len

Definition at line 340 of file potion.h.

PN_SIZE PNBytes::siz

Definition at line 341 of file potion.h.

char PNBytes::chars[]

Definition at line 342 of file potion.h.


The documentation for this struct was generated from the following files: