Пример #1
0
int
main (int argc, short *argv[])
{
  vector short fetched_value = foo ();
  if (fetched_value[0] != 0 || fetched_value[7] != 7)
    abort ();

  fetched_value = foo1 ();
  if (fetched_value[1] != 1 || fetched_value[6] != 6)
    abort ();

  fetched_value = foo2 ();
  if (fetched_value[2] != 2 || fetched_value[5] != 5)
    abort ();

  fetched_value = foo3 (&x);
  if (fetched_value[3] != 3 || fetched_value[4] != 4)
    abort ();

  struct bar a_struct;
  a_struct.a_vector = x;	/* Remove 2 redundant swaps.  */
  fetched_value = foo4 (&a_struct);
  if (fetched_value[4] != 4 || fetched_value[3] != 3)
    abort ();

  for (int i = 0; i < 8; i++)
    z[i] = 7 - i;

  baz (z);
  if (x[0] != 7 || x[7] != 0)
    abort ();

  vector short source = { 8, 7, 6, 5, 4, 3, 2, 1 };

  baz1 (source);
  if (x[3] != 5 || x[7] != 1)
    abort ();

  vector short dest;
  baz2 (&dest, source);
  if (dest[4] != 4 || dest[1] != 7)
    abort ();

  baz3 (&a_struct, source);
  if (a_struct.a_vector[7] != 1 || a_struct.a_vector[5] != 3)
    abort ();

  return 0;
}
Пример #2
0
int foo (void *a, long b, int c)
{
  int d = 0, e, f = 0, i;
  char g[256];
  void **h;

  g[0] = '\n';
  g[1] = 0;

  while (baz1 (a) < b) {
    if (g[0] != ' ' && g[0] != '\t') {
      f = 1;
      e = 0;
      if (!d && baz2 (g) == 0) {
	if ((c & 0x10) == 0)
	  continue;
	e = d = 1;
      }
      if (!((c & 0x10) && (c & 0x4000) && e) && (c & 2))
	continue;
      if ((c & 0x2000) && baz2 (g) == 0)
	continue;
      if ((c & 0x1408) && baz2 (g) == 0)
	continue;
      if ((c & 0x200) && baz2 (g) == 0)
	continue;
      if (c & 0x80) {
	for (h = bar, i = 0; h; h = (void **)*h, i++)
	  if (baz3 (i))
	    break;
      }
      f = 0;
    }
  }
  return 0;
}