Linear Methods for Image Interpolation
Functions
strutil.c File Reference

String utility functions. More...

#include <ctype.h>
#include <math.h>
#include "strutil.h"
Include dependency graph for strutil.c:

Go to the source code of this file.

Functions

int EatWhitespace (const char **StrPtr)
 Eat whitespace characters in a string.
int ParseNumber (double *Number, const char **StrPtr, int FloatAllowed)
 Read a number from a string.

Detailed Description

String utility functions.

Author:
Pascal Getreuer <getreuer@gmail.com>

Copyright (c) 2011, Pascal Getreuer All rights reserved.

This program is free software: you can use, modify and/or redistribute it under the terms of the simplified BSD License. You should have received a copy of this license along this program. If not, see <http://www.opensource.org/licenses/bsd-license.html>.

Definition in file strutil.c.


Function Documentation

int EatWhitespace ( const char **  StrPtr)

Eat whitespace characters in a string.

Parameters:
StrPtrchar** pointing to a pointer to the character array
Returns:
1 if a non-space character is found, 0 if the string terminates

This function advances a pointer to a string to consume as much whitespace as possible. Upon returning, *StrPos points to the first non-space character. If the string terminates without a non-space character, *StrPos is the location of the null terminator.

Definition at line 31 of file strutil.c.

Here is the caller graph for this function:

int ParseNumber ( double *  Number,
const char **  StrPtr,
int  FloatAllowed 
)

Read a number from a string.

Parameters:
Numberis a pointer to where to store the result
StrPtrchar** pointing to a pointer to the character array
FloatAllowedwhether decimal or scientific notations are allowed
Returns:
1 on success, 0 on failure

The routine consumes leading whitespace and reads as many characters as possible to form a valid floating-point number in decimal or scientific notation. Upon returning, *StrPos points to the character immediately following the number.

Definition at line 55 of file strutil.c.

Here is the call graph for this function:

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines