29#define MAX_HE_ENTRY_LENGTH 160 
  102  memset(&hentry,0,
sizeof(hentry));
 
  106  if (!key_is_regexp && (idxfile != 
NULL) && 
heKey2Entry(idxfile, str, &hentry))
 
  136        strcpy(mkey + 1, str);
 
  144        Warn(
"No help for topic '%s' (not even for '*%s*')", str, str);
 
  145        WarnS(
"Try '?;'       for general help");
 
  146        WarnS(
"or  '?Index;'  for all available help topics.");
 
  159      Warn(
"No unique help for '%s'", str);
 
  161      Warn(
"No help for topic '%s'", str);
 
  171  strcpy(hentry.
key, str);
 
  184    while (fgets( 
buf, 
sizeof(
buf), 
f))
 
  186      if ((
buf[0]!=
'#') && (
buf[0]>
' ')) br++;
 
  192    while (fgets( 
buf, 
sizeof(
buf), 
f))
 
  194      if ((
buf[0]!=
'#') && (
buf[0]>
' '))
 
  197        char *req=strtok(
NULL,
"!");
 
  198        char *cmd=strtok(
NULL,
"!");
 
  201          while ((cmd[0]!=
'\0') && (cmd[strlen(cmd)-1]<=
' '))
 
  202            cmd[strlen(cmd)-1]=
'\0';
 
  213          Print(
"syntax error in help.cnf, at line starting with %s\n",
buf);
 
  255  if (which == 
NULL || *which == 
'\0')
 
  298    if (warn) 
Warn(
"No help browser '%s' available.", which);
 
  331      strcmp((
char*) 
feOptSpec[FE_OPT_BROWSER].value,
 
  368  while ((*
s <= 
' ') && (*
s != 
'\0')) 
s++;
 
  369  if (*
s == 
'\0') 
return NULL;
 
  371  while (*ss!=
'\0') ss++;
 
  373  while ((*ss <= 
' ') && (*ss != 
'\0'))
 
  378  if (*ss == 
'\0') 
return NULL;
 
  393  *(hentry->
key) = 
'\0';
 
  394  *(hentry->
url) = 
'\0';
 
  395  *(hentry->
node) = 
'\0';
 
  398  fd = fopen(filename, 
"r");
 
  404  while ((c = getc(
fd)) != EOF)
 
  409      while (getc(
fd) != 
'\n') {};
 
  422        if (getc(
fd) != 
'\t') 
goto Failure;
 
  425        if (hentry->
key != key) strcpy(hentry->
key, key);
 
  428        while ((c = getc(
fd)) != 
'\t' && c != EOF)
 
  433        if (c == EOF) 
goto Failure;
 
  434        if (hentry->
node[0]==
'\0')
 
  435          strcpy(hentry->
node,hentry->
key);
 
  440        while ((c = getc(
fd)) != 
'\t' && c != EOF)
 
  445        if (c == EOF) 
goto Failure;
 
  448        hentry->
url[
i] = 
'\0';
 
  450        if (si_fscanf(
fd, 
"%ld\n", &(hentry->
chksum)) != 1)
 
  482  if (
s == 
NULL || *
s == 
'\0')
 
  483    return (re == 
NULL || *re == 
'\0' || strcmp(re, 
"*") == 0);
 
  484  if (re == 
NULL || *re == 
'\0') 
return FALSE;
 
  489  char *
l, *r, *ll, *rr;
 
  496    if (*
s >= 
'A' && *
s <= 
'Z') ls[
i] = *
s + (
'a' - 
'A');
 
  500  } 
while (*
s != 
'\0');
 
  508    if (*re >= 
'A' && *re <= 
'Z') rs[
i]= *re + (
'a' - 
'A');
 
  512  } 
while (*re != 
'\0');
 
  517  while (*r != 
'*' && *r != 
'\0' && *
l != 
'\0')
 
  519    if (*r != *
l) 
return FALSE;
 
  525  if (*r == 
'\0') 
return (*
l == 
'\0');
 
  526  if (*r == 
'*' && r[1] == 
'\0') 
return TRUE;
 
  527  if (*
l == 
'\0') 
return FALSE;
 
  529  rr = &r[strlen(r) - 1];
 
  530  ll = &
l[strlen(
l) - 1];
 
  531  while (*rr != 
'*' && *rr != 
'\0' && *ll != 
'\0')
 
  533    if (*rr != *ll) 
return FALSE;
 
  539  if (*rr == 
'\0') 
return (*ll == 
'\0');
 
  540  if (*rr == 
'*' && rr[-1] == 
'\0') 
return TRUE;
 
  541  if (*ll == 
'\0') 
return FALSE;
 
  549    while (*rr != 
'*' && *rr != 
'\0') rr++;
 
  574  if (filename == 
NULL || key == 
NULL)  
return 0;
 
  575  fd = fopen(filename, 
"r");
 
  578  while (si_fscanf(
fd, 
"%[^\t]\t%*[^\n]\n", index_key) == 1)
 
  583      Werror(
"index file corrupt at line >>%s<<",index_key);
 
  616    Print(
"`%s` not found in package %s\n",
id,
pa);
 
  626  if ((ss=strstr(
s,
"::"))!=
NULL)
 
  633      Print(
"help for %s from package %s\n",ss,
s);
 
  636      strcat(s_help,
"_help");
 
  641    else Print(
"package %s not found\n",
s);
 
  651      if((lib!=
NULL)&&(*lib!=
'\0'))
 
  653        Print(
"// proc %s from lib %s\n",
s,lib);
 
  680  if (strlen(
s) >=4 &&  strcmp(&
s[ls-3], 
"lib") == 0)
 
  682    if (
s[ls - 4] == 
'.') str = 
s;
 
  697  if ((str[1]!=
'\0') &&
 
  712      Warn( 
"library %s has an old format. Please fix it for the next time",
 
  716      while (fgets( 
buf, 
sizeof(
buf), 
fp))
 
  718        if (strncmp(
buf,
"//",2)==0)
 
  722        else if ((strncmp(
buf,
"proc ",5)==0)||(strncmp(
buf,
"LIB ",4)==0))
 
  724          if (!
found) 
WarnS(
"no help part in library found");
 
  751  if (key == 
NULL || *key == 
'\0') 
return 0;
 
  756    if (
pi != 
NULL) 
return pi->data.s.help_chksum;
 
  772  int kchksum = (hentry != 
NULL && hentry->
chksum > 0 ?
 
  787    WarnS(
"Use 'system(\"--browser\", <browser>);' to change browser,");
 
  798    if (browsers[strlen(browsers)-2] == 
',')
 
  800      browsers[strlen(browsers)-2] = 
'.';
 
  801      browsers[strlen(browsers)-1] = 
'\0';
 
  811#define MAX_SYSCMD_LEN MAXPATHLEN*2 
  827                 if (warn) 
Warn(
"resource `%c` not found",*
p);
 
  834                 if (warn) 
WarnS(
"resource `D` not found");
 
  847                 while (((*
p==
':')||(*
p<=
' ')) && (*
p!=
'\0')) 
p++;
 
  848                 while((
i<127) && (*
p>
' ') && (*
p!=
':'))
 
  854                 if ((op==
'O') && (strcmp(
name,S_UNAME)!=0))
 
  858                   if (warn) 
Warn(
"executable `%s` not found",
name);
 
  863      default: 
Warn(
"unknown char %c",*
p);
 
  891                   if ((*
p==
'h')&&(htmldir!=
NULL))
 
  892                     strcat(sys,
"file://localhost");
 
  893                   else if ((*
p==
'H')||(htmldir==
NULL))
 
  896                   if (hentry != 
NULL && *(hentry->
url) != 
'\0')
 
  897                   #ifdef HAVE_VSNPRINTF 
  901                       snprintf(temp,256,
"%s/%d-%d/%s", htmldir,
 
  905                       snprintf(temp,256,
"%s/%d-%d-%d/%s", htmldir,
 
  912                       snprintf(temp,256,
"%s/%s", htmldir, hentry->
url);
 
  918                       snprintf(temp,256,
"%s/%d-%d/index.htm", htmldir,
 
  923                       snprintf(temp,256,
"%s/%d-%d-%d/index.htm", htmldir,
 
  930                       snprintf(temp,256,
"%s/index.htm", htmldir);
 
  936                       sprintf(temp,
"%s/%d-%d/%s", htmldir,
 
  941                       sprintf(temp,
"%s/%s", htmldir, hentry->
url);
 
  943                       sprintf(temp,
"%s/%d-%d-%d/%s", htmldir,
 
  949                       sprintf(temp,
"%s/%s", htmldir, hentry->
url);
 
  955                       sprintf(temp,
"%s/%d-%d/index.htm", htmldir,
 
  960                       sprintf(temp,
"%s/%d-%d-%d/index.htm", htmldir,
 
  967                       sprintf(temp,
"%s/index.htm", htmldir);
 
  973                     char *
pp=(
char *)strchr(sys,
'#');
 
  987                   if (i_res!=
NULL) strcat(sys,i_res);
 
  990                     WarnS(
"singular.info not found");
 
  999                   if ((hentry!=
NULL) && (*(hentry->
node) != 
'\0'))
 
 1000                     sprintf(temp,
"%s",hentry->
node);
 
 1004                     sprintf(temp,
"Top");
 
 1039  WerrorS(
"No functioning help browser available.");
 
 1048  WarnS(
"Your help command could not be executed. Use");
 
 1050       (hentry != 
NULL && *(hentry->
node) != 
'\0' ? hentry->
node : 
"Top"));
 
 1051  WarnS(
"to enter the Singular online help. For general");
 
 1052  WarnS(
"information on Singular running under Emacs, type C-h m.");
 
 1058                       hentry->
key : 
"Top");
 
 1069#define FIN_INDEX    '\037' 
 1070#define HELP_NOT_OPEN  1 
 1071#define HELP_NOT_FOUND 2 
 1077  if ((
'A'<=
p)&&(
p<=
'Z')) 
return p | 040;
 
 1091  while( (!feof(
help))
 
 1095    printf(
"%s", buffer);
 
 1098      printf(
"\n Press <RETURN> to continue or x to exit help.\n");
 
 1100      *close = (char)getchar();
 
 1111    printf(
"\nEnd of part. Press <RETURN> to continue or x to exit help.\n");
 
 1113    *close = (char)getchar();
 
 1130  Print(
"HELP >>%s>>\n",str);
 
 1144    while ((
p != str) && (*
p<=
' '));
 
 1147    (void)sprintf(String, 
" %s ", str);
 
 1151    (void)sprintf(String, 
" %s", str);
 
 1157   char temp[256];temp[0]=
'\0';
 
 1159   if (hentry != 
NULL && *(hentry->
url) != 
'\0')
 
 1160   #ifdef HAVE_VSNPRINTF 
 1163     snprintf(temp,256,
"%s/%d-%d/%s", htmldir,
 
 1167     snprintf(temp,256,
"%s/%d-%d-%d/%s", htmldir,
 
 1177     sprintf(temp,
"%s/%d-%d/%s", htmldir,
 
 1181     sprintf(temp,
"%s/%d-%d-%d/%s", htmldir,
 
 1189   Print(
"url: %s\n",temp);
 
 1194    if (si_sscanf(buffer, 
"Node:%[^\177]\177%ld\n", Index, &
offset)!=2)
 
 1199      (void)strcat(Index, 
" ");
 
 1200      if( strstr(Index, String)!=
NULL)
 
 1205    else if( strcmp(Index, String)==0)
 
 1217    Warn(
"`%s` not found",String);
 
static BOOLEAN pa(leftv res, leftv args)
 
const CanonicalForm int s
 
FILE * feFopen(const char *path, const char *mode, char *where, short useWerror, short path_only)
 
void WerrorS(const char *s)
 
static void * feOptValue(feOptIndex opt)
 
EXTERN_VAR struct fe_option feOptSpec[]
 
static char * feResource(feResourceConfig config, int warn)
 
static BOOLEAN heDummyInit(int, int)
 
static void feBrowserFile()
 
static int show(unsigned long offset, char *close)
 
char url[MAX_HE_ENTRY_LENGTH]
 
void feStringAppendBrowsers(int warn)
 
EXTERN_VAR BOOLEAN FE_OPT_NO_SHELL_FLAG
 
static void hePrintHelpStr(const idhdl hh, const char *id, const char *pa)
 
static BOOLEAN heGenInit(int, int)
 
static BOOLEAN heEmacsInit(int, int)
 
STATIC_VAR heBrowser_s * heHelpBrowsers
 
static char * strclean(char *str)
 
heBrowserInitProc init_proc
 
static void heBrowserHelp(heEntry hentry)
 
BOOLEAN(* heBrowserInitProc)(int warn, int br)
 
static int heReKey2Entry(char *filename, char *key, heEntry hentry)
 
char node[MAX_HE_ENTRY_LENGTH]
 
heBrowserHelpProc help_proc
 
static void heDummyHelp(heEntry hentry, int)
 
STATIC_VAR heBrowser heCurrentHelpBrowser
 
static int singular_manual(char *str, BOOLEAN isIndexEntry, heEntry hentry)
 
STATIC_VAR BOOLEAN feHelpCalled
 
#define MAX_HE_ENTRY_LENGTH
 
char key[MAX_HE_ENTRY_LENGTH]
 
static void heEmacsHelp(heEntry hentry, int)
 
static void heBuiltinHelp(heEntry hentry, int)
 
static BOOLEAN heKey2Entry(char *filename, char *key, heEntry hentry)
 
static long heKeyChksum(char *key)
 
const char * feHelpBrowser(char *which, int warn)
 
STATIC_VAR int heCurrentHelpBrowserIndex
 
static void heGenHelp(heEntry hentry, int)
 
static BOOLEAN strmatch(char *s, char *re)
 
static char tolow(char p)
 
void(* heBrowserHelpProc)(heEntry hentry, int br)
 
static BOOLEAN heOnlineHelp(char *s)
 
idhdl ggetid(const char *n)
 
BOOLEAN iiLocateLib(const char *lib, char *where)
 
char * iiGetLibProcBuffer(procinfo *pi, int part)
 
static char * iiGetLibName(const procinfov pi)
find the library of an proc
 
VAR char libnamebuf[1024]
 
int yylplex(const char *libname, const char *libfile, lib_style_types *lib_style, idhdl pl, BOOLEAN autoexport=FALSE, lp_modes=LOAD_LIB)
 
char * omFindExec(const char *name, char *exec)
 
static int index(p_Length length, p_Ord ord)
 
void StringSetS(const char *st)
 
void StringAppendS(const char *st)
 
void PrintS(const char *s)
 
void Werror(const char *fmt,...)
 
EXTERN_VAR int pagelength
 
int status int void * buf
 
int name
New type name for int.