diff --git a/minilang b/minilang index 33ce799..6200b08 160000 --- a/minilang +++ b/minilang @@ -1 +1 @@ -Subproject commit 33ce7998df6a8eaa5755d5248a79505c08bc8d11 +Subproject commit 6200b0881cc90b9bd098a943c156f70e2b991fd9 diff --git a/rabs.c b/rabs.c index a186aeb..f1bca0e 100644 --- a/rabs.c +++ b/rabs.c @@ -26,6 +26,8 @@ static int EchoCommands = 0; static stringmap_t Globals[1] = {STRINGMAP_INIT}; static stringmap_t Defines[1] = {STRINGMAP_INIT}; +static int SavedArgc; +static char **SavedArgv; static ml_value_t *rabs_ml_get(void *Data, const char *Name) { ml_value_t *Value = context_symb_get(CurrentContext, Name); @@ -55,6 +57,7 @@ static ml_value_t *rabs_ml_global(void *Data, const char *Name) { } static void load_file(const char *FileName) { + if (MonitorFiles) targetwatch_add(FileName, (target_t *)-1); ml_value_t *Closure = ml_load(rabs_ml_global, NULL, FileName); if (Closure->Type == MLErrorT) { printf("\e[31mError: %s\n\e[0m", ml_error_message(Closure)); @@ -335,7 +338,14 @@ static ml_value_t *debug(void *Data, int Count, ml_value_t **Args) { return MLNil; } -int main(int Argc, const char **Argv) { +void restart() { + cache_close(); + execv(SavedArgv[0], SavedArgv); +} + +int main(int Argc, char **Argv) { + SavedArgc = Argc; + SavedArgv = Argv; GC_INIT(); ml_init(); AppendMethod = ml_method("append"); diff --git a/rabs.h b/rabs.h index 8b9bd8d..c05b157 100644 --- a/rabs.h +++ b/rabs.h @@ -6,5 +6,6 @@ extern const char *RootPath, *SystemName; extern __thread const char *CurrentPath; +void restart(); #endif diff --git a/target.c b/target.c index 52798e5..af2a828 100644 --- a/target.c +++ b/target.c @@ -182,6 +182,7 @@ void target_update(target_t *Target) { } void target_recheck(target_t *Target) { + if (Target == (target_t *)-1) restart(); printf("Rechecking %s\n", Target->Id); cache_bump_version(); ++QueuedTargets;