/* initialise the C library */ void CLibraryInit() { /* define some constants */ VariableDefinePlatformVar(NULL, "NULL", &IntType, (union AnyValue *)&ZeroValue, FALSE); VariableDefinePlatformVar(NULL, "TRUE", &IntType, (union AnyValue *)&TRUEValue, FALSE); VariableDefinePlatformVar(NULL, "FALSE", &IntType, (union AnyValue *)&ZeroValue, FALSE); }
/* global initialisation for libraries */ void LibraryInit(Picoc *pc) { /* define the version number macro */ pc->VersionString = TableStrRegister(pc, PICOC_VERSION); VariableDefinePlatformVar(pc, NULL, "PICOC_VERSION", pc->CharPtrType, (union AnyValue *)&pc->VersionString, FALSE); /* define endian-ness macros */ BigEndian = ((*(char*)&__ENDIAN_CHECK__) == 0); LittleEndian = ((*(char*)&__ENDIAN_CHECK__) == 1); VariableDefinePlatformVar(pc, NULL, "BIG_ENDIAN", &pc->IntType, (union AnyValue *)&BigEndian, FALSE); VariableDefinePlatformVar(pc, NULL, "LITTLE_ENDIAN", &pc->IntType, (union AnyValue *)&LittleEndian, FALSE); }
/* creates various system-dependent definitions */ void UnistdSetupFunc(void) { /* define NULL */ if (!VariableDefined(TableStrRegister("NULL"))) VariableDefinePlatformVar(NULL, "NULL", &IntType, (union AnyValue *)&ZeroValue, FALSE); /* define optarg and friends */ VariableDefinePlatformVar(NULL, "optarg", CharPtrType, (union AnyValue *)&optarg, TRUE); VariableDefinePlatformVar(NULL, "optind", &IntType, (union AnyValue *)&optind, TRUE); VariableDefinePlatformVar(NULL, "opterr", &IntType, (union AnyValue *)&opterr, TRUE); VariableDefinePlatformVar(NULL, "optopt", &IntType, (union AnyValue *)&optopt, TRUE); }
/* creates various system-dependent definitions */ void StdTimeSetupFunc(void) { /* make a "struct tm" which is the same size as a native tm structure */ TypeCreateOpaqueStruct(NULL, TableStrRegister("tm"), sizeof(struct tm)); /* define CLK_PER_SEC etc. */ VariableDefinePlatformVar(NULL, "CLOCKS_PER_SEC", &IntType, (union AnyValue *)&CLOCKS_PER_SECValue, FALSE); #ifdef CLK_PER_SEC VariableDefinePlatformVar(NULL, "CLK_PER_SEC", &IntType, (union AnyValue *)&CLK_PER_SECValue, FALSE); #endif #ifdef CLK_TCK VariableDefinePlatformVar(NULL, "CLK_TCK", &IntType, (union AnyValue *)&CLK_TCKValue, FALSE); #endif }
/* define a variable. Ident must be registered. If it's a redefinition from the same declaration don't throw an error */ struct Value *VariableDefineButIgnoreIdentical(struct ParseState *Parser, char *Ident, struct ValueType *Typ, int IsStatic, int *FirstVisit) { struct Value *ExistingValue; const char *DeclFileName; int DeclLine; int DeclColumn; if (IsStatic) { char MangledName[LINEBUFFER_MAX]; char *MNPos = &MangledName[0]; char *MNEnd = &MangledName[LINEBUFFER_MAX-1]; const char *RegisteredMangledName; /* make the mangled static name (avoiding using sprintf() to minimise library impact) */ memset((void *)&MangledName, '\0', sizeof(MangledName)); *MNPos++ = '/'; strncpy(MNPos, (char *)Parser->FileName, MNEnd - MNPos); MNPos += strlen(MNPos); if (TopStackFrame != NULL) { /* we're inside a function */ if (MNEnd - MNPos > 0) *MNPos++ = '/'; strncpy(MNPos, (char *)TopStackFrame->FuncName, MNEnd - MNPos); MNPos += strlen(MNPos); } if (MNEnd - MNPos > 0) *MNPos++ = '/'; strncpy(MNPos, Ident, MNEnd - MNPos); RegisteredMangledName = TableStrRegister(MangledName); /* is this static already defined? */ if (!TableGet(&GlobalTable, RegisteredMangledName, &ExistingValue, &DeclFileName, &DeclLine, &DeclColumn)) { /* define the mangled-named static variable store in the global scope */ ExistingValue = VariableAllocValueFromType(Parser, Typ, TRUE, NULL, TRUE); TableSet(&GlobalTable, (char *)RegisteredMangledName, ExistingValue, (char *)Parser->FileName, Parser->Line, Parser->CharacterPos); *FirstVisit = TRUE; } /* static variable exists in the global scope - now make a mirroring variable in our own scope with the short name */ VariableDefinePlatformVar(Parser, Ident, ExistingValue->Typ, ExistingValue->Val, TRUE); return ExistingValue; } else { if (Parser->Line != 0 && TableGet((TopStackFrame == NULL) ? &GlobalTable : &TopStackFrame->LocalTable, Ident, &ExistingValue, &DeclFileName, &DeclLine, &DeclColumn) && DeclFileName == Parser->FileName && DeclLine == Parser->Line && DeclColumn == Parser->CharacterPos) return ExistingValue; else return VariableDefine(Parser, Ident, NULL, Typ, TRUE); } }
void LibraryAddConstants(Picoc* pc, LibraryConstant* CstList) { for (int Count = 0; CstList[Count].CstValue != NULL; Count++) { switch (CstList[Count].Type) { case TypeInt: VariableDefinePlatformVar(pc, NULL, CstList[Count].Name, &pc->IntType, CstList[Count].CstValue, FALSE); break; case TypeFP: VariableDefinePlatformVar(pc, NULL, CstList[Count].Name, &pc->FPType, CstList[Count].CstValue, FALSE); break; default: ProgramFailNoParser(pc, "invalid type in LibrairyAdd"); break; } } }
/** * creates various system-dependent definitions * * We retain values like stdout, stdin and stderr in this * function to avoid having to invent "FilePtrType" for * rotables. */ void StdioSetupFunc(void) { struct ValueType *StructFileType; struct ValueType *FilePtrType; /* make a "struct __FILEStruct" which is the same size as a native FILE structure */ StructFileType = TypeCreateOpaqueStruct(NULL, TableStrRegister("__FILEStruct"), sizeof(FILE)); /* get a FILE * type */ FilePtrType = TypeGetMatching(NULL, StructFileType, TypePointer, 0, StrEmpty, TRUE); /* make a "struct __va_listStruct" which is the same size as our struct StdVararg */ TypeCreateOpaqueStruct(NULL, TableStrRegister("__va_listStruct"), sizeof(FILE)); /* define stdin, stdout and stderr */ VariableDefinePlatformVar(NULL, "stdin", FilePtrType, (union AnyValue *)&stdinValue, FALSE); VariableDefinePlatformVar(NULL, "stdout", FilePtrType, (union AnyValue *)&stdoutValue, FALSE); VariableDefinePlatformVar(NULL, "stderr", FilePtrType, (union AnyValue *)&stderrValue, FALSE); /* define NULL, TRUE and FALSE */ if (!VariableDefined(TableStrRegister("NULL"))) VariableDefinePlatformVar(NULL, "NULL", &IntType, (union AnyValue *)&ZeroValue, FALSE); }
void PicocCallMain(Picoc *pc, int argc, char **argv) { /* check if the program wants arguments */ struct Value *FuncValue = NULL; if (!VariableDefined(pc, TableStrRegister(pc, "main"))) ProgramFailNoParser(pc, "main() is not defined"); VariableGet(pc, NULL, TableStrRegister(pc, "main"), &FuncValue); if (FuncValue->Typ->Base != TypeFunction) ProgramFailNoParser(pc, "main is not a function - can't call it"); if (FuncValue->Val->FuncDef.NumParams != 0) { /* define the arguments */ VariableDefinePlatformVar(pc, NULL, "__argc", &pc->IntType, (union AnyValue *)&argc, FALSE); VariableDefinePlatformVar(pc, NULL, "__argv", pc->CharPtrPtrType, (union AnyValue *)&argv, FALSE); } if (FuncValue->Val->FuncDef.ReturnType == &pc->VoidType) { if (FuncValue->Val->FuncDef.NumParams == 0) PicocParse(pc, "startup", CALL_MAIN_NO_ARGS_RETURN_VOID, strlen(CALL_MAIN_NO_ARGS_RETURN_VOID), TRUE, TRUE, FALSE, TRUE); else PicocParse(pc, "startup", CALL_MAIN_WITH_ARGS_RETURN_VOID, strlen(CALL_MAIN_WITH_ARGS_RETURN_VOID), TRUE, TRUE, FALSE, TRUE); } else { VariableDefinePlatformVar(pc, NULL, "__exit_value", &pc->IntType, (union AnyValue *)&pc->PicocExitValue, TRUE); if (FuncValue->Val->FuncDef.NumParams == 0) PicocParse(pc, "startup", CALL_MAIN_NO_ARGS_RETURN_INT, strlen(CALL_MAIN_NO_ARGS_RETURN_INT), TRUE, TRUE, FALSE, TRUE); else PicocParse(pc, "startup", CALL_MAIN_WITH_ARGS_RETURN_INT, strlen(CALL_MAIN_WITH_ARGS_RETURN_INT), TRUE, TRUE, FALSE, TRUE); } }
void PicocCallMain(int argc, char **argv) { /* check if the program wants arguments */ struct Value *FuncValue = NULL; if (!VariableDefined(TableStrRegister("main"))) ProgramFail(NULL, "main() no esta definido"); VariableGet(NULL, TableStrRegister("main"), &FuncValue); if (FuncValue->Typ->Base != TypeFunction) ProgramFail(NULL, "main no es una funcion - no puedo llamarla"); if (FuncValue->Val->FuncDef.NumParams != 0) { /* define the arguments */ VariableDefinePlatformVar(NULL, "__argc", &IntType, (union AnyValue *)&argc, FALSE); VariableDefinePlatformVar(NULL, "__argv", CharPtrPtrType, (union AnyValue *)&argv, FALSE); } if (FuncValue->Val->FuncDef.ReturnType == &VoidType) { if (FuncValue->Val->FuncDef.NumParams == 0) PicocParse("startup", CALL_MAIN_NO_ARGS_RETURN_VOID, strlen(CALL_MAIN_NO_ARGS_RETURN_VOID), TRUE, TRUE, FALSE); else PicocParse("startup", CALL_MAIN_WITH_ARGS_RETURN_VOID, strlen(CALL_MAIN_WITH_ARGS_RETURN_VOID), TRUE, TRUE, FALSE); } else { VariableDefinePlatformVar(NULL, "__exit_value", &IntType, (union AnyValue *)&PicocExitValue, TRUE); if (FuncValue->Val->FuncDef.NumParams == 0) PicocParse("startup", CALL_MAIN_NO_ARGS_RETURN_INT, strlen(CALL_MAIN_NO_ARGS_RETURN_INT), TRUE, TRUE, FALSE); else PicocParse("startup", CALL_MAIN_WITH_ARGS_RETURN_INT, strlen(CALL_MAIN_WITH_ARGS_RETURN_INT), TRUE, TRUE, FALSE); } }
/* creates various system-dependent definitions */ void StdioSetupFunc(void) { struct LibraryFunction *plib; plib = &StdioFunctions; plib[ 0].Func = StdioSprintf ; plib[ 1].Func = StdioPuts ; plib[ 2].Func = StdioGets ; plib[ 3].Func = StdioCls ; plib[ 4].Func = StdioFopen ; plib[ 5].Func = StdioFreopen ; plib[ 6].Func = StdioFclose ; plib[ 7].Func = StdioFread ; plib[ 8].Func = StdioFwrite ; plib[ 9].Func = StdioFgetc ; plib[10].Func = StdioFgetc ; plib[11].Func = StdioFgets ; plib[12].Func = StdioFputc ; plib[13].Func = StdioFputs ; plib[14].Func = StdioFeof ; plib[15].Func = StdioFtell ; plib[16].Func = StdioFseek ; plib[17].Func = StdioPrintf ; struct ValueType *StructFileType; struct ValueType *FilePtrType; /* make a "struct __FILEStruct" which is the same size as a native FILE structure */ StructFileType = TypeCreateOpaqueStruct(NULL, TableStrRegister("__FILEStruct"), sizeof(FILE)); /* get a FILE * type */ FilePtrType = TypeGetMatching(NULL, StructFileType, TypePointer, 0, StrEmpty, TRUE); /* make a "struct __va_listStruct" which is the same size as our struct StdVararg */ TypeCreateOpaqueStruct(NULL, TableStrRegister("__va_listStruct"), sizeof(FILE)); /* define EOF equal to the system EOF */ VariableDefinePlatformVar(NULL, "EOF", &IntType, (union AnyValue *)&EOFValue, FALSE); VariableDefinePlatformVar(NULL, "SEEK_SET", &IntType, (union AnyValue *)&SEEK_SETValue, FALSE); VariableDefinePlatformVar(NULL, "SEEK_CUR", &IntType, (union AnyValue *)&SEEK_CURValue, FALSE); VariableDefinePlatformVar(NULL, "SEEK_END", &IntType, (union AnyValue *)&SEEK_ENDValue, FALSE); VariableDefinePlatformVar(NULL, "BUFSIZ", &IntType, (union AnyValue *)&BUFSIZValue, FALSE); VariableDefinePlatformVar(NULL, "FILENAME_MAX", &IntType, (union AnyValue *)&FILENAME_MAXValue, FALSE); /* define NULL*/ if (!VariableDefined(TableStrRegister("NULL"))) VariableDefinePlatformVar(NULL, "NULL", &IntType, (union AnyValue *)&ZeroValue, FALSE); }
// call this right before running the script void script_define_param_variables() { //int j = 0; for (unsigned int i = 0; i < SCRIPT_NUM_PARAMS; i++) { short p = script_param_order[i]; if (!p) continue; p--; //int* v = &conf_script_vars[p]; int _varname = 'a' + p; char* varname = (char*)&_varname; #ifdef CONFIG_PICOC extern struct ValueType IntType; VariableDefinePlatformVar(NULL, varname, &IntType, (union AnyValue *)&conf_script_vars[p], FALSE); #endif console_printf(" Param %s = %d; // %s\n", varname, conf_script_vars[p], script_params[p]); } }
/* creates various system-dependent definitions */ void StringSetupFunc(void) { /* define NULL */ if (!VariableDefined(TableStrRegister("NULL"))) VariableDefinePlatformVar(NULL, "NULL", &IntType, (union AnyValue *)&ZeroValue, FALSE); }
void SRV1SetupFunc() { IntArrayType = TypeGetMatching(NULL, &IntType, TypeArray, 16, StrEmpty, TRUE); VariableDefinePlatformVar(NULL, "scanvect", IntArrayType, (union AnyValue *)&ScanVect, FALSE); VariableDefinePlatformVar(NULL, "neuron", IntArrayType, (union AnyValue *)&NNVect, FALSE); VariableDefinePlatformVar(NULL, "blobcnt", &IntType, (union AnyValue *)&Blobcnt, FALSE); VariableDefinePlatformVar(NULL, "blobx1", &IntType, (union AnyValue *)&Blobx1, FALSE); VariableDefinePlatformVar(NULL, "blobx2", &IntType, (union AnyValue *)&Blobx2, FALSE); VariableDefinePlatformVar(NULL, "bloby1", &IntType, (union AnyValue *)&Bloby1, FALSE); VariableDefinePlatformVar(NULL, "bloby2", &IntType, (union AnyValue *)&Bloby2, FALSE); VariableDefinePlatformVar(NULL, "lcount", &IntType, (union AnyValue *)&Elcount, FALSE); VariableDefinePlatformVar(NULL, "rcount", &IntType, (union AnyValue *)&Ercount, FALSE); VariableDefinePlatformVar(NULL, "y1", &IntType, (union AnyValue *)&Iy1, FALSE); VariableDefinePlatformVar(NULL, "y2", &IntType, (union AnyValue *)&Iy2, FALSE); VariableDefinePlatformVar(NULL, "u1", &IntType, (union AnyValue *)&Iu1, FALSE); VariableDefinePlatformVar(NULL, "u2", &IntType, (union AnyValue *)&Iu2, FALSE); VariableDefinePlatformVar(NULL, "v1", &IntType, (union AnyValue *)&Iv1, FALSE); VariableDefinePlatformVar(NULL, "v2", &IntType, (union AnyValue *)&Iv2, FALSE); VariableDefinePlatformVar(NULL, "gpslat", &IntType, (union AnyValue *)&GPSlat, FALSE); VariableDefinePlatformVar(NULL, "gpslon", &IntType, (union AnyValue *)&GPSlon, FALSE); VariableDefinePlatformVar(NULL, "gpsalt", &IntType, (union AnyValue *)&GPSalt, FALSE); VariableDefinePlatformVar(NULL, "gpsfix", &IntType, (union AnyValue *)&GPSfix, FALSE); VariableDefinePlatformVar(NULL, "gpssat", &IntType, (union AnyValue *)&GPSsat, FALSE); VariableDefinePlatformVar(NULL, "gpsutc", &IntType, (union AnyValue *)&GPSutc, FALSE); }
/* creates various system-dependent definitions */ void StdioSetupFunc(Picoc *pc) { struct ValueType *StructFileType; struct ValueType *FilePtrType; /* make a "struct __FILEStruct" which is the same size as a native FILE structure */ StructFileType = TypeCreateOpaqueStruct(pc, NULL, TableStrRegister(pc, "__FILEStruct"), sizeof(FILE)); /* get a FILE * type */ FilePtrType = TypeGetMatching(pc, NULL, StructFileType, TypePointer, 0, pc->StrEmpty, TRUE); /* make a "struct __va_listStruct" which is the same size as our struct StdVararg */ TypeCreateOpaqueStruct(pc, NULL, TableStrRegister(pc, "__va_listStruct"), sizeof(FILE)); /* define EOF equal to the system EOF */ VariableDefinePlatformVar(pc, NULL, "EOF", &pc->IntType, (union AnyValue *)&EOFValue, FALSE); VariableDefinePlatformVar(pc, NULL, "SEEK_SET", &pc->IntType, (union AnyValue *)&SEEK_SETValue, FALSE); VariableDefinePlatformVar(pc, NULL, "SEEK_CUR", &pc->IntType, (union AnyValue *)&SEEK_CURValue, FALSE); VariableDefinePlatformVar(pc, NULL, "SEEK_END", &pc->IntType, (union AnyValue *)&SEEK_ENDValue, FALSE); VariableDefinePlatformVar(pc, NULL, "BUFSIZ", &pc->IntType, (union AnyValue *)&BUFSIZValue, FALSE); VariableDefinePlatformVar(pc, NULL, "FILENAME_MAX", &pc->IntType, (union AnyValue *)&FILENAME_MAXValue, FALSE); VariableDefinePlatformVar(pc, NULL, "_IOFBF", &pc->IntType, (union AnyValue *)&_IOFBFValue, FALSE); VariableDefinePlatformVar(pc, NULL, "_IOLBF", &pc->IntType, (union AnyValue *)&_IOLBFValue, FALSE); VariableDefinePlatformVar(pc, NULL, "_IONBF", &pc->IntType, (union AnyValue *)&_IONBFValue, FALSE); VariableDefinePlatformVar(pc, NULL, "L_tmpnam", &pc->IntType, (union AnyValue *)&L_tmpnamValue, FALSE); VariableDefinePlatformVar(pc, NULL, "GETS_MAX", &pc->IntType, (union AnyValue *)&GETS_MAXValue, FALSE); /* define stdin, stdout and stderr */ VariableDefinePlatformVar(pc, NULL, "stdin", FilePtrType, (union AnyValue *)&stdinValue, FALSE); VariableDefinePlatformVar(pc, NULL, "stdout", FilePtrType, (union AnyValue *)&stdoutValue, FALSE); VariableDefinePlatformVar(pc, NULL, "stderr", FilePtrType, (union AnyValue *)&stderrValue, FALSE); /* define NULL, TRUE and FALSE */ if (!VariableDefined(pc, TableStrRegister(pc, "NULL"))) VariableDefinePlatformVar(pc, NULL, "NULL", &pc->IntType, (union AnyValue *)&Stdio_ZeroValue, FALSE); }
void Initjl777vars() { const char *definition = "\ #define TRADEBOT_PRICECHANGE 1\n\ #define TRADEBOT_NEWMINUTE 2\n\ \ #define BARI_FIRSTBID 0\n\ #define BARI_FIRSTASK 1\n\ #define BARI_LOWBID 2\n\ #define BARI_HIGHASK 3\n\ #define BARI_HIGHBID 4\n\ #define BARI_LOWASK 5\n\ #define BARI_LASTBID 6\n\ #define BARI_LASTASK 7\n\ \ #define BARI_ARBBID 8\n\ #define BARI_ARBASK 9\n\ #define BARI_MINBID 10\n\ #define BARI_MAXASK 11\n\ #define BARI_VIRTBID 10\n\ #define BARI_VIRTASK 11\n\ #define BARI_AVEBID 12\n\ #define BARI_AVEASK 13\n\ #define BARI_MEDIAN 14\n\ #define BARI_AVEPRICE 15\n\ \ #define Bid(i) ((double *)pBids)[i]\n\ #define Ask(i) ((double *)pAsks)[i]\n\ #define Bidvol(i) ((double *)pBidvols)[i]\n\ #define Askvol(i) ((double *)pAskvols)[i]\n\ #define Bidid(i) ((unsigned long *)pBidnxt)[i]\n\ #define Askid(i) ((unsigned long *)pAsknxt)[i]\n\ #define M1(i,bari) ((float *)pM1)[((i) << 4) + (bari)]\n\ #define M2(i,bari) ((float *)pM2)[((i) << 4) + (bari)]\n\ #define M3(i,bari) ((float *)pM3)[((i) << 4) + (bari)]\n\ #define M4(i,bari) ((float *)pM4)[((i) << 4) + (bari)]\n\ #define M5(i,bari) ((float *)pM5)[((i) << 4) + (bari)]\n\ #define M10(i,bari) ((float *)pM10)[((i) << 4) + (bari)]\n\ #define M15(i,bari) ((float *)pM15)[((i) << 4) + (bari)]\n\ #define M30(i,bari) ((float *)pM30)[((i) << 4) + (bari)]\n\ #define H1(i,bari) ((float *)pH1)[((i) << 4) + (bari)]\n\ \ int init_PTL(int *eventp,int *changedp,char *exchange,char *base,char *rel)\n\ {\n\ *eventp = Event; *changedp = Changed;\n\ if ( exchange != 0 && strcmp(exchange,Exchange) != 0 )\n\ return(0);\n\ if ( strcmp(base,_Base) == 0 && strcmp(rel,_Rel) == 0 )\n\ {\n\ pBids = _Bids; Numbids = _Numbids; pAsks = _Asks; Numasks = _Numasks; Base = _Base; Rel = _Rel;\n\ pBidvols = _Bidvols; pBidnxt = _Bidnxt; pAskvols = _Askvols; pAsknxt = _Asknxt;\n\ pM1 = _M1; pM2 = _M2; pM3 = _M3; pM4 = _M4; pM5 = _M5; pM10 = _M10; pM15 = _M15; pM30 = _M30; pH1 = _H1;\n\ return(1);\n\ }\n\ else if ( strcmp(base,_Rel) == 0 && strcmp(rel,_Base) == 0 )\n\ {\n\ pBids = _inv_Bids; Numbids = _Numasks; pAsks = _inv_Asks; Numasks = _Numbids; Base = _Rel; Rel = _Base;\n\ pBidvols = _inv_Bidvols; pBidnxt = _Asknxt; pAskvols = _inv_Askvols; pAsknxt = _Bidnxt;\n\ pM1 = _inv_M1; pM2 = _inv_M2; pM3 = _inv_M3; pM4 = _inv_M4; pM5 = _inv_M5; pM10 = _inv_M10; pM15 = _inv_M15; pM30 = _inv_M30; pH1 = _inv_H1;\n\ return(-1);\n\ }\n\ else return(0);\n\ }\ "; //printf("PicoParse(%s)\n",definition); PicocParse("jl777lib",definition,(int)strlen(definition),TRUE,TRUE,FALSE); VariableDefinePlatformVar(NULL,"Exchange",CharPtrType,(union AnyValue *)&Exchange,FALSE); VariableDefinePlatformVar(NULL,"Jdatetime",&IntType,(union AnyValue *)&Jdatetime,FALSE); VariableDefinePlatformVar(NULL,"Changed",&IntType,(union AnyValue *)&Changed,FALSE); VariableDefinePlatformVar(NULL,"Event",&IntType,(union AnyValue *)&Event,FALSE); VariableDefinePlatformVar(NULL,"Maxbars",&IntType,(union AnyValue *)&Maxbars,FALSE); VariableDefinePlatformVar(NULL,"Numbids",&IntType,(union AnyValue *)&Numbids,TRUE); VariableDefinePlatformVar(NULL,"Numasks",&IntType,(union AnyValue *)&Numasks,TRUE); VariableDefinePlatformVar(NULL,"_Numbids",&IntType,(union AnyValue *)&_Numbids,FALSE); VariableDefinePlatformVar(NULL,"_Numasks",&IntType,(union AnyValue *)&_Numasks,FALSE); VariableDefinePlatformVar(NULL,"Base",CharPtrType,(union AnyValue *)&Base,TRUE); VariableDefinePlatformVar(NULL,"Rel",CharPtrType,(union AnyValue *)&Rel,TRUE); VariableDefinePlatformVar(NULL,"_Base",CharPtrType,(union AnyValue *)&_Base,FALSE); VariableDefinePlatformVar(NULL,"_Rel",CharPtrType,(union AnyValue *)&_Rel,FALSE); VariableDefinePlatformVar(NULL,"pBidnxt",VoidPtrType,(union AnyValue *)&pBidnxt,TRUE); VariableDefinePlatformVar(NULL,"pAsknxt",VoidPtrType,(union AnyValue *)&pAsknxt,TRUE); VariableDefinePlatformVar(NULL,"_Bidnxt",VoidPtrType,(union AnyValue *)&_Bidnxt,FALSE); VariableDefinePlatformVar(NULL,"_Asknxt",VoidPtrType,(union AnyValue *)&_Asknxt,FALSE); VariableDefinePlatformVar(NULL,"pBidvols",VoidPtrType,(union AnyValue *)&pBidvols,TRUE); VariableDefinePlatformVar(NULL,"pAskvols",VoidPtrType,(union AnyValue *)&pAskvols,TRUE); VariableDefinePlatformVar(NULL,"_Bidvols",VoidPtrType,(union AnyValue *)&_Bidvols,FALSE); VariableDefinePlatformVar(NULL,"_Askvols",VoidPtrType,(union AnyValue *)&_Askvols,FALSE); VariableDefinePlatformVar(NULL,"_inv_Bidvols",VoidPtrType,(union AnyValue *)&_inv_Bidvols,FALSE); VariableDefinePlatformVar(NULL,"_inv_Askvols",VoidPtrType,(union AnyValue *)&_inv_Askvols,FALSE); VariableDefinePlatformVar(NULL,"pM1",VoidPtrType,(union AnyValue *)&pM1,TRUE); VariableDefinePlatformVar(NULL,"pM2",VoidPtrType,(union AnyValue *)&pM2,TRUE); VariableDefinePlatformVar(NULL,"pM3",VoidPtrType,(union AnyValue *)&pM3,TRUE); VariableDefinePlatformVar(NULL,"pM4",VoidPtrType,(union AnyValue *)&pM4,TRUE); VariableDefinePlatformVar(NULL,"pM5",VoidPtrType,(union AnyValue *)&pM5,TRUE); VariableDefinePlatformVar(NULL,"pM10",VoidPtrType,(union AnyValue *)&pM10,TRUE); VariableDefinePlatformVar(NULL,"pM15",VoidPtrType,(union AnyValue *)&pM15,TRUE); VariableDefinePlatformVar(NULL,"pM30",VoidPtrType,(union AnyValue *)&pM30,TRUE); VariableDefinePlatformVar(NULL,"pH1",VoidPtrType,(union AnyValue *)&pH1,TRUE); VariableDefinePlatformVar(NULL,"pBids",VoidPtrType,(union AnyValue *)&pBids,TRUE); VariableDefinePlatformVar(NULL,"pAsks",VoidPtrType,(union AnyValue *)&pAsks,TRUE); VariableDefinePlatformVar(NULL,"_M1",VoidPtrType,(union AnyValue *)&_M1,FALSE); VariableDefinePlatformVar(NULL,"_M2",VoidPtrType,(union AnyValue *)&_M2,FALSE); VariableDefinePlatformVar(NULL,"_M3",VoidPtrType,(union AnyValue *)&_M3,FALSE); VariableDefinePlatformVar(NULL,"_M4",VoidPtrType,(union AnyValue *)&_M4,FALSE); VariableDefinePlatformVar(NULL,"_M5",VoidPtrType,(union AnyValue *)&_M5,FALSE); VariableDefinePlatformVar(NULL,"_M10",VoidPtrType,(union AnyValue *)&_M10,FALSE); VariableDefinePlatformVar(NULL,"_M15",VoidPtrType,(union AnyValue *)&_M15,FALSE); VariableDefinePlatformVar(NULL,"_M30",VoidPtrType,(union AnyValue *)&_M30,FALSE); VariableDefinePlatformVar(NULL,"_H1",VoidPtrType,(union AnyValue *)&_H1,FALSE); VariableDefinePlatformVar(NULL,"_Bids",VoidPtrType,(union AnyValue *)&_Bids,FALSE); VariableDefinePlatformVar(NULL,"_Asks",VoidPtrType,(union AnyValue *)&_Asks,FALSE); VariableDefinePlatformVar(NULL,"_inv_M1",VoidPtrType,(union AnyValue *)&_inv_M1,FALSE); VariableDefinePlatformVar(NULL,"_inv_M2",VoidPtrType,(union AnyValue *)&_inv_M2,FALSE); VariableDefinePlatformVar(NULL,"_inv_M3",VoidPtrType,(union AnyValue *)&_inv_M3,FALSE); VariableDefinePlatformVar(NULL,"_inv_M4",VoidPtrType,(union AnyValue *)&_inv_M4,FALSE); VariableDefinePlatformVar(NULL,"_inv_M5",VoidPtrType,(union AnyValue *)&_inv_M5,FALSE); VariableDefinePlatformVar(NULL,"_inv_M10",VoidPtrType,(union AnyValue *)&_inv_M10,FALSE); VariableDefinePlatformVar(NULL,"_inv_M15",VoidPtrType,(union AnyValue *)&_inv_M15,FALSE); VariableDefinePlatformVar(NULL,"_inv_M30",VoidPtrType,(union AnyValue *)&_inv_M30,FALSE); VariableDefinePlatformVar(NULL,"_inv_H1",VoidPtrType,(union AnyValue *)&_inv_H1,FALSE); VariableDefinePlatformVar(NULL,"_inv_Bids",VoidPtrType,(union AnyValue *)&_inv_Bids,FALSE); VariableDefinePlatformVar(NULL,"_inv_Asks",VoidPtrType,(union AnyValue *)&_inv_Asks,FALSE); //printf("Parsed pBids.%p %f pAsks.%p %f | _Bids %p _Asks %p | _inv_Bids %p _inv_Asks %p\n",pBids,((double *)_Bids)[0],pAsks,((double *)_Asks)[0],_Bids,_Asks,_inv_Bids,_inv_Asks); }
/* creates various system-dependent definitions */ void StringSetupFunc(Picoc *pc) { /* define NULL */ if (!VariableDefined(pc, TableStrRegister(pc, "NULL"))) VariableDefinePlatformVar(pc, NULL, "NULL", &pc->IntType, (union AnyValue *)&String_ZeroValue, FALSE); }
void PlatformLibraryInitEx(Picoc *pc) { /* Define pin constants */ VariableDefinePlatformVar(pc, NULL, "PA0", &pc->UnsignedShortType, (union AnyValue *)&PA0, FALSE); VariableDefinePlatformVar(pc, NULL, "PA1", &pc->UnsignedShortType, (union AnyValue *)&PA1, FALSE); VariableDefinePlatformVar(pc, NULL, "PA2", &pc->UnsignedShortType, (union AnyValue *)&PA2, FALSE); VariableDefinePlatformVar(pc, NULL, "PA3", &pc->UnsignedShortType, (union AnyValue *)&PA3, FALSE); VariableDefinePlatformVar(pc, NULL, "PA4", &pc->UnsignedShortType, (union AnyValue *)&PA4, FALSE); VariableDefinePlatformVar(pc, NULL, "PA5", &pc->UnsignedShortType, (union AnyValue *)&PA5, FALSE); VariableDefinePlatformVar(pc, NULL, "PA6", &pc->UnsignedShortType, (union AnyValue *)&PA6, FALSE); VariableDefinePlatformVar(pc, NULL, "PA7", &pc->UnsignedShortType, (union AnyValue *)&PA7, FALSE); VariableDefinePlatformVar(pc, NULL, "PA8", &pc->UnsignedShortType, (union AnyValue *)&PA8, FALSE); VariableDefinePlatformVar(pc, NULL, "PA9", &pc->UnsignedShortType, (union AnyValue *)&PA9, FALSE); VariableDefinePlatformVar(pc, NULL, "PA10",&pc->UnsignedShortType, (union AnyValue *)&PA10,FALSE); VariableDefinePlatformVar(pc, NULL, "PA11",&pc->UnsignedShortType, (union AnyValue *)&PA11,FALSE); VariableDefinePlatformVar(pc, NULL, "PA12",&pc->UnsignedShortType, (union AnyValue *)&PA12,FALSE); VariableDefinePlatformVar(pc, NULL, "PA13",&pc->UnsignedShortType, (union AnyValue *)&PA13,FALSE); VariableDefinePlatformVar(pc, NULL, "PA14",&pc->UnsignedShortType, (union AnyValue *)&PA14,FALSE); VariableDefinePlatformVar(pc, NULL, "PA15",&pc->UnsignedShortType, (union AnyValue *)&PA15,FALSE); VariableDefinePlatformVar(pc, NULL, "PB0", &pc->UnsignedShortType, (union AnyValue *)&PB0, FALSE); VariableDefinePlatformVar(pc, NULL, "PB1", &pc->UnsignedShortType, (union AnyValue *)&PB1, FALSE); VariableDefinePlatformVar(pc, NULL, "PB2", &pc->UnsignedShortType, (union AnyValue *)&PB2, FALSE); VariableDefinePlatformVar(pc, NULL, "PB3", &pc->UnsignedShortType, (union AnyValue *)&PB3, FALSE); VariableDefinePlatformVar(pc, NULL, "PB4", &pc->UnsignedShortType, (union AnyValue *)&PB4, FALSE); VariableDefinePlatformVar(pc, NULL, "PB5", &pc->UnsignedShortType, (union AnyValue *)&PB5, FALSE); VariableDefinePlatformVar(pc, NULL, "PB6", &pc->UnsignedShortType, (union AnyValue *)&PB6, FALSE); VariableDefinePlatformVar(pc, NULL, "PB7", &pc->UnsignedShortType, (union AnyValue *)&PB7, FALSE); VariableDefinePlatformVar(pc, NULL, "PB8", &pc->UnsignedShortType, (union AnyValue *)&PB8, FALSE); VariableDefinePlatformVar(pc, NULL, "PB9", &pc->UnsignedShortType, (union AnyValue *)&PB9, FALSE); VariableDefinePlatformVar(pc, NULL, "PB10",&pc->UnsignedShortType, (union AnyValue *)&PB10,FALSE); VariableDefinePlatformVar(pc, NULL, "PB11",&pc->UnsignedShortType, (union AnyValue *)&PB11,FALSE); VariableDefinePlatformVar(pc, NULL, "PB12",&pc->UnsignedShortType, (union AnyValue *)&PB12,FALSE); VariableDefinePlatformVar(pc, NULL, "PB13",&pc->UnsignedShortType, (union AnyValue *)&PB13,FALSE); VariableDefinePlatformVar(pc, NULL, "PB14",&pc->UnsignedShortType, (union AnyValue *)&PB14,FALSE); VariableDefinePlatformVar(pc, NULL, "PB15",&pc->UnsignedShortType, (union AnyValue *)&PB15,FALSE); VariableDefinePlatformVar(pc, NULL, "PC0", &pc->UnsignedShortType, (union AnyValue *)&PC0, FALSE); VariableDefinePlatformVar(pc, NULL, "PC1", &pc->UnsignedShortType, (union AnyValue *)&PC1, FALSE); VariableDefinePlatformVar(pc, NULL, "PC2", &pc->UnsignedShortType, (union AnyValue *)&PC2, FALSE); VariableDefinePlatformVar(pc, NULL, "PC3", &pc->UnsignedShortType, (union AnyValue *)&PC3, FALSE); VariableDefinePlatformVar(pc, NULL, "PC4", &pc->UnsignedShortType, (union AnyValue *)&PC4, FALSE); VariableDefinePlatformVar(pc, NULL, "PC5", &pc->UnsignedShortType, (union AnyValue *)&PC5, FALSE); VariableDefinePlatformVar(pc, NULL, "PC6", &pc->UnsignedShortType, (union AnyValue *)&PC6, FALSE); VariableDefinePlatformVar(pc, NULL, "PC7", &pc->UnsignedShortType, (union AnyValue *)&PC7, FALSE); VariableDefinePlatformVar(pc, NULL, "PC8", &pc->UnsignedShortType, (union AnyValue *)&PC8, FALSE); VariableDefinePlatformVar(pc, NULL, "PC9", &pc->UnsignedShortType, (union AnyValue *)&PC9, FALSE); VariableDefinePlatformVar(pc, NULL, "PC10",&pc->UnsignedShortType, (union AnyValue *)&PC10,FALSE); VariableDefinePlatformVar(pc, NULL, "PC11",&pc->UnsignedShortType, (union AnyValue *)&PC11,FALSE); VariableDefinePlatformVar(pc, NULL, "PC12",&pc->UnsignedShortType, (union AnyValue *)&PC12,FALSE); VariableDefinePlatformVar(pc, NULL, "PC13",&pc->UnsignedShortType, (union AnyValue *)&PC13,FALSE); VariableDefinePlatformVar(pc, NULL, "PC14",&pc->UnsignedShortType, (union AnyValue *)&PC14,FALSE); VariableDefinePlatformVar(pc, NULL, "PC15",&pc->UnsignedShortType, (union AnyValue *)&PC15,FALSE); }
/* creates various system-dependent definitions */ void MathSetupFunc(void) { VariableDefinePlatformVar(NULL, "M_E", &FPType, (union AnyValue *)&M_EValue, FALSE); VariableDefinePlatformVar(NULL, "M_LOG2E", &FPType, (union AnyValue *)&M_LOG2EValue, FALSE); VariableDefinePlatformVar(NULL, "M_LOG10E", &FPType, (union AnyValue *)&M_LOG10EValue, FALSE); VariableDefinePlatformVar(NULL, "M_LN2", &FPType, (union AnyValue *)&M_LN2Value, FALSE); VariableDefinePlatformVar(NULL, "M_LN10", &FPType, (union AnyValue *)&M_LN10Value, FALSE); VariableDefinePlatformVar(NULL, "M_PI", &FPType, (union AnyValue *)&M_PIValue, FALSE); VariableDefinePlatformVar(NULL, "M_PI_2", &FPType, (union AnyValue *)&M_PI_2Value, FALSE); VariableDefinePlatformVar(NULL, "M_PI_4", &FPType, (union AnyValue *)&M_PI_4Value, FALSE); VariableDefinePlatformVar(NULL, "M_1_PI", &FPType, (union AnyValue *)&M_1_PIValue, FALSE); VariableDefinePlatformVar(NULL, "M_2_PI", &FPType, (union AnyValue *)&M_2_PIValue, FALSE); VariableDefinePlatformVar(NULL, "M_2_SQRTPI", &FPType, (union AnyValue *)&M_2_SQRTPIValue, FALSE); VariableDefinePlatformVar(NULL, "M_SQRT2", &FPType, (union AnyValue *)&M_SQRT2Value, FALSE); VariableDefinePlatformVar(NULL, "M_SQRT1_2", &FPType, (union AnyValue *)&M_SQRT1_2Value, FALSE); }
/* creates various system-dependent definitions */ void StdErrnoSetupFunc(Picoc *pc) { /* defines */ #ifdef EACCES VariableDefinePlatformVar(pc, NULL, "EACCES", &pc->IntType, (union AnyValue *)&EACCESValue, FALSE); #endif #ifdef EADDRINUSE VariableDefinePlatformVar(pc, NULL, "EADDRINUSE", &pc->IntType, (union AnyValue *)&EADDRINUSEValue, FALSE); #endif #ifdef EADDRNOTAVAIL VariableDefinePlatformVar(pc, NULL, "EADDRNOTAVAIL", &pc->IntType, (union AnyValue *)&EADDRNOTAVAILValue, FALSE); #endif #ifdef EAFNOSUPPORT VariableDefinePlatformVar(pc, NULL, "EAFNOSUPPORT", &pc->IntType, (union AnyValue *)&EAFNOSUPPORTValue, FALSE); #endif #ifdef EAGAIN VariableDefinePlatformVar(pc, NULL, "EAGAIN", &pc->IntType, (union AnyValue *)&EAGAINValue, FALSE); #endif #ifdef EALREADY VariableDefinePlatformVar(pc, NULL, "EALREADY", &pc->IntType, (union AnyValue *)&EALREADYValue, FALSE); #endif #ifdef EBADF VariableDefinePlatformVar(pc, NULL, "EBADF", &pc->IntType, (union AnyValue *)&EBADFValue, FALSE); #endif #ifdef EBADMSG VariableDefinePlatformVar(pc, NULL, "EBADMSG", &pc->IntType, (union AnyValue *)&EBADMSGValue, FALSE); #endif #ifdef EBUSY VariableDefinePlatformVar(pc, NULL, "EBUSY", &pc->IntType, (union AnyValue *)&EBUSYValue, FALSE); #endif #ifdef ECANCELED VariableDefinePlatformVar(pc, NULL, "ECANCELED", &pc->IntType, (union AnyValue *)&ECANCELEDValue, FALSE); #endif #ifdef ECHILD VariableDefinePlatformVar(pc, NULL, "ECHILD", &pc->IntType, (union AnyValue *)&ECHILDValue, FALSE); #endif #ifdef ECONNABORTED VariableDefinePlatformVar(pc, NULL, "ECONNABORTED", &pc->IntType, (union AnyValue *)&ECONNABORTEDValue, FALSE); #endif #ifdef ECONNREFUSED VariableDefinePlatformVar(pc, NULL, "ECONNREFUSED", &pc->IntType, (union AnyValue *)&ECONNREFUSEDValue, FALSE); #endif #ifdef ECONNRESET VariableDefinePlatformVar(pc, NULL, "ECONNRESET", &pc->IntType, (union AnyValue *)&ECONNRESETValue, FALSE); #endif #ifdef EDEADLK VariableDefinePlatformVar(pc, NULL, "EDEADLK", &pc->IntType, (union AnyValue *)&EDEADLKValue, FALSE); #endif #ifdef EDESTADDRREQ VariableDefinePlatformVar(pc, NULL, "EDESTADDRREQ", &pc->IntType, (union AnyValue *)&EDESTADDRREQValue, FALSE); #endif #ifdef EDOM VariableDefinePlatformVar(pc, NULL, "EDOM", &pc->IntType, (union AnyValue *)&EDOMValue, FALSE); #endif #ifdef EDQUOT VariableDefinePlatformVar(pc, NULL, "EDQUOT", &pc->IntType, (union AnyValue *)&EDQUOTValue, FALSE); #endif #ifdef EEXIST VariableDefinePlatformVar(pc, NULL, "EEXIST", &pc->IntType, (union AnyValue *)&EEXISTValue, FALSE); #endif #ifdef EFAULT VariableDefinePlatformVar(pc, NULL, "EFAULT", &pc->IntType, (union AnyValue *)&EFAULTValue, FALSE); #endif #ifdef EFBIG VariableDefinePlatformVar(pc, NULL, "EFBIG", &pc->IntType, (union AnyValue *)&EFBIGValue, FALSE); #endif #ifdef EHOSTUNREACH VariableDefinePlatformVar(pc, NULL, "EHOSTUNREACH", &pc->IntType, (union AnyValue *)&EHOSTUNREACHValue, FALSE); #endif #ifdef EIDRM VariableDefinePlatformVar(pc, NULL, "EIDRM", &pc->IntType, (union AnyValue *)&EIDRMValue, FALSE); #endif #ifdef EILSEQ VariableDefinePlatformVar(pc, NULL, "EILSEQ", &pc->IntType, (union AnyValue *)&EILSEQValue, FALSE); #endif #ifdef EINPROGRESS VariableDefinePlatformVar(pc, NULL, "EINPROGRESS", &pc->IntType, (union AnyValue *)&EINPROGRESSValue, FALSE); #endif #ifdef EINTR VariableDefinePlatformVar(pc, NULL, "EINTR", &pc->IntType, (union AnyValue *)&EINTRValue, FALSE); #endif #ifdef EINVAL VariableDefinePlatformVar(pc, NULL, "EINVAL", &pc->IntType, (union AnyValue *)&EINVALValue, FALSE); #endif #ifdef EIO VariableDefinePlatformVar(pc, NULL, "EIO", &pc->IntType, (union AnyValue *)&EIOValue, FALSE); #endif #ifdef EISCONN VariableDefinePlatformVar(pc, NULL, "EISCONN", &pc->IntType, (union AnyValue *)&EISCONNValue, FALSE); #endif #ifdef EISDIR VariableDefinePlatformVar(pc, NULL, "EISDIR", &pc->IntType, (union AnyValue *)&EISDIRValue, FALSE); #endif #ifdef ELOOP VariableDefinePlatformVar(pc, NULL, "ELOOP", &pc->IntType, (union AnyValue *)&ELOOPValue, FALSE); #endif #ifdef EMFILE VariableDefinePlatformVar(pc, NULL, "EMFILE", &pc->IntType, (union AnyValue *)&EMFILEValue, FALSE); #endif #ifdef EMLINK VariableDefinePlatformVar(pc, NULL, "EMLINK", &pc->IntType, (union AnyValue *)&EMLINKValue, FALSE); #endif #ifdef EMSGSIZE VariableDefinePlatformVar(pc, NULL, "EMSGSIZE", &pc->IntType, (union AnyValue *)&EMSGSIZEValue, FALSE); #endif #ifdef EMULTIHOP VariableDefinePlatformVar(pc, NULL, "EMULTIHOP", &pc->IntType, (union AnyValue *)&EMULTIHOPValue, FALSE); #endif #ifdef ENAMETOOLONG VariableDefinePlatformVar(pc, NULL, "ENAMETOOLONG", &pc->IntType, (union AnyValue *)&ENAMETOOLONGValue, FALSE); #endif #ifdef ENETDOWN VariableDefinePlatformVar(pc, NULL, "ENETDOWN", &pc->IntType, (union AnyValue *)&ENETDOWNValue, FALSE); #endif #ifdef ENETRESET VariableDefinePlatformVar(pc, NULL, "ENETRESET", &pc->IntType, (union AnyValue *)&ENETRESETValue, FALSE); #endif #ifdef ENETUNREACH VariableDefinePlatformVar(pc, NULL, "ENETUNREACH", &pc->IntType, (union AnyValue *)&ENETUNREACHValue, FALSE); #endif #ifdef ENFILE VariableDefinePlatformVar(pc, NULL, "ENFILE", &pc->IntType, (union AnyValue *)&ENFILEValue, FALSE); #endif #ifdef ENOBUFS VariableDefinePlatformVar(pc, NULL, "ENOBUFS", &pc->IntType, (union AnyValue *)&ENOBUFSValue, FALSE); #endif #ifdef ENODATA VariableDefinePlatformVar(pc, NULL, "ENODATA", &pc->IntType, (union AnyValue *)&ENODATAValue, FALSE); #endif #ifdef ENODEV VariableDefinePlatformVar(pc, NULL, "ENODEV", &pc->IntType, (union AnyValue *)&ENODEVValue, FALSE); #endif #ifdef ENOENT VariableDefinePlatformVar(pc, NULL, "ENOENT", &pc->IntType, (union AnyValue *)&ENOENTValue, FALSE); #endif #ifdef ENOEXEC VariableDefinePlatformVar(pc, NULL, "ENOEXEC", &pc->IntType, (union AnyValue *)&ENOEXECValue, FALSE); #endif #ifdef ENOLCK VariableDefinePlatformVar(pc, NULL, "ENOLCK", &pc->IntType, (union AnyValue *)&ENOLCKValue, FALSE); #endif #ifdef ENOLINK VariableDefinePlatformVar(pc, NULL, "ENOLINK", &pc->IntType, (union AnyValue *)&ENOLINKValue, FALSE); #endif #ifdef ENOMEM VariableDefinePlatformVar(pc, NULL, "ENOMEM", &pc->IntType, (union AnyValue *)&ENOMEMValue, FALSE); #endif #ifdef ENOMSG VariableDefinePlatformVar(pc, NULL, "ENOMSG", &pc->IntType, (union AnyValue *)&ENOMSGValue, FALSE); #endif #ifdef ENOPROTOOPT VariableDefinePlatformVar(pc, NULL, "ENOPROTOOPT", &pc->IntType, (union AnyValue *)&ENOPROTOOPTValue, FALSE); #endif #ifdef ENOSPC VariableDefinePlatformVar(pc, NULL, "ENOSPC", &pc->IntType, (union AnyValue *)&ENOSPCValue, FALSE); #endif #ifdef ENOSR VariableDefinePlatformVar(pc, NULL, "ENOSR", &pc->IntType, (union AnyValue *)&ENOSRValue, FALSE); #endif #ifdef ENOSTR VariableDefinePlatformVar(pc, NULL, "ENOSTR", &pc->IntType, (union AnyValue *)&ENOSTRValue, FALSE); #endif #ifdef ENOSYS VariableDefinePlatformVar(pc, NULL, "ENOSYS", &pc->IntType, (union AnyValue *)&ENOSYSValue, FALSE); #endif #ifdef ENOTCONN VariableDefinePlatformVar(pc, NULL, "ENOTCONN", &pc->IntType, (union AnyValue *)&ENOTCONNValue, FALSE); #endif #ifdef ENOTDIR VariableDefinePlatformVar(pc, NULL, "ENOTDIR", &pc->IntType, (union AnyValue *)&ENOTDIRValue, FALSE); #endif #ifdef ENOTEMPTY VariableDefinePlatformVar(pc, NULL, "ENOTEMPTY", &pc->IntType, (union AnyValue *)&ENOTEMPTYValue, FALSE); #endif #ifdef ENOTRECOVERABLE VariableDefinePlatformVar(pc, NULL, "ENOTRECOVERABLE", &pc->IntType, (union AnyValue *)&ENOTRECOVERABLEValue, FALSE); #endif #ifdef ENOTSOCK VariableDefinePlatformVar(pc, NULL, "ENOTSOCK", &pc->IntType, (union AnyValue *)&ENOTSOCKValue, FALSE); #endif #ifdef ENOTSUP VariableDefinePlatformVar(pc, NULL, "ENOTSUP", &pc->IntType, (union AnyValue *)&ENOTSUPValue, FALSE); #endif #ifdef ENOTTY VariableDefinePlatformVar(pc, NULL, "ENOTTY", &pc->IntType, (union AnyValue *)&ENOTTYValue, FALSE); #endif #ifdef ENXIO VariableDefinePlatformVar(pc, NULL, "ENXIO", &pc->IntType, (union AnyValue *)&ENXIOValue, FALSE); #endif #ifdef EOPNOTSUPP VariableDefinePlatformVar(pc, NULL, "EOPNOTSUPP", &pc->IntType, (union AnyValue *)&EOPNOTSUPPValue, FALSE); #endif #ifdef EOVERFLOW VariableDefinePlatformVar(pc, NULL, "EOVERFLOW", &pc->IntType, (union AnyValue *)&EOVERFLOWValue, FALSE); #endif #ifdef EOWNERDEAD VariableDefinePlatformVar(pc, NULL, "EOWNERDEAD", &pc->IntType, (union AnyValue *)&EOWNERDEADValue, FALSE); #endif #ifdef EPERM VariableDefinePlatformVar(pc, NULL, "EPERM", &pc->IntType, (union AnyValue *)&EPERMValue, FALSE); #endif #ifdef EPIPE VariableDefinePlatformVar(pc, NULL, "EPIPE", &pc->IntType, (union AnyValue *)&EPIPEValue, FALSE); #endif #ifdef EPROTO VariableDefinePlatformVar(pc, NULL, "EPROTO", &pc->IntType, (union AnyValue *)&EPROTOValue, FALSE); #endif #ifdef EPROTONOSUPPORT VariableDefinePlatformVar(pc, NULL, "EPROTONOSUPPORT", &pc->IntType, (union AnyValue *)&EPROTONOSUPPORTValue, FALSE); #endif #ifdef EPROTOTYPE VariableDefinePlatformVar(pc, NULL, "EPROTOTYPE", &pc->IntType, (union AnyValue *)&EPROTOTYPEValue, FALSE); #endif #ifdef ERANGE VariableDefinePlatformVar(pc, NULL, "ERANGE", &pc->IntType, (union AnyValue *)&ERANGEValue, FALSE); #endif #ifdef EROFS VariableDefinePlatformVar(pc, NULL, "EROFS", &pc->IntType, (union AnyValue *)&EROFSValue, FALSE); #endif #ifdef ESPIPE VariableDefinePlatformVar(pc, NULL, "ESPIPE", &pc->IntType, (union AnyValue *)&ESPIPEValue, FALSE); #endif #ifdef ESRCH VariableDefinePlatformVar(pc, NULL, "ESRCH", &pc->IntType, (union AnyValue *)&ESRCHValue, FALSE); #endif #ifdef ESTALE VariableDefinePlatformVar(pc, NULL, "ESTALE", &pc->IntType, (union AnyValue *)&ESTALEValue, FALSE); #endif #ifdef ETIME VariableDefinePlatformVar(pc, NULL, "ETIME", &pc->IntType, (union AnyValue *)&ETIMEValue, FALSE); #endif #ifdef ETIMEDOUT VariableDefinePlatformVar(pc, NULL, "ETIMEDOUT", &pc->IntType, (union AnyValue *)&ETIMEDOUTValue, FALSE); #endif #ifdef ETXTBSY VariableDefinePlatformVar(pc, NULL, "ETXTBSY", &pc->IntType, (union AnyValue *)&ETXTBSYValue, FALSE); #endif #ifdef EWOULDBLOCK VariableDefinePlatformVar(pc, NULL, "EWOULDBLOCK", &pc->IntType, (union AnyValue *)&EWOULDBLOCKValue, FALSE); #endif #ifdef EXDEV VariableDefinePlatformVar(pc, NULL, "EXDEV", &pc->IntType, (union AnyValue *)&EXDEVValue, FALSE); #endif VariableDefinePlatformVar(pc, NULL, "errno", &pc->IntType, (union AnyValue *)&errno, TRUE); }
/* this is called when the header file is included */ void PlatformLibrarySetup_math(Picoc *pc) { VariableDefinePlatformVar(pc, NULL, "M_PI", &pc->FPType, (union AnyValue *)&M_PIValue, FALSE); VariableDefinePlatformVar(pc, NULL, "M_E", &pc->FPType, (union AnyValue *)&M_EValue, FALSE); }