/* $Id: 572c.c 906 2003-12-15 20:33:09Z bird $ */ /** @file * * _Optlink declaration and definition testcases. * * InnoTek Systemberatung GmbH confidential * * Copyright (c) 2003 InnoTek Systemberatung GmbH * Author: knut st. osmundsen * * All Rights Reserved * */ typedef struct some_struct_pointer * PTYPE; /* * Function and method declarations. * Checks mangling. */ /* No underscore, No mangling. */ void _Optlink CVoid(int a, int b, int c, int d); void * _Optlink CPVoid(int a, int b, int c, int d); int _Optlink CInt(int a, int b, int c, int d); PTYPE _Optlink CPType(int a, int b, int c, int d); /* * Typedefs. * Checks that there is not warnings on these. */ typedef void _Optlink Typedef1Void(int a, int b, int c, int d); typedef void * _Optlink Typedef1PVoid(int a, int b, int c, int d); typedef int _Optlink Typedef1Int(int a, int b, int c, int d); typedef PTYPE _Optlink Typedef1PType(int a, int b, int c, int d); typedef void (_Optlink Typedef2Void)(int a, int b, int c, int d); typedef void * (_Optlink Typedef2PVoid)(int a, int b, int c, int d); typedef int (_Optlink Typedef2Int)(int a, int b, int c, int d); typedef PTYPE (_Optlink Typedef2PType)(int a, int b, int c, int d); typedef void (* _Optlink PTypedef1Void)(int a, int b, int c, int d); typedef void * (* _Optlink PTypedef1PVoid)(int a, int b, int c, int d); typedef int (* _Optlink PTypedef1Int)(int a, int b, int c, int d); typedef PTYPE (* _Optlink PTypedef1PType)(int a, int b, int c, int d); /* Alternate writing which should have the same effect I think... */ typedef void (_Optlink * PTypedef2Void)(int a, int b, int c, int d); typedef void * (_Optlink * PTypedef2PVoid)(int a, int b, int c, int d); typedef int (_Optlink * PTypedef2Int)(int a, int b, int c, int d); typedef PTYPE (_Optlink * PTypedef2PType)(int a, int b, int c, int d); /* * Structures. */ typedef struct VFT { void (_Optlink * PStructMemberVoid)(int a, int b, int c, int d); void * (_Optlink * PStructMemberPVoid)(int a, int b, int c, int d); int (_Optlink * PStructMemberInt)(int a, int b, int c, int d); PTYPE (_Optlink * PStructMemberPType)(int a, int b, int c, int d); /* Alternate writing which should have the same effect I think... */ void (_Optlink * PStructMember2Void)(int a, int b, int c, int d); void * (_Optlink * PStructMember2PVoid)(int a, int b, int c, int d); int (_Optlink * PStructMember2Int)(int a, int b, int c, int d); PTYPE (_Optlink * PStructMember2PType)(int a, int b, int c, int d); } VFT, *PVFT; /* * Variables */ void (* _Optlink PVar1Void)(int a, int b, int c, int d); void * (* _Optlink PVar1PVoid)(int a, int b, int c, int d); int (* _Optlink PVar1Int)(int a, int b, int c, int d); PTYPE (* _Optlink PVar1PType)(int a, int b, int c, int d); /* Alternate writing which should have the same effect I think... */ void (_Optlink * PVar2Void)(int a, int b, int c, int d); void * (_Optlink * PVar2PVoid)(int a, int b, int c, int d); int (_Optlink * PVar2Int)(int a, int b, int c, int d); PTYPE (_Optlink * PVar2PType)(int a, int b, int c, int d); /* * Parameters. */ int ParamArgs( void (* _Optlink pfn1Void)(int a, int b, int c, int d), void * (* _Optlink pfn1PVoid)(int a, int b, int c, int d), int (* _Optlink pfn1Int)(int a, int b, int c, int d), PTYPE (* _Optlink pfn1PType)(int a, int b, int c, int d), void (_Optlink * pfn2Void)(int a, int b, int c, int d), void * (_Optlink * pfn2PVoid)(int a, int b, int c, int d), int (_Optlink * pfn2Int)(int a, int b, int c, int d), PTYPE (_Optlink * pfn2PType)(int a, int b, int c, int d) ) { pfn1Void(1,2,3,4); pfn1PVoid(1,2,3,4); pfn1Int(1,2,3,4); pfn1PType(1,2,3,4); pfn2Void(1,2,3,4); pfn2PVoid(1,2,3,4); pfn2Int(1,2,3,4); pfn2PType(1,2,3,4); return 0; } int DoC(int a, int b, int c, int d) { static VFT vft = {CVoid, CPVoid, CInt, CPType, CVoid, CPVoid, CInt, CPType}; static Typedef1Void * pfnTypedef1Void = CVoid; static Typedef1PVoid * pfnTypedef1PVoid = CPVoid; static Typedef1Int * pfnTypedef1Int = CInt; static Typedef1PType * pfnTypedef1PType = CPType; static Typedef2Void * pfnTypedef2Void = CVoid; static Typedef2PVoid * pfnTypedef2PVoid = CPVoid; static Typedef2Int * pfnTypedef2Int = CInt; static Typedef2PType * pfnTypedef2PType = CPType; static PTypedef1Void pfnPTypedef1Void = CVoid; static PTypedef1PVoid pfnPTypedef1PVoid = CPVoid; static PTypedef1Int pfnPTypedef1Int = CInt; static PTypedef1PType pfnPTypedef1PType = CPType; static PTypedef2Void pfnPTypedef2Void = CVoid; static PTypedef2PVoid pfnPTypedef2PVoid = CPVoid; static PTypedef2Int pfnPTypedef2Int = CInt; static PTypedef2PType pfnPTypedef2PType = CPType; PVar1Void = CVoid; PVar1PVoid = CPVoid; PVar1Int = CInt; PVar1PType = CPType; PVar2Void = CVoid; PVar2PVoid = CPVoid; PVar2Int = CInt; PVar2PType = CPType; /* extern functions */ CVoid(1,2,3,4); CPVoid(1,2,3,4); CInt(1,2,3,4); CPType(1,2,3,4); /* typedefs */ pfnTypedef1Void(1,2,3,4); pfnTypedef1PVoid(1,2,3,4); pfnTypedef1Int(1,2,3,4); pfnTypedef1PType(1,2,3,4); pfnTypedef2Void(1,2,3,4); pfnTypedef2PVoid(1,2,3,4); pfnTypedef2Int(1,2,3,4); pfnTypedef2PType(1,2,3,4); pfnPTypedef1Void(1,2,3,4); pfnPTypedef1PVoid(1,2,3,4); pfnPTypedef1Int(1,2,3,4); pfnPTypedef1PType(1,2,3,4); pfnPTypedef2Void(1,2,3,4); pfnPTypedef2PVoid(1,2,3,4); pfnPTypedef2Int(1,2,3,4); pfnPTypedef2PType(1,2,3,4); /* structs */ vft.PStructMemberVoid(1,2,3,4); vft.PStructMemberPVoid(1,2,3,4); vft.PStructMemberInt(1,2,3,4); vft.PStructMemberPType(1,2,3,4); vft.PStructMember2Void(1,2,3,4); vft.PStructMember2PVoid(1,2,3,4); vft.PStructMember2Int(1,2,3,4); vft.PStructMember2PType(1,2,3,4); /* variables */ PVar1Void(1,2,3,4); PVar1PVoid(1,2,3,4); PVar1Int(1,2,3,4); PVar1PType(1,2,3,4); PVar2Void(1,2,3,4); PVar2PVoid(1,2,3,4); PVar2Int(1,2,3,4); PVar2PType(1,2,3,4); /* parameters */ ParamArgs(CVoid, CPVoid, CInt, CPType, CVoid, CPVoid, CInt, CPType); return 0; }