summaryrefslogtreecommitdiff
path: root/support/dktools/dk4ahd.ctr
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2020-09-20 03:03:26 +0000
committerNorbert Preining <norbert@preining.info>2020-09-20 03:03:26 +0000
commit1f457376b478257b88d4a857f5ec1b6155442dd7 (patch)
tree2a06a60551dea362cf8cb0cb0ba66c78608717c4 /support/dktools/dk4ahd.ctr
parentac690ca29ad5bf8a5203a65fd6252f7b564f4727 (diff)
CTAN sync 202009200303
Diffstat (limited to 'support/dktools/dk4ahd.ctr')
-rw-r--r--support/dktools/dk4ahd.ctr42
1 files changed, 39 insertions, 3 deletions
diff --git a/support/dktools/dk4ahd.ctr b/support/dktools/dk4ahd.ctr
index 1fdef1ad24..59cbcada6a 100644
--- a/support/dktools/dk4ahd.ctr
+++ b/support/dktools/dk4ahd.ctr
@@ -2,7 +2,7 @@
copyright owner = Dirk Krause
copyright year = 2015-xxxx
-license = bsd
+SPDX-License-Identifier: BSD-3-Clause
@@ -30,8 +30,24 @@ obtaining DK4_EDSTM_STOP from dk4ahex_dec_add().
*/
+
+#ifndef DK4CONF_H_INCLUDED
+#if DK4_BUILDING_DKTOOLS4
#include "dk4conf.h"
+#else
+#include <dktools-4/dk4conf.h>
+#endif
+#endif
+
+#ifndef DK4ERROR_H_INCLUDED
+#if DK4_BUILDING_DKTOOLS4
#include "dk4error.h"
+#else
+#include <dktools-4/dk4error.h>
+#endif
+#endif
+
+
/** ASCII-Hex decoder.
*/
@@ -92,7 +108,7 @@ dk4ahex_finish(dk4_ahex_dec_t *dec, dk4_er_t *erp);
@return The current byte stored in the decoder.
*/
unsigned char
-dk4ahex_output(dk4_ahex_dec_t *dec, dk4_er_t *erp);
+dk4ahex_output(dk4_ahex_dec_t const *dec, dk4_er_t *erp);
#ifdef __cplusplus
}
@@ -100,6 +116,14 @@ dk4ahex_output(dk4_ahex_dec_t *dec, dk4_er_t *erp);
%% module
+#include "dk4conf.h"
+
+#if DK4_HAVE_ASSERT_H
+#ifndef ASSERT_H_INCLUDED
+#include <assert.h>
+#define ASSERT_H_INCLUDED 1
+#endif
+#endif
#include "dk4ahd.h"
#include "dk4mem.h"
@@ -114,6 +138,9 @@ $!trace-include
void
dk4ahex_dec_init(dk4_ahex_dec_t *dec, dk4_er_t *erp)
{
+#if DK4_USE_ASSERT
+ assert(NULL != dec);
+#endif
if (NULL != dec) {
DK4_MEMRES(dec, sizeof(dk4_ahex_dec_t));
dec->cpos = 0;
@@ -129,6 +156,9 @@ int
dk4ahex_dec_add(dk4_ahex_dec_t *dec, char tc, dk4_er_t *erp)
{
int back = DK4_EDSTM_ERROR;
+#if DK4_USE_ASSERT
+ assert(NULL != dec);
+#endif
if (NULL != dec) {
switch (tc) {
case ' ' : case '\t' : case '\r' : case '\n' : case 0x00 : case 0x0C : {
@@ -267,6 +297,9 @@ int
dk4ahex_finish(dk4_ahex_dec_t *dec, dk4_er_t *erp)
{
int back = DK4_EDSTM_ERROR;
+#if DK4_USE_ASSERT
+ assert(NULL != dec);
+#endif
if (NULL != dec) {
switch (dec->cpos) {
case 1: {
@@ -285,9 +318,12 @@ dk4ahex_finish(dk4_ahex_dec_t *dec, dk4_er_t *erp)
unsigned char
-dk4ahex_output(dk4_ahex_dec_t *dec, dk4_er_t *erp)
+dk4ahex_output(dk4_ahex_dec_t const *dec, dk4_er_t *erp)
{
unsigned char back = 0x00;
+#if DK4_USE_ASSERT
+ assert(NULL != dec);
+#endif
if (NULL != dec) {
back = dec->obyte;
} else {