1 /*
2 Copyright (C) 2015-2021, Dirk Krause
3 SPDX-License-Identifier: BSD-3-Clause
4 */
5 
6 /*
7 	WARNING: This file was generated by the dkct program (see
8 	http://dktools.sourceforge.net/ for details).
9 	Changes you make here will be lost if dkct is run again!
10 	You should modify the original source and run dkct on it.
11 	Original source: dk4mai8dsz.ctr
12 */
13 
14 #ifndef DK4MAI8DSZ_H_INCLUDED
15 /** Avoid multiple inclusions. */
16 #define DK4MAI8DSZ_H_INCLUDED 1
17 
18 
19 /**	@file
20 	Retrieve size_t value from
21 	8 bit character string in decimal notation.
22 
23 	CRT on Windows: Optional, disabling CRT degrades performance.
24 */
25 
26 #ifndef DK4CONF_H_INCLUDED
27 #if DK4_BUILDING_DKTOOLS4
28 #include "dk4conf.h"
29 #else
30 #include <dktools-4/dk4conf.h>
31 #endif
32 #endif
33 
34 #ifndef DK4TYPES_H_INCLUDED
35 #if DK4_BUILDING_DKTOOLS4
36 #include <libdk4base/dk4types.h>
37 #else
38 #include <dktools-4/dk4types.h>
39 #endif
40 #endif
41 
42 #ifndef DK4ERROR_H_INCLUDED
43 #if DK4_BUILDING_DKTOOLS4
44 #include <libdk4base/dk4error.h>
45 #else
46 #include <dktools-4/dk4error.h>
47 #endif
48 #endif
49 
50 
51 
52 #ifdef __cplusplus
53 extern "C" {
54 #endif
55 
56 /**	Retrieve numeric value from string, decimal notation.
57 	@param	rp	Pointer to result variable for the found value.
58 	@param	src	String to check for numeric value.
59 			In addition to the numeric value the string can
60 			contain a suffix 'K', 'M', 'G', 'T', 'P', 'E',
61 			'Z' or 'Y' to indicate multiples of powers of 1024
62 			(kibibytes, mibibytes...).
63 			Suffixes 'k', 'm', 'g', 't', 'p', 'e', 'z' or 'y'
64 			indicate multiples of powers of 1000
65 			(kilobytes, megabytes...).
66 	@param	endptr	Address of pointer variable.
67 			A pointer to the first character not processed
68 			is stored here.
69 			The function may also store a NULL pointer in this
70 			variable.
71 			The variable points to the correct error position
72 			only if er.ec is DK4_E_SYNTAX.
73 	@param	atg	Allow trailing garbage:
74 			0=no unprocessable trailing bytes allowed,
75 			1=trailing whitespaces allowed,
76 			2=any trailing characters allowed.
77 	@param	erp	Error report, may be NULL.
78 	@return	1 on success, 0 on error.
79 
80 	Error codes:
81 	DK4_E_INVALID_ARGUMENTS	if rp or src is NULL,
82 	DK4_E_MATH_OVERFLOW	if the number is out of range, or
83 	DK4_E_SYNTAX		if src contains illegal characters.
84 */
85 
86 int
87 dk4ma_input_c8_dec_size_t(
88   size_t	 *rp,
89   const char	 *src,
90   const char	**endptr,
91   int		  atg,
92   dk4_er_t	 *erp
93 );
94 
95 
96 /**	Retrieve numeric value from string, decimal notation.
97 	@param	rp	Pointer to result variable for the found value.
98 	@param	src	String to check for numeric value.
99 			No suffixes allowed.
100 	@param	endptr	Address of pointer variable.
101 			A pointer to the first character not processed
102 			is stored here.
103 			The function may also store a NULL pointer in this
104 			variable.
105 			The variable points to the correct error position
106 			only if er.ec is DK4_E_SYNTAX.
107 	@param	atg	Allow trailing garbage:
108 			0=no unprocessable trailing bytes allowed,
109 			1=trailing whitespaces allowed,
110 			2=any trailing characters allowed.
111 	@param	erp	Error report, may be NULL.
112 	@return	1 on success, 0 on error.
113 
114 	Error codes:
115 	DK4_E_INVALID_ARGUMENTS	if rp or src is NULL,
116 	DK4_E_MATH_OVERFLOW	if the number is out of range, or
117 	DK4_E_SYNTAX		if src contains illegal characters.
118 */
119 
120 int
121 dk4ma_input_c8_dec_size_t_simple(
122   size_t	 *rp,
123   const char	 *src,
124   const char	**endptr,
125   int		  atg,
126   dk4_er_t	 *erp
127 );
128 
129 
130 #ifdef __cplusplus
131 }
132 #endif
133 
134 
135 #endif
136