43 #define MAX_HE_ENTRY_LENGTH 160 111 BOOLEAN key_is_regexp = (strchr(str,
'*') !=
NULL);
115 memset(&hentry,0,
sizeof(hentry));
119 if (!key_is_regexp && (idxfile !=
NULL) &&
heKey2Entry(idxfile, str, &hentry))
149 strcpy(mkey + 1, str);
157 Warn(
"No help for topic '%s' (not even for '*%s*')", str, str);
158 WarnS(
"Try '?;' for general help");
159 WarnS(
"or '?Index;' for all available help topics.");
172 Warn(
"No unique help for '%s'", str);
174 Warn(
"No help for topic '%s'", str);
184 strcpy(hentry.
key, str);
197 while (fgets(
buf,
sizeof(
buf),
f))
199 if ((
buf[0]!=
'#') && (
buf[0]>
' ')) br++;
205 while (fgets(
buf,
sizeof(
buf),
f))
207 if ((
buf[0]!=
'#') && (
buf[0]>
' '))
210 char *req=strtok(
NULL,
"!");
211 char *cmd=strtok(
NULL,
"!");
214 while ((cmd[0]!=
'\0') && (cmd[strlen(cmd)-1]<=
' '))
215 cmd[strlen(cmd)-1]=
'\0';
226 Print(
"syntax error in help.cnf, at line starting with %s\n",
buf);
268 if (which ==
NULL || *which ==
'\0')
311 if (warn)
Warn(
"No help browser '%s' available.", which);
344 strcmp((
char*)
feOptSpec[FE_OPT_BROWSER].value,
381 while ((*
s <=
' ') && (*
s !=
'\0'))
s++;
382 if (*
s ==
'\0')
return NULL;
384 while (*ss!=
'\0') ss++;
386 while ((*ss <=
' ') && (*ss !=
'\0'))
391 if (*ss ==
'\0')
return NULL;
406 *(hentry->
key) =
'\0';
407 *(hentry->
url) =
'\0';
408 *(hentry->
node) =
'\0';
411 fd = fopen(filename,
"r");
417 while ((c = getc(
fd)) != EOF)
422 while (getc(
fd) !=
'\n') {};
435 if (getc(
fd) !=
'\t')
goto Failure;
438 if (hentry->
key != key) strcpy(hentry->
key, key);
441 while ((c = getc(
fd)) !=
'\t' && c != EOF)
446 if (c == EOF)
goto Failure;
447 if (hentry->
node[0]==
'\0')
448 strcpy(hentry->
node,hentry->
key);
453 while ((c = getc(
fd)) !=
'\t' && c != EOF)
458 if (c == EOF)
goto Failure;
461 hentry->
url[
i] =
'\0';
463 if (si_fscanf(
fd,
"%ld\n", &(hentry->
chksum)) != 1)
495 if (
s ==
NULL || *
s ==
'\0')
496 return (re ==
NULL || *re ==
'\0' || strcmp(re,
"*") == 0);
497 if (re ==
NULL || *re ==
'\0')
return FALSE;
502 char *
l, *
r, *ll, *rr;
509 if (*
s >=
'A' && *
s <=
'Z') ls[
i] = *
s + (
'a' -
'A');
513 }
while (*
s !=
'\0');
521 if (*re >=
'A' && *re <=
'Z') rs[
i]= *re + (
'a' -
'A');
525 }
while (*re !=
'\0');
530 while (*
r !=
'*' && *
r !=
'\0' && *
l !=
'\0')
538 if (*
r ==
'\0')
return (*
l ==
'\0');
539 if (*
r ==
'*' &&
r[1] ==
'\0')
return TRUE;
540 if (*
l ==
'\0')
return FALSE;
542 rr = &
r[strlen(
r) - 1];
543 ll = &
l[strlen(
l) - 1];
544 while (*rr !=
'*' && *rr !=
'\0' && *ll !=
'\0')
546 if (*rr != *ll)
return FALSE;
552 if (*rr ==
'\0')
return (*ll ==
'\0');
553 if (*rr ==
'*' && rr[-1] ==
'\0')
return TRUE;
554 if (*ll ==
'\0')
return FALSE;
562 while (*rr !=
'*' && *rr !=
'\0') rr++;
587 if (filename ==
NULL || key ==
NULL)
return 0;
588 fd = fopen(filename,
"r");
591 while (si_fscanf(
fd,
"%[^\t]\t%*[^\n]\n", index_key) == 1)
596 Werror(
"index file corrupt at line >>%s<<",index_key);
629 Print(
"`%s` not found in package %s\n",
id,pa);
639 if ((ss=strstr(
s,
"::"))!=
NULL)
646 Print(
"help for %s from package %s\n",ss,
s);
649 strcat(s_help,
"_help");
654 else Print(
"package %s not found\n",
s);
664 if((lib!=
NULL)&&(*lib!=
'\0'))
666 Print(
"// proc %s from lib %s\n",
s,lib);
693 if (strlen(
s) >=4 && strcmp(&
s[ls-3],
"lib") == 0)
695 if (
s[ls - 4] ==
'.') str =
s;
710 if ((str[1]!=
'\0') &&
725 Warn(
"library %s has an old format. Please fix it for the next time",
729 while (fgets(
buf,
sizeof(
buf),
fp))
731 if (strncmp(
buf,
"//",2)==0)
735 else if ((strncmp(
buf,
"proc ",5)==0)||(strncmp(
buf,
"LIB ",4)==0))
737 if (!
found)
WarnS(
"no help part in library found");
764 if (key ==
NULL || *key ==
'\0')
return 0;
769 if (
pi !=
NULL)
return pi->data.s.help_chksum;
785 int kchksum = (hentry !=
NULL && hentry->
chksum > 0 ?
800 Warn(
"Use 'system(\"--browser\", <browser>);' to change browser,");
811 if (browsers[strlen(browsers)-2] ==
',')
813 browsers[strlen(browsers)-2] =
'.';
814 browsers[strlen(browsers)-1] =
'\0';
824 #define MAX_SYSCMD_LEN MAXPATHLEN*2 840 if (warn)
Warn(
"resource `%c` not found",*
p);
847 if (warn)
WarnS(
"resource `D` not found");
860 while (((*
p==
':')||(*
p<=
' ')) && (*
p!=
'\0'))
p++;
861 while((
i<127) && (*
p>
' ') && (*
p!=
':'))
867 if ((op==
'O') && (strcmp(
name,S_UNAME)!=0))
871 if (warn)
Warn(
"executable `%s` not found",
name);
876 default:
Warn(
"unknown char %c",*
p);
904 if ((*
p==
'h')&&(htmldir!=
NULL))
905 strcat(sys,
"file://localhost");
906 else if ((*
p==
'H')||(htmldir==
NULL))
909 if (hentry !=
NULL && *(hentry->
url) !=
'\0')
910 #ifdef HAVE_VSNPRINTF 914 snprintf(temp,256,
"%s/%d-%d/%s", htmldir,
918 snprintf(temp,256,
"%s/%d-%d-%d/%s", htmldir,
925 snprintf(temp,256,
"%s/%s", htmldir, hentry->
url);
930 snprintf(temp,256,
"%s/%d-%d-%d/index.htm", htmldir,
936 snprintf(temp,256,
"%s/index.htm", htmldir);
941 sprintf(temp,
"%s/%d-%d-%d/%s", htmldir,
947 sprintf(temp,
"%s/%d-%d-%d/%s", htmldir, hentry->
url);
951 sprintf(temp,
"%s/%d-%d-%d/index.htm", htmldir,
957 sprintf(temp,
"%s/index.htm", htmldir);
963 char *
pp=(
char *)strchr(sys,
'#');
977 if (i_res!=
NULL) strcat(sys,i_res);
980 WarnS(
"singular.hlp not found");
989 if ((hentry!=
NULL) && (*(hentry->
node) !=
'\0'))
990 sprintf(temp,
"%s",hentry->
node);
1019 Print(
"running `%s`\n",sys);
1029 WerrorS(
"No functioning help browser available.");
1038 WarnS(
"Your help command could not be executed. Use");
1040 (hentry !=
NULL && *(hentry->
node) !=
'\0' ? hentry->
node :
"Top"));
1041 Warn(
"to enter the Singular online help. For general");
1042 Warn(
"information on Singular running under Emacs, type C-h m.");
1048 hentry->
key :
"Top");
1059 #define FIN_INDEX '\037' 1060 #define HELP_NOT_OPEN 1 1061 #define HELP_NOT_FOUND 2 1064 #define MAX_LINES 21 1068 if ((
'A'<=
p)&&(
p<=
'Z'))
return p | 040;
1082 while( (!feof(
help))
1086 printf(
"%s", buffer);
1089 printf(
"\n Press <RETURN> to continue or x to exit help.\n");
1091 *close = (char)getchar();
1102 printf(
"\nEnd of part. Press <RETURN> to continue or x to exit help.\n");
1104 *close = (char)getchar();
1121 Print(
"HELP >>%s>>\n",str);
1135 while ((
p != str) && (*
p<=
' '));
1138 (void)sprintf(String,
" %s ", str);
1142 (void)sprintf(String,
" %s", str);
1152 if (si_sscanf(buffer,
"Node:%[^\177]\177%ld\n", Index, &
offset)!=2)
1157 (void)strcat(Index,
" ");
1158 if( strstr(Index, String)!=
NULL)
1163 else if( strcmp(Index, String)==0)
1175 Warn(
"`%s` not found",String);
const char * feHelpBrowser(char *which, int warn)
char url[MAX_HE_ENTRY_LENGTH]
const CanonicalForm int s
idhdl ggetid(const char *n)
static void * feOptValue(feOptIndex opt)
int yylplex(const char *libname, const char *libfile, lib_style_types *lib_style, idhdl pl, BOOLEAN autoexport=FALSE, lp_modes=LOAD_LIB)
static int singular_manual(char *str, BOOLEAN isIndexEntry)
static BOOLEAN heOnlineHelp(char *s)
#define MAX_HE_ENTRY_LENGTH
static char * feResource(feResourceConfig config, int warn)
static BOOLEAN heEmacsInit(int, int)
static int show(unsigned long offset, char *close)
static void feBrowserFile()
static BOOLEAN feHelpCalled
heBrowserInitProc init_proc
char key[MAX_HE_ENTRY_LENGTH]
static int heReKey2Entry(char *filename, char *key, heEntry hentry)
void WerrorS(const char *s)
static void heBrowserHelp(heEntry hentry)
static void heBuiltinHelp(heEntry hentry, int)
static int heCurrentHelpBrowserIndex
void feStringAppendBrowsers(int warn)
static BOOLEAN heDummyInit(int, int)
char node[MAX_HE_ENTRY_LENGTH]
Print("running `%s`\, sys)
void StringSetS(const char *st)
int status int void * buf
void StringAppendS(const char *st)
static void heEmacsHelp(heEntry hentry, int)
struct fe_option feOptSpec[]
static BOOLEAN heKey2Entry(char *filename, char *key, heEntry hentry)
static void heDummyHelp(heEntry hentry, int)
FILE * feFopen(const char *path, const char *mode, char *where, short useWerror, short path_only)
static heBrowser heCurrentHelpBrowser
void PrintS(const char *s)
static void heGenHelp(heEntry hentry, int)
static void hePrintHelpStr(const idhdl hh, const char *id, const char *pa)
char name(const Variable &v)
BOOLEAN iiLocateLib(const char *lib, char *where)
static int index(p_Length length, p_Ord ord)
static long heKeyChksum(char *key)
BOOLEAN(* heBrowserInitProc)(int warn, int br)
void(* heBrowserHelpProc)(heEntry hentry, int br)
static heBrowser_s * heHelpBrowsers
static BOOLEAN heGenInit(int, int)
heBrowserHelpProc help_proc
static char * strclean(char *str)
char * iiGetLibName(procinfov pi)
char * omFindExec(const char *name, char *exec)
static char tolow(char p)
static BOOLEAN strmatch(char *s, char *re)
char * iiGetLibProcBuffer(procinfo *pi, int part)
void Werror(const char *fmt,...)