[svn:parrot] r44832 - in trunk: . docs/pdds include/parrot src src/string
tewk at svn.parrot.org
tewk at svn.parrot.org
Tue Mar 9 23:19:56 UTC 2010
Author: tewk
Date: Tue Mar 9 23:19:56 2010
New Revision: 44832
URL: https://trac.parrot.org/parrot/changeset/44832
Log:
Added Parrot_str_is_null, DEPRECATED Parrot_string_* and STRING_is_null
Modified:
trunk/DEPRECATED.pod
trunk/docs/pdds/pdd28_strings.pod
trunk/include/parrot/interpreter.h
trunk/include/parrot/string_funcs.h
trunk/src/main.c
trunk/src/parrot_debugger.c
trunk/src/string/api.c
Modified: trunk/DEPRECATED.pod
==============================================================================
--- trunk/DEPRECATED.pod Tue Mar 9 22:40:14 2010 (r44831)
+++ trunk/DEPRECATED.pod Tue Mar 9 23:19:56 2010 (r44832)
@@ -214,6 +214,18 @@
All STRING modification functions will return a STRING pointer; capture and use
this rather than relying on in-place modification of an existing pointer.
+=item STRING_is_null function [eligible in 2.4]
+
+renamed to Parrot_str_is_null
+
+=item Parrot_string_* [eligible in 2.4]
+
+rename Parrot_string_cstring to Parrot_str_cstring
+
+=item STRING functions which don't have Parrot_str_ prefix
+
+The string subsytem is gradually getting an overhaul.
+
=back
=head1 Compiler tools
Modified: trunk/docs/pdds/pdd28_strings.pod
==============================================================================
--- trunk/docs/pdds/pdd28_strings.pod Tue Mar 9 22:40:14 2010 (r44831)
+++ trunk/docs/pdds/pdd28_strings.pod Tue Mar 9 23:19:56 2010 (r44832)
@@ -626,9 +626,9 @@
Unsafe, and behavior handled by Parrot_str_to_cstring.
-=head4 Parrot_string_split
+=head4 Parrot_str_split
-Is the same as Parrot_str_split.
+Splits the string C<str> at the delimiter C<delim>.
=head4 Parrot_str_free (was string_free)
Modified: trunk/include/parrot/interpreter.h
==============================================================================
--- trunk/include/parrot/interpreter.h Tue Mar 9 22:40:14 2010 (r44831)
+++ trunk/include/parrot/interpreter.h Tue Mar 9 23:19:56 2010 (r44832)
@@ -609,7 +609,7 @@
# define PMC_IS_NULL(pmc) Parrot_pmc_is_null(NULL, (pmc))
#endif
#ifndef STRING_IS_NULL
-# define STRING_IS_NULL(s) ((s) == NULL || STRING_is_null(NULL, (s))
+# define STRING_IS_NULL(s) ((s) == NULL || Parrot_str_is_null(NULL, (s))
#endif
#endif /* PARROT_INTERPRETER_H_GUARD */
Modified: trunk/include/parrot/string_funcs.h
==============================================================================
--- trunk/include/parrot/string_funcs.h Tue Mar 9 22:40:14 2010 (r44831)
+++ trunk/include/parrot/string_funcs.h Tue Mar 9 23:19:56 2010 (r44832)
@@ -1,3 +1,4 @@
+#define ASSERT_ARGS_STRING_is_null __attribute__unused__ int _ASSERT_ARGS_CHECK = (0)
/* string_funcs.h
* Copyright (C) 2001-2008, Parrot Foundation.
* SVN Info
@@ -492,6 +493,9 @@
__attribute__nonnull__(2);
PARROT_EXPORT
+INTVAL Parrot_str_is_null(SHIM_INTERP, ARGIN_NULLOK(const STRING *s));
+
+PARROT_EXPORT
INTVAL STRING_is_null(SHIM_INTERP, ARGIN_NULLOK(const STRING *s));
PARROT_EXPORT
@@ -710,6 +714,7 @@
PARROT_ASSERT_ARG(interp) \
, PARROT_ASSERT_ARG(s))
#define ASSERT_ARGS_STRING_is_null __attribute__unused__ int _ASSERT_ARGS_CHECK = (0)
+#define ASSERT_ARGS_Parrot_str_is_null __attribute__unused__ int _ASSERT_ARGS_CHECK = (0)
#define ASSERT_ARGS_string_make __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp))
#define ASSERT_ARGS_string_make_from_charset __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
Modified: trunk/src/main.c
==============================================================================
--- trunk/src/main.c Tue Mar 9 22:40:14 2010 (r44831)
+++ trunk/src/main.c Tue Mar 9 23:19:56 2010 (r44832)
@@ -132,11 +132,11 @@
PMC *env = Parrot_pmc_new(interp, enum_class_Env);
STRING *path = VTABLE_get_string_keyed_str(interp, env,
Parrot_str_new_constant(interp, "PARROT_LIBRARY"));
- if (!STRING_is_null(interp, path) && Parrot_str_length(interp, path) > 0)
+ if (!Parrot_str_is_null(interp, path) && Parrot_str_length(interp, path) > 0)
Parrot_lib_add_path(interp, path, PARROT_LIB_PATH_LIBRARY);
path = VTABLE_get_string_keyed_str(interp, env,
Parrot_str_new_constant(interp, "PARROT_INCLUDE"));
- if (!STRING_is_null(interp, path) && Parrot_str_length(interp, path) > 0)
+ if (!Parrot_str_is_null(interp, path) && Parrot_str_length(interp, path) > 0)
Parrot_lib_add_path(interp, path, PARROT_LIB_PATH_INCLUDE);
}
Modified: trunk/src/parrot_debugger.c
==============================================================================
--- trunk/src/parrot_debugger.c Tue Mar 9 22:40:14 2010 (r44831)
+++ trunk/src/parrot_debugger.c Tue Mar 9 23:19:56 2010 (r44832)
@@ -251,7 +251,7 @@
const char source []= ".sub aux :main\nexit 0\n.end\n";
Parrot_compile_string(interp, compiler, source, &errstr);
- if (!STRING_is_null(interp, errstr))
+ if (!Parrot_str_is_null(interp, errstr))
Parrot_io_eprintf(interp, "%Ss\n", errstr);
}
Modified: trunk/src/string/api.c
==============================================================================
--- trunk/src/string/api.c Tue Mar 9 22:40:14 2010 (r44831)
+++ trunk/src/string/api.c Tue Mar 9 23:19:56 2010 (r44832)
@@ -73,6 +73,25 @@
/*
+=item C<INTVAL Parrot_str_is_null(PARROT_INTERP, const STRING *s)>
+
+Tests if the given STRING is STRINGNULL.
+
+=cut
+
+*/
+
+PARROT_EXPORT
+INTVAL
+Parrot_str_is_null(SHIM_INTERP, ARGIN_NULLOK(const STRING *s))
+{
+ ASSERT_ARGS(Parrot_str_is_null)
+ return !s || s == STRINGNULL;
+}
+
+
+/*
+
=item C<INTVAL STRING_is_null(PARROT_INTERP, const STRING *s)>
Tests if the given STRING is STRINGNULL.
More information about the parrot-commits
mailing list