git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@2913 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-MacDonald 1998-08-07 11:56:36 +00:00
parent a6ea02f345
commit 80bc736756
3 changed files with 29 additions and 2 deletions

View file

@ -22,6 +22,7 @@ int main(int argc, char *argv[])
int j,k;
foo f = {99, "cow", 9876543};
foo f2;
small_struct ss;
foo *fp;
const char *n;
int a3[3] = {66,77,88};
@ -99,10 +100,17 @@ int main(int argc, char *argv[])
[p sendSmallStruct:small];
[p sendStructArray:ma];
#if 1
/* returning structures isn't working yet. */
f2 = [p returnStruct];
printf(">>returned foo: i=%d s=%s l=%lu\n",
f2.i, f2.s, f2.l);
ss = [p returnSmallStruct];
printf(">>returned ss: %d\n", ss.z);
f2 = [p returnSetStruct: 99];
printf(">>returned foo: i=%d s=%s l=%lu\n",
f2.i, f2.s, f2.l);
ss = [p returnSetSmallStruct: 99];
printf(">>returned ss: %d\n", ss.z);
#endif
{
float f = 98.6f;

View file

@ -36,6 +36,9 @@ struct myarray {
- sendStruct: (foo)f;
- sendSmallStruct: (small_struct)small;
- (foo) returnStruct;
- (foo) returnSetStruct: (int)x;
- (small_struct) returnSmallStruct;
- (small_struct) returnSetSmallStruct: (int)x;
- sendArray: (int[3])a;
- sendStructArray: (struct myarray)ma;
- sendDouble: (double)d andFloat: (float)f;

View file

@ -116,12 +116,28 @@
printf(">>small value struct: z=%d\n", small.z);
return self;
}
/* Doesn't work. GCC __builtin_return doesn't let you return structs? */
- (foo) returnStruct
{
foo f = {1, "horse", 987654};
return f;
}
- (small_struct) returnSmallStruct
{
small_struct f = {22};
return f;
}
- (foo) returnSetStruct: (int)x
{
foo f = {1, "horse", 987654};
f.l = x;
return f;
}
- (small_struct) returnSetSmallStruct: (int)x
{
small_struct f = {22};
f.z = x;
return f;
}
/* Doesn't work because GCC generates the wrong encoding: "@0@+8:+12^i+16" */
- sendArray: (int[3])a
{