aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools
diff options
context:
space:
mode:
authorCalvin Rose <calsrose@gmail.com>2019-03-23 13:50:50 -0400
committerCalvin Rose <calsrose@gmail.com>2019-03-23 13:50:50 -0400
commit2c9195b507a538219e823d4e6263c13434938aa2 (patch)
treec23e2e0d74e49bebb71e4c0612743d28606bd45d /tools
parentAdd Meson build setup to README.md (diff)
More updates to meson
Redo amalg script so we can more easily run it from Meson.
Diffstat (limited to 'tools')
-rw-r--r--tools/amalg.janet73
-rwxr-xr-xtools/format.sh10
2 files changed, 15 insertions, 68 deletions
diff --git a/tools/amalg.janet b/tools/amalg.janet
index ae06208b..fee4cdde 100644
--- a/tools/amalg.janet
+++ b/tools/amalg.janet
@@ -1,77 +1,14 @@
-# Creates an amalgamated janet.c and janet.h to
-# allow for easy embedding
+# Creates an amalgamated janet.c
+# Head
(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 "/* Generated " YY "-" (inc MM) "-" (inc DD)
" 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_AMALG```)
(print ```#include "janet.h"```)
-(each h headers (dofile h))
-(each s sources (dofile s))
-
-# Relies on these files being built
-(dofile "build/core_image.c")
+# Body
+(each path (tuple/slice process/args 2)
+ (print (slurp path)))
diff --git a/tools/format.sh b/tools/format.sh
new file mode 100755
index 00000000..8d2ba436
--- /dev/null
+++ b/tools/format.sh
@@ -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