[svn:parrot] r49416 - in trunk: compilers/pirc/src src src/dynpmc src/io src/ops src/pmc src/runcore src/string
nwellnhof at svn.parrot.org
nwellnhof at svn.parrot.org
Sat Oct 2 22:25:16 UTC 2010
Author: nwellnhof
Date: Sat Oct 2 22:25:15 2010
New Revision: 49416
URL: https://trac.parrot.org/parrot/changeset/49416
Log:
[str] Switch to STRING_equal macro
Move the whole 'str_equal' logic into the string vtable functions
Modified:
trunk/compilers/pirc/src/bcgen.c
trunk/src/dynext.c
trunk/src/dynpmc/os.pmc
trunk/src/embed.c
trunk/src/exceptions.c
trunk/src/hash.c
trunk/src/hll.c
trunk/src/io/filehandle.c
trunk/src/library.c
trunk/src/multidispatch.c
trunk/src/oo.c
trunk/src/ops/cmp.ops
trunk/src/ops/core_ops.c
trunk/src/packfile.c
trunk/src/packout.c
trunk/src/pmc/callcontext.pmc
trunk/src/pmc/class.pmc
trunk/src/pmc/codestring.pmc
trunk/src/pmc/complex.pmc
trunk/src/pmc/default.pmc
trunk/src/pmc/eventhandler.pmc
trunk/src/pmc/exception.pmc
trunk/src/pmc/filehandle.pmc
trunk/src/pmc/fixedbooleanarray.pmc
trunk/src/pmc/fixedstringarray.pmc
trunk/src/pmc/lexinfo.pmc
trunk/src/pmc/namespace.pmc
trunk/src/pmc/object.pmc
trunk/src/pmc/packfile.pmc
trunk/src/pmc/packfileconstanttable.pmc
trunk/src/pmc/parrotinterpreter.pmc
trunk/src/pmc/pmcproxy.pmc
trunk/src/pmc/role.pmc
trunk/src/pmc/scalar.pmc
trunk/src/pmc/scheduler.pmc
trunk/src/pmc/string.pmc
trunk/src/pmc/stringbuilder.pmc
trunk/src/pmc/stringhandle.pmc
trunk/src/pmc/sub.pmc
trunk/src/pmc/task.pmc
trunk/src/runcore/main.c
trunk/src/runcore/profiling.c
trunk/src/scheduler.c
trunk/src/string/api.c
trunk/src/string/encoding.c
trunk/src/sub.c
Modified: trunk/compilers/pirc/src/bcgen.c
==============================================================================
--- trunk/compilers/pirc/src/bcgen.c Sat Oct 2 22:23:59 2010 (r49415)
+++ trunk/compilers/pirc/src/bcgen.c Sat Oct 2 22:25:15 2010 (r49416)
@@ -271,7 +271,7 @@
while (index < count) {
constant = bc->interp->code->const_table->constants[index];
if (constant->type == PFC_STRING) {
- if (Parrot_str_equal(bc->interp, constant->u.string, parrotstr)) {
+ if (STRING_equal(bc->interp, constant->u.string, parrotstr)) {
#if DEBUGBC
fprintf(stderr, "found string %s at index %d\n", str, index);
#endif
@@ -351,7 +351,7 @@
if (constant->type == PFC_KEY) {
STRING *s2 = key_set_to_string(bc->interp, constant->u.key);
- if (Parrot_str_equal(bc->interp, s1, s2)) {
+ if (STRING_equal(bc->interp, s1, s2)) {
#if DEBUGBC
fprintf(stderr, "found equal key (%d)\n", index);
#endif
Modified: trunk/src/dynext.c
==============================================================================
--- trunk/src/dynext.c Sat Oct 2 22:23:59 2010 (r49415)
+++ trunk/src/dynext.c Sat Oct 2 22:25:15 2010 (r49416)
@@ -51,14 +51,16 @@
PARROT_WARN_UNUSED_RESULT
PARROT_CAN_RETURN_NULL
static STRING * get_path(PARROT_INTERP,
- ARGMOD_NULLOK(STRING *lib),
+ ARGMOD(STRING *lib),
Parrot_dlopen_flags flags,
ARGOUT(void **handle),
ARGIN(STRING *wo_ext),
- ARGIN_NULLOK(STRING *ext))
+ ARGIN(STRING *ext))
__attribute__nonnull__(1)
+ __attribute__nonnull__(2)
__attribute__nonnull__(4)
__attribute__nonnull__(5)
+ __attribute__nonnull__(6)
FUNC_MODIFIES(*lib)
FUNC_MODIFIES(*handle);
@@ -77,10 +79,11 @@
PARROT_CANNOT_RETURN_NULL
static PMC * run_init_lib(PARROT_INTERP,
ARGIN(void *handle),
- ARGIN_NULLOK(STRING *lib_name),
+ ARGIN(STRING *lib_name),
ARGIN(STRING *wo_ext))
__attribute__nonnull__(1)
__attribute__nonnull__(2)
+ __attribute__nonnull__(3)
__attribute__nonnull__(4);
static void set_cstring_prop(PARROT_INTERP,
@@ -97,11 +100,12 @@
ARGIN(PMC *lib_pmc),
ARGIN(STRING *path),
ARGIN(STRING *type),
- ARGIN_NULLOK(STRING *lib_name))
+ ARGIN(STRING *lib_name))
__attribute__nonnull__(1)
__attribute__nonnull__(2)
__attribute__nonnull__(3)
- __attribute__nonnull__(4);
+ __attribute__nonnull__(4)
+ __attribute__nonnull__(5);
#define ASSERT_ARGS_clone_string_into __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(d) \
@@ -112,8 +116,10 @@
, PARROT_ASSERT_ARG(path))
#define ASSERT_ARGS_get_path __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp) \
+ , PARROT_ASSERT_ARG(lib) \
, PARROT_ASSERT_ARG(handle) \
- , PARROT_ASSERT_ARG(wo_ext))
+ , PARROT_ASSERT_ARG(wo_ext) \
+ , PARROT_ASSERT_ARG(ext))
#define ASSERT_ARGS_is_loaded __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp) \
, PARROT_ASSERT_ARG(path))
@@ -123,6 +129,7 @@
#define ASSERT_ARGS_run_init_lib __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp) \
, PARROT_ASSERT_ARG(handle) \
+ , PARROT_ASSERT_ARG(lib_name) \
, PARROT_ASSERT_ARG(wo_ext))
#define ASSERT_ARGS_set_cstring_prop __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp) \
@@ -133,7 +140,8 @@
PARROT_ASSERT_ARG(interp) \
, PARROT_ASSERT_ARG(lib_pmc) \
, PARROT_ASSERT_ARG(path) \
- , PARROT_ASSERT_ARG(type))
+ , PARROT_ASSERT_ARG(type) \
+ , PARROT_ASSERT_ARG(lib_name))
/* Don't modify between HEADERIZER BEGIN / HEADERIZER END. Your changes will be lost. */
/* HEADERIZER END: static */
@@ -177,7 +185,7 @@
static void
store_lib_pmc(PARROT_INTERP, ARGIN(PMC *lib_pmc), ARGIN(STRING *path),
- ARGIN(STRING *type), ARGIN_NULLOK(STRING *lib_name))
+ ARGIN(STRING *type), ARGIN(STRING *lib_name))
{
ASSERT_ARGS(store_lib_pmc)
PMC * const iglobals = interp->iglobals;
@@ -188,7 +196,7 @@
set_cstring_prop(interp, lib_pmc, "_filename", path);
set_cstring_prop(interp, lib_pmc, "_type", type);
- if (lib_name)
+ if (!STRING_IS_NULL(lib_name))
set_cstring_prop(interp, lib_pmc, "_lib_name", lib_name);
VTABLE_set_pmc_keyed_str(interp, dyn_libs, path, lib_pmc);
@@ -260,9 +268,8 @@
PARROT_WARN_UNUSED_RESULT
PARROT_CAN_RETURN_NULL
static STRING *
-get_path(PARROT_INTERP, ARGMOD_NULLOK(STRING *lib), Parrot_dlopen_flags flags,
- ARGOUT(void **handle), ARGIN(STRING *wo_ext),
- ARGIN_NULLOK(STRING *ext))
+get_path(PARROT_INTERP, ARGMOD(STRING *lib), Parrot_dlopen_flags flags,
+ ARGOUT(void **handle), ARGIN(STRING *wo_ext), ARGIN(STRING *ext))
{
ASSERT_ARGS(get_path)
PMC * const iglobals = interp->iglobals;
@@ -273,7 +280,7 @@
STRING *path, *full_name;
- if (! lib) {
+ if (STRING_IS_NULL(lib)) {
*handle = Parrot_dlopen((char *)NULL, flags);
if (*handle)
return CONST_STRING(interp, "");
@@ -284,12 +291,12 @@
err ? err : "unknown reason");
/* clear the error memory */
(void)Parrot_dlerror();
- return NULL;
+ return STRINGNULL;
}
}
/* first, try to add an extension to the file if it has none */
- if (! ext) {
+ if (STRING_IS_NULL(ext)) {
const INTVAL n = VTABLE_elements(interp, share_ext);
INTVAL i;
@@ -299,7 +306,7 @@
path = Parrot_locate_runtime_file_str(interp, full_name,
PARROT_RUNTIME_FT_DYNEXT);
- if (path) {
+ if (!STRING_IS_NULL(path)) {
*handle = dlopen_string(interp, flags, path);
if (*handle)
@@ -311,7 +318,7 @@
full_name, err ? err : "unknown reason");
/* clear the error memory */
(void)Parrot_dlerror();
- return NULL;
+ return STRINGNULL;
}
}
@@ -332,7 +339,7 @@
full_name = Parrot_locate_runtime_file_str(interp, lib,
PARROT_RUNTIME_FT_DYNEXT);
- if (full_name) {
+ if (!STRING_IS_NULL(full_name)) {
*handle = dlopen_string(interp, flags, full_name);
if (*handle)
@@ -344,7 +351,7 @@
* [shouldn't this happen in Parrot_locate_runtime_file instead?]
*/
#ifdef WIN32
- if (!STRING_IS_EMPTY(lib) && memcmp(lib->strstart, "lib", 3) == 0) {
+ if (STRING_length(lib) >= 3 && memcmp(lib->strstart, "lib", 3) == 0) {
*handle = Parrot_dlopen((char *)lib->strstart + 3, 0);
if (*handle)
@@ -354,7 +361,7 @@
/* And on cygwin replace a leading "lib" by "cyg". */
#ifdef __CYGWIN__
- if (!STRING_IS_EMPTY(lib) && memcmp(lib->strstart, "lib", 3) == 0) {
+ if (!STRING_length(lib) >= 3 && memcmp(lib->strstart, "lib", 3) == 0) {
path = Parrot_str_concat(interp, CONST_STRING(interp, "cyg"),
Parrot_str_substr(interp, lib, 3, lib->strlen - 3));
@@ -365,7 +372,7 @@
}
#endif
- if (STRING_IS_EMPTY(lib)) {
+ if (!STRING_length(lib)) {
*handle = dlopen_string(interp, flags, lib);
if (*handle)
return lib;
@@ -379,7 +386,7 @@
/* clear the error memory */
(void)Parrot_dlerror();
- return NULL;
+ return STRINGNULL;
}
}
@@ -469,7 +476,7 @@
PARROT_CANNOT_RETURN_NULL
static PMC *
run_init_lib(PARROT_INTERP, ARGIN(void *handle),
- ARGIN_NULLOK(STRING *lib_name), ARGIN(STRING *wo_ext))
+ ARGIN(STRING *lib_name), ARGIN(STRING *wo_ext))
{
ASSERT_ARGS(run_init_lib)
STRING *type;
@@ -484,7 +491,7 @@
Parrot_pcc_set_namespace(interp, context,
Parrot_get_HLL_namespace(interp, parrot_hll_id));
- if (lib_name) {
+ if (!STRING_IS_NULL(lib_name)) {
STRING * const load_name = Parrot_sprintf_c(interp,
"Parrot_lib_%Ss_load", lib_name);
STRING * const init_func_name = Parrot_sprintf_c(interp,
@@ -606,7 +613,7 @@
STRING * const type =
VTABLE_get_string(s, VTABLE_getprop(s, lib_pmc, type_str));
- if (Parrot_str_equal(s, type, ops)) {
+ if (STRING_equal(s, type, ops)) {
/* we can't clone oplibs in the normal way, since they're actually
* shared between interpreters dynop_register modifies the (statically
* allocated) op_lib_t structure from core_ops.c, for example.
@@ -690,12 +697,12 @@
*
* LOCK()
*/
- if (lib)
+ if (!STRING_IS_NULL(lib))
lib_name = parrot_split_path_ext(interp, lib, &wo_ext, &ext);
else {
wo_ext = CONST_STRING(interp, "");
- lib_name = NULL;
- ext = NULL;
+ lib_name = STRINGNULL;
+ ext = STRINGNULL;
}
lib_pmc = is_loaded(interp, wo_ext);
Modified: trunk/src/dynpmc/os.pmc
==============================================================================
--- trunk/src/dynpmc/os.pmc Sat Oct 2 22:23:59 2010 (r49415)
+++ trunk/src/dynpmc/os.pmc Sat Oct 2 22:25:15 2010 (r49416)
@@ -508,9 +508,9 @@
/* Add \* to the directory name and start search. */
STRING *last_char = Parrot_str_substr(INTERP, path,
Parrot_str_length(INTERP, path) - 1, 1, NULL, 0);
- int trailing_slash = Parrot_str_equal(INTERP, last_char, string_from_literal(INTERP, "\\"))
+ int trailing_slash = STRING_equal(INTERP, last_char, string_from_literal(INTERP, "\\"))
||
- Parrot_str_equal(INTERP, last_char, string_from_literal(INTERP, "/"));
+ STRING_equal(INTERP, last_char, string_from_literal(INTERP, "/"));
cpath = Parrot_str_to_cstring(INTERP, Parrot_str_concat(INTERP,
path, string_from_literal(INTERP, trailing_slash ? "*" : "\\*"), 0));
hFind = FindFirstFile(cpath, &file_find_data);
Modified: trunk/src/embed.c
==============================================================================
--- trunk/src/embed.c Sat Oct 2 22:23:59 2010 (r49415)
+++ trunk/src/embed.c Sat Oct 2 22:25:15 2010 (r49416)
@@ -1118,10 +1118,10 @@
PARROT_ASSERT(interp->initial_pf);
}
- if (Parrot_str_compare(interp, CONST_STRING(interp, "PIR"), type) == 0)
+ if (STRING_equal(interp, CONST_STRING(interp, "PIR"), type))
return IMCC_compile_pir_s(interp, code, error);
- if (Parrot_str_compare(interp, CONST_STRING(interp, "PASM"), type) == 0)
+ if (STRING_equal(interp, CONST_STRING(interp, "PASM"), type))
return IMCC_compile_pasm_s(interp, code, error);
*error = Parrot_str_new(interp, "Invalid interpreter type", 0);
Modified: trunk/src/exceptions.c
==============================================================================
--- trunk/src/exceptions.c Sat Oct 2 22:23:59 2010 (r49415)
+++ trunk/src/exceptions.c Sat Oct 2 22:25:15 2010 (r49416)
@@ -131,7 +131,7 @@
}
}
- if (Parrot_str_not_equal(interp, message, CONST_STRING(interp, ""))) {
+ if (STRING_length(message)) {
if (use_perr)
Parrot_io_eprintf(interp, "%S\n", message);
else {
@@ -234,7 +234,7 @@
const INTVAL severity = VTABLE_get_integer_keyed_str(interp, exception, CONST_STRING(interp, "severity"));
if (severity < EXCEPT_error) {
PMC * const resume = VTABLE_get_attr_str(interp, exception, CONST_STRING(interp, "resume"));
- if (Parrot_str_not_equal(interp, message, CONST_STRING(interp, ""))) {
+ if (STRING_length(message)) {
Parrot_io_eprintf(interp, "%S\n", message);
}
else {
Modified: trunk/src/hash.c
==============================================================================
--- trunk/src/hash.c Sat Oct 2 22:23:59 2010 (r49415)
+++ trunk/src/hash.c Sat Oct 2 22:25:15 2010 (r49416)
@@ -316,7 +316,7 @@
STRING const *s1 = (STRING const *)search_key;
STRING const *s2 = (STRING const *)bucket_key;
- return Parrot_str_equal(interp, s1, s2) == 0;
+ return !STRING_equal(interp, s1, s2);
}
@@ -1499,7 +1499,7 @@
if ((STRING_byte_length(s) == STRING_byte_length(s2))
&& (memcmp(s->strstart, s2->strstart, STRING_byte_length(s)) == 0))
break;
- } else if (Parrot_str_equal(interp, s, s2))
+ } else if (STRING_equal(interp, s, s2))
break;
}
bucket = bucket->next;
Modified: trunk/src/hll.c
==============================================================================
--- trunk/src/hll.c Sat Oct 2 22:23:59 2010 (r49415)
+++ trunk/src/hll.c Sat Oct 2 22:25:15 2010 (r49416)
@@ -209,7 +209,7 @@
if (!PMC_IS_NULL(lib_name)) {
const STRING * const lib_name_str = VTABLE_get_string(interp, lib_name);
- if (Parrot_str_equal(interp, lib_name_str, hll_lib))
+ if (STRING_equal(interp, lib_name_str, hll_lib))
break;
}
}
Modified: trunk/src/io/filehandle.c
==============================================================================
--- trunk/src/io/filehandle.c Sat Oct 2 22:23:59 2010 (r49415)
+++ trunk/src/io/filehandle.c Sat Oct 2 22:25:15 2010 (r49416)
@@ -674,7 +674,7 @@
if (STRING_IS_NULL(handle_struct->encoding))
return 0;
- if (Parrot_str_equal(interp, value, handle_struct->encoding))
+ if (STRING_equal(interp, value, handle_struct->encoding))
return 1;
return 0;
Modified: trunk/src/library.c
==============================================================================
--- trunk/src/library.c Sat Oct 2 22:23:59 2010 (r49415)
+++ trunk/src/library.c Sat Oct 2 22:25:15 2010 (r49416)
@@ -575,7 +575,7 @@
if (Parrot_str_byte_length(interp, test_path) > 4) {
STRING *orig_ext = Parrot_str_substr(interp, test_path, -4, 4);
/* First try substituting .pbc for the .pir extension */
- if (Parrot_str_equal(interp, orig_ext, pir_extension)) {
+ if (STRING_equal(interp, orig_ext, pir_extension)) {
STRING * const without_ext = Parrot_str_chopn(interp, test_path, 4);
test_path = Parrot_str_concat(interp, without_ext, bytecode_extension);
result = try_load_path(interp, test_path);
@@ -583,7 +583,7 @@
return result;
}
/* Next try substituting .pir, then .pasm for the .pbc extension */
- else if (Parrot_str_equal(interp, orig_ext, bytecode_extension)) {
+ else if (STRING_equal(interp, orig_ext, bytecode_extension)) {
STRING * const without_ext = Parrot_str_chopn(interp, test_path, 4);
test_path = Parrot_str_concat(interp, without_ext, pir_extension);
result = try_load_path(interp, test_path);
@@ -601,7 +601,7 @@
/* Finally, try substituting .pbc for the .pasm extension. */
if (Parrot_str_byte_length(interp, test_path) > 5) {
STRING * const orig_ext = Parrot_str_substr(interp, test_path, -5, 5);
- if (Parrot_str_equal(interp, orig_ext, pasm_extension)) {
+ if (STRING_equal(interp, orig_ext, pasm_extension)) {
STRING * const without_ext = Parrot_str_chopn(interp, test_path, 5);
test_path = Parrot_str_concat(interp, without_ext, bytecode_extension);
result = try_load_path(interp, test_path);
@@ -878,12 +878,12 @@
else if (pos_sl) {
stem = Parrot_str_substr(interp, in, pos_sl, len - pos_sl);
*wo_ext = in;
- *ext = NULL;
+ *ext = STRINGNULL;
}
else {
stem = in;
*wo_ext = stem;
- *ext = NULL;
+ *ext = STRINGNULL;
}
return stem;
}
Modified: trunk/src/multidispatch.c
==============================================================================
--- trunk/src/multidispatch.c Sat Oct 2 22:23:59 2010 (r49415)
+++ trunk/src/multidispatch.c Sat Oct 2 22:25:15 2010 (r49416)
@@ -401,13 +401,13 @@
STRING *type_name = VTABLE_get_string_keyed_int(interp, type_list, i);
INTVAL type;
- if (Parrot_str_equal(interp, type_name, CONST_STRING(interp, "DEFAULT")))
+ if (STRING_equal(interp, type_name, CONST_STRING(interp, "DEFAULT")))
type = enum_type_PMC;
- else if (Parrot_str_equal(interp, type_name, CONST_STRING(interp, "STRING")))
+ else if (STRING_equal(interp, type_name, CONST_STRING(interp, "STRING")))
type = enum_type_STRING;
- else if (Parrot_str_equal(interp, type_name, CONST_STRING(interp, "INTVAL")))
+ else if (STRING_equal(interp, type_name, CONST_STRING(interp, "INTVAL")))
type = enum_type_INTVAL;
- else if (Parrot_str_equal(interp, type_name, CONST_STRING(interp, "FLOATVAL")))
+ else if (STRING_equal(interp, type_name, CONST_STRING(interp, "FLOATVAL")))
type = enum_type_FLOATVAL;
else
type = Parrot_pmc_get_type_str(interp, type_name);
Modified: trunk/src/oo.c
==============================================================================
--- trunk/src/oo.c Sat Oct 2 22:23:59 2010 (r49415)
+++ trunk/src/oo.c Sat Oct 2 22:25:15 2010 (r49416)
@@ -1274,7 +1274,7 @@
const STRING * const check =
VTABLE_get_string_keyed_int(interp, exclude, i);
- if (Parrot_str_equal(interp, check, method_name)) {
+ if (STRING_equal(interp, check, method_name)) {
excluded = 1;
break;
}
Modified: trunk/src/ops/cmp.ops
==============================================================================
--- trunk/src/ops/cmp.ops Sat Oct 2 22:23:59 2010 (r49415)
+++ trunk/src/ops/cmp.ops Sat Oct 2 22:25:15 2010 (r49416)
@@ -78,7 +78,7 @@
}
op eq(in STR, in STR, inconst LABEL) :base_core {
- if (Parrot_str_equal(interp, $1, $2)) {
+ if (STRING_equal(interp, $1, $2)) {
goto OFFSET($3);
}
}
@@ -114,7 +114,7 @@
}
op eq(invar PMC, in STR, inconst LABEL) :base_core {
- if (Parrot_str_equal(interp, VTABLE_get_string(interp, $1), $2)) {
+ if (STRING_equal(interp, VTABLE_get_string(interp, $1), $2)) {
goto OFFSET($3);
}
}
@@ -184,7 +184,7 @@
}
op ne(in STR, in STR, inconst LABEL) :base_core {
- if (Parrot_str_not_equal(interp, $1, $2)) {
+ if (!STRING_equal(interp, $1, $2)) {
goto OFFSET($3);
}
}
@@ -214,7 +214,7 @@
}
op ne(invar PMC, in STR, inconst LABEL) :base_core {
- if (Parrot_str_not_equal(interp, VTABLE_get_string(interp, $1), $2)) {
+ if (!STRING_equal(interp, VTABLE_get_string(interp, $1), $2)) {
goto OFFSET($3);
}
}
@@ -857,7 +857,7 @@
}
inline op iseq(out INT, in STR, in STR) {
- $1 = (Parrot_str_equal(interp, $2, $3) ? 1 : 0);
+ $1 = STRING_equal(interp, $2, $3);
}
inline op iseq(out INT, invar PMC, invar PMC) {
@@ -888,7 +888,7 @@
}
inline op isne(out INT, in STR, in STR) {
- $1 = (Parrot_str_not_equal(interp, $2, $3) ? 1 : 0);
+ $1 = !STRING_equal(interp, $2, $3);
}
inline op isne(out INT, invar PMC, invar PMC) {
Modified: trunk/src/ops/core_ops.c
==============================================================================
--- trunk/src/ops/core_ops.c Sat Oct 2 22:23:59 2010 (r49415)
+++ trunk/src/ops/core_ops.c Sat Oct 2 22:25:15 2010 (r49416)
@@ -16748,7 +16748,7 @@
opcode_t *
Parrot_eq_s_s_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- if (Parrot_str_equal(interp, SREG(1), SREG(2))) {return (opcode_t *)cur_opcode + ICONST(3);
+ if (STRING_equal(interp, SREG(1), SREG(2))) {return (opcode_t *)cur_opcode + ICONST(3);
}
return (opcode_t *)cur_opcode + 4;}
@@ -16756,7 +16756,7 @@
opcode_t *
Parrot_eq_sc_s_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- if (Parrot_str_equal(interp, SCONST(1), SREG(2))) {return (opcode_t *)cur_opcode + ICONST(3);
+ if (STRING_equal(interp, SCONST(1), SREG(2))) {return (opcode_t *)cur_opcode + ICONST(3);
}
return (opcode_t *)cur_opcode + 4;}
@@ -16764,7 +16764,7 @@
opcode_t *
Parrot_eq_s_sc_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- if (Parrot_str_equal(interp, SREG(1), SCONST(2))) {return (opcode_t *)cur_opcode + ICONST(3);
+ if (STRING_equal(interp, SREG(1), SCONST(2))) {return (opcode_t *)cur_opcode + ICONST(3);
}
return (opcode_t *)cur_opcode + 4;}
@@ -16836,7 +16836,7 @@
opcode_t *
Parrot_eq_p_s_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- if (Parrot_str_equal(interp, VTABLE_get_string(interp, PREG(1)), SREG(2))) {return (opcode_t *)cur_opcode + ICONST(3);
+ if (STRING_equal(interp, VTABLE_get_string(interp, PREG(1)), SREG(2))) {return (opcode_t *)cur_opcode + ICONST(3);
}
return (opcode_t *)cur_opcode + 4;}
@@ -16844,7 +16844,7 @@
opcode_t *
Parrot_eq_p_sc_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- if (Parrot_str_equal(interp, VTABLE_get_string(interp, PREG(1)), SCONST(2))) {return (opcode_t *)cur_opcode + ICONST(3);
+ if (STRING_equal(interp, VTABLE_get_string(interp, PREG(1)), SCONST(2))) {return (opcode_t *)cur_opcode + ICONST(3);
}
return (opcode_t *)cur_opcode + 4;}
@@ -16956,7 +16956,7 @@
opcode_t *
Parrot_ne_s_s_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- if (Parrot_str_not_equal(interp, SREG(1), SREG(2))) {return (opcode_t *)cur_opcode + ICONST(3);
+ if (!STRING_equal(interp, SREG(1), SREG(2))) {return (opcode_t *)cur_opcode + ICONST(3);
}
return (opcode_t *)cur_opcode + 4;}
@@ -16964,7 +16964,7 @@
opcode_t *
Parrot_ne_sc_s_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- if (Parrot_str_not_equal(interp, SCONST(1), SREG(2))) {return (opcode_t *)cur_opcode + ICONST(3);
+ if (!STRING_equal(interp, SCONST(1), SREG(2))) {return (opcode_t *)cur_opcode + ICONST(3);
}
return (opcode_t *)cur_opcode + 4;}
@@ -16972,7 +16972,7 @@
opcode_t *
Parrot_ne_s_sc_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- if (Parrot_str_not_equal(interp, SREG(1), SCONST(2))) {return (opcode_t *)cur_opcode + ICONST(3);
+ if (!STRING_equal(interp, SREG(1), SCONST(2))) {return (opcode_t *)cur_opcode + ICONST(3);
}
return (opcode_t *)cur_opcode + 4;}
@@ -17032,7 +17032,7 @@
opcode_t *
Parrot_ne_p_s_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- if (Parrot_str_not_equal(interp, VTABLE_get_string(interp, PREG(1)), SREG(2))) {return (opcode_t *)cur_opcode + ICONST(3);
+ if (!STRING_equal(interp, VTABLE_get_string(interp, PREG(1)), SREG(2))) {return (opcode_t *)cur_opcode + ICONST(3);
}
return (opcode_t *)cur_opcode + 4;}
@@ -17040,7 +17040,7 @@
opcode_t *
Parrot_ne_p_sc_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- if (Parrot_str_not_equal(interp, VTABLE_get_string(interp, PREG(1)), SCONST(2))) {return (opcode_t *)cur_opcode + ICONST(3);
+ if (!STRING_equal(interp, VTABLE_get_string(interp, PREG(1)), SCONST(2))) {return (opcode_t *)cur_opcode + ICONST(3);
}
return (opcode_t *)cur_opcode + 4;}
@@ -18089,21 +18089,21 @@
opcode_t *
Parrot_iseq_i_s_s(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- IREG(1) = (Parrot_str_equal(interp, SREG(2), SREG(3)) ? 1 : 0);
+ IREG(1) = STRING_equal(interp, SREG(2), SREG(3));
return (opcode_t *)cur_opcode + 4;}
opcode_t *
Parrot_iseq_i_sc_s(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- IREG(1) = (Parrot_str_equal(interp, SCONST(2), SREG(3)) ? 1 : 0);
+ IREG(1) = STRING_equal(interp, SCONST(2), SREG(3));
return (opcode_t *)cur_opcode + 4;}
opcode_t *
Parrot_iseq_i_s_sc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- IREG(1) = (Parrot_str_equal(interp, SREG(2), SCONST(3)) ? 1 : 0);
+ IREG(1) = STRING_equal(interp, SREG(2), SCONST(3));
return (opcode_t *)cur_opcode + 4;}
@@ -18162,21 +18162,21 @@
opcode_t *
Parrot_isne_i_s_s(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- IREG(1) = (Parrot_str_not_equal(interp, SREG(2), SREG(3)) ? 1 : 0);
+ IREG(1) = !STRING_equal(interp, SREG(2), SREG(3));
return (opcode_t *)cur_opcode + 4;}
opcode_t *
Parrot_isne_i_sc_s(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- IREG(1) = (Parrot_str_not_equal(interp, SCONST(2), SREG(3)) ? 1 : 0);
+ IREG(1) = !STRING_equal(interp, SCONST(2), SREG(3));
return (opcode_t *)cur_opcode + 4;}
opcode_t *
Parrot_isne_i_s_sc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- IREG(1) = (Parrot_str_not_equal(interp, SREG(2), SCONST(3)) ? 1 : 0);
+ IREG(1) = !STRING_equal(interp, SREG(2), SCONST(3));
return (opcode_t *)cur_opcode + 4;}
Modified: trunk/src/packfile.c
==============================================================================
--- trunk/src/packfile.c Sat Oct 2 22:23:59 2010 (r49415)
+++ trunk/src/packfile.c Sat Oct 2 22:25:15 2010 (r49416)
@@ -1181,7 +1181,7 @@
PackFile_Segment *seg = dir->segments[i];
if (seg) {
- if (Parrot_str_equal(interp, seg->name, name))
+ if (STRING_equal(interp, seg->name, name))
return seg;
if (sub_dir && seg->type == PF_DIR_SEG) {
@@ -1223,7 +1223,7 @@
for (i = 0; i < dir->num_segments; ++i) {
PackFile_Segment * const seg = dir->segments[i];
- if (Parrot_str_equal(interp, seg->name, name)) {
+ if (STRING_equal(interp, seg->name, name)) {
dir->num_segments--;
if (i != dir->num_segments) {
@@ -3031,7 +3031,7 @@
prev_filename_n = debug->mappings[debug->num_mappings-1].filename;
filename_pstr = Parrot_str_new(interp, filename, 0);
if (ct->str.constants[prev_filename_n] &&
- Parrot_str_equal(interp, filename_pstr,
+ STRING_equal(interp, filename_pstr,
ct->str.constants[prev_filename_n])) {
return;
}
@@ -3073,7 +3073,7 @@
/* Check if there is already a constant with this filename */
for (i= 0; i < count; ++i) {
- if (Parrot_str_equal(interp, namestr, ct->str.constants[i]))
+ if (STRING_equal(interp, namestr, ct->str.constants[i]))
break;
}
if (i < count) {
@@ -3931,7 +3931,7 @@
for (i = 0; i < self->num_keys; ++i) {
STRING * const test_key = self->code->const_table->str.constants[self->keys[i].name];
- if (Parrot_str_equal(interp, test_key, key_name)) {
+ if (STRING_equal(interp, test_key, key_name)) {
key_id = i;
break;
}
@@ -4048,7 +4048,7 @@
if (!STRING_IS_NULL(key)) {
for (i = 0; i < self->num_keys; ++i) {
STRING * const test_key = self->code->const_table->str.constants[self->keys[i].name];
- if (Parrot_str_equal(interp, test_key, key)) {
+ if (STRING_equal(interp, test_key, key)) {
key_id = i;
break;
}
@@ -4249,7 +4249,7 @@
/* Check if the file found was actually a bytecode file (.pbc extension) or
* a source file (.pir or .pasm extension. */
- if (Parrot_str_equal(interp, found_ext, pbc))
+ if (STRING_equal(interp, found_ext, pbc))
file_type = PARROT_RUNTIME_FT_PBC;
else
file_type = PARROT_RUNTIME_FT_SOURCE;
@@ -4330,7 +4330,7 @@
pbc = CONST_STRING(interp, "pbc");
- if (Parrot_str_equal(interp, ext, pbc))
+ if (STRING_equal(interp, ext, pbc))
file_type = PARROT_RUNTIME_FT_PBC;
else
file_type = PARROT_RUNTIME_FT_SOURCE;
@@ -4348,7 +4348,7 @@
/* Check if the file found was actually a bytecode file (.pbc
* extension) or a source file (.pir or .pasm extension). */
- if (Parrot_str_equal(interp, found_ext, pbc))
+ if (STRING_equal(interp, found_ext, pbc))
file_type = PARROT_RUNTIME_FT_PBC;
else
file_type = PARROT_RUNTIME_FT_SOURCE;
Modified: trunk/src/packout.c
==============================================================================
--- trunk/src/packout.c Sat Oct 2 22:23:59 2010 (r49415)
+++ trunk/src/packout.c Sat Oct 2 22:25:15 2010 (r49416)
@@ -273,7 +273,7 @@
for (i = 0; i < ct->str.const_count; i++) {
STRING *sc = ct->str.constants[i];
- if (Parrot_str_equal(interp, s, sc)
+ if (STRING_equal(interp, s, sc)
&& s->encoding == sc->encoding) {
return i;
}
Modified: trunk/src/pmc/callcontext.pmc
==============================================================================
--- trunk/src/pmc/callcontext.pmc Sat Oct 2 22:23:59 2010 (r49415)
+++ trunk/src/pmc/callcontext.pmc Sat Oct 2 22:25:15 2010 (r49416)
@@ -886,10 +886,10 @@
VTABLE void set_attr_str(STRING *key, PMC *value) {
- if (Parrot_str_equal(INTERP, key, CONST_STRING(INTERP, "arg_flags"))) {
+ if (STRING_equal(INTERP, key, CONST_STRING(INTERP, "arg_flags"))) {
SET_ATTR_arg_flags(INTERP, SELF, value);
}
- else if (Parrot_str_equal(INTERP, key, CONST_STRING(INTERP, "return_flags"))) {
+ else if (STRING_equal(INTERP, key, CONST_STRING(INTERP, "return_flags"))) {
SET_ATTR_return_flags(INTERP, SELF, value);
}
else
@@ -965,34 +965,34 @@
PMC *value = PMCNULL;
INTVAL hll;
- if (Parrot_str_equal(INTERP, key, CONST_STRING(INTERP, "named")))
+ if (STRING_equal(INTERP, key, CONST_STRING(INTERP, "named")))
value = get_named_names(INTERP, SELF);
- else if (Parrot_str_equal(INTERP, key, CONST_STRING(INTERP, "arg_flags")))
+ else if (STRING_equal(INTERP, key, CONST_STRING(INTERP, "arg_flags")))
GET_ATTR_arg_flags(INTERP, SELF, value);
- else if (Parrot_str_equal(INTERP, key, CONST_STRING(INTERP, "return_flags")))
+ else if (STRING_equal(INTERP, key, CONST_STRING(INTERP, "return_flags")))
GET_ATTR_return_flags(INTERP, SELF, value);
- else if (Parrot_str_equal(INTERP, key, CONST_STRING(INTERP, "caller_ctx")))
+ else if (STRING_equal(INTERP, key, CONST_STRING(INTERP, "caller_ctx")))
GET_ATTR_caller_ctx(INTERP, SELF, value);
- else if (Parrot_str_equal(INTERP, key, CONST_STRING(INTERP, "lex_pad")))
+ else if (STRING_equal(INTERP, key, CONST_STRING(INTERP, "lex_pad")))
GET_ATTR_lex_pad(INTERP, SELF, value);
- else if (Parrot_str_equal(INTERP, key, CONST_STRING(INTERP, "outer_ctx")))
+ else if (STRING_equal(INTERP, key, CONST_STRING(INTERP, "outer_ctx")))
GET_ATTR_outer_ctx(INTERP, SELF, value);
- else if (Parrot_str_equal(INTERP, key, CONST_STRING(INTERP, "current_sub")))
+ else if (STRING_equal(INTERP, key, CONST_STRING(INTERP, "current_sub")))
GET_ATTR_current_sub(INTERP, SELF, value);
- else if (Parrot_str_equal(INTERP, key, CONST_STRING(INTERP, "current_cont")))
+ else if (STRING_equal(INTERP, key, CONST_STRING(INTERP, "current_cont")))
GET_ATTR_current_cont(INTERP, SELF, value);
- else if (Parrot_str_equal(INTERP, key, CONST_STRING(INTERP, "current_object")))
+ else if (STRING_equal(INTERP, key, CONST_STRING(INTERP, "current_object")))
GET_ATTR_current_object(INTERP, SELF, value);
- else if (Parrot_str_equal(INTERP, key, CONST_STRING(INTERP, "current_namespace")))
+ else if (STRING_equal(INTERP, key, CONST_STRING(INTERP, "current_namespace")))
GET_ATTR_current_namespace(INTERP, SELF, value);
- else if (Parrot_str_equal(INTERP, key, CONST_STRING(INTERP, "handlers")))
+ else if (STRING_equal(INTERP, key, CONST_STRING(INTERP, "handlers")))
GET_ATTR_handlers(INTERP, SELF, value);
- else if (Parrot_str_equal(INTERP, key, CONST_STRING(INTERP, "current_HLL"))) {
+ else if (STRING_equal(INTERP, key, CONST_STRING(INTERP, "current_HLL"))) {
GET_ATTR_current_HLL(INTERP, SELF, hll);
value = Parrot_pmc_new(interp, Parrot_get_ctx_HLL_type(interp, enum_class_Integer));
VTABLE_set_integer_native(interp, value, hll);
}
- else if (Parrot_str_equal(INTERP, key, CONST_STRING(INTERP, "current_hll"))) {
+ else if (STRING_equal(INTERP, key, CONST_STRING(INTERP, "current_hll"))) {
GET_ATTR_current_HLL(INTERP, SELF, hll);
value = Parrot_pmc_new(interp, Parrot_get_ctx_HLL_type(interp, enum_class_String));
VTABLE_set_string_native(interp, value, Parrot_get_HLL_name(INTERP, hll));
Modified: trunk/src/pmc/class.pmc
==============================================================================
--- trunk/src/pmc/class.pmc Sat Oct 2 22:23:59 2010 (r49415)
+++ trunk/src/pmc/class.pmc Sat Oct 2 22:25:15 2010 (r49416)
@@ -1112,39 +1112,39 @@
/* What should we return? */
PMC *found;
- if (Parrot_str_equal(INTERP, what, CONST_STRING(INTERP, "attributes"))) {
+ if (STRING_equal(INTERP, what, CONST_STRING(INTERP, "attributes"))) {
found = _class->attrib_metadata;
}
- else if (Parrot_str_equal(INTERP, what, CONST_STRING(INTERP, "parents"))) {
+ else if (STRING_equal(INTERP, what, CONST_STRING(INTERP, "parents"))) {
found = _class->parents;
}
- else if (Parrot_str_equal(INTERP, what, CONST_STRING(INTERP, "name"))) {
+ else if (STRING_equal(INTERP, what, CONST_STRING(INTERP, "name"))) {
found = Parrot_pmc_new(INTERP, enum_class_String);
VTABLE_set_string_native(INTERP, found, _class->name);
}
- else if (Parrot_str_equal(INTERP, what, CONST_STRING(INTERP, "id"))) {
+ else if (STRING_equal(INTERP, what, CONST_STRING(INTERP, "id"))) {
found = Parrot_pmc_new_init_int(INTERP, enum_class_Integer, _class->id);
}
- else if (Parrot_str_equal(INTERP, what, CONST_STRING(INTERP, "namespace"))) {
+ else if (STRING_equal(INTERP, what, CONST_STRING(INTERP, "namespace"))) {
/* Should not clone this. */
return _class->_namespace;
}
- else if (Parrot_str_equal(INTERP, what, CONST_STRING(INTERP, "attrib_index"))) {
+ else if (STRING_equal(INTERP, what, CONST_STRING(INTERP, "attrib_index"))) {
found = _class->attrib_index;
}
- else if (Parrot_str_equal(INTERP, what, CONST_STRING(INTERP, "methods"))) {
+ else if (STRING_equal(INTERP, what, CONST_STRING(INTERP, "methods"))) {
found = _class->methods;
}
- else if (Parrot_str_equal(INTERP, what, CONST_STRING(INTERP, "vtable_overrides"))) {
+ else if (STRING_equal(INTERP, what, CONST_STRING(INTERP, "vtable_overrides"))) {
found = _class->vtable_overrides;
}
- else if (Parrot_str_equal(INTERP, what, CONST_STRING(INTERP, "all_parents"))) {
+ else if (STRING_equal(INTERP, what, CONST_STRING(INTERP, "all_parents"))) {
found = _class->all_parents;
}
- else if (Parrot_str_equal(INTERP, what, CONST_STRING(INTERP, "roles"))) {
+ else if (STRING_equal(INTERP, what, CONST_STRING(INTERP, "roles"))) {
found = _class->roles;
}
- else if (Parrot_str_equal(INTERP, what, CONST_STRING(INTERP, "flags"))) {
+ else if (STRING_equal(INTERP, what, CONST_STRING(INTERP, "flags"))) {
found = Parrot_pmc_new_init_int(INTERP, enum_class_Integer,
(INTVAL)PObj_get_FLAGS(SELF));
}
@@ -1479,7 +1479,7 @@
PMC *want_class;
/* hard-code this one exception right away */
- if (Parrot_str_equal(INTERP, classname, CONST_STRING(INTERP, "Class")))
+ if (STRING_equal(INTERP, classname, CONST_STRING(INTERP, "Class")))
return 1;
want_class = Parrot_oo_get_class_str(INTERP, classname);
Modified: trunk/src/pmc/codestring.pmc
==============================================================================
--- trunk/src/pmc/codestring.pmc Sat Oct 2 22:23:59 2010 (r49415)
+++ trunk/src/pmc/codestring.pmc Sat Oct 2 22:25:15 2010 (r49416)
@@ -128,10 +128,10 @@
const INTVAL I0 = Parrot_str_to_int(INTERP, key);
repl = VTABLE_get_string_keyed_int(INTERP, args, I0);
}
- else if (Parrot_str_equal(INTERP, key, comma)) {
+ else if (STRING_equal(INTERP, key, comma)) {
repl = Parrot_str_join(INTERP, comma_space, args);
}
- else if (Parrot_str_equal(INTERP, key, percent)) {
+ else if (STRING_equal(INTERP, key, percent)) {
repl = percent;
}
else {
Modified: trunk/src/pmc/complex.pmc
==============================================================================
--- trunk/src/pmc/complex.pmc Sat Oct 2 22:23:59 2010 (r49415)
+++ trunk/src/pmc/complex.pmc Sat Oct 2 22:25:15 2010 (r49416)
@@ -501,10 +501,10 @@
VTABLE FLOATVAL get_number_keyed_str(STRING *key) {
FLOATVAL value;
- if (Parrot_str_equal(INTERP, key, CONST_STRING(INTERP, "real"))) {
+ if (STRING_equal(INTERP, key, CONST_STRING(INTERP, "real"))) {
GET_ATTR_re(INTERP, SELF, value);
}
- else if (Parrot_str_equal(INTERP, key, CONST_STRING(INTERP, "imag"))) {
+ else if (STRING_equal(INTERP, key, CONST_STRING(INTERP, "imag"))) {
GET_ATTR_im(INTERP, SELF, value);
}
else
@@ -687,10 +687,10 @@
}
VTABLE void set_number_keyed_str(STRING *key, FLOATVAL value) {
- if (Parrot_str_equal(INTERP, key, CONST_STRING(INTERP, "real"))) {
+ if (STRING_equal(INTERP, key, CONST_STRING(INTERP, "real"))) {
SET_ATTR_re(INTERP, SELF, value);
}
- else if (Parrot_str_equal(INTERP, key, CONST_STRING(INTERP, "imag"))) {
+ else if (STRING_equal(INTERP, key, CONST_STRING(INTERP, "imag"))) {
SET_ATTR_im(INTERP, SELF, value);
}
else
Modified: trunk/src/pmc/default.pmc
==============================================================================
--- trunk/src/pmc/default.pmc Sat Oct 2 22:23:59 2010 (r49415)
+++ trunk/src/pmc/default.pmc Sat Oct 2 22:25:15 2010 (r49416)
@@ -197,9 +197,9 @@
ASSERT_ARGS(check_set_std_props)
/*
- * s2 in Parrot_str_equal is freed here
+ * s2 in STRING_equal is freed here
*/
- if (Parrot_str_equal(interp, key, CONST_STRING(interp, "_ro"))) {
+ if (STRING_equal(interp, key, CONST_STRING(interp, "_ro"))) {
/* pmc should set/clear readonly */
const INTVAL on = VTABLE_get_bool(interp, value);
@@ -286,7 +286,7 @@
ASSERT_ARGS(check_get_std_props)
if ((self->vtable->flags & (VTABLE_IS_CONST_FLAG | VTABLE_IS_READONLY_FLAG))
- && Parrot_str_equal(interp, key, CONST_STRING(interp, "_ro"))) {
+ && STRING_equal(interp, key, CONST_STRING(interp, "_ro"))) {
PMC * const ret_val = Parrot_pmc_new_init_int(interp,
enum_class_Integer, 1);
return ret_val;
@@ -1003,7 +1003,7 @@
else {
const Hash * const isa_hash = SELF->vtable->isa_hash;
if (!isa_hash)
- return Parrot_str_equal(INTERP, SELF->vtable->whoami, _class);
+ return STRING_equal(INTERP, SELF->vtable->whoami, _class);
return parrot_hash_exists(INTERP, isa_hash, (void *)_class);
}
@@ -1020,12 +1020,12 @@
*/
VTABLE PMC *inspect_str(STRING *name) {
- if (Parrot_str_equal(INTERP, name, CONST_STRING(INTERP, "flags"))) {
+ if (STRING_equal(INTERP, name, CONST_STRING(INTERP, "flags"))) {
PMC *found = Parrot_pmc_new_init_int(INTERP, enum_class_Integer,
(INTVAL)PObj_get_FLAGS(SELF));
return found;
}
- else if (Parrot_str_equal(INTERP, name, CONST_STRING(INTERP, "mro"))) {
+ else if (STRING_equal(INTERP, name, CONST_STRING(INTERP, "mro"))) {
return VTABLE_clone(INTERP, SELF->vtable->mro);
}
else
Modified: trunk/src/pmc/eventhandler.pmc
==============================================================================
--- trunk/src/pmc/eventhandler.pmc Sat Oct 2 22:23:59 2010 (r49415)
+++ trunk/src/pmc/eventhandler.pmc Sat Oct 2 22:25:15 2010 (r49416)
@@ -217,7 +217,7 @@
Parrot_EventHandler_attributes * const e = PARROT_EVENTHANDLER(SELF);
PMC *value = PMCNULL;
- if (Parrot_str_equal(INTERP, name, CONST_STRING(INTERP, "code"))) {
+ if (STRING_equal(INTERP, name, CONST_STRING(INTERP, "code"))) {
value = e->code;
}
@@ -277,12 +277,12 @@
PMC * const type = VTABLE_get_attr_str(INTERP, event, CONST_STRING(INTERP, "type"));
STRING * const type_str = VTABLE_get_string(INTERP, type);
- if (Parrot_str_equal(INTERP, type_str, CONST_STRING(INTERP, "event"))) {
+ if (STRING_equal(INTERP, type_str, CONST_STRING(INTERP, "event"))) {
Parrot_EventHandler_attributes * const handler_struct = PARROT_EVENTHANDLER(SELF);
PMC * const subtype = VTABLE_get_attr_str(INTERP, event, CONST_STRING(INTERP, "subtype"));
STRING * const subtype_str = VTABLE_get_string(INTERP, subtype);
- if (Parrot_str_equal(INTERP, subtype_str, handler_struct->type)) {
+ if (STRING_equal(INTERP, subtype_str, handler_struct->type)) {
RETURN(INTVAL 1);
}
}
Modified: trunk/src/pmc/exception.pmc
==============================================================================
--- trunk/src/pmc/exception.pmc Sat Oct 2 22:23:59 2010 (r49415)
+++ trunk/src/pmc/exception.pmc Sat Oct 2 22:25:15 2010 (r49416)
@@ -287,7 +287,7 @@
STRING * const name = VTABLE_get_string(INTERP, key);
STRING *message;
- if (Parrot_str_equal(INTERP, name, CONST_STRING(INTERP, "message"))) {
+ if (STRING_equal(INTERP, name, CONST_STRING(INTERP, "message"))) {
message = SELF.get_string();
}
else {
@@ -421,7 +421,7 @@
VTABLE void set_string_keyed(PMC *key, STRING *value) {
STRING * const name = VTABLE_get_string(INTERP, key);
- if (Parrot_str_equal(INTERP, name, CONST_STRING(INTERP, "message"))) {
+ if (STRING_equal(INTERP, name, CONST_STRING(INTERP, "message"))) {
SELF.set_string_native(value);
}
else {
@@ -844,29 +844,29 @@
ASSERT_ARGS(getAttrEnum)
AttrEnum r;
- if (Parrot_str_equal(interp, name, CONST_STRING(interp, "birthtime")))
+ if (STRING_equal(interp, name, CONST_STRING(interp, "birthtime")))
r = attr_birthtime;
- else if (Parrot_str_equal(interp, name, CONST_STRING(interp, "message")))
+ else if (STRING_equal(interp, name, CONST_STRING(interp, "message")))
r = attr_message;
- else if (Parrot_str_equal(interp, name, CONST_STRING(interp, "payload")))
+ else if (STRING_equal(interp, name, CONST_STRING(interp, "payload")))
r = attr_payload;
- else if (Parrot_str_equal(interp, name, CONST_STRING(interp, "resume")))
+ else if (STRING_equal(interp, name, CONST_STRING(interp, "resume")))
r = attr_resume;
- else if (Parrot_str_equal(interp, name, CONST_STRING(interp, "severity")))
+ else if (STRING_equal(interp, name, CONST_STRING(interp, "severity")))
r = attr_severity;
- else if (Parrot_str_equal(interp, name, CONST_STRING(interp, "type")))
+ else if (STRING_equal(interp, name, CONST_STRING(interp, "type")))
r = attr_type;
- else if (Parrot_str_equal(interp, name, CONST_STRING(interp, "exit_code")))
+ else if (STRING_equal(interp, name, CONST_STRING(interp, "exit_code")))
r = attr_exit_code;
- else if (Parrot_str_equal(interp, name, CONST_STRING(interp, "backtrace")))
+ else if (STRING_equal(interp, name, CONST_STRING(interp, "backtrace")))
r = attr_backtrace;
- else if (Parrot_str_equal(interp, name, CONST_STRING(interp, "handled")))
+ else if (STRING_equal(interp, name, CONST_STRING(interp, "handled")))
r = attr_handled;
- else if (Parrot_str_equal(interp, name, CONST_STRING(interp, "handler_iter")))
+ else if (STRING_equal(interp, name, CONST_STRING(interp, "handler_iter")))
r = attr_handler_iter;
- else if (Parrot_str_equal(interp, name, CONST_STRING(interp, "handler_ctx")))
+ else if (STRING_equal(interp, name, CONST_STRING(interp, "handler_ctx")))
r = attr_handler_ctx;
- else if (Parrot_str_equal(interp, name, CONST_STRING(interp, "thrower")))
+ else if (STRING_equal(interp, name, CONST_STRING(interp, "thrower")))
r = attr_thrower;
else
r = attr_NONE;
Modified: trunk/src/pmc/filehandle.pmc
==============================================================================
--- trunk/src/pmc/filehandle.pmc Sat Oct 2 22:23:59 2010 (r49415)
+++ trunk/src/pmc/filehandle.pmc Sat Oct 2 22:25:15 2010 (r49416)
@@ -584,11 +584,11 @@
INTVAL flags;
if (got_type) {
- if (Parrot_str_equal(INTERP, new_type, nobuffer_string))
+ if (STRING_equal(INTERP, new_type, nobuffer_string))
Parrot_io_setbuf(INTERP, SELF, PIOCTL_NONBUF);
- else if (Parrot_str_equal(INTERP, new_type, linebuffer_string))
+ else if (STRING_equal(INTERP, new_type, linebuffer_string))
Parrot_io_setlinebuf(INTERP, SELF);
- else if (Parrot_str_equal(INTERP, new_type, fullbuffer_string))
+ else if (STRING_equal(INTERP, new_type, fullbuffer_string))
Parrot_io_setbuf(INTERP, SELF, PIO_UNBOUND);
}
Modified: trunk/src/pmc/fixedbooleanarray.pmc
==============================================================================
--- trunk/src/pmc/fixedbooleanarray.pmc Sat Oct 2 22:23:59 2010 (r49415)
+++ trunk/src/pmc/fixedbooleanarray.pmc Sat Oct 2 22:25:15 2010 (r49416)
@@ -274,7 +274,7 @@
VTABLE STRING *get_string() {
STRING *zero, *one;
- STRING *str = NULL;
+ STRING *str = STRINGNULL;
UINTVAL i;
UINTVAL elems = SELF.elements();
Modified: trunk/src/pmc/fixedstringarray.pmc
==============================================================================
--- trunk/src/pmc/fixedstringarray.pmc Sat Oct 2 22:23:59 2010 (r49415)
+++ trunk/src/pmc/fixedstringarray.pmc Sat Oct 2 22:25:15 2010 (r49416)
@@ -571,7 +571,7 @@
if (STRING_IS_NULL(item1) || STRING_IS_NULL(item2))
return 0;
- if (!Parrot_str_equal(INTERP, item1, item2))
+ if (!STRING_equal(INTERP, item1, item2))
return 0;
}
Modified: trunk/src/pmc/lexinfo.pmc
==============================================================================
--- trunk/src/pmc/lexinfo.pmc Sat Oct 2 22:23:59 2010 (r49415)
+++ trunk/src/pmc/lexinfo.pmc Sat Oct 2 22:25:15 2010 (r49416)
@@ -95,7 +95,7 @@
*/
VTABLE PMC *inspect_str(STRING *what) {
- if (Parrot_str_equal(INTERP, what, CONST_STRING(INTERP, "symbols"))) {
+ if (STRING_equal(INTERP, what, CONST_STRING(INTERP, "symbols"))) {
PMC * const result = Parrot_pmc_new(INTERP, enum_class_ResizableStringArray);
const Hash *hash = (Hash *)SELF.get_pointer();
Modified: trunk/src/pmc/namespace.pmc
==============================================================================
--- trunk/src/pmc/namespace.pmc Sat Oct 2 22:23:59 2010 (r49415)
+++ trunk/src/pmc/namespace.pmc Sat Oct 2 22:25:15 2010 (r49416)
@@ -182,7 +182,7 @@
if (sub->comp_flags & SUB_COMP_FLAG_METHOD) {
STRING *method_name = key;
- if (Parrot_str_equal(interp, sub->method_name, CONST_STRING(interp, ""))) {
+ if (STRING_equal(interp, sub->method_name, CONST_STRING(interp, ""))) {
if (sub->vtable_index != -1 && !STRING_IS_NULL(vtable_key)) {
method_name = vtable_key;
}
@@ -287,7 +287,7 @@
STRING *method_name = key;
Hash *hash;
- if (Parrot_str_not_equal(interp, sub->method_name, empty_str))
+ if (!STRING_equal(interp, sub->method_name, empty_str))
method_name = sub->method_name;
add_to_class(interp, nsinfo, classobj, method_name, value);
@@ -731,13 +731,13 @@
const Parrot_NameSpace_attributes * const nsinfo = PARROT_NAMESPACE(SELF);
PMC *found;
- if (Parrot_str_equal(INTERP, what, CONST_STRING(INTERP, "methods"))) {
+ if (STRING_equal(INTERP, what, CONST_STRING(INTERP, "methods"))) {
found = nsinfo->methods;
}
- else if (Parrot_str_equal(INTERP, what, CONST_STRING(INTERP, "vtable_overrides"))) {
+ else if (STRING_equal(INTERP, what, CONST_STRING(INTERP, "vtable_overrides"))) {
found = nsinfo->vtable;
}
- else if (Parrot_str_equal(INTERP, what, CONST_STRING(INTERP, "class"))) {
+ else if (STRING_equal(INTERP, what, CONST_STRING(INTERP, "class"))) {
found = nsinfo->_class;
}
else
Modified: trunk/src/pmc/object.pmc
==============================================================================
--- trunk/src/pmc/object.pmc Sat Oct 2 22:23:59 2010 (r49415)
+++ trunk/src/pmc/object.pmc Sat Oct 2 22:25:15 2010 (r49416)
@@ -678,7 +678,7 @@
VTABLE INTVAL isa(STRING *classname) {
if (SELF->vtable->whoami == classname
- || Parrot_str_equal(INTERP, SELF->vtable->whoami, classname))
+ || STRING_equal(INTERP, SELF->vtable->whoami, classname))
return 1;
else {
PMC *_class = PARROT_OBJECT(SELF)->_class;
Modified: trunk/src/pmc/packfile.pmc
==============================================================================
--- trunk/src/pmc/packfile.pmc Sat Oct 2 22:23:59 2010 (r49415)
+++ trunk/src/pmc/packfile.pmc Sat Oct 2 22:25:15 2010 (r49416)
@@ -316,7 +316,7 @@
*/
VTABLE STRING *get_string_keyed_str(STRING *key) {
- if (!Parrot_str_compare(INTERP, key, CONST_STRING(INTERP, "uuid")))
+ if (STRING_equal(INTERP, key, CONST_STRING(INTERP, "uuid")))
return PARROT_PACKFILE(SELF)->uuid;
Parrot_ex_throw_from_c_args(INTERP, NULL, EXCEPTION_KEY_NOT_FOUND,
@@ -431,7 +431,7 @@
*/
VTABLE void set_string_keyed_str(STRING *key, STRING *value) {
- if (!Parrot_str_compare(INTERP, key, CONST_STRING(INTERP, "uuid"))) {
+ if (STRING_equal(INTERP, key, CONST_STRING(INTERP, "uuid"))) {
PARROT_PACKFILE(SELF)->uuid = value;
return;
}
@@ -532,23 +532,23 @@
ASSERT_ARGS(getAttrEnum)
AttrEnumPackfile r;
- if (Parrot_str_equal(interp, name, CONST_STRING(interp, "wordsize")))
+ if (STRING_equal(interp, name, CONST_STRING(interp, "wordsize")))
r = attr_wordsize;
- else if (Parrot_str_equal(interp, name, CONST_STRING(interp, "byteorder")))
+ else if (STRING_equal(interp, name, CONST_STRING(interp, "byteorder")))
r = attr_byteorder;
- else if (Parrot_str_equal(interp, name, CONST_STRING(interp, "fptype")))
+ else if (STRING_equal(interp, name, CONST_STRING(interp, "fptype")))
r = attr_fptype;
- else if (Parrot_str_equal(interp, name, CONST_STRING(interp, "version_major")))
+ else if (STRING_equal(interp, name, CONST_STRING(interp, "version_major")))
r = attr_version_major;
- else if (Parrot_str_equal(interp, name, CONST_STRING(interp, "version_minor")))
+ else if (STRING_equal(interp, name, CONST_STRING(interp, "version_minor")))
r = attr_version_minor;
- else if (Parrot_str_equal(interp, name, CONST_STRING(interp, "version_patch")))
+ else if (STRING_equal(interp, name, CONST_STRING(interp, "version_patch")))
r = attr_version_patch;
- else if (Parrot_str_equal(interp, name, CONST_STRING(interp, "bytecode_major")))
+ else if (STRING_equal(interp, name, CONST_STRING(interp, "bytecode_major")))
r = attr_bytecode_major;
- else if (Parrot_str_equal(interp, name, CONST_STRING(interp, "bytecode_minor")))
+ else if (STRING_equal(interp, name, CONST_STRING(interp, "bytecode_minor")))
r = attr_bytecode_minor;
- else if (Parrot_str_equal(interp, name, CONST_STRING(interp, "uuid_type")))
+ else if (STRING_equal(interp, name, CONST_STRING(interp, "uuid_type")))
r = attr_uuid_type;
else
r = attr_NONE;
Modified: trunk/src/pmc/packfileconstanttable.pmc
==============================================================================
--- trunk/src/pmc/packfileconstanttable.pmc Sat Oct 2 22:23:59 2010 (r49415)
+++ trunk/src/pmc/packfileconstanttable.pmc Sat Oct 2 22:25:15 2010 (r49416)
@@ -318,7 +318,7 @@
for (i=0; i < num; ++i) {
STRING * const str = VTABLE_get_string_keyed_int(INTERP, attrs->str_constants, i);
- if (Parrot_str_equal(INTERP, value, str))
+ if (STRING_equal(INTERP, value, str))
return i;
}
Modified: trunk/src/pmc/parrotinterpreter.pmc
==============================================================================
--- trunk/src/pmc/parrotinterpreter.pmc Sat Oct 2 22:23:59 2010 (r49415)
+++ trunk/src/pmc/parrotinterpreter.pmc Sat Oct 2 22:25:15 2010 (r49416)
@@ -465,12 +465,12 @@
PMC *ctx;
- if (Parrot_str_equal(INTERP, item, name))
+ if (STRING_equal(INTERP, item, name))
return INTERP->root_namespace;
name = CONST_STRING(INTERP, "outer");
- if (Parrot_str_equal(INTERP, item, name)) {
+ if (STRING_equal(INTERP, item, name)) {
outer = item;
nextkey = key_next(INTERP, key);
@@ -522,32 +522,32 @@
name = CONST_STRING(INTERP, "context");
- if (Parrot_str_equal(INTERP, item, name))
+ if (STRING_equal(INTERP, item, name))
return ctx;
name = CONST_STRING(INTERP, "sub");
- if (Parrot_str_equal(INTERP, item, name))
+ if (STRING_equal(INTERP, item, name))
return Parrot_pcc_get_sub(INTERP, ctx);
name = CONST_STRING(INTERP, "lexpad");
- if (Parrot_str_equal(INTERP, item, name))
+ if (STRING_equal(INTERP, item, name))
return Parrot_pcc_get_lex_pad(INTERP, ctx);
name = CONST_STRING(INTERP, "namespace");
- if (Parrot_str_equal(INTERP, item, name))
+ if (STRING_equal(INTERP, item, name))
return Parrot_pcc_get_namespace(INTERP, ctx);
name = CONST_STRING(INTERP, "continuation");
- if (Parrot_str_equal(INTERP, item, name))
+ if (STRING_equal(INTERP, item, name))
return VTABLE_clone(INTERP, Parrot_pcc_get_continuation(INTERP, ctx));
name = CONST_STRING(INTERP, "annotations");
- if (Parrot_str_equal(INTERP, item, name)) {
+ if (STRING_equal(INTERP, item, name)) {
PMC *sub_pmc = Parrot_pcc_get_sub(INTERP, ctx);
if (ctx == CURRENT_CONTEXT(INTERP)) {
/* We can't know the current program counter for the currently
Modified: trunk/src/pmc/pmcproxy.pmc
==============================================================================
--- trunk/src/pmc/pmcproxy.pmc Sat Oct 2 22:23:59 2010 (r49415)
+++ trunk/src/pmc/pmcproxy.pmc Sat Oct 2 22:25:15 2010 (r49416)
@@ -119,7 +119,7 @@
PMC *pclass = VTABLE_get_pmc_keyed_int(INTERP, INTERP->vtables[type_num]->mro, i);
PMC *cns = pclass->vtable->_namespace;
STRING *cname = pclass->vtable->whoami;
- if (Parrot_str_not_equal(INTERP, cname, CONST_STRING(INTERP, "scalar"))) {
+ if (!STRING_equal(INTERP, cname, CONST_STRING(INTERP, "scalar"))) {
PMC *pproxy = Parrot_oo_get_class(INTERP, cns);
VTABLE_push_pmc(INTERP, proxy_info->all_parents, pproxy);
}
@@ -217,7 +217,7 @@
classname = VTABLE_get_string(INTERP, classobj);
/* Check if the passed name is the same as the stored short name. */
- if (Parrot_str_equal(INTERP, classname, _proxy->name))
+ if (STRING_equal(INTERP, classname, _proxy->name))
return 1;
/* Check if the class object is the same as self's class object */
@@ -225,7 +225,7 @@
return 1;
/* Check if the passed name is the same as the fully qualified name. */
- if (Parrot_str_equal(INTERP, classname, VTABLE_get_string(INTERP, SELF)))
+ if (STRING_equal(INTERP, classname, VTABLE_get_string(INTERP, SELF)))
return 1;
/* Look in the isa hash. */
@@ -265,7 +265,7 @@
Parrot_Class_attributes * const _proxy = PARROT_CLASS(SELF);
const STRING * const pmc_proxy = CONST_STRING(INTERP, "PMCProxy");
- if (Parrot_str_equal(INTERP, classname, pmc_proxy))
+ if (STRING_equal(INTERP, classname, pmc_proxy))
return 1;
if (SUPER(classname))
@@ -275,7 +275,7 @@
if (INTERP->vtables[_proxy->id]) {
Hash *isa_hash = INTERP->vtables[_proxy->id]->isa_hash;
- if (!isa_hash && Parrot_str_equal(INTERP,
+ if (!isa_hash && STRING_equal(INTERP,
INTERP->vtables[_proxy->id]->whoami, classname)) {
return 1;
}
Modified: trunk/src/pmc/role.pmc
==============================================================================
--- trunk/src/pmc/role.pmc Sat Oct 2 22:23:59 2010 (r49415)
+++ trunk/src/pmc/role.pmc Sat Oct 2 22:25:15 2010 (r49416)
@@ -416,21 +416,21 @@
/* What should we return? */
PMC *found;
- if (Parrot_str_equal(INTERP, what, CONST_STRING(INTERP, "name"))) {
+ if (STRING_equal(INTERP, what, CONST_STRING(INTERP, "name"))) {
found = Parrot_pmc_new(INTERP, enum_class_String);
VTABLE_set_string_native(INTERP, found, role->name);
}
- else if (Parrot_str_equal(INTERP, what, CONST_STRING(INTERP, "namespace"))) {
+ else if (STRING_equal(INTERP, what, CONST_STRING(INTERP, "namespace"))) {
/* Don't clone the namespace, as it's not part of our state. */
return role->_namespace;
}
- else if (Parrot_str_equal(INTERP, what, CONST_STRING(INTERP, "attributes"))) {
+ else if (STRING_equal(INTERP, what, CONST_STRING(INTERP, "attributes"))) {
found = role->attrib_metadata;
}
- else if (Parrot_str_equal(INTERP, what, CONST_STRING(INTERP, "methods"))) {
+ else if (STRING_equal(INTERP, what, CONST_STRING(INTERP, "methods"))) {
found = role->methods;
}
- else if (Parrot_str_equal(INTERP, what, CONST_STRING(INTERP, "roles"))) {
+ else if (STRING_equal(INTERP, what, CONST_STRING(INTERP, "roles"))) {
found = role->roles;
}
else {
@@ -541,7 +541,7 @@
Parrot_Role_attributes * const role = PARROT_ROLE(SELF);
INTVAL i, count;
- if (Parrot_str_equal(INTERP, role->name, role_name))
+ if (STRING_equal(INTERP, role->name, role_name))
return 1;
count = VTABLE_elements(INTERP, role->roles);
Modified: trunk/src/pmc/scalar.pmc
==============================================================================
--- trunk/src/pmc/scalar.pmc Sat Oct 2 22:23:59 2010 (r49415)
+++ trunk/src/pmc/scalar.pmc Sat Oct 2 22:25:15 2010 (r49416)
@@ -800,7 +800,7 @@
*/
MULTI INTVAL is_equal_string(PMC *value) {
- return (0 != Parrot_str_equal(INTERP, VTABLE_get_string(INTERP, SELF),
+ return (0 != STRING_equal(INTERP, VTABLE_get_string(INTERP, SELF),
VTABLE_get_string(INTERP, value)));
}
Modified: trunk/src/pmc/scheduler.pmc
==============================================================================
--- trunk/src/pmc/scheduler.pmc Sat Oct 2 22:23:59 2010 (r49415)
+++ trunk/src/pmc/scheduler.pmc Sat Oct 2 22:25:15 2010 (r49416)
@@ -420,12 +420,12 @@
for (index = 0; index < elements; ++index) {
const PMC * const handler = VTABLE_get_pmc_keyed_int(INTERP, handlers, index);
if (!PMC_IS_NULL(handler)) {
- if (Parrot_str_equal(INTERP, type, except_str)
+ if (STRING_equal(INTERP, type, except_str)
&& handler->vtable->base_type == enum_class_ExceptionHandler) {
VTABLE_set_pmc_keyed_int(INTERP, handlers, index, PMCNULL);
RETURN(void);
}
- else if (Parrot_str_equal(INTERP, type, event_str)
+ else if (STRING_equal(INTERP, type, event_str)
&& handler->vtable->base_type == enum_class_EventHandler) {
VTABLE_set_pmc_keyed_int(INTERP, handlers, index, PMCNULL);
RETURN(void);
@@ -520,9 +520,9 @@
STRING * const event = CONST_STRING(INTERP, "event");
if (!PMC_IS_NULL(handler)) {
- if ((Parrot_str_equal(INTERP, type, exception)
+ if ((STRING_equal(INTERP, type, exception)
&& handler->vtable->base_type == enum_class_ExceptionHandler)
- || (Parrot_str_equal(INTERP, type, event)
+ || (STRING_equal(INTERP, type, event)
&& handler->vtable->base_type == enum_class_EventHandler))
++count;
}
Modified: trunk/src/pmc/string.pmc
==============================================================================
--- trunk/src/pmc/string.pmc Sat Oct 2 22:23:59 2010 (r49415)
+++ trunk/src/pmc/string.pmc Sat Oct 2 22:25:15 2010 (r49416)
@@ -243,7 +243,7 @@
STRING *str_val;
STRING * const v = VTABLE_get_string(INTERP, value);
GET_ATTR_str_val(INTERP, SELF, str_val);
- return (INTVAL)(Parrot_str_equal(INTERP, str_val, v));
+ return (INTVAL)(STRING_equal(INTERP, str_val, v));
}
MULTI INTVAL is_equal(PMC *value) {
@@ -286,7 +286,7 @@
STRING *str_val;
STRING * const v = VTABLE_get_string(INTERP, value);
GET_ATTR_str_val(INTERP, SELF, str_val);
- return Parrot_str_equal(INTERP, str_val, v);
+ return STRING_equal(INTERP, str_val, v);
}
/*
Modified: trunk/src/pmc/stringbuilder.pmc
==============================================================================
--- trunk/src/pmc/stringbuilder.pmc Sat Oct 2 22:23:59 2010 (r49415)
+++ trunk/src/pmc/stringbuilder.pmc Sat Oct 2 22:25:15 2010 (r49416)
@@ -394,7 +394,7 @@
VTABLE_get_string_keyed_int(INTERP, args,
Parrot_str_to_int(INTERP, key)));
}
- else if (Parrot_str_equal(INTERP, key, comma)) {
+ else if (STRING_equal(INTERP, key, comma)) {
INTVAL num_args = VTABLE_elements(INTERP, args);
INTVAL pos_args;
@@ -405,7 +405,7 @@
VTABLE_get_string_keyed_int(INTERP, args, pos_args));
}
}
- else if (Parrot_str_equal(INTERP, key, percent)) {
+ else if (STRING_equal(INTERP, key, percent)) {
VTABLE_push_string(INTERP, stringbuilder, percent);
}
else {
Modified: trunk/src/pmc/stringhandle.pmc
==============================================================================
--- trunk/src/pmc/stringhandle.pmc Sat Oct 2 22:23:59 2010 (r49415)
+++ trunk/src/pmc/stringhandle.pmc Sat Oct 2 22:25:15 2010 (r49416)
@@ -55,7 +55,7 @@
if (STRING_IS_NULL(s))
return 0;
else
- return Parrot_str_equal(interp, s, CONST_STRING(interp, "utf8"));
+ return STRING_equal(interp, s, CONST_STRING(interp, "utf8"));
}
pmclass StringHandle extends Handle auto_attrs {
@@ -391,15 +391,15 @@
GET_ATTR_flags(INTERP, SELF, flags);
if (got_type) {
- if (Parrot_str_equal(INTERP, new_type, nobuffer_string)) {
+ if (STRING_equal(INTERP, new_type, nobuffer_string)) {
flags &= ~ PIO_F_LINEBUF;
flags &= ~ PIO_F_BLKBUF;
}
- else if (Parrot_str_equal(INTERP, new_type, linebuffer_string)) {
+ else if (STRING_equal(INTERP, new_type, linebuffer_string)) {
flags |= PIO_F_LINEBUF;
flags &= ~ PIO_F_BLKBUF;
}
- else if (Parrot_str_equal(INTERP, new_type, fullbuffer_string)) {
+ else if (STRING_equal(INTERP, new_type, fullbuffer_string)) {
flags &= ~ PIO_F_LINEBUF;
flags |= PIO_F_BLKBUF;
}
Modified: trunk/src/pmc/sub.pmc
==============================================================================
--- trunk/src/pmc/sub.pmc Sat Oct 2 22:23:59 2010 (r49415)
+++ trunk/src/pmc/sub.pmc Sat Oct 2 22:25:15 2010 (r49416)
@@ -908,22 +908,22 @@
}
/* Return the requested argument information */
- if (Parrot_str_equal(INTERP, what, CONST_STRING(INTERP, "pos_required"))) {
+ if (STRING_equal(INTERP, what, CONST_STRING(INTERP, "pos_required"))) {
count_found = (INTVAL)sub->arg_info->pos_required;
}
- else if (Parrot_str_equal(INTERP, what, CONST_STRING(INTERP, "pos_optional"))) {
+ else if (STRING_equal(INTERP, what, CONST_STRING(INTERP, "pos_optional"))) {
count_found = (INTVAL)sub->arg_info->pos_optional;
}
- else if (Parrot_str_equal(INTERP, what, CONST_STRING(INTERP, "pos_slurpy"))) {
+ else if (STRING_equal(INTERP, what, CONST_STRING(INTERP, "pos_slurpy"))) {
count_found = (INTVAL)sub->arg_info->pos_slurpy;
}
- else if (Parrot_str_equal(INTERP, what, CONST_STRING(INTERP, "named_required"))) {
+ else if (STRING_equal(INTERP, what, CONST_STRING(INTERP, "named_required"))) {
count_found = (INTVAL)sub->arg_info->named_required;
}
- else if (Parrot_str_equal(INTERP, what, CONST_STRING(INTERP, "named_optional"))) {
+ else if (STRING_equal(INTERP, what, CONST_STRING(INTERP, "named_optional"))) {
count_found = (INTVAL)sub->arg_info->named_optional;
}
- else if (Parrot_str_equal(INTERP, what, CONST_STRING(INTERP, "named_slurpy"))) {
+ else if (STRING_equal(INTERP, what, CONST_STRING(INTERP, "named_slurpy"))) {
count_found = (INTVAL)sub->arg_info->named_slurpy;
}
else
Modified: trunk/src/pmc/task.pmc
==============================================================================
--- trunk/src/pmc/task.pmc Sat Oct 2 22:23:59 2010 (r49415)
+++ trunk/src/pmc/task.pmc Sat Oct 2 22:25:15 2010 (r49416)
@@ -209,27 +209,27 @@
Parrot_Task_attributes * const core_struct = PARROT_TASK(SELF);
PMC *value;
- if (Parrot_str_equal(INTERP, name, CONST_STRING(INTERP, "id"))) {
+ if (STRING_equal(INTERP, name, CONST_STRING(INTERP, "id"))) {
value = Parrot_pmc_new_init_int(INTERP, enum_class_Integer,
core_struct->id);
}
- else if (Parrot_str_equal(INTERP, name, CONST_STRING(INTERP, "type"))) {
+ else if (STRING_equal(INTERP, name, CONST_STRING(INTERP, "type"))) {
value = Parrot_pmc_new(INTERP, enum_class_String);
VTABLE_set_string_native(INTERP, value, core_struct->type);
}
- else if (Parrot_str_equal(INTERP, name, CONST_STRING(INTERP, "subtype"))) {
+ else if (STRING_equal(INTERP, name, CONST_STRING(INTERP, "subtype"))) {
value = Parrot_pmc_new(INTERP, enum_class_String);
VTABLE_set_string_native(INTERP, value, core_struct->subtype);
}
- else if (Parrot_str_equal(INTERP, name, CONST_STRING(INTERP, "priority"))) {
+ else if (STRING_equal(INTERP, name, CONST_STRING(INTERP, "priority"))) {
value = Parrot_pmc_new_init_int(INTERP, enum_class_Integer,
core_struct->priority);
}
- else if (Parrot_str_equal(INTERP, name, CONST_STRING(INTERP, "status"))) {
+ else if (STRING_equal(INTERP, name, CONST_STRING(INTERP, "status"))) {
value = Parrot_pmc_new(INTERP, enum_class_String);
VTABLE_set_string_native(INTERP, value, core_struct->status);
}
- else if (Parrot_str_equal(INTERP, name, CONST_STRING(INTERP, "birthtime"))) {
+ else if (STRING_equal(INTERP, name, CONST_STRING(INTERP, "birthtime"))) {
value = Parrot_pmc_new(INTERP, enum_class_Float);
VTABLE_set_number_native(INTERP, value, core_struct->birthtime);
}
@@ -252,28 +252,28 @@
VTABLE void set_attr_str(STRING *name, PMC *value) {
Parrot_Task_attributes * const core_struct = PARROT_TASK(SELF);
- if (Parrot_str_equal(INTERP, name, CONST_STRING(INTERP, "id"))) {
+ if (STRING_equal(INTERP, name, CONST_STRING(INTERP, "id"))) {
core_struct->id = VTABLE_get_integer(INTERP, value);
}
- else if (Parrot_str_equal(INTERP, name, CONST_STRING(INTERP, "type"))) {
+ else if (STRING_equal(INTERP, name, CONST_STRING(INTERP, "type"))) {
core_struct->type = VTABLE_get_string(INTERP, value);
}
- else if (Parrot_str_equal(INTERP, name, CONST_STRING(INTERP, "subtype"))) {
+ else if (STRING_equal(INTERP, name, CONST_STRING(INTERP, "subtype"))) {
core_struct->subtype = VTABLE_get_string(INTERP, value);
}
- else if (Parrot_str_equal(INTERP, name, CONST_STRING(INTERP, "priority"))) {
+ else if (STRING_equal(INTERP, name, CONST_STRING(INTERP, "priority"))) {
core_struct->priority = VTABLE_get_integer(INTERP, value);
}
- else if (Parrot_str_equal(INTERP, name, CONST_STRING(INTERP, "status"))) {
+ else if (STRING_equal(INTERP, name, CONST_STRING(INTERP, "status"))) {
core_struct->status = VTABLE_get_string(INTERP, value);
}
- else if (Parrot_str_equal(INTERP, name, CONST_STRING(INTERP, "birthtime"))) {
+ else if (STRING_equal(INTERP, name, CONST_STRING(INTERP, "birthtime"))) {
core_struct->birthtime = VTABLE_get_number(INTERP, value);
}
- else if (Parrot_str_equal(INTERP, name, CONST_STRING(INTERP, "code"))) {
+ else if (STRING_equal(INTERP, name, CONST_STRING(INTERP, "code"))) {
core_struct->codeblock = value;
}
- else if (Parrot_str_equal(INTERP, name, CONST_STRING(INTERP, "data"))) {
+ else if (STRING_equal(INTERP, name, CONST_STRING(INTERP, "data"))) {
core_struct->data = value;
}
}
Modified: trunk/src/runcore/main.c
==============================================================================
--- trunk/src/runcore/main.c Sat Oct 2 22:23:59 2010 (r49415)
+++ trunk/src/runcore/main.c Sat Oct 2 22:25:15 2010 (r49416)
@@ -127,11 +127,11 @@
size_t i;
if (interp->run_core
- && Parrot_str_equal(interp, name, interp->run_core->name))
+ && STRING_equal(interp, name, interp->run_core->name))
return;
for (i = 0; i < num_cores; ++i) {
- if (Parrot_str_equal(interp, name, interp->cores[i]->name)) {
+ if (STRING_equal(interp, name, interp->cores[i]->name)) {
interp->run_core = interp->cores[i];
return;
}
Modified: trunk/src/runcore/profiling.c
==============================================================================
--- trunk/src/runcore/profiling.c Sat Oct 2 22:23:59 2010 (r49415)
+++ trunk/src/runcore/profiling.c Sat Oct 2 22:25:15 2010 (r49416)
@@ -169,10 +169,10 @@
if (output_cstr) {
STRING *profile_format_str = Parrot_str_new(interp, output_cstr, 0);
- if (Parrot_str_equal(interp, profile_format_str, CONST_STRING(interp, "pprof"))) {
+ if (STRING_equal(interp, profile_format_str, CONST_STRING(interp, "pprof"))) {
runcore->output_fn = record_values_ascii_pprof;
}
- else if (Parrot_str_equal(interp, profile_format_str, CONST_STRING(interp, "none"))) {
+ else if (STRING_equal(interp, profile_format_str, CONST_STRING(interp, "none"))) {
runcore->output_fn = record_values_none;
}
else {
@@ -197,11 +197,11 @@
profile_filename = Parrot_str_to_cstring(interp, runcore->profile_filename);
lc_filename = Parrot_str_downcase(interp, runcore->profile_filename);
- if (Parrot_str_equal(interp, lc_filename, CONST_STRING(interp, "stderr"))) {
+ if (STRING_equal(interp, lc_filename, CONST_STRING(interp, "stderr"))) {
runcore->profile_fd = stderr;
runcore->profile_filename = lc_filename;
}
- else if (Parrot_str_equal(interp, lc_filename, CONST_STRING(interp, "stdout"))) {
+ else if (STRING_equal(interp, lc_filename, CONST_STRING(interp, "stdout"))) {
runcore->profile_fd = stdout;
runcore->profile_filename = lc_filename;
}
Modified: trunk/src/scheduler.c
==============================================================================
--- trunk/src/scheduler.c Sat Oct 2 22:23:59 2010 (r49415)
+++ trunk/src/scheduler.c Sat Oct 2 22:25:15 2010 (r49416)
@@ -137,13 +137,13 @@
PMC * const type_pmc = VTABLE_get_attr_str(interp, task, CONST_STRING(interp, "type"));
STRING * const type = VTABLE_get_string(interp, type_pmc);
- if (Parrot_str_equal(interp, type, CONST_STRING(interp, "callback"))) {
+ if (STRING_equal(interp, type, CONST_STRING(interp, "callback"))) {
Parrot_cx_invoke_callback(interp, task);
}
- else if (Parrot_str_equal(interp, type, CONST_STRING(interp, "timer"))) {
+ else if (STRING_equal(interp, type, CONST_STRING(interp, "timer"))) {
Parrot_cx_timer_invoke(interp, task);
}
- else if (Parrot_str_equal(interp, type, CONST_STRING(interp, "event"))) {
+ else if (STRING_equal(interp, type, CONST_STRING(interp, "event"))) {
PMC * const handler = Parrot_cx_find_handler_for_task(interp, task);
if (!PMC_IS_NULL(handler)) {
PMC * const handler_sub = VTABLE_get_attr_str(interp, handler, CONST_STRING(interp, "code"));
@@ -455,7 +455,7 @@
for (index = 0; index < num_tasks; ++index) {
PMC *message = VTABLE_get_pmc_keyed_int(interp, sched_struct->messages, index);
if (!PMC_IS_NULL(message)
- && Parrot_str_equal(interp, VTABLE_get_string(interp, message),
+ && STRING_equal(interp, VTABLE_get_string(interp, message),
suspend_str)) {
VTABLE_delete_keyed_int(interp, sched_struct->messages, index);
UNLOCK(sched_struct->msg_lock);
@@ -533,9 +533,9 @@
typedef enum { Hunknown, Hexception, Hevent } Htype;
const Htype htype =
- Parrot_str_equal(interp, handler_type, exception_str) ?
+ STRING_equal(interp, handler_type, exception_str) ?
Hexception :
- Parrot_str_equal(interp, handler_type, event_str) ?
+ STRING_equal(interp, handler_type, event_str) ?
Hevent :
Hunknown;
STRING * const handler_name = (htype == Hexception) ? handler_str : (STRING *)NULL;
@@ -606,9 +606,9 @@
typedef enum { Hunknown, Hexception, Hevent } Htype;
const Htype htype =
- (Parrot_str_equal(interp, handler_type, exception_str)) ?
+ (STRING_equal(interp, handler_type, exception_str)) ?
Hexception :
- (Parrot_str_equal(interp, handler_type, event_str)) ?
+ (STRING_equal(interp, handler_type, event_str)) ?
Hevent :
Hunknown;
STRING * const handler_name = (htype == Hexception) ? handler_str : (STRING *)NULL;
@@ -1132,7 +1132,7 @@
#endif
UNLOCK(sched_struct->msg_lock);
if (!PMC_IS_NULL(message)
- && Parrot_str_equal(interp, VTABLE_get_string(interp, message),
+ && STRING_equal(interp, VTABLE_get_string(interp, message),
suspend_str)) {
#if CX_DEBUG
fprintf(stderr, "found a suspend, suspending [interp=%p]\n", interp);
Modified: trunk/src/string/api.c
==============================================================================
--- trunk/src/string/api.c Sat Oct 2 22:23:59 2010 (r49415)
+++ trunk/src/string/api.c Sat Oct 2 22:25:15 2010 (r49416)
@@ -569,7 +569,7 @@
result->strstart = (char *)Buffer_bufstart(result);
result->bufused = len;
result->strlen = len;
- result->encoding = Parrot_binary_encoding_ptr;
+ result->encoding = Parrot_binary_encoding_ptr;
Buffer_buflen(buffer) = 0;
Buffer_bufstart(buffer) = NULL;
@@ -1315,7 +1315,11 @@
Parrot_str_not_equal(PARROT_INTERP, ARGIN_NULLOK(const STRING *s1), ARGIN_NULLOK(const STRING *s2))
{
ASSERT_ARGS(Parrot_str_not_equal)
- return !Parrot_str_equal(interp, s1, s2);
+
+ if (s1 == NULL)
+ s1 = STRINGNULL;
+
+ return !STRING_equal(interp, s1, s2);
}
@@ -1325,10 +1329,12 @@
*s2)>
Compares two Parrot strings, performing type and encoding conversions if
-necessary.
+necessary. The null string is considered equal to the empty string.
Returns 1 if the strings are equal, and 0 otherwise.
+Identical to the STRING_equal macro.
+
=cut
*/
@@ -1339,22 +1345,11 @@
Parrot_str_equal(PARROT_INTERP, ARGIN_NULLOK(const STRING *s1), ARGIN_NULLOK(const STRING *s2))
{
ASSERT_ARGS(Parrot_str_equal)
- UINTVAL len1 = STRING_length(s1);
- UINTVAL len2 = STRING_length(s2);
- if (len1 == 0)
- return len2 == 0;
- else if (len2 == 0)
- return 0;
-
- if (s1 == s2)
- return 1;
-
- if (s1->strlen != s2->strlen
- || (s1->hashval && s2->hashval && s1->hashval != s2->hashval))
- return 0;
+ if (s1 == NULL)
+ s1 = STRINGNULL;
- return STRING_compare(interp, s1, s2) == 0;
+ return STRING_equal(interp, s1, s2);
}
@@ -2004,13 +1999,13 @@
/* charpos <= 2 because for "-i" iter already advanced to next char */
if (check_nan && (iter.charpos <= 2)) {
STRING *t = Parrot_str_upcase(interp, s);
- if (Parrot_str_equal(interp, t, CONST_STRING(interp, "NAN")))
+ if (STRING_equal(interp, t, CONST_STRING(interp, "NAN")))
return PARROT_FLOATVAL_NAN_QUIET;
- else if (Parrot_str_equal(interp, t, CONST_STRING(interp, "INF"))
- || Parrot_str_equal(interp, t, CONST_STRING(interp, "INFINITY")))
+ else if (STRING_equal(interp, t, CONST_STRING(interp, "INF"))
+ || STRING_equal(interp, t, CONST_STRING(interp, "INFINITY")))
return PARROT_FLOATVAL_INF_POSITIVE;
- else if (Parrot_str_equal(interp, t, CONST_STRING(interp, "-INF"))
- || Parrot_str_equal(interp, t, CONST_STRING(interp, "-INFINITY")))
+ else if (STRING_equal(interp, t, CONST_STRING(interp, "-INF"))
+ || STRING_equal(interp, t, CONST_STRING(interp, "-INFINITY")))
return PARROT_FLOATVAL_INF_NEGATIVE;
}
Modified: trunk/src/string/encoding.c
==============================================================================
--- trunk/src/string/encoding.c Sat Oct 2 22:23:59 2010 (r49415)
+++ trunk/src/string/encoding.c Sat Oct 2 22:25:15 2010 (r49416)
@@ -163,18 +163,18 @@
int i;
for (i = 0; i < n; ++i) {
- if (Parrot_str_equal(interp, encodings[i]->name_str, encodingname))
+ if (STRING_equal(interp, encodings[i]->name_str, encodingname))
return i;
}
/* backwards compatibility */
- if (Parrot_str_equal(interp, encodingname, unicode_str)) {
+ if (STRING_equal(interp, encodingname, unicode_str)) {
for (i = 0; i < n; ++i) {
if (STREQ(encodings[i]->name, "utf8"))
return i;
}
}
- else if (Parrot_str_equal(interp, encodingname, fixed_8_str)) {
+ else if (STRING_equal(interp, encodingname, fixed_8_str)) {
for (i = 0; i < n; ++i) {
if (STREQ(encodings[i]->name, "ascii"))
return i;
Modified: trunk/src/sub.c
==============================================================================
--- trunk/src/sub.c Sat Oct 2 22:23:59 2010 (r49415)
+++ trunk/src/sub.c Sat Oct 2 22:25:15 2010 (r49416)
@@ -422,7 +422,7 @@
if (!PMC_IS_NULL(child_sub->outer_sub)) {
PMC_get_sub(interp, child_sub->outer_sub, child_outer_sub);
- if (Parrot_str_equal(interp, current_sub->subid,
+ if (STRING_equal(interp, current_sub->subid,
child_outer_sub->subid)) {
child_sub->outer_ctx = ctx;
}
More information about the parrot-commits
mailing list