diff --git a/clibrary.c b/clibrary.c index 2ba8083..e0058bc 100644 --- a/clibrary.c +++ b/clibrary.c @@ -198,7 +198,7 @@ void GenericPrintf(struct ParseState *Parser, struct Value *ReturnValue, struct int LeftJustify = FALSE; int ZeroPad = FALSE; int FieldWidth = 0; - char *Format = Param[0]->Val->NativePointer; + char *Format = Param[0]->Val->Pointer; for (FPos = Format; *FPos != '\0'; FPos++) { @@ -258,7 +258,7 @@ void GenericPrintf(struct ParseState *Parser, struct Value *ReturnValue, struct char *Str; if (NextArg->Typ->Base == TypePointer) - Str = NextArg->Val->NativePointer; + Str = NextArg->Val->Pointer; else Str = &NextArg->Val->ArrayMem[0]; @@ -304,26 +304,26 @@ void LibSPrintf(struct ParseState *Parser, struct Value *ReturnValue, struct Val StrStream.Putch = &SPutc; 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); PrintCh(0, &StrStream); - ReturnValue->Val->NativePointer = *Param; + ReturnValue->Val->Pointer = *Param; } /* get a line of input. protected from buffer overrun */ 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 *Result; - ReturnValue->Val->NativePointer = NULL; + ReturnValue->Val->Pointer = NULL; Result = PlatformGetLine(ReadBuffer, GETS_BUF_MAX); if (Result == NULL) 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) @@ -431,32 +431,32 @@ void LibFloor(struct ParseState *Parser, struct Value *ReturnValue, struct Value #ifndef NO_STRING_FUNCTIONS 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 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 #ifndef NO_REALLOC 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 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) { - char *To = (char *)Param[0]->Val->NativePointer; - char *From = (char *)Param[1]->Val->NativePointer; + char *To = (char *)Param[0]->Val->Pointer; + char *From = (char *)Param[1]->Val->Pointer; while (*From != '\0') *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) { - char *To = (char *)Param[0]->Val->NativePointer; - char *From = (char *)Param[1]->Val->NativePointer; + char *To = (char *)Param[0]->Val->Pointer; + char *From = (char *)Param[1]->Val->Pointer; int Len = Param[2]->Val->Integer; 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) { - char *Str1 = (char *)Param[0]->Val->NativePointer; - char *Str2 = (char *)Param[1]->Val->NativePointer; + char *Str1 = (char *)Param[0]->Val->Pointer; + char *Str2 = (char *)Param[1]->Val->Pointer; int StrEnded; 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) { - char *Str1 = (char *)Param[0]->Val->NativePointer; - char *Str2 = (char *)Param[1]->Val->NativePointer; + char *Str1 = (char *)Param[0]->Val->Pointer; + char *Str2 = (char *)Param[1]->Val->Pointer; int Len = Param[2]->Val->Integer; 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) { - char *To = (char *)Param[0]->Val->NativePointer; - char *From = (char *)Param[1]->Val->NativePointer; + char *To = (char *)Param[0]->Val->Pointer; + char *From = (char *)Param[1]->Val->Pointer; while (*To != '\0') 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) { - char *Pos = (char *)Param[0]->Val->NativePointer; + char *Pos = (char *)Param[0]->Val->Pointer; int SearchChar = Param[1]->Val->Integer; while (*Pos != '\0' && *Pos != SearchChar) Pos++; if (*Pos != SearchChar) - ReturnValue->Val->NativePointer = NULL; + ReturnValue->Val->Pointer = NULL; else - ReturnValue->Val->NativePointer = Pos; + ReturnValue->Val->Pointer = Pos; } 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; - ReturnValue->Val->NativePointer = NULL; + ReturnValue->Val->Pointer = NULL; for (; *Pos != '\0'; Pos++) { if (*Pos == SearchChar) - ReturnValue->Val->NativePointer = Pos; + ReturnValue->Val->Pointer = Pos; } } 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; 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) { /* 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) { /* 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) { - unsigned char *Mem1 = (unsigned char *)Param[0]->Val->NativePointer; - unsigned char *Mem2 = (unsigned char *)Param[1]->Val->NativePointer; + unsigned char *Mem1 = (unsigned char *)Param[0]->Val->Pointer; + unsigned char *Mem2 = (unsigned char *)Param[1]->Val->Pointer; int Len = Param[2]->Val->Integer; for (; Len > 0; Mem1++, Mem2++, Len--) diff --git a/cstdlib/math.c b/cstdlib/math.c index 485835b..c4421bd 100644 --- a/cstdlib/math.c +++ b/cstdlib/math.c @@ -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) { - 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) @@ -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) { - 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) diff --git a/cstdlib/stdio.c b/cstdlib/stdio.c index 5026030..7915599 100644 --- a/cstdlib/stdio.c +++ b/cstdlib/stdio.c @@ -269,7 +269,7 @@ int StdioBasePrintf(struct ParseState *Parser, FILE *Stream, char *StrOut, int S else if (ShowType == CharPtrType) { 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) 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) { if (ThisArg->Typ->Base == TypePointer) - StdioFprintfPointer(&SOStream, OneFormatBuf, ThisArg->Val->NativePointer); + StdioFprintfPointer(&SOStream, OneFormatBuf, ThisArg->Val->Pointer); else if (ThisArg->Typ->Base == TypeArray) 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))); if (ThisArg->Typ->Base == TypePointer) - ScanfArg[ArgCount] = ThisArg->Val->NativePointer; + ScanfArg[ArgCount] = ThisArg->Val->Pointer; else if (ThisArg->Typ->Base == TypeArray) ScanfArg[ArgCount] = &ThisArg->Val->ArrayMem[0]; @@ -341,122 +341,122 @@ int StdioBaseScanf(struct ParseState *Parser, FILE *Stream, char *StrIn, char *F /* stdio calls */ 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) { - 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) { - 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) { - 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) { - 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) { - 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) { - 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) { - 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) { - 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) { - rewind(Param[0]->Val->NativePointer); + rewind(Param[0]->Val->Pointer); } 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) { - clearerr(Param[0]->Val->NativePointer); + clearerr(Param[0]->Val->Pointer); } 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) { - 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) { - 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) { - 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) { - 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) { - 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) { - 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) { - 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) { - 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) { - 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) { - perror(Param[0]->Val->NativePointer); + perror(Param[0]->Val->Pointer); } 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) @@ -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) { - 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) { - 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) { - 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) { - 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) { - 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) @@ -500,12 +500,12 @@ void StdioPrintf(struct ParseState *Parser, struct Value *ReturnValue, struct Va PrintfArgs.Param = Param; 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) { - 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) @@ -514,12 +514,12 @@ void StdioFprintf(struct ParseState *Parser, struct Value *ReturnValue, struct V PrintfArgs.Param = Param + 1; 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) { - 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) @@ -528,7 +528,7 @@ void StdioSprintf(struct ParseState *Parser, struct Value *ReturnValue, struct V PrintfArgs.Param = Param + 1; 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) @@ -537,7 +537,7 @@ void StdioSnprintf(struct ParseState *Parser, struct Value *ReturnValue, struct PrintfArgs.Param = Param+2; 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) @@ -546,7 +546,7 @@ void StdioScanf(struct ParseState *Parser, struct Value *ReturnValue, struct Val ScanfArgs.Param = Param; 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) @@ -555,7 +555,7 @@ void StdioFscanf(struct ParseState *Parser, struct Value *ReturnValue, struct Va ScanfArgs.Param = Param+1; 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) @@ -564,32 +564,32 @@ void StdioSscanf(struct ParseState *Parser, struct Value *ReturnValue, struct Va ScanfArgs.Param = Param+1; 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) { - 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) { - 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) { - 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) { - 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) { - 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 */ diff --git a/cstdlib/stdlib.c b/cstdlib/stdlib.c index 4c403f9..d64b2ec 100644 --- a/cstdlib/stdlib.c +++ b/cstdlib/stdlib.c @@ -8,52 +8,52 @@ static int TRUEValue = 1; 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) { - 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) { - 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) { - 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) { - 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) { - 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) { - 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) { - 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) { - 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) { - free(Param[0]->Val->NativePointer); + free(Param[0]->Val->Pointer); } 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) { - 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) { - ReturnValue->Val->Integer = system(Param[0]->Val->NativePointer); + ReturnValue->Val->Integer = system(Param[0]->Val->Pointer); } /* all stdlib.h functions */ diff --git a/cstdlib/string.c b/cstdlib/string.c index 75aea2e..8ce8fb0 100644 --- a/cstdlib/string.c +++ b/cstdlib/string.c @@ -7,132 +7,132 @@ static int ZeroValue = 0; 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) { - 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) { - 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) { - 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) { - 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) { - 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) { - 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) { - 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) { - 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) { - 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) { - 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) { - 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) { - 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) { - 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) { - 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) { - 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) { - 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) { - 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) { - 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) { - 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) { - 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) { - 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) { - 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) { - 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) { - 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) { - 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 */ diff --git a/expression.c b/expression.c index 5583bf6..bbe7fe6 100644 --- a/expression.c +++ b/expression.c @@ -99,12 +99,12 @@ void ExpressionStackShow(struct ExpressionStack *StackTop) case TypeFunction: printf("%s:function", StackTop->Val->Val->Identifier); break; case TypeMacro: printf("%s:macro", StackTop->Val->Val->Identifier); break; case TypePointer: - if (StackTop->Val->Val->NativePointer == NULL) + if (StackTop->Val->Val->Pointer == NULL) printf("ptr(NULL)"); 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 - printf("ptr(0x%lx)", (long)StackTop->Val->Val->NativePointer); + printf("ptr(0x%lx)", (long)StackTop->Val->Val->Pointer); break; case TypeArray: printf("array"); 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 TypeUnsignedShort: return (long)Val->Val->UnsignedShortInteger; case TypeUnsignedLong: return (long)Val->Val->UnsignedLongInteger; - case TypePointer: return (long)Val->Val->NativePointer; + case TypePointer: return (long)Val->Val->Pointer; #ifndef NO_FP case TypeFP: return (long)Val->Val->FP; #endif @@ -163,7 +163,7 @@ unsigned long ExpressionCoerceUnsignedInteger(struct Value *Val) case TypeUnsignedInt: return (unsigned long)Val->Val->UnsignedInteger; case TypeUnsignedShort: return (unsigned long)Val->Val->UnsignedShortInteger; 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 case TypeFP: return (unsigned long)Val->Val->FP; #endif @@ -321,28 +321,28 @@ void ExpressionAssignToPointer(struct ParseState *Parser, struct Value *ToValue, struct ValueType *PointedToType = ToValue->Typ->FromType; 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)) { /* 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 && (PointedToType == FromValue->Typ->FromType->FromType || ToValue->Typ == VoidPtrType) ) { /* 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) { /* null pointer assignment */ - ToValue->Val->NativePointer = NULL; + ToValue->Val->Pointer = NULL; } else if (AllowPointerCoercion && IS_NUMERIC_COERCIBLE(FromValue)) { /* assign integer to native pointer */ - ToValue->Val->NativePointer = (void *)(unsigned long)ExpressionCoerceUnsignedInteger(FromValue); + ToValue->Val->Pointer = (void *)(unsigned long)ExpressionCoerceUnsignedInteger(FromValue); } else 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; 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); break; @@ -495,7 +495,7 @@ void ExpressionPrefixOperator(struct ParseState *Parser, struct ExpressionStack struct Value *StackValue; void *ResultPtr; - if (TopValue->Val->NativePointer == NULL) + if (TopValue->Val->Pointer == NULL) ProgramFail(Parser, "invalid use of a NULL pointer"); if (!TopValue->IsLValue) @@ -503,14 +503,14 @@ void ExpressionPrefixOperator(struct ParseState *Parser, struct ExpressionStack switch (Op) { - case TokenIncrement: TopValue->Val->NativePointer = (void *)((char *)TopValue->Val->NativePointer + Size); break; - case TokenDecrement: 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->Pointer = (void *)((char *)TopValue->Val->Pointer - Size); break; default: ProgramFail(Parser, "invalid operation"); break; } - ResultPtr = TopValue->Val->NativePointer; + ResultPtr = TopValue->Val->Pointer; StackValue = ExpressionStackPushValueByType(Parser, StackTop, TopValue->Typ); - StackValue->Val->NativePointer = ResultPtr; + StackValue->Val->Pointer = ResultPtr; } else ProgramFail(Parser, "invalid operation"); @@ -549,9 +549,9 @@ void ExpressionPostfixOperator(struct ParseState *Parser, struct ExpressionStack /* pointer postfix arithmetic */ int Size = TypeSize(TopValue->Typ->FromType, 0, TRUE); 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"); if (!TopValue->IsLValue) @@ -559,13 +559,13 @@ void ExpressionPostfixOperator(struct ParseState *Parser, struct ExpressionStack switch (Op) { - case TokenIncrement: TopValue->Val->NativePointer = (void *)((char *)TopValue->Val->NativePointer + Size); break; - case TokenDecrement: 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->Pointer = (void *)((char *)TopValue->Val->Pointer - Size); break; default: ProgramFail(Parser, "invalid operation"); break; } StackValue = ExpressionStackPushValueByType(Parser, StackTop, TopValue->Typ); - StackValue->Val->NativePointer = OrigPointer; + StackValue->Val->Pointer = OrigPointer; } else ProgramFail(Parser, "invalid operation"); @@ -576,7 +576,7 @@ void ExpressionInfixOperator(struct ParseState *Parser, struct ExpressionStack * { long ResultInt = 0; struct Value *StackValue; - void *NativePointer; + void *Pointer; if (Parser->Mode != RunModeRun) { @@ -604,7 +604,7 @@ void ExpressionInfixOperator(struct ParseState *Parser, struct ExpressionStack * 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 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); } @@ -706,26 +706,26 @@ void ExpressionInfixOperator(struct ParseState *Parser, struct ExpressionStack * ProgramFail(Parser, "invalid operation"); if (Op == TokenEqual) - ExpressionPushInt(Parser, StackTop, BottomValue->Val->NativePointer == NULL); + ExpressionPushInt(Parser, StackTop, BottomValue->Val->Pointer == NULL); else - ExpressionPushInt(Parser, StackTop, BottomValue->Val->NativePointer != NULL); + ExpressionPushInt(Parser, StackTop, BottomValue->Val->Pointer != NULL); } else if (Op == TokenPlus || Op == TokenMinus) { /* pointer arithmetic */ int Size = TypeSize(BottomValue->Typ->FromType, 0, TRUE); - NativePointer = BottomValue->Val->NativePointer; - if (NativePointer == NULL) + Pointer = BottomValue->Val->Pointer; + if (Pointer == NULL) ProgramFail(Parser, "invalid use of a NULL pointer"); if (Op == TokenPlus) - NativePointer = (void *)((char *)NativePointer + TopInt * Size); + Pointer = (void *)((char *)Pointer + TopInt * Size); else - NativePointer = (void *)((char *)NativePointer - TopInt * Size); + Pointer = (void *)((char *)Pointer - TopInt * Size); StackValue = ExpressionStackPushValueByType(Parser, StackTop, BottomValue->Typ); - StackValue->Val->NativePointer = NativePointer; + StackValue->Val->Pointer = Pointer; } 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) { /* pointer/pointer operations */ - char *TopLoc = (char *)TopValue->Val->NativePointer; - char *BottomLoc = (char *)BottomValue->Val->NativePointer; + char *TopLoc = (char *)TopValue->Val->Pointer; + char *BottomLoc = (char *)BottomValue->Val->Pointer; switch (Op) { diff --git a/lex.c b/lex.c index 8ee7d51..8314f21 100644 --- a/lex.c +++ b/lex.c @@ -317,7 +317,7 @@ enum LexToken LexGetStringConstant(struct LexState *Lexer, struct Value *Value, /* create the the pointer for this char* */ Value->Typ = CharPtrType; - Value->Val->NativePointer = RegString; + Value->Val->Pointer = RegString; if (*Lexer->Pos == EndChar) LEXER_INC(Lexer); diff --git a/parse.c b/parse.c index 79f5e16..69ea1f1 100644 --- a/parse.c +++ b/parse.c @@ -521,7 +521,7 @@ enum ParseResult ParseStatement(struct ParseState *Parser, int CheckTrailingSemi if (LexGetToken(Parser, &LexerValue, TRUE) != TokenStringConstant) ProgramFail(Parser, "\"filename.h\" expected"); - IncludeFile((char *)LexerValue->Val->NativePointer); + IncludeFile((char *)LexerValue->Val->Pointer); CheckTrailingSemicolon = FALSE; break; #endif diff --git a/picoc.h b/picoc.h index 732c87e..cabeba8 100644 --- a/picoc.h +++ b/picoc.h @@ -38,7 +38,7 @@ typedef FILE IOFILE; #endif #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(v) IS_INTEGER_NUMERIC_TYPE((v)->Typ) @@ -179,7 +179,7 @@ union AnyValue #ifndef NO_FP double FP; #endif - void *NativePointer; /* unsafe native pointers */ + void *Pointer; /* unsafe native pointers */ }; struct Value diff --git a/variable.c b/variable.c index 3288ab3..554f593 100644 --- a/variable.c +++ b/variable.c @@ -279,6 +279,6 @@ void *VariableDereferencePointer(struct ParseState *Parser, struct Value *Pointe if (DerefIsLValue != NULL) *DerefIsLValue = TRUE; - return PointerValue->Val->NativePointer; + return PointerValue->Val->Pointer; }