Changeset 087c8798 in mainline for uspace/lib/posix/stdlib/strtol.c


Ignore:
Timestamp:
2011-07-20T19:30:30Z (13 years ago)
Author:
Petr Koupy <petr.koupy@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
102a729
Parents:
fc3680e
Message:

Added comments to stdlib.h functions (no change in functionality).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/posix/stdlib/strtol.c

    rfc3680e r087c8798  
    3030 * @{
    3131 */
    32 /** @file
     32/** @file Backend for integer conversions.
    3333 */
    3434
     
    4242#include "../errno.h"
    4343
    44 // TODO: documentation
    45 
     44/**
     45 * Decides whether a digit belongs to a particular base.
     46 *
     47 * @param c Character representation of the digit.
     48 * @param base Base against which the digit shall be tested.
     49 * @return True if the digit belongs to the base, false otherwise.
     50 */
    4651static inline bool is_digit_in_base(int c, int base)
    4752{
     
    5459}
    5560
     61/**
     62 * Derive a digit from its character representation.
     63 *
     64 * @param c Character representation of the digit.
     65 * @param base Base into which the digit belongs to.
     66 * @return Digit value represented by an integer.
     67 */
    5668static inline int get_digit_in_base(int c, int base)
    5769{
     
    6375}
    6476
     77/**
     78 * Backend for all integer conversion functions. Can be configured by arguments
     79 * to convert both signed and unsigned integers of various sizes.
     80 *
     81 * @param nptr Input string.
     82 * @param endptr If non-NULL, *endptr is set to the position of the first
     83 *     unrecognized character.
     84 * @param base Expected base of the string representation.
     85 * @param min_value Lower bound for the resulting conversion.
     86 * @param max_value Upper bound for the resulting conversion.
     87 * @param out_negative Either NULL for unsigned conversion or a pointer to the
     88 *     bool variable into which shall be placed the negativity of the resulting
     89 *     converted value.
     90 * @return Result of the conversion.
     91 */
    6592static inline unsigned long long internal_strtol(
    6693    const char *restrict nptr, char **restrict endptr, int base,
     
    188215}
    189216
     217/**
     218 * Convert a string to an integer.
     219 *
     220 * @param nptr Input string.
     221 * @return Result of the conversion.
     222 */
    190223int posix_atoi(const char *nptr)
    191224{
     
    197230}
    198231
     232/**
     233 * Convert a string to a long integer.
     234 *
     235 * @param nptr Input string.
     236 * @return Result of the conversion.
     237 */
    199238long posix_atol(const char *nptr)
    200239{
     
    206245}
    207246
     247/**
     248 * Convert a string to a long long integer.
     249 *
     250 * @param nptr Input string.
     251 * @return Result of the conversion.
     252 */
    208253long long posix_atoll(const char *nptr)
    209254{
     
    215260}
    216261
     262/**
     263 * Convert a string to a long integer.
     264 *
     265 * @param nptr Input string.
     266 * @param endptr Pointer to the final part of the string which
     267 *     was not used for conversion.
     268 * @param base Expected base of the string representation.
     269 * @return Result of the conversion.
     270 */
    217271long posix_strtol(const char *restrict nptr, char **restrict endptr, int base)
    218272{
     
    224278}
    225279
     280/**
     281 * Convert a string to a long long integer.
     282 *
     283 * @param nptr Input string.
     284 * @param endptr Pointer to the final part of the string which
     285 *     was not used for conversion.
     286 * @param base Expected base of the string representation.
     287 * @return Result of the conversion.
     288 */
    226289long long posix_strtoll(
    227290    const char *restrict nptr, char **restrict endptr, int base)
     
    234297}
    235298
     299/**
     300 * Convert a string to an unsigned long integer.
     301 *
     302 * @param nptr Input string.
     303 * @param endptr Pointer to the final part of the string which
     304 *     was not used for conversion.
     305 * @param base Expected base of the string representation.
     306 * @return Result of the conversion.
     307 */
    236308unsigned long posix_strtoul(
    237309    const char *restrict nptr, char **restrict endptr, int base)
     
    243315}
    244316
     317/**
     318 * Convert a string to a an unsigned long long integer.
     319 *
     320 * @param nptr Input string.
     321 * @param endptr Pointer to the final part of the string which
     322 *     was not used for conversion.
     323 * @param base Expected base of the string representation.
     324 * @return Result of the conversion.
     325 */
    245326unsigned long long posix_strtoull(
    246327    const char *restrict nptr, char **restrict endptr, int base)
     
    249330}
    250331
    251 
    252332/** @}
    253333 */
    254 
Note: See TracChangeset for help on using the changeset viewer.