aDefs.h

group aDefs

Acroname Specific Universal Defines and includes.

The C-Interface requires some specific defines for cross platform compatibility. The aDefs.h file contains those defines and includes that are necessary at a global level across platforms.

Things like a cross platform way to specify line endings, safe c-string copy and concatenation operations, and boolean typedefs when they are not defined by default.

We rely on the following std headers:

  • assert.h

  • stddef.h

  • stdint.h

  • stdbool.h

  • string.h

  • stdio.h

  • stdlib.h

aSHOWERR(msg, error) (printf("Error in File; %s on line; %d, %s: %d\n", __FILE__, __LINE__, msg, error))

A macro that will emit an error on stdout including file and line number when compiled without NDEBUG flag. When NDEBUG is defined it emits nothing.

OS_NEW_LN "\n"

A macro containing the appropriate line ending characters for a given platform \r\n on windows and \n elsewhere.

aStringCopySafe(d, l, s) strncpy((d), (s), (l))

A macro that maps to platform specific safe string copy. Parameters are;.

  • d: destination

  • l: length

  • s: source

aStringCatSafe(d, l, s) strncat((d), (s), (l))

A macro that maps to platform specific safe string concatination. Parameters are;.

  • d: destination

  • l: length

  • s: source

aSNPRINTF snprintf

A macro that maps to the platform specific safe printf output.

aLIBEXPORT __attribute__((visibility ("default")))

A macro that expands for dynamic library linking on a given platform.

aMemPtr void *

An acroname specific semantic define for a pointer to a chunk of memory.

const char *aDefs_GetModelName(const int modelNum)

Returns a printable model string.