Exemple #1
0
PARROT_API
Parrot_Int
Parrot_api_string_free_exported_ascii(ARGIN(Parrot_PMC interp_pmc), ARGIN(char * const str))
{
    ASSERT_ARGS(Parrot_api_string_free_exported_ascii)
    EMBED_API_CALLIN(interp_pmc, interp);
    if (str != NULL)
        Parrot_str_free_cstring(str);
    EMBED_API_CALLOUT(interp_pmc, interp);
}
Exemple #2
0
PARROT_API
Parrot_Int
Parrot_api_pmc_new_from_class(ARGIN(Parrot_PMC interp_pmc), ARGIN(Parrot_PMC class_pmc),
        ARGIN_NULLOK(Parrot_PMC init), ARGOUT(Parrot_PMC * pmc))
{
    ASSERT_ARGS(Parrot_api_pmc_new_from_class)
    EMBED_API_CALLIN(interp_pmc, interp)
    Parrot_PMC initializer = init ? init : PMCNULL;
    *pmc = VTABLE_instantiate(interp, class_pmc, initializer);
    EMBED_API_CALLOUT(interp_pmc, interp)
}
Exemple #3
0
PARROT_API
Parrot_Int
Parrot_api_pmc_deserialize(ARGIN(Parrot_PMC interp_pmc), ARGIN(Parrot_String fpmc),
        ARGOUT(Parrot_PMC * pmc))
{
    ASSERT_ARGS(Parrot_api_pmc_deserialize)
    EMBED_API_CALLIN(interp_pmc, interp)
    Parrot_pf_verify_image_string(interp, fpmc);
    *pmc = Parrot_thaw(interp, fpmc);
    EMBED_API_CALLOUT(interp_pmc, interp);
}
Exemple #4
0
PARROT_API
Parrot_Int
Parrot_api_string_export_ascii(ARGIN(Parrot_PMC interp_pmc), ARGIN(Parrot_String string),
        ARGOUT(char ** strout))
{
    ASSERT_ARGS(Parrot_api_string_export_ascii)
    EMBED_API_CALLIN(interp_pmc, interp);
    if (!STRING_IS_NULL(string))
        *strout = Parrot_str_to_cstring(interp, string);
    else
        *strout = NULL;
    EMBED_API_CALLOUT(interp_pmc, interp);
}
Exemple #5
0
PARROT_API
Parrot_Int
Parrot_api_get_result(Parrot_PMC interp_pmc, ARGOUT(Parrot_Int *is_error),
        ARGOUT(Parrot_PMC *exception), ARGOUT(Parrot_Int *exit_code),
        ARGOUT(Parrot_String *errmsg))
{
    ASSERT_ARGS(Parrot_api_get_result)
    EMBED_API_CALLIN(interp_pmc, interp)
    *exit_code = interp->exit_code;
    *exception = interp->final_exception;
    if (PMC_IS_NULL(*exception)) {
        *is_error = 0;
        *errmsg = STRINGNULL;
    }
    else {
        STRING * const severity_str = Parrot_str_new(interp, "severity", 0);
        const INTVAL severity = VTABLE_get_integer_keyed_str(interp, *exception, severity_str);
        *is_error = (severity != EXCEPT_exit);
        *errmsg = VTABLE_get_string(interp, *exception);
    }
    interp->final_exception = PMCNULL;
    interp->exit_code = 0;
    EMBED_API_CALLOUT(interp_pmc, interp)
}