OpenBCM V1.07b12 (Linux)

Packet Radio Mailbox

DB0FHN

[JN59NK Nuernberg]

 Login: GUEST





  
PB0AFK > TSTH     26.04.99 14:17l 288 Lines 5428 Bytes #999 (0) @ WW
BID : 24841-PB0AFK
Read: GUEST
Subj: Pascal-unit for TSTHOST
Path: OE1XAB<OE3XSR<OK0PPR<OK0PKL<DB0MAK<DB0ERF<DB0HSK<DB0SHG<DB0SM<PI8DAZ<
      PI8GCB<PI8WFL<PI8VNW
Sent: 990426/1007Z @:PI8VNW.#ZH2.NLD.EU #:64598 [HvHolland] FBB7.00g $:24841-PB
From: PB0AFK@PI8VNW.#ZH2.NLD.EU
To  : TSTH@WW



Pascal Unit (Source) Contains some routines to handle the records
(message record, userrecord and the IRQ-record) of the TSTHOST packet radio
program. Freeware by Hugo Visser.

Pascal Unit for TSTHOST PG's

If you make additions to this unit, please send me
a copy and state your modifications/additions in the source code. 
Ofcourse you also can contact me if you have a question about the unit.

Here are my adresses:

By E-Mail:

hvisser@cs.vu.nl          


{$A+,B+,D+,E-,F-,G-,I-,L+,N-,O-,R-,S-,V-,X-}

unit TSTUNIT;

interface

Type

{Pascal definition TDms}

TDms   = Record
	 mtype:Char;
	 Status:char;
	 number:longint;
	 Da_year:integer;
	 Da_day:byte;
	 Da_mon:byte;
	 ti_min: byte;
	 ti_hour:byte;
	 ti_hund:byte;
	 ti_sec: byte;
	 tocall:array [1..7] of char;
	 route:array [1..7] of char;
	 from:array[1..7] of char;
	 title:array [1..61] of char;
	 frombbs:char;
	 startbbs:array [1..7] of char;
	 bid:array [1..13] of char;
	 rcvbbs:array [1..7] of char;
	 free:array[1..4] of char;
	 end; {TDms}

(*
How to use this record ?
It's very simple.
You must open the TSTHOST.DMS file as a file of TDms.

Example:

Program ReadDms;

Uses Dos;

Var
Dms:Tdms;
D:file of Tdms;

Begin
	Assign(D,'TSTHOST.DMS');
	Reset(D);
	if IOresult <> 0 then Halt(1);
	writeln('Total messages in TSTHOST.DMS: ',filesize(D));
	Read(d,dms);
	If d.mtype = 'P' then ...

etc.
*)



{--- TSTHOST IRQ RECORD. ----}
{Start of PASCAL definition: TTstIrq}

Ttstirq = record
	  THVH,
	  THVL           : Byte;
	  Maxchannel     : Integer;
	  DrvType        : Byte;
	  Port           : Byte;
	  Baudrate       : Integer;
	  IntNo          : Integer;
	  TsthostCall    : Array[1.. 10] of Char;
	  UListEnable    : Byte;
	  WPath          : Array[1.. 81] of Char;
	  UPath          : Array[1..101] of Char;
	  HomeBBS        : Array[1.. 10] of Char;
	  HomeAlias      : Array[1.. 10] of Char;
	  ChStatus       : integer;
	  SuppCall       : Array[1..10] of Char;
	  UserCall       : Array[1..10] of Char;
	  UIName         : Array[1.. 13] of Char;
	  UILastConnTime : Longint;
	  UILastMsgList  : Longint;
	  UINbrConn      : Longint;
	  ThisConnTime   : Longint;
	  SysFlag        : Integer;
	  end; {TTstIrq}

(*
How to use this record ?
Use the 'GetTSTInfo' procedure to read the info in this record.

Example:

Program TSTIRQ;

Uses TSTUNIT;

var
Info:TTstIrq;
Channel:byte;

Begin
	channel:=Autodetect;
	GetTSTinfo(info,Channel,paramstr(1));
	....

Then your info will be in INFO.
*)

TUser   = Record
	  Call:array [1..7] of char;
	  Name:array [1..13] of char;
	  Lastcontime:longint;
	  Lastmsglist:longint;
	  NbrCon:longint;
	  Thiscontime:longint;
	  Privdir:array [1..31] of char;
	  Reserved:array [1..61] of char;
	  end;

(*
Usage for this record: same as TDms
*)

{Pointer for IRQ}

P_IRQ = ^Ttstirq;

const

IRQ:Byte = 0; {TSTHOST IRQ initial value}
IRQfn:string = 'TSTHOST.IRQ'; {Default TSTHOST IRQ file}
MaxCh:byte = 0; {Maximum channels initial value}
Autodetect = 0; {Value for use with Getinfo}


Function NullTerm(s:string):String;
Procedure GetTSTIrq;
Procedure GetTSTMaxCh;
Procedure GetTSTInfo(var I:Ttstirq;var chan:byte;call:string);

implementation

uses Dos;

Function Nullterm(s:string):string; {Convert Null-terminated strings
				     This only works with strings, so
				     the size shouldn't be longer then
				     255 bytes.
				     This routine is allright for use
				     with the TSTHOST records...}

Begin
	if pos(#0,s)>0 then s:=copy(s,1,pos(#0,s)-1);
	Nullterm:=s;
end;

Procedure GetTSTIrq; {Get the Irqvector from TSTHOST.IRQ}

var

T:Text;
L:String[80];
i:integer;

Begin
     IRQ:=0;
     
     (*
     If file not found (TSTHOST not active) the IRQ will be 0.
     If your program isn't in the TSTHOST dir, you must change the
     'IrqFn' and then call this procedure.
     *)
     
     {$I-}
     Assign(t,irqfn);
     reset(t);
     if ioresult<>0 then exit;
     {$I+}
     Readln(t,l);
     close(t);
     delete(l,1,pos('=',l));
     val(l,irq,i);
     if i<>0 then exit;
end;


Procedure GetTSTMaxCh; {Gets the maximum channels and puts it in MaxCh}

var

r:registers;

Begin
     Maxch:=0;
     if irq=0 then exit;
     r.al:=0;
     r.ah:=0;
     intr(irq,r);
     if r.ah=0 then Maxch:=r.al;
end;

Procedure GetTSTInfo(Var I:Ttstirq;var chan:byte;call:string);

(*
IRQ routine.
Gets the info from the TSTHOST IRQ-vector.
If 'Chan' = Autodetect (0) and a callsign is set then 'Chan' will contain
the channel where 'callsign' is connected.
This is a great option for PG programs, because the callsign is the
first argument that TSTHOST passes to the program (PARAMSTR(1)).
So you could use a line like this:

GetTSTInfo(Info,Chan,Paramstr(1));

And then you would know the users name, call, sysflag etc...

In case of an error the THVL and THVH will be 0.

*)

var

r:registers;
t:integer;
P:P_irq;

label pushinfo;

begin
     if (chan=autodetect) and (call<>'') then begin
	if irq=0 then begin
	   i.THVL:=0;
	   i.THVH:=0;
	   exit;
	end;
	r.ah:=0;
	r.al:=0;
	intr(irq,r);
	if r.ah=0 then begin
	   Maxch:=r.al;
	   P:=ptr(r.es,r.bx);
	end;
	for t:=1 to maxch do begin
	    r.ah:=0;
	    r.al:=t;
	    intr(irq,r);
	    if nullterm(p^.usercall)=call then begin
	       chan:=t;
	       goto pushinfo;
	    end;
	end;
     end;
pushinfo:
	r.ah:=0;
	r.al:=chan;
	intr(irq,r);
	i:=p^;
end;

Begin
     GetTSTIrq;
     GetTSTMaxCh;
end.


Read previous mail | Read next mail


 31.12.2025 12:39:52lGo back Go up