?? foo.c
字號:
/*
* MATLAB Compiler: 2.2
* Date: Tue Jun 25 10:48:10 2002
* 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" "-O" "none" "-O"
* "fold_scalar_mxarrays:off" "-O" "fold_non_scalar_mxarrays:off" "-O"
* "optimize_integer_for_loops:off" "-O" "array_indexing:off" "-O"
* "optimize_conditionals:off" "-O" "fold_scalar_mxarrays:on" "-x" "-W" "mex"
* "-L" "C" "-t" "-T" "link:mexlibrary" "libmatlbmx.mlib" "foo"
*/
#include "foo.h"
#include "libmatlbm.h"
static mxArray * _mxarray0_;
void InitializeModule_foo(void) {
_mxarray0_ = mclInitializeDouble(6.283185307179586);
}
void TerminateModule_foo(void) {
mxDestroyArray(_mxarray0_);
}
static mxArray * Mfoo(int nargout_, mxArray * x);
_mexLocalFunctionTable _local_function_table_foo
= { 0, (mexFunctionTableEntry *)NULL };
/*
* The function "mlfFoo" contains the normal interface for the "foo" M-function
* from file "D:\mywork\foo.m" (lines 1-3). This function processes any input
* arguments and passes them to the implementation version of the function,
* appearing above.
*/
mxArray * mlfFoo(mxArray * x) {
int nargout = 1;
mxArray * y = mclGetUninitializedArray();
mlfEnterNewContext(0, 1, x);
y = Mfoo(nargout, x);
mlfRestorePreviousContext(0, 1, x);
return mlfReturnValue(y);
}
/*
* The function "mlxFoo" contains the feval interface for the "foo" M-function
* from file "D:\mywork\foo.m" (lines 1-3). The feval function calls the
* implementation version of foo through this function. This function processes
* any input arguments and passes them to the implementation version of the
* function, appearing above.
*/
void mlxFoo(int nlhs, mxArray * plhs[], int nrhs, mxArray * prhs[]) {
mxArray * mprhs[1];
mxArray * mplhs[1];
int i;
if (nlhs > 1) {
mlfError(
mxCreateString(
"Run-time Error: File: foo Line: 1 Column: 1 The function \"foo\" "
"was called with more than the declared number of outputs (1)."));
}
if (nrhs > 1) {
mlfError(
mxCreateString(
"Run-time Error: File: foo Line: 1 Column: 1 The function \"foo\""
" was called with more than the declared number of inputs (1)."));
}
for (i = 0; i < 1; ++i) {
mplhs[i] = mclGetUninitializedArray();
}
for (i = 0; i < 1 && i < nrhs; ++i) {
mprhs[i] = prhs[i];
}
for (; i < 1; ++i) {
mprhs[i] = NULL;
}
mlfEnterNewContext(0, 1, mprhs[0]);
mplhs[0] = Mfoo(nlhs, mprhs[0]);
mlfRestorePreviousContext(0, 1, mprhs[0]);
plhs[0] = mplhs[0];
}
/*
* The function "Mfoo" is the implementation version of the "foo" M-function
* from file "D:\mywork\foo.m" (lines 1-3). 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 y = foo(x)
*/
static mxArray * Mfoo(int nargout_, mxArray * x) {
mexLocalFunctionTable save_local_function_table_
= mclSetCurrentLocalFunctionTable(&_local_function_table_foo);
mxArray * y = mclGetUninitializedArray();
mclCopyArray(&x);
/*
* y = 2*pi*x;
*/
mlfAssign(&y, mclMtimes(_mxarray0_, mclVa(x, "x")));
mclValidateOutput(y, 1, nargout_, "y", "foo");
mxDestroyArray(x);
mclSetCurrentLocalFunctionTable(save_local_function_table_);
return y;
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -