Commit Graph

21 Commits

Author SHA1 Message Date
Dave Cunningham
c1825dc54d Update to latest CPP version 2022-10-26 16:13:21 +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
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
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
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
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
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
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
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
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
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