Browse Source

Merged revisions 7022-7024 via svnmerge from
svn+ssh://[email protected]/FPC/svn/fpc/trunk

........
r7022 | Almindor | 2007-03-29 21:29:04 +0200 (Thu, 29 Mar 2007) | 2 lines

* add common socket error constants to all platforms/socket.pp

........
r7023 | micha | 2007-03-29 21:45:42 +0200 (Thu, 29 Mar 2007) | 1 line

+ generics context sensitivity test
........
r7024 | hajny | 2007-03-29 22:31:06 +0200 (Thu, 29 Mar 2007) | 1 line

+ socket error codes
........

git-svn-id: branches/fixes_2_2@7211 -

joost 18 years ago
parent
commit
ee042f726f

+ 2 - 0
.gitattributes

@@ -6695,6 +6695,7 @@ tests/test/tgeneric10.pp svneol=native#text/plain
 tests/test/tgeneric11.pp svneol=native#text/plain
 tests/test/tgeneric12.pp svneol=native#text/plain
 tests/test/tgeneric13.pp svneol=native#text/plain
+tests/test/tgeneric14.pp svneol=native#text/plain
 tests/test/tgeneric2.pp svneol=native#text/plain
 tests/test/tgeneric3.pp svneol=native#text/plain
 tests/test/tgeneric4.pp svneol=native#text/plain
@@ -6851,6 +6852,7 @@ tests/test/uabstrcl.pp svneol=native#text/plain
 tests/test/uenum2a.pp svneol=native#text/plain
 tests/test/uenum2b.pp svneol=native#text/plain
 tests/test/ugeneric10.pp svneol=native#text/plain
+tests/test/ugeneric14.pp svneol=native#text/plain
 tests/test/ugeneric3.pp svneol=native#text/plain
 tests/test/ugeneric4.pp svneol=native#text/plain
 tests/test/uimpluni1.pp svneol=native#text/plain

+ 13 - 4
rtl/netware/sockets.pp

@@ -36,10 +36,19 @@ Type
   tsocklen=cint;
   psocklen=^tsocklen;
 
-const EsockEINTR  = WSAEINTR;
-      EsockEBADF  = WSAEBADF;
-      EsockEFAULT = WSAEFAULT;
-      EsockEINVAL = WSAEINVAL;
+const
+  EsockEINTR            = WSAEINTR;
+  EsockEBADF            = WSAEBADF;
+  EsockEFAULT           = WSAEFAULT;
+  EsockEINVAL           = WSAEINVAL;
+  EsocksEACCESS         = WSAEACCES;
+  EsocksEMFILE          = WSAEMFILE;
+  EsocksEMSGSIZE        = WSAEMSGSIZE;
+  EsocksENOBUFS         = WSAENOBUFS;
+  EsocksENOTCONN        = WSAENOTCONN;
+  EsocksENOTSOCK        = WSAENOTSOCK;
+  EsocksEPROTONOSUPPORT = WSAEPROTONOSUPPORT;
+  EsocksEWOULDBLOCK     = WSAEWOULDBLOCK;
 
 {$i netwsockh.inc}
 {$i socketsh.inc}

+ 13 - 4
rtl/netwlibc/sockets.pp

@@ -35,10 +35,19 @@ Type
   tsocklen=cint;
   psocklen=^tsocklen;
 
-const EsockEINTR  = WSAEINTR;
-      EsockEBADF  = WSAEBADF;
-      EsockEFAULT = WSAEFAULT;
-      EsockEINVAL = WSAEINVAL;
+const
+  EsockEINTR            = WSAEINTR;
+  EsockEBADF            = WSAEBADF;
+  EsockEFAULT           = WSAEFAULT;
+  EsockEINVAL           = WSAEINVAL;
+  EsocksEACCESS         = WSAEACCES;
+  EsocksEMFILE          = WSAEMFILE;
+  EsocksEMSGSIZE        = WSAEMSGSIZE;
+  EsocksENOBUFS         = WSAENOBUFS;
+  EsocksENOTCONN        = WSAENOTCONN;
+  EsocksENOTSOCK        = WSAENOTSOCK;
+  EsocksEPROTONOSUPPORT = WSAEPROTONOSUPPORT;
+  EsocksEWOULDBLOCK     = WSAEWOULDBLOCK;
 
 {$i netwsockh.inc}
 {$i socketsh.inc}

+ 8 - 0
rtl/os2/sockets.pas

@@ -100,6 +100,14 @@ const EsockEINTR  = SOCEINTR;
       EsockEBADF  = SOCEBADF;
       EsockEFAULT = SOCEFAULT;
       EsockEINVAL = SOCEINVAL;
+      EsocksEACCESS = SOCEACCES;
+      EsocksEMFILE  = SOCEMFILE;
+      EsocksEMSGSIZE = SOCEMSGSIZE;
+      EsocksENOBUFS = SOCENOBUFS;
+      EsocksENOTCONN = SOCENOTCONN;
+      EsocksENOTSOCK = SOCENOTSOCK;
+      EsocksEPROTONOSUPPORT = SOCEPROTONOSUPPORT;
+      EsocksEWOULDBLOCK = SOCEWOULDBLOCK;
 
 
 Type

+ 14 - 4
rtl/unix/sockets.pp

@@ -37,10 +37,20 @@ type
                   path:array[0..107] of char;    //104 total for freebsd.
                   end;
 
-const EsockEINTR  = EsysEINTR;
-      EsockEBADF  = EsysEBADF;
-      EsockEFAULT = EsysEFAULT;
-      EsockEINVAL = EsysEINVAL;
+const
+  EsockEINTR            = EsysEINTR;
+  EsockEBADF            = EsysEBADF;
+  EsockEFAULT           = EsysEFAULT;
+  EsockEINVAL           = EsysEINVAL;
+  EsocksEACCESS         = ESysEAcces;
+  EsocksEMFILE          = ESysEmfile;
+  EsocksEMSGSIZE        = ESysEMsgSize;
+  EsocksENOBUFS         = ESysENoBufs;
+  EsocksENOTCONN        = ESysENotConn;
+  EsocksENOTSOCK        = ESysENotSock;
+  EsocksEPROTONOSUPPORT = ESysEProtoNoSupport;
+  EsocksEWOULDBLOCK     = ESysEWouldBlock;
+
 
 { unix socket specific functions }
 Procedure Str2UnixSockAddr(const addr:string;var t:TUnixSockAddr;var len:longint);

+ 13 - 4
rtl/win/sockets.pp

@@ -27,10 +27,19 @@ Type
   tsocklen= cint;
   psocklen= ^tsocklen;
 
-const EsockEINTR  = WSAEINTR;
-      EsockEBADF  = WSAEBADF;
-      EsockEFAULT = WSAEFAULT;
-      EsockEINVAL = WSAEINVAL;
+const
+  EsockEINTR            = WSAEINTR;
+  EsockEBADF            = WSAEBADF;
+  EsockEFAULT           = WSAEFAULT;
+  EsockEINVAL           = WSAEINVAL;
+  EsocksEACCESS         = WSAEACCES;
+  EsocksEMFILE          = WSAEMFILE;
+  EsocksEMSGSIZE        = WSAEMSGSIZE;
+  EsocksENOBUFS         = WSAENOBUFS;
+  EsocksENOTCONN        = WSAENOTCONN;
+  EsocksENOTSOCK        = WSAENOTSOCK;
+  EsocksEPROTONOSUPPORT = WSAEPROTONOSUPPORT;
+  EsocksEWOULDBLOCK     = WSAEWOULDBLOCK;
 
 {$i socketsh.inc}
 {$i fpwinsockh.inc}

+ 24 - 0
tests/test/tgeneric14.pp

@@ -0,0 +1,24 @@
+{$mode objfpc}
+
+{ we test the context sensitivity of generics here, by checking whether names
+  are looked up at specialization or at definition time }
+
+uses
+  ugeneric14;
+
+const
+  Foo = 4;
+
+type
+  TIntTest = specialize TGTest<Integer>;
+
+var
+  A: TIntTest;
+begin
+  A := TIntTest.Create;
+  A.DoSomething;
+  writeln(A.data);
+  if A.data = 4 then
+    halt(1);
+  A.Free;
+end.

+ 27 - 0
tests/test/ugeneric14.pp

@@ -0,0 +1,27 @@
+unit ugeneric14;
+
+{$mode objfpc}
+
+interface
+
+type
+  generic TGTest<T> = class
+  public
+    data: T;
+    procedure DoSomething;
+  end;
+
+implementation
+
+function Foo: Integer;
+begin
+  writeln('foo');
+  Result := 1;
+end;
+
+procedure TGTest.DoSomething;
+begin
+  data := Foo;
+end;
+
+end.