ndtypes 0.2.0dev4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/CONTRIBUTING.md +50 -0
- data/Gemfile +2 -0
- data/History.md +0 -0
- data/README.md +19 -0
- data/Rakefile +125 -0
- data/ext/ruby_ndtypes/extconf.rb +55 -0
- data/ext/ruby_ndtypes/gc_guard.c +36 -0
- data/ext/ruby_ndtypes/gc_guard.h +12 -0
- data/ext/ruby_ndtypes/ndtypes/AUTHORS.txt +5 -0
- data/ext/ruby_ndtypes/ndtypes/INSTALL.txt +101 -0
- data/ext/ruby_ndtypes/ndtypes/LICENSE.txt +29 -0
- data/ext/ruby_ndtypes/ndtypes/MANIFEST.in +3 -0
- data/ext/ruby_ndtypes/ndtypes/Makefile.in +87 -0
- data/ext/ruby_ndtypes/ndtypes/README.rst +47 -0
- data/ext/ruby_ndtypes/ndtypes/config.guess +1530 -0
- data/ext/ruby_ndtypes/ndtypes/config.h.in +67 -0
- data/ext/ruby_ndtypes/ndtypes/config.sub +1782 -0
- data/ext/ruby_ndtypes/ndtypes/configure +5260 -0
- data/ext/ruby_ndtypes/ndtypes/configure.ac +161 -0
- data/ext/ruby_ndtypes/ndtypes/doc/Makefile +14 -0
- data/ext/ruby_ndtypes/ndtypes/doc/_static/copybutton.js +66 -0
- data/ext/ruby_ndtypes/ndtypes/doc/conf.py +26 -0
- data/ext/ruby_ndtypes/ndtypes/doc/grammar/grammar.rst +27 -0
- data/ext/ruby_ndtypes/ndtypes/doc/index.rst +56 -0
- data/ext/ruby_ndtypes/ndtypes/doc/libndtypes/context.rst +131 -0
- data/ext/ruby_ndtypes/ndtypes/doc/libndtypes/encodings.rst +68 -0
- data/ext/ruby_ndtypes/ndtypes/doc/libndtypes/fields-values.rst +175 -0
- data/ext/ruby_ndtypes/ndtypes/doc/libndtypes/functions.rst +72 -0
- data/ext/ruby_ndtypes/ndtypes/doc/libndtypes/index.rst +43 -0
- data/ext/ruby_ndtypes/ndtypes/doc/libndtypes/init.rst +48 -0
- data/ext/ruby_ndtypes/ndtypes/doc/libndtypes/io.rst +100 -0
- data/ext/ruby_ndtypes/ndtypes/doc/libndtypes/memory.rst +124 -0
- data/ext/ruby_ndtypes/ndtypes/doc/libndtypes/predicates.rst +110 -0
- data/ext/ruby_ndtypes/ndtypes/doc/libndtypes/typedef.rst +31 -0
- data/ext/ruby_ndtypes/ndtypes/doc/libndtypes/types.rst +594 -0
- data/ext/ruby_ndtypes/ndtypes/doc/libndtypes/util.rst +166 -0
- data/ext/ruby_ndtypes/ndtypes/doc/ndtypes/buffer-protocol.rst +27 -0
- data/ext/ruby_ndtypes/ndtypes/doc/ndtypes/index.rst +21 -0
- data/ext/ruby_ndtypes/ndtypes/doc/ndtypes/pattern-matching.rst +330 -0
- data/ext/ruby_ndtypes/ndtypes/doc/ndtypes/quickstart.rst +144 -0
- data/ext/ruby_ndtypes/ndtypes/doc/ndtypes/types.rst +544 -0
- data/ext/ruby_ndtypes/ndtypes/doc/releases/index.rst +35 -0
- data/ext/ruby_ndtypes/ndtypes/install-sh +527 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/Makefile.in +271 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/Makefile.vc +269 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/alloc.c +230 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/attr.c +268 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/attr.h +109 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/compat/Makefile.in +73 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/compat/Makefile.vc +70 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/compat/README.txt +16 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/compat/bpgrammar.c +2179 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/compat/bpgrammar.h +134 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/compat/bpgrammar.y +428 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/compat/bplexer.c +2543 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/compat/bplexer.h +735 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/compat/bplexer.l +176 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/compat/export.c +543 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/compat/import.c +110 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/context.c +228 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/copy.c +634 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/encodings.c +116 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/equal.c +288 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/grammar.c +3067 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/grammar.h +180 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/grammar.y +417 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/io.c +1658 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/lexer.c +2773 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/lexer.h +734 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/lexer.l +222 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/match.c +1132 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/ndtypes.c +2323 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/ndtypes.h.in +893 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/overflow.h +161 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/parsefuncs.c +473 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/parsefuncs.h +92 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/parser.c +246 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/seq.c +269 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/seq.h +197 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/serialize/Makefile.in +48 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/serialize/Makefile.vc +46 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/serialize/deserialize.c +1007 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/serialize/serialize.c +442 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/slice.h +42 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/substitute.c +238 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/substitute.h +50 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/symtable.c +371 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/symtable.h +100 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/tests/Makefile.in +55 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/tests/Makefile.vc +45 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/tests/alloc_fail.c +82 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/tests/alloc_fail.h +49 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/tests/runtest.c +1657 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/tests/test.h +85 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/tests/test_array.c +115 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/tests/test_buffer.c +137 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/tests/test_indent.c +201 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/tests/test_match.c +2397 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/tests/test_numba.c +57 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/tests/test_parse.c +349 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/tests/test_parse_error.c +27839 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/tests/test_parse_roundtrip.c +350 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/tests/test_record.c +231 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/tests/test_typecheck.c +375 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/tests/test_typedef.c +65 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/tests/valgrind.supp +30 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/tools/bench.c +79 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/tools/indent.c +94 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/tools/print_ast.c +96 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/util.c +474 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/values.c +228 -0
- data/ext/ruby_ndtypes/ndtypes/python/bench.py +49 -0
- data/ext/ruby_ndtypes/ndtypes/python/ndt_randtype.py +409 -0
- data/ext/ruby_ndtypes/ndtypes/python/ndt_support.py +14 -0
- data/ext/ruby_ndtypes/ndtypes/python/ndtypes/__init__.py +70 -0
- data/ext/ruby_ndtypes/ndtypes/python/ndtypes/_ndtypes.c +1332 -0
- data/ext/ruby_ndtypes/ndtypes/python/ndtypes/docstrings.h +319 -0
- data/ext/ruby_ndtypes/ndtypes/python/ndtypes/pyndtypes.h +154 -0
- data/ext/ruby_ndtypes/ndtypes/python/test_ndtypes.py +1977 -0
- data/ext/ruby_ndtypes/ndtypes/setup.py +288 -0
- data/ext/ruby_ndtypes/ndtypes/vcbuild/INSTALL.txt +41 -0
- data/ext/ruby_ndtypes/ndtypes/vcbuild/runtest32.bat +15 -0
- data/ext/ruby_ndtypes/ndtypes/vcbuild/runtest64.bat +13 -0
- data/ext/ruby_ndtypes/ndtypes/vcbuild/vcbuild32.bat +38 -0
- data/ext/ruby_ndtypes/ndtypes/vcbuild/vcbuild64.bat +38 -0
- data/ext/ruby_ndtypes/ndtypes/vcbuild/vcclean.bat +13 -0
- data/ext/ruby_ndtypes/ndtypes/vcbuild/vcdistclean.bat +14 -0
- data/ext/ruby_ndtypes/ruby_ndtypes.c +1003 -0
- data/ext/ruby_ndtypes/ruby_ndtypes.h +37 -0
- data/ext/ruby_ndtypes/ruby_ndtypes_internal.h +28 -0
- data/lib/ndtypes.rb +45 -0
- data/lib/ndtypes/errors.rb +2 -0
- data/lib/ndtypes/version.rb +6 -0
- data/ndtypes.gemspec +47 -0
- data/spec/gc_table_spec.rb +10 -0
- data/spec/ndtypes_spec.rb +289 -0
- data/spec/spec_helper.rb +241 -0
- metadata +242 -0
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
|
|
2
|
+
AC_PREREQ([2.67])
|
|
3
|
+
AC_INIT(ndtypes, 0.2.0dev3, skrah@bytereef.org, ndtypes, https://github.com/plures/)
|
|
4
|
+
AC_CONFIG_HEADER(config.h)
|
|
5
|
+
AC_CONFIG_FILES([
|
|
6
|
+
Makefile
|
|
7
|
+
libndtypes/Makefile libndtypes/tests/Makefile libndtypes/ndtypes.h
|
|
8
|
+
libndtypes/compat/Makefile
|
|
9
|
+
libndtypes/serialize/Makefile
|
|
10
|
+
])
|
|
11
|
+
|
|
12
|
+
# System and machine type (only used for Darwin):
|
|
13
|
+
AC_MSG_CHECKING(system as reported by uname -s)
|
|
14
|
+
ac_sys_system=`uname -s`
|
|
15
|
+
AC_MSG_RESULT($ac_sys_system)
|
|
16
|
+
|
|
17
|
+
LIBSTATIC=libndtypes.a
|
|
18
|
+
case $ac_sys_system in
|
|
19
|
+
darwin*|Darwin*)
|
|
20
|
+
LIBRARY_PATH="DYLD_LIBRARY_PATH"
|
|
21
|
+
LIBNAME="libndtypes.dylib"
|
|
22
|
+
LIBSONAME="libndtypes.0.dylib"
|
|
23
|
+
LIBSHARED="libndtypes.0.2.0dev3.dylib"
|
|
24
|
+
CONFIGURE_LDFLAGS="-dynamiclib -install_name @rpath/$LIBSONAME -compatibility_version 0.2 -current_version 0.2.0"
|
|
25
|
+
;;
|
|
26
|
+
*)
|
|
27
|
+
LIBRARY_PATH="LD_LIBRARY_PATH"
|
|
28
|
+
LIBNAME="libndtypes.so"
|
|
29
|
+
LIBSONAME="libndtypes.so.0"
|
|
30
|
+
LIBSHARED="libndtypes.so.0.2.0dev3"
|
|
31
|
+
CONFIGURE_LDFLAGS="-shared -Wl,-soname,$LIBSONAME"
|
|
32
|
+
;;
|
|
33
|
+
esac
|
|
34
|
+
|
|
35
|
+
AC_SUBST(LIBSTATIC)
|
|
36
|
+
AC_SUBST(LIBRARY_PATH)
|
|
37
|
+
AC_SUBST(LIBNAME)
|
|
38
|
+
AC_SUBST(LIBSONAME)
|
|
39
|
+
AC_SUBST(LIBSHARED)
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
# Apparently purely informational for this particular build:
|
|
43
|
+
AC_CANONICAL_HOST
|
|
44
|
+
AC_SUBST(build)
|
|
45
|
+
AC_SUBST(host)
|
|
46
|
+
|
|
47
|
+
# Language and compiler:
|
|
48
|
+
AC_LANG_C
|
|
49
|
+
saved_cflags=$CFLAGS
|
|
50
|
+
AC_PROG_CC
|
|
51
|
+
CFLAGS=$saved_cflags
|
|
52
|
+
|
|
53
|
+
# ar and ranlib:
|
|
54
|
+
AC_CHECK_TOOL(AR, ar, ar)
|
|
55
|
+
AC_PROG_RANLIB
|
|
56
|
+
AC_SUBST(RANLIB)
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
# Checks for header files:
|
|
60
|
+
AC_HEADER_STDC
|
|
61
|
+
|
|
62
|
+
# Install program:
|
|
63
|
+
AC_PROG_INSTALL
|
|
64
|
+
AC_SUBST(INSTALL)
|
|
65
|
+
|
|
66
|
+
# Endianness:
|
|
67
|
+
AC_C_BIGENDIAN
|
|
68
|
+
|
|
69
|
+
if test "$ac_cv_c_bigendian" = "yes"; then
|
|
70
|
+
NDT_SYS_BIG_ENDIAN=1
|
|
71
|
+
else
|
|
72
|
+
NDT_SYS_BIG_ENDIAN=0
|
|
73
|
+
fi
|
|
74
|
+
|
|
75
|
+
AC_SUBST(NDT_SYS_BIG_ENDIAN)
|
|
76
|
+
|
|
77
|
+
# Exact memcheck:
|
|
78
|
+
AC_MSG_CHECKING([for --with-valgrind])
|
|
79
|
+
AC_ARG_WITH([valgrind],
|
|
80
|
+
AS_HELP_STRING([--with-valgrind], [enable exact memcheck]),,
|
|
81
|
+
with_valgrind=no)
|
|
82
|
+
AC_MSG_RESULT([$with_valgrind])
|
|
83
|
+
if test "$with_valgrind" != no; then
|
|
84
|
+
AC_CHECK_HEADER([valgrind/memcheck.h],
|
|
85
|
+
[AC_DEFINE([WITH_VALGRIND], 1, [required for exact memcheck])],
|
|
86
|
+
[AC_MSG_ERROR([exact memcheck requested but headers not available])]
|
|
87
|
+
)
|
|
88
|
+
fi
|
|
89
|
+
|
|
90
|
+
# Without documentation:
|
|
91
|
+
AC_MSG_CHECKING([for --with-docs])
|
|
92
|
+
AC_ARG_WITH([docs],
|
|
93
|
+
AS_HELP_STRING([--with-docs], [install documentation - enabled by default]),,
|
|
94
|
+
with_docs=yes)
|
|
95
|
+
AC_MSG_RESULT([$with_docs])
|
|
96
|
+
if test "$with_docs" = yes; then
|
|
97
|
+
NDT_INSTALL_DOCS="install_docs"
|
|
98
|
+
else
|
|
99
|
+
NDT_INSTALL_DOCS=""
|
|
100
|
+
fi
|
|
101
|
+
|
|
102
|
+
AC_SUBST(NDT_INSTALL_DOCS)
|
|
103
|
+
|
|
104
|
+
# Compiler dependent settings:
|
|
105
|
+
NDT_WARN=
|
|
106
|
+
NDT_OPT="-O2 -g"
|
|
107
|
+
case $CC in
|
|
108
|
+
*gcc*)
|
|
109
|
+
NDT_WARN="-Wall -Wextra -std=c11 -pedantic"
|
|
110
|
+
NDT_OPT="-O2 -g"
|
|
111
|
+
NDT_COV_CFLAGS="-O0 -g -fno-inline -fprofile-arcs -ftest-coverage"
|
|
112
|
+
NDT_COV_LDFLAGS="-fprofile-arcs"
|
|
113
|
+
;;
|
|
114
|
+
*icc*)
|
|
115
|
+
AR=xiar
|
|
116
|
+
NDT_WARN="-Wall"
|
|
117
|
+
NDT_OPT="-O2 -g"
|
|
118
|
+
NDT_COV_CFLAGS=""
|
|
119
|
+
NDT_COV_LDFLAGS=""
|
|
120
|
+
;;
|
|
121
|
+
*clang*)
|
|
122
|
+
NDT_WARN="-Wall -Wextra -std=c11 -pedantic"
|
|
123
|
+
NDT_OPT="-O2 -g"
|
|
124
|
+
NDT_COV_CFLAGS="-O0 -g -fno-inline -fprofile-arcs -ftest-coverage"
|
|
125
|
+
NDT_COV_LDFLAGS="-fprofile-arcs"
|
|
126
|
+
;;
|
|
127
|
+
esac
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
# Substitute variables and generate output:
|
|
131
|
+
if test -z "$LD"; then
|
|
132
|
+
LD="$CC"
|
|
133
|
+
fi
|
|
134
|
+
AC_SUBST(LD)
|
|
135
|
+
AC_SUBST(AR)
|
|
136
|
+
AC_SUBST(NDT_WARN)
|
|
137
|
+
AC_SUBST(NDT_OPT)
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
if test -z "$CFLAGS"; then
|
|
141
|
+
CONFIGURE_CFLAGS="-I.. $NDT_WARN $NDT_OPT"
|
|
142
|
+
CONFIGURE_COV_CFLAGS="-I.. $NDT_WARN $NDT_COV_CFLAGS"
|
|
143
|
+
else
|
|
144
|
+
CONFIGURE_CFLAGS="-I.. $NDT_WARN $NDT_OPT $CFLAGS"
|
|
145
|
+
CONFIGURE_COV_CFLAGS="-I.. $NDT_WARN $NDT_COV_CFLAGS $CFLAGS"
|
|
146
|
+
fi
|
|
147
|
+
|
|
148
|
+
CONFIGURE_COV_LDFLAGS="$CONFIGURE_LDFLAGS $NDT_COV_LDFLAGS"
|
|
149
|
+
if test -n "$LDFLAGS"; then
|
|
150
|
+
CONFIGURE_LDFLAGS="$CONFIGURE_LDFLAGS $LDFLAGS"
|
|
151
|
+
CONFIGURE_COV_LDFLAGS="$CONFIGURE_COV_LDFLAGS $LDFLAGS"
|
|
152
|
+
fi
|
|
153
|
+
|
|
154
|
+
AC_SUBST(CONFIGURE_CFLAGS)
|
|
155
|
+
AC_SUBST(CONFIGURE_LDFLAGS)
|
|
156
|
+
|
|
157
|
+
AC_SUBST(CONFIGURE_COV_CFLAGS)
|
|
158
|
+
AC_SUBST(CONFIGURE_COV_LDFLAGS)
|
|
159
|
+
|
|
160
|
+
AC_OUTPUT
|
|
161
|
+
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# Makefile for Sphinx documentation.
|
|
2
|
+
SPHINXBUILD = sphinx-build
|
|
3
|
+
BUILDDIR = build
|
|
4
|
+
|
|
5
|
+
default: html
|
|
6
|
+
|
|
7
|
+
html:
|
|
8
|
+
sphinx-build -b html -d build/doctrees . build/html
|
|
9
|
+
|
|
10
|
+
doctest:
|
|
11
|
+
sphinx-build -b doctest -d build/doctrees . build/html
|
|
12
|
+
|
|
13
|
+
clean:
|
|
14
|
+
rm -rf $(BUILDDIR)/*
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
// Copyright 2014 PSF. Licensed under the PYTHON SOFTWARE FOUNDATION LICENSE VERSION 2
|
|
2
|
+
// File originates from the cpython source found in Doc/tools/sphinxext/static/copybutton.js
|
|
3
|
+
|
|
4
|
+
$(document).ready(function() {
|
|
5
|
+
/* Add a [>>>] button on the top-right corner of code samples to hide
|
|
6
|
+
* the >>> and ... prompts and the output and thus make the code
|
|
7
|
+
* copyable. */
|
|
8
|
+
var div = $('.highlight-py .highlight,' +
|
|
9
|
+
'.highlight-default .highlight,' +
|
|
10
|
+
'.highlight-py3 .highlight')
|
|
11
|
+
var pre = div.find('pre');
|
|
12
|
+
|
|
13
|
+
// get the styles from the current theme
|
|
14
|
+
pre.parent().parent().css('position', 'relative');
|
|
15
|
+
var hide_text = 'Hide the prompts and output';
|
|
16
|
+
var show_text = 'Show the prompts and output';
|
|
17
|
+
var border_width = pre.css('border-top-width');
|
|
18
|
+
var border_style = pre.css('border-top-style');
|
|
19
|
+
var border_color = pre.css('border-top-color');
|
|
20
|
+
var button_styles = {
|
|
21
|
+
'cursor':'pointer', 'position': 'absolute', 'top': '0', 'right': '0',
|
|
22
|
+
'border-color': border_color, 'border-style': border_style,
|
|
23
|
+
'border-width': border_width, 'color': border_color, 'text-size': '75%',
|
|
24
|
+
'font-family': 'monospace', 'padding-left': '0.2em', 'padding-right': '0.2em',
|
|
25
|
+
'border-radius': '0 3px 0 0'
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
// create and add the button to all the code blocks that contain >>>
|
|
29
|
+
div.each(function(index) {
|
|
30
|
+
var jthis = $(this);
|
|
31
|
+
if (jthis.find('.gp').length > 0) {
|
|
32
|
+
var button = $('<span class="copybutton">>>></span>');
|
|
33
|
+
button.css(button_styles)
|
|
34
|
+
button.attr('title', hide_text);
|
|
35
|
+
button.data('hidden', 'false');
|
|
36
|
+
jthis.prepend(button);
|
|
37
|
+
}
|
|
38
|
+
// tracebacks (.gt) contain bare text elements that need to be
|
|
39
|
+
// wrapped in a span to work with .nextUntil() (see later)
|
|
40
|
+
jthis.find('pre:has(.gt)').contents().filter(function() {
|
|
41
|
+
return ((this.nodeType == 3) && (this.data.trim().length > 0));
|
|
42
|
+
}).wrap('<span>');
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
// define the behavior of the button when it's clicked
|
|
46
|
+
$('.copybutton').click(function(e){
|
|
47
|
+
e.preventDefault();
|
|
48
|
+
var button = $(this);
|
|
49
|
+
if (button.data('hidden') === 'false') {
|
|
50
|
+
// hide the code output
|
|
51
|
+
button.parent().find('.go, .gp, .gt').hide();
|
|
52
|
+
button.next('pre').find('.gt').nextUntil('.gp, .go').css('visibility', 'hidden');
|
|
53
|
+
button.css('text-decoration', 'line-through');
|
|
54
|
+
button.attr('title', show_text);
|
|
55
|
+
button.data('hidden', 'true');
|
|
56
|
+
} else {
|
|
57
|
+
// show the code output
|
|
58
|
+
button.parent().find('.go, .gp, .gt').show();
|
|
59
|
+
button.next('pre').find('.gt').nextUntil('.gp, .go').css('visibility', 'visible');
|
|
60
|
+
button.css('text-decoration', 'none');
|
|
61
|
+
button.attr('title', hide_text);
|
|
62
|
+
button.data('hidden', 'false');
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
});
|
|
66
|
+
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import sys, os, docutils
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
extensions = ['sphinx.ext.intersphinx', 'sphinx.ext.doctest']
|
|
5
|
+
|
|
6
|
+
source_suffix = '.rst'
|
|
7
|
+
master_doc = 'index'
|
|
8
|
+
project = 'ndtypes'
|
|
9
|
+
copyright = '2017-2018, Plures Project'
|
|
10
|
+
version = 'v0.2.0dev3'
|
|
11
|
+
release = 'v0.2.0dev3'
|
|
12
|
+
exclude_patterns = ['doc', 'build']
|
|
13
|
+
pygments_style = 'sphinx'
|
|
14
|
+
html_static_path = ['_static']
|
|
15
|
+
|
|
16
|
+
primary_domain = 'py'
|
|
17
|
+
add_function_parentheses = False
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
def setup(app):
|
|
21
|
+
app.add_crossref_type('topic', 'topic', 'single: %s',
|
|
22
|
+
docutils.nodes.strong)
|
|
23
|
+
app.add_javascript("copybutton.js")
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
.. meta::
|
|
2
|
+
:robots: index,follow
|
|
3
|
+
:description: libndtypes datashape documentation
|
|
4
|
+
|
|
5
|
+
.. sectionauthor:: Stefan Krah <skrah at bytereef.org>
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
Grammar
|
|
9
|
+
=======
|
|
10
|
+
|
|
11
|
+
Lexing
|
|
12
|
+
------
|
|
13
|
+
|
|
14
|
+
The latest version of the lexer can be found here:
|
|
15
|
+
|
|
16
|
+
`lexer.l <https://github.com/plures/ndtypes/blob/master/libndtypes/lexer.l>`_
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
Parsing
|
|
20
|
+
-------
|
|
21
|
+
|
|
22
|
+
The latest version of the grammar can be found here:
|
|
23
|
+
|
|
24
|
+
`grammar.y <https://github.com/plures/ndtypes/blob/master/libndtypes/grammar.y>`_
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
.. meta::
|
|
2
|
+
:robots: index, follow
|
|
3
|
+
:description: libndtypes documentation
|
|
4
|
+
:keywords: datashape, libndtypes, C, Python, array computing
|
|
5
|
+
|
|
6
|
+
.. sectionauthor:: Stefan Krah <skrah at bytereef.org>
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
ndtypes
|
|
10
|
+
=======
|
|
11
|
+
|
|
12
|
+
ndtypes is a package for typing raw memory blocks using a close variant
|
|
13
|
+
of the datashape type language.
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
Libndtypes
|
|
17
|
+
----------
|
|
18
|
+
|
|
19
|
+
C library.
|
|
20
|
+
|
|
21
|
+
.. toctree::
|
|
22
|
+
:maxdepth: 1
|
|
23
|
+
|
|
24
|
+
libndtypes/index.rst
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
Ndtypes
|
|
28
|
+
-------
|
|
29
|
+
|
|
30
|
+
Python bindings for libndtypes.
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
.. toctree::
|
|
34
|
+
:maxdepth: 1
|
|
35
|
+
|
|
36
|
+
ndtypes/index.rst
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
Grammar
|
|
40
|
+
-------
|
|
41
|
+
|
|
42
|
+
Type grammar.
|
|
43
|
+
|
|
44
|
+
.. toctree::
|
|
45
|
+
:maxdepth: 1
|
|
46
|
+
|
|
47
|
+
grammar/grammar.rst
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
Releases
|
|
51
|
+
--------
|
|
52
|
+
|
|
53
|
+
.. toctree::
|
|
54
|
+
:maxdepth: 1
|
|
55
|
+
|
|
56
|
+
releases/index.rst
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
.. meta::
|
|
2
|
+
:robots: index,follow
|
|
3
|
+
:description: libndtypes documentation
|
|
4
|
+
|
|
5
|
+
.. sectionauthor:: Stefan Krah <skrah at bytereef.org>
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
Context
|
|
9
|
+
=======
|
|
10
|
+
|
|
11
|
+
The context is used to facilitate error handling. The context struct itself
|
|
12
|
+
should not be considered public and is subject to change.
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
Constants
|
|
16
|
+
---------
|
|
17
|
+
|
|
18
|
+
The *err* field of the context is set to one of the following enum values:
|
|
19
|
+
|
|
20
|
+
.. code-block:: c
|
|
21
|
+
|
|
22
|
+
#include <ndtypes.h>
|
|
23
|
+
|
|
24
|
+
enum ndt_error {
|
|
25
|
+
NDT_Success,
|
|
26
|
+
NDT_ValueError,
|
|
27
|
+
NDT_TypeError,
|
|
28
|
+
NDT_InvalidArgumentError,
|
|
29
|
+
NDT_NotImplementedError,
|
|
30
|
+
NDT_LexError,
|
|
31
|
+
NDT_ParseError,
|
|
32
|
+
NDT_OSError,
|
|
33
|
+
NDT_RuntimeError,
|
|
34
|
+
NDT_MemoryError
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
Static contexts
|
|
39
|
+
---------------
|
|
40
|
+
|
|
41
|
+
.. code-block:: c
|
|
42
|
+
|
|
43
|
+
NDT_STATIC_CONTEXT(ctx);
|
|
44
|
+
|
|
45
|
+
This creates a static context, usually a local variable in a function.
|
|
46
|
+
Error messages may be dynamically allocated, so :func:`ndt_context_del`
|
|
47
|
+
must be called on static contexts, too.
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
Functions
|
|
51
|
+
---------
|
|
52
|
+
|
|
53
|
+
.. topic:: ndt_context_new
|
|
54
|
+
.. topic:: ndt_context_del
|
|
55
|
+
|
|
56
|
+
.. code-block:: c
|
|
57
|
+
|
|
58
|
+
ndt_context_t *ndt_context_new(void);
|
|
59
|
+
void ndt_context_del(ndt_context_t *ctx);
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
Create an initialized context or delete a context. It is safe to call
|
|
63
|
+
:func:`ndt_context_del` on both dynamic and static contexts.
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
.. topic:: ndt_err_format
|
|
67
|
+
|
|
68
|
+
.. code-block:: c
|
|
69
|
+
|
|
70
|
+
void ndt_err_format(ndt_context_t *ctx, enum ndt_error err, const char *fmt, ...);
|
|
71
|
+
|
|
72
|
+
Set a context's error constant and error message. *fmt* may contain the same
|
|
73
|
+
format specifiers as :func:`printf`.
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
.. topic:: ndt_err_occurred
|
|
77
|
+
|
|
78
|
+
.. code-block:: c
|
|
79
|
+
|
|
80
|
+
int ndt_err_occurred(const ndt_context_t *ctx);
|
|
81
|
+
|
|
82
|
+
Check if an error has occurred.
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
.. topic:: ndt_err_clear
|
|
86
|
+
|
|
87
|
+
.. code-block:: c
|
|
88
|
+
|
|
89
|
+
void ndt_err_clear(ndt_context_t *ctx);
|
|
90
|
+
|
|
91
|
+
Clear an error.
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
.. topic:: ndt_memory_error
|
|
95
|
+
|
|
96
|
+
.. code-block:: c
|
|
97
|
+
|
|
98
|
+
void *ndt_memory_error(ndt_context_t *ctx);
|
|
99
|
+
|
|
100
|
+
Convenience function. Set :c:macro:`NDT_MemoryError` and return :c:macro:`NULL`;
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
.. topic:: ndt_err_as_string
|
|
104
|
+
|
|
105
|
+
.. code-block:: c
|
|
106
|
+
|
|
107
|
+
const char *ndt_err_as_string(enum ndt_error err);
|
|
108
|
+
|
|
109
|
+
Get the string representation of an error constant.
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
.. topic:: ndt_context_msg
|
|
113
|
+
|
|
114
|
+
.. code-block:: c
|
|
115
|
+
|
|
116
|
+
const char *ndt_context_msg(ndt_context_t *ctx);
|
|
117
|
+
|
|
118
|
+
Get the current error string. It is safe to call this function if no
|
|
119
|
+
error has occurred, in which case the string is :c:macro:`Success`.
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
.. topic:: ndt_err_fprint
|
|
123
|
+
|
|
124
|
+
.. code-block:: c
|
|
125
|
+
|
|
126
|
+
ndt_err_fprint(FILE *fp, ndt_context_t *ctx);
|
|
127
|
+
|
|
128
|
+
Print an error to *fp*. Mostly useful for debugging.
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
|