[svn:parrot] r44136 - in branches/parrot_call_dep: . docs docs/pdds/draft examples/embed include/parrot src t/src
whiteknight at svn.parrot.org
whiteknight at svn.parrot.org
Thu Feb 18 16:45:27 UTC 2010
Author: whiteknight
Date: Thu Feb 18 16:45:25 2010
New Revision: 44136
URL: https://trac.parrot.org/parrot/changeset/44136
Log:
remove all instances of Parrot_call_* from the repo and replace with Parrot_ext_call where appropriate. Documentation is lacking a replacement
Modified:
branches/parrot_call_dep/DEPRECATED.pod
branches/parrot_call_dep/docs/embed.pod
branches/parrot_call_dep/docs/pdds/draft/pdd11_extending.pod
branches/parrot_call_dep/examples/embed/cotorra.c
branches/parrot_call_dep/include/parrot/extend.h
branches/parrot_call_dep/src/extend.c
branches/parrot_call_dep/t/src/embed.t
branches/parrot_call_dep/t/src/extend.t
Modified: branches/parrot_call_dep/DEPRECATED.pod
==============================================================================
--- branches/parrot_call_dep/DEPRECATED.pod Thu Feb 18 16:23:25 2010 (r44135)
+++ branches/parrot_call_dep/DEPRECATED.pod Thu Feb 18 16:45:25 2010 (r44136)
@@ -178,13 +178,6 @@
L<https://trac.parrot.org/parrot/ticket/443>
-=item Sub/method invocation functions [eligible in 2.1]
-
-The old 'Parrot_call_*' functions for invoking a sub/method object from C are
-deprecated, replaced by 'Parrot_ext_call'.
-
-L<https://trac.parrot.org/parrot/ticket/1145>
-
=item PMC Attributes Allocation Functions [experimental]
Parrot_gc_allocate_pmc_attributes
Modified: branches/parrot_call_dep/docs/embed.pod
==============================================================================
--- branches/parrot_call_dep/docs/embed.pod Thu Feb 18 16:23:25 2010 (r44135)
+++ branches/parrot_call_dep/docs/embed.pod Thu Feb 18 16:45:25 2010 (r44136)
@@ -84,21 +84,7 @@
=head2 Type signatures
-These are used with the Parrot_call_sub family of functions.
-
-=over 4
-
-=item v - void (return only)
-
-=item I - integer (return or argument)
-
-=item N - float (return or argument)
-
-=item S - string (return or argument)
-
-=item P - PMC (return or argument)
-
-=back
+ TODO: Write about signature strings
=head2 Interpreter initialization and destruction
Modified: branches/parrot_call_dep/docs/pdds/draft/pdd11_extending.pod
==============================================================================
--- branches/parrot_call_dep/docs/pdds/draft/pdd11_extending.pod Thu Feb 18 16:23:25 2010 (r44135)
+++ branches/parrot_call_dep/docs/pdds/draft/pdd11_extending.pod Thu Feb 18 16:45:25 2010 (r44136)
@@ -275,11 +275,7 @@
=over 4
-=item C<Parrot_call_sub(interp, Parrot_PMC sub, Parrot_Int argcount, ...)>
-
-Calls a Parrot subroutine, with C<argcount> PMC parameters. This function sets
-up Parrot's registers in line with the Parrot calling conventions; see
-L<pdd03_calling_conventions.pod> for more details.
+ TODO: Add new call functions here
=back
Modified: branches/parrot_call_dep/examples/embed/cotorra.c
==============================================================================
--- branches/parrot_call_dep/examples/embed/cotorra.c Thu Feb 18 16:23:25 2010 (r44135)
+++ branches/parrot_call_dep/examples/embed/cotorra.c Thu Feb 18 16:45:25 2010 (r44136)
@@ -203,7 +203,7 @@
Parrot_String compiler = create_string(interp, "PIR");
Parrot_String errstr;
Parrot_PMC code = Parrot_compile_string(interp, compiler, exec, &errstr);
- void *discard = Parrot_call_sub(interp, code, "v");
+ Parrot_ext_call(interp, code, "->");
return 0;
}
@@ -224,8 +224,7 @@
Parrot_PMC parrotns = Parrot_PMC_get_pmc_strkey(interp, rootns, parrotname);
Parrot_String name = create_string(interp, stname);
Parrot_PMC start = Parrot_PMC_get_pmc_strkey(interp, parrotns, name);
- void *discard;
- discard = Parrot_call_sub(interp, start, "v");
+ Parrot_ext_call(interp, start, "->");
}
else {
Parrot_runcode(interp, argc - i, argv + i);
Modified: branches/parrot_call_dep/include/parrot/extend.h
==============================================================================
--- branches/parrot_call_dep/include/parrot/extend.h Thu Feb 18 16:23:25 2010 (r44135)
+++ branches/parrot_call_dep/include/parrot/extend.h Thu Feb 18 16:45:25 2010 (r44136)
@@ -62,24 +62,6 @@
/* Don't modify between HEADERIZER BEGIN / HEADERIZER END. Your changes will be lost. */
PARROT_EXPORT
-PARROT_WARN_UNUSED_RESULT
-PARROT_CAN_RETURN_NULL
-void * Parrot_call_sub(PARROT_INTERP,
- Parrot_PMC sub_pmc,
- ARGIN(const char *signature),
- ...)
- __attribute__nonnull__(1)
- __attribute__nonnull__(3);
-
-PARROT_EXPORT
-Parrot_Int Parrot_call_sub_ret_int(PARROT_INTERP,
- Parrot_PMC sub_pmc,
- ARGIN(const char *signature),
- ...)
- __attribute__nonnull__(1)
- __attribute__nonnull__(3);
-
-PARROT_EXPORT
int Parrot_eprintf(NULLOK_INTERP, ARGIN(const char *s), ...)
__attribute__nonnull__(2);
@@ -412,12 +394,6 @@
__attribute__nonnull__(2)
__attribute__nonnull__(3);
-#define ASSERT_ARGS_Parrot_call_sub __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
- PARROT_ASSERT_ARG(interp) \
- , PARROT_ASSERT_ARG(signature))
-#define ASSERT_ARGS_Parrot_call_sub_ret_int __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
- PARROT_ASSERT_ARG(interp) \
- , PARROT_ASSERT_ARG(signature))
#define ASSERT_ARGS_Parrot_eprintf __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(s))
#define ASSERT_ARGS_Parrot_ext_call __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
Modified: branches/parrot_call_dep/src/extend.c
==============================================================================
--- branches/parrot_call_dep/src/extend.c Thu Feb 18 16:23:25 2010 (r44135)
+++ branches/parrot_call_dep/src/extend.c Thu Feb 18 16:45:25 2010 (r44136)
@@ -1058,120 +1058,6 @@
/*
-=item C<void * Parrot_call_sub(PARROT_INTERP, Parrot_PMC sub_pmc, const char
-*signature, ...)>
-
-Call a parrot subroutine with the given function signature. The first char in
-C<signature> denotes the return value. Next chars are arguments.
-
-The return value of this function can be void or a pointer type.
-
-Signature chars are:
-
- v ... void return
- I ... Parrot_Int
- N ... Parrot_Float
- S ... Parrot_String
- P ... Parrot_PMC
-
-=cut
-
-*/
-
-PARROT_EXPORT
-PARROT_WARN_UNUSED_RESULT
-PARROT_CAN_RETURN_NULL
-void *
-Parrot_call_sub(PARROT_INTERP, Parrot_PMC sub_pmc,
- ARGIN(const char *signature), ...)
-{
- ASSERT_ARGS(Parrot_call_sub)
- va_list args;
- PMC *sig_object;
- Parrot_sub *sub;
- void *result = NULL;
- const char *arg_sig = signature;
- char return_sig = signature[0];
-
- arg_sig++;
- va_start(args, signature);
- sig_object = Parrot_pcc_build_sig_object_from_varargs(interp, PMCNULL,
- arg_sig, args);
- va_end(args);
-
- /* Add the return argument onto the call signature object (a bit
- * hackish, added for backward compatibility in deprecated API function,
- * see TT #1145). */
- switch (return_sig) {
- case 'v':
- {
- Parrot_String full_sig = VTABLE_get_string(interp, sig_object);
- Parrot_str_concat(interp, full_sig,
- Parrot_str_new_constant(interp, "->"), 0);
- break;
- }
- case 'V':
- case 'P':
- {
- Parrot_pcc_append_result(interp, sig_object, Parrot_str_new_constant(interp, "P"),
- &result);
- break;
- }
- default:
- Parrot_ex_throw_from_c_args(interp, NULL,
- EXCEPTION_INVALID_OPERATION,
- "Dispatch: invalid return type %c!", return_sig);
- }
-
- PMC_get_sub(interp, sub_pmc, sub);
- Parrot_pcc_set_constants(interp, CURRENT_CONTEXT(interp),
- sub->seg->const_table->constants);
- Parrot_pcc_invoke_from_sig_object(interp, sub_pmc, sig_object);
-
- return result;
-}
-
-
-/*
-
-=item C<Parrot_Int Parrot_call_sub_ret_int(PARROT_INTERP, Parrot_PMC sub_pmc,
-const char *signature, ...)>
-
-Like C<Parrot_call_sub>, with Parrot_Int return result.
-
-=cut
-
-*/
-
-PARROT_EXPORT
-Parrot_Int
-Parrot_call_sub_ret_int(PARROT_INTERP, Parrot_PMC sub_pmc,
- ARGIN(const char *signature), ...)
-{
- ASSERT_ARGS(Parrot_call_sub_ret_int)
- va_list args;
- PMC *sig_object;
- Parrot_Int result;
- char return_sig = signature[0];
- const char *arg_sig = signature;
- Parrot_sub *sub;
-
- arg_sig++;
- va_start(args, signature);
- sig_object = Parrot_pcc_build_sig_object_from_varargs(interp, PMCNULL, arg_sig, args);
- va_end(args);
-
- /* Add the return argument onto the call signature object (a bit
- * hackish, added for backward compatibility in deprecated API function,
- * see TT #1145). */
- Parrot_pcc_append_result(interp, sig_object, Parrot_str_new_constant(interp, "I"), &result);
- Parrot_pcc_invoke_from_sig_object(interp, sub_pmc, sig_object);
-
- return result;
-}
-
-/*
-
=item C<Parrot_Int Parrot_get_intreg(PARROT_INTERP, Parrot_Int regnum)>
Return the value of an integer register.
Modified: branches/parrot_call_dep/t/src/embed.t
==============================================================================
--- branches/parrot_call_dep/t/src/embed.t Thu Feb 18 16:23:25 2010 (r44135)
+++ branches/parrot_call_dep/t/src/embed.t Thu Feb 18 16:45:25 2010 (r44136)
@@ -93,7 +93,7 @@
"\n",
&errstr
);
- Parrot_call_sub(interp, code, "v");
+ Parrot_ext_call(interp, code, "->");
Parrot_destroy(interp);
return 0;
@@ -160,7 +160,7 @@
subname = Parrot_new_string(interp, "hello", 5, (const char *)NULL, 0);
sub = Parrot_PMC_get_pmc_strkey(interp, parrotns, subname);
/* Execute it */
- Parrot_call_sub(interp, sub, "v");
+ Parrot_ext_call(interp, sub, "->");
Parrot_destroy(interp);
return 0;
@@ -216,7 +216,7 @@
&errstr
);
hellosub = Parrot_sub_new_from_c_func(interp, (void (*)())& hello, "vJ");
- Parrot_call_sub(interp, code, "vP", hellosub);
+ Parrot_ext_call(interp, code, "P->", hellosub);
Parrot_destroy(interp);
return 0;
@@ -285,7 +285,7 @@
Parrot_PMC_set_pmc_strkey(interp, parrotns, helloname, hellosub);
/* Call it */
- discard = Parrot_call_sub(interp, code, "v");
+ Parrot_ext_call(interp, code, "->");
Parrot_destroy(interp);
return 0;
Modified: branches/parrot_call_dep/t/src/extend.t
==============================================================================
--- branches/parrot_call_dep/t/src/extend.t Thu Feb 18 16:23:25 2010 (r44135)
+++ branches/parrot_call_dep/t/src/extend.t Thu Feb 18 16:45:25 2010 (r44136)
@@ -446,7 +446,7 @@
Parrot_pbc_load(interp, pf);
sub = Parrot_find_global_cur(interp, name);
- Parrot_call_sub(interp, sub, "v");
+ Parrot_ext_call(interp, sub, "->");
Parrot_eprintf(interp, "back\\n");
/* win32 seems to buffer stderr ? */
@@ -459,7 +459,7 @@
Parrot_PMC_set_string_native(interp, arg,
Parrot_str_new(interp, "hello ", 0));
- Parrot_call_sub(interp, sub, "vP", arg);
+ Parrot_ext_call(interp, sub, "P->", arg);
Parrot_eprintf(interp, "back\\n");
return NULL;
@@ -657,7 +657,7 @@
interp->current_runloop_id++;
Parrot_ex_add_c_handler(interp, &jump_point);
- Parrot_call_sub(interp, sub, "v");
+ Parrot_ext_call(interp, sub, "->");
}
Parrot_eprintf(interp, "back\\n");
@@ -781,7 +781,7 @@
foo_name = Parrot_str_new_constant( interp, "foo" );
sub = Parrot_find_global_cur( interp, foo_name );
- retval = (PMC *) Parrot_call_sub( interp, sub, "V", "" );
+ Parrot_ext_call(interp, sub, "->");
Parrot_exit(interp, 0);
return 0;
@@ -812,7 +812,7 @@
Parrot_pbc_load( interp, pf );
sub = Parrot_find_global_cur( interp, Parrot_str_new_constant( interp, "add" ) );
- result = Parrot_call_sub_ret_int( interp, sub, "III", 100, 200 );
+ Parrot_ext_call(interp, sub, "II->I", 100, 200, &result);
printf( "Result is %d.\\n", result );
Parrot_exit(interp, 0);
More information about the parrot-commits
mailing list