home *** CD-ROM | disk | FTP | other *** search
- extern char *tk[500];
- extern char inbuff[300];
- extern char tkbuff[500];
- extern char space_str[3];
- extern int ntk;
-
- do_help(char *hstr)
- {
- char ss[90];
- strcpy(ss,"gle graph ");
- strcat(ss,hstr);
- do_help2(ss);
- }
- do_help2(char *hstr)
- {
- FILE *hfile;
- int i,yy,cp,match;
- char hbuff[90],mstr[80],mstr2[80];
- char *page;
- char h[90];
- char *hfilename="graph.hlp";
-
- page = mymallocz(sizeof(char *) * 200);
- npage = 0;
-
- strcpy(h,hstr);
- help_again:;
- token_data(h,tk,&ntk,tkbuff);
- for (i=1;i<=ntk;i++) strlwr(tk[i]);
-
- scr_menuval();
- clrscr();
-
- if (*tk[2] == 'd' && strlen(tk[2])==2) tk[2] = "dn";
- if (strcmp(tk[3],"yaxis")==0) tk[3] = "xaxis";
- if (strcmp(tk[3],"y2axis")==0) tk[3] = "xaxis";
- if (strcmp(tk[3],"x2axis")==0) tk[3] = "xaxis";
- if (strcmp(tk[3],"ylabels")==0) tk[3] = "xlabels";
- if (strcmp(tk[3],"y2labels")==0) {tk[3] = "xlabels"; k2 = "off";}
- if (strcmp(tk[3],"x2labels")==0) {tk[3] = "xlabels"; k2 = "off";}
- if (strcmp(tk[3],"ynames")==0) tk[3] = "xnames";
- if (strcmp(tk[3],"y2names")==0) tk[3] = "xnames";
- if (strcmp(tk[3],"x2names")==0) tk[3] = "xnames";
- if (strcmp(tk[3],"ytitle")==0) tk[3] = "xtitle";
- if (strcmp(tk[3],"y2title")==0) tk[3] = "xtitle";
- if (strcmp(tk[3],"x2title")==0) tk[3] = "xtitle";
- if (strcmp(tk[3],"title")==0) tk[3] = "xtitle";
-
- gotoxy(1,1); wprintf("GLE help ");
- for (i=1;i<=ntk;i++) wprintf("{%s} ",tk[i]);
- scr_menubg();
- hfile = fopen(gledir(hfilename),"rt");
- if (hfile==NULL) perror("Unable to open graph.hlp ");
-
- /* Find match for each key word, display that section of file
- and find rest of key words at that level */
-
- match = 1; /* trying to match a level one word */
- for (;!feof(hfile);) {
- if (fgets(hbuff,90,hfile)!=NULL) {
- sprintf(mstr,"%d",match);
- sprintf(mstr2,"%d",match-1);
- if (match>ntk) {
- if (strncmp(hbuff,mstr2,1)==0) { /* End of section */
- goto got_help;
- }
- if (strncmp(hbuff,mstr,1)==0) { /* Sub topic */
- capture = false;
- strtok(hbuff," \h\n");
- strcat(subtopic,strtok(NULL," \h\n"));
- strcat(subtopic," ");
- }
- } else if (strncmp(hbuff,mstr,1)==0) { /* correct level */
- capture = true;
- strtok(hbuff," \h\n");
- strcpy(fk1,strtok(NULL," \h\n"));
- if (strncmp(fk1,tk[match],strlen(tk[match]))==0) {
- match++;
- }
- } else if (capture) page[npage++] = sdup(hbuff);
- }
- }
- fclose(hfile);
- scr_menuval();
- gotoxy(1,9);
- wprintf("Help text not found sorry ??? \n");
- text_inkey();
- return;
- got_help:;
-
- /* Add subtopic's onto page[npage] */
- page[npage++] = sdup("Subtopics:");
- page[npage++] = sdup(subtopic);
-
- cp = 0; /* start on first page */
- yy = cp+22;
- next_page:;
- if (yy>=npage) yy = npage;
- for (i==cp;i<yy;i++) {
- strcpy(hbuff,page[i+cp]);
- gotoxy(1,i+3); cputs(tabtospace(hbuff));
- }
- scr_menuval();
- gotoxy(1,24);
- read_command(hbuff,"Subtopic [return to continue] ");
- scr_menubg();
- strupr(hbuff);
- if (strlen(hbuff)!=0) {
- strcat(h," ");
- strcat(h,hbuff);
- goto help_again;
- }
- }
-