8de2fa9bd4
The AMvalue union, AMlistItem struct, AMmapItem struct, and AMobjItem struct are gone, replaced by the AMitem struct. The AMchangeHashes, AMchanges, AMlistItems, AMmapItems, AMobjItems, AMstrs, and AMsyncHaves iterators are gone, replaced by the AMitems iterator. The AMitem struct is opaque, getting and setting values is now achieved exclusively through function calls. The AMitemsNext(), AMitemsPrev(), and AMresultItem() functions return a pointer to an AMitem struct so you ultimately get the same thing whether you're iterating over a sequence or calling AMmapGet() or AMlistGet(). Calling AMitemResult() on an AMitem struct will produce a new AMresult struct referencing its storage so now the AMresult struct for an iterator can be subsequently freed without affecting the AMitem structs that were filtered out of it. The storage for a set of AMitem structs can be recombined into a single AMresult struct by passing pointers to their corresponding AMresult structs to AMresultCat(). For C/C++ programmers, I've added AMstrCmp(), AMstrdup(), AM{idxType,objType,status,valType}ToString() and AM{idxType,objType,status,valType}FromString(). It's also now possible to pass arbitrary parameters through AMstack{Item,Items,Result}() to a callback function.
35 lines
1.2 KiB
CMake
35 lines
1.2 KiB
CMake
# This CMake script is used to force Cargo to regenerate the header file for the
|
|
# core bindings after the out-of-source build directory has been cleaned.
|
|
cmake_minimum_required(VERSION 3.23 FATAL_ERROR)
|
|
|
|
if(NOT DEFINED CONDITION)
|
|
message(FATAL_ERROR "Variable \"CONDITION\" is not defined.")
|
|
elseif(${CMAKE_ARGC} LESS 7)
|
|
message(FATAL_ERROR "Too few arguments.")
|
|
elseif(${CMAKE_ARGC} GREATER 7)
|
|
message(FATAL_ERROR "Too many arguments.")
|
|
elseif(NOT EXISTS ${CMAKE_ARGV6})
|
|
message(FATAL_ERROR "File \"${CMAKE_ARGV6}\" not found.")
|
|
elseif(IS_DIRECTORY "${CMAKE_ARG6}")
|
|
message(FATAL_ERROR "Directory \"${CMAKE_ARG6}\" can't be touched.")
|
|
endif()
|
|
|
|
message(STATUS "Touching \"${CMAKE_ARGV6}\" if ${CONDITION} \"${CMAKE_ARGV5}\"...")
|
|
|
|
if(CONDITION STREQUAL "EXISTS")
|
|
if(EXISTS "${CMAKE_ARGV5}")
|
|
set(DO_IT TRUE)
|
|
endif()
|
|
elseif((CONDITION STREQUAL "NOT_EXISTS") OR (CONDITION STREQUAL "!EXISTS"))
|
|
if(NOT EXISTS "${CMAKE_ARGV5}")
|
|
set(DO_IT TRUE)
|
|
endif()
|
|
else()
|
|
message(FATAL_ERROR "Unexpected condition \"${CONDITION}\".")
|
|
endif()
|
|
|
|
if(DO_IT)
|
|
file(TOUCH_NOCREATE "${CMAKE_ARGV6}")
|
|
|
|
message(STATUS "Touched \"${CMAKE_ARGV6}\".")
|
|
endif()
|