#include "muse_opcodes.h"#include "muse_builtins.h"#include "muse_port.h"#include <stdio.h>#include <stdlib.h>#include <wchar.h>#include <string.h>#include <sys/time.h>Include dependency graph for muse.c:

Data Structures | |
| struct | _bs |
Functions | |
| static void | init_stack (muse_stack *s, int size) |
| static void | destroy_stack (muse_stack *s) |
| static muse_boolean | realloc_stack (muse_stack *s, int new_size) |
| static muse_boolean | ensure_stack (muse_stack *s, int items) |
| Makes sure that there is space enough on the stack for "items" cells to be placed. | |
| static void | init_heap (muse_heap *heap, int heap_size) |
| static void | destroy_heap (muse_heap *heap) |
| static muse_boolean | grow_heap (muse_heap *heap, int new_size) |
| static void | init_builtin_symbols (muse_cell *s) |
| static void | init_parameters (muse_env *env, const int *parameters) |
| muse_env * | muse_init_env (const int *parameters) |
| Creates a new muse environment. | |
| void | muse_network_shutdown () |
| void | muse_destroy_env (muse_env *env) |
| Destroys the given environment. | |
| muse_env * | muse_get_current_env () |
| Returns the current muse environment or NULL if none is set. | |
| muse_env * | muse_set_current_env (muse_env *env) |
| Changes the current muse environment to the given one. | |
| muse_cell | muse_cons (muse_cell head, muse_cell tail) |
| Allocates a new cons cell with the given head and tail cells. | |
| muse_cell | muse_mk_int (muse_int i) |
| Allocates a new integer cell to hold the given integer. | |
| muse_cell | muse_mk_float (muse_float f) |
| Allocates a new float cell to hold the given integer. | |
| int | muse_stack_pos () |
| Returns the current stack position. | |
| void | muse_stack_unwind (int stack_pos) |
| Unwinds the stack to the given position. | |
| muse_cell | muse_stack_push (muse_cell obj) |
| Saves the given object on the stack so that it will not be garbage collected when gc is next invoked. | |
| static void | add_special (muse_cell special) |
| muse_cell | muse_mk_text (const muse_char *start, const muse_char *end) |
| Copies the given text and creates a new text cell to store it. | |
| muse_cell | muse_mk_text_utf8 (const char *start, const char *end) |
Same as muse_mk_text() except that it takes a UTF8 string and converts it into a unicode string and stores it. | |
| muse_cell | muse_mk_ctext (const muse_char *start) |
Same as muse_mk_text() except that it assumes a null terminated string. | |
| muse_cell | muse_mk_ctext_utf8 (const char *start) |
Same as muse_mk_text_utf8() except that it assumes a null terminated string as input. | |
| muse_cell | muse_mk_nativefn (muse_nativefn_t fn, void *context) |
| Creates a new cell that stores a C function. | |
| muse_cell | muse_mk_destructor (muse_nativefn_t fn, void *context) |
| A destructor is a native function that also gets called with no arguments when the function is garbage collected. | |
| static muse_cell | lookup_symbol (const muse_char *start, const muse_char *end, muse_int *out_hash) |
| muse_cell | muse_symbol (const muse_char *start, const muse_char *end) |
| Returns a reference to a named symbol with the given name. | |
| muse_cell | muse_csymbol (const muse_char *sym) |
Same as muse_symbol(), but takes a c-style null terminated unicode character string. | |
| muse_cell | muse_symbol_utf8 (const char *start, const char *end) |
Same as muse_symbol() except that it takes a UTF8 string. | |
| muse_cell | muse_csymbol_utf8 (const char *sym) |
Same as muse_symbol_utf8() except that it takes a c-style null terminated utf8 string. | |
| muse_cell | muse_builtin_symbol (muse_builtin_symbol_t s) |
| Returns a symbol reference corresponding to the given symbol index. | |
| muse_cell | muse_mk_anon_symbol () |
| An anonymous symbol is similar to a named symbol, except that it is not stored permanently on the symbol stack. | |
| void | muse_mark (muse_cell c) |
| Prior to garbage collection, muse_mark is called on all cells which are referenced somewhere and should not be garbage collected. | |
| static void | mark_stack (muse_stack *stack) |
| static void | free_text (muse_cell t) |
| void | free_unused_specials (muse_cell *specials) |
| void | collect_free_cells (muse_heap *heap) |
| void | muse_gc_impl (int free_cells_needed) |
| void | muse_gc (int free_cells_needed) |
| Collects all the garbage cells - i.e. | |
| muse_cell | muse_mk_functional_object (muse_functional_object_type_t *type_info, muse_cell init_args) |
| Creates a new functional object instance based on the given type information. | |
| muse_functional_object_t * | muse_functional_object_data (muse_cell fobj, int type_word) |
| Returns the data pointer of the functional object, or NULL if the object is not a functional object. | |
Variables | |
| muse_env * | g_muse_env = NULL |
| The muse environment contains the heap, the various stacks and symbols, and basically everything that happens in the interpreter is w.r.t. | |
| const char * | g_muse_typenames [] |
| String names for the various cell types, intended for debugging and reporting use. | |
| static struct _bs | k_builtin_symbol_table [] |
All rights reserved. See LICENSE.txt distributed with this source code or http://muvee-symbolic-expressions.googlecode.com/svn/trunk/LICENSE.txt for terms and conditions under which this software is provided to you.
| static void init_stack | ( | muse_stack * | s, | |
| int | size | |||
| ) | [static] |
| static void destroy_stack | ( | muse_stack * | s | ) | [static] |
| static muse_boolean realloc_stack | ( | muse_stack * | s, | |
| int | new_size | |||
| ) | [static] |
| static muse_boolean ensure_stack | ( | muse_stack * | s, | |
| int | items | |||
| ) | [static] |
Makes sure that there is space enough on the stack for "items" cells to be placed.
If not, grows the stack as much as necessary.
| static void init_heap | ( | muse_heap * | heap, | |
| int | heap_size | |||
| ) | [static] |
| static void destroy_heap | ( | muse_heap * | heap | ) | [static] |
| static muse_boolean grow_heap | ( | muse_heap * | heap, | |
| int | new_size | |||
| ) | [static] |
| static void init_builtin_symbols | ( | muse_cell * | s | ) | [static] |
| static void init_parameters | ( | muse_env * | env, | |
| const int * | parameters | |||
| ) | [static] |
| void muse_network_shutdown | ( | ) |
| static void add_special | ( | muse_cell | special | ) | [static] |
| static muse_cell lookup_symbol | ( | const muse_char * | start, | |
| const muse_char * | end, | |||
| muse_int * | out_hash | |||
| ) | [static] |
| static void mark_stack | ( | muse_stack * | stack | ) | [static] |
| static void free_text | ( | muse_cell | t | ) | [static] |
| void free_unused_specials | ( | muse_cell * | specials | ) |
| void collect_free_cells | ( | muse_heap * | heap | ) |
| void muse_gc_impl | ( | int | free_cells_needed | ) |
| muse_env* g_muse_env = NULL |
The muse environment contains the heap, the various stacks and symbols, and basically everything that happens in the interpreter is w.r.t.
the environment. There is only one global muse environment that you can change using the muse_get_current_env() and muse_set_current_env() API calls. Having the muse environment global simplifies the API calls.
As of this implementation, the limitation is that only one muse environment can be the current environment in a single process. It is possible to improve this situation to allow multiple environments to be active in different threads by changing the global to a thread-local variable. Then the conbstraint would be that a single muse environment can be the current environment in only one thread at any given time.
| const char* g_muse_typenames[] |
Initial value:
{
"MUSE_CONS_CELL",
"MUSE_LAMBDA_CELL",
"MUSE_SYMBOL_CELL",
"MUSE_NATIVEFN_CELL",
"MUSE_INT_CELL",
"MUSE_FLOAT_CELL",
"MUSE_TEXT_CELL"
}
struct _bs k_builtin_symbol_table[] [static] |
1.4.7