time | calls | line |
---|
| | 252 | function [ pj, devIndex ] = LocalCheckDevice( pj, cur_arg, devices )
|
| | 253 | %LocalCheckDevice Verify device given is supported, and only one is given.
|
| | 254 | % device proper starts after '-d', if only '-d'
|
| | 255 | % we will later echo out possible choices
|
| | 256 |
|
| | 257 | %We already know first two characters are '-d'
|
| 6 | 258 | if ( length(cur_arg) > 2 )
|
| | 259 |
|
| | 260 | %Is there one unique match?
|
| 6 | 261 | devIndex = find(strcmp( cur_arg(3:end), devices));
|
| 6 | 262 | if length(devIndex) == 1
|
| 6 | 263 | pj.Driver = cur_arg(3:end);
|
| | 264 |
|
| | 265 | else
|
| | 266 | %Is there one partial match, i.e. -dtiffn[ocompression]
|
| | 267 | %todo how to do partial matches with strcmp?
|
| | 268 | devIndex = strmatch( cur_arg(3:end), devices );
|
| | 269 | if length( devIndex ) == 1
|
| | 270 | %Save the full name
|
| | 271 | pj.Driver = devices{devIndex};
|
| | 272 |
|
| | 273 | elseif length( devIndex ) > 1
|
| | 274 | error(message('MATLAB:print:NonUniqueDeviceOption', cur_arg))
|
| | 275 |
|
| | 276 | else
|
| | 277 | % A special case, -djpegnn, where nn == quality level
|
| | 278 | if strncmp( cur_arg, '-djpeg', 6 )
|
| | 279 | if isempty( str2num(cur_arg(7:end)) ) %#ok
|
| | 280 | error(message('MATLAB:print:JPEGQualityLevel'));
|
| | 281 | end
|
| | 282 | %We want to keep quality level in device name.
|
| | 283 | pj.Driver = cur_arg(3:end);
|
| | 284 | devIndex = find(strcmp('jpeg',devices));
|
| | 285 | else
|
| | 286 | error(message('MATLAB:print:InvalidDeviceOption', cur_arg));
|
| | 287 | end
|
| | 288 | end
|
| | 289 | end
|
| | 290 | else
|
| | 291 | devIndex = 0;
|
| | 292 | end
|
| | 293 | %EOFunction LocalCheckDevice
|
| 6 | 294 | end
|
Other subfunctions in this file are not included in this listing.