dotgnu-pnet-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[dotgnu-pnet-commits] pnet ChangeLog engine/call.c engine/lib_array.c...


From: Klaus Treichel
Subject: [dotgnu-pnet-commits] pnet ChangeLog engine/call.c engine/lib_array.c...
Date: Thu, 04 Jun 2009 07:24:55 +0000

CVSROOT:        /cvsroot/dotgnu-pnet
Module name:    pnet
Changes by:     Klaus Treichel <ktreichel>      09/06/04 07:24:55

Modified files:
        .              : ChangeLog 
        engine         : call.c lib_array.c 
        include        : il_varargs.h 

Log message:
        Use the macros in il_varargs.h in call.c and lib_array.c instead of 
having
        each file defining it's own set of macros.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/pnet/ChangeLog?cvsroot=dotgnu-pnet&r1=1.3627&r2=1.3628
http://cvs.savannah.gnu.org/viewcvs/pnet/engine/call.c?cvsroot=dotgnu-pnet&r1=1.45&r2=1.46
http://cvs.savannah.gnu.org/viewcvs/pnet/engine/lib_array.c?cvsroot=dotgnu-pnet&r1=1.35&r2=1.36
http://cvs.savannah.gnu.org/viewcvs/pnet/include/il_varargs.h?cvsroot=dotgnu-pnet&r1=1.1&r2=1.2

Patches:
Index: ChangeLog
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/ChangeLog,v
retrieving revision 1.3627
retrieving revision 1.3628
diff -u -b -r1.3627 -r1.3628
--- ChangeLog   14 May 2009 08:19:03 -0000      1.3627
+++ ChangeLog   4 Jun 2009 07:24:54 -0000       1.3628
@@ -1,3 +1,10 @@
+2009-06-04  Klaus Treichel  <address@hidden>
+
+       * include/il_varargs.h: Add macro IL_VA_ARG(va, type).
+
+       * engine/call.c, engine/lib_array.c: Remove the local vararg macros and
+       use the ones from il_varargs.h instead.
+
 2009-05-14  Heiko Weiss <address@hidden>
 
        * support/time.c: use tzset() to get timezone changes.

Index: engine/call.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/engine/call.c,v
retrieving revision 1.45
retrieving revision 1.46
diff -u -b -r1.45 -r1.46
--- engine/call.c       18 Nov 2008 20:06:05 -0000      1.45
+++ engine/call.c       4 Jun 2009 07:24:55 -0000       1.46
@@ -58,29 +58,7 @@
 
 #include "engine_private.h"
 #include "lib_defs.h"
-#ifdef HAVE_STDARG_H
-#include <stdarg.h>
-#define        VA_LIST                         va_list
-#define        VA_START(arg)           va_list va; va_start(va, arg)
-#define        VA_END                          va_end(va)
-#define        VA_ARG(va,type)         va_arg(va, type)
-#define        VA_GET_LIST                     va
-#else
-#ifdef HAVE_VARARGS_H
-#include <varargs.h>
-#define        VA_LIST                         va_list
-#define        VA_START(arg)           va_list va; va_start(va)
-#define        VA_END                          va_end(va)
-#define        VA_ARG(va,type)         va_arg(va, type)
-#define        VA_GET_LIST                     va
-#else
-#define        VA_LIST                         int
-#define        VA_START
-#define        VA_END
-#define        VA_ARG(va,type)         ((type)0)
-#define        VA_GET_LIST                     0
-#endif
-#endif
+#include <il_varargs.h>
 
 #ifdef __cplusplus
 extern "C" {
@@ -104,12 +82,12 @@
                                                int isCtor, void *_this,
                                            void *argBuffer, void **jitArgs, 
void *userData)
 {
-       VA_LIST va;
+       IL_VA_LIST va;
        ILUInt32 param, numParams;
        ILType *paramType;
 
        /* Copy the incoming "va_list" value */
-       ILMemCpy(&va, userData, sizeof(VA_LIST));
+       ILMemCpy(&va, userData, sizeof(IL_VA_LIST));
 
        /* Push the arguments onto the evaluation stack */
        if(ILType_HasThis(signature) && !isCtor)
@@ -125,7 +103,7 @@
                {
                        /* Get the "this" parameter from the varargs list */
                        *jitArgs = argBuffer;
-                       *((void **)argBuffer) = (void *)(VA_ARG(va, ILObject 
*));
+                       *((void **)argBuffer) = (void *)(IL_VA_ARG(va, ILObject 
*));
                }
                argBuffer += sizeof(void *);
                ++jitArgs;
@@ -145,7 +123,7 @@
                                case IL_META_ELEMTYPE_I1:
                                {
                                        *jitArgs = argBuffer;
-                                       *((ILInt8 *)argBuffer) = 
(ILInt8)VA_ARG(va, ILVaInt);
+                                       *((ILInt8 *)argBuffer) = 
(ILInt8)IL_VA_ARG(va, ILVaInt);
                                        argBuffer += sizeof(ILNativeFloat);
                                        ++jitArgs;
                                }
@@ -154,7 +132,7 @@
                                case IL_META_ELEMTYPE_I2:
                                {
                                        *jitArgs = argBuffer;
-                                       *((ILInt16 *)argBuffer) = 
(ILInt16)VA_ARG(va, ILVaInt);
+                                       *((ILInt16 *)argBuffer) = 
(ILInt16)IL_VA_ARG(va, ILVaInt);
                                        argBuffer += sizeof(ILNativeFloat);
                                        ++jitArgs;
                                }
@@ -166,7 +144,7 @@
                        #endif
                                {
                                        *jitArgs = argBuffer;
-                                       *((ILInt32 *)argBuffer) = 
(ILInt32)VA_ARG(va, ILVaInt);
+                                       *((ILInt32 *)argBuffer) = 
(ILInt32)IL_VA_ARG(va, ILVaInt);
                                        argBuffer += sizeof(ILNativeFloat);
                                        ++jitArgs;
                                }
@@ -175,7 +153,7 @@
                                case IL_META_ELEMTYPE_U1:
                                {
                                        *jitArgs = argBuffer;
-                                       *((ILUInt8 *)argBuffer) = 
(ILUInt8)VA_ARG(va, ILVaUInt);
+                                       *((ILUInt8 *)argBuffer) = 
(ILUInt8)IL_VA_ARG(va, ILVaUInt);
                                        argBuffer += sizeof(ILNativeFloat);
                                        ++jitArgs;
                                }
@@ -185,7 +163,7 @@
                                case IL_META_ELEMTYPE_CHAR:
                                {
                                        *jitArgs = argBuffer;
-                                       *((ILUInt16 *)argBuffer) = 
(ILUInt16)VA_ARG(va, ILVaUInt);
+                                       *((ILUInt16 *)argBuffer) = 
(ILUInt16)IL_VA_ARG(va, ILVaUInt);
                                        argBuffer += sizeof(ILNativeFloat);
                                        ++jitArgs;
                                }
@@ -197,7 +175,7 @@
                        #endif
                                {
                                        *jitArgs = argBuffer;
-                                       *((ILUInt32 *)argBuffer) = 
(ILUInt32)VA_ARG(va, ILVaUInt);
+                                       *((ILUInt32 *)argBuffer) = 
(ILUInt32)IL_VA_ARG(va, ILVaUInt);
                                        argBuffer += sizeof(ILNativeFloat);
                                        ++jitArgs;
                                }
@@ -209,7 +187,7 @@
                        #endif
                                {
                                        *jitArgs = argBuffer;
-                                       *((ILInt64 *)argBuffer) = VA_ARG(va, 
ILInt64);
+                                       *((ILInt64 *)argBuffer) = IL_VA_ARG(va, 
ILInt64);
                                        argBuffer += sizeof(ILNativeFloat);
                                        ++jitArgs;
                                }
@@ -221,7 +199,7 @@
                        #endif
                                {
                                        *jitArgs = argBuffer;
-                                       *((ILUInt64 *)argBuffer) = VA_ARG(va, 
ILUInt64);
+                                       *((ILUInt64 *)argBuffer) = 
IL_VA_ARG(va, ILUInt64);
                                        argBuffer += sizeof(ILUInt64);
                                        ++jitArgs;
                                }
@@ -230,7 +208,7 @@
                                case IL_META_ELEMTYPE_R4:
                                {
                                        *jitArgs = argBuffer;
-                                       *((ILFloat *)argBuffer) = 
(ILFloat)VA_ARG(va, ILVaDouble);
+                                       *((ILFloat *)argBuffer) = 
(ILFloat)IL_VA_ARG(va, ILVaDouble);
                                        argBuffer += sizeof(ILNativeFloat);
                                        ++jitArgs;
                                }
@@ -239,7 +217,7 @@
                                case IL_META_ELEMTYPE_R8:
                                {
                                        *jitArgs = argBuffer;
-                                       *((ILDouble *)argBuffer) = 
(ILDouble)VA_ARG(va, ILVaDouble);
+                                       *((ILDouble *)argBuffer) = 
(ILDouble)IL_VA_ARG(va, ILVaDouble);
                                        argBuffer += sizeof(ILNativeFloat);
                                        ++jitArgs;
                                }
@@ -248,7 +226,7 @@
                                case IL_META_ELEMTYPE_R:
                                {
                                        *jitArgs = argBuffer;
-                                       *((ILNativeFloat *)argBuffer) = 
(ILNativeFloat)VA_ARG(va, ILVaDouble);
+                                       *((ILNativeFloat *)argBuffer) = 
(ILNativeFloat)IL_VA_ARG(va, ILVaDouble);
                                        argBuffer += sizeof(ILNativeFloat);
                                        ++jitArgs;
                                }
@@ -259,7 +237,7 @@
                                        /* We assume that typed references are 
passed to us
                                           as a pointer to a temporary typedref 
structure */
                                        *jitArgs = argBuffer;
-                                       *((void **)argBuffer) = VA_ARG(va, void 
*);
+                                       *((void **)argBuffer) = IL_VA_ARG(va, 
void *);
                                        argBuffer += sizeof(ILNativeFloat);
                                        ++jitArgs;
                                }
@@ -270,7 +248,7 @@
                {
                        /* Process an object reference */
                        *jitArgs = argBuffer;
-                       *((ILObject **)argBuffer) = VA_ARG(va, ILObject *);
+                       *((ILObject **)argBuffer) = IL_VA_ARG(va, ILObject *);
                        argBuffer += sizeof(ILNativeFloat);
                        ++jitArgs;
                }
@@ -279,7 +257,7 @@
                        /* Process a value type: we assume that the caller has
                           put the value into a temporary location and then
                           passed a pointer to the temporary to us */
-                       *jitArgs = (void *)(VA_ARG(va, void *));
+                       *jitArgs = (void *)(IL_VA_ARG(va, void *));
                        ++jitArgs;
                }
                else if(paramType != 0 && ILType_IsComplex(paramType) &&
@@ -287,7 +265,7 @@
                {
                        /* Process a value that is being passed by reference */
                        *jitArgs = argBuffer;
-                       *((void **)argBuffer) = VA_ARG(va, void *);
+                       *((void **)argBuffer) = IL_VA_ARG(va, void *);
                        argBuffer += sizeof(ILNativeFloat);
                        ++jitArgs;
                }
@@ -295,7 +273,7 @@
                {
                        /* Assume that everything else is an object reference */
                        *jitArgs = argBuffer;
-                       *((ILObject **)argBuffer) = VA_ARG(va, ILObject *);
+                       *((ILObject **)argBuffer) = IL_VA_ARG(va, ILObject *);
                        argBuffer += sizeof(ILNativeFloat);
                        ++jitArgs;
                }
@@ -307,7 +285,7 @@
 int _ILCallPackVaParams(ILExecThread *thread, ILMethod *method,
                                            int isCtor, void *_this, void 
*userData)
 {
-       VA_LIST va;
+       IL_VA_LIST va;
        ILType *signature = ILMethod_Signature(method);
        CVMWord *stacktop, *stacklimit;
        ILUInt32 param, numParams;
@@ -318,7 +296,7 @@
        ILNativeFloat fValue;
 
        /* Copy the incoming "va_list" value */
-       ILMemCpy(&va, userData, sizeof(VA_LIST));
+       ILMemCpy(&va, userData, sizeof(IL_VA_LIST));
 
        /* Get the top and extent of the stack */
        stacktop = thread->stackTop;
@@ -337,7 +315,7 @@
                else
                {
                        /* Get the "this" parameter from the varargs list */
-                       stacktop->ptrValue = (void *)(VA_ARG(va, ILObject *));
+                       stacktop->ptrValue = (void *)(IL_VA_ARG(va, ILObject 
*));
                }
                ++stacktop;
        }
@@ -364,7 +342,7 @@
                        #endif
                                {
                                        CHECK_SPACE(1);
-                                       stacktop->intValue = 
(ILInt32)(VA_ARG(va, ILVaInt));
+                                       stacktop->intValue = 
(ILInt32)(IL_VA_ARG(va, ILVaInt));
                                        ++stacktop;
                                }
                                break;
@@ -375,7 +353,7 @@
                        #endif
                                {
                                        CHECK_SPACE(1);
-                                       stacktop->uintValue = 
(ILUInt32)(VA_ARG(va, ILVaUInt));
+                                       stacktop->uintValue = 
(ILUInt32)(IL_VA_ARG(va, ILVaUInt));
                                        ++stacktop;
                                }
                                break;
@@ -388,7 +366,7 @@
                        #endif
                                {
                                        CHECK_SPACE(CVM_WORDS_PER_LONG);
-                                       int64Value = VA_ARG(va, ILInt64);
+                                       int64Value = IL_VA_ARG(va, ILInt64);
                                        ILMemCpy(stacktop, &int64Value, 
sizeof(int64Value));
                                        stacktop += CVM_WORDS_PER_LONG;
                                }
@@ -399,7 +377,7 @@
                                case IL_META_ELEMTYPE_R:
                                {
                                        CHECK_SPACE(CVM_WORDS_PER_NATIVE_FLOAT);
-                                       fValue = (ILNativeFloat)(VA_ARG(va, 
ILVaDouble));
+                                       fValue = (ILNativeFloat)(IL_VA_ARG(va, 
ILVaDouble));
                                        ILMemCpy(stacktop, &fValue, 
sizeof(fValue));
                                        stacktop += CVM_WORDS_PER_NATIVE_FLOAT;
                                }
@@ -410,7 +388,7 @@
                                        /* We assume that typed references are 
passed to us
                                           as a pointer to a temporary typedref 
structure */
                                        CHECK_SPACE(CVM_WORDS_PER_TYPED_REF);
-                                       ptr = (void *)(VA_ARG(va, void *));
+                                       ptr = (void *)(IL_VA_ARG(va, void *));
                                        ILMemCpy(stacktop, ptr, 
sizeof(ILTypedRef));
                                        stacktop += CVM_WORDS_PER_TYPED_REF;
                                }
@@ -421,7 +399,7 @@
                {
                        /* Process an object reference */
                        CHECK_SPACE(1);
-                       stacktop->ptrValue = (void *)(VA_ARG(va, ILObject *));
+                       stacktop->ptrValue = (void *)(IL_VA_ARG(va, ILObject 
*));
                        ++stacktop;
                }
                else if(ILType_IsValueType(paramType))
@@ -429,7 +407,7 @@
                        /* Process a value type: we assume that the caller has
                           put the value into a temporary location and then
                           passed a pointer to the temporary to us */
-                       ptr = (void *)(VA_ARG(va, void *));
+                       ptr = (void *)(IL_VA_ARG(va, void *));
                        size = ILSizeOfType(thread, paramType);
                        sizeInWords = ((size + sizeof(CVMWord) - 1) / 
sizeof(CVMWord));
                        CHECK_SPACE(sizeInWords);
@@ -441,14 +419,14 @@
                {
                        /* Process a value that is being passed by reference */
                        CHECK_SPACE(1);
-                       stacktop->ptrValue = (void *)(VA_ARG(va, void *));
+                       stacktop->ptrValue = (void *)(IL_VA_ARG(va, void *));
                        ++stacktop;
                }
                else
                {
                        /* Assume that everything else is an object reference */
                        CHECK_SPACE(1);
-                       stacktop->ptrValue = (void *)(VA_ARG(va, ILObject *));
+                       stacktop->ptrValue = (void *)(IL_VA_ARG(va, ILObject 
*));
                        ++stacktop;
                }
        }
@@ -1313,7 +1291,7 @@
 }
 
 static int CallVirtualMethod(ILExecThread *thread, ILMethod *method,
-                                                        void *result, void 
*_this, VA_LIST va)
+                                                        void *result, void 
*_this, IL_VA_LIST va)
 {
        ILClass *classInfo;
        ILClass *objectClass;
@@ -1449,12 +1427,12 @@
                                         void *result, ...)
 {
        int threwException;
-       VA_START(result);
+       IL_VA_START(result);
        threwException = _ILCallMethod(thread, method,
                                                                   
_ILCallUnpackDirectResult, result,
                                                                   0, 0,
-                                                                  
_ILCallPackVaParams, &VA_GET_LIST);
-       VA_END;
+                                                                  
_ILCallPackVaParams, &IL_VA_GET_LIST);
+       IL_VA_END;
        return threwException;
 }
 
@@ -1488,10 +1466,10 @@
                                                        void *result, void 
*_this, ...)
 {
        int threwException;
-       VA_START(_this);
+       IL_VA_START(_this);
        threwException = CallVirtualMethod
-                                               (thread, method, result, _this, 
VA_GET_LIST);
-       VA_END;
+                                               (thread, method, result, _this, 
IL_VA_GET_LIST);
+       IL_VA_END;
        return threwException;
 }
 
@@ -1508,13 +1486,13 @@
 {
        int threwException;
        ILMethod *method;
-       VA_START(result);
+       IL_VA_START(result);
        method = ILExecThreadLookupMethod(thread, typeName,
                                                                          
methodName, signature);
        if(!method)
        {
                /* End argument processing */
-               VA_END;
+               IL_VA_END;
 
                /* Construct and throw a "MissingMethodException" object */
                ThrowMethodMissing(thread);
@@ -1525,8 +1503,8 @@
        threwException = _ILCallMethod(thread, method,
                                                                   
_ILCallUnpackDirectResult, result,
                                                                   0, 0,
-                                                                  
_ILCallPackVaParams, &VA_GET_LIST);
-       VA_END;
+                                                                  
_ILCallPackVaParams, &IL_VA_GET_LIST);
+       IL_VA_END;
        return threwException;
 }
 
@@ -1557,13 +1535,13 @@
 {
        int threwException;
        ILMethod *method;
-       VA_START(_this);
+       IL_VA_START(_this);
        method = ILExecThreadLookupMethod(thread, typeName,
                                                                          
methodName, signature);
        if(!method)
        {
                /* End argument processing */
-               VA_END;
+               IL_VA_END;
 
                /* Construct and throw a "MissingMethodException" object */
                ThrowMethodMissing(thread);
@@ -1572,8 +1550,8 @@
                return 1;
        }
        threwException = CallVirtualMethod
-                                               (thread, method, result, _this, 
VA_GET_LIST);
-       VA_END;
+                                               (thread, method, result, _this, 
IL_VA_GET_LIST);
+       IL_VA_END;
        return threwException;
 }
 
@@ -1602,14 +1580,14 @@
        ILMethod *ctor;
        ILClass *classInfo;
        ILObject *result;
-       VA_START(signature);
+       IL_VA_START(signature);
 
        /* Find the constructor */
        ctor = ILExecThreadLookupMethod(thread, typeName, ".ctor", signature);
        if(!ctor)
        {
                /* Throw a "MissingMethodException" */
-               VA_END;
+               IL_VA_END;
                ThrowMethodMissing(thread);
                return 0;
        }
@@ -1621,7 +1599,7 @@
        {
                /* Throw a "TypeLoadException" */
                IL_METADATA_UNLOCK(_ILExecThreadProcess(thread));
-               VA_END;
+               IL_VA_END;
                ILExecThreadThrowSystem(thread, "System.TypeLoadException",
                                                                (const char 
*)0);
                return 0;
@@ -1633,13 +1611,13 @@
        if(_ILCallMethod(thread, ctor,
                                         _ILCallUnpackDirectResult, &result,
                                         1, 0,
-                                        _ILCallPackVaParams, &VA_GET_LIST))
+                                        _ILCallPackVaParams, &IL_VA_GET_LIST))
        {
                /* The constructor threw an exception */
-               VA_END;
+               IL_VA_END;
                return 0;
        }
-       VA_END;
+       IL_VA_END;
        return result;
 }
 

Index: engine/lib_array.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/engine/lib_array.c,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -b -r1.35 -r1.36
--- engine/lib_array.c  3 Jan 2009 14:15:21 -0000       1.35
+++ engine/lib_array.c  4 Jun 2009 07:24:55 -0000       1.36
@@ -20,29 +20,7 @@
 
 #include "engine.h"
 #include "lib_defs.h"
-#ifdef HAVE_STDARG_H
-#include <stdarg.h>
-#define        VA_LIST                         va_list
-#define        VA_START(arg)           va_list va; va_start(va, arg)
-#define        VA_END                          va_end(va)
-#define        VA_ARG(va,type)         va_arg(va, type)
-#define        VA_GET_LIST                     va
-#else
-#ifdef HAVE_VARARGS_H
-#include <varargs.h>
-#define        VA_LIST                         va_list
-#define        VA_START(arg)           va_list va; va_start(va)
-#define        VA_END                          va_end(va)
-#define        VA_ARG(va,type)         va_arg(va, type)
-#define        VA_GET_LIST                     va
-#else
-#define        VA_LIST                         int
-#define        VA_START
-#define        VA_END
-#define        VA_ARG(va,type)         ((type)0)
-#define        VA_GET_LIST                     0
-#endif
-#endif
+#include <il_varargs.h>
 
 #ifdef __cplusplus
 extern "C" {
@@ -266,10 +244,10 @@
        ILInt32 dim;
        ILInt32 index;
 #ifdef IL_USE_JIT
-       VA_LIST va;
+       IL_VA_LIST va;
        
        /* Copy the incoming "va_list" value */
-       ILMemCpy(&va, args, sizeof(VA_LIST));
+       ILMemCpy(&va, args, sizeof(IL_VA_LIST));
 #endif
 
        /* Find the offset of the element */
@@ -277,7 +255,7 @@
        for(dim = 0; dim < _this->rank; ++dim)
        {
        #ifdef IL_USE_JIT
-               index = VA_ARG(va, ILVaInt) - _this->bounds[dim].lower;
+               index = IL_VA_ARG(va, ILVaInt) - _this->bounds[dim].lower;
        #else
                index = ArgWalkerGetInt(args) - _this->bounds[dim].lower;
        #endif
@@ -286,7 +264,7 @@
                        ILExecThreadThrowSystem(thread, 
"System.IndexOutOfRangeException",
                                                                        
"Arg_InvalidArrayIndex");
                #ifdef IL_USE_JIT
-                       VA_END;
+                       IL_VA_END;
                #endif
                        return 0;
                }
@@ -348,10 +326,10 @@
        ILInt32 index;
        void *address;
 #ifdef IL_USE_JIT
-       VA_LIST va;
+       IL_VA_LIST va;
        
        /* Copy the incoming "va_list" value */
-       ILMemCpy(&va, args, sizeof(VA_LIST));
+       ILMemCpy(&va, args, sizeof(IL_VA_LIST));
 #endif
 
        /* Find the offset of the element */
@@ -359,7 +337,7 @@
        for(dim = 0; dim < _this->rank; ++dim)
        {
        #ifdef IL_USE_JIT
-               index = VA_ARG(va, ILVaInt) - _this->bounds[dim].lower;
+               index = IL_VA_ARG(va, ILVaInt) - _this->bounds[dim].lower;
        #else
                index = ArgWalkerGetInt(args) - _this->bounds[dim].lower;
        #endif
@@ -384,7 +362,7 @@
                case IL_META_ELEMTYPE_I1:
                {
                #ifdef IL_USE_JIT
-                       *((ILInt8 *)address) = VA_ARG(va, ILVaInt);
+                       *((ILInt8 *)address) = IL_VA_ARG(va, ILVaInt);
                #else
                        *((ILInt8 *)address) = ArgWalkerGetShortInt(args, 
ILInt8);
                #endif
@@ -394,7 +372,7 @@
                case IL_META_ELEMTYPE_I2:
                {
                #ifdef IL_USE_JIT
-                       *((ILInt16 *)address) = VA_ARG(va, ILVaInt);
+                       *((ILInt16 *)address) = IL_VA_ARG(va, ILVaInt);
                #else
                        *((ILInt16 *)address) = ArgWalkerGetShortInt(args, 
ILInt16);
                #endif
@@ -404,7 +382,7 @@
                case IL_META_ELEMTYPE_I4:
                {
                #ifdef IL_USE_JIT
-                       *((ILInt32 *)address) = VA_ARG(va, ILVaInt);
+                       *((ILInt32 *)address) = IL_VA_ARG(va, ILVaInt);
                #else
                        *((ILInt32 *)address) = ArgWalkerGetInt(args);
                #endif
@@ -414,7 +392,7 @@
                case IL_META_ELEMTYPE_I8:
                {
                #ifdef IL_USE_JIT
-                       ILInt64 longValue = VA_ARG(va, ILInt64);
+                       ILInt64 longValue = IL_VA_ARG(va, ILInt64);
                        ILMemCpy(address, &longValue, sizeof(ILInt64));
                #else
                        ILMemCpy(address, ArgWalkerGetAddr(args), 
sizeof(ILInt64));
@@ -426,7 +404,7 @@
                case IL_META_ELEMTYPE_R4:
                {
                #ifdef IL_USE_JIT
-                       ILFloat floatValue = VA_ARG(va, ILDouble);
+                       ILFloat floatValue = IL_VA_ARG(va, ILDouble);
                        ILMemCpy(address, &floatValue, sizeof(ILFloat));
                #else
                        ILMemCpy(address, ArgWalkerGetAddr(args), 
sizeof(ILFloat));
@@ -438,7 +416,7 @@
                case IL_META_ELEMTYPE_R8:
                {
                #ifdef IL_USE_JIT
-                       ILDouble floatValue = VA_ARG(va, ILVaDouble);
+                       ILDouble floatValue = IL_VA_ARG(va, ILVaDouble);
                        ILMemCpy(address, &floatValue, sizeof(ILDouble));
                #else
                        ILMemCpy(address, ArgWalkerGetAddr(args), 
sizeof(ILDouble));
@@ -450,7 +428,7 @@
                case IL_META_ELEMTYPE_R:
                {
                #ifdef IL_USE_JIT
-                       ILNativeFloat floatValue = VA_ARG(va, ILNativeFloat);
+                       ILNativeFloat floatValue = IL_VA_ARG(va, ILNativeFloat);
                        ILMemCpy(address, &floatValue, sizeof(ILNativeFloat));
                #else
                        ILMemCpy(address, ArgWalkerGetAddr(args), 
sizeof(ILNativeFloat));
@@ -462,7 +440,7 @@
                case IL_META_ELEMTYPE_OBJECT:
                {
                #ifdef IL_USE_JIT
-                       *((ILObject **)address) = (ILObject *)VA_ARG(va, void 
*);
+                       *((ILObject **)address) = (ILObject *)IL_VA_ARG(va, 
void *);
                #else
                        *((ILObject **)address) = (ILObject 
*)ArgWalkerGetPtr(args);
                #endif
@@ -472,7 +450,7 @@
                case IL_META_ELEMTYPE_VALUETYPE:
                {
                #ifdef IL_USE_JIT
-                       void *ptrValue = VA_ARG(va, void *);
+                       void *ptrValue = IL_VA_ARG(va, void *);
                        ILMemCpy(address, ptrValue, _this->elemSize);
                #else
                        ILMemCpy(address, ArgWalkerGetAddr(args), 
_this->elemSize);
@@ -497,7 +475,7 @@
        ILInt32 dim;
        ILInt32 multiplier;
 #ifdef IL_USE_JIT
-       VA_START(thread);
+       IL_VA_START(thread);
 #else
        ArgWalker args;
 #endif
@@ -519,13 +497,13 @@
        {
                _this->bounds[dim].lower = 0;
 #ifdef IL_USE_JIT
-               _this->bounds[dim].size  = VA_ARG(va, ILVaInt);
+               _this->bounds[dim].size  = IL_VA_ARG(va, ILVaInt);
 #else
                _this->bounds[dim].size  = ArgWalkerGetInt(&args);
 #endif
        }
 #ifdef IL_USE_JIT
-       VA_END;
+       IL_VA_END;
 #endif
 
        /* Fill in the array header with the multiplier values */
@@ -555,7 +533,7 @@
        ILInt32 dim;
        ILInt32 multiplier;
 #ifdef IL_USE_JIT
-       VA_START(thread);
+       IL_VA_START(thread);
 #else
        ArgWalker args;
 #endif
@@ -567,7 +545,7 @@
        if(!_this)
        {
        #ifdef IL_USE_JIT
-               VA_END;
+               IL_VA_END;
        #endif
                return 0;
        }
@@ -579,15 +557,15 @@
        for(dim = 0; dim < _this->rank; ++dim)
        {
        #ifdef IL_USE_JIT
-               _this->bounds[dim].lower = VA_ARG(va, ILVaInt);
-               _this->bounds[dim].size  = VA_ARG(va, ILVaInt);
+               _this->bounds[dim].lower = IL_VA_ARG(va, ILVaInt);
+               _this->bounds[dim].size  = IL_VA_ARG(va, ILVaInt);
        #else
                _this->bounds[dim].lower = ArgWalkerGetInt(&args);
                _this->bounds[dim].size  = ArgWalkerGetInt(&args);
        #endif
        }
 #ifdef IL_USE_JIT
-       VA_END;
+       IL_VA_END;
 #endif
 
        /* Fill in the array header with the multiplier values */
@@ -616,7 +594,7 @@
 {
        void *address;
 #ifdef IL_USE_JIT
-       VA_START(_this);
+       IL_VA_START(_this);
 
        address = GetElemAddress(thread, _this, &va);
 #else
@@ -628,14 +606,14 @@
        if(address)
        {
        #ifdef IL_USE_JIT
-               VA_END;
+               IL_VA_END;
        #endif
                return *((ILInt8 *)address);
        }
        else
        {
        #ifdef IL_USE_JIT
-               VA_END;
+               IL_VA_END;
        #endif
                return 0;
        }
@@ -676,7 +654,7 @@
 {
        void *address;
 #ifdef IL_USE_JIT
-       VA_START(_this);
+       IL_VA_START(_this);
        address = GetElemAddress(thread, _this, &va);
 #else
        ArgWalker args;
@@ -686,14 +664,14 @@
        if(address)
        {
        #ifdef IL_USE_JIT
-               VA_END;
+               IL_VA_END;
        #endif
                return *((ILUInt8 *)address);
        }
        else
        {
        #ifdef IL_USE_JIT
-               VA_END;
+               IL_VA_END;
        #endif
                return 0;
        }
@@ -734,7 +712,7 @@
 {
        void *address;
 #ifdef IL_USE_JIT
-       VA_START(_this);
+       IL_VA_START(_this);
        address = GetElemAddress(thread, _this, &va);
 #else
        ArgWalker args;
@@ -744,14 +722,14 @@
        if(address)
        {
        #ifdef IL_USE_JIT
-               VA_END;
+               IL_VA_END;
        #endif
                return *((ILInt16 *)address);
        }
        else
        {
        #ifdef IL_USE_JIT
-               VA_END;
+               IL_VA_END;
        #endif
                return 0;
        }
@@ -792,7 +770,7 @@
 {
        void *address;
 #ifdef IL_USE_JIT
-       VA_START(_this);
+       IL_VA_START(_this);
        address = GetElemAddress(thread, _this, &va);
 #else
        ArgWalker args;
@@ -802,14 +780,14 @@
        if(address)
        {
        #ifdef IL_USE_JIT
-               VA_END;
+               IL_VA_END;
        #endif
                return *((ILUInt16 *)address);
        }
        else
        {
        #ifdef IL_USE_JIT
-               VA_END;
+               IL_VA_END;
        #endif
                return 0;
        }
@@ -850,7 +828,7 @@
 {
        void *address;
 #ifdef IL_USE_JIT
-       VA_START(_this);
+       IL_VA_START(_this);
        address = GetElemAddress(thread, _this, &va);
 #else
        ArgWalker args;
@@ -860,7 +838,7 @@
        if(address)
        {
        #ifdef IL_USE_JIT
-               VA_END;
+               IL_VA_END;
        #endif
                return *((ILInt32 *)address);
        }
@@ -868,7 +846,7 @@
        {
                return 0;
        #ifdef IL_USE_JIT
-               VA_END;
+               IL_VA_END;
        #endif
        }
 }
@@ -908,7 +886,7 @@
 {
        void *address;
 #ifdef IL_USE_JIT
-       VA_START(_this);
+       IL_VA_START(_this);
        address = GetElemAddress(thread, _this, &va);
 #else
        ArgWalker args;
@@ -918,14 +896,14 @@
        if(address)
        {
        #ifdef IL_USE_JIT
-               VA_END;
+               IL_VA_END;
        #endif
                return *((ILUInt32 *)address);
        }
        else
        {
        #ifdef IL_USE_JIT
-               VA_END;
+               IL_VA_END;
        #endif
                return 0;
        }
@@ -966,7 +944,7 @@
 {
        void *address;
 #ifdef IL_USE_JIT
-       VA_START(_this);
+       IL_VA_START(_this);
        address = GetElemAddress(thread, _this, &va);
 #else
        ArgWalker args;
@@ -976,14 +954,14 @@
        if(address)
        {
        #ifdef IL_USE_JIT
-               VA_END;
+               IL_VA_END;
        #endif
                return *((ILInt64 *)address);
        }
        else
        {
        #ifdef IL_USE_JIT
-               VA_END;
+               IL_VA_END;
        #endif
                return 0;
        }
@@ -1024,7 +1002,7 @@
 {
        void *address;
 #ifdef IL_USE_JIT
-       VA_START(_this);
+       IL_VA_START(_this);
        address = GetElemAddress(thread, _this, &va);
 #else
        ArgWalker args;
@@ -1034,14 +1012,14 @@
        if(address)
        {
        #ifdef IL_USE_JIT
-               VA_END;
+               IL_VA_END;
        #endif
                return *((ILUInt64 *)address);
        }
        else
        {
        #ifdef IL_USE_JIT
-               VA_END;
+               IL_VA_END;
        #endif
                return 0;
        }
@@ -1082,7 +1060,7 @@
 {
        void *address;
 #ifdef IL_USE_JIT
-       VA_START(_this);
+       IL_VA_START(_this);
        address = GetElemAddress(thread, _this, &va);
 #else
        ArgWalker args;
@@ -1092,14 +1070,14 @@
        if(address)
        {
        #ifdef IL_USE_JIT
-               VA_END;
+               IL_VA_END;
        #endif
                return *((ILFloat *)address);
        }
        else
        {
        #ifdef IL_USE_JIT
-               VA_END;
+               IL_VA_END;
        #endif
                return 0;
        }
@@ -1140,7 +1118,7 @@
 {
        void *address;
 #ifdef IL_USE_JIT
-       VA_START(_this);
+       IL_VA_START(_this);
        address = GetElemAddress(thread, _this, &va);
 #else
        ArgWalker args;
@@ -1150,14 +1128,14 @@
        if(address)
        {
        #ifdef IL_USE_JIT
-               VA_END;
+               IL_VA_END;
        #endif
                return *((ILDouble *)address);
        }
        else
        {
        #ifdef IL_USE_JIT
-               VA_END;
+               IL_VA_END;
        #endif
                return 0;
        }
@@ -1198,7 +1176,7 @@
 {
        void *address;
 #ifdef IL_USE_JIT
-       VA_START(_this);
+       IL_VA_START(_this);
        address = GetElemAddress(thread, _this, &va);
 #else
        ArgWalker args;
@@ -1208,14 +1186,14 @@
        if(address)
        {
        #ifdef IL_USE_JIT
-               VA_END;
+               IL_VA_END;
        #endif
                return *((ILNativeFloat *)address);
        }
        else
        {
        #ifdef IL_USE_JIT
-               VA_END;
+               IL_VA_END;
        #endif
                return 0;
        }
@@ -1257,7 +1235,7 @@
 {
        void *address;
 #ifdef IL_USE_JIT
-       VA_START(_this);
+       IL_VA_START(_this);
        address = GetElemAddress(thread, _this, &va);
 #else
        ArgWalker args;
@@ -1267,14 +1245,14 @@
        if(address)
        {
        #ifdef IL_USE_JIT
-               VA_END;
+               IL_VA_END;
        #endif
                return *((ILObject **)address);
        }
        else
        {
        #ifdef IL_USE_JIT
-               VA_END;
+               IL_VA_END;
        #endif
                return 0;
        }
@@ -1316,7 +1294,7 @@
 {
        void *address;
 #ifdef IL_USE_JIT
-       VA_START(_this);
+       IL_VA_START(_this);
        address = GetElemAddress(thread, _this, &va);
 #else
        ArgWalker args;
@@ -1328,7 +1306,7 @@
                ILMemCpy(result, address, _this->elemSize);
        }
 #ifdef IL_USE_JIT
-       VA_END;
+       IL_VA_END;
 #endif
 }
 
@@ -1372,9 +1350,9 @@
 {
        void *address;
 #ifdef IL_USE_JIT
-       VA_START(_this);
+       IL_VA_START(_this);
        address = GetElemAddress(thread, _this, &va);
-       VA_END;
+       IL_VA_END;
 #else
        ArgWalker args;
        ArgWalkerInitThis(&args);
@@ -1397,9 +1375,9 @@
 #endif
 {
 #ifdef IL_USE_JIT
-       VA_START(_this);
+       IL_VA_START(_this);
        SetElement(thread, _this, IL_META_ELEMTYPE_I1, &va);
-       VA_END;
+       IL_VA_END;
 #else
        ArgWalker args;
        ArgWalkerInitThis(&args);
@@ -1440,9 +1418,9 @@
 #endif
 {
 #ifdef IL_USE_JIT
-       VA_START(_this);
+       IL_VA_START(_this);
        SetElement(thread, _this, IL_META_ELEMTYPE_I2, &va);
-       VA_END;
+       IL_VA_END;
 #else
        ArgWalker args;
        ArgWalkerInitThis(&args);
@@ -1483,9 +1461,9 @@
 #endif
 {
 #ifdef IL_USE_JIT
-       VA_START(_this);
+       IL_VA_START(_this);
        SetElement(thread, _this, IL_META_ELEMTYPE_I4, &va);
-       VA_END;
+       IL_VA_END;
 #else
        ArgWalker args;
        ArgWalkerInitThis(&args);
@@ -1526,9 +1504,9 @@
 #endif
 {
 #ifdef IL_USE_JIT
-       VA_START(_this);
+       IL_VA_START(_this);
        SetElement(thread, _this, IL_META_ELEMTYPE_I8, &va);
-       VA_END;
+       IL_VA_END;
 #else
        ArgWalker args;
        ArgWalkerInitThis(&args);
@@ -1568,9 +1546,9 @@
 #endif
 {
 #ifdef IL_USE_JIT
-       VA_START(_this);
+       IL_VA_START(_this);
        SetElement(thread, _this, IL_META_ELEMTYPE_R4, &va);
-       VA_END;
+       IL_VA_END;
 #else
        ArgWalker args;
        ArgWalkerInitThis(&args);
@@ -1609,9 +1587,9 @@
 #endif
 {
 #ifdef IL_USE_JIT
-       VA_START(_this);
+       IL_VA_START(_this);
        SetElement(thread, _this, IL_META_ELEMTYPE_R8, &va);
-       VA_END;
+       IL_VA_END;
 #else
        ArgWalker args;
        ArgWalkerInitThis(&args);
@@ -1650,9 +1628,9 @@
 #endif
 {
 #ifdef IL_USE_JIT
-       VA_START(_this);
+       IL_VA_START(_this);
        SetElement(thread, _this, IL_META_ELEMTYPE_R, &va);
-       VA_END;
+       IL_VA_END;
 #else
        ArgWalker args;
        ArgWalkerInitThis(&args);
@@ -1691,9 +1669,9 @@
 #endif
 {
 #ifdef IL_USE_JIT
-       VA_START(_this);
+       IL_VA_START(_this);
        SetElement(thread, _this, IL_META_ELEMTYPE_OBJECT, &va);
-       VA_END;
+       IL_VA_END;
 #else
        ArgWalker args;
        ArgWalkerInitThis(&args);
@@ -1732,9 +1710,9 @@
 #endif
 {
 #ifdef IL_USE_JIT
-       VA_START(_this);
+       IL_VA_START(_this);
        SetElement(thread, _this, IL_META_ELEMTYPE_VALUETYPE, &va);
-       VA_END;
+       IL_VA_END;
 #else
        ArgWalker args;
        ArgWalkerInitThis(&args);
@@ -4142,7 +4120,7 @@
 
                        /* Copy the value to the element */
                        {
-                               VA_START(index);
+                               IL_VA_START(index);
                                if(ILType_IsPrimitive(type))
                                {
                                        /* Primitive type */
@@ -4152,7 +4130,7 @@
                                                case IL_META_ELEMTYPE_I1:
                                                case IL_META_ELEMTYPE_U1:
                                                {
-                                                       ArrayElem(ILInt8) = 
(ILInt8)(VA_ARG(va, ILVaInt));
+                                                       ArrayElem(ILInt8) = 
(ILInt8)(IL_VA_ARG(va, ILVaInt));
                                                }
                                                break;
 
@@ -4160,7 +4138,7 @@
                                                case IL_META_ELEMTYPE_U2:
                                                case IL_META_ELEMTYPE_CHAR:
                                                {
-                                                       ArrayElem(ILInt16) = 
(ILInt16)(VA_ARG(va, ILVaInt));
+                                                       ArrayElem(ILInt16) = 
(ILInt16)(IL_VA_ARG(va, ILVaInt));
                                                }
                                                break;
 
@@ -4171,7 +4149,7 @@
                                                case IL_META_ELEMTYPE_U:
                                        #endif
                                                {
-                                                       ArrayElem(ILInt32) = 
(ILInt32)(VA_ARG(va, ILVaInt));
+                                                       ArrayElem(ILInt32) = 
(ILInt32)(IL_VA_ARG(va, ILVaInt));
                                                }
                                                break;
 
@@ -4182,7 +4160,7 @@
                                                case IL_META_ELEMTYPE_U:
                                        #endif
                                                {
-                                                       ILInt64 int64Value = 
VA_ARG(va, ILInt64);
+                                                       ILInt64 int64Value = 
IL_VA_ARG(va, ILInt64);
                                                        
ILMemCpy(&(ArrayElem(ILInt64)), &int64Value,
                                                                         
sizeof(ILInt64));
                                                }
@@ -4191,14 +4169,14 @@
                                                case IL_META_ELEMTYPE_R4:
                                                {
                                                        ArrayElem(ILFloat) =
-                                                                       
(ILFloat)(VA_ARG(va, ILVaDouble));
+                                                                       
(ILFloat)(IL_VA_ARG(va, ILVaDouble));
                                                }
                                                break;
 
                                                case IL_META_ELEMTYPE_R8:
                                                {
                                                        ILDouble fValue =
-                                                               
(ILDouble)(VA_ARG(va, ILVaDouble));
+                                                               
(ILDouble)(IL_VA_ARG(va, ILVaDouble));
                                                        
ILMemCpy(&(ArrayElem(ILDouble)), &fValue,
                                                                         
sizeof(fValue));
                                                }
@@ -4207,7 +4185,7 @@
                                                case IL_META_ELEMTYPE_R:
                                                {
                                                        ILNativeFloat fValue =
-                                                               
(ILNativeFloat)(VA_ARG(va, ILVaDouble));
+                                                               
(ILNativeFloat)(IL_VA_ARG(va, ILVaDouble));
                                                        
ILMemCpy(&(ArrayElem(ILNativeFloat)), &fValue,
                                                                         
sizeof(fValue));
                                                }
@@ -4218,14 +4196,14 @@
                                {
                                        /* Value type: the caller has passed us 
a pointer */
                                        ILMemCpy(&(ArrayElem(ILInt8)),
-                                                        VA_ARG(va, void *), 
elemSize);
+                                                        IL_VA_ARG(va, void *), 
elemSize);
                                }
                                else
                                {
                                        /* Everything else is a pointer */
-                                       ArrayElem(void *) = VA_ARG(va, void *);
+                                       ArrayElem(void *) = IL_VA_ARG(va, void 
*);
                                }
-                               VA_END;
+                               IL_VA_END;
                        }
                        return 0;
                }

Index: include/il_varargs.h
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/include/il_varargs.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- include/il_varargs.h        18 Apr 2009 19:18:20 -0000      1.1
+++ include/il_varargs.h        4 Jun 2009 07:24:55 -0000       1.2
@@ -32,6 +32,7 @@
 #define        IL_VA_LIST                      va_list
 #define        IL_VA_START(arg)        va_list va; va_start(va, arg)
 #define        IL_VA_END                       va_end(va)
+#define        IL_VA_ARG(va, type)     va_arg(va, type)
 #define        IL_VA_GET_LIST          va
 #else
 #ifdef HAVE_VARARGS_H
@@ -39,11 +40,13 @@
 #define        IL_VA_LIST                      va_list
 #define        IL_VA_START(arg)        va_list va; va_start(va)
 #define        IL_VA_END                       va_end(va)
+#define        IL_VA_ARG(va, type)     va_arg(va, type)
 #define        IL_VA_GET_LIST          va
 #else
 #define        IL_VA_LIST                      int
 #define        IL_VA_START(arg)
 #define        IL_VA_END
+#define        IL_VA_ARG(va, type)     ((type)0)
 #define        IL_VA_GET_LIST          0
 #endif
 #endif




reply via email to

[Prev in Thread] Current Thread [Next in Thread]