view build/config.c.in @ 40:9b496a0c430a

merge
author anatofuz
date Tue, 27 Nov 2018 11:25:43 +0900
parents 2cf249471370
children
line wrap: on
line source

/* !!!
 * If you're looking at config.c and thinking of editing - this is a
 * generated file. See build/config.c.in, unless you're just twiddling
 * to get things to work on your platform before updating Configure,
 * in which case go right ahead. :-)
 * !!!
 */

#include "moar.h"

#define add_entry(tc, hash, name, value) do { \
    MVMString * const key = MVM_string_ascii_decode_nt(tc, tc->instance->VMString, (name)); \
    MVMROOT(tc, key, { \
        MVMString * const value_str = MVM_string_ascii_decode_nt(tc, tc->instance->VMString, (value)); \
        MVMObject * const boxed_value = MVM_repr_box_str(tc, MVM_hll_current(tc)->str_box_type, value_str); \
        MVM_repr_bind_key_o(tc, hash, key, boxed_value); \
    }); \
} while (0)

MVMObject *MVM_backend_config(MVMThreadContext *tc) {
    MVMObject *config = tc->instance->cached_backend_config;
    if (config)
        return config;

    config = MVM_repr_alloc_init(tc, tc->instance->boot_types.BOOTHash);
    MVMROOT(tc, config, {
@backendconfig@
    });
    tc->instance->cached_backend_config = config;

    return config;
}