258
=item C<Parrot_PMC Parrot_compile_string(PARROT_INTERP, Parrot_String type,
259
const char *code, Parrot_String *error)>
261
Compiles a code string.
263
DEPRECATED: Use Parrot_compile_file (or whatever replaces it, TT #2135).
270
PARROT_CAN_RETURN_NULL
271
PARROT_WARN_UNUSED_RESULT
273
Parrot_compile_string(PARROT_INTERP, Parrot_String type, ARGIN(const char *code),
274
ARGOUT(Parrot_String *error))
276
ASSERT_ARGS(Parrot_compile_string)
277
PMC * const compiler = Parrot_get_compiler(interp, type);
279
/* XXX error is not being set */
280
if (PMC_IS_NULL(compiler)) {
281
Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_UNEXPECTED_NULL,
282
"Could not find compiler %Ss", type);
286
STRING * const code_s = Parrot_str_new(interp, code, 0);
287
imc_info_t * imcc = (imc_info_t*) VTABLE_get_pointer(interp, compiler);
288
const INTVAL is_pasm = VTABLE_get_integer(interp, compiler);
290
Parrot_block_GC_mark(interp);
291
result = imcc_compile_string(imcc, code_s, is_pasm);
292
if (PMC_IS_NULL(result)) {
293
STRING * const msg = imcc_last_error_message(imcc);
294
const INTVAL code = imcc_last_error_code(imcc);
296
Parrot_unblock_GC_mark(interp);
297
Parrot_ex_throw_from_c_args(interp, NULL, code, "%Ss", msg);
299
Parrot_unblock_GC_mark(interp);
254
306
=item C<INTVAL interpinfo(PARROT_INTERP, INTVAL what)>
256
308
C<what> specifies the type of information you want about the interpreter.
454
506
return ((Parrot_ParrotInterpreter_attributes*)interp_pmc->data)->interp;
511
=item C<void Parrot_set_flag(PARROT_INTERP, INTVAL flag)>
513
Sets on any of the following flags, specified by C<flag>, in the interpreter:
516
C<PARROT_BOUNDS_FLAG> enable bounds checking
517
C<PARROT_PROFILE_FLAG> enable profiling,
525
Parrot_set_flag(PARROT_INTERP, INTVAL flag)
527
ASSERT_ARGS(Parrot_set_flag)
528
/* These two macros (from interpreter.h) do exactly what they look like. */
530
Interp_flags_SET(interp, flag);
532
case PARROT_BOUNDS_FLAG:
533
case PARROT_PROFILE_FLAG:
534
Parrot_runcore_switch(interp, Parrot_str_new_constant(interp, "slow"));
544
=item C<void Parrot_set_debug(PARROT_INTERP, UINTVAL flag)>
546
Set a debug flag: C<PARROT_DEBUG_FLAG>.
554
Parrot_set_debug(PARROT_INTERP, UINTVAL flag)
556
ASSERT_ARGS(Parrot_set_debug)
557
interp->debug_flags |= flag;
563
=item C<void Parrot_set_executable_name(PARROT_INTERP, STRING * const name)>
565
Sets the name of the executable launching Parrot (see C<pbc_to_exe> and the
574
Parrot_set_executable_name(PARROT_INTERP, ARGIN(STRING * const name))
576
ASSERT_ARGS(Parrot_set_executable_name)
577
PMC * const name_pmc = Parrot_pmc_new(interp, enum_class_String);
578
VTABLE_set_string_native(interp, name_pmc, name);
579
VTABLE_set_pmc_keyed_int(interp, interp->iglobals, IGLOBALS_EXECUTABLE,
586
=item C<void Parrot_set_trace(PARROT_INTERP, UINTVAL flag)>
588
Set a trace flag: C<PARROT_TRACE_FLAG>
596
Parrot_set_trace(PARROT_INTERP, UINTVAL flag)
598
ASSERT_ARGS(Parrot_set_trace)
599
Parrot_pcc_trace_flags_on(interp, interp->ctx, flag);
600
Parrot_runcore_switch(interp, Parrot_str_new_constant(interp, "slow"));
606
=item C<void Parrot_clear_flag(PARROT_INTERP, INTVAL flag)>
608
Clears a flag in the interpreter.
616
Parrot_clear_flag(PARROT_INTERP, INTVAL flag)
618
ASSERT_ARGS(Parrot_clear_flag)
619
Interp_flags_CLEAR(interp, flag);
625
=item C<void Parrot_clear_debug(PARROT_INTERP, UINTVAL flag)>
627
Clears a flag in the interpreter.
635
Parrot_clear_debug(PARROT_INTERP, UINTVAL flag)
637
ASSERT_ARGS(Parrot_clear_debug)
638
interp->debug_flags &= ~flag;
644
=item C<void Parrot_clear_trace(PARROT_INTERP, UINTVAL flag)>
646
Clears a flag in the interpreter.
654
Parrot_clear_trace(PARROT_INTERP, UINTVAL flag)
656
ASSERT_ARGS(Parrot_clear_trace)
657
Parrot_pcc_trace_flags_off(interp, interp->ctx, flag);
663
=item C<Parrot_Int Parrot_test_flag(PARROT_INTERP, INTVAL flag)>
665
Test the interpreter flags specified in C<flag>.
674
Parrot_test_flag(PARROT_INTERP, INTVAL flag)
676
ASSERT_ARGS(Parrot_test_flag)
677
return Interp_flags_TEST(interp, flag);
683
=item C<Parrot_UInt Parrot_test_debug(PARROT_INTERP, UINTVAL flag)>
685
Test the interpreter flags specified in C<flag>.
694
Parrot_test_debug(PARROT_INTERP, UINTVAL flag)
696
ASSERT_ARGS(Parrot_test_debug)
697
return interp->debug_flags & flag;
703
=item C<Parrot_UInt Parrot_test_trace(PARROT_INTERP, UINTVAL flag)>
705
Test the interpreter flags specified in C<flag>.
714
Parrot_test_trace(PARROT_INTERP, UINTVAL flag)
716
ASSERT_ARGS(Parrot_test_trace)
717
return Parrot_pcc_trace_flags_test(interp, interp->ctx, flag);
723
=item C<void Parrot_set_run_core(PARROT_INTERP, Parrot_Run_core_t core)>
725
Sets the specified run core.
733
Parrot_set_run_core(PARROT_INTERP, Parrot_Run_core_t core)
735
ASSERT_ARGS(Parrot_set_run_core)
737
case PARROT_SLOW_CORE:
738
Parrot_runcore_switch(interp, Parrot_str_new_constant(interp, "slow"));
740
case PARROT_FAST_CORE:
741
Parrot_runcore_switch(interp, Parrot_str_new_constant(interp, "fast"));
743
case PARROT_EXEC_CORE:
744
Parrot_runcore_switch(interp, Parrot_str_new_constant(interp, "exec"));
746
case PARROT_GC_DEBUG_CORE:
747
Parrot_runcore_switch(interp, Parrot_str_new_constant(interp, "gc_debug"));
749
case PARROT_DEBUGGER_CORE:
750
Parrot_runcore_switch(interp, Parrot_str_new_constant(interp, "debugger"));
752
case PARROT_PROFILING_CORE:
753
Parrot_runcore_switch(interp, Parrot_str_new_constant(interp, "profiling"));
756
Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_UNIMPLEMENTED,
757
"Invalid runcore requested\n");
764
=item C<void Parrot_setwarnings(PARROT_INTERP, Parrot_warnclass wc)>
766
Activates the given warnings.
774
Parrot_setwarnings(PARROT_INTERP, Parrot_warnclass wc)
776
ASSERT_ARGS(Parrot_setwarnings)
777
/* Activates the given warnings. (Macro from warnings.h.) */
778
PARROT_WARNINGS_on(interp, wc);
459
790
* Local variables: