asoma.dev
· the C reference for libose
libose
the C library every o.se host is built on
Loading...
Searching...
No Matches
ose_error.h
1
/*
2
The error record: one shape for every fallible operation.
3
4
PLAN-ERROR-REPORTING.md Stage 0b. Lives here rather than in the hosts
5
deliberately. Every host that had one carried the same /exception handler,
6
and they were wrong in the same way -- a scan of items 1..4 for the first
7
string -- because the loop had been pasted into each. Record traversal is
8
shared logic and belongs in one place; only PRINTING is host-specific, so
9
the reader hands back a pointer and each host prints it its own way.
10
11
The record is a message addressed /error carrying a single `|` bundle item
12
of addressed fields:
13
14
/error : { /error/code : <int32>
15
/error/message : "<short human text>"
16
... producer-specific fields ... }
17
18
A message rather than a bare bundle because, by the OSC root rule, a bundle
19
element has no address, and the /exception handlers find the record BY
20
address. /error/code and /error/message are always present, so a host with
21
no formatter -- an MCU, a first binding -- prints /error/message and is
22
done.
23
*/
24
#ifndef OSE_ERROR_H
25
#define OSE_ERROR_H
26
27
#ifdef __cplusplus
28
extern
"C"
{
29
#endif
30
31
#include "
ose.h
"
32
43
#define OSE_ADDR_ERROR "/error"
44
53
#define OSE_ADDR_EXCEPTION "/exception"
54
66
void
ose_error_push(
ose_bundle
B
,
67
int32_t nextra,
68
int32_t code,
69
const
char
*
const
message);
70
81
const
char
*ose_error_text(
ose_bundle
B
, int32_t offset);
82
88
int32_t ose_error_find(
ose_bundle
B
);
89
104
int32_t ose_error_next(
ose_bundle
B
, int32_t prev);
105
106
#ifdef __cplusplus
107
}
108
#endif
109
110
#endif
ose.h
provides global definitions and types
B
#define B(...)
Instantiate a top-level OSC bundle.
Definition
ose_test_ctosc.h:339
ose_bundle
Definition
ose.h:400