From: Alexander Shiryaev Date: Thu, 15 Nov 2012 08:11:50 +0000 (+0400) Subject: FD_ZERO X-Git-Url: http://deadsoftware.ru/gitweb?a=commitdiff_plain;h=fe6a598021984cb3877a36cba81e9c542d9f9547;p=bbcp.git FD_ZERO --- diff --git a/Trurl-based/_Linux_/Comm/Mod/TCP.odc b/Trurl-based/_Linux_/Comm/Mod/TCP.odc index 770b445..f904fc2 100644 Binary files a/Trurl-based/_Linux_/Comm/Mod/TCP.odc and b/Trurl-based/_Linux_/Comm/Mod/TCP.odc differ diff --git a/Trurl-based/_Linux_/Lin/Mod/Net.txt b/Trurl-based/_Linux_/Lin/Mod/Net.txt index 5636fe7..738f28a 100644 --- a/Trurl-based/_Linux_/Lin/Mod/Net.txt +++ b/Trurl-based/_Linux_/Lin/Mod/Net.txt @@ -149,7 +149,6 @@ MODULE LinNet ["libc.so.6"]; (* /usr/include/i386-linux-gnu/bits/typesizes.h *) __FD_SETSIZE = 1024; - __NFDBITS = SIZE(SET) * 8; TYPE SOCKET* = INTEGER; @@ -215,7 +214,7 @@ MODULE LinNet ["libc.so.6"]; (* /usr/include/i386-linux-gnu/sys/select.h *) __fd_mask = SET; - fd_set* = ARRAY [untagged] __FD_SETSIZE DIV __NFDBITS OF __fd_mask; + fd_set* = ARRAY [untagged] __FD_SETSIZE DIV (SIZE(__fd_mask) * 8) OF __fd_mask; VAR h_errno*: INTEGER; @@ -244,7 +243,7 @@ MODULE LinNet ["libc.so.6"]; PROCEDURE FD_ZERO (VAR set: Net.fd_set); VAR i: INTEGER; BEGIN - i := 0; WHILE i < LEN(set) DO set[i] := {}; INC(i) END + i := LEN(set); REPEAT DEC(i); set[i] := {} UNTIL i = 0 END FD_ZERO; PROCEDURE FD_SET (fd: Net.SOCKET; VAR set: Net.fd_set); diff --git a/Trurl-based/_Linux_/Lin/Mod/Termios.txt b/Trurl-based/_Linux_/Lin/Mod/Termios.txt index 8e07bf3..f682c36 100644 --- a/Trurl-based/_Linux_/Lin/Mod/Termios.txt +++ b/Trurl-based/_Linux_/Lin/Mod/Termios.txt @@ -133,16 +133,16 @@ MODULE LinTermios ["libc.so.6"]; END; (* POSIX.1 *) - PROCEDURE [ccall] cfgetispeed* (VAR tp: termios): speed_t; - PROCEDURE [ccall] cfsetispeed* (VAR tp: termios; ispeed: speed_t): INTEGER; - PROCEDURE [ccall] cfgetospeed* (VAR tp: termios): speed_t; - PROCEDURE [ccall] cfsetospeed* (VAR tp: termios; ospeed: speed_t): INTEGER; - PROCEDURE [ccall] tcgetattr* (fd: INTEGER; VAR tp: termios): INTEGER; - PROCEDURE [ccall] tcsetattr* (fd: INTEGER; action: INTEGER; VAR tp: termios): INTEGER; + PROCEDURE [ccall] cfgetispeed* (VAR tp: termios): speed_t; + PROCEDURE [ccall] cfsetispeed* (VAR tp: termios; ispeed: speed_t): INTEGER; + PROCEDURE [ccall] cfgetospeed* (VAR tp: termios): speed_t; + PROCEDURE [ccall] cfsetospeed* (VAR tp: termios; ospeed: speed_t): INTEGER; + PROCEDURE [ccall] tcgetattr* (fd: INTEGER; VAR tp: termios): INTEGER; + PROCEDURE [ccall] tcsetattr* (fd: INTEGER; action: INTEGER; VAR tp: termios): INTEGER; - PROCEDURE [ccall] tcdrain* (fd: INTEGER): INTEGER; - PROCEDURE [ccall] tcflow* (fd: INTEGER; action: INTEGER): INTEGER; - PROCEDURE [ccall] tcflush* (fd: INTEGER; action: INTEGER): INTEGER; - PROCEDURE [ccall] tcsendbreak* (fd: INTEGER; len: INTEGER): INTEGER; + PROCEDURE [ccall] tcdrain* (fd: INTEGER): INTEGER; + PROCEDURE [ccall] tcflow* (fd: INTEGER; action: INTEGER): INTEGER; + PROCEDURE [ccall] tcflush* (fd: INTEGER; action: INTEGER): INTEGER; + PROCEDURE [ccall] tcsendbreak* (fd: INTEGER; len: INTEGER): INTEGER; END LinTermios. diff --git a/Trurl-based/_Linux_/Lin/Mod/gen-Net/Net.txt.templ b/Trurl-based/_Linux_/Lin/Mod/gen-Net/Net.txt.templ index ea54461..756fa5e 100644 --- a/Trurl-based/_Linux_/Lin/Mod/gen-Net/Net.txt.templ +++ b/Trurl-based/_Linux_/Lin/Mod/gen-Net/Net.txt.templ @@ -31,7 +31,6 @@ MODULE LinNet ["libc.so.6"]; %%defs-netdb%% (* /usr/include/i386-linux-gnu/bits/typesizes.h *) __FD_SETSIZE = 1024; - __NFDBITS = SIZE(SET) * 8; TYPE SOCKET* = INTEGER; @@ -97,7 +96,7 @@ MODULE LinNet ["libc.so.6"]; (* /usr/include/i386-linux-gnu/sys/select.h *) __fd_mask = SET; - fd_set* = ARRAY [untagged] __FD_SETSIZE DIV __NFDBITS OF __fd_mask; + fd_set* = ARRAY [untagged] __FD_SETSIZE DIV (SIZE(__fd_mask) * 8) OF __fd_mask; VAR h_errno*: INTEGER; @@ -126,7 +125,7 @@ MODULE LinNet ["libc.so.6"]; PROCEDURE FD_ZERO (VAR set: Net.fd_set); VAR i: INTEGER; BEGIN - i := 0; WHILE i < LEN(set) DO set[i] := {}; INC(i) END + i := LEN(set); REPEAT DEC(i); set[i] := {} UNTIL i = 0 END FD_ZERO; PROCEDURE FD_SET (fd: Net.SOCKET; VAR set: Net.fd_set); diff --git a/Trurl-based/_Linux_/Lin/Mod/gen-Termios/Termios.txt.templ b/Trurl-based/_Linux_/Lin/Mod/gen-Termios/Termios.txt.templ index 5f5f06d..561461a 100644 --- a/Trurl-based/_Linux_/Lin/Mod/gen-Termios/Termios.txt.templ +++ b/Trurl-based/_Linux_/Lin/Mod/gen-Termios/Termios.txt.templ @@ -25,16 +25,16 @@ MODULE LinTermios ["libc.so.6"]; END; (* POSIX.1 *) - PROCEDURE [ccall] cfgetispeed* (VAR tp: termios): speed_t; - PROCEDURE [ccall] cfsetispeed* (VAR tp: termios; ispeed: speed_t): INTEGER; - PROCEDURE [ccall] cfgetospeed* (VAR tp: termios): speed_t; - PROCEDURE [ccall] cfsetospeed* (VAR tp: termios; ospeed: speed_t): INTEGER; - PROCEDURE [ccall] tcgetattr* (fd: INTEGER; VAR tp: termios): INTEGER; - PROCEDURE [ccall] tcsetattr* (fd: INTEGER; action: INTEGER; VAR tp: termios): INTEGER; + PROCEDURE [ccall] cfgetispeed* (VAR tp: termios): speed_t; + PROCEDURE [ccall] cfsetispeed* (VAR tp: termios; ispeed: speed_t): INTEGER; + PROCEDURE [ccall] cfgetospeed* (VAR tp: termios): speed_t; + PROCEDURE [ccall] cfsetospeed* (VAR tp: termios; ospeed: speed_t): INTEGER; + PROCEDURE [ccall] tcgetattr* (fd: INTEGER; VAR tp: termios): INTEGER; + PROCEDURE [ccall] tcsetattr* (fd: INTEGER; action: INTEGER; VAR tp: termios): INTEGER; - PROCEDURE [ccall] tcdrain* (fd: INTEGER): INTEGER; - PROCEDURE [ccall] tcflow* (fd: INTEGER; action: INTEGER): INTEGER; - PROCEDURE [ccall] tcflush* (fd: INTEGER; action: INTEGER): INTEGER; - PROCEDURE [ccall] tcsendbreak* (fd: INTEGER; len: INTEGER): INTEGER; + PROCEDURE [ccall] tcdrain* (fd: INTEGER): INTEGER; + PROCEDURE [ccall] tcflow* (fd: INTEGER; action: INTEGER): INTEGER; + PROCEDURE [ccall] tcflush* (fd: INTEGER; action: INTEGER): INTEGER; + PROCEDURE [ccall] tcsendbreak* (fd: INTEGER; len: INTEGER): INTEGER; END LinTermios. diff --git a/Trurl-based/_OpenBSD_/Comm/Mod/TCP.odc b/Trurl-based/_OpenBSD_/Comm/Mod/TCP.odc index a281fd8..0e430cf 100644 Binary files a/Trurl-based/_OpenBSD_/Comm/Mod/TCP.odc and b/Trurl-based/_OpenBSD_/Comm/Mod/TCP.odc differ diff --git a/Trurl-based/_OpenBSD_/Lin/Mod/Net.txt b/Trurl-based/_OpenBSD_/Lin/Mod/Net.txt index 7c5df4e..95c7e4c 100644 --- a/Trurl-based/_OpenBSD_/Lin/Mod/Net.txt +++ b/Trurl-based/_OpenBSD_/Lin/Mod/Net.txt @@ -257,7 +257,7 @@ MODULE LinNet ["libc.so.66.0"]; PROCEDURE FD_ZERO (VAR set: Net.fd_set); VAR i: INTEGER; BEGIN - i := 0; WHILE i < LEN(set) DO set[i] := {}; INC(i) END + i := LEN(set); REPEAT DEC(i); set[i] := {} UNTIL i = 0 END FD_ZERO; PROCEDURE FD_SET (fd: Net.SOCKET; VAR set: Net.fd_set); diff --git a/Trurl-based/_OpenBSD_/Lin/Mod/Termios.txt b/Trurl-based/_OpenBSD_/Lin/Mod/Termios.txt index 459b6b6..159fe77 100644 --- a/Trurl-based/_OpenBSD_/Lin/Mod/Termios.txt +++ b/Trurl-based/_OpenBSD_/Lin/Mod/Termios.txt @@ -133,22 +133,22 @@ MODULE LinTermios ["libc.so.66.0"]; END; (* POSIX.1 *) - PROCEDURE [ccall] cfgetispeed* (VAR tp: termios): speed_t; - PROCEDURE [ccall] cfsetispeed* (VAR tp: termios; ispeed: speed_t): INTEGER; - PROCEDURE [ccall] cfgetospeed* (VAR tp: termios): speed_t; - PROCEDURE [ccall] cfsetospeed* (VAR tp: termios; ospeed: speed_t): INTEGER; - PROCEDURE [ccall] tcgetattr* (fd: INTEGER; VAR tp: termios): INTEGER; - PROCEDURE [ccall] tcsetattr* (fd: INTEGER; action: INTEGER; VAR tp: termios): INTEGER; + PROCEDURE [ccall] cfgetispeed* (VAR tp: termios): speed_t; + PROCEDURE [ccall] cfsetispeed* (VAR tp: termios; ispeed: speed_t): INTEGER; + PROCEDURE [ccall] cfgetospeed* (VAR tp: termios): speed_t; + PROCEDURE [ccall] cfsetospeed* (VAR tp: termios; ospeed: speed_t): INTEGER; + PROCEDURE [ccall] tcgetattr* (fd: INTEGER; VAR tp: termios): INTEGER; + PROCEDURE [ccall] tcsetattr* (fd: INTEGER; action: INTEGER; VAR tp: termios): INTEGER; - PROCEDURE [ccall] tcdrain* (fd: INTEGER): INTEGER; - PROCEDURE [ccall] tcflow* (fd: INTEGER; action: INTEGER): INTEGER; - PROCEDURE [ccall] tcflush* (fd: INTEGER; action: INTEGER): INTEGER; - PROCEDURE [ccall] tcsendbreak* (fd: INTEGER; len: INTEGER): INTEGER; + PROCEDURE [ccall] tcdrain* (fd: INTEGER): INTEGER; + PROCEDURE [ccall] tcflow* (fd: INTEGER; action: INTEGER): INTEGER; + PROCEDURE [ccall] tcflush* (fd: INTEGER; action: INTEGER): INTEGER; + PROCEDURE [ccall] tcsendbreak* (fd: INTEGER; len: INTEGER): INTEGER; (* extensions *) (* - PROCEDURE [ccall] cfsetspeed* (VAR tp: termios; speed: speed_t): INTEGER; - PROCEDURE [ccall] cfmakeraw* (VAR tp: termios); + PROCEDURE [ccall] cfsetspeed* (VAR tp: termios; speed: speed_t): INTEGER; + PROCEDURE [ccall] cfmakeraw* (VAR tp: termios); *) END LinTermios. diff --git a/Trurl-based/_OpenBSD_/Lin/Mod/gen-Net/Net.txt.templ b/Trurl-based/_OpenBSD_/Lin/Mod/gen-Net/Net.txt.templ index 6d16b28..0be10b6 100644 --- a/Trurl-based/_OpenBSD_/Lin/Mod/gen-Net/Net.txt.templ +++ b/Trurl-based/_OpenBSD_/Lin/Mod/gen-Net/Net.txt.templ @@ -127,7 +127,7 @@ MODULE LinNet ["libc.so.66.0"]; PROCEDURE FD_ZERO (VAR set: Net.fd_set); VAR i: INTEGER; BEGIN - i := 0; WHILE i < LEN(set) DO set[i] := {}; INC(i) END + i := LEN(set); REPEAT DEC(i); set[i] := {} UNTIL i = 0 END FD_ZERO; PROCEDURE FD_SET (fd: Net.SOCKET; VAR set: Net.fd_set); diff --git a/Trurl-based/_OpenBSD_/Lin/Mod/gen-Termios/Termios.txt.templ b/Trurl-based/_OpenBSD_/Lin/Mod/gen-Termios/Termios.txt.templ index ebb67e8..81760c5 100644 --- a/Trurl-based/_OpenBSD_/Lin/Mod/gen-Termios/Termios.txt.templ +++ b/Trurl-based/_OpenBSD_/Lin/Mod/gen-Termios/Termios.txt.templ @@ -24,22 +24,22 @@ MODULE LinTermios ["libc.so.66.0"]; END; (* POSIX.1 *) - PROCEDURE [ccall] cfgetispeed* (VAR tp: termios): speed_t; - PROCEDURE [ccall] cfsetispeed* (VAR tp: termios; ispeed: speed_t): INTEGER; - PROCEDURE [ccall] cfgetospeed* (VAR tp: termios): speed_t; - PROCEDURE [ccall] cfsetospeed* (VAR tp: termios; ospeed: speed_t): INTEGER; - PROCEDURE [ccall] tcgetattr* (fd: INTEGER; VAR tp: termios): INTEGER; - PROCEDURE [ccall] tcsetattr* (fd: INTEGER; action: INTEGER; VAR tp: termios): INTEGER; + PROCEDURE [ccall] cfgetispeed* (VAR tp: termios): speed_t; + PROCEDURE [ccall] cfsetispeed* (VAR tp: termios; ispeed: speed_t): INTEGER; + PROCEDURE [ccall] cfgetospeed* (VAR tp: termios): speed_t; + PROCEDURE [ccall] cfsetospeed* (VAR tp: termios; ospeed: speed_t): INTEGER; + PROCEDURE [ccall] tcgetattr* (fd: INTEGER; VAR tp: termios): INTEGER; + PROCEDURE [ccall] tcsetattr* (fd: INTEGER; action: INTEGER; VAR tp: termios): INTEGER; - PROCEDURE [ccall] tcdrain* (fd: INTEGER): INTEGER; - PROCEDURE [ccall] tcflow* (fd: INTEGER; action: INTEGER): INTEGER; - PROCEDURE [ccall] tcflush* (fd: INTEGER; action: INTEGER): INTEGER; - PROCEDURE [ccall] tcsendbreak* (fd: INTEGER; len: INTEGER): INTEGER; + PROCEDURE [ccall] tcdrain* (fd: INTEGER): INTEGER; + PROCEDURE [ccall] tcflow* (fd: INTEGER; action: INTEGER): INTEGER; + PROCEDURE [ccall] tcflush* (fd: INTEGER; action: INTEGER): INTEGER; + PROCEDURE [ccall] tcsendbreak* (fd: INTEGER; len: INTEGER): INTEGER; (* extensions *) (* - PROCEDURE [ccall] cfsetspeed* (VAR tp: termios; speed: speed_t): INTEGER; - PROCEDURE [ccall] cfmakeraw* (VAR tp: termios); + PROCEDURE [ccall] cfsetspeed* (VAR tp: termios; speed: speed_t): INTEGER; + PROCEDURE [ccall] cfmakeraw* (VAR tp: termios); *) END LinTermios.