[svn:parrot] r45902 - branches/string_consting/src
bacek at svn.parrot.org
bacek at svn.parrot.org
Thu Apr 22 11:33:57 UTC 2010
Author: bacek
Date: Thu Apr 22 11:33:57 2010
New Revision: 45902
URL: https://trac.parrot.org/parrot/changeset/45902
Log:
Consting extent/embed functions
Modified:
branches/string_consting/src/dynext.c
branches/string_consting/src/embed.c
branches/string_consting/src/extend.c
Modified: branches/string_consting/src/dynext.c
==============================================================================
--- branches/string_consting/src/dynext.c Thu Apr 22 11:33:44 2010 (r45901)
+++ branches/string_consting/src/dynext.c Thu Apr 22 11:33:57 2010 (r45902)
@@ -44,18 +44,18 @@
PARROT_CAN_RETURN_NULL
static void * dlopen_string(PARROT_INTERP,
Parrot_dlopen_flags flags,
- ARGIN(STRING *path))
+ ARGIN(const STRING *path))
__attribute__nonnull__(1)
__attribute__nonnull__(3);
PARROT_WARN_UNUSED_RESULT
PARROT_CAN_RETURN_NULL
-static STRING * get_path(PARROT_INTERP,
- ARGMOD_NULLOK(STRING *lib),
+static const STRING * get_path(PARROT_INTERP,
+ ARGMOD_NULLOK(const STRING *lib),
Parrot_dlopen_flags flags,
ARGOUT(void **handle),
- ARGIN(STRING *wo_ext),
- ARGIN_NULLOK(STRING *ext))
+ ARGIN(const STRING *wo_ext),
+ ARGIN_NULLOK(const STRING *ext))
__attribute__nonnull__(1)
__attribute__nonnull__(4)
__attribute__nonnull__(5)
@@ -64,7 +64,7 @@
PARROT_WARN_UNUSED_RESULT
PARROT_CAN_RETURN_NULL
-static PMC* is_loaded(PARROT_INTERP, ARGIN(STRING *path))
+static PMC* is_loaded(PARROT_INTERP, ARGIN(const STRING *path))
__attribute__nonnull__(1)
__attribute__nonnull__(2);
@@ -77,8 +77,8 @@
PARROT_CANNOT_RETURN_NULL
static PMC * run_init_lib(PARROT_INTERP,
ARGIN(void *handle),
- ARGIN_NULLOK(STRING *lib_name),
- ARGIN(STRING *wo_ext))
+ ARGIN_NULLOK(const STRING *lib_name),
+ ARGIN(const STRING *wo_ext))
__attribute__nonnull__(1)
__attribute__nonnull__(2)
__attribute__nonnull__(4);
@@ -86,7 +86,7 @@
static void set_cstring_prop(PARROT_INTERP,
ARGMOD(PMC *lib_pmc),
ARGIN(const char *what),
- ARGIN(STRING *name))
+ ARGIN(const STRING *name))
__attribute__nonnull__(1)
__attribute__nonnull__(2)
__attribute__nonnull__(3)
@@ -95,9 +95,9 @@
static void store_lib_pmc(PARROT_INTERP,
ARGIN(PMC *lib_pmc),
- ARGIN(STRING *path),
- ARGIN(STRING *type),
- ARGIN_NULLOK(STRING *lib_name))
+ ARGIN(const STRING *path),
+ ARGIN(const STRING *type),
+ ARGIN_NULLOK(const STRING *lib_name))
__attribute__nonnull__(1)
__attribute__nonnull__(2)
__attribute__nonnull__(3)
@@ -143,7 +143,7 @@
/*
=item C<static void set_cstring_prop(PARROT_INTERP, PMC *lib_pmc, const char
-*what, STRING *name)>
+*what, const STRING *name)>
Set a property C<name> with value C<what> on the C<ParrotLibrary>
C<lib_pmc>.
@@ -154,7 +154,7 @@
static void
set_cstring_prop(PARROT_INTERP, ARGMOD(PMC *lib_pmc), ARGIN(const char *what),
- ARGIN(STRING *name))
+ ARGIN(const STRING *name))
{
ASSERT_ARGS(set_cstring_prop)
STRING * const key = Parrot_str_new_constant(interp, what);
@@ -166,8 +166,8 @@
/*
-=item C<static void store_lib_pmc(PARROT_INTERP, PMC *lib_pmc, STRING *path,
-STRING *type, STRING *lib_name)>
+=item C<static void store_lib_pmc(PARROT_INTERP, PMC *lib_pmc, const STRING
+*path, const STRING *type, const STRING *lib_name)>
Store a C<ParrotLibrary> PMC in the interpreter's C<iglobals>.
@@ -176,8 +176,8 @@
*/
static void
-store_lib_pmc(PARROT_INTERP, ARGIN(PMC *lib_pmc), ARGIN(STRING *path),
- ARGIN(STRING *type), ARGIN_NULLOK(STRING *lib_name))
+store_lib_pmc(PARROT_INTERP, ARGIN(PMC *lib_pmc), ARGIN(const STRING *path),
+ ARGIN(const STRING *type), ARGIN_NULLOK(const STRING *lib_name))
{
ASSERT_ARGS(store_lib_pmc)
PMC * const iglobals = interp->iglobals;
@@ -196,7 +196,7 @@
/*
-=item C<static PMC* is_loaded(PARROT_INTERP, STRING *path)>
+=item C<static PMC* is_loaded(PARROT_INTERP, const STRING *path)>
Check if a C<ParrotLibrary> PMC with the filename path exists.
If it does, return it. Otherwise, return NULL.
@@ -208,7 +208,7 @@
PARROT_WARN_UNUSED_RESULT
PARROT_CAN_RETURN_NULL
static PMC*
-is_loaded(PARROT_INTERP, ARGIN(STRING *path))
+is_loaded(PARROT_INTERP, ARGIN(const STRING *path))
{
ASSERT_ARGS(is_loaded)
PMC * const iglobals = interp->iglobals;
@@ -222,7 +222,7 @@
/*
=item C<static void * dlopen_string(PARROT_INTERP, Parrot_dlopen_flags flags,
-STRING *path)>
+const STRING *path)>
Call Parrot_dlopen with the Parrot String argument converted to C string. The
flags argument will be converted into native form and used if applicable.
@@ -234,7 +234,7 @@
PARROT_WARN_UNUSED_RESULT
PARROT_CAN_RETURN_NULL
static void *
-dlopen_string(PARROT_INTERP, Parrot_dlopen_flags flags, ARGIN(STRING *path))
+dlopen_string(PARROT_INTERP, Parrot_dlopen_flags flags, ARGIN(const STRING *path))
{
ASSERT_ARGS(dlopen_string)
@@ -246,8 +246,9 @@
/*
-=item C<static STRING * get_path(PARROT_INTERP, STRING *lib, Parrot_dlopen_flags
-flags, void **handle, STRING *wo_ext, STRING *ext)>
+=item C<static const STRING * get_path(PARROT_INTERP, const STRING *lib,
+Parrot_dlopen_flags flags, void **handle, const STRING *wo_ext, const STRING
+*ext)>
Return path and handle of a dynamic lib, setting lib_name to just the filestem
(i.e. without path or extension) as a freshly-allocated C string.
@@ -258,13 +259,14 @@
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))
+static const STRING *
+get_path(PARROT_INTERP, ARGMOD_NULLOK(const STRING *lib), Parrot_dlopen_flags flags,
+ ARGOUT(void **handle), ARGIN(const STRING *wo_ext),
+ ARGIN_NULLOK(const STRING *ext))
{
ASSERT_ARGS(get_path)
- STRING *path, *full_name;
+ const STRING *path;
+ const STRING *full_name;
const char *err = NULL; /* buffer returned from Parrot_dlerror */
PMC * const iglobals = interp->iglobals;
@@ -413,8 +415,8 @@
/*
-=item C<static PMC * run_init_lib(PARROT_INTERP, void *handle, STRING *lib_name,
-STRING *wo_ext)>
+=item C<static PMC * run_init_lib(PARROT_INTERP, void *handle, const STRING
+*lib_name, const STRING *wo_ext)>
Loads and Initializes a new library and returns a ParrotLibrary PMC.
Takes the name of a library C<libname>, that is loaded with handle C<handle>.
@@ -427,7 +429,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_NULLOK(const STRING *lib_name), ARGIN(const STRING *wo_ext))
{
ASSERT_ARGS(run_init_lib)
STRING *type;
@@ -512,7 +514,7 @@
clone_string_into(ARGMOD(Interp *d), ARGIN(Interp *s), ARGIN(PMC *value))
{
ASSERT_ARGS(clone_string_into)
- STRING * const orig = VTABLE_get_string(s, value);
+ const STRING * const orig = VTABLE_get_string(s, value);
char * const raw_str = Parrot_str_to_cstring(s, orig);
STRING * const ret =
Parrot_str_new_init(d, raw_str, strlen(raw_str),
@@ -572,7 +574,7 @@
STRING * const lib_name = clone_string_into(d, s,
VTABLE_getprop(s, lib_pmc, libname));
void * const handle = VTABLE_get_pointer(s, lib_pmc);
- STRING * const type =
+ const STRING * const type =
VTABLE_get_string(s, VTABLE_getprop(s, lib_pmc, type_str));
if (Parrot_str_equal(s, type, ops)) {
@@ -646,10 +648,13 @@
ASSERT_ARGS(Parrot_load_lib)
void *handle;
PMC *lib_pmc;
- STRING *path;
- STRING *lib_name, *wo_ext, *ext; /* library stem without path
+ const STRING *path;
+ const STRING *lib_name; /* library stem without path
* or extension. */
+ const STRING *wo_ext;
+ const STRING *ext;
int flags = 0;
+
/* Find the pure library name, without path or extension. */
/*
* TODO move the class_count_mutex here
Modified: branches/string_consting/src/embed.c
==============================================================================
--- branches/string_consting/src/embed.c Thu Apr 22 11:33:44 2010 (r45901)
+++ branches/string_consting/src/embed.c Thu Apr 22 11:33:57 2010 (r45902)
@@ -912,7 +912,7 @@
case enum_class_ResizableStringArray:
{
/*Parrot_print_p(interp, c->u.key);*/
- STRING * const s = VTABLE_get_string(interp, c->u.key);
+ const STRING * const s = VTABLE_get_string(interp, c->u.key);
if (s)
Parrot_io_fprintf(interp, output, "%Ss", s);
break;
Modified: branches/string_consting/src/extend.c
==============================================================================
--- branches/string_consting/src/extend.c Thu Apr 22 11:33:44 2010 (r45901)
+++ branches/string_consting/src/extend.c Thu Apr 22 11:33:57 2010 (r45902)
@@ -423,7 +423,7 @@
Parrot_PMC_get_cstring_intkey(PARROT_INTERP, Parrot_PMC pmc, Parrot_Int key)
{
ASSERT_ARGS(Parrot_PMC_get_cstring_intkey)
- STRING *intermediate;
+ const STRING *intermediate;
char *retval;
PARROT_CALLIN_START(interp);
@@ -454,7 +454,7 @@
Parrot_PMC_get_cstring(PARROT_INTERP, Parrot_PMC pmc)
{
ASSERT_ARGS(Parrot_PMC_get_cstring)
- STRING *intermediate;
+ const STRING *intermediate;
char *retval;
PARROT_CALLIN_START(interp);
More information about the parrot-commits
mailing list