MODULE TrapList;

(**********************************************************************)
(*                Traplist.library support definitions                *)
(*   for use with the Oberon compiler, by Fridtjof Siebert © A+L AG   *)
(*              Done by Roger Nordin (2:203/507@fidonet)              *)
(*   Please send corrections/bug reports regarding this file to me!   *)
(*                                                                    *)
(*                   This version created 21-Sep-91                   *)
(*                                                                    *)
(*   Based on nl.h (02 Apr 1991), © Copyright by Martin J. Laubach.   *)
(**********************************************************************)

IMPORT
  e:Exec;

CONST
  traplistName * = "traplist.library";
  traplistVersion * = 4;

  verbatim     * = LONGSET{31}; (* Don't translate phone numbers, used by FindNL() *)

  parseInvalidChar   * = -1; (* Returned by NLParseAddr() *)
  parseInvalidNumber * = -2;
  
  (* defined/reserved Tag IDs *)
  
  PASS * = 50415353H; (* password entry   *)
  TCNF * = 55434E46H; (* TD config entry  *)
  ACCT * = 41434354H; (* accounting entry *)
  
TYPE
  AddrPtr * = POINTER TO Addr;
  Addr * = STRUCT
    zone  * : INTEGER;
    net   * : INTEGER;
    node  * : INTEGER;
    point * : INTEGER;
  END;
  
  (* This structure is returned by NLFind() and NLIndexFind() *)
  
  NodeDescPtr * = POINTER TO NodeDesc;
  NodeDesc * = STRUCT
    node      * : Addr;    (* node address *)
    reserved  * : LONGINT;
    region    * : INTEGER; (* region (0 if none) *)
    hubNode   * : INTEGER; (* node # of this node's HUB (0 if none) *)
    system    * : LONGINT; (* node name *)
    sysop     * : LONGINT; (* sysop name *)
    phone     * : LONGINT; (* phone number *)
    city      * : LONGINT; (* city and state *)
    passwd    * : LONGINT; (* password *)
    flags     * : LONGINT; (* nodelist flags *)
    cost      * : LONGINT; (* cost *)
    baudRate  * : INTEGER; (* baud rate *)
    id        * : LONGINT; (* unique ID (offset into nodeindex) *)
  END;

VAR
  traplist * : e.LibraryPtr;

PROCEDURE Open* {traplist,-36}(name{8}:ARRAY OF CHAR; flags{0}:LONGSET):LONGINT;
PROCEDURE Close* {traplist,-42}(nodelist{8}:LONGINT);
PROCEDURE Find* {traplist,-48}(nodelist{8}:LONGINT; address{9}:AddrPtr; flags{0}:LONGSET):NodeDescPtr;
PROCEDURE FreeNode* {traplist,-54}(node{8}:NodeDescPtr);
PROCEDURE AddrComp* {traplist,-60}(node1{8},node2{9}:AddrPtr):SHORTINT;
PROCEDURE IndexFind* {traplist,-66}(nodelist{8}:LONGINT; address{9}:AddrPtr; flags{0}:LONGSET):NodeDescPtr;
PROCEDURE ExtraFromNL* {traplist,-72}(nodelist{8}:LONGINT):LONGINT;
PROCEDURE ExtraOpen* {traplist,-78}(path{8}:ARRAY OF CHAR):LONGINT;
PROCEDURE ExtraClose* {traplist,-84}(xtra{8}:LONGINT);
PROCEDURE ExtraFind* {traplist,-90}(xtra{8}:LONGINT; address{9}:AddrPtr; tag{0}:LONGINT; size{10}:LONGINT):LONGINT;
PROCEDURE ExtraPut* {traplist,-96}(xtra{8}:LONGINT; address{9}:AddrPtr; tag{0}:LONGINT; size{1}:LONGINT; data{10}:LONGINT):BOOLEAN;
PROCEDURE ExtraDel* {traplist,-102}(xtra{8}:LONGINT; data{9}:LONGINT);
PROCEDURE ExtraFlush* {traplist,-114}(xtra{8}:LONGINT);
PROCEDURE ExtraLock* {traplist,-120}(xtra{8}:LONGINT);
PROCEDURE ExtraUnlock* {traplist,-126}(xtra{8}:LONGINT);
PROCEDURE ExtraEnumNode* {traplist,-132}(xtra{8}:LONGINT; client{9}:LONGINT; user{10}:LONGINT):LONGINT;
PROCEDURE ExtraChanged* {traplist,-138}(xtra{8}:LONGINT);
PROCEDURE ExtraEnumTag* {traplist,-144}(xtra{8}:LONGINT; address{9}:AddrPtr; client{10}:LONGINT; user{11}:LONGINT):LONGINT;
PROCEDURE EnumNode* {traplist,-150}(nodelist{8}:LONGINT; bufsize{0}:LONGINT; address{9}:AddrPtr; client{10}:LONGINT; user{11}:LONGINT):LONGINT;
PROCEDURE ParseAddr* {traplist,-156}(addr{8}:AddrPtr; str{9}:ARRAY OF CHAR; default{10}:AddrPtr):LONGINT;
PROCEDURE ExtraLockTag* {traplist,-168}(xtra{8}:LONGINT; tagdata{9}:LONGINT);
PROCEDURE ExtraUnlockTag* {traplist,-174}(xtra{8}:LONGINT; tagdata{9}:LONGINT);
PROCEDURE ExtraChange* {traplist,-180}(xtra{8}:LONGINT; address{9}:AddrPtr; tag{0}:LONGINT; size{1}:LONGINT; data{2}:LONGINT):BOOLEAN;
PROCEDURE ExtraFindLock* {traplist, -186}(xtra{8}:LONGINT; address{9}:AddrPtr; tag{0}:LONGINT; size{10}:LONGINT):LONGINT;

BEGIN
  traplist := e.OpenLibrary(traplistName,traplistVersion);
  IF traplist = NIL THEN HALT(20); END;
CLOSE
  e.CloseLibrary(traplist);
END TrapList.
