Esempio n. 1
0
static int do_exec(void) {
    char *source_file = saffire_getopt_string(0);

    setlocale(LC_ALL,"");
    context_init();
    object_init();
    module_init();

    t_ast_element *ast = ast_generate_from_file(source_file);

    if (dot_file) {
        dot_generate(ast, dot_file);
    }

    int ret = interpreter(ast);

    // Release memory of ast root
    if (ast != NULL) {
        ast_free_node(ast);
    }

    module_fini();
    object_fini();
    context_fini();

    return ret;
}
Esempio n. 2
0
static ERL_NIF_TERM
hd512_final(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[])
{
    ContextUnion ctxu;
    ErlNifResourceType* ctx_type = (ErlNifResourceType*)enif_priv_data(env);
    if (!enif_get_resource(env, argv[0], ctx_type, &ctxu.v)) {
        return enif_make_badarg(env);
    }
    return context_fini(env, ctxu.c, DIGEST_SIZE_512, sha5xx_chunk);
}