Data Structures | Macros | Typedefs | Functions | Variables
fehelp.cc File Reference
#include <string.h>
#include <unistd.h>
#include <stdio.h>
#include <stddef.h>
#include <stdlib.h>
#include <time.h>
#include <kernel/mod2.h>
#include <omalloc/omalloc.h>
#include <misc/mylimits.h>
#include <resources/feResource.h>
#include <reporter/reporter.h>
#include <resources/omFindExec.h>
#include <reporter/si_signals.h>
#include "ipid.h"
#include "ipshell.h"
#include "libparse.h"
#include "feOpt.h"
#include "tok.h"
#include "fehelp.h"

Go to the source code of this file.

Data Structures

struct  heEntry_s
 
struct  heBrowser_s
 

Macros

#define MAX_HE_ENTRY_LENGTH   160
 
#define MAX_SYSCMD_LEN   MAXPATHLEN*2
 
#define HELP_OK   0
 
#define FIN_INDEX   '\037'
 
#define HELP_NOT_OPEN   1
 
#define HELP_NOT_FOUND   2
 
#define BUF_LEN   256
 
#define IDX_LEN   256
 
#define MAX_LINES   21
 

Typedefs

typedef heEntry_sheEntry
 
typedef void(* heBrowserHelpProc) (heEntry hentry, int br)
 
typedef BOOLEAN(* heBrowserInitProc) (int warn, int br)
 
typedef heBrowser_sheBrowser
 

Functions

static char * strclean (char *str)
 
static BOOLEAN heKey2Entry (char *filename, char *key, heEntry hentry)
 
static int heReKey2Entry (char *filename, char *key, heEntry hentry)
 
static BOOLEAN strmatch (char *s, char *re)
 
static BOOLEAN heOnlineHelp (char *s)
 
static void heBrowserHelp (heEntry hentry)
 
static long heKeyChksum (char *key)
 
static BOOLEAN heGenInit (int, int)
 
static void heGenHelp (heEntry hentry, int)
 
static void heBuiltinHelp (heEntry hentry, int)
 
static BOOLEAN heDummyInit (int, int)
 
static void heDummyHelp (heEntry hentry, int)
 
static BOOLEAN heEmacsInit (int, int)
 
static void heEmacsHelp (heEntry hentry, int)
 
void feHelp (char *str)
 
static void feBrowserFile ()
 
const char * feHelpBrowser (char *which, int warn)
 
void feStringAppendBrowsers (int warn)
 
static void hePrintHelpStr (const idhdl hh, const char *id, const char *pa)
 
 Print ("running `%s`\, sys)
 
void system (sys)
 
static int singular_manual (char *str, BOOLEAN isIndexEntry)
 
static char tolow (char p)
 
static int show (unsigned long offset, char *close)
 

Variables

static heBrowser heCurrentHelpBrowser = NULL
 
static int heCurrentHelpBrowserIndex = -1
 
static heBrowser_sheHelpBrowsers =NULL
 
static BOOLEAN feHelpCalled = FALSE
 

Data Structure Documentation

§ heEntry_s

struct heEntry_s

Definition at line 44 of file fehelp.cc.

Data Fields
long chksum
char key[MAX_HE_ENTRY_LENGTH]
char node[MAX_HE_ENTRY_LENGTH]
char url[MAX_HE_ENTRY_LENGTH]

§ heBrowser_s

struct heBrowser_s

Definition at line 56 of file fehelp.cc.

Data Fields
const char * action
const char * browser
heBrowserHelpProc help_proc
heBrowserInitProc init_proc
const char * required

Macro Definition Documentation

§ BUF_LEN

#define BUF_LEN   256

Definition at line 1054 of file fehelp.cc.

§ FIN_INDEX

#define FIN_INDEX   '\037'

Definition at line 1051 of file fehelp.cc.

§ HELP_NOT_FOUND

#define HELP_NOT_FOUND   2

Definition at line 1053 of file fehelp.cc.

§ HELP_NOT_OPEN

#define HELP_NOT_OPEN   1

Definition at line 1052 of file fehelp.cc.

§ HELP_OK

#define HELP_OK   0

Definition at line 1050 of file fehelp.cc.

§ IDX_LEN

#define IDX_LEN   256

Definition at line 1055 of file fehelp.cc.

§ MAX_HE_ENTRY_LENGTH

#define MAX_HE_ENTRY_LENGTH   160

Definition at line 43 of file fehelp.cc.

§ MAX_LINES

#define MAX_LINES   21

Definition at line 1056 of file fehelp.cc.

§ MAX_SYSCMD_LEN

#define MAX_SYSCMD_LEN   MAXPATHLEN*2

Definition at line 822 of file fehelp.cc.

Typedef Documentation

§ heBrowser

Definition at line 64 of file fehelp.cc.

§ heBrowserHelpProc

typedef void(* heBrowserHelpProc) (heEntry hentry, int br)

Definition at line 53 of file fehelp.cc.

§ heBrowserInitProc

typedef BOOLEAN(* heBrowserInitProc) (int warn, int br)

Definition at line 54 of file fehelp.cc.

§ heEntry

typedef heEntry_s* heEntry

Definition at line 51 of file fehelp.cc.

Function Documentation

§ feBrowserFile()

static void feBrowserFile ( )
static

Definition at line 188 of file fehelp.cc.

189 {
190  FILE *f=feFopen("help.cnf","r",NULL,TRUE);
191  int br=0;
192  if (f!=NULL)
193  {
194  char buf[512];
195  while (fgets( buf, sizeof(buf), f))
196  {
197  if ((buf[0]!='#') && (buf[0]>' ')) br++;
198  }
199  fseek(f,0,SEEK_SET);
200  // for the 4(!) default browsers
202  br = 0;
203  while (fgets( buf, sizeof(buf), f))
204  {
205  if ((buf[0]!='#') && (buf[0]>' '))
206  {
207  char *name=strtok(buf,"!");
208  char *req=strtok(NULL,"!");
209  char *cmd=strtok(NULL,"!");
210  if ((name!=NULL) && (req!=NULL) && (cmd!=NULL))
211  {
212  while ((cmd[0]!='\0') && (cmd[strlen(cmd)-1]<=' '))
213  cmd[strlen(cmd)-1]='\0';
214  //Print("name %d >>%s<<\n\treq:>>%s<<\n\tcmd:>>%s<<\n",br,name,req,cmd);
215  heHelpBrowsers[br].browser=(char *)omStrDup(name);
219  heHelpBrowsers[br].action=omStrDup(cmd);
220  br++;
221  }
222  else
223  {
224  Print("syntax error in help.cnf, at line starting with %s\n",buf);
225  }
226  }
227  }
228  fclose(f);
229  }
230  else
231  {
232  // for the 4(!) default browsers
234  }
235  heHelpBrowsers[br].browser="builtin";
238  heHelpBrowsers[br].required="i";
239  //heHelpBrowsers[br].action=NULL;
240  br++;
241  heHelpBrowsers[br].browser="dummy";
244  //heHelpBrowsers[br].required=NULL;
245  //heHelpBrowsers[br].action=NULL;
246  br++;
247  heHelpBrowsers[br].browser="emacs";
250  //heHelpBrowsers[br].required=NULL;
251  //heHelpBrowsers[br].action=NULL;
252  //br++;
253  //heHelpBrowsers[br].browser=NULL;
254  //heHelpBrowsers[br].init_proc=NULL;
255  //heHelpBrowsers[br].help_proc=NULL;
256  //heHelpBrowsers[br].required=NULL;
257  //heHelpBrowsers[br].action=NULL;
258 }
static BOOLEAN heEmacsInit(int, int)
Definition: fehelp.cc:1024
heBrowserInitProc init_proc
Definition: fehelp.cc:59
const char * required
Definition: fehelp.cc:61
const char * action
Definition: fehelp.cc:62
#define TRUE
Definition: auxiliary.h:99
const char * browser
Definition: fehelp.cc:58
static void heBuiltinHelp(heEntry hentry, int)
Definition: fehelp.cc:1037
static BOOLEAN heDummyInit(int, int)
Definition: fehelp.cc:1015
Print("running `%s`\, sys)
int status int void * buf
Definition: si_signals.h:59
static void heEmacsHelp(heEntry hentry, int)
Definition: fehelp.cc:1028
static void heDummyHelp(heEntry hentry, int)
Definition: fehelp.cc:1019
FILE * feFopen(const char *path, const char *mode, char *where, short useWerror, short path_only)
Definition: feFopen.cc:47
FILE * f
Definition: checklibs.c:7
static void heGenHelp(heEntry hentry, int)
Definition: fehelp.cc:882
char name(const Variable &v)
Definition: factory.h:178
#define NULL
Definition: omList.c:10
static heBrowser_s * heHelpBrowsers
Definition: fehelp.cc:96
static BOOLEAN heGenInit(int, int)
Definition: fehelp.cc:823
heBrowserHelpProc help_proc
Definition: fehelp.cc:60
#define SEEK_SET
Definition: mod2.h:123
#define omAlloc0(size)
Definition: omAllocDecl.h:211
#define omStrDup(s)
Definition: omAllocDecl.h:263

§ feHelp()

void feHelp ( char *  str)

Definition at line 103 of file fehelp.cc.

104 {
105  str = strclean(str);
106  if (str == NULL) {heBrowserHelp(NULL); return;}
107 
108  if (strlen(str) > MAX_HE_ENTRY_LENGTH - 2) // need room for extra **
109  str[MAX_HE_ENTRY_LENGTH - 3] = '\0';
110 
111  BOOLEAN key_is_regexp = (strchr(str, '*') != NULL);
112 
113  // try proc help and library help
114  if (! key_is_regexp && heOnlineHelp(str)) return;
115 
116  heEntry_s hentry;
117  memset(&hentry,0,sizeof(hentry));
118  char* idxfile = feResource('x' /*"IdxFile"*/);
119 
120  // Try exact match of help string with key in index
121  if (!key_is_regexp && (idxfile != NULL) && heKey2Entry(idxfile, str, &hentry))
122  {
123  heBrowserHelp(&hentry);
124  return;
125  }
126 
127  // Try to match approximately with key in index file
128  if (idxfile != NULL)
129  {
132 
133  StringSetS("");
134  int found = heReKey2Entry(idxfile, str, &hentry);
135 
136  // Try to match with str*
137  if (found == 0)
138  {
139  char mkey[MAX_HE_ENTRY_LENGTH];
140  strcpy(mkey, str);
141  strcat(mkey, "*");
142  found = heReKey2Entry(idxfile, mkey, &hentry);
143  // Try to match with *str*
144  if (found == 0)
145  {
146  mkey[0] = '*';
147  strcpy(mkey + 1, str);
148  strcat(mkey, "*");
149  found = heReKey2Entry(idxfile, mkey, &hentry);
150  }
151 
152  // Print warning and return if nothing found
153  if (found == 0)
154  {
155  Warn("No help for topic '%s' (not even for '*%s*')", str, str);
156  WarnS("Try '?;' for general help");
157  WarnS("or '?Index;' for all available help topics.");
158  return;
159  }
160  }
161 
162  // do help if unique match was found
163  if (found == 1)
164  {
165  heBrowserHelp(&hentry);
166  return;
167  }
168  // Print warning about multiple matches and return
169  if (key_is_regexp)
170  Warn("No unique help for '%s'", str);
171  else
172  Warn("No help for topic '%s'", str);
173  Warn("Try one of");
174  char *matches=StringEndS();
175  PrintS(matches);
176  omFree(matches);
177  PrintLn();
178  return;
179  }
180 
181  // no idx file, let Browsers deal with it, if they can
182  strcpy(hentry.key, str);
183  *hentry.node = '\0';
184  *hentry.url = '\0';
185  hentry.chksum = 0;
186  heBrowserHelp(&hentry);
187 }
const char * feHelpBrowser(char *which, int warn)
Definition: fehelp.cc:260
char url[MAX_HE_ENTRY_LENGTH]
Definition: fehelp.cc:48
long chksum
Definition: fehelp.cc:49
void PrintLn()
Definition: reporter.cc:310
static BOOLEAN heOnlineHelp(char *s)
Definition: fehelp.cc:632
#define MAX_HE_ENTRY_LENGTH
Definition: fehelp.cc:43
static char * feResource(feResourceConfig config, int warn)
Definition: feResource.cc:258
char key[MAX_HE_ENTRY_LENGTH]
Definition: fehelp.cc:46
static int heReKey2Entry(char *filename, char *key, heEntry hentry)
Definition: fehelp.cc:579
char * StringEndS()
Definition: reporter.cc:151
static void heBrowserHelp(heEntry hentry)
Definition: fehelp.cc:780
#define WarnS
Definition: emacs.cc:81
bool found
Definition: facFactorize.cc:56
char node[MAX_HE_ENTRY_LENGTH]
Definition: fehelp.cc:47
#define omFree(addr)
Definition: omAllocDecl.h:261
#define assume(x)
Definition: mod2.h:403
void StringSetS(const char *st)
Definition: reporter.cc:128
static BOOLEAN heKey2Entry(char *filename, char *key, heEntry hentry)
Definition: fehelp.cc:399
static heBrowser heCurrentHelpBrowser
Definition: fehelp.cc:85
void PrintS(const char *s)
Definition: reporter.cc:284
#define NULL
Definition: omList.c:10
static char * strclean(char *str)
Definition: fehelp.cc:375
int BOOLEAN
Definition: auxiliary.h:86
#define Warn
Definition: emacs.cc:80

§ feHelpBrowser()

const char* feHelpBrowser ( char *  which,
int  warn 
)

Definition at line 260 of file fehelp.cc.

261 {
262  int i = 0;
263 
264  // if no argument, choose first available help browser
266  if (which == NULL || *which == '\0')
267  {
268  // return, if already set
269  if (heCurrentHelpBrowser != NULL)
271 
272  // First, try emacs, if emacs-option is set
273  if (feOptValue(FE_OPT_EMACS) != NULL)
274  {
275  while (heHelpBrowsers[i].browser != NULL)
276  {
277  if (strcmp(heHelpBrowsers[i].browser, "emacs") == 0 &&
278  (heHelpBrowsers[i].init_proc(0,i)))
279  {
282  goto Finish;
283  }
284  i++;
285  }
286  i=0;
287  }
288  while (heHelpBrowsers[i].browser != NULL)
289  {
290  if (heHelpBrowsers[i].init_proc(0,i))
291  {
294  goto Finish;
295  }
296  i++;
297  }
298  // should never get here
299  dReportBug("should never get here");
300  }
301 
302  // with argument, find matching help browser
303  while (heHelpBrowsers[i].browser != NULL &&
304  strcmp(heHelpBrowsers[i].browser, which) != 0)
305  {i++;}
306 
307  if (heHelpBrowsers[i].browser == NULL)
308  {
309  if (warn) Warn("No help browser '%s' available.", which);
310  }
311  else
312  {
313  // see whether we can init it
314  if (heHelpBrowsers[i].init_proc(warn,i))
315  {
318  goto Finish;
319  }
320  }
321 
322  // something went wrong
323  if (heCurrentHelpBrowser == NULL)
324  {
325  feHelpBrowser();
327  if (warn)
328  Warn("Setting help browser to '%s'.", heCurrentHelpBrowser->browser);
330  }
331  else
332  {
333  // or, leave as is
334  if (warn)
335  Warn("Help browser stays at '%s'.", heCurrentHelpBrowser->browser);
337  }
338 
339  Finish:
340  // update value of Browser Option
341  if (feOptSpec[FE_OPT_BROWSER].value == NULL ||
342  strcmp((char*) feOptSpec[FE_OPT_BROWSER].value,
344  {
345  omfree(feOptSpec[FE_OPT_BROWSER].value);
346  feOptSpec[FE_OPT_BROWSER].value
348  }
350 }
const char * feHelpBrowser(char *which, int warn)
Definition: fehelp.cc:260
static void * feOptValue(feOptIndex opt)
Definition: feOpt.h:40
static void feBrowserFile()
Definition: fehelp.cc:188
void * value
Definition: fegetopt.h:93
const char * browser
Definition: fehelp.cc:58
static int heCurrentHelpBrowserIndex
Definition: fehelp.cc:86
#define assume(x)
Definition: mod2.h:403
#define omfree(addr)
Definition: omAllocDecl.h:237
struct fe_option feOptSpec[]
#define dReportBug(s)
Definition: reporter.h:112
int i
Definition: cfEzgcd.cc:123
static heBrowser heCurrentHelpBrowser
Definition: fehelp.cc:85
#define NULL
Definition: omList.c:10
static heBrowser_s * heHelpBrowsers
Definition: fehelp.cc:96
#define Warn
Definition: emacs.cc:80
#define omStrDup(s)
Definition: omAllocDecl.h:263

§ feStringAppendBrowsers()

void feStringAppendBrowsers ( int  warn)

Definition at line 352 of file fehelp.cc.

353 {
354  int i;
355  StringAppendS("Available HelpBrowsers: ");
356 
357  i = 0;
359  while (heHelpBrowsers[i].browser != NULL)
360  {
361  if (heHelpBrowsers[i].init_proc(warn,i))
362  StringAppend("%s, ", heHelpBrowsers[i].browser);
363  i++;
364  }
365  StringAppend("\nCurrent HelpBrowser: %s ", feHelpBrowser());
366 }
const char * feHelpBrowser(char *which, int warn)
Definition: fehelp.cc:260
static void feBrowserFile()
Definition: fehelp.cc:188
void StringAppendS(const char *st)
Definition: reporter.cc:107
#define StringAppend
Definition: emacs.cc:82
int i
Definition: cfEzgcd.cc:123
#define NULL
Definition: omList.c:10
static heBrowser_s * heHelpBrowsers
Definition: fehelp.cc:96

§ heBrowserHelp()

static void heBrowserHelp ( heEntry  hentry)
static

Definition at line 780 of file fehelp.cc.

781 {
782  // check checksums of procs
783  int kchksum = (hentry != NULL && hentry->chksum > 0 ?
784  heKeyChksum(hentry->key) : 0);
785  if (kchksum && kchksum != hentry->chksum && heOnlineHelp(hentry->key))
786  return;
787 
790  if (! feHelpCalled)
791  {
792  Warn("Displaying help in browser '%s'.", heCurrentHelpBrowser->browser);
793  //if (strcmp(heCurrentHelpBrowser->browser, "netscape") == 0 &&
794  // feResource('h', 0) == NULL)
795  //{
796  // Warn("Using URL '%s'.", feResource('u', 0));
797  //}
798  Warn("Use 'system(\"--browser\", <browser>);' to change browser,");
799  StringSetS("where <browser> can be: ");
800  int i = 0;
801  i = 0;
802  while (heHelpBrowsers[i].browser != NULL)
803  {
804  if (heHelpBrowsers[i].init_proc(0,i))
805  StringAppend("\"%s\", ", heHelpBrowsers[i].browser);
806  i++;
807  }
808  char *browsers=StringEndS();
809  if (browsers[strlen(browsers)-2] == ',')
810  {
811  browsers[strlen(browsers)-2] = '.';
812  browsers[strlen(browsers)-1] = '\0';
813  }
814  WarnS(browsers);
815  omFree(browsers);
816  }
817 
819  feHelpCalled = TRUE;
820 }
const char * feHelpBrowser(char *which, int warn)
Definition: fehelp.cc:260
long chksum
Definition: fehelp.cc:49
static BOOLEAN heOnlineHelp(char *s)
Definition: fehelp.cc:632
static BOOLEAN feHelpCalled
Definition: fehelp.cc:778
#define TRUE
Definition: auxiliary.h:99
char key[MAX_HE_ENTRY_LENGTH]
Definition: fehelp.cc:46
const char * browser
Definition: fehelp.cc:58
char * StringEndS()
Definition: reporter.cc:151
#define WarnS
Definition: emacs.cc:81
static int heCurrentHelpBrowserIndex
Definition: fehelp.cc:86
#define omFree(addr)
Definition: omAllocDecl.h:261
#define assume(x)
Definition: mod2.h:403
void StringSetS(const char *st)
Definition: reporter.cc:128
#define StringAppend
Definition: emacs.cc:82
int i
Definition: cfEzgcd.cc:123
static heBrowser heCurrentHelpBrowser
Definition: fehelp.cc:85
static long heKeyChksum(char *key)
Definition: fehelp.cc:760
#define NULL
Definition: omList.c:10
static heBrowser_s * heHelpBrowsers
Definition: fehelp.cc:96
heBrowserHelpProc help_proc
Definition: fehelp.cc:60
#define Warn
Definition: emacs.cc:80

§ heBuiltinHelp()

static void heBuiltinHelp ( heEntry  hentry,
int   
)
static

Definition at line 1037 of file fehelp.cc.

1038 {
1039  char* node = omStrDup(hentry != NULL && *(hentry->key) != '\0' ?
1040  hentry->key : "Top");
1041  singular_manual(node,(hentry != NULL) && (hentry->url!=NULL));
1042  omFree(node);
1043 }
char url[MAX_HE_ENTRY_LENGTH]
Definition: fehelp.cc:48
static int singular_manual(char *str, BOOLEAN isIndexEntry)
Definition: fehelp.cc:1105
char key[MAX_HE_ENTRY_LENGTH]
Definition: fehelp.cc:46
#define omFree(addr)
Definition: omAllocDecl.h:261
#define NULL
Definition: omList.c:10
#define omStrDup(s)
Definition: omAllocDecl.h:263

§ heDummyHelp()

static void heDummyHelp ( heEntry  hentry,
int   
)
static

Definition at line 1019 of file fehelp.cc.

1020 {
1021  WerrorS("No functioning help browser available.");
1022 }
void WerrorS(const char *s)
Definition: feFopen.cc:24

§ heDummyInit()

static BOOLEAN heDummyInit ( int  ,
int   
)
static

Definition at line 1015 of file fehelp.cc.

1016 {
1017  return TRUE;
1018 }
#define TRUE
Definition: auxiliary.h:99

§ heEmacsHelp()

static void heEmacsHelp ( heEntry  hentry,
int   
)
static

Definition at line 1028 of file fehelp.cc.

1029 {
1030  WarnS("Your help command could not be executed. Use");
1031  Warn("C-h C-s %s",
1032  (hentry != NULL && *(hentry->node) != '\0' ? hentry->node : "Top"));
1033  Warn("to enter the Singular online help. For general");
1034  Warn("information on Singular running under Emacs, type C-h m.");
1035 }
#define WarnS
Definition: emacs.cc:81
char node[MAX_HE_ENTRY_LENGTH]
Definition: fehelp.cc:47
#define NULL
Definition: omList.c:10
#define Warn
Definition: emacs.cc:80

§ heEmacsInit()

static BOOLEAN heEmacsInit ( int  ,
int   
)
static

Definition at line 1024 of file fehelp.cc.

1025 {
1026  return TRUE;
1027 }
#define TRUE
Definition: auxiliary.h:99

§ heGenHelp()

static void heGenHelp ( heEntry  hentry,
int  br 
)
static

Definition at line 882 of file fehelp.cc.

883 {
884  char sys[MAX_SYSCMD_LEN];
885  const char *p=heHelpBrowsers[br].action;
886  if (p==NULL) {PrintS("no action ?\n"); return;}
887  memset(sys,0,MAX_SYSCMD_LEN);
888  int i=0;
889  while ((*p>'\0')&& (i<MAX_SYSCMD_LEN))
890  {
891  if ((*p)=='%')
892  {
893  p++;
894  switch (*p)
895  {
896  case 'f': /* local html:file */
897  case 'h': /* local html:URL */
898  case 'H': /* www html */
899  {
900  char temp[256];
901  char *htmldir = feResource('h' /*"HtmlDir"*/);
902  if ((*p=='h')&&(htmldir!=NULL))
903  strcat(sys,"file://localhost");
904  else if ((*p=='H')||(htmldir==NULL))
905  htmldir = feResource('u' /* %H -> "ManualUrl"*/);
906  /* always defined */
907  if (hentry != NULL && *(hentry->url) != '\0')
908  #ifdef HAVE_VSNPRINTF
909  {
910  if (*p=='H')
911  snprintf(temp,256,"%s/%d-%d-%d/%s", htmldir,
912  SINGULAR_VERSION/1000,
913  (SINGULAR_VERSION % 1000)/100,
914  (SINGULAR_VERSION % 100)/10,
915  hentry->url);
916  else
917  snprintf(temp,256,"%s/%s", htmldir, hentry->url);
918  }
919  else
920  {
921  if (*p=='H')
922  snprintf(temp,256,"%s/%d-%d-%d/index.htm", htmldir,
923  SINGULAR_VERSION/1000,
924  (SINGULAR_VERSION % 1000)/100,
925  (SINGULAR_VERSION % 100)/10
926  );
927  else
928  snprintf(temp,256,"%s/index.htm", htmldir);
929  }
930  #else
931  {
932  if (*p=='H')
933  sprintf(temp,"%s/%d-%d-%d/%s", htmldir,
934  SINGULAR_VERSION/1000,
935  (SINGULAR_VERSION % 1000)/100,
936  (SINGULAR_VERSION % 100)/10,
937  hentry->url);
938  else
939  sprintf(temp,"%s/%d-%d-%d/%s", htmldir, hentry->url);
940  }
941  else
942  if (*p=='H')
943  sprintf(temp,"%s/%d-%d-%d/index.htm", htmldir,
944  SINGULAR_VERSION/1000,
945  (SINGULAR_VERSION % 1000)/100,
946  (SINGULAR_VERSION % 100)/10
947  );
948  else
949  sprintf(temp,"%s/index.htm", htmldir);
950  }
951  #endif
952  strcat(sys,temp);
953  if ((*p)=='f')
954  { // remove #SEC
955  char *pp=(char *)strchr(sys,'#');
956  if (pp!=NULL)
957  {
958  *pp='\0';
959  i=strlen(sys);
960  memset(pp,0,MAX_SYSCMD_LEN-i);
961  }
962  }
963  i=strlen(sys);
964  break;
965  }
966  case 'i': /* singular.hlp */
967  {
968  char *i_res=feResource('i');
969  if (i_res!=NULL) strcat(sys,i_res);
970  else
971  {
972  WarnS("singular.hlp not found");
973  return;
974  }
975  i=strlen(sys);
976  break;
977  }
978  case 'n': /* info node */
979  {
980  char temp[256];
981  if ((hentry!=NULL) && (*(hentry->node) != '\0'))
982  sprintf(temp,"%s",hentry->node);
983  //else if ((hentry!=NULL) && (hentry->key!=NULL))
984  // sprintf(temp,"Index '%s'",hentry->key);
985  else
986  sprintf(temp,"Top");
987  strcat(sys,temp);
988  i=strlen(sys);
989  break;
990  }
991  case 'v': /* version number*/
992  {
993  char temp[256];
994  sprintf(temp,"%d-%d-%d",SINGULAR_VERSION/1000,
995  (SINGULAR_VERSION % 1000)/100,
996  (SINGULAR_VERSION % 100)/10);
997  strcat(sys,temp);
998  i=strlen(sys);
999  break;
1000  }
1001  default: break;
1002  }
1003  p++;
1004  }
1005  else
1006  {
1007  sys[i]=*p;
1008  p++;i++;
1009  }
1010  }
char url[MAX_HE_ENTRY_LENGTH]
Definition: fehelp.cc:48
return P p
Definition: myNF.cc:203
#define SINGULAR_VERSION
Definition: mod2.h:92
static char * feResource(feResourceConfig config, int warn)
Definition: feResource.cc:258
const char * action
Definition: fehelp.cc:62
#define WarnS
Definition: emacs.cc:81
poly pp
Definition: myNF.cc:296
char node[MAX_HE_ENTRY_LENGTH]
Definition: fehelp.cc:47
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:284
#define NULL
Definition: omList.c:10
static heBrowser_s * heHelpBrowsers
Definition: fehelp.cc:96
#define MAX_SYSCMD_LEN
Definition: fehelp.cc:822

§ heGenInit()

static BOOLEAN heGenInit ( int  warn,
int  br 
)
static

Definition at line 823 of file fehelp.cc.

824 {
825  if (heHelpBrowsers[br].required==NULL) return TRUE;
826  const char *p=heHelpBrowsers[br].required;
827  while (*p>'\0')
828  {
829  switch (*p)
830  {
831  case '#': break;
832  case ' ': break;
833  case 'i': /* singular.hlp */
834  case 'x': /* singular.idx */
835  case 'h': /* html dir */
836  if (feResource(*p, warn) == NULL)
837  {
838  if (warn) Warn("resource `%c` not found",*p);
839  return FALSE;
840  }
841  break;
842  case 'D': /* DISPLAY */
843  if (getenv("DISPLAY") == NULL)
844  {
845  if (warn) WarnS("resource `D` not found");
846  return FALSE;
847  }
848  break;
849  case 'E': /* executable: E:xterm: */
850  case 'O': /* OS: O:ix86Mac-darwin/ppcMac-darwin: */
851  {
852  char name[128];
853  char exec[128];
854  char op=*p;
855  memset(name,0,128);
856  int i=0;
857  p++;
858  while (((*p==':')||(*p<=' ')) && (*p!='\0')) p++;
859  while((i<127) && (*p>' ') && (*p!=':'))
860  {
861  name[i]=*p; p++; i++;
862  }
863  if (i==0) return FALSE;
864 
865  if ((op=='O') && (strcmp(name,S_UNAME)!=0))
866  return FALSE;
867  if ((op=='E') && (omFindExec(name,exec)==NULL))
868  {
869  if (warn) Warn("executable `%s` not found",name);
870  return FALSE;
871  }
872  }
873  break;
874  default: Warn("unknown char %c",*p);
875  break;
876  }
877  p++;
878  }
879  return TRUE;
880 }
#define FALSE
Definition: auxiliary.h:95
return P p
Definition: myNF.cc:203
static char * feResource(feResourceConfig config, int warn)
Definition: feResource.cc:258
const char * required
Definition: fehelp.cc:61
char * getenv()
#define TRUE
Definition: auxiliary.h:99
#define WarnS
Definition: emacs.cc:81
int i
Definition: cfEzgcd.cc:123
char name(const Variable &v)
Definition: factory.h:178
#define NULL
Definition: omList.c:10
static heBrowser_s * heHelpBrowsers
Definition: fehelp.cc:96
char * omFindExec(const char *name, char *exec)
Definition: omFindExec.c:251
#define Warn
Definition: emacs.cc:80

§ heKey2Entry()

static BOOLEAN heKey2Entry ( char *  filename,
char *  key,
heEntry  hentry 
)
static

Definition at line 399 of file fehelp.cc.

400 {
401  FILE* fd;
402  int c, k;
403  int kl, i;
404  *(hentry->key) = '\0';
405  *(hentry->url) = '\0';
406  *(hentry->node) = '\0';
407  hentry->chksum = 0;
408  if (filename == NULL || key == NULL) return FALSE;
409  fd = fopen(filename, "r");
410  if (fd == NULL) return FALSE;
411  kl = strlen(key);
412 
413  k = key[0];
414  i = 0;
415  while ((c = getc(fd)) != EOF)
416  {
417  if (c < k)
418  {
419  /* Skip line */
420  while (getc(fd) != '\n') {};
421  if (i)
422  {
423  i=0;
424  k=key[0];
425  }
426  }
427  else if (c == k)
428  {
429  i++;
430  if (i == kl)
431  {
432  // \t must follow, otherwise only substring match
433  if (getc(fd) != '\t') goto Failure;
434 
435  // Now we found an exact match
436  if (hentry->key != key) strcpy(hentry->key, key);
437  // get node
438  i = 0;
439  while ((c = getc(fd)) != '\t' && c != EOF)
440  {
441  hentry->node[i] = c;
442  i++;
443  }
444  if (c == EOF) goto Failure;
445  if (hentry->node[0]=='\0')
446  strcpy(hentry->node,hentry->key);
447 
448  // get url
449  //hentry->node[i] = '\0';
450  i = 0;
451  while ((c = getc(fd)) != '\t' && c != EOF)
452  {
453  hentry->url[i] = c;
454  i++;
455  }
456  if (c == EOF) goto Failure;
457 
458  // get chksum
459  hentry->url[i] = '\0';
460 
461  if (si_fscanf(fd, "%ld\n", &(hentry->chksum)) != 1)
462  {
463  hentry->chksum = -1;
464  }
465  fclose(fd);
466  return TRUE;
467  }
468  else if (i > kl)
469  {
470  goto Failure;
471  }
472  else
473  {
474  k = key[i];
475  }
476  }
477  else
478  {
479  goto Failure;
480  }
481  }
482  Failure:
483  fclose(fd);
484  return FALSE;
485 }
int status int fd
Definition: si_signals.h:59
char url[MAX_HE_ENTRY_LENGTH]
Definition: fehelp.cc:48
long chksum
Definition: fehelp.cc:49
#define FALSE
Definition: auxiliary.h:95
#define TRUE
Definition: auxiliary.h:99
char key[MAX_HE_ENTRY_LENGTH]
Definition: fehelp.cc:46
int k
Definition: cfEzgcd.cc:93
char node[MAX_HE_ENTRY_LENGTH]
Definition: fehelp.cc:47
int i
Definition: cfEzgcd.cc:123
#define NULL
Definition: omList.c:10

§ heKeyChksum()

static long heKeyChksum ( char *  key)
static

Definition at line 760 of file fehelp.cc.

761 {
762  if (key == NULL || *key == '\0') return 0;
763  idhdl h=IDROOT->get(key,myynest);
764  if ((h!=NULL) && (IDTYP(h)==PROC_CMD))
765  {
766  procinfo *pi = IDPROC(h);
767  if (pi != NULL) return pi->data.s.help_chksum;
768  }
769  return 0;
770 }
#define IDROOT
Definition: ipid.h:20
Definition: idrec.h:34
int myynest
Definition: febase.cc:46
#define IDTYP(a)
Definition: ipid.h:116
procinfodata data
Definition: subexpr.h:62
#define IDPROC(a)
Definition: ipid.h:137
#define pi
Definition: libparse.cc:1143
#define NULL
Definition: omList.c:10
static Poly * h
Definition: janet.cc:978

§ heOnlineHelp()

static BOOLEAN heOnlineHelp ( char *  s)
static

Definition at line 632 of file fehelp.cc.

633 {
634  char *ss;
635  idhdl h;
636 
637  if ((ss=strstr(s,"::"))!=NULL)
638  {
639  *ss='\0';
640  ss+=2;
641  h=ggetid(s);
642  if (h!=NULL)
643  {
644  Print("help for %s from package %s\n",ss,s);
645  char s_help[200];
646  strcpy(s_help,ss);
647  strcat(s_help,"_help");
648  idhdl hh=IDPACKAGE(h)->idroot->get(s_help,0);
649  hePrintHelpStr(hh,s_help,s);
650  return TRUE;
651  }
652  else Print("package %s not found\n",s);
653  return TRUE; /* do not search the manual */
654  }
655  h=IDROOT->get(s,myynest);
656  // try help for a procedure
657  if (h!=NULL)
658  {
659  if (IDTYP(h)==PROC_CMD)
660  {
661  char *lib=iiGetLibName(IDPROC(h));
662  if((lib!=NULL)&&(*lib!='\0'))
663  {
664  Print("// proc %s from lib %s\n",s,lib);
665  procinfov pi=IDPROC(h);
666  if (pi->language==LANG_SINGULAR)
667  {
668  s=iiGetLibProcBuffer(pi, 0);
669  if (s!=NULL)
670  {
671  PrintS(s);
672  omFree((ADDRESS)s);
673  }
674  return TRUE;
675  }
676  }
677  }
678  else if (IDTYP(h)==PACKAGE_CMD)
679  {
680  idhdl hh=IDPACKAGE(h)->idroot->get("info",0);
681  hePrintHelpStr(hh,"info",s);
682  return TRUE;
683  }
684  return FALSE;
685  }
686 
687  // try help for a library
688  int ls = strlen(s);
689  char* str = NULL;
690  // check that it ends with "[.,_]lib"
691  if (strlen(s) >=4 && strcmp(&s[ls-3], "lib") == 0)
692  {
693  if (s[ls - 4] == '.') str = s;
694  else
695  {
696  str = omStrDup(s);
697  str[ls - 4] = '.';
698  }
699  }
700  else
701  {
702  return FALSE;
703  }
704 
705  char libnamebuf[128];
706  FILE *fp=NULL;
707  // first, search for library of that name
708  if ((str[1]!='\0') &&
709  ((iiLocateLib(str, libnamebuf) && (fp=feFopen(libnamebuf, "rb")) !=NULL)
710  ||
711  ((fp=feFopen(str,"rb", libnamebuf))!=NULL)))
712  {
713  extern FILE *yylpin;
714  lib_style_types lib_style; // = OLD_LIBSTYLE;
715 
716  yylpin = fp;
717  yylplex(str, libnamebuf, &lib_style, IDROOT, FALSE, GET_INFO);
718  reinit_yylp();
719  if(lib_style == OLD_LIBSTYLE)
720  {
721  char buf[256];
722  fseek(fp, 0, SEEK_SET);
723  Warn( "library %s has an old format. Please fix it for the next time",
724  str);
725  if (str != s) omFree(str);
727  while (fgets( buf, sizeof(buf), fp))
728  {
729  if (strncmp(buf,"//",2)==0)
730  {
731  if (found) return TRUE;
732  }
733  else if ((strncmp(buf,"proc ",5)==0)||(strncmp(buf,"LIB ",4)==0))
734  {
735  if (!found) WarnS("no help part in library found");
736  return TRUE;
737  }
738  else
739  {
740  found=TRUE;
741  PrintS(buf);
742  }
743  }
744  }
745  else
746  {
747  if (str != s) omFree(str);
748  fclose( yylpin );
752  }
753  return TRUE;
754  }
755 
756  if (str != s) omFree(str);
757  return FALSE;
758 }
const CanonicalForm int s
Definition: facAbsFact.cc:55
CanonicalForm fp
Definition: cfModGcd.cc:4043
int yylplex(const char *libname, const char *libfile, lib_style_types *lib_style, idhdl pl, BOOLEAN autoexport=FALSE, lp_modes=LOAD_LIB)
#define FALSE
Definition: auxiliary.h:95
language_defs language
Definition: subexpr.h:58
#define IDROOT
Definition: ipid.h:20
#define TRUE
Definition: auxiliary.h:99
void * ADDRESS
Definition: auxiliary.h:116
#define WarnS
Definition: emacs.cc:81
Definition: idrec.h:34
bool found
Definition: facFactorize.cc:56
#define IDPACKAGE(a)
Definition: ipid.h:136
int myynest
Definition: febase.cc:46
#define IDTYP(a)
Definition: ipid.h:116
#define omFree(addr)
Definition: omAllocDecl.h:261
Print("running `%s`\, sys)
int status int void * buf
Definition: si_signals.h:59
FILE * feFopen(const char *path, const char *mode, char *where, short useWerror, short path_only)
Definition: feFopen.cc:47
void PrintS(const char *s)
Definition: reporter.cc:284
static void hePrintHelpStr(const idhdl hh, const char *id, const char *pa)
Definition: fehelp.cc:619
BOOLEAN iiLocateLib(const char *lib, char *where)
Definition: iplib.cc:704
#define IDPROC(a)
Definition: ipid.h:137
#define pi
Definition: libparse.cc:1143
#define NULL
Definition: omList.c:10
char * text_buffer
Definition: libparse.cc:1097
lib_style_types
Definition: libparse.h:9
char * iiGetLibName(procinfov pi)
Definition: iplib.cc:101
char libnamebuf[128]
Definition: libparse.cc:1096
#define SEEK_SET
Definition: mod2.h:123
char * iiGetLibProcBuffer(procinfo *pi, int part)
Definition: iplib.cc:210
static Poly * h
Definition: janet.cc:978
int BOOLEAN
Definition: auxiliary.h:86
idhdl ggetid(const char *n, BOOLEAN, idhdl *packhdl)
Definition: ipid.cc:498
#define Warn
Definition: emacs.cc:80
void reinit_yylp()
Definition: libparse.cc:3374
#define omStrDup(s)
Definition: omAllocDecl.h:263

§ hePrintHelpStr()

static void hePrintHelpStr ( const idhdl  hh,
const char *  id,
const char *  pa 
)
static

Definition at line 619 of file fehelp.cc.

620 {
621  if ((hh!=NULL) && (IDTYP(hh)==STRING_CMD))
622  {
623  PrintS(IDSTRING(hh));
624  PrintLn();
625  }
626  else
627  Print("`%s` not found in package %s\n",id,pa);
628 }
void PrintLn()
Definition: reporter.cc:310
#define IDTYP(a)
Definition: ipid.h:116
Print("running `%s`\, sys)
#define IDSTRING(a)
Definition: ipid.h:133
void PrintS(const char *s)
Definition: reporter.cc:284
#define NULL
Definition: omList.c:10

§ heReKey2Entry()

static int heReKey2Entry ( char *  filename,
char *  key,
heEntry  hentry 
)
static

Definition at line 579 of file fehelp.cc.

580 {
581  int i = 0;
582  FILE* fd;
583  char index_key[MAX_HE_ENTRY_LENGTH];
584 
585  if (filename == NULL || key == NULL) return 0;
586  fd = fopen(filename, "r");
587  if (fd == NULL) return 0;
588  memset(index_key,0,MAX_HE_ENTRY_LENGTH);
589  while (si_fscanf(fd, "%[^\t]\t%*[^\n]\n", index_key) == 1)
590  {
591  if ((index_key[MAX_HE_ENTRY_LENGTH-1]!='\0'))
592  {
593  index_key[MAX_HE_ENTRY_LENGTH-1]='\0';
594  Werror("index file corrupt at line >>%s<<",index_key);
595  break;
596  }
597  else if (strmatch(index_key, key))
598  {
599  i++;
600  if (i == 1)
601  {
602  heKey2Entry(filename, index_key, hentry);
603  }
604  else if (i == 2)
605  {
606  StringAppend("?%s; ?%s;", hentry->key, index_key);
607  }
608  else
609  {
610  StringAppend(" ?%s;", index_key);
611  }
612  }
613  }
614  fclose(fd);
615  return i;
616 }
int status int fd
Definition: si_signals.h:59
#define MAX_HE_ENTRY_LENGTH
Definition: fehelp.cc:43
char key[MAX_HE_ENTRY_LENGTH]
Definition: fehelp.cc:46
static BOOLEAN heKey2Entry(char *filename, char *key, heEntry hentry)
Definition: fehelp.cc:399
#define StringAppend
Definition: emacs.cc:82
int i
Definition: cfEzgcd.cc:123
#define NULL
Definition: omList.c:10
static BOOLEAN strmatch(char *s, char *re)
Definition: fehelp.cc:491
void Werror(const char *fmt,...)
Definition: reporter.cc:189

§ Print()

Print ( "running `%s`\  ,
sys   
)

§ show()

static int show ( unsigned long  offset,
char *  close 
)
static

Definition at line 1065 of file fehelp.cc.

1066 { char buffer[BUF_LEN+1];
1067  int lines = 0;
1068  FILE * help;
1069 
1070  if( (help = fopen(feResource('i'), "rb")) == NULL)
1071  return HELP_NOT_OPEN;
1072 
1073  fseek(help, (long)(offset+1), (int)0);
1074  while( (!feof(help))
1075  && (*fgets(buffer, BUF_LEN, help) != EOF)
1076  && (buffer[0] != FIN_INDEX))
1077  {
1078  printf("%s", buffer);
1079  if(lines++> MAX_LINES)
1080  {
1081  printf("\n Press <RETURN> to continue or x to exit help.\n");
1082  fflush(stdout);
1083  *close = (char)getchar();
1084  if(*close=='x')
1085  {
1086  getchar();
1087  break;
1088  }
1089  lines=0;
1090  }
1091  }
1092  if(*close!='x')
1093  {
1094  printf("\nEnd of part. Press <RETURN> to continue or x to exit help.\n");
1095  fflush(stdout);
1096  *close = (char)getchar();
1097  if(*close=='x')
1098  getchar();
1099  }
1100  fclose(help);
1101  return HELP_OK;
1102 }
static char * feResource(feResourceConfig config, int warn)
Definition: feResource.cc:258
char buffer[1024]
Definition: run.c:54
#define MAX_LINES
Definition: fehelp.cc:1056
#define HELP_NOT_OPEN
Definition: fehelp.cc:1052
#define FIN_INDEX
Definition: fehelp.cc:1051
#define HELP_OK
Definition: fehelp.cc:1050
int lines
Definition: checklibs.c:11
#define help
Definition: libparse.cc:1228
#define NULL
Definition: omList.c:10
int offset
Definition: libparse.cc:1091
#define BUF_LEN
Definition: fehelp.cc:1054

§ singular_manual()

static int singular_manual ( char *  str,
BOOLEAN  isIndexEntry 
)
static

Definition at line 1105 of file fehelp.cc.

1106 { FILE *index=NULL;
1107  unsigned long offset;
1108  char *p,close=' ';
1109  int done = 0;
1110  char buffer[BUF_LEN+1],
1111  Index[IDX_LEN+1],
1112  String[IDX_LEN+1];
1113  Print("HELP >>%s>>\n",str);
1114 
1115  if( (index = fopen(feResource('i'), "rb")) == NULL)
1116  {
1117  return HELP_NOT_OPEN;
1118  }
1119 
1120  if (!isIndexEntry)
1121  {
1122  for(p=str; *p; p++) *p = tolow(*p);/* */
1123  do
1124  {
1125  p--;
1126  }
1127  while ((p != str) && (*p<=' '));
1128  p++;
1129  *p='\0';
1130  (void)sprintf(String, " %s ", str);
1131  }
1132  else
1133  {
1134  (void)sprintf(String, " %s", str);
1135  }
1136 
1137  while(!feof(index)
1138  && (fgets(buffer, BUF_LEN, index) != (char *)0)
1139  && (buffer[0] != FIN_INDEX));
1140 
1141  while(!feof(index))
1142  {
1143  if (fgets(buffer, BUF_LEN, index)==NULL) break; /*fill buffer */
1144  if (si_sscanf(buffer, "Node:%[^\177]\177%ld\n", Index, &offset)!=2)
1145  continue;
1146  if (!isIndexEntry)
1147  {
1148  for(p=Index; *p; p++) *p = tolow(*p);/* */
1149  (void)strcat(Index, " ");
1150  if( strstr(Index, String)!=NULL)
1151  {
1152  done++; (void)show(offset, &close);
1153  }
1154  }
1155  else if( strcmp(Index, String)==0)
1156  {
1157  done++; (void)show(offset, &close);
1158  break;
1159  }
1160  Index[0]='\0';
1161  if(close=='x')
1162  break;
1163  }
1164  if (index != NULL) (void)fclose(index);
1165  if(done==0)
1166  {
1167  Warn("`%s` not found",String);
1168  return HELP_NOT_FOUND;
1169  }
1170  return HELP_OK;
1171 }
return P p
Definition: myNF.cc:203
static char * feResource(feResourceConfig config, int warn)
Definition: feResource.cc:258
static int show(unsigned long offset, char *close)
Definition: fehelp.cc:1065
#define HELP_NOT_FOUND
Definition: fehelp.cc:1053
char buffer[1024]
Definition: run.c:54
#define HELP_NOT_OPEN
Definition: fehelp.cc:1052
Print("running `%s`\, sys)
#define FIN_INDEX
Definition: fehelp.cc:1051
#define HELP_OK
Definition: fehelp.cc:1050
static int index(p_Length length, p_Ord ord)
Definition: p_Procs_Impl.h:592
#define NULL
Definition: omList.c:10
#define IDX_LEN
Definition: fehelp.cc:1055
static char tolow(char p)
Definition: fehelp.cc:1058
int offset
Definition: libparse.cc:1091
#define BUF_LEN
Definition: fehelp.cc:1054
#define Warn
Definition: emacs.cc:80

§ strclean()

static char * strclean ( char *  str)
static

Definition at line 375 of file fehelp.cc.

376 {
377  if (str == NULL) return NULL;
378  char *s=str;
379  while ((*s <= ' ') && (*s != '\0')) s++;
380  if (*s == '\0') return NULL;
381  char *ss=s;
382  while (*ss!='\0') ss++;
383  ss--;
384  while ((*ss <= ' ') && (*ss != '\0'))
385  {
386  *ss='\0';
387  ss--;
388  }
389  if (*ss == '\0') return NULL;
390  return s;
391 }
const CanonicalForm int s
Definition: facAbsFact.cc:55
#define NULL
Definition: omList.c:10

§ strmatch()

static BOOLEAN strmatch ( char *  s,
char *  re 
)
static

Definition at line 491 of file fehelp.cc.

492 {
493  if (s == NULL || *s == '\0')
494  return (re == NULL || *re == '\0' || strcmp(re, "*") == 0);
495  if (re == NULL || *re == '\0') return FALSE;
496 
497  int i;
498  char ls[MAX_HE_ENTRY_LENGTH + 1];
499  char rs[MAX_HE_ENTRY_LENGTH + 1];
500  char *l, *r, *ll, *rr;
501 
502  // make everything to lower case
503  i=1;
504  ls[0] = '\0';
505  do
506  {
507  if (*s >= 'A' && *s <= 'Z') ls[i] = *s + ('a' - 'A');
508  else ls[i] = *s;
509  i++;
510  s++;
511  } while (*s != '\0');
512  ls[i] = '\0';
513  l = &(ls[1]);
514 
515  i=1;
516  rs[0] = '\0';
517  do
518  {
519  if (*re >= 'A' && *re <= 'Z') rs[i]= *re + ('a' - 'A');
520  else rs[i] = *re;
521  i++;
522  re++;
523  } while (*re != '\0');
524  rs[i] = '\0';
525  r = &(rs[1]);
526 
527  // chopp of exact matches from beginning and end
528  while (*r != '*' && *r != '\0' && *l != '\0')
529  {
530  if (*r != *l) return FALSE;
531  *r = '\0';
532  *s = '\0';
533  r++;
534  l++;
535  }
536  if (*r == '\0') return (*l == '\0');
537  if (*r == '*' && r[1] == '\0') return TRUE;
538  if (*l == '\0') return FALSE;
539 
540  rr = &r[strlen(r) - 1];
541  ll = &l[strlen(l) - 1];
542  while (*rr != '*' && *rr != '\0' && *ll != '\0')
543  {
544  if (*rr != *ll) return FALSE;
545  *rr = '\0';
546  *ll = '\0';
547  rr--;
548  ll--;
549  }
550  if (*rr == '\0') return (*ll == '\0');
551  if (*rr == '*' && rr[-1] == '\0') return TRUE;
552  if (*ll == '\0') return FALSE;
553 
554  // now *r starts with a * and ends with a *
555  r++;
556  *rr = '\0'; rr--;
557  while (*r != '\0')
558  {
559  rr = r + 1;
560  while (*rr != '*' && *rr != '\0') rr++;
561  if (*rr == '*')
562  {
563  *rr = '\0';
564  rr++;
565  }
566  l = strstr(l, r);
567  if (l == NULL) return FALSE;
568  r = rr;
569  }
570  return TRUE;
571 }
const CanonicalForm int s
Definition: facAbsFact.cc:55
#define FALSE
Definition: auxiliary.h:95
#define MAX_HE_ENTRY_LENGTH
Definition: fehelp.cc:43
#define TRUE
Definition: auxiliary.h:99
const ring r
Definition: syzextra.cc:208
int i
Definition: cfEzgcd.cc:123
#define NULL
Definition: omList.c:10
int l
Definition: cfEzgcd.cc:94

§ system()

void system ( sys  )

§ tolow()

static char tolow ( char  p)
inlinestatic

Definition at line 1058 of file fehelp.cc.

1059 {
1060  if (('A'<=p)&&(p<='Z')) return p | 040;
1061  return p;
1062 }
return P p
Definition: myNF.cc:203

Variable Documentation

§ feHelpCalled

BOOLEAN feHelpCalled = FALSE
static

Definition at line 778 of file fehelp.cc.

§ heCurrentHelpBrowser

heBrowser heCurrentHelpBrowser = NULL
static

Definition at line 85 of file fehelp.cc.

§ heCurrentHelpBrowserIndex

int heCurrentHelpBrowserIndex = -1
static

Definition at line 86 of file fehelp.cc.

§ heHelpBrowsers

heBrowser_s* heHelpBrowsers =NULL
static

Definition at line 96 of file fehelp.cc.