Commit graph

111 commits

Author SHA1 Message Date
Jason Kankiewicz
bc28faee71 Replace NULL with std::ptr::null() within the
safety notes for @alexjg in #414.
2022-08-07 20:04:49 -07:00
Jason Kankiewicz
50981acc5a Replace to_del!() and to_pos!() with
`to_index!()` for @alexjg in #414.
2022-08-07 19:37:48 -07:00
Jason Kankiewicz
7ec17b26a9 Replace `From<&AMvalue<'_>> for Result<
am::ScalarValue, am::AutomergeError>` with `TryFrom<&AMvalue<'_>> for
am::ScalarValue` for @alexjg in #414.
2022-08-07 19:24:47 -07:00
Jason Kankiewicz
825342cbb1 Remove reflexive struct reference from a Doxygen
variable declaration.
2022-08-07 08:07:00 -07:00
Jason Kankiewicz
04d0175113 Add missing past-the-end checks to the unit tests
for `AMmapRange()`.
2022-08-06 16:20:35 -07:00
Jason Kankiewicz
14bd8fbe97 Port the WASM API's basic unit tests to C.
Weave the original TypeScript code into the C ports of the WASM API's
sync tests.
Fix misnomers in the WASM API's basic and sync unit tests.
Fix misspellings in the WASM API's basic and sync unit tests.
2022-08-06 16:18:59 -07:00
Jason Kankiewicz
d48e366272 Fix some documentation content bugs.
Fix some documentation formatting bugs.
2022-08-06 15:56:21 -07:00
Jason Kankiewicz
4217019cbc Expose automerge::AutoCommit::get_all() as AMlistGetAll() and AMmapGetAll().
Add symbolic last index specification to `AMlist{Delete,Get,Increment}()`.
Add symbolic last index specification to `AMlistPut{Bool,Bytes,Counter,
F64,Int,Null,Object,Str,Timestamp,Uint}()`.
Prevent `doc::utils::to_str(NULL)` from segfaulting.
Fix some documentation content bugs.
Fix some documentation formatting bugs.
2022-08-06 15:47:53 -07:00
Jason Kankiewicz
eeb75f74f4 Fix AMstrsCmp().
Fix some documentation content bugs.
Fix some documentation formatting bugs.
2022-08-06 15:07:48 -07:00
Jason Kankiewicz
a22afdd70d Expose automerge::AutoCommit::get_change_by_hash()
as `AMgetChangeByHash()`.
Add the `AM_CHANGE_HASH_SIZE` macro define constant for
`AMgetChangeByHash()`.
Replace the literal `32` with the `automerge::types::HASH_SIZE` constant.
Expose `automerge::AutoCommit::splice()` as `AMsplice()`.
Add the `automerge::error::AutomergeError::InvalidValueType` variant for
`AMsplice()`.
Add push functionality to `AMspliceText()`.
Fix some documentation content bugs.
Fix some documentation formatting bugs.
2022-08-06 15:04:46 -07:00
Orion Henry
5c6f375f99
Merge pull request #410 from jkankiewicz/add_range_functions_to_C_API
Add range functions to C API
2022-08-03 10:47:44 -05:00
Jason Kankiewicz
3a556c5991 Expose Autocommit::fork_at().
Rename `AMdup()` to `AMclone()` to match the WASM API.
Rename `AMgetActor()` to `AMgetActorId()` to match the WASM API.
Rename `AMsetActor()` to `AMsetActorId()` to match the WASM API.
2022-08-01 07:02:30 -07:00
Jason Kankiewicz
69de8187a5 Update the build system with the added and
renamed source files.
Defer `BTreeMap` creation until necessary for  `AMresult::Changes`.
Add `AMvalueEqual()` to enable direct comparison of two `AMvalue` structs regardless of their respective variants.
2022-07-25 01:41:52 -07:00
Jason Kankiewicz
877744d40b Add equality comparison to the AM* types from
which it was missing.
Add equality comparison to `automerge::sync::message`.
Defer `std::ffi::CString` creation until necessary.
2022-07-25 01:33:50 -07:00
Jason Kankiewicz
14b55c4a73 Fix a bug with the iterators when they pass their
initial positions in reverse.
Rename `AMstrings` to `AMstrs` for consistency with the `AMvalue.str`
field.
2022-07-25 01:23:26 -07:00
Jason Kankiewicz
23fbb4917a Replace _INCLUDED with _H as the suffix for
include guards in C headers like the one generated by cbindgen.
2022-07-25 01:04:35 -07:00
Jason Kankiewicz
877dbbfce8 Simplify the unit tests with AMresultStack et.
al.
2022-07-25 01:00:50 -07:00
Jason Kankiewicz
a22bcb916b Promoted ResultStack/StackNode from the
quickstart example up to the library as `AMresultStack` so that it can
appear in the README.md and be used to simplify the unit tests.
Promoted `free_results()` to `AMfreeStack()` and `push()` to `AMpush()`.
Added `AMpop()` because no stack should be without one.
2022-07-25 00:50:40 -07:00
Jason Kankiewicz
42ab1639db Add heads argument to AMmapGet() to expose
`automerge::AutoCommit::get_at()`.
Add `AMmapRange()` to expose `automerge::AutoCommit::map_range()` and
`automerge::AutoCommit::map_range_at()`.
Add `AMmapItems` for `AMlistRange()`.
Add `AMmapItem` for `AMmapItems`.
2022-07-25 00:11:00 -07:00
Jason Kankiewicz
eba18d1ad6 Add heads argument to AMlistGet() to expose
`automerge::AutoCommit::get_at()`.
Add `AMlistRange()` to expose `automerge::AutoCommit::list_range()` and
`automerge::AutoCommit::list_range_at()`.
Add `AMlistItems` for `AMlistRange()`.
Add `AMlistItem` for `AMlistItems`.
2022-07-24 22:41:32 -07:00
Jason Kankiewicz
ee68645f31 Add AMfork() to expose `automerge::AutoCommit::
fork()`.
Add `AMobjValues()` to expose `automerge::AutoCommit::values()` and
`automerge::AutoCommit::values_at()`.
Add `AMobjIdActorId()`, `AMobjIdCounter()`, and `AMobjIdIndex()` to expose `automerge::ObjId::Id` fields.
Change `AMactorId` to reference an `automerge::ActorId` instead of
owning one for `AMobjIdActorId()`.
Add `AMactorIdCmp()` for `AMobjIdActorId()` comparison.
Add `AMobjItems` for `AMobjValues()`.
Add `AMobjItem` for `AMobjItems`.
Add `AMobjIdEqual()` for property comparison.
Rename `to_doc!()` to `to_doc_mut!()` and `to_doc_const!()` to `to_doc!()`
for consistency with the Rust standard library.
2022-07-24 22:23:54 -07:00
Jason Kankiewicz
cc19a37f01 Remove the makefile for the original C
API to prevent confusion.
2022-07-23 08:48:19 -07:00
Jason Kankiewicz
15c9adf965 Remove the obsolete test suite for the original
C API to prevent confusion.
2022-07-23 08:47:21 -07:00
Jason Kankiewicz
52a558ee4d Cease writing a pristine copy of the generated
header file into the root of the C API's source directory to prevent
confusion.
2022-07-23 08:44:41 -07:00
Jason Kankiewicz
e5a8b67b11 Added AMspliceText().
Added `AMtext()`.
Replaced `*mut` function arguments with `*const`
function arguments where possible.
Added "out" directions to the documentation for
out function parameters.
2022-06-20 23:15:25 -07:00
Jason Kankiewicz
aeb8db556c Added "out" directions to the documentation for
out function parameters.
2022-06-20 23:11:03 -07:00
Jason Kankiewicz
eb462cb228 Made free_results() reset the stack pointer. 2022-06-20 15:55:31 -07:00
Jason Kankiewicz
0cbacaebb6 Simplified the AMstrings struct to directly
reference `std::ffi::CString` values.
Switched the `AMresult` struct to store a `Vec<CString>` instead of a
`Vec<String>`.
2022-06-20 14:35:30 -07:00
Jason Kankiewicz
bf4988dcca Fixed AM{change_hashes,changes,haves,strings}Prev(). 2022-06-20 13:50:05 -07:00
Jason Kankiewicz
770c064978 Made cosmetic changes to the quickstart example. 2022-06-20 13:45:32 -07:00
Jason Kankiewicz
db0333fc5a Added AM_ROOT usage to the documentation.
Renamed the `value` argument of `AM{list,map}PutBytes()` to `src` for
consistency with standard `memcpy()`.
2022-06-20 02:16:33 -07:00
Jason Kankiewicz
7bdf726ce1 Sublimated memory management in the quickstart
example.
2022-06-20 02:07:33 -07:00
Jason Kankiewicz
47c5277406 Added AMkeys().
Removed `AMobjSizeAt()`.
Added an optional `AMchangeHashes` argument to `AMobjSize()`.
Replaced the term "length" with "size" in the
documentation.
2022-06-20 01:53:31 -07:00
Jason Kankiewicz
ea8bd32cc1 Added the AMstrings type. 2022-06-20 01:38:32 -07:00
Jason Kankiewicz
be130560f0 Added a check for a 0 increment in the iterator
types.
Improved the documentation for the `detail` field in the iterator types.
2022-06-20 01:34:36 -07:00
Jason Kankiewicz
103d729bd1 Replaced the term "length" with "size" in the
documentation.
2022-06-20 01:31:08 -07:00
Jason Kankiewicz
7b30c84a4c Added AMchangeHashesInit(). 2022-06-20 01:17:20 -07:00
Jason Kankiewicz
39db64e5d9 Publicized the AMbyteSpan fields. 2022-06-20 01:11:30 -07:00
Orion Henry
1610f6d6a6
Merge pull request #391 from jkankiewicz/expose_ActorId_to_C_API
Add `AMactorId` to the C API
2022-06-16 21:57:56 +02:00
Orion Henry
40b32566f4
Merge pull request #390 from jkankiewicz/make_C_API_testing_explicit
Make C API testing explicit
2022-06-16 21:56:26 +02:00
Jason Kankiewicz
400b8acdff Switched the AMactorId unit test suite to group
setup/teardown.
Removed superfluous group state from the `AMactorIdInit()` test.
2022-06-14 23:16:45 -07:00
Jason Kankiewicz
2f37d194ba Asserted that the string forms of two random
`AMactorId` structs are unequal.
2022-06-14 23:04:18 -07:00
Orion Henry
ceecef3b87 update list of read methods in c readme 2022-06-14 21:28:10 -04:00
Jason Kankiewicz
6de9ff620d Moved hex_to_bytes() so that it could be shared
by the unit test suites for `AMactorId` and `AMdoc` functions.
2022-06-14 00:52:06 -07:00
Jason Kankiewicz
84fa83a3f0 Added AMactorId.
Updated `AMchangeActorId()`.
Updated `AMsetActor()`.
Removed `AMgetActorHex()`.
Removed `AMsetActorHex()`.
2022-06-14 00:49:20 -07:00
Jason Kankiewicz
efa0a5624a Removed renamed unit test suite source files. 2022-06-11 21:04:36 -07:00
Jason Kankiewicz
6668f79a6e Decouple the "test_automerge" build target from
the "ALL" target.
2022-06-11 20:53:17 -07:00
Jason Kankiewicz
bfa85050b8 Fix Rust code formatting violations. 2022-06-07 00:29:58 -07:00
Jason Kankiewicz
1c78aab5f0 Fixed the AMsyncStateDecode() documentation. 2022-06-07 00:23:41 -07:00
Jason Kankiewicz
ad7dd07cf7 Simplify the names of the unit test suites' source
files.
2022-06-07 00:21:22 -07:00