fixed multiple glitches for building on non-posix platforms
This commit is contained in:
		| @ -44,17 +44,18 @@ extern "C" { | ||||
|  | ||||
| qse_awk_fnc_t* qse_awk_findfnc (qse_awk_t* awk, const qse_cstr_t* name); | ||||
|  | ||||
| int qse_awk_fnc_index   (qse_awk_rtx_t* rtx, const qse_awk_fnc_info_t* fi); | ||||
| int qse_awk_fnc_rindex  (qse_awk_rtx_t* rtx, const qse_awk_fnc_info_t* fi); | ||||
| int qse_awk_fnc_length  (qse_awk_rtx_t* rtx, const qse_awk_fnc_info_t* fi); | ||||
| int qse_awk_fnc_substr  (qse_awk_rtx_t* rtx, const qse_awk_fnc_info_t* fi); | ||||
| int qse_awk_fnc_split   (qse_awk_rtx_t* rtx, const qse_awk_fnc_info_t* fi); | ||||
| int qse_awk_fnc_match   (qse_awk_rtx_t* rtx, const qse_awk_fnc_info_t* fi); | ||||
| int qse_awk_fnc_gsub    (qse_awk_rtx_t* rtx, const qse_awk_fnc_info_t* fi); | ||||
| int qse_awk_fnc_sub     (qse_awk_rtx_t* rtx, const qse_awk_fnc_info_t* fi); | ||||
| int qse_awk_fnc_tolower (qse_awk_rtx_t* rtx, const qse_awk_fnc_info_t* fi); | ||||
| int qse_awk_fnc_toupper (qse_awk_rtx_t* rtx, const qse_awk_fnc_info_t* fi); | ||||
| int qse_awk_fnc_sprintf (qse_awk_rtx_t* rtx, const qse_awk_fnc_info_t* fi); | ||||
| /* EXPORT is required for linking on windows as they are referenced by mod-str.c */ | ||||
| QSE_EXPORT int qse_awk_fnc_index   (qse_awk_rtx_t* rtx, const qse_awk_fnc_info_t* fi); | ||||
| QSE_EXPORT int qse_awk_fnc_rindex  (qse_awk_rtx_t* rtx, const qse_awk_fnc_info_t* fi); | ||||
| QSE_EXPORT int qse_awk_fnc_length  (qse_awk_rtx_t* rtx, const qse_awk_fnc_info_t* fi); | ||||
| QSE_EXPORT int qse_awk_fnc_substr  (qse_awk_rtx_t* rtx, const qse_awk_fnc_info_t* fi); | ||||
| QSE_EXPORT int qse_awk_fnc_split   (qse_awk_rtx_t* rtx, const qse_awk_fnc_info_t* fi); | ||||
| QSE_EXPORT int qse_awk_fnc_match   (qse_awk_rtx_t* rtx, const qse_awk_fnc_info_t* fi); | ||||
| QSE_EXPORT int qse_awk_fnc_gsub    (qse_awk_rtx_t* rtx, const qse_awk_fnc_info_t* fi); | ||||
| QSE_EXPORT int qse_awk_fnc_sub     (qse_awk_rtx_t* rtx, const qse_awk_fnc_info_t* fi); | ||||
| QSE_EXPORT int qse_awk_fnc_tolower (qse_awk_rtx_t* rtx, const qse_awk_fnc_info_t* fi); | ||||
| QSE_EXPORT int qse_awk_fnc_toupper (qse_awk_rtx_t* rtx, const qse_awk_fnc_info_t* fi); | ||||
| QSE_EXPORT int qse_awk_fnc_sprintf (qse_awk_rtx_t* rtx, const qse_awk_fnc_info_t* fi); | ||||
|  | ||||
| #ifdef __cplusplus | ||||
| } | ||||
|  | ||||
| @ -18,7 +18,7 @@ | ||||
|     License along with QSE. If not, see <http://www.gnu.org/licenses/>. | ||||
|  */ | ||||
|  | ||||
| #include "mod-str.h" | ||||
| #include "mod-math.h" | ||||
| #include <qse/cmn/str.h> | ||||
| #include <qse/cmn/chr.h> | ||||
| #include <qse/cmn/alg.h> | ||||
| @ -36,7 +36,9 @@ | ||||
| #	if defined(_WIN32) || defined(__OS2__) || defined(__DOS__) | ||||
| #		define HAVE_CEIL | ||||
| #		define HAVE_FLOOR | ||||
| #		if !defined(__WATCOMC__) | ||||
| #		define HAVE_ROUND | ||||
| #		endif | ||||
| #		define HAVE_SINH | ||||
| #		define HAVE_COSH | ||||
| #		define HAVE_TANH | ||||
|  | ||||
| @ -128,7 +128,7 @@ qse_dir_errnum_t qse_dir_geterrnum (qse_dir_t* dir) | ||||
| 	return dir->errnum; | ||||
| } | ||||
|  | ||||
| static int compare_dirent (qse_lda_t* lda, const void* dptr1, size_t dlen1, const void* dptr2, size_t dlen2) | ||||
| static int compare_dirent (qse_lda_t* lda, const void* dptr1, qse_size_t dlen1, const void* dptr2, qse_size_t dlen2) | ||||
| { | ||||
| 	int n = QSE_MEMCMP (dptr1, dptr2, ((dlen1 < dlen2)? dlen1: dlen2)); | ||||
| 	if (n == 0 && dlen1 != dlen2) n = (dlen1 > dlen2)? 1: -1; | ||||
|  | ||||
| @ -415,7 +415,7 @@ static QSE_INLINE int append_wcs (qse_env_t* env, const qse_wchar_t* value[]) | ||||
| { | ||||
| #if defined(QSE_ENV_CHAR_IS_WCHAR) | ||||
| 	/* no conversion -> wchar */ | ||||
| 	return appendw (env, name, value); | ||||
| 	return appendw (env, value); | ||||
| #else | ||||
| 	/* convert wchar to mchar */ | ||||
| 	qse_mchar_t* valuedup[2]; | ||||
| @ -469,7 +469,7 @@ static QSE_INLINE int append_mbs (qse_env_t* env, const qse_mchar_t* value[]) | ||||
| 	valuedup[0] = qse_mbsatowcsalldup (value, QSE_NULL, env->mmgr);  | ||||
| 	if (valuedup[0] == QSE_NULL) return -1; | ||||
| 	valuedup[1] = QSE_NULL; | ||||
| 	n = appendw (env, namedup, valuedup); | ||||
| 	n = appendw (env, valuedup); | ||||
| 	QSE_MMGR_FREE (env->mmgr, valuedup[0]); | ||||
|  | ||||
| 	return n; | ||||
|  | ||||
| @ -25,7 +25,8 @@ | ||||
| #	include <winsock2.h> | ||||
| #	include <ws2tcpip.h> /* sockaddr_in6 */ | ||||
| #	include <windows.h> | ||||
| #	if (defined(__WATCOMC__) && (__WATCOMC__ < 1200)) | ||||
| #	undef AF_UNIX | ||||
| #	if defined(__WATCOMC__) && (__WATCOMC__ < 1200) | ||||
| 		/* the header files shipped with watcom 11 doesn't contain | ||||
| 		 * proper inet6 support. note using the compiler version | ||||
| 		 * in the contidional isn't that good idea since you  | ||||
| @ -41,6 +42,7 @@ | ||||
| 	/* though AF_INET6 is defined, there is no support | ||||
| 	 * for it. so undefine it */ | ||||
| #	undef AF_INET6 | ||||
| #	undef AF_UNIX | ||||
| #	pragma library("tcpip32.lib") | ||||
| #elif defined(__DOS__) | ||||
|  	/* TODO:  consider watt-32 */ | ||||
|  | ||||
| @ -299,6 +299,7 @@ static int dns_open (qse_httpd_t* httpd, qse_httpd_dns_t* dns) | ||||
|  | ||||
| 	dns->handle[0] = QSE_INVALID_SCKHND; | ||||
| 	dns->handle[1] = QSE_INVALID_SCKHND; | ||||
| 	dns->handle[2] = QSE_INVALID_SCKHND; | ||||
|  | ||||
| 	dc = (dns_ctx_t*) qse_httpd_callocmem (httpd, QSE_SIZEOF(dns_ctx_t)); | ||||
| 	if (dc == NULL) goto oops; | ||||
|  | ||||
| @ -2,7 +2,12 @@ | ||||
|  | ||||
| static void* mod_open (qse_httpd_t* httpd, const qse_char_t* sysname) | ||||
| { | ||||
| #if defined(USE_LTDL) | ||||
| #if defined(QSE_ENABLE_STATIC_MODULE) | ||||
|  | ||||
| 	qse_httpd_seterrnum (httpd, QSE_HTTPD_ENOIMPL); | ||||
| 	return QSE_NULL; | ||||
|  | ||||
| #elif defined(USE_LTDL) | ||||
| 	void* h; | ||||
| 	qse_mchar_t* modpath; | ||||
|  | ||||
| @ -33,7 +38,7 @@ static void* mod_open (qse_httpd_t* httpd, const qse_char_t* sysname) | ||||
| 	HMODULE h; | ||||
|  | ||||
| 	h = LoadLibrary (sysname); | ||||
| 	if (!h) qse_httpd_seterrnum (httpd, syserr_to_errnum(GetLastError()); | ||||
| 	if (!h) qse_httpd_seterrnum (httpd, syserr_to_errnum(GetLastError())); | ||||
|  | ||||
| 	QSE_ASSERT (QSE_SIZEOF(h) <= QSE_SIZEOF(void*)); | ||||
| 	return h; | ||||
| @ -113,7 +118,10 @@ static void* mod_open (qse_httpd_t* httpd, const qse_char_t* sysname) | ||||
|  | ||||
| static void mod_close (qse_httpd_t* httpd, void* handle) | ||||
| { | ||||
| #if defined(USE_LTDL) | ||||
| #if defined(QSE_ENABLE_STATIC_MODULE) | ||||
| 	/* this won't be called at all when modules are linked into | ||||
| 	 * the main library. */ | ||||
| #elif defined(USE_LTDL) | ||||
| 	lt_dlclose (handle); | ||||
| #elif defined(_WIN32) | ||||
| 	FreeLibrary ((HMODULE)handle); | ||||
| @ -142,7 +150,13 @@ static void* mod_symbol (qse_httpd_t* httpd, void* handle, const qse_char_t* nam | ||||
| 	} | ||||
| #endif | ||||
|  | ||||
| #if defined(USE_LTDL) | ||||
|  | ||||
| #if defined(QSE_ENABLE_STATIC_MODULE) | ||||
| 	/* this won't be called at all when modules are linked into | ||||
| 	 * the main library. */ | ||||
| 	s = QSE_NULL; | ||||
|  | ||||
| #elif defined(USE_LTDL) | ||||
| 	s = lt_dlsym (handle, mname); | ||||
| 	if (s == QSE_NULL) qse_httpd_seterrnum (httpd, syserr_to_errnum(errno)); | ||||
| #elif defined(_WIN32) | ||||
|  | ||||
| @ -378,7 +378,7 @@ static void tmr_urs_tmout_handle (qse_tmr_t* tmr, const qse_ntime_t* now, void* | ||||
| 		tmout_event.handler = tmr_urs_tmout_handle; | ||||
| 		tmout_event.updater = tmr_urs_tmout_update; | ||||
|  | ||||
| 		if (sendto (req->urs_socket, req->pkt, req->pktlen, 0, (struct sockaddr*)&req->urs_skad, req->urs_skadlen) != req->pktlen) | ||||
| 		if (sendto (req->urs_socket, (void*)req->pkt, req->pktlen, 0, (struct sockaddr*)&req->urs_skad, req->urs_skadlen) != req->pktlen) | ||||
| 		{ | ||||
| 			/* error. fall thru */ | ||||
| 			qse_httpd_seterrnum (dc->httpd, SKERR_TO_ERRNUM()); | ||||
| @ -537,7 +537,7 @@ static int urs_send (qse_httpd_t* httpd, qse_httpd_urs_t* urs, const qse_mchar_t | ||||
| } | ||||
| */ | ||||
|  | ||||
| 	if (sendto (req->urs_socket, req->pkt, req->pktlen, 0, (struct sockaddr*)&req->urs_skad, req->urs_skadlen) != req->pktlen) | ||||
| 	if (sendto (req->urs_socket, (void*)req->pkt, req->pktlen, 0, (struct sockaddr*)&req->urs_skad, req->urs_skadlen) != req->pktlen) | ||||
| 	{ | ||||
| 		qse_httpd_seterrnum (httpd, SKERR_TO_ERRNUM()); | ||||
| printf ("URS SENDTO FAILURE........................\n"); /* TODO: logging */ | ||||
|  | ||||
| @ -51,6 +51,8 @@ | ||||
| #			define USE_LTDL | ||||
| #	endif | ||||
|  | ||||
| #	undef AF_UNIX | ||||
|  | ||||
| #elif defined(__OS2__) | ||||
| #	include <types.h> | ||||
| #	include <sys/socket.h> | ||||
| @ -64,8 +66,11 @@ | ||||
| #	endif | ||||
| #	define INCL_DOSERRORS | ||||
| #	define INCL_DOSFILEMGR | ||||
| #	define INCL_DOSMODULEMGR | ||||
| #	include <os2.h> | ||||
|  | ||||
| #	undef AF_UNIX | ||||
|  | ||||
| #elif defined(__DOS__) | ||||
| 	/* TODO */ | ||||
| #	include <errno.h> | ||||
| @ -168,7 +173,7 @@ static qse_httpd_errnum_t skerr_to_errnum (DWORD e) | ||||
| 		case WSAEINTR: | ||||
| 			return QSE_HTTPD_EINTR; | ||||
|  | ||||
| 		case WASEWOULDBLOCK: | ||||
| 		case WSAEWOULDBLOCK: | ||||
| 			return QSE_HTTPD_EAGAIN; | ||||
|  | ||||
| 		case WSAECONNREFUSED: | ||||
| @ -826,7 +831,7 @@ static qse_sck_hnd_t open_client_socket (qse_httpd_t* httpd, int domain, int typ | ||||
| 	#endif | ||||
| 	*/ | ||||
|  | ||||
| 	#if defined(AF_INET6) && defined(IPV6_V6ONLY) | ||||
| 	#if defined(AF_INET6) && defined(IPPROTO_IPV6) && defined(IPV6_V6ONLY) | ||||
| 	if (domain == AF_INET6) | ||||
| 	{ | ||||
| 		flag = 1; | ||||
|  | ||||
| @ -783,7 +783,7 @@ static int activate_servers (qse_httpd_t* httpd) | ||||
| /* | ||||
| 			httpd->opt.rcb.log (httpd, 0, QSE_T("cannot activate %s"), buf); | ||||
| */ | ||||
| #if 0 | ||||
| #if 1 | ||||
| qse_printf(QSE_T("cannot activate [%s]\n"), buf); | ||||
| #endif | ||||
| 			continue; | ||||
| @ -797,7 +797,7 @@ qse_printf(QSE_T("cannot activate [%s]\n"), buf); | ||||
| /* | ||||
| 			httpd->opt.rcb.log (httpd, 0, QSE_T("cannot activate %s - "), buf); | ||||
| */ | ||||
| #if 0 | ||||
| #if 1 | ||||
| qse_printf(QSE_T("cannot add handle [%s]\n"), buf); | ||||
| #endif | ||||
|  | ||||
| @ -1686,6 +1686,7 @@ int qse_httpd_loop (qse_httpd_t* httpd) | ||||
| 	} | ||||
| 	if (httpd->server.nactive <= 0) | ||||
| 	{ | ||||
| printf ("no active servers...\n"); | ||||
| 		if (httpd->dnsactive) deactivate_dns (httpd); | ||||
| 		if (httpd->ursactive) deactivate_urs (httpd); | ||||
| 		httpd->opt.scb.mux.close (httpd, httpd->mux); | ||||
| @ -1694,6 +1695,7 @@ int qse_httpd_loop (qse_httpd_t* httpd) | ||||
| 		return -1; | ||||
| 	} | ||||
|  | ||||
| printf ("entering loop... ...\n"); | ||||
| 	xret = 0; | ||||
|  | ||||
| 	while (!httpd->stopreq) | ||||
| @ -1702,6 +1704,7 @@ int qse_httpd_loop (qse_httpd_t* httpd) | ||||
| 		count = httpd->opt.scb.mux.poll (httpd, httpd->mux, &tmout); | ||||
| 		if (count <= -1)  | ||||
| 		{ | ||||
| printf ("mux errorr ... ...\n"); | ||||
| 			if (httpd->errnum != QSE_HTTPD_EINTR) | ||||
| 			{ | ||||
| 				xret = -1;  | ||||
|  | ||||
		Reference in New Issue
	
	Block a user