From 2c9867c57763e6f4f06db80dd9ef47c1ebc4d673 Mon Sep 17 00:00:00 2001 From: Eugen Wissner Date: Sun, 25 Jun 2017 09:46:02 +0200 Subject: [PATCH] Fix generating async docs for different OS --- source/tanya/async/event/epoll.d | 9 +++++++-- source/tanya/async/event/iocp.d | 9 +++++++-- source/tanya/async/event/kqueue.d | 9 +++++++-- source/tanya/async/event/selector.d | 9 +++++++-- source/tanya/async/iocp.d | 25 ++++++++++++++++++++++++- source/tanya/async/loop.d | 14 ++++++++++---- source/tanya/async/package.d | 2 ++ source/tanya/async/protocol.d | 6 ++++++ source/tanya/async/transport.d | 3 +++ source/tanya/async/watcher.d | 2 ++ source/tanya/format/conv.d | 12 ++++++++---- 11 files changed, 83 insertions(+), 17 deletions(-) diff --git a/source/tanya/async/event/epoll.d b/source/tanya/async/event/epoll.d index 5809dd4..6809ac7 100644 --- a/source/tanya/async/event/epoll.d +++ b/source/tanya/async/event/epoll.d @@ -2,7 +2,9 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -/** +/* + * Event loop implementation for Linux. + * * Copyright: Eugene Wissner 2016-2017. * License: $(LINK2 https://www.mozilla.org/en-US/MPL/2.0/, * Mozilla Public License, v. 2.0). @@ -10,7 +12,10 @@ */ module tanya.async.event.epoll; -version (linux): +version (D_Ddoc) +{ +} +else version (linux): public import core.sys.linux.epoll; import tanya.async.protocol; diff --git a/source/tanya/async/event/iocp.d b/source/tanya/async/event/iocp.d index fe05cc3..97f5459 100644 --- a/source/tanya/async/event/iocp.d +++ b/source/tanya/async/event/iocp.d @@ -2,7 +2,9 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -/** +/* + * Event loop implementation for Windows. + * * Copyright: Eugene Wissner 2016-2017. * License: $(LINK2 https://www.mozilla.org/en-US/MPL/2.0/, * Mozilla Public License, v. 2.0). @@ -10,7 +12,10 @@ */ module tanya.async.event.iocp; -version (Windows): +version (D_Ddoc) +{ +} +else version (Windows): import tanya.container.buffer; import tanya.async.loop; diff --git a/source/tanya/async/event/kqueue.d b/source/tanya/async/event/kqueue.d index 3bd7d46..b99e06c 100644 --- a/source/tanya/async/event/kqueue.d +++ b/source/tanya/async/event/kqueue.d @@ -2,7 +2,9 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -/** +/* + * Event loop implementation for *BSD. + * * Copyright: Eugene Wissner 2016-2017. * License: $(LINK2 https://www.mozilla.org/en-US/MPL/2.0/, * Mozilla Public License, v. 2.0). @@ -10,7 +12,10 @@ */ module tanya.async.event.kqueue; -version (OSX) +version (D_Ddoc) +{ +} +else version (OSX) { version = MacBSD; } diff --git a/source/tanya/async/event/selector.d b/source/tanya/async/event/selector.d index 7194756..1a8a86b 100644 --- a/source/tanya/async/event/selector.d +++ b/source/tanya/async/event/selector.d @@ -2,7 +2,9 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -/** +/* + * This module contains base implementations for reactor event loops. + * * Copyright: Eugene Wissner 2016-2017. * License: $(LINK2 https://www.mozilla.org/en-US/MPL/2.0/, * Mozilla Public License, v. 2.0). @@ -10,7 +12,10 @@ */ module tanya.async.event.selector; -version (Posix): +version (D_Ddoc) +{ +} +else version (Posix): import tanya.async.loop; import tanya.async.protocol; diff --git a/source/tanya/async/iocp.d b/source/tanya/async/iocp.d index bd191d3..14ae840 100644 --- a/source/tanya/async/iocp.d +++ b/source/tanya/async/iocp.d @@ -3,6 +3,10 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** + * This module provides API for Windows I/O Completion Ports. + * + * Note: Available only on Windows. + * * Copyright: Eugene Wissner 2016-2017. * License: $(LINK2 https://www.mozilla.org/en-US/MPL/2.0/, * Mozilla Public License, v. 2.0). @@ -10,7 +14,26 @@ */ module tanya.async.iocp; -version (Windows): +version (Windows) +{ + version = WindowsDoc; +} +else version (D_Ddoc) +{ + version = WindowsDoc; + version (Windows) + { + } + else + { + private struct OVERLAPPED + { + } + private alias HANDLE = void*; + } +} + +version (WindowsDoc): import core.sys.windows.winbase; import core.sys.windows.windef; diff --git a/source/tanya/async/loop.d b/source/tanya/async/loop.d index 9f9587a..40a61ae 100644 --- a/source/tanya/async/loop.d +++ b/source/tanya/async/loop.d @@ -3,10 +3,8 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** - * Copyright: Eugene Wissner 2016-2017. - * License: $(LINK2 https://www.mozilla.org/en-US/MPL/2.0/, - * Mozilla Public License, v. 2.0). - * Authors: $(LINK2 mailto:info@caraus.de, Eugene Wissner) + * Interface for the event loop implementations and the default event loop + * chooser. * * --- * import tanya.async; @@ -61,6 +59,11 @@ * defaultAllocator.dispose(address); * } * --- + * + * Copyright: Eugene Wissner 2016-2017. + * License: $(LINK2 https://www.mozilla.org/en-US/MPL/2.0/, + * Mozilla Public License, v. 2.0). + * Authors: $(LINK2 mailto:info@caraus.de, Eugene Wissner) */ module tanya.async.loop; @@ -79,6 +82,9 @@ import tanya.network.socket; version (DisableBackends) { } +else version (D_Ddoc) +{ +} else version (linux) { import tanya.async.event.epoll; diff --git a/source/tanya/async/package.d b/source/tanya/async/package.d index e9ed007..7719894 100644 --- a/source/tanya/async/package.d +++ b/source/tanya/async/package.d @@ -3,6 +3,8 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** + * This package provides asynchronous capabilities. + * * Copyright: Eugene Wissner 2016-2017. * License: $(LINK2 https://www.mozilla.org/en-US/MPL/2.0/, * Mozilla Public License, v. 2.0). diff --git a/source/tanya/async/protocol.d b/source/tanya/async/protocol.d index 2498d45..6cb3b4b 100644 --- a/source/tanya/async/protocol.d +++ b/source/tanya/async/protocol.d @@ -3,6 +3,12 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** + * This module contains protocol which handle data in asynchronous + * applications. + * + * When an event from the network arrives, a protocol method gets + * called and can respond to the event. + * * Copyright: Eugene Wissner 2016-2017. * License: $(LINK2 https://www.mozilla.org/en-US/MPL/2.0/, * Mozilla Public License, v. 2.0). diff --git a/source/tanya/async/transport.d b/source/tanya/async/transport.d index 2d5fbe7..a21155f 100644 --- a/source/tanya/async/transport.d +++ b/source/tanya/async/transport.d @@ -3,6 +3,9 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** + * This module contains transports which are responsible for data dilvery + * between two parties of an asynchronous communication. + * * Copyright: Eugene Wissner 2016-2017. * License: $(LINK2 https://www.mozilla.org/en-US/MPL/2.0/, * Mozilla Public License, v. 2.0). diff --git a/source/tanya/async/watcher.d b/source/tanya/async/watcher.d index 02b80ae..2b6cbc7 100644 --- a/source/tanya/async/watcher.d +++ b/source/tanya/async/watcher.d @@ -3,6 +3,8 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** + * Watchers register user's interest in some event. + * * Copyright: Eugene Wissner 2016-2017. * License: $(LINK2 https://www.mozilla.org/en-US/MPL/2.0/, * Mozilla Public License, v. 2.0). diff --git a/source/tanya/format/conv.d b/source/tanya/format/conv.d index 7a13178..d069e38 100644 --- a/source/tanya/format/conv.d +++ b/source/tanya/format/conv.d @@ -42,20 +42,24 @@ final class ConvException : Exception * $(D_PARAM To), just returns $(D_PARAM from). * * Params: - * From = Source type. - * To = Target type. - * from = Source value. + * To = Target type. * * Returns: $(D_PARAM from). */ template to(To) { + /** + * Params: + * From = Source type. + * from = Source value. + */ ref To to(From)(ref From from) if (is(To == From)) { return from; } + /// Ditto. To to(From)(From from) if (is(Unqual!To == Unqual!From) || isNumeric!From && isFloatingPoint!To) { @@ -391,7 +395,7 @@ pure nothrow @safe @nogc unittest * from = Source value. * * Returns: Truncated $(D_PARAM from) (everything after the decimal point is - * dropped. + * dropped). * * Throws: $(D_PSYMBOL ConvException) if * $(D_INLINECODE from < To.min || from > To.max).