Changed tests to new standard library.

Fixed some regressions when converting to new standard library.


git-svn-id: http://picoc.googlecode.com/svn/trunk@432 21eae674-98b7-11dd-bd71-f92a316d2d60
This commit is contained in:
zik.saleeba 2010-06-13 11:58:52 +00:00
parent 16a1872035
commit 2dd0dfb049
40 changed files with 237 additions and 156 deletions

View file

@ -9,6 +9,8 @@
FILE *CStdOut;
static int ZeroValue = 0;
static int TRUEValue = 1;
static int EOFValue = EOF;
static int SEEK_SETValue = SEEK_SET;
static int SEEK_CURValue = SEEK_CUR;
@ -251,7 +253,7 @@ int StdioBasePrintf(struct ParseState *Parser, FILE *Stream, char *StrOut, int S
if (ShowType == &IntType)
{
/* show a signed integer */
if (IS_INTEGER_NUMERIC(ThisArg))
if (IS_NUMERIC_COERCIBLE(ThisArg))
StdioFprintfWord(&SOStream, OneFormatBuf, ExpressionCoerceUnsignedInteger(ThisArg));
else
StdioOutPuts("XXX", &SOStream);
@ -259,7 +261,7 @@ int StdioBasePrintf(struct ParseState *Parser, FILE *Stream, char *StrOut, int S
else if (ShowType == &FPType)
{
/* show a floating point number */
if (IS_FP(ThisArg))
if (IS_NUMERIC_COERCIBLE(ThisArg))
StdioFprintfFP(&SOStream, OneFormatBuf, ExpressionCoerceFP(ThisArg));
else
StdioOutPuts("XXX", &SOStream);
@ -681,6 +683,11 @@ void StdioSetupFunc(void)
VariableDefinePlatformVar(NULL, "stdin", FilePtrType, (union AnyValue *)&stdinValue, FALSE);
VariableDefinePlatformVar(NULL, "stdout", FilePtrType, (union AnyValue *)&stdoutValue, FALSE);
VariableDefinePlatformVar(NULL, "stderr", FilePtrType, (union AnyValue *)&stderrValue, FALSE);
/* define NULL, TRUE and FALSE */
VariableDefinePlatformVar(NULL, "NULL", &IntType, (union AnyValue *)&ZeroValue, FALSE);
VariableDefinePlatformVar(NULL, "TRUE", &IntType, (union AnyValue *)&TRUEValue, FALSE);
VariableDefinePlatformVar(NULL, "FALSE", &IntType, (union AnyValue *)&ZeroValue, FALSE);
}
/* portability-related I/O calls */

View file

@ -1,3 +1,5 @@
#include <stdio.h>
int a;
a = 42;
printf("%d\n", a);

View file

@ -1,3 +1,5 @@
#include <stdio.h>
printf("Hello\n");
printf("Hello\n"); /* this is a comment */ printf("Hello\n");
printf("Hello\n");

View file

@ -1,3 +1,5 @@
#include <stdio.h>
printf("Hello world\n");
int Count;

View file

@ -1,3 +1,5 @@
#include <stdio.h>
struct fred
{
int boris;

View file

@ -1,3 +1,5 @@
#include <stdio.h>
int Count;
for (Count = 1; Count <= 10; Count++)

View file

@ -1,3 +1,5 @@
#include <stdio.h>
int Count;
int Array[10];

View file

@ -1,3 +1,5 @@
#include <stdio.h>
int Count;
for (Count = 0; Count < 4; Count++)

View file

@ -1,3 +1,5 @@
#include <stdio.h>
int myfunc(int x)
{
return x * x;

View file

@ -1,3 +1,5 @@
#include <stdio.h>
int a;
int p;
int t;

View file

@ -1,3 +1,5 @@
#include <stdio.h>
int a;
int p;
int t;

View file

@ -1,3 +1,5 @@
#include <stdio.h>
int a;
int *b;
int c;

View file

@ -1,3 +1,5 @@
#include <stdio.h>
int a;
int b;
int c;

View file

@ -1,3 +1,5 @@
#include <stdio.h>
#define FRED 12
#define BLOGGS(x) (12*(x))

View file

@ -1,3 +1,5 @@
#include <stdio.h>
int a = 24680;
int b = 01234567;
int c = 0x2468ac;

View file

@ -1,3 +1,5 @@
#include <stdio.h>
int a = 1;
if (a)

View file

@ -1,3 +1,5 @@
#include <stdio.h>
int factorial(int i)
{
if (i < 2)

View file

@ -1,3 +1,5 @@
#include <stdio.h>
int x, y, z;
for (x = 0; x < 2; x++)

View file

@ -1,3 +1,5 @@
#include <stdio.h>
enum fred
{
a,

View file

@ -1,3 +1,5 @@
#include <stdio.h>
printf("including\n");
#include "18_include.h"
printf("done\n");

View file

@ -1,3 +1,5 @@
#include <stdio.h>
int a;
int *b;
int *c;

View file

@ -1,3 +1,5 @@
#include <stdio.h>
int a;
int b;
int *d;

View file

@ -1,3 +1,5 @@
#include <stdio.h>
int x = 'a';
char y = x;

View file

@ -1,3 +1,6 @@
#include <stdio.h>
#include <math.h>
// variables
float a = 12.34 + 56.78;
printf("%f\n", a);

View file

@ -1,16 +1,16 @@
69.12
69.12
-44.44
700.6652
69.120000
69.120000
-44.440000
700.665200
0.217330
1 1 0 0 0 1
0 1 1 1 0 0
0 0 0 1 1 1
69.12
-44.44
700.6652
69.120000
-44.440000
700.665200
0.217330
12.34
-12.34
2.0
12.340000
-12.340000
2.000000
0.909297

View file

@ -1,3 +1,5 @@
#include <stdio.h>
void charfunc(char a)
{
printf("char: %c\n", a);

View file

@ -4,12 +4,12 @@ char: c
int: 97
int: 98
int: 99
float: 97.0
float: 98.0
float: 99.0
a 98 99.0
a 98 99.0
a 98 99.0
float: 97.000000
float: 98.000000
float: 99.000000
a 98 99.000000
a 98 99.000000
a 98 99.000000
97 97
97 97
97.0 97.0
97.000000 97.000000

View file

@ -1,3 +1,6 @@
#include <stdio.h>
#include <math.h>
printf("%f\n", sin(0.12));
printf("%f\n", cos(0.12));
printf("%f\n", tan(0.12));

View file

@ -1,18 +1,18 @@
0.119712
0.992808
0.992809
0.120579
0.120289
0.120290
1.450506
0.119428
0.119429
0.120288
1.007208
1.007209
0.119427
1.127496
0.12
-2.120263
-0.920818
1.127497
0.120000
-2.120264
-0.920819
0.775357
0.346410
12.0
13.0
12.0
12.000000
13.000000
12.000000

View file

@ -1,3 +1,5 @@
#include <stdio.h>
int array[16];
//Swap integer values by array indexes

View file

@ -1,3 +1,5 @@
#include <stdio.h>
printf("%d\n", '\1');
printf("%d\n", '\10');
printf("%d\n", '\100');

View file

@ -1,3 +1,5 @@
#include <stdio.h>
char a;
int b;
double c;

View file

@ -1,3 +1,5 @@
#include <stdio.h>
char a[10];
strcpy(a, "hello");

View file

@ -1,3 +1,5 @@
#include <stdio.h>
char a[10];
strcpy(a, "abcdef");
printf("%s\n", &a[1]);

View file

@ -1,3 +1,5 @@
#include <stdio.h>
int a[4];
a[0] = 12;

View file

@ -1,3 +1,5 @@
#include <stdio.h>
char a;
short b;

View file

@ -1,3 +1,5 @@
#include <stdio.h>
int Count;
int Array[10] = { 12, 34, 56, 78, 90, 123, 456, 789, 8642, 9753 };

View file

@ -1,3 +1,5 @@
#include <stdio.h>
char Buf[100];
int Count;

View file

@ -1,3 +1,5 @@
#include <stdio.h>
int a[4][4];
int b = 0;
int x;

View file

@ -1,3 +1,5 @@
#include <stdio.h>
typedef int MyInt;
MyInt a = 1;