|
eccLib 1.3.0
Python library for bioinformatics written in C
|
Commonly used functions. More...
Data Structures | |
| struct | occurrence_t |
| An occurrence of a token in a string. More... | |
Macros | |
| #define | UNUSED(x) |
| Supresses unused variable warnings. | |
| #define | STR(x) |
| Converts a macro to a string. | |
Functions | |
| int | strtok_ri (const char *restrict str, char delim, Py_ssize_t *restrict strLen, occurrence_t *restrict lastoccurrence) |
| Version of strtok_r that doesn't modify the original string. | |
| void | percent_encode_char (char *restrict out, char c) |
| Writes a percent encoded character to a buffer. | |
| uint32_t | strncount (const char *restrict str, char c, size_t len) |
| Counts the number of occurrences of c in str. | |
| void * | memchr2 (const void *buf, int c1, int c2, size_t len) |
| Finds the first occurrence of either c1 or c2 in buf. | |
Commonly used functions.
Mainly contains functions for string manipulation (very much a core of the library). Also here is where percent encoding handling lives
| #define STR | ( | x | ) |
| #define UNUSED | ( | x | ) |
Supresses unused variable warnings.
| x | the variable to suppress the warning for |
In C++11 you can just not provide a name for the parameter to suppress the warning, but in C you have to use this macro
| void * memchr2 | ( | const void * | buf, |
| int | c1, | ||
| int | c2, | ||
| size_t | len ) |
Finds the first occurrence of either c1 or c2 in buf.
| buf | the buffer to search in |
| c1 | the first character to search for |
| c2 | the second character to search for |
| len | the length of the buffer to search in |

| void percent_encode_char | ( | char *restrict | out, |
| char | c ) |
Writes a percent encoded character to a buffer.
Creates a percent encoded character in the form xx and writes it to out
| out | the buffer to write to |
| c | the character to encode |

| uint32_t strncount | ( | const char *restrict | str, |
| char | c, | ||
| size_t | len ) |
Counts the number of occurrences of c in str.
| str | the string to search in |
| c | the character to search for |
| len | the length of the string to search in |

| int strtok_ri | ( | const char *restrict | str, |
| char | delim, | ||
| Py_ssize_t *restrict | strLen, | ||
| occurrence_t *restrict | lastoccurrence ) |
Version of strtok_r that doesn't modify the original string.
A reentrant inplace string tokenizer. A custom type is used to store the last occurrence of the token. Both strLen and lastoccurrence are modified by this function
| str | the string to tokenize, may be NULL in which case the last occurrence is used |
| delim | the delimiter to use |
| strLen | the length of the string to tokenize, will be decremented by the length of the token found. So it will reflect the remaining length of the string after the token |
| lastoccurrence | a struct that holds the last occurrence of the token. Cannot be NULL |
