|
libsheepy
|
This file has basic file, random, string, list functions. More...
#include <sys/types.h>#include <sys/stat.h>#include <stdio.h>#include <stdint.h>#include <stdbool.h>#include <stdlib.h>#include <ctype.h>#include <time.h>#include <setjmp.h>#include <iso646.h>#include <inttypes.h>#include <unistd.h>#include <string.h>#include <errno.h>

Go to the source code of this file.
Data Structures | |
| struct | staticArrayBase |
| staticArray type definition More... | |
| struct | fiberBaseT |
| all contexts must start with fiberBaseT More... | |
| struct | fibersT |
| data type for fiber system More... | |
Macros | |
| #define | _GNU_SOURCE |
| #define | LIBSHEEPY_VERSION "2.2.12.1" |
| #define | SH_PREFIX(NAME) NAME |
| #define | internal static |
| file internal declarations More... | |
| #define | local static |
| file local declarations (same as internal, shorter word) More... | |
| #define | var __auto_type |
| declare variable type automaticaly: var a = ARGC; More... | |
| #define | null NULL |
| convenience defines More... | |
| #define | yes true |
| #define | on true |
| #define | no false |
| #define | off false |
| #define | boolS(x) x ? "TRUE" : "FALSE" |
| bool to const string: printf("%s\n", boolS(boolValue)); More... | |
| #define | XSUCCESS exit(EXIT_SUCCESS); |
| success More... | |
| #define | XSuccess XSUCCESS |
| #define | XFAILURE exit(EXIT_FAILURE); |
| failure More... | |
| #define | XFailure XFAILURE |
| #define | logXSuccess(string) |
| log string with logP and exit with success More... | |
| #define | logXSuccessf(format, ...) |
| log formated string with logP and exit with success More... | |
| #define | logXFailure(string) |
| #define | logXFailuref(format, ...) |
| log formated string with logC and exit with failure More... | |
| #define | logExit(exitCode, string) |
| log string with logI and exit with exitCode More... | |
| #define | exitFailure(cond) |
| exit failure More... | |
| #define | procbegin do{ |
| defines for macro begin and end More... | |
| #define | procend }while(0) |
| #define | funcbegin ({ |
| #define | funcend }) |
| #define | MACRO(STATEMENTS) do { STATEMENTS } while(0) |
| do while(0) alternative macro definition More... | |
| #define | FUNC(STATEMENTS) ({ STATEMENTS }) |
| Macro returning a value (GNU extension): #define macro(value) FUNC(\ int returnResult = value + 2;\ returnResult;\ ) More... | |
| #define | is = |
| additions to iso646 int a is 0; if (a equals 1 or a equals 2) a shl = 2; else a inc; return ptr_to a; More... | |
| #define | equals == |
| #define | nequal != |
| #define | shr >> |
| #define | shl << |
| #define | inc ++ |
| #define | dec -- |
| #define | ptr_to & |
| #define | val_of * |
| #define | stringifyExpr(expr) stringifyExpr1(expr) |
| stringify Expression - Turn expression into a string literal More... | |
| #define | stringifyExpr1(expr) #expr |
| #define | libsheepyErrorMask 0x8000000000000000UL |
| #define | disableLibsheepyErrorLogs do{logMask &= (~libsheepyErrorMask);}while(0) |
| #define | shperror(string) |
| #define | pFuncError do{ if ((libsheepyErrorMask) & logMask) { shperror(__func__);logEBtrace;} }while(0); |
| print function name and system error More... | |
| #define | pStrError(str) do{ if ((libsheepyErrorMask) & logMask) { shperror(str);logEBtrace;} }while(0); |
| print string and system error More... | |
| #define | shPrintError do{ if ((libsheepyErrorMask) & logMask) { logE("Error line "stringifyExpr(__LINE__)", function %s, file "__FILE__"\n", __func__); logEBtrace;} }while(0); |
| print error with line number, function name and file name to stderr More... | |
| #define | pError(func) if (func == -1) shPrintError |
| print error when function failed. More... | |
| #define | pError0(func) if (func == 0) shPrintError |
| print error when function failed. More... | |
| #define | pErrorNot0(func) if (func != 0) shPrintError |
| print error when function failed. More... | |
| #define | pErrorNULL(func) if (func == NULL) shPrintError |
| print error when function failed. More... | |
| #define | pErrorValue(func, errorValue) if (func == errorValue) shPrintError |
| print error when function failed. More... | |
| #define | pTestError(test) if (test) shPrintError |
| print error when test is true More... | |
| #define | pTestErrorCmd(test, cmd) if (test) { shPrintError cmd; } |
| print error and run command when test is true More... | |
| #define | pErrorCmd(func, test, cmd) if (func test) { shPrintError cmd; } |
| print error and run cmd when test is true More... | |
| #define | pErrorResult(result, func, test) if ((result = func) test) shPrintError |
| print error when test is true and return func result in result More... | |
| #define | pErrorResultCmd(result, func, test, cmd) if ((result = func) test) { shPrintError cmd; } |
| print error and run cmd when test is true and return func result in result More... | |
| #define | isError(assigned, left) if (!(assigned = left)) |
is Assigment Error catch error when assigned is false, 0 or NULL after being assigned with left More... | |
| #define | maxTryThrowCount 16 |
| setjmp buffers for try/throw,throwV macros More... | |
| #define | setJump(slot) setjmp(tryJumpBuffers[slot]) |
| run setjmp using slot in tryJumpBuffers More... | |
| #define | try(slot) if (!setjmp(tryJumpBuffers[slot])) |
| try throw else try(slot) saves the environment in slot throw(slot) executes the else associated with try(slot) More... | |
| #define | throw(slot) longjmp(tryJumpBuffers[slot], 1) |
| throw goes to else associated with try(slot) More... | |
| #define | tryV(result, slot) if (!(result = setjmp(tryJumpBuffers[slot]))) |
| tryV stores the value from setjmp in result More... | |
| #define | throwV(slot, value) longjmp(tryJumpBuffers[slot], value) |
| throwV returns value and goes to else associated with tryV(slot) More... | |
| #define | goNLabel(go, label) goto go; label: |
| #define | i8 int8_t |
| types More... | |
| #define | i16 int16_t |
| #define | i32 int32_t |
| #define | i64 int64_t |
| #define | u8 uint8_t |
| #define | u16 uint16_t |
| #define | u32 uint32_t |
| #define | u64 uint64_t |
| #define | f32 float |
| #define | f64 double |
| #define | I8(value) (i8)(value) |
| type cast More... | |
| #define | I16(value) (i16)(value) |
| #define | I32(value) (i32)(value) |
| #define | I64(value) (i64)(value) |
| #define | U8(value) (u8)(value) |
| #define | U16(value) (u16)(value) |
| #define | U32(value) (u32)(value) |
| #define | U64(value) (u64)(value) |
| #define | F32(value) (f32)(value) |
| #define | F64(value) (f64)(value) |
| #define | MAX(a, b) (((a) > (b)) ? (a) : (b)) |
| #define | MIN(a, b) (((a) < (b)) ? (a) : (b)) |
| #define | MIN3(a, b, c) MIN((typeof(a))MIN(a, b), c) |
| #define | MAX3(a, b, c) MAX((typeof(a))MAX(a, b), c) |
| #define | ABS(a) (((a) < 0) ? -(a) : (a)) |
| #define | CLAMP(x, low, high) (((x) > (high)) ? (high) : (((x) < (low)) ? (low) : (x))) |
| #define | COUNT_ELEMENTS(arr) (sizeof (arr) / sizeof ((arr)[0])) |
| #define | ARRAY_SIZE COUNT_ELEMENTS |
| #define | EXTRACT(x, msb, lsb) ((~(0xFFFFFFFFFFFFFFFEUL << (msb)) & (x)) >> (lsb)) |
| get a bitfield in an integer (opposite of FIELD_SET) More... | |
| #define | CMP(a, b) |
| compare a to b a and b have to numbers More... | |
| #define | init0Var {0} |
| initialize array or struct to zero More... | |
| #define | ZEROVAR(name) zeroBuf(&(name), sizeof(name)) |
| memset array or struct to zero More... | |
| #define | BUCKETS(count, divider) ((count)/(divider) + (((count) % (divider)) ? 1 : 0)) |
| divide count by divider and add one when remainder is not zero this is used in segmented arrays to count the number of buckets from the element count More... | |
| #define | swapV(a, b) |
| swap a and b, a and b should have the same type More... | |
| #define | setMax(result, a, b) |
| max a,b and store result in result, a and b are evaluated only once More... | |
| #define | setMin(result, a, b) |
| min a,b and store result in result, a and b are evaluated only once More... | |
| #define | maxV(a, b) |
| max a,b and return result, a and b are evaluated only once More... | |
| #define | minV(a, b) |
| min a,b and return result, a and b are evaluated only once More... | |
| #define | absV(a) ({var UNIQVAR(_a) = a; ((UNIQVAR(_a)) < 0) ? -(UNIQVAR(_a)) : (UNIQVAR(_a));}) |
| absV return absolute value for a, a is evaluated only once More... | |
| #define | FIELD_SIZEOF(t, f) (sizeof(((t*)0)->f)) |
| FIELD_SIZEOF - get the size of a struct's field : the target struct : the target struct's field Return: the size of in the struct definition without having a declared instance of . More... | |
| #define | isIntOdd(value) (value&1) |
| true when value is odd integer More... | |
| #define | isIntEven(value) (!(value&1)) |
| true when value is even integer More... | |
| #define | typ typedef |
| typ definition as alternative to typedef More... | |
| #define | ret return |
| ret definition as alternative to return More... | |
| #define | elif else if |
| elif definition as alternative to else if More... | |
| #define | unless(cond) if(not(cond)) |
| unless executes the statement unless the condition is true (that is, if the condition is false). More... | |
| #define | until(cond) while(not(cond)) |
| until repeats the statement until the condition is true (or while the condition is false) More... | |
| #define | cast(type, casted, toCast) type casted = (type) (toCast); |
| define variable and cast pointer More... | |
| #define | freen(ptr) |
| free pointer and set it to NULL More... | |
| #define | EVA(var, func) (var = func, var) |
| Evaluate and assign Evaluate, assign result from func and return result using the comma operator. More... | |
| #define | loopBreakerInit |
| initialize the loop breaker declares loop breaker variables More... | |
| #define | loopBreakerReset |
| reset the loop breaker variables More... | |
| #define | loopBreaker(breakCount) |
| break the loop when the counter exceed breakCount More... | |
| #define | FILE_LINE __FILE__":"stringifyExpr(__LINE__) |
| generate a string FILE:LINE number More... | |
| #define | PFILE_LINE puts(FILE_LINE) |
| #define | AT pLog(LOG_DEBUG, __FILE__", %s:"stringifyExpr(__LINE__)"\n",__func__); |
| print file, function name and line More... | |
| #define | TODO(message) logD(BLD MGT BGBLK"TODO"RST BLD MGT": "message RST) |
| print a todo message in log More... | |
| #define | TOKENPASTE2(a, b) a ## b |
| #define | TOKENPASTE(a, b) TOKENPASTE2(a, b) |
| #define | UNIQVAR(name) TOKENPASTE(name, __LINE__) |
| #define | cleanCharP(name) char *name CLEANUP(cleanUpCharFree) |
| declare pointer name with type char* and free name when it is out of scope More... | |
| #define | cleanListP(name) char **name CLEANUP(cleanUpListFree) |
| declare pointer name with type char* and free name when it is out of scope More... | |
| #define | cleanFileP(name) FILE *name CLEANUP(cleanUpFileFree) |
| declare pointer name with type FILE and free (close) name when it is out of scope More... | |
| #define | cleanFd(name) int name CLEANUP(cleanUpFd) |
| declare a file descriptor name and close name when it is out of scope More... | |
| #define | cleanFdInit(name) int name CLEANUP(cleanUpFd) = -1 |
| #define | logVar(var, format) logD("%s=%" format, stringifyExpr(var), var); |
| log variable and its value More... | |
| #define | logMVar(mask, var, format) logMD(mask, "%s=%" format, stringifyExpr(var), var); |
| #define | logBoolVar(var) logVar(var, "b"); |
| log bool variable More... | |
| #define | logMBoolVar(mask, var) logMVar(mask, var, "b"); |
| #define | logPtr(pointer) logD("%s=%p", stringifyExpr(pointer), pointer); |
| log pointer More... | |
| #define | logMPtr(mask, pointer) logMD(mask, "%s=%p", stringifyExpr(pointer), pointer); |
| #define | RST "\x1B[0m" |
| reset for color function More... | |
| #define | BLD "\x1B[1m" |
| bold for color function More... | |
| #define | FNT "\x1B[2m" |
| faint More... | |
| #define | ITL "\x1B[3m" |
| italic More... | |
| #define | UDL "\x1B[4m" |
| underline for color function More... | |
| #define | BLI "\x1B[5m" |
| blink More... | |
| #define | INV "\x1B[7m" |
| inverse for color function More... | |
| #define | COC "\x1B[8m" |
| conceal/hidden for color function More... | |
| #define | CRD "\x1B[9m" |
| crossed for color function More... | |
| #define | BLK "\x1B[30m" |
| black for color function More... | |
| #define | RED "\x1B[31m" |
| red for color function More... | |
| #define | GRN "\x1B[32m" |
| green for color function More... | |
| #define | YLW "\x1B[33m" |
| yellow for color function More... | |
| #define | BLU "\x1B[34m" |
| blue for color function More... | |
| #define | MGT "\x1B[35m" |
| magenta for color function More... | |
| #define | CYN "\x1B[36m" |
| cyan for color function More... | |
| #define | WHT "\x1B[37m" |
| white for color function More... | |
| #define | BGBLK "\x1B[40m" |
| bg black for color function More... | |
| #define | BGRED "\x1B[41m" |
| bg red for color function More... | |
| #define | BGGRN "\x1B[42m" |
| bg green for color function More... | |
| #define | BGYLW "\x1B[43m" |
| bg yellow for color function More... | |
| #define | BGBLU "\x1B[44m" |
| bg blue for color function More... | |
| #define | BGMGT "\x1B[45m" |
| bg magenta for color function More... | |
| #define | BGCYN "\x1B[46m" |
| bg cyan for color function More... | |
| #define | BGWHT "\x1B[47m" |
| bg white for color function More... | |
| #define | sheepyRGBFP len = fprintf(stream, "%*s", (int)(info->left ? -info->width : info->width), b) |
| #define | sheepyBOOLFP len = fprintf(stream, "%*s", (int)(info->left ? -info->width : info->width), boolS(value)) |
| #define | timeNs(func) |
| time a function in nanoseconds More... | |
| #define | TIMEUNITUS "us" |
| #define | TIMEUNITMS "ms" |
| #define | TIMEUNITSC "s" |
| #define | timeDivs(func, div, timeunit) |
| time a function with div More... | |
| #define | timeUs(func) timeDivs(func,1E3, TIMEUNITUS) |
| time a function in microseconds More... | |
| #define | timeMs(func) timeDivs(func,1E6, TIMEUNITMS) |
| time a function in miliseconds More... | |
| #define | timeSec(func) timeDivs(func,1E9, TIMEUNITSC) |
| time a function in seconds More... | |
| #define | stopwatchStart shStopwatch(0) |
| #define | stopwatchLog printf(BLD GRN "time" RST ": %" PRIu64 "ns\n", shStopwatch(1)) |
| print stopwatch value in ns since last start More... | |
| #define | stopwatchLogDivs(div, timeunit) printf(BLD GRN "time" RST ": %f"timeunit"\n", ((float)shStopwatch(1))/div) |
| print stopwatch value in provided unit since last start More... | |
| #define | stopwatchLogUs stopwatchLogDivs(1E3, TIMEUNITUS) |
| print stopwatch value in microseconds since last start More... | |
| #define | stopwatchLogMs stopwatchLogDivs(1E6, TIMEUNITMS) |
| print stopwatch value in milliseconds since last start More... | |
| #define | stopwatchLogSec stopwatchLogDivs(1E9, TIMEUNITSC) |
| print stopwatch value in seconds since last start More... | |
| #define | LOG_EMERGENCY 0 |
| LOG LEVELS Note: When adding log levels or modes, the log_tags array in libsheepy.c must be updated. More... | |
| #define | LOG_ALERT 1 |
| #define | LOG_CRITICAL 2 |
| #define | LOG_ERROR 3 |
| #define | LOG_WARNING 4 |
| #define | LOG_NOTICE 5 |
| #define | LOG_PASS 6 |
| #define | LOG_INFO 7 |
| #define | LOG_DEBUG 8 |
| #define | LOG_INVALID 9 |
| #define | LOG_MAX_LEVEL LOG_INVALID |
| #define | LOG_DISABLE -1 |
| getMaxLogLevel and setMaxLogLevel value disabling all logs More... | |
| #define | LOG_VERBOSE 0 |
| LOG MODES when a new mode is added, add symbols in log_tags in libsheepy.c. More... | |
| #define | LOG_CONCISE 1 |
| log symbol More... | |
| #define | LOG_DATE 2 |
| log symbol and date More... | |
| #define | LOG_FUNC 3 |
| log symbol and function More... | |
| #define | LOG_PROG 4 |
| log symbol and program name More... | |
| #define | LOG_PROGNDATE 5 |
| log symbol, program name and date More... | |
| #define | LOG_VOID 6 |
| log message only More... | |
| #define | LOG_UTF8 7 |
| UTF8 symbols and concise. More... | |
| #define | LOG_PROGNFUNC 8 |
| log symbol, program name and function More... | |
| #define | LOG_INVALID_MODE 9 |
| invalid More... | |
| #define | openLogFile setLogFile |
| #define | MUST_CHECK |
| #define | pLog(level, ...) _pLog(level, __FILE__, __func__, __LINE__, __VA_ARGS__); |
| print logging levels More... | |
| #define | logY(...) pLog(LOG_EMERGENCY, __VA_ARGS__) |
| #define | logA(...) pLog(LOG_ALERT, __VA_ARGS__) |
| #define | logC(...) pLog(LOG_CRITICAL, __VA_ARGS__) |
| #define | logE(...) pLog(LOG_ERROR, __VA_ARGS__) |
| #define | logW(...) pLog(LOG_WARNING, __VA_ARGS__) |
| #define | logN(...) pLog(LOG_NOTICE, __VA_ARGS__) |
| #define | logP(...) pLog(LOG_PASS, __VA_ARGS__) |
| #define | logI(...) pLog(LOG_INFO, __VA_ARGS__) |
| #define | logD(...) pLog(LOG_DEBUG, __VA_ARGS__) |
| #define | logSY(format, string) |
| log string and free Example: logSY("The list: %s", catS("1", "2")); More... | |
| #define | logSA(format, string) |
| log string and free Example: logSA("The list: %s", catS("1", "2")); More... | |
| #define | logSC(format, string) |
| log string and free Example: logSC("The list: %s", catS("1", "2")); More... | |
| #define | logSE(format, string) |
| log string and free Example: logSE("The list: %s", catS("1", "2")); More... | |
| #define | logSW(format, string) |
| log string and free Example: logSW("The list: %s", catS("1", "2")); More... | |
| #define | logSN(format, string) |
| log string and free Example: logSN("The list: %s", catS("1", "2")); More... | |
| #define | logSP(format, string) |
| log string and free Example: logSP("The list: %s", catS("1", "2")); More... | |
| #define | logSI(format, string) |
| log string and free Example: logSI("The list: %s", catS("1", "2")); More... | |
| #define | logSD(format, string) |
| log string and free Example: logSD("The list: %s", catS("1", "2")); More... | |
| #define | pLogMask(mask, level, ...) if ((mask) & logMask) pLog(level, __VA_ARGS__) |
| print mask logging levels More... | |
| #define | logMY(mask, ...) pLogMask(mask, LOG_EMERGENCY, __VA_ARGS__) |
| #define | logMA(mask, ...) pLogMask(mask, LOG_ALERT, __VA_ARGS__) |
| #define | logMC(mask, ...) pLogMask(mask, LOG_CRITICAL, __VA_ARGS__) |
| #define | logME(mask, ...) pLogMask(mask, LOG_ERROR, __VA_ARGS__) |
| #define | logMW(mask, ...) pLogMask(mask, LOG_WARNING, __VA_ARGS__) |
| #define | logMN(mask, ...) pLogMask(mask, LOG_NOTICE, __VA_ARGS__) |
| #define | logMP(mask, ...) pLogMask(mask, LOG_PASS, __VA_ARGS__) |
| #define | logMI(mask, ...) pLogMask(mask, LOG_INFO, __VA_ARGS__) |
| #define | logMD(mask, ...) pLogMask(mask, LOG_DEBUG, __VA_ARGS__) |
| #define | showLogsInMask(mask) logMask |= mask |
| #define | hideLogsInMask(mask) logMask &= ~(mask) |
| #define | logSMY(mask, format, string) |
| log and mask string and then free Example: logSMY("The list: %s", catS("1", "2")); More... | |
| #define | logSMA(mask, format, string) |
| log and mask string and then free Example: logSMA("The list: %s", catS("1", "2")); More... | |
| #define | logSMC(mask, format, string) |
| log and mask string and then free Example: logSMI("The list: %s", catS("1", "2")); More... | |
| #define | logSME(mask, format, string) |
| log and mask string and then free Example: logSME("The list: %s", catS("1", "2")); More... | |
| #define | logSMW(mask, format, string) |
| log and mask string and then free Example: logSMW("The list: %s", catS("1", "2")); More... | |
| #define | logSMN(mask, format, string) |
| log and mask string and then free Example: logSMN("The list: %s", catS("1", "2")); More... | |
| #define | logSMP(mask, format, string) |
| log and mask string and then free Example: logSMP("The list: %s", catS("1", "2")); More... | |
| #define | logSMI(mask, format, string) |
| log and mask string and then free Example: logSMI("The list: %s", catS("1", "2")); More... | |
| #define | logSMD(mask, format, string) |
| log and mask string and then free Example: logSMD("The list: %s", catS("1", "2")); More... | |
| #define | Q_SORT3(q_a1, q_a2, q_a3, Q_LESS, Q_SWAP) |
| #define | Q_PARTITION(q_l, q_r, q_i, q_j, Q_UINT, Q_LESS, Q_SWAP) |
| #define | Q_INSERTION_SORT(q_l, q_r, Q_UINT, Q_LESS, Q_SWAP) |
| #define | Q_THRESH 16 |
| #define | Q_LOOP(Q_UINT, Q_N, Q_LESS, Q_SWAP) |
| #define | Q_SUBFILES(q_l1, q_r1, q_l2, q_r2) |
| #define | QSORT(Q_N, Q_LESS, Q_SWAP) |
| #define | BSEARCH(RESULT_INDEX, SEARCH_ELEMENT, B_N, B_LESS, B_EQUAL) |
| binary search macro More... | |
| #define | libsheepyPrealloc (1024*1024) |
| #define | makeRoom(length, alloc, addlength) |
| #define | initLibsheepy(progPath) initLibsheepyF(progPath, NULL) |
| #define | systemNFree(command) systemNFreeF(command, __LINE__, __func__, __FILE__) |
| #define | isPath fileExists |
| #define | readFileS readFileToS |
| #define | bReadFileS bReadFileToS |
| #define | bLReadFileS bLReadFileToS |
| #define | readStreamS readStreamToS |
| #define | bReadStreamS bReadStreamToS |
| #define | bLReadStreamS bLReadStreamToS |
| #define | charToS(dst, c) ;char dst[2] = {c, 0} |
| #define | freeManyS(...) freeManySF("", __VA_ARGS__, NULL) |
| #define | put puts(""); |
| #define | catS(...) catSF("", __VA_ARGS__, NULL) |
| #define | iCatS(dst, ...) iCatSF(dst, "", __VA_ARGS__, NULL) |
| #define | bCatS iCatS |
| #define | bLCatS(dst, dstSize, ...) bLCatSF(dst, dstSize, "", __VA_ARGS__, NULL) |
| #define | iAppendManyS(s, s1, ...) iAppendManySF(s, s1, __VA_ARGS__, NULL) |
| #define | bAppendManyS(s, s1, ...) bAppendManySF(s, s1, __VA_ARGS__, NULL) |
| #define | bLAppendManyS(s, sSize, s1, ...) bLAppendManySF(s, sSize, s1, __VA_ARGS__, NULL) |
| #define | replaceS_max(s, olds, news) replaceS(s,olds,news, 0) |
| #define | replaceSMax replaceS_max |
| #define | replaceSMaxLen(s, olds, news) replaceSLen(s,olds,news, 0) |
| #define | iReplaceS_max(s, olds, news) iReplaceS(s,olds,news, 0) |
| #define | iReplaceSMax iReplaceS_max |
| #define | bReplaceS_max(s, olds, news) bReplaceS(s,olds,news, 0) |
| #define | bReplaceSMax bReplaceS_max |
| #define | bLReplaceS_max(s, sSize, olds, news) bLReplaceS(s,sSize,olds,news, 0) |
| #define | bLReplaceSMax bLReplaceS_max |
| #define | replaceManyS(s, ...) replaceManySF(s, __VA_ARGS__, NULL) |
| #define | iReplaceManyS(s, olds, ...) iReplaceManySF(s, olds, __VA_ARGS__, NULL) |
| #define | bReplaceManyS(s, olds, ...) bReplaceManySF(s, olds, __VA_ARGS__, NULL) |
| #define | bLReplaceManyS(s, sSize, olds, ...) bLReplaceManySF(s, sSize, olds, __VA_ARGS__, NULL) |
| #define | icReplaceS_max(s, olds, news) icReplaceS(s,olds,news, 0) |
| #define | icReplaceSMax icReplaceS_max |
| #define | iicReplaceS_max(s, olds, news) iicReplaceS(s,olds,news, 0) |
| #define | iicReplaceSMax iicReplaceS_max |
| #define | bicReplaceS_max(s, olds, news) bicReplaceS(s,olds,news, 0) |
| #define | bicReplaceSMax bicReplaceS_max |
| #define | bLicReplaceS_max(s, sSize, olds, news) bLicReplaceS(s,sSize,olds,news, 0) |
| #define | bLicReplaceSMax bLicReplaceS_max |
| #define | icReplaceManyS(s, ...) icReplaceManySF(s, __VA_ARGS__, NULL) |
| #define | iicReplaceManyS(s, olds, ...) iicReplaceManySF(s, olds, __VA_ARGS__, NULL) |
| #define | bicReplaceManyS(s, olds, ...) bicReplaceManySF(s, olds, __VA_ARGS__, NULL) |
| #define | bLicReplaceManyS(s, sSize, olds, ...) bLicReplaceManySF(s, sSize, olds, __VA_ARGS__, NULL) |
| #define | strEq eqS |
| #define | strIEq eqIS |
| #define | toUpper(c) ((c) = toupper(c), c) |
| upper case and store the result in c and return the result More... | |
| #define | toLower(c) ((c) = tolower(c), c) |
| lower case and store the result in c and return the result More... | |
| #define | uniqSlash(s) uniqS(s, '/') |
| #define | iUniqSlash(s) iUniqS(&(s), '/') |
| #define | bUniqSlash(s) bUniqS(s, '/') |
| #define | codeSizeUTF8(utf8) codeSzUTF8[*(const uint8_t *)(utf8)] |
| size in bytes of UTF-8 code point More... | |
| #define | nextCodeUTF8(utf8) ((utf8) + codeSizeUTF8(utf8)) |
| move pointer to next UTF-8 code point, no checks are done, the utf8 pointer parameter is unchanged More... | |
| #define | nxtCodeUTF8(utf8) EVA(utf8, nextCodeUTF8(utf8)) |
| change the utf8 pointer parameter to next UTF-8 code point, like char *s; s++; More... | |
| #define | nxCodeUTF8(utf8) (utf8 = nextCodeUTF8(utf8)) |
| #define | emptyS(string) string = strdup(""); |
| #define | bEmptyS(string) (string)[0] = 0 |
| #define | orS(string, alternative) !isEmptyS(string) ? (string) : (alternative) |
| orS - if string is empty, the value is alternative More... | |
| #define | orBlankS(string, alternative) !isBlankS(string) ? (string) : (alternative) |
| blankS - if string is blank(white spaces) or empty, the value is alternative More... | |
| #define | nS(string) (string) ? (string) : "" |
| nS - null String - replace null string with "" string (empty string) More... | |
| #define | nAS(string, alternative) (string) ? (string) : (alternative) |
| nAS - null Alternative String - replace null string with alternative string More... | |
| #define | listEmptyS(list) |
| #define | listCreateS(...) listCreateSF("", __VA_ARGS__, NULL) |
| #define | listFreeManyS(...) listFreeManySF(NULL, __VA_ARGS__, NULL) |
| #define | listCatS(...) listCatSF(NULL, __VA_ARGS__, NULL) |
| #define | forever while(1) |
| forever loop More... | |
| #define | range(index, maxCount) |
| range loop ;size_t UNIQVAR needed to avoid: error: a label can only be part of a statement and a declaration is not a statement on older compilers More... | |
| #define | rangeInf(index) for (size_t index = 0 ;; index++) |
| infinity loop increase the index infinitly More... | |
| #define | rangeDown(index, maxCount) for (ssize_t index = (maxCount)-1 ; index >= 0 ; index--) |
| range down loop, index is ssize_t More... | |
| #define | rangeDownTo(index, maxCount, to) |
| range down loop to to index, index is ssize_t ;ssize_t UNIQVAR needed to avoid: error: a label can only be part of a statement and a declaration is not a statement on older compilers More... | |
| #define | rangeFrom(index, from, maxCount) |
| range loop starting at value from ;size_t UNIQVAR needed to avoid: error: a label can only be part of a statement and a declaration is not a statement on older compilers More... | |
| #define | arange(index, array) range(index, ARRAY_SIZE(array)) |
| loop on the elements of C static array of any type More... | |
| #define | arangeDown(index, array) rangeDown(index, ARRAY_SIZE(array)) |
| loop on the elements of C static array of any type from highest index down to 0 More... | |
| #define | arangeDownTo(index, array, to) rangeDownTo(index, ARRAY_SIZE(array), to) |
| loop on the elements of C static array of any type from highest index down to index 'to' More... | |
| #define | arangeFrom(index, from, array) rangeFrom(index, from, ARRAY_SIZE(array)) |
| loop on the elements of C static array of any type starting at index 'from' More... | |
| #define | circular(index, from, maxCount) |
| range from value from to maxCount-1 then from 0 to from-1 More... | |
| #define | circularDown(index, from, maxCount) |
| range from value from down to 0 then from maxCount-1 to from+1 More... | |
| #define | rangeStep(index, maxCount, step) |
| range step loop ;size_t UNIQVAR needed to avoid: error: a label can only be part of a statement and a declaration is not a statement on older compilers More... | |
| #define | rangeDownStep(index, maxCount, step) for (int64_t index = (maxCount)-1 ; index >= 0 ; index-=step) |
| range down step loop, index is int64_t More... | |
| #define | rangeFromStep(index, from, maxCount, step) |
| range step loop starting at value from ;size_t UNIQVAR needed to avoid: error: a label can only be part of a statement and a declaration is not a statement on older compilers More... | |
| #define | loop(maxCount) |
| loops without index ;size_t UNIQVAR needed to avoid: error: a label can only be part of a statement and a declaration is not a statement on older compilers More... | |
| #define | loopDownTo(maxCount, to) |
| loop to to index ;ssize_t UNIQVAR needed to avoid: error: a label can only be part of a statement and a declaration is not a statement on older compilers More... | |
| #define | loopFrom(from, maxCount) |
| loop starting at value from ;size_t UNIQVAR needed to avoid: error: a label can only be part of a statement and a declaration is not a statement on older compilers More... | |
| #define | loopStep(maxCount, step) |
| step loop ;size_t UNIQVAR needed to avoid: error: a label can only be part of a statement and a declaration is not a statement on older compilers More... | |
| #define | loopFromStep(from, maxCount, step) |
| step loop starting at value from ;size_t UNIQVAR needed to avoid: error: a label can only be part of a statement and a declaration is not a statement on older compilers More... | |
| #define | aForEach(array, element) |
| loop on array elements element is a pointer to a value in the array More... | |
| #define | aEnumerate(array, index, element) |
| enumerate array elements index is the position of the element in the array index is declared as size_t and is available after the loop element is a pointer to a value in the array More... | |
| #define | forEachCharP(list, element) for (char **element=list ; *element != NULL ; element++) |
| forEach - loop macro on list indexes to access the element in the loop, use *element More... | |
| #define | forEachCCharP(list, element) for (const char **element=list ; *element != NULL ; element++) |
| forEach for const char** lists More... | |
| #define | forEachS(list, element) |
| forEach - loop macro on list indexes to access the element in the loop, use element ;size_t UNIQVAR needed to avoid: error: a label can only be part of a statement and a declaration is not a statement on older compilers More... | |
| #define | forEachCS(list, element) |
| forEach for const char** lists More... | |
| #define | forEachType(type, list, element) for (type **element=list ; *element != NULL ; element++) |
| forEach - loop macro on list indexes More... | |
| #define | enumerateCharP(list, element, index) |
| enumerateCharP list to access the element in the loop, use *element ;size_t needed to avoid: error: a label can only be part of a statement and a declaration is not a statement on older compilers More... | |
| #define | enumerateCCharP(list, element, index) |
| enumerateCCharP const list to access the element in the loop, use *element ;size_t needed to avoid: error: a label can only be part of a statement and a declaration is not a statement on older compilers More... | |
| #define | enumerateS(list, element, index) |
| enumerateS list to acess the element in the loop, use element ;size_t needed to avoid: error: a label can only be part of a statement and a declaration is not a statement on older compilers More... | |
| #define | enumerateCS(list, element, index) |
| enumerateCS const list to acess the element in the loop, use element ;size_t needed to avoid: error: a label can only be part of a statement and a declaration is not a statement on older compilers More... | |
| #define | enumerateType(type, list, element, index) |
| enumerateType list ;size_t needed to avoid: error: a label can only be part of a statement and a declaration is not a statement on older compilers More... | |
| #define | lForEach(node, startNode) for(var node = startNode; node ; node = (node)->next) |
| loop for linked lists from startNode to last More... | |
| #define | lForEachDown(node, startNode) for(var node = startNode; node ; node = (node)->prev) |
| loop for linked lists from startNode to head More... | |
| #define | lForEachPrev lForEachDown |
| #define | execOutf systemOutf |
| #define | execf systemf |
| #define | systemOut execOut |
| #define | logSystem(cmd) |
| #define | logExec logSystem |
| #define | logSystemOut(cmd) |
| #define | logExecOut logSystemOut |
| #define | logSystemOutf(fmt, ...) |
| #define | logExecOutf logSystemOutf |
| #define | logSystemf(fmt, ...) |
| #define | logExecf logSystemf |
| #define | command(cmd) commandF(cmd, __LINE__, __func__, __FILE__) |
| #define | commandf(...) commandfF(__LINE__, __func__, __FILE__, __VA_ARGS__) |
| #define | commandNFree(cmd) commandNFreeF(cmd, __LINE__, __func__, __FILE__) |
| #define | commandOut execOut |
| #define | commandOutf systemOutf |
| #define | logCommand(cmd) |
| #define | logCommandf(fmt, ...) |
| #define | logCommandNFree(cmd) |
| #define | logCommandOut logExecOut |
| #define | logCommandOutf logExecOutf |
| #define | logBtrace char **UNIQVAR(r)=btrace();if(UNIQVAR(r)){logN("\n"BLD WHT"Backtrace:"RST);forEachS(UNIQVAR(r), element){logN(element);}listFreeS(UNIQVAR(r));logN("---");} |
| #define | logEBtrace if (btraceCfg) { char **UNIQVAR(r)=btrace();if(UNIQVAR(r)){logE("\n"BLD WHT"Backtrace:"RST);forEachS(UNIQVAR(r), element){logE(element);}listFreeS(UNIQVAR(r));logE("---");} } |
| print backtrace in error messages, default is on, use btraceEnable and btraceDisable to configure More... | |
| #define | listEmpty(list) |
| #define | listCreate(...) listCreateF(NULL, __VA_ARGS__, NULL) |
| #define | listFreeMany(...) listFreeManyF(NULL, __VA_ARGS__, NULL) |
| #define | listCat(...) listCatF(NULL, __VA_ARGS__, NULL) |
| #define | newPtr(name, type) ;type *name = malloc(sizeof(type)) |
| #define | new0Ptr(name, type) ;type *name = calloc(1, sizeof(type)) |
| #define | allocAPtr(name) name = malloc(sizeof(*(name))) |
| #define | callocAPtr(name) name = calloc(1, sizeof(*(name))) |
| #define | newArray(name, type, count) ;type *name = malloc((count) * sizeof(type)) |
| #define | new0Array(name, type, count) ;type *name = calloc(count, sizeof(type)) |
| #define | allocArray(name, count) malloc((count) * sizeof(*(name))) |
| #define | allocAArray(name, count) name = malloc((count) * sizeof(*(name))) |
| #define | callocArray(name, count) calloc(count, sizeof(*(name))) |
| #define | callocAArray(name, count) name = calloc(count, sizeof(*(name))) |
| #define | reallocArray(name, count) realloc(name, (count) * sizeof(*(name))) |
| #define | sliceSz 1 |
| slice - dynamic array in one chunk of memory (similar to vector and slab below) More... | |
| #define | sliceT(typeName, elementType) |
| declares type for slice More... | |
| #define | createSlice(typeName, name) ;typeName name; sliceInit(&name) |
| #define | createSliceCount(typeName, name, count) ;typeName name; sliceInitCount(&name, count) |
| #define | createSliceClearCount(typeName, name, count) ;typeName name; sliceCalloc(&name, count) |
| #define | createAllocateSlice(typeName, name) ;typeName *name = calloc(1, sizeof(typeName)) |
| #define | createAllocateSliceCount(typeName, name, count) ;typeName *name = calloc(1, sizeof(typeName)); sliceInitCount(name, count) |
| #define | createAllocateSliceClearCount(typeName, name, count) ;typeName *name = calloc(1, sizeof(typeName)); sliceCalloc(name, count) |
| #define | sliceTerminate(name) if (name) sliceFree(name);free(name) |
| #define | sliceInit(name) |
| initialize empty slice More... | |
| #define | sliceInitCount(name, countInt) |
| initialize slice and count More... | |
| #define | sliceCalloc(name, countInt) |
| initialize slice and count and set slice data to 0 More... | |
| #define | sliceResize(name, countInt) |
| resize slice (even empty slices) More... | |
| #define | sliceClearResize(name, countInt) |
| resize slice and clear the new elements with memset even empty slices can be resized and cleared More... | |
| #define | sliceFree(name) free((name)->array) |
| free the internal buffers More... | |
| #define | sliceElemType(name) typeof((name)->array[0]) |
| element type in slice More... | |
| #define | sliceElemPtrType(name) typeof(&(name)->array[0]) |
| element pointer type in slice More... | |
| #define | sliceDup(name) |
| duplicate slice More... | |
| #define | sliceCreateNDup(name, dest) ;typeof(*(name)) dest; sliceInitCount(&dest, (name)->count); if ((name)->array) { memcpy(dest.array, (name)->array, (name)->count * sizeof (name)->array[0]); dest.count = (name)->count;} |
| assign slice from to slice to the data is shared between slice from and slice to the counts are not shared More... | |
| #define | sliceBDup(name, dest) |
| duplicate slice to already declared dest slice More... | |
| #define | sliceData(name) (name)->array |
| direct access to underlying array More... | |
| #define | sliceFrom(name, array, countInt) |
| copy data from array to slice More... | |
| #define | sliceMirror(name, start, end) |
| mirror a range in a slice the data is not copied to dest slice, to copy data see sliceCopy or sliceBCopy More... | |
| #define | sliceBMirror(name, dest, start, end) |
| mirror a range in a slice the data is not copied to dest slice, to copy data see sliceCopy or sliceBCopy More... | |
| #define | sliceMirrorFrom(name, array, countInt) |
| mirror from array to slice the data is not copied to dest slice, to copy data see sliceCopy or sliceBCopy More... | |
| #define | sliceClear(name) |
| set 0 in slice elements count is unchanged More... | |
| #define | sliceClearRange(name, start, end) |
| #define | sliceEmpty(name) (name)->count = 0 |
| Empty slice Set count to 0 Allocated buffers in the slice must be freed before running sliceEmpty. More... | |
| #define | sliceIsEmpty(name) ((name)->count == 0 || !(name)->array) |
| is slice Empty More... | |
| #define | sliceFit(name) |
| realloc slice to count More... | |
| #define | sliceCount(name) (name)->count |
| return element count More... | |
| #define | sliceElemSize(name) sizeof((name)->array[0]) |
| size of slice element More... | |
| #define | sliceAlloc(name) |
| allocate an element only when the slice is full More... | |
| #define | sliceClearElem(name, index) memset(&(name)->array[index], 0, sizeof (name)->array[0]) |
| clear (set 0) in element at index More... | |
| #define | slicePush(name) |
| push element and expand the slice no data (random) is set in the new element More... | |
| #define | sliceAppend(name, v) |
| append element and expand the slice More... | |
| #define | sliceClearPush(name) |
| push element and expand the slice the new element is cleared More... | |
| #define | slicePop(name) ((name)->count--, (name)->array[(name)->count]) |
| pop element the element count is decreased More... | |
| #define | sliceDelLast(name) ((name)->count--) |
| delete the last element useful for avoiding warning: right-hand operand of comma expression has no effect when the poped value is not used More... | |
| #define | sliceSet(name, index, v) |
| set value at index and clearResize slice when index is outside slice count More... | |
| #define | sliceAt(name, index) ((name)->array[index]) |
| get / set element at index More... | |
| #define | slicePtr(name, index) ((name)->array + index) |
| get pointer to element at index More... | |
| #define | sliceLast(name) ((name)->array[(name)->count-1]) |
| last element More... | |
| #define | sliceLastPtr(name) ((name)->array + (name)->count - 1) |
| pointer to last element More... | |
| #define | sliceLastIndex(name) ((name)->count - 1) |
| index of last element More... | |
| #define | sliceFirst(name) ((name)->array[0]) |
| first element More... | |
| #define | sliceWriteFilename(name, filename) |
| write the slice content to filename file No NULL checks are done on the parameters More... | |
| #define | sliceWrite(name, file) fwrite((name)->array, sizeof((name)->array[0]), sliceCount(name), file) |
| write the slice content to disk No NULL checks are done on the parameters More... | |
| #define | sliceReadFilename(name, filename) |
| read a slice from filename file No NULL checks are done on the parameters More... | |
| #define | sliceRead(name, file) |
| read a slice from disk No NULL checks are done on the parameters More... | |
| #define | forEachSc(name, index) range(index, (name)->count) |
| loop index on slice elements More... | |
| #define | sliceForEach(name, element) |
| loop on slice elements element is a pointer to a value in the array More... | |
| #define | sliceEnumerate(name, index, element) |
| enumerate slice elements index is the position of the element in the array index is declared as size_t and is available after the loop element is a pointer to a value in the array More... | |
| #define | sliceInject(name, index) |
| insert an element at index the data is moved to create space for the new element to set data at the new element, use sliceAt(name, index) = value; More... | |
| #define | slicePrepend(name, v) |
| prepend element More... | |
| #define | sliceDequeue(name) |
| dequeue element More... | |
| #define | sliceDelFirst(name) |
| delete first element in slice the data is moved when count > 1 More... | |
| #define | sliceDelElem(name, index) |
| delete an element in slice the data is moved when index < (count-1) when index = count -1, the last element is deleted and no data is moved More... | |
| #define | sliceDel(name, start, end) |
| delete range in slice start must be between 0 and last index end must be between 1 and count More... | |
| #define | sliceVAppend(name, slice) |
| append slice to slice name the data is copied More... | |
| #define | sliceAppendFrom(name, array, countInt) |
| append array to slice the data is copied More... | |
| #define | sliceVPrepend(name, slice) |
| prepend slice to slice name the data in slice name is moved and the data in slice is copied to slice name More... | |
| #define | slicePrependFrom(name, array, countInt) |
| prepend array to slice the data in slice is moved and the data in array is copied to slice More... | |
| #define | sliceInsert(name, index, slice) |
| insert slice at position index the data in slice name is moved and the data in slice is copied to slice name More... | |
| #define | sliceInsertFrom(name, index, array, countInt) |
| insert array at position index the data in slice is moved and the data in array is copied to slice More... | |
| #define | sliceSlice(name, start, end) |
| slice slice, keep only elements between start and end start must be between 0 and last index end must be between 1 and count the slice is returned More... | |
| #define | sliceCopy(name, start, end) |
| copy slice elements between start and end to a new slice start must be between 0 and last index end must be between 1 and count the new slice is returned and must be freed with sliceTerminate More... | |
| #define | sliceBCopy(name, dest, start, end) |
| copy slice elements between start and end to the dest slice start must be between 0 and last index end must be between 1 and count More... | |
| #define | sliceSort(name, compareFunction) |
| sort the slice the compareFunction must prototype of type: int cmp(const void * a, const void * b); the results of the compareFunction should be: <0 when a < b 0 when a = b >0 when a > b More... | |
| #define | sliceEq(name, slice, eqFunction) |
| return true when slice name is equal to slice eqFunction should return true when the elements are equal eqFunction can be either a macro or a function More... | |
| #define | sliceHas(name, value, eqFunction) |
| return true when slice has value eqFunction should return true when the elements are equal eqFunction can be either a macro or a function More... | |
| #define | sliceIndexOf(name, value, eqFunction) |
| return index (ssize_t) of value in slice eqFunction should return true when the elements are equal eqFunction can be either a macro or a function More... | |
| #define | sliceBinarySearch(name, value, less, equal) |
| binary search value in slice More... | |
| #define | sliceUniq(name, eqFunction) |
| Uniquify elements in slice each elements are unique in the slice. More... | |
| #define | staticSliceT(typeName, elementType, MAXCOUNT) |
| staticSlice - static array with element count More... | |
| #define | createStaticSlice(typeName, name) ;typeName name; staticSliceInit(&name) |
| #define | staticSliceInit(name) |
| initialize empty staticSlice More... | |
| #define | staticSliceElemType(name) typeof((name)->array[0]) |
| element type in slice More... | |
| #define | staticSliceElemPtrType(name) typeof(&(name)->array[0]) |
| element pointer type in slice More... | |
| #define | staticSliceBDup(name, dest) |
| duplicate staticSlice to already declared dest staticSlice More... | |
| #define | staticSliceData sliceData |
| direct access to underlying array More... | |
| #define | staticSliceFrom(name, array, countInt) |
| copy data from array to staticSlice More... | |
| #define | staticSliceClear(name) memset((name)->array, 0, (name)->count * sizeof (name)->array[0]) |
| set 0 in staticSlice elements count is unchanged More... | |
| #define | staticSliceClearRange(name, start, end) memset((name)->array + start, 0, (end-start) * sizeof (name)->array[0]) |
| #define | staticSliceEmpty sliceEmpty |
| Empty staticSlice Set count to 0 Allocated buffers in the staticSlice must be freed before running staticSliceEmpty. More... | |
| #define | staticSliceIsEmpty(name) ((name)->count == 0) |
| is staticSlice Empty More... | |
| #define | staticSliceCount sliceCount |
| return element count More... | |
| #define | staticSliceElemSize sliceElemSize |
| size of staticSlice element More... | |
| #define | staticSliceClearElem sliceClearElem |
| clear (set 0) in element at index More... | |
| #define | staticSlicePush(name) (name)->count++ |
| push element and expand the staticSlice no data (random) is set in the new element More... | |
| #define | staticSliceAppend(name, v) |
| append element and expand the staticSlice More... | |
| #define | staticSliceClearPush(name) |
| push element and expand the staticSlice the new element is cleared More... | |
| #define | staticSlicePop slicePop |
| pop element the element count is decreased More... | |
| #define | staticSliceDelLast sliceDelLast |
| delete the last element useful for avoiding warning: right-hand operand of comma expression has no effect when the poped value is not used More... | |
| #define | staticSliceAt sliceAt |
| get / set element at index More... | |
| #define | staticSlicePtr slicePtr |
| get pointer to element at index More... | |
| #define | staticSliceLast sliceLast |
| last element More... | |
| #define | staticSliceLastPtr sliceLastPtr |
| pointer to last element More... | |
| #define | staticSliceLastIndex sliceLastIndex |
| index of last element More... | |
| #define | staticSliceFirst sliceFirst |
| first element More... | |
| #define | staticSliceWriteFilename sliceWriteFilename |
| write the staticSlice content to filename file No NULL checks are done on the parameters More... | |
| #define | staticSliceWrite sliceWrite |
| write the staticSlice content to disk No NULL checks are done on the parameters More... | |
| #define | staticSliceReadFilename(name, filename) |
| read a staticSlice from filename file No NULL checks are done on the parameters More... | |
| #define | staticSliceRead(name, file) |
| read a staticSlice from disk No NULL checks are done on the parameters More... | |
| #define | forEachSSc forEachSc |
| loop index on staticSlice elements More... | |
| #define | staticSliceForEach(name, element) |
| loop on slice elements element is a pointer to a value in the array More... | |
| #define | staticSliceEnumerate(name, index, element) |
| enumerate slice elements index is the position of the element in the array index is declared as size_t and is available after the loop element is a pointer to a value in the array More... | |
| #define | staticSliceInject(name, index) |
| insert an element at index the data is moved to create space for the new element to set data at the new element, use staticSliceAt(name, index) = value; More... | |
| #define | staticSlicePrepend(name, v) |
| prepend element More... | |
| #define | staticSliceDequeue sliceDequeue |
| dequeue element More... | |
| #define | staticSliceDelFirst sliceDelFirst |
| delete first element in staticSlice the data is moved when count > 1 More... | |
| #define | staticSliceDelElem sliceDelElem |
| delete an element in staticSlice the data is moved when index < (count-1) when index = count -1, the last element is deleted and no data is moved More... | |
| #define | staticSliceDel sliceDel |
| delete range in staticSlice start must be between 0 and last index end must be between 1 and count More... | |
| #define | staticSliceVAppend(name, staticSlice) |
| append staticSlice to staticSlice name the data is copied More... | |
| #define | staticSliceAppendFrom(name, array, countInt) |
| append array to staticSlice the data is copied More... | |
| #define | staticSliceVPrepend(name, staticSlice) |
| prepend staticSlice to staticSlice name the data in staticSlice name is moved and the data in staticSlice is copied to staticSlice name More... | |
| #define | staticSlicePrependFrom(name, array, countInt) |
| prepend array to staticSlice the data in staticSlice is moved and the data in array is copied to staticSlice More... | |
| #define | staticSliceInsert(name, index, staticSlice) |
| insert staticSlice at position index the data in staticSlice name is moved and the data in staticSlice is copied to staticSlice name More... | |
| #define | staticSliceInsertFrom(name, index, array, countInt) |
| insert array at position index the data in staticSlice is moved and the data in array is copied to staticSlice More... | |
| #define | staticSliceSlice sliceSlice |
| staticSlice staticSlice, keep only elements between start and end start must be between 0 and last index end must be between 1 and count the staticSlice is returned More... | |
| #define | staticSliceBCopy(name, dest, start, end) |
| copy staticSlice elements between start and end to the dest staticSlice start must be between 0 and last index end must be between 1 and count More... | |
| #define | staticSliceSort sliceSort |
| sort the staticSlice the compareFunction must prototype of type: int cmp(const void * a, const void * b); the results of the compareFunction should be: <0 when a < b 0 when a = b >0 when a > b More... | |
| #define | staticSliceEq sliceEq |
| return true when staticSlice name is equal to staticSlice eqFunction should return true when the elements are equal eqFunction can be either a macro or a function More... | |
| #define | staticSliceHas sliceHas |
| return true when staticSlice has value eqFunction should return true when the elements are equal eqFunction can be either a macro or a function More... | |
| #define | staticSliceIndexOf sliceIndexOf |
| return index (ssize_t) of value in staticSlice eqFunction should return true when the elements are equal eqFunction can be either a macro or a function More... | |
| #define | staticSliceBinarySearch sliceBinarySearch |
| binary search value in staticSlice More... | |
| #define | staticSliceUniq sliceUniq |
| Uniquify elements in staticSlice each elements are unique in the staticSlice. More... | |
| #define | vectorSz 1 |
| vector - dynamic array in one chunk of memory (similar to slab below) More... | |
| #define | vectorT(typeName, elementType) |
| declares type for vector More... | |
| #define | createVector(typeName, name) ;typeName name; vectorInit(&name) |
| #define | createVectorCount(typeName, name, count) ;typeName name; vectorInitCount(&name, count) |
| #define | createVectorClearCount(typeName, name, count) ;typeName name; vectorCalloc(&name, count) |
| #define | createAllocateVector(typeName, name) ;typeName *name = calloc(1, sizeof(typeName)) |
| #define | createAllocateVectorCount(typeName, name, count) ;typeName *name = calloc(1, sizeof(typeName)); vectorInitCount(name, count) |
| #define | createAllocateVectorClearCount(typeName, name, count) ;typeName *name = calloc(1, sizeof(typeName)); vectorCalloc(name, count) |
| #define | vectorTerminate(name) if (name) vectorFree(name);free(name) |
| #define | vectorInit(name) |
| initialize empty vector More... | |
| #define | vectorInitCount(name, countInt) |
| initialize vector and count More... | |
| #define | vectorCalloc(name, countInt) |
| initialize vector and count and set vector data to 0 More... | |
| #define | vectorResize(name, countInt) |
| resize vector (even empty vectors) More... | |
| #define | vectorClearResize(name, countInt) |
| resize vector and clear the new elements with memset even empty vectors can be resized and cleared More... | |
| #define | vectorFree sliceFree |
| free the internal buffers More... | |
| #define | vectorElemType(name) typeof((name)->array[0]) |
| element type in vector More... | |
| #define | vectorElemPtrType(name) typeof(&(name)->array[0]) |
| element pointer type in vector More... | |
| #define | vectorDup(name) |
| duplicate vector More... | |
| #define | vectorCreateNDup(name, dest) ;typeof(*(name)) dest; vectorInitCount(dest, (name)->count); if ((name)->array) { memcpy(dest->array, (name)->array, (name)->count * sizeof (name)->array[0]); dest->count = (name)->count;} |
| declare dest vector and duplicate vector More... | |
| #define | vectorBDup(name, dest) |
| duplicate vector to already declared dest vector More... | |
| #define | vectorData sliceData |
| direct access to underlying array More... | |
| #define | vectorFrom(name, array, countInt) |
| copy data from array to vector More... | |
| #define | vectorClear sliceClear |
| set 0 in vector elements count is unchanged More... | |
| #define | vectorClearRange sliceClearRange |
| #define | vectorEmpty sliceEmpty |
| Empty vector Set count to 0 Allocated buffers in the vector must be freed before running vectorEmpty. More... | |
| #define | vectorIsEmpty sliceIsEmpty |
| is vector Empty More... | |
| #define | vectorFit(name) |
| resize vector from maxCount to count More... | |
| #define | vectorCount sliceCount |
| return element count More... | |
| #define | vectorMaxCount(name) (name)->maxCount |
| return max element count More... | |
| #define | vectorElemSize sliceElemSize |
| size of vector element More... | |
| #define | vectorAlloc(name) |
| allocate an element only when the vector is full More... | |
| #define | vectorClearElem sliceClearElem |
| clear (set 0) in element at index More... | |
| #define | vectorPush(name) |
| push element and expand the vector no data (random) is set in the new element More... | |
| #define | vectorAppend(name, v) |
| append element and expand the vector More... | |
| #define | vectorClearPush(name) |
| push element and expand the vector the new element is cleared More... | |
| #define | vectorPop slicePop |
| pop element the element count is decreased More... | |
| #define | vectorDelLast sliceDelLast |
| delete the last element useful for avoiding warning: right-hand operand of comma expression has no effect when the poped value is not used More... | |
| #define | vectorPushCount(name, countp) |
| push multiple elements at once More... | |
| #define | vectorSet(name, index, v) |
| set value at index and clearResize vector when index is outside vector maxCount More... | |
| #define | vectorAt sliceAt |
| get / set element at index More... | |
| #define | vectorPtr slicePtr |
| get pointer to element at index More... | |
| #define | vectorLast sliceLast |
| last element More... | |
| #define | vectorLastPtr sliceLastPtr |
| pointer to last element More... | |
| #define | vectorLastIndex sliceLastIndex |
| index of last element More... | |
| #define | vectorFirst sliceFirst |
| first element More... | |
| #define | vectorWriteFilename sliceWriteFilename |
| write the vector content to filename file No NULL checks are done on the parameters More... | |
| #define | vectorWrite sliceWrite |
| write the vector content to disk No NULL checks are done on the parameters More... | |
| #define | vectorReadFilename(name, filename) |
| read a vector from filename file No NULL checks are done on the parameters More... | |
| #define | vectorRead(name, file) |
| read a vector from disk No NULL checks are done on the parameters More... | |
| #define | forEachV forEachSc |
| loop index on vector elements More... | |
| #define | vectorForEach(name, element) |
| loop on vector elements element is a pointer to a value in the array More... | |
| #define | vectorEnumerate(name, index, element) |
| enumerate vector elements index is the position of the element in the array index is declared as size_t and is available after the loop element is a pointer to a value in the array More... | |
| #define | vectorInject(name, index) |
| insert an element at index the data is moved to create space for the new element to set data at the new element, use vectorAt(name, index) = value; More... | |
| #define | vectorPrepend(name, v) |
| prepend element More... | |
| #define | vectorDequeue sliceDequeue |
| dequeue element More... | |
| #define | vectorDelFirst sliceDelFirst |
| delete first element in vector the data is moved when count > 1 More... | |
| #define | vectorDelElem sliceDelElem |
| delete an element in vector the data is moved when index < (count-1) when index = count -1, the last element is deleted and no data is moved More... | |
| #define | vectorDel sliceDel |
| delete range in vector start must be between 0 and last index end must be between 1 and count More... | |
| #define | vectorVAppend(name, vector) |
| append vector to vector name the data is copied More... | |
| #define | vectorAppendFrom(name, array, countInt) |
| append array to vector the data is copied More... | |
| #define | vectorVPrepend(name, vector) |
| prepend vector to vector name the data in vector name is moved and the data in vector is copied to vector name More... | |
| #define | vectorPrependFrom(name, array, countInt) |
| prepend array to vector the data in vector is moved and the data in array is copied to vector More... | |
| #define | vectorInsert(name, index, vector) |
| insert vector at position index the data in vector name is moved and the data in vector is copied to vector name More... | |
| #define | vectorInsertFrom(name, index, array, countInt) |
| insert array at position index the data in vector is moved and the data in array is copied to vector More... | |
| #define | vectorSlice sliceSlice |
| slice vector, keep only elements between start and end start must be between 0 and last index end must be between 1 and count the vector is returned More... | |
| #define | vectorCopy(name, start, end) |
| copy vector elements between start and end to a new vector start must be between 0 and last index end must be between 1 and count the new vector is returned and must be freed with vectorTerminate More... | |
| #define | vectorBCopy(name, dest, start, end) |
| copy vector elements between start and end to the dest vector start must be between 0 and last index end must be between 1 and count More... | |
| #define | vectorSort sliceSort |
| sort the vector the compareFunction must prototype of type: int cmp(const void * a, const void * b); the results of the compareFunction should be: <0 when a < b 0 when a = b >0 when a > b More... | |
| #define | vectorEq sliceEq |
| return true when vector name is equal to vector eqFunction should return true when the elements are equal eqFunction can be either a macro or a function More... | |
| #define | vectorHas sliceHas |
| return true when vector has value eqFunction should return true when the elements are equal eqFunction can be either a macro or a function More... | |
| #define | vectorIndexOf sliceIndexOf |
| return index (ssize_t) of value in vector eqFunction should return true when the elements are equal eqFunction can be either a macro or a function More... | |
| #define | vectorBinarySearch sliceBinarySearch |
| binary search value in vector More... | |
| #define | vectorUniq sliceUniq |
| Uniquify elements in vector each elements are unique in the vector. More... | |
| #define | dVectorBits 6 |
| dynamic segmented vector More... | |
| #define | dVectorSz (1<<dVectorBits) |
| #define | dVectorMask (dVectorSz-1) |
| #define | dVectorT(typeName, elementType) |
| declares type for dynamic array More... | |
| #define | createDVector(typeName, name) ;typeName name; dVectorInit(&name) |
| #define | createDVectorCount(typeName, name, count) ;typeName name; dVectorInitCount(&name, count) |
| #define | dVectorInit(a) |
| initialize dynamic array with minimum element count More... | |
| #define | dVectorInitCount(a, count) |
| initialize dynamic array and count More... | |
| #define | dVectorResize(a, count) |
| #define | dVectorFree(a) |
| free the internal buffers More... | |
| #define | dVectorElemType(name) typeof((name)->element) |
| element type in vector More... | |
| #define | dVectorElemPtrType(name) typeof(&(name)->element) |
| element pointer type in vector More... | |
| #define | dVectorEmpty(name) (name)->count = 0 |
| Empty Array Allocated buffers in the array must be freed before running dVectorEmpty. More... | |
| #define | dVectorIsEmpty(name) ((name)->count == 0) |
| is Array Empty More... | |
| #define | dVectorCount(name) (name)->count |
| return element count More... | |
| #define | dVectorMaxCount(name) ((name)->maxCount * dVectorSz) |
| return max element count More... | |
| #define | dVectorAlloc(a) |
| allocate buffer for new elements only when the array is full More... | |
| #define | dVectorPush(a) |
| push element and expand the dynamic array no data (random) is set in the new element. More... | |
| #define | dVectorAppend(a, v) |
| append element and expand the dynamic array More... | |
| #define | dVectorPop(a) ((a)->count--, *((typeof((a)->element)*)((a)->buffers[((a)->count)>>dVectorBits])+(((a)->count)&dVectorMask))) |
| pop element the index of the last element is decreased More... | |
| #define | dVectorDelLast(a) ((a)->count--) |
| delete the last element useful for avoiding warning: right-hand operand of comma expression has no effect when the poped value is not used More... | |
| #define | dVectorAt(a, index) (*((typeof((a)->element)*)((a)->buffers[(index)>>dVectorBits])+((index)&dVectorMask))) |
| get / set element at index More... | |
| #define | dVectorPtr(a, index) ((typeof((a)->element)*)((a)->buffers[(index)>>dVectorBits])+((index)&dVectorMask)) |
| get pointer to element at index More... | |
| #define | dVectorLast(a) (*((typeof((a)->element)*)((a)->buffers[((a)->count-1)>>dVectorBits])+(((a)->count-1)&dVectorMask))) |
| last element More... | |
| #define | dVectorLastPtr(a) ((typeof((a)->element)*)((a)->buffers[((a)->count-1)>>dVectorBits])+(((a)->count-1)&dVectorMask)) |
| pointer to last element More... | |
| #define | dVectorLastIndex(a) ((a)->count-1) |
| index of last element More... | |
| #define | dVectorFirst(a) (*((typeof((a)->element)*)((a)->buffers[0]))) |
| first element More... | |
| #define | dVectorWriteFilename(a, filename) |
| write the dVector content to filename file No NULL checks are done on the parameters More... | |
| #define | dVectorWrite(a, file) |
| write the dVector content to disk No NULL checks are done on the parameters More... | |
| #define | dVectorReadFilename(a, filename) |
| read a dVector from filename file No NULL checks are done on the parameters More... | |
| #define | dVectorRead(a, file) |
| read a dVector from disk No NULL checks are done on the parameters More... | |
| #define | dVectorForEach(name, element) |
| loop on dVector elements element is a pointer to a value in the array More... | |
| #define | dVectorEnumerate(name, index, element) |
| enumerate dVector elements index is the position of the element in the array index is declared as size_t and is available after the loop element is a pointer to a value in the array More... | |
| #define | staticArrayT(typeName, element, MAXCOUNT) |
| declares type for staticArray or ring More... | |
| #define | createStaticArray(typeName, name) ;typeName name; staticArrayInit(name) |
| #define | staticArrayInit(name) |
| initialize count in array/static ring this macro can initialize rings if the struct is accessed directly More... | |
| #define | staticArrayElemType(name) typeof((name).list[0]) |
| element type in array More... | |
| #define | staticArrayElemPtrType(name) typeof(&(name).list[0]) |
| element pointer type in array More... | |
| #define | staticArrayEmpty(name) |
| Empty Array Allocated buffers in the list must be freed before running staticArrayEmpty. More... | |
| #define | staticArrayIsEmpty(name) ((name).isEmpty) |
| is Array Empty More... | |
| #define | staticArrayIsFull(name) ((name).isEmpty ? 0 : ((((name).last+1) % (name).maxCount) == (name).head)) |
| is Array Full More... | |
| #define | staticArrayCount(name) ((name).isEmpty ? 0 : ((((name).last) >= ((name).head)) ? ((name).last-(name).head+1) : (((name).maxCount-(name).head + (name).last+1))) ) |
| return elements count More... | |
| #define | staticArrayPush(name) |
| push element to array (only increases last) use staticArrayLast to access the element More... | |
| #define | staticArrayPop(name) |
| pop element from array (only decreases last) More... | |
| #define | staticArrayDelLast staticArrayPop |
| #define | staticArrayPrepend(name) |
| prepend element to array (only decreases head) use staticArrayFirst to access the element More... | |
| #define | staticArrayDequeue(name) |
| dequeue element from array (only increases head) More... | |
| #define | staticArrayDelFirst staticArrayDequeue |
| #define | staticArrayGet(name, index) (name).list[(((index) >= 0) ? (index) : staticArrayCount(name) + (index) )] |
| get element at index, negative index is supported More... | |
| #define | staticArrayAt staticArrayGet |
| #define | staticArrayGetIndex(name, index) ((((index) >= 0) ? (index) : staticArrayCount(name) + (index) )) |
| index of element for an index relative to 0, negative index is supported More... | |
| #define | staticArrayRef(name, index) (name).list[((((index) >= 0) ? (index) : staticArrayCount(name) + (index) ) + name.head) % name.maxCount] |
| get element at index with name->head index 0, negative index is supported More... | |
| #define | staticArrayRefIndex(name, index) (((((index) >= 0) ? (index) : staticArrayCount(name) + (index) ) + name.head) % name.maxCount) |
| index of element for an index relative to head, negative index is supported More... | |
| #define | staticArrayLast(name) (name).list[(name).last] |
| last element in array More... | |
| #define | staticArrayLastIndex(name) (name).last |
| index of last element More... | |
| #define | staticArrayFirst(name) (name).list[(name).head] |
| first element in array More... | |
| #define | staticArrayFirstIndex(name) (name).head |
| index of first element More... | |
| #define | staticArrayDelElem(name, index) |
| delete an element in the array and move elements after it to fill the gap More... | |
| #define | staticArrayWriteFilename(name, filename) |
| write the staticArray content to filename file No NULL checks are done on the parameters More... | |
| #define | staticArrayWrite(name, file) |
| write the staticArray content to disk No NULL checks are done on the parameters More... | |
| #define | staticArrayReadFilename(name, filename) |
| read name staticArray from filename file No NULL checks are done on the parameters More... | |
| #define | staticArrayRead(name, file) |
| read name staticArray from disk No NULL checks are done on the parameters More... | |
| #define | staticArrayForEach(name, element) |
| loop on staticArray elements element is a pointer to a value in the array More... | |
| #define | staticArrayEnumerate(name, index, element) |
| enumerate staticArray elements index is the position of the element in the array index is declared as size_t and is available after the loop element is a pointer to a value in the array More... | |
| #define | indexer staticArrayBase |
| indexer is a staticArray without the list It indexes an independent array More... | |
| #define | indexerT(typeName, INT_TYPE) |
| declare an indexer type with INT_TYPE counters instead of the default i64 INT_TYPE has to be signed integer More... | |
| #define | createIndexer(typeName, name, maxCount) ;typeName name; indexerInit(name, maxCount) |
| #define | indexerInit(name, MAXCOUNT) |
| initialize count in array/static ring this macro can initialize rings if the struct is accessed directly More... | |
| #define | indexerPInit ringInit |
| #define | indexerEmpty staticArrayEmpty |
| Empty Array Allocated buffers in the list must be freed before running staticArrayEmpty. More... | |
| #define | indexerPEmpty ringEmpty |
| #define | indexerIsEmpty staticArrayIsEmpty |
| is Array Empty More... | |
| #define | indexerPIsEmpty ringIsEmpty |
| #define | indexerIsFull staticArrayIsFull |
| is Array Full More... | |
| #define | indexerPIsFull ringIsFull |
| #define | indexerCount staticArrayCount |
| return elements count More... | |
| #define | indexerPCount ringCount |
| #define | indexerPush staticArrayPush |
| push element to array (only increases last) use staticArrayLast to access the element More... | |
| #define | indexerPPush ringPush |
| #define | indexerPop staticArrayPop |
| pop element from array (only decreases last) More... | |
| #define | indexerPPop ringPop |
| #define | indexerPrepend staticArrayPrepend |
| prepend element to array (only decreases head) use staticArrayFirst to access the element More... | |
| #define | indexerPPrepend ringPrepend |
| #define | indexerDequeue staticArrayDequeue |
| dequeue element from array (only increases head) More... | |
| #define | indexerPDequeue ringDequeue |
| #define | indexerRef(name, index) (((((index) >= 0) ? (index) : indexerCount(name) + (index) ) + name.head) % name.maxCount) |
| index element at index with name->head index 0, negative index is supported More... | |
| #define | indexerPRef(name, index) (((((index) >= 0) ? (index) : indexerPCount(name) + (index) ) + name->head) % name->maxCount) |
| #define | indexerLast(name) name.last |
| index of last element in array More... | |
| #define | indexerPLast(name) (name)->last |
| #define | indexerFirst(name) (name.head) |
| index of first element in array More... | |
| #define | indexerPFirst(name) (name)->head |
| #define | ringBase staticArrayBase |
| rings usage More... | |
| #define | ringMake staticArrayT |
| declares type for staticArray or ring staticArrayT(typeName, element, MAXCOUNT) More... | |
| #define | ringStaticInit staticArrayInit |
| initialize count in array/static ring staticArrayInit(name, MAXCOUNT) More... | |
| #define | ringGet(name, index) (name)->list[(((index) >= 0) ? (index) : ringCount(name) + (index) )] |
| get element at index, negative index is supported More... | |
| #define | ringRef(name, index) (name)->list[((((index) >= 0) ? (index) : ringCount(name) + (index) ) + name->head) % name->maxCount] |
| get element at index with name->head index 0, negative index is supported More... | |
| #define | ringLast(name) (name)->list[(name)->last] |
| last element in ring More... | |
| #define | ringLastIndex(name) (name)->last |
| index of last element More... | |
| #define | ringFirst(name) (name)->list[(name)->head] |
| last element in ring More... | |
| #define | ringSend(name, value) |
| send data in ring More... | |
| #define | ringSendSt(status, name, value) |
| #define | ringRecv(name, result) |
| receive data from ring More... | |
| #define | ringRecvSt(status, name, result) |
| #define | tCount 10 |
| #define | fiberCtx(thisSlot) fibers.context[thisSlot] |
| get fiber context for thisSlot More... | |
| #define | startJump(func) |
| fibers with setjmp (not ucontext) internal More... | |
| #define | yield(slotValue, slot) |
| yield jumps back to other fiber slot should be a local variable in the fiber slot is set to the index in fiberJumpBuffers for current fiber backToSlot is the index in fiberJumpBuffers for the other fiber More... | |
| #define | fiberEnd(slot) |
| return to scheduler and end the fiber More... | |
| #define | schedulerYield(backToSlot) |
| #define | dArrayBits 6 |
| dynamic segmented array More... | |
| #define | dArraySz (1<<dArrayBits) |
| #define | dArrayMask (dArraySz-1) |
| #define | dArrayT(typeName, elementType) |
| declares type for dynamic array More... | |
| #define | createDArray(typeName, name) ;typeName name; dArrayInit(&name) |
| #define | createDArrayCount(typeName, name, count) ;typeName name; dArrayInitCount(&name, count) |
| #define | dArrayInit(a) |
| initialize dynamic array with minimum element count More... | |
| #define | dArrayInitCount(a, count) |
| initialize dynamic array and count More... | |
| #define | dArrayResize(a, count) |
| #define | dArrayFree dVectorFree |
| free the internal buffers More... | |
| #define | dArrayElemType(a) typeof((a)->element) |
| element type in array More... | |
| #define | dArrayElemPtrType(a) typeof(&(a)->element) |
| element pointer type in array More... | |
| #define | dArrayEmpty(name) |
| Empty Array Allocated buffers in the array must be freed before running dArrayEmpty. More... | |
| #define | dArrayIsEmpty(name) ((name)->head == (name)->last) |
| is Array Empty More... | |
| #define | dArrayCount(name) ((name)->last - (name)->head) |
| return element count More... | |
| #define | dArrayMaxCount(name) ((name)->maxCount * dArraySz) |
| return max element count More... | |
| #define | dArrayAlloc(a) |
| allocate buffer for new elements only when the array is full More... | |
| #define | dArrayPush(a) |
| push element and expand the dynamic array no data (random) is set in the new element. More... | |
| #define | dArrayAppend(a, v) |
| append element and expand the dynamic array More... | |
| #define | dArrayPop(a) ((a)->last--, *((typeof((a)->element)*)((a)->buffers[((a)->last)>>dArrayBits])+(((a)->last)&dArrayMask))) |
| pop element the index of the last element is decreased More... | |
| #define | dArrayDelLast(a) ((a)->last--) |
| delete the last element useful for avoiding warning: right-hand operand of comma expression has no effect when the poped value is not used More... | |
| #define | dArrayPrepend(a, v) |
| prepend element More... | |
| #define | dArrayDequeue(a) ((a)->head++, *((typeof((a)->element)*)((a)->buffers[((a)->head-1)>>dArrayBits])+(((a)->head-1)&dArrayMask))) |
| dequeue element the index of the head element is increased More... | |
| #define | dArrayDelFirst(a) ((a)->head++) |
| delete the first element useful for avoiding warning: right-hand operand of comma expression has no effect when the dequeued value is not used More... | |
| #define | dArrayAt(a, index) (*((typeof((a)->element)*)((a)->buffers[(index)>>dArrayBits])+((index)&dArrayMask))) |
| get / set element at index More... | |
| #define | dArrayPtr(a, index) ((typeof((a)->element)*)((a)->buffers[(index)>>dArrayBits])+((index)&dArrayMask)) |
| get pointer to element at index More... | |
| #define | dArraySet(a, index, v) |
| set at index and resize dArray when index is greater then maxCount More... | |
| #define | dArraySparseSet(a, index, v) |
| sparse set at index and resize dArray when index is greater then maxCount dArraySparseSet allows using dArray as a sparse array More... | |
| #define | dArrayLast(a) (*((typeof((a)->element)*)((a)->buffers[((a)->last-1)>>dArrayBits])+(((a)->last-1)&dArrayMask))) |
| last element More... | |
| #define | dArrayLastPtr(a) ((typeof((a)->element)*)((a)->buffers[((a)->last-1)>>dArrayBits])+(((a)->last-1)&dArrayMask)) |
| pointer to last element More... | |
| #define | dArrayLastIndex(a) ((a)->last-1) |
| index of last element More... | |
| #define | dArrayLastIndexVar(a) ((a)->last) |
| direct access to the last element index variable for assignments More... | |
| #define | dArrayFirst(a) (*((typeof((a)->element)*)((a)->buffers[((a)->head)>>dArrayBits])+((a)->head)&dArrayMask)) |
| first element More... | |
| #define | dArrayFirstIndex(a) ((a)->head) |
| index of first element More... | |
| #define | dArrayWriteFilename(a, filename) |
| write the dArray content to filename file No NULL checks are done on the parameters More... | |
| #define | dArrayWrite(a, file) |
| write the dArray content to disk No NULL checks are done on the parameters More... | |
| #define | dArrayReadFilename(a, filename) |
| read a dArray from filename file No NULL checks are done on the parameters More... | |
| #define | dArrayRead(a, file) |
| read a dArray from disk No NULL checks are done on the parameters More... | |
| #define | dArrayForEach(name, element) |
| loop on dArray elements element is a pointer to a value in the array More... | |
| #define | dArrayEnumerate(name, index, element) |
| enumerate dArray elements index is the position of the element in the array index is declared as size_t and is available after the loop element is a pointer to a value in the array More... | |
| #define | slabSz 64 |
| slab - dynamic array in one chunk of memory More... | |
| #define | slabT(typeName, elementType) |
| declares type for dynamic array More... | |
| #define | createSlab(typeName, name) ;typeName name; slabInit(&name) |
| #define | createSlabCount(typeName, name, count) ;typeName name; slabInitCount(&name, count) |
| #define | slabInit(a) |
| initialize dynamic array with minimum element count More... | |
| #define | slabInitCount(a, count) |
| initialize slab and count More... | |
| #define | slabResize(a, count) |
| #define | slabFree sliceFree |
| free the internal buffers More... | |
| #define | slabElemType(name) typeof((name)->array[0]) |
| element type in array More... | |
| #define | slabElemPtrType(name) typeof(&(name)->array[0]) |
| element pointer type in array More... | |
| #define | slabEmpty(name) |
| Empty Array. More... | |
| #define | slabIsEmpty(name) ((name)->head == (name)->last) |
| is Array Empty More... | |
| #define | slabCount(name) ((name)->last - (name)->head) |
| return element count More... | |
| #define | slabMaxCount vectorMaxCount |
| return max element count More... | |
| #define | slabAlloc(a) |
| allocate buffer for new elements only when the slab is full More... | |
| #define | slabPush(a) |
| push element and expand the slab no data (random) is set in the new element More... | |
| #define | slabAppend(a, v) |
| append element and expand the slab More... | |
| #define | slabPop(a) ((a)->last--, *((a)->array + (a)->last)) |
| pop element the index of the last element is decreased More... | |
| #define | slabDelLast(a) ((a)->last--) |
| delete the last element useful for avoiding warning: right-hand operand of comma expression has no effect when the poped value is not used More... | |
| #define | slabPrepend(a, v) |
| prepend element More... | |
| #define | slabDequeue(a) ((a)->head++, *((a)->array + (a)->head -1)) |
| dequeue element the index of the head element is increased More... | |
| #define | slabDelFirst(a) ((a)->head++) |
| delete the first element useful for avoiding warning: right-hand operand of comma expression has no effect when the dequeued value is not used More... | |
| #define | slabAt sliceAt |
| get / set element at index More... | |
| #define | slabPtr slicePtr |
| get pointer to element at index More... | |
| #define | slabLast(a) (*((a)->array + (a)->last -1)) |
| last element More... | |
| #define | slabLastPtr(a) ((a)->array + (a)->last -1) |
| pointer to last element More... | |
| #define | slabLastIndex(a) ((a)->last-1) |
| index of last element More... | |
| #define | slabLastIndexVar(a) ((a)->last) |
| direct access to the last element index variable for assignments More... | |
| #define | slabFirst(a) (*((a)->array + (a)->head)) |
| first element More... | |
| #define | slabFirstIndex(a) ((a)->head) |
| index of first element More... | |
| #define | slabWriteFilename(a, filename) |
| write the slab content to filename file No NULL checks are done on the parameters More... | |
| #define | slabWrite(a, file) fwrite((a)->array + (a)->head, 1, sizeof(*((a)->array)) * slabCount(a), file) |
| write the slab content to disk No NULL checks are done on the parameters More... | |
| #define | slabReadFilename(a, filename) |
| read a slab from filename file No NULL checks are done on the parameters More... | |
| #define | slabRead(a, file) |
| read a slab from disk No NULL checks are done on the parameters More... | |
| #define | slabForEach(name, element) |
| loop on slab elements element is a pointer to a value in the array More... | |
| #define | slabEnumerate(name, index, element) |
| enumerate slab elements index is the position of the element in the array index is declared as size_t and is available after the loop element is a pointer to a value in the array More... | |
| #define | staticBitsetT(typeName, containerType, count) typedef struct {containerType map[BUCKETS(count, 8 * sizeof(containerType))];} typeName; |
| static bitset More... | |
| #define | staticBitsetInit staticBitsetClear |
| #define | staticBitsetCount(name) (sizeof((name)->map) * 8) |
| bitset count More... | |
| #define | staticBitsetClear(name) memset(name, 0, sizeof(*(name))); |
| clear all bits in bitset More... | |
| #define | staticBitsetBucket(name, index) (name)->map[index / (8 * sizeof((name)->map[0]))] |
| bucket containing bit at given index More... | |
| #define | staticBitset0(name, index) |
| set 0 at index More... | |
| #define | staticBitset1(name, index) |
| set 1 at index More... | |
| #define | staticBitsetSet(name, index, value) |
| set bit value at index More... | |
| #define | staticBitsetInv(name, index) |
| invert bit at index More... | |
| #define | staticBitsetGet(name, index) |
| get bit at index More... | |
| #define | bitsetModulo 8 |
| end static bitset More... | |
| #define | bitsetBucket(name, index) (name)->map[index / (bitsetModulo)] |
| bucket containing bit at given index More... | |
| #define | bitset0(name, at, index) |
| set 0 at index at must be macro or function taking 2 parameters: at(name, intIndex) and point to value at intIndex More... | |
| #define | bitset1(name, at, index) |
| set 1 at index at must be macro or function taking 2 parameters: at(name, intIndex) and point to value at intIndex More... | |
| #define | bitsetSet(name, at, index, value) |
| set bit value at index at must be macro or function taking 2 parameters: at(name, intIndex) and point to value at intIndex More... | |
| #define | bitsetInv(name, at, index) |
| invert bit at index at must be macro or function taking 2 parameters: at(name, intIndex) and point to value at intIndex More... | |
| #define | bitsetGet(name, at, index) |
| get bit at index at must be macro or function taking 2 parameters: at(name, intIndex) and return the value at intIndex More... | |
| #define | FIELD_SET(dst, val, msb, lsb) dst = (/*clear field in dst*/ (dst) & ((0xFFFFFFFFFFFFFFFEUL << (msb)) | ((1UL<<(lsb))-1) )) | (/*clear highest bits in val and shift to field lsb*/(~(0xFFFFFFFFFFFFFFFEUL << ((msb)-(lsb))) & (val)) << (lsb)) |
| end bitset More... | |
| #define | FIELD_GET EXTRACT |
| #define | FIELD_SETL(dst, index, val, len) FIELD_SET(dst, val, ((index)+1)*(len)-1, (index)*(len)) |
| set bitfield value in destination, given bitfield index and length More... | |
| #define | BITFIELD_SET(array, index, val, len) FIELD_SET((array)[((index)*(len))/64], val, ((index)*(len))%64+(len)-1, ((index)*(len))%64) |
| set bitfield value in array of bitfields the boundaries are not checked More... | |
| #define | BITFIELD_GET(array, index, len) EXTRACT((array)[((index)*(len))/64], ((index)*(len))%64+(len)-1, ((index)*(len))%64) |
| get bitfield value in array of bitfields the boundaries are not checked More... | |
| #define | BITFIELD_SIZE(count, len, containerType) BUCKETS((count)*(len), 8 * sizeof(containerType)) |
| return number of u64 necessary to hold count bitfields of length len More... | |
| #define | BITFIELD_VAR(array, count, len) u64 array[BITFIELD_SIZE(count, len, u64)] |
| declare an array to hold count bitfields of length len More... | |
| #define | nanoSleep(time) pError0(nanoSleepF(time)) |
| sleep nanoseconds More... | |
| #define | nanoSleep(time) pError0(nanoSleepF(time)) |
| sleep nanoseconds More... | |
| #define | nanoSleepE(time, cmd) pErrorCmd(nanoSleepF(time), == 0, cmd) |
| nanoSleep and error code More... | |
| #define | usSleep(time) pError0(nanoSleepF(1000 * (uint64_t)time)) |
| sleep microseconds More... | |
| #define | msSleep(time) pError0(nanoSleepF(1000000 * (uint64_t)time)) |
| sleep miliseconds More... | |
| #define | UNUSED |
| #define | DEPRECATED |
| #define | PACKED |
| #define | CLEANUP |
| #define | FALLTHRU |
| #define | AINLINE |
| #define | NOINLINE |
| #define | PURE |
| #define | CONST |
| #define | NORETURN |
| #define | AMALLOC |
| #define | MUST_CHECK |
| #define | USED |
| #define | ALIGN(X) |
| #define | ALIGN_MAX |
| #define | likely(x) (x) |
| #define | unlikely(x) (x) |
Typedefs | |
| typedef void(* | initLibsheepyObjectP) (void) |
| typedef int | rune |
| typedef int(* | shCmpt) (const void *a, const void *b) |
| typedef void(* | fiberFT) (int) |
| fiber function type More... | |
Functions | |
| void | cleanUpCharFree (char **val) |
| void | cleanUpListFree (char ***val) |
| void | cleanUpFileFree (FILE **val) |
| void | cleanUpFd (int *val) |
| uint64_t | shStopwatch (uint8_t op) |
| nanosecond stopwatch More... | |
| FILE *SH_PREFIX() | setLogFile (char *filename) |
| set log file the logs are appended to all log files set with this function More... | |
| int | getLogSymbols (void) MUST_CHECK |
| get current log symbols More... | |
| void | setLogSymbols (int mode) |
| set log symbols More... | |
| int | getMaxLogLevel (void) MUST_CHECK |
| get current max log level More... | |
| void | setMaxLogLevel (int logLevel) |
| set max log level logs above logMaxLevel are skipped More... | |
| void | closeLogFiles (void) |
| close logfiles opened with setLogFile More... | |
| int | getLogMode (void) MUST_CHECK |
| get current log mode (verbose, concise) More... | |
| void | setLogMode (int mode) |
| set log mode LOG_VERBOSE, LOG_CONCISE, . More... | |
| bool | getLogShortPath (void) MUST_CHECK |
| get current log long/short path value More... | |
| void | setLogShortPath (bool shortPath) |
| set log long/short file path value for VERBOSE mode More... | |
| bool | getLogStdout (void) MUST_CHECK |
| get stdout state, when TRUE (default) all logs are printed to stdout More... | |
| void | setLogStdout (bool state) |
| enable/disable printing logs to stdout More... | |
| bool | openProgLogFile (void) MUST_CHECK |
| log to a file named progName.log Use closeLogFiles when finished logging More... | |
| void | keepAnsiColorsInLog (bool state) |
| enable/disable ansi color codes in logs More... | |
| void | _pLog (int, const char *, const char *, int, const char *,...) |
| void | initLibsheepyF (const char *progPath, initLibsheepyObjectP initF) |
| initialize libsheepy (optional, for debug) More... | |
| void | finalizeLibsheepyCharAtExit (void) |
| finalize libsheepy char at exit More... | |
| int64_t | getStackLimit (void) MUST_CHECK |
| get current stack limit More... | |
| int | setStackLimit (int64_t stackSize) MUST_CHECK |
| set stack limit More... | |
| int | enableCoreDump (void) MUST_CHECK |
| enable core dump More... | |
| const char * | getProgName (void) MUST_CHECK |
| get program name More... | |
| bool | setProgName (const char *name) MUST_CHECK |
| set program name More... | |
| void | setDefaultProgName (void) |
| set default program name More... | |
| void | freeProgName (void) |
| free ProgName if set with setProgName More... | |
| const char * | getProgPath (void) MUST_CHECK |
| get program path When initLibsheepy is called before this function, it returns the given program path. More... | |
| const char * | getRealProgPath (void) MUST_CHECK |
| get real program path The first call allocates libSheepyRealProgPath, it is freed with freeRealProgPath More... | |
| void | freeRealProgPath (void) |
| free real program path finalizeLibsheepy calls this function More... | |
| int | systemNFreeF (char *command, int line, const char *thisFunc, const char *thisFileName) MUST_CHECK |
| run system command and free command buffer a message is printed when an error occurs More... | |
| time_t | getModificationTime (const char *path) MUST_CHECK |
| get modification time for path More... | |
| int | setModificationTime (const char *path, time_t mtime) MUST_CHECK |
| set modification time for path More... | |
| bool | isReadable (const char *path) MUST_CHECK |
| is path readable More... | |
| bool | isWritable (const char *path) MUST_CHECK |
| is path writable More... | |
| bool | isExecutable (const char *path) MUST_CHECK |
| is path executable More... | |
| bool | equalModificationTimes (const char *path1, const char *path2) MUST_CHECK |
| compare modification times for path1 and path2 More... | |
| time_t | getCurrentUnixTime (void) MUST_CHECK |
| get current unix time in seconds More... | |
| time_t | strToUnixTime (const char *date, const char *format) MUST_CHECK |
| convert date string to unix time More... | |
| char * | timeToS (const time_t t) MUST_CHECK |
| time To String convert unix time to string (ctime is not used here because it adds at the end of the string) More... | |
| char * | bTimeToS (char *dst, const time_t t) MUST_CHECK |
| char * | bLTimeToS (char *dst, size_t dstSize, const time_t t) MUST_CHECK |
| char * | timeToYMDS (const time_t t) MUST_CHECK |
| time To Year-Month-Day Hour:Minute:Second String convert unix time to string More... | |
| char * | bTimeToYMDS (char *dst, const time_t t) MUST_CHECK |
| char * | bLTimeToYMDS (char *dst, size_t dstSize, const time_t t) MUST_CHECK |
| char * | getCurrentDate (void) MUST_CHECK |
| get current date in ctime format (Wed Dec 12 11:44:08 2018) More... | |
| char * | bGetCurrentDate (char *dst) MUST_CHECK |
| char * | bLGetCurrentDate (char *dst, size_t dstSize) MUST_CHECK |
| char * | getCurrentDateYMD (void) MUST_CHECK |
| get current date in Y-m-d H:M:S format More... | |
| char * | bGetCurrentDateYMD (char *dst) MUST_CHECK |
| char * | bLGetCurrentDateYMD (char *dst, size_t dstSize) MUST_CHECK |
| char * | shDirname (const char *path) MUST_CHECK |
| sheepy dirname More... | |
| char * | bDirname (char *path) MUST_CHECK |
| buffer dirname More... | |
| char * | bLDirname (char *path, size_t pathSize) MUST_CHECK |
| buffer size dirname More... | |
| char * | expandHome (const char *path) MUST_CHECK |
| expands ~/ ($HOME) or ~USER duplicate and expand path. More... | |
| char * | iExpandHome (char **path) MUST_CHECK |
| expands ~/ ($HOME) or ~USER More... | |
| char * | bExpandHome (char *path) MUST_CHECK |
| buffer expands ~/ ($HOME) or ~USER More... | |
| char * | bLExpandHome (char *path, size_t pathSize) MUST_CHECK |
| buffer size expands ~/ ($HOME) or ~USER More... | |
| char * | normalizePath (const char *path) MUST_CHECK |
| normalize path More... | |
| char * | iNormalizePath (char **path) MUST_CHECK |
| normalize path More... | |
| char * | bNormalizePath (char *path) MUST_CHECK |
| buffer normalize path More... | |
| char * | bLNormalizePath (char *path, size_t pathSize) MUST_CHECK |
| buffer size normalize path More... | |
| char * | relPath (const char *path, const char *start) MUST_CHECK |
| relative path More... | |
| char * | iRelPath (char **path, const char *start) MUST_CHECK |
| relative path More... | |
| char * | bRelPath (char *dest, const char *path, const char *start) MUST_CHECK |
| relative path More... | |
| char * | bLRelPath (char *dest, size_t destSize, char *path, const char *start) MUST_CHECK |
| relative path More... | |
| char * | getHomePath (void) MUST_CHECK |
| get home path More... | |
| char * | bGetHomePath (char *path) MUST_CHECK |
| copy home path to path More... | |
| char * | bLGetHomePath (char *path, size_t pathSize) MUST_CHECK |
| copy home path to path maximum pathSize More... | |
| const char * | getCHomePath (void) MUST_CHECK |
| get home path as a const char* More... | |
| char * | getCwd (void) MUST_CHECK |
| get current working directory More... | |
| char * | bLGetCwd (char *path, size_t pathSize) MUST_CHECK |
| int | chDir (const char *path) MUST_CHECK |
| change directory More... | |
| bool | isDir (const char *path) MUST_CHECK |
| is directory More... | |
| char * | shReadlink (const char *path) MUST_CHECK |
| sheepy read link More... | |
| char * | endlink (const char *path) MUST_CHECK |
| end link More... | |
| bool | isLink (const char *path) MUST_CHECK |
| is symbolic link More... | |
| bool | fileExists (const char *filePath) MUST_CHECK |
| detect files and directories More... | |
| bool | fileChmod (const char *filePath, mode_t mode) MUST_CHECK |
| like chmod in stdlibc but return true/false More... | |
| ssize_t | fileSize (const char *filePath) MUST_CHECK |
| get file size More... | |
| ssize_t | fileSizeFP (FILE *fp) MUST_CHECK |
| get file size from file pointer More... | |
| void * | readFileToS (const char *filePath) MUST_CHECK |
| read file to string More... | |
| void * | bReadFileToS (const char *filePath, void *dst) MUST_CHECK |
| buffer read file to string More... | |
| void * | bLReadFileToS (const char *filePath, void *dst, size_t dstSize) MUST_CHECK |
| buffer size read file to string More... | |
| ssize_t | readFile (const char *filePath, void **buffer) MUST_CHECK |
| read file to buffer More... | |
| ssize_t | bReadFile (const char *filePath, void *buffer) MUST_CHECK |
| buffer read file to buffer More... | |
| ssize_t | bLReadFile (const char *filePath, void *buffer, size_t dstSize) MUST_CHECK |
| buffer size read file to buffer More... | |
| void * | readStreamToS (FILE *fp) MUST_CHECK |
| read file to string More... | |
| void * | bReadStreamToS (FILE *fp, void *dst) MUST_CHECK |
| buffer read file to string More... | |
| void * | bLReadStreamToS (FILE *fp, void *dst, size_t dstSize) MUST_CHECK |
| buffer size read file to string More... | |
| int | writeFileS (const char *filePath, const char *string) MUST_CHECK |
| write string to file More... | |
| int | writeFile (const char *filePath, void *buffer, size_t len) MUST_CHECK |
| write buffer to file More... | |
| int | writeStreamS (FILE *fp, const char *string) MUST_CHECK |
| write string to file More... | |
| int | writeLStream (FILE *fp, void *buffer, size_t len) MUST_CHECK |
| write buffer to file More... | |
| bool | appendFileS (const char *filePath, const char *string) MUST_CHECK |
| append string to filePath More... | |
| bool | appendFile (const char *filePath, void *buffer, size_t len) MUST_CHECK |
| append buffer to file More... | |
| char ** | walkDir (const char *dirPath) MUST_CHECK |
| list all files in a directory recursively and sort the list More... | |
| char ** | walkDirDir (const char *dirPath) MUST_CHECK |
| list all directories in a directory recursively and sort the list More... | |
| char ** | readDir (const char *dirPath) MUST_CHECK |
| list files in a directory and sort the list More... | |
| char ** | readDirDir (const char *dirPath) MUST_CHECK |
| list directories in a directory and sort the list More... | |
| char ** | walkDirAll (const char *dirPath) MUST_CHECK |
| list all files and directories in a directory recursively and sort the list More... | |
| char ** | readDirAll (const char *dirPath) MUST_CHECK |
| list files in a directory and sort the list More... | |
| mode_t | getUmask (void) MUST_CHECK |
| get umask More... | |
| mode_t | getCurrentPermissions (void) MUST_CHECK |
| get current permissions for creating directories More... | |
| int | mkdirParents (const char *path) MUST_CHECK |
| recursive mkdir More... | |
| int | rmAll (const char *path) MUST_CHECK |
| remove all delete recursively files and directories More... | |
| int | copy (const char *src, const char *dst) MUST_CHECK |
| copy files recursively This function is equivalent to 'cp -Ra' without wildcards and circular link detection More... | |
| int | shRename (const char *src, const char *dst) MUST_CHECK |
| rename file More... | |
| int | shMove (const char *src, const char *dst) MUST_CHECK |
| move files recursively More... | |
| void | setSoftwareRandom (void) |
| use software random numbers works on all cpu architectures the default random function is software More... | |
| void | setHardwareRandom (void) |
| use cpu hardware random number generator More... | |
| int | randomUrandomOpen (void) MUST_CHECK |
| open /dev/urandom in libsheepy More... | |
| void | randomUrandomClose (void) |
| close /dev/urandom in libsheepy call this function when random are not needed anymore More... | |
| uint64_t | randomWord (void) MUST_CHECK |
| return random 64 bit unsigned integer call randomUrandomOpen before this calling function More... | |
| uint64_t | randomWordFromHW (void) MUST_CHECK |
| return random 64 bit unsigned integer from the cpu when the cpu doesn't have the random generator instruction, the program stops with 'Illegal instruction' More... | |
| uint64_t | randomChoice (uint64_t range) MUST_CHECK |
| return a random value between 0 and range 0<=value<range call randomUrandomOpen before this calling function More... | |
| char * | randomS (uint64_t length) MUST_CHECK |
| random string More... | |
| char * | bRandomS (char *dst, size_t length) MUST_CHECK |
| buffer random string More... | |
| char * | randomAlphaNumS (uint64_t length) MUST_CHECK |
| random alpha numerical string More... | |
| char * | bRandomAlphaNumS (char *dst, size_t dstSize) MUST_CHECK |
| buffer random alpha numerical string More... | |
| char * | readS (void) MUST_CHECK |
| read String read user input (one line) as a string More... | |
| char * | bLReadS (char *dst, size_t dstSize) MUST_CHECK |
| buffer read String read user input (one line) as a string More... | |
| char * | readPasswordS (void) MUST_CHECK |
| read hidden password string More... | |
| bool | zeroS (char *string) MUST_CHECK |
| write zero to all bytes in string with memset, for clearing password buffers More... | |
| bool | zeroBuf (void *buf, size_t len) MUST_CHECK |
| write zero to all bytes in buffer with memset More... | |
| void * | memdup (const void *buf, size_t size) MUST_CHECK |
| memory duplicate allocate and copy buffer More... | |
| void | readEnter (void) |
| read Enter key wait until press the enter key More... | |
| char * | readLine (FILE *fp) MUST_CHECK |
| readLine from file stream the fist new line is converted to 0 More... | |
| void | freeManySF (char *paramType,...) |
| free Many String More... | |
| char * | dupS (const char *string) MUST_CHECK |
| duplicate string More... | |
| void | shPrintfS (const char *fmt,...) |
| sheepy Print String More... | |
| void | shEPrintfS (const char *fmt,...) |
| sheepy Error printf String print with logE More... | |
| void | logNFree (char *s) |
| log and free More... | |
| void | loghex (const void *buf, size_t len) |
| print buffer as hexadecimal string More... | |
| char * | toHexS (const void *buf, size_t len) MUST_CHECK |
| create a string with bytes in buf converted to hex strings More... | |
| char * | toHexSepS (const void *buf, size_t len, const char *separator) MUST_CHECK |
| create a string with bytes in buf converted to hex strings separated by separator More... | |
| char * | toHexHeadSepS (const void *buf, size_t len, const char *head, const char *separator) MUST_CHECK |
| create a string with bytes in buf converted to hex strings separated by separator and with head string in front of earch byte: HEADffSEP More... | |
| char * | strCpy (char *restrict dst, const char *restrict src) MUST_CHECK |
| strCpy - copy src to dst More... | |
| char * | strNCpy (char *restrict dst, const char *restrict src, size_t srcSize) MUST_CHECK |
| strNCpy - copy src to dst More... | |
| char * | strLCpy (char *restrict dst, size_t dstSize, const char *restrict src) MUST_CHECK |
| strLCpy - copy src to dst More... | |
| char * | strCat (char *restrict dst, const char *restrict src) MUST_CHECK |
| strCat - concatenate two strings More... | |
| char * | strNCat (char *restrict dst, const char *restrict src, size_t srcLen) MUST_CHECK |
| strNCat - concatenate two strings More... | |
| char * | strLCat (char *restrict dst, size_t dstSize, const char *restrict src) MUST_CHECK |
| strLCat - concatenate two strings More... | |
| char * | strLNCat (char *restrict dst, size_t dstSize, const char *restrict src, size_t srcLen) MUST_CHECK |
| strLNCat - concatenate two strings More... | |
| char * | catSF (const char *paramType,...) MUST_CHECK |
| cat String Function More... | |
| char * | iCatSF (char *dst, const char *paramType,...) MUST_CHECK |
| cat and copy String Function dst has to be big enough to hold the result More... | |
| char * | bLCatSF (char *dst, size_t dstSize, const char *paramType,...) MUST_CHECK |
| cat and copy String Function More... | |
| char * | formatS (const char *fmt,...) MUST_CHECK |
| format string allocate and format string using asprintf More... | |
| char * | bFormatS (char *string, const char *fmt,...) MUST_CHECK |
| format and store in string: bFormatS(string, "Value %d", i); More... | |
| char * | bLFormatS (char *string, size_t stringSize, const char *fmt,...) MUST_CHECK |
| format and store in string: bLFormatS(string, sizeof(string), "Value %d", i); More... | |
| char * | appendS (const char *string1, const char *string2) MUST_CHECK |
| append strings More... | |
| char * | appendCharS (const char *string1, char c) MUST_CHECK |
| append char to string when c is 0 the result is string1 More... | |
| char * | appendSChar (char c, const char *string2) MUST_CHECK |
| append string to char More... | |
| char * | iAppendS (char **string1, const char *string2) MUST_CHECK |
| append strings More... | |
| char * | iAppendCharS (char **string1, char c) MUST_CHECK |
| append char to string More... | |
| char * | iAppendNFreeS (char **string1, char *string2) MUST_CHECK |
| append and free strings More... | |
| char * | iAppendManySF (char **string, const char *paramType,...) MUST_CHECK |
| append many strings More... | |
| char * | bAppendManySF (char *string, const char *paramType,...) MUST_CHECK |
| buffer append many strings More... | |
| char * | bLAppendManySF (char *string, size_t stringSize, const char *paramType,...) MUST_CHECK |
| buffer size append many strings More... | |
| char * | prependS (const char *string1, const char *string2) MUST_CHECK |
| prepend strings More... | |
| char * | prependCharS (const char *string1, char c) MUST_CHECK |
| prepend char to string More... | |
| char * | prependSChar (char c, const char *string2) MUST_CHECK |
| prepend string to char More... | |
| char * | iPrependS (char **string1, const char *string2) MUST_CHECK |
| prepend strings More... | |
| char * | iPrependCharS (char **string1, char c) MUST_CHECK |
| prepend char to string More... | |
| char * | iPrependNFreeS (char **string1, char *string2) MUST_CHECK |
| prepend and free strings More... | |
| char * | bPrependS (char *string1, const char *string2) MUST_CHECK |
| buffer prepend strings More... | |
| char * | bLPrependS (char *string1, size_t string1Size, const char *string2) MUST_CHECK |
| buffer prepend strings More... | |
| char * | replaceS (const char *s, const char *olds, const char *news, size_t max) MUST_CHECK |
| replace String the original remains unchanged duplicate s the olds string is replaced with the news string max times in the result 0 for max means replace all olds strings More... | |
| char * | replaceCharSS (const char *s, char olds, const char *news, size_t max) MUST_CHECK |
| char * | replaceSCharS (const char *s, const char *olds, char news, size_t max) MUST_CHECK |
| char * | replaceCharCharS (const char *s, char olds, char news, size_t max) MUST_CHECK |
| size_t | replaceSLen (const char *s, const char *olds, const char *news, size_t max) MUST_CHECK |
| replaceSLen returns the length of the resulting string More... | |
| char * | iReplaceS (char **s, const char *olds, const char *news, size_t max) MUST_CHECK |
| replace String the olds string is replaced with the news string max times in the result 0 for max means replace all olds strings More... | |
| char * | iReplaceCharSS (char **s, char olds, const char *news, size_t max) MUST_CHECK |
| char * | iReplaceSCharS (char **s, const char *olds, char news, size_t max) MUST_CHECK |
| char * | iReplaceCharCharS (char **s, char olds, char news, size_t max) MUST_CHECK |
| char * | bReplaceS (char *s, const char *olds, const char *news, size_t max) MUST_CHECK |
| buffer replace String the olds string is replaced with the news string max times in the result 0 for max means replace all olds strings More... | |
| char * | bLReplaceS (char *s, size_t sSize, const char *olds, const char *news, size_t max) MUST_CHECK |
| buffer size replace String the olds string is replaced with the news string max times in the result 0 for max means replace all olds strings More... | |
| char * | replaceManySF (const char *paramType,...) MUST_CHECK |
| replace Many Strings the original remains unchanged duplicate s the olds string is replaced with the news string max times in the result More... | |
| char * | iReplaceManySF (char **string, char *paramType,...) MUST_CHECK |
| replace Many Strings the olds string is replaced with the news string max times in the result More... | |
| char * | bReplaceManySF (char *s, char *paramType,...) MUST_CHECK |
| buffer replace Many Strings the olds string is replaced with the news string max times in the result More... | |
| char * | bLReplaceManySF (char *s, size_t sSize, char *paramType,...) MUST_CHECK |
| buffer size replace Many Strings the olds string is replaced with the news string max times in the result More... | |
| char * | icReplaceS (const char *s, const char *olds, const char *news, size_t max) MUST_CHECK |
| ignore case Replace String the original remains unchanged duplicate s the olds string is replaced with the news string max times in the result 0 for max means replace all olds strings More... | |
| char * | icReplaceCharSS (const char *s, char olds, const char *news, size_t max) MUST_CHECK |
| char * | icReplaceSCharS (const char *s, const char *olds, char news, size_t max) MUST_CHECK |
| char * | icReplaceCharCharS (const char *s, char olds, char news, size_t max) MUST_CHECK |
| char * | iicReplaceS (char **s, const char *olds, const char *news, size_t max) MUST_CHECK |
| in place ignore case replace String the olds string is replaced with the news string max times in the result 0 for max means replace all olds strings More... | |
| char * | iicReplaceCharSS (char **s, char olds, const char *news, size_t max) MUST_CHECK |
| char * | iicReplaceSCharS (char **s, const char *olds, char news, size_t max) MUST_CHECK |
| char * | iicReplaceCharCharS (char **s, char olds, char news, size_t max) MUST_CHECK |
| char * | bicReplaceS (char *s, const char *olds, const char *news, size_t max) MUST_CHECK |
| buffer ignore case replace String the olds string is replaced with the news string max times in the result 0 for max means replace all olds strings More... | |
| char * | bLicReplaceS (char *s, size_t sSize, const char *olds, const char *news, size_t max) MUST_CHECK |
| buffer size ignore case replace String the olds string is replaced with the news string max times in the result 0 for max means replace all olds strings More... | |
| char * | icReplaceManySF (const char *paramType,...) MUST_CHECK |
| ignore case replace Many Strings the original remains unchanged duplicate s the olds string is replaced with the news string max times in the result More... | |
| char * | iicReplaceManySF (char **string, char *paramType,...) MUST_CHECK |
| in place ignore case replace Many Strings the olds string is replaced with the news string max times in the result More... | |
| char * | bicReplaceManySF (char *s, char *paramType,...) MUST_CHECK |
| buffer ignore case replace Many Strings the olds string is replaced with the news string max times in the result More... | |
| char * | bLicReplaceManySF (char *s, size_t sSize, char *paramType,...) MUST_CHECK |
| buffer size ignore case replace Many Strings the olds string is replaced with the news string max times in the result More... | |
| bool | eqS (const char *string1, const char *string2) MUST_CHECK |
| string Equal compare string1 to string2 More... | |
| bool | eqCharS (char c, const char *string2) MUST_CHECK |
| bool | eqSChar (const char *string1, char c) MUST_CHECK |
| bool | eqIS (const char *string1, const char *string2, int64_t index) MUST_CHECK |
| string Index Equal compare string1 at index to string2 when string2 is empty, the result is false More... | |
| bool | eqICharS (const char *string1, char c, int64_t index) MUST_CHECK |
| bool | startsWithS (const char *string1, const char *string2) MUST_CHECK |
| starts With String compare start of string1 with string2 More... | |
| bool | startsWithCharS (const char *string1, char c) MUST_CHECK |
| bool | endsWithS (const char *string1, const char *string2) MUST_CHECK |
| ends With String compare end of string1 with string2 More... | |
| bool | endsWithCharS (const char *string1, char c) MUST_CHECK |
| ssize_t | countS (const char *s, const char *needle) MUST_CHECK |
| count String count number of (non-overlapping) occurrences of a substring More... | |
| ssize_t | countCharS (const char *s, char c) MUST_CHECK |
| bool | icEqS (const char *string1, const char *string2) MUST_CHECK |
| ignore case string Equal compare string1 to string2 More... | |
| bool | icEqCharS (char c, const char *string2) MUST_CHECK |
| bool | icEqSChar (const char *string1, char c) MUST_CHECK |
| bool | icEqIS (const char *string1, const char *string2, int64_t index) MUST_CHECK |
| ignore case string Index Equal compare string1 at index to string2 when string2 is empty, the result is false More... | |
| bool | icEqICharS (const char *string1, char c, int64_t index) MUST_CHECK |
| bool | icStartsWithS (const char *string1, const char *string2) MUST_CHECK |
| ignore case starts With String compare start of string1 with string2 More... | |
| bool | icStartsWithCharS (const char *string1, char c) MUST_CHECK |
| bool | icEndsWithS (const char *string1, const char *string2) MUST_CHECK |
| ignore case ends With String compare end of string1 with string2 More... | |
| bool | icEndsWithCharS (const char *string1, char c) MUST_CHECK |
| ssize_t | icCountS (const char *s, const char *needle) MUST_CHECK |
| ignore case count String count number of (non-overlapping) occurrences of a substring More... | |
| ssize_t | icCountCharS (const char *s, char c) MUST_CHECK |
| bool | hasCtrlChar (const char *string) MUST_CHECK |
| has control char More... | |
| char * | stripCtrlS (const char *string) MUST_CHECK |
| remove terminal control char from string More... | |
| char * | iStripCtrlS (char **string) MUST_CHECK |
| remove terminal control char from string More... | |
| char * | bStripCtrlS (char *string) MUST_CHECK |
| remove terminal control char from string More... | |
| char * | stripColorsS (const char *string) MUST_CHECK |
| remove ansi colors from string More... | |
| char * | iStripColorsS (char **string) MUST_CHECK |
| remove ansi colors from string More... | |
| char * | bStripColorsS (char *string) MUST_CHECK |
| remove terminal control char from string More... | |
| char * | quoteS (const char *s, char delim) MUST_CHECK |
| add backslash '\' before delim('\'' or '"') and backslash the backslashes in the result avoid splitting the string when it is in a source file or a json string More... | |
| char * | bQuoteS (char *dest, const char *s, char delim) MUST_CHECK |
| add backslash '\' before delim('\'' or '"') and backslash the backslashes in the result avoid splitting the string when it is in a source file or a json string More... | |
| char * | bLQuoteS (char *dest, size_t destSize, const char *s, char delim) MUST_CHECK |
| add backslash '\' before delim('\'' or '"') and backslash the backslashes in the result avoid splitting the string when it is in a source file or a json string More... | |
| size_t | quoteLenS (const char *s, char delim) MUST_CHECK |
| return the length of the escaped string (without the terminating \0) More... | |
| char * | escapeS (const char *s, char delim) MUST_CHECK |
| escape string according the json specification (RFC 8259) if there is in the string, the backslash is escaped and it will be parsed as the string '' be the json parsers the unicode characters should be converted to UTF8 codepoints instead of using the result can be included in a json string and the parsing will be correct More... | |
| char * | bEscapeS (char *dest, const char *s, char delim) MUST_CHECK |
| escape string according the json specification (RFC 8259) if there is in the string, the backslash is escaped and it will be parsed as the string '' be the json parsers the unicode characters should be converted to UTF8 codepoints instead of using the result can be included in a json string and the parsing will be correct More... | |
| char * | bLEscapeS (char *dest, size_t destSize, const char *s, char delim) MUST_CHECK |
| escape string according the json specification (RFC 8259) if there is in the string, the backslash is escaped and it will be parsed as the string '' be the json parsers the unicode characters should be converted to UTF8 codepoints instead of using the result can be included in a json string and the parsing will be correct More... | |
| size_t | escapeLenS (const char *s, char delim) MUST_CHECK |
| return the length of the escaped string (without the terminating \0) More... | |
| char | nibbleToHex (u8 n) MUST_CHECK |
| convert number between 0 and 15 to hexadecimal character '0' to 'F' More... | |
| char * | cEscapeS (const char *S) MUST_CHECK |
| escape string to become a valid C source string control characters, backslash and double quotes are escaped. More... | |
| char * | bCEscapeS (char *dest, const char *S) MUST_CHECK |
| escape string to become a valid C source string control characters, backslash and double quotes are escaped. More... | |
| char * | bLCEscapeS (char *dest, size_t destSize, const char *S) MUST_CHECK |
| escape string to become a valid C source string control characters, backslash and double quotes are escaped. More... | |
| size_t | cEscapeLenS (const char *s) MUST_CHECK |
| return the length of the escaped string (without the terminating \0) More... | |
| bool | isNumber (const char *string) MUST_CHECK |
| is Number (integer or float) String More... | |
| bool | isInt (const char *string) MUST_CHECK |
| is Integer String More... | |
| int64_t | parseInt (const char *string) MUST_CHECK |
| convert string to decimal integer More... | |
| int64_t | parseIntChar (char c) MUST_CHECK |
| int64_t | parseI64 (const char *string) MUST_CHECK |
| convert string to decimal integer More... | |
| int64_t | parseI64Char (char c) MUST_CHECK |
| double | parseDouble (const char *string) MUST_CHECK |
| convert string to double More... | |
| double | parseDoubleChar (char c) MUST_CHECK |
| uint64_t | parseHex (const char *string) MUST_CHECK |
| parse hexadecimal number in a string More... | |
| char * | intToS (int64_t n) MUST_CHECK |
| int To String More... | |
| char * | bIntToS (char *s, int64_t n) MUST_CHECK |
| buffer int To String More... | |
| char * | doubleToS (double n) MUST_CHECK |
| double To String More... | |
| char * | bDoubleToS (char *s, double n) MUST_CHECK |
| buffer double To String More... | |
| size_t | lenS (const char *string) MUST_CHECK |
| length string More... | |
| size_t | sizeS (const char *string) MUST_CHECK |
| string buffer size More... | |
| char * | upperS (const char *string) MUST_CHECK |
| upper case String duplicate string More... | |
| char * | iUpperS (char **string) MUST_CHECK |
| upper case String More... | |
| char * | bUpperS (char *string) MUST_CHECK |
| buffer upper case String More... | |
| char * | lowerS (const char *string) MUST_CHECK |
| lower case String duplicate string More... | |
| char * | iLowerS (char **string) MUST_CHECK |
| lower case String More... | |
| char * | bLowerS (char *string) MUST_CHECK |
| buffer lower case String More... | |
| char * | trimS (const char *string) MUST_CHECK |
| trim String duplicate string More... | |
| char * | iTrimS (char **string) MUST_CHECK |
| trim String More... | |
| char * | bTrimS (char *string) MUST_CHECK |
| buffer trim String More... | |
| char * | lTrimS (const char *string) MUST_CHECK |
| left trim String duplicate string More... | |
| char * | iLTrimS (char **string) MUST_CHECK |
| left trim String More... | |
| char * | bLTrimS (char *string) MUST_CHECK |
| buffer left trim String More... | |
| char * | rTrimS (const char *string) MUST_CHECK |
| right trim String duplicate string More... | |
| char * | iRTrimS (char **string) MUST_CHECK |
| right trim String More... | |
| char * | bRTrimS (char *string) MUST_CHECK |
| buffer right trim String More... | |
| char * | uniqS (const char *string, char c) MUST_CHECK |
| uniq String duplicate string More... | |
| char * | iUniqS (char **string, char c) MUST_CHECK |
| uniq String More... | |
| char * | bUniqS (char *string, char c) MUST_CHECK |
| buffer uniq String More... | |
| char * | icUniqS (const char *string, char c) MUST_CHECK |
| ignore case uniq String duplicate string More... | |
| char * | iicUniqS (char **string, char c) MUST_CHECK |
| in place ignore case uniq String More... | |
| char * | bicUniqS (char *string, char c) MUST_CHECK |
| ignore case buffer uniq String More... | |
| char * | repeatS (const char *string, size_t count) MUST_CHECK |
| repeat string count times More... | |
| char * | iRepeatS (char **string, size_t count) MUST_CHECK |
| repeat string count times More... | |
| char * | bRepeatS (char *dest, const char *string, size_t count) MUST_CHECK |
| repeat string count times More... | |
| char * | bLRepeatS (char *dest, size_t destSize, const char *string, size_t count) MUST_CHECK |
| repeat string count times More... | |
| char * | repeatCharS (char c, size_t count) MUST_CHECK |
| repeat char count times More... | |
| char * | bRepeatCharS (char *dest, char c, size_t count) MUST_CHECK |
| repeat char count times More... | |
| char * | bLRepeatCharS (char *dest, size_t destSize, char c, size_t count) MUST_CHECK |
| repeat char count times More... | |
| ssize_t | repeatLenS (const char *string, size_t count) MUST_CHECK |
| length of string repeated count times More... | |
| char * | ellipsisStartS (const char *string, size_t targetLength, const char *ellipsisString) MUST_CHECK |
| ellipsis start string More... | |
| char * | iEllipsisStartS (char **string, size_t targetLength, const char *ellipsisString) MUST_CHECK |
| ellipsis start string More... | |
| char * | bEllipsisStartS (char *dest, const char *string, size_t targetLength, const char *ellipsisString) MUST_CHECK |
| ellipsis start string More... | |
| char * | bLEllipsisStartS (char *dest, size_t destSize, const char *string, size_t targetLength, const char *ellipsisString) MUST_CHECK |
| ellipsis start string More... | |
| char * | ellipsisStartCharS (const char *string, size_t targetLength, char ellipsisChar) MUST_CHECK |
| ellipsis start string More... | |
| char * | iEllipsisStartCharS (char **string, size_t targetLength, char ellipsisChar) MUST_CHECK |
| ellipsis start string More... | |
| char * | bEllipsisStartCharS (char *dest, const char *string, size_t targetLength, char ellipsisChar) MUST_CHECK |
| ellipsis start string More... | |
| char * | bLEllipsisStartCharS (char *dest, size_t destSize, const char *string, size_t targetLength, char ellipsisChar) MUST_CHECK |
| ellipsis start string More... | |
| ssize_t | ellipsisLenS (const char *string, size_t targetLength, const char *ellipsisString) MUST_CHECK |
| length of string after ellipsis More... | |
| char * | ellipsisEndS (const char *string, size_t targetLength, const char *ellipsisString) MUST_CHECK |
| ellipsis end string More... | |
| char * | iEllipsisEndS (char **string, size_t targetLength, const char *ellipsisString) MUST_CHECK |
| ellipsis end string More... | |
| char * | bEllipsisEndS (char *dest, const char *string, size_t targetLength, const char *ellipsisString) MUST_CHECK |
| ellipsis end string More... | |
| char * | bLEllipsisEndS (char *dest, size_t destSize, const char *string, size_t targetLength, const char *ellipsisString) MUST_CHECK |
| ellipsis end string More... | |
| char * | ellipsisEndCharS (const char *string, size_t targetLength, char ellipsisChar) MUST_CHECK |
| ellipsis end string More... | |
| char * | iEllipsisEndCharS (char **string, size_t targetLength, char ellipsisChar) MUST_CHECK |
| ellipsis end string More... | |
| char * | bEllipsisEndCharS (char *dest, const char *string, size_t targetLength, char ellipsisChar) MUST_CHECK |
| ellipsis end string More... | |
| char * | bLEllipsisEndCharS (char *dest, size_t destSize, const char *string, size_t targetLength, char ellipsisChar) MUST_CHECK |
| ellipsis end string More... | |
| char * | padStartS (const char *string, size_t targetLength, const char *padString) MUST_CHECK |
| pad start string More... | |
| char * | iPadStartS (char **string, size_t targetLength, const char *padString) MUST_CHECK |
| pad start string More... | |
| char * | bPadStartS (char *dest, const char *string, size_t targetLength, const char *padString) MUST_CHECK |
| pad start string More... | |
| char * | bLPadStartS (char *dest, size_t destSize, const char *string, size_t targetLength, const char *padString) MUST_CHECK |
| pad start string More... | |
| char * | padStartCharS (const char *string, size_t targetLength, char padChar) MUST_CHECK |
| pad start string More... | |
| char * | iPadStartCharS (char **string, size_t targetLength, char padChar) MUST_CHECK |
| pad start string More... | |
| char * | bPadStartCharS (char *dest, const char *string, size_t targetLength, char padChar) MUST_CHECK |
| pad start string More... | |
| char * | bLPadStartCharS (char *dest, size_t destSize, const char *string, size_t targetLength, char padChar) MUST_CHECK |
| pad start string More... | |
| ssize_t | padStartLenS (const char *string, size_t targetLength, const char *padString) MUST_CHECK |
| length of string after padStart More... | |
| char * | padEndS (const char *string, size_t targetLength, const char *padString) MUST_CHECK |
| pad end string More... | |
| char * | iPadEndS (char **string, size_t targetLength, const char *padString) MUST_CHECK |
| pad end string More... | |
| char * | bPadEndS (char *dest, const char *string, size_t targetLength, const char *padString) MUST_CHECK |
| pad end string More... | |
| char * | bLPadEndS (char *dest, size_t destSize, const char *string, size_t targetLength, const char *padString) MUST_CHECK |
| pad end string More... | |
| char * | padEndCharS (const char *string, size_t targetLength, char padChar) MUST_CHECK |
| pad end string More... | |
| char * | iPadEndCharS (char **string, size_t targetLength, char padChar) MUST_CHECK |
| pad end string More... | |
| char * | bPadEndCharS (char *dest, const char *string, size_t targetLength, char padChar) MUST_CHECK |
| pad end string More... | |
| char * | bLPadEndCharS (char *dest, size_t destSize, const char *string, size_t targetLength, char padChar) MUST_CHECK |
| pad end string More... | |
| ssize_t | padEndLenS (const char *string, size_t targetLength, const char *padString) MUST_CHECK |
| length of string after padEnd More... | |
| char | getS (const char *string, int64_t index) MUST_CHECK |
| get string More... | |
| char * | setS (char *string, int64_t index, char c) MUST_CHECK |
| set string More... | |
| char * | swapS (char *string, int64_t index1, int64_t index2) MUST_CHECK |
| swap characters in string More... | |
| char * | iSwapS (char **string, int64_t index1, int64_t index2) MUST_CHECK |
| swap characters in string More... | |
| char * | bSwapS (char *string, int64_t index1, int64_t index2) MUST_CHECK |
| swap characters in string More... | |
| char * | bLSwapS (char *string, size_t size, int64_t index1, int64_t index2) MUST_CHECK |
| swap characters in string More... | |
| char * | sliceS (const char *string, int64_t start, int64_t end) MUST_CHECK |
| slice String return new string which is the string between start and end negative indexes are allowed More... | |
| char * | iSliceS (char **string, int64_t start, int64_t end) MUST_CHECK |
| slice String return string which is the string between start and end negative indexes are allowed More... | |
| char * | bSliceS (char *string, int64_t start, int64_t end) MUST_CHECK |
| buffer slice String return string which is the string between start and end negative indexes are allowed More... | |
| char * | bLSliceS (char *string, size_t stringSize, int64_t start, int64_t end) MUST_CHECK |
| buffer size slice String return string which is the string between start and end negative indexes are allowed More... | |
| char * | cropS (char *string, int64_t start, int64_t end) MUST_CHECK |
| Crop String return a new string with characters from start and end in string and delete characters from start to end in the original string negative indexes are allowed. More... | |
| char * | iCropS (char **string, int64_t start, int64_t end) MUST_CHECK |
| Crop String return a new string with characters from start and end in string and delete characters from start to end in the original string negative indexes are allowed. More... | |
| char | cropElemS (char *string, int64_t index) MUST_CHECK |
| char | iCropElemS (char **string, int64_t index) MUST_CHECK |
| char * | insertS (const char *string, int64_t index, const char *toInsert) MUST_CHECK |
| insert string in string at index More... | |
| char * | insertNFreeS (const char *string, int64_t index, char *toInsert) MUST_CHECK |
| insert string in string at index and free toInsert when successful More... | |
| char * | iInsertS (char **string, int64_t index, const char *toInsert) MUST_CHECK |
| insert string in string at index More... | |
| char * | iInsertNFreeS (char **string, int64_t index, char *toInsert) MUST_CHECK |
| insert string in string at index and free toInsert More... | |
| char * | bInsertS (char *string, int64_t index, const char *toInsert) MUST_CHECK |
| buffer insert string in string at index More... | |
| char * | bLInsertS (char *string, size_t stringSize, int64_t index, const char *toInsert) MUST_CHECK |
| buffer size insert string in string at index More... | |
| char * | injectS (const char *string, int64_t index, char toInject) MUST_CHECK |
| inject a char in string at index More... | |
| char * | iInjectS (char **string, int64_t index, char toInject) MUST_CHECK |
| inject a char in string at index More... | |
| char * | bInjectS (char *string, int64_t index, char toInject) MUST_CHECK |
| buffer inject a char in string at index More... | |
| char * | bLInjectS (char *string, size_t stringSize, int64_t index, char toInject) MUST_CHECK |
| buffer size inject a char in string at index More... | |
| char * | delS (const char *string, int64_t start, int64_t end) MUST_CHECK |
| delete string More... | |
| char * | iDelS (char **string, int64_t start, int64_t end) MUST_CHECK |
| delete string More... | |
| char * | bDelS (char *string, int64_t start, int64_t end) MUST_CHECK |
| buffer delete string More... | |
| char * | bLDelS (char *string, size_t stringSize, int64_t start, int64_t end) MUST_CHECK |
| buffer size delete string More... | |
| char * | delElemS (const char *string, int64_t index) MUST_CHECK |
| delete element/character string More... | |
| char * | iDelElemS (char **string, int64_t index) MUST_CHECK |
| delete element/character string More... | |
| char * | bDelElemS (char *string, int64_t index) MUST_CHECK |
| buffer delete element/character string More... | |
| char * | bLDelElemS (char *string, size_t stringSize, int64_t index) MUST_CHECK |
| buffer size delete element/character string More... | |
| char * | findS (const char *string, const char *needle) MUST_CHECK |
| find String More... | |
| char * | findCharS (const char *string, char c) MUST_CHECK |
| ssize_t | indexOfS (const char *string, const char *needle) MUST_CHECK |
| indexOf String relative to start More... | |
| ssize_t | indexOfCharS (const char *string, char c) MUST_CHECK |
| bool | hasS (const char *string, const char *needle) MUST_CHECK |
| has String More... | |
| bool | hasCharS (const char *string, char c) MUST_CHECK |
| char * | icFindS (const char *string, const char *needle) MUST_CHECK |
| ignore case Find String More... | |
| char * | icFindCharS (const char *string, char c) MUST_CHECK |
| ssize_t | icIndexOfS (const char *string, const char *needle) MUST_CHECK |
| ignore case indexOf String relative to start More... | |
| ssize_t | icIndexOfCharS (const char *string, char c) MUST_CHECK |
| bool | icHasS (const char *string, const char *needle) MUST_CHECK |
| ignore case has String More... | |
| bool | icHasCharS (const char *string, char c) MUST_CHECK |
| char * | tokS (char *s, const char *delim, char **saveptr) MUST_CHECK |
| token in String More... | |
| char * | icTokS (char *s, const char *delim, char **saveptr) MUST_CHECK |
| ignore case token in String More... | |
| size_t | lenUTF8 (const char *s) MUST_CHECK |
| character length of UTF-8 string More... | |
| size_t | bLLenUTF8 (const char *s, size_t maxSize) MUST_CHECK |
| buffer character length of UTF-8 string More... | |
| bool | isUTF8 (const char *string) MUST_CHECK |
| is UTF-8 string More... | |
| bool | bLIsUTF8 (const char *string, size_t stringSize) MUST_CHECK |
| buffer length is UTF-8 string More... | |
| bool | isCodeUTF8 (const char *code) MUST_CHECK |
| is code point UTF8 encoded string More... | |
| const char * | nextUTF8 (const char *utf8) MUST_CHECK |
| next UTF-8 code point More... | |
| const char * | bLNextUTF8 (const char *string, size_t utf8Size, const char *utf8) MUST_CHECK |
| buffer length next UTF-8 code point More... | |
| const char * | findNextUTF8 (const char *string, size_t utf8Size, const char *utf8) MUST_CHECK |
| find next UTF-8 code point even not at the start of a code point More... | |
| const char * | prevUTF8 (const char *utf8) MUST_CHECK |
| previous UTF-8 code point More... | |
| const char * | bPrevUTF8 (const char *string, const char *utf8) MUST_CHECK |
| buffer previous UTF-8 code point More... | |
| const char * | idx2PtrUTF8 (const char *utf8, int64_t index) MUST_CHECK |
| index to pointer UTF8 encoded string More... | |
| const char * | bLIdx2PtrUTF8 (const char *utf8, size_t utf8Size, int64_t index) MUST_CHECK |
| int64_t | ptr2IdxUTF8 (const char *utf8, const char *pos) MUST_CHECK |
| pointer to code point index UTF8 encoded string More... | |
| int64_t | bPtr2IdxUTF8 (const char *start, const char *utf8, const char *pos) MUST_CHECK |
| buffer pointer to code point index UTF8 encoded string More... | |
| int64_t | bLPtr2IdxUTF8 (const char *utf8, size_t utf8Size, const char *pos) MUST_CHECK |
| buffer size pointer to code point index UTF8 encoded string More... | |
| int64_t | bLPtr2NegIdxUTF8 (const char *utf8, size_t utf8Size, const char *pos) MUST_CHECK |
| buffer size pointer to negative code point index UTF8 encoded string More... | |
| char * | makeValidUTF8 (const char *utf8) MUST_CHECK |
| make valid UTF-8 encoded string More... | |
| char * | bMakeValidUTF8 (char *utf8) MUST_CHECK |
| buffer make valid UTF-8 encoded string More... | |
| char * | nMakeValidUTF8 (const char *utf8, size_t utf8Len) MUST_CHECK |
| length make valid UTF-8 encoded string More... | |
| char * | bNMakeValidUTF8 (char *dst, const char *utf8, size_t utf8Len) MUST_CHECK |
| buffer length make valid UTF-8 encoded string More... | |
| char * | bLMakeValidUTF8 (char *dst, size_t dstSize, const char *utf8) MUST_CHECK |
| buffer destination size make valid UTF-8 encoded string More... | |
| char * | bLNMakeValidUTF8 (char *dst, size_t dstSize, const char *utf8, size_t utf8Len) MUST_CHECK |
| buffer destination size source length make valid UTF-8 encoded string More... | |
| char * | strNCpyUTF8 (char *dst, const char *src, size_t srcLen) MUST_CHECK |
| strNCpyUTF8 - copy src to dst with srcLen in code points More... | |
| char * | strLCpyUTF8 (char *dst, size_t dstSize, const char *src) MUST_CHECK |
| strLCpyUTF8 - copy src to dst More... | |
| char * | strNCatUTF8 (char *dst, const char *src, size_t srcLen) MUST_CHECK |
| strNCatUTF8 - concatenate two UTF-8 encoded strings More... | |
| char * | strLCatUTF8 (char *dst, size_t dstSize, const char *src) MUST_CHECK |
| strLCatUTF8 - concatenate two UTF-8 encoded strings More... | |
| char * | strLNCatUTF8 (char *dst, size_t dstSize, const char *src, size_t srcLen) MUST_CHECK |
| strLNCatUTF8 - concatenate two UTF-8 encoded strings More... | |
| char * | icReplaceUTF8 (const char *s, const char *olds, const char *news, size_t max) MUST_CHECK |
| char * | icReplaceCharSUTF8 (const char *s, char olds, const char *news, size_t max) MUST_CHECK |
| char * | icReplaceSCharUTF8 (const char *s, const char *olds, char news, size_t max) MUST_CHECK |
| char * | iicReplaceUTF8 (char **s, const char *olds, const char *news, size_t max) MUST_CHECK |
| char * | iicReplaceCharSUTF8 (char **s, char olds, const char *news, size_t max) MUST_CHECK |
| char * | iicReplaceSCharUTF8 (char **s, const char *olds, char news, size_t max) MUST_CHECK |
| char * | bicReplaceUTF8 (char *s, const char *olds, const char *news, size_t max) MUST_CHECK |
| char * | bLicReplaceUTF8 (char *s, size_t sSize, const char *olds, const char *news, size_t max) MUST_CHECK |
| char * | icReplaceManyUTF8F (const char *paramType,...) MUST_CHECK |
| char * | iicReplaceManyUTF8F (char **s, char *paramType,...) MUST_CHECK |
| char * | bicReplaceManyUTF8F (char *s, char *paramType,...) MUST_CHECK |
| char * | bLicReplaceManyUTF8F (char *s, size_t sSize, char *paramType,...) MUST_CHECK |
| bool | eqIUTF8 (const char *string1, const char *string2, int64_t index) MUST_CHECK |
| UTF8 encoded string Index Equal compare string1 at character index to string2 when string2 is empty, the result is false. More... | |
| bool | eqICharUTF8 (const char *string1, char c, int64_t index) MUST_CHECK |
| bool | icEqUTF8 (const char *string1, const char *string2) MUST_CHECK |
| ignore case UTF8 encoded string Equal compare string1 to string2 More... | |
| bool | icEqCharUTF8 (char c, const char *string2) MUST_CHECK |
| bool | icEqUTF8Char (const char *string1, char c) MUST_CHECK |
| bool | icEqIUTF8 (const char *string1, const char *string2, int64_t index) MUST_CHECK |
| bool | icEqICharUTF8 (const char *string1, char c, int64_t index) MUST_CHECK |
| bool | icStartsWithUTF8 (const char *string1, const char *string2) MUST_CHECK |
| ignore case starts With UTF8 encoded String compare start of string1 with string2 More... | |
| bool | icEndsWithUTF8 (const char *string1, const char *string2) MUST_CHECK |
| ignore case ends With UTF8 encoded String compare end of string1 with string2 More... | |
| ssize_t | icCountUTF8 (const char *s, const char *needle) MUST_CHECK |
| ignore case count UTF8 encoded String count number of (non-overlapping) occurrences of a substring More... | |
| rune | code2RuneUTF8 (const char *code) MUST_CHECK |
| UTF-8 code point to rune. More... | |
| rune | code2RuneLUTF8 (const char *code, uint8_t *n) MUST_CHECK |
| UTF-8 code point to rune and length. More... | |
| size_t | bRune2CodeUTF8 (char *dst, rune c) MUST_CHECK |
| rune to UTF-8 code point More... | |
| uint8_t | runeLenUTF8 (rune r) MUST_CHECK |
| rune length as UTF-8 code point More... | |
| rune | toupperUTF8 (rune c) MUST_CHECK |
| rune toupper UTF8 More... | |
| char * | upperUTF8 (const char *string) MUST_CHECK |
| upper case UTF-8 encoded string duplicate string More... | |
| char * | iUpperUTF8 (char **string) MUST_CHECK |
| upper case UTF-8 encoded string More... | |
| char * | bUpperUTF8 (char *string) MUST_CHECK |
| rune | tolowerUTF8 (rune c) MUST_CHECK |
| rune tolower UTF8 More... | |
| char * | lowerUTF8 (const char *string) MUST_CHECK |
| lower case UTF-8 String duplicate string More... | |
| char * | iLowerUTF8 (char **string) MUST_CHECK |
| lower case String More... | |
| char * | bLowerUTF8 (char *string) MUST_CHECK |
| char * | casefoldUTF8 (const char *utf8) MUST_CHECK |
| casefold UTF-8 encoded string More... | |
| char * | uniqUTF8 (const char *string, const char *code) MUST_CHECK |
| uniq UTF-8 String duplicate string More... | |
| char * | iUniqUTF8 (char **string, const char *code) MUST_CHECK |
| uniq UTF-8 String More... | |
| char * | bUniqUTF8 (char *string, const char *code) MUST_CHECK |
| buffer uniq String More... | |
| char * | icUniqUTF8 (const char *string, const char *code) MUST_CHECK |
| char * | iicUniqUTF8 (char **string, const char *code) MUST_CHECK |
| char * | bicUniqUTF8 (char *string, char c) MUST_CHECK |
| rune | getUTF8 (const char *string, int64_t index) MUST_CHECK |
| get UTF8 encoded string More... | |
| char * | setUTF8 (char *string, int64_t index, rune c) MUST_CHECK |
| set UTF8 encoded string More... | |
| char * | sliceUTF8 (const char *string, int64_t start, int64_t end) MUST_CHECK |
| slice UTF8 encoded String return new string which is the string between start and end negative indexes are allowed More... | |
| char * | iSliceUTF8 (char **string, int64_t start, int64_t end) MUST_CHECK |
| slice UTF8 encoded String return string which is the string between start and end negative indexes are allowed More... | |
| char * | bSliceUTF8 (char *string, int64_t start, int64_t end) MUST_CHECK |
| buffer slice UTF8 encoded String return string which is the string between start and end negative indexes are allowed More... | |
| char * | bLSliceUTF8 (char *string, size_t stringSize, int64_t start, int64_t end) MUST_CHECK |
| buffer size slice UTF8 encoded String return string which is the string between start and end negative indexes are allowed More... | |
| char * | insertUTF8 (const char *string, int64_t index, const char *toInsert) MUST_CHECK |
| insert string in UTF8 encoded string at index More... | |
| char * | insertNFreeUTF8 (const char *string, int64_t index, char *toInsert) MUST_CHECK |
| insert string in UTF8 encoded string at index and free toInsert More... | |
| char * | iInsertUTF8 (char **string, int64_t index, const char *toInsert) MUST_CHECK |
| insert string in UTF8 encoded string at index More... | |
| char * | iInsertNFreeUTF8 (char **string, int64_t index, char *toInsert) MUST_CHECK |
| insert string in UTF8 encoded string at index and free toInsert More... | |
| char * | bInsertUTF8 (char *string, int64_t index, const char *toInsert) MUST_CHECK |
| buffer insert string in UTF8 encoded string at index More... | |
| char * | bLInsertUTF8 (char *string, size_t stringSize, int64_t index, const char *toInsert) MUST_CHECK |
| buffer size insert string in UTF8 encoded string at index More... | |
| char * | delUTF8 (const char *string, int64_t start, int64_t end) MUST_CHECK |
| delete UTF8 encoded string More... | |
| char * | iDelUTF8 (char **string, int64_t start, int64_t end) MUST_CHECK |
| delete UTF8 encoded string More... | |
| char * | bDelUTF8 (char *string, int64_t start, int64_t end) MUST_CHECK |
| buffer delete UTF8 encoded string More... | |
| char * | bLDelUTF8 (char *string, size_t stringSize, int64_t start, int64_t end) MUST_CHECK |
| buffer size delete UTF8 encoded string More... | |
| ssize_t | indexOfUTF8 (const char *string, const char *needle) MUST_CHECK |
| indexOf UTF8 encoded String relative to start More... | |
| ssize_t | icIndexOfUTF8 (const char *string, const char *needle) MUST_CHECK |
| bool | icHasUTF8 (const char *string, const char *needle) MUST_CHECK |
| ignore case has UTF8 encoded String More... | |
| char * | icTokUTF8 (const char *s, const char *delim, char **saveptr) MUST_CHECK |
| char ** | icExtractUTF8 (const char *string, const char *delim1, const char *delim2) MUST_CHECK |
| char ** | icExtractCharSUTF8 (const char *string, char delim1, const char *delim2) MUST_CHECK |
| char ** | icExtractSCharUTF8 (const char *string, const char *delim1, char delim2) MUST_CHECK |
| char ** | icListSortUTF8 (char **list) MUST_CHECK |
| ignore case list Sort UTF8 encoded String duplicate list and sort More... | |
| char ** | iicListSortUTF8 (char ***list) MUST_CHECK |
| ignore case list Sort UTF8 encoded String More... | |
| bool | icListEqUTF8 (char **list1, char **list2) MUST_CHECK |
| ignore case list Equal UTF8 encoded String compare each element of list1 and list2 More... | |
| bool | icListHasUTF8 (char **list, const char *string) MUST_CHECK |
| ignore case and return true when list has UTF8 encoded string More... | |
| ssize_t | icListIndexOfUTF8 (char **list, const char *string) MUST_CHECK |
| ignore case and return index of UTF8 encoded string in list More... | |
| ssize_t | icListBinarySearchUTF8 (char **list, const char *string) MUST_CHECK |
| ignore case list binary search UTF8 encoded string More... | |
| char ** | icListUniqUTF8 (char **list) MUST_CHECK |
| ignore case and uniquify UTF8 encoded elements of list duplicate list each elements are unique in the new list More... | |
| char ** | iicListUniqUTF8 (char ***list) MUST_CHECK |
| ignore case and uniquify UTF8 encoded elements of list each elements are unique in the list More... | |
| char * | emptySF (void) MUST_CHECK |
| empty String Function More... | |
| char * | iEmptySF (char **string) MUST_CHECK |
| empty String Function More... | |
| bool | isEmptyS (const char *string) MUST_CHECK |
| is Empty String More... | |
| bool | isBlankS (const char *string) MUST_CHECK |
| is Blank String More... | |
| ssize_t | intIndex (int64_t index, int64_t length) |
| int to positive index index can be negative More... | |
| char ** | listEmptySF (void) MUST_CHECK |
| list Empty String Function More... | |
| char ** | iListEmptySF (char ***list) MUST_CHECK |
| list Empty String Function More... | |
| bool | listIsEmptyS (char **list) MUST_CHECK |
| list Is Empty String More... | |
| bool | listIsBlankS (char **list) MUST_CHECK |
| list Is Empty String More... | |
| char ** | listCreateSF (const char *paramType,...) MUST_CHECK |
| list Create String Function create a list from the list of parameters used from the listCreateS(...) macro More... | |
| char ** | listFromArrayS (char **array, size_t size) MUST_CHECK |
| list From Array String More... | |
| char ** | listFromCArrayS (const char **array, size_t size) MUST_CHECK |
| list From Const Array String More... | |
| char ** | listPushS (char ***list, const char *s) MUST_CHECK |
| list Push String append s at the end of the list when list is NULL, a new list with one element is returned when list and s are NULL return list with 2 NULL elements when s is NULL, NULL is pushed at the end of the list More... | |
| char ** | listPushCharS (char ***list, char c) MUST_CHECK |
| char ** | iListPushS (char ***list, char *s) MUST_CHECK |
| list Push String append s pointer at the end of the list when list is NULL, a new list with one element is returned when list and s are NULL return list with 2 NULL elements when s is NULL, NULL is pushed at the end of the list More... | |
| char * | listPopS (char ***list) MUST_CHECK |
| list Pop String return last string from list and remove last element from the list More... | |
| char ** | listPrependS (char ***list, const char *s) MUST_CHECK |
| list Prepend String append s at the beginning of the list when list is NULL, a new list with one element is returned when list and s are NULL return list with 2 NULL elements when s is NULL, the operation is canceled More... | |
| char ** | listPrependCharS (char ***list, char c) MUST_CHECK |
| char ** | iListPrependS (char ***list, char *s) MUST_CHECK |
| list Prepend String append s pointer at the beginning of the list when list is NULL, a new list with one element is returned when list and s are NULL return list with 2 NULL elements when s is NULL, the operation is canceled More... | |
| char * | listDequeueS (char ***list) MUST_CHECK |
| list Dequeue String return first string from list and remove it from the list More... | |
| void | listFreeS (char **list) |
| list Free String More... | |
| void | listFreeManySF (char **paramType,...) |
| list free many String More... | |
| size_t | listLengthS (char **list) MUST_CHECK |
| list Length String return number of elements until the first NULL element More... | |
| size_t | listLengthCS (const char **list) MUST_CHECK |
| const list Length String return number of elements until the first NULL element More... | |
| ssize_t | listStrLengthS (char **list) MUST_CHECK |
| list String Length String More... | |
| ssize_t | listIntIndexS (char **list, int64_t index) MUST_CHECK |
| list int to index String index can be negative More... | |
| char ** | listAddrS (char **list, int64_t index) MUST_CHECK |
| list address String index can be negative More... | |
| char * | listGetS (char **list, int64_t index) MUST_CHECK |
| list Get String duplicate string at given index index can be negative More... | |
| char * | iListGetS (char **list, int64_t index) MUST_CHECK |
| list Get String index can be negative More... | |
| char * | listGetCS (const char **list, int64_t index) MUST_CHECK |
| const list Get String duplicate string at given index index can be negative More... | |
| const char * | iListGetCS (const char **list, int64_t index) MUST_CHECK |
| const list Get String index can be negative More... | |
| char ** | listSetS (char **list, int64_t index, const char *s) MUST_CHECK |
| list Set String duplicate string and store at given index, the existing element is freed index can be negative More... | |
| char ** | listSetCharS (char **list, int64_t index, char c) MUST_CHECK |
| char ** | iListSetS (char **list, int64_t index, char *s) MUST_CHECK |
| list Set String store string at given index index can be negative More... | |
| char ** | listSwapS (char **list, int64_t index1, int64_t index2) MUST_CHECK |
| swap elements in list More... | |
| char ** | iListSwapS (char **list, int64_t index1, int64_t index2) MUST_CHECK |
| swap elements in list More... | |
| char ** | split (const char *string, const char *delim) MUST_CHECK |
| split string with delim string when updating this function, also update splitS (identical to split) return list More... | |
| char ** | splitS (const char *string, const char *delim) MUST_CHECK |
| char ** | splitChar (const char *string, char delim) MUST_CHECK |
| char ** | icSplit (const char *string, const char *delim) MUST_CHECK |
| ignore case split string with delim string when updating this function, also update icSplitS (identical to icSplit) return list More... | |
| char ** | icSplitS (const char *string, const char *delim) MUST_CHECK |
| char ** | icSplitChar (const char *string, char delim) MUST_CHECK |
| ssize_t | joinLength (char **list, const char *delim) MUST_CHECK |
| join Length list length after joined with delimiter More... | |
| char * | join (char **list, const char *delim) MUST_CHECK |
| join list, the elements are seperated with delim in the resulting string when updating this function, also update joinS (identical to join) More... | |
| char * | joinS (char **list, const char *delim) MUST_CHECK |
| char * | joinCS (const char **list, const char *delim) MUST_CHECK |
| join list, the elements are seperated with delim in the resulting string More... | |
| char * | joinChar (char **list, char delim) MUST_CHECK |
| char * | bJoin (char *string, char **list, const char *delim) MUST_CHECK |
| buffer join list, the elements are seperated with delim in the resulting string More... | |
| char * | bJoinChar (char *string, char **list, char delim) MUST_CHECK |
| char * | bLJoin (char *string, size_t stringSize, char **list, const char *delim) MUST_CHECK |
| buffer size join list, the elements are seperated with delim in the resulting string More... | |
| char * | bLJoinChar (char *string, size_t stringSize, char **list, char delim) MUST_CHECK |
| char ** | extractS (const char *string, const char *delim1, const char *delim2) MUST_CHECK |
| extract string between delim1 and delim2 strings return list More... | |
| char ** | extractCharSS (const char *string, char delim1, const char *delim2) MUST_CHECK |
| char ** | extractSCharS (const char *string, const char *delim1, char delim2) MUST_CHECK |
| char ** | extractCharCharS (const char *string, char delim1, char delim2) MUST_CHECK |
| char ** | icExtractS (const char *string, const char *delim1, const char *delim2) MUST_CHECK |
| ignore case extract string between delim1 and delim2 strings return list More... | |
| char ** | icExtractCharSS (const char *string, char delim1, const char *delim2) MUST_CHECK |
| char ** | icExtractSCharS (const char *string, const char *delim1, char delim2) MUST_CHECK |
| char ** | icExtractCharCharS (const char *string, char delim1, char delim2) MUST_CHECK |
| char ** | listDupS (char **list) MUST_CHECK |
| list Duplicate String More... | |
| char ** | listDupCS (const char **list) MUST_CHECK |
| const list Duplicate String More... | |
| char ** | iListDupS (char **list) MUST_CHECK |
| list Duplicate String More... | |
| char ** | listReverseS (char **list) MUST_CHECK |
| list Reverse String duplicate and reverse list, the last element is the first element of the new list More... | |
| char ** | iListReverseS (char ***list) MUST_CHECK |
| list Reverse String reverse list, the last element is the first element of the list More... | |
| char ** | listCatSF (char **paramType,...) MUST_CHECK |
| list Cat String More... | |
| char ** | listAppendS (char ***list1, char **list2) MUST_CHECK |
| list Append String Append list2 at the end of list1 More... | |
| char ** | iListAppendS (char ***list1, char **list2) MUST_CHECK |
| in place list Append String Append list2 at the end of list1 by copying the pointers from list2 to list1. More... | |
| char ** | iListAppendNSmashS (char ***list1, char **list2) MUST_CHECK |
| list Append and smash list2 Append list2 at the end of list1 by copying the pointers from list2 to list1. More... | |
| char ** | listShiftS (char ***list1, char **list2) MUST_CHECK |
| list Shift String Append list2 at the start of list1 More... | |
| char ** | iListShiftS (char ***list1, char **list2) MUST_CHECK |
| in place list Shift String Append list2 at the start of list1 by copying the pointers from list2 to list1. More... | |
| char ** | iListShiftNSmashS (char ***list1, char **list2) MUST_CHECK |
| list Append and smash list2 Append list2 at the start of list1 by copying the pointers from list2 to list1. More... | |
| char ** | listAddS (char **list1, char **list2) |
| list Add String add list1 and list2 in a new list More... | |
| char ** | listAddCS (char **list1, const char **list2) |
| const list Add String add list1 and list2 in a new list More... | |
| char ** | listSliceS (char **list, int64_t start, int64_t end) MUST_CHECK |
| list Slice String return new list with elements from start and end in list negative indexes are allowed More... | |
| char ** | iListCopyS (char **list, int64_t start, int64_t end) MUST_CHECK |
| list Copy String return new list with element pointers from start and end in list negative indexes are allowed More... | |
| char ** | iListSliceS (char ***list, int64_t start, int64_t end) MUST_CHECK |
| list Slice String return list with elements from start and end in list negative indexes are allowed More... | |
| char ** | listCropS (char **list, int64_t start, int64_t end) MUST_CHECK |
| list Crop String return a new list with elements from start and end in list and delete elements from start to end in the original list negative indexes are allowed More... | |
| char ** | iListCropS (char ***list, int64_t start, int64_t end) MUST_CHECK |
| list Crop String return a new list with elements from start and end in list and delete elements from start to end in the original list negative indexes are allowed More... | |
| char * | listCropElemS (char **list, int64_t index) MUST_CHECK |
| list Crop Element String return element at index and delete element at index in the original list negative indexes are allowed More... | |
| char * | iListCropElemS (char ***list, int64_t index) MUST_CHECK |
| list Crop Element String return element at index and delete element at index in the original list negative indexes are allowed More... | |
| char ** | listInsertS (char **list, int64_t index, char **toInsert) MUST_CHECK |
| list Insert string More... | |
| char ** | iListInsertS (char ***list, int64_t index, char **toInsert) MUST_CHECK |
| list Insert string More... | |
| char ** | iListInsertNFreeS (char ***list, int64_t index, char **toInsert) MUST_CHECK |
| list Insert string and free toInsert More... | |
| char ** | listInjectS (char **list, int64_t index, char *toInject) MUST_CHECK |
| list Inject string More... | |
| char ** | listInjectCharS (char **list, int64_t index, char toInject) MUST_CHECK |
| char ** | iListInjectS (char ***list, int64_t index, char *toInject) MUST_CHECK |
| list Inject string More... | |
| char ** | iListInjectCharS (char ***list, int64_t index, char toInject) MUST_CHECK |
| char ** | listDelS (char **list, int64_t start, int64_t end) MUST_CHECK |
| list Delete String return new list without elements from start and end in list negative indexes are allowed More... | |
| char ** | iListDelS (char ***list, int64_t start, int64_t end) MUST_CHECK |
| list Delete String return list without elements from start and end in list negative indexes are allowed More... | |
| char ** | iListRemoveS (char ***list, int64_t start, int64_t end) |
| list Remove String return list without elements from start and end in list the elements are removed without being freed negative indexes are allowed More... | |
| char ** | listDelElemS (char **list, int64_t index) MUST_CHECK |
| list Delete Element String return new list without the element at index negative indexes are allowed More... | |
| char ** | iListDelElemS (char ***list, int64_t index) MUST_CHECK |
| list Delete Element String return list without the element at index negative indexes are allowed More... | |
| char ** | iListRemoveElemS (char ***list, int64_t index) MUST_CHECK |
| list Remove Element String return list without the element at index the element is removed without being freed negative indexes are allowed More... | |
| int | listPrintS (char **list) MUST_CHECK |
| print list elements to stdout More... | |
| int | listPrintCS (const char **list) MUST_CHECK |
| char ** | listSortS (char **list) MUST_CHECK |
| list Sort String duplicate list and sort More... | |
| char ** | iListSortS (char ***list) MUST_CHECK |
| list Sort String More... | |
| char ** | listSortFS (char **list, shCmpt compareFunction) MUST_CHECK |
| list Sort String duplicate list and sort More... | |
| char ** | iListSortFS (char ***list, shCmpt compareFunction) MUST_CHECK |
| list Sort String More... | |
| char ** | icListSortS (char **list) MUST_CHECK |
| ignore case list Sort String duplicate list and sort More... | |
| char ** | iicListSortS (char ***list) MUST_CHECK |
| ignore case list Sort String More... | |
| char ** | readText (const char *filePath) MUST_CHECK |
| return text from filePath in a list new line characters are removed More... | |
| char ** | readStream (FILE *fp) MUST_CHECK |
| return text from stream fp in a list new line characters are removed More... | |
| bool | writeText (const char *filePath, char **list) MUST_CHECK |
| write list to filePath More... | |
| bool | writeCText (const char *filePath, const char **list) MUST_CHECK |
| write const list to filePath More... | |
| bool | writeStream (FILE *fp, char **list) MUST_CHECK |
| write list to stream More... | |
| bool | writeCStream (FILE *fp, const char **list) MUST_CHECK |
| write const list to stream More... | |
| bool | appendText (const char *filePath, char **list) MUST_CHECK |
| append list to filePath More... | |
| bool | appendCText (const char *filePath, const char **list) MUST_CHECK |
| append const list to filePath More... | |
| char ** | execOut (const char *cmd) MUST_CHECK |
| execute command return stdout from cmd More... | |
| char ** | systemOutf (const char *fmt,...) MUST_CHECK |
| execute system command with formatting More... | |
| int | systemf (const char *fmt,...) MUST_CHECK |
| execute system command with formatting More... | |
| int | commandF (const char *cmd, int line, const char *thisFunc, const char *thisFileName) MUST_CHECK |
| run command in default shell More... | |
| int | commandfF (int line, const char *thisFunc, const char *thisFileName, const char *fmt,...) MUST_CHECK |
| run command with formatting in default shell More... | |
| int | commandNFreeF (char *cmd, int line, const char *thisFunc, const char *thisFileName) MUST_CHECK |
| run command in default shell and free the cmd parameter More... | |
| bool | listEqS (char **list1, char **list2) MUST_CHECK |
| list Equal String compare each element of list1 and list2 More... | |
| bool | listEqCS (char **list1, const char **list2) MUST_CHECK |
| const(list2) list Equal String compare each element of list1 and list2 More... | |
| bool | listEqC1S (const char **list1, char **list2) MUST_CHECK |
| const(list1) list Equal String compare each element of list1 and list2 More... | |
| bool | listEqCCS (const char **list1, const char **list2) MUST_CHECK |
| const(list1 and 2) list Equal String compare each element of list1 and list2 More... | |
| bool | listHasS (char **list, const char *string) MUST_CHECK |
| return true when list has string More... | |
| bool | listHasCS (const char **list, const char *string) MUST_CHECK |
| return true when const list has string More... | |
| bool | listHasCharS (char **list, char c) MUST_CHECK |
| bool | listHasCharCS (const char **list, char c) MUST_CHECK |
| ssize_t | listIndexOfS (char **list, const char *string) MUST_CHECK |
| return index of string in list More... | |
| ssize_t | listIndexOfCS (const char **list, const char *string) MUST_CHECK |
| return index of string in const list More... | |
| ssize_t | listIndexOfCharS (char **list, char c) MUST_CHECK |
| ssize_t | listIndexOfCharCS (const char **list, char c) MUST_CHECK |
| ssize_t | listBinarySearchS (char **list, const char *string) MUST_CHECK |
| list binary search string More... | |
| ssize_t | listBinarySearchCharS (char **list, char c) MUST_CHECK |
| char ** | listUniqS (char **list) MUST_CHECK |
| Uniquify elements of list duplicate list each elements are unique in the new list. More... | |
| char ** | iListUniqS (char ***list) MUST_CHECK |
| Uniquify elements of list each elements are unique in the list. More... | |
| bool | icListEqS (char **list1, char **list2) MUST_CHECK |
| ignore case list Equal String compare each element of list1 and list2 More... | |
| bool | icListEqCS (char **list1, const char **list2) MUST_CHECK |
| ignore case const(list2) list Equal String compare each element of list1 and list2 More... | |
| bool | icListEqC1S (const char **list1, char **list2) MUST_CHECK |
| ignore case const(list1) list Equal String compare each element of list1 and list2 More... | |
| bool | icListEqCCS (const char **list1, const char **list2) MUST_CHECK |
| ignore case const(list1 and 2) list Equal String compare each element of list1 and list2 More... | |
| bool | icListHasS (char **list, const char *string) MUST_CHECK |
| ignore case and return true when list has string More... | |
| bool | icListHasCharS (char **list, char c) MUST_CHECK |
| bool | icListHasCS (const char **list, const char *string) MUST_CHECK |
| ignore case and return true when const list has string More... | |
| bool | icListHasCharCS (const char **list, char c) MUST_CHECK |
| ssize_t | icListIndexOfS (char **list, const char *string) MUST_CHECK |
| ignore case and return index of string in list More... | |
| ssize_t | icListIndexOfCS (const char **list, const char *string) MUST_CHECK |
| ignore case and return index of string in const list More... | |
| ssize_t | icListIndexOfCharS (char **list, char c) MUST_CHECK |
| ssize_t | icListIndexOfCharCS (const char **list, char c) MUST_CHECK |
| ssize_t | icListBinarySearchS (char **list, const char *string) MUST_CHECK |
| ignore case list binary search string More... | |
| ssize_t | icListBinarySearchCharS (char **list, char c) MUST_CHECK |
| char ** | icListUniqS (char **list) MUST_CHECK |
| ignore case and uniquify elements of list duplicate list each elements are unique in the new list More... | |
| char ** | iicListUniqS (char ***list) MUST_CHECK |
| ignore case and uniquify elements of list each elements are unique in the list More... | |
| char ** | listCompactS (char **list) MUST_CHECK |
| remove empty strings from list More... | |
| char ** | iListCompactS (char ***list) MUST_CHECK |
| remove empty strings from list More... | |
| void | btraceEnable (void) |
| void | btraceDisable (void) |
| bool | btraceConfig (void) MUST_CHECK |
| char ** | btrace (void) |
| generate backtrace the program has to be linked the -rdynamic option for btrace to work btrace can backtrace 50 functions at most. More... | |
| void ** | listEmptyF (void) MUST_CHECK |
| list Empty Function More... | |
| void ** | iListEmptyF (void ***list) MUST_CHECK |
| list Empty Function More... | |
| bool | listIsEmpty (void **list) MUST_CHECK |
| list Is Empty More... | |
| void ** | listCreateF (void *paramType,...) MUST_CHECK |
| list Create Function create a list from the list of parameters used from the listCreate(...) macro More... | |
| void ** | listFromArray (void **array, size_t size) MUST_CHECK |
| list From Array More... | |
| void ** | listPush (void ***list, void *s) MUST_CHECK |
| list Push More... | |
| void * | listPop (void ***list) MUST_CHECK |
| list Pop return last element from list and remove last element from the list More... | |
| void ** | listPrepend (void ***list, void *s) MUST_CHECK |
| list Prepend More... | |
| void * | listDequeue (void ***list) MUST_CHECK |
| list Dequeue return first element from list and remove last element from the list More... | |
| void | listFree (void **list) |
| list Free More... | |
| void | listFreeManyF (void **paramType,...) |
| list free many More... | |
| size_t | listLength (void **list) MUST_CHECK |
| list Length return number of elements until the first NULL element More... | |
| void * | listGet (void **list, int64_t index) MUST_CHECK |
| list Get More... | |
| void ** | listSet (void **list, int64_t index, void *s) MUST_CHECK |
| list Set More... | |
| void ** | listDup (void **list) MUST_CHECK |
| list Duplicate More... | |
| void ** | listReverse (void **list) MUST_CHECK |
| list Reverse create index list and reverse list, the last element is the first element of the new list More... | |
| void ** | iListReverse (void ***list) MUST_CHECK |
| list Reverse reverse list, the last element is the first element of the list More... | |
| void ** | listCatF (void **paramType,...) MUST_CHECK |
| list Cat More... | |
| void ** | listAppend (void ***list1, void **list2) MUST_CHECK |
| list Append More... | |
| void ** | listAdd (void **list1, void **list2) MUST_CHECK |
| list Add add list1 and list2 in a new list More... | |
| void ** | listSlice (void **list, int64_t start, int64_t end) MUST_CHECK |
| list Slice More... | |
| void ** | iListSlice (void ***list, int64_t start, int64_t end) MUST_CHECK |
| list Slice return list with elements from start and end in list negative indexes are allowed More... | |
| void ** | listInsert (void **list, int64_t index, void **toInsert) MUST_CHECK |
| list Insert More... | |
| void ** | iListInsert (void ***list, int64_t index, void **toInsert) MUST_CHECK |
| list Insert More... | |
| void ** | listDel (void **list, int64_t start, int64_t end) MUST_CHECK |
| list Delete return new list without elements from start and end in list negative indexes are allowed More... | |
| void ** | iListDel (void ***list, int64_t start, int64_t end) MUST_CHECK |
| list Delete return list without elements from start and end in list negative indexes are allowed More... | |
| int | ringInit (void *ring, int maxCount) |
| list Sort duplicate list and sort More... | |
| int | ringEmpty (void *ring) |
| empty ring Allocated buffers in the list must be freed before running staticArrayEmpty More... | |
| int | ringIsEmpty (void *ring) |
| 1 when empty 0 not empty -1 error More... | |
| int | ringIsFull (void *ring) |
| 1 when full 0 not full -1 error More... | |
| ssize_t | ringCount (void *ring) |
| return elements count More... | |
| i64 | ringPush (void *ring) |
| push element to ring (only increases last, use ringSend) use ringLast to access the element More... | |
| int | ringPop (void *ring) |
| pop element from ring (only decreases last) More... | |
| i64 | ringPrepend (void *ring) |
| prepend element to ring (only decreases head) use ringFirst to access the element More... | |
| int | ringDequeue (void *ring) |
| dequeue element from ring (only increases head, use ringRecv) More... | |
| void | scheduler (void) |
| fiber usage More... | |
| staticArrayT (fiberLT, int, tCount) | |
| staticArray to hold the fiber slots More... | |
| bool | fiberAdd (void *ctx, int thisSlot, fiberFT func) |
| add new fiber More... | |
| bool | fiberPrepend (void *ctx, int thisSlot, fiberFT func) |
| add new fiber and start immediately after next yield More... | |
| uint64_t | getMonotonicTime (void) MUST_CHECK |
| end bitfield More... | |
| int | nanoSleepF (uint64_t time) MUST_CHECK |
| nanosleep More... | |
Variables | |
| const bool | TRUE |
| type bool true (glibc true is not bool), for use in generics More... | |
| const bool | FALSE |
| type bool false (glibc true is not bool), for use in generics More... | |
| jmp_buf | tryJumpBuffers [maxTryThrowCount] |
| setjmp buffers for try/throw,throwV macros More... | |
| uint64_t | logMask |
| variable to control which group logs to show, all logs are enabled by default (0xFFFFFFFFFFFFFFFF) More... | |
| const uint8_t | codeSzUTF8 [256] |
| bool | btraceCfg |
| backtrace in error messages is enabled by default More... | |
| fibersT | fibers |
| data for fiber system More... | |
This file has basic file, random, string, list functions.
There are 2 types of lists: char** and void**
The *S (not i*S) functions duplicate the parameters and results. You must free the result if result is non-NULL and free the parameters
The functions starting with i*S are in place functions.
In Place functions: iList*S and i*S The iList*S and i*S functions modify the input buffers The input buffers must be allocated with malloc/calloc Returns are pointers to original buffers
buffer functions: b*, bL* In these functions, the destination buffer is allocated by the caller In the bL* functions, the destination size is the size of the buffer (strlen+1)
Ignore case functions: ic*
UTF-8 functions: *UTF8 Rune is defined as single UTF-8 code point.
libsheepy.h also has:
It is advised to use the C11 generics from libsheepyObject.h instead of the libsheepy.h functions directly because there are many functions.
If you want to add a prefix for libsheepy functions, define a macro like this: #define SH_PREFIX(NAME) MY_PREFIX ## NAME
Error from any function returning a status have 0, false or NULL for value (or specifed otherwise in the function description). Errors are reported when the parameters are NULL or invalid, when it happens no parameters and no data stuctures are freed or changed. Errors are detected with if (!func)
For more information, the documentation is located at http://spartatek.se/libsheepy/
Definition in file libsheepy.h.
| #define _GNU_SOURCE |
Definition at line 29 of file libsheepy.h.
| #define LIBSHEEPY_VERSION "2.2.12.1" |
Definition at line 101 of file libsheepy.h.
| #define SH_PREFIX | ( | NAME | ) | NAME |
Definition at line 104 of file libsheepy.h.
| #define internal static |
file internal declarations
Definition at line 110 of file libsheepy.h.
| #define local static |
file local declarations (same as internal, shorter word)
Definition at line 113 of file libsheepy.h.
| #define var __auto_type |
declare variable type automaticaly: var a = ARGC;
Definition at line 116 of file libsheepy.h.
| #define null NULL |
convenience defines
Definition at line 126 of file libsheepy.h.
| #define yes true |
Definition at line 127 of file libsheepy.h.
| #define on true |
Definition at line 128 of file libsheepy.h.
| #define no false |
Definition at line 129 of file libsheepy.h.
| #define off false |
Definition at line 130 of file libsheepy.h.
| #define boolS | ( | x | ) | x ? "TRUE" : "FALSE" |
bool to const string: printf("%s\n", boolS(boolValue));
Definition at line 133 of file libsheepy.h.
| #define XSUCCESS exit(EXIT_SUCCESS); |
success
Definition at line 138 of file libsheepy.h.
| #define XSuccess XSUCCESS |
Definition at line 139 of file libsheepy.h.
| #define XFAILURE exit(EXIT_FAILURE); |
failure
Definition at line 144 of file libsheepy.h.
| #define XFailure XFAILURE |
Definition at line 145 of file libsheepy.h.
| #define logXSuccess | ( | string | ) |
log string with logP and exit with success
This is useful to know at which line a program exits
Definition at line 152 of file libsheepy.h.
| #define logXSuccessf | ( | format, | |
| ... | |||
| ) |
log formated string with logP and exit with success
This is useful to know at which line a program exits The format string is printed as given, "Success" is not added unlike logXSuccess
Definition at line 164 of file libsheepy.h.
| #define logXFailure | ( | string | ) |
* log string with logC and exit with failure
This is useful to know at which line a program exits
Definition at line 174 of file libsheepy.h.
| #define logXFailuref | ( | format, | |
| ... | |||
| ) |
log formated string with logC and exit with failure
This is useful to know at which line a program exits The format string is printed as given, "Failed" is not added unlike logXFailure
Definition at line 186 of file libsheepy.h.
| #define logExit | ( | exitCode, | |
| string | |||
| ) |
log string with logI and exit with exitCode
This is useful to know at which line a program exits
Definition at line 196 of file libsheepy.h.
| #define exitFailure | ( | cond | ) |
exit failure
Exits when cond is false
Definition at line 206 of file libsheepy.h.
| #define procbegin do{ |
defines for macro begin and end
Macros not returning values are usually written as do while loops: #define macro(value) do{ puts(value); } while(0)
Using the defines below: #define macro(value) procbegin\ puts(value);\ procend
procbegin and procend are for macros not returning a value (like procedure in pascal) funcbegin and funcend are for macros returning a value like functions
Macro returning a value (GNU extension): #define macro(value) funcbegin\ int returnResult = value + 2;\ returnResult;\ funcend
Definition at line 233 of file libsheepy.h.
| #define procend }while(0) |
Definition at line 234 of file libsheepy.h.
| #define funcbegin ({ |
Definition at line 235 of file libsheepy.h.
| #define funcend }) |
Definition at line 236 of file libsheepy.h.
| #define MACRO | ( | STATEMENTS | ) | do { STATEMENTS } while(0) |
do while(0) alternative macro definition
#define macro(param) MACRO( logVarG(param) )
Definition at line 243 of file libsheepy.h.
| #define FUNC | ( | STATEMENTS | ) | ({ STATEMENTS }) |
Macro returning a value (GNU extension): #define macro(value) FUNC(\ int returnResult = value + 2;\ returnResult;\ )
Definition at line 253 of file libsheepy.h.
| #define is = |
additions to iso646 int a is 0; if (a equals 1 or a equals 2) a shl = 2; else a inc; return ptr_to a;
int *b is val_of b is a; val_of b dec;
Definition at line 265 of file libsheepy.h.
| #define equals == |
Definition at line 266 of file libsheepy.h.
| #define nequal != |
Definition at line 267 of file libsheepy.h.
| #define shr >> |
Definition at line 268 of file libsheepy.h.
| #define shl << |
Definition at line 269 of file libsheepy.h.
| #define inc ++ |
Definition at line 270 of file libsheepy.h.
| #define dec -- |
Definition at line 271 of file libsheepy.h.
| #define ptr_to & |
Definition at line 272 of file libsheepy.h.
| #define val_of * |
Definition at line 273 of file libsheepy.h.
| #define stringifyExpr | ( | expr | ) | stringifyExpr1(expr) |
stringify Expression - Turn expression into a string literal
Example: #define PRINT_COND_IF_FALSE(cond) \ ((cond) || printf("%s is false!", stringifyExpr(cond)))
Definition at line 282 of file libsheepy.h.
| #define stringifyExpr1 | ( | expr | ) | #expr |
Definition at line 284 of file libsheepy.h.
| #define libsheepyErrorMask 0x8000000000000000UL |
Definition at line 291 of file libsheepy.h.
| #define disableLibsheepyErrorLogs do{logMask &= (~libsheepyErrorMask);}while(0) |
Definition at line 293 of file libsheepy.h.
| #define shperror | ( | string | ) |
Definition at line 295 of file libsheepy.h.
| #define pFuncError do{ if ((libsheepyErrorMask) & logMask) { shperror(__func__);logEBtrace;} }while(0); |
print function name and system error
to print error, use either pFuncError and shEPrintfS or shPrintError and shEPrintfS
Definition at line 306 of file libsheepy.h.
| #define pStrError | ( | str | ) | do{ if ((libsheepyErrorMask) & logMask) { shperror(str);logEBtrace;} }while(0); |
print string and system error
Definition at line 311 of file libsheepy.h.
| #define shPrintError do{ if ((libsheepyErrorMask) & logMask) { logE("Error line "stringifyExpr(__LINE__)", function %s, file "__FILE__"\n", __func__); logEBtrace;} }while(0); |
print error with line number, function name and file name to stderr
to print error, use either pFuncError and shEPrintfS or shPrintError and shEPrintfS
Definition at line 319 of file libsheepy.h.
| #define pError | ( | func | ) | if (func == -1) shPrintError |
print error when function failed.
The error code must be -1
Definition at line 324 of file libsheepy.h.
| #define pError0 | ( | func | ) | if (func == 0) shPrintError |
print error when function failed.
The error code must be 0
Definition at line 329 of file libsheepy.h.
| #define pErrorNot0 | ( | func | ) | if (func != 0) shPrintError |
print error when function failed.
The error code must be not 0
Definition at line 334 of file libsheepy.h.
| #define pErrorNULL | ( | func | ) | if (func == NULL) shPrintError |
print error when function failed.
The error code must be NULL
Definition at line 339 of file libsheepy.h.
| #define pErrorValue | ( | func, | |
| errorValue | |||
| ) | if (func == errorValue) shPrintError |
print error when function failed.
The error code must be -1
Definition at line 344 of file libsheepy.h.
| #define pTestError | ( | test | ) | if (test) shPrintError |
print error when test is true
Definition at line 349 of file libsheepy.h.
| #define pTestErrorCmd | ( | test, | |
| cmd | |||
| ) | if (test) { shPrintError cmd; } |
print error and run command when test is true
Definition at line 354 of file libsheepy.h.
| #define pErrorCmd | ( | func, | |
| test, | |||
| cmd | |||
| ) | if (func test) { shPrintError cmd; } |
print error and run cmd when test is true
Definition at line 359 of file libsheepy.h.
| #define pErrorResult | ( | result, | |
| func, | |||
| test | |||
| ) | if ((result = func) test) shPrintError |
print error when test is true and return func result in result
Example: pErrorResult(k, randomWordF(), == 0)
Definition at line 367 of file libsheepy.h.
| #define pErrorResultCmd | ( | result, | |
| func, | |||
| test, | |||
| cmd | |||
| ) | if ((result = func) test) { shPrintError cmd; } |
print error and run cmd when test is true and return func result in result
Example: pErrorResultCmd(k, randomWordF(), == 0, XFAILURE)
Definition at line 375 of file libsheepy.h.
| #define isError | ( | assigned, | |
| left | |||
| ) | if (!(assigned = left)) |
is Assigment Error catch error when assigned is false, 0 or NULL after being assigned with left
Example: isError(r, malloc(16384)) { return 0; }
Definition at line 386 of file libsheepy.h.
| #define maxTryThrowCount 16 |
setjmp buffers for try/throw,throwV macros
Definition at line 391 of file libsheepy.h.
| #define setJump | ( | slot | ) | setjmp(tryJumpBuffers[slot]) |
run setjmp using slot in tryJumpBuffers
Definition at line 397 of file libsheepy.h.
| #define try | ( | slot | ) | if (!setjmp(tryJumpBuffers[slot])) |
try throw else try(slot) saves the environment in slot throw(slot) executes the else associated with try(slot)
there are 16 slots
Example: try(0) { throw(0); } else puts("except");
Definition at line 414 of file libsheepy.h.
| #define throw | ( | slot | ) | longjmp(tryJumpBuffers[slot], 1) |
throw goes to else associated with try(slot)
Definition at line 419 of file libsheepy.h.
| #define tryV | ( | result, | |
| slot | |||
| ) | if (!(result = setjmp(tryJumpBuffers[slot]))) |
tryV stores the value from setjmp in result
it is valid to try with throwV and tryV with throw (returns 1)
Example:
Definition at line 428 of file libsheepy.h.
| #define throwV | ( | slot, | |
| value | |||
| ) | longjmp(tryJumpBuffers[slot], value) |
throwV returns value and goes to else associated with tryV(slot)
Definition at line 433 of file libsheepy.h.
| #define goNLabel | ( | go, | |
| label | |||
| ) | goto go; label: |
Definition at line 436 of file libsheepy.h.
| #define i8 int8_t |
types
Definition at line 441 of file libsheepy.h.
| #define i16 int16_t |
Definition at line 442 of file libsheepy.h.
| #define i32 int32_t |
Definition at line 443 of file libsheepy.h.
| #define i64 int64_t |
Definition at line 444 of file libsheepy.h.
| #define u8 uint8_t |
Definition at line 445 of file libsheepy.h.
| #define u16 uint16_t |
Definition at line 446 of file libsheepy.h.
| #define u32 uint32_t |
Definition at line 447 of file libsheepy.h.
| #define u64 uint64_t |
Definition at line 448 of file libsheepy.h.
| #define f32 float |
Definition at line 449 of file libsheepy.h.
| #define f64 double |
Definition at line 450 of file libsheepy.h.
type cast
Definition at line 455 of file libsheepy.h.
Definition at line 456 of file libsheepy.h.
Definition at line 457 of file libsheepy.h.
Definition at line 458 of file libsheepy.h.
Definition at line 459 of file libsheepy.h.
Definition at line 460 of file libsheepy.h.
Definition at line 461 of file libsheepy.h.
Definition at line 462 of file libsheepy.h.
Definition at line 463 of file libsheepy.h.
Definition at line 464 of file libsheepy.h.
| #define CLAMP | ( | x, | |
| low, | |||
| high | |||
| ) | (((x) > (high)) ? (high) : (((x) < (low)) ? (low) : (x))) |
Definition at line 471 of file libsheepy.h.
| #define COUNT_ELEMENTS | ( | arr | ) | (sizeof (arr) / sizeof ((arr)[0])) |
Definition at line 472 of file libsheepy.h.
| #define ARRAY_SIZE COUNT_ELEMENTS |
Definition at line 473 of file libsheepy.h.
| #define EXTRACT | ( | x, | |
| msb, | |||
| lsb | |||
| ) | ((~(0xFFFFFFFFFFFFFFFEUL << (msb)) & (x)) >> (lsb)) |
get a bitfield in an integer (opposite of FIELD_SET)
Definition at line 478 of file libsheepy.h.
compare a to b a and b have to numbers
Definition at line 489 of file libsheepy.h.
| #define init0Var {0} |
initialize array or struct to zero
int a[10] = init0Var; struct {} s = init0Var;
Definition at line 501 of file libsheepy.h.
| #define ZEROVAR | ( | name | ) | zeroBuf(&(name), sizeof(name)) |
memset array or struct to zero
Definition at line 506 of file libsheepy.h.
| #define BUCKETS | ( | count, | |
| divider | |||
| ) | ((count)/(divider) + (((count) % (divider)) ? 1 : 0)) |
divide count by divider and add one when remainder is not zero this is used in segmented arrays to count the number of buckets from the element count
For example, bucket have 64 elements and there are 66 elements in the array 66/64 = 1 and there are 2 buckets, so BUCKETS returns 2
could be: (((count) + (1UL<<(divider) -1))/ (divider))
Definition at line 519 of file libsheepy.h.
swap a and b, a and b should have the same type
Definition at line 524 of file libsheepy.h.
max a,b and store result in result, a and b are evaluated only once
Definition at line 531 of file libsheepy.h.
min a,b and store result in result, a and b are evaluated only once
Definition at line 538 of file libsheepy.h.
max a,b and return result, a and b are evaluated only once
Definition at line 545 of file libsheepy.h.
min a,b and return result, a and b are evaluated only once
Definition at line 552 of file libsheepy.h.
absV return absolute value for a, a is evaluated only once
Definition at line 559 of file libsheepy.h.
| #define FIELD_SIZEOF | ( | t, | |
| f | |||
| ) | (sizeof(((t*)0)->f)) |
FIELD_SIZEOF - get the size of a struct's field : the target struct : the target struct's field Return: the size of in the struct definition without having a declared instance of .
Definition at line 568 of file libsheepy.h.
true when value is odd integer
Definition at line 571 of file libsheepy.h.
true when value is even integer
Definition at line 574 of file libsheepy.h.
| #define typ typedef |
typ definition as alternative to typedef
Definition at line 579 of file libsheepy.h.
| #define ret return |
ret definition as alternative to return
Definition at line 584 of file libsheepy.h.
| #define elif else if |
elif definition as alternative to else if
Definition at line 589 of file libsheepy.h.
| #define unless | ( | cond | ) | if(not(cond)) |
unless executes the statement unless the condition is true (that is, if the condition is false).
Example: unless(isPath("/void")) { put("the '/void' directory doesn't exist."); }
Definition at line 599 of file libsheepy.h.
| #define until | ( | cond | ) | while(not(cond)) |
until repeats the statement until the condition is true (or while the condition is false)
Example: i16 i = 0; do { i++; logVarG(i); } until(i == 3);
Definition at line 611 of file libsheepy.h.
| #define cast | ( | type, | |
| casted, | |||
| toCast | |||
| ) | type casted = (type) (toCast); |
define variable and cast pointer
Definition at line 617 of file libsheepy.h.
| #define freen | ( | ptr | ) |
free pointer and set it to NULL
Definition at line 622 of file libsheepy.h.
Evaluate and assign Evaluate, assign result from func and return result using the comma operator.
Example: save pointer returned by a function in a function parameter: void *p; func2( EVA(p,func1()) ); free(p);
Using libsheepy functions: char *s; puts( EVA(s, normalizePath("/wef/./../")) ); free(s);
Definition at line 642 of file libsheepy.h.
| #define loopBreakerInit |
initialize the loop breaker declares loop breaker variables
Example:
loopBreakerInit; forever { loopBreaker(20); } if (didBreak) logE("infinite loop detected"); loopBreakerReset; forever { loopBreaker(100); } if (didBreak) logE("infinite loop detected");
Definition at line 661 of file libsheepy.h.
| #define loopBreakerReset |
reset the loop breaker variables
Definition at line 668 of file libsheepy.h.
| #define loopBreaker | ( | breakCount | ) |
break the loop when the counter exceed breakCount
Definition at line 675 of file libsheepy.h.
| #define FILE_LINE __FILE__":"stringifyExpr(__LINE__) |
generate a string FILE:LINE number
Example: puts(FILE_LINE);
Definition at line 684 of file libsheepy.h.
| #define PFILE_LINE puts(FILE_LINE) |
Definition at line 685 of file libsheepy.h.
print file, function name and line
Example: AT; libsheepy.c, main:9149
Definition at line 694 of file libsheepy.h.
print a todo message in log
Definition at line 699 of file libsheepy.h.
| #define TOKENPASTE | ( | a, | |
| b | |||
| ) | TOKENPASTE2(a, b) |
Definition at line 704 of file libsheepy.h.
| #define UNIQVAR | ( | name | ) | TOKENPASTE(name, __LINE__) |
Definition at line 705 of file libsheepy.h.
| #define cleanCharP | ( | name | ) | char *name CLEANUP(cleanUpCharFree) |
declare pointer name with type char* and free name when it is out of scope
Definition at line 714 of file libsheepy.h.
| #define cleanListP | ( | name | ) | char **name CLEANUP(cleanUpListFree) |
declare pointer name with type char* and free name when it is out of scope
Definition at line 722 of file libsheepy.h.
| #define cleanFileP | ( | name | ) | FILE *name CLEANUP(cleanUpFileFree) |
declare pointer name with type FILE and free (close) name when it is out of scope
Definition at line 730 of file libsheepy.h.
declare a file descriptor name and close name when it is out of scope
Definition at line 738 of file libsheepy.h.
Definition at line 739 of file libsheepy.h.
| #define logVar | ( | var, | |
| format | |||
| ) | logD("%s=%" format, stringifyExpr(var), var); |
log variable and its value
Example: logVar(k, PRIu64) k=14
Definition at line 748 of file libsheepy.h.
| #define logMVar | ( | mask, | |
| var, | |||
| format | |||
| ) | logMD(mask, "%s=%" format, stringifyExpr(var), var); |
Definition at line 749 of file libsheepy.h.
log bool variable
Definition at line 752 of file libsheepy.h.
Definition at line 753 of file libsheepy.h.
| #define logPtr | ( | pointer | ) | logD("%s=%p", stringifyExpr(pointer), pointer); |
log pointer
Definition at line 758 of file libsheepy.h.
| #define logMPtr | ( | mask, | |
| pointer | |||
| ) | logMD(mask, "%s=%p", stringifyExpr(pointer), pointer); |
Definition at line 759 of file libsheepy.h.
| #define RST "\x1B[0m" |
reset for color function
Definition at line 763 of file libsheepy.h.
| #define BLD "\x1B[1m" |
bold for color function
Definition at line 765 of file libsheepy.h.
| #define FNT "\x1B[2m" |
faint
Definition at line 767 of file libsheepy.h.
| #define ITL "\x1B[3m" |
italic
Definition at line 769 of file libsheepy.h.
| #define UDL "\x1B[4m" |
underline for color function
Definition at line 771 of file libsheepy.h.
| #define BLI "\x1B[5m" |
blink
Definition at line 773 of file libsheepy.h.
| #define INV "\x1B[7m" |
inverse for color function
Definition at line 775 of file libsheepy.h.
| #define COC "\x1B[8m" |
conceal/hidden for color function
Definition at line 777 of file libsheepy.h.
| #define CRD "\x1B[9m" |
crossed for color function
Definition at line 779 of file libsheepy.h.
| #define BLK "\x1B[30m" |
black for color function
Definition at line 783 of file libsheepy.h.
| #define RED "\x1B[31m" |
red for color function
Definition at line 785 of file libsheepy.h.
| #define GRN "\x1B[32m" |
green for color function
Definition at line 787 of file libsheepy.h.
| #define YLW "\x1B[33m" |
yellow for color function
Definition at line 789 of file libsheepy.h.
| #define BLU "\x1B[34m" |
blue for color function
Definition at line 791 of file libsheepy.h.
| #define MGT "\x1B[35m" |
magenta for color function
Definition at line 793 of file libsheepy.h.
| #define CYN "\x1B[36m" |
cyan for color function
Definition at line 795 of file libsheepy.h.
| #define WHT "\x1B[37m" |
white for color function
Definition at line 797 of file libsheepy.h.
| #define BGBLK "\x1B[40m" |
bg black for color function
Definition at line 801 of file libsheepy.h.
| #define BGRED "\x1B[41m" |
bg red for color function
Definition at line 803 of file libsheepy.h.
| #define BGGRN "\x1B[42m" |
bg green for color function
Definition at line 805 of file libsheepy.h.
| #define BGYLW "\x1B[43m" |
bg yellow for color function
Definition at line 807 of file libsheepy.h.
| #define BGBLU "\x1B[44m" |
bg blue for color function
Definition at line 809 of file libsheepy.h.
| #define BGMGT "\x1B[45m" |
bg magenta for color function
Definition at line 811 of file libsheepy.h.
| #define BGCYN "\x1B[46m" |
bg cyan for color function
Definition at line 813 of file libsheepy.h.
| #define BGWHT "\x1B[47m" |
bg white for color function
Definition at line 815 of file libsheepy.h.
Definition at line 818 of file libsheepy.h.
| #define sheepyBOOLFP len = fprintf(stream, "%*s", (int)(info->left ? -info->width : info->width), boolS(value)) |
Definition at line 819 of file libsheepy.h.
| #define timeNs | ( | func | ) |
time a function in nanoseconds
Example: timeNs(func(anInt));
Definition at line 827 of file libsheepy.h.
| #define TIMEUNITUS "us" |
Definition at line 835 of file libsheepy.h.
| #define TIMEUNITMS "ms" |
Definition at line 836 of file libsheepy.h.
| #define TIMEUNITSC "s" |
Definition at line 837 of file libsheepy.h.
| #define timeDivs | ( | func, | |
| div, | |||
| timeunit | |||
| ) |
time a function with div
Example: timeDivs(func(anInt), 1E3);
Definition at line 845 of file libsheepy.h.
| #define timeUs | ( | func | ) | timeDivs(func,1E3, TIMEUNITUS) |
time a function in microseconds
Example: timeUs(func(anInt));
Definition at line 859 of file libsheepy.h.
| #define timeMs | ( | func | ) | timeDivs(func,1E6, TIMEUNITMS) |
time a function in miliseconds
Example: timeMs(func(anInt));
Definition at line 867 of file libsheepy.h.
| #define timeSec | ( | func | ) | timeDivs(func,1E9, TIMEUNITSC) |
time a function in seconds
Example: timeSec(func(anInt));
Definition at line 875 of file libsheepy.h.
| #define stopwatchStart shStopwatch(0) |
Definition at line 880 of file libsheepy.h.
print stopwatch value in ns since last start
Definition at line 885 of file libsheepy.h.
| #define stopwatchLogDivs | ( | div, | |
| timeunit | |||
| ) | printf(BLD GRN "time" RST ": %f"timeunit"\n", ((float)shStopwatch(1))/div) |
print stopwatch value in provided unit since last start
Definition at line 890 of file libsheepy.h.
| #define stopwatchLogUs stopwatchLogDivs(1E3, TIMEUNITUS) |
print stopwatch value in microseconds since last start
Definition at line 895 of file libsheepy.h.
| #define stopwatchLogMs stopwatchLogDivs(1E6, TIMEUNITMS) |
print stopwatch value in milliseconds since last start
Definition at line 900 of file libsheepy.h.
| #define stopwatchLogSec stopwatchLogDivs(1E9, TIMEUNITSC) |
print stopwatch value in seconds since last start
Definition at line 905 of file libsheepy.h.
| #define LOG_EMERGENCY 0 |
LOG LEVELS Note: When adding log levels or modes, the log_tags array in libsheepy.c must be updated.
Definition at line 912 of file libsheepy.h.
| #define LOG_ALERT 1 |
Definition at line 913 of file libsheepy.h.
| #define LOG_CRITICAL 2 |
Definition at line 914 of file libsheepy.h.
| #define LOG_ERROR 3 |
Definition at line 915 of file libsheepy.h.
| #define LOG_WARNING 4 |
Definition at line 919 of file libsheepy.h.
| #define LOG_NOTICE 5 |
Definition at line 920 of file libsheepy.h.
| #define LOG_PASS 6 |
Definition at line 921 of file libsheepy.h.
| #define LOG_INFO 7 |
Definition at line 925 of file libsheepy.h.
| #define LOG_DEBUG 8 |
Definition at line 926 of file libsheepy.h.
| #define LOG_INVALID 9 |
Definition at line 927 of file libsheepy.h.
| #define LOG_MAX_LEVEL LOG_INVALID |
Definition at line 928 of file libsheepy.h.
| #define LOG_DISABLE -1 |
getMaxLogLevel and setMaxLogLevel value disabling all logs
Definition at line 931 of file libsheepy.h.
| #define LOG_VERBOSE 0 |
LOG MODES when a new mode is added, add symbols in log_tags in libsheepy.c.
log symbol, program name, filename, function, line, date
Definition at line 941 of file libsheepy.h.
| #define LOG_CONCISE 1 |
log symbol
Definition at line 946 of file libsheepy.h.
| #define LOG_DATE 2 |
log symbol and date
Definition at line 951 of file libsheepy.h.
| #define LOG_FUNC 3 |
log symbol and function
Definition at line 956 of file libsheepy.h.
| #define LOG_PROG 4 |
log symbol and program name
Definition at line 961 of file libsheepy.h.
| #define LOG_PROGNDATE 5 |
log symbol, program name and date
Definition at line 966 of file libsheepy.h.
| #define LOG_VOID 6 |
log message only
Definition at line 971 of file libsheepy.h.
| #define LOG_UTF8 7 |
UTF8 symbols and concise.
Definition at line 976 of file libsheepy.h.
| #define LOG_PROGNFUNC 8 |
log symbol, program name and function
Definition at line 981 of file libsheepy.h.
| #define LOG_INVALID_MODE 9 |
invalid
Definition at line 986 of file libsheepy.h.
| #define openLogFile setLogFile |
Definition at line 990 of file libsheepy.h.
| #define MUST_CHECK |
Definition at line 8206 of file libsheepy.h.
| #define pLog | ( | level, | |
| ... | |||
| ) | _pLog(level, __FILE__, __func__, __LINE__, __VA_ARGS__); |
print logging levels
to disable logging, empty pLog define: #undef pLog #define pLog
| level | LOG_CRITICAL, LOG_ERROR, LOG_WARNING or LOG_INFO, anything else has log level LOG_INVALID |
| message | like printf |
Definition at line 1053 of file libsheepy.h.
| #define logY | ( | ... | ) | pLog(LOG_EMERGENCY, __VA_ARGS__) |
Definition at line 1057 of file libsheepy.h.
Definition at line 1058 of file libsheepy.h.
| #define logC | ( | ... | ) | pLog(LOG_CRITICAL, __VA_ARGS__) |
Definition at line 1059 of file libsheepy.h.
Definition at line 1060 of file libsheepy.h.
| #define logW | ( | ... | ) | pLog(LOG_WARNING, __VA_ARGS__) |
Definition at line 1061 of file libsheepy.h.
| #define logN | ( | ... | ) | pLog(LOG_NOTICE, __VA_ARGS__) |
Definition at line 1062 of file libsheepy.h.
Definition at line 1063 of file libsheepy.h.
Definition at line 1064 of file libsheepy.h.
Definition at line 1065 of file libsheepy.h.
| #define logSY | ( | format, | |
| string | |||
| ) |
log string and free Example: logSY("The list: %s", catS("1", "2"));
Definition at line 1072 of file libsheepy.h.
| #define logSA | ( | format, | |
| string | |||
| ) |
log string and free Example: logSA("The list: %s", catS("1", "2"));
Definition at line 1083 of file libsheepy.h.
| #define logSC | ( | format, | |
| string | |||
| ) |
log string and free Example: logSC("The list: %s", catS("1", "2"));
Definition at line 1094 of file libsheepy.h.
| #define logSE | ( | format, | |
| string | |||
| ) |
log string and free Example: logSE("The list: %s", catS("1", "2"));
Definition at line 1105 of file libsheepy.h.
| #define logSW | ( | format, | |
| string | |||
| ) |
log string and free Example: logSW("The list: %s", catS("1", "2"));
Definition at line 1116 of file libsheepy.h.
| #define logSN | ( | format, | |
| string | |||
| ) |
log string and free Example: logSN("The list: %s", catS("1", "2"));
Definition at line 1127 of file libsheepy.h.
| #define logSP | ( | format, | |
| string | |||
| ) |
log string and free Example: logSP("The list: %s", catS("1", "2"));
Definition at line 1138 of file libsheepy.h.
| #define logSI | ( | format, | |
| string | |||
| ) |
log string and free Example: logSI("The list: %s", catS("1", "2"));
Definition at line 1149 of file libsheepy.h.
| #define logSD | ( | format, | |
| string | |||
| ) |
log string and free Example: logSD("The list: %s", catS("1", "2"));
Definition at line 1160 of file libsheepy.h.
print mask logging levels
print logs with a mask in logMask normally, mask is 1 bit wide.
pLogMask allows enabling/disabling groups of logs
to disable logging, empty pLogMask define: #undef pLogMask #define pLogMask
Example:
#define group1 0x03 #define group11 0x01 #define group12 0x02 #define group2 0x04
logMask = group11; logMI(group1, "is shown when logMask has bit 0 or 1 set"); logMI(group11, "is shown when logMask has bit 0 set"); logMI(group12, "is shown when logMask has bit 1 set"); logMI(group2, "is shown when logMask has bit 2 set");
| level | LOG_CRITICAL, LOG_ERROR, LOG_WARNING or LOG_INFO, anything else has log level LOG_INVALID |
| message | like printf |
Definition at line 1200 of file libsheepy.h.
| #define logMY | ( | mask, | |
| ... | |||
| ) | pLogMask(mask, LOG_EMERGENCY, __VA_ARGS__) |
Definition at line 1202 of file libsheepy.h.
Definition at line 1203 of file libsheepy.h.
| #define logMC | ( | mask, | |
| ... | |||
| ) | pLogMask(mask, LOG_CRITICAL, __VA_ARGS__) |
Definition at line 1204 of file libsheepy.h.
Definition at line 1205 of file libsheepy.h.
| #define logMW | ( | mask, | |
| ... | |||
| ) | pLogMask(mask, LOG_WARNING, __VA_ARGS__) |
Definition at line 1206 of file libsheepy.h.
| #define logMN | ( | mask, | |
| ... | |||
| ) | pLogMask(mask, LOG_NOTICE, __VA_ARGS__) |
Definition at line 1207 of file libsheepy.h.
Definition at line 1208 of file libsheepy.h.
Definition at line 1209 of file libsheepy.h.
Definition at line 1210 of file libsheepy.h.
| #define showLogsInMask | ( | mask | ) | logMask |= mask |
Definition at line 1213 of file libsheepy.h.
| #define hideLogsInMask | ( | mask | ) | logMask &= ~(mask) |
Definition at line 1216 of file libsheepy.h.
| #define logSMY | ( | mask, | |
| format, | |||
| string | |||
| ) |
log and mask string and then free Example: logSMY("The list: %s", catS("1", "2"));
Definition at line 1223 of file libsheepy.h.
| #define logSMA | ( | mask, | |
| format, | |||
| string | |||
| ) |
log and mask string and then free Example: logSMA("The list: %s", catS("1", "2"));
Definition at line 1234 of file libsheepy.h.
| #define logSMC | ( | mask, | |
| format, | |||
| string | |||
| ) |
log and mask string and then free Example: logSMI("The list: %s", catS("1", "2"));
Definition at line 1245 of file libsheepy.h.
| #define logSME | ( | mask, | |
| format, | |||
| string | |||
| ) |
log and mask string and then free Example: logSME("The list: %s", catS("1", "2"));
Definition at line 1256 of file libsheepy.h.
| #define logSMW | ( | mask, | |
| format, | |||
| string | |||
| ) |
log and mask string and then free Example: logSMW("The list: %s", catS("1", "2"));
Definition at line 1267 of file libsheepy.h.
| #define logSMN | ( | mask, | |
| format, | |||
| string | |||
| ) |
log and mask string and then free Example: logSMN("The list: %s", catS("1", "2"));
Definition at line 1278 of file libsheepy.h.
| #define logSMP | ( | mask, | |
| format, | |||
| string | |||
| ) |
log and mask string and then free Example: logSMP("The list: %s", catS("1", "2"));
Definition at line 1289 of file libsheepy.h.
| #define logSMI | ( | mask, | |
| format, | |||
| string | |||
| ) |
log and mask string and then free Example: logSMI("The list: %s", catS("1", "2"));
Definition at line 1300 of file libsheepy.h.
| #define logSMD | ( | mask, | |
| format, | |||
| string | |||
| ) |
log and mask string and then free Example: logSMD("The list: %s", catS("1", "2"));
Definition at line 1311 of file libsheepy.h.
| #define Q_SORT3 | ( | q_a1, | |
| q_a2, | |||
| q_a3, | |||
| Q_LESS, | |||
| Q_SWAP | |||
| ) |
Definition at line 1386 of file libsheepy.h.
| #define Q_PARTITION | ( | q_l, | |
| q_r, | |||
| q_i, | |||
| q_j, | |||
| Q_UINT, | |||
| Q_LESS, | |||
| Q_SWAP | |||
| ) |
Definition at line 1406 of file libsheepy.h.
| #define Q_INSERTION_SORT | ( | q_l, | |
| q_r, | |||
| Q_UINT, | |||
| Q_LESS, | |||
| Q_SWAP | |||
| ) |
| #define Q_THRESH 16 |
Definition at line 1457 of file libsheepy.h.
| #define Q_LOOP | ( | Q_UINT, | |
| Q_N, | |||
| Q_LESS, | |||
| Q_SWAP | |||
| ) |
Definition at line 1460 of file libsheepy.h.
| #define Q_SUBFILES | ( | q_l1, | |
| q_r1, | |||
| q_l2, | |||
| q_r2 | |||
| ) |
Definition at line 1494 of file libsheepy.h.
| #define QSORT | ( | Q_N, | |
| Q_LESS, | |||
| Q_SWAP | |||
| ) |
Definition at line 1516 of file libsheepy.h.
| #define BSEARCH | ( | RESULT_INDEX, | |
| SEARCH_ELEMENT, | |||
| B_N, | |||
| B_LESS, | |||
| B_EQUAL | |||
| ) |
binary search macro
Synopsis: BSEARCH(RESULT_INDEX, SEARCH_ELEMENT, N, LESS, EQUAL); where RESULT_INDEX - variable holding the result index, signed int type (example: ssize_t), declare RESULT_INDEX before calling BSEARCH; SEARCH_ELEMENT - element to search in the array; N - the number of elements in A[]; LESS(i, SEARCH_ELEMENT) - compares A[i] to SEARCH_ELEMENT, 1 when less; EQUAL(i, SEARCH_ELEMENT) - compares A[i] to SEARCH_ELEMENT, 1 when equal;
Example: int A[] = {1,5,7,9,10,65}; ssize_t bsr;
#define LESS(i, se) A[i] < se #define EQUAL(i, se) A[i] == se BSEARCH(bsr, 9, COUNT_ELEMENTS(A), LESS, EQUAL); #undef LESS #undef EQUAL
logVar(bsr,"zd");
Definition at line 1555 of file libsheepy.h.
| #define libsheepyPrealloc (1024*1024) |
Definition at line 1578 of file libsheepy.h.
| #define makeRoom | ( | length, | |
| alloc, | |||
| addlength | |||
| ) |
Definition at line 1579 of file libsheepy.h.
| #define initLibsheepy | ( | progPath | ) | initLibsheepyF(progPath, NULL) |
Definition at line 1599 of file libsheepy.h.
| #define systemNFree | ( | command | ) | systemNFreeF(command, __LINE__, __func__, __FILE__) |
Definition at line 1635 of file libsheepy.h.
| #define isPath fileExists |
Definition at line 1732 of file libsheepy.h.
| #define readFileS readFileToS |
Definition at line 1752 of file libsheepy.h.
| #define bReadFileS bReadFileToS |
Definition at line 1753 of file libsheepy.h.
| #define bLReadFileS bLReadFileToS |
Definition at line 1754 of file libsheepy.h.
| #define readStreamS readStreamToS |
Definition at line 1755 of file libsheepy.h.
| #define bReadStreamS bReadStreamToS |
Definition at line 1756 of file libsheepy.h.
| #define bLReadStreamS bLReadStreamToS |
Definition at line 1757 of file libsheepy.h.
Definition at line 1862 of file libsheepy.h.
| #define freeManyS | ( | ... | ) | freeManySF("", __VA_ARGS__, NULL) |
Definition at line 1867 of file libsheepy.h.
| #define put puts(""); |
Definition at line 1894 of file libsheepy.h.
| #define catS | ( | ... | ) | catSF("", __VA_ARGS__, NULL) |
Definition at line 1911 of file libsheepy.h.
| #define iCatS | ( | dst, | |
| ... | |||
| ) | iCatSF(dst, "", __VA_ARGS__, NULL) |
Definition at line 1915 of file libsheepy.h.
| #define bCatS iCatS |
Definition at line 1916 of file libsheepy.h.
| #define bLCatS | ( | dst, | |
| dstSize, | |||
| ... | |||
| ) | bLCatSF(dst, dstSize, "", __VA_ARGS__, NULL) |
Definition at line 1918 of file libsheepy.h.
| #define iAppendManyS | ( | s, | |
| s1, | |||
| ... | |||
| ) | iAppendManySF(s, s1, __VA_ARGS__, NULL) |
Definition at line 1937 of file libsheepy.h.
| #define bAppendManyS | ( | s, | |
| s1, | |||
| ... | |||
| ) | bAppendManySF(s, s1, __VA_ARGS__, NULL) |
Definition at line 1939 of file libsheepy.h.
| #define bLAppendManyS | ( | s, | |
| sSize, | |||
| s1, | |||
| ... | |||
| ) | bLAppendManySF(s, sSize, s1, __VA_ARGS__, NULL) |
Definition at line 1941 of file libsheepy.h.
Definition at line 1958 of file libsheepy.h.
| #define replaceSMax replaceS_max |
Definition at line 1959 of file libsheepy.h.
| #define replaceSMaxLen | ( | s, | |
| olds, | |||
| news | |||
| ) | replaceSLen(s,olds,news, 0) |
Definition at line 1962 of file libsheepy.h.
Definition at line 1967 of file libsheepy.h.
| #define iReplaceSMax iReplaceS_max |
Definition at line 1968 of file libsheepy.h.
Definition at line 1970 of file libsheepy.h.
| #define bReplaceSMax bReplaceS_max |
Definition at line 1971 of file libsheepy.h.
| #define bLReplaceS_max | ( | s, | |
| sSize, | |||
| olds, | |||
| news | |||
| ) | bLReplaceS(s,sSize,olds,news, 0) |
Definition at line 1973 of file libsheepy.h.
| #define bLReplaceSMax bLReplaceS_max |
Definition at line 1974 of file libsheepy.h.
| #define replaceManyS | ( | s, | |
| ... | |||
| ) | replaceManySF(s, __VA_ARGS__, NULL) |
Definition at line 1978 of file libsheepy.h.
| #define iReplaceManyS | ( | s, | |
| olds, | |||
| ... | |||
| ) | iReplaceManySF(s, olds, __VA_ARGS__, NULL) |
Definition at line 1980 of file libsheepy.h.
| #define bReplaceManyS | ( | s, | |
| olds, | |||
| ... | |||
| ) | bReplaceManySF(s, olds, __VA_ARGS__, NULL) |
Definition at line 1982 of file libsheepy.h.
| #define bLReplaceManyS | ( | s, | |
| sSize, | |||
| olds, | |||
| ... | |||
| ) | bLReplaceManySF(s, sSize, olds, __VA_ARGS__, NULL) |
Definition at line 1984 of file libsheepy.h.
| #define icReplaceS_max | ( | s, | |
| olds, | |||
| news | |||
| ) | icReplaceS(s,olds,news, 0) |
Definition at line 1991 of file libsheepy.h.
| #define icReplaceSMax icReplaceS_max |
Definition at line 1992 of file libsheepy.h.
| #define iicReplaceS_max | ( | s, | |
| olds, | |||
| news | |||
| ) | iicReplaceS(s,olds,news, 0) |
Definition at line 1997 of file libsheepy.h.
| #define iicReplaceSMax iicReplaceS_max |
Definition at line 1998 of file libsheepy.h.
| #define bicReplaceS_max | ( | s, | |
| olds, | |||
| news | |||
| ) | bicReplaceS(s,olds,news, 0) |
Definition at line 2000 of file libsheepy.h.
| #define bicReplaceSMax bicReplaceS_max |
Definition at line 2001 of file libsheepy.h.
| #define bLicReplaceS_max | ( | s, | |
| sSize, | |||
| olds, | |||
| news | |||
| ) | bLicReplaceS(s,sSize,olds,news, 0) |
Definition at line 2003 of file libsheepy.h.
| #define bLicReplaceSMax bLicReplaceS_max |
Definition at line 2004 of file libsheepy.h.
| #define icReplaceManyS | ( | s, | |
| ... | |||
| ) | icReplaceManySF(s, __VA_ARGS__, NULL) |
Definition at line 2008 of file libsheepy.h.
| #define iicReplaceManyS | ( | s, | |
| olds, | |||
| ... | |||
| ) | iicReplaceManySF(s, olds, __VA_ARGS__, NULL) |
Definition at line 2010 of file libsheepy.h.
| #define bicReplaceManyS | ( | s, | |
| olds, | |||
| ... | |||
| ) | bicReplaceManySF(s, olds, __VA_ARGS__, NULL) |
Definition at line 2012 of file libsheepy.h.
| #define bLicReplaceManyS | ( | s, | |
| sSize, | |||
| olds, | |||
| ... | |||
| ) | bLicReplaceManySF(s, sSize, olds, __VA_ARGS__, NULL) |
Definition at line 2014 of file libsheepy.h.
| #define strEq eqS |
Definition at line 2018 of file libsheepy.h.
| #define strIEq eqIS |
Definition at line 2024 of file libsheepy.h.
upper case and store the result in c and return the result
Definition at line 2127 of file libsheepy.h.
lower case and store the result in c and return the result
Definition at line 2137 of file libsheepy.h.
Definition at line 2159 of file libsheepy.h.
Definition at line 2160 of file libsheepy.h.
Definition at line 2161 of file libsheepy.h.
| #define codeSizeUTF8 | ( | utf8 | ) | codeSzUTF8[*(const uint8_t *)(utf8)] |
size in bytes of UTF-8 code point
Definition at line 2328 of file libsheepy.h.
| #define nextCodeUTF8 | ( | utf8 | ) | ((utf8) + codeSizeUTF8(utf8)) |
move pointer to next UTF-8 code point, no checks are done, the utf8 pointer parameter is unchanged
Definition at line 2331 of file libsheepy.h.
| #define nxtCodeUTF8 | ( | utf8 | ) | EVA(utf8, nextCodeUTF8(utf8)) |
change the utf8 pointer parameter to next UTF-8 code point, like char *s; s++;
Definition at line 2334 of file libsheepy.h.
| #define nxCodeUTF8 | ( | utf8 | ) | (utf8 = nextCodeUTF8(utf8)) |
Definition at line 2335 of file libsheepy.h.
| #define emptyS | ( | string | ) | string = strdup(""); |
Definition at line 2544 of file libsheepy.h.
| #define bEmptyS | ( | string | ) | (string)[0] = 0 |
Definition at line 2549 of file libsheepy.h.
| #define orS | ( | string, | |
| alternative | |||
| ) | !isEmptyS(string) ? (string) : (alternative) |
orS - if string is empty, the value is alternative
Definition at line 2558 of file libsheepy.h.
| #define orBlankS | ( | string, | |
| alternative | |||
| ) | !isBlankS(string) ? (string) : (alternative) |
blankS - if string is blank(white spaces) or empty, the value is alternative
Definition at line 2567 of file libsheepy.h.
| #define nS | ( | string | ) | (string) ? (string) : "" |
nS - null String - replace null string with "" string (empty string)
Definition at line 2573 of file libsheepy.h.
| #define nAS | ( | string, | |
| alternative | |||
| ) | (string) ? (string) : (alternative) |
nAS - null Alternative String - replace null string with alternative string
Definition at line 2579 of file libsheepy.h.
| #define listEmptyS | ( | list | ) |
Definition at line 2587 of file libsheepy.h.
| #define listCreateS | ( | ... | ) | listCreateSF("", __VA_ARGS__, NULL) |
Definition at line 2605 of file libsheepy.h.
| #define listFreeManyS | ( | ... | ) | listFreeManySF(NULL, __VA_ARGS__, NULL) |
Definition at line 2634 of file libsheepy.h.
| #define listCatS | ( | ... | ) | listCatSF(NULL, __VA_ARGS__, NULL) |
Definition at line 2710 of file libsheepy.h.
| #define forever while(1) |
forever loop
Definition at line 2765 of file libsheepy.h.
| #define range | ( | index, | |
| maxCount | |||
| ) |
range loop ;size_t UNIQVAR needed to avoid: error: a label can only be part of a statement and a declaration is not a statement on older compilers
Definition at line 2772 of file libsheepy.h.
| #define rangeInf | ( | index | ) | for (size_t index = 0 ;; index++) |
infinity loop increase the index infinitly
Definition at line 2780 of file libsheepy.h.
| #define rangeDown | ( | index, | |
| maxCount | |||
| ) | for (ssize_t index = (maxCount)-1 ; index >= 0 ; index--) |
range down loop, index is ssize_t
Definition at line 2786 of file libsheepy.h.
| #define rangeDownTo | ( | index, | |
| maxCount, | |||
| to | |||
| ) |
range down loop to to index, index is ssize_t ;ssize_t UNIQVAR needed to avoid: error: a label can only be part of a statement and a declaration is not a statement on older compilers
Definition at line 2794 of file libsheepy.h.
| #define rangeFrom | ( | index, | |
| from, | |||
| maxCount | |||
| ) |
range loop starting at value from ;size_t UNIQVAR needed to avoid: error: a label can only be part of a statement and a declaration is not a statement on older compilers
Definition at line 2803 of file libsheepy.h.
| #define arange | ( | index, | |
| array | |||
| ) | range(index, ARRAY_SIZE(array)) |
loop on the elements of C static array of any type
Example: u32 array[20]; arange(i, array) {}
Definition at line 2814 of file libsheepy.h.
| #define arangeDown | ( | index, | |
| array | |||
| ) | rangeDown(index, ARRAY_SIZE(array)) |
loop on the elements of C static array of any type from highest index down to 0
Example: u32 array[20]; arangeDown(i, array) {}
Definition at line 2823 of file libsheepy.h.
| #define arangeDownTo | ( | index, | |
| array, | |||
| to | |||
| ) | rangeDownTo(index, ARRAY_SIZE(array), to) |
loop on the elements of C static array of any type from highest index down to index 'to'
Example: u32 array[20]; arangeDownTo(i, array, 5) {}
Definition at line 2832 of file libsheepy.h.
| #define arangeFrom | ( | index, | |
| from, | |||
| array | |||
| ) | rangeFrom(index, from, ARRAY_SIZE(array)) |
loop on the elements of C static array of any type starting at index 'from'
Example: u32 array[20]; arange(i, 10, array) {}
Definition at line 2841 of file libsheepy.h.
| #define circular | ( | index, | |
| from, | |||
| maxCount | |||
| ) |
range from value from to maxCount-1 then from 0 to from-1
Example: circular(i, 2, 4)
counts: 2, 3, 0, 1
;bool UNIQVAR needed to avoid: error: a label can only be part of a statement and a declaration is not a statement on older compilers
Definition at line 2854 of file libsheepy.h.
| #define circularDown | ( | index, | |
| from, | |||
| maxCount | |||
| ) |
range from value from down to 0 then from maxCount-1 to from+1
Example: circularDown(i, 2, 4)
counts: 2, 1, 0, 3
;bool UNIQVAR needed to avoid: error: a label can only be part of a statement and a declaration is not a statement on older compilers
Definition at line 2871 of file libsheepy.h.
| #define rangeStep | ( | index, | |
| maxCount, | |||
| step | |||
| ) |
range step loop ;size_t UNIQVAR needed to avoid: error: a label can only be part of a statement and a declaration is not a statement on older compilers
Definition at line 2882 of file libsheepy.h.
| #define rangeDownStep | ( | index, | |
| maxCount, | |||
| step | |||
| ) | for (int64_t index = (maxCount)-1 ; index >= 0 ; index-=step) |
range down step loop, index is int64_t
Definition at line 2889 of file libsheepy.h.
| #define rangeFromStep | ( | index, | |
| from, | |||
| maxCount, | |||
| step | |||
| ) |
range step loop starting at value from ;size_t UNIQVAR needed to avoid: error: a label can only be part of a statement and a declaration is not a statement on older compilers
Definition at line 2897 of file libsheepy.h.
| #define loop | ( | maxCount | ) |
loops without index ;size_t UNIQVAR needed to avoid: error: a label can only be part of a statement and a declaration is not a statement on older compilers
Definition at line 2907 of file libsheepy.h.
| #define loopDownTo | ( | maxCount, | |
| to | |||
| ) |
loop to to index ;ssize_t UNIQVAR needed to avoid: error: a label can only be part of a statement and a declaration is not a statement on older compilers
Definition at line 2916 of file libsheepy.h.
| #define loopFrom | ( | from, | |
| maxCount | |||
| ) |
loop starting at value from ;size_t UNIQVAR needed to avoid: error: a label can only be part of a statement and a declaration is not a statement on older compilers
Definition at line 2925 of file libsheepy.h.
| #define loopStep | ( | maxCount, | |
| step | |||
| ) |
step loop ;size_t UNIQVAR needed to avoid: error: a label can only be part of a statement and a declaration is not a statement on older compilers
Definition at line 2934 of file libsheepy.h.
| #define loopFromStep | ( | from, | |
| maxCount, | |||
| step | |||
| ) |
step loop starting at value from ;size_t UNIQVAR needed to avoid: error: a label can only be part of a statement and a declaration is not a statement on older compilers
Definition at line 2943 of file libsheepy.h.
| #define aForEach | ( | array, | |
| element | |||
| ) |
loop on array elements element is a pointer to a value in the array
aForEach(array, e) { e->x = 0; }
Definition at line 2956 of file libsheepy.h.
| #define aEnumerate | ( | array, | |
| index, | |||
| element | |||
| ) |
enumerate array elements index is the position of the element in the array index is declared as size_t and is available after the loop element is a pointer to a value in the array
aEnumerate(array, i, e) { e->x = 0; printf("aEnumerate %d\n", i); }
Definition at line 2971 of file libsheepy.h.
| #define forEachCharP | ( | list, | |
| element | |||
| ) | for (char **element=list ; *element != NULL ; element++) |
forEach - loop macro on list indexes to access the element in the loop, use *element
Definition at line 2979 of file libsheepy.h.
| #define forEachCCharP | ( | list, | |
| element | |||
| ) | for (const char **element=list ; *element != NULL ; element++) |
forEach for const char** lists
Definition at line 2985 of file libsheepy.h.
| #define forEachS | ( | list, | |
| element | |||
| ) |
forEach - loop macro on list indexes to access the element in the loop, use element ;size_t UNIQVAR needed to avoid: error: a label can only be part of a statement and a declaration is not a statement on older compilers
Definition at line 2994 of file libsheepy.h.
| #define forEachCS | ( | list, | |
| element | |||
| ) |
forEach for const char** lists
Definition at line 3001 of file libsheepy.h.
| #define forEachType | ( | type, | |
| list, | |||
| element | |||
| ) | for (type **element=list ; *element != NULL ; element++) |
forEach - loop macro on list indexes
Definition at line 3008 of file libsheepy.h.
| #define enumerateCharP | ( | list, | |
| element, | |||
| index | |||
| ) |
enumerateCharP list to access the element in the loop, use *element ;size_t needed to avoid: error: a label can only be part of a statement and a declaration is not a statement on older compilers
Definition at line 3017 of file libsheepy.h.
| #define enumerateCCharP | ( | list, | |
| element, | |||
| index | |||
| ) |
enumerateCCharP const list to access the element in the loop, use *element ;size_t needed to avoid: error: a label can only be part of a statement and a declaration is not a statement on older compilers
Definition at line 3027 of file libsheepy.h.
| #define enumerateS | ( | list, | |
| element, | |||
| index | |||
| ) |
enumerateS list to acess the element in the loop, use element ;size_t needed to avoid: error: a label can only be part of a statement and a declaration is not a statement on older compilers
Definition at line 3037 of file libsheepy.h.
| #define enumerateCS | ( | list, | |
| element, | |||
| index | |||
| ) |
enumerateCS const list to acess the element in the loop, use element ;size_t needed to avoid: error: a label can only be part of a statement and a declaration is not a statement on older compilers
Definition at line 3047 of file libsheepy.h.
| #define enumerateType | ( | type, | |
| list, | |||
| element, | |||
| index | |||
| ) |
enumerateType list ;size_t needed to avoid: error: a label can only be part of a statement and a declaration is not a statement on older compilers
Definition at line 3056 of file libsheepy.h.
| #define lForEach | ( | node, | |
| startNode | |||
| ) | for(var node = startNode; node ; node = (node)->next) |
loop for linked lists from startNode to last
node must be a pointer to a struct with a next member pointing to the next node in the list
when node->next is NULL, the list end is reached
Definition at line 3068 of file libsheepy.h.
| #define lForEachDown | ( | node, | |
| startNode | |||
| ) | for(var node = startNode; node ; node = (node)->prev) |
loop for linked lists from startNode to head
node must be a pointer to a struct with a prev member pointing to the previous node in the list
when node->prev is NULL, the list head is reached
Definition at line 3079 of file libsheepy.h.
| #define lForEachPrev lForEachDown |
Definition at line 3082 of file libsheepy.h.
| #define execOutf systemOutf |
Definition at line 3119 of file libsheepy.h.
| #define execf systemf |
Definition at line 3120 of file libsheepy.h.
| #define systemOut execOut |
Definition at line 3125 of file libsheepy.h.
| #define logSystem | ( | cmd | ) |
Definition at line 3129 of file libsheepy.h.
| #define logExec logSystem |
Definition at line 3134 of file libsheepy.h.
| #define logSystemOut | ( | cmd | ) |
Definition at line 3135 of file libsheepy.h.
| #define logExecOut logSystemOut |
Definition at line 3140 of file libsheepy.h.
| #define logSystemOutf | ( | fmt, | |
| ... | |||
| ) |
Definition at line 3141 of file libsheepy.h.
| #define logExecOutf logSystemOutf |
Definition at line 3144 of file libsheepy.h.
| #define logSystemf | ( | fmt, | |
| ... | |||
| ) |
Definition at line 3145 of file libsheepy.h.
| #define logExecf logSystemf |
Definition at line 3148 of file libsheepy.h.
| #define command | ( | cmd | ) | commandF(cmd, __LINE__, __func__, __FILE__) |
Definition at line 3151 of file libsheepy.h.
| #define commandf | ( | ... | ) | commandfF(__LINE__, __func__, __FILE__, __VA_ARGS__) |
Definition at line 3153 of file libsheepy.h.
| #define commandNFree | ( | cmd | ) | commandNFreeF(cmd, __LINE__, __func__, __FILE__) |
Definition at line 3155 of file libsheepy.h.
| #define commandOut execOut |
Definition at line 3157 of file libsheepy.h.
| #define commandOutf systemOutf |
Definition at line 3158 of file libsheepy.h.
| #define logCommand | ( | cmd | ) |
Definition at line 3161 of file libsheepy.h.
| #define logCommandf | ( | fmt, | |
| ... | |||
| ) |
Definition at line 3167 of file libsheepy.h.
| #define logCommandNFree | ( | cmd | ) |
Definition at line 3172 of file libsheepy.h.
| #define logCommandOut logExecOut |
Definition at line 3178 of file libsheepy.h.
| #define logCommandOutf logExecOutf |
Definition at line 3179 of file libsheepy.h.
| #define logBtrace char **UNIQVAR(r)=btrace();if(UNIQVAR(r)){logN("\n"BLD WHT"Backtrace:"RST);forEachS(UNIQVAR(r), element){logN(element);}listFreeS(UNIQVAR(r));logN("---");} |
Definition at line 3249 of file libsheepy.h.
| #define logEBtrace if (btraceCfg) { char **UNIQVAR(r)=btrace();if(UNIQVAR(r)){logE("\n"BLD WHT"Backtrace:"RST);forEachS(UNIQVAR(r), element){logE(element);}listFreeS(UNIQVAR(r));logE("---");} } |
print backtrace in error messages, default is on, use btraceEnable and btraceDisable to configure
Definition at line 3255 of file libsheepy.h.
| #define listEmpty | ( | list | ) |
Definition at line 3263 of file libsheepy.h.
| #define listCreate | ( | ... | ) | listCreateF(NULL, __VA_ARGS__, NULL) |
Definition at line 3277 of file libsheepy.h.
| #define listFreeMany | ( | ... | ) | listFreeManyF(NULL, __VA_ARGS__, NULL) |
Definition at line 3301 of file libsheepy.h.
| #define listCat | ( | ... | ) | listCatF(NULL, __VA_ARGS__, NULL) |
Definition at line 3321 of file libsheepy.h.
| #define newPtr | ( | name, | |
| type | |||
| ) | ;type *name = malloc(sizeof(type)) |
Definition at line 3364 of file libsheepy.h.
| #define new0Ptr | ( | name, | |
| type | |||
| ) | ;type *name = calloc(1, sizeof(type)) |
Definition at line 3368 of file libsheepy.h.
| #define allocAPtr | ( | name | ) | name = malloc(sizeof(*(name))) |
Definition at line 3372 of file libsheepy.h.
| #define callocAPtr | ( | name | ) | name = calloc(1, sizeof(*(name))) |
Definition at line 3375 of file libsheepy.h.
| #define newArray | ( | name, | |
| type, | |||
| count | |||
| ) | ;type *name = malloc((count) * sizeof(type)) |
Definition at line 3378 of file libsheepy.h.
| #define new0Array | ( | name, | |
| type, | |||
| count | |||
| ) | ;type *name = calloc(count, sizeof(type)) |
Definition at line 3382 of file libsheepy.h.
| #define allocArray | ( | name, | |
| count | |||
| ) | malloc((count) * sizeof(*(name))) |
Definition at line 3386 of file libsheepy.h.
| #define allocAArray | ( | name, | |
| count | |||
| ) | name = malloc((count) * sizeof(*(name))) |
Definition at line 3389 of file libsheepy.h.
| #define callocArray | ( | name, | |
| count | |||
| ) | calloc(count, sizeof(*(name))) |
Definition at line 3392 of file libsheepy.h.
| #define callocAArray | ( | name, | |
| count | |||
| ) | name = calloc(count, sizeof(*(name))) |
Definition at line 3395 of file libsheepy.h.
| #define reallocArray | ( | name, | |
| count | |||
| ) | realloc(name, (count) * sizeof(*(name))) |
Definition at line 3398 of file libsheepy.h.
| #define sliceSz 1 |
slice - dynamic array in one chunk of memory (similar to vector and slab below)
This is a simple dynamic array holding element count and the data
this type of array has a dynamic element count pushing elements into the array increases the element count poping elements only decreases the element count, call sliceFit to realloc the slice
no sanity checks are done
the prefix is slice
Usage:
to declare a slice:
typeName slce;
sliceInit(&slce); or sliceInitCount(&slce, 17);
// get an element int a = sliceAt(&slce, 0);
set sliceAt(&slce, 1) = 3;
Slice variables: slce.array: elements slce.count: current element count
Note: some functions are macros to be able to have structs as element and access the struct members directly, for example: sliceLast(chan).a = 0;number of elements added by sliceAlloc
Definition at line 3445 of file libsheepy.h.
| #define sliceT | ( | typeName, | |
| elementType | |||
| ) |
declares type for slice
| typeName | slice type name |
| element | type of elements (int, struct, pointer...) |
Definition at line 3455 of file libsheepy.h.
| #define createSlice | ( | typeName, | |
| name | |||
| ) | ;typeName name; sliceInit(&name) |
Definition at line 3461 of file libsheepy.h.
| #define createSliceCount | ( | typeName, | |
| name, | |||
| count | |||
| ) | ;typeName name; sliceInitCount(&name, count) |
Definition at line 3463 of file libsheepy.h.
| #define createSliceClearCount | ( | typeName, | |
| name, | |||
| count | |||
| ) | ;typeName name; sliceCalloc(&name, count) |
Definition at line 3465 of file libsheepy.h.
| #define createAllocateSlice | ( | typeName, | |
| name | |||
| ) | ;typeName *name = calloc(1, sizeof(typeName)) |
Definition at line 3467 of file libsheepy.h.
| #define createAllocateSliceCount | ( | typeName, | |
| name, | |||
| count | |||
| ) | ;typeName *name = calloc(1, sizeof(typeName)); sliceInitCount(name, count) |
Definition at line 3469 of file libsheepy.h.
| #define createAllocateSliceClearCount | ( | typeName, | |
| name, | |||
| count | |||
| ) | ;typeName *name = calloc(1, sizeof(typeName)); sliceCalloc(name, count) |
Definition at line 3471 of file libsheepy.h.
Definition at line 3473 of file libsheepy.h.
| #define sliceInit | ( | name | ) |
initialize empty slice
| name | variable name for slice |
Definition at line 3481 of file libsheepy.h.
| #define sliceInitCount | ( | name, | |
| countInt | |||
| ) |
initialize slice and count
| name | variable name for slice |
| count | initial element count for name type |
Definition at line 3494 of file libsheepy.h.
| #define sliceCalloc | ( | name, | |
| countInt | |||
| ) |
initialize slice and count and set slice data to 0
| name | variable name for slice |
| count | initial element count for name type |
Definition at line 3509 of file libsheepy.h.
| #define sliceResize | ( | name, | |
| countInt | |||
| ) |
resize slice (even empty slices)
Definition at line 3518 of file libsheepy.h.
| #define sliceClearResize | ( | name, | |
| countInt | |||
| ) |
resize slice and clear the new elements with memset even empty slices can be resized and cleared
Definition at line 3536 of file libsheepy.h.
| #define sliceElemType | ( | name | ) | typeof((name)->array[0]) |
element type in slice
Definition at line 3565 of file libsheepy.h.
| #define sliceElemPtrType | ( | name | ) | typeof(&(name)->array[0]) |
element pointer type in slice
Definition at line 3570 of file libsheepy.h.
| #define sliceDup | ( | name | ) |
duplicate slice
Definition at line 3575 of file libsheepy.h.
| #define sliceCreateNDup | ( | name, | |
| dest | |||
| ) | ;typeof(*(name)) dest; sliceInitCount(&dest, (name)->count); if ((name)->array) { memcpy(dest.array, (name)->array, (name)->count * sizeof (name)->array[0]); dest.count = (name)->count;} |
assign slice from to slice to the data is shared between slice from and slice to the counts are not shared
NO need for this macro, do like this: *to = *from; declare dest slice and duplicate slice
Definition at line 3601 of file libsheepy.h.
| #define sliceBDup | ( | name, | |
| dest | |||
| ) |
duplicate slice to already declared dest slice
Definition at line 3606 of file libsheepy.h.
| #define sliceData | ( | name | ) | (name)->array |
direct access to underlying array
Definition at line 3619 of file libsheepy.h.
| #define sliceFrom | ( | name, | |
| array, | |||
| countInt | |||
| ) |
| #define sliceMirror | ( | name, | |
| start, | |||
| end | |||
| ) |
mirror a range in a slice the data is not copied to dest slice, to copy data see sliceCopy or sliceBCopy
Definition at line 3638 of file libsheepy.h.
| #define sliceBMirror | ( | name, | |
| dest, | |||
| start, | |||
| end | |||
| ) |
mirror a range in a slice the data is not copied to dest slice, to copy data see sliceCopy or sliceBCopy
name can be slice, vector or slab dest must be slice
Definition at line 3653 of file libsheepy.h.
| #define sliceMirrorFrom | ( | name, | |
| array, | |||
| countInt | |||
| ) |
mirror from array to slice the data is not copied to dest slice, to copy data see sliceCopy or sliceBCopy
Definition at line 3664 of file libsheepy.h.
| #define sliceClear | ( | name | ) |
set 0 in slice elements count is unchanged
Definition at line 3675 of file libsheepy.h.
| #define sliceClearRange | ( | name, | |
| start, | |||
| end | |||
| ) |
Definition at line 3680 of file libsheepy.h.
| #define sliceEmpty | ( | name | ) | (name)->count = 0 |
Empty slice Set count to 0 Allocated buffers in the slice must be freed before running sliceEmpty.
Definition at line 3690 of file libsheepy.h.
| #define sliceIsEmpty | ( | name | ) | ((name)->count == 0 || !(name)->array) |
is slice Empty
Definition at line 3695 of file libsheepy.h.
| #define sliceFit | ( | name | ) |
realloc slice to count
Definition at line 3700 of file libsheepy.h.
| #define sliceCount | ( | name | ) | (name)->count |
return element count
Definition at line 3707 of file libsheepy.h.
| #define sliceElemSize | ( | name | ) | sizeof((name)->array[0]) |
size of slice element
Definition at line 3712 of file libsheepy.h.
| #define sliceAlloc | ( | name | ) |
allocate an element only when the slice is full
Definition at line 3718 of file libsheepy.h.
clear (set 0) in element at index
Definition at line 3730 of file libsheepy.h.
| #define slicePush | ( | name | ) |
push element and expand the slice no data (random) is set in the new element
| name | slice |
Definition at line 3739 of file libsheepy.h.
| #define sliceAppend | ( | name, | |
| v | |||
| ) |
append element and expand the slice
| name | slice |
| v | element to push |
Definition at line 3752 of file libsheepy.h.
| #define sliceClearPush | ( | name | ) |
push element and expand the slice the new element is cleared
| name | slice |
Definition at line 3765 of file libsheepy.h.
| #define slicePop | ( | name | ) | ((name)->count--, (name)->array[(name)->count]) |
pop element the element count is decreased
NOTE: using comma operator to avoid warning warning: operation on ‘b.head’ may be undefined [-Wsequence-point]
| name | slice |
Definition at line 3781 of file libsheepy.h.
| #define sliceDelLast | ( | name | ) | ((name)->count--) |
delete the last element useful for avoiding warning: right-hand operand of comma expression has no effect when the poped value is not used
Definition at line 3788 of file libsheepy.h.
| #define sliceSet | ( | name, | |
| index, | |||
| v | |||
| ) |
set value at index and clearResize slice when index is outside slice count
Definition at line 3793 of file libsheepy.h.
| #define sliceAt | ( | name, | |
| index | |||
| ) | ((name)->array[index]) |
get / set element at index
| name | slice |
| index | index in array |
Definition at line 3810 of file libsheepy.h.
| #define slicePtr | ( | name, | |
| index | |||
| ) | ((name)->array + index) |
get pointer to element at index
| name | slice |
| index | index in array |
Definition at line 3820 of file libsheepy.h.
| #define sliceLast | ( | name | ) | ((name)->array[(name)->count-1]) |
| #define sliceLastPtr | ( | name | ) | ((name)->array + (name)->count - 1) |
| #define sliceLastIndex | ( | name | ) | ((name)->count - 1) |
index of last element
Definition at line 3841 of file libsheepy.h.
| #define sliceFirst | ( | name | ) | ((name)->array[0]) |
| #define sliceWriteFilename | ( | name, | |
| filename | |||
| ) |
write the slice content to filename file No NULL checks are done on the parameters
| filename | file name string |
Definition at line 3860 of file libsheepy.h.
| #define sliceWrite | ( | name, | |
| file | |||
| ) | fwrite((name)->array, sizeof((name)->array[0]), sliceCount(name), file) |
write the slice content to disk No NULL checks are done on the parameters
| file | already opened file |
Definition at line 3875 of file libsheepy.h.
| #define sliceReadFilename | ( | name, | |
| filename | |||
| ) |
read a slice from filename file No NULL checks are done on the parameters
| filename | file name string |
Definition at line 3884 of file libsheepy.h.
| #define sliceRead | ( | name, | |
| file | |||
| ) |
read a slice from disk No NULL checks are done on the parameters
| file | already opened file |
Definition at line 3905 of file libsheepy.h.
| #define forEachSc | ( | name, | |
| index | |||
| ) | range(index, (name)->count) |
loop index on slice elements
For example: forEachV(vec, i) { sliceAt(vec, i) = 0; }
Definition at line 3924 of file libsheepy.h.
| #define sliceForEach | ( | name, | |
| element | |||
| ) |
loop on slice elements element is a pointer to a value in the array
sliceForEach(&slc, e) { e->x = 0; }
Definition at line 3934 of file libsheepy.h.
| #define sliceEnumerate | ( | name, | |
| index, | |||
| element | |||
| ) |
enumerate slice elements index is the position of the element in the array index is declared as size_t and is available after the loop element is a pointer to a value in the array
sliceEnumerate(&slc, i, e) { e->x = 0; printf("sliceEnumerate %d\n", i); }
Definition at line 3949 of file libsheepy.h.
| #define sliceInject | ( | name, | |
| index | |||
| ) |
insert an element at index the data is moved to create space for the new element to set data at the new element, use sliceAt(name, index) = value;
Definition at line 3958 of file libsheepy.h.
| #define slicePrepend | ( | name, | |
| v | |||
| ) |
prepend element
| name | slice |
| v | element to prepend |
Definition at line 3974 of file libsheepy.h.
| #define sliceDequeue | ( | name | ) |
dequeue element
| name | slice |
Definition at line 3985 of file libsheepy.h.
| #define sliceDelFirst | ( | name | ) |
delete first element in slice the data is moved when count > 1
Definition at line 3995 of file libsheepy.h.
| #define sliceDelElem | ( | name, | |
| index | |||
| ) |
delete an element in slice the data is moved when index < (count-1) when index = count -1, the last element is deleted and no data is moved
Definition at line 4011 of file libsheepy.h.
| #define sliceDel | ( | name, | |
| start, | |||
| end | |||
| ) |
delete range in slice start must be between 0 and last index end must be between 1 and count
Definition at line 4025 of file libsheepy.h.
| #define sliceVAppend | ( | name, | |
| slice | |||
| ) |
append slice to slice name the data is copied
Definition at line 4039 of file libsheepy.h.
| #define sliceAppendFrom | ( | name, | |
| array, | |||
| countInt | |||
| ) |
append array to slice the data is copied
Definition at line 4052 of file libsheepy.h.
| #define sliceVPrepend | ( | name, | |
| slice | |||
| ) |
prepend slice to slice name the data in slice name is moved and the data in slice is copied to slice name
Definition at line 4067 of file libsheepy.h.
| #define slicePrependFrom | ( | name, | |
| array, | |||
| countInt | |||
| ) |
prepend array to slice the data in slice is moved and the data in array is copied to slice
Definition at line 4082 of file libsheepy.h.
| #define sliceInsert | ( | name, | |
| index, | |||
| slice | |||
| ) |
insert slice at position index the data in slice name is moved and the data in slice is copied to slice name
Definition at line 4098 of file libsheepy.h.
| #define sliceInsertFrom | ( | name, | |
| index, | |||
| array, | |||
| countInt | |||
| ) |
insert array at position index the data in slice is moved and the data in array is copied to slice
Definition at line 4117 of file libsheepy.h.
| #define sliceSlice | ( | name, | |
| start, | |||
| end | |||
| ) |
slice slice, keep only elements between start and end start must be between 0 and last index end must be between 1 and count the slice is returned
Definition at line 4138 of file libsheepy.h.
| #define sliceCopy | ( | name, | |
| start, | |||
| end | |||
| ) |
copy slice elements between start and end to a new slice start must be between 0 and last index end must be between 1 and count the new slice is returned and must be freed with sliceTerminate
Definition at line 4153 of file libsheepy.h.
| #define sliceBCopy | ( | name, | |
| dest, | |||
| start, | |||
| end | |||
| ) |
copy slice elements between start and end to the dest slice start must be between 0 and last index end must be between 1 and count
Definition at line 4167 of file libsheepy.h.
| #define sliceSort | ( | name, | |
| compareFunction | |||
| ) |
sort the slice the compareFunction must prototype of type: int cmp(const void * a, const void * b); the results of the compareFunction should be: <0 when a < b 0 when a = b >0 when a > b
Definition at line 4186 of file libsheepy.h.
| #define sliceEq | ( | name, | |
| slice, | |||
| eqFunction | |||
| ) |
return true when slice name is equal to slice eqFunction should return true when the elements are equal eqFunction can be either a macro or a function
Definition at line 4195 of file libsheepy.h.
| #define sliceHas | ( | name, | |
| value, | |||
| eqFunction | |||
| ) |
return true when slice has value eqFunction should return true when the elements are equal eqFunction can be either a macro or a function
Definition at line 4215 of file libsheepy.h.
| #define sliceIndexOf | ( | name, | |
| value, | |||
| eqFunction | |||
| ) |
return index (ssize_t) of value in slice eqFunction should return true when the elements are equal eqFunction can be either a macro or a function
return value is -1 when value is not found
Definition at line 4234 of file libsheepy.h.
| #define sliceBinarySearch | ( | name, | |
| value, | |||
| less, | |||
| equal | |||
| ) |
binary search value in slice
efficiently finds the index of value in slice the slice has to be sorted before calling sliceBinarySearch
less is a macro taking an index and the search value returning 1 when sliceAt(name,index) is less than value: #define less(index, value) sliceAt(name, index) < value
equal is a macro returning 1 when sliceAt(name,index) is equal to value: #define equal(index, value) sliceAt(name,index) == value
return value is -1 when value is not found
Definition at line 4260 of file libsheepy.h.
| #define sliceUniq | ( | name, | |
| eqFunction | |||
| ) |
Uniquify elements in slice each elements are unique in the slice.
eqFunction should return true when the elements are equal eqFunction can be either a macro or a function
Definition at line 4274 of file libsheepy.h.
| #define staticSliceT | ( | typeName, | |
| elementType, | |||
| MAXCOUNT | |||
| ) |
staticSlice - static array with element count
pushing elements into the array increases the element count poping elements only decreases the element count
no sanity checks are done
the prefix is staticSlice
Usage:
to declare a staticSlice:
staticSliceT(typeName, type, 10);
typeName slce;
staticSliceAppend(&slce, value);
// get an element int a = staticSliceAt(&slce, 0);
set staticSliceAt(&slce, 1) = 3;
staticSliceFree(&slce);
StaticSlice variables: slce.array: elements slce.count: current element count
Note: some functions are macros to be able to have structs as element and access the struct members directly, for example: staticSliceLast(chan).a = 0; declares type for staticSlice
| typeName | staticSlice type name |
| element | type of elements (int, struct, pointer...) |
| MAXCOUNT | array/ring buffer size |
Definition at line 4360 of file libsheepy.h.
| #define createStaticSlice | ( | typeName, | |
| name | |||
| ) | ;typeName name; staticSliceInit(&name) |
Definition at line 4366 of file libsheepy.h.
| #define staticSliceInit | ( | name | ) |
initialize empty staticSlice
| name | variable name for staticSlice |
Definition at line 4374 of file libsheepy.h.
| #define staticSliceElemType | ( | name | ) | typeof((name)->array[0]) |
element type in slice
Definition at line 4381 of file libsheepy.h.
| #define staticSliceElemPtrType | ( | name | ) | typeof(&(name)->array[0]) |
element pointer type in slice
Definition at line 4386 of file libsheepy.h.
| #define staticSliceBDup | ( | name, | |
| dest | |||
| ) |
duplicate staticSlice to already declared dest staticSlice
Definition at line 4391 of file libsheepy.h.
| #define staticSliceData sliceData |
direct access to underlying array
Definition at line 4403 of file libsheepy.h.
| #define staticSliceFrom | ( | name, | |
| array, | |||
| countInt | |||
| ) |
copy data from array to staticSlice
Definition at line 4408 of file libsheepy.h.
set 0 in staticSlice elements count is unchanged
Definition at line 4422 of file libsheepy.h.
| #define staticSliceClearRange | ( | name, | |
| start, | |||
| end | |||
| ) | memset((name)->array + start, 0, (end-start) * sizeof (name)->array[0]) |
Definition at line 4424 of file libsheepy.h.
| #define staticSliceEmpty sliceEmpty |
Empty staticSlice Set count to 0 Allocated buffers in the staticSlice must be freed before running staticSliceEmpty.
Definition at line 4431 of file libsheepy.h.
| #define staticSliceIsEmpty | ( | name | ) | ((name)->count == 0) |
is staticSlice Empty
Definition at line 4436 of file libsheepy.h.
| #define staticSliceCount sliceCount |
return element count
Definition at line 4441 of file libsheepy.h.
| #define staticSliceElemSize sliceElemSize |
size of staticSlice element
Definition at line 4446 of file libsheepy.h.
| #define staticSliceClearElem sliceClearElem |
clear (set 0) in element at index
Definition at line 4451 of file libsheepy.h.
| #define staticSlicePush | ( | name | ) | (name)->count++ |
push element and expand the staticSlice no data (random) is set in the new element
| name | staticSlice |
Definition at line 4460 of file libsheepy.h.
| #define staticSliceAppend | ( | name, | |
| v | |||
| ) |
append element and expand the staticSlice
| name | staticSlice |
| v | element to push |
Definition at line 4470 of file libsheepy.h.
| #define staticSliceClearPush | ( | name | ) |
push element and expand the staticSlice the new element is cleared
| name | staticSlice |
Definition at line 4483 of file libsheepy.h.
| #define staticSlicePop slicePop |
pop element the element count is decreased
NOTE: using comma operator to avoid warning warning: operation on ‘b.head’ may be undefined [-Wsequence-point]
| name | staticSlice |
Definition at line 4499 of file libsheepy.h.
| #define staticSliceDelLast sliceDelLast |
delete the last element useful for avoiding warning: right-hand operand of comma expression has no effect when the poped value is not used
Definition at line 4506 of file libsheepy.h.
| #define staticSliceAt sliceAt |
get / set element at index
| name | staticSlice |
| index | index in array |
Definition at line 4516 of file libsheepy.h.
| #define staticSlicePtr slicePtr |
get pointer to element at index
| name | staticSlice |
| index | index in array |
Definition at line 4526 of file libsheepy.h.
| #define staticSliceLast sliceLast |
| #define staticSliceLastPtr sliceLastPtr |
| #define staticSliceLastIndex sliceLastIndex |
index of last element
Definition at line 4547 of file libsheepy.h.
| #define staticSliceFirst sliceFirst |
| #define staticSliceWriteFilename sliceWriteFilename |
write the staticSlice content to filename file No NULL checks are done on the parameters
| filename | file name string |
Definition at line 4566 of file libsheepy.h.
| #define staticSliceWrite sliceWrite |
write the staticSlice content to disk No NULL checks are done on the parameters
| file | already opened file |
Definition at line 4575 of file libsheepy.h.
| #define staticSliceReadFilename | ( | name, | |
| filename | |||
| ) |
read a staticSlice from filename file No NULL checks are done on the parameters
| filename | file name string |
Definition at line 4584 of file libsheepy.h.
| #define staticSliceRead | ( | name, | |
| file | |||
| ) |
read a staticSlice from disk No NULL checks are done on the parameters
| file | already opened file |
Definition at line 4605 of file libsheepy.h.
| #define forEachSSc forEachSc |
loop index on staticSlice elements
For example: forEachV(vec, i) { staticSliceAt(vec, i) = 0; }
Definition at line 4624 of file libsheepy.h.
| #define staticSliceForEach | ( | name, | |
| element | |||
| ) |
loop on slice elements element is a pointer to a value in the array
staticSliceForEach(&slc, e) { e->x = 0; }
Definition at line 4634 of file libsheepy.h.
| #define staticSliceEnumerate | ( | name, | |
| index, | |||
| element | |||
| ) |
enumerate slice elements index is the position of the element in the array index is declared as size_t and is available after the loop element is a pointer to a value in the array
sliceEnumerate(&slc, i, e) { e->x = 0; printf("sliceEnumerate %d\n", i); }
Definition at line 4649 of file libsheepy.h.
| #define staticSliceInject | ( | name, | |
| index | |||
| ) |
insert an element at index the data is moved to create space for the new element to set data at the new element, use staticSliceAt(name, index) = value;
Definition at line 4658 of file libsheepy.h.
| #define staticSlicePrepend | ( | name, | |
| v | |||
| ) |
prepend element
| name | staticSlice |
| v | element to prepend |
Definition at line 4672 of file libsheepy.h.
| #define staticSliceDequeue sliceDequeue |
| #define staticSliceDelFirst sliceDelFirst |
delete first element in staticSlice the data is moved when count > 1
Definition at line 4689 of file libsheepy.h.
| #define staticSliceDelElem sliceDelElem |
delete an element in staticSlice the data is moved when index < (count-1) when index = count -1, the last element is deleted and no data is moved
Definition at line 4697 of file libsheepy.h.
| #define staticSliceDel sliceDel |
delete range in staticSlice start must be between 0 and last index end must be between 1 and count
Definition at line 4704 of file libsheepy.h.
| #define staticSliceVAppend | ( | name, | |
| staticSlice | |||
| ) |
append staticSlice to staticSlice name the data is copied
Definition at line 4710 of file libsheepy.h.
| #define staticSliceAppendFrom | ( | name, | |
| array, | |||
| countInt | |||
| ) |
append array to staticSlice the data is copied
Definition at line 4722 of file libsheepy.h.
| #define staticSliceVPrepend | ( | name, | |
| staticSlice | |||
| ) |
prepend staticSlice to staticSlice name the data in staticSlice name is moved and the data in staticSlice is copied to staticSlice name
Definition at line 4736 of file libsheepy.h.
| #define staticSlicePrependFrom | ( | name, | |
| array, | |||
| countInt | |||
| ) |
prepend array to staticSlice the data in staticSlice is moved and the data in array is copied to staticSlice
Definition at line 4750 of file libsheepy.h.
| #define staticSliceInsert | ( | name, | |
| index, | |||
| staticSlice | |||
| ) |
insert staticSlice at position index the data in staticSlice name is moved and the data in staticSlice is copied to staticSlice name
Definition at line 4766 of file libsheepy.h.
| #define staticSliceInsertFrom | ( | name, | |
| index, | |||
| array, | |||
| countInt | |||
| ) |
insert array at position index the data in staticSlice is moved and the data in array is copied to staticSlice
Definition at line 4784 of file libsheepy.h.
| #define staticSliceSlice sliceSlice |
staticSlice staticSlice, keep only elements between start and end start must be between 0 and last index end must be between 1 and count the staticSlice is returned
Definition at line 4804 of file libsheepy.h.
| #define staticSliceBCopy | ( | name, | |
| dest, | |||
| start, | |||
| end | |||
| ) |
copy staticSlice elements between start and end to the dest staticSlice start must be between 0 and last index end must be between 1 and count
Definition at line 4811 of file libsheepy.h.
| #define staticSliceSort sliceSort |
sort the staticSlice the compareFunction must prototype of type: int cmp(const void * a, const void * b); the results of the compareFunction should be: <0 when a < b 0 when a = b >0 when a > b
Definition at line 4830 of file libsheepy.h.
| #define staticSliceEq sliceEq |
return true when staticSlice name is equal to staticSlice eqFunction should return true when the elements are equal eqFunction can be either a macro or a function
Definition at line 4837 of file libsheepy.h.
| #define staticSliceHas sliceHas |
return true when staticSlice has value eqFunction should return true when the elements are equal eqFunction can be either a macro or a function
Definition at line 4844 of file libsheepy.h.
| #define staticSliceIndexOf sliceIndexOf |
return index (ssize_t) of value in staticSlice eqFunction should return true when the elements are equal eqFunction can be either a macro or a function
return value is -1 when value is not found
Definition at line 4853 of file libsheepy.h.
| #define staticSliceBinarySearch sliceBinarySearch |
binary search value in staticSlice
efficiently finds the index of value in staticSlice the staticSlice has to be sorted before calling staticSliceBinarySearch
less is a macro taking an index and the search value returning 1 when staticSliceAt(name,index) is less than value: #define less(index, value) staticSliceAt(name, index) < value
equal is a macro returning 1 when staticSliceAt(name,index) is equal to value: #define equal(index, value) staticSliceAt(name,index) == value
return value is -1 when value is not found
Definition at line 4869 of file libsheepy.h.
| #define staticSliceUniq sliceUniq |
Uniquify elements in staticSlice each elements are unique in the staticSlice.
eqFunction should return true when the elements are equal eqFunction can be either a macro or a function
Definition at line 4878 of file libsheepy.h.
| #define vectorSz 1 |
vector - dynamic array in one chunk of memory (similar to slab below)
This is a simple dynamic array holding element count, maximum element count and the data
vector supports shrinking through vectorResize
this type of array has a dynamic element count pushing elements into the array increases the element count poping elements only decreases the element count, call vectorFit to resize the vector
no sanity checks are done
the prefix is vector
Usage:
to declare a vector:
typeName vectr;
vectorInit(&vectr); or vectorInitCount(&vectr, 17);
// get an element int a = vectorAt(&vectr, 0);
set vectorAt(&vectr, 1) = 3;
Vector variables: vectr.array: elements vectr.count: current element count vectr.maxCount: maximum element count allowed
Note: some functions are macros to be able to have structs as element and access the struct members directly, for example: vectorLast(chan).a = 0;number of elements added by vectorAlloc
Definition at line 4932 of file libsheepy.h.
| #define vectorT | ( | typeName, | |
| elementType | |||
| ) |
declares type for vector
| typeName | vector type name |
| element | type of elements (int, struct, pointer...) |
Definition at line 4942 of file libsheepy.h.
| #define createVector | ( | typeName, | |
| name | |||
| ) | ;typeName name; vectorInit(&name) |
Definition at line 4950 of file libsheepy.h.
| #define createVectorCount | ( | typeName, | |
| name, | |||
| count | |||
| ) | ;typeName name; vectorInitCount(&name, count) |
Definition at line 4952 of file libsheepy.h.
| #define createVectorClearCount | ( | typeName, | |
| name, | |||
| count | |||
| ) | ;typeName name; vectorCalloc(&name, count) |
Definition at line 4954 of file libsheepy.h.
| #define createAllocateVector | ( | typeName, | |
| name | |||
| ) | ;typeName *name = calloc(1, sizeof(typeName)) |
Definition at line 4956 of file libsheepy.h.
| #define createAllocateVectorCount | ( | typeName, | |
| name, | |||
| count | |||
| ) | ;typeName *name = calloc(1, sizeof(typeName)); vectorInitCount(name, count) |
Definition at line 4958 of file libsheepy.h.
| #define createAllocateVectorClearCount | ( | typeName, | |
| name, | |||
| count | |||
| ) | ;typeName *name = calloc(1, sizeof(typeName)); vectorCalloc(name, count) |
Definition at line 4960 of file libsheepy.h.
| #define vectorTerminate | ( | name | ) | if (name) vectorFree(name);free(name) |
Definition at line 4962 of file libsheepy.h.
| #define vectorInit | ( | name | ) |
initialize empty vector
| name | variable name for vector |
Definition at line 4970 of file libsheepy.h.
| #define vectorInitCount | ( | name, | |
| countInt | |||
| ) |
initialize vector and count
| name | variable name for vector |
| count | initial element count for name type |
Definition at line 4984 of file libsheepy.h.
| #define vectorCalloc | ( | name, | |
| countInt | |||
| ) |
initialize vector and count and set vector data to 0
| name | variable name for vector |
| count | initial element count for name type |
Definition at line 4999 of file libsheepy.h.
| #define vectorResize | ( | name, | |
| countInt | |||
| ) |
resize vector (even empty vectors)
Definition at line 5009 of file libsheepy.h.
| #define vectorClearResize | ( | name, | |
| countInt | |||
| ) |
resize vector and clear the new elements with memset even empty vectors can be resized and cleared
Definition at line 5028 of file libsheepy.h.
| #define vectorFree sliceFree |
| #define vectorElemType | ( | name | ) | typeof((name)->array[0]) |
element type in vector
Definition at line 5058 of file libsheepy.h.
| #define vectorElemPtrType | ( | name | ) | typeof(&(name)->array[0]) |
element pointer type in vector
Definition at line 5063 of file libsheepy.h.
| #define vectorDup | ( | name | ) |
duplicate vector
Definition at line 5068 of file libsheepy.h.
| #define vectorCreateNDup | ( | name, | |
| dest | |||
| ) | ;typeof(*(name)) dest; vectorInitCount(dest, (name)->count); if ((name)->array) { memcpy(dest->array, (name)->array, (name)->count * sizeof (name)->array[0]); dest->count = (name)->count;} |
declare dest vector and duplicate vector
Definition at line 5080 of file libsheepy.h.
| #define vectorBDup | ( | name, | |
| dest | |||
| ) |
duplicate vector to already declared dest vector
Definition at line 5085 of file libsheepy.h.
| #define vectorData sliceData |
direct access to underlying array
Definition at line 5097 of file libsheepy.h.
| #define vectorFrom | ( | name, | |
| array, | |||
| countInt | |||
| ) |
copy data from array to vector
Definition at line 5102 of file libsheepy.h.
| #define vectorClear sliceClear |
set 0 in vector elements count is unchanged
Definition at line 5117 of file libsheepy.h.
| #define vectorClearRange sliceClearRange |
Definition at line 5119 of file libsheepy.h.
| #define vectorEmpty sliceEmpty |
Empty vector Set count to 0 Allocated buffers in the vector must be freed before running vectorEmpty.
Definition at line 5126 of file libsheepy.h.
| #define vectorIsEmpty sliceIsEmpty |
is vector Empty
Definition at line 5131 of file libsheepy.h.
| #define vectorFit | ( | name | ) |
resize vector from maxCount to count
Definition at line 5136 of file libsheepy.h.
| #define vectorCount sliceCount |
return element count
Definition at line 5145 of file libsheepy.h.
| #define vectorMaxCount | ( | name | ) | (name)->maxCount |
return max element count
Definition at line 5150 of file libsheepy.h.
| #define vectorElemSize sliceElemSize |
size of vector element
Definition at line 5155 of file libsheepy.h.
| #define vectorAlloc | ( | name | ) |
allocate an element only when the vector is full
Definition at line 5161 of file libsheepy.h.
| #define vectorClearElem sliceClearElem |
clear (set 0) in element at index
Definition at line 5175 of file libsheepy.h.
| #define vectorPush | ( | name | ) |
push element and expand the vector no data (random) is set in the new element
| name | vector |
Definition at line 5184 of file libsheepy.h.
| #define vectorAppend | ( | name, | |
| v | |||
| ) |
append element and expand the vector
| name | vector |
| v | element to push |
Definition at line 5197 of file libsheepy.h.
| #define vectorClearPush | ( | name | ) |
push element and expand the vector the new element is cleared
| name | vector |
Definition at line 5210 of file libsheepy.h.
| #define vectorPop slicePop |
pop element the element count is decreased
NOTE: using comma operator to avoid warning warning: operation on ‘b.head’ may be undefined [-Wsequence-point]
| name | vector |
Definition at line 5226 of file libsheepy.h.
| #define vectorDelLast sliceDelLast |
delete the last element useful for avoiding warning: right-hand operand of comma expression has no effect when the poped value is not used
Definition at line 5233 of file libsheepy.h.
| #define vectorPushCount | ( | name, | |
| countp | |||
| ) |
push multiple elements at once
| name | vector |
| countp | number of elements to add |
Definition at line 5243 of file libsheepy.h.
| #define vectorSet | ( | name, | |
| index, | |||
| v | |||
| ) |
set value at index and clearResize vector when index is outside vector maxCount
Definition at line 5256 of file libsheepy.h.
| #define vectorAt sliceAt |
get / set element at index
| name | vector |
| index | index in array |
Definition at line 5273 of file libsheepy.h.
| #define vectorPtr slicePtr |
get pointer to element at index
| name | vector |
| index | index in array |
Definition at line 5283 of file libsheepy.h.
| #define vectorLast sliceLast |
| #define vectorLastPtr sliceLastPtr |
| #define vectorLastIndex sliceLastIndex |
index of last element
Definition at line 5304 of file libsheepy.h.
| #define vectorFirst sliceFirst |
| #define vectorWriteFilename sliceWriteFilename |
write the vector content to filename file No NULL checks are done on the parameters
| filename | file name string |
Definition at line 5323 of file libsheepy.h.
| #define vectorWrite sliceWrite |
write the vector content to disk No NULL checks are done on the parameters
| file | already opened file |
Definition at line 5332 of file libsheepy.h.
| #define vectorReadFilename | ( | name, | |
| filename | |||
| ) |
read a vector from filename file No NULL checks are done on the parameters
| filename | file name string |
Definition at line 5341 of file libsheepy.h.
| #define vectorRead | ( | name, | |
| file | |||
| ) |
read a vector from disk No NULL checks are done on the parameters
| file | already opened file |
Definition at line 5362 of file libsheepy.h.
| #define forEachV forEachSc |
loop index on vector elements
For example: forEachV(vec, i) { vectorAt(vec, i) = 0; }
Definition at line 5381 of file libsheepy.h.
| #define vectorForEach | ( | name, | |
| element | |||
| ) |
loop on vector elements element is a pointer to a value in the array
vectorForEach(&slc, e) { e->x = 0; }
Definition at line 5391 of file libsheepy.h.
| #define vectorEnumerate | ( | name, | |
| index, | |||
| element | |||
| ) |
enumerate vector elements index is the position of the element in the array index is declared as size_t and is available after the loop element is a pointer to a value in the array
vectorEnumerate(&slc, i, e) { e->x = 0; printf("vectorEnumerate %d\n", i); }
Definition at line 5406 of file libsheepy.h.
| #define vectorInject | ( | name, | |
| index | |||
| ) |
insert an element at index the data is moved to create space for the new element to set data at the new element, use vectorAt(name, index) = value;
Definition at line 5415 of file libsheepy.h.
| #define vectorPrepend | ( | name, | |
| v | |||
| ) |
prepend element
| name | vector |
| v | element to prepend |
Definition at line 5429 of file libsheepy.h.
| #define vectorDequeue sliceDequeue |
| #define vectorDelFirst sliceDelFirst |
delete first element in vector the data is moved when count > 1
Definition at line 5446 of file libsheepy.h.
| #define vectorDelElem sliceDelElem |
delete an element in vector the data is moved when index < (count-1) when index = count -1, the last element is deleted and no data is moved
Definition at line 5454 of file libsheepy.h.
| #define vectorDel sliceDel |
delete range in vector start must be between 0 and last index end must be between 1 and count
Definition at line 5461 of file libsheepy.h.
| #define vectorVAppend | ( | name, | |
| vector | |||
| ) |
append vector to vector name the data is copied
Definition at line 5467 of file libsheepy.h.
| #define vectorAppendFrom | ( | name, | |
| array, | |||
| countInt | |||
| ) |
append array to vector the data is copied
Definition at line 5481 of file libsheepy.h.
| #define vectorVPrepend | ( | name, | |
| vector | |||
| ) |
prepend vector to vector name the data in vector name is moved and the data in vector is copied to vector name
Definition at line 5497 of file libsheepy.h.
| #define vectorPrependFrom | ( | name, | |
| array, | |||
| countInt | |||
| ) |
prepend array to vector the data in vector is moved and the data in array is copied to vector
Definition at line 5513 of file libsheepy.h.
| #define vectorInsert | ( | name, | |
| index, | |||
| vector | |||
| ) |
insert vector at position index the data in vector name is moved and the data in vector is copied to vector name
Definition at line 5530 of file libsheepy.h.
| #define vectorInsertFrom | ( | name, | |
| index, | |||
| array, | |||
| countInt | |||
| ) |
insert array at position index the data in vector is moved and the data in array is copied to vector
Definition at line 5550 of file libsheepy.h.
| #define vectorSlice sliceSlice |
slice vector, keep only elements between start and end start must be between 0 and last index end must be between 1 and count the vector is returned
Definition at line 5572 of file libsheepy.h.
| #define vectorCopy | ( | name, | |
| start, | |||
| end | |||
| ) |
copy vector elements between start and end to a new vector start must be between 0 and last index end must be between 1 and count the new vector is returned and must be freed with vectorTerminate
Definition at line 5580 of file libsheepy.h.
| #define vectorBCopy | ( | name, | |
| dest, | |||
| start, | |||
| end | |||
| ) |
copy vector elements between start and end to the dest vector start must be between 0 and last index end must be between 1 and count
Definition at line 5594 of file libsheepy.h.
| #define vectorSort sliceSort |
sort the vector the compareFunction must prototype of type: int cmp(const void * a, const void * b); the results of the compareFunction should be: <0 when a < b 0 when a = b >0 when a > b
Definition at line 5614 of file libsheepy.h.
| #define vectorEq sliceEq |
return true when vector name is equal to vector eqFunction should return true when the elements are equal eqFunction can be either a macro or a function
Definition at line 5621 of file libsheepy.h.
| #define vectorHas sliceHas |
return true when vector has value eqFunction should return true when the elements are equal eqFunction can be either a macro or a function
Definition at line 5628 of file libsheepy.h.
| #define vectorIndexOf sliceIndexOf |
return index (ssize_t) of value in vector eqFunction should return true when the elements are equal eqFunction can be either a macro or a function
return value is -1 when value is not found
Definition at line 5637 of file libsheepy.h.
| #define vectorBinarySearch sliceBinarySearch |
binary search value in vector
efficiently finds the index of value in vector the vector has to be sorted before calling vectorBinarySearch
less is a macro taking an index and the search value returning 1 when vectorAt(name,index) is less than value: #define less(index, value) vectorAt(name, index) < value
equal is a macro returning 1 when vectorAt(name,index) is equal to value: #define equal(index, value) vectorAt(name,index) == value
return value is -1 when value is not found
Definition at line 5653 of file libsheepy.h.
| #define vectorUniq sliceUniq |
Uniquify elements in vector each elements are unique in the vector.
eqFunction should return true when the elements are equal eqFunction can be either a macro or a function
Definition at line 5662 of file libsheepy.h.
| #define dVectorBits 6 |
dynamic segmented vector
this type of array is faster than vector when there are many elements and has a dynamic element count pushing elements into the array increases the element count the data is stored in static array segments
no sanity checks are done
usage examples: regular array, stack
the prefix is dVector
Usage:
to declare an array:
typeName dvector;
dVectorInit(&dvector); or dVectorInitCount(&dvector, 17);
dVectorAppend(&dvector, value);
// get an element int a = dVectorAt(&dvector, 0);
set dVectorAt(&dvector, 1) = 3;
dVector variables: dvector.maxCount: maximum element count allowed
Note: dont combine the macros, it gives wrong results: a = dVectorAt(&dvector, dVectorPop(&dvector2)); dVectorPop is run several time, more than one element is popped
Note: some functions are macros to be able to have structs as element and access the struct members directly, for example: dVectorLast(chan).a = 0; chunk size: 2^dVectorBits elements
Definition at line 5720 of file libsheepy.h.
| #define dVectorSz (1<<dVectorBits) |
Definition at line 5723 of file libsheepy.h.
| #define dVectorMask (dVectorSz-1) |
Definition at line 5724 of file libsheepy.h.
| #define dVectorT | ( | typeName, | |
| elementType | |||
| ) |
declares type for dynamic array
| typeName | dVector type name |
| element | type of elements (int, struct, pointer...) |
Definition at line 5734 of file libsheepy.h.
| #define createDVector | ( | typeName, | |
| name | |||
| ) | ;typeName name; dVectorInit(&name) |
Definition at line 5743 of file libsheepy.h.
| #define createDVectorCount | ( | typeName, | |
| name, | |||
| count | |||
| ) | ;typeName name; dVectorInitCount(&name, count) |
Definition at line 5745 of file libsheepy.h.
| #define dVectorInit | ( | a | ) |
initialize dynamic array with minimum element count
| a | variable name for dVector |
Definition at line 5753 of file libsheepy.h.
| #define dVectorInitCount | ( | a, | |
| count | |||
| ) |
initialize dynamic array and count
| a | variable name for dVector |
| count | initial element count for name type |
Definition at line 5769 of file libsheepy.h.
| #define dVectorResize | ( | a, | |
| count | |||
| ) |
Definition at line 5780 of file libsheepy.h.
| #define dVectorFree | ( | a | ) |
free the internal buffers
| a | dynamic array |
Definition at line 5798 of file libsheepy.h.
| #define dVectorElemType | ( | name | ) | typeof((name)->element) |
element type in vector
Definition at line 5808 of file libsheepy.h.
| #define dVectorElemPtrType | ( | name | ) | typeof(&(name)->element) |
element pointer type in vector
Definition at line 5813 of file libsheepy.h.
| #define dVectorEmpty | ( | name | ) | (name)->count = 0 |
Empty Array Allocated buffers in the array must be freed before running dVectorEmpty.
Definition at line 5819 of file libsheepy.h.
| #define dVectorIsEmpty | ( | name | ) | ((name)->count == 0) |
is Array Empty
Definition at line 5824 of file libsheepy.h.
| #define dVectorCount | ( | name | ) | (name)->count |
return element count
Definition at line 5829 of file libsheepy.h.
| #define dVectorMaxCount | ( | name | ) | ((name)->maxCount * dVectorSz) |
return max element count
Definition at line 5834 of file libsheepy.h.
| #define dVectorAlloc | ( | a | ) |
allocate buffer for new elements only when the array is full
| a | dynamic array |
Definition at line 5843 of file libsheepy.h.
| #define dVectorPush | ( | a | ) |
push element and expand the dynamic array no data (random) is set in the new element.
| a | dynamic array |
| v | element to push |
Definition at line 5860 of file libsheepy.h.
| #define dVectorAppend | ( | a, | |
| v | |||
| ) |
append element and expand the dynamic array
| a | dynamic array |
| v | element to push |
Definition at line 5873 of file libsheepy.h.
| #define dVectorPop | ( | a | ) | ((a)->count--, *((typeof((a)->element)*)((a)->buffers[((a)->count)>>dVectorBits])+(((a)->count)&dVectorMask))) |
pop element the index of the last element is decreased
NOTE: using comma operator to avoid warning warning: operation on ‘b.head’ may be undefined [-Wsequence-point]
| a | dynamic array |
Definition at line 5893 of file libsheepy.h.
delete the last element useful for avoiding warning: right-hand operand of comma expression has no effect when the poped value is not used
Definition at line 5900 of file libsheepy.h.
| #define dVectorAt | ( | a, | |
| index | |||
| ) | (*((typeof((a)->element)*)((a)->buffers[(index)>>dVectorBits])+((index)&dVectorMask))) |
get / set element at index
| a | dynamic array |
| index | index in array |
Definition at line 5916 of file libsheepy.h.
| #define dVectorPtr | ( | a, | |
| index | |||
| ) | ((typeof((a)->element)*)((a)->buffers[(index)>>dVectorBits])+((index)&dVectorMask)) |
get pointer to element at index
| a | dynamic array |
| index | index in array |
Definition at line 5926 of file libsheepy.h.
| #define dVectorLast | ( | a | ) | (*((typeof((a)->element)*)((a)->buffers[((a)->count-1)>>dVectorBits])+(((a)->count-1)&dVectorMask))) |
| #define dVectorLastPtr | ( | a | ) | ((typeof((a)->element)*)((a)->buffers[((a)->count-1)>>dVectorBits])+(((a)->count-1)&dVectorMask)) |
index of last element
Definition at line 5947 of file libsheepy.h.
| #define dVectorWriteFilename | ( | a, | |
| filename | |||
| ) |
write the dVector content to filename file No NULL checks are done on the parameters
| filename | file name string |
Definition at line 5964 of file libsheepy.h.
write the dVector content to disk No NULL checks are done on the parameters
| file | already opened file |
Definition at line 5982 of file libsheepy.h.
| #define dVectorReadFilename | ( | a, | |
| filename | |||
| ) |
read a dVector from filename file No NULL checks are done on the parameters
| filename | file name string |
Definition at line 5996 of file libsheepy.h.
read a dVector from disk No NULL checks are done on the parameters
| file | already opened file |
Definition at line 6017 of file libsheepy.h.
| #define dVectorForEach | ( | name, | |
| element | |||
| ) |
loop on dVector elements element is a pointer to a value in the array
dVectorForEach(&vec, e) { e->x = 0; }
Definition at line 6035 of file libsheepy.h.
| #define dVectorEnumerate | ( | name, | |
| index, | |||
| element | |||
| ) |
enumerate dVector elements index is the position of the element in the array index is declared as size_t and is available after the loop element is a pointer to a value in the array
dVectorEnumerate(&vec, i, e) { e->x = 0; printf("dVectorEnumerate %d\n", i); }
Definition at line 6050 of file libsheepy.h.
| #define staticArrayT | ( | typeName, | |
| element, | |||
| MAXCOUNT | |||
| ) |
declares type for staticArray or ring
| typeName | staticArray/ring type name |
| element | type of elements (int, struct, pointer...) |
| MAXCOUNT | array/ring buffer size |
Definition at line 6124 of file libsheepy.h.
| #define createStaticArray | ( | typeName, | |
| name | |||
| ) | ;typeName name; staticArrayInit(name) |
Definition at line 6133 of file libsheepy.h.
| #define staticArrayInit | ( | name | ) |
initialize count in array/static ring this macro can initialize rings if the struct is accessed directly
| name | variable name for staticArray |
Definition at line 6142 of file libsheepy.h.
| #define staticArrayElemType | ( | name | ) | typeof((name).list[0]) |
element type in array
Definition at line 6152 of file libsheepy.h.
| #define staticArrayElemPtrType | ( | name | ) | typeof(&(name).list[0]) |
element pointer type in array
Definition at line 6157 of file libsheepy.h.
| #define staticArrayEmpty | ( | name | ) |
Empty Array Allocated buffers in the list must be freed before running staticArrayEmpty.
Definition at line 6163 of file libsheepy.h.
| #define staticArrayIsEmpty | ( | name | ) | ((name).isEmpty) |
is Array Empty
Definition at line 6172 of file libsheepy.h.
| #define staticArrayIsFull | ( | name | ) | ((name).isEmpty ? 0 : ((((name).last+1) % (name).maxCount) == (name).head)) |
is Array Full
Definition at line 6177 of file libsheepy.h.
| #define staticArrayCount | ( | name | ) | ((name).isEmpty ? 0 : ((((name).last) >= ((name).head)) ? ((name).last-(name).head+1) : (((name).maxCount-(name).head + (name).last+1))) ) |
return elements count
Definition at line 6182 of file libsheepy.h.
| #define staticArrayPush | ( | name | ) |
push element to array (only increases last) use staticArrayLast to access the element
Definition at line 6188 of file libsheepy.h.
| #define staticArrayPop | ( | name | ) |
pop element from array (only decreases last)
Definition at line 6202 of file libsheepy.h.
| #define staticArrayDelLast staticArrayPop |
Definition at line 6215 of file libsheepy.h.
| #define staticArrayPrepend | ( | name | ) |
prepend element to array (only decreases head) use staticArrayFirst to access the element
Definition at line 6221 of file libsheepy.h.
| #define staticArrayDequeue | ( | name | ) |
dequeue element from array (only increases head)
Definition at line 6237 of file libsheepy.h.
| #define staticArrayDelFirst staticArrayDequeue |
Definition at line 6248 of file libsheepy.h.
| #define staticArrayGet | ( | name, | |
| index | |||
| ) | (name).list[(((index) >= 0) ? (index) : staticArrayCount(name) + (index) )] |
get element at index, negative index is supported
Definition at line 6253 of file libsheepy.h.
| #define staticArrayAt staticArrayGet |
Definition at line 6254 of file libsheepy.h.
| #define staticArrayGetIndex | ( | name, | |
| index | |||
| ) | ((((index) >= 0) ? (index) : staticArrayCount(name) + (index) )) |
index of element for an index relative to 0, negative index is supported
Definition at line 6259 of file libsheepy.h.
| #define staticArrayRef | ( | name, | |
| index | |||
| ) | (name).list[((((index) >= 0) ? (index) : staticArrayCount(name) + (index) ) + name.head) % name.maxCount] |
get element at index with name->head index 0, negative index is supported
Definition at line 6264 of file libsheepy.h.
| #define staticArrayRefIndex | ( | name, | |
| index | |||
| ) | (((((index) >= 0) ? (index) : staticArrayCount(name) + (index) ) + name.head) % name.maxCount) |
index of element for an index relative to head, negative index is supported
Definition at line 6269 of file libsheepy.h.
| #define staticArrayLast | ( | name | ) | (name).list[(name).last] |
last element in array
Definition at line 6274 of file libsheepy.h.
| #define staticArrayLastIndex | ( | name | ) | (name).last |
index of last element
Definition at line 6279 of file libsheepy.h.
| #define staticArrayFirst | ( | name | ) | (name).list[(name).head] |
first element in array
Definition at line 6284 of file libsheepy.h.
| #define staticArrayFirstIndex | ( | name | ) | (name).head |
index of first element
Definition at line 6289 of file libsheepy.h.
| #define staticArrayDelElem | ( | name, | |
| index | |||
| ) |
delete an element in the array and move elements after it to fill the gap
Definition at line 6294 of file libsheepy.h.
| #define staticArrayWriteFilename | ( | name, | |
| filename | |||
| ) |
write the staticArray content to filename file No NULL checks are done on the parameters
| filename | file name string |
Definition at line 6332 of file libsheepy.h.
| #define staticArrayWrite | ( | name, | |
| file | |||
| ) |
write the staticArray content to disk No NULL checks are done on the parameters
| file | already opened file |
Definition at line 6353 of file libsheepy.h.
| #define staticArrayReadFilename | ( | name, | |
| filename | |||
| ) |
read name staticArray from filename file No NULL checks are done on the parameters
| filename | file name string |
Definition at line 6370 of file libsheepy.h.
| #define staticArrayRead | ( | name, | |
| file | |||
| ) |
read name staticArray from disk No NULL checks are done on the parameters
| file | already opened file |
Definition at line 6400 of file libsheepy.h.
| #define staticArrayForEach | ( | name, | |
| element | |||
| ) |
loop on staticArray elements element is a pointer to a value in the array
staticArrayForEach(sa, e) { e->x = 0; }
Definition at line 6427 of file libsheepy.h.
| #define staticArrayEnumerate | ( | name, | |
| index, | |||
| element | |||
| ) |
enumerate staticArray elements index is the position of the element in the array index is declared as size_t and is available after the loop element is a pointer to a value in the array
staticArrayEnumerate(sa, i, e) { e->x = 0; printf("staticArrayEnumerate %d\n", i); }
Definition at line 6442 of file libsheepy.h.
| #define indexer staticArrayBase |
indexer is a staticArray without the list It indexes an independent array
Usage:
declare an array: char array[10][5];
declare an indexer: indexer indx;
or declare an indexer with smaller counters (default is int64_t): indexerT(typeName, i8); typeName indx;
indexerPush(indx); array[indexerLast(indx)][0] = '0';
// or indexerPush(indx); array[indx.last][0] = '0';
// accessing the first/head element
char c = array[indexerFirst(indx)][0]; char c = array[indx.head][0];
For pointer to indexers (idxP), use: indexerPInit, indexerPEmpty, indexerPIsEmpty, indexerPIsFull, indexerPCount, indexerPPush, indexerPPop, indexerPPrepend, indexerPDequeue, indexerPRef, indexerPLast or idxP->last, indexerPFirst or idxP->head base type, same as staticArray
Definition at line 6499 of file libsheepy.h.
| #define indexerT | ( | typeName, | |
| INT_TYPE | |||
| ) |
declare an indexer type with INT_TYPE counters instead of the default i64 INT_TYPE has to be signed integer
The indexers of this type are not compatible with the indexerP* functions
Definition at line 6507 of file libsheepy.h.
| #define createIndexer | ( | typeName, | |
| name, | |||
| maxCount | |||
| ) | ;typeName name; indexerInit(name, maxCount) |
Definition at line 6515 of file libsheepy.h.
| #define indexerInit | ( | name, | |
| MAXCOUNT | |||
| ) |
initialize count in array/static ring this macro can initialize rings if the struct is accessed directly
| name | variable name for staticArray |
| MAXCOUNT | max count for name type |
Definition at line 6526 of file libsheepy.h.
| #define indexerPInit ringInit |
Definition at line 6533 of file libsheepy.h.
| #define indexerEmpty staticArrayEmpty |
Empty Array Allocated buffers in the list must be freed before running staticArrayEmpty.
Definition at line 6539 of file libsheepy.h.
| #define indexerPEmpty ringEmpty |
Definition at line 6540 of file libsheepy.h.
| #define indexerIsEmpty staticArrayIsEmpty |
is Array Empty
Definition at line 6545 of file libsheepy.h.
| #define indexerPIsEmpty ringIsEmpty |
Definition at line 6546 of file libsheepy.h.
| #define indexerIsFull staticArrayIsFull |
is Array Full
Definition at line 6551 of file libsheepy.h.
| #define indexerPIsFull ringIsFull |
Definition at line 6552 of file libsheepy.h.
| #define indexerCount staticArrayCount |
return elements count
Definition at line 6557 of file libsheepy.h.
| #define indexerPCount ringCount |
Definition at line 6558 of file libsheepy.h.
| #define indexerPush staticArrayPush |
push element to array (only increases last) use staticArrayLast to access the element
Definition at line 6564 of file libsheepy.h.
| #define indexerPPush ringPush |
Definition at line 6565 of file libsheepy.h.
| #define indexerPop staticArrayPop |
pop element from array (only decreases last)
Definition at line 6570 of file libsheepy.h.
| #define indexerPPop ringPop |
Definition at line 6571 of file libsheepy.h.
| #define indexerPrepend staticArrayPrepend |
prepend element to array (only decreases head) use staticArrayFirst to access the element
Definition at line 6577 of file libsheepy.h.
| #define indexerPPrepend ringPrepend |
Definition at line 6578 of file libsheepy.h.
| #define indexerDequeue staticArrayDequeue |
dequeue element from array (only increases head)
Definition at line 6583 of file libsheepy.h.
| #define indexerPDequeue ringDequeue |
Definition at line 6584 of file libsheepy.h.
| #define indexerRef | ( | name, | |
| index | |||
| ) | (((((index) >= 0) ? (index) : indexerCount(name) + (index) ) + name.head) % name.maxCount) |
index element at index with name->head index 0, negative index is supported
Definition at line 6589 of file libsheepy.h.
| #define indexerPRef | ( | name, | |
| index | |||
| ) | (((((index) >= 0) ? (index) : indexerPCount(name) + (index) ) + name->head) % name->maxCount) |
Definition at line 6590 of file libsheepy.h.
| #define indexerLast | ( | name | ) | name.last |
index of last element in array
Definition at line 6595 of file libsheepy.h.
| #define indexerPLast | ( | name | ) | (name)->last |
Definition at line 6596 of file libsheepy.h.
| #define indexerFirst | ( | name | ) | (name.head) |
index of first element in array
Definition at line 6601 of file libsheepy.h.
| #define indexerPFirst | ( | name | ) | (name)->head |
Definition at line 6602 of file libsheepy.h.
| #define ringBase staticArrayBase |
rings usage
Make the ring type:
#define chanMax 30 // max message count in ring type chanT ringMake(chanT, int, chanMax); // ring type is chanT, list 30 of ints
Add ring to a fiber context:
typedef struct {int slot; int a; chanT *c;} AArgs;
Declare a ring of type chanT and initialize:
chanT c; ringInit(&c, chanMax);
When the ring is empty, ringLast and ringFirst are valid and equal (same index).
Send and receive data through the ring:
ringSend(ctx->c, 10); int r; if (!ringIsEmpty(ctx->c)) ringRecv(ctx->c, r);
Note: some functions are macros to be able to have structs as element and access the struct members directly, for example: ringLast(chan).a = 0; base type, same as staticArray
Definition at line 6639 of file libsheepy.h.
| #define ringMake staticArrayT |
declares type for staticArray or ring staticArrayT(typeName, element, MAXCOUNT)
| typeName | staticArray/ring type name |
| element | type of elements (int, struct, pointer...) MAXCOUNT array/ring buffer size |
Definition at line 6652 of file libsheepy.h.
| #define ringStaticInit staticArrayInit |
initialize count in array/static ring staticArrayInit(name, MAXCOUNT)
this macro can initialize rings if the struct is accessed directly
| name | variable name for ring |
Definition at line 6663 of file libsheepy.h.
| #define ringGet | ( | name, | |
| index | |||
| ) | (name)->list[(((index) >= 0) ? (index) : ringCount(name) + (index) )] |
get element at index, negative index is supported
Definition at line 6698 of file libsheepy.h.
| #define ringRef | ( | name, | |
| index | |||
| ) | (name)->list[((((index) >= 0) ? (index) : ringCount(name) + (index) ) + name->head) % name->maxCount] |
get element at index with name->head index 0, negative index is supported
Definition at line 6703 of file libsheepy.h.
| #define ringLast | ( | name | ) | (name)->list[(name)->last] |
last element in ring
Definition at line 6708 of file libsheepy.h.
| #define ringLastIndex | ( | name | ) | (name)->last |
index of last element
Definition at line 6713 of file libsheepy.h.
| #define ringFirst | ( | name | ) | (name)->list[(name)->head] |
last element in ring
Definition at line 6718 of file libsheepy.h.
| #define ringSend | ( | name, | |
| value | |||
| ) |
send data in ring
| name | variable name for ring |
| value | data |
Definition at line 6729 of file libsheepy.h.
| #define ringSendSt | ( | status, | |
| name, | |||
| value | |||
| ) |
Definition at line 6735 of file libsheepy.h.
| #define ringRecv | ( | name, | |
| result | |||
| ) |
receive data from ring
| name | variable name for ring |
| result | previously declared variable to store the data |
Definition at line 6749 of file libsheepy.h.
| #define ringRecvSt | ( | status, | |
| name, | |||
| result | |||
| ) |
Definition at line 6756 of file libsheepy.h.
| #define tCount 10 |
Definition at line 6820 of file libsheepy.h.
| #define fiberCtx | ( | thisSlot | ) | fibers.context[thisSlot] |
get fiber context for thisSlot
Definition at line 6869 of file libsheepy.h.
| #define startJump | ( | func | ) |
fibers with setjmp (not ucontext) internal
startJump starts another fiber slot is the index in fiberJumpBuffers for current fiber func is the fiber to start
the first fiber has to finish last
Definition at line 6896 of file libsheepy.h.
| #define yield | ( | slotValue, | |
| slot | |||
| ) |
yield jumps back to other fiber slot should be a local variable in the fiber slot is set to the index in fiberJumpBuffers for current fiber backToSlot is the index in fiberJumpBuffers for the other fiber
Definition at line 6908 of file libsheepy.h.
| #define fiberEnd | ( | slot | ) |
return to scheduler and end the fiber
Definition at line 6919 of file libsheepy.h.
| #define schedulerYield | ( | backToSlot | ) |
Definition at line 6925 of file libsheepy.h.
| #define dArrayBits 6 |
dynamic segmented array
this type of array is faster than slab when there are many elements and has a dynamic element count pushing elements into the array increases the element count the data is stored in static array segments dArray has head and last indexes, this allows dequeuing from head elements fast
no sanity checks are done
usage examples: regular array, stack, lifo, fifo
the prefix is dArray
Usage:
to declare an array:
typeName darray;
dArrayInit(&darray); or dArrayInitCount(&darray, 17);
// get an element int a = dArrayAt(&darray, 0);
set dArrayAt(&darray, 1) = 3;
dArray variables: darray.maxCount: maximum element count allowed
Note: dont combine the macros, it gives wrong results: a = dArrayAt(&darray, dArrayPop(&darray2)); dArrayPop is run several time, more than one element is popped
Note: some functions are macros to be able to have structs as element and access the struct members directly, for example: dArrayLast(chan).a = 0; chunk size: 2^dArrayBits elements
Definition at line 6984 of file libsheepy.h.
| #define dArraySz (1<<dArrayBits) |
Definition at line 6987 of file libsheepy.h.
| #define dArrayMask (dArraySz-1) |
Definition at line 6988 of file libsheepy.h.
| #define dArrayT | ( | typeName, | |
| elementType | |||
| ) |
declares type for dynamic array
| typeName | dArray type name |
| element | type of elements (int, struct, pointer...) |
Definition at line 6998 of file libsheepy.h.
| #define createDArray | ( | typeName, | |
| name | |||
| ) | ;typeName name; dArrayInit(&name) |
Definition at line 7008 of file libsheepy.h.
| #define createDArrayCount | ( | typeName, | |
| name, | |||
| count | |||
| ) | ;typeName name; dArrayInitCount(&name, count) |
Definition at line 7010 of file libsheepy.h.
| #define dArrayInit | ( | a | ) |
initialize dynamic array with minimum element count
| a | variable name for dArray |
Definition at line 7018 of file libsheepy.h.
| #define dArrayInitCount | ( | a, | |
| count | |||
| ) |
initialize dynamic array and count
| a | variable name for dArray |
| count | initial element count for name type |
Definition at line 7033 of file libsheepy.h.
| #define dArrayResize | ( | a, | |
| count | |||
| ) |
Definition at line 7044 of file libsheepy.h.
| #define dArrayFree dVectorFree |
element type in array
Definition at line 7067 of file libsheepy.h.
element pointer type in array
Definition at line 7072 of file libsheepy.h.
| #define dArrayEmpty | ( | name | ) |
Empty Array Allocated buffers in the array must be freed before running dArrayEmpty.
Definition at line 7078 of file libsheepy.h.
| #define dArrayIsEmpty | ( | name | ) | ((name)->head == (name)->last) |
is Array Empty
Definition at line 7085 of file libsheepy.h.
| #define dArrayCount | ( | name | ) | ((name)->last - (name)->head) |
return element count
Definition at line 7090 of file libsheepy.h.
| #define dArrayMaxCount | ( | name | ) | ((name)->maxCount * dArraySz) |
return max element count
Definition at line 7095 of file libsheepy.h.
| #define dArrayAlloc | ( | a | ) |
allocate buffer for new elements only when the array is full
| a | dynamic array |
Definition at line 7104 of file libsheepy.h.
| #define dArrayPush | ( | a | ) |
push element and expand the dynamic array no data (random) is set in the new element.
| a | dynamic array |
| v | element to push |
Definition at line 7121 of file libsheepy.h.
| #define dArrayAppend | ( | a, | |
| v | |||
| ) |
append element and expand the dynamic array
| a | dynamic array |
| v | element to push |
Definition at line 7134 of file libsheepy.h.
| #define dArrayPop | ( | a | ) | ((a)->last--, *((typeof((a)->element)*)((a)->buffers[((a)->last)>>dArrayBits])+(((a)->last)&dArrayMask))) |
pop element the index of the last element is decreased
NOTE: using comma operator to avoid warning warning: operation on ‘b.head’ may be undefined [-Wsequence-point]
| a | dynamic array |
Definition at line 7154 of file libsheepy.h.
delete the last element useful for avoiding warning: right-hand operand of comma expression has no effect when the poped value is not used
Definition at line 7161 of file libsheepy.h.
| #define dArrayPrepend | ( | a, | |
| v | |||
| ) |
prepend element
| a | dynamic array |
| v | element to prepend |
Definition at line 7171 of file libsheepy.h.
| #define dArrayDequeue | ( | a | ) | ((a)->head++, *((typeof((a)->element)*)((a)->buffers[((a)->head-1)>>dArrayBits])+(((a)->head-1)&dArrayMask))) |
dequeue element the index of the head element is increased
NOTE: using comma operator to avoid warning warning: operation on ‘b.head’ may be undefined [-Wsequence-point]
| a | dynamic array |
Definition at line 7190 of file libsheepy.h.
delete the first element useful for avoiding warning: right-hand operand of comma expression has no effect when the dequeued value is not used
Definition at line 7197 of file libsheepy.h.
| #define dArrayAt | ( | a, | |
| index | |||
| ) | (*((typeof((a)->element)*)((a)->buffers[(index)>>dArrayBits])+((index)&dArrayMask))) |
get / set element at index
| a | dynamic array |
| index | index in array |
Definition at line 7207 of file libsheepy.h.
| #define dArrayPtr | ( | a, | |
| index | |||
| ) | ((typeof((a)->element)*)((a)->buffers[(index)>>dArrayBits])+((index)&dArrayMask)) |
get pointer to element at index
| a | dynamic array |
| index | index in array |
Definition at line 7217 of file libsheepy.h.
| #define dArraySet | ( | a, | |
| index, | |||
| v | |||
| ) |
set at index and resize dArray when index is greater then maxCount
Definition at line 7222 of file libsheepy.h.
| #define dArraySparseSet | ( | a, | |
| index, | |||
| v | |||
| ) |
sparse set at index and resize dArray when index is greater then maxCount dArraySparseSet allows using dArray as a sparse array
head and last are not updated because there are empty regions in the sparse array
the empty segments are marked with NULL in the a->buffers array
after using dArraySparseSet only these macros are valid: dArrayResize, dArrayElemType, dArrayElemPtrType, dArrayMaxCount, dArrayAt, dArrayPtr, dArrayFree
Definition at line 7256 of file libsheepy.h.
| #define dArrayLast | ( | a | ) | (*((typeof((a)->element)*)((a)->buffers[((a)->last-1)>>dArrayBits])+(((a)->last-1)&dArrayMask))) |
| #define dArrayLastPtr | ( | a | ) | ((typeof((a)->element)*)((a)->buffers[((a)->last-1)>>dArrayBits])+(((a)->last-1)&dArrayMask)) |
index of last element
Definition at line 7298 of file libsheepy.h.
direct access to the last element index variable for assignments
Definition at line 7303 of file libsheepy.h.
| #define dArrayFirst | ( | a | ) | (*((typeof((a)->element)*)((a)->buffers[((a)->head)>>dArrayBits])+((a)->head)&dArrayMask)) |
index of first element
Definition at line 7316 of file libsheepy.h.
| #define dArrayWriteFilename | ( | a, | |
| filename | |||
| ) |
write the dArray content to filename file No NULL checks are done on the parameters
| filename | file name string |
Definition at line 7325 of file libsheepy.h.
write the dArray content to disk No NULL checks are done on the parameters
| file | already opened file |
Definition at line 7343 of file libsheepy.h.
| #define dArrayReadFilename | ( | a, | |
| filename | |||
| ) |
read a dArray from filename file No NULL checks are done on the parameters
| filename | file name string |
Definition at line 7357 of file libsheepy.h.
read a dArray from disk No NULL checks are done on the parameters
| file | already opened file |
Definition at line 7378 of file libsheepy.h.
| #define dArrayForEach | ( | name, | |
| element | |||
| ) |
loop on dArray elements element is a pointer to a value in the array
dArrayForEach(&a, e) { e->x = 0; }
Definition at line 7396 of file libsheepy.h.
| #define dArrayEnumerate | ( | name, | |
| index, | |||
| element | |||
| ) |
enumerate dArray elements index is the position of the element in the array index is declared as size_t and is available after the loop element is a pointer to a value in the array
dArrayEnumerate(&a, i, e) { e->x = 0; printf("dArrayEnumerate %d\n", i); }
Definition at line 7411 of file libsheepy.h.
| #define slabSz 64 |
slab - dynamic array in one chunk of memory
slab supports shrinking through slabResize, the slab is reset when head or last are outside the new size slab has head and last indexes, this allows dequeuing from head elements fast
this type of array has a dynamic element count pushing elements into the array increases the element count
no sanity checks are done
usage examples: regular array, stack, lifo, fifo
the prefix is slab
Usage:
to declare an array:
typeName slab;
slabInit(&slab); or slabInitCount(&slab, 17);
// get an element int a = slabAt(&slab, 0);
set slabAt(&slab, 1) = 3;
Slab variables: slab.array: elements slab.maxCount: maximum element count allowed
Note: some functions are macros to be able to have structs as element and access the struct members directly, for example: slabLast(chan).a = 0;number of elements added by slabAlloc
Definition at line 7469 of file libsheepy.h.
| #define slabT | ( | typeName, | |
| elementType | |||
| ) |
declares type for dynamic array
| typeName | slab type name |
| element | type of elements (int, struct, pointer...) |
Definition at line 7479 of file libsheepy.h.
| #define createSlab | ( | typeName, | |
| name | |||
| ) | ;typeName name; slabInit(&name) |
Definition at line 7488 of file libsheepy.h.
| #define createSlabCount | ( | typeName, | |
| name, | |||
| count | |||
| ) | ;typeName name; slabInitCount(&name, count) |
Definition at line 7490 of file libsheepy.h.
| #define slabInit | ( | a | ) |
initialize dynamic array with minimum element count
| a | variable name for slab |
Definition at line 7498 of file libsheepy.h.
| #define slabInitCount | ( | a, | |
| count | |||
| ) |
initialize slab and count
| a | variable name for slab |
| count | initial element count for name type |
Definition at line 7513 of file libsheepy.h.
| #define slabResize | ( | a, | |
| count | |||
| ) |
Definition at line 7520 of file libsheepy.h.
| #define slabFree sliceFree |
| #define slabElemType | ( | name | ) | typeof((name)->array[0]) |
element type in array
Definition at line 7541 of file libsheepy.h.
| #define slabElemPtrType | ( | name | ) | typeof(&(name)->array[0]) |
element pointer type in array
Definition at line 7546 of file libsheepy.h.
| #define slabEmpty | ( | name | ) |
Empty Array.
Definition at line 7551 of file libsheepy.h.
| #define slabIsEmpty | ( | name | ) | ((name)->head == (name)->last) |
is Array Empty
Definition at line 7558 of file libsheepy.h.
| #define slabCount | ( | name | ) | ((name)->last - (name)->head) |
return element count
Definition at line 7563 of file libsheepy.h.
| #define slabMaxCount vectorMaxCount |
return max element count
Definition at line 7568 of file libsheepy.h.
| #define slabAlloc | ( | a | ) |
allocate buffer for new elements only when the slab is full
| a | dynamic array |
Definition at line 7577 of file libsheepy.h.
| #define slabPush | ( | a | ) |
push element and expand the slab no data (random) is set in the new element
| a | slab |
Definition at line 7591 of file libsheepy.h.
| #define slabAppend | ( | a, | |
| v | |||
| ) |
append element and expand the slab
| a | slab |
| v | element to push |
Definition at line 7604 of file libsheepy.h.
pop element the index of the last element is decreased
NOTE: using comma operator to avoid warning warning: operation on ‘b.head’ may be undefined [-Wsequence-point]
| a | slab |
Definition at line 7623 of file libsheepy.h.
delete the last element useful for avoiding warning: right-hand operand of comma expression has no effect when the poped value is not used
Definition at line 7630 of file libsheepy.h.
| #define slabPrepend | ( | a, | |
| v | |||
| ) |
prepend element
| a | slab |
| v | element to prepend |
Definition at line 7640 of file libsheepy.h.
dequeue element the index of the head element is increased
NOTE: using comma operator to avoid warning warning: operation on ‘b.head’ may be undefined [-Wsequence-point]
| a | slab |
Definition at line 7658 of file libsheepy.h.
delete the first element useful for avoiding warning: right-hand operand of comma expression has no effect when the dequeued value is not used
Definition at line 7665 of file libsheepy.h.
| #define slabAt sliceAt |
get / set element at index
| a | slab |
| index | index in array |
Definition at line 7675 of file libsheepy.h.
| #define slabPtr slicePtr |
get pointer to element at index
| a | slab |
| index | index in array |
Definition at line 7685 of file libsheepy.h.
index of last element
Definition at line 7706 of file libsheepy.h.
direct access to the last element index variable for assignments
Definition at line 7711 of file libsheepy.h.
index of first element
Definition at line 7724 of file libsheepy.h.
| #define slabWriteFilename | ( | a, | |
| filename | |||
| ) |
write the slab content to filename file No NULL checks are done on the parameters
| filename | file name string |
Definition at line 7733 of file libsheepy.h.
| #define slabWrite | ( | a, | |
| file | |||
| ) | fwrite((a)->array + (a)->head, 1, sizeof(*((a)->array)) * slabCount(a), file) |
write the slab content to disk No NULL checks are done on the parameters
| file | already opened file |
Definition at line 7748 of file libsheepy.h.
| #define slabReadFilename | ( | a, | |
| filename | |||
| ) |
read a slab from filename file No NULL checks are done on the parameters
| filename | file name string |
Definition at line 7757 of file libsheepy.h.
read a slab from disk No NULL checks are done on the parameters
| file | already opened file |
Definition at line 7778 of file libsheepy.h.
| #define slabForEach | ( | name, | |
| element | |||
| ) |
loop on slab elements element is a pointer to a value in the array
slabForEach(&a, e) { e->x = 0; }
Definition at line 7796 of file libsheepy.h.
| #define slabEnumerate | ( | name, | |
| index, | |||
| element | |||
| ) |
enumerate slab elements index is the position of the element in the array index is declared as size_t and is available after the loop element is a pointer to a value in the array
slabEnumerate(&a, i, e) { e->x = 0; printf("slabEnumerate %d\n", i); }
Definition at line 7811 of file libsheepy.h.
| #define staticBitsetT | ( | typeName, | |
| containerType, | |||
| count | |||
| ) | typedef struct {containerType map[BUCKETS(count, 8 * sizeof(containerType))];} typeName; |
static bitset
no sanity checks are done
Usage:
staticBitsetT(typeName, u64 , 8);
typeName bits;
bool bit = staticBitsetGet(&bits, index); typedef for staticBitset
| typeName | typedef name |
| containerType | element type in array: u8, u16, u32, u64... |
| count | bit count in array |
Definition at line 7850 of file libsheepy.h.
| #define staticBitsetInit staticBitsetClear |
Definition at line 7853 of file libsheepy.h.
| #define staticBitsetCount | ( | name | ) | (sizeof((name)->map) * 8) |
bitset count
Definition at line 7856 of file libsheepy.h.
| #define staticBitsetClear | ( | name | ) | memset(name, 0, sizeof(*(name))); |
clear all bits in bitset
Definition at line 7859 of file libsheepy.h.
| #define staticBitsetBucket | ( | name, | |
| index | |||
| ) | (name)->map[index / (8 * sizeof((name)->map[0]))] |
bucket containing bit at given index
Definition at line 7862 of file libsheepy.h.
| #define staticBitset0 | ( | name, | |
| index | |||
| ) |
set 0 at index
Definition at line 7865 of file libsheepy.h.
| #define staticBitset1 | ( | name, | |
| index | |||
| ) |
set 1 at index
Definition at line 7873 of file libsheepy.h.
| #define staticBitsetSet | ( | name, | |
| index, | |||
| value | |||
| ) |
set bit value at index
Definition at line 7881 of file libsheepy.h.
| #define staticBitsetInv | ( | name, | |
| index | |||
| ) |
invert bit at index
Definition at line 7893 of file libsheepy.h.
| #define staticBitsetGet | ( | name, | |
| index | |||
| ) |
get bit at index
Definition at line 7901 of file libsheepy.h.
| #define bitsetModulo 8 |
end static bitset
bitset the underlying array is defined in the provided at macro or function
no sanity checks are done
a dynamic bitset can be created using slice and sliceAt
Definition at line 7921 of file libsheepy.h.
| #define bitsetBucket | ( | name, | |
| index | |||
| ) | (name)->map[index / (bitsetModulo)] |
bucket containing bit at given index
Definition at line 7924 of file libsheepy.h.
| #define bitset0 | ( | name, | |
| at, | |||
| index | |||
| ) |
set 0 at index at must be macro or function taking 2 parameters: at(name, intIndex) and point to value at intIndex
Definition at line 7931 of file libsheepy.h.
| #define bitset1 | ( | name, | |
| at, | |||
| index | |||
| ) |
set 1 at index at must be macro or function taking 2 parameters: at(name, intIndex) and point to value at intIndex
Definition at line 7943 of file libsheepy.h.
| #define bitsetSet | ( | name, | |
| at, | |||
| index, | |||
| value | |||
| ) |
set bit value at index at must be macro or function taking 2 parameters: at(name, intIndex) and point to value at intIndex
Definition at line 7955 of file libsheepy.h.
| #define bitsetInv | ( | name, | |
| at, | |||
| index | |||
| ) |
invert bit at index at must be macro or function taking 2 parameters: at(name, intIndex) and point to value at intIndex
Definition at line 7971 of file libsheepy.h.
| #define bitsetGet | ( | name, | |
| at, | |||
| index | |||
| ) |
get bit at index at must be macro or function taking 2 parameters: at(name, intIndex) and return the value at intIndex
Definition at line 7984 of file libsheepy.h.
| #define FIELD_SET | ( | dst, | |
| val, | |||
| msb, | |||
| lsb | |||
| ) | dst = (/*clear field in dst*/ (dst) & ((0xFFFFFFFFFFFFFFFEUL << (msb)) | ((1UL<<(lsb))-1) )) | (/*clear highest bits in val and shift to field lsb*/(~(0xFFFFFFFFFFFFFFFEUL << ((msb)-(lsb))) & (val)) << (lsb)) |
end bitset
bitfield array
a field is a group of bit representing an int stored in a larger int
bitfield array is an array of fields (short int) similar to bitset
Example:
u64 v = 0; // field storage FIELD_SET(v, 3, 1, 0); // field is 2 bits from bit 0 to bit 1, set value 3
u8 field = FIELD_GET(v, 1, 0); // get value in field at bit 0 to 1
// declare a bitfield array // the array has 256 elements and each element is a 2 bit integer BITFIELD_VAR(bitfields, 256, 2) = init0Var;
// set value for element at index 255 BITFIELD_SET(bitfields, 255, 3, 2); // get value for element at index 255 v = BITFIELD_GET(bitfields, 255, 2); set bitfield value in destination (opposite of EXTRACT macro)
only bits between msb and lsb are set in dst
| dst | destination, unsigned integer (u8, u16, u32, u64) |
| val | value to set, the value is shifted to lsb |
| msb | most significant bit in dst to be set |
| lsb | least significant bit in dst to be set |
Definition at line 8034 of file libsheepy.h.
| #define FIELD_GET EXTRACT |
Definition at line 8036 of file libsheepy.h.
set bitfield value in destination, given bitfield index and length
(index+1)*len-1 must be lower or equal to 8*sizeof(dst), otherwise val will be truncated
| dst | destination, unsigned integer (u8, u16, u32, u64) |
| index | index of the bitfield in dst (bit index*len is lsb) |
| val | value to set, the value is shifted to lsb |
| len | bitfield length in dst |
Definition at line 8053 of file libsheepy.h.
| #define BITFIELD_SET | ( | array, | |
| index, | |||
| val, | |||
| len | |||
| ) | FIELD_SET((array)[((index)*(len))/64], val, ((index)*(len))%64+(len)-1, ((index)*(len))%64) |
set bitfield value in array of bitfields the boundaries are not checked
| array | array of u64 |
| index | index of the bitfield in array (bit index*len is lsb) |
| val | value to set, the value is shifted to the correct position |
| len | bitfield length in array, must divide 64 (2, 4, 8, 16, 32) |
Definition at line 8068 of file libsheepy.h.
| #define BITFIELD_GET | ( | array, | |
| index, | |||
| len | |||
| ) | EXTRACT((array)[((index)*(len))/64], ((index)*(len))%64+(len)-1, ((index)*(len))%64) |
get bitfield value in array of bitfields the boundaries are not checked
| array | array of u64 |
| index | index of the bitfield in array (bit index*len is lsb) |
| len | bitfield length in array, must divide 64 (2, 4, 8, 16, 32) |
Definition at line 8081 of file libsheepy.h.
| #define BITFIELD_SIZE | ( | count, | |
| len, | |||
| containerType | |||
| ) | BUCKETS((count)*(len), 8 * sizeof(containerType)) |
return number of u64 necessary to hold count bitfields of length len
Definition at line 8086 of file libsheepy.h.
declare an array to hold count bitfields of length len
Definition at line 8091 of file libsheepy.h.
| #define nanoSleep | ( | time | ) | pError0(nanoSleepF(time)) |
sleep nanoseconds
Definition at line 8105 of file libsheepy.h.
| #define nanoSleep | ( | time | ) | pError0(nanoSleepF(time)) |
sleep nanoseconds
Definition at line 8105 of file libsheepy.h.
| #define nanoSleepE | ( | time, | |
| cmd | |||
| ) | pErrorCmd(nanoSleepF(time), == 0, cmd) |
nanoSleep and error code
Definition at line 8108 of file libsheepy.h.
| #define usSleep | ( | time | ) | pError0(nanoSleepF(1000 * (uint64_t)time)) |
sleep microseconds
Definition at line 8111 of file libsheepy.h.
| #define msSleep | ( | time | ) | pError0(nanoSleepF(1000000 * (uint64_t)time)) |
sleep miliseconds
Definition at line 8114 of file libsheepy.h.
| #define UNUSED |
Definition at line 8195 of file libsheepy.h.
| #define DEPRECATED |
Definition at line 8196 of file libsheepy.h.
| #define PACKED |
Definition at line 8197 of file libsheepy.h.
| #define CLEANUP |
Definition at line 8198 of file libsheepy.h.
| #define FALLTHRU |
Definition at line 8199 of file libsheepy.h.
| #define AINLINE |
Definition at line 8200 of file libsheepy.h.
| #define NOINLINE |
Definition at line 8201 of file libsheepy.h.
| #define PURE |
Definition at line 8202 of file libsheepy.h.
| #define CONST |
Definition at line 8203 of file libsheepy.h.
| #define NORETURN |
Definition at line 8204 of file libsheepy.h.
| #define AMALLOC |
Definition at line 8205 of file libsheepy.h.
| #define MUST_CHECK |
Definition at line 8206 of file libsheepy.h.
| #define USED |
Definition at line 8207 of file libsheepy.h.
| #define ALIGN | ( | X | ) |
Definition at line 8208 of file libsheepy.h.
| #define ALIGN_MAX |
Definition at line 8209 of file libsheepy.h.
| #define likely | ( | x | ) | (x) |
Definition at line 8210 of file libsheepy.h.
| #define unlikely | ( | x | ) | (x) |
Definition at line 8211 of file libsheepy.h.
| typedef void(* initLibsheepyObjectP) (void) |
Definition at line 1597 of file libsheepy.h.
| typedef int rune |
Definition at line 2312 of file libsheepy.h.
Definition at line 3085 of file libsheepy.h.
| typedef void(* fiberFT) (int) |
fiber function type
Definition at line 6874 of file libsheepy.h.
| void cleanUpCharFree | ( | char ** | val | ) |
| void cleanUpListFree | ( | char *** | val | ) |
| void cleanUpFileFree | ( | FILE ** | val | ) |
| void cleanUpFd | ( | int * | val | ) |
Definition at line 939 of file libsheepy.c.
| uint64_t shStopwatch | ( | uint8_t | op | ) |
nanosecond stopwatch
| op | operation: 0 start, 1 get stopwatch value |
Definition at line 955 of file libsheepy.c.

| FILE* SH_PREFIX() setLogFile | ( | char * | filename | ) |
set log file the logs are appended to all log files set with this function
there is a maximum of 15 log files
Definition at line 1058 of file libsheepy.c.
| int getLogSymbols | ( | void | ) |
get current log symbols
Definition at line 996 of file libsheepy.c.
| void setLogSymbols | ( | int | mode | ) |
set log symbols
LOG_VERBOSE for words LOG_UTF8 for emojis LOG_VOID for no symbols LOG_INVALID_MODE (reset log symbols) for default log mode symbols anything else (LOG_CONCISE,...) for symbols (!*+->~)
default is default log mode symbols
Definition at line 1012 of file libsheepy.c.
| int getMaxLogLevel | ( | void | ) |
get current max log level
default is LOG_INVALID, to show all log levels -1 hides all logs
Definition at line 1028 of file libsheepy.c.
| void setMaxLogLevel | ( | int | logLevel | ) |
set max log level logs above logMaxLevel are skipped
default is LOG_INVALID, to show all log levels LOG_DISABLE hides all logs
| logLevel | from LOG_DISABLE to LOG_INVALID |
Definition at line 1043 of file libsheepy.c.
| void closeLogFiles | ( | void | ) |
close logfiles opened with setLogFile
Definition at line 1081 of file libsheepy.c.
| int getLogMode | ( | void | ) |
get current log mode (verbose, concise)
Definition at line 1097 of file libsheepy.c.
| void setLogMode | ( | int | mode | ) |
set log mode LOG_VERBOSE, LOG_CONCISE, .
the default log mode is LOG_DATE
Definition at line 1107 of file libsheepy.c.


| bool getLogShortPath | ( | void | ) |
get current log long/short path value
The default value is TRUE (short paths) TRUE shows short file paths in logs FALSE shows long file paths in logs
Definition at line 1128 of file libsheepy.c.
| void setLogShortPath | ( | bool | shortPath | ) |
set log long/short file path value for VERBOSE mode
TRUE shows short file paths in logs FALSE shows long file paths in logs
the default long/short path value is TRUE
Definition at line 1141 of file libsheepy.c.
| bool getLogStdout | ( | void | ) |
get stdout state, when TRUE (default) all logs are printed to stdout
Definition at line 1149 of file libsheepy.c.
| void setLogStdout | ( | bool | state | ) |
enable/disable printing logs to stdout
TRUE: print logs to stdout FALSE: print logs to files only
Definition at line 1160 of file libsheepy.c.
| bool openProgLogFile | ( | void | ) |
log to a file named progName.log Use closeLogFiles when finished logging
Definition at line 1169 of file libsheepy.c.
| void keepAnsiColorsInLog | ( | bool | state | ) |
enable/disable ansi color codes in logs
TRUE: print colors FALSE: strip colors
Definition at line 1194 of file libsheepy.c.
| void _pLog | ( | int | , |
| const char * | , | ||
| const char * | , | ||
| int | , | ||
| const char * | , | ||
| ... | |||
| ) |
Definition at line 1210 of file libsheepy.c.
| void initLibsheepyF | ( | const char * | progPath, |
| initLibsheepyObjectP | initF | ||
| ) |
initialize libsheepy (optional, for debug)
initialize segfault handler for crash debug the segfault handler prints the line and file where the segfault occured
initialize the fibers initialize libsheepyObject
Definition at line 1579 of file libsheepy.c.
| void finalizeLibsheepyCharAtExit | ( | void | ) |
finalize libsheepy char at exit
free internal buffers in this file:
realprogpath urandomFp software random file
Definition at line 1652 of file libsheepy.c.

| int64_t getStackLimit | ( | void | ) |
get current stack limit
Definition at line 1667 of file libsheepy.c.
| int setStackLimit | ( | int64_t | stackSize | ) |
set stack limit
| stackSize | stack size in bytes, set -1 for unlimited size |
Definition at line 1686 of file libsheepy.c.
| int enableCoreDump | ( | void | ) |
enable core dump
change core dump size to infinity to enable core dump. After the program receives a signal generating core dump, a core file is written to disk and can be open with gdb
Definition at line 1720 of file libsheepy.c.
| const char* getProgName | ( | void | ) |
| bool setProgName | ( | const char * | name | ) |
set program name
this program name showing in the logs
Definition at line 1755 of file libsheepy.c.

| void setDefaultProgName | ( | void | ) |
set default program name
this program name showing in the logs
Definition at line 1773 of file libsheepy.c.
| void freeProgName | ( | void | ) |
free ProgName if set with setProgName
Definition at line 1782 of file libsheepy.c.
| const char* getProgPath | ( | void | ) |
get program path When initLibsheepy is called before this function, it returns the given program path.
When initLibsheepy has not been called before this function, it returns the real program path.
Definition at line 1795 of file libsheepy.c.

| const char* getRealProgPath | ( | void | ) |
get real program path The first call allocates libSheepyRealProgPath, it is freed with freeRealProgPath
Definition at line 1812 of file libsheepy.c.

| void freeRealProgPath | ( | void | ) |
free real program path finalizeLibsheepy calls this function
Definition at line 1826 of file libsheepy.c.

| int systemNFreeF | ( | char * | command, |
| int | line, | ||
| const char * | thisFunc, | ||
| const char * | thisFileName | ||
| ) |
run system command and free command buffer a message is printed when an error occurs
this function is called from the systemNFree macro
| command | command to run in the shell |
Definition at line 1844 of file libsheepy.c.

| time_t getModificationTime | ( | const char * | path | ) |
get modification time for path
| path |
Definition at line 1864 of file libsheepy.c.


| int setModificationTime | ( | const char * | path, |
| time_t | mtime | ||
| ) |
set modification time for path
| path | |
| mtime | (for example, from the getModificationTime function) |
Definition at line 1890 of file libsheepy.c.


| bool isReadable | ( | const char * | path | ) |
| bool isWritable | ( | const char * | path | ) |
| bool isExecutable | ( | const char * | path | ) |
| bool equalModificationTimes | ( | const char * | path1, |
| const char * | path2 | ||
| ) |
compare modification times for path1 and path2
| path1 | |
| path2 |
Definition at line 1979 of file libsheepy.c.


| time_t getCurrentUnixTime | ( | void | ) |
get current unix time in seconds
time_t is either int32_t or int64_t
Definition at line 2001 of file libsheepy.c.
| time_t strToUnixTime | ( | const char * | date, |
| const char * | format | ||
| ) |
convert date string to unix time
| date | string |
| format | for strptime |
Definition at line 2018 of file libsheepy.c.

| char* timeToS | ( | const time_t | t | ) |
time To String convert unix time to string (ctime is not used here because it adds
at the end of the string)
| unix | time to convert |
Definition at line 2048 of file libsheepy.c.

| char* bTimeToS | ( | char * | dst, |
| const time_t | t | ||
| ) |
Definition at line 2057 of file libsheepy.c.
| char* bLTimeToS | ( | char * | dst, |
| size_t | dstSize, | ||
| const time_t | t | ||
| ) |
Definition at line 2065 of file libsheepy.c.
| char* timeToYMDS | ( | const time_t | t | ) |
time To Year-Month-Day Hour:Minute:Second String convert unix time to string
| unix | time to convert |
Definition at line 2082 of file libsheepy.c.
| char* bTimeToYMDS | ( | char * | dst, |
| const time_t | t | ||
| ) |
Definition at line 2091 of file libsheepy.c.
| char* bLTimeToYMDS | ( | char * | dst, |
| size_t | dstSize, | ||
| const time_t | t | ||
| ) |
Definition at line 2099 of file libsheepy.c.
| char* getCurrentDate | ( | void | ) |
get current date in ctime format (Wed Dec 12 11:44:08 2018)
you must free the pointer
Definition at line 2112 of file libsheepy.c.
| char* bGetCurrentDate | ( | char * | dst | ) |
Definition at line 2121 of file libsheepy.c.
| char* bLGetCurrentDate | ( | char * | dst, |
| size_t | dstSize | ||
| ) |
Definition at line 2132 of file libsheepy.c.
| char* getCurrentDateYMD | ( | void | ) |
get current date in Y-m-d H:M:S format
you must free the pointer
Definition at line 2148 of file libsheepy.c.
| char* bGetCurrentDateYMD | ( | char * | dst | ) |
Definition at line 2157 of file libsheepy.c.
| char* bLGetCurrentDateYMD | ( | char * | dst, |
| size_t | dstSize | ||
| ) |
Definition at line 2168 of file libsheepy.c.
| char* shDirname | ( | const char * | path | ) |
sheepy dirname
the returned string has to be freed
| path |
Definition at line 2191 of file libsheepy.c.


| char* bDirname | ( | char * | path | ) |
buffer dirname
the buffer size (path) must be at least 3 chars
| path |
Definition at line 2252 of file libsheepy.c.


| char* bLDirname | ( | char * | path, |
| size_t | pathSize | ||
| ) |
buffer size dirname
the buffer size (path) must be at least 3 chars
| path | |
| pathSize | path buffer size, the path strlen will be at most pathSize-1 |
Definition at line 2306 of file libsheepy.c.

| char* expandHome | ( | const char * | path | ) |
expands ~/ ($HOME) or ~USER
duplicate and expand path.
The original remains unchanged.
| path | string |
Definition at line 2443 of file libsheepy.c.


| char* iExpandHome | ( | char ** | path | ) |
expands ~/ ($HOME) or ~USER
duplicate and expand path.
| path | string (this parameter is reallocated) |
Definition at line 2638 of file libsheepy.c.


| char* bExpandHome | ( | char * | path | ) |
buffer expands ~/ ($HOME) or ~USER
expand path
| path | string |
Definition at line 2821 of file libsheepy.c.


| char* bLExpandHome | ( | char * | path, |
| size_t | pathSize | ||
| ) |
buffer size expands ~/ ($HOME) or ~USER
expand path
| path | string |
| pathSize | path buffer size, the path strlen will be at most pathSize-1 |
Definition at line 3001 of file libsheepy.c.


| char* normalizePath | ( | const char * | path | ) |
normalize path
remove unecessary /, .. and . leading / is kept leading .. is kept leading . is removed
'/../' becomes '/'
| path |
Definition at line 3057 of file libsheepy.c.


| char* iNormalizePath | ( | char ** | path | ) |
normalize path
remove unecessary /, .. and . leading / is kept leading .. is kept leading . is removed
'/../' becomes '/'
| path | (this parameter is reallocated) |
Definition at line 3155 of file libsheepy.c.


| char* bNormalizePath | ( | char * | path | ) |
buffer normalize path
remove unecessary /, .. and . leading / is kept leading .. is kept leading . is removed
'/../' becomes '/'
| path |
Definition at line 3260 of file libsheepy.c.


| char* bLNormalizePath | ( | char * | path, |
| size_t | pathSize | ||
| ) |
buffer size normalize path
path must be at least 2 chars
remove unecessary /, .. and . leading / is kept leading .. is kept leading . is removed
'/../' becomes '/'
| path | |
| pathSize | path buffer size, the path strlen will be at most pathSize-1 |
Definition at line 3367 of file libsheepy.c.

| char* relPath | ( | const char * | path, |
| const char * | start | ||
| ) |
relative path
Return a relative filepath to path either from the current directory or from an optional start directory
| path | path to convert |
| start | reference path, cwd when NULL |
Definition at line 3472 of file libsheepy.c.

| char* iRelPath | ( | char ** | path, |
| const char * | start | ||
| ) |
relative path
Return a relative filepath to path either from the current directory or from an optional start directory
| path | path to convert (this parameter is reallocated) |
| start | reference path, cwd when NULL |
Definition at line 3599 of file libsheepy.c.

| char* bRelPath | ( | char * | dest, |
| const char * | path, | ||
| const char * | start | ||
| ) |
relative path
Return a relative filepath to path either from the current directory or from an optional start directory
| path | path to convert |
| start | reference path, cwd when NULL |
Definition at line 3730 of file libsheepy.c.

| char* bLRelPath | ( | char * | dest, |
| size_t | destSize, | ||
| char * | path, | ||
| const char * | start | ||
| ) |
relative path
Return a relative filepath to path either from the current directory or from an optional start directory
| path | path to convert |
| start | reference path, cwd when NULL |
Definition at line 3860 of file libsheepy.c.

| char* getHomePath | ( | void | ) |
get home path
Definition at line 3983 of file libsheepy.c.
| char* bGetHomePath | ( | char * | path | ) |
copy home path to path
| path | buffer large enough for home path |
Definition at line 4000 of file libsheepy.c.
| char* bLGetHomePath | ( | char * | path, |
| size_t | pathSize | ||
| ) |
copy home path to path maximum pathSize
| path | buffer large enough for home path |
| pathSize | size of path |
Definition at line 4020 of file libsheepy.c.

| const char* getCHomePath | ( | void | ) |
| char* getCwd | ( | void | ) |
get current working directory
Definition at line 4054 of file libsheepy.c.

| char* bLGetCwd | ( | char * | path, |
| size_t | pathSize | ||
| ) |
Definition at line 4070 of file libsheepy.c.
| int chDir | ( | const char * | path | ) |
change directory
| path |
Definition at line 4092 of file libsheepy.c.


| bool isDir | ( | const char * | path | ) |
is directory
| path |
Definition at line 4119 of file libsheepy.c.


| char* shReadlink | ( | const char * | path | ) |
sheepy read link
read the first target in the link chain
the returned string has to be freed
| path | symbolic link path |
Definition at line 4153 of file libsheepy.c.

| char* endlink | ( | const char * | path | ) |
end link
read the link chain of a symbolic link to the end the returned string has to be freed
| path | symbolic link path |
Definition at line 4215 of file libsheepy.c.

| bool isLink | ( | const char * | path | ) |
is symbolic link
| path |
Definition at line 4293 of file libsheepy.c.


| bool fileExists | ( | const char * | filePath | ) |
detect files and directories
| filePath | path to file or directory |
Definition at line 4321 of file libsheepy.c.


| bool fileChmod | ( | const char * | filePath, |
| mode_t | mode | ||
| ) |
like chmod in stdlibc but return true/false
| filePath | path to file or directory mode: permissions |
Definition at line 4345 of file libsheepy.c.


| ssize_t fileSize | ( | const char * | filePath | ) |
get file size
| filePath | path to file |
Definition at line 4369 of file libsheepy.c.


| ssize_t fileSizeFP | ( | FILE * | fp | ) |
get file size from file pointer
| fp | file pointer |
Definition at line 4401 of file libsheepy.c.

| void* readFileToS | ( | const char * | filePath | ) |
read file to string
0 is added at the end to terminate the string
| filePath | path to file |
Definition at line 4427 of file libsheepy.c.


| void* bReadFileToS | ( | const char * | filePath, |
| void * | dst | ||
| ) |
buffer read file to string
0 is added at the end to terminate the string
| dst | destination buffer |
| filePath | path to file |
Definition at line 4530 of file libsheepy.c.

| void* bLReadFileToS | ( | const char * | filePath, |
| void * | dst, | ||
| size_t | dstSize | ||
| ) |
buffer size read file to string
0 is added at the end to terminate the string
| filePath | path to file |
| dst | destination buffer |
| dstSize | path buffer size, the path strlen will be at most dstSize-1 |
Definition at line 4621 of file libsheepy.c.

| ssize_t readFile | ( | const char * | filePath, |
| void ** | buffer | ||
| ) |
read file to buffer
The function allocates the buffer
| filePath | path to file |
| buffer | unallocated buffer |
Definition at line 4726 of file libsheepy.c.

| ssize_t bReadFile | ( | const char * | filePath, |
| void * | buffer | ||
| ) |
buffer read file to buffer
The function allocates the buffer
| filePath | path to file |
| buffer | already allocated buffer |
Definition at line 4782 of file libsheepy.c.

| ssize_t bLReadFile | ( | const char * | filePath, |
| void * | buffer, | ||
| size_t | dstSize | ||
| ) |
buffer size read file to buffer
The function allocates the buffer
| filePath | path to file |
| buffer | already allocated buffer |
| dstSize | path buffer size |
Definition at line 4832 of file libsheepy.c.

| void* readStreamToS | ( | FILE * | fp | ) |
read file to string
0 is added at the end to terminate the string
| fp | file pointer |
Definition at line 4482 of file libsheepy.c.


| void* bReadStreamToS | ( | FILE * | fp, |
| void * | dst | ||
| ) |
buffer read file to string
0 is added at the end to terminate the string
| dst | destination buffer |
| fp | file pointer |
Definition at line 4579 of file libsheepy.c.

| void* bLReadStreamToS | ( | FILE * | fp, |
| void * | dst, | ||
| size_t | dstSize | ||
| ) |
buffer size read file to string
0 is added at the end to terminate the string
| dst | destination buffer |
| fp | file pointer |
Definition at line 4678 of file libsheepy.c.

| int writeFileS | ( | const char * | filePath, |
| const char * | string | ||
| ) |
write string to file
| filePath | path to file string |
Definition at line 4883 of file libsheepy.c.


| int writeFile | ( | const char * | filePath, |
| void * | buffer, | ||
| size_t | len | ||
| ) |
write buffer to file
| filePath | path to file buffer len buffer size in bytes |
Definition at line 4925 of file libsheepy.c.

| int writeStreamS | ( | FILE * | fp, |
| const char * | string | ||
| ) |
write string to file
| fp | file pointer string |
Definition at line 4963 of file libsheepy.c.

| int writeLStream | ( | FILE * | fp, |
| void * | buffer, | ||
| size_t | len | ||
| ) |
write buffer to file
| fp | file pointer buffer len buffer size in bytes |
Definition at line 4995 of file libsheepy.c.
| bool appendFileS | ( | const char * | filePath, |
| const char * | string | ||
| ) |
append string to filePath
| filePath | path to file string |
Definition at line 5023 of file libsheepy.c.


| bool appendFile | ( | const char * | filePath, |
| void * | buffer, | ||
| size_t | len | ||
| ) |
append buffer to file
| filePath | path to file buffer len buffer size in bytes |
Definition at line 5064 of file libsheepy.c.

| char** walkDir | ( | const char * | dirPath | ) |
list all files in a directory recursively and sort the list
directories are not listed
| dirPath | path to directory |
Definition at line 5103 of file libsheepy.c.

| char** walkDirDir | ( | const char * | dirPath | ) |
list all directories in a directory recursively and sort the list
files are not listed
| dirPath | path to directory |
Definition at line 5166 of file libsheepy.c.

| char** readDir | ( | const char * | dirPath | ) |
list files in a directory and sort the list
directories are not listed
| dirPath | path to directory |
Definition at line 5227 of file libsheepy.c.

| char** readDirDir | ( | const char * | dirPath | ) |
list directories in a directory and sort the list
files are not listed
| dirPath | path to directory |
Definition at line 5279 of file libsheepy.c.

| char** walkDirAll | ( | const char * | dirPath | ) |
list all files and directories in a directory recursively and sort the list
directories are listed
| dirPath | path to directory |
Definition at line 5331 of file libsheepy.c.

| char** readDirAll | ( | const char * | dirPath | ) |
list files in a directory and sort the list
directories are listed
| dirPath | path to directory |
Definition at line 5392 of file libsheepy.c.

| mode_t getUmask | ( | void | ) |
| mode_t getCurrentPermissions | ( | void | ) |
get current permissions for creating directories
Definition at line 5443 of file libsheepy.c.


| int mkdirParents | ( | const char * | path | ) |
recursive mkdir
| path |
Definition at line 5457 of file libsheepy.c.


| int rmAll | ( | const char * | path | ) |
remove all delete recursively files and directories
| path |
Definition at line 5510 of file libsheepy.c.


| int copy | ( | const char * | src, |
| const char * | dst | ||
| ) |
copy files recursively This function is equivalent to 'cp -Ra' without wildcards and circular link detection
when src ends with /, the files in src are copied to dst when src does't end with /, the last directory name in src is copied to dst The permissions are copied to the destination
| src | source path dst destination path |
Definition at line 5590 of file libsheepy.c.


| int shRename | ( | const char * | src, |
| const char * | dst | ||
| ) |
rename file
| src | source path dst destination path |
Definition at line 5808 of file libsheepy.c.


| int shMove | ( | const char * | src, |
| const char * | dst | ||
| ) |
move files recursively
copy and then delete source
called shMove because it conflicts with move in ncurses
| src | source path |
| dst | destination path |
Definition at line 5845 of file libsheepy.c.


| void setSoftwareRandom | ( | void | ) |
use software random numbers works on all cpu architectures the default random function is software
Definition at line 5869 of file libsheepy.c.
| void setHardwareRandom | ( | void | ) |
use cpu hardware random number generator
Definition at line 5878 of file libsheepy.c.
| int randomUrandomOpen | ( | void | ) |
open /dev/urandom in libsheepy
call this function before calling randomWord and randomChoice when random are not needed anymore call randomUrandomClose
Definition at line 5895 of file libsheepy.c.
| void randomUrandomClose | ( | void | ) |
close /dev/urandom in libsheepy call this function when random are not needed anymore
Definition at line 5916 of file libsheepy.c.
| uint64_t randomWord | ( | void | ) |
return random 64 bit unsigned integer call randomUrandomOpen before this calling function
Definition at line 5933 of file libsheepy.c.
| uint64_t randomWordFromHW | ( | void | ) |
return random 64 bit unsigned integer from the cpu when the cpu doesn't have the random generator instruction, the program stops with 'Illegal instruction'
Definition at line 5959 of file libsheepy.c.
| uint64_t randomChoice | ( | uint64_t | range | ) |
return a random value between 0 and range 0<=value<range call randomUrandomOpen before this calling function
| range | - must be > 0 |
Definition at line 5991 of file libsheepy.c.
| char* randomS | ( | uint64_t | length | ) |
random string
allocate and generate a random string in charset "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_-,"
| string | length |
Definition at line 6020 of file libsheepy.c.

| char* bRandomS | ( | char * | dst, |
| size_t | dstSize | ||
| ) |
buffer random string
allocate and generate a random string in charset "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_-,"
| dst | destination buffer |
| dstSize | destination buffer size, must be at least 2, to have at least 1 random char in the string |
Definition at line 6080 of file libsheepy.c.
| char* randomAlphaNumS | ( | uint64_t | length | ) |
random alpha numerical string
allocate and generate a random string in charset "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
| string | length |
Definition at line 6132 of file libsheepy.c.

| char* bRandomAlphaNumS | ( | char * | dst, |
| size_t | dstSize | ||
| ) |
buffer random alpha numerical string
allocate and generate a random string in charset "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
| dst | destination buffer |
| dstSize | destination buffer size, must be at least 2, to have at least 1 random char in the string |
Definition at line 6192 of file libsheepy.c.
| char* readS | ( | void | ) |
read String read user input (one line) as a string
there is no size limit and the buffer expands as needed
Definition at line 6244 of file libsheepy.c.


| char* bLReadS | ( | char * | dst, |
| size_t | dstSize | ||
| ) |
buffer read String read user input (one line) as a string
| dst | destination buffer |
| dstSize | destination buffer size, must be at least 2, to have at least 1 char from the user in the string |
Definition at line 6297 of file libsheepy.c.
| char* readPasswordS | ( | void | ) |
read hidden password string
Definition at line 6377 of file libsheepy.c.

| bool zeroS | ( | char * | string | ) |
write zero to all bytes in string with memset, for clearing password buffers
| string |
Definition at line 6403 of file libsheepy.c.
| bool zeroBuf | ( | void * | buf, |
| size_t | len | ||
| ) |
write zero to all bytes in buffer with memset
| buf | buffer |
| len | length |
Definition at line 6425 of file libsheepy.c.
| void* memdup | ( | const void * | buf, |
| size_t | size | ||
| ) |
memory duplicate allocate and copy buffer
| buf | buffer to duplicate |
| size | buffer size |
Definition at line 6448 of file libsheepy.c.
| void readEnter | ( | void | ) |
read Enter key wait until press the enter key
Definition at line 6468 of file libsheepy.c.
| char* readLine | ( | FILE * | fp | ) |
readLine from file stream the fist new line is converted to 0
| fp | file stream |
Definition at line 6493 of file libsheepy.c.


| void freeManySF | ( | char * | paramType, |
| ... | |||
| ) |
free Many String
free variable list of pointers freeManyS(s1, s2, ...);
Definition at line 6526 of file libsheepy.c.

| char* dupS | ( | const char * | string | ) |
duplicate string
| string |
Definition at line 6548 of file libsheepy.c.

| void shPrintfS | ( | const char * | fmt, |
| ... | |||
| ) |
sheepy Print String
same as printf when the formating string is NULL, "(null)" is printed
| format | string - can be NULL data |
Definition at line 6566 of file libsheepy.c.
| void shEPrintfS | ( | const char * | fmt, |
| ... | |||
| ) |
sheepy Error printf String print with logE
when the formating string is NULL, "(null)" is printed
| format | string like printf |
Definition at line 6589 of file libsheepy.c.


| void logNFree | ( | char * | s | ) |
log and free
| string | to print, can be NULL |
Definition at line 6613 of file libsheepy.c.


| void loghex | ( | const void * | buf, |
| size_t | len | ||
| ) |
print buffer as hexadecimal string
Definition at line 6624 of file libsheepy.c.
| char* toHexS | ( | const void * | buf, |
| size_t | len | ||
| ) |
create a string with bytes in buf converted to hex strings
| buf | buffer to convert to hexstring |
| len | buffer size in bytes |
Definition at line 6648 of file libsheepy.c.
| char* toHexSepS | ( | const void * | buf, |
| size_t | len, | ||
| const char * | separator | ||
| ) |
create a string with bytes in buf converted to hex strings separated by separator
| buf | buffer to convert to hexstring |
| len | buffer size in bytes |
| separator | separator between the hexadecimal numbers |
Definition at line 6686 of file libsheepy.c.

| char* toHexHeadSepS | ( | const void * | buf, |
| size_t | len, | ||
| const char * | head, | ||
| const char * | separator | ||
| ) |
create a string with bytes in buf converted to hex strings separated by separator and with head string in front of earch byte: HEADffSEP
| buf | buffer to convert to hexstring |
| len | buffer size in bytes |
| head | separator before each hexadecimal numbers |
| separator | separator after each hexadecimal numbers |
Definition at line 6728 of file libsheepy.c.
| char* strCpy | ( | char *restrict | dst, |
| const char *restrict | src | ||
| ) |
strCpy - copy src to dst
like strcpy with sanity checks
| dst | destination buffer |
| src | source string |
Definition at line 6771 of file libsheepy.c.
| char* strNCpy | ( | char *restrict | dst, |
| const char *restrict | src, | ||
| size_t | srcSize | ||
| ) |
strNCpy - copy src to dst
null safe version of strncpy
| dst | destination buffer |
| src | source string |
| srcSize | source buffer size |
Definition at line 6796 of file libsheepy.c.
| char* strLCpy | ( | char *restrict | dst, |
| size_t | dstSize, | ||
| const char *restrict | src | ||
| ) |
strLCpy - copy src to dst
like strncpy and the NUL char is always added at the end of the string
| dst | destination buffer |
| dstSize | destination buffer size, result string will be no longer than dstSize-1 |
| src | source string |
Definition at line 6822 of file libsheepy.c.

| char* strCat | ( | char *restrict | dst, |
| const char *restrict | src | ||
| ) |
strCat - concatenate two strings
like strcat with sanity checks
| dst | destination buffer |
| src | source string |
Definition at line 6848 of file libsheepy.c.
| char* strNCat | ( | char *restrict | dst, |
| const char *restrict | src, | ||
| size_t | srcLen | ||
| ) |
strNCat - concatenate two strings
like strncat with sanity checks
| dst | destination buffer |
| src | source string |
| srcLen | max source len |
Definition at line 6872 of file libsheepy.c.
| char* strLCat | ( | char *restrict | dst, |
| size_t | dstSize, | ||
| const char *restrict | src | ||
| ) |
strLCat - concatenate two strings
like strlcat with sanity checks
| dst | destination buffer |
| src | source string |
| dstSize | destination buffer size, result string will be no longer than dstSize-1 |
Definition at line 6897 of file libsheepy.c.

| char* strLNCat | ( | char *restrict | dst, |
| size_t | dstSize, | ||
| const char *restrict | src, | ||
| size_t | srcLen | ||
| ) |
strLNCat - concatenate two strings
like strlcat with sanity checks
| dst | destination buffer |
| src | source string |
| dstSize | destination buffer size, result string will be no longer than dstSize-1 |
| srcLen | max source len |
Definition at line 6966 of file libsheepy.c.

| char* catSF | ( | const char * | paramType, |
| ... | |||
| ) |
cat String Function
| arbitrary | list of strings seperated by commas |
Definition at line 6998 of file libsheepy.c.

| char* iCatSF | ( | char * | dst, |
| const char * | paramType, | ||
| ... | |||
| ) |
cat and copy String Function dst has to be big enough to hold the result
| dst | result destination buffer arbitrary list of strings seperated by commas |
Definition at line 7027 of file libsheepy.c.
| char* bLCatSF | ( | char * | dst, |
| size_t | dstSize, | ||
| const char * | paramType, | ||
| ... | |||
| ) |
cat and copy String Function
| dst | result destination buffer arbitrary list of strings seperated by commas |
Definition at line 7057 of file libsheepy.c.

| char* formatS | ( | const char * | fmt, |
| ... | |||
| ) |
format string allocate and format string using asprintf
| format | string and other parameters |
Definition at line 7092 of file libsheepy.c.

| char* bFormatS | ( | char * | string, |
| const char * | fmt, | ||
| ... | |||
| ) |
format and store in string: bFormatS(string, "Value %d", i);
format and store in string: bFormatS(string, "Value %d", i);
| format | string and other parameters |
Definition at line 7117 of file libsheepy.c.
| char* bLFormatS | ( | char * | string, |
| size_t | stringSize, | ||
| const char * | fmt, | ||
| ... | |||
| ) |
format and store in string: bLFormatS(string, sizeof(string), "Value %d", i);
format and store in string: bLFormatS(string, sizeof(string), "Value %d", i);
| format | string and other parameters |
Definition at line 7140 of file libsheepy.c.
| char* appendS | ( | const char * | string1, |
| const char * | string2 | ||
| ) |
append strings
| string1 | string string2 string to append at the end of string1 |
Definition at line 7166 of file libsheepy.c.

| char* appendCharS | ( | const char * | string1, |
| char | c | ||
| ) |
append char to string when c is 0 the result is string1
| string1 | string c char to append |
Definition at line 7209 of file libsheepy.c.

| char* appendSChar | ( | char | c, |
| const char * | string2 | ||
| ) |
append string to char
| string1 | string c char to append |
Definition at line 7245 of file libsheepy.c.

| char* iAppendS | ( | char ** | string1, |
| const char * | string2 | ||
| ) |
append strings
| string1 | string, which is reallocated. string2 string to append at the end of string1 |
Definition at line 7285 of file libsheepy.c.

| char* iAppendCharS | ( | char ** | string1, |
| char | c | ||
| ) |
append char to string
| string1 | string, which is reallocated. c char to append at the end of string1 |
Definition at line 7329 of file libsheepy.c.

| char* iAppendNFreeS | ( | char ** | string1, |
| char * | string2 | ||
| ) |
append and free strings
string2 is freed (except when there is an error)
| string1 | string, which is reallocated. string2 string to append at the end of string1 |
Definition at line 7368 of file libsheepy.c.


| char* iAppendManySF | ( | char ** | string, |
| const char * | paramType, | ||
| ... | |||
| ) |
append many strings
| string1 | string, which is reallocated. string2 string to append at the end of string1 |
Definition at line 7388 of file libsheepy.c.

| char* bAppendManySF | ( | char * | string, |
| const char * | paramType, | ||
| ... | |||
| ) |
buffer append many strings
| string1 | string string2 string to append at the end of string1 |
Definition at line 7427 of file libsheepy.c.

| char* bLAppendManySF | ( | char * | string, |
| size_t | stringSize, | ||
| const char * | paramType, | ||
| ... | |||
| ) |
buffer size append many strings
| string1 | string string2 string to append at the end of string1 |
Definition at line 7466 of file libsheepy.c.

| char* prependS | ( | const char * | string1, |
| const char * | string2 | ||
| ) |
prepend strings
| string1 | string string2 string to prepend at the beginning of string1 |
Definition at line 7511 of file libsheepy.c.

| char* prependCharS | ( | const char * | string1, |
| char | c | ||
| ) |
prepend char to string
| string1 | string c char to prepend at the beginning of string1 |
Definition at line 7526 of file libsheepy.c.

| char* prependSChar | ( | char | c, |
| const char * | string2 | ||
| ) |
prepend string to char
| c | char string2 string to prepend at the beginning of c |
Definition at line 7541 of file libsheepy.c.

| char* iPrependS | ( | char ** | string1, |
| const char * | string2 | ||
| ) |
prepend strings
| string1 | string, which is reallocated. string2 string to prepend at the beginning of string1 |
Definition at line 7557 of file libsheepy.c.


| char* iPrependCharS | ( | char ** | string1, |
| char | c | ||
| ) |
prepend char to string
| string1 | string, which is reallocated. c char to prepend at the beginning of string1 |
Definition at line 7591 of file libsheepy.c.
| char* iPrependNFreeS | ( | char ** | string1, |
| char * | string2 | ||
| ) |
prepend and free strings
string2 is freed
| string1 | string, which is reallocated. string2 string to prepend at the beginning of string1 |
Definition at line 7634 of file libsheepy.c.

| char* bPrependS | ( | char * | string1, |
| const char * | string2 | ||
| ) |
buffer prepend strings
| string1 | string string2 string to prepend at the beginning of string1 |
Definition at line 7655 of file libsheepy.c.


| char* bLPrependS | ( | char * | string1, |
| size_t | string1Size, | ||
| const char * | string2 | ||
| ) |
buffer prepend strings
| string1 | string string2 string to prepend at the beginning of string1 |
Definition at line 7687 of file libsheepy.c.


| char* replaceS | ( | const char * | s, |
| const char * | olds, | ||
| const char * | news, | ||
| size_t | max | ||
| ) |
replace String the original remains unchanged duplicate s the olds string is replaced with the news string max times in the result 0 for max means replace all olds strings
| s | string olds: old string to be replaced in s news: new string replacing olds in s max: number of times to replace olds, 0 to replace all found olds |
Definition at line 7731 of file libsheepy.c.


| char* replaceCharSS | ( | const char * | s, |
| char | olds, | ||
| const char * | news, | ||
| size_t | max | ||
| ) |
| char* replaceSCharS | ( | const char * | s, |
| const char * | olds, | ||
| char | news, | ||
| size_t | max | ||
| ) |
| char* replaceCharCharS | ( | const char * | s, |
| char | olds, | ||
| char | news, | ||
| size_t | max | ||
| ) |
| size_t replaceSLen | ( | const char * | s, |
| const char * | olds, | ||
| const char * | news, | ||
| size_t | max | ||
| ) |
replaceSLen returns the length of the resulting string
Definition at line 7827 of file libsheepy.c.

| char* iReplaceS | ( | char ** | s, |
| const char * | olds, | ||
| const char * | news, | ||
| size_t | max | ||
| ) |
replace String the olds string is replaced with the news string max times in the result 0 for max means replace all olds strings
| s | string (that is allocated with malloc) olds: old string to be replaced in s news: new string replacing olds in s max: number of times to replace olds, 0 to replace all found olds |
Definition at line 7892 of file libsheepy.c.


| char* iReplaceCharSS | ( | char ** | s, |
| char | olds, | ||
| const char * | news, | ||
| size_t | max | ||
| ) |
| char* iReplaceSCharS | ( | char ** | s, |
| const char * | olds, | ||
| char | news, | ||
| size_t | max | ||
| ) |
| char* iReplaceCharCharS | ( | char ** | s, |
| char | olds, | ||
| char | news, | ||
| size_t | max | ||
| ) |
| char* bReplaceS | ( | char * | s, |
| const char * | olds, | ||
| const char * | news, | ||
| size_t | max | ||
| ) |
buffer replace String the olds string is replaced with the news string max times in the result 0 for max means replace all olds strings
| s | string olds: old string to be replaced in s news: new string replacing olds in s max: number of times to replace olds, 0 to replace all found olds |
Definition at line 8004 of file libsheepy.c.


| char* bLReplaceS | ( | char * | s, |
| size_t | sSize, | ||
| const char * | olds, | ||
| const char * | news, | ||
| size_t | max | ||
| ) |
buffer size replace String the olds string is replaced with the news string max times in the result 0 for max means replace all olds strings
| s | string olds: old string to be replaced in s news: new string replacing olds in s max: number of times to replace olds, 0 to replace all found olds |
Definition at line 8097 of file libsheepy.c.


| char* replaceManySF | ( | const char * | paramType, |
| ... | |||
| ) |
replace Many Strings the original remains unchanged duplicate s the olds string is replaced with the news string max times in the result
Example: r = replaceManyS("asd", "s", "BNM", "a", "AAA") ^olds ^news ^olds ^news
| s | string olds: old string to be replaced in s news: new string replacing olds in s ... |
Definition at line 8202 of file libsheepy.c.

| char* iReplaceManySF | ( | char ** | s, |
| char * | paramType, | ||
| ... | |||
| ) |
replace Many Strings the olds string is replaced with the news string max times in the result
Example: iReplaceManyS(s, "s", "BNM", "a", "AAA") ^olds ^news ^olds ^news
| string | (this parameter is reallocated) olds: old string to be replaced in s news: new string replacing olds in s ... |
Definition at line 8263 of file libsheepy.c.

| char* bReplaceManySF | ( | char * | s, |
| char * | paramType, | ||
| ... | |||
| ) |
buffer replace Many Strings the olds string is replaced with the news string max times in the result
Example: bReplaceManyS(s, "s", "BNM", "a", "AAA") ^olds ^news ^olds ^news
| string | olds: old string to be replaced in s news: new string replacing olds in s ... |
Definition at line 8317 of file libsheepy.c.

| char* bLReplaceManySF | ( | char * | s, |
| size_t | sSize, | ||
| char * | paramType, | ||
| ... | |||
| ) |
buffer size replace Many Strings the olds string is replaced with the news string max times in the result
Example: bReplaceManyS(s, "s", "BNM", "a", "AAA") ^olds ^news ^olds ^news
| string | olds: old string to be replaced in s news: new string replacing olds in s ... |
Definition at line 8371 of file libsheepy.c.

| char* icReplaceS | ( | const char * | s, |
| const char * | olds, | ||
| const char * | news, | ||
| size_t | max | ||
| ) |
ignore case Replace String the original remains unchanged duplicate s the olds string is replaced with the news string max times in the result 0 for max means replace all olds strings
| s | string olds: old string to be replaced in s news: new string replacing olds in s max: number of times to replace olds, 0 to replace all found olds |
Definition at line 8429 of file libsheepy.c.


| char* icReplaceCharSS | ( | const char * | s, |
| char | olds, | ||
| const char * | news, | ||
| size_t | max | ||
| ) |
| char* icReplaceSCharS | ( | const char * | s, |
| const char * | olds, | ||
| char | news, | ||
| size_t | max | ||
| ) |
| char* icReplaceCharCharS | ( | const char * | s, |
| char | olds, | ||
| char | news, | ||
| size_t | max | ||
| ) |
| char* iicReplaceS | ( | char ** | s, |
| const char * | olds, | ||
| const char * | news, | ||
| size_t | max | ||
| ) |
in place ignore case replace String the olds string is replaced with the news string max times in the result 0 for max means replace all olds strings
| s | string (this parameter is reallocated) olds: old string to be replaced in s news: new string replacing olds in s max: number of times to replace olds, 0 to replace all found olds |
Definition at line 8537 of file libsheepy.c.


| char* iicReplaceCharSS | ( | char ** | s, |
| char | olds, | ||
| const char * | news, | ||
| size_t | max | ||
| ) |
| char* iicReplaceSCharS | ( | char ** | s, |
| const char * | olds, | ||
| char | news, | ||
| size_t | max | ||
| ) |
| char* iicReplaceCharCharS | ( | char ** | s, |
| char | olds, | ||
| char | news, | ||
| size_t | max | ||
| ) |
| char* bicReplaceS | ( | char * | s, |
| const char * | olds, | ||
| const char * | news, | ||
| size_t | max | ||
| ) |
buffer ignore case replace String the olds string is replaced with the news string max times in the result 0 for max means replace all olds strings
| s | string olds: old string to be replaced in s news: new string replacing olds in s max: number of times to replace olds, 0 to replace all found olds |
Definition at line 8649 of file libsheepy.c.


| char* bLicReplaceS | ( | char * | s, |
| size_t | sSize, | ||
| const char * | olds, | ||
| const char * | news, | ||
| size_t | max | ||
| ) |
buffer size ignore case replace String the olds string is replaced with the news string max times in the result 0 for max means replace all olds strings
| s | string olds: old string to be replaced in s news: new string replacing olds in s max: number of times to replace olds, 0 to replace all found olds |
Definition at line 8742 of file libsheepy.c.


| char* icReplaceManySF | ( | const char * | paramType, |
| ... | |||
| ) |
ignore case replace Many Strings the original remains unchanged duplicate s the olds string is replaced with the news string max times in the result
Example: r = icReplaceManyS("asd", "s", "BNM", "a", "AAA") ^olds ^news ^olds ^news
| s | string olds: old string to be replaced in s news: new string replacing olds in s ... |
Definition at line 8847 of file libsheepy.c.

| char* iicReplaceManySF | ( | char ** | s, |
| char * | paramType, | ||
| ... | |||
| ) |
in place ignore case replace Many Strings the olds string is replaced with the news string max times in the result
Example: iicReplaceManyS(s, "s", "BNM", "a", "AAA") ^olds ^news ^olds ^news
| string | (this parameter is reallocated) olds: old string to be replaced in s news: new string replacing olds in s ... |
Definition at line 8908 of file libsheepy.c.

| char* bicReplaceManySF | ( | char * | s, |
| char * | paramType, | ||
| ... | |||
| ) |
buffer ignore case replace Many Strings the olds string is replaced with the news string max times in the result
Example: bReplaceManyS(s, "s", "BNM", "a", "AAA") ^olds ^news ^olds ^news
| string | olds: old string to be replaced in s news: new string replacing olds in s ... |
Definition at line 8962 of file libsheepy.c.

| char* bLicReplaceManySF | ( | char * | s, |
| size_t | sSize, | ||
| char * | paramType, | ||
| ... | |||
| ) |
buffer size ignore case replace Many Strings the olds string is replaced with the news string max times in the result
Example: bReplaceManyS(s, "s", "BNM", "a", "AAA") ^olds ^news ^olds ^news
| string | olds: old string to be replaced in s news: new string replacing olds in s ... |
Definition at line 9016 of file libsheepy.c.

| bool eqS | ( | const char * | string1, |
| const char * | string2 | ||
| ) |
string Equal compare string1 to string2
| 2 | strings |
Definition at line 9067 of file libsheepy.c.

| bool eqCharS | ( | char | c, |
| const char * | string2 | ||
| ) |
Definition at line 9076 of file libsheepy.c.
| bool eqSChar | ( | const char * | string1, |
| char | c | ||
| ) |
Definition at line 9086 of file libsheepy.c.
| bool eqIS | ( | const char * | string1, |
| const char * | string2, | ||
| int64_t | index | ||
| ) |
string Index Equal compare string1 at index to string2 when string2 is empty, the result is false
| 2 | strings |
Definition at line 9107 of file libsheepy.c.

| bool eqICharS | ( | const char * | string1, |
| char | c, | ||
| int64_t | index | ||
| ) |
Definition at line 9142 of file libsheepy.c.


| bool startsWithS | ( | const char * | string1, |
| const char * | string2 | ||
| ) |
starts With String compare start of string1 with string2
| 2 | strings |
Definition at line 9158 of file libsheepy.c.

| bool startsWithCharS | ( | const char * | string1, |
| char | c | ||
| ) |
Definition at line 9167 of file libsheepy.c.
| bool endsWithS | ( | const char * | string1, |
| const char * | string2 | ||
| ) |
ends With String compare end of string1 with string2
| 2 | strings |
Definition at line 9185 of file libsheepy.c.

| bool endsWithCharS | ( | const char * | string1, |
| char | c | ||
| ) |
Definition at line 9198 of file libsheepy.c.
| ssize_t countS | ( | const char * | s, |
| const char * | needle | ||
| ) |
count String count number of (non-overlapping) occurrences of a substring
Example: assert(countS("aaa aaa", "a") == 6); assert(countS("aaa aaa", "ab") == 0); assert(countS("aaa aaa", "aa") == 2);
| 2 | strings |
Definition at line 9230 of file libsheepy.c.
| ssize_t countCharS | ( | const char * | s, |
| char | c | ||
| ) |
Definition at line 9254 of file libsheepy.c.
| bool icEqS | ( | const char * | string1, |
| const char * | string2 | ||
| ) |
ignore case string Equal compare string1 to string2
| 2 | strings |
Definition at line 9283 of file libsheepy.c.

| bool icEqCharS | ( | char | c, |
| const char * | string2 | ||
| ) |
Definition at line 9292 of file libsheepy.c.
| bool icEqSChar | ( | const char * | string1, |
| char | c | ||
| ) |
Definition at line 9302 of file libsheepy.c.
| bool icEqIS | ( | const char * | string1, |
| const char * | string2, | ||
| int64_t | index | ||
| ) |
ignore case string Index Equal compare string1 at index to string2 when string2 is empty, the result is false
| 2 | strings |
Definition at line 9323 of file libsheepy.c.

| bool icEqICharS | ( | const char * | string1, |
| char | c, | ||
| int64_t | index | ||
| ) |
| bool icStartsWithS | ( | const char * | string1, |
| const char * | string2 | ||
| ) |
ignore case starts With String compare start of string1 with string2
| 2 | strings |
Definition at line 9374 of file libsheepy.c.
| bool icStartsWithCharS | ( | const char * | string1, |
| char | c | ||
| ) |
Definition at line 9383 of file libsheepy.c.
| bool icEndsWithS | ( | const char * | string1, |
| const char * | string2 | ||
| ) |
ignore case ends With String compare end of string1 with string2
| 2 | strings |
Definition at line 9401 of file libsheepy.c.
| bool icEndsWithCharS | ( | const char * | string1, |
| char | c | ||
| ) |
Definition at line 9414 of file libsheepy.c.
| ssize_t icCountS | ( | const char * | s, |
| const char * | needle | ||
| ) |
ignore case count String count number of (non-overlapping) occurrences of a substring
Example: assert(countS("aaa aaa", "a") == 6); assert(countS("aaa aaa", "ab") == 0); assert(countS("aaa aaa", "aa") == 2);
| 2 | strings |
Definition at line 9446 of file libsheepy.c.
| ssize_t icCountCharS | ( | const char * | s, |
| char | c | ||
| ) |
Definition at line 9470 of file libsheepy.c.
| bool hasCtrlChar | ( | const char * | string | ) |
has control char
Definition at line 9497 of file libsheepy.c.
| char* stripCtrlS | ( | const char * | string | ) |
remove terminal control char from string
| string |
Definition at line 9521 of file libsheepy.c.
| char* iStripCtrlS | ( | char ** | string | ) |
remove terminal control char from string
| string | pointer to a string |
Definition at line 9553 of file libsheepy.c.
| char* bStripCtrlS | ( | char * | string | ) |
remove terminal control char from string
| string |
Definition at line 9581 of file libsheepy.c.
| char* stripColorsS | ( | const char * | string | ) |
remove ansi colors from string
| string |
Definition at line 9609 of file libsheepy.c.
| char* iStripColorsS | ( | char ** | string | ) |
remove ansi colors from string
| string | pointer to a string |
Definition at line 9690 of file libsheepy.c.
| char* bStripColorsS | ( | char * | string | ) |
remove terminal control char from string
| string |
Definition at line 9768 of file libsheepy.c.
| char* quoteS | ( | const char * | s, |
| char | delim | ||
| ) |
add backslash '\' before delim('\'' or '"') and backslash the backslashes in the result avoid splitting the string when it is in a source file or a json string
| s | string to escape |
| delim | string delimiter ' or " |
Definition at line 9850 of file libsheepy.c.
| char* bQuoteS | ( | char * | dest, |
| const char * | s, | ||
| char | delim | ||
| ) |
add backslash '\' before delim('\'' or '"') and backslash the backslashes in the result avoid splitting the string when it is in a source file or a json string
| dest | destination buffer, it should be big enough |
| s | string to escape |
| delim | string delimiter ' or " |
Definition at line 9914 of file libsheepy.c.
| char* bLQuoteS | ( | char * | dest, |
| size_t | destSize, | ||
| const char * | s, | ||
| char | delim | ||
| ) |
add backslash '\' before delim('\'' or '"') and backslash the backslashes in the result avoid splitting the string when it is in a source file or a json string
| dest | destination buffer |
| destSize | destination buffer size |
| s | string to escape |
| delim | string delimiter ' or " |
Definition at line 9959 of file libsheepy.c.
| size_t quoteLenS | ( | const char * | s, |
| char | delim | ||
| ) |
return the length of the escaped string (without the terminating \0)
Definition at line 10007 of file libsheepy.c.
| char* escapeS | ( | const char * | s, |
| char | delim | ||
| ) |
escape string according the json specification (RFC 8259) if there is in the string, the backslash is escaped and it will be parsed as the string '' be the json parsers the unicode characters should be converted to UTF8 codepoints instead of using the result can be included in a json string and the parsing will be correct
| s | string to escape |
| delim | string delimiter ' or " |
Definition at line 10045 of file libsheepy.c.

| char* bEscapeS | ( | char * | dest, |
| const char * | s, | ||
| char | delim | ||
| ) |
escape string according the json specification (RFC 8259) if there is in the string, the backslash is escaped and it will be parsed as the string '' be the json parsers the unicode characters should be converted to UTF8 codepoints instead of using the result can be included in a json string and the parsing will be correct
| dest | destination buffer |
| s | string to escape |
| delim | string delimiter ' or " |
Definition at line 10134 of file libsheepy.c.
| char* bLEscapeS | ( | char * | dest, |
| size_t | destSize, | ||
| const char * | s, | ||
| char | delim | ||
| ) |
escape string according the json specification (RFC 8259) if there is in the string, the backslash is escaped and it will be parsed as the string '' be the json parsers the unicode characters should be converted to UTF8 codepoints instead of using the result can be included in a json string and the parsing will be correct
| dest | destination buffer |
| destSize | destination buffer size |
| s | string to escape |
| delim | string delimiter ' or " |
Definition at line 10205 of file libsheepy.c.
| size_t escapeLenS | ( | const char * | s, |
| char | delim | ||
| ) |
return the length of the escaped string (without the terminating \0)
Definition at line 10276 of file libsheepy.c.
| char nibbleToHex | ( | u8 | n | ) |
convert number between 0 and 15 to hexadecimal character '0' to 'F'
Definition at line 10301 of file libsheepy.c.

| char* cEscapeS | ( | const char * | S | ) |
escape string to become a valid C source string control characters, backslash and double quotes are escaped.
control characters without an escaped representation () are represented as hexidecimal literal '' the result can be included in C source code and the parsing will be correct
| S | string to escape |
Definition at line 10328 of file libsheepy.c.

| char* bCEscapeS | ( | char * | dest, |
| const char * | S | ||
| ) |
escape string to become a valid C source string control characters, backslash and double quotes are escaped.
control characters without an escaped representation () are represented as hexidecimal literal '' the result can be included in C source code and the parsing will be correct
| dest | destination buffer |
| S | string to escape |
Definition at line 10459 of file libsheepy.c.

| char* bLCEscapeS | ( | char * | dest, |
| size_t | destSize, | ||
| const char * | S | ||
| ) |
escape string to become a valid C source string control characters, backslash and double quotes are escaped.
control characters without an escaped representation () are represented as hexidecimal literal '' the result can be included in C source code and the parsing will be correct
| dest | destination buffer |
| destSize | destination buffer size |
| S | string to escape |
Definition at line 10549 of file libsheepy.c.

| size_t cEscapeLenS | ( | const char * | s | ) |
return the length of the escaped string (without the terminating \0)
Definition at line 10693 of file libsheepy.c.
| bool isNumber | ( | const char * | string | ) |
is Number (integer or float) String
1, -12 1e+4, -1.44E-1
| string |
Definition at line 10749 of file libsheepy.c.

| bool isInt | ( | const char * | string | ) |
is Integer String
| string |
Definition at line 10811 of file libsheepy.c.

| int64_t parseInt | ( | const char * | string | ) |
convert string to decimal integer
| string |
Definition at line 10846 of file libsheepy.c.


| int64_t parseIntChar | ( | char | c | ) |
Definition at line 10863 of file libsheepy.c.
| int64_t parseI64 | ( | const char * | string | ) |
convert string to decimal integer
| string |
Definition at line 10880 of file libsheepy.c.

| int64_t parseI64Char | ( | char | c | ) |
Definition at line 10897 of file libsheepy.c.
| double parseDouble | ( | const char * | string | ) |
convert string to double
| string |
Definition at line 10914 of file libsheepy.c.

| double parseDoubleChar | ( | char | c | ) |
Definition at line 10927 of file libsheepy.c.
| uint64_t parseHex | ( | const char * | string | ) |
parse hexadecimal number in a string
| string | hexadecimal string starting with 0x |
Definition at line 10944 of file libsheepy.c.


| char* intToS | ( | int64_t | n | ) |
int To String
convert int to string
| int64 | number |
Definition at line 10970 of file libsheepy.c.

| char* bIntToS | ( | char * | s, |
| int64_t | n | ||
| ) |
buffer int To String
convert int to string
| int64 | number |
Definition at line 10989 of file libsheepy.c.
| char* doubleToS | ( | double | n | ) |
double To String
convert int to string
| double | number |
Definition at line 11008 of file libsheepy.c.

| char* bDoubleToS | ( | char * | s, |
| double | n | ||
| ) |
buffer double To String
convert int to string
| double | number |
Definition at line 11027 of file libsheepy.c.
| size_t lenS | ( | const char * | string | ) |
length string
return strlen when possible
| string |
Definition at line 11047 of file libsheepy.c.

| size_t sizeS | ( | const char * | string | ) |
string buffer size
return strlen+1 when possible
| string |
Definition at line 11066 of file libsheepy.c.
| char* upperS | ( | const char * | string | ) |
upper case String duplicate string
| string |
Definition at line 11083 of file libsheepy.c.
| char* iUpperS | ( | char ** | string | ) |
upper case String
| string |
Definition at line 11114 of file libsheepy.c.
| char* bUpperS | ( | char * | string | ) |
buffer upper case String
| string |
Definition at line 11139 of file libsheepy.c.
| char* lowerS | ( | const char * | string | ) |
lower case String duplicate string
| string |
Definition at line 11164 of file libsheepy.c.
| char* iLowerS | ( | char ** | string | ) |
lower case String
| string |
Definition at line 11195 of file libsheepy.c.

| char* bLowerS | ( | char * | string | ) |
buffer lower case String
| string |
Definition at line 11220 of file libsheepy.c.
| char* trimS | ( | const char * | string | ) |
trim String duplicate string
| string |
Definition at line 11245 of file libsheepy.c.

| char* iTrimS | ( | char ** | string | ) |
trim String
| string | (this parameter is reallocated) |
Definition at line 11292 of file libsheepy.c.

| char* bTrimS | ( | char * | string | ) |
buffer trim String
| string |
Definition at line 11345 of file libsheepy.c.

| char* lTrimS | ( | const char * | string | ) |
left trim String duplicate string
| string |
Definition at line 11397 of file libsheepy.c.
| char* iLTrimS | ( | char ** | string | ) |
left trim String
| string | (this parameter is reallocated) |
Definition at line 11430 of file libsheepy.c.

| char* bLTrimS | ( | char * | string | ) |
buffer left trim String
| string |
Definition at line 11464 of file libsheepy.c.
| char* rTrimS | ( | const char * | string | ) |
right trim String duplicate string
| string |
Definition at line 11492 of file libsheepy.c.
| char* iRTrimS | ( | char ** | string | ) |
right trim String
| string |
Definition at line 11529 of file libsheepy.c.
| char* bRTrimS | ( | char * | string | ) |
buffer right trim String
| string |
Definition at line 11559 of file libsheepy.c.
| char* uniqS | ( | const char * | string, |
| char | c | ||
| ) |
uniq String duplicate string
remove successive repetitions of char c
| string | c character to remove |
Definition at line 11592 of file libsheepy.c.
| char* iUniqS | ( | char ** | string, |
| char | c | ||
| ) |
uniq String
remove successive repetitions of char c
| string | c character to remove |
Definition at line 11638 of file libsheepy.c.

| char* bUniqS | ( | char * | string, |
| char | c | ||
| ) |
buffer uniq String
remove successive repetitions of char c
| string | c character to remove |
Definition at line 11682 of file libsheepy.c.
| char* icUniqS | ( | const char * | string, |
| char | c | ||
| ) |
ignore case uniq String duplicate string
remove successive repetitions of char c
| string | c character to remove |
Definition at line 11726 of file libsheepy.c.
| char* iicUniqS | ( | char ** | string, |
| char | c | ||
| ) |
in place ignore case uniq String
remove successive repetitions of char c
| string | c character to remove |
Definition at line 11774 of file libsheepy.c.
| char* bicUniqS | ( | char * | string, |
| char | c | ||
| ) |
ignore case buffer uniq String
remove successive repetitions of char c
| string | c character to remove |
Definition at line 11820 of file libsheepy.c.
| char* repeatS | ( | const char * | string, |
| size_t | count | ||
| ) |
repeat string count times
| string | |
| count | number of times string is repeated |
Definition at line 11865 of file libsheepy.c.

| char* iRepeatS | ( | char ** | string, |
| size_t | count | ||
| ) |
repeat string count times
| string | (this parameter is reallocated) |
| count | number of times string is repeated |
Definition at line 11908 of file libsheepy.c.


| char* bRepeatS | ( | char * | dest, |
| const char * | string, | ||
| size_t | count | ||
| ) |
repeat string count times
| dest | buffer big enough to hold count times string |
| string | |
| count | number of times string is repeated |
Definition at line 11956 of file libsheepy.c.

| char* bLRepeatS | ( | char * | dest, |
| size_t | destSize, | ||
| const char * | string, | ||
| size_t | count | ||
| ) |
repeat string count times
| dest | buffer big enough to hold count times string |
| destSize | dest buffer size (sizeof(dest)) |
| string | |
| count | number of times string is repeated |
Definition at line 11996 of file libsheepy.c.

| char* repeatCharS | ( | char | c, |
| size_t | count | ||
| ) |
repeat char count times
| c | char to repeat |
| count | number of times c is repeated |
Definition at line 12036 of file libsheepy.c.

| char* bRepeatCharS | ( | char * | dest, |
| char | c, | ||
| size_t | count | ||
| ) |
repeat char count times
| dest | buffer big enough to hold count times c |
| c | char to repeat |
| count | number of times c is repeated |
Definition at line 12055 of file libsheepy.c.

| char* bLRepeatCharS | ( | char * | dest, |
| size_t | destSize, | ||
| char | c, | ||
| size_t | count | ||
| ) |
repeat char count times
| dest | buffer big enough to hold count times c |
| destSize | dest buffer size (sizeof(dest)) |
| c | char to repeat |
| count | number of times c is repeated |
Definition at line 12076 of file libsheepy.c.

| ssize_t repeatLenS | ( | const char * | string, |
| size_t | count | ||
| ) |
length of string repeated count times
| string | |
| count | number of times string is repeated |
Definition at line 12093 of file libsheepy.c.
| char* ellipsisStartS | ( | const char * | string, |
| size_t | targetLength, | ||
| const char * | ellipsisString | ||
| ) |
ellipsis start string
This function pads the current string with a given string if current string is longer than target length If target length is more than current string's length, the current string is returned as is
| string | |
| targetLength | The length of the resulting string once the current string has been padded. If the value is less than the current string's length, the current string is truncated from the right and the pad is applied once |
| ellipsisString | The string to pad the current string with. |
Definition at line 12126 of file libsheepy.c.

| char* iEllipsisStartS | ( | char ** | string, |
| size_t | targetLength, | ||
| const char * | ellipsisString | ||
| ) |
ellipsis start string
This function pads the current string with a given string if current string is longer than target length If target length is more than current string's length, the current string is returned as is
| string | (this parameter is reallocated) |
| targetLength | The length of the resulting string once the current string has been padded. If the value is less than the current string's length, the current string is truncated from the right and the pad is applied once |
| ellipsisString | The string to pad the current string with. |
Definition at line 12172 of file libsheepy.c.

| char* bEllipsisStartS | ( | char * | dest, |
| const char * | string, | ||
| size_t | targetLength, | ||
| const char * | ellipsisString | ||
| ) |
ellipsis start string
This function pads the current string with a given string if current string is longer than target length If target length is more than current string's length, the current string is returned as is
| string | |
| targetLength | The length of the resulting string once the current string has been padded. If the value is less than the current string's length, the current string is truncated from the right and the pad is applied once |
| ellipsisString | The string to pad the current string with. |
Definition at line 12217 of file libsheepy.c.

| char* bLEllipsisStartS | ( | char * | dest, |
| size_t | destSize, | ||
| const char * | string, | ||
| size_t | targetLength, | ||
| const char * | ellipsisString | ||
| ) |
ellipsis start string
This function pads the current string with a given string if current string is longer than target length If target length is more than current string's length, the current string is returned as is
| string | |
| targetLength | The length of the resulting string once the current string has been padded. If the value is less than the current string's length, the current string is truncated from the right and the pad is applied once |
| ellipsisString | The string to pad the current string with. |
Definition at line 12265 of file libsheepy.c.

| char* ellipsisStartCharS | ( | const char * | string, |
| size_t | targetLength, | ||
| char | ellipsisChar | ||
| ) |
ellipsis start string
This function pads the current string with a given string if current string is longer than target length If target length is more than current string's length, the current string is returned as is
| string | |
| targetLength | The length of the resulting string once the current string has been padded. If the value is less than the current string's length, the current string is truncated from the right and the pad is applied once |
| ellipsisChar | The char to pad the current string with. |
Definition at line 12319 of file libsheepy.c.

| char* iEllipsisStartCharS | ( | char ** | string, |
| size_t | targetLength, | ||
| char | ellipsisChar | ||
| ) |
ellipsis start string
This function pads the current string with a given string if current string is longer than target length If target length is more than current string's length, the current string is returned as is
| string | (this parameter is reallocated) |
| targetLength | The length of the resulting string once the current string has been padded. If the value is less than the current string's length, the current string is truncated from the right and the pad is applied once |
| ellipsisChar | The char to pad the current string with. |
Definition at line 12366 of file libsheepy.c.

| char* bEllipsisStartCharS | ( | char * | dest, |
| const char * | string, | ||
| size_t | targetLength, | ||
| char | ellipsisChar | ||
| ) |
ellipsis start string
This function pads the current string with a given string if current string is longer than target length If target length is more than current string's length, the current string is returned as is
| string | |
| targetLength | The length of the resulting string once the current string has been padded. If the value is less than the current string's length, the current string is truncated from the right and the pad is applied once |
| ellipsisChar | The char to pad the current string with. |
Definition at line 12413 of file libsheepy.c.

| char* bLEllipsisStartCharS | ( | char * | dest, |
| size_t | destSize, | ||
| const char * | string, | ||
| size_t | targetLength, | ||
| char | ellipsisChar | ||
| ) |
ellipsis start string
This function pads the current string with a given string if current string is longer than target length If target length is more than current string's length, the current string is returned as is
| string | |
| targetLength | The length of the resulting string once the current string has been padded. If the value is less than the current string's length, the current string is truncated from the right and the pad is applied once |
| ellipsisChar | The char to pad the current string with. |
Definition at line 12463 of file libsheepy.c.

| ssize_t ellipsisLenS | ( | const char * | string, |
| size_t | targetLength, | ||
| const char * | ellipsisString | ||
| ) |
length of string after ellipsis
| string |
Definition at line 12511 of file libsheepy.c.
| char* ellipsisEndS | ( | const char * | string, |
| size_t | targetLength, | ||
| const char * | ellipsisString | ||
| ) |
ellipsis end string
This function pads the current string with a given string if current string is longer than target length If target length is more than current string's length, the current string is returned as is
| string | |
| targetLength | The length of the resulting string once the current string has been padded. If the value is less than the current string's length, the current string is truncated from the left and the pad is applied once |
| ellipsisString | The string to pad the current string with. |
Definition at line 12546 of file libsheepy.c.

| char* iEllipsisEndS | ( | char ** | string, |
| size_t | targetLength, | ||
| const char * | ellipsisString | ||
| ) |
ellipsis end string
This function pads the current string with a given string if current string is longer than target length If target length is more than current string's length, the current string is returned as is
| string | (this parameter is reallocated) |
| targetLength | The length of the resulting string once the current string has been padded. If the value is less than the current string's length, the current string is truncated from the left and the pad is applied once |
| ellipsisString | The string to pad the current string with. |
Definition at line 12595 of file libsheepy.c.

| char* bEllipsisEndS | ( | char * | dest, |
| const char * | string, | ||
| size_t | targetLength, | ||
| const char * | ellipsisString | ||
| ) |
ellipsis end string
This function pads the current string with a given string if current string is longer than target length If target length is more than current string's length, the current string is returned as is
| string | |
| targetLength | The length of the resulting string once the current string has been padded. If the value is less than the current string's length, the current string is truncated from the left and the pad is applied once |
| ellipsisString | The string to pad the current string with. |
Definition at line 12644 of file libsheepy.c.

| char* bLEllipsisEndS | ( | char * | dest, |
| size_t | destSize, | ||
| const char * | string, | ||
| size_t | targetLength, | ||
| const char * | ellipsisString | ||
| ) |
ellipsis end string
This function pads the current string with a given string if current string is longer than target length If target length is more than current string's length, the current string is returned as is
| string | |
| targetLength | The length of the resulting string once the current string has been padded. If the value is less than the current string's length, the current string is truncated from the left and the pad is applied once |
| ellipsisString | The string to pad the current string with. |
Definition at line 12699 of file libsheepy.c.

| char* ellipsisEndCharS | ( | const char * | string, |
| size_t | targetLength, | ||
| char | ellipsisChar | ||
| ) |
ellipsis end string
This function pads the current string with a given string if current string is longer than target length If target length is more than current string's length, the current string is returned as is
| string | |
| targetLength | The length of the resulting string once the current string has been padded. If the value is less than the current string's length, the current string is truncated from the left and the pad is applied once |
| ellipsisChar | The char to pad the current string with. |
Definition at line 12757 of file libsheepy.c.

| char* iEllipsisEndCharS | ( | char ** | string, |
| size_t | targetLength, | ||
| char | ellipsisChar | ||
| ) |
ellipsis end string
This function pads the current string with a given string if current string is longer than target length If target length is more than current string's length, the current string is returned as is
| string | (this parameter is reallocated) |
| targetLength | The length of the resulting string once the current string has been padded. If the value is less than the current string's length, the current string is truncated from the left and the pad is applied once |
| ellipsisChar | The char to pad the current string with. |
Definition at line 12802 of file libsheepy.c.

| char* bEllipsisEndCharS | ( | char * | dest, |
| const char * | string, | ||
| size_t | targetLength, | ||
| char | ellipsisChar | ||
| ) |
ellipsis end string
This function pads the current string with a given string if current string is longer than target length If target length is more than current string's length, the current string is returned as is
| string | |
| targetLength | The length of the resulting string once the current string has been padded. If the value is less than the current string's length, the current string is truncated from the left and the pad is applied once |
| ellipsisChar | The char to pad the current string with. |
Definition at line 12847 of file libsheepy.c.

| char* bLEllipsisEndCharS | ( | char * | dest, |
| size_t | destSize, | ||
| const char * | string, | ||
| size_t | targetLength, | ||
| char | ellipsisChar | ||
| ) |
ellipsis end string
This function pads the current string with a given string if current string is longer than target length If target length is more than current string's length, the current string is returned as is
| string | |
| targetLength | The length of the resulting string once the current string has been padded. If the value is less than the current string's length, the current string is truncated from the left and the pad is applied once |
| ellipsisString | The string to pad the current string with. |
Definition at line 12898 of file libsheepy.c.

| char* padStartS | ( | const char * | string, |
| size_t | targetLength, | ||
| const char * | padString | ||
| ) |
pad start string
This function pads the current string with a given string (repeated, if needed) until the resulting string reaches a given length. The padding is applied from the start (left) of the current string
| string | |
| targetLength | The length of the resulting string once the current string has been padded. If the value is less than the current string's length, the current string is returned as is |
| padString | The string to pad the current string with. If this string is too long to stay within the target length, it will be truncated from the right. The current string is returned as is when an empty string is supplied |
Definition at line 12955 of file libsheepy.c.

| char* iPadStartS | ( | char ** | string, |
| size_t | targetLength, | ||
| const char * | padString | ||
| ) |
pad start string
This function pads the current string with a given string (repeated, if needed) until the resulting string reaches a given length. The padding is applied from the start (left) of the current string
| string | (this parameter is reallocated) |
| targetLength | The length of the resulting string once the current string has been padded. If the value is less than the current string's length, the current string is returned as is |
| padString | The string to pad the current string with. If this string is too long to stay within the target length, it will be truncated from the right. The current string is returned as is when an empty string is supplied |
Definition at line 13009 of file libsheepy.c.

| char* bPadStartS | ( | char * | dest, |
| const char * | string, | ||
| size_t | targetLength, | ||
| const char * | padString | ||
| ) |
pad start string
This function pads the current string with a given string (repeated, if needed) until the resulting string reaches a given length. The padding is applied from the start (left) of the current string
| string | |
| targetLength | The length of the resulting string once the current string has been padded. If the value is less than the current string's length, the current string is returned as is |
| padString | The string to pad the current string with. If this string is too long to stay within the target length, it will be truncated from the right. The current string is returned as is when an empty string is supplied |
Definition at line 13061 of file libsheepy.c.

| char* bLPadStartS | ( | char * | dest, |
| size_t | destSize, | ||
| const char * | string, | ||
| size_t | targetLength, | ||
| const char * | padString | ||
| ) |
pad start string
This function pads the current string with a given string (repeated, if needed) until the resulting string reaches a given length. The padding is applied from the start (left) of the current string
| string | |
| targetLength | The length of the resulting string once the current string has been padded. If the value is less than the current string's length, the current string is returned as is |
| padString | The string to pad the current string with. If this string is too long to stay within the target length, it will be truncated from the right. The current string is returned as is when an empty string is supplied |
Definition at line 13123 of file libsheepy.c.

| char* padStartCharS | ( | const char * | string, |
| size_t | targetLength, | ||
| char | padChar | ||
| ) |
pad start string
This function pads the current string with a given character (repeated, if needed) until the resulting string reaches a given length. The padding is applied from the start (left) of the current string
| string | |
| targetLength | The length of the resulting string once the current string has been padded. If the value is less than the current string's length, the current string is returned as is |
| padChar | The character to pad the current string with |
Definition at line 13183 of file libsheepy.c.

| char* iPadStartCharS | ( | char ** | string, |
| size_t | targetLength, | ||
| char | padChar | ||
| ) |
pad start string
This function pads the current string with a given character (repeated, if needed) until the resulting string reaches a given length. The padding is applied from the start (left) of the current string
| string | (this parameter is reallocated) |
| targetLength | The length of the resulting string once the current string has been padded. If the value is less than the current string's length, the current string is returned as is |
| padChar | The character to pad the current string with |
Definition at line 13231 of file libsheepy.c.

| char* bPadStartCharS | ( | char * | dest, |
| const char * | string, | ||
| size_t | targetLength, | ||
| char | padChar | ||
| ) |
pad start string
This function pads the current string with a given character (repeated, if needed) until the resulting string reaches a given length. The padding is applied from the start (left) of the current string
| string | |
| targetLength | The length of the resulting string once the current string has been padded. If the value is less than the current string's length, the current string is returned as is |
| padChar | The character to pad the current string with |
Definition at line 13277 of file libsheepy.c.

| char* bLPadStartCharS | ( | char * | dest, |
| size_t | destSize, | ||
| const char * | string, | ||
| size_t | targetLength, | ||
| char | padChar | ||
| ) |
pad start string
This function pads the current string with a given character (repeated, if needed) until the resulting string reaches a given length. The padding is applied from the start (left) of the current string
| string | |
| targetLength | The length of the resulting string once the current string has been padded. If the value is less than the current string's length, the current string is returned as is |
| padChar | The character to pad the current string with |
Definition at line 13332 of file libsheepy.c.

| ssize_t padStartLenS | ( | const char * | string, |
| size_t | targetLength, | ||
| const char * | padString | ||
| ) |
length of string after padStart
| string |
Definition at line 13378 of file libsheepy.c.
| char* padEndS | ( | const char * | string, |
| size_t | targetLength, | ||
| const char * | padString | ||
| ) |
pad end string
This function pads the current string with a given string (repeated, if needed) until the resulting string reaches a given length. The padding is applied from the end (right) of the current string
| string | |
| targetLength | The length of the resulting string once the current string has been padded. If the value is lower than the current string's length, the current string is returned as is |
| padString | The string to pad the current string with. If this string is too long to stay within the target length, it will be truncated and the left-most part will be applied. The current string is returned as is when an empty string is supplied |
Definition at line 13417 of file libsheepy.c.

| char* iPadEndS | ( | char ** | string, |
| size_t | targetLength, | ||
| const char * | padString | ||
| ) |
pad end string
This function pads the current string with a given string (repeated, if needed) so that the resulting string reaches a given length. The padding is applied from the end (right) of the current string
| string | (this parameter is reallocated) |
| targetLength | The length of the resulting string once the current string has been padded. If the value is lower than the current string's length, the current string will be returned as is |
| padString | The string to pad the current string with. If this string is too long to stay within the target length, it will be truncated and the left-most part will be applied. The current string is returned as is when an empty string is supplied |
Definition at line 13473 of file libsheepy.c.

| char* bPadEndS | ( | char * | dest, |
| const char * | string, | ||
| size_t | targetLength, | ||
| const char * | padString | ||
| ) |
pad end string
This function pads the current string with a given string (repeated, if needed) so that the resulting string reaches a given length. The padding is applied from the end (right) of the current string
| string | |
| targetLength | The length of the resulting string once the current string has been padded. If the value is lower than the current string's length, the current string will be returned as is |
| padString | The string to pad the current string with. If this string is too long to stay within the target length, it will be truncated and the left-most part will be applied. The current string is returned as is when an empty string is supplied |
Definition at line 13527 of file libsheepy.c.

| char* bLPadEndS | ( | char * | dest, |
| size_t | destSize, | ||
| const char * | string, | ||
| size_t | targetLength, | ||
| const char * | padString | ||
| ) |
pad end string
This function pads the current string with a given string (repeated, if needed) so that the resulting string reaches a given length. The padding is applied from the end (right) of the current string
| string | |
| targetLength | The length of the resulting string once the current string has been padded. If the value is lower than the current string's length, the current string will be returned as is |
| padString | The string to pad the current string with. If this string is too long to stay within the target length, it will be truncated and the left-most part will be applied. The current string is returned as is when an empty string is supplied |
Definition at line 13589 of file libsheepy.c.

| char* padEndCharS | ( | const char * | string, |
| size_t | targetLength, | ||
| char | padChar | ||
| ) |
pad end string
This function pads the current string with a given character (repeated, if needed) so that the resulting string reaches a given length. The padding is applied from the end (right) of the current string
| string | |
| targetLength | The length of the resulting string once the current string has been padded. If the value is lower than the current string's length, the current string will be returned as is |
| padChar | The character to pad the current string with |
Definition at line 13649 of file libsheepy.c.

| char* iPadEndCharS | ( | char ** | string, |
| size_t | targetLength, | ||
| char | padChar | ||
| ) |
pad end string
This function pads the current string with a given character (repeated, if needed) so that the resulting string reaches a given length. The padding is applied from the end (right) of the current string
| string | (this parameter is reallocated) |
| targetLength | The length of the resulting string once the current string has been padded. If the value is lower than the current string's length, the current string will be returned as is |
| padChar | The character to pad the current string with |
Definition at line 13697 of file libsheepy.c.

| char* bPadEndCharS | ( | char * | dest, |
| const char * | string, | ||
| size_t | targetLength, | ||
| char | padChar | ||
| ) |
pad end string
This function pads the current string with a given character (repeated, if needed) so that the resulting string reaches a given length. The padding is applied from the end (right) of the current string
| string | |
| targetLength | The length of the resulting string once the current string has been padded. If the value is lower than the current string's length, the current string will be returned as is |
| padChar | The character to pad the current string with |
Definition at line 13745 of file libsheepy.c.

| char* bLPadEndCharS | ( | char * | dest, |
| size_t | destSize, | ||
| const char * | string, | ||
| size_t | targetLength, | ||
| char | padChar | ||
| ) |
pad end string
This function pads the current string with a given character (repeated, if needed) so that the resulting string reaches a given length. The padding is applied from the end (right) of the current string
| string | |
| targetLength | The length of the resulting string once the current string has been padded. If the value is lower than the current string's length, the current string will be returned as is |
| padChar | The string to pad the current string with |
Definition at line 13800 of file libsheepy.c.

| ssize_t padEndLenS | ( | const char * | string, |
| size_t | targetLength, | ||
| const char * | padString | ||
| ) |
length of string after padEnd
| string |
Definition at line 13847 of file libsheepy.c.
| char getS | ( | const char * | string, |
| int64_t | index | ||
| ) |
get string
get char at python index
Definition at line 13872 of file libsheepy.c.

| char* setS | ( | char * | string, |
| int64_t | index, | ||
| char | c | ||
| ) |
set string
set char at python index
Definition at line 13898 of file libsheepy.c.

| char* swapS | ( | char * | string, |
| int64_t | index1, | ||
| int64_t | index2 | ||
| ) |
swap characters in string
| string | |
| index1 | index of character to swap |
| index2 | index of second character to swap |
Definition at line 13933 of file libsheepy.c.
| char* iSwapS | ( | char ** | string, |
| int64_t | index1, | ||
| int64_t | index2 | ||
| ) |
swap characters in string
| string | |
| index1 | index of character to swap |
| index2 | index of second character to swap |
Definition at line 13986 of file libsheepy.c.
| char* bSwapS | ( | char * | string, |
| int64_t | index1, | ||
| int64_t | index2 | ||
| ) |
swap characters in string
| string | |
| index1 | index of character to swap |
| index2 | index of second character to swap |
Definition at line 14034 of file libsheepy.c.
| char* bLSwapS | ( | char * | string, |
| size_t | size, | ||
| int64_t | index1, | ||
| int64_t | index2 | ||
| ) |
swap characters in string
if string's length is more than size then size is the end of string and the indexes are computed relative to size
| string | |
| size | string buffer size |
| index1 | index of character to swap |
| index2 | index of second character to swap |
Definition at line 14087 of file libsheepy.c.
| char* sliceS | ( | const char * | string, |
| int64_t | start, | ||
| int64_t | end | ||
| ) |
slice String return new string which is the string between start and end negative indexes are allowed
(copy substring from start to end)
| string | to slice start: start index, must be in the string end: end index, must be in the string after start |
Definition at line 14148 of file libsheepy.c.

| char* iSliceS | ( | char ** | string, |
| int64_t | start, | ||
| int64_t | end | ||
| ) |
slice String return string which is the string between start and end negative indexes are allowed
| string | to slice (this parameter is reallocated) start: start index, must be in the string end: end index, must be in the string after start |
Definition at line 14213 of file libsheepy.c.


| char* bSliceS | ( | char * | string, |
| int64_t | start, | ||
| int64_t | end | ||
| ) |
buffer slice String return string which is the string between start and end negative indexes are allowed
| string | to slice start: start index, must be in the string end: end index, must be in the string after start |
Definition at line 14286 of file libsheepy.c.
| char* bLSliceS | ( | char * | string, |
| size_t | stringSize, | ||
| int64_t | start, | ||
| int64_t | end | ||
| ) |
buffer size slice String return string which is the string between start and end negative indexes are allowed
| string | to slice |
| stringSize | string buffer size |
| start | start index, must be in the string |
| end | end index, must be in the string after start |
Definition at line 14355 of file libsheepy.c.
| char* cropS | ( | char * | string, |
| int64_t | start, | ||
| int64_t | end | ||
| ) |
Crop String return a new string with characters from start and end in string and delete characters from start to end in the original string negative indexes are allowed.
| string | |
| start | index, must be in the list |
| end | index, must be in the list |
Definition at line 14430 of file libsheepy.c.

| char* iCropS | ( | char ** | string, |
| int64_t | start, | ||
| int64_t | end | ||
| ) |
Crop String return a new string with characters from start and end in string and delete characters from start to end in the original string negative indexes are allowed.
| string | |
| start | index, must be in the list |
| end | index, must be in the list |
Definition at line 14501 of file libsheepy.c.

| char cropElemS | ( | char * | string, |
| int64_t | index | ||
| ) |
| char iCropElemS | ( | char ** | string, |
| int64_t | index | ||
| ) |
| char* insertS | ( | const char * | string, |
| int64_t | index, | ||
| const char * | toInsert | ||
| ) |
insert string in string at index
return new string with toInsert at index negative indexes are allowed index -1 is the end of the array and is equivalent to index len
| string | |
| index | in string |
| toInsert | string |
Definition at line 14609 of file libsheepy.c.

| char* insertNFreeS | ( | const char * | string, |
| int64_t | index, | ||
| char * | toInsert | ||
| ) |
insert string in string at index and free toInsert when successful
return new string with toInsert at index negative indexes are allowed index -1 is the end of the array and is equivalent to index len
| string | |
| index | in string |
| toInsert | string |
Definition at line 14678 of file libsheepy.c.

| char* iInsertS | ( | char ** | string, |
| int64_t | index, | ||
| const char * | toInsert | ||
| ) |
insert string in string at index
return string with toInsert at index negative indexes are allowed index -1 is the end of the array and is equivalent to index len
| string | (this parameter is reallocated) |
| index | in string |
| toInsert | string |
Definition at line 14756 of file libsheepy.c.


| char* iInsertNFreeS | ( | char ** | string, |
| int64_t | index, | ||
| char * | toInsert | ||
| ) |
insert string in string at index and free toInsert
return string with toInsert at index negative indexes are allowed index -1 is the end of the array and is equivalent to index len
| string | (this parameter is reallocated) |
| index | in string |
| toInsert | string |
Definition at line 14835 of file libsheepy.c.

| char* bInsertS | ( | char * | string, |
| int64_t | index, | ||
| const char * | toInsert | ||
| ) |
buffer insert string in string at index
return string with toInsert at index negative indexes are allowed index -1 is the end of the array and is equivalent to index len
| string | |
| index | in string |
| toInsert | string |
Definition at line 14917 of file libsheepy.c.


| char* bLInsertS | ( | char * | string, |
| size_t | stringSize, | ||
| int64_t | index, | ||
| const char * | toInsert | ||
| ) |
buffer size insert string in string at index
return string with toInsert at index negative indexes are allowed index -1 is the end of the array and is equivalent to index len
| string | |
| index | in string |
| toInsert | string |
Definition at line 14986 of file libsheepy.c.


| char* injectS | ( | const char * | string, |
| int64_t | index, | ||
| char | toInject | ||
| ) |
inject a char in string at index
return new string with toInject at index negative indexes are allowed index -1 is the end of the array and is equivalent to index len
| string | |
| index | in string |
| toInject | char |
Definition at line 15061 of file libsheepy.c.

| char* iInjectS | ( | char ** | string, |
| int64_t | index, | ||
| char | toInject | ||
| ) |
inject a char in string at index
return string with toInject at index negative indexes are allowed index -1 is the end of the array and is equivalent to index len
| string | (this parameter is reallocated) |
| index | in string |
| toInject | char |
Definition at line 15131 of file libsheepy.c.

| char* bInjectS | ( | char * | string, |
| int64_t | index, | ||
| char | toInject | ||
| ) |
buffer inject a char in string at index
return string with toInject at index negative indexes are allowed index -1 is the end of the array and is equivalent to index len
| string | |
| index | in string |
| toInject | char |
Definition at line 15208 of file libsheepy.c.

| char* bLInjectS | ( | char * | string, |
| size_t | stringSize, | ||
| int64_t | index, | ||
| char | toInject | ||
| ) |
buffer size inject a char in string at index
return string with toInject at index negative indexes are allowed index -1 is the end of the array and is equivalent to index len
| string | |
| index | in string |
| toInject | char |
Definition at line 15274 of file libsheepy.c.

| char* delS | ( | const char * | string, |
| int64_t | start, | ||
| int64_t | end | ||
| ) |
delete string
return new string without the string between start and end negative indexes are allowed
| string | to delete |
| start | start index, must be in the string |
| end | end index, must be in the string after start |
Definition at line 15345 of file libsheepy.c.
| char* iDelS | ( | char ** | string, |
| int64_t | start, | ||
| int64_t | end | ||
| ) |
delete string
return string without the string between start and end negative indexes are allowed
| string | to delete (this parameter is reallocated) |
| start | start index, must be in the string |
| end | end index, must be in the string after start |
Definition at line 15415 of file libsheepy.c.


| char* bDelS | ( | char * | string, |
| int64_t | start, | ||
| int64_t | end | ||
| ) |
buffer delete string
return string without the string between start and end negative indexes are allowed
| string | to delete |
| start | start index, must be in the string |
| end | end index, must be in the string after start |
Definition at line 15487 of file libsheepy.c.
| char* bLDelS | ( | char * | string, |
| size_t | stringSize, | ||
| int64_t | start, | ||
| int64_t | end | ||
| ) |
buffer size delete string
return string without the string between start and end negative indexes are allowed
| string | to delete |
| stringSize | string buffer size |
| start | start index, must be in the string |
| end | end index, must be in the string after start |
Definition at line 15553 of file libsheepy.c.
| char* delElemS | ( | const char * | string, |
| int64_t | index | ||
| ) |
delete element/character string
return new string without the character at given index negative indexes are allowed
| string | to delete |
| index | must be in the string, -1 is the last character in the string |
Definition at line 15617 of file libsheepy.c.
| char* iDelElemS | ( | char ** | string, |
| int64_t | index | ||
| ) |
delete element/character string
return string without the character at given index negative indexes are allowed
| string | to delete (this parameter is reallocated) |
| index | must be in the string, -1 is the last character in the string |
Definition at line 15660 of file libsheepy.c.

| char* bDelElemS | ( | char * | string, |
| int64_t | index | ||
| ) |
buffer delete element/character string
return string without the character at given index negative indexes are allowed
| string | to delete |
| index | must be in the string, -1 is the last character in the string |
Definition at line 15707 of file libsheepy.c.
| char* bLDelElemS | ( | char * | string, |
| size_t | stringSize, | ||
| int64_t | index | ||
| ) |
buffer size delete element/character string
return string without the character at given index negative indexes are allowed
| string | to delete |
| stringSize | string buffer size |
| index | must be in the string, -1 is the last character in the string |
Definition at line 15748 of file libsheepy.c.
| char* findS | ( | const char * | string, |
| const char * | needle | ||
| ) |
find String
| string | |
| needle | string to find |
Definition at line 15790 of file libsheepy.c.

| char* findCharS | ( | const char * | string, |
| char | c | ||
| ) |
| ssize_t indexOfS | ( | const char * | string, |
| const char * | needle | ||
| ) |
indexOf String relative to start
| string | |
| needle | string to find |
Definition at line 15821 of file libsheepy.c.


| ssize_t indexOfCharS | ( | const char * | string, |
| char | c | ||
| ) |
Definition at line 15830 of file libsheepy.c.


| bool hasS | ( | const char * | string, |
| const char * | needle | ||
| ) |
has String
| string | |
| needle | string to find |
Definition at line 15851 of file libsheepy.c.

| bool hasCharS | ( | const char * | string, |
| char | c | ||
| ) |
Definition at line 15864 of file libsheepy.c.
| char* icFindS | ( | const char * | string, |
| const char * | needle | ||
| ) |
ignore case Find String
| string | |
| needle | string to find |
Definition at line 15888 of file libsheepy.c.

| char* icFindCharS | ( | const char * | string, |
| char | c | ||
| ) |
Definition at line 15897 of file libsheepy.c.


| ssize_t icIndexOfS | ( | const char * | string, |
| const char * | needle | ||
| ) |
ignore case indexOf String relative to start
| string | |
| needle | string to find |
Definition at line 15925 of file libsheepy.c.


| ssize_t icIndexOfCharS | ( | const char * | string, |
| char | c | ||
| ) |
Definition at line 15934 of file libsheepy.c.


| bool icHasS | ( | const char * | string, |
| const char * | needle | ||
| ) |
ignore case has String
| string | |
| needle | string to find |
Definition at line 15955 of file libsheepy.c.

| bool icHasCharS | ( | const char * | string, |
| char | c | ||
| ) |
| char* tokS | ( | char * | s, |
| const char * | delim, | ||
| char ** | saveptr | ||
| ) |
token in String
parse string into a sequence of tokens delimited by the ENTIRE DELIM string work like strtok_r from c stdlib (for strtok_r, when delim has multiple characters, each character is a delimiter)
on first call s is the string to parse, optionally initialize *saveptr to NULL on next calls, s should be NULL
| s | string to parse, the s string is modified |
| delim | string |
Definition at line 15996 of file libsheepy.c.


| char* icTokS | ( | char * | s, |
| const char * | delim, | ||
| char ** | saveptr | ||
| ) |
ignore case token in String
parse string into a sequence of tokens delimited by the ENTIRE DELIM string work like strtok_r from c stdlib (for strtok_r, when delim has multiple characters, each character is a delimiter)
on first call s is the string to parse, optionally initialize *saveptr to NULL on next calls, s should be NULL
| s | string to parse, the s string is modified |
| delim | string |
Definition at line 16038 of file libsheepy.c.


| size_t lenUTF8 | ( | const char * | s | ) |
character length of UTF-8 string
string is not checked for validity
Definition at line 16076 of file libsheepy.c.

| size_t bLLenUTF8 | ( | const char * | s, |
| size_t | maxSize | ||
| ) |
buffer character length of UTF-8 string
string is not checked for validity
bLLenUTF8 checks at most maxSize bytes
Definition at line 16095 of file libsheepy.c.

| bool isUTF8 | ( | const char * | string | ) |
is UTF-8 string
check if string is a valid UTF-8 string
| string | UTF-8 encoded string |
Definition at line 16124 of file libsheepy.c.
| bool bLIsUTF8 | ( | const char * | string, |
| size_t | stringSize | ||
| ) |
buffer length is UTF-8 string
check if string is a valid UTF-8 string
| string | UTF-8 encoded string |
Definition at line 16178 of file libsheepy.c.
| bool isCodeUTF8 | ( | const char * | code | ) |
is code point UTF8 encoded string
Check if a UTF8 code point is valid
This function checks only the first code point
| bytes | string, NUL-terminated or not, bytes can be a pointer inside a UTF8 encoded string |
Definition at line 16247 of file libsheepy.c.

| const char* nextUTF8 | ( | const char * | utf8 | ) |
next UTF-8 code point
find the next UTF-8 code point in the string
the validity of the found UTF-8 code point is not checked
nextUTF8 gives wrong result when utf8 is not on the first byte of a code point use findNextUTF8 to find next code point when utf8 is not at the start of a code point
| utf8 | UTF-8 encoded string |
Definition at line 46037 of file libsheepy.c.
| const char* bLNextUTF8 | ( | const char * | string, |
| size_t | utf8Size, | ||
| const char * | utf8 | ||
| ) |
buffer length next UTF-8 code point
find the next UTF-8 code point in the string
the validity of the found UTF-8 code point is not checked
bLNextUTF8 gives wrong result when utf8 is not on the first byte of a code point use findNextUTF8 to find next code point when utf8 is not at the start of a code point
| string | start of the UTF-8 encoded string |
| utf8 | pointer to a code point in string |
| utf8Size | string buffer size (including NUL, strlen(string) +1 when the buffer is full) |
Definition at line 46067 of file libsheepy.c.
| const char* findNextUTF8 | ( | const char * | string, |
| size_t | utf8Size, | ||
| const char * | utf8 | ||
| ) |
find next UTF-8 code point even not at the start of a code point
find the next UTF-8 code point in the string
the validity of the found UTF-8 code point is not checked
| string | start of the UTF-8 encoded string |
| utf8 | pointer in string |
| ut8Size | string buffer size (including NUL, strlen(string) +1 when the buffer is full) |
Definition at line 46099 of file libsheepy.c.
| const char* prevUTF8 | ( | const char * | utf8 | ) |
previous UTF-8 code point
find the previous UTF-8 code point in the string
the validity of the found UTF-8 code point is not checked
the behavior is undefined when utf8 is the start of the string, use instead findPrevUTF8 for safe handling
| utf8 | UTF-8 encoded string |
Definition at line 46132 of file libsheepy.c.
| const char* bPrevUTF8 | ( | const char * | string, |
| const char * | utf8 | ||
| ) |
buffer previous UTF-8 code point
find the previous UTF-8 code point in the string
the validity of the found UTF-8 code point is not checked
| string | UTF-8 encoded string |
| utf8 | pointer in UTF-8 encoded string |
Definition at line 46161 of file libsheepy.c.

| const char* idx2PtrUTF8 | ( | const char * | utf8, |
| int64_t | index | ||
| ) |
index to pointer UTF8 encoded string
Converts character index to pointer in utf8
| utf8 | UTF8 encoded string |
| index | character index in utf8, positive or negative. -1 is the last character in the string |
Definition at line 46207 of file libsheepy.c.


| const char* bLIdx2PtrUTF8 | ( | const char * | utf8, |
| size_t | utf8Size, | ||
| int64_t | index | ||
| ) |
Definition at line 46306 of file libsheepy.c.


| int64_t ptr2IdxUTF8 | ( | const char * | utf8, |
| const char * | pos | ||
| ) |
pointer to code point index UTF8 encoded string
Converts pointer to character index
This function works when utf8 and pos point inside code points
| utf8 | pointer to a code point in a UTF8 encoded string |
| pos | pointer to a code point in a UTF8 encoded string |
Definition at line 46371 of file libsheepy.c.

| int64_t bPtr2IdxUTF8 | ( | const char * | start, |
| const char * | utf8, | ||
| const char * | pos | ||
| ) |
buffer pointer to code point index UTF8 encoded string
Converts pointer to character index
Safe function for negative index
This function works when utf8 and pos point inside code points
| start | start of the UTF8 encoded string |
| utf8 | pointer to a code point in a UTF8 encoded string |
| pos | pointer to a code point in a UTF8 encoded string |
Definition at line 46444 of file libsheepy.c.
| int64_t bLPtr2IdxUTF8 | ( | const char * | utf8, |
| size_t | utf8Size, | ||
| const char * | pos | ||
| ) |
buffer size pointer to code point index UTF8 encoded string
Converts pointer to character index
This function works when utf8 and pos point inside code points
| utf8 | pointer to a code point in a UTF8 encoded string |
| utf8Size | utf8 buffer size including NUL |
| pos | pointer to a code point in a UTF8 encoded string |
Definition at line 46505 of file libsheepy.c.
| int64_t bLPtr2NegIdxUTF8 | ( | const char * | utf8, |
| size_t | utf8Size, | ||
| const char * | pos | ||
| ) |
buffer size pointer to negative code point index UTF8 encoded string
Converts pointer to negative character index (from the end of the string)
This function works when utf8 and pos point inside code points
| utf8 | pointer to a code point in a UTF8 encoded string |
| utf8Size | utf8 buffer size including NUL |
| pos | pointer to a code point in a UTF8 encoded string |
Definition at line 46556 of file libsheepy.c.
| char* makeValidUTF8 | ( | const char * | utf8 | ) |
make valid UTF-8 encoded string
copy utf8 to newly allocated buffer, the invalid code points are replaced with '?'
The result buffer size is the same as utf8 size
| utf8 | valid or invalid UTF-8 encoded string |
Definition at line 46593 of file libsheepy.c.

| char* bMakeValidUTF8 | ( | char * | utf8 | ) |
buffer make valid UTF-8 encoded string
replace the invalid code points with '?' in utf8
| utf8 | valid or invalid UTF-8 encoded string |
Definition at line 46635 of file libsheepy.c.


| char* nMakeValidUTF8 | ( | const char * | utf8, |
| size_t | utf8Len | ||
| ) |
length make valid UTF-8 encoded string
copy utf8 to newly allocated buffer, the invalid code points are replaced with '?'
The result buffer size is utf8Len+1
| utf8 | valid or invalid UTF-8 encoded string |
| utf8Len | utf8 length |
Definition at line 46672 of file libsheepy.c.

| char* bNMakeValidUTF8 | ( | char * | dst, |
| const char * | utf8, | ||
| size_t | utf8Len | ||
| ) |
buffer length make valid UTF-8 encoded string
copy utf8 to the dst buffer, the invalid code points are replaced with '?'
The result buffer size is utf8Len+1
| utf8 | valid or invalid UTF-8 encoded string |
| utf8Len | utf8 length |
Definition at line 46724 of file libsheepy.c.

| char* bLMakeValidUTF8 | ( | char * | dst, |
| size_t | dstSize, | ||
| const char * | utf8 | ||
| ) |
buffer destination size make valid UTF-8 encoded string
copy utf8 to the dst buffer, the invalid code points are replaced with '?'
The result buffer size is dstSize
| dst | destination buffer |
| dstSize | size of dst |
| utf8 | valid or invalid UTF-8 encoded string |
Definition at line 46773 of file libsheepy.c.

| char* bLNMakeValidUTF8 | ( | char * | dst, |
| size_t | dstSize, | ||
| const char * | utf8, | ||
| size_t | utf8Len | ||
| ) |
buffer destination size source length make valid UTF-8 encoded string
copy utf8 to the dst buffer, the invalid code points are replaced with '?'
This function always reads less than utf8Len+1 bytes in utf8 buffer The result buffer size is dstSize
| dst | destination buffer |
| dstSize | size of dst |
| utf8 | valid or invalid UTF-8 encoded string |
| utf8Len | utf8 length |
Definition at line 46825 of file libsheepy.c.

| char* strNCpyUTF8 | ( | char * | dst, |
| const char * | src, | ||
| size_t | srcLen | ||
| ) |
strNCpyUTF8 - copy src to dst with srcLen in code points
copy srcLen code points from src (UTF-8 encoded string) to dst and add one NUL character when src end is not reached (unlike strncpy).
| dst | destination buffer |
| src | source string |
| srcLen | source buffer size in code points |
Definition at line 46875 of file libsheepy.c.
| char* strLCpyUTF8 | ( | char * | dst, |
| size_t | dstSize, | ||
| const char * | src | ||
| ) |
strLCpyUTF8 - copy src to dst
like strncpy and the NUL char is always added at the end of the string and the result string is always a valid UTF-8 encoded string
| dst | destination buffer |
| dstSize | destination buffer size, result string will be no longer than dstSize-1 |
| src | source string |
Definition at line 46912 of file libsheepy.c.

| char* strNCatUTF8 | ( | char * | dst, |
| const char * | src, | ||
| size_t | srcLen | ||
| ) |
strNCatUTF8 - concatenate two UTF-8 encoded strings
like strncat with sanity checks and srcLen is the number of code points
| dst | destination buffer |
| src | source string |
| srcLen | max source len in code points |
Definition at line 46941 of file libsheepy.c.
| char* strLCatUTF8 | ( | char * | dst, |
| size_t | dstSize, | ||
| const char * | src | ||
| ) |
strLCatUTF8 - concatenate two UTF-8 encoded strings
like strlcat with sanity checks the result string is always a valid UTF-8 encoded string
| dst | destination buffer |
| src | source string |
| dstSize | destination buffer size, result string will be no longer than dstSize-1 |
Definition at line 46978 of file libsheepy.c.

| char* strLNCatUTF8 | ( | char * | dst, |
| size_t | dstSize, | ||
| const char * | src, | ||
| size_t | srcLen | ||
| ) |
strLNCatUTF8 - concatenate two UTF-8 encoded strings
like strlcat with sanity checks and srcLen is the number of code points the result string is always a valid UTF-8 encoded string
| dst | destination buffer |
| src | source string |
| dstSize | destination buffer size, result string will be no longer than dstSize-1 |
| srcLen | max source len in code points |
Definition at line 47023 of file libsheepy.c.

| char* icReplaceUTF8 | ( | const char * | s, |
| const char * | olds, | ||
| const char * | news, | ||
| size_t | max | ||
| ) |
| char* icReplaceCharSUTF8 | ( | const char * | s, |
| char | olds, | ||
| const char * | news, | ||
| size_t | max | ||
| ) |
| char* icReplaceSCharUTF8 | ( | const char * | s, |
| const char * | olds, | ||
| char | news, | ||
| size_t | max | ||
| ) |
| char* iicReplaceUTF8 | ( | char ** | s, |
| const char * | olds, | ||
| const char * | news, | ||
| size_t | max | ||
| ) |
| char* iicReplaceCharSUTF8 | ( | char ** | s, |
| char | olds, | ||
| const char * | news, | ||
| size_t | max | ||
| ) |
| char* iicReplaceSCharUTF8 | ( | char ** | s, |
| const char * | olds, | ||
| char | news, | ||
| size_t | max | ||
| ) |
| char* bicReplaceUTF8 | ( | char * | s, |
| const char * | olds, | ||
| const char * | news, | ||
| size_t | max | ||
| ) |
| char* bLicReplaceUTF8 | ( | char * | s, |
| size_t | sSize, | ||
| const char * | olds, | ||
| const char * | news, | ||
| size_t | max | ||
| ) |
| char* icReplaceManyUTF8F | ( | const char * | paramType, |
| ... | |||
| ) |
| char* iicReplaceManyUTF8F | ( | char ** | s, |
| char * | paramType, | ||
| ... | |||
| ) |
| char* bicReplaceManyUTF8F | ( | char * | s, |
| char * | paramType, | ||
| ... | |||
| ) |
| char* bLicReplaceManyUTF8F | ( | char * | s, |
| size_t | sSize, | ||
| char * | paramType, | ||
| ... | |||
| ) |
| bool eqIUTF8 | ( | const char * | string1, |
| const char * | string2, | ||
| int64_t | index | ||
| ) |
UTF8 encoded string Index Equal compare string1 at character index to string2 when string2 is empty, the result is false.
| 2 | strings |
Definition at line 47312 of file libsheepy.c.

| bool eqICharUTF8 | ( | const char * | string1, |
| char | c, | ||
| int64_t | index | ||
| ) |
| bool icEqUTF8 | ( | const char * | string1, |
| const char * | string2 | ||
| ) |
ignore case UTF8 encoded string Equal compare string1 to string2
| 2 | strings |
Definition at line 47343 of file libsheepy.c.


| bool icEqCharUTF8 | ( | char | c, |
| const char * | string2 | ||
| ) |
| bool icEqUTF8Char | ( | const char * | string1, |
| char | c | ||
| ) |
| bool icEqIUTF8 | ( | const char * | string1, |
| const char * | string2, | ||
| int64_t | index | ||
| ) |
| bool icEqICharUTF8 | ( | const char * | string1, |
| char | c, | ||
| int64_t | index | ||
| ) |
| bool icStartsWithUTF8 | ( | const char * | string1, |
| const char * | string2 | ||
| ) |
ignore case starts With UTF8 encoded String compare start of string1 with string2
| 2 | strings |
Definition at line 47419 of file libsheepy.c.

| bool icEndsWithUTF8 | ( | const char * | string1, |
| const char * | string2 | ||
| ) |
ignore case ends With UTF8 encoded String compare end of string1 with string2
| 2 | strings |
Definition at line 47444 of file libsheepy.c.

| ssize_t icCountUTF8 | ( | const char * | s, |
| const char * | needle | ||
| ) |
ignore case count UTF8 encoded String count number of (non-overlapping) occurrences of a substring
Example: assert(countUTF8("aaa aaa", "a") == 6); assert(countUTF8("aaa aaa", "ab") == 0); assert(countUTF8("aaa aaa", "aa") == 2);
| 2 | strings |
Definition at line 47480 of file libsheepy.c.

| rune code2RuneUTF8 | ( | const char * | code | ) |
UTF-8 code point to rune.
| code | UTF-8 code point |
Definition at line 47550 of file libsheepy.c.


| rune code2RuneLUTF8 | ( | const char * | code, |
| uint8_t * | n | ||
| ) |
UTF-8 code point to rune and length.
the code point length is returned in *n
| code | UTF-8 code point |
| n | pointer to returned code point length |
Definition at line 47569 of file libsheepy.c.


| size_t bRune2CodeUTF8 | ( | char * | dst, |
| rune | c | ||
| ) |
rune to UTF-8 code point
| dst | destination buffer at least 6 bytes or if NULL, the code point length is computed |
| c | UNICODE rune |
Definition at line 47635 of file libsheepy.c.


| uint8_t runeLenUTF8 | ( | rune | r | ) |
rune length as UTF-8 code point
| r | UNICODE rune |
Definition at line 47670 of file libsheepy.c.

rune toupper UTF8
Converts a character to uppercase.
| c | rune |
Definition at line 47854 of file libsheepy.c.

| char* upperUTF8 | ( | const char * | utf8 | ) |
upper case UTF-8 encoded string duplicate string
| string | UTF-8 encoded string |
Definition at line 47975 of file libsheepy.c.


| char* iUpperUTF8 | ( | char ** | utf8 | ) |
upper case UTF-8 encoded string
| string | (this parameter is reallocated) |
Definition at line 48003 of file libsheepy.c.

| char* bUpperUTF8 | ( | char * | string | ) |
rune tolower UTF8
Converts a character to lower case.
| c | UNICODE rune |
Definition at line 48078 of file libsheepy.c.

| char* lowerUTF8 | ( | const char * | utf8 | ) |
lower case UTF-8 String duplicate string
| string |
Definition at line 48228 of file libsheepy.c.


| char* iLowerUTF8 | ( | char ** | utf8 | ) |
lower case String
| string | (this parameter is reallocated) |
Definition at line 48256 of file libsheepy.c.

| char* bLowerUTF8 | ( | char * | string | ) |
| char* casefoldUTF8 | ( | const char * | utf8 | ) |
casefold UTF-8 encoded string
| utf8 | UTF-8 encoded string |
Definition at line 48294 of file libsheepy.c.


| char* uniqUTF8 | ( | const char * | string, |
| const char * | code | ||
| ) |
uniq UTF-8 String duplicate string
remove successive repetitions of UTF-8 code point code
| string | |
| c | character to remove |
Definition at line 48352 of file libsheepy.c.

| char* iUniqUTF8 | ( | char ** | string, |
| const char * | code | ||
| ) |
uniq UTF-8 String
remove successive repetitions of char c
| string | |
| c | character to remove |
Definition at line 48409 of file libsheepy.c.

| char* bUniqUTF8 | ( | char * | string, |
| const char * | code | ||
| ) |
buffer uniq String
remove successive repetitions of char c
| string | |
| c | character to remove |
Definition at line 48463 of file libsheepy.c.

| char* icUniqUTF8 | ( | const char * | string, |
| const char * | code | ||
| ) |
| char* iicUniqUTF8 | ( | char ** | string, |
| const char * | code | ||
| ) |
| char* bicUniqUTF8 | ( | char * | string, |
| char | c | ||
| ) |
| rune getUTF8 | ( | const char * | string, |
| int64_t | index | ||
| ) |
get UTF8 encoded string
get char at python index
Definition at line 48567 of file libsheepy.c.

| char* setUTF8 | ( | char * | string, |
| int64_t | index, | ||
| rune | c | ||
| ) |
set UTF8 encoded string
set char at python index
TODO this function might make the string invalid UTF8 check codeSizeUTF8 and adjust the buffer
Definition at line 48598 of file libsheepy.c.

| char* sliceUTF8 | ( | const char * | string, |
| int64_t | start, | ||
| int64_t | end | ||
| ) |
slice UTF8 encoded String return new string which is the string between start and end negative indexes are allowed
(copy substring from start to end)
| string | to slice |
| start | start character index, must be in the string |
| end | end character index, must be in the string after start |
Definition at line 48641 of file libsheepy.c.

| char* iSliceUTF8 | ( | char ** | string, |
| int64_t | start, | ||
| int64_t | end | ||
| ) |
slice UTF8 encoded String return string which is the string between start and end negative indexes are allowed
| string | to slice (this parameter is reallocated) |
| start | start character index, must be in the string |
| end | end character index, must be in the string after start |
Definition at line 48712 of file libsheepy.c.

| char* bSliceUTF8 | ( | char * | string, |
| int64_t | start, | ||
| int64_t | end | ||
| ) |
buffer slice UTF8 encoded String return string which is the string between start and end negative indexes are allowed
| string | to slice |
| start | start index, must be in the string |
| end | end index, must be in the string after start |
Definition at line 48791 of file libsheepy.c.

| char* bLSliceUTF8 | ( | char * | string, |
| size_t | stringSize, | ||
| int64_t | start, | ||
| int64_t | end | ||
| ) |
buffer size slice UTF8 encoded String return string which is the string between start and end negative indexes are allowed
| string | to slice |
| stringSize | string buffer size |
| start | start character index, must be in the string |
| end | end character index, must be in the string after start |
Definition at line 48862 of file libsheepy.c.

| char* insertUTF8 | ( | const char * | string, |
| int64_t | index, | ||
| const char * | toInsert | ||
| ) |
insert string in UTF8 encoded string at index
return new string with toInsert at index negative indexes are allowed index -1 is the end of the array and is equivalent to index len
| string | UTF8 encoded string |
| index | character index in string |
| toInsert | UTF8 encoded string |
Definition at line 48956 of file libsheepy.c.

| char* insertNFreeUTF8 | ( | const char * | string, |
| int64_t | index, | ||
| char * | toInsert | ||
| ) |
insert string in UTF8 encoded string at index and free toInsert
return new string with toInsert at index negative indexes are allowed index -1 is the end of the array and is equivalent to index len
| string | UTF8 encoded string |
| index | character index in string |
| toInsert | UTF8 encoded string |
Definition at line 49029 of file libsheepy.c.

| char* iInsertUTF8 | ( | char ** | string, |
| int64_t | index, | ||
| const char * | toInsert | ||
| ) |
insert string in UTF8 encoded string at index
return string with toInsert at index negative indexes are allowed index -1 is the end of the array and is equivalent to index len
| string | UTF8 encoded string (this parameter is reallocated) |
| index | character index in string |
| toInsert | UTF8 encoded string |
Definition at line 49110 of file libsheepy.c.

| char* iInsertNFreeUTF8 | ( | char ** | string, |
| int64_t | index, | ||
| char * | toInsert | ||
| ) |
insert string in UTF8 encoded string at index and free toInsert
return string with toInsert at index negative indexes are allowed index -1 is the end of the array and is equivalent to index len
| string | UTF8 encoded string (this parameter is reallocated) |
| index | character index in string |
| toInsert | UTF8 encoded string |
Definition at line 49191 of file libsheepy.c.

| char* bInsertUTF8 | ( | char * | string, |
| int64_t | index, | ||
| const char * | toInsert | ||
| ) |
buffer insert string in UTF8 encoded string at index
return string with toInsert at index negative indexes are allowed index -1 is the end of the array and is equivalent to index len
| string | UTF8 encoded string |
| index | character index in string |
| toInsert | UTF8 encoded string |
Definition at line 49275 of file libsheepy.c.

| char* bLInsertUTF8 | ( | char * | string, |
| size_t | stringSize, | ||
| int64_t | index, | ||
| const char * | toInsert | ||
| ) |
buffer size insert string in UTF8 encoded string at index
return string with toInsert at index negative indexes are allowed index -1 is the end of the array and is equivalent to index len
| string | UTF8 encoded string |
| index | character index in string |
| toInsert | UTF8 encoded string |
Definition at line 49347 of file libsheepy.c.

| char* delUTF8 | ( | const char * | string, |
| int64_t | start, | ||
| int64_t | end | ||
| ) |
delete UTF8 encoded string
return new string without the string between start and end negative indexes are allowed
| string | to delete |
| start | start character index, must be in the string |
| end | end character index, must be in the string after start |
Definition at line 49424 of file libsheepy.c.

| char* iDelUTF8 | ( | char ** | string, |
| int64_t | start, | ||
| int64_t | end | ||
| ) |
delete UTF8 encoded string
return string without the string between start and end negative indexes are allowed
| string | to delete (this parameter is reallocated) |
| start | start character index, must be in the string |
| end | end character index, must be in the string after start |
Definition at line 49499 of file libsheepy.c.

| char* bDelUTF8 | ( | char * | string, |
| int64_t | start, | ||
| int64_t | end | ||
| ) |
buffer delete UTF8 encoded string
return string without the string between start and end negative indexes are allowed
| string | to delete |
| start | start character index, must be in the string |
| end | end character index, must be in the string after start |
Definition at line 49576 of file libsheepy.c.

| char* bLDelUTF8 | ( | char * | string, |
| size_t | stringSize, | ||
| int64_t | start, | ||
| int64_t | end | ||
| ) |
buffer size delete UTF8 encoded string
return string without the string between start and end negative indexes are allowed
| string | to delete |
| stringSize | string buffer size |
| start | start character index, must be in the string |
| end | end character index, must be in the string after start |
Definition at line 49647 of file libsheepy.c.

| ssize_t indexOfUTF8 | ( | const char * | string, |
| const char * | needle | ||
| ) |
indexOf UTF8 encoded String relative to start
| string | |
| needle | string to find |
Definition at line 49726 of file libsheepy.c.

| ssize_t icIndexOfUTF8 | ( | const char * | string, |
| const char * | needle | ||
| ) |
| bool icHasUTF8 | ( | const char * | string, |
| const char * | needle | ||
| ) |
ignore case has UTF8 encoded String
| string | |
| needle | string to find |
Definition at line 49768 of file libsheepy.c.

| char* icTokUTF8 | ( | const char * | s, |
| const char * | delim, | ||
| char ** | saveptr | ||
| ) |
| char** icExtractUTF8 | ( | const char * | string, |
| const char * | delim1, | ||
| const char * | delim2 | ||
| ) |
| char** icExtractCharSUTF8 | ( | const char * | string, |
| char | delim1, | ||
| const char * | delim2 | ||
| ) |
| char** icExtractSCharUTF8 | ( | const char * | string, |
| const char * | delim1, | ||
| char | delim2 | ||
| ) |
| char** icListSortUTF8 | ( | char ** | list | ) |
ignore case list Sort UTF8 encoded String duplicate list and sort
| list |
Definition at line 49903 of file libsheepy.c.

| char** iicListSortUTF8 | ( | char *** | list | ) |
ignore case list Sort UTF8 encoded String
| list |
Definition at line 49934 of file libsheepy.c.

| bool icListEqUTF8 | ( | char ** | list1, |
| char ** | list2 | ||
| ) |
ignore case list Equal UTF8 encoded String compare each element of list1 and list2
| 2 | lists |
Definition at line 49961 of file libsheepy.c.

| bool icListHasUTF8 | ( | char ** | list, |
| const char * | string | ||
| ) |
ignore case and return true when list has UTF8 encoded string
| list | |
| string |
Definition at line 49994 of file libsheepy.c.

| ssize_t icListIndexOfUTF8 | ( | char ** | list, |
| const char * | string | ||
| ) |
ignore case and return index of UTF8 encoded string in list
| list | |
| string |
Definition at line 50018 of file libsheepy.c.


| ssize_t icListBinarySearchUTF8 | ( | char ** | list, |
| const char * | string | ||
| ) |
ignore case list binary search UTF8 encoded string
efficiently finds the index of string in list the list has be sorted with for example listSortS
| list | |
| string | to search |
Definition at line 50055 of file libsheepy.c.

| char** icListUniqUTF8 | ( | char ** | list | ) |
ignore case and uniquify UTF8 encoded elements of list duplicate list each elements are unique in the new list
| list |
Definition at line 50098 of file libsheepy.c.

| char** iicListUniqUTF8 | ( | char *** | list | ) |
ignore case and uniquify UTF8 encoded elements of list each elements are unique in the list
| list |
Definition at line 50139 of file libsheepy.c.

| char* emptySF | ( | void | ) |
empty String Function
Definition at line 50188 of file libsheepy.c.

| char* iEmptySF | ( | char ** | string | ) |
empty String Function
when *string is NULL, it is freed
Definition at line 50202 of file libsheepy.c.


| bool isEmptyS | ( | const char * | string | ) |
is Empty String
| string |
Definition at line 50226 of file libsheepy.c.

| bool isBlankS | ( | const char * | string | ) |
is Blank String
| string |
Definition at line 50246 of file libsheepy.c.


| ssize_t intIndex | ( | int64_t | index, |
| int64_t | length | ||
| ) |
int to positive index index can be negative
| index | index in list, must be inside the list |
| length | list length |
Definition at line 50275 of file libsheepy.c.
| char** listEmptySF | ( | void | ) |
list Empty String Function
Definition at line 50305 of file libsheepy.c.
| char** iListEmptySF | ( | char *** | list | ) |
list Empty String Function
Definition at line 50322 of file libsheepy.c.


| bool listIsEmptyS | ( | char ** | list | ) |
list Is Empty String
| list |
Definition at line 50351 of file libsheepy.c.

| bool listIsBlankS | ( | char ** | list | ) |
list Is Empty String
| list |
Definition at line 50370 of file libsheepy.c.

| char** listCreateSF | ( | const char * | paramType, |
| ... | |||
| ) |
list Create String Function create a list from the list of parameters used from the listCreateS(...) macro
| list | of strings seperated with commas |
Definition at line 50395 of file libsheepy.c.

| char** listFromArrayS | ( | char ** | array, |
| size_t | size | ||
| ) |
list From Array String
copy array of 'size' strings to a new list NULL strings are not copied to the list
| array | of strings |
| size | - number of strings in the array |
Definition at line 50427 of file libsheepy.c.


| char** listFromCArrayS | ( | const char ** | array, |
| size_t | size | ||
| ) |
list From Const Array String
copy array of 'size' strings to a new list NULL strings are not copied to the list
| array | of strings |
| size | - number of strings in the array |
Definition at line 50465 of file libsheepy.c.


| char** listPushS | ( | char *** | list, |
| const char * | s | ||
| ) |
list Push String append s at the end of the list when list is NULL, a new list with one element is returned when list and s are NULL return list with 2 NULL elements when s is NULL, NULL is pushed at the end of the list
the list is reallocated to add extra space
| pointer | to list - becomes NULL when realloc fails (this parameter is reallocated) |
| s | string to push |
Definition at line 50504 of file libsheepy.c.


| char** listPushCharS | ( | char *** | list, |
| char | c | ||
| ) |
| char** iListPushS | ( | char *** | list, |
| char * | s | ||
| ) |
list Push String append s pointer at the end of the list when list is NULL, a new list with one element is returned when list and s are NULL return list with 2 NULL elements when s is NULL, NULL is pushed at the end of the list
the list is reallocated to add extra space
| pointer | to list - becomes NULL when realloc fails (this parameter is reallocated) |
| s | string to push |
Definition at line 50559 of file libsheepy.c.


| char* listPopS | ( | char *** | list | ) |
list Pop String return last string from list and remove last element from the list
| pointer | to list |
Definition at line 50602 of file libsheepy.c.


| char** listPrependS | ( | char *** | list, |
| const char * | s | ||
| ) |
list Prepend String append s at the beginning of the list when list is NULL, a new list with one element is returned when list and s are NULL return list with 2 NULL elements when s is NULL, the operation is canceled
the list is reallocated to add extra space
| pointer | to list - becomes NULL when realloc fails (this parameter is reallocated) |
| s | string to prepend |
Definition at line 50641 of file libsheepy.c.


| char** listPrependCharS | ( | char *** | list, |
| char | c | ||
| ) |
| char** iListPrependS | ( | char *** | list, |
| char * | s | ||
| ) |
list Prepend String append s pointer at the beginning of the list when list is NULL, a new list with one element is returned when list and s are NULL return list with 2 NULL elements when s is NULL, the operation is canceled
the list is reallocated to add extra space
| pointer | to list - becomes NULL when realloc fails (this parameter is reallocated) |
| s | string to prepend |
Definition at line 50700 of file libsheepy.c.

| char* listDequeueS | ( | char *** | list | ) |
list Dequeue String return first string from list and remove it from the list
| pointer | to list |
Definition at line 50746 of file libsheepy.c.


| void listFreeS | ( | char ** | list | ) |
list Free String
| list |
Definition at line 50780 of file libsheepy.c.


| void listFreeManySF | ( | char ** | paramType, |
| ... | |||
| ) |
list free many String
free variable list of pointers listFreeManyS(l1, l2, ...);
Definition at line 50797 of file libsheepy.c.

| size_t listLengthS | ( | char ** | list | ) |
list Length String return number of elements until the first NULL element
| list |
Definition at line 50820 of file libsheepy.c.

| size_t listLengthCS | ( | const char ** | list | ) |
const list Length String return number of elements until the first NULL element
| list |
Definition at line 50843 of file libsheepy.c.

| ssize_t listStrLengthS | ( | char ** | list | ) |
list String Length String
| list |
Definition at line 50865 of file libsheepy.c.
| ssize_t listIntIndexS | ( | char ** | list, |
| int64_t | index | ||
| ) |
list int to index String index can be negative
| list | |
| index | index in list, must be inside the list |
Definition at line 50892 of file libsheepy.c.

| char** listAddrS | ( | char ** | list, |
| int64_t | index | ||
| ) |
list address String index can be negative
| list | |
| index | index in list, must be inside the list |
Definition at line 50929 of file libsheepy.c.

| char* listGetS | ( | char ** | list, |
| int64_t | index | ||
| ) |
list Get String duplicate string at given index index can be negative
| list | |
| index | index in list, must be inside the list |
Definition at line 50967 of file libsheepy.c.


| char* iListGetS | ( | char ** | list, |
| int64_t | index | ||
| ) |
list Get String index can be negative
| list | |
| index | index in list, must be inside the list |
Definition at line 51001 of file libsheepy.c.


| char* listGetCS | ( | const char ** | list, |
| int64_t | index | ||
| ) |
const list Get String duplicate string at given index index can be negative
| list | |
| index | index in list, must be inside the list |
Definition at line 51036 of file libsheepy.c.


| const char* iListGetCS | ( | const char ** | list, |
| int64_t | index | ||
| ) |
const list Get String index can be negative
| list | |
| index | index in list, must be inside the list |
Definition at line 51070 of file libsheepy.c.


| char** listSetS | ( | char ** | list, |
| int64_t | index, | ||
| const char * | s | ||
| ) |
list Set String duplicate string and store at given index, the existing element is freed index can be negative
| list | |
| index | index in list, must be inside the list |
| string |
Does nothing when: when list is NULL, index is not set correctly or s is NULL
Definition at line 51110 of file libsheepy.c.


| char** listSetCharS | ( | char ** | list, |
| int64_t | index, | ||
| char | c | ||
| ) |
| char** iListSetS | ( | char ** | list, |
| int64_t | index, | ||
| char * | s | ||
| ) |
list Set String store string at given index index can be negative
| list | |
| index | index in list, must be inside the list |
| string |
Does nothing when: when list is NULL, index is not set correctly or s is NULL
Definition at line 51158 of file libsheepy.c.


| char** listSwapS | ( | char ** | list, |
| int64_t | index1, | ||
| int64_t | index2 | ||
| ) |
swap elements in list
| list | |
| index1 | index of character to swap |
| index2 | index of second character to swap |
Definition at line 51195 of file libsheepy.c.

| char** iListSwapS | ( | char ** | list, |
| int64_t | index1, | ||
| int64_t | index2 | ||
| ) |
swap elements in list
| list | |
| index1 | index of character to swap |
| index2 | index of second character to swap |
Definition at line 51245 of file libsheepy.c.

| char** split | ( | const char * | string, |
| const char * | delim | ||
| ) |
split string with delim string when updating this function, also update splitS (identical to split) return list
| string | to split |
| delim | delimiter |
Definition at line 51294 of file libsheepy.c.


| char** splitS | ( | const char * | string, |
| const char * | delim | ||
| ) |
| char** splitChar | ( | const char * | string, |
| char | delim | ||
| ) |
| char** icSplit | ( | const char * | string, |
| const char * | delim | ||
| ) |
ignore case split string with delim string when updating this function, also update icSplitS (identical to icSplit) return list
| string | to split |
| delim | delimiter |
Definition at line 51407 of file libsheepy.c.


| char** icSplitS | ( | const char * | string, |
| const char * | delim | ||
| ) |
| char** icSplitChar | ( | const char * | string, |
| char | delim | ||
| ) |
| ssize_t joinLength | ( | char ** | list, |
| const char * | delim | ||
| ) |
join Length list length after joined with delimiter
| list | |
| delim | string seperator |
Definition at line 51519 of file libsheepy.c.
| char* join | ( | char ** | list, |
| const char * | delim | ||
| ) |
join list, the elements are seperated with delim in the resulting string when updating this function, also update joinS (identical to join)
| list | |
| delim | string seperator |
Definition at line 51554 of file libsheepy.c.


| char* joinS | ( | char ** | list, |
| const char * | delim | ||
| ) |
| char* joinCS | ( | const char ** | list, |
| const char * | delim | ||
| ) |
join list, the elements are seperated with delim in the resulting string
| list | |
| delim | string seperator |
Definition at line 51633 of file libsheepy.c.


| char* joinChar | ( | char ** | list, |
| char | delim | ||
| ) |
| char* bJoin | ( | char * | string, |
| char ** | list, | ||
| const char * | delim | ||
| ) |
buffer join list, the elements are seperated with delim in the resulting string
| list | |
| delim | string seperator |
Definition at line 51683 of file libsheepy.c.


| char* bJoinChar | ( | char * | string, |
| char ** | list, | ||
| char | delim | ||
| ) |
| char* bLJoin | ( | char * | string, |
| size_t | stringSize, | ||
| char ** | list, | ||
| const char * | delim | ||
| ) |
buffer size join list, the elements are seperated with delim in the resulting string
| list | |
| delim | string seperator |
Definition at line 51720 of file libsheepy.c.


| char* bLJoinChar | ( | char * | string, |
| size_t | stringSize, | ||
| char ** | list, | ||
| char | delim | ||
| ) |
| char** extractS | ( | const char * | string, |
| const char * | delim1, | ||
| const char * | delim2 | ||
| ) |
extract string between delim1 and delim2 strings return list
| string | to split |
| delim1 | first delimiter |
| delim2 | second delimiter, has to be different from delim1 |
Definition at line 51765 of file libsheepy.c.


| char** extractCharSS | ( | const char * | string, |
| char | delim1, | ||
| const char * | delim2 | ||
| ) |
| char** extractSCharS | ( | const char * | string, |
| const char * | delim1, | ||
| char | delim2 | ||
| ) |
| char** extractCharCharS | ( | const char * | string, |
| char | delim1, | ||
| char | delim2 | ||
| ) |
| char** icExtractS | ( | const char * | string, |
| const char * | delim1, | ||
| const char * | delim2 | ||
| ) |
ignore case extract string between delim1 and delim2 strings return list
| string | to split |
| delim1 | first delimiter |
| delim2 | second delimiter, has to different from delim1 |
Definition at line 51838 of file libsheepy.c.


| char** icExtractCharSS | ( | const char * | string, |
| char | delim1, | ||
| const char * | delim2 | ||
| ) |
| char** icExtractSCharS | ( | const char * | string, |
| const char * | delim1, | ||
| char | delim2 | ||
| ) |
| char** icExtractCharCharS | ( | const char * | string, |
| char | delim1, | ||
| char | delim2 | ||
| ) |
| char** listDupS | ( | char ** | list | ) |
list Duplicate String
| list |
Definition at line 51906 of file libsheepy.c.


| char** listDupCS | ( | const char ** | list | ) |
const list Duplicate String
| list |
Definition at line 51940 of file libsheepy.c.


| char** iListDupS | ( | char ** | list | ) |
list Duplicate String
copy pointers to new list After this function, free list with free instead of listFreeS
Note: this function creates a new list, so char *** is not needed. Unlike iList functions.
| list |
Definition at line 51980 of file libsheepy.c.

| char** listReverseS | ( | char ** | list | ) |
list Reverse String duplicate and reverse list, the last element is the first element of the new list
| list |
Definition at line 52015 of file libsheepy.c.

| char** iListReverseS | ( | char *** | list | ) |
list Reverse String reverse list, the last element is the first element of the list
| list | (this parameter is reallocated) |
Definition at line 52051 of file libsheepy.c.

| char** listCatSF | ( | char ** | paramType, |
| ... | |||
| ) |
list Cat String
| arbitrary | list of lists seperated by commas |
Definition at line 52086 of file libsheepy.c.

| char** listAppendS | ( | char *** | list1, |
| char ** | list2 | ||
| ) |
list Append String Append list2 at the end of list1
list1 is reallocated to add extra space
| list1 | (this parameter is reallocated) |
| list2 |
Definition at line 52116 of file libsheepy.c.


| char** iListAppendS | ( | char *** | list1, |
| char ** | list2 | ||
| ) |
in place list Append String Append list2 at the end of list1 by copying the pointers from list2 to list1.
After this function, free list2 with free instead of listFreeS
list1 is reallocated to add extra space
| list1 | (this parameter is reallocated) |
| list2 |
Definition at line 52199 of file libsheepy.c.


| char** iListAppendNSmashS | ( | char *** | list1, |
| char ** | list2 | ||
| ) |
list Append and smash list2 Append list2 at the end of list1 by copying the pointers from list2 to list1.
list2 is freed (except when there is an error)
list1 is reallocated to add extra space
| list1 | (this parameter is reallocated) |
| list2 |
Definition at line 52273 of file libsheepy.c.

| char** listShiftS | ( | char *** | list1, |
| char ** | list2 | ||
| ) |
list Shift String Append list2 at the start of list1
list1 is reallocated to add extra space
| list1 | (this parameter is reallocated) |
| list2 |
Definition at line 52298 of file libsheepy.c.

| char** iListShiftS | ( | char *** | list1, |
| char ** | list2 | ||
| ) |
in place list Shift String Append list2 at the start of list1 by copying the pointers from list2 to list1.
After this function, free list2 with free instead of listFreeS
list1 is reallocated to add extra space
| list1 | (this parameter is reallocated) |
| list2 |
Definition at line 52330 of file libsheepy.c.

| char** iListShiftNSmashS | ( | char *** | list1, |
| char ** | list2 | ||
| ) |
list Append and smash list2 Append list2 at the start of list1 by copying the pointers from list2 to list1.
list2 is freed (except when there is an error)
list1 is reallocated to add extra space
| list1 | (this parameter is reallocated) |
| list2 |
Definition at line 52354 of file libsheepy.c.

| char** listAddS | ( | char ** | list1, |
| char ** | list2 | ||
| ) |
list Add String add list1 and list2 in a new list
| list1 | |
| list2 |
Definition at line 52372 of file libsheepy.c.


| char** listAddCS | ( | char ** | list1, |
| const char ** | list2 | ||
| ) |
const list Add String add list1 and list2 in a new list
| list1 | |
| list2 |
Definition at line 52423 of file libsheepy.c.


| char** listSliceS | ( | char ** | list, |
| int64_t | start, | ||
| int64_t | end | ||
| ) |
list Slice String return new list with elements from start and end in list negative indexes are allowed
| list | |
| start | index, must be in the list |
| end | index, must be in the list |
Definition at line 52479 of file libsheepy.c.


| char** iListCopyS | ( | char ** | list, |
| int64_t | start, | ||
| int64_t | end | ||
| ) |
list Copy String return new list with element pointers from start and end in list negative indexes are allowed
Note: this function creates a new list, so char *** is not needed. Unlike iList functions.
| list | |
| start | index, must be in the list |
| end | index, must be in the list |
Definition at line 52552 of file libsheepy.c.


| char** iListSliceS | ( | char *** | list, |
| int64_t | start, | ||
| int64_t | end | ||
| ) |
list Slice String return list with elements from start and end in list negative indexes are allowed
| list | (this parameter is reallocated) |
| start | index, must be in the list |
| end | index, must be in the list |
Definition at line 52623 of file libsheepy.c.


| char** listCropS | ( | char ** | list, |
| int64_t | start, | ||
| int64_t | end | ||
| ) |
list Crop String return a new list with elements from start and end in list and delete elements from start to end in the original list negative indexes are allowed
iListCropS is faster than listSliceS+iListDelS because only the string pointers are copied to the sliced list
| list | |
| start | index, must be in the list |
| end | index, must be in the list |
Definition at line 52717 of file libsheepy.c.

| char** iListCropS | ( | char *** | list, |
| int64_t | start, | ||
| int64_t | end | ||
| ) |
list Crop String return a new list with elements from start and end in list and delete elements from start to end in the original list negative indexes are allowed
iListCropS is faster than listSliceS+iListDelS because only the string pointers are copied to the sliced list
| list | |
| start | index, must be in the list |
| end | index, must be in the list |
Definition at line 52799 of file libsheepy.c.

| char* listCropElemS | ( | char ** | list, |
| int64_t | index | ||
| ) |
list Crop Element String return element at index and delete element at index in the original list negative indexes are allowed
iListCropS is faster than listSliceS+iListDelElemS because only the string pointer is returned directly
| list | |
| index | must be in the list |
Definition at line 52879 of file libsheepy.c.

| char* iListCropElemS | ( | char *** | list, |
| int64_t | index | ||
| ) |
list Crop Element String return element at index and delete element at index in the original list negative indexes are allowed
iListCropS is faster than listSliceS+iListDelElemS because only the string pointer is returned directly
| list | |
| index | must be in the list |
Definition at line 52933 of file libsheepy.c.

| char** listInsertS | ( | char ** | list, |
| int64_t | index, | ||
| char ** | toInsert | ||
| ) |
list Insert string
insert list in list at index
return new list with toInsert at index negative indexes are allowed index -1 is the end of the array and is equivalent to index len
| list | |
| index | in list |
| toInsert | list |
Definition at line 52986 of file libsheepy.c.


| char** iListInsertS | ( | char *** | list, |
| int64_t | index, | ||
| char ** | toInsert | ||
| ) |
list Insert string
insert list in list at index After this function, free toInsert with free instead of listFreeS
return list with toInsert at index negative indexes are allowed index -1 is the end of the array and is equivalent to index len
| list | (this parameter is reallocated) |
| index | in list |
| toInsert | list |
Definition at line 53060 of file libsheepy.c.


| char** iListInsertNFreeS | ( | char *** | list, |
| int64_t | index, | ||
| char ** | toInsert | ||
| ) |
list Insert string and free toInsert
insert list in list at index
return list with toInsert at index negative indexes are allowed index -1 is the end of the array and is equivalent to index len
| list | (this parameter is reallocated) |
| index | in list |
| toInsert | list |
Definition at line 53161 of file libsheepy.c.


| char** listInjectS | ( | char ** | list, |
| int64_t | index, | ||
| char * | toInject | ||
| ) |
list Inject string
Inject string in list at index
return new list with toInject at index negative indexes are allowed index -1 is the end of the array and is equivalent to index len
| list | |
| index | in list |
| toInject | string |
Definition at line 53254 of file libsheepy.c.


| char** listInjectCharS | ( | char ** | list, |
| int64_t | index, | ||
| char | toInject | ||
| ) |
| char** iListInjectS | ( | char *** | list, |
| int64_t | index, | ||
| char * | toInject | ||
| ) |
list Inject string
Inject string pointer in list at index
return list with toInject at index negative indexes are allowed index -1 is the end of the array and is equivalent to index len
| list | (this parameter is reallocated) |
| index | in list |
| toInject | string |
Definition at line 53339 of file libsheepy.c.


| char** iListInjectCharS | ( | char *** | list, |
| int64_t | index, | ||
| char | toInject | ||
| ) |
| char** listDelS | ( | char ** | list, |
| int64_t | start, | ||
| int64_t | end | ||
| ) |
list Delete String return new list without elements from start and end in list negative indexes are allowed
| list | |
| start | index, must be in the list |
| end | index, must be in the list |
Definition at line 53435 of file libsheepy.c.

| char** iListDelS | ( | char *** | list, |
| int64_t | start, | ||
| int64_t | end | ||
| ) |
list Delete String return list without elements from start and end in list negative indexes are allowed
| list | (this parameter is reallocated) |
| start | index, must be in the list |
| end | index, must be in the list |
Definition at line 53512 of file libsheepy.c.

| char** iListRemoveS | ( | char *** | list, |
| int64_t | start, | ||
| int64_t | end | ||
| ) |
list Remove String return list without elements from start and end in list the elements are removed without being freed negative indexes are allowed
| list | (this parameter is reallocated) |
| start | index, must be in the list |
| end | index, must be in the list |
Definition at line 53595 of file libsheepy.c.

| char** listDelElemS | ( | char ** | list, |
| int64_t | index | ||
| ) |
list Delete Element String return new list without the element at index negative indexes are allowed
| list | |
| index | must be in the list |
Definition at line 53670 of file libsheepy.c.

| char** iListDelElemS | ( | char *** | list, |
| int64_t | index | ||
| ) |
list Delete Element String return list without the element at index negative indexes are allowed
| list | (this parameter is reallocated) |
| index | must be in the list |
Definition at line 53725 of file libsheepy.c.

| char** iListRemoveElemS | ( | char *** | list, |
| int64_t | index | ||
| ) |
list Remove Element String return list without the element at index the element is removed without being freed negative indexes are allowed
| list | (this parameter is reallocated) |
| index | must be in the list |
Definition at line 53785 of file libsheepy.c.

| int listPrintS | ( | char ** | list | ) |
print list elements to stdout
when list is NULL, returns directly without doing anything
| list |
Definition at line 53841 of file libsheepy.c.

| int listPrintCS | ( | const char ** | list | ) |
| char** listSortS | ( | char ** | list | ) |
list Sort String duplicate list and sort
| list |
Definition at line 53898 of file libsheepy.c.

| char** iListSortS | ( | char *** | list | ) |
list Sort String
| list |
Definition at line 53928 of file libsheepy.c.


| char** listSortFS | ( | char ** | list, |
| shCmpt | compareFunction | ||
| ) |
list Sort String duplicate list and sort
| list | compareFunction |
Definition at line 53956 of file libsheepy.c.

| char** iListSortFS | ( | char *** | list, |
| shCmpt | compareFunction | ||
| ) |
list Sort String
| list | compareFunction |
Definition at line 53987 of file libsheepy.c.

| char** icListSortS | ( | char ** | list | ) |
ignore case list Sort String duplicate list and sort
| list |
Definition at line 54039 of file libsheepy.c.

| char** iicListSortS | ( | char *** | list | ) |
ignore case list Sort String
| list |
Definition at line 54069 of file libsheepy.c.

| char** readText | ( | const char * | filePath | ) |
return text from filePath in a list new line characters are removed
| filePath | file path |
Definition at line 54122 of file libsheepy.c.


| char** readStream | ( | FILE * | fp | ) |
return text from stream fp in a list new line characters are removed
| fp | file stream |
Definition at line 54187 of file libsheepy.c.


| bool writeText | ( | const char * | filePath, |
| char ** | list | ||
| ) |
write list to filePath
| filePath | |
| list |
Definition at line 54230 of file libsheepy.c.


| bool writeCText | ( | const char * | filePath, |
| const char ** | list | ||
| ) |
write const list to filePath
| filePath | |
| list |
Definition at line 54267 of file libsheepy.c.


| bool writeStream | ( | FILE * | fp, |
| char ** | list | ||
| ) |
write list to stream
| fp | file stream |
| list |
Definition at line 54304 of file libsheepy.c.

| bool writeCStream | ( | FILE * | fp, |
| const char ** | list | ||
| ) |
write const list to stream
| fp | file stream |
| list |
Definition at line 54328 of file libsheepy.c.

| bool appendText | ( | const char * | filePath, |
| char ** | list | ||
| ) |
append list to filePath
| filePath | |
| list |
Definition at line 54352 of file libsheepy.c.


| bool appendCText | ( | const char * | filePath, |
| const char ** | list | ||
| ) |
append const list to filePath
| filePath | |
| list |
Definition at line 54389 of file libsheepy.c.


| char** execOut | ( | const char * | cmd | ) |
execute command return stdout from cmd
| cmd | command |
Definition at line 54426 of file libsheepy.c.


| char** systemOutf | ( | const char * | fmt, |
| ... | |||
| ) |
execute system command with formatting
| formatting |
Definition at line 54458 of file libsheepy.c.

| int systemf | ( | const char * | fmt, |
| ... | |||
| ) |
execute system command with formatting
| formatting |
Definition at line 54484 of file libsheepy.c.
| int commandF | ( | const char * | cmd, |
| int | line, | ||
| const char * | thisFunc, | ||
| const char * | thisFileName | ||
| ) |
run command in default shell
Exit value equals to 127 is considered an error because if a shell could not be executed in the child process, then the return value from system() is 127 (man 3 system).
| cmd | command string |
Definition at line 54514 of file libsheepy.c.


| int commandfF | ( | int | line, |
| const char * | thisFunc, | ||
| const char * | thisFileName, | ||
| const char * | fmt, | ||
| ... | |||
| ) |
run command with formatting in default shell
Exit value equals to 127 is considered an error because if a shell could not be executed in the child process, then the return value from system() is 127 (man 3 system).
| formatting |
Definition at line 54551 of file libsheepy.c.

| int commandNFreeF | ( | char * | cmd, |
| int | line, | ||
| const char * | thisFunc, | ||
| const char * | thisFileName | ||
| ) |
run command in default shell and free the cmd parameter
Exit value equals to 127 is considered an error because if a shell could not be executed in the child process, then the return value from system() is 127 (man 3 system).
| cmd | command string |
Definition at line 54581 of file libsheepy.c.


| bool listEqS | ( | char ** | list1, |
| char ** | list2 | ||
| ) |
list Equal String compare each element of list1 and list2
| 2 | lists |
Definition at line 54599 of file libsheepy.c.

| bool listEqCS | ( | char ** | list1, |
| const char ** | list2 | ||
| ) |
const(list2) list Equal String compare each element of list1 and list2
| 2 | lists |
Definition at line 54629 of file libsheepy.c.


| bool listEqC1S | ( | const char ** | list1, |
| char ** | list2 | ||
| ) |
const(list1) list Equal String compare each element of list1 and list2
| 2 | lists |
Definition at line 54659 of file libsheepy.c.


| bool listEqCCS | ( | const char ** | list1, |
| const char ** | list2 | ||
| ) |
const(list1 and 2) list Equal String compare each element of list1 and list2
| 2 | lists |
Definition at line 54689 of file libsheepy.c.


| bool listHasS | ( | char ** | list, |
| const char * | string | ||
| ) |
return true when list has string
| list | |
| string |
Definition at line 54721 of file libsheepy.c.


| bool listHasCS | ( | const char ** | list, |
| const char * | string | ||
| ) |
return true when const list has string
| list | |
| string |
Definition at line 54744 of file libsheepy.c.


| bool listHasCharS | ( | char ** | list, |
| char | c | ||
| ) |
| bool listHasCharCS | ( | const char ** | list, |
| char | c | ||
| ) |
Definition at line 54761 of file libsheepy.c.


| ssize_t listIndexOfS | ( | char ** | list, |
| const char * | string | ||
| ) |
return index of string in list
| list | |
| string |
Definition at line 54779 of file libsheepy.c.

| ssize_t listIndexOfCS | ( | const char ** | list, |
| const char * | string | ||
| ) |
return index of string in const list
| list | |
| string |
Definition at line 54813 of file libsheepy.c.

| ssize_t listIndexOfCharS | ( | char ** | list, |
| char | c | ||
| ) |
| ssize_t listIndexOfCharCS | ( | const char ** | list, |
| char | c | ||
| ) |
Definition at line 54841 of file libsheepy.c.


| ssize_t listBinarySearchS | ( | char ** | list, |
| const char * | string | ||
| ) |
list binary search string
efficiently finds the index of string in list the list has to be sorted with for example listSortS
| list | |
| string | to search |
Definition at line 54861 of file libsheepy.c.


| ssize_t listBinarySearchCharS | ( | char ** | list, |
| char | c | ||
| ) |
| char** listUniqS | ( | char ** | list | ) |
Uniquify elements of list duplicate list each elements are unique in the new list.
| list |
Definition at line 54902 of file libsheepy.c.

| char** iListUniqS | ( | char *** | list | ) |
Uniquify elements of list each elements are unique in the list.
| list | (this parameter is reallocated) |
Definition at line 54942 of file libsheepy.c.


| bool icListEqS | ( | char ** | list1, |
| char ** | list2 | ||
| ) |
ignore case list Equal String compare each element of list1 and list2
| 2 | lists |
Definition at line 54986 of file libsheepy.c.

| bool icListEqCS | ( | char ** | list1, |
| const char ** | list2 | ||
| ) |
ignore case const(list2) list Equal String compare each element of list1 and list2
| 2 | lists |
Definition at line 55016 of file libsheepy.c.


| bool icListEqC1S | ( | const char ** | list1, |
| char ** | list2 | ||
| ) |
ignore case const(list1) list Equal String compare each element of list1 and list2
| 2 | lists |
Definition at line 55046 of file libsheepy.c.


| bool icListEqCCS | ( | const char ** | list1, |
| const char ** | list2 | ||
| ) |
ignore case const(list1 and 2) list Equal String compare each element of list1 and list2
| 2 | lists |
Definition at line 55076 of file libsheepy.c.


| bool icListHasS | ( | char ** | list, |
| const char * | string | ||
| ) |
ignore case and return true when list has string
| list | |
| string |
Definition at line 55108 of file libsheepy.c.


| bool icListHasCharS | ( | char ** | list, |
| char | c | ||
| ) |
| bool icListHasCS | ( | const char ** | list, |
| const char * | string | ||
| ) |
ignore case and return true when const list has string
| list | |
| string |
Definition at line 55137 of file libsheepy.c.


| bool icListHasCharCS | ( | const char ** | list, |
| char | c | ||
| ) |
Definition at line 55148 of file libsheepy.c.


| ssize_t icListIndexOfS | ( | char ** | list, |
| const char * | string | ||
| ) |
ignore case and return index of string in list
| list | |
| string |
Definition at line 55166 of file libsheepy.c.


| ssize_t icListIndexOfCS | ( | const char ** | list, |
| const char * | string | ||
| ) |
ignore case and return index of string in const list
| list | |
| string |
Definition at line 55200 of file libsheepy.c.


| ssize_t icListIndexOfCharS | ( | char ** | list, |
| char | c | ||
| ) |
| ssize_t icListIndexOfCharCS | ( | const char ** | list, |
| char | c | ||
| ) |
Definition at line 55228 of file libsheepy.c.


| ssize_t icListBinarySearchS | ( | char ** | list, |
| const char * | string | ||
| ) |
ignore case list binary search string
efficiently finds the index of string in list the list has be sorted with for example listSortS
| list | |
| string | to search |
Definition at line 55248 of file libsheepy.c.


| ssize_t icListBinarySearchCharS | ( | char ** | list, |
| char | c | ||
| ) |
| char** icListUniqS | ( | char ** | list | ) |
ignore case and uniquify elements of list duplicate list each elements are unique in the new list
| list |
Definition at line 55289 of file libsheepy.c.

| char** iicListUniqS | ( | char *** | list | ) |
ignore case and uniquify elements of list each elements are unique in the list
| list | (this parameter is reallocated) |
Definition at line 55329 of file libsheepy.c.


| char** listCompactS | ( | char ** | list | ) |
remove empty strings from list
| list |
Definition at line 55373 of file libsheepy.c.

| char** iListCompactS | ( | char *** | list | ) |
remove empty strings from list
| list | (this parameter is reallocated) |
Definition at line 55407 of file libsheepy.c.


| void btraceEnable | ( | void | ) |
Definition at line 55441 of file libsheepy.c.
| void btraceDisable | ( | void | ) |
| bool btraceConfig | ( | void | ) |
| char** btrace | ( | void | ) |
generate backtrace the program has to be linked the -rdynamic option for btrace to work btrace can backtrace 50 functions at most.
Definition at line 55472 of file libsheepy.c.


| void** listEmptyF | ( | void | ) |
list Empty Function
Definition at line 55649 of file libsheepy.c.
| void** iListEmptyF | ( | void *** | list | ) |
list Empty Function
| list | list to empty (this parameter is reallocated) |
Definition at line 55668 of file libsheepy.c.

| bool listIsEmpty | ( | void ** | list | ) |
list Is Empty
| list |
Definition at line 55696 of file libsheepy.c.

| void** listCreateF | ( | void * | paramType, |
| ... | |||
| ) |
list Create Function create a list from the list of parameters used from the listCreate(...) macro
| list | of elements seperated with commas |
Definition at line 55716 of file libsheepy.c.

| void** listFromArray | ( | void ** | array, |
| size_t | size | ||
| ) |
list From Array
copy array of 'size' to a new list NULL elements are not copied to the list
| array | |
| size | - number of elements in the array |
Definition at line 55748 of file libsheepy.c.

| void** listPush | ( | void *** | list, |
| void * | s | ||
| ) |
list Push
(like iListPushS)
append s pointer at the end of the list when list is NULL, a new list with one element is returned when list and s are NULL return list with 2 NULL elements when s is NULL, NULL is pushed at the end of the list
the list is reallocated to add extra space
| pointer | to list - becomes NULL when realloc fails (this parameter is reallocated) |
| s | element to push |
Definition at line 55790 of file libsheepy.c.


| void* listPop | ( | void *** | list | ) |
list Pop return last element from list and remove last element from the list
| pointer | to list (this parameter is reallocated) |
Definition at line 55832 of file libsheepy.c.

| void** listPrepend | ( | void *** | list, |
| void * | s | ||
| ) |
list Prepend
(like iListPrependS)
append s pointer at the beginning of the list when list is NULL, a new list with one element is returned when list and s are NULL return list with 2 NULL elements when s is NULL, NULL is pushed at the end of the list
the list is reallocated to add extra space
| pointer | to list - becomes NULL when realloc fails (this parameter is reallocated) |
| s | element to prepend |
Definition at line 55874 of file libsheepy.c.

| void* listDequeue | ( | void *** | list | ) |
list Dequeue return first element from list and remove last element from the list
| pointer | to list |
Definition at line 55920 of file libsheepy.c.

| void listFree | ( | void ** | list | ) |
list Free
| list |
Definition at line 55954 of file libsheepy.c.


| void listFreeManyF | ( | void ** | paramType, |
| ... | |||
| ) |
list free many
free variable list of pointers listFreeManyS(l1, l2, ...);
Definition at line 55971 of file libsheepy.c.

| size_t listLength | ( | void ** | list | ) |
list Length return number of elements until the first NULL element
| list |
Definition at line 55994 of file libsheepy.c.

| void* listGet | ( | void ** | list, |
| int64_t | index | ||
| ) |
list Get
(like iListGetS)
index can be negative
| list | |
| index | index in list, must be inside the list |
Definition at line 56022 of file libsheepy.c.

| void** listSet | ( | void ** | list, |
| int64_t | index, | ||
| void * | s | ||
| ) |
list Set
(like iListSetS)
store element at given index previous element at index has to be freed before hand index can be negative
| list | |
| index | index in list, must be inside the list |
| element |
Does nothing when: when list is NULL, index is not set correctly or s is NULL
Definition at line 56066 of file libsheepy.c.

| void** listDup | ( | void ** | list | ) |
list Duplicate
(like iListDupS)
copy pointers to new list After this function, free list with free instead of listFreeS
Note: this function creates a new list, so void *** is not needed. Unlike iList functions.
| list |
Definition at line 56110 of file libsheepy.c.


| void** listReverse | ( | void ** | list | ) |
list Reverse create index list and reverse list, the last element is the first element of the new list
| list |
Definition at line 56145 of file libsheepy.c.


| void** iListReverse | ( | void *** | list | ) |
list Reverse reverse list, the last element is the first element of the list
| list | (this parameter is reallocated) |
Definition at line 56182 of file libsheepy.c.

| void** listCatF | ( | void ** | paramType, |
| ... | |||
| ) |
list Cat
| arbitrary | list of lists seperated by commas |
Definition at line 56203 of file libsheepy.c.

| void** listAppend | ( | void *** | list1, |
| void ** | list2 | ||
| ) |
list Append
(like iListAppendS)
Append list2 at the end of list1 by copying the pointers from list2 to list1. After this function, free list2 with free instead of listFreeS
list1 is reallocated to add extra space
| list1 | (this parameter is reallocated) |
| list2 |
Definition at line 56240 of file libsheepy.c.


| void** listAdd | ( | void ** | list1, |
| void ** | list2 | ||
| ) |
list Add add list1 and list2 in a new list
| list1 | |
| list2 |
Definition at line 56308 of file libsheepy.c.


| void** listSlice | ( | void ** | list, |
| int64_t | start, | ||
| int64_t | end | ||
| ) |
list Slice
(like iListCopyS)
return new list with element pointers from start and end in list negative indexes are allowed
Note: this function creates a new list, so void *** is not needed. Unlike iList functions.
| list | |
| start | index, must be in the list |
| end | index, must be in the list |
Definition at line 56370 of file libsheepy.c.


| void** iListSlice | ( | void *** | list, |
| int64_t | start, | ||
| int64_t | end | ||
| ) |
list Slice return list with elements from start and end in list negative indexes are allowed
| list | (this parameter is reallocated) |
| start | index, must be in the list |
| end | index, must be in the list |
Definition at line 56441 of file libsheepy.c.

| void** listInsert | ( | void ** | list, |
| int64_t | index, | ||
| void ** | toInsert | ||
| ) |
list Insert
insert list in list at index
return new list with toInsert at index negative indexes are allowed index -1 is the end of the array and is equivalent to index len
| list | |
| index | in list |
| toInsert | list |
Definition at line 56522 of file libsheepy.c.

| void** iListInsert | ( | void *** | list, |
| int64_t | index, | ||
| void ** | toInsert | ||
| ) |
list Insert
insert list in list at index After this function, free toInsert with free instead of listFreeS
return list with toInsert at index negative indexes are allowed index -1 is the end of the array and is equivalent to index len
| list | (this parameter is reallocated) |
| index | in list |
| toInsert | list |
Definition at line 56602 of file libsheepy.c.

| void** listDel | ( | void ** | list, |
| int64_t | start, | ||
| int64_t | end | ||
| ) |
list Delete return new list without elements from start and end in list negative indexes are allowed
| list | |
| start | index, must be in the list |
| end | index, must be in the list |
Definition at line 56684 of file libsheepy.c.

| void** iListDel | ( | void *** | list, |
| int64_t | start, | ||
| int64_t | end | ||
| ) |
list Delete return list without elements from start and end in list negative indexes are allowed
| list | (this parameter is reallocated) |
| start | index, must be in the list |
| end | index, must be in the list |
Definition at line 56761 of file libsheepy.c.

| int ringInit | ( | void * | ring, |
| int | maxCount | ||
| ) |
list Sort duplicate list and sort
| list |
| list |
| 2 | lists |
| list | element |
efficiently finds the index of element in list the list has be sorted with for example listSortS
| list | element to search |
| list |
| list |
| list |
| list |
the ring is empty after this function
a pointer to staticArray is also valid the array is empty after this function
| ring | pointer to initialize |
| maxCount | for this ring type |
Definition at line 57082 of file libsheepy.c.
| int ringEmpty | ( | void * | ring | ) |
empty ring Allocated buffers in the list must be freed before running staticArrayEmpty
Definition at line 57104 of file libsheepy.c.
| int ringIsEmpty | ( | void * | ring | ) |
1 when empty 0 not empty -1 error
Definition at line 57121 of file libsheepy.c.

| int ringIsFull | ( | void * | ring | ) |
1 when full 0 not full -1 error
Definition at line 57137 of file libsheepy.c.

| ssize_t ringCount | ( | void * | ring | ) |
| i64 ringPush | ( | void * | ring | ) |
push element to ring (only increases last, use ringSend) use ringLast to access the element
Definition at line 57186 of file libsheepy.c.

| int ringPop | ( | void * | ring | ) |
pop element from ring (only decreases last)
Definition at line 57215 of file libsheepy.c.

| i64 ringPrepend | ( | void * | ring | ) |
prepend element to ring (only decreases head) use ringFirst to access the element
Definition at line 57249 of file libsheepy.c.

| int ringDequeue | ( | void * | ring | ) |
dequeue element from ring (only increases head, use ringRecv)
Definition at line 57282 of file libsheepy.c.

| void scheduler | ( | void | ) |
fiber usage
The stack is not restored, so all local variables should be stored in the context struct.
Declare a context type for the fiber:
typedef struct {int slot; int a; chanT *c;} AArgs;
the context type must start with int slot; in this example, the fiber has a ring c of type chanT
Declare a function of type:
void fiberA(int thisSlot) { static AArgs *ctx; int slot; ctx = fiberCtx(thisSlot); ... }
several fibers can have the function fiberA with different slots
To yield, add:
yield(slot, ctx->slot); // switch to scheduler ctx = fiberCtx(slot); // restore the context for this fiber
The next steps show how to start the fibers
Declare a variable for the context and create the ring chanT:
AArgs Aa; chanT c; ringInit(&c, chanMax);
Initialize the fiber:
Aa.a = 0; Aa.c = fiberAdd(&Aa, 1, fiberA);
this can also be done from a running fiber
Finally, start the scheduler:
fiber usage
Definition at line 57358 of file libsheepy.c.

| staticArrayT | ( | fiberLT | , |
| int | , | ||
| tCount | |||
| ) |
staticArray to hold the fiber slots
| bool fiberAdd | ( | void * | ctx, |
| int | thisSlot, | ||
| fiberFT | func | ||
| ) |
add new fiber
| ctx | context for the fiber at thisSlot |
| thisSlot | reserved slot for this fiber |
| func | fiber function |
Definition at line 57321 of file libsheepy.c.
| bool fiberPrepend | ( | void * | ctx, |
| int | thisSlot, | ||
| fiberFT | func | ||
| ) |
add new fiber and start immediately after next yield
| ctx | context for the fiber at thisSlot |
| thisSlot | reserved slot for this fiber |
| func | fiber function |
Definition at line 57344 of file libsheepy.c.
| uint64_t getMonotonicTime | ( | void | ) |
end bitfield
Definition at line 57411 of file libsheepy.c.

| int nanoSleepF | ( | uint64_t | time | ) |
nanosleep
sleep nanoseconds
| time | in nanosceonds |
Definition at line 57427 of file libsheepy.c.
| const bool TRUE |
type bool true (glibc true is not bool), for use in generics
Definition at line 862 of file libsheepy.c.
| const bool FALSE |
type bool false (glibc true is not bool), for use in generics
Definition at line 864 of file libsheepy.c.
| jmp_buf tryJumpBuffers[maxTryThrowCount] |
setjmp buffers for try/throw,throwV macros
Definition at line 872 of file libsheepy.c.
| uint64_t logMask |
variable to control which group logs to show, all logs are enabled by default (0xFFFFFFFFFFFFFFFF)
Definition at line 974 of file libsheepy.c.
| const uint8_t codeSzUTF8[256] |
Definition at line 31675 of file libsheepy.c.
| bool btraceCfg |
backtrace in error messages is enabled by default
Definition at line 867 of file libsheepy.c.
| fibersT fibers |
1.8.13