This is a static copy of a profile report

Home

graphics/private/inputcheck (6 calls, 0.040 sec)
Generated 14-Nov-2016 07:47:15 using cpu time.
function in file /usr/local/MATLAB/MATLAB_Production_Server/R2015a/toolbox/matlab/graphics/private/inputcheck.m
Copy to new window for comparing multiple runs

Parents (calling functions)

Function NameFunction TypeCalls
printfunction6
Lines where the most time was spent

Line NumberCodeCallsTotal Time% TimeTime Plot
235
LocalCheckForDeprecation(pj); ...
60.020 s50.0%
223
pj.DriverClipboard = clipsuppo...
60.010 s25.0%
198
[ ~, devices, extensions, clas...
60.010 s25.0%
245
end
60 s0%
240
if ~pj.UseOriginalHGPrinting &...
60 s0%
All other lines  0 s0%
Totals  0.040 s100% 
Children (called functions)

Function NameFunction TypeCallsTotal Time% TimeTime Plot
...nputcheck>LocalCheckForDeprecationsubfunction120.020 s50.0%
printtablesfunction120.010 s25.0%
...rivate/inputcheck>LocalCheckDevicesubfunction60 s0%
graphics/private/isSLorSFfunction120 s0%
graphics/...te/checkArgsForHandleToPrintfunction60 s0%
Self time (built-ins, overhead, etc.)  0.010 s25.0%
Totals  0.040 s100% 
Code Analyzer results
Line numberMessage
Coverage results
Show coverage for parent directory
Total lines in function245
Non-code lines (comments, blank lines)99
Code lines (lines that can run)146
Code lines that did run44
Code lines that did not run102
Coverage (did run/can run)30.14 %
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-2014 The MathWorks, Inc.
  14 

      6 
  15 
options = printtables(pj); % first find out what options are valid 
      6 
  16 
deviceToCheck = ''; % placeholder for device/format caller wants to create;  
  17 

      6 
  18 
[handles,  simWindowName] = checkArgsForHandleToPrint(false, varargin{:}); 
      6 
  19 
if ~isempty(handles)  
      6 
  20 
    pj.Handles = [pj.Handles handles]; 
      6 
  21 
end 
      6 
  22 
if pj.UseOriginalHGPrinting 
  23 
    pj.SimWindowName = simWindowName;
  24 
end
  25 

      6 
  26 
for i = 1 : length(varargin) 
     18 
  27 
    cur_arg = varargin{i}; 
  28 

     18 
  29 
    if isempty( cur_arg ) 
  30 
        %silly thing to do, ignore it
  31 

     18 
  32 
    elseif ~ischar( cur_arg )  
  33 
        % Non-string argument better be a handle of a Figure or model. Dealt with in checkArgsForHandlesToPrint
  34 

     12 
  35 
    elseif (cur_arg(1) ~= '-') 
  36 
        % Filename, can only have one!
      6 
  37 
        if isempty( pj.FileName ) 
      6 
  38 
            pj.FileName = cur_arg; 
  39 
        else
  40 
            error(message('MATLAB:print:MultipleInputFiles', pj.FileName, cur_arg));
  41 
        end
  42 

      6 
  43 
    else 
      6 
  44 
        switch( cur_arg(2) ) 
  45 

      6 
  46 
            case 'd' 
  47 

  48 
                % delay processing of device until we know what
  49 
                % figure/system we are working with 
  50 
                % Device name
      6 
  51 
                if ~isempty(deviceToCheck)  
  52 
                   error(message('MATLAB:print:MultipleInputDeviceNames', deviceToCheck, cur_arg));
  53 
                end
      6 
  54 
                deviceToCheck = cur_arg;  
  55 

  56 
            case 'f' 
  57 
                % Handle Graphics figure handle dealt with in checkArgsForHandlesToPrint
  58 

  59 
            case 's' 
  60 
                % Simulink system name handled in checkArgsForHandlesToPrint
  61 

  62 
            case 'P'
  63 
                % Printer name - Windows and Unix
  64 
                pj.PrinterName = cur_arg(3:end);
  65 

  66 
                % check for empty name
  67 
                if(isempty(pj.PrinterName))
  68 
                    error(message('MATLAB:print:InvalidPrinterName'));
  69 
                end
  70 
                
  71 
                % Check for non-installed UNC path's on Windows systems and
  72 
                % warn users's that this functionality will be removed in
  73 
                % future versions. g611254
  74 
                if pj.UseOriginalHGPrinting && ...
  75 
                        ispc && ...
  76 
                        ~isempty(regexp(pj.PrinterName,'^\\\\.*?\\.*$','once')) && ...
  77 
                        ~queryPrintServices('validate', pj.PrinterName)
  78 
                    warning(message('MATLAB:print:UNCPrinterNotFoundWarning', pj.PrinterName));
  79 
                end
  80 
                
  81 
            otherwise
  82 
                %
  83 
                % Verify a given option is supported.
  84 
                % At this point we now it is a string that starts with -
  85 
                %
  86 
                opIndex = LocalCheckOption( cur_arg, options );
  87 

  88 
                %Some options are used in HARDCOPY, others used only in MATLAB before or after.
  89 
                %This switch must be kept up to date with options table and code i HARDCOPY.
  90 
                switch options{opIndex}
  91 

  92 
                    case 'loose'
  93 
                        pj.PostScriptTightBBox = 0;
  94 

  95 
                    case 'tiff'
  96 
                        pj.PostScriptPreview = pj.TiffPreview;
  97 

  98 
                    case 'append'
  99 
                        pj.PostScriptAppend = 1;
 100 

 101 
                    case 'adobecset'
 102 
                        pj.PostScriptLatin1 = 0;
 103 
                        if pj.UseOriginalHGPrinting
 104 
                            warning(message('MATLAB:print:DeprecatedOptionAdobecset'));
 105 
                        else
 106 
                            error(message('MATLAB:print:DeprecatedOptionAdobecsetRemoved'));
 107 
                        end
 108 

 109 
                    case 'cmyk'
 110 
                        pj.PostScriptCMYK = 1;
 111 
                        pj.PostScriptLatin1 = 0;
 112 

 113 
                    case 'r'
 114 
                        %Need number following -r for resolution
 115 
                        pj.DPI = round(sscanf( cur_arg, '-r%g' ));
 116 
                        if isempty(pj.DPI) || isnan(pj.DPI) || isinf(pj.DPI) || pj.DPI < 0
 117 
                            error(message('MATLAB:print:InvalidParamResolution'))
 118 
                        end
 119 

 120 
                    case 'noui'
 121 
                        pj.PrintUI = 0;
 122 
                        pj.nouiOption = 1;
 123 

 124 
                    case 'painters'
 125 
                        pj.Renderer = 'painters';
 126 
                        pj.rendererOption = 1;
 127 

 128 
                    case 'zbuffer'
 129 
                        if pj.XTerminalMode
 130 
                            warning(message('MATLAB:prnRenderer:zbuffer'))
 131 
                        else
 132 
                            pj.Renderer = 'zbuffer';
 133 
                            pj.rendererOption = 1;
 134 
                        end
 135 

 136 
                    case 'opengl'
 137 
                        if pj.UseOriginalHGPrinting
 138 
                            allowOpenGL = ~pj.XTerminalMode;
 139 
                        else
 140 
                            allowOpenGL = opengl('info');
 141 
                        end
 142 
                        if ~allowOpenGL
 143 
                            warning(message('MATLAB:prnRenderer:opengl'))
 144 
                        else
 145 
                            pj.Renderer = 'opengl';
 146 
                            pj.rendererOption = 1;
 147 
                        end
 148 

 149 
                    case 'tileall'
 150 
                        pj.TiledPrint = 1;
 151 

 152 
                    case 'printframes'
 153 
                        % no need to doc this one on print. This option is internally used by
 154 
                        % simprintdlg.
 155 
                        pj.FramePrint = 1;
 156 
                        
 157 
                    case 'numcopies'
 158 
                        % Used internally by simprintdlg2
 159 
                        pj.NumCopies = sscanf(cur_arg,'-numcopies%d');
 160 
                        
 161 
                    case 'pages'
 162 
                        [ a, count ] = sscanf(cur_arg, '-pages[ %d %d ]');
 163 
                        if (count ~= 2) || (a(1) < 1) || (a(2) > 9999) || (a(1) > a(2))
 164 
                            warning(message('MATLAB:print:InvalidParamPages'))
 165 
                        else
 166 
                            pj.FromPage = a(1);
 167 
                            pj.ToPage = a(2);
 168 
                        end
 169 

 170 
                    case 'DEBUG'
 171 
                        pj.DebugMode = 1;
 172 

 173 
                    case 'v'
 174 
                        %This is really just a PC option, but it would have gotten flagged earlier.
 175 
                        pj.Verbose = 1;
 176 

 177 
                    case 'RGBImage'
 178 
                        %reserved for future use
 179 
                        pj.RGBImage = 1;
 180 
                        pj.DriverClass = 'IM';
 181 
                        pj.DriverColor = 1;
 182 

 183 
                    case 'clipboard'
 184 
                        %reserved for future use
 185 
                        pj.ClipboardOption = 1;
 186 

 187 
                    otherwise
 188 
                        error(message('MATLAB:print:UnrecognizedOption', cur_arg))
 189 

 190 
                end %switch option
 191 
        end %switch cur_arg
      6 
 192 
    end % if isempty 
     18 
 193 
end %for loop 
 194 

 195 
% now check device/format to see if it's valid
 196 
% we already got options earlier - don't overwrite them here
 197 
% we also don't care about the descriptions here
  0.01 
      6 
 198 
[ ~, devices, extensions, classes, colorDevs, destinations, ~, clipsupport ] = printtables(pj); 
 199 

 200 
% Call LocalCheckForDeprecation earlier as per g852505
      6 
 201 
if ~pj.UseOriginalHGPrinting && ~isempty(deviceToCheck) && ~isSLorSF(pj)  
      6 
 202 
    if length(deviceToCheck)>2 
      6 
 203 
        pj.Driver = deviceToCheck(3:end); 
      6 
 204 
        LocalCheckForDeprecation(pj); % warn if using deprecated device 
      6 
 205 
    end 
      6 
 206 
end 
      6 
 207 
[ pj, devIndex ] = LocalCheckDevice( pj, deviceToCheck, devices ); 
 208 
   
 209 
   % caller specified a device
      6 
 210 
if ~isempty(deviceToCheck) 
      6 
 211 
   if devIndex == 0  
 212 
      %we couldn't find requested device 
 213 
      %Will echo out possible values or error out depending on input to PRINT
 214 
      pj.Driver = '-d';
 215 
      return
 216 
   end
 217 
   % found requested device, set printjob fields appropriately
      6 
 218 
   pj.DriverExt       = extensions{ devIndex }; 
      6 
 219 
   pj.DriverClass     = classes{ devIndex }; 
      6 
 220 
   pj.DriverColor     = strcmp( 'C', colorDevs{ devIndex } ); 
      6 
 221 
   pj.DriverColorSet  = 1; 
      6 
 222 
   pj.DriverExport    = strcmp( 'X', destinations{ devIndex } ); 
  0.01 
      6 
 223 
   pj.DriverClipboard = clipsupport{devIndex}; 
 224 
   
 225 
   % only full page postscript can be appended
      6 
 226 
   if pj.PostScriptAppend && ~strcmp(pj.DriverClass, 'PS') 
 227 
       error(message('MATLAB:print:AppendNotValid'));
 228 
   end
 229 

 230 
   % We don't want to check for deprecation if we are using new SL/SF editor
 231 
   % pipeline. Any format support depends on what the new editor supports.
 232 
   % So skip this deprecation check.
 233 
   % -sramaswa
      6 
 234 
   if ~isSLorSF(pj) 
  0.02 
      6 
 235 
      LocalCheckForDeprecation(pj); % warn if using deprecated device 
      6 
 236 
   end 
      6 
 237 
end 
 238 

 239 
% warn if caller requested zbuffer & use opengl instead
      6 
 240 
if ~pj.UseOriginalHGPrinting && pj.rendererOption && strcmpi(pj.Renderer, 'zbuffer') 
 241 
    pj.Renderer = 'opengl';
 242 
    warning(message('MATLAB:print:DeprecateZbuffer'));
 243 
end
 244 

      6 
 245 
end 

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