📄 test.cpp
字号:
//
// MATLAB Compiler: 2.1
// Date: Thu Oct 25 01:02:43 2001
// Arguments: "-B" "macro_default" "-O" "all" "-O" "fold_scalar_mxarrays:on"
// "-O" "fold_non_scalar_mxarrays:on" "-O" "optimize_integer_for_loops:on" "-O"
// "array_indexing:on" "-O" "optimize_conditionals:on" "-t" "-h" "-L" "Cpp"
// "test"
//
#include "test.hpp"
#include "libmatlbm.hpp"
static mxChar _array1_[126] = { 'R', 'u', 'n', '-', 't', 'i', 'm', 'e', ' ',
'E', 'r', 'r', 'o', 'r', ':', ' ', 'F', 'i',
'l', 'e', ':', ' ', 't', 'e', 's', 't', ' ',
'L', 'i', 'n', 'e', ':', ' ', '1', ' ', 'C',
'o', 'l', 'u', 'm', 'n', ':', ' ', '1', ' ',
'T', 'h', 'e', ' ', 'f', 'u', 'n', 'c', 't',
'i', 'o', 'n', ' ', '"', 't', 'e', 's', 't',
'"', ' ', 'w', 'a', 's', ' ', 'c', 'a', 'l',
'l', 'e', 'd', ' ', 'w', 'i', 't', 'h', ' ',
'm', 'o', 'r', 'e', ' ', 't', 'h', 'a', 'n',
' ', 't', 'h', 'e', ' ', 'd', 'e', 'c', 'l',
'a', 'r', 'e', 'd', ' ', 'n', 'u', 'm', 'b',
'e', 'r', ' ', 'o', 'f', ' ', 'o', 'u', 't',
'p', 'u', 't', 's', ' ', '(', '2', ')', '.' };
static mwArray _mxarray0_ = mclInitializeString(126, _array1_);
static mxChar _array3_[125] = { 'R', 'u', 'n', '-', 't', 'i', 'm', 'e', ' ',
'E', 'r', 'r', 'o', 'r', ':', ' ', 'F', 'i',
'l', 'e', ':', ' ', 't', 'e', 's', 't', ' ',
'L', 'i', 'n', 'e', ':', ' ', '1', ' ', 'C',
'o', 'l', 'u', 'm', 'n', ':', ' ', '1', ' ',
'T', 'h', 'e', ' ', 'f', 'u', 'n', 'c', 't',
'i', 'o', 'n', ' ', '"', 't', 'e', 's', 't',
'"', ' ', 'w', 'a', 's', ' ', 'c', 'a', 'l',
'l', 'e', 'd', ' ', 'w', 'i', 't', 'h', ' ',
'm', 'o', 'r', 'e', ' ', 't', 'h', 'a', 'n',
' ', 't', 'h', 'e', ' ', 'd', 'e', 'c', 'l',
'a', 'r', 'e', 'd', ' ', 'n', 'u', 'm', 'b',
'e', 'r', ' ', 'o', 'f', ' ', 'i', 'n', 'p',
'u', 't', 's', ' ', '(', '2', ')', '.' };
static mwArray _mxarray2_ = mclInitializeString(125, _array3_);
void InitializeModule_test() {
}
void TerminateModule_test() {
}
static mwArray Mtest(mwArray * prod, int nargout_, mwArray x, mwArray y);
_mexLocalFunctionTable _local_function_table_test
= { 0, (mexFunctionTableEntry *)NULL };
//
// The function "test" contains the normal interface for the "test" M-function
// from file "D:\book\soft\ch9\MccDemo\test.m" (lines 1-4). This function
// processes any input arguments and passes them to the implementation version
// of the function, appearing above.
//
mwArray test(mwArray * prod, mwArray x, mwArray y) {
int nargout(1);
mwArray sum(mclGetUninitializedArray());
mwArray prod__(mclGetUninitializedArray());
if (prod != NULL) {
++nargout;
}
sum = Mtest(&prod__, nargout, x, y);
if (prod != NULL) {
*prod = prod__;
}
return sum;
}
//
// The function "mlxTest" contains the feval interface for the "test"
// M-function from file "D:\book\soft\ch9\MccDemo\test.m" (lines 1-4). The
// feval function calls the implementation version of test through this
// function. This function processes any input arguments and passes them to the
// implementation version of the function, appearing above.
//
void mlxTest(int nlhs, mxArray * plhs[], int nrhs, mxArray * prhs[]) {
MW_BEGIN_MLX();
{
mwArray mprhs[2];
mwArray mplhs[2];
int i;
mclCppUninitializeArrays(2, mplhs);
if (nlhs > 2) {
error(_mxarray0_);
}
if (nrhs > 2) {
error(_mxarray2_);
}
for (i = 0; i < 2 && i < nrhs; ++i) {
mprhs[i] = mwArray(prhs[i], 0);
}
for (; i < 2; ++i) {
mprhs[i].MakeDIN();
}
mplhs[0] = Mtest(&mplhs[1], nlhs, mprhs[0], mprhs[1]);
plhs[0] = mplhs[0].FreezeData();
for (i = 1; i < 2 && i < nlhs; ++i) {
plhs[i] = mplhs[i].FreezeData();
}
}
MW_END_MLX();
}
//
// The function "Mtest" is the implementation version of the "test" M-function
// from file "D:\book\soft\ch9\MccDemo\test.m" (lines 1-4). It contains the
// actual compiled code for that M-function. It is a static function and must
// only be called from one of the interface functions, appearing below.
//
//
// function [sum, prod]=test(x,y)
//
static mwArray Mtest(mwArray * prod, int nargout_, mwArray x, mwArray y) {
mwLocalFunctionTable save_local_function_table_(&_local_function_table_test);
mwArray sum(mclGetUninitializedArray());
//
//
// sum = x+y;
//
sum = mwVa(x, "x") + mwVa(y, "y");
//
// prod = x*y;
//
*prod = mwVa(x, "x") * mwVa(y, "y");
mwValidateOutput(sum, 1, nargout_, "sum", "test");
mwValidateOutput(*prod, 2, nargout_, "prod", "test");
return sum;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -