This is a static copy of a profile report

Home

graphics/private/inputcheck (40 calls, 0.230 sec)
Generated 05-Aug-2011 13:03:32 using cpu time.
function in file /usr/local/MATLAB/R2011a/toolbox/matlab/graphics/private/inputcheck.m
Copy to new window for comparing multiple runs

Parents (calling functions)

Function NameFunction TypeCalls
printfunction40
Lines where the most time was spent

Line NumberCodeCallsTotal Time% TimeTime Plot
15
options = printtables; % first...
400.098 s42.9%
178
[ ~, devices, extensions, clas...
400.077 s33.3%
79
opIndex = LocalCheckOption( cu...
400.022 s9.5%
200
if( ~( isSLorSF(pj) &&...
400.011 s4.8%
56
case 's'
400.011 s4.8%
All other lines  0.011 s4.8%
Totals  0.230 s100% 
Children (called functions)

Function NameFunction TypeCallsTotal Time% TimeTime Plot
printtablesfunction800.164 s71.4%
graphics/.../inputcheck>LocalCheckOptionsubfunction400.022 s9.5%
...e/inputcheck>LocalCheckForDeprecationsubfunction400 s0%
graphics/private/isSLorSFfunction400 s0%
graphics/.../inputcheck>LocalCheckDevicesubfunction400 s0%
Self time (built-ins, overhead, etc.)  0.044 s19.0%
Totals  0.230 s100% 
Code Analyzer results
Line numberMessage
Coverage results
[ Show coverage for parent directory ]
Total lines in function212
Non-code lines (comments, blank lines)89
Code lines (lines that can run)123
Code lines that did run47
Code lines that did not run76
Coverage (did run/can run)38.21 %
Function listing
   time   calls  line
1 function [pj, devices, options] = inputcheck( pj, varargin )
2 %INPUTCHECK Method to validate input arguments to PRINT.
3 % Parses input arguments, updates state of PrintJob object accordingly.
4 % Returns PrintJob object and cell-arrays for the lists of devices and
5 % options that can legally be passed to PRINT.
6 % Will error out if bad arguments are found.
7 %
8 % Ex:
9 % [pj, dev, opt] = INPUTCHECK( pj, ... );
10 %
11 % See also PRINT, TABLE, VALIDATE.
12
13 % Copyright 1984-2010 The MathWorks, Inc.
14
0.10 40 15 options = printtables; % first find out what options are valid
40 16 deviceToCheck = ''; % placeholder for device/format caller wants to create;
17
40 18 for i = 1 : length(varargin)
120 19 cur_arg = varargin{i};
20
120 21 if isempty( cur_arg )
22 %silly thing to do, ignore it
23
120 24 elseif ~ischar( cur_arg )
25 %Non-string argument better be a handle of a Figure or model.
26 %To be a non-string we are using the function form of PRINT.
27 pj.Handles = [ pj.Handles LocalCheckHandles(cur_arg) ];
28
120 29 elseif (cur_arg(1) ~= '-')
30 % Filename, can only have one!
40 31 if isempty( pj.FileName )
40 32 pj.FileName = cur_arg;
33 else
34 error( 'MATLAB:Print:multInputFile', ['Multiple inputs that look like filenames: ''' ...
35 pj.FileName ''' and ''' cur_arg '''' ] );
36 end
37
80 38 else
80 39 switch( cur_arg(2) )
40
80 41 case 'd'
42
43 % delay processing of device until we know what
44 % figure/system we are working with
45 % Device name
40 46 if ~isempty(deviceToCheck)
47 error( 'MATLAB:Print:multInputDev', ['Multiple inputs that look like device names: ''' ...
48 deviceToCheck ''' and ''' cur_arg ''''] );
49 end
40 50 deviceToCheck = cur_arg;
51
40 52 case 'f'
53 % Handle Graphics figure handle
54 pj.Handles = [ pj.Handles {LocalString2Handle(cur_arg)} ];
55
0.01 40 56 case 's'
57 % Simulink system name
58 if ( exist('open_system','builtin') ~= 5 )
59 error('MATLAB:prnSimulink:openSystem', 'Simulink is not available in this version of MATLAB.');
60 end
61 window = LocalSimName2Handle( cur_arg );
62 pj.Handles = [ pj.Handles {window} ];
63 pj.SimWindowName = get_param( window, 'name' );
64
40 65 case 'P'
66 % Printer name - Windows and Unix
67 pj.PrinterName = cur_arg(3:end);
68
69 % check for empty name
70 if(isempty(pj.PrinterName))
71 error( 'MATLAB:Print:prnName', 'A valid printer name must be supplied with ''-P''.' );
72 end
73
40 74 otherwise
75 %
76 % Verify a given option is supported.
77 % At this point we now it is a string that starts with -
78 %
0.02 40 79 opIndex = LocalCheckOption( cur_arg, options );
80
81 %Some options are used in HARDCOPY, others used only in MATLAB before or after.
82 %This switch must be kept up to date with options table and code i HARDCOPY.
40 83 switch options{opIndex}
84
40 85 case 'loose'
86 pj.PostScriptTightBBox = 0;
87
40 88 case 'tiff'
89 pj.PostScriptPreview = pj.TiffPreview;
90
40 91 case 'append'
92 pj.PostScriptAppend = 1;
93
40 94 case 'adobecset'
95 pj.PostScriptLatin1 = 0;
96 warning('MATLAB:print:adobecset:DeprecatedOption', ...
97 'The ''-adobecset'' option will be removed in a future release.');
98
40 99 case 'cmyk'
100 pj.PostScriptCMYK = 1;
101 pj.PostScriptLatin1 = 0;
102
40 103 case 'r'
104 %Need number following -r for resolution
40 105 pj.DPI = round(sscanf( cur_arg, '-r%g' ));
40 106 if isempty(pj.DPI) || isnan(pj.DPI) || isinf(pj.DPI) || pj.DPI < 0
107 error('MATLAB:Print:resolution','Illegal value for -r. Use -rN when N is a number greater than zero.')
108 end
109
110 case 'noui'
111 pj.PrintUI = 0;
112 pj.nouiOption = 1;
113
114 case 'painters'
115 pj.Renderer = 'painters';
116 pj.rendererOption = 1;
117
118 case 'zbuffer'
119 if pj.XTerminalMode
120 warning( 'MATLAB:prnRenderer:zbuffer', 'ZBuffer mode can not be used in terminal emulation mode; ignoring option.')
121 else
122 pj.Renderer = 'zbuffer';
123 pj.rendererOption = 1;
124 end
125
126 case 'opengl'
127 if pj.XTerminalMode
128 warning( 'MATLAB:prnRenderer:opengl', 'OpenGL mode can not be used in terminal emulation mode; ignoring option.')
129 else
130 pj.Renderer = 'opengl';
131 pj.rendererOption = 1;
132 end
133
134 case 'tileall'
135 pj.TiledPrint = 1;
136
137 case 'printframes'
138 % no need to doc this one on print. This option is internally used by
139 % simprintdlg.
140 pj.FramePrint = 1;
141
142 case 'pages'
143 [ a count ] = sscanf(cur_arg, '-pages[ %d %d ]');
144 if (count ~= 2) || (a(1) < 1) || (a(2) > 9999) || (a(1) > a(2))
145 warning( 'MATLAB:print:pages', '-pages option must specify a valid range of 2 pages from 1 to 9999; ignoring option.')
146 else
147 pj.FromPage = a(1);
148 pj.ToPage = a(2);
149 end
150
151 case 'DEBUG'
152 pj.DebugMode = 1;
153
154 case 'v'
155 %This is really just a PC option, but it would have gotten flagged earlier.
156 pj.Verbose = 1;
157
158 case 'RGBImage'
159 %reserved for future use
160 pj.RGBImage = 1;
161 pj.DriverClass = 'IM';
162
163 case 'clipboard'
164 %reserved for future use
165 pj.ClipboardOption = 1;
166
167 otherwise
168 error('MATLAB:Print:illegalOpt', 'Illegal option ''%s'' given.',cur_arg)
169
170 end %switch option
40 171 end %switch cur_arg
80 172 end % if isempty
120 173 end %for loop
174
175 % now check device/format to see if it's valid
176 % we already got options earlier - don't overwrite them here
177 % we also don't care about the descriptions here
0.08 40 178 [ ~, devices, extensions, classes, colorDevs, destinations, ~, clipsupport ] = printtables(pj);
40 179 [ pj, devIndex ] = LocalCheckDevice( pj, deviceToCheck, devices );
180
181 % caller specified a device
40 182 if ~isempty(deviceToCheck)
40 183 if devIndex == 0
184 %we couldn't find requested device
185 %Will echo out possible values or error out depending on input to PRINT
186 pj.Driver = '-d';
187 return
188 end
189 % found requested device, set printjob fields appropriately
40 190 pj.DriverExt = extensions{ devIndex };
40 191 pj.DriverClass = classes{ devIndex };
40 192 pj.DriverColor = strcmp( 'C', colorDevs{ devIndex } );
40 193 pj.DriverColorSet = 1;
40 194 pj.DriverExport = strcmp( 'X', destinations{ devIndex } );
40 195 pj.DriverClipboard = clipsupport{devIndex};
196 % We don't want to check for deprecation if we are using new SL/SF editor
197 % pipeline. Any format support depends on what the new editor supports.
198 % So skip this deprecation check.
199 % -sramaswa
0.01 40 200 if( ~( isSLorSF(pj) && (slfeature('SLGlueBigSwitch') == 1) ) )
40 201 LocalCheckForDeprecation(pj, destinations{devIndex}); % warn if using deprecated device
40 202 end
40 203 end
204
205 % warn if caller requested zbuffer & use opengl instead
40 206 if ~pj.UseOriginalHGPrinting && pj.rendererOption && strcmpi(pj.Renderer, 'zbuffer')
207 pj.Renderer = 'opengl';
208 warning('MATLAB:Print:Deprecate:Zbuffer', ...
209 'Zbuffer is not supported for printing, using OpenGL instead.');
210 end
211
40 212 end

Other subfunctions in this file are not included in this listing.