home *** CD-ROM | disk | FTP | other *** search
- export void SimpleHelp(string doc)
- {
- string docfile="Guide:AllNodes";
- int oldbuffer=GetEntryID();
- int buffer;
- string line, file;
- int start=6, stop;
- int flagcase=ReadInfo("search_case");
- int flagforw=ReadInfo("search_forward");
- int flagword=ReadInfo("search_word");
- int found=0;
-
-
- if (strlen(doc)) {
- buffer=New();
- if (buffer) {
- found=1;
- Visible(0);
- CurrentBuffer(buffer);
- Clean(joinstr("Load(\"", docfile, "\");"));
- GotoLine(1, 0);
- SetInfo(0, "search_forward", 1, "search_case", 1, "search_word", 0);
- if (Search(joinstr("\"", doc, "\""))<0) {
- if (Search(joinstr(" ", doc, " "))<0) {
- SetInfo(0, "search_word", 1);
- if (Search(doc)<0) {
- found=0;
- }
- }
- }
- if (found) {
- found=0;
- line=GetLine();
- if (line[start]=='\"')
- stop=strstr(line, "\"", ++start);
- else {
- stop=strstr(line, " ", start);
- if (stop==-1)
- stop=strstr(line, "\n", start);
- }
- if (stop) {
- line=substr(line, start, stop-start);
- SetInfo(0, "search_forward", 0, "search_word", 0);
- if (Search(":\n")>=0) {
- file=substr(GetLine(), 0, ReadInfo("byte_position"));
- System(Sprintf("run >nil: <nil: Amigaguide \"%s\" Document \"%s\" PubScreen \"%s\"", file, line, ReadInfo("current_screen")));
- ReturnStatus(Sprintf("AMIGAGUIDE \"%s\" DOCUMENT \"%s\" PUBSCREEN \"%s\"", file, line, ReadInfo("current_screen")));
- found=1;
- }
- }
- }
- CurrentBuffer(oldbuffer);
- Kill(buffer);
- SetInfo(0, "search_forward", flagforw, "search_case", flagcase, "search_word", flagword);
- }
- }
- if (!found)
- System(Sprintf("run >nil: <nil: Amigaguide FrexxEd:Docs/FrexxEd.guide PubScreen \"%s\"", ReadInfo("current_screen")));
- }
- AssignKey("SimpleHelp(GetWord());", "'Help'");
-