home *** CD-ROM | disk | FTP | other *** search
/ Il CD di internet / CD.iso / SOURCE / AP / JED / JED097-1.TAR / jed / lib / jedhelp.sl < prev    next >
Encoding:
Text File  |  1994-12-12  |  1.4 KB  |  64 lines

  1. %
  2. %  This is supposed to be an easy to use help facility
  3. %
  4.  
  5. $1 = " *EZhelp*";
  6.  
  7. !if (keymap_p($1))
  8. {
  9.    make_keymap($1);
  10.    definekey("page_up",        "^?", $1);
  11.    definekey("page_up",        "u", $1);
  12.    definekey("page_up",        "U", $1);
  13.    definekey("page_down",    " ", $1);
  14.    definekey("page_down",    "d", $1);
  15.    definekey("page_down",    "D", $1);
  16.    definekey("search_forward",    "S", $1);
  17.    definekey("search_forward",    "F", $1);
  18.    definekey("search_forward",    "f", $1);
  19.    definekey("search_forward",    "s", $1);
  20.    definekey("search_backward",    "b", $1);
  21.    definekey("search_backward",    "B", $1);
  22.    definekey("ezhelp_quit",    "q", $1);
  23.    definekey("ezhelp_quit",    "Q", $1);
  24. }
  25.  
  26. variable EZhelp_Last_Buffer;
  27.  
  28. define ezhelp_quit()
  29. {
  30.    sw2buf(EZhelp_Last_Buffer);
  31. }
  32.  
  33. define jed_easy_help(file)
  34. {
  35.    variable c, hlpbuf, hlpfile, err, flags, dir;
  36.    hlpbuf = " *EZhelp*";
  37.    !if (strcmp(hlpbuf, whatbuf())) return;
  38.    EZhelp_Last_Buffer = whatbuf();
  39.    err = strcat("Help file not found: ", file);
  40.    ERROR_BLOCK 
  41.      {
  42.     ezhelp_quit();
  43.      }
  44.    
  45.    sw2buf(hlpbuf);
  46.    getbuf_info(); =flags; =hlpbuf; =dir; =hlpfile();
  47.    
  48.    if (strcmp(hlpfile, file))
  49.      {
  50.     hlpfile = expand_jedlib_file(file);
  51.     !if (strlen(hlpfile)) error(err);
  52.     erase_buffer();
  53.     set_readonly(0);
  54.     if (insert_file(hlpfile) <= 0) error(err);
  55.     setbuf_info(file, dir, hlpbuf, flags);
  56.     bob();
  57.     set_readonly(1);
  58.      }
  59.    use_keymap(hlpbuf);
  60.    set_status_line(" u:Page Up, d:Page Down, s:Search, q:Quit Help  (%p)", 0);
  61. }
  62.  
  63.  
  64.