1
0
mirror of https://github.com/janet-lang/janet synced 2024-11-24 09:17:17 +00:00

Rename boot.dst to core.dst

This commit is contained in:
Calvin Rose 2018-07-04 00:17:34 -04:00
parent 0ee17b15f1
commit 1f37919f39
10 changed files with 70 additions and 3858 deletions

2
.gitignore vendored
View File

@ -6,6 +6,7 @@ dst
/Release
/Debug
/Emscripten
/src/include/generated/*.h
# Generated files
*.gen.h
@ -28,7 +29,6 @@ tags
# Valgrind files
vgcore.*
core.*
# Created by https://www.gitignore.io/api/c

View File

@ -49,7 +49,9 @@ else
endif
# Source headers
DST_GENERATED_HEADERS=$(sort $(wildcard src/include/generated/*.h))
DST_GENERATED_HEADERS= \
src/include/generated/core.h \
src/include/generated/init.h
DST_HEADERS=$(sort $(wildcard src/include/dst/*.h))
DST_LOCAL_HEADERS=$(sort $(wildcard src/*/*.h))
@ -71,13 +73,13 @@ xxd: src/tools/xxd.c
#############################
src/include/generated/init.h: src/mainclient/init.dst xxd
./xxd $< $@ dst_mainclient_init
./xxd $< $@ dst_gen_init
src/include/generated/boot.h: src/core/boot.dst xxd
./xxd $< $@ dst_stl_bootstrap_gen
src/include/generated/core.h: src/core/core.dst xxd
./xxd $< $@ dst_gen_core
# Only a few files depend on the generated headers
src/core/corelib.o: src/include/generated/boot.h
src/core/corelib.o: src/include/generated/core.h
src/mainclient/main.o: src/include/generated/init.h
##########################################################

View File

@ -21,10 +21,10 @@ are fairly straight forward. Dst can be easily ported to new platforms.
There is not much in the way of documentation yet because it is still a "personal project" and
I don't want to freeze features prematurely. You can look in the examples directory, the test directory,
or the file `src/compiler/boot.dst` to get a sense of what dst code looks like.
or the file `src/core/core.dst` to get a sense of what dst code looks like.
For syntax highlighting, there is some preliminary vim syntax highlighting in [dst.vim](https://github.com/bakpakin/dst.vim).
Generic lisp syntax highlighting should provide good results, however.
Generic lisp syntax highlighting should, however, provide good results.
## Features
@ -34,42 +34,50 @@ Generic lisp syntax highlighting should provide good results, however.
* Mutable and immutable arrays (array/tuple)
* Mutable and immutable hashtables (table/struct)
* Mutable and immutable strings (buffer/string)
* Lisp Macros (Code is Data, Data is Code)
* Lisp Macros
* Byte code interpreter with an assembly interface, as well as bytecode verification
* Proper tail calls.
* Direct interop with C via abstract types and C functions
* Dynamically load C libraries
* Functional and imperative standard library
* Lexical scoping
* Imperative Programming as well as functional
* Imperative programming as well as functional
* REPL
* Interactive Environment
* Interactive environment with detailed stack traces
* SQLite bindings
## Documentation
API documentation and design documents can be found in the
[wiki](https://github.com/bakpakin/dst/wiki).
[wiki](https://github.com/bakpakin/dst/wiki). Not at all complete.
## Usage
A repl is launched when the binary is invoked with no arguments. Pass the -h flag
to display the usage information. Individual scripts can be run with `./dst myscript.dst`
If you are looking to explore, you can print a list of all available macros, functions, and constants
by entering the command `(all-symbols)` into the repl.
```
$ ./dst
Dst 0.0.0 alpha Copyright (C) 2017-2018 Calvin Rose
> (+ 1 2 3)
dst:1:> (+ 1 2 3)
6
> (print "Hello, World!")
dst:2:> (print "Hello, World!")
Hello, World!
nil
> (exit)
dst:3:> (os.exit)
$ ./dst -h
usage: ./dst [options] scripts...
Options are:
-h Show this help
-v Print the version string
-r Enter the repl after running all scripts
-h Show this help
-v Print the version string
-s Use raw stdin instead of getline like functionality
-e Execute a string of dst
-r Enter the repl after running all scripts
-p Keep on executing if there is a top level error (persistent)
-- Stop handling option
$
```
@ -89,7 +97,8 @@ make test
### CMake
On a posix system using make as the backend, compiling and running is as follows (this is the same as
On a posix system using make as the target build system,
compiling and running is as follows (this is the same as
most CMake based projects).
```sh
@ -109,3 +118,34 @@ make run
## Examples
See the examples directory for some example dst code.
## SQLite bindings
There are some sqlite3 bindings in the directory natives/sqlite3. They serve mostly as a
proof of concept external c library. To use, first compile the module with Make.
```sh
make natives
```
Next, enter the repl and create a database and a table.
```
dst:1:> (import natives.sqlite :as sql)
nil
dst:2:> (def db (sql.open "test.db"))
<sqlite3.connection 0x5561A138C470>
dst:3:> (sql.eval db `CREATE TABLE customers(id INTEGER PRIMARY KEY, name TEXT);`)
@[]
dst:4:> (sql.eval db `INSERT INTO customers VALUES(:id, :name);` {:name "John" :id 12345})
@[]
dst:5:> (sql.eval db `SELECT * FROM customers;`)
@[{"id" 12345 "name" "John"}]
```
Finally, close the database connection when done with it.
```
dst:6:> (sql.close db)
nil
```

View File

@ -4,7 +4,7 @@ set (CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}")
include(bin2h)
bin2h (
SOURCE_FILE ${CMAKE_CURRENT_LIST_DIR}/../src/core/boot.dst
HEADER_FILE "generated/boot.h"
VARIABLE_NAME dst_stl_bootstrap_gen
SOURCE_FILE ${CMAKE_CURRENT_LIST_DIR}/../src/core/core.dst
HEADER_FILE "generated/core.h"
VARIABLE_NAME dst_gen_core
)

View File

@ -6,5 +6,5 @@ include(bin2h)
bin2h (
SOURCE_FILE ${CMAKE_CURRENT_LIST_DIR}/../src/mainclient/init.dst
HEADER_FILE "generated/init.h"
VARIABLE_NAME dst_mainclient_init
VARIABLE_NAME dst_gen_init
)

View File

@ -1,4 +1,4 @@
# Bootstrap the dst environment
# The core dst library
# Copyright 2018 (C) Calvin Rose
###

View File

@ -26,7 +26,7 @@
#include "state.h"
/* Generated header */
#include <generated/boot.h>
#include <generated/core.h>
/* Use LoadLibrary on windows or dlopen on posix to load dynamic libaries
* with native code. */
@ -496,7 +496,7 @@ DstTable *dst_stl_env(int flags) {
dst_env_def(env, "_env", ret);
/* Run bootstrap source */
dst_dobytes(env, dst_stl_bootstrap_gen, sizeof(dst_stl_bootstrap_gen), "boot.dst");
dst_dobytes(env, dst_gen_core, sizeof(dst_gen_core), "core.dst");
if (flags & DST_STL_NOGCROOT)
dst_gcunroot(dst_wrap_table(env));

File diff suppressed because it is too large Load Diff

View File

@ -1,193 +0,0 @@
/* Auto generated - DO NOT EDIT */
static const unsigned char dst_mainclient_init[] = {
0x23, 0x20, 0x43, 0x6F, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
0x74, 0x20, 0x32, 0x30, 0x31, 0x37, 0x2D, 0x32, 0x30, 0x31,
0x38, 0x20, 0x28, 0x43, 0x29, 0x20, 0x43, 0x61, 0x6C, 0x76,
0x69, 0x6E, 0x20, 0x52, 0x6F, 0x73, 0x65, 0x0A, 0x28, 0x74,
0x61, 0x62, 0x6C, 0x65, 0x2E, 0x73, 0x65, 0x74, 0x70, 0x72,
0x6F, 0x74, 0x6F, 0x20, 0x40, 0x7B, 0x20, 0x31, 0x20, 0x32,
0x7D, 0x20, 0x40, 0x7B, 0x7D, 0x29, 0x0A, 0x28, 0x64, 0x6F,
0x0A, 0x0A, 0x20, 0x20, 0x28, 0x76, 0x61, 0x72, 0x20, 0x2A,
0x73, 0x68, 0x6F, 0x75, 0x6C, 0x64, 0x2D, 0x72, 0x65, 0x70,
0x6C, 0x2A, 0x20, 0x3A, 0x70, 0x72, 0x69, 0x76, 0x61, 0x74,
0x65, 0x20, 0x66, 0x61, 0x6C, 0x73, 0x65, 0x29, 0x0A, 0x20,
0x20, 0x28, 0x76, 0x61, 0x72, 0x20, 0x2A, 0x6E, 0x6F, 0x2D,
0x66, 0x69, 0x6C, 0x65, 0x2A, 0x20, 0x3A, 0x70, 0x72, 0x69,
0x76, 0x61, 0x74, 0x65, 0x20, 0x74, 0x72, 0x75, 0x65, 0x29,
0x0A, 0x20, 0x20, 0x28, 0x76, 0x61, 0x72, 0x20, 0x2A, 0x72,
0x61, 0x77, 0x2D, 0x73, 0x74, 0x64, 0x69, 0x6E, 0x2A, 0x20,
0x3A, 0x70, 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, 0x20, 0x66,
0x61, 0x6C, 0x73, 0x65, 0x29, 0x0A, 0x20, 0x20, 0x28, 0x76,
0x61, 0x72, 0x20, 0x2A, 0x68, 0x61, 0x6E, 0x64, 0x6C, 0x65,
0x6F, 0x70, 0x74, 0x73, 0x2A, 0x20, 0x3A, 0x70, 0x72, 0x69,
0x76, 0x61, 0x74, 0x65, 0x20, 0x74, 0x72, 0x75, 0x65, 0x29,
0x0A, 0x20, 0x20, 0x28, 0x76, 0x61, 0x72, 0x20, 0x2A, 0x65,
0x78, 0x69, 0x74, 0x2D, 0x6F, 0x6E, 0x2D, 0x65, 0x72, 0x72,
0x6F, 0x72, 0x2A, 0x20, 0x3A, 0x70, 0x72, 0x69, 0x76, 0x61,
0x74, 0x65, 0x20, 0x74, 0x72, 0x75, 0x65, 0x29, 0x0A, 0x0A,
0x20, 0x20, 0x23, 0x20, 0x46, 0x6C, 0x61, 0x67, 0x20, 0x68,
0x61, 0x6E, 0x64, 0x6C, 0x65, 0x72, 0x73, 0x0A, 0x20, 0x20,
0x28, 0x64, 0x65, 0x66, 0x20, 0x68, 0x61, 0x6E, 0x64, 0x6C,
0x65, 0x72, 0x73, 0x20, 0x3A, 0x70, 0x72, 0x69, 0x76, 0x61,
0x74, 0x65, 0x20, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x7B, 0x22,
0x68, 0x22, 0x20, 0x28, 0x66, 0x6E, 0x20, 0x5B, 0x5D, 0x20,
0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
0x20, 0x20, 0x28, 0x70, 0x72, 0x69, 0x6E, 0x74, 0x20, 0x22,
0x75, 0x73, 0x61, 0x67, 0x65, 0x3A, 0x20, 0x22, 0x20, 0x28,
0x67, 0x65, 0x74, 0x20, 0x61, 0x72, 0x67, 0x73, 0x20, 0x30,
0x29, 0x20, 0x22, 0x20, 0x5B, 0x6F, 0x70, 0x74, 0x69, 0x6F,
0x6E, 0x73, 0x5D, 0x20, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74,
0x73, 0x2E, 0x2E, 0x2E, 0x22, 0x29, 0x0A, 0x20, 0x20, 0x20,
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x28, 0x70,
0x72, 0x69, 0x6E, 0x74, 0x20, 0x0A, 0x20, 0x20, 0x20, 0x20,
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x60,
0x4F, 0x70, 0x74, 0x69, 0x6F, 0x6E, 0x73, 0x20, 0x61, 0x72,
0x65, 0x3A, 0x0A, 0x20, 0x20, 0x2D, 0x68, 0x20, 0x53, 0x68,
0x6F, 0x77, 0x20, 0x74, 0x68, 0x69, 0x73, 0x20, 0x68, 0x65,
0x6C, 0x70, 0x0A, 0x20, 0x20, 0x2D, 0x76, 0x20, 0x50, 0x72,
0x69, 0x6E, 0x74, 0x20, 0x74, 0x68, 0x65, 0x20, 0x76, 0x65,
0x72, 0x73, 0x69, 0x6F, 0x6E, 0x20, 0x73, 0x74, 0x72, 0x69,
0x6E, 0x67, 0x0A, 0x20, 0x20, 0x2D, 0x73, 0x20, 0x55, 0x73,
0x65, 0x20, 0x72, 0x61, 0x77, 0x20, 0x73, 0x74, 0x64, 0x69,
0x6E, 0x20, 0x69, 0x6E, 0x73, 0x74, 0x65, 0x61, 0x64, 0x20,
0x6F, 0x66, 0x20, 0x67, 0x65, 0x74, 0x6C, 0x69, 0x6E, 0x65,
0x20, 0x6C, 0x69, 0x6B, 0x65, 0x20, 0x66, 0x75, 0x6E, 0x63,
0x74, 0x69, 0x6F, 0x6E, 0x61, 0x6C, 0x69, 0x74, 0x79, 0x0A,
0x20, 0x20, 0x2D, 0x65, 0x20, 0x45, 0x78, 0x65, 0x63, 0x75,
0x74, 0x65, 0x20, 0x61, 0x20, 0x73, 0x74, 0x72, 0x69, 0x6E,
0x67, 0x20, 0x6F, 0x66, 0x20, 0x64, 0x73, 0x74, 0x0A, 0x20,
0x20, 0x2D, 0x72, 0x20, 0x45, 0x6E, 0x74, 0x65, 0x72, 0x20,
0x74, 0x68, 0x65, 0x20, 0x72, 0x65, 0x70, 0x6C, 0x20, 0x61,
0x66, 0x74, 0x65, 0x72, 0x20, 0x72, 0x75, 0x6E, 0x6E, 0x69,
0x6E, 0x67, 0x20, 0x61, 0x6C, 0x6C, 0x20, 0x73, 0x63, 0x72,
0x69, 0x70, 0x74, 0x73, 0x0A, 0x20, 0x20, 0x2D, 0x70, 0x20,
0x4B, 0x65, 0x65, 0x70, 0x20, 0x6F, 0x6E, 0x20, 0x65, 0x78,
0x65, 0x63, 0x75, 0x74, 0x69, 0x6E, 0x67, 0x20, 0x69, 0x66,
0x20, 0x74, 0x68, 0x65, 0x72, 0x65, 0x20, 0x69, 0x73, 0x20,
0x61, 0x20, 0x74, 0x6F, 0x70, 0x20, 0x6C, 0x65, 0x76, 0x65,
0x6C, 0x20, 0x65, 0x72, 0x72, 0x6F, 0x72, 0x20, 0x28, 0x70,
0x65, 0x72, 0x73, 0x69, 0x73, 0x74, 0x65, 0x6E, 0x74, 0x29,
0x0A, 0x20, 0x20, 0x2D, 0x2D, 0x20, 0x53, 0x74, 0x6F, 0x70,
0x20, 0x68, 0x61, 0x6E, 0x64, 0x6C, 0x69, 0x6E, 0x67, 0x20,
0x6F, 0x70, 0x74, 0x69, 0x6F, 0x6E, 0x73, 0x60, 0x29, 0x0A,
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
0x20, 0x28, 0x6F, 0x73, 0x2E, 0x65, 0x78, 0x69, 0x74, 0x20,
0x30, 0x29, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
0x20, 0x20, 0x20, 0x20, 0x31, 0x29, 0x0A, 0x20, 0x20, 0x20,
0x20, 0x20, 0x22, 0x76, 0x22, 0x20, 0x28, 0x66, 0x6E, 0x20,
0x5B, 0x5D, 0x20, 0x28, 0x70, 0x72, 0x69, 0x6E, 0x74, 0x20,
0x56, 0x45, 0x52, 0x53, 0x49, 0x4F, 0x4E, 0x29, 0x20, 0x28,
0x6F, 0x73, 0x2E, 0x65, 0x78, 0x69, 0x74, 0x20, 0x30, 0x29,
0x20, 0x31, 0x29, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22,
0x73, 0x22, 0x20, 0x28, 0x66, 0x6E, 0x20, 0x5B, 0x5D, 0x20,
0x28, 0x3A, 0x3D, 0x20, 0x2A, 0x72, 0x61, 0x77, 0x2D, 0x73,
0x74, 0x64, 0x69, 0x6E, 0x2A, 0x20, 0x74, 0x72, 0x75, 0x65,
0x29, 0x20, 0x28, 0x3A, 0x3D, 0x20, 0x2A, 0x73, 0x68, 0x6F,
0x75, 0x6C, 0x64, 0x2D, 0x72, 0x65, 0x70, 0x6C, 0x2A, 0x20,
0x74, 0x72, 0x75, 0x65, 0x29, 0x20, 0x31, 0x29, 0x0A, 0x20,
0x20, 0x20, 0x20, 0x20, 0x22, 0x72, 0x22, 0x20, 0x28, 0x66,
0x6E, 0x20, 0x5B, 0x5D, 0x20, 0x28, 0x3A, 0x3D, 0x20, 0x2A,
0x73, 0x68, 0x6F, 0x75, 0x6C, 0x64, 0x2D, 0x72, 0x65, 0x70,
0x6C, 0x2A, 0x20, 0x74, 0x72, 0x75, 0x65, 0x29, 0x20, 0x31,
0x29, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x70, 0x22,
0x20, 0x28, 0x66, 0x6E, 0x20, 0x5B, 0x5D, 0x20, 0x28, 0x3A,
0x3D, 0x20, 0x2A, 0x65, 0x78, 0x69, 0x74, 0x2D, 0x6F, 0x6E,
0x2D, 0x65, 0x72, 0x72, 0x6F, 0x72, 0x2A, 0x20, 0x66, 0x61,
0x6C, 0x73, 0x65, 0x29, 0x20, 0x31, 0x29, 0x0A, 0x20, 0x20,
0x20, 0x20, 0x20, 0x22, 0x2D, 0x22, 0x20, 0x28, 0x66, 0x6E,
0x20, 0x5B, 0x5D, 0x20, 0x28, 0x3A, 0x3D, 0x20, 0x2A, 0x68,
0x61, 0x6E, 0x64, 0x6C, 0x65, 0x6F, 0x70, 0x74, 0x73, 0x2A,
0x20, 0x66, 0x61, 0x6C, 0x73, 0x65, 0x29, 0x20, 0x31, 0x29,
0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x65, 0x22, 0x20,
0x28, 0x66, 0x6E, 0x20, 0x5B, 0x69, 0x5D, 0x20, 0x0A, 0x20,
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
0x28, 0x3A, 0x3D, 0x20, 0x2A, 0x6E, 0x6F, 0x2D, 0x66, 0x69,
0x6C, 0x65, 0x2A, 0x20, 0x66, 0x61, 0x6C, 0x73, 0x65, 0x29,
0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
0x20, 0x20, 0x28, 0x65, 0x76, 0x61, 0x6C, 0x20, 0x28, 0x67,
0x65, 0x74, 0x20, 0x61, 0x72, 0x67, 0x73, 0x20, 0x28, 0x2B,
0x20, 0x69, 0x20, 0x31, 0x29, 0x29, 0x29, 0x0A, 0x20, 0x20,
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x32,
0x29, 0x7D, 0x29, 0x0A, 0x0A, 0x20, 0x20, 0x28, 0x64, 0x65,
0x66, 0x6E, 0x2D, 0x20, 0x64, 0x6F, 0x68, 0x61, 0x6E, 0x64,
0x6C, 0x65, 0x72, 0x20, 0x5B, 0x6E, 0x20, 0x69, 0x5D, 0x0A,
0x20, 0x20, 0x20, 0x20, 0x28, 0x64, 0x65, 0x66, 0x20, 0x68,
0x20, 0x28, 0x67, 0x65, 0x74, 0x20, 0x68, 0x61, 0x6E, 0x64,
0x6C, 0x65, 0x72, 0x73, 0x20, 0x6E, 0x29, 0x29, 0x0A, 0x20,
0x20, 0x20, 0x20, 0x28, 0x69, 0x66, 0x20, 0x68, 0x20, 0x28,
0x68, 0x20, 0x69, 0x29, 0x20, 0x28, 0x70, 0x72, 0x69, 0x6E,
0x74, 0x20, 0x22, 0x75, 0x6E, 0x6B, 0x6E, 0x6F, 0x77, 0x6E,
0x20, 0x66, 0x6C, 0x61, 0x67, 0x20, 0x2D, 0x22, 0x20, 0x6E,
0x29, 0x29, 0x29, 0x0A, 0x0A, 0x20, 0x20, 0x23, 0x20, 0x50,
0x72, 0x6F, 0x63, 0x65, 0x73, 0x73, 0x20, 0x61, 0x72, 0x67,
0x75, 0x6D, 0x65, 0x6E, 0x74, 0x73, 0x0A, 0x20, 0x20, 0x28,
0x76, 0x61, 0x72, 0x20, 0x69, 0x20, 0x31, 0x29, 0x0A, 0x20,
0x20, 0x28, 0x64, 0x65, 0x66, 0x20, 0x6C, 0x65, 0x6E, 0x61,
0x72, 0x67, 0x73, 0x20, 0x28, 0x6C, 0x65, 0x6E, 0x67, 0x74,
0x68, 0x20, 0x61, 0x72, 0x67, 0x73, 0x29, 0x29, 0x0A, 0x20,
0x20, 0x28, 0x77, 0x68, 0x69, 0x6C, 0x65, 0x20, 0x28, 0x3C,
0x20, 0x69, 0x20, 0x6C, 0x65, 0x6E, 0x61, 0x72, 0x67, 0x73,
0x29, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x28, 0x64, 0x65, 0x66,
0x20, 0x61, 0x72, 0x67, 0x20, 0x28, 0x67, 0x65, 0x74, 0x20,
0x61, 0x72, 0x67, 0x73, 0x20, 0x69, 0x29, 0x29, 0x0A, 0x20,
0x20, 0x20, 0x20, 0x28, 0x69, 0x66, 0x20, 0x28, 0x61, 0x6E,
0x64, 0x20, 0x2A, 0x68, 0x61, 0x6E, 0x64, 0x6C, 0x65, 0x6F,
0x70, 0x74, 0x73, 0x2A, 0x20, 0x28, 0x3D, 0x20, 0x22, 0x2D,
0x22, 0x20, 0x28, 0x73, 0x74, 0x72, 0x69, 0x6E, 0x67, 0x2E,
0x73, 0x6C, 0x69, 0x63, 0x65, 0x20, 0x61, 0x72, 0x67, 0x20,
0x30, 0x20, 0x31, 0x29, 0x29, 0x29, 0x0A, 0x20, 0x20, 0x20,
0x20, 0x20, 0x20, 0x28, 0x2B, 0x3D, 0x20, 0x69, 0x20, 0x28,
0x64, 0x6F, 0x68, 0x61, 0x6E, 0x64, 0x6C, 0x65, 0x72, 0x20,
0x28, 0x73, 0x74, 0x72, 0x69, 0x6E, 0x67, 0x2E, 0x73, 0x6C,
0x69, 0x63, 0x65, 0x20, 0x61, 0x72, 0x67, 0x20, 0x31, 0x20,
0x32, 0x29, 0x20, 0x69, 0x29, 0x29, 0x0A, 0x20, 0x20, 0x20,
0x20, 0x20, 0x20, 0x28, 0x64, 0x6F, 0x0A, 0x20, 0x20, 0x20,
0x20, 0x20, 0x20, 0x20, 0x20, 0x28, 0x3A, 0x3D, 0x20, 0x2A,
0x6E, 0x6F, 0x2D, 0x66, 0x69, 0x6C, 0x65, 0x2A, 0x20, 0x66,
0x61, 0x6C, 0x73, 0x65, 0x29, 0x0A, 0x20, 0x20, 0x20, 0x20,
0x20, 0x20, 0x20, 0x20, 0x28, 0x69, 0x6D, 0x70, 0x6F, 0x72,
0x74, 0x2A, 0x20, 0x5F, 0x65, 0x6E, 0x76, 0x20, 0x61, 0x72,
0x67, 0x20, 0x3A, 0x65, 0x78, 0x69, 0x74, 0x20, 0x2A, 0x65,
0x78, 0x69, 0x74, 0x2D, 0x6F, 0x6E, 0x2D, 0x65, 0x72, 0x72,
0x6F, 0x72, 0x2A, 0x29, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20,
0x20, 0x20, 0x20, 0x28, 0x2B, 0x2B, 0x20, 0x69, 0x29, 0x29,
0x29, 0x29, 0x0A, 0x0A, 0x20, 0x20, 0x28, 0x77, 0x68, 0x65,
0x6E, 0x20, 0x28, 0x6F, 0x72, 0x20, 0x2A, 0x73, 0x68, 0x6F,
0x75, 0x6C, 0x64, 0x2D, 0x72, 0x65, 0x70, 0x6C, 0x2A, 0x20,
0x2A, 0x6E, 0x6F, 0x2D, 0x66, 0x69, 0x6C, 0x65, 0x2A, 0x29,
0x20, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x28, 0x69, 0x66, 0x20,
0x2A, 0x72, 0x61, 0x77, 0x2D, 0x73, 0x74, 0x64, 0x69, 0x6E,
0x2A, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x28, 0x72,
0x65, 0x70, 0x6C, 0x20, 0x6E, 0x69, 0x6C, 0x20, 0x69, 0x64,
0x65, 0x6E, 0x74, 0x69, 0x74, 0x79, 0x29, 0x0A, 0x20, 0x20,
0x20, 0x20, 0x20, 0x20, 0x28, 0x64, 0x6F, 0x0A, 0x20, 0x20,
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x28, 0x70, 0x72, 0x69,
0x6E, 0x74, 0x20, 0x28, 0x73, 0x74, 0x72, 0x69, 0x6E, 0x67,
0x20, 0x22, 0x44, 0x73, 0x74, 0x20, 0x22, 0x20, 0x56, 0x45,
0x52, 0x53, 0x49, 0x4F, 0x4E, 0x20, 0x22, 0x20, 0x20, 0x43,
0x6F, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68, 0x74, 0x20, 0x28,
0x43, 0x29, 0x20, 0x32, 0x30, 0x31, 0x37, 0x2D, 0x32, 0x30,
0x31, 0x38, 0x20, 0x43, 0x61, 0x6C, 0x76, 0x69, 0x6E, 0x20,
0x52, 0x6F, 0x73, 0x65, 0x22, 0x29, 0x29, 0x0A, 0x20, 0x20,
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x28, 0x72, 0x65, 0x70,
0x6C, 0x20, 0x28, 0x66, 0x6E, 0x20, 0x5B, 0x62, 0x75, 0x66,
0x20, 0x70, 0x5D, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
0x28, 0x64, 0x65, 0x66, 0x20, 0x5B, 0x6C, 0x69, 0x6E, 0x65,
0x5D, 0x20, 0x28, 0x70, 0x61, 0x72, 0x73, 0x65, 0x72, 0x2E,
0x77, 0x68, 0x65, 0x72, 0x65, 0x20, 0x70, 0x29, 0x29, 0x0A,
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x28, 0x64, 0x65, 0x66,
0x20, 0x70, 0x72, 0x6F, 0x6D, 0x70, 0x74, 0x20, 0x28, 0x73,
0x74, 0x72, 0x69, 0x6E, 0x67, 0x20, 0x22, 0x64, 0x73, 0x74,
0x3A, 0x22, 0x20, 0x6C, 0x69, 0x6E, 0x65, 0x20, 0x22, 0x3A,
0x22, 0x20, 0x28, 0x70, 0x61, 0x72, 0x73, 0x65, 0x72, 0x2E,
0x73, 0x74, 0x61, 0x74, 0x65, 0x20, 0x70, 0x29, 0x20, 0x22,
0x3E, 0x20, 0x22, 0x29, 0x29, 0x0A, 0x20, 0x20, 0x20, 0x20,
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
0x20, 0x20, 0x28, 0x67, 0x65, 0x74, 0x6C, 0x69, 0x6E, 0x65,
0x20, 0x70, 0x72, 0x6F, 0x6D, 0x70, 0x74, 0x20, 0x62, 0x75,
0x66, 0x29, 0x29, 0x29, 0x29, 0x29, 0x29, 0x29, 0x0A
};

View File

@ -36,9 +36,8 @@ int main(int argc, char **argv) {
/* Create args tuple */
args = dst_array(argc);
for (i = 0; i < argc; i++) {
for (i = 0; i < argc; i++)
dst_array_push(args, dst_cstringv(argv[i]));
}
dst_env_def(env, "args", dst_wrap_array(args));
/* Expose line getter */
@ -46,7 +45,7 @@ int main(int argc, char **argv) {
dst_line_init();
/* Run startup script */
status = dst_dobytes(env, dst_mainclient_init, sizeof(dst_mainclient_init), "init.dst");
status = dst_dobytes(env, dst_gen_init, sizeof(dst_gen_init), "init.dst");
/* Deinitialize vm */
dst_deinit();