@port-labs/jq-node-bindings 0.0.1

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.
Files changed (131) hide show
  1. package/.editorconfig +5 -0
  2. package/.jshintignore +1 -0
  3. package/.jshintrc +23 -0
  4. package/binding.gyp +56 -0
  5. package/configure +26 -0
  6. package/deps/jq/.gitattributes +2 -0
  7. package/deps/jq/.travis.yml +53 -0
  8. package/deps/jq/AUTHORS +73 -0
  9. package/deps/jq/COPYING +70 -0
  10. package/deps/jq/ChangeLog +1349 -0
  11. package/deps/jq/Makefile.am +198 -0
  12. package/deps/jq/NEWS +88 -0
  13. package/deps/jq/README.md +64 -0
  14. package/deps/jq/builtin.c +1684 -0
  15. package/deps/jq/builtin.h +10 -0
  16. package/deps/jq/bytecode.c +161 -0
  17. package/deps/jq/bytecode.h +92 -0
  18. package/deps/jq/compile-ios.sh +102 -0
  19. package/deps/jq/compile.c +1210 -0
  20. package/deps/jq/compile.h +101 -0
  21. package/deps/jq/config/m4/check-math-func.m4 +4 -0
  22. package/deps/jq/config/m4/find-func-no-libs.m4 +8 -0
  23. package/deps/jq/config/m4/find-func-no-libs2.m4 +62 -0
  24. package/deps/jq/config/m4/find-func.m4 +9 -0
  25. package/deps/jq/config/m4/misc.m4 +3 -0
  26. package/deps/jq/configure.ac +221 -0
  27. package/deps/jq/docs/Gemfile +7 -0
  28. package/deps/jq/docs/Gemfile.lock +63 -0
  29. package/deps/jq/docs/README.md +25 -0
  30. package/deps/jq/docs/Rakefile +145 -0
  31. package/deps/jq/docs/content/1.tutorial/default.yml +327 -0
  32. package/deps/jq/docs/content/2.download/default.yml +117 -0
  33. package/deps/jq/docs/content/3.manual/manual.yml +2878 -0
  34. package/deps/jq/docs/content/3.manual/v1.3/manual.yml +1270 -0
  35. package/deps/jq/docs/content/3.manual/v1.4/manual.yml +1672 -0
  36. package/deps/jq/docs/content/index/index.yml +51 -0
  37. package/deps/jq/docs/default_manpage.md +22 -0
  38. package/deps/jq/docs/public/.htaccess +28 -0
  39. package/deps/jq/docs/public/bootstrap/css/bootstrap-responsive.css +1058 -0
  40. package/deps/jq/docs/public/bootstrap/css/bootstrap-responsive.min.css +9 -0
  41. package/deps/jq/docs/public/bootstrap/css/bootstrap.css +5224 -0
  42. package/deps/jq/docs/public/bootstrap/css/bootstrap.min.css +9 -0
  43. package/deps/jq/docs/public/bootstrap/img/glyphicons-halflings-white.png +0 -0
  44. package/deps/jq/docs/public/bootstrap/img/glyphicons-halflings.png +0 -0
  45. package/deps/jq/docs/public/bootstrap/js/bootstrap.js +2027 -0
  46. package/deps/jq/docs/public/bootstrap/js/bootstrap.min.js +6 -0
  47. package/deps/jq/docs/public/css/base.scss +99 -0
  48. package/deps/jq/docs/public/jq.png +0 -0
  49. package/deps/jq/docs/public/robots.txt +2 -0
  50. package/deps/jq/docs/site.yml +18 -0
  51. package/deps/jq/docs/templates/default.liquid +34 -0
  52. package/deps/jq/docs/templates/index.liquid +60 -0
  53. package/deps/jq/docs/templates/manual.liquid +122 -0
  54. package/deps/jq/docs/templates/shared/_footer.liquid +5 -0
  55. package/deps/jq/docs/templates/shared/_head.liquid +12 -0
  56. package/deps/jq/docs/templates/shared/_header.liquid +26 -0
  57. package/deps/jq/exec_stack.h +112 -0
  58. package/deps/jq/execute.c +1155 -0
  59. package/deps/jq/inject_errors.c +112 -0
  60. package/deps/jq/jq.1.default +39 -0
  61. package/deps/jq/jq.1.prebuilt +3075 -0
  62. package/deps/jq/jq.h +60 -0
  63. package/deps/jq/jq.spec +70 -0
  64. package/deps/jq/jq_parser.h +9 -0
  65. package/deps/jq/jq_test.c +346 -0
  66. package/deps/jq/jv.c +1333 -0
  67. package/deps/jq/jv.h +240 -0
  68. package/deps/jq/jv_alloc.c +179 -0
  69. package/deps/jq/jv_alloc.h +27 -0
  70. package/deps/jq/jv_aux.c +619 -0
  71. package/deps/jq/jv_dtoa.c +4275 -0
  72. package/deps/jq/jv_dtoa.h +22 -0
  73. package/deps/jq/jv_file.c +49 -0
  74. package/deps/jq/jv_parse.c +852 -0
  75. package/deps/jq/jv_print.c +348 -0
  76. package/deps/jq/jv_unicode.c +96 -0
  77. package/deps/jq/jv_unicode.h +11 -0
  78. package/deps/jq/jv_utf8_tables.h +37 -0
  79. package/deps/jq/lexer.c +2442 -0
  80. package/deps/jq/lexer.h +362 -0
  81. package/deps/jq/lexer.l +184 -0
  82. package/deps/jq/libm.h +160 -0
  83. package/deps/jq/linker.c +393 -0
  84. package/deps/jq/linker.h +7 -0
  85. package/deps/jq/locfile.c +91 -0
  86. package/deps/jq/locfile.h +29 -0
  87. package/deps/jq/m4/ax_compare_version.m4 +177 -0
  88. package/deps/jq/m4/ax_prog_bison_version.m4 +68 -0
  89. package/deps/jq/main.c +566 -0
  90. package/deps/jq/opcode_list.h +44 -0
  91. package/deps/jq/parser.c +3914 -0
  92. package/deps/jq/parser.h +193 -0
  93. package/deps/jq/parser.y +923 -0
  94. package/deps/jq/scripts/crosscompile +42 -0
  95. package/deps/jq/scripts/gen_utf8_tables.py +32 -0
  96. package/deps/jq/scripts/version +5 -0
  97. package/deps/jq/setup.sh +33 -0
  98. package/deps/jq/tests/jq.test +1235 -0
  99. package/deps/jq/tests/jqtest +5 -0
  100. package/deps/jq/tests/mantest +7 -0
  101. package/deps/jq/tests/modules/.jq +5 -0
  102. package/deps/jq/tests/modules/a.jq +2 -0
  103. package/deps/jq/tests/modules/b/b.jq +2 -0
  104. package/deps/jq/tests/modules/c/c.jq +16 -0
  105. package/deps/jq/tests/modules/c/d.jq +1 -0
  106. package/deps/jq/tests/modules/data.json +4 -0
  107. package/deps/jq/tests/modules/lib/jq/e/e.jq +1 -0
  108. package/deps/jq/tests/modules/lib/jq/f.jq +1 -0
  109. package/deps/jq/tests/modules/syntaxerror/syntaxerror.jq +1 -0
  110. package/deps/jq/tests/modules/test_bind_order.jq +4 -0
  111. package/deps/jq/tests/modules/test_bind_order0.jq +1 -0
  112. package/deps/jq/tests/modules/test_bind_order1.jq +2 -0
  113. package/deps/jq/tests/modules/test_bind_order2.jq +2 -0
  114. package/deps/jq/tests/onig.supp +21 -0
  115. package/deps/jq/tests/onig.test +85 -0
  116. package/deps/jq/tests/onigtest +5 -0
  117. package/deps/jq/tests/setup +36 -0
  118. package/deps/jq/tests/shtest +205 -0
  119. package/deps/jq/tests/torture/input0.json +7 -0
  120. package/deps/jq/util.c +462 -0
  121. package/deps/jq/util.h +64 -0
  122. package/deps/jq.gyp +35 -0
  123. package/index.d.ts +3 -0
  124. package/jest.config.js +10 -0
  125. package/lib/index.js +14 -0
  126. package/package.json +48 -0
  127. package/reports/jest-port-api.xml +35 -0
  128. package/src/binding.cc +177 -0
  129. package/src/binding.h +13 -0
  130. package/test/santiy.test.js +122 -0
  131. package/util/configure.js +27 -0
@@ -0,0 +1,101 @@
1
+ #ifndef COMPILE_H
2
+ #define COMPILE_H
3
+ #include <stdint.h>
4
+ #include "jv.h"
5
+ #include "bytecode.h"
6
+ #include "locfile.h"
7
+
8
+ struct inst;
9
+ typedef struct inst inst;
10
+
11
+
12
+ typedef struct block {
13
+ inst* first;
14
+ inst* last;
15
+ } block;
16
+
17
+ block gen_location(location, struct locfile*, block);
18
+
19
+ block gen_noop();
20
+ int block_is_noop(block b);
21
+ block gen_op_simple(opcode op);
22
+ block gen_const(jv constant);
23
+ block gen_const_global(jv constant, const char *name);
24
+ int block_is_const(block b);
25
+ int block_is_const_inf(block b);
26
+ jv_kind block_const_kind(block b);
27
+ jv block_const(block b);
28
+ block gen_op_target(opcode op, block target);
29
+ block gen_op_unbound(opcode op, const char* name);
30
+ block gen_op_bound(opcode op, block binder);
31
+ block gen_op_var_fresh(opcode op, const char* name);
32
+
33
+ block gen_module(block metadata);
34
+ jv block_module_meta(block b);
35
+ block gen_import(const char* name, block metadata, const char *as, int is_data);
36
+ block gen_function(const char* name, block formals, block body);
37
+ block gen_param_regular(const char* name);
38
+ block gen_param(const char* name);
39
+ block gen_lambda(block body);
40
+ block gen_call(const char* name, block body);
41
+ block gen_subexp(block a);
42
+ block gen_both(block a, block b);
43
+ block gen_const_object(block expr);
44
+ block gen_collect(block expr);
45
+ block gen_reduce(block source, block matcher, block init, block body);
46
+ block gen_foreach(block source, block matcher, block init, block update, block extract);
47
+ block gen_definedor(block a, block b);
48
+ block gen_condbranch(block iftrue, block iffalse);
49
+ block gen_and(block a, block b);
50
+ block gen_or(block a, block b);
51
+
52
+ block gen_var_binding(block var, const char* name, block body);
53
+ block gen_array_matcher(block left, block curr);
54
+ block gen_object_matcher(block name, block curr);
55
+ block gen_destructure(block var, block matcher, block body);
56
+
57
+ block gen_cond(block cond, block iftrue, block iffalse);
58
+ block gen_try_handler(block handler);
59
+ block gen_try(block exp, block handler);
60
+ block gen_label(const char *label, block exp);
61
+
62
+ block gen_cbinding(const struct cfunction* functions, int nfunctions, block b);
63
+
64
+ void block_append(block* b, block b2);
65
+ block block_join(block a, block b);
66
+ int block_has_only_binders_and_imports(block, int bindflags);
67
+ int block_has_only_binders(block, int bindflags);
68
+ int block_has_main(block);
69
+ int block_is_funcdef(block b);
70
+ int block_is_single(block b);
71
+ block block_bind(block binder, block body, int bindflags);
72
+ block block_bind_library(block binder, block body, int bindflags, const char* libname);
73
+ block block_bind_referenced(block binder, block body, int bindflags);
74
+ block block_drop_unreferenced(block body);
75
+
76
+ jv block_take_imports(block* body);
77
+
78
+ int block_compile(block, struct bytecode**, struct locfile*);
79
+
80
+ void block_free(block);
81
+
82
+
83
+
84
+ // Here's some horrible preprocessor gunk so that code
85
+ // sequences can be contructed as BLOCK(block1, block2, block3)
86
+
87
+ #define BLOCK_1(b1) (b1)
88
+ #define BLOCK_2(b1,b2) (block_join((b1),(b2)))
89
+ #define BLOCK_3(b1,b2,b3) (block_join(BLOCK_2(b1,b2),(b3)))
90
+ #define BLOCK_4(b1,b2,b3,b4) (block_join(BLOCK_3(b1,b2,b3),(b4)))
91
+ #define BLOCK_5(b1,b2,b3,b4,b5) (block_join(BLOCK_4(b1,b2,b3,b4),(b5)))
92
+ #define BLOCK_6(b1,b2,b3,b4,b5,b6) (block_join(BLOCK_5(b1,b2,b3,b4,b5),(b6)))
93
+ #define BLOCK_7(b1,b2,b3,b4,b5,b6,b7) (block_join(BLOCK_6(b1,b2,b3,b4,b5,b6),(b7)))
94
+ #define BLOCK_8(b1,b2,b3,b4,b5,b6,b7,b8) (block_join(BLOCK_7(b1,b2,b3,b4,b5,b6,b7),(b8)))
95
+
96
+ #define BLOCK_IDX(_1,_2,_3,_4,_5,_6,_7,_8,NAME,...) NAME
97
+ #define BLOCK(...) \
98
+ BLOCK_IDX(__VA_ARGS__, BLOCK_8, BLOCK_7, BLOCK_6, BLOCK_5, BLOCK_4, BLOCK_3, BLOCK_2, BLOCK_1)(__VA_ARGS__)
99
+
100
+
101
+ #endif
@@ -0,0 +1,4 @@
1
+ dnl AC_FIND_FUNC(func, arguments)
2
+ AC_DEFUN([AC_CHECK_MATH_FUNC], [
3
+ AC_FIND_FUNC_NO_LIBS([$1], [m], [#include <math.h>], [$2])
4
+ ])
@@ -0,0 +1,8 @@
1
+ dnl Shamelessly stolen from Heimdal
2
+ dnl
3
+ dnl Look for function in any of the specified libraries
4
+ dnl
5
+
6
+ dnl AC_FIND_FUNC_NO_LIBS(func, libraries, includes, arguments, extra libs, extra args)
7
+ AC_DEFUN([AC_FIND_FUNC_NO_LIBS], [
8
+ AC_FIND_FUNC_NO_LIBS2([$1], ["" $2], [$3], [$4], [$5], [$6])])
@@ -0,0 +1,62 @@
1
+ dnl Shamelessly stolen from Heimdal
2
+ dnl
3
+ dnl Look for function in any of the specified libraries
4
+ dnl
5
+
6
+ dnl AC_FIND_FUNC_NO_LIBS2(func, libraries, includes, arguments, extra libs, extra args)
7
+ AC_DEFUN([AC_FIND_FUNC_NO_LIBS2], [
8
+
9
+ AC_MSG_CHECKING([for $1])
10
+ AC_CACHE_VAL(ac_cv_funclib_$1,
11
+ [
12
+ if eval "test \"\$ac_cv_func_$1\" != yes" ; then
13
+ ac_save_LIBS="$LIBS"
14
+ for ac_lib in $2; do
15
+ case "$ac_lib" in
16
+ "") ;;
17
+ yes) ac_lib="" ;;
18
+ no) continue ;;
19
+ -l*) ;;
20
+ *) ac_lib="-l$ac_lib" ;;
21
+ esac
22
+ LIBS="$6 $ac_lib $5 $ac_save_LIBS"
23
+ AC_LINK_IFELSE([AC_LANG_PROGRAM([[$3]],[[$1($4)]])],[eval "if test -n \"$ac_lib\";then ac_cv_funclib_$1=$ac_lib; else ac_cv_funclib_$1=yes; fi";break])
24
+ done
25
+ eval "ac_cv_funclib_$1=\${ac_cv_funclib_$1-no}"
26
+ LIBS="$ac_save_LIBS"
27
+ fi
28
+ ])
29
+
30
+ eval "ac_res=\$ac_cv_funclib_$1"
31
+
32
+ if false; then
33
+ AC_CHECK_FUNCS($1)
34
+ dnl AC_CHECK_LIBS($2, foo)
35
+ fi
36
+ # $1
37
+ eval "ac_tr_func=HAVE_[]upcase($1)"
38
+ eval "ac_tr_lib=HAVE_LIB[]upcase($ac_res | sed -e 's/-l//')"
39
+ eval "LIB_$1=$ac_res"
40
+
41
+ case "$ac_res" in
42
+ yes)
43
+ eval "ac_cv_func_$1=yes"
44
+ eval "LIB_$1="
45
+ AC_DEFINE_UNQUOTED($ac_tr_func)
46
+ AC_MSG_RESULT([yes])
47
+ ;;
48
+ no)
49
+ eval "ac_cv_func_$1=no"
50
+ eval "LIB_$1="
51
+ AC_MSG_RESULT([no])
52
+ ;;
53
+ *)
54
+ eval "ac_cv_func_$1=yes"
55
+ eval "ac_cv_lib_`echo "$ac_res" | sed 's/-l//'`=yes"
56
+ AC_DEFINE_UNQUOTED($ac_tr_func)
57
+ AC_DEFINE_UNQUOTED($ac_tr_lib)
58
+ AC_MSG_RESULT([yes, in $ac_res])
59
+ ;;
60
+ esac
61
+ AC_SUBST(LIB_$1)
62
+ ])
@@ -0,0 +1,9 @@
1
+ dnl Shamelessly stolen from Heimdal
2
+ dnl
3
+ dnl AC_FIND_FUNC(func, libraries, includes, arguments)
4
+ AC_DEFUN([AC_FIND_FUNC], [
5
+ AC_FIND_FUNC_NO_LIBS([$1], [$2], [$3], [$4])
6
+ if test -n "$LIB_$1"; then
7
+ LIBS="$LIB_$1 $LIBS"
8
+ fi
9
+ ])
@@ -0,0 +1,3 @@
1
+
2
+ dnl Shamelessly stolen from Heimdal
3
+ AC_DEFUN([upcase],[`echo $1 | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ`])dnl
@@ -0,0 +1,221 @@
1
+ m4_define([jq_version], m4_esyscmd_s([git describe --tags --dirty --match 'jq-*'|sed 's/^jq-//']))
2
+
3
+ AC_INIT([jq], [jq_version], [https://github.com/stedolan/jq/issues],
4
+ [jq], [https://stedolan.github.io/jq])
5
+
6
+ m4_include([m4/ax_compare_version.m4])
7
+ m4_include([m4/ax_prog_bison_version.m4])
8
+
9
+ dnl Created autoconf implementation thompson@dtosolutions, 26NOV12
10
+ AC_PREREQ([2.64])
11
+ AC_CONFIG_AUX_DIR([config])
12
+ AM_INIT_AUTOMAKE([1.11.2 parallel-tests foreign -Wall])
13
+ AM_SILENT_RULES([yes])
14
+ AM_PROG_AR
15
+ AM_MAINTAINER_MODE([enable])
16
+ AC_PROG_CC
17
+ AC_PROG_CC_STDC
18
+ AC_PROG_CPP_WERROR
19
+ AC_PROG_YACC
20
+ AC_OBJEXT
21
+ AC_EXEEXT
22
+ LT_INIT([shared static win32-dll])
23
+ AM_PROG_CC_C_O
24
+
25
+
26
+ dnl couldn't use AM_PROG_LEX as it doesn't support header files like the
27
+ dnl AC_PROG_YACC macros...
28
+
29
+ dnl check bison version
30
+
31
+ if test "$USE_MAINTAINER_MODE" = yes; then
32
+ if test "$YACC" != "bison -y"; then
33
+ AC_MSG_CHECKING([bison version])
34
+ AC_MSG_RESULT([not bison])
35
+ else
36
+ AX_PROG_BISON_VERSION([3],
37
+ [],
38
+ [AC_MSG_ERROR([You need bison version 3.0 or greater, or use --disable-maintainer-mode.])])
39
+ fi
40
+
41
+ AC_PROG_LEX
42
+ if test "x$LEX" != xflex; then
43
+ LEX="$SHELL $missing_dir/missing flex"
44
+ fi
45
+ fi
46
+
47
+
48
+ ##########################################################################
49
+ # check for ONIGURUMA library
50
+ ##########################################################################
51
+
52
+ AC_ARG_WITH([oniguruma],
53
+ [AS_HELP_STRING([--with-oniguruma=prefix],
54
+ [try this for a non-standard install prefix of the oniguruma library])],
55
+ [ONIGURUMAPATHSET=1],
56
+ [ONIGURUMAPATHSET=0])
57
+
58
+ if test $ONIGURUMAPATHSET = 1; then
59
+ CFLAGS="$CFLAGS -I${with_oniguruma}/include"
60
+ LDFLAGS="$LDFLAGS -L${with_oniguruma}/lib"
61
+ fi
62
+
63
+ # check for ONIGURUMA library
64
+ HAVE_ONIGURUMA=0
65
+ AC_CHECK_HEADER("oniguruma.h",
66
+ AC_CHECK_LIB([onig],[onig_version],[LIBS="$LIBS -lonig"; HAVE_ONIGURUMA=1;]))
67
+
68
+ # handle check results
69
+ if test $HAVE_ONIGURUMA != 1; then
70
+ AC_MSG_NOTICE([Oniguruma was not found.])
71
+ AC_MSG_NOTICE([ Try setting the location using '--with-oniguruma=PREFIX' ])
72
+ else
73
+ AC_DEFINE([HAVE_ONIGURUMA],1,[Define to 1 if Oniguruma is installed])
74
+ fi
75
+
76
+
77
+ dnl Check for valgrind
78
+ AC_CHECK_PROGS(valgrind_cmd, valgrind)
79
+ if test "x$valgrind_cmd" = "x" ; then
80
+ AC_MSG_WARN([valgrind is required to test jq.])
81
+ fi
82
+ AC_CHECK_FUNCS(memmem)
83
+ AC_CHECK_FUNCS(mkstemp)
84
+
85
+
86
+ dnl Running tests with Valgrind is slow. It is faster to iterate on
87
+ dnl code without Valgrind until tests pass, then enable Valgrind and
88
+ dnl fix leaks.
89
+ AC_ARG_ENABLE([valgrind],
90
+ AC_HELP_STRING([--disable-valgrind], [do not run tests under Valgrind]))
91
+
92
+ dnl Code coverage
93
+ AC_ARG_ENABLE([gcov],
94
+ AC_HELP_STRING([--enable-gcov], [enable gcov code coverage tool]))
95
+
96
+ dnl Don't attempt to build docs if there's no Ruby lying around
97
+ AC_ARG_ENABLE([docs],
98
+ AC_HELP_STRING([--disable-docs], [don't build docs]))
99
+
100
+ dnl Don't attempt to build the error injection object (if there is no LD_PRELOAD support)
101
+ AC_ARG_ENABLE([error-injection],
102
+ AC_HELP_STRING([--enable-error-injection], [build and test with error injection]))
103
+
104
+ dnl Enable building all static
105
+ AC_ARG_ENABLE([all-static],
106
+ AC_HELP_STRING([--enable-all-static], [link jq with static libraries only]))
107
+
108
+ AS_IF([test "x$enable_docs" != "xno"],[
109
+ AC_CHECK_PROGS(bundle_cmd, bundle)
110
+
111
+ AC_CACHE_CHECK([for Ruby dependencies], [jq_cv_ruby_deps],
112
+ [jq_cv_ruby_deps=yes;
113
+ AS_IF([test "x$bundle_cmd" = "x" || \
114
+ ! bmsg="`cd ${srcdir}/docs; "$bundle_cmd" check 2>/dev/null`"],[
115
+ AC_MSG_WARN([$bmsg])
116
+ cat <<EOF
117
+ *****************************************************************
118
+ * Ruby dependencies for building jq documentation not found. *
119
+ * You can still build, install and hack on jq, but the manpage *
120
+ * will not be rebuilt and some of the tests won't run. *
121
+ * See docs/README.md for how to install the docs dependencies. *
122
+ *****************************************************************
123
+ EOF
124
+ jq_cv_ruby_deps=no
125
+ ])])
126
+
127
+ if test "x$jq_cv_ruby_deps" != "xyes"; then
128
+ enable_docs=no
129
+ fi
130
+ ])
131
+
132
+ AM_CONDITIONAL([ENABLE_VALGRIND], [test "x$enable_valgrind" != xno])
133
+ AM_CONDITIONAL([ENABLE_GCOV], [test "x$enable_gcov" = xyes])
134
+ AM_CONDITIONAL([ENABLE_DOCS], [test "x$enable_docs" != xno])
135
+ AM_CONDITIONAL([ENABLE_ERROR_INJECTION], [test "x$enable_error_injection" = xyes])
136
+ AM_CONDITIONAL([ENABLE_ALL_STATIC], [test "x$enable_all_static" = xyes])
137
+
138
+ AC_FUNC_ALLOCA
139
+
140
+ AC_FIND_FUNC([isatty], [c], [#include <unistd.h>], [0])
141
+ AC_FIND_FUNC([_isatty], [c], [#include <io.h>], [0])
142
+ AC_FIND_FUNC([strptime], [c], [#include <time.h>], [0, 0, 0])
143
+ AC_FIND_FUNC([strftime], [c], [#include <time.h>], [0, 0, 0, 0])
144
+ AC_FIND_FUNC([timegm], [c], [#include <time.h>], [0])
145
+ AC_FIND_FUNC([gmtime_r], [c], [#include <time.h>], [0, 0])
146
+ AC_FIND_FUNC([gmtime], [c], [#include <time.h>], [0])
147
+ AC_FIND_FUNC([gettimeofday], [c], [#include <time.h>], [0, 0])
148
+ AC_CHECK_MEMBER([struct tm.tm_gmtoff], [AC_DEFINE([HAVE_TM_TM_GMT_OFF],1,[Define to 1 if the system has the tm_gmt_off field in struct tm])],
149
+ [], [[#include <time.h>]])
150
+ AC_CHECK_MEMBER([struct tm.__tm_gmtoff], [AC_DEFINE([HAVE_TM___TM_GMT_OFF],1,[Define to 1 if the system has the __tm_gmt_off field in struct tm])],
151
+ [], [[#include <time.h>]])
152
+
153
+ AC_ARG_ENABLE([pthread-tls],
154
+ [AC_HELP_STRING([--enable-pthread-tls],
155
+ [Enable use of pthread thread local storage])],
156
+ [],
157
+ [enable_pthread_tls=no])
158
+
159
+ if test $enable_pthread_tls = yes; then
160
+ AC_FIND_FUNC([pthread_key_create], [pthread], [#include <pthread.h>], [NULL, NULL])
161
+ AC_FIND_FUNC([pthread_once], [pthread], [#include <pthread.h>], [NULL, NULL])
162
+ AC_FIND_FUNC([atexit], [pthread], [#include <stdlib.h>], [NULL])
163
+ fi
164
+
165
+ dnl libm math.h functions
166
+ AC_CHECK_MATH_FUNC(acos, [.5])
167
+ AC_CHECK_MATH_FUNC(acosh, [.5])
168
+ AC_CHECK_MATH_FUNC(asin, [.5])
169
+ AC_CHECK_MATH_FUNC(asinh, [.5])
170
+ AC_CHECK_MATH_FUNC(atan, [.5])
171
+ AC_CHECK_MATH_FUNC(atanh, [.5])
172
+ AC_CHECK_MATH_FUNC(cbrt, [.5])
173
+ AC_CHECK_MATH_FUNC(cos, [.5])
174
+ AC_CHECK_MATH_FUNC(cosh, [.5])
175
+ AC_CHECK_MATH_FUNC(exp2, [.5])
176
+ AC_CHECK_MATH_FUNC(exp, [.5])
177
+ AC_CHECK_MATH_FUNC(floor, [.5])
178
+ AC_CHECK_MATH_FUNC(j0, [.5])
179
+ AC_CHECK_MATH_FUNC(j1, [.5])
180
+ AC_CHECK_MATH_FUNC(log10, [.5])
181
+ AC_CHECK_MATH_FUNC(log2, [.5])
182
+ AC_CHECK_MATH_FUNC(log, [.5])
183
+ AC_CHECK_MATH_FUNC(sin, [.5])
184
+ AC_CHECK_MATH_FUNC(sinh, [.5])
185
+ AC_CHECK_MATH_FUNC(sqrt, [.5])
186
+ AC_CHECK_MATH_FUNC(tan, [.5])
187
+ AC_CHECK_MATH_FUNC(tanh, [.5])
188
+ AC_CHECK_MATH_FUNC(tgamma, [.5])
189
+ AC_CHECK_MATH_FUNC(y0, [.5])
190
+ AC_CHECK_MATH_FUNC(y1, [.5])
191
+ AC_CHECK_MATH_FUNC(pow, [2,2])
192
+ AC_CHECK_MATH_FUNC(atan2, [.5,.5])
193
+ AC_CHECK_MATH_FUNC(hypot, [.5,.5])
194
+ AC_CHECK_MATH_FUNC(remainder, [3,2])
195
+
196
+ dnl Thread local storage
197
+ have___thread=no
198
+ AC_MSG_CHECKING(for thread-local storage)
199
+ AC_LINK_IFELSE([AC_LANG_SOURCE([
200
+ static __thread int x ;
201
+ int main () { x = 123; return x; }
202
+ ])], have___thread=yes)
203
+ if test $have___thread = yes; then
204
+ AC_DEFINE([HAVE___THREAD],1,[Define to 1 if the system supports __thread])
205
+ fi
206
+ AC_MSG_RESULT($have___thread)
207
+
208
+ AC_C_BIGENDIAN(
209
+ AC_DEFINE([IEEE_MC68k], 1, [machine is bigendian]),
210
+ AC_DEFINE([IEEE_8087], 1, [machine is littleendian]),
211
+ AC_MSG_ERROR(unknown endianess),
212
+ AC_MSG_ERROR(universial endianess not supported)
213
+ )
214
+
215
+ AC_SUBST([BUNDLER], ["$bundle_cmd"])
216
+
217
+ AC_CONFIG_MACRO_DIR([config/m4])
218
+ AC_CONFIG_FILES([Makefile])
219
+ AC_OUTPUT
220
+
221
+
@@ -0,0 +1,7 @@
1
+ source "https://rubygems.org"
2
+
3
+ gem "rake"
4
+ gem "bonsai"
5
+ gem "maruku"
6
+ gem "ronn"
7
+ gem "mustache", "<1.0" # to support ruby <2.0
@@ -0,0 +1,63 @@
1
+ GEM
2
+ remote: https://rubygems.org/
3
+ specs:
4
+ activesupport (4.2.3)
5
+ i18n (~> 0.7)
6
+ json (~> 1.7, >= 1.7.7)
7
+ minitest (~> 5.1)
8
+ thread_safe (~> 0.3, >= 0.3.4)
9
+ tzinfo (~> 1.1)
10
+ addressable (2.3.8)
11
+ bonsai (1.4.9)
12
+ activesupport (>= 3.0.3)
13
+ builder (>= 3.0.0)
14
+ i18n (>= 0.5.0)
15
+ launchy (>= 0.3.7)
16
+ liquid (>= 2.2.2)
17
+ maruku (>= 0.6.0)
18
+ rack
19
+ sass
20
+ sinatra (>= 1.0)
21
+ tilt (>= 1.3)
22
+ watch (>= 0.1.0)
23
+ yui-compressor
24
+ builder (3.2.2)
25
+ hpricot (0.8.6)
26
+ i18n (0.7.0)
27
+ json (1.8.3)
28
+ launchy (2.4.3)
29
+ addressable (~> 2.3)
30
+ liquid (3.0.6)
31
+ maruku (0.7.2)
32
+ minitest (5.8.0)
33
+ mustache (0.99.8)
34
+ rack (1.6.4)
35
+ rack-protection (1.5.3)
36
+ rack
37
+ rake (10.4.2)
38
+ rdiscount (2.1.8)
39
+ ronn (0.7.3)
40
+ hpricot (>= 0.8.2)
41
+ mustache (>= 0.7.0)
42
+ rdiscount (>= 1.5.8)
43
+ sass (3.4.16)
44
+ sinatra (1.4.6)
45
+ rack (~> 1.4)
46
+ rack-protection (~> 1.4)
47
+ tilt (>= 1.3, < 3)
48
+ thread_safe (0.3.5)
49
+ tilt (2.0.1)
50
+ tzinfo (1.2.2)
51
+ thread_safe (~> 0.1)
52
+ watch (0.1.0)
53
+ yui-compressor (0.12.0)
54
+
55
+ PLATFORMS
56
+ ruby
57
+
58
+ DEPENDENCIES
59
+ bonsai
60
+ maruku
61
+ mustache (< 1.0)
62
+ rake
63
+ ronn
@@ -0,0 +1,25 @@
1
+ Documentation
2
+ =============
3
+
4
+ The jq website, manpages and some of the tests are generated from this
5
+ directory. The directory holds a [Bonsai](http://tinytree.info)
6
+ website, and the manual is a YAML file in `content/3.manual`.
7
+
8
+ To build the documentation (including building the jq manpage), you'll
9
+ need a working Ruby setup. The easiest way to get one is to install
10
+ RVM and Ruby 1.9.3 like so:
11
+
12
+ \curl -L https://get.rvm.io | bash -s stable --ruby=1.9.3
13
+
14
+ After that finishes installing, you'll need to make sure RVM is on
15
+ your path by doing `source $HOME/.rvm/scripts/rvm`, or just opening a
16
+ new shell. See <https://rvm.io> for more info on RVM.
17
+
18
+ Once RVM is installed, you can install all the dependencies for jq's
19
+ documentation build by running this from the `docs` directory:
20
+
21
+ bundle install
22
+
23
+ When bundle manages to install the dependencies, rerun `./configure`
24
+ in the jq root directory and then the Makefile will be able to
25
+ generate the jq manpage.
@@ -0,0 +1,145 @@
1
+ require 'yaml'
2
+ require 'bonsai'
3
+ require 'liquid'
4
+ require 'maruku'
5
+ require 'json'
6
+ require 'ronn'
7
+ require 'tempfile'
8
+ require 'yaml'
9
+
10
+ module ExtraFilters
11
+ def markdownify(input)
12
+ Maruku.new(input).to_html
13
+ end
14
+
15
+ def sanitize(input)
16
+ input.gsub(/[^a-zA-Z0-9_]/,"")
17
+ end
18
+
19
+ def json(input)
20
+ input.to_json
21
+ end
22
+
23
+ def unique(input)
24
+ @n = (@n || 0) + 1
25
+ input + @n.to_s
26
+ end
27
+ end
28
+
29
+ Liquid::Template.register_filter(ExtraFilters)
30
+
31
+
32
+ task :serve do
33
+ begin
34
+ Bonsai.log "Press Control+C to quit"
35
+
36
+ require 'rack'
37
+ require 'sinatra'
38
+ require 'watch'
39
+ require 'launchy'
40
+
41
+ Bonsai.root_dir = Dir.pwd
42
+
43
+ server = fork {
44
+ app = Rack::Builder.app {
45
+ map "/jq" do
46
+ use Bonsai::StaticPassThrough, :root => Bonsai.root_dir + "/output", :urls => ["/"]
47
+ end
48
+ run Bonsai::DevelopmentServer
49
+ }
50
+ Rack::Handler.default.run(app, :Port => 5000) do
51
+ Launchy.open("http://localhost:5000/jq/")
52
+ end
53
+ }
54
+ Watch.new("{content,templates,public}/**/*") { Bonsai::Exporter.process! }
55
+ rescue Interrupt
56
+ Process.kill("QUIT", server)
57
+ Process.wait(server)
58
+ exit
59
+ end
60
+ end
61
+
62
+ task :build do
63
+ Bonsai.root_dir = Dir.pwd
64
+ Bonsai::Exporter.publish!
65
+ end
66
+
67
+ $BINARIES = {
68
+ :osx32 => "--host=i686-apple-darwin10 CFLAGS='-m32 -g -O'",
69
+ :osx64 => "--host=i686-apple-darwin10 CFLAGS='-m64 -g -O'",
70
+ :win32 => "--host=i686-w64-mingw32 CFLAGS='-g -O'",
71
+ :win64 => "--host=x86_64-w64-mingw32 CFLAGS='-g -O'",
72
+ :linux32 => "--host=x86_64-linux-gnu CFLAGS='-m32 -g -O'",
73
+ :linux64 => "--host=x86_64-linux-gnu CFLAGS='-m64 -g -O'"
74
+ }
75
+
76
+ $BINARIES.each do |name, args|
77
+ file "../build/#{name}" do |t|
78
+ sh "../scripts/crosscompile -j4 #{name} #{args}"
79
+ end
80
+ task :binaries => ["../build/#{name}"]
81
+ end
82
+
83
+ task :binaries => ["output/download"] do
84
+ $BINARIES.each do |name, args|
85
+ FileUtils.cp_r "../build/#{name}", "output/download/"
86
+ end
87
+ end
88
+
89
+ def load_manual
90
+ YAML::load(File.open("content/3.manual/manual.yml"))
91
+ end
92
+
93
+ task :manpage do
94
+ Tempfile.open "manpage" do |f|
95
+ manual = load_manual
96
+ f.puts manual['manpage_intro']
97
+ f.puts manual['body']
98
+ manual['sections'].each do |section|
99
+
100
+ f.puts "## #{section['title'].upcase}\n"
101
+ f.puts section['body']
102
+ f.puts ""
103
+ (section['entries'] || []).each do |entry|
104
+ f.puts "### #{entry['title']}\n"
105
+ f.puts entry['body']
106
+ f.puts ""
107
+ (entry['examples'] || []).each do |example|
108
+ f.puts " jq '#{example['program']}'"
109
+ f.puts " #{example['input']}"
110
+ f.puts " => #{example['output'].join(", ")}"
111
+ f.puts
112
+ end
113
+ end
114
+ f.puts ""
115
+ end
116
+ f.puts manual['manpage_epilogue']
117
+ f.close
118
+ puts Ronn::Document.new(f.path).convert('roff').gsub(/<\/?code>/,"")
119
+ end
120
+ end
121
+
122
+ task :manpage_default => ["default_manpage.md"] do
123
+ puts Ronn::Document.new("default_manpage.md").convert('roff').gsub(/<\/?code>/,"")
124
+ end
125
+
126
+ task :mantests do
127
+ load_manual['sections'].each do |section|
128
+ (section['entries'] || []).each do |entry|
129
+ (entry['examples'] || []).each do |example|
130
+ puts example['program'].gsub("\n", " ")
131
+ puts example['input']
132
+ example['output'].each do |s| puts s end
133
+ puts
134
+ end
135
+ end
136
+ end
137
+ end
138
+
139
+ directory "output/download/source"
140
+ task :tarball => ["output/download/source"] do
141
+ sh "cd ..; ./configure && make dist && make distclean"
142
+ sh "cp ../jq-*.tar.gz output/download/source"
143
+ end
144
+
145
+ task :dist => [:build, :binaries, :tarball]