redefined some types

This commit is contained in:
hyunghwan.chung 2015-10-28 14:58:58 +00:00
parent 2aef6b9bab
commit 98631175d0
17 changed files with 460 additions and 240 deletions

4
stix/configure vendored
View File

@ -17915,8 +17915,8 @@ then
fi fi
fi fi
CFLAGS="$CFLAGS -DSTIX_HAVE_CONFIG_H" CFLAGS="$CFLAGS -DSTIX_HAVE_CFG_H"
CXXFLAGS="$CXXFLAGS -DSTIX_HAVE_CONFIG_H" CXXFLAGS="$CXXFLAGS -DSTIX_HAVE_CFG_H"
CFLAGS="$CFLAGS -D_LARGEFILE64_SOURCE" CFLAGS="$CFLAGS -D_LARGEFILE64_SOURCE"
CXXFLAGS="$CXXFLAGS -D_LARGEFILE64_SOURCE" CXXFLAGS="$CXXFLAGS -D_LARGEFILE64_SOURCE"

View File

@ -95,8 +95,8 @@ then
fi fi
dnl indicate the existence of config.h dnl indicate the existence of config.h
CFLAGS="$CFLAGS -DSTIX_HAVE_CONFIG_H" CFLAGS="$CFLAGS -DSTIX_HAVE_CFG_H"
CXXFLAGS="$CXXFLAGS -DSTIX_HAVE_CONFIG_H" CXXFLAGS="$CXXFLAGS -DSTIX_HAVE_CFG_H"
dnl make visible the 64-bit interface to the file system dnl make visible the 64-bit interface to the file system
CFLAGS="$CFLAGS -D_LARGEFILE64_SOURCE" CFLAGS="$CFLAGS -D_LARGEFILE64_SOURCE"

View File

@ -79,7 +79,7 @@ typedef struct var_info_t var_info_t;
static struct voca_t static struct voca_t
{ {
stix_oow_t len; stix_oow_t len;
stix_uch_t str[11]; stix_ooch_t str[11];
} vocas[] = { } vocas[] = {
{ 4, { 'b','y','t','e' } }, { 4, { 'b','y','t','e' } },
{ 9, { 'c','h','a','r','a','c','t','e','r' } }, { 9, { 'c','h','a','r','a','c','t','e','r' } },
@ -147,7 +147,7 @@ static int compile_method_statement (stix_t* stix);
static int compile_method_expression (stix_t* stix, int pop); static int compile_method_expression (stix_t* stix, int pop);
static int add_literal (stix_t* stix, stix_oop_t lit, stix_size_t* index); static int add_literal (stix_t* stix, stix_oop_t lit, stix_size_t* index);
static STIX_INLINE int is_spacechar (stix_uci_t c) static STIX_INLINE int is_spacechar (stix_ooci_t c)
{ {
/* TODO: handle other space unicode characters */ /* TODO: handle other space unicode characters */
switch (c) switch (c)
@ -166,25 +166,25 @@ static STIX_INLINE int is_spacechar (stix_uci_t c)
} }
static STIX_INLINE int is_alphachar (stix_uci_t c) static STIX_INLINE int is_alphachar (stix_ooci_t c)
{ {
/* TODO: support full unicode */ /* TODO: support full unicode */
return (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z'); return (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z');
} }
static STIX_INLINE int is_digitchar (stix_uci_t c) static STIX_INLINE int is_digitchar (stix_ooci_t c)
{ {
/* TODO: support full unicode */ /* TODO: support full unicode */
return (c >= '0' && c <= '9'); return (c >= '0' && c <= '9');
} }
static STIX_INLINE int is_alnumchar (stix_uci_t c) static STIX_INLINE int is_alnumchar (stix_ooci_t c)
{ {
/* TODO: support full unicode */ /* TODO: support full unicode */
return (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || (c >= '0' && c <= '9'); return (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || (c >= '0' && c <= '9');
} }
static STIX_INLINE int is_binselchar (stix_uci_t c) static STIX_INLINE int is_binselchar (stix_ooci_t c)
{ {
/* /*
* binary-selector-character := * binary-selector-character :=
@ -218,17 +218,17 @@ static STIX_INLINE int is_binselchar (stix_uci_t c)
} }
} }
static STIX_INLINE int is_leadidentchar (stix_uci_t c) static STIX_INLINE int is_leadidentchar (stix_ooci_t c)
{ {
return is_alphachar(c) || c == '_'; return is_alphachar(c) || c == '_';
} }
static STIX_INLINE int is_identchar (stix_uci_t c) static STIX_INLINE int is_identchar (stix_ooci_t c)
{ {
return is_alnumchar(c) || c == '_'; return is_alnumchar(c) || c == '_';
} }
static STIX_INLINE int is_closing_char (stix_uci_t c) static STIX_INLINE int is_closing_char (stix_ooci_t c)
{ {
switch (c) switch (c)
{ {
@ -271,12 +271,12 @@ static STIX_INLINE int is_token_keyword (stix_t* stix, voca_id_t id)
return stix->c->tok.type == STIX_IOTOK_KEYWORD && does_token_name_match(stix, id); return stix->c->tok.type == STIX_IOTOK_KEYWORD && does_token_name_match(stix, id);
} }
static STIX_INLINE int is_word (const stix_ucs_t* ucs, voca_id_t id) static STIX_INLINE int is_word (const stix_oocs_t* ucs, voca_id_t id)
{ {
return ucs->len == vocas[id].len && stix_equalchars(ucs->ptr, vocas[id].str, vocas[id].len); return ucs->len == vocas[id].len && stix_equalchars(ucs->ptr, vocas[id].str, vocas[id].len);
} }
static int is_reserved_word (const stix_ucs_t* ucs) static int is_reserved_word (const stix_oocs_t* ucs)
{ {
static int rw[] = static int rw[] =
{ {
@ -300,7 +300,7 @@ static int is_reserved_word (const stix_ucs_t* ucs)
static int begin_include (stix_t* fsc); static int begin_include (stix_t* fsc);
static int end_include (stix_t* fsc); static int end_include (stix_t* fsc);
static void set_syntax_error (stix_t* stix, stix_synerrnum_t num, const stix_ioloc_t* loc, const stix_ucs_t* tgt) static void set_syntax_error (stix_t* stix, stix_synerrnum_t num, const stix_ioloc_t* loc, const stix_oocs_t* tgt)
{ {
stix->errnum = STIX_ESYNTAX; stix->errnum = STIX_ESYNTAX;
stix->c->synerr.num = num; stix->c->synerr.num = num;
@ -313,7 +313,7 @@ static void set_syntax_error (stix_t* stix, stix_synerrnum_t num, const stix_iol
} }
} }
static int copy_string_to (stix_t* stix, const stix_ucs_t* src, stix_ucs_t* dst, stix_size_t* dst_capa, int append, stix_uch_t add_delim) static int copy_string_to (stix_t* stix, const stix_oocs_t* src, stix_oocs_t* dst, stix_size_t* dst_capa, int append, stix_ooch_t add_delim)
{ {
stix_size_t len, pos; stix_size_t len, pos;
@ -331,7 +331,7 @@ static int copy_string_to (stix_t* stix, const stix_ucs_t* src, stix_ucs_t* dst,
if (len > *dst_capa) if (len > *dst_capa)
{ {
stix_uch_t* tmp; stix_ooch_t* tmp;
stix_size_t capa; stix_size_t capa;
capa = STIX_ALIGN(len, CLASS_BUFFER_ALIGN); capa = STIX_ALIGN(len, CLASS_BUFFER_ALIGN);
@ -344,12 +344,12 @@ static int copy_string_to (stix_t* stix, const stix_ucs_t* src, stix_ucs_t* dst,
} }
if (append && add_delim) dst->ptr[pos++] = add_delim; if (append && add_delim) dst->ptr[pos++] = add_delim;
stix_copyuchars (&dst->ptr[pos], src->ptr, src->len); stix_copyoochars (&dst->ptr[pos], src->ptr, src->len);
dst->len = len; dst->len = len;
return 0; return 0;
} }
static int find_word_in_string (const stix_ucs_t* haystack, const stix_ucs_t* name, stix_size_t* xindex) static int find_word_in_string (const stix_oocs_t* haystack, const stix_oocs_t* name, stix_size_t* xindex)
{ {
/* this function is inefficient. but considering the typical number /* this function is inefficient. but considering the typical number
* of arguments and temporary variables, the inefficiency can be * of arguments and temporary variables, the inefficiency can be
@ -357,7 +357,7 @@ static int find_word_in_string (const stix_ucs_t* haystack, const stix_ucs_t* na
* table from a name to an index should be greater than this simple * table from a name to an index should be greater than this simple
* inefficient lookup */ * inefficient lookup */
stix_uch_t* t, * e; stix_ooch_t* t, * e;
stix_size_t index, i; stix_size_t index, i;
t = haystack->ptr; t = haystack->ptr;
@ -401,7 +401,7 @@ static int find_word_in_string (const stix_ucs_t* haystack, const stix_ucs_t* na
(c >= 'A' && c <= 'Z')? ((c - 'A' + 10 < base)? (c - 'A' + 10): base): \ (c >= 'A' && c <= 'Z')? ((c - 'A' + 10 < base)? (c - 'A' + 10): base): \
(c >= 'a' && c <= 'z')? ((c - 'a' + 10 < base)? (c - 'a' + 10): base): base) (c >= 'a' && c <= 'z')? ((c - 'a' + 10 < base)? (c - 'a' + 10): base): base)
static int string_to_smint (stix_t* stix, stix_ucs_t* str, int radixed, stix_ooi_t* num) static int string_to_smint (stix_t* stix, stix_oocs_t* str, int radixed, stix_ooi_t* num)
{ {
/* it is not a generic conversion function. /* it is not a generic conversion function.
* it assumes a certain pre-sanity check on the string * it assumes a certain pre-sanity check on the string
@ -409,7 +409,7 @@ static int string_to_smint (stix_t* stix, stix_ucs_t* str, int radixed, stix_ooi
/* TODO: handle floating point numbers, etc, handle radix */ /* TODO: handle floating point numbers, etc, handle radix */
int v, negsign, base; int v, negsign, base;
const stix_uch_t* ptr, * end; const stix_ooch_t* ptr, * end;
stix_oow_t value, old_value; stix_oow_t value, old_value;
negsign = 0; negsign = 0;
@ -514,18 +514,18 @@ static int string_to_smint (stix_t* stix, stix_ucs_t* str, int radixed, stix_ooi
do { if (add_token_char(stix, c) <= -1) return -1; } while (0) do { if (add_token_char(stix, c) <= -1) return -1; } while (0)
static STIX_INLINE int add_token_str (stix_t* stix, const stix_uch_t* ptr, stix_size_t len) static STIX_INLINE int add_token_str (stix_t* stix, const stix_ooch_t* ptr, stix_size_t len)
{ {
stix_ucs_t tmp; stix_oocs_t tmp;
tmp.ptr = (stix_uch_t*)ptr; tmp.ptr = (stix_ooch_t*)ptr;
tmp.len = len; tmp.len = len;
return copy_string_to (stix, &tmp, &stix->c->tok.name, &stix->c->tok.name_capa, 1, '\0'); return copy_string_to (stix, &tmp, &stix->c->tok.name, &stix->c->tok.name_capa, 1, '\0');
} }
static STIX_INLINE int add_token_char (stix_t* stix, stix_uch_t c) static STIX_INLINE int add_token_char (stix_t* stix, stix_ooch_t c)
{ {
stix_ucs_t tmp; stix_oocs_t tmp;
tmp.ptr = &c; tmp.ptr = &c;
tmp.len = 1; tmp.len = 1;
@ -542,7 +542,7 @@ static STIX_INLINE void unget_char (stix_t* stix, const stix_iolxc_t* c)
static int get_char (stix_t* stix) static int get_char (stix_t* stix)
{ {
stix_ssize_t n; stix_ssize_t n;
stix_uci_t lc, ec; stix_ooci_t lc, ec;
if (stix->c->nungots > 0) if (stix->c->nungots > 0)
{ {
@ -648,7 +648,7 @@ static int skip_spaces (stix_t* stix)
static int skip_comment (stix_t* stix) static int skip_comment (stix_t* stix)
{ {
stix_uci_t c = stix->c->lxc.c; stix_ooci_t c = stix->c->lxc.c;
stix_iolxc_t lc; stix_iolxc_t lc;
if (c == '"') if (c == '"')
@ -706,14 +706,14 @@ static int skip_comment (stix_t* stix)
return 0; return 0;
} }
static int get_ident (stix_t* stix, stix_uci_t char_read_ahead) static int get_ident (stix_t* stix, stix_ooci_t char_read_ahead)
{ {
/* /*
* identifier := alpha-char (alpha-char | digit-char)* * identifier := alpha-char (alpha-char | digit-char)*
* keyword := identifier ":" * keyword := identifier ":"
*/ */
stix_uci_t c; stix_ooci_t c;
c = stix->c->lxc.c; c = stix->c->lxc.c;
stix->c->tok.type = STIX_IOTOK_IDENT; stix->c->tok.type = STIX_IOTOK_IDENT;
@ -839,7 +839,7 @@ static int get_numlit (stix_t* stix, int negated)
* fractionalDigits := decimal-integer * fractionalDigits := decimal-integer
*/ */
stix_uci_t c; stix_ooci_t c;
int radix = 0, r; int radix = 0, r;
c = stix->c->lxc.c; c = stix->c->lxc.c;
@ -905,7 +905,7 @@ static int get_charlit (stix_t* stix)
* character := normal-character | "'" * character := normal-character | "'"
*/ */
stix_uci_t c = stix->c->lxc.c; /* even a new-line or white space would be taken */ stix_ooci_t c = stix->c->lxc.c; /* even a new-line or white space would be taken */
if (c == STIX_UCI_EOF) if (c == STIX_UCI_EOF)
{ {
set_syntax_error (stix, STIX_SYNERR_CLTNT, &stix->c->lxc.l, STIX_NULL); set_syntax_error (stix, STIX_SYNERR_CLTNT, &stix->c->lxc.l, STIX_NULL);
@ -927,7 +927,7 @@ static int get_strlit (stix_t* stix)
* normal-character := character-except-single-quote * normal-character := character-except-single-quote
*/ */
stix_uci_t c = stix->c->lxc.c; stix_ooci_t c = stix->c->lxc.c;
stix->c->tok.type = STIX_IOTOK_STRLIT; stix->c->tok.type = STIX_IOTOK_STRLIT;
do do
@ -953,12 +953,12 @@ static int get_strlit (stix_t* stix)
return 0; return 0;
} }
static int get_string (stix_t* stix, stix_uch_t end_char, stix_uch_t esc_char, int regex, stix_size_t preescaped) static int get_string (stix_t* stix, stix_ooch_t end_char, stix_ooch_t esc_char, int regex, stix_size_t preescaped)
{ {
stix_uci_t c; stix_ooci_t c;
stix_size_t escaped = preescaped; stix_size_t escaped = preescaped;
stix_size_t digit_count = 0; stix_size_t digit_count = 0;
stix_uci_t c_acc = 0; stix_ooci_t c_acc = 0;
stix->c->tok.type = STIX_IOTOK_STRLIT; stix->c->tok.type = STIX_IOTOK_STRLIT;
@ -1030,7 +1030,7 @@ static int get_string (stix_t* stix, stix_uch_t end_char, stix_uch_t esc_char, i
} }
else else
{ {
stix_uch_t rc; stix_ooch_t rc;
rc = (escaped == 2)? 'x': rc = (escaped == 2)? 'x':
(escaped == 4)? 'u': 'U'; (escaped == 4)? 'u': 'U';
@ -1081,14 +1081,14 @@ static int get_string (stix_t* stix, stix_uch_t end_char, stix_uch_t esc_char, i
c_acc = 0; c_acc = 0;
continue; continue;
} }
else if (c == 'u' && STIX_SIZEOF(stix_uch_t) >= 2) else if (c == 'u' && STIX_SIZEOF(stix_ooch_t) >= 2)
{ {
escaped = 4; escaped = 4;
digit_count = 0; digit_count = 0;
c_acc = 0; c_acc = 0;
continue; continue;
} }
else if (c == 'U' && STIX_SIZEOF(stix_uch_t) >= 4) else if (c == 'U' && STIX_SIZEOF(stix_ooch_t) >= 4)
{ {
escaped = 8; escaped = 8;
digit_count = 0; digit_count = 0;
@ -1119,7 +1119,7 @@ static int get_binsel (stix_t* stix)
/* /*
* binary-selector := binary-selector-character+ * binary-selector := binary-selector-character+
*/ */
stix_uci_t oc; stix_ooci_t oc;
oc = stix->c->lxc.c; oc = stix->c->lxc.c;
ADD_TOKEN_CHAR (stix, oc); ADD_TOKEN_CHAR (stix, oc);
@ -1150,7 +1150,7 @@ static int get_binsel (stix_t* stix)
static int get_token (stix_t* stix) static int get_token (stix_t* stix)
{ {
stix_uci_t c; stix_ooci_t c;
int n; int n;
retry: retry:
@ -1374,7 +1374,7 @@ retry:
case 'S': /* a string with a C-style escape sequences */ case 'S': /* a string with a C-style escape sequences */
case 'M': /* a symbol with a C-style escape sequences */ case 'M': /* a symbol with a C-style escape sequences */
{ {
stix_uci_t saved_c = c; stix_ooci_t saved_c = c;
GET_CHAR_TO (stix, c); GET_CHAR_TO (stix, c);
if (c == '\'') if (c == '\'')
@ -1437,7 +1437,7 @@ retry:
} }
else else
{ {
stix->c->ilchr = (stix_uch_t)c; stix->c->ilchr = (stix_ooch_t)c;
set_syntax_error (stix, STIX_SYNERR_ILCHR, &stix->c->lxc.l, &stix->c->ilchr_ucs); set_syntax_error (stix, STIX_SYNERR_ILCHR, &stix->c->lxc.l, &stix->c->ilchr_ucs);
return -1; return -1;
} }
@ -1451,7 +1451,7 @@ retry:
/* /*
printf ("TOKEN: ["); printf ("TOKEN: [");
print_ucs (&stix->c->tok.name); print_oocs (&stix->c->tok.name);
printf ("]\n"); printf ("]\n");
*/ */
return 0; return 0;
@ -1472,17 +1472,17 @@ static void clear_io_names (stix_t* stix)
} }
} }
static const stix_uch_t* add_io_name (stix_t* stix, const stix_ucs_t* name) static const stix_ooch_t* add_io_name (stix_t* stix, const stix_oocs_t* name)
{ {
stix_iolink_t* link; stix_iolink_t* link;
stix_uch_t* ptr; stix_ooch_t* ptr;
link = (stix_iolink_t*) stix_callocmem (stix, STIX_SIZEOF(*link) + STIX_SIZEOF(stix_uch_t) * (name->len + 1)); link = (stix_iolink_t*) stix_callocmem (stix, STIX_SIZEOF(*link) + STIX_SIZEOF(stix_ooch_t) * (name->len + 1));
if (!link) return STIX_NULL; if (!link) return STIX_NULL;
ptr = (stix_uch_t*)(link + 1); ptr = (stix_ooch_t*)(link + 1);
stix_copyuchars (ptr, name->ptr, name->len); stix_copyoochars (ptr, name->ptr, name->len);
ptr[name->len] = '\0'; ptr[name->len] = '\0';
link->link = stix->c->io_names; link->link = stix->c->io_names;
@ -1494,7 +1494,7 @@ static const stix_uch_t* add_io_name (stix_t* stix, const stix_ucs_t* name)
static int begin_include (stix_t* stix) static int begin_include (stix_t* stix)
{ {
stix_io_arg_t* arg; stix_io_arg_t* arg;
const stix_uch_t* io_name; const stix_ooch_t* io_name;
io_name = add_io_name (stix, &stix->c->tok.name); io_name = add_io_name (stix, &stix->c->tok.name);
if (!io_name) return -1; if (!io_name) return -1;
@ -1806,12 +1806,12 @@ static int add_literal (stix_t* stix, stix_oop_t lit, stix_size_t* index)
return 0; return 0;
} }
static STIX_INLINE int add_character_literal (stix_t* stix, stix_uch_t ch, stix_size_t* index) static STIX_INLINE int add_character_literal (stix_t* stix, stix_ooch_t ch, stix_size_t* index)
{ {
return add_literal (stix, STIX_OOP_FROM_CHAR(ch), index); return add_literal (stix, STIX_OOP_FROM_CHAR(ch), index);
} }
static int add_string_literal (stix_t* stix, const stix_ucs_t* str, stix_size_t* index) static int add_string_literal (stix_t* stix, const stix_oocs_t* str, stix_size_t* index)
{ {
stix_oop_t lit; stix_oop_t lit;
stix_size_t i; stix_size_t i;
@ -1835,7 +1835,7 @@ static int add_string_literal (stix_t* stix, const stix_ucs_t* str, stix_size_t*
return add_literal (stix, lit, index); return add_literal (stix, lit, index);
} }
static int add_symbol_literal (stix_t* stix, const stix_ucs_t* str, stix_size_t* index) static int add_symbol_literal (stix_t* stix, const stix_oocs_t* str, stix_size_t* index)
{ {
stix_oop_t tmp; stix_oop_t tmp;
@ -1845,21 +1845,21 @@ static int add_symbol_literal (stix_t* stix, const stix_ucs_t* str, stix_size_t*
return add_literal (stix, tmp, index); return add_literal (stix, tmp, index);
} }
static STIX_INLINE int set_class_fqn (stix_t* stix, const stix_ucs_t* name) static STIX_INLINE int set_class_fqn (stix_t* stix, const stix_oocs_t* name)
{ {
if (copy_string_to (stix, name, &stix->c->cls.fqn, &stix->c->cls.fqn_capa, 0, '\0') <= -1) return -1; if (copy_string_to (stix, name, &stix->c->cls.fqn, &stix->c->cls.fqn_capa, 0, '\0') <= -1) return -1;
stix->c->cls.name = stix->c->cls.fqn; stix->c->cls.name = stix->c->cls.fqn;
return 0; return 0;
} }
static STIX_INLINE int set_superclass_fqn (stix_t* stix, const stix_ucs_t* name) static STIX_INLINE int set_superclass_fqn (stix_t* stix, const stix_oocs_t* name)
{ {
if (copy_string_to (stix, name, &stix->c->cls.superfqn, &stix->c->cls.superfqn_capa, 0, '\0') <= -1) return -1; if (copy_string_to (stix, name, &stix->c->cls.superfqn, &stix->c->cls.superfqn_capa, 0, '\0') <= -1) return -1;
stix->c->cls.supername = stix->c->cls.superfqn; stix->c->cls.supername = stix->c->cls.superfqn;
return 0; return 0;
} }
static STIX_INLINE int add_class_level_variable (stix_t* stix, var_type_t index, const stix_ucs_t* name) static STIX_INLINE int add_class_level_variable (stix_t* stix, var_type_t index, const stix_oocs_t* name)
{ {
int n; int n;
@ -1873,7 +1873,7 @@ static STIX_INLINE int add_class_level_variable (stix_t* stix, var_type_t index,
return n; return n;
} }
static STIX_INLINE int add_pool_dictionary (stix_t* stix, const stix_ucs_t* name, stix_oop_set_t pooldic_oop) static STIX_INLINE int add_pool_dictionary (stix_t* stix, const stix_oocs_t* name, stix_oop_set_t pooldic_oop)
{ {
int n; int n;
stix_size_t saved_len; stix_size_t saved_len;
@ -1909,13 +1909,13 @@ static STIX_INLINE int add_pool_dictionary (stix_t* stix, const stix_ucs_t* name
} }
static stix_ssize_t find_class_level_variable (stix_t* stix, stix_oop_class_t self, const stix_ucs_t* name, var_info_t* var) static stix_ssize_t find_class_level_variable (stix_t* stix, stix_oop_class_t self, const stix_oocs_t* name, var_info_t* var)
{ {
stix_size_t pos; stix_size_t pos;
stix_oop_t super; stix_oop_t super;
stix_oop_char_t v; stix_oop_char_t v;
stix_oop_char_t* vv; stix_oop_char_t* vv;
stix_ucs_t hs; stix_oocs_t hs;
int index; int index;
if (self) if (self)
@ -2045,7 +2045,7 @@ done:
return pos; return pos;
} }
static int clone_assignee (stix_t* stix, const stix_ucs_t* name, stix_size_t* offset) static int clone_assignee (stix_t* stix, const stix_oocs_t* name, stix_size_t* offset)
{ {
int n; int n;
stix_size_t old_len; stix_size_t old_len;
@ -2060,7 +2060,7 @@ static int clone_assignee (stix_t* stix, const stix_ucs_t* name, stix_size_t* of
return 0; return 0;
} }
static int clone_binary_selector (stix_t* stix, const stix_ucs_t* name, stix_size_t* offset) static int clone_binary_selector (stix_t* stix, const stix_oocs_t* name, stix_size_t* offset)
{ {
int n; int n;
stix_size_t old_len; stix_size_t old_len;
@ -2075,7 +2075,7 @@ static int clone_binary_selector (stix_t* stix, const stix_ucs_t* name, stix_siz
return 0; return 0;
} }
static int clone_keyword (stix_t* stix, const stix_ucs_t* name, stix_size_t* offset) static int clone_keyword (stix_t* stix, const stix_oocs_t* name, stix_size_t* offset)
{ {
int n; int n;
stix_size_t old_len; stix_size_t old_len;
@ -2090,31 +2090,31 @@ static int clone_keyword (stix_t* stix, const stix_ucs_t* name, stix_size_t* off
return 0; return 0;
} }
static int add_method_name_fragment (stix_t* stix, const stix_ucs_t* name) static int add_method_name_fragment (stix_t* stix, const stix_oocs_t* name)
{ {
/* method name fragments are concatenated without any delimiters */ /* method name fragments are concatenated without any delimiters */
return copy_string_to (stix, name, &stix->c->mth.name, &stix->c->mth.name_capa, 1, '\0'); return copy_string_to (stix, name, &stix->c->mth.name, &stix->c->mth.name_capa, 1, '\0');
} }
static int method_exists (stix_t* stix, const stix_ucs_t* name) static int method_exists (stix_t* stix, const stix_oocs_t* name)
{ {
/* check if the current class contains a method of the given name */ /* check if the current class contains a method of the given name */
return stix_lookupdic (stix, stix->c->cls.mthdic_oop[stix->c->mth.type], name) != STIX_NULL; return stix_lookupdic (stix, stix->c->cls.mthdic_oop[stix->c->mth.type], name) != STIX_NULL;
} }
static int add_temporary_variable (stix_t* stix, const stix_ucs_t* name) static int add_temporary_variable (stix_t* stix, const stix_oocs_t* name)
{ {
/* temporary variable names are added to the string with leading /* temporary variable names are added to the string with leading
* space if it's not the first variable */ * space if it's not the first variable */
return copy_string_to (stix, name, &stix->c->mth.tmprs, &stix->c->mth.tmprs_capa, 1, ' '); return copy_string_to (stix, name, &stix->c->mth.tmprs, &stix->c->mth.tmprs_capa, 1, ' ');
} }
static STIX_INLINE int find_temporary_variable (stix_t* stix, const stix_ucs_t* name, stix_size_t* xindex) static STIX_INLINE int find_temporary_variable (stix_t* stix, const stix_oocs_t* name, stix_size_t* xindex)
{ {
return find_word_in_string (&stix->c->mth.tmprs, name, xindex); return find_word_in_string (&stix->c->mth.tmprs, name, xindex);
} }
static stix_oop_set_t add_namespace (stix_t* stix, stix_oop_set_t dic, const stix_ucs_t* name) static stix_oop_set_t add_namespace (stix_t* stix, stix_oop_set_t dic, const stix_oocs_t* name)
{ {
stix_size_t tmp_count = 0; stix_size_t tmp_count = 0;
stix_oop_t sym; stix_oop_t sym;
@ -2144,11 +2144,11 @@ oops:
return STIX_NULL; return STIX_NULL;
} }
static int preprocess_dotted_name (stix_t* stix, int dont_add_ns, int accept_pooldic_as_ns, const stix_ucs_t* fqn, const stix_ioloc_t* fqn_loc, stix_ucs_t* name, stix_oop_set_t* ns_oop) static int preprocess_dotted_name (stix_t* stix, int dont_add_ns, int accept_pooldic_as_ns, const stix_oocs_t* fqn, const stix_ioloc_t* fqn_loc, stix_oocs_t* name, stix_oop_set_t* ns_oop)
{ {
const stix_uch_t* ptr, * dot; const stix_ooch_t* ptr, * dot;
stix_size_t len; stix_size_t len;
stix_ucs_t seg; stix_oocs_t seg;
stix_oop_set_t dic; stix_oop_set_t dic;
stix_oop_association_t ass; stix_oop_association_t ass;
int pooldic_gotten = 0; int pooldic_gotten = 0;
@ -2159,9 +2159,9 @@ static int preprocess_dotted_name (stix_t* stix, int dont_add_ns, int accept_poo
while (1) while (1)
{ {
seg.ptr = (stix_uch_t*)ptr; seg.ptr = (stix_ooch_t*)ptr;
dot = stix_findchar (ptr, len, '.'); dot = stix_findoochar (ptr, len, '.');
if (dot) if (dot)
{ {
if (pooldic_gotten) goto wrong_name; if (pooldic_gotten) goto wrong_name;
@ -2281,7 +2281,7 @@ static int compile_class_level_variables (stix_t* stix)
{ {
/* pool dictionary import declaration /* pool dictionary import declaration
* #dcl(#pooldic) ... */ * #dcl(#pooldic) ... */
stix_ucs_t last; stix_oocs_t last;
stix_oop_set_t ns_oop; stix_oop_set_t ns_oop;
stix_oop_association_t ass; stix_oop_association_t ass;
stix_size_t i; stix_size_t i;
@ -2547,7 +2547,7 @@ static int compile_method_primitive (stix_t* stix)
* method-primitive := "<" "primitive:" integer ">" * method-primitive := "<" "primitive:" integer ">"
*/ */
stix_ooi_t prim_no; stix_ooi_t prim_no;
const stix_uch_t* ptr, * end; const stix_ooch_t* ptr, * end;
if (!is_token_binary_selector(stix, VOCA_LT)) if (!is_token_binary_selector(stix, VOCA_LT))
{ {
@ -2595,9 +2595,9 @@ static int compile_method_primitive (stix_t* stix)
prim_no = stix_getprimno (stix, &stix->c->tok.name); prim_no = stix_getprimno (stix, &stix->c->tok.name);
if (prim_no <= -1) if (prim_no <= -1)
{ {
const stix_uch_t* us; const stix_ooch_t* us;
/* the primitive is not found */ /* the primitive is not found */
us = stix_findchar (stix->c->tok.name.ptr, stix->c->tok.name.len, '_'); us = stix_findoochar (stix->c->tok.name.ptr, stix->c->tok.name.len, '_');
if (us > stix->c->tok.name.ptr && us < stix->c->tok.name.ptr + stix->c->tok.name.len - 1) if (us > stix->c->tok.name.ptr && us < stix->c->tok.name.ptr + stix->c->tok.name.len - 1)
{ {
stix_size_t lit_idx; stix_size_t lit_idx;
@ -2642,7 +2642,7 @@ static int compile_method_primitive (stix_t* stix)
return 0; return 0;
} }
static int get_variable_info (stix_t* stix, const stix_ucs_t* name, const stix_ioloc_t* name_loc, int name_dotted, var_info_t* var) static int get_variable_info (stix_t* stix, const stix_oocs_t* name, const stix_ioloc_t* name_loc, int name_dotted, var_info_t* var)
{ {
stix_size_t index; stix_size_t index;
@ -2656,17 +2656,17 @@ static int get_variable_info (stix_t* stix, const stix_ucs_t* name, const stix_i
* A.B.C - namespace or pool dictionary related reference. * A.B.C - namespace or pool dictionary related reference.
*/ */
stix_ucs_t last; stix_oocs_t last;
stix_oop_set_t ns_oop; stix_oop_set_t ns_oop;
stix_oop_association_t ass; stix_oop_association_t ass;
const stix_uch_t* dot; const stix_ooch_t* dot;
dot = stix_findchar (name->ptr, name->len, '.'); dot = stix_findoochar (name->ptr, name->len, '.');
STIX_ASSERT (dot != STIX_NULL); STIX_ASSERT (dot != STIX_NULL);
if (dot - name->ptr == 4 && stix_equalchars(name->ptr, vocas[VOCA_SELF].str, 4)) if (dot - name->ptr == 4 && stix_equalchars(name->ptr, vocas[VOCA_SELF].str, 4))
{ {
/* the dotted name begins with self. */ /* the dotted name begins with self. */
dot = stix_findchar (dot + 1, name->len - 5, '.'); dot = stix_findoochar (dot + 1, name->len - 5, '.');
if (!dot) if (!dot)
{ {
/* the dotted name is composed of 2 segments only */ /* the dotted name is composed of 2 segments only */
@ -2691,7 +2691,7 @@ static int get_variable_info (stix_t* stix, const stix_ucs_t* name, const stix_i
if (preprocess_dotted_name (stix, 1, 1, name, name_loc, &last, &ns_oop) <= -1) return -1; if (preprocess_dotted_name (stix, 1, 1, name, name_loc, &last, &ns_oop) <= -1) return -1;
printf ("checking variable "); printf ("checking variable ");
print_ucs (&last); print_oocs (&last);
printf ("\n"); printf ("\n");
ass = stix_lookupdic (stix, ns_oop, &last); ass = stix_lookupdic (stix, ns_oop, &last);
if (ass) if (ass)
@ -3333,7 +3333,7 @@ printf ("\tpush_literal array\n");
return 0; return 0;
} }
static int compile_expression_primary (stix_t* stix, const stix_ucs_t* ident, const stix_ioloc_t* ident_loc, int ident_dotted, int* to_super) static int compile_expression_primary (stix_t* stix, const stix_oocs_t* ident, const stix_ioloc_t* ident_loc, int ident_dotted, int* to_super)
{ {
/* /*
* expression-primary := identifier | literal | block-constructor | ( "(" method-expression ")" ) * expression-primary := identifier | literal | block-constructor | ( "(" method-expression ")" )
@ -3580,7 +3580,7 @@ static int compile_unary_message (stix_t* stix, int to_super)
if (add_symbol_literal(stix, &stix->c->tok.name, &index) <= -1 || if (add_symbol_literal(stix, &stix->c->tok.name, &index) <= -1 ||
emit_double_param_instruction(stix, send_message_cmd[to_super], 0, index) <= -1) return -1; emit_double_param_instruction(stix, send_message_cmd[to_super], 0, index) <= -1) return -1;
printf ("\tsend unary message %d [", (int)index); printf ("\tsend unary message %d [", (int)index);
print_ucs (&stix->c->tok.name); print_oocs (&stix->c->tok.name);
printf ("] with 0 arguments %s\n", (to_super? " to super": "")); printf ("] with 0 arguments %s\n", (to_super? " to super": ""));
GET_TOKEN (stix); GET_TOKEN (stix);
@ -3598,7 +3598,7 @@ static int compile_binary_message (stix_t* stix, int to_super)
*/ */
stix_size_t index; stix_size_t index;
int to_super2; int to_super2;
stix_ucs_t binsel; stix_oocs_t binsel;
stix_size_t saved_binsels_len, binsel_offset; stix_size_t saved_binsels_len, binsel_offset;
STIX_ASSERT (stix->c->tok.type == STIX_IOTOK_BINSEL); STIX_ASSERT (stix->c->tok.type == STIX_IOTOK_BINSEL);
@ -3623,7 +3623,7 @@ static int compile_binary_message (stix_t* stix, int to_super)
if (add_symbol_literal(stix, &binsel, &index) <= -1 || if (add_symbol_literal(stix, &binsel, &index) <= -1 ||
emit_double_param_instruction(stix, send_message_cmd[to_super], 1, index) <= -1) goto oops; emit_double_param_instruction(stix, send_message_cmd[to_super], 1, index) <= -1) goto oops;
printf ("\tsend binary message %d [", (int)index); printf ("\tsend binary message %d [", (int)index);
print_ucs (&binsel); print_oocs (&binsel);
printf ("] with 1 arguments %s\n", (to_super? " to super": "")); printf ("] with 1 arguments %s\n", (to_super? " to super": ""));
stix->c->mth.binsels.len = saved_binsels_len; stix->c->mth.binsels.len = saved_binsels_len;
@ -3646,7 +3646,7 @@ static int compile_keyword_message (stix_t* stix, int to_super)
stix_size_t index; stix_size_t index;
int to_super2; int to_super2;
stix_ucs_t kw, kwsel; stix_oocs_t kw, kwsel;
stix_ioloc_t saved_kwsel_loc; stix_ioloc_t saved_kwsel_loc;
stix_size_t saved_kwsel_len; stix_size_t saved_kwsel_len;
stix_size_t kw_offset; stix_size_t kw_offset;
@ -3688,7 +3688,7 @@ static int compile_keyword_message (stix_t* stix, int to_super)
emit_double_param_instruction(stix, send_message_cmd[to_super], nargs, index) <= -1) goto oops; emit_double_param_instruction(stix, send_message_cmd[to_super], nargs, index) <= -1) goto oops;
printf ("\tsend keyword message %d [", (int)index); printf ("\tsend keyword message %d [", (int)index);
print_ucs (&kwsel); print_oocs (&kwsel);
printf ("] with %d arguments to %s\n", (int)nargs, (to_super? "super": "self")); printf ("] with %d arguments to %s\n", (int)nargs, (to_super? "super": "self"));
stix->c->mth.kwsels.len = saved_kwsel_len; stix->c->mth.kwsels.len = saved_kwsel_len;
return 0; return 0;
@ -3814,7 +3814,7 @@ done:
return 0; return 0;
} }
static int compile_basic_expression (stix_t* stix, const stix_ucs_t* ident, const stix_ioloc_t* ident_loc, int ident_dotted) static int compile_basic_expression (stix_t* stix, const stix_oocs_t* ident, const stix_ioloc_t* ident_loc, int ident_dotted)
{ {
/* /*
* basic-expression := expression-primary message-expression? * basic-expression := expression-primary message-expression?
@ -3840,7 +3840,7 @@ static int compile_method_expression (stix_t* stix, int pop)
* method-assignment-expression := identifier ":=" method-expression * method-assignment-expression := identifier ":=" method-expression
*/ */
stix_ucs_t assignee; stix_oocs_t assignee;
stix_size_t index; stix_size_t index;
int ret = 0; int ret = 0;
@ -3873,7 +3873,7 @@ static int compile_method_expression (stix_t* stix, int pop)
printf ("ASSIGNING TO ...."); printf ("ASSIGNING TO ....");
assignee.ptr = &stix->c->mth.assignees.ptr[assignee_offset]; assignee.ptr = &stix->c->mth.assignees.ptr[assignee_offset];
print_ucs (&assignee); print_oocs (&assignee);
printf ("\n"); printf ("\n");
if (compile_method_expression(stix, 0) <= -1) goto oops; if (compile_method_expression(stix, 0) <= -1) goto oops;
@ -4296,7 +4296,7 @@ static int compile_method_definition (stix_t* stix)
if (compile_method_name(stix) <= -1) return -1; if (compile_method_name(stix) <= -1) return -1;
printf (">>METHOD "); printf (">>METHOD ");
print_ucs (&stix->c->mth.name); print_oocs (&stix->c->mth.name);
printf ("\n"); printf ("\n");
if (stix->c->tok.type != STIX_IOTOK_LBRACE) if (stix->c->tok.type != STIX_IOTOK_LBRACE)
{ {
@ -4342,7 +4342,7 @@ static int make_defined_class (stix_t* stix)
#if 0 #if 0
printf ("MAKING ... "); printf ("MAKING ... ");
print_ucs (&stix->c->cls.name); print_oocs (&stix->c->cls.name);
printf (" instvars %d classvars %d classinstvars %d\n", (int)stix->c->cls.var_count[VAR_INSTANCE], (int)stix->c->cls.var_count[VAR_CLASS], (int)stix->c->cls.var_count[VAR_CLASSINST]); printf (" instvars %d classvars %d classinstvars %d\n", (int)stix->c->cls.var_count[VAR_INSTANCE], (int)stix->c->cls.var_count[VAR_CLASS], (int)stix->c->cls.var_count[VAR_CLASSINST]);
#endif #endif
if (stix->c->cls.self_oop) if (stix->c->cls.self_oop)
@ -4552,7 +4552,7 @@ static int __compile_class_definition (stix_t* stix, int extend)
int super_is_nil = 0; int super_is_nil = 0;
printf ("DEFININING CLASS "); printf ("DEFININING CLASS ");
print_ucs (&stix->c->cls.name); print_oocs (&stix->c->cls.name);
printf ("\n"); printf ("\n");
if (stix->c->tok.type == STIX_IOTOK_LPAREN) if (stix->c->tok.type == STIX_IOTOK_LPAREN)
{ {
@ -4827,7 +4827,7 @@ static int __compile_pooldic_definition (stix_t* stix)
} }
printf ("DEFININING POOL DICTIONARY "); printf ("DEFININING POOL DICTIONARY ");
print_ucs (&stix->c->cls.name); print_oocs (&stix->c->cls.name);
printf ("\n"); printf ("\n");
GET_TOKEN (stix); GET_TOKEN (stix);

View File

@ -76,7 +76,7 @@ void dump_dictionary (stix_t* stix, stix_oop_set_t dic, const char* title)
printf ("--------------------------------------------\n"); printf ("--------------------------------------------\n");
} }
void print_ucs (const stix_ucs_t* name) void print_oocs (const stix_oocs_t* name)
{ {
stix_size_t i; stix_size_t i;
for (i = 0; i < name->len; i++) printf ("%c", name->ptr[i]); for (i = 0; i < name->len; i++) printf ("%c", name->ptr[i]);
@ -118,7 +118,7 @@ void print_object (stix_t* stix, stix_oop_t oop)
else else
{ {
stix_oop_class_t c; stix_oop_class_t c;
stix_ucs_t s; stix_oocs_t s;
stix_size_t i; stix_size_t i;
stix_bch_t bcs[32]; stix_bch_t bcs[32];
stix_size_t ucslen, bcslen; stix_size_t ucslen, bcslen;
@ -177,7 +177,7 @@ void print_object (stix_t* stix, stix_oop_t oop)
s.ptr = ((stix_oop_char_t)c->name)->slot; s.ptr = ((stix_oop_char_t)c->name)->slot;
s.len = STIX_OBJ_GET_SIZE(c->name); s.len = STIX_OBJ_GET_SIZE(c->name);
printf ("instance of "); printf ("instance of ");
print_ucs (&s); print_oocs (&s);
printf ("- (%p)", oop); printf ("- (%p)", oop);
} }
} }
@ -186,7 +186,7 @@ void print_object (stix_t* stix, stix_oop_t oop)
static void __dump_object (stix_t* stix, stix_oop_t oop, int depth) static void __dump_object (stix_t* stix, stix_oop_t oop, int depth)
{ {
stix_oop_class_t c; stix_oop_class_t c;
stix_ucs_t s; stix_oocs_t s;
int i; int i;
for (i = 0; i < depth; i++) printf ("\t"); for (i = 0; i < depth; i++) printf ("\t");
@ -195,7 +195,7 @@ static void __dump_object (stix_t* stix, stix_oop_t oop, int depth)
c = (stix_oop_class_t)STIX_CLASSOF(stix, oop); c = (stix_oop_class_t)STIX_CLASSOF(stix, oop);
s.ptr = ((stix_oop_char_t)c->name)->slot; s.ptr = ((stix_oop_char_t)c->name)->slot;
s.len = STIX_OBJ_GET_SIZE(c->name); s.len = STIX_OBJ_GET_SIZE(c->name);
print_ucs (&s); print_oocs (&s);
if (oop == stix->_nil) if (oop == stix->_nil)
{ {

View File

@ -52,7 +52,7 @@ static stix_oop_oop_t expand_bucket (stix_t* stix, stix_oop_oop_t oldbuc)
key = (stix_oop_char_t)ass->key; key = (stix_oop_char_t)ass->key;
STIX_ASSERT (STIX_CLASSOF(stix,key) == (stix_oop_t)stix->_symbol); STIX_ASSERT (STIX_CLASSOF(stix,key) == (stix_oop_t)stix->_symbol);
index = stix_hashuchars(key->slot, STIX_OBJ_GET_SIZE(key)) % newsz; index = stix_hashchars(key->slot, STIX_OBJ_GET_SIZE(key)) % newsz;
while (newbuc->slot[index] != stix->_nil) index = (index + 1) % newsz; while (newbuc->slot[index] != stix->_nil) index = (index + 1) % newsz;
newbuc->slot[index] = (stix_oop_t)ass; newbuc->slot[index] = (stix_oop_t)ass;
} }
@ -73,7 +73,7 @@ static stix_oop_association_t find_or_upsert (stix_t* stix, stix_oop_set_t dic,
STIX_ASSERT (STIX_CLASSOF(stix,dic->tally) == stix->_small_integer); STIX_ASSERT (STIX_CLASSOF(stix,dic->tally) == stix->_small_integer);
STIX_ASSERT (STIX_CLASSOF(stix,dic->bucket) == stix->_array); STIX_ASSERT (STIX_CLASSOF(stix,dic->bucket) == stix->_array);
index = stix_hashuchars(key->slot, STIX_OBJ_GET_SIZE(key)) % STIX_OBJ_GET_SIZE(dic->bucket); index = stix_hashchars(key->slot, STIX_OBJ_GET_SIZE(key)) % STIX_OBJ_GET_SIZE(dic->bucket);
while (dic->bucket->slot[index] != stix->_nil) while (dic->bucket->slot[index] != stix->_nil)
{ {
@ -124,7 +124,7 @@ static stix_oop_association_t find_or_upsert (stix_t* stix, stix_oop_set_t dic,
dic->bucket = bucket; dic->bucket = bucket;
/* recalculate the index for the expanded bucket */ /* recalculate the index for the expanded bucket */
index = stix_hashuchars(key->slot, STIX_OBJ_GET_SIZE(key)) % STIX_OBJ_GET_SIZE(dic->bucket); index = stix_hashchars(key->slot, STIX_OBJ_GET_SIZE(key)) % STIX_OBJ_GET_SIZE(dic->bucket);
while (dic->bucket->slot[index] != stix->_nil) while (dic->bucket->slot[index] != stix->_nil)
index = (index + 1) % STIX_OBJ_GET_SIZE(dic->bucket); index = (index + 1) % STIX_OBJ_GET_SIZE(dic->bucket);
@ -150,7 +150,7 @@ oops:
return STIX_NULL; return STIX_NULL;
} }
static stix_oop_association_t lookup (stix_t* stix, stix_oop_set_t dic, const stix_ucs_t* name) static stix_oop_association_t lookup (stix_t* stix, stix_oop_set_t dic, const stix_oocs_t* name)
{ {
/* this is special version of stix_getatsysdic() that performs /* this is special version of stix_getatsysdic() that performs
* lookup using a plain string specified */ * lookup using a plain string specified */
@ -161,7 +161,7 @@ static stix_oop_association_t lookup (stix_t* stix, stix_oop_set_t dic, const st
STIX_ASSERT (STIX_CLASSOF(stix,dic->tally) == stix->_small_integer); STIX_ASSERT (STIX_CLASSOF(stix,dic->tally) == stix->_small_integer);
STIX_ASSERT (STIX_CLASSOF(stix,dic->bucket) == stix->_array); STIX_ASSERT (STIX_CLASSOF(stix,dic->bucket) == stix->_array);
index = stix_hashuchars(name->ptr, name->len) % STIX_OBJ_GET_SIZE(dic->bucket); index = stix_hashchars(name->ptr, name->len) % STIX_OBJ_GET_SIZE(dic->bucket);
while (dic->bucket->slot[index] != stix->_nil) while (dic->bucket->slot[index] != stix->_nil)
{ {
@ -196,7 +196,7 @@ stix_oop_association_t stix_getatsysdic (stix_t* stix, stix_oop_t key)
return find_or_upsert (stix, stix->sysdic, (stix_oop_char_t)key, STIX_NULL); return find_or_upsert (stix, stix->sysdic, (stix_oop_char_t)key, STIX_NULL);
} }
stix_oop_association_t stix_lookupsysdic (stix_t* stix, const stix_ucs_t* name) stix_oop_association_t stix_lookupsysdic (stix_t* stix, const stix_oocs_t* name)
{ {
return lookup (stix, stix->sysdic, name); return lookup (stix, stix->sysdic, name);
} }
@ -213,7 +213,7 @@ stix_oop_association_t stix_getatdic (stix_t* stix, stix_oop_set_t dic, stix_oop
return find_or_upsert (stix, dic, (stix_oop_char_t)key, STIX_NULL); return find_or_upsert (stix, dic, (stix_oop_char_t)key, STIX_NULL);
} }
stix_oop_association_t stix_lookupdic (stix_t* stix, stix_oop_set_t dic, const stix_ucs_t* name) stix_oop_association_t stix_lookupdic (stix_t* stix, stix_oop_set_t dic, const stix_oocs_t* name)
{ {
return lookup (stix, dic, name); return lookup (stix, dic, name);
} }

View File

@ -350,7 +350,7 @@ printf ("\n");
#endif #endif
} }
static stix_oop_method_t find_method (stix_t* stix, stix_oop_t receiver, const stix_ucs_t* message, int super) static stix_oop_method_t find_method (stix_t* stix, stix_oop_t receiver, const stix_oocs_t* message, int super)
{ {
stix_oop_class_t cls; stix_oop_class_t cls;
stix_oop_association_t ass; stix_oop_association_t ass;
@ -361,7 +361,7 @@ static stix_oop_method_t find_method (stix_t* stix, stix_oop_t receiver, const s
#if defined(STIX_DEBUG_EXEC) #if defined(STIX_DEBUG_EXEC)
printf ("==== FINDING METHOD FOR %p [", receiver); printf ("==== FINDING METHOD FOR %p [", receiver);
print_ucs (message); print_oocs (message);
printf ("] in "); printf ("] in ");
#endif #endif
@ -420,7 +420,7 @@ not_found:
return STIX_NULL; return STIX_NULL;
} }
static int activate_initial_context (stix_t* stix, const stix_ucs_t* objname, const stix_ucs_t* mthname) static int activate_initial_context (stix_t* stix, const stix_oocs_t* objname, const stix_oocs_t* mthname)
{ {
/* the initial context is a fake context. if objname is 'Stix' and /* the initial context is a fake context. if objname is 'Stix' and
* mthname is 'main', this function emulates message sending 'Stix main'. * mthname is 'main', this function emulates message sending 'Stix main'.
@ -1561,7 +1561,7 @@ static prim_t primitives[] =
}; };
int stix_getprimno (stix_t* stix, const stix_ucs_t* name) int stix_getprimno (stix_t* stix, const stix_oocs_t* name)
{ {
int i; int i;
@ -1577,16 +1577,16 @@ int stix_getprimno (stix_t* stix, const stix_ucs_t* name)
return -1; return -1;
} }
static stix_prim_impl_t query_prim_module (stix_t* stix, const stix_uch_t* name, stix_oow_t len) static stix_prim_impl_t query_prim_module (stix_t* stix, const stix_ooch_t* name, stix_oow_t len)
{ {
stix_rbt_pair_t* pair; stix_rbt_pair_t* pair;
stix_prim_mod_data_t* mdp; stix_prim_mod_data_t* mdp;
const stix_uch_t* sep; const stix_ooch_t* sep;
stix_oow_t mod_name_len; stix_oow_t mod_name_len;
stix_prim_impl_t handler; stix_prim_impl_t handler;
int n; int n;
sep = stix_findchar (name, len, '_'); sep = stix_findoochar (name, len, '_');
STIX_ASSERT (sep != STIX_NULL); STIX_ASSERT (sep != STIX_NULL);
mod_name_len = sep - name; mod_name_len = sep - name;
@ -1606,10 +1606,10 @@ static stix_prim_impl_t query_prim_module (stix_t* stix, const stix_uch_t* name,
* 1 for _ at the end when stix_prim_mod_xxx_ is attempted. * 1 for _ at the end when stix_prim_mod_xxx_ is attempted.
* 1 for the terminating '\0'. * 1 for the terminating '\0'.
*/ */
stix_uch_t buf[STIX_MOD_NAME_LEN_MAX + 16]; stix_ooch_t buf[STIX_MOD_NAME_LEN_MAX + 16];
/* the terminating null isn't needed in buf here */ /* the terminating null isn't needed in buf here */
stix_copybchtouchars (buf, "stix_prim_mod_", 14); stix_copybchtooochars (buf, "stix_prim_mod_", 14);
if (mod_name_len > STIX_COUNTOF(buf) - 16) if (mod_name_len > STIX_COUNTOF(buf) - 16)
{ {
@ -1618,7 +1618,7 @@ static stix_prim_impl_t query_prim_module (stix_t* stix, const stix_uch_t* name,
return STIX_NULL; return STIX_NULL;
} }
stix_copyuchars (&buf[14], name, mod_name_len); stix_copyoochars (&buf[14], name, mod_name_len);
buf[14 + mod_name_len] = '\0'; buf[14 + mod_name_len] = '\0';
#if defined(STIX_ENABLE_STATIC_MODULE) #if defined(STIX_ENABLE_STATIC_MODULE)
@ -1629,7 +1629,7 @@ static stix_prim_impl_t query_prim_module (stix_t* stix, const stix_uch_t* name,
/* TODO: binary search ... */ /* TODO: binary search ... */
for (n = 0; n < STIX_COUNTOF(static_modtab); n++) for (n = 0; n < STIX_COUNTOF(static_modtab); n++)
{ {
if (stix_compucstr (static_modtab[n].modname, name) == 0) if (stix_compoocstr (static_modtab[n].modname, name) == 0)
{ {
load = static_modtab[n].modload; load = static_modtab[n].modload;
break; break;
@ -2209,7 +2209,7 @@ printf ("\n");
/* b1 -> number of arguments /* b1 -> number of arguments
* b2 -> index to the selector stored in the literal frame * b2 -> index to the selector stored in the literal frame
*/ */
stix_ucs_t mthname; stix_oocs_t mthname;
stix_oop_t newrcv; stix_oop_t newrcv;
stix_oop_method_t newmth; stix_oop_method_t newmth;
stix_oop_char_t selector; stix_oop_char_t selector;
@ -2244,7 +2244,7 @@ printf ("\n");
{ {
/* TODO: implement doesNotUnderstand: XXXXX instead of returning -1. */ /* TODO: implement doesNotUnderstand: XXXXX instead of returning -1. */
printf ("no such method .........["); printf ("no such method .........[");
print_ucs (&mthname); print_oocs (&mthname);
printf ("]\n"); printf ("]\n");
goto oops; goto oops;
} }
@ -2744,7 +2744,7 @@ oops:
return -1; return -1;
} }
int stix_invoke (stix_t* stix, const stix_ucs_t* objname, const stix_ucs_t* mthname) int stix_invoke (stix_t* stix, const stix_oocs_t* objname, const stix_oocs_t* mthname)
{ {
if (activate_initial_context (stix, objname, mthname) <= -1) return -1; if (activate_initial_context (stix, objname, mthname) <= -1) return -1;
return stix_execute (stix); return stix_execute (stix);

View File

@ -64,7 +64,7 @@ static void compact_symbol_table (stix_t* stix, stix_oop_t _nil)
STIX_ASSERT (STIX_CLASSOF(stix,symbol) == stix->_symbol); STIX_ASSERT (STIX_CLASSOF(stix,symbol) == stix->_symbol);
z = stix_hashuchars(symbol->slot, STIX_OBJ_GET_SIZE(symbol)) % bucket_size; z = stix_hashchars(symbol->slot, STIX_OBJ_GET_SIZE(symbol)) % bucket_size;
/* move an element if necessary */ /* move an element if necessary */
if ((y > x && (z <= x || z > y)) || if ((y > x && (z <= x || z > y)) ||
@ -290,6 +290,7 @@ void stix_gc (stix_t* stix)
stix->_false_class = stix_moveoop (stix, stix->_false_class); stix->_false_class = stix_moveoop (stix, stix->_false_class);
stix->_character = stix_moveoop (stix, stix->_character); stix->_character = stix_moveoop (stix, stix->_character);
stix->_small_integer = stix_moveoop (stix, stix->_small_integer); stix->_small_integer = stix_moveoop (stix, stix->_small_integer);
stix->_large_integer = stix_moveoop (stix, stix->_large_integer);
stix->sysdic = (stix_oop_set_t) stix_moveoop (stix, (stix_oop_t)stix->sysdic); stix->sysdic = (stix_oop_set_t) stix_moveoop (stix, (stix_oop_t)stix->sysdic);
stix->processor = (stix_oop_process_scheduler_t) stix_moveoop (stix, (stix_oop_t)stix->processor); stix->processor = (stix_oop_process_scheduler_t) stix_moveoop (stix, (stix_oop_t)stix->processor);

View File

@ -143,6 +143,7 @@ static int ignite_1 (stix_t* stix)
* Does this make sense? */ * Does this make sense? */
stix->_character = alloc_kernel_class (stix, 0, STIX_CLASS_SPEC_MAKE(0, 0, STIX_OBJ_TYPE_OOP)); stix->_character = alloc_kernel_class (stix, 0, STIX_CLASS_SPEC_MAKE(0, 0, STIX_OBJ_TYPE_OOP));
stix->_small_integer = alloc_kernel_class (stix, 0, STIX_CLASS_SPEC_MAKE(0, 0, STIX_OBJ_TYPE_OOP)); stix->_small_integer = alloc_kernel_class (stix, 0, STIX_CLASS_SPEC_MAKE(0, 0, STIX_OBJ_TYPE_OOP));
stix->_large_integer = alloc_kernel_class (stix, 0, STIX_CLASS_SPEC_MAKE(0, 1, STIX_OBJ_TYPE_OOP));
if (!stix->_apex || !stix->_undefined_object || if (!stix->_apex || !stix->_undefined_object ||
!stix->_object || !stix->_string || !stix->_object || !stix->_string ||
@ -157,7 +158,7 @@ static int ignite_1 (stix_t* stix)
!stix->_process || !stix->_process_scheduler || !stix->_process || !stix->_process_scheduler ||
!stix->_true_class || !stix->_false_class || !stix->_true_class || !stix->_false_class ||
!stix->_character || !stix->_small_integer) return -1; !stix->_character || !stix->_small_integer || !stix->_large_integer) return -1;
STIX_OBJ_SET_CLASS (stix->_nil, stix->_undefined_object); STIX_OBJ_SET_CLASS (stix->_nil, stix->_undefined_object);
return 0; return 0;
@ -212,7 +213,7 @@ static int ignite_3 (stix_t* stix)
static struct symbol_name_t static struct symbol_name_t
{ {
stix_oow_t len; stix_oow_t len;
stix_uch_t str[16]; stix_ooch_t str[16];
} symnames[] = { } symnames[] = {
{ 4, { 'A','p','e','x' } }, { 4, { 'A','p','e','x' } },
{ 15, { 'U','n','d','e','f','i','n','e','d','O','b','j','e','c','t' } }, { 15, { 'U','n','d','e','f','i','n','e','d','O','b','j','e','c','t' } },
@ -239,11 +240,12 @@ static int ignite_3 (stix_t* stix)
{ 4, { 'T','r','u','e' } }, { 4, { 'T','r','u','e' } },
{ 5, { 'F','a','l','s','e' } }, { 5, { 'F','a','l','s','e' } },
{ 9, { 'C','h','a','r','a','c','t','e','r' } }, { 9, { 'C','h','a','r','a','c','t','e','r' } },
{ 12, { 'S','m','a','l','l','I','n','t','e','g','e','r' } } { 12, { 'S','m','a','l','l','I','n','t','e','g','e','r' } },
{ 12, { 'L','a','r','g','e','I','n','t','e','g','e','r' } }
}; };
static stix_uch_t str_stix[] = { 'S','t','i','x' }; static stix_ooch_t str_stix[] = { 'S','t','i','x' };
static stix_uch_t str_processor[] = { 'P', 'r', 'o', 'c', 'e', 's', 's', 'o', 'r' }; static stix_ooch_t str_processor[] = { 'P', 'r', 'o', 'c', 'e', 's', 's', 'o', 'r' };
stix_oow_t i; stix_oow_t i;
stix_oop_t sym; stix_oop_t sym;

View File

@ -213,7 +213,7 @@ static stix_ssize_t input_handler (stix_t* stix, stix_io_cmd_t cmd, stix_io_arg_
} }
} }
static void* mod_open (stix_t* stix, const stix_uch_t* name) static void* mod_open (stix_t* stix, const stix_ooch_t* name)
{ {
#if defined(USE_LTDL) #if defined(USE_LTDL)
/* TODO: support various platforms */ /* TODO: support various platforms */
@ -274,7 +274,7 @@ static void mod_close (stix_t* stix, void* handle)
#endif #endif
} }
static void* mod_getsym (stix_t* stix, void* handle, const stix_uch_t* name) static void* mod_getsym (stix_t* stix, void* handle, const stix_ooch_t* name)
{ {
#if defined(USE_LTDL) #if defined(USE_LTDL)
stix_bch_t buf[1024]; /* TODO: use a proper buffer. dynamically allocated if conversion result in too a large value */ stix_bch_t buf[1024]; /* TODO: use a proper buffer. dynamically allocated if conversion result in too a large value */
@ -369,16 +369,16 @@ static char* syntax_error_msg[] =
"literal expected" "literal expected"
}; };
stix_uch_t str_stix[] = { 'S', 't', 'i', 'x' }; stix_ooch_t str_stix[] = { 'S', 't', 'i', 'x' };
stix_uch_t str_my_object[] = { 'M', 'y', 'O', 'b','j','e','c','t' }; stix_ooch_t str_my_object[] = { 'M', 'y', 'O', 'b','j','e','c','t' };
stix_uch_t str_main[] = { 'm', 'a', 'i', 'n' }; stix_ooch_t str_main[] = { 'm', 'a', 'i', 'n' };
int main (int argc, char* argv[]) int main (int argc, char* argv[])
{ {
stix_t* stix; stix_t* stix;
xtn_t* xtn; xtn_t* xtn;
stix_ucs_t objname; stix_oocs_t objname;
stix_ucs_t mthname; stix_oocs_t mthname;
stix_vmprim_t vmprim; stix_vmprim_t vmprim;
int i; int i;
@ -457,8 +457,8 @@ int main (int argc, char* argv[])
} }
{ {
stix_uch_t x[] = { 'X', 't', 'r', 'i', 'n', 'g', '\0' }; stix_ooch_t x[] = { 'X', 't', 'r', 'i', 'n', 'g', '\0' };
stix_uch_t y[] = { 'S', 'y', 'm', 'b', 'o', 'l', '\0' }; stix_ooch_t y[] = { 'S', 'y', 'm', 'b', 'o', 'l', '\0' };
stix_oop_t a, b, k; stix_oop_t a, b, k;
a = stix_makesymbol (stix, x, 6); a = stix_makesymbol (stix, x, 6);

View File

@ -150,16 +150,16 @@ static stix_oop_t alloc_numeric_array (stix_t* stix, const void* ptr, stix_oow_t
return hdr; return hdr;
} }
stix_oop_t stix_alloccharobj (stix_t* stix, const stix_uch_t* ptr, stix_oow_t len) stix_oop_t stix_alloccharobj (stix_t* stix, const stix_ooch_t* ptr, stix_oow_t len)
{ {
return alloc_numeric_array (stix, ptr, len, STIX_OBJ_TYPE_CHAR, STIX_SIZEOF(stix_uch_t), 1); return alloc_numeric_array (stix, ptr, len, STIX_OBJ_TYPE_CHAR, STIX_SIZEOF(stix_ooch_t), 1);
} }
/* /*
TODO: extra bits must be set ... TODO: extra bits must be set ...
stix_oop_t stix_allocmbcharobj (stix_t* stix, const stix_uch_t* ptr, stix_oow_t len) stix_oop_t stix_allocmbcharobj (stix_t* stix, const stix_ooch_t* ptr, stix_oow_t len)
{ {
return alloc_numeric_array (stix, ptr, len, STIX_OBJ_TYPE_MBCHAR, STIX_SIZEOF(stix_uch_t), 1); return alloc_numeric_array (stix, ptr, len, STIX_OBJ_TYPE_MBCHAR, STIX_SIZEOF(stix_ooch_t), 1);
} }
*/ */

View File

@ -33,42 +33,204 @@
#if defined(STIX_HAVE_CFG_H) #if defined(STIX_HAVE_CFG_H)
# include "stix-cfg.h" # include "stix-cfg.h"
#else
# error UNSUPPORTED SYSTEM
#endif
#if defined(EMSCRIPTEN)
# if defined(STIX_SIZEOF___INT128)
# undef STIX_SIZEOF___INT128
# define STIX_SIZEOF___INT128 0
# endif
# if defined(STIX_SIZEOF_LONG) && defined(STIX_SIZEOF_INT) && (STIX_SIZEOF_LONG > STIX_SIZEOF_INT)
/* autoconf doesn't seem to match actual emscripten */
# undef STIX_SIZEOF_LONG
# define STIX_SIZEOF_LONG STIX_SIZEOF_INT
# endif
#endif #endif
/* ========================================================================= /* =========================================================================
* PRIMITIVE TYPE DEFINTIONS * PRIMITIVE TYPE DEFINTIONS
* ========================================================================= */ * ========================================================================= */
/* TODO: define these types and macros using autoconf */ #if defined(STIX_SIZEOF_CHAR) && (STIX_SIZEOF_CHAR == 1)
typedef unsigned char stix_uint8_t; # define STIX_HAVE_UINT8_T
typedef signed char stix_int8_t; # define STIX_HAVE_INT8_T
typedef unsigned char stix_uint8_t;
typedef unsigned short int stix_uint16_t; typedef signed char stix_int8_t;
typedef signed short int stix_int16_t; #elif defined(STIX_SIZEOF___INT8) && (STIX_SIZEOF___INT8 == 1)
# define STIX_HAVE_UINT8_T
#if defined(__MSDOS__) # define STIX_HAVE_INT8_T
typedef unsigned long int stix_uint32_t; typedef unsigned __int8 stix_uint8_t;
typedef signed long int stix_int32_t; typedef signed __int8 stix_int8_t;
#elif defined(STIX_SIZEOF___INT8_T) && (STIX_SIZEOF___INT8_T == 1)
# define STIX_HAVE_UINT8_T
# define STIX_HAVE_INT8_T
typedef unsigned __int8_t stix_uint8_t;
typedef signed __int8_t stix_int8_t;
#else #else
typedef unsigned int stix_uint32_t; # define STIX_HAVE_UINT8_T
typedef signed int stix_int32_t; # define STIX_HAVE_INT8_T
typedef unsigned char stix_uint8_t;
typedef signed char stix_int8_t;
#endif #endif
#if defined(_WIN64) #if defined(STIX_SIZEOF_SHORT) && (STIX_SIZEOF_SHORT == 2)
typedef unsigned __int64 stix_uintptr_t; # define STIX_HAVE_UINT16_T
typedef signed __int64 stix_intptr_t; # define STIX_HAVE_INT16_T
typedef unsigned __int64 stix_size_t; typedef unsigned short int stix_uint16_t;
typedef signed __int64 stix_ssize_t; typedef signed short int stix_int16_t;
#elif defined(STIX_SIZEOF___INT16) && (STIX_SIZEOF___INT16 == 2)
# define STIX_HAVE_UINT16_T
# define STIX_HAVE_INT16_T
typedef unsigned __int16 stix_uint16_t;
typedef signed __int16 stix_int16_t;
#elif defined(STIX_SIZEOF___INT16_T) && (STIX_SIZEOF___INT16_T == 2)
# define STIX_HAVE_UINT16_T
# define STIX_HAVE_INT16_T
typedef unsigned __int16_t stix_uint16_t;
typedef signed __int16_t stix_int16_t;
#else #else
typedef unsigned long int stix_uintptr_t; # define STIX_HAVE_UINT16_T
typedef signed long int stix_intptr_t; # define STIX_HAVE_INT16_T
typedef unsigned long int stix_size_t; typedef unsigned short int stix_uint16_t;
typedef signed long int stix_ssize_t; typedef signed short int stix_int16_t;
#endif #endif
#if defined(STIX_SIZEOF_INT) && (STIX_SIZEOF_INT == 4)
# define STIX_HAVE_UINT32_T
# define STIX_HAVE_INT32_T
typedef unsigned int stix_uint32_t;
typedef signed int stix_int32_t;
#elif defined(STIX_SIZEOF_LONG) && (STIX_SIZEOF_LONG == 4)
# define STIX_HAVE_UINT32_T
# define STIX_HAVE_INT32_T
typedef unsigned long stix_uint32_t;
typedef signed long stix_int32_t;
#elif defined(STIX_SIZEOF___INT32) && (STIX_SIZEOF___INT32 == 4)
# define STIX_HAVE_UINT32_T
# define STIX_HAVE_INT32_T
typedef unsigned __int32 stix_uint32_t;
typedef signed __int32 stix_int32_t;
#elif defined(STIX_SIZEOF___INT32_T) && (STIX_SIZEOF___INT32_T == 4)
# define STIX_HAVE_UINT32_T
# define STIX_HAVE_INT32_T
typedef unsigned __int32_t stix_uint32_t;
typedef signed __int32_t stix_int32_t;
#elif defined(__MSDOS__)
# define STIX_HAVE_UINT32_T
# define STIX_HAVE_INT32_T
typedef unsigned long int stix_uint32_t;
typedef signed long int stix_int32_t;
#else
# define STIX_HAVE_UINT32_T
# define STIX_HAVE_INT32_T
typedef unsigned int stix_uint32_t;
typedef signed int stix_int32_t;
#endif
#if defined(STIX_SIZEOF_INT) && (STIX_SIZEOF_INT == 8)
# define STIX_HAVE_UINT64_T
# define STIX_HAVE_INT64_T
typedef unsigned int stix_uint64_t;
typedef signed int stix_int64_t;
#elif defined(STIX_SIZEOF_LONG) && (STIX_SIZEOF_LONG == 8)
# define STIX_HAVE_UINT64_T
# define STIX_HAVE_INT64_T
typedef unsigned long stix_uint64_t;
typedef signed long stix_int64_t;
#elif defined(STIX_SIZEOF_LONG_LONG) && (STIX_SIZEOF_LONG_LONG == 8)
# define STIX_HAVE_UINT64_T
# define STIX_HAVE_INT64_T
typedef unsigned long long stix_uint64_t;
typedef signed long long stix_int64_t;
#elif defined(STIX_SIZEOF___INT64) && (STIX_SIZEOF___INT64 == 8)
# define STIX_HAVE_UINT64_T
# define STIX_HAVE_INT64_T
typedef unsigned __int64 stix_uint64_t;
typedef signed __int64 stix_int64_t;
#elif defined(STIX_SIZEOF___INT64_T) && (STIX_SIZEOF___INT64_T == 8)
# define STIX_HAVE_UINT64_T
# define STIX_HAVE_INT64_T
typedef unsigned __int64_t stix_uint64_t;
typedef signed __int64_t stix_int64_t;
#elif defined(_WIN64) || defined(_WIN32)
# define STIX_HAVE_UINT64_T
# define STIX_HAVE_INT64_T
typedef unsigned __int64 stix_uint64_t;
typedef signed __int64 stix_int64_t;
#else
/* no 64-bit integer */
#endif
#if defined(STIX_SIZEOF_INT) && (STIX_SIZEOF_INT == 16)
# define STIX_HAVE_UINT128_T
# define STIX_HAVE_INT128_T
typedef unsigned int stix_uint128_t;
typedef signed int stix_int128_t;
#elif defined(STIX_SIZEOF_LONG) && (STIX_SIZEOF_LONG == 16)
# define STIX_HAVE_UINT128_T
# define STIX_HAVE_INT128_T
typedef unsigned long stix_uint128_t;
typedef signed long stix_int128_t;
#elif defined(STIX_SIZEOF_LONG_LONG) && (STIX_SIZEOF_LONG_LONG == 16)
# define STIX_HAVE_UINT128_T
# define STIX_HAVE_INT128_T
typedef unsigned long long stix_uint128_t;
typedef signed long long stix_int128_t;
#elif defined(STIX_SIZEOF___INT128) && (STIX_SIZEOF___INT128 == 16)
# define STIX_HAVE_UINT128_T
# define STIX_HAVE_INT128_T
typedef unsigned __int128 stix_uint128_t;
typedef signed __int128 stix_int128_t;
#elif defined(STIX_SIZEOF___INT128_T) && (STIX_SIZEOF___INT128_T == 16)
# define STIX_HAVE_UINT128_T
# define STIX_HAVE_INT128_T
typedef unsigned __int128_t stix_uint128_t;
typedef signed __int128_t stix_int128_t;
#else
/* no 128-bit integer */
#endif
#if defined(STIX_HAVE_UINT8_T) && (STIX_SIZEOF_VOID_P == 1)
# error UNSUPPORTED POINTER SIZE
#elif defined(STIX_HAVE_UINT16_T) && (STIX_SIZEOF_VOID_P == 2)
typedef stix_uint16_t stix_uintptr_t;
typedef stix_int16_t stix_intptr_t;
typedef stix_uint8_t stix_ushortptr_t;
typedef stix_int8_t stix_shortptr_t;
#elif defined(STIX_HAVE_UINT32_T) && (STIX_SIZEOF_VOID_P == 4)
typedef stix_uint32_t stix_uintptr_t;
typedef stix_int32_t stix_intptr_t;
typedef stix_uint16_t stix_ushortptr_t;
typedef stix_int16_t stix_shortptr_t;
#elif defined(STIX_HAVE_UINT64_T) && (STIX_SIZEOF_VOID_P == 8)
typedef stix_uint64_t stix_uintptr_t;
typedef stix_int64_t stix_intptr_t;
typedef stix_uint32_t stix_ushortptr_t;
typedef stix_int32_t stix_shortptr_t;
#elif defined(STIX_HAVE_UINT128_T) && (STIX_SIZEOF_VOID_P == 16)
typedef stix_uint128_t stix_uintptr_t;
typedef stix_int128_t stix_intptr_t;
typedef stix_uint64_t stix_ushortptr_t;
typedef stix_int64_t stix_shortptr_t;
#else
# error UNSUPPORTED POINTER SIZE
#endif
#define STIX_SIZEOF_INTPTR_T STIX_SIZEOF_VOID_P
#define STIX_SIZEOF_UINTPTR_T STIX_SIZEOF_VOID_P
#define STIX_SIZEOF_SHORTPTR_T (STIX_SIZEOF_VOID_P / 2)
#define STIX_SIZEOF_USHORTPTR_T (STIX_SIZEOF_VOID_P / 2)
typedef stix_uintptr_t stix_size_t;
typedef stix_intptr_t stix_ssize_t;
typedef stix_uint8_t stix_byte_t; typedef stix_uint8_t stix_byte_t;
typedef char stix_bch_t;
typedef stix_uint16_t stix_uch_t; /* TODO ... wchar_t??? */ typedef stix_uint16_t stix_uch_t; /* TODO ... wchar_t??? */
typedef stix_int32_t stix_uci_t; typedef stix_int32_t stix_uci_t;
typedef char stix_bch_t;
struct stix_ucs_t struct stix_ucs_t
{ {
@ -78,12 +240,11 @@ struct stix_ucs_t
typedef struct stix_ucs_t stix_ucs_t; typedef struct stix_ucs_t stix_ucs_t;
/* ========================================================================= /* =========================================================================
* PRIMITIVE MACROS * PRIMITIVE MACROS
* ========================================================================= */ * ========================================================================= */
#define STIX_UCI_EOF ((stix_uci_t)-1) #define STIX_UCI_EOF ((stix_ooci_t)-1)
#define STIX_UCI_NL ((stix_uci_t)'\n') #define STIX_UCI_NL ((stix_ooci_t)'\n')
#define STIX_SIZEOF(x) (sizeof(x)) #define STIX_SIZEOF(x) (sizeof(x))
#define STIX_COUNTOF(x) (sizeof(x) / sizeof(x[0])) #define STIX_COUNTOF(x) (sizeof(x) / sizeof(x[0]))

View File

@ -175,13 +175,13 @@ struct stix_ioloc_t
{ {
unsigned long line; /**< line */ unsigned long line; /**< line */
unsigned long colm; /**< column */ unsigned long colm; /**< column */
const stix_uch_t* file; /**< file specified in #include */ const stix_ooch_t* file; /**< file specified in #include */
}; };
typedef struct stix_ioloc_t stix_ioloc_t; typedef struct stix_ioloc_t stix_ioloc_t;
struct stix_iolxc_t struct stix_iolxc_t
{ {
stix_uci_t c; /**< character */ stix_ooci_t c; /**< character */
stix_ioloc_t l; /**< location */ stix_ioloc_t l; /**< location */
}; };
typedef struct stix_iolxc_t stix_iolxc_t; typedef struct stix_iolxc_t stix_iolxc_t;
@ -201,7 +201,7 @@ struct stix_io_arg_t
* It is #STIX_NULL for the main stream and points to a non-NULL string * It is #STIX_NULL for the main stream and points to a non-NULL string
* for an included stream. * for an included stream.
*/ */
const stix_uch_t* name; const stix_ooch_t* name;
/** /**
* [OUT] I/O handle set by a handler. * [OUT] I/O handle set by a handler.
@ -214,7 +214,7 @@ struct stix_io_arg_t
/** /**
* [OUT] place data here * [OUT] place data here
*/ */
stix_uch_t buf[1024]; stix_ooch_t buf[1024];
/** /**
* [IN] points to the data of the includer. It is #STIX_NULL for the * [IN] points to the data of the includer. It is #STIX_NULL for the
@ -278,7 +278,7 @@ struct stix_iotok_t
STIX_IOTOK_SEMICOLON STIX_IOTOK_SEMICOLON
} type; } type;
stix_ucs_t name; stix_oocs_t name;
stix_size_t name_capa; stix_size_t name_capa;
stix_ioloc_t loc; stix_ioloc_t loc;
@ -352,7 +352,7 @@ struct stix_synerr_t
{ {
stix_synerrnum_t num; stix_synerrnum_t num;
stix_ioloc_t loc; stix_ioloc_t loc;
stix_ucs_t tgt; stix_oocs_t tgt;
}; };
typedef struct stix_synerr_t stix_synerr_t; typedef struct stix_synerr_t stix_synerr_t;
@ -394,8 +394,8 @@ struct stix_compiler_t
stix_synerr_t synerr; stix_synerr_t synerr;
/* temporary space to handle an illegal character */ /* temporary space to handle an illegal character */
stix_uch_t ilchr; stix_ooch_t ilchr;
stix_ucs_t ilchr_ucs; stix_oocs_t ilchr_ucs;
/* information about a class being compiled */ /* information about a class being compiled */
struct struct
@ -408,19 +408,19 @@ struct stix_compiler_t
stix_oop_set_t mthdic_oop[2]; stix_oop_set_t mthdic_oop[2];
stix_oop_set_t ns_oop; stix_oop_set_t ns_oop;
stix_ucs_t fqn; stix_oocs_t fqn;
stix_ucs_t name; stix_oocs_t name;
stix_size_t fqn_capa; stix_size_t fqn_capa;
stix_ioloc_t fqn_loc; stix_ioloc_t fqn_loc;
stix_oop_set_t superns_oop; stix_oop_set_t superns_oop;
stix_ucs_t superfqn; stix_oocs_t superfqn;
stix_ucs_t supername; stix_oocs_t supername;
stix_size_t superfqn_capa; stix_size_t superfqn_capa;
stix_ioloc_t superfqn_loc; stix_ioloc_t superfqn_loc;
/* instance variable, class variable, class instance variable */ /* instance variable, class variable, class instance variable */
stix_ucs_t vars[3]; stix_oocs_t vars[3];
stix_size_t vars_capa[3]; stix_size_t vars_capa[3];
/* var_count, unlike vars above, includes superclass counts as well. /* var_count, unlike vars above, includes superclass counts as well.
@ -429,7 +429,7 @@ struct stix_compiler_t
* var_count[2] - number of class instance variables */ * var_count[2] - number of class instance variables */
stix_size_t var_count[3]; stix_size_t var_count[3];
stix_ucs_t pooldic; stix_oocs_t pooldic;
stix_size_t pooldic_capa; stix_size_t pooldic_capa;
stix_size_t pooldic_count; stix_size_t pooldic_count;
@ -443,28 +443,28 @@ struct stix_compiler_t
int type; int type;
/* method source text */ /* method source text */
stix_ucs_t text; stix_oocs_t text;
stix_size_t text_capa; stix_size_t text_capa;
/* buffer to store identifier names to be assigned */ /* buffer to store identifier names to be assigned */
stix_ucs_t assignees; stix_oocs_t assignees;
stix_size_t assignees_capa; stix_size_t assignees_capa;
/* buffer to store binary selectors being worked on */ /* buffer to store binary selectors being worked on */
stix_ucs_t binsels; stix_oocs_t binsels;
stix_size_t binsels_capa; stix_size_t binsels_capa;
/* buffer to store keyword selectors being worked on */ /* buffer to store keyword selectors being worked on */
stix_ucs_t kwsels; stix_oocs_t kwsels;
stix_size_t kwsels_capa; stix_size_t kwsels_capa;
/* method name */ /* method name */
stix_ucs_t name; stix_oocs_t name;
stix_size_t name_capa; stix_size_t name_capa;
stix_ioloc_t name_loc; stix_ioloc_t name_loc;
/* single string containing a space separated list of temporaries */ /* single string containing a space separated list of temporaries */
stix_ucs_t tmprs; stix_oocs_t tmprs;
stix_size_t tmprs_capa; stix_size_t tmprs_capa;
stix_size_t tmpr_count; /* total number of temporaries including arguments */ stix_size_t tmpr_count; /* total number of temporaries including arguments */
stix_size_t tmpr_nargs; stix_size_t tmpr_nargs;
@ -808,6 +808,24 @@ enum stix_bcode_t
extern "C" { extern "C" {
#endif #endif
#if defined(STIX_OOCH_IS_UCH)
# define stix_hashchars(ptr,len) stix_hashuchars(ptr,len)
# define stix_compoocbcstr(str1,str2) stix_compucbcstr(str1,str2)
# define stix_compoocstr(str1,str2) stix_compucstr(str1,str2)
# define stix_copyoochars(dst,src,len) stix_copyuchars(dst,src,len)
# define stix_copybchtooochars(dst,src,len) stix_copybchtouchars(dst,src,len)
# define stix_copyoocstr(dst,len,src) stix_copyucstr(dst,len,src)
# define stix_findoochar(ptr,len,c) stix_finduchar(ptr,len,c)
#else
# define stix_hashchars(ptr,len) stix_hashbchars(ptr,len)
# define stix_compoocbcstr(str1,str2) stix_compbcstr(str1,str2)
# define stix_compoocstr(str1,str2) stix_compbcstr(str1,str2)
# define stix_copyoochars(dst,src,len) stix_copybchars(dst,src,len)
# define stix_copybchtooochars(dst,src,len) stix_copybchars(dst,src,len)
# define stix_copyoocstr(dst,len,src) stix_copybcstr(dst,len,src)
# define stix_findoochar(ptr,len,c) stix_findbchar(ptr,len,c)
#endif
/* ========================================================================= */ /* ========================================================================= */
/* heap.c */ /* heap.c */
/* ========================================================================= */ /* ========================================================================= */
@ -843,22 +861,6 @@ void* stix_allocheapmem (
); );
/* ========================================================================= */
/* stix.c */
/* ========================================================================= */
stix_size_t stix_hashbytes (
const stix_byte_t* ptr,
stix_size_t len
);
stix_size_t stix_hashuchars (
const stix_uch_t* ptr,
stix_size_t len
);
#define stix_hashbchars(ptr,len) stix_hashbytes(ptr,len)
/* ========================================================================= */ /* ========================================================================= */
/* gc.c */ /* gc.c */
/* ========================================================================= */ /* ========================================================================= */
@ -895,7 +897,7 @@ stix_oop_t stix_allocoopobjwithtrailer (
stix_oop_t stix_alloccharobj ( stix_oop_t stix_alloccharobj (
stix_t* stix, stix_t* stix,
const stix_uch_t* ptr, const stix_ooch_t* ptr,
stix_oow_t len stix_oow_t len
); );
@ -926,19 +928,19 @@ stix_oop_t stix_instantiatewithtrailer (
/* ========================================================================= */ /* ========================================================================= */
stix_oop_t stix_makesymbol ( stix_oop_t stix_makesymbol (
stix_t* stix, stix_t* stix,
const stix_uch_t* ptr, const stix_ooch_t* ptr,
stix_oow_t len stix_oow_t len
); );
stix_oop_t stix_findsymbol ( stix_oop_t stix_findsymbol (
stix_t* stix, stix_t* stix,
const stix_uch_t* ptr, const stix_ooch_t* ptr,
stix_oow_t len stix_oow_t len
); );
stix_oop_t stix_makestring ( stix_oop_t stix_makestring (
stix_t* stix, stix_t* stix,
const stix_uch_t* ptr, const stix_ooch_t* ptr,
stix_oow_t len stix_oow_t len
); );
@ -958,7 +960,7 @@ stix_oop_association_t stix_getatsysdic (
stix_oop_association_t stix_lookupsysdic ( stix_oop_association_t stix_lookupsysdic (
stix_t* stix, stix_t* stix,
const stix_ucs_t* name const stix_oocs_t* name
); );
stix_oop_association_t stix_putatdic ( stix_oop_association_t stix_putatdic (
@ -977,7 +979,7 @@ stix_oop_association_t stix_getatdic (
stix_oop_association_t stix_lookupdic ( stix_oop_association_t stix_lookupdic (
stix_t* stix, stix_t* stix,
stix_oop_set_t dic, stix_oop_set_t dic,
const stix_ucs_t* name const stix_oocs_t* name
); );
stix_oop_set_t stix_makedic ( stix_oop_set_t stix_makedic (
@ -1068,7 +1070,7 @@ void stix_getsynerr (
/* ========================================================================= */ /* ========================================================================= */
int stix_getprimno ( int stix_getprimno (
stix_t* stix, stix_t* stix,
const stix_ucs_t* name const stix_oocs_t* name
); );
/* TODO: remove debugging functions */ /* TODO: remove debugging functions */
@ -1077,7 +1079,7 @@ int stix_getprimno (
/* ========================================================================= */ /* ========================================================================= */
void dump_symbol_table (stix_t* stix); void dump_symbol_table (stix_t* stix);
void dump_dictionary (stix_t* stix, stix_oop_set_t dic, const char* title); void dump_dictionary (stix_t* stix, stix_oop_set_t dic, const char* title);
void print_ucs (const stix_ucs_t* name); void print_oocs (const stix_oocs_t* name);
void print_object (stix_t* stix, stix_oop_t oop); void print_object (stix_t* stix, stix_oop_t oop);
void dump_object (stix_t* stix, stix_oop_t oop, const char* title); void dump_object (stix_t* stix, stix_oop_t oop, const char* title);

View File

@ -27,6 +27,22 @@
#include "stix-utl.h" #include "stix-utl.h"
stix_size_t stix_hashbytes (const stix_byte_t* ptr, stix_size_t len)
{
stix_size_t h = 0;
const stix_uint8_t* bp, * be;
bp = ptr; be = bp + len;
while (bp < be) h = h * 31 + *bp++;
return h;
}
stix_size_t stix_hashuchars (const stix_uch_t* ptr, stix_size_t len)
{
return stix_hashbytes ((const stix_byte_t *)ptr, len * STIX_SIZEOF(*ptr));
}
int stix_equalchars (const stix_uch_t* str1, const stix_uch_t* str2, stix_size_t len) int stix_equalchars (const stix_uch_t* str1, const stix_uch_t* str2, stix_size_t len)
{ {
stix_size_t i; stix_size_t i;
@ -87,6 +103,12 @@ void stix_copyuchars (stix_uch_t* dst, const stix_uch_t* src, stix_size_t len)
for (i = 0; i < len; i++) dst[i] = src[i]; for (i = 0; i < len; i++) dst[i] = src[i];
} }
void stix_copybchars (stix_bch_t* dst, const stix_bch_t* src, stix_size_t len)
{
stix_size_t i;
for (i = 0; i < len; i++) dst[i] = src[i];
}
void stix_copybchtouchars (stix_uch_t* dst, const stix_bch_t* src, stix_size_t len) void stix_copybchtouchars (stix_uch_t* dst, const stix_bch_t* src, stix_size_t len)
{ {
stix_size_t i; stix_size_t i;
@ -125,7 +147,7 @@ stix_size_t stix_copybcstr (stix_bch_t* dst, stix_size_t len, const stix_bch_t*
return p - dst; return p - dst;
} }
stix_uch_t* stix_findchar (const stix_uch_t* ptr, stix_size_t len, stix_uch_t c) stix_uch_t* stix_finduchar (const stix_uch_t* ptr, stix_size_t len, stix_uch_t c)
{ {
const stix_uch_t* end; const stix_uch_t* end;
@ -139,3 +161,17 @@ stix_uch_t* stix_findchar (const stix_uch_t* ptr, stix_size_t len, stix_uch_t c)
return STIX_NULL; return STIX_NULL;
} }
stix_uch_t* stix_findbchar (const stix_bch_t* ptr, stix_size_t len, stix_bch_t c)
{
const stix_bch_t* end;
end = ptr + len;
while (ptr < end)
{
if (*ptr == c) return (stix_bch_t*)ptr;
ptr++;
}
return STIX_NULL;
}

View File

@ -37,6 +37,19 @@ extern "C" {
/* ========================================================================= */ /* ========================================================================= */
/* stix-utl.c */ /* stix-utl.c */
/* ========================================================================= */ /* ========================================================================= */
stix_size_t stix_hashbytes (
const stix_byte_t* ptr,
stix_size_t len
);
stix_size_t stix_hashuchars (
const stix_uch_t* ptr,
stix_size_t len
);
#define stix_hashbchars(ptr,len) stix_hashbytes(ptr,len)
int stix_equalchars ( int stix_equalchars (
const stix_uch_t* str1, const stix_uch_t* str1,
const stix_uch_t* str2, const stix_uch_t* str2,
@ -70,18 +83,30 @@ void stix_copyuchars (
stix_size_t len stix_size_t len
); );
void stix_copybchars (
stix_bch_t* dst,
const stix_bch_t* src,
stix_size_t len
);
void stix_copybchtouchars ( void stix_copybchtouchars (
stix_uch_t* dst, stix_uch_t* dst,
const stix_bch_t* src, const stix_bch_t* src,
stix_size_t len stix_size_t len
); );
stix_uch_t* stix_findchar ( stix_uch_t* stix_finduchar (
const stix_uch_t* ptr, const stix_uch_t* ptr,
stix_size_t len, stix_size_t len,
stix_uch_t c stix_uch_t c
); );
stix_uch_t* stix_findbchar (
const stix_bch_t* ptr,
stix_size_t len,
stix_bch_t c
);
stix_size_t stix_copyucstr ( stix_size_t stix_copyucstr (
stix_uch_t* dst, stix_uch_t* dst,
stix_size_t len, stix_size_t len,

View File

@ -69,7 +69,7 @@ int stix_init (stix_t* stix, stix_mmgr_t* mmgr, stix_size_t heapsz, const stix_v
stix->newheap = stix_makeheap (stix, heapsz); stix->newheap = stix_makeheap (stix, heapsz);
if (!stix->newheap) goto oops; if (!stix->newheap) goto oops;
if (stix_rbt_init (&stix->pmtable, mmgr, STIX_SIZEOF(stix_uch_t), 1) <= -1) goto oops; if (stix_rbt_init (&stix->pmtable, mmgr, STIX_SIZEOF(stix_ooch_t), 1) <= -1) goto oops;
stix_rbt_setstyle (&stix->pmtable, stix_getrbtstyle(STIX_RBT_STYLE_INLINE_COPIERS)); stix_rbt_setstyle (&stix->pmtable, stix_getrbtstyle(STIX_RBT_STYLE_INLINE_COPIERS));
return 0; return 0;
@ -215,21 +215,7 @@ void stix_deregcb (stix_t* stix, stix_cb_t* cb)
stix_freemem (stix, cb); stix_freemem (stix, cb);
} }
stix_size_t stix_hashbytes (const stix_byte_t* ptr, stix_size_t len)
{
stix_size_t h = 0;
const stix_uint8_t* bp, * be;
bp = ptr; be = bp + len;
while (bp < be) h = h * 31 + *bp++;
return h;
}
stix_size_t stix_hashuchars (const stix_uch_t* ptr, stix_size_t len)
{
return stix_hashbytes ((const stix_byte_t *)ptr, len * STIX_SIZEOF(*ptr));
}
void* stix_allocmem (stix_t* stix, stix_size_t size) void* stix_allocmem (stix_t* stix, stix_size_t size)

View File

@ -78,9 +78,16 @@ typedef enum stix_trait_t stix_trait_t;
/* NOTE: sizeof(stix_oop_t) must be equal to sizeof(stix_oow_t) */ /* NOTE: sizeof(stix_oop_t) must be equal to sizeof(stix_oow_t) */
typedef stix_uintptr_t stix_oow_t; typedef stix_uintptr_t stix_oow_t;
typedef stix_intptr_t stix_ooi_t; typedef stix_intptr_t stix_ooi_t;
typedef stix_ushortptr_t stix_oosw_t; /* short word - half word */
typedef stix_shortptr_t stix_oosi_t; /* signed short word */
typedef struct stix_obj_t stix_obj_t; typedef struct stix_obj_t stix_obj_t;
typedef struct stix_obj_t* stix_oop_t; typedef struct stix_obj_t* stix_oop_t;
typedef stix_uch_t stix_ooch_t;
typedef stix_uci_t stix_ooci_t;
typedef stix_ucs_t stix_oocs_t;
#define STIX_OOCH_IS_UCH
/* these are more specialized types for stix_obj_t */ /* these are more specialized types for stix_obj_t */
typedef struct stix_obj_oop_t stix_obj_oop_t; typedef struct stix_obj_oop_t stix_obj_oop_t;
typedef struct stix_obj_char_t stix_obj_char_t; typedef struct stix_obj_char_t stix_obj_char_t;
@ -96,7 +103,6 @@ typedef struct stix_obj_word_t* stix_oop_word_t;
#define STIX_OOW_BITS (STIX_SIZEOF(stix_oow_t) * 8) #define STIX_OOW_BITS (STIX_SIZEOF(stix_oow_t) * 8)
#define STIX_OOP_BITS (STIX_SIZEOF(stix_oop_t) * 8) #define STIX_OOP_BITS (STIX_SIZEOF(stix_oop_t) * 8)
/* /*
* OOP encoding * OOP encoding
* An object pointer(OOP) is an ordinary pointer value to an object. * An object pointer(OOP) is an ordinary pointer value to an object.
@ -271,7 +277,7 @@ struct stix_obj_oop_t
struct stix_obj_char_t struct stix_obj_char_t
{ {
STIX_OBJ_HEADER; STIX_OBJ_HEADER;
stix_uch_t slot[1]; stix_ooch_t slot[1];
}; };
struct stix_obj_byte_t struct stix_obj_byte_t
@ -673,6 +679,7 @@ struct stix_t
stix_oop_t _character; /* Character */ stix_oop_t _character; /* Character */
stix_oop_t _small_integer; /* SmallInteger */ stix_oop_t _small_integer; /* SmallInteger */
stix_oop_t _large_integer;
/* == NEVER CHANGE THE ORDER OF FIELDS ABOVE == */ /* == NEVER CHANGE THE ORDER OF FIELDS ABOVE == */
stix_oop_set_t symtab; /* system-wide symbol table. instance of SymbolSet */ stix_oop_set_t symtab; /* system-wide symbol table. instance of SymbolSet */
@ -820,9 +827,9 @@ STIX_EXPORT int stix_execute (
* named \a objname. * named \a objname.
*/ */
STIX_EXPORT int stix_invoke ( STIX_EXPORT int stix_invoke (
stix_t* stix, stix_t* stix,
const stix_ucs_t* objname, const stix_oocs_t* objname,
const stix_ucs_t* mthname const stix_oocs_t* mthname
); );
/* Temporary OOP management */ /* Temporary OOP management */

View File

@ -49,7 +49,7 @@ static stix_oop_oop_t expand_bucket (stix_t* stix, stix_oop_oop_t oldbuc)
STIX_ASSERT (STIX_CLASSOF(stix,symbol) == stix->_symbol); STIX_ASSERT (STIX_CLASSOF(stix,symbol) == stix->_symbol);
/*STIX_ASSERT (sym->size > 0);*/ /*STIX_ASSERT (sym->size > 0);*/
index = stix_hashuchars(symbol->slot, STIX_OBJ_GET_SIZE(symbol)) % newsz; index = stix_hashchars(symbol->slot, STIX_OBJ_GET_SIZE(symbol)) % newsz;
while (newbuc->slot[index] != stix->_nil) index = (index + 1) % newsz; while (newbuc->slot[index] != stix->_nil) index = (index + 1) % newsz;
newbuc->slot[index] = (stix_oop_t)symbol; newbuc->slot[index] = (stix_oop_t)symbol;
} }
@ -58,7 +58,7 @@ static stix_oop_oop_t expand_bucket (stix_t* stix, stix_oop_oop_t oldbuc)
return newbuc; return newbuc;
} }
static stix_oop_t find_or_make_symbol (stix_t* stix, const stix_uch_t* ptr, stix_oow_t len, int create) static stix_oop_t find_or_make_symbol (stix_t* stix, const stix_ooch_t* ptr, stix_oow_t len, int create)
{ {
stix_oow_t index, tally; stix_oow_t index, tally;
stix_oop_char_t symbol; stix_oop_char_t symbol;
@ -72,7 +72,7 @@ static stix_oop_t find_or_make_symbol (stix_t* stix, const stix_uch_t* ptr, stix
} }
STIX_ASSERT (STIX_CLASSOF(stix,stix->symtab->bucket) == stix->_array); STIX_ASSERT (STIX_CLASSOF(stix,stix->symtab->bucket) == stix->_array);
index = stix_hashuchars(ptr, len) % STIX_OBJ_GET_SIZE(stix->symtab->bucket); index = stix_hashchars(ptr, len) % STIX_OBJ_GET_SIZE(stix->symtab->bucket);
/* find a matching symbol in the open-addressed symbol table */ /* find a matching symbol in the open-addressed symbol table */
while (stix->symtab->bucket->slot[index] != stix->_nil) while (stix->symtab->bucket->slot[index] != stix->_nil)
@ -114,7 +114,7 @@ static stix_oop_t find_or_make_symbol (stix_t* stix, const stix_uch_t* ptr, stix
stix->symtab->bucket = bucket; stix->symtab->bucket = bucket;
/* recalculate the index for the expanded bucket */ /* recalculate the index for the expanded bucket */
index = stix_hashuchars(ptr, len) % STIX_OBJ_GET_SIZE(stix->symtab->bucket); index = stix_hashchars(ptr, len) % STIX_OBJ_GET_SIZE(stix->symtab->bucket);
while (stix->symtab->bucket->slot[index] != stix->_nil) while (stix->symtab->bucket->slot[index] != stix->_nil)
index = (index + 1) % STIX_OBJ_GET_SIZE(stix->symtab->bucket); index = (index + 1) % STIX_OBJ_GET_SIZE(stix->symtab->bucket);
@ -132,17 +132,17 @@ static stix_oop_t find_or_make_symbol (stix_t* stix, const stix_uch_t* ptr, stix
return (stix_oop_t)symbol; return (stix_oop_t)symbol;
} }
stix_oop_t stix_makesymbol (stix_t* stix, const stix_uch_t* ptr, stix_oow_t len) stix_oop_t stix_makesymbol (stix_t* stix, const stix_ooch_t* ptr, stix_oow_t len)
{ {
return find_or_make_symbol (stix, ptr, len, 1); return find_or_make_symbol (stix, ptr, len, 1);
} }
stix_oop_t stix_findsymbol (stix_t* stix, const stix_uch_t* ptr, stix_oow_t len) stix_oop_t stix_findsymbol (stix_t* stix, const stix_ooch_t* ptr, stix_oow_t len)
{ {
return find_or_make_symbol (stix, ptr, len, 0); return find_or_make_symbol (stix, ptr, len, 0);
} }
stix_oop_t stix_makestring (stix_t* stix, const stix_uch_t* ptr, stix_oow_t len) stix_oop_t stix_makestring (stix_t* stix, const stix_ooch_t* ptr, stix_oow_t len)
{ {
return stix_instantiate (stix, stix->_string, ptr, len); return stix_instantiate (stix, stix->_string, ptr, len);
} }