- Timestamp:
- Apr 22, 2003, 7:19:49 PM (21 years ago)
- Branches:
- (u'fieker-DuVal', '117eb8c30fc9e991c4decca4832b1d19036c4c65')(u'spielwiese', 'c5facdfddea2addfd91babd8b9019161dea4b695')
- Children:
- fd7acf827c4e50c346b4d461584b5e601fdf170f
- Parents:
- 1bc15419b6d0aab65be2263582c648990bbcdb58
- Location:
- Singular
- Files:
-
- 1 added
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Singular/fehelp.cc
r1bc154 r06929a 39 39 typedef heEntry_s * heEntry; 40 40 41 typedef void (*heBrowserHelpProc)(heEntry hentry );42 typedef BOOLEAN (*heBrowserInitProc)(int warn );41 typedef void (*heBrowserHelpProc)(heEntry hentry, int br); 42 typedef BOOLEAN (*heBrowserInitProc)(int warn, int br); 43 43 44 44 typedef struct … … 47 47 heBrowserInitProc init_proc; 48 48 heBrowserHelpProc help_proc; 49 char* required; 50 char* action; 49 51 } heBrowser_s; 50 52 typedef heBrowser_s * heBrowser; … … 64 66 65 67 // browser functions 66 static BOOLEAN heInfoInit(int); static void heInfoHelp(heEntry hentry); 67 #if ! defined(macintosh) 68 static BOOLEAN heNetscapeInit(int);static void heNetscapeHelp(heEntry hentry); 69 static BOOLEAN heXinfoInit(int); static void heXinfoHelp(heEntry hentry); 70 static BOOLEAN heTkinfoInit(int); static void heTkinfoHelp(heEntry hentry); 71 #endif 72 static BOOLEAN heBuiltinInit(int); static void heBuiltinHelp(heEntry hentry); 73 static BOOLEAN heDummyInit(int); static void heDummyHelp(heEntry hentry); 74 static BOOLEAN heEmacsInit(int); static void heEmacsHelp(heEntry hentry); 68 static BOOLEAN heGenInit(int,int); static void heGenHelp(heEntry hentry,int); 69 static void heBuiltinHelp(heEntry hentry,int); 70 static BOOLEAN heDummyInit(int,int); static void heDummyHelp(heEntry hentry,int); 71 static BOOLEAN heEmacsInit(int,int); static void heEmacsHelp(heEntry hentry,int); 75 72 76 73 #ifdef ix86_Win 77 static void heHtmlHelp(heEntry hentry );78 static void heWinHelp(heEntry hentry );74 static void heHtmlHelp(heEntry hentry,int); 75 static void heWinHelp(heEntry hentry,int); 79 76 #include "sing_win.h" 80 77 #endif 81 78 82 79 static heBrowser heCurrentHelpBrowser = NULL; 80 static int heCurrentHelpBrowserIndex= -1; 83 81 84 82 … … 89 87 *****************************************************************/ 90 88 // order is improtant -- first possible help is choosen 89 #if 1 90 static heBrowser_s *heHelpBrowsers=NULL; 91 #else 91 92 static heBrowser_s heHelpBrowsers[] = 92 93 { 93 94 #ifdef ix86_Win 94 { "html", heDummyInit, heHtmlHelp},95 { "winhlp", heDummyInit, heWinHelp},95 // { "html", heDummyInit, heHtmlHelp, NULL, NULL}, 96 // { "winhlp", heDummyInit, heWinHelp, NULL, NULL}, 96 97 #endif 97 #if ! defined(macintosh) 98 { "netscape", heNetscapeInit, heNetscapeHelp}, 99 { "tkinfo", heTkinfoInit, heTkinfoHelp}, 100 { "xinfo", heXinfoInit, heXinfoHelp}, 98 { "mozilla", heGenInit, heGenHelp, "xDhE:mozilla:", "(mozilla -remote \"openURL(%h)\")||(mozilla %h)"}, 99 { "netscape", heGenInit, heGenHelp, "xDhE:netscape:", "(netscape -remote \"openURL(%h)\")||(netscape %h)"}, 100 { "tkinfo", heGenInit, heGenHelp, "xDiE:tkinfo:", "tkinfo '(%i)%n' &"}, 101 { "xinfo", heGenInit, heGenHelp, "xDiE:xterm:E:info:", "xterm -e info -f %i --node='%n' &"}, 102 { "mac", heGenInit, heGenHelp, "xhE:open:","open %h" }, 103 { "machtml", heGenInit, heGenHelp, "xE:open:","open %H" }, 104 { "info", heGenInit, heGenHelp, "xiE:info:", "info -f %i --node='%n' &"}, 105 { "builtin", heGenInit, heBuiltinHelp, "i", NULL}, 106 { "dummy", heDummyInit, heDummyHelp, NULL, NULL}, 107 { "emacs", heEmacsInit, heEmacsHelp, NULL, NULL}, 108 { NULL, NULL, NULL, NULL, NULL} // must be the last record 109 }; 101 110 #endif 102 { "info", heInfoInit, heInfoHelp},103 { "builtin", heBuiltinInit, heBuiltinHelp},104 { "dummy", heDummyInit, heDummyHelp},105 { "emacs", heEmacsInit, heEmacsHelp},106 { NULL, NULL, NULL} // must be the last record107 };108 111 109 112 /***************************************************************** … … 117 120 if (str == NULL) {heBrowserHelp(NULL); return;} 118 121 119 BOOLEAN key_is_regexp = (strchr(str, '*') != NULL);120 #ifdef HAVE_NS121 if (!key_is_regexp)122 {123 // test for help mod::p;124 char *cc=strstr(str,"::");125 if ((cc!=NULL) && (cc!=str))126 {127 char *cc=strstr(str,"::");128 *cc='\0';129 cc+=2;130 idhdl pack=basePack->idroot->get(str,0);131 if (IDTYP(pack)==PACKAGE_CMD)132 {133 package save=currPack;134 currPack=IDPACKAGE(pack);135 BOOLEAN r=heOnlineHelp(cc);136 currPack=save;137 if (r) return;138 else139 {140 cc-=2; *cc=':';141 }142 }143 }144 }145 #endif146 122 if (strlen(str) > MAX_HE_ENTRY_LENGTH - 2) // need room for extra ** 147 123 str[MAX_HE_ENTRY_LENGTH - 3] = '\0'; 148 124 125 BOOLEAN key_is_regexp = (strchr(str, '*') != NULL); 149 126 heEntry_s hentry; 150 127 char* idxfile = feResource('x' /*"IdxFile"*/); … … 216 193 heBrowserHelp(&hentry); 217 194 } 195 static void feBrowserFile() 196 { 197 FILE *f=feFopen("help.cnf","r",NULL,TRUE); 198 int br=0; 199 if (f!=NULL) 200 { 201 char buf[512]; 202 while (fgets( buf, sizeof(buf), f)) 203 { 204 if ((buf[0]!='#') && (buf[0]>' ')) br++; 205 } 206 fseek(f,0,SEEK_SET); 207 // for the 4(!) default browsers 208 heHelpBrowsers=(heBrowser_s*)omAlloc0((br+4)*sizeof(heBrowser_s)); 209 br=0; 210 while (fgets( buf, sizeof(buf), f)) 211 { 212 if ((buf[0]!='#') && (buf[0]>' ')) 213 { 214 char *name=strtok(buf,"!"); 215 char *req=strtok(NULL,"!"); 216 char *cmd=strtok(NULL,"!"); 217 while ((cmd[0]!='\0') && (cmd[strlen(cmd)-1]<=' ')) 218 cmd[strlen(cmd)-1]='\0'; 219 //Print("name %d >>%s<<\n\treq:>>%s<<\n\tcmd:>>%s<<\n",br,name,req,cmd); 220 heHelpBrowsers[br].browser=(char *)omStrDup(name); 221 heHelpBrowsers[br].init_proc=heGenInit; 222 heHelpBrowsers[br].help_proc=heGenHelp; 223 heHelpBrowsers[br].required=omStrDup(req); 224 heHelpBrowsers[br].action=omStrDup(cmd); 225 br++; 226 } 227 } 228 fclose(f); 229 } 230 else 231 { 232 // for the 4(!) default browsers 233 heHelpBrowsers=(heBrowser_s*)omAlloc0(4*sizeof(heBrowser_s)); 234 } 235 heHelpBrowsers[br].browser="builtin"; 236 heHelpBrowsers[br].init_proc=heGenInit; 237 heHelpBrowsers[br].help_proc=heBuiltinHelp; 238 heHelpBrowsers[br].required="i"; 239 //heHelpBrowsers[br].action=NULL; 240 br++; 241 heHelpBrowsers[br].browser="dummy"; 242 heHelpBrowsers[br].init_proc=heDummyInit; 243 heHelpBrowsers[br].help_proc=heDummyHelp; 244 //heHelpBrowsers[br].required=NULL; 245 //heHelpBrowsers[br].action=NULL; 246 br++; 247 heHelpBrowsers[br].browser="emacs"; 248 heHelpBrowsers[br].init_proc=heEmacsInit; 249 heHelpBrowsers[br].help_proc=heEmacsHelp; 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 } 218 259 219 260 char* feHelpBrowser(char* which, int warn) … … 222 263 223 264 // if no argument, choose first available help browser 265 if (heHelpBrowsers==NULL) feBrowserFile(); 224 266 if (which == NULL || *which == '\0') 225 267 { … … 236 278 { 237 279 if (strcmp(heHelpBrowsers[i].browser, "emacs") == 0 && 238 (heHelpBrowsers[i].init_proc(0 )))280 (heHelpBrowsers[i].init_proc(0,i))) 239 281 { 240 282 heCurrentHelpBrowser = &(heHelpBrowsers[i]); 283 heCurrentHelpBrowserIndex=i; 241 284 goto Finish; 242 285 } … … 248 291 while (heHelpBrowsers[i].browser != NULL) 249 292 { 250 if (heHelpBrowsers[i].init_proc(0 ))293 if (heHelpBrowsers[i].init_proc(0,i)) 251 294 { 252 295 heCurrentHelpBrowser = &(heHelpBrowsers[i]); 296 heCurrentHelpBrowserIndex=i; 253 297 goto Finish; 254 298 } … … 271 315 { 272 316 // see whether we can init it 273 if (heHelpBrowsers[i].init_proc(warn ))317 if (heHelpBrowsers[i].init_proc(warn,i)) 274 318 { 275 319 heCurrentHelpBrowser = &(heHelpBrowsers[i]); 320 heCurrentHelpBrowserIndex=i; 276 321 goto Finish; 277 322 } … … 301 346 heCurrentHelpBrowser->browser) != 0) 302 347 { 303 304 feOptSpec[FE_OPT_BROWSER].value348 omfree(feOptSpec[FE_OPT_BROWSER].value); 349 feOptSpec[FE_OPT_BROWSER].value 305 350 = (void*) omStrDup(heCurrentHelpBrowser->browser); 306 351 } … … 314 359 315 360 i = 0; 361 if (heHelpBrowsers==NULL) feBrowserFile(); 316 362 while (heHelpBrowsers[i].browser != NULL) 317 363 { 318 if (heHelpBrowsers[i].init_proc(warn ))364 if (heHelpBrowsers[i].init_proc(warn,i)) 319 365 StringAppend("%s, ", heHelpBrowsers[i].browser); 320 366 i++; … … 569 615 static BOOLEAN heOnlineHelp(char* s) 570 616 { 571 idhdl h=IDROOT->get(s,myynest); 617 #ifdef HAVE_NAMESPACES 618 idhdl h, ns; 619 iiname2hdl(s, &ns, &h); 620 #else /* HAVE_NAMESPACES */ 621 idhdl h=idroot->get(s,myynest); 622 #endif /* HAVE_NAMESPACES */ 572 623 573 624 // try help for a procedure 574 625 if ((h!=NULL) && (IDTYP(h)==PROC_CMD)) 575 626 { 576 procinfo *p=IDPROC(h); 577 #ifdef HAVE_NS 578 if (p->language==LANG_SINGULAR) 579 #endif 580 { 581 char *lib=iiGetLibName(p /*IDPROC(h)*/); 582 if((lib!=NULL)&&(*lib!='\0')) 583 { 584 Print("// proc %s from lib %s\n",s,lib); 585 s=iiGetLibProcBuffer(p /*IDPROC(h)*/, 0); 586 if (s!=NULL) 587 { 588 PrintS(s); 589 omFree((ADDRESS)s); 590 } 591 return TRUE; 592 } 593 } 594 #ifdef HAVE_NS 595 else if (p->language==LANG_C) 596 { 597 Print("// c-proc %s\n",s); 627 char *lib=iiGetLibName(IDPROC(h)); 628 if((lib!=NULL)&&(*lib!='\0')) 629 { 630 Print("// proc %s from lib %s\n",s,lib); 631 s=iiGetLibProcBuffer(IDPROC(h), 0); 632 if (s!=NULL) 633 { 634 PrintS(s); 635 omFree((ADDRESS)s); 636 } 598 637 return TRUE; 599 638 } 600 #endif601 639 return FALSE; 602 640 } … … 632 670 633 671 yylpin = fp; 634 #ifdef HAVE_N S672 #ifdef HAVE_NAMESPACES 635 673 yylplex(str, libnamebuf, &lib_style, IDROOT, FALSE, GET_INFO); 636 #else /* HAVE_N S */674 #else /* HAVE_NAMESPACES */ 637 675 yylplex(str, libnamebuf, &lib_style, GET_INFO); 638 #endif /* HAVE_N S */676 #endif /* HAVE_NAMESPACES */ 639 677 reinit_yylp(); 640 678 if(lib_style == OLD_LIBSTYLE) … … 682 720 { 683 721 if (key == NULL || *key == '\0') return 0; 684 idhdl h=IDROOT->get(key,myynest); 722 #ifdef HAVE_NAMESPACES 723 idhdl h, ns; 724 iiname2hdl(key, &ns, &h); 725 #else /* HAVE_NAMESPACES */ 726 idhdl h=idroot->get(key,myynest); 727 #endif /* HAVE_NAMESPACES */ 685 728 if ((h!=NULL) && (IDTYP(h)==PROC_CMD)) 686 729 { … … 723 766 while (heHelpBrowsers[i].browser != NULL) 724 767 { 725 if (heHelpBrowsers[i].init_proc(0 ))768 if (heHelpBrowsers[i].init_proc(0,i)) 726 769 StringAppend("\"%s\", ", heHelpBrowsers[i].browser); 727 770 i++; … … 735 778 } 736 779 737 heCurrentHelpBrowser->help_proc(hentry );780 heCurrentHelpBrowser->help_proc(hentry, heCurrentHelpBrowserIndex); 738 781 feHelpCalled = TRUE; 739 782 } 740 783 741 784 #define MAX_SYSCMD_LEN MAXPATHLEN*2 742 // browser functions 743 static BOOLEAN heInfoInit(int warn) 744 { 745 if (feResource('i', warn) == NULL) 746 { 747 if (warn) WarnS("'info' help browser not available: no InfoFile"); 748 return FALSE; 749 } 750 if (feResource('I') == NULL) 751 { 752 if (warn) 753 WarnS("'info' help browser not available: no 'info' program found"); 754 return FALSE; 785 static BOOLEAN heGenInit(int warn, int br) 786 { 787 if (heHelpBrowsers[br].required==NULL) return TRUE; 788 char *p=heHelpBrowsers[br].required; 789 while (*p>'\0') 790 { 791 switch (*p) 792 { 793 case '#': break; 794 case ' ': break; 795 case 'i': /* singular.hlp */ 796 case 'x': /* singular.idx */ 797 case 'h': /* html dir */ 798 if (feResource(*p, warn) == NULL) 799 { 800 if (warn) Warn("ressource `%c` not found",*p); 801 return FALSE; 802 } 803 break; 804 case 'D': /* DISPLAY */ 805 if (getenv("DISPLAY") == NULL) 806 { 807 if (warn) WarnS("ressource `D` not found"); 808 return FALSE; 809 } 810 break; 811 case 'E': /* executable: E:xterm: */ 812 { 813 char name[128]; 814 char exec[128]; 815 memset(name,0,128); 816 int i=0; 817 p++; 818 while (((*p==':')||(*p<=' ')) && (*p!='\0')) p++; 819 while((i<127) && (*p>' ') && (*p!=':')) 820 { 821 name[i]=*p; p++; i++; 822 } 823 if (i==0) return FALSE; 824 if (omFindExec(name,exec)==NULL) 825 { 826 if (warn) Warn("executable `%s` not found",name); 827 return FALSE; 828 } 829 } 830 break; 831 default: Warn("unknown char %c",*p); 832 break; 833 } 834 p++; 755 835 } 756 836 return TRUE; 757 837 } 758 static void heInfoHelp(heEntry hentry) 759 { 760 char sys[MAX_SYSCMD_LEN]; 761 762 if (hentry != NULL && *(hentry->key) != '\0') 763 { 764 if (*(hentry->node) != '\0') 765 sprintf(sys, "%s -f %s --node='%s'", 766 feResource('I'), feResource('i'), hentry->node); 767 else 768 sprintf(sys, "%s -f %s Index '%s'", 769 feResource('I'), feResource('i'), hentry->key); 770 } 771 else 772 sprintf(sys, "%s -f %s --node=Top", feResource('I'), feResource('i')); 773 system(sys); 774 } 775 776 #if ! defined(macintosh) 777 static BOOLEAN heNetscapeInit(int warn) 778 { 779 if (feResource('N' /*"netscape"*/, warn) == NULL) 780 { 781 if (warn) WarnS("'netscape' help browser not available: no 'netscape' program found"); 782 return FALSE; 783 } 784 #ifndef ix86_Win 785 if (getenv("DISPLAY") == NULL) 786 { 787 if (warn) WarnS("'netscape' help browser not available:"); 788 if (warn) WarnS("Environment variable DISPLAY not set"); 789 return FALSE; 790 } 791 #endif 792 793 if (feResource('h' /*"HtmlDir"*/, (feOptValue(FE_OPT_ALLOW_NET)? 0 : warn)) 794 == NULL) 795 { 796 if (warn) WarnS("No local HtmlDir found."); 797 if (feOptValue(FE_OPT_ALLOW_NET)) 798 { 799 if (warn) Warn("Using URL '%s' instead.", feResource('u' /*"ManualUrl"*/, warn)); 800 } 801 else 802 return FALSE; 803 } 804 return TRUE; 805 } 806 807 static void heNetscapeHelp(heEntry hentry) 838 839 static void heGenHelp(heEntry hentry, int br) 808 840 { 809 841 char sys[MAX_SYSCMD_LEN]; 810 842 char url[MAXPATHLEN]; 811 char* htmldir = feResource('h' /*"HtmlDir"*/); 812 char* urltype; 813 814 if (htmldir == NULL) 815 { 816 urltype = ""; 817 htmldir = feResource('u' /*"ManualUrl"*/); 818 } 819 else 820 { 821 urltype = "file:"; 822 } 823 824 if (hentry != NULL && *(hentry->url) != '\0') 825 { 826 sprintf(url, "%s%s/%s", urltype, htmldir, hentry->url); 827 } 828 else 829 { 830 sprintf(url, "%s%s/index.htm", urltype, htmldir); 831 } 832 #ifndef ix86_Win 833 sprintf(sys, "%s --remote 'OpenUrl(%s)' > /dev/null 2>&1", 834 #else 835 sprintf(sys, "%s %s", 836 #endif 837 feResource('N' /*"netscape"*/), url); 838 839 // --remote exits with status != 0 if netscaep isn't already running 840 if (system(sys) != 0) 841 { 842 sprintf(sys, "%s %s &", feResource('N' /*"netscape"*/), url); 843 system(sys); 844 } 845 else 846 { 847 if (! feHelpCalled) 848 { 849 Warn("Help is displayed in already running 'netscape'."); 850 } 851 } 843 char *p=heHelpBrowsers[br].action; 844 if (p==NULL) {PrintS("no action ?\n"); return;} 845 memset(sys,0,MAX_SYSCMD_LEN); 846 int i=0; 847 while ((*p>'\0')&& (i<MAX_SYSCMD_LEN)) 848 { 849 if ((*p)=='%') 850 { 851 p++; 852 switch (*p) 853 { 854 case 'f': /* local html:file */ 855 case 'h': /* local html:URL */ 856 case 'H': /* www html */ 857 { 858 char temp[256]; 859 char *htmldir = feResource('h' /*"HtmlDir"*/); 860 if ((*p=='h')&&(htmldir!=NULL)) 861 strcat(sys,"file://localhost"); 862 else if ((*p=='H')||(htmldir==NULL)) 863 htmldir = feResource('u' /* %H -> "ManualUrl"*/); 864 /* always defined */ 865 if (hentry != NULL && *(hentry->url) != '\0') 866 #ifdef HAVE_VSNPRINTF 867 snprintf(temp,256,"%s/%s", htmldir, hentry->url); 868 else 869 snprintf(temp,256,"%s/index.htm", htmldir); 870 #else 871 sprintf(temp,"%s/%s", htmldir, hentry->url); 872 else 873 sprintf(temp,"%s/index.htm", htmldir); 874 #endif 875 strcat(sys,temp); 876 if ((*p)=='f') 877 { // remove #SEC 878 char *pp=strchr(sys,'#'); 879 if (pp!=NULL) 880 { 881 *pp='\0'; 882 i=strlen(sys); 883 memset(pp,0,MAX_SYSCMD_LEN-i); 884 } 885 } 886 i=strlen(sys); 887 break; 888 } 889 case 'i': /* singular.hlp */ 890 { 891 char *i_res=feResource('i'); 892 if (i_res!=NULL) strcat(sys,i_res); 893 else 894 { 895 WarnS("singular.hlp not found"); 896 return; 897 } 898 i=strlen(sys); 899 break; 900 } 901 case 'n': /* info node */ 902 { 903 char temp[256]; 904 if ((hentry!=NULL) && (*(hentry->node) != '\0')) 905 sprintf(temp,"%s",hentry->node); 906 //else if ((hentry!=NULL) && (hentry->key!=NULL)) 907 // sprintf(temp,"Index '%s'",hentry->key); 908 else 909 sprintf(temp,"Top"); 910 strcat(sys,temp); 911 i=strlen(sys); 912 break; 913 } 914 default: break; 915 } 916 p++; 917 } 918 else 919 { 920 sys[i]=*p; 921 p++;i++; 922 } 923 } 924 Print("running `%s`\n",sys); 925 system(sys); 852 926 } 853 927 … … 884 958 #endif 885 959 886 static BOOLEAN heXinfoInit(int warn) 887 { 888 #ifndef ix86_Win 889 if (getenv("DISPLAY") == NULL) 890 { 891 if (warn) WarnS("'xinfo' help browser not available:"); 892 if (warn) WarnS("Environment variable DISPLAY not set"); 893 return FALSE; 894 } 895 #endif 896 if (feResource('i', warn) == NULL) 897 { 898 if (warn) WarnS("'xinfo' help browser not available: no InfoFile"); 899 return FALSE; 900 } 901 if (feResource('I', warn) == NULL) 902 { 903 if (warn) WarnS("'xinfo' help browser not available: no 'info' program found"); 904 return FALSE; 905 } 906 if (feResource('X', warn) == NULL) 907 { 908 if (warn) WarnS("'xinfo' help browser not available: no 'xterm' program found"); 909 return FALSE; 910 } 960 static BOOLEAN heDummyInit(int warn, int br) 961 { 911 962 return TRUE; 912 963 } 913 static void heXinfoHelp(heEntry hentry) 914 { 915 char sys[MAX_SYSCMD_LEN]; 916 917 #ifdef ix86_Win 918 #define EXTRA_XTERM_ARGS "+vb -sb -fb Courier-bold-12 -tn linux -cr Red3" 919 #else 920 #define EXTRA_XTERM_ARGS "" 921 #endif 922 923 if (hentry != NULL && *(hentry->key) != '\0') 924 { 925 if (*(hentry->node) != '\0') 926 sprintf(sys, "%s %s -e %s -f %s --node='%s' &", 927 feResource('X'), EXTRA_XTERM_ARGS, 928 feResource('I'), feResource('i'), hentry->node); 929 else 930 sprintf(sys, "%s %s -e %s -f %s Index '%s' &", 931 feResource('X'), EXTRA_XTERM_ARGS, 932 feResource('I'), feResource('i'), hentry->key); 933 } 934 else 935 sprintf(sys, "%s %s -e %s -f %s --node=Top &", 936 feResource('X'), EXTRA_XTERM_ARGS, 937 feResource('I'), feResource('i')); 938 system(sys); 939 } 940 941 static BOOLEAN heTkinfoInit(int warn) 942 { 943 #ifndef ix86_Win 944 if (getenv("DISPLAY") == NULL) 945 { 946 if (warn) WarnS("'tkinfo' help browser not available:"); 947 if (warn) WarnS("Environment variable DISPLAY not set"); 948 return FALSE; 949 } 950 #endif 951 if (feResource('i', warn) == NULL) 952 { 953 if (warn) WarnS("'tkinfo' help browser not available: no InfoFile"); 954 return FALSE; 955 } 956 if (feResource('T', warn) == NULL) 957 { 958 if (warn) WarnS("'tkinfo' help browser not available: no 'tkinfo' program found"); 959 return FALSE; 960 } 964 static void heDummyHelp(heEntry hentry, int br) 965 { 966 Werror("No functioning help browser available."); 967 } 968 969 static BOOLEAN heEmacsInit(int warn, int br) 970 { 961 971 return TRUE; 962 972 } 963 static void heTkinfoHelp(heEntry hentry) 964 { 965 char sys[MAX_SYSCMD_LEN]; 966 if (hentry != NULL && *(hentry->node) != '\0') 967 { 968 sprintf(sys, "%s '(%s)%s' &", 969 feResource('T'), feResource('i'), hentry->node); 970 } 971 else 972 { 973 sprintf(sys, "%s %s &", 974 feResource('T'), feResource('i')); 975 } 976 system(sys); 977 } 978 #endif // ! defined(macintosh) 979 980 static BOOLEAN heDummyInit(int warn) 981 { 982 return TRUE; 983 } 984 static void heDummyHelp(heEntry hentry) 985 { 986 Werror("No functioning help browser available."); 987 } 988 989 static BOOLEAN heEmacsInit(int warn) 990 { 991 return TRUE; 992 } 993 static void heEmacsHelp(heEntry hentry) 973 static void heEmacsHelp(heEntry hentry, int br) 994 974 { 995 975 WarnS("Your help command could not be executed. Use"); … … 999 979 Warn("information on Singular running under Emacs, type C-h m."); 1000 980 } 1001 static BOOLEAN heBuiltinInit(int warn)1002 {1003 if (feResource('i', warn) == NULL)1004 {1005 if (warn) WarnS("'builtin' help browser not available: no InfoFile");1006 return FALSE;1007 }1008 return TRUE;1009 }1010 981 static int singular_manual(char *str); 1011 static void heBuiltinHelp(heEntry hentry )982 static void heBuiltinHelp(heEntry hentry, int br) 1012 983 { 1013 984 char* node = omStrDup(hentry != NULL && *(hentry->node) != '\0' ? … … 1030 1001 #define MAX_LINES 21 1031 1002 1032 #ifdef macintosh1033 static char tolow(char p)1034 #else1035 1003 static inline char tolow(char p) 1036 #endif1037 1004 { 1038 1005 if (('A'<=p)&&(p<='Z')) return p | 040; … … 1057 1024 if(lines++> MAX_LINES) 1058 1025 { 1059 #ifdef macintosh1060 printf("\n Press <RETURN> to continue or x and <RETURN> to exit help.\n");1061 #else1062 1026 printf("\n Press <RETURN> to continue or x to exit help.\n"); 1063 #endif1064 1027 fflush(stdout); 1065 1028 *close = (char)getchar(); … … 1074 1037 if(*close!='x') 1075 1038 { 1076 #ifdef macintosh1077 printf("\nEnd of part. Press <RETURN> to continue or x and <RETURN> to exit help.\n");1078 #else1079 1039 printf("\nEnd of part. Press <RETURN> to continue or x to exit help.\n"); 1080 #endif1081 1040 fflush(stdout); 1082 1041 *close = (char)getchar();
Note: See TracChangeset
for help on using the changeset viewer.