23 #include "../libsheepyObject.h" 24 #if (!defined(__OpenBSD__)) 28 #if (!(__APPLE__ || __FreeBSD__ || __TERMUX__ || __OpenBSD__ || __DragonFly__ || MUSL_LIBC || __sun__)) 32 #if (!(__APPLE__ || __FreeBSD__ || __OpenBSD__ || __DragonFly__ || __HAIKU__)) 34 #include "sys/sysinfo.h" 37 #define internal static 45 #if (!(__OpenBSD__ || __HAIKU__)) 54 #if (!defined(__OpenBSD__)) 56 #if (!(__APPLE__ || __FreeBSD__ || __TERMUX__ || __OpenBSD__ || __DragonFly__ || MUSL_LIBC || __sun__)) 58 #if (!(__APPLE__ || __FreeBSD__ || __OpenBSD__ || __DragonFly__ || __HAIKU__)) 60 #if (__APPLE__ || __FreeBSD__ || __OpenBSD__ || __DragonFly__ || __sun__ || __HAIKU__) 81 #if (!(__APPLE__ || __FreeBSD__ || __TERMUX__ || __OpenBSD__ || __DragonFly__ || MUSL_LIBC || __sun__ || __HAIKU__)) 82 int print_m(FILE *stream,
const struct printf_info *info,
const void *
const *args);
99 void putsSGF(
const char*
object);
148 char *
otos(
void *basetObj);
191 #if (__OpenBSD__ || __HAIKU__) 214 char *
readFileToG(
char **
string,
const char *filePath);
226 char **
readTextSG(
char ***list,
const char *filePath);
228 bool writeTextSG(
char **list,
const char *filePath);
230 bool writeTextCG(
const char **list,
const char *filePath);
232 bool appendFileSG(
const char *
string,
const char *filePath);
234 bool appendTextCG(
const char **list,
const char *filePath);
277 char getSG(
const char *
string,
int retType
UNUSED, int64_t index);
281 const char *
iListGetCG(
const char **list,
int retType
UNUSED, int64_t index);
285 bool listEqCG(
char **list1,
const char **list2);
286 bool listEqC1G(
const char **list1,
char **list2);
287 bool listEqCCG(
const char **list1,
const char **list2);
288 bool icListEqCG(
char **list1,
const char **list2);
289 bool icListEqC1G(
const char **list1,
char **list2);
290 bool icListEqCCG(
const char **list1,
const char **list2);
292 ssize_t
listIndexOfCG(
const char **list,
const char *
string);
297 bool listHasCG(
const char **list,
const char *
string);
298 bool icListHasCG(
const char **list,
const char *
string);
300 char *
joinCG(
const char **list,
const char* delim);
301 char *
joinCharCG(
const char **list,
char delim);
302 char **
listAddCG(
char **list1,
const char **list2);
490 #if (__APPLE__ || __FreeBSD__ || __TERMUX__ || __OpenBSD__ || __DragonFly__ || MUSL_LIBC || __sun__ || __HAIKU__) 503 #if (__APPLE__ || __FreeBSD__ || __OpenBSD__ || __DragonFly__ || __sun__ || __HAIKU__) 525 #else // #if (__APPLE__ || __FreeBSD__ || __OpenBSD__ || __DragonFly__ || __sun__ || __HAIKU__) 535 if (sysinfo(&info) == -1) {
542 setIntO(
r,
"loads", (int64_t)info.loads[0]);
543 setIntO(
r,
"totalram", (int64_t)info.totalram);
544 setIntO(
r,
"freeram", (int64_t)info.freeram);
545 setIntO(
r,
"sharedram", (int64_t)info.sharedram);
546 setIntO(
r,
"bufferram", (int64_t)info.bufferram);
547 setIntO(
r,
"totalswap", (int64_t)info.totalswap);
548 setIntO(
r,
"freeswap", (int64_t)info.freeswap);
577 return(self->f->duplicate(
self));
586 va_start(pl, paramType);
587 paramType = va_arg(pl,
baset *);
590 paramType = va_arg(pl,
baset *);
599 obj = (
baset*)paramType;
603 va_start(pl, paramType);
604 paramType = va_arg(pl,
baset *);
606 obj = (
baset*)paramType;
608 paramType = va_arg(pl,
baset *);
617 obj = (
baset*)paramType;
621 va_start(pl, paramType);
622 paramType = va_arg(pl,
baset *);
624 obj = (
baset*)paramType;
626 paramType = va_arg(pl,
baset *);
635 obj = (
baset*)paramType;
639 va_start(pl, paramType);
640 paramType = va_arg(pl,
baset *);
642 obj = (
baset*)paramType;
644 paramType = va_arg(pl,
baset *);
687 if (!
eqS(type,
"string")) {
700 return(system(
ssGet(command)));
712 if (!
eqS(type,
"string")) {
720 printf(
"\nSystem Error at %d, %s, %s. The command was: \"%s\"\n", line, thisFunc, thisFileName, cmd);
734 char *cmd =
ssGet(command);;
738 printf(
"\nSystem Error at %d, %s, %s. The command was: \"%s\"\n", line, thisFunc, thisFileName, cmd);
745 #if (!(__APPLE__ || __FreeBSD__ || __TERMUX__ || __OpenBSD__ || __DragonFly__ || MUSL_LIBC || __sun__ || __HAIKU__)) 749 int print_m(FILE *stream,
const struct printf_info *info,
const void *
const *args) {
754 o = *((
baset*
const*) args[0]);
756 _Pragma (
"GCC diagnostic push")
757 _Pragma (
"GCC diagnostic ignored \"-Wdiscarded-qualifiers\"") {
761 _Pragma (
"GCC diagnostic pop")
778 argtypes[0] = PA_POINTER;
779 size[0] =
sizeof(
baset*);
835 isError(s, malloc(256*
sizeof(
char))) {
838 snprintf(s,256,
"%e",
object);
849 isError(s, malloc(256*
sizeof(
char))) {
852 snprintf(s,256,
"%e", *
object);
907 s =
intToS((int64_t)
object);
921 s =
intToS((int64_t)*
object);
1078 puts(
"Unsupported putsG type or void pointer");
1114 return(strdup(
"true"));
1117 return(strdup(
"false"));
1127 return(strdup(
"true"));
1130 return(strdup(
"false"));
1137 isError(s, malloc(256*
sizeof(
char)))
return(NULL);
1138 snprintf(s,256,
"%f", (
double)
object);
1148 isError(s, malloc(256*
sizeof(
char)))
return(NULL);
1149 snprintf(s,256,
"%f", (
double)*
object);
1156 isError(s, malloc(256*
sizeof(
char)))
return(NULL);
1157 snprintf(s,256,
"%e",
object);
1167 isError(s, malloc(256*
sizeof(
char)))
return(NULL);
1168 snprintf(s,256,
"%e", *
object);
1214 return(
intToS((int64_t)
object));
1223 return(
intToS((int64_t)*
object));
1276 return(
dupS(
object));
1284 char *
s =
join(
object,
"\",\"");
1287 return(strdup(
"[]"));
1289 char *
r =
catS(
"[\"", s,
"\"]");;
1299 char *
s =
joinCS(
object,
"\",\"");
1302 return(strdup(
"[]"));
1304 char *
r =
catS(
"[\"", s,
"\"]");;
1370 return(strdup(
"Unsupported toStringG type or void pointer"));
1403 if (vasprintf(&r, fmt, pl) == -1) {
1431 fp = popen(cmd,
"r");
1434 shEPrintfS(
"The command was: \"%s\"\n", cmd);
1441 out->
f->fromArrayNFree(out, list, 0);
1453 if (!
eqS(type,
"string")) {
1471 if (!dirPath ||
isBlankS(dirPath)) {
1481 list->f->sort(list);
1494 if (!
eqS(type,
"string")) {
1511 struct dirent *dp = NULL;
1514 d = opendir(dirPath);
1517 shEPrintfS(
"The path was: \"%s\"\n", dirPath);
1523 if (
eqS(dp->d_name,
".") ||
eqS(dp->d_name,
"..")) {
1528 sPath =
catS(dirPath,
"/", dp->d_name);
1536 list->
f->pushS(list, sPath);
1548 if (!dirPath ||
isBlankS(dirPath)) {
1558 list->f->sort(list);
1571 if (!
eqS(type,
"string")) {
1588 struct dirent *dp = NULL;
1591 d = opendir(dirPath);
1594 shEPrintfS(
"The path was: \"%s\"\n", dirPath);
1600 if (
eqS(dp->d_name,
".") ||
eqS(dp->d_name,
"..")) {
1605 sPath =
catS(dirPath,
"/", dp->d_name);
1608 list->
f->pushS(list, sPath);
1622 struct dirent *dp = NULL;
1625 if (!dirPath ||
isBlankS(dirPath)) {
1634 d = opendir(dirPath);
1637 shEPrintfS(
"The path was: \"%s\"\n", dirPath);
1643 if (
eqS(dp->d_name,
".") ||
eqS(dp->d_name,
"..")) {
1648 char *sPath =
catS(dirPath,
"/", dp->d_name);
1650 if (!
isDir(sPath)) {
1651 list->f->pushS(list, dp->d_name);
1659 list->f->sort(list);
1672 if (!
eqS(type,
"string")) {
1689 struct dirent *dp = NULL;
1692 if (!dirPath ||
isBlankS(dirPath)) {
1701 d = opendir(dirPath);
1704 shEPrintfS(
"The path was: \"%s\"\n", dirPath);
1710 if (
eqS(dp->d_name,
".") ||
eqS(dp->d_name,
"..")) {
1715 char *sPath =
catS(dirPath,
"/", dp->d_name);
1718 list->f->pushS(list, dp->d_name);
1726 list->f->sort(list);
1739 if (!
eqS(type,
"string")) {
1757 if (!dirPath ||
isBlankS(dirPath)) {
1767 list->f->sort(list);
1780 if (!
eqS(type,
"string")) {
1797 struct dirent *dp = NULL;
1800 d = opendir(dirPath);
1803 shEPrintfS(
"The path was: \"%s\"\n", dirPath);
1809 if (
eqS(dp->d_name,
".") ||
eqS(dp->d_name,
"..")) {
1814 sPath =
catS(dirPath,
"/", dp->d_name);
1816 list->
f->pushS(list, sPath);
1832 struct dirent *dp = NULL;
1835 if (!dirPath ||
isBlankS(dirPath)) {
1844 d = opendir(dirPath);
1847 shEPrintfS(
"The path was: \"%s\"\n", dirPath);
1853 if (
eqS(dp->d_name,
".") ||
eqS(dp->d_name,
"..")) {
1858 char *sPath =
catS(dirPath,
"/", dp->d_name);
1860 list->f->pushS(list, dp->d_name);
1867 list->f->sort(list);
1880 if (!
eqS(type,
"string")) {
1903 if (!
eqS(type,
"string")) {
1914 if (!path || !path->
data) {
1932 if (!
eqS(type,
"string")) {
1943 if (!path || !path->
data) {
1955 if (!path1 || !path2) {
1961 if (!
eqS(type,
"string")) {
1967 if (!
eqS(type,
"string")) {
1978 if (!path1 || !path2) {
1984 if (!
eqS(type,
"string")) {
1995 if (!path1 || !path2) {
2001 if (!
eqS(type,
"string")) {
2012 if (!path1 || !path2 || !path2->
data) {
2018 if (!
eqS(type,
"string")) {
2029 if (!path1 || !path2 || !path1->
data) {
2035 if (!
eqS(type,
"string")) {
2046 if (!path1 || !path2 || !path1->
data || !path2->
data) {
2113 if (!
eqS(type,
"string")) {
2129 if (!path || !path->
data) {
2137 dir = strdup(
ssGet(path));
2164 if (!
eqS(type,
"string")) {
2174 #if (__OpenBSD__ || __HAIKU__) 2178 if (!path || !path->
data) {
2183 path->
f->set(path, r);
2190 wordexp_t exp_result;
2197 if (!path || !path->
data) {
2203 int status = wordexp(path->
f->get(path), &exp_result, 0);;
2206 shEPrintfS(
"expandHomeO error: unquoted invalid character\n");
2210 shEPrintfS(
"expandHomeO error: undefined shell variable\n");
2214 shEPrintfS(
"expandHomeO error: out of memory\n");
2218 shEPrintfS(
"expandHomeO error: syntax error\n");
2225 path->
f->set(path, exp_result.we_wordv[0]);
2226 wordfree(&exp_result);
2228 path->
f->replace(path,
"~",
"/data/data/com.termux/files/home", 1);
2244 if (!
eqS(type,
"string")) {
2257 if (!path || !path->
data) {
2266 char **pathL =
splitSO(path,
"/");
2274 path->
f->set(path,
"/");
2282 bool onlyLeadingDoubleDots =
true;
2286 if (
strEq(*level,
"..")) {
2287 if (onlyLeadingDoubleDots) {
2297 else if (!
strEq(*level,
".")) {
2301 onlyLeadingDoubleDots =
false;
2305 if (
listLengthS(list) == 1 &&
strEq(list[0],
"..") && path->
f->getAt(path, 0) ==
'/') {
2311 if (path->
f->equalS(path,
"/.")) {
2316 if (path->
f->getAt(path, 0) ==
'/') {
2320 path->
f->set(path,
"/");
2327 char *
r =
join(list,
"/");;
2332 path->
f->set(path,
"");
2335 path->
f->setNFree(path, r);
2360 r = getcwd(NULL, 0);
2370 s->f->setNFree(
s, r);
2382 if (!
eqS(type,
"string")) {
2395 int r = chdir(
ssGet(path));
2412 if (!
eqS(type,
"string")) {
2427 if (stat(
ssGet(path), &st) == -1) {
2431 if (!S_ISDIR(st.st_mode)) {
2445 if (!
eqS(type,
"string")) {
2460 if (lstat(
ssGet(path), &st) == -1) {
2464 if (!S_ISLNK(st.st_mode)) {
2478 if (!
eqS(type,
"string")) {
2488 if (!filePath || filePath->
f->isBlank(filePath)) {
2492 int r = access(filePath->
f->get(filePath), F_OK);
2507 if (!
eqS(type,
"string")) {
2517 if (!filePath ||
isBlankO(filePath)) {
2521 int r = chmod(
ssGet(filePath), mode);
2537 if (!
eqS(type,
"string")) {
2548 if (!filePath ||
isBlankO(filePath)) {
2552 int r = stat(
ssGet(filePath), &st);;
2561 if ((uint64_t)(st.st_size) > 140734000000000) {
2599 logI(
"readFile smallJsont path not supported");
2606 logI(
"readFile smallStringt path not supported");
2613 logI(
"readFile smallJsont path not supported");
2620 logI(
"readFile smallStringt path not supported");
2637 logI(
"writeFile smallJsont path not supported");
2645 logI(
"writeFile smallStringt path not supported");
2653 logI(
"writeFile smallJsont path not supported");
2661 logI(
"writeFile smallStringt path not supported");
2726 if (!
eqS(type,
"string")) {
2736 if (!path || path->
f->isBlank(path)) {
2751 if (!
eqS(type,
"string")) {
2761 if (!path || path->
f->isBlank(path)) {
2771 if (!src || !dst || src->
f->isBlank(src) || dst->
f->isBlank(dst)) {
2780 if (!src || !dst ||
isBlankS(src)) {
2790 if (!
eqS(type,
"string")) {
2804 if (!src || !dst ||
isBlankS(src) || dst->
f->isBlank(dst)) {
2813 if (!src || !dst ||
isBlankS(dst)) {
2823 if (!
eqS(type,
"string")) {
2850 if (!
eqS(type,
"string")) {
2856 if (!
eqS(type,
"string")) {
2883 if (!
eqS(type,
"string")) {
2897 if (!src || !dst || src->
f->isBlank(src) ||
isBlankS(dst)) {
2920 if (!
eqS(type,
"string")) {
2947 if (!
eqS(type,
"string")) {
2974 if (!
eqS(type,
"string")) {
2980 if (!
eqS(type,
"string")) {
2993 if (!src || !dst ||
isBlankS(dst)) {
3003 if (!
eqS(type,
"string")) {
3017 if (!src || !dst || src->
f->isBlank(src) || dst->
f->isBlank(dst)) {
3040 if (!
eqS(type,
"string")) {
3063 if (!
eqS(type,
"string")) {
3106 if (!
eqS(type,
"string")) {
3133 if (!
eqS(type,
"string")) {
3139 if (!
eqS(type,
"string")) {
3152 if (!src || !dst ||
isBlankS(dst)) {
3162 if (!
eqS(type,
"string")) {
3176 if (!src || !dst || src->
f->isBlank(src) || dst->
f->isBlank(dst)) {
3199 if (!
eqS(type,
"string")) {
3222 if (!
eqS(type,
"string")) {
3277 r->f->setNFree(
r, s);
3309 r->f->setNFree(
r, s);
3333 char *
s = malloc(max);
3359 char *tmp = realloc(s, max);
3373 r->f->setNFree(
r, s);
3409 r->f->setNFree(
r, s);
3445 return(
getS(
string, index));
3558 char *
joinCG(
const char **list,
const char* delim) {
3560 return(
joinCS(list, delim));
3581 return(c == value);;
3627 if (!value || !value->
B) {
3643 return(value->
f->equalChar(value,
s));
3653 return(value->
f->equalChar(value,
s));
3668 if (!
eqS(type,
"string")) {
3678 if (!value || !value->
data) {
3734 return(value->
f->equalChar(value, s));
3742 return(value->
f->equalS(value, s));
3750 return(value->
f->equalChar(value, s));
3758 return(value->
f->equalChar(value, s));
3773 if (!
eqS(type,
"string")) {
3795 if (!
isOType(p2,
"smallArray")) {
3825 if (!
isOType(p2,
"smallArray")) {
3861 if (!
eqS(type,
"array")) {
3865 return(p2->
f->equalArray(p2, p1));
3878 return(p2->
f->equalArray(p2, p1));
3893 if (!
eqS(type,
"array")) {
3897 return(p2->
f->equalCArray(p2, p1));
3910 return(p2->
f->equalCArray(p2, p1));
3992 return(p2->
f->equalBase(p2, p1));
4005 return(p2->
f->equalBase(p2, p1));
4018 return(p2->
f->equalBase(p2, p1));
4031 return(p2->
f->equalBase(p2, p1));
4044 return(p2->
f->equalBase(p2, p1));
4057 return(p2->
f->equalBase(p2, p1));
4070 return(p2->
f->equalBase(p2, p1));
4075 if (!p1 || !p2 || !p2->
data) {
4101 if (
strEq(p2,
"true") ||
strEq(p2,
"TRUE")) {
4104 else if (
strEq(p2,
"false") ||
strEq(p2,
"FALSE")) {
4122 else if (
strEq(s,
"false") ||
strEq(s,
"FALSE")) {
4162 if (!p2 || !p2->
value) {
4171 if (!p2 || !p2->
B) {
4186 if (!p2 || !p2->
value) {
4195 if (!p2 || !p2->
value) {
4217 if (!p2 || !p2->
data) {
4225 else if (
strEq(s,
"false") ||
strEq(s,
"FALSE")) {
4248 return(p1 == value);;
4309 if (!p2 || !p2->
value) {
4318 if (!p2 || !p2->
B) {
4342 return(p2Value == p1);;
4347 if (!p2 || !p2->
value) {
4356 if (!p2 || !p2->
value) {
4378 if (!p2 || !p2->
data) {
4390 return(p2Value == p1);;
4410 return(p1 == value);;
4466 return((uint64_t)p1 == p2);;
4471 if (!p2 || !p2->
value) {
4480 if (!p2 || !p2->
B) {
4504 return(p2Value == p1);;
4509 if (!p2 || !p2->
value) {
4518 if (!p2 || !p2->
value) {
4540 if (!p2 || !p2->
data) {
4552 return(p2Value == p1);;
4572 return(p1 == value);;
4623 return((uint32_t)p1 == p2);;
4628 return((uint64_t)p1 == p2);;
4633 if (!p2 || !p2->
value) {
4642 if (!p2 || !p2->
B) {
4664 int32_t p2Value = (int32_t)
parseInt(s);
4666 return(p2Value == p1);;
4671 if (!p2 || !p2->
value) {
4680 if (!p2 || !p2->
value) {
4702 if (!p2 || !p2->
data) {
4712 int32_t p2Value = (int32_t)
parseIntO(p2);
4714 return(p2Value == p1);;
4734 return(p1 == value);;
4780 return(p1 == (uint32_t)p2);;
4795 if (!p2 || !p2->
value) {
4804 if (!p2 || !p2->
B) {
4826 uint32_t p2Value = (uint32_t)
parseInt(s);
4828 return(p2Value == p1);;
4833 if (!p2 || !p2->
value) {
4842 if (!p2 || !p2->
value) {
4864 if (!p2 || !p2->
data) {
4874 uint32_t p2Value = (uint32_t)
parseIntO(p2);
4876 return(p2Value == p1);;
4896 return(p1 == value);;
4937 return(p1 == (uint64_t)p2);;
4942 return(p1 == (uint64_t)p2);;
4957 if (!p2 || !p2->
value) {
4966 if (!p2 || !p2->
B) {
4988 uint64_t p2Value = (uint64_t)
parseInt(s);
4990 return(p2Value == p1);;
4995 if (!p2 || !p2->
value) {
5004 if (!p2 || !p2->
value) {
5026 if (!p2 || !p2->
data) {
5036 uint64_t p2Value = (uint64_t)
parseIntO(p2);
5038 return(p2Value == p1);;
5124 return(tolower(c) == tolower(value));;
5144 return(value->
f->icEqualChar(value, c));
5180 return(value->
f->icEqualS(value, s));
5198 if (!
isOType(p2,
"smallArray")) {
5228 if (!
isOType(p2,
"smallArray")) {
5265 if (!
eqS(type,
"array")) {
5269 return(p2->
f->icEqualArray(p2, p1));
5285 if (!
eqS(type,
"array")) {
5289 return(p2->
f->icEqualCArray(p2, p1));
5302 return(p2->
f->icEqualArray(p2, p1));
5315 return(p2->
f->icEqualCArray(p2, p1));
5367 return(p2->
f->icEqualBase(p2, p1));
5380 return(p2->
f->icEqualBase(p2, p1));
5394 return(p2->
f->icEqualBase(p2, p1));
5399 if (!p1 || !p2 || !p2->
data) {
5433 if (
isOType(obj,
"undefined")) {
5436 else if (
isOType(obj,
"smallArray")) {
5442 else if (
isOType(obj,
"smallDict")) {
5448 else if (
isOType(obj,
"smallBool")) {
5454 else if (
isOType(obj,
"smallBytes")) {
5460 else if (
isOType(obj,
"smallContainer")) {
5466 else if (
isOType(obj,
"smallDouble")) {
5472 else if (
isOType(obj,
"smallInt")) {
5478 else if (
isOType(obj,
"smallString")) {
5580 s->
_len = strlen((
char*)obj)-1;
5599 return((
int)sysconf(_SC_NPROCESSORS_ONLN));
5616 dArrayAt(&finalizeRecycleContainersFuncs,
i)(NULL);
5638 #if (__APPLE__ || __FreeBSD__ || __TERMUX__ || __OpenBSD__ || __DragonFly__ || MUSL_LIBC || __sun__ || __HAIKU__) 5653 int numberOfOnlineProcs = (int)sysconf(_SC_NPROCESSORS_ONLN);
5656 pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
5668 #else // #if (__APPLE__ || __FreeBSD__ || __TERMUX__ || __OpenBSD__ || __DragonFly__ || MUSL_LIBC || __sun__ || __HAIKU__) 5683 int numberOfOnlineProcs = (int)sysconf(_SC_NPROCESSORS_ONLN);
5686 pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
bool icEqualCharPSmallStringG(const char *s, smallStringt *value)
smallStringt * randomSO(uint64_t length)
char ** listAddCG(char **list1, const char **list2)
char * toStringSmallDoubleGF(smallDoublet *object)
void listFreeS(char **list)
list Free String
bool equalUint64Int64G(uint64_t p1, int64_t p2)
void finalizeRecycleUndefined(void *arg UNUSED)
char ** listFromArrayG(char **retType UNUSED, char **array, size_t size)
call listFromArrayS for fromArrayG
bool icEqualOSmallDictG(baset *p1, smallDictt *p2)
char ** iListUniqS(char ***list)
Uniquify elements of list each elements are unique in the list.
bool equalInt32SmallBoolG(int32_t p1, smallBoolt *p2)
bool equalArrayOG(char **p1, baset *p2)
bool equalUint64SmallDoubleG(uint64_t p1, smallDoublet *p2)
bool equalModificationTimes(const char *path1, const char *path2)
compare modification times for path1 and path2
void putsInt32GF(int32_t object)
bool equalOBoolG(baset *p1, bool p2)
void finalizeSmallBytes(void)
int listPrintCS(const char **list)
smallStringt * getProgPathO(void)
bool equalDoubleSmallDoubleG(double p1, smallDoublet *p2)
smallt * toSmallt(baset *obj)
convert baset object to smallt
bool equalInt64SmallDoubleG(int64_t p1, smallDoublet *p2)
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 th...
bool eqS(const char *string1, const char *string2)
string Equal compare string1 to string2
bool equalCArraySmallJsonG(const char **p1, smallJsont *p2)
bool equalInt32FG(int32_t p1, int32_t p2)
int renameOSmallJson(smallStringt *src, smallJsont *dst)
bool notEqualDoubleG(void *p1 UNUSED, double p2 UNUSED)
void * readFileToNewG(void *none UNUSED, const char *filePath)
call readFileToS (for readFileG)
bool writeCStream(FILE *fp, const char **list)
write const list to stream
bool isBlankS(const char *string)
is Blank String
smallJsont * readSmallJsonO(void)
read String read user input (one line) as a string
#define dArrayFree
free the internal buffers
ssize_t icListIndexOfCS(const char **list, const char *string)
ignore case and return index of string in const list
void cleanUpBaseSmashG(baset **val)
char * toStringBoolGF(bool object)
char * toStringUndefinedGF(undefinedt *object)
void putsArrayGF(smallArrayt *object)
void putsListCSGF(const char **object)
bool equalInt32Uint32G(int32_t p1, uint32_t p2)
bool equalInt64Uint32G(int64_t p1, uint32_t p2)
bool equalInt64FG(int64_t p1, int64_t p2)
int rmAllO(smallStringt *path)
bool equalBoolUint64G(bool p1, uint64_t p2)
bool equalUint32SmallIntG(uint32_t p1, smallIntt *p2)
char * toStringSmallContainerGF(smallContainert *object)
bool equalCharSmallBoolG(const char *s, smallBoolt *value)
smallDictt * shSysinfo(void)
sheepy sysinfo
bool isLink(const char *path)
is symbolic link
smallArrayt * walkDirDirO(const char *dirPath)
list all directories in a directory recursively and sort the list
char * toStringSmallBoolGF(smallBoolt *object)
#define equalBoolO(self, p2)
bool equalOUint64G(baset *p1, uint64_t p2)
void finalizeSmallArray(void)
sStringt * allocSStringTiny(const char *data)
allocate a small string
void finalizeRecycleSmallInt(void *arg UNUSED)
#define ssGet(obj)
get a pointer to the string in the smallString object
char * toStringInt32PGF(int32_t *object)
void readToFileSmallJsonNotSupported(void *self UNUSED, smallJsont *path UNUSED)
#define rangeDown(index, maxCount)
range down loop, index is ssize_t
void finalizeSmallJson(void)
sIntt * allocSInt(int64_t value)
allocate a small int
int mkdirParentsO(smallStringt *path)
char * joinCS(const char **list, const char *delim)
join list, the elements are seperated with delim in the resulting string
bool listEqCG(char **list1, const char **list2)
int renameOS(smallStringt *src, const char *dst)
bool equalOOG(baset *p1, baset *p2)
bool icListEqC1S(const char **list1, char **list2)
ignore case const(list1) list Equal String compare each element of list1 and list2 ...
bool equalOArrayG(baset *p1, char **p2)
void putsDoubleGF(double object)
int shMove(const char *src, const char *dst)
move files recursively
int moveSmallJsonSmallJson(smallJsont *src, smallJsont *dst)
int renameSSmallJsonO(const char *src, smallJsont *dst)
int renameSmallJsonOS(smallJsont *src, const char *dst)
bool writeTextSG(char **list, const char *filePath)
call writeText (for writeFileG) (swaps parameters)
bool equalUint64SmallIntG(uint64_t p1, smallIntt *p2)
int moveSmallJsonOS(smallJsont *src, const char *dst)
bool notEqualDoubleOG(double p1 UNUSED, void *p2 UNUSED)
char * toStringInt16GF(int16_t object)
char * toStringOF(baset *object)
convert data in obj to string
bool equalBoolSmallStringG(bool p1, smallStringt *p2)
ssize_t icListIndexOfCG(const char **list, const char *string)
bool equalUint64BaseG(uint64_t p1, baset *p2)
bool notEqualUint32OG(uint32_t p1 UNUSED, void *p2 UNUSED)
bool equalInt64DoubleG(int64_t p1, double p2)
bool equalDoubleCharG(double p1, const char *p2)
char * toStringUint32GF(uint32_t object)
char * randomS(uint64_t length)
random string
char * iListGetG(char **list, int retType UNUSED, int64_t index)
call iListGetS for getG
char * getCwd(void)
get current working directory
bool icListHasCharCG(const char **list, char c)
bool equalModificationTimesO(smallStringt *path1, smallStringt *path2)
char * toStringUint16PGF(uint16_t *object)
int copySmallJsonSmallJson(smallJsont *src, smallJsont *dst)
void putsSmallIntGF(smallIntt *object)
int rmAllSmallJsonO(smallJsont *path)
remove all delete recursively files and directories
void putsUintPGF(uint64_t *object)
int mkdirParentsSmallJsonO(smallJsont *path)
recursive mkdir
bool equalOSmallStringG(baset *p1, smallStringt *p2)
int listPrintS(char **list)
print list elements to stdout
bool equalUint32SmallJsonG(uint32_t p1, smallJsont *p2)
#define isOSmallInt(obj)
test if obj type is smallInt
internal void walkADirAll(const char *dirPath, smallArrayt *list)
bool fileChmodO(smallStringt *filePath, mode_t mode)
void initiateAllocateSmallDouble(smallDoublet **self)
bool appendTextCG(const char **list, const char *filePath)
baset * rtBaset
Generic return types getG(dict, rtBool, "a");.
bool icEqS(const char *string1, const char *string2)
ignore case string Equal compare string1 to string2
void cleanUpBaseFinishG(baset **val)
char * randomAlphaNumS(uint64_t length)
random alpha numerical string
bool notEqualOInt64G(void *p1 UNUSED, int64_t p2 UNUSED)
const char * iListGetCS(const char **list, int64_t index)
const list Get String index can be negative
int renameSO(const char *src, smallStringt *dst)
smallDoublet * rtSmallDoublet
int copyOS(smallStringt *src, const char *dst)
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 elem...
bool equalCharDoubleG(const char *s, double value)
bool equalCArraySmallArrayG(const char **p1, smallArrayt *p2)
char * toStringVoidGF(void *object)
bool listHasCG(const char **list, const char *string)
bool icEqualChaOG(char c, baset *value)
char * toStringSmallJsonGF(smallJsont *object)
char * toStringUint8PGF(uint8_t *object)
bool equalUint64DoubleG(uint64_t p1, double p2)
#define pFuncError
print function name and system error
char * normalizePath(const char *path)
normalize path
bool equalChaInt32G(char c, int32_t value)
bool equalUint64CharG(uint64_t p1, const char *p2)
bool equalUint64ChaG(uint64_t p1, char p2)
char * readS(void)
read String read user input (one line) as a string
void putsInt32PGF(int32_t *object)
int writeStreamS(FILE *fp, const char *string)
write string to file
bool equalUint32SmallBoolG(uint32_t p1, smallBoolt *p2)
char ** iicListUniqG(char ***list, int dum UNUSED)
call iicListUniqS for icUniqG
bool equalUint32SmallBytesG(uint32_t p1, smallBytest *p2)
char * readFileToG(char **string, const char *filePath)
size_t listLengthCG(const char **list)
internal finalizeRecycleContainersFuncst finalizeRecycleContainersFuncs
char * toStringSmallStringGF(smallStringt *object)
base class for the small objects all small objects have a type
smallJsont * timeToJO(const time_t t)
time To String convert unix time to string (ctime is not used here because it adds at the end of th...
bool appendFileSG(const char *string, const char *filePath)
call appendFileS (for appendFileG) (swaps parameters)
void finalizeSmallInt(void)
bool listHasCS(const char **list, const char *string)
return true when const list has string
bool writeText(const char *filePath, char **list)
write list to filePath
char ** listFromCArrayG(char **retType UNUSED, const char **array, size_t size)
char * toStringListSGF(char **object)
bool equalUint32SmallDoubleG(uint32_t p1, smallDoublet *p2)
char ** iicListUniqS(char ***list)
ignore case and uniquify elements of list each elements are unique in the list
#define createAllocateSmallDict(obj)
sBytest * allocSBytes(void)
allocate a small bytes object
bool equalChaInt64G(char c, int64_t value)
char * otos(void *basetObj)
object to string for debug this function is used for printing an object in gdb, lldb, any debugger, in gdb: p otos(obj) a longer alternative to print an object is: p obj->f->toString(obj)
smallArrayt * walkDirAllSmallJsonO(smallJsont *dirPath)
void putsDictGF(smallDictt *object)
char * toStringUintGF(uint64_t object)
bool icListEqC1G(const char **list1, char **list2)
int shRename(const char *src, const char *dst)
rename file
bool fileExistsJO(smallJsont *filePath)
detect files and directories
bool writeCText(const char *filePath, const char **list)
write const list to filePath
#define equalUint32O(self, p2)
bool isDirO(smallStringt *path)
bool equalCharUint32G(const char *s, uint32_t value)
void readTextSmallStringNotSupported(char ***self UNUSED, smallStringt *path UNUSED)
bool equalCharBoolG(const char *s, bool value)
int renameO(smallStringt *src, smallStringt *dst)
ssize_t icListIndexOfCharCS(const char **list, char c)
bool notEqualBoolOG(bool p1 UNUSED, void *p2 UNUSED)
char * iListGetS(char **list, int64_t index)
list Get String index can be negative
bool equalInt64SmallStringG(int64_t p1, smallStringt *p2)
bool listEqCCG(const char **list1, const char **list2)
bool equalDoubleSmallIntG(double p1, smallIntt *p2)
#define isError(assigned, left)
is Assigment Error catch error when assigned is false, 0 or NULL after being assigned with left ...
int print_m(FILE *stream, const struct printf_info *info, const void *const *args)
m printf type specifier to print baset objects
int writeTextSmallJsonNotSupported(char **self UNUSED, smallJsont *path UNUSED)
char ** listFromArrayS(char **array, size_t size)
list From Array String
smallArrayt * walkDirAllO(const char *dirPath)
list all files and directories in a directory recursively the directories are listed ...
smallArrayt * readDirDirSmallJsonO(smallJsont *dirPath)
#define icEqualSO(self, string)
bool equalInt32CharG(int32_t p1, const char *p2)
bool equalBoolOG(bool p1, baset *p2)
bool equalBoolSmallJsonG(bool p1, smallJsont *p2)
bool icListHasCharCS(const char **list, char c)
bool listHasCharCS(const char **list, char c)
void putsSmallContainerGF(smallContainert *object)
char * sStringGetTiny(sStringt *string)
get string in a small string object
bool notEqualOBoolG(void *p1 UNUSED, bool p2 UNUSED)
ssize_t fileSizeO(smallStringt *filePath)
void readTextSmallJsonNotSupported(char ***self UNUSED, smallJsont *path UNUSED)
void finalizeRecycleSmallArray(void *arg UNUSED)
int systemJO(smallJsont *command)
run system command in a smallString
bool icEqualCArrayOG(const char **p1, baset *p2)
char * intToS(int64_t n)
int To String
char * toStringDoubleGF(double object)
int writeStreamFromG(const char *string, FILE *fp)
int rmAll(const char *path)
remove all delete recursively files and directories
int moveSmallJsonO(smallJsont *src, smallStringt *dst)
move files recursively
int writeTextCCSmallJsonNotSupported(const char **self UNUSED, smallJsont *path UNUSED)
smallJsont * randomAlphaNumSmallJsonO(uint64_t length)
random alpha numerical string
bool fileExistsO(smallStringt *filePath)
bool appendCText(const char *filePath, const char **list)
append const list to filePath
time_t getModificationTimeO(smallStringt *path)
char * toStringSmallIntGF(smallIntt *object)
#define getTopTypeO(self)
void putsListSGF(char **object)
bool equalInt32SmallJsonG(int32_t p1, smallJsont *p2)
bool equalInt64Uint64G(int64_t p1, uint64_t p2)
bool eqCharChar(char c, char value)
equality functions
#define isOSmallJson(obj)
test if obj type is smallJson
smallArrayt * readDirSmallStringO(smallStringt *dirPath)
void initiateAllocateSmallInt(smallIntt **self)
#define isOType(obj, className)
test obj type
bool equalOSmallDictG(baset *p1, smallDictt *p2)
smallArrayt * walkDirO(const char *dirPath)
list all files in a directory recursively the directories are not listed
smallStringFunctionst * f
void finalizeRecycleSmallBytes(void *arg UNUSED)
bool equalBoolInt64G(bool p1, int64_t p2)
internal void walkADir(const char *dirPath, smallArrayt *list)
bool icListEqCCG(const char **list1, const char **list2)
dArrayT(finalizeRecycleContainersFuncst, recycleContainersFt)
void finalizeRecycleSmallDict(void *arg UNUSED)
char * shDirname(const char *path)
sheepy dirname
char * readLine(FILE *fp)
readLine from file stream the fist new line is converted to 0
void freeBasetInContainer(void *baseo)
#define createAllocateSmallJson(obj)
ssize_t listIndexOfCharCG(const char **list, char c)
int moveSO(const char *src, smallStringt *dst)
void finalizeSmallDouble(void)
bool writeStream(FILE *fp, char **list)
write list to stream
#define terminateO(obj)
free buffers and obj itself
void cleanUpBaseTerminateG(baset **val)
smallArrayt * readDirO(const char *dirPath)
list files in a directory and sort the list
bool equalCharUint64G(const char *s, uint64_t value)
void finalizeRecycleSmallJson(void *arg UNUSED)
bool equalChaSmallJsonG(char c, smallJsont *value)
#define range(index, maxCount)
range loop ;size_t UNIQVAR needed to avoid: error: a label can only be part of a statement and a decl...
bool equalUint64BoolG(uint64_t p1, bool p2)
char * toStringUint8GF(uint8_t object)
bool equalDoubleSmallJsonG(double p1, smallJsont *p2)
pErrorNULL(iPrependS(&ks, "[1]"))
char * toStringFloatPGF(float *object)
bool equalDoubleSmallBoolG(double p1, smallBoolt *p2)
void putsSmallStringGF(smallStringt *object)
int execSmallStringO(smallStringt *cmd, smallArrayt *out, smallArrayt *err)
char ** listDupCS(const char **list)
const list Duplicate String
bool equalUint64SmallBytesG(uint64_t p1, smallBytest *p2)
bool isLinkO(smallStringt *path)
#define isOSmallBytes(obj)
test if obj type is smallBytes
char ** readText(const char *filePath)
return text from filePath in a list new line characters are removed
bool appendTextSG(char **list, const char *filePath)
call appendText (for appendFileG) (swaps parameters)
bool equalCharSmallIntG(const char *s, smallIntt *value)
sContainert * allocSContainer(void *data)
allocate a small container The container holds a pointer to a user buffer
char * joinCG(const char **list, const char *delim)
smallArrayt * readDirDirSmallStringO(smallStringt *dirPath)
char * doubleToSG(char *retType UNUSED, double n)
call doubleToS for doubleToG
bool equalUint32FG(uint32_t p1, uint32_t p2)
baset * toBaset(smallt *obj)
convert smallt object to baset
bool icListHasCS(const char **list, const char *string)
ignore case and return true when const list has string
bool equalUint32Int64G(uint32_t p1, int64_t p2)
bool equalDoubleSmallBytesG(double p1, smallBytest *p2)
bool equalUint32DoubleG(uint32_t p1, double p2)
bool equalDoubleBaseG(double p1, baset *p2)
int writeFileS(const char *filePath, const char *string)
write string to file
bool equalUint32SmallStringG(uint32_t p1, smallStringt *p2)
bool icListHasCG(const char **list, const char *string)
sUndefinedt * allocSUndefined(void)
allocate a small undefined object
bool equalOCharG(baset *p1, const char *p2)
int copy(const char *src, const char *dst)
copy files recursively This function is equivalent to 'cp -Ra' without wildcards and circular link de...
smallJsont * shDirnameJO(smallJsont *path)
sheepy dirname
bool notEqualOUint32G(void *p1 UNUSED, uint32_t p2 UNUSED)
bool equalBoolUint32G(bool p1, uint32_t p2)
bool isDir(const char *path)
is directory
char * listGetG(char **list, int retType UNUSED, int64_t index)
call listGetS for getG
bool equalCArrayOG(const char **p1, baset *p2)
smallContainert * rtSmallContainert
smallJsont * expandHomeJO(smallJsont *path)
expands ~/ ($HOME) or ~USER duplicate and expand path.
bool equalDoubleFG(double p1, double p2)
void(* recycleContainersFt)(void *arg)
function pointer freeing the unused containers of a class in a thread
#define dArrayCount(name)
return element count
bool equalUint64SmallJsonG(uint64_t p1, smallJsont *p2)
smallArrayt * readDirAllSmallStringO(smallStringt *dirPath)
int execSmallJsonO(smallJsont *cmd, smallArrayt *out, smallArrayt *err)
int copySmallJsonOS(smallJsont *src, const char *dst)
char * doubleToS(double n)
double To String
bool equalModificationTimesSJO(const char *path1, smallJsont *path2)
bool equalBoolInt32G(bool p1, int32_t p2)
bool equalDoubleInt64G(double p1, int64_t p2)
#define equalInt32O(self, p2)
int setModificationTimeJO(smallJsont *path, time_t mtime)
set modification time for path
bool equalInt32Uint64G(int32_t p1, uint64_t p2)
bool equalUint64SmallBoolG(uint64_t p1, smallBoolt *p2)
bool equalUint32ChaG(uint32_t p1, char p2)
#define equalInt64O(self, p2)
bool equalDoubleUint64G(double p1, uint64_t p2)
smallBoolt * rtSmallBoolt
smallArrayt * readDirAllSmallJsonO(smallJsont *dirPath)
char * toStringInt16PGF(int16_t *object)
void putsUint32GF(uint32_t object)
bool fileChmod(const char *filePath, mode_t mode)
like chmod in stdlibc but return true/false
bool isDirJO(smallJsont *path)
is directory
bool equalChaSmallStringG(char c, smallStringt *value)
char * toStringIntPGF(int64_t *object)
void freeManyOF(void *paramType,...)
free many buffers in baset objects
bool equalInt32SmallStringG(int32_t p1, smallStringt *p2)
bool equalModificationTimesSO(const char *path1, smallStringt *path2)
int systemO(smallStringt *command)
bool notEqualCharG(char c UNUSED, void *value UNUSED)
return false, used in eqG when object types don't match
char ** listFromCArrayS(const char **array, size_t size)
list From Const Array String
char * toStringUint16GF(uint16_t object)
char * listGetCG(const char **list, int retType UNUSED, int64_t index)
void finalizeSmallDict(void)
int renameSmallJsonSmallJson(smallJsont *src, smallJsont *dst)
smallArrayt * readDirSmallJsonO(smallJsont *dirPath)
#define cast(type, casted, toCast)
define variable and cast pointer
char * readStreamToG(char **string, FILE *fp)
#define parseDoubleO(self)
char * join(char **list, const char *delim)
join list, the elements are seperated with delim in the resulting string when updating this function...
bool equalCharSmallDoubleG(const char *s, smallDoublet *value)
#define splitSO(self, delim)
void smashManyOF(void *paramType,...)
smash many baset objects
char ** listDupCG(const char **list)
void initiateAllocateSmallDict(smallDictt **self)
char * listDequeueS(char ***list)
list Dequeue String return first string from list and remove it from the list
bool icEqualOCharG(baset *p1, const char *p2)
bool equalCharInt32G(const char *s, int32_t value)
smallStringt * normalizePathO(smallStringt *path)
int copyOSmallJson(smallStringt *src, smallJsont *dst)
int writeTextSmallStringNotSupported(char **self UNUSED, smallStringt *path UNUSED)
smallArrayt * walkDirDirSmallStringO(smallStringt *dirPath)
#define toStringO(obj)
convert data in obj to string
bool listEqC1S(const char **list1, char **list2)
const(list1) list Equal String compare each element of list1 and list2
bool equalInt64SmallJsonG(int64_t p1, smallJsont *p2)
char ** listAddCS(char **list1, const char **list2)
const list Add String add list1 and list2 in a new list
void putsOF(baset *object)
puts for objects using toString
bool isNumber(const char *string)
is Number (integer or float) String
bool icEqualOCArrayG(baset *p1, const char **p2)
void finalizeSmallBool(void)
bool equalDoubleSmallStringG(double p1, smallStringt *p2)
unsigned registerFinalizeRecycleContainersInThreadPool(recycleContainersFt f)
register function freeing the unused containers a finalizeRecycle must be registered for each class i...
void putsDoublePGF(double *object)
void initiateAllocateSmallArray(smallArrayt **self)
bool equalInt64ChaG(int64_t p1, char p2)
bool fileChmodJO(smallJsont *filePath, mode_t mode)
like chmod in stdlibc but return true/false
void * readFileToS(const char *filePath)
read file to string
pthread_mutex_t tpoolLocks[tpoolLockCount]
bool equalCharOG(const char *s, baset *value)
void initiateAllocateSmallBool(smallBoolt **self)
bool equalInt32BoolG(int32_t p1, bool p2)
char * toStringListCSGF(const char **object)
void putsUintGF(uint64_t object)
bool isLinkJO(smallJsont *path)
is symbolic link
sDictt * allocSDict(void)
allocate a small dict
void finalizeRecycleSmallContainer(void *arg UNUSED)
bool icEqualArraySmallArrayG(char **p1, smallArrayt *p2)
bool icEqualOSmallJsonG(baset *p1, smallJsont *p2)
sContainert * data
pointer to data in smallContainer
bool equalChaDoubleG(char c, double value)
bool equalInt32SmallIntG(int32_t p1, smallIntt *p2)
bool listHasCharCG(const char **list, char c)
#define shPrintError
print error with line number, function name and file name to stderr
bool equalOSmallBytesG(baset *p1, smallBytest *p2)
bool icEqualChaSmallStringG(char c, smallStringt *value)
const char * iListGetCG(const char **list, int retType UNUSED, int64_t index)
bool notEqualInt64OG(int64_t p1 UNUSED, void *p2 UNUSED)
int execO(const char *cmd, smallArrayt *out, smallArrayt *err UNUSED)
bool icListEqCS(char **list1, const char **list2)
ignore case const(list2) list Equal String compare each element of list1 and list2 ...
smallStringt * getCwdO(void)
bool equalCharPSmallStringG(const char *s, smallStringt *value)
smallJsont * getRealProgPathJO(void)
get real program path The first call allocates libSheepyRealProgPath, it is freed with freeRealProgPa...
bool equalUint32CharG(uint32_t p1, const char *p2)
smallStringt * expandHomeO(smallStringt *path)
ssize_t icListIndexOfCharCG(const char **list, char c)
#define setTopStringO(self, value)
smallJsont * readLineSmallJsonO(FILE *fp)
readLine from file stream the fist new line is converted to 0
void initiateAllocateSmallString(smallStringt **self)
void * readStreamToNewG(void *none UNUSED, FILE *fp)
int mkdirParents(const char *path)
recursive mkdir
void terminateManyOF(void *paramType,...)
terminate many baset objects
bool isInt(const char *string)
is Integer String
bool icEqualArrayOG(char **p1, baset *p2)
bool icEqualOChaG(baset *p1, char p2)
int writeFileFromG(const char *string, const char *filePath)
call writeFileS (for writeFileG) (swaps parameters)
smallStringt * getRealProgPathO(void)
ssize_t fileSizeJO(smallJsont *filePath)
get file size
bool equalOSmallIntG(baset *p1, smallIntt *p2)
#define pErrorNot0(func)
print error when function failed.
bool icEqualOSmallArrayG(baset *p1, smallArrayt *p2)
bool equalModificationTimesOJO(smallStringt *path1, smallJsont *path2)
char * toStringSmallBytesGF(smallBytest *object)
char * listPopS(char ***list)
list Pop String return last string from list and remove last element from the list ...
smallBytest * rtSmallBytest
bool equalOChaG(baset *p1, char p2)
char * toStringInt32GF(int32_t object)
#define isOSmallDouble(obj)
test if obj type is smallDouble
char * toStringIntGF(int64_t object)
void * sBytesGet(sBytest *bytes)
get buffer in small bytes
smallDictt * rtSmallDictt
#define equalSO(self, string)
double parseDouble(const char *string)
convert string to double
void finalizeSmallContainer(void)
bool equalUint32BaseG(uint32_t p1, baset *p2)
bool notEqualOInt32G(void *p1 UNUSED, int32_t p2 UNUSED)
void initLibsheepyObject(void)
called from initLibsheepy in libsheepy.c start the thread pool
smallStringt * readLineO(FILE *fp)
char * expandHome(const char *path)
expands ~/ ($HOME) or ~USER duplicate and expand path.
void putsUndefinedGF(undefinedt *object)
smallArrayt * readDirDirO(const char *dirPath)
list directories in a directory and sort the list
threadpool tpool_init(int num_threads)
bool listEqCS(char **list1, const char **list2)
const(list2) list Equal String compare each element of list1 and list2
#define dArrayAt(a, index)
get / set element at index
void putsSmallBoolGF(smallBoolt *object)
char ** iListCompactS(char ***list)
remove empty strings from list
bool icEqualCArraySmallJsonG(const char **p1, smallJsont *p2)
sDoublet * allocSDouble(double value)
allocate a small double
char * intToSG(char *retType UNUSED, int64_t n)
call intToS for intToG
bool notEqualInt32OG(int32_t p1 UNUSED, void *p2 UNUSED)
char * listGetS(char **list, int64_t index)
list Get String duplicate string at given index index can be negative
#define isOSmallDict(obj)
test if obj type is smallDictt
bool equalModificationTimesJOO(smallJsont *path1, smallStringt *path2)
bool listIsEmptyS(char **list)
list Is Empty String
const char * getProgPath(void)
get program path When initLibsheepy is called before this function, it returns the given program path...
void finalizeLibsheepyRecycleContainers(void *arg UNUSED)
function called automatically (registered in tpool) when a thread exits This function calls all the r...
time_t getModificationTimeJO(smallJsont *path)
get modification time for path
int moveOSmallJson(smallStringt *src, smallJsont *dst)
bool equalArraySmallArrayG(char **p1, smallArrayt *p2)
char * dupS(const char *string)
duplicate string
bool icEqualOOG(baset *p1, baset *p2)
#define listFreeManyS(...)
bool notEqualCCOG(const char *a UNUSED, void *b UNUSED)
char * toStringFloatGF(float object)
bool equalChaOG(char c, baset *value)
void finalizeRecycleSmallDouble(void *arg UNUSED)
char * toStringSGF(const char *object)
char getS(const char *string, int64_t index)
get string
size_t listLengthCS(const char **list)
const list Length String return number of elements until the first NULL element
char * toStringCharGF(char object)
bool equalBoolDoubleG(bool p1, double p2)
bool equalChaSmallBytesG(char c, smallBytest *value)
void putsSGF(const char *object)
bool equalDoubleChaG(double p1, char p2)
smallJsont * getCwdJO(void)
get current working directory
smallStringt * readO(void)
int print_m_arginfo(const struct printf_info *info UNUSED, size_t n, int *argtypes, int *size)
procress printf argument
bool equalModificationTimesJOS(smallJsont *path1, const char *path2)
char ** readTextStreamG(char ***list, FILE *fp)
bool equalDoubleUint32G(double p1, uint32_t p2)
smallArrayt * readDirAllO(const char *dirPath)
list files in a directory and sort the list
int systemNFreeJOF(smallJsont *command, int line, const char *thisFunc, const char *thisFileName)
bool writeTextStreamG(char **list, FILE *fp)
#define isOSmallBool(obj)
test if obj type is smallBool
int chDirO(smallStringt *path)
bool equalInt32BaseG(int32_t p1, baset *p2)
char * toStringDictGF(smallDictt *object)
bool icListEqCCS(const char **list1, const char **list2)
ignore case const(list1 and 2) list Equal String compare each element of list1 and list2 ...
const char * getRealProgPath(void)
get real program path The first call allocates libSheepyRealProgPath, it is freed with freeRealProgPa...
bool equalBoolSmallBoolG(bool p1, smallBoolt *p2)
bool icEqualChaSmallJsonG(char c, smallJsont *value)
void putsVoidGF(void *object)
#define dArrayAppend(a, v)
append element and expand the dynamic array
bool equalInt32SmallBytesG(int32_t p1, smallBytest *p2)
bool equalDoubleInt32G(double p1, int32_t p2)
int listPrintCG(const char **list)
bool equalUint32Uint64G(uint32_t p1, uint64_t p2)
bool icListEqCG(char **list1, const char **list2)
bool equalInt64BaseG(int64_t p1, baset *p2)
internal void walkADirDir(const char *dirPath, smallArrayt *list)
void finalizeLibsheepyAtExit(void)
free class methods for all classes the objects and classes are not usuable after this an object has t...
void cleanUpBaseFreeG(baset **val)
void putsBoolGF(bool object)
bool equalCharPSmallJsonG(const char *s, smallJsont *value)
bool equalBoolFG(bool p1, bool p2)
int moveSSmallJsonO(const char *src, smallJsont *dst)
void finishManyOF(void *paramType,...)
finish many baset objects
char ** iListUniqG(char ***list, int dum UNUSED)
call iListUniqS for uniqG
void initiateAllocateSmallContainer(smallContainert **self)
bool equalInt32SmallDoubleG(int32_t p1, smallDoublet *p2)
void initiateAllocateSmallBytes(smallBytest **self)
int copySmallJsonO(smallJsont *src, smallStringt *dst)
bool equalUint64Int32G(uint64_t p1, int32_t p2)
char * toStringUint32PGF(uint32_t *object)
bool writeTextCG(const char **list, const char *filePath)
int setModificationTime(const char *path, time_t mtime)
set modification time for path
smallArrayt * walkDirAllSmallStringO(smallStringt *dirPath)
bool appendFileS(const char *filePath, const char *string)
append string to filePath
bool equalUint64SmallStringG(uint64_t p1, smallStringt *p2)
char * toStringUintPGF(uint64_t *object)
bool equalODoubleG(baset *p1, double p2)
int copySSmallJsonO(const char *src, smallJsont *dst)
bool equalOCArrayG(baset *p1, const char **p2)
char getSG(const char *string, int retType UNUSED, int64_t index)
call getS for getG
bool notEqualOG(void *a UNUSED, void *b UNUSED)
void finalizeRecycleSmallBool(void *arg UNUSED)
smallStringt * randomAlphaNumSO(uint64_t length)
bool equalBoolCharG(bool p1, const char *p2)
bool equalOSmallDoubleG(baset *p1, smallDoublet *p2)
sBoolt * allocSBool(bool value)
allocate a small bool
bool equalDoubleBoolG(double p1, bool p2)
int chDirJO(smallJsont *path)
change directory
ssize_t listIndexOfCS(const char **list, const char *string)
return index of string in const list
smallJsont * getProgPathJO(void)
get program path When initLibsheepy is called before this function, it returns the given program path...
smallJsont * randomSmallJsonO(uint64_t length)
random string
int copyO(smallStringt *src, smallStringt *dst)
copy files recursively
bool equalBoolSmallBytesG(bool p1, smallBytest *p2)
#define forEachCharP(list, element)
forEach - loop macro on list indexes to access the element in the loop, use *element ...
bool equalOInt64G(baset *p1, int64_t p2)
smallStringt * allocSmallString(const char *string)
smallJsont * normalizePathJO(smallJsont *path)
normalize path
void readToFileSmallStringNotSupported(void *self UNUSED, smallStringt *path UNUSED)
#define createAllocateSmallString(obj)
char * joinCharCG(const char **list, char delim)
smallStringt * timeToSO(const time_t t)
bool equalOSmallJsonG(baset *p1, smallJsont *p2)
char * toStringBoolPGF(bool *object)
bool icEqualArraySmallJsonG(char **p1, smallJsont *p2)
bool icEqualOSmallStringG(baset *p1, smallStringt *p2)
bool equalModificationTimesOS(smallStringt *path1, const char *path2)
int renameSmallJsonO(smallJsont *src, smallStringt *dst)
rename file
bool listEqC1G(const char **list1, char **list2)
bool equalInt64BoolG(int64_t p1, bool p2)
int systemNFreeOF(smallStringt *command, int line, const char *thisFunc, const char *thisFileName)
char ** readStream(FILE *fp)
return text from stream fp in a list new line characters are removed
bool equalChaUint32G(char c, uint32_t value)
#define sjGet(obj)
get a pointer to the string in the smallJson object
#define equalUint64O(self, p2)
bool equalBoolSmallDoubleG(bool p1, smallDoublet *p2)
void shEPrintfS(const char *fmt,...)
sheepy Error printf String print with logE
void finalizeRecycleSmallString(void *arg UNUSED)
bool equalInt32ChaG(int32_t p1, char p2)
bool equalChaBoolG(char c UNUSED, bool value UNUSED)
void putsBoolPGF(bool *object)
smallArrayt * walkDirDirSmallJsonO(smallJsont *dirPath)
bool equalOSmallBoolG(baset *p1, smallBoolt *p2)
#define freeO(obj)
free buffers in obj
char * listGetCS(const char **list, int64_t index)
const list Get String duplicate string at given index index can be negative
void putsSmallBytesGF(smallBytest *object)
#define enumerateSArray(array, element, index)
void putsIntPGF(int64_t *object)
time_t getModificationTime(const char *path)
get modification time for path
undefinedt * rtUndefinedt
char * toStringArrayGF(smallArrayt *object)
char * listPopG(char ***list, int retType UNUSED)
call listPopS for popG
bool fileExists(const char *filePath)
detect files and directories
smallArrayt * rtSmallArrayt
int cpuCount(void)
return number of online CPUs, also number of threads in the thread pool
void putsSmallDoubleGF(smallDoublet *object)
bool equalUint32BoolG(uint32_t p1, bool p2)
bool notEqualUint64OG(uint64_t p1 UNUSED, void *p2 UNUSED)
#define setTopNFreeStringO(self, value)
bool appendText(const char *filePath, char **list)
append list to filePath
size_t listLengthS(char **list)
list Length String return number of elements until the first NULL element
int moveOS(smallStringt *src, const char *dst)
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 re...
int copySO(const char *src, smallStringt *dst)
bool equalChaUint64G(char c, uint64_t value)
bool equalInt32Int64G(int32_t p1, int64_t p2)
void finalizeSmallString(void)
smallStringt * shDirnameO(smallStringt *path)
int64_t parseInt(const char *string)
convert string to decimal integer
int writeTextCCSmallStringNotSupported(const char **self UNUSED, smallStringt *path UNUSED)
ssize_t fileSize(const char *filePath)
get file size
bool equalCharInt64G(const char *s, int64_t value)
bool equalOUint32G(baset *p1, uint32_t p2)
bool notEqualOCharG(void *a UNUSED, char c UNUSED)
bool equalUint64Uint32G(uint64_t p1, uint32_t p2)
bool icEqualCharOG(const char *s, baset *value)
#define equalDoubleO(self, p2)
smallJsont * rtSmallJsont
bool icEqCharChar(char c, char value)
ignore case equality functions
bool equalInt64Int32G(int64_t p1, int32_t p2)
smallArrayt * walkDirSmallStringO(smallStringt *dirPath)
sArrayt * allocSArray(void)
allocate a small array
bool equalModificationTimesJO(smallJsont *path1, smallJsont *path2)
compare modification times for path1 and path2
void finalizeUndefined(void)
bool equalUint32Int32G(uint32_t p1, int32_t p2)
bool equalOInt32G(baset *p1, int32_t p2)
char ** readTextSG(char ***list, const char *filePath)
call readText (for readFileG)
char * toStringDoublePGF(double *object)
smallStringt * formatO(const char *fmt,...)
format string allocate and format string using asprintf
int chDir(const char *path)
change directory
void putsIntGF(int64_t object)
bool equalInt64SmallBoolG(int64_t p1, smallBoolt *p2)
bool equalBoolChaG(bool p1 UNUSED, char p2 UNUSED)
bool equalBoolSmallIntG(bool p1, smallIntt *p2)
smallStringt * rtSmallStringt
#define createAllocateSmallArray(obj)
bool equalInt64SmallBytesG(int64_t p1, smallBytest *p2)
ssize_t listIndexOfCG(const char **list, const char *string)
int setModificationTimeO(smallStringt *path, time_t mtime)
#define dArrayInit(a)
initialize dynamic array with minimum element count
ssize_t listIndexOfCharCS(const char **list, char c)
#define finishO(obj)
free container only
bool equalCharSmallBytesG(const char *s, smallBytest *value)
#define isOSmallArray(obj)
test if obj type is smallArray
smallArrayt * walkDirSmallJsonO(smallJsont *dirPath)
void initiateAllocateUndefined(undefinedt **self)
void * readStreamToS(FILE *fp)
read file to string
bool notEqualOUint64G(void *p1 UNUSED, uint64_t p2 UNUSED)
#define pError0(func)
print error when function failed.
char * listDequeueG(char ***list, int retType UNUSED)
call listDequeueS for dequeueG
bool equalOSmallArrayG(baset *p1, smallArrayt *p2)
#define setIntO(self, key, value)
#define smashO(obj)
free object and keep data
int moveO(smallStringt *src, smallStringt *dst)
bool equalInt32DoubleG(int32_t p1, double p2)
bool icEqualOArrayG(baset *p1, char **p2)
smallDoubleFunctionst * f
bool equalUint64FG(uint64_t p1, uint64_t p2)
bool listEqCCS(const char **list1, const char **list2)
const(list1 and 2) list Equal String compare each element of list1 and list2
void putsJsonGF(smallJsont *object)
bool icEqualCharPSmallJsonG(const char *s, smallJsont *value)
bool equalArraySmallJsonG(char **p1, smallJsont *p2)
bool writeTextStreamCG(const char **list, FILE *fp)
bool equalInt64SmallIntG(int64_t p1, smallIntt *p2)
bool icEqualCArraySmallArrayG(const char **p1, smallArrayt *p2)
bool equalChaSmallDoubleG(char c, smallDoublet *value)
baset * duplicateBaseG(baset *self)
bool equalInt64CharG(int64_t p1, const char *p2)
void putsUint32PGF(uint32_t *object)
bool equalChaSmallIntG(char c, smallIntt *value)
#define isOSmallString(obj)
test if obj type is smallString