summaryrefslogtreecommitdiff
path: root/src/core/config.h
blob: 63b131b2929cc548b07ee4f193550c57a97a154e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#ifndef SAND_CONFIG_H
#define SAND_CONFIG_H

// This module defines the configuration type. This is a fully transparent (i.e.
// not opaque) type which the consumer of the core library is supposed to
// assemble themselves. It contains hooks which the State will use for all effects.

#include "location.h"

#include <stddef.h>

// This handler is used for output from the user-supplied actual program.
typedef void (* SandPrintHandler)(const char *message, size_t length);

typedef enum {
	SAND_DIAGNOSTIC_INFO,
	SAND_DIAGNOSTIC_WARNING,
	SAND_DIAGNOSTIC_ERROR,
} SandDiagnosticLevel;

// This handler is used when the implementation has a report to make.
// These could for example be displayed in tan editor's interface.
typedef void (* SandDiagnosticHandler)(const SandLocation *, SandDiagnosticLevel, const char *message, size_t message_length);

typedef struct {
	SandPrintHandler print_handler;
	SandDiagnosticHandler diagnostic_handler;
} SandConfig;

#endif