mirror of
https://github.com/janet-lang/janet
synced 2025-10-30 07:03:02 +00:00
More updates to meson
Redo amalg script so we can more easily run it from Meson.
This commit is contained in:
86
Makefile
86
Makefile
@@ -48,23 +48,76 @@ endif
|
|||||||
# For other unix likes, add flags here!
|
# For other unix likes, add flags here!
|
||||||
|
|
||||||
$(shell mkdir -p build/core build/mainclient build/webclient build/boot)
|
$(shell mkdir -p build/core build/mainclient build/webclient build/boot)
|
||||||
|
|
||||||
# Source headers
|
|
||||||
JANET_HEADERS=$(sort $(wildcard src/include/*.h))
|
|
||||||
JANET_LOCAL_HEADERS=$(sort $(wildcard src/*/*.h))
|
|
||||||
|
|
||||||
# Source files
|
|
||||||
JANET_CORE_SOURCES=$(sort $(wildcard src/core/*.c))
|
|
||||||
JANET_MAINCLIENT_SOURCES=$(sort $(wildcard src/mainclient/*.c))
|
|
||||||
JANET_WEBCLIENT_SOURCES=$(sort $(wildcard src/webclient/*.c))
|
|
||||||
|
|
||||||
all: $(JANET_TARGET) $(JANET_LIBRARY)
|
all: $(JANET_TARGET) $(JANET_LIBRARY)
|
||||||
|
|
||||||
|
######################
|
||||||
|
##### Name Files #####
|
||||||
|
######################
|
||||||
|
|
||||||
|
JANET_HEADERS=src/include/janet.h src/include/janetconf.h
|
||||||
|
|
||||||
|
JANET_LOCAL_HEADERS=src/core/util.h \
|
||||||
|
src/core/state.h \
|
||||||
|
src/core/gc.h \
|
||||||
|
src/core/vector.h \
|
||||||
|
src/core/fiber.h \
|
||||||
|
src/core/regalloc.h \
|
||||||
|
src/core/compile.h \
|
||||||
|
src/core/emit.h \
|
||||||
|
src/core/symcache.h
|
||||||
|
|
||||||
|
JANET_CORE_SOURCES=src/core/abstract.c \
|
||||||
|
src/core/array.c \
|
||||||
|
src/core/asm.c \
|
||||||
|
src/core/buffer.c \
|
||||||
|
src/core/bytecode.c \
|
||||||
|
src/core/capi.c \
|
||||||
|
src/core/cfuns.c \
|
||||||
|
src/core/compile.c \
|
||||||
|
src/core/corelib.c \
|
||||||
|
src/core/debug.c \
|
||||||
|
src/core/emit.c \
|
||||||
|
src/core/fiber.c \
|
||||||
|
src/core/gc.c \
|
||||||
|
src/core/inttypes.c \
|
||||||
|
src/core/io.c \
|
||||||
|
src/core/marsh.c \
|
||||||
|
src/core/math.c \
|
||||||
|
src/core/os.c \
|
||||||
|
src/core/parse.c \
|
||||||
|
src/core/peg.c \
|
||||||
|
src/core/pp.c \
|
||||||
|
src/core/regalloc.c \
|
||||||
|
src/core/run.c \
|
||||||
|
src/core/specials.c \
|
||||||
|
src/core/string.c \
|
||||||
|
src/core/strtod.c \
|
||||||
|
src/core/struct.c \
|
||||||
|
src/core/symcache.c \
|
||||||
|
src/core/table.c \
|
||||||
|
src/core/tuple.c \
|
||||||
|
src/core/typedarray.c \
|
||||||
|
src/core/util.c \
|
||||||
|
src/core/value.c \
|
||||||
|
src/core/vector.c \
|
||||||
|
src/core/vm.c \
|
||||||
|
src/core/wrap.c
|
||||||
|
|
||||||
|
JANET_BOOT_SOURCES=src/boot/array_test.c \
|
||||||
|
src/boot/boot.c \
|
||||||
|
src/boot/buffer_test.c \
|
||||||
|
src/boot/number_test.c \
|
||||||
|
src/boot/system_test.c \
|
||||||
|
src/boot/table_test.c
|
||||||
|
|
||||||
|
JANET_MAINCLIENT_SOURCES=src/mainclient/line.c src/mainclient/main.c
|
||||||
|
|
||||||
|
JANET_WEBCLIENT_SOURCES=src/webclient/main.c
|
||||||
|
|
||||||
##################################################################
|
##################################################################
|
||||||
##### The bootstrap interpreter that compiles the core image #####
|
##### The bootstrap interpreter that compiles the core image #####
|
||||||
##################################################################
|
##################################################################
|
||||||
|
|
||||||
JANET_BOOT_SOURCES=$(sort $(wildcard src/boot/*.c))
|
|
||||||
JANET_BOOT_OBJECTS=$(patsubst src/%.c,build/%.boot.o,$(JANET_CORE_SOURCES) $(JANET_BOOT_SOURCES)) \
|
JANET_BOOT_OBJECTS=$(patsubst src/%.c,build/%.boot.o,$(JANET_CORE_SOURCES) $(JANET_BOOT_SOURCES)) \
|
||||||
build/boot.gen.o
|
build/boot.gen.o
|
||||||
|
|
||||||
@@ -150,8 +203,9 @@ build/boot.gen.c: src/boot/boot.janet build/xxd
|
|||||||
|
|
||||||
amalg: build/janet.c build/janet.h build/core_image.c
|
amalg: build/janet.c build/janet.h build/core_image.c
|
||||||
|
|
||||||
build/janet.c: $(JANET_LOCAL_HEADERS) $(JANET_CORE_SOURCES) tools/amalg.janet $(JANET_TARGET)
|
AMALG_SOURCE=$(JANET_LOCAL_HEADERS) $(JANET_CORE_SOURCES) build/core_image.c
|
||||||
$(JANET_TARGET) tools/amalg.janet > $@
|
build/janet.c: $(AMALG_SOURCE) tools/amalg.janet $(JANET_TARGET)
|
||||||
|
$(JANET_TARGET) tools/amalg.janet $(AMALG_SOURCE) > $@
|
||||||
|
|
||||||
build/janet.h: src/include/janet.h
|
build/janet.h: src/include/janet.h
|
||||||
cp $< $@
|
cp $< $@
|
||||||
@@ -207,12 +261,8 @@ build/doc.html: $(JANET_TARGET) tools/gendoc.janet
|
|||||||
##### Other #####
|
##### Other #####
|
||||||
#################
|
#################
|
||||||
|
|
||||||
STYLEOPTS=--style=attach --indent-switches --convert-tabs \
|
|
||||||
--align-pointer=name --pad-header --pad-oper --unpad-paren --indent-labels
|
|
||||||
format:
|
format:
|
||||||
astyle $(STYLEOPTS) */*.c
|
tools/format.sh
|
||||||
astyle $(STYLEOPTS) */*/*.c
|
|
||||||
astyle $(STYLEOPTS) */*/*.h
|
|
||||||
|
|
||||||
grammar: build/janet.tmLanguage
|
grammar: build/janet.tmLanguage
|
||||||
build/janet.tmLanguage: tools/tm_lang_gen.janet $(JANET_TARGET)
|
build/janet.tmLanguage: tools/tm_lang_gen.janet $(JANET_TARGET)
|
||||||
|
|||||||
18
README.md
18
README.md
@@ -116,17 +116,19 @@ $
|
|||||||
|
|
||||||
The C API for Janet is not yet documented but coming soon.
|
The C API for Janet is not yet documented but coming soon.
|
||||||
|
|
||||||
Janet can be embedded in a host program very easily. There is a make target `make amalg`
|
Janet can be embedded in a host program very easily. There is a make target
|
||||||
which creates the file `build/janet.c`, which is a single C file that contains all the source
|
`make amalg` which creates the file `build/janet.c`, which is a single C file
|
||||||
to Janet. This file, along with `src/include/janet/janet.h` can dragged into any C project
|
that contains all the source to Janet. This file, along with
|
||||||
and compiled into the project. Janet should be compiled with `-std=c99` on most compilers, and
|
`src/include/janet.h` and `src/include/janetconf.h` can dragged into any C
|
||||||
will need to be linked to the math library, `-lm`, and the dynamic linker, `-ldl`, if one wants
|
project and compiled into the project. Janet should be compiled with `-std=c99`
|
||||||
to be able to load dynamic modules. If there is no need for dynamic modules, add the define
|
on most compilers, and will need to be linked to the math library, `-lm`, and
|
||||||
|
the dynamic linker, `-ldl`, if one wants to be able to load dynamic modules. If
|
||||||
|
there is no need for dynamic modules, add the define
|
||||||
`-DJANET_NO_DYNAMIC_MODULES` to the compiler options.
|
`-DJANET_NO_DYNAMIC_MODULES` to the compiler options.
|
||||||
|
|
||||||
## Compiling and Running
|
## Compiling and Running
|
||||||
|
|
||||||
Janet only uses Make and batch files to compile on Posix and windows
|
Janet only requires Make and batch files to compile on Posix and windows
|
||||||
respectively. To configure janet, edit the header file src/include/janet/janet.h
|
respectively. To configure janet, edit the header file src/include/janet/janet.h
|
||||||
before compilation.
|
before compilation.
|
||||||
|
|
||||||
@@ -180,7 +182,7 @@ Building with emscripten on windows is currently unsupported.
|
|||||||
|
|
||||||
Janet also has a build file for [Meson](https://mesonbuild.com/), a cross platform build
|
Janet also has a build file for [Meson](https://mesonbuild.com/), a cross platform build
|
||||||
system. This is not currently the main supported build system, but should work on any
|
system. This is not currently the main supported build system, but should work on any
|
||||||
system that supports meson.
|
system that supports meson. Meson also provides much better IDE integration than Make or batch files.
|
||||||
|
|
||||||
## Examples
|
## Examples
|
||||||
|
|
||||||
|
|||||||
43
meson.build
43
meson.build
@@ -20,6 +20,9 @@
|
|||||||
|
|
||||||
project('janet', 'c', default_options : ['c_std=c99'])
|
project('janet', 'c', default_options : ['c_std=c99'])
|
||||||
|
|
||||||
|
# Global settings
|
||||||
|
janet_path = join_paths(get_option('prefix'), get_option('libdir'), 'janet')
|
||||||
|
|
||||||
# Link math library on all systems
|
# Link math library on all systems
|
||||||
cc = meson.get_compiler('c')
|
cc = meson.get_compiler('c')
|
||||||
m_dep = cc.find_library('m', required : false)
|
m_dep = cc.find_library('m', required : false)
|
||||||
@@ -39,6 +42,20 @@ gen = generator(xxd,
|
|||||||
boot_gen = gen.process('src/boot/boot.janet', extra_args: 'janet_gen_boot')
|
boot_gen = gen.process('src/boot/boot.janet', extra_args: 'janet_gen_boot')
|
||||||
init_gen = gen.process('src/mainclient/init.janet', extra_args: 'janet_gen_init')
|
init_gen = gen.process('src/mainclient/init.janet', extra_args: 'janet_gen_init')
|
||||||
|
|
||||||
|
# Order is important here, as some headers
|
||||||
|
# depend on other headers for the amalg target
|
||||||
|
core_headers = [
|
||||||
|
'src/core/util.h',
|
||||||
|
'src/core/state.h',
|
||||||
|
'src/core/gc.h',
|
||||||
|
'src/core/vector.h',
|
||||||
|
'src/core/fiber.h',
|
||||||
|
'src/core/regalloc.h',
|
||||||
|
'src/core/compile.h',
|
||||||
|
'src/core/emit.h',
|
||||||
|
'src/core/symcache.h'
|
||||||
|
]
|
||||||
|
|
||||||
core_src = [
|
core_src = [
|
||||||
'src/core/abstract.c',
|
'src/core/abstract.c',
|
||||||
'src/core/array.c',
|
'src/core/array.c',
|
||||||
@@ -93,7 +110,7 @@ mainclient_src = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
# Build boot binary
|
# Build boot binary
|
||||||
janet_boot = executable('janet_boot', core_src, boot_src, boot_gen,
|
janet_boot = executable('janet-boot', core_src, boot_src, boot_gen,
|
||||||
c_args : '-DJANET_BOOTSTRAP',
|
c_args : '-DJANET_BOOTSTRAP',
|
||||||
dependencies : [m_dep, dl_dep])
|
dependencies : [m_dep, dl_dep])
|
||||||
|
|
||||||
@@ -101,8 +118,7 @@ janet_boot = executable('janet_boot', core_src, boot_src, boot_gen,
|
|||||||
core_image = custom_target('core_image',
|
core_image = custom_target('core_image',
|
||||||
input : [janet_boot],
|
input : [janet_boot],
|
||||||
output : 'core_image.gen.c',
|
output : 'core_image.gen.c',
|
||||||
command : [janet_boot, '@OUTPUT@',
|
command : [janet_boot, '@OUTPUT@', 'JANET_PATH', janet_path])
|
||||||
'JANET_PATH', join_paths(get_option('prefix'), get_option('datadir'), 'janet')])
|
|
||||||
|
|
||||||
libjanet = shared_library('janet', core_src, core_image,
|
libjanet = shared_library('janet', core_src, core_image,
|
||||||
dependencies : [m_dep, dl_dep],
|
dependencies : [m_dep, dl_dep],
|
||||||
@@ -111,6 +127,25 @@ janet_mainclient = executable('janet', core_src, core_image, init_gen, mainclien
|
|||||||
dependencies : [m_dep, dl_dep],
|
dependencies : [m_dep, dl_dep],
|
||||||
install : true)
|
install : true)
|
||||||
|
|
||||||
|
# Documentation
|
||||||
|
docs = custom_target('docs',
|
||||||
|
input : ['tools/gendoc.janet'],
|
||||||
|
output : ['doc.html'],
|
||||||
|
capture : true,
|
||||||
|
command : [janet_mainclient, '@INPUT@'])
|
||||||
|
|
||||||
|
# Amalgamated source
|
||||||
|
amalg = custom_target('amalg',
|
||||||
|
input : ['tools/amalg.janet', core_headers, core_src, core_image],
|
||||||
|
output : ['janet.c'],
|
||||||
|
capture : true,
|
||||||
|
command : [janet_mainclient, '@INPUT@'])
|
||||||
|
|
||||||
|
# Amalgamated client
|
||||||
|
janet_amalgclient = executable('janet-amalg', amalg, init_gen, mainclient_src,
|
||||||
|
dependencies : [m_dep, dl_dep],
|
||||||
|
build_by_default : false)
|
||||||
|
|
||||||
# Tests
|
# Tests
|
||||||
test_files = [
|
test_files = [
|
||||||
'test/suite0.janet',
|
'test/suite0.janet',
|
||||||
@@ -138,4 +173,4 @@ janet_libs = [
|
|||||||
'tools/cook.janet',
|
'tools/cook.janet',
|
||||||
'tools/highlight.janet'
|
'tools/highlight.janet'
|
||||||
]
|
]
|
||||||
install_data(sources : janet_libs)
|
install_data(sources : janet_libs, install_dir : janet_path)
|
||||||
|
|||||||
@@ -182,8 +182,8 @@ static Janet cfun_array_concat(int32_t argc, Janet *argv) {
|
|||||||
break;
|
break;
|
||||||
case JANET_ARRAY:
|
case JANET_ARRAY:
|
||||||
case JANET_TUPLE: {
|
case JANET_TUPLE: {
|
||||||
int32_t j, len;
|
int32_t j, len = 0;
|
||||||
const Janet *vals;
|
const Janet *vals = NULL;
|
||||||
janet_indexed_view(argv[i], &vals, &len);
|
janet_indexed_view(argv[i], &vals, &len);
|
||||||
for (j = 0; j < len; j++)
|
for (j = 0; j < len; j++)
|
||||||
janet_array_push(array, vals[j]);
|
janet_array_push(array, vals[j]);
|
||||||
|
|||||||
@@ -309,9 +309,9 @@ JanetSlot *janetc_toslotskv(JanetCompiler *c, Janet ds) {
|
|||||||
JanetSlot *ret = NULL;
|
JanetSlot *ret = NULL;
|
||||||
JanetFopts subopts = janetc_fopts_default(c);
|
JanetFopts subopts = janetc_fopts_default(c);
|
||||||
const JanetKV *kvs = NULL;
|
const JanetKV *kvs = NULL;
|
||||||
int32_t cap, i, len;
|
int32_t cap = 0, len = 0;
|
||||||
janet_dictionary_view(ds, &kvs, &len, &cap);
|
janet_dictionary_view(ds, &kvs, &len, &cap);
|
||||||
for (i = 0; i < cap; i++) {
|
for (int32_t i = 0; i < cap; i++) {
|
||||||
if (janet_checktype(kvs[i].key, JANET_NIL)) continue;
|
if (janet_checktype(kvs[i].key, JANET_NIL)) continue;
|
||||||
janet_v_push(ret, janetc_value(subopts, kvs[i].key));
|
janet_v_push(ret, janetc_value(subopts, kvs[i].key));
|
||||||
janet_v_push(ret, janetc_value(subopts, kvs[i].value));
|
janet_v_push(ret, janetc_value(subopts, kvs[i].value));
|
||||||
|
|||||||
@@ -341,8 +341,8 @@ static void janet_pretty_one(struct pretty *S, Janet x, int is_dict_value) {
|
|||||||
break;
|
break;
|
||||||
case JANET_ARRAY:
|
case JANET_ARRAY:
|
||||||
case JANET_TUPLE: {
|
case JANET_TUPLE: {
|
||||||
int32_t i, len;
|
int32_t i = 0, len = 0;
|
||||||
const Janet *arr;
|
const Janet *arr = NULL;
|
||||||
int isarray = janet_checktype(x, JANET_ARRAY);
|
int isarray = janet_checktype(x, JANET_ARRAY);
|
||||||
janet_indexed_view(x, &arr, &len);
|
janet_indexed_view(x, &arr, &len);
|
||||||
int hasbrackets = !isarray && (janet_tuple_flag(arr) & JANET_TUPLE_FLAG_BRACKETCTOR);
|
int hasbrackets = !isarray && (janet_tuple_flag(arr) & JANET_TUPLE_FLAG_BRACKETCTOR);
|
||||||
@@ -391,9 +391,9 @@ static void janet_pretty_one(struct pretty *S, Janet x, int is_dict_value) {
|
|||||||
if (S->depth == 0) {
|
if (S->depth == 0) {
|
||||||
janet_buffer_push_cstring(S->buffer, "...");
|
janet_buffer_push_cstring(S->buffer, "...");
|
||||||
} else {
|
} else {
|
||||||
int32_t i, len, cap;
|
int32_t i = 0, len = 0, cap = 0;
|
||||||
int first_kv_pair = 1;
|
int first_kv_pair = 1;
|
||||||
const JanetKV *kvs;
|
const JanetKV *kvs = NULL;
|
||||||
janet_dictionary_view(x, &kvs, &len, &cap);
|
janet_dictionary_view(x, &kvs, &len, &cap);
|
||||||
if (!istable && len >= 4)
|
if (!istable && len >= 4)
|
||||||
janet_buffer_push_u8(S->buffer, ' ');
|
janet_buffer_push_u8(S->buffer, ' ');
|
||||||
|
|||||||
@@ -83,7 +83,7 @@ static JanetSlot quasiquote(JanetFopts opts, Janet x) {
|
|||||||
case JANET_TABLE:
|
case JANET_TABLE:
|
||||||
case JANET_STRUCT: {
|
case JANET_STRUCT: {
|
||||||
const JanetKV *kv = NULL, *kvs = NULL;
|
const JanetKV *kv = NULL, *kvs = NULL;
|
||||||
int32_t len, cap;
|
int32_t len, cap = 0;
|
||||||
janet_dictionary_view(x, &kvs, &len, &cap);
|
janet_dictionary_view(x, &kvs, &len, &cap);
|
||||||
while ((kv = janet_dictionary_next(kvs, cap, kv))) {
|
while ((kv = janet_dictionary_next(kvs, cap, kv))) {
|
||||||
JanetSlot key = quasiquote(opts, kv->key);
|
JanetSlot key = quasiquote(opts, kv->key);
|
||||||
@@ -134,10 +134,10 @@ static int destructure(JanetCompiler *c,
|
|||||||
return leaf(c, janet_unwrap_symbol(left), right, attr);
|
return leaf(c, janet_unwrap_symbol(left), right, attr);
|
||||||
case JANET_TUPLE:
|
case JANET_TUPLE:
|
||||||
case JANET_ARRAY: {
|
case JANET_ARRAY: {
|
||||||
int32_t i, len;
|
int32_t len = 0;
|
||||||
const Janet *values;
|
const Janet *values = NULL;
|
||||||
janet_indexed_view(left, &values, &len);
|
janet_indexed_view(left, &values, &len);
|
||||||
for (i = 0; i < len; i++) {
|
for (int32_t i = 0; i < len; i++) {
|
||||||
JanetSlot nextright = janetc_farslot(c);
|
JanetSlot nextright = janetc_farslot(c);
|
||||||
Janet subval = values[i];
|
Janet subval = values[i];
|
||||||
if (i < 0x100) {
|
if (i < 0x100) {
|
||||||
@@ -154,9 +154,9 @@ static int destructure(JanetCompiler *c,
|
|||||||
case JANET_TABLE:
|
case JANET_TABLE:
|
||||||
case JANET_STRUCT: {
|
case JANET_STRUCT: {
|
||||||
const JanetKV *kvs = NULL;
|
const JanetKV *kvs = NULL;
|
||||||
int32_t i, cap, len;
|
int32_t cap = 0, len = 0;
|
||||||
janet_dictionary_view(left, &kvs, &len, &cap);
|
janet_dictionary_view(left, &kvs, &len, &cap);
|
||||||
for (i = 0; i < cap; i++) {
|
for (int32_t i = 0; i < cap; i++) {
|
||||||
if (janet_checktype(kvs[i].key, JANET_NIL)) continue;
|
if (janet_checktype(kvs[i].key, JANET_NIL)) continue;
|
||||||
JanetSlot nextright = janetc_farslot(c);
|
JanetSlot nextright = janetc_farslot(c);
|
||||||
JanetSlot k = janetc_value(janetc_fopts_default(c), kvs[i].key);
|
JanetSlot k = janetc_value(janetc_fopts_default(c), kvs[i].key);
|
||||||
|
|||||||
@@ -96,5 +96,4 @@ void janet_lib_typed_array(JanetTable *env);
|
|||||||
void janet_lib_inttypes(JanetTable *env);
|
void janet_lib_inttypes(JanetTable *env);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -88,6 +88,4 @@
|
|||||||
))
|
))
|
||||||
"int64 typed arrays")
|
"int64 typed arrays")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
(end-suite)
|
(end-suite)
|
||||||
|
|||||||
@@ -1,77 +1,14 @@
|
|||||||
# Creates an amalgamated janet.c and janet.h to
|
# Creates an amalgamated janet.c
|
||||||
# allow for easy embedding
|
|
||||||
|
|
||||||
|
# Head
|
||||||
(def {:year YY :month MM :month-day DD} (os/date))
|
(def {:year YY :month MM :month-day DD} (os/date))
|
||||||
|
|
||||||
(defn dofile
|
|
||||||
"Print one file to stdout"
|
|
||||||
[path]
|
|
||||||
(print (slurp path)))
|
|
||||||
|
|
||||||
# Order is important here, as some headers
|
|
||||||
# depend on other headers.
|
|
||||||
(def headers
|
|
||||||
@["src/core/util.h"
|
|
||||||
"src/core/state.h"
|
|
||||||
"src/core/gc.h"
|
|
||||||
"src/core/vector.h"
|
|
||||||
"src/core/fiber.h"
|
|
||||||
"src/core/regalloc.h"
|
|
||||||
"src/core/compile.h"
|
|
||||||
"src/core/emit.h"
|
|
||||||
"src/core/symcache.h"])
|
|
||||||
|
|
||||||
(def sources
|
|
||||||
@["src/core/abstract.c"
|
|
||||||
"src/core/array.c"
|
|
||||||
"src/core/asm.c"
|
|
||||||
"src/core/buffer.c"
|
|
||||||
"src/core/bytecode.c"
|
|
||||||
"src/core/capi.c"
|
|
||||||
"src/core/cfuns.c"
|
|
||||||
"src/core/compile.c"
|
|
||||||
"src/core/corelib.c"
|
|
||||||
"src/core/debug.c"
|
|
||||||
"src/core/emit.c"
|
|
||||||
"src/core/fiber.c"
|
|
||||||
"src/core/gc.c"
|
|
||||||
"src/core/io.c"
|
|
||||||
"src/core/inttypes.c"
|
|
||||||
"src/core/marsh.c"
|
|
||||||
"src/core/math.c"
|
|
||||||
"src/core/os.c"
|
|
||||||
"src/core/parse.c"
|
|
||||||
"src/core/peg.c"
|
|
||||||
"src/core/pp.c"
|
|
||||||
"src/core/regalloc.c"
|
|
||||||
"src/core/run.c"
|
|
||||||
"src/core/specials.c"
|
|
||||||
"src/core/string.c"
|
|
||||||
"src/core/strtod.c"
|
|
||||||
"src/core/struct.c"
|
|
||||||
"src/core/symcache.c"
|
|
||||||
"src/core/table.c"
|
|
||||||
"src/core/tuple.c"
|
|
||||||
"src/core/typedarray.c"
|
|
||||||
"src/core/util.c"
|
|
||||||
"src/core/value.c"
|
|
||||||
"src/core/vector.c"
|
|
||||||
"src/core/vm.c"
|
|
||||||
"src/core/wrap.c"])
|
|
||||||
|
|
||||||
(print "/* Amalgamated build - DO NOT EDIT */")
|
(print "/* Amalgamated build - DO NOT EDIT */")
|
||||||
(print "/* Generated " YY "-" (inc MM) "-" (inc DD)
|
(print "/* Generated " YY "-" (inc MM) "-" (inc DD)
|
||||||
" with janet version " janet/version "-" janet/build " */")
|
" with janet version " janet/version "-" janet/build " */")
|
||||||
|
|
||||||
# Assume the version of janet used to run this script is the same
|
|
||||||
# as the version being generated
|
|
||||||
(print "#define JANET_BUILD \"" janet/build "\"")
|
(print "#define JANET_BUILD \"" janet/build "\"")
|
||||||
|
|
||||||
(print ```#define JANET_AMALG```)
|
(print ```#define JANET_AMALG```)
|
||||||
(print ```#include "janet.h"```)
|
(print ```#include "janet.h"```)
|
||||||
|
|
||||||
(each h headers (dofile h))
|
# Body
|
||||||
(each s sources (dofile s))
|
(each path (tuple/slice process/args 2)
|
||||||
|
(print (slurp path)))
|
||||||
# Relies on these files being built
|
|
||||||
(dofile "build/core_image.c")
|
|
||||||
|
|||||||
10
tools/format.sh
Executable file
10
tools/format.sh
Executable file
@@ -0,0 +1,10 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Format all code with astyle
|
||||||
|
|
||||||
|
STYLEOPTS="--style=attach --indent-switches --convert-tabs \
|
||||||
|
--align-pointer=name --pad-header --pad-oper --unpad-paren --indent-labels"
|
||||||
|
|
||||||
|
astyle $STYLEOPTS */*.c
|
||||||
|
astyle $STYLEOPTS */*/*.c
|
||||||
|
astyle $STYLEOPTS */*/*.h
|
||||||
Reference in New Issue
Block a user