w32tex
About: TeX Live provides a comprehensive TeX system including all the major TeX-related programs, macro packages, and fonts that are free software. Windows sources.
  Fossies Dox: w32tex-src.tar.xz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

state.c File Reference
#include <stdlib.h>
#include <string.h>
#include <mruby.h>
#include <mruby/irep.h>
#include <mruby/variable.h>
#include <mruby/debug.h>
#include <mruby/class.h>
Include dependency graph for state.c:

Go to the source code of this file.

Functions

void mrb_init_core (mrb_state *)
 
void mrb_init_mrbgems (mrb_state *)
 
void mrb_gc_init (mrb_state *, mrb_gc *gc)
 
void mrb_gc_destroy (mrb_state *, mrb_gc *gc)
 
int mrb_core_init_protect (mrb_state *mrb, void(*body)(mrb_state *, void *), void *opaque)
 
static void init_gc_and_core (mrb_state *mrb, void *opaque)
 
mrb_statemrb_open_core (mrb_allocf f, void *ud)
 
voidmrb_default_allocf (mrb_state *mrb, void *p, size_t size, void *ud)
 
mrb_statemrb_open (void)
 
static void init_mrbgems (mrb_state *mrb, void *opaque)
 
mrb_statemrb_open_allocf (mrb_allocf f, void *ud)
 
void mrb_free_symtbl (mrb_state *mrb)
 
void mrb_irep_incref (mrb_state *mrb, mrb_irep *irep)
 
void mrb_irep_decref (mrb_state *mrb, mrb_irep *irep)
 
void mrb_irep_cutref (mrb_state *mrb, mrb_irep *irep)
 
void mrb_irep_free (mrb_state *mrb, mrb_irep *irep)
 
void mrb_free_context (mrb_state *mrb, struct mrb_context *c)
 
int mrb_protect_atexit (mrb_state *mrb)
 
void mrb_close (mrb_state *mrb)
 
mrb_irepmrb_add_irep (mrb_state *mrb)
 
mrb_value mrb_top_self (mrb_state *mrb)
 
void mrb_state_atexit (mrb_state *mrb, mrb_atexit_func f)
 

Function Documentation

◆ init_gc_and_core()

static void init_gc_and_core ( mrb_state mrb,
void opaque 
)
static

Definition at line 25 of file state.c.

References mrb_state::c, mrb_state::gc, mrb_gc_init(), mrb_init_core(), mrb_malloc(), and mrb_state::root_c.

Referenced by mrb_open_core().

◆ init_mrbgems()

static void init_mrbgems ( mrb_state mrb,
void opaque 
)
static

Definition at line 82 of file state.c.

References mrb_init_mrbgems().

Referenced by mrb_open_allocf().

◆ mrb_add_irep()

mrb_irep* mrb_add_irep ( mrb_state mrb)

Definition at line 196 of file state.c.

References mrb_malloc(), and mrb_irep::refcnt.

Referenced by read_irep_record_1(), and scope_add_irep().

◆ mrb_close()

◆ mrb_core_init_protect()

int mrb_core_init_protect ( mrb_state mrb,
void(*)(mrb_state *, void *)  body,
void opaque 
)

◆ mrb_default_allocf()

void* mrb_default_allocf ( mrb_state mrb,
void p,
size_t  size,
void ud 
)

The default allocation function.

See also
mrb_allocf

Definition at line 61 of file state.c.

References free, NULL, p, realloc, and size.

Referenced by main(), mrb_open(), and mrb_open_core().

◆ mrb_free_context()

void mrb_free_context ( mrb_state mrb,
struct mrb_context c 
)

Definition at line 171 of file state.c.

References c, and mrb_free().

Referenced by mrb_close(), and obj_free().

◆ mrb_free_symtbl()

void mrb_free_symtbl ( mrb_state mrb)

Definition at line 346 of file symbol.c.

References i, symbol_name::lit, mrb_free(), symbol_name::name, mrb_state::symidx, and mrb_state::symtbl.

Referenced by mrb_close().

◆ mrb_gc_destroy()

void mrb_gc_destroy ( mrb_state mrb,
mrb_gc gc 
)

Definition at line 442 of file gc.c.

References free_heap(), gen-ucd-table::gc, and mrb_free().

Referenced by mrb_close().

◆ mrb_gc_init()

void mrb_gc_init ( mrb_state mrb,
mrb_gc gc 
)

◆ mrb_init_core()

◆ mrb_init_mrbgems()

void mrb_init_mrbgems ( mrb_state mrb)

Definition at line 349 of file mrbc.c.

Referenced by init_mrbgems().

◆ mrb_irep_cutref()

void mrb_irep_cutref ( mrb_state mrb,
mrb_irep irep 
)

Definition at line 127 of file state.c.

References mrb_irep::flags, for(), i, mrb_irep_decref(), MRB_IREP_NO_FREE, NULL, mrb_irep::reps, and mrb_irep::rlen.

Referenced by obj_free().

◆ mrb_irep_decref()

void mrb_irep_decref ( mrb_state mrb,
mrb_irep irep 
)

◆ mrb_irep_free()

◆ mrb_irep_incref()

void mrb_irep_incref ( mrb_state mrb,
mrb_irep irep 
)

Definition at line 110 of file state.c.

References mrb_irep::flags, MRB_IREP_NO_FREE, and mrb_irep::refcnt.

Referenced by mrb_proc_copy(), and mrb_proc_new().

◆ mrb_open()

mrb_state* mrb_open ( void  )

Creates new mrb_state.

Returns
Pointer to the newly created mrb_state.

Definition at line 73 of file state.c.

References mrb_default_allocf(), mrb_open_allocf(), and NULL.

Referenced by aptex_commands_init(), FuzzRB(), LLVMFuzzerTestOneInput(), and main().

◆ mrb_open_allocf()

mrb_state* mrb_open_allocf ( mrb_allocf  f,
void ud 
)

Create new mrb_state with custom allocators.

Parameters
fReference to the allocation function.
udUser data will be passed to custom allocator f. If user data isn't required just pass NULL.
Returns
Pointer to the newly created mrb_state.

Definition at line 89 of file state.c.

References f, init_mrbgems(), mrb_close(), mrb_core_init_protect(), mrb_gc_arena_restore(), mrb_open_core(), and NULL.

Referenced by mrb_open().

◆ mrb_open_core()

mrb_state* mrb_open_core ( mrb_allocf  f,
void ud 
)

Create new mrb_state with just the MRuby core

Parameters
fReference to the allocation function. Use mrb_default_allocf for the default
udUser data will be passed to custom allocator f. If user data isn't required just pass NULL.
Returns
Pointer to the newly created mrb_state.

Definition at line 38 of file state.c.

References mrb_state::allocf, mrb_state::allocf_ud, mrb_state::atexit_stack_len, f, init_gc_and_core(), mrb_close(), mrb_core_init_protect(), mrb_default_allocf(), and NULL.

Referenced by main(), and mrb_open_allocf().

◆ mrb_protect_atexit()

int mrb_protect_atexit ( mrb_state mrb)

◆ mrb_state_atexit()

◆ mrb_top_self()

mrb_value mrb_top_self ( mrb_state mrb)

Definition at line 209 of file state.c.

References mrb_obj_value(), and mrb_state::top_self.

Referenced by decl_lv_underscore(), load_irep(), main(), mrb_load_exec(), and mrb_load_proc().