Skip to content
This repository
Browse code

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
7 DEPRECATED.pod
Source Rendered
@@ -178,13 +178,6 @@ functions will be kept in the ticket at:
178 178
179 179 L<https://trac.parrot.org/parrot/ticket/443>
180 180
181   -=item Sub/method invocation functions [eligible in 2.1]
182   -
183   -The old 'Parrot_call_*' functions for invoking a sub/method object from C are
184   -deprecated, replaced by 'Parrot_ext_call'.
185   -
186   -L<https://trac.parrot.org/parrot/ticket/1145>
187   -
188 181 =item PMC Attributes Allocation Functions [experimental]
189 182
190 183 Parrot_gc_allocate_pmc_attributes
16 docs/embed.pod
Source Rendered
@@ -84,21 +84,7 @@ Not documented yet.
84 84
85 85 =head2 Type signatures
86 86
87   -These are used with the Parrot_call_sub family of functions.
88   -
89   -=over 4
90   -
91   -=item v - void (return only)
92   -
93   -=item I - integer (return or argument)
94   -
95   -=item N - float (return or argument)
96   -
97   -=item S - string (return or argument)
98   -
99   -=item P - PMC (return or argument)
100   -
101   -=back
  87 + TODO: Write about signature strings
102 88
103 89 =head2 Interpreter initialization and destruction
104 90
6 docs/pdds/draft/pdd11_extending.pod
Source Rendered
@@ -275,11 +275,7 @@ Functions to call Parrot subroutines and methods
275 275
276 276 =over 4
277 277
278   -=item C<Parrot_call_sub(interp, Parrot_PMC sub, Parrot_Int argcount, ...)>
279   -
280   -Calls a Parrot subroutine, with C<argcount> PMC parameters. This function sets
281   -up Parrot's registers in line with the Parrot calling conventions; see
282   -L<pdd03_calling_conventions.pod> for more details.
  278 + TODO: Add new call functions here
283 279
284 280 =back
285 281
5 examples/embed/cotorra.c
@@ -203,7 +203,7 @@ int cotorra_main(Parrot_Interp interp, int argc, char **argv)
203 203 Parrot_String compiler = create_string(interp, "PIR");
204 204 Parrot_String errstr;
205 205 Parrot_PMC code = Parrot_compile_string(interp, compiler, exec, &errstr);
206   - void *discard = Parrot_call_sub(interp, code, "v");
  206 + Parrot_ext_call(interp, code, "->");
207 207 return 0;
208 208 }
209 209
@@ -224,8 +224,7 @@ int cotorra_main(Parrot_Interp interp, int argc, char **argv)
224 224 Parrot_PMC parrotns = Parrot_PMC_get_pmc_strkey(interp, rootns, parrotname);
225 225 Parrot_String name = create_string(interp, stname);
226 226 Parrot_PMC start = Parrot_PMC_get_pmc_strkey(interp, parrotns, name);
227   - void *discard;
228   - discard = Parrot_call_sub(interp, start, "v");
  227 + Parrot_ext_call(interp, start, "->");
229 228 }
230 229 else {
231 230 Parrot_runcode(interp, argc - i, argv + i);
24 include/parrot/extend.h
@@ -62,24 +62,6 @@ typedef const void * Parrot_VTABLE;
62 62 /* Don't modify between HEADERIZER BEGIN / HEADERIZER END. Your changes will be lost. */
63 63
64 64 PARROT_EXPORT
65   -PARROT_WARN_UNUSED_RESULT
66   -PARROT_CAN_RETURN_NULL
67   -void * Parrot_call_sub(PARROT_INTERP,
68   - Parrot_PMC sub_pmc,
69   - ARGIN(const char *signature),
70   - ...)
71   - __attribute__nonnull__(1)
72   - __attribute__nonnull__(3);
73   -
74   -PARROT_EXPORT
75   -Parrot_Int Parrot_call_sub_ret_int(PARROT_INTERP,
76   - Parrot_PMC sub_pmc,
77   - ARGIN(const char *signature),
78   - ...)
79   - __attribute__nonnull__(1)
80   - __attribute__nonnull__(3);
81   -
82   -PARROT_EXPORT
83 65 int Parrot_eprintf(NULLOK_INTERP, ARGIN(const char *s), ...)
84 66 __attribute__nonnull__(2);
85 67
@@ -412,12 +394,6 @@ int Parrot_vfprintf(PARROT_INTERP,
412 394 __attribute__nonnull__(2)
413 395 __attribute__nonnull__(3);
414 396
415   -#define ASSERT_ARGS_Parrot_call_sub __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
416   - PARROT_ASSERT_ARG(interp) \
417   - , PARROT_ASSERT_ARG(signature))
418   -#define ASSERT_ARGS_Parrot_call_sub_ret_int __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
419   - PARROT_ASSERT_ARG(interp) \
420   - , PARROT_ASSERT_ARG(signature))
421 397 #define ASSERT_ARGS_Parrot_eprintf __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
422 398 PARROT_ASSERT_ARG(s))
423 399 #define ASSERT_ARGS_Parrot_ext_call __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
114 src/extend.c
@@ -1058,120 +1058,6 @@ Parrot_ext_call(PARROT_INTERP, ARGIN(Parrot_PMC sub_pmc),
1058 1058
1059 1059 /*
1060 1060
1061   -=item C<void * Parrot_call_sub(PARROT_INTERP, Parrot_PMC sub_pmc, const char
1062   -*signature, ...)>
1063   -
1064   -Call a parrot subroutine with the given function signature. The first char in
1065   -C<signature> denotes the return value. Next chars are arguments.
1066   -
1067   -The return value of this function can be void or a pointer type.
1068   -
1069   -Signature chars are:
1070   -
1071   - v ... void return
1072   - I ... Parrot_Int
1073   - N ... Parrot_Float
1074   - S ... Parrot_String
1075   - P ... Parrot_PMC
1076   -
1077   -=cut
1078   -
1079   -*/
1080   -
1081   -PARROT_EXPORT
1082   -PARROT_WARN_UNUSED_RESULT
1083   -PARROT_CAN_RETURN_NULL
1084   -void *
1085   -Parrot_call_sub(PARROT_INTERP, Parrot_PMC sub_pmc,
1086   - ARGIN(const char *signature), ...)
1087   -{
1088   - ASSERT_ARGS(Parrot_call_sub)
1089   - va_list args;
1090   - PMC *sig_object;
1091   - Parrot_sub *sub;
1092   - void *result = NULL;
1093   - const char *arg_sig = signature;
1094   - char return_sig = signature[0];
1095   -
1096   - arg_sig++;
1097   - va_start(args, signature);
1098   - sig_object = Parrot_pcc_build_sig_object_from_varargs(interp, PMCNULL,
1099   - arg_sig, args);
1100   - va_end(args);
1101   -
1102   - /* Add the return argument onto the call signature object (a bit
1103   - * hackish, added for backward compatibility in deprecated API function,
1104   - * see TT #1145). */
1105   - switch (return_sig) {
1106   - case 'v':
1107   - {
1108   - Parrot_String full_sig = VTABLE_get_string(interp, sig_object);
1109   - Parrot_str_concat(interp, full_sig,
1110   - Parrot_str_new_constant(interp, "->"), 0);
1111   - break;
1112   - }
1113   - case 'V':
1114   - case 'P':
1115   - {
1116   - Parrot_pcc_append_result(interp, sig_object, Parrot_str_new_constant(interp, "P"),
1117   - &result);
1118   - break;
1119   - }
1120   - default:
1121   - Parrot_ex_throw_from_c_args(interp, NULL,
1122   - EXCEPTION_INVALID_OPERATION,
1123   - "Dispatch: invalid return type %c!", return_sig);
1124   - }
1125   -
1126   - PMC_get_sub(interp, sub_pmc, sub);
1127   - Parrot_pcc_set_constants(interp, CURRENT_CONTEXT(interp),
1128   - sub->seg->const_table->constants);
1129   - Parrot_pcc_invoke_from_sig_object(interp, sub_pmc, sig_object);
1130   -
1131   - return result;
1132   -}
1133   -
1134   -
1135   -/*
1136   -
1137   -=item C<Parrot_Int Parrot_call_sub_ret_int(PARROT_INTERP, Parrot_PMC sub_pmc,
1138   -const char *signature, ...)>
1139   -
1140   -Like C<Parrot_call_sub>, with Parrot_Int return result.
1141   -
1142   -=cut
1143   -
1144   -*/
1145   -
1146   -PARROT_EXPORT
1147   -Parrot_Int
1148   -Parrot_call_sub_ret_int(PARROT_INTERP, Parrot_PMC sub_pmc,
1149   - ARGIN(const char *signature), ...)
1150   -{
1151   - ASSERT_ARGS(Parrot_call_sub_ret_int)
1152   - va_list args;
1153   - PMC *sig_object;
1154   - Parrot_Int result;
1155   - char return_sig = signature[0];
1156   - const char *arg_sig = signature;
1157   - Parrot_sub *sub;
1158   -
1159   - arg_sig++;
1160   - va_start(args, signature);
1161   - sig_object = Parrot_pcc_build_sig_object_from_varargs(interp, PMCNULL, arg_sig, args);
1162   - va_end(args);
1163   -
1164   - /* Add the return argument onto the call signature object (a bit
1165   - * hackish, added for backward compatibility in deprecated API function,
1166   - * see TT #1145). */
1167   - Parrot_pcc_append_result(interp, sig_object, Parrot_str_new_constant(interp, "I"), &result);
1168   - Parrot_pcc_invoke_from_sig_object(interp, sub_pmc, sig_object);
1169   -
1170   - return result;
1171   -}
1172   -
1173   -/*
1174   -
1175 1061 =item C<Parrot_Int Parrot_get_intreg(PARROT_INTERP, Parrot_Int regnum)>
1176 1062
1177 1063 Return the value of an integer register.
8 t/src/embed.t
@@ -93,7 +93,7 @@ int main(void)
93 93 "\n",
94 94 &errstr
95 95 );
96   - Parrot_call_sub(interp, code, "v");
  96 + Parrot_ext_call(interp, code, "->");
97 97
98 98 Parrot_destroy(interp);
99 99 return 0;
@@ -160,7 +160,7 @@ int main(void)
160 160 subname = Parrot_new_string(interp, "hello", 5, (const char *)NULL, 0);
161 161 sub = Parrot_PMC_get_pmc_strkey(interp, parrotns, subname);
162 162 /* Execute it */
163   - Parrot_call_sub(interp, sub, "v");
  163 + Parrot_ext_call(interp, sub, "->");
164 164
165 165 Parrot_destroy(interp);
166 166 return 0;
@@ -216,7 +216,7 @@ int main(void)
216 216 &errstr
217 217 );
218 218 hellosub = Parrot_sub_new_from_c_func(interp, (void (*)())& hello, "vJ");
219   - Parrot_call_sub(interp, code, "vP", hellosub);
  219 + Parrot_ext_call(interp, code, "P->", hellosub);
220 220
221 221 Parrot_destroy(interp);
222 222 return 0;
@@ -285,7 +285,7 @@ int main(void)
285 285 Parrot_PMC_set_pmc_strkey(interp, parrotns, helloname, hellosub);
286 286
287 287 /* Call it */
288   - discard = Parrot_call_sub(interp, code, "v");
  288 + Parrot_ext_call(interp, code, "->");
289 289
290 290 Parrot_destroy(interp);
291 291 return 0;
10 t/src/extend.t
@@ -446,7 +446,7 @@ the_test(PARROT_INTERP, opcode_t *cur_op, opcode_t *start)
446 446
447 447 Parrot_pbc_load(interp, pf);
448 448 sub = Parrot_find_global_cur(interp, name);
449   - Parrot_call_sub(interp, sub, "v");
  449 + Parrot_ext_call(interp, sub, "->");
450 450 Parrot_eprintf(interp, "back\\n");
451 451
452 452 /* win32 seems to buffer stderr ? */
@@ -459,7 +459,7 @@ the_test(PARROT_INTERP, opcode_t *cur_op, opcode_t *start)
459 459 Parrot_PMC_set_string_native(interp, arg,
460 460 Parrot_str_new(interp, "hello ", 0));
461 461
462   - Parrot_call_sub(interp, sub, "vP", arg);
  462 + Parrot_ext_call(interp, sub, "P->", arg);
463 463 Parrot_eprintf(interp, "back\\n");
464 464
465 465 return NULL;
@@ -657,7 +657,7 @@ the_test(PARROT_INTERP, opcode_t *cur_op, opcode_t *start)
657 657 interp->current_runloop_id++;
658 658
659 659 Parrot_ex_add_c_handler(interp, &jump_point);
660   - Parrot_call_sub(interp, sub, "v");
  660 + Parrot_ext_call(interp, sub, "->");
661 661 }
662 662
663 663 Parrot_eprintf(interp, "back\\n");
@@ -781,7 +781,7 @@ main(int argc, char* argv[])
781 781 foo_name = Parrot_str_new_constant( interp, "foo" );
782 782 sub = Parrot_find_global_cur( interp, foo_name );
783 783
784   - retval = (PMC *) Parrot_call_sub( interp, sub, "V", "" );
  784 + Parrot_ext_call(interp, sub, "->");
785 785
786 786 Parrot_exit(interp, 0);
787 787 return 0;
@@ -812,7 +812,7 @@ main(int argc, char* argv[])
812 812 Parrot_pbc_load( interp, pf );
813 813
814 814 sub = Parrot_find_global_cur( interp, Parrot_str_new_constant( interp, "add" ) );
815   - result = Parrot_call_sub_ret_int( interp, sub, "III", 100, 200 );
  815 + Parrot_ext_call(interp, sub, "II->I", 100, 200, &result);
816 816 printf( "Result is %d.\\n", result );
817 817
818 818 Parrot_exit(interp, 0);

0 comments on commit 26856bb

Please sign in to comment.
Something went wrong with that request. Please try again.