home *** CD-ROM | disk | FTP | other *** search
/ Supercompiler 1997 / SUPERCOMPILER97.iso / MS_VC.50 / VC / MFC / SRC / INETCALL.CPP < prev    next >
Encoding:
C/C++ Source or Header  |  1996-10-30  |  3.2 KB  |  108 lines

  1. // This is a part of the Microsoft Foundation Classes C++ library.
  2. // Copyright (C) 1992-1997 Microsoft Corporation
  3. // All rights reserved.
  4. //
  5. // This source code is only intended as a supplement to the
  6. // Microsoft Foundation Classes Reference and related
  7. // electronic documentation provided with the library.
  8. // See these sources for detailed information regarding the
  9. // Microsoft Foundation Classes product.
  10.  
  11. #ifdef _AFXDLL
  12. #include "stdafx.h"
  13. #endif
  14. #include <afxisapi.h>
  15.  
  16. // Note: because of the nature of these functions, it is not possible
  17. //  to create a 'C' or 'C++' version of them.  These functions are used
  18. //  for the lowest level of the OLE IDispatch implementation, and need
  19. //  to be ported to each supported platform.
  20.  
  21. extern "C" {
  22.  
  23. /////////////////////////////////////////////////////////////////////////////
  24. // Intel 386 version
  25.  
  26. #ifdef _X86_
  27.  
  28. __declspec(naked) void AFXISAPI
  29. _AfxParseCall(AFX_PISAPICMD /*pfn*/, void* /*pArgs*/, UINT /*nSizeArgs*/)
  30. {
  31.     _asm
  32.     {
  33.         pop     edx         // edx = return address
  34.         pop     eax         // eax = pfn
  35.         pop     ecx         // ecx = pArgs
  36.         add     ecx,[esp]   // ecx += nSizeArgs (=scratch area)
  37.         mov     [ecx],edx   // scratch[0] = return address
  38.         sub     ecx,[esp]   // ecx = pArgs (again)
  39.         mov     esp,ecx     // esp = pArgs (usually already correct)
  40.         pop     ecx         // ecx = this pointer (the CCmdTarget*)
  41.         call    eax         // call member function
  42.         ret                 // esp[0] should = scratch[0] = return address
  43.     }
  44. }
  45. #endif // _X86_
  46.  
  47. /////////////////////////////////////////////////////////////////////////////
  48. // MIPS R4000 version
  49.  
  50. #ifdef _MIPS_
  51.  
  52. extern "C" void _asm(char *, ...);
  53. void AFXISAPI
  54. _AfxParseCall(AFX_PMSG /*pfn*/, void* /*pArgs*/, UINT /*nSizeArgs*/)
  55. {
  56.     _asm("addiu     %sp,%a1,0x0");      // sp = pArgs
  57.     _asm("addiu     %t6,%a0,0x0");      // t6 = pfn (save it)
  58.     _asm("lw        %a0,0x0(%sp)");     // a0 = param0
  59.     _asm("lw        %a1,0x4(%sp)");     // a1 = param1
  60.     _asm("lw        %a2,0x8(%sp)");     // a2 = param2
  61.     _asm("lw        %a3,0xc(%sp)");     // a3 = param3
  62.     _asm("j         %t6");              // ip = pfn (jump to target function)
  63. }
  64.  
  65. #endif // _MIPS_
  66.  
  67. /////////////////////////////////////////////////////////////////////////////
  68. // DEC Alpha AXP version
  69.  
  70. #ifdef _ALPHA_
  71.  
  72. // Note: ALPHA version is in src\alpha\inetcal_.s
  73.  
  74. // The ALPHA compiler does not support inline assembly, so it
  75. //  must be build separately with the ASAXP assembler.
  76.  
  77. #endif // _ALPHA_
  78.  
  79. /////////////////////////////////////////////////////////////////////////////
  80. // 680x0 version
  81.  
  82. #ifdef _68K_
  83.  
  84. // Note: Mac68k version is in src\m68k\inetcal_.obj
  85.  
  86. // The 68k compiler does not support inline assembly, so it
  87. //  has been build separate and included as an object
  88.  
  89.  
  90. #endif // _68K_
  91.  
  92. /////////////////////////////////////////////////////////////////////////////
  93. // PowerMac version
  94.  
  95. #ifdef _MPPC_
  96.  
  97. // Note: MacPPC version is in src\mppc\inetcal_.obj
  98.  
  99. // The Mac PowerPC compiler does not support inline assembly, so it
  100. //  has been build separate and included as an object
  101.  
  102. #endif // _MPPC_
  103.  
  104.  
  105. } // end extern "C" block
  106.  
  107. /////////////////////////////////////////////////////////////////////////////
  108.