Reduct  v4.1.3-1-gd06c383
A functional and immutable language.
Loading...
Searching...
No Matches
Core

Detailed Description

Data Structures

struct  reduct_global_t
 Global state structure. More...
 
struct  reduct_t
 Per-thread state structure. More...
 

Macros

#define REDUCT_SCHEMA_INITIAL   4
 Initial size of the schema array.
 
#define REDUCT_SCHEMA_GROWTH   2
 Growth factor of the schema array.
 
#define REDUCT_CONSTANTS_MAX   8
 Maximum amount of predefined constants.
 
#define REDUCT_SCRATCH_INITIAL   128
 Initial scratch buffer size.
 
#define REDUCT_SCRATCH_MAX   16
 The maximum number of scratch buffers.
 

Functions

REDUCT_API reduct_treduct_new (void)
 Create a new Reduct environment.
 
REDUCT_API void reduct_free (reduct_t *reduct)
 Free the Reduct structure.
 
REDUCT_API void reduct_userdata_set (reduct_t *reduct, void *userdata)
 Set the user data pointer for the Reduct structure.
 
REDUCT_API void * reduct_userdata_get (reduct_t *reduct)
 Get the user data pointer from the Reduct structure.
 
REDUCT_API void reduct_args_set (reduct_t *reduct, int argc, char **argv)
 Set the command line arguments for the Reduct structure.
 
static REDUCT_ALWAYS_INLINE uint32_t reduct_hash (const char *str, size_t len)
 Hash a string.
 

Macro Definition Documentation

◆ REDUCT_SCHEMA_INITIAL

#define REDUCT_SCHEMA_INITIAL   4

Initial size of the schema array.

Definition at line 33 of file core.h.

◆ REDUCT_SCHEMA_GROWTH

#define REDUCT_SCHEMA_GROWTH   2

Growth factor of the schema array.

Definition at line 34 of file core.h.

◆ REDUCT_CONSTANTS_MAX

#define REDUCT_CONSTANTS_MAX   8

Maximum amount of predefined constants.

Definition at line 36 of file core.h.

◆ REDUCT_SCRATCH_INITIAL

#define REDUCT_SCRATCH_INITIAL   128

Initial scratch buffer size.

Definition at line 38 of file core.h.

◆ REDUCT_SCRATCH_MAX

#define REDUCT_SCRATCH_MAX   16

The maximum number of scratch buffers.

Definition at line 39 of file core.h.

Function Documentation

◆ reduct_new()

REDUCT_API reduct_t * reduct_new ( void  )

Create a new Reduct environment.

Returns
A pointer to the first per thread state structure of the new environment or NULL.

◆ reduct_free()

REDUCT_API void reduct_free ( reduct_t reduct)

Free the Reduct structure.

Parameters
reductPointer to the Reduct structure to free.

◆ reduct_userdata_set()

REDUCT_API void reduct_userdata_set ( reduct_t reduct,
void *  userdata 
)

Set the user data pointer for the Reduct structure.

Parameters
reductPointer to the Reduct structure.
userdataThe user data pointer.

◆ reduct_userdata_get()

REDUCT_API void * reduct_userdata_get ( reduct_t reduct)

Get the user data pointer from the Reduct structure.

Parameters
reductPointer to the Reduct structure.
Returns
The user data pointer.

◆ reduct_args_set()

REDUCT_API void reduct_args_set ( reduct_t reduct,
int  argc,
char **  argv 
)

Set the command line arguments for the Reduct structure.

Will be utilized by the (args!) native.

Parameters
reductPointer to the Reduct structure.
argcThe number of arguments.
argvThe argument strings.

◆ reduct_hash()

static REDUCT_ALWAYS_INLINE uint32_t reduct_hash ( const char *  str,
size_t  len 
)
inlinestatic

Hash a string.

Parameters
strThe string to hash.
lenThe length of the string.
Returns
The hash of the string.

Definition at line 126 of file core.h.