2009-07-31 11:31 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)

* harbour/source/rtl/hbinet.c
    ! modified hb_inetRecv[All]() to always return number
      of bytes read if at least one byte was successfully read
      just like in documentation so it's not longer necessary to
      use hb_inetCount() to check real number of read bytes.
      On error they return -1 and 0 when foreign host closed connection.
    ! modified hb_inetSend[All]() to always return number of written
      bytes if at least one byte was successfully written so it's not
      longer necessary to use hb_inetCount() to check real number of
      written bytes. On error they return -1.
    ! modified hb_inetRecvLine() to return "" on errors and always
      set numeric value with error code or number of bytes read
      in 2-nd parameter passed by reference
    ! modified hb_inetDataReady() to return -1 instead of .F. to
      indicate errors when socket is not open socket
    ! modified  hb_inetRecvLine() and hb_inetRecvEndBlock() to work
      like in documentation and set in 2-nd parameter passed by
      reference the size of read line with line terminator, -1
      or error and 0 when foreign host closed connection.
    ! modified hb_inetRecvEndBlock() to always use default EOL when
      there is no not empty string in passed string parameter or
      passed array with line terminators
    ! fixed some small differences between hb_inetRecvLine() and
      hb_inetRecvEndBlock()
    ! fixed returned values in hb_InetDGramSend() and hb_InetDGramRecv()
      to be synced with documentation
    * minor: modified hb_inetRecvEndBlock() to use as default EOL
      s_inetCRLF instead of hardcoded "\r\n"
    * eliminated some redundant code
    + added automatic socket initialization in windows builds
    % added support for read ahead buffer in hb_inetRecvLine() and
      hb_inetRecvEndBlock() and updated other functions which may
      interact with it. It greatly improved the speed of code
      which extensively uses above functions.

   Warning!!! Above modifications may force updating other code which used
              some undocumented hb_inet*() functions behavior i.e. some side
              effects in previous implementation. Please update your code
              if necessary.

  * harbour/doc/inet.txt
    ! modified hb_inetAccept() documentation wrongly describing value
      returned on error when it's NIL

  * harbour/config/os2/watcom.cf
    ! fixes for real OS2 command processor - please test
This commit is contained in:
Przemyslaw Czerpak
2009-07-31 09:32:11 +00:00
parent 1058de3021
commit bbd1e6b0a4
4 changed files with 555 additions and 720 deletions

View File

@@ -17,6 +17,54 @@
past entries belonging to author(s): Viktor Szakats.
*/
2009-07-31 11:31 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/source/rtl/hbinet.c
! modified hb_inetRecv[All]() to always return number
of bytes read if at least one byte was successfully read
just like in documentation so it's not longer necessary to
use hb_inetCount() to check real number of read bytes.
On error they return -1 and 0 when foreign host closed connection.
! modified hb_inetSend[All]() to always return number of written
bytes if at least one byte was successfully written so it's not
longer necessary to use hb_inetCount() to check real number of
written bytes. On error they return -1.
! modified hb_inetRecvLine() to return "" on errors and always
set numeric value with error code or number of bytes read
in 2-nd parameter passed by reference
! modified hb_inetDataReady() to return -1 instead of .F. to
indicate errors when socket is not open socket
! modified hb_inetRecvLine() and hb_inetRecvEndBlock() to work
like in documentation and set in 2-nd parameter passed by
reference the size of read line with line terminator, -1
or error and 0 when foreign host closed connection.
! modified hb_inetRecvEndBlock() to always use default EOL when
there is no not empty string in passed string parameter or
passed array with line terminators
! fixed some small differences between hb_inetRecvLine() and
hb_inetRecvEndBlock()
! fixed returned values in hb_InetDGramSend() and hb_InetDGramRecv()
to be synced with documentation
* minor: modified hb_inetRecvEndBlock() to use as default EOL
s_inetCRLF instead of hardcoded "\r\n"
* eliminated some redundant code
+ added automatic socket initialization in windows builds
% added support for read ahead buffer in hb_inetRecvLine() and
hb_inetRecvEndBlock() and updated other functions which may
interact with it. It greatly improved the speed of code
which extensively uses above functions.
Warning!!! Above modifications may force updating other code which used
some undocumented hb_inet*() functions behavior i.e. some side
effects in previous implementation. Please update your code
if necessary.
* harbour/doc/inet.txt
! modified hb_inetAccept() documentation wrongly describing value
returned on error when it's NIL
* harbour/config/os2/watcom.cf
! fixes for real OS2 command processor - please test
2009-07-31 11:09 UTC+0200 Viktor Szakats (harbour.01 syenar.hu)
* include/hbdefs.h
* include/hbsetup.h

View File

@@ -62,27 +62,9 @@ CC_RULE = $(CC) $(CPPFLAGS) $(subst /,\,$(CFLAGS)) $(HB_CDBG) $(subst /,\,$(HB_U
endif
endif
# Note: The empty line directly before 'endef' HAVE TO exist!
# It causes that the 'echo' command is separated by LF
define link_file
@echo FILE $(file) >> __link__.tmp
endef
#Note: The empty line directly before 'endef' HAVE TO exist!
define link_lib
@echo LIB $(lib) >> __link__.tmp
endef
define link_exe_file
@echo $(LDFLAGS) NAME $(EXE_DIR)/$@ > __link__.tmp
$(foreach file, $(^F), $(link_file))
$(foreach lib, $(LINKLIBS), $(link_lib))
$(foreach lib, $(RDDLIBS), $(link_lib))
$(foreach lib, $(GTLIBS), $(link_lib))
-$(LD) @__link__.tmp
endef
empty:=
space:= $(empty) $(empty)
comma:= ,
LD = wlink
LDFLAGS = sys OS2V2
@@ -101,20 +83,26 @@ ifeq ($(findstring hbrtl,$(LIBS)),hbrtl)
GTLIBS = $(foreach gt, $(HB_GT_LIBS), $(LIB_DIR)/$(gt))
endif
LD_RULE = $(link_exe_file) $(HB_USER_LDFLAGS)
#Note: The empty line below HAVE TO exist!
define lib_object
@echo -+$(file) >> __lib__.tmp
endef
LDFILES = $(subst $(space),$(comma) ,$(^F))
LDLIBS = $(subst $(space),$(comma) ,$(strip $(LINKLIBS) $(RDDLIBS) $(GTLIBS)))
LD_RULE = $(LD) $(LDFLAGS) $(HB_USER_LDFLAGS) NAME $(EXE_DIR)/$@ FILE $(LDFILES) $(if $(LDLIBS), LIB $(LDLIBS),)
# maximum size of command line in OS2 is limited to 1024 characters
# the trick below with 'wordlist' is workaround for it
define create_library
@echo $(LIB_DIR)/$@ > __lib__.tmp
$(foreach file, $(^F), $(lib_object))
echo $(LIB_DIR)/$@ > __lib__.tmp
$(if $(wordlist 1, 50,$(^F)), echo $(wordlist 1, 50,$(addprefix -+,$(^F))) >> __lib__.tmp,)
$(if $(wordlist 51,100,$(^F)), echo $(wordlist 51,100,$(addprefix -+,$(^F))) >> __lib__.tmp,)
$(if $(wordlist 101,150,$(^F)), echo $(wordlist 101,150,$(addprefix -+,$(^F))) >> __lib__.tmp,)
$(if $(wordlist 151,200,$(^F)), echo $(wordlist 151,200,$(addprefix -+,$(^F))) >> __lib__.tmp,)
$(if $(wordlist 201,250,$(^F)), echo $(wordlist 201,250,$(addprefix -+,$(^F))) >> __lib__.tmp,)
$(if $(wordlist 250,300,$(^F)), echo $(wordlist 250,300,$(addprefix -+,$(^F))) >> __lib__.tmp,)
$(if $(wordlist 300,999,$(^F)), echo $(wordlist 300,999,$(addprefix -+,$(^F))) >> __lib__.tmp,)
$(AR) $(ARFLAGS) @__lib__.tmp
endef
ARFILES = $(addprefix -+,$(^F))
AR = wlib
ARFLAGS = -p=64 -c -n $(HB_USER_AFLAGS)
AR_RULE = $(create_library)

View File

@@ -147,7 +147,8 @@
* hb_InetAccept( SOCKET ) --> SOCKET
* Waits until a connection is available on a socket created with hb_InetServer;
* Returns a socket that can be used to communicate with the incoming client.
* On error, sets error in the newly returned socket.
* On error, NIL is returned and error code sets in the passed SOCKET.
* This error can be accessed using hb_InetErrorCode() function.
*
* Client side socket functions
* ----------------------------

File diff suppressed because it is too large Load Diff