PineForge unreleased
Deterministic PineScript v6 backtest runtime — C ABI reference
Loading...
Searching...
No Matches
report_mode.h
Go to the documentation of this file.
1/*
2 * SPDX-License-Identifier: Apache-2.0
3 *
4 * O1 report contract v1: data declarations only, no runtime feature probe.
5 * See docs/design/o1-report-contract.md. Including this header does not
6 * establish provider support for SUMMARY_ONLY or STREAMED.
7 * C++ row/point visitors are declared in the sibling report_pages.hpp;
8 * they use these modes/metadata and introduce no second mode vocabulary.
9 */
10#ifndef PINEFORGE_REPORT_MODE_H
11#define PINEFORGE_REPORT_MODE_H
12
13#include <pineforge/pineforge.h>
14
15#ifdef __cplusplus
16extern "C" {
17#endif
18
19/** Version of the opt-in report envelope; independent of PF_ABI_VERSION.
20 * The legacy pf_report_t layout and all existing function signatures stay
21 * unchanged. No runtime C export is introduced by this header. */
22#define PF_REPORT_ENVELOPE_VERSION 1
23
24/** Fixed-width mode word, including for consumers using short C enums. */
25typedef uint32_t pf_report_mode_v1_t;
26enum {
27 PF_REPORT_MODE_FULL = 0, /**< Legacy owning report sequences. */
28 PF_REPORT_MODE_SUMMARY_ONLY = 1, /**< FULL metric bits without presentation overrides; no captured sequences; refused with an observer, selection window or observed phase and no sink. */
29 PF_REPORT_MODE_STREAMED = 2 /**< Complete sequences in an external sink. */
30};
31
32/** Setter/read outcomes. Rejection leaves configuration unchanged; invalid
33 * envelope descriptors also leave the destination unchanged. */
34enum {
41};
42
43/** Logical cardinality and explicit capture policy for one sequence.
44 * Both flags are 0 or 1; external implies captured. An enabled, captured
45 * empty sequence has captured=1 and logical_count=0. SUMMARY_ONLY has both
46 * flags 0 even when logical_count is positive. These fields do not certify
47 * run completion. Counts refer to the authoritative pass exactly once. */
48typedef struct pf_report_sequence_v1 {
50 uint32_t captured;
51 uint32_t external;
53
54/** Fixed-size report metadata. Initialize struct_size and version before a
55 * native envelope read. complete is 1 only after the current attempt and
56 * all required replay/receipt validation succeed.
57 *
58 * The seven logical counts are independent of resident array lengths.
59 * Optional disabled sources have count/flags 0. Output rows/events remain
60 * outside pf_report_t; their capture policy is stated here for consumers. */
74
75/** Opt-in envelope, not an extension of the caller-allocated ABI-4 report.
76 * report.total_trades remains the logical total; report.trades_len and
77 * report.equity_curve_len describe resident arrays only. In SUMMARY_ONLY
78 * and STREAMED those arrays are NULL/0. The payload's existing free rules
79 * apply; the envelope itself is caller-owned. */
84
87PF_STATIC_ASSERT(offsetof(pf_report_sequence_v1, captured) == 8);
88PF_STATIC_ASSERT(offsetof(pf_report_sequence_v1, external) == 12);
90PF_STATIC_ASSERT(offsetof(pf_report_metadata_v1, trades) == 16);
91PF_STATIC_ASSERT(offsetof(pf_report_metadata_v1, equity_curve) == 32);
92PF_STATIC_ASSERT(offsetof(pf_report_metadata_v1, broker_state_hash) == 48);
94PF_STATIC_ASSERT(offsetof(pf_report_metadata_v1, trace_names) == 80);
95PF_STATIC_ASSERT(offsetof(pf_report_metadata_v1, output_rows) == 96);
96PF_STATIC_ASSERT(offsetof(pf_report_metadata_v1, output_events) == 112);
97PF_STATIC_ASSERT(offsetof(pf_report_envelope_v1, report) == 128);
99
100#ifdef __cplusplus
101} /* extern "C" */
102#endif
103
104#endif /* PINEFORGE_REPORT_MODE_H */
#define PF_STATIC_ASSERT(condition)
Definition pineforge.h:52
uint32_t pf_report_mode_v1_t
Fixed-width mode word, including for consumers using short C enums.
Definition report_mode.h:25
@ PF_REPORT_MODE_CONFLICT
Definition report_mode.h:39
@ PF_REPORT_MODE_ACCEPTED
Definition report_mode.h:35
@ PF_REPORT_MODE_BUSY
Definition report_mode.h:38
@ PF_REPORT_MODE_UNSUPPORTED
Definition report_mode.h:37
@ PF_REPORT_MODE_INVALID
Definition report_mode.h:36
@ PF_REPORT_MODE_REPLAY_UNAVAILABLE
Definition report_mode.h:40
@ PF_REPORT_MODE_SUMMARY_ONLY
FULL metric bits without presentation overrides; no captured sequences; refused with an observer,...
Definition report_mode.h:28
@ PF_REPORT_MODE_FULL
Legacy owning report sequences.
Definition report_mode.h:27
@ PF_REPORT_MODE_STREAMED
Complete sequences in an external sink.
Definition report_mode.h:29
Opt-in envelope, not an extension of the caller-allocated ABI-4 report.
Definition report_mode.h:80
pf_report_metadata_v1 metadata
Definition report_mode.h:81
Fixed-size report metadata.
Definition report_mode.h:61
pf_report_sequence_v1 trades
Definition report_mode.h:66
pf_report_sequence_v1 trace
Definition report_mode.h:69
pf_report_sequence_v1 output_rows
Definition report_mode.h:71
pf_report_sequence_v1 trace_names
Definition report_mode.h:70
pf_report_sequence_v1 equity_curve
Definition report_mode.h:67
pf_report_sequence_v1 broker_state_hash
Definition report_mode.h:68
pf_report_sequence_v1 output_events
Definition report_mode.h:72
pf_report_mode_v1_t mode
Definition report_mode.h:64
Logical cardinality and explicit capture policy for one sequence.
Definition report_mode.h:48
Backtest report filled by run_backtest / run_backtest_full.
Definition pineforge.h:366