Skip to content

Commit 985f1a3

Browse files
committed
Track duktape 2.0.0 snapshot
1 parent f7e24c3 commit 985f1a3

File tree

298 files changed

+308939
-509
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

298 files changed

+308939
-509
lines changed

.gitmodules

-3
Original file line numberDiff line numberDiff line change
@@ -1,3 +0,0 @@
1-
[submodule "duktape-sys/duktape"]
2-
path = duktape-sys/duktape
3-
url = https://github.com/svaarala/duktape-releases.git

duktape-sys/Cargo.toml

+8-4
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,16 @@ gcc = "0.3.28"
1515

1616
[dependencies]
1717
libc = "*"
18-
log = "0.3.6"
18+
19+
[dependencies.log]
20+
optional = true
21+
version = "*"
1922

2023
[dev-dependencies]
2124
bindgen = "0.18.0"
2225

2326
[features]
24-
debug = []
25-
trace = []
26-
spam = []
27+
default = ["debug"]
28+
debug = ["log"]
29+
trace = ["log"]
30+
spam = ["log"]

duktape-sys/build.rs

+15-9
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,22 @@ extern crate gcc;
33
fn main() {
44
let mut config = gcc::Config::new();
55

6-
if cfg!(feature = "debug") {
7-
config.define("DUK_OPT_DEBUG", None);
8-
config.define("DUK_OPT_DPRINT", None);
9-
if cfg!(feature = "trace") {
10-
config.define("DUK_OPT_DDPRINT", None);
6+
let wire_debug = if cfg!(feature = "spam") {
7+
config.define("DUK_OPT_DEBUG_LEVEL", Some("DUK_LEVEL_DDDEBUG"));
8+
true
9+
} else if cfg!(feature = "trace") {
10+
config.define("DUK_OPT_DEBUG_LEVEL", Some("DUK_LEVEL_DDEBUG"));
11+
true
12+
} else if cfg!(feature = "debug") {
13+
config.define("DUK_OPT_DEBUG_LEVEL", Some("DUK_LEVEL_DEBUG"));
14+
true
15+
} else {
16+
false
17+
};
1118

12-
if cfg!(feature = "spam") {
13-
config.define("DUK_OPT_DDDPRINT", None);
14-
}
15-
}
19+
if wire_debug {
20+
config.define("DUK_OPT_DEBUG", None);
21+
config.define("DUK_OPT_DEBUG_WRITE", Some("__duktape_sys_debug_write"));
1622
}
1723

1824
config.file("duktape/src/duktape.c");

duktape-sys/duktape

-1
This file was deleted.

duktape-sys/duktape/AUTHORS.rst

+77
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
===============
2+
Duktape authors
3+
===============
4+
5+
Copyright
6+
=========
7+
8+
Duktape copyrights are held by its authors. Each author has a copyright
9+
to their contribution, and agrees to irrevocably license the contribution
10+
under the Duktape ``LICENSE.txt``.
11+
12+
Authors
13+
=======
14+
15+
Please include an e-mail address, a link to your GitHub profile, or something
16+
similar to allow your contribution to be identified accurately.
17+
18+
The following people have contributed code, website contents, or Wiki contents,
19+
and agreed to irrevocably license their contributions under the Duktape
20+
``LICENSE.txt`` (in order of appearance):
21+
22+
* Sami Vaarala <[email protected]>
23+
* Niki Dobrev
24+
* Andreas Öman <[email protected]>
25+
* László Langó <[email protected]>
26+
* Legimet <[email protected]>
27+
* Karl Skomski <[email protected]>
28+
* Bruce Pascoe <[email protected]>
29+
* René Hollander <[email protected]>
30+
* Julien Hamaide (https://github.com/crazyjul)
31+
* Sebastian Götte (https://github.com/jaseg)
32+
* Tomasz Magulski (https://github.com/magul)
33+
* \D. Bohdan (https://github.com/dbohdan)
34+
* Ondřej Jirman (https://github.com/megous)
35+
* Saúl Ibarra Corretgé <[email protected]>
36+
* Jeremy HU <[email protected]>
37+
38+
Other contributions
39+
===================
40+
41+
The following people have contributed something other than code (e.g. reported
42+
bugs, provided ideas, etc; roughly in order of appearance):
43+
44+
* Greg Burns
45+
* Anthony Rabine
46+
* Carlos Costa
47+
* Aurélien Bouilland
48+
* Preet Desai (Pris Matic)
49+
* judofyr (http://www.reddit.com/user/judofyr)
50+
* Jason Woofenden
51+
* Michał Przybyś
52+
* Anthony Howe
53+
* Conrad Pankoff
54+
* Jim Schimpf
55+
* Rajaran Gaunker (https://github.com/zimbabao)
56+
* Andreas Öman
57+
* Doug Sanden
58+
* Josh Engebretson (https://github.com/JoshEngebretson)
59+
* Remo Eichenberger (https://github.com/remoe)
60+
* Mamod Mehyar (https://github.com/mamod)
61+
* David Demelier (https://github.com/markand)
62+
* Tim Caswell (https://github.com/creationix)
63+
* Mitchell Blank Jr (https://github.com/mitchblank)
64+
* https://github.com/yushli
65+
* Seo Sanghyeon (https://github.com/sanxiyn)
66+
* Han ChoongWoo (https://github.com/tunz)
67+
* Joshua Peek (https://github.com/josh)
68+
* Bruce E. Pascoe (https://github.com/fatcerberus)
69+
* https://github.com/Kelledin
70+
* https://github.com/sstruchtrup
71+
* Michael Drake (https://github.com/tlsa)
72+
* https://github.com/chris-y
73+
* Laurent Zubiaur (https://github.com/lzubiaur)
74+
* Ole André Vadla Ravnås (https://github.com/oleavr)
75+
76+
If you are accidentally missing from this list, send me an e-mail
77+
(``[email protected]``) and I'll fix the omission.

duktape-sys/duktape/LICENSE.txt

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
===============
2+
Duktape license
3+
===============
4+
5+
(http://opensource.org/licenses/MIT)
6+
7+
Copyright (c) 2013-2016 by Duktape authors (see AUTHORS.rst)
8+
9+
Permission is hereby granted, free of charge, to any person obtaining a copy
10+
of this software and associated documentation files (the "Software"), to deal
11+
in the Software without restriction, including without limitation the rights
12+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13+
copies of the Software, and to permit persons to whom the Software is
14+
furnished to do so, subject to the following conditions:
15+
16+
The above copyright notice and this permission notice shall be included in
17+
all copies or substantial portions of the Software.
18+
19+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25+
THE SOFTWARE.

duktape-sys/duktape/Makefile.cmdline

+50
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
#
2+
# Example Makefile for building a program with embedded Duktape.
3+
# The example program here is the Duktape command line tool.
4+
#
5+
6+
DUKTAPE_SOURCES = src/duktape.c
7+
8+
CMDLINE_SOURCES = \
9+
examples/cmdline/duk_cmdline.c
10+
11+
CC = gcc
12+
CCOPTS = -Os -pedantic -std=c99 -Wall -fstrict-aliasing -fomit-frame-pointer
13+
CCOPTS += -I./src # duktape.h and duk_config.h must be in include path
14+
CCLIBS = -lm
15+
16+
# Enable print() and alert() for command line using an optional extra module.
17+
CCOPTS += -DDUK_CMDLINE_PRINTALERT_SUPPORT -I./extras/print-alert
18+
CMDLINE_SOURCES += extras/print-alert/duk_print_alert.c
19+
20+
# Enable console object (console.log() etc) for command line.
21+
CCOPTS += -DDUK_CMDLINE_CONSOLE_SUPPORT -I./extras/console
22+
CMDLINE_SOURCES += extras/console/duk_console.c
23+
24+
# Enable Duktape.Logger for command line.
25+
CCOPTS += -DDUK_CMDLINE_LOGGING_SUPPORT -I./extras/logging
26+
CMDLINE_SOURCES += extras/logging/duk_logging.c
27+
28+
# Enable Duktape 1.x module loading for command line.
29+
CCOPTS += -DDUK_CMDLINE_MODULE_SUPPORT -I./extras/module-duktape
30+
CMDLINE_SOURCES += extras/module-duktape/duk_module_duktape.c
31+
32+
# If you want linenoise, you can enable these. At the moment linenoise
33+
# will cause some harmless compilation warnings.
34+
#CCOPTS += -DDUK_CMDLINE_FANCY -I./linenoise
35+
#CMDLINE_SOURCES += linenoise/linenoise.c
36+
#duk: linenoise
37+
38+
# Optional feature defines, see: http://duktape.org/guide.html#compiling
39+
CCOPTS += -DDUK_OPT_SELF_TESTS
40+
#CCOPTS += -DDUK_OPT_DEBUG
41+
#CCOPTS += '-DDUK_OPT_DEBUG_WRITE(level,file,line,func,msg)=do {fprintf(stderr, "D%ld %s:%ld (%s): %s\n", (long) (level), (file), (long) (line), (func), (msg));} while(0)'
42+
#CCOPTS += -DDUK_OPT_DEBUG_LEVEL=0
43+
# ...
44+
45+
duk: $(DUKTAPE_SOURCES) $(CMDLINE_SOURCES)
46+
$(CC) -o $@ $(DEFINES) $(CCOPTS) $(DUKTAPE_SOURCES) $(CMDLINE_SOURCES) $(CCLIBS)
47+
48+
linenoise/linenoise.c: linenoise
49+
linenoise:
50+
git clone https://github.com/antirez/linenoise.git

duktape-sys/duktape/Makefile.codepage

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
codepage:
2+
gcc -o $@ -std=c99 -O2 -Wall -Wextra -Isrc/ \
3+
src/duktape.c examples/codepage-conv/duk_codepage_conv.c \
4+
examples/codepage-conv/test.c -lm

duktape-sys/duktape/Makefile.coffee

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
dummy:
2+
coffee -c examples/coffee/globals.coffee
3+
coffee -c examples/coffee/hello.coffee
4+
coffee -c examples/coffee/mandel.coffee

duktape-sys/duktape/Makefile.dukdebug

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#
2+
# Duktape command line tool with debugger support.
3+
#
4+
5+
DUKTAPE_SOURCES = src/duktape.c
6+
7+
# Windows (MinGW): use examples/debug-trans-socket/duk_trans_socket_windows.c
8+
# and link with -lws2_32.
9+
DUKTAPE_CMDLINE_SOURCES = \
10+
examples/cmdline/duk_cmdline.c \
11+
examples/debug-trans-socket/duk_trans_socket_unix.c
12+
13+
CC = gcc
14+
CCOPTS = -Os -pedantic -std=c99 -Wall -fstrict-aliasing -fomit-frame-pointer
15+
CCOPTS += -I./src -I./examples/debug-trans-socket
16+
CCOPTS += -DDUK_CMDLINE_DEBUGGER_SUPPORT # enable --debugger in ./duk
17+
CCOPTS += -DDUK_OPT_DEBUGGER_SUPPORT # enable debugger support in Duktape
18+
CCOPTS += -DDUK_OPT_INTERRUPT_COUNTER # prerequisite for debugging
19+
CCOPTS += -DDUK_OPT_DEBUGGER_FWD_LOGGING # optional debugger features
20+
CCOPTS += -DDUK_OPT_DEBUGGER_DUMPHEAP
21+
CCOPTS += -DDUK_OPT_DEBUGGER_INSPECT
22+
CCLIBS = -lm
23+
24+
duk: $(DUKTAPE_SOURCES) $(DUKTAPE_CMDLINE_SOURCES)
25+
$(CC) -o $@ $(DEFINES) $(CCOPTS) $(DUKTAPE_SOURCES) $(DUKTAPE_CMDLINE_SOURCES) $(CCLIBS)

duktape-sys/duktape/Makefile.eval

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#
2+
# Example Makefile for building the eval example
3+
#
4+
5+
eval:
6+
gcc -o $@ -std=c99 -O2 -Wall -Wextra -Isrc/ \
7+
src/duktape.c examples/eval/eval.c -lm
+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#
2+
# Example Makefile for building the eventloop example
3+
#
4+
5+
evloop:
6+
@echo "NOTE: The eventloop is example is intended to be used on Linux"
7+
@echo " or other common UNIX variants. It is not fully portable."
8+
@echo ""
9+
10+
gcc -o $@ -std=c99 -Wall -Wextra -O2 -Isrc \
11+
examples/eventloop/main.c \
12+
examples/eventloop/c_eventloop.c \
13+
examples/eventloop/poll.c \
14+
examples/eventloop/socket.c \
15+
examples/eventloop/fileio.c \
16+
examples/eventloop/ncurses.c \
17+
src/duktape.c \
18+
-lm -lncurses
19+
20+
@echo ""
21+
@echo "NOTE: You must 'cd examples/eventloop' before you execute the"
22+
@echo " eventloop binary: it relies on finding .js files in CWD"

duktape-sys/duktape/Makefile.hello

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#
2+
# Example Makefile for building a program with embedded Duktape.
3+
#
4+
# There are two source sets in the distribution: (1) combined sources where
5+
# you only need duktape.c, duktape.h, and duk_config.h, and (2) separate
6+
# sources where you have a bunch of source and header files. Whichever
7+
# you use, simply include the relevant sources into your C project. This
8+
# Makefile uses the combined source file.
9+
#
10+
11+
DUKTAPE_SOURCES = src/duktape.c
12+
13+
# Compiler options are quite flexible. GCC versions have a significant impact
14+
# on the size of -Os code, e.g. gcc-4.6 is much worse than gcc-4.5.
15+
16+
CC = gcc
17+
CCOPTS = -Os -pedantic -std=c99 -Wall -fstrict-aliasing -fomit-frame-pointer
18+
CCOPTS += -I./src # for combined sources
19+
CCLIBS = -lm
20+
DEFINES =
21+
22+
# If you want a 32-bit build on a 64-bit host
23+
#CCOPTS += -m32
24+
25+
# Optional feature defines, see: http://duktape.org/guide.html#compiling
26+
DEFINES += -DDUK_OPT_SELF_TESTS
27+
#DEFINES += -DDUK_OPT_DEBUG
28+
#DEFINES += -DDUK_OPT_DPRINT
29+
#DEFINES += -DDUK_OPT_NO_TRACEBACKS
30+
# ...
31+
32+
# For debugging, use -O0 -g -ggdb, and don't add -fomit-frame-pointer
33+
34+
hello: $(DUKTAPE_SOURCES) examples/hello/hello.c
35+
$(CC) -o $@ $(DEFINES) $(CCOPTS) $(DUKTAPE_SOURCES) examples/hello/hello.c $(CCLIBS)

duktape-sys/duktape/Makefile.jxpretty

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#
2+
# Example Makefile for building the jxpretty example
3+
#
4+
5+
jxpretty:
6+
gcc -o $@ -std=c99 -Wall -Wextra -O2 -Isrc \
7+
src/duktape.c examples/jxpretty/jxpretty.c \
8+
-lm

duktape-sys/duktape/Makefile.sandbox

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#
2+
# Example Makefile for building the sandbox example
3+
#
4+
5+
sandbox:
6+
gcc -o $@ -std=c99 -O2 -Wall -Wextra -Isrc/ \
7+
src/duktape.c examples/sandbox/sandbox.c -lm

0 commit comments

Comments
 (0)