Down to the hard bits of stdlib.c
git-svn-id: http://picoc.googlecode.com/svn/trunk@438 21eae674-98b7-11dd-bd71-f92a316d2d60
This commit is contained in:
parent
907f2b26d9
commit
0773986309
|
@ -86,6 +86,48 @@ void StdlibSystem(struct ParseState *Parser, struct Value *ReturnValue, struct V
|
||||||
ReturnValue->Val->Integer = system(Param[0]->Val->Pointer);
|
ReturnValue->Val->Integer = system(Param[0]->Val->Pointer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
void StdlibBsearch(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
||||||
|
{
|
||||||
|
ReturnValue->Val->Pointer = bsearch(Param[0]->Val->Pointer, Param[1]->Val->Pointer, Param[2]->Val->Integer, Param[3]->Val->Integer, (int (*)())Param[4]->Val->Pointer);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
void StdlibAbs(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
||||||
|
{
|
||||||
|
ReturnValue->Val->Integer = abs(Param[0]->Val->Integer);
|
||||||
|
}
|
||||||
|
|
||||||
|
void StdlibLabs(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
||||||
|
{
|
||||||
|
ReturnValue->Val->Integer = labs(Param[0]->Val->Integer);
|
||||||
|
}
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
void StdlibDiv(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
||||||
|
{
|
||||||
|
ReturnValue->Val->Integer = div(Param[0]->Val->Integer, Param[1]->Val->Integer);
|
||||||
|
}
|
||||||
|
|
||||||
|
void StdlibLdiv(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
||||||
|
{
|
||||||
|
ReturnValue->Val->Integer = ldiv(Param[0]->Val->Integer, Param[1]->Val->Integer);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
/* handy structure definitions */
|
||||||
|
const char StdlibDefs[] = "\
|
||||||
|
typedef struct { \
|
||||||
|
int quot, rem; \
|
||||||
|
} div_t; \
|
||||||
|
\
|
||||||
|
typedef struct { \
|
||||||
|
int quot, rem; \
|
||||||
|
} ldiv_t; \
|
||||||
|
";
|
||||||
|
#endif
|
||||||
|
|
||||||
/* all stdlib.h functions */
|
/* all stdlib.h functions */
|
||||||
struct LibraryFunction StdlibFunctions[] =
|
struct LibraryFunction StdlibFunctions[] =
|
||||||
{
|
{
|
||||||
|
@ -105,6 +147,13 @@ struct LibraryFunction StdlibFunctions[] =
|
||||||
{ StdlibExit, "void exit(int);" },
|
{ StdlibExit, "void exit(int);" },
|
||||||
{ StdlibGetenv, "char *getenv(char *);" },
|
{ StdlibGetenv, "char *getenv(char *);" },
|
||||||
{ StdlibSystem, "int system(char *);" },
|
{ StdlibSystem, "int system(char *);" },
|
||||||
|
/* { StdlibBsearch, "void *bsearch(void *,void *,int,int,int (*)());" }, */
|
||||||
|
{ StdlibAbs, "int abs(int);" },
|
||||||
|
{ StdlibLabs, "int labs(int);" },
|
||||||
|
#if 0
|
||||||
|
{ StdlibDiv, "div_t div(int);" },
|
||||||
|
{ StdlibLdiv, "ldiv_t ldiv(int);" },
|
||||||
|
#endif
|
||||||
{ NULL, NULL }
|
{ NULL, NULL }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue