|
TPCCLIB
|
Working with integer values. More...
#include "tpcclibConfig.h"#include <stdio.h>#include <stdlib.h>#include <string.h>#include <ctype.h>#include <math.h>#include "tpcextensions.h"Go to the source code of this file.
Functions | |
| int | atoiCheck (const char *s, int *v) |
| unsigned int | factorial (unsigned int n) |
| unsigned long long int | lfactorial (unsigned long long int n) |
| void | intlistInit (INTLIST *l) |
| void | intlistFree (INTLIST *l) |
| int | intlistAdd (INTLIST *l, const int v, const int ifnew) |
| void | intlistSort (INTLIST *l) |
| int | intlistAddFromString (const char *s1, const char *s2, INTLIST *l, const int ifnew) |
| int | intlistExpandFromString (const char *s1, const char *s2, INTLIST *l, const int ifnew) |
Working with integer values.
Definition in file intutil.c.
| int atoiCheck | ( | const char * | s, |
| int * | v ) |
Verifies that argument string at least seems like a valid integer. '\0' must follow the integer part in the string. Optional result integer value is set to 0 if string was not valid value.
| s | String which is converted to an integer; string must not contain any space characters. |
| v | Pointer to the integer; enter NULL, if not needed. |
Definition at line 25 of file intutil.c.
Referenced by intlistAddFromString(), and tacReadQView().
| unsigned int factorial | ( | unsigned int | n | ) |
Calculate factorial of given number.
| n | Integer n, from which the factorial is calculated. |
Definition at line 46 of file intutil.c.
Referenced by factorial().
| int intlistAdd | ( | INTLIST * | l, |
| const int | v, | ||
| const int | ifnew ) |
Add one integer to the integer array in INTLIST structure.
| l | Pointer to initiated or filled INTLIST structure. |
| v | Integer value to add. |
| ifnew | Add integer to the list only if it is new (0=no, 1=yes). |
Definition at line 108 of file intutil.c.
Referenced by intlistAddFromString(), and intlistExpandFromString().
| int intlistAddFromString | ( | const char * | s1, |
| const char * | s2, | ||
| INTLIST * | l, | ||
| const int | ifnew ) |
Read a list of integer values from given string with given delimiters.
| s1 | Pointer to string from which the integers are read, for example "2,3,6,8". |
| s2 | String containing character delimiters, for example ", ". |
| l | Pointer to INTLIST structure; previous contents are preserved. |
| ifnew | Add integer to the list only if it is new (0=no, 1=yes). |
Definition at line 156 of file intutil.c.
| int intlistExpandFromString | ( | const char * | s1, |
| const char * | s2, | ||
| INTLIST * | l, | ||
| const int | ifnew ) |
Read ranges and individual integer values from given string with given delimiters.
| s1 | Pointer to string from which the integers are read, for example "0-8,12,32-28" or "0..8, 12, 28..34". |
| s2 | String containing character delimiters, for example ", ". |
| l | Pointer to INTLIST struct; previous contents are preserved. |
| ifnew | Add integer to the list only if it is new (0=no, 1=yes). |
Definition at line 190 of file intutil.c.
Referenced by parSelectParameters(), and parSelectTACs().
| void intlistFree | ( | INTLIST * | l | ) |
Free memory allocated for INTLIST. All data is cleared.
| l | Pointer to INTLIST structure |
Definition at line 92 of file intutil.c.
Referenced by parSelectParameters(), and parSelectTACs().
| void intlistInit | ( | INTLIST * | l | ) |
Initiate the INTLIST structure before any use.
| l | Pointer to INTLIST. |
Definition at line 80 of file intutil.c.
Referenced by intlistFree(), parSelectParameters(), and parSelectTACs().
| void intlistSort | ( | INTLIST * | l | ) |
Sort the integer array in INTLIST structure.
| l | Pointer to INTLIST structure. |
Definition at line 137 of file intutil.c.
Referenced by parSelectParameters(), and parSelectTACs().
| unsigned long long int lfactorial | ( | unsigned long long int | n | ) |
Calculate factorial of given number.
| n | Integer n, from which the factorial is calculated. |
Definition at line 63 of file intutil.c.
Referenced by lfactorial(), mfEvalInt(), and mfEvalY().