📄 avcall.h.msvc
字号:
#ifndef _avcall_h /*-*- C -*-*/#define _avcall_h/** Copyright 1993 Bill Triggs, <Bill.Triggs@inrialpes.fr> Copyright 1995-2004 Bruno Haible, <bruno@clisp.org> This is free software distributed under the GNU General Public Licence described in the file COPYING. Contact the author if you don't have this or can't live with it. There is ABSOLUTELY NO WARRANTY, explicit or implied, on this software.**//*---------------------------------------------------------------------- av_call() foreign function interface. Varargs-style macros to build a C argument list incrementally and call a function on it. ----------------------------------------------------------------------*//* These definitions are adjusted by `configure' automatically. *//* CPU */#ifndef __i386__#define __i386__ 1#endif#ifndef __m68k__#undef __m68k__#endif#ifndef __mips__#undef __mips__#endif#ifndef __mipsn32__#undef __mipsn32__#endif#ifndef __mips64__#undef __mips64__#endif#ifndef __sparc__#undef __sparc__#endif#ifndef __sparc64__#undef __sparc64__#endif#ifndef __alpha__#undef __alpha__#endif#ifndef __hppa__#undef __hppa__#endif#ifndef __arm__#undef __arm__#endif#ifndef __rs6000__#undef __rs6000__#endif#ifndef __s390__#undef __s390__#endif#ifndef __m88k__#undef __m88k__#endif#ifndef __convex__#undef __convex__#endif#ifndef __ia64__#undef __ia64__#endif#ifndef __x86_64__#undef __x86_64__#endif/* Calling convention *//* Define if using pcc non-reentrant struct return convention */#undef __PCC_STRUCT_RETURN__/* Define if small structs are returned in registers */#define __SMALL_STRUCT_RETURN__ 1/* Define if floating-point results are returned in the integer registers */#undef __IREG_FLOAT_RETURN__/* CL_LONGLONG *//* Define if your compiler supports the `long long' type. */#undef HAVE_LONGLONG/* End of definitions adjusted by `configure'. *//* Max # words in argument-list and temporary structure storage. */#ifndef __AV_ALIST_WORDS#define __AV_ALIST_WORDS 256#endif/* Determine the alignment of a type at compile time. */#if defined(__GNUC__)#define __AV_alignof __alignof__#else#if defined(__mips__) || defined(__mipsn32__) || defined(__mips64__) /* SGI compiler */#define __AV_alignof __builtin_alignof#else#define __AV_offsetof(type,ident) ((unsigned long)&(((type*)0)->ident))#define __AV_alignof(type) __AV_offsetof(struct { char __slot1; type __slot2; }, __slot2)#endif#endif/* C builtin types. */#if defined(__mipsn32__)typedef long long __avword;#elsetypedef long __avword;#endifenum __AVtype{ __AVword, __AVvoid, __AVchar, __AVschar, __AVuchar, __AVshort, __AVushort, __AVint, __AVuint, __AVlong, __AVulong, __AVlonglong, __AVulonglong, __AVfloat, __AVdouble, __AVvoidp, __AVstruct};enum __AV_alist_flags{ /* how to return structs */ /* There are basically 3 ways to return structs: * a. The called function returns a pointer to static data. Not reentrant. * b. The caller passes the return structure address in a dedicated register * or as a first (or last), invisible argument. The called function stores * its result there. * c. Like b, and the called function also returns the return structure * address in the return value register. (This is not very distinguishable * from b.) * Independently of this, * r. small structures (<= 4 or <= 8 bytes) may be returned in the return * value register(s), or * m. even small structures are passed in memory. */ /* gcc-2.6.3 employs the following strategy: * - If PCC_STATIC_STRUCT_RETURN is defined in the machine description * it uses method a, else method c. * - If flag_pcc_struct_return is set (either by -fpcc-struct-return or if * DEFAULT_PCC_STRUCT_RETURN is defined to 1 in the machine description) * it uses method m, else (either by -freg-struct-return or if * DEFAULT_PCC_STRUCT_RETURN is defined to 0 in the machine description) * method r. */ __AV_PCC_STRUCT_RETURN = 1<<0, /* a: need to copy the struct */ __AV_SMALL_STRUCT_RETURN = 1<<1, /* r: special case for small structs */ __AV_GCC_STRUCT_RETURN = 1<<2, /* consider 8 byte structs as small */#if defined(__sparc__) && !defined(__sparc64__) __AV_SUNCC_STRUCT_RETURN = 1<<3, __AV_SUNPROCC_STRUCT_RETURN = 1<<4,#endif#if defined(__i386__) __AV_NEXTGCC_STRUCT_RETURN = 1<<3, __AV_MSVC_STRUCT_RETURN = 1<<4,#endif#if defined(__hppa__) __AV_OLDGCC_STRUCT_RETURN = 1<<3,#endif /* the default way to return structs */ /* This choice here is based on the assumption that the function you are * going to call has been compiled with the same compiler you are using to * include this file. * If you want to call functions with another struct returning convention, * just #define __AV_STRUCT_RETURN ... * before or after #including <avcall.h>. */#ifndef __AV_STRUCT_RETURN __AV_STRUCT_RETURN =#if defined(__sparc__) && !defined(__sparc64__) && defined(sun) && defined(__SUNPRO_C) /* SUNWspro cc */ __AV_SUNPROCC_STRUCT_RETURN,#else#if defined(__PCC_STRUCT_RETURN__) /* defined through configure, see above */ __AV_PCC_STRUCT_RETURN |#if defined(__sparc__) && !defined(__sparc64__) && defined(sun) && !(defined(__STDC__) || defined(__GNUC__)) /* sun cc */ __AV_SUNCC_STRUCT_RETURN,#else 0,#endif#else#if defined(__SMALL_STRUCT_RETURN__) || defined(__mipsn32__) || defined(__mips64__) /* defined through configure, see above */ __AV_SMALL_STRUCT_RETURN |#endif#if defined(__GNUC__) __AV_GCC_STRUCT_RETURN |#endif#if defined(__i386__) && defined(NeXT) && defined(__GNUC__) /* NeXT gcc-2.5.8 */ __AV_NEXTGCC_STRUCT_RETURN |#endif#if defined(__i386__) && defined(_MSC_VER) /* MSVC 4.0 */ __AV_MSVC_STRUCT_RETURN |#endif#if defined(__hppa__) && defined(__GNUC__) && (__GNUC__ < 3) && (__GNUC_MINOR__ < 7) __AV_OLDGCC_STRUCT_RETURN |#endif 0,#endif#endif#endif /* how to return floats */#if defined(__m68k__) || (defined(__sparc__) && !defined(__sparc64__)) __AV_SUNCC_FLOAT_RETURN = 1<<5,#endif#if defined(__m68k__) __AV_FREG_FLOAT_RETURN = 1<<6,#endif /* the default way to return floats */ /* This choice here is based on the assumption that the function you are * going to call has been compiled with the same compiler you are using to * include this file. * If you want to call functions with another float returning convention, * just #define __AV_FLOAT_RETURN ... * before or after #including <avcall.h>. */#ifndef __AV_FLOAT_RETURN#if (defined(__m68k__) || (defined(__sparc__) && !defined(__sparc64__))) && !defined(__GNUC__) && defined(sun) && !defined(__SUNPRO_C) /* sun cc */ __AV_FLOAT_RETURN = __AV_SUNCC_FLOAT_RETURN,#elif (defined(__m68k__) && !defined(__IREG_FLOAT_RETURN__)) __AV_FLOAT_RETURN = __AV_FREG_FLOAT_RETURN,#else __AV_FLOAT_RETURN = 0,#endif#endif /* how to pass structs */#if defined(__mips__) || defined(__mipsn32__) || defined(__mips64__) __AV_SGICC_STRUCT_ARGS = 1<<7,#endif#if defined(__rs6000__) __AV_AIXCC_STRUCT_ARGS = 1<<7,#endif /* the default way to pass floats */ /* This choice here is based on the assumption that the function you are * going to call has been compiled with the same compiler you are using to * include this file. * If you want to call functions with another float passing convention, * just #define __AV_STRUCT_ARGS ... * before or after #including <avcall.h>. */#ifndef __AV_STRUCT_ARGS#if (defined(__mips__) || defined(__mipsn32__) || defined(__mips64__)) && !defined(__GNUC__) /* SGI mips cc */ __AV_STRUCT_ARGS = __AV_SGICC_STRUCT_ARGS,#else#if defined(__rs6000__) && defined(_AIX) && !defined(__GNUC__) /* AIX cc, xlc */ __AV_STRUCT_ARGS = __AV_AIXCC_STRUCT_ARGS,#else __AV_STRUCT_ARGS = 0,#endif#endif#endif /* how to pass floats */ /* ANSI C compilers and GNU gcc pass floats as floats. * K&R C compilers pass floats as doubles. * (Except some compilers like SGI MIPS "cc" and "cc -cckr" if a prototype is * known for the called functions. But to compile a program with prototypes, * "cc -ansi" is better anyway. */ __AV_ANSI_FLOAT_ARGS = 0, /* pass floats as floats */ __AV_TRADITIONAL_FLOAT_ARGS = 1<<8, /* pass floats as doubles */ /* the default way to pass floats */ /* This choice here is based on the assumption that the function you are * going to call has been compiled with the same compiler you are using to * include this file. * If you want to call functions with another float passing convention, * just #define __AV_FLOAT_ARGS ... * before or after #including <avcall.h>. */#ifndef __AV_FLOAT_ARGS#if defined(__STDC__) || defined(__GNUC__) /* what about hppa "cc -Aa" ?? */ __AV_FLOAT_ARGS = __AV_ANSI_FLOAT_ARGS,#else __AV_FLOAT_ARGS = __AV_TRADITIONAL_FLOAT_ARGS,#endif#endif /* how to pass and return small integer arguments */ __AV_ANSI_INTEGERS = 0, /* no promotions */ __AV_TRADITIONAL_INTEGERS = 0, /* promote [u]char, [u]short to [u]int */ /* Fortunately these two methods are compatible. Our macros work with both. */ /* the default way to pass and return small integer arguments */ /* This choice here is based on the assumption that the function you are * going to call has been compiled with the same compiler you are using to * include this file. * If you want to call functions with another float passing convention, * just #define __AV_INTEGERS ... * before or after #including <avcall.h>. */#ifndef __AV_INTEGERS#if defined(__STDC__) || defined(__GNUC__) __AV_INTEGERS = __AV_ANSI_INTEGERS,#else __AV_INTEGERS = __AV_TRADITIONAL_INTEGERS,#endif#endif /* stack cleanup policy */ __AV_CDECL_CLEANUP = 0, /* caller pops args after return */ __AV_STDCALL_CLEANUP = 0, /* callee pops args before return */ /* currently only supported on __i386__ */#ifndef __AV_CLEANUP __AV_CLEANUP = __AV_CDECL_CLEANUP,#endif /* These are for internal use only */#if defined(__i386__) || defined(__m68k__) || defined(__mipsn32__) || defined(__mips64__) || defined(__sparc64__) || defined(__alpha__) || defined(__arm__) || defined(__rs6000__) || defined(__convex__) || defined(__ia64__) || defined(__x86_64__) || defined(__s390__) __AV_REGISTER_STRUCT_RETURN = 1<<9,#endif#if defined(__mips__) && !defined(__mipsn32__) __AV_FLOAT_1 = 1<<10, __AV_FLOAT_2 = 1<<11,#endif __AV_flag_for_broken_compilers_that_dont_like_trailing_commas};typedef struct{ /* function to be called */ __avword (*func)(); /* some av_... macros need these flags */ int flags; /* return type, address for the result */ void* raddr; enum __AVtype rtype; unsigned long rsize; /* current pointer into the args[] array */ __avword* aptr;#if defined(__sparc__) || defined(__sparc64__) || defined(__hppa__) || (defined(__rs6000__) && !defined(_AIX) && !(defined(__MACH__) && defined(__APPLE__))) || defined(__s390__) /* limit pointer into the args[] array */ __avword* eptr;#endif#if defined(__i386__) && 0 /* Filler word, needed if the numbers of words up to now in this structure */ /* is odd (because on MSVC, alignof(double) = 8, normally = 4). */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -