aboutsummaryrefslogtreecommitdiffstats
path: root/libparc
diff options
context:
space:
mode:
authorLuca Muscariello <lumuscar+fdio@cisco.com>2019-01-24 16:32:25 +0000
committerGerrit Code Review <gerrit@fd.io>2019-01-24 16:32:25 +0000
commit9fc2b9ec49c54ec2d5f0164bbedc1c78732c464c (patch)
treec7ebcf4c83b5c2f71318bc69c6f6915aaac7ae2a /libparc
parentcada1143501a48effc483e3873596c22849926b5 (diff)
parent097e69e6daeefc84fd271babbdc1b47dfe4c01e5 (diff)
Merge "Add support for ubuntu18.04 packages."
Diffstat (limited to 'libparc')
-rw-r--r--libparc/CMakeLists.txt67
-rw-r--r--libparc/README.md5
-rw-r--r--libparc/documentation/Makefile.am1
-rw-r--r--libparc/documentation/libparc.doxygen2
-rw-r--r--libparc/documentation/libparc.doxygen.in2
-rw-r--r--libparc/examples/How To Create A Static PARC Object/parc_MyObject.c4
-rw-r--r--libparc/examples/How To Create an Object Pool/parc_SimpleBufferPool.c2
-rw-r--r--libparc/parc/CMakeLists.txt84
-rwxr-xr-xlibparc/parc/algol/internal_parc_Event.c28
-rw-r--r--libparc/parc/algol/parc_ArrayList.c28
-rwxr-xr-xlibparc/parc/algol/parc_Base64.c4
-rwxr-xr-xlibparc/parc/algol/parc_BitVector.c38
-rwxr-xr-xlibparc/parc/algol/parc_BitVector.h34
-rwxr-xr-xlibparc/parc/algol/parc_Buffer.c45
-rw-r--r--libparc/parc/algol/parc_Buffer.h2
-rwxr-xr-xlibparc/parc/algol/parc_BufferComposer.c8
-rwxr-xr-xlibparc/parc/algol/parc_BufferComposer.h2
-rwxr-xr-xlibparc/parc/algol/parc_BufferDictionary.c20
-rw-r--r--libparc/parc/algol/parc_ByteArray.c12
-rw-r--r--libparc/parc/algol/parc_ByteArray.h4
-rw-r--r--libparc/parc/algol/parc_Deque.c22
-rwxr-xr-xlibparc/parc/algol/parc_Deque.h2
-rwxr-xr-xlibparc/parc/algol/parc_Dictionary.c38
-rwxr-xr-xlibparc/parc/algol/parc_DisplayIndented.c14
-rwxr-xr-xlibparc/parc/algol/parc_Event.c16
-rw-r--r--libparc/parc/algol/parc_EventBuffer.c76
-rwxr-xr-xlibparc/parc/algol/parc_EventQueue.c26
-rwxr-xr-xlibparc/parc/algol/parc_EventScheduler.c20
-rwxr-xr-xlibparc/parc/algol/parc_EventSignal.c14
-rwxr-xr-xlibparc/parc/algol/parc_EventSocket.c6
-rwxr-xr-xlibparc/parc/algol/parc_EventTimer.c14
-rw-r--r--libparc/parc/algol/parc_File.c12
-rwxr-xr-xlibparc/parc/algol/parc_FileInputStream.c4
-rwxr-xr-xlibparc/parc/algol/parc_FileInputStream.h2
-rwxr-xr-xlibparc/parc/algol/parc_FileOutputStream.c4
-rw-r--r--libparc/parc/algol/parc_FileOutputStream.h2
-rwxr-xr-xlibparc/parc/algol/parc_HashCodeTable.c36
-rw-r--r--libparc/parc/algol/parc_HashMap.c12
-rwxr-xr-xlibparc/parc/algol/parc_Iterator.c14
-rw-r--r--libparc/parc/algol/parc_Iterator.h2
-rwxr-xr-xlibparc/parc/algol/parc_JSON.c2
-rwxr-xr-xlibparc/parc/algol/parc_JSONArray.c6
-rwxr-xr-xlibparc/parc/algol/parc_JSONArray.h2
-rwxr-xr-xlibparc/parc/algol/parc_JSONPair.c4
-rwxr-xr-xlibparc/parc/algol/parc_JSONParser.c6
-rwxr-xr-xlibparc/parc/algol/parc_JSONParser.h2
-rwxr-xr-xlibparc/parc/algol/parc_JSONValue.c22
-rwxr-xr-xlibparc/parc/algol/parc_JSONValue.h2
-rwxr-xr-xlibparc/parc/algol/parc_KeyValue.c14
-rwxr-xr-xlibparc/parc/algol/parc_KeyedElement.c6
-rw-r--r--libparc/parc/algol/parc_LinkedList.c22
-rw-r--r--libparc/parc/algol/parc_LinkedList.h4
-rw-r--r--libparc/parc/algol/parc_List.c2
-rw-r--r--libparc/parc/algol/parc_List.h4
-rwxr-xr-xlibparc/parc/algol/parc_Memory.c4
-rw-r--r--libparc/parc/algol/parc_Network.c30
-rw-r--r--libparc/parc/algol/parc_Network.h10
-rw-r--r--libparc/parc/algol/parc_Object.c30
-rw-r--r--libparc/parc/algol/parc_Object.h35
-rwxr-xr-xlibparc/parc/algol/parc_OldSortedList.c18
-rwxr-xr-xlibparc/parc/algol/parc_PathName.c2
-rwxr-xr-xlibparc/parc/algol/parc_PriorityQueue.c28
-rw-r--r--libparc/parc/algol/parc_Properties.c12
-rwxr-xr-xlibparc/parc/algol/parc_RandomAccessFile.c8
-rw-r--r--libparc/parc/algol/parc_SafeMemory.c10
-rw-r--r--libparc/parc/algol/parc_SafeMemory.h2
-rw-r--r--libparc/parc/algol/parc_SortedList.c6
-rwxr-xr-xlibparc/parc/algol/parc_Stack.c4
-rwxr-xr-xlibparc/parc/algol/parc_StdlibMemory.c4
-rwxr-xr-xlibparc/parc/algol/parc_String.c4
-rwxr-xr-xlibparc/parc/algol/parc_Time.c4
-rwxr-xr-xlibparc/parc/algol/parc_TreeMap.c76
-rwxr-xr-xlibparc/parc/algol/parc_TreeRedBlack.c44
-rw-r--r--libparc/parc/algol/parc_URI.c4
-rw-r--r--libparc/parc/algol/parc_URIAuthority.c2
-rwxr-xr-xlibparc/parc/algol/parc_URIPath.c8
-rwxr-xr-xlibparc/parc/algol/parc_URIPath.h2
-rwxr-xr-xlibparc/parc/algol/parc_URISegment.c10
-rw-r--r--libparc/parc/algol/parc_Unsigned.c2
-rwxr-xr-xlibparc/parc/algol/parc_Varint.c84
-rwxr-xr-xlibparc/parc/algol/parc_Vector.c12
-rwxr-xr-xlibparc/parc/algol/test/test_parc_ArrayList.c5
-rw-r--r--libparc/parc/assert/parc_Assert.h191
-rwxr-xr-xlibparc/parc/concurrent/parc_AtomicUint16.c4
-rwxr-xr-xlibparc/parc/concurrent/parc_AtomicUint32.c4
-rwxr-xr-xlibparc/parc/concurrent/parc_AtomicUint64.c4
-rwxr-xr-xlibparc/parc/concurrent/parc_AtomicUint8.c4
-rwxr-xr-xlibparc/parc/concurrent/parc_FutureTask.c8
-rwxr-xr-xlibparc/parc/concurrent/parc_Lock.c8
-rwxr-xr-xlibparc/parc/concurrent/parc_Notifier.c6
-rwxr-xr-xlibparc/parc/concurrent/parc_RingBuffer.c2
-rwxr-xr-xlibparc/parc/concurrent/parc_RingBuffer_1x1.c10
-rwxr-xr-xlibparc/parc/concurrent/parc_RingBuffer_NxM.c8
-rwxr-xr-xlibparc/parc/concurrent/parc_ScheduledTask.c4
-rw-r--r--libparc/parc/concurrent/parc_ScheduledThreadPool.c6
-rwxr-xr-xlibparc/parc/concurrent/parc_Synchronizer.c4
-rw-r--r--libparc/parc/concurrent/parc_Thread.c6
-rw-r--r--libparc/parc/concurrent/parc_ThreadPool.c4
-rwxr-xr-xlibparc/parc/concurrent/parc_Timer.c4
-rw-r--r--libparc/parc/concurrent/test/test_parc_ScheduledThreadPool.c4
-rw-r--r--libparc/parc/concurrent/test/test_parc_Thread.c15
-rw-r--r--libparc/parc/concurrent/test/test_parc_ThreadPool.c2
-rw-r--r--libparc/parc/developer/parc_Stopwatch.c4
-rw-r--r--libparc/parc/developer/test/test_parc_Stopwatch.c4
-rw-r--r--libparc/parc/libparc_About.c2
-rwxr-xr-xlibparc/parc/libparc_About.h2
-rwxr-xr-xlibparc/parc/logging/parc_Log.c6
-rw-r--r--libparc/parc/logging/parc_LogEntry.c4
-rwxr-xr-xlibparc/parc/logging/parc_LogManager.c2
-rw-r--r--libparc/parc/memory/parc_BufferPool.c4
-rw-r--r--libparc/parc/object/test/CMakeLists.txt12
-rw-r--r--libparc/parc/security/command-line/parc-publickey.c2
-rw-r--r--libparc/parc/security/command-line/parcPublicKey_About.c2
-rwxr-xr-xlibparc/parc/security/command-line/parcPublicKey_About.h2
-rw-r--r--libparc/parc/security/parc_CertificateFactory.c2
-rwxr-xr-xlibparc/parc/security/parc_CertificateType.c2
-rwxr-xr-xlibparc/parc/security/parc_ContainerEncoding.c2
-rwxr-xr-xlibparc/parc/security/parc_CryptoCache.c20
-rwxr-xr-xlibparc/parc/security/parc_CryptoHash.c10
-rw-r--r--libparc/parc/security/parc_CryptoHashType.c2
-rwxr-xr-xlibparc/parc/security/parc_CryptoHasher.c18
-rwxr-xr-xlibparc/parc/security/parc_CryptoSuite.c10
-rw-r--r--libparc/parc/security/parc_DiffieHellmanKeyShare.c2
-rwxr-xr-xlibparc/parc/security/parc_Identity.c8
-rw-r--r--libparc/parc/security/parc_IdentityFile.c2
-rw-r--r--libparc/parc/security/parc_InMemoryVerifier.c30
-rwxr-xr-xlibparc/parc/security/parc_Key.c34
-rwxr-xr-xlibparc/parc/security/parc_KeyId.c4
-rwxr-xr-xlibparc/parc/security/parc_KeyStore.c2
-rw-r--r--libparc/parc/security/parc_KeyType.c2
-rw-r--r--libparc/parc/security/parc_Pkcs12KeyStore.c32
-rw-r--r--libparc/parc/security/parc_PublicKeySigner.c32
-rw-r--r--libparc/parc/security/parc_SecureRandom.c8
-rw-r--r--libparc/parc/security/parc_Security.c19
-rwxr-xr-xlibparc/parc/security/parc_Signature.c16
-rw-r--r--libparc/parc/security/parc_Signer.c10
-rwxr-xr-xlibparc/parc/security/parc_Signer.h2
-rwxr-xr-xlibparc/parc/security/parc_SigningAlgorithm.c2
-rw-r--r--libparc/parc/security/parc_SymmetricKeySigner.c12
-rw-r--r--libparc/parc/security/parc_SymmetricKeyStore.c18
-rwxr-xr-xlibparc/parc/security/parc_Verifier.c24
-rw-r--r--libparc/parc/security/parc_Verifier.h2
-rw-r--r--libparc/parc/security/parc_X509Certificate.c28
-rw-r--r--libparc/parc/security/test/test_parc_SymmetricKeySigner.c2
-rw-r--r--libparc/parc/statistics/parc_BasicStats.c4
-rw-r--r--libparc/parc/statistics/parc_EWMA.c4
-rwxr-xr-xlibparc/parc/testing/parc_MemoryTesting.c8
-rwxr-xr-xlibparc/parc/testing/parc_MemoryTesting.h9
-rw-r--r--libparc/scripts/build-package.sh12
149 files changed, 1146 insertions, 878 deletions
diff --git a/libparc/CMakeLists.txt b/libparc/CMakeLists.txt
index 3db7bfa4..f40a340e 100644
--- a/libparc/CMakeLists.txt
+++ b/libparc/CMakeLists.txt
@@ -31,14 +31,12 @@ elseif(COMPILE_FOR_IOS)
message("############ This build will not include doxygen, tools, or tests")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
else()
-# set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall")
-# set(CMAKE_C_FLAGS_NOPANTS "${CMAKE_C_FLAGS_NOPANTS} -O3 -DNDEBUG -DPARCLibrary_DISABLE_VALIDATION")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
find_package( Doxygen )
endif()
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} ${CMAKE_C_FLAGS}")
-set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} ${CMAKE_C_FLAGS} -DPARCLibrary_DISABLE_VALIDATION -DLongBow_DISABLE_ASSERTIONS")
+set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} ${CMAKE_C_FLAGS} -DPARCLibrary_DISABLE_VALIDATION")
set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} ${CMAKE_C_FLAGS}")
set(CMAKE_C_FLAGS_MINSIZEREL "${CMAKE_C_FLAGS_MINSIZEREL} ${CMAKE_C_FLAGS}")
@@ -50,33 +48,42 @@ include_directories(${PROJECT_BINARY_DIR}/parc ${PROJECT_SOURCE_DIR})
if (DOC_ONLY)
message("############ Skipping check of required dependencies.")
elseif(COMPILE_FOR_IOS)
- find_host_package( LongBow REQUIRED )
- include_directories(${LONGBOW_INCLUDE_DIRS})
-
- find_host_package( LibEvent REQUIRED )
+find_host_package( LibEvent REQUIRED )
include_directories(${LIBEVENT_INCLUDE_DIRS})
find_host_package ( OpenSSL REQUIRED )
else()
- find_package( LongBow REQUIRED )
- include_directories(${LONGBOW_INCLUDE_DIRS})
-
find_package( LibEvent REQUIRED )
include_directories(${LIBEVENT_INCLUDE_DIRS})
+ if(ENABLE_TEST)
+ find_package( LongBow REQUIRED )
+ include_directories(${LONGBOW_INCLUDE_DIRS})
+ endif()
+
find_package ( Threads REQUIRED )
find_package ( OpenSSL REQUIRED )
include_directories(${OPENSSL_INCLUDE_DIR})
-endif()
-set(PARC_BIN_LIBRARIES
- parc
- ${LONGBOW_LIBRARIES}
- ${LIBEVENT_LIBRARIES}
- ${OPENSSL_LIBRARIES}
- ${CMAKE_THREAD_LIBS_INIT}
- )
+endif()
+if(ENABLE_TEST)
+ message("############ Test enabled")
+ set(PARC_BIN_LIBRARIES
+ parc
+ ${LONGBOW_LIBRARIES}
+ ${LIBEVENT_LIBRARIES}
+ ${OPENSSL_LIBRARIES}
+ ${CMAKE_THREAD_LIBS_INIT}
+ )
+else()
+ set(PARC_BIN_LIBRARIES
+ parc
+ ${LIBEVENT_LIBRARIES}
+ ${OPENSSL_LIBRARIES}
+ ${CMAKE_THREAD_LIBS_INIT}
+ )
+endif()
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
@@ -91,6 +98,7 @@ if (ANDROID_API)
elseif(COMPILE_FOR_IOS)
macro(AddTest testFile)
message("iOS build: Skipping test ${ARGV0}")
+ set(CMAKE_C_FLAGS_NOPANTS "${CMAKE_C_FLAGS_NOPANTS} -O3 -DNDEBUG -DPARCLibrary_DISABLE_VALIDATION")
endmacro(AddTest)
else()
macro(AddTest testFile)
@@ -143,11 +151,15 @@ if(DEB_PACKAGE)
set(CPACK_${TYPE}_HEADERS_FILE_NAME "${PACKAGE_NAME}-dev_${PACKAGE_VERSION}_${ARCHITECTURE}.deb")
set(CPACK_${TYPE}_DOCUMENTATION_FILE_NAME "${PACKAGE_NAME}-doc_${PACKAGE_VERSION}_${ARCHITECTURE}.deb")
-# set(CPACK_DEBIAN_LIBRARY_PACKAGE_SHLIBDEPS ON)
+ set(CPACK_DEBIAN_LIBRARY_PACKAGE_SHLIBDEPS ON)
- set(CPACK_${TYPE}_LIBRARY_PACKAGE_DEPENDS "longbow (>= 1.0)")
- set(CPACK_${TYPE}_HEADERS_PACKAGE_DEPENDS "libparc (>= 1.0), longbow-dev (>= 1.0), libevent-dev, libssl-dev")
- set(CPACK_${TYPE}_DOCUMENTATION_PACKAGE_DEPENDS "")
+ if(ENABLE_TEST)
+ set(CPACK_${TYPE}_LIBRARY_PACKAGE_DEPENDS "longbow (>= 1.0)")
+ set(CPACK_${TYPE}_HEADERS_PACKAGE_DEPENDS "libparc (>= 1.0), longbow-dev (>= 1.0), libevent-dev, libssl-dev")
+ else()
+ set(CPACK_${TYPE}_HEADERS_PACKAGE_DEPENDS "libparc (>= 1.0), libevent-dev, libssl-dev")
+ set(CPACK_${TYPE}_DOCUMENTATION_PACKAGE_DEPENDS "")
+ endif()
elseif(RPM_PACKAGE)
set(TYPE "RPM")
set(GENERATOR "RPM")
@@ -161,10 +173,13 @@ elseif(RPM_PACKAGE)
set(CPACK_${TYPE}_DOCUMENTATION_FILE_NAME "${PACKAGE_NAME}-doc-${PACKAGE_VERSION}.${ARCHITECTURE}.rpm")
set(CPACK_${TYPE}_LIBRARY_PACKAGE_AUTOREQ ON)
-
- set(CPACK_${TYPE}_LIBRARY_PACKAGE_REQUIRES "longbow >= 1.0")
- set(CPACK_${TYPE}_HEADERS_PACKAGE_REQUIRES "libparc >= 1.0, longbow-devel >= 1.0, libevent-devel, openssl-devel")
- set(CPACK_${TYPE}_DOCUMENTATION_PACKAGE_REQUIRES "")
+ if(ENABLE_TEST)
+ set(CPACK_${TYPE}_LIBRARY_PACKAGE_REQUIRES "longbow >= 1.0")
+ set(CPACK_${TYPE}_HEADERS_PACKAGE_REQUIRES "libparc >= 1.0, longbow-devel >= 1.0, libevent-devel, openssl-devel")
+ else()
+ set(CPACK_${TYPE}_HEADERS_PACKAGE_REQUIRES "libparc >= 1.0, libevent-devel, openssl-devel")
+ set(CPACK_${TYPE}_DOCUMENTATION_PACKAGE_REQUIRES "")
+ endif()
set(CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION "/usr/etc" "/usr/lib/python2.7" "/usr/lib/python2.7/site-packages")
else()
diff --git a/libparc/README.md b/libparc/README.md
index 818435f6..34d38c9a 100644
--- a/libparc/README.md
+++ b/libparc/README.md
@@ -13,6 +13,10 @@ $ cd build
$ cmake ..
or, for MacOSX 10.12, you need to speficy openssl root folder
$ cmake .. -DOPENSSL_ROOT_DIR=/usr/local/opt/openssl/
+
+otherwise, if you want to build also the tests you need to specify the following flag
+$ cmake .. -DOPENSSL_ROOT_DIR=/usr/local/opt/openssl/ -DENABLE_TEST=on
+
$ make
$ make test
$ make install
@@ -56,7 +60,6 @@ Basic dependencies:
- OpenSSL
- pthreads
- Libevent
-- LongBow
Documentation dependencies:
diff --git a/libparc/documentation/Makefile.am b/libparc/documentation/Makefile.am
index 4163756c..440de845 100644
--- a/libparc/documentation/Makefile.am
+++ b/libparc/documentation/Makefile.am
@@ -18,7 +18,6 @@ docs: doxygen-libparc
doxygen-libparc: libparc.doxygen
${DOXYGEN_BIN} -s libparc.doxygen
- ${prefix}/bin/longbow-doxygen-report -a --doxygenlog libparc-doxygen.log
website: libparc-doxygen.log
$(MAKE) -C Jekyll
diff --git a/libparc/documentation/libparc.doxygen b/libparc/documentation/libparc.doxygen
index fc9d6483..340c1382 100644
--- a/libparc/documentation/libparc.doxygen
+++ b/libparc/documentation/libparc.doxygen
@@ -2053,7 +2053,7 @@ SKIP_FUNCTION_MACROS = YES
# the path). If a tag file is not located in the directory in which doxygen is
# run, you must also specify the path to the tagfile here.
-TAGFILES = ../../Longbow/documentation/longbow.doctags=
+TAGFILES = ../../tagfiles/documentation/tagfiles.doctags=
# When a file name is specified after GENERATE_TAGFILE, doxygen will create a
# tag file that is based on the input files it reads. See section "Linking to
diff --git a/libparc/documentation/libparc.doxygen.in b/libparc/documentation/libparc.doxygen.in
index 1844b3e2..9dab9566 100644
--- a/libparc/documentation/libparc.doxygen.in
+++ b/libparc/documentation/libparc.doxygen.in
@@ -2058,7 +2058,7 @@ SKIP_FUNCTION_MACROS = YES
# the path). If a tag file is not located in the directory in which doxygen is
# run, you must also specify the path to the tagfile here.
-TAGFILES = ../../Longbow/documentation/longbow.doctags=https://parc.github.io/LongBow/
+TAGFILES = ../../tagfile/documentation/tagfile.doctags
# When a file name is specified after GENERATE_TAGFILE, doxygen will create a
# tag file that is based on the input files it reads. See section "Linking to
diff --git a/libparc/examples/How To Create A Static PARC Object/parc_MyObject.c b/libparc/examples/How To Create A Static PARC Object/parc_MyObject.c
index 9523e494..f3e5b6c4 100644
--- a/libparc/examples/How To Create A Static PARC Object/parc_MyObject.c
+++ b/libparc/examples/How To Create A Static PARC Object/parc_MyObject.c
@@ -37,7 +37,7 @@ struct PARCMyObject {
static bool
_parcMyObject_Destructor(PARCMyObject **instancePtr)
{
- assertNotNull(instancePtr, "Parameter must be a non-null pointer to a PARCMyObject pointer.");
+ parcAssertNotNull(instancePtr, "Parameter must be a non-null pointer to a PARCMyObject pointer.");
/* cleanup the instance fields here */
@@ -62,7 +62,7 @@ parcObject_Override(
void
parcMyObject_AssertValid(const PARCMyObject *instance)
{
- assertTrue(parcMyObject_IsValid(instance),
+ parcAssertTrue(parcMyObject_IsValid(instance),
"PARCMyObject is not valid.");
}
diff --git a/libparc/examples/How To Create an Object Pool/parc_SimpleBufferPool.c b/libparc/examples/How To Create an Object Pool/parc_SimpleBufferPool.c
index fbd71b6e..9aad015b 100644
--- a/libparc/examples/How To Create an Object Pool/parc_SimpleBufferPool.c
+++ b/libparc/examples/How To Create an Object Pool/parc_SimpleBufferPool.c
@@ -33,7 +33,7 @@ struct PARCSimpleBufferPool {
static bool
_parcSimpleBufferPool_Destructor(PARCSimpleBufferPool **instancePtr)
{
- assertNotNull(instancePtr, "Parameter must be a non-null pointer to a PARCSimpleBufferPool pointer.");
+ parcAssertNotNull(instancePtr, "Parameter must be a non-null pointer to a PARCSimpleBufferPool pointer.");
PARCSimpleBufferPool *pool = *instancePtr;
diff --git a/libparc/parc/CMakeLists.txt b/libparc/parc/CMakeLists.txt
index 1b98fee9..ebb3ff91 100644
--- a/libparc/parc/CMakeLists.txt
+++ b/libparc/parc/CMakeLists.txt
@@ -88,18 +88,18 @@ set(LIBPARC_ALGOL_SOURCE_FILES
algol/parc_Base64.c
algol/parc_BitVector.c
algol/parc_Buffer.c
- algol/parc_BufferChunker.c
+ algol/parc_BufferChunker.c
algol/parc_BufferComposer.c
algol/parc_BufferDictionary.c
algol/parc_ByteArray.c
algol/parc_Clock.c
- algol/parc_Chunker.c
+ algol/parc_Chunker.c
algol/parc_Deque.c
algol/parc_Dictionary.c
algol/parc_DisplayIndented.c
algol/parc_Environment.c
algol/parc_File.c
- algol/parc_FileChunker.c
+ algol/parc_FileChunker.c
algol/parc_FileInputStream.c
algol/parc_FileOutputStream.c
algol/parc_Hash.c
@@ -152,15 +152,17 @@ set(LIBPARC_ALGOL_SOURCE_FILES
algol/parc_Unsigned.c
)
-set(LIBPARC_TESTING_HEADER_FILES
- testing/parc_MemoryTesting.h
- testing/parc_ObjectTesting.h
- )
+if(ENABLE_TEST)
+ set(LIBPARC_TESTING_HEADER_FILES
+ testing/parc_MemoryTesting.h
+ testing/parc_ObjectTesting.h
+ )
-set(LIBPARC_TESTING_SOURCE_FILES
- testing/parc_MemoryTesting.c
- testing/parc_ObjectTesting.c
- )
+ set(LIBPARC_TESTING_SOURCE_FILES
+ testing/parc_MemoryTesting.c
+ testing/parc_ObjectTesting.c
+ )
+endif()
set(LIBPARC_SECURITY_HEADER_FILES
security/parc_CryptoHasher.h
@@ -177,9 +179,9 @@ set(LIBPARC_SECURITY_HEADER_FILES
security/parc_IdentityFile.h
security/parc_Key.h
security/parc_KeyId.h
- security/parc_KeyStore.h
- security/parc_Pkcs12KeyStore.h
- security/parc_PublicKeySigner.h
+ security/parc_KeyStore.h
+ security/parc_Pkcs12KeyStore.h
+ security/parc_PublicKeySigner.h
security/parc_SecureRandom.h
security/parc_Security.h
security/parc_Signature.h
@@ -279,6 +281,10 @@ set(LIBPARC_LOGGING_HEADER_FILES
logging/parc_LogFormatSyslog.h
)
+set (LIBPARC_ASSERT_HEADER_FILES
+ assert/parc_Assert.h
+ )
+
set(LIBPARC_LOGGING_SOURCE_FILES
logging/parc_Log.c
logging/parc_LogEntry.c
@@ -324,13 +330,11 @@ set(LIBPARC_SOURCE_FILES
${LIBPARC_ALGOL_SOURCE_FILES}
${LIBPARC_CONCURRENT_SOURCE_FILES}
${LIBPARC_SECURITY_SOURCE_FILES}
- ${LIBPARC_TESTING_SOURCE_FILES}
${LIBPARC_LOGGING_SOURCE_FILES}
${LIBPARC_DEVELOPER_SOURCE_FILES}
${LIBPARC_BASE_HEADER_FILES}
${LIBPARC_ALGOL_HEADER_FILES}
${LIBPARC_PRIVATE_HEADER_FILES}
- ${LIBPARC_TESTING_HEADER_FILES}
${LIBPARC_SECURITY_HEADER_FILES}
${LIBPARC_CONCURRENT_HEADER_FILES}
${LIBPARC_CONCURRENT_SOURCE_FILES}
@@ -338,20 +342,31 @@ set(LIBPARC_SOURCE_FILES
${LIBPARC_DEVELOPER_HEADER_FILES}
${LIBPARC_STATISTICS_HEADER_FILES} ${LIBPARC_STATISTICS_SOURCE_FILES}
${LIBPARC_MEMORY_HEADER_FILES} ${LIBPARC_MEMORY_SOURCE_FILES}
+ ${LIBPARC_ASSERT_HEADER_FILES}
+)
+
+if(ENABLE_TEST)
+ list(APPEND LIBPARC_SOURCE_FILES
+ ${LIBPARC_TESTING_SOURCE_FILES}
+ ${LIBPARC_TESTING_HEADER_FILES}
)
+endif()
set(LIBPARC_ALGOL_FILES ${LIBPARC_ALGOL_SOURCE_FILES} ${LIBPARC_ALGOL_HEADER_FILES})
list(SORT LIBPARC_ALGOL_FILES)
source_group(algol FILES ${LIBPARC_ALGOL_FILES})
-#source_group(algol FILES ${LIBPARC_ALGOL_SOURCE_FILES} ${LIBPARC_ALGOL_HEADER_FILES})
source_group(concurrent FILES ${LIBPARC_CONCURRENT_SOURCE_FILES} ${LIBPARC_CONCURRENT_HEADER_FILES})
source_group(security FILES ${LIBPARC_SECURITY_SOURCE_FILES} ${LIBPARC_SECURITY_HEADER_FILES})
source_group(developer FILES ${LIBPARC_DEVELOPER_SOURCE_FILES} ${LIBPARC_DEVELOPER_HEADER_FILES})
source_group(logging FILES ${LIBPARC_LOGGING_SOURCE_FILES} ${LIBPARC_LOGGING_HEADER_FILES})
-source_group(testing FILES ${LIBPARC_TESTING_SOURCE_FILES} ${LIBPARC_TESTING_HEADER_FILES})
source_group(statistics FILES ${LIBPARC_STATISTICS_SOURCE_FILES} ${LIBPARC_STATISTICS_HEADER_FILES})
source_group(memory FILES ${LIBPARC_MEMORY_SOURCE_FILES} ${LIBPARC_MEMORY_HEADER_FILES})
+source_group(assert FILES ${LIBPARC_ASSERT_HEADER_FILES})
+
+if(ENABLE_TEST)
+ source_group(testing FILES ${LIBPARC_TESTING_SOURCE_FILES} ${LIBPARC_TESTING_HEADER_FILES})
+endif()
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "AppleClang" OR COMPILE_FOR_IOS)
set(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "${CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS} -undefined dynamic_lookup")
@@ -390,21 +405,32 @@ endforeach()
install(FILES ${LIBPARC_ALGOL_HEADER_FILES} DESTINATION include/parc/algol COMPONENT headers)
install(FILES ${LIBPARC_SECURITY_HEADER_FILES} DESTINATION include/parc/security COMPONENT headers)
install(FILES ${LIBPARC_LOGGING_HEADER_FILES} DESTINATION include/parc/logging COMPONENT headers)
-install(FILES ${LIBPARC_TESTING_HEADER_FILES} DESTINATION include/parc/testing COMPONENT headers)
install(FILES ${LIBPARC_CONCURRENT_HEADER_FILES} DESTINATION include/parc/concurrent COMPONENT headers)
install(FILES ${LIBPARC_DEVELOPER_HEADER_FILES} DESTINATION include/parc/developer COMPONENT headers)
install(FILES ${LIBPARC_BASE_HEADER_FILES} DESTINATION include/parc COMPONENT headers)
install(FILES ${LIBPARC_STATISTICS_HEADER_FILES} DESTINATION include/parc/statistics COMPONENT headers)
install(FILES ${LIBPARC_MEMORY_HEADER_FILES} DESTINATION include/parc/memory COMPONENT headers)
+install(FILES ${LIBPARC_ASSERT_HEADER_FILES} DESTINATION include/parc/assert COMPONENT headers)
-if(NOT COMPILE_FOR_IOS)
- add_subdirectory(security/command-line)
- add_subdirectory(algol/test)
- add_subdirectory(concurrent/test)
- add_subdirectory(developer/test)
- add_subdirectory(security/test)
- add_subdirectory(logging/test)
- add_subdirectory(testing/test)
- add_subdirectory(statistics/test)
- add_subdirectory(memory/test)
+if(ENABLE_TEST)
+ install(FILES ${LIBPARC_TESTING_HEADER_FILES} DESTINATION include/parc/testing COMPONENT headers)
endif()
+
+if(ENABLE_TEST)
+ if(NOT COMPILE_FOR_IOS)
+ add_subdirectory(security/command-line)
+ add_subdirectory(algol/test)
+ add_subdirectory(concurrent/test)
+ add_subdirectory(developer/test)
+ add_subdirectory(security/test)
+ add_subdirectory(logging/test)
+ add_subdirectory(testing/test)
+ add_subdirectory(statistics/test)
+ add_subdirectory(memory/test)
+ endif()
+else()
+ if(NOT COMPILE_FOR_IOS)
+ add_subdirectory(security/command-line)
+ endif()
+endif()
+
diff --git a/libparc/parc/algol/internal_parc_Event.c b/libparc/parc/algol/internal_parc_Event.c
index 74e917bf..54c193ea 100755
--- a/libparc/parc/algol/internal_parc_Event.c
+++ b/libparc/parc/algol/internal_parc_Event.c
@@ -17,7 +17,7 @@
*/
#include <config.h>
-#include <LongBow/runtime.h>
+#include <parc/assert/parc_Assert.h>
#include <parc/algol/parc_Memory.h>
#include "internal_parc_Event.h"
@@ -67,7 +67,7 @@ internal_parc_initializeLibevent(void)
// CC = patchlevel
//
uint32_t version = event_get_version_number();
- trapIllegalValueIf(version < 0x02001000UL,
+ parcTrapIllegalValueIf(version < 0x02001000UL,
"Libevent version must be at least 2.0.16, got %s",
event_get_version());
@@ -79,9 +79,9 @@ internal_parc_initializeLibevent(void)
// Create a scheduler event base, an event, then free both of them.
//
struct event_base *evbase = event_base_new();
- assertNotNull(evbase, "Libevent event_base_new returned NULL");
+ parcAssertNotNull(evbase, "Libevent event_base_new returned NULL");
struct event *event = event_new(evbase, -1, 0, NULL, NULL);
- assertNotNull(event, "Libevent event_new returned NULL");
+ parcAssertNotNull(event, "Libevent event_new returned NULL");
event_del(event);
event_base_free(evbase);
event_free(event);
@@ -103,7 +103,7 @@ internal_libevent_priority_to_PARCEventPriority(short evpriority)
case 2: priority = PARCEventPriority_Minimum;
break;
default:
- assertTrue(0, "Unknown Libevent priority 0x%x\n", evpriority);
+ parcAssertTrue(0, "Unknown Libevent priority 0x%x\n", evpriority);
break;
}
return priority;
@@ -121,7 +121,7 @@ internal_PARCEventPriority_to_libevent_priority(PARCEventPriority priority)
case PARCEventPriority_Minimum: evpriority = 2;
break;
default:
- assertTrue(0, "Unknown PARCEventPriority 0x%x\n", evpriority);
+ parcAssertTrue(0, "Unknown PARCEventPriority 0x%x\n", evpriority);
break;
}
return evpriority;
@@ -139,7 +139,7 @@ internal_eventloop_options_to_PARCEventSchedulerDispatchType(short evoptions)
case EVLOOP_NONBLOCK: options = PARCEventSchedulerDispatchType_NonBlocking;
break;
default:
- assertTrue(0, "Unknown Libevent dispatcher flag 0x%x\n", evoptions);
+ parcAssertTrue(0, "Unknown Libevent dispatcher flag 0x%x\n", evoptions);
break;
}
return options;
@@ -157,7 +157,7 @@ internal_PARCEventSchedulerDispatchType_to_eventloop_options(PARCEventSchedulerD
case PARCEventSchedulerDispatchType_NonBlocking: evoptions = EVLOOP_NONBLOCK;
break;
default:
- assertTrue(0, "Unknown PARCEventSchedulerDispatchType option 0x%x\n", evoptions);
+ parcAssertTrue(0, "Unknown PARCEventSchedulerDispatchType option 0x%x\n", evoptions);
break;
}
return evoptions;
@@ -175,7 +175,7 @@ internal_bufferevent_options_to_PARCEventQueueOption(short evflags)
flags |= PARCEventQueueOption_DeferCallbacks;
evflags &= ~BEV_OPT_DEFER_CALLBACKS;
}
- assertTrue(evflags == 0, "Unknown Libevent option flag 0x%x\n", evflags);
+ parcAssertTrue(evflags == 0, "Unknown Libevent option flag 0x%x\n", evflags);
return flags;
}
@@ -191,7 +191,7 @@ internal_PARCEventQueueOption_to_bufferevent_options(PARCEventQueueOption flags)
evflags |= BEV_OPT_DEFER_CALLBACKS;
flags &= ~PARCEventQueueOption_DeferCallbacks;
}
- assertTrue(flags == 0, "Unknown PARCEventQueueOption flag 0x%x\n", flags);
+ parcAssertTrue(flags == 0, "Unknown PARCEventQueueOption flag 0x%x\n", flags);
return evflags;
}
@@ -223,7 +223,7 @@ internal_bufferevent_type_to_PARCEventQueueEventType(short evtypes)
types |= PARCEventQueueEventType_Connected;
evtypes &= ~BEV_EVENT_CONNECTED;
}
- assertTrue(evtypes == 0, "Unknown Libevent type flag 0x%x\n", evtypes);
+ parcAssertTrue(evtypes == 0, "Unknown Libevent type flag 0x%x\n", evtypes);
return types;
}
@@ -255,7 +255,7 @@ internal_PARCEventQueueEventType_to_bufferevent_type(PARCEventQueueEventType typ
evtypes |= BEV_EVENT_CONNECTED;
types &= ~PARCEventQueueEventType_Connected;
}
- assertTrue(types == 0, "Unknown PARCEventQueueEventType 0x%x\n", types);
+ parcAssertTrue(types == 0, "Unknown PARCEventQueueEventType 0x%x\n", types);
return evtypes;
}
@@ -287,7 +287,7 @@ internal_libevent_type_to_PARCEventType(short evtypes)
types |= PARCEventType_EdgeTriggered;
evtypes &= ~EV_ET;
}
- assertTrue(evtypes == 0, "Unknown Libevent event type 0x%x\n", evtypes);
+ parcAssertTrue(evtypes == 0, "Unknown Libevent event type 0x%x\n", evtypes);
return types;
}
@@ -319,6 +319,6 @@ internal_PARCEventType_to_libevent_type(PARCEventType types)
evtypes |= EV_ET;
types &= ~PARCEventType_EdgeTriggered;
}
- assertTrue(types == 0, "Unknown Libevent event type 0x%x\n", types);
+ parcAssertTrue(types == 0, "Unknown Libevent event type 0x%x\n", types);
return evtypes;
}
diff --git a/libparc/parc/algol/parc_ArrayList.c b/libparc/parc/algol/parc_ArrayList.c
index e9597070..4e6f6df1 100644
--- a/libparc/parc/algol/parc_ArrayList.c
+++ b/libparc/parc/algol/parc_ArrayList.c
@@ -22,7 +22,7 @@
#include <stdbool.h>
#include <string.h>
-#include <LongBow/runtime.h>
+#include <parc/assert/parc_Assert.h>
#include <parc/algol/parc_ArrayList.h>
#include <parc/algol/parc_Object.h>
@@ -85,7 +85,7 @@ _ensureCapacity(PARCArrayList *array, size_t newCapacity)
static PARCArrayList *
_ensureRemaining(PARCArrayList *array, size_t remnant)
{
- assertNotNull(array, "Parameter must be a non-null PARCArrayList pointer.");
+ parcAssertNotNull(array, "Parameter must be a non-null PARCArrayList pointer.");
if (_remaining(array) < remnant) {
size_t newCapacity = parcArrayList_Size(array) + remnant;
@@ -111,8 +111,8 @@ parcArrayList_IsValid(const PARCArrayList *instance)
void
parcArrayList_AssertValid(const PARCArrayList *instance)
{
- trapIllegalValueIf(instance == NULL, "Parameter must be a non-null PARC_ArrayList pointer.");
- assertTrue(instance->numberOfElements == 0 ? true : instance->array != NULL, "PARC_ArrayList size is inconsistent.");
+ parcTrapIllegalValueIf(instance == NULL, "Parameter must be a non-null PARC_ArrayList pointer.");
+ parcAssertTrue(instance->numberOfElements == 0 ? true : instance->array != NULL, "PARC_ArrayList size is inconsistent.");
}
static PARCArrayList *
@@ -137,7 +137,7 @@ PARCArrayList *
parcArrayList_Create(void (*destroyElement)(void **element))
{
PARCArrayList *result = parcMemory_AllocateAndClear(sizeof(PARCArrayList));
- assertNotNull(result, "Memory allocation of PARCArrayList failed");
+ parcAssertNotNull(result, "Memory allocation of PARCArrayList failed");
return _parcArrayList_Init(result, 0, 0, NULL, NULL, destroyElement);
}
@@ -146,7 +146,7 @@ PARCArrayList *
parcArrayList_Create_Capacity(bool (*equalsElement)(void *x, void *y), void (*destroyElement)(void **element), size_t size)
{
PARCArrayList *result = parcMemory_AllocateAndClear(sizeof(PARCArrayList));
- assertNotNull(result, "Memory allocation of PARCArrayList failed");
+ parcAssertNotNull(result, "Memory allocation of PARCArrayList failed");
_parcArrayList_Init(result, 0, 0, NULL, equalsElement, destroyElement);
@@ -163,7 +163,7 @@ parcArrayList_Add(PARCArrayList *array, const void *pointer)
parcArrayList_OptionalAssertValid(array);
if (_ensureRemaining(array, 1) == NULL) {
- trapOutOfMemory("Cannot increase space for PARCArrayList.");
+ parcTrapOutOfMemory("Cannot increase space for PARCArrayList.");
}
array->array[array->numberOfElements++] = (void *) pointer;
@@ -221,7 +221,7 @@ parcArrayList_Equals(const PARCArrayList *a, const PARCArrayList *b)
void *
parcArrayList_RemoveAtIndex(PARCArrayList *array, size_t index)
{
- trapOutOfBoundsIf(index >= array->numberOfElements, "Index must be within the range [0, %zu)", array->numberOfElements);
+ parcTrapOutOfBoundsIf(index >= array->numberOfElements, "Index must be within the range [0, %zu)", array->numberOfElements);
void *element = array->array[index];
@@ -237,7 +237,7 @@ parcArrayList_RemoveAtIndex(PARCArrayList *array, size_t index)
void
parcArrayList_Set(const PARCArrayList *array, size_t index, void *pointer)
{
- trapOutOfBoundsIf(index >= array->numberOfElements, "Index must be within the range [0, %zu)", array->numberOfElements);
+ parcTrapOutOfBoundsIf(index >= array->numberOfElements, "Index must be within the range [0, %zu)", array->numberOfElements);
array->array[index] = pointer;
}
@@ -245,7 +245,7 @@ parcArrayList_Set(const PARCArrayList *array, size_t index, void *pointer)
void *
parcArrayList_Get(const PARCArrayList *array, size_t index)
{
- trapOutOfBoundsIf(index >= array->numberOfElements, "Index must be within the range [0, %zu)", array->numberOfElements);
+ parcTrapOutOfBoundsIf(index >= array->numberOfElements, "Index must be within the range [0, %zu)", array->numberOfElements);
return array->array[index];
}
@@ -265,13 +265,13 @@ parcArrayList_Size(const PARCArrayList *pointerArray)
void
parcArrayList_Destroy(PARCArrayList **arrayPtr)
{
- assertNotNull(arrayPtr, "Parameter must be a non-null pointer to a PARC_ArrayList pointer.");
+ parcAssertNotNull(arrayPtr, "Parameter must be a non-null pointer to a PARC_ArrayList pointer.");
PARCArrayList *array = *arrayPtr;
parcArrayList_OptionalAssertValid(array);
- assertTrue(array->numberOfElements == 0 ? true : array->array != NULL, "PARC_ArrayList is inconsistent.");
+ parcAssertTrue(array->numberOfElements == 0 ? true : array->array != NULL, "PARC_ArrayList is inconsistent.");
if (array->destroyElement != NULL) {
for (size_t i = 0; i < array->numberOfElements; i++) {
@@ -328,7 +328,7 @@ parcArrayList_RemoveAndDestroyAtIndex(PARCArrayList *array, size_t index)
{
parcArrayList_OptionalAssertValid(array);
- assertTrue(index < array->numberOfElements, "Index must be ( 0 <= index < %zd). Actual=%zd", array->numberOfElements, index);
+ parcAssertTrue(index < array->numberOfElements, "Index must be ( 0 <= index < %zd). Actual=%zd", array->numberOfElements, index);
if (index < array->numberOfElements) {
// Destroy the element at the given index.
@@ -352,7 +352,7 @@ parcArrayList_InsertAtIndex(PARCArrayList *array, size_t index, const void *poin
parcArrayList_OptionalAssertValid(array);
size_t length = parcArrayList_Size(array);
- assertTrue(index <= array->numberOfElements, "You can't insert beyond the end of the list");
+ parcAssertTrue(index <= array->numberOfElements, "You can't insert beyond the end of the list");
// Create space and grow the array if needed
_ensureRemaining(array, length + 1);
diff --git a/libparc/parc/algol/parc_Base64.c b/libparc/parc/algol/parc_Base64.c
index 38020479..cac0aa4d 100755
--- a/libparc/parc/algol/parc_Base64.c
+++ b/libparc/parc/algol/parc_Base64.c
@@ -39,7 +39,7 @@
#include <stdio.h>
#include <string.h>
-#include <LongBow/runtime.h>
+#include <parc/assert/parc_Assert.h>
#include <parc/algol/parc_Base64.h>
#include <parc/algol/parc_Memory.h>
@@ -80,7 +80,7 @@ const uint8_t decodeTable[256] = {
static void
_encodeWithPad(PARCBufferComposer *output, const uint8_t *quantum, size_t padLength)
{
- assertTrue(padLength < 3, "Degenerate case -- should never pad all 3 bytes!");
+ parcAssertTrue(padLength < 3, "Degenerate case -- should never pad all 3 bytes!");
unsigned index;
diff --git a/libparc/parc/algol/parc_BitVector.c b/libparc/parc/algol/parc_BitVector.c
index 578fd102..21a66c23 100755
--- a/libparc/parc/algol/parc_BitVector.c
+++ b/libparc/parc/algol/parc_BitVector.c
@@ -13,11 +13,9 @@
* limitations under the License.
*/
-/**
- */
#include <config.h>
-#include <LongBow/runtime.h>
+#include <parc/assert/parc_Assert.h>
#include <parc/algol/parc_Object.h>
#include <parc/algol/parc_BitVector.h>
@@ -61,10 +59,10 @@ PARCBitVector *
parcBitVector_Create(void)
{
PARCBitVector *parcBitVector = parcObject_CreateInstance(PARCBitVector);
- assertNotNull(parcBitVector, "parcObject_CreateInstance returned NULL");
+ parcAssertNotNull(parcBitVector, "parcObject_CreateInstance returned NULL");
parcBitVector->bitArray = parcMemory_AllocateAndClear(DEFAULT_BITARRAY_SIZE);
- assertNotNull(parcBitVector->bitArray, "parcMemory_AllocateAndClear(%d) returned NULL", DEFAULT_BITARRAY_SIZE);
+ parcAssertNotNull(parcBitVector->bitArray, "parcMemory_AllocateAndClear(%d) returned NULL", DEFAULT_BITARRAY_SIZE);
parcBitVector->bitLength = DEFAULT_BITARRAY_SIZE * BITS_PER_BYTE;
parcBitVector->numberOfBitsSet = 0;
parcBitVector->firstBitSet = -1;
@@ -77,7 +75,7 @@ PARCBitVector *
parcBitVector_Copy(const PARCBitVector *source)
{
PARCBitVector *parcBitVector = parcObject_CreateInstance(PARCBitVector);
- assertNotNull(parcBitVector, "parcObject_CreateInstance returned NULL");
+ parcAssertNotNull(parcBitVector, "parcObject_CreateInstance returned NULL");
size_t byteLength = source->bitLength / BITS_PER_BYTE;
parcBitVector->bitArray = parcMemory_Allocate(byteLength);
@@ -111,8 +109,8 @@ parcBitVector_Equals(const PARCBitVector *a, const PARCBitVector *b)
static void
_parc_bit_vector_resize(PARCBitVector *parcBitVector, unsigned bit)
{
- assertNotNull(parcBitVector, "_parc_bit_vector_resize passed a NULL parcBitVector");
- assertTrue(bit < MAX_BIT_VECTOR_INDEX, "_parc_bit_vector_resize passed a bit index that's too large");
+ parcAssertNotNull(parcBitVector, "_parc_bit_vector_resize passed a NULL parcBitVector");
+ parcAssertTrue(bit < MAX_BIT_VECTOR_INDEX, "_parc_bit_vector_resize passed a bit index that's too large");
unsigned neededBits = bit + 1;
if (neededBits > parcBitVector->bitLength) {
@@ -120,12 +118,12 @@ _parc_bit_vector_resize(PARCBitVector *parcBitVector, unsigned bit)
int oldSize = (parcBitVector->bitLength / BITS_PER_BYTE) + ((parcBitVector->bitLength % BITS_PER_BYTE) ? 1 : 0);
uint8_t *newArray = parcMemory_Reallocate(parcBitVector->bitArray, newSize);
- assertTrue(newArray, "parcMemory_Reallocate(%d) failed", newSize);
+ parcAssertTrue(newArray, "parcMemory_Reallocate(%d) failed", newSize);
// Reallocate does not guarantee that additional memory is zero-filled.
memset((void *) &(newArray[oldSize]), parcBitVector->fillValue, newSize - oldSize);
parcBitVector->bitArray = newArray;
- assertNotNull(newArray, "parcMemory_Reallocate(%d) returned NULL", newSize);
+ parcAssertNotNull(newArray, "parcMemory_Reallocate(%d) returned NULL", newSize);
parcBitVector->bitLength = newSize * BITS_PER_BYTE;
}
}
@@ -133,7 +131,7 @@ _parc_bit_vector_resize(PARCBitVector *parcBitVector, unsigned bit)
int
parcBitVector_Get(const PARCBitVector *parcBitVector, unsigned bit)
{
- assertTrue(bit < MAX_BIT_VECTOR_INDEX, "parcBitVector_Set passed a bit index that's too large");
+ parcAssertTrue(bit < MAX_BIT_VECTOR_INDEX, "parcBitVector_Set passed a bit index that's too large");
if ((parcBitVector == NULL) || (bit >= parcBitVector->bitLength)) {
return -1;
@@ -151,8 +149,8 @@ parcBitVector_Get(const PARCBitVector *parcBitVector, unsigned bit)
void
parcBitVector_Set(PARCBitVector *parcBitVector, unsigned bit)
{
- assertNotNull(parcBitVector, "parcBitVector_Set passed a NULL parcBitVector");
- assertTrue(bit < MAX_BIT_VECTOR_INDEX, "parcBitVector_Set passed a bit index that's too huge");
+ parcAssertNotNull(parcBitVector, "parcBitVector_Set passed a NULL parcBitVector");
+ parcAssertTrue(bit < MAX_BIT_VECTOR_INDEX, "parcBitVector_Set passed a bit index that's too huge");
if (bit >= parcBitVector->bitLength) {
_parc_bit_vector_resize(parcBitVector, bit);
}
@@ -170,12 +168,12 @@ parcBitVector_Set(PARCBitVector *parcBitVector, unsigned bit)
void
parcBitVector_SetVector(PARCBitVector *parcBitVector, const PARCBitVector *bitsToSet)
{
- assertNotNull(parcBitVector, "parcBitVector_SetVector passed a NULL parcBitVector");
- assertNotNull(parcBitVector, "parcBitVector_SetVector passed a NULL vector of bits to set");
+ parcAssertNotNull(parcBitVector, "parcBitVector_SetVector passed a NULL parcBitVector");
+ parcAssertNotNull(parcBitVector, "parcBitVector_SetVector passed a NULL vector of bits to set");
int settingBit = 0;
for (int i = 0; i < bitsToSet->numberOfBitsSet; i++) {
settingBit = parcBitVector_NextBitSet(bitsToSet, settingBit);
- assertTrue(settingBit != -1, "Number of bits claimed set inconsistent with bits found");
+ parcAssertTrue(settingBit != -1, "Number of bits claimed set inconsistent with bits found");
parcBitVector_Set(parcBitVector, settingBit);
settingBit++;
}
@@ -194,8 +192,8 @@ parcBitVector_Reset(PARCBitVector *parcBitVector)
void
parcBitVector_Clear(PARCBitVector *parcBitVector, unsigned bit)
{
- assertNotNull(parcBitVector, "parcBitVector_Clear passed a NULL parcBitVector");
- assertTrue(bit < MAX_BIT_VECTOR_INDEX, "parcBitVector_Clear passed a bit index that's too huge");
+ parcAssertNotNull(parcBitVector, "parcBitVector_Clear passed a NULL parcBitVector");
+ parcAssertTrue(bit < MAX_BIT_VECTOR_INDEX, "parcBitVector_Clear passed a bit index that's too huge");
if (bit > parcBitVector->bitLength) {
_parc_bit_vector_resize(parcBitVector, bit);
}
@@ -213,8 +211,8 @@ parcBitVector_Clear(PARCBitVector *parcBitVector, unsigned bit)
void
parcBitVector_ClearVector(PARCBitVector *parcBitVector, const PARCBitVector *bitsToClear)
{
- assertNotNull(parcBitVector, "parcBitVector_ClearVector passed a NULL parcBitVector");
- assertNotNull(bitsToClear, "parcBitVector_ClearVector passed a NULL for vector of bitsToClear");
+ parcAssertNotNull(parcBitVector, "parcBitVector_ClearVector passed a NULL parcBitVector");
+ parcAssertNotNull(bitsToClear, "parcBitVector_ClearVector passed a NULL for vector of bitsToClear");
// If we're clearing ourself, we just need a reset
if (parcBitVector == bitsToClear) {
diff --git a/libparc/parc/algol/parc_BitVector.h b/libparc/parc/algol/parc_BitVector.h
index 7e72ac70..552fd911 100755
--- a/libparc/parc/algol/parc_BitVector.h
+++ b/libparc/parc/algol/parc_BitVector.h
@@ -57,7 +57,7 @@ PARCBitVector *parcBitVector_Create(void);
* PARCBitVector *parcBitVector = parcBitVector_Create();
* parcBitVector_Set(parcBitVector, 10);
* PARCBitVector *copy = parcBitVector_Copy(parcBitVector);
- * assertTrue(parcBitVector_Equals(parcBitVector, copy), "Duplicate vector is unequal");
+ * parcAssertTrue(parcBitVector_Equals(parcBitVector, copy), "Duplicate vector is unequal");
* }
* @endcode
*
@@ -115,7 +115,7 @@ void parcBitVector_Release(PARCBitVector **parcBitVector);
* parcBitVector_Set(parcBitVector, 10);
* PARCBitVector *copy = parcBitVector_Copy(parcBitVector);
* parcBitVector_Set(copy, 1);
- * assertTrue(parcBitVector_Equals(parcBitVector, copy) == false, "Vector should have been unequal");
+ * parcAssertTrue(parcBitVector_Equals(parcBitVector, copy) == false, "Vector should have been unequal");
* }
* @endcode
*
@@ -138,7 +138,7 @@ bool parcBitVector_Equals(const PARCBitVector *a, const PARCBitVector *b);
* parcBitVector_Set(superSet, 11);
* PARCBitVector *subSet = parcBitVector_Create();
* parcBitVector_Set(subSet, 10);
- * assertTrue(parcBitVector_Contains(superSet, subSet), "Expect superSet to contain subSet");
+ * parcAssertTrue(parcBitVector_Contains(superSet, subSet), "Expect superSet to contain subSet");
* }
* @endcode
*
@@ -157,7 +157,7 @@ bool parcBitVector_Contains(const PARCBitVector *parcBitVector, const PARCBitVec
* {
* PARCBitVector *parcBitVector = parcBitVector_Create();
* parcBitVector_Set(parcBitVector, 10);
- * assertTrue(parcBitVector_Get(parcBitVector, 10) == 1, "Vector should have been set");
+ * parcAssertTrue(parcBitVector_Get(parcBitVector, 10) == 1, "Vector should have been set");
* }
* @endcode
*
@@ -175,7 +175,7 @@ int parcBitVector_Get(const PARCBitVector *parcBitVector, unsigned bit);
* {
* PARCBitVector *parcBitVector = parcBitVector_Create();
* parcBitVector_Set(parcBitVector, 10);
- * assertTrue(parcBitVector_Get(parcBitVector, 10) == 1, "Vector should have been set");
+ * parcAssertTrue(parcBitVector_Get(parcBitVector, 10) == 1, "Vector should have been set");
* }
* @endcode
*
@@ -196,7 +196,7 @@ void parcBitVector_Set(PARCBitVector *parcBitVector, unsigned bit);
* parcBitVector_Set(parcBitVector, 0);
*
* parcBitVector_RightShift(parcBitVector, 1);
- * assertTrue(parcBitVector_FirstBitSet(parcBitVector) == 1,
+ * parcAssertTrue(parcBitVector_FirstBitSet(parcBitVector) == 1,
* "First vector element should have moved up");
*
* parcBitVector_Release(&parcBitVector);
@@ -221,7 +221,7 @@ PARCBitVector *parcBitVector_RightShift(PARCBitVector *parcBitVector, size_t rig
* parcBitVector_Set(parcBitVector, 0);
*
* parcBitVector_LeftShift(parcBitVector, 1);
- * assertTrue(parcBitVector_NumberOfBitsSet(parcBitVector) == 1,
+ * parcAssertTrue(parcBitVector_NumberOfBitsSet(parcBitVector) == 1,
* "First vector element should have rolled off");
*
* parcBitVector_Release(&parcBitVector);
@@ -247,7 +247,7 @@ PARCBitVector *parcBitVector_LeftShift(PARCBitVector *parcBitVector, size_t left
* parcBitVector_Set(andVector, 11);
*
* PARCBitVector *result = parcBitVector_And(parcBitVector, andVector);
- * assertTrue(parcBitVector_NumberOfBitsSet(result) == 0, "Vector should have been empty");
+ * parcAssertTrue(parcBitVector_NumberOfBitsSet(result) == 0, "Vector should have been empty");
*
* parcBitVector_Release(&parcBitVector);
* parcBitVector_Release(&andVector);
@@ -274,7 +274,7 @@ PARCBitVector *parcBitVector_And(const PARCBitVector *a, const PARCBitVector *b)
* parcBitVector_Set(orVector, 11);
*
* PARCBitVector *result = parcBitVector_Or(parcBitVector, orVector);
- * assertTrue(parcBitVector_NumberOfBitsSet(result) == 2, "Vector should have been set");
+ * parcAssertTrue(parcBitVector_NumberOfBitsSet(result) == 2, "Vector should have been set");
*
* parcBitVector_Release(&parcBitVector);
* parcBitVector_Release(&orVector);
@@ -298,7 +298,7 @@ PARCBitVector *parcBitVector_Or(const PARCBitVector *a, const PARCBitVector *b);
* PARCBitVector *bitsToSet = parcBitVector_Create();
* parcBitVector_Set(bitsToSet, 10);
* parcBitVector_SetVector(parcBitVector, bitsToSet);
- * assertTrue(parcBitVector_Get(parcBitVector, 10) == 1, "Vector should have been set");
+ * parcAssertTrue(parcBitVector_Get(parcBitVector, 10) == 1, "Vector should have been set");
* }
* @endcode
*
@@ -317,7 +317,7 @@ void parcBitVector_SetVector(PARCBitVector *parcBitVector, const PARCBitVector *
* parcBitVector_Set(parcBitVector, 10);
* parcBitVector_Set(parcBitVector, 42);
* parcBitVector_Reset(parcBitVector);
- * assertTrue(parcBitVector_NumberOfBitsSet(parcBitVector) == 0, "Vector should have 0 bits set");
+ * parcAssertTrue(parcBitVector_NumberOfBitsSet(parcBitVector) == 0, "Vector should have 0 bits set");
* }
* @endcode
*
@@ -335,9 +335,9 @@ void parcBitVector_Reset(PARCBitVector *parcBitVector);
* {
* PARCBitVector *parcBitVector = parcBitVector_Create();
* parcBitVector_Set(parcBitVector, 10);
- * assertTrue(parcBitVector_Get(parcBitVector, 10) == 1, "Vector should have been set");
+ * parcAssertTrue(parcBitVector_Get(parcBitVector, 10) == 1, "Vector should have been set");
* parcBitVector_Clear(parcBitVector, 10);
- * assertTrue(parcBitVector_Get(parcBitVector, 10) == 0, "Vector should have been cleared");
+ * parcAssertTrue(parcBitVector_Get(parcBitVector, 10) == 0, "Vector should have been cleared");
* }
* @endcode
*
@@ -358,7 +358,7 @@ void parcBitVector_Clear(PARCBitVector *parcBitVector, unsigned bit);
* PARCBitVector *bitsToClear = parcBitVector_Create();
* parcBitVector_Set(bitsToClear, 10);
* parcBitVector_SetVector(parcBitVector, bitsToClear);
- * assertTrue(parcBitVector_Get(parcBitVector, 10) == 0, "Vector should have been cleared");
+ * parcAssertTrue(parcBitVector_Get(parcBitVector, 10) == 0, "Vector should have been cleared");
* }
* @endcode
*
@@ -376,7 +376,7 @@ void parcBitVector_ClearVector(PARCBitVector *parcBitVector, const PARCBitVector
* {
* PARCBitVector *parcBitVector = parcBitVector_Create();
* parcBitVector_Set(parcBitVector, 10);
- * assertTrue(parcBitVector_NumberOfBitsSet(parcBitVector) == 1, "One bit should have been set");
+ * parcAssertTrue(parcBitVector_NumberOfBitsSet(parcBitVector) == 1, "One bit should have been set");
* }
* @endcode
*
@@ -396,8 +396,8 @@ unsigned parcBitVector_NumberOfBitsSet(const PARCBitVector *parcBitVector);
* PARCBitVector *parcBitVector = parcBitVector_Create();
* parcBitVector_Set(parcBitVector, 10);
* parcBitVector_Set(parcBitVector, 12);
- * assertTrue(parcBitVector_NextBitSet(parcBitVector, 0) == 10, "Bit 10 should have been found first");
- * assertTrue(parcBitVector_NextBitSet(parcBitVector, 11) == 12, "Bit 12 should have been found next");
+ * parcAssertTrue(parcBitVector_NextBitSet(parcBitVector, 0) == 10, "Bit 10 should have been found first");
+ * parcAssertTrue(parcBitVector_NextBitSet(parcBitVector, 11) == 12, "Bit 12 should have been found next");
* }
* @endcode
*
diff --git a/libparc/parc/algol/parc_Buffer.c b/libparc/parc/algol/parc_Buffer.c
index b2ca3577..20520f9c 100755
--- a/libparc/parc/algol/parc_Buffer.c
+++ b/libparc/parc/algol/parc_Buffer.c
@@ -18,8 +18,7 @@
#include <config.h>
#include <ctype.h>
-#include <LongBow/runtime.h>
-#include <LongBow/debugging.h>
+#include <parc/assert/parc_Assert.h>
#include <parc/algol/parc_Object.h>
#include <parc/algol/parc_Buffer.h>
@@ -65,8 +64,8 @@ _markIsDiscarded(const PARCBuffer *buffer)
static inline void
_trapIfIndexExceedsLimit(const PARCBuffer *buffer, const size_t index)
{
- trapOutOfBoundsIf(index > buffer->limit, "PARCBuffer limit at %zd, attempted to access at %zd",
- parcBuffer_Limit(buffer), index);
+ //parcTrapOutOfBoundsIf(index > buffer->limit, "PARCBuffer limit at %zd, attempted to access at %zd",
+ // parcBuffer_Limit(buffer), index);
}
static inline void
@@ -96,15 +95,15 @@ static inline void
_assertInvariants(const PARCBuffer *buffer)
{
// 0 <= mark <= position <= limit <= capacity
- assertTrue(0 <= buffer->mark,
+ parcAssertTrue(0 <= buffer->mark,
"Expected 0 <= mark (%zd)", buffer->mark);
- assertTrue(_markIsDiscarded(buffer) || buffer->mark <= buffer->position,
+ parcAssertTrue(_markIsDiscarded(buffer) || buffer->mark <= buffer->position,
"Expected mark (%zd) <= position (%zd)", buffer->mark, buffer->position);
- assertTrue(buffer->position <= buffer->limit,
+ parcAssertTrue(buffer->position <= buffer->limit,
"Expected position (%zd) <= limit (%zd)", buffer->position, buffer->limit);
- assertTrue(buffer->limit <= buffer->capacity,
+ parcAssertTrue(buffer->limit <= buffer->capacity,
"Expected limit (%zd) <= capacity (%zd)", buffer->limit, buffer->capacity);
- assertTrue((buffer->arrayOffset + buffer->capacity) <= parcByteArray_Capacity(buffer->array),
+ parcAssertTrue((buffer->arrayOffset + buffer->capacity) <= parcByteArray_Capacity(buffer->array),
"Expected (%zd + %zd) <= %zd",
buffer->arrayOffset, buffer->capacity, parcByteArray_Capacity(buffer->array));
}
@@ -201,7 +200,7 @@ parcBuffer_AssertValid(const PARCBuffer *buffer)
{
char *explanation = _parcBuffer_CheckValidity(buffer);
- trapIllegalValueIf(explanation != NULL, "PARCBuffer@%p %s.", (void *) buffer, explanation);
+ parcTrapIllegalValueIf(explanation != NULL, "PARCBuffer@%p %s.", (void *) buffer, explanation);
}
bool
@@ -450,7 +449,7 @@ parcBuffer_ParseHexString(const char *hexString)
PARCBuffer *
parcBuffer_CreateFromArray(const void *bytes, const size_t length)
{
- assertTrue(length == 0 || bytes != NULL,
+ parcAssertTrue(length == 0 || bytes != NULL,
"If the byte array is NULL, then length MUST be zero.");
PARCBuffer *result = parcBuffer_Allocate(length);
@@ -587,7 +586,7 @@ parcBuffer_Reset(PARCBuffer *buffer)
{
parcBuffer_OptionalAssertValid(buffer);
- assertFalse(_markIsDiscarded(buffer),
+ parcAssertFalse(_markIsDiscarded(buffer),
"The mark has not been set");
buffer->position = buffer->mark;
@@ -618,7 +617,7 @@ PARCBuffer *
parcBuffer_SetLimit(PARCBuffer *buffer, size_t newLimit)
{
parcBuffer_OptionalAssertValid(buffer);
- assertTrue(newLimit <= parcBuffer_Capacity(buffer),
+ parcAssertTrue(newLimit <= parcBuffer_Capacity(buffer),
"new limit cannot be larger than the capacity");
if (_markIsDiscarded(buffer)) {
@@ -666,7 +665,7 @@ parcBuffer_SetPosition(PARCBuffer *buffer, size_t newPosition)
{
parcBuffer_OptionalAssertValid(buffer);
- assertFalse(newPosition > buffer->limit,
+ parcAssertFalse(newPosition > buffer->limit,
"new position cannot be greater the buffer's limit");
buffer->position = newPosition;
@@ -808,7 +807,7 @@ PARCBuffer *
parcBuffer_PutUint8(PARCBuffer *buffer, uint8_t value)
{
parcBuffer_OptionalAssertValid(buffer);
- assertTrue(parcBuffer_Remaining(buffer) >= 1,
+ parcAssertTrue(parcBuffer_Remaining(buffer) >= 1,
"Buffer overflow");
parcByteArray_PutByte(buffer->array, _effectivePosition(buffer), value);
@@ -819,7 +818,7 @@ parcBuffer_PutUint8(PARCBuffer *buffer, uint8_t value)
PARCBuffer *
parcBuffer_PutUint16(PARCBuffer *buffer, uint16_t value)
{
- assertTrue(parcBuffer_Remaining(buffer) >= sizeof(uint16_t),
+ parcAssertTrue(parcBuffer_Remaining(buffer) >= sizeof(uint16_t),
"Buffer overflow");
parcBuffer_PutUint8(buffer, (value >> 8) & 0xFF);
@@ -830,7 +829,7 @@ parcBuffer_PutUint16(PARCBuffer *buffer, uint16_t value)
PARCBuffer *
parcBuffer_PutUint32(PARCBuffer *buffer, uint32_t value)
{
- assertTrue(parcBuffer_Remaining(buffer) >= sizeof(uint32_t),
+ parcAssertTrue(parcBuffer_Remaining(buffer) >= sizeof(uint32_t),
"Buffer overflow");
for (int i = sizeof(uint32_t) - 1; i > 0; i--) {
uint8_t b = value >> (i * 8) & 0xFF;
@@ -843,7 +842,7 @@ parcBuffer_PutUint32(PARCBuffer *buffer, uint32_t value)
PARCBuffer *
parcBuffer_PutUint64(PARCBuffer *buffer, uint64_t value)
{
- assertTrue(parcBuffer_Remaining(buffer) >= sizeof(uint64_t),
+ parcAssertTrue(parcBuffer_Remaining(buffer) >= sizeof(uint64_t),
"Buffer overflow");
for (int i = sizeof(uint64_t) - 1; i > 0; i--) {
uint8_t b = value >> (i * 8) & 0xFF;
@@ -857,7 +856,7 @@ PARCBuffer *
parcBuffer_PutAtIndex(PARCBuffer *buffer, size_t index, uint8_t value)
{
parcBuffer_OptionalAssertValid(buffer);
- assertTrue(_effectiveIndex(buffer, index) < parcBuffer_Limit(buffer), "Buffer overflow");
+ parcAssertTrue(_effectiveIndex(buffer, index) < parcBuffer_Limit(buffer), "Buffer overflow");
parcByteArray_PutByte(buffer->array, _effectiveIndex(buffer, index), value);
return buffer;
@@ -867,7 +866,7 @@ PARCBuffer *
parcBuffer_PutArray(PARCBuffer *buffer, size_t arrayLength, const uint8_t array[arrayLength])
{
parcBuffer_OptionalAssertValid(buffer);
- assertTrue(parcBuffer_Remaining(buffer) >= arrayLength,
+ parcAssertTrue(parcBuffer_Remaining(buffer) >= arrayLength,
"Buffer overflow");
parcByteArray_PutBytes(buffer->array, _effectivePosition(buffer), arrayLength, array);
@@ -884,7 +883,7 @@ PARCBuffer *
parcBuffer_PutBuffer(PARCBuffer *result, const PARCBuffer *buffer)
{
parcBuffer_OptionalAssertValid(buffer);
- assertTrue(parcBuffer_Remaining(result) >= parcBuffer_Remaining(buffer),
+ parcAssertTrue(parcBuffer_Remaining(result) >= parcBuffer_Remaining(buffer),
"Buffer overflow. %zd bytes remaining, %zd required.", parcBuffer_Remaining(result), parcBuffer_Remaining(buffer));
size_t length = parcBuffer_Remaining(buffer);
@@ -923,7 +922,7 @@ parcBuffer_ToString(const PARCBuffer *buffer)
char *result = parcMemory_Allocate(remaining + 1);
if (remaining > 0) {
- assertNotNull(result, "parcMemory_Allocate returned NULL");
+ parcAssertNotNull(result, "parcMemory_Allocate returned NULL");
if (result != NULL) {
memcpy(result, parcBuffer_Overlay((PARCBuffer *) buffer, 0), remaining);
}
@@ -965,7 +964,7 @@ parcBuffer_ToHexString(const PARCBuffer *buffer)
// Hopefully length is less than (2^(sizeof(size_t)*8) / 2)
char *result = parcMemory_AllocateAndClear((length * 2) + 1);
- assertNotNull(result, "parcMemory_AllocateAndClear(%zu) returned NULL", (length * 2) + 1);
+ parcAssertNotNull(result, "parcMemory_AllocateAndClear(%zu) returned NULL", (length * 2) + 1);
for (size_t i = 0; i < length; i++) {
unsigned char byte = parcBuffer_GetAtIndex(buffer, i);
diff --git a/libparc/parc/algol/parc_Buffer.h b/libparc/parc/algol/parc_Buffer.h
index 2c7f56fd..665019db 100644
--- a/libparc/parc/algol/parc_Buffer.h
+++ b/libparc/parc/algol/parc_Buffer.h
@@ -140,7 +140,7 @@ extern parcObjectDescriptor_Declaration(PARCBuffer);
/**
* Assert that an instance of `PARCBuffer` is valid.
*
- * If the instance is not valid, terminate via `trapIllegalValue()`
+ * If the instance is not valid, terminate via `parcTrapIllegalValue()`
*
* Valid means the internal state of the type is consistent with its required current or future behaviour.
* This may include the validation of internal instances of types.
diff --git a/libparc/parc/algol/parc_BufferComposer.c b/libparc/parc/algol/parc_BufferComposer.c
index 20b7ecee..30e23acf 100755
--- a/libparc/parc/algol/parc_BufferComposer.c
+++ b/libparc/parc/algol/parc_BufferComposer.c
@@ -18,7 +18,7 @@
#include <config.h>
-#include <LongBow/runtime.h>
+#include <parc/assert/parc_Assert.h>
#include <stdlib.h>
#include <stdarg.h>
@@ -91,8 +91,8 @@ _ensureRemaining(PARCBufferComposer *composer, size_t required)
void
parcBufferComposer_AssertValid(const PARCBufferComposer *composer)
{
- trapIllegalValueIf(composer == NULL, "Parameter must be a non-null pointer to a valid PARCBufferComposer.");
- trapIllegalValueIf(composer->incrementHeuristic < sizeof(void *), "Heuristic cannot be < sizeof(void *) (%zd), actual %zd", sizeof(void *), composer->incrementHeuristic);
+ parcTrapIllegalValueIf(composer == NULL, "Parameter must be a non-null pointer to a valid PARCBufferComposer.");
+ parcTrapIllegalValueIf(composer->incrementHeuristic < sizeof(void *), "Heuristic cannot be < sizeof(void *) (%zd), actual %zd", sizeof(void *), composer->incrementHeuristic);
}
PARCBufferComposer *
@@ -250,7 +250,7 @@ parcBufferComposer_Format(PARCBufferComposer *composer, const char *format, ...)
va_start(ap, format);
char *cString;
ssize_t written = vasprintf(&cString, format, ap);
- assertTrue(written >= 0, "Got error from vasprintf");
+ parcAssertTrue(written >= 0, "Got error from vasprintf");
va_end(ap);
parcBufferComposer_PutString(composer, cString);
diff --git a/libparc/parc/algol/parc_BufferComposer.h b/libparc/parc/algol/parc_BufferComposer.h
index f45aeb8e..25c69258 100755
--- a/libparc/parc/algol/parc_BufferComposer.h
+++ b/libparc/parc/algol/parc_BufferComposer.h
@@ -83,7 +83,7 @@ PARCBufferComposer *parcBufferComposer_Allocate(size_t length);
/**
* Assert that an instance of `PARCBufferComposer` is valid.
*
- * If the instance is not valid, terminate via `trapIllegalValue()`.
+ * If the instance is not valid, terminate via `parcTrapIllegalValue()`.
*
* Valid means the internal state of the type is consistent with its required current or future behaviour.
* This may include the validation of internal instances of types.
diff --git a/libparc/parc/algol/parc_BufferDictionary.c b/libparc/parc/algol/parc_BufferDictionary.c
index 56ed800a..c2438129 100755
--- a/libparc/parc/algol/parc_BufferDictionary.c
+++ b/libparc/parc/algol/parc_BufferDictionary.c
@@ -21,7 +21,7 @@
*/
#include <config.h>
-#include <LongBow/runtime.h>
+#include <parc/assert/parc_Assert.h>
#include <parc/algol/parc_BufferDictionary.h>
@@ -73,8 +73,8 @@ _init(PARCBufferDictionary *result)
static void
_destroy(PARCBufferDictionary **dictionaryPtr)
{
- assertNotNull(dictionaryPtr, "Double pointer dictionaryPtr must be non-NULL");
- assertNotNull(*dictionaryPtr, "Double pointer dictionaryPtr must dereference to non-NULL");
+ parcAssertNotNull(dictionaryPtr, "Double pointer dictionaryPtr must be non-NULL");
+ parcAssertNotNull(*dictionaryPtr, "Double pointer dictionaryPtr must dereference to non-NULL");
PARCBufferDictionary *dict = *dictionaryPtr;
@@ -102,9 +102,9 @@ parcObject_ImplementRelease(parcBufferDictionary, PARCBufferDictionary);
PARCBuffer *
parcBufferDictionary_Put(PARCBufferDictionary *dictionary, PARCBuffer *key, PARCBuffer *value)
{
- assertNotNull(dictionary, "Parameter dictionary must be non-NULL");
- assertNotNull(key, "Parameter key must be non-NULL");
- assertNotNull(value, "Parameter value must be non-NULL");
+ parcAssertNotNull(dictionary, "Parameter dictionary must be non-NULL");
+ parcAssertNotNull(key, "Parameter key must be non-NULL");
+ parcAssertNotNull(value, "Parameter value must be non-NULL");
PARCBuffer *oldValue = NULL;
@@ -126,8 +126,8 @@ parcBufferDictionary_Put(PARCBufferDictionary *dictionary, PARCBuffer *key, PARC
PARCBuffer *
parcBufferDictionary_Get(PARCBufferDictionary *dictionary, PARCBuffer *key)
{
- assertNotNull(dictionary, "Parameter dictionary must be non-NULL");
- assertNotNull(key, "Parameter key must be non-NULL");
+ parcAssertNotNull(dictionary, "Parameter dictionary must be non-NULL");
+ parcAssertNotNull(key, "Parameter key must be non-NULL");
return parcHashCodeTable_Get(dictionary->hashtable, key);
}
@@ -135,8 +135,8 @@ parcBufferDictionary_Get(PARCBufferDictionary *dictionary, PARCBuffer *key)
PARCBuffer *
parcBufferDictionary_Remove(PARCBufferDictionary *dictionary, PARCBuffer *key)
{
- assertNotNull(dictionary, "Parameter dictionary must be non-NULL");
- assertNotNull(key, "Parameter key must be non-NULL");
+ parcAssertNotNull(dictionary, "Parameter dictionary must be non-NULL");
+ parcAssertNotNull(key, "Parameter key must be non-NULL");
// parcHashCodeTable_Del will free the referece, to make a copy of it
PARCBuffer *original = (PARCBuffer *) parcHashCodeTable_Get(dictionary->hashtable, key);
diff --git a/libparc/parc/algol/parc_ByteArray.c b/libparc/parc/algol/parc_ByteArray.c
index 762421bd..1d81d211 100644
--- a/libparc/parc/algol/parc_ByteArray.c
+++ b/libparc/parc/algol/parc_ByteArray.c
@@ -21,7 +21,7 @@
#include <ctype.h>
#include <string.h>
-#include <LongBow/runtime.h>
+#include <parc/assert/parc_Assert.h>
#include <parc/algol/parc_ByteArray.h>
#include <parc/algol/parc_Memory.h>
@@ -39,7 +39,7 @@ struct parc_byte_array {
static inline void
_trapIfOutOfBounds(const PARCByteArray *array, const size_t index)
{
- trapOutOfBoundsIf(index >= array->length, "parcByteArray index %zd exceeds the length %zd", index, array->length);
+ parcTrapOutOfBoundsIf(index >= array->length, "parcByteArray index %zd exceeds the length %zd", index, array->length);
}
static bool
@@ -66,7 +66,7 @@ parcObject_Override(PARCByteArray, PARCObject,
void
parcByteArray_AssertValid(const PARCByteArray *instance)
{
- trapInvalidValueIf(parcByteArray_IsValid(instance) == false,
+ parcTrapInvalidValueIf(parcByteArray_IsValid(instance) == false,
"PARCByteArray instance is invalid.");
}
@@ -212,12 +212,12 @@ PARCByteArray *
parcByteArray_PutBytes(PARCByteArray *result, size_t offset, size_t length, const uint8_t source[length])
{
parcByteArray_OptionalAssertValid(result);
- trapOutOfBoundsIf(offset > result->length,
+ parcTrapOutOfBoundsIf(offset > result->length,
"The offset (%zd) exeeds the length (%zd) of the PARCByteArray.", offset, result->length);
size_t available = result->length - offset;
- trapOutOfBoundsIf(length > available, "%zd available bytes, %zd required.", available, length);
+ parcTrapOutOfBoundsIf(length > available, "%zd available bytes, %zd required.", available, length);
memcpy(&result->array[offset], source, length);
return result;
@@ -230,7 +230,7 @@ parcByteArray_GetBytes(const PARCByteArray *result, size_t offset, size_t length
size_t available = result->length - offset;
- trapOutOfBoundsIf(length > available, "parcByteArray_CopyOut %zd available bytes, %zd required", available, length);
+ parcTrapOutOfBoundsIf(length > available, "parcByteArray_CopyOut %zd available bytes, %zd required", available, length);
memcpy(array, &result->array[offset], length);
return (PARCByteArray *) result;
diff --git a/libparc/parc/algol/parc_ByteArray.h b/libparc/parc/algol/parc_ByteArray.h
index 98cc970a..c7a26285 100644
--- a/libparc/parc/algol/parc_ByteArray.h
+++ b/libparc/parc/algol/parc_ByteArray.h
@@ -91,7 +91,7 @@ typedef struct parc_byte_array PARCByteArray;
/**
* Assert that an instance of `PARCByteArray` is valid.
*
- * If the instance is not valid, terminate via {@link trapIllegalValue}
+ * If the instance is not valid, terminate via {@link parcTrapIllegalValue}
*
* Valid means the internal state of the type is consistent with its required current or future behaviour.
* This may include the validation of internal instances of types.
@@ -331,7 +331,7 @@ int parcByteArray_Compare(const PARCByteArray *a, const PARCByteArray *b);
*
* @return The given `PARCByteArray` pointer
*
- * @throws SIGABRT `trapOutOfBounds` if the underlying `PARCByteArray` is not large enough
+ * @throws SIGABRT `parcTrapOutOfBounds` if the underlying `PARCByteArray` is not large enough
*
* Example:
* @code
diff --git a/libparc/parc/algol/parc_Deque.c b/libparc/parc/algol/parc_Deque.c
index 4793b032..84808766 100644
--- a/libparc/parc/algol/parc_Deque.c
+++ b/libparc/parc/algol/parc_Deque.c
@@ -17,7 +17,7 @@
*/
#include <config.h>
-#include <LongBow/runtime.h>
+#include <parc/assert/parc_Assert.h>
#include <stdio.h>
#include <sys/queue.h>
@@ -104,27 +104,27 @@ _parcDequeNode_Destroy(PARCDeque *deque __attribute__((unused)), struct parc_deq
static void
_parcDequeNode_AssertInvariants(struct parc_deque_node *node)
{
- assertNotNull(node, "Expected non-null node pointer.");
+ parcAssertNotNull(node, "Expected non-null node pointer.");
if (node->next != NULL) {
- assertTrue(node->next->previous == node, "Expected next node to point to this node.");
+ parcAssertTrue(node->next->previous == node, "Expected next node to point to this node.");
}
if (node->previous != NULL) {
- assertTrue(node->previous->next == node, "Expected previous node to point to this node.");
+ parcAssertTrue(node->previous->next == node, "Expected previous node to point to this node.");
}
}
static void
_parcDeque_AssertInvariants(const PARCDeque *deque)
{
- assertNotNull(deque, "Parameter cannot be null.");
+ parcAssertNotNull(deque, "Parameter cannot be null.");
if (deque->head != NULL) {
- assertTrue(deque->size != 0, "PARCDeque head is not-null, but size is zero.");
- assertNotNull(deque->tail, "PARCDeque head is not-null, but tail is null.");
+ parcAssertTrue(deque->size != 0, "PARCDeque head is not-null, but size is zero.");
+ parcAssertNotNull(deque->tail, "PARCDeque head is not-null, but tail is null.");
_parcDequeNode_AssertInvariants(deque->head);
_parcDequeNode_AssertInvariants(deque->tail);
} else {
- assertNull(deque->tail, "PARCDeque head is null, but tail is not null.");
- assertTrue(deque->size == 0, "PARCDeque head is null, but size is not zero.");
+ parcAssertNull(deque->tail, "PARCDeque head is null, but tail is not null.");
+ parcAssertTrue(deque->size == 0, "PARCDeque head is null, but size is not zero.");
}
}
@@ -159,7 +159,7 @@ _parcDequeNode_Next(PARCDeque *deque __attribute__((unused)), const struct parc_
if (node == NULL) {
return deque->head;
}
- trapOutOfBoundsIf(node->next == NULL, "No more elements.");
+ parcTrapOutOfBoundsIf(node->next == NULL, "No more elements.");
return node->next;
}
@@ -386,7 +386,7 @@ void *
parcDeque_GetAtIndex(const PARCDeque *deque, size_t index)
{
if (index > (parcDeque_Size(deque) - 1)) {
- trapOutOfBounds(index, "[0, %zd]", parcDeque_Size(deque) - 1);
+ parcTrapOutOfBounds(index, "[0, %zd]", parcDeque_Size(deque) - 1);
}
struct parc_deque_node *node = deque->head;
while (index--) {
diff --git a/libparc/parc/algol/parc_Deque.h b/libparc/parc/algol/parc_Deque.h
index 3e11e845..57dd39b1 100755
--- a/libparc/parc/algol/parc_Deque.h
+++ b/libparc/parc/algol/parc_Deque.h
@@ -282,7 +282,7 @@ bool parcDeque_IsEmpty(const PARCDeque *deque);
* @param [in] deque A pointer to a `PARCDeque` instance.
* @param [in] index The index of the element to be retrieved.
*
- * @throws `trapOutOfBounds`
+ * @throws `parcTrapOutOfBounds`
*
* Example:
* @code
diff --git a/libparc/parc/algol/parc_Dictionary.c b/libparc/parc/algol/parc_Dictionary.c
index 628b08e2..a7a59de6 100755
--- a/libparc/parc/algol/parc_Dictionary.c
+++ b/libparc/parc/algol/parc_Dictionary.c
@@ -18,7 +18,7 @@
#include <config.h>
-#include <LongBow/runtime.h>
+#include <parc/assert/parc_Assert.h>
#include <string.h>
@@ -43,10 +43,10 @@ parcDictionary_Create(PARCDictionary_CompareKey keyCompareFunction,
PARCDictionary_ValueEquals valueEqualsFunction,
PARCDictionary_FreeValue valueFreeFunction)
{
- assertNotNull(keyCompareFunction, "KeyCompareFunction can't be null");
- assertNotNull(keyHashFunction, "KeyHashFunction can't be null");
+ parcAssertNotNull(keyCompareFunction, "KeyCompareFunction can't be null");
+ parcAssertNotNull(keyHashFunction, "KeyHashFunction can't be null");
PARCDictionary *dictionary = parcMemory_Allocate(sizeof(PARCDictionary));
- assertNotNull(dictionary, "parcMemory_Allocate(%zu) returned NULL", sizeof(PARCDictionary));
+ parcAssertNotNull(dictionary, "parcMemory_Allocate(%zu) returned NULL", sizeof(PARCDictionary));
dictionary->keyCompareFunction = keyCompareFunction;
dictionary->keyHashFunction = keyHashFunction;
dictionary->keyFreeFunction = keyFreeFunction;
@@ -65,8 +65,8 @@ parcDictionary_Create(PARCDictionary_CompareKey keyCompareFunction,
void
parcDictionary_Destroy(PARCDictionary **dictionaryPointer)
{
- assertNotNull(dictionaryPointer, "Pointer to dictionary pointer can't be NULL");
- assertNotNull(*dictionaryPointer, "Pointer to dictionary can't be NULL");
+ parcAssertNotNull(dictionaryPointer, "Pointer to dictionary pointer can't be NULL");
+ parcAssertNotNull(*dictionaryPointer, "Pointer to dictionary can't be NULL");
parcTreeRedBlack_Destroy(&((*dictionaryPointer)->tree));
parcMemory_Deallocate((void **) dictionaryPointer);
*dictionaryPointer = NULL;
@@ -75,60 +75,60 @@ parcDictionary_Destroy(PARCDictionary **dictionaryPointer)
void
parcDictionary_SetValue(PARCDictionary *dictionary, void *key, void *value)
{
- assertNotNull(dictionary, "dictionary pointer can't be NULL");
- assertNotNull(key, "Key pointer can't be NULL");
+ parcAssertNotNull(dictionary, "dictionary pointer can't be NULL");
+ parcAssertNotNull(key, "Key pointer can't be NULL");
parcTreeRedBlack_Insert(dictionary->tree, key, value);
}
void *
parcDictionary_GetValue(PARCDictionary *dictionary, const void *key)
{
- assertNotNull(dictionary, "dictionary pointer can't be NULL");
- assertNotNull(key, "Key pointer can't be NULL");
+ parcAssertNotNull(dictionary, "dictionary pointer can't be NULL");
+ parcAssertNotNull(key, "Key pointer can't be NULL");
return parcTreeRedBlack_Get(dictionary->tree, key);
}
void *
parcDictionary_RemoveValue(PARCDictionary *dictionary, const void *key)
{
- assertNotNull(dictionary, "dictionary pointer can't be NULL");
- assertNotNull(key, "Key pointer can't be NULL");
+ parcAssertNotNull(dictionary, "dictionary pointer can't be NULL");
+ parcAssertNotNull(key, "Key pointer can't be NULL");
return parcTreeRedBlack_Remove(dictionary->tree, key);
}
void
parcDictionary_RemoveAndDestroyValue(PARCDictionary *dictionary, const void *key)
{
- assertNotNull(dictionary, "dictionary pointer can't be NULL");
- assertNotNull(key, "Key pointer can't be NULL");
+ parcAssertNotNull(dictionary, "dictionary pointer can't be NULL");
+ parcAssertNotNull(key, "Key pointer can't be NULL");
parcTreeRedBlack_RemoveAndDestroy(dictionary->tree, key);
}
PARCArrayList *
parcDictionary_Keys(const PARCDictionary *dictionary)
{
- assertNotNull(dictionary, "dictionary pointer can't be NULL");
+ parcAssertNotNull(dictionary, "dictionary pointer can't be NULL");
return parcTreeRedBlack_Keys(dictionary->tree);
}
PARCArrayList *
parcDictionary_Values(const PARCDictionary *dictionary)
{
- assertNotNull(dictionary, "dictionary pointer can't be NULL");
+ parcAssertNotNull(dictionary, "dictionary pointer can't be NULL");
return parcTreeRedBlack_Values(dictionary->tree);
}
size_t
parcDictionary_Size(const PARCDictionary *dictionary)
{
- assertNotNull(dictionary, "dictionary pointer can't be NULL");
+ parcAssertNotNull(dictionary, "dictionary pointer can't be NULL");
return parcTreeRedBlack_Size(dictionary->tree);
}
int
parcDictionary_Equals(const PARCDictionary *dictionary1, const PARCDictionary *dictionary2)
{
- assertNotNull(dictionary1, "dictionary pointer can't be NULL");
- assertNotNull(dictionary2, "dictionary pointer can't be NULL");
+ parcAssertNotNull(dictionary1, "dictionary pointer can't be NULL");
+ parcAssertNotNull(dictionary2, "dictionary pointer can't be NULL");
return parcTreeRedBlack_Equals(dictionary1->tree, dictionary2->tree);
}
diff --git a/libparc/parc/algol/parc_DisplayIndented.c b/libparc/parc/algol/parc_DisplayIndented.c
index 5e043c15..39e1d76e 100755
--- a/libparc/parc/algol/parc_DisplayIndented.c
+++ b/libparc/parc/algol/parc_DisplayIndented.c
@@ -17,7 +17,7 @@
*/
#include <config.h>
-#include <LongBow/runtime.h>
+#include <parc/assert/parc_Assert.h>
#include <stdio.h>
#include <stdlib.h>
@@ -39,7 +39,7 @@ _indent(int indentation)
if (indentation > 0) {
result = write(1, _spaces, indentation * _indentationFactor);
- assertTrue(result == (indentation * _indentationFactor),
+ parcAssertTrue(result == (indentation * _indentationFactor),
"Write(2) failed to write %zd bytes.", indentation * _indentationFactor);
}
return result;
@@ -55,11 +55,11 @@ _parcDisplayIndented_Print(int indentation, char *string)
_indent(indentation);
if (end != NULL) {
ssize_t nwritten = write(1, start, end - start + 1);
- assertTrue(nwritten >= 0, "Error calling write");
+ parcAssertTrue(nwritten >= 0, "Error calling write");
start = end + 1;
} else {
ssize_t nwritten = write(1, start, strlen(start));
- assertTrue(nwritten >= 0, "Error calling write");
+ parcAssertTrue(nwritten >= 0, "Error calling write");
break;
}
end = strchr(start, '\n');
@@ -74,14 +74,14 @@ parcDisplayIndented_PrintLine(int indentation, const char *format, ...)
char *cString;
int length = vasprintf(&cString, format, ap);
- assertTrue(length >= 0, "Error in vasprintf");
+ parcAssertTrue(length >= 0, "Error in vasprintf");
va_end(ap);
_parcDisplayIndented_Print(indentation, cString);
ssize_t nwritten = write(1, "\n", 1);
- assertTrue(nwritten >= 0, "Error calling write");
+ parcAssertTrue(nwritten >= 0, "Error calling write");
free(cString);
}
@@ -98,7 +98,7 @@ parcDisplayIndented_PrintMemory(int indentation, size_t length, const char memor
char *cString;
for (size_t offset = 0; offset < length; /**/) {
int nwritten = asprintf(&cString, "%p=[", &memory[offset]);
- assertTrue(nwritten >= 0, "Error calling asprintf");
+ parcAssertTrue(nwritten >= 0, "Error calling asprintf");
_parcDisplayIndented_Print(indentation, cString);
free(cString);
diff --git a/libparc/parc/algol/parc_Event.c b/libparc/parc/algol/parc_Event.c
index 0a8391aa..1621edac 100755
--- a/libparc/parc/algol/parc_Event.c
+++ b/libparc/parc/algol/parc_Event.c
@@ -17,7 +17,7 @@
*/
#include <config.h>
-#include <LongBow/runtime.h>
+#include <parc/assert/parc_Assert.h>
#include "internal_parc_Event.h"
#include <parc/algol/parc_EventScheduler.h>
@@ -70,7 +70,7 @@ PARCEvent *
parcEvent_Create(PARCEventScheduler *parcEventScheduler, int fd, PARCEventType flags, PARCEvent_Callback *callback, void *callbackArgs)
{
PARCEvent *parcEvent = parcMemory_Allocate(sizeof(PARCEvent));
- assertNotNull(parcEvent, "parcMemory_Allocate(%zu) returned NULL", sizeof(PARCEvent));
+ parcAssertNotNull(parcEvent, "parcMemory_Allocate(%zu) returned NULL", sizeof(PARCEvent));
parcEvent->parcEventScheduler = parcEventScheduler;
parcEvent->callback = callback;
@@ -78,7 +78,7 @@ parcEvent_Create(PARCEventScheduler *parcEventScheduler, int fd, PARCEventType f
parcEvent->event = event_new(parcEventScheduler_GetEvBase(parcEventScheduler), fd,
internal_PARCEventType_to_libevent_type(flags), _parc_event_callback, parcEvent);
- assertNotNull(parcEvent->event, "Could not create a new event!");
+ parcAssertNotNull(parcEvent->event, "Could not create a new event!");
parcEvent_LogDebug(parcEvent,
"parcEvent_Create(base=%p,fd=%x,events=%x,cb=%p,args=%p)\n",
@@ -91,7 +91,7 @@ int
parcEvent_Start(PARCEvent *parcEvent)
{
parcEvent_LogDebug(parcEvent, "parcEvent_Start(%p)\n", parcEvent);
- assertNotNull(parcEvent, "parcEvent_Start must be passed a valid event!");
+ parcAssertNotNull(parcEvent, "parcEvent_Start must be passed a valid event!");
int result = event_add(parcEvent->event, NULL);
return result;
@@ -101,7 +101,7 @@ int
parcEvent_Stop(PARCEvent *parcEvent)
{
parcEvent_LogDebug(parcEvent, "parcEvent_Stop(%p)\n", parcEvent);
- assertNotNull(parcEvent, "parcEvent_Stop must be passed a valid event!");
+ parcAssertNotNull(parcEvent, "parcEvent_Stop must be passed a valid event!");
int result = event_del(parcEvent->event);
return result;
@@ -111,7 +111,7 @@ int
parcEvent_Poll(PARCEvent *parcEvent, PARCEventType event)
{
parcEvent_LogDebug(parcEvent, "parcEvent_Stop(%p)\n", parcEvent);
- assertNotNull(parcEvent, "parcEvent_Stop must be passed a valid event!");
+ parcAssertNotNull(parcEvent, "parcEvent_Stop must be passed a valid event!");
int result = event_pending(parcEvent->event, event, NULL);
return result;
@@ -121,8 +121,8 @@ void
parcEvent_Destroy(PARCEvent **parcEvent)
{
parcEvent_LogDebug((*parcEvent), "parcEvent_Destroy(%p)\n", *parcEvent);
- assertNotNull(*parcEvent, "parcEvent_Destroy must be passed a valid parcEvent!");
- assertNotNull((*parcEvent)->event, "parcEvent_Destroy passed a null event!");
+ parcAssertNotNull(*parcEvent, "parcEvent_Destroy must be passed a valid parcEvent!");
+ parcAssertNotNull((*parcEvent)->event, "parcEvent_Destroy passed a null event!");
event_free((*parcEvent)->event);
parcMemory_Deallocate((void **) parcEvent);
diff --git a/libparc/parc/algol/parc_EventBuffer.c b/libparc/parc/algol/parc_EventBuffer.c
index 49ba3354..6293680c 100644
--- a/libparc/parc/algol/parc_EventBuffer.c
+++ b/libparc/parc/algol/parc_EventBuffer.c
@@ -17,7 +17,7 @@
*/
#include <config.h>
-#include <LongBow/runtime.h>
+#include <parc/assert/parc_Assert.h>
#include "internal_parc_Event.h"
#include <parc/algol/parc_Event.h>
@@ -55,10 +55,10 @@ parcEventBuffer_Create(void)
{
internal_parc_initializeLibevent();
struct evbuffer *new_evbuffer = evbuffer_new();
- assertNotNull(new_evbuffer, "libevent returned a null evbuffer.\n");
+ parcAssertNotNull(new_evbuffer, "libevent returned a null evbuffer.\n");
PARCEventBuffer *parcEventBuffer = parcMemory_AllocateAndClear(sizeof(PARCEventBuffer));
- assertNotNull(parcEventBuffer, "parcMemory_AllocateAndClear(%zu) returned NULL", sizeof(PARCEventBuffer));
+ parcAssertNotNull(parcEventBuffer, "parcMemory_AllocateAndClear(%zu) returned NULL", sizeof(PARCEventBuffer));
parcEventBuffer->allocated_evbuffer = new_evbuffer;
parcEventBuffer->evbuffer = parcEventBuffer->allocated_evbuffer;
@@ -71,8 +71,8 @@ void
parcEventBuffer_Destroy(PARCEventBuffer **parcEventBuffer)
{
parcEventBuffer_LogDebug((*parcEventBuffer), "parcEventBuffer_Destroy(parcEventBuffer=%p)\n", *parcEventBuffer);
- assertNotNull(parcEventBuffer, "parcEventBuffer_Destroy was passed a null parcEventBuffer pointer\n");
- assertNotNull(*parcEventBuffer, "parcEventBuffer_Destroy was passed a null parcEventBuffer\n");
+ parcAssertNotNull(parcEventBuffer, "parcEventBuffer_Destroy was passed a null parcEventBuffer pointer\n");
+ parcAssertNotNull(*parcEventBuffer, "parcEventBuffer_Destroy was passed a null parcEventBuffer\n");
// Destroy allocated eveventBuffer if it was allocated by us, otherwise it's owned by bufferevent
if ((*parcEventBuffer)->allocated_evbuffer) {
@@ -100,7 +100,7 @@ parcEventBuffer_IsValid(const PARCEventBuffer *eventBuffer)
void
parcEventBuffer_AssertValid(const PARCEventBuffer *eventBuffer)
{
- assertTrue(parcEventBuffer_IsValid(eventBuffer),
+ parcAssertTrue(parcEventBuffer_IsValid(eventBuffer),
"PARCEventBuffer@%p is not valid.", (void *) eventBuffer);
}
@@ -109,7 +109,7 @@ parcEventBuffer_GetLength(PARCEventBuffer *parcEventBuffer)
{
parcEventBuffer_LogDebug(parcEventBuffer, "parcEventBuffer_GetLength(parcEventBuffer=%p)\n", parcEventBuffer);
// parcEventBuffer_OptionalAssertValid(parcEventBuffer);
- assertNotNull(parcEventBuffer, "parcEventBuffer_GetLength was passed a null parcEventBuffer\n");
+ parcAssertNotNull(parcEventBuffer, "parcEventBuffer_GetLength was passed a null parcEventBuffer\n");
if (parcEventBuffer->evbuffer) {
return evbuffer_get_length(parcEventBuffer->evbuffer);
@@ -124,8 +124,8 @@ parcEventBuffer_Pullup(PARCEventBuffer *parcEventBuffer, ssize_t size)
parcEventBuffer_LogDebug(parcEventBuffer, "parcEventBuffer_Pullup(parcEventBuffer=%p,size=%zx)\n", parcEventBuffer, size);
parcEventBuffer_OptionalAssertValid(parcEventBuffer);
-// assertNotNull(parcEventBuffer, "parcEventBuffer_Pullup was passed a null parcEventBuffer\n");
-// assertNotNull(parcEventBuffer->evbuffer, "parcEventBuffer_Pullup was passed a null libevent evbuffer\n");
+// parcAssertNotNull(parcEventBuffer, "parcEventBuffer_Pullup was passed a null parcEventBuffer\n");
+// parcAssertNotNull(parcEventBuffer->evbuffer, "parcEventBuffer_Pullup was passed a null libevent evbuffer\n");
return evbuffer_pullup(parcEventBuffer->evbuffer, (ev_ssize_t) size);
}
@@ -135,10 +135,10 @@ parcEventBuffer_ReadIntoBuffer(PARCEventBuffer *source, PARCEventBuffer *destina
{
parcEventBuffer_OptionalAssertValid(source);
parcEventBuffer_OptionalAssertValid(destination);
-// assertNotNull(source, "parcEventBuffer_ReadIntoBuffer was passed a null source buffer\n");
-// assertNotNull(source->evbuffer, "parcEventBuffer_ReadIntoBuffer was passed a null source evbuffer\n");
-// assertNotNull(destination, "parcEventBuffer_ReadIntoBuffer was passed a null destination buffer\n");
-// assertNotNull(destination->evbuffer, "parcEventBuffer_ReadIntoBuffer was passed a null destination evbuffer\n");
+// parcAssertNotNull(source, "parcEventBuffer_ReadIntoBuffer was passed a null source buffer\n");
+// parcAssertNotNull(source->evbuffer, "parcEventBuffer_ReadIntoBuffer was passed a null source evbuffer\n");
+// parcAssertNotNull(destination, "parcEventBuffer_ReadIntoBuffer was passed a null destination buffer\n");
+// parcAssertNotNull(destination->evbuffer, "parcEventBuffer_ReadIntoBuffer was passed a null destination evbuffer\n");
return evbuffer_remove_buffer(source->evbuffer, destination->evbuffer, length);
}
@@ -147,8 +147,8 @@ int
parcEventBuffer_Read(PARCEventBuffer *readBuffer, void *data, size_t length)
{
parcEventBuffer_OptionalAssertValid(readBuffer);
-// assertNotNull(readBuffer, "parcEventBuffer_Read was passed a null buffer\n");
-// assertNotNull(readBuffer->evbuffer, "parcEventBuffer_Read was passed a null libevent evbuffer\n");
+// parcAssertNotNull(readBuffer, "parcEventBuffer_Read was passed a null buffer\n");
+// parcAssertNotNull(readBuffer->evbuffer, "parcEventBuffer_Read was passed a null libevent evbuffer\n");
if (data == NULL) {
return evbuffer_drain(readBuffer->evbuffer, length);
@@ -160,7 +160,7 @@ parcEventBuffer_Read(PARCEventBuffer *readBuffer, void *data, size_t length)
int
parcEventBuffer_copyOut(PARCEventBuffer *readBuffer, void *data_out, size_t length)
{
- assertNotNull(data_out, "parcEventBuffer_Copy was passed a null data_out buffer\n");
+ parcAssertNotNull(data_out, "parcEventBuffer_Copy was passed a null data_out buffer\n");
parcEventBuffer_OptionalAssertValid(readBuffer);
return evbuffer_copyout(readBuffer->evbuffer, data_out, length);
}
@@ -170,8 +170,8 @@ parcEventBuffer_WriteToFileDescriptor(PARCEventBuffer *writeBuffer, int fd, ssiz
{
parcEventBuffer_OptionalAssertValid(writeBuffer);
-// assertNotNull(writeBuffer, "parcEventBuffer_WriteToFileDescriptor was passed a null buffer\n");
-// assertNotNull(writeBuffer->evbuffer, "parcEventBuffer_WriteToFileDescriptor was passed a null libevent evbuffer\n");
+// parcAssertNotNull(writeBuffer, "parcEventBuffer_WriteToFileDescriptor was passed a null buffer\n");
+// parcAssertNotNull(writeBuffer->evbuffer, "parcEventBuffer_WriteToFileDescriptor was passed a null libevent evbuffer\n");
return evbuffer_write_atmost(writeBuffer->evbuffer, fd, length);
}
@@ -180,8 +180,8 @@ int
parcEventBuffer_ReadFromFileDescriptor(PARCEventBuffer *readBuffer, int fd, size_t length)
{
parcEventBuffer_OptionalAssertValid(readBuffer);
-// assertNotNull(readBuffer, "parcEventBuffer_ReadFromFileDescriptor was passed a null buffer\n");
-// assertNotNull(readBuffer->evbuffer, "parcEventBuffer_ReadFromFileDescriptor was passed a null libevent evbuffer\n");
+// parcAssertNotNull(readBuffer, "parcEventBuffer_ReadFromFileDescriptor was passed a null buffer\n");
+// parcAssertNotNull(readBuffer->evbuffer, "parcEventBuffer_ReadFromFileDescriptor was passed a null libevent evbuffer\n");
return evbuffer_read(readBuffer->evbuffer, fd, (int) length);
}
@@ -190,8 +190,8 @@ void
parcEventBuffer_FreeLine(PARCEventBuffer *readBuffer, char **line)
{
parcEventBuffer_OptionalAssertValid(readBuffer);
-// assertNotNull(readBuffer, "parcEventBuffer_ReadLine was passed a null readBuffer\n");
-// assertNotNull(readBuffer->evbuffer, "parcEventBuffer_ReadLine was passed a null libevent evbuffer\n");
+// parcAssertNotNull(readBuffer, "parcEventBuffer_ReadLine was passed a null readBuffer\n");
+// parcAssertNotNull(readBuffer->evbuffer, "parcEventBuffer_ReadLine was passed a null libevent evbuffer\n");
parcMemory_Deallocate((void **) line);
}
@@ -200,8 +200,8 @@ char *
parcEventBuffer_ReadLine(PARCEventBuffer *readBuffer, size_t *length)
{
parcEventBuffer_OptionalAssertValid(readBuffer);
-// assertNotNull(readBuffer, "parcEventBuffer_ReadLine was passed a null readBuffer\n");
-// assertNotNull(readBuffer->evbuffer, "parcEventBuffer_ReadLine was passed a null libevent evbuffer\n");
+// parcAssertNotNull(readBuffer, "parcEventBuffer_ReadLine was passed a null readBuffer\n");
+// parcAssertNotNull(readBuffer->evbuffer, "parcEventBuffer_ReadLine was passed a null libevent evbuffer\n");
return evbuffer_readln(readBuffer->evbuffer, length, EVBUFFER_EOL_CRLF);
}
@@ -211,10 +211,10 @@ parcEventBuffer_AppendBuffer(PARCEventBuffer *source, PARCEventBuffer *destinati
{
parcEventBuffer_OptionalAssertValid(source);
parcEventBuffer_OptionalAssertValid(destination);
-// assertNotNull(source, "parcEventBuffer_AppendBuffer was passed a null source parcEventBuffer\n");
-// assertNotNull(destination, "parcEventBuffer_AppendBuffer was passed a null destination parcEventBuffer\n");
-// assertNotNull(source->evbuffer, "parcEventBuffer_AppendBuffer was passed a null source libevent evbuffer\n");
-// assertNotNull(destination->evbuffer, "parcEventBuffer_AppendBuffer was passed a null destination libevent evbuffer\n");
+// parcAssertNotNull(source, "parcEventBuffer_AppendBuffer was passed a null source parcEventBuffer\n");
+// parcAssertNotNull(destination, "parcEventBuffer_AppendBuffer was passed a null destination parcEventBuffer\n");
+// parcAssertNotNull(source->evbuffer, "parcEventBuffer_AppendBuffer was passed a null source libevent evbuffer\n");
+// parcAssertNotNull(destination->evbuffer, "parcEventBuffer_AppendBuffer was passed a null destination libevent evbuffer\n");
return evbuffer_add_buffer(destination->evbuffer, source->evbuffer);
}
@@ -223,9 +223,9 @@ int
parcEventBuffer_Append(PARCEventBuffer *parcEventBuffer, void *data, size_t length)
{
parcEventBuffer_OptionalAssertValid(parcEventBuffer);
-// assertNotNull(parcEventBuffer, "parcEventBuffer_Append was passed a null parcEventBuffer\n");
-// assertNotNull(parcEventBuffer->evbuffer, "parcEventBuffer_Append was passed a null libevent evbuffer\n");
- assertNotNull(data, "parcEventBuffer_Append was passed a null data buffer\n");
+// parcAssertNotNull(parcEventBuffer, "parcEventBuffer_Append was passed a null parcEventBuffer\n");
+// parcAssertNotNull(parcEventBuffer->evbuffer, "parcEventBuffer_Append was passed a null libevent evbuffer\n");
+ parcAssertNotNull(data, "parcEventBuffer_Append was passed a null data buffer\n");
return evbuffer_add(parcEventBuffer->evbuffer, data, length);
}
@@ -234,9 +234,9 @@ int
parcEventBuffer_Prepend(PARCEventBuffer *readBuffer, void *data, size_t length)
{
parcEventBuffer_OptionalAssertValid(readBuffer);
-// assertNotNull(readBuffer->evbuffer, "parcEventBuffer_Prepend was passed a null libevent evbuffer\n");
-// assertNotNull(readBuffer, "parcEventBuffer_Prepend was passed a null buffer\n");
- assertNotNull(data, "parcEventBuffer_Prepend was passed a null data buffer\n");
+// parcAssertNotNull(readBuffer->evbuffer, "parcEventBuffer_Prepend was passed a null libevent evbuffer\n");
+// parcAssertNotNull(readBuffer, "parcEventBuffer_Prepend was passed a null buffer\n");
+ parcAssertNotNull(data, "parcEventBuffer_Prepend was passed a null data buffer\n");
return evbuffer_prepend(readBuffer->evbuffer, data, length);
}
@@ -244,10 +244,10 @@ parcEventBuffer_Prepend(PARCEventBuffer *readBuffer, void *data, size_t length)
PARCEventBuffer *
parcEventBuffer_GetQueueBufferInput(PARCEventQueue *queue)
{
- assertNotNull(queue, "parcEventBuffer_GetQueueBufferInput was passed a null queue\n");
+ parcAssertNotNull(queue, "parcEventBuffer_GetQueueBufferInput was passed a null queue\n");
PARCEventBuffer *parcEventBuffer = parcMemory_AllocateAndClear(sizeof(PARCEventBuffer));
- assertNotNull(parcEventBuffer, "parcMemory_AllocateAndClear(%zu) returned NULL", sizeof(PARCEventBuffer));
+ parcAssertNotNull(parcEventBuffer, "parcMemory_AllocateAndClear(%zu) returned NULL", sizeof(PARCEventBuffer));
parcEventBuffer->evbuffer = internal_parcEventQueue_GetEvInputBuffer(queue);
parcEventBuffer_LogDebug(parcEventBuffer, "parcEventBuffer_GetQueueBufferInput(queue=%p)\n", queue);
@@ -258,10 +258,10 @@ parcEventBuffer_GetQueueBufferInput(PARCEventQueue *queue)
PARCEventBuffer *
parcEventBuffer_GetQueueBufferOutput(PARCEventQueue *queue)
{
- assertNotNull(queue, "parcEventBuffer_GetQueueBufferOutput was passed a null queue\n");
+ parcAssertNotNull(queue, "parcEventBuffer_GetQueueBufferOutput was passed a null queue\n");
PARCEventBuffer *parcEventBuffer = parcMemory_AllocateAndClear(sizeof(PARCEventBuffer));
- assertNotNull(parcEventBuffer, "parcMemory_AllocateAndClear(%zu) returned NULL", sizeof(PARCEventBuffer));
+ parcAssertNotNull(parcEventBuffer, "parcMemory_AllocateAndClear(%zu) returned NULL", sizeof(PARCEventBuffer));
parcEventBuffer->evbuffer = internal_parcEventQueue_GetEvOutputBuffer(queue);
parcEventBuffer_LogDebug(parcEventBuffer, "parcEventBuffer_GetQueueBufferInput(queue=%p)\n", queue);
diff --git a/libparc/parc/algol/parc_EventQueue.c b/libparc/parc/algol/parc_EventQueue.c
index 5d656a12..dffab1e7 100755
--- a/libparc/parc/algol/parc_EventQueue.c
+++ b/libparc/parc/algol/parc_EventQueue.c
@@ -18,7 +18,7 @@
#include <config.h>
#include <errno.h>
-#include <LongBow/runtime.h>
+#include <parc/assert/parc_Assert.h>
#include "internal_parc_Event.h"
#include <parc/algol/parc_EventScheduler.h>
@@ -70,7 +70,7 @@ _parc_queue_read_callback(struct bufferevent *bev, void *ptr)
parcEventQueue_LogDebug(parcEventQueue,
"_parc_queue_read_callback(bev=%p,ptr->buffereventBuffer=%p,parcEventQueue=%p)\n",
bev, parcEventQueue->buffereventBuffer, parcEventQueue);
- assertNotNull(parcEventQueue->readCallback, "parcEvent read callback called when NULL");
+ parcAssertNotNull(parcEventQueue->readCallback, "parcEvent read callback called when NULL");
parcEventQueue->readCallback(parcEventQueue, PARCEventType_Read, parcEventQueue->readUserData);
}
@@ -82,7 +82,7 @@ _parc_queue_write_callback(struct bufferevent *bev, void *ptr)
parcEventQueue_LogDebug(parcEventQueue,
"_parc_queue_write_callback(bev=%p,ptr->buffereventBuffer=%p,parcEventQueue=%p)\n",
bev, parcEventQueue->buffereventBuffer, parcEventQueue);
- assertNotNull(parcEventQueue->writeCallback, "parcEvent write callback called when NULL");
+ parcAssertNotNull(parcEventQueue->writeCallback, "parcEvent write callback called when NULL");
parcEventQueue->writeCallback(parcEventQueue, PARCEventType_Write, parcEventQueue->writeUserData);
}
@@ -95,7 +95,7 @@ _parc_queue_event_callback(struct bufferevent *bev, short events, void *ptr)
parcEventQueue_LogDebug(parcEventQueue,
"_parc_queue_event_callback(bev=%p,events=%x,errno=%d,ptr->buffereventBuffer=%p,parcEventQueue=%p)\n",
bev, events, errno, parcEventQueue->buffereventBuffer, parcEventQueue);
- assertNotNull(parcEventQueue->eventCallback, "parcEvent event callback called when NULL");
+ parcAssertNotNull(parcEventQueue->eventCallback, "parcEvent event callback called when NULL");
errno = errno_forwarded;
parcEventQueue->eventCallback(parcEventQueue, internal_bufferevent_type_to_PARCEventQueueEventType(events), parcEventQueue->eventUserData);
@@ -130,9 +130,9 @@ parcEventQueue_SetCallbacks(PARCEventQueue *parcEventQueue,
PARCEventQueue *
parcEventQueue_Create(PARCEventScheduler *eventScheduler, int fd, PARCEventQueueOption flags)
{
- assertNotNull(eventScheduler, "parcEventQueue_Create passed a NULL scheduler instance.");
+ parcAssertNotNull(eventScheduler, "parcEventQueue_Create passed a NULL scheduler instance.");
PARCEventQueue *parcEventQueue = parcMemory_AllocateAndClear(sizeof(PARCEventQueue));
- assertNotNull(parcEventQueue, "parcMemory_AllocateAndClear(%zu) returned NULL", sizeof(PARCEventQueue));
+ parcAssertNotNull(parcEventQueue, "parcMemory_AllocateAndClear(%zu) returned NULL", sizeof(PARCEventQueue));
parcEventQueue->eventScheduler = eventScheduler;
//
@@ -145,7 +145,7 @@ parcEventQueue_Create(PARCEventScheduler *eventScheduler, int fd, PARCEventQueue
//
parcEventQueue->buffereventBuffer = bufferevent_socket_new(parcEventScheduler_GetEvBase(eventScheduler), fd,
internal_PARCEventQueueOption_to_bufferevent_options(flags));
- assertNotNull(parcEventQueue->buffereventBuffer,
+ parcAssertNotNull(parcEventQueue->buffereventBuffer,
"Got null from bufferevent_socket_new for socket %d", fd);
parcEventQueue_LogDebug(parcEventQueue,
@@ -161,7 +161,7 @@ void
parcEventQueue_Destroy(PARCEventQueue **parcEventQueue)
{
parcEventQueue_LogDebug((*parcEventQueue), "parcEventQueue_Destroy(ptr=%p)\n", *parcEventQueue);
- assertNotNull((*parcEventQueue)->buffereventBuffer, "parcEventQueue_Destroy passed a null buffer!");
+ parcAssertNotNull((*parcEventQueue)->buffereventBuffer, "parcEventQueue_Destroy passed a null buffer!");
bufferevent_free((*parcEventQueue)->buffereventBuffer);
parcMemory_Deallocate((void *) parcEventQueue);
@@ -226,7 +226,7 @@ int
parcEventQueue_Printf(PARCEventQueue *parcEventQueue, const char *fmt, ...)
{
struct evbuffer *buffer = bufferevent_get_output(parcEventQueue->buffereventBuffer);
- assertNotNull(buffer, "bufferevent_get_output returned NULL");
+ parcAssertNotNull(buffer, "bufferevent_get_output returned NULL");
va_list ap;
@@ -258,9 +258,9 @@ parcEventQueue_SetPriority(PARCEventQueue *eventQueue, PARCEventPriority priorit
PARCEventQueuePair *
parcEventQueue_CreateConnectedPair(PARCEventScheduler *eventScheduler)
{
- assertNotNull(eventScheduler, "parcEventQueue_CreateConnectedPair must be passed a valid Event Scheduler");
+ parcAssertNotNull(eventScheduler, "parcEventQueue_CreateConnectedPair must be passed a valid Event Scheduler");
PARCEventQueuePair *parcEventQueuePair = parcMemory_AllocateAndClear(sizeof(PARCEventQueuePair));
- assertNotNull(parcEventQueuePair, "parcMemory_AllocateAndClear(%zu) returned NULL", sizeof(PARCEventQueuePair));
+ parcAssertNotNull(parcEventQueuePair, "parcMemory_AllocateAndClear(%zu) returned NULL", sizeof(PARCEventQueuePair));
parcEventQueuePair->up = parcMemory_AllocateAndClear(sizeof(PARCEventQueue));
parcEventQueuePair->up->eventScheduler = eventScheduler;
@@ -269,7 +269,7 @@ parcEventQueue_CreateConnectedPair(PARCEventScheduler *eventScheduler)
eventScheduler,
parcEventScheduler_GetEvBase(eventScheduler),
parcEventQueuePair->up);
- assertNotNull(parcEventQueuePair->up, "parcMemory_AllocateAndClear(%zu) returned NULL", sizeof(PARCEventQueue));
+ parcAssertNotNull(parcEventQueuePair->up, "parcMemory_AllocateAndClear(%zu) returned NULL", sizeof(PARCEventQueue));
parcEventQueuePair->down = parcMemory_AllocateAndClear(sizeof(PARCEventQueue));
parcEventQueuePair->down->eventScheduler = eventScheduler;
@@ -278,7 +278,7 @@ parcEventQueue_CreateConnectedPair(PARCEventScheduler *eventScheduler)
eventScheduler,
parcEventScheduler_GetEvBase(eventScheduler),
parcEventQueuePair->down);
- assertNotNull(parcEventQueuePair->down, "parcMemory_AllocateAndClear(%zu) returned NULL", sizeof(PARCEventQueue));
+ parcAssertNotNull(parcEventQueuePair->down, "parcMemory_AllocateAndClear(%zu) returned NULL", sizeof(PARCEventQueue));
struct bufferevent *evpair[2];
int result = bufferevent_pair_new(parcEventScheduler_GetEvBase(eventScheduler), 0, evpair);
diff --git a/libparc/parc/algol/parc_EventScheduler.c b/libparc/parc/algol/parc_EventScheduler.c
index 55de5c52..3983740e 100755
--- a/libparc/parc/algol/parc_EventScheduler.c
+++ b/libparc/parc/algol/parc_EventScheduler.c
@@ -17,7 +17,7 @@
*/
#include <config.h>
-#include <LongBow/runtime.h>
+#include <parc/assert/parc_Assert.h>
#include <stdio.h>
#include <unistd.h>
@@ -76,17 +76,17 @@ parcEventScheduler_Create(void)
internal_parc_initializeLibevent();
PARCEventScheduler *parcEventScheduler = parcMemory_Allocate(sizeof(PARCEventScheduler));
- assertNotNull(parcEventScheduler, "parcMemory_Allocate(%zu) returned NULL", sizeof(PARCEventScheduler));
+ parcAssertNotNull(parcEventScheduler, "parcMemory_Allocate(%zu) returned NULL", sizeof(PARCEventScheduler));
// Initialize libevent base pointer.
parcEventScheduler->evbase = event_base_new();
- assertNotNull(parcEventScheduler->evbase, "Could not obtain an event base!");
+ parcAssertNotNull(parcEventScheduler->evbase, "Could not obtain an event base!");
int result = event_base_priority_init(parcEventScheduler->evbase, PARCEventPriority_NumberOfPriorities);
- assertTrue(result == 0, "Could not set scheduler priorities (%d)", result);
+ parcAssertTrue(result == 0, "Could not set scheduler priorities (%d)", result);
parcEventScheduler->log = _parc_logger_create();
- assertNotNull(parcEventScheduler->log, "Could not create parc logger");
+ parcAssertNotNull(parcEventScheduler->log, "Could not create parc logger");
parcEventScheduler_LogDebug(parcEventScheduler, "parcEventScheduler_Create() = %p\n", parcEventScheduler);
@@ -97,7 +97,7 @@ int
parcEventScheduler_Start(PARCEventScheduler *parcEventScheduler, PARCEventSchedulerDispatchType type)
{
parcEventScheduler_LogDebug(parcEventScheduler, "parcEventScheduler_Start(%p, %d)\n", parcEventScheduler, type);
- assertNotNull(parcEventScheduler, "parcEventScheduler_Start must be passed a valid base parcEventScheduler!");
+ parcAssertNotNull(parcEventScheduler, "parcEventScheduler_Start must be passed a valid base parcEventScheduler!");
int result = event_base_loop(parcEventScheduler->evbase,
internal_PARCEventSchedulerDispatchType_to_eventloop_options(type));
return result;
@@ -119,7 +119,7 @@ int
parcEventScheduler_Stop(PARCEventScheduler *parcEventScheduler, struct timeval *delay)
{
parcEventScheduler_LogDebug(parcEventScheduler, "parcEventScheduler_Stop(%p, %p)\n", parcEventScheduler, delay);
- assertNotNull(parcEventScheduler, "parcEventScheduler_Stop must be passed a valid base parcEventScheduler!");
+ parcAssertNotNull(parcEventScheduler, "parcEventScheduler_Stop must be passed a valid base parcEventScheduler!");
int result = event_base_loopexit(parcEventScheduler->evbase, delay);
return result;
}
@@ -128,7 +128,7 @@ int
parcEventScheduler_Abort(PARCEventScheduler *parcEventScheduler)
{
parcEventScheduler_LogDebug(parcEventScheduler, "parcEventScheduler_Abort(%p)\n", parcEventScheduler);
- assertNotNull(parcEventScheduler, "parcEventScheduler_Abort must be passed a valid base parcEventScheduler!");
+ parcAssertNotNull(parcEventScheduler, "parcEventScheduler_Abort must be passed a valid base parcEventScheduler!");
int result = event_base_loopbreak(parcEventScheduler->evbase);
return result;
}
@@ -156,8 +156,8 @@ parcEventScheduler_Destroy(PARCEventScheduler **parcEventScheduler)
{
parcEventScheduler_LogDebug((*parcEventScheduler), "parcEventScheduler_Destroy(%p)\n", *parcEventScheduler);
- assertNotNull(*parcEventScheduler, "parcEventScheduler_Destroy must be passed a valid base parcEventScheduler!");
- assertNotNull((*parcEventScheduler)->evbase, "parcEventScheduler_Destroy passed a NULL event base member!");
+ parcAssertNotNull(*parcEventScheduler, "parcEventScheduler_Destroy must be passed a valid base parcEventScheduler!");
+ parcAssertNotNull((*parcEventScheduler)->evbase, "parcEventScheduler_Destroy passed a NULL event base member!");
event_base_free((*parcEventScheduler)->evbase);
parcLog_Release(&((*parcEventScheduler)->log));
diff --git a/libparc/parc/algol/parc_EventSignal.c b/libparc/parc/algol/parc_EventSignal.c
index 7b8d1191..7bb094bd 100755
--- a/libparc/parc/algol/parc_EventSignal.c
+++ b/libparc/parc/algol/parc_EventSignal.c
@@ -17,7 +17,7 @@
*/
#include <config.h>
-#include <LongBow/runtime.h>
+#include <parc/assert/parc_Assert.h>
#include "internal_parc_Event.h"
#include <parc/algol/parc_EventScheduler.h>
@@ -66,7 +66,7 @@ PARCEventSignal *
parcEventSignal_Create(PARCEventScheduler *eventScheduler, int signal, PARCEventType flags, PARCEvent_Callback *callback, void *callbackArgs)
{
PARCEventSignal *parcEventSignal = parcMemory_Allocate(sizeof(PARCEventSignal));
- assertNotNull(parcEventSignal, "parcMemory_Allocate(%zu) returned NULL", sizeof(PARCEventSignal));
+ parcAssertNotNull(parcEventSignal, "parcMemory_Allocate(%zu) returned NULL", sizeof(PARCEventSignal));
parcEventSignal->eventScheduler = eventScheduler;
parcEventSignal->callback = callback;
@@ -75,7 +75,7 @@ parcEventSignal_Create(PARCEventScheduler *eventScheduler, int signal, PARCEvent
parcEventSignal->event = event_new(parcEventScheduler_GetEvBase(eventScheduler), signal,
internal_PARCEventType_to_libevent_type(flags),
_parc_event_signal_callback, parcEventSignal);
- assertNotNull(parcEventSignal->event, "Could not create a new event!");
+ parcAssertNotNull(parcEventSignal->event, "Could not create a new event!");
parcEventSignal_LogDebug(parcEventSignal,
"parcEventSignal_Create(base=%p,signal=%x,flags=%x,cb=%p,args=%p) = %p\n",
@@ -88,7 +88,7 @@ int
parcEventSignal_Start(PARCEventSignal *parcEventSignal)
{
parcEventSignal_LogDebug(parcEventSignal, "parcEventSignal_Start(event=%p)\n", parcEventSignal);
- assertNotNull(parcEventSignal, "parcEventStart_Signal must be passed a valid event!");
+ parcAssertNotNull(parcEventSignal, "parcEventStart_Signal must be passed a valid event!");
int result = event_add(parcEventSignal->event, NULL);
return result;
@@ -98,7 +98,7 @@ int
parcEventSignal_Stop(PARCEventSignal *parcEventSignal)
{
parcEventSignal_LogDebug(parcEventSignal, "parcEventSignal_Stop(event=%p)\n", parcEventSignal);
- assertNotNull(parcEventSignal, "parcEvent_Stop must be passed a valid event!");
+ parcAssertNotNull(parcEventSignal, "parcEvent_Stop must be passed a valid event!");
int result = event_del(parcEventSignal->event);
return result;
@@ -108,8 +108,8 @@ void
parcEventSignal_Destroy(PARCEventSignal **parcEventSignal)
{
parcEventSignal_LogDebug((*parcEventSignal), "parcEventSignal_Destroy(event=%p)\n", parcEventSignal);
- assertNotNull(*parcEventSignal, "parcEvent_Destroy must be passed a valid parcEventSignal!");
- assertNotNull((*parcEventSignal)->event, "parcEvent_Destroy passed a null event!");
+ parcAssertNotNull(*parcEventSignal, "parcEvent_Destroy must be passed a valid parcEventSignal!");
+ parcAssertNotNull((*parcEventSignal)->event, "parcEvent_Destroy passed a null event!");
event_free((*parcEventSignal)->event);
parcMemory_Deallocate((void **) parcEventSignal);
}
diff --git a/libparc/parc/algol/parc_EventSocket.c b/libparc/parc/algol/parc_EventSocket.c
index dcb2fd69..62aa10bc 100755
--- a/libparc/parc/algol/parc_EventSocket.c
+++ b/libparc/parc/algol/parc_EventSocket.c
@@ -17,7 +17,7 @@
*/
#include <config.h>
-#include <LongBow/runtime.h>
+#include <parc/assert/parc_Assert.h>
#include <parc/algol/parc_EventScheduler.h>
#include <parc/algol/parc_EventSocket.h>
@@ -87,7 +87,7 @@ parcEventSocket_Create(PARCEventScheduler *eventScheduler,
void *userData, const struct sockaddr *sa, int socklen)
{
PARCEventSocket *parcEventSocket = parcMemory_AllocateAndClear(sizeof(PARCEventSocket));
- assertNotNull(parcEventSocket, "parcMemory_Allocate(%zu) returned NULL", sizeof(PARCEventSocket));
+ parcAssertNotNull(parcEventSocket, "parcMemory_Allocate(%zu) returned NULL", sizeof(PARCEventSocket));
parcEventSocket->eventScheduler = eventScheduler;
parcEventSocket->socketCallback = callback;
@@ -118,7 +118,7 @@ parcEventSocket_Create(PARCEventScheduler *eventScheduler,
void
parcEventSocket_Destroy(PARCEventSocket **socketEvent)
{
- assertNotNull(*socketEvent, "parcEventSocket_Destroy must be passed a valid socketEvent!");
+ parcAssertNotNull(*socketEvent, "parcEventSocket_Destroy must be passed a valid socketEvent!");
if ((*socketEvent)->listener) {
evconnlistener_free((*socketEvent)->listener);
diff --git a/libparc/parc/algol/parc_EventTimer.c b/libparc/parc/algol/parc_EventTimer.c
index 529188b1..82f731b1 100755
--- a/libparc/parc/algol/parc_EventTimer.c
+++ b/libparc/parc/algol/parc_EventTimer.c
@@ -17,7 +17,7 @@
*/
#include <config.h>
-#include <LongBow/runtime.h>
+#include <parc/assert/parc_Assert.h>
#include "internal_parc_Event.h"
#include <parc/algol/parc_EventTimer.h>
@@ -62,7 +62,7 @@ PARCEventTimer *
parcEventTimer_Create(PARCEventScheduler *eventScheduler, PARCEventType flags, PARCEvent_Callback *callback, void *callbackArgs)
{
PARCEventTimer *parcEventTimer = parcMemory_Allocate(sizeof(PARCEventTimer));
- assertNotNull(parcEventTimer, "parcMemory_Allocate(%zu) returned NULL", sizeof(PARCEventTimer));
+ parcAssertNotNull(parcEventTimer, "parcMemory_Allocate(%zu) returned NULL", sizeof(PARCEventTimer));
parcEventTimer->eventScheduler = eventScheduler;
parcEventTimer->callback = callback;
@@ -72,7 +72,7 @@ parcEventTimer_Create(PARCEventScheduler *eventScheduler, PARCEventType flags, P
parcEventTimer->event = event_new(parcEventScheduler_GetEvBase(eventScheduler), -1,
internal_PARCEventType_to_libevent_type(flags),
_parc_event_timer_callback, parcEventTimer);
- assertNotNull(parcEventTimer->event, "Could not create a new event!");
+ parcAssertNotNull(parcEventTimer->event, "Could not create a new event!");
parcEventTimer_LogDebug(parcEventTimer,
"parcEventTimer_Create(base=%p,events=%x,cb=%p,args=%p) = %p\n",
@@ -88,7 +88,7 @@ parcEventTimer_Start(PARCEventTimer *parcEventTimer, struct timeval *timeout)
parcEventTimer_LogDebug(parcEventTimer,
"parcEventTimer_Start(event=%p, timeout=%d:%d)\n",
parcEventTimer, timeout->tv_sec, timeout->tv_usec);
- assertNotNull(parcEventTimer, "parcEventTimer_Start must be passed a valid event!");
+ parcAssertNotNull(parcEventTimer, "parcEventTimer_Start must be passed a valid event!");
int result = event_add(parcEventTimer->event, timeout);
return result;
@@ -98,7 +98,7 @@ int
parcEventTimer_Stop(PARCEventTimer *parcEventTimer)
{
parcEventTimer_LogDebug(parcEventTimer, "parcEventTimer_Stop(event=%p)\n", parcEventTimer);
- assertNotNull(parcEventTimer, "parcEventTimer_Stop must be passed a valid event!");
+ parcAssertNotNull(parcEventTimer, "parcEventTimer_Stop must be passed a valid event!");
int result = event_del(parcEventTimer->event);
return result;
@@ -108,8 +108,8 @@ void
parcEventTimer_Destroy(PARCEventTimer **parcEventTimer)
{
parcEventTimer_LogDebug((*parcEventTimer), "parcEventTimer_Destroy(parcEventTimer=%p)\n", *parcEventTimer);
- assertNotNull(*parcEventTimer, "parcEventTimer_Destroy must be passed a valid parcEventTimer!");
- assertNotNull((*parcEventTimer)->event, "parcEventTimer_Destroy passed a null event!");
+ parcAssertNotNull(*parcEventTimer, "parcEventTimer_Destroy must be passed a valid parcEventTimer!");
+ parcAssertNotNull((*parcEventTimer)->event, "parcEventTimer_Destroy passed a null event!");
event_free((*parcEventTimer)->event);
parcMemory_Deallocate((void **) parcEventTimer);
diff --git a/libparc/parc/algol/parc_File.c b/libparc/parc/algol/parc_File.c
index 2ab307a2..353ffcca 100644
--- a/libparc/parc/algol/parc_File.c
+++ b/libparc/parc/algol/parc_File.c
@@ -37,7 +37,7 @@
#include <string.h>
#include <errno.h>
-#include <LongBow/runtime.h>
+#include <parc/assert/parc_Assert.h>
#include <parc/algol/parc_Object.h>
#include <parc/algol/parc_PathName.h>
@@ -66,8 +66,8 @@ parcObject_Override(PARCFile, PARCObject,
void
parcFile_AssertValid(const PARCFile *instance)
{
- trapIllegalValueIf(instance == NULL, "Parameter must be a non-null pointer to a valid PARCFile.");
- trapIllegalValueIf(instance->pathName == NULL, "PARCFile cannot have a NULL path-name");
+ parcTrapIllegalValueIf(instance == NULL, "Parameter must be a non-null pointer to a valid PARCFile.");
+ parcTrapIllegalValueIf(instance->pathName == NULL, "PARCFile cannot have a NULL path-name");
}
PARCFile *
@@ -194,10 +194,10 @@ parcFile_Delete(const PARCFile *file)
char *string = parcPathName_ToString(file->pathName);
// only allow under tmp
- assertTrue(strncmp(string, "/tmp/", 5) == 0,
+ parcAssertTrue(strncmp(string, "/tmp/", 5) == 0,
"Path must begin with /tmp/: %s", string);
// dont allow ".."
- assertNull(strstr(string, ".."), "Path cannot have .. in it: %s", string);
+ parcAssertNull(strstr(string, ".."), "Path cannot have .. in it: %s", string);
bool result = false;
if (parcFile_IsDirectory(file)) {
@@ -208,7 +208,7 @@ parcFile_Delete(const PARCFile *file)
int maximumFileDescriptors = 20;
int failure = nftw(string, _deleteNode, maximumFileDescriptors, flags);
- assertFalse(failure, "Error on recursive delete: (%d) %s", errno, strerror(errno));
+ parcAssertFalse(failure, "Error on recursive delete: (%d) %s", errno, strerror(errno));
result = failure == false;
} else {
diff --git a/libparc/parc/algol/parc_FileInputStream.c b/libparc/parc/algol/parc_FileInputStream.c
index f42ced73..186d07b5 100755
--- a/libparc/parc/algol/parc_FileInputStream.c
+++ b/libparc/parc/algol/parc_FileInputStream.c
@@ -24,7 +24,7 @@
#include <unistd.h>
#include <sys/stat.h>
-#include <LongBow/runtime.h>
+#include <parc/assert/parc_Assert.h>
#include <parc/algol/parc_Memory.h>
#include <parc/algol/parc_File.h>
@@ -70,7 +70,7 @@ parcFileInputStream_Open(const PARCFile *file)
PARCFileInputStream *
parcFileInputStream_Create(int fileDescriptor)
{
- trapIllegalValueIf(fileDescriptor < 0, "File descriptor must not be negative.");
+ parcTrapIllegalValueIf(fileDescriptor < 0, "File descriptor must not be negative.");
PARCFileInputStream *result = parcObject_CreateInstance(PARCFileInputStream);
if (result != NULL) {
diff --git a/libparc/parc/algol/parc_FileInputStream.h b/libparc/parc/algol/parc_FileInputStream.h
index 3641e08a..f7f7987a 100755
--- a/libparc/parc/algol/parc_FileInputStream.h
+++ b/libparc/parc/algol/parc_FileInputStream.h
@@ -140,7 +140,7 @@ void parcFileInputStream_Release(PARCFileInputStream **inputStreamPtr);
*
* parcFileOutputStream_Write(stream, buffer);
*
- * assertFalse(parcBuffer_HasRemaining(buffer), "Expected the buffer to be emtpy");
+ * parcAssertFalse(parcBuffer_HasRemaining(buffer), "Expected the buffer to be emtpy");
*
* parcBuffer_Release(&buffer);
*
diff --git a/libparc/parc/algol/parc_FileOutputStream.c b/libparc/parc/algol/parc_FileOutputStream.c
index a17dc66c..3e5c8cd6 100755
--- a/libparc/parc/algol/parc_FileOutputStream.c
+++ b/libparc/parc/algol/parc_FileOutputStream.c
@@ -20,7 +20,7 @@
#include <stdio.h>
#include <unistd.h>
-#include <LongBow/runtime.h>
+#include <parc/assert/parc_Assert.h>
#include <parc/algol/parc_FileOutputStream.h>
#include <parc/algol/parc_Object.h>
@@ -48,7 +48,7 @@ parcObject_ExtendPARCObject(PARCFileOutputStream, _destroy, NULL, NULL, NULL, NU
PARCFileOutputStream *
parcFileOutputStream_Create(int fileDescriptor)
{
- assertTrue(fileDescriptor != -1, "Invalid file descriptor");
+ parcAssertTrue(fileDescriptor != -1, "Invalid file descriptor");
PARCFileOutputStream *result = parcObject_CreateInstance(PARCFileOutputStream);
result->fd = fileDescriptor;
diff --git a/libparc/parc/algol/parc_FileOutputStream.h b/libparc/parc/algol/parc_FileOutputStream.h
index 51251561..a9708b0d 100644
--- a/libparc/parc/algol/parc_FileOutputStream.h
+++ b/libparc/parc/algol/parc_FileOutputStream.h
@@ -130,7 +130,7 @@ void parcFileOutputStream_Release(PARCFileOutputStream **streamPtr);
*
* parcFileOutputStream_Write(stream, buffer);
*
- * assertFalse(parcBuffer_HasRemaining(buffer), "Expected the buffer to be emtpy");
+ * parcAssertFalse(parcBuffer_HasRemaining(buffer), "Expected the buffer to be emtpy");
*
* parcBuffer_Release(&buffer);
*
diff --git a/libparc/parc/algol/parc_HashCodeTable.c b/libparc/parc/algol/parc_HashCodeTable.c
index ea1945b3..9531e312 100755
--- a/libparc/parc/algol/parc_HashCodeTable.c
+++ b/libparc/parc/algol/parc_HashCodeTable.c
@@ -28,7 +28,7 @@
*/
#include <config.h>
-#include <LongBow/runtime.h>
+#include <parc/assert/parc_Assert.h>
#include <stdio.h>
#include <string.h>
@@ -181,7 +181,7 @@ _expand(PARCHashCodeTable *hashCodeTable)
temp_table.tableLimit = old_table->tableLimit * expandby;
temp_table.expandThreshold = temp_table.tableLimit - temp_table.tableLimit / 4;
temp_table.entries = parcMemory_AllocateAndClear(temp_table.tableLimit * sizeof(HashTableEntry));
- assertNotNull(temp_table.entries, "parcMemory_AllocateAndClear(%zu) returned NULL", temp_table.tableLimit * sizeof(HashTableEntry));
+ parcAssertNotNull(temp_table.entries, "parcMemory_AllocateAndClear(%zu) returned NULL", temp_table.tableLimit * sizeof(HashTableEntry));
result = _rehash(old_table, &temp_table, hashCodeTable->keyEqualsFunc);
if (result == ADD_NOSPACE) {
@@ -203,11 +203,11 @@ parcHashCodeTable_Create_Size(PARCHashCodeTable_KeyEqualsFunc keyEqualsFunc,
size_t minimumSize)
{
PARCHashCodeTable *table = parcMemory_AllocateAndClear(sizeof(PARCHashCodeTable));
- assertNotNull(table, "parcMemory_AllocateAndClear(%zu) returned NULL", sizeof(PARCHashCodeTable));
+ parcAssertNotNull(table, "parcMemory_AllocateAndClear(%zu) returned NULL", sizeof(PARCHashCodeTable));
- assertNotNull(keyEqualsFunc, "keyEqualsFunc must be non-null");
- assertNotNull(keyHashCodeFunc, "keyHashCodeFunc must be non-null");
- assertTrue(minimumSize > 0, "minimumSize must be greater than zero");
+ parcAssertNotNull(keyEqualsFunc, "keyEqualsFunc must be non-null");
+ parcAssertNotNull(keyHashCodeFunc, "keyHashCodeFunc must be non-null");
+ parcAssertTrue(minimumSize > 0, "minimumSize must be greater than zero");
table->keyEqualsFunc = keyEqualsFunc;
table->keyHashCodeFunc = keyHashCodeFunc;
@@ -215,7 +215,7 @@ parcHashCodeTable_Create_Size(PARCHashCodeTable_KeyEqualsFunc keyEqualsFunc,
table->dataDestroyer = dataDestroyer;
table->hashtable.entries = parcMemory_AllocateAndClear(minimumSize * sizeof(HashTableEntry));
- assertNotNull(table->hashtable.entries, "parcMemory_AllocateAndClear(%zu) returned NULL", minimumSize * sizeof(HashTableEntry));
+ parcAssertNotNull(table->hashtable.entries, "parcMemory_AllocateAndClear(%zu) returned NULL", minimumSize * sizeof(HashTableEntry));
table->hashtable.tableLimit = minimumSize;
table->hashtable.tableSize = 0;
@@ -239,8 +239,8 @@ parcHashCodeTable_Create(PARCHashCodeTable_KeyEqualsFunc keyEqualsFunc,
void
parcHashCodeTable_Destroy(PARCHashCodeTable **tablePtr)
{
- assertNotNull(tablePtr, "Parameter must be non-null double pointer");
- assertNotNull(*tablePtr, "Parameter must dereference to non-null pointer");
+ parcAssertNotNull(tablePtr, "Parameter must be non-null double pointer");
+ parcAssertNotNull(*tablePtr, "Parameter must dereference to non-null pointer");
PARCHashCodeTable *table = *tablePtr;
size_t i;
@@ -264,9 +264,9 @@ parcHashCodeTable_Destroy(PARCHashCodeTable **tablePtr)
bool
parcHashCodeTable_Add(PARCHashCodeTable *table, void *key, void *data)
{
- assertNotNull(table, "Parameter table must be non-null");
- assertNotNull(key, "Parameter key must be non-null");
- assertNotNull(data, "Parameter data must be non-null");
+ parcAssertNotNull(table, "Parameter table must be non-null");
+ parcAssertNotNull(key, "Parameter key must be non-null");
+ parcAssertNotNull(data, "Parameter data must be non-null");
if (table->hashtable.tableSize >= table->hashtable.expandThreshold) {
_expand(table);
@@ -291,13 +291,13 @@ parcHashCodeTable_Del(PARCHashCodeTable *table, const void *key)
size_t index;
bool found;
- assertNotNull(table, "Parameter table must be non-null");
- assertNotNull(key, "parameter key must be non-null");
+ parcAssertNotNull(table, "Parameter table must be non-null");
+ parcAssertNotNull(key, "parameter key must be non-null");
found = _findIndex(table, key, &index);
if (found) {
- assertTrue(table->hashtable.tableSize > 0, "Illegal state: found entry in a hash table with 0 size");
+ parcAssertTrue(table->hashtable.tableSize > 0, "Illegal state: found entry in a hash table with 0 size");
if (table->keyDestroyer) {
table->keyDestroyer(&table->hashtable.entries[index].key);
@@ -318,8 +318,8 @@ parcHashCodeTable_Get(PARCHashCodeTable *table, const void *key)
{
size_t index;
- assertNotNull(table, "Parameter table must be non-null");
- assertNotNull(key, "parameter key must be non-null");
+ parcAssertNotNull(table, "Parameter table must be non-null");
+ parcAssertNotNull(key, "parameter key must be non-null");
bool found = _findIndex(table, key, &index);
@@ -333,6 +333,6 @@ parcHashCodeTable_Get(PARCHashCodeTable *table, const void *key)
size_t
parcHashCodeTable_Length(const PARCHashCodeTable *table)
{
- assertNotNull(table, "Parameter table must be non-null");
+ parcAssertNotNull(table, "Parameter table must be non-null");
return table->hashtable.tableSize;
}
diff --git a/libparc/parc/algol/parc_HashMap.c b/libparc/parc/algol/parc_HashMap.c
index 35a4414f..5e73a4c3 100644
--- a/libparc/parc/algol/parc_HashMap.c
+++ b/libparc/parc/algol/parc_HashMap.c
@@ -16,7 +16,7 @@
/**
*/
#include <config.h>
-#include <LongBow/runtime.h>
+#include <parc/assert/parc_Assert.h>
#include <parc/algol/parc_Object.h>
#include <parc/algol/parc_DisplayIndented.h>
@@ -54,7 +54,7 @@ _parcHashMapEntry_IsValid(_PARCHashMapEntry *hashEntry)
static void
_parcHashMapEntry_Finalize(_PARCHashMapEntry **instancePtr)
{
- assertNotNull(instancePtr, "Parameter must be a non-null pointer to a PARCHashMap pointer.");
+ parcAssertNotNull(instancePtr, "Parameter must be a non-null pointer to a PARCHashMap pointer.");
_PARCHashMapEntry *hashMapEntry = *instancePtr;
_parcHashMapEntry_IsValid(hashMapEntry);
@@ -134,7 +134,7 @@ _parcHashMapEntry_Create(const PARCObject *key, const PARCObject *value)
static void
_parcHashMap_Finalize(PARCHashMap **instancePtr)
{
- assertNotNull(instancePtr, "Parameter must be a non-null pointer to a PARCHashMap pointer.");
+ parcAssertNotNull(instancePtr, "Parameter must be a non-null pointer to a PARCHashMap pointer.");
PARCHashMap *hashMap = *instancePtr;
for (unsigned int i = 0; i < hashMap->capacity; i++) {
@@ -157,7 +157,7 @@ parcObject_ExtendPARCObject(PARCHashMap, _parcHashMap_Finalize, parcHashMap_Copy
void
parcHashMap_AssertValid(const PARCHashMap *instance)
{
- assertTrue(parcHashMap_IsValid(instance),
+ parcAssertTrue(parcHashMap_IsValid(instance),
"PARCHashMap is not valid.");
}
@@ -566,7 +566,7 @@ _parcHashMap_Init(PARCHashMap *map __attribute__((unused)))
}
}
- trapOutOfMemoryIf(state->listIterator == NULL, "Cannot create parcLinkedList_CreateIterator");
+ parcTrapOutOfMemoryIf(state->listIterator == NULL, "Cannot create parcLinkedList_CreateIterator");
}
return state;
@@ -613,7 +613,7 @@ _parcHashMap_HasNext(PARCHashMap *map __attribute__((unused)), _PARCHashMapItera
if (map->buckets[state->bucket] != NULL) {
parcIterator_Release(&state->listIterator);
state->listIterator = parcLinkedList_CreateIterator(map->buckets[state->bucket]);
- trapOutOfMemoryIf(state->listIterator == NULL, "Cannot create parcLinkedList_CreateIterator");
+ parcTrapOutOfMemoryIf(state->listIterator == NULL, "Cannot create parcLinkedList_CreateIterator");
result = parcIterator_HasNext(state->listIterator);
}
}
diff --git a/libparc/parc/algol/parc_Iterator.c b/libparc/parc/algol/parc_Iterator.c
index e70a0ff9..5ef67bf4 100755
--- a/libparc/parc/algol/parc_Iterator.c
+++ b/libparc/parc/algol/parc_Iterator.c
@@ -77,12 +77,12 @@ parcIterator_Create(PARCObject *object,
void (*fini)(PARCObject *, void *),
void (*assertValid)(const void *))
{
- assertNotNull(object, "PARCObject cannot be NULL.");
- assertNotNull(init, "'init' function cannot be NULL.");
- assertNotNull(hasNext, "'hasNext' function cannot be NULL.");
- assertNotNull(next, "'next' function cannot be NULL.");
- assertNotNull(element, "'element' function cannot be NULL.");
- assertNotNull(fini, "'fini' function cannot be NULL.");
+ parcAssertNotNull(object, "PARCObject cannot be NULL.");
+ parcAssertNotNull(init, "'init' function cannot be NULL.");
+ parcAssertNotNull(hasNext, "'hasNext' function cannot be NULL.");
+ parcAssertNotNull(next, "'next' function cannot be NULL.");
+ parcAssertNotNull(element, "'element' function cannot be NULL.");
+ parcAssertNotNull(fini, "'fini' function cannot be NULL.");
PARCIterator *result = parcObject_CreateInstance(PARCIterator);
@@ -120,7 +120,7 @@ parcIterator_IsValid(const PARCIterator *iterator)
void
parcIterator_AssertValid(const PARCIterator *iterator)
{
- assertTrue(parcIterator_IsValid(iterator), "PARCIterator is not valid.");
+ parcAssertTrue(parcIterator_IsValid(iterator), "PARCIterator is not valid.");
}
parcObject_ImplementAcquire(parcIterator, PARCIterator);
diff --git a/libparc/parc/algol/parc_Iterator.h b/libparc/parc/algol/parc_Iterator.h
index 275a16e7..1f402cba 100644
--- a/libparc/parc/algol/parc_Iterator.h
+++ b/libparc/parc/algol/parc_Iterator.h
@@ -62,7 +62,7 @@ typedef struct parc_iterator PARCIterator;
*
* * `next`
* Returns the next element in the iteration.
- * If there are no remaining elements in the iteration, then this function must induce a trapOutOfBounds
+ * If there are no remaining elements in the iteration, then this function must induce a parcTrapOutOfBounds
*
* * `remove`
* Removes the element returned by the `next` function.
diff --git a/libparc/parc/algol/parc_JSON.c b/libparc/parc/algol/parc_JSON.c
index d70a302e..f69396d2 100755
--- a/libparc/parc/algol/parc_JSON.c
+++ b/libparc/parc/algol/parc_JSON.c
@@ -17,7 +17,7 @@
*/
#include <config.h>
-#include <LongBow/runtime.h>
+#include <parc/assert/parc_Assert.h>
#include <stdio.h>
#include <ctype.h>
diff --git a/libparc/parc/algol/parc_JSONArray.c b/libparc/parc/algol/parc_JSONArray.c
index 87421e12..a92e6422 100755
--- a/libparc/parc/algol/parc_JSONArray.c
+++ b/libparc/parc/algol/parc_JSONArray.c
@@ -18,7 +18,7 @@
#include <config.h>
-#include <LongBow/runtime.h>
+#include <parc/assert/parc_Assert.h>
#include <parc/algol/parc_JSONArray.h>
#include <parc/algol/parc_Object.h>
@@ -54,8 +54,8 @@ static const PARCObjectDescriptor parcArrayValue_ObjInterface = {
void
parcJSONArray_AssertValid(const PARCJSONArray *array)
{
- assertNotNull(array, "Must be a non-null pointer to a PARCJSONArray instance.");
- assertNotNull(array->array, "Must be a non-null pointer to a PARCDeque instance.");
+ parcAssertNotNull(array, "Must be a non-null pointer to a PARCJSONArray instance.");
+ parcAssertNotNull(array->array, "Must be a non-null pointer to a PARCDeque instance.");
}
PARCJSONArray *
diff --git a/libparc/parc/algol/parc_JSONArray.h b/libparc/parc/algol/parc_JSONArray.h
index 32fa9817..7b322867 100755
--- a/libparc/parc/algol/parc_JSONArray.h
+++ b/libparc/parc/algol/parc_JSONArray.h
@@ -95,7 +95,7 @@ void parcJSONArray_Release(PARCJSONArray **arrayPtr);
/**
* Assert that an instance of `PARCJSONArray` is valid.
*
- * If the instance is not valid, terminate via {@link trapIllegalValue}
+ * If the instance is not valid, terminate via {@link parcTrapIllegalValue}
*
* Valid means the internal state of the type is consistent with its required current or future behaviour.
* This may include the validation of internal instances of types.
diff --git a/libparc/parc/algol/parc_JSONPair.c b/libparc/parc/algol/parc_JSONPair.c
index a5df700f..11676523 100755
--- a/libparc/parc/algol/parc_JSONPair.c
+++ b/libparc/parc/algol/parc_JSONPair.c
@@ -20,7 +20,7 @@
*/
#include <config.h>
-#include <LongBow/runtime.h>
+#include <parc/assert/parc_Assert.h>
#include <stdio.h>
#include <ctype.h>
@@ -49,7 +49,7 @@ _destroyJSONPair(PARCJSONPair **pairPtr)
{
if (pairPtr != NULL) {
PARCJSONPair *pair = *pairPtr;
- assertNotNull(pair, "Parameter must be a non-null pointer to a valid PARCJSONPair.");
+ parcAssertNotNull(pair, "Parameter must be a non-null pointer to a valid PARCJSONPair.");
parcBuffer_Release(&pair->name);
parcJSONValue_Release(&pair->value);
}
diff --git a/libparc/parc/algol/parc_JSONParser.c b/libparc/parc/algol/parc_JSONParser.c
index a0022597..a8a0510b 100755
--- a/libparc/parc/algol/parc_JSONParser.c
+++ b/libparc/parc/algol/parc_JSONParser.c
@@ -17,7 +17,7 @@
*/
#include <config.h>
-#include <LongBow/runtime.h>
+#include <parc/assert/parc_Assert.h>
#include <ctype.h>
#include <string.h>
@@ -59,7 +59,7 @@ parcJSONParser_Create(PARCBuffer *buffer)
void
parcJSONParser_AssertValid(const PARCJSONParser *parser)
{
- assertNotNull(parser, "PARCJSONParser cannot be NULL");
+ parcAssertNotNull(parser, "PARCJSONParser cannot be NULL");
parcBuffer_OptionalAssertValid(parser->buffer);
}
@@ -166,7 +166,7 @@ parcJSONParser_ParseString(PARCJSONParser *parser)
c = '\t';
} else if (c == 'u') {
// Not supporting unicode at this point.
- trapNotImplemented("Unicode is not supported.");
+ parcTrapNotImplemented("Unicode is not supported.");
}
} else if (iscntrl(c)) {
// !! Syntax Error.
diff --git a/libparc/parc/algol/parc_JSONParser.h b/libparc/parc/algol/parc_JSONParser.h
index 18ee9d1a..425a2427 100755
--- a/libparc/parc/algol/parc_JSONParser.h
+++ b/libparc/parc/algol/parc_JSONParser.h
@@ -64,7 +64,7 @@ PARCJSONParser *parcJSONParser_Create(PARCBuffer *buffer);
/**
* Assert that an instance of `PARCJSONParser` is valid.
*
- * If the instance is not valid, terminate via {@link trapIllegalValue()}
+ * If the instance is not valid, terminate via {@link parcTrapIllegalValue()}
*
* Valid means the internal state of the type is consistent with its required current or future behaviour.
* This may include the validation of internal instances of types.
diff --git a/libparc/parc/algol/parc_JSONValue.c b/libparc/parc/algol/parc_JSONValue.c
index 3a3ba9cd..f5aff0b4 100755
--- a/libparc/parc/algol/parc_JSONValue.c
+++ b/libparc/parc/algol/parc_JSONValue.c
@@ -17,7 +17,7 @@
*/
#include <config.h>
-#include <LongBow/runtime.h>
+#include <parc/assert/parc_Assert.h>
#include <stdio.h>
#include <ctype.h>
@@ -463,7 +463,7 @@ _displayNumber(const PARCJSONValue *value, int indentation)
void
parcJSONValue_AssertValid(const PARCJSONValue *value)
{
- assertNotNull(value, "PARCJSONValue cannot be NULL.");
+ parcAssertNotNull(value, "PARCJSONValue cannot be NULL.");
}
bool
@@ -577,7 +577,7 @@ parcJSONValue_CreateFromString(PARCBuffer *value)
PARCJSONValue *
parcJSONValue_CreateFromCString(const char *value)
{
- assertNotNull(value, "String cannot be NULL.");
+ parcAssertNotNull(value, "String cannot be NULL.");
PARCJSONValue *result = _createValue(PARCJSONValueType_String);
if (result != NULL) {
@@ -663,7 +663,7 @@ parcJSONValue_Display(const PARCJSONValue *value, int indentation)
parcDisplayIndented_PrintLine(indentation + 1, ".value=null");
break;
default:
- trapIllegalValue(value->type, "Unknown PARCJSONValue type %d", value->type);
+ parcTrapIllegalValue(value->type, "Unknown PARCJSONValue type %d", value->type);
}
}
parcDisplayIndented_PrintLine(indentation, "}");
@@ -739,7 +739,7 @@ parcJSONValue_GetArray(const PARCJSONValue *value)
{
parcJSONValue_OptionalAssertValid(value);
- trapUnexpectedStateIf(!parcJSONValue_IsArray(value), "Expected type to be array, actual type %d", value->type);
+ parcTrapUnexpectedStateIf(!parcJSONValue_IsArray(value), "Expected type to be array, actual type %d", value->type);
return value->value.array;
}
@@ -749,7 +749,7 @@ parcJSONValue_GetBoolean(const PARCJSONValue *value)
{
parcJSONValue_OptionalAssertValid(value);
- trapUnexpectedStateIf(!parcJSONValue_IsBoolean(value), "Expected type to be boolean, actual type %d", value->type);
+ parcTrapUnexpectedStateIf(!parcJSONValue_IsBoolean(value), "Expected type to be boolean, actual type %d", value->type);
return value->value.boolean;
}
@@ -793,7 +793,7 @@ parcJSONValue_GetString(const PARCJSONValue *value)
{
parcJSONValue_OptionalAssertValid(value);
- trapUnexpectedStateIf(!parcJSONValue_IsString(value), "Expected type to be string, actual type %d", value->type);
+ parcTrapUnexpectedStateIf(!parcJSONValue_IsString(value), "Expected type to be string, actual type %d", value->type);
return value->value.string;
}
@@ -803,7 +803,7 @@ parcJSONValue_GetJSON(const PARCJSONValue *value)
{
parcJSONValue_OptionalAssertValid(value);
- trapUnexpectedStateIf(!parcJSONValue_IsJSON(value), "Expected type to be string, actual type %d", value->type);
+ parcTrapUnexpectedStateIf(!parcJSONValue_IsJSON(value), "Expected type to be string, actual type %d", value->type);
return value->value.object;
}
@@ -811,7 +811,7 @@ parcJSONValue_GetJSON(const PARCJSONValue *value)
struct timeval *
parcJSONValue_GetTimeval(const PARCJSONValue *jsonTimeval, struct timeval *timeval)
{
- assertNotNull(jsonTimeval, "Parameter jsonTimeval must be a non-null PARCJSON pointer.");
+ parcAssertNotNull(jsonTimeval, "Parameter jsonTimeval must be a non-null PARCJSON pointer.");
PARCJSON *json = parcJSONValue_GetJSON(jsonTimeval);
PARCJSONValue *value = parcJSON_GetValueByName(json, "seconds");
@@ -825,7 +825,7 @@ parcJSONValue_GetTimeval(const PARCJSONValue *jsonTimeval, struct timeval *timev
struct timespec *
parcJSONValue_GetTimespec(const PARCJSONValue *jsonTimespec, struct timespec *timespec)
{
- assertNotNull(jsonTimespec, "Parameter jsonTimeval must be a non-null PARCJSON pointer.");
+ parcAssertNotNull(jsonTimespec, "Parameter jsonTimeval must be a non-null PARCJSON pointer.");
PARCJSON *json = parcJSONValue_GetJSON(jsonTimespec);
PARCJSONValue *value = parcJSON_GetValueByName(json, "seconds");
@@ -911,7 +911,7 @@ parcJSONValue_BuildString(const PARCJSONValue *value, PARCBufferComposer *compos
} else if (value->type == PARCJSONValueType_Null) {
parcBufferComposer_PutString(composer, "null");
} else {
- trapIllegalValue(value->type, "Unknown value type: %d", value->type);
+ parcTrapIllegalValue(value->type, "Unknown value type: %d", value->type);
}
return composer;
diff --git a/libparc/parc/algol/parc_JSONValue.h b/libparc/parc/algol/parc_JSONValue.h
index 300a1c0c..0f93b2bc 100755
--- a/libparc/parc/algol/parc_JSONValue.h
+++ b/libparc/parc/algol/parc_JSONValue.h
@@ -174,7 +174,7 @@ bool parcJSONValue_IsValid(const PARCJSONValue *value);
/**
* Assert that an instance of `PARCJSONValue` is valid.
*
- * If the instance is not valid, terminate via {@link trapIllegalValue()}
+ * If the instance is not valid, terminate via {@link parcTrapIllegalValue()}
*
* Valid means the internal state of the type is consistent with its required current or future behaviour.
* This may include the validation of internal instances of types.
diff --git a/libparc/parc/algol/parc_KeyValue.c b/libparc/parc/algol/parc_KeyValue.c
index 27b20f35..352bf3e8 100755
--- a/libparc/parc/algol/parc_KeyValue.c
+++ b/libparc/parc/algol/parc_KeyValue.c
@@ -24,7 +24,7 @@
#include "parc_KeyValue.h"
#include "parc_Object.h"
-#include <LongBow/runtime.h>
+#include <parc/assert/parc_Assert.h>
struct parc_key_value {
PARCObject *key;
@@ -52,10 +52,10 @@ PARCKeyValue *
parcKeyValue_Create(const PARCObject *key,
const PARCObject *value)
{
- assertNotNull(key, "Key may not be null in a KeyValue element");
+ parcAssertNotNull(key, "Key may not be null in a KeyValue element");
PARCKeyValue *keyValue = parcObject_CreateInstance(PARCKeyValue);
- assertNotNull(keyValue, "parcMemory_Allocate(%zu) returned NULL", sizeof(PARCKeyValue));
+ parcAssertNotNull(keyValue, "parcMemory_Allocate(%zu) returned NULL", sizeof(PARCKeyValue));
keyValue->key = parcObject_Acquire(key);
keyValue->value = NULL;
@@ -82,7 +82,7 @@ parcKeyValue_Copy(const PARCKeyValue *source)
void
parcKeyValue_SetValue(PARCKeyValue *keyValue, PARCObject *value)
{
- assertNotNull(keyValue, "Not a valid keyValue");
+ parcAssertNotNull(keyValue, "Not a valid keyValue");
PARCObject *oldValue = keyValue->value;
if (value != NULL) {
keyValue->value = parcObject_Acquire(value);
@@ -97,7 +97,7 @@ parcKeyValue_SetValue(PARCKeyValue *keyValue, PARCObject *value)
void
parcKeyValue_SetKey(PARCKeyValue *keyValue, PARCObject *key)
{
- assertNotNull(keyValue, "Not a valid keyValue");
+ parcAssertNotNull(keyValue, "Not a valid keyValue");
PARCObject *oldKey = keyValue->key;
keyValue->key = parcObject_Acquire(key);
parcObject_Release(&oldKey);
@@ -106,14 +106,14 @@ parcKeyValue_SetKey(PARCKeyValue *keyValue, PARCObject *key)
PARCObject *
parcKeyValue_GetValue(PARCKeyValue *keyValue)
{
- assertNotNull(keyValue, "Not a valid keyValue");
+ parcAssertNotNull(keyValue, "Not a valid keyValue");
return keyValue->value;
}
PARCObject *
parcKeyValue_GetKey(PARCKeyValue *keyValue)
{
- assertNotNull(keyValue, "Not a valid keyValue");
+ parcAssertNotNull(keyValue, "Not a valid keyValue");
return keyValue->key;
}
diff --git a/libparc/parc/algol/parc_KeyedElement.c b/libparc/parc/algol/parc_KeyedElement.c
index a55de891..265987cd 100755
--- a/libparc/parc/algol/parc_KeyedElement.c
+++ b/libparc/parc/algol/parc_KeyedElement.c
@@ -21,7 +21,7 @@
#include <string.h>
-#include <LongBow/runtime.h>
+#include <parc/assert/parc_Assert.h>
#include <parc/algol/parc_KeyedElement.h>
#include <parc/algol/parc_Memory.h>
@@ -36,10 +36,10 @@ PARCKeyedElement *
parcKeyedElement_Create(void *data, const void *key, size_t keylen)
{
PARCKeyedElement *keyedElement = parcMemory_Allocate(sizeof(PARCKeyedElement));
- assertNotNull(keyedElement, "parcMemory_Allocate(%zu) returned NULL", sizeof(PARCKeyedElement));
+ parcAssertNotNull(keyedElement, "parcMemory_Allocate(%zu) returned NULL", sizeof(PARCKeyedElement));
keyedElement->element = data;
keyedElement->key = parcMemory_Allocate(sizeof(PARCKeyedElement));
- assertNotNull(keyedElement->key, "parcMemory_Allocate(%zu) returned NULL", sizeof(PARCKeyedElement));
+ parcAssertNotNull(keyedElement->key, "parcMemory_Allocate(%zu) returned NULL", sizeof(PARCKeyedElement));
memcpy(keyedElement->key, key, keylen);
keyedElement->keylen = keylen;
return keyedElement;
diff --git a/libparc/parc/algol/parc_LinkedList.c b/libparc/parc/algol/parc_LinkedList.c
index d220e223..b5bbd0a6 100644
--- a/libparc/parc/algol/parc_LinkedList.c
+++ b/libparc/parc/algol/parc_LinkedList.c
@@ -17,7 +17,7 @@
*/
#include <config.h>
-#include <LongBow/runtime.h>
+#include <parc/assert/parc_Assert.h>
#include <stdio.h>
#include <sys/queue.h>
@@ -136,7 +136,7 @@ static void
_parcLinkedListIterator_IsValid(const _PARCLinkedListNode *node)
{
if (node != NULL) {
- assertTrue(_parcLinkedListNode_IsValid(node), "node is invalid");
+ parcAssertTrue(_parcLinkedListNode_IsValid(node), "node is invalid");
}
}
@@ -183,12 +183,12 @@ _parcLinkedListNode_Next(PARCLinkedList *list __attribute__((unused)), const _PA
if (node == NULL) {
result = list->head;
} else {
- assertTrue(_parcLinkedListNode_IsValid(node), "node is invalid");
- trapOutOfBoundsIf(node->next == NULL, "No more elements.");
+ parcAssertTrue(_parcLinkedListNode_IsValid(node), "node is invalid");
+ parcTrapOutOfBoundsIf(node->next == NULL, "No more elements.");
result = node->next;
}
- assertTrue(_parcLinkedListNode_IsValid(result), "result is invalid");
+ parcAssertTrue(_parcLinkedListNode_IsValid(result), "result is invalid");
parcObject_OptionalAssertValid(result->object);
return result;
@@ -244,12 +244,12 @@ _parcLinkedListNode_HasNext(PARCLinkedList *list, const _PARCLinkedListNode *nod
if (node == NULL) {
result = (list->head != NULL);
if (result) {
- assertTrue(_parcLinkedListNode_IsValid(list->head), "node is invalid");
+ parcAssertTrue(_parcLinkedListNode_IsValid(list->head), "node is invalid");
}
} else {
result = node->next != NULL;
if (result) {
- assertTrue(_parcLinkedListNode_IsValid(node->next), "node is invalid");
+ parcAssertTrue(_parcLinkedListNode_IsValid(node->next), "node is invalid");
}
}
@@ -333,7 +333,7 @@ parcLinkedList_IsValid(const PARCLinkedList *list)
void
parcLinkedList_AssertValid(const PARCLinkedList *instance)
{
- assertTrue(parcLinkedList_IsValid(instance),
+ parcAssertTrue(parcLinkedList_IsValid(instance),
"PARCLinkedList is not valid.");
}
@@ -462,7 +462,7 @@ parcLinkedList_RemoveLast(PARCLinkedList *list)
bool
parcLinkedList_Remove(PARCLinkedList *list, const PARCObject *element)
{
- assertTrue(element != NULL, "Element must not be NULL");
+ parcAssertTrue(element != NULL, "Element must not be NULL");
bool result = false;
_PARCLinkedListNode *node = _parcLinkedListNode_getByValue(list, element);
@@ -592,7 +592,7 @@ parcLinkedList_SetAtIndex(PARCLinkedList *list, size_t index, PARCObject *elemen
PARCObject *result = NULL;
if (index > (parcLinkedList_Size(list) - 1)) {
- trapOutOfBounds(index, "[0, %zd]", parcLinkedList_Size(list) - 1);
+ parcTrapOutOfBounds(index, "[0, %zd]", parcLinkedList_Size(list) - 1);
}
_PARCLinkedListNode *node = _parcLinkedListNode_getByIndex(list, index);
@@ -607,7 +607,7 @@ PARCObject *
parcLinkedList_GetAtIndex(const PARCLinkedList *list, size_t index)
{
if (index > (parcLinkedList_Size(list) - 1)) {
- trapOutOfBounds(index, "[0, %zd]", parcLinkedList_Size(list) - 1);
+ parcTrapOutOfBounds(index, "[0, %zd]", parcLinkedList_Size(list) - 1);
}
_PARCLinkedListNode *node = _parcLinkedListNode_getByIndex(list, index);
diff --git a/libparc/parc/algol/parc_LinkedList.h b/libparc/parc/algol/parc_LinkedList.h
index 7babff79..381e2a18 100644
--- a/libparc/parc/algol/parc_LinkedList.h
+++ b/libparc/parc/algol/parc_LinkedList.h
@@ -421,7 +421,7 @@ bool parcLinkedList_IsEmpty(const PARCLinkedList *list);
* @param [in] list A pointer to a `PARCLinkedList` instance.
* @param [in] index The index of the element to be retrieved.
*
- * @throws `trapOutOfBounds`
+ * @throws `parcTrapOutOfBounds`
*
* Example:
* @code
@@ -437,7 +437,7 @@ PARCObject *parcLinkedList_GetAtIndex(const PARCLinkedList *list, size_t index);
* @param [in] index The index of the element to be replaced.
* @param [in] element A pointer to a valid PARCObject instance that will replace the current element at @p index.
*
- * @throws `trapOutOfBounds`
+ * @throws `parcTrapOutOfBounds`
*
* Example:
* @code
diff --git a/libparc/parc/algol/parc_List.c b/libparc/parc/algol/parc_List.c
index 0e62cda6..bdb343f8 100644
--- a/libparc/parc/algol/parc_List.c
+++ b/libparc/parc/algol/parc_List.c
@@ -17,7 +17,7 @@
*/
#include <config.h>
-#include <LongBow/runtime.h>
+#include <parc/assert/parc_Assert.h>
#include <stdio.h>
#include <stdarg.h>
diff --git a/libparc/parc/algol/parc_List.h b/libparc/parc/algol/parc_List.h
index 6c17453c..d6d94adf 100644
--- a/libparc/parc/algol/parc_List.h
+++ b/libparc/parc/algol/parc_List.h
@@ -364,7 +364,7 @@ void parcList_Release(PARCList **listPtr);
* @return NULL Memory could not be allocated.
* @return non-NULL A pointer to a new `PARCList` instance.
*
- * @throws trapIllegalValue if @p instance is NULL.
+ * @throws parcTrapIllegalValue if @p instance is NULL.
*
* Example:
* @code
@@ -429,7 +429,7 @@ bool parcList_Add(PARCList *list, void *element);
* parcList_AddAll(array, 3, elements);
* size_t actual = parcList_Length(array);
*
- * assertTrue(3 == actual, "Expected=%d, actual=%d", 3, actual);
+ * parcAssertTrue(3 == actual, "Expected=%d, actual=%d", 3, actual);
*
* parcListRelease(&array);
* }
diff --git a/libparc/parc/algol/parc_Memory.c b/libparc/parc/algol/parc_Memory.c
index e444baba..eebdadf0 100755
--- a/libparc/parc/algol/parc_Memory.c
+++ b/libparc/parc/algol/parc_Memory.c
@@ -17,7 +17,7 @@
*/
#include <config.h>
-#include <LongBow/runtime.h>
+#include <parc/assert/parc_Assert.h>
#include <unistd.h>
#include <stdlib.h>
@@ -37,7 +37,7 @@ static const PARCMemoryInterface *parcMemory = &PARCStdlibMemoryAsPARCMemory;
const PARCMemoryInterface *
parcMemory_SetInterface(const PARCMemoryInterface *memoryProvider)
{
- assertFalse(memoryProvider == &PARCMemoryAsPARCMemory,
+ parcAssertFalse(memoryProvider == &PARCMemoryAsPARCMemory,
"You cannot use PARCMemoryAsPARCMemory as a memory provider for parcMemory.");
const PARCMemoryInterface *result = parcMemory;
parcMemory = memoryProvider;
diff --git a/libparc/parc/algol/parc_Network.c b/libparc/parc/algol/parc_Network.c
index 35279648..2b6c8888 100644
--- a/libparc/parc/algol/parc_Network.c
+++ b/libparc/parc/algol/parc_Network.c
@@ -17,7 +17,7 @@
*/
#include <config.h>
-#include <LongBow/runtime.h>
+#include <parc/assert/parc_Assert.h>
#include <sys/socket.h>
#include <ctype.h>
@@ -49,9 +49,9 @@ parcNetwork_SockAddress(const char *address, in_port_t port)
switch (ai->ai_family) {
case PF_INET: {
struct sockaddr_in *result = parcMemory_AllocateAndClear(sizeof(struct sockaddr_in));
- assertNotNull(result, "parcMemory_AllocateAndClear(%zu) returned NULL", sizeof(struct sockaddr_in));
+ parcAssertNotNull(result, "parcMemory_AllocateAndClear(%zu) returned NULL", sizeof(struct sockaddr_in));
if (result != NULL) {
- assertTrue(ai->ai_addrlen == sizeof(struct sockaddr_in),
+ parcAssertTrue(ai->ai_addrlen == sizeof(struct sockaddr_in),
"Sockaddr wrong length, expected %zu got %u", sizeof(struct sockaddr_in), ai->ai_addrlen);
memcpy(result, ai->ai_addr, ai->ai_addrlen);
result->sin_port = htons(port);
@@ -62,9 +62,9 @@ parcNetwork_SockAddress(const char *address, in_port_t port)
case PF_INET6: {
struct sockaddr_in6 *result = parcMemory_AllocateAndClear(sizeof(struct sockaddr_in6));
- assertNotNull(result, "parcMemory_AllocateAndClear(%zu) returned NULL", sizeof(struct sockaddr_in6));
+ parcAssertNotNull(result, "parcMemory_AllocateAndClear(%zu) returned NULL", sizeof(struct sockaddr_in6));
if (result != NULL) {
- assertTrue(ai->ai_addrlen == sizeof(struct sockaddr_in6),
+ parcAssertTrue(ai->ai_addrlen == sizeof(struct sockaddr_in6),
"Sockaddr wrong length, expected %zu got %u", sizeof(struct sockaddr_in6), ai->ai_addrlen);
memcpy(result, ai->ai_addr, ai->ai_addrlen);
@@ -93,7 +93,7 @@ struct sockaddr_in *
parcNetwork_SockInet4Address(const char *address, in_port_t port)
{
struct sockaddr_in *result = parcMemory_AllocateAndClear(sizeof(struct sockaddr_in));
- assertNotNull(result, "parcMemory_AllocateAndClear(%zu) returned NULL", sizeof(struct sockaddr_in));
+ parcAssertNotNull(result, "parcMemory_AllocateAndClear(%zu) returned NULL", sizeof(struct sockaddr_in));
if (result != NULL) {
result->sin_family = AF_INET;
result->sin_port = htons(port);
@@ -113,7 +113,7 @@ struct sockaddr_in6 *
parcNetwork_SockInet6Address(const char *address, in_port_t port, uint32_t flowInfo, uint32_t scopeId)
{
struct sockaddr_in6 *result = parcMemory_AllocateAndClear(sizeof(struct sockaddr_in6));
- assertNotNull(result, "parcMemory_AllocateAndClear(%zu) returned NULL", sizeof(struct sockaddr_in6));
+ parcAssertNotNull(result, "parcMemory_AllocateAndClear(%zu) returned NULL", sizeof(struct sockaddr_in6));
if (result != NULL) {
result->sin6_family = AF_INET6;
result->sin6_port = htons(port);
@@ -136,7 +136,7 @@ struct sockaddr_in *
parcNetwork_SockInet4AddressAny()
{
struct sockaddr_in *result = parcMemory_AllocateAndClear(sizeof(struct sockaddr_in));
- assertNotNull(result, "parcMemory_AllocateAndClear(%zu) returned NULL", sizeof(struct sockaddr_in));
+ parcAssertNotNull(result, "parcMemory_AllocateAndClear(%zu) returned NULL", sizeof(struct sockaddr_in));
if (result != NULL) {
result->sin_family = AF_INET;
result->sin_addr.s_addr = INADDR_ANY;
@@ -151,10 +151,10 @@ parcNetwork_SockInet4AddressAny()
PARCBufferComposer *
parcNetwork_SockInet4Address_BuildString(const struct sockaddr_in *address, PARCBufferComposer *composer)
{
- assertNotNull(address, "Parameter must be a non-null pointer to a struct sockaddr_in.");
+ parcAssertNotNull(address, "Parameter must be a non-null pointer to a struct sockaddr_in.");
if (address->sin_family != AF_INET) {
- trapIllegalValue(address->sin_family, "Expected an AF_INET configured address, not %d", address->sin_family);
+ parcTrapIllegalValue(address->sin_family, "Expected an AF_INET configured address, not %d", address->sin_family);
}
char buffer[INET_ADDRSTRLEN];
@@ -167,10 +167,10 @@ parcNetwork_SockInet4Address_BuildString(const struct sockaddr_in *address, PARC
PARCBufferComposer *
parcNetwork_SockInet6Address_BuildString(const struct sockaddr_in6 *address, PARCBufferComposer *composer)
{
- assertNotNull(address, "Parameter must be a non-null pointer to a struct sockaddr_in.");
+ parcAssertNotNull(address, "Parameter must be a non-null pointer to a struct sockaddr_in.");
if (address->sin6_family != AF_INET6) {
- trapIllegalValue(address->sin_family, "Expected an AF_INET6 configured address, not %d", address->sin6_family);
+ parcTrapIllegalValue(address->sin_family, "Expected an AF_INET6 configured address, not %d", address->sin6_family);
}
char buffer[INET6_ADDRSTRLEN];
@@ -297,13 +297,13 @@ parcNetwork_ParseLinkAddress(const char *address)
if (parcNetwork_ParseMAC48Address(&address[7], result) == false) {
parcBuffer_Release(&result);
- trapIllegalValue(address, "Syntax error '%s'", address);
+ parcTrapIllegalValue(address, "Syntax error '%s'", address);
}
return parcBuffer_Flip(result);
}
- trapIllegalValue(address, "Bad scheme '%s'", address);
+ parcTrapIllegalValue(address, "Bad scheme '%s'", address);
}
bool
@@ -366,7 +366,7 @@ _isInet4Loopback(struct sockaddr_in *sin4)
bool
parcNetwork_IsSocketLocal(struct sockaddr *sock)
{
- assertNotNull(sock, "Parameter sock must be non-null");
+ parcAssertNotNull(sock, "Parameter sock must be non-null");
bool isLocal = false;
switch (sock->sa_family) {
diff --git a/libparc/parc/algol/parc_Network.h b/libparc/parc/algol/parc_Network.h
index efd5e632..bf7cfcbd 100644
--- a/libparc/parc/algol/parc_Network.h
+++ b/libparc/parc/algol/parc_Network.h
@@ -55,24 +55,24 @@ typedef uint16_t in_port_t;
* {
* struct sockaddr *addr;
* addr = parcNetwork_SockAddress("1.2.3.4", 555);
- * assertTrue(addr && addr->sa_family == AF_INET, "Addr not IPv4 for a dotted quad.");
+ * parcAssertTrue(addr && addr->sa_family == AF_INET, "Addr not IPv4 for a dotted quad.");
* struct sockaddr_in *addr_in = (struct sockaddr_in *) addr;
* // ...
* parcMemory_Deallocate((void **)&addr);
*
* addr = parcNetwork_SockAddress("fe80::aa20:66ff:fe00:314a", 555);
- * assertTrue(addr && addr->sa_family == AF_INET6, "Addr not IPv6.");
+ * parcAssertTrue(addr && addr->sa_family == AF_INET6, "Addr not IPv6.");
* struct sockaddr_in6 *addr_in6 = (struct sockaddr_in6 *) addr;
* // ...
* parcMemory_Deallocate((void **)&addr);
*
* addr = parcNetwork_SockAddress("alpha.parc.com", 555);
- * assertTrue(addr && addr->sa_family == AF_INET, "Addr not IPv4 hostname with only ipv4 address.");
+ * parcAssertTrue(addr && addr->sa_family == AF_INET, "Addr not IPv4 hostname with only ipv4 address.");
* // ...
* parcMemory_Deallocate((void **)&addr);
*
* addr = parcNetwork_SockAddress("Over the rainbow, way up high", 555);
- * assertNull(addr, "Addr no null for bogus name.");
+ * parcAssertNull(addr, "Addr no null for bogus name.");
*
* }
* @endcode
@@ -256,7 +256,7 @@ struct sockaddr_in *parcNetwork_ParseInet4Address(const char *addressURI);
* @code
* {
* struct sockaddr *s = parcNetwork_SockAddress("127.1.1.1", 5900);
- * assertTrue(parcNetwork_IsSocketLocal(s), "This will not assert");
+ * parcAssertTrue(parcNetwork_IsSocketLocal(s), "This will not assert");
* parcMemory_Deallocate((void **)&s);
* }
* @endcode
diff --git a/libparc/parc/algol/parc_Object.c b/libparc/parc/algol/parc_Object.c
index 578f1e1a..70a24f34 100644
--- a/libparc/parc/algol/parc_Object.c
+++ b/libparc/parc/algol/parc_Object.c
@@ -17,7 +17,7 @@
*/
#include <config.h>
-#include <LongBow/runtime.h>
+#include <parc/assert/parc_Assert.h>
#include <stdio.h>
#include <inttypes.h>
@@ -246,7 +246,7 @@ _parcObject_ToString(const PARCObject *object)
"Object@%p { .references=%" PRId64 ", .objectLength = %zd, .objectAlignment=%u } data %p\n",
(void *) header,
header->references, header->descriptor->objectSize, header->descriptor->objectAlignment, object);
- assertTrue(nwritten >= 0, "Error calling asprintf");
+ parcAssertTrue(nwritten >= 0, "Error calling asprintf");
char *result = parcMemory_StringDuplicate(string, strlen(string));
free(string);
return result;
@@ -265,7 +265,7 @@ _parcObject_ToJSON(const PARCObject *object)
char *addressString;
int nwritten = asprintf(&addressString, "%p", object);
- assertTrue(nwritten >= 0, "Error calling asprintf");
+ parcAssertTrue(nwritten >= 0, "Error calling asprintf");
parcJSON_AddString(json, "address", addressString);
@@ -335,17 +335,17 @@ parcObject_IsValid(const PARCObject *object)
static inline void
_parcObjectHeader_AssertValid(const _PARCObjectHeader *header, const PARCObject *object)
{
- trapIllegalValueIf(header->magicGuardNumber != PARCObject_HEADER_MAGIC_GUARD_NUMBER, "PARCObject@%p is corrupt.", object);
- trapIllegalValueIf(header->descriptor == NULL, "PARCObject@%p descriptor cannot be NULL.", object);
+ parcTrapIllegalValueIf(header->magicGuardNumber != PARCObject_HEADER_MAGIC_GUARD_NUMBER, "PARCObject@%p is corrupt.", object);
+ parcTrapIllegalValueIf(header->descriptor == NULL, "PARCObject@%p descriptor cannot be NULL.", object);
if (header->descriptor->isLockable) {
- trapIllegalValueIf(header->locking == NULL, "PARCObject@%p is corrupt. Is Lockable but no locking structure", object);
+ parcTrapIllegalValueIf(header->locking == NULL, "PARCObject@%p is corrupt. Is Lockable but no locking structure", object);
}
}
static inline void
_parcObject_AssertValid(const PARCObject *object)
{
- trapIllegalValueIf(object == NULL, "PARCObject must be a non-null pointer.");
+ parcTrapIllegalValueIf(object == NULL, "PARCObject must be a non-null pointer.");
_PARCObjectHeader *header = _parcObject_Header(object);
_parcObjectHeader_AssertValid(header, object);
@@ -628,7 +628,7 @@ parcObject_Release(PARCObject **objectPointer)
_PARCObjectHeader *header = _parcObject_Header(object);
- trapIllegalValueIf(header->references == 0, "PARCObject@%p references must be > 0", object);
+ parcTrapIllegalValueIf(header->references == 0, "PARCObject@%p references must be > 0", object);
PARCReferenceCount result = parcAtomicUint64_Decrement(&header->references);
@@ -641,9 +641,9 @@ parcObject_Release(PARCObject **objectPointer)
void *origin = _parcObject_Origin(object);
parcMemory_Deallocate(&origin);
}
- assertNotNull(*objectPointer, "Class implementation unnecessarily clears the object pointer.");
+ parcAssertNotNull(*objectPointer, "Class implementation unnecessarily clears the object pointer.");
} else {
- assertNull(*objectPointer, "Class implementation must clear the object pointer.");
+ parcAssertNull(*objectPointer, "Class implementation must clear the object pointer.");
}
}
@@ -675,7 +675,7 @@ const PARCObjectDescriptor *
parcObject_SetDescriptor(PARCObject *object, const PARCObjectDescriptor *descriptor)
{
parcObject_OptionalAssertValid(object);
- assertNotNull(descriptor, "PARCObjectDescriptor cannot be NULL.");
+ parcAssertNotNull(descriptor, "PARCObjectDescriptor cannot be NULL.");
_PARCObjectHeader *header = _parcObject_Header(object);
@@ -702,7 +702,7 @@ parcObjectDescriptor_Create(const char *name,
const PARCObjectDescriptor *superType,
PARCObjectTypeState *typeState)
{
- assertNotNull(superType, "Supertype descriptor cannot be NULL.");
+ parcAssertNotNull(superType, "Supertype descriptor cannot be NULL.");
PARCObjectDescriptor *result = parcMemory_AllocateAndClear(sizeof(PARCObjectDescriptor));
if (result != NULL) {
@@ -773,7 +773,7 @@ parcObject_Unlock(const PARCObject *object)
locking->locker = (pthread_t) NULL;
result = (pthread_mutex_unlock(&locking->lock) == 0);
- assertTrue(result, "Attempted to unlock an unowned lock.");
+ parcAssertTrue(result, "Attempted to unlock an unowned lock.");
}
}
}
@@ -793,7 +793,7 @@ parcObject_Lock(const PARCObject *object)
if (object != NULL) {
_PARCObjectLocking *locking = _parcObjectHeader_Locking(object);
if (locking != NULL) {
- trapCannotObtainLockIf(pthread_equal(locking->locker, pthread_self()),
+ parcTrapCannotObtainLockIf(pthread_equal(locking->locker, pthread_self()),
"Recursive locks on %p are not supported.", object);
errno = pthread_mutex_lock(&locking->lock);
@@ -818,7 +818,7 @@ parcObject_TryLock(const PARCObject *object)
_PARCObjectLocking *locking = _parcObjectHeader_Locking(object);
if (locking != NULL) {
- trapCannotObtainLockIf(pthread_equal(locking->locker, pthread_self()), "Recursive locks are not supported.");
+ parcTrapCannotObtainLockIf(pthread_equal(locking->locker, pthread_self()), "Recursive locks are not supported.");
int lockStatus = pthread_mutex_trylock(&locking->lock);
diff --git a/libparc/parc/algol/parc_Object.h b/libparc/parc/algol/parc_Object.h
index 0f3a932b..ac7e9652 100644
--- a/libparc/parc/algol/parc_Object.h
+++ b/libparc/parc/algol/parc_Object.h
@@ -42,8 +42,7 @@
#include <stdint.h>
#include <time.h>
-#include <LongBow/runtime.h>
-#include <LongBow/longBow_Compiler.h>
+#include <parc/assert/parc_Assert.h>
#include <parc/algol/parc_CMacro.h>
//#include <parc/algol/parc_JSON.h>
@@ -598,8 +597,11 @@ const PARCObjectDescriptor *parcObject_SetDescriptor(PARCObject *object, const P
* Create new `PARCObjectDescriptor` based on an existing `PARCObjectDescriptor.`
* The new `PARCObjectDescriptor` uses the existing `PARCObjectDescriptor` as the super-type of the new descriptor.
*/
+
+#ifdef __clang__
#define parcObject_Extends(_subtype, _superType, ...) \
- LongBowCompiler_IgnoreInitializerOverrides \
+ _Pragma("GCC diagnostic push") \
+ _Pragma("GCC diagnostic ignored \"-Winitializer-overrides\"") \
parcObjectDescriptor_Declaration(_subtype) = { \
.super = &parcObject_DescriptorName(_superType), \
.name = #_subtype, \
@@ -619,8 +621,33 @@ const PARCObjectDescriptor *parcObject_SetDescriptor(PARCObject *object, const P
.typeState = NULL, \
__VA_ARGS__ \
}; \
- LongBowCompiler_WarnInitializerOverrides \
+ _Pragma("GCC diagnostic pop") \
const PARCObjectDescriptor parcObject_DescriptorName(_subtype)
+#else
+ #define parcObject_Extends(_subtype, _superType, ...) \
+ _Pragma("GCC diagnostic ignored \"-Woverride-init\"") \
+ parcObjectDescriptor_Declaration(_subtype) = { \
+ .super = &parcObject_DescriptorName(_superType), \
+ .name = #_subtype, \
+ .objectSize = 0, \
+ .objectAlignment = 0, \
+ .destroy = NULL, \
+ .destructor = NULL, \
+ .release = NULL, \
+ .copy = NULL, \
+ .toString = NULL, \
+ .equals = NULL, \
+ .compare = NULL, \
+ .hashCode = NULL, \
+ .toJSON = NULL, \
+ .display = NULL, \
+ .isLockable = true, \
+ .typeState = NULL, \
+ __VA_ARGS__ \
+ }; \
+ _Pragma("GCC diagnostic warning \"-Woverride-init\"") \
+ const PARCObjectDescriptor parcObject_DescriptorName(_subtype)
+#endif
/**
* Define a new PARC Object implementation, by composing a new PARC Object Descriptor referencing an old one.
diff --git a/libparc/parc/algol/parc_OldSortedList.c b/libparc/parc/algol/parc_OldSortedList.c
index ef007388..c50d856d 100755
--- a/libparc/parc/algol/parc_OldSortedList.c
+++ b/libparc/parc/algol/parc_OldSortedList.c
@@ -17,7 +17,7 @@
*/
#include <config.h>
-#include <LongBow/runtime.h>
+#include <parc/assert/parc_Assert.h>
#include <parc/algol/parc_SortedList.h>
@@ -33,7 +33,7 @@ PARCSortedList *
parcSortedList_Create(parcSortedList_Compare compareFunction)
{
PARCSortedList *sortedList = parcMemory_Allocate(sizeof(PARCSortedList));
- assertNotNull(sortedList, "parcMemory_Allocate(%zu) returned NULL", sizeof(PARCSortedList));
+ parcAssertNotNull(sortedList, "parcMemory_Allocate(%zu) returned NULL", sizeof(PARCSortedList));
sortedList->arrayList = parcArrayList_Create(NULL);
sortedList->compare = compareFunction;
return sortedList;
@@ -50,9 +50,9 @@ parcSortedList_Destroy(PARCSortedList **parcSortedListPointer)
void
parcSortedList_Add(PARCSortedList *parcSortedList, void *newItem)
{
- assertNotNull(parcSortedList, "sortedList parameter can't be null");
- assertNotNull(parcSortedList->arrayList, "arrayList can't be null");
- assertNotNull(newItem, "newItem can't be null");
+ parcAssertNotNull(parcSortedList, "sortedList parameter can't be null");
+ parcAssertNotNull(parcSortedList->arrayList, "arrayList can't be null");
+ parcAssertNotNull(newItem, "newItem can't be null");
size_t total_items = parcArrayList_Size(parcSortedList->arrayList);
for (size_t i = 0; i < total_items; i++) {
@@ -77,8 +77,8 @@ parcSortedList_Length(PARCSortedList *parcSortedList)
void *
parcSortedList_PopFirst(PARCSortedList *parcSortedList)
{
- assertNotNull(parcSortedList, "sortedList parameter can't be null");
- assertNotNull(parcSortedList->arrayList, "arrayList can't be null");
+ parcAssertNotNull(parcSortedList, "sortedList parameter can't be null");
+ parcAssertNotNull(parcSortedList->arrayList, "arrayList can't be null");
if (parcArrayList_Size(parcSortedList->arrayList) == 0) {
return NULL;
@@ -91,8 +91,8 @@ parcSortedList_PopFirst(PARCSortedList *parcSortedList)
void *
parcSortedList_GetFirst(PARCSortedList *parcSortedList)
{
- assertNotNull(parcSortedList, "sortedList parameter can't be null");
- assertNotNull(parcSortedList->arrayList, "arrayList can't be null");
+ parcAssertNotNull(parcSortedList, "sortedList parameter can't be null");
+ parcAssertNotNull(parcSortedList->arrayList, "arrayList can't be null");
if (parcArrayList_Size(parcSortedList->arrayList) == 0) {
return NULL;
diff --git a/libparc/parc/algol/parc_PathName.c b/libparc/parc/algol/parc_PathName.c
index e329ee88..56e57d27 100755
--- a/libparc/parc/algol/parc_PathName.c
+++ b/libparc/parc/algol/parc_PathName.c
@@ -17,7 +17,7 @@
*/
#include <config.h>
-#include <LongBow/runtime.h>
+#include <parc/assert/parc_Assert.h>
#include <stdbool.h>
#include <stdio.h>
diff --git a/libparc/parc/algol/parc_PriorityQueue.c b/libparc/parc/algol/parc_PriorityQueue.c
index 93744b2c..c6c003b1 100755
--- a/libparc/parc/algol/parc_PriorityQueue.c
+++ b/libparc/parc/algol/parc_PriorityQueue.c
@@ -30,7 +30,7 @@
#include <config.h>
-#include <LongBow/runtime.h>
+#include <parc/assert/parc_Assert.h>
#include <stdio.h>
#include <stdbool.h>
@@ -263,8 +263,8 @@ _expand(PARCPriorityQueue *queue)
void
parcPriorityQueue_ParcFreeDestroyer(void **elementPtr)
{
- assertNotNull(elementPtr, "Double pointer must be non-null");
- assertNotNull(*elementPtr, "Double pointer must dereference to non-null");
+ parcAssertNotNull(elementPtr, "Double pointer must be non-null");
+ parcAssertNotNull(*elementPtr, "Double pointer must dereference to non-null");
void *element = *elementPtr;
parcMemory_Deallocate((void **) &element);
*elementPtr = NULL;
@@ -286,13 +286,13 @@ parcPriorityQueue_Uint64CompareTo(const void *a, const void *b)
PARCPriorityQueue *
parcPriorityQueue_Create(PARCPriorityQueueCompareTo *compare, PARCPriorityQueueDestroyer *destroyer)
{
- assertNotNull(compare, "Parameter compare must be non-null");
+ parcAssertNotNull(compare, "Parameter compare must be non-null");
size_t initialSize = 128;
PARCPriorityQueue *queue = parcMemory_AllocateAndClear(sizeof(PARCPriorityQueue));
- assertNotNull(queue, "parcMemory_AllocateAndClear(%zu) returned NULL", sizeof(PARCPriorityQueue));
+ parcAssertNotNull(queue, "parcMemory_AllocateAndClear(%zu) returned NULL", sizeof(PARCPriorityQueue));
queue->array = parcMemory_AllocateAndClear(sizeof(HeapEntry) * initialSize);
- assertNotNull(queue->array, "parcMemory_AllocateAndClear(%zu) returned NULL", sizeof(HeapEntry) * initialSize);
+ parcAssertNotNull(queue->array, "parcMemory_AllocateAndClear(%zu) returned NULL", sizeof(HeapEntry) * initialSize);
queue->capacity = initialSize;
queue->size = 0;
queue->compare = compare;
@@ -304,8 +304,8 @@ parcPriorityQueue_Create(PARCPriorityQueueCompareTo *compare, PARCPriorityQueueD
void
parcPriorityQueue_Destroy(PARCPriorityQueue **queuePtr)
{
- assertNotNull(queuePtr, "Double pointer must be non-null");
- assertNotNull(*queuePtr, "Double pointer must dereference to non-null");
+ parcAssertNotNull(queuePtr, "Double pointer must be non-null");
+ parcAssertNotNull(*queuePtr, "Double pointer must dereference to non-null");
PARCPriorityQueue *queue = *queuePtr;
parcPriorityQueue_Clear(queue);
parcMemory_Deallocate((void **) &(queue->array));
@@ -316,8 +316,8 @@ parcPriorityQueue_Destroy(PARCPriorityQueue **queuePtr)
bool
parcPriorityQueue_Add(PARCPriorityQueue *queue, void *data)
{
- assertNotNull(queue, "Parameter queue must be non-null");
- assertNotNull(data, "Parameter data must be non-null");
+ parcAssertNotNull(queue, "Parameter queue must be non-null");
+ parcAssertNotNull(data, "Parameter data must be non-null");
if (queue->size + 1 > queue->capacity) {
_expand(queue);
@@ -338,7 +338,7 @@ parcPriorityQueue_Add(PARCPriorityQueue *queue, void *data)
void
parcPriorityQueue_Clear(PARCPriorityQueue *queue)
{
- assertNotNull(queue, "Parameter queue must be non-null");
+ parcAssertNotNull(queue, "Parameter queue must be non-null");
if (queue->destroyer != NULL) {
for (size_t i = 0; i < queue->size; i++) {
queue->destroyer(&queue->array[i].data);
@@ -351,7 +351,7 @@ parcPriorityQueue_Clear(PARCPriorityQueue *queue)
void *
parcPriorityQueue_Peek(PARCPriorityQueue *queue)
{
- assertNotNull(queue, "Parameter queue must be non-null");
+ parcAssertNotNull(queue, "Parameter queue must be non-null");
if (queue->size > 0) {
return queue->array[0].data;
}
@@ -361,7 +361,7 @@ parcPriorityQueue_Peek(PARCPriorityQueue *queue)
void *
parcPriorityQueue_Poll(PARCPriorityQueue *queue)
{
- assertNotNull(queue, "Parameter queue must be non-null");
+ parcAssertNotNull(queue, "Parameter queue must be non-null");
if (queue->size > 0) {
void *data = queue->array[0].data;
@@ -382,6 +382,6 @@ parcPriorityQueue_Poll(PARCPriorityQueue *queue)
size_t
parcPriorityQueue_Size(const PARCPriorityQueue *queue)
{
- assertNotNull(queue, "Parameter queue must be non-null");
+ parcAssertNotNull(queue, "Parameter queue must be non-null");
return queue->size;
}
diff --git a/libparc/parc/algol/parc_Properties.c b/libparc/parc/algol/parc_Properties.c
index 19aea290..2a6c7d33 100644
--- a/libparc/parc/algol/parc_Properties.c
+++ b/libparc/parc/algol/parc_Properties.c
@@ -18,7 +18,7 @@
#include <config.h>
#include <stdio.h>
-#include <LongBow/runtime.h>
+#include <parc/assert/parc_Assert.h>
#include <parc/algol/parc_Object.h>
#include <parc/algol/parc_DisplayIndented.h>
@@ -35,7 +35,7 @@ struct PARCProperties {
static void
_parcProperties_Finalize(PARCProperties **instancePtr)
{
- assertNotNull(instancePtr, "Parameter must be a non-null pointer to a PARCProperties pointer.");
+ parcAssertNotNull(instancePtr, "Parameter must be a non-null pointer to a PARCProperties pointer.");
PARCProperties *instance = *instancePtr;
parcProperties_OptionalAssertValid(instance);
@@ -53,7 +53,7 @@ parcObject_ExtendPARCObject(PARCProperties, _parcProperties_Finalize, parcProper
void
parcProperties_AssertValid(const PARCProperties *instance)
{
- assertTrue(parcProperties_IsValid(instance),
+ parcAssertTrue(parcProperties_IsValid(instance),
"PARCProperties is not valid.");
}
@@ -94,7 +94,7 @@ void
parcProperties_Display(const PARCProperties *properties, int indentation)
{
parcDisplayIndented_PrintLine(indentation, "PARCProperties@%p {", properties);
- trapCannotObtainLockIf(parcHashMap_Lock(properties->properties) == false, "Cannot lock PARCProperties object.");
+ parcTrapCannotObtainLockIf(parcHashMap_Lock(properties->properties) == false, "Cannot lock PARCProperties object.");
PARCIterator *iterator = parcHashMap_CreateKeyIterator(properties->properties);
while (parcIterator_HasNext(iterator)) {
@@ -151,7 +151,7 @@ parcProperties_ToJSON(const PARCProperties *properties)
{
PARCJSON *result = parcJSON_Create();
- trapCannotObtainLockIf(parcHashMap_Lock(properties->properties) == false, "Cannot lock PARCProperties object.");
+ parcTrapCannotObtainLockIf(parcHashMap_Lock(properties->properties) == false, "Cannot lock PARCProperties object.");
PARCIterator *iterator = parcHashMap_CreateKeyIterator(properties->properties);
while (parcIterator_HasNext(iterator)) {
@@ -170,7 +170,7 @@ parcProperties_ToJSON(const PARCProperties *properties)
PARCBufferComposer *
parcProperties_BuildString(const PARCProperties *properties, PARCBufferComposer *composer)
{
- trapCannotObtainLockIf(parcHashMap_Lock(properties->properties) == false, "Cannot lock PARCProperties object.");
+ parcTrapCannotObtainLockIf(parcHashMap_Lock(properties->properties) == false, "Cannot lock PARCProperties object.");
PARCIterator *iterator = parcHashMap_CreateKeyIterator(properties->properties);
while (parcIterator_HasNext(iterator)) {
diff --git a/libparc/parc/algol/parc_RandomAccessFile.c b/libparc/parc/algol/parc_RandomAccessFile.c
index 65bff1d1..9a5e7914 100755
--- a/libparc/parc/algol/parc_RandomAccessFile.c
+++ b/libparc/parc/algol/parc_RandomAccessFile.c
@@ -33,7 +33,7 @@ struct PARCRandomAccessFile {
static void
_parcRandomAccessFile_Finalize(PARCRandomAccessFile **instancePtr)
{
- assertNotNull(instancePtr, "Parameter must be a non-null pointer to a PARCRandomAccessFile pointer.");
+ parcAssertNotNull(instancePtr, "Parameter must be a non-null pointer to a PARCRandomAccessFile pointer.");
PARCRandomAccessFile *instance = *instancePtr;
if (instance->fhandle != NULL) {
fclose(instance->fhandle);
@@ -55,7 +55,7 @@ parcObject_ExtendPARCObject(PARCRandomAccessFile, _parcRandomAccessFile_Finalize
void
parcRandomAccessFile_AssertValid(const PARCRandomAccessFile *instance)
{
- assertTrue(parcRandomAccessFile_IsValid(instance),
+ parcAssertTrue(parcRandomAccessFile_IsValid(instance),
"PARCRandomAccessFile is not valid.");
}
@@ -138,7 +138,7 @@ parcRandomAccessFile_Open(PARCFile *file)
bool
parcRandomAccessFile_Close(PARCRandomAccessFile *fileHandle)
{
- assertNotNull(fileHandle->fhandle, "Can't fclose a null pointer. How did they get one anyway?");
+ parcAssertNotNull(fileHandle->fhandle, "Can't fclose a null pointer. How did they get one anyway?");
bool result = fclose(fileHandle->fhandle) == 0;
fileHandle->fhandle = NULL;
parcMemory_Deallocate(&fileHandle->fname);
@@ -179,7 +179,7 @@ parcRandomAccessFile_Seek(PARCRandomAccessFile *fileHandle, long offset, PARCRan
result = fseek(fileHandle->fhandle, offset, SEEK_END); // end of the file
break;
default:
- assertTrue(false, "Invalid position %d", position);
+ parcAssertTrue(false, "Invalid position %d", position);
}
return result;
}
diff --git a/libparc/parc/algol/parc_SafeMemory.c b/libparc/parc/algol/parc_SafeMemory.c
index 1f152af9..76908548 100644
--- a/libparc/parc/algol/parc_SafeMemory.c
+++ b/libparc/parc/algol/parc_SafeMemory.c
@@ -36,7 +36,7 @@
*/
#include <config.h>
-#include <LongBow/runtime.h>
+#include <parc/assert/parc_Assert.h>
#if defined(_WIN64)
# define backtrace(...) (0)
@@ -340,7 +340,7 @@ _parcSafeMemory_Report(const PARCSafeMemoryUsable *safeMemory, int outputFd)
(void *) safeMemory,
(void *) prefix,
_parcSafeMemory_StateToString(_parcSafeMemory_GetState(safeMemory)));
- trapUnexpectedStateIf(charactersPrinted < 0, "Cannot write to file descriptor %d", outputFd);
+ parcTrapUnexpectedStateIf(charactersPrinted < 0, "Cannot write to file descriptor %d", outputFd);
}
_backtraceReport(prefix->backtrace, outputFd);
}
@@ -359,7 +359,7 @@ parcSafeMemory_ReportAllocation(int outputFd)
int charactersPrinted = dprintf(outputFd,
"\n%u SafeMemory@%p: %p={ .requestedLength=%zd, .actualLength=%zd, .alignment=%zd }\n",
index, e->memory, (void *) prefix, prefix->requestedLength, prefix->actualLength, prefix->alignment);
- trapUnexpectedStateIf(charactersPrinted < 0, "Cannot write to file descriptor %d", outputFd)
+ parcTrapUnexpectedStateIf(charactersPrinted < 0, "Cannot write to file descriptor %d", outputFd)
{
pthread_mutex_unlock(&head_mutex);
}
@@ -394,7 +394,7 @@ _parcSafeMemory_Destroy(void **memoryPointer)
PARCSafeMemoryUsable *memory = *memoryPointer;
PARCSafeMemoryState state = _parcSafeMemory_GetState(memory);
- trapUnexpectedStateIf(state != PARCSafeMemoryState_OK,
+ parcTrapUnexpectedStateIf(state != PARCSafeMemoryState_OK,
"Expected PARCSafeMemoryState_OK, actual %s (see parc_SafeMemory.h)",
_parcSafeMemory_StateToString(state))
{
@@ -474,7 +474,7 @@ _parcSafeMemory_FormatPrefix(PARCSafeMemoryOrigin *origin, size_t requestedLengt
PARCSafeMemoryUsable *result = _pointerAdd(origin, prefixSize);
- assertAligned(result, alignment, "Return value is not properly aligned to %zu", alignment);
+ parcAssertAligned(result, alignment, "Return value is not properly aligned to %zu", alignment);
return result;
}
diff --git a/libparc/parc/algol/parc_SafeMemory.h b/libparc/parc/algol/parc_SafeMemory.h
index 0383fe39..a2574e87 100644
--- a/libparc/parc/algol/parc_SafeMemory.h
+++ b/libparc/parc/algol/parc_SafeMemory.h
@@ -209,7 +209,7 @@ void parcSafeMemory_Deallocate(void **pointer);
* size_t newLength = 0;
* unsigned char *newMemory = parcSafeMemory_Reallocate(memory, newLength);
*
- * assertTrue(newMemory == NULL, "Expected NULL, actual %p", newMemory);
+ * parcAssertTrue(newMemory == NULL, "Expected NULL, actual %p", newMemory);
* }
* @endcode
*/
diff --git a/libparc/parc/algol/parc_SortedList.c b/libparc/parc/algol/parc_SortedList.c
index 8a941701..1efa25ea 100644
--- a/libparc/parc/algol/parc_SortedList.c
+++ b/libparc/parc/algol/parc_SortedList.c
@@ -32,7 +32,7 @@ struct PARCSortedList {
static void
_parcSortedList_Finalize(PARCSortedList **instancePtr)
{
- assertNotNull(instancePtr, "Parameter must be a non-null pointer to a PARCSortedList pointer.");
+ parcAssertNotNull(instancePtr, "Parameter must be a non-null pointer to a PARCSortedList pointer.");
PARCSortedList *instance = *instancePtr;
parcSortedList_OptionalAssertValid(instance);
@@ -50,7 +50,7 @@ parcObject_ExtendPARCObject(PARCSortedList, _parcSortedList_Finalize, parcSorted
void
parcSortedList_AssertValid(const PARCSortedList *instance)
{
- assertTrue(parcSortedList_IsValid(instance),
+ parcAssertTrue(parcSortedList_IsValid(instance),
"PARCSortedList is not valid.");
}
@@ -245,7 +245,7 @@ void
parcSortedList_Add(PARCSortedList *instance, PARCObject *element)
{
size_t insertionPoint = _parcSortedList_GetInsertionIndex(instance, element);
- assertTrue(insertionPoint >= 0 && insertionPoint <= parcLinkedList_Size(instance->list),
+ parcAssertTrue(insertionPoint >= 0 && insertionPoint <= parcLinkedList_Size(instance->list),
"%zd is bad insertion point. Must be >=0 and <= %zd", insertionPoint, parcLinkedList_Size(instance->list));
parcLinkedList_InsertAtIndex(instance->list, insertionPoint, element);
diff --git a/libparc/parc/algol/parc_Stack.c b/libparc/parc/algol/parc_Stack.c
index 5930169b..72cae53c 100755
--- a/libparc/parc/algol/parc_Stack.c
+++ b/libparc/parc/algol/parc_Stack.c
@@ -19,7 +19,7 @@
#include <stdio.h>
-#include <LongBow/runtime.h>
+#include <parc/assert/parc_Assert.h>
#include <parc/algol/parc_Memory.h>
#include <parc/algol/parc_Deque.h>
@@ -34,7 +34,7 @@ PARCStack *
parcStack(void *instance, PARCStackInterface *interface)
{
PARCStack *result = parcMemory_AllocateAndClear(sizeof(PARCStack));
- assertNotNull(result, "parcMemory_AllocateAndClear(%zu) returned NULL", sizeof(PARCStack));
+ parcAssertNotNull(result, "parcMemory_AllocateAndClear(%zu) returned NULL", sizeof(PARCStack));
result->instance = instance;
result->interface = interface;
diff --git a/libparc/parc/algol/parc_StdlibMemory.c b/libparc/parc/algol/parc_StdlibMemory.c
index a919f727..11381a54 100755
--- a/libparc/parc/algol/parc_StdlibMemory.c
+++ b/libparc/parc/algol/parc_StdlibMemory.c
@@ -25,7 +25,7 @@
#include <strings.h>
#include <pthread.h>
-#include <LongBow/runtime.h>
+#include <parc/assert/parc_Assert.h>
#include <parc/algol/parc_StdlibMemory.h>
@@ -132,7 +132,7 @@ void
parcStdlibMemory_Deallocate(void **pointer)
{
#ifndef PARCLibrary_DISABLE_VALIDATION
- trapIllegalValueIf(_parcStdlibMemory_OutstandingAllocations == 0,
+ parcTrapIllegalValueIf(_parcStdlibMemory_OutstandingAllocations == 0,
"parcStdlibMemory_Deallocate invoked with nothing left to free (double free somewhere?)\n");
#endif
free(*pointer);
diff --git a/libparc/parc/algol/parc_String.c b/libparc/parc/algol/parc_String.c
index e5af5f71..78aaf470 100755
--- a/libparc/parc/algol/parc_String.c
+++ b/libparc/parc/algol/parc_String.c
@@ -30,7 +30,7 @@ struct PARCString {
static bool
_parcString_Destructor(PARCString **instancePtr)
{
- assertNotNull(instancePtr, "Parameter must be a non-null pointer to a PARCString pointer.");
+ parcAssertNotNull(instancePtr, "Parameter must be a non-null pointer to a PARCString pointer.");
PARCString *string = *instancePtr;
parcMemory_Deallocate(&string->string);
@@ -55,7 +55,7 @@ parcObject_Override(PARCString, PARCObject,
void
parcString_AssertValid(const PARCString *instance)
{
- assertTrue(parcString_IsValid(instance),
+ parcAssertTrue(parcString_IsValid(instance),
"PARCString is not valid.");
}
diff --git a/libparc/parc/algol/parc_Time.c b/libparc/parc/algol/parc_Time.c
index 7cc358b9..07ab185b 100755
--- a/libparc/parc/algol/parc_Time.c
+++ b/libparc/parc/algol/parc_Time.c
@@ -22,7 +22,7 @@
#include <time.h>
#include <sys/time.h>
-#include <LongBow/runtime.h>
+#include <parc/assert/parc_Assert.h>
#include <parc/algol/parc_Time.h>
#include <parc/algol/parc_Memory.h>
@@ -32,7 +32,7 @@ parcTime_TimevalAsString(struct timeval timeval)
{
char *string;
int nwritten = asprintf(&string, "%ld.%06ld", timeval.tv_sec, (long) timeval.tv_usec);
- assertTrue(nwritten >= 0, "Error calling asprintf");
+ parcAssertTrue(nwritten >= 0, "Error calling asprintf");
char *result = parcMemory_StringDuplicate(string, strlen(string));
free(string);
diff --git a/libparc/parc/algol/parc_TreeMap.c b/libparc/parc/algol/parc_TreeMap.c
index 9c776b30..9922829b 100755
--- a/libparc/parc/algol/parc_TreeMap.c
+++ b/libparc/parc/algol/parc_TreeMap.c
@@ -17,7 +17,7 @@
*/
#include <config.h>
-#include <LongBow/runtime.h>
+#include <parc/assert/parc_Assert.h>
#include <stdio.h>
@@ -167,7 +167,7 @@ static _RBNode *
_rbNodeCreate(PARCTreeMap *tree, int color)
{
_RBNode *node = parcMemory_AllocateAndClear(sizeof(_RBNode));
- assertNotNull(node, "parcMemory_AllocateAndClear(%zu) returned NULL", sizeof(_RBNode));
+ parcAssertNotNull(node, "parcMemory_AllocateAndClear(%zu) returned NULL", sizeof(_RBNode));
node->color = color;
node->leftChild = tree->nil;
node->rightChild = tree->nil;
@@ -353,28 +353,28 @@ static void
_rbNodeAssertNodeInvariants(_RBNode *node, PARCObject *data)
{
PARCTreeMap *tree = (PARCTreeMap *) data;
- assertNotNull(node->parent, "Node has NULL parent");
- assertNotNull(node->leftChild, "Left child NULL");
- assertNotNull(node->rightChild, "Richt child NULL");
+ parcAssertNotNull(node->parent, "Node has NULL parent");
+ parcAssertNotNull(node->leftChild, "Left child NULL");
+ parcAssertNotNull(node->rightChild, "Richt child NULL");
if (node != tree->root) {
- assertTrue(node->parent != tree->nil, "Paren't can't be nill for node!");
+ parcAssertTrue(node->parent != tree->nil, "Paren't can't be nill for node!");
// Don't need to compare to parent, they compared to us
}
- assertNotNull(node->element, "We have a null element!!");
- assertNotNull(parcKeyValue_GetKey(node->element), "We have a null key!!");
- assertNotNull(parcKeyValue_GetValue(node->element), "We have a null value!!");
+ parcAssertNotNull(node->element, "We have a null element!!");
+ parcAssertNotNull(parcKeyValue_GetKey(node->element), "We have a null key!!");
+ parcAssertNotNull(parcKeyValue_GetValue(node->element), "We have a null value!!");
if (node->leftChild != tree->nil) {
if (tree->customCompare != NULL) {
- assertTrue(tree->customCompare(parcKeyValue_GetKey(node->element), parcKeyValue_GetKey(node->leftChild->element)) > 0, "Left child not smaller?");
+ parcAssertTrue(tree->customCompare(parcKeyValue_GetKey(node->element), parcKeyValue_GetKey(node->leftChild->element)) > 0, "Left child not smaller?");
} else {
- assertTrue(parcObject_Compare(parcKeyValue_GetKey(node->element), parcKeyValue_GetKey(node->leftChild->element)) > 0, "Left child not smaller?");
+ parcAssertTrue(parcObject_Compare(parcKeyValue_GetKey(node->element), parcKeyValue_GetKey(node->leftChild->element)) > 0, "Left child not smaller?");
}
}
if (node->rightChild != tree->nil) {
if (tree->customCompare != NULL) {
- assertTrue(tree->customCompare(parcKeyValue_GetKey(node->element), parcKeyValue_GetKey(node->rightChild->element)) < 0, "Right child not bigger?");
+ parcAssertTrue(tree->customCompare(parcKeyValue_GetKey(node->element), parcKeyValue_GetKey(node->rightChild->element)) < 0, "Right child not bigger?");
} else {
- assertTrue(parcObject_Compare(parcKeyValue_GetKey(node->element), parcKeyValue_GetKey(node->rightChild->element)) < 0, "Right child not bigger?");
+ parcAssertTrue(parcObject_Compare(parcKeyValue_GetKey(node->element), parcKeyValue_GetKey(node->rightChild->element)) < 0, "Right child not bigger?");
}
}
}
@@ -383,11 +383,11 @@ static
void
_rbNodeAssertTreeInvariants(const PARCTreeMap *tree)
{
- assertNotNull(tree, "Tree is null!");
- assertTrue(tree->size >= 0, "Tree has negative size");
+ parcAssertNotNull(tree, "Tree is null!");
+ parcAssertTrue(tree->size >= 0, "Tree has negative size");
if (tree->size != 0) {
- assertTrue(tree->root != tree->nil, "Tree size = %d > 0 but root is nil", tree->size);
- assertNotNull(tree->root, "Tree size > 0 but root is NULL");
+ parcAssertTrue(tree->root != tree->nil, "Tree size = %d > 0 but root is nil", tree->size);
+ parcAssertNotNull(tree->root, "Tree size > 0 but root is NULL");
#ifdef ASSERT_INVARIANTS
_rbNodeRecursiveRun((PARCTreeMap *) tree, tree->root, _rbNodeAssertNodeInvariants, (PARCObject *) tree);
#endif
@@ -558,8 +558,8 @@ _rbNodeRemove(PARCTreeMap *tree, _RBNode *node)
static void
_parcTreeMap_Destroy(PARCTreeMap **treePointer)
{
- assertNotNull(treePointer, "pointer to pointer to tree can't be null");
- assertNotNull(*treePointer, "pointer to tree can't be null");
+ parcAssertNotNull(treePointer, "pointer to pointer to tree can't be null");
+ parcAssertNotNull(*treePointer, "pointer to tree can't be null");
_rbNodeAssertTreeInvariants(*treePointer);
if ((*treePointer)->size > 0) {
@@ -582,7 +582,7 @@ PARCTreeMap *
parcTreeMap_CreateCustom(PARCTreeMap_CustomCompare *customCompare)
{
PARCTreeMap *tree = parcObject_CreateInstance(PARCTreeMap);
- assertNotNull(tree, "parcMemory_AllocateAndClear(%zu) returned NULL", sizeof(PARCTreeMap));
+ parcAssertNotNull(tree, "parcMemory_AllocateAndClear(%zu) returned NULL", sizeof(PARCTreeMap));
tree->nil = _rbNodeCreate(tree, BLACK);
tree->nil->leftChild = tree->nil;
tree->nil->rightChild = tree->nil;
@@ -602,9 +602,9 @@ parcTreeMap_Create(void)
void
parcTreeMap_Put(PARCTreeMap *tree, const PARCObject *key, const PARCObject *value)
{
- assertNotNull(tree, "Tree can't be NULL");
- assertNotNull(key, "Key can't be NULL");
- assertNotNull(value, "Value can't be NULL");
+ parcAssertNotNull(tree, "Tree can't be NULL");
+ parcAssertNotNull(key, "Key can't be NULL");
+ parcAssertNotNull(value, "Value can't be NULL");
_RBNode *newNode = _rbNodeCreate(tree, RED);
_RBNode *parent = tree->nil;
@@ -660,7 +660,7 @@ parcTreeMap_Put(PARCTreeMap *tree, const PARCObject *key, const PARCObject *valu
PARCObject *
parcTreeMap_Get(PARCTreeMap *tree, const PARCObject *key)
{
- assertNotNull(tree, "Tree can't be NULL");
+ parcAssertNotNull(tree, "Tree can't be NULL");
_rbNodeAssertTreeInvariants(tree);
PARCObject *result = NULL;
@@ -678,8 +678,8 @@ parcTreeMap_Get(PARCTreeMap *tree, const PARCObject *key)
PARCObject *
parcTreeMap_Remove(PARCTreeMap *tree, const PARCObject *key)
{
- assertNotNull(tree, "Tree can't be NULL");
- assertNotNull(key, "Key can't be NULL");
+ parcAssertNotNull(tree, "Tree can't be NULL");
+ parcAssertNotNull(key, "Key can't be NULL");
_rbNodeAssertTreeInvariants(tree);
PARCObject *result = NULL;
@@ -703,8 +703,8 @@ parcTreeMap_Remove(PARCTreeMap *tree, const PARCObject *key)
void
parcTreeMap_RemoveAndRelease(PARCTreeMap *tree, const PARCObject *key)
{
- assertNotNull(tree, "Tree can't be NULL");
- assertNotNull(key, "Key can't be NULL");
+ parcAssertNotNull(tree, "Tree can't be NULL");
+ parcAssertNotNull(key, "Key can't be NULL");
_RBNode *node = _rbFindNode(tree, tree->root, key);
@@ -719,7 +719,7 @@ parcTreeMap_RemoveAndRelease(PARCTreeMap *tree, const PARCObject *key)
PARCKeyValue *
parcTreeMap_GetLastEntry(const PARCTreeMap *tree)
{
- assertNotNull(tree, "Tree can't be NULL");
+ parcAssertNotNull(tree, "Tree can't be NULL");
_rbNodeAssertTreeInvariants(tree);
_RBNode *node = tree->root;
@@ -752,7 +752,7 @@ parcTreeMap_GetLastKey(const PARCTreeMap *tree)
PARCKeyValue *
parcTreeMap_GetFirstEntry(const PARCTreeMap *tree)
{
- assertNotNull(tree, "Tree can't be NULL");
+ parcAssertNotNull(tree, "Tree can't be NULL");
_rbNodeAssertTreeInvariants(tree);
if (tree->size == 0) {
@@ -840,7 +840,7 @@ parcTreeMap_GetLowerKey(const PARCTreeMap *tree, const PARCObject *key)
size_t
parcTreeMap_Size(const PARCTreeMap *tree)
{
- assertNotNull(tree, "Tree can't be NULL");
+ parcAssertNotNull(tree, "Tree can't be NULL");
_rbNodeAssertTreeInvariants(tree);
return tree->size;
@@ -867,7 +867,7 @@ _rbAddElementToList(_RBNode *node, PARCList *list)
PARCList *
parcTreeMap_AcquireKeys(const PARCTreeMap *tree)
{
- assertNotNull(tree, "Tree can't be NULL");
+ parcAssertNotNull(tree, "Tree can't be NULL");
_rbNodeAssertTreeInvariants(tree);
PARCList *keys = parcList(parcArrayList_Create_Capacity((bool (*)(void *x, void *y))parcObject_Equals,
@@ -883,7 +883,7 @@ parcTreeMap_AcquireKeys(const PARCTreeMap *tree)
PARCList *
parcTreeMap_AcquireValues(const PARCTreeMap *tree)
{
- assertNotNull(tree, "Tree can't be NULL");
+ parcAssertNotNull(tree, "Tree can't be NULL");
_rbNodeAssertTreeInvariants(tree);
PARCList *values = parcList(parcArrayList_Create_Capacity((bool (*)(void *x, void *y))parcObject_Equals,
@@ -899,7 +899,7 @@ parcTreeMap_AcquireValues(const PARCTreeMap *tree)
static PARCList *
_parcTreeMap_Elements(const PARCTreeMap *tree)
{
- assertNotNull(tree, "Tree can't be NULL");
+ parcAssertNotNull(tree, "Tree can't be NULL");
_rbNodeAssertTreeInvariants(tree);
PARCList *elements = parcList(parcArrayList_Create_Capacity((bool (*)(void *x, void *y))parcObject_Equals,
@@ -917,8 +917,8 @@ parcTreeMap_Equals(const PARCTreeMap *tree1, const PARCTreeMap *tree2)
{
_rbNodeAssertTreeInvariants(tree1);
_rbNodeAssertTreeInvariants(tree2);
- assertNotNull(tree1, "Tree can't be NULL");
- assertNotNull(tree2, "Tree can't be NULL");
+ parcAssertNotNull(tree1, "Tree can't be NULL");
+ parcAssertNotNull(tree2, "Tree can't be NULL");
bool result = false;
@@ -968,7 +968,7 @@ PARCTreeMap *
parcTreeMap_Copy(const PARCTreeMap *sourceTree)
{
_rbNodeAssertTreeInvariants(sourceTree);
- assertNotNull(sourceTree, "Tree can't be NULL");
+ parcAssertNotNull(sourceTree, "Tree can't be NULL");
PARCObject *keySource;
PARCObject *keyCopy;
@@ -1019,7 +1019,7 @@ _parcTreeMapIterator_Init(PARCTreeMap *map)
state->list = _parcTreeMap_Elements(map);
state->currentIndex = 0;
state->currentElement = parcList_GetAtIndex(state->list, 0);
- trapOutOfMemoryIf(state->list == NULL, "Cannot create parcList");
+ parcTrapOutOfMemoryIf(state->list == NULL, "Cannot create parcList");
}
return state;
diff --git a/libparc/parc/algol/parc_TreeRedBlack.c b/libparc/parc/algol/parc_TreeRedBlack.c
index 2d772555..71a23f10 100755
--- a/libparc/parc/algol/parc_TreeRedBlack.c
+++ b/libparc/parc/algol/parc_TreeRedBlack.c
@@ -17,7 +17,7 @@
*/
#include <config.h>
-#include <LongBow/runtime.h>
+#include <parc/assert/parc_Assert.h>
#include <stdio.h>
@@ -102,7 +102,7 @@ static Node *
_rbNodeCreate(PARCTreeRedBlack *tree, int color)
{
Node *node = parcMemory_AllocateAndClear(sizeof(Node));
- assertNotNull(node, "parcMemory_AllocateAndClear(%zu) returned NULL", sizeof(Node));
+ parcAssertNotNull(node, "parcMemory_AllocateAndClear(%zu) returned NULL", sizeof(Node));
node->color = color;
node->left_child = tree->nil;
node->right_child = tree->nil;
@@ -414,9 +414,9 @@ parcTreeRedBlack_Create(PARCTreeRedBlack_KeyCompare *keyCompare,
PARCTreeRedBlack_ValueFree *valueFree,
PARCTreeRedBlack_ValueCopy *valueCopy)
{
- assertNotNull(keyCompare, "We need a key compare function");
+ parcAssertNotNull(keyCompare, "We need a key compare function");
PARCTreeRedBlack *tree = parcMemory_AllocateAndClear(sizeof(PARCTreeRedBlack));
- assertNotNull(tree, "parcMemory_AllocateAndClear(%zu) returned NULL", sizeof(PARCTreeRedBlack));
+ parcAssertNotNull(tree, "parcMemory_AllocateAndClear(%zu) returned NULL", sizeof(PARCTreeRedBlack));
tree->nil = _rbNodeCreate(tree, BLACK);
tree->nil->left_child = tree->nil;
tree->nil->right_child = tree->nil;
@@ -435,8 +435,8 @@ parcTreeRedBlack_Create(PARCTreeRedBlack_KeyCompare *keyCompare,
void
parcTreeRedBlack_Destroy(PARCTreeRedBlack **treePointer)
{
- assertNotNull(treePointer, "pointer to pointer to tree can't be null");
- assertNotNull(*treePointer, "pointer to tree can't be null");
+ parcAssertNotNull(treePointer, "pointer to pointer to tree can't be null");
+ parcAssertNotNull(*treePointer, "pointer to tree can't be null");
if ((*treePointer)->size > 0) {
// If we have any elements in the tree, free them
@@ -453,9 +453,9 @@ parcTreeRedBlack_Destroy(PARCTreeRedBlack **treePointer)
void
parcTreeRedBlack_Insert(PARCTreeRedBlack *tree, void *key, void *value)
{
- assertNotNull(tree, "Tree can't be NULL");
- assertNotNull(key, "Key can't be NULL");
- assertNotNull(value, "Value can't be NULL");
+ parcAssertNotNull(tree, "Tree can't be NULL");
+ parcAssertNotNull(key, "Key can't be NULL");
+ parcAssertNotNull(value, "Value can't be NULL");
Node *newNode = _rbNodeCreate(tree, RED);
Node *parent = tree->nil;
@@ -511,7 +511,7 @@ parcTreeRedBlack_Insert(PARCTreeRedBlack *tree, void *key, void *value)
void *
parcTreeRedBlack_Get(PARCTreeRedBlack *tree, const void *key)
{
- assertNotNull(tree, "Tree can't be NULL");
+ parcAssertNotNull(tree, "Tree can't be NULL");
Node *node = tree->root;
@@ -535,8 +535,8 @@ parcTreeRedBlack_Get(PARCTreeRedBlack *tree, const void *key)
void *
parcTreeRedBlack_Remove(PARCTreeRedBlack *tree, const void *key)
{
- assertNotNull(tree, "Tree can't be NULL");
- assertNotNull(key, "Key can't be NULL");
+ parcAssertNotNull(tree, "Tree can't be NULL");
+ parcAssertNotNull(key, "Key can't be NULL");
Node *node = tree->root;
@@ -568,8 +568,8 @@ parcTreeRedBlack_Remove(PARCTreeRedBlack *tree, const void *key)
void
parcTreeRedBlack_RemoveAndDestroy(PARCTreeRedBlack *tree, const void *key)
{
- assertNotNull(tree, "Tree can't be NULL");
- assertNotNull(key, "Key can't be NULL");
+ parcAssertNotNull(tree, "Tree can't be NULL");
+ parcAssertNotNull(key, "Key can't be NULL");
Node *node = tree->root;
// Let's get to the bottom of the tree to insert.
@@ -591,7 +591,7 @@ parcTreeRedBlack_RemoveAndDestroy(PARCTreeRedBlack *tree, const void *key)
void *
parcTreeRedBlack_LastKey(const PARCTreeRedBlack *tree)
{
- assertNotNull(tree, "Tree can't be NULL");
+ parcAssertNotNull(tree, "Tree can't be NULL");
Node *node = tree->root;
if (tree->size == 0) {
@@ -610,7 +610,7 @@ parcTreeRedBlack_LastKey(const PARCTreeRedBlack *tree)
void *
parcTreeRedBlack_FirstKey(const PARCTreeRedBlack *tree)
{
- assertNotNull(tree, "Tree can't be NULL");
+ parcAssertNotNull(tree, "Tree can't be NULL");
Node *node = tree->root;
@@ -630,7 +630,7 @@ parcTreeRedBlack_FirstKey(const PARCTreeRedBlack *tree)
size_t
parcTreeRedBlack_Size(const PARCTreeRedBlack *tree)
{
- assertNotNull(tree, "Tree can't be NULL");
+ parcAssertNotNull(tree, "Tree can't be NULL");
return tree->size;
}
@@ -645,7 +645,7 @@ _rbGetKeys(Node *node, void *data)
PARCArrayList *
parcTreeRedBlack_Keys(const PARCTreeRedBlack *tree)
{
- assertNotNull(tree, "Tree can't be NULL");
+ parcAssertNotNull(tree, "Tree can't be NULL");
PARCArrayList *keys = parcArrayList_Create(NULL);
@@ -665,7 +665,7 @@ _rbGetValues(Node *node, void *data)
PARCArrayList *
parcTreeRedBlack_Values(const PARCTreeRedBlack *tree)
{
- assertNotNull(tree, "Tree can't be NULL");
+ parcAssertNotNull(tree, "Tree can't be NULL");
PARCArrayList *values = parcArrayList_Create(NULL);
@@ -678,8 +678,8 @@ parcTreeRedBlack_Values(const PARCTreeRedBlack *tree)
int
parcTreeRedBlack_Equals(const PARCTreeRedBlack *tree1, const PARCTreeRedBlack *tree2)
{
- assertNotNull(tree1, "Tree can't be NULL");
- assertNotNull(tree2, "Tree can't be NULL");
+ parcAssertNotNull(tree1, "Tree can't be NULL");
+ parcAssertNotNull(tree2, "Tree can't be NULL");
int ret = 1;
@@ -736,7 +736,7 @@ parcTreeRedBlack_Equals(const PARCTreeRedBlack *tree1, const PARCTreeRedBlack *t
PARCTreeRedBlack *
parcTreeRedBlack_Copy(const PARCTreeRedBlack *source_tree)
{
- assertNotNull(source_tree, "Tree can't be NULL");
+ parcAssertNotNull(source_tree, "Tree can't be NULL");
void *key_source;
void *key_copy;
diff --git a/libparc/parc/algol/parc_URI.c b/libparc/parc/algol/parc_URI.c
index 172468d8..e14dfc9f 100644
--- a/libparc/parc/algol/parc_URI.c
+++ b/libparc/parc/algol/parc_URI.c
@@ -18,7 +18,7 @@
*/
#include <config.h>
-#include <LongBow/runtime.h>
+#include <parc/assert/parc_Assert.h>
#include <unistd.h>
#include <stdio.h>
@@ -61,7 +61,7 @@ struct parc_uri {
static void
_parcURI_Finalize(PARCURI **uriPtr)
{
- assertNotNull(uriPtr, "Parameter must be a non-null pointer to a pointer to a PARCURI instance.");
+ parcAssertNotNull(uriPtr, "Parameter must be a non-null pointer to a pointer to a PARCURI instance.");
PARCURI *uri = *uriPtr;
diff --git a/libparc/parc/algol/parc_URIAuthority.c b/libparc/parc/algol/parc_URIAuthority.c
index ac2ee351..1e3468d1 100644
--- a/libparc/parc/algol/parc_URIAuthority.c
+++ b/libparc/parc/algol/parc_URIAuthority.c
@@ -18,7 +18,7 @@
*/
#include <config.h>
-#include <LongBow/runtime.h>
+#include <parc/assert/parc_Assert.h>
#include <unistd.h>
#include <stdio.h>
diff --git a/libparc/parc/algol/parc_URIPath.c b/libparc/parc/algol/parc_URIPath.c
index ef46dac9..04636852 100755
--- a/libparc/parc/algol/parc_URIPath.c
+++ b/libparc/parc/algol/parc_URIPath.c
@@ -17,7 +17,7 @@
*/
#include <config.h>
-#include <LongBow/runtime.h>
+#include <parc/assert/parc_Assert.h>
#include <unistd.h>
#include <stdio.h>
@@ -40,7 +40,7 @@ struct parc_uri_path {
static void
_parcURIPath_Finalize(PARCURIPath **pathPtr)
{
- assertNotNull(pathPtr, "Parameter must be a non-null pointer to a pointer to a PARCURIPath instance.");
+ parcAssertNotNull(pathPtr, "Parameter must be a non-null pointer to a pointer to a PARCURIPath instance.");
PARCURIPath *path = *pathPtr;
if (path != NULL) {
@@ -89,7 +89,7 @@ parcURIPath_Trim(PARCURIPath *path, size_t numberToRemove)
//
// result->segments = parcArrayList_Create((void (*)(void **))parcURISegment_Release);
// if (*string != 0) {
-// assertTrue(*string == '/', "Expected initial '/' character.");
+// parcAssertTrue(*string == '/', "Expected initial '/' character.");
// *pointer = string;
// while (**pointer != 0 && **pointer != '?' && **pointer != '#') {
// PARCURISegment *segment = parcURISegment_Parse(++(*pointer), pointer);
@@ -148,7 +148,7 @@ parcURIPath_Equals(const PARCURIPath *pathA, const PARCURIPath *pathB)
PARCURIPath *
parcURIPath_Copy(const PARCURIPath *path)
{
- assertNotNull(path, "Parameter must be a non-null PARC_URIPath pointer.");
+ parcAssertNotNull(path, "Parameter must be a non-null PARC_URIPath pointer.");
PARCURIPath *result = parcURIPath_Create();
result->segments = parcArrayList_Create((void (*)(void **))parcURISegment_Release);
diff --git a/libparc/parc/algol/parc_URIPath.h b/libparc/parc/algol/parc_URIPath.h
index d43d8651..4e2d62e5 100755
--- a/libparc/parc/algol/parc_URIPath.h
+++ b/libparc/parc/algol/parc_URIPath.h
@@ -332,7 +332,7 @@ PARCURIPath *parcURIPath_Append(PARCURIPath *path, const PARCURISegment *segment
* Retrieve the URI path segment at the specified index.
*
* The index must be within the range [0, number of segments]
- * prior to invocation. Otherwise, the program is terminated with LongBow trapOutOfBounds.
+ * prior to invocation. Otherwise, the program is terminated with parcTrapOutOfBounds.
*
* @param [in] path A `PARCURIPath` instance to be examined.
* @param [in] index The index of the URI segment to retrieve.
diff --git a/libparc/parc/algol/parc_URISegment.c b/libparc/parc/algol/parc_URISegment.c
index 7261c3aa..786a7182 100755
--- a/libparc/parc/algol/parc_URISegment.c
+++ b/libparc/parc/algol/parc_URISegment.c
@@ -17,7 +17,7 @@
*/
#include <config.h>
-#include <LongBow/runtime.h>
+#include <parc/assert/parc_Assert.h>
#include <unistd.h>
#include <stdio.h>
@@ -93,7 +93,7 @@ _parsePercentEncoded(const char *string, unsigned char *value)
static PARCBufferComposer *
_parcURISegment_BuildString(const PARCURISegment *segment, PARCBufferComposer *composer)
{
- assertNotNull(composer, "Parameter must be a non-null pointer to a PARCBufferComposer.");
+ parcAssertNotNull(composer, "Parameter must be a non-null pointer to a PARCBufferComposer.");
for (size_t i = 0; i < parcBuffer_Limit(segment->buffer) && composer != NULL; i++) {
unsigned char c = parcBuffer_GetAtIndex(segment->buffer, i);
@@ -148,10 +148,10 @@ parcURISegment_Create(size_t length, const unsigned char segment[length])
PARCURISegment *
parcURISegment_Parse(const char *string, const char **pointer)
{
- assertFalse(*string == '/', "Input parameter '%s' must NOT point to an initial '/' character.", string);
+ parcAssertFalse(*string == '/', "Input parameter '%s' must NOT point to an initial '/' character.", string);
unsigned char *segment = parcMemory_AllocateAndClear((strlen(string) + 1) * sizeof(unsigned char));
- assertNotNull(segment, "parcMemory_AllocateAndClear(%zu) returned NULL", (strlen(string) + 1) * sizeof(unsigned char));
+ parcAssertNotNull(segment, "parcMemory_AllocateAndClear(%zu) returned NULL", (strlen(string) + 1) * sizeof(unsigned char));
size_t length = 0;
unsigned char *r = segment;
@@ -219,7 +219,7 @@ parcURISegment_Equals(const PARCURISegment *segmentA, const PARCURISegment *segm
PARCURISegment *
parcURISegment_Clone(const PARCURISegment *segment)
{
- assertNotNull(segment, "Parameter must be a non-null PARC_URISegment pointer.");
+ parcAssertNotNull(segment, "Parameter must be a non-null PARC_URISegment pointer.");
PARCBuffer *copy = parcBuffer_Copy(segment->buffer);
PARCURISegment *result = parcURISegment_CreateFromBuffer(copy);
diff --git a/libparc/parc/algol/parc_Unsigned.c b/libparc/parc/algol/parc_Unsigned.c
index 839f6b2b..a8fd1053 100644
--- a/libparc/parc/algol/parc_Unsigned.c
+++ b/libparc/parc/algol/parc_Unsigned.c
@@ -52,7 +52,7 @@ parcObject_Override(PARCUnsigned, PARCObject,
void
parcUnsigned_AssertValid(const PARCUnsigned *instance)
{
- assertTrue(parcUnsigned_IsValid(instance),
+ parcAssertTrue(parcUnsigned_IsValid(instance),
"PARCUnsigned is not valid.");
}
diff --git a/libparc/parc/algol/parc_Varint.c b/libparc/parc/algol/parc_Varint.c
index 7a593f45..7a1d2698 100755
--- a/libparc/parc/algol/parc_Varint.c
+++ b/libparc/parc/algol/parc_Varint.c
@@ -17,7 +17,7 @@
*/
#include <config.h>
-#include <LongBow/runtime.h>
+#include <parc/assert/parc_Assert.h>
#include <stdio.h>
#include <stdlib.h>
@@ -45,12 +45,12 @@ parcVarint_Create(void)
PARCVarint *
parcVarint_DecodeBuffer(PARCBuffer *buffer, size_t length)
{
- assertNotNull(buffer, "Parameter must be a non-null PARCBuffer pointer.");
- assertTrue(length < sizeof(size_t), "Length must be less then or equal to %zd", sizeof(size_t));
- assertTrue(length <= parcBuffer_Remaining(buffer), "Buffer does not contain at least %zd bytes", length);
+ parcAssertNotNull(buffer, "Parameter must be a non-null PARCBuffer pointer.");
+ parcAssertTrue(length < sizeof(size_t), "Length must be less then or equal to %zd", sizeof(size_t));
+ parcAssertTrue(length <= parcBuffer_Remaining(buffer), "Buffer does not contain at least %zd bytes", length);
PARCVarint *result = parcVarint_Create();
- assertNotNull(result, "PARCVarint out of memory.");
+ parcAssertNotNull(result, "PARCVarint out of memory.");
for (size_t i = 0; i < length; i++) {
parcVarint_ShiftLeft(result, 8);
@@ -63,11 +63,11 @@ parcVarint_DecodeBuffer(PARCBuffer *buffer, size_t length)
PARCVarint *
parcVarint_DecodeElasticByteBuffer(const PARCBuffer *buffer, size_t length)
{
- assertNotNull(buffer, "Parameter must be a non-null PARCBuffer pointer.");
- assertTrue(length < sizeof(size_t), "Length must be less then or equal to %zd", sizeof(size_t));
+ parcAssertNotNull(buffer, "Parameter must be a non-null PARCBuffer pointer.");
+ parcAssertTrue(length < sizeof(size_t), "Length must be less then or equal to %zd", sizeof(size_t));
PARCVarint *result = parcVarint_Create();
- assertNotNull(result, "PARCVarint out of memory.");
+ parcAssertNotNull(result, "PARCVarint out of memory.");
for (size_t i = 0; i < length; i++) {
parcVarint_ShiftLeft(result, 8);
@@ -87,7 +87,7 @@ parcVarint_Set(PARCVarint *varint, uint64_t newValue)
PARCVarint *
parcVarint_FromElasticByteBuffer(const PARCBuffer *buffer)
{
- assertNotNull(buffer, "Parameter must be a non-null PARCBuffer pointer.");
+ parcAssertNotNull(buffer, "Parameter must be a non-null PARCBuffer pointer.");
PARCVarint *result = parcVarint_Create();
size_t length = parcBuffer_Remaining(buffer);
@@ -103,7 +103,7 @@ parcVarint_FromElasticByteBuffer(const PARCBuffer *buffer)
PARCVarint *
parcVarint_FromUTF8ByteBuffer(const PARCBuffer *buffer)
{
- assertNotNull(buffer, "Parameter must not be NULL.");
+ parcAssertNotNull(buffer, "Parameter must not be NULL.");
PARCVarint *result = parcVarint_Create();
if (result != NULL) {
@@ -121,7 +121,7 @@ parcVarint_FromUTF8ByteBuffer(const PARCBuffer *buffer)
PARCVarint *
parcVarint_FromUTF8Buffer(PARCBuffer *buffer)
{
- assertNotNull(buffer, "Parameter must be a non-null PARCBuffer pointer.");
+ parcAssertNotNull(buffer, "Parameter must be a non-null PARCBuffer pointer.");
PARCVarint *result = parcVarint_Create();
if (result != NULL) {
@@ -180,8 +180,8 @@ parcVarint_FromUint64(uint64_t uint)
void
parcVarint_Destroy(PARCVarint **varintP)
{
- assertNotNull(varintP, "Parameter must be a non-null pointer to a pointer to a PARCVarint");
- assertNotNull(*varintP, "Parameter must be a non-null pointer to a PARCVarint");
+ parcAssertNotNull(varintP, "Parameter must be a non-null pointer to a pointer to a PARCVarint");
+ parcAssertNotNull(*varintP, "Parameter must be a non-null pointer to a PARCVarint");
parcMemory_Deallocate((void **) varintP);
*varintP = NULL;
@@ -197,7 +197,7 @@ parcVarint_Destroy(PARCVarint **varintP)
PARCVarint *
parcVarint_ShiftLeft(PARCVarint *varint, int bits)
{
- assertNotNull(varint, "Parameter must be a non-null pointer to a PARCVarint.");
+ parcAssertNotNull(varint, "Parameter must be a non-null pointer to a PARCVarint.");
varint->value <<= bits;
return varint;
@@ -206,7 +206,7 @@ parcVarint_ShiftLeft(PARCVarint *varint, int bits)
PARCVarint *
parcVarint_Add(PARCVarint *varint, int addend)
{
- assertNotNull(varint, "Parameter must be a non-null pointer to a PARCVarint.");
+ parcAssertNotNull(varint, "Parameter must be a non-null pointer to a PARCVarint.");
varint->value += addend;
return varint;
@@ -215,7 +215,7 @@ parcVarint_Add(PARCVarint *varint, int addend)
PARCVarint *
parcVarint_Subtract(PARCVarint *varint, int subtrahend)
{
- assertNotNull(varint, "Parameter must be a non-null pointer to a PARCVarint.");
+ parcAssertNotNull(varint, "Parameter must be a non-null pointer to a PARCVarint.");
varint->value -= subtrahend;
return varint;
@@ -224,7 +224,7 @@ parcVarint_Subtract(PARCVarint *varint, int subtrahend)
PARCVarint *
parcVarint_Multiply(PARCVarint *varint, int multiplicand)
{
- assertNotNull(varint, "Parameter must be a non-null pointer to a PARCVarint.");
+ parcAssertNotNull(varint, "Parameter must be a non-null pointer to a PARCVarint.");
varint->value *= multiplicand;
return varint;
@@ -233,7 +233,7 @@ parcVarint_Multiply(PARCVarint *varint, int multiplicand)
PARCVarint *
parcVarint_Divide(PARCVarint *varint, int divisor)
{
- assertNotNull(varint, "Parameter must be a non-null pointer to a PARCVarint.");
+ parcAssertNotNull(varint, "Parameter must be a non-null pointer to a PARCVarint.");
varint->value /= divisor;
return varint;
@@ -249,7 +249,7 @@ parcVarint_Divide(PARCVarint *varint, int divisor)
PARCVarint *
parcVarint_ShiftRight(PARCVarint *varint, int bits)
{
- assertNotNull(varint, "Parameter must be a non-null pointer to a PARCVarint.");
+ parcAssertNotNull(varint, "Parameter must be a non-null pointer to a PARCVarint.");
varint->value >>= bits;
return varint;
}
@@ -265,8 +265,8 @@ parcVarint_ShiftRight(PARCVarint *varint, int bits)
PARCVarint *
parcVarint_And(PARCVarint *varint, PARCVarint *operand)
{
- assertNotNull(varint, "Parameter varint must not be NULL.");
- assertNotNull(operand, "Parameter operand must not be NULL.");
+ parcAssertNotNull(varint, "Parameter varint must not be NULL.");
+ parcAssertNotNull(operand, "Parameter operand must not be NULL.");
varint->value &= operand->value;
return varint;
}
@@ -280,7 +280,7 @@ parcVarint_And(PARCVarint *varint, PARCVarint *operand)
PARCVarint *
parcVarint_AndUint8(PARCVarint *varint, uint8_t operand)
{
- assertNotNull(varint, "Parameter varint must not be NULL.");
+ parcAssertNotNull(varint, "Parameter varint must not be NULL.");
varint->value &= operand;
return varint;
}
@@ -294,7 +294,7 @@ parcVarint_AndUint8(PARCVarint *varint, uint8_t operand)
PARCVarint *
parcVarint_AndUint16(PARCVarint *varint, uint16_t operand)
{
- assertNotNull(varint, "Parameter varint must not be NULL.");
+ parcAssertNotNull(varint, "Parameter varint must not be NULL.");
varint->value &= operand;
return varint;
}
@@ -308,7 +308,7 @@ parcVarint_AndUint16(PARCVarint *varint, uint16_t operand)
PARCVarint *
parcVarint_AndUint32(PARCVarint *varint, uint32_t operand)
{
- assertNotNull(varint, "Parameter varint must not be NULL.");
+ parcAssertNotNull(varint, "Parameter varint must not be NULL.");
varint->value &= operand;
return varint;
}
@@ -322,7 +322,7 @@ parcVarint_AndUint32(PARCVarint *varint, uint32_t operand)
PARCVarint *
parcVarint_AndUint64(PARCVarint *varint, uint64_t operand)
{
- assertNotNull(varint, "Parameter must be a non-null PARCVarint pointer.");
+ parcAssertNotNull(varint, "Parameter must be a non-null PARCVarint pointer.");
varint->value &= operand;
return varint;
}
@@ -336,7 +336,7 @@ parcVarint_AndUint64(PARCVarint *varint, uint64_t operand)
PARCVarint *
parcVarint_Or(PARCVarint *varint, PARCVarint *operand)
{
- assertNotNull(varint, "Parameter must be a non-null PARCVarint pointer.");
+ parcAssertNotNull(varint, "Parameter must be a non-null PARCVarint pointer.");
varint->value |= operand->value;
return varint;
}
@@ -351,7 +351,7 @@ parcVarint_Or(PARCVarint *varint, PARCVarint *operand)
PARCVarint *
parcVarint_OrUint8(PARCVarint *varint, uint8_t operand)
{
- assertNotNull(varint, "Parameter varint must not be NULL.");
+ parcAssertNotNull(varint, "Parameter varint must not be NULL.");
varint->value |= operand;
return varint;
}
@@ -366,7 +366,7 @@ parcVarint_OrUint8(PARCVarint *varint, uint8_t operand)
PARCVarint *
parcVarint_OrUint16(PARCVarint *varint, uint16_t operand)
{
- assertNotNull(varint, "Parameter varint must not be NULL.");
+ parcAssertNotNull(varint, "Parameter varint must not be NULL.");
varint->value |= operand;
return varint;
}
@@ -381,7 +381,7 @@ parcVarint_OrUint16(PARCVarint *varint, uint16_t operand)
PARCVarint *
parcVarint_OrUint32(PARCVarint *varint, uint32_t operand)
{
- assertNotNull(varint, "Parameter varint must not be NULL.");
+ parcAssertNotNull(varint, "Parameter varint must not be NULL.");
varint->value |= operand;
return varint;
}
@@ -396,7 +396,7 @@ parcVarint_OrUint32(PARCVarint *varint, uint32_t operand)
PARCVarint *
parcVarint_OrUint64(PARCVarint *varint, uint64_t operand)
{
- assertNotNull(varint, "Parameter varint must not be NULL.");
+ parcAssertNotNull(varint, "Parameter varint must not be NULL.");
varint->value |= operand;
return varint;
}
@@ -411,7 +411,7 @@ parcVarint_OrUint64(PARCVarint *varint, uint64_t operand)
int
parcVarint_Equals(PARCVarint *varint, PARCVarint *operand)
{
- assertNotNull(varint, "Parameter varint must not be NULL.");
+ parcAssertNotNull(varint, "Parameter varint must not be NULL.");
return varint->value == operand->value;
}
@@ -424,7 +424,7 @@ parcVarint_Equals(PARCVarint *varint, PARCVarint *operand)
int
parcVarint_EqualsUint64(PARCVarint *varint, uint64_t value)
{
- assertNotNull(varint, "Parameter varint must not be NULL.");
+ parcAssertNotNull(varint, "Parameter varint must not be NULL.");
return varint->value == value;
}
@@ -437,7 +437,7 @@ parcVarint_EqualsUint64(PARCVarint *varint, uint64_t value)
int
parcVarint_EqualsUint32(PARCVarint *varint, uint32_t value)
{
- assertNotNull(varint, "Parameter varint must not be NULL.");
+ parcAssertNotNull(varint, "Parameter varint must not be NULL.");
return parcVarint_EqualsUint64(varint, (uint64_t) value);
}
@@ -450,7 +450,7 @@ parcVarint_EqualsUint32(PARCVarint *varint, uint32_t value)
int
parcVarint_EqualsUint16(PARCVarint *varint, uint16_t value)
{
- assertNotNull(varint, "Parameter varint must not be NULL.");
+ parcAssertNotNull(varint, "Parameter varint must not be NULL.");
return parcVarint_EqualsUint64(varint, (uint64_t) value);
}
@@ -463,7 +463,7 @@ parcVarint_EqualsUint16(PARCVarint *varint, uint16_t value)
int
parcVarint_EqualsUint8(PARCVarint *varint, uint8_t value)
{
- assertNotNull(varint, "Parameter varint must not be NULL.");
+ parcAssertNotNull(varint, "Parameter varint must not be NULL.");
return parcVarint_EqualsUint64(varint, (uint64_t) value);
}
@@ -476,7 +476,7 @@ parcVarint_EqualsUint8(PARCVarint *varint, uint8_t value)
uint8_t
parcVarint_AsUint8(const PARCVarint *varint)
{
- assertNotNull(varint, "Parameter varint must not be NULL.");
+ parcAssertNotNull(varint, "Parameter varint must not be NULL.");
return (uint8_t) varint->value;
}
@@ -489,7 +489,7 @@ parcVarint_AsUint8(const PARCVarint *varint)
uint16_t
parcVarint_AsUint16(const PARCVarint *varint)
{
- assertNotNull(varint, "Parameter varint must not be NULL.");
+ parcAssertNotNull(varint, "Parameter varint must not be NULL.");
return (uint16_t) varint->value;
}
@@ -502,14 +502,14 @@ parcVarint_AsUint16(const PARCVarint *varint)
uint32_t
parcVarint_AsUint32(const PARCVarint *varint)
{
- assertNotNull(varint, "Parameter varint must not be NULL.");
+ parcAssertNotNull(varint, "Parameter varint must not be NULL.");
return (uint32_t) varint->value;
}
uint64_t
parcVarint_AsUint64(const PARCVarint *varint)
{
- assertNotNull(varint, "Parameter varint must not be NULL.");
+ parcAssertNotNull(varint, "Parameter varint must not be NULL.");
return varint->value;
}
@@ -522,7 +522,7 @@ parcVarint_AsUint64(const PARCVarint *varint)
size_t
parcVarint_AsSize(const PARCVarint *varint)
{
- assertNotNull(varint, "Parameter varint must not be NULL.");
+ parcAssertNotNull(varint, "Parameter varint must not be NULL.");
return (size_t) varint->value;
}
@@ -536,8 +536,8 @@ parcVarint_AsSize(const PARCVarint *varint)
char *
parcVarint_ToString(char **string, PARCVarint *varint)
{
- assertNotNull(varint, "Parameter varint must not be NULL.");
+ parcAssertNotNull(varint, "Parameter varint must not be NULL.");
int nwritten = asprintf(string, "%" PRIu64, varint->value);
- assertTrue(nwritten >= 0, "Error calling asprintf");
+ parcAssertTrue(nwritten >= 0, "Error calling asprintf");
return *string;
}
diff --git a/libparc/parc/algol/parc_Vector.c b/libparc/parc/algol/parc_Vector.c
index f5380eb7..1d0e9a1d 100755
--- a/libparc/parc/algol/parc_Vector.c
+++ b/libparc/parc/algol/parc_Vector.c
@@ -17,7 +17,7 @@
*/
#include <config.h>
-#include <LongBow/runtime.h>
+#include <parc/assert/parc_Assert.h>
#include <stdio.h>
#include <stdbool.h>
@@ -46,7 +46,7 @@ parcVector_Create(const void *pointer, const size_t length)
PARCVector *
parcVector_Init(PARCVector *vector, const void *pointer, const size_t length)
{
- assertNotNull(vector, "Parameter must be a non-null PARCVector pointer");
+ parcAssertNotNull(vector, "Parameter must be a non-null PARCVector pointer");
vector->pointer = pointer;
vector->length = length;
@@ -56,9 +56,9 @@ parcVector_Init(PARCVector *vector, const void *pointer, const size_t length)
void
parcVector_Destroy(PARCVector **vectorPtr)
{
- assertNotNull(vectorPtr, "Parameter must be a non-null PARCVector pointer");
+ parcAssertNotNull(vectorPtr, "Parameter must be a non-null PARCVector pointer");
PARCVector *vector = *vectorPtr;
- assertNotNull(vector, "Vector is already free or was not set.\n");
+ parcAssertNotNull(vector, "Vector is already free or was not set.\n");
parcMemory_Deallocate((void **) &vector);
*vectorPtr = NULL;
@@ -67,14 +67,14 @@ parcVector_Destroy(PARCVector **vectorPtr)
const void *
parcVector_GetPointer(const PARCVector *vector)
{
- assertNotNull(vector, "Parameter must be a non-null PARCVector pointer.");
+ parcAssertNotNull(vector, "Parameter must be a non-null PARCVector pointer.");
return vector->pointer;
}
size_t
parcVector_GetLength(const PARCVector *vector)
{
- assertNotNull(vector, "Parameter must be a non-null PARCVector pointer.");
+ parcAssertNotNull(vector, "Parameter must be a non-null PARCVector pointer.");
return vector->length;
}
diff --git a/libparc/parc/algol/test/test_parc_ArrayList.c b/libparc/parc/algol/test/test_parc_ArrayList.c
index 9e387a28..51e9e11c 100755
--- a/libparc/parc/algol/test/test_parc_ArrayList.c
+++ b/libparc/parc/algol/test/test_parc_ArrayList.c
@@ -641,11 +641,14 @@ LONGBOW_TEST_FIXTURE_TEARDOWN(Errors)
LONGBOW_TEST_CASE_EXPECTS(Errors, PARC_ArrayList_InsertAtIndex_OutOfCapacity, .event = &LongBowAssertEvent)
{
PARCArrayList *array = longBowTestCase_GetClipBoardData(testCase);
-
+ printf("1\n");
parcArrayList_Add(array, (void *) 1);
+ printf("2\n");
parcArrayList_Add(array, (void *) 2);
+ printf("3\n");
parcArrayList_InsertAtIndex(array, 200, (void *) 3);
+ printf("4\n");
}
int
diff --git a/libparc/parc/assert/parc_Assert.h b/libparc/parc/assert/parc_Assert.h
new file mode 100644
index 00000000..46e3e2f0
--- /dev/null
+++ b/libparc/parc/assert/parc_Assert.h
@@ -0,0 +1,191 @@
+/*
+ * Copyright (c) 2019 Cisco and/or its affiliates.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <assert.h>
+#include <errno.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#ifdef NDEBUG
+
+#define parcClean_errno() (errno == 0 ? "None" : strerror(errno))
+#define parcLog_PrintError(M, ...) \
+ fprintf(stderr, "[ERROR] (%s:%d: errno: %s) " M "\nExit (Failure)\n", \
+ __FILE__, __LINE__, parcClean_errno(), ##__VA_ARGS__);
+
+#define parcAssertTrue(A, M, ...) \
+ if (!(A)) { \
+ assert(A); \
+ }
+#define parcAssertFalse(A, M, ...) \
+ if ((A)) { \
+ assert(!(A)); \
+ }
+#define parcAssertNotNull(A, M, ...) \
+ if (A == NULL) { \
+ assert(A != NULL); \
+ }
+#define parcAssertNull(A, M, ...) \
+ if (A != NULL) { \
+ assert(A == NULL); \
+ }
+
+#define parcTrapIllegalValueIf(A, M, ...) \
+ if ((A)) { \
+ assert(!(A)); \
+ }
+#define parcTrapIllegalValue(A, M, ...) \
+ { \
+ parcLog_PrintError("Illegal value: " M, ##__VA_ARGS__); \
+ assert(0); \
+ exit(1); \
+ }
+#define parcTrapNotImplemented(M, ...) \
+ { \
+ parcLog_PrintError("Feature not implemented: " M, ##__VA_ARGS__); \
+ assert(0); \
+ }
+#define parcTrapOutOfBounds(A, M, ...) \
+ { \
+ parcLog_PrintError("Element out of bounds, %zu :" M, A, ##__VA_ARGS__); \
+ assert(0); \
+ exit(1); \
+ }
+#define parcTrapOutOfBoundsIf(A, M, ...) \
+ { assert(!(A)); }
+#define parcTrapOutOfMemory(M, ...) \
+ { \
+ parcLog_PrintError("Out of memory. " M, ##__VA_ARGS__); \
+ assert(0); \
+ exit(1); \
+ }
+#define parcTrapOutOfMemoryIf(A, M, ...) \
+ { assert(!(A)); }
+#define parcTrapUnexpectedState(M, ...) \
+ { \
+ parcLog_PrintError("Unexpected state. " M, ##__VA_ARGS__); \
+ assert(0); \
+ exit(1); \
+ }
+#define parcTrapUnexpectedStateIf(A, M, ...) \
+ { assert(!(A)); }
+#define parcTrapUnrecoverableState(M, ...) \
+ { \
+ parcLog_PrintError("Unrecoverable State: " M, ##__VA_ARGS__); \
+ assert(0); \
+ exit(1); \
+ }
+#define parcTrapInvalidValueIf(A, M, ...) \
+ { assert(!(A)); }
+#define parcTrapCannotObtainLock(M, ...) \
+ { \
+ parcLog_PrintError("Cannot obtain lock: " M, ##__VA_ARGS__); \
+ assert(0); \
+ exit(1); \
+ }
+#define parcTrapCannotObtainLockIf(A, M, ...) \
+ { assert(!(A)); }
+#define parcAssertAligned(address, alignment, ...) \
+ { \
+ assert(((alignment & (~alignment + 1)) == alignment) \
+ ? (((uintptr_t)address) % alignment) == 0 ? 1 : 0 \
+ : 0); \
+ }
+
+#else
+
+#define parcLog_PrintError(M, ...) \
+ fprintf(stderr, "[ERROR] " M "\n", ##__VA_ARGS__);
+
+#define parcAssertTrue(A, M, ...) \
+ if (!(A)) { \
+ parcLog_PrintError(M, ##__VA_ARGS__); \
+ assert(A); \
+ }
+#define parcAssertFalse(A, M, ...) \
+ if ((A)) { \
+ parcLog_PrintError(M, ##__VA_ARGS__); \
+ assert(!(A)); \
+ }
+#define parcAssertNotNull(A, M, ...) \
+ if (A == NULL) { \
+ parcLog_PrintError(M, ##__VA_ARGS__); \
+ assert(A != NULL); \
+ }
+#define parcAssertNull(A, M, ...) \
+ if (A != NULL) { \
+ parcLog_PrintError(M, ##__VA_ARGS__); \
+ assert(A == NULL); \
+ }
+
+#define parcTrapIllegalValueIf(A, M, ...) \
+ if ((A)) { \
+ parcLog_PrintError("Illegal value: " M, ##__VA_ARGS__); \
+ assert(!(A)); \
+ }
+#define parcTrapIllegalValue(A, M, ...) \
+ parcLog_PrintError("Illegal value: " M, ##__VA_ARGS__); \
+ assert(0);
+#define parcTrapNotImplemented(M, ...) \
+ parcLog_PrintError("Feature not implemented: " M, ##__VA_ARGS__); \
+ assert(0);
+#define parcTrapOutOfBounds(A, M, ...) \
+ parcLog_PrintError("Element out of bounds, %zu :" M, A, ##__VA_ARGS__); \
+ assert(0);
+#define parcTrapOutOfBoundsIf(A, M, ...) \
+ if ((A)) { \
+ parcLog_PrintError("Out of bounds: " M, ##__VA_ARGS__); \
+ assert(!(A)); \
+ }
+#define parcTrapOutOfMemory(M, ...) \
+ parcLog_PrintError("Out of memory. " M, ##__VA_ARGS__); \
+ assert(0);
+#define parcTrapOutOfMemoryIf(A, M, ...) \
+ if ((A)) { \
+ parcLog_PrintError("Out of memory. " M, ##__VA_ARGS__); \
+ assert(!(A)); \
+ }
+#define parcTrapUnexpectedState(M, ...) \
+ parcLog_PrintError("Unexpected state. " M, ##__VA_ARGS__); \
+ assert(0);
+#define parcTrapUnexpectedStateIf(A, M, ...) \
+ if ((A)) { \
+ parcLog_PrintError("Unexpected state: " M, ##__VA_ARGS__); \
+ assert(!(A)); \
+ }
+#define parcTrapUnrecoverableState(M, ...) \
+ parcLog_PrintError("Unrecoverable State: " M, ##__VA_ARGS__); \
+ assert(0);
+#define parcTrapInvalidValueIf(A, M, ...) \
+ if ((A)) { \
+ parcLog_PrintError("Invalid value: " M, ##__VA_ARGS__); \
+ assert(!(A)); \
+ }
+#define parcTrapCannotObtainLock(M, ...) \
+ parcLog_PrintError("Cannot obtain lock: " M, ##__VA_ARGS__); \
+ assert(0);
+#define parcTrapCannotObtainLockIf(A, M, ...) \
+ if ((A)) { \
+ parcLog_PrintError("Cannot obtain lock: " M, ##__VA_ARGS__); \
+ assert(!(A)); \
+ }
+#define parcAssertAligned(address, alignment, ...) \
+ parcLog_PrintError(__VA_ARGS__); \
+ assert(((alignment & (~alignment + 1)) == alignment) \
+ ? (((uintptr_t)address) % alignment) == 0 ? 1 : 0 \
+ : 0);
+
+#endif
diff --git a/libparc/parc/concurrent/parc_AtomicUint16.c b/libparc/parc/concurrent/parc_AtomicUint16.c
index 24c9f922..9bf2e478 100755
--- a/libparc/parc/concurrent/parc_AtomicUint16.c
+++ b/libparc/parc/concurrent/parc_AtomicUint16.c
@@ -32,7 +32,7 @@ struct PARCAtomicUint16 {
static void
_parcAtomicUint16_Finalize(PARCAtomicUint16 **instancePtr)
{
- assertNotNull(instancePtr, "Parameter must be a non-null pointer to a PARCAtomicUint16 pointer.");
+ parcAssertNotNull(instancePtr, "Parameter must be a non-null pointer to a PARCAtomicUint16 pointer.");
parcAtomicUint16_OptionalAssertValid((*instancePtr));
@@ -49,7 +49,7 @@ parcObject_ExtendPARCObject(PARCAtomicUint16, _parcAtomicUint16_Finalize, parcAt
void
parcAtomicUint16_AssertValid(const PARCAtomicUint16 *instance)
{
- assertTrue(parcAtomicUint16_IsValid(instance),
+ parcAssertTrue(parcAtomicUint16_IsValid(instance),
"PARCAtomicUint16 is not valid.");
}
diff --git a/libparc/parc/concurrent/parc_AtomicUint32.c b/libparc/parc/concurrent/parc_AtomicUint32.c
index 32ed7a6a..24093951 100755
--- a/libparc/parc/concurrent/parc_AtomicUint32.c
+++ b/libparc/parc/concurrent/parc_AtomicUint32.c
@@ -32,7 +32,7 @@ struct PARCAtomicUint32 {
static void
_parcAtomicUint32_Finalize(PARCAtomicUint32 **instancePtr)
{
- assertNotNull(instancePtr, "Parameter must be a non-null pointer to a PARCAtomicUint32 pointer.");
+ parcAssertNotNull(instancePtr, "Parameter must be a non-null pointer to a PARCAtomicUint32 pointer.");
parcAtomicUint32_OptionalAssertValid((*instancePtr));
@@ -49,7 +49,7 @@ parcObject_ExtendPARCObject(PARCAtomicUint32, _parcAtomicUint32_Finalize, parcAt
void
parcAtomicUint32_AssertValid(const PARCAtomicUint32 *instance)
{
- assertTrue(parcAtomicUint32_IsValid(instance),
+ parcAssertTrue(parcAtomicUint32_IsValid(instance),
"PARCAtomicUint32 is not valid.");
}
diff --git a/libparc/parc/concurrent/parc_AtomicUint64.c b/libparc/parc/concurrent/parc_AtomicUint64.c
index 35d5cf66..326f39db 100755
--- a/libparc/parc/concurrent/parc_AtomicUint64.c
+++ b/libparc/parc/concurrent/parc_AtomicUint64.c
@@ -32,7 +32,7 @@ struct PARCAtomicUint64 {
static void
_parcAtomicUint64_Finalize(PARCAtomicUint64 **instancePtr)
{
- assertNotNull(instancePtr, "Parameter must be a non-null pointer to a PARCAtomicUint64 pointer.");
+ parcAssertNotNull(instancePtr, "Parameter must be a non-null pointer to a PARCAtomicUint64 pointer.");
parcAtomicUint64_OptionalAssertValid((*instancePtr));
@@ -49,7 +49,7 @@ parcObject_ExtendPARCObject(PARCAtomicUint64, _parcAtomicUint64_Finalize, parcAt
void
parcAtomicUint64_AssertValid(const PARCAtomicUint64 *instance)
{
- assertTrue(parcAtomicUint64_IsValid(instance),
+ parcAssertTrue(parcAtomicUint64_IsValid(instance),
"PARCAtomicUint64 is not valid.");
}
diff --git a/libparc/parc/concurrent/parc_AtomicUint8.c b/libparc/parc/concurrent/parc_AtomicUint8.c
index 59a3d865..fd34258b 100755
--- a/libparc/parc/concurrent/parc_AtomicUint8.c
+++ b/libparc/parc/concurrent/parc_AtomicUint8.c
@@ -32,7 +32,7 @@ struct PARCAtomicUint8 {
static void
_parcAtomicUint8_Finalize(PARCAtomicUint8 **instancePtr)
{
- assertNotNull(instancePtr, "Parameter must be a non-null pointer to a PARCAtomicUint8 pointer.");
+ parcAssertNotNull(instancePtr, "Parameter must be a non-null pointer to a PARCAtomicUint8 pointer.");
parcAtomicUint8_OptionalAssertValid((*instancePtr));
@@ -49,7 +49,7 @@ parcObject_ExtendPARCObject(PARCAtomicUint8, _parcAtomicUint8_Finalize, parcAtom
void
parcAtomicUint8_AssertValid(const PARCAtomicUint8 *instance)
{
- assertTrue(parcAtomicUint8_IsValid(instance),
+ parcAssertTrue(parcAtomicUint8_IsValid(instance),
"PARCAtomicUint8 is not valid.");
}
diff --git a/libparc/parc/concurrent/parc_FutureTask.c b/libparc/parc/concurrent/parc_FutureTask.c
index 0ba2c224..d323e0bd 100755
--- a/libparc/parc/concurrent/parc_FutureTask.c
+++ b/libparc/parc/concurrent/parc_FutureTask.c
@@ -46,7 +46,7 @@ _parcFutureTask_Initialise(PARCFutureTask *futureTask)
static bool
_parcFutureTask_Destructor(PARCFutureTask **instancePtr)
{
- assertNotNull(instancePtr, "Parameter must be a non-null pointer to a PARCFutureTask pointer.");
+ parcAssertNotNull(instancePtr, "Parameter must be a non-null pointer to a PARCFutureTask pointer.");
PARCFutureTask *task = *instancePtr;
if (parcObject_IsInstanceOf(task->parameter, &PARCObject_Descriptor)) {
@@ -73,7 +73,7 @@ parcObject_Override(PARCFutureTask, PARCObject,
void
parcFutureTask_AssertValid(const PARCFutureTask *task)
{
- assertTrue(parcFutureTask_IsValid(task),
+ parcAssertTrue(parcFutureTask_IsValid(task),
"PARCFutureTask is not valid.");
}
@@ -273,7 +273,7 @@ parcFutureTask_Run(PARCFutureTask *task)
}
parcFutureTask_Unlock(task);
} else {
- trapCannotObtainLock("Cannot lock PARCFutureTask");
+ parcTrapCannotObtainLock("Cannot lock PARCFutureTask");
}
return task->result;
}
@@ -291,7 +291,7 @@ parcFutureTask_RunAndReset(PARCFutureTask *task)
}
parcFutureTask_Unlock(task);
} else {
- trapCannotObtainLock("Cannot lock PARCFutureTask");
+ parcTrapCannotObtainLock("Cannot lock PARCFutureTask");
}
return result;
diff --git a/libparc/parc/concurrent/parc_Lock.c b/libparc/parc/concurrent/parc_Lock.c
index d510b5ed..493fd44f 100755
--- a/libparc/parc/concurrent/parc_Lock.c
+++ b/libparc/parc/concurrent/parc_Lock.c
@@ -37,7 +37,7 @@ struct PARCLock {
static void
_parcLock_Finalize(PARCLock **instancePtr)
{
- assertNotNull(instancePtr, "Parameter must be a non-null pointer to a PARCLock pointer.");
+ parcAssertNotNull(instancePtr, "Parameter must be a non-null pointer to a PARCLock pointer.");
parcLock_OptionalAssertValid(*instancePtr);
@@ -53,7 +53,7 @@ parcObject_ExtendPARCObject(PARCLock, _parcLock_Finalize, NULL, parcLock_ToStrin
void
parcLock_AssertValid(const PARCLock *instance)
{
- assertTrue(parcLock_IsValid(instance),
+ parcAssertTrue(parcLock_IsValid(instance),
"PARCLock is not valid.");
}
@@ -179,7 +179,7 @@ parcLock_Wait(PARCLock *lock)
{
parcLock_OptionalAssertValid(lock);
- trapUnexpectedStateIf(lock->locked == false,
+ parcTrapUnexpectedStateIf(lock->locked == false,
"You must Lock the object before calling parcLock_Wait");
lock->notified = false;
@@ -193,7 +193,7 @@ parcLock_Notify(PARCLock *lock)
{
parcLock_OptionalAssertValid(lock);
- trapUnexpectedStateIf(lock->locked == false,
+ parcTrapUnexpectedStateIf(lock->locked == false,
"You must Lock the object before calling parcLock_Notify");
lock->notified = true;
diff --git a/libparc/parc/concurrent/parc_Notifier.c b/libparc/parc/concurrent/parc_Notifier.c
index 6cba9147..67e8cfb3 100755
--- a/libparc/parc/concurrent/parc_Notifier.c
+++ b/libparc/parc/concurrent/parc_Notifier.c
@@ -23,7 +23,7 @@
#include <errno.h>
#include <fcntl.h>
-#include <LongBow/runtime.h>
+#include <parc/assert/parc_Assert.h>
#include <parc/concurrent/parc_Notifier.h>
#include <parc/algol/parc_Object.h>
@@ -83,7 +83,7 @@ parcNotifier_Create(void)
notifier->skippedNotify = false;
int failure = pipe(notifier->fds);
- assertFalse(failure, "Error on pipe: %s", strerror(errno));
+ parcAssertFalse(failure, "Error on pipe: %s", strerror(errno));
if (!_parcNotifier_MakeNonblocking(notifier)) {
parcObject_Release((void **) &notifier);
@@ -113,7 +113,7 @@ parcNotifier_Notify(PARCNotifier *notifier)
ssize_t written;
do {
written = write(notifier->fds[PARCNotifierWriteFd], &one, 1);
- assertTrue(written >= 0, "Error writing to socket %d: %s", notifier->fds[PARCNotifierWriteFd], strerror(errno));
+ parcAssertTrue(written >= 0, "Error writing to socket %d: %s", notifier->fds[PARCNotifierWriteFd], strerror(errno));
} while (written == 0);
return true;
diff --git a/libparc/parc/concurrent/parc_RingBuffer.c b/libparc/parc/concurrent/parc_RingBuffer.c
index 9492ae92..d5fb677b 100755
--- a/libparc/parc/concurrent/parc_RingBuffer.c
+++ b/libparc/parc/concurrent/parc_RingBuffer.c
@@ -27,7 +27,7 @@
#include <parc/algol/parc_Memory.h>
#include <parc/algol/parc_Object.h>
-#include <LongBow/runtime.h>
+#include <parc/assert/parc_Assert.h>
#include <parc/concurrent/parc_RingBuffer.h>
diff --git a/libparc/parc/concurrent/parc_RingBuffer_1x1.c b/libparc/parc/concurrent/parc_RingBuffer_1x1.c
index a023f4d7..a93049eb 100755
--- a/libparc/parc/concurrent/parc_RingBuffer_1x1.c
+++ b/libparc/parc/concurrent/parc_RingBuffer_1x1.c
@@ -81,7 +81,7 @@
#include <parc/algol/parc_Memory.h>
#include <parc/algol/parc_Object.h>
-#include <LongBow/runtime.h>
+#include <parc/assert/parc_Assert.h>
#include <parc/concurrent/parc_RingBuffer_1x1.h>
@@ -141,10 +141,10 @@ static PARCRingBuffer1x1 *
_create(uint32_t elements, RingBufferEntryDestroyer *destroyer)
{
PARCRingBuffer1x1 *ring = parcObject_CreateInstance(PARCRingBuffer1x1);
- assertNotNull(ring, "parcObject_Create returned NULL");
+ parcAssertNotNull(ring, "parcObject_Create returned NULL");
ring->buffer = parcMemory_AllocateAndClear(sizeof(void *) * elements);
- assertNotNull((ring->buffer), "parcMemory_AllocateAndClear() failed to allocate array of %u pointers", elements);
+ parcAssertNotNull((ring->buffer), "parcMemory_AllocateAndClear() failed to allocate array of %u pointers", elements);
ring->writer_head = 0;
ring->reader_tail = 0;
@@ -158,7 +158,7 @@ _create(uint32_t elements, RingBufferEntryDestroyer *destroyer)
PARCRingBuffer1x1 *
parcRingBuffer1x1_Create(uint32_t elements, RingBufferEntryDestroyer *destroyer)
{
- assertTrue(_isPowerOfTwo(elements), "Parameter elements must be a power of 2, got %u", elements);
+ parcAssertTrue(_isPowerOfTwo(elements), "Parameter elements must be a power of 2, got %u", elements);
return _create(elements, destroyer);
}
@@ -189,7 +189,7 @@ parcRingBuffer1x1_Put(PARCRingBuffer1x1 *ring, void *data)
return false;
}
- assertNull(ring->buffer[writer_head], "Ring index %u is not null!", writer_head);
+ parcAssertNull(ring->buffer[writer_head], "Ring index %u is not null!", writer_head);
ring->buffer[writer_head] = data;
// we're using this just for atomic write to the integer
diff --git a/libparc/parc/concurrent/parc_RingBuffer_NxM.c b/libparc/parc/concurrent/parc_RingBuffer_NxM.c
index 15ec849b..4ea69e58 100755
--- a/libparc/parc/concurrent/parc_RingBuffer_NxM.c
+++ b/libparc/parc/concurrent/parc_RingBuffer_NxM.c
@@ -29,7 +29,7 @@
#include <parc/algol/parc_Memory.h>
#include <parc/algol/parc_Object.h>
-#include <LongBow/runtime.h>
+#include <parc/assert/parc_Assert.h>
#include <parc/concurrent/parc_RingBuffer_1x1.h>
#include <parc/concurrent/parc_RingBuffer_NxM.h>
@@ -55,7 +55,7 @@ static bool
_lock(pthread_mutex_t *mutex)
{
int failure = pthread_mutex_lock(mutex);
- assertFalse(failure, "Error locking mutex: (%d) %s\n", errno, strerror(errno));
+ parcAssertFalse(failure, "Error locking mutex: (%d) %s\n", errno, strerror(errno));
return true;
}
@@ -63,7 +63,7 @@ static bool
_unlock(pthread_mutex_t *mutex)
{
int failure = pthread_mutex_unlock(mutex);
- assertFalse(failure, "Error unlocking mutex: (%d) %s\n", errno, strerror(errno));
+ parcAssertFalse(failure, "Error unlocking mutex: (%d) %s\n", errno, strerror(errno));
return true;
}
@@ -88,7 +88,7 @@ static PARCRingBufferNxM *
_create(uint32_t elements, RingBufferEntryDestroyer *destroyer)
{
PARCRingBufferNxM *ring = parcObject_CreateInstance(PARCRingBufferNxM);
- assertNotNull(ring, "parcObject_Create returned NULL");
+ parcAssertNotNull(ring, "parcObject_Create returned NULL");
ring->onebyone = parcRingBuffer1x1_Create(elements, destroyer);
ring->destroyer = destroyer;
diff --git a/libparc/parc/concurrent/parc_ScheduledTask.c b/libparc/parc/concurrent/parc_ScheduledTask.c
index 14c1d556..4875abf7 100755
--- a/libparc/parc/concurrent/parc_ScheduledTask.c
+++ b/libparc/parc/concurrent/parc_ScheduledTask.c
@@ -35,7 +35,7 @@ struct PARCScheduledTask {
static bool
_parcScheduledTask_Destructor(PARCScheduledTask **instancePtr)
{
- assertNotNull(instancePtr, "Parameter must be a non-null pointer to a PARCScheduledTask pointer.");
+ parcAssertNotNull(instancePtr, "Parameter must be a non-null pointer to a PARCScheduledTask pointer.");
PARCScheduledTask *task = *instancePtr;
parcFutureTask_Release(&task->task);
@@ -59,7 +59,7 @@ parcObject_Override(PARCScheduledTask, PARCObject,
void
parcScheduledTask_AssertValid(const PARCScheduledTask *instance)
{
- assertTrue(parcScheduledTask_IsValid(instance),
+ parcAssertTrue(parcScheduledTask_IsValid(instance),
"PARCScheduledTask is not valid.");
}
diff --git a/libparc/parc/concurrent/parc_ScheduledThreadPool.c b/libparc/parc/concurrent/parc_ScheduledThreadPool.c
index 3d6c3e57..0b77372e 100644
--- a/libparc/parc/concurrent/parc_ScheduledThreadPool.c
+++ b/libparc/parc/concurrent/parc_ScheduledThreadPool.c
@@ -72,7 +72,7 @@ _workerThread(PARCThread *thread, PARCScheduledThreadPool *pool)
static bool
_parcScheduledThreadPool_Destructor(PARCScheduledThreadPool **instancePtr)
{
- assertNotNull(instancePtr, "Parameter must be a non-null pointer to a PARCScheduledThreadPool pointer.");
+ parcAssertNotNull(instancePtr, "Parameter must be a non-null pointer to a PARCScheduledThreadPool pointer.");
PARCScheduledThreadPool *pool = *instancePtr;
parcThreadPool_Release(&pool->threadPool);
@@ -81,7 +81,7 @@ _parcScheduledThreadPool_Destructor(PARCScheduledThreadPool **instancePtr)
if (parcObject_Lock(pool->workQueue)) {
parcSortedList_Release(&pool->workQueue);
} else {
- assertTrue(false, "Cannot lock the work queue.");
+ parcAssertTrue(false, "Cannot lock the work queue.");
}
return true;
@@ -103,7 +103,7 @@ parcObject_Override(PARCScheduledThreadPool, PARCObject,
void
parcScheduledThreadPool_AssertValid(const PARCScheduledThreadPool *instance)
{
- assertTrue(parcScheduledThreadPool_IsValid(instance),
+ parcAssertTrue(parcScheduledThreadPool_IsValid(instance),
"PARCScheduledThreadPool is not valid.");
}
diff --git a/libparc/parc/concurrent/parc_Synchronizer.c b/libparc/parc/concurrent/parc_Synchronizer.c
index c4475476..ab331442 100755
--- a/libparc/parc/concurrent/parc_Synchronizer.c
+++ b/libparc/parc/concurrent/parc_Synchronizer.c
@@ -44,7 +44,7 @@ struct PARCSynchronizer {
static void
_parcSynchronizer_Finalize(PARCSynchronizer **instancePtr)
{
- assertNotNull(instancePtr, "Parameter must be a non-null pointer to a PARCSynchronizer pointer.");
+ parcAssertNotNull(instancePtr, "Parameter must be a non-null pointer to a PARCSynchronizer pointer.");
parcSynchronizer_OptionalAssertValid((*instancePtr));
}
@@ -58,7 +58,7 @@ parcObject_ExtendPARCObject(PARCSynchronizer, _parcSynchronizer_Finalize, NULL,
void
parcSynchronizer_AssertValid(const PARCSynchronizer *instance)
{
- assertTrue(parcSynchronizer_IsValid(instance),
+ parcAssertTrue(parcSynchronizer_IsValid(instance),
"PARCSynchronizer is not valid.");
}
diff --git a/libparc/parc/concurrent/parc_Thread.c b/libparc/parc/concurrent/parc_Thread.c
index 4bccc47f..50be042d 100644
--- a/libparc/parc/concurrent/parc_Thread.c
+++ b/libparc/parc/concurrent/parc_Thread.c
@@ -36,7 +36,7 @@ struct PARCThread {
static bool
_parcThread_Destructor(PARCThread **instancePtr)
{
- assertNotNull(instancePtr, "Parameter must be a non-null pointer to a PARCThread pointer.");
+ parcAssertNotNull(instancePtr, "Parameter must be a non-null pointer to a PARCThread pointer.");
PARCThread *thread = *instancePtr;
if (thread->argument != NULL) {
@@ -67,14 +67,14 @@ parcObject_Override(PARCThread, PARCObject,
void
parcThread_AssertValid(const PARCThread *instance)
{
- assertTrue(parcThread_IsValid(instance),
+ parcAssertTrue(parcThread_IsValid(instance),
"PARCThread is not valid.");
}
PARCThread *
parcThread_Create(void *(*runFunction)(PARCThread *, PARCObject *), PARCObject *restrict parameter)
{
- assertNotNull(parameter, "Parameter cannot be NULL.");
+ parcAssertNotNull(parameter, "Parameter cannot be NULL.");
PARCThread *result = parcObject_CreateAndClearInstance(PARCThread);
diff --git a/libparc/parc/concurrent/parc_ThreadPool.c b/libparc/parc/concurrent/parc_ThreadPool.c
index 80b093ba..2d9ef6d6 100644
--- a/libparc/parc/concurrent/parc_ThreadPool.c
+++ b/libparc/parc/concurrent/parc_ThreadPool.c
@@ -96,7 +96,7 @@ _parcThreadPool_JoinAll(const PARCThreadPool *pool)
static bool
_parcThreadPool_Destructor(PARCThreadPool **instancePtr)
{
- assertNotNull(instancePtr, "Parameter must be a non-null pointer to a PARCThreadPool pointer.");
+ parcAssertNotNull(instancePtr, "Parameter must be a non-null pointer to a PARCThreadPool pointer.");
PARCThreadPool *pool = *instancePtr;
if (pool->isShutdown == false) {
@@ -130,7 +130,7 @@ parcObject_Override(PARCThreadPool, PARCObject,
void
parcThreadPool_AssertValid(const PARCThreadPool *instance)
{
- assertTrue(parcThreadPool_IsValid(instance),
+ parcAssertTrue(parcThreadPool_IsValid(instance),
"PARCThreadPool is not valid.");
}
diff --git a/libparc/parc/concurrent/parc_Timer.c b/libparc/parc/concurrent/parc_Timer.c
index e6d84de4..b1ecb5d2 100755
--- a/libparc/parc/concurrent/parc_Timer.c
+++ b/libparc/parc/concurrent/parc_Timer.c
@@ -30,7 +30,7 @@ struct PARCTimer {
static void
_parcTimer_Finalize(PARCTimer **instancePtr)
{
- assertNotNull(instancePtr, "Parameter must be a non-null pointer to a PARCTimer pointer.");
+ parcAssertNotNull(instancePtr, "Parameter must be a non-null pointer to a PARCTimer pointer.");
/* cleanup the instance fields here */
@@ -46,7 +46,7 @@ parcObject_ExtendPARCObject(PARCTimer, _parcTimer_Finalize, parcTimer_Copy, parc
void
parcTimer_AssertValid(const PARCTimer *instance)
{
- assertTrue(parcTimer_IsValid(instance),
+ parcAssertTrue(parcTimer_IsValid(instance),
"PARCTimer is not valid.");
}
diff --git a/libparc/parc/concurrent/test/test_parc_ScheduledThreadPool.c b/libparc/parc/concurrent/test/test_parc_ScheduledThreadPool.c
index f466d72a..e2e2473c 100644
--- a/libparc/parc/concurrent/test/test_parc_ScheduledThreadPool.c
+++ b/libparc/parc/concurrent/test/test_parc_ScheduledThreadPool.c
@@ -80,7 +80,7 @@ LONGBOW_TEST_CASE(CreateAcquireRelease, CreateRelease)
parcObjectTesting_AssertAcquireReleaseContract(parcScheduledThreadPool_Acquire, instance);
parcScheduledThreadPool_ShutdownNow(instance);
- assertTrue(parcObject_GetReferenceCount(instance) == 1, "Expected 1 reference count. Actual %llu", parcObject_GetReferenceCount(instance));
+ assertTrue(parcObject_GetReferenceCount(instance) == 1, "Expected 1 reference count. Actual %lu", parcObject_GetReferenceCount(instance));
parcScheduledThreadPool_Release(&instance);
assertNull(instance, "Expected null result from parcScheduledThreadPool_Release();");
@@ -260,7 +260,7 @@ LONGBOW_TEST_CASE(Specialization, OneJob)
PARCFutureTask *task = parcFutureTask_Create(_function, _function);
parcScheduledThreadPool_Schedule(pool, task, parcTimeout_MilliSeconds(2000));
- printf("references %lld\n", parcObject_GetReferenceCount(task));
+ printf("references %lu\n", parcObject_GetReferenceCount(task));
parcFutureTask_Release(&task);
sleep(5);
diff --git a/libparc/parc/concurrent/test/test_parc_Thread.c b/libparc/parc/concurrent/test/test_parc_Thread.c
index 22ca31bf..679f58d0 100644
--- a/libparc/parc/concurrent/test/test_parc_Thread.c
+++ b/libparc/parc/concurrent/test/test_parc_Thread.c
@@ -72,7 +72,12 @@ LONGBOW_TEST_FIXTURE_TEARDOWN(CreateAcquireRelease)
PARCBuffer *buffer = longBowTestCase_Get(testCase, "object");
parcBuffer_Release(&buffer);
+#if INTPTR_MAX == INT32_MAX
uint32_t initialAllocations = (uint32_t) longBowTestCase_Get(testCase, "initialAllocations");
+#else
+ uint64_t initialAllocations = (uint64_t) longBowTestCase_Get(testCase, "initialAllocations");
+#endif
+
if (!parcMemoryTesting_ExpectedOutstanding(initialAllocations, "%s leaked memory.", longBowTestCase_GetFullName(testCase))) {
parcSafeMemory_ReportAllocation(1);
return LONGBOW_STATUS_MEMORYLEAK;
@@ -126,7 +131,12 @@ LONGBOW_TEST_FIXTURE_TEARDOWN(Object)
PARCBuffer *buffer = longBowTestCase_Get(testCase, "object");
parcBuffer_Release(&buffer);
+#if INTPTR_MAX == INT32_MAX
uint32_t initialAllocations = (uint32_t) longBowTestCase_Get(testCase, "initialAllocations");
+#else
+ uint64_t initialAllocations = (uint64_t) longBowTestCase_Get(testCase, "initialAllocations");
+#endif
+
if (!parcMemoryTesting_ExpectedOutstanding(initialAllocations, "%s leaked memory.", longBowTestCase_GetFullName(testCase))) {
parcSafeMemory_ReportAllocation(1);
return LONGBOW_STATUS_MEMORYLEAK;
@@ -239,7 +249,12 @@ LONGBOW_TEST_FIXTURE_SETUP(Specialization)
LONGBOW_TEST_FIXTURE_TEARDOWN(Specialization)
{
+#if INTPTR_MAX == INT32_MAX
uint32_t initialAllocations = (uint32_t) longBowTestCase_Get(testCase, "initialAllocations");
+#else
+ uint64_t initialAllocations = (uint64_t) longBowTestCase_Get(testCase, "initialAllocations");
+#endif
+
if (!parcMemoryTesting_ExpectedOutstanding(initialAllocations, "%s leaked memory.", longBowTestCase_GetFullName(testCase))) {
parcSafeMemory_ReportAllocation(1);
return LONGBOW_STATUS_MEMORYLEAK;
diff --git a/libparc/parc/concurrent/test/test_parc_ThreadPool.c b/libparc/parc/concurrent/test/test_parc_ThreadPool.c
index 6ed6e4d3..5ec60fa5 100644
--- a/libparc/parc/concurrent/test/test_parc_ThreadPool.c
+++ b/libparc/parc/concurrent/test/test_parc_ThreadPool.c
@@ -255,7 +255,7 @@ LONGBOW_TEST_CASE(Object, parcThreadPool_Execute)
assertTrue(shutdownSuccess, "parcThreadPool_AwaitTermination timed-out");
uint64_t count = parcThreadPool_GetCompletedTaskCount(pool);
- assertTrue(count == 5, "Expected 5, actual %lld", count);
+ assertTrue(count == 5, "Expected 5, actual %lu", count);
parcThreadPool_Release(&pool);
diff --git a/libparc/parc/developer/parc_Stopwatch.c b/libparc/parc/developer/parc_Stopwatch.c
index dfd8a200..2b696f4a 100644
--- a/libparc/parc/developer/parc_Stopwatch.c
+++ b/libparc/parc/developer/parc_Stopwatch.c
@@ -40,7 +40,7 @@ struct PARCStopwatch {
static bool
_parcStopwatch_Destructor(PARCStopwatch **instancePtr)
{
- assertNotNull(instancePtr, "Parameter must be a non-null pointer to a PARCStopwatch pointer.");
+ parcAssertNotNull(instancePtr, "Parameter must be a non-null pointer to a PARCStopwatch pointer.");
/* cleanup the instance fields here */
return true;
@@ -63,7 +63,7 @@ parcObject_Override(PARCStopwatch, PARCObject,
void
parcStopwatch_AssertValid(const PARCStopwatch *instance)
{
- assertTrue(parcStopwatch_IsValid(instance),
+ parcAssertTrue(parcStopwatch_IsValid(instance),
"PARCStopwatch is not valid.");
}
diff --git a/libparc/parc/developer/test/test_parc_Stopwatch.c b/libparc/parc/developer/test/test_parc_Stopwatch.c
index 0f205ec7..94072c2f 100644
--- a/libparc/parc/developer/test/test_parc_Stopwatch.c
+++ b/libparc/parc/developer/test/test_parc_Stopwatch.c
@@ -214,7 +214,7 @@ LONGBOW_TEST_CASE(Specialization, parcStopwatch_Multi)
parcStopwatch_Start(a, b, c);
sleep(2);
uint64_t nanos = parcStopwatch_ElapsedTimeNanos(a);
- printf("%llu %llu\n", nanos, nanos / 1000000000);
+ printf("%lu %lu\n", nanos, nanos / 1000000000);
if (nanos > (3000000000)) {
parcStopwatch_Display(a, 0);
}
@@ -231,7 +231,7 @@ LONGBOW_TEST_CASE(Specialization, parcStopwatch_ElapsedTimeNanos)
parcStopwatch_StartImpl(instance, NULL);
sleep(2);
uint64_t nanos = parcStopwatch_ElapsedTimeNanos(instance);
- printf("%llu %llu\n", nanos, nanos / 1000000000);
+ printf("%lu %lu\n", nanos, nanos / 1000000000);
if (nanos > (3000000000)) {
parcStopwatch_Display(instance, 0);
}
diff --git a/libparc/parc/libparc_About.c b/libparc/parc/libparc_About.c
index 0120caf1..4afd72fc 100644
--- a/libparc/parc/libparc_About.c
+++ b/libparc/parc/libparc_About.c
@@ -1,5 +1,5 @@
// DO NOT EDIT THIS FILE. IT IS AUTOMATICALLY GENERATED.
-// longbow-generate-about 1.0.20170206.46e2c73a 2017-02-06T08:50:09Z
+// generate-about 1.0.20170206.46e2c73a 2017-02-06T08:50:09Z
#include "libparc_About.h"
diff --git a/libparc/parc/libparc_About.h b/libparc/parc/libparc_About.h
index 39fee44f..8ecd59ac 100755
--- a/libparc/parc/libparc_About.h
+++ b/libparc/parc/libparc_About.h
@@ -1,5 +1,5 @@
// DO NOT EDIT THIS FILE. IT IS AUTOMATICALLY GENERATED.
-// longbow-generate-about 1.0.20170206.46e2c73a 2017-02-06T08:50:09Z
+// generate-about 1.0.20170206.46e2c73a 2017-02-06T08:50:09Z
#ifndef libparc_About_h
#define libparc_About_h
diff --git a/libparc/parc/logging/parc_Log.c b/libparc/parc/logging/parc_Log.c
index e3948c36..4aa2a679 100755
--- a/libparc/parc/logging/parc_Log.c
+++ b/libparc/parc/logging/parc_Log.c
@@ -20,7 +20,7 @@
#include <stdio.h>
#include <sys/time.h>
-#include <LongBow/runtime.h>
+#include <parc/assert/parc_Assert.h>
#include <parc/algol/parc_Object.h>
#include <parc/algol/parc_Memory.h>
@@ -67,7 +67,7 @@ parcLog_Create(const char *hostName, const char *applicationName, const char *pr
PARCLog *result = parcObject_CreateInstance(PARCLog);
if (result == NULL) {
- trapOutOfMemory("Creating an instance of PARCLog.");
+ parcTrapOutOfMemory("Creating an instance of PARCLog.");
}
result->hostName = parcMemory_StringDuplicate(hostName, strlen(hostName));
@@ -103,7 +103,7 @@ _parcLog_CreateEntry(PARCLog *log, PARCLogLevel level, uint64_t messageId, const
{
char *cString;
int nwritten = vasprintf(&cString, format, ap);
- assertTrue(nwritten >= 0, "Error calling vasprintf");
+ parcAssertTrue(nwritten >= 0, "Error calling vasprintf");
struct timeval timeStamp;
gettimeofday(&timeStamp, NULL);
diff --git a/libparc/parc/logging/parc_LogEntry.c b/libparc/parc/logging/parc_LogEntry.c
index f84e3719..994efbf1 100644
--- a/libparc/parc/logging/parc_LogEntry.c
+++ b/libparc/parc/logging/parc_LogEntry.c
@@ -17,7 +17,7 @@
*/
#include <config.h>
-#include <LongBow/runtime.h>
+#include <parc/assert/parc_Assert.h>
#include <inttypes.h>
#include <stdarg.h>
@@ -89,7 +89,7 @@ parcLogEntry_Create(PARCLogLevel level,
{
PARCLogEntry *result = parcObject_CreateInstance(PARCLogEntry);
if (result == NULL) {
- trapOutOfMemory("Creating an instance of PARCLogEntry.");
+ parcTrapOutOfMemory("Creating an instance of PARCLogEntry.");
}
result->version = _parcLog_Version;
result->timeStamp = timeStamp;
diff --git a/libparc/parc/logging/parc_LogManager.c b/libparc/parc/logging/parc_LogManager.c
index 28f24d07..939ab90d 100755
--- a/libparc/parc/logging/parc_LogManager.c
+++ b/libparc/parc/logging/parc_LogManager.c
@@ -17,7 +17,7 @@
*/
#include <config.h>
-#include <LongBow/runtime.h>
+#include <parc/assert/parc_Assert.h>
#include <parc/algol/parc_Object.h>
#include <parc/algol/parc_Memory.h>
diff --git a/libparc/parc/memory/parc_BufferPool.c b/libparc/parc/memory/parc_BufferPool.c
index d6695fdf..d448c518 100644
--- a/libparc/parc/memory/parc_BufferPool.c
+++ b/libparc/parc/memory/parc_BufferPool.c
@@ -39,7 +39,7 @@ struct PARCBufferPool {
static bool
_parcBufferPool_Destructor(PARCBufferPool **instancePtr)
{
- assertNotNull(instancePtr, "Parameter must be a non-null pointer to a PARCBufferPool pointer.");
+ parcAssertNotNull(instancePtr, "Parameter must be a non-null pointer to a PARCBufferPool pointer.");
PARCBufferPool *pool = *instancePtr;
@@ -91,7 +91,7 @@ parcObject_Override(PARCBufferPool, PARCObject,
void
parcBufferPool_AssertValid(const PARCBufferPool *instance)
{
- assertTrue(parcBufferPool_IsValid(instance),
+ parcAssertTrue(parcBufferPool_IsValid(instance),
"PARCBufferPool is not valid.");
}
diff --git a/libparc/parc/object/test/CMakeLists.txt b/libparc/parc/object/test/CMakeLists.txt
deleted file mode 100644
index 3be628ab..00000000
--- a/libparc/parc/object/test/CMakeLists.txt
+++ /dev/null
@@ -1,12 +0,0 @@
-set(TestsExpectedToPass
- )
-
-# Enable gcov output for the tests
-add_definitions(--coverage)
-set(CMAKE_EXE_LINKER_FLAGS ${CMAKE_EXE_LINKER_FLAGS} " --coverage")
-
-foreach(test ${TestsExpectedToPass})
- AddTest(${test})
-endforeach()
-
-
diff --git a/libparc/parc/security/command-line/parc-publickey.c b/libparc/parc/security/command-line/parc-publickey.c
index 56d35935..6b0caa08 100644
--- a/libparc/parc/security/command-line/parc-publickey.c
+++ b/libparc/parc/security/command-line/parc-publickey.c
@@ -20,7 +20,7 @@
#include <string.h>
#include <errno.h>
-#include <LongBow/runtime.h>
+#include <parc/assert/parc_Assert.h>
#include <parc/algol/parc_ArrayList.h>
#include <parc/security/parc_Security.h>
diff --git a/libparc/parc/security/command-line/parcPublicKey_About.c b/libparc/parc/security/command-line/parcPublicKey_About.c
index 6a242cf4..c992de22 100644
--- a/libparc/parc/security/command-line/parcPublicKey_About.c
+++ b/libparc/parc/security/command-line/parcPublicKey_About.c
@@ -1,5 +1,5 @@
// DO NOT EDIT THIS FILE. IT IS AUTOMATICALLY GENERATED.
-// longbow-generate-about 1.0.20170206.46e2c73a 2017-02-06T08:50:09Z
+// generate-about 1.0.20170206.46e2c73a 2017-02-06T08:50:09Z
#include "parcPublicKey_About.h"
diff --git a/libparc/parc/security/command-line/parcPublicKey_About.h b/libparc/parc/security/command-line/parcPublicKey_About.h
index 64670ad8..fccb7b7d 100755
--- a/libparc/parc/security/command-line/parcPublicKey_About.h
+++ b/libparc/parc/security/command-line/parcPublicKey_About.h
@@ -1,5 +1,5 @@
// DO NOT EDIT THIS FILE. IT IS AUTOMATICALLY GENERATED.
-// longbow-generate-about 1.0.20170206.46e2c73a 2017-02-06T08:50:09Z
+// generate-about 1.0.20170206.46e2c73a 2017-02-06T08:50:09Z
#ifndef parcPublicKey_About_h
#define parcPublicKey_About_h
diff --git a/libparc/parc/security/parc_CertificateFactory.c b/libparc/parc/security/parc_CertificateFactory.c
index 52cef4af..c737e425 100644
--- a/libparc/parc/security/parc_CertificateFactory.c
+++ b/libparc/parc/security/parc_CertificateFactory.c
@@ -91,6 +91,8 @@ parcCertificateFactory_CreateSelfSignedCertificate(PARCCertificateFactory *facto
case PARCSigningAlgorithm_ECDSA:
certificate = parcX509Certificate_CreateSelfSignedCertificate(privateKey, subjectName, (int) keyLength, valdityDays, PARCKeyType_EC);
break;
+ default:
+ break;
}
// This may fail.
diff --git a/libparc/parc/security/parc_CertificateType.c b/libparc/parc/security/parc_CertificateType.c
index 9da557fd..86581675 100755
--- a/libparc/parc/security/parc_CertificateType.c
+++ b/libparc/parc/security/parc_CertificateType.c
@@ -20,7 +20,7 @@
#include <stdio.h>
#include <string.h>
-#include <LongBow/runtime.h>
+#include <parc/assert/parc_Assert.h>
#include <parc/security/parc_CertificateType.h>
diff --git a/libparc/parc/security/parc_ContainerEncoding.c b/libparc/parc/security/parc_ContainerEncoding.c
index 8f51031a..3376e69a 100755
--- a/libparc/parc/security/parc_ContainerEncoding.c
+++ b/libparc/parc/security/parc_ContainerEncoding.c
@@ -20,7 +20,7 @@
#include <stdio.h>
#include <string.h>
-#include <LongBow/runtime.h>
+#include <parc/assert/parc_Assert.h>
#include <parc/security/parc_ContainerEncoding.h>
diff --git a/libparc/parc/security/parc_CryptoCache.c b/libparc/parc/security/parc_CryptoCache.c
index a454819b..07caaed7 100755
--- a/libparc/parc/security/parc_CryptoCache.c
+++ b/libparc/parc/security/parc_CryptoCache.c
@@ -36,7 +36,7 @@
#include <stdio.h>
#include <string.h>
-#include <LongBow/runtime.h>
+#include <parc/assert/parc_Assert.h>
#include <parc/algol/parc_Memory.h>
#include <parc/security/parc_CryptoCache.h>
@@ -68,7 +68,7 @@ PARCCryptoCache *
parcCryptoCache_Create()
{
PARCCryptoCache *cache = parcMemory_AllocateAndClear(sizeof(PARCCryptoCache));
- assertNotNull(cache, "parcMemory_AllocateAndClear(%zu) returned NULL", sizeof(PARCCryptoCache));
+ parcAssertNotNull(cache, "parcMemory_AllocateAndClear(%zu) returned NULL", sizeof(PARCCryptoCache));
// KeyIdDestroyer is NULL because we get the keyid out of the key, and it will be destroyed
// when the key is destroyed.
@@ -88,8 +88,8 @@ parcCryptoCache_Create()
void
parcCryptoCache_Destroy(PARCCryptoCache **cryptoCachePtr)
{
- assertNotNull(cryptoCachePtr, "Parameter must be non-null double pointer");
- assertNotNull(*cryptoCachePtr, "Parameter must dereference to non-null pointer");
+ parcAssertNotNull(cryptoCachePtr, "Parameter must be non-null double pointer");
+ parcAssertNotNull(*cryptoCachePtr, "Parameter must dereference to non-null pointer");
PARCCryptoCache *cache = *cryptoCachePtr;
parcHashCodeTable_Destroy(&cache->keyid_table);
@@ -111,8 +111,8 @@ parcCryptoCache_Destroy(PARCCryptoCache **cryptoCachePtr)
bool
parcCryptoCache_AddKey(PARCCryptoCache *cache, PARCKey *original_key)
{
- assertNotNull(cache, "Parameter cache must be non-null");
- assertNotNull(original_key, "Parameter key must be non-null");
+ parcAssertNotNull(cache, "Parameter cache must be non-null");
+ parcAssertNotNull(original_key, "Parameter key must be non-null");
PARCKey *key = parcKey_Copy(original_key);
PARCKeyId *keyid = parcKey_GetKeyId(key);
@@ -133,8 +133,8 @@ parcCryptoCache_AddKey(PARCCryptoCache *cache, PARCKey *original_key)
const PARCKey *
parcCryptoCache_GetKey(PARCCryptoCache *cache, const PARCKeyId *keyid)
{
- assertNotNull(cache, "Parameter cache must be non-null");
- assertNotNull(keyid, "Parameter keyid must be non-null");
+ parcAssertNotNull(cache, "Parameter cache must be non-null");
+ parcAssertNotNull(keyid, "Parameter keyid must be non-null");
return parcHashCodeTable_Get(cache->keyid_table, keyid);
}
@@ -150,8 +150,8 @@ parcCryptoCache_GetKey(PARCCryptoCache *cache, const PARCKeyId *keyid)
void
parcCryptoCache_RemoveKey(PARCCryptoCache *cache, const PARCKeyId *keyid)
{
- assertNotNull(cache, "Parameter cache must be non-null");
- assertNotNull(keyid, "Parameter keyid must be non-null");
+ parcAssertNotNull(cache, "Parameter cache must be non-null");
+ parcAssertNotNull(keyid, "Parameter keyid must be non-null");
parcHashCodeTable_Del(cache->keyid_table, keyid);
}
diff --git a/libparc/parc/security/parc_CryptoHash.c b/libparc/parc/security/parc_CryptoHash.c
index 3fc40b16..d0f82af3 100755
--- a/libparc/parc/security/parc_CryptoHash.c
+++ b/libparc/parc/security/parc_CryptoHash.c
@@ -28,7 +28,7 @@
#include <config.h>
#include <stdio.h>
-#include <LongBow/runtime.h>
+#include <parc/assert/parc_Assert.h>
#include <parc/security/parc_CryptoHash.h>
#include <parc/algol/parc_Memory.h>
@@ -62,7 +62,7 @@ PARCCryptoHash *
parcCryptoHash_Create(PARCCryptoHashType digestType, const PARCBuffer *digestBuffer)
{
PARCCryptoHash *parcDigest = parcObject_CreateInstance(PARCCryptoHash);
- assertNotNull(parcDigest, "parcMemory_AllocateAndClear(%zu) returned NULL", sizeof(PARCCryptoHash));
+ parcAssertNotNull(parcDigest, "parcMemory_AllocateAndClear(%zu) returned NULL", sizeof(PARCCryptoHash));
parcDigest->type = digestType;
parcDigest->digestBuffer = parcBuffer_Acquire((PARCBuffer *) digestBuffer); // casting to un-const
@@ -82,7 +82,7 @@ PARCCryptoHash *
parcCryptoHash_CreateFromArray(PARCCryptoHashType digestType, const void *buffer, size_t length)
{
PARCCryptoHash *parcDigest = parcObject_CreateInstance(PARCCryptoHash);
- assertNotNull(parcDigest, "parcMemory_AllocateAndClear(%zu) returned NULL", sizeof(PARCCryptoHash));
+ parcAssertNotNull(parcDigest, "parcMemory_AllocateAndClear(%zu) returned NULL", sizeof(PARCCryptoHash));
parcDigest->type = digestType;
// create a reference counted copy
@@ -103,7 +103,7 @@ parcCryptoHash_CreateFromArray(PARCCryptoHashType digestType, const void *buffer
PARCCryptoHashType
parcCryptoHash_GetDigestType(const PARCCryptoHash *parcDigest)
{
- assertNotNull(parcDigest, "Parameter must be non-null");
+ parcAssertNotNull(parcDigest, "Parameter must be non-null");
return parcDigest->type;
}
@@ -129,6 +129,6 @@ parcCryptoHash_Equals(const PARCCryptoHash *a, const PARCCryptoHash *b)
PARCBuffer *
parcCryptoHash_GetDigest(const PARCCryptoHash *parcDigest)
{
- assertNotNull(parcDigest, "Parameter must be non-null");
+ parcAssertNotNull(parcDigest, "Parameter must be non-null");
return parcDigest->digestBuffer;
}
diff --git a/libparc/parc/security/parc_CryptoHashType.c b/libparc/parc/security/parc_CryptoHashType.c
index 78440f33..beacc3f4 100644
--- a/libparc/parc/security/parc_CryptoHashType.c
+++ b/libparc/parc/security/parc_CryptoHashType.c
@@ -20,7 +20,7 @@
#include <stdio.h>
#include <string.h>
-#include <LongBow/runtime.h>
+#include <parc/assert/parc_Assert.h>
#include <parc/security/parc_CryptoHashType.h>
diff --git a/libparc/parc/security/parc_CryptoHasher.c b/libparc/parc/security/parc_CryptoHasher.c
index f2c00967..a4d492ff 100755
--- a/libparc/parc/security/parc_CryptoHasher.c
+++ b/libparc/parc/security/parc_CryptoHasher.c
@@ -30,7 +30,7 @@
#include <parc/security/parc_CryptoHasher.h>
#include <parc/algol/parc_Buffer.h>
#include <parc/algol/parc_Memory.h>
-#include <LongBow/runtime.h>
+#include <parc/assert/parc_Assert.h>
#include <parc/algol/parc_Object.h>
#ifdef __APPLE__
@@ -137,7 +137,7 @@ PARCCryptoHasher *
parcCryptoHasher_Create(PARCCryptoHashType type)
{
PARCCryptoHasher *hasher = parcObject_CreateInstance(PARCCryptoHasher);
- assertNotNull(hasher, "parcMemory_AllocateAndClear(%zu) returned NULL", sizeof(PARCCryptoHasher));
+ parcAssertNotNull(hasher, "parcMemory_AllocateAndClear(%zu) returned NULL", sizeof(PARCCryptoHasher));
hasher->type = type;
@@ -156,7 +156,7 @@ parcCryptoHasher_Create(PARCCryptoHashType type)
default:
parcMemory_Deallocate((void **) &hasher);
- trapIllegalValue(type, "Unknown hasher type: %d", type);
+ parcTrapIllegalValue(type, "Unknown hasher type: %d", type);
}
hasher->hasher_ctx = hasher->functor.hasher_setup(hasher->functor.functor_env);
@@ -167,7 +167,7 @@ PARCCryptoHasher *
parcCryptoHasher_CustomHasher(PARCCryptoHashType type, PARCCryptoHasherInterface functor)
{
PARCCryptoHasher *hasher = parcObject_CreateInstance(PARCCryptoHasher);
- assertNotNull(hasher, "parcMemory_AllocateAndClear(%zu) returned NULL", sizeof(PARCCryptoHasher));
+ parcAssertNotNull(hasher, "parcMemory_AllocateAndClear(%zu) returned NULL", sizeof(PARCCryptoHasher));
hasher->type = type;
hasher->functor = functor;
hasher->hasher_ctx = hasher->functor.hasher_setup(hasher->functor.functor_env);
@@ -186,7 +186,7 @@ parcCryptoHasher_CustomHasher(PARCCryptoHashType type, PARCCryptoHasherInterface
int
parcCryptoHasher_Init(PARCCryptoHasher *digester)
{
- assertNotNull(digester, "Parameter must be non-null");
+ parcAssertNotNull(digester, "Parameter must be non-null");
int success = digester->functor.hasher_init(digester->hasher_ctx);
return (success == 1) ? 0 : -1;
@@ -195,7 +195,7 @@ parcCryptoHasher_Init(PARCCryptoHasher *digester)
int
parcCryptoHasher_UpdateBytes(PARCCryptoHasher *digester, const void *buffer, size_t length)
{
- assertNotNull(digester, "Parameter must be non-null");
+ parcAssertNotNull(digester, "Parameter must be non-null");
int success = digester->functor.hasher_update(digester->hasher_ctx, buffer, length);
return (success == 1) ? 0 : -1;
}
@@ -203,7 +203,7 @@ parcCryptoHasher_UpdateBytes(PARCCryptoHasher *digester, const void *buffer, siz
int
parcCryptoHasher_UpdateBuffer(PARCCryptoHasher *digester, const PARCBuffer *buffer)
{
- assertNotNull(digester, "Parameter must be non-null");
+ parcAssertNotNull(digester, "Parameter must be non-null");
PARCBuffer *buf = parcBuffer_Slice(buffer);
size_t length = parcBuffer_Limit(buf);
void *byteArray = parcBuffer_Overlay(buf, length);
@@ -216,7 +216,7 @@ parcCryptoHasher_UpdateBuffer(PARCCryptoHasher *digester, const PARCBuffer *buff
PARCCryptoHash *
parcCryptoHasher_Finalize(PARCCryptoHasher *digester)
{
- assertNotNull(digester, "Parameter must be non-null");
+ parcAssertNotNull(digester, "Parameter must be non-null");
PARCBuffer *digestBuffer = digester->functor.hasher_finalize(digester->hasher_ctx);
if (parcBuffer_Position(digestBuffer) != 0) {
@@ -486,7 +486,7 @@ static void *
_crc32_create(void *env __attribute__ ((unused)))
{
_CRC32CState *ctx = parcMemory_AllocateAndClear(sizeof(_CRC32CState));
- assertNotNull(ctx, "parcMemory_AllocateAndClear(%zu) returned NULL for _CRC32CState", sizeof(_CRC32CState));
+ parcAssertNotNull(ctx, "parcMemory_AllocateAndClear(%zu) returned NULL for _CRC32CState", sizeof(_CRC32CState));
// Now initialize it with our digest and key, so in hmac_init we can avoid using those
return ctx;
diff --git a/libparc/parc/security/parc_CryptoSuite.c b/libparc/parc/security/parc_CryptoSuite.c
index 43339121..b7e1938b 100755
--- a/libparc/parc/security/parc_CryptoSuite.c
+++ b/libparc/parc/security/parc_CryptoSuite.c
@@ -17,7 +17,7 @@
*/
#include <config.h>
-#include <LongBow/runtime.h>
+#include <parc/assert/parc_Assert.h>
#include <parc/security/parc_CryptoSuite.h>
#include <parc/security/parc_SigningAlgorithm.h>
@@ -40,7 +40,7 @@ parcCryptoSuite_GetCryptoHash(PARCCryptoSuite suite)
return PARCCryptoHashType_CRC32C;
default:
- trapIllegalValue(suite, "Unknown crypto suite: %d", suite);
+ parcTrapIllegalValue(suite, "Unknown crypto suite: %d", suite);
}
}
@@ -65,7 +65,7 @@ parcCryptoSuite_GetSignatureSizeBytes(PARCCryptoSuite suite, int keyLengthBits)
return 4;
default:
- trapIllegalValue(suite, "Unknown crypto suite: %d", suite);
+ parcTrapIllegalValue(suite, "Unknown crypto suite: %d", suite);
}
}
@@ -81,7 +81,7 @@ PARCCryptoSuite parcCryptoSuite_GetFromSigningHash(PARCSigningAlgorithm signAlgo
case PARCSigningAlgorithm_NULL:
return PARCCryptoSuite_NULL_CRC32C;
default:
- trapIllegalValue(suite, "Unknown signing algorithm suite: %d", signAlgo);
+ parcTrapIllegalValue(suite, "Unknown signing algorithm suite: %d", signAlgo);
}
}
@@ -106,6 +106,6 @@ parcCryptoSuite_GetSigningAlgorithm(PARCCryptoSuite suite)
return PARCSigningAlgorithm_NULL;
default:
- trapIllegalValue(suit, "Unknown crypto suite: %d", suite);
+ parcTrapIllegalValue(suit, "Unknown crypto suite: %d", suite);
}
}
diff --git a/libparc/parc/security/parc_DiffieHellmanKeyShare.c b/libparc/parc/security/parc_DiffieHellmanKeyShare.c
index 250e5664..313af4a3 100644
--- a/libparc/parc/security/parc_DiffieHellmanKeyShare.c
+++ b/libparc/parc/security/parc_DiffieHellmanKeyShare.c
@@ -130,7 +130,7 @@ parcDiffieHellmanKeyShare_Create(PARCDiffieHellmanGroup groupType)
}
if (keyShare->privateKey == NULL) {
- assertTrue(false, "Unable to instantiate a private key.");
+ parcAssertTrue(false, "Unable to instantiate a private key.");
parcDiffieHellmanKeyShare_Release(&keyShare);
}
}
diff --git a/libparc/parc/security/parc_Identity.c b/libparc/parc/security/parc_Identity.c
index b48046ba..daaf661d 100755
--- a/libparc/parc/security/parc_Identity.c
+++ b/libparc/parc/security/parc_Identity.c
@@ -17,7 +17,7 @@
*/
#include <config.h>
-#include <LongBow/runtime.h>
+#include <parc/assert/parc_Assert.h>
#include <parc/algol/parc_Object.h>
#include <parc/security/parc_Identity.h>
@@ -53,13 +53,13 @@ parcIdentity_IsValid(const PARCIdentity *identity)
void
parcIdentity_AssertValid(const PARCIdentity *identity)
{
- trapInvalidValueIf(parcIdentity_IsValid(identity) == false, "PARCIdentity");
+ parcTrapInvalidValueIf(parcIdentity_IsValid(identity) == false, "PARCIdentity");
}
PARCIdentity *
parcIdentity_Create(PARCObject *instance, const PARCIdentityInterface *interface)
{
- assertNotNull(interface, "Got null interface in parcIdentity_Create");
+ parcAssertNotNull(interface, "Got null interface in parcIdentity_Create");
PARCIdentity *result = parcObject_CreateInstance(PARCIdentity);
@@ -107,7 +107,7 @@ parcIdentity_CreateSigner(const PARCIdentity *identity, PARCCryptoHashType hash)
void
parcIdentity_Display(const PARCIdentity *identity, int indentation)
{
- assertNotNull(identity->interface->Display, "Got null implementation in parcIdentity_Display");
+ parcAssertNotNull(identity->interface->Display, "Got null implementation in parcIdentity_Display");
parcDisplayIndented_PrintLine(indentation, "PARCIdentity@%p {", identity);
parcDisplayIndented_PrintLine(indentation, ".instance=");
diff --git a/libparc/parc/security/parc_IdentityFile.c b/libparc/parc/security/parc_IdentityFile.c
index 0d22a51e..8372a111 100644
--- a/libparc/parc/security/parc_IdentityFile.c
+++ b/libparc/parc/security/parc_IdentityFile.c
@@ -17,7 +17,7 @@
*/
#include <config.h>
-#include <LongBow/runtime.h>
+#include <parc/assert/parc_Assert.h>
#include <sys/stat.h>
#include <unistd.h>
diff --git a/libparc/parc/security/parc_InMemoryVerifier.c b/libparc/parc/security/parc_InMemoryVerifier.c
index c3af4d7d..33f6fcfe 100644
--- a/libparc/parc/security/parc_InMemoryVerifier.c
+++ b/libparc/parc/security/parc_InMemoryVerifier.c
@@ -27,7 +27,7 @@
#include <config.h>
#include <stdio.h>
-#include <LongBow/runtime.h>
+#include <parc/assert/parc_Assert.h>
#include <parc/security/parc_InMemoryVerifier.h>
#include <parc/security/parc_CryptoHasher.h>
#include <parc/security/parc_CryptoCache.h>
@@ -88,7 +88,7 @@ _parcInMemoryVerifier_GetCryptoHasher(void *interfaceContext, PARCKeyId *keyid,
return false;
}
- assertFalse(parcKey_GetSigningAlgorithm(key) == PARCSigningAlgorithm_HMAC, "HMAC not supported yet");
+ parcAssertFalse(parcKey_GetSigningAlgorithm(key) == PARCSigningAlgorithm_HMAC, "HMAC not supported yet");
switch (hashType) {
case PARCCryptoHashType_SHA256:
@@ -98,7 +98,7 @@ _parcInMemoryVerifier_GetCryptoHasher(void *interfaceContext, PARCKeyId *keyid,
return verifier->hasher_sha512;
default:
- trapUnexpectedState("unsupported hash type: %d", hashType);
+ parcTrapUnexpectedState("unsupported hash type: %d", hashType);
}
}
@@ -154,7 +154,7 @@ _parcInMemoryVerifier_AllowedCryptoSuite(void *interfaceContext, PARCKeyId *keyi
break;
default:
- trapUnexpectedState("Unknown signing algorithm: %s",
+ parcTrapUnexpectedState("Unknown signing algorithm: %s",
parcSigningAlgorithm_ToString(parcKey_GetSigningAlgorithm(key)));
return false;
}
@@ -190,7 +190,7 @@ _parcInMemoryVerifier_VerifyDigest(void *interfaceContext, PARCKeyId *keyid, PAR
return false;
}
- assertTrue(_parcInMemoryVerifier_AllowedCryptoSuite(interfaceContext, keyid, suite), "Invalid crypto suite for keyid");
+ parcAssertTrue(_parcInMemoryVerifier_AllowedCryptoSuite(interfaceContext, keyid, suite), "Invalid crypto suite for keyid");
if (parcKey_GetSigningAlgorithm(key) != parcSignature_GetSigningAlgorithm(objectSignature)) {
fprintf(stdout, "Signatured failed, signing algorithms do not match: key %s sig %s\n",
@@ -214,15 +214,15 @@ _parcInMemoryVerifier_VerifyDigest(void *interfaceContext, PARCKeyId *keyid, PAR
return _parcInMemoryVerifier_ECDSAKey_Verify(verifier, locallyComputedHash, objectSignature, parcKey_GetKey(key));
case PARCSigningAlgorithm_DSA:
- trapNotImplemented("DSA not supported");
+ parcTrapNotImplemented("DSA not supported");
break;
case PARCSigningAlgorithm_HMAC:
- trapNotImplemented("HMAC not supported");
+ parcTrapNotImplemented("HMAC not supported");
break;
default:
- trapUnexpectedState("Unknown signing algorithm: %d", parcSignature_GetSigningAlgorithm(objectSignature));
+ parcTrapUnexpectedState("Unknown signing algorithm: %d", parcSignature_GetSigningAlgorithm(objectSignature));
}
@@ -232,19 +232,19 @@ _parcInMemoryVerifier_VerifyDigest(void *interfaceContext, PARCKeyId *keyid, PAR
static void
_parcInMemoryVerifier_AddKey(void *interfaceContext, PARCKey *key)
{
- assertNotNull(interfaceContext, "interfaceContext must be non-null");
- assertNotNull(key, "key must be non-null");
+ parcAssertNotNull(interfaceContext, "interfaceContext must be non-null");
+ parcAssertNotNull(key, "key must be non-null");
PARCInMemoryVerifier *verifier = (PARCInMemoryVerifier *) interfaceContext;
bool success = parcCryptoCache_AddKey(verifier->key_cache, key);
- assertTrue(success, "could not add key, it must be a duplicate");
+ parcAssertTrue(success, "could not add key, it must be a duplicate");
}
static void
_parcInMemoryVerifier_RemoveKeyId(void *interfaceContext, PARCKeyId *keyid)
{
- assertNotNull(interfaceContext, "interfaceContent must be non-null");
- assertNotNull(keyid, "key must be non-null");
+ parcAssertNotNull(interfaceContext, "interfaceContent must be non-null");
+ parcAssertNotNull(keyid, "key must be non-null");
PARCInMemoryVerifier *verifier = (PARCInMemoryVerifier *) interfaceContext;
parcCryptoCache_RemoveKey(verifier->key_cache, keyid);
@@ -293,7 +293,7 @@ _parcInMemoryVerifier_RSAKey_Verify(PARCInMemoryVerifier *verifier, PARCCryptoHa
openssl_digest_type = NID_sha512;
break;
default:
- trapUnexpectedState("Unknown digest type: %s",
+ parcTrapUnexpectedState("Unknown digest type: %s",
parcCryptoHashType_ToString(parcCryptoHash_GetDigestType(localHash)));
}
@@ -355,7 +355,7 @@ _parcInMemoryVerifier_ECDSAKey_Verify(PARCInMemoryVerifier *verifier, PARCCrypto
openssl_digest_type = NID_sha512;
break;
default:
- trapUnexpectedState("Unknown digest type: %s",
+ parcTrapUnexpectedState("Unknown digest type: %s",
parcCryptoHashType_ToString(parcCryptoHash_GetDigestType(localHash)));
}
diff --git a/libparc/parc/security/parc_Key.c b/libparc/parc/security/parc_Key.c
index 3802549e..82d21244 100755
--- a/libparc/parc/security/parc_Key.c
+++ b/libparc/parc/security/parc_Key.c
@@ -24,7 +24,7 @@
#include <parc/security/parc_Key.h>
#include <parc/algol/parc_Object.h>
#include <parc/algol/parc_Memory.h>
-#include <LongBow/runtime.h>
+#include <parc/assert/parc_Assert.h>
struct parc_key {
PARCKeyId *keyid;
@@ -62,8 +62,8 @@ _parcKey_Create()
PARCKey *
parcKey_CreateFromDerEncodedPublicKey(PARCKeyId *keyid, PARCSigningAlgorithm signingAlg, PARCBuffer *derEncodedKey)
{
- assertNotNull(keyid, "Parameter keyid must be non-null");
- assertNotNull(derEncodedKey, "Parameter derEncodedKey must be non-null");
+ parcAssertNotNull(keyid, "Parameter keyid must be non-null");
+ parcAssertNotNull(derEncodedKey, "Parameter derEncodedKey must be non-null");
// Exclude the symmetric key algorithms
switch (signingAlg) {
@@ -73,11 +73,11 @@ parcKey_CreateFromDerEncodedPublicKey(PARCKeyId *keyid, PARCSigningAlgorithm sig
break;
default:
- trapIllegalValueIf(true, "Unknown key algorithm or symmetric key algorithm: %s\n", parcSigningAlgorithm_ToString(signingAlg));
+ parcTrapIllegalValueIf(true, "Unknown key algorithm or symmetric key algorithm: %s\n", parcSigningAlgorithm_ToString(signingAlg));
}
PARCKey *key = _parcKey_Create();
- assertNotNull(key, "Unable to allocate memory for PARCKey");
+ parcAssertNotNull(key, "Unable to allocate memory for PARCKey");
key->key = parcBuffer_Acquire(derEncodedKey);
key->signingAlg = signingAlg;
@@ -95,8 +95,8 @@ parcKey_CreateFromDerEncodedPublicKey(PARCKeyId *keyid, PARCSigningAlgorithm sig
PARCKey *
parcKey_CreateFromSymmetricKey(PARCKeyId *keyid, PARCSigningAlgorithm signingAlg, PARCBuffer *secretkey)
{
- assertNotNull(keyid, "Parameter keyid must be non-null");
- assertNotNull(secretkey, "Parameter derEncodedKey must be non-null");
+ parcAssertNotNull(keyid, "Parameter keyid must be non-null");
+ parcAssertNotNull(secretkey, "Parameter derEncodedKey must be non-null");
// Exclude the symmetric key algorithms
switch (signingAlg) {
@@ -104,11 +104,11 @@ parcKey_CreateFromSymmetricKey(PARCKeyId *keyid, PARCSigningAlgorithm signingAlg
break;
default:
- trapIllegalValueIf(true, "Unknown key algorithm or symmetric key algorithm: %s\n", parcSigningAlgorithm_ToString(signingAlg));
+ parcTrapIllegalValueIf(true, "Unknown key algorithm or symmetric key algorithm: %s\n", parcSigningAlgorithm_ToString(signingAlg));
}
PARCKey *key = _parcKey_Create();
- assertNotNull(key, "Unable to allocate memory for PARCKey");
+ parcAssertNotNull(key, "Unable to allocate memory for PARCKey");
key->key = parcBuffer_Acquire(secretkey);
key->signingAlg = signingAlg;
@@ -127,29 +127,29 @@ parcObject_ImplementRelease(parcKey, PARCKey);
void
parcKey_AssertValid(PARCKey *keyPtr)
{
- assertNotNull(keyPtr, "Parameter must be non-null double pointer");
- assertNotNull(keyPtr->key, "Parameter key must not be null");
- assertNotNull(keyPtr->keyid, "Parameter keyId must not be null");
+ parcAssertNotNull(keyPtr, "Parameter must be non-null double pointer");
+ parcAssertNotNull(keyPtr->key, "Parameter key must not be null");
+ parcAssertNotNull(keyPtr->keyid, "Parameter keyId must not be null");
}
PARCKeyId *
parcKey_GetKeyId(const PARCKey *key)
{
- assertNotNull(key, "Parameter must be non-null");
+ parcAssertNotNull(key, "Parameter must be non-null");
return key->keyid;
}
PARCSigningAlgorithm
parcKey_GetSigningAlgorithm(const PARCKey *key)
{
- assertNotNull(key, "Parameter must be non-null");
+ parcAssertNotNull(key, "Parameter must be non-null");
return key->signingAlg;
}
PARCBuffer *
parcKey_GetKey(const PARCKey *key)
{
- assertNotNull(key, "Parameter must be non-null");
+ parcAssertNotNull(key, "Parameter must be non-null");
return key->key;
}
@@ -183,7 +183,7 @@ PARCKey *
parcKey_Copy(const PARCKey *original)
{
PARCKey *newkey = _parcKey_Create();
- assertNotNull(newkey, "Unable to allocate memory for a new key");
+ parcAssertNotNull(newkey, "Unable to allocate memory for a new key");
newkey->key = parcBuffer_Copy(original->key);
newkey->keyid = parcKeyId_Copy(original->keyid);
newkey->signingAlg = original->signingAlg;
@@ -197,7 +197,7 @@ parcKey_ToString(const PARCKey *key)
int failure = asprintf(&string, "PARCKey {.KeyID=\"%s\", .SigningAlgorithm=\"%s\" }",
parcKeyId_ToString(key->keyid),
parcSigningAlgorithm_ToString(key->signingAlg));
- assertTrue(failure > -1, "Error asprintf");
+ parcAssertTrue(failure > -1, "Error asprintf");
char *result = parcMemory_StringDuplicate(string, strlen(string));
free(string);
diff --git a/libparc/parc/security/parc_KeyId.c b/libparc/parc/security/parc_KeyId.c
index 1dbd9512..45e7454b 100755
--- a/libparc/parc/security/parc_KeyId.c
+++ b/libparc/parc/security/parc_KeyId.c
@@ -20,7 +20,7 @@
#include <stdio.h>
#include <string.h>
-#include <LongBow/runtime.h>
+#include <parc/assert/parc_Assert.h>
#include <parc/security/parc_KeyId.h>
@@ -46,7 +46,7 @@ parcObject_ExtendPARCObject(PARCKeyId, _parcKeyId_Destroy, NULL, NULL, NULL, NUL
void
parcKeyId_AssertValid(const PARCKeyId *keyId)
{
- assertNotNull(keyId, "Pointer must be a non-null pointer to a PARCKeyId");
+ parcAssertNotNull(keyId, "Pointer must be a non-null pointer to a PARCKeyId");
}
PARCKeyId *
diff --git a/libparc/parc/security/parc_KeyStore.c b/libparc/parc/security/parc_KeyStore.c
index 753fe118..6d4a724a 100755
--- a/libparc/parc/security/parc_KeyStore.c
+++ b/libparc/parc/security/parc_KeyStore.c
@@ -17,7 +17,7 @@
*/
#include <config.h>
-#include <LongBow/runtime.h>
+#include <parc/assert/parc_Assert.h>
#include <parc/security/parc_KeyStore.h>
#include <parc/algol/parc_Memory.h>
diff --git a/libparc/parc/security/parc_KeyType.c b/libparc/parc/security/parc_KeyType.c
index 62fc0000..695f4613 100644
--- a/libparc/parc/security/parc_KeyType.c
+++ b/libparc/parc/security/parc_KeyType.c
@@ -20,7 +20,7 @@
#include <stdio.h>
#include <string.h>
-#include <LongBow/runtime.h>
+#include <parc/assert/parc_Assert.h>
#include <parc/security/parc_KeyType.h>
diff --git a/libparc/parc/security/parc_Pkcs12KeyStore.c b/libparc/parc/security/parc_Pkcs12KeyStore.c
index c0d673c4..f6c65e4f 100644
--- a/libparc/parc/security/parc_Pkcs12KeyStore.c
+++ b/libparc/parc/security/parc_Pkcs12KeyStore.c
@@ -23,8 +23,7 @@
#include <fcntl.h>
#include <unistd.h>
-#include <LongBow/runtime.h>
-#include <LongBow/longBow_Compiler.h>
+#include <parc/assert/parc_Assert.h>
#include <parc/algol/parc_Object.h>
@@ -65,7 +64,7 @@ struct parc_pkcs12_keystore {
static bool
_parcPkcs12KeyStore_Finalize(PARCPkcs12KeyStore **instancePtr)
{
- assertNotNull(instancePtr, "Parameter must be a non-null pointer to a PARCPkcs12KeyStore pointer.");
+ parcAssertNotNull(instancePtr, "Parameter must be a non-null pointer to a PARCPkcs12KeyStore pointer.");
PARCPkcs12KeyStore *keystore = *instancePtr;
EVP_PKEY_free(keystore->private_key);
@@ -105,7 +104,7 @@ _parcPkcs12KeyStore_ParseFile(PARCPkcs12KeyStore *keystore, const char *filename
FILE *fp = fopen(filename, "rb");
- assertNotNull(fp, "Error opening %s: %s", filename, strerror(errno));
+ parcAssertNotNull(fp, "Error opening %s: %s", filename, strerror(errno));
if (fp == NULL) {
return -1;
}
@@ -149,10 +148,6 @@ _parcPkcs12KeyStore_ParseFile(PARCPkcs12KeyStore *keystore, const char *filename
return 0;
}
-// =============================================================
-LONGBOW_STOP_DEPRECATED_WARNINGS
-// =============================================================
-
PKCS12 *_createPkcs12KeyStore_RSA(
PARCBuffer *privateKeyBuffer,
PARCCertificate *certificate,
@@ -264,11 +259,11 @@ parcPkcs12KeyStore_CreateFile(
fclose(fp);
result = true;
} else {
- trapUnrecoverableState("Cannot fdopen(3) the file descriptor %d", fd);
+ parcTrapUnrecoverableState("Cannot fdopen(3) the file descriptor %d", fd);
}
close(fd);
} else {
- trapUnrecoverableState("Cannot open(2) the file '%s': %s", filename, strerror(errno));
+ parcTrapUnrecoverableState("Cannot open(2) the file '%s': %s", filename, strerror(errno));
}
PKCS12_free(pkcs12);
} else {
@@ -276,7 +271,7 @@ parcPkcs12KeyStore_CreateFile(
while ((errcode = ERR_get_error()) != 0) {
fprintf(stderr, "openssl error: %s\n", ERR_error_string(errcode, NULL));
}
- trapUnrecoverableState("PKCS12_create returned a NULL value.");
+ parcTrapUnrecoverableState("PKCS12_create returned a NULL value.");
}
}
@@ -313,7 +308,7 @@ _GetPublickKeyDigest(PARCPkcs12KeyStore *keystore)
{
parcSecurity_AssertIsInitialized();
- assertNotNull(keystore, "Parameter must be non-null PARCPkcs12KeyStore");
+ parcAssertNotNull(keystore, "Parameter must be non-null PARCPkcs12KeyStore");
#if 0
if (keystore->public_key_digest == NULL) {
@@ -341,7 +336,7 @@ _GetPublickKeyDigest(PARCPkcs12KeyStore *keystore)
digestBuffer,
NULL);
if (result != 1) {
- assertTrue(0, "Could not compute digest over certificate public key");
+ parcAssertTrue(0, "Could not compute digest over certificate public key");
} else {
keystore->public_key_digest =
parcBuffer_PutArray(parcBuffer_Allocate(SHA256_DIGEST_LENGTH), SHA256_DIGEST_LENGTH, digestBuffer);
@@ -359,7 +354,7 @@ _GetCertificateDigest(PARCPkcs12KeyStore *keystore)
{
parcSecurity_AssertIsInitialized();
- assertNotNull(keystore, "Parameter must be non-null PARCPkcs12KeyStore");
+ parcAssertNotNull(keystore, "Parameter must be non-null PARCPkcs12KeyStore");
if (keystore->certificate_digest == NULL) {
uint8_t digestBuffer[SHA256_DIGEST_LENGTH];
@@ -379,7 +374,7 @@ _GetDEREncodedCertificate(PARCPkcs12KeyStore *keystore)
{
parcSecurity_AssertIsInitialized();
- assertNotNull(keystore, "Parameter must be non-null PARCPkcs12KeyStore");
+ parcAssertNotNull(keystore, "Parameter must be non-null PARCPkcs12KeyStore");
if (keystore->certificate_der == NULL) {
uint8_t *der = NULL;
@@ -401,7 +396,7 @@ _GetDEREncodedPublicKey(PARCPkcs12KeyStore *keystore)
{
parcSecurity_AssertIsInitialized();
- assertNotNull(keystore, "Parameter must be non-null PARCPkcs12KeyStore");
+ parcAssertNotNull(keystore, "Parameter must be non-null PARCPkcs12KeyStore");
if (keystore->public_key_der == NULL) {
uint8_t *der = NULL;
@@ -423,7 +418,7 @@ _GetDEREncodedPrivateKey(PARCPkcs12KeyStore *keystore)
{
parcSecurity_AssertIsInitialized();
- assertNotNull(keystore, "Parameter must be non-null PARCPkcs12KeyStore");
+ parcAssertNotNull(keystore, "Parameter must be non-null PARCPkcs12KeyStore");
if (keystore->private_key_der == NULL) {
uint8_t *der = NULL;
@@ -449,6 +444,3 @@ PARCKeyStoreInterface *PARCPkcs12KeyStoreAsKeyStore = &(PARCKeyStoreInterface) {
.getSigningAlgorithm = (PARCKeyStoreGetSigningAlgorithm *) _GetSigningAlgorithm,
};
-// =============================================================
-LONGBOW_START_DEPRECATED_WARNINGS
-// =============================================================
diff --git a/libparc/parc/security/parc_PublicKeySigner.c b/libparc/parc/security/parc_PublicKeySigner.c
index 3c70a139..1297611e 100644
--- a/libparc/parc/security/parc_PublicKeySigner.c
+++ b/libparc/parc/security/parc_PublicKeySigner.c
@@ -41,7 +41,7 @@ struct PARCPublicKeySigner {
static bool
_parcPublicKeySigner_Finalize(PARCPublicKeySigner **instancePtr)
{
- assertNotNull(instancePtr, "Parameter must be a non-null pointer to a PARCPublicKeySigner pointer.");
+ parcAssertNotNull(instancePtr, "Parameter must be a non-null pointer to a PARCPublicKeySigner pointer.");
PARCPublicKeySigner *instance = *instancePtr;
@@ -58,7 +58,7 @@ _parcPublicKeySigner_Finalize(PARCPublicKeySigner **instancePtr)
void
parcPublicKeySigner_AssertValid(const PARCPublicKeySigner *instance)
{
- assertTrue(parcPublicKeySigner_IsValid(instance), "PARCPublicKeySigner is not valid.");
+ parcAssertTrue(parcPublicKeySigner_IsValid(instance), "PARCPublicKeySigner is not valid.");
}
bool
@@ -140,28 +140,28 @@ parcPublicKeySigner_Create(PARCKeyStore *keyStore, PARCCryptoSuite suite)
static PARCSigningAlgorithm
_GetSigningAlgorithm(PARCPublicKeySigner *signer)
{
- assertNotNull(signer, "Parameter must be non-null PARCCryptoHasher");
+ parcAssertNotNull(signer, "Parameter must be non-null PARCCryptoHasher");
return signer->signingAlgorithm;
}
static PARCCryptoHashType
_GetCryptoHashType(PARCPublicKeySigner *signer)
{
- assertNotNull(signer, "Parameter must be non-null PARCCryptoHasher");
+ parcAssertNotNull(signer, "Parameter must be non-null PARCCryptoHasher");
return signer->hashType;
}
static PARCCryptoHasher *
_GetCryptoHasher(PARCPublicKeySigner *signer)
{
- assertNotNull(signer, "Parameter must be non-null PARCCryptoHasher");
+ parcAssertNotNull(signer, "Parameter must be non-null PARCCryptoHasher");
return signer->hasher;
}
static PARCKeyStore *
_GetKeyStore(PARCPublicKeySigner *signer)
{
- assertNotNull(signer, "Parameter must be non-null PARCCryptoHasher");
+ parcAssertNotNull(signer, "Parameter must be non-null PARCCryptoHasher");
return signer->keyStore;
}
@@ -175,7 +175,7 @@ static inline int _SignDigestRSA(const PARCCryptoHash *digestToSign, PARCBuffer
RSA *rsa = EVP_PKEY_get1_RSA(privateKey);
*sig = parcMemory_Allocate(RSA_size(rsa));
- assertNotNull(*sig, "parcMemory_Allocate(%u) returned NULL", RSA_size(rsa));
+ parcAssertNotNull(*sig, "parcMemory_Allocate(%u) returned NULL", RSA_size(rsa));
*sigLength = 0;
PARCBuffer *bb_digest = parcCryptoHash_GetDigest(digestToSign);
@@ -185,7 +185,7 @@ static inline int _SignDigestRSA(const PARCCryptoHash *digestToSign, PARCBuffer
*sig,
sigLength,
rsa);
- assertTrue(result == 1, "Got error from RSA_sign: %d", result);
+ parcAssertTrue(result == 1, "Got error from RSA_sign: %d", result);
EVP_PKEY_free(privateKey);
RSA_free(rsa);
return result;
@@ -201,7 +201,7 @@ static inline int _SignDigestECDSA(const PARCCryptoHash *digestToSign, PARCBuffe
EC_KEY *ec_key = EVP_PKEY_get1_EC_KEY(privateKey);
*sig = parcMemory_Allocate(ECDSA_size(ec_key));
- assertNotNull(sig, "parcMemory_Allocate(%u) returned NULL", ECDSA_size(ec_key));
+ parcAssertNotNull(sig, "parcMemory_Allocate(%u) returned NULL", ECDSA_size(ec_key));
*sigLength = 0;
PARCBuffer *bb_digest = parcCryptoHash_GetDigest(digestToSign);
@@ -211,9 +211,9 @@ static inline int _SignDigestECDSA(const PARCCryptoHash *digestToSign, PARCBuffe
*sig,
sigLength,
ec_key);
- assertTrue(result == 1, "Got error from ECDSA_sign: %d", result);
+ parcAssertTrue(result == 1, "Got error from ECDSA_sign: %d", result);
EC_KEY_free(ec_key);
-
+ return result;
}
static PARCSignature *
@@ -221,8 +221,8 @@ _SignDigest(PARCPublicKeySigner *signer, const PARCCryptoHash *digestToSign)
{
parcSecurity_AssertIsInitialized();
- assertNotNull(signer, "Parameter must be non-null CCNxFileKeystore");
- assertNotNull(digestToSign, "Buffer to sign must not be null");
+ parcAssertNotNull(signer, "Parameter must be non-null CCNxFileKeystore");
+ parcAssertNotNull(digestToSign, "Buffer to sign must not be null");
// TODO: what is the best way to expose this?
PARCKeyStore *keyStore = signer->keyStore;
@@ -240,7 +240,7 @@ _SignDigest(PARCPublicKeySigner *signer, const PARCCryptoHash *digestToSign)
opensslDigestType = NID_sha512;
break;
default:
- trapUnexpectedState("Unknown digest type: %s",
+ parcTrapUnexpectedState("Unknown digest type: %s",
parcCryptoHashType_ToString(parcCryptoHash_GetDigestType(digestToSign)));
}
@@ -272,7 +272,7 @@ _SignDigest(PARCPublicKeySigner *signer, const PARCCryptoHash *digestToSign)
static size_t
_GetSignatureSize(PARCPublicKeySigner *signer)
{
- assertNotNull(signer, "Parameter must be non-null CCNxFileKeystore");
+ parcAssertNotNull(signer, "Parameter must be non-null CCNxFileKeystore");
// TODO: what is the best way to expose this?
PARCKeyStore *keyStore = signer->keyStore;
@@ -307,6 +307,8 @@ _GetSignatureSize(PARCPublicKeySigner *signer)
EVP_PKEY_free(privateKey);
break;
}
+ default:
+ break;
}
parcBuffer_Release(&privateKeyBuffer);
diff --git a/libparc/parc/security/parc_SecureRandom.c b/libparc/parc/security/parc_SecureRandom.c
index 8ebf7f0f..92c308c1 100644
--- a/libparc/parc/security/parc_SecureRandom.c
+++ b/libparc/parc/security/parc_SecureRandom.c
@@ -35,7 +35,7 @@ struct parc_securerandom {
static bool
_parcSecureRandom_Destructor(PARCSecureRandom **instancePtr)
{
- assertNotNull(instancePtr, "Parameter must be a non-null pointer to a PARCSecureRandom pointer.");
+ parcAssertNotNull(instancePtr, "Parameter must be a non-null pointer to a PARCSecureRandom pointer.");
PARCSecureRandom *instance = *instancePtr;
close(instance->randomfd);
@@ -51,7 +51,7 @@ parcObject_Override(PARCSecureRandom, PARCObject,
void
parcSecureRandom_AssertValid(const PARCSecureRandom *instance)
{
- assertTrue(parcSecureRandom_IsValid(instance),
+ parcAssertTrue(parcSecureRandom_IsValid(instance),
"PARCSecureRandom is not valid.");
}
@@ -77,7 +77,7 @@ static void
_parcSecureRandom_ReSeed(PARCSecureRandom *random, PARCBuffer *buffer)
{
size_t length = parcBuffer_Remaining(buffer);
- write(random->randomfd, parcBuffer_Overlay(buffer, length), length);
+ int wrote_bytes = write(random->randomfd, parcBuffer_Overlay(buffer, length), length);
}
PARCSecureRandom *
@@ -96,7 +96,7 @@ uint32_t
parcSecureRandom_Next(PARCSecureRandom *random)
{
uint32_t value;
- read(random->randomfd, &value, sizeof(value));
+ int read_bytes = read(random->randomfd, &value, sizeof(value));
return value;
}
diff --git a/libparc/parc/security/parc_Security.c b/libparc/parc/security/parc_Security.c
index 70731ba3..e5f7609d 100644
--- a/libparc/parc/security/parc_Security.c
+++ b/libparc/parc/security/parc_Security.c
@@ -26,7 +26,7 @@
#include <pthread.h>
-#include <LongBow/runtime.h>
+#include <parc/assert/parc_Assert.h>
#include <parc/security/parc_Security.h>
#include <parc/algol/parc_Memory.h>
@@ -50,7 +50,6 @@
#error OpenSSL version must be at least 0.9.8 release
#endif
-// Use the LongBow aids for this (case 999)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
@@ -77,7 +76,7 @@ _lockingCallback(int mode, int type, const char *file __attribute__((unused)), i
error = pthread_mutex_unlock(&(perThreadLocks[type]));
}
- assertTrue(error == 0, "Error in pthreads: (%d) %s", errno, strerror(errno));
+ parcAssertTrue(error == 0, "Error in pthreads: (%d) %s", errno, strerror(errno));
}
#if OPENSSL_VERSION_NUMBER < 0x1000005fL
@@ -92,7 +91,7 @@ _getThreadId(void)
#if defined(__APPLE__)
uint64_t threadid = 0;
int error = pthread_threadid_np(pthread_self(), &threadid);
- assertTrue(error == 0, "Error getting threadid");
+ parcAssertTrue(error == 0, "Error getting threadid");
return (unsigned long) threadid;
#elif defined(__linux__)
// linux (at least ubuntu and redhat) uses unsigned long int
@@ -131,7 +130,7 @@ static void
_initLocks(void)
{
perThreadLocks = parcMemory_AllocateAndClear(CRYPTO_num_locks() * sizeof(pthread_mutex_t));
- assertNotNull(perThreadLocks, "parcMemory_AllocateAndClear(%zu) returned NULL",
+ parcAssertNotNull(perThreadLocks, "parcMemory_AllocateAndClear(%zu) returned NULL",
CRYPTO_num_locks() * sizeof(pthread_mutex_t));
for (int i = 0; i < CRYPTO_num_locks(); i++) {
@@ -161,14 +160,14 @@ _finiLocks(void)
void
parcSecurity_AssertIsInitialized(void)
{
- trapUnexpectedStateIf(parcSecurity_IsInitialized() == false, "PARC Security framework is not initialized. See parcSecurity_Init()");
+ parcTrapUnexpectedStateIf(parcSecurity_IsInitialized() == false, "PARC Security framework is not initialized. See parcSecurity_Init()");
}
void
parcSecurity_Init(void)
{
int lockSuccessful = pthread_mutex_lock(&parcSecurity_mutex) == 0;
- assertTrue(lockSuccessful, "Unable to lock the PARC Security framework.");
+ parcAssertTrue(lockSuccessful, "Unable to lock the PARC Security framework.");
if (!parcSecurity_initialized) {
_initLocks();
@@ -180,7 +179,7 @@ parcSecurity_Init(void)
parcSecurity_count++;
int unlockSuccessful = pthread_mutex_unlock(&parcSecurity_mutex) == 0;
- assertTrue(unlockSuccessful, "Unable to unlock the PARC Security framework.");
+ parcAssertTrue(unlockSuccessful, "Unable to unlock the PARC Security framework.");
}
bool
@@ -193,7 +192,7 @@ void
parcSecurity_Fini(void)
{
int lockSuccessful = pthread_mutex_lock(&parcSecurity_mutex) == 0;
- assertTrue(lockSuccessful, "Unable to lock the PARC Security framework.");
+ parcAssertTrue(lockSuccessful, "Unable to lock the PARC Security framework.");
parcSecurity_count--;
if (parcSecurity_count == 0) {
@@ -204,7 +203,7 @@ parcSecurity_Fini(void)
}
int unlockSuccessful = pthread_mutex_unlock(&parcSecurity_mutex) == 0;
- assertTrue(unlockSuccessful, "Unable to unlock the PARC Security framework.");
+ parcAssertTrue(unlockSuccessful, "Unable to unlock the PARC Security framework.");
}
#pragma GCC diagnostic pop
diff --git a/libparc/parc/security/parc_Signature.c b/libparc/parc/security/parc_Signature.c
index 1021b2a4..4b1abc06 100755
--- a/libparc/parc/security/parc_Signature.c
+++ b/libparc/parc/security/parc_Signature.c
@@ -19,7 +19,7 @@
#include <stdio.h>
#include <string.h>
-#include <LongBow/runtime.h>
+#include <parc/assert/parc_Assert.h>
#include <parc/algol/parc_Object.h>
#include <parc/security/parc_Signature.h>
@@ -42,10 +42,10 @@ parcObject_ExtendPARCObject(PARCSignature, _parcSignature_FinalRelease, NULL, NU
PARCSignature *
parcSignature_Create(PARCSigningAlgorithm signingAlgorithm, PARCCryptoHashType hashType, PARCBuffer *signatureBits)
{
- assertNotNull(signatureBits, "SignatureBits Parameter cannot be null");
+ parcAssertNotNull(signatureBits, "SignatureBits Parameter cannot be null");
PARCSignature *signature = parcObject_CreateInstance(PARCSignature);
- assertNotNull(signature, "parcObject_CreateInstance(%zu) returned NULL", sizeof(PARCSignature));
+ parcAssertNotNull(signature, "parcObject_CreateInstance(%zu) returned NULL", sizeof(PARCSignature));
signature->signingAlgorithm = signingAlgorithm;
signature->hashType = hashType;
@@ -62,28 +62,28 @@ parcObject_ImplementRelease(parcSignature, PARCSignature);
PARCSigningAlgorithm
parcSignature_GetSigningAlgorithm(const PARCSignature *signature)
{
- assertNotNull(signature, "Parameter must be non-null");
+ parcAssertNotNull(signature, "Parameter must be non-null");
return signature->signingAlgorithm;
}
PARCCryptoHashType
parcSignature_GetHashType(const PARCSignature *signature)
{
- assertNotNull(signature, "Parameter must be non-null");
+ parcAssertNotNull(signature, "Parameter must be non-null");
return signature->hashType;
}
PARCBuffer *
parcSignature_GetSignature(const PARCSignature *signature)
{
- assertNotNull(signature, "Parameter must be non-null");
+ parcAssertNotNull(signature, "Parameter must be non-null");
return signature->signatureBits;
}
char *
parcSignature_ToString(const PARCSignature *signature)
{
- assertNotNull(signature, "Parameter must be a non-null CCNxSignature pointer");
+ parcAssertNotNull(signature, "Parameter must be a non-null CCNxSignature pointer");
char *bits = parcBuffer_ToString(signature->signatureBits);
@@ -92,7 +92,7 @@ parcSignature_ToString(const PARCSignature *signature)
signature->signingAlgorithm,
signature->hashType,
bits);
- assertTrue(nwritten >= 0, "Error calling asprintf");
+ parcAssertTrue(nwritten >= 0, "Error calling asprintf");
parcMemory_Deallocate((void **) &bits);
diff --git a/libparc/parc/security/parc_Signer.c b/libparc/parc/security/parc_Signer.c
index 5287c97b..70b8f616 100644
--- a/libparc/parc/security/parc_Signer.c
+++ b/libparc/parc/security/parc_Signer.c
@@ -18,7 +18,7 @@
#include <config.h>
#include <stdio.h>
-#include <LongBow/runtime.h>
+#include <parc/assert/parc_Assert.h>
#include <parc/algol/parc_Memory.h>
#include <parc/algol/parc_Object.h>
@@ -44,7 +44,7 @@ _parcSigner_FinalRelease(PARCSigner **signerPtr)
void
parcSigner_AssertValid(const PARCSigner *signer)
{
- assertNotNull(signer, "Parameter must be non-null PARCSigner");
+ parcAssertNotNull(signer, "Parameter must be non-null PARCSigner");
}
parcObject_ImplementAcquire(parcSigner, PARCSigner);
@@ -56,7 +56,7 @@ parcObject_Override(PARCSigner, PARCObject,
PARCSigner *
parcSigner_Create(PARCObject *instance, PARCSigningInterface *interfaceContext)
{
- assertNotNull(interfaceContext, "Parameter must be non-null implementation pointer");
+ parcAssertNotNull(interfaceContext, "Parameter must be non-null implementation pointer");
PARCSigner *signer = parcObject_CreateInstance(PARCSigner);
if (signer != NULL) {
@@ -112,7 +112,7 @@ parcSigner_SignDigest(const PARCSigner *signer, const PARCCryptoHash *parcDigest
{
parcSigner_OptionalAssertValid(signer);
- assertNotNull(parcDigest, "parcDigest to sign must not be null");
+ parcAssertNotNull(parcDigest, "parcDigest to sign must not be null");
return signer->interface->SignDigest(signer->instance, parcDigest);
}
@@ -120,7 +120,7 @@ PARCSignature *
parcSigner_SignBuffer(const PARCSigner *signer, const PARCBuffer *buffer)
{
parcSigner_OptionalAssertValid(signer);
- assertNotNull(buffer, "buffer to sign must not be null");
+ parcAssertNotNull(buffer, "buffer to sign must not be null");
PARCCryptoHashType hashType = parcSigner_GetCryptoHashType(signer);
PARCCryptoHasher *hasher = parcCryptoHasher_Create(hashType);
diff --git a/libparc/parc/security/parc_Signer.h b/libparc/parc/security/parc_Signer.h
index 1e675c50..bee68fd2 100755
--- a/libparc/parc/security/parc_Signer.h
+++ b/libparc/parc/security/parc_Signer.h
@@ -129,7 +129,7 @@ typedef struct parc_signer_interface {
/**
* Assert that an instance of `PARCSigner` is valid.
*
- * If the instance is not valid, terminate via {@link trapIllegalValue}
+ * If the instance is not valid, terminate via {@link parcTrapIllegalValue}
*
* Valid means the internal state of the type is consistent with its
* required current or future behaviour.
diff --git a/libparc/parc/security/parc_SigningAlgorithm.c b/libparc/parc/security/parc_SigningAlgorithm.c
index 5803f675..4d1765d7 100755
--- a/libparc/parc/security/parc_SigningAlgorithm.c
+++ b/libparc/parc/security/parc_SigningAlgorithm.c
@@ -20,7 +20,7 @@
#include <stdio.h>
#include <string.h>
-#include <LongBow/runtime.h>
+#include <parc/assert/parc_Assert.h>
#include <parc/security/parc_SigningAlgorithm.h>
diff --git a/libparc/parc/security/parc_SymmetricKeySigner.c b/libparc/parc/security/parc_SymmetricKeySigner.c
index b06389dd..9f760326 100644
--- a/libparc/parc/security/parc_SymmetricKeySigner.c
+++ b/libparc/parc/security/parc_SymmetricKeySigner.c
@@ -68,13 +68,13 @@ _hmacCreate(void *env)
#else
// HMAC_Init_ex seems to overrun the size of HMAC_CTX, so make it bigger
HMAC_CTX *ctx = parcMemory_Allocate(sizeof(HMAC_CTX) * 2);
- assertNotNull(ctx, "parcMemory_Allocate(%zu) returned NULL for HMAC_CTX", sizeof(HMAC_CTX) * 2);
+ parcAssertNotNull(ctx, "parcMemory_Allocate(%zu) returned NULL for HMAC_CTX", sizeof(HMAC_CTX) * 2);
HMAC_CTX_init(ctx);
#endif
// Now initialize it with our digest and key, so in hmac_init we can avoid using those
PARCBuffer *secretKey = parcSymmetricKeyStore_GetKey(signer->keyStore);
- assertTrue(parcBuffer_Remaining(secretKey) < 512, "The keystore secret key cannot be longer than %d", 512);
+ parcAssertTrue(parcBuffer_Remaining(secretKey) < 512, "The keystore secret key cannot be longer than %d", 512);
HMAC_Init_ex(ctx, parcByteArray_Array(parcBuffer_Array(secretKey)), (int) parcBuffer_Remaining(secretKey), signer->opensslMd, NULL);
@@ -133,7 +133,7 @@ static PARCCryptoHasherInterface functor_hmac = {
static bool
_parcSymmetricKeySigner_Finalize(PARCSymmetricKeySigner **instancePtr)
{
- assertNotNull(instancePtr, "Parameter must be a non-null pointer to a PARCSymmetricKeySigner pointer.");
+ parcAssertNotNull(instancePtr, "Parameter must be a non-null pointer to a PARCSymmetricKeySigner pointer.");
PARCSymmetricKeySigner *signer = (PARCSymmetricKeySigner *) *instancePtr;
if (signer->secretKeyHash != NULL) {
parcCryptoHash_Release(&signer->secretKeyHash);
@@ -161,7 +161,7 @@ parcObject_Override(PARCSymmetricKeySigner, PARCObject,
void
parcSymmetricKeySigner_AssertValid(const PARCSymmetricKeySigner *instance)
{
- assertTrue(parcSymmetricKeySigner_IsValid(instance),
+ parcAssertTrue(parcSymmetricKeySigner_IsValid(instance),
"PARCSymmetricKeySigner is not valid.");
}
@@ -185,7 +185,7 @@ parcSymmetricKeySigner_Create(PARCSymmetricKeyStore *keyStore, PARCCryptoHashTyp
default:
parcObject_Release((void **) &result);
- trapIllegalValue(hmacHashType, "Unknown HMAC hash type: %d", hmacHashType);
+ parcTrapIllegalValue(hmacHashType, "Unknown HMAC hash type: %d", hmacHashType);
}
// the signer key digest is SHA256, independent of the HMAC digest
@@ -243,7 +243,7 @@ _getKeyStore(PARCSymmetricKeySigner *signer)
static size_t
_GetSignatureSize(PARCSymmetricKeySigner *signer)
{
- assertNotNull(signer, "Parameter must be non-null CCNxFileKeystore");
+ parcAssertNotNull(signer, "Parameter must be non-null CCNxFileKeystore");
// TODO: what is the best way to expose this?
PARCSymmetricKeyStore *keyStore = signer->keyStore;
diff --git a/libparc/parc/security/parc_SymmetricKeyStore.c b/libparc/parc/security/parc_SymmetricKeyStore.c
index 38996dba..49d5055e 100644
--- a/libparc/parc/security/parc_SymmetricKeyStore.c
+++ b/libparc/parc/security/parc_SymmetricKeyStore.c
@@ -44,8 +44,7 @@
#include <openssl/aes.h>
#include <openssl/hmac.h>
-#include <LongBow/runtime.h>
-#include <LongBow/longBow_Compiler.h>
+#include <parc/assert/parc_Assert.h>
#include <parc/algol/parc_Object.h>
#include <parc/algol/parc_Memory.h>
@@ -108,10 +107,6 @@ parcObject_ImplementRelease(parcSymmetricKeyStore, PARCSymmetricKeyStore);
parcObject_Override(PARCSymmetricKeyStore, PARCObject,
.destructor = (PARCObjectDestructor *) _parcSymmetricKeyStore_Finalize);
-// =============================================================
-LONGBOW_STOP_DEPRECATED_WARNINGS
-// =============================================================
-
/**
* The openssl ASN1 representation of the PARC symmetric key keystore.
* It will be written to disk in DER format with an i2d call
@@ -392,7 +387,7 @@ _AESKeyStoreInit(const char *filename, const char *password)
PARCBuffer *
parcSymmetricKeyStore_CreateKey(unsigned bits)
{
- assertTrue((bits & 0x07) == 0, "bits must be a multiple of 8");
+ parcAssertTrue((bits & 0x07) == 0, "bits must be a multiple of 8");
unsigned keylength = bits / 8;
uint8_t buffer[keylength];
@@ -427,7 +422,7 @@ parcSymmetricKeyStore_GetVerifierKeyDigest(PARCSymmetricKeyStore *keyStore)
bool
parcSymmetricKeyStore_CreateFile(const char *filename, const char *password, PARCBuffer *secret_key)
{
- assertTrue(parcBuffer_Remaining(secret_key) > 0, "The secret_key buffer is not flipped. See parcBuffer_Flip()");
+ parcAssertTrue(parcBuffer_Remaining(secret_key) > 0, "The secret_key buffer is not flipped. See parcBuffer_Flip()");
return _createKeyStore(filename, password, secret_key) == 0;
}
@@ -444,7 +439,7 @@ PARCSymmetricKeyStore *
parcSymmetricKeyStore_OpenFile(const char *filename, const char *password, PARCCryptoHashType hmacHashType)
{
PARCBuffer *secretKey = _AESKeyStoreInit(filename, password);
- assertNotNull(secretKey, "Could not read AES keystore %s", filename);
+ parcAssertNotNull(secretKey, "Could not read AES keystore %s", filename);
PARCSymmetricKeyStore *keyStore = parcSymmetricKeyStore_Create(secretKey);
parcBuffer_Release(&secretKey);
@@ -465,13 +460,10 @@ PARCSymmetricKeyStore *
parcSymmetricKeyStore_Create(PARCBuffer *secret_key)
{
PARCSymmetricKeyStore *keyStore = parcObject_CreateAndClearInstance(PARCSymmetricKeyStore);
- assertNotNull(keyStore, "parcObject_CreateAndClearInstance returned NULL, cannot allocate keystore");
+ parcAssertNotNull(keyStore, "parcObject_CreateAndClearInstance returned NULL, cannot allocate keystore");
keyStore->secretKey = parcBuffer_Acquire(secret_key);
return keyStore;
}
-// =============================================================
-LONGBOW_START_DEPRECATED_WARNINGS
-// =============================================================
diff --git a/libparc/parc/security/parc_Verifier.c b/libparc/parc/security/parc_Verifier.c
index 967356a5..75f99555 100755
--- a/libparc/parc/security/parc_Verifier.c
+++ b/libparc/parc/security/parc_Verifier.c
@@ -18,7 +18,7 @@
#include <config.h>
#include <stdio.h>
-#include <LongBow/runtime.h>
+#include <parc/assert/parc_Assert.h>
#include <parc/security/parc_Verifier.h>
#include <parc/algol/parc_Memory.h>
@@ -41,7 +41,7 @@ _parcVerifier_FinalRelease(PARCVerifier **verifierPtr)
void
parcVerifier_AssertValid(const PARCVerifier *verifier)
{
- assertNotNull(verifier, "Parameter must be non-null PARCVerifier");
+ parcAssertNotNull(verifier, "Parameter must be non-null PARCVerifier");
}
parcObject_ImplementAcquire(parcVerifier, PARCVerifier);
@@ -53,11 +53,11 @@ parcObject_Override(PARCVerifier, PARCObject,
PARCVerifier *
parcVerifier_Create(PARCObject *instance, PARCVerifierInterface *interfaceContext)
{
- assertNotNull(interfaceContext, "Parameter `interfaceContext` must be non-null interface pointer");
- assertNotNull(instance, "Parameter `instance` must be non-null PARCObject pointer");
+ parcAssertNotNull(interfaceContext, "Parameter `interfaceContext` must be non-null interface pointer");
+ parcAssertNotNull(instance, "Parameter `instance` must be non-null PARCObject pointer");
PARCVerifier *verifier = parcObject_CreateInstance(PARCVerifier);
- assertNotNull(verifier, "parcObject_CreateInstance returned NULL");
+ parcAssertNotNull(verifier, "parcObject_CreateInstance returned NULL");
verifier->instance = parcObject_Acquire(instance);
verifier->interface = interfaceContext;
@@ -69,9 +69,9 @@ bool
parcVerifier_VerifyDigestSignature(PARCVerifier *verifier, PARCKeyId *keyid, PARCCryptoHash *locallyComputedHash,
PARCCryptoSuite suite, PARCSignature *signatureToVerify)
{
- assertNotNull(verifier, "Parameter must be non-null PARCVerifier");
- assertNotNull(locallyComputedHash, "cryptoHash to verify must not be null");
- assertNotNull(signatureToVerify, "Signature to verify must not be null");
+ parcAssertNotNull(verifier, "Parameter must be non-null PARCVerifier");
+ parcAssertNotNull(locallyComputedHash, "cryptoHash to verify must not be null");
+ parcAssertNotNull(signatureToVerify, "Signature to verify must not be null");
// null keyid is allowed now that we support CRCs, etc.
@@ -81,27 +81,27 @@ parcVerifier_VerifyDigestSignature(PARCVerifier *verifier, PARCKeyId *keyid, PAR
bool
parcVerifier_AllowedCryptoSuite(PARCVerifier *verifier, PARCKeyId *keyid, PARCCryptoSuite suite)
{
- assertNotNull(verifier, "Parameter must be non-null PARCVerifier");
+ parcAssertNotNull(verifier, "Parameter must be non-null PARCVerifier");
return verifier->interface->AllowedCryptoSuite(verifier->instance, keyid, suite);
}
PARCCryptoHasher*
parcVerifier_GetCryptoHasher(PARCVerifier *verifier, PARCKeyId *keyid, PARCCryptoHashType hashType)
{
- assertNotNull(verifier, "Parameter must be non-null PARCVerifier");
+ parcAssertNotNull(verifier, "Parameter must be non-null PARCVerifier");
return verifier->interface->GetCryptoHasher(verifier->instance, keyid, hashType);
}
void
parcVerifier_AddKey(PARCVerifier *verifier, PARCKey *key)
{
- assertNotNull(verifier, "Parameter must be non-null PARCVerifier");
+ parcAssertNotNull(verifier, "Parameter must be non-null PARCVerifier");
verifier->interface->AddKey(verifier->instance, key);
}
void
parcVerifier_RemoveKeyId(PARCVerifier *verifier, PARCKeyId *keyid)
{
- assertNotNull(verifier, "Parameter must be non-null PARCVerifier");
+ parcAssertNotNull(verifier, "Parameter must be non-null PARCVerifier");
verifier->interface->RemoveKeyId(verifier->instance, keyid);
}
diff --git a/libparc/parc/security/parc_Verifier.h b/libparc/parc/security/parc_Verifier.h
index 09e3640f..96232e93 100644
--- a/libparc/parc/security/parc_Verifier.h
+++ b/libparc/parc/security/parc_Verifier.h
@@ -76,7 +76,7 @@ PARCVerifier *parcVerifier_Create(PARCObject *instance, PARCVerifierInterface *i
/**
* Assert that an instance of `PARCVerifier` is valid.
*
- * If the instance is not valid, terminate via {@link trapIllegalValue}
+ * If the instance is not valid, terminate via {@link parcTrapIllegalValue}
*
* Valid means the internal state of the type is consistent with its
* required current or future behaviour.
diff --git a/libparc/parc/security/parc_X509Certificate.c b/libparc/parc/security/parc_X509Certificate.c
index 67ee6b2b..2c964ae7 100644
--- a/libparc/parc/security/parc_X509Certificate.c
+++ b/libparc/parc/security/parc_X509Certificate.c
@@ -79,7 +79,7 @@ _getPublicKeyDigest(void *interfaceContext)
{
parcSecurity_AssertIsInitialized();
- assertNotNull(interfaceContext, "Parameter must be non-null PARCX509Certificate");
+ parcAssertNotNull(interfaceContext, "Parameter must be non-null PARCX509Certificate");
PARCX509Certificate *certificate = (PARCX509Certificate *) interfaceContext;
@@ -103,7 +103,7 @@ _getCertificateDigest(void *interfaceContext)
{
parcSecurity_AssertIsInitialized();
- assertNotNull(interfaceContext, "Parameter must be non-null PARCX509Certificate");
+ parcAssertNotNull(interfaceContext, "Parameter must be non-null PARCX509Certificate");
PARCX509Certificate *certificate = (PARCX509Certificate *) interfaceContext;
@@ -126,7 +126,7 @@ _getDEREncodedCertificate(void *interfaceContext)
{
parcSecurity_AssertIsInitialized();
- assertNotNull(interfaceContext, "Parameter must be non-null PARCX509Certificate");
+ parcAssertNotNull(interfaceContext, "Parameter must be non-null PARCX509Certificate");
PARCX509Certificate *certificate = (PARCX509Certificate *) interfaceContext;
@@ -150,7 +150,7 @@ _getDEREncodedPublicKey(void *interfaceContext)
{
parcSecurity_AssertIsInitialized();
- assertNotNull(interfaceContext, "Parameter must be non-null PARCX509Certificate");
+ parcAssertNotNull(interfaceContext, "Parameter must be non-null PARCX509Certificate");
PARCX509Certificate *certificate = (PARCX509Certificate *) interfaceContext;
@@ -222,7 +222,7 @@ _createEmptyCertificate()
cert->certificateDigest = NULL;
cert->derEncodedCertificate = NULL;
cert->derEncodedKey = NULL;
- assertNotNull(cert, "Failure allocating memory for a new PARCX509Certificate instance");
+ parcAssertNotNull(cert, "Failure allocating memory for a new PARCX509Certificate instance");
return cert;
}
@@ -288,7 +288,7 @@ _addSubjectName(X509 *cert, const char *subjectname)
{
// Set up the simple subject name and issuer name for the certificate.
X509_NAME *name = X509_get_subject_name(cert);
- assertNotNull(name, "Got null name from X509_get_subject_name");
+ parcAssertNotNull(name, "Got null name from X509_get_subject_name");
if (X509_NAME_add_entry_by_txt(name, "CN", MBSTRING_ASC, (unsigned char *) subjectname, -1, -1, 0)) {
if (X509_set_issuer_name(cert, name)) {
@@ -353,7 +353,7 @@ _parcX509Certificate_CreateFromPEMFile(const char *filename)
cert->certificateBIO = BIO_new(BIO_s_file());
size_t result = BIO_read_filename(cert->certificateBIO, filename);
- assertTrue(result == 1, "Unable to open the specified file");
+ parcAssertTrue(result == 1, "Unable to open the specified file");
cert->certificate = PEM_read_bio_X509(cert->certificateBIO, NULL, 0, NULL);
cert->publicKey = X509_get_pubkey(cert->certificate);
@@ -404,13 +404,13 @@ PARCX509Certificate * _createSelfSignedCertificate_RSA(PARCBuffer **privateKeyBu
parcSecurity_AssertIsInitialized();
RSA *rsa = RSA_new();
- assertNotNull(rsa, "RSA_new failed.");
+ parcAssertNotNull(rsa, "RSA_new failed.");
EVP_PKEY *privateKey = EVP_PKEY_new();
- assertNotNull(privateKey, "EVP_PKEY_new() failed.");
+ parcAssertNotNull(privateKey, "EVP_PKEY_new() failed.");
X509 *cert = X509_new();
- assertNotNull(cert, "X509_new() failed.");
+ parcAssertNotNull(cert, "X509_new() failed.");
int res;
BIGNUM *pub_exp;
@@ -518,15 +518,15 @@ PARCX509Certificate * _createSelfSignedCertificate_EC(PARCBuffer **privateKeyBuf
return NULL;
EC_KEY *ec_key = EC_KEY_new_by_curve_name(curve_params);
- assertNotNull(ec_key, "EC key creation failed.");
+ parcAssertNotNull(ec_key, "EC key creation failed.");
EC_KEY_set_asn1_flag(ec_key, OPENSSL_EC_NAMED_CURVE);
EVP_PKEY *pkey = EVP_PKEY_new();
- assertNotNull(pkey, "EVP_PKEY_new() failed.");
+ parcAssertNotNull(pkey, "EVP_PKEY_new() failed.");
X509 *cert = X509_new();
- assertNotNull(cert, "X509_new() failed.");
+ parcAssertNotNull(cert, "X509_new() failed.");
int res;
@@ -609,6 +609,8 @@ parcX509Certificate_CreateSelfSignedCertificate(PARCBuffer **privateKeyBuffer, c
return _createSelfSignedCertificate_RSA(privateKeyBuffer, subjectName, keyLength, validityDays);
case PARCKeyType_EC:
return _createSelfSignedCertificate_EC(privateKeyBuffer, subjectName, keyLength, validityDays);
+ default:
+ break;
}
return NULL;
diff --git a/libparc/parc/security/test/test_parc_SymmetricKeySigner.c b/libparc/parc/security/test/test_parc_SymmetricKeySigner.c
index 44b169eb..401e2517 100644
--- a/libparc/parc/security/test/test_parc_SymmetricKeySigner.c
+++ b/libparc/parc/security/test/test_parc_SymmetricKeySigner.c
@@ -246,7 +246,7 @@ LONGBOW_TEST_CASE(Global, parcSymmetricSigner_SignatureSize)
PARCSigner *signer = parcSigner_Create(symmetricSigner, PARCSymmetricKeySignerAsSigner);
- assertTrue(parcSigner_GetSignatureSize(signer) == 32, "Key size unexpected %d ", parcSigner_GetSignatureSize(signer));
+ assertTrue(parcSigner_GetSignatureSize(signer) == 32, "Key size unexpected %zu ", parcSigner_GetSignatureSize(signer));
parcSigner_Release(&signer);
parcSymmetricKeySigner_Release(&symmetricSigner);
}
diff --git a/libparc/parc/statistics/parc_BasicStats.c b/libparc/parc/statistics/parc_BasicStats.c
index b66bbd7a..9b570d17 100644
--- a/libparc/parc/statistics/parc_BasicStats.c
+++ b/libparc/parc/statistics/parc_BasicStats.c
@@ -42,7 +42,7 @@ _parcBasicStats_FloatEquals(double x, double y, double e)
static bool
_parcBasicStats_Destructor(PARCBasicStats **instancePtr)
{
- assertNotNull(instancePtr, "Parameter must be a non-null pointer to a PARCBasicStats pointer.");
+ parcAssertNotNull(instancePtr, "Parameter must be a non-null pointer to a PARCBasicStats pointer.");
return true;
}
@@ -65,7 +65,7 @@ parcObject_Override(
void
parcBasicStats_AssertValid(const PARCBasicStats *instance)
{
- assertTrue(parcBasicStats_IsValid(instance),
+ parcAssertTrue(parcBasicStats_IsValid(instance),
"PARCBasicStats is not valid.");
}
diff --git a/libparc/parc/statistics/parc_EWMA.c b/libparc/parc/statistics/parc_EWMA.c
index 20f85d4a..92046ac2 100644
--- a/libparc/parc/statistics/parc_EWMA.c
+++ b/libparc/parc/statistics/parc_EWMA.c
@@ -41,7 +41,7 @@ _parcEWMA_FloatEquals(double x, double y, double e)
static bool
_parcEWMA_Destructor(PARCEWMA **instancePtr)
{
- assertNotNull(instancePtr, "Parameter must be a non-null pointer to a PARCEWMA pointer.");
+ parcAssertNotNull(instancePtr, "Parameter must be a non-null pointer to a PARCEWMA pointer.");
return true;
}
@@ -63,7 +63,7 @@ parcObject_Override(
void
parcEWMA_AssertValid(const PARCEWMA *instance)
{
- assertTrue(parcEWMA_IsValid(instance),
+ parcAssertTrue(parcEWMA_IsValid(instance),
"PARCEWMA is not valid.");
}
diff --git a/libparc/parc/testing/parc_MemoryTesting.c b/libparc/parc/testing/parc_MemoryTesting.c
index 9a7b49fa..5d53a877 100755
--- a/libparc/parc/testing/parc_MemoryTesting.c
+++ b/libparc/parc/testing/parc_MemoryTesting.c
@@ -21,8 +21,16 @@
#include <parc/testing/parc_MemoryTesting.h>
#include <parc/algol/parc_Memory.h>
+
+
+#if INTPTR_MAX == INT32_MAX
bool
parcMemoryTesting_ExpectedOutstanding(const uint32_t expected, const char *format, ...)
+#else
+bool
+parcMemoryTesting_ExpectedOutstanding(const uint64_t expected, const char *format, ...)
+#endif
+
{
bool result = true;
diff --git a/libparc/parc/testing/parc_MemoryTesting.h b/libparc/parc/testing/parc_MemoryTesting.h
index 32b139db..9ac6889d 100755
--- a/libparc/parc/testing/parc_MemoryTesting.h
+++ b/libparc/parc/testing/parc_MemoryTesting.h
@@ -43,5 +43,12 @@
* }
* @endcode
*/
-bool parcMemoryTesting_ExpectedOutstanding(const uint32_t expected, const char *format, ...);
+
+#if INTPTR_MAX == INT32_MAX
+bool
+parcMemoryTesting_ExpectedOutstanding(const uint32_t expected, const char *format, ...);
+#else
+bool
+parcMemoryTesting_ExpectedOutstanding(const uint64_t expected, const char *format, ...);
#endif
+#endif \ No newline at end of file
diff --git a/libparc/scripts/build-package.sh b/libparc/scripts/build-package.sh
index 102d05d1..2f651aa9 100644
--- a/libparc/scripts/build-package.sh
+++ b/libparc/scripts/build-package.sh
@@ -9,11 +9,11 @@ apt_get=${APT_PATH:-"/usr/local/bin/apt-get"}
BUILD_TOOLS_UBUNTU="build-essential doxygen"
LIBSSL_LIBEVENT_UBUNTU="libevent-dev libssl-dev"
-DEPS_UBUNTU="longbow-dev $LIBSSL_LIBEVENT_UBUNTU"
+DEPS_UBUNTU="$LIBSSL_LIBEVENT_UBUNTU"
BUILD_TOOLS_GROUP_CENTOS="'Development Tools'"
LIBSSL_LIBEVENT_CENTOS="libevent-devel openssl-devel"
-DEPS_CENTOS="longbow-devel $LIBSSL_LIBEVENT_CENTOS"
+DEPS_CENTOS="$LIBSSL_LIBEVENT_CENTOS"
update_cmake_repo() {
@@ -36,7 +36,7 @@ update_cmake_repo() {
update_qt_repo() {
DISTRIBUTION_CODENAME=$1
- if [ "$DISTRIBUTION_CODENAME" != "trusty" ] && [ "$DISTRIBUTION_CODENAME" != "xenial" ]; then
+ if [ "$DISTRIBUTION_CODENAME" != "bionic" ] && [ "$DISTRIBUTION_CODENAME" != "xenial" ]; then
echo "No valid distribution specified when calling 'update_qt_repo'. Exiting.."
exit -1
fi
@@ -68,9 +68,9 @@ update_fdio_repo() {
REPO_VPP_URL="${NEXUS_PROXY}/content/repositories/fd.io.stable.1701.ubuntu.xenial.main/"
REPO=${REPO_NAME:-"master.ubuntu.xenial.main"}
REPO_CICN_URL="${NEXUS_PROXY}/content/repositories/fd.io.${REPO}"
- elif [ "$DISTRIB_CODENAME" == "trusty" ]; then
- REPO_VPP_URL="${NEXUS_PROXY}/content/repositories/fd.io.stable.1701.ubuntu.trusty.main/"
- REPO=${REPO_NAME:-"master.ubuntu.trusty.main"}
+ elif [ "$DISTRIB_CODENAME" == "bionic" ]; then
+ REPO_VPP_URL="${NEXUS_PROXY}/content/repositories/fd.io.stable.1701.ubuntu.bionic.main/"
+ REPO=${REPO_NAME:-"master.ubuntu.bionic.main"}
REPO_CICN_URL="${NEXUS_PROXY}/content/repositories/fd.io.${REPO}"
else
echo "Distribution $DISTRIB_CODENAME is not supported"