/* Copyright (C) 2014-2020, Dirk Krause SPDX-License-Identifier: BSD-3-Clause */ /* WARNING: This file was generated by the dkct program (see http://dktools.sourceforge.net/ for details). Changes you make here will be lost if dkct is run again! You should modify the original source and run dkct on it. Original source: dk3maidd.ctr */ #ifndef DK3MAIDD_H_INCLUDED /** Avoid multiple inclusions. */ #define DK3MAIDD_H_INCLUDED 1 #line 10 "dk3maidd.ctr" /** @file dk3maidd.h Retrieve numbers from decimal dkChar strings. */ #include #include #if DK3_HAVE_SYS_TYPES_H #include #endif #if DK3_HAVE_STDINT #include #endif #if DK3_HAVE_INTTYPES_H #include #endif #if DK3_HAVE_LIMITS_H #include #endif #if DK3_HAVE_MATH_H #include #endif #if DK3_HAVE_FLOAT_H #include #endif #include #ifdef __cplusplus extern "C" { #endif /** Convert string to dk3_um_t. @param rp Pointer to result variable. @param src Source text to convert. @param ec Pointer to error code variable, may be NULL. Set to DK3_ERROR_INVALID_ARGS if rp and/or src is NULL, DK3_ERROR_SYNTAX if unacceptable characters found, DK3_ERROR_MATH_OVERFLOW on numeric overflow. @return 1 on success, 0 on error (see ec). If trailing garbage is found after the number, the function returns 1 and sets the error code variable to DK3_ERROR_SYNTAX. */ int dk3ma_um_from_string(dk3_um_t *rp, dkChar const *src, int *ec); /** Convert string to dk3_im_t. @param rp Pointer to result variable. @param src Source text to convert. @param ec Pointer to error code variable, may be NULL. Set to DK3_ERROR_INVALID_ARGS if rp and/or src is NULL, DK3_ERROR_SYNTAX if unacceptable characters found, DK3_ERROR_MATH_OVERFLOW on numeric overflow. @return 1 on success, 0 on error (see ec). If trailing garbage is found after the number, the function returns 1 and sets the error code variable to DK3_ERROR_SYNTAX. */ int dk3ma_im_from_string(dk3_im_t *rp, dkChar const *src, int *ec); /** Convert string to short. @param rp Pointer to result variable. @param src Source text to convert. @param ec Pointer to error code variable, may be NULL. Set to DK3_ERROR_INVALID_ARGS if rp and/or src is NULL, DK3_ERROR_SYNTAX if unacceptable characters found, DK3_ERROR_MATH_OVERFLOW on numeric overflow. @return 1 on success, 0 on error (see ec). If trailing garbage is found after the number, the function returns 1 and sets the error code variable to DK3_ERROR_SYNTAX. */ int dk3ma_s_from_string(short *rp, dkChar const *src, int *ec); /** Convert string to unsigned short. @param rp Pointer to result variable. @param src Source text to convert. @param ec Pointer to error code variable, may be NULL. Set to DK3_ERROR_INVALID_ARGS if rp and/or src is NULL, DK3_ERROR_SYNTAX if unacceptable characters found, DK3_ERROR_MATH_OVERFLOW on numeric overflow. @return 1 on success, 0 on error (see ec). If trailing garbage is found after the number, the function returns 1 and sets the error code variable to DK3_ERROR_SYNTAX. */ int dk3ma_us_from_string(unsigned short *rp, dkChar const *src, int *ec); /** Convert string to int. @param rp Pointer to result variable. @param src Source text to convert. @param ec Pointer to error code variable, may be NULL. Set to DK3_ERROR_INVALID_ARGS if rp and/or src is NULL, DK3_ERROR_SYNTAX if unacceptable characters found, DK3_ERROR_MATH_OVERFLOW on numeric overflow. @return 1 on success, 0 on error (see ec). If trailing garbage is found after the number, the function returns 1 and sets the error code variable to DK3_ERROR_SYNTAX. */ int dk3ma_i_from_string(int *rp, dkChar const *src, int *ec); /** Convert string to unsigned. @param rp Pointer to result variable. @param src Source text to convert. @param ec Pointer to error code variable, may be NULL. Set to DK3_ERROR_INVALID_ARGS if rp and/or src is NULL, DK3_ERROR_SYNTAX if unacceptable characters found, DK3_ERROR_MATH_OVERFLOW on numeric overflow. @return 1 on success, 0 on error (see ec). If trailing garbage is found after the number, the function returns 1 and sets the error code variable to DK3_ERROR_SYNTAX. */ int dk3ma_ui_from_string(unsigned *rp, dkChar const *src, int *ec); /** Convert string to long. @param rp Pointer to result variable. @param src Source text to convert. @param ec Pointer to error code variable, may be NULL. Set to DK3_ERROR_INVALID_ARGS if rp and/or src is NULL, DK3_ERROR_SYNTAX if unacceptable characters found, DK3_ERROR_MATH_OVERFLOW on numeric overflow. @return 1 on success, 0 on error (see ec). If trailing garbage is found after the number, the function returns 1 and sets the error code variable to DK3_ERROR_SYNTAX. */ int dk3ma_l_from_string(long *rp, dkChar const *src, int *ec); /** Convert string to unsigned long. @param rp Pointer to result variable. @param src Source text to convert. @param ec Pointer to error code variable, may be NULL. Set to DK3_ERROR_INVALID_ARGS if rp and/or src is NULL, DK3_ERROR_SYNTAX if unacceptable characters found, DK3_ERROR_MATH_OVERFLOW on numeric overflow. @return 1 on success, 0 on error (see ec). If trailing garbage is found after the number, the function returns 1 and sets the error code variable to DK3_ERROR_SYNTAX. */ int dk3ma_ul_from_string(unsigned long *rp, dkChar const *src, int *ec); #if DK3_HAVE_LONG_LONG /** Convert string to long long. @param rp Pointer to result variable. @param src Source text to convert. @param ec Pointer to error code variable, may be NULL. Set to DK3_ERROR_INVALID_ARGS if rp and/or src is NULL, DK3_ERROR_SYNTAX if unacceptable characters found, DK3_ERROR_MATH_OVERFLOW on numeric overflow. @return 1 on success, 0 on error (see ec). If trailing garbage is found after the number, the function returns 1 and sets the error code variable to DK3_ERROR_SYNTAX. */ int dk3ma_ll_from_string(long long *rp, dkChar const *src, int *ec); /** Convert string to unsigned long long. @param rp Pointer to result variable. @param src Source text to convert. @param ec Pointer to error code variable, may be NULL. Set to DK3_ERROR_INVALID_ARGS if rp and/or src is NULL, DK3_ERROR_SYNTAX if unacceptable characters found, DK3_ERROR_MATH_OVERFLOW on numeric overflow. @return 1 on success, 0 on error (see ec). If trailing garbage is found after the number, the function returns 1 and sets the error code variable to DK3_ERROR_SYNTAX. */ int dk3ma_ull_from_string(unsigned long long *rp, dkChar const *src, int *ec); #endif #if DK3_HAVE_INTMAX_T /** Convert string to intmax_t. @param rp Pointer to result variable. @param src Source text to convert. @param ec Pointer to error code variable, may be NULL. Set to DK3_ERROR_INVALID_ARGS if rp and/or src is NULL, DK3_ERROR_SYNTAX if unacceptable characters found, DK3_ERROR_MATH_OVERFLOW on numeric overflow. @return 1 on success, 0 on error (see ec). If trailing garbage is found after the number, the function returns 1 and sets the error code variable to DK3_ERROR_SYNTAX. */ int dk3ma_intmax_t_from_string(intmax_t *rp, dkChar const *src, int *ec); /** Convert string to uintmax_t. @param rp Pointer to result variable. @param src Source text to convert. @param ec Pointer to error code variable, may be NULL. Set to DK3_ERROR_INVALID_ARGS if rp and/or src is NULL, DK3_ERROR_SYNTAX if unacceptable characters found, DK3_ERROR_MATH_OVERFLOW on numeric overflow. @return 1 on success, 0 on error (see ec). If trailing garbage is found after the number, the function returns 1 and sets the error code variable to DK3_ERROR_SYNTAX. */ int dk3ma_uintmax_t_from_string(uintmax_t *rp, dkChar const *src, int *ec); #endif #ifdef __cplusplus } #endif #endif