Changed "NativePointer" to "Pointer" for brevity
git-svn-id: http://picoc.googlecode.com/svn/trunk@437 21eae674-98b7-11dd-bd71-f92a316d2d60
This commit is contained in:
parent
62ade18048
commit
907f2b26d9
64
clibrary.c
64
clibrary.c
|
@ -198,7 +198,7 @@ void GenericPrintf(struct ParseState *Parser, struct Value *ReturnValue, struct
|
||||||
int LeftJustify = FALSE;
|
int LeftJustify = FALSE;
|
||||||
int ZeroPad = FALSE;
|
int ZeroPad = FALSE;
|
||||||
int FieldWidth = 0;
|
int FieldWidth = 0;
|
||||||
char *Format = Param[0]->Val->NativePointer;
|
char *Format = Param[0]->Val->Pointer;
|
||||||
|
|
||||||
for (FPos = Format; *FPos != '\0'; FPos++)
|
for (FPos = Format; *FPos != '\0'; FPos++)
|
||||||
{
|
{
|
||||||
|
@ -258,7 +258,7 @@ void GenericPrintf(struct ParseState *Parser, struct Value *ReturnValue, struct
|
||||||
char *Str;
|
char *Str;
|
||||||
|
|
||||||
if (NextArg->Typ->Base == TypePointer)
|
if (NextArg->Typ->Base == TypePointer)
|
||||||
Str = NextArg->Val->NativePointer;
|
Str = NextArg->Val->Pointer;
|
||||||
else
|
else
|
||||||
Str = &NextArg->Val->ArrayMem[0];
|
Str = &NextArg->Val->ArrayMem[0];
|
||||||
|
|
||||||
|
@ -304,26 +304,26 @@ void LibSPrintf(struct ParseState *Parser, struct Value *ReturnValue, struct Val
|
||||||
|
|
||||||
StrStream.Putch = &SPutc;
|
StrStream.Putch = &SPutc;
|
||||||
StrStream.i.Str.Parser = Parser;
|
StrStream.i.Str.Parser = Parser;
|
||||||
StrStream.i.Str.WritePos = Param[0]->Val->NativePointer;
|
StrStream.i.Str.WritePos = Param[0]->Val->Pointer;
|
||||||
|
|
||||||
GenericPrintf(Parser, ReturnValue, Param+1, NumArgs-1, &StrStream);
|
GenericPrintf(Parser, ReturnValue, Param+1, NumArgs-1, &StrStream);
|
||||||
PrintCh(0, &StrStream);
|
PrintCh(0, &StrStream);
|
||||||
ReturnValue->Val->NativePointer = *Param;
|
ReturnValue->Val->Pointer = *Param;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* get a line of input. protected from buffer overrun */
|
/* get a line of input. protected from buffer overrun */
|
||||||
void LibGets(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
void LibGets(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
||||||
{
|
{
|
||||||
struct Value *CharArray = (struct Value *)(Param[0]->Val->NativePointer);
|
struct Value *CharArray = (struct Value *)(Param[0]->Val->Pointer);
|
||||||
char *ReadBuffer = &CharArray->Val->ArrayMem[0];
|
char *ReadBuffer = &CharArray->Val->ArrayMem[0];
|
||||||
char *Result;
|
char *Result;
|
||||||
|
|
||||||
ReturnValue->Val->NativePointer = NULL;
|
ReturnValue->Val->Pointer = NULL;
|
||||||
Result = PlatformGetLine(ReadBuffer, GETS_BUF_MAX);
|
Result = PlatformGetLine(ReadBuffer, GETS_BUF_MAX);
|
||||||
if (Result == NULL)
|
if (Result == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
ReturnValue->Val->NativePointer = Param[0]->Val->NativePointer;
|
ReturnValue->Val->Pointer = Param[0]->Val->Pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
void LibGetc(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
void LibGetc(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
||||||
|
@ -431,32 +431,32 @@ void LibFloor(struct ParseState *Parser, struct Value *ReturnValue, struct Value
|
||||||
#ifndef NO_STRING_FUNCTIONS
|
#ifndef NO_STRING_FUNCTIONS
|
||||||
void LibMalloc(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
void LibMalloc(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
||||||
{
|
{
|
||||||
ReturnValue->Val->NativePointer = malloc(Param[0]->Val->Integer);
|
ReturnValue->Val->Pointer = malloc(Param[0]->Val->Integer);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef NO_CALLOC
|
#ifndef NO_CALLOC
|
||||||
void LibCalloc(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
void LibCalloc(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
||||||
{
|
{
|
||||||
ReturnValue->Val->NativePointer = calloc(Param[0]->Val->Integer, Param[1]->Val->Integer);
|
ReturnValue->Val->Pointer = calloc(Param[0]->Val->Integer, Param[1]->Val->Integer);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef NO_REALLOC
|
#ifndef NO_REALLOC
|
||||||
void LibRealloc(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
void LibRealloc(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
||||||
{
|
{
|
||||||
ReturnValue->Val->NativePointer = realloc(Param[0]->Val->NativePointer, Param[1]->Val->Integer);
|
ReturnValue->Val->Pointer = realloc(Param[0]->Val->Pointer, Param[1]->Val->Integer);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void LibFree(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
void LibFree(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
||||||
{
|
{
|
||||||
free(Param[0]->Val->NativePointer);
|
free(Param[0]->Val->Pointer);
|
||||||
}
|
}
|
||||||
|
|
||||||
void LibStrcpy(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
void LibStrcpy(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
||||||
{
|
{
|
||||||
char *To = (char *)Param[0]->Val->NativePointer;
|
char *To = (char *)Param[0]->Val->Pointer;
|
||||||
char *From = (char *)Param[1]->Val->NativePointer;
|
char *From = (char *)Param[1]->Val->Pointer;
|
||||||
|
|
||||||
while (*From != '\0')
|
while (*From != '\0')
|
||||||
*To++ = *From++;
|
*To++ = *From++;
|
||||||
|
@ -466,8 +466,8 @@ void LibStrcpy(struct ParseState *Parser, struct Value *ReturnValue, struct Valu
|
||||||
|
|
||||||
void LibStrncpy(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
void LibStrncpy(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
||||||
{
|
{
|
||||||
char *To = (char *)Param[0]->Val->NativePointer;
|
char *To = (char *)Param[0]->Val->Pointer;
|
||||||
char *From = (char *)Param[1]->Val->NativePointer;
|
char *From = (char *)Param[1]->Val->Pointer;
|
||||||
int Len = Param[2]->Val->Integer;
|
int Len = Param[2]->Val->Integer;
|
||||||
|
|
||||||
for (; *From != '\0' && Len > 0; Len--)
|
for (; *From != '\0' && Len > 0; Len--)
|
||||||
|
@ -479,8 +479,8 @@ void LibStrncpy(struct ParseState *Parser, struct Value *ReturnValue, struct Val
|
||||||
|
|
||||||
void LibStrcmp(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
void LibStrcmp(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
||||||
{
|
{
|
||||||
char *Str1 = (char *)Param[0]->Val->NativePointer;
|
char *Str1 = (char *)Param[0]->Val->Pointer;
|
||||||
char *Str2 = (char *)Param[1]->Val->NativePointer;
|
char *Str2 = (char *)Param[1]->Val->Pointer;
|
||||||
int StrEnded;
|
int StrEnded;
|
||||||
|
|
||||||
for (StrEnded = FALSE; !StrEnded; StrEnded = (*Str1 == '\0' || *Str2 == '\0'), Str1++, Str2++)
|
for (StrEnded = FALSE; !StrEnded; StrEnded = (*Str1 == '\0' || *Str2 == '\0'), Str1++, Str2++)
|
||||||
|
@ -494,8 +494,8 @@ void LibStrcmp(struct ParseState *Parser, struct Value *ReturnValue, struct Valu
|
||||||
|
|
||||||
void LibStrncmp(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
void LibStrncmp(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
||||||
{
|
{
|
||||||
char *Str1 = (char *)Param[0]->Val->NativePointer;
|
char *Str1 = (char *)Param[0]->Val->Pointer;
|
||||||
char *Str2 = (char *)Param[1]->Val->NativePointer;
|
char *Str2 = (char *)Param[1]->Val->Pointer;
|
||||||
int Len = Param[2]->Val->Integer;
|
int Len = Param[2]->Val->Integer;
|
||||||
int StrEnded;
|
int StrEnded;
|
||||||
|
|
||||||
|
@ -510,8 +510,8 @@ void LibStrncmp(struct ParseState *Parser, struct Value *ReturnValue, struct Val
|
||||||
|
|
||||||
void LibStrcat(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
void LibStrcat(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
||||||
{
|
{
|
||||||
char *To = (char *)Param[0]->Val->NativePointer;
|
char *To = (char *)Param[0]->Val->Pointer;
|
||||||
char *From = (char *)Param[1]->Val->NativePointer;
|
char *From = (char *)Param[1]->Val->Pointer;
|
||||||
|
|
||||||
while (*To != '\0')
|
while (*To != '\0')
|
||||||
To++;
|
To++;
|
||||||
|
@ -524,34 +524,34 @@ void LibStrcat(struct ParseState *Parser, struct Value *ReturnValue, struct Valu
|
||||||
|
|
||||||
void LibIndex(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
void LibIndex(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
||||||
{
|
{
|
||||||
char *Pos = (char *)Param[0]->Val->NativePointer;
|
char *Pos = (char *)Param[0]->Val->Pointer;
|
||||||
int SearchChar = Param[1]->Val->Integer;
|
int SearchChar = Param[1]->Val->Integer;
|
||||||
|
|
||||||
while (*Pos != '\0' && *Pos != SearchChar)
|
while (*Pos != '\0' && *Pos != SearchChar)
|
||||||
Pos++;
|
Pos++;
|
||||||
|
|
||||||
if (*Pos != SearchChar)
|
if (*Pos != SearchChar)
|
||||||
ReturnValue->Val->NativePointer = NULL;
|
ReturnValue->Val->Pointer = NULL;
|
||||||
else
|
else
|
||||||
ReturnValue->Val->NativePointer = Pos;
|
ReturnValue->Val->Pointer = Pos;
|
||||||
}
|
}
|
||||||
|
|
||||||
void LibRindex(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
void LibRindex(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
||||||
{
|
{
|
||||||
char *Pos = (char *)Param[0]->Val->NativePointer;
|
char *Pos = (char *)Param[0]->Val->Pointer;
|
||||||
int SearchChar = Param[1]->Val->Integer;
|
int SearchChar = Param[1]->Val->Integer;
|
||||||
|
|
||||||
ReturnValue->Val->NativePointer = NULL;
|
ReturnValue->Val->Pointer = NULL;
|
||||||
for (; *Pos != '\0'; Pos++)
|
for (; *Pos != '\0'; Pos++)
|
||||||
{
|
{
|
||||||
if (*Pos == SearchChar)
|
if (*Pos == SearchChar)
|
||||||
ReturnValue->Val->NativePointer = Pos;
|
ReturnValue->Val->Pointer = Pos;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void LibStrlen(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
void LibStrlen(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
||||||
{
|
{
|
||||||
char *Pos = (char *)Param[0]->Val->NativePointer;
|
char *Pos = (char *)Param[0]->Val->Pointer;
|
||||||
int Len;
|
int Len;
|
||||||
|
|
||||||
for (Len = 0; *Pos != '\0'; Pos++)
|
for (Len = 0; *Pos != '\0'; Pos++)
|
||||||
|
@ -563,19 +563,19 @@ void LibStrlen(struct ParseState *Parser, struct Value *ReturnValue, struct Valu
|
||||||
void LibMemset(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
void LibMemset(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
||||||
{
|
{
|
||||||
/* we can use the system memset() */
|
/* we can use the system memset() */
|
||||||
memset(Param[0]->Val->NativePointer, Param[1]->Val->Integer, Param[2]->Val->Integer);
|
memset(Param[0]->Val->Pointer, Param[1]->Val->Integer, Param[2]->Val->Integer);
|
||||||
}
|
}
|
||||||
|
|
||||||
void LibMemcpy(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
void LibMemcpy(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
||||||
{
|
{
|
||||||
/* we can use the system memcpy() */
|
/* we can use the system memcpy() */
|
||||||
memcpy(Param[0]->Val->NativePointer, Param[1]->Val->NativePointer, Param[2]->Val->Integer);
|
memcpy(Param[0]->Val->Pointer, Param[1]->Val->Pointer, Param[2]->Val->Integer);
|
||||||
}
|
}
|
||||||
|
|
||||||
void LibMemcmp(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
void LibMemcmp(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
||||||
{
|
{
|
||||||
unsigned char *Mem1 = (unsigned char *)Param[0]->Val->NativePointer;
|
unsigned char *Mem1 = (unsigned char *)Param[0]->Val->Pointer;
|
||||||
unsigned char *Mem2 = (unsigned char *)Param[1]->Val->NativePointer;
|
unsigned char *Mem2 = (unsigned char *)Param[1]->Val->Pointer;
|
||||||
int Len = Param[2]->Val->Integer;
|
int Len = Param[2]->Val->Integer;
|
||||||
|
|
||||||
for (; Len > 0; Mem1++, Mem2++, Len--)
|
for (; Len > 0; Mem1++, Mem2++, Len--)
|
||||||
|
|
|
@ -85,7 +85,7 @@ void MathFmod(struct ParseState *Parser, struct Value *ReturnValue, struct Value
|
||||||
|
|
||||||
void MathFrexp(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
void MathFrexp(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
||||||
{
|
{
|
||||||
ReturnValue->Val->FP = frexp(Param[0]->Val->FP, Param[1]->Val->NativePointer);
|
ReturnValue->Val->FP = frexp(Param[0]->Val->FP, Param[1]->Val->Pointer);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MathLdexp(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
void MathLdexp(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
||||||
|
@ -105,7 +105,7 @@ void MathLog10(struct ParseState *Parser, struct Value *ReturnValue, struct Valu
|
||||||
|
|
||||||
void MathModf(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
void MathModf(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
||||||
{
|
{
|
||||||
ReturnValue->Val->FP = modf(Param[0]->Val->FP, Param[0]->Val->NativePointer);
|
ReturnValue->Val->FP = modf(Param[0]->Val->FP, Param[0]->Val->Pointer);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MathPow(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
void MathPow(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
||||||
|
|
|
@ -269,7 +269,7 @@ int StdioBasePrintf(struct ParseState *Parser, FILE *Stream, char *StrOut, int S
|
||||||
else if (ShowType == CharPtrType)
|
else if (ShowType == CharPtrType)
|
||||||
{
|
{
|
||||||
if (ThisArg->Typ->Base == TypePointer)
|
if (ThisArg->Typ->Base == TypePointer)
|
||||||
StdioFprintfPointer(&SOStream, OneFormatBuf, ThisArg->Val->NativePointer);
|
StdioFprintfPointer(&SOStream, OneFormatBuf, ThisArg->Val->Pointer);
|
||||||
|
|
||||||
else if (ThisArg->Typ->Base == TypeArray && ThisArg->Typ->FromType->Base == TypeChar)
|
else if (ThisArg->Typ->Base == TypeArray && ThisArg->Typ->FromType->Base == TypeChar)
|
||||||
StdioFprintfPointer(&SOStream, OneFormatBuf, &ThisArg->Val->ArrayMem[0]);
|
StdioFprintfPointer(&SOStream, OneFormatBuf, &ThisArg->Val->ArrayMem[0]);
|
||||||
|
@ -280,7 +280,7 @@ int StdioBasePrintf(struct ParseState *Parser, FILE *Stream, char *StrOut, int S
|
||||||
else if (ShowType == VoidPtrType)
|
else if (ShowType == VoidPtrType)
|
||||||
{
|
{
|
||||||
if (ThisArg->Typ->Base == TypePointer)
|
if (ThisArg->Typ->Base == TypePointer)
|
||||||
StdioFprintfPointer(&SOStream, OneFormatBuf, ThisArg->Val->NativePointer);
|
StdioFprintfPointer(&SOStream, OneFormatBuf, ThisArg->Val->Pointer);
|
||||||
|
|
||||||
else if (ThisArg->Typ->Base == TypeArray)
|
else if (ThisArg->Typ->Base == TypeArray)
|
||||||
StdioFprintfPointer(&SOStream, OneFormatBuf, &ThisArg->Val->ArrayMem[0]);
|
StdioFprintfPointer(&SOStream, OneFormatBuf, &ThisArg->Val->ArrayMem[0]);
|
||||||
|
@ -323,7 +323,7 @@ int StdioBaseScanf(struct ParseState *Parser, FILE *Stream, char *StrIn, char *F
|
||||||
ThisArg = (struct Value *)((char *)ThisArg + MEM_ALIGN(sizeof(struct Value) + TypeStackSizeValue(ThisArg)));
|
ThisArg = (struct Value *)((char *)ThisArg + MEM_ALIGN(sizeof(struct Value) + TypeStackSizeValue(ThisArg)));
|
||||||
|
|
||||||
if (ThisArg->Typ->Base == TypePointer)
|
if (ThisArg->Typ->Base == TypePointer)
|
||||||
ScanfArg[ArgCount] = ThisArg->Val->NativePointer;
|
ScanfArg[ArgCount] = ThisArg->Val->Pointer;
|
||||||
|
|
||||||
else if (ThisArg->Typ->Base == TypeArray)
|
else if (ThisArg->Typ->Base == TypeArray)
|
||||||
ScanfArg[ArgCount] = &ThisArg->Val->ArrayMem[0];
|
ScanfArg[ArgCount] = &ThisArg->Val->ArrayMem[0];
|
||||||
|
@ -341,122 +341,122 @@ int StdioBaseScanf(struct ParseState *Parser, FILE *Stream, char *StrIn, char *F
|
||||||
/* stdio calls */
|
/* stdio calls */
|
||||||
void StdioFopen(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
void StdioFopen(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
||||||
{
|
{
|
||||||
ReturnValue->Val->NativePointer = fopen(Param[0]->Val->NativePointer, Param[1]->Val->NativePointer);
|
ReturnValue->Val->Pointer = fopen(Param[0]->Val->Pointer, Param[1]->Val->Pointer);
|
||||||
}
|
}
|
||||||
|
|
||||||
void StdioFreopen(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
void StdioFreopen(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
||||||
{
|
{
|
||||||
ReturnValue->Val->NativePointer = freopen(Param[0]->Val->NativePointer, Param[1]->Val->NativePointer, Param[2]->Val->NativePointer);
|
ReturnValue->Val->Pointer = freopen(Param[0]->Val->Pointer, Param[1]->Val->Pointer, Param[2]->Val->Pointer);
|
||||||
}
|
}
|
||||||
|
|
||||||
void StdioFclose(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
void StdioFclose(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
||||||
{
|
{
|
||||||
ReturnValue->Val->Integer = fclose(Param[0]->Val->NativePointer);
|
ReturnValue->Val->Integer = fclose(Param[0]->Val->Pointer);
|
||||||
}
|
}
|
||||||
|
|
||||||
void StdioFread(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
void StdioFread(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
||||||
{
|
{
|
||||||
ReturnValue->Val->Integer = fread(Param[0]->Val->NativePointer, Param[1]->Val->Integer, Param[2]->Val->Integer, Param[3]->Val->NativePointer);
|
ReturnValue->Val->Integer = fread(Param[0]->Val->Pointer, Param[1]->Val->Integer, Param[2]->Val->Integer, Param[3]->Val->Pointer);
|
||||||
}
|
}
|
||||||
|
|
||||||
void StdioFwrite(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
void StdioFwrite(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
||||||
{
|
{
|
||||||
ReturnValue->Val->Integer = fwrite(Param[0]->Val->NativePointer, Param[1]->Val->Integer, Param[2]->Val->Integer, Param[3]->Val->NativePointer);
|
ReturnValue->Val->Integer = fwrite(Param[0]->Val->Pointer, Param[1]->Val->Integer, Param[2]->Val->Integer, Param[3]->Val->Pointer);
|
||||||
}
|
}
|
||||||
|
|
||||||
void StdioFgetc(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
void StdioFgetc(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
||||||
{
|
{
|
||||||
ReturnValue->Val->Integer = fgetc(Param[0]->Val->NativePointer);
|
ReturnValue->Val->Integer = fgetc(Param[0]->Val->Pointer);
|
||||||
}
|
}
|
||||||
|
|
||||||
void StdioFgets(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
void StdioFgets(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
||||||
{
|
{
|
||||||
ReturnValue->Val->NativePointer = fgets(Param[0]->Val->NativePointer, Param[1]->Val->Integer, Param[2]->Val->NativePointer);
|
ReturnValue->Val->Pointer = fgets(Param[0]->Val->Pointer, Param[1]->Val->Integer, Param[2]->Val->Pointer);
|
||||||
}
|
}
|
||||||
|
|
||||||
void StdioRemove(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
void StdioRemove(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
||||||
{
|
{
|
||||||
ReturnValue->Val->Integer = remove(Param[0]->Val->NativePointer);
|
ReturnValue->Val->Integer = remove(Param[0]->Val->Pointer);
|
||||||
}
|
}
|
||||||
|
|
||||||
void StdioRename(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
void StdioRename(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
||||||
{
|
{
|
||||||
ReturnValue->Val->Integer = rename(Param[0]->Val->NativePointer, Param[1]->Val->NativePointer);
|
ReturnValue->Val->Integer = rename(Param[0]->Val->Pointer, Param[1]->Val->Pointer);
|
||||||
}
|
}
|
||||||
|
|
||||||
void StdioRewind(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
void StdioRewind(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
||||||
{
|
{
|
||||||
rewind(Param[0]->Val->NativePointer);
|
rewind(Param[0]->Val->Pointer);
|
||||||
}
|
}
|
||||||
|
|
||||||
void StdioTmpfile(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
void StdioTmpfile(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
||||||
{
|
{
|
||||||
ReturnValue->Val->NativePointer = tmpfile();
|
ReturnValue->Val->Pointer = tmpfile();
|
||||||
}
|
}
|
||||||
|
|
||||||
void StdioClearerr(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
void StdioClearerr(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
||||||
{
|
{
|
||||||
clearerr(Param[0]->Val->NativePointer);
|
clearerr(Param[0]->Val->Pointer);
|
||||||
}
|
}
|
||||||
|
|
||||||
void StdioFeof(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
void StdioFeof(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
||||||
{
|
{
|
||||||
ReturnValue->Val->Integer = feof(Param[0]->Val->NativePointer);
|
ReturnValue->Val->Integer = feof(Param[0]->Val->Pointer);
|
||||||
}
|
}
|
||||||
|
|
||||||
void StdioFerror(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
void StdioFerror(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
||||||
{
|
{
|
||||||
ReturnValue->Val->Integer = ferror(Param[0]->Val->NativePointer);
|
ReturnValue->Val->Integer = ferror(Param[0]->Val->Pointer);
|
||||||
}
|
}
|
||||||
|
|
||||||
void StdioFileno(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
void StdioFileno(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
||||||
{
|
{
|
||||||
ReturnValue->Val->Integer = fileno(Param[0]->Val->NativePointer);
|
ReturnValue->Val->Integer = fileno(Param[0]->Val->Pointer);
|
||||||
}
|
}
|
||||||
|
|
||||||
void StdioFflush(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
void StdioFflush(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
||||||
{
|
{
|
||||||
ReturnValue->Val->Integer = fflush(Param[0]->Val->NativePointer);
|
ReturnValue->Val->Integer = fflush(Param[0]->Val->Pointer);
|
||||||
}
|
}
|
||||||
|
|
||||||
void StdioFgetpos(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
void StdioFgetpos(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
||||||
{
|
{
|
||||||
ReturnValue->Val->Integer = fgetpos(Param[0]->Val->NativePointer, Param[1]->Val->NativePointer);
|
ReturnValue->Val->Integer = fgetpos(Param[0]->Val->Pointer, Param[1]->Val->Pointer);
|
||||||
}
|
}
|
||||||
|
|
||||||
void StdioFsetpos(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
void StdioFsetpos(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
||||||
{
|
{
|
||||||
ReturnValue->Val->Integer = fsetpos(Param[0]->Val->NativePointer, Param[1]->Val->NativePointer);
|
ReturnValue->Val->Integer = fsetpos(Param[0]->Val->Pointer, Param[1]->Val->Pointer);
|
||||||
}
|
}
|
||||||
|
|
||||||
void StdioFputc(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
void StdioFputc(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
||||||
{
|
{
|
||||||
ReturnValue->Val->Integer = fputc(Param[0]->Val->Integer, Param[1]->Val->NativePointer);
|
ReturnValue->Val->Integer = fputc(Param[0]->Val->Integer, Param[1]->Val->Pointer);
|
||||||
}
|
}
|
||||||
|
|
||||||
void StdioFputs(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
void StdioFputs(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
||||||
{
|
{
|
||||||
ReturnValue->Val->Integer = fputs(Param[0]->Val->NativePointer, Param[1]->Val->NativePointer);
|
ReturnValue->Val->Integer = fputs(Param[0]->Val->Pointer, Param[1]->Val->Pointer);
|
||||||
}
|
}
|
||||||
|
|
||||||
void StdioFtell(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
void StdioFtell(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
||||||
{
|
{
|
||||||
ReturnValue->Val->Integer = ftell(Param[0]->Val->NativePointer);
|
ReturnValue->Val->Integer = ftell(Param[0]->Val->Pointer);
|
||||||
}
|
}
|
||||||
|
|
||||||
void StdioFseek(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
void StdioFseek(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
||||||
{
|
{
|
||||||
ReturnValue->Val->Integer = fseek(Param[0]->Val->NativePointer, Param[1]->Val->Integer, Param[2]->Val->Integer);
|
ReturnValue->Val->Integer = fseek(Param[0]->Val->Pointer, Param[1]->Val->Integer, Param[2]->Val->Integer);
|
||||||
}
|
}
|
||||||
|
|
||||||
void StdioPerror(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
void StdioPerror(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
||||||
{
|
{
|
||||||
perror(Param[0]->Val->NativePointer);
|
perror(Param[0]->Val->Pointer);
|
||||||
}
|
}
|
||||||
|
|
||||||
void StdioPutc(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
void StdioPutc(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
||||||
{
|
{
|
||||||
ReturnValue->Val->Integer = putc(Param[0]->Val->Integer, Param[1]->Val->NativePointer);
|
ReturnValue->Val->Integer = putc(Param[0]->Val->Integer, Param[1]->Val->Pointer);
|
||||||
}
|
}
|
||||||
|
|
||||||
void StdioPutchar(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
void StdioPutchar(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
||||||
|
@ -466,27 +466,27 @@ void StdioPutchar(struct ParseState *Parser, struct Value *ReturnValue, struct V
|
||||||
|
|
||||||
void StdioSetbuf(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
void StdioSetbuf(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
||||||
{
|
{
|
||||||
setbuf(Param[0]->Val->NativePointer, Param[1]->Val->NativePointer);
|
setbuf(Param[0]->Val->Pointer, Param[1]->Val->Pointer);
|
||||||
}
|
}
|
||||||
|
|
||||||
void StdioSetvbuf(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
void StdioSetvbuf(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
||||||
{
|
{
|
||||||
setvbuf(Param[0]->Val->NativePointer, Param[1]->Val->NativePointer, Param[2]->Val->Integer, Param[3]->Val->Integer);
|
setvbuf(Param[0]->Val->Pointer, Param[1]->Val->Pointer, Param[2]->Val->Integer, Param[3]->Val->Integer);
|
||||||
}
|
}
|
||||||
|
|
||||||
void StdioUngetc(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
void StdioUngetc(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
||||||
{
|
{
|
||||||
ReturnValue->Val->Integer = ungetc(Param[0]->Val->Integer, Param[1]->Val->NativePointer);
|
ReturnValue->Val->Integer = ungetc(Param[0]->Val->Integer, Param[1]->Val->Pointer);
|
||||||
}
|
}
|
||||||
|
|
||||||
void StdioPuts(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
void StdioPuts(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
||||||
{
|
{
|
||||||
ReturnValue->Val->Integer = puts(Param[0]->Val->NativePointer);
|
ReturnValue->Val->Integer = puts(Param[0]->Val->Pointer);
|
||||||
}
|
}
|
||||||
|
|
||||||
void StdioGets(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
void StdioGets(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
||||||
{
|
{
|
||||||
ReturnValue->Val->NativePointer = fgets(Param[0]->Val->NativePointer, GETS_MAXValue, stdin);
|
ReturnValue->Val->Pointer = fgets(Param[0]->Val->Pointer, GETS_MAXValue, stdin);
|
||||||
}
|
}
|
||||||
|
|
||||||
void StdioGetchar(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
void StdioGetchar(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
||||||
|
@ -500,12 +500,12 @@ void StdioPrintf(struct ParseState *Parser, struct Value *ReturnValue, struct Va
|
||||||
|
|
||||||
PrintfArgs.Param = Param;
|
PrintfArgs.Param = Param;
|
||||||
PrintfArgs.NumArgs = NumArgs-1;
|
PrintfArgs.NumArgs = NumArgs-1;
|
||||||
ReturnValue->Val->Integer = StdioBasePrintf(Parser, stdout, NULL, 0, Param[0]->Val->NativePointer, &PrintfArgs);
|
ReturnValue->Val->Integer = StdioBasePrintf(Parser, stdout, NULL, 0, Param[0]->Val->Pointer, &PrintfArgs);
|
||||||
}
|
}
|
||||||
|
|
||||||
void StdioVprintf(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
void StdioVprintf(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
||||||
{
|
{
|
||||||
ReturnValue->Val->Integer = StdioBasePrintf(Parser, stdout, NULL, 0, Param[0]->Val->NativePointer, Param[1]->Val->NativePointer);
|
ReturnValue->Val->Integer = StdioBasePrintf(Parser, stdout, NULL, 0, Param[0]->Val->Pointer, Param[1]->Val->Pointer);
|
||||||
}
|
}
|
||||||
|
|
||||||
void StdioFprintf(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
void StdioFprintf(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
||||||
|
@ -514,12 +514,12 @@ void StdioFprintf(struct ParseState *Parser, struct Value *ReturnValue, struct V
|
||||||
|
|
||||||
PrintfArgs.Param = Param + 1;
|
PrintfArgs.Param = Param + 1;
|
||||||
PrintfArgs.NumArgs = NumArgs-2;
|
PrintfArgs.NumArgs = NumArgs-2;
|
||||||
ReturnValue->Val->Integer = StdioBasePrintf(Parser, Param[0]->Val->NativePointer, NULL, 0, Param[1]->Val->NativePointer, &PrintfArgs);
|
ReturnValue->Val->Integer = StdioBasePrintf(Parser, Param[0]->Val->Pointer, NULL, 0, Param[1]->Val->Pointer, &PrintfArgs);
|
||||||
}
|
}
|
||||||
|
|
||||||
void StdioVfprintf(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
void StdioVfprintf(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
||||||
{
|
{
|
||||||
ReturnValue->Val->Integer = StdioBasePrintf(Parser, Param[0]->Val->NativePointer, NULL, 0, Param[1]->Val->NativePointer, Param[2]->Val->NativePointer);
|
ReturnValue->Val->Integer = StdioBasePrintf(Parser, Param[0]->Val->Pointer, NULL, 0, Param[1]->Val->Pointer, Param[2]->Val->Pointer);
|
||||||
}
|
}
|
||||||
|
|
||||||
void StdioSprintf(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
void StdioSprintf(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
||||||
|
@ -528,7 +528,7 @@ void StdioSprintf(struct ParseState *Parser, struct Value *ReturnValue, struct V
|
||||||
|
|
||||||
PrintfArgs.Param = Param + 1;
|
PrintfArgs.Param = Param + 1;
|
||||||
PrintfArgs.NumArgs = NumArgs-2;
|
PrintfArgs.NumArgs = NumArgs-2;
|
||||||
ReturnValue->Val->Integer = StdioBasePrintf(Parser, NULL, Param[0]->Val->NativePointer, -1, Param[1]->Val->NativePointer, &PrintfArgs);
|
ReturnValue->Val->Integer = StdioBasePrintf(Parser, NULL, Param[0]->Val->Pointer, -1, Param[1]->Val->Pointer, &PrintfArgs);
|
||||||
}
|
}
|
||||||
|
|
||||||
void StdioSnprintf(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
void StdioSnprintf(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
||||||
|
@ -537,7 +537,7 @@ void StdioSnprintf(struct ParseState *Parser, struct Value *ReturnValue, struct
|
||||||
|
|
||||||
PrintfArgs.Param = Param+2;
|
PrintfArgs.Param = Param+2;
|
||||||
PrintfArgs.NumArgs = NumArgs-3;
|
PrintfArgs.NumArgs = NumArgs-3;
|
||||||
ReturnValue->Val->Integer = StdioBasePrintf(Parser, NULL, Param[0]->Val->NativePointer, Param[1]->Val->Integer, Param[2]->Val->NativePointer, &PrintfArgs);
|
ReturnValue->Val->Integer = StdioBasePrintf(Parser, NULL, Param[0]->Val->Pointer, Param[1]->Val->Integer, Param[2]->Val->Pointer, &PrintfArgs);
|
||||||
}
|
}
|
||||||
|
|
||||||
void StdioScanf(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
void StdioScanf(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
||||||
|
@ -546,7 +546,7 @@ void StdioScanf(struct ParseState *Parser, struct Value *ReturnValue, struct Val
|
||||||
|
|
||||||
ScanfArgs.Param = Param;
|
ScanfArgs.Param = Param;
|
||||||
ScanfArgs.NumArgs = NumArgs-1;
|
ScanfArgs.NumArgs = NumArgs-1;
|
||||||
ReturnValue->Val->Integer = StdioBaseScanf(Parser, stdin, NULL, Param[0]->Val->NativePointer, &ScanfArgs);
|
ReturnValue->Val->Integer = StdioBaseScanf(Parser, stdin, NULL, Param[0]->Val->Pointer, &ScanfArgs);
|
||||||
}
|
}
|
||||||
|
|
||||||
void StdioFscanf(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
void StdioFscanf(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
||||||
|
@ -555,7 +555,7 @@ void StdioFscanf(struct ParseState *Parser, struct Value *ReturnValue, struct Va
|
||||||
|
|
||||||
ScanfArgs.Param = Param+1;
|
ScanfArgs.Param = Param+1;
|
||||||
ScanfArgs.NumArgs = NumArgs-2;
|
ScanfArgs.NumArgs = NumArgs-2;
|
||||||
ReturnValue->Val->Integer = StdioBaseScanf(Parser, Param[0]->Val->NativePointer, NULL, Param[1]->Val->NativePointer, &ScanfArgs);
|
ReturnValue->Val->Integer = StdioBaseScanf(Parser, Param[0]->Val->Pointer, NULL, Param[1]->Val->Pointer, &ScanfArgs);
|
||||||
}
|
}
|
||||||
|
|
||||||
void StdioSscanf(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
void StdioSscanf(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
||||||
|
@ -564,32 +564,32 @@ void StdioSscanf(struct ParseState *Parser, struct Value *ReturnValue, struct Va
|
||||||
|
|
||||||
ScanfArgs.Param = Param+1;
|
ScanfArgs.Param = Param+1;
|
||||||
ScanfArgs.NumArgs = NumArgs-2;
|
ScanfArgs.NumArgs = NumArgs-2;
|
||||||
ReturnValue->Val->Integer = StdioBaseScanf(Parser, NULL, Param[0]->Val->NativePointer, Param[1]->Val->NativePointer, &ScanfArgs);
|
ReturnValue->Val->Integer = StdioBaseScanf(Parser, NULL, Param[0]->Val->Pointer, Param[1]->Val->Pointer, &ScanfArgs);
|
||||||
}
|
}
|
||||||
|
|
||||||
void StdioVsprintf(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
void StdioVsprintf(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
||||||
{
|
{
|
||||||
ReturnValue->Val->Integer = StdioBasePrintf(Parser, NULL, Param[0]->Val->NativePointer, -1, Param[1]->Val->NativePointer, Param[2]->Val->NativePointer);
|
ReturnValue->Val->Integer = StdioBasePrintf(Parser, NULL, Param[0]->Val->Pointer, -1, Param[1]->Val->Pointer, Param[2]->Val->Pointer);
|
||||||
}
|
}
|
||||||
|
|
||||||
void StdioVsnprintf(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
void StdioVsnprintf(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
||||||
{
|
{
|
||||||
ReturnValue->Val->Integer = StdioBasePrintf(Parser, NULL, Param[0]->Val->NativePointer, Param[1]->Val->Integer, Param[2]->Val->NativePointer, Param[3]->Val->NativePointer);
|
ReturnValue->Val->Integer = StdioBasePrintf(Parser, NULL, Param[0]->Val->Pointer, Param[1]->Val->Integer, Param[2]->Val->Pointer, Param[3]->Val->Pointer);
|
||||||
}
|
}
|
||||||
|
|
||||||
void StdioVscanf(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
void StdioVscanf(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
||||||
{
|
{
|
||||||
ReturnValue->Val->Integer = StdioBaseScanf(Parser, stdin, NULL, Param[0]->Val->NativePointer, Param[1]->Val->NativePointer);
|
ReturnValue->Val->Integer = StdioBaseScanf(Parser, stdin, NULL, Param[0]->Val->Pointer, Param[1]->Val->Pointer);
|
||||||
}
|
}
|
||||||
|
|
||||||
void StdioVfscanf(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
void StdioVfscanf(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
||||||
{
|
{
|
||||||
ReturnValue->Val->Integer = StdioBaseScanf(Parser, Param[0]->Val->NativePointer, NULL, Param[1]->Val->NativePointer, Param[2]->Val->NativePointer);
|
ReturnValue->Val->Integer = StdioBaseScanf(Parser, Param[0]->Val->Pointer, NULL, Param[1]->Val->Pointer, Param[2]->Val->Pointer);
|
||||||
}
|
}
|
||||||
|
|
||||||
void StdioVsscanf(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
void StdioVsscanf(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
||||||
{
|
{
|
||||||
ReturnValue->Val->Integer = StdioBaseScanf(Parser, NULL, Param[0]->Val->NativePointer, Param[1]->Val->NativePointer, Param[2]->Val->NativePointer);
|
ReturnValue->Val->Integer = StdioBaseScanf(Parser, NULL, Param[0]->Val->Pointer, Param[1]->Val->Pointer, Param[2]->Val->Pointer);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* handy structure definitions */
|
/* handy structure definitions */
|
||||||
|
|
|
@ -8,52 +8,52 @@ static int TRUEValue = 1;
|
||||||
|
|
||||||
void StdlibAtof(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
void StdlibAtof(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
||||||
{
|
{
|
||||||
ReturnValue->Val->FP = atof(Param[0]->Val->NativePointer);
|
ReturnValue->Val->FP = atof(Param[0]->Val->Pointer);
|
||||||
}
|
}
|
||||||
|
|
||||||
void StdlibAtoi(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
void StdlibAtoi(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
||||||
{
|
{
|
||||||
ReturnValue->Val->Integer = atoi(Param[0]->Val->NativePointer);
|
ReturnValue->Val->Integer = atoi(Param[0]->Val->Pointer);
|
||||||
}
|
}
|
||||||
|
|
||||||
void StdlibAtol(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
void StdlibAtol(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
||||||
{
|
{
|
||||||
ReturnValue->Val->Integer = atol(Param[0]->Val->NativePointer);
|
ReturnValue->Val->Integer = atol(Param[0]->Val->Pointer);
|
||||||
}
|
}
|
||||||
|
|
||||||
void StdlibStrtod(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
void StdlibStrtod(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
||||||
{
|
{
|
||||||
ReturnValue->Val->FP = strtod(Param[0]->Val->NativePointer, Param[1]->Val->NativePointer);
|
ReturnValue->Val->FP = strtod(Param[0]->Val->Pointer, Param[1]->Val->Pointer);
|
||||||
}
|
}
|
||||||
|
|
||||||
void StdlibStrtol(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
void StdlibStrtol(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
||||||
{
|
{
|
||||||
ReturnValue->Val->Integer = strtol(Param[0]->Val->NativePointer, Param[1]->Val->NativePointer, Param[2]->Val->Integer);
|
ReturnValue->Val->Integer = strtol(Param[0]->Val->Pointer, Param[1]->Val->Pointer, Param[2]->Val->Integer);
|
||||||
}
|
}
|
||||||
|
|
||||||
void StdlibStrtoul(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
void StdlibStrtoul(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
||||||
{
|
{
|
||||||
ReturnValue->Val->Integer = strtoul(Param[0]->Val->NativePointer, Param[1]->Val->NativePointer, Param[2]->Val->Integer);
|
ReturnValue->Val->Integer = strtoul(Param[0]->Val->Pointer, Param[1]->Val->Pointer, Param[2]->Val->Integer);
|
||||||
}
|
}
|
||||||
|
|
||||||
void StdlibMalloc(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
void StdlibMalloc(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
||||||
{
|
{
|
||||||
ReturnValue->Val->NativePointer = malloc(Param[0]->Val->Integer);
|
ReturnValue->Val->Pointer = malloc(Param[0]->Val->Integer);
|
||||||
}
|
}
|
||||||
|
|
||||||
void StdlibCalloc(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
void StdlibCalloc(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
||||||
{
|
{
|
||||||
ReturnValue->Val->NativePointer = calloc(Param[0]->Val->Integer, Param[1]->Val->Integer);
|
ReturnValue->Val->Pointer = calloc(Param[0]->Val->Integer, Param[1]->Val->Integer);
|
||||||
}
|
}
|
||||||
|
|
||||||
void StdlibRealloc(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
void StdlibRealloc(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
||||||
{
|
{
|
||||||
ReturnValue->Val->NativePointer = realloc(Param[0]->Val->NativePointer, Param[1]->Val->Integer);
|
ReturnValue->Val->Pointer = realloc(Param[0]->Val->Pointer, Param[1]->Val->Integer);
|
||||||
}
|
}
|
||||||
|
|
||||||
void StdlibFree(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
void StdlibFree(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
||||||
{
|
{
|
||||||
free(Param[0]->Val->NativePointer);
|
free(Param[0]->Val->Pointer);
|
||||||
}
|
}
|
||||||
|
|
||||||
void StdlibRand(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
void StdlibRand(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
||||||
|
@ -78,12 +78,12 @@ void StdlibExit(struct ParseState *Parser, struct Value *ReturnValue, struct Val
|
||||||
|
|
||||||
void StdlibGetenv(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
void StdlibGetenv(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
||||||
{
|
{
|
||||||
ReturnValue->Val->NativePointer = getenv(Param[0]->Val->NativePointer);
|
ReturnValue->Val->Pointer = getenv(Param[0]->Val->Pointer);
|
||||||
}
|
}
|
||||||
|
|
||||||
void StdlibSystem(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
void StdlibSystem(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
||||||
{
|
{
|
||||||
ReturnValue->Val->Integer = system(Param[0]->Val->NativePointer);
|
ReturnValue->Val->Integer = system(Param[0]->Val->Pointer);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* all stdlib.h functions */
|
/* all stdlib.h functions */
|
||||||
|
|
|
@ -7,132 +7,132 @@ static int ZeroValue = 0;
|
||||||
|
|
||||||
void StringStrcpy(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
void StringStrcpy(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
||||||
{
|
{
|
||||||
ReturnValue->Val->NativePointer = strcpy(Param[0]->Val->NativePointer, Param[1]->Val->NativePointer);
|
ReturnValue->Val->Pointer = strcpy(Param[0]->Val->Pointer, Param[1]->Val->Pointer);
|
||||||
}
|
}
|
||||||
|
|
||||||
void StringStrncpy(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
void StringStrncpy(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
||||||
{
|
{
|
||||||
ReturnValue->Val->NativePointer = strncpy(Param[0]->Val->NativePointer, Param[1]->Val->NativePointer, Param[2]->Val->Integer);
|
ReturnValue->Val->Pointer = strncpy(Param[0]->Val->Pointer, Param[1]->Val->Pointer, Param[2]->Val->Integer);
|
||||||
}
|
}
|
||||||
|
|
||||||
void StringStrcmp(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
void StringStrcmp(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
||||||
{
|
{
|
||||||
ReturnValue->Val->Integer = strcmp(Param[0]->Val->NativePointer, Param[1]->Val->NativePointer);
|
ReturnValue->Val->Integer = strcmp(Param[0]->Val->Pointer, Param[1]->Val->Pointer);
|
||||||
}
|
}
|
||||||
|
|
||||||
void StringStrncmp(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
void StringStrncmp(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
||||||
{
|
{
|
||||||
ReturnValue->Val->Integer = strncmp(Param[0]->Val->NativePointer, Param[1]->Val->NativePointer, Param[2]->Val->Integer);
|
ReturnValue->Val->Integer = strncmp(Param[0]->Val->Pointer, Param[1]->Val->Pointer, Param[2]->Val->Integer);
|
||||||
}
|
}
|
||||||
|
|
||||||
void StringStrcat(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
void StringStrcat(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
||||||
{
|
{
|
||||||
ReturnValue->Val->NativePointer = strcat(Param[0]->Val->NativePointer, Param[1]->Val->NativePointer);
|
ReturnValue->Val->Pointer = strcat(Param[0]->Val->Pointer, Param[1]->Val->Pointer);
|
||||||
}
|
}
|
||||||
|
|
||||||
void StringStrncat(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
void StringStrncat(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
||||||
{
|
{
|
||||||
ReturnValue->Val->NativePointer = strncat(Param[0]->Val->NativePointer, Param[1]->Val->NativePointer, Param[2]->Val->Integer);
|
ReturnValue->Val->Pointer = strncat(Param[0]->Val->Pointer, Param[1]->Val->Pointer, Param[2]->Val->Integer);
|
||||||
}
|
}
|
||||||
|
|
||||||
void StringIndex(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
void StringIndex(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
||||||
{
|
{
|
||||||
ReturnValue->Val->NativePointer = index(Param[0]->Val->NativePointer, Param[1]->Val->Integer);
|
ReturnValue->Val->Pointer = index(Param[0]->Val->Pointer, Param[1]->Val->Integer);
|
||||||
}
|
}
|
||||||
|
|
||||||
void StringRindex(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
void StringRindex(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
||||||
{
|
{
|
||||||
ReturnValue->Val->NativePointer = rindex(Param[0]->Val->NativePointer, Param[1]->Val->Integer);
|
ReturnValue->Val->Pointer = rindex(Param[0]->Val->Pointer, Param[1]->Val->Integer);
|
||||||
}
|
}
|
||||||
|
|
||||||
void StringStrlen(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
void StringStrlen(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
||||||
{
|
{
|
||||||
ReturnValue->Val->Integer = strlen(Param[0]->Val->NativePointer);
|
ReturnValue->Val->Integer = strlen(Param[0]->Val->Pointer);
|
||||||
}
|
}
|
||||||
|
|
||||||
void StringMemset(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
void StringMemset(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
||||||
{
|
{
|
||||||
ReturnValue->Val->NativePointer = memset(Param[0]->Val->NativePointer, Param[1]->Val->Integer, Param[2]->Val->Integer);
|
ReturnValue->Val->Pointer = memset(Param[0]->Val->Pointer, Param[1]->Val->Integer, Param[2]->Val->Integer);
|
||||||
}
|
}
|
||||||
|
|
||||||
void StringMemcpy(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
void StringMemcpy(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
||||||
{
|
{
|
||||||
ReturnValue->Val->NativePointer = memcpy(Param[0]->Val->NativePointer, Param[1]->Val->NativePointer, Param[2]->Val->Integer);
|
ReturnValue->Val->Pointer = memcpy(Param[0]->Val->Pointer, Param[1]->Val->Pointer, Param[2]->Val->Integer);
|
||||||
}
|
}
|
||||||
|
|
||||||
void StringMemcmp(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
void StringMemcmp(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
||||||
{
|
{
|
||||||
ReturnValue->Val->Integer = memcmp(Param[0]->Val->NativePointer, Param[1]->Val->NativePointer, Param[2]->Val->Integer);
|
ReturnValue->Val->Integer = memcmp(Param[0]->Val->Pointer, Param[1]->Val->Pointer, Param[2]->Val->Integer);
|
||||||
}
|
}
|
||||||
|
|
||||||
void StringMemmove(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
void StringMemmove(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
||||||
{
|
{
|
||||||
ReturnValue->Val->NativePointer = memmove(Param[0]->Val->NativePointer, Param[1]->Val->NativePointer, Param[2]->Val->Integer);
|
ReturnValue->Val->Pointer = memmove(Param[0]->Val->Pointer, Param[1]->Val->Pointer, Param[2]->Val->Integer);
|
||||||
}
|
}
|
||||||
|
|
||||||
void StringMemchr(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
void StringMemchr(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
||||||
{
|
{
|
||||||
ReturnValue->Val->NativePointer = memchr(Param[0]->Val->NativePointer, Param[1]->Val->Integer, Param[2]->Val->Integer);
|
ReturnValue->Val->Pointer = memchr(Param[0]->Val->Pointer, Param[1]->Val->Integer, Param[2]->Val->Integer);
|
||||||
}
|
}
|
||||||
|
|
||||||
void StringStrchr(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
void StringStrchr(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
||||||
{
|
{
|
||||||
ReturnValue->Val->NativePointer = strchr(Param[0]->Val->NativePointer, Param[1]->Val->Integer);
|
ReturnValue->Val->Pointer = strchr(Param[0]->Val->Pointer, Param[1]->Val->Integer);
|
||||||
}
|
}
|
||||||
|
|
||||||
void StringStrrchr(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
void StringStrrchr(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
||||||
{
|
{
|
||||||
ReturnValue->Val->NativePointer = strrchr(Param[0]->Val->NativePointer, Param[1]->Val->Integer);
|
ReturnValue->Val->Pointer = strrchr(Param[0]->Val->Pointer, Param[1]->Val->Integer);
|
||||||
}
|
}
|
||||||
|
|
||||||
void StringStrcoll(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
void StringStrcoll(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
||||||
{
|
{
|
||||||
ReturnValue->Val->Integer = strcoll(Param[0]->Val->NativePointer, Param[1]->Val->NativePointer);
|
ReturnValue->Val->Integer = strcoll(Param[0]->Val->Pointer, Param[1]->Val->Pointer);
|
||||||
}
|
}
|
||||||
|
|
||||||
void StringStrerror(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
void StringStrerror(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
||||||
{
|
{
|
||||||
ReturnValue->Val->NativePointer = strerror(Param[0]->Val->Integer);
|
ReturnValue->Val->Pointer = strerror(Param[0]->Val->Integer);
|
||||||
}
|
}
|
||||||
|
|
||||||
void StringStrspn(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
void StringStrspn(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
||||||
{
|
{
|
||||||
ReturnValue->Val->Integer = strspn(Param[0]->Val->NativePointer, Param[1]->Val->NativePointer);
|
ReturnValue->Val->Integer = strspn(Param[0]->Val->Pointer, Param[1]->Val->Pointer);
|
||||||
}
|
}
|
||||||
|
|
||||||
void StringStrcspn(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
void StringStrcspn(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
||||||
{
|
{
|
||||||
ReturnValue->Val->Integer = strcspn(Param[0]->Val->NativePointer, Param[1]->Val->NativePointer);
|
ReturnValue->Val->Integer = strcspn(Param[0]->Val->Pointer, Param[1]->Val->Pointer);
|
||||||
}
|
}
|
||||||
|
|
||||||
void StringStrpbrk(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
void StringStrpbrk(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
||||||
{
|
{
|
||||||
ReturnValue->Val->NativePointer = strpbrk(Param[0]->Val->NativePointer, Param[1]->Val->NativePointer);
|
ReturnValue->Val->Pointer = strpbrk(Param[0]->Val->Pointer, Param[1]->Val->Pointer);
|
||||||
}
|
}
|
||||||
|
|
||||||
void StringStrstr(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
void StringStrstr(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
||||||
{
|
{
|
||||||
ReturnValue->Val->NativePointer = strstr(Param[0]->Val->NativePointer, Param[1]->Val->NativePointer);
|
ReturnValue->Val->Pointer = strstr(Param[0]->Val->Pointer, Param[1]->Val->Pointer);
|
||||||
}
|
}
|
||||||
|
|
||||||
void StringStrtok(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
void StringStrtok(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
||||||
{
|
{
|
||||||
ReturnValue->Val->NativePointer = strtok(Param[0]->Val->NativePointer, Param[1]->Val->NativePointer);
|
ReturnValue->Val->Pointer = strtok(Param[0]->Val->Pointer, Param[1]->Val->Pointer);
|
||||||
}
|
}
|
||||||
|
|
||||||
void StringStrxfrm(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
void StringStrxfrm(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
||||||
{
|
{
|
||||||
ReturnValue->Val->Integer = strxfrm(Param[0]->Val->NativePointer, Param[1]->Val->NativePointer, Param[2]->Val->Integer);
|
ReturnValue->Val->Integer = strxfrm(Param[0]->Val->Pointer, Param[1]->Val->Pointer, Param[2]->Val->Integer);
|
||||||
}
|
}
|
||||||
|
|
||||||
void StringStrdup(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
void StringStrdup(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
||||||
{
|
{
|
||||||
ReturnValue->Val->NativePointer = strdup(Param[0]->Val->NativePointer);
|
ReturnValue->Val->Pointer = strdup(Param[0]->Val->Pointer);
|
||||||
}
|
}
|
||||||
|
|
||||||
void StringStrtok_r(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
void StringStrtok_r(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
||||||
{
|
{
|
||||||
ReturnValue->Val->NativePointer = strtok_r(Param[0]->Val->NativePointer, Param[1]->Val->NativePointer, Param[2]->Val->NativePointer);
|
ReturnValue->Val->Pointer = strtok_r(Param[0]->Val->Pointer, Param[1]->Val->Pointer, Param[2]->Val->Pointer);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* all string.h functions */
|
/* all string.h functions */
|
||||||
|
|
64
expression.c
64
expression.c
|
@ -99,12 +99,12 @@ void ExpressionStackShow(struct ExpressionStack *StackTop)
|
||||||
case TypeFunction: printf("%s:function", StackTop->Val->Val->Identifier); break;
|
case TypeFunction: printf("%s:function", StackTop->Val->Val->Identifier); break;
|
||||||
case TypeMacro: printf("%s:macro", StackTop->Val->Val->Identifier); break;
|
case TypeMacro: printf("%s:macro", StackTop->Val->Val->Identifier); break;
|
||||||
case TypePointer:
|
case TypePointer:
|
||||||
if (StackTop->Val->Val->NativePointer == NULL)
|
if (StackTop->Val->Val->Pointer == NULL)
|
||||||
printf("ptr(NULL)");
|
printf("ptr(NULL)");
|
||||||
else if (StackTop->Val->Typ->FromType->Base == TypeChar)
|
else if (StackTop->Val->Typ->FromType->Base == TypeChar)
|
||||||
printf("\"%s\":string", (char *)StackTop->Val->Val->NativePointer);
|
printf("\"%s\":string", (char *)StackTop->Val->Val->Pointer);
|
||||||
else
|
else
|
||||||
printf("ptr(0x%lx)", (long)StackTop->Val->Val->NativePointer);
|
printf("ptr(0x%lx)", (long)StackTop->Val->Val->Pointer);
|
||||||
break;
|
break;
|
||||||
case TypeArray: printf("array"); break;
|
case TypeArray: printf("array"); break;
|
||||||
case TypeStruct: printf("%s:struct", StackTop->Val->Val->Identifier); break;
|
case TypeStruct: printf("%s:struct", StackTop->Val->Val->Identifier); break;
|
||||||
|
@ -144,7 +144,7 @@ long ExpressionCoerceInteger(struct Value *Val)
|
||||||
case TypeUnsignedInt: return (long)Val->Val->UnsignedInteger;
|
case TypeUnsignedInt: return (long)Val->Val->UnsignedInteger;
|
||||||
case TypeUnsignedShort: return (long)Val->Val->UnsignedShortInteger;
|
case TypeUnsignedShort: return (long)Val->Val->UnsignedShortInteger;
|
||||||
case TypeUnsignedLong: return (long)Val->Val->UnsignedLongInteger;
|
case TypeUnsignedLong: return (long)Val->Val->UnsignedLongInteger;
|
||||||
case TypePointer: return (long)Val->Val->NativePointer;
|
case TypePointer: return (long)Val->Val->Pointer;
|
||||||
#ifndef NO_FP
|
#ifndef NO_FP
|
||||||
case TypeFP: return (long)Val->Val->FP;
|
case TypeFP: return (long)Val->Val->FP;
|
||||||
#endif
|
#endif
|
||||||
|
@ -163,7 +163,7 @@ unsigned long ExpressionCoerceUnsignedInteger(struct Value *Val)
|
||||||
case TypeUnsignedInt: return (unsigned long)Val->Val->UnsignedInteger;
|
case TypeUnsignedInt: return (unsigned long)Val->Val->UnsignedInteger;
|
||||||
case TypeUnsignedShort: return (unsigned long)Val->Val->UnsignedShortInteger;
|
case TypeUnsignedShort: return (unsigned long)Val->Val->UnsignedShortInteger;
|
||||||
case TypeUnsignedLong: return (unsigned long)Val->Val->UnsignedLongInteger;
|
case TypeUnsignedLong: return (unsigned long)Val->Val->UnsignedLongInteger;
|
||||||
case TypePointer: return (unsigned long)Val->Val->NativePointer;
|
case TypePointer: return (unsigned long)Val->Val->Pointer;
|
||||||
#ifndef NO_FP
|
#ifndef NO_FP
|
||||||
case TypeFP: return (unsigned long)Val->Val->FP;
|
case TypeFP: return (unsigned long)Val->Val->FP;
|
||||||
#endif
|
#endif
|
||||||
|
@ -321,28 +321,28 @@ void ExpressionAssignToPointer(struct ParseState *Parser, struct Value *ToValue,
|
||||||
struct ValueType *PointedToType = ToValue->Typ->FromType;
|
struct ValueType *PointedToType = ToValue->Typ->FromType;
|
||||||
|
|
||||||
if (FromValue->Typ == ToValue->Typ || FromValue->Typ == VoidPtrType || (ToValue->Typ == VoidPtrType && FromValue->Typ->Base == TypePointer))
|
if (FromValue->Typ == ToValue->Typ || FromValue->Typ == VoidPtrType || (ToValue->Typ == VoidPtrType && FromValue->Typ->Base == TypePointer))
|
||||||
ToValue->Val->NativePointer = FromValue->Val->NativePointer; /* plain old pointer assignment */
|
ToValue->Val->Pointer = FromValue->Val->Pointer; /* plain old pointer assignment */
|
||||||
|
|
||||||
else if (FromValue->Typ->Base == TypeArray && (PointedToType == FromValue->Typ->FromType || ToValue->Typ == VoidPtrType))
|
else if (FromValue->Typ->Base == TypeArray && (PointedToType == FromValue->Typ->FromType || ToValue->Typ == VoidPtrType))
|
||||||
{
|
{
|
||||||
/* the form is: blah *x = array of blah */
|
/* the form is: blah *x = array of blah */
|
||||||
ToValue->Val->NativePointer = (void *)&FromValue->Val->ArrayMem[0];
|
ToValue->Val->Pointer = (void *)&FromValue->Val->ArrayMem[0];
|
||||||
}
|
}
|
||||||
else if (FromValue->Typ->Base == TypePointer && FromValue->Typ->FromType->Base == TypeArray &&
|
else if (FromValue->Typ->Base == TypePointer && FromValue->Typ->FromType->Base == TypeArray &&
|
||||||
(PointedToType == FromValue->Typ->FromType->FromType || ToValue->Typ == VoidPtrType) )
|
(PointedToType == FromValue->Typ->FromType->FromType || ToValue->Typ == VoidPtrType) )
|
||||||
{
|
{
|
||||||
/* the form is: blah *x = pointer to array of blah */
|
/* the form is: blah *x = pointer to array of blah */
|
||||||
ToValue->Val->NativePointer = VariableDereferencePointer(Parser, FromValue, NULL, NULL, NULL, NULL);
|
ToValue->Val->Pointer = VariableDereferencePointer(Parser, FromValue, NULL, NULL, NULL, NULL);
|
||||||
}
|
}
|
||||||
else if (IS_NUMERIC_COERCIBLE(FromValue) && ExpressionCoerceInteger(FromValue) == 0)
|
else if (IS_NUMERIC_COERCIBLE(FromValue) && ExpressionCoerceInteger(FromValue) == 0)
|
||||||
{
|
{
|
||||||
/* null pointer assignment */
|
/* null pointer assignment */
|
||||||
ToValue->Val->NativePointer = NULL;
|
ToValue->Val->Pointer = NULL;
|
||||||
}
|
}
|
||||||
else if (AllowPointerCoercion && IS_NUMERIC_COERCIBLE(FromValue))
|
else if (AllowPointerCoercion && IS_NUMERIC_COERCIBLE(FromValue))
|
||||||
{
|
{
|
||||||
/* assign integer to native pointer */
|
/* assign integer to native pointer */
|
||||||
ToValue->Val->NativePointer = (void *)(unsigned long)ExpressionCoerceUnsignedInteger(FromValue);
|
ToValue->Val->Pointer = (void *)(unsigned long)ExpressionCoerceUnsignedInteger(FromValue);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
AssignFail(Parser, "%t from %t", ToValue->Typ, FromValue->Typ, 0, 0, FuncName, ParamNo);
|
AssignFail(Parser, "%t from %t", ToValue->Typ, FromValue->Typ, 0, 0, FuncName, ParamNo);
|
||||||
|
@ -425,7 +425,7 @@ void ExpressionPrefixOperator(struct ParseState *Parser, struct ExpressionStack
|
||||||
|
|
||||||
ValPtr = TopValue->Val;
|
ValPtr = TopValue->Val;
|
||||||
Result = VariableAllocValueFromType(Parser, TypeGetMatching(Parser, TopValue->Typ, TypePointer, 0, StrEmpty), FALSE, NULL, FALSE);
|
Result = VariableAllocValueFromType(Parser, TypeGetMatching(Parser, TopValue->Typ, TypePointer, 0, StrEmpty), FALSE, NULL, FALSE);
|
||||||
Result->Val->NativePointer = (void *)ValPtr;
|
Result->Val->Pointer = (void *)ValPtr;
|
||||||
ExpressionStackPushValueNode(Parser, StackTop, Result);
|
ExpressionStackPushValueNode(Parser, StackTop, Result);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -495,7 +495,7 @@ void ExpressionPrefixOperator(struct ParseState *Parser, struct ExpressionStack
|
||||||
struct Value *StackValue;
|
struct Value *StackValue;
|
||||||
void *ResultPtr;
|
void *ResultPtr;
|
||||||
|
|
||||||
if (TopValue->Val->NativePointer == NULL)
|
if (TopValue->Val->Pointer == NULL)
|
||||||
ProgramFail(Parser, "invalid use of a NULL pointer");
|
ProgramFail(Parser, "invalid use of a NULL pointer");
|
||||||
|
|
||||||
if (!TopValue->IsLValue)
|
if (!TopValue->IsLValue)
|
||||||
|
@ -503,14 +503,14 @@ void ExpressionPrefixOperator(struct ParseState *Parser, struct ExpressionStack
|
||||||
|
|
||||||
switch (Op)
|
switch (Op)
|
||||||
{
|
{
|
||||||
case TokenIncrement: TopValue->Val->NativePointer = (void *)((char *)TopValue->Val->NativePointer + Size); break;
|
case TokenIncrement: TopValue->Val->Pointer = (void *)((char *)TopValue->Val->Pointer + Size); break;
|
||||||
case TokenDecrement: TopValue->Val->NativePointer = (void *)((char *)TopValue->Val->NativePointer - Size); break;
|
case TokenDecrement: TopValue->Val->Pointer = (void *)((char *)TopValue->Val->Pointer - Size); break;
|
||||||
default: ProgramFail(Parser, "invalid operation"); break;
|
default: ProgramFail(Parser, "invalid operation"); break;
|
||||||
}
|
}
|
||||||
|
|
||||||
ResultPtr = TopValue->Val->NativePointer;
|
ResultPtr = TopValue->Val->Pointer;
|
||||||
StackValue = ExpressionStackPushValueByType(Parser, StackTop, TopValue->Typ);
|
StackValue = ExpressionStackPushValueByType(Parser, StackTop, TopValue->Typ);
|
||||||
StackValue->Val->NativePointer = ResultPtr;
|
StackValue->Val->Pointer = ResultPtr;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
ProgramFail(Parser, "invalid operation");
|
ProgramFail(Parser, "invalid operation");
|
||||||
|
@ -549,9 +549,9 @@ void ExpressionPostfixOperator(struct ParseState *Parser, struct ExpressionStack
|
||||||
/* pointer postfix arithmetic */
|
/* pointer postfix arithmetic */
|
||||||
int Size = TypeSize(TopValue->Typ->FromType, 0, TRUE);
|
int Size = TypeSize(TopValue->Typ->FromType, 0, TRUE);
|
||||||
struct Value *StackValue;
|
struct Value *StackValue;
|
||||||
void *OrigPointer = TopValue->Val->NativePointer;
|
void *OrigPointer = TopValue->Val->Pointer;
|
||||||
|
|
||||||
if (TopValue->Val->NativePointer == NULL)
|
if (TopValue->Val->Pointer == NULL)
|
||||||
ProgramFail(Parser, "invalid use of a NULL pointer");
|
ProgramFail(Parser, "invalid use of a NULL pointer");
|
||||||
|
|
||||||
if (!TopValue->IsLValue)
|
if (!TopValue->IsLValue)
|
||||||
|
@ -559,13 +559,13 @@ void ExpressionPostfixOperator(struct ParseState *Parser, struct ExpressionStack
|
||||||
|
|
||||||
switch (Op)
|
switch (Op)
|
||||||
{
|
{
|
||||||
case TokenIncrement: TopValue->Val->NativePointer = (void *)((char *)TopValue->Val->NativePointer + Size); break;
|
case TokenIncrement: TopValue->Val->Pointer = (void *)((char *)TopValue->Val->Pointer + Size); break;
|
||||||
case TokenDecrement: TopValue->Val->NativePointer = (void *)((char *)TopValue->Val->NativePointer - Size); break;
|
case TokenDecrement: TopValue->Val->Pointer = (void *)((char *)TopValue->Val->Pointer - Size); break;
|
||||||
default: ProgramFail(Parser, "invalid operation"); break;
|
default: ProgramFail(Parser, "invalid operation"); break;
|
||||||
}
|
}
|
||||||
|
|
||||||
StackValue = ExpressionStackPushValueByType(Parser, StackTop, TopValue->Typ);
|
StackValue = ExpressionStackPushValueByType(Parser, StackTop, TopValue->Typ);
|
||||||
StackValue->Val->NativePointer = OrigPointer;
|
StackValue->Val->Pointer = OrigPointer;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
ProgramFail(Parser, "invalid operation");
|
ProgramFail(Parser, "invalid operation");
|
||||||
|
@ -576,7 +576,7 @@ void ExpressionInfixOperator(struct ParseState *Parser, struct ExpressionStack *
|
||||||
{
|
{
|
||||||
long ResultInt = 0;
|
long ResultInt = 0;
|
||||||
struct Value *StackValue;
|
struct Value *StackValue;
|
||||||
void *NativePointer;
|
void *Pointer;
|
||||||
|
|
||||||
if (Parser->Mode != RunModeRun)
|
if (Parser->Mode != RunModeRun)
|
||||||
{
|
{
|
||||||
|
@ -604,7 +604,7 @@ void ExpressionInfixOperator(struct ParseState *Parser, struct ExpressionStack *
|
||||||
switch (BottomValue->Typ->Base)
|
switch (BottomValue->Typ->Base)
|
||||||
{
|
{
|
||||||
case TypeArray: Result = VariableAllocValueFromExistingData(Parser, BottomValue->Typ->FromType, (union AnyValue *)(&BottomValue->Val->ArrayMem[0] + TypeSize(BottomValue->Typ, ArrayIndex, TRUE)), BottomValue->IsLValue, BottomValue->LValueFrom); break;
|
case TypeArray: Result = VariableAllocValueFromExistingData(Parser, BottomValue->Typ->FromType, (union AnyValue *)(&BottomValue->Val->ArrayMem[0] + TypeSize(BottomValue->Typ, ArrayIndex, TRUE)), BottomValue->IsLValue, BottomValue->LValueFrom); break;
|
||||||
case TypePointer: Result = VariableAllocValueFromExistingData(Parser, BottomValue->Typ->FromType, (union AnyValue *)((char *)BottomValue->Val->NativePointer + TypeSize(BottomValue->Typ->FromType, 0, TRUE) * ArrayIndex), BottomValue->IsLValue, BottomValue->LValueFrom); break;
|
case TypePointer: Result = VariableAllocValueFromExistingData(Parser, BottomValue->Typ->FromType, (union AnyValue *)((char *)BottomValue->Val->Pointer + TypeSize(BottomValue->Typ->FromType, 0, TRUE) * ArrayIndex), BottomValue->IsLValue, BottomValue->LValueFrom); break;
|
||||||
default: ProgramFail(Parser, "this %t is not an array", BottomValue->Typ);
|
default: ProgramFail(Parser, "this %t is not an array", BottomValue->Typ);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -706,26 +706,26 @@ void ExpressionInfixOperator(struct ParseState *Parser, struct ExpressionStack *
|
||||||
ProgramFail(Parser, "invalid operation");
|
ProgramFail(Parser, "invalid operation");
|
||||||
|
|
||||||
if (Op == TokenEqual)
|
if (Op == TokenEqual)
|
||||||
ExpressionPushInt(Parser, StackTop, BottomValue->Val->NativePointer == NULL);
|
ExpressionPushInt(Parser, StackTop, BottomValue->Val->Pointer == NULL);
|
||||||
else
|
else
|
||||||
ExpressionPushInt(Parser, StackTop, BottomValue->Val->NativePointer != NULL);
|
ExpressionPushInt(Parser, StackTop, BottomValue->Val->Pointer != NULL);
|
||||||
}
|
}
|
||||||
else if (Op == TokenPlus || Op == TokenMinus)
|
else if (Op == TokenPlus || Op == TokenMinus)
|
||||||
{
|
{
|
||||||
/* pointer arithmetic */
|
/* pointer arithmetic */
|
||||||
int Size = TypeSize(BottomValue->Typ->FromType, 0, TRUE);
|
int Size = TypeSize(BottomValue->Typ->FromType, 0, TRUE);
|
||||||
|
|
||||||
NativePointer = BottomValue->Val->NativePointer;
|
Pointer = BottomValue->Val->Pointer;
|
||||||
if (NativePointer == NULL)
|
if (Pointer == NULL)
|
||||||
ProgramFail(Parser, "invalid use of a NULL pointer");
|
ProgramFail(Parser, "invalid use of a NULL pointer");
|
||||||
|
|
||||||
if (Op == TokenPlus)
|
if (Op == TokenPlus)
|
||||||
NativePointer = (void *)((char *)NativePointer + TopInt * Size);
|
Pointer = (void *)((char *)Pointer + TopInt * Size);
|
||||||
else
|
else
|
||||||
NativePointer = (void *)((char *)NativePointer - TopInt * Size);
|
Pointer = (void *)((char *)Pointer - TopInt * Size);
|
||||||
|
|
||||||
StackValue = ExpressionStackPushValueByType(Parser, StackTop, BottomValue->Typ);
|
StackValue = ExpressionStackPushValueByType(Parser, StackTop, BottomValue->Typ);
|
||||||
StackValue->Val->NativePointer = NativePointer;
|
StackValue->Val->Pointer = Pointer;
|
||||||
}
|
}
|
||||||
else if (Op == TokenAssign && TopInt == 0)
|
else if (Op == TokenAssign && TopInt == 0)
|
||||||
{
|
{
|
||||||
|
@ -740,8 +740,8 @@ void ExpressionInfixOperator(struct ParseState *Parser, struct ExpressionStack *
|
||||||
else if (BottomValue->Typ->Base == TypePointer && TopValue->Typ->Base == TypePointer && Op != TokenAssign)
|
else if (BottomValue->Typ->Base == TypePointer && TopValue->Typ->Base == TypePointer && Op != TokenAssign)
|
||||||
{
|
{
|
||||||
/* pointer/pointer operations */
|
/* pointer/pointer operations */
|
||||||
char *TopLoc = (char *)TopValue->Val->NativePointer;
|
char *TopLoc = (char *)TopValue->Val->Pointer;
|
||||||
char *BottomLoc = (char *)BottomValue->Val->NativePointer;
|
char *BottomLoc = (char *)BottomValue->Val->Pointer;
|
||||||
|
|
||||||
switch (Op)
|
switch (Op)
|
||||||
{
|
{
|
||||||
|
|
2
lex.c
2
lex.c
|
@ -317,7 +317,7 @@ enum LexToken LexGetStringConstant(struct LexState *Lexer, struct Value *Value,
|
||||||
|
|
||||||
/* create the the pointer for this char* */
|
/* create the the pointer for this char* */
|
||||||
Value->Typ = CharPtrType;
|
Value->Typ = CharPtrType;
|
||||||
Value->Val->NativePointer = RegString;
|
Value->Val->Pointer = RegString;
|
||||||
if (*Lexer->Pos == EndChar)
|
if (*Lexer->Pos == EndChar)
|
||||||
LEXER_INC(Lexer);
|
LEXER_INC(Lexer);
|
||||||
|
|
||||||
|
|
2
parse.c
2
parse.c
|
@ -521,7 +521,7 @@ enum ParseResult ParseStatement(struct ParseState *Parser, int CheckTrailingSemi
|
||||||
if (LexGetToken(Parser, &LexerValue, TRUE) != TokenStringConstant)
|
if (LexGetToken(Parser, &LexerValue, TRUE) != TokenStringConstant)
|
||||||
ProgramFail(Parser, "\"filename.h\" expected");
|
ProgramFail(Parser, "\"filename.h\" expected");
|
||||||
|
|
||||||
IncludeFile((char *)LexerValue->Val->NativePointer);
|
IncludeFile((char *)LexerValue->Val->Pointer);
|
||||||
CheckTrailingSemicolon = FALSE;
|
CheckTrailingSemicolon = FALSE;
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
|
4
picoc.h
4
picoc.h
|
@ -38,7 +38,7 @@ typedef FILE IOFILE;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define IS_POINTER_COERCIBLE(v, ap) ((ap) ? ((v)->Typ->Base == TypePointer) : 0)
|
#define IS_POINTER_COERCIBLE(v, ap) ((ap) ? ((v)->Typ->Base == TypePointer) : 0)
|
||||||
#define POINTER_COERCE(v) ((int)(v)->Val->NativePointer)
|
#define POINTER_COERCE(v) ((int)(v)->Val->Pointer)
|
||||||
|
|
||||||
#define IS_INTEGER_NUMERIC_TYPE(t) ((t)->Base >= TypeInt && (t)->Base <= TypeUnsignedLong)
|
#define IS_INTEGER_NUMERIC_TYPE(t) ((t)->Base >= TypeInt && (t)->Base <= TypeUnsignedLong)
|
||||||
#define IS_INTEGER_NUMERIC(v) IS_INTEGER_NUMERIC_TYPE((v)->Typ)
|
#define IS_INTEGER_NUMERIC(v) IS_INTEGER_NUMERIC_TYPE((v)->Typ)
|
||||||
|
@ -179,7 +179,7 @@ union AnyValue
|
||||||
#ifndef NO_FP
|
#ifndef NO_FP
|
||||||
double FP;
|
double FP;
|
||||||
#endif
|
#endif
|
||||||
void *NativePointer; /* unsafe native pointers */
|
void *Pointer; /* unsafe native pointers */
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Value
|
struct Value
|
||||||
|
|
|
@ -279,6 +279,6 @@ void *VariableDereferencePointer(struct ParseState *Parser, struct Value *Pointe
|
||||||
if (DerefIsLValue != NULL)
|
if (DerefIsLValue != NULL)
|
||||||
*DerefIsLValue = TRUE;
|
*DerefIsLValue = TRUE;
|
||||||
|
|
||||||
return PointerValue->Val->NativePointer;
|
return PointerValue->Val->Pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue