Serene Runtime 1.0.0-dev
C runtime for the Serene programming language
Loading...
Searching...
No Matches
base.h File Reference
#include <serene/rt/context.h>
#include <serene/rt/engine.h>
#include <serene/rt/mm/interface.h>
#include <serene/utils.h>
#include "acutest.h"
Include dependency graph for base.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define ENTRY(name, test)
#define ASSERT_NOT_NULL(x)
#define MAKE_ENGINE(mm, engine)
#define SHUTDOWN_ENGINE(mm, engine)
#define MAKE_CONTEXT(engine, x)
#define RELEASE_CONTEXT(x)

Macro Definition Documentation

◆ ASSERT_NOT_NULL

#define ASSERT_NOT_NULL ( x)
Value:
TEST_ASSERT(x != nullptr)
#define TEST_ASSERT(cond)
Definition acutest.h:117

Definition at line 30 of file base.h.

◆ ENTRY

#define ENTRY ( name,
test )
Value:
{name, test}

Definition at line 28 of file base.h.

◆ MAKE_CONTEXT

#define MAKE_CONTEXT ( engine,
x )
Value:
TEST_ASSERT(x != nullptr)
srn_context_t * srn_context_make(srn_engine_t *engine)
Make an empty context, by allocating a new memory block.
Definition context.c:39

Definition at line 42 of file base.h.

42#define MAKE_CONTEXT(engine, x) \
43 srn_context_t *x = srn_context_make(engine); \
44 TEST_ASSERT(x != nullptr)

◆ MAKE_ENGINE

#define MAKE_ENGINE ( mm,
engine )
Value:
srn_mm_t *mm = srn_mm_init(nullptr); \
TEST_ASSERT(mm != nullptr); \
srn_engine_t *engine = srn_engine_make(mm, nullptr); \
TEST_ASSERT(engine != nullptr)
srn_mm_t * srn_mm_init(const srn_configuration_t *config)
Initialize the memory manager, this function will panic on error.
Definition default.c:322
srn_engine_t * srn_engine_make(srn_mm_t *mm, const srn_configuration_t *config)
Create the engine over mm, copying config (the runtime's knobs) into it.
Definition engine.c:101
Engine is a structure to own the long living and main pieces of the compiler.
Definition engine.h:51
Main memory manager structure that will own all the allocated blocks and data.
Definition interface.h:107

Definition at line 32 of file base.h.

32#define MAKE_ENGINE(mm, engine) \
33 srn_mm_t *mm = srn_mm_init(nullptr); \
34 TEST_ASSERT(mm != nullptr); \
35 srn_engine_t *engine = srn_engine_make(mm, nullptr); \
36 TEST_ASSERT(engine != nullptr)

◆ RELEASE_CONTEXT

#define RELEASE_CONTEXT ( x)
Value:
int srn_context_release(srn_context_t *ctx)
Definition context.c:64

Definition at line 46 of file base.h.

◆ SHUTDOWN_ENGINE

#define SHUTDOWN_ENGINE ( mm,
engine )
Value:
srn_mm_shutdown(mm)
void srn_engine_shutdown(srn_engine_t *engine)
Definition engine.c:154

Definition at line 38 of file base.h.

38#define SHUTDOWN_ENGINE(mm, engine) \
39 srn_engine_shutdown(engine); \
40 srn_mm_shutdown(mm)