home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / PASCAL / ECO30603.ZIP / ECO30603.LZH / ECO_DOO2.PAS < prev    next >
Encoding:
Pascal/Delphi Source File  |  1992-08-29  |  11.0 KB  |  345 lines

  1. {
  2.     ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
  3.     ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
  4.     ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
  5.     ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
  6.     ▓▓▓▓▓▓▓▓·──                                              ──·▓▓▓▓▓▓▓▓▓▓▓
  7.     ▓▓▓▓▓▓▓▓│                                                  │░░▓▓▓▓▓▓▓▓▓
  8.     ▓▓▓▓▓▓▓▓   ECO_Door was conceived, designed and written     ░░▓▓▓▓▓▓▓▓▓
  9.     ▓▓▓▓▓▓▓▓   by Floor A.C. Naaijkens for                      ░░▓▓▓▓▓▓▓▓▓
  10.     ▓▓▓▓▓▓▓▓   UltiHouse Software / The ECO Group.              ░░▓▓▓▓▓▓▓▓▓
  11.     ▓▓▓▓▓▓▓▓                                                    ░░▓▓▓▓▓▓▓▓▓
  12.     ▓▓▓▓▓▓▓▓   (C) MCMXCII by EUROCON PANATIONAL CORPORATION.   ░░▓▓▓▓▓▓▓▓▓
  13.     ▓▓▓▓▓▓▓▓   All Rights Reserved for The ECO Group.           ░░▓▓▓▓▓▓▓▓▓
  14.     ▓▓▓▓▓▓▓▓                                                    ░░▓▓▓▓▓▓▓▓▓
  15.     ▓▓▓▓▓▓▓▓   ECO_Door interfaces between Fossil, RA/Quick     ░░▓▓▓▓▓▓▓▓▓
  16.     ▓▓▓▓▓▓▓▓   and Turbo Pascal User                            ░░▓▓▓▓▓▓▓▓▓
  17.     ▓▓▓▓▓▓▓▓│                                                  │░░▓▓▓▓▓▓▓▓▓
  18.     ▓▓▓▓▓▓▓▓·──                                              ──·░░▓▓▓▓▓▓▓▓▓
  19.     ▓▓▓▓▓▓▓▓▓▓░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░▓▓▓▓▓▓▓▓▓
  20.     ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
  21.     ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
  22.     ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
  23.     ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
  24. }
  25. {$I-}
  26. unit eco_door;
  27. interface
  28. uses
  29.   dos,      
  30.   eco_asyn, eco_ansi,
  31.   unit_fil, unit_cmd, unit_str
  32.  
  33.   ;
  34.  
  35.  
  36. const
  37.   user_ansi_possible_ : boolean = true;
  38.   ansi_possible_      : boolean = true;
  39.   user_online_        : boolean = false;
  40.  
  41.  
  42. type
  43.   sysinforec_ = record
  44.     callcount         : longint;
  45.     lastcaller        : string[35];
  46.     extraspace        : array[1..128] of byte;
  47.   end;
  48.  
  49.   timelogrec_ = record
  50.     startdate         : string[8];
  51.     busyperhour       : array [0..23] of integer;
  52.     busyperday        : array [0..6] of integer;
  53.   end;
  54.  
  55.   flagtype_      = array [1..4] of byte;
  56.  
  57.   gosubdatatype_ = array [1..20] of string[8];
  58.  
  59.   string80_ = string[80];
  60.   userrec_ = record
  61.     name_            :     string[35];
  62.     city_            :     string[25];
  63.     pwd_             :     string[15];
  64.     dataphone_,
  65.     homephone_       :     string[12];
  66.     lasttime_        :      string[5];
  67.     lastdate_        :      string[8];
  68.     attrib_          :           byte;
  69.     flags_           :      flagtype_;
  70.     credit_,
  71.     pending_,
  72.     timesposted_,
  73.     highmsgread_,
  74.     seclvl_,
  75.     times_,
  76.     ups_,
  77.     downs_,
  78.     upk_,
  79.     downk_,
  80.     todayk_,
  81.     elapsed_,
  82.     len_             :        integer;
  83.     combinedptr_     :           word;
  84.     age_             :           byte;
  85.     extraspace_      : array [1..5] of byte;
  86.   end;
  87.  
  88.   eventrec_ = record
  89.     status_          :           byte;
  90.     runtime_         :      string[5];
  91.     errorlevel_      :           byte;
  92.     days_            :           byte;
  93.     forced_          :        boolean;
  94.     lasttimerun_     :      string[8];
  95.   end;
  96.  
  97.   exitrec_ = record
  98.     baudrate_        :        integer;
  99.     sysinfo_         :    sysinforec_;
  100.     timeloginfo_     :    timelogrec_;
  101.     userinfo_        :       userrec_;
  102.     eventinfo_       :      eventrec_;
  103.     netmailentered_  :        boolean;
  104.     echomailentered_ :        boolean;
  105.     logintime_       :      string[5];
  106.     logindate_       :      string[8];
  107.     tmlimit_         :        integer;
  108.     loginsec_        :        longint;
  109.     credit_          :        longint;
  110.     userrecnum_      :        integer;
  111.     readthru_        :        integer;
  112.     pagetimes_       :        integer;
  113.     downlimit_       :        integer;
  114.     wantchat_        :        boolean;
  115.     gosublevel_      : gosubdatatype_;
  116.     menu_            :      string[8];
  117.   end;
  118.  
  119.  
  120.  
  121. var
  122.   ansi_              :        boolean;
  123.   baudstring_        :      string[6];
  124.   baud_              :           word;
  125.   parity_            :           char;
  126.   databits_          :           byte;
  127.   stopbits_          :           byte;
  128.   extendedchars_     :        boolean;
  129.   hotkeyon_          :        boolean;
  130.   hotkeypressed_     :        boolean;
  131.   inactiveval_       :           word;
  132.   local_             :        boolean;
  133.   portnum_           :           byte;
  134.   snoop_             :        boolean;
  135.   sysopfirst_        :      string80_;
  136.   sysoplast_         :      string80_;
  137.   sysopname_         :      string80_;
  138.   systemname_        :      string80_;
  139.   timeremaining_     :           word;
  140.   usercitystate_     :      string80_;
  141.   userfirst_         :      string80_;
  142.   userlast_          :      string80_;
  143.   username_          :      string80_;
  144.   usersecurity_      :           word;
  145.  
  146.  
  147.   dorinfofile_       :           text;
  148.   dorinfo_           :         string;
  149.   cmdtoken           :      _cmdtoken;
  150.   cmdtext, cmdvalue  :         string;
  151.   retoption, error   :           word;
  152.   comm_port_         :           byte;
  153.  
  154.  
  155.  
  156. function  homeclreol_: ansi_seq_;
  157. procedure delline_;
  158. procedure backspace_;
  159. function  carrier_: boolean;
  160. procedure write_  (st: string);
  161. procedure writeln_(st: string);
  162. procedure showfile_(fl: string);
  163.  
  164.  
  165.  
  166. implementation
  167. var
  168.   receivedch_ :    char;
  169.   st          :  string;
  170.   i           : integer;
  171.   succes      : boolean;
  172.  
  173.  
  174.  
  175. function homeclreol_: ansi_seq_;
  176. begin
  177.   homeclreol_ := left_cursor_(80) + clreol_;
  178. end;
  179.  
  180.  
  181. procedure delline_;
  182. begin
  183.   if ansi_possible_ then write(output,homeclreol_);
  184.   if user_online_ and user_ansi_possible_ then begin
  185.     comwrite_(comm_port_,homeclreol_);
  186.   end else if user_online_ then comwrite_(comm_port_,replicate(80,#12));
  187. end;
  188.  
  189.  
  190.  
  191. procedure backspace_;
  192. begin
  193.   if ansi_possible_ then begin
  194.     write(output,left_cursor_(1)); write(' '); write(output,left_cursor_(1));
  195.   end;
  196.   if user_online_ and user_ansi_possible_ then begin
  197.     comwrite_(comm_port_,left_cursor_(1) + ' ' + left_cursor_(1));
  198.   end else if user_online_ then comwrite_(comm_port_,#12);
  199. end;
  200.  
  201.  
  202.  
  203. function carrier_: boolean;
  204. begin
  205.   carrier_ := dcdstat_(comm_port_);
  206. end;
  207.  
  208.  
  209.  
  210. procedure write_(st: string);
  211. begin
  212.   write(output,st);
  213.   if user_online_ then comwrite_(comm_port_,st);
  214. end;
  215.  
  216.  
  217. procedure writeln_(st: string);
  218. begin
  219.   writeln(output,st);
  220.   if user_online_ then comwrite_(comm_port_,st+#10+#13);
  221. end;
  222.  
  223.  
  224. procedure showfile_(fl: string);
  225. var showf: text;
  226.     st: string;
  227. begin
  228.   if __existfil(fexpand(fl)) then begin
  229.     assign(showf, fexpand(fl)); reset(showf);
  230.     while not(eof(showf)) do begin
  231.       readln(showf,st); writeln_(st);
  232.     end;
  233.     close(showf);
  234.   end else begin write_(#7); write_('■ Error 2; File not found.'); end;
  235. end;
  236.  
  237.  
  238.  
  239. var
  240.   tm: integer;
  241.  
  242. begin
  243.   write_(clrscr_);
  244.   if paramstr(1)='/?' then begin
  245.     writeln('■ This program has been compiled using FastDoor');
  246.     writeln('  FastDoor has a fixed commandline readout, use a CFG file');
  247.     writeln('  to control other options you want to include, besides the');
  248.     writeln('  following overrides (one letter is enough, so /P n works) :');
  249.     writeln;
  250.     writeln(' /PORT n');
  251.     writeln(' /BAUD n');
  252.     writeln(' /DATABITS n');
  253.     writeln(' /STOPBITS n');
  254.     writeln(' /WORDPARITY x');
  255.     writeln(' /USERINFO file (override from DORINFO1.DEF)');
  256.     writeln(' /OVERRIDEANSI  [T{RUE}|F{ALSE}]');
  257.     writeln('___________________________________________________');
  258.   end;
  259.   { by using ECO_ansi, all input/output is done using std i/o }
  260.   comm_port_ := 3;                        (* default com port                *)
  261.   dorinfo_ := fexpand('DORINFO1.DEF');    (* dorinfo file, may be overridden *)
  262.  
  263.   if __existfil(dorinfo_) then begin
  264.     assign(dorinfofile_, dorinfo_); reset(dorinfofile_);
  265.     readln(dorinfofile_, systemname_);
  266.     readln(dorinfofile_, sysopfirst_);
  267.     readln(dorinfofile_, sysoplast_);
  268.     readln(dorinfofile_, st);
  269.     portnum_ := str_to_int(st[4]);
  270.     readln(dorinfofile_,st);
  271.     i := 1; while st[i]<>' ' do inc(i);
  272.     baud_ := str_to_int(copy(st,1,i-1));
  273.     while st[i]<>',' do inc(i);
  274.     parity_ := st[i+1];
  275.     databits_ := str_to_int(st[i+3]);
  276.     stopbits_ := str_to_int(st[i+5]);
  277.     readln(dorinfofile_, st);
  278.     readln(dorinfofile_, userfirst_);
  279.     readln(dorinfofile_, userlast_);
  280.     readln(dorinfofile_, usercitystate_);
  281.     readln(dorinfofile_, st);
  282.     if st[1]='0' then user_ansi_possible_ := false;
  283.     readln(dorinfofile_, st);
  284.     usersecurity_ := str_to_int(st);
  285.     readln(dorinfofile_, st);
  286.     timeremaining_ := str_to_int(st);
  287.     close(dorinfofile_);
  288.   end else begin
  289.     writeln('■ Error 2 reading file ',fexpand(dorinfo_));
  290.     halt(2);
  291.   end;
  292.  
  293.  
  294.   { get overriding parameters }
  295.   initcmd;
  296.   __parsecmd(_commandline, _cmdreset, 0, cmdtoken, cmdtext,
  297.              @cmdvalue,    retoption, error);
  298.   repeat
  299.     __parsecmd(_commandline, _cmdnext,  0, cmdtoken, cmdtext,
  300.                @cmdvalue,    retoption, error);
  301.     if error=0 then
  302.       case cmdtoken._cmdindex of
  303.         1: begin writeln(cmdvalue); comm_port_ := str_to_int(cmdvalue) end;
  304.         2: baud_     := str_to_int(cmdvalue);
  305.         3: databits_ := str_to_int(cmdvalue);
  306.         4: stopbits_ := str_to_int(cmdvalue);
  307.         5: parity_   := cmdvalue[1];
  308.         6: dorinfo_  := cmdvalue;
  309.         7: if upcase(cmdvalue[1])='T' then user_ansi_possible_ := true else
  310.                                            user_ansi_possible_ := false;
  311.       end else if error <> _complete_cmd then begin
  312.         writeln('■ Error 153; Bad command line option: ',cmdtext); halt(153)
  313.       end;
  314.   until error = _complete_cmd; __zapwdcmd; { no heap neaded for cmds }
  315.  
  316.   writeln('■ User info succesfully read. FastDoor set up.');
  317.   writeln('■ Installing internal COMport handler. accesses the hardware directly.');
  318.   writeln('■ FastPort will be set to H/W-port (0=COM1) ',comm_port_-1,
  319.           ' with the following parameters:');
  320.   writeln('  COM',comm_port_,', at ',baud_,' baud, with ',databits_,
  321.           ' Databits, ',stopbits_,' Stopbits and Parity = ',parity_);
  322.  
  323.   if dcdstat_(comm_port_) then user_online_ := true else begin
  324.     sound(500); delay(100); nosound;
  325.     write_(colormode_(reverse_, f_black_, b_white_));
  326.     write_('■ No user online! ');
  327.     write_(colormode_(normal_, f_white_, b_black_));
  328.     write_(''); writeln_('');
  329.   end;
  330.  
  331.   if not reopencom_(comm_port_,2400,2400) then begin
  332.     writeln('■ Error 162: Hardware failure. Modem COM params could not be set.');
  333.     closecom_(comm_port_); halt(162);
  334.   end else begin
  335.     writeln('■ Re-opened, setting params now..');
  336.     {comparams_(comm_port_, baud_, databits_, parity_, stopbits_)
  337.      tijdelijk uit, is niet nodig??}
  338.   end;
  339.  
  340.   clearcom_(comm_port_, 'B');
  341.   if dsrstat_(comm_port_) then writeln('■ Data Set Ready.') else
  342.                                writeln('■ Data Set Not Ready');
  343.  
  344. end.
  345.