MCPcopy Create free account
hub / github.com/Singular/Singular / feHelpBrowser

Function feHelpBrowser

Singular/fehelp.cc:249–339  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

247}
248
249const char* feHelpBrowser(char* which, int warn)
250{
251 int i = 0;
252
253 // if no argument, choose first available help browser
254 if (heHelpBrowsers==NULL) feBrowserFile();
255 if (which == NULL || *which == '\0')
256 {
257 // return, if already set
258 if (heCurrentHelpBrowser != NULL)
259 return heCurrentHelpBrowser->browser;
260
261 // First, try emacs, if emacs-option is set
262 if (feOptValue(FE_OPT_EMACS) != NULL)
263 {
264 while (heHelpBrowsers[i].browser != NULL)
265 {
266 if (strcmp(heHelpBrowsers[i].browser, "emacs") == 0 &&
267 (heHelpBrowsers[i].init_proc(0,i)))
268 {
269 heCurrentHelpBrowser = &(heHelpBrowsers[i]);
270 heCurrentHelpBrowserIndex=i;
271 goto Finish;
272 }
273 i++;
274 }
275 i=0;
276 }
277 while (heHelpBrowsers[i].browser != NULL)
278 {
279 if (heHelpBrowsers[i].init_proc(0,i))
280 {
281 heCurrentHelpBrowser = &(heHelpBrowsers[i]);
282 heCurrentHelpBrowserIndex=i;
283 goto Finish;
284 }
285 i++;
286 }
287 // should never get here
288 dReportBug("should never get here");
289 }
290
291 // with argument, find matching help browser
292 while (heHelpBrowsers[i].browser != NULL &&
293 strcmp(heHelpBrowsers[i].browser, which) != 0)
294 {i++;}
295
296 if (heHelpBrowsers[i].browser == NULL)
297 {
298 if (warn) Warn("No help browser '%s' available.", which);
299 }
300 else
301 {
302 // see whether we can init it
303 if (heHelpBrowsers[i].init_proc(warn,i))
304 {
305 heCurrentHelpBrowser = &(heHelpBrowsers[i]);
306 heCurrentHelpBrowserIndex=i;

Callers 4

feOptActionFunction · 0.85
feHelpFunction · 0.85
feStringAppendBrowsersFunction · 0.85
heBrowserHelpFunction · 0.85

Calls 3

feBrowserFileFunction · 0.85
feOptValueFunction · 0.85
WarnFunction · 0.85

Tested by

no test coverage detected