KerMor  0.9
Model order reduction for nonlinear dynamical systems and nonlinear approximation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
pdftops.m
Go to the documentation of this file.
1 
2 
3 /* (Autoinserted by mtoc++)
4  * This source code has been filtered by the mtoc++ executable,
5  * which generates code that can be processed by the doxygen documentation tool.
6  *
7  * On the other hand, it can neither be interpreted by MATLAB, nor can it be compiled with a C++ compiler.
8  * Except for the comments, the function bodies of your M-file functions are untouched.
9  * Consequently, the FILTER_SOURCE_FILES doxygen switch (default in our Doxyfile.template) will produce
10  * attached source files that are highly readable by humans.
11  *
12  * Additionally, links in the doxygen generated documentation to the source code of functions and class members refer to
13  * the correct locations in the source code browser.
14  * However, the line numbers most likely do not correspond to the line numbers in the original MATLAB source files.
15  */
16 
17 function varargout = pdftops(cmd) {
18 
19 
20 /* Copyright: Oliver Woodford, 2009-2010 */
21 
22 /* Thanks to Jonas Dorn for the fix for the title of the uigetdir window on
23  * Mac OS.
24  * Thanks to Christoph Hertel for pointing out a bug in check_xpdf_path
25  * under linux. */
26 
27 /* Call pdftops */
28 [varargout[1:nargout]] = system(sprintf(" '%s' %s ", xpdf_path, cmd));
29 return
30 
31 }
62 function path_ = pdftops>xpdf_path() {
63 path_ = user_string(" pdftops ");
64 /* Check the path works */
65 if check_xpdf_path(path_)
66  return
67 end
68 /* Check whether the binary is on the path */
69 if ispc
70  bin = " pdftops.exe ";
71 else
72  bin = " pdftops ";
73 end
74 if check_store_xpdf_path(bin)
75  path_ = bin;
76  return
77 end
78 /* Search the obvious places */
79 if ispc
80  path_ = " C:\Program Files\xpdf\pdftops.exe ";
81 else
82  path_ = " /usr/local/bin/pdftops ";
83 end
84 if check_store_xpdf_path(path_)
85  return
86 end
87 /* Ask the user to enter the path */
88 while 1
89  if strncmp(computer," MAC ",3) /* Is a Mac
90  * Give separate warning as the uigetdir dialogue box doesn't have a
91  * title */
92 
93  uiwait(warndlg(" Pdftops not found. Please locate the program, or install xpdf-tools from http://users.phg-online.de/tk/MOSXS/. "))
94  end
95  base = uigetdir(" / ", " Pdftops not found. Please locate the program. ");
96  if isequal(base, 0)
97  /* User hit cancel or closed window */
98  break;
99  end
100  base = [base filesep];
101  bin_dir = [, [" bin " filesep], [" lib " filesep]];
102  for a = 1:numel(bin_dir)
103  path_ = [base bin_dir[a] bin];
104  if exist(path_, " file ") == 2
105  break;
106  end
107  end
108  if check_store_xpdf_path(path_)
109  return
110  end
111 end
112 error(" pdftops executable not found. ");
113 
114 }
115 
116 function good = pdftops>check_store_xpdf_path(path_) {
117 good = check_xpdf_path(path_);
118 if ~good
119  return
120 end
121 /* Update the current default path to the path found */
122 if ~user_string(" pdftops ", path_)
123  warning(" Path to pdftops executable could not be saved. Enter it manually in pdftops.txt. ");
124  return
125 end
126 return
127 
128 }
129 
130 function good = pdftops>check_xpdf_path(path_) {
131 [good message] = system(sprintf(" '%s' -h ", path_));
132 /* system returns good = 1 even when the command runs
133  * Look for something distinct in the help text */
134 good = ~isempty(strfind(message, " PostScript "));
135 return
136 }
137 
function path_ = pdftops>xpdf_path()
Definition: pdftops.m:62
function string = user_string(string_name, string)
Definition: user_string.m:17
function good = pdftops>check_store_xpdf_path(path_)
Definition: pdftops.m:116
function varargout = pdftops(cmd)
PDFTOPS Calls a local pdftops executable with the input command.
Definition: pdftops.m:17
function good = pdftops>check_xpdf_path(path_)
Definition: pdftops.m:130
A variable number of output arguments.