Browse Source

* made commandParser more compatible between clib and libc

armin 20 years ago
parent
commit
e8889a1ef5
3 changed files with 76 additions and 92 deletions
  1. 35 66
      rtl/netware/README
  2. 22 16
      rtl/netware/nwserv.pp
  3. 19 10
      rtl/netwlibc/libc.pp

+ 35 - 66
rtl/netware/README

@@ -1,42 +1,22 @@
-    News
-    ====
-
-    2004/08/01 armin:
-     - lot of fixes, compiler can compile itself on a netware server
-    2003/02/16 armin:
-     - added nwconio, nwthreads, nwsnut
-    2003/02/15 armin:
-     - changes for new threadvars
-    2002/02/27 armin:
-     - changes for current fpc 1.1
-    2001/04/16 armin:
-     - implemented CRT and SYSUTILS
-     - nwimp/convertimp to convert .imp files to unix
-    2001/05/26 armin:
-     - successfuly compiled binutils for win32 under linux. Patched nlmconv
-       for win32 available. This makes it possible to use FPC to create NLM's
-       unter win32.
-
-
 
 
     General
     General
     =======
     =======
 
 
-    Currently generating NetWare-NLM's only work under Linux and win32. (may be under bsd also)
-    For Win32 you need a win32 compiled binutils with netware target enabled. Because nlmconv
-    only works with elf objects, elf support in binutils is also needed.
+    Currently generating NetWare-NLM's only work under Linux and win32. (may work under other
+    unix versions also but this is not tested yet)
 
 
 
 
     Binutils with netware-support needed
     Binutils with netware-support needed
     ====================================
     ====================================
 
 
-    You need a version of binutils compiled with netware-support. (nlmconv has to be present)
+    You need a version of binutils compiled with netware-support. As of FreePascal 1.9.5 Nov 2004
+    binutils needs to be named i386-netware-* (i.e. i386-netware-ld, i386-netware-nlmconv).
     Unfortunately in the Linux distibutions this component of the binutils is not included
     Unfortunately in the Linux distibutions this component of the binutils is not included
     so you have to compile it. So download the latest stable binutils package from your
     so you have to compile it. So download the latest stable binutils package from your
     favourite GNU mirror, decompress it ('tar xfz binutils-x.yy.z.tar.gz' on unices
     favourite GNU mirror, decompress it ('tar xfz binutils-x.yy.z.tar.gz' on unices
     with GNU tar), change to the binutils-x.yy.z directory and configure:
     with GNU tar), change to the binutils-x.yy.z directory and configure:
 
 
-      ./configure --prefix=/usr --enable-shared --enable-targets=i386-netware,i386-linux
+      ./configure --prefix=/usr --enable-shared --enable-target=i386-netware
 
 
     I used the prefix /usr because thats the default location on redhat (thats what I'm using)
     I used the prefix /usr because thats the default location on redhat (thats what I'm using)
 
 
@@ -46,29 +26,38 @@
       make install
       make install
 
 
     to build and install binutils. To check that netware is supported by the version of binutils
     to build and install binutils. To check that netware is supported by the version of binutils
-    installed, use ld --version. The emulation 'i386nw' must be present. Also check that nlmconv
-    is present and can be started without specifying the complete path of nlmconv.
+    installed, use i386-netware-ld --version. The emulation 'i386nw' must be present. Also check that 
+    i386-netware-nlmconv
+    is present and can be started without specifying the complete path of i386-netware-nlmconv.
 
 
     You can find more information and a binary version of binutils with netware-support for
     You can find more information and a binary version of binutils with netware-support for
     linux on:
     linux on:
            http://home.sch.bme.hu/~keresztg/novell/howto/NLM-Linux-HOWTO.html.
            http://home.sch.bme.hu/~keresztg/novell/howto/NLM-Linux-HOWTO.html.
 
 
-    Binutils-2.11 for win32 and RedHat 7.2 with netware support and a patched nlmconv
-    that supports "copyright" are available from:
-           http://home.arcor.de/armin.diehl/fpcnw
+    Binutils for win32 and Fedora Core 2 are available from:
+           ftp://ftp.freepascal.org/pub/fpc/contrib/cross
 	  
 	  
-    The copyright-patch is included in newer versions of binutils (2.13)
-
 
 
     Building the freepascal runtime-library for netware
     Building the freepascal runtime-library for netware
     ===================================================
     ===================================================
 
 
     Install the current fpc sources from ftp.freepascal.org and change to the directory
     Install the current fpc sources from ftp.freepascal.org and change to the directory
     rtl/netware under the freepascal sourcetree. Verify the path of your units in
     rtl/netware under the freepascal sourcetree. Verify the path of your units in
-    Makefile. The default is /usr/lib/fpc/1.9.5/units/netware/rtl.
+    Makefile. The default is /usr/lib/fpc/1.9.5/units/i386-netware/*.
     Compile and install the rtl with
     Compile and install the rtl with
 
 
       make install
       make install
+      
+    This will install the basic rtl files. To install all (packages,fcl and nlm's) do a
+    
+    make OS_TARGET=netware build
+    
+    and
+    
+    make OS_TARGET=netware install
+    
+    at the fpc source root dir.
+    
 
 
     Settings and needed files to compile for netware
     Settings and needed files to compile for netware
     ================================================
     ================================================
@@ -76,9 +65,15 @@
     Edit your /etc/fpc.cfg and add the rtl source path for netware. This are my settings,
     Edit your /etc/fpc.cfg and add the rtl source path for netware. This are my settings,
     you may paste it to your fpc.cfg:
     you may paste it to your fpc.cfg:
 
 
-#IFDEF Netware
-  -Fu/usr/lib/fpc/1.9.5/units/netware/rtl
-  -Fl/usr/lib/fpc/1.9.5/units/netware/rtl
+#IFDEF Netware_clib
+  -Fu/usr/lib/fpc/1.9.5/units/i386-netware/*
+  -Fl/usr/lib/fpc/1.9.5/units/i386-netware/rtl
+#ENDIF
+
+#IFDEF Netware_libc
+  -Fu/usr/lib/fpc/1.9.5/units/i386-netwlibc/*
+  -Fl/usr/lib/fpc/1.9.5/units/i386-netwlibc/rtl
+  -XPi386-netware-
 #ENDIF
 #ENDIF
 
 
     This adds the search path for the rtl-units as well as for the needed import-files.
     This adds the search path for the rtl-units as well as for the needed import-files.
@@ -98,10 +93,10 @@
     {$Description The FreePascal HelloWorld for Netware}
     {$Description The FreePascal HelloWorld for Netware}
     {$Version 1.0.0}
     {$Version 1.0.0}
     {$Copyright Copyright (c) 2001 The FreePascal Development Team}
     {$Copyright Copyright (c) 2001 The FreePascal Development Team}
-    {$Screenname The Pascal Hello World for Netware}
+    {$Screenname FPC Hello World for Netware}
 
 
     BEGIN
     BEGIN
-      WriteLn ('This is open source ! FreePascal for netware');
+      WriteLn ('This is open source, FreePascal for netware');
     END.
     END.
 
 
     Hints on using freepascal for nlm's
     Hints on using freepascal for nlm's
@@ -118,7 +113,8 @@
                         above.
                         above.
       $SCREENNAME     : Sets the screen-name (i.e. shown in ctrl-esc screen)
       $SCREENNAME     : Sets the screen-name (i.e. shown in ctrl-esc screen)
                         $SCREENNAME DEFAULT : output to logger screen
                         $SCREENNAME DEFAULT : output to logger screen
-			$SCREENNAME NONE    : no output at all
+			$SCREENNAME NONE    : no output at all (do not use this, writeln,
+			                      even from a runtime error may crash the sever)
 			$SCREENNAME MyScreen: Name the screen "MyScreen"
 			$SCREENNAME MyScreen: Name the screen "MyScreen"
       $THREADNAME     : Sets the thread name (dont use names that are to long
       $THREADNAME     : Sets the thread name (dont use names that are to long
                         for netware, that will prevent your nlm from loading)
                         for netware, that will prevent your nlm from loading)
@@ -180,31 +176,4 @@
 
 
         function NWAbortServicingQueueJob2;  CDecl; external 'calwin32.nlm';
         function NWAbortServicingQueueJob2;  CDecl; external 'calwin32.nlm';
 
 
-    - FreePascal RTL
-      --------------
-
-      Currently the following units are available for netware:
-
-        - SYSTEM
-        - CRT
-        - DOS
-        - SYSUTILS
-        - STRINGS
-        - KEYBOARD
-        - VIDEO
-        - MATH
-        - TYPINFO
-        - OBJECTS
-        - GETOPTS
-        - HEAPTRC
-        - VARUTILS
-        - CPU
-        - MMX
-	- WinSock2
-	- SYSTHRDS
-	- nwconio
-	- nwthreads
-	- nwsnut
-
-
 [email protected]
 [email protected]

+ 22 - 16
rtl/netware/nwserv.pp

@@ -1509,25 +1509,24 @@ type
 { Resource tag signatures for AllocateResourceTag  }
 { Resource tag signatures for AllocateResourceTag  }
 
 
 const
 const
-   AllocSignature = $54524C41;
-   AESProcessSignature = $50534541;
+   AllocSignature                 = $54524C41;
+   AESProcessSignature            = $50534541;
    CacheNonMovableMemorySignature = $544D4E43;
    CacheNonMovableMemorySignature = $544D4E43;
-   ConsoleCommandSignature = $4D4F4343;
-   HardwareInterruptSignature = $50544E49;
+   ConsoleCommandSignature        = $4D4F4343;
+   HardwareInterruptSignature     = $50544E49;
    InterruptTimeCallBackSignature = $524D4954;
    InterruptTimeCallBackSignature = $524D4954;
-   SemiPermMemorySignature = $454D5053;
-   DebuggerSignature = $47554244;
-   BreakpointSignature = $54504B42;
-{ Data structure for RegisterConsoleCommand  }
-{ set by RegisterConsoleCommand  }
-{ parsing routing (user defined)  }
-{ set to resource tag  }
+   SemiPermMemorySignature        = $454D5053;
+   DebuggerSignature              = $47554244;
+   BreakpointSignature            = $54504B42;
+
 type
 type
+   TCommandParserFunc = function (screenID    : scr_t;
+                                  commandLine : PChar):longint;cdecl;
    PcommandParserStructure = ^TcommandParserStructure;
    PcommandParserStructure = ^TcommandParserStructure;
-   TcommandParserStructure = record
-        Link : PcommandParserStructure;
-        parseRoutine : function (screenID:longint; commandLine:PBYTE):longint;cdecl;
-        RTag : longint;
+   TcommandParserStructure = record                 // Data structure for RegisterConsoleCommand
+        Link         : PcommandParserStructure;     // set by RegisterConsoleCommand
+        parseRoutine : TCommandParserFunc;          // parsing routing (user defined)
+        RTag         : longint;                     // set to resource tag
      end;
      end;
 
 
 {
 {
@@ -1962,6 +1961,8 @@ const
    ECDetachedBit = $00000008;
    ECDetachedBit = $00000008;
    ECDirectFileSystemBit = $00000020;
    ECDirectFileSystemBit = $00000020;
    ECFileWriteThroughBit = $00000040;
    ECFileWriteThroughBit = $00000040;
+   HANDLEDCOMMAND  = 0;
+   NOTMYCOMMAND    = 1;
 {$include npackoff.inc}
 {$include npackoff.inc}
 
 
 function AllocateResourceTag (NLMHandle:TNlmHandle;
 function AllocateResourceTag (NLMHandle:TNlmHandle;
@@ -2000,6 +2001,7 @@ function NWGetSearchPathElement (searchPathNumber:longint;
                                  searchPath:PChar):longint;cdecl;external 'clib' name 'NWGetSearchPathElement';
                                  searchPath:PChar):longint;cdecl;external 'clib' name 'NWGetSearchPathElement';
 function NWInsertSearchPath(searchPathNumber:longint; path:PChar):longint;cdecl;external 'clib' name 'NWInsertSearchPath';
 function NWInsertSearchPath(searchPathNumber:longint; path:PChar):longint;cdecl;external 'clib' name 'NWInsertSearchPath';
 function RegisterConsoleCommand(newCommandParser:PcommandParserStructure):longint;cdecl;external 'clib' name 'RegisterConsoleCommand';
 function RegisterConsoleCommand(newCommandParser:PcommandParserStructure):longint;cdecl;external 'clib' name 'RegisterConsoleCommand';
+function RegisterConsoleCommand(var newCommandParser:TcommandParserStructure):longint;cdecl;external 'clib' name 'RegisterConsoleCommand';
 function RegisterForEvent (eventType:longint;
 function RegisterForEvent (eventType:longint;
                            reportProcedure:TreportProcedure;
                            reportProcedure:TreportProcedure;
                            warnProcedure:TwarnProcedure):longint;cdecl;external 'clib' name 'RegisterForEvent';
                            warnProcedure:TwarnProcedure):longint;cdecl;external 'clib' name 'RegisterForEvent';
@@ -2032,6 +2034,7 @@ procedure SynchronizeStart;cdecl;external 'clib' name 'SynchronizeStart';
 function UnimportSymbol (NLMHandle:TNlmHandle;
 function UnimportSymbol (NLMHandle:TNlmHandle;
                          symbolName:Pchar):longint;cdecl;external 'clib' name 'UnimportSymbol';
                          symbolName:Pchar):longint;cdecl;external 'clib' name 'UnimportSymbol';
 function UnRegisterConsoleCommand (commandParserToDelete:PcommandParserStructure):longint;cdecl;external 'clib' name 'UnRegisterConsoleCommand';
 function UnRegisterConsoleCommand (commandParserToDelete:PcommandParserStructure):longint;cdecl;external 'clib' name 'UnRegisterConsoleCommand';
+function UnRegisterConsoleCommand (var commandParserToDelete:TcommandParserStructure):longint;cdecl;external 'clib' name 'UnRegisterConsoleCommand';
 function UnregisterForEvent (eventHandle:longint):longint;cdecl;external 'clib' name 'UnregisterForEvent';
 function UnregisterForEvent (eventHandle:longint):longint;cdecl;external 'clib' name 'UnregisterForEvent';
 {-nwfileio.h-------------------------------------------------------------------}
 {-nwfileio.h-------------------------------------------------------------------}
 type
 type
@@ -5374,7 +5377,10 @@ end.
 
 
 {
 {
   $Log$
   $Log$
-  Revision 1.5  2004-12-16 12:42:55  armin
+  Revision 1.6  2004-12-29 13:01:42  armin
+  * made commandParser more compatible between clib and libc
+
+  Revision 1.5  2004/12/16 12:42:55  armin
   * added NetWare Alert
   * added NetWare Alert
   * added sysutils.sleep
   * added sysutils.sleep
 
 

+ 19 - 10
rtl/netwlibc/libc.pp

@@ -41,7 +41,7 @@ Type
   void      = pointer;
   void      = pointer;
   cint      = longint;
   cint      = longint;
   TNLMHandle = Pointer;
   TNLMHandle = Pointer;
-  
+
 const
 const
   NullNlmHandle = nil;
   NullNlmHandle = nil;
 
 
@@ -4523,22 +4523,28 @@ function RegisterCommand(NLMHandle:TNLMHandle; rTag:rtag_t; keywordFlags:dword;
 { legacy command parsing; uses ConsoleCommandSignature...  }
 { legacy command parsing; uses ConsoleCommandSignature...  }
 
 
 type
 type
-   Parser_t = function (scrID:scr_t; commandline:Pchar):longint;cdecl;
+   TCommandParserFunc = function (scrID:scr_t; commandline:Pchar):longint;cdecl;
+
 { allocate with ConsoleCommandSignature  }
 { allocate with ConsoleCommandSignature  }
 
 
-   PCommandParser_t = ^TCommandParser;
-   TCommandParser = record
+   PCommandParserStructure = ^TCommandParserStructure;
+   TCommandParserStructure = record
         link   : pointer;
         link   : pointer;
-        parser : Parser_t;
-        rTag   : rtag_t;
+        case longint of
+          0 : (parser : TCommandParserFunc; rTag : rtag_t);
+          1 : (parseRoutine : TCommandParserFunc; rTag2 : rtag_t);
      end;
      end;
-   PCommandParser = PCommandParser_t;
+   TCommandParser = TCommandParserStructure;
+   PCommandParser = PCommandParserStructure;
 
 
+const
+  HANDLEDCOMMAND  = 0;
+  NOTMYCOMMAND    = 1;
 
 
 function ParseCommand(commandLine:Pchar):longint;cdecl;external system_nlm name 'ParseCommand';
 function ParseCommand(commandLine:Pchar):longint;cdecl;external system_nlm name 'ParseCommand';
-function RegisterConsoleCommand(cmdParser:PCommandParser_t):longint;cdecl;external system_nlm name 'RegisterConsoleCommand';
+function RegisterConsoleCommand(cmdParser:PCommandParser):longint;cdecl;external system_nlm name 'RegisterConsoleCommand';
 function RegisterConsoleCommand(var cmdParser:TCommandParser):longint;cdecl;external system_nlm name 'RegisterConsoleCommand';
 function RegisterConsoleCommand(var cmdParser:TCommandParser):longint;cdecl;external system_nlm name 'RegisterConsoleCommand';
-function UnRegisterConsoleCommand(cmdParser:PCommandParser_t):longint;cdecl;external libc_nlm name 'UnRegisterConsoleCommand';
+function UnRegisterConsoleCommand(cmdParser:PCommandParser):longint;cdecl;external libc_nlm name 'UnRegisterConsoleCommand';
 function UnRegisterConsoleCommand(var cmdParser:TCommandParser):longint;cdecl;external libc_nlm name 'UnRegisterConsoleCommand';
 function UnRegisterConsoleCommand(var cmdParser:TCommandParser):longint;cdecl;external libc_nlm name 'UnRegisterConsoleCommand';
 
 
     const
     const
@@ -9111,7 +9117,10 @@ end.
 
 
 {
 {
   $Log$
   $Log$
-  Revision 1.7  2004-12-16 12:42:55  armin
+  Revision 1.8  2004-12-29 13:01:43  armin
+  * made commandParser more compatible between clib and libc
+
+  Revision 1.7  2004/12/16 12:42:55  armin
   * added NetWare Alert
   * added NetWare Alert
   * added sysutils.sleep
   * added sysutils.sleep