summaryrefslogtreecommitdiff
path: root/support/dktools/dk4edstm.h
blob: b985cf50a5f174af801e3de6047882c95dc8c2ef (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
57
58
#ifndef DK4EDSTM_H_INCLUDED
#define	DK4EDSTM_H_INCLUDED	1

/**	@file	dk4edstm.h	Output values for state machines used
	to encode and decode data or for BOM detection.

	Several tasks in encoding, decoding and BOM detection are implemented
	using state machines.
	When using the state machine you pass byte by byte (or word by
	word in UTF-16 decoding) to the state machine.
	The state machines response is one from DK4_EDSTM_ACCEPT,
	DK4_EDSTM_FINISHED, DK4_EDSTM_FINISHED_WITH_UNUSED, or
	DK4_EDSTM_ERROR.
	You should perform an adequate action for the response.
	See the documentation of the specific state machine for possible
	actions.

*/

/**	Results when adding bytes to an encoder, decoder or BOM detector.
*/
enum {
				/**	Byte(s) added successfully, stored in
					the decoders internal state.
					No further action necessary.
				*/
  DK4_EDSTM_ACCEPT	=	0,

				/**	Byte(s) added successfully,
					you can retrieve output.
				*/
  DK4_EDSTM_FINISHED ,

				/**	Detection/encoding/decoding finished,
					you can retrieve the result but
					unused data is is saved in the state
					machine.
					You should retrieve and process the
					unused data before continuing to
					process the data stream.
				*/
  DK4_EDSTM_FINISHED_WITH_UNUSED ,

				/**	An EOD marker was found during
					decoding (i.e. when decoding ASCII85
					data).
					You should retrieve and process
					output available in the state machine.
				*/
  DK4_EDSTM_STOP ,

  				/**	An error occured while adding byte(s).
				*/
  DK4_EDSTM_ERROR		=	-1
};

#endif