2010-04-07 Jb Evain <jbevain@novell.com>
[mcs.git] / tests / test-399-lib.cs
blob45459088ede3e087b9de303326ee9e382f73479b
1 // Compiler options: -t:library
3 using System;
5 public struct Result {
6 public int res;
7 // big enough that it won't be returned in registers
8 double duh;
9 long bah;
11 public Result (int val) {
12 res = val;
13 bah = val;
14 duh = val;
18 public class Vararg
20 public static int AddABunchOfInts (__arglist)
22 int result = 0;
24 System.ArgIterator iter = new System.ArgIterator (__arglist);
25 int argCount = iter.GetRemainingCount();
27 for (int i = 0; i < argCount; i++) {
28 System.TypedReference typedRef = iter.GetNextArg();
29 result += (int)TypedReference.ToObject( typedRef );
32 return result;
35 public static int AddASecondBunchOfInts (int a, __arglist)
37 int result = 0;
39 System.ArgIterator iter = new System.ArgIterator (__arglist);
40 int argCount = iter.GetRemainingCount();
42 for (int i = 0; i < argCount; i++) {
43 System.TypedReference typedRef = iter.GetNextArg();
44 result += (int)TypedReference.ToObject( typedRef );
47 return result;
50 public static Result VtAddABunchOfInts (__arglist)
52 int result = 0;
54 System.ArgIterator iter = new System.ArgIterator (__arglist);
55 int argCount = iter.GetRemainingCount();
57 for (int i = 0; i < argCount; i++) {
58 System.TypedReference typedRef = iter.GetNextArg();
59 result += (int)TypedReference.ToObject( typedRef );
62 return new Result (result);
65 public static Result VtAddASecondBunchOfInts (int a, __arglist)
67 int result = 0;
69 System.ArgIterator iter = new System.ArgIterator (__arglist);
70 int argCount = iter.GetRemainingCount();
72 for (int i = 0; i < argCount; i++) {
73 System.TypedReference typedRef = iter.GetNextArg();
74 result += (int)TypedReference.ToObject( typedRef );
77 return new Result (result);
80 public int InstAddABunchOfInts (__arglist)
82 int result = 0;
84 System.ArgIterator iter = new System.ArgIterator (__arglist);
85 int argCount = iter.GetRemainingCount();
87 for (int i = 0; i < argCount; i++) {
88 System.TypedReference typedRef = iter.GetNextArg();
89 result += (int)TypedReference.ToObject( typedRef );
92 return result;
95 public int InstAddASecondBunchOfInts (int a, __arglist)
97 int result = 0;
99 System.ArgIterator iter = new System.ArgIterator (__arglist);
100 int argCount = iter.GetRemainingCount();
102 for (int i = 0; i < argCount; i++) {
103 System.TypedReference typedRef = iter.GetNextArg();
104 result += (int)TypedReference.ToObject( typedRef );
107 return result;
110 public Result InstVtAddABunchOfInts (__arglist)
112 int result = 0;
114 System.ArgIterator iter = new System.ArgIterator (__arglist);
115 int argCount = iter.GetRemainingCount();
117 for (int i = 0; i < argCount; i++) {
118 System.TypedReference typedRef = iter.GetNextArg();
119 result += (int)TypedReference.ToObject( typedRef );
122 return new Result (result);
125 public Result InstVtAddASecondBunchOfInts (int a, __arglist)
127 int result = 0;
129 System.ArgIterator iter = new System.ArgIterator (__arglist);
130 int argCount = iter.GetRemainingCount();
132 for (int i = 0; i < argCount; i++) {
133 System.TypedReference typedRef = iter.GetNextArg();
134 result += (int)TypedReference.ToObject( typedRef );
137 return new Result (result);