URL
https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk
Go to most recent revision |
Only display areas with differences |
Details |
Blame |
View Log
Rev 309 |
Rev 384 |
/* { dg-do run } */
|
/* { dg-do run } */
|
/* { dg-skip-if "" { *-*-* } { "-fnext-runtime" } { "" } } */
|
/* { dg-skip-if "" { *-*-* } { "-fnext-runtime" } { "" } } */
|
#include <objc/typedstream.h>
|
#include <objc/typedstream.h>
|
#include <stdio.h>
|
#include <stdio.h>
|
#include <stdlib.h>
|
#include <stdlib.h>
|
|
|
int main (void)
|
int main (void)
|
{
|
{
|
FILE *f; TypedStream *ts;
|
FILE *f; TypedStream *ts;
|
struct T { int a, b; } x = { 1, 2 };
|
struct T { int a, b; } x = { 1, 2 };
|
f = fopen ("foo", "w"); ts = objc_open_typed_stream (f, OBJC_WRITEONLY);
|
f = fopen ("foo", "w"); ts = objc_open_typed_stream (f, OBJC_WRITEONLY);
|
objc_write_type (ts, @encode(struct T), &x);
|
objc_write_type (ts, @encode(struct T), &x);
|
objc_close_typed_stream (ts); fclose (f);
|
objc_close_typed_stream (ts); fclose (f);
|
f = fopen ("foo", "r"); ts = objc_open_typed_stream (f, OBJC_READONLY);
|
f = fopen ("foo", "r"); ts = objc_open_typed_stream (f, OBJC_READONLY);
|
struct T y;
|
struct T y;
|
objc_read_type (ts, @encode(struct T), &y);
|
objc_read_type (ts, @encode(struct T), &y);
|
if (y.a != 1)
|
if (y.a != 1)
|
abort ();
|
abort ();
|
if (y.b != 2)
|
if (y.b != 2)
|
abort ();
|
abort ();
|
objc_close_typed_stream (ts); fclose (f);
|
objc_close_typed_stream (ts); fclose (f);
|
remove ("foo");
|
remove ("foo");
|
return 0;
|
return 0;
|
}
|
}
|
|
|
|
|
© copyright 1999-2024
OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.