Skip to content

Commit

Permalink
Header version, link against math libs, doxygen edits
Browse files Browse the repository at this point in the history
  • Loading branch information
attipaci committed Aug 29, 2024
1 parent 8e556a2 commit d0bbed1
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 5 deletions.
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ include config.mk
# The version of the shared .so libraries
SO_VERSION := 1

# Link against math libs (for e.g. isnan())
LDFLAGS += -lm

# Check if there is a doxygen we can run
ifndef DOXYGEN
DOXYGEN := $(shell which doxygen)
Expand Down
38 changes: 35 additions & 3 deletions include/xchange.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,46 @@
*
* A Basic set of utilities to allow platform-independent structured data exchange from C/C++.
* It also includes a JSON parser and emitter implementation.
*
* @version 0.9.0
*/

#ifndef XCHANGE_H_
#define XCHANGE_H_

#include <math.h>

/// API major version
#define XCHANGE_MAJOR_VERSION 0

/// API minor version
#define XCHANGE_MINOR_VERSION 9

/// Integer sub version of the release
#define XCHANGE_PATCHLEVEL 0

/// Additional release information in version, e.g. "-1", or "-rc1".
#define XCHANGE_RELEASE_STRING "-devel"


#ifdef str_2
# undef str_2
#endif

/// Stringify level 2 macro
#define str_2(s) str_1(s)

#ifdef str_1
# undef str_1
#endif

/// Stringify level 1 macro
#define str_1(s) #s


/// The version string for this library
#define XCHANGE_VERSION_STRING str_2(XCHANGE_MAJOR_VERSION) "." str_2(XCHANGE_MINOR_VERSION) \
"." str_2(XCHANGE_PATCHLEVEL) XCHANGE_RELEASE_STRING


#ifndef TRUE
#define TRUE 1 ///< Boolean 'true' value, if not already defined.
Expand Down Expand Up @@ -135,8 +169,6 @@ extern boolean xDebug; ///< Switch to enable debugging (very verbose) o
#define xdprintf if(xDebug) printf ///< Use for generating debug output

// In xutil.c ------------------------------------------------>
boolean xIsVerbose();
void xSetVerbose(boolean value);
int xError(const char *func, int errorCode); // TODO...
const char *xErrorDescription(int code);

Expand Down
2 changes: 1 addition & 1 deletion src/xchange.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* @author Attila Kovacs
*
* \brief
* A collection of commonly used functions for data exchange for scalars and arrays, and
* A collection of commonly used functions for standard data exchange for scalars and arrays, and
* ASCII representations.
*
*/
Expand Down
4 changes: 3 additions & 1 deletion src/xjson.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ static int PrintArray(const char *prefix, char *ptr, XType type, int ndim, const
static int PrintPrimitive(const void *ptr, XType type, char *str);
static int PrintString(const char *src, int maxLength, char *json);

static FILE *xerr; ///< File which errors are printed to.
static FILE *xerr = stderr; ///< File / stream, which errors are printed to.

static char *indent = XJSON_INDENT;
static int ilen = sizeof(XJSON_INDENT) - 1;
Expand Down Expand Up @@ -210,6 +210,8 @@ XStructure *xjsonParseFilename(const char *fileName, int *lineNumber) {
return NULL;
}

if(xIsVerbose()) fprintf(stderr, "XJSON: Parsing %s.\n", fileName);

fp = fopen(fileName, "r");
if(!fp) {
Error("Cannot open file (%s).\n", strerror(errno));
Expand Down

0 comments on commit d0bbed1

Please sign in to comment.