Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Chris Müller
cherry
Commits
2deac920
Commit
2deac920
authored
Jul 15, 2013
by
Chris Müller
Browse files
Reorganize core runtime functions
Move and rename some core- and system functions for the toplevel environment.
parent
6b36f4e8
Changes
6
Show whitespace changes
Inline
Side-by-side
include/cherry/primitives.h
View file @
2deac920
...
@@ -20,16 +20,14 @@
...
@@ -20,16 +20,14 @@
#include
"cherry/runtime.h"
#include
"cherry/runtime.h"
struct
org_cherry_value
*
org_cherry_core_type
(
struct
org_cherry_environment
*
env
,
struct
org_cherry_value
*
args
);
struct
org_cherry_value
*
org_cherry_core_type
(
struct
org_cherry_environment
*
env
,
struct
org_cherry_value
*
args
);
struct
org_cherry_value
*
org_cherry_core_raise
(
struct
org_cherry_environment
*
env
,
struct
org_cherry_value
*
args
);
struct
org_cherry_value
*
org_cherry_core_add
(
struct
org_cherry_environment
*
env
,
struct
org_cherry_value
*
args
);
struct
org_cherry_value
*
org_cherry_core_add
(
struct
org_cherry_environment
*
env
,
struct
org_cherry_value
*
args
);
struct
org_cherry_value
*
org_cherry_core_sub
(
struct
org_cherry_environment
*
env
,
struct
org_cherry_value
*
args
);
struct
org_cherry_value
*
org_cherry_core_sub
(
struct
org_cherry_environment
*
env
,
struct
org_cherry_value
*
args
);
struct
org_cherry_value
*
org_cherry_core_mul
(
struct
org_cherry_environment
*
env
,
struct
org_cherry_value
*
args
);
struct
org_cherry_value
*
org_cherry_core_mul
(
struct
org_cherry_environment
*
env
,
struct
org_cherry_value
*
args
);
struct
org_cherry_value
*
org_cherry_core_div
(
struct
org_cherry_environment
*
env
,
struct
org_cherry_value
*
args
);
struct
org_cherry_value
*
org_cherry_core_div
(
struct
org_cherry_environment
*
env
,
struct
org_cherry_value
*
args
);
struct
org_cherry_value
*
org_cherry_io_println
(
struct
org_cherry_environment
*
env
,
struct
org_cherry_value
*
args
);
struct
org_cherry_value
*
org_cherry_primitive_println
(
struct
org_cherry_environment
*
env
,
struct
org_cherry_value
*
args
);
struct
org_cherry_value
*
org_cherry_system_exit
(
struct
org_cherry_environment
*
env
,
struct
org_cherry_value
*
args
);
struct
org_cherry_value
*
org_cherry_primitive_raise
(
struct
org_cherry_environment
*
env
,
struct
org_cherry_value
*
args
);
struct
org_cherry_value
*
org_cherry_primitive_exit
(
struct
org_cherry_environment
*
env
,
struct
org_cherry_value
*
args
);
source/CMakeLists.txt
View file @
2deac920
...
@@ -7,7 +7,7 @@ set(CORE_SOURCES
...
@@ -7,7 +7,7 @@ set(CORE_SOURCES
tables.c
tables.c
exception.c
exception.c
primitives/core.c
primitives/core.c
primitives/
print
.c
primitives/
io
.c
primitives/system.c
)
primitives/system.c
)
set
(
INTERPRETER_SOURCES
set
(
INTERPRETER_SOURCES
...
...
source/primitives/core.c
View file @
2deac920
...
@@ -210,5 +210,14 @@ org_cherry_core_div(struct org_cherry_environment* env, struct org_cherry_value*
...
@@ -210,5 +210,14 @@ org_cherry_core_div(struct org_cherry_environment* env, struct org_cherry_value*
return
v
;
return
v
;
}
}
struct
org_cherry_value
*
org_cherry_core_raise
(
struct
org_cherry_environment
*
env
,
struct
org_cherry_value
*
args
)
{
if
(
IS_NULL
(
args
))
org_cherry_env_raise
(
env
,
org_cherry_emptylist
);
else
org_cherry_env_raise
(
env
,
HEAD
(
args
));
return
org_cherry_false
;
}
source/primitives/
print
.c
→
source/primitives/
io
.c
View file @
2deac920
...
@@ -20,7 +20,7 @@
...
@@ -20,7 +20,7 @@
#include
<stdio.h>
#include
<stdio.h>
struct
org_cherry_value
*
struct
org_cherry_value
*
org_cherry_
primitive
_println
(
struct
org_cherry_environment
*
env
,
struct
org_cherry_value
*
args
)
org_cherry_
io
_println
(
struct
org_cherry_environment
*
env
,
struct
org_cherry_value
*
args
)
{
{
while
(
!
IS_NULL
(
args
))
{
while
(
!
IS_NULL
(
args
))
{
struct
org_cherry_value
*
v
=
HEAD
(
args
);
struct
org_cherry_value
*
v
=
HEAD
(
args
);
...
...
source/primitives/system.c
View file @
2deac920
...
@@ -20,18 +20,9 @@
...
@@ -20,18 +20,9 @@
#include
<stdlib.h>
#include
<stdlib.h>
struct
org_cherry_value
*
struct
org_cherry_value
*
org_cherry_
primitive
_exit
(
struct
org_cherry_environment
*
env
,
struct
org_cherry_value
*
args
)
org_cherry_
system
_exit
(
struct
org_cherry_environment
*
env
,
struct
org_cherry_value
*
args
)
{
{
return
org_cherry_false
;
return
org_cherry_false
;
}
}
struct
org_cherry_value
*
org_cherry_primitive_raise
(
struct
org_cherry_environment
*
env
,
struct
org_cherry_value
*
args
)
{
if
(
IS_NULL
(
args
))
org_cherry_env_raise
(
env
,
org_cherry_emptylist
);
else
org_cherry_env_raise
(
env
,
HEAD
(
args
));
return
org_cherry_false
;
}
source/value.c
View file @
2deac920
...
@@ -400,8 +400,8 @@ org_cherry_environment(void)
...
@@ -400,8 +400,8 @@ org_cherry_environment(void)
#define proc_to_env(ENV, STR, FUN) \
#define proc_to_env(ENV, STR, FUN) \
org_cherry_env_add(ENV, org_cherry_symbol(STR), org_cherry_primitive(FUN))
org_cherry_env_add(ENV, org_cherry_symbol(STR), org_cherry_primitive(FUN))
proc_to_env
(
env
,
"println"
,
org_cherry_
primitive
_println
);
proc_to_env
(
env
,
"println"
,
org_cherry_
io
_println
);
proc_to_env
(
env
,
"raise"
,
org_cherry_
primitiv
e_raise
);
proc_to_env
(
env
,
"raise"
,
org_cherry_
cor
e_raise
);
proc_to_env
(
env
,
"type"
,
org_cherry_core_type
);
proc_to_env
(
env
,
"type"
,
org_cherry_core_type
);
proc_to_env
(
env
,
"+"
,
org_cherry_core_add
);
proc_to_env
(
env
,
"+"
,
org_cherry_core_add
);
proc_to_env
(
env
,
"-"
,
org_cherry_core_sub
);
proc_to_env
(
env
,
"-"
,
org_cherry_core_sub
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment