QPMS
Electromagnetic multiple scattering library and toolkit.
Loading...
Searching...
No Matches
Data Structures | Functions
canonbuf.h File Reference

Growable buffer for canonical fingerprint streams. More...

#include <complex.h>
#include <float.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
Include dependency graph for canonbuf.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  qpms_canonbuf_t
 

Functions

static void qpms_canonbuf_free (qpms_canonbuf_t *b)
 Frees the buffer contents (safe on a zero-initialised buffer).
 
static int qcb_reserve (qpms_canonbuf_t *b, size_t extra)
 
static int qpms_canonbuf_printf (qpms_canonbuf_t *b, const char *fmt,...)
 Appends a printf-formatted string; 0 on success, -1 on error.
 
static int qpms_canonbuf_double (qpms_canonbuf_t *b, double v)
 Appends a double with round-trip exactness (%.17g).
 
static int qpms_canonbuf_cdouble (qpms_canonbuf_t *b, _Complex double v)
 Appends a complex double as "(re,im)" with round-trip exact parts.
 
static int qpms_canonbuf_string (qpms_canonbuf_t *b, const char *s)
 Appends a length-prefixed string (delimiter-safe; NULL and "" differ).
 

Detailed Description

Growable buffer for canonical fingerprint streams.

Small header-only helper shared by the system fingerprint code (scatspec.c) and the simspec solver-spec fingerprint code (simspec.c). The buffer content is hashed with SHA-256 to obtain the fingerprint.

Note
The printf-based helpers rely on the process using the "C" locale (qpms-sim never calls setlocale), as required for reproducible number formatting.

Function Documentation

◆ qpms_canonbuf_string()

static int qpms_canonbuf_string ( qpms_canonbuf_t *  b,
const char *  s 
)
inlinestatic

Appends a length-prefixed string (delimiter-safe; NULL and "" differ).

Returns
0 on success, -1 on error.