Skip to content

Commit

Permalink
Added flags to XField
Browse files Browse the repository at this point in the history
  • Loading branch information
attipaci committed Sep 4, 2024
1 parent c414736 commit baab1db
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
3 changes: 2 additions & 1 deletion include/xchange.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@

typedef int XType; ///< SMA-X data type.

#define X_CHARS(length) (-(length)) ///< \hideinitializer A fixed-size character sequence of 'length' bytes.
#define X_CHARS(length) (-(length)) ///< \hideinitializer A fixed-size sequence of 'length' bytes.
#define X_UNKNOWN 0 ///< Unknown XType (default)
#define X_BOOLEAN '?' ///< \hideinitializer boolean XType
#define X_BYTE 'B' ///< \hideinitializer single byte XType
Expand Down Expand Up @@ -136,6 +136,7 @@ typedef struct XField {
XType type; ///< The underlyng data type
int ndim; ///< The dimensionality of the data
int sizes[X_MAX_DIMS]; ///< The sizes along each dimension
int flags; ///< (optional) flags that specific data exchange mechanism may use, e.g. for BSON subtype.
boolean isSerialized; ///< Whether the fields is stored in serialized (string) format.
struct XField *next; ///< Pointer to the next linked element (if inside an XStructure).
} XField;
Expand Down
4 changes: 2 additions & 2 deletions include/xjson.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@
#include <stdio.h>
#include "xchange.h"

#define XJSON_INDENT " " ///< Indentation for nested elements.
#define XJSON_INDENT " " ///< Indentation for nested elements.

#ifndef NULLDEV
# define NULLDEV "/dev/null" ///< null device on system
# define NULLDEV "/dev/null" ///< null device on system
#endif

void xjsonSetIndent(int nchars);
Expand Down
8 changes: 4 additions & 4 deletions src/xchange.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ void xSetVerbose(boolean value) {
}

/**
* Checks if the type represents a (fixed size) character sequence.
* Checks if the type represents a fixed-size character / binary sequence.
*
* \param type X-Change type to check.
*
Expand Down Expand Up @@ -166,13 +166,13 @@ int xGetElementCount(int ndim, const int *sizes) {
}

/**
* Serializes the dimensions to a string.
* Serializes the dimensions to a string as a space-separated list of integers.
*
* \param[out] dst Pointer to a string buffer with at least X_MAX_STRING_DIMS bytes size.
* \param[in] ndim Number of dimensions
* \param[in] sizes Sizes along each dimension.
*
* \return Number of characters written into the destonation buffer, not counting the string
* \return Number of characters written into the destination buffer, not counting the string
* termination.
*
*/
Expand All @@ -196,7 +196,7 @@ int xPrintDims(char *dst, int ndim, const int *sizes) {


/**
* Deserializes the sizes from a multi-dimensional specification. The parsing will terminate at the first non integer
* Deserializes the sizes from a space-separated list of dimensions. The parsing will terminate at the first non integer
* value or the end of string, whichever comes first. Integer values <= 0 are ignored.
*
* \param src Pointer to a string buffer that contains the serialized dimensions, as a list of space separated integers.
Expand Down

0 comments on commit baab1db

Please sign in to comment.