diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 956579d4dc..2a440ccee0 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -16,6 +16,76 @@ The license applies to all entries newer than 2009-04-28. */ +2010-07-15 16:57 UTC+0200 Viktor Szakats (harbour.01 syenar.hu) + * INSTALL + + config/vxworks + + config/vxworks/libs.mk + + config/vxworks/gcc.mk + + config/vxworks/diab.mk + + config/vxworks/global.mk + + Started experimental VxWorks port. + ; NOTE: VxWorks port was made possible by Wind River Systems Inc., + who were so kind to mail me a full VxWorks development + environment, for the purpose of porting Harbour to this + platform. Thank you very much guys. + + [ The free license is valid for one month, so if anyone + is interested in helping in this project, I can help with + real tests, builds and information. BTW, the devenv is + Eclipse based plus cmdline, running on Windows (available + for Linux and Solaris, too) and the target VxWorks exes + run in a virtual environment. ] + + * config/global.mk + + Added autodetection of VxWorks platform. + + * utils/hbmk2/hbmk2.prg + + Added VxWorks support. It's incomplete yet. + ! Fixed to quote *nix/gcc compiler family in + Windows-host cross-platform situations. + + * src/vm/thread.c + * src/common/hbgete.c + * src/common/hbffind.c + * src/common/hbtrace.c + * src/common/hbdate.c + * src/rtl/gtstd/gtstd.c + * src/rtl/gttrm/Makefile + * src/rtl/hbsocket.c + * src/rtl/filesys.c + * src/rtl/diskspac.c + * src/rtl/cputime.c + * src/rtl/disksphb.c + * src/rtl/gtpca/gtpca.c + * src/rtl/net.c + * src/rtl/hbproces.c + * src/rtl/gtsys.c + * src/rtl/hbcom.c + * external/zlib/inflate.c + * external/jpeg/jmorecfg.h + * external/pcre/Makefile + * include/hbapifs.h + * include/hbthread.h + * include/hbdefs.h + * include/hbsetup.h + * contrib/xhb/hboutdbg.c + * contrib/xhb/hbsyslog.c + * contrib/xhb/hbserv.c + + vxworks/gcc port. First phase. + ; Please review. + ; NOTE: - vxworks has no termios, for serial comm + support it has sioLib.h. + - vxworks supports another C compiler, which + was not tested yet. + - vxworks supports lots of CPUs, only x86 was + tested yet. + - There are still mutex related warnings to sort out. + - Some parts had to disabled, like HB_LIB*() functionality. + ; TODO: Regenarate .difs in external/. + + * src/vm/hashfunc.c + * Silenced warnings shown by vxworks/gcc. + 2010-07-15 07:12 UTC+0200 Viktor Szakats (harbour.01 syenar.hu) * contrib/hbdoc2/hbdoc2.prg * contrib/hbdoc2/hbdoc2.hbp diff --git a/harbour/INSTALL b/harbour/INSTALL index d52ddd4ec6..51ab8a3499 100644 --- a/harbour/INSTALL +++ b/harbour/INSTALL @@ -475,6 +475,7 @@ HARBOUR hpux - HP-UX sunos - Sun Solaris / OpenSolaris qnx - QNX + vxworks - VxWorks win - MS Windows (all flavors) (see LINKS section for Win9x requirements) wce - MS Windows CE @@ -516,6 +517,11 @@ HARBOUR --- gcc - GNU C + vxworks + ------- + gcc - GNU C + diab - Wind River Compiler + sunos ----- gcc - GNU C @@ -923,6 +929,13 @@ HARBOUR win-make --- + --- VxWorks 6.8 (requires preceding build for Windows target) + wrenv -p vxworks-6.8 + set HB_COMPILER=gcc + set HB_CCPOSTFIX=pentium + win-make + --- + --8<-- rem ; Add these *before* above sample scripts to configure 3rd party dependencies. rem When using MSYS or Cygwin shell you'll have to use forward slashes and @@ -1258,6 +1271,8 @@ HARBOUR x win -> dos/watcom x86 x win -> os2/watcom x86 x win -> linux/watcom x86 + x win -> vxworks/gcc (CPU cross-builds possible: x86, arm, coldfire, mips, ppc) + x win -> vxworks/diab (CPU cross-builds possible) dos -> dos/djgpp x86 dos -> dos/watcom x86 x dos -> win/watcom x86 @@ -1282,6 +1297,8 @@ HARBOUR x linux -> os2/watcom x86 x linux -> dos/watcom x86 x linux -> dos/djgpp x86 + x linux -> vxworks/gcc (CPU cross-builds possible: x86, arm, coldfire, mips, ppc) + x linux -> vxworks/diab (CPU cross-builds possible) bsd -> bsd/gcc (CPU cross-builds possible) bsd -> bsd/clang (CPU cross-builds possible) x bsd -> wce/mingwarm arm @@ -1309,6 +1326,8 @@ HARBOUR x sunos -> wce/mingw x86 x sunos -> win/mingw x86 x sunos -> dos/djgpp x86 + x sunos -> vxworks/gcc (CPU cross-builds possible: x86, arm, coldfire, mips, ppc) + x sunos -> vxworks/diab (CPU cross-builds possible) Leading 'x' marks cross-platform scenarios. diff --git a/harbour/config/global.mk b/harbour/config/global.mk index 5b8017ca72..d4a828e459 100644 --- a/harbour/config/global.mk +++ b/harbour/config/global.mk @@ -545,6 +545,9 @@ ifeq ($(HB_PLATFORM),) endif endif endif + ifneq ($(findstring vxworks,$(WIND_PLATFORM)),) + HB_PLATFORM := vxworks + endif ifneq ($(HB_PLATFORM),) HB_PLAT_AUTO := (autodetected) endif diff --git a/harbour/config/vxworks/diab.mk b/harbour/config/vxworks/diab.mk new file mode 100644 index 0000000000..f40a3b3817 --- /dev/null +++ b/harbour/config/vxworks/diab.mk @@ -0,0 +1,57 @@ +# +# $Id$ +# + +ifeq ($(HB_CMP),) + ifeq ($(HB_BUILD_MODE),cpp) + HB_CMP := dplus + else + HB_CMP := dcc + endif +endif + +OBJ_EXT := .o +LIB_PREF := lib +LIB_EXT := .a + +HB_DYN_COPT := -DHB_DYNLIB -Xcode-relative-far + +CC := $(HB_CCACHE) $(HB_CCPREFIX)$(HB_CMP) +CC_IN := -c +CC_OUT := -o + +CFLAGS += -I. -I$(HB_INC_COMPILE) + +ifneq ($(HB_BUILD_WARN),no) + CFLAGS += -W -Xlint +else + CFLAGS += -W +endif + +ifneq ($(HB_BUILD_OPTIM),no) + CFLAGS += -XO level-3 +endif + +ifeq ($(HB_BUILD_DEBUG),yes) + CFLAGS += -g +endif + +LD := $(HB_CCACHE) $(HB_CCPREFIX)$(HB_CMP)$(HB_CCPOSTFIX) +LD_OUT := -o + +LIBPATHS := $(foreach dir,$(LIB_DIR) $(SYSLIBPATHS),-L$(dir)) +LDLIBS := $(foreach lib,$(HB_USER_LIBS) $(LIBS) $(SYSLIBS),-l$(lib)) + +LDFLAGS += $(LIBPATHS) + +AR := $(HB_CCPREFIX)ar$(HB_CCPOSTFIX) +AR_RULE = ( $(AR) $(ARFLAGS) $(HB_AFLAGS) $(HB_USER_AFLAGS) rcs $(LIB_DIR)/$@ $(^F) $(ARSTRIP) ) || ( $(RM) $(LIB_DIR)/$@ && $(FALSE) ) + +DY := $(CC) +DFLAGS += -shared $(LIBPATHS) +DY_OUT := -o$(subst x,x, ) +DLIBS := $(foreach lib,$(HB_USER_LIBS) $(SYSLIBS),-l$(lib)) + +DY_RULE = $(DY) $(DFLAGS) $(HB_USER_DFLAGS) $(DY_OUT)$(DYN_DIR)/$@ $^ $(DLIBS) $(DYSTRIP) && $(LN) $(@F) $(DYN_FILE2) + +include $(TOP)$(ROOT)config/rules.mk diff --git a/harbour/config/vxworks/gcc.mk b/harbour/config/vxworks/gcc.mk new file mode 100644 index 0000000000..b611434d49 --- /dev/null +++ b/harbour/config/vxworks/gcc.mk @@ -0,0 +1,80 @@ +# +# $Id$ +# + +ifeq ($(HB_CMP),) + ifeq ($(HB_BUILD_MODE),cpp) + HB_CMP := g++ + else + HB_CMP := cc + endif +endif + +OBJ_EXT := .o +LIB_PREF := lib +LIB_EXT := .a + +HB_DYN_COPT := -DHB_DYNLIB -fpic + +CC := $(HB_CCACHE) $(HB_CCPREFIX)$(HB_CMP)$(HB_CCPOSTFIX) +CC_IN := -c +CC_OUT := -o + +CFLAGS += -mrtp +LDFLAGS += -mrtp +DFLAGS += -mrtp + +CFLAGS += -I. -I$(HB_INC_COMPILE) +CFLAGS += -I$(WIND_USR)/h -I$(WIND_USR)/h/wrn/coreip +CFLAGS += -fno-strict-aliasing +CFLAGS += -D_C99 -D_HAS_C9X +# ? +CFLAGS += -D_VX_TOOL_FAMILY=gnu -D_VX_TOOL=gnu +CFLAGS += -D_VX_CPU=_VX_SIMPENTIUM + +ifneq ($(HB_BUILD_WARN),no) + CFLAGS += -W -Wall +else + CFLAGS += -W +endif + +ifneq ($(HB_BUILD_OPTIM),no) + CFLAGS += -O3 +endif + +ifeq ($(HB_BUILD_DEBUG),yes) + CFLAGS += -g +endif + +LD := $(CC) +LD_OUT := -o + +LDLIBPATHS := $(foreach dir,$(LIB_DIR) $(SYSLIBPATHS_BIN),-L$(dir)) +DLIBPATHS := $(foreach dir,$(LIB_DIR) $(SYSLIBPATHS_DYN),-L$(dir)) + +LDLIBS := $(foreach lib,$(HB_USER_LIBS) $(LIBS) $(SYSLIBS),-l$(lib)) + +LDFLAGS += $(LDLIBPATHS) + +AR := $(HB_CCPREFIX)ar$(HB_CCPOSTFIX) +AR_RULE = ( $(AR) $(ARFLAGS) $(HB_AFLAGS) $(HB_USER_AFLAGS) rcs $(LIB_DIR)/$@ $(^F) $(ARSTRIP) ) || ( $(RM) $(LIB_DIR)/$@ && $(FALSE) ) + +DY := $(CC) +DFLAGS += -shared $(DLIBPATHS) +DY_OUT := -o$(subst x,x, ) +DLIBS := $(foreach lib,$(HB_USER_LIBS) $(SYSLIBS),-l$(lib)) + +# NOTE: The empty line directly before 'endef' HAVE TO exist! +define dynlib_object + @$(ECHO) $(ECHOQUOTE)INPUT($(subst \,/,$(file)))$(ECHOQUOTE) >> __dyn__.tmp + +endef +define create_dynlib + $(if $(wildcard __dyn__.tmp),@$(RM) __dyn__.tmp,) + $(foreach file,$^,$(dynlib_object)) + $(DY) $(DFLAGS) $(HB_USER_DFLAGS) $(DY_OUT)$(DYN_DIR)/$@ __dyn__.tmp $(DLIBS) $(DYSTRIP) +endef + +DY_RULE = $(create_dynlib) + +include $(TOP)$(ROOT)config/rules.mk diff --git a/harbour/config/vxworks/global.mk b/harbour/config/vxworks/global.mk new file mode 100644 index 0000000000..366bf4248c --- /dev/null +++ b/harbour/config/vxworks/global.mk @@ -0,0 +1,17 @@ +# +# $Id$ +# + +all : first + +BIN_EXT := .vxe +DYN_EXT := .so +DYN_PREF := lib + +ifneq ($(filter $(HB_BUILD_STRIP),all lib),) + ARSTRIP = && strip$(HB_CCPOSTFIX) $(LIB_DIR)/$@ +endif +ifneq ($(filter $(HB_BUILD_STRIP),all bin),) + LDSTRIP := -s + DYSTRIP := -s +endif diff --git a/harbour/config/vxworks/libs.mk b/harbour/config/vxworks/libs.mk new file mode 100644 index 0000000000..db9451d2c1 --- /dev/null +++ b/harbour/config/vxworks/libs.mk @@ -0,0 +1,8 @@ +# +# $Id$ +# + +SYSLIBPATHS := + +SYSLIBPATHS_BIN := $(WIND_BASE)/target/lib/usr/lib/simpentium/SIMPENTIUM/common +SYSLIBPATHS_DYN := $(WIND_BASE)/target/lib/usr/lib/simpentium/SIMPENTIUM/common/PIC diff --git a/harbour/contrib/xhb/hboutdbg.c b/harbour/contrib/xhb/hboutdbg.c index 716739bf4e..5e3c7388e9 100644 --- a/harbour/contrib/xhb/hboutdbg.c +++ b/harbour/contrib/xhb/hboutdbg.c @@ -64,7 +64,7 @@ #include #endif -#if defined( HB_OS_UNIX ) +#if defined( HB_OS_UNIX ) && !defined( HB_OS_VXWORKS ) #include #include @@ -139,7 +139,7 @@ HB_BOOL hb_OutDebugName( PHB_ITEM pName ) { HB_BOOL bRet; -#if defined( HB_OS_UNIX ) +#if defined( HB_OS_UNIX ) && !defined( HB_OS_VXWORKS ) if( s_iDebugFd == 0 && pName != NULL) { hb_strncpy( s_szDebugName, hb_itemGetCPtr( pName ), sizeof( s_szDebugName ) - 1 ); @@ -166,7 +166,7 @@ HB_BOOL hb_OutDebugName( PHB_ITEM pName ) void hb_OutDebug( const char * szMsg, HB_SIZE nMsgLen ) { -#if defined( HB_OS_UNIX ) +#if defined( HB_OS_UNIX ) && !defined( HB_OS_VXWORKS ) int iStatus, iPid; /* Are we under X? */ @@ -192,12 +192,12 @@ void hb_OutDebug( const char * szMsg, HB_SIZE nMsgLen ) } } - if( s_iDebugFd > 0 && HB_ISCHAR(1) ) + if( s_iDebugFd > 0 && HB_ISCHAR( 1 ) ) { fd_set wrds; struct timeval tv = { 0, 100000 }; /* wait each time a tenth of second */ - FD_ZERO(&wrds); - FD_SET(s_iDebugFd, &wrds); + FD_ZERO( &wrds ); + FD_SET( s_iDebugFd, &wrds ); if( select( s_iDebugFd + 1, NULL, &wrds, NULL, &tv ) > 0 ) { @@ -205,8 +205,8 @@ void hb_OutDebug( const char * szMsg, HB_SIZE nMsgLen ) { tv.tv_sec = 0; tv.tv_usec = 100000; - FD_ZERO(&wrds); - FD_SET(s_iDebugFd, &wrds); + FD_ZERO( &wrds ); + FD_SET( s_iDebugFd, &wrds ); if( select( s_iDebugFd + 1, NULL, &wrds, NULL, &tv ) > 0 ) { if( write( s_iDebugFd, "\n", 1 ) != 1 ) {} diff --git a/harbour/contrib/xhb/hbserv.c b/harbour/contrib/xhb/hbserv.c index 7685d55166..6ce226d461 100644 --- a/harbour/contrib/xhb/hbserv.c +++ b/harbour/contrib/xhb/hbserv.c @@ -217,10 +217,12 @@ static void s_signalHandler( int sig, siginfo_t * info, void * v ) #endif { hb_arraySetNI( pRet, HB_SERVICE_OSSUBSIG, info->si_code ); + #if ! defined( HB_OS_VXWORKS ) hb_arraySetNI( pRet, HB_SERVICE_OSERROR, info->si_errno ); hb_arraySetPtr( pRet, HB_SERVICE_ADDRESS, ( void * ) info->si_addr ); hb_arraySetNI( pRet, HB_SERVICE_PROCESS, info->si_pid ); hb_arraySetNI( pRet, HB_SERVICE_UID, info->si_uid ); + #endif } #endif @@ -764,7 +766,7 @@ HB_FUNC( HB_STARTSERVICE ) } #endif - #ifdef HB_OS_UNIX + #if defined( HB_OS_UNIX ) && ! defined( HB_OS_VXWORKS ) { int pid; @@ -985,7 +987,9 @@ HB_FUNC( HB_SIGNALDESC ) case FPE_FLTOVF: hb_retc_const( "Floating point: floating point overflow"); return; case FPE_FLTUND: hb_retc_const( "Floating point: floating point underflow"); return; case FPE_FLTRES: hb_retc_const( "Floating point: floating point inexact result"); return; + #if ! defined( HB_OS_VXWORKS ) case FPE_FLTINV: hb_retc_const( "Floating point: floating point invalid operation"); return; + #endif #if ! defined( HB_OS_DARWIN ) case FPE_FLTSUB: hb_retc_const( "Floating point: subscript out of range"); return; #endif diff --git a/harbour/contrib/xhb/hbsyslog.c b/harbour/contrib/xhb/hbsyslog.c index ad8f062fbc..133c5f9f38 100644 --- a/harbour/contrib/xhb/hbsyslog.c +++ b/harbour/contrib/xhb/hbsyslog.c @@ -16,7 +16,7 @@ static HANDLE s_RegHandle; -#elif ( defined( HB_OS_UNIX ) || defined( HB_OS_LINUX ) ) && !defined( __WATCOMC__ ) +#elif ( defined( HB_OS_UNIX ) || defined( HB_OS_LINUX ) ) && !defined( __WATCOMC__ ) && !defined( HB_OS_VXWORKS ) #include @@ -42,7 +42,7 @@ HB_FUNC( HB_SYSLOGOPEN ) s_RegHandle = NULL; hb_retl( HB_FALSE ); #endif - #elif defined( HB_OS_UNIX ) && !defined( __WATCOMC__ ) + #elif defined( HB_OS_UNIX ) && !defined( __WATCOMC__ ) && !defined( HB_OS_VXWORKS ) openlog( hb_parcx( 1 ), LOG_NDELAY | LOG_NOWAIT | LOG_PID, LOG_USER ); hb_retl( HB_TRUE ); #else @@ -63,7 +63,7 @@ HB_FUNC( HB_SYSLOGCLOSE ) else #endif hb_retl( HB_FALSE ); - #elif defined( HB_OS_UNIX ) && !defined( __WATCOMC__ ) + #elif defined( HB_OS_UNIX ) && !defined( __WATCOMC__ ) && !defined( HB_OS_VXWORKS ) closelog(); hb_retl( HB_TRUE ); #else @@ -105,7 +105,7 @@ HB_FUNC( HB_SYSLOGMESSAGE ) else #endif hb_retl( HB_FALSE ); - #elif defined( HB_OS_UNIX ) && !defined( __WATCOMC__ ) + #elif defined( HB_OS_UNIX ) && !defined( __WATCOMC__ ) && !defined( HB_OS_VXWORKS ) int logval; switch( hb_parni( 2 ) ) diff --git a/harbour/external/jpeg/jmorecfg.h b/harbour/external/jpeg/jmorecfg.h index 928d052c83..4e24d6d881 100644 --- a/harbour/external/jpeg/jmorecfg.h +++ b/harbour/external/jpeg/jmorecfg.h @@ -138,7 +138,9 @@ typedef unsigned char UINT8; #ifdef CHAR_IS_UNSIGNED typedef char UINT8; #else /* not CHAR_IS_UNSIGNED */ +#ifndef __INCvxTypesOldh /* VxWorks defines this */ typedef short UINT8; +#endif #endif /* CHAR_IS_UNSIGNED */ #endif /* HAVE_UNSIGNED_CHAR */ @@ -147,7 +149,9 @@ typedef short UINT8; #ifdef HAVE_UNSIGNED_SHORT typedef unsigned short UINT16; #else /* not HAVE_UNSIGNED_SHORT */ +#ifndef __INCvxTypesOldh /* VxWorks defines this */ typedef unsigned int UINT16; +#endif #endif /* HAVE_UNSIGNED_SHORT */ /* INT16 must hold at least the values -32768..32767. */ @@ -162,11 +166,13 @@ typedef short INT16; #ifndef _BASETSD_H_ /* Microsoft defines it in basetsd.h */ #ifndef _BASETSD_H /* MinGW is slightly different */ #ifndef QGLOBAL_H /* Qt defines it in qglobal.h */ +#ifndef __INCvxTypesOldh /* VxWorks defines this */ typedef long INT32; #endif #endif #endif #endif +#endif /* Datatype used for image dimensions. The JPEG standard only supports * images up to 64K*64K due to 16-bit fields in SOF markers. Therefore @@ -190,6 +196,9 @@ typedef unsigned int JDIMENSION; /* a function called through method pointers: */ #define METHODDEF(type) static type /* a function used only in its module: */ +#ifdef __INCvxTypesOldh /* VxWorks defines this */ +#undef LOCAL +#endif #define LOCAL(type) static type /* a function referenced thru EXTERNs: */ #define GLOBAL(type) type diff --git a/harbour/external/pcre/Makefile b/harbour/external/pcre/Makefile index d219cfc688..b549257c3c 100644 --- a/harbour/external/pcre/Makefile +++ b/harbour/external/pcre/Makefile @@ -41,6 +41,10 @@ ifneq ($(HB_HAS_PCRE_LOCAL),) ifneq ($(filter $(HB_COMPILER),bcc msvc msvc64 msvcia64 icc iccia64 djgpp),) HB_CFLAGS += -DHAVE_INTTYPES_H=0 + else + ifneq ($(filter $(HB_PLATFORM),vxworks),) + HB_CFLAGS += -DHAVE_INTTYPES_H=0 + endif endif HB_CFLAGS += -DHAVE_CONFIG_H diff --git a/harbour/external/zlib/inflate.c b/harbour/external/zlib/inflate.c index a8431abeac..81644f74bb 100644 --- a/harbour/external/zlib/inflate.c +++ b/harbour/external/zlib/inflate.c @@ -408,6 +408,7 @@ unsigned out; /* Macros for inflate(): */ /* check function to use adler32() for zlib or crc32() for gzip */ +#undef UPDATE /* VxWorks defines it */ #ifdef GUNZIP # define UPDATE(check, buf, len) \ (state->flags ? crc32(check, buf, len) : adler32(check, buf, len)) diff --git a/harbour/include/hbapifs.h b/harbour/include/hbapifs.h index 438a3c7edc..41dae3cf24 100644 --- a/harbour/include/hbapifs.h +++ b/harbour/include/hbapifs.h @@ -135,6 +135,10 @@ HB_EXTERN_BEGIN #define HB_FA_RWXG ( HB_FA_RGRP | HB_FA_WGRP | HB_FA_XGRP ) #define HB_FA_RWXO ( HB_FA_ROTH | HB_FA_WOTH | HB_FA_XOTH ) +#if defined( HB_OS_VXWORKS ) && ! defined( S_ISVTX ) +# define S_ISVTX 0 +#endif + /* macros to convert Harbour attributes to POSIX ones */ #define HB_FA_POSIX_SID(a) ( ( ( ( a ) & HB_FA_SVTX ) ? S_ISVTX : 0 ) | \ ( ( ( a ) & HB_FA_SGID ) ? S_ISGID : 0 ) | \ diff --git a/harbour/include/hbdefs.h b/harbour/include/hbdefs.h index 6d87a9ecfc..12a52d13f6 100644 --- a/harbour/include/hbdefs.h +++ b/harbour/include/hbdefs.h @@ -73,7 +73,8 @@ ( __DJGPP__ > 2 || ( __DJGPP__ == 2 && __DJGPP_MINOR__ >= 4 ) ) ) || \ defined( HB_OS_LINUX ) || defined( HB_OS_DARWIN ) || \ defined( HB_OS_BSD ) || defined( HB_OS_SUNOS ) || \ - defined( HB_OS_BEOS ) || defined( HB_OS_QNX ) ) ) + defined( HB_OS_BEOS ) || defined( HB_OS_QNX ) || \ + defined( HB_OS_VXWORKS ) ) ) #include /* workaround for BCC 5.8 bug */ #if ( defined( __BORLANDC__ ) && __BORLANDC__ >= 1410 ) diff --git a/harbour/include/hbsetup.h b/harbour/include/hbsetup.h index 656da09462..644b09f480 100644 --- a/harbour/include/hbsetup.h +++ b/harbour/include/hbsetup.h @@ -398,6 +398,12 @@ #endif #endif +#ifndef HB_OS_VXWORKS + #if defined( __VXWORKS__ ) || defined( __vxworks ) + #define HB_OS_VXWORKS + #endif +#endif + #ifndef HB_OS_UNIX #if defined( HB_OS_LINUX ) || \ defined( HB_OS_DARWIN ) || \ @@ -405,11 +411,16 @@ defined( HB_OS_SUNOS ) || \ defined( HB_OS_HPUX ) || \ defined( HB_OS_QNX ) || \ + defined( HB_OS_VXWORKS ) || \ defined( HB_OS_BEOS ) #define HB_OS_UNIX #endif #endif +#if defined( HB_OS_VXWORKS ) + #define HB_NO_FNMATCH +#endif + /* *********************************************************************** * Operating system specific definitions */ diff --git a/harbour/include/hbthread.h b/harbour/include/hbthread.h index 245f06f4b6..60eaef0a37 100644 --- a/harbour/include/hbthread.h +++ b/harbour/include/hbthread.h @@ -64,7 +64,7 @@ #elif defined( HB_OS_LINUX ) || defined( HB_OS_DARWIN ) || \ defined( HB_OS_SUNOS ) || defined( HB_OS_HPUX ) || \ defined( HB_OS_BSD ) || defined( HB_OS_BEOS ) || \ - defined( HB_OS_QNX ) + defined( HB_OS_QNX ) || defined( HB_OS_VXWORKS ) # include # define HB_PTHREAD_API #elif defined( HB_OS_WIN ) diff --git a/harbour/src/common/hbdate.c b/harbour/src/common/hbdate.c index 9fc04ca295..67f480c7fa 100644 --- a/harbour/src/common/hbdate.c +++ b/harbour/src/common/hbdate.c @@ -929,3 +929,32 @@ long hb_timeUTCOffset( void ) /* in seconds */ } #endif } + +#if defined( HB_OS_VXWORKS ) + +/* NOTE: This function is declared, but not present in + libs in VxWorks 6.8. So here we emulate its + base functionality. [vszakats] */ + +int gettimeofday( struct timeval * tv, void * tz ) +{ + int ret; + struct timespec tp; + + HB_SYMBOL_UNUSED( tz ); + + if( ( ret = clock_gettime( CLOCK_REALTIME, &tp ) ) == 0 ) + { + tv->tv_sec = tp.tv_sec; + tv->tv_usec = ( tp.tv_nsec + 500 ) / 1000; + } + else + { + tv->tv_sec = 0; + tv->tv_usec = 0; + } + + return ret; +} + +#endif diff --git a/harbour/src/common/hbffind.c b/harbour/src/common/hbffind.c index 8712f062fa..fce24bac6a 100644 --- a/harbour/src/common/hbffind.c +++ b/harbour/src/common/hbffind.c @@ -248,7 +248,9 @@ HB_FATTR hb_fsAttrFromRaw( HB_FATTR raw_attr ) if( S_ISCHR( raw_attr ) ) ulAttr |= HB_FA_CHRDEVICE; if( S_ISBLK( raw_attr ) ) ulAttr |= HB_FA_BLKDEVICE; if( S_ISFIFO( raw_attr ) ) ulAttr |= HB_FA_FIFO; +#if ! defined( HB_OS_VXWORKS ) if( S_ISSOCK( raw_attr ) ) ulAttr |= HB_FA_SOCKET; +#endif #else diff --git a/harbour/src/common/hbgete.c b/harbour/src/common/hbgete.c index a66fa741c7..f00a1e01f5 100644 --- a/harbour/src/common/hbgete.c +++ b/harbour/src/common/hbgete.c @@ -216,7 +216,7 @@ HB_BOOL hb_setenv( const char * szName, const char * szValue ) defined( __WATCOMC__ ) || defined( __DJGPP__ ) || \ defined( HB_OS_SUNOS ) || defined( HB_OS_BSD ) || \ defined( HB_OS_DARWIN ) || defined( HB_OS_BEOS ) || \ - defined( HB_OS_QNX ) + defined( HB_OS_QNX ) || defined( HB_OS_VXWORKS ) if( szValue ) return setenv( szName, szValue, 1 ) == 0; diff --git a/harbour/src/common/hbtrace.c b/harbour/src/common/hbtrace.c index bca92c66d8..044d11b17f 100644 --- a/harbour/src/common/hbtrace.c +++ b/harbour/src/common/hbtrace.c @@ -63,7 +63,7 @@ #if defined( HB_OS_WIN ) #include -#elif defined( HB_OS_UNIX ) && ! defined( __WATCOMC__ ) +#elif defined( HB_OS_UNIX ) && ! defined( __WATCOMC__ ) && ! defined( HB_OS_VXWORKS ) #include #endif @@ -213,7 +213,7 @@ static void hb_tracelog_( int level, const char * file, int line, const char * p if( s_sysout ) { #if ( defined( HB_OS_WIN ) && ! defined( HB_OS_WIN_CE ) ) || \ - ( defined( HB_OS_UNIX ) && ! defined( __WATCOMC__ ) ) + ( defined( HB_OS_UNIX ) && ! defined( __WATCOMC__ ) && ! defined( HB_OS_VXWORKS ) ) char message[ 1024 ]; diff --git a/harbour/src/rtl/cputime.c b/harbour/src/rtl/cputime.c index 8476c0530d..d4b18bc7bf 100644 --- a/harbour/src/rtl/cputime.c +++ b/harbour/src/rtl/cputime.c @@ -54,7 +54,9 @@ #include "hbdate.h" #if defined( HB_OS_UNIX ) - #include + #if ! defined( HB_OS_VXWORKS ) + #include + #endif #include #endif #if defined( HB_OS_OS2 ) @@ -102,7 +104,7 @@ double hb_secondsCPU( int n ) if( ( n < 1 || n > 3 ) && ( n < 11 || n > 13 ) ) n = 3; -#if defined( HB_OS_UNIX ) +#if defined( HB_OS_UNIX ) && ! defined( HB_OS_VXWORKS ) { struct tms tm; diff --git a/harbour/src/rtl/diskspac.c b/harbour/src/rtl/diskspac.c index 45c1ddd70e..f2f4f24a8a 100644 --- a/harbour/src/rtl/diskspac.c +++ b/harbour/src/rtl/diskspac.c @@ -61,7 +61,7 @@ #if defined( HB_OS_UNIX ) # include # include -# if defined( __WATCOMC__ ) || defined( __CEGCC__ ) +# if defined( __WATCOMC__ ) || defined( __CEGCC__ ) || defined( HB_OS_VXWORKS ) # include # elif defined( HB_OS_DARWIN ) # include @@ -236,7 +236,7 @@ HB_FUNC( DISKSPACE ) bError = HB_FALSE; #else -#if defined( HB_OS_DARWIN ) +#if defined( HB_OS_DARWIN ) || defined( HB_OS_VXWORKS ) struct statfs st; bError = statfs( szName, &st ) != 0; #else @@ -245,9 +245,11 @@ HB_FUNC( DISKSPACE ) #endif if( !bError ) { +#if ! defined( HB_OS_VXWORKS ) if( getuid() == 0 ) dSpace = ( double ) st.f_bfree * ( double ) st.f_bsize; else +#endif dSpace = ( double ) st.f_bavail * ( double ) st.f_bsize; } #endif diff --git a/harbour/src/rtl/disksphb.c b/harbour/src/rtl/disksphb.c index 147a2fdf0c..dddf8f4df8 100644 --- a/harbour/src/rtl/disksphb.c +++ b/harbour/src/rtl/disksphb.c @@ -58,7 +58,11 @@ #include #include #elif defined( HB_OS_UNIX ) && !( defined( __WATCOMC__ ) || defined( __CEGCC__ ) ) - #include + #if defined( HB_OS_VXWORKS ) + #include + #else + #include + #endif #endif #if defined( HB_OS_WIN ) #include @@ -355,7 +359,7 @@ HB_FUNC( HB_DISKSPACE ) } #elif defined( HB_OS_UNIX ) && !( defined( __WATCOMC__ ) || defined( __CEGCC__ ) ) { -#if defined( HB_OS_DARWIN ) +#if defined( HB_OS_DARWIN ) || defined( HB_OS_VXWORKS ) struct statfs sf; #else struct statvfs sf; @@ -364,7 +368,7 @@ HB_FUNC( HB_DISKSPACE ) szPath = hb_fsNameConv( szPath, &pszFree ); -#if defined( HB_OS_DARWIN ) +#if defined( HB_OS_DARWIN ) || defined( HB_OS_VXWORKS ) if( statfs( szPath, &sf ) == 0 ) #else if( statvfs( szPath, &sf ) == 0 ) diff --git a/harbour/src/rtl/filesys.c b/harbour/src/rtl/filesys.c index 303eb4c35e..50674f7d64 100644 --- a/harbour/src/rtl/filesys.c +++ b/harbour/src/rtl/filesys.c @@ -598,7 +598,7 @@ HB_FHANDLE hb_fsPOpen( const char * pFilename, const char * pMode ) HB_TRACE(HB_TR_DEBUG, ("hb_fsPOpen(%p, %s)", pFilename, pMode)); -#if defined( HB_OS_UNIX ) +#if defined( HB_OS_UNIX ) && !defined( HB_OS_VXWORKS ) { HB_FHANDLE hPipeHandle[ 2 ], hNullHandle; pid_t pid; @@ -1722,7 +1722,7 @@ HB_SIZE hb_fsReadAt( HB_FHANDLE hFileHandle, void * pBuff, HB_SIZE nCount, HB_FO hb_vmUnlock(); -#if defined( HB_OS_UNIX ) && !defined( __WATCOMC__ ) +#if defined( HB_OS_UNIX ) && !defined( __WATCOMC__ ) && !defined( HB_OS_VXWORKS ) # if defined( HB_USE_LARGEFILE64 ) nRead = pread64( hFileHandle, pBuff, nCount, nOffset ); # else @@ -1847,7 +1847,7 @@ HB_SIZE hb_fsWriteAt( HB_FHANDLE hFileHandle, const void * pBuff, HB_SIZE nCount hb_vmUnlock(); -#if defined( HB_OS_UNIX ) && !defined( __WATCOMC__ ) +#if defined( HB_OS_UNIX ) && !defined( __WATCOMC__ ) && !defined( HB_OS_VXWORKS ) # if defined( HB_USE_LARGEFILE64 ) nWritten = pwrite64( hFileHandle, pBuff, nCount, nOffset ); # else diff --git a/harbour/src/rtl/gtpca/gtpca.c b/harbour/src/rtl/gtpca/gtpca.c index 8ddab9a110..8f5db69b58 100644 --- a/harbour/src/rtl/gtpca/gtpca.c +++ b/harbour/src/rtl/gtpca/gtpca.c @@ -70,15 +70,23 @@ #include +#if ( defined( HB_OS_UNIX ) && !defined( HB_OS_VXWORKS ) ) || defined( __DJGPP__ ) +# if !defined( HB_HAS_TERMIOS ) +# define HB_HAS_TERMIOS +# endif +#endif + #if defined( HB_OS_UNIX ) || defined( __DJGPP__ ) - #include /* read() function requires it */ - #include - #include - #include - #include - #include - #include - #include +# if defined( HB_HAS_TERMIOS ) +# include /* read() function requires it */ +# include +# include +# include +# include +# include +# include +# include +# endif #else # if defined( HB_OS_WIN ) # include @@ -121,7 +129,7 @@ static int s_iOutBufSize = 0; static int s_iOutBufIndex = 0; static char * s_sOutBuf; -#if defined( HB_OS_UNIX ) || defined( __DJGPP__ ) +#if defined( HB_HAS_TERMIOS ) static volatile HB_BOOL s_fRestTTY = HB_FALSE; static struct termios s_saved_TIO, s_curr_TIO; @@ -282,7 +290,7 @@ static void hb_gt_pca_AnsiGetCurPos( int * iRow, int * iCol ) break; else { -#if defined( HB_OS_UNIX ) || defined( __DJGPP__ ) +#if defined( HB_HAS_TERMIOS ) struct timeval tv; fd_set rdfds; int iMilliSec; @@ -484,7 +492,7 @@ static void hb_gt_pca_Init( PHB_GT pGT, HB_FHANDLE hFilenoStdin, HB_FHANDLE hFil HB_GTSUPER_INIT( pGT, hFilenoStdin, hFilenoStdout, hFilenoStderr ); /* SA_NOCLDSTOP in #if is a hack to detect POSIX compatible environment */ -#if ( defined( HB_OS_UNIX ) || defined( __DJGPP__ ) ) && \ +#if defined( HB_HAS_TERMIOS ) && \ defined( SA_NOCLDSTOP ) s_fRestTTY = HB_FALSE; if( s_bStdinConsole ) @@ -566,7 +574,7 @@ static void hb_gt_pca_Exit( PHB_GT pGT ) HB_GTSUPER_EXIT( pGT ); -#if defined( HB_OS_UNIX ) || defined( __DJGPP__ ) +#if defined( HB_HAS_TERMIOS ) if( s_fRestTTY ) tcsetattr( s_hFilenoStdin, TCSANOW, &s_saved_TIO ); #endif @@ -613,7 +621,7 @@ static int hb_gt_pca_ReadKey( PHB_GT pGT, int iEventMask ) ch = hb_gt_dos_keyCodeTranslate( ch ); if( ch > 0 && ch <= 255 ) ch = s_keyTransTbl[ ch ]; -#elif defined( HB_OS_UNIX ) || defined( __DJGPP__ ) +#elif defined( HB_HAS_TERMIOS ) { struct timeval tv; fd_set rfds; @@ -746,7 +754,7 @@ static HB_BOOL hb_gt_pca_Suspend( PHB_GT pGT ) HB_TRACE( HB_TR_DEBUG, ( "hb_gt_pca_Suspend(%p)", pGT ) ); HB_SYMBOL_UNUSED( pGT ); -#if defined( HB_OS_UNIX ) || defined( __DJGPP__ ) +#if defined( HB_HAS_TERMIOS ) if( s_fRestTTY ) { tcsetattr( s_hFilenoStdin, TCSANOW, &s_saved_TIO ); @@ -762,7 +770,7 @@ static HB_BOOL hb_gt_pca_Resume( PHB_GT pGT ) HB_TRACE( HB_TR_DEBUG, ( "hb_gt_pca_Resume(%p)", pGT ) ); HB_SYMBOL_UNUSED( pGT ); -#if defined( HB_OS_UNIX ) || defined( __DJGPP__ ) +#if defined( HB_HAS_TERMIOS ) if( s_fRestTTY ) { tcsetattr( s_hFilenoStdin, TCSANOW, &s_curr_TIO ); diff --git a/harbour/src/rtl/gtstd/gtstd.c b/harbour/src/rtl/gtstd/gtstd.c index 7734d19936..9e7b20d185 100644 --- a/harbour/src/rtl/gtstd/gtstd.c +++ b/harbour/src/rtl/gtstd/gtstd.c @@ -62,15 +62,23 @@ #include "hbdate.h" #include "hb_io.h" +#if ( defined( HB_OS_UNIX ) && !defined( HB_OS_VXWORKS ) ) || defined( __DJGPP__ ) +# if !defined( HB_HAS_TERMIOS ) +# define HB_HAS_TERMIOS +# endif +#endif + #if defined( HB_OS_UNIX ) || defined( __DJGPP__ ) - #include - #include - #include - #include - #include - #include - #include - #include +# if defined( HB_HAS_TERMIOS ) +# include +# include +# include +# include +# include +# include +# include +# include +# endif #else # if defined( HB_OS_WIN ) # include @@ -115,7 +123,7 @@ typedef struct _HB_GTSTD PHB_CODEPAGE cdpHost; HB_BYTE keyTransTbl[ 256 ]; -#if defined( HB_OS_UNIX ) || defined( __DJGPP__ ) +#if defined( HB_HAS_TERMIOS ) struct termios saved_TIO; struct termios curr_TIO; HB_BOOL fRestTTY; @@ -126,7 +134,7 @@ typedef struct _HB_GTSTD } HB_GTSTD, * PHB_GTSTD; -#if defined( HB_OS_UNIX ) || defined( __DJGPP__ ) +#if defined( HB_HAS_TERMIOS ) static volatile HB_BOOL s_fRestTTY = HB_FALSE; @@ -223,7 +231,7 @@ static void hb_gt_std_Init( PHB_GT pGT, HB_FHANDLE hFilenoStdin, HB_FHANDLE hFil HB_GTSUPER_INIT( pGT, hFilenoStdin, hFilenoStdout, hFilenoStderr ); /* SA_NOCLDSTOP in #if is a hack to detect POSIX compatible environment */ -#if ( defined( HB_OS_UNIX ) || defined( __DJGPP__ ) ) && \ +#if defined( HB_HAS_TERMIOS ) && \ defined( SA_NOCLDSTOP ) if( pGTSTD->fStdinConsole ) @@ -311,7 +319,7 @@ static void hb_gt_std_Exit( PHB_GT pGT ) while( ++pGTSTD->iRow <= iRow ) hb_gt_std_newLine( pGTSTD ); -#if defined( HB_OS_UNIX ) || defined( __DJGPP__ ) +#if defined( HB_HAS_TERMIOS ) if( pGTSTD->fRestTTY ) tcsetattr( pGTSTD->hStdin, TCSANOW, &pGTSTD->saved_TIO ); #endif @@ -336,7 +344,7 @@ static int hb_gt_std_ReadKey( PHB_GT pGT, int iEventMask ) pGTSTD = HB_GTSTD_GET( pGT ); -#if defined( HB_OS_UNIX ) || defined( __DJGPP__ ) +#if defined( HB_HAS_TERMIOS ) { struct timeval tv; fd_set rfds; @@ -474,7 +482,7 @@ static HB_BOOL hb_gt_std_Suspend( PHB_GT pGT ) { HB_TRACE( HB_TR_DEBUG, ( "hb_gt_std_Suspend(%p)", pGT ) ); -#if defined( HB_OS_UNIX ) || defined( __DJGPP__ ) +#if defined( HB_HAS_TERMIOS ) { PHB_GTSTD pGTSTD = HB_GTSTD_GET( pGT ); if( pGTSTD->fRestTTY ) @@ -490,7 +498,7 @@ static HB_BOOL hb_gt_std_Resume( PHB_GT pGT ) HB_TRACE( HB_TR_DEBUG, ( "hb_gt_std_Resume(%p)", pGT ) ); -#if defined( HB_OS_UNIX ) || defined( __DJGPP__ ) +#if defined( HB_HAS_TERMIOS ) { PHB_GTSTD pGTSTD = HB_GTSTD_GET( pGT ); if( pGTSTD->fRestTTY ) diff --git a/harbour/src/rtl/gtsys.c b/harbour/src/rtl/gtsys.c index 23e4f967eb..a97f7e5f5c 100644 --- a/harbour/src/rtl/gtsys.c +++ b/harbour/src/rtl/gtsys.c @@ -69,6 +69,8 @@ HB_GT_REQUEST( DOS ) #elif defined( HB_OS_OS2 ) HB_GT_REQUEST( OS2 ) +#elif defined( HB_OS_VXWORKS ) + HB_GT_REQUEST( STD ) #elif defined( HB_OS_UNIX ) HB_GT_REQUEST( TRM ) #else diff --git a/harbour/src/rtl/gttrm/Makefile b/harbour/src/rtl/gttrm/Makefile index 3bd89b52aa..a8360770c8 100644 --- a/harbour/src/rtl/gttrm/Makefile +++ b/harbour/src/rtl/gttrm/Makefile @@ -30,6 +30,9 @@ endif ifeq ($(HB_COMPILER),djgpp) HB_SUPPORTED := yes endif +ifeq ($(HB_PLATFORM),vxworks) + HB_SUPPORTED := no +endif ifeq ($(HB_SUPPORTED),yes) diff --git a/harbour/src/rtl/hbcom.c b/harbour/src/rtl/hbcom.c index 3271a112e7..2d6c2d2c3e 100644 --- a/harbour/src/rtl/hbcom.c +++ b/harbour/src/rtl/hbcom.c @@ -63,8 +63,14 @@ #include "hbdate.h" #if defined( HB_OS_UNIX ) && !defined( __WATCOMC__ ) /* || defined( __DJGPP__ ) */ -# if !defined( HB_HAS_TERMIOS ) -# define HB_HAS_TERMIOS +# if defined( HB_OS_VXWORKS ) +# if !defined( HB_HAS_SIOLIB ) +# define HB_HAS_SIOLIB +# endif +# else +# if !defined( HB_HAS_TERMIOS ) +# define HB_HAS_TERMIOS +# endif # endif # if defined( HB_OS_SUNOS ) # if !defined( BSD_COMP ) @@ -84,6 +90,8 @@ # include # include # endif +#elif defined( HB_HAS_SIOLIB ) +# include #elif defined( HB_OS_WIN ) # include #elif defined( HB_OS_OS2 ) diff --git a/harbour/src/rtl/hbproces.c b/harbour/src/rtl/hbproces.c index cf03a2f449..d9f1bd693a 100644 --- a/harbour/src/rtl/hbproces.c +++ b/harbour/src/rtl/hbproces.c @@ -306,7 +306,7 @@ static int hb_fsProcessExec( const char * pszFilename, iStdErr = dup( 2 ); dup2( hStderr, 2 ); } -#if defined( HB_OS_UNIX ) +#if defined( HB_OS_UNIX ) && !defined( HB_OS_VXWORKS ) { pid_t pid = fork(); if( pid == 0 ) @@ -506,7 +506,7 @@ HB_FHANDLE hb_fsProcessOpen( const char * pszFilename, CloseHandle( hPipes[ i ] ); } } -#elif defined( HB_OS_UNIX ) +#elif defined( HB_OS_UNIX ) && !defined( HB_OS_VXWORKS ) { HB_BOOL fError = HB_FALSE; HB_FHANDLE hPipeIn [ 2 ] = { FS_ERROR, FS_ERROR }, diff --git a/harbour/src/rtl/hbsocket.c b/harbour/src/rtl/hbsocket.c index 446ec612da..197b51c7e4 100644 --- a/harbour/src/rtl/hbsocket.c +++ b/harbour/src/rtl/hbsocket.c @@ -52,7 +52,7 @@ #include "hbsocket.h" -#if defined( HB_OS_DOS ) && !defined( HB_HAS_WATT ) +#if ( defined( HB_OS_DOS ) && !defined( HB_HAS_WATT ) ) # if !defined( HB_SOCKET_OFF ) # define HB_SOCKET_OFF # endif @@ -125,7 +125,9 @@ # endif # if !defined( __WATCOMC__ ) && !defined( HB_OS_BEOS ) # define HB_HAS_INET6 -# define HB_HAS_INET6_ADDR_CONST +# if !defined( HB_OS_VXWORKS ) +# define HB_HAS_INET6_ADDR_CONST +# endif # endif # if defined( HB_OS_BEOS ) # define HB_SOCKET_TRANSLATE_DOMAIN @@ -213,6 +215,9 @@ # if defined( HB_OS_BEOS ) # include # endif +# if defined( HB_OS_VXWORKS ) +# include +# endif # include # include # include @@ -3006,7 +3011,8 @@ PHB_ITEM hb_socketGetIFaces( int af, HB_BOOL fNoAliases ) * of 'struct ifreq' and SIOCGIF* */ #if defined( SIOCGIFCONF ) && \ - !( defined( HB_OS_LINUX ) && defined( __WATCOMC__ ) ) + !( defined( HB_OS_LINUX ) && defined( __WATCOMC__ ) && \ + ! defined( HB_OS_VXWORKS ) ) struct ifconf ifc; struct ifreq * pifr; char * buf, * ptr; diff --git a/harbour/src/rtl/net.c b/harbour/src/rtl/net.c index 9260691056..4f79670b20 100644 --- a/harbour/src/rtl/net.c +++ b/harbour/src/rtl/net.c @@ -92,7 +92,11 @@ #elif defined( HB_OS_UNIX ) #if !defined( __WATCOMC__ ) - #include + #if defined( HB_OS_VXWORKS ) + #include + #else + #include + #endif #include #endif #include @@ -187,7 +191,7 @@ char * hb_username( void ) { #if defined( HB_OS_UNIX ) || ( defined( HB_OS_OS2 ) && defined( __GNUC__ ) ) -# if defined( __WATCOMC__ ) +# if defined( __WATCOMC__ ) || defined( HB_OS_VXWORKS ) return hb_getenv( "USER" ); # else struct passwd * pwd = getpwuid( getuid() ); diff --git a/harbour/src/vm/hashfunc.c b/harbour/src/vm/hashfunc.c index 6cad8554bf..d9968a709f 100644 --- a/harbour/src/vm/hashfunc.c +++ b/harbour/src/vm/hashfunc.c @@ -330,7 +330,7 @@ HB_FUNC( HB_HCOPY ) nStart = hb_parns( 3 ); if( ! nStart ) ++nStart; - nCount = HB_ISNUM( 4 ) ? hb_parns( 4 ) : nLen - nStart + 1; + nCount = HB_ISNUM( 4 ) ? ( HB_SIZE ) hb_parns( 4 ) : nLen - nStart + 1; while( nCount-- ) { @@ -403,7 +403,7 @@ HB_FUNC( HB_HEVAL ) nStart = hb_parns( 3 ); if( ! nStart ) ++nStart; - nCount = HB_ISNUM( 4 ) ? hb_parns( 4 ) : nLen - nStart + 1; + nCount = HB_ISNUM( 4 ) ? ( HB_SIZE ) hb_parns( 4 ) : nLen - nStart + 1; while( nCount-- ) { @@ -442,7 +442,7 @@ HB_FUNC( HB_HSCAN ) nStart = hb_parns( 3 ); if( ! nStart ) ++nStart; - nCount = HB_ISNUM( 4 ) ? hb_parns( 4 ) : nLen - nStart + 1; + nCount = HB_ISNUM( 4 ) ? ( HB_SIZE ) hb_parns( 4 ) : nLen - nStart + 1; if( HB_IS_BLOCK( pValue ) ) { diff --git a/harbour/src/vm/thread.c b/harbour/src/vm/thread.c index 08bf771910..78d586e043 100644 --- a/harbour/src/vm/thread.c +++ b/harbour/src/vm/thread.c @@ -111,7 +111,9 @@ #if defined( HB_OS_UNIX ) # include -# include +# if ! defined( HB_OS_VXWORKS ) +# include +# endif # include #endif diff --git a/harbour/utils/hbmk2/hbmk2.prg b/harbour/utils/hbmk2/hbmk2.prg index 1162ee250f..20ade9ce3b 100644 --- a/harbour/utils/hbmk2/hbmk2.prg +++ b/harbour/utils/hbmk2/hbmk2.prg @@ -1127,7 +1127,7 @@ FUNCTION hbmk2( aArgs, /* @ */ lPause ) cBin_CompPRG := "harbour" + l_cHBPOSTFIX DO CASE - CASE hbmk[ _HBMK_cPLAT ] $ "bsd|hpux|sunos|beos|qnx|linux" .OR. hbmk[ _HBMK_cPLAT ] == "darwin" /* Separated to avoid match with 'win' */ + CASE hbmk[ _HBMK_cPLAT ] $ "bsd|hpux|sunos|beos|qnx|vxworks|linux" .OR. hbmk[ _HBMK_cPLAT ] == "darwin" /* Separated to avoid match with 'win' */ DO CASE CASE hbmk[ _HBMK_cPLAT ] == "linux" aCOMPSUP := { "gcc", "clang", "icc", "watcom", "sunpro", "open64" } @@ -1137,13 +1137,21 @@ FUNCTION hbmk2( aArgs, /* @ */ lPause ) aCOMPSUP := { "gcc", "clang" } CASE hbmk[ _HBMK_cPLAT ] == "sunos" aCOMPSUP := { "gcc", "sunpro" } + CASE hbmk[ _HBMK_cPLAT ] == "vxworks" + aCOMPSUP := { "gcc", "diab" } OTHERWISE aCOMPSUP := { "gcc" } ENDCASE - l_aLIBHBGT := { "gttrm" } - hbmk[ _HBMK_cGTDEFAULT ] := "gttrm" cDynLibNamePrefix := "lib" - cBinExt := "" + IF hbmk[ _HBMK_cPLAT ] == "vxworks" + l_aLIBHBGT := {} + hbmk[ _HBMK_cGTDEFAULT ] := "gtstd" + cBinExt := ".vxe" + ELSE + l_aLIBHBGT := { "gttrm" } + hbmk[ _HBMK_cGTDEFAULT ] := "gttrm" + cBinExt := "" + ENDIF cOptPrefix := "-" SWITCH hbmk[ _HBMK_cPLAT ] CASE "darwin" ; cDynLibExt := ".dylib" ; EXIT @@ -1399,7 +1407,7 @@ FUNCTION hbmk2( aArgs, /* @ */ lPause ) IF Empty( hbmk[ _HBMK_cCOMP ] ) .OR. hbmk[ _HBMK_cCOMP ] == "bld" IF Len( aCOMPSUP ) == 1 hbmk[ _HBMK_cCOMP ] := aCOMPSUP[ 1 ] - ELSEIF hbmk[ _HBMK_cPLAT ] $ "bsd|hpux|sunos|beos|qnx|linux" .OR. ; + ELSEIF hbmk[ _HBMK_cPLAT ] $ "bsd|hpux|sunos|beos|qnx|vxworks|linux" .OR. ; hbmk[ _HBMK_cPLAT ] == "darwin" .OR. ; hbmk[ _HBMK_cCOMP ] == "bld" hbmk[ _HBMK_cCOMP ] := hb_Version( HB_VERSION_BUILD_COMP ) @@ -1571,7 +1579,7 @@ FUNCTION hbmk2( aArgs, /* @ */ lPause ) /* Build with shared libs by default, if we're installed to default system locations. */ - IF lSysLoc .AND. ( hbmk[ _HBMK_cPLAT ] $ "bsd|hpux|sunos|beos|qnx|linux" .OR. hbmk[ _HBMK_cPLAT ] == "darwin" ) + IF lSysLoc .AND. ( hbmk[ _HBMK_cPLAT ] $ "bsd|hpux|sunos|beos|qnx|vxworks|linux" .OR. hbmk[ _HBMK_cPLAT ] == "darwin" ) hbmk[ _HBMK_lSHARED ] := .T. hbmk[ _HBMK_lSTATICFULL ] := .F. ELSE @@ -2567,7 +2575,7 @@ FUNCTION hbmk2( aArgs, /* @ */ lPause ) #endif DO CASE - CASE hbmk[ _HBMK_cPLAT ] $ "bsd|linux|hpux|beos|qnx|sunos" .OR. hbmk[ _HBMK_cPLAT ] == "darwin" /* Separated to avoid match with 'win' */ + CASE hbmk[ _HBMK_cPLAT ] $ "bsd|linux|hpux|beos|qnx|vxworks|sunos" .OR. hbmk[ _HBMK_cPLAT ] == "darwin" /* Separated to avoid match with 'win' */ IF Empty( cPrefix ) l_aLIBSHARED := { iif( hbmk[ _HBMK_lMT ], "harbourmt" + cPostfix,; "harbour" + cPostfix ) } @@ -2646,21 +2654,26 @@ FUNCTION hbmk2( aArgs, /* @ */ lPause ) DO CASE /* GCC family */ - CASE ( hbmk[ _HBMK_cPLAT ] == "bsd" .AND. hbmk[ _HBMK_cCOMP ] == "gcc" ) .OR. ; - ( hbmk[ _HBMK_cPLAT ] == "darwin" .AND. hbmk[ _HBMK_cCOMP ] == "gcc" ) .OR. ; - ( hbmk[ _HBMK_cPLAT ] == "hpux" .AND. hbmk[ _HBMK_cCOMP ] == "gcc" ) .OR. ; - ( hbmk[ _HBMK_cPLAT ] == "sunos" .AND. hbmk[ _HBMK_cCOMP ] == "gcc" ) .OR. ; - ( hbmk[ _HBMK_cPLAT ] == "linux" .AND. hbmk[ _HBMK_cCOMP ] == "gcc" ) .OR. ; - ( hbmk[ _HBMK_cPLAT ] == "linux" .AND. hbmk[ _HBMK_cCOMP ] == "icc" ) .OR. ; - ( hbmk[ _HBMK_cPLAT ] == "darwin" .AND. hbmk[ _HBMK_cCOMP ] == "icc" ) .OR. ; - ( hbmk[ _HBMK_cPLAT ] == "linux" .AND. hbmk[ _HBMK_cCOMP ] == "clang" ) .OR. ; - ( hbmk[ _HBMK_cPLAT ] == "darwin" .AND. hbmk[ _HBMK_cCOMP ] == "clang" ) .OR. ; - ( hbmk[ _HBMK_cPLAT ] == "bsd" .AND. hbmk[ _HBMK_cCOMP ] == "clang" ) .OR. ; - ( hbmk[ _HBMK_cPLAT ] == "beos" .AND. hbmk[ _HBMK_cCOMP ] == "gcc" ) .OR. ; - ( hbmk[ _HBMK_cPLAT ] == "qnx" .AND. hbmk[ _HBMK_cCOMP ] == "gcc" ) .OR. ; - ( hbmk[ _HBMK_cPLAT ] == "linux" .AND. hbmk[ _HBMK_cCOMP ] == "open64" ) + CASE ( hbmk[ _HBMK_cPLAT ] == "bsd" .AND. hbmk[ _HBMK_cCOMP ] == "gcc" ) .OR. ; + ( hbmk[ _HBMK_cPLAT ] == "darwin" .AND. hbmk[ _HBMK_cCOMP ] == "gcc" ) .OR. ; + ( hbmk[ _HBMK_cPLAT ] == "hpux" .AND. hbmk[ _HBMK_cCOMP ] == "gcc" ) .OR. ; + ( hbmk[ _HBMK_cPLAT ] == "sunos" .AND. hbmk[ _HBMK_cCOMP ] == "gcc" ) .OR. ; + ( hbmk[ _HBMK_cPLAT ] == "linux" .AND. hbmk[ _HBMK_cCOMP ] == "gcc" ) .OR. ; + ( hbmk[ _HBMK_cPLAT ] == "linux" .AND. hbmk[ _HBMK_cCOMP ] == "icc" ) .OR. ; + ( hbmk[ _HBMK_cPLAT ] == "darwin" .AND. hbmk[ _HBMK_cCOMP ] == "icc" ) .OR. ; + ( hbmk[ _HBMK_cPLAT ] == "linux" .AND. hbmk[ _HBMK_cCOMP ] == "clang" ) .OR. ; + ( hbmk[ _HBMK_cPLAT ] == "darwin" .AND. hbmk[ _HBMK_cCOMP ] == "clang" ) .OR. ; + ( hbmk[ _HBMK_cPLAT ] == "bsd" .AND. hbmk[ _HBMK_cCOMP ] == "clang" ) .OR. ; + ( hbmk[ _HBMK_cPLAT ] == "beos" .AND. hbmk[ _HBMK_cCOMP ] == "gcc" ) .OR. ; + ( hbmk[ _HBMK_cPLAT ] == "qnx" .AND. hbmk[ _HBMK_cCOMP ] == "gcc" ) .OR. ; + ( hbmk[ _HBMK_cPLAT ] == "vxworks" .AND. hbmk[ _HBMK_cCOMP ] == "gcc" ) .OR. ; + ( hbmk[ _HBMK_cPLAT ] == "linux" .AND. hbmk[ _HBMK_cCOMP ] == "open64" ) - hbmk[ _HBMK_nCmd_Esc ] := _ESC_NIX + #if defined( __PLATFORM__UNIX ) + hbmk[ _HBMK_nCmd_Esc ] := _ESC_NIX + #elif defined( __PLATFORM__WINDOWS ) + hbmk[ _HBMK_nCmd_Esc ] := _ESC_DBLQUOTE + #endif IF hbmk[ _HBMK_lDEBUG ] AAdd( hbmk[ _HBMK_aOPTC ], "-g" ) ENDIF @@ -2694,6 +2707,9 @@ FUNCTION hbmk2( aArgs, /* @ */ lPause ) CASE hbmk[ _HBMK_cCOMP ] == "open64" cBin_CompCPP := "openCC" cBin_CompC := iif( hbmk[ _HBMK_lCPP ] != NIL .AND. hbmk[ _HBMK_lCPP ], cBin_CompCPP, "opencc" ) + CASE hbmk[ _HBMK_cPLAT ] == "vxworks" + cBin_CompCPP := hbmk[ _HBMK_cCCPREFIX ] + "g++" + hbmk[ _HBMK_cCCPOSTFIX ] + cBin_CompC := iif( hbmk[ _HBMK_lCPP ] != NIL .AND. hbmk[ _HBMK_lCPP ], cBin_CompCPP, hbmk[ _HBMK_cCCPREFIX ] + "cc" + hbmk[ _HBMK_cCCPOSTFIX ] ) OTHERWISE cBin_CompCPP := hbmk[ _HBMK_cCCPREFIX ] + "g++" + hbmk[ _HBMK_cCCPOSTFIX ] cBin_CompC := iif( hbmk[ _HBMK_lCPP ] != NIL .AND. hbmk[ _HBMK_lCPP ], cBin_CompCPP, hbmk[ _HBMK_cCCPREFIX ] + "gcc" + hbmk[ _HBMK_cCCPOSTFIX ] ) @@ -2717,6 +2733,16 @@ FUNCTION hbmk2( aArgs, /* @ */ lPause ) CASE _WARN_NO ; AAdd( hbmk[ _HBMK_aOPTC ], "-w" ) ; EXIT ENDSWITCH ENDIF + IF hbmk[ _HBMK_cPLAT ] == "vxworks" + AAdd( hbmk[ _HBMK_aOPTC ], "-mrtp" ) + AAdd( hbmk[ _HBMK_aOPTL ], "-mrtp" ) + AAdd( hbmk[ _HBMK_aOPTD ], "-mrtp" ) + AAdd( hbmk[ _HBMK_aOPTC ], "-fno-strict-aliasing" ) + AAdd( hbmk[ _HBMK_aOPTC ], "-D_C99" ) + AAdd( hbmk[ _HBMK_aOPTC ], "-D_HAS_C9X" ) + AAdd( hbmk[ _HBMK_aINCPATH ], PathSepToSelf( GetEnv( "WIND_USR" ) ) + hb_ps() + "h" ) + AAdd( hbmk[ _HBMK_aINCPATH ], PathSepToSelf( GetEnv( "WIND_USR" ) ) + hb_ps() + "h" + hb_ps() + "wrn" + hb_ps() + "coreip" ) + ENDIF cOpt_CompC += " {FC}" IF ! Empty( hbmk[ _HBMK_cWorkDir ] ) IF hbmk[ _HBMK_cPLAT ] $ "linux|bsd" .AND. hbmk[ _HBMK_cCOMP ] == "clang" @@ -2742,6 +2768,7 @@ FUNCTION hbmk2( aArgs, /* @ */ lPause ) ( hbmk[ _HBMK_cPLAT ] == "linux" .OR. ; hbmk[ _HBMK_cPLAT ] == "beos" .OR. ; hbmk[ _HBMK_cPLAT ] == "qnx" .OR. ; + hbmk[ _HBMK_cPLAT ] == "vxworks" .OR. ; hbmk[ _HBMK_cPLAT ] == "bsd" ) AAdd( hbmk[ _HBMK_aOPTL ], "-Wl,--start-group {LL} {LB} -Wl,--end-group" ) AAdd( hbmk[ _HBMK_aOPTD ], "-Wl,--start-group {LL} {LB} -Wl,--end-group" ) @@ -3965,6 +3992,10 @@ FUNCTION hbmk2( aArgs, /* @ */ lPause ) cBin_Link := FNameEscape( hbmk[ _HBMK_cCCPATH ] + hb_ps() + cBin_Link, hbmk[ _HBMK_nCmd_Esc ] ) ENDIF + CASE hbmk[ _HBMK_cPLAT ] == "vxworks" .AND. hbmk[ _HBMK_cCOMP ] == "diab" + + /* TODO */ + ENDCASE /* NOTE: We only use different shared object flags when compiling for @@ -8724,6 +8755,9 @@ STATIC PROCEDURE PlatformPRGFlags( hbmk, aOPTPRG ) CASE hbmk[ _HBMK_cPLAT ] == "qnx" AAdd( aDf, "__PLATFORM__QNX" ) AAdd( aDf, "__PLATFORM__UNIX" ) + CASE hbmk[ _HBMK_cPLAT ] == "vxworks" + AAdd( aDf, "__PLATFORM__VXWORKS" ) + AAdd( aDf, "__PLATFORM__UNIX" ) ENDCASE /* Setup those CPU flags which we can be sure about. @@ -9727,7 +9761,7 @@ FUNCTION hbmk_KEYW( hbmk, cKeyword, cValue ) CASE "static" ; RETURN ! hbmk[ _HBMK_lSHARED ] CASE "unicode" ; RETURN hbmk[ _HBMK_lUNICODE ] CASE "ascii" ; RETURN ! hbmk[ _HBMK_lUNICODE ] - CASE "unix" ; RETURN "|" + hbmk[ _HBMK_cPLAT ] + "|" $ "|bsd|hpux|sunos|beos|qnx|linux|darwin|" + CASE "unix" ; RETURN "|" + hbmk[ _HBMK_cPLAT ] + "|" $ "|bsd|hpux|sunos|beos|qnx|vxworks|linux|darwin|" CASE "allwin" ; RETURN "|" + hbmk[ _HBMK_cPLAT ] + "|" $ "|win|wce|" CASE "allgcc" ; RETURN "|" + hbmk[ _HBMK_cCOMP ] + "|" $ "|gcc|mingw|mingw64|mingwarm|cygwin|djgpp|gccomf|clang|open64|" CASE "allmingw" ; RETURN "|" + hbmk[ _HBMK_cCOMP ] + "|" $ "|mingw|mingw64|mingwarm|" @@ -9747,7 +9781,7 @@ FUNCTION hbmk_KEYW( hbmk, cKeyword, cValue ) ENDIF IF ! ( "|" + cKeyword + "|" $ "|win|wce|dos|os2" + ; - "|bsd|hpux|sunos|beos|qnx|linux|darwin" + ; + "|bsd|hpux|sunos|beos|qnx|vxworks|linux|darwin" + ; "|msvc|msvc64|msvcia64|msvcarm" + ; "|pocc|pocc64|poccarm|xcc" + ; "|mingw|mingw64|mingwarm|cygwin|bcc|watcom" + ; @@ -10302,18 +10336,19 @@ STATIC PROCEDURE ShowHelp( hbmk, lLong ) LOCAL aText_Supp := {; "",; I_( "Supported values for each supported value:" ),; - " - linux : gcc, clang, icc, watcom, sunpro, open64",; - " - darwin : gcc, clang, icc",; - " - win : mingw, msvc, bcc, watcom, icc, pocc, cygwin, xcc,",; - " - mingw64, msvc64, msvcia64, iccia64, pocc64",; - " - wce : mingwarm, mingw, msvcarm, poccarm",; - " - os2 : gcc, gccomf, watcom",; - " - dos : djgpp, watcom",; - " - bsd : gcc, clang",; - " - hpux : gcc",; - " - beos : gcc",; - " - qnx : gcc",; - " - sunos : gcc, sunpro" } + " - linux : gcc, clang, icc, watcom, sunpro, open64",; + " - darwin : gcc, clang, icc",; + " - win : mingw, msvc, bcc, watcom, icc, pocc, cygwin, xcc,",; + " - mingw64, msvc64, msvcia64, iccia64, pocc64",; + " - wce : mingwarm, mingw, msvcarm, poccarm",; + " - os2 : gcc, gccomf, watcom",; + " - dos : djgpp, watcom",; + " - bsd : gcc, clang",; + " - hpux : gcc",; + " - beos : gcc",; + " - qnx : gcc",; + " - vxworks : gcc, diab",; + " - sunos : gcc, sunpro" } LOCAL aOpt_Basic := {; { "-o" , I_( "output file name" ) },;