muon/include/lang/eval.h
Stone Tickle 9cb9d858c9
lots of small changes
- wip "unencapsulated" module.  This just means that the module is
  loaded into the global scope.  You could then write functions like
  `vcs_tag` in this global module to be used by all meson files.  This
  might be removed.
- remove export() function and instead use a lua-like return to export
  from the module.
- track language mode in function definitions.  Necessary for functions
  to use internal-only functions.
- use assigned function name in error messages
- fix embedded source reopening in error messages
- reduce number of node types that get marked as dead code
- create true/false bools on workspace initialization with known ids.
  Future code should use these rather than making new boolean objects to
  save memory.
- add a new test script-module
2023-11-27 12:45:53 -05:00

40 lines
984 B
C

/*
* SPDX-FileCopyrightText: Stone Tickle <lattis@mochiro.moe>
* SPDX-License-Identifier: GPL-3.0-only
*/
#ifndef MUON_LANG_EVAL_H
#define MUON_LANG_EVAL_H
#include <stdarg.h>
#include <stdbool.h>
#include <stdint.h>
#include "lang/types.h"
struct workspace;
struct source;
struct darr;
enum eval_mode {
eval_mode_default,
eval_mode_repl,
eval_mode_first,
};
struct source_data {
char *data;
uint64_t data_len;
};
void source_data_destroy(struct source_data *sdata);
bool eval_project(struct workspace *wk, const char *subproject_name, const char *cwd,
const char *build_dir, uint32_t *proj_id);
bool eval_project_file(struct workspace *wk, const char *path, bool first);
bool eval(struct workspace *wk, struct source *src, enum eval_mode mode, obj *res);
bool eval_str(struct workspace *wk, const char *str, enum eval_mode mode, obj *res);
void repl(struct workspace *wk, bool dbg);
const char *determine_project_root(struct workspace *wk, const char *path);
#endif