1%%	options
2
3copyright owner	=	Dirk Krause
4copyright year	=	2015-xxxx
5SPDX-License-Identifier:	BSD-3-Clause
6
7
8
9%%	header
10
11/**	@file
12	Retrieve unsigned long long value from
13	dkChar string in decimal notation.
14*/
15
16#ifndef DK4CONF_H_INCLUDED
17#if DK4_BUILDING_DKTOOLS4
18#include "dk4conf.h"
19#else
20#include <dktools-4/dk4conf.h>
21#endif
22#endif
23
24#ifndef DK4TYPES_H_INCLUDED
25#if DK4_BUILDING_DKTOOLS4
26#include <libdk4base/dk4types.h>
27#else
28#include <dktools-4/dk4types.h>
29#endif
30#endif
31
32#ifndef DK4ERROR_H_INCLUDED
33#if DK4_BUILDING_DKTOOLS4
34#include <libdk4base/dk4error.h>
35#else
36#include <dktools-4/dk4error.h>
37#endif
38#endif
39
40#ifdef __cplusplus
41extern "C" {
42#endif
43
44/**	Retrieve numeric value from string, decimal notation.
45	@param	rp	Pointer to result variable for the found value.
46	@param	src	String to check for numeric value.
47	@param	endptr	Address of pointer variable.
48			A pointer to the first character not processed
49			is stored here.
50			The function may also store a NULL pointer in this
51			variable.
52	@param	atg	Allow trailing garbage:
53			0=no unprocessable trailing bytes allowed,
54			1=trailing whitespaces allowed,
55			2=any trailing characters allowed.
56	@param	erp	Error report, may be NULL.
57	@return	1 on success, 0 on error.
58
59	Error codes:
60	DK4_E_INVALID_ARGUMENTS	if rp or src is NULL,
61	DK4_E_MATH_OVERFLOW	if the number is out of range, or
62	DK4_E_SYNTAX		if src contains illegal characters.
63*/
64int
65dk4ma_input_dk_dec_ull(
66  unsigned long long	 *rp,
67  const dkChar		 *src,
68  const dkChar		**endptr,
69  int			  atg,
70  dk4_er_t		 *erp
71);
72
73#ifdef __cplusplus
74}
75#endif
76
77
78
79%%	module
80
81#include "dk4conf.h"
82#include <libdk4maiodd/dk4maiddlu.h>
83
84#if DK4_CHAR_SIZE > 1
85#if DK4_CHAR_SIZE == DK4_SIZEOF_WCHAR_T
86#include <libdk4maiowd/dk4maiwdlu.h>
87#else
88#error "Illegal dkChar size!"
89#endif
90#else
91#include <libdk4maio8d/dk4mai8dlu.h>
92#endif
93
94#if	DK4_HAVE_ASSERT_H
95#ifndef	ASSERT_H_INCLUDED
96#include <assert.h>
97#define	ASSERT_H_INCLUDED 1
98#endif
99#endif
100
101
102int
103dk4ma_input_dk_dec_ull(
104  unsigned long long	 *rp,
105  const dkChar		 *src,
106  const dkChar		**endptr,
107  int			  atg,
108  dk4_er_t		 *erp
109)
110{
111#if	DK4_USE_ASSERT
112  assert(NULL != rp);
113  assert(NULL != src);
114#endif
115#if DK4_CHAR_SIZE > 1
116  return ( dk4ma_input_wc_dec_ull(rp, src, endptr, atg, erp));
117#else
118  return ( dk4ma_input_c8_dec_ull(rp, src, endptr, atg, erp));
119#endif
120}
121
122