summaryrefslogtreecommitdiff
path: root/support/dktools/dk4tsp.h
blob: fd20ba00153adc33a6d961e8dd1d8d101df71023 (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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
/*
Copyright 2020, Dirk Krause. All rights reserved.
SPDX-License-Identifier:	BSD-3-Clause
*/

#ifndef DK4TSP_H_INCLUDED
#define	DK4TSP_H_INCLUDED	1

/**	@file	dk4tsp.h	Text stream processing.
*/

#ifndef DK4CONF_H_INCLUDED
#if DK4_BUILDING_DKTOOLS4
#include "dk4conf.h"
#else
#include <dktools-4/dk4conf.h>
#endif
#endif

#ifndef DK4TYPES_H_INCLUDED
#if DK4_BUILDING_DKTOOLS4
#include "dk4types.h"
#else
#include <dktools-4/dk4types.h>
#endif
#endif

/**	Position in a data stream.
*/
typedef struct {
  dk4_um_t	bytes;		/**< Number of bytes successfully processed. */
  dk4_um_t	chars;		/**< Number of current character. */
  dk4_um_t	lineno;		/**< Current line number. */
  dk4_um_t	charil;		/**< Number of current character in line. */
} dk4_text_stream_position_t;

/**	Results from processing a text character or a line.
*/
enum {
			/**	Text processing succeeded.
			*/
  DK4_TSP_RES_OK	=	1,

			/**	There was an error while applying
				the information, but we can continue.
			*/
  DK4_TSP_RES_ERROR	=	0,

			/**	Fatal error while applying information,
				abort processing.
			*/
  DK4_TSP_RES_FATAL	=	-1
};

#endif