23 #include "../libsheepyObject.h" 28 #define internal static 143 self->type =
"smallInt";
209 #if (recycleContainers) 226 #if (recycleContainers) 297 s = malloc(256*
sizeof(
char));
301 snprintf(s,256,
"%" PRIi64, self->value->value);
326 #if (NFreeStackCheck) 329 register u64 rsp
asm(
"rsp");
330 if ((
u64)*
self > rsp) {
331 logW(
"Probably trying to free a smallInt on stack: "BLD PRIx64
RST" sp: "BLD PRIx64
RST, *
self, rsp);
335 #if (recycleContainers) 349 #if (recycleContainers) 371 return(self->value->value);
380 self->value->value =
value;
391 self->value->value = (int64_t)p2;
402 self->value->value = (int64_t)p2;
413 self->value->value = (int64_t)p2;
424 self->value->value = (int64_t)p2;
435 self->value->value = (int64_t)p2;
461 value = p2->
f->get(p2);
467 self->value->value = (int64_t)value;
482 self->value->value = (int64_t)p2->
f->get(p2);
497 self->value->value = p2->
f->get(p2);
510 if (!type ||
eqS(type,
"undefined") ||
eqS(type,
"dict") ||
eqS(type,
"array")) {
514 if (
eqS(type,
"bool")) {
517 else if (
eqS(type,
"double")) {
520 else if (
eqS(type,
"int")) {
523 else if (
eqS(type,
"string")) {
549 return(&(self->value->value));
566 return(self->value->value == value);;
571 if (!self->value || !p2) {
581 return(self->value->value == value);;
586 if (!self->value || !p2) {
600 if (self->value->value == value) {
616 return(self->value->value == p2);;
625 return(self->value->value == p2);;
634 return(self->value->value == p2);;
643 return(self->value->value == p2);;
652 return(self->value->value == p2);;
661 return((uint64_t)self->value->value == p2);;
666 if (!self->value || !p2 || !p2->
value) {
670 return(self->value->value == p2->
value->
value);;
675 if (!self->value || !p2 || !p2->
B) {
699 return(p2Value == self->value->value);;
704 if (!self->value || !p2 || !p2->
value) {
708 return(self->value->value == p2->
value->
value);;
713 if (!self->value || !p2 || !p2->
value) {
717 return(self->value->value == p2->
value->
value);;
731 return(p2->
f->equalSmallInt(p2,
self));
736 if (!self->value || !p2 || !p2->
data) {
746 return(self->value->value == value);;
754 if (!filePath ||
isBlankS(filePath)) {
762 f = fopen(filePath,
"r");
765 shEPrintfS(
"The path was: \"%s\"\n", filePath);
768 readStatus = fread(&self->value->value, 1,
sizeof(int64_t) , f);
771 if (readStatus !=
sizeof(int64_t)) {
773 shEPrintfS(
"The path was: \"%s\"\n", filePath);
792 if (!
eqS(type,
"string")) {
824 readStatus = fread(&self->value->value, 1,
sizeof(int64_t) , fp);
826 if (readStatus !=
sizeof(int64_t)) {
839 if (!filePath ||
isBlankS(filePath) || !self->value) {
843 f = fopen(filePath,
"w");
846 shEPrintfS(
"The path was: \"%s\"\n", filePath);
849 writeStatus = fwrite(&self->value->value, 1,
sizeof(int64_t) , f);
852 if (writeStatus !=
sizeof(int64_t)) {
854 shEPrintfS(
"The path was: \"%s\"\n", filePath);
873 if (!
eqS(type,
"string")) {
897 if (!fp || !self->value) {
901 writeStatus = fwrite(&self->value->value, 1,
sizeof(int64_t) , fp);
903 if (writeStatus !=
sizeof(int64_t)) {
916 if (!filePath ||
isBlankS(filePath) || !self->value) {
920 f = fopen(filePath,
"a");
923 shEPrintfS(
"The path was: \"%s\"\n", filePath);
926 writeStatus = fwrite(&self->value->value, 1,
sizeof(int64_t) , f);
929 if (writeStatus !=
sizeof(int64_t)) {
931 shEPrintfS(
"The path was: \"%s\"\n", filePath);
948 return(self->f->duplicate(
self));
955 return(self->f->get(
self));
960 return(self->f->getP(
self));
965 return((int32_t)self->f->get(
self));
970 return((int32_t*)self->f->getP(
self));
975 return((uint64_t)self->f->get(
self));
980 return((uint64_t*)self->f->getP(
self));
985 return((uint32_t)self->f->get(
self));
990 return((uint32_t*)self->f->getP(
self));
995 return(self->f->setBool(
self, p2));
1000 return(self->f->setDouble(
self, p2));
1005 return(self->f->setInt32(
self, p2));
1010 return(self->f->setUint32(
self, p2));
1015 return(self->f->setUint64(
self, p2));
1020 return(self->f->setS(
self, p2));
1025 return(self->f->setSmallBool(
self, p2));
1030 return(self->f->setSmallDouble(
self, p2));
1035 return(self->f->setSmallInt(
self, p2));
1040 return(self->f->setSmallJson(
self, p2));
1045 return(self->f->setSmallString(
self, p2));
1051 return(self->f->equalCha(
self, p2));
1056 return(self->f->equalChar(
self, p2));
1061 return(self->f->equalBase(
self, p2));
1066 return(self->f->equalBool(
self, p2));
1071 return(self->f->equalDouble(
self, p2));
1076 return(self->f->equalInt64(
self, p2));
1081 return(self->f->equalInt32(
self, p2));
1086 return(self->f->equalUint32(
self, p2));
1091 return(self->f->equalUint64(
self, p2));
1096 return(self->f->equalSmallBool(
self, p2));
1101 return(self->f->equalSmallBytes(
self, p2));
1106 return(self->f->equalSmallDouble(
self, p2));
1111 return(self->f->equal(
self, p2));
1116 return(self->f->equalSmallJson(
self, p2));
1121 return(self->f->equalSmallString(
self, p2));
1126 return(self->f->readFile(
self, filePath));
1131 return(self->f->readFileSmallJson(
self,filePath));
1136 return(self->f->readFileSmallString(
self,filePath));
1141 return(self->f->readStream(
self, fp));
1146 return(self->f->writeFile(
self, filePath));
1151 return(self->f->writeFileSmallJson(
self,filePath));
1156 return(self->f->writeFileSmallString(
self,filePath));
1161 return(self->f->writeStream(
self, fp));
1166 return(self->f->appendFile(
self, filePath));
1171 return(self->f->appendFileSmallString(
self,filePath));
void cleanUpSmallIntTerminateG(smallIntt **val)
#define getTopDoubleO(self)
smallIntt * allocSmallInt(int64_t value)
#define getTopBoolO(self)
bool eqS(const char *string1, const char *string2)
string Equal compare string1 to string2
bool isBlankS(const char *string)
is Blank String
internal smallIntt * duplicateSmallInt(smallIntt *self)
bool equalSmallIntInt64G(smallIntt *self, int64_t p2)
void finalizeRecycleSmallInt(void *arg UNUSED)
#define ssGet(obj)
get a pointer to the string in the smallString object
smallIntt * setSmallBoolSmallIntG(smallIntt *self, smallBoolt *p2)
#define rangeDown(index, maxCount)
range down loop, index is ssize_t
sIntt * allocSInt(int64_t value)
allocate a small int
internal bool equalSmallIntBase(smallIntt *self, baset *p2)
bool equalSmallIntSmallJsonG(smallIntt *self, smallJsont *p2)
#define RST
reset for color function
internal int64_t getSmallInt(smallIntt *self)
void cleanUpSmallIntFreeLocalG(smallIntt *val)
bool equalSmallIntBaseG(smallIntt *self, baset *p2)
internal int64_t * getPSmallInt(smallIntt *self)
internal const char * helpSmallInt(smallIntt UNUSED *self)
internal int writeFileSmallJsonSmallInt(smallIntt *self, smallJsont *filePath)
smallIntt * readFileSmallStringSmallIntG(smallIntt *self, smallStringt *filePath)
bool equalSmallIntFG(smallIntt *self, smallIntt *p2)
internal int appendFileSmallInt(smallIntt *self, const char *filePath)
#define pFuncError
print function name and system error
internal int writeFileSmallStringSmallInt(smallIntt *self, smallStringt *filePath)
int appendFileSmallIntFG(smallIntt *self, const char *filePath)
int writeStreamSmallIntG(smallIntt *self, FILE *fp)
void initiateSmallInt(smallIntt *self)
void finalizeSmallInt(void)
terminateSmallIntFt terminate
uint32_t * getUint32PSmallIntG(smallIntt *self, uint32_t *retType UNUSED, int64_t index UNUSED)
bool equalSmallIntCharG(smallIntt *self, const char *p2)
internal smallIntt * setSmallBoolSmallInt(smallIntt *self, smallBoolt *p2)
#define isError(assigned, left)
is Assigment Error catch error when assigned is false, 0 or NULL after being assigned with left ...
internal bool equalSmallIntInt32(smallIntt *self, int32_t p2)
internal int writeFileSmallInt(smallIntt *self, const char *filePath)
internal bool equalSmallIntSmallString(smallIntt *self, smallStringt *p2)
internal void terminateSmallInt(smallIntt **self)
uint32_t getUint32SmallIntG(smallIntt *self, uint32_t retType UNUSED, int64_t index UNUSED)
internal smallIntt * setSSmallInt(smallIntt *self, const char *p2)
bool equalSmallIntUint64G(smallIntt *self, uint64_t p2)
internal bool equalSmallInt(smallIntt *self, smallIntt *p2)
#define getTopTypeO(self)
void cleanUpSmallIntFinishG(smallIntt **val)
#define isOSmallJson(obj)
test if obj type is smallJson
void initiateAllocateSmallInt(smallIntt **self)
internal smallIntt * setUint64SmallInt(smallIntt *self, uint64_t p2)
internal smallIntt * readFileSmallJsonSmallInt(smallIntt *self, smallJsont *filePath)
internal smallIntt * setSmallIntSmallInt(smallIntt *self, smallIntt *p2)
int64_t getIntSmallIntG(smallIntt *self, int64_t retType UNUSED, int64_t index UNUSED)
internal bool equalSmallIntSmallBool(smallIntt *self, smallBoolt *p2)
bool equalSmallIntSmallDoubleG(smallIntt *self, smallDoublet *p2)
internal bool equalSmallIntUint64(smallIntt *self, uint64_t p2)
#define terminateO(obj)
free buffers and obj itself
internal smallIntt * setBoolSmallInt(smallIntt *self, bool p2)
internal smallIntt * readStreamSmallInt(smallIntt *self, FILE *fp)
bool equalSmallIntBoolG(smallIntt *self, bool p2)
smallIntt * setSmallJsonSmallIntG(smallIntt *self, smallJsont *p2)
smallIntt * setSmallDoubleSmallIntG(smallIntt *self, smallDoublet *p2)
smallIntt * readStreamSmallIntG(smallIntt *self, FILE *fp)
internal smallIntt * setInt32SmallInt(smallIntt *self, int32_t p2)
void freeSmallIntG(smallIntt *self)
smallIntt * setSSmallIntG(smallIntt *self, const char *p2)
internal smallIntt * setDoubleSmallInt(smallIntt *self, double p2)
int writeFileSmallIntG(smallIntt *self, const char *filePath)
int64_t * getIntPSmallIntG(smallIntt *self, int64_t *retType UNUSED, int64_t index UNUSED)
internal bool equalSmallIntUint32(smallIntt *self, uint32_t p2)
#define toStringO(obj)
convert data in obj to string
bool isNumber(const char *string)
is Number (integer or float) String
internal bool equalSmallIntBool(smallIntt *self, bool p2)
int appendFileSmallStringSmallIntG(smallIntt *self, smallStringt *filePath)
internal smallIntt * setSmallStringSmallInt(smallIntt *self, smallStringt *p2)
smallIntt * setUint32SmallIntG(smallIntt *self, uint32_t p2)
internal bool equalSmallIntCha(smallIntt *self, char p2)
internal int writeStreamSmallInt(smallIntt *self, FILE *fp)
bool equalSmallIntSmallBoolG(smallIntt *self, smallBoolt *p2)
bool isInt(const char *string)
is Integer String
smallIntt * setBoolSmallIntG(smallIntt *self, bool p2)
int writeFileSmallJsonSmallIntG(smallIntt *self, smallJsont *filePath)
bool equalSmallIntInt32G(smallIntt *self, int32_t p2)
internal smallIntt * setSmallInt(smallIntt *self, int64_t value)
internal bool equalSmallIntSmallBytes(smallIntt *self, smallBytest *p2)
void * sBytesGet(sBytest *bytes)
get buffer in small bytes
void cleanUpSmallIntFreeG(smallIntt **val)
smallIntt * setSmallIntSmallIntG(smallIntt *self, smallIntt *p2)
#define BLD
bold for color function
internal char * toStringSmallInt(smallIntt *self)
internal smallIntt * readFileSmallInt(smallIntt *self, const char *filePath)
int32_t getInt32SmallIntG(smallIntt *self, int32_t retType UNUSED, int64_t index UNUSED)
internal void smashSmallInt(smallIntt **self)
internal smallIntt * setSmallJsonSmallInt(smallIntt *self, smallJsont *p2)
bool equalSmallIntSmallBytesG(smallIntt *self, smallBytest *p2)
internal bool equalSmallIntChar(smallIntt *self, const char *p2)
internal smallIntt * setSmallDoubleSmallInt(smallIntt *self, smallDoublet *p2)
smallIntt * setSmallStringSmallIntG(smallIntt *self, smallStringt *p2)
internal void freeSmallInt(smallIntt *self)
bool equalSmallIntUint32G(smallIntt *self, uint32_t p2)
toStringSmallIntFt toString
smallIntt * setUint64SmallIntG(smallIntt *self, uint64_t p2)
bool equalSmallIntDoubleG(smallIntt *self, double p2)
bool equalSmallIntSmallStringG(smallIntt *self, smallStringt *p2)
smallIntt * setDoubleSmallIntG(smallIntt *self, double p2)
int32_t * getInt32PSmallIntG(smallIntt *self, int32_t *retType UNUSED, int64_t index UNUSED)
internal bool equalSmallIntDouble(smallIntt *self, double p2)
uint64_t * getUintPSmallIntG(smallIntt *self, uint64_t *retType UNUSED, int64_t index UNUSED)
#define createAllocateSmallInt(obj)
uint64_t getUintSmallIntG(smallIntt *self, uint64_t retType UNUSED, int64_t index UNUSED)
smallIntt * duplicateSmallIntG(smallIntt *self)
void shEPrintfS(const char *fmt,...)
sheepy Error printf String print with logE
#define freeO(obj)
free buffers in obj
internal bool equalSmallIntSmallJson(smallIntt *self, smallJsont *p2)
internal bool equalSmallIntSmallDouble(smallIntt *self, smallDoublet *p2)
internal void finishSmallInt(smallIntt **self)
internal smallIntt * setUint32SmallInt(smallIntt *self, uint32_t p2)
int writeFileSmallStringSmallIntG(smallIntt *self, smallStringt *filePath)
void registerMethodsSmallInt(smallIntFunctionst *f)
smallIntt * readFileSmallIntG(smallIntt *self, const char *filePath)
bool equalSmallIntChaG(smallIntt *self, char p2)
int64_t parseInt(const char *string)
convert string to decimal integer
smallIntt * readFileSmallJsonSmallIntG(smallIntt *self, smallJsont *filePath)
smallIntt * setInt32SmallIntG(smallIntt *self, int32_t p2)
#define finishO(obj)
free container only
#define helpTextSmallInt
help text for this class It is public declaration so that child classes can add their help text easil...
smallDoubleFunctionst * f
internal smallIntt * readFileSmallStringSmallInt(smallIntt *self, smallStringt *filePath)
internal int appendFileSmallStringSmallInt(smallIntt *self, smallStringt *filePath)
internal bool equalSmallIntInt64(smallIntt *self, int64_t p2)
duplicateSmallIntFt duplicate
#define isOSmallString(obj)
test if obj type is smallString