./test << EOF
wrapper empty_wrapper {}
EOF

./test << EOF
wrapper var_decl {
	int i;
	int bar[];
	char argv[][];
	static int foo;
	const char *argv;
	const char *argv[];
	char *const argv[];
	register unsigned int *foo[];
	volatile unsigned long int foo;
	int *i = {1,2};
	int i,j;
	int *i = {1,2};
	int *i = {1,2,};
	int **i = {{1,2},2,}, **f = {{1,3},{4,5}, };
	int i=3, j=3;
}
EOF

./test << EOF
wrapper null_stmt {
	;;;;;	
}
EOF

./test << EOF
wrapper constants {
	int i = 3 + 3;
	int j = (i == 3);

	hexalnumber = 0x2a3132FA;
	intalnumber = 21231;
	octalnumber = 02302;
	fltalnumber = 23.3e+34;
	fltalnumber = 23.3e+34L;

	turkey_stix = "this is \"chicken\" not \"turkey\"!\n";
	_spoon = (char *)sdlqj;
}
EOF

./test << EOF
wrapper labels {
	j = i = 3;
	
exit:	j = 14;
	return (13);
	call(buff, str);
}
EOF

./test << EOF
wrapper realloc {
    register void *r;

    if (!ptr)
        {
        r = imalloc(size);
    }
        else if (ptr && !size)
        { 
        ifree(ptr);
        r = 0;
    }
        else
        {
        r = irealloc(ptr, size); 
    }       
    return (r);

{
	void *a, *b;
	int  c;

	malloc_options = "Dr";

	printf ("Malloc options: %s\n", malloc_options);
	a = NULL;
	b = malloc (1024);
	c = 256;

	do
	{
		a = realloc (b,c);
		if (a==b)
		{
			printf ("a == b, c = %d\n", c);
		}
		else
		{
			printf ("a <> b, c = %d\n", c);
			b = a;
		}
		c = c << 1;
	} while (a);

	printf ("a is NULL\n");

	return 0;
}
}
EOF

./test << EOF
wrapper strings {
	printf("\"a is NULL\"\n");
	printf("b \"is\" NULL");
	printf("\\c is NULL\\\\");
	printf("d is NULL");
}
EOF


./test << EOF
wrapper hexld {
char *s;
  s = malloc(80);
  sprintf(s, "%04x#%08x%08x",
	  ((unsigned short *)&x)[4], ((unsigned *)&x)[1], ((unsigned *)&x)[0]);
  return s;
}
EOF

./test << EOF
wrapper testsin {
long double x, y, t;
  x = *((long double *)&numbers[n].arg);
  y = lsin(x);
  t = *((long double *)&numbers[n].nearest);
  if ( y != t )
    { if ( n == 0 )
        printf("pi precision estimate: %.2f bits\n",
	       log(fabs(x/(y-t)))/log(2));
      if ( ((unsigned short *)&y)[4] != ((unsigned short *)&t)[4] )
	printf("Test %d result = %s\n",
	       n, hexld(y));
      else { long long diff = *(long long *)&y - *(long long *)&t;
	  printf("Test %d difference = %6d, result = %s\n",
		 n, (int)diff, hexld(y));
	}
      return 1;
    }
  return 0;
}
EOF

./test << EOF
wrapper tstruct {
	int k;
}
EOF

./test << EOF
wrapper comments {

int i;
	/* this is a comment and this is still more of 
	the same comment so there */

int j;

}
EOF

./test << EOF
wrapper foo {
	typedef int ii, j, foo, bar, baz;

	ii i;
	j ba;
}
EOF

./test << EOF
wrapper cut_n_paster {

}
EOF

exit
