diff --git a/Package.swift b/Package.swift index 4ab4e74e..036b1681 100644 --- a/Package.swift +++ b/Package.swift @@ -25,11 +25,9 @@ let package = Package( targets: [ Target(name: "PerfectLib", dependencies: [ .Target(name: "OpenSSL"), - .Target(name: "ICU"), .Target(name: "cURL"), .Target(name: "LinuxBridge")]), Target(name: "OpenSSL"), - Target(name: "ICU"), Target(name: "cURL"), Target(name: "LinuxBridge") ], @@ -41,10 +39,8 @@ let package = Package( targets: [ Target(name: "PerfectLib", dependencies: [ .Target(name: "OpenSSL"), - .Target(name: "ICU"), .Target(name: "cURL")]), Target(name: "OpenSSL"), - Target(name: "ICU"), Target(name: "cURL"), Target(name: "PerfectLibTests", dependencies: [.Target(name: "PerfectLib")]) ], diff --git a/Sources/ICU/icu.c b/Sources/ICU/icu.c deleted file mode 100644 index b28b04f6..00000000 --- a/Sources/ICU/icu.c +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/Sources/ICU/include/module.modulemap b/Sources/ICU/include/module.modulemap deleted file mode 100644 index 6f070ef0..00000000 --- a/Sources/ICU/include/module.modulemap +++ /dev/null @@ -1,4 +0,0 @@ -module ICU { - header "p_icu.h" - export * -} diff --git a/Sources/ICU/include/p_icu.h b/Sources/ICU/include/p_icu.h deleted file mode 100644 index bea6dc6a..00000000 --- a/Sources/ICU/include/p_icu.h +++ /dev/null @@ -1,66 +0,0 @@ - -#ifndef _p_icu_h_ -#define _p_icu_h_ - -#include - -// This file contains several imports from the ICU libraries. - -typedef char UBool; -typedef void* UDateFormat; -typedef double UDate; -typedef unsigned short UChar; - -typedef enum UErrorCode { - U_USING_FALLBACK_WARNING = -128, - U_ZERO_ERROR = 0 -} UErrorCode; - -extern UBool u_isWhitespace(unsigned int); -extern UBool u_isdigit(unsigned int); -extern UBool u_isalnum(unsigned int); - -extern double ucal_getNow(); - -extern const char * u_errorName(enum UErrorCode code); - -typedef enum UDateFormatStyle { - UDAT_FULL, - UDAT_LONG, - UDAT_MEDIUM, - UDAT_SHORT, - UDAT_DEFAULT = UDAT_MEDIUM, - UDAT_RELATIVE = (1 << 7), - UDAT_FULL_RELATIVE = UDAT_FULL | UDAT_RELATIVE, - UDAT_LONG_RELATIVE = UDAT_LONG | UDAT_RELATIVE, - UDAT_MEDIUM_RELATIVE = UDAT_MEDIUM | UDAT_RELATIVE, - UDAT_SHORT_RELATIVE = UDAT_SHORT | UDAT_RELATIVE, - UDAT_NONE = -1, - UDAT_PATTERN = -2 -} UDateFormatStyle; - -extern UDateFormat * udat_open(UDateFormatStyle timeStyle, - UDateFormatStyle dateStyle, - const char *locale, - const UChar *tzID, - int tzIDLength, - const UChar *pattern, - int patternLength, - enum UErrorCode *status); - -extern void udat_close(UDateFormat* format); - -extern UDate udat_parse(const UDateFormat* format, - const UChar* text, - int textLength, - int *parsePos, - enum UErrorCode *status); - -extern int udat_format(const UDateFormat* format, - UDate dateToFormat, - UChar* result, - int resultLength, - void * position, - enum UErrorCode* status); - -#endif diff --git a/Sources/PerfectLib/NetEvent.swift b/Sources/PerfectLib/NetEvent.swift index 43fba89e..20fc56ba 100644 --- a/Sources/PerfectLib/NetEvent.swift +++ b/Sources/PerfectLib/NetEvent.swift @@ -43,9 +43,9 @@ class NetEvent { enum Filter { case None, Error(Int32), Read, Write, Timer - + #if os(Linux) - var epollEvent: UInt3 { + var epollEvent: UInt32 { switch self { case .Read: return EPOLLIN.rawValue @@ -124,7 +124,7 @@ class NetEvent { let q = Threading.getQueue("NetEvent", type: .Serial) q.dispatch { while true { - + #if os(Linux) let nev = Int(epoll_wait(self.kq, self.evlist, Int32(self.numEvents), -1)) #else @@ -142,16 +142,14 @@ class NetEvent { #if os(Linux) let sock = SocketType(evt.data.fd) var filter = Filter.None - if (evt.events & EPOLLERR) != 0 { + if (evt.events & EPOLLERR.rawValue) != 0 { var errData = Int32(0) - if error { - var errLen = socklen_t(sizeof(Int32)) - getsockopt(sock, SOL_SOCKET, SO_ERROR, &errData, &errLen) - } + var errLen = socklen_t(sizeof(Int32)) + getsockopt(sock, SOL_SOCKET, SO_ERROR, &errData, &errLen) filter = .Error(errData) - } else if (evt.events & EPOLLIN) != 0 { + } else if (evt.events & EPOLLIN.rawValue) != 0 { filter = .Read - } else if (evt.events & EPOLLOUT) != 0 { + } else if (evt.events & EPOLLOUT.rawValue) != 0 { filter = .Write } #else diff --git a/Sources/PerfectLib/Utilities-Server.swift b/Sources/PerfectLib/Utilities-Server.swift index b71d448d..c6ee8eb3 100644 --- a/Sources/PerfectLib/Utilities-Server.swift +++ b/Sources/PerfectLib/Utilities-Server.swift @@ -17,6 +17,10 @@ //===----------------------------------------------------------------------===// // +#if os(Linux) +import SwiftGlibc +#endif + extension UnicodeScalar { /// Returns true if the UnicodeScalar is a white space character @@ -44,4 +48,3 @@ extension UnicodeScalar { } } } -