home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / PASCAL / PROKIT29.ZIP / CALLS.DOC < prev    next >
Encoding:
Text File  |  1989-03-01  |  9.6 KB  |  304 lines

  1.  
  2. (*
  3.  * CALLS.DOC - DOOR support functions provided by ProKIT
  4.  *
  5.  * (C) 1988 Samuel H. Smith (rev. 04-aug-88)
  6.  *
  7.  *)
  8.  
  9. procedure init;
  10. {must be first - opens com port, loads setup and user data}
  11.  
  12. procedure load_cnames_file;
  13. {make conference information available}
  14.  
  15. procedure uninit;
  16. {must be last - closes com port and updates database}
  17.  
  18. procedure close_down_door(messages: boolean);
  19. {same as uninit but does not send ANY messages to the caller
  20.  if called as close_down_door(false)}
  21.  
  22.  
  23. (* ---------------------------------------------------------------- *)
  24. (* high level input and output *)
  25.  
  26. procedure disp(msg: string);
  27.    {display a string without linefeed}
  28.  
  29. procedure displn(msg: string);
  30.    {display a string and linefeed, increments linenum}
  31.  
  32. procedure newline;
  33.    {C/R and linefeed, increments linenum}
  34.  
  35.    
  36. procedure display_file(name: string);
  37.    {displays the contents of named file;
  38.     automatic "more:" prompting;
  39.     adds "g" to filename in graphics mode}
  40.  
  41. procedure display_file_raw(name: string; number_lines);
  42.    {display a file with line numbers added}
  43.  
  44.  
  45. procedure input(var line: string;       {the variable to input into}
  46.                 maxlen: integer);       {maximum length of input}
  47.    {read a line of input with the specified length; echo to screen;
  48.     leaves cursor after the last key typed before C/R;
  49.     automatic check for time-left and carrier loss - sets dump_user}
  50.  
  51. procedure get_cmdline;      
  52.    {calls 'input' to read into 'cmdline', maps to upper case}
  53.  
  54. procedure get_nextpar;      
  55.    {scan next param from 'cmdline' into 'par'}
  56.  
  57. procedure wait_for_enter;   
  58.    {prompt "Press (enter) to continue: " only in novice mode}
  59.  
  60. procedure force_enter;
  61.    {prompt "Press (enter) to continue: "}
  62.  
  63. procedure position(x,y: byte);
  64.    {position cursor; graphics mode only}
  65.  
  66. procedure clear_screen;
  67.    {ease screen in current color; graphics mode only}
  68.  
  69. procedure clear_eol;
  70.    {clear to end of line; graphics mode only}
  71.  
  72.  
  73.  
  74. (* ---------------------------------------------------------------- *)
  75. (* high-level command-line input and prompt handlers *)
  76.  
  77. procedure get_cmdline_raw(prelength: integer);
  78.    {get a command line; prelength=0 for normal prompts.
  79.     if prelength > 0 then the user input and a prompt of prelength
  80.     characters will be erased from the screen after the input}
  81.  
  82. procedure prompt_def(prompt: string80; default: string80);
  83.    {display a prompt with a default value; example:
  84.         prompt_def('File to open:','(Enter)=none? ');}
  85.  
  86. procedure get_def(prompt: string80; default: string80);
  87.    {get input after displaying a prompt with a default}
  88.  
  89. procedure get_defn(prompt: string80; default: string80);
  90.    {same as get_def but appends '(Enter)=none?' to the end of the default}
  91.  
  92. procedure get_defen(prompt: string80);
  93.    {same as get_def but the default is always '(Enter)=none?'}
  94.  
  95. procedure get_defyn(prompt: string80; default: boolean);
  96.    {get input with yes/no default based on boolean value}
  97.  
  98.  
  99.  
  100. (* ---------------------------------------------------------------- *)
  101. (* low level input and output *)
  102.  
  103. function nomore: boolean;      
  104.    {prompts "more?" when needed, 
  105.     returns TRUE if user answers 'no' or uses ^K}
  106.  
  107. procedure display_file_raw(name: string; remove_semicolons);
  108.    {display a file with semicolons in column 1 changed to spaces (script0)}
  109.  
  110. procedure display_file_raw(name: string; remove_paths);
  111.    {display a file with all drive and directory names excluded}
  112.  
  113. procedure display_file_raw(name: string; dir_colorize);
  114.    {display a DIR file with automatic colorization}
  115.  
  116.  
  117. function get_key: char;        
  118.    {wait for single key; no echo}
  119.  
  120. function key_ready: boolean;
  121.    {is a key waiting (local or remote)}
  122.  
  123. function time_key(ms: real): char;
  124.    {wait for a key; returns chr(0) if no key is pressed with
  125.     'ms' thousandths of a second}
  126.  
  127.  
  128. procedure check_carrier_loss;   
  129.    {set dump_user and print msg on carrier loss}
  130.  
  131. function carrier_present: boolean;
  132.    {returns TRUE only if carrier is present}
  133.  
  134. procedure transmit_data(s:    string);
  135.    {send a string to the modem without echo to the local display}
  136.  
  137. procedure flush_com;
  138.    {wait for all requested output to be sent to the modem}
  139.  
  140. procedure lower_dtr;
  141.    {force the modem to hang-up}
  142.  
  143. procedure raise_dtr;
  144.    {allow the modem to operate again}
  145.  
  146. procedure force_offhook;
  147.    {hang up and then place the  modem off-hook}
  148.  
  149.  
  150. procedure line_input(var line: string;     {read input into this variable}
  151.                      maxlen:   integer;    {maximum length of input}
  152.                      echo:     boolean;    {echo to screen? dots if false}
  153.                      autocr:   boolean);   {automatic C/R when full?}
  154.    {line input with full control}
  155.  
  156. function scan_nextpar(var cmdline: string): string;
  157.    {scan a string and return the next ";" or " " delimited parameter;
  158.     removes the param from the input string; used in command stacking}
  159.  
  160. procedure popup_prompt(prompt: string; var answer: string);
  161.    {prompt for input; erase prompt afterwards}
  162.  
  163.  
  164. (* ---------------------------------------------------------------- *)
  165. (* color control *)
  166.  
  167. function BLUE:    string;
  168. function CYAN:    string;      {output ansi color codes}
  169. function GRAY:    string;      {return null strings in non-graphic mode}
  170. function GREEN:   string;
  171. function GREY:    string;
  172. function MAGENTA: string;
  173. function RED:     string;
  174. function WHITE:   string;
  175. function YELLOW:  string;
  176.  
  177. procedure load_color_constants(name: string);  
  178.    {load a new set of color constants from a PROCOLOR style data file}
  179.  
  180. procedure default_color;
  181.    {change display to the default color (as defined in pcbsetup)}
  182.  
  183.  
  184. (* ---------------------------------------------------------------- *)
  185. (* pcboard information functions *)
  186.  
  187. function expert:   boolean;        {expert flag set?}
  188. function graphics: boolean;        {ansi graphics flag set?}
  189. function local:    boolean;        {local mode?, no com port}
  190.  
  191.  
  192. function minutes_left: integer;
  193.    {minutes left before automatic logoff}
  194.  
  195. function time_used: integer;       
  196.    {minutes used since login}
  197.  
  198. procedure adjust_time_allowed(seconds: real);
  199.    {add or subtract online time}
  200.  
  201. procedure check_time_left;
  202.    {print a message and set dump_user if time has run out}
  203.  
  204. procedure display_time(true);
  205.    {display (xxxx used, xxxx left)}
  206.  
  207. procedure display_time(false);
  208.    {display (xxxx left)}
  209.  
  210.  
  211. function conference_name: string;      
  212.    {example: 'Main Board' or 'xxxx Conference'}
  213.  
  214. function download_k_allowed: real;
  215.    {how many K bytes are left for downloading?}
  216.  
  217.  
  218. function event_run_needed(event_now): boolean;
  219.    {will event be started immediately if the caller logs off right now?}
  220.  
  221. function event_run_needed(event_possible): boolean;
  222.    {will the event be due if the caller uses all available time}
  223.  
  224. function minutes_before_event: integer;
  225.    {how many minutes before the event is to be started?}
  226.  
  227.  
  228. function verify_level(func: char): boolean;       
  229.    {example:  verify_level('D') = true 
  230.     if pcboard 'D' command is allowed;
  231.     logs security violation if not}
  232.    
  233. procedure make_log_entry (entry: string;        {message to log}
  234.                           echo: boolean);       {also display if true}
  235.    {make an entry in caller log; 
  236.     also echo to screen if second param is TRUE}
  237.  
  238. procedure chat_mode;
  239.    {activate sysop-chat mode}
  240.  
  241. procedure operator_page;
  242.    {page sysop and possibly enter chat mode}
  243.  
  244.  
  245.  
  246. (* ---------------------------------------------------------------- *)
  247. (* utilities *)
  248.  
  249. procedure replace_string( var line: string; oldstr, newstr: string);
  250.    {scans line and replaces all occurences of 'oldstr' with 'newstr'}
  251.  
  252. procedure stoupper(var st: string);  
  253.    {map string to all upper case}
  254.  
  255. procedure strip_trailing(var s: string);
  256.    {remove trailing spaces from a string variable}
  257.  
  258. function get_environment_var(id: string): string;
  259.    {returns the value of an envionment variable;
  260.     example: get_environment_var('PATH=') returns "C:\;C:\BATCH..."}
  261.  
  262.  
  263. function get_time: real;  
  264.    {returns the time of day in seconds since midnight}
  265.  
  266. function todays_date_mmddyy: string8;   {format: mmddyy}
  267. function todays_date_yymmdd: string8;   {format: yymmdd}
  268. function system_date: string;           {format: mm-dd-yy}
  269. function system_time: string;           {format: hh:mm}
  270.  
  271. function expdate(yymmdd: string): string;
  272.    {convert mmddyy to mm-dd-yy}
  273. function mmddyy_to_yymmdd(mmddyy: string8): string8;
  274.    {convert mmddyy to yymmdd}
  275. function yymmdd_to_mmddyy(yymmdd: string8): string8;
  276.    {convert yymmdd to mmddyy}
  277.  
  278.  
  279.  
  280. (* ---------------------------------------------------------------- *)
  281. (* data type conversion *)
  282.  
  283. function wtoa(w:   word):    string;   {word to ascii}
  284. function ltoa(int: longint): string;   {longint to ascii}
  285. function itoa(int: integer): string;   {integer to ascii}
  286.  
  287. function atof(asc: string):  real;     {ascii to float}
  288. function atoi(asc: string):  integer;  {ascii to integer}
  289. function atol(asc: string):  longint;  {ascii to longint}
  290. function atow(asc: string):  word;     {ascii to word}
  291.  
  292.  
  293. function ftoa(f: real; width,dec: integer): string;
  294.    {convert pascal floating to string with specified width and decimal places}
  295.  
  296. function stof(B: single): real; {convert 4 byte single (basic format) to real}
  297. function dtof(B: double): real; {convert 8 byte double (basic format) to real}
  298. procedure ftod(PasReal: real; var B: double); {convert real to 8 byte double}
  299. procedure ftos(PasReal: real; var B: single); {convert real to 4 byte single}
  300.  
  301. function stoa(s: single): string;       {convert single to ascii}
  302. function stol(s: single): longint;      {convert single to longint}
  303.  
  304.