diff --git a/clibrary.c b/clibrary.c index c668862..93739c6 100644 --- a/clibrary.c +++ b/clibrary.c @@ -321,6 +321,11 @@ void LibGetc(struct ParseState *Parser, struct Value *ReturnValue, struct Value ReturnValue->Val->Integer = PlatformGetCharacter(); } +void LibExit(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + PlatformExit(); +} + #ifdef PICOC_MATH_LIBRARY void LibSin(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) { @@ -367,21 +372,6 @@ void LibTanh(struct ParseState *Parser, struct Value *ReturnValue, struct Value ReturnValue->Val->FP = math_tanh(Param[0]->Val->FP); } -void LibAsinh(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) -{ - ReturnValue->Val->FP = math_asinh(Param[0]->Val->FP); -} - -void LibAcosh(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) -{ - ReturnValue->Val->FP = math_acosh(Param[0]->Val->FP); -} - -void LibAtanh(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) -{ - ReturnValue->Val->FP = math_atanh(Param[0]->Val->FP); -} - void LibExp(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) { ReturnValue->Val->FP = math_exp(Param[0]->Val->FP); @@ -435,6 +425,7 @@ struct LibraryFunction CLibrary[] = { LibSPrintf, "char *sprintf(char *, char *, ...)" }, { LibGets, "void gets(char *, int)" }, { LibGetc, "int getchar()" }, + { LibExit, "void exit()" }, #ifdef PICOC_MATH_LIBRARY { LibSin, "float sin(float)" }, { LibCos, "float cos(float)" }, @@ -445,9 +436,6 @@ struct LibraryFunction CLibrary[] = { LibSinh, "float sinh(float)" }, { LibCosh, "float cosh(float)" }, { LibTanh, "float tanh(float)" }, - { LibAsinh, "float asinh(float)" }, - { LibAcosh, "float acosh(float)" }, - { LibAtanh, "float atanh(float)" }, { LibExp, "float exp(float)" }, { LibFabs, "float fabs(float)" }, { LibLog, "float log(float)" }, diff --git a/library_surveyor.c b/library_surveyor.c index 89a3ec8..d86d225 100644 --- a/library_surveyor.c +++ b/library_surveyor.c @@ -323,9 +323,9 @@ void Cvpix(struct ParseState *Parser, struct Value *ReturnValue, struct Value ** x = Param[0]->Val->Integer; y = Param[1]->Val->Integer; ix = vpix((unsigned char *)FRAME_BUF, x, y); - Iy1 = ((ix>>16) & 0x000000FF); // Y1 - Iu1 = ((ix>>24) & 0x000000FF); // U - Iv1 = ((ix>>8) & 0x000000FF); // V + Iy1 = ((ix>>16) & 0x000000FF); // Y1 + Iu1 = ((ix>>24) & 0x000000FF); // U + Iv1 = ((ix>>8) & 0x000000FF); // V } void Cvscan(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) @@ -343,11 +343,11 @@ void Cvscan(struct ParseState *Parser, struct Value *ReturnValue, struct Value * void Cvmean(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) { - vmean((unsigned char *)FRAME_BUF); + vmean((unsigned char *)FRAME_BUF); Iy1 = mean[0]; Iu1 = mean[1]; Iv1 = mean[2]; -} +} // search for blob by color, index; return center point X,Y and width Z void Cvblob(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) { @@ -657,11 +657,6 @@ void Cnnlearnblob (struct ParseState *Parser, struct Value *ReturnValue, struct bloby1[0], bloby2[0], imgWidth, imgHeight); nnpack8x8(ix); nndisplay(ix); -} - -void Cexit (struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) { - ExitBuf[40] = 1; - longjmp(ExitBuf, 1); } /* list of all library functions and their prototypes */ @@ -719,7 +714,6 @@ struct LibraryFunction PlatformLibrary[] = { Cnntest, "void nntest(int, int, int, int, int, int, int, int)" }, { Cnnmatchblob, "void nnmatchblob(int)" }, { Cnnlearnblob, "void nnlearnblob(int)" }, - { Cexit, "void exit()" }, { NULL, NULL } }; diff --git a/library_unix.c b/library_unix.c index 403fef6..9c46f3b 100644 --- a/library_unix.c +++ b/library_unix.c @@ -4,9 +4,16 @@ void PlatformLibraryInit() { } +void Ctest (struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + printf("test(%d)\n", Param[0]->Val->Integer); + Param[0]->Val->Integer = 1234; +} + /* list of all library functions and their prototypes */ struct LibraryFunction PlatformLibrary[] = { + { Ctest, "void test(int)" }, { NULL, NULL } };