📄 graphics_private_clo.c
字号:
/*
* MATLAB Compiler: 2.0.1
* Date: Tue May 08 21:28:22 2001
* Arguments: "-B" "sgl" "-m" "-W" "mainhg" "-L" "C" "asufit.m" "absfun.m"
* "absfunfree.m" "absfunshift.m" "absfunwidth.m" "dispfit.m" "dispfitdisp.m"
* "dispfitfree.m" "dispfitwidth.m" "seqmodfree.m" "spcfun.m" "spcfun1.m"
* "atamult.m" "aprecon.m"
*/
#include "graphics_private_clo.h"
static mxArray * Mclo_find_kids(int nargout_, mxArray * obj, mxArray * hsave);
static mxArray * mlfClo_find_kids(mxArray * obj, mxArray * hsave);
static void mlxClo_find_kids(int nlhs,
mxArray * plhs[],
int nrhs,
mxArray * prhs[]);
/*
* The function "Mgraphics_private_clo" is the implementation version of the
* "graphics/private/clo" M-function from file
* "C:\MATLABR11\toolbox\matlab\graphics\private\clo.m" (lines 1-68). 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 ret_obj = clo(obj, in1, in2)
*/
static mxArray * Mgraphics_private_clo(int nargout_,
mxArray * obj,
mxArray * in1,
mxArray * in2) {
mxArray * ret_obj = mclGetUninitializedArray();
mxArray * do_reset = mclGetUninitializedArray();
mxArray * hsave = mclGetUninitializedArray();
mxArray * kids_to_delete = mclGetUninitializedArray();
mxArray * nargin_ = mclGetUninitializedArray();
mxArray * nargout = mclInitialize(mlfScalar(nargout_));
mlfAssign(&nargin_, mlfNargin(0, obj, in1, in2, NULL));
mclValidateInputs("graphics/private/clo", 3, &obj, &in1, &in2);
/*
* %CLO Clear object
* % CLO(H) deletes all children of the object with visible handles.
* %
* % CLO(..., 'reset') deletes all children (including ones with hidden
* % handles) and also resets all object properties to their default
* % values.
* %
* % CLO(..., HSAVE) deletes all children except those specified in
* % HSAVE.
* %
* % See also CLF, CLA, RESET, HOLD.
*
* % Copyright (c) 1984-98 by The MathWorks, Inc.
* % $Revision: 1.1 $ $Date: 1998/06/29 14:56:08 $
*
* % decode input args:
* hsave = [];
*/
mlfAssign(&hsave, mclCreateEmptyArray());
/*
* do_reset = '';
*/
mlfAssign(&do_reset, mxCreateString(""));
/*
*
* error(nargchk(1, 3, nargin));
*/
mlfError(mlfNargchk(mlfScalar(1.0), mlfScalar(3.0), nargin_));
/*
*
* if nargin > 1
*/
if (mlfTobool(mlfGt(nargin_, mlfScalar(1.0)))) {
/*
* if isstr(in1), do_reset = in1; else, hsave = in1; end
*/
if (mlfTobool(mlfIsstr(in1))) {
mlfAssign(&do_reset, in1);
} else {
mlfAssign(&hsave, in1);
}
/*
* if nargin > 2
*/
if (mlfTobool(mlfGt(nargin_, mlfScalar(2.0)))) {
/*
* if isstr(in2), do_reset = in2; else, hsave = in2; end
*/
if (mlfTobool(mlfIsstr(in2))) {
mlfAssign(&do_reset, in2);
} else {
mlfAssign(&hsave, in2);
}
/*
* end
*/
}
/*
* end
*/
}
/*
*
* % error-check input args
* if ~isempty(do_reset)
*/
if (mlfTobool(mlfNot(mlfIsempty(do_reset)))) {
/*
* if ~strcmp(do_reset, 'reset')
*/
if (mlfTobool(mlfNot(mlfStrcmp(do_reset, mxCreateString("reset"))))) {
/*
* error('Unknown command option.')
*/
mlfError(mxCreateString("Unknown command option."));
/*
* else
*/
} else {
/*
* do_reset = 1;
*/
mlfAssign(&do_reset, mlfScalar(1.0));
/*
* end
*/
}
/*
* else
*/
} else {
/*
* do_reset = 0;
*/
mlfAssign(&do_reset, mlfScalar(0.0));
/*
* end
*/
}
/*
*
* if any(~ishandle(hsave))
*/
if (mlfTobool(mlfAny(mlfNot(mlfIshandle(hsave)), NULL))) {
/*
* error('Bad handle')
*/
mlfError(mxCreateString("Bad handle"));
/*
* end
*/
}
/*
*
* hsave = find_kids(obj, hsave);
*/
mlfAssign(&hsave, mlfClo_find_kids(obj, hsave));
/*
*
* kids_to_delete = [];
*/
mlfAssign(&kids_to_delete, mclCreateEmptyArray());
/*
* if do_reset
*/
if (mlfTobool(do_reset)) {
/*
* kids_to_delete = findobj(allchild(obj),'flat','serializable','on');
*/
mlfAssign(
&kids_to_delete,
mlfFindobj(
mlfAllchild(obj),
mxCreateString("flat"),
mxCreateString("serializable"),
mxCreateString("on"),
NULL));
/*
* else
*/
} else {
/*
* kids_to_delete = findobj(get(obj,'Children'),'flat',...
*/
mlfAssign(
&kids_to_delete,
mlfFindobj(
mlfGet(obj, mxCreateString("Children"), NULL),
mxCreateString("flat"),
mxCreateString("HandleVisibility"),
mxCreateString("on"),
mxCreateString("serializable"),
mxCreateString("on"),
NULL));
/*
* 'HandleVisibility','on', 'serializable','on');
* end
*/
}
/*
*
* kids_to_delete = setdiff(kids_to_delete, hsave);
*/
mlfAssign(&kids_to_delete, mlfSetdiff(NULL, kids_to_delete, hsave, NULL));
/*
*
* delete(kids_to_delete);
*/
mlfDelete(kids_to_delete, NULL);
/*
*
* if do_reset, reset(obj(ishandle(obj))), end
*/
if (mlfTobool(do_reset)) {
mlfReset(mlfIndexRef(obj, "(?)", mlfIshandle(obj)));
}
/*
*
* % now that IntegerHandle can be changed by reset, make sure
* % we're returning the new handle:
* if (nargout ~= 0)
*/
if (mlfTobool(mlfNe(nargout, mlfScalar(0.0)))) {
/*
* ret_obj = obj(ishandle(obj));
*/
mlfAssign(&ret_obj, mlfIndexRef(obj, "(?)", mlfIshandle(obj)));
/*
* end
*/
}
mclValidateOutputs("graphics/private/clo", 1, nargout_, &ret_obj);
mxDestroyArray(do_reset);
mxDestroyArray(hsave);
mxDestroyArray(kids_to_delete);
mxDestroyArray(nargin_);
mxDestroyArray(nargout);
/*
*
* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
* function hsave_out = find_kids(obj, hsave)
* %
* %
* %
* hsave_out = [];
* for kid=hsave(:)'
* while ~isempty(kid)
* parent = get(kid,'parent');
* if ~isempty(parent) & parent == obj
* hsave_out(end + 1) = kid;
* break;
* else
* kid = parent;
* end
* end
* end
*
*/
return ret_obj;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -