This is a static copy of a profile report

Home

helptools\private\makehelphyper (2 calls, 0.016 sec)
Generated 15-Mar-2007 12:02:09 using real time.
M-function in file C:\Program Files\MATLAB71\toolbox\matlab\helptools\private\makehelphyper.m
[Copy to new window for comparing multiple runs]

Parents (calling functions)

Function NameFunction TypeCalls
help>displayHelpM-subfunction2
Lines where the most time was spent

Line NumberCodeCallsTotal Time% TimeTime Plot
32
crPos = regexp(pieceStr,'\n\s*...
20.016 s99.8%
75
word = '';
80.000 s0.1%
54
fname = word;
40.000 s0.0%
45
seealsoStr = '';
20.000 s0.0%
59
suffix = '';
40.000 s0.0%
Other lines & overhead  0 s0%
Totals  0.016 s100% 
Children (called functions)

Function NameFunction TypeCallsTotal Time% TimeTime Plot
filepartsM-function20 s0%
hel...vate\makehelphyper>isHyperlinkableM-subfunction40 s0%
Self time (built-ins, overhead, etc.)  0.016 s99.8%
Totals  0.016 s100% 
M-Lint results
Line numberMessage
178Use one call to STRREAD instead of calling STRTOK in a loop.
Coverage results
[ Show coverage for parent directory ]
Total lines in file202
Non-code lines (comments, blank lines)49
Code lines (lines that can run)153
Code lines that did run52
Code lines that did not run101
Coverage (did run/can run)33.99 %
Function listing
   time   calls  line
1 function hyperHelp = makehelphyper(actionName, pathname, fcnName, helpStr)
2 %MAKEHELPHYPER Reformat help output so that the content has hyperlinks
3
4 % Copyright 1984-2005 The MathWorks, Inc.
5 % $Revision: 1.1.6.13.2.2 $ $Date: 2005/07/24 20:57:08 $
6
7 % Isolate the function name in case a full pathname was passed in
2 8 [unused fcnName] = fileparts(fcnName); %#ok
9
10 % Make "see also" references act as hot links
2 11 CR = sprintf('\n');
12 % use sprintf to force translation
2 13 seeAlso = sprintf('See also');
< 0.01 2 14 lengthSeeAlso = length(seeAlso);
2 15 xrefStart = strfind(helpStr, seeAlso);
16 % If we are on a Japanese machine but the m-file help is not translated we
17 % need to look for the English string.
2 18 if isempty(xrefStart) && strcmp('See also',seeAlso) == 0
19 xrefStart = strfind(helpStr, 'See also');
20 % If we found it, reset lengthSeeAlso
21 if ~isempty(xrefStart)
22 lengthSeeAlso = length('See also');
23 end
24 end
2 25 if ~isempty(xrefStart)
< 0.01 2 26 seeAlsoIndex = xrefStart(end);
< 0.01 2 27 nameChars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_/.'; % Note : '.' is now valid (for MATLAB class syntax)
2 28 delimChars = [ ', ' CR ];
29 % Determine start and end of "see also" portion of the help output
2 30 pieceStr = helpStr(seeAlsoIndex+lengthSeeAlso : length(helpStr));
2 31 notePos = min([findstr(pieceStr, sprintf('Overloaded')) findstr(lower(pieceStr), sprintf('note:'))]);
0.02 2 32 crPos = regexp(pieceStr,'\n\s*\n'); % blank line with a possible space (or more).
2 33 if isempty(notePos) && isempty(crPos)
34 xrefEnd = length(helpStr);
35 trailerStr = '';
2 36 elseif ~isempty(notePos)
37 xrefEnd = seeAlsoIndex+lengthSeeAlso + notePos(1) - 1;
38 trailerStr = pieceStr(notePos(1):length(pieceStr));
< 0.01 2 39 else
< 0.01 2 40 xrefEnd = seeAlsoIndex+lengthSeeAlso + crPos(1) - 1;
2 41 trailerStr = pieceStr(crPos(1):length(pieceStr));
2 42 end
43
44 % Parse the "See Also" portion of help output to isolate function names.
< 0.01 2 45 seealsoStr = '';
< 0.01 2 46 word = '';
2 47 for chx = seeAlsoIndex+lengthSeeAlso : xrefEnd
41 48 if length(findstr(nameChars, helpStr(chx))) == 1
33 49 word = [ word helpStr(chx)];
8 50 elseif (length(findstr(delimChars, helpStr(chx))) == 1)
8 51 if length(word) > 0
52 % This word appears to be a function name.
53 % Make link in corresponding "see also" string.
< 0.01 4 54 fname = word;
4 55 if strcmp(upper(word), word) == 1
56 % only lowercase this if it's all uppercase.
4 57 fname = lower(word);
4 58 end
< 0.01 4 59 suffix = '';
4 60 if fname(length(fname)) == '.'
61 % Don't hyperlink the last period of the word.
2 62 fname = fname(1:length(fname)-1);
< 0.01 2 63 suffix = '.';
< 0.01 2 64 end
65 % Make sure the function exists before hyperlinking it.
4 66 if isHyperlinkable(fname)
4 67 seealsoStr = [seealsoStr '<a href="matlab:' actionName ' ' fname '">' fname '</a>' suffix];
68 else
69 seealsoStr = [seealsoStr word];
70 end
4 71 end
72
73
8 74 seealsoStr = [seealsoStr helpStr(chx)];
< 0.01 8 75 word = '';
76 else
77 seealsoStr = [seealsoStr word helpStr(chx)];
78 word = '';
79 end
41 80 end
81 % Replace "See Also" section with modified string (with links)
2 82 helpStr = [helpStr(1:seeAlsoIndex+lengthSeeAlso -1) seealsoStr trailerStr];
2 83 end
84
85 % If there is a list of overloaded methods, make these act as links.
2 86 overloadPos = findstr(helpStr, xlate('Overloaded'));
2 87 if strcmp(actionName,'doc') == 1
88 textToFind = ' doc ';
89 len = 5;
< 0.01 2 90 else
< 0.01 2 91 textToFind = ' help ';
< 0.01 2 92 len = 6;
< 0.01 2 93 end
94
2 95 if length(overloadPos) > 0
96 pieceStr = helpStr(overloadPos(1) : length(helpStr));
97 % Parse the "Overload methods" section to isolate strings of the form "help DIRNAME/METHOD"
98 overloadStr = '';
99 linebrkPos = find(pieceStr == CR);
100 lineStrt = 1;
101 for lx = 1 : length(linebrkPos)
102 lineEnd = linebrkPos(lx);
103 curLine = pieceStr(lineStrt : lineEnd);
104 methodStartPos = findstr(curLine, textToFind);
105 methodEndPos = length(curLine) - 2;
106 if (length(methodStartPos) > 0 ) && (length(methodEndPos) > 0 )
107 linkTag = ['<a href="matlab:' actionName ' ' curLine(methodStartPos(1)+len:methodEndPos(1)+1) '">'];
108 overloadStr = [overloadStr curLine(1:methodStartPos(1)) linkTag curLine(methodStartPos(1)+1:methodEndPos(1)+1) '</a>' curLine(methodEndPos(1)+2:length(curLine))];
109 else
110 overloadStr = [overloadStr curLine];
111 end
112 lineStrt = lineEnd + 1;
113 end
114 % Replace "Overloaded methods" section with modified string (with links)
115 helpStr = [helpStr(1:overloadPos(1)-1) overloadStr];
116 end
117
118 % If this topic is a Contents.m file, scan it for function lists, and
119 % modify function names to act as active links.
2 120 if (strcmpi(fcnName, 'Contents')) || (length(findstr(helpStr,'is both a directory and a function'))) || (strcmp(fcnName,'simulink')) || (strcmp(fcnName,'debug'))
121 TAB = sprintf('\t');
122 helpStr = strrep(helpStr, TAB, ' ');
123 modHelpStr = '';
124 linebrkPos = find(helpStr == CR);
125 lineStrt = 1;
126 for lx = 1 : length(linebrkPos)
127 lineEnd = linebrkPos(lx);
128 curLine = helpStr(lineStrt : lineEnd);
129 hyphPos = findstr(curLine, ' - ');
130 if any(hyphPos)
131 nonblankPos = find(curLine ~= ' ');
132 if curLine(nonblankPos(1)) == '-'
133 modHelpStr = [modHelpStr curLine];
134 else
135 % start with the hyphen position, and walk backwards to the
136 % first nonblank position.
137 for i = hyphPos(1):-1:nonblankPos(1)
138 if (curLine(i) ~= ' ') && (curLine(i) ~= ','), break, end;
139 end
140 fname = curLine(nonblankPos(1):i);
141 remainder = curLine(i+1:end);
142 try
143 % If there is any help for this name, insert a link for it.
144 % First determine if we need to qualify the name to put
145 % in the link by testing whether or not the function
146 % exists under the same directory.
147 qualified_name = fname;
148 fullpath = which(fname);
149 if ~isempty(pathname) && ~isempty(fullpath)
150 startpos = strfind(fullpath, [pathname filesep]);
151 if isempty(startpos)
152 % Maybe the function is shadowed... if so, we
153 % need to add a prefix to the help command so
154 % we get the correct help.
155 fullpath = which('-all',fname);
156 if length(fullpath)>1
157 for entry=2:length(fullpath)
158 pathentry = fullpath{entry};
159 startpos = strfind(pathentry, [filesep pathname filesep]);
160 if ~isempty(startpos)
161 pname = strrep(pathentry(startpos+1:end),'\','/');
162 [pname unused] = fileparts(pname); %#ok
163 if ~isempty(pname)
164 qualified_name = [pname '/' fname];
165 end
166 end
167 end
168 end
169 end
170 end
171
172 % If this is a valid function name, convert it to a
173 % hyperlink.
174 if isHyperlinkable(fname)
175 fnameLink = strrep(qualified_name,'''','''''');
176 if remainder(1) == ','
177 % Sometimes there are two names separated by a comma.
178 [fname2, remainder2] = strtok(remainder(3:end));
179 fnameLink2 = strrep([pathname '/' fname2],'''','''''');
180 modHelpStr = [modHelpStr curLine(1:nonblankPos(1)-1) '<a href="' 'matlab:' actionName ' ''' fnameLink '''">' fname '</a>, ' '<a href="' 'matlab:' actionName ' ''' fnameLink2 '''">' fname2 '</a>' remainder2];
181 else
182 modHelpStr = [modHelpStr curLine(1:nonblankPos(1)-1) '<a href="' 'matlab:' actionName ' ''' fnameLink '''">' fname '</a>' remainder];
183 end
184 else
185 modHelpStr = [modHelpStr curLine];
186 end
187 catch
188 % Just in case an error occurred during the helpfunc call, don't try to
189 % hyperlink anything.
190 modHelpStr = [modHelpStr curLine];
191 end
192 end
193 else
194 modHelpStr = [modHelpStr curLine];
195 end
196 lineStrt = lineEnd + 1;
197 end
198 helpStr = modHelpStr;
199 end
200
< 0.01 2 201 hyperHelp = helpStr;
202

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