Rename 'state' to 'scope'
This commit is contained in:
28
src/lisp.h
28
src/lisp.h
@@ -4,19 +4,19 @@
|
||||
#include "uclisp.h"
|
||||
#include "utility.h"
|
||||
|
||||
#define LISP_FUNC_0(func_name, state_name) \
|
||||
#define LISP_FUNC_0(func_name, scope_name) \
|
||||
static struct ucl_object *func_name##_impl(); \
|
||||
struct ucl_object *func_name(struct ucl_state *state, struct ucl_object *args) { \
|
||||
struct ucl_object *func_name(struct ucl_scope *scope, struct ucl_object *args) { \
|
||||
if (args->cell.car != NULL) { \
|
||||
return NULL; \
|
||||
} \
|
||||
return func_name##_impl(state_name); \
|
||||
return func_name##_impl(scope_name); \
|
||||
} \
|
||||
static struct ucl_object *func_name##_impl(struct ucl_state *state)
|
||||
static struct ucl_object *func_name##_impl(struct ucl_scope *scope)
|
||||
|
||||
#define LISP_FUNC_1(func_name, state_name, arg0_name) \
|
||||
static struct ucl_object *func_name##_impl(struct ucl_state *state, struct ucl_object *arg0_name); \
|
||||
struct ucl_object *func_name(struct ucl_state *state, struct ucl_object *args) { \
|
||||
#define LISP_FUNC_1(func_name, scope_name, arg0_name) \
|
||||
static struct ucl_object *func_name##_impl(struct ucl_scope *scope, struct ucl_object *arg0_name); \
|
||||
struct ucl_object *func_name(struct ucl_scope *scope, struct ucl_object *args) { \
|
||||
struct ucl_object *len_obj = ucl_list_length(args); \
|
||||
if (len_obj->type != UCL_TYPE_INT) { \
|
||||
return NULL; \
|
||||
@@ -25,14 +25,14 @@
|
||||
return NULL; \
|
||||
} \
|
||||
struct ucl_object *arg0 = ucl_car(args); \
|
||||
return func_name##_impl(state_name, arg0); \
|
||||
return func_name##_impl(scope_name, arg0); \
|
||||
} \
|
||||
static struct ucl_object *func_name##_impl(struct ucl_state *state, struct ucl_object *arg0_name)
|
||||
static struct ucl_object *func_name##_impl(struct ucl_scope *scope, struct ucl_object *arg0_name)
|
||||
|
||||
// TODO: Unroll the args more efficiently, this is O(n^2)
|
||||
#define LISP_FUNC_2(func_name, state_name, arg0_name, arg1_name) \
|
||||
static struct ucl_object *func_name##_impl(struct ucl_state *state, struct ucl_object *arg0_name, struct ucl_object *arg1_name); \
|
||||
struct ucl_object *func_name(struct ucl_state *state, struct ucl_object *args) { \
|
||||
#define LISP_FUNC_2(func_name, scope_name, arg0_name, arg1_name) \
|
||||
static struct ucl_object *func_name##_impl(struct ucl_scope *scope, struct ucl_object *arg0_name, struct ucl_object *arg1_name); \
|
||||
struct ucl_object *func_name(struct ucl_scope *scope, struct ucl_object *args) { \
|
||||
struct ucl_object *len_obj = ucl_list_length(args); \
|
||||
if (len_obj->type != UCL_TYPE_INT) { \
|
||||
return NULL; \
|
||||
@@ -42,8 +42,8 @@
|
||||
} \
|
||||
struct ucl_object *arg0 = ucl_list_nth(args, 0); \
|
||||
struct ucl_object *arg1 = ucl_list_nth(args, 1); \
|
||||
return func_name##_impl(state_name, arg0, arg1); \
|
||||
return func_name##_impl(scope_name, arg0, arg1); \
|
||||
} \
|
||||
static struct ucl_object *func_name##_impl(struct ucl_state *state, struct ucl_object *arg0_name, struct ucl_object *arg1_name)
|
||||
static struct ucl_object *func_name##_impl(struct ucl_scope *scope, struct ucl_object *arg0_name, struct ucl_object *arg1_name)
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user