add optional wren features

This commit is contained in:
Babz 2021-09-10 18:29:10 +02:00
parent e9c9a38e63
commit 7f847283a5
3 changed files with 6 additions and 7 deletions

View File

@ -29,9 +29,8 @@ set(SOURCES
wren/src/wren_utils.c
wren/src/wren_value.c
wren/src/wren_vm.c
#wren/src/wren_opt_meta.c
#wren/src/wren_opt_random.c
wren/src/wren_opt_meta.c
wren/src/wren_opt_random.c
)
# shared assets
set(ASSETS

View File

@ -48,11 +48,11 @@
// these or not. By default, they are all available. To disable one, set the
// corresponding `WREN_OPT_<name>` define to `0`.
#ifndef WREN_OPT_META
#define WREN_OPT_META 0
#define WREN_OPT_META 1
#endif
#ifndef WREN_OPT_RANDOM
#define WREN_OPT_RANDOM 0
#define WREN_OPT_RANDOM 1
#endif
// These flags are useful for debugging and hacking on Wren itself. They are not

View File

@ -3,7 +3,7 @@
#if WREN_OPT_RANDOM
#include <string.h>
#include <time.h>
#include <gint/rtc.h>
#include "wren.h"
#include "wren_vm.h"
@ -47,7 +47,7 @@ static void randomSeed0(WrenVM* vm)
{
Well512* well = (Well512*)wrenGetSlotForeign(vm, 0);
srand((uint32_t)time(NULL));
srand(rtc_ticks());
for (int i = 0; i < 16; i++)
{
well->state[i] = rand();