Browse Source

* added nwsnut, nwconio and nwthreads for netware

armin 22 years ago
parent
commit
6cd83c6db8
6 changed files with 1869 additions and 5 deletions
  1. 1 1
      rtl/netware/Makefile
  2. 2 1
      rtl/netware/Makefile.fpc
  3. 8 3
      rtl/netware/README
  4. 141 0
      rtl/netware/nwconio.pp
  5. 1518 0
      rtl/netware/nwsnut.pp
  6. 199 0
      rtl/netware/nwthread.pp

+ 1 - 1
rtl/netware/Makefile

@@ -211,7 +211,7 @@ override FPCOPT+=-Ur
 override FPCOPT+=-dMT
 CREATESMART=1
 OBJPASDIR=$(RTL)/objpas
-override TARGET_UNITS+=$(SYSTEMUNIT) systhrds objpas strings netware winsock2 dos crt objects sysutils typinfo math cpu mmx getopts heaptrc lineinfo sockets aio varutils video mouse keyboard types
+override TARGET_UNITS+=$(SYSTEMUNIT) systhrds objpas strings netware winsock2 dos crt objects sysutils typinfo math cpu mmx getopts heaptrc lineinfo sockets aio varutils video mouse keyboard types nwsnut nwthread nwconio
 override TARGET_LOADERS+=nwpre prelude
 override TARGET_RSTS+=math typinfo varutils
 override INSTALL_FPCPACKAGE=y

+ 2 - 1
rtl/netware/Makefile.fpc

@@ -13,7 +13,8 @@ units=$(SYSTEMUNIT) systhrds objpas strings \
       sysutils typinfo math \
       cpu mmx getopts heaptrc lineinfo \
       sockets aio varutils \
-      video mouse keyboard types
+      video mouse keyboard types \
+      nwsnut nwthread nwconio
 rsts=math typinfo varutils
 
 [require]

+ 8 - 3
rtl/netware/README

@@ -1,6 +1,8 @@
     News
     ====
 
+    2003/02/16 armin:
+     - added nwconio, nwthreads, nwsnut
     2003/02/15 armin:
      - changes for new threadvars
     2002/02/27 armin:
@@ -51,9 +53,9 @@
 
     Binutils-2.11 for win32 and RedHat 7.2 with netware support and a patched nlmconv
     that supports "copyright" are available from:
-           http://home.t-online.de/home/armin-diehl/fpcnw
-      or
-           http://members.tripod.de/adiehl/fpcnw
+           http://home.arcor.de/armin.diehl/fpcnw
+	  
+    The copyright-patch is included in newer versions of binutils (2.13)
 
 
     Building the freepascal runtime-library for netware
@@ -211,6 +213,9 @@
         - MMX
 	- WinSock2
 	- SYSTHRDS
+	- nwconio
+	- nwthreads
+	- nwsnut
 
 
 [email protected]

+ 141 - 0
rtl/netware/nwconio.pp

@@ -0,0 +1,141 @@
+{
+    $Id$
+    This file is part of the Free Pascal run time library
+    for Netware.
+    Copyright (c) 1999-2003 by the Free Pascal development team.
+
+    See the file COPYING.FPC, included in this distribution,
+    for details about the copyright.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+					    
+**********************************************************************}
+
+unit nwconio;
+interface
+
+{$mode objfpc}
+
+  const
+    ClibNlm    = 'clib';
+    ThreadsNlm = 'threads';
+
+
+{$PACKRECORDS C}
+
+
+  const
+     DONT_AUTO_ACTIVATE              = 1;
+     DONT_SWITCH_SCREEN              = 2;
+     DONT_CHECK_CTRL_CHARS           = $10;
+     AUTO_DESTROY_SCREEN             = $20;
+     POP_UP_SCREEN                   = $40;
+     UNCOUPLED_CURSORS               = $80;
+     HAS_A_CLIB_HANDLE               = $100;
+     _KEYBOARD_INPUT_ACTIVE          = $00010000;
+     _PROCESS_BLOCKED_ON_KEYBOARD    = $00020000;
+     _PROCESS_BLOCKED_ON_SCREEN      = $00040000;
+     _INPUT_CURSOR_DISABLED          = $00080000;
+     _SCREEN_HAS_TITLE_BAR           = $00400000;
+     _NON_SWITCHABLE_SCREEN          = $01000000;
+
+  function getch :longint;                                cdecl;external ThreadsNlm name 'getch';
+  function getche:longint;                                cdecl;external ThreadsNlm name 'getche';
+  function kbhit :longint;                                cdecl;external ThreadsNlm name 'kbhit';
+  function putch(c:longint):longint;                      cdecl;external ThreadsNlm name 'putch';
+  function ungetch(c:longint):longint;                    cdecl;external ThreadsNlm name 'ungetch';
+  function cgets(buf:Pchar):Pchar;                        cdecl;external ThreadsNlm name 'cgets';
+  function CheckIfScreenDisplayed(screenHandle:longint; waitFlag:longint):longint;
+                                                          cdecl;external ThreadsNlm name 'CheckIfScreenDisplayed';
+  procedure clrscr;                                       cdecl;external ThreadsNlm name 'clrscr';
+
+  procedure ConsolePrintf(format:Pchar; args:array of const);
+                                                          cdecl;external ClibNlm name 'ConsolePrintf';
+  procedure ConsolePrintf(format:Pchar);                  cdecl;external ClibNlm name 'ConsolePrintf';
+
+  procedure CopyToScreenMemory(height,width:word; Rect:PBYTE; begx,begy:word);cdecl;external ThreadsNlm name 'CopyToScreenMemory';
+  procedure CopyToScreenMemory(height,width:word; var Rect:byte; begx,begy:word);cdecl;external ThreadsNlm name 'CopyToScreenMemory';
+
+  procedure CopyFromScreenMemory(height, width:word; Rect:PBYTE; begx,begy:word);cdecl;external ThreadsNlm name 'CopyFromScreenMemory';
+  procedure CopyFromScreenMemory(height, width:word; var Rect:byte; begx,begy:word);cdecl;external ThreadsNlm name 'CopyFromScreenMemory';
+
+  { function CoupleInputOutputCursors:longint;cdecl;external ClibNlm name 'CoupleInputOutputCursors'; }
+
+  function cputs(buf:Pchar):longint;                      cdecl;external ThreadsNlm name 'cputs';
+  function cprintf(fmt:Pchar; args:array of const):longint;
+                                                          cdecl;external ClibNlm name 'cprintf';
+  function cprintf(fmt:Pchar):longint;                    cdecl;external ClibNlm name 'cprintf';
+
+  function CreateScreen(screenName:Pchar; attr:byte):longint;
+                                                          cdecl;external ThreadsNlm name 'CreateScreen';
+
+  function cscanf(fmt:Pchar; args:array of const):longint;cdecl;external ClibNlm name 'cscanf';
+  function cscanf(fmt:Pchar):longint;                     cdecl;external ClibNlm name 'cscanf';
+
+  { function DecoupleInputOutputCursors:longint;cdecl;external External_library name 'DecoupleInputOutputCursors'; }
+
+  function DestroyScreen(screenHandle:longint):longint;   cdecl;external ThreadsNlm name 'DestroyScreen';
+  function DisplayInputCursor:longint;                    cdecl;external ThreadsNlm name 'DisplayInputCursor';
+  function DisplayScreen(screenHandle:longint):longint;   cdecl;external ThreadsNlm name 'DisplayScreen';
+  function DropPopUpScreen(screenHandle:longint):longint; cdecl;external ThreadsNlm name 'DropPopUpScreen';
+  function GetCurrentScreen:longint;                      cdecl;external ThreadsNlm name 'GetCurrentScreen';
+  function GetCursorCouplingMode:byte;                    cdecl;external ThreadsNlm name 'GetCursorCouplingMode';
+  function GetCursorShape(startline,endline:byte):word;   cdecl;external ThreadsNlm name 'GetCursorShape';
+  function GetCursorSize(var firstline,lastl:byte):word;  cdecl;external ThreadsNlm name 'GetCursorSize';
+
+  function GetPositionOfOutputCursor(var row,columnP:word):longint;
+                                                          cdecl;external ThreadsNlm name 'GetPositionOfOutputCursor';
+
+  function __GetScreenID(screenHandle:longint):longint;   cdecl;external ThreadsNlm name '__GetScreenID';
+  function GetScreenInfo(handle:longint; name:Pchar; var attr:longint):longint;
+                                                          cdecl;external ThreadsNlm name 'GetScreenInfo';
+
+  function GetSizeOfScreen(var height,width:word):longint;cdecl;external ThreadsNlm name 'GetSizeOfScreen';
+  procedure gotoxy(x,y:word);                             cdecl;external ThreadsNlm name 'gotoxy';
+  function HideInputCursor:longint;                       cdecl;external ThreadsNlm name 'HideInputCursor';
+  function IsColorMonitor:longint;                        cdecl;external ThreadsNlm name 'IsColorMonitor';
+  function PressAnyKeyToContinue:longint;                 cdecl;external ThreadsNlm name 'PressAnyKeyToContinue';
+  function PressEscapeToQuit:longint;                     cdecl;external ThreadsNlm name 'PressEscapeToQuit';
+  procedure RingTheBell;                                  cdecl;external ThreadsNlm name 'RingTheBell';
+
+  function ScanScreens(LastScreenID:longint; name:Pchar; var attr:longint):longint;
+                                                          cdecl;external ThreadsNlm name 'ScanScreens';
+
+  function ScrollScreenRegionDown(firstLine,lines:longint):longint;cdecl;external ThreadsNlm name 'ScrollScreenRegionDown';
+  function ScrollScreenRegionUp(firstLine,lines:longint):longint;cdecl;external ThreadsNlm name 'ScrollScreenRegionUp';
+  function SetAutoScreenDestructionMode(newMode:byte):byte;cdecl;external ThreadsNlm name 'SetAutoScreenDestructionMode';
+  function SetCtrlCharCheckMode(newMode:byte):byte;        cdecl;external ThreadsNlm name 'SetCtrlCharCheckMode';
+  function SetCursorCouplingMode(newMode:byte):byte;       cdecl;external ThreadsNlm name 'SetCursorCouplingMode';
+  function SetCursorShape(startline,endline:byte):word;    cdecl;external ThreadsNlm name 'SetCursorShape';
+  function SetCurrentScreen(screenHandle:longint):longint; cdecl;external ThreadsNlm name 'SetCurrentScreen';
+  function SetInputAtOutputCursorPosition:longint;         cdecl;external ThreadsNlm name 'SetInputAtOutputCursorPosition';
+  function SetOutputAtInputCursorPosition:longint;         cdecl;external ThreadsNlm name 'SetOutputAtInputCursorPosition';
+  function SetPositionOfInputCursor(row,col:word):longint; cdecl;external ThreadsNlm name 'SetPositionOfInputCursor';
+
+  function SetScreenAreaAttribute(line,column,numLines,numColumns,attr:longint):longint;
+                                                           cdecl;external ThreadsNlm name 'SetScreenAreaAttribute';
+  {function SetScreenAttributes(mask,attr:longint):longint; cdecl;external ClibNlm name 'SetScreenAttributes';}
+
+  function SetScreenCharacterAttribute(line,column,attr:longint):longint;
+                                                           cdecl;external ThreadsNlm name 'SetScreenCharacterAttribute';
+
+  function SetScreenRegionAttribute(firstLine,lines:longint; attr:byte):longint;
+                                                           cdecl;external ThreadsNlm name 'SetScreenRegionAttribute';
+  function wherex:word;                                    cdecl;external ThreadsNlm name 'wherex';
+  function wherey:word;                                    cdecl;external ThreadsNlm name 'wherey';
+
+
+implementation
+
+
+end.
+
+{
+  $Log$
+  Revision 1.1  2003-02-16 17:45:08  armin
+  * added nwsnut, nwconio and nwthreads for netware
+
+ 
+}

+ 1518 - 0
rtl/netware/nwsnut.pp

@@ -0,0 +1,1518 @@
+{
+    $Id$
+    This file is part of the Free Pascal run time library
+    for Netware.
+    Copyright (c) 1999-2003 by the Free Pascal development team.
+		
+    See the file COPYING.FPC, included in this distribution,
+    for details about the copyright.
+			
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+				    
+**********************************************************************}
+
+unit nwsnut;
+
+interface
+
+{$mode objfpc}
+
+  const
+    External_library='nwsnut';
+
+  Type
+    PLongint  = ^Longint;
+    PSmallInt = ^SmallInt;
+    PByte     = ^Byte;
+    PPByte    = ^PByte;
+    PWord     = ^Word;
+    PDWord    = ^DWord;
+    PDouble   = ^Double;
+    TLONG = longint;
+    PLONG = ^TLONG;
+    TWORD = word;
+    TBYTE = byte;
+    PScreenStruct = pointer;
+
+{$PACKRECORDS C}
+
+  type
+     LONG = dword;
+
+  const
+     NULL = 0;
+     
+  { constants  
+    the constant CURRENT_NUT_VERSION is incremented when increased
+    functionality is added. An NLM can check this value which is placed
+    in the NUTInfo structure, version field, to determine if the NWSNUT
+    NLM contains sufficient functionality to support its requirements  }
+
+  const
+     CURRENT_NUT_VERSION = 405;
+  { the constant NUT_REVISION_LEVEL is incremented when a major change
+    in the behavior of NWSNUT is made. This value is not used by the calling
+    NLM, but rather by NWSNUT itself to determine what is expected of it
+    by the calling NLM  }
+     NUT_REVISION_LEVEL = 1;
+     SAVE = 1;
+     NO_SAVE = 0;
+     NOHEADER = 0;
+     NOBORDER = 0;
+     NO_HELP_CONTEXT = $ffff;
+     SINGLE = 1;
+     DOUBLE = 2;
+     CURSOR_OFF = 0;
+     CURSOR_ON = 1;
+     VIRTUAL = 0;
+     DIRECT = 1;
+     SEVERITY_INFORM = 1;
+     SEVERITY_WARNING = 2;
+     SEVERITY_FATAL = 3;
+  { text size minimization styles  }
+     SNORMAL = 0;
+     SMINWIDTH = 1;
+     SMINHEIGHT = 2;
+  { palettes to set screen colors.
+  	background and foreground can be reversed with VREVERSE
+   }
+  { white and black  }
+     BW_PALETTE = 0;
+  { white and dark blue  }
+     NORMAL_PALETTE = 1;
+  { light blue and dark blue  }
+     INIT_PALETTE = 2;
+  { green and black  }
+     HELP_PALETTE = 3;
+  { red and black  }
+     ERROR_PALETTE = 4;
+  { pink and white  }
+     WARNING_PALETTE = 5;
+  { green and red  }
+     OTHER_PALETTE = 6;
+  { text and portal justification styles  }
+     JRIGHT = 0;
+     JLEFT = 1;
+     JTOP = 2;
+     JBOTTOM = 3;
+     JCENTER = 4;
+     JTOPRIGHT = 5;
+     JTOPLEFT = 6;
+     JBOTTOMLEFT = 7;
+     JBOTTOMRIGHT = 8;
+  { video constants  }
+     V_UP = 6;
+     V_DOWN = 7;
+     LINE_OFFSET = 160;
+     EXPLODE_RATE = 45;
+     SCREEN_SPEED = 0;
+  { video attributes  }
+     VNORMAL = 0;
+     VINTENSE = 1;
+     VREVERSE = 2;
+     VBLINK = 3;
+     VIBLINK = 4;
+     VRBLINK = 5;
+  { header types  }
+     NO_HEADER = 0;
+     SMALL_HEADER = 1;
+     NORMAL_HEADER = 2;
+     LARGE_HEADER = 3;
+  { keyboard constants  }
+     KS_OFF = 0;
+     KS_ON = 1;
+     KS_INT = 2;
+     K_NORMAL = 0;
+     K_F1 = 1;
+     K_F2 = 2;
+     K_F3 = 3;
+     K_F4 = 4;
+     K_F5 = 5;
+     K_F6 = 6;
+     K_F7 = 7;
+     K_F8 = 8;
+     K_F9 = 9;
+     K_F10 = 10;
+     K_SF1 = 11;
+     K_SF2 = 12;
+     K_SF3 = 13;
+     K_SF4 = 14;
+     K_SF5 = 15;
+     K_SF6 = 16;
+     K_SF7 = 17;
+     K_SF8 = 18;
+     K_SF9 = 19;
+     K_SF10 = 20;
+     K_CF1 = 21;
+     K_CF2 = 22;
+     K_CF3 = 23;
+     K_CF4 = 24;
+     K_CF5 = 25;
+     K_CF6 = 26;
+     K_CF7 = 27;
+     K_CF8 = 28;
+     K_CF9 = 29;
+     K_CF10 = 30;
+     K_AF1 = 31;
+     K_AF2 = 32;
+     K_AF3 = 33;
+     K_AF4 = 34;
+     K_AF5 = 35;
+     K_AF6 = 36;
+     K_AF7 = 37;
+     K_AF8 = 38;
+     K_AF9 = 39;
+     K_AF10 = 40;
+     K_HELP = 1;
+     K_MODIFY = 3;
+     K_MARK = 5;
+     K_CANCEL = 7;
+     K_MODE = 9;
+     K_EXIT = 40;
+     K_ESCAPE = 41;
+     K_BACK = 42;
+     K_INSERT = 43;
+     K_DELETE = 44;
+     K_SELECT = 45;
+     K_CYCLE = 46;
+     K_UP = 47;
+     K_DOWN = 48;
+     K_LEFT = 49;
+     K_RIGHT = 50;
+     K_SUP = 51;
+     K_SDOWN = 52;
+     K_SLEFT = 53;
+     K_SRIGHT = 54;
+     K_PUP = 55;
+     K_PDOWN = 56;
+     K_FRIGHT = 57;
+     K_FLEFT = 58;
+     K_DELETE_END = 59;
+  {
+  For NWSUngetKey of function keys, use UGK_FUNCTION_KEY for the "type"
+  parameter and "K_F1" etc. for the "value" parameter
+   }
+     UGK_NORMAL_KEY = $00;
+     UGK_FUNCTION_KEY = $01;
+  {
+  For other special keys listed below, use UGK_NORMAL_KEY for the "value"
+  parameter, and the UGK_xxx for the "type" parameter.
+   }
+     UGK_ENTER_KEY = $02;
+     UGK_ESCAPE_KEY = $03;
+     UGK_BACKSPACE_KEY = $04;
+     UGK_DELETE_KEY = $05;
+     UGK_INSERT_KEY = $06;
+     UGK_CURSOR_UP_KEY = $07;
+     UGK_CURSOR_DOWN_KEY = $08;
+     UGK_CURSOR_RIGHT_KEY = $09;
+     UGK_CURSOR_LEFT_KEY = $0a;
+     UGK_CURSOR_HOME_KEY = $0b;
+     UGK_CURSOR_END_KEY = $0c;
+     UGK_CURSOR_PUP_KEY = $0d;
+     UGK_CURSOR_PDOWN_KEY = $0e;
+  {
+  Added in version 403
+  
+  A special key type to cause LISTs to refresh. K_REFRESH_KEY may be returned
+  from an action procedure passed to NWSList, or another thread that wishes
+  to cause a list to refresh may call NWSUngetKey with the UGK version of this,
+  and it too will cause the list to be redrawn.
+  
+  Use "type" = UGK_SPECIAL_KEY, and "value" = UGK_REFRESH_KEY
+   }
+     UGK_SPECIAL_KEY = 3;
+     UGK_REFRESH_KEY = $22222222;
+     K_REFRESH_KEY = UGK_REFRESH_KEY;
+     OLD_REFRESH_KEY = 222;
+  { available action keys for list  }
+     M_ESCAPE = $0001;
+     M_INSERT = $0002;
+     M_DELETE = $0004;
+     M_MODIFY = $0008;
+     M_SELECT = $0010;
+  { marked delete  }
+     M_MDELETE = $0020;
+     M_CYCLE = $0040;
+  { marked modify  }
+     M_MMODIFY = $0080;
+  { marked select  }
+     M_MSELECT = $0100;
+  { don't sort list  }
+     M_NO_SORT = $0200;
+  { allow the list to be refreshed  }
+     M_REFRESH = $0400;
+  { return values for EditString  }
+     E_ESCAPE = 1;
+     E_SELECT = 2;
+     E_EMPTY = 4;
+     E_CHANGE = 8;
+  { type values for EditString  }
+     EF_ANY = $0001;
+     EF_DECIMAL = $0002;
+     EF_HEX = $0004;
+     EF_NOSPACES = $0008;
+     EF_UPPER = $0010;
+     EF_DATE = $0020;
+     EF_TIME = $0040;
+     EF_FLOAT = $0080;
+     EF_SET = $0100;
+     EF_NOECHO = $0200;
+     EF_FILENAME = $0400;
+  { added in version 404  }
+     EF_MASK = $0800;
+  { and in version 405  }
+     EF_NOCONFIRM_EXIT = $1000;
+  { scroll bar stuff for NWSEditTextWithScrollBars, and NWSViewTextWithScrollBars  }
+  { which scroll bars to show  }
+     SHOW_VERTICAL_SCROLL_BAR = 2;
+     SHOW_HORIZONTAL_SCROLL_BAR = 4;
+  { when to show the scroll bars. Use ONLY one of these  }
+     CONSTANT_SCROLL_BARS = $0200;
+     TEXT_SENSITIVE_SCROLL_BARS = $0400;
+     CONSIDER_LOCKED_FIELDS = $0800;
+  { character and key constants  }
+  { was #define dname def_expr }
+  function F_H1 : longint;
+      { return type might be wrong }
+
+  { Í  }
+  { was #define dname def_expr }
+  function F_H2 : longint;
+      { return type might be wrong }
+
+  { ³  }
+  { was #define dname def_expr }
+  function F_V1 : longint;
+      { return type might be wrong }
+
+  { º  }
+  { was #define dname def_expr }
+  function F_V2 : longint;
+      { return type might be wrong }
+
+  { Ú  }
+  { was #define dname def_expr }
+  function F_UL1 : longint;
+      { return type might be wrong }
+
+  { ¿  }
+  { was #define dname def_expr }
+  function F_UR1 : longint;
+      { return type might be wrong }
+
+  { À  }
+  { was #define dname def_expr }
+  function F_LL1 : longint;
+      { return type might be wrong }
+
+  { Ù  }
+  { was #define dname def_expr }
+  function F_LR1 : longint;
+      { return type might be wrong }
+
+  { É  }
+  { was #define dname def_expr }
+  function F_UL2 : longint;
+      { return type might be wrong }
+
+  { »  }
+  { was #define dname def_expr }
+  function F_UR2 : longint;
+      { return type might be wrong }
+
+  { È  }
+  { was #define dname def_expr }
+  function F_LL2 : longint;
+      { return type might be wrong }
+
+  { ¼  }
+  { was #define dname def_expr }
+  function F_LR2 : longint;
+      { return type might be wrong }
+
+  { Á  }
+  { was #define dname def_expr }
+  function F_UT1 : longint;
+      { return type might be wrong }
+
+  { Â  }
+  { was #define dname def_expr }
+  function F_DT1 : longint;
+      { return type might be wrong }
+
+  { ´  }
+  { was #define dname def_expr }
+  function F_LT1 : longint;
+      { return type might be wrong }
+
+  { Ã  }
+  { was #define dname def_expr }
+  function F_RT1 : longint;
+      { return type might be wrong }
+
+  { Ê  }
+  { was #define dname def_expr }
+  function F_UT2 : longint;
+      { return type might be wrong }
+
+  { Ë  }
+  { was #define dname def_expr }
+  function F_DT2 : longint;
+      { return type might be wrong }
+
+  { ¹  }
+  { was #define dname def_expr }
+  function F_LT2 : longint;
+      { return type might be wrong }
+
+  { Ì  }
+  { was #define dname def_expr }
+  function F_RT2 : longint;
+      { return type might be wrong }
+
+  { Å  }
+  { was #define dname def_expr }
+  function F_X1 : longint;
+      { return type might be wrong }
+
+  { Î  }
+  { was #define dname def_expr }
+  function F_X2 : longint;
+      { return type might be wrong }
+
+  {   }
+  { was #define dname def_expr }
+  function F_UP : longint;
+      { return type might be wrong }
+
+  {   }
+  { was #define dname def_expr }
+  function F_DOWN : longint;
+      { return type might be wrong }
+
+  {   }
+  { was #define dname def_expr }
+  function F_LEFT : longint;
+      { return type might be wrong }
+
+  {   }
+  { was #define dname def_expr }
+  function F_RIGHT : longint;
+      { return type might be wrong }
+
+  { °  }
+  { was #define dname def_expr }
+  function F_BG1 : longint;
+      { return type might be wrong }
+
+  { ±  }
+  { was #define dname def_expr }
+  function F_BG2 : longint;
+      { return type might be wrong }
+
+  { ²  }
+  { was #define dname def_expr }
+  function F_BG3 : longint;
+      { return type might be wrong }
+
+  { Û  }
+  { was #define dname def_expr }
+  function F_BG4 : longint;
+      { return type might be wrong }
+
+  { form constants (control flags)  }
+
+  const
+     F_NOVERIFY = $00;
+     F_VERIFY = $10;
+     F_FORCE = $20;
+  { a flag to pass if no help is desired in the form  }
+     F_NO_HELP = $ffffffff;
+  {    fieldFlags Type masks     }
+  { normal editable field  }
+     NORMAL_FIELD = $00;
+  { non accessable  }
+     LOCKED_FIELD = $01;
+  { non editable  }
+     SECURE_FIELD = $02;
+  { verify field on form exit  }
+     REQUIRED_FIELD = $04;
+  { hidden fields are also locked  }
+     HIDDEN_FIELD = $09;
+  { prompt fields are also locked  }
+     PROMPT_FIELD = $11;
+  { field locked by user, not by NUT  }
+     ULOCKED_FIELD = $0100;
+  { MASKED_FIELD added in version 402  }
+  { display ' ' for text   }
+     MASKED_FIELD = $200;
+  { flag to cause form deselection
+                                             before action & verify routines
+                                             are called  }
+     FORM_DESELECT = $20;
+  { In case old flag was used  }
+     NO_FORM_DESELECT = $00;
+  { normal field controlled justify  }
+     DEFAULT_FORMAT = $00;
+  { right justification format  }
+     RIGHT_FORMAT = $40;
+  { left justification format  }
+     LEFT_FORMAT = $80;
+  { centering format  }
+     CENTER_FORMAT = $C0;
+     MAXPORTALS = 50;
+     MAXLISTS = 20;
+     SAVELISTS = 20;
+     MAXACTIONS = 60;
+     MAXFUNCTIONS = MAXACTIONS;
+     MAXHELP = 30;
+     NO_MESSAGE = $ffff;
+     DYNAMIC_MESSAGE_ONE = $fffe;
+     DYNAMIC_MESSAGE_TWO = $fffd;
+     DYNAMIC_MESSAGE_THREE = $fffc;
+     DYNAMIC_MESSAGE_FOUR = $fffb;
+     DYNAMIC_MESSAGE_FIVE = $fffa;
+     DYNAMIC_MESSAGE_SIX = $fff9;
+     DYNAMIC_MESSAGE_SEVEN = $fff8;
+     DYNAMIC_MESSAGE_EIGHT = $fff7;
+     DYNAMIC_MESSAGE_NINE = $fff6;
+     DYNAMIC_MESSAGE_TEN = $fff5;
+     DYNAMIC_MESSAGE_ELEVEN = $fff4;
+     DYNAMIC_MESSAGE_TWELVE = $fff3;
+     DYNAMIC_MESSAGE_THIRTEEN = $fff2;
+     DYNAMIC_MESSAGE_FOURTEEN = $fff1;
+     SYSTEM_MESSAGE = $8000;
+  { was #define dname(params) para_def_expr }
+  { argument types are unknown }
+  { return type might be wrong }   
+  function IS_DYNAMIC_MESSAGE(a : longint) : boolean;
+
+
+  type
+     {PNUTInfo_ = ^TNUTInfo_;
+     TNUTInfo_ = record
+       end;}
+       
+       PNUTInfo_ = ^TNUTInfo_;
+
+  { height of virtual screen  }
+  { width of virtual screen  }
+  { top-most line of portal  }
+  { left-most column of portal  }
+  { position of portal over virtual portal  }
+  { position of portal over virtual portal  }
+  { the following fields should never be referenced by any application  }
+
+     PPCB_ = ^TPCB_;
+     TPCB_ = record
+          frameLine : TLONG;
+          frameColumn : TLONG;
+          frameHeight : TLONG;
+          frameWidth : TLONG;
+          virtualHeight : TLONG;
+          virtualWidth : TLONG;
+          cursorState : TLONG;
+          borderType : TLONG;
+          borderAttribute : TLONG;
+          saveFlag : TWORD;
+          secondarySaveFlag : TWORD;
+          directFlag : TLONG;
+          headerAttribute : TLONG;
+          portalLine : TLONG;
+          portalColumn : TLONG;
+          portalHeight : TLONG;
+          portalWidth : TLONG;
+          virtualLine : TLONG;
+          virtualColumn : TLONG;
+          cursorLine : TLONG;
+          cursorColumn : TLONG;
+          firstUpdateFlag : TLONG;
+          headerText : PBYTE;
+          headerText2 : PBYTE;
+          virtualScreen : PBYTE;
+          saveScreen : PBYTE;
+          screenID : PScreenStruct;
+          nutInfo : PNUTInfo_;
+          sequenceNumber : TLONG;
+          reserved1 : TLONG;
+          mtflags : TLONG;
+          borderPalette : TLONG;
+          showScrollBars : TLONG;
+          lastLine : TLONG;
+          longestLineLen : TLONG;
+          verticalScroll : TLONG;
+          horizontalScroll : TLONG;
+          oldVertical : TLONG;
+          oldHorizontal : TLONG;
+          deHighlightFunction : procedure (para1:PNUTInfo_; para2:PPCB_);cdecl;
+          reHighlightFunction : procedure (para1:PNUTInfo_; para2:PPCB_); cdecl;
+          reportPortalUpdate : procedure (para1:PPCB_; para2:PNUTInfo_; updateType:TLONG); cdecl;
+       end;
+     TPCB = TPCB_;
+     PPCB = ^TPCB;
+  { Topmost line of frame on physical screen  }
+  { Leftmost column of frame on physical screen  }
+  { Height of frame on physical screen  }
+  { Width of frame on physical screen  }
+  { Height of virtual screen  }
+  { Width of virtual screen  }
+  { Is the cursor on or off (1 or 0)  }
+  { Type of border to use  }
+  { Attribute to use with border  }
+  { TRUE = save old screen  }
+  { TRUE = no virtual screen  }
+  { Attribute of header text  }
+  { Pointer to header text  }
+  { Pointer to the help text, always assumed to  }
+  { be non NULL (when empty points to a '/0' BYTE  }
+
+     PHS_ = ^THS_;
+     THS_ = record
+          nextScreen : TLONG;
+          previousScreen : TLONG;
+          frameLine : TLONG;
+          frameColumn : TLONG;
+          frameHeight : TLONG;
+          frameWidth : TLONG;
+          virtualHeight : TLONG;
+          virtualWidth : TLONG;
+          cursorState : TLONG;
+          borderType : TLONG;
+          borderAttribute : TLONG;
+          saveFlag : TLONG;
+          directFlag : TLONG;
+          headerAttribute : TLONG;
+          headerText : PBYTE;
+          text : PBYTE;
+       end;
+     THELP_SCREEN = THS_;
+     PHELP_SCREEN = ^THELP_SCREEN;
+
+     PLIST_STRUCT = ^TLIST_STRUCT;
+     TLIST_STRUCT = record
+          prev : PLIST_STRUCT;
+          next : PLIST_STRUCT;
+          otherInfo : pointer;
+          marked : TLONG;
+          flags : TWORD;
+          maxSkew : TWORD;
+          entryProcedure : procedure (listElement:PLIST_STRUCT; displayLine:TLONG; NUTInfoStructure:pointer);cdecl;
+          extra : TLONG;
+          text : array[0..0] of TBYTE;
+       end;
+     TLIST = TLIST_STRUCT;
+     PLIST = ^TLIST;
+     PPLIST= ^PLIST;
+
+     PLP_ = ^TLP_;
+     TLP_ = record
+          head : pointer;
+          tail : pointer;
+          sortProc : function :longint;cdecl;
+          freeProcedure : procedure (memoryPointer:pointer);
+       end;
+     TLISTPTR = TLP_;
+     PLISTPTR = ^TLISTPTR;
+
+     PMI_ = ^TMI_;
+     TMI_ = record
+          dynamicMessageOne : PBYTE;
+          dynamicMessageTwo : PBYTE;
+          dynamicMessageThree : PBYTE;
+          dynamicMessageFour : PBYTE;
+          dynamicMessageFive : PBYTE;
+          dynamicMessageSix : PBYTE;
+          dynamicMessageSeven : PBYTE;
+          dynamicMessageEight : PBYTE;
+          dynamicMessageNine : PBYTE;
+          dynamicMessageTen : PBYTE;
+          dynamicMessageEleven : PBYTE;
+          dynamicMessageTwelve : PBYTE;
+          dynamicMessageThirteen : PBYTE;
+          dynamicMessageFourteen : PBYTE;
+          messageCount : TLONG;
+          programMesgTable : ^PBYTE;
+       end;
+     TMessageInfo = TMI_;
+     PMessageInfo = ^TMessageInfo;
+
+     PINT_ = ^TINT_;
+     TINT_ = record
+          interruptProc : procedure (handle:pointer);cdecl;
+          key : TLONG;
+       end;
+     TINTERRUPT = TINT_;
+     PINTERRUPT = ^TINTERRUPT;
+
+     PMP_ = ^TMP_;
+     TMP_ = record
+          listAction : function (option:longint; parameter:pointer):longint;cdecl;
+          parameter : pointer;
+       end;
+     TMENU_PARAMETER = TMP_;
+     PMENU_PARAMETER = ^TMENU_PARAMETER;
+  { environment structure  }
+  { always leave the following fields at the end of the struct.  They
+          should never be referenced directly by an application  }
+
+     
+     TNUTInfo_ = record
+          portal : array[0..(MAXPORTALS)-1] of PPCB;
+          currentPortal : TLONG;
+          headerHeight : TLONG;
+          waitFlag : TLONG;
+          listStack : array[0..(MAXLISTS)-1] of TLISTPTR;
+          saveStack : array[0..(SAVELISTS)-1] of TLISTPTR;
+          nextAvailList : TLONG;
+          head : PLIST;
+          tail : PLIST;
+          defaultCompareFunction : function (el1:PLIST; el2:PLIST):longint;cdecl;
+          freeProcedure : procedure (memoryPointer:pointer);
+          interruptTable : array[0..(MAXFUNCTIONS)-1] of procedure ;
+          functionKeyStatus : array[0..(MAXACTIONS)-1] of TLONG;
+          messages : TMessageInfo;
+          helpContextStack : array[0..(MAXHELP)-1] of TLONG;
+          currentPreHelpMessage : TLONG;
+          freeHelpSlot : longint;
+          redisplayFormFlag : TLONG;
+          preHelpPortal : TLONG;
+          helpActive : smallint;
+          errorDisplayActive : smallint;
+          helpPortal : TLONG;
+          waitPortal : TLONG;
+          errorPortal : TLONG;
+          resourceTag : pointer;
+          screenID : pointer;
+          helpScreens : PBYTE;
+          helpOffset : longint;
+          helpHelp : TLONG;
+          allocChain : pointer;
+          version : TLONG;
+          reserved : array[0..9] of TLONG;
+          moduleHandle : TLONG;
+          customData : pointer;
+          customDataRelease : procedure (theData:pointer; thisStructure:PNUTInfo_); cdecl;
+          displayErrorLabel : TLONG;
+          markBuffer : PBYTE;
+          markBufferLength : TLONG;
+          editBuffer : PBYTE;
+          editBufferLength : TLONG;
+          staticFlag : TLONG;
+          processID : TLONG;
+          mtflags : TLONG;
+          saveCurrentPortal : TLONG;
+          palette : TLONG;
+          nutDataHandle : pointer;
+          next : PNUTInfo_;
+          prev : PNUTInfo_;
+          listSortFunction : procedure (head:PLIST; tail:PLIST; thisStructure:PNUTInfo_); cdecl;
+          compatibilityLevel : TLONG;
+       end;
+     TNUTInfo = TNUTInfo_;
+     PNUTInfo = ^TNUTInfo;
+     PPNUTInfo= ^PNUTInfo;
+     
+  { menu header message number  }
+  { menu center line  }
+  { menu center column  }
+  { len of longest menu option  }
+  { menu action routine  }
+  { list head for menu list  }
+
+     PMFC_ = ^TMFC_;
+     TMFC_ = record
+          headernum : TLONG;
+          centerLine : TLONG;
+          centerColumn : TLONG;
+          maxoptlen : TLONG;
+          action : function (option:longint; parameter:pointer):longint;cdecl;
+          arg1 : TLONG;
+          arg2 : TLONG;
+          arg3 : TLONG;
+          arg4 : TLONG;
+          arg5 : TLONG;
+          arg6 : TLONG;
+          menuhead : TLISTPTR;
+          nutInfo : PNUTInfo;
+       end;
+     TMFCONTROL = TMFC_;
+     PMFCONTROL = ^TMFCONTROL;
+  { list element that owns the field  }
+  { Control flags  }
+  { Line where field is located  }
+  { Column where field is located  }
+  { Maximum width of field  }
+  { Display attribute for field  }
+  { Keys that will activate the field  }
+  { Routine called when field selected  }
+  { Routine to verify Input  }
+  { Data & Xtra field release routine  }
+  { Pointer to data  }
+  { Additional control info  }
+  { help context for this field  }
+  { Pointer to field above  }
+  { Pointer to field below  }
+  { Pointer to field to left  }
+  { Pointer to field to right  }
+  { Pointer to previous field  }
+  { Pointer to next field  }
+  { if this value is set, this routine will be called upon
+                  entry to each field  }
+  { this allows the user to have any sort of custom data that
+                  he wants attached to the field.  }
+  { and this lets him release it. Note that these parameters
+                  match NWSFree which allows the use of NWSAlloc for
+                  this data (a further guarantee that the memory will be freed  }
+  { handle to keep track of who owns the field  }
+
+     Pfielddef = ^Tfielddef;
+     Tfielddef = record
+          element : PLIST;
+          fieldFlags : TLONG;
+          fieldLine : TLONG;
+          fieldColumn : TLONG;
+          fieldWidth : TLONG;
+          fieldAttribute : TLONG;
+          fieldActivateKeys : longint;
+          fieldFormat : procedure (field:Pfielddef; text:PBYTE; buffLen:TLONG);cdecl;
+          fieldControl : function (field:Pfielddef; selectKey:longint; fieldChanged:Plongint; handle:PNUTInfo):TLONG;
+          fieldVerify : function (field:Pfielddef; data:PBYTE; handle:PNUTInfo):longint;
+          fieldRelease : procedure (para1:Pfielddef);
+          fieldData : PBYTE;
+          fieldXtra : PBYTE;
+          fieldHelp : longint;
+          fieldAbove : Pfielddef;
+          fieldBelow : Pfielddef;
+          fieldLeft : Pfielddef;
+          fieldRight : Pfielddef;
+          fieldPrev : Pfielddef;
+          fieldNext : Pfielddef;
+          fieldEntry : procedure (intoField:Pfielddef; fieldData:pointer; handle:PNUTInfo);
+          customData : pointer;
+          customDataRelease : procedure (fieldCustomData:pointer; handle:PNUTInfo);
+          nutInfo : PNUTInfo;
+       end;
+     TFIELD = Tfielddef;
+     PFIELD = ^TFIELD;
+  { Structures used for DisplayErrorCondition()  }
+
+     PPCERR_ = ^TPCERR_;
+     TPCERR_ = record
+          ccodeReturned : longint;
+          errorMessageNumber : longint;
+       end;
+     TPROCERROR = TPCERR_;
+     PPROCERROR = ^TPROCERROR;
+
+     PNA_ = ^TNA_;
+     TNA_ = record
+          address : pointer;
+          next : pointer;
+       end;
+     TNUT_ALLOC = TNA_;
+     PNUT_ALLOC = ^TNUT_ALLOC;
+{ C++ extern C conditionnal removed }
+  { CLIB screen ID  }
+  { OS ResourceTagStructure  }
+
+  function NWSInitializeNut(utility:TLONG; version:TLONG; headerType:TLONG; compatibilityLevel:TLONG; messageTable:PPBYTE; 
+             helpScreens:PBYTE; screenID:longint; resourceTag:TLONG; handle:PPNUTInfo):longint;cdecl;external External_library name 'NWSInitializeNut';
+
+  procedure NWSScreenSize(maxLines:PLONG; maxColumns:PLONG);cdecl;external External_library name 'NWSScreenSize';
+
+  procedure NWSShowPortalLine(line:TLONG; column:TLONG; text:PBYTE; length:TLONG; portal:PPCB);cdecl;external External_library name 'NWSShowPortalLine';
+
+  procedure NWSShowPortalLineAttribute(line:TLONG; column:TLONG; text:PBYTE; attribute:TLONG; length:TLONG; 
+              portal:PPCB);cdecl;external External_library name 'NWSShowPortalLineAttribute';
+
+  procedure NWSScrollPortalZone(line:TLONG; column:TLONG; height:TLONG; width:TLONG; attribute:TLONG; 
+              count:TLONG; direction:TLONG; portal:PPCB);cdecl;external External_library name 'NWSScrollPortalZone';
+
+  procedure NWSFillPortalZone(line:TLONG; column:TLONG; height:TLONG; width:TLONG; fillCharacter:TLONG; 
+              fillAttribute:TLONG; portal:PPCB);cdecl;external External_library name 'NWSFillPortalZone';
+
+  procedure NWSFillPortalZoneAttribute(line:TLONG; column:TLONG; height:TLONG; width:TLONG; attribute:TLONG; 
+              portal:PPCB);cdecl;external External_library name 'NWSFillPortalZoneAttribute';
+
+  function NWSGetMessage(message:TLONG; messages:PMessageInfo):PBYTE;cdecl;external External_library name 'NWSGetMessage';
+
+  procedure NWSSetDynamicMessage(message:TLONG; text:PBYTE; messages:PMessageInfo);cdecl;external External_library name 'NWSSetDynamicMessage';
+
+  function NWSCreatePortal(line:TLONG; column:TLONG; frameHeight:TLONG; frameWidth:TLONG; virtualHeight:TLONG; 
+             virtualWidth:TLONG; saveFlag:TLONG; headerText:PBYTE; headerAttribute:TLONG; borderType:TLONG; 
+             borderAttribute:TLONG; cursorFlag:TLONG; directFlag:TLONG; handle:PNUTInfo):TLONG;cdecl;external External_library name 'NWSCreatePortal';
+
+  procedure NWSDestroyPortal(portalNumber:TLONG; handle:PNUTInfo);cdecl;external External_library name 'NWSDestroyPortal';
+
+  procedure NWSPositionPortalCursor(line:TLONG; column:TLONG; portal:PPCB);cdecl;external External_library name 'NWSPositionPortalCursor';
+
+  procedure NWSEnablePortalCursor(portal:PPCB);cdecl;external External_library name 'NWSEnablePortalCursor';
+
+  procedure NWSDisablePortalCursor(portal:PPCB);cdecl;external External_library name 'NWSDisablePortalCursor';
+
+  procedure NWSDeselectPortal(handle:PNUTInfo);cdecl;external External_library name 'NWSDeselectPortal';
+
+  procedure NWSSelectPortal(portalNumber:TLONG; handle:PNUTInfo);cdecl;external External_library name 'NWSSelectPortal';
+
+  function NWSComputePortalPosition(centerLine:TLONG; centerColumn:TLONG; height:TLONG; width:TLONG; line:PLONG; 
+             column:PLONG; handle:PNUTInfo):longint;cdecl;external External_library name 'NWSComputePortalPosition';
+
+  procedure NWSClearPortal(portal:PPCB);cdecl;external External_library name 'NWSClearPortal';
+
+type TFreeRoutine = procedure (memoryPointer:pointer); cdecl;
+
+  procedure NWSInitList(handle:PNUTInfo; freeRoutine:TFreeRoutine);cdecl;external External_library name 'NWSInitList';
+
+  function NWSPushList(handle:PNUTInfo):TLONG;cdecl;external External_library name 'NWSPushList';
+
+  function NWSPopList(handleNWS:PNUTInfo):TLONG;cdecl;external External_library name 'NWSPopList';
+
+  function NWSSaveList(listIndex:TLONG; handle:PNUTInfo):TLONG;cdecl;external External_library name 'NWSSaveList';
+
+  function NWSRestoreList(listIndex:TLONG; handle:PNUTInfo):TLONG;cdecl;external External_library name 'NWSRestoreList';
+
+  procedure NWSDestroyList(handle:PNUTInfo);cdecl;external External_library name 'NWSDestroyList';
+
+  procedure NWSDestroyMenu(handle:PNUTInfo);cdecl;external External_library name 'NWSDestroyMenu';
+
+  procedure NWSDestroyForm(handle:PNUTInfo);cdecl;external External_library name 'NWSDestroyForm';
+
+  function NWSAppendToList(text:PBYTE; otherInfo:pointer; handle:PNUTInfo):PLIST;cdecl;external External_library name 'NWSAppendToList';
+
+  function NWSDeleteFromList(el:PLIST; handle:PNUTInfo):PLIST;cdecl;external External_library name 'NWSDeleteFromList';
+
+  function NWSInsertInList(text:PBYTE; otherInfo:PBYTE; atElement:PLIST; handle:PNUTInfo):PLIST;cdecl;external External_library name 'NWSInsertInList';
+
+  function NWSGetListElementText(element:PLIST):PBYTE;cdecl;external External_library name 'NWSGetListElementText';
+
+  function NWSGetListHead(handle:PNUTInfo):PLIST;cdecl;external External_library name 'NWSGetListHead';
+
+  function NWSGetListTail(handle:PNUTInfo):PLIST;cdecl;external External_library name 'NWSGetListTail';
+
+  procedure NWSUnmarkList(handle:PNUTInfo);cdecl;external External_library name 'NWSUnmarkList';
+
+  procedure NWSSetList(listPtr:PLISTPTR; handle:PNUTInfo);cdecl;external External_library name 'NWSSetList';
+
+  procedure NWSGetList(listPtr:PLISTPTR; handle:PNUTInfo);cdecl;external External_library name 'NWSGetList';
+
+  function NWSIsAnyMarked(handle:PNUTInfo):TLONG;cdecl;external External_library name 'NWSIsAnyMarked';
+
+  procedure NWSPushMarks(handle:PNUTInfo);cdecl;external External_library name 'NWSPushMarks';
+
+  procedure NWSPopMarks(handle:PNUTInfo);cdecl;external External_library name 'NWSPopMarks';
+
+  procedure NWSSortList(handle:PNUTInfo);cdecl;external External_library name 'NWSSortList';
+
+  procedure NWSInitMenu(handle:PNUTInfo);cdecl;external External_library name 'NWSInitMenu';
+
+  procedure NWSInitForm(handle:PNUTInfo);cdecl;external External_library name 'NWSInitForm';
+
+  function NWSGetSortCharacter(charIndex:TLONG):TLONG;cdecl;external External_library name 'NWSGetSortCharacter';
+
+  function NWSGetLineDrawCharacter(charIndex:TLONG):TLONG;cdecl;external External_library name 'NWSGetLineDrawCharacter';
+
+  function NWSStrcat(_string:PBYTE; newStuff:PBYTE):TLONG;cdecl;external External_library name 'NWSStrcat';
+
+  procedure NWSMemmove(dest:pointer; source:pointer; len:longint);cdecl;external External_library name 'NWSMemmove';
+
+  function NWSToupper(ch:TBYTE):TBYTE;cdecl;external External_library name 'NWSToupper';
+
+  function NWSIsdigit(ch:TBYTE):longint;cdecl;external External_library name 'NWSIsdigit';
+
+  function NWSIsxdigit(ch:TBYTE):longint;cdecl;external External_library name 'NWSIsxdigit';
+
+  function NWSAsciiToInt(data:PBYTE):longint;cdecl;external External_library name 'NWSAsciiToInt';
+
+  function NWSAsciiToLONG(data:PBYTE):TLONG;cdecl;external External_library name 'NWSAsciiToLONG';
+
+  function NWSAsciiHexToInt(data:PBYTE):longint;cdecl;external External_library name 'NWSAsciiHexToInt';
+
+  procedure NWSWaitForEscape(handle:PNUTInfo);cdecl;external External_library name 'NWSWaitForEscape';
+
+  function NWSWaitForEscapeOrCancel(handle:PNUTInfo):longint;cdecl;external External_library name 'NWSWaitForEscapeOrCancel';
+
+  procedure NWSGetKey(_type:PLONG; value:PBYTE; handle:PNUTInfo);cdecl;external External_library name 'NWSGetKey';
+
+  function NWSKeyStatus(handle:PNUTInfo):TLONG;cdecl;external External_library name 'NWSKeyStatus';
+
+  function NWSUngetKey(_type:TLONG; value:TLONG; handle:PNUTInfo):TLONG;cdecl;external External_library name 'NWSUngetKey';
+
+  procedure NWSEnableFunctionKey(key:TLONG; handle:PNUTInfo);cdecl;external External_library name 'NWSEnableFunctionKey';
+
+  procedure NWSDisableFunctionKey(key:TLONG; handle:PNUTInfo);cdecl;external External_library name 'NWSDisableFunctionKey';
+
+  procedure NWSDisableInterruptKey(key:TLONG; handle:PNUTInfo);cdecl;external External_library name 'NWSDisableInterruptKey';
+
+type TInterruptProc = procedure (handle:pointer); cdecl;
+
+  procedure NWSEnableInterruptKey(key:TLONG; interruptProc:TInterruptProc; handle:PNUTInfo);cdecl;external External_library name 'NWSEnableInterruptKey';
+
+  procedure NWSSaveFunctionKeyList(keyList:PBYTE; handle:PNUTInfo);cdecl;external External_library name 'NWSSaveFunctionKeyList';
+
+  procedure NWSEnableFunctionKeyList(keyList:PBYTE; handle:PNUTInfo);cdecl;external External_library name 'NWSEnableFunctionKeyList';
+
+  procedure NWSSaveInterruptList(interruptList:PINTERRUPT; handle:PNUTInfo);cdecl;external External_library name 'NWSSaveInterruptList';
+
+  procedure NWSEnableInterruptList(interruptList:PINTERRUPT; handle:PNUTInfo);cdecl;external External_library name 'NWSEnableInterruptList';
+
+  procedure NWSDisableAllInterruptKeys(handle:PNUTInfo);cdecl;external External_library name 'NWSDisableAllInterruptKeys';
+
+  procedure NWSDisableAllFunctionKeys(handle:PNUTInfo);cdecl;external External_library name 'NWSDisableAllFunctionKeys';
+
+  procedure NWSEnableAllFunctionKeys(handle:PNUTInfo);cdecl;external External_library name 'NWSEnableAllFunctionKeys';
+
+  function NWSDisplayTextInPortal(line:TLONG; indentLevel:TLONG; text:PBYTE; attribute:TLONG; portal:PPCB):longint;cdecl;external External_library name 'NWSDisplayTextInPortal';
+
+  function NWSDisplayInformation(header:TLONG; pauseFlag:TLONG; centerLine:TLONG; centerColumn:TLONG; palette:TLONG; 
+             attribute:TLONG; displayText:PBYTE; handle:PNUTInfo):TLONG;cdecl;external External_library name 'NWSDisplayInformation';
+
+  procedure NWSStartWait(centerLine:TLONG; centerColumn:TLONG; handle:PNUTInfo);cdecl;external External_library name 'NWSStartWait';
+
+  procedure NWSEndWait(handle:PNUTInfo);cdecl;external External_library name 'NWSEndWait';
+
+  function NWSAlert(centerLine:TLONG; centerColumn:TLONG; handle:PNUTInfo; message:TLONG; args:array of const):TLONG;cdecl;external External_library name 'NWSAlert';
+
+  function NWSAlert(centerLine:TLONG; centerColumn:TLONG; handle:PNUTInfo; message:TLONG):TLONG;cdecl;external External_library name 'NWSAlert';
+
+  function NWSAlertWithHelp(centerLine:TLONG; centerColumn:TLONG; handle:PNUTInfo; message:TLONG; helpContext:TLONG; 
+             args:array of const):TLONG;cdecl;external External_library name 'NWSAlertWithHelp';
+
+  function NWSAlertWithHelp(centerLine:TLONG; centerColumn:TLONG; handle:PNUTInfo; message:TLONG; helpContext:TLONG):TLONG;cdecl;external External_library name 'NWSAlertWithHelp';
+
+  function NWSTrace(handle:PNUTInfo; message:PBYTE; args:array of const):TLONG;cdecl;external External_library name 'NWSTrace';
+
+  function NWSTrace(handle:PNUTInfo; message:PBYTE):TLONG;cdecl;external External_library name 'NWSTrace';
+
+  procedure NWSDisplayErrorText(message:TLONG; severity:TLONG; handle:PNUTInfo; args:array of const);cdecl;external External_library name 'NWSDisplayErrorText';
+
+  procedure NWSDisplayErrorText(message:TLONG; severity:TLONG; handle:PNUTInfo);cdecl;external External_library name 'NWSDisplayErrorText';
+
+  procedure NWSDisplayErrorCondition(procedureName:PBYTE; errorCode:longint; severity:TLONG; errorList:PPROCERROR; handle:PNUTInfo; 
+              args:array of const);cdecl;external External_library name 'NWSDisplayErrorCondition';
+
+  procedure NWSDisplayErrorCondition(procedureName:PBYTE; errorCode:longint; severity:TLONG; errorList:PPROCERROR; handle:PNUTInfo);cdecl;external External_library name 'NWSDisplayErrorCondition';
+
+  function NWSAppendToMenu(message:TLONG; option:TLONG; handle:PNUTInfo):PLIST;cdecl;external External_library name 'NWSAppendToMenu';
+
+type TActionFunc = function (option:longint; parameter:pointer) : longint; cdecl;
+
+  function NWSMenu(header:TLONG; centerLine:TLONG; centerColumn:TLONG; defaultElement:PLIST; action:TActionFunc; 
+             handle:PNUTInfo; actionParameter:pointer):longint;cdecl;external External_library name 'NWSMenu';
+
+  function NWSConfirm(header:TLONG; centerLine:TLONG; centerColumn:TLONG; defaultChoice:TLONG; action:TActionFunc; 
+             handle:PNUTInfo; actionParameter:pointer):longint;cdecl;external External_library name 'NWSConfirm';
+
+  function NWSPushHelpContext(helpContext:TLONG; handle:PNUTInfo):longint;cdecl;external External_library name 'NWSPushHelpContext';
+
+  function NWSPopHelpContext(handle:PNUTInfo):longint;cdecl;external External_library name 'NWSPopHelpContext';
+
+type TFormatFunc=function (element:PLIST; skew:TLONG; displayLine:PBYTE; width:TLONG):TLONG; cdecl;
+     TNWSListActionFunc=function (keyPressed:TLONG; elementSelected:PPLIST; itemLineNumber:PLONG; actionParameter:pointer):longint;  cdecl;
+     
+  function NWSList(header:TLONG; centerLine:TLONG; centerColumn:TLONG; height:TLONG; width:TLONG; 
+             validKeyFlags:TLONG; element:PPLIST; handle:PNUTInfo; format:TFormatFunc; action:TNWSListActionFunc;
+             actionParameter:pointer):TLONG;cdecl;external External_library name 'NWSList';
+
+type TInsertFunc = function (text:PBYTE; otherInfo:Ppointer; parameters:pointer):longint; cdecl;
+     TFreeProcedure=function (otherInfo:pointer):longint; cdecl;
+     
+  function NWSInsertInPortalList(currentElement:PPLIST; currentLine:PLONG; InsertProcedure:TInsertFunc; FreeProcedure:TFreeProcedure; handle:PNUTInfo; 
+             parameters:pointer):longint;cdecl;external External_library name 'NWSInsertInPortalList';
+
+type TModifyProcedure=function (text:PBYTE; parameters:pointer):longint;  cdecl;
+
+  function NWSModifyInPortalList(currentElement:PPLIST; currentLine:PLONG; ModifyProcedure:TModifyProcedure; handle:PNUTInfo; parameters:pointer):longint;cdecl;external External_library name 'NWSModifyInPortalList';
+
+type TDeleteFunc = function (el:PLIST; handle:PNUTInfo; parameters:pointer):PLIST; cdecl;
+  function NWSDeleteFromPortalList(currentElement:PPLIST; currentLine:PLONG; DeleteProcedure:TDeleteFunc; deleteCurrentHeader:TLONG; deleteMarkedHeader:TLONG; 
+             handle:PNUTInfo; parameters:pointer):longint;cdecl;external External_library name 'NWSDeleteFromPortalList';
+
+type TNWSEditInsertFunc=function (buffer:PBYTE; maxLen:TLONG; parameters:pointer):longint; cdecl;
+     TNWSEditActionFunc=function (action:TLONG; buffer:PBYTE; parameters:pointer):longint; cdecl;
+
+  function NWSEditString(centerLine:TLONG; centerColumn:TLONG; editHeight:TLONG; editWidth:TLONG; header:TLONG; 
+             prompt:TLONG; buf:PBYTE; maxLen:TLONG; _type:TLONG; handle:PNUTInfo; 
+             insertProc:TNWSEditInsertFunc; actionProc:TNWSEditActionFunc; parameters:pointer):longint;cdecl;external External_library name 'NWSEditString';
+
+  function NWSAppendIntegerField(line:TLONG; column:TLONG; fflag:TLONG; data:Plongint; minimum:longint; 
+             maximum:longint; help:TLONG; handle:PNUTInfo):PFIELD;cdecl;external External_library name 'NWSAppendIntegerField';
+
+  function NWSAppendUnsignedIntegerField(line:TLONG; column:TLONG; fflag:TLONG; data:PLONG; minimum:TLONG; 
+             maximum:TLONG; help:TLONG; handle:PNUTInfo):PFIELD;cdecl;external External_library name 'NWSAppendUnsignedIntegerField';
+
+  function NWSAppendHexField(line:TLONG; column:TLONG; fflag:TLONG; data:Plongint; minimum:longint; 
+             maximum:longint; help:TLONG; handle:PNUTInfo):PFIELD;cdecl;external External_library name 'NWSAppendHexField';
+
+  procedure NWSDisplayPreHelp(line:TLONG; column:TLONG; message:TLONG; handle:PNUTInfo);cdecl;external External_library name 'NWSDisplayPreHelp';
+
+  procedure NWSRemovePreHelp(handle:PNUTInfo);cdecl;external External_library name 'NWSRemovePreHelp';
+
+  function NWSGetADisk(volName:PBYTE; prompt:PBYTE; handle:PNUTInfo):TLONG;cdecl;external External_library name 'NWSGetADisk';
+
+  procedure NWSInitListPtr(listPtr:PLISTPTR);cdecl;external External_library name 'NWSInitListPtr';
+
+  function NWSEditForm(headernum:TLONG; line:TLONG; col:TLONG; portalHeight:TLONG; portalWidth:TLONG; 
+             virtualHeight:TLONG; virtualWidth:TLONG; ESCverify:TLONG; forceverify:TLONG; confirmMessage:TLONG; 
+             handle:PNUTInfo):longint;cdecl;external External_library name 'NWSEditForm';
+
+  function NWSEditPortalFormField(header:TLONG; cline:TLONG; ccol:TLONG; formHeight:TLONG; formWidth:TLONG; 
+             controlFlags:TLONG; formHelp:TLONG; confirmMessage:TLONG; startField:PFIELD; handle:PNUTInfo):longint;cdecl;external External_library name 'NWSEditPortalFormField';
+
+  function NWSEditPortalForm(header:TLONG; centerLine:TLONG; centerColumn:TLONG; formHeight:TLONG; formWidth:TLONG; 
+             controlFlags:TLONG; formHelp:TLONG; confirmMessage:TLONG; handle:PNUTInfo):longint;cdecl;external External_library name 'NWSEditPortalForm';
+
+type TfFormat  = procedure (field:Pfielddef; text:PBYTE; buffLen:TLONG); cdecl;
+     TfControl = function (field:Pfielddef; selectKey:longint; fieldChanged:Plongint; handle:PNUTInfo):TLONG; cdecl;
+     TfVerify  = function (field:Pfielddef; data:PBYTE; handle:PNUTInfo):longint; cdecl;
+     TfRelease = procedure (field:Pfielddef); cdecl;
+
+  { Data & Xtra field release routine  }
+  function NWSAppendToForm(
+             fline:TLONG; 
+	     fcol:TLONG; 
+	     fwidth:TLONG; 
+	     fattr:TLONG; 
+	     fFormat:TfFormat;
+             fControl:TfControl;
+	     fVerify:TfVerify;
+	     fRelease:TfRelease;
+	     fData:PBYTE; 
+	     fXtra:PBYTE; 
+             fflags:TLONG; 
+	     fActivateKeys:TLONG; 
+	     fhelp:TLONG; 
+	     handle:PNUTInfo):PFIELD;cdecl;external External_library name 'NWSAppendToForm';
+
+  function NWSAppendPromptField(line:TLONG; column:TLONG; promptnum:TLONG; handle:PNUTInfo):PFIELD;cdecl;external External_library name 'NWSAppendPromptField';
+
+  function NWSAppendCommentField(line:TLONG; column:TLONG; prompt:PBYTE; handle:PNUTInfo):PFIELD;cdecl;external External_library name 'NWSAppendCommentField';
+
+  function NWSAppendStringField(line:TLONG; column:TLONG; width:TLONG; fflag:TLONG; data:PBYTE; 
+             cset:PBYTE; help:TLONG; handle:PNUTInfo):PFIELD;cdecl;external External_library name 'NWSAppendStringField';
+
+  function NWSAppendBoolField(line:TLONG; column:TLONG; fflag:TLONG; data:PBYTE; help:TLONG; 
+             handle:PNUTInfo):PFIELD;cdecl;external External_library name 'NWSAppendBoolField';
+
+  function NWSAppendGenericBoolField(line:TLONG; column:TLONG; fflag:TLONG; data:PBYTE; help:TLONG; 
+             yesString:PBYTE; noString:PBYTE; handle:PNUTInfo):PFIELD;cdecl;external External_library name 'NWSAppendGenericBoolField';
+
+type TSpotActionFunc = function (fp:PFIELD; selectKey:longint; changedField:Plongint; handle:PNUTInfo):TLONG; cdecl;
+  function NWSAppendHotSpotField(line:TLONG; column:TLONG; fflag:TLONG; 
+             displayString:PBYTE; 
+	     SpotAction:TSpotActionFunc;
+             handle:PNUTInfo):PFIELD;cdecl;external External_library name 'NWSAppendHotSpotField';
+
+  function NWSInitMenuField(headermsg:TLONG; cLine:TLONG; cCol:TLONG; 
+             action:TActionFunc ;
+	     nutInfo:PNUTInfo; 
+             args:array of const):PMFCONTROL;cdecl;external External_library name 'NWSInitMenuField';
+
+  function NWSInitMenuField(headermsg:TLONG; cLine:TLONG; cCol:TLONG; 
+              action:TActionFunc; nutInfo:PNUTInfo):PMFCONTROL;cdecl;external External_library name 'NWSInitMenuField';
+
+  function NWSAppendToMenuField(m:PMFCONTROL; optiontext:TLONG; option:longint; nutInfo:PNUTInfo):longint;cdecl;external External_library name 'NWSAppendToMenuField';
+
+  function NWSAppendMenuField(line:TLONG; column:TLONG; fflag:TLONG; data:Plongint; m:PMFCONTROL; 
+             help:TLONG; nutInfo:PNUTInfo):PFIELD;cdecl;external External_library name 'NWSAppendMenuField';
+
+  { length of document  }
+  function NWSEditText(centerLine:TLONG; centerColumn:TLONG; height:TLONG; width:TLONG; headerNumber:TLONG; 
+             textBuffer:PBYTE; maxBufferLength:TLONG; confirmMessage:TLONG; forceConfirm:TLONG; handle:PNUTInfo):longint;cdecl;external External_library name 'NWSEditText';
+
+  function NWSViewText(centerLine:TLONG; centerColumn:TLONG; height:TLONG; width:TLONG; headerNumber:TLONG; 
+             textBuffer:PBYTE; maxBufferLength:TLONG; handle:PNUTInfo):longint;cdecl;external External_library name 'NWSViewText';
+
+  procedure NWSDisplayHelpScreen(offset:TLONG; handle:PNUTInfo);cdecl;external External_library name 'NWSDisplayHelpScreen';
+
+  function NWSAlloc(numberOfBytes:TLONG; handle:PNUTInfo):pointer;cdecl;external External_library name 'NWSAlloc';
+
+  procedure NWSFree(address:pointer; handle:PNUTInfo);cdecl;external External_library name 'NWSFree';
+
+  function NWSDisplayTextJustifiedInPortal(justify:TLONG; line:TLONG; column:TLONG; textWidth:TLONG; text:PBYTE; 
+             attribute:TLONG; portal:PPCB):longint;cdecl;external External_library name 'NWSDisplayTextJustifiedInPortal';
+
+  function NWSDisplayInformationInPortal(header:TLONG; portalJustifyLine:TLONG; portalJustifyColumn:TLONG; portalJustifyType:TLONG; portalPalette:TLONG; 
+             portalBorderType:TLONG; portalMaxWidth:TLONG; portalMaxHeight:TLONG; portalMinWidth:TLONG; portalMinHeight:TLONG; 
+             textLRJustifyType:TLONG; textLRIndent:TLONG; textTBJustifyType:TLONG; textTBIndent:TLONG; textAttribute:TLONG; 
+             textMinimizeStyle:TLONG; text:PBYTE; handle:PNUTInfo):longint;cdecl;external External_library name 'NWSDisplayInformationInPortal';
+
+  procedure NWSRestoreNut(handle:PNUTInfo);cdecl;external External_library name 'NWSRestoreNut';
+
+  procedure NWSDrawPortalBorder(portal:PPCB);cdecl;external External_library name 'NWSDrawPortalBorder';
+
+  procedure NWSUpdatePortal(portal:PPCB);cdecl;external External_library name 'NWSUpdatePortal';
+
+type TSSFEntryProc = procedure (para1:PFIELD; para2:pointer; para3:PNUTInfo); cdecl;
+     TSSFCustomDataReleaseProc = procedure (para1:pointer; para2:PNUTInfo); cdecl;
+     TSSFFormat=procedure (para1:PFIELD; text:PBYTE; para3:TLONG); cdecl;
+     TSSFControlFunc = function (para1:PFIELD; para2:longint; para3:Plongint; para4:PNUTInfo):TLONG; cdecl;
+     TSSFVerifyFunc  = function (para1:PFIELD; para2:PBYTE; para3:PNUTInfo):longint; cdecl;
+     TSSFReleaseProc = procedure (para1:PFIELD); cdecl;
+     
+  procedure NWSSetFieldFunctionPtr(fp:PFIELD; 
+              Format : TSSFFormat;
+	      Control: TSSFControlFunc;
+	      Verify : TSSFVerifyFunc;
+	      Release: TSSFReleaseProc;
+              Entry  : TSSFEntryProc; 
+	      customDataRelease
+	             : TSSFCustomDataReleaseProc);cdecl;external External_library name 'NWSSetFieldFunctionPtr';
+
+  procedure NWSGetFieldFunctionPtr(
+                fp:PFIELD; 
+		var Format  : TSSFFormat;
+		var Control : TSSFControlFunc;
+		var Verify  : TSSFVerifyFunc;
+		var Release : TSSFReleaseProc;
+                var Entry   : TSSFEntryProc;
+		var customDataRelease:TSSFCustomDataReleaseProc);cdecl;external External_library name 'NWSGetFieldFunctionPtr';
+
+type TCompareFunc = function (el1:PLIST; el2:PLIST):longint; cdecl;
+  procedure NWSSetDefaultCompare(handle:PNUTInfo; 
+                                 defaultCompareFunction:TCompareFunc);cdecl;external External_library name 'NWSSetDefaultCompare';
+
+  procedure NWSGetDefaultCompare(handle:PNUTInfo; var defaultCompareFunction:TCompareFunc);cdecl;external External_library name 'NWSGetDefaultCompare';
+
+type TlistSortFunction = procedure (head:PLIST; tail:PLIST; handle:PNUTInfo); cdecl;
+  { added in version 402  }
+  procedure NWSSetListSortFunction(handle:PNUTInfo; 
+                   listSortFunction:TlistSortFunction);cdecl;external External_library name 'NWSSetListSortFunction';
+
+  { added in version 402  }
+  procedure NWSGetListSortFunction(handle:PNUTInfo; 
+                            var listSortFunction:TlistSortFunction);cdecl;external External_library name 'NWSGetListSortFunction';
+
+  procedure NWSSetScreenPalette(newPalette:TLONG; handle:PNUTInfo);cdecl;external External_library name 'NWSSetScreenPalette';
+
+  function NWSGetScreenPalette(handle:PNUTInfo):TLONG;cdecl;external External_library name 'NWSGetScreenPalette';
+
+  procedure NWSGetPCB(var _pPcb:PPCB; portalNumber:TLONG; handle:PNUTInfo);cdecl;external External_library name 'NWSGetPCB';
+
+type TentryProcedure = procedure (element:PLIST; displayLine:TLONG; handle:PNUTInfo); cdecl;
+  procedure NWSSetListNotifyProcedure(el:PLIST; 
+              entryProcedure:TentryProcedure);cdecl;external External_library name 'NWSSetListNotifyProcedure';
+
+  procedure NWSGetListNotifyProcedure(el:PLIST; 
+                                      var entryProcedure:TentryProcedure);cdecl;external External_library name 'NWSGetListNotifyProcedure';
+
+type TcdReleaseProc = procedure (theData:pointer; handle:PNUTInfo); cdecl;
+  procedure NWSSetHandleCustomData(handle:PNUTInfo; 
+                                   customData:pointer; 
+				   customDataRelease:TcdReleaseProc);cdecl;external External_library name 'NWSSetHandleCustomData';
+
+  procedure NWSGetHandleCustomData(handle:PNUTInfo; 
+                                   customData:Ppointer; 
+				   customDataRelease:TcdReleaseProc);cdecl;external External_library name 'NWSGetHandleCustomData';
+
+  procedure NWSSetErrorLabelDisplayFlag(flag:TLONG; 
+                                        handle:PNUTInfo);cdecl;external External_library name 'NWSSetErrorLabelDisplayFlag';
+
+  procedure NWSSetHelpHelp(helpIndex:TLONG; 
+                           handle:PNUTInfo);cdecl;external External_library name 'NWSSetHelpHelp';
+
+  { max length of passwordString, including NULL  }
+  function NWSPromptForPassword(passwordHeader:TLONG; line:TLONG; column:TLONG; maxPasswordLen:TLONG; passwordString:PBYTE; 
+             verifyEntry:TLONG; handle:PNUTInfo):TLONG;cdecl;external External_library name 'NWSPromptForPassword';
+
+  { field flags  }
+  { ptr to field text  }
+  { including null  }
+  { help for field  }
+  { force password verification  }
+  { fill character for field  }
+  function NWSAppendPasswordField(line:TLONG; column:TLONG; width:TLONG; fflag:TLONG; data:PBYTE; 
+             maxDataLen:TLONG; help:TLONG; verifyEntry:TLONG; passwordPortalHeader:TLONG; maskCharacter:TLONG; 
+             handle:PNUTInfo):PFIELD;cdecl;external External_library name 'NWSAppendPasswordField';
+
+  { field display width in form  }
+  { field flags (NORMAL_FIELD, etc.)  }
+  { ptr to field text  }
+  { max len of data, allowing for null terminator  }
+  { valid characters, if using EF_SET  }
+  { NWSEditString flags (EF_UPPER etc.)  }
+  function NWSAppendScrollableStringField(line:TLONG; column:TLONG; width:TLONG; fflag:TLONG; data:PBYTE; 
+             maxLen:TLONG; cset:PBYTE; editFlags:TLONG; help:TLONG; handle:PNUTInfo):PFIELD;cdecl;external External_library name 'NWSAppendScrollableStringField';
+
+type TSSFInsertFunc = function (_string:PBYTE; maxLen:TLONG; parameters:pointer):longint; cdecl;
+  procedure NWSSetScrollableFieldInsertProc(fp:PFIELD; insertProc:TSSFInsertFunc);cdecl;external External_library name 'NWSSetScrollableFieldInsertProc';
+
+  { Returns 0 for success, -1 if none selected  }
+  { if not NULL, returns portal number  }
+  function NWSGetCurrentPortal(nutInfo:PNUTInfo; portalNumber:PLONG; var portal:PPCB):TLONG;cdecl;external External_library name 'NWSGetCurrentPortal';
+
+  { if not NULL, returns PCB pointer  }
+  function NWSWaitForKeyAndValue(handle:PNUTInfo; 
+                                        nKeys:TLONG; 
+					keyType:array of TLONG; 
+					keyValue:array of TLONG):longint;cdecl;external External_library name 'NWSWaitForKeyAndValue';
+
+  procedure NWSShowLineAttribute(line:TLONG; 
+                                 column:TLONG; 
+				 text:PBYTE; 
+				 attribute:TLONG; 
+				 length:TLONG; 
+                                 screenID:PScreenStruct);cdecl;external External_library name 'NWSShowLineAttribute';
+
+  procedure NWSShowLine(line:TLONG; column:TLONG; text:PBYTE; length:TLONG; screenID:PScreenStruct);cdecl;external External_library name 'NWSShowLine';
+
+  procedure NWSScrollZone(line:TLONG; column:TLONG; height:TLONG; width:TLONG; attribute:TLONG; 
+              count:TLONG; direction:TLONG; screenID:PScreenStruct);cdecl;external External_library name 'NWSScrollZone';
+
+  procedure NWSSaveZone(line:TLONG; column:TLONG; height:TLONG; width:TLONG; buffer:PBYTE; 
+              screenID:PScreenStruct);cdecl;external External_library name 'NWSSaveZone';
+
+  procedure NWSRestoreZone(line:TLONG; column:TLONG; height:TLONG; width:TLONG; buffer:PBYTE; 
+              screenID:PScreenStruct);cdecl;external External_library name 'NWSRestoreZone';
+
+  procedure NWSRestoreDisplay(screenID:PScreenStruct);cdecl;external External_library name 'NWSRestoreDisplay';
+
+  procedure NWSPositionCursor(line:TLONG; column:TLONG; screenID:PScreenStruct);cdecl;external External_library name 'NWSPositionCursor';
+
+  procedure NWSGetNUTVersion(majorVersion:PLONG; minorVersion:PLONG; revision:PLONG);cdecl;external External_library name 'NWSGetNUTVersion';
+
+  procedure NWSSetFormRepaintFlag(value:TLONG; handle:PNUTInfo);cdecl;external External_library name 'NWSSetFormRepaintFlag';
+
+  procedure NWSSetFormNoWrap(handle:PNUTInfo);cdecl;external External_library name 'NWSSetFormNoWrap';
+
+  function NWSViewTextWithScrollBars(centerLine:TLONG; centerColumn:TLONG; height:TLONG; width:TLONG; headerNumber:TLONG; 
+             textBuffer:PBYTE; maxBufferLength:TLONG; scrollBarFlag:TLONG; handle:PNUTInfo):longint;cdecl;external External_library name 'NWSViewTextWithScrollBars';
+
+  { length of document  }
+  function NWSEditTextWithScrollBars(centerLine:TLONG; centerColumn:TLONG; height:TLONG; width:TLONG; headerNumber:TLONG; 
+             textBuffer:PBYTE; maxBufferLength:TLONG; confirmMessage:TLONG; forceConfirm:TLONG; scrollBarFlag:TLONG; 
+             handle:PNUTInfo):longint;cdecl;external External_library name 'NWSEditTextWithScrollBars';
+
+
+implementation
+
+  { was #define dname def_expr }
+  function F_H1 : longint;
+      { return type might be wrong }
+      begin
+         F_H1:=NWSGetLineDrawCharacter(0);
+      end;
+
+  { was #define dname def_expr }
+  function F_H2 : longint;
+      { return type might be wrong }
+      begin
+         F_H2:=NWSGetLineDrawCharacter(1);
+      end;
+
+  { was #define dname def_expr }
+  function F_V1 : longint;
+      { return type might be wrong }
+      begin
+         F_V1:=NWSGetLineDrawCharacter(2);
+      end;
+
+  { was #define dname def_expr }
+  function F_V2 : longint;
+      { return type might be wrong }
+      begin
+         F_V2:=NWSGetLineDrawCharacter(3);
+      end;
+
+  { was #define dname def_expr }
+  function F_UL1 : longint;
+      { return type might be wrong }
+      begin
+         F_UL1:=NWSGetLineDrawCharacter(4);
+      end;
+
+  { was #define dname def_expr }
+  function F_UR1 : longint;
+      { return type might be wrong }
+      begin
+         F_UR1:=NWSGetLineDrawCharacter(5);
+      end;
+
+  { was #define dname def_expr }
+  function F_LL1 : longint;
+      { return type might be wrong }
+      begin
+         F_LL1:=NWSGetLineDrawCharacter(6);
+      end;
+
+  { was #define dname def_expr }
+  function F_LR1 : longint;
+      { return type might be wrong }
+      begin
+         F_LR1:=NWSGetLineDrawCharacter(7);
+      end;
+
+  { was #define dname def_expr }
+  function F_UL2 : longint;
+      { return type might be wrong }
+      begin
+         F_UL2:=NWSGetLineDrawCharacter(8);
+      end;
+
+  { was #define dname def_expr }
+  function F_UR2 : longint;
+      { return type might be wrong }
+      begin
+         F_UR2:=NWSGetLineDrawCharacter(9);
+      end;
+
+  { was #define dname def_expr }
+  function F_LL2 : longint;
+      { return type might be wrong }
+      begin
+         F_LL2:=NWSGetLineDrawCharacter(10);
+      end;
+
+  { was #define dname def_expr }
+  function F_LR2 : longint;
+      { return type might be wrong }
+      begin
+         F_LR2:=NWSGetLineDrawCharacter(11);
+      end;
+
+  { was #define dname def_expr }
+  function F_UT1 : longint;
+      { return type might be wrong }
+      begin
+         F_UT1:=NWSGetLineDrawCharacter(12);
+      end;
+
+  { was #define dname def_expr }
+  function F_DT1 : longint;
+      { return type might be wrong }
+      begin
+         F_DT1:=NWSGetLineDrawCharacter(13);
+      end;
+
+  { was #define dname def_expr }
+  function F_LT1 : longint;
+      { return type might be wrong }
+      begin
+         F_LT1:=NWSGetLineDrawCharacter(14);
+      end;
+
+  { was #define dname def_expr }
+  function F_RT1 : longint;
+      { return type might be wrong }
+      begin
+         F_RT1:=NWSGetLineDrawCharacter(15);
+      end;
+
+  { was #define dname def_expr }
+  function F_UT2 : longint;
+      { return type might be wrong }
+      begin
+         F_UT2:=NWSGetLineDrawCharacter(24);
+      end;
+
+  { was #define dname def_expr }
+  function F_DT2 : longint;
+      { return type might be wrong }
+      begin
+         F_DT2:=NWSGetLineDrawCharacter(25);
+      end;
+
+  { was #define dname def_expr }
+  function F_LT2 : longint;
+      { return type might be wrong }
+      begin
+         F_LT2:=NWSGetLineDrawCharacter(26);
+      end;
+
+  { was #define dname def_expr }
+  function F_RT2 : longint;
+      { return type might be wrong }
+      begin
+         F_RT2:=NWSGetLineDrawCharacter(27);
+      end;
+
+  { was #define dname def_expr }
+  function F_X1 : longint;
+      { return type might be wrong }
+      begin
+         F_X1:=NWSGetLineDrawCharacter(36);
+      end;
+
+  { was #define dname def_expr }
+  function F_X2 : longint;
+      { return type might be wrong }
+      begin
+         F_X2:=NWSGetLineDrawCharacter(39);
+      end;
+
+  { was #define dname def_expr }
+  function F_UP : longint;
+      { return type might be wrong }
+      begin
+         F_UP:=NWSGetLineDrawCharacter(40);
+      end;
+
+  { was #define dname def_expr }
+  function F_DOWN : longint;
+      { return type might be wrong }
+      begin
+         F_DOWN:=NWSGetLineDrawCharacter(41);
+      end;
+
+  { was #define dname def_expr }
+  function F_LEFT : longint;
+      { return type might be wrong }
+      begin
+         F_LEFT:=NWSGetLineDrawCharacter(42);
+      end;
+
+  { was #define dname def_expr }
+  function F_RIGHT : longint;
+      { return type might be wrong }
+      begin
+         F_RIGHT:=NWSGetLineDrawCharacter(43);
+      end;
+
+  { was #define dname def_expr }
+  function F_BG1 : longint;
+      { return type might be wrong }
+      begin
+         F_BG1:=NWSGetLineDrawCharacter(44);
+      end;
+
+  { was #define dname def_expr }
+  function F_BG2 : longint;
+      { return type might be wrong }
+      begin
+         F_BG2:=NWSGetLineDrawCharacter(45);
+      end;
+
+  { was #define dname def_expr }
+  function F_BG3 : longint;
+      { return type might be wrong }
+      begin
+         F_BG3:=NWSGetLineDrawCharacter(46);
+      end;
+
+  { was #define dname def_expr }
+  function F_BG4 : longint;
+      { return type might be wrong }
+      begin
+         F_BG4:=NWSGetLineDrawCharacter(47);
+      end;
+
+  { was #define dname(params) para_def_expr }
+  { argument types are unknown }
+  { return type might be wrong }   
+  function IS_DYNAMIC_MESSAGE(a : longint) : boolean;
+    begin
+       IS_DYNAMIC_MESSAGE:=(a > $fff0) and (a < $ffff);
+    end;
+
+
+end.
+
+{
+  $Log$
+  Revision 1.1  2003-02-16 17:45:08  armin
+  * added nwsnut, nwconio and nwthreads for netware
+
+  
+}

+ 199 - 0
rtl/netware/nwthread.pp

@@ -0,0 +1,199 @@
+{
+    $Id$
+    This file is part of the Free Pascal run time library
+    for Netware.
+    Copyright (c) 1999-2003 by the Free Pascal development team.
+		
+    See the file COPYING.FPC, included in this distribution,
+    for details about the copyright.
+			
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+				    
+**********************************************************************}
+
+unit nwthread;
+interface
+
+{$mode objfpc}
+
+
+  const
+    ThreadsNlm = 'threads';
+    Lib0Nlm    = 'lib0';
+    NlmLibNlm  = 'nlmlib';
+
+  Type
+    PLong = ^longint;
+
+{$PACKRECORDS C}
+
+
+
+  { values for __action_code used with ExitThread()  }
+
+  const
+     TSR_THREAD = -1;
+     EXIT_THREAD = 0;
+     EXIT_NLM = 1;
+  { values for __mode used with spawnxx()  }
+     P_WAIT = 0;
+     P_NOWAIT = 1;
+     P_OVERLAY = 2;
+     P_NOWAITO = 4;
+     P_SPAWN_IN_CURRENT_DOMAIN = 8;
+     NO_CONTEXT = 0;
+     USE_CURRENT_CONTEXT = 1;
+  { stack defines  }
+     MIN_STACKSIZE = 16384;
+     DEFAULT_STACKSIZE = 16384;
+
+  type
+  
+     PWorkToDo = ^TWorkToDo;
+    
+     TProcedure    = procedure; cdecl;
+     TThreadFunc   = procedure (param1:pointer); cdecl;
+     TWorkToDoProc = procedure (data:pointer; workToDo:PWorkToDo); cdecl;
+     TCleanup      = procedure (para1:longint); cdecl;
+
+  
+     PAESProcessStructure = ^TAESProcessStructure;
+     TAESProcessStructure = record
+          ALink              : PAESProcessStructure;
+          AWakeUpDelayAmount : longint;
+          AWakeUpTime        : longint;
+          AProcessToCall     : procedure (para1:pointer);cdecl;
+          ARTag              : longint;
+          AOldLink           : longint;
+       end;
+
+
+     PWorkToDoStructure = ^TWorkToDoStructure;
+     TWorkToDoStructure = record
+          Link            : PWorkToDoStructure;
+          workProcedure   : TProcedure;
+          WorkResourceTag : longint;
+          PollCountAmount : longint;
+          PollCountWhen   : longint;
+          userProcedure   : TProcedure;
+          dataPtr         : pointer;
+          destThreadGroup : longint;
+       end;
+     TWorkToDo = TWorkToDoStructure;
+     
+
+     
+  { custom data area variables...  }
+
+    var
+       threadCustomDataPtr : pointer;cvar;external;
+       threadCustomDataSize : longint;cvar;external;
+       threadGroupCustomDataPtr : pointer;cvar;external;
+       threadGroupCustomDataSize : longint;cvar;external;
+    
+    
+  function AtUnload(func:Tprocedure):longint;                       cdecl;external ThreadsNlm name 'AtUnload';
+  function BeginThread(func:TThreadFunc; 
+                       stackP:pointer; 
+		       stackSize:dword; 
+		       arg:pointer):longint;                        cdecl;external ThreadsNlm name 'BeginThread';
+  function BeginThreadGroup(func:TThreadFunc; 
+                            stackP:pointer; 
+			    stackSize:dword; 
+			    arg:pointer):longint;                   cdecl;external ThreadsNlm name 'BeginThreadGroup';
+  function Breakpoint(arg:longint):longint;                         cdecl;external Lib0Nlm name 'Breakpoint';
+  procedure CancelNoSleepAESProcessEvent(EventNode:PAESProcessStructure);cdecl;external ThreadsNlm name 'CancelNoSleepAESProcessEvent';
+  procedure CancelSleepAESProcessEvent  (EventNode:PAESProcessStructure);cdecl;external ThreadsNlm name 'CancelSleepAESProcessEvent';
+  function ClearNLMDontUnloadFlag(NLMID:longint):longint;                cdecl;external ThreadsNlm name 'ClearNLMDontUnloadFlag';
+  procedure delay(milliseconds:dword);                                   cdecl;external ThreadsNlm name 'delay';
+  function EnterCritSec:longint;                                         cdecl;external ThreadsNlm name 'EnterCritSec';
+  function ExitCritSec:longint;                                          cdecl;external ThreadsNlm name 'ExitCritSec';
+  procedure ExitThread(action_code     :longint; 
+                       termination_code:longint);                        cdecl;external ThreadsNlm name 'ExitThread';
+
+  function FindNLMHandle(NLMFileName:Pchar):dword;                       cdecl;external ThreadsNlm name 'FindNLMHandle';
+  function getcmd(cmdLine:Pchar):Pchar;                                  cdecl;external ThreadsNlm name 'getcmd';
+  function GetNLMHandle:dword;                                           cdecl;external ThreadsNlm name 'GetNLMHandle';
+  function GetNLMID:longint;                                             cdecl;external ThreadsNlm name 'GetNLMID';
+  function GetNLMIDFromNLMHandle(NLMHandle:longint):longint;             cdecl;external ThreadsNlm name 'GetNLMIDFromNLMHandle';
+  function GetNLMIDFromThreadID(threadID:longint;fileName:Pchar):longint;cdecl;external ThreadsNlm name 'GetNLMIDFromThreadID';
+  function GetNLMNameFromNLMID(NLMID:longint; 
+                               fileName:Pchar; 
+			       description:Pchar):longint;               cdecl;external ThreadsNlm name 'GetNLMNameFromNLMID';
+  function GetNLMNameFromNLMHandle(NLMHandle:longint; 
+                                   LDFileName:Pchar; 
+				   LDName:Pchar):longint;                cdecl;external ThreadsNlm name 'GetNLMNameFromNLMHandle';
+  function GetThreadContextSpecifier(threadID:longint):longint;          cdecl;external ThreadsNlm name 'GetThreadContextSpecifier';
+  function GetThreadGroupID:longint;                                     cdecl;external ThreadsNlm name 'GetThreadGroupID';
+  function __GetThreadIDFromPCB(PCB:longint):longint;                    cdecl;external Lib0Nlm name '__GetThreadIDFromPCB';
+  function GetThreadHandicap(threadID:longint):longint;                  cdecl;external ThreadsNlm name 'GetThreadHandicap';
+  function GetThreadID:longint;                                          cdecl;external ThreadsNlm name 'GetThreadID';
+  function GetThreadName(threadID:longint; tName:Pchar):longint;         cdecl;external ThreadsNlm name 'GetThreadName';
+  function MapNLMIDToHandle(NLMID:longint):longint;                      cdecl;external ThreadsNlm name 'MapNLMIDToHandle';
+  function PopThreadCleanup(execute:longint):TCLEANUP;                   cdecl;external ThreadsNlm name 'PopThreadCleanup';
+  function PopThreadGroupCleanup(execute:longint):TCLEANUP;              cdecl;external ThreadsNlm name 'PopThreadGroupCleanup';
+  function PushThreadCleanup(func:TCLEANUP):longint;                     cdecl;external ThreadsNlm name 'PushThreadCleanup';
+  function PushThreadGroupCleanup(func:TCLEANUP):longint;                cdecl;external ThreadsNlm name 'PushThreadGroupCleanup';
+  function RenameThread(threadID:longint; newName:Pchar):longint;        cdecl;external ThreadsNlm name 'RenameThread';
+  function ResumeThread(threadID:longint):longint;                       cdecl;external ThreadsNlm name 'ResumeThread';
+  function ReturnNLMVersionInfoFromFile(pathName:pchar; 
+                                        majorVersion:PLONG; 
+					minorVersion:PLONG; 
+					revision:PLONG; 
+					year:PLONG; 
+                                        month:PLONG; 
+					day:PLONG; 
+					copyrightString:pchar; 
+					description:pchar):longint;      cdecl;external NlmLibNlm name 'ReturnNLMVersionInfoFromFile';
+  function ReturnNLMVersionInfoFromFile(pathName:pchar; 
+                                        var majorVersion,minorVersion,revision:longint;
+					var year,month,day:longint; 
+					copyrightString:pchar; 
+					description:pchar):longint;      cdecl;external NlmLibNlm name 'ReturnNLMVersionInfoFromFile';
+
+  function ReturnNLMVersionInformation(NLMHandle:longint; 
+                                       majorVersion,minorVersion,revision,year,month,day:PLONG; 
+                                       copyrightString:pchar; description:pchar):longint;cdecl;external NlmLibNlm name 'ReturnNLMVersionInformation';
+  function ReturnNLMVersionInformation(NLMHandle:longint; 
+                                       var majorVersion,minorVersion,revision,year,month,day:longint; 
+                                       copyrightString:pchar; description:pchar):longint;cdecl;external NlmLibNlm name 'ReturnNLMVersionInformation';
+
+  procedure ScheduleNoSleepAESProcessEvent(EventNode:PAESProcessStructure);cdecl;external ThreadsNlm name 'ScheduleNoSleepAESProcessEvent';
+  procedure ScheduleSleepAESProcessEvent(EventNode:PAESProcessStructure);  cdecl;external ThreadsNlm name 'ScheduleSleepAESProcessEvent';
+
+
+  function ScheduleWorkToDo(ProcedureToCall:TWorkToDoProc; 
+                            workData       :pointer; 
+			    workToDo       :PWorkToDo):longint;            cdecl;external ThreadsNlm name 'ScheduleWorkToDo';
+  function SetNLMDontUnloadFlag(NLMID:longint):longint;                    cdecl;external ThreadsNlm name 'SetNLMDontUnloadFlag';
+  function SetNLMID(newNLMID:longint):longint;                             cdecl;external ThreadsNlm name 'SetNLMID';
+  function SetThreadContextSpecifier(threadID,
+                                     contextSpecifier:longint):longint;    cdecl;external ThreadsNlm name 'SetThreadContextSpecifier';
+  function SetThreadGroupID(newThreadGroupID:longint):longint;             cdecl;external ThreadsNlm name 'SetThreadGroupID';
+  procedure SetThreadHandicap(threadID, handicap:longint);                 cdecl;external ThreadsNlm name 'SetThreadHandicap';
+  function spawnlp(mode:longint; 
+                   path,arg0:Pchar; 
+		   args:array of const):longint;                           cdecl;external ThreadsNlm name 'spawnlp';
+  function spawnlp(mode:longint; 
+                   path,arg0:Pchar):longint;                               cdecl;external ThreadsNlm name 'spawnlp';
+  function spawnvp(mode:longint; 
+                   path,argv:PPchar):longint;                              cdecl;external ThreadsNlm name 'spawnvp';
+  function SuspendThread(threadID:longint):longint;                        cdecl;external ThreadsNlm name 'SuspendThread';
+  procedure ThreadSwitch;                                                  cdecl;external ThreadsNlm name 'ThreadSwitch';
+  procedure ThreadSwitchLowPriority;                                       cdecl;external ThreadsNlm name 'ThreadSwitchLowPriority';
+  procedure ThreadSwitchWithDelay;                                         cdecl;external ThreadsNlm name 'ThreadSwitchWithDelay';
+
+implementation
+
+
+end.
+
+{
+  $Log$
+  Revision 1.1  2003-02-16 17:45:08  armin
+  * added nwsnut, nwconio and nwthreads for netware
+
+  
+}