Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

remove all instances of Parrot_call_* from the repo and replace with …

…Parrot_ext_call where appropriate. Documentation is lacking a replacement

git-svn-id: https://svn.parrot.org/parrot/branches/parrot_call_dep@44136 d31e2699-5ff4-0310-a27c-f18f2fbe73fe
  • Loading branch information...
commit 26856bb9883355c88187960b6c237d8292e6d9f8 1 parent 506fc1a
whiteknight authored
View
7 DEPRECATED.pod
@@ -178,13 +178,6 @@ functions will be kept in the ticket at:
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
View
16 docs/embed.pod
@@ -84,21 +84,7 @@ Not documented yet.
=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
View
6 docs/pdds/draft/pdd11_extending.pod
@@ -275,11 +275,7 @@ Functions to call Parrot subroutines and methods
=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
View
5 examples/embed/cotorra.c
@@ -203,7 +203,7 @@ int cotorra_main(Parrot_Interp interp, int argc, char **argv)
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 @@ int cotorra_main(Parrot_Interp interp, int argc, char **argv)
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);
View
24 include/parrot/extend.h
@@ -62,24 +62,6 @@ typedef const void * Parrot_VTABLE;
/* 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 @@ int Parrot_vfprintf(PARROT_INTERP,
__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 = (\
View
114 src/extend.c
@@ -1058,120 +1058,6 @@ Parrot_ext_call(PARROT_INTERP, ARGIN(Parrot_PMC sub_pmc),
/*
-=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.
View
8 t/src/embed.t
@@ -93,7 +93,7 @@ int main(void)
"\n",
&errstr
);
- Parrot_call_sub(interp, code, "v");
+ Parrot_ext_call(interp, code, "->");
Parrot_destroy(interp);
return 0;
@@ -160,7 +160,7 @@ int main(void)
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 @@ int main(void)
&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 @@ int main(void)
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;
View
10 t/src/extend.t
@@ -446,7 +446,7 @@ the_test(PARROT_INTERP, opcode_t *cur_op, opcode_t *start)
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 @@ the_test(PARROT_INTERP, opcode_t *cur_op, opcode_t *start)
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 @@ the_test(PARROT_INTERP, opcode_t *cur_op, opcode_t *start)
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 @@ main(int argc, char* argv[])
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 @@ main(int argc, char* argv[])
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);
Please sign in to comment.
Something went wrong with that request. Please try again.