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

📄 gm_entrypoint.cpp

📁 算断裂的
💻 CPP
字号:
// ------------------------------------------------------------------// gm_entrypoint.cpp//// This is not a standalone file -- it is included by driver routines.// It is the standard entrypoint for QMG's matlab functions.// The includer must define macros://   GM_ROUTINE_NAME//   GM_ROUTINE_NAME_Q// and a function called "worker" to actually call the routine.//// ------------------------------------------------------------------// Author: Stephen A. Vavasis// Copyright (c) 1999 by Cornell University.  All rights reserved.// // See the accompanying file 'Copyright' for authorship information,// the terms of the license governing this software, and disclaimers// concerning this software.// ------------------------------------------------------------------// This file is part of the QMG software.  // Version 2.0 of QMG, release date September 3, 1999.// ------------------------------------------------------------------#include <new>#include "qerr.h"extern "C" {#include "mex.h"}namespace QMG {  namespace FrontEnd {    using namespace QMG;    extern void set_matlab_error_ostream(ostream* os);  }}#ifdef USE_MX_FOR_NEWusing std::size_t;void* operator new(size_t size) throw(std::bad_alloc) {  return mxMalloc(size);}void* operator new(size_t size, const std::nothrow_t&) throw() {  return mxMalloc(size);}void  operator delete(void* ptr) throw() {  if (ptr) mxFree(ptr);}void  operator delete(void* ptr, const std::nothrow_t&) throw() {  if (ptr) mxFree(ptr);} void* operator new[](size_t size) throw(std::bad_alloc) {  return mxMalloc(size);}void* operator new[](size_t size, const std::nothrow_t&) throw() {  return mxMalloc(size);}void  operator delete[](void* ptr) throw() {  if (ptr) mxFree(ptr);}void  operator delete[](void* ptr, const std::nothrow_t&) throw() {  if (ptr) mxFree(ptr);}#endifextern "C" {void mexFunction(int nlhs, 		 mxArray* plhs[],		 int nrhs,		 const mxArray* prhs[]) {  using namespace QMG::FrontEnd;  ArgValType arghandle(nrhs, prhs);  ReturnValType returnhandle(nlhs, plhs);  Interpreter interpr;  // Initialize the list of error messages and error tasks.  QMG::Error_Message::init_error_message_list();  QMG::Error_Task::init_error_task_list();  // parse input args.  InterpOStream ost1(interpr);    set_matlab_error_ostream(&ost1.ostrm());    // call the worker.  #ifdef EXCEPTIONS_ENABLED  try {#endif    worker(arghandle, returnhandle, interpr);#ifdef EXCEPTIONS_ENABLED  }  catch (QMG::Error e) {    mexErrMsgTxt(e.get_error_messages());  }  catch (...) {    mexErrMsgTxt("Unknown C++ exception occurred");  }#endif}}

⌨️ 快捷键说明

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