1 /*
2 Copyright 2020, Dirk Krause. All rights reserved.
3 SPDX-License-Identifier:	BSD-3-Clause
4 */
5 
6 #ifndef DK4EDSTM_H_INCLUDED
7 #define	DK4EDSTM_H_INCLUDED	1
8 
9 /**	@file	dk4edstm.h	Output values for state machines used
10 	to encode and decode data or for BOM detection.
11 
12 	Several tasks in encoding, decoding and BOM detection are implemented
13 	using state machines.
14 	When using the state machine you pass byte by byte (or word by
15 	word in UTF-16 decoding) to the state machine.
16 	The state machines response is one from DK4_EDSTM_ACCEPT,
17 	DK4_EDSTM_FINISHED, DK4_EDSTM_FINISHED_WITH_UNUSED, or
18 	DK4_EDSTM_ERROR.
19 	You should perform an adequate action for the response.
20 	See the documentation of the specific state machine for possible
21 	actions.
22 
23 */
24 
25 /**	Results when adding bytes to an encoder, decoder or BOM detector.
26 */
27 enum {
28 				/**	Byte(s) added successfully, stored in
29 					the decoders internal state.
30 					No further action necessary.
31 				*/
32   DK4_EDSTM_ACCEPT	=	0,
33 
34 				/**	Byte(s) added successfully,
35 					you can retrieve output.
36 				*/
37   DK4_EDSTM_FINISHED ,
38 
39 				/**	Detection/encoding/decoding finished,
40 					you can retrieve the result but
41 					unused data is is saved in the state
42 					machine.
43 					You should retrieve and process the
44 					unused data before continuing to
45 					process the data stream.
46 				*/
47   DK4_EDSTM_FINISHED_WITH_UNUSED ,
48 
49 				/**	An EOD marker was found during
50 					decoding (i.e. when decoding ASCII85
51 					data).
52 					You should retrieve and process
53 					output available in the state machine.
54 				*/
55   DK4_EDSTM_STOP ,
56 
57   				/**	An error occured while adding byte(s).
58 				*/
59   DK4_EDSTM_ERROR		=	-1
60 };
61 
62 #endif
63 
64