⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 delphidll.cpp

📁 精通matlab7.0及与其他语言的混合编程
💻 CPP
字号:
// delphidll.cpp : Defines the initialization routines for the DLL.
//

#include "stdafx.h"
#include "delphidll.h"
#include "matlib.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

//
//	Note!
//
//		If this DLL is dynamically linked against the MFC
//		DLLs, any functions exported from this DLL which
//		call into MFC must have the AFX_MANAGE_STATE macro
//		added at the very beginning of the function.
//
//		For example:
//
//		extern "C" BOOL PASCAL EXPORT ExportedFunction()
//		{
//			AFX_MANAGE_STATE(AfxGetStaticModuleState());
//			// normal function body here
//		}
//
//		It is very important that this macro appear in each
//		function, prior to any calls into MFC.  This means that
//		it must appear as the first statement within the 
//		function, even before any object variable declarations
//		as their constructors may generate calls into the MFC
//		DLL.
//
//		Please see MFC Technical Notes 33 and 58 for additional
//		details.
//

/////////////////////////////////////////////////////////////////////////////
// CDelphidllApp

BEGIN_MESSAGE_MAP(CDelphidllApp, CWinApp)
	//{{AFX_MSG_MAP(CDelphidllApp)
		// NOTE - the ClassWizard will add and remove mapping macros here.
		//    DO NOT EDIT what you see in these blocks of generated code!
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CDelphidllApp construction

CDelphidllApp::CDelphidllApp()
{
	// TODO: add construction code here,
	// Place all significant initialization in InitInstance
}

/////////////////////////////////////////////////////////////////////////////
// The one and only CDelphidllApp object

CDelphidllApp theApp;

extern "C" _declspec(dllexport) void diamond()
{
	// TODO: add construction code here,
	// Place all significant initialization in InitInstance
	 initM(MATCOM_VERSION);
   begin_scope
    dMm(t); dMm(x); dMm(y); dMm(n); dMm(h); dMm(i_); 
    
    #line 1 "d:/soucecode/example6-5/diamond.m"
    call_stack_begin;
    #line 1 "d:/soucecode/example6-5/diamond.m"
    // nargin, nargout entry code
    double old_nargin=nargin_val; if (!nargin_set) nargin_val=0.0;
    nargin_set=0;
    double old_nargout=nargout_val; if (!nargout_set) nargout_val=0.0;
    nargout_set=0;
    
    // translated code
    
    #line 2 "d:/soucecode/example6-5/diamond.m"
_   t = colon(0.0,pi/2000.0,pi*2.0);
    #line 3 "d:/soucecode/example6-5/diamond.m"
_   x = sin(t);
    #line 4 "d:/soucecode/example6-5/diamond.m"
_   y = cos(t);
    #line 5 "d:/soucecode/example6-5/diamond.m"
_   plot((CL(y),x,TM("b")));
    #line 6 "d:/soucecode/example6-5/diamond.m"
_   axis(TM("equal"));
    #line 7 "d:/soucecode/example6-5/diamond.m"
_   n = length(t);
    #line 8 "d:/soucecode/example6-5/diamond.m"
_   h = line((CL(TM("color")),TM("g"),TM("linestyle"),TM("."),TM("marker"),TM("."),TM("markersize"),50.0,TM("erasemode") \
      ,TM("xor")));
    #line 10 "d:/soucecode/example6-5/diamond.m"
_   i_ = 1.0;
    #line 11 "d:/soucecode/example6-5/diamond.m"
_   while (istrue(i_)) {
      #line 12 "d:/soucecode/example6-5/diamond.m"
_     set(h,(CL(TM("xdata")),y(i_),TM("ydata"),x(i_)));
      #line 13 "d:/soucecode/example6-5/diamond.m"
_     drawnow();
      #line 14 "d:/soucecode/example6-5/diamond.m"
_     i_ = i_+1.0;
      #line 15 "d:/soucecode/example6-5/diamond.m"
_     if (istrue(i_>n)) {
        #line 16 "d:/soucecode/example6-5/diamond.m"
_       i_ = 1.0;
        #line 17 "d:/soucecode/example6-5/diamond.m"
      }
      #line 18 "d:/soucecode/example6-5/diamond.m"
    }
    
    call_stack_end;
    
    // nargin, nargout exit code
    nargin_val=old_nargin; nargout_val=old_nargout;
    
    // function exit code
    
  //  return x_M;
    end_scope
	exitM();

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -