Commit Graph

36 Commits

Author SHA1 Message Date
guoguangwu
04f3751f08
chore: remove refs to deprecated io/ioutil (#716) 2024-06-10 21:27:07 +01:00
Rohit Jangid
aece6e9b90
feat: add more crypto functions (#699)
* feat: add more crypto functions
2023-06-13 17:18:02 +01:00
Dave Cunningham
c1825dc54d Update to latest CPP version 2022-10-26 16:13:21 +01:00
Angus Lees
0a32b8c327 Fix //c-bindings bazel build
Add missing bazel dependency so `bazel build //c-bindings` works again.
2022-10-26 13:03:12 +01:00
mikehoyle
eac7db4471 c-bindings: Add jsonnet_realloc export
This adds the realloc function as an export in c-bindings.go so
that it is included in the generated header and can be used by
dependent libraries.
2022-10-21 17:55:35 +01:00
Jesse
2655afd2bd
memory align structs (#635)
feat: align most structs and add lint rule to enforce struct alignment
2022-10-19 06:19:15 +01:00
Hanyu Cui
63a452246d
Support different output streams than os.Stderr for std.trace (C API) (#520)
Support different output streams than os.Stderr for std.trace (C API)
2021-03-21 20:03:01 +01:00
Kohei Suzuki
35acb29ff8 Add format APIs to C bindings 2020-11-26 19:23:49 +01:00
Kohei Suzuki
57e6137c93 Support creating VMs from multiple threads in C-bindings
Since all VM instances are managed by a global map, read/write of the
global map must be protected by a mutex.
2020-11-23 19:18:40 +01:00
Stanisław Barzowski
4f527c6f96 Add support for missing functions in C-bindings.
With this change we cover 100% of the C API.
2020-11-21 17:34:25 +01:00
Zhongpeng Lin
eced33e88b Using cpp_jsonnet as external repo 2020-10-30 19:45:27 +01:00
Stanisław Barzowski
b70cbd441a Anonymous Import Locations
We used to treat dummy paths like <stdin>, <std>, <extvar> as
real import locations, which causes obvious problem for importers.

After this change we consistently pass "" (an empty string) as location
for non-imported paths.

We exposed new functions to properly handle all paths.

The first function family, EvaluateFile* which allow evaluating
a Jsonnet program at a specified importable path. It should
be used in most cases.

The second function family, EvaluateAnonymousSnippet* allows evaluating
a snippet without an importable path. It should be used for situations
like the code passed as a commandline argument, stdin, etc.

The old function family, EvaluateSnippet* is now deprecated, but
works the same as before, i.e. the passed filenames are treated
as imported paths.

Changes are required to custom importers to make sure they satisfy
the refined contract.

Fixes #329.
2020-09-08 17:27:47 +02:00
Alexander Petrov
6a41464c6d issue-433 Address review comments: avoid indexing the map twice 2020-08-01 10:55:42 +02:00
Alexander Petrov
fc188d008d issue-433 avoid keeping all the allocated handles forever by using map
and uintptr of the allocated object.
2020-08-01 10:55:42 +02:00
Alexander Petrov
db2bf1e024 issue-433 increase the number of constructed Jsonnet handles. 2020-08-01 10:55:42 +02:00
Ricardo Amaro
6f135f75bc Remove bindings debug msg 2020-03-19 16:51:44 +01:00
Dave Cunningham
724650d358
Add native golang formatter (#388)
Add native golang formatter
2020-03-10 22:19:49 +00:00
Stanisław Barzowski
9ada769ce4 Make golangci-lint happy
Some of the suggestions are minor bug fixes (missing error handling).
2020-03-05 14:54:27 +01:00
Stanisław Barzowski
7cad41e894 [Bindings] Fix compatibility issue with C import callback api 2020-03-02 11:57:27 +01:00
Alexander Petrov
441e4cc581 Use backed by go-jsonnet for python extension 2019-12-19 18:09:09 +01:00
Alexander Petrov
acf0e5cfbf Implemented jsonnet_import_callback c-binding (#330)
Implemented jsonnet_import_callback c-binding
2019-10-14 20:49:24 +02:00
Alexander Petrov
56da397819 Code review fixes: Removed unnecessary vm handle checks 2019-10-06 21:20:15 +02:00
Alexander Petrov
4abec72f46 Code review fixes:
* Renamed jsonValue obj field to val
* Renamed jsonValue children field to owned + added an explicit comment about this field
* Got rid of unnecessary vm handle checks
* Renamed arg to param, identifiers to paramNames
* Raised maxID value to 100 000
* Removed freedIDs entry check
2019-10-06 21:20:15 +02:00
Alexander Petrov
ba37440e4f * Added more tests on native callback
* Fixed jsonnet_json_array_append, jsonnet_json_object_append bugs
* jsonValue now stores the list of related struct_JsonnetJsonValue
instead of handles ids
2019-10-06 21:20:15 +02:00
Alexander Petrov
6e9943c99d * Implemented jsonnet_native_callback
* Moved handles workflow to handles.go
* Replaced JsonnetJsonValue c++ implementation with go
* Added jsonnet_json_* integration tests
2019-10-06 21:20:15 +02:00
Stanisław Barzowski
e4e1d9112a Fix Bazel config 2019-09-09 13:31:08 +02:00
Stanisław Barzowski
c77f22c99f Eliminate the unnecessary ast.StdAst
The initially empty ast.StdAst was created to break the circular
dependency. The generation of stdlib AST used to depend on
the primary "jsonnet" package, which meant that "jsonnet"
could not depend on it directly. Hence stdlib needed to be put
in the ast package. Now dumpstdlibast no longer depends on Jsonnet,
so we can get rid of this complication.

All code using ast.StdAst should now use astgen.StdAst.
2019-09-01 21:17:29 +02:00
Stanisław Barzowski
e6c74ca7a6 Address review comments 2019-08-28 20:16:47 +01:00
Stanisław Barzowski
82f949e7fe Extract AST processing to separate packages
Making it independent from the jsonnet package breaks the circular
dependency during stdast generation.
2019-08-28 20:16:47 +01:00
Stanisław Barzowski
197b8c58d0 Prevent autogenerated header in BUILD.bazel
Before this change updating BUILD.bazel file with Gazelle
would add `c-bindings/libgojsonnet.h` to `srcs/`.

It was prevented manually, but someone is going to let it slip
in at some point, so it's better to just not include it there
in the first place.
2019-08-27 11:54:11 +02:00
Steven E. Harris
8cd516f2ad Eliminate Bazel repository for "cpp-jsonnet" (#290)
Treating the "cpp-jsonnet" Git submodule as a separate local Bazel
repository precludes use of the "go-jsonnet" repository from other
workspaces, as Bazel misinterprets the relative path to the local
"cpp-jsonnet" repository. Instead, use the Git submodule content
directly along the package path from the workspace root.
2019-06-24 21:41:01 +01:00
Steve Harris
7614fd519c Correct a few complaints reported by "staticcheck" 2019-06-15 01:34:11 +02:00
Steve Harris
2e6c559964 Don't automatically install the std AST into "ast" 2019-06-15 01:34:11 +02:00
Steve Harris
886fcaca1d Allow building the "c-bindings" program with Bazel 2019-06-15 01:34:11 +02:00
Steve Harris
ad72eb0fbb Allow building the Go program with Bazel 2019-06-15 01:34:11 +02:00
Stanisław Barzowski
eea884b12f Minimal C bindings (#257)
* Minimal C bindings
* Fix version reporting in C bindings
* Apply suggestions about C bindings implementation
* Rename compat/ -> c-bindings/
* Add comment about indexing VMs in C bindings
2019-03-16 17:47:12 -04:00