forked from WHC/Hermit
Vendored sashidown, OpenAI-compatible env (OPENAI_*), and bootstrap scripts. Co-authored-by: Cursor <cursoragent@cursor.com>
32 lines
884 B
C
32 lines
884 B
C
#ifndef MD_FSM_H
|
|
#define MD_FSM_H
|
|
|
|
#include <stdint.h>
|
|
#include <stddef.h>
|
|
#include "sashidown.h"
|
|
|
|
#ifndef likely
|
|
#define likely(x) __builtin_expect(!!(x), 1)
|
|
#endif
|
|
#ifndef unlikely
|
|
#define unlikely(x) __builtin_expect(!!(x), 0)
|
|
#endif
|
|
|
|
extern const uint8_t CH_HTML_ESCAPE[256];
|
|
extern const uint8_t CH_SCAN_STOP[256];
|
|
extern const uint8_t CH_JSON_ESCAPE[256];
|
|
|
|
int fsm_append(sashidown_ctx_t *ctx, char c);
|
|
int fsm_append_str(sashidown_ctx_t *ctx, const char *s);
|
|
int fsm_append_len(sashidown_ctx_t *restrict ctx, const char *restrict s, size_t n);
|
|
|
|
void fsm_append_fast(sashidown_ctx_t *ctx, char c);
|
|
void fsm_append_len_fast(sashidown_ctx_t *restrict ctx, const char *restrict s, size_t n);
|
|
|
|
void fsm_write_begin(sashidown_ctx_t *ctx);
|
|
void fsm_write_end(sashidown_ctx_t *ctx);
|
|
|
|
#define fsm_append_lit(ctx, s) fsm_append_len((ctx), (s), sizeof(s) - 1)
|
|
|
|
#endif /* MD_FSM_H */
|