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

  1. % Interface to VMS Help
  2.  
  3. variable VMSHelp_Topic_Len = 0;
  4. variable VMS_Help_Library = "SYS$HELP:HELPLIB.HLB"; 
  5. % change as necessary - routines work with any .HLB file.
  6.  
  7. define vms_help ()
  8. {
  9.    variable curr_buf, helptopic;
  10.    
  11.    if (VMSHelp_Topic_Len) return;
  12.  
  13.    curr_buf = whatbuf();
  14.    
  15.    ERROR_BLOCK 
  16.      {
  17.     pop_mark(0);
  18.     sw2buf(curr_buf);
  19.     VMSHelp_Topic_Len = -0;
  20.      }
  21.    
  22.  
  23.    helptopic = read_mini("VMS Help Topic:", Null_String, Null_String);
  24.    
  25.  
  26.    sw2buf ("*VMS-Help*");
  27.    % set_readonly (0);
  28.    erase_buffer ();
  29.  
  30.    push_mark();           % This mark is popped later
  31.    VMSHelp_Topic_Len = -1;
  32.    vms_get_help (VMS_Help_Library, helptopic);
  33.    
  34.    EXECUTE_ERROR_BLOCK;
  35. }
  36.  
  37. variable VMSHelp_This_Topic = Null_String;
  38. define vms_help_grab_topic ()
  39. {
  40.    variable word = "-/_@=:0-9a-zA-Z\277-\326\330-\336\340-\366\370-\376";
  41.    bskip_chars (word);
  42.    push_mark();
  43.    skip_chars (word);
  44.    VMSHelp_This_Topic = bufsubstr ();
  45.    strlen (VMSHelp_This_Topic);
  46. }
  47.  
  48. define vms_help_newtopic (prompt)
  49. {
  50.    variable use_call, fun, ch, topic, msg;
  51.    setbuf ("*VMS-Help*");
  52.    pop_mark(1);
  53.    % set_readonly (1);
  54.    
  55.    VMSHelp_This_Topic = Null_String;
  56.    if (VMSHelp_Topic_Len)
  57.      {
  58.     msg = Sprintf("Hit RET for '%s', PgDn/PgUp,  ", prompt, 1);
  59.     recenter (1);
  60.     forever 
  61.       {
  62.          ERROR_BLOCK
  63.            {
  64.           _clear_error ();
  65.            }
  66.          
  67.          message (msg);
  68.          update (1);
  69.          
  70.          ch = getkey ();
  71.          if (ch == '\r') break;
  72.          if (ch == '.')
  73.            {
  74.           if (vms_help_grab_topic ()) break;
  75.           continue;
  76.            }
  77.          
  78.          if (ch == 127)
  79.            {
  80.           use_call = 1;
  81.           fun = "page_up";
  82.            }
  83.          else 
  84.            {
  85.           ungetkey (ch);
  86.           fun = get_key_function (); =use_call;
  87.            }
  88.          
  89.          !if (strcmp(fun, "self_insert_cmd")) 
  90.            {
  91.           if (ch == ' ') fun = "page_down"; 
  92.           else
  93.             {
  94.                ungetkey(ch);
  95.                break;
  96.             }
  97.            }
  98.          
  99.          if (use_call) call (fun); else eval (fun);
  100.       }
  101.      }
  102.    
  103.    re_fsearch ("^[\t ]*\\cAdditional information available:"); pop();
  104.    topic = strtrim(read_mini(prompt, VMSHelp_This_Topic, Null_String));
  105.    % set_readonly (0);
  106.  
  107.    VMSHelp_Topic_Len = strlen (topic);
  108.    if (VMSHelp_Topic_Len) eob();
  109.    push_mark();
  110.    topic;
  111. }
  112.  
  113.  
  114.