Documentation of 'npg_unit.tpu' v3.0 (04/01/1999) (Compatible witht 1.xx and 2.xx)
===========================================================================

Function  NPG_Pointer_To_Frame ( T : String) : Pointer;
---------------------------------------------------------------
  Convert a address-string ( 1234:12A3 ) to a pointer variable.
  An address will be parsed as parameter 7 to an run program.
  This address will contain the actual parameters the user submitted.
  The pointer points to the next record:

      FrameBlock = Record
                      FrameLength : Word;
                      Buffer      : Array[0..256] of Byte;
                   End;


Function  NPG_String_To_Frame : String;
---------------------------------------------------------------
  Converts the frame-record to an array of characters (string).


Function  NPG_Check : Integer;
---------------------------------------------------------------
  Checks if NPG is loaded, when value 256 is return then NPG isn't
  loaded. Every other value means the interrupt NPG is located on.


Procedure NPG_WriteUser ( Ur : UserRec );
---------------------------------------------------------------
  Writes UserRec to disk for a specific channel.
  UserRec is formatted like this:

        UserRec   = Record
                      Channel     : Byte;
                      Mode        : Byte; (*  0 = Do Nothing with File    *)
                                          (*  1 = Kill File after execute *)
                                          (*  2 = Send 'FileName' as text *)
                                          (*  3 = Send Frame block        *)
                                          (*  4 = Show Frame block        *)
                      FileName    : String[80];
                    End;


Procedure NPG_WriteTnc ( Tr : TncRec );
---------------------------------------------------------------

  Writes TncRec to disk for a specific channel.
  TncRec is formatted like this:

        TncRec    = Record
                       Channel     : Byte;
                       TncCommand  : String[80];
                    End;



Function  NPG_Version : Word;
---------------------------------------------------------------
  Request version from NPG x.yy, x = major byte, yy = minor byte.


Function  NPG_Pointer_To_ChannelRec : Pointer;
---------------------------------------------------------------
  Request address from channel data and convert the address to a
  pointer. You can request data for all channels using this pointer!
  Be careful! There are 2 different version of ChannelRec, for NPG 1.yy
  and NPG 2.yy. Channel data is stored like this:

      Channel_Rec1xx  = Record
                         UserCall    : String [ 9]; {User Callsign   }
                         MyCall      : String [ 9]; {Sysop Callsign  }
                         ProgName    : String [12]; {Default Program }
                         PrgNme      : String [12]; {Active Program  }
                         ExecLevel   : Byte;        {Times Executed  }
                         ConnectMode : Byte;        {Channel-mode    }
                                                    {0 = not connected }
                                                    {1 = incoming      }
                                                    {2 = outgoing      }
                         Hours,
                         Minutes,
                         Seconds     : Word;        {Connection Time   }
                         InitCall    : String [9];  {Initialization mycall }
                     End;
      ChannelRec1xx = Array[0..20] Of Channel_Rec; {21 x Channel_Rec1xx}

      Channel_Rec2xx  = Record
                         UserCall    : String [ 9]; {User Callsign   }
                         MyCall      : String [ 9]; {Sysop Callsign  }
                         ProgName    : String [79]; {Default Program }
                         PrgNme      : String [79]; {Active Program  }
                         ExecLevel   : Byte;        {Times Executed  }
                         ConnectMode : Byte;        {Channel-mode    }
                                                    {0 = not connected }
                                                    {1 = incoming      }
                                                    {2 = outgoing      }
                         Hours,
                         Minutes,
                         Seconds     : Word;        {Connection Time   }
                         InitCall    : String [9];  {Initialization mycall }
                     End;
      ChannelRec2xx = Array[0..20] Of Channel_Rec; {21 x Channel_Rec2xx}



Function  NPG_SysopChannel : Byte;
---------------------------------------------------------------
  Request channel where the sysop is currently on.


Function  NPG_MaxChannels : Byte;
---------------------------------------------------------------
  Request the maximum number of channels where NPG is set on.


Function  NPG_Pointer_To_MHeard : Pointer;
---------------------------------------------------------------
  Request address to Monitor-Heard list.
  The Monitor-Heard list is stored like this:

      MHeardRec   = Record
                      Call : String [9];
                      Port : Byte;
                      Time : LongInt; {PackedTime}
                    End;


Function  NPG_Get_Field ( Ch : Byte; ID : Integer;
                          Var RetVal : LongInt;
                          Var RetStr : String ) : Boolean;
---------------------------------------------------------------
  Request data per channel. Ch is the channel. ID is the field
  you want to request:

                                 RetVal   RetStr
      NPGC_USERCALL   = 0                   x
      NPGC_MYCALL     = 1                   x
      NPGC_DEFPROG    = 2                   x
      NPGC_ACTPROG    = 3                   x
      NPGC_EXECLEVEL  = 4          x
      NPGC_CONMODE    = 5          x
      NPGC_CT_HOURS   = 6          x
      NPGC_CT_MINS    = 7          x
      NPGC_CT_SECS    = 8          x
      NPGC_INITCALL   = 9                   x

  x means wether the function returns it's value in RetVal or RetStr.
  NPGC_... are the codes the represent the constants.


Function  NPG_Set_Field ( Ch : Byte; ID : Integer;
                          SetVal : LongInt;
                          SetStr : String ) : Boolean;
---------------------------------------------------------------
  Set data per channel. Ch is the channel. ID is the field
  you want to set:

                                 SetVal   SetStr
      NPGC_USERCALL   = 0                   x
      NPGC_MYCALL     = 1                   x
      NPGC_DEFPROG    = 2                   x
      NPGC_ACTPROG    = 3                   x
      NPGC_EXECLEVEL  = 4          x
      NPGC_CONMODE    = 5          x
      NPGC_CT_HOURS   = 6          x
      NPGC_CT_MINS    = 7          x
      NPGC_CT_SECS    = 8          x
      NPGC_INITCALL   = 9                   x


Function  NPG_SendFile  ( Ch : Byte; FileName : String; Mode : Byte ) : Boolean;
---------------------------------------------------------------
  With this function you'll be able to send text or a file alot easier:
  Incase you use channel 255, the data will be send to the channel where
  the user is on. We have used a few constants for these modes:

      NPGM_FILE          = 0;  {send as file}
      NPGM_FILE_DELETE   = 1;  {send as file, erase afterwards}
      NPGM_TEXT          = 2;  {send as text}
      NPGM_SEND_FRAME    = 3;  {send frame}
      NPGM_SHOW_FRAME    = 4;  {echo frame, but don't send}
      NPGM_FRAME_REPLACE = 5;  {echo frame, replace //-command (npg 2.00 only)}

Function  NPG_DoCommand ( Ch : Byte; Command : String ) : Boolean;
---------------------------------------------------------------
  With this function you can execute commands for NPG alot easier.
  Incase you use channel 255, the command will be executed on the
  active channel (=channel where it's is executed).



Function  NPG_FindCallsign ( Call : String; Var Channel : byte ) : Boolean;
---------------------------------------------------------------
  With this function you can search for users, and wether he's connected
  or not. When the function returns TRUE the the user is connected,
  the channel where the user is located will be parsed to Channel.


Procedure NPG_StopRun ( StopCode : Integer );
---------------------------------------------------------------
  With this function you can stop your run-program using a certain
  STOP-Code. The behaviar of the RUN-program can be set by this.

  Here are the constants for these stop-codes:

      NPGS_STOP_NO_OUTPUT     = 0; {stop, no output}
      NPGS_STOP_TNC_USER      = 1; {stop, first tnc-com. then text}
      NPGS_STOP_USER_TNC      = 2; {stop, first text then tnc-com.}
      NPGS_INC_NO_OUTPUT      = 3; {level increase, no output}
      NPGS_INC_TNC_USER       = 4; {level increase, 1st tnc, then text}
      NPGS_INC_USER_TNC       = 5; {level increase, 1st text, then tnc}


Function NPG_GetMode : Byte;
---------------------------------------------------------------
  Requesting the info-mode:

                 0  - user text
                 1  - connection
                 2  - disconnection


Function NPG_SetFrame ( Frame : String ) : Boolean;
---------------------------------------------------------------
  Replace the original parameters, can be used together with
  NPG_SendFile ( NPGM_SEND_FRAME and NPGM_SHOW_FRAME).


Procedure GetCommand_Data ( S : String; Var Command, Data : String );
---------------------------------------------------------------
  Split a text line into 2 seperate strings.

  Example:  popup this is a test

         Split will be done like this: command = popup
                                       data    = this is a test


Function Adjust ( S : String; StrLength : Byte ) : String;
---------------------------------------------------------------
  With this function you can adjust the length of a string.
  When the length of S if greater than StrLength then S will
  be cut. If length of S if less than StrLength it will be
  added with spaces.


Function UpcStr ( S : String): String;
---------------------------------------------------------------
  With this function you can change the string into uppercase.


Procedure NPG_GetMHeard ( Number : Byte; Var MonitorHeard : MHeardRec );
-------------------------------------------------------------------------
  Gets record with MonitorHeard data, Number is 1 to 26.


Function NPG_GetMode : Byte;
----------------------------
  Returns the info-mode.


(Boolean) NPG_Sysopmode
-----------------------
  Do we have sysop-mode or not.

(byte) NPG_UserLevel
--------------------
  Level of the user.

