home *** CD-ROM | disk | FTP | other *** search
/ Beijing Paradise BBS Backup / PARADISE.ISO / software / BBSDOORW / FMSTR96G.ZIP / FMSTR96G.PAS
Encoding:
Pascal/Delphi Source File  |  1993-08-10  |  32.5 KB  |  547 lines

  1. (**********************************************************************)
  2. (**             Structure definitions for FMail v0.96Γ               **)
  3. (**                                                                  **)
  4. (** /*                                                               **)
  5. (**    FMSTRUCT.H                                                    **)
  6. (**                                                                  **)
  7. (**    File structures for FMail 0.96Γ                               **)
  8. (**    Copyright (C) 1993 Folkert J. Wijnstra. All rights reserved.  **)
  9. (**                                                                  **)
  10. (**    All information in this document is subject to change at any  **)
  11. (**    time without prior notice!                                    **)
  12. (**                                                                  **)
  13. (**    Strings are NUL terminated arrays of char type.               **)
  14. (**    Path names are \ terminated.                                  **)
  15. (** */                                                               **)
  16. (**                                                                  **)
  17. (**    Based on the C structures as published by Folkert Wijnstra.   **)
  18. (**    Converted to TurboPascal by Jan Hoolwerf.                     **)
  19. (**                                                                  **)
  20. (**    Last update: 11 August 1993                                   **)
  21. (**********************************************************************)
  22.  
  23. UNIT FmStr96G;
  24.  
  25. INTERFACE
  26.  
  27.   (****************************************************************************************************)
  28.   (**                                  General constants and structures                              **)
  29.   (****************************************************************************************************)
  30.  
  31. CONST
  32.   _ARC                : Word = 0;                                             { used in the conversion }
  33.   _ZIP                : Word = 1;                                             { from FMail to GEcho    }
  34.   _LZH                : Word = 2;
  35.   _PAK                : Word = 3;
  36.   _ZOO                : Word = 4;
  37.   _ARJ                : Word = 5;
  38.   _SQZ                : Word = 6;
  39.   {}
  40.   _Comment_len        = 51;                   { these constants are defined here because they are      }
  41.   _Path_len           = 48;                   { necessary in more than one section of these structures }
  42.   _OrgLine_len        = 59;
  43.   _ProgramName_len    = 46;
  44.   _MaxAKAs            = 11;                                                   { including main address }
  45.   _MaxUplinkReq       = 16;
  46.   _MaxUsers           = 16;
  47.   _MaxMatch           = 16;
  48.   {}
  49.   _LOG_INBOUND        = $0001;
  50.   _LOG_OUTBOUND       = $0002;
  51.   _LOG_PKTINFO        = $0004;
  52.   _LOG_XPKTINFO       = $0008;
  53.   _LOG_UNEXPPWD       = $0010;
  54.   _LOG_SENTRCVD       = $0020;
  55.   _LOG_STATS          = $0040;
  56.   _LOG_MSGBASE        = $8000;
  57.   _LOG_ECHOEXP        = $8000;
  58.   _LOG_NETIMP         = $8000;
  59.   _LOG_NETEXP         = $8000;
  60.   _LOG_WARNINGS       = $8000;
  61.   _LOG_ALWAYS         = $8000;
  62.   _LOG_DEBUG          = $8000;
  63.  
  64. TYPE
  65.   _FlagsType          = ARRAY[1..4] OF Char;                              { for the RemoteAccess flags }
  66.   _CommentType        = ARRAY[1.._Comment_len] OF Char;                                 { echo comment }
  67.   _OriginlineType     = ARRAY[1.._OrgLine_len] OF Char;                              { the origin line }
  68.   _PathType           = ARRAY[1.._Path_len] OF Char;                                   { DOS pathnames }
  69.   _ProgramName        = ARRAY[1.._ProgramName_len] OF Char;
  70.   _ArchiverInfo       = RECORD                     { archiver program name and command line parameters }
  71.                           _ProgramName        : ARRAY[1.._ProgramName_len] OF Char;
  72.                           _MemRequired        : Word;
  73.                         END;
  74.   _NodenumType        = RECORD
  75.                           _Zone,
  76.                           _Net,
  77.                           _Node,
  78.                           _Point              : Word;
  79.                         END;
  80.   _NodeFakeType       = RECORD
  81.                           _NodeNum            : _NodenumType;
  82.                           _FakeNet            : Word;
  83.                         END;
  84.   _AKAlistType        = ARRAY[1.._MaxAKAs] OF _NodeFakeType;
  85.  
  86.   GenOptionsBits      = (
  87.          _GO_UseEMS,                                                      { bit  0 from GenOptionsType }
  88.          _GO_CheckBreak,                                                  { bit  1 from GenOptionsType }
  89.          _GO_Swap,                                                        { bit  2 from GenOptionsType }
  90.          _GO_SwapEMS,                                                     { bit  3 from GenOptionsType }
  91.          _GO_SwapXMS,                                                     { bit  4 from GenOptionsType }
  92.          _GO_bit5,                                                                        { unused bit }
  93.          _GO_Monochrome,                                                  { bit  6 from GenOptionsType }
  94.          _GO_CommentFFD,                                                  { bit  7 from GenOptionsType }
  95.          _GO_PtAreasBBS,                                                  { bit  8 from GenOptionsType }
  96.          _GO_CommentFRA,                                                  { bit  9 from GenOptionsType }
  97.          _GO_bit10,                                                                       { unused bit }
  98.          _GO_IncBDRRA,                                                    { bit 11 from GenOptionsType }
  99.          _GO_bit12, _GO_b13, _GO_bit14,                                                  { unused bits }
  100.          _GO_RA2);                                                        { bit 15 from GenOptionsType }
  101.   _GenOptionsType     = SET OF GenOptionsBits;
  102.  
  103.   MailOptionsBits     = (
  104.         _MO_RemoveNetKludges,                                            { bit  0 from MailOptionsType }
  105.         _MO_bit1,                                                                         { unused bit }
  106.         _MO_CheckPktDest,                                                { bit  2 from MailOptionsType }
  107.         _MO_bit3,                                                                        { unused bits }
  108.         _MO_CreateSema,                                                  { bit  4 from MailOptionsType }
  109.         _MO_bit5, _MO_bit6, _MO_bit7,                                                    { unused bits }
  110.         _MO_DupDetection,                                                { bit  8 from MailOptionsType }
  111.         _MO_IgnoreMSGID,                                                 { bit  9 from MailOptionsType }
  112.         _MO_ARCmail060,                                                  { bit 10 from MailOptionsType }
  113.         _MO_bit11,                                                                        { unused bit }
  114.         _MO_PersNetmail,                                                 { bit 12 from MailOptionsType }
  115.         _MO_PrivateImport,                                               { bit 13 from MailOptionsType }
  116.         _MO_KeepExpMail,                                                 { bit 14 from MailOptionsType }
  117.         _MO_KillEmptyNetmail);                                           { bit 15 from MailOptionsType }
  118.   _MailOptionsType    = SET OF MailOptionsBits;
  119.  
  120.   MBoptionsBits       = (
  121.           _MB_SortNew,                                                     { bit  0 from MBoptionsType }
  122.           _MB_SortSubject,                                                 { bit  1 from MBoptionsType }
  123.           _MB_UdateChains,                                                 { bit  2 from MBoptionsType }
  124.           _MB_Retear,                                                      { bit  3 from MBoptionsType }
  125.           _MB_bit4, _MB_bit5,                                                            { unused bits }
  126.           _MB_RemoveRE,                                                    { bit  6 from MBoptionsType }
  127.           _MB_RemoveLfSr,                                                  { bit  7 from MBoptionsType }
  128.           _MB_ScanAlways,                                                  { bit  8 from MBoptionsType }
  129.           _MB_ScanUpdate,                                                  { bit  9 from MBoptionsType }
  130.           _MB_MultiLine,                                                   { bit 10 from MBoptionsType }
  131.           _MB_bit11,                                                                      { unused bit }
  132.           _MB_QuickToss,                                                   { bit 12 from MBoptionsType }
  133.           _MB_bit13, _MB_bit14,                                                          { unused bits }
  134.           _MB_SysopImport);                                                { bit 15 from MBoptionsType }
  135.   _MBoptionsType      = SET OF MBoptionsBits;                            { various options FOR an area }
  136.  
  137.   MGRoptionsBits      = (
  138.          _MGR_KeepRequest,                                                { bit  0 from MGRoptionsType }
  139.          _MGR_KeepReceipt,                                                { bit  1 from MGRoptionsType }
  140.          _MGR_bit2, _MGR_bit3,                                                           { unused bits }
  141.          _MGR_AutoDiscArea,                                               { bit  4 from MGRoptionsType }
  142.          _MGR_bit5, _MGR_bit6, _MGR_bit7, _MGR_bit8,                                     { unused bits }
  143.          _MGR_AllowAddAll,                                                { bit  9 from MGRoptionsType }
  144.          _MGR_AllowActive,                                                { bit 10 from MGRoptionsType }
  145.          _MGR_bit11,                                                                      { unused bit }
  146.          _MGR_AllowPassword,                                              { bit 12 from MGRoptionsType }
  147.          _MGR_AllowPktPwd,                                                { bit 13 from MGRoptionsType }
  148.          _MGR_AllowNotify,                                                { bit 14 from MGRoptionsType }
  149.          _MGR_AllowCompr);                                                { bit 15 from MGRoptionsType }
  150.   _MGRoptionsType     = SET OF MGRoptionsBits;
  151.  
  152.   DefaultOptionsBits  = (
  153.      _DO_Active,                                                          { bit  0 from DefOptionsType }
  154.      _DO_TinySeenby,                                                      { bit  1 from DefOptionsType }
  155.      _DO_Security,                                                        { bit  2 from DefOptionsType }
  156.      _DO_bit3,                                                                            { unused bit }
  157.      _DO_Private,                                                         { bit  4 from DefOptionsType }
  158.      _DO_ImpSeenby,                                                       { bit  5 from DefOptionsType }
  159.      _DO_CheckSeenby,                                                     { bit  6 from DefOptionsType }
  160.      _DO_bit7,                                                                            { unused bit }
  161.      _DO_Local,                                                           { bit  8 from DefOptionsType }
  162.      _DO_b9,                                                                              { unused bit }
  163.      _DO_PassThrough,                                                     { bit 10 from DefOptionsType }
  164.      _DO_b11, _DO_b12, _DO_b13,                                                          { unused bits }
  165.      _DO_ArrivalDate,                                                     { bit 14 from DefOptionsType }
  166.      _DO_SysopRead);                                                      { bit 15 from DefOptionsType }
  167.   _DefaultOptionsType = SET OF DefaultOptionsBits;
  168.  
  169.   UplinkOptionsBits   = (
  170.       _UO_AddPlusPrefix,                                                 { bit  0 of UplinlOptionsType }
  171.       _UO_b1, _UO_b2, _UO_b3,                                                            { unused bits }
  172.       _UO_unconditional,                                                 { bit  4 of UplinlOptionsType }
  173.       _UO_b5, _UO_b6, _UO_b7, _UO_b8, _UO_b9,                                            { unused bits }
  174.       _UO_b10, _UO_b11, _UO_b12, _UO_b13, _UO_b14, _UO_b15);                             { unused bits }
  175.   _UplinkOptionsType  = SET OF UplinkOptionsBits;
  176.  
  177.   _UplinkReqType      = RECORD
  178.                           _Node               : _NodenumType;
  179.                           _program            : ARRAY[1..9] OF Char;
  180.                           _password           : ARRAY[1..17] OF Char;
  181.                           _fileName           : ARRAY[1..13] OF Char;
  182.                           _fileType           : Char;
  183.                           _groups             : LongInt;
  184.                           _originAka          : Char;
  185.                           _options            : _UplinkOptionsType;
  186.                           _reserved           : ARRAY[1..9] OF Char;
  187.                         END;
  188.  
  189.   _UserType           = RECORD
  190.                           _UserName           : ARRAY[1..36] OF Char;
  191.                           _reserved           : ARRAY[1..28] OF Char;
  192.                         END;
  193.  
  194.  
  195.   (****************************************************************************************************)
  196.   (**                                      FMAIL.CFG                                                 **)
  197.   (****************************************************************************************************)
  198.  
  199. TYPE
  200.   _AkaMatchNodeType   = RECORD
  201.                           _Valid,
  202.                           _Zone,
  203.                           _Net,
  204.                           _Node               : Word;
  205.                         END;
  206.   _AkamatchType       = RECORD
  207.                           _AmNode             : _AkaMatchNodeType;
  208.                           _Aka                : Word;
  209.                         END;
  210.   _ConfigType         = RECORD
  211.                           _VersionMinor,
  212.                           _VersionMajor       : Char;
  213.                           _CreationDate       : LongInt;
  214.                           _Key,
  215.                           _ReservedKey,
  216.                           _RelKey1,
  217.                           _RelKey2            : LongInt;
  218.                           _reserved1          : ARRAY[1..22] OF Char;
  219.                           _MgrOptions         : _MGRoptionsType;
  220.                           _AKAlist            : _AKAlistType;
  221.                           _ReservedAKA        : ARRAY[1..16 - _MaxAKAs] OF _NodeFakeType;
  222.                           _NetmailBoard       : ARRAY[1.._MaxAKAs] OF Word;
  223.                           _ReservedNet        : ARRAY[1..16 - _MaxAKAs] OF Word;
  224.                           _GenOptions         : _GenOptionsType;
  225.                           _MBoptions          : _MBoptionsType;
  226.                           _MailOptions        : _MailOptionsType;
  227.                           _MaxPktSize,
  228.                           _reserved2,
  229.                           _Mailer,
  230.                           _BBSprogram,
  231.                           _MaxBundleSize,
  232.                           _ExtraHandles,                                          { valid range: 0-235 }
  233.                           _AutoRenumber,
  234.                           _BufSize,
  235.                           _FtBufSize,
  236.                           _AllowedNumNetmail,
  237.                           _LogInfo,
  238.                           _LogStyle           : Word;
  239.                           _reserved3          : ARRAY[1..68] OF Char;
  240.                           _ColorSet           : Word;
  241.                           _SysopName          : ARRAY[1..36] OF Char;
  242.                           _DefArc             : Word;
  243.                           _reserved4          : ARRAY[1..24] OF Char;
  244.                           _TearType           : Char;
  245.                           _TearLine           : ARRAY[1..25] OF Char;
  246.                           _SummaryLogName     : _PathType;
  247.                           _RecBoard,
  248.                           _BadBoard,
  249.                           _DupBoard           : Word;
  250.                           _Topic1,
  251.                           _Topic2             : ARRAY[1..16] OF Char;
  252.                           _BbsPath,
  253.                           _NetPath,
  254.                           _SentPath,
  255.                           _RcvdPath,
  256.                           _InPath,
  257.                           _OutPath,
  258.                           _SecurePath,
  259.                           _LogName,
  260.                           _SwapPath,
  261.                           _SemaphorePath,
  262.                           _PmailPath,
  263.                           _AreaMgrLogName,
  264.                           _AutoRApath,
  265.                           _AutoFolderFDpath,
  266.                           _AutoAreasBBSpath,
  267.                           _AutoGoldEDareasPath : _PathType;
  268.                           _UnArc,
  269.                           _UnZip,
  270.                           _UnLzh,
  271.                           _UnPak,
  272.                           _UnZoo,
  273.                           _UnArj,
  274.                           _UnSqz,
  275.                           _GUS,
  276.                           _ARC,
  277.                           _ZIP,
  278.                           _LZH,
  279.                           _PAK,
  280.                           _ZOO,
  281.                           _ARJ,
  282.                           _SQZ,
  283.                           _CustomArc          : _ArchiverInfo;
  284.                           _reserved5          : ARRAY[1..105] OF Char;
  285.                           _GroupsQBBS         : ARRAY[1.._MaxAKAs] OF Char;
  286.                           _TemplateSecQBBS    : ARRAY[1.._MaxAKAs] OF Word;
  287.                           _TemplateFlagsQBBS  : ARRAY[1.._MaxAKAs] OF _FlagsType;
  288.                           _Attr2RA            : ARRAY[1.._MaxAKAs] OF Char;
  289.                           _AliasesQBBS        : ARRAY[1.._MaxAKAs] OF Char;
  290.                           _GroupRA            : ARRAY[1.._MaxAKAs] OF Word;
  291.                           _AltGroupRA         : ARRAY[1.._MaxAKAs, 1..3] OF Word;
  292.                           _QwkNameSBBS        : ARRAY[1.._MaxAKAs, 1..13] OF Char;
  293.                           _MinAgeSBBS,
  294.                           _DaysRcvdAKA        : ARRAY[1.._MaxAKAs] OF Word;
  295.                           _ReplyStatSBBS      : ARRAY[1.._MaxAKAs] OF Char;
  296.                           _AttrSBBS           : ARRAY[1.._MaxAKAs] OF Word;
  297.                           _GroupDescr         : ARRAY[1..26, 1..27] OF Char;
  298.                           _reserved6          : ARRAY[1..9] OF Char;
  299.                           _MsgKindsRA         : ARRAY[1.._MaxAKAs] OF Char;
  300.                           _AttrRA             : ARRAY[1.._MaxAKAs] OF Char;
  301.                           _ReadSecRA          : ARRAY[1.._MaxAKAs] OF Word;
  302.                           _ReadFlagsRA        : ARRAY[1.._MaxAKAs] OF _FlagsType;
  303.                           _WriteSecRA         : ARRAY[1.._MaxAKAs] OF Word;
  304.                           _WriteFlagsRA       : ARRAY[1.._MaxAKAs] OF _FlagsType;
  305.                           _SysopSecRA         : ARRAY[1.._MaxAKAs] OF Word;
  306.                           _SysOpFlagsRA       : ARRAY[1.._MaxAKAs] OF _FlagsType;
  307.                           _DaysAKA,
  308.                           _MsgsAKA            : ARRAY[1.._MaxAKAs] OF Word;
  309.                           _DescrAKA           : ARRAY[1.._MaxAKAs] OF _CommentType;
  310.                           _Users              : ARRAY[1.._MaxUsers] OF _UserType;
  311.                           _AkaMatch           : ARRAY[1.._MaxMatch] OF _AkamatchType;
  312.                           _reserved7          : ARRAY[1..2048 - 10 * _MaxMatch] OF Char;
  313.                           _uplinkReq          : ARRAY[1.._MaxUplinkReq] OF _UplinkReqType;
  314.                         END;
  315.  
  316.  
  317.   (****************************************************************************************************)
  318.   (**                                                Node manager                                    **)
  319.   (****************************************************************************************************)
  320.  
  321. CONST
  322.   MaxNodeMgr          = 256;
  323.   PktType2plus        = 1;
  324.  
  325. TYPE
  326.   _NodeOptionsBits    = (
  327.        _NO_FixDate,                                                     { bit  0 from _NodeOptionsType }
  328.        _NO_TinySeenby,                                                  { bit  1 from _NodeOptionsType }
  329.        _NO_b2,                                                                            { unused bit }
  330.        _NO_IgnorePwd,                                                   { bit  3 from _NodeOptionsType }
  331.        _NO_Active,                                                      { bit  4 from _NodeOptionsType }
  332.        _NO_b5, _NO_b6, _NO_b7,                                                           { unused bits }
  333.        _NO_b8,                                                                            { unused bit }
  334.        _NO_b9, _NO_b10, _NO_b11,                                                         { unused bits }
  335.        _NO_ForwardReq,                                                  { bit 12 from _NodeOptionsType }
  336.        _NO_RemMaint,                                                    { bit 13 from _NodeOptionsType }
  337.        _NO_AllowRescan,                                                 { bit 14 from _NodeOptionsType }
  338.        _NO_Notify);                                                     { bit 15 from _NodeOptionsType }
  339.   _NodeOptionsType    = SET OF _NodeOptionsBits;
  340.  
  341.   _NodeInfoType       = RECORD
  342.                           _Node               : _NodenumType;
  343.                           _reserved1          : ARRAY[1..2] OF Char;
  344.                           _capability,                                         { 0=Stone Age  1=Type2+ }
  345.                           _archiver           : Word;                               { 0=ARC 1=ZIP etc. }
  346.                           _options            : _NodeOptionsType;
  347.                           _groups             : LongInt;
  348.                           _OutStatus          : Word;                     { 0=none 1=hold 2=crash etc. }
  349.                           _reserved2          : ARRAY[1..32] OF Char;
  350.                           _password           : ARRAY[1..18] OF Char;               { AreaMgr password }
  351.                           _PacketPwd          : ARRAY[1..10] OF Char;           { password for packets }
  352.                           _reserved3          : ARRAY[1..2] OF Char;
  353.                           _ViaNode            : _NodenumType;
  354.                           _SysopName          : ARRAY[1..36] OF Char;
  355.                         END;
  356.  
  357.  
  358.   (****************************************************************************************************)
  359.   (**                                           Area Manager                                         **)
  360.   (****************************************************************************************************)
  361.  
  362. CONST
  363.   _MaxAreas           = 512;                             { may be bigger (not related to message base) }
  364.   _MaxForward         = 64;                                         { max. # of nodes in forward table }
  365.   _EchoName_len       = 51;
  366.   _MBpath_len         = 19;
  367.  
  368. TYPE
  369.   _ExportType         = ARRAY[1.._MaxForward] OF _NodenumType;                { list of export systems }
  370.   _EchoNameType       = ARRAY[1.._EchoName_len] OF Char;                                     { echotag }
  371.   AreaOptionsBits     = (
  372.         _AO_Active,                                                      { bit  0 from AreaOptionsType }
  373.         _AO_TinySeenby,                                                  { bit  1 from AreaOptionsType }
  374.         _AO_Security,                                                    { bit  2 from AreaOptionsType }
  375.         _AO_bit3,                                                                         { unused bit }
  376.         _AO_Private,                                                     { bit  4 from AreaOptionsType }
  377.         _AO_ImportSeenby,                                                { bit  5 from AreaOptionsType }
  378.         _AO_CheckSeenby,                                                 { bit  6 from AreaOptionsType }
  379.         _AO_bit7,                                                                         { unused bit }
  380.         _AO_local,                                                       { bit  8 from AreaOptionsType }
  381.         _AO_Disconnected,                                                { bit  9 from AreaOptionsType }
  382.         _AO_reserved,                                                    { bit 10 from AreaOptionsType }
  383.         _AO_b11, _AO_b12, _AO_b13,                                                       { unused bits }
  384.         _AO_ArrivalDate,                                                 { bit 14 from AreaOptionsType }
  385.         _AO_SysopRead);                                                  { bit 15 from AreaOptionsType }
  386.   _AreaOptionsType    = SET OF AreaOptionsBits;
  387.  
  388.   _RawEchoType        = RECORD                                             { the structure of FMAIL.AR }
  389.                           _Zero               : Char;                    { !! should always be zero !! }
  390.                           _AreaNameOld        : ARRAY[1.._MBpath_len] OF Char;
  391.                           _GroupQBBS          : Char;
  392.                           _FlagsTemplateQBBS  : _FlagsType;
  393.                           _Comment            : _CommentType;
  394.                           _Group              : LongInt;
  395.                           _Board,
  396.                           _Address,
  397.                           _AlsoSeenBy,
  398.                           _GroupRA            : Word;
  399.                           _AltGroupRA         : ARRAY[1..3] OF Word;
  400.                           _options            : _AreaOptionsType;
  401.                           _OutStatus,
  402.                           _Days,
  403.                           _Msgs,
  404.                           _DaysRcvd,
  405.                           _TemplateSecQBBS,
  406.                           _ReadSecRA          : Word;
  407.                           _FlagsRdRA          : _FlagsType;
  408.                           _WriteSecRA         : Word;
  409.                           _FlagsWrRA          : _FlagsType;
  410.                           _SysopSecRA         : Word;
  411.                           _FlagsSysRA         : _FlagsType;
  412.                           _AttrRA,
  413.                           _MsgKindsRA         : Char;
  414.                           _AttrSBBS           : Word;
  415.                           _ReplyStatSBBS      : Char;
  416.                           _AreaName           : _EchoNameType;
  417.                           _QwkName            : ARRAY[1..13] OF Char;
  418.                           _MinAgeSBBS         : Word;
  419.                           _Attr2RA,
  420.                           _AliasesQBBS        : Char;
  421.                           _OriginLine         : _OriginlineType;
  422.                           _Export             : _ExportType;
  423.                         END;
  424.  
  425.  
  426.   (****************************************************************************************************)
  427.   (**                                        Pack Manager                                            **)
  428.   (****************************************************************************************************)
  429.  
  430. CONST
  431.   _MaxPack            = 64;
  432.   _PackStringSize     = 64;
  433.  
  434. TYPE
  435.   _PackEntryType      = ARRAY[1.._PackStringSize] OF Char;
  436.   _PackType           = ARRAY[1.._MaxPack] OF _PackEntryType;
  437.  
  438.  
  439.   (****************************************************************************************************)
  440.   (**                                            FMAIL.BDE                                           **)
  441.   (****************************************************************************************************)
  442.  
  443. CONST
  444.   _MaxBadEchos        = 50;
  445.  
  446. TYPE
  447.   _BadEchoType        = RECORD
  448.                           _BadEchoName        : _EchoNameType;
  449.                           _SourceNode         : _NodenumType;
  450.                           _DestinationAKA     : Integer;
  451.                         END;
  452.  
  453.  
  454.   (****************************************************************************************************)
  455.   (**                               some usefull functions and procedures                            **)
  456.   (****************************************************************************************************)
  457.  
  458. FUNCTION C2P(VAR S; Max : Byte) : String;                { convert a C string to the Pascal equivalent }
  459. FUNCTION BitIsSet(Arg, Bitmask : Word) : Boolean;                             { checks if a bit is set }
  460. PROCEDURE SetBit(VAR Arg : Word; Bitmask : Word);                              { sets a bit iin a word }
  461. PROCEDURE ResetBit(VAR Arg : Word; Bitmask : Word);                           { resets a bit in a word }
  462. FUNCTION Group2Letter(Arg : LongInt) : Char;   { convert the group definition from 'longint' to 'char' }
  463. FUNCTION Letter2Group(Arg : Char) : LongInt;   { convert the group definition from 'char' to 'longint' }
  464. FUNCTION NodeNumStr(Arg : _NodenumType) : String;                         { make a readable nodenumber }
  465.  
  466.  
  467.  
  468. IMPLEMENTATION
  469.  
  470.   FUNCTION C2P(VAR S; Max : Byte) : String;
  471.     { Converts an ASCIIZ string to a Turbo Pascal string }
  472.     { with a maximum length of max.                      }
  473.   VAR 
  474.     starray             : ARRAY[1..255] OF Char ABSOLUTE S;
  475.     len                 : Integer;
  476.   BEGIN                                                                                    { C2P begin }
  477.     len := Pos(#0, starray) - 1;                                                      { Get the length }
  478.     IF (len > Max) OR(len < 0) THEN                                           { length exceeds maximum }
  479.       len := Max;                                                                  { so set to maximum }
  480.     C2P := starray;
  481.     C2P[0] := Chr(len);                                                                   { Set length }
  482.   END; { C2P end }                                                                           { Asc2Str }
  483.  
  484.  
  485.   FUNCTION BitIsSet(Arg, Bitmask : Word) : Boolean;
  486.   BEGIN                                                                                 { BitSet begin }
  487.     BitIsSet := (Arg AND Bitmask) = Bitmask;
  488.   END;                                                                                    { BitSet end }
  489.  
  490.  
  491.   PROCEDURE SetBit(VAR Arg : Word; Bitmask : Word);
  492.   BEGIN                                                                                 { BitSet begin }
  493.     Arg := Arg OR Bitmask;
  494.   END;                                                                                    { BitSet end }
  495.  
  496.  
  497.   PROCEDURE ResetBit(VAR Arg : Word; Bitmask : Word);
  498.   BEGIN                                                                                 { BitSet begin }
  499.     Arg := Arg AND NOT Bitmask;
  500.   END;                                                                                    { BitSet end }
  501.  
  502.  
  503.   FUNCTION Group2Letter(Arg : LongInt) : Char;
  504.   VAR
  505.     count               : Byte;
  506.   BEGIN                                                                                  { Group begin }
  507.     count := 1;
  508.     WHILE Arg > 1 DO
  509.       BEGIN
  510.         Arg := Arg SHR 1;
  511.         Inc(count);
  512.       END;
  513.     Group2Letter := Chr(count + 64);
  514.   END;                                                                                     { Group end }
  515.  
  516.  
  517.   FUNCTION Letter2Group(Arg : Char) : LongInt;
  518.   VAR
  519.     count               : Byte;
  520.   BEGIN                                                                                  { Group begin }
  521.     count := Ord(Arg) - 65;
  522.     Letter2Group := LongInt(1) SHL count;
  523.   END;                                                                                     { Group end }
  524.  
  525.  
  526.   FUNCTION NodeNumStr(Arg : _NodenumType) : String;
  527.   VAR
  528.     I                   : Byte;
  529.     S                   : String;
  530.     FUNCTION Int2Str(L, F : LongInt) : String;
  531.     VAR
  532.       Si                  : String;
  533.     BEGIN
  534.       Str(L, Si);
  535.       Int2Str := Si;
  536.     END;                                                                                     { Int2Str }
  537.   BEGIN                                                                             { NodeNumStr begin }
  538.     S := Int2Str(Arg._Zone, 6) + ':';
  539.     S := S + Int2Str(Arg._Net, 6) + '/';
  540.     S := S + Int2Str(Arg._Node, 6);
  541.     IF Arg._Point <> 0 THEN
  542.       S := S + '.' + Int2Str(Arg._Point, 6);
  543.     NodeNumStr := S;
  544.   END;                                                                                { NodeNumStr end }
  545.  
  546. END.                                                                                     { end of unit }
  547.