code
stringlengths
3
10M
language
stringclasses
31 values
.hd chkarg "parse single-letter arguments" 03/23/80 integer function chkarg (arg_num, result) integer arg_num, result (26) .sp Library: vswtlb (standard Subsystem library) .fs 'Chkarg' scans the list of arguments supplied on the command line, starting at position 'arg_num', looking for arguments that contain a dash followed by a string of letters. For each letter in such an argument, 'chkarg' looks at the corresponding element in the 'result' array (the letters "A" and "a" correspond to element 1, "Z" and "z" to element 26). If the element is non-negative, it is set to a positive value equal to the order in which the letter was encountered in scanning the arguments, counting from 1. Otherwise, the element is left unchanged and a value of ERR is returned as the result of the function. Thus, illegal letters may be detected by setting the corresponding elements in 'result' to a negative value before calling 'chkarg'. .sp Scanning continues, incrementing 'arg_num', until the end of the argument list is reached, an argument not beginning with a dash is found, or an argument beginning with a dash but containing a subsequent character other than a letter is found. In the first two cases, 'chkarg' returns with the number of letters encountered as its result. In the third case, a result of ERR is returned. .im 'Chkarg' does a straightforward argument scan, using 'getarg' to fetch each argument in turn. The actions taken for each argument are simply those mentioned above. .am arg_num, result .ca getarg .sa getarg (2), getkwd (2)
D
/Users/admin/Desktop/CuckooTest/Pods/Cuckoo/Generator/.build/debug/FileKit.build/Path.swift.o : /Users/admin/Desktop/CuckooTest/Pods/Cuckoo/Generator/Packages/FileKit-4.0.2/Sources/Array+File.swift /Users/admin/Desktop/CuckooTest/Pods/Cuckoo/Generator/Packages/FileKit-4.0.2/Sources/ArrayFile.swift /Users/admin/Desktop/CuckooTest/Pods/Cuckoo/Generator/Packages/FileKit-4.0.2/Sources/Bundle+FileKit.swift /Users/admin/Desktop/CuckooTest/Pods/Cuckoo/Generator/Packages/FileKit-4.0.2/Sources/Data+FileKit.swift /Users/admin/Desktop/CuckooTest/Pods/Cuckoo/Generator/Packages/FileKit-4.0.2/Sources/DataFile.swift /Users/admin/Desktop/CuckooTest/Pods/Cuckoo/Generator/Packages/FileKit-4.0.2/Sources/DataType.swift /Users/admin/Desktop/CuckooTest/Pods/Cuckoo/Generator/Packages/FileKit-4.0.2/Sources/Dictionary+File.swift /Users/admin/Desktop/CuckooTest/Pods/Cuckoo/Generator/Packages/FileKit-4.0.2/Sources/DictionaryFile.swift /Users/admin/Desktop/CuckooTest/Pods/Cuckoo/Generator/Packages/FileKit-4.0.2/Sources/DirectoryEnumerator.swift /Users/admin/Desktop/CuckooTest/Pods/Cuckoo/Generator/Packages/FileKit-4.0.2/Sources/DispatchEvent.swift /Users/admin/Desktop/CuckooTest/Pods/Cuckoo/Generator/Packages/FileKit-4.0.2/Sources/DispatchWatcher.swift /Users/admin/Desktop/CuckooTest/Pods/Cuckoo/Generator/Packages/FileKit-4.0.2/Sources/File.swift /Users/admin/Desktop/CuckooTest/Pods/Cuckoo/Generator/Packages/FileKit-4.0.2/Sources/FileKit.swift /Users/admin/Desktop/CuckooTest/Pods/Cuckoo/Generator/Packages/FileKit-4.0.2/Sources/FileKitError.swift /Users/admin/Desktop/CuckooTest/Pods/Cuckoo/Generator/Packages/FileKit-4.0.2/Sources/FilePermissions.swift /Users/admin/Desktop/CuckooTest/Pods/Cuckoo/Generator/Packages/FileKit-4.0.2/Sources/FileProtection.swift /Users/admin/Desktop/CuckooTest/Pods/Cuckoo/Generator/Packages/FileKit-4.0.2/Sources/FileSystemEvent.swift /Users/admin/Desktop/CuckooTest/Pods/Cuckoo/Generator/Packages/FileKit-4.0.2/Sources/FileSystemEventStream.swift /Users/admin/Desktop/CuckooTest/Pods/Cuckoo/Generator/Packages/FileKit-4.0.2/Sources/FileSystemWatcher.swift /Users/admin/Desktop/CuckooTest/Pods/Cuckoo/Generator/Packages/FileKit-4.0.2/Sources/FileType.swift /Users/admin/Desktop/CuckooTest/Pods/Cuckoo/Generator/Packages/FileKit-4.0.2/Sources/Image+FileKit.swift /Users/admin/Desktop/CuckooTest/Pods/Cuckoo/Generator/Packages/FileKit-4.0.2/Sources/ImageFile.swift /Users/admin/Desktop/CuckooTest/Pods/Cuckoo/Generator/Packages/FileKit-4.0.2/Sources/NSArray+FileKit.swift /Users/admin/Desktop/CuckooTest/Pods/Cuckoo/Generator/Packages/FileKit-4.0.2/Sources/NSData+FileKit.swift /Users/admin/Desktop/CuckooTest/Pods/Cuckoo/Generator/Packages/FileKit-4.0.2/Sources/NSDataFile.swift /Users/admin/Desktop/CuckooTest/Pods/Cuckoo/Generator/Packages/FileKit-4.0.2/Sources/NSDictionary+FileKit.swift /Users/admin/Desktop/CuckooTest/Pods/Cuckoo/Generator/Packages/FileKit-4.0.2/Sources/NSString+FileKit.swift /Users/admin/Desktop/CuckooTest/Pods/Cuckoo/Generator/Packages/FileKit-4.0.2/Sources/Operators.swift /Users/admin/Desktop/CuckooTest/Pods/Cuckoo/Generator/Packages/FileKit-4.0.2/Sources/Path.swift /Users/admin/Desktop/CuckooTest/Pods/Cuckoo/Generator/Packages/FileKit-4.0.2/Sources/Process+FileKit.swift /Users/admin/Desktop/CuckooTest/Pods/Cuckoo/Generator/Packages/FileKit-4.0.2/Sources/RelativePathType.swift /Users/admin/Desktop/CuckooTest/Pods/Cuckoo/Generator/Packages/FileKit-4.0.2/Sources/String+FileKit.swift /Users/admin/Desktop/CuckooTest/Pods/Cuckoo/Generator/Packages/FileKit-4.0.2/Sources/TextFile.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Swift.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/SwiftOnoneSupport.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Foundation.swiftmodule /Users/admin/Desktop/CuckooTest/Pods/Cuckoo/Generator/.build/debug/CYaml.build/module.modulemap /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Darwin.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Dispatch.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/ObjectiveC.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/CoreGraphics.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/IOKit.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/AppKit.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/CoreData.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/QuartzCore.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/XPC.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/CoreImage.swiftmodule /Users/admin/Desktop/CuckooTest/Pods/Cuckoo/Generator/.build/debug/FileKit.build/Path~partial.swiftmodule : /Users/admin/Desktop/CuckooTest/Pods/Cuckoo/Generator/Packages/FileKit-4.0.2/Sources/Array+File.swift /Users/admin/Desktop/CuckooTest/Pods/Cuckoo/Generator/Packages/FileKit-4.0.2/Sources/ArrayFile.swift /Users/admin/Desktop/CuckooTest/Pods/Cuckoo/Generator/Packages/FileKit-4.0.2/Sources/Bundle+FileKit.swift /Users/admin/Desktop/CuckooTest/Pods/Cuckoo/Generator/Packages/FileKit-4.0.2/Sources/Data+FileKit.swift /Users/admin/Desktop/CuckooTest/Pods/Cuckoo/Generator/Packages/FileKit-4.0.2/Sources/DataFile.swift /Users/admin/Desktop/CuckooTest/Pods/Cuckoo/Generator/Packages/FileKit-4.0.2/Sources/DataType.swift /Users/admin/Desktop/CuckooTest/Pods/Cuckoo/Generator/Packages/FileKit-4.0.2/Sources/Dictionary+File.swift /Users/admin/Desktop/CuckooTest/Pods/Cuckoo/Generator/Packages/FileKit-4.0.2/Sources/DictionaryFile.swift /Users/admin/Desktop/CuckooTest/Pods/Cuckoo/Generator/Packages/FileKit-4.0.2/Sources/DirectoryEnumerator.swift /Users/admin/Desktop/CuckooTest/Pods/Cuckoo/Generator/Packages/FileKit-4.0.2/Sources/DispatchEvent.swift /Users/admin/Desktop/CuckooTest/Pods/Cuckoo/Generator/Packages/FileKit-4.0.2/Sources/DispatchWatcher.swift /Users/admin/Desktop/CuckooTest/Pods/Cuckoo/Generator/Packages/FileKit-4.0.2/Sources/File.swift /Users/admin/Desktop/CuckooTest/Pods/Cuckoo/Generator/Packages/FileKit-4.0.2/Sources/FileKit.swift /Users/admin/Desktop/CuckooTest/Pods/Cuckoo/Generator/Packages/FileKit-4.0.2/Sources/FileKitError.swift /Users/admin/Desktop/CuckooTest/Pods/Cuckoo/Generator/Packages/FileKit-4.0.2/Sources/FilePermissions.swift /Users/admin/Desktop/CuckooTest/Pods/Cuckoo/Generator/Packages/FileKit-4.0.2/Sources/FileProtection.swift /Users/admin/Desktop/CuckooTest/Pods/Cuckoo/Generator/Packages/FileKit-4.0.2/Sources/FileSystemEvent.swift /Users/admin/Desktop/CuckooTest/Pods/Cuckoo/Generator/Packages/FileKit-4.0.2/Sources/FileSystemEventStream.swift /Users/admin/Desktop/CuckooTest/Pods/Cuckoo/Generator/Packages/FileKit-4.0.2/Sources/FileSystemWatcher.swift /Users/admin/Desktop/CuckooTest/Pods/Cuckoo/Generator/Packages/FileKit-4.0.2/Sources/FileType.swift /Users/admin/Desktop/CuckooTest/Pods/Cuckoo/Generator/Packages/FileKit-4.0.2/Sources/Image+FileKit.swift /Users/admin/Desktop/CuckooTest/Pods/Cuckoo/Generator/Packages/FileKit-4.0.2/Sources/ImageFile.swift /Users/admin/Desktop/CuckooTest/Pods/Cuckoo/Generator/Packages/FileKit-4.0.2/Sources/NSArray+FileKit.swift /Users/admin/Desktop/CuckooTest/Pods/Cuckoo/Generator/Packages/FileKit-4.0.2/Sources/NSData+FileKit.swift /Users/admin/Desktop/CuckooTest/Pods/Cuckoo/Generator/Packages/FileKit-4.0.2/Sources/NSDataFile.swift /Users/admin/Desktop/CuckooTest/Pods/Cuckoo/Generator/Packages/FileKit-4.0.2/Sources/NSDictionary+FileKit.swift /Users/admin/Desktop/CuckooTest/Pods/Cuckoo/Generator/Packages/FileKit-4.0.2/Sources/NSString+FileKit.swift /Users/admin/Desktop/CuckooTest/Pods/Cuckoo/Generator/Packages/FileKit-4.0.2/Sources/Operators.swift /Users/admin/Desktop/CuckooTest/Pods/Cuckoo/Generator/Packages/FileKit-4.0.2/Sources/Path.swift /Users/admin/Desktop/CuckooTest/Pods/Cuckoo/Generator/Packages/FileKit-4.0.2/Sources/Process+FileKit.swift /Users/admin/Desktop/CuckooTest/Pods/Cuckoo/Generator/Packages/FileKit-4.0.2/Sources/RelativePathType.swift /Users/admin/Desktop/CuckooTest/Pods/Cuckoo/Generator/Packages/FileKit-4.0.2/Sources/String+FileKit.swift /Users/admin/Desktop/CuckooTest/Pods/Cuckoo/Generator/Packages/FileKit-4.0.2/Sources/TextFile.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Swift.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/SwiftOnoneSupport.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Foundation.swiftmodule /Users/admin/Desktop/CuckooTest/Pods/Cuckoo/Generator/.build/debug/CYaml.build/module.modulemap /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Darwin.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Dispatch.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/ObjectiveC.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/CoreGraphics.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/IOKit.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/AppKit.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/CoreData.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/QuartzCore.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/XPC.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/CoreImage.swiftmodule /Users/admin/Desktop/CuckooTest/Pods/Cuckoo/Generator/.build/debug/FileKit.build/Path~partial.swiftdoc : /Users/admin/Desktop/CuckooTest/Pods/Cuckoo/Generator/Packages/FileKit-4.0.2/Sources/Array+File.swift /Users/admin/Desktop/CuckooTest/Pods/Cuckoo/Generator/Packages/FileKit-4.0.2/Sources/ArrayFile.swift /Users/admin/Desktop/CuckooTest/Pods/Cuckoo/Generator/Packages/FileKit-4.0.2/Sources/Bundle+FileKit.swift /Users/admin/Desktop/CuckooTest/Pods/Cuckoo/Generator/Packages/FileKit-4.0.2/Sources/Data+FileKit.swift /Users/admin/Desktop/CuckooTest/Pods/Cuckoo/Generator/Packages/FileKit-4.0.2/Sources/DataFile.swift /Users/admin/Desktop/CuckooTest/Pods/Cuckoo/Generator/Packages/FileKit-4.0.2/Sources/DataType.swift /Users/admin/Desktop/CuckooTest/Pods/Cuckoo/Generator/Packages/FileKit-4.0.2/Sources/Dictionary+File.swift /Users/admin/Desktop/CuckooTest/Pods/Cuckoo/Generator/Packages/FileKit-4.0.2/Sources/DictionaryFile.swift /Users/admin/Desktop/CuckooTest/Pods/Cuckoo/Generator/Packages/FileKit-4.0.2/Sources/DirectoryEnumerator.swift /Users/admin/Desktop/CuckooTest/Pods/Cuckoo/Generator/Packages/FileKit-4.0.2/Sources/DispatchEvent.swift /Users/admin/Desktop/CuckooTest/Pods/Cuckoo/Generator/Packages/FileKit-4.0.2/Sources/DispatchWatcher.swift /Users/admin/Desktop/CuckooTest/Pods/Cuckoo/Generator/Packages/FileKit-4.0.2/Sources/File.swift /Users/admin/Desktop/CuckooTest/Pods/Cuckoo/Generator/Packages/FileKit-4.0.2/Sources/FileKit.swift /Users/admin/Desktop/CuckooTest/Pods/Cuckoo/Generator/Packages/FileKit-4.0.2/Sources/FileKitError.swift /Users/admin/Desktop/CuckooTest/Pods/Cuckoo/Generator/Packages/FileKit-4.0.2/Sources/FilePermissions.swift /Users/admin/Desktop/CuckooTest/Pods/Cuckoo/Generator/Packages/FileKit-4.0.2/Sources/FileProtection.swift /Users/admin/Desktop/CuckooTest/Pods/Cuckoo/Generator/Packages/FileKit-4.0.2/Sources/FileSystemEvent.swift /Users/admin/Desktop/CuckooTest/Pods/Cuckoo/Generator/Packages/FileKit-4.0.2/Sources/FileSystemEventStream.swift /Users/admin/Desktop/CuckooTest/Pods/Cuckoo/Generator/Packages/FileKit-4.0.2/Sources/FileSystemWatcher.swift /Users/admin/Desktop/CuckooTest/Pods/Cuckoo/Generator/Packages/FileKit-4.0.2/Sources/FileType.swift /Users/admin/Desktop/CuckooTest/Pods/Cuckoo/Generator/Packages/FileKit-4.0.2/Sources/Image+FileKit.swift /Users/admin/Desktop/CuckooTest/Pods/Cuckoo/Generator/Packages/FileKit-4.0.2/Sources/ImageFile.swift /Users/admin/Desktop/CuckooTest/Pods/Cuckoo/Generator/Packages/FileKit-4.0.2/Sources/NSArray+FileKit.swift /Users/admin/Desktop/CuckooTest/Pods/Cuckoo/Generator/Packages/FileKit-4.0.2/Sources/NSData+FileKit.swift /Users/admin/Desktop/CuckooTest/Pods/Cuckoo/Generator/Packages/FileKit-4.0.2/Sources/NSDataFile.swift /Users/admin/Desktop/CuckooTest/Pods/Cuckoo/Generator/Packages/FileKit-4.0.2/Sources/NSDictionary+FileKit.swift /Users/admin/Desktop/CuckooTest/Pods/Cuckoo/Generator/Packages/FileKit-4.0.2/Sources/NSString+FileKit.swift /Users/admin/Desktop/CuckooTest/Pods/Cuckoo/Generator/Packages/FileKit-4.0.2/Sources/Operators.swift /Users/admin/Desktop/CuckooTest/Pods/Cuckoo/Generator/Packages/FileKit-4.0.2/Sources/Path.swift /Users/admin/Desktop/CuckooTest/Pods/Cuckoo/Generator/Packages/FileKit-4.0.2/Sources/Process+FileKit.swift /Users/admin/Desktop/CuckooTest/Pods/Cuckoo/Generator/Packages/FileKit-4.0.2/Sources/RelativePathType.swift /Users/admin/Desktop/CuckooTest/Pods/Cuckoo/Generator/Packages/FileKit-4.0.2/Sources/String+FileKit.swift /Users/admin/Desktop/CuckooTest/Pods/Cuckoo/Generator/Packages/FileKit-4.0.2/Sources/TextFile.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Swift.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/SwiftOnoneSupport.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Foundation.swiftmodule /Users/admin/Desktop/CuckooTest/Pods/Cuckoo/Generator/.build/debug/CYaml.build/module.modulemap /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Darwin.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Dispatch.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/ObjectiveC.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/CoreGraphics.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/IOKit.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/AppKit.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/CoreData.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/QuartzCore.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/XPC.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/CoreImage.swiftmodule
D
// Copyright Ferdinand Majerech 2014. // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) /// Support for <a href="https://github.com/kiith-sa/despiker">Despiker</a> module tharsis.prof.despikersender; import std.algorithm; import std.array; import std.exception: assumeWontThrow, ErrnoException; import std.string; import tharsis.prof.profiler; /// Exception thrown at DespikerSender errors. class DespikerSenderException : Exception { this(string msg, string file = __FILE__, int line = __LINE__) @safe pure nothrow { super(msg, file, line); } } // TODO: Replace writeln by logger once in Phobos 2014-10-06 /** Sends profiling data recorded by one or more profilers to the Desiker profiler. * * <a href="https://github.com/kiith-sa/despiker">Despiker</a> is a real-time graphical * profiler based on Tharsis.prof. It visualizes zones in frames while the game is running * and allows the user to move between frames and automatically find the worst frame. Note * that at the moment, Despiker is extremely experimental and unstable. * * See <a href="http://defenestrate.eu/docs/despiker/index.html">Despiker * documentation</a> for more info. * * Example: * -------------------- * // Profiler profiler - construct it somewhere first * * auto sender = new DespikerSender([profiler]); * * for(;;) * { * // Despiker will consider code in this zone (named "frame") a part of a single frame. * // Which zone is considered a frame can be changed by setting the * // sender.frameFilter property. * auto frame = Zone(profiler, "frame"); * * ... frame code here, with more zones ... * * if(... condition to start Despiker ...) * { * // Looks in the current directory, directory with the binary/exe and in PATH * // use sender.startDespiker("path/to/despiker") to specify explicit path * sender.startDespiker(); * } * * // No zones must be in progress while sender is being updated, so we end the frame * // early by destroying it. * destroy(frame); * * // Update the sender, send profiling data to Despiker if it is running * sender.update(); * } * -------------------- */ class DespikerSender { /// Maximum number of profilers we can send data from. enum maxProfilers = 1024; private: /* Profilers we're sending data from. * * Despiker assumes that each profiler is used to profile a separate thread * (profilers_[0] - thread 0, profilers_[1] - thread 1, etc.). */ Profiler[] profilers_; import std.process; /* Pipes to send data to the Despiker (when running) along with pid to check its state. * * Reset by reset(). */ ProcessPipes despikerPipes_; /* Storage for bytesSentPerProfiler. * * Using a fixed-size array for simplest/fastest allocation. 8kiB is acceptable but * right at the edge of being acceptable... if we ever increase maxProfilers above * 1024, we should use malloc. */ size_t[1024] bytesSentPerProfilerStorage_; /* Number of bytes of profiling data sent from each profiler in profilers_. * * Reset by reset(). */ size_t[] bytesSentPerProfiler_; // Are we sending data to a running Despiker right now? bool sending_ = false; // Used to determine which zones are frames. DespikerFrameFilter frameFilter_; public: // TODO screenshot of a frame in despiker near 'matching their 'frame' zones' text // 2014-10-08 /** Construct a DespikerSender sending data recorded by specified profilers. * * Despiker will show results from passed profilers side-by-side, matching their * 'frame' zones. To get meaningful results, all profilers should start profiling * at the same time and have one 'frame' zone for each frame of the profiled * game/program. * * The main use of multiple profilers is to profile code in multiple threads * simultaneously. If you don't need this, pass a single profiler. * * Params: * * profilers = Profilers the DespikerSender will send data from. Must not be empty. * Must not have more than 1024 profilers. * * Note: * * At the moment, DespikerSender does not support resetting profilers. Neither of the * passed profilers may be reset() while the DespikerSender is being used. */ this(Profiler[] profilers) @safe pure nothrow @nogc { assert(!profilers.empty, "0 profilers passed to DespikerSender constructor"); assert(profilers.length <= maxProfilers, "Despiker supports at most 1024 profilers at once"); profilers_ = profilers; bytesSentPerProfiler_ = bytesSentPerProfilerStorage_[0 .. profilers.length]; bytesSentPerProfiler_[] = 0; } /// Is there a Despiker instance (that we are sending to) running at the moment? bool sending() @safe pure nothrow const @nogc { return sending_; } /** Set the filter to used by Despiker to determine which zones are frames. * * Affects the following calls to startDespiker(), does not affect the running * Despiker instance, if any. */ void frameFilter(DespikerFrameFilter rhs) @safe pure nothrow @nogc { assert(rhs.info != "NULL", "DespikerFrameFilter.info must not be set to string value \"NULL\""); frameFilter_ = rhs; } /** Open a Despiker window and start sending profiling data to it. * * Can only be called when sending is false (after DespikerSender construction * or reset). * * By default, looks for the Despiker binary in the following order: * * 0: defaultPath, if specified * 1: 'despiker' in current working directory * 2: 'despiker' in directory of the running binary * 3: 'despiker' in PATH * * Note: the next update() call will send all profiling data recorded so far to the * Despiker. * * Throws: * * DespikerSenderException on failure (couldn't find or run Despiker in any of the * searched paths, or couldn't run Despiker with path specified by defaultPath). */ void startDespiker(string defaultPath = null) @safe { assert(!sending_, "Can't startDespiker() while we're already sending to a running Despiker"); string[] errorStrings; // Tries to run Despiker at specified path. Adds a string to errorStrings on failure. bool runDespiker(string path) @trusted nothrow { import std.stdio: StdioException; try { import std.conv: to; // Pass the frame filter through command-line arguments. auto args = [path, "--frameInfo", // "NULL" represents "don't care about frame info" frameFilter_.info is null ? "NULL" : frameFilter_.info, "--frameNestLevel", to!string(frameFilter_.nestLevel)]; despikerPipes_ = pipeProcess(args, Redirect.stdin); sending_ = true; return true; } catch(ProcessException e) { errorStrings ~= e.msg; } catch(StdioException e) { errorStrings ~= e.msg; } catch(Exception e) { assert(false, "Unexpected exception when trying to start Despiker"); } return false; } // Path specified by the user. if(defaultPath !is null && runDespiker(defaultPath)) { return; } import std.file: thisExePath; import std.path: dirName, buildPath; // User didn't specify a path, we have to find Despiker ourselves. // Try current working directory first, then the directory the game binary is // in, then a despiker installation in $PATH auto paths = ["./despiker", thisExePath().dirName.buildPath("despiker"), "despiker"]; foreach(path; paths) if(runDespiker(path)) { return; } throw new DespikerSenderException ("Failed to start Despiker.\n " "Tried to look for it in:\n " ~ defaultPath is null ? "" : "0: path provided by caller: '%s'\n".format(defaultPath) ~ "1: working directory, 2: directory of the running binary, 3: PATH.\n" "Got errors:\n" ~ errorStrings.join("\n")); } /** Resets the sender. * * If Despiker is running, 'forgets' it, stops sending to it without closing it and * the next startDespiker() call will launch a new Despiker instance. */ void reset() @trusted nothrow @nogc { sending_ = false; // Not @nogc yet, although ProcessPipes destruction should not use GC. // Probably don't need to explicitly destroy this here anyway. // destroy(despikerPipes_).assumeWontThrow; bytesSentPerProfiler_[] = 0; } import std.stdio; /** Update the sender. * * Must not be called if any profilers passed to DespikerSender constructor are in a * zone, or are being accessed by other threads (any synchronization must be handled * by the caller). */ void update() @trusted nothrow { assert(!profilers_.canFind!(p => p.zoneNestLevel > 0), "Can't update DespikerSender while one or more profilers are in a zone"); if(!sending_) { return; } // Check if Despiker got closed. try { // tryWait may fail. There is no 'nice' way to handle that. auto status = tryWait(despikerPipes_.pid); if(status.terminated) { // Non-zero status means Despiker had an error. if(status.status != 0) { writeln("Despiker exited (crashed?) with non-zero status: ", status.status) .assumeWontThrow; } reset(); return; } } catch(ProcessException e) { writefln("tryWait failed: %s; assuming Despiker dead", e.msg).assumeWontThrow; reset(); return; } catch(Exception e) { assert(false, "Unexpected exception"); } send().assumeWontThrow; foreach(profiler; profilers_) { profiler.checkpointEvent(); } } private: /** Send profiled data (since the last send()) to Despiker. * * Despite not being nothrow, should never throw. */ void send() @trusted { try foreach(uint threadIdx, profiler; profilers_) { const data = profiler.profileData; const newData = data[bytesSentPerProfiler_[threadIdx] .. $]; import std.array; if(newData.empty) { continue; } const uint bytes = cast(uint)newData.length; // Send a chunk of raw profile data perfixed by a header of two 32-bit uints: // thread index and chunks size in bytes. uint[2] header; header[0] = threadIdx; header[1] = bytes; despikerPipes_.stdin.rawWrite(header[]); despikerPipes_.stdin.rawWrite(newData); // Ensure 'somewhat real-time' sending. despikerPipes_.stdin.flush(); assert(bytesSentPerProfiler_[threadIdx] + newData.length == data.length, "Newly sent data doesn't add up to all recorded data"); bytesSentPerProfiler_[threadIdx] = data.length; } catch(ErrnoException e) { writeln("Failed to send data to despiker: ", e); } catch(Exception e) { writeln("Unhandled exception while sending to despiker: ", e); } } } /** Used to tell Despiker which zones are 'frames'. * * Despiker displays one frame at a time, and it lines up frames from multiple profilers * enable profiling multiple threads. Properties of this struct determine which zones will * be considered frames by Despiker. * * By default, it is enough to use a zone with info string set to "frame" (and to ensure * no other zone uses the same info string). */ struct DespikerFrameFilter { /** Info string of a zone must be equal to this for that zone to be considered a frame. * * If null, zone info does not determine which zones are frames. Must not be set to * string value "NULL". */ string info = "frame"; /** Nest level of a zone must be equal to this for that zone to be considered a frame. * * If 0, zone nest level does not determine which zones are frames. */ ushort nestLevel = 0; }
D
<?xml version="1.0" encoding="ASCII"?> <di:SashWindowsMngr xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:di="http://www.eclipse.org/papyrus/0.7.0/sashdi"> <pageList> <availablePage> <emfPageIdentifier href="model.notation#_2NoqkOhqEeKBB-kCzVtx8w"/> </availablePage> </pageList> <sashModel currentSelection="//@sashModel/@windows.0/@children.0"> <windows> <children xsi:type="di:TabFolder"> <children> <emfPageIdentifier href="model.notation#_2NoqkOhqEeKBB-kCzVtx8w"/> </children> </children> </windows> </sashModel> </di:SashWindowsMngr>
D
module perfontain.meshholder.atlas; import std.range, std.algorithm, perfontain, perfontain.misc.pack; final class AtlasHolderCreator : HolderCreator { this(in MeshInfo[] meshes, ubyte type, ubyte flags = 0) { super(meshes, type, flags); } protected: override void makeData(ref HolderData res) { makeAtlasTexture(res); foreach(ref m; _meshes) with(res) { auto start = cast(uint)data.indices.length; processSubMeshes(data, m); auto sm = HolderSubMesh(cast(uint)data.indices.length - start, start); meshes ~= [ sm ].HolderMesh; } } private: enum ATLAS_PAD = 2; // doubled, so it's 4 void processSubMeshes(ref SubMeshData data, ref in MeshInfo m) { foreach(ref s; m.subs) { auto len = data.indices.length; data.indices ~= s.data.indices; data.indices[len..$][] += cast(uint)data.vertices.length / _vsize; auto vs = s .data .vertices .as!float .chunks(_vsize / 4); foreach(v; vs) { auto c = calcCoords(s.tex, *cast(Vector2 *)&v[$ - 2]); data.vertices ~= v[0..$ - 2].toByte; data.vertices ~= c.toByte; } } } void makeAtlasTexture(ref HolderData f) { Vector2s sz; auto ims = _texIndex.keys; auto rgb = !(_flags & MH_DXT); auto data = new stbrp_rect[ims.length]; { uint sq; auto func = rgb ? (int a) => cast(ushort)a : (int a) => alignTo(cast(ushort)a, 4); foreach(uint i, ref s; data) { s.id = i; s.w = func(ims[i].w + ATLAS_PAD * 2); s.h = func(ims[i].h + ATLAS_PAD * 2); sq += s.w * s.h; } sz = new TexPacker(data).process; log.info(`texture atlas usage is %.4g, size is %ux%u`, sq / float(sz.x * sz.y), sz.x, sz.y); } auto atlas = new Image(sz.x, sz.y, null); foreach(r, im; zip(data, ims.indexed(data.map!(a => a.id)))) { assert(rgb || !(r.x & 3) && !(r.y & 3)); auto u = r.x + ATLAS_PAD, v = r.y + ATLAS_PAD; atlas.blit(im, u, v); // left line ATLAS_PAD.iota.each!(a => atlas.blit(im.copy(0, 0, 1, im.h), r.x + a, v)); // right line iota(r.w - im.w - ATLAS_PAD).each!(a => atlas.blit(im.copy(im.w - 1, 0, 1, im.h), u + im.w + a, v)); // top ATLAS_PAD.iota.each!(a => atlas.blit(atlas.copy(r.x, v, r.w, 1), r.x, r.y + a)); // bottom iota(r.h - im.h - ATLAS_PAD).each!(a => atlas.blit(atlas.copy(r.x, v + im.h - 1, r.w, 1), r.x, v + im.h + a)); Vector4 q; q.x = float(u) / sz.x; q.y = float(v) / sz.y; q.z = float(im.w) / sz.x; q.w = float(im.h) / sz.y; _coords[im] = q; } debug { auto im = atlas.dup; im[].each!((ref a) => a.a = 255); im.saveToFile(`atlas.png`, IM_PNG); } add(f, atlas, false); } auto calcCoords(in Image tex, Vector2 t) { auto v = _coords[tex]; t.x = v.x + v.z * clamp(t.x, 0, 1); t.y = v.y + v.w * clamp(t.y, 0, 1); return t; } Vector4[const Image] _coords; }
D
/** * Compiler implementation of the * $(LINK2 http://www.dlang.org, D programming language). * * Copyright: Copyright (c) 1999-2017 by Digital Mars, All Rights Reserved * Authors: $(LINK2 http://www.digitalmars.com, Walter Bright) * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0) * Source: $(DMDSRC _blockexit.d) */ module ddmd.blockexit; import core.stdc.stdio; import ddmd.arraytypes; import ddmd.canthrow; import ddmd.dclass; import ddmd.declaration; import ddmd.expression; import ddmd.func; import ddmd.globals; import ddmd.id; import ddmd.identifier; import ddmd.mtype; import ddmd.statement; import ddmd.tokens; import ddmd.visitor; /** * BE stands for BlockExit. * * It indicates if a statement does transfer control to another block. * A block is a sequence of statements enclosed in { } */ enum BE : int { BEnone = 0, BEfallthru = 1, BEthrow = 2, BEreturn = 4, BEgoto = 8, BEhalt = 0x10, BEbreak = 0x20, BEcontinue = 0x40, BEerrthrow = 0x80, BEany = (BEfallthru | BEthrow | BEreturn | BEgoto | BEhalt), } alias BEnone = BE.BEnone; alias BEfallthru = BE.BEfallthru; alias BEthrow = BE.BEthrow; alias BEreturn = BE.BEreturn; alias BEgoto = BE.BEgoto; alias BEhalt = BE.BEhalt; alias BEbreak = BE.BEbreak; alias BEcontinue = BE.BEcontinue; alias BEerrthrow = BE.BEerrthrow; alias BEany = BE.BEany; /********************************************* * Only valid after semantic analysis * Params: * mustNotThrow = generate an error if it throws * Returns: * BExxxx */ int blockExit(Statement s, FuncDeclaration func, bool mustNotThrow) { extern (C++) final class BlockExit : Visitor { alias visit = super.visit; public: FuncDeclaration func; bool mustNotThrow; int result; extern (D) this(FuncDeclaration func, bool mustNotThrow) { this.func = func; this.mustNotThrow = mustNotThrow; result = BEnone; } override void visit(Statement s) { printf("Statement::blockExit(%p)\n", s); printf("%s\n", s.toChars()); assert(0); } override void visit(ErrorStatement s) { result = BEany; } override void visit(ExpStatement s) { result = BEfallthru; if (s.exp) { if (s.exp.op == TOKhalt) { result = BEhalt; return; } if (s.exp.op == TOKassert) { AssertExp a = cast(AssertExp)s.exp; if (a.e1.isBool(false)) // if it's an assert(0) { result = BEhalt; return; } } if (canThrow(s.exp, func, mustNotThrow)) result |= BEthrow; } } override void visit(CompileStatement s) { assert(global.errors); result = BEfallthru; } override void visit(CompoundStatement cs) { //printf("CompoundStatement.blockExit(%p) %d result = x%X\n", cs, cs.statements.dim, result); result = BEfallthru; Statement slast = null; foreach (s; *cs.statements) { if (s) { //printf("result = x%x\n", result); //printf("s: %s\n", s.toChars()); if (result & BEfallthru && slast) { slast = slast.last(); if (slast && (slast.isCaseStatement() || slast.isDefaultStatement()) && (s.isCaseStatement() || s.isDefaultStatement())) { // Allow if last case/default was empty CaseStatement sc = slast.isCaseStatement(); DefaultStatement sd = slast.isDefaultStatement(); if (sc && (!sc.statement.hasCode() || sc.statement.isCaseStatement() || sc.statement.isErrorStatement())) { } else if (sd && (!sd.statement.hasCode() || sd.statement.isCaseStatement() || sd.statement.isErrorStatement())) { } else { const(char)* gototype = s.isCaseStatement() ? "case" : "default"; s.deprecation("switch case fallthrough - use 'goto %s;' if intended", gototype); } } } if (!(result & BEfallthru) && !s.comeFrom()) { if (blockExit(s, func, mustNotThrow) != BEhalt && s.hasCode()) s.warning("statement is not reachable"); } else { result &= ~BEfallthru; result |= blockExit(s, func, mustNotThrow); } slast = s; } } } override void visit(UnrolledLoopStatement uls) { result = BEfallthru; foreach (s; *uls.statements) { if (s) { int r = blockExit(s, func, mustNotThrow); result |= r & ~(BEbreak | BEcontinue | BEfallthru); if ((r & (BEfallthru | BEcontinue | BEbreak)) == 0) result &= ~BEfallthru; } } } override void visit(ScopeStatement s) { //printf("ScopeStatement::blockExit(%p)\n", s.statement); result = blockExit(s.statement, func, mustNotThrow); } override void visit(ForwardingStatement s) { if (s.statement) { s.statement.accept(this); } else { result = BEfallthru; } } override void visit(WhileStatement s) { assert(global.errors); result = BEfallthru; } override void visit(DoStatement s) { if (s._body) { result = blockExit(s._body, func, mustNotThrow); if (result == BEbreak) { result = BEfallthru; return; } if (result & BEcontinue) result |= BEfallthru; } else result = BEfallthru; if (result & BEfallthru) { if (canThrow(s.condition, func, mustNotThrow)) result |= BEthrow; if (!(result & BEbreak) && s.condition.isBool(true)) result &= ~BEfallthru; } result &= ~(BEbreak | BEcontinue); } override void visit(ForStatement s) { result = BEfallthru; if (s._init) { result = blockExit(s._init, func, mustNotThrow); if (!(result & BEfallthru)) return; } if (s.condition) { if (canThrow(s.condition, func, mustNotThrow)) result |= BEthrow; if (s.condition.isBool(true)) result &= ~BEfallthru; else if (s.condition.isBool(false)) return; } else result &= ~BEfallthru; // the body must do the exiting if (s._body) { int r = blockExit(s._body, func, mustNotThrow); if (r & (BEbreak | BEgoto)) result |= BEfallthru; result |= r & ~(BEfallthru | BEbreak | BEcontinue); } if (s.increment && canThrow(s.increment, func, mustNotThrow)) result |= BEthrow; } override void visit(ForeachStatement s) { result = BEfallthru; if (canThrow(s.aggr, func, mustNotThrow)) result |= BEthrow; if (s._body) result |= blockExit(s._body, func, mustNotThrow) & ~(BEbreak | BEcontinue); } override void visit(ForeachRangeStatement s) { assert(global.errors); result = BEfallthru; } override void visit(IfStatement s) { //printf("IfStatement::blockExit(%p)\n", s); result = BEnone; if (canThrow(s.condition, func, mustNotThrow)) result |= BEthrow; if (s.condition.isBool(true)) { result |= blockExit(s.ifbody, func, mustNotThrow); } else if (s.condition.isBool(false)) { result |= blockExit(s.elsebody, func, mustNotThrow); } else { result |= blockExit(s.ifbody, func, mustNotThrow); result |= blockExit(s.elsebody, func, mustNotThrow); } //printf("IfStatement::blockExit(%p) = x%x\n", s, result); } override void visit(ConditionalStatement s) { result = blockExit(s.ifbody, func, mustNotThrow); if (s.elsebody) result |= blockExit(s.elsebody, func, mustNotThrow); } override void visit(PragmaStatement s) { result = BEfallthru; } override void visit(StaticAssertStatement s) { result = BEfallthru; } override void visit(SwitchStatement s) { result = BEnone; if (canThrow(s.condition, func, mustNotThrow)) result |= BEthrow; if (s._body) { result |= blockExit(s._body, func, mustNotThrow); if (result & BEbreak) { result |= BEfallthru; result &= ~BEbreak; } } else result |= BEfallthru; } override void visit(CaseStatement s) { result = blockExit(s.statement, func, mustNotThrow); } override void visit(DefaultStatement s) { result = blockExit(s.statement, func, mustNotThrow); } override void visit(GotoDefaultStatement s) { result = BEgoto; } override void visit(GotoCaseStatement s) { result = BEgoto; } override void visit(SwitchErrorStatement s) { // Switch errors are non-recoverable result = BEhalt; } override void visit(ReturnStatement s) { result = BEreturn; if (s.exp && canThrow(s.exp, func, mustNotThrow)) result |= BEthrow; } override void visit(BreakStatement s) { //printf("BreakStatement::blockExit(%p) = x%x\n", s, s.ident ? BEgoto : BEbreak); result = s.ident ? BEgoto : BEbreak; } override void visit(ContinueStatement s) { result = s.ident ? BEgoto : BEcontinue; } override void visit(SynchronizedStatement s) { result = blockExit(s._body, func, mustNotThrow); } override void visit(WithStatement s) { result = BEnone; if (canThrow(s.exp, func, mustNotThrow)) result = BEthrow; result |= blockExit(s._body, func, mustNotThrow); } override void visit(TryCatchStatement s) { assert(s._body); result = blockExit(s._body, func, false); int catchresult = 0; foreach (c; *s.catches) { if (c.type == Type.terror) continue; int cresult = blockExit(c.handler, func, mustNotThrow); /* If we're catching Object, then there is no throwing */ Identifier id = c.type.toBasetype().isClassHandle().ident; if (c.internalCatch && (cresult & BEfallthru)) { // https://issues.dlang.org/show_bug.cgi?id=11542 // leave blockExit flags of the body cresult &= ~BEfallthru; } else if (id == Id.Object || id == Id.Throwable) { result &= ~(BEthrow | BEerrthrow); } else if (id == Id.Exception) { result &= ~BEthrow; } catchresult |= cresult; } if (mustNotThrow && (result & BEthrow)) { // now explain why this is nothrow blockExit(s._body, func, mustNotThrow); } result |= catchresult; } override void visit(TryFinallyStatement s) { result = BEfallthru; if (s._body) result = blockExit(s._body, func, false); // check finally body as well, it may throw (bug #4082) int finalresult = BEfallthru; if (s.finalbody) finalresult = blockExit(s.finalbody, func, false); // If either body or finalbody halts if (result == BEhalt) finalresult = BEnone; if (finalresult == BEhalt) result = BEnone; if (mustNotThrow) { // now explain why this is nothrow if (s._body && (result & BEthrow)) blockExit(s._body, func, mustNotThrow); if (s.finalbody && (finalresult & BEthrow)) blockExit(s.finalbody, func, mustNotThrow); } version (none) { // https://issues.dlang.org/show_bug.cgi?id=13201 // Mask to prevent spurious warnings for // destructor call, exit of synchronized statement, etc. if (result == BEhalt && finalresult != BEhalt && s.finalbody && s.finalbody.hasCode()) { s.finalbody.warning("statement is not reachable"); } } if (!(finalresult & BEfallthru)) result &= ~BEfallthru; result |= finalresult & ~BEfallthru; } override void visit(OnScopeStatement s) { // At this point, this statement is just an empty placeholder result = BEfallthru; } override void visit(ThrowStatement s) { if (s.internalThrow) { // https://issues.dlang.org/show_bug.cgi?id=8675 // Allow throwing 'Throwable' object even if mustNotThrow. result = BEfallthru; return; } Type t = s.exp.type.toBasetype(); ClassDeclaration cd = t.isClassHandle(); assert(cd); if (cd == ClassDeclaration.errorException || ClassDeclaration.errorException.isBaseOf(cd, null)) { result = BEerrthrow; return; } if (mustNotThrow) s.error("`%s` is thrown but not caught", s.exp.type.toChars()); result = BEthrow; } override void visit(GotoStatement s) { //printf("GotoStatement::blockExit(%p)\n", s); result = BEgoto; } override void visit(LabelStatement s) { //printf("LabelStatement::blockExit(%p)\n", s); result = blockExit(s.statement, func, mustNotThrow); if (s.breaks) result |= BEfallthru; } override void visit(CompoundAsmStatement s) { if (mustNotThrow && !(s.stc & STCnothrow)) s.deprecation("asm statement is assumed to throw - mark it with `nothrow` if it does not"); // Assume the worst result = BEfallthru | BEreturn | BEgoto | BEhalt; if (!(s.stc & STCnothrow)) result |= BEthrow; } override void visit(ImportStatement s) { result = BEfallthru; } } if (!s) return BEfallthru; scope BlockExit be = new BlockExit(func, mustNotThrow); s.accept(be); return be.result; }
D
/* TEST_OUTPUT: --- fail_compilation/fail150.d(22): Error: e.new is only for allocating nested classes --- */ //import std.stdio; class Class1 { } class Foo { } int main(char[][] argv) { Class1 myclass = new Class1; myclass.new Foo(); return 0; }
D
/** * @author Lee Avital * * Holds the board class, which represents a scrabble board */ module Board; import std.stdio; import std.format; import std.array; import position; // internal representation of multiplier enum Multiplier{ DOUBLE_WORD, DOUBLE_LETTER, TRIPLE_WORD, TRIPLE_LETTER, NO_MULTIPLIER } /** * Represents a scrabble board */ class Board{ private char[26][26] board; private Multiplier[26][26] multipliers; this(){ // fill up the board with blank spaces for( auto i = 0; i < 26; i++){ for( auto j = 0; j < 26; j++){ board[i][j] = ' '; } } // initialize the multipliers for( int i = 0; i < 26 * 26; i++){ multipliers[ i / 26 ][ i % 26 ] = Multiplier.NO_MULTIPLIER; } } /** * allow a board to be accessed with the index operator */ const char opIndex( int i, int j ){ return board[i][j]; } /** * allow the board to be accessed with a Position */ const char opIndex( const Position p ){ return board[ p.x ][ p.y ]; } /** * allow the board to be index assigned */ void opIndexAssign( char c, int i, int j){ //writefln("assigning %d %d as %c", i, j, c ); // once we place a piece, it no longer has a multiplier effect multipliers[i][j] = Multiplier.NO_MULTIPLIER; board[i][j] = c; } /** * print out the board */ override string toString(){ auto writer = appender!string(); formattedWrite( writer, "---" ); for(int i = 0; i < 26; i++){ formattedWrite( writer, "%-2d ", i ); } formattedWrite( writer, "\n" ); for( auto y = 0; y < 26; y++ ){ formattedWrite( writer, "%-3d", y ); for( int x = 0; x < 26; x++){ auto thechar = board[x][y]; if(thechar == ' '){ thechar = '-'; } formattedWrite( writer, "%c ", thechar ); } formattedWrite( writer, "\n" ); } return writer.data; } const int getWordMultiplier( Position p ){ return getWordMultiplier( p.x, p.y ); } const int getWordMultiplier(int x, int y) { auto mult = multipliers[x][y]; if( mult == Multiplier.DOUBLE_WORD ){ return 2; }else if( mult == Multiplier.TRIPLE_WORD ){ return 3; }else{ return 1; } } const int getLetterMultiplier( Position p ){ return getLetterMultiplier( p.x, p.y ); } const int getLetterMultiplier( int x, int y ){ auto mult = multipliers[x][y]; if( mult == Multiplier.DOUBLE_LETTER){ return 2; }else if( mult == Multiplier.TRIPLE_LETTER ){ return 3; }else{ return 1; } } } unittest{ auto b = new Board; b[0, 5] = 'J'; assert( b[0, 5] == 'J', "failed index test" ); writeln("finished unittest 1 for board"); }
D
#!/usr/bin/env dub /+ dub.sdl: name "t0" dflags "-I../source" dflags "-debug" dependency "hio" version="*" +/ // cd to tests and run with "dub run --single t0.d" import std.datetime; import std.stdio; import std.experimental.logger; import core.sys.posix.signal; import core.memory; import core.thread; import hio.scheduler; import hio.socket; import hio.events; import hio.loop; static bool server_active; void client() { hlSleep(500.msecs); while (server_active) { auto s = new HioSocket(); info("Connecting"); s.connect("127.0.0.1:9999", 1.seconds); if (s.connected()) { info("Connected"); } else { infof("Failed to connect: %d", s.errno()); } hlSleep(100.msecs); s.close(); } } void server() { auto s = new HioSocket(); scope (exit) { //s.close(); } auto started = Clock.currTime; try { s.bind("0.0.0.0:9999"); } catch (Throwable t) { error(t); return; } infof("server bind ok"); s.listen(); server_active = true; while (Clock.currTime < started + 10.seconds) { auto new_socket = s.accept(); infof("using accepted socket %s", new_socket); new_socket.close(); //info("next loop"); new_socket = null; } server_active = false; s.close(); } void job() { SigHandlerDelegate sigint = delegate void(int signum) { info("signal"); getDefaultLoop().stop(); }; auto sighandler = new Signal(SIGINT, sigint); getDefaultLoop().startSignal(sighandler); auto s = task(&server); auto clients = [task(&client), task(&client)]; s.start; foreach(c; clients) { c.start(); } s.wait(); info("server done"); foreach (c; clients) { c.wait(); info("client done"); } } void main() { globalLogLevel = LogLevel.info; ignoreSignal(SIGINT); App(&job); }
D
/** * Compiler implementation of the * $(LINK2 http://www.dlang.org, D programming language). * * Copyright: Copyright (c) 1999-2017 by Digital Mars, All Rights Reserved * Authors: $(LINK2 http://www.digitalmars.com, Walter Bright) * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0) * Source: $(LINK2 https://github.com/dlang/dmd/blob/master/src/ddmd/escape.d, _escape.d) */ module ddmd.escape; // Online documentation: https://dlang.org/phobos/ddmd_escape.html import core.stdc.stdio : printf; import ddmd.aggregate; import ddmd.declaration; import ddmd.dscope; import ddmd.dsymbol; import ddmd.errors; import ddmd.expression; import ddmd.func; import ddmd.globals; import ddmd.identifier; import ddmd.init; import ddmd.mtype; import ddmd.root.rootobject; import ddmd.tokens; import ddmd.visitor; import ddmd.arraytypes; /**************************************** * Function parameter par is being initialized to arg, * and par may escape. * Detect if scoped values can escape this way. * Print error messages when these are detected. * Params: * sc = used to determine current function and module * par = identifier of function parameter * arg = initializer for param * gag = do not print error messages * Returns: * true if pointers to the stack can escape via assignment */ bool checkParamArgumentEscape(Scope* sc, FuncDeclaration fdc, Identifier par, Expression arg, bool gag) { //printf("checkParamArgumentEscape(arg: %s par: %s)\n", arg.toChars(), par.toChars()); //printf("type = %s, %d\n", arg.type.toChars(), arg.type.hasPointers()); if (!arg.type.hasPointers()) return false; EscapeByResults er; escapeByValue(arg, &er); if (!er.byref.dim && !er.byvalue.dim && !er.byfunc.dim && !er.byexp.dim) return false; bool result = false; /* 'v' is assigned unsafely to 'par' */ void unsafeAssign(VarDeclaration v, const char* desc) { if (global.params.vsafe && sc.func.setUnsafe()) { if (!gag) error(arg.loc, "%s `%s` assigned to non-scope parameter `%s` calling %s", desc, v.toChars(), par ? par.toChars() : "unnamed", fdc ? fdc.toPrettyChars() : "indirectly"); result = true; } } foreach (VarDeclaration v; er.byvalue) { //printf("byvalue %s\n", v.toChars()); if (v.isDataseg()) continue; Dsymbol p = v.toParent2(); v.storage_class &= ~STCmaybescope; if (v.isScope()) { unsafeAssign(v, "scope variable"); } else if (v.storage_class & STCvariadic && p == sc.func) { Type tb = v.type.toBasetype(); if (tb.ty == Tarray || tb.ty == Tsarray) { unsafeAssign(v, "variadic variable"); } } else { /* v is not 'scope', and is assigned to a parameter that may escape. * Therefore, v can never be 'scope'. */ v.doNotInferScope = true; } } foreach (VarDeclaration v; er.byref) { if (v.isDataseg()) continue; Dsymbol p = v.toParent2(); v.storage_class &= ~STCmaybescope; if ((v.storage_class & (STCref | STCout)) == 0 && p == sc.func) { unsafeAssign(v, "reference to local variable"); continue; } } foreach (FuncDeclaration fd; er.byfunc) { //printf("fd = %s, %d\n", fd.toChars(), fd.tookAddressOf); VarDeclarations vars; findAllOuterAccessedVariables(fd, &vars); foreach (v; vars) { //printf("v = %s\n", v.toChars()); assert(!v.isDataseg()); // these are not put in the closureVars[] Dsymbol p = v.toParent2(); v.storage_class &= ~STCmaybescope; if ((v.storage_class & (STCref | STCout | STCscope)) && p == sc.func) { unsafeAssign(v, "reference to local"); continue; } } } foreach (Expression ee; er.byexp) { if (sc.func.setUnsafe()) { if (!gag) error(ee.loc, "reference to stack allocated value returned by `%s` assigned to non-scope parameter `%s`", ee.toChars(), par ? par.toChars() : "unnamed"); result = true; } } return result; } /**************************************** * Given an AssignExp, determine if the lvalue will cause * the contents of the rvalue to escape. * Print error messages when these are detected. * Infer 'scope' for the lvalue where possible, in order * to eliminate the error. * Params: * sc = used to determine current function and module * ae = AssignExp to check for any pointers to the stack * gag = do not print error messages * Returns: * true if pointers to the stack can escape via assignment */ bool checkAssignEscape(Scope* sc, Expression e, bool gag) { //printf("checkAssignEscape(e: %s)\n", e.toChars()); if (e.op != TOKassign && e.op != TOKblit && e.op != TOKconstruct) return false; auto ae = cast(AssignExp)e; Expression e1 = ae.e1; Expression e2 = ae.e2; //printf("type = %s, %d\n", e1.type.toChars(), e1.type.hasPointers()); if (!e1.type.hasPointers()) return false; if (e1.op == TOKslice) return false; EscapeByResults er; escapeByValue(e2, &er); if (!er.byref.dim && !er.byvalue.dim && !er.byfunc.dim && !er.byexp.dim) return false; VarDeclaration va; while (e1.op == TOKdotvar) e1 = (cast(DotVarExp)e1).e1; if (e1.op == TOKvar) va = (cast(VarExp)e1).var.isVarDeclaration(); else if (e1.op == TOKthis) va = (cast(ThisExp)e1).var.isVarDeclaration(); else if (e1.op == TOKindex) { auto ie = cast(IndexExp)e1; if (ie.e1.op == TOKvar && ie.e1.type.toBasetype().ty == Tsarray) va = (cast(VarExp)ie.e1).var.isVarDeclaration(); } // Try to infer 'scope' for va if in a function not marked @system bool inferScope = false; if (va && sc.func && sc.func.type && sc.func.type.ty == Tfunction) inferScope = (cast(TypeFunction)sc.func.type).trust != TRUSTsystem; bool result = false; foreach (VarDeclaration v; er.byvalue) { //printf("byvalue: %s\n", v.toChars()); if (v.isDataseg()) continue; if (v == va) continue; Dsymbol p = v.toParent2(); if (!(va && va.isScope())) v.storage_class &= ~STCmaybescope; if (v.isScope()) { if (va && va.isScope() && va.storage_class & STCreturn && !(v.storage_class & STCreturn) && sc.func.setUnsafe()) { if (!gag) error(ae.loc, "scope variable `%s` assigned to return scope `%s`", v.toChars(), va.toChars()); result = true; continue; } // If va's lifetime encloses v's, then error if (va && (va.enclosesLifetimeOf(v) && !(v.storage_class & STCparameter) || // va is class reference ae.e1.op == TOKdotvar && va.type.toBasetype().ty == Tclass && (va.enclosesLifetimeOf(v) || !va.isScope) || va.storage_class & STCref) && sc.func.setUnsafe()) { if (!gag) error(ae.loc, "scope variable `%s` assigned to `%s` with longer lifetime", v.toChars(), va.toChars()); result = true; continue; } if (va && !va.isDataseg() && !va.doNotInferScope) { if (!va.isScope() && inferScope) { //printf("inferring scope for %s\n", va.toChars()); va.storage_class |= STCscope | STCscopeinferred; va.storage_class |= v.storage_class & STCreturn; } continue; } if (sc.func.setUnsafe()) { if (!gag) error(ae.loc, "scope variable `%s` assigned to non-scope `%s`", v.toChars(), e1.toChars()); result = true; } } else if (v.storage_class & STCvariadic && p == sc.func) { Type tb = v.type.toBasetype(); if (tb.ty == Tarray || tb.ty == Tsarray) { if (va && !va.isDataseg() && !va.doNotInferScope) { if (!va.isScope() && inferScope) { //printf("inferring scope for %s\n", va.toChars()); va.storage_class |= STCscope | STCscopeinferred; } continue; } if (sc.func.setUnsafe()) { if (!gag) error(ae.loc, "variadic variable `%s` assigned to non-scope `%s`", v.toChars(), e1.toChars()); result = true; } } } else { /* v is not 'scope', and we didn't check the scope of where we assigned it to. * It may escape via that assignment, therefore, v can never be 'scope'. */ v.doNotInferScope = true; } } foreach (VarDeclaration v; er.byref) { //printf("byref: %s\n", v.toChars()); if (v.isDataseg()) continue; Dsymbol p = v.toParent2(); // If va's lifetime encloses v's, then error if (va && (va.enclosesLifetimeOf(v) && !(v.storage_class & STCparameter) || va.storage_class & STCref) && sc.func.setUnsafe()) { if (!gag) error(ae.loc, "address of variable `%s` assigned to `%s` with longer lifetime", v.toChars(), va.toChars()); result = true; continue; } if (!(va && va.isScope())) v.storage_class &= ~STCmaybescope; if ((v.storage_class & (STCref | STCout)) == 0 && p == sc.func) { if (va && !va.isDataseg() && !va.doNotInferScope) { if (!va.isScope() && inferScope) { //printf("inferring scope for %s\n", va.toChars()); va.storage_class |= STCscope | STCscopeinferred; } continue; } if (sc.func.setUnsafe()) { if (!gag) error(ae.loc, "reference to local variable `%s` assigned to non-scope `%s`", v.toChars(), e1.toChars()); result = true; } continue; } } foreach (FuncDeclaration fd; er.byfunc) { //printf("fd = %s, %d\n", fd.toChars(), fd.tookAddressOf); VarDeclarations vars; findAllOuterAccessedVariables(fd, &vars); foreach (v; vars) { //printf("v = %s\n", v.toChars()); assert(!v.isDataseg()); // these are not put in the closureVars[] Dsymbol p = v.toParent2(); if (!(va && va.isScope())) v.storage_class &= ~STCmaybescope; if ((v.storage_class & (STCref | STCout | STCscope)) && p == sc.func) { if (va && !va.isDataseg() && !va.doNotInferScope) { /* Don't infer STCscope for va, because then a closure * won't be generated for sc.func. */ //if (!va.isScope() && inferScope) //va.storage_class |= STCscope | STCscopeinferred; continue; } if (sc.func.setUnsafe()) { if (!gag) error(ae.loc, "reference to local `%s` assigned to non-scope `%s` in @safe code", v.toChars(), e1.toChars()); result = true; } continue; } } } foreach (Expression ee; er.byexp) { if (va && !va.isDataseg() && !va.doNotInferScope) { if (!va.isScope() && inferScope) { //printf("inferring scope for %s\n", va.toChars()); va.storage_class |= STCscope | STCscopeinferred; } continue; } if (sc.func.setUnsafe()) { if (!gag) error(ee.loc, "reference to stack allocated value returned by `%s` assigned to non-scope `%s`", ee.toChars(), e1.toChars()); result = true; } } return result; } /************************************ * Detect cases where pointers to the stack can 'escape' the * lifetime of the stack frame when throwing `e`. * Print error messages when these are detected. * Params: * sc = used to determine current function and module * e = expression to check for any pointers to the stack * gag = do not print error messages * Returns: * true if pointers to the stack can escape */ bool checkThrowEscape(Scope* sc, Expression e, bool gag) { //printf("[%s] checkThrowEscape, e = %s\n", e.loc.toChars(), e.toChars()); EscapeByResults er; escapeByValue(e, &er); if (!er.byref.dim && !er.byvalue.dim && !er.byexp.dim) return false; bool result = false; foreach (VarDeclaration v; er.byvalue) { //printf("byvalue %s\n", v.toChars()); if (v.isDataseg()) continue; Dsymbol p = v.toParent2(); if (v.isScope()) { if (sc._module && sc._module.isRoot()) { // Only look for errors if in module listed on command line if (global.params.vsafe) // https://issues.dlang.org/show_bug.cgi?id=17029 { if (!gag) error(e.loc, "scope variable `%s` may not be thrown", v.toChars()); result = true; } continue; } } else { //printf("no infer for %s\n", v.toChars()); v.doNotInferScope = true; } } return result; } /************************************ * Detect cases where pointers to the stack can 'escape' the * lifetime of the stack frame by returning 'e' by value. * Print error messages when these are detected. * Params: * sc = used to determine current function and module * e = expression to check for any pointers to the stack * gag = do not print error messages * Returns: * true if pointers to the stack can escape */ bool checkReturnEscape(Scope* sc, Expression e, bool gag) { //printf("[%s] checkReturnEscape, e = %s\n", e.loc.toChars(), e.toChars()); return checkReturnEscapeImpl(sc, e, false, gag); } /************************************ * Detect cases where returning 'e' by ref can result in a reference to the stack * being returned. * Print error messages when these are detected. * Params: * sc = used to determine current function and module * e = expression to check * gag = do not print error messages * Returns: * true if references to the stack can escape */ bool checkReturnEscapeRef(Scope* sc, Expression e, bool gag) { version (none) { printf("[%s] checkReturnEscapeRef, e = %s\n", e.loc.toChars(), e.toChars()); printf("current function %s\n", sc.func.toChars()); printf("parent2 function %s\n", sc.func.toParent2().toChars()); } return checkReturnEscapeImpl(sc, e, true, gag); } private bool checkReturnEscapeImpl(Scope* sc, Expression e, bool refs, bool gag) { //printf("[%s] checkReturnEscapeImpl, e: `%s`\n", e.loc.toChars(), e.toChars()); EscapeByResults er; if (refs) escapeByRef(e, &er); else escapeByValue(e, &er); if (!er.byref.dim && !er.byvalue.dim && !er.byexp.dim) return false; bool result = false; foreach (VarDeclaration v; er.byvalue) { //printf("byvalue `%s`\n", v.toChars()); if (v.isDataseg()) continue; Dsymbol p = v.toParent2(); if ((v.isScope() || (v.storage_class & STCmaybescope)) && !(v.storage_class & STCreturn) && v.isParameter() && sc.func.flags & FUNCFLAGreturnInprocess && p == sc.func) { inferReturn(sc.func, v); // infer addition of 'return' continue; } if (v.isScope()) { if (v.storage_class & STCreturn) continue; if (sc._module && sc._module.isRoot() && /* This case comes up when the ReturnStatement of a __foreachbody is * checked for escapes by the caller of __foreachbody. Skip it. * * struct S { static int opApply(int delegate(S*) dg); } * S* foo() { * foreach (S* s; S) // create __foreachbody for body of foreach * return s; // s is inferred as 'scope' but incorrectly tested in foo() * return null; } */ !(!refs && p.parent == sc.func)) { // Only look for errors if in module listed on command line if (global.params.vsafe) // https://issues.dlang.org/show_bug.cgi?id=17029 { if (!gag) error(e.loc, "scope variable `%s` may not be returned", v.toChars()); result = true; } continue; } } else if (v.storage_class & STCvariadic && p == sc.func) { Type tb = v.type.toBasetype(); if (tb.ty == Tarray || tb.ty == Tsarray) { if (!gag) error(e.loc, "returning `%s` escapes a reference to variadic parameter `%s`", e.toChars(), v.toChars()); result = false; } } else { //printf("no infer for %s\n", v.toChars()); v.doNotInferScope = true; } } foreach (VarDeclaration v; er.byref) { //printf("byref `%s`\n", v.toChars()); void escapingRef(VarDeclaration v) { if (!gag) { const(char)* msg; if (v.storage_class & STCparameter) msg = "returning `%s` escapes a reference to parameter `%s`, perhaps annotate with `return`"; else msg = "returning `%s` escapes a reference to local variable `%s`"; error(e.loc, msg, e.toChars(), v.toChars()); } result = true; } if (v.isDataseg()) continue; Dsymbol p = v.toParent2(); if ((v.storage_class & (STCref | STCout)) == 0) { if (p == sc.func) { escapingRef(v); continue; } FuncDeclaration fd = p.isFuncDeclaration(); if (fd && sc.func.flags & FUNCFLAGreturnInprocess) { /* Code like: * int x; * auto dg = () { return &x; } * Making it: * auto dg = () return { return &x; } * Because dg.ptr points to x, this is returning dt.ptr+offset */ if (global.params.vsafe) sc.func.storage_class |= STCreturn; } } /* Check for returning a ref variable by 'ref', but should be 'return ref' * Infer the addition of 'return', or set result to be the offending expression. */ if ( (v.storage_class & (STCref | STCout)) && !(v.storage_class & (STCreturn | STCforeach))) { if (sc.func.flags & FUNCFLAGreturnInprocess && p == sc.func) { inferReturn(sc.func, v); // infer addition of 'return' } else if (global.params.useDIP25 && sc._module && sc._module.isRoot()) { // Only look for errors if in module listed on command line if (p == sc.func) { //printf("escaping reference to local ref variable %s\n", v.toChars()); //printf("storage class = x%llx\n", v.storage_class); escapingRef(v); continue; } // Don't need to be concerned if v's parent does not return a ref FuncDeclaration fd = p.isFuncDeclaration(); if (fd && fd.type && fd.type.ty == Tfunction) { TypeFunction tf = cast(TypeFunction)fd.type; if (tf.isref) { if (!gag) error(e.loc, "escaping reference to outer local variable `%s`", v.toChars()); result = true; continue; } } } } } foreach (Expression ee; er.byexp) { //printf("byexp %s\n", ee.toChars()); if (!gag) error(ee.loc, "escaping reference to stack allocated value returned by `%s`", ee.toChars()); result = true; } return result; } /************************************* * Variable v needs to have 'return' inferred for it. * Params: * fd = function that v is a parameter to * v = parameter that needs to be STCreturn */ private void inferReturn(FuncDeclaration fd, VarDeclaration v) { // v is a local in the current function //printf("for function '%s' inferring 'return' for variable '%s'\n", fd.toChars(), v.toChars()); v.storage_class |= STCreturn; TypeFunction tf = cast(TypeFunction)fd.type; if (v == fd.vthis) { /* v is the 'this' reference, so mark the function */ fd.storage_class |= STCreturn; if (tf.ty == Tfunction) { //printf("'this' too %p %s\n", tf, sc.func.toChars()); tf.isreturn = true; } } else { // Perform 'return' inference on parameter if (tf.ty == Tfunction && tf.parameters) { const dim = Parameter.dim(tf.parameters); foreach (const i; 0 .. dim) { Parameter p = Parameter.getNth(tf.parameters, i); if (p.ident == v.ident) { p.storageClass |= STCreturn; break; // there can be only one } } } } } /**************************************** * e is an expression to be returned by value, and that value contains pointers. * Walk e to determine which variables are possibly being * returned by value, such as: * int* function(int* p) { return p; } * If e is a form of &p, determine which variables have content * which is being returned as ref, such as: * int* function(int i) { return &i; } * Multiple variables can be inserted, because of expressions like this: * int function(bool b, int i, int* p) { return b ? &i : p; } * * No side effects. * * Params: * e = expression to be returned by value * er = where to place collected data */ private void escapeByValue(Expression e, EscapeByResults* er) { //printf("[%s] escapeByValue, e: %s\n", e.loc.toChars(), e.toChars()); extern (C++) final class EscapeVisitor : Visitor { alias visit = super.visit; public: EscapeByResults* er; extern (D) this(EscapeByResults* er) { this.er = er; } override void visit(Expression e) { } override void visit(AddrExp e) { escapeByRef(e.e1, er); } override void visit(SymOffExp e) { VarDeclaration v = e.var.isVarDeclaration(); if (v) er.byref.push(v); } override void visit(VarExp e) { VarDeclaration v = e.var.isVarDeclaration(); if (v) er.byvalue.push(v); } override void visit(ThisExp e) { if (e.var) er.byvalue.push(e.var); } override void visit(DotVarExp e) { auto t = e.e1.type.toBasetype(); if (t.ty == Tstruct) e.e1.accept(this); } override void visit(DelegateExp e) { Type t = e.e1.type.toBasetype(); if (t.ty == Tclass || t.ty == Tpointer) escapeByValue(e.e1, er); else escapeByRef(e.e1, er); er.byfunc.push(e.func); } override void visit(FuncExp e) { if (e.fd.tok == TOKdelegate) er.byfunc.push(e.fd); } override void visit(TupleExp e) { assert(0); // should have been lowered by now } override void visit(ArrayLiteralExp e) { Type tb = e.type.toBasetype(); if (tb.ty == Tsarray || tb.ty == Tarray) { if (e.basis) e.basis.accept(this); foreach (el; *e.elements) { if (el) el.accept(this); } } } override void visit(StructLiteralExp e) { if (e.elements) { foreach (ex; *e.elements) { if (ex) ex.accept(this); } } } override void visit(NewExp e) { Type tb = e.newtype.toBasetype(); if (tb.ty == Tstruct && !e.member && e.arguments) { foreach (ex; *e.arguments) { if (ex) ex.accept(this); } } } override void visit(CastExp e) { Type tb = e.type.toBasetype(); if (tb.ty == Tarray && e.e1.type.toBasetype().ty == Tsarray) { escapeByRef(e.e1, er); } else e.e1.accept(this); } override void visit(SliceExp e) { if (e.e1.op == TOKvar) { VarDeclaration v = (cast(VarExp)e.e1).var.isVarDeclaration(); Type tb = e.type.toBasetype(); if (v) { if (tb.ty == Tsarray) return; if (v.storage_class & STCvariadic) { er.byvalue.push(v); return; } } } Type t1b = e.e1.type.toBasetype(); if (t1b.ty == Tsarray) { Type tb = e.type.toBasetype(); if (tb.ty != Tsarray) escapeByRef(e.e1, er); } else e.e1.accept(this); } override void visit(BinExp e) { Type tb = e.type.toBasetype(); if (tb.ty == Tpointer) { e.e1.accept(this); e.e2.accept(this); } } override void visit(BinAssignExp e) { e.e1.accept(this); } override void visit(AssignExp e) { e.e1.accept(this); } override void visit(CommaExp e) { e.e2.accept(this); } override void visit(CondExp e) { e.e1.accept(this); e.e2.accept(this); } override void visit(CallExp e) { //printf("CallExp(): %s\n", e.toChars()); /* Check each argument that is * passed as 'return scope'. */ Type t1 = e.e1.type.toBasetype(); TypeFunction tf; TypeDelegate dg; if (t1.ty == Tdelegate) { dg = cast(TypeDelegate)t1; tf = cast(TypeFunction)(cast(TypeDelegate)t1).next; } else if (t1.ty == Tfunction) tf = cast(TypeFunction)t1; else return; if (e.arguments && e.arguments.dim) { /* j=1 if _arguments[] is first argument, * skip it because it is not passed by ref */ int j = (tf.linkage == LINKd && tf.varargs == 1); for (size_t i = j; i < e.arguments.dim; ++i) { Expression arg = (*e.arguments)[i]; size_t nparams = Parameter.dim(tf.parameters); if (i - j < nparams && i >= j) { Parameter p = Parameter.getNth(tf.parameters, i - j); const stc = tf.parameterStorageClass(p); if ((stc & (STCscope)) && (stc & STCreturn)) arg.accept(this); else if ((stc & (STCref)) && (stc & STCreturn)) escapeByRef(arg, er); } } } // If 'this' is returned, check it too if (e.e1.op == TOKdotvar && t1.ty == Tfunction) { DotVarExp dve = cast(DotVarExp)e.e1; FuncDeclaration fd = dve.var.isFuncDeclaration(); AggregateDeclaration ad; if (global.params.vsafe && tf.isreturn && fd && (ad = fd.isThis()) !is null) { if (ad.isClassDeclaration() || tf.isscope) // this is 'return scope' dve.e1.accept(this); else if (ad.isStructDeclaration()) // this is 'return ref' escapeByRef(dve.e1, er); } else if (dve.var.storage_class & STCreturn || tf.isreturn) { if (dve.var.storage_class & STCscope) dve.e1.accept(this); else if (dve.var.storage_class & STCref) escapeByRef(dve.e1, er); } } /* If returning the result of a delegate call, the .ptr * field of the delegate must be checked. */ if (dg) { if (tf.isreturn) e.e1.accept(this); } } } scope EscapeVisitor v = new EscapeVisitor(er); e.accept(v); } /**************************************** * e is an expression to be returned by 'ref'. * Walk e to determine which variables are possibly being * returned by ref, such as: * ref int function(int i) { return i; } * If e is a form of *p, determine which variables have content * which is being returned as ref, such as: * ref int function(int* p) { return *p; } * Multiple variables can be inserted, because of expressions like this: * ref int function(bool b, int i, int* p) { return b ? i : *p; } * * No side effects. * * Params: * e = expression to be returned by 'ref' * er = where to place collected data */ private void escapeByRef(Expression e, EscapeByResults* er) { //printf("[%s] escapeByRef, e: %s\n", e.loc.toChars(), e.toChars()); extern (C++) final class EscapeRefVisitor : Visitor { alias visit = super.visit; public: EscapeByResults* er; extern (D) this(EscapeByResults* er) { this.er = er; } override void visit(Expression e) { } override void visit(VarExp e) { auto v = e.var.isVarDeclaration(); if (v) { if (v.storage_class & STCref && v.storage_class & (STCforeach | STCtemp) && v._init) { /* If compiler generated ref temporary * (ref v = ex; ex) * look at the initializer instead */ if (ExpInitializer ez = v._init.isExpInitializer()) { assert(ez.exp && ez.exp.op == TOKconstruct); Expression ex = (cast(ConstructExp)ez.exp).e2; ex.accept(this); } } else er.byref.push(v); } } override void visit(ThisExp e) { if (e.var) er.byref.push(e.var); } override void visit(PtrExp e) { escapeByValue(e.e1, er); } override void visit(IndexExp e) { Type tb = e.e1.type.toBasetype(); if (e.e1.op == TOKvar) { VarDeclaration v = (cast(VarExp)e.e1).var.isVarDeclaration(); if (tb.ty == Tarray || tb.ty == Tsarray) { if (v && v.storage_class & STCvariadic) { er.byref.push(v); return; } } } if (tb.ty == Tsarray) { e.e1.accept(this); } else if (tb.ty == Tarray) { escapeByValue(e.e1, er); } } override void visit(DotVarExp e) { Type t1b = e.e1.type.toBasetype(); if (t1b.ty == Tclass) escapeByValue(e.e1, er); else e.e1.accept(this); } override void visit(BinAssignExp e) { e.e1.accept(this); } override void visit(AssignExp e) { e.e1.accept(this); } override void visit(CommaExp e) { e.e2.accept(this); } override void visit(CondExp e) { e.e1.accept(this); e.e2.accept(this); } override void visit(CallExp e) { /* If the function returns by ref, check each argument that is * passed as 'return ref'. */ Type t1 = e.e1.type.toBasetype(); TypeFunction tf; if (t1.ty == Tdelegate) tf = cast(TypeFunction)(cast(TypeDelegate)t1).next; else if (t1.ty == Tfunction) tf = cast(TypeFunction)t1; else return; if (tf.isref) { if (e.arguments && e.arguments.dim) { /* j=1 if _arguments[] is first argument, * skip it because it is not passed by ref */ int j = (tf.linkage == LINKd && tf.varargs == 1); for (size_t i = j; i < e.arguments.dim; ++i) { Expression arg = (*e.arguments)[i]; size_t nparams = Parameter.dim(tf.parameters); if (i - j < nparams && i >= j) { Parameter p = Parameter.getNth(tf.parameters, i - j); const stc = tf.parameterStorageClass(p); if ((stc & (STCout | STCref)) && (stc & STCreturn)) arg.accept(this); else if ((stc & STCscope) && (stc & STCreturn)) { if (arg.op == TOKdelegate) { DelegateExp de = cast(DelegateExp)arg; if (de.func.isNested()) er.byexp.push(de); } else escapeByValue(arg, er); } } } } // If 'this' is returned by ref, check it too if (e.e1.op == TOKdotvar && t1.ty == Tfunction) { DotVarExp dve = cast(DotVarExp)e.e1; if (dve.var.storage_class & STCreturn || tf.isreturn) { if (dve.var.storage_class & STCscope || tf.isscope) escapeByValue(dve.e1, er); else if (dve.var.storage_class & STCref || tf.isref) dve.e1.accept(this); } } // If it's a delegate, check it too if (e.e1.op == TOKvar && t1.ty == Tdelegate) { escapeByValue(e.e1, er); } } else er.byexp.push(e); } } scope EscapeRefVisitor v = new EscapeRefVisitor(er); e.accept(v); } /************************************ * Aggregate the data collected by the escapeBy??() functions. */ private struct EscapeByResults { VarDeclarations byref; // array into which variables being returned by ref are inserted VarDeclarations byvalue; // array into which variables with values containing pointers are inserted FuncDeclarations byfunc; // nested functions that are turned into delegates Expressions byexp; // array into which temporaries being returned by ref are inserted } /************************* * Find all variables accessed by this delegate that are * in functions enclosing it. * Params: * fd = function * vars = array to append found variables to */ void findAllOuterAccessedVariables(FuncDeclaration fd, VarDeclarations* vars) { //printf("findAllOuterAccessedVariables(fd: %s)\n", fd.toChars()); for (auto p = fd.parent; p; p = p.parent) { auto fdp = p.isFuncDeclaration(); if (fdp) { foreach (v; fdp.closureVars) { foreach (const fdv; v.nestedrefs) { if (fdv == fd) { //printf("accessed: %s, type %s\n", v.toChars(), v.type.toChars()); vars.push(v); } } } } } }
D
// -------------------------------------------------------------------------------------------------------- // Mob-Benutzung // -------------------------------------------------------------------------------------------------------- // Kein Schlüssel oder Dietrich func void PLAYER_MOB_MISSING_KEY_OR_LOCKPICK() { Print (PRINT_PicklockOrKeyMissing); AI_PlayAni (self,"T_DONTKNOW"); B_SayOverlay (self, self , "$PicklockOrKeyMissing"); }; // Hat keinen Schlüssel func void PLAYER_MOB_MISSING_KEY() { Print (PRINT_KeyMissing); AI_PlayAni (self,"T_DONTKNOW"); B_SayOverlay (self, self , "$KeyMissing"); }; // Hat keinen Dietrich func void PLAYER_MOB_MISSING_LOCKPICK() { if (Npc_GetTalentSkill (hero,NPC_TALENT_PICKLOCK) == FALSE) { Print (PRINT_NoPicklockTalent); AI_PlayAni (self,"T_DONTKNOW"); B_SayOverlay (self, self , "$NoPicklockTalent"); } else { Print (PRINT_PicklockMissing); AI_PlayAni (self,"T_DONTKNOW"); B_SayOverlay (self, self , "$PicklockMissing"); }; }; // Krieg ich niemals auf func void PLAYER_MOB_NEVER_OPEN() { Print (PRINT_NeverOpen); AI_PlayAni (self,"T_DONTKNOW"); B_SayOverlay (self, self, "$NeverOpen"); }; // Passendes Interact Item fehlt func void PLAYER_MOB_MISSING_ITEM() { Print (PRINT_MissingItem); AI_PlayAni (self,"T_DONTKNOW"); B_SayOverlay (self, self , "$MissingItem"); }; // Wird bereits vom NSC benutzt func void PLAYER_MOB_ANOTHER_IS_USING() { Print (PRINT_AnotherUser); AI_PlayAni (self,"T_DONTKNOW"); }; // Bin zu weit weg, um den MOB zu benutzen func void PLAYER_MOB_TOO_FAR_AWAY() { Print (PRINT_Toofar_Away); AI_PlayAni (self,"T_DONTKNOW"); }; // Falsche Seite für Benutzung func void PLAYER_MOB_WRONG_SIDE() { Print (PRINT_WrongSide); AI_PlayAni (self,"T_DONTKNOW"); }; // -------------------------------------------------------------------------------------------------------- // Trade // -------------------------------------------------------------------------------------------------------- // Nicht genug Gold um den Gegenstand zu kaufen. func void PLAYER_TRADE_NOT_ENOUGH_GOLD() { Print (PRINT_Trade_Not_Enough_Gold); };
D
/Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/Build/Intermediates.noindex/CryptoSwift.build/Debug/CryptoSwift.build/Objects-normal/x86_64/CBC.o : /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/ChaCha20.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/SHA1.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/PKCS/PBKDF1.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/SHA2.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/PKCS/PBKDF2.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/SHA3.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/Poly1305.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/AEAD/AEADChaCha20Poly1305.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/MD5.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/PKCS/PKCS5.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/PKCS/PKCS7.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/UInt128.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/BlockMode/ECB.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/BlockMode/OCB.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/BlockMode/CFB.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/BlockMode/OFB.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/CMAC.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/CBCMAC.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/HMAC.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/BlockMode/CBC.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/BlockMode/PCBC.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/AEAD/AEAD.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/HKDF.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/BlockMode/CCM.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/BlockMode/GCM.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/BlockMode/CTR.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/AES.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/BlockMode/BlockMode.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/Updatable.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/DigestType.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/Padding.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/ISO78164Padding.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/PKCS/PKCS7Padding.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/NoPadding.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/ZeroPadding.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/Blowfish.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/Checksum.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/UInt32+Extension.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/UInt64+Extension.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/UInt16+Extension.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/UInt8+Extension.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/Foundation/Data+Extension.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/String+Extension.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/Collection+Extension.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/Int+Extension.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/Array+Extension.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/Foundation/String+FoundationExtension.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/Foundation/ChaCha20+Foundation.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/Foundation/HMAC+Foundation.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/Foundation/AES+Foundation.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/Foundation/Blowfish+Foundation.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/Foundation/Utils+Foundation.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/Foundation/Rabbit+Foundation.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/Foundation/Array+Foundation.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/BatchedCollection.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/CompactMap.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/Cipher.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/BlockCipher.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/BlockMode/CipherModeWorker.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/Authenticator.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/Cryptor.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/BlockDecryptor.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/StreamDecryptor.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/BlockEncryptor.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/StreamEncryptor.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/Generics.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/SecureBytes.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/Utils.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/BlockMode/BlockModeOptions.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/Operators.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/AES.Cryptors.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/Cryptors.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/Bit.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/Rabbit.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/Scrypt.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/Digest.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/XPC.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/ObjectiveC.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/Combine.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/Dispatch.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/Darwin.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/Foundation.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/CoreFoundation.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/CoreGraphics.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/Swift.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/IOKit.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/SwiftOnoneSupport.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.1.sdk/usr/include/mach-o/dyld.modulemap /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.1.sdk/usr/include/mach-o/compact_unwind_encoding.modulemap /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.1.sdk/usr/include/xpc/XPC.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.1.sdk/usr/include/objc/ObjectiveC.apinotes /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/apinotes/Dispatch.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.1.sdk/usr/include/Darwin.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.1.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.1.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.1.sdk/System/Library/Frameworks/ApplicationServices.framework/Headers/ApplicationServices.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.1.sdk/System/Library/Frameworks/CoreText.framework/Headers/CoreText.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.1.sdk/System/Library/Frameworks/Security.framework/Headers/Security.apinotes /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/Build/Intermediates.noindex/CryptoSwift.build/Debug/CryptoSwift.build/Objects-normal/x86_64/CBC~partial.swiftmodule : /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/ChaCha20.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/SHA1.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/PKCS/PBKDF1.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/SHA2.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/PKCS/PBKDF2.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/SHA3.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/Poly1305.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/AEAD/AEADChaCha20Poly1305.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/MD5.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/PKCS/PKCS5.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/PKCS/PKCS7.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/UInt128.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/BlockMode/ECB.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/BlockMode/OCB.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/BlockMode/CFB.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/BlockMode/OFB.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/CMAC.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/CBCMAC.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/HMAC.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/BlockMode/CBC.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/BlockMode/PCBC.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/AEAD/AEAD.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/HKDF.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/BlockMode/CCM.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/BlockMode/GCM.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/BlockMode/CTR.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/AES.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/BlockMode/BlockMode.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/Updatable.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/DigestType.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/Padding.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/ISO78164Padding.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/PKCS/PKCS7Padding.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/NoPadding.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/ZeroPadding.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/Blowfish.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/Checksum.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/UInt32+Extension.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/UInt64+Extension.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/UInt16+Extension.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/UInt8+Extension.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/Foundation/Data+Extension.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/String+Extension.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/Collection+Extension.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/Int+Extension.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/Array+Extension.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/Foundation/String+FoundationExtension.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/Foundation/ChaCha20+Foundation.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/Foundation/HMAC+Foundation.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/Foundation/AES+Foundation.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/Foundation/Blowfish+Foundation.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/Foundation/Utils+Foundation.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/Foundation/Rabbit+Foundation.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/Foundation/Array+Foundation.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/BatchedCollection.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/CompactMap.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/Cipher.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/BlockCipher.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/BlockMode/CipherModeWorker.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/Authenticator.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/Cryptor.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/BlockDecryptor.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/StreamDecryptor.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/BlockEncryptor.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/StreamEncryptor.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/Generics.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/SecureBytes.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/Utils.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/BlockMode/BlockModeOptions.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/Operators.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/AES.Cryptors.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/Cryptors.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/Bit.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/Rabbit.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/Scrypt.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/Digest.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/XPC.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/ObjectiveC.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/Combine.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/Dispatch.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/Darwin.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/Foundation.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/CoreFoundation.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/CoreGraphics.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/Swift.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/IOKit.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/SwiftOnoneSupport.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.1.sdk/usr/include/mach-o/dyld.modulemap /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.1.sdk/usr/include/mach-o/compact_unwind_encoding.modulemap /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.1.sdk/usr/include/xpc/XPC.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.1.sdk/usr/include/objc/ObjectiveC.apinotes /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/apinotes/Dispatch.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.1.sdk/usr/include/Darwin.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.1.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.1.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.1.sdk/System/Library/Frameworks/ApplicationServices.framework/Headers/ApplicationServices.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.1.sdk/System/Library/Frameworks/CoreText.framework/Headers/CoreText.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.1.sdk/System/Library/Frameworks/Security.framework/Headers/Security.apinotes /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/Build/Intermediates.noindex/CryptoSwift.build/Debug/CryptoSwift.build/Objects-normal/x86_64/CBC~partial.swiftdoc : /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/ChaCha20.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/SHA1.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/PKCS/PBKDF1.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/SHA2.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/PKCS/PBKDF2.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/SHA3.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/Poly1305.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/AEAD/AEADChaCha20Poly1305.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/MD5.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/PKCS/PKCS5.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/PKCS/PKCS7.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/UInt128.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/BlockMode/ECB.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/BlockMode/OCB.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/BlockMode/CFB.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/BlockMode/OFB.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/CMAC.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/CBCMAC.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/HMAC.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/BlockMode/CBC.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/BlockMode/PCBC.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/AEAD/AEAD.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/HKDF.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/BlockMode/CCM.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/BlockMode/GCM.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/BlockMode/CTR.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/AES.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/BlockMode/BlockMode.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/Updatable.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/DigestType.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/Padding.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/ISO78164Padding.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/PKCS/PKCS7Padding.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/NoPadding.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/ZeroPadding.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/Blowfish.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/Checksum.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/UInt32+Extension.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/UInt64+Extension.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/UInt16+Extension.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/UInt8+Extension.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/Foundation/Data+Extension.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/String+Extension.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/Collection+Extension.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/Int+Extension.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/Array+Extension.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/Foundation/String+FoundationExtension.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/Foundation/ChaCha20+Foundation.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/Foundation/HMAC+Foundation.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/Foundation/AES+Foundation.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/Foundation/Blowfish+Foundation.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/Foundation/Utils+Foundation.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/Foundation/Rabbit+Foundation.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/Foundation/Array+Foundation.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/BatchedCollection.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/CompactMap.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/Cipher.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/BlockCipher.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/BlockMode/CipherModeWorker.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/Authenticator.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/Cryptor.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/BlockDecryptor.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/StreamDecryptor.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/BlockEncryptor.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/StreamEncryptor.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/Generics.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/SecureBytes.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/Utils.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/BlockMode/BlockModeOptions.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/Operators.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/AES.Cryptors.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/Cryptors.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/Bit.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/Rabbit.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/Scrypt.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/Digest.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/XPC.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/ObjectiveC.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/Combine.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/Dispatch.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/Darwin.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/Foundation.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/CoreFoundation.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/CoreGraphics.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/Swift.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/IOKit.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/SwiftOnoneSupport.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.1.sdk/usr/include/mach-o/dyld.modulemap /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.1.sdk/usr/include/mach-o/compact_unwind_encoding.modulemap /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.1.sdk/usr/include/xpc/XPC.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.1.sdk/usr/include/objc/ObjectiveC.apinotes /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/apinotes/Dispatch.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.1.sdk/usr/include/Darwin.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.1.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.1.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.1.sdk/System/Library/Frameworks/ApplicationServices.framework/Headers/ApplicationServices.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.1.sdk/System/Library/Frameworks/CoreText.framework/Headers/CoreText.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.1.sdk/System/Library/Frameworks/Security.framework/Headers/Security.apinotes /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/Build/Intermediates.noindex/CryptoSwift.build/Debug/CryptoSwift.build/Objects-normal/x86_64/CBC~partial.swiftsourceinfo : /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/ChaCha20.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/SHA1.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/PKCS/PBKDF1.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/SHA2.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/PKCS/PBKDF2.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/SHA3.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/Poly1305.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/AEAD/AEADChaCha20Poly1305.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/MD5.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/PKCS/PKCS5.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/PKCS/PKCS7.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/UInt128.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/BlockMode/ECB.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/BlockMode/OCB.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/BlockMode/CFB.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/BlockMode/OFB.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/CMAC.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/CBCMAC.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/HMAC.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/BlockMode/CBC.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/BlockMode/PCBC.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/AEAD/AEAD.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/HKDF.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/BlockMode/CCM.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/BlockMode/GCM.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/BlockMode/CTR.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/AES.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/BlockMode/BlockMode.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/Updatable.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/DigestType.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/Padding.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/ISO78164Padding.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/PKCS/PKCS7Padding.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/NoPadding.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/ZeroPadding.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/Blowfish.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/Checksum.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/UInt32+Extension.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/UInt64+Extension.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/UInt16+Extension.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/UInt8+Extension.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/Foundation/Data+Extension.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/String+Extension.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/Collection+Extension.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/Int+Extension.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/Array+Extension.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/Foundation/String+FoundationExtension.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/Foundation/ChaCha20+Foundation.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/Foundation/HMAC+Foundation.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/Foundation/AES+Foundation.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/Foundation/Blowfish+Foundation.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/Foundation/Utils+Foundation.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/Foundation/Rabbit+Foundation.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/Foundation/Array+Foundation.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/BatchedCollection.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/CompactMap.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/Cipher.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/BlockCipher.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/BlockMode/CipherModeWorker.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/Authenticator.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/Cryptor.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/BlockDecryptor.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/StreamDecryptor.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/BlockEncryptor.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/StreamEncryptor.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/Generics.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/SecureBytes.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/Utils.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/BlockMode/BlockModeOptions.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/Operators.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/AES.Cryptors.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/Cryptors.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/Bit.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/Rabbit.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/Scrypt.swift /Users/darthjuda/Documents/snippets/swiftPackage/ovhAPI/DerivedData/ovhAPI/SourcePackages/checkouts/CryptoSwift/Sources/CryptoSwift/Digest.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/XPC.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/ObjectiveC.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/Combine.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/Dispatch.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/Darwin.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/Foundation.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/CoreFoundation.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/CoreGraphics.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/Swift.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/IOKit.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/SwiftOnoneSupport.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.1.sdk/usr/include/mach-o/dyld.modulemap /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.1.sdk/usr/include/mach-o/compact_unwind_encoding.modulemap /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.1.sdk/usr/include/xpc/XPC.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.1.sdk/usr/include/objc/ObjectiveC.apinotes /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/apinotes/Dispatch.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.1.sdk/usr/include/Darwin.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.1.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.1.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.1.sdk/System/Library/Frameworks/ApplicationServices.framework/Headers/ApplicationServices.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.1.sdk/System/Library/Frameworks/CoreText.framework/Headers/CoreText.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.1.sdk/System/Library/Frameworks/Security.framework/Headers/Security.apinotes
D
// Written in the D programming language. /** String handling functions. $(SCRIPT inhibitQuickIndex = 1;) $(DIVC quickindex, $(BOOKTABLE , $(TR $(TH Category) $(TH Functions) ) $(TR $(TDNW Searching) $(TD $(MYREF column) $(MYREF inPattern) $(MYREF indexOf) $(MYREF indexOfAny) $(MYREF indexOfNeither) $(MYREF lastIndexOf) $(MYREF lastIndexOfAny) $(MYREF lastIndexOfNeither) ) ) $(TR $(TDNW Comparison) $(TD $(MYREF countchars) $(MYREF isNumeric) ) ) $(TR $(TDNW Mutation) $(TD $(MYREF capitalize) $(MYREF munch) $(MYREF removechars) $(MYREF squeeze) ) ) $(TR $(TDNW Pruning and Filling) $(TD $(MYREF center) $(MYREF chomp) $(MYREF chompPrefix) $(MYREF chop) $(MYREF detabber) $(MYREF detab) $(MYREF entab) $(MYREF leftJustify) $(MYREF outdent) $(MYREF rightJustify) $(MYREF strip) $(MYREF stripLeft) $(MYREF stripRight) $(MYREF wrap) ) ) $(TR $(TDNW Substitution) $(TD $(MYREF abbrev) $(MYREF soundex) $(MYREF soundexer) $(MYREF succ) $(MYREF tr) $(MYREF translate) ) ) $(TR $(TDNW Miscellaneous) $(TD $(MYREF assumeUTF) $(MYREF fromStringz) $(MYREF lineSplitter) $(MYREF representation) $(MYREF splitLines) $(MYREF toStringz) ) ))) Objects of types $(D _string), $(D wstring), and $(D dstring) are value types and cannot be mutated element-by-element. For using mutation during building strings, use $(D char[]), $(D wchar[]), or $(D dchar[]). The $(D xxxstring) types are preferable because they don't exhibit undesired aliasing, thus making code more robust. The following functions are publicly imported: $(BOOKTABLE , $(TR $(TH Module) $(TH Functions) ) $(LEADINGROW Publicly imported functions) $(TR $(TD std.algorithm) $(TD $(SHORTXREF_PACK algorithm,comparison,cmp) $(SHORTXREF_PACK algorithm,searching,count) $(SHORTXREF_PACK algorithm,searching,endsWith) $(SHORTXREF_PACK algorithm,searching,startsWith) )) $(TR $(TD std.array) $(TD $(SHORTXREF array, join) $(SHORTXREF array, replace) $(SHORTXREF array, replaceInPlace) $(SHORTXREF array, split) )) $(TR $(TD std.format) $(TD $(SHORTXREF format, format) $(SHORTXREF format, sformat) )) $(TR $(TD std.uni) $(TD $(SHORTXREF uni, icmp) $(SHORTXREF uni, toLower) $(SHORTXREF uni, toLowerInPlace) $(SHORTXREF uni, toUpper) $(SHORTXREF uni, toUpperInPlace) )) ) There is a rich set of functions for _string handling defined in other modules. Functions related to Unicode and ASCII are found in $(LINK2 std_uni.html, std.uni) and $(LINK2 std_ascii.html, std.ascii), respectively. Other functions that have a wider generality than just strings can be found in $(LINK2 std_algorithm.html, std.algorithm) and $(LINK2 std_range.html, std.range). See_Also: $(LIST $(LINK2 std_algorithm.html, std.algorithm) and $(LINK2 std_range.html, std.range) for generic range algorithms , $(LINK2 std_ascii.html, std.ascii) for functions that work with ASCII strings , $(LINK2 std_uni.html, std.uni) for functions that work with unicode strings ) Macros: WIKI = Phobos/StdString SHORTXREF=$(XREF2 $1, $2, $(TT $2)) SHORTXREF_PACK=$(XREF_PACK_NAMED $1,$2,$3, $(TT $3)) Copyright: Copyright Digital Mars 2007-. License: $(WEB boost.org/LICENSE_1_0.txt, Boost License 1.0). Authors: $(WEB digitalmars.com, Walter Bright), $(WEB erdani.org, Andrei Alexandrescu), and Jonathan M Davis Source: $(PHOBOSSRC std/_string.d) */ module std.string; //debug=string; // uncomment to turn on debugging trustedPrintf's debug(string) private void trustedPrintf(in char* str) @trusted nothrow @nogc { import core.stdc.stdio : printf; printf("%s", str); } version (unittest) { private: struct TestAliasedString { string get() @safe @nogc pure nothrow { return _s; } alias get this; @disable this(this); string _s; } bool testAliasedString(alias func, Args...)(string s, Args args) { return func(TestAliasedString(s), args) == func(s, args); } } public import std.uni : icmp, toLower, toLowerInPlace, toUpper, toUpperInPlace; public import std.format : format, sformat; import std.typecons : Flag; import std.meta; import std.range.primitives; import std.traits; //public imports for backward compatibility public import std.algorithm : startsWith, endsWith, cmp, count; public import std.array : join, replace, replaceInPlace, split; /* ************* Exceptions *************** */ /++ Exception thrown on errors in std.string functions. +/ class StringException : Exception { /++ Params: msg = The message for the exception. file = The file where the exception occurred. line = The line number where the exception occurred. next = The previous exception in the chain of exceptions, if any. +/ this(string msg, string file = __FILE__, size_t line = __LINE__, Throwable next = null) @safe pure nothrow { super(msg, file, line, next); } } /++ Params: cString = A null-terminated c-style string. Returns: A D-style array of $(D char) referencing the same string. The returned array will retain the same type qualifiers as the input. $(RED Important Note:) The returned array is a slice of the original buffer. The original data is not changed and not copied. +/ inout(char)[] fromStringz(inout(char)* cString) @nogc @system pure nothrow { import core.stdc.string : strlen; return cString ? cString[0 .. strlen(cString)] : null; } /// @system pure unittest { assert(fromStringz(null) == null); assert(fromStringz("foo") == "foo"); } /++ Params: s = A D-style string. Returns: A C-style null-terminated string equivalent to $(D s). $(D s) must not contain embedded $(D '\0')'s as any C function will treat the first $(D '\0') that it sees as the end of the string. If $(D s.empty) is $(D true), then a string containing only $(D '\0') is returned. $(RED Important Note:) When passing a $(D char*) to a C function, and the C function keeps it around for any reason, make sure that you keep a reference to it in your D code. Otherwise, it may become invalid during a garbage collection cycle and cause a nasty bug when the C code tries to use it. +/ immutable(char)* toStringz(const(char)[] s) @trusted pure nothrow in { // The assert below contradicts the unittests! //assert(memchr(s.ptr, 0, s.length) == null, //text(s.length, ": `", s, "'")); } out (result) { import core.stdc.string : strlen, memcmp; if (result) { auto slen = s.length; while (slen > 0 && s[slen-1] == 0) --slen; assert(strlen(result) == slen); assert(memcmp(result, s.ptr, slen) == 0); } } body { import std.exception : assumeUnique; /+ Unfortunately, this isn't reliable. We could make this work if string literals are put in read-only memory and we test if s[] is pointing into that. /* Peek past end of s[], if it's 0, no conversion necessary. * Note that the compiler will put a 0 past the end of static * strings, and the storage allocator will put a 0 past the end * of newly allocated char[]'s. */ char* p = &s[0] + s.length; if (*p == 0) return s; +/ // Need to make a copy auto copy = new char[s.length + 1]; copy[0..s.length] = s[]; copy[s.length] = 0; return assumeUnique(copy).ptr; } /++ Ditto +/ immutable(char)* toStringz(in string s) @trusted pure nothrow { if (s.empty) return "".ptr; /* Peek past end of s[], if it's 0, no conversion necessary. * Note that the compiler will put a 0 past the end of static * strings, and the storage allocator will put a 0 past the end * of newly allocated char[]'s. */ immutable p = s.ptr + s.length; // Is p dereferenceable? A simple test: if the p points to an // address multiple of 4, then conservatively assume the pointer // might be pointing to a new block of memory, which might be // unreadable. Otherwise, it's definitely pointing to valid // memory. if ((cast(size_t) p & 3) && *p == 0) return s.ptr; return toStringz(cast(const char[]) s); } pure nothrow unittest { import core.stdc.string : strlen; import std.conv : to; debug(string) trustedPrintf("string.toStringz.unittest\n"); // TODO: CTFEable toStringz is really necessary? //assertCTFEable!( //{ auto p = toStringz("foo"); assert(strlen(p) == 3); const(char)[] foo = "abbzxyzzy"; p = toStringz(foo[3..5]); assert(strlen(p) == 2); string test = ""; p = toStringz(test); assert(*p == 0); test = "\0"; p = toStringz(test); assert(*p == 0); test = "foo\0"; p = toStringz(test); assert(p[0] == 'f' && p[1] == 'o' && p[2] == 'o' && p[3] == 0); const string test2 = ""; p = toStringz(test2); assert(*p == 0); //}); } /** Flag indicating whether a search is case-sensitive. */ alias CaseSensitive = Flag!"caseSensitive"; /++ Searches for character in range. Params: s = string or InputRange of characters to search in correct UTF format c = character to search for cs = CaseSensitive.yes or CaseSensitive.no Returns: the index of the first occurrence of $(D c) in $(D s). If $(D c) is not found, then $(D -1) is returned. If the parameters are not valid UTF, the result will still be in the range [-1 .. s.length], but will not be reliable otherwise. +/ ptrdiff_t indexOf(Range)(Range s, in dchar c, in CaseSensitive cs = CaseSensitive.yes) if (isInputRange!Range && isSomeChar!(ElementEncodingType!Range) && !isConvertibleToString!Range) { import std.ascii : toLower, isASCII; import std.uni : toLower; import std.utf : byDchar, byCodeUnit, UTFException, codeLength; alias Char = Unqual!(ElementEncodingType!Range); if (cs == CaseSensitive.yes) { static if (Char.sizeof == 1 && isSomeString!Range) { import core.stdc.string : memchr; if (std.ascii.isASCII(c) && !__ctfe) { // Plain old ASCII auto trustedmemchr() @trusted { return cast(Char*)memchr(s.ptr, c, s.length); } const p = trustedmemchr(); if (p) return p - s.ptr; else return -1; } } static if (Char.sizeof == 1) { if (c <= 0x7F) { ptrdiff_t i; foreach (const c2; s) { if (c == c2) return i; ++i; } } else { ptrdiff_t i; foreach (const c2; s.byDchar()) { if (c == c2) return i; i += codeLength!Char(c2); } } } else static if (Char.sizeof == 2) { if (c <= 0xFFFF) { ptrdiff_t i; foreach (const c2; s) { if (c == c2) return i; ++i; } } else if (c <= 0x10FFFF) { // Encode UTF-16 surrogate pair const wchar c1 = cast(wchar)((((c - 0x10000) >> 10) & 0x3FF) + 0xD800); const wchar c2 = cast(wchar)(((c - 0x10000) & 0x3FF) + 0xDC00); ptrdiff_t i; for (auto r = s.byCodeUnit(); !r.empty; r.popFront()) { if (c1 == r.front) { r.popFront(); if (r.empty) // invalid UTF - missing second of pair break; if (c2 == r.front) return i; ++i; } ++i; } } } else static if (Char.sizeof == 4) { ptrdiff_t i; foreach (const c2; s) { if (c == c2) return i; ++i; } } else static assert(0); return -1; } else { if (std.ascii.isASCII(c)) { // Plain old ASCII auto c1 = cast(char) std.ascii.toLower(c); ptrdiff_t i; foreach (const c2; s.byCodeUnit()) { if (c1 == std.ascii.toLower(c2)) return i; ++i; } } else { // c is a universal character auto c1 = std.uni.toLower(c); ptrdiff_t i; foreach (const c2; s.byDchar()) { if (c1 == std.uni.toLower(c2)) return i; i += codeLength!Char(c2); } } } return -1; } ptrdiff_t indexOf(Range)(auto ref Range s, in dchar c, in CaseSensitive cs = CaseSensitive.yes) if (isConvertibleToString!Range) { return indexOf!(StringTypeOf!Range)(s, c, cs); } unittest { assert(testAliasedString!indexOf("std/string.d", '/')); } @safe pure unittest { import std.conv : to; debug(string) trustedPrintf("string.indexOf.unittest\n"); import std.exception; import std.utf : byChar, byWchar, byDchar; assertCTFEable!( { foreach (S; AliasSeq!(string, wstring, dstring)) { assert(indexOf(cast(S)null, cast(dchar)'a') == -1); assert(indexOf(to!S("def"), cast(dchar)'a') == -1); assert(indexOf(to!S("abba"), cast(dchar)'a') == 0); assert(indexOf(to!S("def"), cast(dchar)'f') == 2); assert(indexOf(to!S("def"), cast(dchar)'a', CaseSensitive.no) == -1); assert(indexOf(to!S("def"), cast(dchar)'a', CaseSensitive.no) == -1); assert(indexOf(to!S("Abba"), cast(dchar)'a', CaseSensitive.no) == 0); assert(indexOf(to!S("def"), cast(dchar)'F', CaseSensitive.no) == 2); assert(indexOf(to!S("ödef"), 'ö', CaseSensitive.no) == 0); S sPlts = "Mars: the fourth Rock (Planet) from the Sun."; assert(indexOf("def", cast(char)'f', CaseSensitive.no) == 2); assert(indexOf(sPlts, cast(char)'P', CaseSensitive.no) == 23); assert(indexOf(sPlts, cast(char)'R', CaseSensitive.no) == 2); } foreach (cs; EnumMembers!CaseSensitive) { assert(indexOf("hello\U00010143\u0100\U00010143", '\u0100', cs) == 9); assert(indexOf("hello\U00010143\u0100\U00010143"w, '\u0100', cs) == 7); assert(indexOf("hello\U00010143\u0100\U00010143"d, '\u0100', cs) == 6); assert(indexOf("hello\U00010143\u0100\U00010143".byChar, '\u0100', cs) == 9); assert(indexOf("hello\U00010143\u0100\U00010143".byWchar, '\u0100', cs) == 7); assert(indexOf("hello\U00010143\u0100\U00010143".byDchar, '\u0100', cs) == 6); assert(indexOf("hello\U000007FF\u0100\U00010143".byChar, 'l', cs) == 2); assert(indexOf("hello\U000007FF\u0100\U00010143".byChar, '\u0100', cs) == 7); assert(indexOf("hello\U0000EFFF\u0100\U00010143".byChar, '\u0100', cs) == 8); assert(indexOf("hello\U00010100".byWchar, '\U00010100', cs) == 5); assert(indexOf("hello\U00010100".byWchar, '\U00010101', cs) == -1); } char[10] fixedSizeArray = "0123456789"; assert(indexOf(fixedSizeArray, '2') == 2); }); } /++ Searches for character in range starting at index startIdx. Params: s = string or InputRange of characters to search in correct UTF format c = character to search for startIdx = starting index to a well-formed code point cs = CaseSensitive.yes or CaseSensitive.no Returns: the index of the first occurrence of $(D c) in $(D s). If $(D c) is not found, then $(D -1) is returned. If the parameters are not valid UTF, the result will still be in the range [-1 .. s.length], but will not be reliable otherwise. +/ ptrdiff_t indexOf(Range)(Range s, in dchar c, in size_t startIdx, in CaseSensitive cs = CaseSensitive.yes) if (isInputRange!Range && isSomeChar!(ElementEncodingType!Range) && !isConvertibleToString!Range) { static if (isSomeString!(typeof(s)) || (hasSlicing!(typeof(s)) && hasLength!(typeof(s)))) { if (startIdx < s.length) { ptrdiff_t foundIdx = indexOf(s[startIdx .. $], c, cs); if (foundIdx != -1) { return foundIdx + cast(ptrdiff_t)startIdx; } } } else { foreach (i; 0 .. startIdx) { if (s.empty) return -1; s.popFront(); } ptrdiff_t foundIdx = indexOf(s, c, cs); if (foundIdx != -1) { return foundIdx + cast(ptrdiff_t)startIdx; } } return -1; } ptrdiff_t indexOf(Range)(auto ref Range s, in dchar c, in size_t startIdx, in CaseSensitive cs = CaseSensitive.yes) if (isConvertibleToString!Range) { return indexOf!(StringTypeOf!Range)(s, c, startIdx, cs); } unittest { assert(testAliasedString!indexOf("std/string.d", '/', 3)); } @safe pure unittest { import std.conv : to; debug(string) trustedPrintf("string.indexOf(startIdx).unittest\n"); import std.utf : byCodeUnit, byChar, byWchar; assert("hello".byCodeUnit.indexOf(cast(dchar)'l', 1) == 2); assert("hello".byWchar.indexOf(cast(dchar)'l', 1) == 2); assert("hello".byWchar.indexOf(cast(dchar)'l', 6) == -1); foreach (S; AliasSeq!(string, wstring, dstring)) { assert(indexOf(cast(S)null, cast(dchar)'a', 1) == -1); assert(indexOf(to!S("def"), cast(dchar)'a', 1) == -1); assert(indexOf(to!S("abba"), cast(dchar)'a', 1) == 3); assert(indexOf(to!S("def"), cast(dchar)'f', 1) == 2); assert((to!S("def")).indexOf(cast(dchar)'a', 1, CaseSensitive.no) == -1); assert(indexOf(to!S("def"), cast(dchar)'a', 1, CaseSensitive.no) == -1); assert(indexOf(to!S("def"), cast(dchar)'a', 12, CaseSensitive.no) == -1); assert(indexOf(to!S("AbbA"), cast(dchar)'a', 2, CaseSensitive.no) == 3); assert(indexOf(to!S("def"), cast(dchar)'F', 2, CaseSensitive.no) == 2); S sPlts = "Mars: the fourth Rock (Planet) from the Sun."; assert(indexOf("def", cast(char)'f', cast(uint)2, CaseSensitive.no) == 2); assert(indexOf(sPlts, cast(char)'P', 12, CaseSensitive.no) == 23); assert(indexOf(sPlts, cast(char)'R', cast(ulong)1, CaseSensitive.no) == 2); } foreach(cs; EnumMembers!CaseSensitive) { assert(indexOf("hello\U00010143\u0100\U00010143", '\u0100', 2, cs) == 9); assert(indexOf("hello\U00010143\u0100\U00010143"w, '\u0100', 3, cs) == 7); assert(indexOf("hello\U00010143\u0100\U00010143"d, '\u0100', 6, cs) == 6); } } /++ Searches for substring in $(D s). Params: s = string or ForwardRange of characters to search in correct UTF format sub = substring to search for cs = CaseSensitive.yes or CaseSensitive.no Returns: the index of the first occurrence of $(D sub) in $(D s). If $(D sub) is not found, then $(D -1) is returned. If the arguments are not valid UTF, the result will still be in the range [-1 .. s.length], but will not be reliable otherwise. Bugs: Does not work with case insensitive strings where the mapping of tolower and toupper is not 1:1. +/ ptrdiff_t indexOf(Range, Char)(Range s, const(Char)[] sub, in CaseSensitive cs = CaseSensitive.yes) if (isForwardRange!Range && isSomeChar!(ElementEncodingType!Range) && isSomeChar!Char) { import std.uni : toLower; alias Char1 = Unqual!(ElementEncodingType!Range); static if (isSomeString!Range) { import std.algorithm : find; const(Char1)[] balance; if (cs == CaseSensitive.yes) { balance = std.algorithm.find(s, sub); } else { balance = std.algorithm.find! ((a, b) => std.uni.toLower(a) == std.uni.toLower(b)) (s, sub); } return balance.empty ? -1 : balance.ptr - s.ptr; } else { if (s.empty) return -1; if (sub.empty) return 0; // degenerate case import std.utf : byDchar, codeLength; auto subr = sub.byDchar; // decode sub[] by dchar's dchar sub0 = subr.front; // cache first character of sub[] subr.popFront(); // Special case for single character search if (subr.empty) return indexOf(s, sub0, cs); if (cs == CaseSensitive.no) sub0 = toLower(sub0); /* Classic double nested loop search algorithm */ ptrdiff_t index = 0; // count code unit index into s for (auto sbydchar = s.byDchar(); !sbydchar.empty; sbydchar.popFront()) { dchar c2 = sbydchar.front; if (cs == CaseSensitive.no) c2 = toLower(c2); if (c2 == sub0) { auto s2 = sbydchar.save; // why s must be a forward range foreach (c; subr.save) { s2.popFront(); if (s2.empty) return -1; if (cs == CaseSensitive.yes ? c != s2.front : toLower(c) != toLower(s2.front) ) goto Lnext; } return index; } Lnext: index += codeLength!Char1(c2); } return -1; } } ptrdiff_t indexOf(Range, Char)(auto ref Range s, const(Char)[] sub, in CaseSensitive cs = CaseSensitive.yes) if (!(isForwardRange!Range && isSomeChar!(ElementEncodingType!Range) && isSomeChar!Char) && is(StringTypeOf!Range)) { return indexOf!(StringTypeOf!Range)(s, sub, cs); } unittest { assert(testAliasedString!indexOf("std/string.d", "string")); } @safe pure unittest { import std.conv : to; debug(string) trustedPrintf("string.indexOf.unittest\n"); import std.exception; assertCTFEable!( { foreach (S; AliasSeq!(string, wstring, dstring)) { foreach (T; AliasSeq!(string, wstring, dstring)) (){ // avoid slow optimizations for large functions @@@BUG@@@ 2396 assert(indexOf(cast(S)null, to!T("a")) == -1); assert(indexOf(to!S("def"), to!T("a")) == -1); assert(indexOf(to!S("abba"), to!T("a")) == 0); assert(indexOf(to!S("def"), to!T("f")) == 2); assert(indexOf(to!S("dfefffg"), to!T("fff")) == 3); assert(indexOf(to!S("dfeffgfff"), to!T("fff")) == 6); assert(indexOf(to!S("dfeffgfff"), to!T("a"), CaseSensitive.no) == -1); assert(indexOf(to!S("def"), to!T("a"), CaseSensitive.no) == -1); assert(indexOf(to!S("abba"), to!T("a"), CaseSensitive.no) == 0); assert(indexOf(to!S("def"), to!T("f"), CaseSensitive.no) == 2); assert(indexOf(to!S("dfefffg"), to!T("fff"), CaseSensitive.no) == 3); assert(indexOf(to!S("dfeffgfff"), to!T("fff"), CaseSensitive.no) == 6); S sPlts = "Mars: the fourth Rock (Planet) from the Sun."; S sMars = "Who\'s \'My Favorite Maritian?\'"; assert(indexOf(sMars, to!T("MY fAVe"), CaseSensitive.no) == -1); assert(indexOf(sMars, to!T("mY fAVOriTe"), CaseSensitive.no) == 7); assert(indexOf(sPlts, to!T("mArS:"), CaseSensitive.no) == 0); assert(indexOf(sPlts, to!T("rOcK"), CaseSensitive.no) == 17); assert(indexOf(sPlts, to!T("Un."), CaseSensitive.no) == 41); assert(indexOf(sPlts, to!T(sPlts), CaseSensitive.no) == 0); assert(indexOf("\u0100", to!T("\u0100"), CaseSensitive.no) == 0); // Thanks to Carlos Santander B. and zwang assert(indexOf("sus mejores cortesanos. Se embarcaron en el puerto de Dubai y", to!T("page-break-before"), CaseSensitive.no) == -1); }(); foreach (cs; EnumMembers!CaseSensitive) { assert(indexOf("hello\U00010143\u0100\U00010143", to!S("\u0100"), cs) == 9); assert(indexOf("hello\U00010143\u0100\U00010143"w, to!S("\u0100"), cs) == 7); assert(indexOf("hello\U00010143\u0100\U00010143"d, to!S("\u0100"), cs) == 6); } } }); } @safe pure @nogc nothrow unittest { import std.utf : byWchar; foreach (cs; EnumMembers!CaseSensitive) { assert(indexOf("".byWchar, "", cs) == -1); assert(indexOf("hello".byWchar, "", cs) == 0); assert(indexOf("hello".byWchar, "l", cs) == 2); assert(indexOf("heLLo".byWchar, "LL", cs) == 2); assert(indexOf("hello".byWchar, "lox", cs) == -1); assert(indexOf("hello".byWchar, "betty", cs) == -1); assert(indexOf("hello\U00010143\u0100*\U00010143".byWchar, "\u0100*", cs) == 7); } } /++ Params: s = string to search sub = substring to search for startIdx = the index into s to start searching from cs = CaseSensitive.yes or CaseSensitive.no Returns: The index of the first occurrence of $(D sub) in $(D s) with respect to the start index $(D startIdx). If $(D sub) is not found, then $(D -1) is returned. If $(D sub) is found the value of the returned index is at least $(D startIdx). $(D startIdx) represents a codeunit index in $(D s). If the sequence starting at $(D startIdx) does not represent a well formed codepoint, then a $(XREF utf,UTFException) may be thrown. $(D cs) indicates whether the comparisons are case sensitive. +/ ptrdiff_t indexOf(Char1, Char2)(const(Char1)[] s, const(Char2)[] sub, in size_t startIdx, in CaseSensitive cs = CaseSensitive.yes) @safe if (isSomeChar!Char1 && isSomeChar!Char2) { if (startIdx < s.length) { ptrdiff_t foundIdx = indexOf(s[startIdx .. $], sub, cs); if (foundIdx != -1) { return foundIdx + cast(ptrdiff_t)startIdx; } } return -1; } @safe pure unittest { import std.conv : to; debug(string) trustedPrintf("string.indexOf(startIdx).unittest\n"); foreach(S; AliasSeq!(string, wstring, dstring)) { foreach(T; AliasSeq!(string, wstring, dstring)) (){ // avoid slow optimizations for large functions @@@BUG@@@ 2396 assert(indexOf(cast(S)null, to!T("a"), 1337) == -1); assert(indexOf(to!S("def"), to!T("a"), 0) == -1); assert(indexOf(to!S("abba"), to!T("a"), 2) == 3); assert(indexOf(to!S("def"), to!T("f"), 1) == 2); assert(indexOf(to!S("dfefffg"), to!T("fff"), 1) == 3); assert(indexOf(to!S("dfeffgfff"), to!T("fff"), 5) == 6); assert(indexOf(to!S("dfeffgfff"), to!T("a"), 1, CaseSensitive.no) == -1); assert(indexOf(to!S("def"), to!T("a"), 2, CaseSensitive.no) == -1); assert(indexOf(to!S("abba"), to!T("a"), 3, CaseSensitive.no) == 3); assert(indexOf(to!S("def"), to!T("f"), 1, CaseSensitive.no) == 2); assert(indexOf(to!S("dfefffg"), to!T("fff"), 2, CaseSensitive.no) == 3); assert(indexOf(to!S("dfeffgfff"), to!T("fff"), 4, CaseSensitive.no) == 6); assert(indexOf(to!S("dfeffgffföä"), to!T("öä"), 9, CaseSensitive.no) == 9, to!string(indexOf(to!S("dfeffgffföä"), to!T("öä"), 9, CaseSensitive.no)) ~ " " ~ S.stringof ~ " " ~ T.stringof); S sPlts = "Mars: the fourth Rock (Planet) from the Sun."; S sMars = "Who\'s \'My Favorite Maritian?\'"; assert(indexOf(sMars, to!T("MY fAVe"), 10, CaseSensitive.no) == -1); assert(indexOf(sMars, to!T("mY fAVOriTe"), 4, CaseSensitive.no) == 7); assert(indexOf(sPlts, to!T("mArS:"), 0, CaseSensitive.no) == 0); assert(indexOf(sPlts, to!T("rOcK"), 12, CaseSensitive.no) == 17); assert(indexOf(sPlts, to!T("Un."), 32, CaseSensitive.no) == 41); assert(indexOf(sPlts, to!T(sPlts), 0, CaseSensitive.no) == 0); assert(indexOf("\u0100", to!T("\u0100"), 0, CaseSensitive.no) == 0); // Thanks to Carlos Santander B. and zwang assert(indexOf("sus mejores cortesanos. Se embarcaron en el puerto de Dubai y", to!T("page-break-before"), 10, CaseSensitive.no) == -1); // In order for indexOf with and without index to be consistent assert(indexOf(to!S(""), to!T("")) == indexOf(to!S(""), to!T(""), 0)); }(); foreach(cs; EnumMembers!CaseSensitive) { assert(indexOf("hello\U00010143\u0100\U00010143", to!S("\u0100"), 3, cs) == 9); assert(indexOf("hello\U00010143\u0100\U00010143"w, to!S("\u0100"), 3, cs) == 7); assert(indexOf("hello\U00010143\u0100\U00010143"d, to!S("\u0100"), 3, cs) == 6); } } } /++ Params: s = string to search c = character to search for cs = CaseSensitive.yes or CaseSensitive.no Returns: The index of the last occurrence of $(D c) in $(D s). If $(D c) is not found, then $(D -1) is returned. $(D cs) indicates whether the comparisons are case sensitive. +/ ptrdiff_t lastIndexOf(Char)(const(Char)[] s, in dchar c, in CaseSensitive cs = CaseSensitive.yes) @safe pure if (isSomeChar!Char) { import std.ascii : isASCII, toLower; import std.utf : canSearchInCodeUnits; if (cs == CaseSensitive.yes) { if (canSearchInCodeUnits!Char(c)) { foreach_reverse (i, it; s) { if (it == c) { return i; } } } else { foreach_reverse (i, dchar it; s) { if (it == c) { return i; } } } } else { if (std.ascii.isASCII(c)) { immutable c1 = std.ascii.toLower(c); foreach_reverse (i, it; s) { immutable c2 = std.ascii.toLower(it); if (c1 == c2) { return i; } } } else { immutable c1 = std.uni.toLower(c); foreach_reverse (i, dchar it; s) { immutable c2 = std.uni.toLower(it); if (c1 == c2) { return i; } } } } return -1; } @safe pure unittest { import std.conv : to; debug(string) trustedPrintf("string.lastIndexOf.unittest\n"); import std.exception; assertCTFEable!( { foreach (S; AliasSeq!(string, wstring, dstring)) { assert(lastIndexOf(cast(S) null, 'a') == -1); assert(lastIndexOf(to!S("def"), 'a') == -1); assert(lastIndexOf(to!S("abba"), 'a') == 3); assert(lastIndexOf(to!S("def"), 'f') == 2); assert(lastIndexOf(to!S("ödef"), 'ö') == 0); assert(lastIndexOf(cast(S) null, 'a', CaseSensitive.no) == -1); assert(lastIndexOf(to!S("def"), 'a', CaseSensitive.no) == -1); assert(lastIndexOf(to!S("AbbA"), 'a', CaseSensitive.no) == 3); assert(lastIndexOf(to!S("def"), 'F', CaseSensitive.no) == 2); assert(lastIndexOf(to!S("ödef"), 'ö', CaseSensitive.no) == 0); assert(lastIndexOf(to!S("i\u0100def"), to!dchar("\u0100"), CaseSensitive.no) == 1); S sPlts = "Mars: the fourth Rock (Planet) from the Sun."; assert(lastIndexOf(to!S("def"), 'f', CaseSensitive.no) == 2); assert(lastIndexOf(sPlts, 'M', CaseSensitive.no) == 34); assert(lastIndexOf(sPlts, 'S', CaseSensitive.no) == 40); } foreach (cs; EnumMembers!CaseSensitive) { assert(lastIndexOf("\U00010143\u0100\U00010143hello", '\u0100', cs) == 4); assert(lastIndexOf("\U00010143\u0100\U00010143hello"w, '\u0100', cs) == 2); assert(lastIndexOf("\U00010143\u0100\U00010143hello"d, '\u0100', cs) == 1); } }); } /++ Params: s = string to search c = character to search for startIdx = the index into s to start searching from cs = CaseSensitive.yes or CaseSensitive.no Returns: The index of the last occurrence of $(D c) in $(D s). If $(D c) is not found, then $(D -1) is returned. The $(D startIdx) slices $(D s) in the following way $(D s[0 .. startIdx]). $(D startIdx) represents a codeunit index in $(D s). If the sequence ending at $(D startIdx) does not represent a well formed codepoint, then a $(XREF utf,UTFException) may be thrown. $(D cs) indicates whether the comparisons are case sensitive. +/ ptrdiff_t lastIndexOf(Char)(const(Char)[] s, in dchar c, in size_t startIdx, in CaseSensitive cs = CaseSensitive.yes) @safe pure if (isSomeChar!Char) { if (startIdx <= s.length) { return lastIndexOf(s[0u .. startIdx], c, cs); } return -1; } @safe pure unittest { import std.conv : to; debug(string) trustedPrintf("string.lastIndexOf.unittest\n"); foreach(S; AliasSeq!(string, wstring, dstring)) { assert(lastIndexOf(cast(S) null, 'a') == -1); assert(lastIndexOf(to!S("def"), 'a') == -1); assert(lastIndexOf(to!S("abba"), 'a', 3) == 0); assert(lastIndexOf(to!S("deff"), 'f', 3) == 2); assert(lastIndexOf(cast(S) null, 'a', CaseSensitive.no) == -1); assert(lastIndexOf(to!S("def"), 'a', CaseSensitive.no) == -1); assert(lastIndexOf(to!S("AbbAa"), 'a', to!ushort(4), CaseSensitive.no) == 3, to!string(lastIndexOf(to!S("AbbAa"), 'a', 4, CaseSensitive.no))); assert(lastIndexOf(to!S("def"), 'F', 3, CaseSensitive.no) == 2); S sPlts = "Mars: the fourth Rock (Planet) from the Sun."; assert(lastIndexOf(to!S("def"), 'f', 4, CaseSensitive.no) == -1); assert(lastIndexOf(sPlts, 'M', sPlts.length -2, CaseSensitive.no) == 34); assert(lastIndexOf(sPlts, 'S', sPlts.length -2, CaseSensitive.no) == 40); } foreach(cs; EnumMembers!CaseSensitive) { assert(lastIndexOf("\U00010143\u0100\U00010143hello", '\u0100', cs) == 4); assert(lastIndexOf("\U00010143\u0100\U00010143hello"w, '\u0100', cs) == 2); assert(lastIndexOf("\U00010143\u0100\U00010143hello"d, '\u0100', cs) == 1); } } /++ Params: s = string to search sub = substring to search for cs = CaseSensitive.yes or CaseSensitive.no Returns: the index of the last occurrence of $(D sub) in $(D s). If $(D sub) is not found, then $(D -1) is returned. $(D cs) indicates whether the comparisons are case sensitive. +/ ptrdiff_t lastIndexOf(Char1, Char2)(const(Char1)[] s, const(Char2)[] sub, in CaseSensitive cs = CaseSensitive.yes) @safe pure if (isSomeChar!Char1 && isSomeChar!Char2) { import std.utf : strideBack; import std.conv : to; import std.algorithm : endsWith; if (sub.empty) return s.length; if (walkLength(sub) == 1) return lastIndexOf(s, sub.front, cs); if (cs == CaseSensitive.yes) { static if (is(Unqual!Char1 == Unqual!Char2)) { import core.stdc.string : memcmp; immutable c = sub[0]; for (ptrdiff_t i = s.length - sub.length; i >= 0; --i) { if (s[i] == c) { if (__ctfe) { foreach (j; 1 .. sub.length) { if (s[i + j] != sub[j]) continue; } return i; } else { auto trustedMemcmp(in void* s1, in void* s2, size_t n) @trusted { return memcmp(s1, s2, n); } if (trustedMemcmp(&s[i + 1], &sub[1], (sub.length - 1) * Char1.sizeof) == 0) return i; } } } } else { for (size_t i = s.length; !s.empty;) { if (s.endsWith(sub)) return cast(ptrdiff_t)i - to!(const(Char1)[])(sub).length; i -= strideBack(s, i); s = s[0 .. i]; } } } else { for (size_t i = s.length; !s.empty;) { if (endsWith!((a, b) => std.uni.toLower(a) == std.uni.toLower(b)) (s, sub)) { return cast(ptrdiff_t)i - to!(const(Char1)[])(sub).length; } i -= strideBack(s, i); s = s[0 .. i]; } } return -1; } @safe pure unittest { import std.conv : to; debug(string) trustedPrintf("string.lastIndexOf.unittest\n"); import std.exception; assertCTFEable!( { foreach (S; AliasSeq!(string, wstring, dstring)) { foreach (T; AliasSeq!(string, wstring, dstring)) (){ // avoid slow optimizations for large functions @@@BUG@@@ 2396 enum typeStr = S.stringof ~ " " ~ T.stringof; assert(lastIndexOf(cast(S)null, to!T("a")) == -1, typeStr); assert(lastIndexOf(to!S("abcdefcdef"), to!T("c")) == 6, typeStr); assert(lastIndexOf(to!S("abcdefcdef"), to!T("cd")) == 6, typeStr); assert(lastIndexOf(to!S("abcdefcdef"), to!T("ef")) == 8, typeStr); assert(lastIndexOf(to!S("abcdefCdef"), to!T("c")) == 2, typeStr); assert(lastIndexOf(to!S("abcdefCdef"), to!T("cd")) == 2, typeStr); assert(lastIndexOf(to!S("abcdefcdef"), to!T("x")) == -1, typeStr); assert(lastIndexOf(to!S("abcdefcdef"), to!T("xy")) == -1, typeStr); assert(lastIndexOf(to!S("abcdefcdef"), to!T("")) == 10, typeStr); assert(lastIndexOf(to!S("öabcdefcdef"), to!T("ö")) == 0, typeStr); assert(lastIndexOf(cast(S)null, to!T("a"), CaseSensitive.no) == -1, typeStr); assert(lastIndexOf(to!S("abcdefCdef"), to!T("c"), CaseSensitive.no) == 6, typeStr); assert(lastIndexOf(to!S("abcdefCdef"), to!T("cD"), CaseSensitive.no) == 6, typeStr); assert(lastIndexOf(to!S("abcdefcdef"), to!T("x"), CaseSensitive.no) == -1, typeStr); assert(lastIndexOf(to!S("abcdefcdef"), to!T("xy"), CaseSensitive.no) == -1, typeStr); assert(lastIndexOf(to!S("abcdefcdef"), to!T(""), CaseSensitive.no) == 10, typeStr); assert(lastIndexOf(to!S("öabcdefcdef"), to!T("ö"), CaseSensitive.no) == 0, typeStr); assert(lastIndexOf(to!S("abcdefcdef"), to!T("c"), CaseSensitive.no) == 6, typeStr); assert(lastIndexOf(to!S("abcdefcdef"), to!T("cd"), CaseSensitive.no) == 6, typeStr); assert(lastIndexOf(to!S("abcdefcdef"), to!T("def"), CaseSensitive.no) == 7, typeStr); assert(lastIndexOf(to!S("ödfeffgfff"), to!T("ö"), CaseSensitive.yes) == 0); S sPlts = "Mars: the fourth Rock (Planet) from the Sun."; S sMars = "Who\'s \'My Favorite Maritian?\'"; assert(lastIndexOf(sMars, to!T("RiTE maR"), CaseSensitive.no) == 14, typeStr); assert(lastIndexOf(sPlts, to!T("FOuRTh"), CaseSensitive.no) == 10, typeStr); assert(lastIndexOf(sMars, to!T("whO\'s \'MY"), CaseSensitive.no) == 0, typeStr); assert(lastIndexOf(sMars, to!T(sMars), CaseSensitive.no) == 0, typeStr); }(); foreach (cs; EnumMembers!CaseSensitive) { enum csString = to!string(cs); assert(lastIndexOf("\U00010143\u0100\U00010143hello", to!S("\u0100"), cs) == 4, csString); assert(lastIndexOf("\U00010143\u0100\U00010143hello"w, to!S("\u0100"), cs) == 2, csString); assert(lastIndexOf("\U00010143\u0100\U00010143hello"d, to!S("\u0100"), cs) == 1, csString); } } }); } @safe pure unittest // issue13529 { import std.conv : to; foreach (S; AliasSeq!(string, wstring, dstring)) { foreach (T; AliasSeq!(string, wstring, dstring)) { enum typeStr = S.stringof ~ " " ~ T.stringof; auto idx = lastIndexOf(to!T("Hällö Wörldö ö"),to!S("ö ö")); assert(idx != -1, to!string(idx) ~ " " ~ typeStr); idx = lastIndexOf(to!T("Hällö Wörldö ö"),to!S("ö öd")); assert(idx == -1, to!string(idx) ~ " " ~ typeStr); } } } /++ Params: s = string to search sub = substring to search for startIdx = the index into s to start searching from cs = CaseSensitive.yes or CaseSensitive.no Returns: the index of the last occurrence of $(D sub) in $(D s). If $(D sub) is not found, then $(D -1) is returned. The $(D startIdx) slices $(D s) in the following way $(D s[0 .. startIdx]). $(D startIdx) represents a codeunit index in $(D s). If the sequence ending at $(D startIdx) does not represent a well formed codepoint, then a $(XREF utf,UTFException) may be thrown. $(D cs) indicates whether the comparisons are case sensitive. +/ ptrdiff_t lastIndexOf(Char1, Char2)(const(Char1)[] s, const(Char2)[] sub, in size_t startIdx, in CaseSensitive cs = CaseSensitive.yes) @safe pure if (isSomeChar!Char1 && isSomeChar!Char2) { if (startIdx <= s.length) { return lastIndexOf(s[0u .. startIdx], sub, cs); } return -1; } @safe pure unittest { import std.conv : to; debug(string) trustedPrintf("string.lastIndexOf.unittest\n"); foreach(S; AliasSeq!(string, wstring, dstring)) { foreach(T; AliasSeq!(string, wstring, dstring)) (){ // avoid slow optimizations for large functions @@@BUG@@@ 2396 enum typeStr = S.stringof ~ " " ~ T.stringof; assert(lastIndexOf(cast(S)null, to!T("a")) == -1, typeStr); assert(lastIndexOf(to!S("abcdefcdef"), to!T("c"), 5) == 2, typeStr); assert(lastIndexOf(to!S("abcdefcdef"), to!T("cd"), 3) == -1, typeStr); assert(lastIndexOf(to!S("abcdefcdef"), to!T("ef"), 6) == 4, typeStr ~ format(" %u", lastIndexOf(to!S("abcdefcdef"), to!T("ef"), 6))); assert(lastIndexOf(to!S("abcdefCdef"), to!T("c"), 5) == 2, typeStr); assert(lastIndexOf(to!S("abcdefCdef"), to!T("cd"), 3) == -1, typeStr); assert(lastIndexOf(to!S("abcdefcdefx"), to!T("x"), 1) == -1, typeStr); assert(lastIndexOf(to!S("abcdefcdefxy"), to!T("xy"), 6) == -1, typeStr); assert(lastIndexOf(to!S("abcdefcdef"), to!T(""), 8) == 8, typeStr); assert(lastIndexOf(to!S("öafö"), to!T("ö"), 3) == 0, typeStr ~ to!string(lastIndexOf(to!S("öafö"), to!T("ö"), 3))); //BUG 10472 assert(lastIndexOf(cast(S)null, to!T("a"), 1, CaseSensitive.no) == -1, typeStr); assert(lastIndexOf(to!S("abcdefCdef"), to!T("c"), 5, CaseSensitive.no) == 2, typeStr); assert(lastIndexOf(to!S("abcdefCdef"), to!T("cD"), 4, CaseSensitive.no) == 2, typeStr ~ " " ~ to!string(lastIndexOf(to!S("abcdefCdef"), to!T("cD"), 3, CaseSensitive.no))); assert(lastIndexOf(to!S("abcdefcdef"), to!T("x"),3 , CaseSensitive.no) == -1, typeStr); assert(lastIndexOf(to!S("abcdefcdefXY"), to!T("xy"), 4, CaseSensitive.no) == -1, typeStr); assert(lastIndexOf(to!S("abcdefcdef"), to!T(""), 7, CaseSensitive.no) == 7, typeStr); assert(lastIndexOf(to!S("abcdefcdef"), to!T("c"), 4, CaseSensitive.no) == 2, typeStr); assert(lastIndexOf(to!S("abcdefcdef"), to!T("cd"), 4, CaseSensitive.no) == 2, typeStr); assert(lastIndexOf(to!S("abcdefcdef"), to!T("def"), 6, CaseSensitive.no) == 3, typeStr); assert(lastIndexOf(to!S(""), to!T(""), 0) == lastIndexOf(to!S(""), to!T("")), typeStr); }(); foreach(cs; EnumMembers!CaseSensitive) { enum csString = to!string(cs); assert(lastIndexOf("\U00010143\u0100\U00010143hello", to!S("\u0100"), 6, cs) == 4, csString); assert(lastIndexOf("\U00010143\u0100\U00010143hello"w, to!S("\u0100"), 6, cs) == 2, csString); assert(lastIndexOf("\U00010143\u0100\U00010143hello"d, to!S("\u0100"), 3, cs) == 1, csString); } } } private ptrdiff_t indexOfAnyNeitherImpl(bool forward, bool any, Char, Char2)( const(Char)[] haystack, const(Char2)[] needles, in CaseSensitive cs = CaseSensitive.yes) @safe pure if (isSomeChar!Char && isSomeChar!Char2) { import std.algorithm : canFind; if (cs == CaseSensitive.yes) { static if (forward) { static if (any) { import std.algorithm : findAmong; size_t n = haystack.findAmong(needles).length; return n ? haystack.length - n : -1; } else { foreach (idx, dchar hay; haystack) { if (!canFind(needles, hay)) { return idx; } } } } else { static if (any) { import std.utf : strideBack; import std.algorithm : findAmong; import std.range : retro; size_t n = haystack.retro.findAmong(needles).source.length; if (n) { return n - haystack.strideBack(n); } } else { foreach_reverse (idx, dchar hay; haystack) { if(!canFind(needles, hay)) { return idx; } } } } } else { if (needles.length <= 16 && needles.walkLength(17)) { size_t si = 0; dchar[16] scratch = void; foreach ( dchar c; needles) { scratch[si++] = std.uni.toLower(c); } static if (forward) { foreach (i, dchar c; haystack) { if (canFind(scratch[0 .. si], std.uni.toLower(c)) == any) { return i; } } } else { foreach_reverse (i, dchar c; haystack) { if (canFind(scratch[0 .. si], std.uni.toLower(c)) == any) { return i; } } } } else { static bool f(dchar a, dchar b) { return std.uni.toLower(a) == b; } static if (forward) { foreach (i, dchar c; haystack) { if (canFind!f(needles, std.uni.toLower(c)) == any) { return i; } } } else { foreach_reverse (i, dchar c; haystack) { if (canFind!f(needles, std.uni.toLower(c)) == any) { return i; } } } } } return -1; } /** Returns the index of the first occurence of any of the elements in $(D needles) in $(D haystack). If no element of $(D needles) is found, then $(D -1) is returned. Params: haystack = String to search for needles in. needles = Strings to search for in haystack. cs = Indicates whether the comparisons are case sensitive. */ ptrdiff_t indexOfAny(Char,Char2)(const(Char)[] haystack, const(Char2)[] needles, in CaseSensitive cs = CaseSensitive.yes) @safe pure if (isSomeChar!Char && isSomeChar!Char2) { return indexOfAnyNeitherImpl!(true, true)(haystack, needles, cs); } /// @safe pure unittest { import std.conv : to; ptrdiff_t i = "helloWorld".indexOfAny("Wr"); assert(i == 5); i = "öällo world".indexOfAny("lo "); assert(i == 4, to!string(i)); } @safe pure unittest { import std.conv : to; debug(string) trustedPrintf("string.indexOfAny.unittest\n"); import std.exception; assertCTFEable!( { foreach (S; AliasSeq!(string, wstring, dstring)) { foreach (T; AliasSeq!(string, wstring, dstring)) (){ // avoid slow optimizations for large functions @@@BUG@@@ 2396 assert(indexOfAny(cast(S)null, to!T("a")) == -1); assert(indexOfAny(to!S("def"), to!T("rsa")) == -1); assert(indexOfAny(to!S("abba"), to!T("a")) == 0); assert(indexOfAny(to!S("def"), to!T("f")) == 2); assert(indexOfAny(to!S("dfefffg"), to!T("fgh")) == 1); assert(indexOfAny(to!S("dfeffgfff"), to!T("feg")) == 1); assert(indexOfAny(to!S("zfeffgfff"), to!T("ACDC"), CaseSensitive.no) == -1); assert(indexOfAny(to!S("def"), to!T("MI6"), CaseSensitive.no) == -1); assert(indexOfAny(to!S("abba"), to!T("DEA"), CaseSensitive.no) == 0); assert(indexOfAny(to!S("def"), to!T("FBI"), CaseSensitive.no) == 2); assert(indexOfAny(to!S("dfefffg"), to!T("NSA"), CaseSensitive.no) == -1); assert(indexOfAny(to!S("dfeffgfff"), to!T("BND"), CaseSensitive.no) == 0); assert(indexOfAny(to!S("dfeffgfff"), to!T("BNDabCHIJKQEPÖÖSYXÄ??ß"), CaseSensitive.no) == 0); assert(indexOfAny("\u0100", to!T("\u0100"), CaseSensitive.no) == 0); }(); } } ); } /** Returns the index of the first occurence of any of the elements in $(D needles) in $(D haystack). If no element of $(D needles) is found, then $(D -1) is returned. The $(D startIdx) slices $(D s) in the following way $(D haystack[startIdx .. $]). $(D startIdx) represents a codeunit index in $(D haystack). If the sequence ending at $(D startIdx) does not represent a well formed codepoint, then a $(XREF utf,UTFException) may be thrown. Params: haystack = String to search for needles in. needles = Strings to search for in haystack. startIdx = slices haystack like this $(D haystack[startIdx .. $]). If the startIdx is greater equal the length of haystack the functions returns $(D -1). cs = Indicates whether the comparisons are case sensitive. */ ptrdiff_t indexOfAny(Char,Char2)(const(Char)[] haystack, const(Char2)[] needles, in size_t startIdx, in CaseSensitive cs = CaseSensitive.yes) @safe pure if (isSomeChar!Char && isSomeChar!Char2) { if (startIdx < haystack.length) { ptrdiff_t foundIdx = indexOfAny(haystack[startIdx .. $], needles, cs); if (foundIdx != -1) { return foundIdx + cast(ptrdiff_t)startIdx; } } return -1; } /// @safe pure unittest { import std.conv : to; ptrdiff_t i = "helloWorld".indexOfAny("Wr", 4); assert(i == 5); i = "Foo öällo world".indexOfAny("lh", 3); assert(i == 8, to!string(i)); } @safe pure unittest { import std.conv : to; debug(string) trustedPrintf("string.indexOfAny(startIdx).unittest\n"); foreach(S; AliasSeq!(string, wstring, dstring)) { foreach(T; AliasSeq!(string, wstring, dstring)) (){ // avoid slow optimizations for large functions @@@BUG@@@ 2396 assert(indexOfAny(cast(S)null, to!T("a"), 1337) == -1); assert(indexOfAny(to!S("def"), to!T("AaF"), 0) == -1); assert(indexOfAny(to!S("abba"), to!T("NSa"), 2) == 3); assert(indexOfAny(to!S("def"), to!T("fbi"), 1) == 2); assert(indexOfAny(to!S("dfefffg"), to!T("foo"), 2) == 3); assert(indexOfAny(to!S("dfeffgfff"), to!T("fsb"), 5) == 6); assert(indexOfAny(to!S("dfeffgfff"), to!T("NDS"), 1, CaseSensitive.no) == -1); assert(indexOfAny(to!S("def"), to!T("DRS"), 2, CaseSensitive.no) == -1); assert(indexOfAny(to!S("abba"), to!T("SI"), 3, CaseSensitive.no) == -1); assert(indexOfAny(to!S("deO"), to!T("ASIO"), 1, CaseSensitive.no) == 2); assert(indexOfAny(to!S("dfefffg"), to!T("fbh"), 2, CaseSensitive.no) == 3); assert(indexOfAny(to!S("dfeffgfff"), to!T("fEe"), 4, CaseSensitive.no) == 4); assert(indexOfAny(to!S("dfeffgffföä"), to!T("föä"), 9, CaseSensitive.no) == 9); assert(indexOfAny("\u0100", to!T("\u0100"), 0, CaseSensitive.no) == 0); }(); foreach(cs; EnumMembers!CaseSensitive) { assert(indexOfAny("hello\U00010143\u0100\U00010143", to!S("e\u0100"), 3, cs) == 9); assert(indexOfAny("hello\U00010143\u0100\U00010143"w, to!S("h\u0100"), 3, cs) == 7); assert(indexOfAny("hello\U00010143\u0100\U00010143"d, to!S("l\u0100"), 5, cs) == 6); } } } /** Returns the index of the last occurence of any of the elements in $(D needles) in $(D haystack). If no element of $(D needles) is found, then $(D -1) is returned. Params: haystack = String to search for needles in. needles = Strings to search for in haystack. cs = Indicates whether the comparisons are case sensitive. */ ptrdiff_t lastIndexOfAny(Char,Char2)(const(Char)[] haystack, const(Char2)[] needles, in CaseSensitive cs = CaseSensitive.yes) @safe pure if (isSomeChar!Char && isSomeChar!Char2) { return indexOfAnyNeitherImpl!(false, true)(haystack, needles, cs); } /// @safe pure unittest { ptrdiff_t i = "helloWorld".lastIndexOfAny("Wlo"); assert(i == 8); i = "Foo öäöllo world".lastIndexOfAny("öF"); assert(i == 8); } @safe pure unittest { import std.conv : to; debug(string) trustedPrintf("string.lastIndexOfAny.unittest\n"); import std.exception; assertCTFEable!( { foreach (S; AliasSeq!(string, wstring, dstring)) { foreach (T; AliasSeq!(string, wstring, dstring)) (){ // avoid slow optimizations for large functions @@@BUG@@@ 2396 assert(lastIndexOfAny(cast(S)null, to!T("a")) == -1); assert(lastIndexOfAny(to!S("def"), to!T("rsa")) == -1); assert(lastIndexOfAny(to!S("abba"), to!T("a")) == 3); assert(lastIndexOfAny(to!S("def"), to!T("f")) == 2); assert(lastIndexOfAny(to!S("dfefffg"), to!T("fgh")) == 6); ptrdiff_t oeIdx = 9; if (is(S == wstring) || is(S == dstring)) { oeIdx = 8; } auto foundOeIdx = lastIndexOfAny(to!S("dfeffgföf"), to!T("feg")); assert(foundOeIdx == oeIdx, to!string(foundOeIdx)); assert(lastIndexOfAny(to!S("zfeffgfff"), to!T("ACDC"), CaseSensitive.no) == -1); assert(lastIndexOfAny(to!S("def"), to!T("MI6"), CaseSensitive.no) == -1); assert(lastIndexOfAny(to!S("abba"), to!T("DEA"), CaseSensitive.no) == 3); assert(lastIndexOfAny(to!S("def"), to!T("FBI"), CaseSensitive.no) == 2); assert(lastIndexOfAny(to!S("dfefffg"), to!T("NSA"), CaseSensitive.no) == -1); oeIdx = 2; if (is(S == wstring) || is(S == dstring)) { oeIdx = 1; } assert(lastIndexOfAny(to!S("ödfeffgfff"), to!T("BND"), CaseSensitive.no) == oeIdx); assert(lastIndexOfAny("\u0100", to!T("\u0100"), CaseSensitive.no) == 0); }(); } } ); } /** Returns the index of the last occurence of any of the elements in $(D needles) in $(D haystack). If no element of $(D needles) is found, then $(D -1) is returned. The $(D stopIdx) slices $(D s) in the following way $(D s[0 .. stopIdx]). $(D stopIdx) represents a codeunit index in $(D s). If the sequence ending at $(D startIdx) does not represent a well formed codepoint, then a $(XREF utf,UTFException) may be thrown. Params: haystack = String to search for needles in. needles = Strings to search for in haystack. stopIdx = slices haystack like this $(D haystack[0 .. stopIdx]). If the stopIdx is greater equal the length of haystack the functions returns $(D -1). cs = Indicates whether the comparisons are case sensitive. */ ptrdiff_t lastIndexOfAny(Char,Char2)(const(Char)[] haystack, const(Char2)[] needles, in size_t stopIdx, in CaseSensitive cs = CaseSensitive.yes) @safe pure if (isSomeChar!Char && isSomeChar!Char2) { if (stopIdx <= haystack.length) { return lastIndexOfAny(haystack[0u .. stopIdx], needles, cs); } return -1; } /// @safe pure unittest { import std.conv : to; ptrdiff_t i = "helloWorld".lastIndexOfAny("Wlo", 4); assert(i == 3); i = "Foo öäöllo world".lastIndexOfAny("öF", 3); assert(i == 0); } @safe pure unittest { import std.conv : to; debug(string) trustedPrintf("string.lastIndexOfAny(index).unittest\n"); import std.exception; assertCTFEable!( { foreach (S; AliasSeq!(string, wstring, dstring)) { foreach (T; AliasSeq!(string, wstring, dstring)) (){ // avoid slow optimizations for large functions @@@BUG@@@ 2396 enum typeStr = S.stringof ~ " " ~ T.stringof; assert(lastIndexOfAny(cast(S)null, to!T("a"), 1337) == -1, typeStr); assert(lastIndexOfAny(to!S("abcdefcdef"), to!T("c"), 7) == 6, typeStr); assert(lastIndexOfAny(to!S("abcdefcdef"), to!T("cd"), 5) == 3, typeStr); assert(lastIndexOfAny(to!S("abcdefcdef"), to!T("ef"), 6) == 5, typeStr); assert(lastIndexOfAny(to!S("abcdefCdef"), to!T("c"), 8) == 2, typeStr); assert(lastIndexOfAny(to!S("abcdefcdef"), to!T("x"), 7) == -1, typeStr); assert(lastIndexOfAny(to!S("abcdefcdef"), to!T("xy"), 4) == -1, typeStr); assert(lastIndexOfAny(to!S("öabcdefcdef"), to!T("ö"), 2) == 0, typeStr); assert(lastIndexOfAny(cast(S)null, to!T("a"), 1337, CaseSensitive.no) == -1, typeStr); assert(lastIndexOfAny(to!S("abcdefcdef"), to!T("C"), 7, CaseSensitive.no) == 6, typeStr); assert(lastIndexOfAny(to!S("ABCDEFCDEF"), to!T("cd"), 5, CaseSensitive.no) == 3, typeStr); assert(lastIndexOfAny(to!S("abcdefcdef"), to!T("EF"), 6, CaseSensitive.no) == 5, typeStr); assert(lastIndexOfAny(to!S("ABCDEFcDEF"), to!T("C"), 8, CaseSensitive.no) == 6, typeStr); assert(lastIndexOfAny(to!S("ABCDEFCDEF"), to!T("x"), 7, CaseSensitive.no) == -1, typeStr); assert(lastIndexOfAny(to!S("abCdefcdef"), to!T("XY"), 4, CaseSensitive.no) == -1, typeStr); assert(lastIndexOfAny(to!S("ÖABCDEFCDEF"), to!T("ö"), 2, CaseSensitive.no) == 0, typeStr); }(); } } ); } /** Returns the index of the first occurence of any character not an elements in $(D needles) in $(D haystack). If all element of $(D haystack) are element of $(D needles) $(D -1) is returned. Params: haystack = String to search for needles in. needles = Strings to search for in haystack. cs = Indicates whether the comparisons are case sensitive. */ ptrdiff_t indexOfNeither(Char,Char2)(const(Char)[] haystack, const(Char2)[] needles, in CaseSensitive cs = CaseSensitive.yes) @safe pure if (isSomeChar!Char && isSomeChar!Char2) { return indexOfAnyNeitherImpl!(true, false)(haystack, needles, cs); } /// @safe pure unittest { assert(indexOfNeither("def", "a") == 0); assert(indexOfNeither("def", "de") == 2); assert(indexOfNeither("dfefffg", "dfe") == 6); } @safe pure unittest { import std.conv : to; debug(string) trustedPrintf("string.indexOf.unittest\n"); import std.exception; assertCTFEable!( { foreach (S; AliasSeq!(string, wstring, dstring)) { foreach (T; AliasSeq!(string, wstring, dstring)) (){ // avoid slow optimizations for large functions @@@BUG@@@ 2396 assert(indexOfNeither(cast(S)null, to!T("a")) == -1); assert(indexOfNeither("abba", "a") == 1); assert(indexOfNeither(to!S("dfeffgfff"), to!T("a"), CaseSensitive.no) == 0); assert(indexOfNeither(to!S("def"), to!T("D"), CaseSensitive.no) == 1); assert(indexOfNeither(to!S("ABca"), to!T("a"), CaseSensitive.no) == 1); assert(indexOfNeither(to!S("def"), to!T("f"), CaseSensitive.no) == 0); assert(indexOfNeither(to!S("DfEfffg"), to!T("dFe"), CaseSensitive.no) == 6); if (is(S == string)) { assert(indexOfNeither(to!S("äDfEfffg"), to!T("ädFe"), CaseSensitive.no) == 8, to!string(indexOfNeither(to!S("äDfEfffg"), to!T("ädFe"), CaseSensitive.no))); } else { assert(indexOfNeither(to!S("äDfEfffg"), to!T("ädFe"), CaseSensitive.no) == 7, to!string(indexOfNeither(to!S("äDfEfffg"), to!T("ädFe"), CaseSensitive.no))); } }(); } } ); } /** Returns the index of the first occurence of any character not an elements in $(D needles) in $(D haystack). If all element of $(D haystack) are element of $(D needles) $(D -1) is returned. Params: haystack = String to search for needles in. needles = Strings to search for in haystack. startIdx = slices haystack like this $(D haystack[startIdx .. $]). If the startIdx is greater equal the length of haystack the functions returns $(D -1). cs = Indicates whether the comparisons are case sensitive. */ ptrdiff_t indexOfNeither(Char,Char2)(const(Char)[] haystack, const(Char2)[] needles, in size_t startIdx, in CaseSensitive cs = CaseSensitive.yes) @safe pure if (isSomeChar!Char && isSomeChar!Char2) { if (startIdx < haystack.length) { ptrdiff_t foundIdx = indexOfAnyNeitherImpl!(true, false)( haystack[startIdx .. $], needles, cs); if (foundIdx != -1) { return foundIdx + cast(ptrdiff_t)startIdx; } } return -1; } /// @safe pure unittest { assert(indexOfNeither("abba", "a", 2) == 2); assert(indexOfNeither("def", "de", 1) == 2); assert(indexOfNeither("dfefffg", "dfe", 4) == 6); } @safe pure unittest { import std.conv : to; debug(string) trustedPrintf("string.indexOfNeither(index).unittest\n"); import std.exception; assertCTFEable!( { foreach (S; AliasSeq!(string, wstring, dstring)) { foreach (T; AliasSeq!(string, wstring, dstring)) (){ // avoid slow optimizations for large functions @@@BUG@@@ 2396 assert(indexOfNeither(cast(S)null, to!T("a"), 1) == -1); assert(indexOfNeither(to!S("def"), to!T("a"), 1) == 1, to!string(indexOfNeither(to!S("def"), to!T("a"), 1))); assert(indexOfNeither(to!S("dfeffgfff"), to!T("a"), 4, CaseSensitive.no) == 4); assert(indexOfNeither(to!S("def"), to!T("D"), 2, CaseSensitive.no) == 2); assert(indexOfNeither(to!S("ABca"), to!T("a"), 3, CaseSensitive.no) == -1); assert(indexOfNeither(to!S("def"), to!T("tzf"), 2, CaseSensitive.no) == -1); assert(indexOfNeither(to!S("DfEfffg"), to!T("dFe"), 5, CaseSensitive.no) == 6); if (is(S == string)) { assert(indexOfNeither(to!S("öDfEfffg"), to!T("äDi"), 2, CaseSensitive.no) == 3, to!string(indexOfNeither( to!S("öDfEfffg"), to!T("äDi"), 2, CaseSensitive.no))); } else { assert(indexOfNeither(to!S("öDfEfffg"), to!T("äDi"), 2, CaseSensitive.no) == 2, to!string(indexOfNeither( to!S("öDfEfffg"), to!T("äDi"), 2, CaseSensitive.no))); } }(); } } ); } /** Returns the last index of the first occurence of any character that is not an elements in $(D needles) in $(D haystack). If all element of $(D haystack) are element of $(D needles) $(D -1) is returned. Params: haystack = String to search for needles in. needles = Strings to search for in haystack. cs = Indicates whether the comparisons are case sensitive. */ ptrdiff_t lastIndexOfNeither(Char,Char2)(const(Char)[] haystack, const(Char2)[] needles, in CaseSensitive cs = CaseSensitive.yes) @safe pure if (isSomeChar!Char && isSomeChar!Char2) { return indexOfAnyNeitherImpl!(false, false)(haystack, needles, cs); } /// @safe pure unittest { assert(lastIndexOfNeither("abba", "a") == 2); assert(lastIndexOfNeither("def", "f") == 1); } @safe pure unittest { import std.conv : to; debug(string) trustedPrintf("string.lastIndexOfNeither.unittest\n"); import std.exception; assertCTFEable!( { foreach (S; AliasSeq!(string, wstring, dstring)) { foreach (T; AliasSeq!(string, wstring, dstring)) (){ // avoid slow optimizations for large functions @@@BUG@@@ 2396 assert(lastIndexOfNeither(cast(S)null, to!T("a")) == -1); assert(lastIndexOfNeither(to!S("def"), to!T("rsa")) == 2); assert(lastIndexOfNeither(to!S("dfefffg"), to!T("fgh")) == 2); ptrdiff_t oeIdx = 8; if (is(S == string)) { oeIdx = 9; } auto foundOeIdx = lastIndexOfNeither(to!S("ödfefegff"), to!T("zeg")); assert(foundOeIdx == oeIdx, to!string(foundOeIdx)); assert(lastIndexOfNeither(to!S("zfeffgfsb"), to!T("FSB"), CaseSensitive.no) == 5); assert(lastIndexOfNeither(to!S("def"), to!T("MI6"), CaseSensitive.no) == 2, to!string(lastIndexOfNeither(to!S("def"), to!T("MI6"), CaseSensitive.no))); assert(lastIndexOfNeither(to!S("abbadeafsb"), to!T("fSb"), CaseSensitive.no) == 6, to!string(lastIndexOfNeither( to!S("abbadeafsb"), to!T("fSb"), CaseSensitive.no))); assert(lastIndexOfNeither(to!S("defbi"), to!T("FBI"), CaseSensitive.no) == 1); assert(lastIndexOfNeither(to!S("dfefffg"), to!T("NSA"), CaseSensitive.no) == 6); assert(lastIndexOfNeither(to!S("dfeffgfffö"), to!T("BNDabCHIJKQEPÖÖSYXÄ??ß"), CaseSensitive.no) == 8, to!string(lastIndexOfNeither(to!S("dfeffgfffö"), to!T("BNDabCHIJKQEPÖÖSYXÄ??ß"), CaseSensitive.no))); }(); } } ); } /** Returns the last index of the first occurence of any character that is not an elements in $(D needles) in $(D haystack). If all element of $(D haystack) are element of $(D needles) $(D -1) is returned. Params: haystack = String to search for needles in. needles = Strings to search for in haystack. stopIdx = slices haystack like this $(D haystack[0 .. stopIdx]) If the stopIdx is greater equal the length of haystack the functions returns $(D -1). cs = Indicates whether the comparisons are case sensitive. */ ptrdiff_t lastIndexOfNeither(Char,Char2)(const(Char)[] haystack, const(Char2)[] needles, in size_t stopIdx, in CaseSensitive cs = CaseSensitive.yes) @safe pure if (isSomeChar!Char && isSomeChar!Char2) { if (stopIdx < haystack.length) { return indexOfAnyNeitherImpl!(false, false)(haystack[0 .. stopIdx], needles, cs); } return -1; } /// @safe pure unittest { assert(lastIndexOfNeither("def", "rsa", 3) == -1); assert(lastIndexOfNeither("abba", "a", 2) == 1); } @safe pure unittest { import std.conv : to; debug(string) trustedPrintf("string.lastIndexOfNeither(index).unittest\n"); import std.exception; assertCTFEable!( { foreach (S; AliasSeq!(string, wstring, dstring)) { foreach (T; AliasSeq!(string, wstring, dstring)) (){ // avoid slow optimizations for large functions @@@BUG@@@ 2396 assert(lastIndexOfNeither(cast(S)null, to!T("a"), 1337) == -1); assert(lastIndexOfNeither(to!S("def"), to!T("f")) == 1); assert(lastIndexOfNeither(to!S("dfefffg"), to!T("fgh")) == 2); ptrdiff_t oeIdx = 4; if (is(S == string)) { oeIdx = 5; } auto foundOeIdx = lastIndexOfNeither(to!S("ödfefegff"), to!T("zeg"), 7); assert(foundOeIdx == oeIdx, to!string(foundOeIdx)); assert(lastIndexOfNeither(to!S("zfeffgfsb"), to!T("FSB"), 6, CaseSensitive.no) == 5); assert(lastIndexOfNeither(to!S("def"), to!T("MI6"), 2, CaseSensitive.no) == 1, to!string(lastIndexOfNeither(to!S("def"), to!T("MI6"), 2, CaseSensitive.no))); assert(lastIndexOfNeither(to!S("abbadeafsb"), to!T("fSb"), 6, CaseSensitive.no) == 5, to!string(lastIndexOfNeither( to!S("abbadeafsb"), to!T("fSb"), 6, CaseSensitive.no))); assert(lastIndexOfNeither(to!S("defbi"), to!T("FBI"), 3, CaseSensitive.no) == 1); assert(lastIndexOfNeither(to!S("dfefffg"), to!T("NSA"), 2, CaseSensitive.no) == 1, to!string(lastIndexOfNeither( to!S("dfefffg"), to!T("NSA"), 2, CaseSensitive.no))); }(); } } ); } /** * Returns the _representation of a string, which has the same type * as the string except the character type is replaced by $(D ubyte), * $(D ushort), or $(D uint) depending on the character width. * * Params: * s = The string to return the _representation of. * * Returns: * The _representation of the passed string. */ auto representation(Char)(Char[] s) @safe pure nothrow @nogc if (isSomeChar!Char) { alias ToRepType(T) = AliasSeq!(ubyte, ushort, uint)[T.sizeof / 2]; return cast(ModifyTypePreservingTQ!(ToRepType, Char)[])s; } /// @safe pure unittest { string s = "hello"; static assert(is(typeof(representation(s)) == immutable(ubyte)[])); assert(representation(s) is cast(immutable(ubyte)[]) s); assert(representation(s) == [0x68, 0x65, 0x6c, 0x6c, 0x6f]); } @trusted pure unittest { import std.exception; import std.typecons; assertCTFEable!( { void test(Char, T)(Char[] str) { static assert(is(typeof(representation(str)) == T[])); assert(representation(str) is cast(T[]) str); } foreach (Type; AliasSeq!(Tuple!(char , ubyte ), Tuple!(wchar, ushort), Tuple!(dchar, uint ))) { alias Char = Fields!Type[0]; alias Int = Fields!Type[1]; enum immutable(Char)[] hello = "hello"; test!( immutable Char, immutable Int)(hello); test!( const Char, const Int)(hello); test!( Char, Int)(hello.dup); test!( shared Char, shared Int)(cast(shared) hello.dup); test!(const shared Char, const shared Int)(hello); } }); } /** * Capitalize the first character of $(D s) and convert the rest of $(D s) to * lowercase. * * Params: * input = The string to _capitalize. * * Returns: * The capitalized string. * * See_Also: * $(XREF uni, toCapitalized) for a lazy range version that doesn't allocate memory */ S capitalize(S)(S s) @trusted pure if (isSomeString!S) { import std.utf : encode; Unqual!(typeof(s[0]))[] retval; bool changed = false; foreach (i, dchar c; s) { dchar c2; if (i == 0) { c2 = std.uni.toUpper(c); if (c != c2) changed = true; } else { c2 = std.uni.toLower(c); if (c != c2) { if (!changed) { changed = true; retval = s[0 .. i].dup; } } } if (changed) std.utf.encode(retval, c2); } return changed ? cast(S)retval : s; } /// pure @safe unittest { assert(capitalize("hello") == "Hello"); assert(capitalize("World") == "World"); } auto capitalize(S)(auto ref S s) if (!isSomeString!S && is(StringTypeOf!S)) { return capitalize!(StringTypeOf!S)(s); } unittest { assert(testAliasedString!capitalize("hello")); } @trusted pure unittest { import std.conv : to; import std.algorithm : cmp; import std.exception; assertCTFEable!( { foreach (S; AliasSeq!(string, wstring, dstring, char[], wchar[], dchar[])) { S s1 = to!S("FoL"); S s2; s2 = capitalize(s1); assert(cmp(s2, "Fol") == 0); assert(s2 !is s1); s2 = capitalize(s1[0 .. 2]); assert(cmp(s2, "Fo") == 0); assert(s2.ptr == s1.ptr); s1 = to!S("fOl"); s2 = capitalize(s1); assert(cmp(s2, "Fol") == 0); assert(s2 !is s1); s1 = to!S("\u0131 \u0130"); s2 = capitalize(s1); assert(cmp(s2, "\u0049 \u0069") == 0); assert(s2 !is s1); s1 = to!S("\u017F \u0049"); s2 = capitalize(s1); assert(cmp(s2, "\u0053 \u0069") == 0); assert(s2 !is s1); } }); } /++ Split $(D s) into an array of lines according to the unicode standard using $(D '\r'), $(D '\n'), $(D "\r\n"), $(XREF uni, lineSep), $(XREF uni, paraSep), $(D U+0085) (NEL), $(D '\v') and $(D '\f') as delimiters. If $(D keepTerm) is set to $(D KeepTerminator.yes), then the delimiter is included in the strings returned. Does not throw on invalid UTF; such is simply passed unchanged to the output. Allocates memory; use $(LREF lineSplitter) for an alternative that does not. Adheres to $(WEB http://www.unicode.org/versions/Unicode7.0.0/ch05.pdf, Unicode 7.0). Params: s = a string of $(D chars), $(D wchars), or $(D dchars), or any custom type that casts to a $(D string) type keepTerm = whether delimiter is included or not in the results Returns: array of strings, each element is a line that is a slice of $(D s) See_Also: $(LREF lineSplitter) $(XREF algorithm, splitter) $(XREF regex, splitter) +/ alias KeepTerminator = Flag!"keepTerminator"; /// ditto S[] splitLines(S)(S s, in KeepTerminator keepTerm = KeepTerminator.no) @safe pure if (isSomeString!S) { import std.uni : lineSep, paraSep; import std.array : appender; size_t iStart = 0; auto retval = appender!(S[])(); for (size_t i; i < s.length; ++i) { switch (s[i]) { case '\v', '\f', '\n': retval.put(s[iStart .. i + (keepTerm == KeepTerminator.yes)]); iStart = i + 1; break; case '\r': if (i + 1 < s.length && s[i + 1] == '\n') { retval.put(s[iStart .. i + (keepTerm == KeepTerminator.yes) * 2]); iStart = i + 2; ++i; } else { goto case '\n'; } break; static if (s[i].sizeof == 1) { /* Manually decode: * lineSep is E2 80 A8 * paraSep is E2 80 A9 */ case 0xE2: if (i + 2 < s.length && s[i + 1] == 0x80 && (s[i + 2] == 0xA8 || s[i + 2] == 0xA9) ) { retval.put(s[iStart .. i + (keepTerm == KeepTerminator.yes) * 3]); iStart = i + 3; i += 2; } else goto default; break; /* Manually decode: * NEL is C2 85 */ case 0xC2: if(i + 1 < s.length && s[i + 1] == 0x85) { retval.put(s[iStart .. i + (keepTerm == KeepTerminator.yes) * 2]); iStart = i + 2; i += 1; } else goto default; break; } else { case lineSep: case paraSep: case '\u0085': goto case '\n'; } default: break; } } if (iStart != s.length) retval.put(s[iStart .. $]); return retval.data; } /// unittest { string s = "Hello\nmy\rname\nis"; assert(splitLines(s) == ["Hello", "my", "name", "is"]); } auto splitLines(S)(auto ref S s, in KeepTerminator keepTerm = KeepTerminator.no) if (!isSomeString!S && is(StringTypeOf!S)) { return splitLines!(StringTypeOf!S)(s, keepTerm); } unittest { assert(testAliasedString!splitLines("hello\nworld")); } @safe pure unittest { import std.conv : to; debug(string) trustedPrintf("string.splitLines.unittest\n"); import std.exception; assertCTFEable!( { foreach (S; AliasSeq!(char[], wchar[], dchar[], string, wstring, dstring)) { auto s = to!S( "\rpeter\n\rpaul\r\njerry\u2028ice\u2029cream\n\nsunday\n" ~ "mon\u2030day\nschadenfreude\vkindergarten\f\vcookies\u0085" ); auto lines = splitLines(s); assert(lines.length == 14); assert(lines[0] == ""); assert(lines[1] == "peter"); assert(lines[2] == ""); assert(lines[3] == "paul"); assert(lines[4] == "jerry"); assert(lines[5] == "ice"); assert(lines[6] == "cream"); assert(lines[7] == ""); assert(lines[8] == "sunday"); assert(lines[9] == "mon\u2030day"); assert(lines[10] == "schadenfreude"); assert(lines[11] == "kindergarten"); assert(lines[12] == ""); assert(lines[13] == "cookies"); ubyte[] u = ['a', 0xFF, 0x12, 'b']; // invalid UTF auto ulines = splitLines(cast(char[])u); assert(cast(ubyte[])(ulines[0]) == u); lines = splitLines(s, KeepTerminator.yes); assert(lines.length == 14); assert(lines[0] == "\r"); assert(lines[1] == "peter\n"); assert(lines[2] == "\r"); assert(lines[3] == "paul\r\n"); assert(lines[4] == "jerry\u2028"); assert(lines[5] == "ice\u2029"); assert(lines[6] == "cream\n"); assert(lines[7] == "\n"); assert(lines[8] == "sunday\n"); assert(lines[9] == "mon\u2030day\n"); assert(lines[10] == "schadenfreude\v"); assert(lines[11] == "kindergarten\f"); assert(lines[12] == "\v"); assert(lines[13] == "cookies\u0085"); s.popBack(); // Lop-off trailing \n lines = splitLines(s); assert(lines.length == 14); assert(lines[9] == "mon\u2030day"); lines = splitLines(s, KeepTerminator.yes); assert(lines.length == 14); assert(lines[13] == "cookies"); } }); } private struct LineSplitter(KeepTerminator keepTerm = KeepTerminator.no, Range) { import std.uni : lineSep, paraSep; import std.conv : unsigned; private: Range _input; alias IndexType = typeof(unsigned(_input.length)); enum IndexType _unComputed = IndexType.max; IndexType iStart = _unComputed; IndexType iEnd = 0; IndexType iNext = 0; public: this(Range input) { _input = input; } static if (isInfinite!Range) { enum bool empty = false; } else { @property bool empty() { return iStart == _unComputed && iNext == _input.length; } } @property typeof(_input) front() { if (iStart == _unComputed) { iStart = iNext; Loop: for (IndexType i = iNext; ; ++i) { if (i == _input.length) { iEnd = i; iNext = i; break Loop; } switch (_input[i]) { case '\v', '\f', '\n': iEnd = i + (keepTerm == KeepTerminator.yes); iNext = i + 1; break Loop; case '\r': if (i + 1 < _input.length && _input[i + 1] == '\n') { iEnd = i + (keepTerm == KeepTerminator.yes) * 2; iNext = i + 2; break Loop; } else { goto case '\n'; } static if (_input[i].sizeof == 1) { /* Manually decode: * lineSep is E2 80 A8 * paraSep is E2 80 A9 */ case 0xE2: if (i + 2 < _input.length && _input[i + 1] == 0x80 && (_input[i + 2] == 0xA8 || _input[i + 2] == 0xA9) ) { iEnd = i + (keepTerm == KeepTerminator.yes) * 3; iNext = i + 3; break Loop; } else goto default; /* Manually decode: * NEL is C2 85 */ case 0xC2: if(i + 1 < _input.length && _input[i + 1] == 0x85) { iEnd = i + (keepTerm == KeepTerminator.yes) * 2; iNext = i + 2; break Loop; } else goto default; } else { case '\u0085': case lineSep: case paraSep: goto case '\n'; } default: break; } } } return _input[iStart .. iEnd]; } void popFront() { if (iStart == _unComputed) { assert(!empty); front(); } iStart = _unComputed; } static if (isForwardRange!Range) { @property typeof(this) save() { auto ret = this; ret._input = _input.save; return ret; } } } /*********************************** * Split an array or slicable range of characters into a range of lines using $(D '\r'), $(D '\n'), $(D '\v'), $(D '\f'), $(D "\r\n"), $(XREF uni, lineSep), $(XREF uni, paraSep) and $(D '\u0085') (NEL) as delimiters. If $(D keepTerm) is set to $(D KeepTerminator.yes), then the delimiter is included in the slices returned. Does not throw on invalid UTF; such is simply passed unchanged to the output. Adheres to $(WEB http://www.unicode.org/versions/Unicode7.0.0/ch05.pdf, Unicode 7.0). Does not allocate memory. Params: r = array of $(D chars), $(D wchars), or $(D dchars) or a slicable range keepTerm = whether delimiter is included or not in the results Returns: range of slices of the input range $(D r) See_Also: $(LREF splitLines) $(XREF algorithm, splitter) $(XREF regex, splitter) */ auto lineSplitter(KeepTerminator keepTerm = KeepTerminator.no, Range)(Range r) if ((hasSlicing!Range && hasLength!Range && isSomeChar!(ElementType!Range) || isSomeString!Range) && !isConvertibleToString!Range) { return LineSplitter!(keepTerm, Range)(r); } auto lineSplitter(KeepTerminator keepTerm = KeepTerminator.no, Range)(auto ref Range r) if (isConvertibleToString!Range) { return LineSplitter!(keepTerm, StringTypeOf!Range)(r); } @safe pure unittest { import std.conv : to; import std.array : array; debug(string) trustedPrintf("string.lineSplitter.unittest\n"); import std.exception; assertCTFEable!( { foreach (S; AliasSeq!(char[], wchar[], dchar[], string, wstring, dstring)) { auto s = to!S( "\rpeter\n\rpaul\r\njerry\u2028ice\u2029cream\n\n" ~ "sunday\nmon\u2030day\nschadenfreude\vkindergarten\f\vcookies\u0085" ); auto lines = lineSplitter(s).array; assert(lines.length == 14); assert(lines[0] == ""); assert(lines[1] == "peter"); assert(lines[2] == ""); assert(lines[3] == "paul"); assert(lines[4] == "jerry"); assert(lines[5] == "ice"); assert(lines[6] == "cream"); assert(lines[7] == ""); assert(lines[8] == "sunday"); assert(lines[9] == "mon\u2030day"); assert(lines[10] == "schadenfreude"); assert(lines[11] == "kindergarten"); assert(lines[12] == ""); assert(lines[13] == "cookies"); ubyte[] u = ['a', 0xFF, 0x12, 'b']; // invalid UTF auto ulines = lineSplitter(cast(char[])u).array; assert(cast(ubyte[])(ulines[0]) == u); lines = lineSplitter!(KeepTerminator.yes)(s).array; assert(lines.length == 14); assert(lines[0] == "\r"); assert(lines[1] == "peter\n"); assert(lines[2] == "\r"); assert(lines[3] == "paul\r\n"); assert(lines[4] == "jerry\u2028"); assert(lines[5] == "ice\u2029"); assert(lines[6] == "cream\n"); assert(lines[7] == "\n"); assert(lines[8] == "sunday\n"); assert(lines[9] == "mon\u2030day\n"); assert(lines[10] == "schadenfreude\v"); assert(lines[11] == "kindergarten\f"); assert(lines[12] == "\v"); assert(lines[13] == "cookies\u0085"); s.popBack(); // Lop-off trailing \n lines = lineSplitter(s).array; assert(lines.length == 14); assert(lines[9] == "mon\u2030day"); lines = lineSplitter!(KeepTerminator.yes)(s).array; assert(lines.length == 14); assert(lines[13] == "cookies"); } }); } /// @nogc @safe pure unittest { auto s = "\rpeter\n\rpaul\r\njerry\u2028ice\u2029cream\n\nsunday\nmon\u2030day\n"; auto lines = s.lineSplitter(); static immutable witness = ["", "peter", "", "paul", "jerry", "ice", "cream", "", "sunday", "mon\u2030day"]; uint i; foreach (line; lines) { assert(line == witness[i++]); } assert(i == witness.length); } unittest { import std.file : DirEntry; import std.algorithm.comparison : equal; auto s = "std/string.d"; auto de = DirEntry(s); auto i = de.lineSplitter(); auto j = s.lineSplitter(); assert(equal(i, j)); } /++ Strips leading whitespace (as defined by $(XREF uni, isWhite)). Params: input = string or ForwardRange of characters Returns: $(D str) stripped of leading whitespace. Postconditions: $(D str) and the returned value will share the same tail (see $(XREF array, sameTail)). +/ auto stripLeft(Range)(Range str) if (isForwardRange!Range && isSomeChar!(ElementEncodingType!Range) && !isConvertibleToString!Range) { import std.ascii : isASCII, isWhite; import std.uni : isWhite; import std.utf : decodeFront; while (!str.empty) { auto c = str.front; if (std.ascii.isASCII(c)) { if (!std.ascii.isWhite(c)) break; str.popFront(); } else { auto save = str.save; auto dc = decodeFront(str); if (!std.uni.isWhite(dc)) return save; } } return str; } /// @safe pure unittest { import std.uni : lineSep, paraSep; assert(stripLeft(" hello world ") == "hello world "); assert(stripLeft("\n\t\v\rhello world\n\t\v\r") == "hello world\n\t\v\r"); assert(stripLeft("hello world") == "hello world"); assert(stripLeft([lineSep] ~ "hello world" ~ lineSep) == "hello world" ~ [lineSep]); assert(stripLeft([paraSep] ~ "hello world" ~ paraSep) == "hello world" ~ [paraSep]); import std.utf : byChar; import std.array; assert(stripLeft(" hello world "w.byChar).array == "hello world "); } auto stripLeft(Range)(auto ref Range str) if (isConvertibleToString!Range) { return stripLeft!(StringTypeOf!Range)(str); } unittest { assert(testAliasedString!stripLeft(" hello")); } /++ Strips trailing whitespace (as defined by $(XREF uni, isWhite)). Params: str = string or random access range of characters Returns: slice of $(D str) stripped of trailing whitespace. +/ auto stripRight(Range)(Range str) if (isSomeString!Range || isRandomAccessRange!Range && hasLength!Range && hasSlicing!Range && !isConvertibleToString!Range && isSomeChar!(ElementEncodingType!Range)) { alias C = Unqual!(ElementEncodingType!(typeof(str))); static if (isSomeString!(typeof(str))) { import std.utf : codeLength; foreach_reverse (i, dchar c; str) { if (!std.uni.isWhite(c)) return str[0 .. i + codeLength!C(c)]; } return str[0 .. 0]; } else { size_t i = str.length; while (i--) { static if (C.sizeof == 4) { if (std.uni.isWhite(str[i])) continue; break; } else static if (C.sizeof == 2) { auto c2 = str[i]; if (c2 < 0xD800 || c2 >= 0xE000) { if (std.uni.isWhite(c2)) continue; } else if (c2 >= 0xDC00) { if (i) { auto c1 = str[i - 1]; if (c1 >= 0xD800 && c1 < 0xDC00) { dchar c = ((c1 - 0xD7C0) << 10) + (c2 - 0xDC00); if (std.uni.isWhite(c)) { --i; continue; } } } } break; } else static if (C.sizeof == 1) { import std.utf : byDchar; char cx = str[i]; if (cx <= 0x7F) { if (std.uni.isWhite(cx)) continue; break; } else { size_t stride = 0; while (1) { ++stride; if (!i || (cx & 0xC0) == 0xC0 || stride == 4) break; cx = str[i - 1]; if (!(cx & 0x80)) break; --i; } if (!std.uni.isWhite(str[i .. i + stride].byDchar.front)) return str[0 .. i + stride]; } } else static assert(0); } return str[0 .. i + 1]; } } /// @safe pure unittest { import std.uni : lineSep, paraSep; assert(stripRight(" hello world ") == " hello world"); assert(stripRight("\n\t\v\rhello world\n\t\v\r") == "\n\t\v\rhello world"); assert(stripRight("hello world") == "hello world"); assert(stripRight([lineSep] ~ "hello world" ~ lineSep) == [lineSep] ~ "hello world"); assert(stripRight([paraSep] ~ "hello world" ~ paraSep) == [paraSep] ~ "hello world"); } auto stripRight(Range)(auto ref Range str) if (isConvertibleToString!Range) { return stripRight!(StringTypeOf!Range)(str); } unittest { assert(testAliasedString!stripRight("hello ")); } unittest { import std.utf; import std.array; import std.uni : lineSep, paraSep; assert(stripRight(" hello world ".byChar).array == " hello world"); assert(stripRight("\n\t\v\rhello world\n\t\v\r"w.byWchar).array == "\n\t\v\rhello world"w); assert(stripRight("hello world"d.byDchar).array == "hello world"d); assert(stripRight("\u2028hello world\u2020\u2028".byChar).array == "\u2028hello world\u2020"); assert(stripRight("hello world\U00010001"w.byWchar).array == "hello world\U00010001"w); foreach (C; AliasSeq!(char, wchar, dchar)) { foreach (s; invalidUTFstrings!C()) { cast(void)stripRight(s.byUTF!C).array; } } cast(void)stripRight("a\x80".byUTF!char).array; wstring ws = ['a', cast(wchar)0xDC00]; cast(void)stripRight(ws.byUTF!wchar).array; } /++ Strips both leading and trailing whitespace (as defined by $(XREF uni, isWhite)). Params: str = string or random access range of characters Returns: slice of $(D str) stripped of leading and trailing whitespace. +/ auto strip(Range)(Range str) if (isSomeString!Range || isRandomAccessRange!Range && hasLength!Range && hasSlicing!Range && !isConvertibleToString!Range && isSomeChar!(ElementEncodingType!Range)) { return stripRight(stripLeft(str)); } /// @safe pure unittest { import std.uni : lineSep, paraSep; assert(strip(" hello world ") == "hello world"); assert(strip("\n\t\v\rhello world\n\t\v\r") == "hello world"); assert(strip("hello world") == "hello world"); assert(strip([lineSep] ~ "hello world" ~ [lineSep]) == "hello world"); assert(strip([paraSep] ~ "hello world" ~ [paraSep]) == "hello world"); } auto strip(Range)(auto ref Range str) if (isConvertibleToString!Range) { return strip!(StringTypeOf!Range)(str); } @safe pure unittest { assert(testAliasedString!strip(" hello world ")); } @safe pure unittest { import std.conv : to; import std.algorithm : equal; debug(string) trustedPrintf("string.strip.unittest\n"); import std.exception; assertCTFEable!( { foreach (S; AliasSeq!( char[], const char[], string, wchar[], const wchar[], wstring, dchar[], const dchar[], dstring)) { assert(equal(stripLeft(to!S(" foo\t ")), "foo\t ")); assert(equal(stripLeft(to!S("\u2008 foo\t \u2007")), "foo\t \u2007")); assert(equal(stripLeft(to!S("\u0085 μ \u0085 \u00BB \r")), "μ \u0085 \u00BB \r")); assert(equal(stripLeft(to!S("1")), "1")); assert(equal(stripLeft(to!S("\U0010FFFE")), "\U0010FFFE")); assert(equal(stripLeft(to!S("")), "")); assert(equal(stripRight(to!S(" foo\t ")), " foo")); assert(equal(stripRight(to!S("\u2008 foo\t \u2007")), "\u2008 foo")); assert(equal(stripRight(to!S("\u0085 μ \u0085 \u00BB \r")), "\u0085 μ \u0085 \u00BB")); assert(equal(stripRight(to!S("1")), "1")); assert(equal(stripRight(to!S("\U0010FFFE")), "\U0010FFFE")); assert(equal(stripRight(to!S("")), "")); assert(equal(strip(to!S(" foo\t ")), "foo")); assert(equal(strip(to!S("\u2008 foo\t \u2007")), "foo")); assert(equal(strip(to!S("\u0085 μ \u0085 \u00BB \r")), "μ \u0085 \u00BB")); assert(equal(strip(to!S("\U0010FFFE")), "\U0010FFFE")); assert(equal(strip(to!S("")), "")); } }); } @safe pure unittest { import std.exception; import std.range; assertCTFEable!( { wstring s = " "; assert(s.sameTail(s.stripLeft())); assert(s.sameHead(s.stripRight())); }); } /++ If $(D str) ends with $(D delimiter), then $(D str) is returned without $(D delimiter) on its end. If it $(D str) does $(I not) end with $(D delimiter), then it is returned unchanged. If no $(D delimiter) is given, then one trailing $(D '\r'), $(D '\n'), $(D "\r\n"), $(D '\f'), $(D '\v'), $(XREF uni, lineSep), $(XREF uni, paraSep), or $(XREF uni, nelSep) is removed from the end of $(D str). If $(D str) does not end with any of those characters, then it is returned unchanged. Params: str = string or indexable range of characters delimiter = string of characters to be sliced off end of str[] Returns: slice of str +/ Range chomp(Range)(Range str) if ((isRandomAccessRange!Range && isSomeChar!(ElementEncodingType!Range) || isNarrowString!Range) && !isConvertibleToString!Range) { import std.uni : lineSep, paraSep, nelSep; if (str.empty) return str; alias C = ElementEncodingType!Range; switch (str[$ - 1]) { case '\n': { if (str.length > 1 && str[$ - 2] == '\r') return str[0 .. $ - 2]; goto case; } case '\r', '\v', '\f': return str[0 .. $ - 1]; // Pop off the last character if lineSep, paraSep, or nelSep static if (is(C : const char)) { /* Manually decode: * lineSep is E2 80 A8 * paraSep is E2 80 A9 */ case 0xA8: // Last byte of lineSep case 0xA9: // Last byte of paraSep if (str.length > 2 && str[$ - 2] == 0x80 && str[$ - 3] == 0xE2) return str [0 .. $ - 3]; goto default; /* Manually decode: * NEL is C2 85 */ case 0x85: if (str.length > 1 && str[$ - 2] == 0xC2) return str [0 .. $ - 2]; goto default; } else { case lineSep: case paraSep: case nelSep: return str[0 .. $ - 1]; } default: return str; } } /// Ditto Range chomp(Range, C2)(Range str, const(C2)[] delimiter) if ((isBidirectionalRange!Range && isSomeChar!(ElementEncodingType!Range) || isNarrowString!Range) && !isConvertibleToString!Range && isSomeChar!C2) { if (delimiter.empty) return chomp(str); alias C1 = ElementEncodingType!Range; static if (is(Unqual!C1 == Unqual!C2) && (isSomeString!Range || (hasSlicing!Range && C2.sizeof == 4))) { import std.algorithm : endsWith; if (str.endsWith(delimiter)) return str[0 .. $ - delimiter.length]; return str; } else { auto orig = str.save; static if (isSomeString!Range) alias C = dchar; // because strings auto-decode else alias C = C1; // and ranges do not foreach_reverse (C c; delimiter) { if (str.empty || str.back != c) return orig; str.popBack(); } return str; } } /// @safe pure unittest { import std.utf : decode; import std.uni : lineSep, paraSep, nelSep; assert(chomp(" hello world \n\r") == " hello world \n"); assert(chomp(" hello world \r\n") == " hello world "); assert(chomp(" hello world \f") == " hello world "); assert(chomp(" hello world \v") == " hello world "); assert(chomp(" hello world \n\n") == " hello world \n"); assert(chomp(" hello world \n\n ") == " hello world \n\n "); assert(chomp(" hello world \n\n" ~ [lineSep]) == " hello world \n\n"); assert(chomp(" hello world \n\n" ~ [paraSep]) == " hello world \n\n"); assert(chomp(" hello world \n\n" ~ [ nelSep]) == " hello world \n\n"); assert(chomp(" hello world") == " hello world"); assert(chomp("") == ""); assert(chomp(" hello world", "orld") == " hello w"); assert(chomp(" hello world", " he") == " hello world"); assert(chomp("", "hello") == ""); // Don't decode pointlessly assert(chomp("hello\xFE", "\r") == "hello\xFE"); } StringTypeOf!Range chomp(Range)(auto ref Range str) if (isConvertibleToString!Range) { return chomp!(StringTypeOf!Range)(str); } StringTypeOf!Range chomp(Range, C2)(auto ref Range str, const(C2)[] delimiter) if (isConvertibleToString!Range) { return chomp!(StringTypeOf!Range, C2)(str, delimiter); } unittest { assert(testAliasedString!chomp(" hello world \n\r")); assert(testAliasedString!chomp(" hello world", "orld")); } unittest { import std.conv : to; debug(string) trustedPrintf("string.chomp.unittest\n"); string s; import std.exception; assertCTFEable!( { foreach (S; AliasSeq!(char[], wchar[], dchar[], string, wstring, dstring)) { // @@@ BUG IN COMPILER, MUST INSERT CAST assert(chomp(cast(S)null) is null); assert(chomp(to!S("hello")) == "hello"); assert(chomp(to!S("hello\n")) == "hello"); assert(chomp(to!S("hello\r")) == "hello"); assert(chomp(to!S("hello\r\n")) == "hello"); assert(chomp(to!S("hello\n\r")) == "hello\n"); assert(chomp(to!S("hello\n\n")) == "hello\n"); assert(chomp(to!S("hello\r\r")) == "hello\r"); assert(chomp(to!S("hello\nxxx\n")) == "hello\nxxx"); assert(chomp(to!S("hello\u2028")) == "hello"); assert(chomp(to!S("hello\u2029")) == "hello"); assert(chomp(to!S("hello\u0085")) == "hello"); assert(chomp(to!S("hello\u2028\u2028")) == "hello\u2028"); assert(chomp(to!S("hello\u2029\u2029")) == "hello\u2029"); assert(chomp(to!S("hello\u2029\u2129")) == "hello\u2029\u2129"); assert(chomp(to!S("hello\u2029\u0185")) == "hello\u2029\u0185"); foreach (T; AliasSeq!(char[], wchar[], dchar[], string, wstring, dstring)) (){ // avoid slow optimizations for large functions @@@BUG@@@ 2396 // @@@ BUG IN COMPILER, MUST INSERT CAST assert(chomp(cast(S)null, cast(T)null) is null); assert(chomp(to!S("hello\n"), cast(T)null) == "hello"); assert(chomp(to!S("hello"), to!T("o")) == "hell"); assert(chomp(to!S("hello"), to!T("p")) == "hello"); // @@@ BUG IN COMPILER, MUST INSERT CAST assert(chomp(to!S("hello"), cast(T) null) == "hello"); assert(chomp(to!S("hello"), to!T("llo")) == "he"); assert(chomp(to!S("\uFF28ello"), to!T("llo")) == "\uFF28e"); assert(chomp(to!S("\uFF28el\uFF4co"), to!T("l\uFF4co")) == "\uFF28e"); }(); } }); // Ranges import std.utf : byChar, byWchar, byDchar; import std.array; assert(chomp("hello world\r\n" .byChar ).array == "hello world"); assert(chomp("hello world\r\n"w.byWchar).array == "hello world"w); assert(chomp("hello world\r\n"d.byDchar).array == "hello world"d); assert(chomp("hello world"d.byDchar, "ld").array == "hello wor"d); assert(chomp("hello\u2020" .byChar , "\u2020").array == "hello"); assert(chomp("hello\u2020"d.byDchar, "\u2020"d).array == "hello"d); } /++ If $(D str) starts with $(D delimiter), then the part of $(D str) following $(D delimiter) is returned. If $(D str) does $(I not) start with $(D delimiter), then it is returned unchanged. Params: str = string or forward range of characters delimiter = string of characters to be sliced off front of str[] Returns: slice of str +/ Range chompPrefix(Range, C2)(Range str, const(C2)[] delimiter) if ((isForwardRange!Range && isSomeChar!(ElementEncodingType!Range) || isNarrowString!Range) && !isConvertibleToString!Range && isSomeChar!C2) { alias C1 = ElementEncodingType!Range; static if (is(Unqual!C1 == Unqual!C2) && (isSomeString!Range || (hasSlicing!Range && C2.sizeof == 4))) { import std.algorithm : startsWith; if (str.startsWith(delimiter)) return str[delimiter.length .. $]; return str; } else { auto orig = str.save; static if (isSomeString!Range) alias C = dchar; // because strings auto-decode else alias C = C1; // and ranges do not foreach (C c; delimiter) { if (str.empty || str.front != c) return orig; str.popFront(); } return str; } } /// @safe pure unittest { assert(chompPrefix("hello world", "he") == "llo world"); assert(chompPrefix("hello world", "hello w") == "orld"); assert(chompPrefix("hello world", " world") == "hello world"); assert(chompPrefix("", "hello") == ""); } StringTypeOf!Range chompPrefix(Range, C2)(auto ref Range str, const(C2)[] delimiter) if (isConvertibleToString!Range) { return chompPrefix!(StringTypeOf!Range, C2)(str, delimiter); } @safe pure unittest { import std.conv : to; import std.algorithm : equal; import std.exception; assertCTFEable!( { foreach (S; AliasSeq!(char[], wchar[], dchar[], string, wstring, dstring)) { foreach (T; AliasSeq!(char[], wchar[], dchar[], string, wstring, dstring)) (){ // avoid slow optimizations for large functions @@@BUG@@@ 2396 assert(equal(chompPrefix(to!S("abcdefgh"), to!T("abcde")), "fgh")); assert(equal(chompPrefix(to!S("abcde"), to!T("abcdefgh")), "abcde")); assert(equal(chompPrefix(to!S("\uFF28el\uFF4co"), to!T("\uFF28el\uFF4co")), "")); assert(equal(chompPrefix(to!S("\uFF28el\uFF4co"), to!T("\uFF28el")), "\uFF4co")); assert(equal(chompPrefix(to!S("\uFF28el"), to!T("\uFF28el\uFF4co")), "\uFF28el")); }(); } }); // Ranges import std.utf : byChar, byWchar, byDchar; import std.array; assert(chompPrefix("hello world" .byChar , "hello"d).array == " world"); assert(chompPrefix("hello world"w.byWchar, "hello" ).array == " world"w); assert(chompPrefix("hello world"d.byDchar, "hello"w).array == " world"d); assert(chompPrefix("hello world"c.byDchar, "hello"w).array == " world"d); assert(chompPrefix("hello world"d.byDchar, "lx").array == "hello world"d); assert(chompPrefix("hello world"d.byDchar, "hello world xx").array == "hello world"d); assert(chompPrefix("\u2020world" .byChar , "\u2020").array == "world"); assert(chompPrefix("\u2020world"d.byDchar, "\u2020"d).array == "world"d); } unittest { assert(testAliasedString!chompPrefix("hello world", "hello")); } /++ Returns $(D str) without its last character, if there is one. If $(D str) ends with $(D "\r\n"), then both are removed. If $(D str) is empty, then then it is returned unchanged. Params: str = string (must be valid UTF) Returns: slice of str +/ Range chop(Range)(Range str) if ((isBidirectionalRange!Range && isSomeChar!(ElementEncodingType!Range) || isNarrowString!Range) && !isConvertibleToString!Range) { if (str.empty) return str; static if (isSomeString!Range) { if (str.length >= 2 && str[$ - 1] == '\n' && str[$ - 2] == '\r') return str[0 .. $ - 2]; str.popBack(); return str; } else { alias C = Unqual!(ElementEncodingType!Range); C c = str.back; str.popBack(); if (c == '\n') { if (!str.empty && str.back == '\r') str.popBack(); return str; } // Pop back a dchar, not just a code unit static if (C.sizeof == 1) { int cnt = 1; while ((c & 0xC0) == 0x80) { if (str.empty) break; c = str.back; str.popBack(); if (++cnt > 4) break; } } else static if (C.sizeof == 2) { if (c >= 0xD800 && c <= 0xDBFF) { if (!str.empty) str.popBack(); } } else static if (C.sizeof == 4) { } else static assert(0); return str; } } /// @safe pure unittest { assert(chop("hello world") == "hello worl"); assert(chop("hello world\n") == "hello world"); assert(chop("hello world\r") == "hello world"); assert(chop("hello world\n\r") == "hello world\n"); assert(chop("hello world\r\n") == "hello world"); assert(chop("Walter Bright") == "Walter Brigh"); assert(chop("") == ""); } StringTypeOf!Range chop(Range)(auto ref Range str) if (isConvertibleToString!Range) { return chop!(StringTypeOf!Range)(str); } unittest { assert(testAliasedString!chop("hello world")); } @safe pure unittest { import std.utf : byChar, byWchar, byDchar, byCodeUnit, invalidUTFstrings; import std.array; assert(chop("hello world".byChar).array == "hello worl"); assert(chop("hello world\n"w.byWchar).array == "hello world"w); assert(chop("hello world\r"d.byDchar).array == "hello world"d); assert(chop("hello world\n\r".byChar).array == "hello world\n"); assert(chop("hello world\r\n"w.byWchar).array == "hello world"w); assert(chop("Walter Bright"d.byDchar).array == "Walter Brigh"d); assert(chop("".byChar).array == ""); assert(chop(`ミツバチと科学者` .byCodeUnit).array == "ミツバチと科学"); assert(chop(`ミツバチと科学者`w.byCodeUnit).array == "ミツバチと科学"w); assert(chop(`ミツバチと科学者`d.byCodeUnit).array == "ミツバチと科学"d); auto ca = invalidUTFstrings!char(); foreach (s; ca) { foreach (c; chop(s.byCodeUnit)) { } } auto wa = invalidUTFstrings!wchar(); foreach (s; wa) { foreach (c; chop(s.byCodeUnit)) { } } } unittest { import std.conv : to; import std.algorithm : equal; debug(string) trustedPrintf("string.chop.unittest\n"); import std.exception; assertCTFEable!( { foreach (S; AliasSeq!(char[], wchar[], dchar[], string, wstring, dstring)) { assert(chop(cast(S) null) is null); assert(equal(chop(to!S("hello")), "hell")); assert(equal(chop(to!S("hello\r\n")), "hello")); assert(equal(chop(to!S("hello\n\r")), "hello\n")); assert(equal(chop(to!S("Verité")), "Verit")); assert(equal(chop(to!S(`さいごの果実`)), "さいごの果")); assert(equal(chop(to!S(`ミツバチと科学者`)), "ミツバチと科学")); } }); } /++ Left justify $(D s) in a field $(D width) characters wide. $(D fillChar) is the character that will be used to fill up the space in the field that $(D s) doesn't fill. Params: s = string width = minimum field width fillChar = used to pad end up to $(D width) characters Returns: GC allocated string See_Also: $(LREF leftJustifier), which does not allocate +/ S leftJustify(S)(S s, size_t width, dchar fillChar = ' ') if (isSomeString!S) { import std.array; return leftJustifier(s, width, fillChar).array; } /// @safe pure unittest { assert(leftJustify("hello", 7, 'X') == "helloXX"); assert(leftJustify("hello", 2, 'X') == "hello"); assert(leftJustify("hello", 9, 'X') == "helloXXXX"); } /++ Left justify $(D s) in a field $(D width) characters wide. $(D fillChar) is the character that will be used to fill up the space in the field that $(D s) doesn't fill. Params: r = string or range of characters width = minimum field width fillChar = used to pad end up to $(D width) characters Returns: a lazy range of the left justified result See_Also: $(LREF rightJustifier) +/ auto leftJustifier(Range)(Range r, size_t width, dchar fillChar = ' ') if (isInputRange!Range && isSomeChar!(ElementEncodingType!Range) && !isConvertibleToString!Range) { alias C = Unqual!(ElementEncodingType!Range); static if (C.sizeof == 1) { import std.utf : byDchar, byChar; return leftJustifier(r.byDchar, width, fillChar).byChar; } else static if (C.sizeof == 2) { import std.utf : byDchar, byWchar; return leftJustifier(r.byDchar, width, fillChar).byWchar; } else static if (C.sizeof == 4) { static struct Result { private: Range _input; size_t _width; dchar _fillChar; size_t len; public: this(Range input, size_t width, dchar fillChar) { _input = input; _width = width; _fillChar = fillChar; } @property bool empty() { return len >= _width && _input.empty; } @property C front() { return _input.empty ? _fillChar : _input.front; } void popFront() { ++len; if (!_input.empty) _input.popFront(); } static if (isForwardRange!Range) { @property typeof(this) save() { auto ret = this; ret._input = _input.save; return ret; } } } return Result(r, width, fillChar); } else static assert(0); } /// @safe pure @nogc nothrow unittest { import std.algorithm : equal; import std.utf : byChar; assert(leftJustifier("hello", 2).equal("hello".byChar)); assert(leftJustifier("hello", 7).equal("hello ".byChar)); assert(leftJustifier("hello", 7, 'x').equal("helloxx".byChar)); } auto leftJustifier(Range)(auto ref Range r, size_t width, dchar fillChar = ' ') if (isConvertibleToString!Range) { return leftJustifier!(StringTypeOf!Range)(r, width, fillChar); } unittest { auto r = "hello".leftJustifier(8); r.popFront(); auto save = r.save; r.popFront(); assert(r.front == 'l'); assert(save.front == 'e'); } unittest { assert(testAliasedString!leftJustifier("hello", 2)); } /++ Right justify $(D s) in a field $(D width) characters wide. $(D fillChar) is the character that will be used to fill up the space in the field that $(D s) doesn't fill. Params: s = string width = minimum field width fillChar = used to pad end up to $(D width) characters Returns: GC allocated string See_Also: $(LREF rightJustifier), which does not allocate +/ S rightJustify(S)(S s, size_t width, dchar fillChar = ' ') if (isSomeString!S) { import std.array; return rightJustifier(s, width, fillChar).array; } /// @safe pure unittest { assert(rightJustify("hello", 7, 'X') == "XXhello"); assert(rightJustify("hello", 2, 'X') == "hello"); assert(rightJustify("hello", 9, 'X') == "XXXXhello"); } /++ Right justify $(D s) in a field $(D width) characters wide. $(D fillChar) is the character that will be used to fill up the space in the field that $(D s) doesn't fill. Params: r = string or forward range of characters width = minimum field width fillChar = used to pad end up to $(D width) characters Returns: a lazy range of the right justified result See_Also: $(LREF leftJustifier) +/ auto rightJustifier(Range)(Range r, size_t width, dchar fillChar = ' ') if (isForwardRange!Range && isSomeChar!(ElementEncodingType!Range) && !isConvertibleToString!Range) { alias C = Unqual!(ElementEncodingType!Range); static if (C.sizeof == 1) { import std.utf : byDchar, byChar; return rightJustifier(r.byDchar, width, fillChar).byChar; } else static if (C.sizeof == 2) { import std.utf : byDchar, byWchar; return rightJustifier(r.byDchar, width, fillChar).byWchar; } else static if (C.sizeof == 4) { static struct Result { private: Range _input; size_t _width; alias nfill = _width; // number of fill characters to prepend dchar _fillChar; bool inited; // Lazy initialization so constructor is trivial and cannot fail void initialize() { // Replace _width with nfill // (use alias instead of union because CTFE cannot deal with unions) assert(_width); static if (hasLength!Range) { auto len = _input.length; nfill = (_width > len) ? _width - len : 0; } else { // Lookahead to see now many fill characters are needed import std.range : walkLength, take; nfill = _width - walkLength(_input.save.take(_width), _width); } inited = true; } public: this(Range input, size_t width, dchar fillChar) pure nothrow { _input = input; _fillChar = fillChar; _width = width; } @property bool empty() { return !nfill && _input.empty; } @property C front() { if (!nfill) return _input.front; // fast path if (!inited) initialize(); return nfill ? _fillChar : _input.front; } void popFront() { if (!nfill) _input.popFront(); // fast path else { if (!inited) initialize(); if (nfill) --nfill; else _input.popFront(); } } @property typeof(this) save() { auto ret = this; ret._input = _input.save; return ret; } } return Result(r, width, fillChar); } else static assert(0); } /// @safe pure @nogc nothrow unittest { import std.algorithm : equal; import std.utf : byChar; assert(rightJustifier("hello", 2).equal("hello".byChar)); assert(rightJustifier("hello", 7).equal(" hello".byChar)); assert(rightJustifier("hello", 7, 'x').equal("xxhello".byChar)); } auto rightJustifier(Range)(auto ref Range r, size_t width, dchar fillChar = ' ') if (isConvertibleToString!Range) { return rightJustifier!(StringTypeOf!Range)(r, width, fillChar); } unittest { assert(testAliasedString!rightJustifier("hello", 2)); } unittest { auto r = "hello"d.rightJustifier(6); r.popFront(); auto save = r.save; r.popFront(); assert(r.front == 'e'); assert(save.front == 'h'); auto t = "hello".rightJustifier(7); t.popFront(); assert(t.front == ' '); t.popFront(); assert(t.front == 'h'); auto u = "hello"d.rightJustifier(5); u.popFront(); u.popFront(); u.popFront(); } /++ Center $(D s) in a field $(D width) characters wide. $(D fillChar) is the character that will be used to fill up the space in the field that $(D s) doesn't fill. Params: s = The string to center width = Width of the field to center `s` in fillChar = The character to use for filling excess space in the field Returns: The resulting _center-justified string. The returned string is GC-allocated. To avoid GC allocation, use $(LREF centerJustifier) instead. +/ S center(S)(S s, size_t width, dchar fillChar = ' ') if (isSomeString!S) { import std.array; return centerJustifier(s, width, fillChar).array; } /// @safe pure unittest { assert(center("hello", 7, 'X') == "XhelloX"); assert(center("hello", 2, 'X') == "hello"); assert(center("hello", 9, 'X') == "XXhelloXX"); } @safe pure unittest { import std.conv : to; debug(string) trustedPrintf("string.justify.unittest\n"); import std.exception; assertCTFEable!( { foreach (S; AliasSeq!(char[], wchar[], dchar[], string, wstring, dstring)) { S s = to!S("hello"); assert(leftJustify(s, 2) == "hello"); assert(rightJustify(s, 2) == "hello"); assert(center(s, 2) == "hello"); assert(leftJustify(s, 7) == "hello "); assert(rightJustify(s, 7) == " hello"); assert(center(s, 7) == " hello "); assert(leftJustify(s, 8) == "hello "); assert(rightJustify(s, 8) == " hello"); assert(center(s, 8) == " hello "); assert(leftJustify(s, 8, '\u0100') == "hello\u0100\u0100\u0100"); assert(rightJustify(s, 8, '\u0100') == "\u0100\u0100\u0100hello"); assert(center(s, 8, '\u0100') == "\u0100hello\u0100\u0100"); assert(leftJustify(s, 8, 'ö') == "helloööö"); assert(rightJustify(s, 8, 'ö') == "öööhello"); assert(center(s, 8, 'ö') == "öhelloöö"); } }); } /++ Center justify $(D r) in a field $(D width) characters wide. $(D fillChar) is the character that will be used to fill up the space in the field that $(D r) doesn't fill. Params: r = string or forward range of characters width = minimum field width fillChar = used to pad end up to $(D width) characters Returns: a lazy range of the center justified result See_Also: $(LREF leftJustifier) $(LREF rightJustifier) +/ auto centerJustifier(Range)(Range r, size_t width, dchar fillChar = ' ') if (isForwardRange!Range && isSomeChar!(ElementEncodingType!Range) && !isConvertibleToString!Range) { alias C = Unqual!(ElementEncodingType!Range); static if (C.sizeof == 1) { import std.utf : byDchar, byChar; return centerJustifier(r.byDchar, width, fillChar).byChar; } else static if (C.sizeof == 2) { import std.utf : byDchar, byWchar; return centerJustifier(r.byDchar, width, fillChar).byWchar; } else static if (C.sizeof == 4) { import std.range : chain, repeat, walkLength; auto len = walkLength(r.save, width); if (len > width) len = width; const nleft = (width - len) / 2; const nright = width - len - nleft; return chain(repeat(fillChar, nleft), r, repeat(fillChar, nright)); } else static assert(0); } /// @safe pure @nogc nothrow unittest { import std.algorithm : equal; import std.utf : byChar; assert(centerJustifier("hello", 2).equal("hello".byChar)); assert(centerJustifier("hello", 8).equal(" hello ".byChar)); assert(centerJustifier("hello", 7, 'x').equal("xhellox".byChar)); } auto centerJustifier(Range)(auto ref Range r, size_t width, dchar fillChar = ' ') if (isConvertibleToString!Range) { return centerJustifier!(StringTypeOf!Range)(r, width, fillChar); } unittest { assert(testAliasedString!centerJustifier("hello", 8)); } unittest { static auto byFwdRange(dstring s) { static struct FRange { dstring str; this(dstring s) { str = s; } @property bool empty() { return str.length == 0; } @property dchar front() { return str[0]; } void popFront() { str = str[1 .. $]; } @property FRange save() { return this; } } return FRange(s); } auto r = centerJustifier(byFwdRange("hello"d), 6); r.popFront(); auto save = r.save; r.popFront(); assert(r.front == 'l'); assert(save.front == 'e'); auto t = "hello".centerJustifier(7); t.popFront(); assert(t.front == 'h'); t.popFront(); assert(t.front == 'e'); auto u = byFwdRange("hello"d).centerJustifier(6); u.popFront(); u.popFront(); u.popFront(); u.popFront(); u.popFront(); u.popFront(); } /++ Replace each tab character in $(D s) with the number of spaces necessary to align the following character at the next tab stop. Params: s = string tabSize = distance between tab stops Returns: GC allocated string with tabs replaced with spaces +/ auto detab(Range)(auto ref Range s, size_t tabSize = 8) pure if ((isForwardRange!Range && isSomeChar!(ElementEncodingType!Range)) || __traits(compiles, StringTypeOf!Range)) { import std.array; return detabber(s, tabSize).array; } /// @trusted pure unittest { import std.array; assert(detab(" \n\tx", 9) == " \n x"); } unittest { static struct TestStruct { string s; alias s this; } static struct TestStruct2 { string s; alias s this; @disable this(this); } string s = " \n\tx"; string cmp = " \n x"; auto t = TestStruct(s); assert(detab(t, 9) == cmp); assert(detab(TestStruct(s), 9) == cmp); assert(detab(TestStruct(s), 9) == detab(TestStruct(s), 9)); assert(detab(TestStruct2(s), 9) == detab(TestStruct2(s), 9)); assert(detab(TestStruct2(s), 9) == cmp); } /++ Replace each tab character in $(D r) with the number of spaces necessary to align the following character at the next tab stop. Params: r = string or forward range tabSize = distance between tab stops Returns: lazy forward range with tabs replaced with spaces +/ auto detabber(Range)(Range r, size_t tabSize = 8) if (isForwardRange!Range && isSomeChar!(ElementEncodingType!Range) && !isConvertibleToString!Range) { import std.uni : lineSep, paraSep, nelSep; import std.utf : codeUnitLimit, decodeFront; assert(tabSize > 0); alias C = Unqual!(ElementEncodingType!(Range)); static struct Result { private: Range _input; size_t _tabSize; size_t nspaces; int column; size_t index; public: this(Range input, size_t tabSize) { _input = input; _tabSize = tabSize; } static if (isInfinite!(Range)) { enum bool empty = false; } else { @property bool empty() { return _input.empty && nspaces == 0; } } @property C front() { if (nspaces) return ' '; static if (isSomeString!(Range)) C c = _input[0]; else C c = _input.front; if (index) return c; dchar dc; if (c < codeUnitLimit!(immutable(C)[])) { dc = c; index = 1; } else { auto r = _input.save; dc = decodeFront(r, index); // lookahead to decode } switch (dc) { case '\r': case '\n': case paraSep: case lineSep: case nelSep: column = 0; break; case '\t': nspaces = _tabSize - (column % _tabSize); column += nspaces; c = ' '; break; default: ++column; break; } return c; } void popFront() { if (!index) front(); if (nspaces) --nspaces; if (!nspaces) { static if (isSomeString!(Range)) _input = _input[1 .. $]; else _input.popFront(); --index; } } @property typeof(this) save() { auto ret = this; ret._input = _input.save; return ret; } } return Result(r, tabSize); } /// @trusted pure unittest { import std.array; assert(detabber(" \n\tx", 9).array == " \n x"); } auto detabber(Range)(auto ref Range r, size_t tabSize = 8) if (isConvertibleToString!Range) { return detabber!(StringTypeOf!Range)(r, tabSize); } unittest { assert(testAliasedString!detabber( " ab\t asdf ", 8)); } @trusted pure unittest { import std.conv : to; import std.algorithm : cmp; debug(string) trustedPrintf("string.detab.unittest\n"); import std.exception; assertCTFEable!( { foreach (S; AliasSeq!(char[], wchar[], dchar[], string, wstring, dstring)) { S s = to!S("This \tis\t a fofof\tof list"); assert(cmp(detab(s), "This is a fofof of list") == 0); assert(detab(cast(S)null) is null); assert(detab("").empty); assert(detab("a") == "a"); assert(detab("\t") == " "); assert(detab("\t", 3) == " "); assert(detab("\t", 9) == " "); assert(detab( " ab\t asdf ") == " ab asdf "); assert(detab( " \U00010000b\tasdf ") == " \U00010000b asdf "); assert(detab("\r\t", 9) == "\r "); assert(detab("\n\t", 9) == "\n "); assert(detab("\u0085\t", 9) == "\u0085 "); assert(detab("\u2028\t", 9) == "\u2028 "); assert(detab(" \u2029\t", 9) == " \u2029 "); } }); } /// @trusted pure unittest { import std.utf; import std.array; assert(detabber(" \u2029\t".byChar, 9).array == " \u2029 "); auto r = "hel\tx".byWchar.detabber(); assert(r.front == 'h' && r.front == 'h'); auto s = r.save; r.popFront(); r.popFront(); assert(r.front == 'l'); assert(s.front == 'h'); } /++ Replaces spaces in $(D s) with the optimal number of tabs. All spaces and tabs at the end of a line are removed. Params: s = String to convert. tabSize = Tab columns are $(D tabSize) spaces apart. Returns: GC allocated string with spaces replaced with tabs; use $(LREF entabber) to not allocate. See_Also: $(LREF entabber) +/ auto entab(Range)(Range s, size_t tabSize = 8) if (isForwardRange!Range && isSomeChar!(ElementEncodingType!Range)) { import std.array : array; return entabber(s, tabSize).array; } /// unittest { assert(entab(" x \n") == "\tx\n"); } auto entab(Range)(auto ref Range s, size_t tabSize = 8) if (!(isForwardRange!Range && isSomeChar!(ElementEncodingType!Range)) && is(StringTypeOf!Range)) { return entab!(StringTypeOf!Range)(s, tabSize); } unittest { assert(testAliasedString!entab(" x \n")); } /++ Replaces spaces in range $(D r) with the optimal number of tabs. All spaces and tabs at the end of a line are removed. Params: r = string or forward range tabSize = distance between tab stops Returns: lazy forward range with spaces replaced with tabs See_Also: $(LREF entab) +/ auto entabber(Range)(Range r, size_t tabSize = 8) if (isForwardRange!Range && !isConvertibleToString!Range) { import std.uni : lineSep, paraSep, nelSep; import std.utf : codeUnitLimit, decodeFront; assert(tabSize > 0); alias C = Unqual!(ElementEncodingType!Range); static struct Result { private: Range _input; size_t _tabSize; size_t nspaces; size_t ntabs; int column; size_t index; @property C getFront() { static if (isSomeString!Range) return _input[0]; // avoid autodecode else return _input.front; } public: this(Range input, size_t tabSize) { _input = input; _tabSize = tabSize; } @property bool empty() { if (ntabs || nspaces) return false; /* Since trailing spaces are removed, * look ahead for anything that is not a trailing space */ static if (isSomeString!Range) { foreach (c; _input) { if (c != ' ' && c != '\t') return false; } return true; } else { if (_input.empty) return true; C c = _input.front; if (c != ' ' && c != '\t') return false; auto t = _input.save; t.popFront(); foreach (c2; t) { if (c2 != ' ' && c2 != '\t') return false; } return true; } } @property C front() { //writefln(" front(): ntabs = %s nspaces = %s index = %s front = '%s'", ntabs, nspaces, index, getFront()); if (ntabs) return '\t'; if (nspaces) return ' '; C c = getFront(); if (index) return c; dchar dc; if (c < codeUnitLimit!(immutable(C)[])) { index = 1; dc = c; if (c == ' ' || c == '\t') { // Consume input until a non-blank is encountered size_t startcol = column; C cx; static if (isSomeString!Range) { while (1) { assert(_input.length); cx = _input[0]; if (cx == ' ') ++column; else if (cx == '\t') column += _tabSize - (column % _tabSize); else break; _input = _input[1 .. $]; } } else { while (1) { assert(!_input.empty); cx = _input.front; if (cx == ' ') ++column; else if (cx == '\t') column += _tabSize - (column % _tabSize); else break; _input.popFront(); } } // Compute ntabs+nspaces to get from startcol to column auto n = column - startcol; if (n == 1) { nspaces = 1; } else { ntabs = column / _tabSize - startcol / _tabSize; if (ntabs == 0) nspaces = column - startcol; else nspaces = column % _tabSize; } //writefln("\tstartcol = %s, column = %s, _tabSize = %s", startcol, column, _tabSize); //writefln("\tntabs = %s, nspaces = %s", ntabs, nspaces); if (cx < codeUnitLimit!(immutable(C)[])) { dc = cx; index = 1; } else { auto r = _input.save; dc = decodeFront(r, index); // lookahead to decode } switch (dc) { case '\r': case '\n': case paraSep: case lineSep: case nelSep: column = 0; // Spaces followed by newline are ignored ntabs = 0; nspaces = 0; return cx; default: ++column; break; } return ntabs ? '\t' : ' '; } } else { auto r = _input.save; dc = decodeFront(r, index); // lookahead to decode } //writefln("dc = x%x", dc); switch (dc) { case '\r': case '\n': case paraSep: case lineSep: case nelSep: column = 0; break; default: ++column; break; } return c; } void popFront() { //writefln("popFront(): ntabs = %s nspaces = %s index = %s front = '%s'", ntabs, nspaces, index, getFront()); if (!index) front(); if (ntabs) --ntabs; else if (nspaces) --nspaces; else if (!ntabs && !nspaces) { static if (isSomeString!Range) _input = _input[1 .. $]; else _input.popFront(); --index; } } @property typeof(this) save() { auto ret = this; ret._input = _input.save; return ret; } } return Result(r, tabSize); } /// unittest { import std.array; assert(entabber(" x \n").array == "\tx\n"); } auto entabber(Range)(auto ref Range r, size_t tabSize = 8) if (isConvertibleToString!Range) { return entabber!(StringTypeOf!Range)(r, tabSize); } unittest { assert(testAliasedString!entabber(" ab asdf ", 8)); } @safe pure unittest { import std.conv : to; debug(string) trustedPrintf("string.entab.unittest\n"); import std.exception; assertCTFEable!( { assert(entab(cast(string) null) is null); assert(entab("").empty); assert(entab("a") == "a"); assert(entab(" ") == ""); assert(entab(" x") == "\tx"); assert(entab(" ab asdf ") == " ab\tasdf"); assert(entab(" ab asdf ") == " ab\t asdf"); assert(entab(" ab \t asdf ") == " ab\t asdf"); assert(entab("1234567 \ta") == "1234567\t\ta"); assert(entab("1234567 \ta") == "1234567\t\ta"); assert(entab("1234567 \ta") == "1234567\t\ta"); assert(entab("1234567 \ta") == "1234567\t\ta"); assert(entab("1234567 \ta") == "1234567\t\ta"); assert(entab("1234567 \ta") == "1234567\t\ta"); assert(entab("1234567 \ta") == "1234567\t\ta"); assert(entab("1234567 \ta") == "1234567\t\ta"); assert(entab("1234567 \ta") == "1234567\t\t\ta"); assert(entab("a ") == "a"); assert(entab("a\v") == "a\v"); assert(entab("a\f") == "a\f"); assert(entab("a\n") == "a\n"); assert(entab("a\n\r") == "a\n\r"); assert(entab("a\r\n") == "a\r\n"); assert(entab("a\u2028") == "a\u2028"); assert(entab("a\u2029") == "a\u2029"); assert(entab("a\u0085") == "a\u0085"); assert(entab("a ") == "a"); assert(entab("a\t") == "a"); assert(entab("\uFF28\uFF45\uFF4C\uFF4C567 \t\uFF4F \t") == "\uFF28\uFF45\uFF4C\uFF4C567\t\t\uFF4F"); assert(entab(" \naa") == "\naa"); assert(entab(" \r aa") == "\r aa"); assert(entab(" \u2028 aa") == "\u2028 aa"); assert(entab(" \u2029 aa") == "\u2029 aa"); assert(entab(" \u0085 aa") == "\u0085 aa"); }); } @safe pure unittest { import std.utf : byChar; import std.array; assert(entabber(" \u0085 aa".byChar).array == "\u0085 aa"); assert(entabber(" \u2028\t aa \t".byChar).array == "\u2028\t aa"); auto r = entabber("1234", 4); r.popFront(); auto rsave = r.save; r.popFront(); assert(r.front == '3'); assert(rsave.front == '2'); } /++ Replaces the characters in $(D str) which are keys in $(D transTable) with their corresponding values in $(D transTable). $(D transTable) is an AA where its keys are $(D dchar) and its values are either $(D dchar) or some type of string. Also, if $(D toRemove) is given, the characters in it are removed from $(D str) prior to translation. $(D str) itself is unaltered. A copy with the changes is returned. See_Also: $(LREF tr) $(XREF array, replace) Params: str = The original string. transTable = The AA indicating which characters to replace and what to replace them with. toRemove = The characters to remove from the string. +/ C1[] translate(C1, C2 = immutable char)(C1[] str, in dchar[dchar] transTable, const(C2)[] toRemove = null) @safe pure if (isSomeChar!C1 && isSomeChar!C2) { import std.array : appender; auto buffer = appender!(C1[])(); translateImpl(str, transTable, toRemove, buffer); return buffer.data; } /// @safe pure unittest { dchar[dchar] transTable1 = ['e' : '5', 'o' : '7', '5': 'q']; assert(translate("hello world", transTable1) == "h5ll7 w7rld"); assert(translate("hello world", transTable1, "low") == "h5 rd"); string[dchar] transTable2 = ['e' : "5", 'o' : "orange"]; assert(translate("hello world", transTable2) == "h5llorange worangerld"); } @safe pure unittest // issue 13018 { immutable dchar[dchar] transTable1 = ['e' : '5', 'o' : '7', '5': 'q']; assert(translate("hello world", transTable1) == "h5ll7 w7rld"); assert(translate("hello world", transTable1, "low") == "h5 rd"); immutable string[dchar] transTable2 = ['e' : "5", 'o' : "orange"]; assert(translate("hello world", transTable2) == "h5llorange worangerld"); } @trusted pure unittest { import std.conv : to; import std.exception; assertCTFEable!( { foreach (S; AliasSeq!( char[], const( char)[], immutable( char)[], wchar[], const(wchar)[], immutable(wchar)[], dchar[], const(dchar)[], immutable(dchar)[])) { assert(translate(to!S("hello world"), cast(dchar[dchar])['h' : 'q', 'l' : '5']) == to!S("qe55o wor5d")); assert(translate(to!S("hello world"), cast(dchar[dchar])['o' : 'l', 'l' : '\U00010143']) == to!S("he\U00010143\U00010143l wlr\U00010143d")); assert(translate(to!S("hello \U00010143 world"), cast(dchar[dchar])['h' : 'q', 'l': '5']) == to!S("qe55o \U00010143 wor5d")); assert(translate(to!S("hello \U00010143 world"), cast(dchar[dchar])['o' : '0', '\U00010143' : 'o']) == to!S("hell0 o w0rld")); assert(translate(to!S("hello world"), cast(dchar[dchar])null) == to!S("hello world")); foreach (T; AliasSeq!( char[], const( char)[], immutable( char)[], wchar[], const(wchar)[], immutable(wchar)[], dchar[], const(dchar)[], immutable(dchar)[])) (){ // avoid slow optimizations for large functions @@@BUG@@@ 2396 foreach(R; AliasSeq!(dchar[dchar], const dchar[dchar], immutable dchar[dchar])) { R tt = ['h' : 'q', 'l' : '5']; assert(translate(to!S("hello world"), tt, to!T("r")) == to!S("qe55o wo5d")); assert(translate(to!S("hello world"), tt, to!T("helo")) == to!S(" wrd")); assert(translate(to!S("hello world"), tt, to!T("q5")) == to!S("qe55o wor5d")); } }(); auto s = to!S("hello world"); dchar[dchar] transTable = ['h' : 'q', 'l' : '5']; static assert(is(typeof(s) == typeof(translate(s, transTable)))); } }); } /++ Ditto +/ C1[] translate(C1, S, C2 = immutable char)(C1[] str, in S[dchar] transTable, const(C2)[] toRemove = null) @safe pure if (isSomeChar!C1 && isSomeString!S && isSomeChar!C2) { import std.array : appender; auto buffer = appender!(C1[])(); translateImpl(str, transTable, toRemove, buffer); return buffer.data; } @trusted pure unittest { import std.conv : to; import std.exception; assertCTFEable!( { foreach (S; AliasSeq!( char[], const( char)[], immutable( char)[], wchar[], const(wchar)[], immutable(wchar)[], dchar[], const(dchar)[], immutable(dchar)[])) { assert(translate(to!S("hello world"), ['h' : "yellow", 'l' : "42"]) == to!S("yellowe4242o wor42d")); assert(translate(to!S("hello world"), ['o' : "owl", 'l' : "\U00010143\U00010143"]) == to!S("he\U00010143\U00010143\U00010143\U00010143owl wowlr\U00010143\U00010143d")); assert(translate(to!S("hello \U00010143 world"), ['h' : "yellow", 'l' : "42"]) == to!S("yellowe4242o \U00010143 wor42d")); assert(translate(to!S("hello \U00010143 world"), ['o' : "owl", 'l' : "\U00010143\U00010143"]) == to!S("he\U00010143\U00010143\U00010143\U00010143owl \U00010143 wowlr\U00010143\U00010143d")); assert(translate(to!S("hello \U00010143 world"), ['h' : ""]) == to!S("ello \U00010143 world")); assert(translate(to!S("hello \U00010143 world"), ['\U00010143' : ""]) == to!S("hello world")); assert(translate(to!S("hello world"), cast(string[dchar])null) == to!S("hello world")); foreach (T; AliasSeq!( char[], const( char)[], immutable( char)[], wchar[], const(wchar)[], immutable(wchar)[], dchar[], const(dchar)[], immutable(dchar)[])) (){ // avoid slow optimizations for large functions @@@BUG@@@ 2396 foreach(R; AliasSeq!(string[dchar], const string[dchar], immutable string[dchar])) { R tt = ['h' : "yellow", 'l' : "42"]; assert(translate(to!S("hello world"), tt, to!T("r")) == to!S("yellowe4242o wo42d")); assert(translate(to!S("hello world"), tt, to!T("helo")) == to!S(" wrd")); assert(translate(to!S("hello world"), tt, to!T("y42")) == to!S("yellowe4242o wor42d")); assert(translate(to!S("hello world"), tt, to!T("hello world")) == to!S("")); assert(translate(to!S("hello world"), tt, to!T("42")) == to!S("yellowe4242o wor42d")); } }(); auto s = to!S("hello world"); string[dchar] transTable = ['h' : "silly", 'l' : "putty"]; static assert(is(typeof(s) == typeof(translate(s, transTable)))); } }); } /++ This is an overload of $(D translate) which takes an existing buffer to write the contents to. Params: str = The original string. transTable = The AA indicating which characters to replace and what to replace them with. toRemove = The characters to remove from the string. buffer = An output range to write the contents to. +/ void translate(C1, C2 = immutable char, Buffer)(C1[] str, in dchar[dchar] transTable, const(C2)[] toRemove, Buffer buffer) if (isSomeChar!C1 && isSomeChar!C2 && isOutputRange!(Buffer, C1)) { translateImpl(str, transTable, toRemove, buffer); } /// @safe pure unittest { import std.array : appender; dchar[dchar] transTable1 = ['e' : '5', 'o' : '7', '5': 'q']; auto buffer = appender!(dchar[])(); translate("hello world", transTable1, null, buffer); assert(buffer.data == "h5ll7 w7rld"); buffer.clear(); translate("hello world", transTable1, "low", buffer); assert(buffer.data == "h5 rd"); buffer.clear(); string[dchar] transTable2 = ['e' : "5", 'o' : "orange"]; translate("hello world", transTable2, null, buffer); assert(buffer.data == "h5llorange worangerld"); } @safe pure unittest // issue 13018 { import std.array : appender; immutable dchar[dchar] transTable1 = ['e' : '5', 'o' : '7', '5': 'q']; auto buffer = appender!(dchar[])(); translate("hello world", transTable1, null, buffer); assert(buffer.data == "h5ll7 w7rld"); buffer.clear(); translate("hello world", transTable1, "low", buffer); assert(buffer.data == "h5 rd"); buffer.clear(); immutable string[dchar] transTable2 = ['e' : "5", 'o' : "orange"]; translate("hello world", transTable2, null, buffer); assert(buffer.data == "h5llorange worangerld"); } /++ Ditto +/ void translate(C1, S, C2 = immutable char, Buffer)(C1[] str, in S[dchar] transTable, const(C2)[] toRemove, Buffer buffer) if (isSomeChar!C1 && isSomeString!S && isSomeChar!C2 && isOutputRange!(Buffer, S)) { translateImpl(str, transTable, toRemove, buffer); } private void translateImpl(C1, T, C2, Buffer)(C1[] str, T transTable, const(C2)[] toRemove, Buffer buffer) { bool[dchar] removeTable; foreach (dchar c; toRemove) removeTable[c] = true; foreach (dchar c; str) { if (c in removeTable) continue; auto newC = c in transTable; if (newC) put(buffer, *newC); else put(buffer, c); } } /++ This is an $(I $(RED ASCII-only)) overload of $(LREF _translate). It will $(I not) work with Unicode. It exists as an optimization for the cases where Unicode processing is not necessary. Unlike the other overloads of $(LREF _translate), this one does not take an AA. Rather, it takes a $(D string) generated by $(LREF makeTransTable). The array generated by $(D makeTransTable) is $(D 256) elements long such that the index is equal to the ASCII character being replaced and the value is equal to the character that it's being replaced with. Note that translate does not decode any of the characters, so you can actually pass it Extended ASCII characters if you want to (ASCII only actually uses $(D 128) characters), but be warned that Extended ASCII characters are not valid Unicode and therefore will result in a $(D UTFException) being thrown from most other Phobos functions. Also, because no decoding occurs, it is possible to use this overload to translate ASCII characters within a proper UTF-8 string without altering the other, non-ASCII characters. It's replacing any code unit greater than $(D 127) with another code unit or replacing any code unit with another code unit greater than $(D 127) which will cause UTF validation issues. See_Also: $(LREF tr) $(XREF array, replace) Params: str = The original string. transTable = The string indicating which characters to replace and what to replace them with. It is generated by $(LREF makeTransTable). toRemove = The characters to remove from the string. +/ C[] translate(C = immutable char)(in char[] str, in char[] transTable, in char[] toRemove = null) @trusted pure nothrow if (is(Unqual!C == char)) in { assert(transTable.length == 256); } body { bool[256] remTable = false; foreach (char c; toRemove) remTable[c] = true; size_t count = 0; foreach (char c; str) { if (!remTable[c]) ++count; } auto buffer = new char[count]; size_t i = 0; foreach (char c; str) { if (!remTable[c]) buffer[i++] = transTable[c]; } return cast(C[])(buffer); } /** * Do same thing as $(LREF makeTransTable) but allocate the translation table * on the GC heap. * * Use $(LREF makeTransTable) instead. */ string makeTrans(in char[] from, in char[] to) @trusted pure nothrow { return makeTransTable(from, to)[].idup; } /// @safe pure nothrow unittest { auto transTable1 = makeTrans("eo5", "57q"); assert(translate("hello world", transTable1) == "h5ll7 w7rld"); assert(translate("hello world", transTable1, "low") == "h5 rd"); } /******* * Construct 256 character translation table, where characters in from[] are replaced * by corresponding characters in to[]. * * Params: * from = array of chars, less than or equal to 256 in length * to = corresponding array of chars to translate to * Returns: * translation array */ char[256] makeTransTable(in char[] from, in char[] to) @safe pure nothrow @nogc in { import std.ascii : isASCII; assert(from.length == to.length); assert(from.length <= 256); foreach (char c; from) assert(std.ascii.isASCII(c)); foreach (char c; to) assert(std.ascii.isASCII(c)); } body { char[256] result = void; foreach (i; 0 .. result.length) result[i] = cast(char)i; foreach (i, c; from) result[c] = to[i]; return result; } @safe pure unittest { import std.conv : to; import std.exception; assertCTFEable!( { foreach (C; AliasSeq!(char, const char, immutable char)) { assert(translate!C("hello world", makeTransTable("hl", "q5")) == to!(C[])("qe55o wor5d")); auto s = to!(C[])("hello world"); auto transTable = makeTransTable("hl", "q5"); static assert(is(typeof(s) == typeof(translate!C(s, transTable)))); } foreach (S; AliasSeq!(char[], const(char)[], immutable(char)[])) { assert(translate(to!S("hello world"), makeTransTable("hl", "q5")) == to!S("qe55o wor5d")); assert(translate(to!S("hello \U00010143 world"), makeTransTable("hl", "q5")) == to!S("qe55o \U00010143 wor5d")); assert(translate(to!S("hello world"), makeTransTable("ol", "1o")) == to!S("heoo1 w1rod")); assert(translate(to!S("hello world"), makeTransTable("", "")) == to!S("hello world")); assert(translate(to!S("hello world"), makeTransTable("12345", "67890")) == to!S("hello world")); assert(translate(to!S("hello \U00010143 world"), makeTransTable("12345", "67890")) == to!S("hello \U00010143 world")); foreach (T; AliasSeq!(char[], const(char)[], immutable(char)[])) (){ // avoid slow optimizations for large functions @@@BUG@@@ 2396 assert(translate(to!S("hello world"), makeTransTable("hl", "q5"), to!T("r")) == to!S("qe55o wo5d")); assert(translate(to!S("hello \U00010143 world"), makeTransTable("hl", "q5"), to!T("r")) == to!S("qe55o \U00010143 wo5d")); assert(translate(to!S("hello world"), makeTransTable("hl", "q5"), to!T("helo")) == to!S(" wrd")); assert(translate(to!S("hello world"), makeTransTable("hl", "q5"), to!T("q5")) == to!S("qe55o wor5d")); }(); } }); } /++ This is an $(I $(RED ASCII-only)) overload of $(D translate) which takes an existing buffer to write the contents to. Params: str = The original string. transTable = The string indicating which characters to replace and what to replace them with. It is generated by $(LREF makeTransTable). toRemove = The characters to remove from the string. buffer = An output range to write the contents to. +/ void translate(C = immutable char, Buffer)(in char[] str, in char[] transTable, in char[] toRemove, Buffer buffer) @trusted pure if (is(Unqual!C == char) && isOutputRange!(Buffer, char)) in { assert(transTable.length == 256); } body { bool[256] remTable = false; foreach (char c; toRemove) remTable[c] = true; foreach (char c; str) { if (!remTable[c]) put(buffer, transTable[c]); } } /// @safe pure unittest { import std.array : appender; auto buffer = appender!(char[])(); auto transTable1 = makeTransTable("eo5", "57q"); translate("hello world", transTable1, null, buffer); assert(buffer.data == "h5ll7 w7rld"); buffer.clear(); translate("hello world", transTable1, "low", buffer); assert(buffer.data == "h5 rd"); } /*********************************************** * See if character c is in the pattern. * Patterns: * * A <i>pattern</i> is an array of characters much like a <i>character * class</i> in regular expressions. A sequence of characters * can be given, such as "abcde". The '-' can represent a range * of characters, as "a-e" represents the same pattern as "abcde". * "a-fA-F0-9" represents all the hex characters. * If the first character of a pattern is '^', then the pattern * is negated, i.e. "^0-9" means any character except a digit. * The functions inPattern, <b>countchars</b>, <b>removeschars</b>, * and <b>squeeze</b> * use patterns. * * Note: In the future, the pattern syntax may be improved * to be more like regular expression character classes. */ bool inPattern(S)(dchar c, in S pattern) @safe pure @nogc if (isSomeString!S) { bool result = false; int range = 0; dchar lastc; foreach (size_t i, dchar p; pattern) { if (p == '^' && i == 0) { result = true; if (i + 1 == pattern.length) return (c == p); // or should this be an error? } else if (range) { range = 0; if (lastc <= c && c <= p || c == p) return !result; } else if (p == '-' && i > result && i + 1 < pattern.length) { range = 1; continue; } else if (c == p) return !result; lastc = p; } return result; } @safe pure @nogc unittest { import std.conv : to; debug(string) trustedPrintf("std.string.inPattern.unittest\n"); import std.exception; assertCTFEable!( { assert(inPattern('x', "x") == 1); assert(inPattern('x', "y") == 0); assert(inPattern('x', string.init) == 0); assert(inPattern('x', "^y") == 1); assert(inPattern('x', "yxxy") == 1); assert(inPattern('x', "^yxxy") == 0); assert(inPattern('x', "^abcd") == 1); assert(inPattern('^', "^^") == 0); assert(inPattern('^', "^") == 1); assert(inPattern('^', "a^") == 1); assert(inPattern('x', "a-z") == 1); assert(inPattern('x', "A-Z") == 0); assert(inPattern('x', "^a-z") == 0); assert(inPattern('x', "^A-Z") == 1); assert(inPattern('-', "a-") == 1); assert(inPattern('-', "^A-") == 0); assert(inPattern('a', "z-a") == 1); assert(inPattern('z', "z-a") == 1); assert(inPattern('x', "z-a") == 0); }); } /*********************************************** * See if character c is in the intersection of the patterns. */ bool inPattern(S)(dchar c, S[] patterns) @safe pure @nogc if (isSomeString!S) { foreach (string pattern; patterns) { if (!inPattern(c, pattern)) { return false; } } return true; } /******************************************** * Count characters in s that match pattern. */ size_t countchars(S, S1)(S s, in S1 pattern) @safe pure @nogc if (isSomeString!S && isSomeString!S1) { size_t count; foreach (dchar c; s) { count += inPattern(c, pattern); } return count; } @safe pure @nogc unittest { import std.conv : to; debug(string) trustedPrintf("std.string.count.unittest\n"); import std.exception; assertCTFEable!( { assert(countchars("abc", "a-c") == 3); assert(countchars("hello world", "or") == 3); }); } /******************************************** * Return string that is s with all characters removed that match pattern. */ S removechars(S)(S s, in S pattern) @safe pure if (isSomeString!S) { import std.utf : encode; Unqual!(typeof(s[0]))[] r; bool changed = false; foreach (size_t i, dchar c; s) { if (inPattern(c, pattern)) { if (!changed) { changed = true; r = s[0 .. i].dup; } continue; } if (changed) { std.utf.encode(r, c); } } if (changed) return r; else return s; } @safe pure unittest { import std.conv : to; debug(string) trustedPrintf("std.string.removechars.unittest\n"); import std.exception; assertCTFEable!( { assert(removechars("abc", "a-c").length == 0); assert(removechars("hello world", "or") == "hell wld"); assert(removechars("hello world", "d") == "hello worl"); assert(removechars("hah", "h") == "a"); }); } /*************************************************** * Return string where sequences of a character in s[] from pattern[] * are replaced with a single instance of that character. * If pattern is null, it defaults to all characters. */ S squeeze(S)(S s, in S pattern = null) { import std.utf : encode; Unqual!(typeof(s[0]))[] r; dchar lastc; size_t lasti; int run; bool changed; foreach (size_t i, dchar c; s) { if (run && lastc == c) { changed = true; } else if (pattern is null || inPattern(c, pattern)) { run = 1; if (changed) { if (r is null) r = s[0 .. lasti].dup; std.utf.encode(r, c); } else lasti = i + std.utf.stride(s, i); lastc = c; } else { run = 0; if (changed) { if (r is null) r = s[0 .. lasti].dup; std.utf.encode(r, c); } } } return changed ? ((r is null) ? s[0 .. lasti] : cast(S) r) : s; } @trusted pure unittest { import std.conv : to; debug(string) trustedPrintf("std.string.squeeze.unittest\n"); import std.exception; assertCTFEable!( { string s; assert(squeeze("hello") == "helo"); s = "abcd"; assert(squeeze(s) is s); s = "xyzz"; assert(squeeze(s).ptr == s.ptr); // should just be a slice assert(squeeze("hello goodbyee", "oe") == "hello godbye"); }); } /*************************************************************** Finds the position $(D_PARAM pos) of the first character in $(D_PARAM s) that does not match $(D_PARAM pattern) (in the terminology used by $(LINK2 std_string.html,inPattern)). Updates $(D_PARAM s = s[pos..$]). Returns the slice from the beginning of the original (before update) string up to, and excluding, $(D_PARAM pos). The $(D_PARAM munch) function is mostly convenient for skipping certain category of characters (e.g. whitespace) when parsing strings. (In such cases, the return value is not used.) */ S1 munch(S1, S2)(ref S1 s, S2 pattern) @safe pure @nogc { size_t j = s.length; foreach (i, dchar c; s) { if (!inPattern(c, pattern)) { j = i; break; } } scope(exit) s = s[j .. $]; return s[0 .. j]; } /// @safe pure @nogc unittest { string s = "123abc"; string t = munch(s, "0123456789"); assert(t == "123" && s == "abc"); t = munch(s, "0123456789"); assert(t == "" && s == "abc"); } @safe pure @nogc unittest { string s = "123€abc"; string t = munch(s, "0123456789"); assert(t == "123" && s == "€abc"); t = munch(s, "0123456789"); assert(t == "" && s == "€abc"); t = munch(s, "£$€¥"); assert(t == "€" && s == "abc"); } /********************************************** * Return string that is the 'successor' to s[]. * If the rightmost character is a-zA-Z0-9, it is incremented within * its case or digits. If it generates a carry, the process is * repeated with the one to its immediate left. */ S succ(S)(S s) @safe pure if (isSomeString!S) { import std.ascii : isAlphaNum; if (s.length && std.ascii.isAlphaNum(s[$ - 1])) { auto r = s.dup; size_t i = r.length - 1; while (1) { dchar c = s[i]; dchar carry; switch (c) { case '9': c = '0'; carry = '1'; goto Lcarry; case 'z': case 'Z': c -= 'Z' - 'A'; carry = c; Lcarry: r[i] = cast(char)c; if (i == 0) { auto t = new typeof(r[0])[r.length + 1]; t[0] = cast(char) carry; t[1 .. $] = r[]; return t; } i--; break; default: if (std.ascii.isAlphaNum(c)) r[i]++; return r; } } } return s; } /// @safe pure unittest { assert(succ("1") == "2"); assert(succ("9") == "10"); assert(succ("999") == "1000"); assert(succ("zz99") == "aaa00"); } @safe pure unittest { import std.conv : to; debug(string) trustedPrintf("std.string.succ.unittest\n"); import std.exception; assertCTFEable!( { assert(succ(string.init) is null); assert(succ("!@#$%") == "!@#$%"); assert(succ("1") == "2"); assert(succ("9") == "10"); assert(succ("999") == "1000"); assert(succ("zz99") == "aaa00"); }); } /++ Replaces the characters in $(D str) which are in $(D from) with the the corresponding characters in $(D to) and returns the resulting string. $(D tr) is based on $(WEB pubs.opengroup.org/onlinepubs/9699919799/utilities/_tr.html, Posix's tr), though it doesn't do everything that the Posix utility does. Params: str = The original string. from = The characters to replace. to = The characters to replace with. modifiers = String containing modifiers. Modifiers: $(BOOKTABLE, $(TR $(TD Modifier) $(TD Description)) $(TR $(TD $(D 'c')) $(TD Complement the list of characters in $(D from))) $(TR $(TD $(D 'd')) $(TD Removes matching characters with no corresponding replacement in $(D to))) $(TR $(TD $(D 's')) $(TD Removes adjacent duplicates in the replaced characters)) ) If the modifier $(D 'd') is present, then the number of characters in $(D to) may be only $(D 0) or $(D 1). If the modifier $(D 'd') is $(I not) present, and $(D to) is empty, then $(D to) is taken to be the same as $(D from). If the modifier $(D 'd') is $(I not) present, and $(D to) is shorter than $(D from), then $(D to) is extended by replicating the last character in $(D to). Both $(D from) and $(D to) may contain ranges using the $(D '-') character (e.g. $(D "a-d") is synonymous with $(D "abcd").) Neither accept a leading $(D '^') as meaning the complement of the string (use the $(D 'c') modifier for that). +/ C1[] tr(C1, C2, C3, C4 = immutable char) (C1[] str, const(C2)[] from, const(C3)[] to, const(C4)[] modifiers = null) { import std.conv : conv_to = to; import std.utf : decode; import std.array : appender; bool mod_c; bool mod_d; bool mod_s; foreach (char c; modifiers) { switch (c) { case 'c': mod_c = 1; break; // complement case 'd': mod_d = 1; break; // delete unreplaced chars case 's': mod_s = 1; break; // squeeze duplicated replaced chars default: assert(0); } } if (to.empty && !mod_d) to = conv_to!(typeof(to))(from); auto result = appender!(C1[])(); bool modified; dchar lastc; foreach (dchar c; str) { dchar lastf; dchar lastt; dchar newc; int n = 0; for (size_t i = 0; i < from.length; ) { dchar f = std.utf.decode(from, i); if (f == '-' && lastf != dchar.init && i < from.length) { dchar nextf = std.utf.decode(from, i); if (lastf <= c && c <= nextf) { n += c - lastf - 1; if (mod_c) goto Lnotfound; goto Lfound; } n += nextf - lastf; lastf = lastf.init; continue; } if (c == f) { if (mod_c) goto Lnotfound; goto Lfound; } lastf = f; n++; } if (!mod_c) goto Lnotfound; n = 0; // consider it 'found' at position 0 Lfound: // Find the nth character in to[] dchar nextt; for (size_t i = 0; i < to.length; ) { dchar t = std.utf.decode(to, i); if (t == '-' && lastt != dchar.init && i < to.length) { nextt = std.utf.decode(to, i); n -= nextt - lastt; if (n < 0) { newc = nextt + n + 1; goto Lnewc; } lastt = dchar.init; continue; } if (n == 0) { newc = t; goto Lnewc; } lastt = t; nextt = t; n--; } if (mod_d) continue; newc = nextt; Lnewc: if (mod_s && modified && newc == lastc) continue; result.put(newc); assert(newc != dchar.init); modified = true; lastc = newc; continue; Lnotfound: result.put(c); lastc = c; modified = false; } return result.data; } unittest { import std.conv : to; debug(string) trustedPrintf("std.string.tr.unittest\n"); import std.algorithm : equal; // Complete list of test types; too slow to test'em all // alias TestTypes = AliasSeq!( // char[], const( char)[], immutable( char)[], // wchar[], const(wchar)[], immutable(wchar)[], // dchar[], const(dchar)[], immutable(dchar)[]); // Reduced list of test types alias TestTypes = AliasSeq!(char[], const(wchar)[], immutable(dchar)[]); import std.exception; assertCTFEable!( { foreach (S; TestTypes) { foreach (T; TestTypes) { foreach (U; TestTypes) { assert(equal(tr(to!S("abcdef"), to!T("cd"), to!U("CD")), "abCDef")); assert(equal(tr(to!S("abcdef"), to!T("b-d"), to!U("B-D")), "aBCDef")); assert(equal(tr(to!S("abcdefgh"), to!T("b-dh"), to!U("B-Dx")), "aBCDefgx")); assert(equal(tr(to!S("abcdefgh"), to!T("b-dh"), to!U("B-CDx")), "aBCDefgx")); assert(equal(tr(to!S("abcdefgh"), to!T("b-dh"), to!U("B-BCDx")), "aBCDefgx")); assert(equal(tr(to!S("abcdef"), to!T("ef"), to!U("*"), to!S("c")), "****ef")); assert(equal(tr(to!S("abcdef"), to!T("ef"), to!U(""), to!T("d")), "abcd")); assert(equal(tr(to!S("hello goodbye"), to!T("lo"), to!U(""), to!U("s")), "helo godbye")); assert(equal(tr(to!S("hello goodbye"), to!T("lo"), to!U("x"), "s"), "hex gxdbye")); assert(equal(tr(to!S("14-Jul-87"), to!T("a-zA-Z"), to!U(" "), "cs"), " Jul ")); assert(equal(tr(to!S("Abc"), to!T("AAA"), to!U("XYZ")), "Xbc")); } } auto s = to!S("hello world"); static assert(is(typeof(s) == typeof(tr(s, "he", "if")))); } }); } /* ************************************************ * Version : v0.3 * Author : David L. 'SpottedTiger' Davis * Date Created : 31.May.05 Compiled and Tested with dmd v0.125 * Date Modified : 01.Jun.05 Modified the function to handle the * : imaginary and complex float-point * : datatypes. * : * Licence : Public Domain / Contributed to Digital Mars */ /** * [in] string s can be formatted in the following ways: * * Integer Whole Number: * (for byte, ubyte, short, ushort, int, uint, long, and ulong) * ['+'|'-']digit(s)[U|L|UL] * * examples: 123, 123UL, 123L, +123U, -123L * * Floating-Point Number: * (for float, double, real, ifloat, idouble, and ireal) * ['+'|'-']digit(s)[.][digit(s)][[e-|e+]digit(s)][i|f|L|Li|fi]] * or [nan|nani|inf|-inf] * * examples: +123., -123.01, 123.3e-10f, 123.3e-10fi, 123.3e-10L * * (for cfloat, cdouble, and creal) * ['+'|'-']digit(s)[.][digit(s)][[e-|e+]digit(s)][+] * [digit(s)[.][digit(s)][[e-|e+]digit(s)][i|f|L|Li|fi]] * or [nan|nani|nan+nani|inf|-inf] * * examples: nan, -123e-1+456.9e-10Li, +123e+10+456i, 123+456 * * [in] bool bAllowSep * False by default, but when set to true it will accept the * separator characters $(D ',') and $(D '__') within the string, but these * characters should be stripped from the string before using any * of the conversion functions like toInt(), toFloat(), and etc * else an error will occur. * * Also please note, that no spaces are allowed within the string * anywhere whether it's a leading, trailing, or embedded space(s), * thus they too must be stripped from the string before using this * function, or any of the conversion functions. */ bool isNumeric(const(char)[] s, in bool bAllowSep = false) @safe pure { import std.algorithm : among; immutable iLen = s.length; if (iLen == 0) return false; // Check for NaN (Not a Number) and for Infinity if (s.among!((a, b) => icmp(a, b) == 0) ("nan", "nani", "nan+nani", "inf", "-inf")) return true; immutable j = s[0].among!('-', '+')() != 0; bool bDecimalPoint, bExponent, bComplex, sawDigits; for (size_t i = j; i < iLen; i++) { immutable c = s[i]; // Digits are good, continue checking // with the popFront character... ;) if (c >= '0' && c <= '9') { sawDigits = true; continue; } // Check for the complex type, and if found // reset the flags for checking the 2nd number. if (c == '+') { if (!i) return false; bDecimalPoint = false; bExponent = false; bComplex = true; sawDigits = false; continue; } // Allow only one exponent per number if (c.among!('e', 'E')()) { // A 2nd exponent found, return not a number if (bExponent || i + 1 >= iLen) return false; // Look forward for the sign, and if // missing then this is not a number. if (!s[i + 1].among!('-', '+')()) return false; bExponent = true; i++; continue; } // Allow only one decimal point per number to be used if (c == '.' ) { // A 2nd decimal point found, return not a number if (bDecimalPoint) return false; bDecimalPoint = true; continue; } // Check for ending literal characters: "f,u,l,i,ul,fi,li", // and whether they're being used with the correct datatype. if (i == iLen - 2) { if (!sawDigits) return false; // Integer Whole Number if (icmp(s[i..iLen], "ul") == 0 && (!bDecimalPoint && !bExponent && !bComplex)) return true; // Floating-Point Number if (s[i..iLen].among!((a, b) => icmp(a, b) == 0)("fi", "li") && (bDecimalPoint || bExponent || bComplex)) return true; if (icmp(s[i..iLen], "ul") == 0 && (bDecimalPoint || bExponent || bComplex)) return false; // Could be a Integer or a Float, thus // all these suffixes are valid for both return s[i..iLen].among!((a, b) => icmp(a, b) == 0) ("ul", "fi", "li") != 0; } if (i == iLen - 1) { if (!sawDigits) return false; // Integer Whole Number if (c.among!('u', 'l', 'U', 'L')() && (!bDecimalPoint && !bExponent && !bComplex)) return true; // Check to see if the last character in the string // is the required 'i' character if (bComplex) return c.among!('i', 'I')() != 0; // Floating-Point Number return c.among!('l', 'L', 'f', 'F', 'i', 'I')() != 0; } // Check if separators are allowed to be in the numeric string if (!bAllowSep || !c.among!('_', ',')()) return false; } return sawDigits; } @safe pure unittest { assert(!isNumeric("F")); assert(!isNumeric("L")); assert(!isNumeric("U")); assert(!isNumeric("i")); assert(!isNumeric("fi")); assert(!isNumeric("ul")); assert(!isNumeric("li")); assert(!isNumeric(".")); assert(!isNumeric("-")); assert(!isNumeric("+")); assert(!isNumeric("e-")); assert(!isNumeric("e+")); assert(!isNumeric(".f")); assert(!isNumeric("e+f")); } @trusted unittest { import std.conv : to; debug(string) trustedPrintf("isNumeric(in string, bool = false).unittest\n"); import std.exception; assertCTFEable!( { // Test the isNumeric(in string) function assert(isNumeric("1") == true ); assert(isNumeric("1.0") == true ); assert(isNumeric("1e-1") == true ); assert(isNumeric("12345xxxx890") == false ); assert(isNumeric("567L") == true ); assert(isNumeric("23UL") == true ); assert(isNumeric("-123..56f") == false ); assert(isNumeric("12.3.5.6") == false ); assert(isNumeric(" 12.356") == false ); assert(isNumeric("123 5.6") == false ); assert(isNumeric("1233E-1+1.0e-1i") == true ); assert(isNumeric("123.00E-5+1234.45E-12Li") == true); assert(isNumeric("123.00e-5+1234.45E-12iL") == false); assert(isNumeric("123.00e-5+1234.45e-12uL") == false); assert(isNumeric("123.00E-5+1234.45e-12lu") == false); assert(isNumeric("123fi") == true); assert(isNumeric("123li") == true); assert(isNumeric("--123L") == false); assert(isNumeric("+123.5UL") == false); assert(isNumeric("123f") == true); assert(isNumeric("123.u") == false); // @@@BUG@@ to!string(float) is not CTFEable. // Related: formatValue(T) if (is(FloatingPointTypeOf!T)) if (!__ctfe) { assert(isNumeric(to!string(real.nan)) == true); assert(isNumeric(to!string(-real.infinity)) == true); assert(isNumeric(to!string(123e+2+1234.78Li)) == true); } string s = "$250.99-"; assert(isNumeric(s[1..s.length - 2]) == true); assert(isNumeric(s) == false); assert(isNumeric(s[0..s.length - 1]) == false); }); assert(!isNumeric("-")); assert(!isNumeric("+")); } /***************************** * Soundex algorithm. * * The Soundex algorithm converts a word into 4 characters * based on how the word sounds phonetically. The idea is that * two spellings that sound alike will have the same Soundex * value, which means that Soundex can be used for fuzzy matching * of names. * * Params: * str = String or InputRange to convert to Soundex representation. * * Returns: * The four character array with the Soundex result in it. * The array has zero's in it if there is no Soundex representation for the string. * * See_Also: * $(LINK2 http://en.wikipedia.org/wiki/Soundex, Wikipedia), * $(LUCKY The Soundex Indexing System) * $(LREF soundex) * * Bugs: * Only works well with English names. * There are other arguably better Soundex algorithms, * but this one is the standard one. */ char[4] soundexer(Range)(Range str) if (isInputRange!Range && isSomeChar!(ElementEncodingType!Range) && !isConvertibleToString!Range) { alias C = Unqual!(ElementEncodingType!Range); static immutable dex = // ABCDEFGHIJKLMNOPQRSTUVWXYZ "01230120022455012623010202"; char[4] result = void; size_t b = 0; C lastc; foreach (C c; str) { if (c >= 'a' && c <= 'z') c -= 'a' - 'A'; else if (c >= 'A' && c <= 'Z') { } else { lastc = lastc.init; continue; } if (b == 0) { result[0] = cast(char)c; b++; lastc = dex[c - 'A']; } else { if (c == 'H' || c == 'W') continue; if (c == 'A' || c == 'E' || c == 'I' || c == 'O' || c == 'U') lastc = lastc.init; c = dex[c - 'A']; if (c != '0' && c != lastc) { result[b] = cast(char)c; b++; lastc = c; } if (b == 4) goto Lret; } } if (b == 0) result[] = 0; else result[b .. 4] = '0'; Lret: return result; } char[4] soundexer(Range)(auto ref Range str) if (isConvertibleToString!Range) { return soundexer!(StringTypeOf!Range)(str); } /***************************** * Like $(LREF soundexer), but with different parameters * and return value. * * Params: * str = String to convert to Soundex representation. * buffer = Optional 4 char array to put the resulting Soundex * characters into. If null, the return value * buffer will be allocated on the heap. * Returns: * The four character array with the Soundex result in it. * Returns null if there is no Soundex representation for the string. * See_Also: * $(LREF soundexer) */ char[] soundex(const(char)[] str, char[] buffer = null) @safe pure nothrow in { assert(!buffer.ptr || buffer.length >= 4); } out (result) { if (result.ptr) { assert(result.length == 4); assert(result[0] >= 'A' && result[0] <= 'Z'); foreach (char c; result[1 .. 4]) assert(c >= '0' && c <= '6'); } } body { char[4] result = soundexer(str); if (result[0] == 0) return null; if (!buffer.ptr) buffer = new char[4]; buffer[] = result[]; return buffer; } @safe pure nothrow unittest { import std.exception; assertCTFEable!( { char[4] buffer; assert(soundex(null) == null); assert(soundex("") == null); assert(soundex("0123^&^^**&^") == null); assert(soundex("Euler") == "E460"); assert(soundex(" Ellery ") == "E460"); assert(soundex("Gauss") == "G200"); assert(soundex("Ghosh") == "G200"); assert(soundex("Hilbert") == "H416"); assert(soundex("Heilbronn") == "H416"); assert(soundex("Knuth") == "K530"); assert(soundex("Kant", buffer) == "K530"); assert(soundex("Lloyd") == "L300"); assert(soundex("Ladd") == "L300"); assert(soundex("Lukasiewicz", buffer) == "L222"); assert(soundex("Lissajous") == "L222"); assert(soundex("Robert") == "R163"); assert(soundex("Rupert") == "R163"); assert(soundex("Rubin") == "R150"); assert(soundex("Washington") == "W252"); assert(soundex("Lee") == "L000"); assert(soundex("Gutierrez") == "G362"); assert(soundex("Pfister") == "P236"); assert(soundex("Jackson") == "J250"); assert(soundex("Tymczak") == "T522"); assert(soundex("Ashcraft") == "A261"); assert(soundex("Woo") == "W000"); assert(soundex("Pilgrim") == "P426"); assert(soundex("Flingjingwaller") == "F452"); assert(soundex("PEARSE") == "P620"); assert(soundex("PIERCE") == "P620"); assert(soundex("Price") == "P620"); assert(soundex("CATHY") == "C300"); assert(soundex("KATHY") == "K300"); assert(soundex("Jones") == "J520"); assert(soundex("johnsons") == "J525"); assert(soundex("Hardin") == "H635"); assert(soundex("Martinez") == "M635"); import std.utf; assert(soundexer("Martinez".byChar ) == "M635"); assert(soundexer("Martinez".byWchar) == "M635"); assert(soundexer("Martinez".byDchar) == "M635"); }); } unittest { assert(testAliasedString!soundexer("Martinez")); } /*************************************************** * Construct an associative array consisting of all * abbreviations that uniquely map to the strings in values. * * This is useful in cases where the user is expected to type * in one of a known set of strings, and the program will helpfully * autocomplete the string once sufficient characters have been * entered that uniquely identify it. * Example: * --- * import std.stdio; * import std.string; * * void main() * { * static string[] list = [ "food", "foxy" ]; * * auto abbrevs = std.string.abbrev(list); * * foreach (key, value; abbrevs) * { * writefln("%s => %s", key, value); * } * } * --- * produces the output: * <pre> * fox =&gt; foxy * food =&gt; food * foxy =&gt; foxy * foo =&gt; food * </pre> */ string[string] abbrev(string[] values) @safe pure { import std.algorithm : sort; string[string] result; // Make a copy when sorting so we follow COW principles. values = values.dup; sort(values); size_t values_length = values.length; size_t lasti = values_length; size_t nexti; string nv; string lv; for (size_t i = 0; i < values_length; i = nexti) { string value = values[i]; // Skip dups for (nexti = i + 1; nexti < values_length; nexti++) { nv = values[nexti]; if (value != values[nexti]) break; } for (size_t j = 0; j < value.length; j += std.utf.stride(value, j)) { string v = value[0 .. j]; if ((nexti == values_length || j > nv.length || v != nv[0 .. j]) && (lasti == values_length || j > lv.length || v != lv[0 .. j])) { result[v] = value; } } result[value] = value; lasti = i; lv = value; } return result; } @trusted pure unittest { import std.conv : to; import std.algorithm : sort; debug(string) trustedPrintf("string.abbrev.unittest\n"); import std.exception; assertCTFEable!( { string[] values; values ~= "hello"; values ~= "hello"; values ~= "he"; string[string] r; r = abbrev(values); auto keys = r.keys.dup; sort(keys); assert(keys.length == 4); assert(keys[0] == "he"); assert(keys[1] == "hel"); assert(keys[2] == "hell"); assert(keys[3] == "hello"); assert(r[keys[0]] == "he"); assert(r[keys[1]] == "hello"); assert(r[keys[2]] == "hello"); assert(r[keys[3]] == "hello"); }); } /****************************************** * Compute _column number at the end of the printed form of the string, * assuming the string starts in the leftmost _column, which is numbered * starting from 0. * * Tab characters are expanded into enough spaces to bring the _column number * to the next multiple of tabsize. * If there are multiple lines in the string, the _column number of the last * line is returned. * * Params: * str = string or InputRange to be analyzed * tabsize = number of columns a tab character represents * * Returns: * column number */ size_t column(Range)(Range str, in size_t tabsize = 8) if ((isInputRange!Range && isSomeChar!(Unqual!(ElementEncodingType!Range)) || isNarrowString!Range) && !isConvertibleToString!Range) { static if (is(Unqual!(ElementEncodingType!Range) == char)) { // decoding needed for chars import std.utf: byDchar; return str.byDchar.column(tabsize); } else { // decoding not needed for wchars and dchars import std.uni : lineSep, paraSep, nelSep; size_t column; foreach (const c; str) { switch (c) { case '\t': column = (column + tabsize) / tabsize * tabsize; break; case '\r': case '\n': case paraSep: case lineSep: case nelSep: column = 0; break; default: column++; break; } } return column; } } /// unittest { import std.utf : byChar, byWchar, byDchar; assert(column("1234 ") == 5); assert(column("1234 "w) == 5); assert(column("1234 "d) == 5); assert(column("1234 ".byChar()) == 5); assert(column("1234 "w.byWchar()) == 5); assert(column("1234 "d.byDchar()) == 5); // Tab stops are set at 8 spaces by default; tab characters insert enough // spaces to bring the column position to the next multiple of 8. assert(column("\t") == 8); assert(column("1\t") == 8); assert(column("\t1") == 9); assert(column("123\t") == 8); // Other tab widths are possible by specifying it explicitly: assert(column("\t", 4) == 4); assert(column("1\t", 4) == 4); assert(column("\t1", 4) == 5); assert(column("123\t", 4) == 4); // New lines reset the column number. assert(column("abc\n") == 0); assert(column("abc\n1") == 1); assert(column("abcdefg\r1234") == 4); assert(column("abc\u20281") == 1); assert(column("abc\u20291") == 1); assert(column("abc\u00851") == 1); assert(column("abc\u00861") == 5); } size_t column(Range)(auto ref Range str, in size_t tabsize = 8) if (isConvertibleToString!Range) { return column!(StringTypeOf!Range)(str, tabsize); } unittest { assert(testAliasedString!column("abc\u00861")); } @safe @nogc unittest { import std.conv : to; debug(string) trustedPrintf("string.column.unittest\n"); import std.exception; assertCTFEable!( { assert(column(string.init) == 0); assert(column("") == 0); assert(column("\t") == 8); assert(column("abc\t") == 8); assert(column("12345678\t") == 16); }); } /****************************************** * Wrap text into a paragraph. * * The input text string s is formed into a paragraph * by breaking it up into a sequence of lines, delineated * by \n, such that the number of columns is not exceeded * on each line. * The last line is terminated with a \n. * Params: * s = text string to be wrapped * columns = maximum number of _columns in the paragraph * firstindent = string used to _indent first line of the paragraph * indent = string to use to _indent following lines of the paragraph * tabsize = column spacing of tabs in firstindent[] and indent[] * Returns: * resulting paragraph as an allocated string */ S wrap(S)(S s, in size_t columns = 80, S firstindent = null, S indent = null, in size_t tabsize = 8) if (isSomeString!S) { typeof(s.dup) result; bool inword; bool first = true; size_t wordstart; const indentcol = column(indent, tabsize); result.length = firstindent.length + s.length; result.length = firstindent.length; result[] = firstindent[]; auto col = column(firstindent, tabsize); foreach (size_t i, dchar c; s) { if (std.uni.isWhite(c)) { if (inword) { if (first) { } else if (col + 1 + (i - wordstart) > columns) { result ~= '\n'; result ~= indent; col = indentcol; } else { result ~= ' '; col += 1; } result ~= s[wordstart .. i]; col += i - wordstart; inword = false; first = false; } } else { if (!inword) { wordstart = i; inword = true; } } } if (inword) { if (col + 1 + (s.length - wordstart) >= columns) { result ~= '\n'; result ~= indent; } else if (result.length != firstindent.length) result ~= ' '; result ~= s[wordstart .. s.length]; } result ~= '\n'; return result; } /// @safe pure unittest { assert(wrap("a short string", 7) == "a short\nstring\n"); // wrap will not break inside of a word, but at the next space assert(wrap("a short string", 4) == "a\nshort\nstring\n"); assert(wrap("a short string", 7, "\t") == "\ta\nshort\nstring\n"); assert(wrap("a short string", 7, "\t", " ") == "\ta\n short\n string\n"); } @safe pure unittest { import std.conv : to; debug(string) trustedPrintf("string.wrap.unittest\n"); import std.exception; assertCTFEable!( { assert(wrap(string.init) == "\n"); assert(wrap(" a b df ") == "a b df\n"); assert(wrap(" a b df ", 3) == "a b\ndf\n"); assert(wrap(" a bc df ", 3) == "a\nbc\ndf\n"); assert(wrap(" abcd df ", 3) == "abcd\ndf\n"); assert(wrap("x") == "x\n"); assert(wrap("u u") == "u u\n"); assert(wrap("abcd", 3) == "\nabcd\n"); assert(wrap("a de", 10, "\t", " ", 8) == "\ta\n de\n"); }); } /****************************************** * Removes one level of indentation from a multi-line string. * * This uniformly outdents the text as much as possible. * Whitespace-only lines are always converted to blank lines. * * Does not allocate memory if it does not throw. * * Params: * str = multi-line string * * Returns: * outdented string * * Throws: * StringException if indentation is done with different sequences * of whitespace characters. */ S outdent(S)(S str) @safe pure if(isSomeString!S) { return str.splitLines(KeepTerminator.yes).outdent().join(); } /// @safe pure unittest { enum pretty = q{ import std.stdio; void main() { writeln("Hello"); } }.outdent(); enum ugly = q{ import std.stdio; void main() { writeln("Hello"); } }; assert(pretty == ugly); } /****************************************** * Removes one level of indentation from an array of single-line strings. * * This uniformly outdents the text as much as possible. * Whitespace-only lines are always converted to blank lines. * * Params: * lines = array of single-line strings * * Returns: * lines[] is rewritten in place with outdented lines * * Throws: * StringException if indentation is done with different sequences * of whitespace characters. */ S[] outdent(S)(S[] lines) @safe pure if(isSomeString!S) { import std.algorithm : startsWith; if (lines.empty) { return null; } static S leadingWhiteOf(S str) { return str[ 0 .. $ - stripLeft(str).length ]; } S shortestIndent; foreach (ref line; lines) { auto stripped = line.stripLeft(); if (stripped.empty) { line = line[line.chomp().length .. $]; } else { auto indent = leadingWhiteOf(line); // Comparing number of code units instead of code points is OK here // because this function throws upon inconsistent indentation. if (shortestIndent is null || indent.length < shortestIndent.length) { if (indent.empty) return lines; shortestIndent = indent; } } } foreach (ref line; lines) { auto stripped = line.stripLeft(); if (stripped.empty) { // Do nothing } else if (line.startsWith(shortestIndent)) { line = line[shortestIndent.length .. $]; } else { throw new StringException("outdent: Inconsistent indentation"); } } return lines; } @safe pure unittest { import std.conv : to; debug(string) trustedPrintf("string.outdent.unittest\n"); template outdent_testStr(S) { enum S outdent_testStr = " \t\tX \t\U00010143X \t\t \t\t\tX \t "; } template outdent_expected(S) { enum S outdent_expected = " \tX \U00010143X \t\tX "; } import std.exception; assertCTFEable!( { foreach (S; AliasSeq!(string, wstring, dstring)) { enum S blank = ""; assert(blank.outdent() == blank); static assert(blank.outdent() == blank); enum S testStr1 = " \n \t\n "; enum S expected1 = "\n\n"; assert(testStr1.outdent() == expected1); static assert(testStr1.outdent() == expected1); assert(testStr1[0..$-1].outdent() == expected1); static assert(testStr1[0..$-1].outdent() == expected1); enum S testStr2 = "a\n \t\nb"; assert(testStr2.outdent() == testStr2); static assert(testStr2.outdent() == testStr2); enum S testStr3 = " \t\tX \t\U00010143X \t\t \t\t\tX \t "; enum S expected3 = " \tX \U00010143X \t\tX "; assert(testStr3.outdent() == expected3); static assert(testStr3.outdent() == expected3); enum testStr4 = " X\r X\n X\r\n X\u2028 X\u2029 X"; enum expected4 = "X\rX\nX\r\nX\u2028X\u2029X"; assert(testStr4.outdent() == expected4); static assert(testStr4.outdent() == expected4); enum testStr5 = testStr4[0..$-1]; enum expected5 = expected4[0..$-1]; assert(testStr5.outdent() == expected5); static assert(testStr5.outdent() == expected5); enum testStr6 = " \r \n \r\n \u2028 \u2029"; enum expected6 = "\r\n\r\n\u2028\u2029"; assert(testStr6.outdent() == expected6); static assert(testStr6.outdent() == expected6); enum testStr7 = " a \n b "; enum expected7 = "a \nb "; assert(testStr7.outdent() == expected7); static assert(testStr7.outdent() == expected7); } }); } /** Assume the given array of integers $(D arr) is a well-formed UTF string and return it typed as a UTF string. $(D ubyte) becomes $(D char), $(D ushort) becomes $(D wchar) and $(D uint) becomes $(D dchar). Type qualifiers are preserved. Params: arr = array of bytes, ubytes, shorts, ushorts, ints, or uints Returns: arr retyped as an array of chars, wchars, or dchars See_Also: $(LREF representation) */ auto assumeUTF(T)(T[] arr) pure if(staticIndexOf!(Unqual!T, ubyte, ushort, uint) != -1) { import std.utf : validate; alias ToUTFType(U) = AliasSeq!(char, wchar, dchar)[U.sizeof / 2]; auto asUTF = cast(ModifyTypePreservingTQ!(ToUTFType, T)[])arr; debug validate(asUTF); return asUTF; } /// @safe pure unittest { string a = "Hölo World"; immutable(ubyte)[] b = a.representation; string c = b.assumeUTF; assert(a == c); } pure unittest { import std.algorithm : equal; foreach(T; AliasSeq!(char[], wchar[], dchar[])) { immutable T jti = "Hello World"; T jt = jti.dup; static if(is(T == char[])) { auto gt = cast(ubyte[])jt; auto gtc = cast(const(ubyte)[])jt; auto gti = cast(immutable(ubyte)[])jt; } else static if(is(T == wchar[])) { auto gt = cast(ushort[])jt; auto gtc = cast(const(ushort)[])jt; auto gti = cast(immutable(ushort)[])jt; } else static if(is(T == dchar[])) { auto gt = cast(uint[])jt; auto gtc = cast(const(uint)[])jt; auto gti = cast(immutable(uint)[])jt; } auto ht = assumeUTF(gt); auto htc = assumeUTF(gtc); auto hti = assumeUTF(gti); assert(equal(jt, ht)); assert(equal(jt, htc)); assert(equal(jt, hti)); } }
D
/Users/gbs/Xcode/MessView/DerivedData/MessView/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/Kingfisher.build/Objects-normal/x86_64/ImageProcessor.o : /Users/gbs/Xcode/MessView/Pods/Kingfisher/Sources/String+MD5.swift /Users/gbs/Xcode/MessView/Pods/Kingfisher/Sources/Resource.swift /Users/gbs/Xcode/MessView/Pods/Kingfisher/Sources/Image.swift /Users/gbs/Xcode/MessView/Pods/Kingfisher/Sources/ImageCache.swift /Users/gbs/Xcode/MessView/Pods/Kingfisher/Sources/ImageTransition.swift /Users/gbs/Xcode/MessView/Pods/Kingfisher/Sources/KingfisherOptionsInfo.swift /Users/gbs/Xcode/MessView/Pods/Kingfisher/Sources/ImageDownloader.swift /Users/gbs/Xcode/MessView/Pods/Kingfisher/Sources/Placeholder.swift /Users/gbs/Xcode/MessView/Pods/Kingfisher/Sources/KingfisherManager.swift /Users/gbs/Xcode/MessView/Pods/Kingfisher/Sources/ImagePrefetcher.swift /Users/gbs/Xcode/MessView/Pods/Kingfisher/Sources/UIButton+Kingfisher.swift /Users/gbs/Xcode/MessView/Pods/Kingfisher/Sources/ImageView+Kingfisher.swift /Users/gbs/Xcode/MessView/Pods/Kingfisher/Sources/Kingfisher.swift /Users/gbs/Xcode/MessView/Pods/Kingfisher/Sources/ImageModifier.swift /Users/gbs/Xcode/MessView/Pods/Kingfisher/Sources/RequestModifier.swift /Users/gbs/Xcode/MessView/Pods/Kingfisher/Sources/ThreadHelper.swift /Users/gbs/Xcode/MessView/Pods/Kingfisher/Sources/Filter.swift /Users/gbs/Xcode/MessView/Pods/Kingfisher/Sources/CacheSerializer.swift /Users/gbs/Xcode/MessView/Pods/Kingfisher/Sources/FormatIndicatedCacheSerializer.swift /Users/gbs/Xcode/MessView/Pods/Kingfisher/Sources/ImageProcessor.swift /Users/gbs/Xcode/MessView/Pods/Kingfisher/Sources/Indicator.swift /Users/gbs/Xcode/MessView/Pods/Kingfisher/Sources/AnimatedImageView.swift /Users/gbs/Xcode/MessView/Pods/Kingfisher/Sources/Box.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Dispatch.apinotesc /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/os.apinotesc /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/ObjectiveC.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreImage.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/QuartzCore.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Accelerate.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Dispatch.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Metal.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Darwin.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Foundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreFoundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreGraphics.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/os.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Swift.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/UIKit.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/SwiftOnoneSupport.swiftmodule /Users/gbs/Xcode/MessView/Pods/Target\ Support\ Files/Kingfisher/Kingfisher-umbrella.h /Users/gbs/Xcode/MessView/Pods/Kingfisher/Sources/Kingfisher.h /Users/gbs/Xcode/MessView/DerivedData/MessView/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/Kingfisher.build/unextended-module.modulemap /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/usr/include/objc/ObjectiveC.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/OpenGLES.framework/Headers/OpenGLES.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/CoreImage.framework/Headers/CoreImage.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/QuartzCore.framework/Headers/QuartzCore.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/Accelerate.framework/Headers/Accelerate.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/Metal.framework/Headers/Metal.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/usr/include/Darwin.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIKit.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/CoreText.framework/Headers/CoreText.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/Security.framework/Headers/Security.apinotes /Users/gbs/Xcode/MessView/DerivedData/MessView/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/Kingfisher.build/Objects-normal/x86_64/ImageProcessor~partial.swiftmodule : /Users/gbs/Xcode/MessView/Pods/Kingfisher/Sources/String+MD5.swift /Users/gbs/Xcode/MessView/Pods/Kingfisher/Sources/Resource.swift /Users/gbs/Xcode/MessView/Pods/Kingfisher/Sources/Image.swift /Users/gbs/Xcode/MessView/Pods/Kingfisher/Sources/ImageCache.swift /Users/gbs/Xcode/MessView/Pods/Kingfisher/Sources/ImageTransition.swift /Users/gbs/Xcode/MessView/Pods/Kingfisher/Sources/KingfisherOptionsInfo.swift /Users/gbs/Xcode/MessView/Pods/Kingfisher/Sources/ImageDownloader.swift /Users/gbs/Xcode/MessView/Pods/Kingfisher/Sources/Placeholder.swift /Users/gbs/Xcode/MessView/Pods/Kingfisher/Sources/KingfisherManager.swift /Users/gbs/Xcode/MessView/Pods/Kingfisher/Sources/ImagePrefetcher.swift /Users/gbs/Xcode/MessView/Pods/Kingfisher/Sources/UIButton+Kingfisher.swift /Users/gbs/Xcode/MessView/Pods/Kingfisher/Sources/ImageView+Kingfisher.swift /Users/gbs/Xcode/MessView/Pods/Kingfisher/Sources/Kingfisher.swift /Users/gbs/Xcode/MessView/Pods/Kingfisher/Sources/ImageModifier.swift /Users/gbs/Xcode/MessView/Pods/Kingfisher/Sources/RequestModifier.swift /Users/gbs/Xcode/MessView/Pods/Kingfisher/Sources/ThreadHelper.swift /Users/gbs/Xcode/MessView/Pods/Kingfisher/Sources/Filter.swift /Users/gbs/Xcode/MessView/Pods/Kingfisher/Sources/CacheSerializer.swift /Users/gbs/Xcode/MessView/Pods/Kingfisher/Sources/FormatIndicatedCacheSerializer.swift /Users/gbs/Xcode/MessView/Pods/Kingfisher/Sources/ImageProcessor.swift /Users/gbs/Xcode/MessView/Pods/Kingfisher/Sources/Indicator.swift /Users/gbs/Xcode/MessView/Pods/Kingfisher/Sources/AnimatedImageView.swift /Users/gbs/Xcode/MessView/Pods/Kingfisher/Sources/Box.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Dispatch.apinotesc /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/os.apinotesc /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/ObjectiveC.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreImage.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/QuartzCore.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Accelerate.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Dispatch.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Metal.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Darwin.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Foundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreFoundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreGraphics.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/os.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Swift.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/UIKit.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/SwiftOnoneSupport.swiftmodule /Users/gbs/Xcode/MessView/Pods/Target\ Support\ Files/Kingfisher/Kingfisher-umbrella.h /Users/gbs/Xcode/MessView/Pods/Kingfisher/Sources/Kingfisher.h /Users/gbs/Xcode/MessView/DerivedData/MessView/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/Kingfisher.build/unextended-module.modulemap /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/usr/include/objc/ObjectiveC.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/OpenGLES.framework/Headers/OpenGLES.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/CoreImage.framework/Headers/CoreImage.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/QuartzCore.framework/Headers/QuartzCore.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/Accelerate.framework/Headers/Accelerate.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/Metal.framework/Headers/Metal.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/usr/include/Darwin.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIKit.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/CoreText.framework/Headers/CoreText.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/Security.framework/Headers/Security.apinotes /Users/gbs/Xcode/MessView/DerivedData/MessView/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/Kingfisher.build/Objects-normal/x86_64/ImageProcessor~partial.swiftdoc : /Users/gbs/Xcode/MessView/Pods/Kingfisher/Sources/String+MD5.swift /Users/gbs/Xcode/MessView/Pods/Kingfisher/Sources/Resource.swift /Users/gbs/Xcode/MessView/Pods/Kingfisher/Sources/Image.swift /Users/gbs/Xcode/MessView/Pods/Kingfisher/Sources/ImageCache.swift /Users/gbs/Xcode/MessView/Pods/Kingfisher/Sources/ImageTransition.swift /Users/gbs/Xcode/MessView/Pods/Kingfisher/Sources/KingfisherOptionsInfo.swift /Users/gbs/Xcode/MessView/Pods/Kingfisher/Sources/ImageDownloader.swift /Users/gbs/Xcode/MessView/Pods/Kingfisher/Sources/Placeholder.swift /Users/gbs/Xcode/MessView/Pods/Kingfisher/Sources/KingfisherManager.swift /Users/gbs/Xcode/MessView/Pods/Kingfisher/Sources/ImagePrefetcher.swift /Users/gbs/Xcode/MessView/Pods/Kingfisher/Sources/UIButton+Kingfisher.swift /Users/gbs/Xcode/MessView/Pods/Kingfisher/Sources/ImageView+Kingfisher.swift /Users/gbs/Xcode/MessView/Pods/Kingfisher/Sources/Kingfisher.swift /Users/gbs/Xcode/MessView/Pods/Kingfisher/Sources/ImageModifier.swift /Users/gbs/Xcode/MessView/Pods/Kingfisher/Sources/RequestModifier.swift /Users/gbs/Xcode/MessView/Pods/Kingfisher/Sources/ThreadHelper.swift /Users/gbs/Xcode/MessView/Pods/Kingfisher/Sources/Filter.swift /Users/gbs/Xcode/MessView/Pods/Kingfisher/Sources/CacheSerializer.swift /Users/gbs/Xcode/MessView/Pods/Kingfisher/Sources/FormatIndicatedCacheSerializer.swift /Users/gbs/Xcode/MessView/Pods/Kingfisher/Sources/ImageProcessor.swift /Users/gbs/Xcode/MessView/Pods/Kingfisher/Sources/Indicator.swift /Users/gbs/Xcode/MessView/Pods/Kingfisher/Sources/AnimatedImageView.swift /Users/gbs/Xcode/MessView/Pods/Kingfisher/Sources/Box.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Dispatch.apinotesc /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/os.apinotesc /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/ObjectiveC.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreImage.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/QuartzCore.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Accelerate.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Dispatch.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Metal.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Darwin.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Foundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreFoundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreGraphics.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/os.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Swift.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/UIKit.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/SwiftOnoneSupport.swiftmodule /Users/gbs/Xcode/MessView/Pods/Target\ Support\ Files/Kingfisher/Kingfisher-umbrella.h /Users/gbs/Xcode/MessView/Pods/Kingfisher/Sources/Kingfisher.h /Users/gbs/Xcode/MessView/DerivedData/MessView/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/Kingfisher.build/unextended-module.modulemap /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/usr/include/objc/ObjectiveC.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/OpenGLES.framework/Headers/OpenGLES.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/CoreImage.framework/Headers/CoreImage.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/QuartzCore.framework/Headers/QuartzCore.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/Accelerate.framework/Headers/Accelerate.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/Metal.framework/Headers/Metal.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/usr/include/Darwin.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIKit.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/CoreText.framework/Headers/CoreText.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/Security.framework/Headers/Security.apinotes
D
module xf.mem.Gather; private { import xf.mem.ScratchAllocator; import tango.core.Tuple; } private template TupleOfArrays(T ...) { static assert (T.length >= 1); static if (1 == T.length) { alias Tuple!(T[0][]) TupleOfArrays; } else { alias Tuple!(T[0][], TupleOfArrays!(T[1..$])) TupleOfArrays; } } private template LazyDg(T ...) { static if (1 == T.length) { alias void delegate(lazy T[0]) LazyDg; } else static if (2 == T.length) { alias void delegate(lazy T[0], lazy T[1]) LazyDg; } else static assert (false, "Add more."); } /** Sample usage: gatherArrays!(string, Value)(sc.mem, (void delegate(lazy string, lazy Value) gen) { foreach (stmt_; sc.statements) { if (auto stmt = cast(AssignStatement)stmt_) { gen(stmt.name, stmt.value); } } }, (string[] names, Value[] values) { sc.doAssign(names, values); }); */ template gatherArrays(T...) { bool gatherArrays( DgScratchAllocator alloc, void delegate(LazyDg!(T)) gen, void delegate(TupleOfArrays!(T)) sink ) { size_t num = 0; gen((lazy T) { ++num; }); if (num != 0) { TupleOfArrays!(T) res; foreach (ri, _poop; res) { res[ri] = alloc.allocArrayNoInit!(T[ri])(num); } size_t i = 0; gen((lazy T t) { foreach (xi, x; t) { res[xi][i] = x; } ++i; }); assert (num == i); sink(res); return true; } else { return false; } } }
D
.build_1i1o2_lin33_48k_usbctl_farenddsp/_m_usb_audio/reboot.xc.d .build_1i1o2_lin33_48k_usbctl_farenddsp/_m_usb_audio/reboot.xc.o .build_1i1o2_lin33_48k_usbctl_farenddsp/_m_usb_audio/reboot.xc.pca.xml: C:/Users/user/workspace/module_usb_audio/reboot.xc
D
/** * Compiler implementation of the * $(LINK2 http://www.dlang.org, D programming language). * * Copyright: Copyright (c) 1999-2017 by Digital Mars, All Rights Reserved * Authors: $(LINK2 http://www.digitalmars.com, Walter Bright) * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0) * Source: $(DMDSRC _hdrgen.d) */ module ddmd.hdrgen; import core.stdc.ctype; import core.stdc.stdio; import core.stdc.string; import ddmd.aggregate; import ddmd.aliasthis; import ddmd.arraytypes; import ddmd.attrib; import ddmd.complex; import ddmd.cond; import ddmd.ctfeexpr; import ddmd.dclass; import ddmd.declaration; import ddmd.denum; import ddmd.dimport; import ddmd.dmodule; import ddmd.doc; import ddmd.dstruct; import ddmd.dsymbol; import ddmd.dtemplate; import ddmd.dversion; import ddmd.expression; import ddmd.func; import ddmd.globals; import ddmd.id; import ddmd.identifier; import ddmd.init; import ddmd.mtype; import ddmd.nspace; import ddmd.parse; import ddmd.root.ctfloat; import ddmd.root.outbuffer; import ddmd.root.rootobject; import ddmd.statement; import ddmd.staticassert; import ddmd.target; import ddmd.tokens; import ddmd.utils; import ddmd.visitor; struct HdrGenState { bool hdrgen; /// true if generating header file bool ddoc; /// true if generating Ddoc file bool fullDump; /// true if generating a full AST dump file bool fullQual; /// fully qualify types when printing int tpltMember; int autoMember; int forStmtInit; } enum TEST_EMIT_ALL = 0; extern (C++) void genhdrfile(Module m) { OutBuffer buf; buf.doindent = 1; buf.printf("// D import file generated from '%s'", m.srcfile.toChars()); buf.writenl(); HdrGenState hgs; hgs.hdrgen = true; toCBuffer(m, &buf, &hgs); // Transfer image to file m.hdrfile.setbuffer(buf.data, buf.offset); buf.extractData(); ensurePathToNameExists(Loc(), m.hdrfile.toChars()); writeFile(m.loc, m.hdrfile); } extern (C++) final class PrettyPrintVisitor : Visitor { alias visit = super.visit; public: OutBuffer* buf; HdrGenState* hgs; bool declstring; // set while declaring alias for string,wstring or dstring EnumDeclaration inEnumDecl; extern (D) this(OutBuffer* buf, HdrGenState* hgs) { this.buf = buf; this.hgs = hgs; } override void visit(Statement s) { buf.printf("Statement::toCBuffer()"); buf.writenl(); assert(0); } override void visit(ErrorStatement s) { buf.printf("__error__"); buf.writenl(); } override void visit(ExpStatement s) { if (s.exp && s.exp.op == TOKdeclaration) { // bypass visit(DeclarationExp) (cast(DeclarationExp)s.exp).declaration.accept(this); return; } if (s.exp) s.exp.accept(this); buf.writeByte(';'); if (!hgs.forStmtInit) buf.writenl(); } override void visit(CompileStatement s) { buf.writestring("mixin("); s.exp.accept(this); buf.writestring(");"); if (!hgs.forStmtInit) buf.writenl(); } override void visit(CompoundStatement s) { foreach (sx; *s.statements) { if (sx) sx.accept(this); } } override void visit(CompoundDeclarationStatement s) { bool anywritten = false; foreach (sx; *s.statements) { auto ds = sx ? sx.isExpStatement() : null; if (ds && ds.exp.op == TOKdeclaration) { auto d = (cast(DeclarationExp)ds.exp).declaration; assert(d.isDeclaration()); if (auto v = d.isVarDeclaration()) visitVarDecl(v, anywritten); else d.accept(this); anywritten = true; } } buf.writeByte(';'); if (!hgs.forStmtInit) buf.writenl(); } override void visit(UnrolledLoopStatement s) { buf.writestring("unrolled {"); buf.writenl(); buf.level++; foreach (sx; *s.statements) { if (sx) sx.accept(this); } buf.level--; buf.writeByte('}'); buf.writenl(); } override void visit(ScopeStatement s) { buf.writeByte('{'); buf.writenl(); buf.level++; if (s.statement) s.statement.accept(this); buf.level--; buf.writeByte('}'); buf.writenl(); } override void visit(WhileStatement s) { buf.writestring("while ("); s.condition.accept(this); buf.writeByte(')'); buf.writenl(); if (s._body) s._body.accept(this); } override void visit(DoStatement s) { buf.writestring("do"); buf.writenl(); if (s._body) s._body.accept(this); buf.writestring("while ("); s.condition.accept(this); buf.writestring(");"); buf.writenl(); } override void visit(ForStatement s) { buf.writestring("for ("); if (s._init) { hgs.forStmtInit++; s._init.accept(this); hgs.forStmtInit--; } else buf.writeByte(';'); if (s.condition) { buf.writeByte(' '); s.condition.accept(this); } buf.writeByte(';'); if (s.increment) { buf.writeByte(' '); s.increment.accept(this); } buf.writeByte(')'); buf.writenl(); buf.writeByte('{'); buf.writenl(); buf.level++; if (s._body) s._body.accept(this); buf.level--; buf.writeByte('}'); buf.writenl(); } override void visit(ForeachStatement s) { buf.writestring(Token.toString(s.op)); buf.writestring(" ("); foreach (i, p; *s.parameters) { if (i) buf.writestring(", "); if (stcToBuffer(buf, p.storageClass)) buf.writeByte(' '); if (p.type) typeToBuffer(p.type, p.ident); else buf.writestring(p.ident.toChars()); } buf.writestring("; "); s.aggr.accept(this); buf.writeByte(')'); buf.writenl(); buf.writeByte('{'); buf.writenl(); buf.level++; if (s._body) s._body.accept(this); buf.level--; buf.writeByte('}'); buf.writenl(); } override void visit(ForeachRangeStatement s) { buf.writestring(Token.toString(s.op)); buf.writestring(" ("); if (s.prm.type) typeToBuffer(s.prm.type, s.prm.ident); else buf.writestring(s.prm.ident.toChars()); buf.writestring("; "); s.lwr.accept(this); buf.writestring(" .. "); s.upr.accept(this); buf.writeByte(')'); buf.writenl(); buf.writeByte('{'); buf.writenl(); buf.level++; if (s._body) s._body.accept(this); buf.level--; buf.writeByte('}'); buf.writenl(); } override void visit(IfStatement s) { buf.writestring("if ("); if (Parameter p = s.prm) { StorageClass stc = p.storageClass; if (!p.type && !stc) stc = STCauto; if (stcToBuffer(buf, stc)) buf.writeByte(' '); if (p.type) typeToBuffer(p.type, p.ident); else buf.writestring(p.ident.toChars()); buf.writestring(" = "); } s.condition.accept(this); buf.writeByte(')'); buf.writenl(); if (!s.ifbody.isScopeStatement()) buf.level++; s.ifbody.accept(this); if (!s.ifbody.isScopeStatement()) buf.level--; if (s.elsebody) { buf.writestring("else"); if (!s.elsebody.isIfStatement) { buf.writenl(); } else { buf.writeByte(' '); } if (!s.elsebody.isScopeStatement() && !s.elsebody.isIfStatement) buf.level++; s.elsebody.accept(this); if (!s.elsebody.isScopeStatement() && !s.elsebody.isIfStatement) buf.level--; } } override void visit(ConditionalStatement s) { s.condition.accept(this); buf.writenl(); buf.writeByte('{'); buf.writenl(); buf.level++; if (s.ifbody) s.ifbody.accept(this); buf.level--; buf.writeByte('}'); buf.writenl(); if (s.elsebody) { buf.writestring("else"); buf.writenl(); buf.writeByte('{'); buf.level++; buf.writenl(); s.elsebody.accept(this); buf.level--; buf.writeByte('}'); } buf.writenl(); } override void visit(PragmaStatement s) { buf.writestring("pragma ("); buf.writestring(s.ident.toChars()); if (s.args && s.args.dim) { buf.writestring(", "); argsToBuffer(s.args); } buf.writeByte(')'); if (s._body) { buf.writenl(); buf.writeByte('{'); buf.writenl(); buf.level++; s._body.accept(this); buf.level--; buf.writeByte('}'); buf.writenl(); } else { buf.writeByte(';'); buf.writenl(); } } override void visit(StaticAssertStatement s) { s.sa.accept(this); } override void visit(SwitchStatement s) { buf.writestring(s.isFinal ? "final switch (" : "switch ("); s.condition.accept(this); buf.writeByte(')'); buf.writenl(); if (s._body) { if (!s._body.isScopeStatement()) { buf.writeByte('{'); buf.writenl(); buf.level++; s._body.accept(this); buf.level--; buf.writeByte('}'); buf.writenl(); } else { s._body.accept(this); } } } override void visit(CaseStatement s) { buf.writestring("case "); s.exp.accept(this); buf.writeByte(':'); buf.writenl(); s.statement.accept(this); } override void visit(CaseRangeStatement s) { buf.writestring("case "); s.first.accept(this); buf.writestring(": .. case "); s.last.accept(this); buf.writeByte(':'); buf.writenl(); s.statement.accept(this); } override void visit(DefaultStatement s) { buf.writestring("default:"); buf.writenl(); s.statement.accept(this); } override void visit(GotoDefaultStatement s) { buf.writestring("goto default;"); buf.writenl(); } override void visit(GotoCaseStatement s) { buf.writestring("goto case"); if (s.exp) { buf.writeByte(' '); s.exp.accept(this); } buf.writeByte(';'); buf.writenl(); } override void visit(SwitchErrorStatement s) { buf.writestring("SwitchErrorStatement::toCBuffer()"); buf.writenl(); } override void visit(ReturnStatement s) { buf.printf("return "); if (s.exp) s.exp.accept(this); buf.writeByte(';'); buf.writenl(); } override void visit(BreakStatement s) { buf.writestring("break"); if (s.ident) { buf.writeByte(' '); buf.writestring(s.ident.toChars()); } buf.writeByte(';'); buf.writenl(); } override void visit(ContinueStatement s) { buf.writestring("continue"); if (s.ident) { buf.writeByte(' '); buf.writestring(s.ident.toChars()); } buf.writeByte(';'); buf.writenl(); } override void visit(SynchronizedStatement s) { buf.writestring("synchronized"); if (s.exp) { buf.writeByte('('); s.exp.accept(this); buf.writeByte(')'); } if (s._body) { buf.writeByte(' '); s._body.accept(this); } } override void visit(WithStatement s) { buf.writestring("with ("); s.exp.accept(this); buf.writestring(")"); buf.writenl(); if (s._body) s._body.accept(this); } override void visit(TryCatchStatement s) { buf.writestring("try"); buf.writenl(); if (s._body) s._body.accept(this); foreach (c; *s.catches) { visit(c); } } override void visit(TryFinallyStatement s) { buf.writestring("try"); buf.writenl(); buf.writeByte('{'); buf.writenl(); buf.level++; s._body.accept(this); buf.level--; buf.writeByte('}'); buf.writenl(); buf.writestring("finally"); buf.writenl(); buf.writeByte('{'); buf.writenl(); buf.level++; s.finalbody.accept(this); buf.level--; buf.writeByte('}'); buf.writenl(); } override void visit(OnScopeStatement s) { buf.writestring(Token.toString(s.tok)); buf.writeByte(' '); s.statement.accept(this); } override void visit(ThrowStatement s) { buf.printf("throw "); s.exp.accept(this); buf.writeByte(';'); buf.writenl(); } override void visit(DebugStatement s) { if (s.statement) { s.statement.accept(this); } } override void visit(GotoStatement s) { buf.writestring("goto "); buf.writestring(s.ident.toChars()); buf.writeByte(';'); buf.writenl(); } override void visit(LabelStatement s) { buf.writestring(s.ident.toChars()); buf.writeByte(':'); buf.writenl(); if (s.statement) s.statement.accept(this); } override void visit(AsmStatement s) { buf.writestring("asm { "); Token* t = s.tokens; buf.level++; while (t) { buf.writestring(t.toChars()); if (t.next && t.value != TOKmin && t.value != TOKcomma && t.next.value != TOKcomma && t.value != TOKlbracket && t.next.value != TOKlbracket && t.next.value != TOKrbracket && t.value != TOKlparen && t.next.value != TOKlparen && t.next.value != TOKrparen && t.value != TOKdot && t.next.value != TOKdot) { buf.writeByte(' '); } t = t.next; } buf.level--; buf.writestring("; }"); buf.writenl(); } override void visit(ImportStatement s) { foreach (imp; *s.imports) { imp.accept(this); } } void visit(Catch c) { buf.writestring("catch"); if (c.type) { buf.writeByte('('); typeToBuffer(c.type, c.ident); buf.writeByte(')'); } buf.writenl(); buf.writeByte('{'); buf.writenl(); buf.level++; if (c.handler) c.handler.accept(this); buf.level--; buf.writeByte('}'); buf.writenl(); } //////////////////////////////////////////////////////////////////////////// /************************************************** * An entry point to pretty-print type. */ void typeToBuffer(Type t, Identifier ident) { if (t.ty == Tfunction) { visitFuncIdentWithPrefix(cast(TypeFunction)t, ident, null, true); return; } visitWithMask(t, 0); if (ident) { buf.writeByte(' '); buf.writestring(ident.toChars()); } } void visitWithMask(Type t, ubyte modMask) { // Tuples and functions don't use the type constructor syntax if (modMask == t.mod || t.ty == Tfunction || t.ty == Ttuple) { t.accept(this); } else { ubyte m = t.mod & ~(t.mod & modMask); if (m & MODshared) { MODtoBuffer(buf, MODshared); buf.writeByte('('); } if (m & MODwild) { MODtoBuffer(buf, MODwild); buf.writeByte('('); } if (m & (MODconst | MODimmutable)) { MODtoBuffer(buf, m & (MODconst | MODimmutable)); buf.writeByte('('); } t.accept(this); if (m & (MODconst | MODimmutable)) buf.writeByte(')'); if (m & MODwild) buf.writeByte(')'); if (m & MODshared) buf.writeByte(')'); } } override void visit(Type t) { printf("t = %p, ty = %d\n", t, t.ty); assert(0); } override void visit(TypeError t) { buf.writestring("_error_"); } override void visit(TypeBasic t) { //printf("TypeBasic::toCBuffer2(t.mod = %d)\n", t.mod); buf.writestring(t.dstring); } override void visit(TypeVector t) { //printf("TypeVector::toCBuffer2(t.mod = %d)\n", t.mod); buf.writestring("__vector("); visitWithMask(t.basetype, t.mod); buf.writestring(")"); } override void visit(TypeSArray t) { visitWithMask(t.next, t.mod); buf.writeByte('['); sizeToBuffer(t.dim); buf.writeByte(']'); } override void visit(TypeDArray t) { Type ut = t.castMod(0); if (declstring) goto L1; if (ut.equals(Type.tstring)) buf.writestring("string"); else if (ut.equals(Type.twstring)) buf.writestring("wstring"); else if (ut.equals(Type.tdstring)) buf.writestring("dstring"); else { L1: visitWithMask(t.next, t.mod); buf.writestring("[]"); } } override void visit(TypeAArray t) { visitWithMask(t.next, t.mod); buf.writeByte('['); visitWithMask(t.index, 0); buf.writeByte(']'); } override void visit(TypePointer t) { //printf("TypePointer::toCBuffer2() next = %d\n", t.next.ty); if (t.next.ty == Tfunction) visitFuncIdentWithPostfix(cast(TypeFunction)t.next, "function"); else { visitWithMask(t.next, t.mod); buf.writeByte('*'); } } override void visit(TypeReference t) { visitWithMask(t.next, t.mod); buf.writeByte('&'); } override void visit(TypeFunction t) { //printf("TypeFunction::toCBuffer2() t = %p, ref = %d\n", t, t.isref); visitFuncIdentWithPostfix(t, null); } // callback for TypeFunction::attributesApply struct PrePostAppendStrings { OutBuffer* buf; bool isPostfixStyle; bool isCtor; extern (C++) static int fp(void* param, const(char)* str) { PrePostAppendStrings* p = cast(PrePostAppendStrings*)param; // don't write 'ref' for ctors if (p.isCtor && strcmp(str, "ref") == 0) return 0; if (p.isPostfixStyle) p.buf.writeByte(' '); p.buf.writestring(str); if (!p.isPostfixStyle) p.buf.writeByte(' '); return 0; } } void visitFuncIdentWithPostfix(TypeFunction t, const(char)* ident) { if (t.inuse) { t.inuse = 2; // flag error to caller return; } t.inuse++; PrePostAppendStrings pas; pas.buf = buf; pas.isCtor = false; pas.isPostfixStyle = true; if (t.linkage > LINKd && hgs.ddoc != 1 && !hgs.hdrgen) { linkageToBuffer(buf, t.linkage); buf.writeByte(' '); } if (t.next) { typeToBuffer(t.next, null); if (ident) buf.writeByte(' '); } else if (hgs.ddoc) buf.writestring("auto "); if (ident) buf.writestring(ident); parametersToBuffer(t.parameters, t.varargs); /* Use postfix style for attributes */ if (t.mod) { buf.writeByte(' '); MODtoBuffer(buf, t.mod); } t.attributesApply(&pas, &PrePostAppendStrings.fp); t.inuse--; } void visitFuncIdentWithPrefix(TypeFunction t, Identifier ident, TemplateDeclaration td, bool isPostfixStyle) { if (t.inuse) { t.inuse = 2; // flag error to caller return; } t.inuse++; PrePostAppendStrings pas; pas.buf = buf; pas.isCtor = (ident == Id.ctor); pas.isPostfixStyle = false; /* Use 'storage class' (prefix) style for attributes */ if (t.mod) { MODtoBuffer(buf, t.mod); buf.writeByte(' '); } t.attributesApply(&pas, &PrePostAppendStrings.fp); if (t.linkage > LINKd && hgs.ddoc != 1 && !hgs.hdrgen) { linkageToBuffer(buf, t.linkage); buf.writeByte(' '); } if (ident && ident.toHChars2() != ident.toChars()) { // Don't print return type for ctor, dtor, unittest, etc } else if (t.next) { typeToBuffer(t.next, null); if (ident) buf.writeByte(' '); } else if (hgs.ddoc) buf.writestring("auto "); if (ident) buf.writestring(ident.toHChars2()); if (td) { buf.writeByte('('); foreach (i, p; *td.origParameters) { if (i) buf.writestring(", "); p.accept(this); } buf.writeByte(')'); } parametersToBuffer(t.parameters, t.varargs); t.inuse--; } override void visit(TypeDelegate t) { visitFuncIdentWithPostfix(cast(TypeFunction)t.next, "delegate"); } void visitTypeQualifiedHelper(TypeQualified t) { foreach (id; t.idents) { if (id.dyncast() == DYNCAST.dsymbol) { buf.writeByte('.'); TemplateInstance ti = cast(TemplateInstance)id; ti.accept(this); } else if (id.dyncast() == DYNCAST.expression) { buf.writeByte('['); (cast(Expression)id).accept(this); buf.writeByte(']'); } else if (id.dyncast() == DYNCAST.type) { buf.writeByte('['); (cast(Type)id).accept(this); buf.writeByte(']'); } else { buf.writeByte('.'); buf.writestring(id.toChars()); } } } override void visit(TypeIdentifier t) { buf.writestring(t.ident.toChars()); visitTypeQualifiedHelper(t); } override void visit(TypeInstance t) { t.tempinst.accept(this); visitTypeQualifiedHelper(t); } override void visit(TypeTypeof t) { buf.writestring("typeof("); t.exp.accept(this); buf.writeByte(')'); visitTypeQualifiedHelper(t); } override void visit(TypeReturn t) { buf.writestring("typeof(return)"); visitTypeQualifiedHelper(t); } override void visit(TypeEnum t) { buf.writestring(t.sym.toChars()); } override void visit(TypeStruct t) { // Bugzilla 13776: Don't use ti.toAlias() to avoid forward reference error // while printing messages. TemplateInstance ti = t.sym.parent ? t.sym.parent.isTemplateInstance() : null; if (ti && ti.aliasdecl == t.sym) buf.writestring(hgs.fullQual ? ti.toPrettyChars() : ti.toChars()); else buf.writestring(hgs.fullQual ? t.sym.toPrettyChars() : t.sym.toChars()); } override void visit(TypeClass t) { // Bugzilla 13776: Don't use ti.toAlias() to avoid forward reference error // while printing messages. TemplateInstance ti = t.sym.parent.isTemplateInstance(); if (ti && ti.aliasdecl == t.sym) buf.writestring(hgs.fullQual ? ti.toPrettyChars() : ti.toChars()); else buf.writestring(hgs.fullQual ? t.sym.toPrettyChars() : t.sym.toChars()); } override void visit(TypeTuple t) { parametersToBuffer(t.arguments, 0); } override void visit(TypeSlice t) { visitWithMask(t.next, t.mod); buf.writeByte('['); sizeToBuffer(t.lwr); buf.writestring(" .. "); sizeToBuffer(t.upr); buf.writeByte(']'); } override void visit(TypeNull t) { buf.writestring("typeof(null)"); } //////////////////////////////////////////////////////////////////////////// override void visit(Dsymbol s) { buf.writestring(s.toChars()); } override void visit(StaticAssert s) { buf.writestring(s.kind()); buf.writeByte('('); s.exp.accept(this); if (s.msg) { buf.writestring(", "); s.msg.accept(this); } buf.writestring(");"); buf.writenl(); } override void visit(DebugSymbol s) { buf.writestring("debug = "); if (s.ident) buf.writestring(s.ident.toChars()); else buf.printf("%u", s.level); buf.writestring(";"); buf.writenl(); } override void visit(VersionSymbol s) { buf.writestring("version = "); if (s.ident) buf.writestring(s.ident.toChars()); else buf.printf("%u", s.level); buf.writestring(";"); buf.writenl(); } override void visit(EnumMember em) { if (em.type) typeToBuffer(em.type, em.ident); else buf.writestring(em.ident.toChars()); if (em.value) { buf.writestring(" = "); em.value.accept(this); } } override void visit(Import imp) { if (hgs.hdrgen && imp.id == Id.object) return; // object is imported by default if (imp.isstatic) buf.writestring("static "); buf.writestring("import "); if (imp.aliasId) { buf.printf("%s = ", imp.aliasId.toChars()); } if (imp.packages && imp.packages.dim) { foreach (const pid; *imp.packages) { buf.printf("%s.", pid.toChars()); } } buf.printf("%s", imp.id.toChars()); if (imp.names.dim) { buf.writestring(" : "); foreach (const i, const name; imp.names) { if (i) buf.writestring(", "); const _alias = imp.aliases[i]; if (_alias) buf.printf("%s = %s", _alias.toChars(), name.toChars()); else buf.printf("%s", name.toChars()); } } buf.printf(";"); buf.writenl(); } override void visit(AliasThis d) { buf.writestring("alias "); buf.writestring(d.ident.toChars()); buf.writestring(" this;\n"); } override void visit(AttribDeclaration d) { if (!d.decl) { buf.writeByte(';'); buf.writenl(); return; } if (d.decl.dim == 0) buf.writestring("{}"); else if (hgs.hdrgen && d.decl.dim == 1 && (*d.decl)[0].isUnitTestDeclaration()) { // hack for bugzilla 8081 buf.writestring("{}"); } else if (d.decl.dim == 1) { (*d.decl)[0].accept(this); return; } else { buf.writenl(); buf.writeByte('{'); buf.writenl(); buf.level++; foreach (de; *d.decl) de.accept(this); buf.level--; buf.writeByte('}'); } buf.writenl(); } override void visit(StorageClassDeclaration d) { if (stcToBuffer(buf, d.stc)) buf.writeByte(' '); visit(cast(AttribDeclaration)d); } override void visit(DeprecatedDeclaration d) { buf.writestring("deprecated("); d.msg.accept(this); buf.writestring(") "); visit(cast(AttribDeclaration)d); } override void visit(LinkDeclaration d) { const(char)* p; switch (d.linkage) { case LINKd: p = "D"; break; case LINKc: p = "C"; break; case LINKcpp: p = "C++"; break; case LINKwindows: p = "Windows"; break; case LINKpascal: p = "Pascal"; break; case LINKobjc: p = "Objective-C"; break; default: assert(0); } buf.writestring("extern ("); buf.writestring(p); buf.writestring(") "); visit(cast(AttribDeclaration)d); } override void visit(CPPMangleDeclaration d) { const(char)* p; switch (d.cppmangle) { case CPPMANGLE.asClass: p = "class"; break; case CPPMANGLE.asStruct: p = "struct"; break; default: assert(0); } buf.writestring("extern (C++, "); buf.writestring(p); buf.writestring(") "); visit(cast(AttribDeclaration)d); } override void visit(ProtDeclaration d) { protectionToBuffer(buf, d.protection); buf.writeByte(' '); visit(cast(AttribDeclaration)d); } override void visit(AlignDeclaration d) { if (!d.ealign) buf.printf("align "); else buf.printf("align (%s) ", d.ealign.toChars()); visit(cast(AttribDeclaration)d); } override void visit(AnonDeclaration d) { buf.printf(d.isunion ? "union" : "struct"); buf.writenl(); buf.writestring("{"); buf.writenl(); buf.level++; if (d.decl) { foreach (de; *d.decl) de.accept(this); } buf.level--; buf.writestring("}"); buf.writenl(); } override void visit(PragmaDeclaration d) { buf.printf("pragma (%s", d.ident.toChars()); if (d.args && d.args.dim) { buf.writestring(", "); argsToBuffer(d.args); } buf.writeByte(')'); visit(cast(AttribDeclaration)d); } override void visit(ConditionalDeclaration d) { d.condition.accept(this); if (d.decl || d.elsedecl) { buf.writenl(); buf.writeByte('{'); buf.writenl(); buf.level++; if (d.decl) { foreach (de; *d.decl) de.accept(this); } buf.level--; buf.writeByte('}'); if (d.elsedecl) { buf.writenl(); buf.writestring("else"); buf.writenl(); buf.writeByte('{'); buf.writenl(); buf.level++; foreach (de; *d.elsedecl) de.accept(this); buf.level--; buf.writeByte('}'); } } else buf.writeByte(':'); buf.writenl(); } override void visit(CompileDeclaration d) { buf.writestring("mixin("); d.exp.accept(this); buf.writestring(");"); buf.writenl(); } override void visit(UserAttributeDeclaration d) { buf.writestring("@("); argsToBuffer(d.atts); buf.writeByte(')'); visit(cast(AttribDeclaration)d); } override void visit(TemplateDeclaration d) { version (none) { // Should handle template functions for doc generation if (onemember && onemember.isFuncDeclaration()) buf.writestring("foo "); } if ((hgs.hdrgen || hgs.fullDump) && visitEponymousMember(d)) return; if (hgs.ddoc) buf.writestring(d.kind()); else buf.writestring("template"); buf.writeByte(' '); buf.writestring(d.ident.toChars()); buf.writeByte('('); visitTemplateParameters(hgs.ddoc ? d.origParameters : d.parameters); buf.writeByte(')'); visitTemplateConstraint(d.constraint); if (hgs.hdrgen || hgs.fullDump) { hgs.tpltMember++; buf.writenl(); buf.writeByte('{'); buf.writenl(); buf.level++; foreach (s; *d.members) s.accept(this); buf.level--; buf.writeByte('}'); buf.writenl(); hgs.tpltMember--; } } bool visitEponymousMember(TemplateDeclaration d) { if (!d.members || d.members.dim != 1) return false; Dsymbol onemember = (*d.members)[0]; if (onemember.ident != d.ident) return false; if (FuncDeclaration fd = onemember.isFuncDeclaration()) { assert(fd.type); if (stcToBuffer(buf, fd.storage_class)) buf.writeByte(' '); functionToBufferFull(cast(TypeFunction)fd.type, buf, d.ident, hgs, d); visitTemplateConstraint(d.constraint); hgs.tpltMember++; bodyToBuffer(fd); hgs.tpltMember--; return true; } if (AggregateDeclaration ad = onemember.isAggregateDeclaration()) { buf.writestring(ad.kind()); buf.writeByte(' '); buf.writestring(ad.ident.toChars()); buf.writeByte('('); visitTemplateParameters(hgs.ddoc ? d.origParameters : d.parameters); buf.writeByte(')'); visitTemplateConstraint(d.constraint); visitBaseClasses(ad.isClassDeclaration()); hgs.tpltMember++; if (ad.members) { buf.writenl(); buf.writeByte('{'); buf.writenl(); buf.level++; foreach (s; *ad.members) s.accept(this); buf.level--; buf.writeByte('}'); } else buf.writeByte(';'); buf.writenl(); hgs.tpltMember--; return true; } if (VarDeclaration vd = onemember.isVarDeclaration()) { if (d.constraint) return false; if (stcToBuffer(buf, vd.storage_class)) buf.writeByte(' '); if (vd.type) typeToBuffer(vd.type, vd.ident); else buf.writestring(vd.ident.toChars()); buf.writeByte('('); visitTemplateParameters(hgs.ddoc ? d.origParameters : d.parameters); buf.writeByte(')'); if (vd._init) { buf.writestring(" = "); ExpInitializer ie = vd._init.isExpInitializer(); if (ie && (ie.exp.op == TOKconstruct || ie.exp.op == TOKblit)) (cast(AssignExp)ie.exp).e2.accept(this); else vd._init.accept(this); } buf.writeByte(';'); buf.writenl(); return true; } return false; } void visitTemplateParameters(TemplateParameters* parameters) { if (!parameters || !parameters.dim) return; foreach (i, p; *parameters) { if (i) buf.writestring(", "); p.accept(this); } } void visitTemplateConstraint(Expression constraint) { if (!constraint) return; buf.writestring(" if ("); constraint.accept(this); buf.writeByte(')'); } override void visit(TemplateInstance ti) { buf.writestring(ti.name.toChars()); tiargsToBuffer(ti); if (hgs.fullDump) { buf.writenl(); if (ti.aliasdecl) { // the ti.aliasDecl is the instantiated body // if we have it, print it. ti.aliasdecl.accept(this); } } } override void visit(TemplateMixin tm) { buf.writestring("mixin "); typeToBuffer(tm.tqual, null); tiargsToBuffer(tm); if (tm.ident && memcmp(tm.ident.toChars(), cast(const(char)*)"__mixin", 7) != 0) { buf.writeByte(' '); buf.writestring(tm.ident.toChars()); } buf.writeByte(';'); buf.writenl(); } void tiargsToBuffer(TemplateInstance ti) { buf.writeByte('!'); if (ti.nest) { buf.writestring("(...)"); return; } if (!ti.tiargs) { buf.writestring("()"); return; } if (ti.tiargs.dim == 1) { RootObject oarg = (*ti.tiargs)[0]; if (Type t = isType(oarg)) { if (t.equals(Type.tstring) || t.equals(Type.twstring) || t.equals(Type.tdstring) || t.mod == 0 && (t.isTypeBasic() || t.ty == Tident && (cast(TypeIdentifier)t).idents.dim == 0)) { buf.writestring(t.toChars()); return; } } else if (Expression e = isExpression(oarg)) { if (e.op == TOKint64 || e.op == TOKfloat64 || e.op == TOKnull || e.op == TOKstring || e.op == TOKthis) { buf.writestring(e.toChars()); return; } } } buf.writeByte('('); ti.nest++; foreach (i, arg; *ti.tiargs) { if (i) buf.writestring(", "); objectToBuffer(arg); } ti.nest--; buf.writeByte(')'); } /**************************************** * This makes a 'pretty' version of the template arguments. * It's analogous to genIdent() which makes a mangled version. */ void objectToBuffer(RootObject oarg) { //printf("objectToBuffer()\n"); /* The logic of this should match what genIdent() does. The _dynamic_cast() * function relies on all the pretty strings to be unique for different classes * (see Bugzilla 7375). * Perhaps it would be better to demangle what genIdent() does. */ if (auto t = isType(oarg)) { //printf("\tt: %s ty = %d\n", t.toChars(), t.ty); typeToBuffer(t, null); } else if (auto e = isExpression(oarg)) { if (e.op == TOKvar) e = e.optimize(WANTvalue); // added to fix Bugzilla 7375 e.accept(this); } else if (Dsymbol s = isDsymbol(oarg)) { const p = s.ident ? s.ident.toChars() : s.toChars(); buf.writestring(p); } else if (auto v = isTuple(oarg)) { auto args = &v.objects; foreach (i, arg; *args) { if (i) buf.writestring(", "); objectToBuffer(arg); } } else if (!oarg) { buf.writestring("NULL"); } else { debug { printf("bad Object = %p\n", oarg); } assert(0); } } override void visit(EnumDeclaration d) { auto oldInEnumDecl = inEnumDecl; scope(exit) inEnumDecl = oldInEnumDecl; inEnumDecl = d; buf.writestring("enum "); if (d.ident) { buf.writestring(d.ident.toChars()); buf.writeByte(' '); } if (d.memtype) { buf.writestring(": "); typeToBuffer(d.memtype, null); } if (!d.members) { buf.writeByte(';'); buf.writenl(); return; } buf.writenl(); buf.writeByte('{'); buf.writenl(); buf.level++; foreach (em; *d.members) { if (!em) continue; em.accept(this); buf.writeByte(','); buf.writenl(); } buf.level--; buf.writeByte('}'); buf.writenl(); } override void visit(Nspace d) { buf.writestring("extern (C++, "); buf.writestring(d.ident.toChars()); buf.writeByte(')'); buf.writenl(); buf.writeByte('{'); buf.writenl(); buf.level++; foreach (s; *d.members) s.accept(this); buf.level--; buf.writeByte('}'); buf.writenl(); } override void visit(StructDeclaration d) { buf.printf("%s ", d.kind()); if (!d.isAnonymous()) buf.writestring(d.toChars()); if (!d.members) { buf.writeByte(';'); buf.writenl(); return; } buf.writenl(); buf.writeByte('{'); buf.writenl(); buf.level++; foreach (s; *d.members) s.accept(this); buf.level--; buf.writeByte('}'); buf.writenl(); } override void visit(ClassDeclaration d) { if (!d.isAnonymous()) { buf.writestring(d.kind()); buf.writeByte(' '); buf.writestring(d.ident.toChars()); } visitBaseClasses(d); if (d.members) { buf.writenl(); buf.writeByte('{'); buf.writenl(); buf.level++; foreach (s; *d.members) s.accept(this); buf.level--; buf.writeByte('}'); } else buf.writeByte(';'); buf.writenl(); } void visitBaseClasses(ClassDeclaration d) { if (!d || !d.baseclasses.dim) return; buf.writestring(" : "); foreach (i, b; *d.baseclasses) { if (i) buf.writestring(", "); typeToBuffer(b.type, null); } } override void visit(AliasDeclaration d) { buf.writestring("alias "); if (d.aliassym) { buf.writestring(d.ident.toChars()); buf.writestring(" = "); if (stcToBuffer(buf, d.storage_class)) buf.writeByte(' '); d.aliassym.accept(this); } else if (d.type.ty == Tfunction) { if (stcToBuffer(buf, d.storage_class)) buf.writeByte(' '); typeToBuffer(d.type, d.ident); } else { declstring = (d.ident == Id.string || d.ident == Id.wstring || d.ident == Id.dstring); buf.writestring(d.ident.toChars()); buf.writestring(" = "); if (stcToBuffer(buf, d.storage_class)) buf.writeByte(' '); typeToBuffer(d.type, null); declstring = false; } buf.writeByte(';'); buf.writenl(); } override void visit(VarDeclaration d) { visitVarDecl(d, false); buf.writeByte(';'); buf.writenl(); } void visitVarDecl(VarDeclaration v, bool anywritten) { if (anywritten) { buf.writestring(", "); buf.writestring(v.ident.toChars()); } else { if (stcToBuffer(buf, v.storage_class)) buf.writeByte(' '); if (v.type) typeToBuffer(v.type, v.ident); else buf.writestring(v.ident.toChars()); } if (v._init) { buf.writestring(" = "); auto ie = v._init.isExpInitializer(); if (ie && (ie.exp.op == TOKconstruct || ie.exp.op == TOKblit)) (cast(AssignExp)ie.exp).e2.accept(this); else v._init.accept(this); } } override void visit(FuncDeclaration f) { //printf("FuncDeclaration::toCBuffer() '%s'\n", f.toChars()); if (stcToBuffer(buf, f.storage_class)) buf.writeByte(' '); auto tf = cast(TypeFunction)f.type; typeToBuffer(tf, f.ident); if (hgs.hdrgen) { // if the return type is missing (e.g. ref functions or auto) if (!tf.next || f.storage_class & STCauto) { hgs.autoMember++; bodyToBuffer(f); hgs.autoMember--; } else if (hgs.tpltMember == 0 && global.params.hdrStripPlainFunctions) { buf.writeByte(';'); buf.writenl(); } else bodyToBuffer(f); } else bodyToBuffer(f); } void bodyToBuffer(FuncDeclaration f) { if (!f.fbody || (hgs.hdrgen && global.params.hdrStripPlainFunctions && !hgs.autoMember && !hgs.tpltMember)) { buf.writeByte(';'); buf.writenl(); return; } int savetlpt = hgs.tpltMember; int saveauto = hgs.autoMember; hgs.tpltMember = 0; hgs.autoMember = 0; buf.writenl(); // in{} if (f.frequire) { buf.writestring("in"); buf.writenl(); f.frequire.accept(this); } // out{} if (f.fensure) { buf.writestring("out"); if (f.outId) { buf.writeByte('('); buf.writestring(f.outId.toChars()); buf.writeByte(')'); } buf.writenl(); f.fensure.accept(this); } if (f.frequire || f.fensure) { buf.writestring("body"); buf.writenl(); } buf.writeByte('{'); buf.writenl(); buf.level++; f.fbody.accept(this); buf.level--; buf.writeByte('}'); buf.writenl(); hgs.tpltMember = savetlpt; hgs.autoMember = saveauto; } override void visit(FuncLiteralDeclaration f) { if (f.type.ty == Terror) { buf.writestring("__error"); return; } if (f.tok != TOKreserved) { buf.writestring(f.kind()); buf.writeByte(' '); } TypeFunction tf = cast(TypeFunction)f.type; // Don't print tf.mod, tf.trust, and tf.linkage if (!f.inferRetType && tf.next) typeToBuffer(tf.next, null); parametersToBuffer(tf.parameters, tf.varargs); CompoundStatement cs = f.fbody.isCompoundStatement(); Statement s1; if (f.semanticRun >= PASSsemantic3done && cs) { s1 = (*cs.statements)[cs.statements.dim - 1]; } else s1 = !cs ? f.fbody : null; ReturnStatement rs = s1 ? s1.isReturnStatement() : null; if (rs && rs.exp) { buf.writestring(" => "); rs.exp.accept(this); } else { hgs.tpltMember++; bodyToBuffer(f); hgs.tpltMember--; } } override void visit(PostBlitDeclaration d) { if (stcToBuffer(buf, d.storage_class)) buf.writeByte(' '); buf.writestring("this(this)"); bodyToBuffer(d); } override void visit(DtorDeclaration d) { if (d.storage_class & STCtrusted) buf.writestring("@trusted "); if (d.storage_class & STCsafe) buf.writestring("@safe "); if (d.storage_class & STCnogc) buf.writestring("@nogc "); if (d.storage_class & STCdisable) buf.writestring("@disable "); buf.writestring("~this()"); bodyToBuffer(d); } override void visit(StaticCtorDeclaration d) { if (stcToBuffer(buf, d.storage_class & ~STCstatic)) buf.writeByte(' '); if (d.isSharedStaticCtorDeclaration()) buf.writestring("shared "); buf.writestring("static this()"); if (hgs.hdrgen && !hgs.tpltMember) { buf.writeByte(';'); buf.writenl(); } else bodyToBuffer(d); } override void visit(StaticDtorDeclaration d) { if (hgs.hdrgen) return; if (stcToBuffer(buf, d.storage_class & ~STCstatic)) buf.writeByte(' '); if (d.isSharedStaticDtorDeclaration()) buf.writestring("shared "); buf.writestring("static ~this()"); bodyToBuffer(d); } override void visit(InvariantDeclaration d) { if (hgs.hdrgen) return; if (stcToBuffer(buf, d.storage_class)) buf.writeByte(' '); buf.writestring("invariant"); bodyToBuffer(d); } override void visit(UnitTestDeclaration d) { if (hgs.hdrgen) return; if (stcToBuffer(buf, d.storage_class)) buf.writeByte(' '); buf.writestring("unittest"); bodyToBuffer(d); } override void visit(NewDeclaration d) { if (stcToBuffer(buf, d.storage_class & ~STCstatic)) buf.writeByte(' '); buf.writestring("new"); parametersToBuffer(d.parameters, d.varargs); bodyToBuffer(d); } override void visit(DeleteDeclaration d) { if (stcToBuffer(buf, d.storage_class & ~STCstatic)) buf.writeByte(' '); buf.writestring("delete"); parametersToBuffer(d.parameters, 0); bodyToBuffer(d); } //////////////////////////////////////////////////////////////////////////// override void visit(ErrorInitializer iz) { buf.writestring("__error__"); } override void visit(VoidInitializer iz) { buf.writestring("void"); } override void visit(StructInitializer si) { //printf("StructInitializer::toCBuffer()\n"); buf.writeByte('{'); foreach (i, const id; si.field) { if (i) buf.writestring(", "); if (id) { buf.writestring(id.toChars()); buf.writeByte(':'); } if (auto iz = si.value[i]) iz.accept(this); } buf.writeByte('}'); } override void visit(ArrayInitializer ai) { buf.writeByte('['); foreach (i, ex; ai.index) { if (i) buf.writestring(", "); if (ex) { ex.accept(this); buf.writeByte(':'); } if (auto iz = ai.value[i]) iz.accept(this); } buf.writeByte(']'); } override void visit(ExpInitializer ei) { ei.exp.accept(this); } //////////////////////////////////////////////////////////////////////////// /************************************************** * Write out argument list to buf. */ void argsToBuffer(Expressions* expressions, Expression basis = null) { if (!expressions || !expressions.dim) return; version (all) { foreach (i, el; *expressions) { if (i) buf.writestring(", "); if (!el) el = basis; if (el) expToBuffer(el, PREC.assign); } } else { // Sparse style formatting, for debug use only // [0..dim: basis, 1: e1, 5: e5] if (basis) { buf.printf("0..%llu: ", cast(ulong)expressions.dim); expToBuffer(basis, PREC.assign); } foreach (i, el; *expressions) { if (el) { if (basis) buf.printf(", %llu: ", cast(ulong)i); else if (i) buf.writestring(", "); expToBuffer(el, PREC.assign); } } } } void sizeToBuffer(Expression e) { if (e.type == Type.tsize_t) { Expression ex = (e.op == TOKcast ? (cast(CastExp)e).e1 : e); ex = ex.optimize(WANTvalue); dinteger_t uval = ex.op == TOKint64 ? ex.toInteger() : cast(dinteger_t)-1; if (cast(sinteger_t)uval >= 0) { dinteger_t sizemax; if (Target.ptrsize == 4) sizemax = 0xFFFFFFFFU; else if (Target.ptrsize == 8) sizemax = 0xFFFFFFFFFFFFFFFFUL; else assert(0); if (uval <= sizemax && uval <= 0x7FFFFFFFFFFFFFFFUL) { buf.printf("%llu", uval); return; } } } expToBuffer(e, PREC.assign); } /************************************************** * Write expression out to buf, but wrap it * in ( ) if its precedence is less than pr. */ void expToBuffer(Expression e, PREC pr) { debug { if (precedence[e.op] == PREC.zero) printf("precedence not defined for token '%s'\n", Token.toChars(e.op)); } assert(precedence[e.op] != PREC.zero); assert(pr != PREC.zero); //if (precedence[e.op] == 0) e.print(); /* Despite precedence, we don't allow a<b<c expressions. * They must be parenthesized. */ if (precedence[e.op] < pr || (pr == PREC.rel && precedence[e.op] == pr)) { buf.writeByte('('); e.accept(this); buf.writeByte(')'); } else e.accept(this); } override void visit(Expression e) { buf.writestring(Token.toString(e.op)); } override void visit(IntegerExp e) { dinteger_t v = e.toInteger(); if (e.type) { Type t = e.type; L1: switch (t.ty) { case Tenum: { TypeEnum te = cast(TypeEnum)t; if (hgs.fullDump) { auto sym = te.sym; if (inEnumDecl != sym) foreach(i;0 .. sym.members.dim) { EnumMember em = cast(EnumMember) (*sym.members)[i]; if (em.value.toInteger == v) { buf.printf("%s.%s", sym.toChars(), em.ident.toChars()); return ; } } //assert(0, "We could not find the EmumMember");// for some reason it won't append char* ~ e.toChars() ~ " in " ~ sym.toChars() ); } buf.printf("cast(%s)", te.sym.toChars()); t = te.sym.memtype; goto L1; } case Twchar: // BUG: need to cast(wchar) case Tdchar: // BUG: need to cast(dchar) if (cast(uinteger_t)v > 0xFF) { buf.printf("'\\U%08x'", v); break; } goto case; case Tchar: { size_t o = buf.offset; if (v == '\'') buf.writestring("'\\''"); else if (isprint(cast(int)v) && v != '\\') buf.printf("'%c'", cast(int)v); else buf.printf("'\\x%02x'", cast(int)v); if (hgs.ddoc) escapeDdocString(buf, o); break; } case Tint8: buf.writestring("cast(byte)"); goto L2; case Tint16: buf.writestring("cast(short)"); goto L2; case Tint32: L2: buf.printf("%d", cast(int)v); break; case Tuns8: buf.writestring("cast(ubyte)"); goto L3; case Tuns16: buf.writestring("cast(ushort)"); goto L3; case Tuns32: L3: buf.printf("%uu", cast(uint)v); break; case Tint64: buf.printf("%lldL", v); break; case Tuns64: L4: buf.printf("%lluLU", v); break; case Tbool: buf.writestring(v ? "true" : "false"); break; case Tpointer: buf.writestring("cast("); buf.writestring(t.toChars()); buf.writeByte(')'); if (Target.ptrsize == 4) goto L3; else if (Target.ptrsize == 8) goto L4; else assert(0); default: /* This can happen if errors, such as * the type is painted on like in fromConstInitializer(). */ if (!global.errors) { debug { t.print(); } assert(0); } break; } } else if (v & 0x8000000000000000L) buf.printf("0x%llx", v); else buf.printf("%lld", v); } override void visit(ErrorExp e) { buf.writestring("__error"); } void floatToBuffer(Type type, real_t value) { /** sizeof(value)*3 is because each byte of mantissa is max of 256 (3 characters). The string will be "-M.MMMMe-4932". (ie, 8 chars more than mantissa). Plus one for trailing \0. Plus one for rounding. */ const(size_t) BUFFER_LEN = value.sizeof * 3 + 8 + 1 + 1; char[BUFFER_LEN] buffer; CTFloat.sprint(buffer.ptr, 'g', value); assert(strlen(buffer.ptr) < BUFFER_LEN); if (hgs.hdrgen) { real_t r = CTFloat.parse(buffer.ptr); if (r != value) // if exact duplication CTFloat.sprint(buffer.ptr, 'a', value); } buf.writestring(buffer.ptr); if (type) { Type t = type.toBasetype(); switch (t.ty) { case Tfloat32: case Timaginary32: case Tcomplex32: buf.writeByte('F'); break; case Tfloat80: case Timaginary80: case Tcomplex80: buf.writeByte('L'); break; default: break; } if (t.isimaginary()) buf.writeByte('i'); } } override void visit(RealExp e) { floatToBuffer(e.type, e.value); } override void visit(ComplexExp e) { /* Print as: * (re+imi) */ buf.writeByte('('); floatToBuffer(e.type, creall(e.value)); buf.writeByte('+'); floatToBuffer(e.type, cimagl(e.value)); buf.writestring("i)"); } override void visit(IdentifierExp e) { if (hgs.hdrgen || hgs.ddoc) buf.writestring(e.ident.toHChars2()); else buf.writestring(e.ident.toChars()); } override void visit(DsymbolExp e) { buf.writestring(e.s.toChars()); } override void visit(ThisExp e) { buf.writestring("this"); } override void visit(SuperExp e) { buf.writestring("super"); } override void visit(NullExp e) { buf.writestring("null"); } override void visit(StringExp e) { buf.writeByte('"'); size_t o = buf.offset; for (size_t i = 0; i < e.len; i++) { uint c = e.charAt(i); switch (c) { case '"': case '\\': buf.writeByte('\\'); goto default; default: if (c <= 0xFF) { if (c <= 0x7F && isprint(c)) buf.writeByte(c); else buf.printf("\\x%02x", c); } else if (c <= 0xFFFF) buf.printf("\\x%02x\\x%02x", c & 0xFF, c >> 8); else buf.printf("\\x%02x\\x%02x\\x%02x\\x%02x", c & 0xFF, (c >> 8) & 0xFF, (c >> 16) & 0xFF, c >> 24); break; } } if (hgs.ddoc) escapeDdocString(buf, o); buf.writeByte('"'); if (e.postfix) buf.writeByte(e.postfix); } override void visit(ArrayLiteralExp e) { buf.writeByte('['); argsToBuffer(e.elements, e.basis); buf.writeByte(']'); } override void visit(AssocArrayLiteralExp e) { buf.writeByte('['); foreach (i, key; *e.keys) { if (i) buf.writestring(", "); expToBuffer(key, PREC.assign); buf.writeByte(':'); auto value = (*e.values)[i]; expToBuffer(value, PREC.assign); } buf.writeByte(']'); } override void visit(StructLiteralExp e) { buf.writestring(e.sd.toChars()); buf.writeByte('('); // CTFE can generate struct literals that contain an AddrExp pointing // to themselves, need to avoid infinite recursion: // struct S { this(int){ this.s = &this; } S* s; } // const foo = new S(0); if (e.stageflags & stageToCBuffer) buf.writestring("<recursion>"); else { int old = e.stageflags; e.stageflags |= stageToCBuffer; argsToBuffer(e.elements); e.stageflags = old; } buf.writeByte(')'); } override void visit(TypeExp e) { typeToBuffer(e.type, null); } override void visit(ScopeExp e) { if (e.sds.isTemplateInstance()) { e.sds.accept(this); } else if (hgs !is null && hgs.ddoc) { // fixes bug 6491 Module m = e.sds.isModule(); if (m) buf.writestring(m.md.toChars()); else buf.writestring(e.sds.toChars()); } else { buf.writestring(e.sds.kind()); buf.writeByte(' '); buf.writestring(e.sds.toChars()); } } override void visit(TemplateExp e) { buf.writestring(e.td.toChars()); } override void visit(NewExp e) { if (e.thisexp) { expToBuffer(e.thisexp, PREC.primary); buf.writeByte('.'); } buf.writestring("new "); if (e.newargs && e.newargs.dim) { buf.writeByte('('); argsToBuffer(e.newargs); buf.writeByte(')'); } typeToBuffer(e.newtype, null); if (e.arguments && e.arguments.dim) { buf.writeByte('('); argsToBuffer(e.arguments); buf.writeByte(')'); } } override void visit(NewAnonClassExp e) { if (e.thisexp) { expToBuffer(e.thisexp, PREC.primary); buf.writeByte('.'); } buf.writestring("new"); if (e.newargs && e.newargs.dim) { buf.writeByte('('); argsToBuffer(e.newargs); buf.writeByte(')'); } buf.writestring(" class "); if (e.arguments && e.arguments.dim) { buf.writeByte('('); argsToBuffer(e.arguments); buf.writeByte(')'); } if (e.cd) e.cd.accept(this); } override void visit(SymOffExp e) { if (e.offset) buf.printf("(& %s+%u)", e.var.toChars(), e.offset); else if (e.var.isTypeInfoDeclaration()) buf.printf("%s", e.var.toChars()); else buf.printf("& %s", e.var.toChars()); } override void visit(VarExp e) { buf.writestring(e.var.toChars()); } override void visit(OverExp e) { buf.writestring(e.vars.ident.toChars()); } override void visit(TupleExp e) { if (e.e0) { buf.writeByte('('); e.e0.accept(this); buf.writestring(", tuple("); argsToBuffer(e.exps); buf.writestring("))"); } else { buf.writestring("tuple("); argsToBuffer(e.exps); buf.writeByte(')'); } } override void visit(FuncExp e) { e.fd.accept(this); //buf.writestring(e.fd.toChars()); } override void visit(DeclarationExp e) { /* Normal dmd execution won't reach here - regular variable declarations * are handled in visit(ExpStatement), so here would be used only when * we'll directly call Expression.toChars() for debugging. */ if (auto v = e.declaration.isVarDeclaration()) { // For debugging use: // - Avoid printing newline. // - Intentionally use the format (Type var;) // which isn't correct as regular D code. buf.writeByte('('); visitVarDecl(v, false); buf.writeByte(';'); buf.writeByte(')'); } else e.declaration.accept(this); } override void visit(TypeidExp e) { buf.writestring("typeid("); objectToBuffer(e.obj); buf.writeByte(')'); } override void visit(TraitsExp e) { buf.writestring("__traits("); buf.writestring(e.ident.toChars()); if (e.args) { foreach (arg; *e.args) { buf.writestring(", "); objectToBuffer(arg); } } buf.writeByte(')'); } override void visit(HaltExp e) { buf.writestring("halt"); } override void visit(IsExp e) { buf.writestring("is("); typeToBuffer(e.targ, e.id); if (e.tok2 != TOKreserved) { buf.printf(" %s %s", Token.toChars(e.tok), Token.toChars(e.tok2)); } else if (e.tspec) { if (e.tok == TOKcolon) buf.writestring(" : "); else buf.writestring(" == "); typeToBuffer(e.tspec, null); } if (e.parameters && e.parameters.dim) { buf.writestring(", "); visitTemplateParameters(e.parameters); } buf.writeByte(')'); } override void visit(UnaExp e) { buf.writestring(Token.toString(e.op)); expToBuffer(e.e1, precedence[e.op]); } override void visit(BinExp e) { expToBuffer(e.e1, precedence[e.op]); buf.writeByte(' '); buf.writestring(Token.toString(e.op)); buf.writeByte(' '); expToBuffer(e.e2, cast(PREC)(precedence[e.op] + 1)); } override void visit(CompileExp e) { buf.writestring("mixin("); expToBuffer(e.e1, PREC.assign); buf.writeByte(')'); } override void visit(ImportExp e) { buf.writestring("import("); expToBuffer(e.e1, PREC.assign); buf.writeByte(')'); } override void visit(AssertExp e) { buf.writestring("assert("); expToBuffer(e.e1, PREC.assign); if (e.msg) { buf.writestring(", "); expToBuffer(e.msg, PREC.assign); } buf.writeByte(')'); } override void visit(DotIdExp e) { expToBuffer(e.e1, PREC.primary); buf.writeByte('.'); buf.writestring(e.ident.toChars()); } override void visit(DotTemplateExp e) { expToBuffer(e.e1, PREC.primary); buf.writeByte('.'); buf.writestring(e.td.toChars()); } override void visit(DotVarExp e) { expToBuffer(e.e1, PREC.primary); buf.writeByte('.'); buf.writestring(e.var.toChars()); } override void visit(DotTemplateInstanceExp e) { expToBuffer(e.e1, PREC.primary); buf.writeByte('.'); e.ti.accept(this); } override void visit(DelegateExp e) { buf.writeByte('&'); if (!e.func.isNested()) { expToBuffer(e.e1, PREC.primary); buf.writeByte('.'); } buf.writestring(e.func.toChars()); } override void visit(DotTypeExp e) { expToBuffer(e.e1, PREC.primary); buf.writeByte('.'); buf.writestring(e.sym.toChars()); } override void visit(CallExp e) { if (e.e1.op == TOKtype) { /* Avoid parens around type to prevent forbidden cast syntax: * (sometype)(arg1) * This is ok since types in constructor calls * can never depend on parens anyway */ e.e1.accept(this); } else expToBuffer(e.e1, precedence[e.op]); buf.writeByte('('); argsToBuffer(e.arguments); buf.writeByte(')'); } override void visit(PtrExp e) { buf.writeByte('*'); expToBuffer(e.e1, precedence[e.op]); } override void visit(DeleteExp e) { buf.writestring("delete "); expToBuffer(e.e1, precedence[e.op]); } override void visit(CastExp e) { buf.writestring("cast("); if (e.to) typeToBuffer(e.to, null); else { MODtoBuffer(buf, e.mod); } buf.writeByte(')'); expToBuffer(e.e1, precedence[e.op]); } override void visit(VectorExp e) { buf.writestring("cast("); typeToBuffer(e.to, null); buf.writeByte(')'); expToBuffer(e.e1, precedence[e.op]); } override void visit(SliceExp e) { expToBuffer(e.e1, precedence[e.op]); buf.writeByte('['); if (e.upr || e.lwr) { if (e.lwr) sizeToBuffer(e.lwr); else buf.writeByte('0'); buf.writestring(".."); if (e.upr) sizeToBuffer(e.upr); else buf.writeByte('$'); } buf.writeByte(']'); } override void visit(ArrayLengthExp e) { expToBuffer(e.e1, PREC.primary); buf.writestring(".length"); } override void visit(IntervalExp e) { expToBuffer(e.lwr, PREC.assign); buf.writestring(".."); expToBuffer(e.upr, PREC.assign); } override void visit(DelegatePtrExp e) { expToBuffer(e.e1, PREC.primary); buf.writestring(".ptr"); } override void visit(DelegateFuncptrExp e) { expToBuffer(e.e1, PREC.primary); buf.writestring(".funcptr"); } override void visit(ArrayExp e) { expToBuffer(e.e1, PREC.primary); buf.writeByte('['); argsToBuffer(e.arguments); buf.writeByte(']'); } override void visit(DotExp e) { expToBuffer(e.e1, PREC.primary); buf.writeByte('.'); expToBuffer(e.e2, PREC.primary); } override void visit(IndexExp e) { expToBuffer(e.e1, PREC.primary); buf.writeByte('['); sizeToBuffer(e.e2); buf.writeByte(']'); } override void visit(PostExp e) { expToBuffer(e.e1, precedence[e.op]); buf.writestring(Token.toString(e.op)); } override void visit(PreExp e) { buf.writestring(Token.toString(e.op)); expToBuffer(e.e1, precedence[e.op]); } override void visit(RemoveExp e) { expToBuffer(e.e1, PREC.primary); buf.writestring(".remove("); expToBuffer(e.e2, PREC.assign); buf.writeByte(')'); } override void visit(CondExp e) { expToBuffer(e.econd, PREC.oror); buf.writestring(" ? "); expToBuffer(e.e1, PREC.expr); buf.writestring(" : "); expToBuffer(e.e2, PREC.cond); } override void visit(DefaultInitExp e) { buf.writestring(Token.toString(e.subop)); } override void visit(ClassReferenceExp e) { buf.writestring(e.value.toChars()); } //////////////////////////////////////////////////////////////////////////// override void visit(TemplateTypeParameter tp) { buf.writestring(tp.ident.toChars()); if (tp.specType) { buf.writestring(" : "); typeToBuffer(tp.specType, null); } if (tp.defaultType) { buf.writestring(" = "); typeToBuffer(tp.defaultType, null); } } override void visit(TemplateThisParameter tp) { buf.writestring("this "); visit(cast(TemplateTypeParameter)tp); } override void visit(TemplateAliasParameter tp) { buf.writestring("alias "); if (tp.specType) typeToBuffer(tp.specType, tp.ident); else buf.writestring(tp.ident.toChars()); if (tp.specAlias) { buf.writestring(" : "); objectToBuffer(tp.specAlias); } if (tp.defaultAlias) { buf.writestring(" = "); objectToBuffer(tp.defaultAlias); } } override void visit(TemplateValueParameter tp) { typeToBuffer(tp.valType, tp.ident); if (tp.specValue) { buf.writestring(" : "); tp.specValue.accept(this); } if (tp.defaultValue) { buf.writestring(" = "); tp.defaultValue.accept(this); } } override void visit(TemplateTupleParameter tp) { buf.writestring(tp.ident.toChars()); buf.writestring("..."); } //////////////////////////////////////////////////////////////////////////// override void visit(DebugCondition c) { if (c.ident) buf.printf("debug (%s)", c.ident.toChars()); else buf.printf("debug (%u)", c.level); } override void visit(VersionCondition c) { if (c.ident) buf.printf("version (%s)", c.ident.toChars()); else buf.printf("version (%u)", c.level); } override void visit(StaticIfCondition c) { buf.writestring("static if ("); c.exp.accept(this); buf.writeByte(')'); } //////////////////////////////////////////////////////////////////////////// override void visit(Parameter p) { if (p.storageClass & STCauto) buf.writestring("auto "); if (p.storageClass & STCreturn) buf.writestring("return "); if (p.storageClass & STCout) buf.writestring("out "); else if (p.storageClass & STCref) buf.writestring("ref "); else if (p.storageClass & STCin) buf.writestring("in "); else if (p.storageClass & STClazy) buf.writestring("lazy "); else if (p.storageClass & STCalias) buf.writestring("alias "); StorageClass stc = p.storageClass; if (p.type && p.type.mod & MODshared) stc &= ~STCshared; if (stcToBuffer(buf, stc & (STCconst | STCimmutable | STCwild | STCshared | STCscope))) buf.writeByte(' '); if (p.storageClass & STCalias) { if (p.ident) buf.writestring(p.ident.toChars()); } else if (p.type.ty == Tident && (cast(TypeIdentifier)p.type).ident.toString().length > 3 && strncmp((cast(TypeIdentifier)p.type).ident.toChars(), "__T", 3) == 0) { // print parameter name, instead of undetermined type parameter buf.writestring(p.ident.toChars()); } else typeToBuffer(p.type, p.ident); if (p.defaultArg) { buf.writestring(" = "); p.defaultArg.accept(this); } } void parametersToBuffer(Parameters* parameters, int varargs) { buf.writeByte('('); if (parameters) { size_t dim = Parameter.dim(parameters); foreach (i; 0 .. dim) { if (i) buf.writestring(", "); Parameter fparam = Parameter.getNth(parameters, i); fparam.accept(this); } if (varargs) { if (parameters.dim && varargs == 1) buf.writestring(", "); buf.writestring("..."); } } buf.writeByte(')'); } override void visit(Module m) { if (m.md) { if (m.userAttribDecl) { buf.writestring("@("); argsToBuffer(m.userAttribDecl.atts); buf.writeByte(')'); buf.writenl(); } if (m.md.isdeprecated) { if (m.md.msg) { buf.writestring("deprecated("); m.md.msg.accept(this); buf.writestring(") "); } else buf.writestring("deprecated "); } buf.writestring("module "); buf.writestring(m.md.toChars()); buf.writeByte(';'); buf.writenl(); } foreach (s; *m.members) { s.accept(this); } } } extern (C++) void toCBuffer(Statement s, OutBuffer* buf, HdrGenState* hgs) { scope PrettyPrintVisitor v = new PrettyPrintVisitor(buf, hgs); s.accept(v); } extern (C++) void toCBuffer(Type t, OutBuffer* buf, Identifier ident, HdrGenState* hgs) { scope PrettyPrintVisitor v = new PrettyPrintVisitor(buf, hgs); v.typeToBuffer(t, ident); } extern (C++) void toCBuffer(Dsymbol s, OutBuffer* buf, HdrGenState* hgs) { scope PrettyPrintVisitor v = new PrettyPrintVisitor(buf, hgs); s.accept(v); } // used from TemplateInstance::toChars() and TemplateMixin::toChars() extern (C++) void toCBufferInstance(TemplateInstance ti, OutBuffer* buf, bool qualifyTypes = false) { HdrGenState hgs; hgs.fullQual = qualifyTypes; scope PrettyPrintVisitor v = new PrettyPrintVisitor(buf, &hgs); v.visit(ti); } extern (C++) void toCBuffer(Initializer iz, OutBuffer* buf, HdrGenState* hgs) { scope PrettyPrintVisitor v = new PrettyPrintVisitor(buf, hgs); iz.accept(v); } extern (C++) bool stcToBuffer(OutBuffer* buf, StorageClass stc) { bool result = false; if ((stc & (STCreturn | STCscope)) == (STCreturn | STCscope)) stc &= ~STCscope; while (stc) { const(char)* p = stcToChars(stc); if (!p) // there's no visible storage classes break; if (!result) result = true; else buf.writeByte(' '); buf.writestring(p); } return result; } /************************************************* * Pick off one of the storage classes from stc, * and return a pointer to a string representation of it. * stc is reduced by the one picked. */ extern (C++) const(char)* stcToChars(ref StorageClass stc) { struct SCstring { StorageClass stc; TOK tok; const(char)* id; } static __gshared SCstring* table = [ SCstring(STCauto, TOKauto), SCstring(STCscope, TOKscope), SCstring(STCstatic, TOKstatic), SCstring(STCextern, TOKextern), SCstring(STCconst, TOKconst), SCstring(STCfinal, TOKfinal), SCstring(STCabstract, TOKabstract), SCstring(STCsynchronized, TOKsynchronized), SCstring(STCdeprecated, TOKdeprecated), SCstring(STCoverride, TOKoverride), SCstring(STClazy, TOKlazy), SCstring(STCalias, TOKalias), SCstring(STCout, TOKout), SCstring(STCin, TOKin), SCstring(STCmanifest, TOKenum), SCstring(STCimmutable, TOKimmutable), SCstring(STCshared, TOKshared), SCstring(STCnothrow, TOKnothrow), SCstring(STCwild, TOKwild), SCstring(STCpure, TOKpure), SCstring(STCref, TOKref), SCstring(STCtls), SCstring(STCgshared, TOKgshared), SCstring(STCnogc, TOKat, "@nogc"), SCstring(STCproperty, TOKat, "@property"), SCstring(STCsafe, TOKat, "@safe"), SCstring(STCtrusted, TOKat, "@trusted"), SCstring(STCsystem, TOKat, "@system"), SCstring(STCdisable, TOKat, "@disable"), SCstring(0, TOKreserved) ]; for (int i = 0; table[i].stc; i++) { StorageClass tbl = table[i].stc; assert(tbl & STCStorageClass); if (stc & tbl) { stc &= ~tbl; if (tbl == STCtls) // TOKtls was removed return "__thread"; TOK tok = table[i].tok; if (tok == TOKat) return table[i].id; else return Token.toChars(tok); } } //printf("stc = %llx\n", stc); return null; } extern (C++) void trustToBuffer(OutBuffer* buf, TRUST trust) { const(char)* p = trustToChars(trust); if (p) buf.writestring(p); } extern (C++) const(char)* trustToChars(TRUST trust) { switch (trust) { case TRUSTdefault: return null; case TRUSTsystem: return "@system"; case TRUSTtrusted: return "@trusted"; case TRUSTsafe: return "@safe"; default: assert(0); } } extern (C++) void linkageToBuffer(OutBuffer* buf, LINK linkage) { const(char)* p = linkageToChars(linkage); if (p) { buf.writestring("extern ("); buf.writestring(p); buf.writeByte(')'); } } extern (C++) const(char)* linkageToChars(LINK linkage) { switch (linkage) { case LINKdefault: return null; case LINKd: return "D"; case LINKc: return "C"; case LINKcpp: return "C++"; case LINKwindows: return "Windows"; case LINKpascal: return "Pascal"; case LINKobjc: return "Objective-C"; case LINKsystem: return "System"; default: assert(0); } } extern (C++) void protectionToBuffer(OutBuffer* buf, Prot prot) { const(char)* p = protectionToChars(prot.kind); if (p) buf.writestring(p); if (prot.kind == PROTpackage && prot.pkg) { buf.writeByte('('); buf.writestring(prot.pkg.toPrettyChars(true)); buf.writeByte(')'); } } extern (C++) const(char)* protectionToChars(PROTKIND kind) { switch (kind) { case PROTundefined: return null; case PROTnone: return "none"; case PROTprivate: return "private"; case PROTpackage: return "package"; case PROTprotected: return "protected"; case PROTpublic: return "public"; case PROTexport: return "export"; default: assert(0); } } // Print the full function signature with correct ident, attributes and template args extern (C++) void functionToBufferFull(TypeFunction tf, OutBuffer* buf, Identifier ident, HdrGenState* hgs, TemplateDeclaration td) { //printf("TypeFunction::toCBuffer() this = %p\n", this); scope PrettyPrintVisitor v = new PrettyPrintVisitor(buf, hgs); v.visitFuncIdentWithPrefix(tf, ident, td, true); } // ident is inserted before the argument list and will be "function" or "delegate" for a type extern (C++) void functionToBufferWithIdent(TypeFunction tf, OutBuffer* buf, const(char)* ident) { HdrGenState hgs; scope PrettyPrintVisitor v = new PrettyPrintVisitor(buf, &hgs); v.visitFuncIdentWithPostfix(tf, ident); } extern (C++) void toCBuffer(Expression e, OutBuffer* buf, HdrGenState* hgs) { scope PrettyPrintVisitor v = new PrettyPrintVisitor(buf, hgs); e.accept(v); } /************************************************** * Write out argument types to buf. */ extern (C++) void argExpTypesToCBuffer(OutBuffer* buf, Expressions* arguments) { if (!arguments || !arguments.dim) return; HdrGenState hgs; scope PrettyPrintVisitor v = new PrettyPrintVisitor(buf, &hgs); foreach (i, arg; *arguments) { if (i) buf.writestring(", "); v.typeToBuffer(arg.type, null); } } extern (C++) void toCBuffer(TemplateParameter tp, OutBuffer* buf, HdrGenState* hgs) { scope PrettyPrintVisitor v = new PrettyPrintVisitor(buf, hgs); tp.accept(v); } extern (C++) void arrayObjectsToBuffer(OutBuffer* buf, Objects* objects) { if (!objects || !objects.dim) return; HdrGenState hgs; scope PrettyPrintVisitor v = new PrettyPrintVisitor(buf, &hgs); foreach (i, o; *objects) { if (i) buf.writestring(", "); v.objectToBuffer(o); } } extern (C++) const(char)* parametersTypeToChars(Parameters* parameters, int varargs) { OutBuffer buf; HdrGenState hgs; scope PrettyPrintVisitor v = new PrettyPrintVisitor(&buf, &hgs); v.parametersToBuffer(parameters, varargs); return buf.extractString(); }
D
var a := 11; var b := 7; a := a + b; b := a - b; a := a - b; print a; print b;
D
#!/usr/bin/env rdmd import dpq2.all; import std.stdio: writeln; void main() { Connection conn = new Connection; conn.connString = "dbname=postgres"; conn.connect(); // Text query result auto s = conn.exec( "SELECT now() as current_time, 'abc'::text as field_name, " "123 as field_3, 456.78 as field_4" ); writeln( "1: ", s[0][3].as!PGtext ); // Binary query result static queryArg arg; queryParams p; p.resultFormat = valueFormat.BINARY; p.sqlCommand = "SELECT " "-1234.56789012345::double precision, " "'2012-10-04 11:00:21.227803+08'::timestamp with time zone, " "'first line\nsecond line'::text, " "NULL, " "array[1, 2, NULL]::integer[]"; auto r = conn.exec( p ); writeln( "2: ", r[0][0].as!PGdouble_precision ); writeln( "3: ", r[0][1].as!PGtime_stamp.toSimpleString ); writeln( "4: ", r[0][2].as!PGtext ); writeln( "5: ", r[0].isNULL(3) ); writeln( "6: ", r[0][4].asArray.getValue(1).as!PGinteger ); writeln( "7: ", r[0][4].asArray.isNULL(0) ); writeln( "8: ", r[0][4].asArray.isNULL(2) ); }
D
import Proto; import std.stdio; import std.container; import std.array, std.conv; T findExtrem (alias fun, T) (T [] rng) { T ret = rng [0]; foreach (it ; 1 .. rng.length) { if (fun (rng [it], ret)) ret = rng [it]; } return ret; } class Slave { private Proto _proto; private bool _end = false; private Array!Edge _window; private Array!ulong _vertices; private static float __lambda__; ulong nbEdges; this (Proto p, float lambda) { this._proto = p; __lambda__ = lambda; } void run () { while (!this._end) { this._proto.request (0, EDGE); this._proto.edge.receive (0, &this.edgeReceived); if (!this._end && this._window.length % WINDOW_SIZE == 0) { partitionWindow (); this._window.clear (); this._vertices.clear (); } else if (this._end && this._window.length > 0) { partitionWindow (); this._window.clear (); this._vertices.clear (); } } this._proto.end (0, END); } private void partitionWindow () { this._proto.state (0, (this._vertices.array)); Vertex [] vertices; ulong [] partitions; stateReceive (vertices, partitions); for (int it = 0, vt = 0; it < this._window.length; it ++, vt += 2) { auto u = vertices [vt]; auto v = vertices [vt + 1]; u.degree ++; v.degree ++; auto p = selectPartitionHDRF (u, v, partitions); this._window [it].color = p; } this._proto.putState (0, (this._window.array)); } private float balanceScoreHDRF (ulong p, ulong max, ulong min, float lambda, float epsilon) { return lambda * (cast (float) max - cast (float) p) / (epsilon + cast (float) max - cast (float) min); } private float g (Vertex v, ulong p, float thetaV) { if (!v.isInPartition(p)) return 0; else return 1 + (1 - thetaV); } private float replicationScoreHDRF (Vertex u, Vertex v, ulong p, float thetaV1, float thetaV2) { return g (u, p, thetaV1) + g (v, p, thetaV2); } private ulong selectPartitionHDRF (Vertex u, Vertex v, ulong [] partitions) { import std.algorithm, std.typecons, std.math; alias Pair = Tuple!(ulong, "p", float, "score"); float epsilon = 3.; auto delta1 = u.degree, delta2 = v.degree; auto thetaV1 = cast (float) delta1 / cast (float) (delta1 + delta2); auto thetaV2 = 1 - thetaV1; auto maxP = partitions.findExtrem!((a, b) => a > b); auto minP = partitions.findExtrem!((a, b) => a < b); Pair maxPart = Pair (0, float.init); Pair [] scores = new Pair [partitions.length]; foreach (it ; 0 .. partitions.length) { auto p = partitions [it]; auto rScore = replicationScoreHDRF (u, v, it, thetaV1, thetaV2); auto bScore = balanceScoreHDRF (p, maxP, minP, __lambda__, epsilon); scores [it] = Pair (it, (rScore + bScore) / 2.); } return scores [].findExtrem!((a, b) => a.score > b.score).p; } private void edgeReceived (ubyte * test, ulong len) { if (len != 0) { Serializer!(Edge*) serial; serial.ptr = test; this._window.insertBack (*serial.value); this._vertices.insertBack (serial.value.src); this._vertices.insertBack (serial.value.dst); this.nbEdges ++; } else { this._end = true; } } private void stateReceive (ref Vertex [] vertices, ref ulong [] partitions) { ubyte * begin; ulong len; this._proto.getState.receive (0, begin, len, partitions); while (len > 0) { vertices ~= Vertex.deserialize (begin, len); } } }
D
module android.java.android.app.IntentService_d_interface; import arsd.jni : IJavaObjectImplementation, JavaPackageId, JavaName, IJavaObject, ImportExportImpl, JavaInterfaceMembers; static import arsd.jni; import import12 = android.java.android.content.res.Resources_Theme_d_interface; import import2 = android.java.android.app.Application_d_interface; import import31 = android.java.android.content.ComponentName_d_interface; import import33 = android.java.java.lang.Class_d_interface; import import38 = android.java.android.content.res.ColorStateList_d_interface; import import4 = android.java.android.app.Notification_d_interface; import import29 = android.java.android.os.UserHandle_d_interface; import import0 = android.java.android.content.Intent_d_interface; import import17 = android.java.java.io.FileOutputStream_d_interface; import import28 = android.java.android.os.Handler_d_interface; import import32 = android.java.android.content.ServiceConnection_d_interface; import import6 = android.java.android.content.res.AssetManager_d_interface; import import40 = android.java.android.util.AttributeSet_d_interface; import import22 = android.java.android.graphics.drawable.Drawable_d_interface; import import36 = android.java.android.content.ComponentCallbacks_d_interface; import import25 = android.java.android.os.Bundle_d_interface; import import11 = android.java.java.util.concurrent.Executor_d_interface; import import21 = android.java.android.database.DatabaseErrorHandler_d_interface; import import1 = android.java.android.os.IBinder_d_interface; import import9 = android.java.android.content.ContentResolver_d_interface; import import10 = android.java.android.os.Looper_d_interface; import import18 = android.java.java.io.File_d_interface; import import26 = android.java.android.content.IntentSender_d_interface; import import30 = android.java.android.content.IntentFilter_d_interface; import import24 = android.java.java.io.InputStream_d_interface; import import13 = android.java.java.lang.ClassLoader_d_interface; import import19 = android.java.android.database.sqlite.SQLiteDatabase_d_interface; import import8 = android.java.android.content.pm.PackageManager_d_interface; import import3 = android.java.android.content.res.Configuration_d_interface; import import27 = android.java.android.content.BroadcastReceiver_d_interface; import import16 = android.java.java.io.FileInputStream_d_interface; import import23 = android.java.android.graphics.Bitmap_d_interface; import import20 = android.java.android.database.sqlite.SQLiteDatabase_CursorFactory_d_interface; import import37 = android.java.java.lang.CharSequence_d_interface; import import34 = android.java.android.net.Uri_d_interface; import import7 = android.java.android.content.res.Resources_d_interface; import import15 = android.java.android.content.SharedPreferences_d_interface; import import35 = android.java.android.view.Display_d_interface; import import39 = android.java.android.content.res.TypedArray_d_interface; import import14 = android.java.android.content.pm.ApplicationInfo_d_interface; import import5 = android.java.android.content.Context_d_interface; final class IntentService : IJavaObject { static immutable string[] _d_canCastTo = [ ]; @Import this(string); @Import void setIntentRedelivery(bool); @Import void onCreate(); @Import void onStart(import0.Intent, int); @Import int onStartCommand(import0.Intent, int, int); @Import void onDestroy(); @Import import1.IBinder onBind(import0.Intent); @Import import2.Application getApplication(); @Import void onConfigurationChanged(import3.Configuration); @Import void onLowMemory(); @Import void onTrimMemory(int); @Import bool onUnbind(import0.Intent); @Import void onRebind(import0.Intent); @Import void onTaskRemoved(import0.Intent); @Import void stopSelf(); @Import void stopSelf(int); @Import bool stopSelfResult(int); @Import void startForeground(int, import4.Notification); @Import void startForeground(int, import4.Notification, int); @Import void stopForeground(bool); @Import void stopForeground(int); @Import int getForegroundServiceType(); @Import import5.Context getBaseContext(); @Import import6.AssetManager getAssets(); @Import import7.Resources getResources(); @Import import8.PackageManager getPackageManager(); @Import import9.ContentResolver getContentResolver(); @Import import10.Looper getMainLooper(); @Import import11.Executor getMainExecutor(); @Import import5.Context getApplicationContext(); @Import void setTheme(int); @Import import12.Resources_Theme getTheme(); @Import import13.ClassLoader getClassLoader(); @Import string getPackageName(); @Import string getOpPackageName(); @Import import14.ApplicationInfo getApplicationInfo(); @Import string getPackageResourcePath(); @Import string getPackageCodePath(); @Import import15.SharedPreferences getSharedPreferences(string, int); @Import bool moveSharedPreferencesFrom(import5.Context, string); @Import bool deleteSharedPreferences(string); @Import import16.FileInputStream openFileInput(string); @Import import17.FileOutputStream openFileOutput(string, int); @Import bool deleteFile(string); @Import import18.File getFileStreamPath(string); @Import string[] fileList(); @Import import18.File getDataDir(); @Import import18.File getFilesDir(); @Import import18.File getNoBackupFilesDir(); @Import import18.File getExternalFilesDir(string); @Import import18.File[] getExternalFilesDirs(string); @Import import18.File getObbDir(); @Import import18.File[] getObbDirs(); @Import import18.File getCacheDir(); @Import import18.File getCodeCacheDir(); @Import import18.File getExternalCacheDir(); @Import import18.File[] getExternalCacheDirs(); @Import import18.File[] getExternalMediaDirs(); @Import import18.File getDir(string, int); @Import import19.SQLiteDatabase openOrCreateDatabase(string, int, import20.SQLiteDatabase_CursorFactory); @Import import19.SQLiteDatabase openOrCreateDatabase(string, int, import20.SQLiteDatabase_CursorFactory, import21.DatabaseErrorHandler); @Import bool moveDatabaseFrom(import5.Context, string); @Import bool deleteDatabase(string); @Import import18.File getDatabasePath(string); @Import string[] databaseList(); @Import import22.Drawable getWallpaper(); @Import import22.Drawable peekWallpaper(); @Import int getWallpaperDesiredMinimumWidth(); @Import int getWallpaperDesiredMinimumHeight(); @Import void setWallpaper(import23.Bitmap); @Import void setWallpaper(import24.InputStream); @Import void clearWallpaper(); @Import void startActivity(import0.Intent); @Import void startActivity(import0.Intent, import25.Bundle); @Import void startActivities(import0.Intent[]); @Import void startActivities(import0.Intent, import25.Bundle[]); @Import void startIntentSender(import26.IntentSender, import0.Intent, int, int, int); @Import void startIntentSender(import26.IntentSender, import0.Intent, int, int, int, import25.Bundle); @Import void sendBroadcast(import0.Intent); @Import void sendBroadcast(import0.Intent, string); @Import void sendOrderedBroadcast(import0.Intent, string); @Import void sendOrderedBroadcast(import0.Intent, string, import27.BroadcastReceiver, import28.Handler, int, string, import25.Bundle); @Import void sendBroadcastAsUser(import0.Intent, import29.UserHandle); @Import void sendBroadcastAsUser(import0.Intent, import29.UserHandle, string); @Import void sendOrderedBroadcastAsUser(import0.Intent, import29.UserHandle, string, import27.BroadcastReceiver, import28.Handler, int, string, import25.Bundle); @Import void sendStickyBroadcast(import0.Intent); @Import void sendStickyOrderedBroadcast(import0.Intent, import27.BroadcastReceiver, import28.Handler, int, string, import25.Bundle); @Import void removeStickyBroadcast(import0.Intent); @Import void sendStickyBroadcastAsUser(import0.Intent, import29.UserHandle); @Import void sendStickyOrderedBroadcastAsUser(import0.Intent, import29.UserHandle, import27.BroadcastReceiver, import28.Handler, int, string, import25.Bundle); @Import void removeStickyBroadcastAsUser(import0.Intent, import29.UserHandle); @Import import0.Intent registerReceiver(import27.BroadcastReceiver, import30.IntentFilter); @Import import0.Intent registerReceiver(import27.BroadcastReceiver, import30.IntentFilter, int); @Import import0.Intent registerReceiver(import27.BroadcastReceiver, import30.IntentFilter, string, import28.Handler); @Import import0.Intent registerReceiver(import27.BroadcastReceiver, import30.IntentFilter, string, import28.Handler, int); @Import void unregisterReceiver(import27.BroadcastReceiver); @Import import31.ComponentName startService(import0.Intent); @Import import31.ComponentName startForegroundService(import0.Intent); @Import bool stopService(import0.Intent); @Import bool bindService(import0.Intent, import32.ServiceConnection, int); @Import bool bindService(import0.Intent, int, import11.Executor, import32.ServiceConnection); @Import bool bindIsolatedService(import0.Intent, int, string, import11.Executor, import32.ServiceConnection); @Import void updateServiceGroup(import32.ServiceConnection, int, int); @Import void unbindService(import32.ServiceConnection); @Import bool startInstrumentation(import31.ComponentName, string, import25.Bundle); @Import IJavaObject getSystemService(string); @Import string getSystemServiceName(import33.Class); @Import int checkPermission(string, int, int); @Import int checkCallingPermission(string); @Import int checkCallingOrSelfPermission(string); @Import int checkSelfPermission(string); @Import void enforcePermission(string, int, int, string); @Import void enforceCallingPermission(string, string); @Import void enforceCallingOrSelfPermission(string, string); @Import void grantUriPermission(string, import34.Uri, int); @Import void revokeUriPermission(import34.Uri, int); @Import void revokeUriPermission(string, import34.Uri, int); @Import int checkUriPermission(import34.Uri, int, int, int); @Import int checkCallingUriPermission(import34.Uri, int); @Import int checkCallingOrSelfUriPermission(import34.Uri, int); @Import int checkUriPermission(import34.Uri, string, string, int, int, int); @Import void enforceUriPermission(import34.Uri, int, int, int, string); @Import void enforceCallingUriPermission(import34.Uri, int, string); @Import void enforceCallingOrSelfUriPermission(import34.Uri, int, string); @Import void enforceUriPermission(import34.Uri, string, string, int, int, int, string); @Import import5.Context createPackageContext(string, int); @Import import5.Context createContextForSplit(string); @Import import5.Context createConfigurationContext(import3.Configuration); @Import import5.Context createDisplayContext(import35.Display); @Import bool isRestricted(); @Import import5.Context createDeviceProtectedStorageContext(); @Import bool isDeviceProtectedStorage(); @Import void registerComponentCallbacks(import36.ComponentCallbacks); @Import void unregisterComponentCallbacks(import36.ComponentCallbacks); @Import import37.CharSequence getText(int); @Import string getString(int); @Import string getString(int, IJavaObject[]); @Import int getColor(int); @Import import22.Drawable getDrawable(int); @Import import38.ColorStateList getColorStateList(int); @Import import39.TypedArray obtainStyledAttributes(int[]); @Import import39.TypedArray obtainStyledAttributes(int, int[]); @Import import39.TypedArray obtainStyledAttributes(import40.AttributeSet, int[]); @Import import39.TypedArray obtainStyledAttributes(import40.AttributeSet, int, int, int[]); @Import IJavaObject getSystemService(import33.Class); @Import import33.Class getClass(); @Import int hashCode(); @Import bool equals(IJavaObject); @Import @JavaName("toString") string toString_(); override string toString() { return arsd.jni.javaObjectToString(this); } @Import void notify(); @Import void notifyAll(); @Import void wait(long); @Import void wait(long, int); @Import void wait(); mixin IJavaObjectImplementation!(false); public static immutable string _javaParameterString = "Landroid/app/IntentService;"; }
D
PLONG PLAT ED95 KD LOMAGAGE HIMAGAGE SLAT SLONG RESULTNO DP DM ROCKTYPE 269.100006 76.3000031 4.30000019 66.6999969 0 3 32.4000015 70.9000015 404 2.9000001 5 sediments 295.700012 66.9000015 4 30.2000008 1 3 33.5 73.0999985 600 2.4000001 4.4000001 sediments 267.5 72.1999969 2 13 1 13 28 82 6129 1.10000002 2.0999999 sediments, sandstones
D
/** Copyright: Copyright (c) 2016-2018 Andrey Penechko. License: $(WEB boost.org/LICENSE_1_0.txt, Boost License 1.0). Authors: Andrey Penechko. */ module voxelman.session.components; import cbor : ignore; import netlib : SessionId; import datadriven; import voxelman.math; import voxelman.core.config; import voxelman.world.storage; void registerSessionComponents(EntityManager* eman) { eman.registerComponent!ClientPosition(); eman.registerComponent!LoggedInFlag(); eman.registerComponent!SpawnedFlag(); eman.registerComponent!ClientSettings(); eman.registerComponent!ClientSessionInfo(); } @Component("session.SpawnedFlag", Replication.none) struct SpawnedFlag {} @Component("session.LoggedInFlag", Replication.none) struct LoggedInFlag {} @Component("session.ClientPosition", Replication.toDb) struct ClientPosition { ClientDimPos dimPos; DimensionId dimension; /// Used to reject wrong positions from client. /// Client sends positions updates with latest known key and server only accepts /// positions matching this key. /// After dimension change key is incremented. @ignore ubyte positionKey; ChunkWorldPos chunk() { ChunkWorldPos cwp = BlockWorldPos(dimPos.pos, dimension); return cwp; } } @Component("session.ClientSettings", Replication.toDb) struct ClientSettings { int viewRadius = DEFAULT_VIEW_RADIUS; } @Component("session.ClientSessionInfo", Replication.none) struct ClientSessionInfo { string name; SessionId sessionId; }
D
# FIXED utils/ustdlib.obj: C:/ti/tirex-content/TivaWare_C_Series-2.1.3.156/utils/ustdlib.c utils/ustdlib.obj: C:/ti/ccsv7/tools/compiler/ti-cgt-arm_16.9.0.LTS/include/stdint.h utils/ustdlib.obj: C:/ti/tirex-content/TivaWare_C_Series-2.1.3.156/driverlib/debug.h utils/ustdlib.obj: C:/ti/tirex-content/TivaWare_C_Series-2.1.3.156/utils/ustdlib.h utils/ustdlib.obj: C:/ti/ccsv7/tools/compiler/ti-cgt-arm_16.9.0.LTS/include/stdarg.h utils/ustdlib.obj: C:/ti/ccsv7/tools/compiler/ti-cgt-arm_16.9.0.LTS/include/time.h utils/ustdlib.obj: C:/ti/ccsv7/tools/compiler/ti-cgt-arm_16.9.0.LTS/include/linkage.h utils/ustdlib.obj: C:/ti/ccsv7/tools/compiler/ti-cgt-arm_16.9.0.LTS/include/abi_prefix.h C:/ti/tirex-content/TivaWare_C_Series-2.1.3.156/utils/ustdlib.c: C:/ti/ccsv7/tools/compiler/ti-cgt-arm_16.9.0.LTS/include/stdint.h: C:/ti/tirex-content/TivaWare_C_Series-2.1.3.156/driverlib/debug.h: C:/ti/tirex-content/TivaWare_C_Series-2.1.3.156/utils/ustdlib.h: C:/ti/ccsv7/tools/compiler/ti-cgt-arm_16.9.0.LTS/include/stdarg.h: C:/ti/ccsv7/tools/compiler/ti-cgt-arm_16.9.0.LTS/include/time.h: C:/ti/ccsv7/tools/compiler/ti-cgt-arm_16.9.0.LTS/include/linkage.h: C:/ti/ccsv7/tools/compiler/ti-cgt-arm_16.9.0.LTS/include/abi_prefix.h:
D
/* Copyright (c) 2017-2018 Timur Gafarov Boost Software License - Version 1.0 - August 17th, 2003 Permission is hereby granted, free of charge, to any person or organization obtaining a copy of the software and accompanying documentation covered by this license (the "Software") to use, reproduce, display, distribute, execute, and transmit the Software, and to prepare derivative works of the Software, and to permit third-parties to whom the Software is furnished to do so, all subject to the following: The copyright notices in the Software and this entire statement, including the above license grant, this restriction and the following disclaimer, must be included in all copies of the Software, in whole or in part, and all derivative works of the Software, unless such copies or derivative works are solely in the form of machine-executable object code generated by a source language processor. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ module dagon.graphics.shaders.sky; import std.stdio; import std.math; import std.conv; import dlib.core.memory; import dlib.math.vector; import dlib.math.matrix; import dlib.image.color; import dagon.core.libs; import dagon.core.ownership; import dagon.graphics.rc; import dagon.graphics.shader; class SkyShader: Shader { string vs = import("Sky.vs"); string fs = import("Sky.fs"); this(Owner o) { auto myProgram = New!ShaderProgram(vs, fs, this); super(myProgram, o); } override void bind(RenderingContext* rc) { // Matrices setParameter("modelViewMatrix", rc.modelViewMatrix); setParameter("projectionMatrix", rc.projectionMatrix); setParameter("normalMatrix", rc.normalMatrix); setParameter("viewMatrix", rc.viewMatrix); setParameter("invViewMatrix", rc.invViewMatrix); setParameter("prevModelViewProjMatrix", rc.prevModelViewProjMatrix); setParameter("blurModelViewProjMatrix", rc.blurModelViewProjMatrix); // Environment setParameter("sunDirection", rc.environment.sunDirection); setParameter("sunColor", rc.environment.sunColor); setParameter("sunEnergy", rc.environment.sunEnergy); if (rc.environment.environmentMap) { glActiveTexture(GL_TEXTURE0); rc.environment.environmentMap.bind(); setParameter("envTexture", 0); setParameterSubroutine("environment", ShaderType.Fragment, "environmentTexture"); } else { setParameter("skyZenithColor", rc.environment.skyZenithColor); setParameter("skyHorizonColor", rc.environment.skyHorizonColor); setParameter("groundColor", rc.environment.groundColor); setParameter("skyEnergy", rc.environment.skyEnergy); setParameter("groundEnergy", rc.environment.groundEnergy); setParameterSubroutine("environment", ShaderType.Fragment, "environmentSky"); } setParameter("showSun", rc.environment.showSun); setParameter("showSunHalo", rc.environment.showSunHalo); setParameter("sunSize", rc.environment.sunSize); setParameter("sunScattering", rc.environment.sunScattering); super.bind(rc); } override void unbind(RenderingContext* rc) { super.unbind(rc); } }
D
/// Copyright: Copyright (c) 2017-2019 Andrey Penechko. /// License: $(WEB boost.org/LICENSE_1_0.txt, Boost License 1.0). /// Authors: Andrey Penechko. module fe.ast.stmt.block_stmt; import all; @(AstType.stmt_block) struct BlockStmtNode { mixin AstNodeData!(AstType.stmt_block, AstFlags.isStatement, AstNodeState.name_register_self_done); /// Each node can be expression, declaration or expression AstNodes statements; } void post_clone_block(BlockStmtNode* node, ref CloneState state) { state.fixAstNodes(node.statements); } void name_register_nested_block(BlockStmtNode* node, ref NameRegisterState state) { node.state = AstNodeState.name_register_nested; require_name_register(node.statements, state); node.state = AstNodeState.name_register_nested_done; } void name_resolve_block(BlockStmtNode* node, ref NameResolveState state) { node.state = AstNodeState.name_resolve; require_name_resolve(node.statements, state); node.state = AstNodeState.name_resolve_done; } void type_check_block(BlockStmtNode* node, ref TypeCheckState state) { node.state = AstNodeState.type_check; require_type_check(node.statements, state); node.state = AstNodeState.type_check_done; } void ir_gen_block(ref IrGenState gen, IrIndex curBlock, ref IrLabel nextStmt, BlockStmtNode* b) { genBlock(gen, b.as!AstNode(gen.context), b.statements, curBlock, nextStmt); }
D
module ircclient.net.client; public import dlangui.core.asyncsocket; import dlangui.core.logger; import dlangui.core.collections; import std.string : empty, format, startsWith; import std.conv : to; import std.utf : toUTF32, toUTF8; interface IRCClientCallback { void onIRCConnect(IRCClient client); void onIRCDisconnect(IRCClient client); void onIRCMessage(IRCClient client, IRCMessage message); void onIRCPing(IRCClient client, string message); void onIRCPrivmsg(IRCClient client, IRCAddress source, string target, string message); void onIRCNotice(IRCClient client, IRCAddress source, string target, string message); } enum IRCCommand : int { UNKNOWN, CHANNEL_TOPIC = 332, CHANNEL_TOPIC_SET_BY = 333, CHANNEL_NAMES_LIST = 353, CHANNEL_NAMES_LIST_END = 366, USER = 1000, PRIVMSG, // :source PRIVMSG <target> :Message NOTICE, // :source NOTICE <target> :Message NICK, PING, // PING :message PONG, // PONG :message QUIT, // :source QUIT :reason JOIN, // :source JOIN :#channel PART, // :source PART #channel :reason MODE, // } IRCCommand findCommandId(string s) { if (s.empty) return IRCCommand.UNKNOWN; if (s[0] >= '0' && s[0] <= '9') { // parse numeric command ID int n = 0; foreach(ch; s) if (ch >= '0' && ch <= '9') n = n * 10 + (ch - '0'); return cast(IRCCommand)n; } switch (s) with(IRCCommand) { case "USER": return USER; case "PRIVMSG": return PRIVMSG; case "NICK": return NICK; case "QUIT": return QUIT; case "PING": return PING; case "PONG": return PONG; case "JOIN": return JOIN; case "PART": return PART; case "NOTICE": return NOTICE; default: return UNKNOWN; } } /// IRC message class IRCMessage { /// full message text string msg; /// optional first parameter of message, starting with : -- e.g. ":holmes.freenode.net" string source; // source of message IRCAddress sourceAddress; // parsed source string command; // command text IRCCommand commandId = IRCCommand.UNKNOWN; // command id string[] params; // all parameters after command string message; // optional message parameter, w/o starting : string target; // for some command types - message target /// parse message text bool parse(string s) { msg = s; if (s.empty) return false; if (s[0] == ':') { // parse source source = parseDelimitedParameter(s); if (source.length < 2) return false; source = source[1 .. $]; sourceAddress = new IRCAddress(source); } command = parseDelimitedParameter(s); if (command.empty) return false; commandId = findCommandId(command); while (!s.empty) { if (s[0] == ':') { params ~= s; message = s[1 .. $]; break; } else { params ~= parseDelimitedParameter(s); } } switch(commandId) with (IRCCommand) { case PRIVMSG: case NOTICE: case JOIN: case PART: if (params.length > 0) target = params[0]; break; case CHANNEL_TOPIC: case CHANNEL_TOPIC_SET_BY: case CHANNEL_NAMES_LIST_END: if (params.length > 1) target = params[1]; break; case CHANNEL_NAMES_LIST: if (params.length > 2 && (params[1] == "=" || params[1] == "@")) target = params[2]; break; default: break; } return true; } } class IRCAddress { string full; string host; string channel; string nick; string username; this() { } this(string s) { full = s; string s1 = parseDelimitedParameter(s, '!'); if (!s.empty) { // VadimLopatin!~Buggins@149.62.27.44 nick = s1; username = s; } else { host = s1; } } @property string longName() { if (!nick.empty) { return nick ~ " (" ~ username ~ ")"; } else { return full; } } } class IRCUser { string nick; int flags; this(string s) { nick = s; } } class UserList { Collection!IRCUser _users; @property size_t length() { return _users.length; } @property IRCUser opIndex(size_t index) { return _users[index]; } void fromList(string userList) { _users.clear(); while(true) { string s = parseDelimitedParameter(userList); if (s.empty) break; IRCUser u = new IRCUser(s); _users.add(u); } } import std.typecons : Tuple; Tuple!(bool, "found", size_t, "index") findUser(string name) { foreach(i; 0.._users.length) { if (_users[i].nick == name) return typeof(return)(true, i); } return typeof(return)(false, 0); } void addUser(string name) { if (findUser(name).found == false) _users.add(new IRCUser(name)); } void removeUser(string name) { auto user = findUser(name); if (user.found) { _users.remove(user.index); } } } class IRCChannel { string name; string topic; string topicSetBy; long topicSetWhen; UserList users; this(string name) { this.name = name; users = new UserList(); } char[] userListBuffer; void setUserList(string userList) { users.fromList(userList); } @property dstring[] userNames() { dstring[] res; for(int i = 0; i < users.length; i++) { res ~= toUTF32(users[i].nick); } return res; } void handleMessage(IRCMessage msg) { switch (msg.commandId) with (IRCCommand) { case CHANNEL_TOPIC: topic = msg.message; break; case CHANNEL_TOPIC_SET_BY: topicSetBy = msg.params.length == 3 ? msg.params[1] : null; break; case CHANNEL_NAMES_LIST: if (userListBuffer.length > 0) userListBuffer ~= " "; userListBuffer ~= msg.message; break; case CHANNEL_NAMES_LIST_END: setUserList(userListBuffer.dup); Log.d("user list for " ~ name ~ " : " ~ userListBuffer); userListBuffer = null; break; case JOIN: users.addUser(msg.sourceAddress.nick); break; case PART: users.removeUser(msg.sourceAddress.nick); break; default: break; } } } /// IRC Client connection implementation class IRCClient : AsyncSocketCallback { protected: AsyncSocket _socket; IRCClientCallback _callback; char[] _readbuf; string _host; ushort _port; string _nick; IRCChannel[string] _channels; void onDataReceived(AsyncSocket socket, ubyte[] data) { _readbuf ~= cast(char[])data; // split by lines int start = 0; for (int i = 0; i + 1 < _readbuf.length; i++) { if (_readbuf[i] == '\r' && _readbuf[i + 1] == '\n') { if (i > start) onMessageText(_readbuf[start .. i].dup); start = i + 2; } } if (start < _readbuf.length) { // has unfinished text _readbuf = _readbuf[start .. $].dup; } else { // end of buffer _readbuf.length = 0; } } void onMessageText(string msgText) { IRCMessage msg = new IRCMessage(); if (msg.parse(msgText)) { onMessage(msg); } else { Log.e("cannot parse IRC message " ~ msgText); } } void onMessage(IRCMessage msg) { Log.d("MSG: " ~ msg.msg); switch (msg.commandId) with (IRCCommand) { case PING: _callback.onIRCPing(this, msg.message); break; case PRIVMSG: _callback.onIRCPrivmsg(this, msg.sourceAddress, msg.target, msg.message); break; case NOTICE: _callback.onIRCNotice(this, msg.sourceAddress, msg.target, msg.message); break; case CHANNEL_TOPIC: case CHANNEL_TOPIC_SET_BY: case CHANNEL_NAMES_LIST: case CHANNEL_NAMES_LIST_END: case JOIN: case PART: if (msg.target.startsWith("#")) { auto channel = channelByName(msg.target, true); channel.handleMessage(msg); _callback.onIRCMessage(this, msg); } break; default: _callback.onIRCMessage(this, msg); break; } } void onConnect(AsyncSocket socket) { Log.e("onConnect"); _readbuf.length = 0; _callback.onIRCConnect(this); } void onDisconnect(AsyncSocket socket) { Log.e("onDisconnect"); _readbuf.length = 0; _callback.onIRCDisconnect(this); } void onError(AsyncSocket socket, SocketError error, string msg) { } public: this() { } ~this() { if (_socket) destroy(_socket); } @property SocketState state() { return _socket.state; } IRCChannel removeChannel(string name) { if (auto p = name in _channels) { _channels.remove(name); return *p; } return null; } IRCChannel channelByName(string name, bool createIfNotExist = false) { if (auto p = name in _channels) { return *p; } if (!createIfNotExist) return null; IRCChannel res = new IRCChannel(name); _channels[name] = res; return res; } @property string host() { return _host; } @property ushort port() { return _port; } @property string hostPort() { return "%s:%d".format(_host, _port); } /// set socket to use @property void socket(AsyncSocket sock) { _socket = sock; } @property void callback(IRCClientCallback callback) { _callback = callback; } void connect(string host, ushort port) { _host = host; _port = port; _socket.connect(host, port); } void sendMessage(string msg) { Log.d("CMD: " ~ msg); _socket.send(cast(ubyte[])(msg ~ "\r\n")); } void pong(string msg) { sendMessage("PONG :" ~ msg); } void privMsg(string destination, string message) { sendMessage("PRIVMSG " ~ destination ~ " :" ~ message); _callback.onIRCPrivmsg(this, new IRCAddress(_nick ~ "!~username@host"), destination, message); } void disconnect() { _socket.disconnect(); } @property string nick() { return _nick; } @property void nick(string nickName) { if (_nick.empty) _nick = nickName; sendMessage("NICK " ~ nickName); } void join(string channel) { sendMessage("JOIN " ~ channel); } void part(string channel, string message) { sendMessage("PART " ~ channel ~ (message.empty ? "" : ":" ~ message)); } void quit(string message) { sendMessage("QUIT " ~ (message.empty ? "" : ":" ~ message)); } } /// utility function to get first space delimited parameter from string string parseDelimitedParameter(ref string s, char delimiter = ' ') { string res; int i = 0; // parse source for (; i < s.length; i++) { if (s[i] == delimiter) break; } if (i > 0) { res = s[0 .. i]; } i++; s = i < s.length ? s[i .. $] : null; return res; }
D
// Written in the D programming language /* Copyright (C) 2004-2011 Christopher E. Miller Boost Software License - Version 1.0 - August 17th, 2003 Permission is hereby granted, free of charge, to any person or organization obtaining a copy of the software and accompanying documentation covered by this license (the "Software") to use, reproduce, display, distribute, execute, and transmit the Software, and to prepare derivative works of the Software, and to permit third-parties to whom the Software is furnished to do so, all subject to the following: The copyright notices in the Software and this entire statement, including the above license grant, this restriction and the following disclaimer, must be included in all copies of the Software, in whole or in part, and all derivative works of the Software, unless such copies or derivative works are solely in the form of machine-executable object code generated by a source language processor. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. socket.d 1.4 Jan 2011 Thanks to Benjamin Herr for his assistance. */ /** * Example: See $(SAMPLESRC listener.d) and $(SAMPLESRC htmlget.d) * License: <a href="http://www.boost.org/LICENSE_1_0.txt">Boost License 1.0</a>. * Authors: Christopher E. Miller, $(WEB klickverbot.at, David Nadlinger), * $(WEB thecybershadow.net, Vladimir Panteleev) * Source: $(PHOBOSSRC std/_socket.d) * Macros: * WIKI=Phobos/StdSocket */ module std.socket; import core.stdc.stdint, std.string, std.c.string, std.c.stdlib, std.conv; import core.stdc.config; import core.time : dur, Duration; import std.algorithm : max; import std.exception : assumeUnique, enforce, collectException; version(Windows) { pragma (lib, "ws2_32.lib"); pragma (lib, "wsock32.lib"); private import std.c.windows.windows, std.c.windows.winsock, std.windows.syserror; private alias std.c.windows.winsock.timeval _ctimeval; private alias std.c.windows.winsock.linger _clinger; enum socket_t : SOCKET { INVALID_SOCKET }; private const int _SOCKET_ERROR = SOCKET_ERROR; private int _lasterr() { return WSAGetLastError(); } } else version(Posix) { version(linux) import std.c.linux.socket : AF_IPX, AF_APPLETALK, SOCK_RDM, IPPROTO_IGMP, IPPROTO_GGP, IPPROTO_PUP, IPPROTO_IDP, SD_RECEIVE, SD_SEND, SD_BOTH, MSG_NOSIGNAL, INADDR_NONE, TCP_KEEPIDLE, TCP_KEEPINTVL; else version(OSX) import std.c.osx.socket : AF_IPX, AF_APPLETALK, SOCK_RDM, IPPROTO_IGMP, IPPROTO_GGP, IPPROTO_PUP, IPPROTO_IDP, SD_RECEIVE, SD_SEND, SD_BOTH, INADDR_NONE; else version(FreeBSD) { import core.sys.posix.sys.socket; import core.sys.posix.sys.select; import std.c.freebsd.socket; private enum SD_RECEIVE = SHUT_RD; private enum SD_SEND = SHUT_WR; private enum SD_BOTH = SHUT_RDWR; } else static assert(false); import core.sys.posix.netdb; private import core.sys.posix.fcntl; private import core.sys.posix.unistd; private import core.sys.posix.arpa.inet; private import core.sys.posix.netinet.tcp; private import core.sys.posix.netinet.in_; private import core.sys.posix.sys.time; //private import core.sys.posix.sys.select; private import core.sys.posix.sys.socket; private alias core.sys.posix.sys.time.timeval _ctimeval; private alias core.sys.posix.sys.socket.linger _clinger; private import core.stdc.errno; enum socket_t : int32_t { init = -1 } private const int _SOCKET_ERROR = -1; private int _lasterr() { return errno; } } else { static assert(0); // No socket support yet. } version(unittest) { static assert(is(uint32_t == uint)); static assert(is(uint16_t == ushort)); private import std.stdio : writefln; // Print a message on exception instead of failing the unittest. private void softUnittest(void delegate() test, int line = __LINE__) { try test(); catch (Throwable e) { writefln(" --- std.socket(%d) test fails depending on environment ---", line); writefln(" (%s)", e); } } } /// Base exception thrown by $(D std.socket). class SocketException: Exception { /** * $(RED Deprecated. It will be removed in January 2013. * Please use $(LREF SocketOSException) instead.) * * Provided for compatibility with older code using $(D SocketException). */ deprecated @property int errorCode() const { auto osException = cast(SocketOSException)this; if (osException) return osException.errorCode; else return 0; } this(string msg) { super(msg); } } private string formatSocketError(int err) { version(Posix) { char[80] buf; const(char)* cs; version (linux) { cs = strerror_r(err, buf.ptr, buf.length); } else version (OSX) { auto errs = strerror_r(err, buf.ptr, buf.length); if (errs == 0) cs = buf.ptr; else return "Socket error " ~ to!string(err); } else version (FreeBSD) { auto errs = strerror_r(err, buf.ptr, buf.length); if (errs == 0) cs = buf.ptr; else return "Socket error " ~ to!string(err); } else static assert(0); auto len = strlen(cs); if(cs[len - 1] == '\n') len--; if(cs[len - 1] == '\r') len--; return cs[0 .. len].idup; } else version(Windows) { return sysErrorString(err); } else return "Socket error " ~ to!string(err); } /// Retrieve the error message for the most recently encountered network error. @property string lastSocketError() { return formatSocketError(_lasterr()); } /// Socket exceptions representing network errors reported by the operating /// system. class SocketOSException: SocketException { int errorCode; /// Platform-specific error code. this(string msg, int err = _lasterr(), string function(int) errorFormatter = &formatSocketError) { errorCode = err; if (msg.length) super(msg ~ ": " ~ errorFormatter(err)); else super(errorFormatter(err)); } } /// Socket exceptions representing invalid parameters specified by user code. class SocketParameterException: SocketException { this(string msg) { super(msg); } } /// Socket exceptions representing attempts to use network capabilities not /// available on the current system. class SocketFeatureException: SocketException { this(string msg) { super(msg); } } /// Return $(D true) if the last socket operation failed because the socket /// was in non-blocking mode and the operation would have blocked. bool wouldHaveBlocked() { version(Windows) return _lasterr() == WSAEWOULDBLOCK; else version(Posix) return _lasterr() == EAGAIN; else static assert(0); } private __gshared typeof(&getnameinfo) getnameinfoPointer; private __gshared typeof(&getaddrinfo) getaddrinfoPointer; private __gshared typeof(&freeaddrinfo) freeaddrinfoPointer; shared static this() { version(Windows) { WSADATA wd; // Winsock will still load if an older version is present. // The version is just a request. int val; val = WSAStartup(0x2020, &wd); if(val) // Request Winsock 2.2 for IPv6. throw new SocketOSException("Unable to initialize socket library", val); // These functions may not be present on older Windows versions. // See the comment in InternetAddress.toHostNameString() for details. auto ws2Lib = GetModuleHandleA("ws2_32.dll"); if (ws2Lib) { getnameinfoPointer = cast(typeof(getnameinfoPointer)) GetProcAddress(ws2Lib, "getnameinfo"); getaddrinfoPointer = cast(typeof(getaddrinfoPointer)) GetProcAddress(ws2Lib, "getaddrinfo"); freeaddrinfoPointer = cast(typeof(freeaddrinfoPointer)) GetProcAddress(ws2Lib, "freeaddrinfo"); } } else version(Posix) { getnameinfoPointer = &getnameinfo; getaddrinfoPointer = &getaddrinfo; freeaddrinfoPointer = &freeaddrinfo; } } shared static ~this() { version(Windows) { WSACleanup(); } } /** * The communication domain used to resolve an address. */ enum AddressFamily: int { UNSPEC = AF_UNSPEC, /// Unspecified address family UNIX = AF_UNIX, /// Local communication INET = AF_INET, /// Internet Protocol version 4 IPX = AF_IPX, /// Novell IPX APPLETALK = AF_APPLETALK, /// AppleTalk INET6 = AF_INET6, /// Internet Protocol version 6 } /** * Communication semantics */ enum SocketType: int { STREAM = SOCK_STREAM, /// Sequenced, reliable, two-way communication-based byte streams DGRAM = SOCK_DGRAM, /// Connectionless, unreliable datagrams with a fixed maximum length; data may be lost or arrive out of order RAW = SOCK_RAW, /// Raw protocol access RDM = SOCK_RDM, /// Reliably-delivered message datagrams SEQPACKET = SOCK_SEQPACKET, /// Sequenced, reliable, two-way connection-based datagrams with a fixed maximum length } /** * Protocol */ enum ProtocolType: int { IP = IPPROTO_IP, /// Internet Protocol version 4 ICMP = IPPROTO_ICMP, /// Internet Control Message Protocol IGMP = IPPROTO_IGMP, /// Internet Group Management Protocol GGP = IPPROTO_GGP, /// Gateway to Gateway Protocol TCP = IPPROTO_TCP, /// Transmission Control Protocol PUP = IPPROTO_PUP, /// PARC Universal Packet Protocol UDP = IPPROTO_UDP, /// User Datagram Protocol IDP = IPPROTO_IDP, /// Xerox NS protocol RAW = IPPROTO_RAW, /// Raw IP packets IPV6 = IPPROTO_IPV6, /// Internet Protocol version 6 } /** * $(D Protocol) is a class for retrieving protocol information. * * Example: * --- * auto proto = new Protocol; * writeln("About protocol TCP:"); * if (proto.getProtocolByType(ProtocolType.TCP)) * { * writefln(" Name: %s", proto.name); * foreach(string s; proto.aliases) * writefln(" Alias: %s", s); * } * else * writeln(" No information found"); * --- */ class Protocol { /// These members are populated when one of the following functions are called successfully: ProtocolType type; string name; /// ditto string[] aliases; /// ditto void populate(protoent* proto) { type = cast(ProtocolType)proto.p_proto; name = to!string(proto.p_name); int i; for(i = 0;; i++) { if(!proto.p_aliases[i]) break; } if(i) { aliases = new string[i]; for(i = 0; i != aliases.length; i++) { aliases[i] = to!string(proto.p_aliases[i]); } } else { aliases = null; } } /** Returns: false on failure */ bool getProtocolByName(in char[] name) { protoent* proto; proto = getprotobyname(toStringz(name)); if(!proto) return false; populate(proto); return true; } /** Returns: false on failure */ // Same as getprotobynumber(). bool getProtocolByType(ProtocolType type) { protoent* proto; proto = getprotobynumber(type); if(!proto) return false; populate(proto); return true; } } unittest { softUnittest({ Protocol proto = new Protocol; assert(proto.getProtocolByType(ProtocolType.TCP)); //writeln("About protocol TCP:"); //writefln("\tName: %s", proto.name); // foreach(string s; proto.aliases) // { // writefln("\tAlias: %s", s); // } assert(proto.name == "tcp"); assert(proto.aliases.length == 1 && proto.aliases[0] == "TCP"); }); } /** * $(D Service) is a class for retrieving service information. * * Example: * --- * auto serv = new Service; * writeln("About service epmap:"); * if (serv.getServiceByName("epmap", "tcp")) * { * writefln(" Service: %s", serv.name); * writefln(" Port: %d", serv.port); * writefln(" Protocol: %s", serv.protocolName); * foreach (string s; serv.aliases) * writefln(" Alias: %s", s); * } * else * writefln(" No service for epmap."); * --- */ class Service { /// These members are populated when one of the following functions are called successfully: string name; string[] aliases; /// ditto ushort port; /// ditto string protocolName; /// ditto void populate(servent* serv) { name = to!string(serv.s_name); port = ntohs(cast(ushort)serv.s_port); protocolName = to!string(serv.s_proto); int i; for(i = 0;; i++) { if(!serv.s_aliases[i]) break; } if(i) { aliases = new string[i]; for(i = 0; i != aliases.length; i++) { aliases[i] = to!string(serv.s_aliases[i]); } } else { aliases = null; } } /** * If a protocol name is omitted, any protocol will be matched. * Returns: false on failure. */ bool getServiceByName(in char[] name, in char[] protocolName = null) { servent* serv; serv = getservbyname(toStringz(name), protocolName !is null ? toStringz(protocolName) : null); if(!serv) return false; populate(serv); return true; } /// ditto bool getServiceByPort(ushort port, in char[] protocolName = null) { servent* serv; serv = getservbyport(port, protocolName !is null ? toStringz(protocolName) : null); if(!serv) return false; populate(serv); return true; } } unittest { softUnittest({ Service serv = new Service; if(serv.getServiceByName("epmap", "tcp")) { // writefln("About service epmap:"); // writefln("\tService: %s", serv.name); // writefln("\tPort: %d", serv.port); // writefln("\tProtocol: %s", serv.protocolName); // foreach(string s; serv.aliases) // { // writefln("\tAlias: %s", s); // } // For reasons unknown this is loc-srv on Wine and epmap on Windows assert(serv.name == "loc-srv" || serv.name == "epmap", serv.name); assert(serv.port == 135); assert(serv.protocolName == "tcp"); } else { writefln("No service for epmap."); } }); } /** * Class for exceptions thrown from an $(D InternetHost). */ class HostException: SocketOSException { this(string msg, int err = _lasterr()) { super(msg, err); } } /** * $(D InternetHost) is a class for resolving IPv4 addresses. * * Consider using $(D getAddress), $(D parseAddress) and $(D Address) methods * instead of using this class directly. * * Example: * --- * auto ih = new InternetHost; * * // Forward lookup * writeln("About www.digitalmars.com:"); * if (ih.getHostByName("www.digitalmars.com")) * { * writefln(" Name: %s", ih.name); * auto ip = InternetAddress.addrToString(ih.addrList[0]); * writefln(" IP address: %s", ip); * foreach (string s; ih.aliases) * writefln(" Alias: %s", s); * writeln("---"); * * // Reverse lookup * writefln("About IP %s:", ip); * if (ih.getHostByAddr(ih.addrList[0])) * { * writefln(" Name: %s", ih.name); * foreach (string s; ih.aliases) * writefln(" Alias: %s", s); * } * else * writeln(" Reverse lookup failed"); * } * else * writeln(" Can't resolve www.digitalmars.com"); * --- */ class InternetHost { /// These members are populated when one of the following functions are called successfully: string name; string[] aliases; /// ditto uint[] addrList; /// ditto void validHostent(hostent* he) { if(he.h_addrtype != cast(int)AddressFamily.INET || he.h_length != 4) throw new HostException("Address family mismatch"); } void populate(hostent* he) { int i; char* p; name = to!string(he.h_name); for(i = 0;; i++) { p = he.h_aliases[i]; if(!p) break; } if(i) { aliases = new string[i]; for(i = 0; i != aliases.length; i++) { aliases[i] = to!string(he.h_aliases[i]); } } else { aliases = null; } for(i = 0;; i++) { p = he.h_addr_list[i]; if(!p) break; } if(i) { addrList = new uint[i]; for(i = 0; i != addrList.length; i++) { addrList[i] = ntohl(*(cast(uint*)he.h_addr_list[i])); } } else { addrList = null; } } private bool getHostNoSync(string opMixin, T)(T param) { mixin(opMixin); if (!he) return false; validHostent(he); populate(he); return true; } version(Windows) alias getHostNoSync getHost; else { // posix systems use global state for return value, so we // must synchronize across all threads private bool getHost(string opMixin, T)(T param) { synchronized(this.classinfo) return getHostNoSync!(opMixin, T)(param); } } /** * Resolve host name. * Returns: false if unable to resolve. */ bool getHostByName(in char[] name) { static if (is(typeof(gethostbyname_r))) { return getHostNoSync!q{ hostent he_v; hostent* he; ubyte[256] buffer_v = void; auto buffer = buffer_v[]; auto param_z = std.string.toStringz(param); while (true) { he = &he_v; int errno; if (gethostbyname_r(param_z, he, buffer.ptr, buffer.length, &he, &errno) == ERANGE) buffer.length = buffer.length * 2; else break; } }(name); } else { return getHost!q{ auto he = gethostbyname(toStringz(param)); }(name); } } /** * Resolve IPv4 address number. * * Params: * addr = The IPv4 address to resolve, in host byte order. * Returns: * false if unable to resolve. */ bool getHostByAddr(uint addr) { return getHost!q{ auto x = htonl(param); auto he = gethostbyaddr(&x, 4, cast(int)AddressFamily.INET); }(addr); } /** * Same as previous, but addr is an IPv4 address string in the * dotted-decimal form $(I a.b.c.d). * Returns: false if unable to resolve. */ bool getHostByAddr(in char[] addr) { return getHost!q{ auto x = inet_addr(std.string.toStringz(param)); enforce(x != INADDR_NONE, new SocketParameterException("Invalid IPv4 address")); auto he = gethostbyaddr(&x, 4, cast(int)AddressFamily.INET); }(addr); } } unittest { InternetHost ih = new InternetHost; ih.getHostByAddr(0x7F_00_00_01); assert(ih.addrList[0] == 0x7F_00_00_01); ih.getHostByAddr("127.0.0.1"); assert(ih.addrList[0] == 0x7F_00_00_01); softUnittest({ if (!ih.getHostByName("www.digitalmars.com")) return; // don't fail if not connected to internet //writefln("addrList.length = %d", ih.addrList.length); assert(ih.addrList.length); InternetAddress ia = new InternetAddress(ih.addrList[0], InternetAddress.PORT_ANY); assert(ih.name == "www.digitalmars.com" || ih.name == "digitalmars.com", ih.name); // writefln("IP address = %s", ia.toAddrString()); // writefln("name = %s", ih.name); // foreach(int i, string s; ih.aliases) // { // writefln("aliases[%d] = %s", i, s); // } // writefln("---"); //assert(ih.getHostByAddr(ih.addrList[0])); // writefln("name = %s", ih.name); // foreach(int i, string s; ih.aliases) // { // writefln("aliases[%d] = %s", i, s); // } }); } /// Holds information about a socket _address retrieved by $(D getAddressInfo). struct AddressInfo { AddressFamily family; /// Address _family SocketType type; /// Socket _type ProtocolType protocol; /// Protocol Address address; /// Socket _address string canonicalName; /// Canonical name, when $(D AddressInfoFlags.CANONNAME) is used. } // A subset of flags supported on all platforms with getaddrinfo. /// Specifies option flags for $(D getAddressInfo). enum AddressInfoFlags: int { /// The resulting addresses will be used in a call to $(D Socket.bind). PASSIVE = AI_PASSIVE, /// The canonical name is returned in $(D canonicalName) member in the first $(D AddressInfo). CANONNAME = AI_CANONNAME, /// The $(D node) parameter passed to $(D getAddressInfo) must be a numeric string. /// This will suppress any potentially lengthy network host address lookups. NUMERICHOST = AI_NUMERICHOST, } /// On POSIX, getaddrinfo uses its own error codes, and thus has its own /// formatting function. private string formatGaiError(int err) { version(Windows) { return sysErrorString(err); } else { synchronized return to!string(gai_strerror(err)); } } /** * Provides _protocol-independent translation from host names to socket * addresses. If advanced functionality is not required, consider using * $(D getAddress) for compatibility with older systems. * * Returns: Array with one $(D AddressInfo) per socket address. * * Throws: $(D SocketOSException) on failure, or $(D SocketFeatureException) * if this functionality is not available on the current system. * * Params: * node = string containing host name or numeric address * options = optional additional parameters, identified by type: * $(UL $(LI $(D string) - service name or port number) * $(LI $(D AddressInfoFlags) - option flags) * $(LI $(D AddressFamily) - address family to filter by) * $(LI $(D SocketType) - socket type to filter by) * $(LI $(D ProtocolType) - protocol to filter by)) * * Example: * --- * // Roundtrip DNS resolution * auto results = getAddressInfo("www.digitalmars.com"); * assert(results[0].address.toHostNameString() == * "digitalmars.com"); * * // Canonical name * results = getAddressInfo("www.digitalmars.com", * AddressInfoFlags.CANONNAME); * assert(results[0].canonicalName == "digitalmars.com"); * * // IPv6 resolution * results = getAddressInfo("ipv6.google.com"); * assert(results[0].family == AddressFamily.INET6); * * // Multihomed resolution * results = getAddressInfo("google.com"); * assert(results.length > 1); * * // Parsing IPv4 * results = getAddressInfo("127.0.0.1", * AddressInfoFlags.NUMERICHOST); * assert(results.length && results[0].family == * AddressFamily.INET); * * // Parsing IPv6 * results = getAddressInfo("::1", * AddressInfoFlags.NUMERICHOST); * assert(results.length && results[0].family == * AddressFamily.INET6); * --- */ AddressInfo[] getAddressInfo(T...)(in char[] node, T options) { const(char)[] service = null; addrinfo hints; hints.ai_family = AF_UNSPEC; foreach (option; options) { static if (is(typeof(option) : const(char)[])) service = option; else static if (is(typeof(option) == AddressInfoFlags)) hints.ai_flags |= option; else static if (is(typeof(option) == AddressFamily)) hints.ai_family = option; else static if (is(typeof(option) == SocketType)) hints.ai_socktype = option; else static if (is(typeof(option) == ProtocolType)) hints.ai_protocol = option; else static assert(0, "Unknown getAddressInfo option type: " ~ typeof(option).stringof); } return getAddressInfoImpl(node, service, &hints); } private AddressInfo[] getAddressInfoImpl(in char[] node, in char[] service, addrinfo* hints) { if (getaddrinfoPointer && freeaddrinfoPointer) { addrinfo* ai_res; int ret = getaddrinfoPointer( node is null ? null : std.string.toStringz(node), service is null ? null : std.string.toStringz(service), hints, &ai_res); scope(exit) if (ai_res) freeaddrinfoPointer(ai_res); enforce(ret == 0, new SocketOSException("getaddrinfo error", ret, &formatGaiError)); AddressInfo[] result; // Use const to force UnknownAddressReference to copy the sockaddr. for (const(addrinfo)* ai = ai_res; ai; ai = ai.ai_next) result ~= AddressInfo( cast(AddressFamily) ai.ai_family, cast(SocketType ) ai.ai_socktype, cast(ProtocolType ) ai.ai_protocol, new UnknownAddressReference(ai.ai_addr, cast(socklen_t) ai.ai_addrlen), ai.ai_canonname ? to!string(ai.ai_canonname) : null); assert(result.length > 0); return result; } throw new SocketFeatureException("Address info lookup is not available " ~ "on this system."); } unittest { softUnittest({ if (getaddrinfoPointer) { // Roundtrip DNS resolution auto results = getAddressInfo("www.digitalmars.com"); assert(results[0].address.toHostNameString() == "digitalmars.com"); // Canonical name results = getAddressInfo("www.digitalmars.com", AddressInfoFlags.CANONNAME); assert(results[0].canonicalName == "digitalmars.com"); // IPv6 resolution //results = getAddressInfo("ipv6.google.com"); //assert(results[0].family == AddressFamily.INET6); // Multihomed resolution //results = getAddressInfo("google.com"); //assert(results.length > 1); // Parsing IPv4 results = getAddressInfo("127.0.0.1", AddressInfoFlags.NUMERICHOST); assert(results.length && results[0].family == AddressFamily.INET); // Parsing IPv6 results = getAddressInfo("::1", AddressInfoFlags.NUMERICHOST); assert(results.length && results[0].family == AddressFamily.INET6); } }); } private ushort serviceToPort(in char[] service) { if (service == "") return InternetAddress.PORT_ANY; else if (isNumeric(service)) return to!ushort(service); else { auto s = new Service(); s.getServiceByName(service); return s.port; } } /** * Provides _protocol-independent translation from host names to socket * addresses. Uses $(D getAddressInfo) if the current system supports it, * and $(D InternetHost) otherwise. * * Returns: Array with one $(D Address) instance per socket address. * * Throws: $(D SocketOSException) on failure. * * Example: * --- * writeln("Resolving www.digitalmars.com:"); * try * { * auto addresses = getAddress("www.digitalmars.com"); * foreach (address; addresses) * writefln(" IP: %s", address.toAddrString()); * } * catch (SocketException e) * writefln(" Lookup failed: %s", e.msg); * --- */ Address[] getAddress(in char[] hostname, in char[] service = null) { if (getaddrinfoPointer && freeaddrinfoPointer) { // use getAddressInfo Address[] results; auto infos = getAddressInfo(hostname, service); foreach (ref info; infos) results ~= info.address; return results; } else return getAddress(hostname, serviceToPort(service)); } /// ditto Address[] getAddress(in char[] hostname, ushort port) { if (getaddrinfoPointer && freeaddrinfoPointer) return getAddress(hostname, to!string(port)); else { // use getHostByName auto ih = new InternetHost; if (!ih.getHostByName(hostname)) throw new AddressException( text("Unable to resolve host '", hostname, "'")); Address[] results; foreach (uint addr; ih.addrList) results ~= new InternetAddress(addr, port); return results; } } unittest { softUnittest({ auto addresses = getAddress("63.105.9.61"); assert(addresses.length && addresses[0].toAddrString() == "63.105.9.61"); if (getaddrinfoPointer) { // test via gethostbyname auto getaddrinfoPointerBackup = getaddrinfoPointer; getaddrinfoPointer = null; scope(exit) getaddrinfoPointer = getaddrinfoPointerBackup; addresses = getAddress("63.105.9.61"); assert(addresses.length && addresses[0].toAddrString() == "63.105.9.61"); } }); } /** * Provides _protocol-independent parsing of network addresses. Does not * attempt name resolution. Uses $(D getAddressInfo) with * $(D AddressInfoFlags.NUMERICHOST) if the current system supports it, and * $(D InternetAddress) otherwise. * * Returns: An $(D Address) instance representing specified address. * * Throws: $(D SocketException) on failure. * * Example: * --- * writeln("Enter IP address:"); * string ip = readln().chomp(); * try * { * Address address = parseAddress(ip); * writefln("Looking up reverse of %s:", * address.toAddrString()); * try * { * string reverse = address.toHostNameString()); * if (reverse) * writefln(" Reverse name: %s", reverse); * else * writeln(" Reverse hostname not found."); * } * catch (SocketException e) * writefln(" Lookup error: %s", e.msg); * } * catch (SocketException e) * { * writefln(" %s is not a valid IP address: %s", * ip, e.msg); * } * --- */ Address parseAddress(in char[] hostaddr, in char[] service = null) { if (getaddrinfoPointer && freeaddrinfoPointer) return getAddressInfo(hostaddr, service, AddressInfoFlags.NUMERICHOST)[0].address; else return parseAddress(hostaddr, serviceToPort(service)); } /// ditto Address parseAddress(in char[] hostaddr, ushort port) { if (getaddrinfoPointer && freeaddrinfoPointer) return parseAddress(hostaddr, to!string(port)); else { auto in4_addr = InternetAddress.parse(hostaddr); enforce(in4_addr != InternetAddress.ADDR_NONE, new SocketParameterException("Invalid IP address")); return new InternetAddress(in4_addr, port); } } unittest { softUnittest({ auto address = parseAddress("63.105.9.61"); assert(address.toAddrString() == "63.105.9.61"); if (getaddrinfoPointer) { // test via inet_addr auto getaddrinfoPointerBackup = getaddrinfoPointer; getaddrinfoPointer = null; scope(exit) getaddrinfoPointer = getaddrinfoPointerBackup; address = parseAddress("63.105.9.61"); assert(address.toAddrString() == "63.105.9.61"); } assert(collectException!SocketException(parseAddress("Invalid IP address"))); }); } /** * Class for exceptions thrown from an $(D Address). */ class AddressException: SocketOSException { this(string msg, int err = _lasterr()) { super(msg, err); } } /** * $(D Address) is an abstract class for representing a socket addresses. * * Example: * --- * writeln("About www.google.com port 80:"); * try * { * Address[] addresses = getAddress("www.google.com", 80); * writefln(" %d addresses found.", addresses.length); * foreach (int i, Address a; addresses) * { * writefln(" Address %d:", i+1); * writefln(" IP address: %s", a.toAddrString()); * writefln(" Hostname: %s", a.toHostNameString()); * writefln(" Port: %s", a.toPortString()); * writefln(" Service name: %s", * a.toServiceNameString()); * } * } * catch (SocketException e) * writefln(" Lookup error: %s", e.msg); * --- */ abstract class Address { /// Returns pointer to underlying $(D sockaddr) structure. sockaddr* name(); abstract const(sockaddr)* name() const; /// ditto /// Returns actual size of underlying $(D sockaddr) structure. abstract socklen_t nameLen() const; /// Family of this address. @property AddressFamily addressFamily() const { return cast(AddressFamily) name().sa_family; } // Common code for toAddrString and toHostNameString private final string toHostString(bool numeric) const { // getnameinfo() is the recommended way to perform a reverse (name) // lookup on both Posix and Windows. However, it is only available // on Windows XP and above, and not included with the WinSock import // libraries shipped with DMD. Thus, we check for getnameinfo at // runtime in the shared module constructor, and use it if it's // available in the base class method. Classes for specific network // families (e.g. InternetHost) override this method and use a // deprecated, albeit commonly-available method when getnameinfo() // is not available. // http://technet.microsoft.com/en-us/library/aa450403.aspx if (getnameinfoPointer) { auto buf = new char[NI_MAXHOST]; auto ret = getnameinfoPointer( name(), nameLen(), buf.ptr, cast(uint)buf.length, null, 0, numeric ? NI_NUMERICHOST : NI_NAMEREQD); if (!numeric) { if (ret==EAI_NONAME) return null; version(Windows) if (ret==WSANO_DATA) return null; } enforce(ret == 0, new AddressException("Could not get " ~ (numeric ? "host address" : "host name"))); return assumeUnique(buf[0 .. strlen(buf.ptr)]); } throw new SocketFeatureException((numeric ? "Host address" : "Host name") ~ " lookup for this address family is not available on this system."); } // Common code for toPortString and toServiceNameString private final string toServiceString(bool numeric) const { // See toHostNameString() for details about getnameinfo(). if (getnameinfoPointer) { auto buf = new char[NI_MAXSERV]; enforce(getnameinfoPointer( name(), nameLen(), null, 0, buf.ptr, cast(uint)buf.length, numeric ? NI_NUMERICSERV : NI_NAMEREQD ) == 0, new AddressException("Could not get " ~ (numeric ? "port number" : "service name"))); return assumeUnique(buf[0 .. strlen(buf.ptr)]); } throw new SocketFeatureException((numeric ? "Port number" : "Service name") ~ " lookup for this address family is not available on this system."); } /** * Attempts to retrieve the host address as a human-readable string. * * Throws: $(D AddressException) on failure, or $(D SocketFeatureException) * if address retrieval for this address family is not available on the * current system. */ string toAddrString() const { return toHostString(true); } /** * Attempts to retrieve the host name as a fully qualified domain name. * * Returns: The FQDN corresponding to this $(D Address), or $(D null) if * the host name did not resolve. * * Throws: $(D AddressException) on error, or $(D SocketFeatureException) * if host name lookup for this address family is not available on the * current system. */ string toHostNameString() const { return toHostString(false); } /** * Attempts to retrieve the numeric port number as a string. * * Throws: $(D AddressException) on failure, or $(D SocketFeatureException) * if port number retrieval for this address family is not available on the * current system. */ string toPortString() const { return toServiceString(true); } /** * Attempts to retrieve the service name as a string. * * Throws: $(D AddressException) on failure, or $(D SocketFeatureException) * if service name lookup for this address family is not available on the * current system. */ string toServiceNameString() const { return toServiceString(false); } /// Human readable string representing this address. override string toString() const { try { string host = toAddrString(); string port = toPortString(); if (host.indexOf(':') >= 0) return "[" ~ host ~ "]:" ~ port; else return host ~ ":" ~ port; } catch (SocketException) return "Unknown"; } } /** * $(D UnknownAddress) encapsulates an unknown socket address. */ class UnknownAddress: Address { protected: sockaddr sa; public: override sockaddr* name() { return &sa; } override const(sockaddr)* name() const { return &sa; } override socklen_t nameLen() const { return cast(socklen_t) sa.sizeof; } } /** * $(D UnknownAddressReference) encapsulates a reference to an arbitrary * socket address. */ class UnknownAddressReference: Address { protected: sockaddr* sa; socklen_t len; public: /// Constructs an $(D Address) with a reference to the specified $(D sockaddr). this(sockaddr* sa, socklen_t len) { this.sa = sa; this.len = len; } /// Constructs an $(D Address) with a copy of the specified $(D sockaddr). this(const(sockaddr)* sa, socklen_t len) { this.sa = cast(sockaddr*) (cast(ubyte*)sa)[0..len].dup.ptr; this.len = len; } override sockaddr* name() { return sa; } override const(sockaddr)* name() const { return sa; } override socklen_t nameLen() const { return cast(socklen_t) len; } } /** * $(D InternetAddress) encapsulates an IPv4 (Internet Protocol version 4) * socket address. * * Consider using $(D getAddress), $(D parseAddress) and $(D Address) methods * instead of using this class directly. */ class InternetAddress: Address { protected: sockaddr_in sin; this() { } public: override sockaddr* name() { return cast(sockaddr*)&sin; } override const(sockaddr)* name() const { return cast(const(sockaddr)*)&sin; } override socklen_t nameLen() const { return cast(socklen_t) sin.sizeof; } enum uint ADDR_ANY = INADDR_ANY; /// Any IPv4 host address. enum uint ADDR_NONE = INADDR_NONE; /// An invalid IPv4 host address. enum ushort PORT_ANY = 0; /// Any IPv4 port number. /// Returns the IPv4 _port number (in host byte order). ushort port() const { return ntohs(sin.sin_port); } /// Returns the IPv4 address number (in host byte order). uint addr() const { return ntohl(sin.sin_addr.s_addr); } /** * Construct a new $(D InternetAddress). * Params: * addr = an IPv4 address string in the dotted-decimal form a.b.c.d, * or a host name which will be resolved using an $(D InternetHost) * object. * port = port number, may be $(D PORT_ANY). */ this(in char[] addr, ushort port) { uint uiaddr = parse(addr); if(ADDR_NONE == uiaddr) { InternetHost ih = new InternetHost; if(!ih.getHostByName(addr)) //throw new AddressException("Invalid internet address"); throw new AddressException( text("Unable to resolve host '", addr, "'")); uiaddr = ih.addrList[0]; } sin.sin_family = AddressFamily.INET; sin.sin_addr.s_addr = htonl(uiaddr); sin.sin_port = htons(port); } /** * Construct a new $(D InternetAddress). * Params: * addr = (optional) an IPv4 address in host byte order, may be $(D ADDR_ANY). * port = port number, may be $(D PORT_ANY). */ this(uint addr, ushort port) { sin.sin_family = AddressFamily.INET; sin.sin_addr.s_addr = htonl(addr); sin.sin_port = htons(port); } /// ditto this(ushort port) { sin.sin_family = AddressFamily.INET; sin.sin_addr.s_addr = ADDR_ANY; sin.sin_port = htons(port); } /// Human readable string representing the IPv4 address in dotted-decimal form. override string toAddrString() const { return to!string(inet_ntoa(sin.sin_addr)); } /// Human readable string representing the IPv4 port. override string toPortString() const { return std.conv.to!string(port()); } /** * Attempts to retrieve the host name as a fully qualified domain name. * * Returns: The FQDN corresponding to this $(D InternetAddress), or * $(D null) if the host name did not resolve. * * Throws: $(D AddressException) on error. */ override string toHostNameString() const { // getnameinfo() is the recommended way to perform a reverse (name) // lookup on both Posix and Windows. However, it is only available // on Windows XP and above, and not included with the WinSock import // libraries shipped with DMD. Thus, we check for getnameinfo at // runtime in the shared module constructor, and fall back to the // deprecated getHostByAddr() if it could not be found. See also: // http://technet.microsoft.com/en-us/library/aa450403.aspx if (getnameinfoPointer) return super.toHostNameString(); else { auto host = new InternetHost(); if (!host.getHostByAddr(ntohl(sin.sin_addr.s_addr))) return null; return host.name; } } /** * Parse an IPv4 address string in the dotted-decimal form $(I a.b.c.d) * and return the number. * Returns: If the string is not a legitimate IPv4 address, * $(D ADDR_NONE) is returned. */ static uint parse(in char[] addr) { return ntohl(inet_addr(std.string.toStringz(addr))); } /** * Convert an IPv4 address number in host byte order to a human readable * string representing the IPv4 address in dotted-decimal form. */ static string addrToString(uint addr) { in_addr sin_addr; sin_addr.s_addr = htonl(addr); return to!string(inet_ntoa(sin_addr)); } } unittest { softUnittest({ const InternetAddress ia = new InternetAddress("63.105.9.61", 80); assert(ia.toString() == "63.105.9.61:80"); }); softUnittest({ // test reverse lookup auto ih = new InternetHost; if (ih.getHostByName("digitalmars.com")) { const ia = new InternetAddress(ih.addrList[0], 80); assert(ia.toHostNameString() == "digitalmars.com"); if (getnameinfoPointer) { // test reverse lookup, via gethostbyaddr auto getnameinfoPointerBackup = getnameinfoPointer; getnameinfoPointer = null; scope(exit) getnameinfoPointer = getnameinfoPointerBackup; assert(ia.toHostNameString() == "digitalmars.com"); } } }); version (SlowTests) softUnittest({ // test failing reverse lookup const InternetAddress ia = new InternetAddress("127.114.111.120", 80); assert(ia.toHostNameString() is null); if (getnameinfoPointer) { // test failing reverse lookup, via gethostbyaddr auto getnameinfoPointerBackup = getnameinfoPointer; getnameinfoPointer = null; scope(exit) getnameinfoPointer = getnameinfoPointerBackup; assert(ia.toHostNameString() is null); } }); } /** * $(D Internet6Address) encapsulates an IPv6 (Internet Protocol version 6) * socket address. * * Consider using $(D getAddress), $(D parseAddress) and $(D Address) methods * instead of using this class directly. */ class Internet6Address: Address { protected: sockaddr_in6 sin6; this() { } public: override sockaddr* name() { return cast(sockaddr*)&sin6; } override const(sockaddr)* name() const { return cast(const(sockaddr)*)&sin6; } override socklen_t nameLen() const { return cast(socklen_t) sin6.sizeof; } /// Any IPv6 host address. static @property ref const(ubyte)[16] ADDR_ANY() { const(ubyte)[16]* addr; static if (is(typeof(IN6ADDR_ANY))) return addr = &IN6ADDR_ANY.s6_addr, *addr; else static if (is(typeof(in6addr_any))) return addr = &in6addr_any.s6_addr, *addr; else static assert(0); } /// Any IPv6 port number. enum ushort PORT_ANY = 0; /// Returns the IPv6 port number. ushort port() const { return ntohs(sin6.sin6_port); } /// Returns the IPv6 address. ubyte[16] addr() const { return sin6.sin6_addr.s6_addr; } /** * Construct a new $(D Internet6Address). * Params: * node = an IPv6 host address string in the form described in RFC 2373, * or a host name which will be resolved using $(D getAddressInfo). * port = (optional) service name or port number. */ this(in char[] node, in char[] service = null) { auto results = getAddressInfo(node, service, AddressFamily.INET6); assert(results.length && results[0].family == AddressFamily.INET6); sin6 = *cast(sockaddr_in6*)results[0].address.name(); } /** * Construct a new $(D Internet6Address). * Params: * addr = an IPv6 host address string in the form described in RFC 2373, * or a host name which will be resolved using $(D getAddressInfo). * port = port number, may be $(D PORT_ANY). */ this(in char[] node, ushort port) { if (port == PORT_ANY) this(node); else this(node, to!string(port)); } /** * Construct a new $(D Internet6Address). * Params: * addr = (optional) an IPv6 host address in host byte order, or $(D ADDR_ANY). * port = port number, may be $(D PORT_ANY). */ this(ubyte[16] addr, ushort port) { sin6.sin6_family = AddressFamily.INET6; sin6.sin6_addr.s6_addr = addr; sin6.sin6_port = htons(port); } /// ditto this(ushort port) { sin6.sin6_family = AddressFamily.INET6; sin6.sin6_addr.s6_addr = ADDR_ANY; sin6.sin6_port = htons(port); } /** * Parse an IPv6 host address string as described in RFC 2373, and return the * address. * Throws: $(D SocketException) on error. */ static ubyte[16] parse(in char[] addr) { // Although we could use inet_pton here, it's only available on Windows // versions starting with Vista, so use getAddressInfo with NUMERICHOST // instead. auto results = getAddressInfo(addr, AddressInfoFlags.NUMERICHOST); if (results.length && results[0].family == AddressFamily.INET6) return (cast(sockaddr_in6*)results[0].address.name()).sin6_addr.s6_addr; throw new AddressException("Not an IPv6 address", 0); } } unittest { softUnittest({ const Internet6Address ia = new Internet6Address("::1", 80); assert(ia.toString() == "[::1]:80"); }); } version(StdDdoc) { /** * $(D UnixAddress) encapsulates an address for a Unix domain socket * ($(D AF_UNIX)). Available only on supported systems. */ class UnixAddress: Address { /// Construct a new $(D UnixAddress) from the specified path. this(in char[] path); /// Get the underlying _path. @property string path() const; /// ditto override string toString() const; } } else static if (is(sockaddr_un)) { class UnixAddress: Address { protected: sockaddr_un* sun; socklen_t len; this() { } public: override sockaddr* name() { return cast(sockaddr*)sun; } override const(sockaddr)* name() const { return cast(const(sockaddr)*)sun; } override socklen_t nameLen() const { return len; } this(in char[] path) { len = sockaddr_un.sun_path.offsetof + path.length + 1; sun = cast(sockaddr_un*) (new ubyte[len]).ptr; sun.sun_family = AF_UNIX; sun.sun_path.ptr[0..path.length] = path; sun.sun_path.ptr[path.length] = 0; } @property string path() const { return to!string(sun.sun_path.ptr); } override string toString() const { return path; } } } /** * Class for exceptions thrown by $(D Socket.accept). */ class SocketAcceptException: SocketOSException { this(string msg, int err = _lasterr()) { super(msg, err); } } /// How a socket is shutdown: enum SocketShutdown: int { RECEIVE = SD_RECEIVE, /// socket receives are disallowed SEND = SD_SEND, /// socket sends are disallowed BOTH = SD_BOTH, /// both RECEIVE and SEND } /// Flags may be OR'ed together: enum SocketFlags: int { NONE = 0, /// no flags specified OOB = MSG_OOB, /// out-of-band stream data PEEK = MSG_PEEK, /// peek at incoming data without removing it from the queue, only for receiving DONTROUTE = MSG_DONTROUTE, /// data should not be subject to routing; this flag may be ignored. Only for sending } private mixin template FieldProxy(string target, string field) { mixin(` @property typeof(`~target~`) `~field~`() const { return `~target~`; } /// ditto @property typeof(`~target~`) `~field~`(typeof(`~target~`) value) { return `~target~` = value; } `); } /// Duration timeout value. struct TimeVal { _ctimeval ctimeval; alias typeof(ctimeval.tv_sec) tv_sec_t; alias typeof(ctimeval.tv_usec) tv_usec_t; version (StdDdoc) // no DDoc for string mixins, can't forward individual fields { tv_sec_t seconds; /// Number of _seconds. tv_usec_t microseconds; /// Number of additional _microseconds. } else { // D interface mixin FieldProxy!(`ctimeval.tv_sec`, `seconds`); mixin FieldProxy!(`ctimeval.tv_usec`, `microseconds`); } } /++ $(RED Deprecated. It will be removed in January 2013. Please use $(LREF TimeVal) instead.) +/ deprecated alias TimeVal timeval; /** * A collection of sockets for use with $(D Socket.select). * * $(D SocketSet) allows specifying the capacity of the underlying * $(D fd_set), however users should be aware that the exact meaning of this * value varies depending on the current platform: * $(UL $(LI On POSIX, $(D fd_set) is a bit array of file descriptors. The * $(D SocketSet) capacity specifies the highest file descriptor which can be * stored in the set.) * $(LI on Windows, $(D fd_set) is an array of socket handles. Capacity * indicates the actual number of sockets that can be stored in the set.)) */ class SocketSet { private: version(Windows) { // the maximum number of sockets the allocated fd_set can hold uint fdsetCapacity; fd_set* set; @property uint count() const { return set.fd_count; } } else version(Posix) { int fdsetMax; fd_set setData; final @property fd_set* set() { return &setData; } final @property const(fd_set)* set() const { return &setData; } int maxfd; uint count; } public: /** * Set the capacity of this $(D SocketSet). The exact meaning of the * $(D max) parameter varies from platform to platform. * Throws: $(D SocketParameterException) if $(D max) exceeds this * platform's maximum socket set size. */ this(uint max) { version(Windows) { fdsetCapacity = max; set = FD_CREATE(max); } else version(Posix) { // TODO (needs druntime changes) enforce(max <= FD_SETSIZE, new SocketParameterException( "Maximum socket set size exceeded for this platform")); fdsetMax = max; } reset(); } /// Uses the default capacity for the system. this() { this(FD_SETSIZE); } /// Reset the $(D SocketSet) so that there are 0 $(D Socket)s in the collection. void reset() { FD_ZERO(set); version(Posix) { maxfd = -1; count = 0; } } void add(socket_t s) { // Make sure too many sockets don't get added. version(Windows) { enforce(count < fdsetCapacity, new SocketParameterException( "SocketSet capacity exceeded")); } else version(Posix) { enforce(s < fdsetMax, new SocketParameterException( "Socket descriptor index exceeds SocketSet capacity")); } FD_SET(s, set); version(Posix) { ++count; if(s > maxfd) maxfd = s; } } /// Add a $(D Socket) to the collection. /// Throws: $(D SocketParameterException) if the capacity of this /// $(D SocketSet) has been exceeded. void add(Socket s) { add(s.sock); } void remove(socket_t s) { version(Posix) { enforce(s < fdsetMax, new SocketParameterException( "Socket descriptor index exceeds SocketSet capacity")); } FD_CLR(s, set); version(Posix) { --count; // note: adjusting maxfd would require scanning the set, not worth it } } /// Remove this $(D Socket) from the collection. void remove(Socket s) { remove(s.sock); } int isSet(socket_t s) const { version(Posix) { enforce(s < fdsetMax, new SocketParameterException( "Socket descriptor index exceeds SocketSet capacity")); } return FD_ISSET(s, set); } /// Returns nonzero if this $(D Socket) is in the collection. int isSet(Socket s) const { return isSet(s.sock); } /// Return the capacity of this $(D SocketSet). The exact meaning of the /// return value varies from platform to platform. @property uint max() const { version(Windows) { return fdsetCapacity; } else version(Posix) { return fdsetMax; } } fd_set* toFd_set() { return set; } int selectn() const { version(Windows) { return count; } else version(Posix) { return maxfd + 1; } } } /// The level at which a socket option is defined: enum SocketOptionLevel: int { SOCKET = SOL_SOCKET, /// Socket level IP = ProtocolType.IP, /// Internet Protocol version 4 level ICMP = ProtocolType.ICMP, /// Internet Control Message Protocol level IGMP = ProtocolType.IGMP, /// Internet Group Management Protocol level GGP = ProtocolType.GGP, /// Gateway to Gateway Protocol level TCP = ProtocolType.TCP, /// Transmission Control Protocol level PUP = ProtocolType.PUP, /// PARC Universal Packet Protocol level UDP = ProtocolType.UDP, /// User Datagram Protocol level IDP = ProtocolType.IDP, /// Xerox NS protocol level RAW = ProtocolType.RAW, /// Raw IP packet level IPV6 = ProtocolType.IPV6, /// Internet Protocol version 6 level } /// _Linger information for use with SocketOption.LINGER. struct Linger { _clinger clinger; version (StdDdoc) // no DDoc for string mixins, can't forward individual fields { private alias typeof(_clinger.init.l_onoff ) l_onoff_t; private alias typeof(_clinger.init.l_linger) l_linger_t; l_onoff_t on; /// Nonzero for _on. l_linger_t time; /// Linger _time. } else { // D interface mixin FieldProxy!(`clinger.l_onoff`, `on`); mixin FieldProxy!(`clinger.l_linger`, `time`); } } /++ $(RED Deprecated. It will be removed in January 2013. Please use $(LREF Linger) instead.) +/ deprecated alias Linger linger; /// Specifies a socket option: enum SocketOption: int { DEBUG = SO_DEBUG, /// Record debugging information BROADCAST = SO_BROADCAST, /// Allow transmission of broadcast messages REUSEADDR = SO_REUSEADDR, /// Allow local reuse of address LINGER = SO_LINGER, /// Linger on close if unsent data is present OOBINLINE = SO_OOBINLINE, /// Receive out-of-band data in band SNDBUF = SO_SNDBUF, /// Send buffer size RCVBUF = SO_RCVBUF, /// Receive buffer size DONTROUTE = SO_DONTROUTE, /// Do not route SNDTIMEO = SO_SNDTIMEO, /// Send timeout RCVTIMEO = SO_RCVTIMEO, /// Receive timeout ERROR = SO_ERROR, /// Retrieve and clear error status KEEPALIVE = SO_KEEPALIVE, /// Enable keep-alive packets ACCEPTCONN = SO_ACCEPTCONN, /// Listen RCVLOWAT = SO_RCVLOWAT, /// Minimum number of input bytes to process SNDLOWAT = SO_SNDLOWAT, /// Minimum number of output bytes to process TYPE = SO_TYPE, /// Socket type // SocketOptionLevel.TCP: TCP_NODELAY = .TCP_NODELAY, /// Disable the Nagle algorithm for send coalescing // SocketOptionLevel.IPV6: IPV6_UNICAST_HOPS = .IPV6_UNICAST_HOPS, /// IP unicast hop limit IPV6_MULTICAST_IF = .IPV6_MULTICAST_IF, /// IP multicast interface IPV6_MULTICAST_LOOP = .IPV6_MULTICAST_LOOP, /// IP multicast loopback IPV6_MULTICAST_HOPS = .IPV6_MULTICAST_HOPS, /// IP multicast hops IPV6_JOIN_GROUP = .IPV6_JOIN_GROUP, /// Add an IP group membership IPV6_LEAVE_GROUP = .IPV6_LEAVE_GROUP, /// Drop an IP group membership IPV6_V6ONLY = .IPV6_V6ONLY, /// Treat wildcard bind as AF_INET6-only } /** * $(D Socket) is a class that creates a network communication endpoint using * the Berkeley sockets interface. */ class Socket { private: socket_t sock; AddressFamily _family; version(Windows) bool _blocking = false; /// Property to get or set whether the socket is blocking or nonblocking. // The WinSock timeouts seem to be effectively skewed by a constant // offset of about half a second (value in milliseconds). This has // been confirmed on updated (as of Jun 2011) Windows XP, Windows 7 // and Windows Server 2008 R2 boxes. The unittest below tests this // behavior. enum WINSOCK_TIMEOUT_SKEW = 500; unittest { version(SlowTests) softUnittest({ import std.datetime; enum msecs = 1000; auto pair = socketPair(); auto sock = pair[0]; sock.setOption(SocketOptionLevel.SOCKET, SocketOption.RCVTIMEO, dur!"msecs"(msecs)); auto sw = StopWatch(AutoStart.yes); ubyte[1] buf; sock.receive(buf); sw.stop(); Duration readBack = void; sock.getOption(SocketOptionLevel.SOCKET, SocketOption.RCVTIMEO, readBack); assert(readBack.total!"msecs" == msecs); assert(sw.peek().msecs > msecs-100 && sw.peek().msecs < msecs+100); }); } void setSock(socket_t handle) { assert(handle != socket_t.init); sock = handle; // Set the option to disable SIGPIPE on send() if the platform // has it (e.g. on OS X). static if (is(typeof(SO_NOSIGPIPE))) { setOption(SocketOptionLevel.SOCKET, cast(SocketOption)SO_NOSIGPIPE, true); } } // For use with accepting(). protected this() { } public: /** * Create a blocking socket. If a single protocol type exists to support * this socket type within the address family, the $(D ProtocolType) may be * omitted. */ this(AddressFamily af, SocketType type, ProtocolType protocol) { _family = af; auto handle = cast(socket_t) socket(af, type, protocol); if(handle == socket_t.init) throw new SocketOSException("Unable to create socket"); setSock(handle); } // A single protocol exists to support this socket type within the // protocol family, so the ProtocolType is assumed. /// ditto this(AddressFamily af, SocketType type) { this(af, type, cast(ProtocolType)0); // Pseudo protocol number. } /// ditto this(AddressFamily af, SocketType type, in char[] protocolName) { protoent* proto; proto = getprotobyname(toStringz(protocolName)); if(!proto) throw new SocketOSException("Unable to find the protocol"); this(af, type, cast(ProtocolType)proto.p_proto); } /** * Create a blocking socket using the parameters from the specified * $(D AddressInfo) structure. */ this(in AddressInfo info) { this(info.family, info.type, info.protocol); } /// Use an existing socket handle. this(socket_t sock, AddressFamily af) { assert(sock != socket_t.init); this.sock = sock; this._family = af; } ~this() { close(); } /// Get underlying socket handle. @property socket_t handle() const { return sock; } /** * Get/set socket's blocking flag. * * When a socket is blocking, calls to receive(), accept(), and send() * will block and wait for data/action. * A non-blocking socket will immediately return instead of blocking. */ @property bool blocking() const { version(Windows) { return _blocking; } else version(Posix) { return !(fcntl(handle, F_GETFL, 0) & O_NONBLOCK); } } /// ditto @property void blocking(bool byes) { version(Windows) { uint num = !byes; if(_SOCKET_ERROR == ioctlsocket(sock, FIONBIO, &num)) goto err; _blocking = byes; } else version(Posix) { int x = fcntl(sock, F_GETFL, 0); if(-1 == x) goto err; if(byes) x &= ~O_NONBLOCK; else x |= O_NONBLOCK; if(-1 == fcntl(sock, F_SETFL, x)) goto err; } return; // Success. err: throw new SocketOSException("Unable to set socket blocking"); } /// Get the socket's address family. @property AddressFamily addressFamily() { return _family; } /// Property that indicates if this is a valid, alive socket. @property bool isAlive() const { int type; socklen_t typesize = cast(socklen_t) type.sizeof; return !getsockopt(sock, SOL_SOCKET, SO_TYPE, cast(char*)&type, &typesize); } /// Associate a local address with this socket. void bind(Address addr) { if(_SOCKET_ERROR == .bind(sock, addr.name(), addr.nameLen())) throw new SocketOSException("Unable to bind socket"); } /** * Establish a connection. If the socket is blocking, connect waits for * the connection to be made. If the socket is nonblocking, connect * returns immediately and the connection attempt is still in progress. */ void connect(Address to) { if(_SOCKET_ERROR == .connect(sock, to.name(), to.nameLen())) { int err; err = _lasterr(); if(!blocking) { version(Windows) { if(WSAEWOULDBLOCK == err) return; } else version(Posix) { if(EINPROGRESS == err) return; } else { static assert(0); } } throw new SocketOSException("Unable to connect socket", err); } } /** * Listen for an incoming connection. $(D bind) must be called before you * can $(D listen). The $(D backlog) is a request of how many pending * incoming connections are queued until $(D accept)ed. */ void listen(int backlog) { if(_SOCKET_ERROR == .listen(sock, backlog)) throw new SocketOSException("Unable to listen on socket"); } /** * Called by $(D accept) when a new $(D Socket) must be created for a new * connection. To use a derived class, override this method and return an * instance of your class. The returned $(D Socket)'s handle must not be * set; $(D Socket) has a protected constructor $(D this()) to use in this * situation. */ // Override to use a derived class. // The returned socket's handle must not be set. protected Socket accepting() { return new Socket; } /** * Accept an incoming connection. If the socket is blocking, $(D accept) * waits for a connection request. Throws $(D SocketAcceptException) if * unable to _accept. See $(D accepting) for use with derived classes. */ Socket accept() { auto newsock = cast(socket_t).accept(sock, null, null); if(socket_t.init == newsock) throw new SocketAcceptException("Unable to accept socket connection"); Socket newSocket; try { newSocket = accepting(); assert(newSocket.sock == socket_t.init); newSocket.setSock(newsock); version(Windows) newSocket._blocking = _blocking; //inherits blocking mode newSocket._family = _family; //same family } catch(Throwable o) { _close(newsock); throw o; } return newSocket; } /// Disables sends and/or receives. void shutdown(SocketShutdown how) { .shutdown(sock, cast(int)how); } private static void _close(socket_t sock) { version(Windows) { .closesocket(sock); } else version(Posix) { .close(sock); } } /** * Immediately drop any connections and release socket resources. * Calling $(D shutdown) before $(D close) is recommended for * connection-oriented sockets. The $(D Socket) object is no longer * usable after $(D close). */ //calling shutdown() before this is recommended //for connection-oriented sockets void close() { _close(sock); sock = socket_t.init; } /// Returns the local machine's host name. // Idea from mango. static string hostName() // getter { char[256] result; // Host names are limited to 255 chars. if(_SOCKET_ERROR == .gethostname(result.ptr, result.length)) throw new SocketOSException("Unable to obtain host name"); return to!string(result.ptr); } /// Remote endpoint $(D Address). Address remoteAddress() { Address addr = createAddress(); socklen_t nameLen = addr.nameLen(); if(_SOCKET_ERROR == .getpeername(sock, addr.name(), &nameLen)) throw new SocketOSException("Unable to obtain remote socket address"); if(nameLen > addr.nameLen()) throw new SocketParameterException("Not enough socket address storage"); assert(addr.addressFamily() == _family); return addr; } /// Local endpoint $(D Address). Address localAddress() { Address addr = createAddress(); socklen_t nameLen = addr.nameLen(); if(_SOCKET_ERROR == .getsockname(sock, addr.name(), &nameLen)) throw new SocketOSException("Unable to obtain local socket address"); if(nameLen > addr.nameLen()) throw new SocketParameterException("Not enough socket address storage"); assert(addr.addressFamily() == _family); return addr; } /** * Send or receive error code. See $(D wouldHaveBlocked), * $(D lastSocketError) and $(D Socket.getErrorText) for obtaining more * information about the error. */ enum int ERROR = _SOCKET_ERROR; /** * Send data on the connection. If the socket is blocking and there is no * buffer space left, $(D send) waits. * Returns: The number of bytes actually sent, or $(D Socket.ERROR) on * failure. */ //returns number of bytes actually sent, or -1 on error ptrdiff_t send(const(void)[] buf, SocketFlags flags) { static if (is(typeof(MSG_NOSIGNAL))) { flags = cast(SocketFlags)(flags | MSG_NOSIGNAL); } version( Windows ) auto sent = .send(sock, buf.ptr, to!int(buf.length), cast(int)flags); else auto sent = .send(sock, buf.ptr, buf.length, cast(int)flags); return sent; } /// ditto ptrdiff_t send(const(void)[] buf) { return send(buf, SocketFlags.NONE); } /** * Send data to a specific destination Address. If the destination address is * not specified, a connection must have been made and that address is used. * If the socket is blocking and there is no buffer space left, $(D sendTo) waits. * Returns: The number of bytes actually sent, or $(D Socket.ERROR) on * failure. */ ptrdiff_t sendTo(const(void)[] buf, SocketFlags flags, Address to) { static if (is(typeof(MSG_NOSIGNAL))) { flags = cast(SocketFlags)(flags | MSG_NOSIGNAL); } version( Windows ) return .sendto( sock, buf.ptr, std.conv.to!int(buf.length), cast(int)flags, to.name(), to.nameLen() ); else return .sendto(sock, buf.ptr, buf.length, cast(int)flags, to.name(), to.nameLen()); } /// ditto ptrdiff_t sendTo(const(void)[] buf, Address to) { return sendTo(buf, SocketFlags.NONE, to); } //assumes you connect()ed /// ditto ptrdiff_t sendTo(const(void)[] buf, SocketFlags flags) { static if (is(typeof(MSG_NOSIGNAL))) { flags = cast(SocketFlags)(flags | MSG_NOSIGNAL); } version(Windows) return .sendto(sock, buf.ptr, to!int(buf.length), cast(int)flags, null, 0); else return .sendto(sock, buf.ptr, buf.length, cast(int)flags, null, 0); } //assumes you connect()ed /// ditto ptrdiff_t sendTo(const(void)[] buf) { return sendTo(buf, SocketFlags.NONE); } /** * Receive data on the connection. If the socket is blocking, $(D receive) * waits until there is data to be received. * Returns: The number of bytes actually received, $(D 0) if the remote side * has closed the connection, or $(D Socket.ERROR) on failure. */ //returns number of bytes actually received, 0 on connection closure, or -1 on error ptrdiff_t receive(void[] buf, SocketFlags flags) { version(Windows) // Does not use size_t { return buf.length ? .recv(sock, buf.ptr, to!int(buf.length), cast(int)flags) : 0; } else { return buf.length ? .recv(sock, buf.ptr, buf.length, cast(int)flags) : 0; } } /// ditto ptrdiff_t receive(void[] buf) { return receive(buf, SocketFlags.NONE); } /** * Receive data and get the remote endpoint $(D Address). * If the socket is blocking, $(D receiveFrom) waits until there is data to * be received. * Returns: The number of bytes actually received, $(D 0) if the remote side * has closed the connection, or $(D Socket.ERROR) on failure. */ ptrdiff_t receiveFrom(void[] buf, SocketFlags flags, ref Address from) { if(!buf.length) //return 0 and don't think the connection closed return 0; if (from is null || from.addressFamily != _family) from = createAddress(); socklen_t nameLen = from.nameLen(); version(Windows) { auto read = .recvfrom(sock, buf.ptr, to!int(buf.length), cast(int)flags, from.name(), &nameLen); assert(from.addressFamily() == _family); // if(!read) //connection closed return read; } else { auto read = .recvfrom(sock, buf.ptr, buf.length, cast(int)flags, from.name(), &nameLen); assert(from.addressFamily() == _family); // if(!read) //connection closed return read; } } /// ditto ptrdiff_t receiveFrom(void[] buf, ref Address from) { return receiveFrom(buf, SocketFlags.NONE, from); } //assumes you connect()ed /// ditto ptrdiff_t receiveFrom(void[] buf, SocketFlags flags) { if(!buf.length) //return 0 and don't think the connection closed return 0; version(Windows) { auto read = .recvfrom(sock, buf.ptr, to!int(buf.length), cast(int)flags, null, null); // if(!read) //connection closed return read; } else { auto read = .recvfrom(sock, buf.ptr, buf.length, cast(int)flags, null, null); // if(!read) //connection closed return read; } } //assumes you connect()ed /// ditto ptrdiff_t receiveFrom(void[] buf) { return receiveFrom(buf, SocketFlags.NONE); } /// Get a socket option. /// Returns: The number of bytes written to $(D result). //returns the length, in bytes, of the actual result - very different from getsockopt() int getOption(SocketOptionLevel level, SocketOption option, void[] result) { socklen_t len = cast(socklen_t) result.length; if(_SOCKET_ERROR == .getsockopt(sock, cast(int)level, cast(int)option, result.ptr, &len)) throw new SocketOSException("Unable to get socket option"); return len; } /// Common case of getting integer and boolean options. int getOption(SocketOptionLevel level, SocketOption option, out int32_t result) { return getOption(level, option, (&result)[0 .. 1]); } /// Get the linger option. int getOption(SocketOptionLevel level, SocketOption option, out Linger result) { //return getOption(cast(SocketOptionLevel)SocketOptionLevel.SOCKET, SocketOption.LINGER, (&result)[0 .. 1]); return getOption(level, option, (&result.clinger)[0 .. 1]); } /// Get a timeout (duration) option. void getOption(SocketOptionLevel level, SocketOption option, out Duration result) { enforce(option == SocketOption.SNDTIMEO || option == SocketOption.RCVTIMEO, new SocketParameterException("Not a valid timeout option: " ~ to!string(option))); // WinSock returns the timeout values as a milliseconds DWORD, // while Linux and BSD return a timeval struct. version (Windows) { int msecs; getOption(level, option, (&msecs)[0 .. 1]); if (option == SocketOption.RCVTIMEO) msecs += WINSOCK_TIMEOUT_SKEW; result = dur!"msecs"(msecs); } else version (Posix) { TimeVal tv; getOption(level, option, (&tv.ctimeval)[0..1]); result = dur!"seconds"(tv.seconds) + dur!"usecs"(tv.microseconds); } else static assert(false); } // Set a socket option. void setOption(SocketOptionLevel level, SocketOption option, void[] value) { if(_SOCKET_ERROR == .setsockopt(sock, cast(int)level, cast(int)option, value.ptr, cast(uint) value.length)) throw new SocketOSException("Unable to set socket option"); } /// Common case for setting integer and boolean options. void setOption(SocketOptionLevel level, SocketOption option, int32_t value) { setOption(level, option, (&value)[0 .. 1]); } /// Set the linger option. void setOption(SocketOptionLevel level, SocketOption option, Linger value) { //setOption(cast(SocketOptionLevel)SocketOptionLevel.SOCKET, SocketOption.LINGER, (&value)[0 .. 1]); setOption(level, option, (&value.clinger)[0 .. 1]); } /** * Sets a timeout (duration) option, i.e. $(D SocketOption.SNDTIMEO) or * $(D RCVTIMEO). Zero indicates no timeout. * * In a typical application, you might also want to consider using * a non-blocking socket instead of setting a timeout on a blocking one. * * Note: While the receive timeout setting is generally quite accurate * on *nix systems even for smaller durations, there are two issues to * be aware of on Windows: First, although undocumented, the effective * timeout duration seems to be the one set on the socket plus half * a second. $(D setOption()) tries to compensate for that, but still, * timeouts under 500ms are not possible on Windows. Second, be aware * that the actual amount of time spent until a blocking call returns * randomly varies on the order of 10ms. * * Params: * value = The timeout duration to set. Must not be negative. * * Throws: $(D SocketException) if setting the options fails. * * Example: * --- * import std.datetime; * auto pair = socketPair(); * scope(exit) foreach (s; pair) s.close(); * * // Set a receive timeout, and then wait at one end of * // the socket pair, knowing that no data will arrive. * pair[0].setOption(SocketOptionLevel.SOCKET, * SocketOption.RCVTIMEO, dur!"seconds"(1)); * * auto sw = StopWatch(AutoStart.yes); * ubyte[1] buffer; * pair[0].receive(buffer); * writefln("Waited %s ms until the socket timed out.", * sw.peek.msecs); * --- */ void setOption(SocketOptionLevel level, SocketOption option, Duration value) { enforce(option == SocketOption.SNDTIMEO || option == SocketOption.RCVTIMEO, new SocketParameterException("Not a valid timeout option: " ~ to!string(option))); enforce(value >= dur!"hnsecs"(0), new SocketParameterException( "Timeout duration must not be negative.")); version (Windows) { auto msecs = to!int(value.total!"msecs"()); if (msecs != 0 && option == SocketOption.RCVTIMEO) msecs = max(1, msecs - WINSOCK_TIMEOUT_SKEW); setOption(level, option, msecs); } else version (Posix) { _ctimeval tv; tv.tv_sec = to!(typeof(tv.tv_sec ))(value.total!"seconds"()); tv.tv_usec = to!(typeof(tv.tv_usec))(value.fracSec.usecs); setOption(level, option, (&tv)[0 .. 1]); } else static assert(false); } /// Get a text description of this socket's error status, and clear the /// socket's error status. string getErrorText() { int32_t error; getOption(SocketOptionLevel.SOCKET, SocketOption.ERROR, error); return formatSocketError(error); } /** * Enables TCP keep-alive with the specified parameters. * * Params: * time = Number of seconds with no activity until the first * keep-alive packet is sent. * interval = Number of seconds between when successive keep-alive * packets are sent if no acknowledgement is received. * * Throws: $(D SocketOSException) if setting the options fails, or * $(D SocketFeatureException) if setting keep-alive parameters is * unsupported on the current platform. */ void setKeepAlive(int time, int interval) { version(Windows) { tcp_keepalive options; options.onoff = 1; options.keepalivetime = time * 1000; options.keepaliveinterval = interval * 1000; uint cbBytesReturned; enforce(WSAIoctl(sock, SIO_KEEPALIVE_VALS, &options, options.sizeof, null, 0, &cbBytesReturned, null, null) == 0, new SocketOSException("Error setting keep-alive")); } else static if (is(typeof(TCP_KEEPIDLE)) && is(typeof(TCP_KEEPINTVL))) { setOption(SocketOptionLevel.TCP, cast(SocketOption)TCP_KEEPIDLE, time); setOption(SocketOptionLevel.TCP, cast(SocketOption)TCP_KEEPINTVL, interval); setOption(SocketOptionLevel.SOCKET, SocketOption.KEEPALIVE, true); } else throw new SocketFeatureException("Setting keep-alive options " ~ "is not supported on this platform"); } /** * Wait for a socket to change status. A wait timeout $(D TimeVal), * $(D Duration) or $(D long) microseconds may be specified; if a timeout * is not specified or the $(D TimeVal) is $(D null), the maximum timeout * is used. The $(D TimeVal) timeout has an unspecified value when * $(D select) returns. * Returns: The number of sockets with status changes, $(D 0) on timeout, * or $(D -1) on interruption. If the return value is greater than $(D 0), * the $(D SocketSets) are updated to only contain the sockets having status * changes. For a connecting socket, a write status change means the * connection is established and it's able to send. For a listening socket, * a read status change means there is an incoming connection request and * it's able to accept. */ //SocketSet's updated to include only those sockets which an event occured //returns the number of events, 0 on timeout, or -1 on interruption //for a connect()ing socket, writeability means connected //for a listen()ing socket, readability means listening //Winsock: possibly internally limited to 64 sockets per set static int select(SocketSet checkRead, SocketSet checkWrite, SocketSet checkError, TimeVal* tv) in { //make sure none of the SocketSet's are the same object if(checkRead) { assert(checkRead !is checkWrite); assert(checkRead !is checkError); } if(checkWrite) { assert(checkWrite !is checkError); } } body { fd_set* fr, fw, fe; int n = 0; version(Windows) { // Windows has a problem with empty fd_set`s that aren't null. fr = (checkRead && checkRead.count()) ? checkRead.toFd_set() : null; fw = (checkWrite && checkWrite.count()) ? checkWrite.toFd_set() : null; fe = (checkError && checkError.count()) ? checkError.toFd_set() : null; } else { if(checkRead) { fr = checkRead.toFd_set(); n = checkRead.selectn(); } else { fr = null; } if(checkWrite) { fw = checkWrite.toFd_set(); int _n; _n = checkWrite.selectn(); if(_n > n) n = _n; } else { fw = null; } if(checkError) { fe = checkError.toFd_set(); int _n; _n = checkError.selectn(); if(_n > n) n = _n; } else { fe = null; } } int result = .select(n, fr, fw, fe, &tv.ctimeval); version(Windows) { if(_SOCKET_ERROR == result && WSAGetLastError() == WSAEINTR) return -1; } else version(Posix) { if(_SOCKET_ERROR == result && errno == EINTR) return -1; } else { static assert(0); } if(_SOCKET_ERROR == result) throw new SocketOSException("Socket select error"); return result; } /// ditto static int select(SocketSet checkRead, SocketSet checkWrite, SocketSet checkError, long microseconds) { TimeVal tv; tv.seconds = to!(tv.tv_sec_t )(microseconds / 1_000_000); tv.microseconds = to!(tv.tv_usec_t)(microseconds % 1_000_000); return select(checkRead, checkWrite, checkError, &tv); } /// ditto static int select(SocketSet checkRead, SocketSet checkWrite, SocketSet checkError, Duration duration) { TimeVal tv; tv.seconds = to!(tv.tv_sec_t )(duration.total!"seconds"()); tv.microseconds = to!(tv.tv_usec_t)(duration.fracSec.usecs); return select(checkRead, checkWrite, checkError, &tv); } /// ditto //maximum timeout static int select(SocketSet checkRead, SocketSet checkWrite, SocketSet checkError) { return select(checkRead, checkWrite, checkError, null); } /// Returns a new Address object for the current address family. /// Can be overridden to support other addresses. protected Address createAddress() { Address result; switch(_family) { case AddressFamily.INET: result = new InternetAddress; break; case AddressFamily.INET6: result = new Internet6Address; break; default: result = new UnknownAddress; } return result; } } /// $(D TcpSocket) is a shortcut class for a TCP Socket. class TcpSocket: Socket { /// Constructs a blocking TCP Socket. this(AddressFamily family) { super(family, SocketType.STREAM, ProtocolType.TCP); } /// Constructs a blocking IPv4 TCP Socket. this() { this(AddressFamily.INET); } //shortcut /// Constructs a blocking TCP Socket and connects to an $(D Address). this(Address connectTo) { this(connectTo.addressFamily()); connect(connectTo); } } /// $(D UdpSocket) is a shortcut class for a UDP Socket. class UdpSocket: Socket { /// Constructs a blocking UDP Socket. this(AddressFamily family) { super(family, SocketType.DGRAM, ProtocolType.UDP); } /// Constructs a blocking IPv4 UDP Socket. this() { this(AddressFamily.INET); } } /** * Creates a pair of connected sockets. * * The two sockets are indistinguishable. * * Throws: $(D SocketException) if creation of the sockets fails. * * Example: * --- * immutable ubyte[] data = [1, 2, 3, 4]; * auto pair = socketPair(); * scope(exit) foreach (s; pair) s.close(); * * pair[0].send(data); * * auto buf = new ubyte[data.length]; * pair[1].receive(buf); * assert(buf == data); * --- */ Socket[2] socketPair() { version(Posix) { int[2] socks; if (socketpair(AF_UNIX, SOCK_STREAM, 0, socks) == -1) throw new SocketOSException("Unable to create socket pair"); Socket toSocket(size_t id) { auto s = new Socket; s.setSock(cast(socket_t)socks[id]); s._family = AddressFamily.UNIX; return s; } return [toSocket(0), toSocket(1)]; } else version(Windows) { // We do not have socketpair() on Windows, just manually create a // pair of sockets connected over some localhost port. Socket[2] result; auto listener = new TcpSocket(); listener.setOption(SocketOptionLevel.SOCKET, SocketOption.REUSEADDR, true); listener.bind(new InternetAddress(INADDR_LOOPBACK, InternetAddress.PORT_ANY)); auto addr = listener.localAddress(); listener.listen(1); result[0] = new TcpSocket(addr); result[1] = listener.accept(); listener.close(); return result; } else static assert(false); } unittest { immutable ubyte[] data = [1, 2, 3, 4]; auto pair = socketPair(); scope(exit) foreach (s; pair) s.close(); pair[0].send(data); auto buf = new ubyte[data.length]; pair[1].receive(buf); assert(buf == data); }
D
instance PC_ROCKEFELLER(NPC_DEFAULT) { name[0] = "Рокфеллер"; npctype = NPCTYPE_MAIN; guild = GIL_NONE; level = 30; voice = 15; id = 0; attribute[ATR_STRENGTH] = 1000; attribute[ATR_DEXTERITY] = 100; attribute[ATR_MANA_MAX] = 400; attribute[ATR_MANA] = 400; attribute[ATR_HITPOINTS_MAX] = 400; attribute[ATR_HITPOINTS] = 400; exp = 500 * ((level + 1) / 2) * (level + 1); exp_next = 500 * ((level + 2) / 2) * (level + 1); Mdl_SetVisual(self,"HUMANS.MDS"); Mdl_SetVisualBody(self,"hum_body_Naked0",BODYTEX_PLAYER,0,"Hum_Head_Pony",FACE_N_PLAYER,0,itar_pal_h); Npc_SetTalentSkill(self,NPC_TALENT_MAGE,6); Npc_SetTalentSkill(self,NPC_TALENT_PICKLOCK,1); Npc_SetTalentSkill(self,NPC_TALENT_SNEAK,1); Npc_SetTalentSkill(self,NPC_TALENT_ACROBAT,0); Npc_SetTalentSkill(self,NPC_TALENT_PICKPOCKET,1); Npc_SetTalentSkill(self,NPC_TALENT_SMITH,1); Npc_SetTalentSkill(self,NPC_TALENT_RUNES,1); Npc_SetTalentSkill(self,NPC_TALENT_ALCHEMY,1); Npc_SetTalentSkill(self,NPC_TALENT_TAKEANIMALTROPHY,1); PLAYER_TALENT_ALCHEMY[POTION_HEALTH_01] = TRUE; PLAYER_TALENT_ALCHEMY[POTION_HEALTH_02] = TRUE; PLAYER_TALENT_ALCHEMY[POTION_HEALTH_03] = TRUE; PLAYER_TALENT_ALCHEMY[POTION_MANA_01] = TRUE; PLAYER_TALENT_ALCHEMY[POTION_MANA_02] = TRUE; PLAYER_TALENT_ALCHEMY[POTION_MANA_03] = TRUE; PLAYER_TALENT_ALCHEMY[POTION_SPEED] = TRUE; PLAYER_TALENT_ALCHEMY[POTION_PERM_STR] = TRUE; PLAYER_TALENT_ALCHEMY[POTION_PERM_DEX] = TRUE; PLAYER_TALENT_ALCHEMY[POTION_PERM_MANA] = TRUE; PLAYER_TALENT_ALCHEMY[POTION_PERM_HEALTH] = TRUE; PLAYER_TALENT_SMITH[WEAPON_COMMON] = TRUE; PLAYER_TALENT_SMITH[WEAPON_1H_SPECIAL_01] = TRUE; PLAYER_TALENT_SMITH[WEAPON_2H_SPECIAL_01] = TRUE; PLAYER_TALENT_SMITH[WEAPON_1H_SPECIAL_02] = TRUE; PLAYER_TALENT_SMITH[WEAPON_2H_SPECIAL_02] = TRUE; PLAYER_TALENT_SMITH[WEAPON_1H_SPECIAL_03] = TRUE; PLAYER_TALENT_SMITH[WEAPON_2H_SPECIAL_03] = TRUE; PLAYER_TALENT_SMITH[WEAPON_1H_SPECIAL_04] = TRUE; PLAYER_TALENT_SMITH[WEAPON_2H_SPECIAL_04] = TRUE; PLAYER_TALENT_TAKEANIMALTROPHY[TROPHY_TEETH] = TRUE; PLAYER_TALENT_TAKEANIMALTROPHY[TROPHY_CLAWS] = TRUE; PLAYER_TALENT_TAKEANIMALTROPHY[TROPHY_FUR] = TRUE; PLAYER_TALENT_TAKEANIMALTROPHY[TROPHY_HEART] = TRUE; PLAYER_TALENT_TAKEANIMALTROPHY[TROPHY_SHADOWHORN] = TRUE; PLAYER_TALENT_TAKEANIMALTROPHY[TROPHY_FIRETONGUE] = TRUE; PLAYER_TALENT_TAKEANIMALTROPHY[TROPHY_BFWING] = TRUE; PLAYER_TALENT_TAKEANIMALTROPHY[TROPHY_BFSTING] = TRUE; PLAYER_TALENT_TAKEANIMALTROPHY[TROPHY_MANDIBLES] = TRUE; PLAYER_TALENT_TAKEANIMALTROPHY[TROPHY_CRAWLERPLATE] = TRUE; PLAYER_TALENT_TAKEANIMALTROPHY[TROPHY_DRGSNAPPERHORN] = TRUE; PLAYER_TALENT_TAKEANIMALTROPHY[TROPHY_DRAGONSCALE] = TRUE; PLAYER_TALENT_TAKEANIMALTROPHY[TROPHY_DRAGONBLOOD] = TRUE; PLAYER_TALENT_RUNES[SPL_LIGHT] = TRUE; PLAYER_TALENT_RUNES[SPL_FIREBOLT] = TRUE; PLAYER_TALENT_RUNES[SPL_ICEBOLT] = TRUE; PLAYER_TALENT_RUNES[SPL_LIGHTHEAL] = TRUE; PLAYER_TALENT_RUNES[SPL_SUMMONGOBLINSKELETON] = TRUE; PLAYER_TALENT_RUNES[SPL_INSTANTFIREBALL] = TRUE; PLAYER_TALENT_RUNES[SPL_ZAP] = TRUE; PLAYER_TALENT_RUNES[SPL_SUMMONWOLF] = TRUE; PLAYER_TALENT_RUNES[SPL_WINDFIST] = TRUE; PLAYER_TALENT_RUNES[SPL_SLEEP] = TRUE; PLAYER_TALENT_RUNES[SPL_MEDIUMHEAL] = TRUE; PLAYER_TALENT_RUNES[SPL_LIGHTNINGFLASH] = TRUE; PLAYER_TALENT_RUNES[SPL_CHARGEFIREBALL] = TRUE; PLAYER_TALENT_RUNES[SPL_SUMMONSKELETON] = TRUE; PLAYER_TALENT_RUNES[SPL_FEAR] = TRUE; PLAYER_TALENT_RUNES[SPL_ICECUBE] = TRUE; PLAYER_TALENT_RUNES[SPL_CHARGEZAP] = TRUE; PLAYER_TALENT_RUNES[SPL_SUMMONGOLEM] = TRUE; PLAYER_TALENT_RUNES[SPL_DESTROYUNDEAD] = TRUE; PLAYER_TALENT_RUNES[SPL_PYROKINESIS] = TRUE; PLAYER_TALENT_RUNES[SPL_FIRESTORM] = TRUE; PLAYER_TALENT_RUNES[SPL_ICEWAVE] = TRUE; PLAYER_TALENT_RUNES[SPL_SUMMONDEMON] = TRUE; PLAYER_TALENT_RUNES[SPL_FULLHEAL] = TRUE; PLAYER_TALENT_RUNES[SPL_FIRERAIN] = TRUE; PLAYER_TALENT_RUNES[SPL_BREATHOFDEATH] = TRUE; PLAYER_TALENT_RUNES[SPL_MASSDEATH] = TRUE; PLAYER_TALENT_RUNES[SPL_ARMYOFDARKNESS] = TRUE; PLAYER_TALENT_RUNES[SPL_SHRINK] = TRUE; b_setfightskills(self,100); EquipItem(self,itmw_2h_pal_sword); CreateInvItems(self,itmw_1h_vlk_dagger,1); CreateInvItems(self,itmw_1h_mace_l_01,1); CreateInvItems(self,itmw_1h_bau_axe,1); CreateInvItems(self,itmw_1h_vlk_mace,1); CreateInvItems(self,itmw_1h_mace_l_03,1); CreateInvItems(self,itmw_1h_bau_mace,1); CreateInvItems(self,itmw_1h_vlk_axe,1); CreateInvItems(self,itmw_1h_mace_l_04,1); CreateInvItems(self,itmw_shortsword1,1); CreateInvItems(self,itmw_nagelknueppel,1); CreateInvItems(self,itmw_1h_sword_l_03,1); CreateInvItems(self,itmw_shortsword2,1); CreateInvItems(self,itmw_sense,1); CreateInvItems(self,itmw_1h_vlk_sword,1); CreateInvItems(self,itmw_1h_nov_mace,1); CreateInvItems(self,itmw_2h_bau_axe,1); CreateInvItems(self,itmw_2h_axe_l_01,1); CreateInvItems(self,itmw_1h_misc_sword,1); CreateInvItems(self,itmw_1h_misc_axe,1); CreateInvItems(self,itmw_2h_sword_m_01,1); CreateInvItems(self,itmw_1h_mil_sword,1); CreateInvItems(self,itmw_1h_sld_axe,1); CreateInvItems(self,itmw_1h_sld_sword,1); CreateInvItems(self,itmw_2h_sld_axe,1); CreateInvItems(self,itmw_2h_sld_sword,1); CreateInvItems(self,itmw_1h_pal_sword,1); CreateInvItems(self,itmw_2h_pal_sword,1); CreateInvItems(self,itmw_2h_orcaxe_01,1); CreateInvItems(self,itmw_2h_orcaxe_02,1); CreateInvItems(self,itmw_2h_orcaxe_03,1); CreateInvItems(self,itmw_2h_orcaxe_04,1); CreateInvItems(self,itmw_2h_orcmace_01,1); CreateInvItems(self,itmw_2h_orcsword_01,1); CreateInvItems(self,itmw_2h_orcsword_02,1); CreateInvItems(self,itmw_shortsword3,1); CreateInvItems(self,itmw_nagelkeule,1); CreateInvItems(self,itmw_shortsword4,1); CreateInvItems(self,itmw_kriegskeule,1); CreateInvItems(self,itmw_richtstab,1); CreateInvItems(self,itmw_shortsword5,1); CreateInvItems(self,itmw_kriegshammer1,1); CreateInvItems(self,itmw_hellebarde,1); CreateInvItems(self,itmw_nagelkeule2,1); CreateInvItems(self,itmw_schiffsaxt,1); CreateInvItems(self,itmw_piratensaebel,1); CreateInvItems(self,itmw_schwert,1); CreateInvItems(self,itmw_1h_common_01,1); CreateInvItems(self,itmw_stabkeule,1); CreateInvItems(self,itmw_zweihaender1,1); CreateInvItems(self,itmw_steinbrecher,1); CreateInvItems(self,itmw_spicker,1); CreateInvItems(self,itmw_streitaxt1,1); CreateInvItems(self,itmw_schwert1,1); CreateInvItems(self,itmw_schwert2,1); CreateInvItems(self,itmw_doppelaxt,1); CreateInvItems(self,itmw_bartaxt,1); CreateInvItems(self,itmw_morgenstern,1); CreateInvItems(self,itmw_schwert3,1); CreateInvItems(self,itmw_schwert4,1); CreateInvItems(self,itmw_1h_special_01,1); CreateInvItems(self,itmw_2h_special_01,1); CreateInvItems(self,itmw_rapier,1); CreateInvItems(self,itmw_rubinklinge,1); CreateInvItems(self,itmw_streitkolben,1); CreateInvItems(self,itmw_zweihaender2,1); CreateInvItems(self,itmw_runenschwert,1); CreateInvItems(self,itmw_rabenschnabel,1); CreateInvItems(self,itmw_schwert5,1); CreateInvItems(self,itmw_inquisitor,1); CreateInvItems(self,itmw_streitaxt2,1); CreateInvItems(self,itmw_zweihaender3,1); CreateInvItems(self,itmw_1h_special_02,1); CreateInvItems(self,itmw_2h_special_02,1); CreateInvItems(self,itmw_elbastardo,1); CreateInvItems(self,itmw_kriegshammer2,1); CreateInvItems(self,itmw_meisterdegen,1); CreateInvItems(self,itmw_folteraxt,1); CreateInvItems(self,itmw_orkschlaechter,1); CreateInvItems(self,itmw_schlachtaxt,1); CreateInvItems(self,itmw_krummschwert,1); CreateInvItems(self,itmw_barbarenstreitaxt,1); CreateInvItems(self,itmw_sturmbringer,1); CreateInvItems(self,itmw_1h_special_03,1); CreateInvItems(self,itmw_2h_special_03,1); CreateInvItems(self,itmw_berserkeraxt,1); CreateInvItems(self,itmw_drachenschneide,1); CreateInvItems(self,itmw_1h_special_04,1); CreateInvItems(self,itmw_2h_special_04,1); CreateInvItems(self,itmw_1h_blessed_01,1); CreateInvItems(self,itmw_1h_blessed_02,1); CreateInvItems(self,itmw_1h_blessed_03,1); CreateInvItems(self,itmw_2h_blessed_01,1); CreateInvItems(self,itmw_2h_blessed_02,1); CreateInvItems(self,itmw_2h_blessed_03,1); CreateInvItem(self,itar_governor); CreateInvItem(self,itar_smith); CreateInvItem(self,itar_barkeeper); CreateInvItem(self,itar_judge); CreateInvItem(self,itar_vlk_l); CreateInvItem(self,itar_vlk_m); CreateInvItem(self,itar_vlk_h); CreateInvItem(self,itar_vlkbabe_l); CreateInvItem(self,itar_vlkbabe_m); CreateInvItem(self,itar_vlkbabe_h); CreateInvItem(self,itar_mil_l); CreateInvItem(self,itar_mil_m); CreateInvItem(self,itar_pal_m); CreateInvItem(self,itar_pal_h); CreateInvItem(self,itar_bau_l); CreateInvItem(self,itar_bau_m); CreateInvItem(self,itar_baubabe_l); CreateInvItem(self,itar_baubabe_m); CreateInvItem(self,itar_sld_l); CreateInvItem(self,itar_sld_m); CreateInvItem(self,itar_sld_h); CreateInvItem(self,itar_nov_l); CreateInvItem(self,itar_kdf_l); CreateInvItem(self,itar_kdf_h); CreateInvItem(self,itar_leather_l); CreateInvItem(self,itar_bdt_m); CreateInvItem(self,itar_bdt_h); CreateInvItem(self,itar_djg_l); CreateInvItem(self,itar_djg_m); CreateInvItem(self,itar_djg_h); CreateInvItem(self,itar_djg_crawler); CreateInvItem(self,itar_djg_babe); CreateInvItem(self,itar_xardas); CreateInvItem(self,itar_lester); CreateInvItem(self,itar_diego); CreateInvItem(self,itar_corangar); CreateInvItem(self,itar_kdw_h); CreateInvItem(self,itar_dementor); CreateInvItem(self,itar_prisoner); CreateInvItem(self,itru_pallight); CreateInvItem(self,itru_pallightheal); CreateInvItem(self,itru_palholybolt); CreateInvItem(self,itru_palmediumheal); CreateInvItem(self,itru_palrepelevil); CreateInvItem(self,itru_palfullheal); CreateInvItem(self,itru_paldestroyevil); CreateInvItem(self,itru_light); CreateInvItem(self,itru_firebolt); CreateInvItem(self,itru_icebolt); CreateInvItem(self,itru_lightheal); CreateInvItem(self,itru_sumgobskel); CreateInvItem(self,itru_instantfireball); CreateInvItem(self,itru_zap); CreateInvItem(self,itru_sumwolf); CreateInvItem(self,itru_windfist); CreateInvItem(self,itru_sleep); CreateInvItem(self,itru_mediumheal); CreateInvItem(self,itru_lightningflash); CreateInvItem(self,itru_chargefireball); CreateInvItem(self,itru_sumskel); CreateInvItem(self,itru_fear); CreateInvItem(self,itru_icecube); CreateInvItem(self,itru_thunderball); CreateInvItem(self,itru_sumgol); CreateInvItem(self,itru_harmundead); CreateInvItem(self,itru_pyrokinesis); CreateInvItem(self,itru_firestorm); CreateInvItem(self,itru_icewave); CreateInvItem(self,itru_sumdemon); CreateInvItem(self,itru_fullheal); CreateInvItem(self,itru_firerain); CreateInvItem(self,itru_breathofdeath); CreateInvItem(self,itru_massdeath); CreateInvItem(self,itru_masterofdisaster); CreateInvItem(self,itru_armyofdarkness); CreateInvItem(self,itru_shrink); CreateInvItem(self,itsc_pallight); CreateInvItem(self,itsc_pallightheal); CreateInvItem(self,itsc_palholybolt); CreateInvItem(self,itsc_palmediumheal); CreateInvItem(self,itsc_palrepelevil); CreateInvItem(self,itsc_palfullheal); CreateInvItem(self,itsc_paldestroyevil); CreateInvItems(self,itsc_charm,10); CreateInvItem(self,itsc_light); CreateInvItem(self,itsc_firebolt); CreateInvItem(self,itsc_icebolt); CreateInvItem(self,itsc_lightheal); CreateInvItem(self,itsc_sumgobskel); CreateInvItem(self,itsc_instantfireball); CreateInvItem(self,itsc_zap); CreateInvItem(self,itsc_sumwolf); CreateInvItem(self,itsc_windfist); CreateInvItem(self,itsc_sleep); CreateInvItem(self,itsc_mediumheal); CreateInvItem(self,itsc_lightningflash); CreateInvItem(self,itsc_chargefireball); CreateInvItem(self,itsc_sumskel); CreateInvItem(self,itsc_fear); CreateInvItem(self,itsc_icecube); CreateInvItem(self,itsc_thunderball); CreateInvItem(self,itsc_sumgol); CreateInvItem(self,itsc_harmundead); CreateInvItem(self,itsc_pyrokinesis); CreateInvItem(self,itsc_firestorm); CreateInvItem(self,itsc_icewave); CreateInvItem(self,itsc_sumdemon); CreateInvItem(self,itsc_fullheal); CreateInvItem(self,itsc_firerain); CreateInvItem(self,itsc_breathofdeath); CreateInvItem(self,itsc_massdeath); CreateInvItem(self,itsc_armyofdarkness); CreateInvItem(self,itsc_shrink); CreateInvItems(self,itsc_trfsheep,10); CreateInvItems(self,itsc_trfscavenger,10); CreateInvItems(self,itsc_trfgiantrat,10); CreateInvItems(self,itsc_trfgiantbug,10); CreateInvItems(self,itsc_trfwolf,10); CreateInvItems(self,itsc_trfwaran,10); CreateInvItems(self,itsc_trfsnapper,10); CreateInvItems(self,itsc_trfwarg,10); CreateInvItems(self,itsc_trffirewaran,10); CreateInvItems(self,itsc_trflurker,10); CreateInvItems(self,itsc_trfshadowbeast,10); CreateInvItems(self,itsc_trfdragonsnapper,10); CreateInvItem(self,itfo_apple); CreateInvItem(self,itfo_cheese); CreateInvItem(self,itfo_bacon); CreateInvItem(self,itfo_bread); CreateInvItem(self,itfo_fish); CreateInvItem(self,itfomuttonraw); CreateInvItem(self,itfo_stew); CreateInvItem(self,itfo_fishsoup); CreateInvItem(self,itfo_sausage); CreateInvItem(self,itfo_honey); CreateInvItem(self,itfo_water); CreateInvItem(self,itfo_beer); CreateInvItem(self,itfo_booze); CreateInvItem(self,itfo_wine); CreateInvItem(self,itfo_milk); CreateInvItem(self,itpl_swampherb); CreateInvItem(self,itpl_mana_herb_01); CreateInvItem(self,itpl_mana_herb_02); CreateInvItem(self,itpl_mana_herb_03); CreateInvItem(self,itpl_health_herb_01); CreateInvItem(self,itpl_health_herb_02); CreateInvItem(self,itpl_health_herb_03); CreateInvItem(self,itpl_dex_herb_01); CreateInvItem(self,itpl_strength_herb_01); CreateInvItem(self,itpl_speed_herb_01); CreateInvItem(self,itpl_mushroom_01); CreateInvItem(self,itpl_mushroom_02); CreateInvItem(self,itpl_forestberry); CreateInvItem(self,itpl_blueplant); CreateInvItem(self,itpl_planeberry); CreateInvItem(self,itpl_temp_herb); CreateInvItem(self,itpl_perm_herb); CreateInvItem(self,itke_key_01); CreateInvItem(self,itke_key_02); CreateInvItem(self,itke_key_03); CreateInvItem(self,itke_lockpick); CreateInvItems(self,itlstorch,50); CreateInvItem(self,itmi_pan); CreateInvItem(self,itmi_saw); CreateInvItem(self,itmi_brush); CreateInvItem(self,itmi_flask); CreateInvItem(self,itmi_stomper); CreateInvItem(self,itmi_broom); CreateInvItem(self,itmi_rake); CreateInvItem(self,itmi_hammer); CreateInvItem(self,itmi_scoop); CreateInvItem(self,itmi_nugget); CreateInvItem(self,itmi_joint); CreateInvItem(self,itmi_lute); CreateInvItems(self,itmi_gold,1000); CreateInvItem(self,itmiswordraw); CreateInvItem(self,itmiswordrawhot); CreateInvItem(self,itmiswordbladehot); CreateInvItem(self,itmiswordblade); CreateInvItem(self,itmi_runeblank); CreateInvItem(self,itmi_sulfur); CreateInvItem(self,itmi_quartz); CreateInvItem(self,itmi_pitch); CreateInvItem(self,itmi_rockcrystal); CreateInvItem(self,itmi_aquamarine); CreateInvItem(self,itmi_holywater); CreateInvItem(self,itmi_coal); CreateInvItem(self,itmi_darkpearl); CreateInvItem(self,itmi_goldcandleholder); CreateInvItem(self,itmi_goldnecklace); CreateInvItem(self,itmi_goldcup); CreateInvItem(self,itmi_goldchalice); CreateInvItem(self,itmi_goldchest); CreateInvItem(self,itmi_goldring); CreateInvItem(self,itmi_silverchalice); CreateInvItem(self,itmi_jewelerychest); CreateInvItem(self,itmi_innosstatue); CreateInvItem(self,itmi_silverring); CreateInvItem(self,itmi_silvercup); CreateInvItem(self,itmi_silverplate); CreateInvItem(self,itmi_silvernecklace); CreateInvItem(self,itmi_silvercandleholder); CreateInvItem(self,itmi_sextant); CreateInvItem(self,itrw_bow_l_01); CreateInvItem(self,itrw_bow_l_02); CreateInvItem(self,itrw_bow_l_03); CreateInvItem(self,itrw_bow_l_04); CreateInvItem(self,itrw_bow_m_01); CreateInvItem(self,itrw_bow_m_02); CreateInvItem(self,itrw_bow_m_03); CreateInvItem(self,itrw_bow_m_04); CreateInvItem(self,itrw_bow_h_01); CreateInvItem(self,itrw_bow_h_02); CreateInvItem(self,itrw_bow_h_03); CreateInvItem(self,itrw_bow_h_04); CreateInvItem(self,itrw_crossbow_l_01); CreateInvItem(self,itrw_crossbow_l_02); CreateInvItem(self,itrw_crossbow_m_01); CreateInvItem(self,itrw_crossbow_m_02); CreateInvItem(self,itrw_crossbow_h_01); CreateInvItem(self,itrw_crossbow_h_02); CreateInvItems(self,itrw_arrow,1000); CreateInvItems(self,itrw_bolt,1000); CreateInvItem(self,itam_dex_01); CreateInvItem(self,itam_strg_01); CreateInvItem(self,itam_hp_01); CreateInvItem(self,itam_mana_01); CreateInvItem(self,itam_dex_strg_01); CreateInvItem(self,itam_hp_mana_01); CreateInvItem(self,itam_prot_fire_01); CreateInvItem(self,itam_prot_mage_01); CreateInvItem(self,itam_prot_edge_01); CreateInvItem(self,itam_prot_point_01); CreateInvItem(self,itam_prot_total_01); CreateInvItem(self,itri_dex_01); CreateInvItem(self,itri_dex_02); CreateInvItem(self,itri_hp_01); CreateInvItem(self,itri_hp_02); CreateInvItem(self,itri_str_01); CreateInvItem(self,itri_str_02); CreateInvItem(self,itri_mana_01); CreateInvItem(self,itri_mana_02); CreateInvItem(self,itri_dex_strg_01); CreateInvItem(self,itri_hp_mana_01); CreateInvItem(self,itri_prot_fire_01); CreateInvItem(self,itri_prot_fire_02); CreateInvItem(self,itri_prot_edge_01); CreateInvItem(self,itri_prot_edge_02); CreateInvItem(self,itri_prot_mage_01); CreateInvItem(self,itri_prot_mage_02); CreateInvItem(self,itri_prot_point_01); CreateInvItem(self,itri_prot_point_02); CreateInvItem(self,itri_prot_total_01); CreateInvItem(self,itri_prot_total_02); CreateInvItems(self,itpo_mana_01,10); CreateInvItems(self,itpo_mana_02,10); CreateInvItems(self,itpo_mana_03,10); CreateInvItems(self,itpo_health_01,10); CreateInvItems(self,itpo_health_02,10); CreateInvItems(self,itpo_health_03,10); CreateInvItems(self,itpo_perm_str,10); CreateInvItems(self,itpo_perm_dex,10); CreateInvItems(self,itpo_perm_health,10); CreateInvItems(self,itpo_perm_mana,10); CreateInvItems(self,itpo_speed,10); CreateInvItem(self,itat_meatbugflesh); CreateInvItem(self,itat_sheepfur); CreateInvItem(self,itat_wolffur); CreateInvItem(self,itat_bugmandibles); CreateInvItem(self,itat_claw); CreateInvItem(self,itat_lurkerclaw); CreateInvItem(self,itat_teeth); CreateInvItem(self,itat_crawlermandibles); CreateInvItem(self,itat_wing); CreateInvItem(self,itat_sting); CreateInvItem(self,itat_lurkerskin); CreateInvItem(self,itat_wargfur); CreateInvItem(self,itat_crawlerplate); CreateInvItem(self,itat_shadowfur); CreateInvItem(self,itat_sharkskin); CreateInvItem(self,itat_trollfur); CreateInvItem(self,itat_waranfiretongue); CreateInvItem(self,itat_shadowhorn); CreateInvItem(self,itat_sharkteeth); CreateInvItem(self,itat_trolltooth); CreateInvItem(self,itat_goblinbone); CreateInvItem(self,itat_skeletonbone); CreateInvItem(self,itat_demonheart); CreateInvItem(self,itat_stonegolemheart); CreateInvItem(self,itat_firegolemheart); CreateInvItem(self,itat_icegolemheart); };
D
instance VLK_462_Thorben (Npc_Default) { // ------ NSC ------ name = "Thorben"; guild = GIL_VLK; id = 462; voice = 6; flags = 0; npctype = NPCTYPE_MAIN; // ------ Attribute ------ B_SetAttributesToChapter (self, 2); // ------ Kampf-Taktik ------ fight_tactic = FAI_HUMAN_COWARD; // ------ Equippte Waffen ------ EquipItem (self, ItMw_1h_Bau_Mace); // ------ Inventory ------ B_CreateAmbientInv (self); CreateInvItems (self, itke_lockpick, 12); // ------ visuals ------ B_SetNpcVisual (self, MALE, "Hum_Head_Bald", Face_N_Normal04, BodyTex_N,ITAR_Vlk_L); Mdl_SetModelFatness (self,1); Mdl_ApplyOverlayMds (self, "Humans_Relaxed.mds"); // ------ NSC-relevante Talente vergeben ------ B_GiveNpcTalents (self); // ------ Kampf-Talente ------ B_SetFightSkills (self, 30); // ------ TA anmelden ------ daily_routine = Rtn_Start_462; }; FUNC VOID Rtn_Start_462() { TA_Saw (06,00,09,00,"NW_CITY_MERCHANT_SHOP01_FRONT_01"); TA_Repair_Hut (09,00,13,05,"NW_CITY_MERCHANT_SHOP01_FRONT_01"); TA_Smalltalk (13,05,14,00,"NW_CITY_MERCHANT_SHOP01_FRONT_01"); TA_Repair_Hut (14,00,16,00,"NW_CITY_MERCHANT_SHOP01_FRONT_01"); TA_Saw (16,00,17,05,"NW_CITY_MERCHANT_SHOP01_FRONT_01"); TA_Smalltalk (17,05,18,00,"NW_CITY_MERCHANT_SHOP01_FRONT_01"); TA_Saw (18,00,19,00,"NW_CITY_MERCHANT_SHOP01_FRONT_01"); TA_Repair_Hut (19,00,20,00,"NW_CITY_MERCHANT_SHOP01_FRONT_01"); TA_Sit_Bench (20,00,00,00,"NW_CITY_MERCHANT_HUT_01_FRONT"); TA_Sleep (00,00,06,00,"NW_CITY_BED_BOSPER"); };
D
{ ["flags"] = { "-fvisibility=hidden" , "-O3" , "-arch" , "x86_64" , "-fpascal-strings" , "-fmessage-length=0" , "-isysroot" , "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk" , "-Qunused-arguments" } , ["program"] = "xcrun -sdk macosx clang" , ["sources"] = { "src/lua/lopcodes.c" } , ["includes"] = { "src/lua/lopcodes.c" , "src/lua/lopcodes.h" , "src/lua/llimits.h" , "src/lua/lua.h" , "src/lua/luaconf.h" } }
D
module perfontain.managers.window; import std, perfontain.misc, perfontain, perfontain.math.matrix, perfontain.opengl, utile.except, nuklear; public import derelict.sdl2.sdl; enum : ubyte { MOUSE_LEFT = 1, MOUSE_MIDDLE = 2, MOUSE_RIGHT = 4, } final: class WindowManager { void create(string title, string backend) { environment[`ANGLE_DEFAULT_PLATFORM`] = backend; { string suffix; debug suffix = `_debug`; const path = buildPath(thisExePath.dirName, ANGLE_DIR ~ suffix); version (Windows) { const ext = `dll`; } else { const ext = `so`; } environment[`SDL_VIDEO_GL_DRIVER`] = buildPath(path, `libGLESv2`.setExtension(ext)); environment[`SDL_VIDEO_EGL_DRIVER`] = buildPath(path, `libEGL`.setExtension(ext)); } SDL_Init(SDL_INIT_VIDEO) && throwSDLError; { SDL_DisplayMode mode; SDL_GetDesktopDisplayMode(0, &mode) && throwSDLError; _size = Vector2s(mode.w, mode.h); _size -= Vector2s(100, 90); } SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 8) && throwSDLError; SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 8) && throwSDLError; SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 8) && throwSDLError; SDL_GL_SetAttribute(SDL_GL_ALPHA_SIZE, 8) && throwSDLError; SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 24) && throwSDLError; SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1) && throwSDLError; // if (PE.settings.msaa) // { // !SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, 1) || throwSDLError; // !SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, MSAA_LEVEL) || throwSDLError; // } SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, OPENGL_VERSION / 10) && throwSDLError; SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, OPENGL_VERSION % 10) && throwSDLError; SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_ES) && throwSDLError; { auto f = SDL_WINDOW_OPENGL | SDL_WINDOW_RESIZABLE; if (PE.settings.fullscreen) { f |= SDL_WINDOW_FULLSCREEN_DESKTOP; } _win = SDL_CreateWindow(title.toStringz, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, _size.x, _size.y, f); _win || throwSDLError; } _ctx = SDL_GL_CreateContext(_win); hookGL; SDL_GL_SetSwapInterval(0); //SDL_GL_SetSwapInterval(1); //SDL_StopTextInput(); SDL_SetWindowMinimumSize(_win, 640, 480); onVSync(PE.settings.vsync); PE.settings.vsyncChange.permanent(&onVSync); PE.settings.fullscreenChange.permanent(&onFS); } ~this() { SDL_GL_DeleteContext(_ctx); SDL_DestroyWindow(_win); SDL_GL_UnloadLibrary(); SDL_Quit(); } @property cursor(bool v) { //!SDL_SetRelativeMouseMode(!v) || throwSDLError; } @property title(string s) { SDL_SetWindowTitle(_win, s.toStringz); } @property left() { return !!(_mouse & MOUSE_LEFT); } @property right() { return !!(_mouse & MOUSE_RIGHT); } @property middle() { return !!(_mouse & MOUSE_MIDDLE); } @property mpos() { int x, y; SDL_GetMouseState(&x, &y); return Vector2s(x, y); } package(perfontain): mixin publicProperty!(Vector2s, `size`); mixin publicProperty!(bool, `active`); mixin publicProperty!(ubyte, `mouse`); void swapBuffers() { SDL_GL_SwapWindow(_win); } auto ctx() { return PE.gui.ctx.ctx; } auto isGuiHovered() { for (auto w = ctx.begin; w; w = w.next) { if (w.flags & NK_WINDOW_NOT_INTERACTIVE) continue; //logger(*w); if (nk_input_is_mouse_hovering_rect(&ctx.input, w.bounds)) return true; } return false; //return !!nk_item_is_any_active(ctx); //return !!nk_window_is_any_hovered(ctx); } void processEvents() { auto inGui = isGuiHovered(); nk_input_begin(ctx); loop: for (SDL_Event evt; SDL_PollEvent(&evt);) switch (evt.type) { /*case SDL_MOUSEWHEEL: auto sc = Vector2s(evt.wheel.x, evt.wheel.y); if(evt.wheel.direction == SDL_MOUSEWHEEL_FLIPPED) { sc[][] *= -1; } PE.onWheel.first(sc); break; case SDL_WINDOWEVENT: switch(evt.window.event) { case SDL_WINDOWEVENT_FOCUS_GAINED: _active = _skip = true; break; case SDL_WINDOWEVENT_FOCUS_LOST: _active = false; break; case SDL_WINDOWEVENT_RESIZED: PE.onResize(_size = Vector2s(evt.window.data1, evt.window.data2)); break; default: } break;*/ case SDL_WINDOWEVENT: switch (evt.window.event) { case SDL_WINDOWEVENT_FOCUS_GAINED: //_active = _skip = true; break; case SDL_WINDOWEVENT_FOCUS_LOST: //_active = false; break; case SDL_WINDOWEVENT_SIZE_CHANGED: PE.onResize(_size = Vector2s(evt.window.data1, evt.window.data2)); break; default: } goto default; case SDL_KEYUP: case SDL_KEYDOWN: auto r = evt.key.keysym.sym; if (!evt.key.repeat) { auto st = evt.key.state == SDL_PRESSED; if (st) { _keys ~= r; } else { _keys = _keys.remove(_keys.countUntil(r)); } PE.onKey.last(r, st); } goto default; case SDL_MOUSEBUTTONUP: case SDL_MOUSEBUTTONDOWN: const map = [SDL_BUTTON_LEFT : MOUSE_LEFT, SDL_BUTTON_MIDDLE: MOUSE_MIDDLE, SDL_BUTTON_RIGHT: MOUSE_RIGHT]; auto t = map[cast(SDL_D_MouseButton)evt.button.button]; // TODO: REPORT DERELICT auto v = evt.button.state == SDL_PRESSED; //if(inGui && !(_mouse & t)) // goto default; if (!inGui || (_mouse & t)) { byFlag(_mouse, t, v); PE.onButton.first(t, v); } /*if(!v && evt.button.clicks == 2) { PE.onDoubleClick.first(t); }*/ goto default; case SDL_MOUSEMOTION: if (_skip) { _skip = false; } else { PE.onMoveDelta(Vector2s(evt.motion.xrel, evt.motion.yrel)); } PE.onMove.reverse(Vector2s(evt.motion.x, evt.motion.y)); goto default; case SDL_QUIT: PE._run = false; break loop; default: nk_sdl_handle_event(&evt); } nk_input_end(ctx); } private: mixin publicProperty!(uint[], `keys`); void onVSync(bool v) { //if(!v || SDL_GL_SetSwapInterval(-1)) { //!SDL_GL_SetSwapInterval(v) || throwSDLError; } } void onFS(bool b) { !SDL_SetWindowFullscreen(_win, b ? SDL_WINDOW_FULLSCREEN_DESKTOP : 0) || throwSDLError; } bool throwSDLError(string f = __FILE__, uint l = __LINE__) { return throwError(SDL_GetError().fromStringz, f, l); } SDL_Window* _win; SDL_GLContext _ctx; void delegate(string) _text; bool _skip; ubyte _flags; } class TextInput : RCounted { this(void delegate(string) f) { assert(!SDL_IsTextInputActive()); SDL_StartTextInput(); PEwindow._text = f; } ~this() { SDL_StopTextInput(); PEwindow._text = null; } } void showErrorMessage(string s) { SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, `Error`, s.toStringz, null); } int nk_sdl_handle_event(SDL_Event* evt) { nk_context* ctx = PE.gui.ctx.ctx; if (evt.type == SDL_KEYUP || evt.type == SDL_KEYDOWN) { /* key events */ bool down = evt.type == SDL_KEYDOWN; const Uint8* state = SDL_GetKeyboardState(null); SDL_Keycode sym = evt.key.keysym.sym; if (sym == SDLK_RSHIFT || sym == SDLK_LSHIFT) nk_input_key(ctx, NK_KEY_SHIFT, down); else if (sym == SDLK_DELETE) nk_input_key(ctx, NK_KEY_DEL, down); else if (sym == SDLK_RETURN) nk_input_key(ctx, NK_KEY_ENTER, down); else if (sym == SDLK_TAB) nk_input_key(ctx, NK_KEY_TAB, down); else if (sym == SDLK_BACKSPACE) nk_input_key(ctx, NK_KEY_BACKSPACE, down); else if (sym == SDLK_HOME) { nk_input_key(ctx, NK_KEY_TEXT_START, down); nk_input_key(ctx, NK_KEY_SCROLL_START, down); } else if (sym == SDLK_END) { nk_input_key(ctx, NK_KEY_TEXT_END, down); nk_input_key(ctx, NK_KEY_SCROLL_END, down); } else if (sym == SDLK_PAGEDOWN) { nk_input_key(ctx, NK_KEY_SCROLL_DOWN, down); } else if (sym == SDLK_PAGEUP) { nk_input_key(ctx, NK_KEY_SCROLL_UP, down); } else if (sym == SDLK_z) nk_input_key(ctx, NK_KEY_TEXT_UNDO, down && state[SDL_SCANCODE_LCTRL]); else if (sym == SDLK_r) nk_input_key(ctx, NK_KEY_TEXT_REDO, down && state[SDL_SCANCODE_LCTRL]); else if (sym == SDLK_c) nk_input_key(ctx, NK_KEY_COPY, down && state[SDL_SCANCODE_LCTRL]); else if (sym == SDLK_v) nk_input_key(ctx, NK_KEY_PASTE, down && state[SDL_SCANCODE_LCTRL]); else if (sym == SDLK_x) nk_input_key(ctx, NK_KEY_CUT, down && state[SDL_SCANCODE_LCTRL]); else if (sym == SDLK_b) nk_input_key(ctx, NK_KEY_TEXT_LINE_START, down && state[SDL_SCANCODE_LCTRL]); else if (sym == SDLK_e) nk_input_key(ctx, NK_KEY_TEXT_LINE_END, down && state[SDL_SCANCODE_LCTRL]); else if (sym == SDLK_UP) nk_input_key(ctx, NK_KEY_UP, down); else if (sym == SDLK_DOWN) nk_input_key(ctx, NK_KEY_DOWN, down); else if (sym == SDLK_LEFT) { if (state[SDL_SCANCODE_LCTRL]) nk_input_key(ctx, NK_KEY_TEXT_WORD_LEFT, down); else nk_input_key(ctx, NK_KEY_LEFT, down); } else if (sym == SDLK_RIGHT) { if (state[SDL_SCANCODE_LCTRL]) nk_input_key(ctx, NK_KEY_TEXT_WORD_RIGHT, down); else nk_input_key(ctx, NK_KEY_RIGHT, down); } else return 0; return 1; } else if (evt.type == SDL_MOUSEBUTTONDOWN || evt.type == SDL_MOUSEBUTTONUP) { /* mouse button */ bool down = evt.type == SDL_MOUSEBUTTONDOWN; const int x = evt.button.x, y = evt.button.y; if (evt.button.button == SDL_BUTTON_LEFT) { if (evt.button.clicks > 1) nk_input_button(ctx, NK_BUTTON_DOUBLE, x, y, down); nk_input_button(ctx, NK_BUTTON_LEFT, x, y, down); } else if (evt.button.button == SDL_BUTTON_MIDDLE) nk_input_button(ctx, NK_BUTTON_MIDDLE, x, y, down); else if (evt.button.button == SDL_BUTTON_RIGHT) nk_input_button(ctx, NK_BUTTON_RIGHT, x, y, down); return 1; } else if (evt.type == SDL_MOUSEMOTION) { /* mouse motion */ if (ctx.input.mouse.grabbed) { int x = cast(int)ctx.input.mouse.prev.x, y = cast(int)ctx.input.mouse.prev.y; nk_input_motion(ctx, x + evt.motion.xrel, y + evt.motion.yrel); } else nk_input_motion(ctx, evt.motion.x, evt.motion.y); return 1; } else if (evt.type == SDL_TEXTINPUT) { /* text input */ nk_glyph glyph; import core.stdc.string; memcpy(glyph.ptr, evt.text.text.ptr, NK_UTF_SIZE); nk_input_glyph(ctx, glyph.ptr); return 1; } else if (evt.type == SDL_MOUSEWHEEL) { /* mouse wheel */ nk_input_scroll(ctx, nk_vec2(cast(float)evt.wheel.x, cast(float)evt.wheel.y)); return 1; } return 0; }
D
module android.java.android.graphics.drawable.Animatable2_AnimationCallback; public import android.java.android.graphics.drawable.Animatable2_AnimationCallback_d_interface; import arsd.jni : ImportExportImpl; mixin ImportExportImpl!Animatable2_AnimationCallback; import import1 = android.java.java.lang.Class;
D
module directx.d2d1_1; //--------------------------------------------------------------------------- // Copyright (c) Microsoft Corporation. All rights reserved. // // This file is automatically generated. Please do not edit it directly. // // File name: D2D1_1.h //--------------------------------------------------------------------------- version(Windows): public import directx.com; public import directx.d2d1; public import directx.d2d1effects; public import directx.dxgi; public import directx.dwrite, directx.wincodec; import directx.d2d1effectauthor; import core.sys.windows.objidl; /// <summary> /// Function pointer to construct a new effect once registered. /// </summary> alias PD2D1_EFFECT_FACTORY = extern(Windows) HRESULT function(IUnknown* effectImpl); enum D2D1_INVALID_PROPERTY_INDEX = uint.max; alias D2D1_RECT_L = D2D_RECT_L; alias D2D1_POINT_2L = D2D_POINT_2L; /// <summary> /// This defines the valid property types that can be used in an effect property /// interface. /// </summary> alias D2D1_PROPERTY_TYPE = uint; enum : D2D1_PROPERTY_TYPE { D2D1_PROPERTY_TYPE_UNKNOWN = 0, D2D1_PROPERTY_TYPE_STRING = 1, D2D1_PROPERTY_TYPE_BOOL = 2, D2D1_PROPERTY_TYPE_UINT32 = 3, D2D1_PROPERTY_TYPE_INT32 = 4, D2D1_PROPERTY_TYPE_FLOAT = 5, D2D1_PROPERTY_TYPE_VECTOR2 = 6, D2D1_PROPERTY_TYPE_VECTOR3 = 7, D2D1_PROPERTY_TYPE_VECTOR4 = 8, D2D1_PROPERTY_TYPE_BLOB = 9, D2D1_PROPERTY_TYPE_IUNKNOWN = 10, D2D1_PROPERTY_TYPE_ENUM = 11, D2D1_PROPERTY_TYPE_ARRAY = 12, D2D1_PROPERTY_TYPE_CLSID = 13, D2D1_PROPERTY_TYPE_MATRIX_3X2 = 14, D2D1_PROPERTY_TYPE_MATRIX_4X3 = 15, D2D1_PROPERTY_TYPE_MATRIX_4X4 = 16, D2D1_PROPERTY_TYPE_MATRIX_5X4 = 17, D2D1_PROPERTY_TYPE_COLOR_CONTEXT = 18, D2D1_PROPERTY_TYPE_FORCE_DWORD = 0xffffffff } /// <summary> /// This defines the list of system properties present on the root effect property /// interface. /// </summary> alias D2D1_PROPERTY = uint; enum : D2D1_PROPERTY { D2D1_PROPERTY_CLSID = 0x80000000, D2D1_PROPERTY_DISPLAYNAME = 0x80000001, D2D1_PROPERTY_AUTHOR = 0x80000002, D2D1_PROPERTY_CATEGORY = 0x80000003, D2D1_PROPERTY_DESCRIPTION = 0x80000004, D2D1_PROPERTY_INPUTS = 0x80000005, D2D1_PROPERTY_CACHED = 0x80000006, D2D1_PROPERTY_PRECISION = 0x80000007, D2D1_PROPERTY_MIN_INPUTS = 0x80000008, D2D1_PROPERTY_MAX_INPUTS = 0x80000009 } /// <summary> /// This defines the indices of sub-properties that may be present on any parent /// property. /// </summary> alias D2D1_SUBPROPERTY = uint; enum : D2D1_SUBPROPERTY { D2D1_SUBPROPERTY_DISPLAYNAME = 0x80000000, D2D1_SUBPROPERTY_ISREADONLY = 0x80000001, D2D1_SUBPROPERTY_MIN = 0x80000002, D2D1_SUBPROPERTY_MAX = 0x80000003, D2D1_SUBPROPERTY_DEFAULT = 0x80000004, D2D1_SUBPROPERTY_FIELDS = 0x80000005, D2D1_SUBPROPERTY_INDEX = 0x80000006 } /// <summary> /// Specifies how the bitmap can be used. /// </summary> alias D2D1_BITMAP_OPTIONS = uint; enum : D2D1_BITMAP_OPTIONS { /// <summary> /// The bitmap is created with default properties. /// </summary> D2D1_BITMAP_OPTIONS_NONE = 0x00000000, /// <summary> /// The bitmap can be specified as a target in ID2D1DeviceContext::SetTarget /// </summary> D2D1_BITMAP_OPTIONS_TARGET = 0x00000001, /// <summary> /// The bitmap cannot be used as an input to DrawBitmap, DrawImage, in a bitmap /// brush or as an input to an effect. /// </summary> D2D1_BITMAP_OPTIONS_CANNOT_DRAW = 0x00000002, /// <summary> /// The bitmap can be read from the CPU. /// </summary> D2D1_BITMAP_OPTIONS_CPU_READ = 0x00000004, /// <summary> /// The bitmap works with the ID2D1GdiInteropRenderTarget::GetDC API. /// </summary> D2D1_BITMAP_OPTIONS_GDI_COMPATIBLE = 0x00000008 } /// <summary> /// Specifies the composite mode that will be applied. /// </summary> alias D2D1_COMPOSITE_MODE = uint; enum : D2D1_COMPOSITE_MODE { D2D1_COMPOSITE_MODE_SOURCE_OVER = 0, D2D1_COMPOSITE_MODE_DESTINATION_OVER = 1, D2D1_COMPOSITE_MODE_SOURCE_IN = 2, D2D1_COMPOSITE_MODE_DESTINATION_IN = 3, D2D1_COMPOSITE_MODE_SOURCE_OUT = 4, D2D1_COMPOSITE_MODE_DESTINATION_OUT = 5, D2D1_COMPOSITE_MODE_SOURCE_ATOP = 6, D2D1_COMPOSITE_MODE_DESTINATION_ATOP = 7, D2D1_COMPOSITE_MODE_XOR = 8, D2D1_COMPOSITE_MODE_PLUS = 9, D2D1_COMPOSITE_MODE_SOURCE_COPY = 10, D2D1_COMPOSITE_MODE_BOUNDED_SOURCE_COPY = 11, D2D1_COMPOSITE_MODE_MASK_INVERT = 12 } /// <summary> /// This specifies the precision that should be used in buffers allocated by D2D. /// </summary> alias D2D1_BUFFER_PRECISION = uint; enum : D2D1_BUFFER_PRECISION { D2D1_BUFFER_PRECISION_UNKNOWN = 0, D2D1_BUFFER_PRECISION_8BPC_UNORM = 1, D2D1_BUFFER_PRECISION_8BPC_UNORM_SRGB = 2, D2D1_BUFFER_PRECISION_16BPC_UNORM = 3, D2D1_BUFFER_PRECISION_16BPC_FLOAT = 4, D2D1_BUFFER_PRECISION_32BPC_FLOAT = 5 } /// <summary> /// This describes how the individual mapping operation should be performed. /// </summary> alias D2D1_MAP_OPTIONS = uint; enum : D2D1_MAP_OPTIONS { /// <summary> /// The mapped pointer has undefined behavior. /// </summary> D2D1_MAP_OPTIONS_NONE = 0, /// <summary> /// The mapped pointer can be read from. /// </summary> D2D1_MAP_OPTIONS_READ = 1, /// <summary> /// The mapped pointer can be written to. /// </summary> D2D1_MAP_OPTIONS_WRITE = 2, /// <summary> /// The previous contents of the bitmap are discarded when it is mapped. /// </summary> D2D1_MAP_OPTIONS_DISCARD = 4 } /// <summary> /// This is used to specify the quality of image scaling with /// ID2D1DeviceContext::DrawImage and with the 2D Affine Transform Effect. /// </summary> alias D2D1_INTERPOLATION_MODE = uint; enum : D2D1_INTERPOLATION_MODE { D2D1_INTERPOLATION_MODE_NEAREST_NEIGHBOR = D2D1_INTERPOLATION_MODE_DEFINITION_NEAREST_NEIGHBOR, D2D1_INTERPOLATION_MODE_LINEAR = D2D1_INTERPOLATION_MODE_DEFINITION_LINEAR, D2D1_INTERPOLATION_MODE_CUBIC = D2D1_INTERPOLATION_MODE_DEFINITION_CUBIC, D2D1_INTERPOLATION_MODE_MULTI_SAMPLE_LINEAR = D2D1_INTERPOLATION_MODE_DEFINITION_MULTI_SAMPLE_LINEAR, D2D1_INTERPOLATION_MODE_ANISOTROPIC = D2D1_INTERPOLATION_MODE_DEFINITION_ANISOTROPIC, D2D1_INTERPOLATION_MODE_HIGH_QUALITY_CUBIC = D2D1_INTERPOLATION_MODE_DEFINITION_HIGH_QUALITY_CUBIC } /// <summary> /// This specifies what units should be accepted by the D2D API. /// </summary> alias D2D1_UNIT_MODE = uint; enum : D2D1_UNIT_MODE { D2D1_UNIT_MODE_DIPS = 0, D2D1_UNIT_MODE_PIXELS = 1 } /// <summary> /// Defines a color space. /// </summary> alias D2D1_COLOR_SPACE = uint; enum : D2D1_COLOR_SPACE { /// <summary> /// The color space is described by accompanying data, such as a color profile. /// </summary> D2D1_COLOR_SPACE_CUSTOM = 0, /// <summary> /// The sRGB color space. /// </summary> D2D1_COLOR_SPACE_SRGB = 1, /// <summary> /// The scRGB color space. /// </summary> D2D1_COLOR_SPACE_SCRGB = 2 } /// <summary> /// This specifies options that apply to the device context for its lifetime. /// </summary> alias D2D1_DEVICE_CONTEXT_OPTIONS = uint; enum : D2D1_DEVICE_CONTEXT_OPTIONS { D2D1_DEVICE_CONTEXT_OPTIONS_NONE = 0, /// <summary> /// Geometry rendering will be performed on many threads in parallel, a single /// thread is the default. /// </summary> D2D1_DEVICE_CONTEXT_OPTIONS_ENABLE_MULTITHREADED_OPTIMIZATIONS = 1 } /// <summary> /// Defines how the world transform, dots per inch (dpi), and stroke width affect /// the shape of the pen used to stroke a primitive. /// </summary> alias D2D1_STROKE_TRANSFORM_TYPE = uint; enum : D2D1_STROKE_TRANSFORM_TYPE { /// <summary> /// The stroke respects the world transform, the DPI, and the stroke width. /// </summary> D2D1_STROKE_TRANSFORM_TYPE_NORMAL = 0, /// <summary> /// The stroke does not respect the world transform, but it does respect the DPI and /// the stroke width. /// </summary> D2D1_STROKE_TRANSFORM_TYPE_FIXED = 1, /// <summary> /// The stroke is forced to one pixel wide. /// </summary> D2D1_STROKE_TRANSFORM_TYPE_HAIRLINE = 2 } /// <summary> /// A blend mode that applies to all primitives drawn on the context. /// </summary> alias D2D1_PRIMITIVE_BLEND = uint; enum : D2D1_PRIMITIVE_BLEND { D2D1_PRIMITIVE_BLEND_SOURCE_OVER = 0, D2D1_PRIMITIVE_BLEND_COPY = 1, D2D1_PRIMITIVE_BLEND_MIN = 2, D2D1_PRIMITIVE_BLEND_ADD = 3, D2D1_PRIMITIVE_BLEND_MAX = 4 } /// <summary> /// This specifies the threading mode used while simultaneously creating the device, /// factory, and device context. /// </summary> alias D2D1_THREADING_MODE = uint; enum : D2D1_THREADING_MODE { /// <summary> /// Resources may only be invoked serially. Reference counts on resources are /// interlocked, however, resource and render target state is not protected from /// multi-threaded access /// </summary> D2D1_THREADING_MODE_SINGLE_THREADED = D2D1_FACTORY_TYPE_SINGLE_THREADED, /// <summary> /// Resources may be invoked from multiple threads. Resources use interlocked /// reference counting and their state is protected. /// </summary> D2D1_THREADING_MODE_MULTI_THREADED = D2D1_FACTORY_TYPE_MULTI_THREADED } /// <summary> /// This specifies how colors are interpolated. /// </summary> alias D2D1_COLOR_INTERPOLATION_MODE = uint; enum : D2D1_COLOR_INTERPOLATION_MODE { /// <summary> /// Colors will be interpolated in straight alpha space. /// </summary> D2D1_COLOR_INTERPOLATION_MODE_STRAIGHT = 0, /// <summary> /// Colors will be interpolated in premultiplied alpha space. /// </summary> D2D1_COLOR_INTERPOLATION_MODE_PREMULTIPLIED = 1 } alias D2D1_VECTOR_2F = D2D_VECTOR_2F; alias D2D1_VECTOR_3F = D2D_VECTOR_3F; alias D2D1_VECTOR_4F = D2D_VECTOR_4F; /// <summary> /// Extended bitmap properties. /// </summary> struct D2D1_BITMAP_PROPERTIES1 { D2D1_PIXEL_FORMAT pixelFormat; FLOAT dpiX; FLOAT dpiY; /// <summary> /// Specifies how the bitmap can be used. /// </summary> D2D1_BITMAP_OPTIONS bitmapOptions; ID2D1ColorContext colorContext; } /// <summary> /// Describes mapped memory from the ID2D1Bitmap1::Map API. /// </summary> struct D2D1_MAPPED_RECT { UINT32 pitch; BYTE* bits; } /// <summary> /// This controls advanced settings of the Direct2D imaging pipeline. /// </summary> struct D2D1_RENDERING_CONTROLS { /// <summary> /// The default buffer precision, used if the precision isn't otherwise specified. /// </summary> D2D1_BUFFER_PRECISION bufferPrecision; /// <summary> /// The size of allocated tiles used to render imaging effects. /// </summary> D2D1_SIZE_U tileSize; } /// <summary> /// This identifies a certain input connection of a certain effect. /// </summary> struct D2D1_EFFECT_INPUT_DESCRIPTION { /// <summary> /// The effect whose input connection is being specified. /// </summary> ID2D1Effect effect; /// <summary> /// The index of the input connection into the specified effect. /// </summary> UINT32 inputIndex; /// <summary> /// The rectangle which would be available on the specified input connection during /// render operations. /// </summary> D2D1_RECT_F inputRectangle; } alias D2D1_MATRIX_4X3_F = D2D_MATRIX_4X3_F; alias D2D1_MATRIX_4X4_F = D2D_MATRIX_4X4_F; alias D2D1_MATRIX_5X4_F = D2D_MATRIX_5X4_F; /// <summary> /// Describes a point along a path. /// </summary> struct D2D1_POINT_DESCRIPTION { D2D1_POINT_2F point; D2D1_POINT_2F unitTangentVector; UINT32 endSegment; UINT32 endFigure; FLOAT lengthToEndSegment; } /// <summary> /// Creation properties for an image brush. /// </summary> struct D2D1_IMAGE_BRUSH_PROPERTIES { D2D1_RECT_F sourceRectangle; D2D1_EXTEND_MODE extendModeX; D2D1_EXTEND_MODE extendModeY; D2D1_INTERPOLATION_MODE interpolationMode; } /// <summary> /// Describes the extend modes and the interpolation mode of an ID2D1BitmapBrush. /// </summary> struct D2D1_BITMAP_BRUSH_PROPERTIES1 { D2D1_EXTEND_MODE extendModeX; D2D1_EXTEND_MODE extendModeY; D2D1_INTERPOLATION_MODE interpolationMode; } /// <summary> /// This defines how geometries should be drawn and widened. /// </summary> struct D2D1_STROKE_STYLE_PROPERTIES1 { D2D1_CAP_STYLE startCap; D2D1_CAP_STYLE endCap; D2D1_CAP_STYLE dashCap; D2D1_LINE_JOIN lineJoin; FLOAT miterLimit; D2D1_DASH_STYLE dashStyle; FLOAT dashOffset; /// <summary> /// How the nib of the stroke is influenced by the context properties. /// </summary> D2D1_STROKE_TRANSFORM_TYPE transformType; } /// <summary> /// Specifies how the layer contents should be prepared. /// </summary> alias D2D1_LAYER_OPTIONS1 = uint; enum : D2D1_LAYER_OPTIONS1 { D2D1_LAYER_OPTIONS1_NONE = 0, D2D1_LAYER_OPTIONS1_INITIALIZE_FROM_BACKGROUND = 1, D2D1_LAYER_OPTIONS1_IGNORE_ALPHA = 2 } /// <summary> /// All parameters related to pushing a layer. /// </summary> struct D2D1_LAYER_PARAMETERS1 { D2D1_RECT_F contentBounds; ID2D1Geometry geometricMask; D2D1_ANTIALIAS_MODE maskAntialiasMode; D2D1_MATRIX_3X2_F maskTransform; FLOAT opacity; ID2D1Brush opacityBrush; D2D1_LAYER_OPTIONS1 layerOptions; } /// <summary> /// Defines when font resources should be subset during printing. /// </summary> alias D2D1_PRINT_FONT_SUBSET_MODE = uint; enum : D2D1_PRINT_FONT_SUBSET_MODE { /// <summary> /// Subset for used glyphs, send and discard font resource after every five pages /// </summary> D2D1_PRINT_FONT_SUBSET_MODE_DEFAULT = 0, /// <summary> /// Subset for used glyphs, send and discard font resource after each page /// </summary> D2D1_PRINT_FONT_SUBSET_MODE_EACHPAGE = 1, /// <summary> /// Do not subset, reuse font for all pages, send it after first page /// </summary> D2D1_PRINT_FONT_SUBSET_MODE_NONE = 2 } /// <summary> /// This describes the drawing state. /// </summary> struct D2D1_DRAWING_STATE_DESCRIPTION1 { D2D1_ANTIALIAS_MODE antialiasMode; D2D1_TEXT_ANTIALIAS_MODE textAntialiasMode; D2D1_TAG tag1; D2D1_TAG tag2; D2D1_MATRIX_3X2_F transform; D2D1_PRIMITIVE_BLEND primitiveBlend; D2D1_UNIT_MODE unitMode; } /// <summary> /// The creation properties for a ID2D1PrintControl object. /// </summary> struct D2D1_PRINT_CONTROL_PROPERTIES { D2D1_PRINT_FONT_SUBSET_MODE fontSubset; /// <summary> /// DPI for rasterization of all unsupported D2D commands or options, defaults to /// 150.0 /// </summary> FLOAT rasterDPI; /// <summary> /// Color space for vector graphics in XPS package /// </summary> D2D1_COLOR_SPACE colorSpace; } /// <summary> /// This specifies the options while simultaneously creating the device, factory, /// and device context. /// </summary> struct D2D1_CREATION_PROPERTIES { /// <summary> /// Describes locking behavior of D2D resources /// </summary> D2D1_THREADING_MODE threadingMode; D2D1_DEBUG_LEVEL debugLevel; D2D1_DEVICE_CONTEXT_OPTIONS options; } mixin(uuid!(ID2D1GdiMetafileSink, "82237326-8111-4f7c-bcf4-b5c1175564fe")); /// <summary> /// User-implementable interface for introspecting on a metafile. /// </summary> interface ID2D1GdiMetafileSink : IUnknown { extern(Windows): /// <summary> /// Callback for examining a metafile record. /// </summary> HRESULT ProcessRecord( DWORD recordType, const(void)* recordData, DWORD recordDataSize ); } // interface ID2D1GdiMetafileSink mixin(uuid!(ID2D1GdiMetafile, "2f543dc3-cfc1-4211-864f-cfd91c6f3395")); /// <summary> /// Interface encapsulating a GDI/GDI+ metafile. /// </summary> interface ID2D1GdiMetafile : ID2D1Resource { extern(Windows): /// <summary> /// Play the metafile into a caller-supplied sink interface. /// </summary> HRESULT Stream(ID2D1GdiMetafileSink sink); /// <summary> /// Gets the bounds of the metafile. /// </summary> HRESULT GetBounds(D2D1_RECT_F* bounds); } // interface ID2D1GdiMetafile mixin(uuid!(ID2D1CommandSink, "54d7898a-a061-40a7-bec7-e465bcba2c4f")); /// <summary> /// Caller-supplied implementation of an interface to receive the recorded command /// list. /// </summary> interface ID2D1CommandSink : IUnknown { extern(Windows): HRESULT BeginDraw(); HRESULT EndDraw(); HRESULT SetAntialiasMode(D2D1_ANTIALIAS_MODE antialiasMode); HRESULT SetTags(D2D1_TAG tag1, D2D1_TAG tag2); HRESULT SetTextAntialiasMode(D2D1_TEXT_ANTIALIAS_MODE textAntialiasMode); HRESULT SetTextRenderingParams(IDWriteRenderingParams textRenderingParams); HRESULT SetTransform(const(D2D1_MATRIX_3X2_F)* transform); HRESULT SetPrimitiveBlend(D2D1_PRIMITIVE_BLEND primitiveBlend); HRESULT SetUnitMode(D2D1_UNIT_MODE unitMode); HRESULT Clear(const(D2D1_COLOR_F)* color); HRESULT DrawGlyphRun( D2D1_POINT_2F baselineOrigin, const(DWRITE_GLYPH_RUN)* glyphRun, const(DWRITE_GLYPH_RUN_DESCRIPTION)* glyphRunDescription, ID2D1Brush foregroundBrush, DWRITE_MEASURING_MODE measuringMode ); HRESULT DrawLine( D2D1_POINT_2F point0, D2D1_POINT_2F point1, ID2D1Brush brush, FLOAT strokeWidth, ID2D1StrokeStyle strokeStyle ); HRESULT DrawGeometry( ID2D1Geometry geometry, ID2D1Brush brush, FLOAT strokeWidth, ID2D1StrokeStyle strokeStyle ); HRESULT DrawRectangle( const(D2D1_RECT_F)* rect, ID2D1Brush brush, FLOAT strokeWidth, ID2D1StrokeStyle strokeStyle ); HRESULT DrawBitmap( ID2D1Bitmap bitmap, const(D2D1_RECT_F)* destinationRectangle, FLOAT opacity, D2D1_INTERPOLATION_MODE interpolationMode, const(D2D1_RECT_F)* sourceRectangle, const(D2D1_MATRIX_4X4_F)* perspectiveTransform ); HRESULT DrawImage( ID2D1Image image, const(D2D1_POINT_2F)* targetOffset, const(D2D1_RECT_F)* imageRectangle, D2D1_INTERPOLATION_MODE interpolationMode, D2D1_COMPOSITE_MODE compositeMode ); HRESULT DrawGdiMetafile( ID2D1GdiMetafile gdiMetafile, const(D2D1_POINT_2F)* targetOffset ); HRESULT FillMesh( ID2D1Mesh mesh, ID2D1Brush brush ); HRESULT FillOpacityMask( ID2D1Bitmap opacityMask, ID2D1Brush brush, const(D2D1_RECT_F)* destinationRectangle, const(D2D1_RECT_F)* sourceRectangle ); HRESULT FillGeometry( ID2D1Geometry geometry, ID2D1Brush brush, ID2D1Brush opacityBrush ); HRESULT FillRectangle( const(D2D1_RECT_F)* rect, ID2D1Brush brush ); HRESULT PushAxisAlignedClip( const(D2D1_RECT_F)* clipRect, D2D1_ANTIALIAS_MODE antialiasMode ); HRESULT PushLayer( const(D2D1_LAYER_PARAMETERS1)* layerParameters1, ID2D1Layer layer ); HRESULT PopAxisAlignedClip(); HRESULT PopLayer(); } // interface ID2D1CommandSink mixin(uuid!(ID2D1CommandList, "b4f34a19-2383-4d76-94f6-ec343657c3dc")); /// <summary> /// The commandList interface. /// </summary> interface ID2D1CommandList : ID2D1Image { extern(Windows): /// <summary> /// Play the command list into a caller-supplied sink interface. /// </summary> HRESULT Stream(ID2D1CommandSink sink); /// <summary> /// Marks the command list as ready for use. /// </summary> HRESULT Close(); } // interface ID2D1CommandList mixin(uuid!(ID2D1PrintControl, "2c1d867d-c290-41c8-ae7e-34a98702e9a5")); /// <summary> /// Converts Direct2D primitives stored in an ID2D1CommandList into a fixed page /// representation. The print sub-system then consumes the primitives. /// </summary> interface ID2D1PrintControl : IUnknown { extern(Windows): HRESULT AddPage( ID2D1CommandList commandList, D2D_SIZE_F pageSize, IStream pagePrintTicketStream, D2D1_TAG* tag1 = null, D2D1_TAG* tag2 = null ); HRESULT Close(); } // interface ID2D1PrintControl mixin(uuid!(ID2D1ImageBrush, "fe9e984d-3f95-407c-b5db-cb94d4e8f87c")); /// <summary> /// Provides a brush that can take any effect, command list or bitmap and use it to /// fill a 2D shape. /// </summary> interface ID2D1ImageBrush : ID2D1Brush { extern(Windows): void SetImage(ID2D1Image image); void SetExtendModeX(D2D1_EXTEND_MODE extendModeX); void SetExtendModeY(D2D1_EXTEND_MODE extendModeY); void SetInterpolationMode(D2D1_INTERPOLATION_MODE interpolationMode); void SetSourceRectangle(const(D2D1_RECT_F)* sourceRectangle); void GetImage(ID2D1Image **image) const; D2D1_EXTEND_MODE GetExtendModeX() const; D2D1_EXTEND_MODE GetExtendModeY() const; D2D1_INTERPOLATION_MODE GetInterpolationMode() const; void GetSourceRectangle(D2D1_RECT_F* sourceRectangle) const; } // interface ID2D1ImageBrush mixin(uuid!(ID2D1BitmapBrush1, "41343a53-e41a-49a2-91cd-21793bbb62e5")); /// <summary> /// A bitmap brush allows a bitmap to be used to fill a geometry. Interpolation /// mode is specified with D2D1_INTERPOLATION_MODE /// </summary> interface ID2D1BitmapBrush1 : ID2D1BitmapBrush { extern(Windows): /// <summary> /// Sets the interpolation mode used when this brush is used. /// </summary> void SetInterpolationMode1(D2D1_INTERPOLATION_MODE interpolationMode); D2D1_INTERPOLATION_MODE GetInterpolationMode1() const; } // interface ID2D1BitmapBrush1 mixin(uuid!(ID2D1StrokeStyle1, "10a72a66-e91c-43f4-993f-ddf4b82b0b4a")); /// <summary> /// Extends a stroke style to allow nominal width strokes. /// </summary> interface ID2D1StrokeStyle1 : ID2D1StrokeStyle { extern(Windows): D2D1_STROKE_TRANSFORM_TYPE GetStrokeTransformType() const; } // interface ID2D1StrokeStyle1 mixin(uuid!(ID2D1PathGeometry1, "62baa2d2-ab54-41b7-b872-787e0106a421")); /// <summary> /// The ID2D1PathGeometry1 interface adds functionality to ID2D1PathGeometry. In /// particular, it provides the path geometry-specific /// ComputePointAndSegmentAtLength method. /// </summary> interface ID2D1PathGeometry1 : ID2D1PathGeometry { extern(Windows): HRESULT ComputePointAndSegmentAtLength( FLOAT length, UINT32 startSegment, const(D2D1_MATRIX_3X2_F)* worldTransform, FLOAT flatteningTolerance, D2D1_POINT_DESCRIPTION* pointDescription ) const; final HRESULT ComputePointAndSegmentAtLength( FLOAT length, UINT32 startSegment, const D2D1_MATRIX_3X2_F worldTransform, FLOAT flatteningTolerance, D2D1_POINT_DESCRIPTION pointDescription ) const { return ComputePointAndSegmentAtLength(length, startSegment, &worldTransform, flatteningTolerance, &pointDescription); } final HRESULT ComputePointAndSegmentAtLength( FLOAT length, UINT32 startSegment, const(D2D1_MATRIX_3X2_F)* worldTransform, D2D1_POINT_DESCRIPTION* pointDescription ) const { return ComputePointAndSegmentAtLength(length, startSegment, worldTransform, D2D1_DEFAULT_FLATTENING_TOLERANCE, pointDescription); } final HRESULT ComputePointAndSegmentAtLength( FLOAT length, UINT32 startSegment, const(D2D1_MATRIX_3X2_F) worldTransform, D2D1_POINT_DESCRIPTION* pointDescription ) const { return ComputePointAndSegmentAtLength(length, startSegment, &worldTransform, D2D1_DEFAULT_FLATTENING_TOLERANCE, pointDescription); } } // interface ID2D1PathGeometry1 mixin(uuid!(ID2D1Properties, "483473d7-cd46-4f9d-9d3a-3112aa80159d")); /// <summary> /// Represents a set of run-time bindable and discoverable properties that allow a /// data-driven application to modify the state of a Direct2D effect. /// </summary> interface ID2D1Properties : IUnknown { extern(Windows): /// <summary> /// Returns the total number of custom properties in this interface. /// </summary> UINT32 GetPropertyCount() const; /// <summary> /// Retrieves the property name from the given property index. /// </summary> HRESULT GetPropertyName( UINT32 index, PWSTR name, UINT32 nameCount ) const; /// <summary> /// Returns the length of the property name from the given index. /// </summary> UINT32 GetPropertyNameLength(UINT32 index) const; /// <summary> /// Retrieves the type of the given property. /// </summary> D2D1_PROPERTY_TYPE GetType(UINT32 index) const; /// <summary> /// Retrieves the property index for the given property name. /// </summary> UINT32 GetPropertyIndex(PCWSTR name) const; /// <summary> /// Sets the value of the given property using its name. /// </summary> HRESULT SetValueByName( PCWSTR name, D2D1_PROPERTY_TYPE type, const(BYTE)* data, UINT32 dataSize ); /// <summary> /// Sets the given value using the property index. /// </summary> HRESULT SetValue( UINT32 index, D2D1_PROPERTY_TYPE type, const(BYTE)* data, UINT32 dataSize ); /// <summary> /// Retrieves the given property or sub-property by name. '.' is the delimiter for /// sub-properties. /// </summary> HRESULT GetValueByName( PCWSTR name, D2D1_PROPERTY_TYPE type, BYTE* data, UINT32 dataSize ) const; /// <summary> /// Retrieves the given value by index. /// </summary> HRESULT GetValue( UINT32 index, D2D1_PROPERTY_TYPE type, BYTE* data, UINT32 dataSize ) const; /// <summary> /// Returns the value size for the given property index. /// </summary> UINT32 GetValueSize(UINT32 index) const; /// <summary> /// Retrieves the sub-properties of the given property by index. /// </summary> HRESULT GetSubProperties( UINT32 index, ID2D1Properties *subProperties ) const; final HRESULT SetValueByName( PCWSTR name, const(BYTE)* data, UINT32 dataSize ) { return SetValueByName(name, D2D1_PROPERTY_TYPE_UNKNOWN, data, dataSize); } final HRESULT SetValue( UINT32 index, const(BYTE)* data, UINT32 dataSize ) { return SetValue(index, D2D1_PROPERTY_TYPE_UNKNOWN, data, dataSize); } final HRESULT GetValueByName( PCWSTR name, BYTE* data, UINT32 dataSize ) const { return GetValueByName(name, D2D1_PROPERTY_TYPE_UNKNOWN, data, dataSize); } final HRESULT GetValue( UINT32 index, BYTE* data, UINT32 dataSize ) const { return GetValue(index, D2D1_PROPERTY_TYPE_UNKNOWN, data, dataSize); } // // Templatized helper functions: // final HRESULT GetValueByName(T)( PCWSTR propertyName, T *value ) const { return GetValueByName(propertyName, cast(BYTE*)value, T.sizeof); } final T GetValueByName(T)(PCWSTR propertyName) const { T value; HRESULT ignoreHr = GetValueByName(propertyName, cast(BYTE*)&value, T.sizeof); UNREFERENCED_PARAMETER(ignoreHr); return value; } final HRESULT SetValueByName(T)( PCWSTR propertyName, const T value ) { return SetValueByName(propertyName, cast(const(BYTE)*)&value, T.sizeof); } final HRESULT GetValue(U)( U index, BYTE* data, UINT32 dataSize ) const { return GetValue(cast(UINT32)index, data, dataSize); } final HRESULT GetValue(T, U)(U index, T* value) const { return GetValue(cast(UINT32)index, cast(BYTE*)value, T.sizeof); } final T GetValue(T, U)(U index) const { T value; HRESULT ignoreHr = GetValue(cast(UINT32)index, cast(BYTE*)&value, T.sizeof); // Unreferenced variable: ignoreHr; return value; } final HRESULT SetValue(U)(U index, const(BYTE)* data, UINT32 dataSize) { return SetValue(cast(UINT32)index, data, dataSize); } final HRESULT SetValue(T, U)(U index, const T value) { return SetValue(cast(UINT32)index, cast(const(BYTE)*)&value, T.sizeof); } final HRESULT GetPropertyName(U)(U index, PWSTR name, UINT32 nameCount) const { return GetPropertyName(cast(UINT32)index, name, nameCount); } final UINT32 GetPropertyNameLength(U)(U index) const { return GetPropertyNameLength(cast(UINT32)index); } final D2D1_PROPERTY_TYPE GetType(U)(U index) const { return GetType(cast(UINT32)index); } final UINT32 GetValueSize(U)(U index) const { return GetValueSize(cast(UINT32)index); } final HRESULT GetSubProperties(U)(U index, out ID2D1Properties subProperties) const { return GetSubProperties(cast(UINT32)index, &subProperties); } } // interface ID2D1Properties mixin(uuid!(ID2D1Effect, "28211a43-7d89-476f-8181-2d6159b220ad")); /// <summary> /// The effect interface. Properties control how the effect is rendered. The effect /// is Drawn with the DrawImage call. /// </summary> interface ID2D1Effect : ID2D1Properties { extern(Windows): /// <summary> /// Sets the input to the given effect. The input can be a concrete bitmap or the /// output of another effect. /// </summary> void SetInput( UINT32 index, ID2D1Image input, BOOL invalidate = TRUE ); /// <summary> /// If the effect supports a variable number of inputs, this sets the number of /// input that are currently active on the effect. /// </summary> HRESULT SetInputCount(UINT32 inputCount); /// <summary> /// Returns the input image to the effect. The input could be another effect or a /// bitmap. /// </summary> void GetInput(UINT32 index, ID2D1Image **input) const; /// <summary> /// This returns the number of input that are bound into this effect. /// </summary> UINT32 GetInputCount() const; /// <summary> /// Returns the output image of the given effect. This can be set as the input to /// another effect or can be drawn with DrawImage. /// </summary> void GetOutput(ID2D1Image *outputImage) const; final void SetInputEffect(UINT32 index, ID2D1Effect inputEffect, BOOL invalidate = TRUE) { ID2D1Image output = null; if (inputEffect !is null) inputEffect.GetOutput(&output); scope(exit) if(output !is null) output.Release(); SetInput(index, output, invalidate); } } // interface ID2D1Effect mixin(uuid!(ID2D1Bitmap, "28211a43-7d89-476f-8181-2d6159b220ad")); /// <summary> /// Represents a bitmap that can be used as a surface for an ID2D1DeviceContext or /// mapped into system memory, and can contain additional color context information. /// </summary> interface ID2D1Bitmap1 : ID2D1Bitmap { extern(Windows): /// <summary> /// Retrieves the color context information associated with the bitmap. /// </summary> void GetColorContext(ID2D1ColorContext *colorContext) const; /// <summary> /// Retrieves the bitmap options used when creating the API. /// </summary> D2D1_BITMAP_OPTIONS GetOptions() const; /// <summary> /// Retrieves the DXGI surface from the corresponding bitmap, if the bitmap was /// created from a device derived from a D3D device. /// </summary> HRESULT GetSurface(IDXGISurface *dxgiSurface) const; /// <summary> /// Maps the given bitmap into memory. The bitmap must have been created with the /// D2D1_BITMAP_OPTIONS_CPU_READ flag. /// </summary> HRESULT Map(D2D1_MAP_OPTIONS options, D2D1_MAPPED_RECT *mappedRect); /// <summary> /// Unmaps the given bitmap from memory. /// </summary> HRESULT Unmap(); } // interface ID2D1Bitmap1 mixin(uuid!(ID2D1ColorContext, "1c4820bb-5771-4518-a581-2fe4dd0ec657")); /// <summary> /// Represents a color context that can be used with an ID2D1Bitmap1 object. /// </summary> interface ID2D1ColorContext : ID2D1Resource { extern(Windows): /// <summary> /// Retrieves the color space of the color context. /// </summary> D2D1_COLOR_SPACE GetColorSpace() const; /// <summary> /// Retrieves the size of the color profile, in bytes. /// </summary> UINT32 GetProfileSize() const; /// <summary> /// Retrieves the color profile bytes. /// </summary> HRESULT GetProfile(BYTE* profile, UINT32 profileSize) const; } // interface ID2D1ColorContext mixin(uuid!(ID2D1GradientStopCollection1, "ae1572f4-5dd0-4777-998b-9279472ae63b")); /// <summary> /// Represents an collection of gradient stops that can then be the source resource /// for either a linear or radial gradient brush. /// </summary> interface ID2D1GradientStopCollection1 : ID2D1GradientStopCollection { extern(Windows): /// <summary> /// Copies the gradient stops from the collection into the caller's memory. If this /// object was created using ID2D1DeviceContext::CreateGradientStopCollection, this /// method returns the same values as were specified in the creation method. If this /// object was created using ID2D1RenderTarget::CreateGradientStopCollection, the /// stops returned here will first be transformed into the gamma space specified by /// the colorInterpolationGamma parameter. /// </summary> void GetGradientStops1(D2D1_GRADIENT_STOP* gradientStops, UINT32 gradientStopsCount) const; /// <summary> /// Returns the color space in which interpolation occurs. If this object was /// created using ID2D1RenderTarget::CreateGradientStopCollection, this method /// returns the color space related to the color interpolation gamma. /// </summary> D2D1_COLOR_SPACE GetPreInterpolationSpace() const; /// <summary> /// Returns the color space colors will be converted to after interpolation occurs. /// If this object was created using /// ID2D1RenderTarget::CreateGradientStopCollection, this method returns /// D2D1_COLOR_SPACE_SRGB. /// </summary> D2D1_COLOR_SPACE GetPostInterpolationSpace() const; /// <summary> /// Returns the buffer precision of this gradient. If this object was created using /// ID2D1RenderTarget::CreateGradientStopCollection, this method returns /// D2D1_BUFFER_PRECISION_8BPC_UNORM. /// </summary> D2D1_BUFFER_PRECISION GetBufferPrecision() const; /// <summary> /// Returns the interpolation mode used to interpolate colors in the gradient. /// </summary> D2D1_COLOR_INTERPOLATION_MODE GetColorInterpolationMode() const; } // interface ID2D1GradientStopCollection1 mixin(uuid!(ID2D1DrawingStateBlock1, "689f1f85-c72e-4e33-8f19-85754efd5ace")); /// <summary> /// Represents drawing state. /// </summary> interface ID2D1DrawingStateBlock1 : ID2D1DrawingStateBlock { extern(Windows): /// <summary> /// Retrieves the state currently contained within this state block resource. /// </summary> void GetDescription(D2D1_DRAWING_STATE_DESCRIPTION1 *stateDescription) const; /* using ID2D1DrawingStateBlock::GetDescription; */ void GetDescription(D2D1_DRAWING_STATE_DESCRIPTION *stateDescription) const; /// <summary> /// Sets the state description of this state block resource. /// </summary> void SetDescription(const(D2D1_DRAWING_STATE_DESCRIPTION1)* stateDescription); /* using ID2D1DrawingStateBlock::SetDescription; */ void SetDescription(const(D2D1_DRAWING_STATE_DESCRIPTION)* stateDescription); } // interface ID2D1DrawingStateBlock1 mixin(uuid!(ID2D1DeviceContext, "e8f7fe7a-191c-466d-ad95-975678bda998")); /// <summary> /// The device context represents a set of state and a command buffer that is used /// to render to a target bitmap. /// </summary> interface ID2D1DeviceContext : ID2D1RenderTarget { extern(Windows): /// <summary> /// Creates a bitmap with extended bitmap properties, potentially from a block of /// memory. /// </summary> HRESULT CreateBitmap( D2D1_SIZE_U size, const(void)* sourceData, UINT32 pitch, const(D2D1_BITMAP_PROPERTIES1)* bitmapProperties, ID2D1Bitmap1 *bitmap ); /* using ID2D1RenderTarget::CreateBitmap; */ HRESULT CreateBitmap( D2D1_SIZE_U size, const(void*) srcData, UINT32 pitch, const(D2D1_BITMAP_PROPERTIES)* bitmapProperties, /*out*/ID2D1Bitmap* bitmap ); /// <summary> /// Create a D2D bitmap by copying a WIC bitmap. /// </summary> HRESULT CreateBitmapFromWicBitmap( IWICBitmapSource wicBitmapSource, const(D2D1_BITMAP_PROPERTIES1)* bitmapProperties, ID2D1Bitmap1 *bitmap ); /* using ID2D1RenderTarget::CreateBitmapFromWicBitmap; */ HRESULT CreateBitmapFromWicBitmap( IWICBitmapSource wicBitmapSource, const(D2D1_BITMAP_PROPERTIES)* bitmapProperties, /*out*/ ID2D1Bitmap *bitmap ); /// <summary> /// Creates a color context from a color space. If the space is Custom, the context /// is initialized from the profile/profileSize arguments. Otherwise the context is /// initialized with the profile bytes associated with the space and /// profile/profileSize are ignored. /// </summary> HRESULT CreateColorContext( D2D1_COLOR_SPACE space, const(BYTE)* profile, UINT32 profileSize, ID2D1ColorContext *colorContext ); HRESULT CreateColorContextFromFilename( PCWSTR filename, ID2D1ColorContext *colorContext ); HRESULT CreateColorContextFromWicColorContext( IWICColorContext wicColorContext, ID2D1ColorContext *colorContext ); /// <summary> /// Creates a bitmap from a DXGI surface with a set of extended properties. /// </summary> HRESULT CreateBitmapFromDxgiSurface( IDXGISurface surface, const(D2D1_BITMAP_PROPERTIES1)* bitmapProperties, ID2D1Bitmap1* bitmap ); /// <summary> /// Create a new effect, the effect must either be built in or previously registered /// through ID2D1Factory1::RegisterEffectFromStream or /// ID2D1Factory1::RegisterEffectFromString. /// </summary> HRESULT CreateEffect( REFCLSID effectId, ID2D1Effect *effect ); /// <summary> /// A gradient stop collection represents a set of stops in an ideal unit length. /// This is the source resource for a linear gradient and radial gradient brush. /// </summary> /// <param name="preInterpolationSpace">Specifies both the input color space and the /// space in which the color interpolation occurs.</param> /// <param name="postInterpolationSpace">Specifies the color space colors will be /// converted to after interpolation occurs.</param> /// <param name="bufferPrecision">Specifies the precision in which the gradient /// buffer will be held.</param> /// <param name="extendMode">Specifies how the gradient will be extended outside of /// the unit length.</param> /// <param name="colorInterpolationMode">Determines if colors will be interpolated /// in straight alpha or premultiplied alpha space.</param> HRESULT CreateGradientStopCollection( const(D2D1_GRADIENT_STOP)* straightAlphaGradientStops, UINT32 straightAlphaGradientStopsCount, D2D1_COLOR_SPACE preInterpolationSpace, D2D1_COLOR_SPACE postInterpolationSpace, D2D1_BUFFER_PRECISION bufferPrecision, D2D1_EXTEND_MODE extendMode, D2D1_COLOR_INTERPOLATION_MODE colorInterpolationMode, ID2D1GradientStopCollection1 *gradientStopCollection1 ); /* using ID2D1RenderTarget::CreateGradientStopCollection; */ HRESULT CreateGradientStopCollection( const(D2D1_GRADIENT_STOP)* gradientStops, UINT32 gradientStopsCount, // // Specifies which space the color interpolation occurs in. // D2D1_GAMMA colorInterpolationGamma, // // Specifies how the gradient will be extended outside of the unit length. // D2D1_EXTEND_MODE extendMode, /*out*/ ID2D1GradientStopCollection* gradientStopCollection ); /// <summary> /// Creates an image brush, the input image can be any type of image, including a /// bitmap, effect and a command list. /// </summary> HRESULT CreateImageBrush( ID2D1Image image, const(D2D1_IMAGE_BRUSH_PROPERTIES)* imageBrushProperties, const(D2D1_BRUSH_PROPERTIES)* brushProperties, ID2D1ImageBrush *imageBrush ); HRESULT CreateBitmapBrush( ID2D1Bitmap bitmap, const(D2D1_BITMAP_BRUSH_PROPERTIES1)* bitmapBrushProperties, const(D2D1_BRUSH_PROPERTIES)* brushProperties, ID2D1BitmapBrush1 *bitmapBrush ); /* using ID2D1RenderTarget::CreateBitmapBrush; */ HRESULT CreateBitmapBrush( ID2D1Bitmap bitmap, const(D2D1_BITMAP_BRUSH_PROPERTIES)* bitmapBrushProperties, const(D2D1_BRUSH_PROPERTIES)* brushProperties, /*out*/ ID2D1BitmapBrush* bitmapBrush ); /// <summary> /// Creates a new command list. /// </summary> HRESULT CreateCommandList(ID2D1CommandList *commandList); /// <summary> /// Indicates whether the format is supported by D2D. /// </summary> BOOL IsDxgiFormatSupported(DXGI_FORMAT format) const; /// <summary> /// Indicates whether the buffer precision is supported by D2D. /// </summary> BOOL IsBufferPrecisionSupported(D2D1_BUFFER_PRECISION bufferPrecision) const; /// <summary> /// This retrieves the local-space bounds in DIPs of the current image using the /// device context DPI. /// </summary> HRESULT GetImageLocalBounds( ID2D1Image image, D2D1_RECT_F* localBounds ) const; /// <summary> /// This retrieves the world-space bounds in DIPs of the current image using the /// device context DPI. /// </summary> HRESULT GetImageWorldBounds( ID2D1Image image, D2D1_RECT_F* worldBounds ) const; /// <summary> /// Retrieves the world-space bounds in DIPs of the glyph run using the device /// context DPI. /// </summary> HRESULT GetGlyphRunWorldBounds( D2D1_POINT_2F baselineOrigin, const(DWRITE_GLYPH_RUN)* glyphRun, DWRITE_MEASURING_MODE measuringMode, D2D1_RECT_F* bounds ) const; /// <summary> /// Retrieves the device associated with this device context. /// </summary> void GetDevice(ID2D1Device *device) const; /// <summary> /// Sets the target for this device context to point to the given image. The image /// can be a command list or a bitmap created with the D2D1_BITMAP_OPTIONS_TARGET /// flag. /// </summary> void SetTarget(ID2D1Image image); /// <summary> /// Gets the target that this device context is currently pointing to. /// </summary> void GetTarget(ID2D1Image *image) const; /// <summary> /// Sets tuning parameters for internal rendering inside the device context. /// </summary> void SetRenderingControls(const(D2D1_RENDERING_CONTROLS)* renderingControls); /// <summary> /// This retrieves the rendering controls currently selected into the device /// context. /// </summary> void GetRenderingControls(D2D1_RENDERING_CONTROLS* renderingControls) const; /// <summary> /// Changes the primitive blending mode for all of the rendering operations. /// </summary> void SetPrimitiveBlend(D2D1_PRIMITIVE_BLEND primitiveBlend); /// <summary> /// Returns the primitive blend currently selected into the device context. /// </summary> D2D1_PRIMITIVE_BLEND GetPrimitiveBlend() const; /// <summary> /// Changes the units used for all of the rendering operations. /// </summary> void SetUnitMode(D2D1_UNIT_MODE unitMode); /// <summary> /// Returns the unit mode currently set on the device context. /// </summary> D2D1_UNIT_MODE GetUnitMode() const; /// <summary> /// Draws the glyph run with an extended description to describe the glyphs. /// </summary> void DrawGlyphRun( D2D1_POINT_2F baselineOrigin, const(DWRITE_GLYPH_RUN)* glyphRun, const(DWRITE_GLYPH_RUN_DESCRIPTION)* glyphRunDescription, ID2D1Brush foregroundBrush, DWRITE_MEASURING_MODE measuringMode = DWRITE_MEASURING_MODE_NATURAL ); /* using ID2D1RenderTarget::DrawGlyphRun; */ void DrawGlyphRun( D2D1_POINT_2F baselineOrigin, const(DWRITE_GLYPH_RUN)* glyphRun, ID2D1Brush foregroundBrush, DWRITE_MEASURING_MODE measuringMode = DWRITE_MEASURING_MODE_NATURAL ); /// <summary> /// Draw an image to the device context. The image represents either a concrete /// bitmap or the output of an effect graph. /// </summary> void DrawImage( ID2D1Image image, const(D2D1_POINT_2F)* targetOffset = null, const(D2D1_RECT_F)* imageRectangle = null, D2D1_INTERPOLATION_MODE interpolationMode = D2D1_INTERPOLATION_MODE_LINEAR, D2D1_COMPOSITE_MODE compositeMode = D2D1_COMPOSITE_MODE_SOURCE_OVER ); /// <summary> /// Draw a metafile to the device context. /// </summary> void DrawGdiMetafile( ID2D1GdiMetafile gdiMetafile, const(D2D1_POINT_2F)* targetOffset = null ); void DrawBitmap( ID2D1Bitmap bitmap, const(D2D1_RECT_F)* destinationRectangle, FLOAT opacity, D2D1_INTERPOLATION_MODE interpolationMode, const(D2D1_RECT_F)* sourceRectangle = null, const(D2D1_MATRIX_4X4_F)* perspectiveTransform = null ); /* using ID2D1RenderTarget::DrawBitmap; */ void DrawBitmap( ID2D1Bitmap bitmap, const(D2D1_RECT_F)* destinationRectangle = null, FLOAT opacity = 1.0f, D2D1_BITMAP_INTERPOLATION_MODE interpolationMode = D2D1_BITMAP_INTERPOLATION_MODE_LINEAR, const(D2D1_RECT_F)* sourceRectangle = null ); /// <summary> /// Push a layer on the device context. /// </summary> void PushLayer( const(D2D1_LAYER_PARAMETERS1)* layerParameters, ID2D1Layer layer ); /* using ID2D1RenderTarget::PushLayer; */ void PushLayer( const(D2D1_LAYER_PARAMETERS)* layerParameters, ID2D1Layer layer ); /// <summary> /// This indicates that a portion of an effect's input is invalid. This method can /// be called many times. /// </summary> HRESULT InvalidateEffectInputRectangle( ID2D1Effect effect, UINT32 input, const(D2D1_RECT_F)* inputRectangle ); /// <summary> /// Gets the number of invalid ouptut rectangles that have accumulated at the /// effect. /// </summary> HRESULT GetEffectInvalidRectangleCount( ID2D1Effect effect, UINT32* rectangleCount ); /// <summary> /// Gets the invalid rectangles that are at the output of the effect. /// </summary> HRESULT GetEffectInvalidRectangles( ID2D1Effect effect, D2D1_RECT_F* rectangles, UINT32 rectanglesCount ); /// <summary> /// Gets the maximum region of each specified input which would be used during a /// subsequent rendering operation /// </summary> HRESULT GetEffectRequiredInputRectangles( ID2D1Effect* renderEffect, const(D2D1_RECT_F)* renderImageRectangle, const(D2D1_EFFECT_INPUT_DESCRIPTION)* inputDescriptions, D2D1_RECT_F* requiredInputRects, UINT32 inputCount ); /// <summary> /// Fill using the alpha channel of the supplied opacity mask bitmap. The brush /// opacity will be modulated by the mask. The render target antialiasing mode must /// be set to aliased. /// </summary> void FillOpacityMask( ID2D1Bitmap opacityMask, ID2D1Brush brush, const(D2D1_RECT_F)* destinationRectangle = null, const(D2D1_RECT_F)* sourceRectangle = null ); /* using ID2D1RenderTarget::FillOpacityMask; */ void FillOpacityMask( ID2D1Bitmap opacityMask, ID2D1Brush brush, D2D1_OPACITY_MASK_CONTENT content, const(D2D1_RECT_F)* destinationRectangle = null, const(D2D1_RECT_F)* sourceRectangle = null ); final HRESULT CreateBitmap( D2D1_SIZE_U size, const(void)* sourceData, UINT32 pitch, const D2D1_BITMAP_PROPERTIES1 bitmapProperties, out ID2D1Bitmap1 bitmap ) { return CreateBitmap(size, sourceData, pitch, &bitmapProperties, &bitmap); } /// <summary> /// Create a D2D bitmap by copying a WIC bitmap. /// </summary> final HRESULT CreateBitmapFromWicBitmap( IWICBitmapSource wicBitmapSource, const D2D1_BITMAP_PROPERTIES1 bitmapProperties, out ID2D1Bitmap1 bitmap ) { return CreateBitmapFromWicBitmap(wicBitmapSource, &bitmapProperties, &bitmap); } /// <summary> /// Create a D2D bitmap by copying a WIC bitmap. /// </summary> final HRESULT CreateBitmapFromWicBitmap( IWICBitmapSource wicBitmapSource, out ID2D1Bitmap1 bitmap ) { return CreateBitmapFromWicBitmap(wicBitmapSource, null, &bitmap); } final HRESULT CreateBitmapFromDxgiSurface( IDXGISurface surface, const D2D1_BITMAP_PROPERTIES1 bitmapProperties, out ID2D1Bitmap1 bitmap ) { return CreateBitmapFromDxgiSurface(surface, &bitmapProperties, &bitmap); } final HRESULT CreateImageBrush( ID2D1Image image, const D2D1_IMAGE_BRUSH_PROPERTIES imageBrushProperties, const D2D1_BRUSH_PROPERTIES brushProperties, out ID2D1ImageBrush imageBrush ) { return CreateImageBrush(image, &imageBrushProperties, &brushProperties, &imageBrush); } final HRESULT CreateImageBrush( ID2D1Image image, const D2D1_IMAGE_BRUSH_PROPERTIES imageBrushProperties, out ID2D1ImageBrush imageBrush ) { return CreateImageBrush(image,&imageBrushProperties, null, &imageBrush); } final HRESULT CreateBitmapBrush( ID2D1Bitmap bitmap, out ID2D1BitmapBrush1 bitmapBrush ) { return CreateBitmapBrush(bitmap, null, null, &bitmapBrush); } final HRESULT CreateBitmapBrush( ID2D1Bitmap bitmap, const D2D1_BITMAP_BRUSH_PROPERTIES1 bitmapBrushProperties, out ID2D1BitmapBrush1 bitmapBrush ) { return CreateBitmapBrush(bitmap, &bitmapBrushProperties, null, &bitmapBrush); } final HRESULT CreateBitmapBrush( ID2D1Bitmap bitmap, const D2D1_BITMAP_BRUSH_PROPERTIES1 bitmapBrushProperties, const D2D1_BRUSH_PROPERTIES brushProperties, out ID2D1BitmapBrush1 bitmapBrush ) { return CreateBitmapBrush(bitmap, &bitmapBrushProperties, &brushProperties, &bitmapBrush); } /// <summary> /// Draws the output of the effect as an image. /// </summary> final void DrawImage( ID2D1Effect effect, const(D2D1_POINT_2F)* targetOffset = null, const(D2D1_RECT_F)* imageRectangle = null, D2D1_INTERPOLATION_MODE interpolationMode = D2D1_INTERPOLATION_MODE_LINEAR, D2D1_COMPOSITE_MODE compositeMode = D2D1_COMPOSITE_MODE_SOURCE_OVER ) { ID2D1Image output = null; effect.GetOutput(&output); scope(exit) output.Release(); DrawImage(output, targetOffset, imageRectangle, interpolationMode, compositeMode); } final void DrawImage( ID2D1Image image, D2D1_INTERPOLATION_MODE interpolationMode, D2D1_COMPOSITE_MODE compositeMode = D2D1_COMPOSITE_MODE_SOURCE_OVER ) { DrawImage(image, null, null, interpolationMode, compositeMode); } final void DrawImage( ID2D1Effect effect, D2D1_INTERPOLATION_MODE interpolationMode, D2D1_COMPOSITE_MODE compositeMode = D2D1_COMPOSITE_MODE_SOURCE_OVER ) { DrawImage(effect, null, null, interpolationMode, compositeMode); } final void DrawImage( ID2D1Image image, D2D1_POINT_2F targetOffset, D2D1_INTERPOLATION_MODE interpolationMode = D2D1_INTERPOLATION_MODE_LINEAR, D2D1_COMPOSITE_MODE compositeMode = D2D1_COMPOSITE_MODE_SOURCE_OVER ) { DrawImage(image, &targetOffset, null, interpolationMode, compositeMode); } final void DrawImage( ID2D1Effect effect, D2D1_POINT_2F targetOffset, D2D1_INTERPOLATION_MODE interpolationMode = D2D1_INTERPOLATION_MODE_LINEAR, D2D1_COMPOSITE_MODE compositeMode = D2D1_COMPOSITE_MODE_SOURCE_OVER ) { DrawImage(effect, &targetOffset, null, interpolationMode, compositeMode); } final void DrawImage( ID2D1Image image, D2D1_POINT_2F targetOffset, const D2D1_RECT_F imageRectangle, D2D1_INTERPOLATION_MODE interpolationMode = D2D1_INTERPOLATION_MODE_LINEAR, D2D1_COMPOSITE_MODE compositeMode = D2D1_COMPOSITE_MODE_SOURCE_OVER ) { DrawImage(image, &targetOffset, &imageRectangle, interpolationMode, compositeMode); } final void DrawImage( ID2D1Effect effect, D2D1_POINT_2F targetOffset, const D2D1_RECT_F imageRectangle, D2D1_INTERPOLATION_MODE interpolationMode = D2D1_INTERPOLATION_MODE_LINEAR, D2D1_COMPOSITE_MODE compositeMode = D2D1_COMPOSITE_MODE_SOURCE_OVER ) { DrawImage(effect, &targetOffset, &imageRectangle, interpolationMode, compositeMode); } final void PushLayer( const D2D1_LAYER_PARAMETERS1 layerParameters, ID2D1Layer layer ) { PushLayer(&layerParameters, layer); } final void DrawGdiMetafile( ID2D1GdiMetafile gdiMetafile, D2D1_POINT_2F targetOffset ) { DrawGdiMetafile(gdiMetafile, &targetOffset); } final void DrawBitmap( ID2D1Bitmap bitmap, const D2D1_RECT_F destinationRectangle, FLOAT opacity, D2D1_INTERPOLATION_MODE interpolationMode, const(D2D1_RECT_F)* sourceRectangle = null, const(D2D1_MATRIX_4X4_F)* perspectiveTransform = null ) { DrawBitmap(bitmap, &destinationRectangle, opacity, interpolationMode, sourceRectangle, perspectiveTransform); } final void DrawBitmap( ID2D1Bitmap bitmap, const D2D1_RECT_F destinationRectangle, FLOAT opacity, D2D1_INTERPOLATION_MODE interpolationMode, const D2D1_RECT_F sourceRectangle, const(D2D1_MATRIX_4X4_F)* perspectiveTransform = null ) { DrawBitmap(bitmap, &destinationRectangle, opacity, interpolationMode, &sourceRectangle, perspectiveTransform); } final void DrawBitmap( ID2D1Bitmap bitmap, const D2D1_RECT_F destinationRectangle, FLOAT opacity, D2D1_INTERPOLATION_MODE interpolationMode, const D2D1_RECT_F sourceRectangle, const D2D1_MATRIX_4X4_F perspectiveTransform ) { DrawBitmap(bitmap, &destinationRectangle, opacity, interpolationMode, &sourceRectangle, &perspectiveTransform); } final void FillOpacityMask( ID2D1Bitmap opacityMask, ID2D1Brush brush, const D2D1_RECT_F destinationRectangle, const(D2D1_RECT_F)* sourceRectangle = null ) { FillOpacityMask(opacityMask, brush, &destinationRectangle, sourceRectangle); } final void FillOpacityMask( ID2D1Bitmap opacityMask, ID2D1Brush brush, const D2D1_RECT_F destinationRectangle, const D2D1_RECT_F sourceRectangle ) { FillOpacityMask(opacityMask, brush, &destinationRectangle, &sourceRectangle); } /// <summary> /// Sets tuning parameters for internal rendering inside the device context. /// </summary> final void SetRenderingControls( const D2D1_RENDERING_CONTROLS renderingControls ) { return SetRenderingControls(&renderingControls); } } // interface ID2D1DeviceContext mixin(uuid!(ID2D1Device, "47dd575d-ac05-4cdd-8049-9b02cd16f44c")); /// <summary> /// The device defines a resource domain whose objects and device contexts can be /// used together. /// </summary> interface ID2D1Device : ID2D1Resource { extern(Windows): /// <summary> /// Creates a new device context with no initially assigned target. /// </summary> HRESULT CreateDeviceContext( D2D1_DEVICE_CONTEXT_OPTIONS options, ID2D1DeviceContext *deviceContext ); /// <summary> /// Creates a D2D print control. /// </summary> HRESULT CreatePrintControl( IWICImagingFactory wicFactory, IPrintDocumentPackageTarget documentTarget, const(D2D1_PRINT_CONTROL_PROPERTIES)* printControlProperties, ID2D1PrintControl *printControl ); /// <summary> /// Sets the maximum amount of texture memory to maintain before evicting caches. /// </summary> void SetMaximumTextureMemory(UINT64 maximumInBytes); /// <summary> /// Gets the maximum amount of texture memory to maintain before evicting caches. /// </summary> UINT64 GetMaximumTextureMemory() const; /// <summary> /// Clears all resources that are cached but not held in use by the application /// through an interface reference. /// </summary> void ClearResources(UINT32 millisecondsSinceUse = 0); final HRESULT CreatePrintControl( IWICImagingFactory wicFactory, IPrintDocumentPackageTarget documentTarget, const D2D1_PRINT_CONTROL_PROPERTIES printControlProperties, out ID2D1PrintControl printControl ) { return CreatePrintControl(wicFactory, documentTarget, &printControlProperties, &printControl); } } // interface ID2D1Device mixin(uuid!(ID2D1Factory1, "bb12d362-daee-4b9a-aa1d-14ba401cfa1f")); /// <summary> /// Creates Direct2D resources. /// </summary> interface ID2D1Factory1 : ID2D1Factory { extern(Windows): /// <summary> /// This creates a new Direct2D device from the given IDXGIDevice. /// </summary> HRESULT CreateDevice( IDXGIDevice dxgiDevice, ID2D1Device *d2dDevice ); /// <summary> /// This creates a stroke style with the ability to preserve stroke width in various /// ways. /// </summary> HRESULT CreateStrokeStyle( const(D2D1_STROKE_STYLE_PROPERTIES1)* strokeStyleProperties, const(FLOAT)* dashes, UINT32 dashesCount, ID2D1StrokeStyle1 *strokeStyle ); /* using ID2D1Factory::CreateStrokeStyle; */ HRESULT CreateStrokeStyle( const(D2D1_STROKE_STYLE_PROPERTIES)* strokeStyleProperties, const(FLOAT)* dashes, UINT32 dashesCount, /*out*/ ID2D1StrokeStyle* strokeStyle ); /// <summary> /// Creates a path geometry with new operational methods. /// </summary> HRESULT CreatePathGeometry(ID2D1PathGeometry1 *pathGeometry); /* using ID2D1Factory::CreatePathGeometry; */ HRESULT CreatePathGeometry( /*out*/ ID2D1PathGeometry* pathGeometry ); /// <summary> /// Creates a new drawing state block, this can be used in subsequent /// SaveDrawingState and RestoreDrawingState operations on the render target. /// </summary> HRESULT CreateDrawingStateBlock( const(D2D1_DRAWING_STATE_DESCRIPTION1)* drawingStateDescription, IDWriteRenderingParams textRenderingParams, ID2D1DrawingStateBlock1 *drawingStateBlock ); /* using ID2D1Factory::CreateDrawingStateBlock; */ HRESULT CreateDrawingStateBlock( const(D2D1_DRAWING_STATE_DESCRIPTION)* drawingStateDescription, IDWriteRenderingParams textRenderingParams, /*out*/ ID2D1DrawingStateBlock* drawingStateBlock ); /// <summary> /// Creates a new GDI metafile. /// </summary> HRESULT CreateGdiMetafile( IStream metafileStream, ID2D1GdiMetafile *metafile ); /// <summary> /// This globally registers the given effect. The effect can later be instantiated /// by using the registered class id. The effect registration is reference counted. /// </summary> HRESULT RegisterEffectFromStream( REFCLSID classId, IStream propertyXml, const(D2D1_PROPERTY_BINDING)* bindings, UINT32 bindingsCount, const PD2D1_EFFECT_FACTORY effectFactory ); /// <summary> /// This globally registers the given effect. The effect can later be instantiated /// by using the registered class id. The effect registration is reference counted. /// </summary> HRESULT RegisterEffectFromString( REFCLSID classId, PCWSTR propertyXml, const(D2D1_PROPERTY_BINDING)* bindings, UINT32 bindingsCount, const PD2D1_EFFECT_FACTORY effectFactory ); /// <summary> /// This unregisters the given effect by its class id, you need to call /// UnregisterEffect for every call to ID2D1Factory1::RegisterEffectFromStream and /// ID2D1Factory1::RegisterEffectFromString to completely unregister it. /// </summary> HRESULT UnregisterEffect(REFCLSID classId); /// <summary> /// This returns all of the registered effects in the process, including any /// built-in effects. /// </summary> /// <param name="effectsReturned">The number of effects returned into the passed in /// effects array.</param> /// <param name="effectsRegistered">The number of effects currently registered in /// the system.</param> HRESULT GetRegisteredEffects( CLSID* effects, UINT32 effectsCount, UINT32* effectsReturned, UINT32* effectsRegistered ) const; /// <summary> /// This retrieves the effect properties for the given effect, all of the effect /// properties will be set to a default value since an effect is not instantiated to /// implement the returned property interface. /// </summary> HRESULT GetEffectProperties( REFCLSID effectId, ID2D1Properties *properties ) const; final HRESULT CreateStrokeStyle( const D2D1_STROKE_STYLE_PROPERTIES1 strokeStyleProperties, const(FLOAT)* dashes, UINT32 dashesCount, out ID2D1StrokeStyle1 strokeStyle ) { return CreateStrokeStyle(&strokeStyleProperties, dashes, dashesCount, &strokeStyle); } // D-style impl final HRESULT CreateStrokeStyle( const D2D1_STROKE_STYLE_PROPERTIES1 strokeStyleProperties, const(FLOAT)[] dashes, out ID2D1StrokeStyle1 strokeStyle ) { return CreateStrokeStyle(&strokeStyleProperties, &dashes[0], cast(UINT32)dashes.length, &strokeStyle); } final HRESULT CreateDrawingStateBlock( const D2D1_DRAWING_STATE_DESCRIPTION1 drawingStateDescription, out ID2D1DrawingStateBlock1 drawingStateBlock ) { return CreateDrawingStateBlock(&drawingStateDescription, null, &drawingStateBlock); } final HRESULT CreateDrawingStateBlock(out ID2D1DrawingStateBlock1 drawingStateBlock) { return CreateDrawingStateBlock(null, null, &drawingStateBlock); } } // interface ID2D1Factory1 mixin(uuid!(ID2D1Multithread, "31e6e7bc-e0ff-4d46-8c64-a0a8c41c15d3")); /// <summary> /// A locking mechanism from a Direct2D factory that Direct2D uses to control /// exclusive resource access in an app that is uses multiple threads. /// </summary> interface ID2D1Multithread : IUnknown { extern(Windows): /// <summary> /// Returns whether the D2D factory was created with /// D2D1_FACTORY_TYPE_MULTI_THREADED. /// </summary> BOOL GetMultithreadProtected() const; /// <summary> /// Enters the D2D API critical section, if it exists. /// </summary> void Enter(); /// <summary> /// Leaves the D2D API critical section, if it exists. /// </summary> void Leave(); } // interface ID2D1Multithread extern(Windows) { HRESULT D2D1CreateDevice( IDXGIDevice dxgiDevice, const(D2D1_CREATION_PROPERTIES)* creationProperties, ID2D1Device *d2dDevice ); HRESULT D2D1CreateDeviceContext( IDXGISurface dxgiSurface, const(D2D1_CREATION_PROPERTIES)* creationProperties, ID2D1DeviceContext *d2dDeviceContext ); D2D1_COLOR_F D2D1ConvertColorSpace( D2D1_COLOR_SPACE sourceColorSpace, D2D1_COLOR_SPACE destinationColorSpace, const(D2D1_COLOR_F)* color ); void D2D1SinCos( FLOAT angle, FLOAT* s, FLOAT* c ); FLOAT D2D1Tan(FLOAT angle); FLOAT D2D1Vec3Length( FLOAT x, FLOAT y, FLOAT z ); } // public import D2D1 = directx.d2d1_1helper; TODO: Resolve namespace translation HRESULT D2D1CreateDevice()( IDXGIDevice dxgiDevice, const D2D1_CREATION_PROPERTIES creationProperties, out ID2D1Device d2dDevice ) { return D2D1CreateDevice( dxgiDevice, &creationProperties, &d2dDevice); } HRESULT D2D1CreateDeviceContext()( IDXGISurface dxgiSurface, const D2D1_CREATION_PROPERTIES creationProperties, out ID2D1DeviceContext d2dDeviceContext ) { return D2D1CreateDeviceContext( dxgiSurface, &creationProperties, &d2dDeviceContext); }
D
module sexp; import std.variant; import std.format; import std.algorithm; import std.string; import std.conv; abstract class Sexp { public: abstract override @safe pure string toString() const; } final class Atom : Sexp { public: @safe pure nothrow @nogc this(string v) { this.val = v; } @safe pure nothrow this(T)(T v) if (__traits(compiles, v.toString)) { this.val = v.toString; } @safe pure nothrow this(T)(T v) if (__traits(compiles, to!string(v))) { this.val = v.to!string; } override @safe pure string toString() const { return val; } private: string val; } final class List : Sexp { public: @safe pure nothrow this(Sexp[] elems...) { this.elems = elems; } override @safe pure string toString() const { return format("(%(%s %))", this.elems); } private: Sexp[] elems; } unittest { scope s = new Atom("string"); assert(s.toString == "string"); scope s2 = new List(new Atom("+"), new Atom("1"), new Atom("2")); assert(s2.toString == "(+ 1 2)"); } private class SexpParser { public: @safe nothrow pure this(string src) { this.src = src; } private: string src; @safe pure void skipWs() { if (this.src == "") return; src = src.stripLeft; } unittest { auto p = new SexpParser(" abc"); p.skipWs; assert(p.src == "abc"); } @safe pure Sexp parseAtom() { this.skipWs; immutable idx = src.indexOfAny(" )"); if (idx == -1) { auto ret = new Atom(this.src); this.src = ""; return ret; } auto ret = new Atom(this.src[0..idx]); this.src = this.src[idx..$]; this.skipWs; return ret; } unittest { auto p = new SexpParser("abc def"); auto res = p.parseAtom; assert(res.toString == "abc"); assert(p.src == "def"); p = new SexpParser("abc)"); res = p.parseAtom; assert(res.toString == "abc"); assert(p.src == ")"); } @safe pure Sexp parse() { this.skipWs; if (src[0] == '(') { src = src[1..$]; Sexp[] elems = []; while (src[0] != ')') { elems ~= this.parse; } src = src[1..$]; this.skipWs; return new List(elems); } else { return this.parseAtom; } } unittest { auto p = new SexpParser("(+ 1 2)"); auto res = p.parse; assert(res.toString == "(+ 1 2)"); p = new SexpParser("(+ 1 (- 3 2))"); res = p.parse; assert(res.toString == "(+ 1 (- 3 2))"); } } @safe pure Sexp parse(in string src) { return new SexpParser(src).parse; } @safe pure Sexp cons(T)(Sexp s, T v) if (__traits(compiles, v.to!string) || __traits(compiles, v.toString)) { if (cast(Atom)s) throw new Error(""); Sexp newelem = new Atom(v); auto elms = [newelem] ~ (cast(List)s).elems; return new List(elms); } unittest { Sexp s = new List(new Atom("x"), new Atom("y"), new Atom("z")); assert(s.cons(2).toString == "(2 x y z)"); try { s = new Atom(1); s.cons(2); assert(false); } catch { // should be reach here. } }
D
/* Boost Software License - Version 1.0 - August 17th,2003 Permission is hereby granted,free of charge,to any person or organization obtaining a copy of the software and accompanying documentation covered by this license (the "Software") to use,reproduce,display,distribute, execute,and transmit the Software,and to prepare derivative works of the Software,and to permit third-parties to whom the Software is furnished to do so,all subject to the following: The copyright notices in the Software and this entire statement,including the above license grant,this restriction and the following disclaimer, must be included in all copies of the Software,in whole or in part,and all derivative works of the Software,unless such copies or derivative works are solely in the form of machine-executable object code generated by a source language processor. THE SOFTWARE IS PROVIDED "AS IS",WITHOUT WARRANTY OF ANY KIND,EXPRESS OR IMPLIED,INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE,TITLE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE FOR ANY DAMAGES OR OTHER LIABILITY,WHETHER IN CONTRACT,TORT OR OTHERWISE, ARISING FROM,OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ module derelict.sdl2.internal.sdl_static; import core.stdc.stdarg, core.stdc.stdio; import derelict.util.system; import derelict.sdl2.internal.sdl_types; extern(System) @nogc nothrow { int SDL_Init(Uint32); int SDL_InitSubSystem(Uint32); void SDL_QuitSubSystem(Uint32); Uint32 SDL_WasInit(Uint32); void SDL_Quit(); void SDL_free(void* mem); void SDL_SetAssertionHandler(SDL_AssertionHandler,void*); SDL_AssertionHandler SDL_GetDefaultAssertionHandler(); SDL_AssertionHandler SDL_GetAssertionHandler(void**); const(SDL_assert_data)* SDL_GetAssertionReport(); void SDL_ResetAssertionReport(); int SDL_GetNumAudioDrivers(); const(char)* SDL_GetAudioDriver(int); int SDL_AudioInit(const(char)*); void SDL_AudioQuit(); const(char)* SDL_GetCurrentAudioDriver(); int SDL_OpenAudio(SDL_AudioSpec*,SDL_AudioSpec*); int SDL_GetNumAudioDevices(int); const(char)* SDL_GetAudioDeviceName(int,int); SDL_AudioDeviceID SDL_OpenAudioDevice(const(char)*,int,const(SDL_AudioSpec)*,SDL_AudioSpec*,int); SDL_AudioStatus SDL_GetAudioStatus(); SDL_AudioStatus SDL_GetAudioDeviceStatus(SDL_AudioDeviceID); void SDL_PauseAudio(int); void SDL_PauseAudioDevice(SDL_AudioDeviceID,int); SDL_AudioSpec* SDL_LoadWAV_RW(SDL_RWops*,int,SDL_AudioSpec*,Uint8**,Uint32*); void SDL_FreeWAV(Uint8*); int SDL_BuildAudioCVT(SDL_AudioCVT*,SDL_AudioFormat,Uint8,int,SDL_AudioFormat,Uint8,int); int SDL_ConvertAudio(SDL_AudioCVT*); void SDL_MixAudio(Uint8*,const(Uint8)*,Uint32,int); void SDL_MixAudioFormat(Uint8*,const(Uint8)*,SDL_AudioFormat,Uint32,int); int SDL_QueueAudio(SDL_AudioDeviceID,const(void)*,Uint32); Uint32 SDL_DequeueAudio(SDL_AudioDeviceID,void*,Uint32); int SDL_GetQueuedAudioSize(SDL_AudioDeviceID); int SDL_ClearQueuedAudio(SDL_AudioDeviceID); void SDL_LockAudio(); void SDL_LockAudioDevice(SDL_AudioDeviceID); void SDL_UnlockAudio(); void SDL_UnlockAudioDevice(SDL_AudioDeviceID); void SDL_CloseAudio(); void SDL_CloseAudioDevice(SDL_AudioDeviceID); int SDL_AudioDeviceConnected(SDL_AudioDeviceID); int SDL_SetClipboardText(const(char)*); char* SDL_GetClipboardText(); SDL_bool SDL_HasClipboardText(); int SDL_GetCPUCount(); int SDL_GetCPUCacheLineSize(); SDL_bool SDL_HasRDTSC(); SDL_bool SDL_HasAltiVec(); SDL_bool SDL_HasMMX(); SDL_bool SDL_Has3DNow(); SDL_bool SDL_HasSSE(); SDL_bool SDL_HasSSE2(); SDL_bool SDL_HasSSE3(); SDL_bool SDL_HasSSE41(); SDL_bool SDL_HasSSE42(); SDL_bool SDL_HasAVX(); SDL_bool SDL_HasAVX2(); int SDL_GetSystemRAM(); void SDL_SetError(const(char)*,...); const(char)* SDL_GetError(); void SDL_ClearError(); void SDL_PumpEvents(); int SDL_PeepEvents(SDL_Event*,int,SDL_eventaction,Uint32,Uint32); SDL_bool SDL_HasEvent(Uint32); SDL_bool SDL_HasEvents(Uint32,Uint32); void SDL_FlushEvent(Uint32); void SDL_FlushEvents(Uint32,Uint32); int SDL_PollEvent(SDL_Event*); int SDL_WaitEvent(SDL_Event*); int SDL_WaitEventTimeout(SDL_Event*,int); int SDL_PushEvent(SDL_Event*); void SDL_SetEventFilter(SDL_EventFilter,void*); SDL_bool SDL_GetEventFilter(SDL_EventFilter*,void**); void SDL_AddEventWatch(SDL_EventFilter,void*); void SDL_DelEventWatch(SDL_EventFilter,void*); void SDL_FilterEvents(SDL_EventFilter,void*); Uint8 SDL_EventState(Uint32,int); Uint32 SDL_RegisterEvents(int); char* SDL_GetBasePath(); char* SDL_GetPrefPath(const(char)* org,const(char)* app); int SDL_GameControllerAddMappingsFromRW(SDL_RWops*,int); int SDL_GameControllerAddMapping(const(char)*); char* SDL_GameControllerMappingForGUID(SDL_JoystickGUID); char* SDL_GameControllerMapping(SDL_GameController*); SDL_bool SDL_IsGameController(int); const(char)* SDL_GameControllerNameForIndex(int); SDL_GameController* SDL_GameControllerOpen(int); SDL_GameController* SDL_GameControllerFromInstanceID(SDL_JoystickID); const(char)* SDL_GameControllerName(SDL_GameController*); SDL_bool SDL_GameControllerGetAttached(SDL_GameController*); SDL_Joystick* SDL_GameControllerGetJoystick(SDL_GameController*); int SDL_GameControllerEventState(int); void SDL_GameControllerUpdate(); SDL_GameControllerAxis SDL_GameControllerGetAxisFromString(const(char)*); const(char)* SDL_GameControllerGetStringForAxis(SDL_GameControllerAxis); SDL_GameControllerButtonBind SDL_GameControllerGetBindForAxis(SDL_GameController*,SDL_GameControllerAxis); Sint16 SDL_GameControllerGetAxis(SDL_GameController*,SDL_GameControllerAxis); SDL_GameControllerButton SDL_GameControllerGetButtonFromString(const(char*)); const(char)* SDL_GameControllerGetStringForButton(SDL_GameControllerButton); SDL_GameControllerButtonBind SDL_GameControllerGetBindForButton(SDL_GameController*,SDL_GameControllerButton); Uint8 SDL_GameControllerGetButton(SDL_GameController*,SDL_GameControllerButton); void SDL_GameControllerClose(SDL_GameController*); int SDL_RecordGesture(SDL_TouchID); int SDL_SaveAllDollarTemplates(SDL_RWops*); int SDL_SaveDollarTemplate(SDL_GestureID,SDL_RWops*); int SDL_LoadDollarTemplates(SDL_TouchID,SDL_RWops*); int SDL_NumHaptics(); const(char)* SDL_HapticName(int); SDL_Haptic* SDL_HapticOpen(int); int SDL_HapticOpened(int); int SDL_HapticIndex(SDL_Haptic*); int SDL_MouseIsHaptic(); SDL_Haptic* SDL_HapticOpenFromMouse(); int SDL_JoystickIsHaptic(SDL_Joystick*); SDL_Haptic* SDL_HapticOpenFromJoystick(SDL_Joystick*); int SDL_HapticClose(SDL_Haptic*); int SDL_HapticNumEffects(SDL_Haptic*); int SDL_HapticNumEffectsPlaying(SDL_Haptic*); uint SDL_HapticQuery(SDL_Haptic*); int SDL_HapticNumAxes(SDL_Haptic*); int SDL_HapticEffectSupported(SDL_Haptic*,SDL_HapticEffect*); int SDL_HapticNewEffect(SDL_Haptic*,SDL_HapticEffect*); int SDL_HapticUpdateEffect(SDL_Haptic*,int,SDL_HapticEffect*); int SDL_HapticRunEffect(SDL_Haptic*,int,Uint32); int SDL_HapticStopEffect(SDL_Haptic*,int); int SDL_HapticDestroyEffect(SDL_Haptic*,int); int SDL_HapticGetEffectStatus(SDL_Haptic*,int); int SDL_HapticSetGain(SDL_Haptic*,int); int SDL_HapticSetAutocenter(SDL_Haptic*,int); int SDL_HapticPause(SDL_Haptic*); int SDL_HapticUnpause(SDL_Haptic*); int SDL_HapticStopAll(SDL_Haptic*); int SDL_HapticRumbleSupported(SDL_Haptic*); int SDL_HapticRumbleInit(SDL_Haptic*); int SDL_HapticRumblePlay(SDL_Haptic*,float,Uint32); int SDL_HapticRumbleStop(SDL_Haptic*); SDL_bool SDL_SetHintWithPriority(const(char)*,const(char)*,SDL_HintPriority); SDL_bool SDL_SetHint(const(char)*,const(char)*); const(char)* SDL_GetHint(const(char)*); SDL_bool SDL_GetHintBoolean(const(char)*,SDL_bool); void SDL_AddHintCallback(const(char)*,SDL_HintCallback,void*); void SDL_DelHintCallback(const(char)*,SDL_HintCallback,void*); void SDL_ClearHints(); int SDL_NumJoysticks(); const(char)* SDL_JoystickNameForIndex(int); SDL_Joystick* SDL_JoystickOpen(int); SDL_Joystick* SDL_JoystickFromInstanceID(SDL_JoystickID); const(char)* SDL_JoystickName(SDL_Joystick*); JoystickGUID SDL_JoystickGetDeviceGUID(int); JoystickGUID SDL_JoystickGetGUID(SDL_Joystick*); char* SDL_JoystickGetGUIDString(JoystickGUID); JoystickGUID SDL_JoystickGetGUIDFromString(const(char)*); SDL_bool SDL_JoystickGetAttached(SDL_Joystick*); SDL_JoystickID SDL_JoystickInstanceID(SDL_Joystick*); int SDL_JoystickNumAxes(SDL_Joystick*); int SDL_JoystickNumBalls(SDL_Joystick*); int SDL_JoystickNumHats(SDL_Joystick*); int SDL_JoystickNumButtons(SDL_Joystick*); void SDL_JoystickUpdate(); int SDL_JoystickEventState(int); Sint16 SDL_JoystickGetAxis(SDL_Joystick*,int); Uint8 SDL_JoystickGetHat(SDL_Joystick*,int); int SDL_JoystickGetBall(SDL_Joystick*,int,int*,int*); Uint8 SDL_JoystickGetButton(SDL_Joystick*,int); void SDL_JoystickClose(SDL_Joystick*); SDL_JoystickPowerLevel SDL_JoystickCurrentPowerLevel(SDL_Joystick*); SDL_Window* SDL_GetKeyboardFocus(); Uint8* SDL_GetKeyboardState(int*); SDL_Keymod SDL_GetModState(); void SDL_SetModState(SDL_Keymod); SDL_Keycode SDL_GetKeyFromScancode(SDL_Scancode); SDL_Scancode SDL_GetScancodeFromKey(SDL_Keycode); const(char)* SDL_GetScancodeName(SDL_Scancode); SDL_Scancode SDL_GetScancodeFromName(const(char)*); const(char)* SDL_GetKeyName(SDL_Keycode); SDL_Keycode SDL_GetKeyFromName(const(char)*); void SDL_StartTextInput(); SDL_bool SDL_IsTextInputActive(); void SDL_StopTextInput(); void SDL_SetTextInputRect(SDL_Rect*); SDL_bool SDL_HasScreenKeyboardSupport(); SDL_bool SDL_IsScreenKeyboardShown(SDL_Window*); void* SDL_LoadObject(const(char)*); void* SDL_LoadFunction(void*,const(char*)); void SDL_UnloadObject(void*); void SDL_LogSetAllPriority(SDL_LogPriority); void SDL_LogSetPriority(int,SDL_LogPriority); SDL_LogPriority SDL_LogGetPriority(int); void SDL_LogResetPriorities(); void SDL_Log(const(char)*,...); void SDL_LogVerbose(int,const(char)*,...); void SDL_LogDebug(int,const(char)*,...); void SDL_LogInfo(int,const(char)*,...); void SDL_LogWarn(int,const(char)*,...); void SDL_LogError(int,const(char)*,...); void SDL_LogCritical(int,const(char)*,...); void SDL_LogMessage(int,SDL_LogPriority,const(char)*,...); void SDL_LogMessageV(int,SDL_LogPriority,const(char)*,va_list); void SDL_LogGetOutputFunction(SDL_LogOutputFunction,void**); void SDL_LogSetOutputFunction(SDL_LogOutputFunction,void*); int SDL_ShowMessageBox(const(SDL_MessageBoxData)*,int*); int SDL_ShowSimpleMessageBox(Uint32,const(char)*,const(char)*,SDL_Window*); SDL_Window* SDL_GetMouseFocus(); Uint32 SDL_GetMouseState(int*,int*); Uint32 SDL_GetGlobalMouseState(int*,int*); Uint32 SDL_GetRelativeMouseState(int*,int*); void SDL_WarpMouseInWindow(SDL_Window*,int,int); void SDL_WarpMouseGlobal(int,int); int SDL_SetRelativeMouseMode(SDL_bool); int SDL_CaptureMouse(SDL_bool); SDL_bool SDL_GetRelativeMouseMode(); SDL_Cursor* SDL_CreateCursor(const(Uint8)*,const(Uint8)*,int,int,int,int); SDL_Cursor* SDL_CreateColorCursor(SDL_Surface*,int,int); SDL_Cursor* SDL_CreateSystemCursor(SDL_SystemCursor); void SDL_SetCursor(SDL_Cursor*); SDL_Cursor* SDL_GetCursor(); SDL_Cursor* SDL_GetDefaultCursor(); void SDL_FreeCursor(SDL_Cursor*); int SDL_ShowCursor(int); const(char)* SDL_GetPixelFormatName(Uint32); SDL_bool SDL_PixelFormatEnumToMasks(Uint32,int*,Uint32*,Uint32*,Uint32*,Uint32*); Uint32 SDL_MasksToPixelFormatEnum(int,Uint32,Uint32,Uint32,Uint32); SDL_PixelFormat* SDL_AllocFormat(Uint32); void SDL_FreeFormat(SDL_PixelFormat*); SDL_Palette* SDL_AllocPalette(int); int SDL_SetPixelFormatPalette(SDL_PixelFormat*,SDL_Palette*); int SDL_SetPaletteColors(SDL_Palette*,const(SDL_Color)*,int,int); void SDL_FreePalette(SDL_Palette*); Uint32 SDL_MapRGB(const(SDL_PixelFormat)*,Uint8,Uint8,Uint8); Uint32 SDL_MapRGBA(const(SDL_PixelFormat)*,Uint8,Uint8,Uint8,Uint8); void SDL_GetRGB(Uint32,const(SDL_PixelFormat)*,Uint8*,Uint8*,Uint8*); void SDL_GetRGBA(Uint32,const(SDL_PixelFormat)*,Uint8*,Uint8*,Uint8*,Uint8*); void SDL_CalculateGammaRamp(float,Uint16*); const(char)* SDL_GetPlatform(); SDL_PowerState SDL_GetPowerInfo(int*,int*); SDL_bool SDL_HasIntersection(const(SDL_Rect)*,const(SDL_Rect)*); SDL_bool SDL_IntersectRect(const(SDL_Rect)*,const(SDL_Rect)*,SDL_Rect*); void SDL_UnionRect(const(SDL_Rect)*,const(SDL_Rect)*,SDL_Rect*); SDL_bool SDL_EnclosePoints(const(SDL_Point)*,int,const(SDL_Rect)*,SDL_Rect*); SDL_bool SDL_IntersectRectAndLine(const(SDL_Rect)*,int*,int*,int*,int*); int SDL_GetNumRenderDrivers(); int SDL_GetRenderDriverInfo(int,SDL_RendererInfo*); int SDL_CreateWindowAndRenderer(int,int,Uint32,SDL_Window**,SDL_Renderer**); SDL_Renderer* SDL_CreateRenderer(SDL_Window*,int,SDL_RendererFlags); SDL_Renderer* SDL_CreateSoftwareRenderer(SDL_Surface*); SDL_Renderer* SDL_GetRenderer(SDL_Window*); int SDL_GetRendererInfo(SDL_Renderer*,SDL_RendererInfo*); int SDL_GetRendererOutputSize(SDL_Renderer*,int*,int*); SDL_Texture* SDL_CreateTexture(SDL_Renderer*,Uint32,SDL_TextureAccess,int,int); SDL_Texture* SDL_CreateTextureFromSurface(SDL_Renderer*,SDL_Surface*); int SDL_QueryTexture(SDL_Texture*,Uint32*,int*,int*,int*); int SDL_SetTextureColorMod(SDL_Texture*,Uint8,Uint8,Uint8); int SDL_GetTextureColorMod(SDL_Texture*,Uint8*,Uint8*,Uint8*); int SDL_SetTextureAlphaMod(SDL_Texture*,Uint8); int SDL_GetTextureAlphaMod(SDL_Texture*,Uint8*); int SDL_SetTextureBlendMode(SDL_Texture*,SDL_BlendMode); int SDL_GetTextureBlendMode(SDL_Texture*,SDL_BlendMode*); int SDL_UpdateTexture(SDL_Texture*,const(SDL_Rect)*,const(void)*,int); int SDL_UpdateYUVTexture(SDL_Texture*,const(SDL_Rect)*,const(Uint8)*,int,const(Uint8)*,int,const(Uint8)*,int); int SDL_LockTexture(SDL_Texture*,const(SDL_Rect)*,void**,int*); void SDL_UnlockTexture(SDL_Texture*); SDL_bool SDL_RenderTargetSupported(SDL_Renderer*); int SDL_SetRenderTarget(SDL_Renderer*,SDL_Texture*); SDL_Texture* SDL_GetRenderTarget(SDL_Renderer*); int SDL_RenderSetClipRect(SDL_Renderer*,const(SDL_Rect)*); void SDL_RenderGetClipRect(SDL_Renderer* renderer,SDL_Rect*); int SDL_RenderSetLogicalSize(SDL_Renderer*,int,int); void SDL_RenderGetLogicalSize(SDL_Renderer*,int*,int*); int SDL_RenderSetIntegerScale(SDL_Renderer*,SDL_bool); SDL_bool SDL_RenderGetIntegerScale(SDL_Renderer*); int SDL_RenderSetViewport(SDL_Renderer*,const(SDL_Rect)*); void SDL_RenderGetViewport(SDL_Renderer*,SDL_Rect*); SDL_bool SDL_RenderIsClipEnabled(SDL_Renderer*); int SDL_RenderSetScale(SDL_Renderer*,float,float); int SDL_RenderGetScale(SDL_Renderer*,float*,float*); int SDL_SetRenderDrawColor(SDL_Renderer*,Uint8,Uint8,Uint8,Uint8); int SDL_GetRenderDrawColor(SDL_Renderer*,Uint8*,Uint8*,Uint8*,Uint8*); int SDL_SetRenderDrawBlendMode(SDL_Renderer*,SDL_BlendMode); int SDL_GetRenderDrawBlendMode(SDL_Renderer*,SDL_BlendMode*); int SDL_RenderClear(SDL_Renderer*); int SDL_RenderDrawPoint(SDL_Renderer*,int,int); int SDL_RenderDrawPoints(SDL_Renderer*,const(SDL_Point)*,int); int SDL_RenderDrawLine(SDL_Renderer*,int,int,int,int); int SDL_RenderDrawLines(SDL_Renderer*,const(SDL_Point)*,int); int SDL_RenderDrawRect(SDL_Renderer*,const(SDL_Rect)*); int SDL_RenderDrawRects(SDL_Renderer*,const(SDL_Rect)*,int); int SDL_RenderFillRect(SDL_Renderer*,const(SDL_Rect)*); int SDL_RenderFillRects(SDL_Renderer*,const(SDL_Rect)*,int); int SDL_RenderCopy(SDL_Renderer*,SDL_Texture*,const(SDL_Rect)*,const(SDL_Rect*)); int SDL_RenderCopyEx(SDL_Renderer*,SDL_Texture*,const(SDL_Rect)*,const(SDL_Rect)*,const(double),const(SDL_Point)*,const(SDL_RendererFlip)); int SDL_RenderReadPixels(SDL_Renderer*,const(SDL_Rect)*,Uint32,void*,int); void SDL_RenderPresent(SDL_Renderer*); void SDL_DestroyTexture(SDL_Texture*); void SDL_DestroyRenderer(SDL_Renderer*); int SDL_GL_BindTexture(SDL_Texture*,float*,float*); int SDL_GL_UnbindTexture(SDL_Texture*); SDL_RWops* SDL_RWFromFile(const(char)*,const(char)*); SDL_RWops* SDL_RWFromFP(FILE*,SDL_bool); SDL_RWops* SDL_RWFromMem(void*,int); SDL_RWops* SDL_RWFromConstMem(const(void)*,int); SDL_RWops* SDL_AllocRW(); void SDL_FreeRW(SDL_RWops*); Uint8 SDL_ReadU8(SDL_RWops*); Uint16 SDL_ReadLE16(SDL_RWops*); Uint16 SDL_ReadBE16(SDL_RWops*); Uint32 SDL_ReadLE32(SDL_RWops*); Uint32 SDL_ReadBE32(SDL_RWops*); Uint64 SDL_ReadLE64(SDL_RWops*); Uint64 SDL_ReadBE64(SDL_RWops*); size_t SDL_WriteU8(SDL_RWops*,Uint8); size_t SDL_WriteLE16(SDL_RWops*,Uint16); size_t SDL_WriteBE16(SDL_RWops*,Uint16); size_t SDL_WriteLE32(SDL_RWops*,Uint32); size_t SDL_WriteBE32(SDL_RWops*,Uint32); size_t SDL_WriteLE64(SDL_RWops*,Uint64); size_t SDL_WriteBE64(SDL_RWops*,Uint64); SDL_Window* SDL_CreateShapedWindow(const(char)*,uint,uint,uint,uint,Uint32); SDL_bool SDL_IsShapedWindow(const(SDL_Window)*); int SDL_SetWindowShape(SDL_Window*,SDL_Surface*,SDL_WindowShapeMode*); int SDL_GetShapedWindowMode(SDL_Window*,SDL_WindowShapeMode*); SDL_Surface* SDL_CreateRGBSurface(Uint32,int,int,int,Uint32,Uint32,Uint32,Uint32); SDL_Surface* SDL_CreateRGBSurfaceWithFormat(Uint32,int,int,int,Uint32); SDL_Surface* SDL_CreateRGBSurfaceFrom(void*,int,int,int,int,Uint32,Uint32,Uint32,Uint32); SDL_Surface* SDL_CreateRGBSurfaceWithFormatFrom(void*,int,int,int,int,Uint32); void SDL_FreeSurface(SDL_Surface*); int SDL_SetSurfacePalette(SDL_Surface*,SDL_Palette*); int SDL_LockSurface(SDL_Surface*); int SDL_UnlockSurface(SDL_Surface*); SDL_Surface* SDL_LoadBMP_RW(SDL_RWops*,int); int SDL_SaveBMP_RW(SDL_Surface*,SDL_RWops*,int); int SDL_SetSurfaceRLE(SDL_Surface*,int); int SDL_SetColorKey(SDL_Surface*,int,Uint32); int SDL_GetColorKey(SDL_Surface*,Uint32*); int SDL_SetSurfaceColorMod(SDL_Surface*,Uint8,Uint8,Uint8); int SDL_GetSurfaceColorMod(SDL_Surface*,Uint8*,Uint8*,Uint8*); int SDL_SetSurfaceAlphaMod(SDL_Surface*,Uint8); int SDL_GetSurfaceAlphaMod(SDL_Surface*,Uint8*); int SDL_SetSurfaceBlendMode(SDL_Surface*,SDL_BlendMode); int SDL_GetSurfaceBlendMode(SDL_Surface*,SDL_BlendMode*); SDL_bool SDL_SetClipRect(SDL_Surface*,const(SDL_Rect)*); void SDL_GetClipRect(SDL_Surface*,SDL_Rect*); SDL_Surface* SDL_ConvertSurface(SDL_Surface*,const(SDL_PixelFormat)*,Uint32); SDL_Surface* SDL_ConvertSurfaceFormat(SDL_Surface*,Uint32,Uint32); int SDL_ConvertPixels(int,int,Uint32,const(void)*,int,Uint32,void*,int); int SDL_FillRect(SDL_Surface*,const(SDL_Rect)*,Uint32); int SDL_FillRects(SDL_Surface*,const(SDL_Rect)*,int,Uint32); int SDL_UpperBlit(SDL_Surface*,const(SDL_Rect)*,SDL_Surface*,SDL_Rect*); int SDL_LowerBlit(SDL_Surface*,SDL_Rect*,SDL_Surface*,SDL_Rect*); int SDL_SoftStretch(SDL_Surface*,const(SDL_Rect)*,SDL_Surface*,const(SDL_Rect)*); int SDL_UpperBlitScaled(SDL_Surface*,const(SDL_Rect)*,SDL_Surface*,SDL_Rect*); int SDL_LowerBlitScaled(SDL_Surface*,SDL_Rect*,SDL_Surface*,SDL_Rect*); static if(Derelict_OS_Windows) { int SDL_Direct3D9GetAdapterIndex(int); IDirect3DDevice9* SDL_RenderGetD3D9Device(SDL_Renderer*); SDL_bool SDL_DXGIGetOutputInfo(int,int*,int*); } static if(Derelict_OS_iOS) { int SDL_iPhoneSetAnimationCallback(SDL_Window*,int,SDL_iPhoneAnimationCallback,void*); void SDL_iPhoneSetEventPump(SDL_bool); } static if(Derelict_OS_Android) { void* SDL_AndroidGetJNIEnv(); void* SDL_AndroidGetActivity(); const(char)* SDL_AndroidGetInternalStoragePath(); int SDL_AndroidGetInternalStorageState(); const(char)* SDL_AndroidGetExternalStoragePath(); } static if(Derelict_OS_WinRT) { const(wchar_t)* SDL_WinRTGetFSPathUNICODE(SDL_WinRT_Path); const(char)* SDL_WinRTGetFSPathUTF8(SDL_WinRT_Path); int SDL_WinRTRunApp(int function(int,char**),void*); } SDL_bool SDL_GetWindowWMInfo(SDL_Window* window,SDL_SysWMinfo * info); Uint32 SDL_GetTicks(); Uint64 SDL_GetPerformanceCounter(); Uint64 SDL_GetPerformanceFrequency(); void SDL_Delay(Uint32); SDL_TimerID SDL_AddTimer(Uint32,SDL_TimerCallback,void*); SDL_bool SDL_RemoveTimer(SDL_TimerID); int SDL_GetNumTouchDevices(); SDL_TouchID SDL_GetTouchDevice(int); int SDL_GetNumTouchFingers(SDL_TouchID); SDL_Finger* SDL_GetTouchFinger(SDL_TouchID,int); void SDL_GetVersion(SDL_version*); const(char)* SDL_GetRevision(); int SDL_GetRevisionNumber(); int SDL_GetNumVideoDrivers(); const(char)* SDL_GetVideoDriver(int); int SDL_VideoInit(const(char)*); void SDL_VideoQuit(); const(char)* SDL_GetCurrentVideoDriver(); int SDL_GetNumVideoDisplays(); const(char)* SDL_GetDisplayName(int); int SDL_GetDisplayBounds(int,SDL_Rect*); int SDL_GetDisplayDPI(int,float*,float*,float*); int SDL_GetDisplayUsableBounds(int,SDL_Rect*); int SDL_GetNumDisplayModes(int); int SDL_GetDisplayMode(int,int,SDL_DisplayMode*); int SDL_GetDesktopDisplayMode(int,SDL_DisplayMode*); int SDL_GetCurrentDisplayMode(int,SDL_DisplayMode*); SDL_DisplayMode* SDL_GetClosestDisplayMode(int,const(SDL_DisplayMode)*,SDL_DisplayMode*); int SDL_GetWindowDisplayIndex(SDL_Window*); int SDL_SetWindowDisplayMode(SDL_Window*,const(SDL_DisplayMode)*); int SDL_GetWindowDisplayMode(SDL_Window*,SDL_DisplayMode*); Uint32 SDL_GetWindowPixelFormat(SDL_Window*); SDL_Window* SDL_CreateWindow(const(char)*,int,int,int,int,SDL_WindowFlags); SDL_Window* SDL_CreateWindowFrom(const(void)*); Uint32 SDL_GetWindowID(SDL_Window*); SDL_Window* SDL_GetWindowFromID(Uint32); SDL_WindowFlags SDL_GetWindowFlags(SDL_Window*); void SDL_SetWindowTitle(SDL_Window*,const(char)*); const(char)* SDL_GetWindowTitle(SDL_Window*); void SDL_SetWindowIcon(SDL_Window*,SDL_Surface*); void* SDL_SetWindowData(SDL_Window*,const(char)*,void*); void* SDL_GetWindowData(SDL_Window*,const(char)*); void SDL_SetWindowPosition(SDL_Window*,int,int); void SDL_GetWindowPosition(SDL_Window*,int*,int*); void SDL_SetWindowSize(SDL_Window*,int,int); void SDL_GetWindowSize(SDL_Window*,int*,int*); int SDL_GetWindowBordersSize(SDL_Window*,int*,int*,int*,int*); void SDL_SetWindowMinimumSize(SDL_Window*,int,int); void SDL_GetWindowMinimumSize(SDL_Window*,int*,int*); void SDL_SetWindowMaximumSize(SDL_Window*,int,int); void SDL_GetWindowMaximumSize(SDL_Window*,int*,int*); void SDL_SetWindowBordered(SDL_Window*,SDL_bool); void SDL_SetWindowResizable(SDL_Window*,SDL_bool); void SDL_ShowWindow(SDL_Window*); void SDL_HideWindow(SDL_Window*); void SDL_RaiseWindow(SDL_Window*); void SDL_MaximizeWindow(SDL_Window*); void SDL_MinimizeWindow(SDL_Window*); void SDL_RestoreWindow(SDL_Window*); int SDL_SetWindowFullscreen(SDL_Window*,Uint32); SDL_Surface* SDL_GetWindowSurface(SDL_Window*); int SDL_UpdateWindowSurface(SDL_Window*); int SDL_UpdateWindowSurfaceRects(SDL_Window*,SDL_Rect*,int); void SDL_SetWindowGrab(SDL_Window*,SDL_bool); SDL_bool SDL_GetWindowGrab(SDL_Window*); SDL_Window* SDL_GetGrabbedWindow(); int SDL_SetWindowBrightness(SDL_Window*,float); float SDL_GetWindowBrightness(SDL_Window*); int SDL_SetWindowOpacity(SDL_Window*,float); int SDL_GetWindowOpacity(SDL_Window*,float*); int SDL_SetWindowModalFor(SDL_Window*,SDL_Window*); int SDL_SetWindowInputFocus(SDL_Window*); int SDL_SetWindowGammaRamp(SDL_Window*,const(Uint16)*,const(Uint16)*,const(Uint16)*); int SDL_GetWindowGammaRamp(SDL_Window*,Uint16*,Uint16*,Uint16*); int SDL_SetWindowHitTest(SDL_Window*,SDL_HitTest,void*); void SDL_DestroyWindow(SDL_Window*); SDL_bool SDL_IsScreenSaverEnabled(); void SDL_EnableScreenSaver(); void SDL_DisableScreenSaver(); int SDL_GL_LoadLibrary(const(char)*); void* SDL_GL_GetProcAddress(const(char)*); void SDL_GL_UnloadLibrary(); SDL_bool SDL_GL_ExtensionSupported(const(char)*); void SDL_GL_ResetAttributes(); int SDL_GL_SetAttribute(SDL_GLattr,int); int SDL_GL_GetAttribute(SDL_GLattr,int*); SDL_GLContext SDL_GL_CreateContext(SDL_Window*); int SDL_GL_MakeCurrent(SDL_Window*,SDL_GLContext); SDL_Window* SDL_GL_GetCurrentWindow(); SDL_GLContext SDL_GL_GetCurrentContext(); void SDL_GL_GetDrawableSize(SDL_Window*,int*,int*); int SDL_GL_SetSwapInterval(int); int SDL_GL_GetSwapInterval(); void SDL_GL_SwapWindow(SDL_Window*); void SDL_GL_DeleteContext(SDL_GLContext); }
D
module eventcore.internal.win32; version(Windows): public import core.sys.windows.windows; public import core.sys.windows.winsock2; extern(System) nothrow @nogc: enum { FD_READ = 0x0001, FD_WRITE = 0x0002, FD_OOB = 0x0004, FD_ACCEPT = 0x0008, FD_CONNECT = 0x0010, FD_CLOSE = 0x0020, FD_QOS = 0x0040, FD_GROUP_QOS = 0x0080, FD_ROUTING_INTERFACE_CHANGE = 0x0100, FD_ADDRESS_LIST_CHANGE = 0x0200 } enum { WSA_FLAG_OVERLAPPED = 0x01 } enum { WSAPROTOCOL_LEN = 255, MAX_PROTOCOL_CHAIN = 7, } enum WSA_IO_PENDING = 997; struct WSAPROTOCOL_INFOW { DWORD dwServiceFlags1; DWORD dwServiceFlags2; DWORD dwServiceFlags3; DWORD dwServiceFlags4; DWORD dwProviderFlags; GUID ProviderId; DWORD dwCatalogEntryId; WSAPROTOCOLCHAIN ProtocolChain; int iVersion; int iAddressFamily; int iMaxSockAddr; int iMinSockAddr; int iSocketType; int iProtocol; int iProtocolMaxOffset; int iNetworkByteOrder; int iSecurityScheme; DWORD dwMessageSize; DWORD dwProviderReserved; WCHAR[WSAPROTOCOL_LEN+1] szProtocol; } struct WSAPROTOCOLCHAIN { int ChainLen; DWORD[MAX_PROTOCOL_CHAIN] ChainEntries; } struct WSABUF { size_t len; ubyte *buf; } struct ADDRINFOEXW { int ai_flags; int ai_family; int ai_socktype; int ai_protocol; size_t ai_addrlen; LPCWSTR ai_canonname; sockaddr* ai_addr; void* ai_blob; size_t ai_bloblen; GUID* ai_provider; ADDRINFOEXW* ai_next; } struct ADDRINFOA { int ai_flags; int ai_family; int ai_socktype; int ai_protocol; size_t ai_addrlen; LPSTR ai_canonname; sockaddr* ai_addr; ADDRINFOA* ai_next; } struct ADDRINFOW { int ai_flags; int ai_family; int ai_socktype; int ai_protocol; size_t ai_addrlen; LPWSTR ai_canonname; sockaddr* ai_addr; ADDRINFOW* ai_next; } struct WSAPROTOCOL_INFO { DWORD dwServiceFlags1; DWORD dwServiceFlags2; DWORD dwServiceFlags3; DWORD dwServiceFlags4; DWORD dwProviderFlags; GUID ProviderId; DWORD dwCatalogEntryId; WSAPROTOCOLCHAIN ProtocolChain; int iVersion; int iAddressFamily; int iMaxSockAddr; int iMinSockAddr; int iSocketType; int iProtocol; int iProtocolMaxOffset; int iNetworkByteOrder; int iSecurityScheme; DWORD dwMessageSize; DWORD dwProviderReserved; CHAR[WSAPROTOCOL_LEN+1] szProtocol; } alias SOCKADDR = sockaddr; alias LPWSAOVERLAPPED_COMPLETION_ROUTINEX = void function(DWORD, DWORD, WSAOVERLAPPEDX*, DWORD); alias LPLOOKUPSERVICE_COMPLETION_ROUTINE = void function(DWORD, DWORD, WSAOVERLAPPEDX*); alias LPCONDITIONPROC = void*; alias LPTRANSMIT_FILE_BUFFERS = void*; SOCKET WSAAccept(SOCKET s, sockaddr *addr, INT* addrlen, LPCONDITIONPROC lpfnCondition, DWORD_PTR dwCallbackData); int WSAAsyncSelect(SOCKET s, HWND hWnd, uint wMsg, sizediff_t lEvent); SOCKET WSASocketW(int af, int type, int protocol, WSAPROTOCOL_INFOW *lpProtocolInfo, uint g, DWORD dwFlags); int WSARecv(SOCKET s, WSABUF* lpBuffers, DWORD dwBufferCount, DWORD* lpNumberOfBytesRecvd, DWORD* lpFlags, in WSAOVERLAPPEDX* lpOverlapped, LPWSAOVERLAPPED_COMPLETION_ROUTINEX lpCompletionRoutine); int WSASend(SOCKET s, in WSABUF* lpBuffers, DWORD dwBufferCount, DWORD* lpNumberOfBytesSent, DWORD dwFlags, in WSAOVERLAPPEDX* lpOverlapped, LPWSAOVERLAPPED_COMPLETION_ROUTINEX lpCompletionRoutine); int WSASendDisconnect(SOCKET s, WSABUF* lpOutboundDisconnectData); INT WSAStringToAddressA(in LPTSTR AddressString, INT AddressFamily, in WSAPROTOCOL_INFO* lpProtocolInfo, SOCKADDR* lpAddress, INT* lpAddressLength); INT WSAStringToAddressW(in LPWSTR AddressString, INT AddressFamily, in WSAPROTOCOL_INFOW* lpProtocolInfo, SOCKADDR* lpAddress, INT* lpAddressLength); INT WSAAddressToStringW(in SOCKADDR* lpsaAddress, DWORD dwAddressLength, in WSAPROTOCOL_INFO* lpProtocolInfo, LPWSTR lpszAddressString, DWORD* lpdwAddressStringLength); int GetAddrInfoExW(LPCWSTR pName, LPCWSTR pServiceName, DWORD dwNameSpace, GUID* lpNspId, const ADDRINFOEXW *pHints, ADDRINFOEXW **ppResult, timeval *timeout, WSAOVERLAPPEDX* lpOverlapped, LPLOOKUPSERVICE_COMPLETION_ROUTINE lpCompletionRoutine, HANDLE* lpNameHandle); int GetAddrInfoW(LPCWSTR pName, LPCWSTR pServiceName, const ADDRINFOW *pHints, ADDRINFOW **ppResult); int getaddrinfo(LPCSTR pName, LPCSTR pServiceName, const ADDRINFOA *pHints, ADDRINFOA **ppResult); void FreeAddrInfoW(ADDRINFOW* pAddrInfo); void FreeAddrInfoExW(ADDRINFOEXW* pAddrInfo); void freeaddrinfo(ADDRINFOA* ai); BOOL TransmitFile(SOCKET hSocket, HANDLE hFile, DWORD nNumberOfBytesToWrite, DWORD nNumberOfBytesPerSend, OVERLAPPED* lpOverlapped, LPTRANSMIT_FILE_BUFFERS lpTransmitBuffers, DWORD dwFlags); struct WSAOVERLAPPEDX { ULONG_PTR Internal; ULONG_PTR InternalHigh; union { struct { DWORD Offset; DWORD OffsetHigh; } PVOID Pointer; } HANDLE hEvent; }
D
the season of growth a metal elastic device that returns to its shape or position when pushed or pulled or pressed a natural flow of ground water a point at which water issues forth the elasticity of something that can be stretched and returns to its original length a light, self-propelled movement upwards or forwards move forward by leaps and bounds develop into a distinctive entity spring back develop suddenly produce or disclose suddenly or unexpectedly
D
/* Copyright (c) 2016-2023 Eugene Wissner, Timur Gafarov Boost Software License - Version 1.0 - August 17th, 2003 Permission is hereby granted, free of charge, to any person or organization obtaining a copy of the software and accompanying documentation covered by this license (the "Software") to use, reproduce, display, distribute, execute, and transmit the Software, and to prepare derivative works of the Software, and to permit third-parties to whom the Software is furnished to do so, all subject to the following: The copyright notices in the Software and this entire statement, including the above license grant, this restriction and the following disclaimer, must be included in all copies of the Software, in whole or in part, and all derivative works of the Software, unless such copies or derivative works are solely in the form of machine-executable object code generated by a source language processor. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** * Networking and web functionality * * Copyright: Eugene Wissner, Timur Gafarov 2016-2023. * License: $(LINK2 boost.org/LICENSE_1_0.txt, Boost License 1.0). * Authors: Eugene Wissner, Timur Gafarov */ module dlib.network; public { import dlib.network.socket; import dlib.network.url; }
D
var int LokiAnsewrOne; var int LokiAnsewrTwo; var int LokiAnsewrThree; instance DIA_SEK_8049_LOKI_EXIT(C_Info) { npc = SEK_8049_LOKI; nr = 999; condition = dia_SEK_8049_LOKI_exit_condition; information = dia_SEK_8049_LOKI_exit_info; permanent = TRUE; description = Dialog_Ende; }; func int dia_SEK_8049_LOKI_exit_condition() { return TRUE; }; func void dia_SEK_8049_LOKI_exit_info() { AI_StopProcessInfos(self); }; instance DIA_SEK_8049_LOKI_GREET(C_Info) { npc = SEK_8049_LOKI; nr = 1; condition = dia_SEK_8049_LOKI_greet_condition; information = dia_SEK_8049_LOKI_greet_info; permanent = FALSE; description = "Rád bych s tebou pohovořil novici."; }; func int dia_SEK_8049_LOKI_greet_condition() { return TRUE; }; func void dia_SEK_8049_LOKI_greet_info() { AI_Output(other,self,"DIA_SEK_8049_LOKI_Greet_01_00"); //Rád bych s tebou pohovořil novici. AI_Output(self,other,"DIA_SEK_8049_LOKI_Greet_01_01"); //O čem konkrétně? AI_Output(other,self,"DIA_SEK_8049_LOKI_Greet_01_02"); //Rád bych znal podrobnosti o nedávném útoku. AI_Output(self,other,"DIA_SEK_8049_LOKI_Greet_01_03"); //Aha, tohle... (nervózně) Snažím se na to zapomenout. Ale jak to vypadá, není mě to souzeno. AI_Output(other,self,"DIA_SEK_8049_LOKI_Greet_01_04"); //Chápu, že na to chceš zapomenou. AI_Output(other,self,"DIA_SEK_8049_LOKI_Greet_01_05"); //Ale musíš pochopit, že tvoje zázračná záchrana, není garancí klidného života. AI_Output(other,self,"DIA_SEK_8049_LOKI_Greet_01_06"); //A ostatní členové Bratrstva stále čelí velkému nebezpečí! AI_Output(other,self,"DIA_SEK_8049_LOKI_Greet_01_07"); //Proto mě musíš pomoci. AI_Output(self,other,"DIA_SEK_8049_LOKI_Greet_01_08"); //Hmm... (odevzdaně) No dobře, asi máš pravdu. Ptej se na co chceš. }; instance DIA_SEK_8049_LOKI_Survive(C_Info) { npc = SEK_8049_LOKI; nr = 1; condition = dia_SEK_8049_LOKI_Survive_condition; information = dia_SEK_8049_LOKI_Survive_info; permanent = FALSE; description = "Jak se ti povedlo přežít?"; }; func int dia_SEK_8049_LOKI_Survive_condition() { if(Npc_KnowsInfo(hero,DIA_SEK_8049_LOKI_Greet)) { return TRUE; }; }; func void dia_SEK_8049_LOKI_Survive_info() { AI_Output(other,self,"DIA_SEK_8049_LOKI_Survive_01_00"); //Jak se ti povedlo přežít? AI_Output(self,other,"DIA_SEK_8049_LOKI_Survive_01_01"); //Myslím, že jsem měl prostě štěstí... (zmateně) Nenapadá mě nic jiného! AI_Output(self,other,"DIA_SEK_8049_LOKI_Survive_01_02"); //Našel jsem ohromnou louku plnou trávy z bažin a tak jsem se zabral do sbírání, ani jsem si nevšimnul, že jsem se vzdálil od našeho tábora. AI_Output(self,other,"DIA_SEK_8049_LOKI_Survive_01_03"); //Slyšel jsem zvuky bitvy, tak jsem se schoval v blízkém keři, a čekal až bude po všem. AI_Output(self,other,"DIA_SEK_8049_LOKI_Survive_01_04"); //To je vše. LokiAnsewrOne = TRUE; }; instance DIA_SEK_8049_LOKI_Attackers(C_Info) { npc = SEK_8049_LOKI; nr = 1; condition = dia_SEK_8049_LOKI_Attackers_condition; information = dia_SEK_8049_LOKI_Attackers_info; permanent = FALSE; description = "Jak vypadali útočníci?"; }; func int dia_SEK_8049_LOKI_Attackers_condition() { if(Npc_KnowsInfo(hero,DIA_SEK_8049_LOKI_Greet)) { return TRUE; }; }; func void dia_SEK_8049_LOKI_Attackers_info() { AI_Output(other,self,"DIA_SEK_8049_LOKI_Attackers_01_00"); //Jak vypadali útočníci? AI_Output(self,other,"DIA_SEK_8049_LOKI_Attackers_01_01"); //Nevím... (zmateně) Všichni měli na tvářích masky. AI_Output(self,other,"DIA_SEK_8049_LOKI_Attackers_01_02"); //Jediné na co si vzpomínám, je že jejich těla byla pokryta podivnými kresbami. AI_Output(self,other,"DIA_SEK_8049_LOKI_Attackers_01_03"); //Jsou trochu podobné těm, které děláme v táboře Bratrstva. AI_Output(other,self,"DIA_SEK_8049_LOKI_Attackers_01_04"); //A říkali něco? AI_Output(self,other,"DIA_SEK_8049_LOKI_Attackers_01_05"); //Ne, za celou dobu neřekli ani slovo. LokiAnsewrTwo = TRUE; }; instance DIA_SEK_8049_LOKI_Other(C_Info) { npc = SEK_8049_LOKI; nr = 1; condition = dia_SEK_8049_LOKI_Other_condition; information = dia_SEK_8049_LOKI_Other_info; permanent = FALSE; description = "Co se stalo s ostatníma?"; }; func int dia_SEK_8049_LOKI_Other_condition() { if(Npc_KnowsInfo(hero,DIA_SEK_8049_LOKI_Greet)) { return TRUE; }; }; func void dia_SEK_8049_LOKI_Other_info() { AI_Output(other,self,"DIA_SEK_8049_LOKI_Other_01_00"); //Co se stalo s ostatníma? AI_Output(self,other,"DIA_SEK_8049_LOKI_Other_01_01"); //Všechny novice odvedli sebou. A ty co se bránili na místě zabili. AI_Output(self,other,"DIA_SEK_8049_LOKI_Other_01_02"); //Víc toho nevím. LokiAnsewrThree = TRUE; }; instance DIA_SEK_8049_LOKI_Sign(C_Info) { npc = SEK_8049_LOKI; nr = 1; condition = dia_SEK_8049_LOKI_Sign_condition; information = dia_SEK_8049_LOKI_Sign_info; permanent = FALSE; description = "O tom amuletu co ti ukázal Baal Namib."; }; func int dia_SEK_8049_LOKI_Sign_condition() { if((LokiAnsewrOne == TRUE) && (LokiAnsewrTwo == TRUE) && (LokiAnsewrThree == TRUE)) { return TRUE; }; }; func void dia_SEK_8049_LOKI_Sign_info() { AI_Output(other,self,"DIA_SEK_8049_LOKI_Sign_01_00"); //O tom amuletu co ti ukázal Baal Namib. AI_Output(other,self,"DIA_SEK_8049_LOKI_Sign_01_01"); //Víš o něm něco? AI_Output(self,other,"DIA_SEK_8049_LOKI_Sign_01_02"); //Ne, nic o něm nevím. AI_Output(self,other,"DIA_SEK_8049_LOKI_Sign_01_03"); //Po pravdě... měl jsem pocit, že symbol co je zobrazen v jeho středu jsem už někde viděl. AI_Output(self,other,"DIA_SEK_8049_LOKI_Sign_01_04"); //Ale nemohu si vzpomenout kde. AI_Output(other,self,"DIA_SEK_8049_LOKI_Sign_01_05"); //Jseš si jistej? AI_Output(self,other,"DIA_SEK_8049_LOKI_Sign_01_06"); //Ano, jinak bych tomu symbolu nepřikládal tak velký význam. AI_Output(other,self,"DIA_SEK_8049_LOKI_Sign_01_07"); //Ale proč jsi o tom neřekl Baalu Namibovi?! AI_Output(self,other,"DIA_SEK_8049_LOKI_Sign_01_08"); //Víš... Byl jsem tenkrát příliš vystrašený a bál jsem se, že se mohu ve svém úsudku mýlit. AI_Output(other,self,"DIA_SEK_8049_LOKI_Sign_01_09"); //Nyní musíme zajistit, aby sis na všechno vzpomněl. Může to být velmi důležité! AI_Output(self,other,"DIA_SEK_8049_LOKI_Sign_01_10"); //Ale jak to chceš udělat?... (zmateně) Bojím se, že ti v tom nijak nemohu pomoci. AI_Output(other,self,"DIA_SEK_8049_LOKI_Sign_01_11"); //Na něco přijdu. B_LogEntry(TOPIC_PrioratStart,"Zjistil jsem, že Loki znal symbol, který mu ukázal Baal Namib na amuletu. Nicméně Loki si nemůže vzpomenout kdy a kde to bylo. Je potřeba mu osvěžit paměť. Možná některý z Guru bude znát způsob jak to udělat."); LokiNeedMemory = TRUE; }; instance DIA_SEK_8049_LOKI_SPECIALPOTION(C_Info) { npc = SEK_8049_LOKI; nr = 1; condition = dia_SEK_8049_LOKI_SPECIALPOTION_condition; information = dia_SEK_8049_LOKI_SPECIALPOTION_info; permanent = FALSE; description = "Tady, vypí tento nápoj."; }; func int dia_SEK_8049_LOKI_SPECIALPOTION_condition() { if((MIS_PrioratStart == LOG_Running) && (LokiMemoriesAlive == FALSE) && (Npc_HasItems(other,ItPo_Memories) >= 1)) { return TRUE; }; }; func void dia_SEK_8049_LOKI_SPECIALPOTION_info() { AI_Output(other,self,"DIA_SEK_8049_LOKI_SPECIALPOTION_01_00"); //Tady, vypí tento nápoj. AI_Output(self,other,"DIA_SEK_8049_LOKI_SPECIALPOTION_01_01"); //A co je to? AI_Output(other,self,"DIA_SEK_8049_LOKI_SPECIALPOTION_01_02"); //Neboj se, jen ti pomůže vzpomenout si. AI_Output(self,other,"DIA_SEK_8049_LOKI_SPECIALPOTION_01_03"); //No, dobře... (nedůvěřivě) dej to sem. AI_StopProcessInfos(self); B_GiveInvItems(other,self,ItPo_Memories,1); if(C_BodyStateContains(self,BS_SIT)) { AI_Standup(self); AI_TurnToNPC(self,other); }; AI_UseItem(self,ItPo_Memories); LokiMemoriesAlive = TRUE; Npc_SetRefuseTalk(self,5); hero.aivar[AIV_INVINCIBLE] = FALSE; }; instance DIA_SEK_8049_LOKI_SPECIALPOTION_OK(C_Info) { npc = SEK_8049_LOKI; nr = 1; condition = DIA_SEK_8049_LOKI_SPECIALPOTION_OK_condition; information = DIA_SEK_8049_LOKI_SPECIALPOTION_OK_info; permanent = FALSE; important = TRUE; }; func int DIA_SEK_8049_LOKI_SPECIALPOTION_OK_condition() { if(LokiMemoriesAlive == TRUE) { return TRUE; }; }; func void DIA_SEK_8049_LOKI_SPECIALPOTION_OK_info() { B_GivePlayerXP(100); AI_Output(self,other,"DIA_SEK_8049_LOKI_SPECIALPOTION_OK_01_00"); //Och... (probírá se) Sakra, co to bylo?! AI_Output(other,self,"DIA_SEK_8049_LOKI_SPECIALPOTION_OK_01_01"); //Tak jak se cítíš? AI_Output(self,other,"DIA_SEK_8049_LOKI_SPECIALPOTION_OK_01_02"); //Nemůžu říct, že moc dobře... (překvapeně) Ten váš nápoj má dost silné učinky na mozek! AI_Output(self,other,"DIA_SEK_8049_LOKI_SPECIALPOTION_OK_01_03"); //Zdá se, že jsem byl v bezvědomí několik minut. AI_Output(other,self,"DIA_SEK_8049_LOKI_SPECIALPOTION_OK_01_04"); //To je pravda. A teď k věci. AI_Output(other,self,"DIA_SEK_8049_LOKI_SPECIALPOTION_OK_01_05"); //Už sis vzpomněl, kde jsi viděl ten symbol z amuletu? AI_Output(self,other,"DIA_SEK_8049_LOKI_SPECIALPOTION_OK_01_06"); //Ano, pamatuji si všechno a ještě víc než bych chtěl. AI_Output(other,self,"DIA_SEK_8049_LOKI_SPECIALPOTION_OK_01_07"); //A můžeš mě tam dovést? AI_Output(self,other,"DIA_SEK_8049_LOKI_SPECIALPOTION_OK_01_08"); //Myslím, že ano. To místo není daleko od našeho tábora. AI_Output(other,self,"DIA_SEK_8049_LOKI_SPECIALPOTION_OK_01_09"); //Tak nebudem ztrácet čas - veď mě. Npc_ExchangeRoutine(self,"GUIDE"); AI_Output(self,other,"DIA_SEK_8049_LOKI_SPECIALPOTION_OK_01_10"); //Dobře, pojď za mnou. AI_StopProcessInfos(self); self.aivar[AIV_PARTYMEMBER] = TRUE; LokiGuide = TRUE; Loki_GuideDay = Wld_GetDay(); }; instance DIA_SEK_8049_LOKI_GUIDE(C_Info) { npc = SEK_8049_LOKI; nr = 1; condition = DIA_SEK_8049_LOKI_GUIDE_Condition; information = DIA_SEK_8049_LOKI_GUIDE_Info; permanent = FALSE; important = TRUE; }; func int DIA_SEK_8049_LOKI_GUIDE_Condition() { if((LokiGuide == TRUE) && (Npc_GetDistToWP(self,"NW_TO_NEWCAMPPSI_01") <= 1000)) { return TRUE; }; }; func void DIA_SEK_8049_LOKI_GUIDE_Info() { B_GivePlayerXP(500); if(Loki_GuideDay > (Wld_GetDay() - 2)) { AI_Output(self,other,"DIA_SEK_8049_LOKI_GUIDE_01_00"); //Tak jsme tady. } else { AI_Output(self,other,"DIA_SEK_8049_LOKI_GUIDE_01_01"); //Kde jsi byl, už jsem si začínal myslet že tě roztrhali vlci. }; AI_Output(other,self,"DIA_SEK_8049_LOKI_GUIDE_01_02"); //A co tady je? AI_Output(self,other,"DIA_SEK_8049_LOKI_GUIDE_01_03"); //... (rozhlíží se) Za mnou je zvláštní kámen a na něm jsem viděl ten symbol co tě zajímal. AI_Output(other,self,"DIA_SEK_8049_LOKI_GUIDE_01_04"); //Dobře, podívám se. AI_Output(self,other,"DIA_SEK_8049_LOKI_GUIDE_01_05"); //Hele... (nervózně) Radši se vrátím zpět do tábora, vzpomínám, že jsem z toho místa neměl dobrý pocit. AI_Output(self,other,"DIA_SEK_8049_LOKI_GUIDE_01_06"); //Uvidíme se později, kamaráde. AI_Output(other,self,"DIA_SEK_8049_LOKI_GUIDE_01_07"); //Samo sebou. Assasins_Door_Found = TRUE; self.aivar[AIV_PARTYMEMBER] = FALSE; AI_StopProcessInfos(self); Npc_ExchangeRoutine(self,"PsiCamp"); };
D
instance DIA_Addon_Owen_EXIT(C_Info) { npc = PIR_1367_Addon_Owen; nr = 999; condition = DIA_Addon_Owen_EXIT_Condition; information = DIA_Addon_Owen_EXIT_Info; permanent = TRUE; description = Dialog_Ende; }; func int DIA_Addon_Owen_EXIT_Condition() { return TRUE; }; func void DIA_Addon_Owen_EXIT_Info() { AI_StopProcessInfos(self); }; instance DIA_Addon_Owen_PICKPOCKET(C_Info) { npc = PIR_1367_Addon_Owen; nr = 900; condition = DIA_Addon_Owen_PICKPOCKET_Condition; information = DIA_Addon_Owen_PICKPOCKET_Info; permanent = TRUE; description = Pickpocket_20; }; func int DIA_Addon_Owen_PICKPOCKET_Condition() { return C_Beklauen(20,30); }; func void DIA_Addon_Owen_PICKPOCKET_Info() { Info_ClearChoices(DIA_Addon_Owen_PICKPOCKET); Info_AddChoice(DIA_Addon_Owen_PICKPOCKET,Dialog_Back,DIA_Addon_Owen_PICKPOCKET_BACK); Info_AddChoice(DIA_Addon_Owen_PICKPOCKET,DIALOG_PICKPOCKET,DIA_Addon_Owen_PICKPOCKET_DoIt); }; func void DIA_Addon_Owen_PICKPOCKET_DoIt() { B_Beklauen(); Info_ClearChoices(DIA_Addon_Owen_PICKPOCKET); }; func void DIA_Addon_Owen_PICKPOCKET_BACK() { Info_ClearChoices(DIA_Addon_Owen_PICKPOCKET); }; instance DIA_Addon_Owen_Hello(C_Info) { npc = PIR_1367_Addon_Owen; nr = 1; condition = DIA_Addon_Owen_Hello_Condition; information = DIA_Addon_Owen_Hello_Info; important = TRUE; }; func int DIA_Addon_Owen_Hello_Condition() { if(Npc_IsInState(self,ZS_Talk) && (self.aivar[AIV_TalkedToPlayer] == FALSE)) { return TRUE; }; }; func void DIA_Addon_Owen_Hello_Info() { var C_Item itm; AI_Output(other,self,"DIA_Addon_Owen_Hello_15_00"); //Как дела? AI_Output(self,other,"DIA_Addon_Owen_Hello_13_01"); //А ты кто такой? Один из бандитов? AI_Output(other,self,"DIA_Addon_Owen_Hello_15_02"); //А что, похож? itm = Npc_GetEquippedArmor(other); if((Hlp_IsItem(itm,ITAR_PIR_M_Addon) == TRUE) || (Hlp_IsItem(itm,ITAR_PIR_L_Addon) == TRUE) || (Hlp_IsItem(itm,ITAR_PIR_H_Addon) == TRUE)) { AI_Output(self,other,"DIA_Addon_Owen_Hello_13_03"); //Одет ты так же, как и мы, но я тебя не знаю. } else if((Hlp_IsItem(itm,ItAr_BDT_M) == TRUE) || (Hlp_IsItem(itm,ItAr_BDT_H) == TRUE)) { AI_Output(self,other,"DIA_Addon_Owen_Hello_13_04"); //Честно говоря, да. } else { AI_Output(self,other,"DIA_Addon_Owen_Hello_13_05"); //Нет. Судя по твоей одежде, ты издалека. }; }; instance DIA_Addon_Owen_WasMachen(C_Info) { npc = PIR_1367_Addon_Owen; nr = 2; condition = DIA_Addon_Owen_WasMachen_Condition; information = DIA_Addon_Owen_WasMachen_Info; description = "Что ты делаешь здесь?"; }; func int DIA_Addon_Owen_WasMachen_Condition() { if(Malcom_Accident == FALSE) { return TRUE; }; }; func void DIA_Addon_Owen_WasMachen_Info() { AI_Output(other,self,"DIA_Addon_Owen_WasMachen_15_00"); //Что ты здесь делаешь? AI_Output(self,other,"DIA_Addon_Owen_WasMachen_13_01"); //Рублю деревья для нашего лагеря. AI_Output(self,other,"DIA_Addon_Owen_WasMachen_13_02"); //Я здесь работаю как проклятый, гну спину, а они там в лагере валяются на солнышке. }; instance DIA_Addon_Owen_Perm(C_Info) { npc = PIR_1367_Addon_Owen; nr = 99; condition = DIA_Addon_Owen_Perm_Condition; information = DIA_Addon_Owen_Perm_Info; permanent = TRUE; description = "И?"; }; func int DIA_Addon_Owen_Perm_Condition() { if(Npc_KnowsInfo(other,DIA_Addon_Owen_WasMachen) || Npc_KnowsInfo(other,DIA_Addon_Owen_MalcomStunt)) { return TRUE; }; }; func void DIA_Addon_Owen_Perm_Info() { AI_Output(other,self,"DIA_Addon_Owen_Perm_15_00"); //И? AI_Output(self,other,"DIA_Addon_Owen_Perm_13_01"); //Если бы я знал, что все будет именно так, я бы ни за что не стал пиратом. }; instance DIA_Addon_Owen_Henry(C_Info) { npc = PIR_1367_Addon_Owen; nr = 3; condition = DIA_Addon_Owen_Henry_Condition; information = DIA_Addon_Owen_Henry_Info; permanent = TRUE; description = "Генри нужно дерево."; }; func int DIA_Addon_Owen_Henry_Condition() { if((MIS_Henry_HolOwen == LOG_Running) && (Owen_ComesToHenry == FALSE)) { return TRUE; }; }; func void DIA_Addon_Owen_Henry_Info() { AI_Output(other,self,"DIA_Addon_Owen_Henry_15_00"); //Генри нужно дерево. if(MIS_Owen_FindMalcom != LOG_SUCCESS) { AI_Output(self,other,"DIA_Addon_Owen_Henry_13_01"); //Сначала я должен выяснить, что случилось с моим другом Малькомом. } else { AI_Output(self,other,"DIA_Addon_Owen_Henry_13_02"); //Расслабься. Получит он рано или поздно свое дерево. AI_Output(self,other,"DIA_Addon_Owen_Henry_13_03"); //Так ему и передай. B_LogEntry(TOPIC_Addon_HolOwen,"Я должен передать Генри, что Оуэн доставит дерево."); AI_StopProcessInfos(self); Owen_ComesToHenry = TRUE; }; }; instance DIA_Addon_Owen_MalcomStunt(C_Info) { npc = PIR_1367_Addon_Owen; nr = 1; condition = DIA_Addon_Owen_MalcomStunt_Condition; information = DIA_Addon_Owen_MalcomStunt_Info; description = "Как дела?"; }; func int DIA_Addon_Owen_MalcomStunt_Condition() { if(Malcom_Accident == TRUE) { return TRUE; }; }; func void DIA_Addon_Owen_MalcomStunt_Info() { AI_Output(other,self,"DIA_Addon_Owen_MalcomStunt_15_00"); //Как дела? AI_Output(self,other,"DIA_Addon_Owen_MalcomStunt_13_01"); //Мой приятель Мальком пропал. AI_Output(self,other,"DIA_Addon_Owen_MalcomStunt_13_02"); //На нас напал один из этих луркеров. AI_Output(self,other,"DIA_Addon_Owen_MalcomStunt_13_03"); //Мы убежали в эту пещеру. AI_Output(self,other,"DIA_Addon_Owen_MalcomStunt_13_04"); //Но луркер последовал за нами. AI_Output(self,other,"DIA_Addon_Owen_MalcomStunt_13_05"); //Мальком начал с ним сражаться, а потом они оба упали в ту яму. AI_Output(self,other,"DIA_Addon_Owen_MalcomStunt_13_06"); //Похоже, там на дне вода. AI_Output(self,other,"DIA_Addon_Owen_MalcomStunt_13_07"); //Я слышал, как внизу Мальком дерется с луркером. А потом все стихло. AI_Output(self,other,"DIA_Addon_Owen_MalcomStunt_13_08"); //Не знаю, жив ли еще Мальком. Log_CreateTopic(TOPIC_Addon_MalcomsStunt,LOG_MISSION); Log_SetTopicStatus(TOPIC_Addon_MalcomsStunt,LOG_Running); B_LogEntry(TOPIC_Addon_MalcomsStunt,"Оуэн хочет узнать, что случилось с его другом Малькомом, который упал в глубокую яму после того, как схватился с луркером."); Log_AddEntry(TOPIC_Addon_MalcomsStunt,"Оуэн сказал мне, что на дне ямы вода, и сначала упавший туда Мальком был жив. Но через некоторое время шум в яме стих."); MIS_Owen_FindMalcom = LOG_Running; }; instance DIA_Addon_Owen_runter(C_Info) { npc = PIR_1367_Addon_Owen; nr = 2; condition = DIA_Addon_Owen_runter_Condition; information = DIA_Addon_Owen_runter_Info; description = "Как можно спуститься на дно ямы?"; }; func int DIA_Addon_Owen_runter_Condition() { if(Npc_KnowsInfo(other,DIA_Addon_Owen_MalcomStunt) && (MIS_Owen_FindMalcom == LOG_Running) && (Npc_HasItems(Malcom,ItWr_TwoHStonePlate3_Addon) > 0)) { return TRUE; }; }; func void DIA_Addon_Owen_runter_Info() { AI_Output(other,self,"DIA_Addon_Owen_runter_15_00"); //Как можно спуститься на дно ямы? AI_Output(self,other,"DIA_Addon_Owen_runter_13_01"); //Понятия не имею. Спуститься по стенкам или спрыгнуть, наверное. }; instance DIA_Addon_Owen_MalcomDead(C_Info) { npc = PIR_1367_Addon_Owen; nr = 3; condition = DIA_Addon_Owen_MalcomDead_Condition; information = DIA_Addon_Owen_MalcomDead_Info; description = "Твой приятель Мальком мертв."; }; func int DIA_Addon_Owen_MalcomDead_Condition() { if(Npc_KnowsInfo(other,DIA_Addon_Owen_MalcomStunt) && (MIS_Owen_FindMalcom == LOG_Running) && (Npc_HasItems(Malcom,ItWr_TwoHStonePlate3_Addon) == 0)) { return TRUE; }; }; func void DIA_Addon_Owen_MalcomDead_Info() { AI_Output(other,self,"DIA_Addon_Owen_MalcomDead_15_00"); //Твой приятель Мальком мертв. AI_Output(self,other,"DIA_Addon_Owen_MalcomDead_13_01"); //Я так и знал. Бедняга. Я должен был ему помочь. if(SC_MadeStunt == TRUE) { AI_Output(self,other,"DIA_Addon_Owen_MalcomDead_13_02"); //А ты храбрец. AI_Output(self,other,"DIA_Addon_Owen_MalcomDead_13_03"); //Я бы ни за что не смог спуститься в эту яму. }; B_LogEntry(TOPIC_Addon_MalcomsStunt,"Я рассказал Оуэну о смерти Малькома. Он воспринял новость довольно спокойно."); MIS_Owen_FindMalcom = LOG_SUCCESS; B_GivePlayerXP(XP_Addon_Owen_MalcomDead); };
D
instance DIA_Edda_EXIT(C_Info) { npc = VLK_471_Edda; nr = 999; condition = DIA_Edda_EXIT_Condition; information = DIA_Edda_EXIT_Info; permanent = TRUE; description = Dialog_Ende; }; func int DIA_Edda_EXIT_Condition() { return TRUE; }; func void DIA_Edda_EXIT_Info() { AI_StopProcessInfos(self); }; instance DIA_Edda_Hallo(C_Info) { npc = VLK_471_Edda; nr = 2; condition = DIA_Edda_Hallo_Condition; information = DIA_Edda_Hallo_Info; permanent = FALSE; description = "Что ты варишь?"; }; func int DIA_Edda_Hallo_Condition() { if(Wld_IsTime(8,0,22,0)) { return TRUE; }; }; func void DIA_Edda_Hallo_Info() { AI_Output(other,self,"DIA_Edda_Hallo_15_00"); //Что ты варишь? AI_Output(self,other,"DIA_Edda_Hallo_17_01"); //Уху. Может, она не особенно вкусная, но, по крайней мере, это горячая еда. AI_Output(self,other,"DIA_Edda_Hallo_17_02"); //Могу налить тебе тарелку, если хочешь. AI_Output(self,other,"DIA_Edda_Kochen_17_01"); //Я готовлю для всех. Для тебя тоже, если захочешь. Все, что мне нужно - это чтобы ты принес мне рыбу. }; func void B_Edda_AboutStolenStatue() { if(Wld_IsTime(8,0,22,0)) { AI_Output(self,other,"DIA_Edda_Stadt_17_02"); //Но если ты ищешь, где остановиться на ночь, можешь поспать в моей хижине. Там есть еще одна кровать. } else { AI_Output(self,other,"DIA_Edda_Stadt_17_02_add"); //Если ты ищешь, где остановиться на ночь, можешь поспать в моей хижине. Есть еще одна кровать. }; AI_Output(other,self,"DIA_Edda_Stadt_15_03"); //А ты не боишься воров? AI_Output(self,other,"DIA_Edda_Stadt_17_04"); //Единственная ценная вещь, что у меня была, уже пропала. AI_Output(self,other,"DIA_Edda_Stadt_17_05"); //Кто-то украл мою статую Инноса. Edda_Schlafplatz = TRUE; }; instance DIA_Edda_Sleep(C_Info) { npc = VLK_471_Edda; nr = 3; condition = DIA_Edda_Sleep_Condition; information = DIA_Edda_Sleep_Info; permanent = FALSE; important = TRUE; }; func int DIA_Edda_Sleep_Condition() { if(Wld_IsTime(22,0,8,0) && Npc_IsInState(self,ZS_Talk) && (Edda_Schlafplatz == FALSE)) { return TRUE; }; }; func void DIA_Edda_Sleep_Info() { B_Edda_AboutStolenStatue(); }; instance DIA_Edda_Stadt(C_Info) { npc = VLK_471_Edda; nr = 9; condition = DIA_Edda_Stadt_Condition; information = DIA_Edda_Stadt_Info; permanent = FALSE; description = "Что ты можешь рассказать мне о городе?"; }; func int DIA_Edda_Stadt_Condition() { return TRUE; }; func void DIA_Edda_Stadt_Info() { AI_Output(other,self,"DIA_Edda_Stadt_15_00"); //Что ты можешь рассказать мне о городе? AI_Output(self,other,"DIA_Edda_Stadt_17_01"); //Большинство горожан опасаются воров. Поэтому лучше не входить в чужие дома. if(Edda_Schlafplatz == FALSE) { B_Edda_AboutStolenStatue(); }; }; instance DIA_Edda_Suppe(C_Info) { npc = VLK_471_Edda; nr = 6; condition = DIA_Edda_Suppe_Condition; information = DIA_Edda_Suppe_Info; permanent = TRUE; description = "Ты можешь сварить для меня суп?"; }; func int DIA_Edda_Suppe_Condition() { if(Npc_KnowsInfo(other,DIA_Edda_Hallo)) { return TRUE; }; }; func void DIA_Edda_Suppe_Info() { AI_Output(other,self,"DIA_Edda_Suppe_15_00"); //Ты можешь сварить для меня суп? if(Wld_GetDay() == 0) { AI_Output(self,other,"DIA_Edda_Suppe_17_02"); //С завтрашнего дня ты можешь приходить и получать суп каждый день. } else if(Wld_IsTime(22,0,8,0)) { AI_Output(self,other,"DIA_Edda_Suppe_17_03_add"); //Заходи попозже. } else if(Edda_Day != Wld_GetDay()) { if(Npc_HasItems(other,ItFo_Fish) || Npc_HasItems(other,ItFo_SmellyFish)) { if(Npc_HasItems(other,ItFo_Fish)) { B_GiveInvItems(other,self,ItFo_Fish,1); B_RemoveEveryInvItem(self,ItFo_Fish); } else { B_GiveInvItems(other,self,ItFo_SmellyFish,1); B_RemoveEveryInvItem(self,ItFo_SmellyFish); }; AI_Output(self,other,"DIA_Edda_Suppe_17_01"); //Нет ничего проще. Вот, держи тарелку. B_GiveInvItems(self,other,ItFo_EddasFishSoup,1); Edda_Day = Wld_GetDay(); } else { AI_Output(self,other,"DIA_Edda_Suppe_17_04"); //Принеси мне рыбу, и я сварю тебе вкусный суп. }; } else { AI_Output(self,other,"DIA_Edda_Suppe_17_03"); //Нет, не сегодня. Приходи завтра. }; }; instance DIA_Edda_Statue(C_Info) { npc = VLK_471_Edda; nr = 6; condition = DIA_Edda_Statue_Condition; information = DIA_Edda_Statue_Info; permanent = FALSE; description = "Посмотри, я принес статую Инноса для тебя."; }; func int DIA_Edda_Statue_Condition() { if(Edda_Schlafplatz == TRUE) { if(Npc_HasItems(other,ItMi_EddasStatue) || Npc_HasItems(other,ItMi_InnosStatue) || Npc_HasItems(other,ItMi_LostInnosStatue_Daron)) { return TRUE; }; }; }; func void DIA_Edda_Statue_Info() { AI_Output(other,self,"DIA_Edda_Statue_15_00"); //Посмотри, я принес статую Инноса для тебя. if(Npc_HasItems(other,ItMi_EddasStatue)) { B_GiveInvItems(other,self,ItMi_EddasStatue,1); B_SetItemToSteal(self,20,ItMi_EddasStatue,1); B_GivePlayerXP(XP_Edda_Statue * 2); AI_Output(self,other,"DIA_Maria_BringPlate_17_01"); //Да! Это она! Огромное тебе спасибо! } else { if(Npc_HasItems(other,ItMi_InnosStatue)) { B_GiveInvItems(other,self,ItMi_InnosStatue,1); B_SetItemToSteal(self,20,ItMi_InnosStatue,1); } else if(Npc_HasItems(other,ItMi_LostInnosStatue_Daron)) { B_GiveInvItems(other,self,ItMi_LostInnosStatue_Daron,1); B_SetItemToSteal(self,20,ItMi_LostInnosStatue_Daron,1); }; B_GivePlayerXP(XP_Edda_Statue); AI_Output(self,other,"DIA_Edda_Statue_17_01"); //Ах - огромное тебе спасибо. Да не оставит тебя свет Инноса... }; AI_Output(other,self,"DIA_Edda_Statue_15_02"); //Не стоит благодарностей. B_AssignPickpocket(self); };
D
module mach.meta.predicates; private: /++ Docs: mach.meta.predicates Provides templates which apply logical operations to predicate functions. `NegatePredicate` produces a predicate which is a logical negation of the input. `AndPredicates` produces a predicate which is only satisfied when all of its inputs are satisfied. `OrPredicates` produces a predicate which is satisfied when anu of its inputs are satisfied. +/ unittest{ /// Example alias pred = (x) => (x == 0); assert(pred(0)); assert(!pred(1)); assert(NegatePredicate!pred(1)); assert(!NegatePredicate!pred(0)); } unittest{ /// Example alias a = (x) => (x != 1); alias b = (x) => (x != 2); assert(AndPredicates!(a, b)(0)); assert(!AndPredicates!(a, b)(1)); assert(!AndPredicates!(a, b)(2)); } unittest{ /// Example alias a = (x) => (x == 1); alias b = (x) => (x == 2); assert(OrPredicates!(a, b)(1)); assert(OrPredicates!(a, b)(2)); assert(!OrPredicates!(a, b)(3)); } public: /// Given a predicate, produce a predicate function which is a logical negation /// of that input predicate. template NegatePredicate(alias func){ auto NegatePredicate(Args...)(auto ref Args args) if(is(typeof({return !func(args);}))){ return !func(args); } } /// Given some predicates, produce a predicate function which is satisfied only /// when all of the input predicates are satisfied. template AndPredicates(funcs...) if(funcs.length){ static if(funcs.length == 1){ alias AndPredicates = funcs[0]; }else{ auto AndPredicates(Args...)(auto ref Args args) if(is(typeof({ foreach(func; funcs){if(!func(args)){}} }))){ foreach(func; funcs){ if(!func(args)) return false; } return true; } } } /// Given some predicates, produce a predicate function which is satisfied /// when any of the input predicates are satisfied. template OrPredicates(funcs...) if(funcs.length){ static if(funcs.length == 1){ alias OrPredicates = funcs[0]; }else{ auto OrPredicates(Args...)(auto ref Args args) if(is(typeof({ foreach(func; funcs){if(func(args)){}} }))){ foreach(func; funcs){ if(func(args)) return true; } return false; } } } version(unittest){ private: import mach.meta.aliases : Aliases; } unittest{ alias apred = (x) => (x == 0); bool fpred(in int x){return x == 0;} static bool sfpred(in int x){return x == 0;} auto fppred = &fpred; bool delegate(in int) dgpred = (in int x){return x == 0;}; foreach(pred; Aliases!(apred, fpred, sfpred, fppred, dgpred)){ assert(pred(0)); assert(!pred(1)); assert(NegatePredicate!pred(1)); assert(!NegatePredicate!pred(0)); } } unittest{ alias pred = (a, b) => (a == b); assert(pred(0, 0)); assert(!pred(0, 1)); assert(NegatePredicate!pred(0, 1)); assert(!NegatePredicate!pred(0, 0)); } unittest{ alias pred = (x) => (x == 0); assert(AndPredicates!pred(0)); assert(!AndPredicates!pred(1)); } unittest{ alias preda = (int x) => (x > 0); alias predb = (long x) => (x > 10); assert(AndPredicates!(preda, predb)(11)); assert(!AndPredicates!(preda, predb)(0)); assert(!AndPredicates!(preda, predb)(1)); } unittest{ alias preda = (x, y) => (x > 0); alias predb = (x, y) => (x > 10); assert(AndPredicates!(preda, predb)(11, 0)); assert(!AndPredicates!(preda, predb)(0, 0)); assert(!AndPredicates!(preda, predb)(1, 0)); } unittest{ alias pred = (x) => (x == 0); assert(OrPredicates!pred(0)); assert(!OrPredicates!pred(1)); } unittest{ alias preda = (x) => (x == 0); alias predb = (x) => (x == 1); assert(OrPredicates!(preda, predb)(0)); assert(OrPredicates!(preda, predb)(1)); assert(!OrPredicates!(preda, predb)(2)); } unittest{ alias preda = (x, y) => (x == 0); alias predb = (x, y) => (x == 1); assert(OrPredicates!(preda, predb)(0, 0)); assert(OrPredicates!(preda, predb)(1, 0)); assert(!OrPredicates!(preda, predb)(2, 0)); }
D
/Users/MohamedNawar/Desktop/Task/build/Pods.build/Debug-iphonesimulator/Kingfisher.build/Objects-normal/x86_64/ImageProgressive.o : /Users/MohamedNawar/Desktop/Task/Pods/Kingfisher/Sources/Utility/String+MD5.swift /Users/MohamedNawar/Desktop/Task/Pods/Kingfisher/Sources/General/Deprecated.swift /Users/MohamedNawar/Desktop/Task/Pods/Kingfisher/Sources/General/ImageSource/Source.swift /Users/MohamedNawar/Desktop/Task/Pods/Kingfisher/Sources/General/ImageSource/Resource.swift /Users/MohamedNawar/Desktop/Task/Pods/Kingfisher/Sources/Image/Image.swift /Users/MohamedNawar/Desktop/Task/Pods/Kingfisher/Sources/Image/GIFAnimatedImage.swift /Users/MohamedNawar/Desktop/Task/Pods/Kingfisher/Sources/Cache/Storage.swift /Users/MohamedNawar/Desktop/Task/Pods/Kingfisher/Sources/Cache/DiskStorage.swift /Users/MohamedNawar/Desktop/Task/Pods/Kingfisher/Sources/Cache/MemoryStorage.swift /Users/MohamedNawar/Desktop/Task/Pods/Kingfisher/Sources/Cache/ImageCache.swift /Users/MohamedNawar/Desktop/Task/Pods/Kingfisher/Sources/Networking/AuthenticationChallengeResponsable.swift /Users/MohamedNawar/Desktop/Task/Pods/Kingfisher/Sources/Utility/Runtime.swift /Users/MohamedNawar/Desktop/Task/Pods/Kingfisher/Sources/Utility/Delegate.swift /Users/MohamedNawar/Desktop/Task/Pods/Kingfisher/Sources/Networking/SessionDelegate.swift /Users/MohamedNawar/Desktop/Task/Pods/Kingfisher/Sources/Networking/ImageDownloaderDelegate.swift /Users/MohamedNawar/Desktop/Task/Pods/Kingfisher/Sources/Utility/CallbackQueue.swift /Users/MohamedNawar/Desktop/Task/Pods/Kingfisher/Sources/Image/ImageProgressive.swift /Users/MohamedNawar/Desktop/Task/Pods/Kingfisher/Sources/Image/ImageDrawing.swift /Users/MohamedNawar/Desktop/Task/Pods/Kingfisher/Sources/Networking/SessionDataTask.swift /Users/MohamedNawar/Desktop/Task/Pods/Kingfisher/Sources/Image/ImageTransition.swift /Users/MohamedNawar/Desktop/Task/Pods/Kingfisher/Sources/General/KingfisherOptionsInfo.swift /Users/MohamedNawar/Desktop/Task/Pods/Kingfisher/Sources/Networking/ImageDownloader.swift /Users/MohamedNawar/Desktop/Task/Pods/Kingfisher/Sources/General/ImageSource/ImageDataProvider.swift /Users/MohamedNawar/Desktop/Task/Pods/Kingfisher/Sources/General/ImageSource/AVAssetImageDataProvider.swift /Users/MohamedNawar/Desktop/Task/Pods/Kingfisher/Sources/Image/Placeholder.swift /Users/MohamedNawar/Desktop/Task/Pods/Kingfisher/Sources/General/KingfisherManager.swift /Users/MohamedNawar/Desktop/Task/Pods/Kingfisher/Sources/Networking/ImagePrefetcher.swift /Users/MohamedNawar/Desktop/Task/Pods/Kingfisher/Sources/Extensions/WKInterfaceImage+Kingfisher.swift /Users/MohamedNawar/Desktop/Task/Pods/Kingfisher/Sources/Extensions/UIButton+Kingfisher.swift /Users/MohamedNawar/Desktop/Task/Pods/Kingfisher/Sources/Extensions/NSButton+Kingfisher.swift /Users/MohamedNawar/Desktop/Task/Pods/Kingfisher/Sources/Extensions/NSTextAttachment+Kingfisher.swift /Users/MohamedNawar/Desktop/Task/Pods/Kingfisher/Sources/Extensions/ImageView+Kingfisher.swift /Users/MohamedNawar/Desktop/Task/Pods/Kingfisher/Sources/General/Kingfisher.swift /Users/MohamedNawar/Desktop/Task/Pods/Kingfisher/Sources/Networking/ImageModifier.swift /Users/MohamedNawar/Desktop/Task/Pods/Kingfisher/Sources/Networking/RequestModifier.swift /Users/MohamedNawar/Desktop/Task/Pods/Kingfisher/Sources/Networking/RedirectHandler.swift /Users/MohamedNawar/Desktop/Task/Pods/Kingfisher/Sources/Image/Filter.swift /Users/MohamedNawar/Desktop/Task/Pods/Kingfisher/Sources/Cache/CacheSerializer.swift /Users/MohamedNawar/Desktop/Task/Pods/Kingfisher/Sources/Cache/FormatIndicatedCacheSerializer.swift /Users/MohamedNawar/Desktop/Task/Pods/Kingfisher/Sources/General/KingfisherError.swift /Users/MohamedNawar/Desktop/Task/Pods/Kingfisher/Sources/Networking/ImageDataProcessor.swift /Users/MohamedNawar/Desktop/Task/Pods/Kingfisher/Sources/Image/ImageProcessor.swift /Users/MohamedNawar/Desktop/Task/Pods/Kingfisher/Sources/Views/Indicator.swift /Users/MohamedNawar/Desktop/Task/Pods/Kingfisher/Sources/Utility/SizeExtensions.swift /Users/MohamedNawar/Desktop/Task/Pods/Kingfisher/Sources/Utility/ExtensionHelpers.swift /Users/MohamedNawar/Desktop/Task/Pods/Kingfisher/Sources/Image/ImageFormat.swift /Users/MohamedNawar/Desktop/Task/Pods/Kingfisher/Sources/Utility/Result.swift /Users/MohamedNawar/Desktop/Task/Pods/Kingfisher/Sources/Views/AnimatedImageView.swift /Users/MohamedNawar/Desktop/Task/Pods/Kingfisher/Sources/Utility/Box.swift /Users/MohamedNawar/Desktop/Task/Pods/Kingfisher/Sources/Networking/RetryStrategy.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/ObjectiveC.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/CoreMIDI.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/CoreMedia.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/simd.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/CoreImage.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/QuartzCore.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/Accelerate.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/Dispatch.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/Metal.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/Darwin.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/Foundation.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/AVFoundation.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/CoreFoundation.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/CoreAudio.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/CoreGraphics.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/os.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/Swift.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/UIKit.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/SwiftOnoneSupport.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/Combine.swiftmodule/x86_64-apple-ios-simulator.swiftmodule /Users/MohamedNawar/Desktop/Task/Pods/Target\ Support\ Files/Kingfisher/Kingfisher-umbrella.h /Users/MohamedNawar/Desktop/Task/Pods/Kingfisher/Sources/Kingfisher.h /Users/MohamedNawar/Desktop/Task/build/Pods.build/Debug-iphonesimulator/Kingfisher.build/unextended-module.modulemap /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.5.sdk/usr/include/objc/ObjectiveC.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.5.sdk/System/Library/Frameworks/OpenGLES.framework/Headers/OpenGLES.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.5.sdk/System/Library/Frameworks/CoreMedia.framework/Headers/CoreMedia.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.5.sdk/System/Library/Frameworks/CoreImage.framework/Headers/CoreImage.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.5.sdk/System/Library/Frameworks/QuartzCore.framework/Headers/QuartzCore.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.5.sdk/System/Library/Frameworks/Accelerate.framework/Headers/Accelerate.apinotes /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/apinotes/Dispatch.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.5.sdk/System/Library/Frameworks/Metal.framework/Headers/Metal.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.5.sdk/usr/include/Darwin.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.5.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.5.sdk/System/Library/Frameworks/AVFoundation.framework/Headers/AVFoundation.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.5.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.5.sdk/System/Library/Frameworks/CoreAudioTypes.framework/Headers/CoreAudioTypes.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.5.sdk/System/Library/Frameworks/UserNotifications.framework/Headers/UserNotifications.apinotes /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/apinotes/os.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.5.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIKit.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.5.sdk/System/Library/Frameworks/AVKit.framework/Headers/AVKit.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.5.sdk/System/Library/Frameworks/CoreText.framework/Headers/CoreText.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.5.sdk/System/Library/Frameworks/MediaToolbox.framework/Headers/MediaToolbox.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.5.sdk/System/Library/Frameworks/AudioToolbox.framework/Headers/AudioToolbox.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.5.sdk/System/Library/Frameworks/Security.framework/Headers/Security.apinotes /Users/MohamedNawar/Desktop/Task/build/Pods.build/Debug-iphonesimulator/Kingfisher.build/Objects-normal/x86_64/ImageProgressive~partial.swiftmodule : /Users/MohamedNawar/Desktop/Task/Pods/Kingfisher/Sources/Utility/String+MD5.swift /Users/MohamedNawar/Desktop/Task/Pods/Kingfisher/Sources/General/Deprecated.swift /Users/MohamedNawar/Desktop/Task/Pods/Kingfisher/Sources/General/ImageSource/Source.swift /Users/MohamedNawar/Desktop/Task/Pods/Kingfisher/Sources/General/ImageSource/Resource.swift /Users/MohamedNawar/Desktop/Task/Pods/Kingfisher/Sources/Image/Image.swift /Users/MohamedNawar/Desktop/Task/Pods/Kingfisher/Sources/Image/GIFAnimatedImage.swift /Users/MohamedNawar/Desktop/Task/Pods/Kingfisher/Sources/Cache/Storage.swift /Users/MohamedNawar/Desktop/Task/Pods/Kingfisher/Sources/Cache/DiskStorage.swift /Users/MohamedNawar/Desktop/Task/Pods/Kingfisher/Sources/Cache/MemoryStorage.swift /Users/MohamedNawar/Desktop/Task/Pods/Kingfisher/Sources/Cache/ImageCache.swift /Users/MohamedNawar/Desktop/Task/Pods/Kingfisher/Sources/Networking/AuthenticationChallengeResponsable.swift /Users/MohamedNawar/Desktop/Task/Pods/Kingfisher/Sources/Utility/Runtime.swift /Users/MohamedNawar/Desktop/Task/Pods/Kingfisher/Sources/Utility/Delegate.swift /Users/MohamedNawar/Desktop/Task/Pods/Kingfisher/Sources/Networking/SessionDelegate.swift /Users/MohamedNawar/Desktop/Task/Pods/Kingfisher/Sources/Networking/ImageDownloaderDelegate.swift /Users/MohamedNawar/Desktop/Task/Pods/Kingfisher/Sources/Utility/CallbackQueue.swift /Users/MohamedNawar/Desktop/Task/Pods/Kingfisher/Sources/Image/ImageProgressive.swift /Users/MohamedNawar/Desktop/Task/Pods/Kingfisher/Sources/Image/ImageDrawing.swift /Users/MohamedNawar/Desktop/Task/Pods/Kingfisher/Sources/Networking/SessionDataTask.swift /Users/MohamedNawar/Desktop/Task/Pods/Kingfisher/Sources/Image/ImageTransition.swift /Users/MohamedNawar/Desktop/Task/Pods/Kingfisher/Sources/General/KingfisherOptionsInfo.swift /Users/MohamedNawar/Desktop/Task/Pods/Kingfisher/Sources/Networking/ImageDownloader.swift /Users/MohamedNawar/Desktop/Task/Pods/Kingfisher/Sources/General/ImageSource/ImageDataProvider.swift /Users/MohamedNawar/Desktop/Task/Pods/Kingfisher/Sources/General/ImageSource/AVAssetImageDataProvider.swift /Users/MohamedNawar/Desktop/Task/Pods/Kingfisher/Sources/Image/Placeholder.swift /Users/MohamedNawar/Desktop/Task/Pods/Kingfisher/Sources/General/KingfisherManager.swift /Users/MohamedNawar/Desktop/Task/Pods/Kingfisher/Sources/Networking/ImagePrefetcher.swift /Users/MohamedNawar/Desktop/Task/Pods/Kingfisher/Sources/Extensions/WKInterfaceImage+Kingfisher.swift /Users/MohamedNawar/Desktop/Task/Pods/Kingfisher/Sources/Extensions/UIButton+Kingfisher.swift /Users/MohamedNawar/Desktop/Task/Pods/Kingfisher/Sources/Extensions/NSButton+Kingfisher.swift /Users/MohamedNawar/Desktop/Task/Pods/Kingfisher/Sources/Extensions/NSTextAttachment+Kingfisher.swift /Users/MohamedNawar/Desktop/Task/Pods/Kingfisher/Sources/Extensions/ImageView+Kingfisher.swift /Users/MohamedNawar/Desktop/Task/Pods/Kingfisher/Sources/General/Kingfisher.swift /Users/MohamedNawar/Desktop/Task/Pods/Kingfisher/Sources/Networking/ImageModifier.swift /Users/MohamedNawar/Desktop/Task/Pods/Kingfisher/Sources/Networking/RequestModifier.swift /Users/MohamedNawar/Desktop/Task/Pods/Kingfisher/Sources/Networking/RedirectHandler.swift /Users/MohamedNawar/Desktop/Task/Pods/Kingfisher/Sources/Image/Filter.swift /Users/MohamedNawar/Desktop/Task/Pods/Kingfisher/Sources/Cache/CacheSerializer.swift /Users/MohamedNawar/Desktop/Task/Pods/Kingfisher/Sources/Cache/FormatIndicatedCacheSerializer.swift /Users/MohamedNawar/Desktop/Task/Pods/Kingfisher/Sources/General/KingfisherError.swift /Users/MohamedNawar/Desktop/Task/Pods/Kingfisher/Sources/Networking/ImageDataProcessor.swift /Users/MohamedNawar/Desktop/Task/Pods/Kingfisher/Sources/Image/ImageProcessor.swift /Users/MohamedNawar/Desktop/Task/Pods/Kingfisher/Sources/Views/Indicator.swift /Users/MohamedNawar/Desktop/Task/Pods/Kingfisher/Sources/Utility/SizeExtensions.swift /Users/MohamedNawar/Desktop/Task/Pods/Kingfisher/Sources/Utility/ExtensionHelpers.swift /Users/MohamedNawar/Desktop/Task/Pods/Kingfisher/Sources/Image/ImageFormat.swift /Users/MohamedNawar/Desktop/Task/Pods/Kingfisher/Sources/Utility/Result.swift /Users/MohamedNawar/Desktop/Task/Pods/Kingfisher/Sources/Views/AnimatedImageView.swift /Users/MohamedNawar/Desktop/Task/Pods/Kingfisher/Sources/Utility/Box.swift /Users/MohamedNawar/Desktop/Task/Pods/Kingfisher/Sources/Networking/RetryStrategy.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/ObjectiveC.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/CoreMIDI.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/CoreMedia.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/simd.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/CoreImage.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/QuartzCore.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/Accelerate.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/Dispatch.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/Metal.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/Darwin.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/Foundation.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/AVFoundation.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/CoreFoundation.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/CoreAudio.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/CoreGraphics.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/os.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/Swift.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/UIKit.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/SwiftOnoneSupport.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/Combine.swiftmodule/x86_64-apple-ios-simulator.swiftmodule /Users/MohamedNawar/Desktop/Task/Pods/Target\ Support\ Files/Kingfisher/Kingfisher-umbrella.h /Users/MohamedNawar/Desktop/Task/Pods/Kingfisher/Sources/Kingfisher.h /Users/MohamedNawar/Desktop/Task/build/Pods.build/Debug-iphonesimulator/Kingfisher.build/unextended-module.modulemap /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.5.sdk/usr/include/objc/ObjectiveC.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.5.sdk/System/Library/Frameworks/OpenGLES.framework/Headers/OpenGLES.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.5.sdk/System/Library/Frameworks/CoreMedia.framework/Headers/CoreMedia.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.5.sdk/System/Library/Frameworks/CoreImage.framework/Headers/CoreImage.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.5.sdk/System/Library/Frameworks/QuartzCore.framework/Headers/QuartzCore.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.5.sdk/System/Library/Frameworks/Accelerate.framework/Headers/Accelerate.apinotes /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/apinotes/Dispatch.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.5.sdk/System/Library/Frameworks/Metal.framework/Headers/Metal.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.5.sdk/usr/include/Darwin.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.5.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.5.sdk/System/Library/Frameworks/AVFoundation.framework/Headers/AVFoundation.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.5.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.5.sdk/System/Library/Frameworks/CoreAudioTypes.framework/Headers/CoreAudioTypes.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.5.sdk/System/Library/Frameworks/UserNotifications.framework/Headers/UserNotifications.apinotes /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/apinotes/os.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.5.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIKit.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.5.sdk/System/Library/Frameworks/AVKit.framework/Headers/AVKit.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.5.sdk/System/Library/Frameworks/CoreText.framework/Headers/CoreText.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.5.sdk/System/Library/Frameworks/MediaToolbox.framework/Headers/MediaToolbox.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.5.sdk/System/Library/Frameworks/AudioToolbox.framework/Headers/AudioToolbox.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.5.sdk/System/Library/Frameworks/Security.framework/Headers/Security.apinotes /Users/MohamedNawar/Desktop/Task/build/Pods.build/Debug-iphonesimulator/Kingfisher.build/Objects-normal/x86_64/ImageProgressive~partial.swiftdoc : /Users/MohamedNawar/Desktop/Task/Pods/Kingfisher/Sources/Utility/String+MD5.swift /Users/MohamedNawar/Desktop/Task/Pods/Kingfisher/Sources/General/Deprecated.swift /Users/MohamedNawar/Desktop/Task/Pods/Kingfisher/Sources/General/ImageSource/Source.swift /Users/MohamedNawar/Desktop/Task/Pods/Kingfisher/Sources/General/ImageSource/Resource.swift /Users/MohamedNawar/Desktop/Task/Pods/Kingfisher/Sources/Image/Image.swift /Users/MohamedNawar/Desktop/Task/Pods/Kingfisher/Sources/Image/GIFAnimatedImage.swift /Users/MohamedNawar/Desktop/Task/Pods/Kingfisher/Sources/Cache/Storage.swift /Users/MohamedNawar/Desktop/Task/Pods/Kingfisher/Sources/Cache/DiskStorage.swift /Users/MohamedNawar/Desktop/Task/Pods/Kingfisher/Sources/Cache/MemoryStorage.swift /Users/MohamedNawar/Desktop/Task/Pods/Kingfisher/Sources/Cache/ImageCache.swift /Users/MohamedNawar/Desktop/Task/Pods/Kingfisher/Sources/Networking/AuthenticationChallengeResponsable.swift /Users/MohamedNawar/Desktop/Task/Pods/Kingfisher/Sources/Utility/Runtime.swift /Users/MohamedNawar/Desktop/Task/Pods/Kingfisher/Sources/Utility/Delegate.swift /Users/MohamedNawar/Desktop/Task/Pods/Kingfisher/Sources/Networking/SessionDelegate.swift /Users/MohamedNawar/Desktop/Task/Pods/Kingfisher/Sources/Networking/ImageDownloaderDelegate.swift /Users/MohamedNawar/Desktop/Task/Pods/Kingfisher/Sources/Utility/CallbackQueue.swift /Users/MohamedNawar/Desktop/Task/Pods/Kingfisher/Sources/Image/ImageProgressive.swift /Users/MohamedNawar/Desktop/Task/Pods/Kingfisher/Sources/Image/ImageDrawing.swift /Users/MohamedNawar/Desktop/Task/Pods/Kingfisher/Sources/Networking/SessionDataTask.swift /Users/MohamedNawar/Desktop/Task/Pods/Kingfisher/Sources/Image/ImageTransition.swift /Users/MohamedNawar/Desktop/Task/Pods/Kingfisher/Sources/General/KingfisherOptionsInfo.swift /Users/MohamedNawar/Desktop/Task/Pods/Kingfisher/Sources/Networking/ImageDownloader.swift /Users/MohamedNawar/Desktop/Task/Pods/Kingfisher/Sources/General/ImageSource/ImageDataProvider.swift /Users/MohamedNawar/Desktop/Task/Pods/Kingfisher/Sources/General/ImageSource/AVAssetImageDataProvider.swift /Users/MohamedNawar/Desktop/Task/Pods/Kingfisher/Sources/Image/Placeholder.swift /Users/MohamedNawar/Desktop/Task/Pods/Kingfisher/Sources/General/KingfisherManager.swift /Users/MohamedNawar/Desktop/Task/Pods/Kingfisher/Sources/Networking/ImagePrefetcher.swift /Users/MohamedNawar/Desktop/Task/Pods/Kingfisher/Sources/Extensions/WKInterfaceImage+Kingfisher.swift /Users/MohamedNawar/Desktop/Task/Pods/Kingfisher/Sources/Extensions/UIButton+Kingfisher.swift /Users/MohamedNawar/Desktop/Task/Pods/Kingfisher/Sources/Extensions/NSButton+Kingfisher.swift /Users/MohamedNawar/Desktop/Task/Pods/Kingfisher/Sources/Extensions/NSTextAttachment+Kingfisher.swift /Users/MohamedNawar/Desktop/Task/Pods/Kingfisher/Sources/Extensions/ImageView+Kingfisher.swift /Users/MohamedNawar/Desktop/Task/Pods/Kingfisher/Sources/General/Kingfisher.swift /Users/MohamedNawar/Desktop/Task/Pods/Kingfisher/Sources/Networking/ImageModifier.swift /Users/MohamedNawar/Desktop/Task/Pods/Kingfisher/Sources/Networking/RequestModifier.swift /Users/MohamedNawar/Desktop/Task/Pods/Kingfisher/Sources/Networking/RedirectHandler.swift /Users/MohamedNawar/Desktop/Task/Pods/Kingfisher/Sources/Image/Filter.swift /Users/MohamedNawar/Desktop/Task/Pods/Kingfisher/Sources/Cache/CacheSerializer.swift /Users/MohamedNawar/Desktop/Task/Pods/Kingfisher/Sources/Cache/FormatIndicatedCacheSerializer.swift /Users/MohamedNawar/Desktop/Task/Pods/Kingfisher/Sources/General/KingfisherError.swift /Users/MohamedNawar/Desktop/Task/Pods/Kingfisher/Sources/Networking/ImageDataProcessor.swift /Users/MohamedNawar/Desktop/Task/Pods/Kingfisher/Sources/Image/ImageProcessor.swift /Users/MohamedNawar/Desktop/Task/Pods/Kingfisher/Sources/Views/Indicator.swift /Users/MohamedNawar/Desktop/Task/Pods/Kingfisher/Sources/Utility/SizeExtensions.swift /Users/MohamedNawar/Desktop/Task/Pods/Kingfisher/Sources/Utility/ExtensionHelpers.swift /Users/MohamedNawar/Desktop/Task/Pods/Kingfisher/Sources/Image/ImageFormat.swift /Users/MohamedNawar/Desktop/Task/Pods/Kingfisher/Sources/Utility/Result.swift /Users/MohamedNawar/Desktop/Task/Pods/Kingfisher/Sources/Views/AnimatedImageView.swift /Users/MohamedNawar/Desktop/Task/Pods/Kingfisher/Sources/Utility/Box.swift /Users/MohamedNawar/Desktop/Task/Pods/Kingfisher/Sources/Networking/RetryStrategy.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/ObjectiveC.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/CoreMIDI.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/CoreMedia.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/simd.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/CoreImage.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/QuartzCore.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/Accelerate.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/Dispatch.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/Metal.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/Darwin.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/Foundation.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/AVFoundation.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/CoreFoundation.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/CoreAudio.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/CoreGraphics.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/os.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/Swift.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/UIKit.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/SwiftOnoneSupport.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/Combine.swiftmodule/x86_64-apple-ios-simulator.swiftmodule /Users/MohamedNawar/Desktop/Task/Pods/Target\ Support\ Files/Kingfisher/Kingfisher-umbrella.h /Users/MohamedNawar/Desktop/Task/Pods/Kingfisher/Sources/Kingfisher.h /Users/MohamedNawar/Desktop/Task/build/Pods.build/Debug-iphonesimulator/Kingfisher.build/unextended-module.modulemap /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.5.sdk/usr/include/objc/ObjectiveC.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.5.sdk/System/Library/Frameworks/OpenGLES.framework/Headers/OpenGLES.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.5.sdk/System/Library/Frameworks/CoreMedia.framework/Headers/CoreMedia.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.5.sdk/System/Library/Frameworks/CoreImage.framework/Headers/CoreImage.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.5.sdk/System/Library/Frameworks/QuartzCore.framework/Headers/QuartzCore.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.5.sdk/System/Library/Frameworks/Accelerate.framework/Headers/Accelerate.apinotes /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/apinotes/Dispatch.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.5.sdk/System/Library/Frameworks/Metal.framework/Headers/Metal.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.5.sdk/usr/include/Darwin.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.5.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.5.sdk/System/Library/Frameworks/AVFoundation.framework/Headers/AVFoundation.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.5.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.5.sdk/System/Library/Frameworks/CoreAudioTypes.framework/Headers/CoreAudioTypes.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.5.sdk/System/Library/Frameworks/UserNotifications.framework/Headers/UserNotifications.apinotes /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/apinotes/os.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.5.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIKit.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.5.sdk/System/Library/Frameworks/AVKit.framework/Headers/AVKit.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.5.sdk/System/Library/Frameworks/CoreText.framework/Headers/CoreText.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.5.sdk/System/Library/Frameworks/MediaToolbox.framework/Headers/MediaToolbox.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.5.sdk/System/Library/Frameworks/AudioToolbox.framework/Headers/AudioToolbox.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.5.sdk/System/Library/Frameworks/Security.framework/Headers/Security.apinotes /Users/MohamedNawar/Desktop/Task/build/Pods.build/Debug-iphonesimulator/Kingfisher.build/Objects-normal/x86_64/ImageProgressive~partial.swiftsourceinfo : /Users/MohamedNawar/Desktop/Task/Pods/Kingfisher/Sources/Utility/String+MD5.swift /Users/MohamedNawar/Desktop/Task/Pods/Kingfisher/Sources/General/Deprecated.swift /Users/MohamedNawar/Desktop/Task/Pods/Kingfisher/Sources/General/ImageSource/Source.swift /Users/MohamedNawar/Desktop/Task/Pods/Kingfisher/Sources/General/ImageSource/Resource.swift /Users/MohamedNawar/Desktop/Task/Pods/Kingfisher/Sources/Image/Image.swift /Users/MohamedNawar/Desktop/Task/Pods/Kingfisher/Sources/Image/GIFAnimatedImage.swift /Users/MohamedNawar/Desktop/Task/Pods/Kingfisher/Sources/Cache/Storage.swift /Users/MohamedNawar/Desktop/Task/Pods/Kingfisher/Sources/Cache/DiskStorage.swift /Users/MohamedNawar/Desktop/Task/Pods/Kingfisher/Sources/Cache/MemoryStorage.swift /Users/MohamedNawar/Desktop/Task/Pods/Kingfisher/Sources/Cache/ImageCache.swift /Users/MohamedNawar/Desktop/Task/Pods/Kingfisher/Sources/Networking/AuthenticationChallengeResponsable.swift /Users/MohamedNawar/Desktop/Task/Pods/Kingfisher/Sources/Utility/Runtime.swift /Users/MohamedNawar/Desktop/Task/Pods/Kingfisher/Sources/Utility/Delegate.swift /Users/MohamedNawar/Desktop/Task/Pods/Kingfisher/Sources/Networking/SessionDelegate.swift /Users/MohamedNawar/Desktop/Task/Pods/Kingfisher/Sources/Networking/ImageDownloaderDelegate.swift /Users/MohamedNawar/Desktop/Task/Pods/Kingfisher/Sources/Utility/CallbackQueue.swift /Users/MohamedNawar/Desktop/Task/Pods/Kingfisher/Sources/Image/ImageProgressive.swift /Users/MohamedNawar/Desktop/Task/Pods/Kingfisher/Sources/Image/ImageDrawing.swift /Users/MohamedNawar/Desktop/Task/Pods/Kingfisher/Sources/Networking/SessionDataTask.swift /Users/MohamedNawar/Desktop/Task/Pods/Kingfisher/Sources/Image/ImageTransition.swift /Users/MohamedNawar/Desktop/Task/Pods/Kingfisher/Sources/General/KingfisherOptionsInfo.swift /Users/MohamedNawar/Desktop/Task/Pods/Kingfisher/Sources/Networking/ImageDownloader.swift /Users/MohamedNawar/Desktop/Task/Pods/Kingfisher/Sources/General/ImageSource/ImageDataProvider.swift /Users/MohamedNawar/Desktop/Task/Pods/Kingfisher/Sources/General/ImageSource/AVAssetImageDataProvider.swift /Users/MohamedNawar/Desktop/Task/Pods/Kingfisher/Sources/Image/Placeholder.swift /Users/MohamedNawar/Desktop/Task/Pods/Kingfisher/Sources/General/KingfisherManager.swift /Users/MohamedNawar/Desktop/Task/Pods/Kingfisher/Sources/Networking/ImagePrefetcher.swift /Users/MohamedNawar/Desktop/Task/Pods/Kingfisher/Sources/Extensions/WKInterfaceImage+Kingfisher.swift /Users/MohamedNawar/Desktop/Task/Pods/Kingfisher/Sources/Extensions/UIButton+Kingfisher.swift /Users/MohamedNawar/Desktop/Task/Pods/Kingfisher/Sources/Extensions/NSButton+Kingfisher.swift /Users/MohamedNawar/Desktop/Task/Pods/Kingfisher/Sources/Extensions/NSTextAttachment+Kingfisher.swift /Users/MohamedNawar/Desktop/Task/Pods/Kingfisher/Sources/Extensions/ImageView+Kingfisher.swift /Users/MohamedNawar/Desktop/Task/Pods/Kingfisher/Sources/General/Kingfisher.swift /Users/MohamedNawar/Desktop/Task/Pods/Kingfisher/Sources/Networking/ImageModifier.swift /Users/MohamedNawar/Desktop/Task/Pods/Kingfisher/Sources/Networking/RequestModifier.swift /Users/MohamedNawar/Desktop/Task/Pods/Kingfisher/Sources/Networking/RedirectHandler.swift /Users/MohamedNawar/Desktop/Task/Pods/Kingfisher/Sources/Image/Filter.swift /Users/MohamedNawar/Desktop/Task/Pods/Kingfisher/Sources/Cache/CacheSerializer.swift /Users/MohamedNawar/Desktop/Task/Pods/Kingfisher/Sources/Cache/FormatIndicatedCacheSerializer.swift /Users/MohamedNawar/Desktop/Task/Pods/Kingfisher/Sources/General/KingfisherError.swift /Users/MohamedNawar/Desktop/Task/Pods/Kingfisher/Sources/Networking/ImageDataProcessor.swift /Users/MohamedNawar/Desktop/Task/Pods/Kingfisher/Sources/Image/ImageProcessor.swift /Users/MohamedNawar/Desktop/Task/Pods/Kingfisher/Sources/Views/Indicator.swift /Users/MohamedNawar/Desktop/Task/Pods/Kingfisher/Sources/Utility/SizeExtensions.swift /Users/MohamedNawar/Desktop/Task/Pods/Kingfisher/Sources/Utility/ExtensionHelpers.swift /Users/MohamedNawar/Desktop/Task/Pods/Kingfisher/Sources/Image/ImageFormat.swift /Users/MohamedNawar/Desktop/Task/Pods/Kingfisher/Sources/Utility/Result.swift /Users/MohamedNawar/Desktop/Task/Pods/Kingfisher/Sources/Views/AnimatedImageView.swift /Users/MohamedNawar/Desktop/Task/Pods/Kingfisher/Sources/Utility/Box.swift /Users/MohamedNawar/Desktop/Task/Pods/Kingfisher/Sources/Networking/RetryStrategy.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/ObjectiveC.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/CoreMIDI.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/CoreMedia.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/simd.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/CoreImage.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/QuartzCore.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/Accelerate.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/Dispatch.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/Metal.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/Darwin.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/Foundation.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/AVFoundation.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/CoreFoundation.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/CoreAudio.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/CoreGraphics.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/os.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/Swift.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/UIKit.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/SwiftOnoneSupport.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/Combine.swiftmodule/x86_64-apple-ios-simulator.swiftmodule /Users/MohamedNawar/Desktop/Task/Pods/Target\ Support\ Files/Kingfisher/Kingfisher-umbrella.h /Users/MohamedNawar/Desktop/Task/Pods/Kingfisher/Sources/Kingfisher.h /Users/MohamedNawar/Desktop/Task/build/Pods.build/Debug-iphonesimulator/Kingfisher.build/unextended-module.modulemap /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.5.sdk/usr/include/objc/ObjectiveC.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.5.sdk/System/Library/Frameworks/OpenGLES.framework/Headers/OpenGLES.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.5.sdk/System/Library/Frameworks/CoreMedia.framework/Headers/CoreMedia.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.5.sdk/System/Library/Frameworks/CoreImage.framework/Headers/CoreImage.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.5.sdk/System/Library/Frameworks/QuartzCore.framework/Headers/QuartzCore.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.5.sdk/System/Library/Frameworks/Accelerate.framework/Headers/Accelerate.apinotes /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/apinotes/Dispatch.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.5.sdk/System/Library/Frameworks/Metal.framework/Headers/Metal.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.5.sdk/usr/include/Darwin.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.5.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.5.sdk/System/Library/Frameworks/AVFoundation.framework/Headers/AVFoundation.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.5.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.5.sdk/System/Library/Frameworks/CoreAudioTypes.framework/Headers/CoreAudioTypes.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.5.sdk/System/Library/Frameworks/UserNotifications.framework/Headers/UserNotifications.apinotes /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/apinotes/os.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.5.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIKit.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.5.sdk/System/Library/Frameworks/AVKit.framework/Headers/AVKit.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.5.sdk/System/Library/Frameworks/CoreText.framework/Headers/CoreText.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.5.sdk/System/Library/Frameworks/MediaToolbox.framework/Headers/MediaToolbox.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.5.sdk/System/Library/Frameworks/AudioToolbox.framework/Headers/AudioToolbox.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.5.sdk/System/Library/Frameworks/Security.framework/Headers/Security.apinotes
D
instance KDW_1405_Addon_Merdarion_NW(Npc_Default) { name[0] = "Мердарион"; guild = GIL_KDW; id = 1405; voice = 6; flags = 0; npcType = npctype_main; aivar[93] = TRUE; aivar[AIV_IgnoresFakeGuild] = TRUE; aivar[AIV_IgnoresArmor] = TRUE; B_SetAttributesToChapter(self,5); fight_tactic = FAI_HUMAN_MASTER; B_CreateAmbientInv(self); B_SetNpcVisual(self,MALE,"Hum_Head_Thief",Face_P_NormalBart_Nefarius,BodyTex_P,ITAR_KDW_L_Addon); Mdl_SetModelFatness(self,0); Mdl_ApplyOverlayMds(self,"Humans_Mage.mds"); B_GiveNpcTalents(self); B_SetFightSkills(self,30); bodyStateInterruptableOverride = TRUE; EquipItem(self,ItMW_Addon_Stab02_NPC); aivar[AIV_MagicUser] = MAGIC_ALWAYS; daily_routine = Rtn_PreStart_1405; }; func void Rtn_PreStart_1405() { TA_Smalltalk(8,0,20,0,"NW_TROLLAREA_PORTAL_03"); TA_Smalltalk(20,0,8,0,"NW_TROLLAREA_PORTAL_03"); }; func void Rtn_Start_1405() { TA_Stand_ArmsCrossed(6,5,6,15,"NW_TROLLAREA_PORTAL_02"); TA_Stand_ArmsCrossed(6,15,6,25,"NW_TROLLAREA_PORTALTEMPEL_STUDY_05"); TA_Stand_ArmsCrossed(6,25,6,35,"NW_TROLLAREA_PORTAL_02"); TA_Stand_ArmsCrossed(6,35,6,45,"NW_TROLLAREA_PORTALTEMPEL_STUDY_05"); TA_Stand_ArmsCrossed(6,45,6,55,"NW_TROLLAREA_PORTAL_02"); TA_Stand_ArmsCrossed(6,55,7,5,"NW_TROLLAREA_PORTALTEMPEL_STUDY_05"); TA_Stand_ArmsCrossed(7,5,7,15,"NW_TROLLAREA_PORTAL_02"); TA_Stand_ArmsCrossed(7,15,7,25,"NW_TROLLAREA_PORTALTEMPEL_STUDY_05"); TA_Stand_ArmsCrossed(7,25,7,35,"NW_TROLLAREA_PORTAL_02"); TA_Stand_ArmsCrossed(7,35,7,45,"NW_TROLLAREA_PORTALTEMPEL_STUDY_05"); TA_Stand_ArmsCrossed(7,45,7,55,"NW_TROLLAREA_PORTAL_02"); TA_Stand_ArmsCrossed(7,55,8,5,"NW_TROLLAREA_PORTALTEMPEL_STUDY_05"); TA_Stand_ArmsCrossed(8,5,8,15,"NW_TROLLAREA_PORTAL_02"); TA_Stand_ArmsCrossed(8,15,8,25,"NW_TROLLAREA_PORTALTEMPEL_STUDY_05"); TA_Stand_ArmsCrossed(8,25,8,35,"NW_TROLLAREA_PORTAL_02"); TA_Stand_ArmsCrossed(8,35,8,45,"NW_TROLLAREA_PORTALTEMPEL_STUDY_05"); TA_Stand_ArmsCrossed(8,45,8,55,"NW_TROLLAREA_PORTAL_02"); TA_Stand_ArmsCrossed(8,55,9,5,"NW_TROLLAREA_PORTALTEMPEL_STUDY_05"); TA_Stand_ArmsCrossed(9,5,9,15,"NW_TROLLAREA_PORTAL_02"); TA_Stand_ArmsCrossed(9,15,9,25,"NW_TROLLAREA_PORTALTEMPEL_STUDY_05"); TA_Stand_ArmsCrossed(9,25,9,35,"NW_TROLLAREA_PORTAL_02"); TA_Stand_ArmsCrossed(9,35,9,45,"NW_TROLLAREA_PORTALTEMPEL_STUDY_05"); TA_Stand_ArmsCrossed(9,45,9,55,"NW_TROLLAREA_PORTAL_02"); TA_Stand_ArmsCrossed(9,55,10,5,"NW_TROLLAREA_PORTALTEMPEL_STUDY_05"); TA_Stand_ArmsCrossed(10,5,10,15,"NW_TROLLAREA_PORTAL_02"); TA_Stand_ArmsCrossed(10,15,10,25,"NW_TROLLAREA_PORTALTEMPEL_STUDY_05"); TA_Stand_ArmsCrossed(10,25,10,35,"NW_TROLLAREA_PORTAL_02"); TA_Stand_ArmsCrossed(10,35,10,45,"NW_TROLLAREA_PORTALTEMPEL_STUDY_05"); TA_Stand_ArmsCrossed(10,45,10,55,"NW_TROLLAREA_PORTAL_02"); TA_Stand_ArmsCrossed(10,55,11,5,"NW_TROLLAREA_PORTALTEMPEL_STUDY_05"); TA_Stand_ArmsCrossed(11,5,11,15,"NW_TROLLAREA_PORTAL_02"); TA_Stand_ArmsCrossed(11,15,11,25,"NW_TROLLAREA_PORTALTEMPEL_STUDY_05"); TA_Stand_ArmsCrossed(11,25,11,35,"NW_TROLLAREA_PORTAL_02"); TA_Stand_ArmsCrossed(11,35,11,45,"NW_TROLLAREA_PORTALTEMPEL_STUDY_05"); TA_Stand_ArmsCrossed(11,45,11,55,"NW_TROLLAREA_PORTAL_02"); TA_Stand_ArmsCrossed(11,55,12,5,"NW_TROLLAREA_PORTALTEMPEL_STUDY_05"); TA_Stand_ArmsCrossed(12,5,12,15,"NW_TROLLAREA_PORTAL_02"); TA_Stand_ArmsCrossed(12,15,12,25,"NW_TROLLAREA_PORTALTEMPEL_STUDY_05"); TA_Stand_ArmsCrossed(12,25,12,35,"NW_TROLLAREA_PORTAL_02"); TA_Stand_ArmsCrossed(12,35,12,45,"NW_TROLLAREA_PORTALTEMPEL_STUDY_05"); TA_Stand_ArmsCrossed(12,45,12,55,"NW_TROLLAREA_PORTAL_02"); TA_Stand_ArmsCrossed(12,55,13,5,"NW_TROLLAREA_PORTALTEMPEL_STUDY_05"); TA_Stand_ArmsCrossed(13,5,13,15,"NW_TROLLAREA_PORTAL_02"); TA_Stand_ArmsCrossed(13,15,13,25,"NW_TROLLAREA_PORTALTEMPEL_STUDY_05"); TA_Stand_ArmsCrossed(13,25,13,35,"NW_TROLLAREA_PORTAL_02"); TA_Stand_ArmsCrossed(13,35,13,45,"NW_TROLLAREA_PORTALTEMPEL_STUDY_05"); TA_Stand_ArmsCrossed(13,45,13,55,"NW_TROLLAREA_PORTAL_02"); TA_Stand_ArmsCrossed(13,55,14,5,"NW_TROLLAREA_PORTALTEMPEL_STUDY_05"); TA_Stand_ArmsCrossed(14,5,14,15,"NW_TROLLAREA_PORTAL_02"); TA_Stand_ArmsCrossed(14,15,14,25,"NW_TROLLAREA_PORTALTEMPEL_STUDY_05"); TA_Stand_ArmsCrossed(14,25,14,35,"NW_TROLLAREA_PORTAL_02"); TA_Stand_ArmsCrossed(14,35,14,45,"NW_TROLLAREA_PORTALTEMPEL_STUDY_05"); TA_Stand_ArmsCrossed(14,45,14,55,"NW_TROLLAREA_PORTAL_02"); TA_Stand_ArmsCrossed(14,55,15,5,"NW_TROLLAREA_PORTALTEMPEL_STUDY_05"); TA_Stand_ArmsCrossed(15,5,15,15,"NW_TROLLAREA_PORTAL_02"); TA_Stand_ArmsCrossed(15,15,15,25,"NW_TROLLAREA_PORTALTEMPEL_STUDY_05"); TA_Stand_ArmsCrossed(15,25,15,35,"NW_TROLLAREA_PORTAL_02"); TA_Stand_ArmsCrossed(15,35,15,45,"NW_TROLLAREA_PORTALTEMPEL_STUDY_05"); TA_Stand_ArmsCrossed(15,45,15,55,"NW_TROLLAREA_PORTAL_02"); TA_Stand_ArmsCrossed(15,55,16,5,"NW_TROLLAREA_PORTALTEMPEL_STUDY_05"); TA_Stand_ArmsCrossed(16,5,16,15,"NW_TROLLAREA_PORTAL_02"); TA_Stand_ArmsCrossed(16,15,16,25,"NW_TROLLAREA_PORTALTEMPEL_STUDY_05"); TA_Stand_ArmsCrossed(16,25,16,35,"NW_TROLLAREA_PORTAL_02"); TA_Stand_ArmsCrossed(16,35,16,45,"NW_TROLLAREA_PORTALTEMPEL_STUDY_05"); TA_Stand_ArmsCrossed(16,45,16,55,"NW_TROLLAREA_PORTAL_02"); TA_Stand_ArmsCrossed(16,55,17,5,"NW_TROLLAREA_PORTALTEMPEL_STUDY_05"); TA_Stand_ArmsCrossed(17,5,17,15,"NW_TROLLAREA_PORTAL_02"); TA_Stand_ArmsCrossed(17,15,17,25,"NW_TROLLAREA_PORTALTEMPEL_STUDY_05"); TA_Stand_ArmsCrossed(17,25,17,35,"NW_TROLLAREA_PORTAL_02"); TA_Stand_ArmsCrossed(17,35,17,45,"NW_TROLLAREA_PORTALTEMPEL_STUDY_05"); TA_Stand_ArmsCrossed(17,45,17,55,"NW_TROLLAREA_PORTAL_02"); TA_Stand_ArmsCrossed(17,55,18,5,"NW_TROLLAREA_PORTALTEMPEL_STUDY_05"); TA_Stand_ArmsCrossed(18,5,18,15,"NW_TROLLAREA_PORTAL_02"); TA_Stand_ArmsCrossed(18,15,18,25,"NW_TROLLAREA_PORTALTEMPEL_STUDY_05"); TA_Stand_ArmsCrossed(18,25,18,35,"NW_TROLLAREA_PORTAL_02"); TA_Stand_ArmsCrossed(18,35,18,45,"NW_TROLLAREA_PORTALTEMPEL_STUDY_05"); TA_Stand_ArmsCrossed(18,45,18,55,"NW_TROLLAREA_PORTAL_02"); TA_Stand_ArmsCrossed(18,55,19,5,"NW_TROLLAREA_PORTALTEMPEL_STUDY_05"); TA_Stand_ArmsCrossed(19,5,19,15,"NW_TROLLAREA_PORTAL_02"); TA_Stand_ArmsCrossed(19,15,19,25,"NW_TROLLAREA_PORTALTEMPEL_STUDY_05"); TA_Stand_ArmsCrossed(19,25,19,35,"NW_TROLLAREA_PORTAL_02"); TA_Stand_ArmsCrossed(19,35,19,45,"NW_TROLLAREA_PORTALTEMPEL_STUDY_05"); TA_Stand_ArmsCrossed(19,45,19,55,"NW_TROLLAREA_PORTAL_02"); TA_Stand_ArmsCrossed(19,55,20,5,"NW_TROLLAREA_PORTALTEMPEL_STUDY_05"); TA_Stand_ArmsCrossed(20,5,20,15,"NW_TROLLAREA_PORTAL_02"); TA_Stand_ArmsCrossed(20,15,20,25,"NW_TROLLAREA_PORTALTEMPEL_STUDY_05"); TA_Stand_ArmsCrossed(20,25,20,35,"NW_TROLLAREA_PORTAL_02"); TA_Stand_ArmsCrossed(20,35,20,45,"NW_TROLLAREA_PORTALTEMPEL_STUDY_05"); TA_Stand_ArmsCrossed(20,45,20,55,"NW_TROLLAREA_PORTAL_02"); TA_Stand_ArmsCrossed(20,55,21,5,"NW_TROLLAREA_PORTALTEMPEL_STUDY_05"); TA_Stand_ArmsCrossed(21,5,21,15,"NW_TROLLAREA_PORTAL_02"); TA_Stand_ArmsCrossed(21,15,21,25,"NW_TROLLAREA_PORTALTEMPEL_STUDY_05"); TA_Stand_ArmsCrossed(21,25,21,35,"NW_TROLLAREA_PORTAL_02"); TA_Stand_ArmsCrossed(21,35,21,45,"NW_TROLLAREA_PORTALTEMPEL_STUDY_05"); TA_Stand_ArmsCrossed(21,45,21,55,"NW_TROLLAREA_PORTAL_02"); TA_Stand_ArmsCrossed(21,55,22,5,"NW_TROLLAREA_PORTALTEMPEL_STUDY_05"); TA_Stand_ArmsCrossed(22,5,22,15,"NW_TROLLAREA_PORTAL_02"); TA_Stand_ArmsCrossed(22,15,22,25,"NW_TROLLAREA_PORTALTEMPEL_STUDY_05"); TA_Stand_ArmsCrossed(22,25,22,35,"NW_TROLLAREA_PORTAL_02"); TA_Stand_ArmsCrossed(22,35,22,45,"NW_TROLLAREA_PORTALTEMPEL_STUDY_05"); TA_Stand_ArmsCrossed(22,45,22,55,"NW_TROLLAREA_PORTAL_02"); TA_Stand_ArmsCrossed(22,55,23,5,"NW_TROLLAREA_PORTALTEMPEL_STUDY_05"); TA_Stand_ArmsCrossed(23,5,23,15,"NW_TROLLAREA_PORTAL_02"); TA_Stand_ArmsCrossed(23,15,23,25,"NW_TROLLAREA_PORTALTEMPEL_STUDY_05"); TA_Stand_ArmsCrossed(23,25,23,35,"NW_TROLLAREA_PORTAL_02"); TA_Stand_ArmsCrossed(23,35,23,45,"NW_TROLLAREA_PORTALTEMPEL_STUDY_05"); TA_Stand_ArmsCrossed(23,45,23,55,"NW_TROLLAREA_PORTAL_02"); TA_Stand_ArmsCrossed(23,55,0,5,"NW_TROLLAREA_PORTALTEMPEL_STUDY_05"); TA_Stand_ArmsCrossed(0,5,0,15,"NW_TROLLAREA_PORTAL_02"); TA_Stand_ArmsCrossed(0,15,0,25,"NW_TROLLAREA_PORTALTEMPEL_STUDY_05"); TA_Stand_ArmsCrossed(0,25,0,35,"NW_TROLLAREA_PORTAL_02"); TA_Stand_ArmsCrossed(0,35,0,45,"NW_TROLLAREA_PORTALTEMPEL_STUDY_05"); TA_Stand_ArmsCrossed(0,45,0,55,"NW_TROLLAREA_PORTAL_02"); TA_Stand_ArmsCrossed(0,55,1,5,"NW_TROLLAREA_PORTALTEMPEL_STUDY_05"); TA_Stand_ArmsCrossed(1,5,1,15,"NW_TROLLAREA_PORTAL_02"); TA_Stand_ArmsCrossed(1,15,1,25,"NW_TROLLAREA_PORTALTEMPEL_STUDY_05"); TA_Stand_ArmsCrossed(1,25,1,35,"NW_TROLLAREA_PORTAL_02"); TA_Stand_ArmsCrossed(1,35,1,45,"NW_TROLLAREA_PORTALTEMPEL_STUDY_05"); TA_Stand_ArmsCrossed(1,45,1,55,"NW_TROLLAREA_PORTAL_02"); TA_Stand_ArmsCrossed(1,55,2,5,"NW_TROLLAREA_PORTALTEMPEL_STUDY_05"); TA_Stand_ArmsCrossed(2,5,2,15,"NW_TROLLAREA_PORTAL_02"); TA_Stand_ArmsCrossed(2,15,2,25,"NW_TROLLAREA_PORTALTEMPEL_STUDY_05"); TA_Stand_ArmsCrossed(2,25,2,35,"NW_TROLLAREA_PORTAL_02"); TA_Stand_ArmsCrossed(2,35,2,45,"NW_TROLLAREA_PORTALTEMPEL_STUDY_05"); TA_Stand_ArmsCrossed(2,45,2,55,"NW_TROLLAREA_PORTAL_02"); TA_Stand_ArmsCrossed(2,55,3,5,"NW_TROLLAREA_PORTALTEMPEL_STUDY_05"); TA_Stand_ArmsCrossed(3,5,3,15,"NW_TROLLAREA_PORTAL_02"); TA_Stand_ArmsCrossed(3,15,3,25,"NW_TROLLAREA_PORTALTEMPEL_STUDY_05"); TA_Stand_ArmsCrossed(3,25,3,35,"NW_TROLLAREA_PORTAL_02"); TA_Stand_ArmsCrossed(3,35,3,45,"NW_TROLLAREA_PORTALTEMPEL_STUDY_05"); TA_Stand_ArmsCrossed(3,45,3,55,"NW_TROLLAREA_PORTAL_02"); TA_Stand_ArmsCrossed(3,55,4,5,"NW_TROLLAREA_PORTALTEMPEL_STUDY_05"); TA_Stand_ArmsCrossed(4,5,4,15,"NW_TROLLAREA_PORTAL_02"); TA_Stand_ArmsCrossed(4,15,4,25,"NW_TROLLAREA_PORTALTEMPEL_STUDY_05"); TA_Stand_ArmsCrossed(4,25,4,35,"NW_TROLLAREA_PORTAL_02"); TA_Stand_ArmsCrossed(4,35,4,45,"NW_TROLLAREA_PORTALTEMPEL_STUDY_05"); TA_Stand_ArmsCrossed(4,45,4,55,"NW_TROLLAREA_PORTAL_02"); TA_Stand_ArmsCrossed(4,55,5,5,"NW_TROLLAREA_PORTALTEMPEL_STUDY_05"); TA_Stand_ArmsCrossed(5,5,5,15,"NW_TROLLAREA_PORTAL_02"); TA_Stand_ArmsCrossed(5,15,5,25,"NW_TROLLAREA_PORTALTEMPEL_STUDY_05"); TA_Stand_ArmsCrossed(5,25,5,35,"NW_TROLLAREA_PORTAL_02"); TA_Stand_ArmsCrossed(5,35,5,45,"NW_TROLLAREA_PORTALTEMPEL_STUDY_05"); TA_Stand_ArmsCrossed(5,45,5,55,"NW_TROLLAREA_PORTAL_02"); TA_Stand_ArmsCrossed(5,55,6,5,"NW_TROLLAREA_PORTALTEMPEL_STUDY_05"); }; func void Rtn_Ringritual_1405() { TA_Circle(8,0,20,0,"NW_TROLLAREA_PORTALTEMPEL_RITUAL_06"); TA_Circle(20,0,8,0,"NW_TROLLAREA_PORTALTEMPEL_RITUAL_06"); }; func void Rtn_PreRingritual_1405() { TA_Study_WP(8,0,20,0,"NW_TROLLAREA_PORTALTEMPEL_RITUAL_06"); TA_Study_WP(20,0,8,0,"NW_TROLLAREA_PORTALTEMPEL_RITUAL_06"); }; func void Rtn_OpenPortal_1405() { TA_Study_WP(8,0,20,0,"NW_TROLLAREA_PORTAL_KDWWAIT_06"); TA_Study_WP(20,0,8,0,"NW_TROLLAREA_PORTAL_KDWWAIT_06"); }; func void Rtn_TOT_1405() { TA_Stand_ArmsCrossed(8,0,20,0,"TOT"); TA_Stand_ArmsCrossed(20,0,8,0,"TOT"); }; func void Rtn_TOTNW_1405() { TA_Stand_ArmsCrossed(8,0,20,0,"TOT_NW"); TA_Stand_ArmsCrossed(20,0,8,0,"TOT_NW"); }; func void rtn_campon_1405() { TA_Stand_ArmsCrossed(9,0,23,0,"NW_BIGFARM_CAMPON_KDW_05"); TA_Stand_ArmsCrossed(23,0,9,0,"NW_BIGFARM_CAMPON_KDW_05"); }; func void rtn_inbattle_1405() { ta_bigfight(8,0,22,0,"NW_BIGFIGHT_8688"); ta_bigfight(22,0,8,0,"NW_BIGFIGHT_8688"); }; func void rtn_monastery_1405() { TA_Stand_ArmsCrossed(9,0,23,0,"NW_MONASTERY_WTMG_04"); TA_Stand_ArmsCrossed(23,0,9,0,"NW_MONASTERY_WTMG_04"); };
D
extern(C) int printf(const char*, ...); /***************************************************/ // 7239 struct vec7239 { float x, y, z, w; alias x r; //! for color access alias y g; //! ditto alias z b; //! ditto alias w a; //! ditto } void test7239() { vec7239 a = {x: 0, g: 0, b: 0, a: 1}; assert(a.r == 0); assert(a.g == 0); assert(a.b == 0); assert(a.a == 1); } /***************************************************/ int main() { test7239(); printf("Success\n"); return 0; }
D
import std.stdio; double pi() { double sum = 0; int i; while (i < 1e8) { sum += 4.0 / (i * 2 + 1) * (i % 2 ? -1 : 1); i++; } return sum; } void main() { writefln("%.15f", pi()); }
D
/Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/x86_64-apple-macosx/debug/Run.build/main.swift.o : /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/Sources/Run/main.swift /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/x86_64-apple-macosx/debug/NIOHTTP1.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/ObjectiveC.swiftmodule /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/x86_64-apple-macosx/debug/NIOOpenSSL.swiftmodule /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/x86_64-apple-macosx/debug/NIO.swiftmodule /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/x86_64-apple-macosx/debug/HTTP.swiftmodule /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/x86_64-apple-macosx/debug/NIOTLS.swiftmodule /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/x86_64-apple-macosx/debug/Async.swiftmodule /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/x86_64-apple-macosx/debug/Command.swiftmodule /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/x86_64-apple-macosx/debug/Service.swiftmodule /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/x86_64-apple-macosx/debug/Console.swiftmodule /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/x86_64-apple-macosx/debug/Core.swiftmodule /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/x86_64-apple-macosx/debug/Leaf.swiftmodule /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/x86_64-apple-macosx/debug/Logging.swiftmodule /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/x86_64-apple-macosx/debug/Debugging.swiftmodule /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/x86_64-apple-macosx/debug/Routing.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Dispatch.swiftmodule /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/x86_64-apple-macosx/debug/COperatingSystem.swiftmodule /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/x86_64-apple-macosx/debug/Random.swiftmodule /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/x86_64-apple-macosx/debug/URLEncodedForm.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Darwin.swiftmodule /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/x86_64-apple-macosx/debug/Validation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Foundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/CoreFoundation.swiftmodule /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/x86_64-apple-macosx/debug/Crypto.swiftmodule /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/x86_64-apple-macosx/debug/App.swiftmodule /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/x86_64-apple-macosx/debug/Vapor.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/CoreGraphics.swiftmodule /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/x86_64-apple-macosx/debug/NIOConcurrencyHelpers.swiftmodule /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/x86_64-apple-macosx/debug/Bits.swiftmodule /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/x86_64-apple-macosx/debug/NIOFoundationCompat.swiftmodule /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/x86_64-apple-macosx/debug/WebSocket.swiftmodule /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/x86_64-apple-macosx/debug/NIOWebSocket.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Swift.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/IOKit.swiftmodule /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/x86_64-apple-macosx/debug/DatabaseKit.swiftmodule /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/x86_64-apple-macosx/debug/TemplateKit.swiftmodule /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/x86_64-apple-macosx/debug/Multipart.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/SwiftOnoneSupport.swiftmodule /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/checkouts/swift-nio/Sources/CNIOSHA1/include/CNIOSHA1.h /usr/local/Cellar/libressl/2.9.2/include/openssl/asn1.h /usr/local/Cellar/libressl/2.9.2/include/openssl/tls1.h /usr/local/Cellar/libressl/2.9.2/include/openssl/dtls1.h /usr/local/Cellar/libressl/2.9.2/include/openssl/pkcs12.h /usr/local/Cellar/libressl/2.9.2/include/openssl/ssl2.h /usr/local/Cellar/libressl/2.9.2/include/openssl/pem2.h /usr/local/Cellar/libressl/2.9.2/include/openssl/ssl23.h /usr/local/Cellar/libressl/2.9.2/include/openssl/ssl3.h /usr/local/Cellar/libressl/2.9.2/include/openssl/x509v3.h /usr/local/Cellar/libressl/2.9.2/include/openssl/md5.h /usr/local/Cellar/libressl/2.9.2/include/openssl/pkcs7.h /usr/local/Cellar/libressl/2.9.2/include/openssl/x509.h /usr/local/Cellar/libressl/2.9.2/include/openssl/sha.h /usr/local/Cellar/libressl/2.9.2/include/openssl/dsa.h /usr/local/Cellar/libressl/2.9.2/include/openssl/ecdsa.h /usr/local/Cellar/libressl/2.9.2/include/openssl/rsa.h /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/checkouts/swift-nio/Sources/CNIOZlib/include/CNIOZlib.h /usr/local/Cellar/libressl/2.9.2/include/openssl/obj_mac.h /usr/local/Cellar/libressl/2.9.2/include/openssl/hmac.h /usr/local/Cellar/libressl/2.9.2/include/openssl/ec.h /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/checkouts/swift-nio/Sources/CNIOAtomics/include/cpp_magic.h /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/checkouts/swift-nio/Sources/CNIOLinux/include/ifaddrs-android.h /usr/local/Cellar/libressl/2.9.2/include/openssl/rand.h /usr/local/Cellar/libressl/2.9.2/include/openssl/conf.h /usr/local/Cellar/libressl/2.9.2/include/openssl/opensslconf.h /usr/local/Cellar/libressl/2.9.2/include/openssl/dh.h /usr/local/Cellar/libressl/2.9.2/include/openssl/ecdh.h /usr/local/Cellar/libressl/2.9.2/include/openssl/lhash.h /usr/local/Cellar/libressl/2.9.2/include/openssl/stack.h /usr/local/Cellar/libressl/2.9.2/include/openssl/safestack.h /usr/local/Cellar/libressl/2.9.2/include/openssl/ssl.h /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/checkouts/swift-nio-ssl/Sources/CNIOOpenSSL/include/c_nio_openssl.h /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/checkouts/crypto/Sources/CCryptoOpenSSL/include/c_crypto_openssl.h /usr/local/Cellar/libressl/2.9.2/include/openssl/pem.h /usr/local/Cellar/libressl/2.9.2/include/openssl/bn.h /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/checkouts/swift-nio/Sources/CNIODarwin/include/CNIODarwin.h /usr/local/Cellar/libressl/2.9.2/include/openssl/bio.h /usr/local/Cellar/libressl/2.9.2/include/openssl/crypto.h /usr/local/Cellar/libressl/2.9.2/include/openssl/srtp.h /usr/local/Cellar/libressl/2.9.2/include/openssl/evp.h /usr/local/Cellar/libressl/2.9.2/include/openssl/ossl_typ.h /usr/local/Cellar/libressl/2.9.2/include/openssl/buffer.h /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/checkouts/swift-nio/Sources/CNIOHTTPParser/include/CNIOHTTPParser.h /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/checkouts/swift-nio/Sources/CNIOHTTPParser/include/c_nio_http_parser.h /usr/local/Cellar/libressl/2.9.2/include/openssl/err.h /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/checkouts/swift-nio/Sources/CNIOAtomics/include/CNIOAtomics.h /usr/local/Cellar/libressl/2.9.2/include/openssl/opensslfeatures.h /usr/local/Cellar/libressl/2.9.2/include/openssl/objects.h /usr/local/Cellar/libressl/2.9.2/include/openssl/opensslv.h /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/checkouts/swift-nio/Sources/CNIOLinux/include/CNIOLinux.h /usr/local/Cellar/libressl/2.9.2/include/openssl/x509_vfy.h /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/x86_64-apple-macosx/debug/CNIOSHA1.build/module.modulemap /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/x86_64-apple-macosx/debug/CNIOOpenSSL.build/module.modulemap /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/x86_64-apple-macosx/debug/CCryptoOpenSSL.build/module.modulemap /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/x86_64-apple-macosx/debug/CNIOZlib.build/module.modulemap /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/x86_64-apple-macosx/debug/CNIODarwin.build/module.modulemap /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/x86_64-apple-macosx/debug/CNIOHTTPParser.build/module.modulemap /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/x86_64-apple-macosx/debug/CNIOAtomics.build/module.modulemap /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/x86_64-apple-macosx/debug/CNIOLinux.build/module.modulemap /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/checkouts/crypto/Sources/CBase32/include/module.modulemap /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/checkouts/crypto/Sources/CBcrypt/include/module.modulemap /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/checkouts/swift-nio-zlib-support/module.modulemap /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/checkouts/swift-nio-ssl-support/module.modulemap /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/objc/ObjectiveC.apinotes /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Dispatch.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/Darwin.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/ApplicationServices.framework/Headers/ApplicationServices.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/CoreText.framework/Headers/CoreText.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/Security.framework/Headers/Security.apinotes /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/x86_64-apple-macosx/debug/Run.build/main~partial.swiftmodule : /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/Sources/Run/main.swift /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/x86_64-apple-macosx/debug/NIOHTTP1.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/ObjectiveC.swiftmodule /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/x86_64-apple-macosx/debug/NIOOpenSSL.swiftmodule /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/x86_64-apple-macosx/debug/NIO.swiftmodule /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/x86_64-apple-macosx/debug/HTTP.swiftmodule /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/x86_64-apple-macosx/debug/NIOTLS.swiftmodule /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/x86_64-apple-macosx/debug/Async.swiftmodule /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/x86_64-apple-macosx/debug/Command.swiftmodule /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/x86_64-apple-macosx/debug/Service.swiftmodule /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/x86_64-apple-macosx/debug/Console.swiftmodule /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/x86_64-apple-macosx/debug/Core.swiftmodule /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/x86_64-apple-macosx/debug/Leaf.swiftmodule /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/x86_64-apple-macosx/debug/Logging.swiftmodule /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/x86_64-apple-macosx/debug/Debugging.swiftmodule /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/x86_64-apple-macosx/debug/Routing.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Dispatch.swiftmodule /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/x86_64-apple-macosx/debug/COperatingSystem.swiftmodule /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/x86_64-apple-macosx/debug/Random.swiftmodule /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/x86_64-apple-macosx/debug/URLEncodedForm.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Darwin.swiftmodule /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/x86_64-apple-macosx/debug/Validation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Foundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/CoreFoundation.swiftmodule /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/x86_64-apple-macosx/debug/Crypto.swiftmodule /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/x86_64-apple-macosx/debug/App.swiftmodule /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/x86_64-apple-macosx/debug/Vapor.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/CoreGraphics.swiftmodule /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/x86_64-apple-macosx/debug/NIOConcurrencyHelpers.swiftmodule /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/x86_64-apple-macosx/debug/Bits.swiftmodule /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/x86_64-apple-macosx/debug/NIOFoundationCompat.swiftmodule /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/x86_64-apple-macosx/debug/WebSocket.swiftmodule /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/x86_64-apple-macosx/debug/NIOWebSocket.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Swift.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/IOKit.swiftmodule /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/x86_64-apple-macosx/debug/DatabaseKit.swiftmodule /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/x86_64-apple-macosx/debug/TemplateKit.swiftmodule /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/x86_64-apple-macosx/debug/Multipart.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/SwiftOnoneSupport.swiftmodule /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/checkouts/swift-nio/Sources/CNIOSHA1/include/CNIOSHA1.h /usr/local/Cellar/libressl/2.9.2/include/openssl/asn1.h /usr/local/Cellar/libressl/2.9.2/include/openssl/tls1.h /usr/local/Cellar/libressl/2.9.2/include/openssl/dtls1.h /usr/local/Cellar/libressl/2.9.2/include/openssl/pkcs12.h /usr/local/Cellar/libressl/2.9.2/include/openssl/ssl2.h /usr/local/Cellar/libressl/2.9.2/include/openssl/pem2.h /usr/local/Cellar/libressl/2.9.2/include/openssl/ssl23.h /usr/local/Cellar/libressl/2.9.2/include/openssl/ssl3.h /usr/local/Cellar/libressl/2.9.2/include/openssl/x509v3.h /usr/local/Cellar/libressl/2.9.2/include/openssl/md5.h /usr/local/Cellar/libressl/2.9.2/include/openssl/pkcs7.h /usr/local/Cellar/libressl/2.9.2/include/openssl/x509.h /usr/local/Cellar/libressl/2.9.2/include/openssl/sha.h /usr/local/Cellar/libressl/2.9.2/include/openssl/dsa.h /usr/local/Cellar/libressl/2.9.2/include/openssl/ecdsa.h /usr/local/Cellar/libressl/2.9.2/include/openssl/rsa.h /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/checkouts/swift-nio/Sources/CNIOZlib/include/CNIOZlib.h /usr/local/Cellar/libressl/2.9.2/include/openssl/obj_mac.h /usr/local/Cellar/libressl/2.9.2/include/openssl/hmac.h /usr/local/Cellar/libressl/2.9.2/include/openssl/ec.h /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/checkouts/swift-nio/Sources/CNIOAtomics/include/cpp_magic.h /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/checkouts/swift-nio/Sources/CNIOLinux/include/ifaddrs-android.h /usr/local/Cellar/libressl/2.9.2/include/openssl/rand.h /usr/local/Cellar/libressl/2.9.2/include/openssl/conf.h /usr/local/Cellar/libressl/2.9.2/include/openssl/opensslconf.h /usr/local/Cellar/libressl/2.9.2/include/openssl/dh.h /usr/local/Cellar/libressl/2.9.2/include/openssl/ecdh.h /usr/local/Cellar/libressl/2.9.2/include/openssl/lhash.h /usr/local/Cellar/libressl/2.9.2/include/openssl/stack.h /usr/local/Cellar/libressl/2.9.2/include/openssl/safestack.h /usr/local/Cellar/libressl/2.9.2/include/openssl/ssl.h /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/checkouts/swift-nio-ssl/Sources/CNIOOpenSSL/include/c_nio_openssl.h /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/checkouts/crypto/Sources/CCryptoOpenSSL/include/c_crypto_openssl.h /usr/local/Cellar/libressl/2.9.2/include/openssl/pem.h /usr/local/Cellar/libressl/2.9.2/include/openssl/bn.h /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/checkouts/swift-nio/Sources/CNIODarwin/include/CNIODarwin.h /usr/local/Cellar/libressl/2.9.2/include/openssl/bio.h /usr/local/Cellar/libressl/2.9.2/include/openssl/crypto.h /usr/local/Cellar/libressl/2.9.2/include/openssl/srtp.h /usr/local/Cellar/libressl/2.9.2/include/openssl/evp.h /usr/local/Cellar/libressl/2.9.2/include/openssl/ossl_typ.h /usr/local/Cellar/libressl/2.9.2/include/openssl/buffer.h /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/checkouts/swift-nio/Sources/CNIOHTTPParser/include/CNIOHTTPParser.h /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/checkouts/swift-nio/Sources/CNIOHTTPParser/include/c_nio_http_parser.h /usr/local/Cellar/libressl/2.9.2/include/openssl/err.h /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/checkouts/swift-nio/Sources/CNIOAtomics/include/CNIOAtomics.h /usr/local/Cellar/libressl/2.9.2/include/openssl/opensslfeatures.h /usr/local/Cellar/libressl/2.9.2/include/openssl/objects.h /usr/local/Cellar/libressl/2.9.2/include/openssl/opensslv.h /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/checkouts/swift-nio/Sources/CNIOLinux/include/CNIOLinux.h /usr/local/Cellar/libressl/2.9.2/include/openssl/x509_vfy.h /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/x86_64-apple-macosx/debug/CNIOSHA1.build/module.modulemap /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/x86_64-apple-macosx/debug/CNIOOpenSSL.build/module.modulemap /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/x86_64-apple-macosx/debug/CCryptoOpenSSL.build/module.modulemap /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/x86_64-apple-macosx/debug/CNIOZlib.build/module.modulemap /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/x86_64-apple-macosx/debug/CNIODarwin.build/module.modulemap /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/x86_64-apple-macosx/debug/CNIOHTTPParser.build/module.modulemap /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/x86_64-apple-macosx/debug/CNIOAtomics.build/module.modulemap /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/x86_64-apple-macosx/debug/CNIOLinux.build/module.modulemap /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/checkouts/crypto/Sources/CBase32/include/module.modulemap /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/checkouts/crypto/Sources/CBcrypt/include/module.modulemap /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/checkouts/swift-nio-zlib-support/module.modulemap /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/checkouts/swift-nio-ssl-support/module.modulemap /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/objc/ObjectiveC.apinotes /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Dispatch.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/Darwin.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/ApplicationServices.framework/Headers/ApplicationServices.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/CoreText.framework/Headers/CoreText.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/Security.framework/Headers/Security.apinotes /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/x86_64-apple-macosx/debug/Run.build/main~partial.swiftdoc : /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/Sources/Run/main.swift /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/x86_64-apple-macosx/debug/NIOHTTP1.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/ObjectiveC.swiftmodule /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/x86_64-apple-macosx/debug/NIOOpenSSL.swiftmodule /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/x86_64-apple-macosx/debug/NIO.swiftmodule /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/x86_64-apple-macosx/debug/HTTP.swiftmodule /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/x86_64-apple-macosx/debug/NIOTLS.swiftmodule /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/x86_64-apple-macosx/debug/Async.swiftmodule /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/x86_64-apple-macosx/debug/Command.swiftmodule /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/x86_64-apple-macosx/debug/Service.swiftmodule /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/x86_64-apple-macosx/debug/Console.swiftmodule /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/x86_64-apple-macosx/debug/Core.swiftmodule /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/x86_64-apple-macosx/debug/Leaf.swiftmodule /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/x86_64-apple-macosx/debug/Logging.swiftmodule /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/x86_64-apple-macosx/debug/Debugging.swiftmodule /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/x86_64-apple-macosx/debug/Routing.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Dispatch.swiftmodule /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/x86_64-apple-macosx/debug/COperatingSystem.swiftmodule /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/x86_64-apple-macosx/debug/Random.swiftmodule /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/x86_64-apple-macosx/debug/URLEncodedForm.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Darwin.swiftmodule /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/x86_64-apple-macosx/debug/Validation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Foundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/CoreFoundation.swiftmodule /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/x86_64-apple-macosx/debug/Crypto.swiftmodule /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/x86_64-apple-macosx/debug/App.swiftmodule /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/x86_64-apple-macosx/debug/Vapor.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/CoreGraphics.swiftmodule /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/x86_64-apple-macosx/debug/NIOConcurrencyHelpers.swiftmodule /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/x86_64-apple-macosx/debug/Bits.swiftmodule /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/x86_64-apple-macosx/debug/NIOFoundationCompat.swiftmodule /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/x86_64-apple-macosx/debug/WebSocket.swiftmodule /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/x86_64-apple-macosx/debug/NIOWebSocket.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Swift.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/IOKit.swiftmodule /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/x86_64-apple-macosx/debug/DatabaseKit.swiftmodule /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/x86_64-apple-macosx/debug/TemplateKit.swiftmodule /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/x86_64-apple-macosx/debug/Multipart.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/SwiftOnoneSupport.swiftmodule /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/checkouts/swift-nio/Sources/CNIOSHA1/include/CNIOSHA1.h /usr/local/Cellar/libressl/2.9.2/include/openssl/asn1.h /usr/local/Cellar/libressl/2.9.2/include/openssl/tls1.h /usr/local/Cellar/libressl/2.9.2/include/openssl/dtls1.h /usr/local/Cellar/libressl/2.9.2/include/openssl/pkcs12.h /usr/local/Cellar/libressl/2.9.2/include/openssl/ssl2.h /usr/local/Cellar/libressl/2.9.2/include/openssl/pem2.h /usr/local/Cellar/libressl/2.9.2/include/openssl/ssl23.h /usr/local/Cellar/libressl/2.9.2/include/openssl/ssl3.h /usr/local/Cellar/libressl/2.9.2/include/openssl/x509v3.h /usr/local/Cellar/libressl/2.9.2/include/openssl/md5.h /usr/local/Cellar/libressl/2.9.2/include/openssl/pkcs7.h /usr/local/Cellar/libressl/2.9.2/include/openssl/x509.h /usr/local/Cellar/libressl/2.9.2/include/openssl/sha.h /usr/local/Cellar/libressl/2.9.2/include/openssl/dsa.h /usr/local/Cellar/libressl/2.9.2/include/openssl/ecdsa.h /usr/local/Cellar/libressl/2.9.2/include/openssl/rsa.h /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/checkouts/swift-nio/Sources/CNIOZlib/include/CNIOZlib.h /usr/local/Cellar/libressl/2.9.2/include/openssl/obj_mac.h /usr/local/Cellar/libressl/2.9.2/include/openssl/hmac.h /usr/local/Cellar/libressl/2.9.2/include/openssl/ec.h /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/checkouts/swift-nio/Sources/CNIOAtomics/include/cpp_magic.h /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/checkouts/swift-nio/Sources/CNIOLinux/include/ifaddrs-android.h /usr/local/Cellar/libressl/2.9.2/include/openssl/rand.h /usr/local/Cellar/libressl/2.9.2/include/openssl/conf.h /usr/local/Cellar/libressl/2.9.2/include/openssl/opensslconf.h /usr/local/Cellar/libressl/2.9.2/include/openssl/dh.h /usr/local/Cellar/libressl/2.9.2/include/openssl/ecdh.h /usr/local/Cellar/libressl/2.9.2/include/openssl/lhash.h /usr/local/Cellar/libressl/2.9.2/include/openssl/stack.h /usr/local/Cellar/libressl/2.9.2/include/openssl/safestack.h /usr/local/Cellar/libressl/2.9.2/include/openssl/ssl.h /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/checkouts/swift-nio-ssl/Sources/CNIOOpenSSL/include/c_nio_openssl.h /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/checkouts/crypto/Sources/CCryptoOpenSSL/include/c_crypto_openssl.h /usr/local/Cellar/libressl/2.9.2/include/openssl/pem.h /usr/local/Cellar/libressl/2.9.2/include/openssl/bn.h /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/checkouts/swift-nio/Sources/CNIODarwin/include/CNIODarwin.h /usr/local/Cellar/libressl/2.9.2/include/openssl/bio.h /usr/local/Cellar/libressl/2.9.2/include/openssl/crypto.h /usr/local/Cellar/libressl/2.9.2/include/openssl/srtp.h /usr/local/Cellar/libressl/2.9.2/include/openssl/evp.h /usr/local/Cellar/libressl/2.9.2/include/openssl/ossl_typ.h /usr/local/Cellar/libressl/2.9.2/include/openssl/buffer.h /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/checkouts/swift-nio/Sources/CNIOHTTPParser/include/CNIOHTTPParser.h /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/checkouts/swift-nio/Sources/CNIOHTTPParser/include/c_nio_http_parser.h /usr/local/Cellar/libressl/2.9.2/include/openssl/err.h /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/checkouts/swift-nio/Sources/CNIOAtomics/include/CNIOAtomics.h /usr/local/Cellar/libressl/2.9.2/include/openssl/opensslfeatures.h /usr/local/Cellar/libressl/2.9.2/include/openssl/objects.h /usr/local/Cellar/libressl/2.9.2/include/openssl/opensslv.h /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/checkouts/swift-nio/Sources/CNIOLinux/include/CNIOLinux.h /usr/local/Cellar/libressl/2.9.2/include/openssl/x509_vfy.h /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/x86_64-apple-macosx/debug/CNIOSHA1.build/module.modulemap /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/x86_64-apple-macosx/debug/CNIOOpenSSL.build/module.modulemap /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/x86_64-apple-macosx/debug/CCryptoOpenSSL.build/module.modulemap /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/x86_64-apple-macosx/debug/CNIOZlib.build/module.modulemap /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/x86_64-apple-macosx/debug/CNIODarwin.build/module.modulemap /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/x86_64-apple-macosx/debug/CNIOHTTPParser.build/module.modulemap /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/x86_64-apple-macosx/debug/CNIOAtomics.build/module.modulemap /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/x86_64-apple-macosx/debug/CNIOLinux.build/module.modulemap /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/checkouts/crypto/Sources/CBase32/include/module.modulemap /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/checkouts/crypto/Sources/CBcrypt/include/module.modulemap /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/checkouts/swift-nio-zlib-support/module.modulemap /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/checkouts/swift-nio-ssl-support/module.modulemap /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/objc/ObjectiveC.apinotes /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Dispatch.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/Darwin.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/ApplicationServices.framework/Headers/ApplicationServices.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/CoreText.framework/Headers/CoreText.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/Security.framework/Headers/Security.apinotes
D
/** * Module without unit test. */ module test.with_wrapper.no_unittest;
D
/* * Copyright (c) 2004-2009 Derelict Developers * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the names 'Derelict', 'DerelictAL', nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ module derelict.openal.alfuncs; private { import derelict.openal.altypes; import derelict.openal.alctypes; import derelict.openal.alcfuncs; import derelict.util.loader; } private void loadAL(SharedLib lib) { bindFunc(alEnable)("alEnable", lib); bindFunc(alDisable)("alDisable", lib); bindFunc(alIsEnabled)("alIsEnabled", lib); bindFunc(alGetString)("alGetString", lib); bindFunc(alGetBooleanv)("alGetBooleanv", lib); bindFunc(alGetIntegerv)("alGetIntegerv", lib); bindFunc(alGetFloatv)("alGetFloatv", lib); bindFunc(alGetDoublev)("alGetDoublev", lib); bindFunc(alGetInteger)("alGetInteger", lib); bindFunc(alGetFloat)("alGetFloat", lib); bindFunc(alGetDouble)("alGetDouble", lib); bindFunc(alGetError)("alGetError", lib); bindFunc(alIsExtensionPresent)("alIsExtensionPresent", lib); bindFunc(alGetProcAddress)("alGetProcAddress", lib); bindFunc(alGetEnumValue)("alGetEnumValue", lib); bindFunc(alListenerf)("alListenerf", lib); bindFunc(alListener3f)("alListener3f", lib); bindFunc(alListenerfv)("alListenerfv", lib); bindFunc(alListeneri)("alListeneri", lib); bindFunc(alListener3i)("alListener3i", lib); bindFunc(alListeneriv)("alListeneriv", lib); bindFunc(alGetListenerf)("alGetListenerf", lib); bindFunc(alGetListener3f)("alGetListener3f", lib); bindFunc(alGetListenerfv)("alGetListenerfv", lib); bindFunc(alGetListeneri)("alGetListeneri", lib); bindFunc(alGetListener3i)("alGetListener3i", lib); bindFunc(alGetListeneriv)("alGetListeneriv", lib); bindFunc(alGenSources)("alGenSources", lib); bindFunc(alDeleteSources)("alDeleteSources", lib); bindFunc(alIsSource)("alIsSource", lib); bindFunc(alSourcef)("alSourcef", lib); bindFunc(alSource3f)("alSource3f", lib); bindFunc(alSourcefv)("alSourcefv", lib); bindFunc(alSourcei)("alSourcei", lib); bindFunc(alSource3i)("alSource3i", lib); bindFunc(alSourceiv)("alSourceiv", lib); bindFunc(alGetSourcef)("alGetSourcef", lib); bindFunc(alGetSource3f)("alGetSource3f", lib); bindFunc(alGetSourcefv)("alGetSourcefv", lib); bindFunc(alGetSourcei)("alGetSourcei", lib); bindFunc(alGetSourceiv)("alGetSourceiv", lib); bindFunc(alSourcePlayv)("alSourcePlayv", lib); bindFunc(alSourceStopv)("alSourceStopv", lib); bindFunc(alSourceRewindv)("alSourceRewindv", lib); bindFunc(alSourcePausev)("alSourcePausev", lib); bindFunc(alSourcePlay)("alSourcePlay", lib); bindFunc(alSourcePause)("alSourcePause", lib); bindFunc(alSourceRewind)("alSourceRewind", lib); bindFunc(alSourceStop)("alSourceStop", lib); bindFunc(alSourceQueueBuffers)("alSourceQueueBuffers", lib); bindFunc(alSourceUnqueueBuffers)("alSourceUnqueueBuffers", lib); bindFunc(alGenBuffers)("alGenBuffers", lib); bindFunc(alDeleteBuffers)("alDeleteBuffers", lib); bindFunc(alIsBuffer)("alIsBuffer", lib); bindFunc(alBufferData)("alBufferData", lib); bindFunc(alBufferf)("alBufferf", lib); bindFunc(alBuffer3f)("alBuffer3f", lib); bindFunc(alBufferfv)("alBufferfv", lib); bindFunc(alBufferi)("alBufferi", lib); bindFunc(alBuffer3i)("alBuffer3i", lib); bindFunc(alBufferiv)("alBufferiv", lib); bindFunc(alGetBufferf)("alGetBufferf", lib); bindFunc(alGetBuffer3f)("alGetBuffer3f", lib); bindFunc(alGetBufferfv)("alGetBufferfv", lib); bindFunc(alGetBufferi)("alGetBufferi", lib); bindFunc(alGetBuffer3i)("alGetBuffer3i", lib); bindFunc(alGetBufferiv)("alGetBufferiv", lib); bindFunc(alDopplerFactor)("alDopplerFactor", lib); bindFunc(alDopplerVelocity)("alDopplerVelocity", lib); bindFunc(alSpeedOfSound)("alSpeedOfSound", lib); bindFunc(alDistanceModel)("alDistanceModel", lib); loadALC(lib); } GenericLoader DerelictAL; static this() { DerelictAL.setup( "OpenAL32.dll", "libal.so, libAL.so, libopenal.so, libopenal.so.1, libopenal.so.0", "", &loadAL ); } extern(C): void function(ALenum) alEnable; void function(ALenum) alDisable; ALboolean function(ALenum) alIsEnabled; char* function(ALenum) alGetString; void function(ALenum, ALboolean*) alGetBooleanv; void function(ALenum, ALint*) alGetIntegerv; void function(ALenum, ALfloat*) alGetFloatv; void function(ALenum, ALdouble*) alGetDoublev; ALboolean function(ALenum) alGetBoolean; ALint function(ALenum) alGetInteger; ALfloat function(ALenum) alGetFloat; ALdouble function(ALenum) alGetDouble; ALenum function() alGetError; ALboolean function(in char*) alIsExtensionPresent; ALboolean function(in char*) alGetProcAddress; ALenum function(in char*) alGetEnumValue; void function(ALenum, ALfloat) alListenerf; void function(ALenum, ALfloat, ALfloat, ALfloat) alListener3f; void function(ALenum, in ALfloat*) alListenerfv; void function(ALenum, ALint) alListeneri; void function(ALenum, ALint, ALint, ALint) alListener3i; void function(ALenum, in ALint*) alListeneriv; void function(ALenum, ALfloat*) alGetListenerf; void function(ALenum, ALfloat*, ALfloat*, ALfloat*) alGetListener3f; void function(ALenum, ALfloat*) alGetListenerfv; void function(ALenum, ALint*) alGetListeneri; void function(ALenum, ALint*, ALint*, ALint*) alGetListener3i; void function(ALenum, ALint*) alGetListeneriv; void function(ALsizei, ALuint*) alGenSources; void function(ALsizei, in ALuint*) alDeleteSources; ALboolean function(ALuint) alIsSource; void function(ALuint, ALenum, ALfloat) alSourcef; void function(ALuint, ALenum, ALfloat, ALfloat, ALfloat) alSource3f; void function(ALuint, ALenum, in ALfloat*) alSourcefv; void function(ALuint, ALenum, ALint) alSourcei; void function(ALuint, ALenum, ALint, ALint, ALint) alSource3i; void function(ALuint, ALenum, in ALint*) alSourceiv; void function(ALuint, ALenum, ALfloat*) alGetSourcef; void function(ALuint, ALenum, ALfloat*, ALfloat*, ALfloat*) alGetSource3f; void function(ALuint, ALenum, ALfloat*) alGetSourcefv; void function(ALuint, ALenum, ALint*) alGetSourcei; void function(ALuint, ALenum, ALint*, ALint*, ALint*) alGetSource3i; void function(ALuint, ALenum, ALint*) alGetSourceiv; void function(ALsizei, in ALuint*) alSourcePlayv; void function(ALsizei, in ALuint*) alSourceStopv; void function(ALsizei, in ALuint*) alSourceRewindv; void function(ALsizei, in ALuint*) alSourcePausev; void function(ALuint) alSourcePlay; void function(ALuint) alSourcePause; void function(ALuint) alSourceRewind; void function(ALuint) alSourceStop; void function(ALuint, ALsizei, ALuint*) alSourceQueueBuffers; void function(ALuint, ALsizei, ALuint*) alSourceUnqueueBuffers; void function(ALsizei, ALuint*) alGenBuffers; void function(ALsizei, in ALuint*) alDeleteBuffers; ALboolean function(ALuint) alIsBuffer; void function(ALuint, ALenum, in ALvoid*, ALsizei, ALsizei) alBufferData; void function(ALuint, ALenum, ALfloat) alBufferf; void function(ALuint, ALenum, ALfloat, ALfloat, ALfloat) alBuffer3f; void function(ALuint, ALenum, in ALfloat*) alBufferfv; void function(ALuint, ALenum, ALint) alBufferi; void function(ALuint, ALenum, ALint, ALint, ALint) alBuffer3i; void function(ALuint, ALenum, in ALint*) alBufferiv; void function(ALuint, ALenum, ALfloat*) alGetBufferf; void function(ALuint, ALenum, ALfloat*, ALfloat*, ALfloat*) alGetBuffer3f; void function(ALuint, ALenum, ALfloat*) alGetBufferfv; void function(ALuint, ALenum, ALint*) alGetBufferi; void function(ALuint, ALenum, ALint*, ALint*, ALint*) alGetBuffer3i; void function(ALuint, ALenum, ALint*) alGetBufferiv; void function(ALfloat) alDopplerFactor; void function(ALfloat) alDopplerVelocity; void function(ALfloat) alSpeedOfSound; void function(ALenum) alDistanceModel;
D
/Users/cktalex/Documents/bProject/SwiftTutorials/Session3/CoreDataSample/DerivedData/CoreDataSample/Build/Intermediates/CoreDataSample.build/Debug-iphoneos/CoreDataSample.build/Objects-normal/arm64/AppDelegate.o : /Users/cktalex/Documents/bProject/SwiftTutorials/Session3/CoreDataSample/CoreDataSample/User.swift /Users/cktalex/Documents/bProject/SwiftTutorials/Session3/CoreDataSample/CoreDataSample/ViewController.swift /Users/cktalex/Documents/bProject/SwiftTutorials/Session3/CoreDataSample/CoreDataSample/AppDelegate.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/Swift.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/Foundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/Darwin.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/Dispatch.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/ObjectiveC.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/CoreGraphics.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/CoreData.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/UIKit.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/CoreImage.swiftmodule /Users/cktalex/Documents/bProject/SwiftTutorials/Session3/CoreDataSample/DerivedData/CoreDataSample/Build/Intermediates/CoreDataSample.build/Debug-iphoneos/CoreDataSample.build/Objects-normal/arm64/AppDelegate~partial.swiftmodule : /Users/cktalex/Documents/bProject/SwiftTutorials/Session3/CoreDataSample/CoreDataSample/User.swift /Users/cktalex/Documents/bProject/SwiftTutorials/Session3/CoreDataSample/CoreDataSample/ViewController.swift /Users/cktalex/Documents/bProject/SwiftTutorials/Session3/CoreDataSample/CoreDataSample/AppDelegate.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/Swift.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/Foundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/Darwin.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/Dispatch.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/ObjectiveC.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/CoreGraphics.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/CoreData.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/UIKit.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/CoreImage.swiftmodule /Users/cktalex/Documents/bProject/SwiftTutorials/Session3/CoreDataSample/DerivedData/CoreDataSample/Build/Intermediates/CoreDataSample.build/Debug-iphoneos/CoreDataSample.build/Objects-normal/arm64/AppDelegate~partial.swiftdoc : /Users/cktalex/Documents/bProject/SwiftTutorials/Session3/CoreDataSample/CoreDataSample/User.swift /Users/cktalex/Documents/bProject/SwiftTutorials/Session3/CoreDataSample/CoreDataSample/ViewController.swift /Users/cktalex/Documents/bProject/SwiftTutorials/Session3/CoreDataSample/CoreDataSample/AppDelegate.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/Swift.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/Foundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/Darwin.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/Dispatch.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/ObjectiveC.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/CoreGraphics.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/CoreData.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/UIKit.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/CoreImage.swiftmodule
D
instance TPL_1410_TEMPLER(NPC_DEFAULT) { name[0] = NAME_TEMPLER; npctype = NPCTYPE_GUARD; guild = GIL_TPL; level = 17; flags = 0; voice = 13; id = 1410; attribute[ATR_STRENGTH] = 85; attribute[ATR_DEXTERITY] = 65; attribute[ATR_MANA_MAX] = 0; attribute[ATR_MANA] = 0; attribute[ATR_HITPOINTS_MAX] = 244; attribute[ATR_HITPOINTS] = 244; Mdl_SetVisual(self,"HUMANS.MDS"); Mdl_ApplyOverlayMds(self,"Humans_Mage.mds"); Mdl_SetVisualBody(self,"hum_body_Naked0",1,1,"Hum_Head_Bald",64,4,tpl_armor_m); b_scale(self); Mdl_SetModelFatness(self,-1); fight_tactic = FAI_HUMAN_STRONG; Npc_SetTalentSkill(self,NPC_TALENT_2H,1); EquipItem(self,itmw_2h_sword_light_01); CreateInvItem(self,itfosoup); CreateInvItem(self,itmijoint_1); daily_routine = rtn_start_1410; }; func void rtn_start_1410() { ta_smalltalk(5,0,22,0,"PSI_SMITH_TALK"); ta_guard(22,0,5,0,"PSI_SMITH_GUARD"); }; func void rtn_ritual_1410() { ta_guard(8,0,13,0,"PSI_PATH_TEMPLE_4"); ta_guard(13,0,8,0,"PSI_PATH_TEMPLE_4"); };
D
class A(T) { class B { T blah() { return t; } } T t; } mixin A!(int); int main() { A!(int) a = new A!(int)(); return 0; }
D
module std_backport.meta; import std.meta : AliasSeq; /** * Converts an input range $(D range) to an alias sequence. */ template aliasSeqOf(alias range) { import std.range : isInputRange; import std.traits : isArray, isNarrowString; alias ArrT = typeof(range); static if (isArray!ArrT && !isNarrowString!ArrT) { static if (range.length == 0) { alias aliasSeqOf = AliasSeq!(); } else static if (range.length == 1) { alias aliasSeqOf = AliasSeq!(range[0]); } else { alias aliasSeqOf = AliasSeq!(aliasSeqOf!(range[0 .. $/2]), aliasSeqOf!(range[$/2 .. $])); } } else static if (isInputRange!ArrT) { import std.array : array; alias aliasSeqOf = aliasSeqOf!(array(range)); } else { import std.string : format; static assert(false, format("Cannot transform %s of type %s into a AliasSeq.", range, ArrT.stringof)); } }
D
/** libevent based driver Copyright: © 2012-2013 RejectedSoftware e.K. Authors: Sönke Ludwig License: Subject to the terms of the MIT license, as written in the included LICENSE.txt file. */ module vibe.core.drivers.libevent2_tcp; version(VibeLibeventDriver) { public import vibe.core.core; import vibe.core.log; import vibe.core.drivers.libevent2; import vibe.core.drivers.utils; import vibe.utils.memory; import deimos.event2.buffer; import deimos.event2.bufferevent; import deimos.event2.bufferevent_ssl; import deimos.event2.event; import deimos.event2.util; import std.algorithm; import std.encoding : sanitize; import std.exception; import std.conv; import std.string; import core.stdc.errno; import core.thread; import core.sys.posix.netinet.in_; import core.sys.posix.netinet.tcp; import core.sys.posix.sys.socket; private { version(Windows){ import std.c.windows.winsock; enum EWOULDBLOCK = WSAEWOULDBLOCK; // make some neccessary parts of the socket interface public alias std.c.windows.winsock.in6_addr in6_addr; alias std.c.windows.winsock.INADDR_ANY INADDR_ANY; alias std.c.windows.winsock.IN6ADDR_ANY IN6ADDR_ANY; } else { alias core.sys.posix.netinet.in_.in6_addr in6_addr; alias core.sys.posix.netinet.in_.in6addr_any IN6ADDR_ANY; alias core.sys.posix.netinet.in_.INADDR_ANY INADDR_ANY; alias core.sys.posix.netinet.tcp.TCP_NODELAY TCP_NODELAY; } } package class Libevent2TCPConnection : TCPConnection { private { bool m_timeout_triggered; TCPContext* m_ctx; string m_peerAddress; ubyte[64] m_peekBuffer; bool m_tcpNoDelay = false; Duration m_readTimeout; char[64] m_peerAddressBuf; NetworkAddress m_localAddress, m_remoteAddress; } this(TCPContext* ctx) { m_ctx = ctx; assert(!amOwner()); m_localAddress = ctx.local_addr; m_remoteAddress = ctx.remote_addr; void* ptr; if( ctx.remote_addr.family == AF_INET ) ptr = &ctx.remote_addr.sockAddrInet4.sin_addr; else ptr = &ctx.remote_addr.sockAddrInet6.sin6_addr; evutil_inet_ntop(ctx.remote_addr.family, ptr, m_peerAddressBuf.ptr, m_peerAddressBuf.length); m_peerAddress = cast(string)m_peerAddressBuf[0 .. m_peerAddressBuf.indexOf('\0')]; bufferevent_setwatermark(m_ctx.event, EV_WRITE, 4096, 65536); bufferevent_setwatermark(m_ctx.event, EV_READ, 0, 65536); } /*~this() { //assert(m_ctx is null, "Leaking TCPContext because it has not been cleaned up and we are not allowed to touch the GC in finalizers.."); }*/ @property void tcpNoDelay(bool enabled) { m_tcpNoDelay = enabled; auto fd = m_ctx.socketfd; ubyte opt = enabled; assert(fd <= int.max, "Socket descriptor > int.max"); setsockopt(cast(int)fd, IPPROTO_TCP, TCP_NODELAY, &opt, opt.sizeof); } @property bool tcpNoDelay() const { return m_tcpNoDelay; } @property void readTimeout(Duration v) { m_readTimeout = v; if( v == dur!"seconds"(0) ){ bufferevent_set_timeouts(m_ctx.event, null, null); } else { assert(v.total!"seconds" <= int.max); timeval toread = {tv_sec: cast(int)v.total!"seconds", tv_usec: v.fracSec.usecs}; bufferevent_set_timeouts(m_ctx.event, &toread, null); } } @property Duration readTimeout() const { return m_readTimeout; } @property NetworkAddress localAddress() const { return m_localAddress; } @property NetworkAddress remoteAddress() const { return m_remoteAddress; } private void acquire() { assert(m_ctx, "Trying to acquire a closed TCP connection."); assert(m_ctx.readOwner == Task() && m_ctx.writeOwner == Task(), "Trying to acquire a TCP connection that is currently owned."); m_ctx.readOwner = m_ctx.writeOwner = Task.getThis(); } private void release() { if( !m_ctx ) return; assert(m_ctx.readOwner != Task() && m_ctx.writeOwner != Task(), "Trying to release a TCP connection that is not owned."); assert(m_ctx.readOwner == Task.getThis() && m_ctx.readOwner == m_ctx.writeOwner, "Trying to release a foreign TCP connection."); m_ctx.readOwner = m_ctx.writeOwner = Task(); } private bool amOwner() { return m_ctx !is null && m_ctx.readOwner != Task() && m_ctx.readOwner == Task.getThis() && m_ctx.readOwner == m_ctx.writeOwner; } /// Closes the connection. void close() { if (!m_ctx) return; acquire(); scope (exit) { TCPContextAlloc.free(m_ctx); m_ctx = null; } if (m_ctx.event) { auto fd = m_ctx.socketfd; scope (exit) { version(Windows) shutdown(m_ctx.socketfd, SD_SEND); else shutdown(m_ctx.socketfd, SHUT_WR); if (m_ctx.event) bufferevent_free(m_ctx.event); logTrace("...socket %d closed.", fd); } m_ctx.shutdown = true; bufferevent_setwatermark(m_ctx.event, EV_WRITE, 1, 0); bufferevent_flush(m_ctx.event, EV_WRITE, bufferevent_flush_mode.BEV_FINISHED); logTrace("Closing socket %d...", fd); auto buf = bufferevent_get_output(m_ctx.event); while (m_ctx.event && evbuffer_get_length(buf) > 0) m_ctx.core.yieldForEvent(); } } /// The 'connected' status of this connection @property bool connected() const { return m_ctx !is null && m_ctx.event !is null && !m_ctx.eof; } @property bool empty() { return leastSize == 0; } @property ulong leastSize() { if (!m_ctx || !m_ctx.event) return 0; acquireReader(); scope(exit) releaseReader(); auto inbuf = bufferevent_get_input(m_ctx.event); size_t len; while ((len = evbuffer_get_length(inbuf)) == 0) { if (!connected) { if (m_ctx) { if (m_ctx.event) bufferevent_free(m_ctx.event); TCPContextAlloc.free(m_ctx); m_ctx = null; } return 0; } logTrace("leastSize waiting for new data."); m_ctx.core.yieldForEvent(); } return len; } @property bool dataAvailableForRead() { if (!m_ctx || !m_ctx.event) return false; acquireReader(); scope(exit) releaseReader(); auto inbuf = bufferevent_get_input(m_ctx.event); return evbuffer_get_length(inbuf) > 0; } @property string peerAddress() const { return m_peerAddress; } const(ubyte)[] peek() { if (!m_ctx || !m_ctx.event) return null; acquireReader(); scope(exit) releaseReader(); auto inbuf = bufferevent_get_input(m_ctx.event); evbuffer_iovec iovec; if (evbuffer_peek(inbuf, -1, null, &iovec, 1) == 0) return null; return (cast(ubyte*)iovec.iov_base)[0 .. iovec.iov_len]; } /** Reads as many bytes as 'dst' can hold. */ void read(ubyte[] dst) { checkConnected(false); acquireReader(); scope(exit) releaseReader(); while (dst.length > 0) { checkConnected(false); logTrace("evbuffer_read %d bytes (fd %d)", dst.length, m_ctx.socketfd); auto nbytes = bufferevent_read(m_ctx.event, dst.ptr, dst.length); logTrace(" .. got %d bytes", nbytes); dst = dst[nbytes .. $]; if( dst.length == 0 ) break; checkConnected(false); m_ctx.core.yieldForEvent(); } logTrace("read data"); } bool waitForData(Duration timeout) { if (!m_ctx || !m_ctx.event) return false; assert(m_ctx !is null); auto inbuf = bufferevent_get_input(m_ctx.event); if (evbuffer_get_length(inbuf) > 0) return true; if (m_ctx.eof) return false; acquireReader(); scope(exit) releaseReader(); m_timeout_triggered = false; event* evtmout = event_new(m_ctx.eventLoop, -1, 0, &onTimeout, cast(void*)this); timeval t; assert(timeout.total!"seconds"() <= int.max, "Timeouts must not be larger than int.max seconds!"); t.tv_sec = cast(int)timeout.total!"seconds"(); t.tv_usec = timeout.fracSec().usecs(); logTrace("add timeout event with %d/%d", t.tv_sec, t.tv_usec); event_add(evtmout, &t); scope (exit) { event_del(evtmout); event_free(evtmout); } logTrace("wait for data"); while (m_ctx && m_ctx.event) { if (evbuffer_get_length(inbuf) > 0) return true; if (m_timeout_triggered) { logTrace(" -> timeout = %s", m_timeout_triggered); return false; } try rawYield(); catch (Exception e) { logDiagnostic("Connection error during waitForData: %s", e.toString()); } } return false; } alias Stream.write write; /** Writes the given byte array. */ void write(in ubyte[] bytes) { checkConnected(); acquireWriter(); scope(exit) releaseWriter(); if (!bytes.length) return; //logTrace("evbuffer_add (fd %d): %s", m_ctx.socketfd, bytes); //logTrace("evbuffer_add (fd %d): <%s>", m_ctx.socketfd, cast(string)bytes); logTrace("evbuffer_add (fd %d): %d B", m_ctx.socketfd, bytes.length); auto outbuf = bufferevent_get_output(m_ctx.event); if( bufferevent_write(m_ctx.event, cast(char*)bytes.ptr, bytes.length) != 0 ) throw new Exception("Failed to write data to buffer"); // wait for the data to be written up the the low watermark while (evbuffer_get_length(outbuf) > 4096) { rawYield(); checkConnected(); } } void write(InputStream stream, ulong nbytes = 0) { import vibe.core.drivers.threadedfile; version(none){ // causes a crash on Windows // special case sending of files if( auto fstream = cast(ThreadedFileStream)stream ){ checkConnected(); acquireWriter(); scope(exit) releaseWriter(); logInfo("Using sendfile! %s %s %s %s", fstream.fd, fstream.tell(), fstream.size, nbytes); fstream.takeOwnershipOfFD(); auto buf = bufferevent_get_output(m_ctx.event); enforce(evbuffer_add_file(buf, fstream.fd, fstream.tell(), nbytes ? nbytes : fstream.size-fstream.tell()) == 0, "Failed to send file over TCP connection."); return; } } logTrace("writing stream %s %s", nbytes, stream.leastSize); writeDefault(stream, nbytes); logTrace("wrote stream %s", nbytes); } /** Causes any buffered data to be written. */ void flush() { checkConnected(); acquireWriter(); scope(exit) releaseWriter(); logTrace("bufferevent_flush"); bufferevent_flush(m_ctx.event, EV_WRITE, bufferevent_flush_mode.BEV_NORMAL); } void finalize() { flush(); } private void acquireReader() { assert(m_ctx.readOwner == Task(), "Acquiring reader of already owned connection."); m_ctx.readOwner = Task.getThis(); } private void releaseReader() { if (!m_ctx) return; assert(m_ctx.readOwner == Task.getThis(), "Releasing reader of unowned connection."); m_ctx.readOwner = Task(); } private void acquireWriter() { assert(m_ctx.writeOwner == Task(), "Acquiring writer of already owned connection."); m_ctx.writeOwner = Task.getThis(); } private void releaseWriter() { if (!m_ctx) return; assert(m_ctx.writeOwner == Task.getThis(), "Releasing reader of already unowned connection."); m_ctx.writeOwner = Task(); } private void checkConnected(bool write = true) { enforce(m_ctx !is null, "Operating on closed TCPConnection."); if (m_ctx.event is null) { TCPContextAlloc.free(m_ctx); m_ctx = null; throw new Exception(format("Connection error while %s TCPConnection.", write ? "writing to" : "reading from")); } enforce (!write || !m_ctx.eof, "Remote hung up while writing to TCPConnection."); if (!write && m_ctx.eof) { auto buf = bufferevent_get_input(m_ctx.event); auto data_left = evbuffer_get_length(buf) > 0; enforce(data_left, "Remote hung up while reading from TCPConnection."); } } } class LibeventTCPListener : TCPListener { private { TCPContext*[] m_ctx; } void addContext(TCPContext* ctx) { synchronized(this) m_ctx ~= ctx; } void stopListening() { synchronized(this) { foreach (ctx; m_ctx) { event_free(ctx.listenEvent); evutil_closesocket(ctx.socketfd); TCPContextAlloc.free(ctx); } m_ctx = null; } } } /**************************************************************************************************/ /* Private types */ /**************************************************************************************************/ package struct TCPContext { this(DriverCore c, event_base* evbase, int sock, bufferevent* evt, NetworkAddress bindaddr, NetworkAddress peeraddr){ core = c; eventLoop = evbase; socketfd = sock; event = evt; local_addr = bindaddr; remote_addr = peeraddr; } this(DriverCore c, event_base* evbase, int sock, bufferevent* evt){ core = c; eventLoop = evbase; socketfd = sock; event = evt; } void checkForException() { if (auto ex = this.exception) { this.exception = null; throw ex; } } DriverCore core; event_base* eventLoop; void delegate(TCPConnection conn) connectionCallback; bufferevent* event; deimos.event2.event_struct.event* listenEvent; NetworkAddress local_addr; NetworkAddress remote_addr; bool shutdown = false; int socketfd = -1; int status = 0; bool eof = false; // remomte has hung up Task readOwner; Task writeOwner; Exception exception; // set during onSocketEvent calls that were emitted synchronously TCPListenOptions listenOptions; } alias FreeListObjectAlloc!(TCPContext, false, true) TCPContextAlloc; /**************************************************************************************************/ /* Private functions */ /**************************************************************************************************/ package nothrow extern(C) { void onConnect(evutil_socket_t listenfd, short evtype, void *arg) { logTrace("connect callback"); auto ctx = cast(TCPContext*)arg; if( !(evtype & EV_READ) ){ logError("Unknown event type in connect callback: 0x%hx", evtype); return; } static struct ClientTask { TCPContext* listen_ctx; NetworkAddress bind_addr; NetworkAddress remote_addr; int sockfd; TCPListenOptions options; void execute() { assert(sockfd > 0); if( evutil_make_socket_nonblocking(sockfd) ){ logError("Error setting non-blocking I/O on an incoming connection."); } auto eventloop = getThreadLibeventEventLoop(); auto drivercore = getThreadLibeventDriverCore(); // Initialize a buffered I/O event auto buf_event = bufferevent_socket_new(eventloop, sockfd, bufferevent_options.BEV_OPT_CLOSE_ON_FREE); if( !buf_event ){ logError("Error initializing buffered I/O event for fd %d.", sockfd); return; } auto client_ctx = TCPContextAlloc.alloc(drivercore, eventloop, sockfd, buf_event, bind_addr, remote_addr); assert(client_ctx.event !is null, "event is null although it was just != null?"); bufferevent_setcb(buf_event, &onSocketRead, &onSocketWrite, &onSocketEvent, client_ctx); if( bufferevent_enable(buf_event, EV_READ|EV_WRITE) ){ bufferevent_free(buf_event); TCPContextAlloc.free(client_ctx); logError("Error enabling buffered I/O event for fd %d.", sockfd); return; } assert(client_ctx.event !is null, "Client task called without event!?"); auto conn = FreeListRef!Libevent2TCPConnection(client_ctx); assert(conn.connected, "Connection closed directly after accept?!"); logDebug("start task (fd %d).", client_ctx.socketfd); try { listen_ctx.connectionCallback(conn); logDebug("task out (fd %d).", client_ctx.socketfd); } catch (Exception e) { logWarn("Handling of connection failed: %s", e.msg); logDiagnostic("%s", e.toString().sanitize); } finally { logDebug("task finished."); FreeListObjectAlloc!ClientTask.free(&this); if (!(options & TCPListenOptions.disableAutoClose)) conn.close(); } } } try { // Accept and configure incoming connections (up to 10 connections in one go) foreach( i; 0 .. 10 ){ logTrace("accept"); assert(listenfd < int.max, "Listen socket descriptor >= int.max?!"); sockaddr_in6 remote_addr; socklen_t addrlen = remote_addr.sizeof; auto sockfd_raw = accept(cast(int)listenfd, cast(sockaddr*)&remote_addr, &addrlen); logDebug("FD: %s", sockfd_raw); static if (typeof(sockfd_raw).max > int.max) assert(sockfd_raw <= int.max || sockfd_raw == ~0); auto sockfd = cast(int)sockfd_raw; logTrace("accepted %d", sockfd); if (sockfd == -1) { version(Windows) auto err = evutil_socket_geterror(sockfd); else auto err = errno; if( err != EWOULDBLOCK && err != EAGAIN && err != 0 ){ version(Windows) logError("Error accepting an incoming connection: %s", to!string(evutil_socket_error_to_string(err))); else logError("Error accepting an incoming connection: %d", err); } break; } auto task = FreeListObjectAlloc!ClientTask.alloc(); task.listen_ctx = ctx; task.bind_addr = ctx.local_addr; *cast(sockaddr_in6*)task.remote_addr.sockAddr = remote_addr; task.sockfd = sockfd; task.options = ctx.listenOptions; runTask(&task.execute); } } catch (Throwable e) { logWarn("Got exception while accepting new connections: %s", e.msg); try logDebug("Full error: %s", e.toString().sanitize()); catch {} } logTrace("handled incoming connections..."); } void onSocketRead(bufferevent *buf_event, void *arg) { auto ctx = cast(TCPContext*)arg; logTrace("socket %d read event!", ctx.socketfd); auto f = ctx.readOwner; try { if (f && f.running) ctx.core.resumeTask(f); } catch( Throwable e ){ logWarn("Got exception when resuming task onSocketRead: %s", e.msg); } } void onSocketWrite(bufferevent *buf_event, void *arg) { try { auto ctx = cast(TCPContext*)arg; assert(ctx.event is buf_event, "Write event on bufferevent that does not match the TCPContext"); logTrace("socket %d write event (%s)!", ctx.socketfd, ctx.shutdown); if (ctx.writeOwner && ctx.writeOwner.running) { bufferevent_flush(buf_event, EV_WRITE, bufferevent_flush_mode.BEV_FLUSH); } if (ctx.writeOwner) ctx.core.resumeTask(ctx.writeOwner); } catch( Throwable e ){ logWarn("Got exception when resuming task onSocketRead: %s", e.msg); } } void onSocketEvent(bufferevent *buf_event, short status, void *arg) { try { auto ctx = cast(TCPContext*)arg; ctx.status = status; logDebug("Socket event on fd %d: %d (%s vs %s)", ctx.socketfd, status, cast(void*)buf_event, cast(void*)ctx.event); assert(ctx.event is buf_event, "Status event on bufferevent that does not match the TCPContext"); Exception ex; bool free_event = false; string errorMessage; if (status & BEV_EVENT_EOF) { logDebug("Connection was closed (fd %d).", ctx.socketfd); ctx.eof = true; evbuffer* buf = bufferevent_get_input(buf_event); if (evbuffer_get_length(buf) == 0) free_event = true; } else if (status & BEV_EVENT_TIMEOUT) { logDebug("Remote host on fd %d timed out.", ctx.socketfd); free_event = true; } else if (status & BEV_EVENT_ERROR) { auto msg = format("Error %s socket %s", (status & BEV_EVENT_READING) ? "reading from" : (status & BEV_EVENT_WRITING) ? "writing to" : "on", ctx.socketfd); ex = new SystemSocketException(msg); free_event = true; } if (free_event) { bufferevent_free(buf_event); ctx.event = null; } ctx.core.eventException = ex; if (ctx.readOwner && ctx.readOwner.running) { logTrace("resuming corresponding task%s...", ex is null ? "" : " with exception"); if (ctx.readOwner.fiber.state == Fiber.State.EXEC) ctx.exception = ex; else ctx.core.resumeTask(ctx.readOwner, ex); } if (ctx.writeOwner && ctx.writeOwner != ctx.readOwner && ctx.writeOwner.running) { logTrace("resuming corresponding task%s...", ex is null ? "" : " with exception"); if (ctx.writeOwner.fiber.state == Fiber.State.EXEC) ctx.exception = ex; else ctx.core.resumeTask(ctx.writeOwner, ex); } } catch( Throwable e ){ logWarn("Got exception when resuming task onSocketEvent: %s", e.msg); try logDiagnostic("Full error: %s", e.toString().sanitize); catch {} } } private extern(C) void onTimeout(evutil_socket_t, short events, void* userptr) { try { logTrace("data wait timeout"); auto conn = cast(Libevent2TCPConnection)userptr; conn.m_timeout_triggered = true; if( conn.m_ctx ) conn.m_ctx.core.resumeTask(conn.m_ctx.readOwner); else logDebug("waitForData timeout after connection was closed!"); } catch( Throwable e ){ logWarn("Exception onTimeout: %s", e.msg); } } } /// private package void removeFromArray(T)(ref T[] array, T item) { foreach( i; 0 .. array.length ) if( array[i] is item ){ array = array[0 .. i] ~ array[i+1 .. $]; return; } } }
D
// Copyright Ferdinand Majerech 2011. // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) /** * YAML emitter. * Code based on PyYAML: http://www.pyyaml.org */ module dyaml.emitter; import std.algorithm; import std.array; import std.ascii; import std.conv; import std.encoding; import std.exception; import std.format; import std.range; import std.string; import std.system; import std.typecons; import std.utf; import dyaml.encoding; import dyaml.escapes; import dyaml.event; import dyaml.exception; import dyaml.linebreak; import dyaml.queue; import dyaml.style; import dyaml.tagdirective; package: //Stores results of analysis of a scalar, determining e.g. what scalar style to use. struct ScalarAnalysis { //Scalar itself. string scalar; enum AnalysisFlags { empty = 1<<0, multiline = 1<<1, allowFlowPlain = 1<<2, allowBlockPlain = 1<<3, allowSingleQuoted = 1<<4, allowDoubleQuoted = 1<<5, allowBlock = 1<<6, isNull = 1<<7 } ///Analysis results. BitFlags!AnalysisFlags flags; } private alias isNewLine = among!('\n', '\u0085', '\u2028', '\u2029'); private alias isSpecialChar = among!('#', ',', '[', ']', '{', '}', '&', '*', '!', '|', '>', '\\', '\'', '"', '%', '@', '`'); private alias isFlowIndicator = among!(',', '?', '[', ']', '{', '}'); private alias isSpace = among!('\0', '\n', '\r', '\u0085', '\u2028', '\u2029', ' ', '\t'); //Emits YAML events into a file/stream. struct Emitter(Range, CharType) if (isOutputRange!(Range, CharType)) { private: ///Default tag handle shortcuts and replacements. static TagDirective[] defaultTagDirectives_ = [TagDirective("!", "!"), TagDirective("!!", "tag:yaml.org,2002:")]; ///Stream to write to. Range stream_; /// Type used for upcoming emitter steps alias EmitterFunction = void function(scope typeof(this)*) @safe; ///Stack of states. Appender!(EmitterFunction[]) states_; ///Current state. EmitterFunction state_; ///Event queue. Queue!Event events_; ///Event we're currently emitting. Event event_; ///Stack of previous indentation levels. Appender!(int[]) indents_; ///Current indentation level. int indent_ = -1; ///Level of nesting in flow context. If 0, we're in block context. uint flowLevel_ = 0; /// Describes context (where we are in the document). enum Context { /// Root node of a document. root, /// Sequence. sequence, /// Mapping. mappingNoSimpleKey, /// Mapping, in a simple key. mappingSimpleKey, } /// Current context. Context context_; ///Characteristics of the last emitted character: ///Line. uint line_ = 0; ///Column. uint column_ = 0; ///Whitespace character? bool whitespace_ = true; ///indentation space, '-', '?', or ':'? bool indentation_ = true; ///Does the document require an explicit document indicator? bool openEnded_; ///Formatting details. ///Canonical scalar format? bool canonical_; ///Best indentation width. uint bestIndent_ = 2; ///Best text width. uint bestWidth_ = 80; ///Best line break character/s. LineBreak bestLineBreak_; ///Tag directive handle - prefix pairs. TagDirective[] tagDirectives_; ///Anchor/alias to process. string preparedAnchor_ = null; ///Tag to process. string preparedTag_ = null; ///Analysis result of the current scalar. ScalarAnalysis analysis_; ///Style of the current scalar. ScalarStyle style_ = ScalarStyle.invalid; public: @disable int opCmp(ref Emitter); @disable bool opEquals(ref Emitter); /** * Construct an emitter. * * Params: stream = Output range to write to. * canonical = Write scalars in canonical form? * indent = Indentation width. * lineBreak = Line break character/s. */ this(Range stream, const bool canonical, const int indent, const int width, const LineBreak lineBreak) @safe { states_.reserve(32); indents_.reserve(32); stream_ = stream; canonical_ = canonical; nextExpected!"expectStreamStart"(); if(indent > 1 && indent < 10){bestIndent_ = indent;} if(width > bestIndent_ * 2) {bestWidth_ = width;} bestLineBreak_ = lineBreak; analysis_.flags.isNull = true; } ///Emit an event. void emit(Event event) @safe { events_.push(event); while(!needMoreEvents()) { event_ = events_.pop(); callNext(); event_.destroy(); } } private: ///Pop and return the newest state in states_. EmitterFunction popState() @safe in(states_.data.length > 0, "Emitter: Need to pop a state but there are no states left") { const result = states_.data[$-1]; states_.shrinkTo(states_.data.length - 1); return result; } void pushState(string D)() @safe { states_ ~= mixin("function(typeof(this)* self) { self."~D~"(); }"); } ///Pop and return the newest indent in indents_. int popIndent() @safe in(indents_.data.length > 0, "Emitter: Need to pop an indent level but there" ~ " are no indent levels left") { const result = indents_.data[$-1]; indents_.shrinkTo(indents_.data.length - 1); return result; } ///Write a string to the file/stream. void writeString(const scope char[] str) @safe { static if(is(CharType == char)) { copy(str, stream_); } static if(is(CharType == wchar)) { const buffer = to!wstring(str); copy(buffer, stream_); } static if(is(CharType == dchar)) { const buffer = to!dstring(str); copy(buffer, stream_); } } ///In some cases, we wait for a few next events before emitting. bool needMoreEvents() @safe nothrow { if(events_.length == 0){return true;} const event = events_.peek(); if(event.id == EventID.documentStart){return needEvents(1);} if(event.id == EventID.sequenceStart){return needEvents(2);} if(event.id == EventID.mappingStart) {return needEvents(3);} return false; } ///Determines if we need specified number of more events. bool needEvents(in uint count) @safe nothrow { int level; foreach(const event; events_.range) { if(event.id.among!(EventID.documentStart, EventID.sequenceStart, EventID.mappingStart)) {++level;} else if(event.id.among!(EventID.documentEnd, EventID.sequenceEnd, EventID.mappingEnd)) {--level;} else if(event.id == EventID.streamStart){level = -1;} if(level < 0) { return false; } } return events_.length < (count + 1); } ///Increase indentation level. void increaseIndent(const Flag!"flow" flow = No.flow, const bool indentless = false) @safe { indents_ ~= indent_; if(indent_ == -1) { indent_ = flow ? bestIndent_ : 0; } else if(!indentless) { indent_ += bestIndent_; } } ///Determines if the type of current event is as specified. Throws if no event. bool eventTypeIs(in EventID id) const pure @safe in(!event_.isNull, "Expected an event, but no event is available.") { return event_.id == id; } //States. //Stream handlers. ///Handle start of a file/stream. void expectStreamStart() @safe in(eventTypeIs(EventID.streamStart), "Expected streamStart, but got " ~ event_.idString) { writeStreamStart(); nextExpected!"expectDocumentStart!(Yes.first)"(); } ///Expect nothing, throwing if we still have something. void expectNothing() @safe { assert(0, "Expected nothing, but got " ~ event_.idString); } //Document handlers. ///Handle start of a document. void expectDocumentStart(Flag!"first" first)() @safe in(eventTypeIs(EventID.documentStart) || eventTypeIs(EventID.streamEnd), "Expected documentStart or streamEnd, but got " ~ event_.idString) { if(event_.id == EventID.documentStart) { const YAMLVersion = event_.value; auto tagDirectives = event_.tagDirectives; if(openEnded_ && (YAMLVersion !is null || tagDirectives !is null)) { writeIndicator("...", Yes.needWhitespace); writeIndent(); } if(YAMLVersion !is null) { writeVersionDirective(prepareVersion(YAMLVersion)); } if(tagDirectives !is null) { tagDirectives_ = tagDirectives; sort!"icmp(a.handle, b.handle) < 0"(tagDirectives_); foreach(ref pair; tagDirectives_) { writeTagDirective(prepareTagHandle(pair.handle), prepareTagPrefix(pair.prefix)); } } bool eq(ref TagDirective a, ref TagDirective b){return a.handle == b.handle;} //Add any default tag directives that have not been overriden. foreach(ref def; defaultTagDirectives_) { if(!std.algorithm.canFind!eq(tagDirectives_, def)) { tagDirectives_ ~= def; } } const implicit = first && !event_.explicitDocument && !canonical_ && YAMLVersion is null && tagDirectives is null && !checkEmptyDocument(); if(!implicit) { writeIndent(); writeIndicator("---", Yes.needWhitespace); if(canonical_){writeIndent();} } nextExpected!"expectRootNode"(); } else if(event_.id == EventID.streamEnd) { if(openEnded_) { writeIndicator("...", Yes.needWhitespace); writeIndent(); } writeStreamEnd(); nextExpected!"expectNothing"(); } } ///Handle end of a document. void expectDocumentEnd() @safe in(eventTypeIs(EventID.documentEnd), "Expected DocumentEnd, but got " ~ event_.idString) { writeIndent(); if(event_.explicitDocument) { writeIndicator("...", Yes.needWhitespace); writeIndent(); } nextExpected!"expectDocumentStart!(No.first)"(); } ///Handle the root node of a document. void expectRootNode() @safe { pushState!"expectDocumentEnd"(); expectNode(Context.root); } ///Handle a mapping node. // //Params: simpleKey = Are we in a simple key? void expectMappingNode(const bool simpleKey = false) @safe { expectNode(simpleKey ? Context.mappingSimpleKey : Context.mappingNoSimpleKey); } ///Handle a sequence node. void expectSequenceNode() @safe { expectNode(Context.sequence); } ///Handle a new node. Context specifies where in the document we are. void expectNode(const Context context) @safe { context_ = context; const flowCollection = event_.collectionStyle == CollectionStyle.flow; switch(event_.id) { case EventID.alias_: expectAlias(); break; case EventID.scalar: processAnchor("&"); processTag(); expectScalar(); break; case EventID.sequenceStart: processAnchor("&"); processTag(); if(flowLevel_ > 0 || canonical_ || flowCollection || checkEmptySequence()) { expectFlowSequence(); } else { expectBlockSequence(); } break; case EventID.mappingStart: processAnchor("&"); processTag(); if(flowLevel_ > 0 || canonical_ || flowCollection || checkEmptyMapping()) { expectFlowMapping(); } else { expectBlockMapping(); } break; default: assert(0, "Expected alias_, scalar, sequenceStart or " ~ "mappingStart, but got: " ~ event_.idString); } } ///Handle an alias. void expectAlias() @safe in(event_.anchor != "", "Anchor is not specified for alias") { processAnchor("*"); nextExpected(popState()); } ///Handle a scalar. void expectScalar() @safe { increaseIndent(Yes.flow); processScalar(); indent_ = popIndent(); nextExpected(popState()); } //Flow sequence handlers. ///Handle a flow sequence. void expectFlowSequence() @safe { writeIndicator("[", Yes.needWhitespace, Yes.whitespace); ++flowLevel_; increaseIndent(Yes.flow); nextExpected!"expectFlowSequenceItem!(Yes.first)"(); } ///Handle a flow sequence item. void expectFlowSequenceItem(Flag!"first" first)() @safe { if(event_.id == EventID.sequenceEnd) { indent_ = popIndent(); --flowLevel_; static if(!first) if(canonical_) { writeIndicator(",", No.needWhitespace); writeIndent(); } writeIndicator("]", No.needWhitespace); nextExpected(popState()); return; } static if(!first){writeIndicator(",", No.needWhitespace);} if(canonical_ || column_ > bestWidth_){writeIndent();} pushState!"expectFlowSequenceItem!(No.first)"(); expectSequenceNode(); } //Flow mapping handlers. ///Handle a flow mapping. void expectFlowMapping() @safe { writeIndicator("{", Yes.needWhitespace, Yes.whitespace); ++flowLevel_; increaseIndent(Yes.flow); nextExpected!"expectFlowMappingKey!(Yes.first)"(); } ///Handle a key in a flow mapping. void expectFlowMappingKey(Flag!"first" first)() @safe { if(event_.id == EventID.mappingEnd) { indent_ = popIndent(); --flowLevel_; static if (!first) if(canonical_) { writeIndicator(",", No.needWhitespace); writeIndent(); } writeIndicator("}", No.needWhitespace); nextExpected(popState()); return; } static if(!first){writeIndicator(",", No.needWhitespace);} if(canonical_ || column_ > bestWidth_){writeIndent();} if(!canonical_ && checkSimpleKey()) { pushState!"expectFlowMappingSimpleValue"(); expectMappingNode(true); return; } writeIndicator("?", Yes.needWhitespace); pushState!"expectFlowMappingValue"(); expectMappingNode(); } ///Handle a simple value in a flow mapping. void expectFlowMappingSimpleValue() @safe { writeIndicator(":", No.needWhitespace); pushState!"expectFlowMappingKey!(No.first)"(); expectMappingNode(); } ///Handle a complex value in a flow mapping. void expectFlowMappingValue() @safe { if(canonical_ || column_ > bestWidth_){writeIndent();} writeIndicator(":", Yes.needWhitespace); pushState!"expectFlowMappingKey!(No.first)"(); expectMappingNode(); } //Block sequence handlers. ///Handle a block sequence. void expectBlockSequence() @safe { const indentless = (context_ == Context.mappingNoSimpleKey || context_ == Context.mappingSimpleKey) && !indentation_; increaseIndent(No.flow, indentless); nextExpected!"expectBlockSequenceItem!(Yes.first)"(); } ///Handle a block sequence item. void expectBlockSequenceItem(Flag!"first" first)() @safe { static if(!first) if(event_.id == EventID.sequenceEnd) { indent_ = popIndent(); nextExpected(popState()); return; } writeIndent(); writeIndicator("-", Yes.needWhitespace, No.whitespace, Yes.indentation); pushState!"expectBlockSequenceItem!(No.first)"(); expectSequenceNode(); } //Block mapping handlers. ///Handle a block mapping. void expectBlockMapping() @safe { increaseIndent(No.flow); nextExpected!"expectBlockMappingKey!(Yes.first)"(); } ///Handle a key in a block mapping. void expectBlockMappingKey(Flag!"first" first)() @safe { static if(!first) if(event_.id == EventID.mappingEnd) { indent_ = popIndent(); nextExpected(popState()); return; } writeIndent(); if(checkSimpleKey()) { pushState!"expectBlockMappingSimpleValue"(); expectMappingNode(true); return; } writeIndicator("?", Yes.needWhitespace, No.whitespace, Yes.indentation); pushState!"expectBlockMappingValue"(); expectMappingNode(); } ///Handle a simple value in a block mapping. void expectBlockMappingSimpleValue() @safe { writeIndicator(":", No.needWhitespace); pushState!"expectBlockMappingKey!(No.first)"(); expectMappingNode(); } ///Handle a complex value in a block mapping. void expectBlockMappingValue() @safe { writeIndent(); writeIndicator(":", Yes.needWhitespace, No.whitespace, Yes.indentation); pushState!"expectBlockMappingKey!(No.first)"(); expectMappingNode(); } //Checkers. ///Check if an empty sequence is next. bool checkEmptySequence() const @safe pure nothrow { return event_.id == EventID.sequenceStart && events_.length > 0 && events_.peek().id == EventID.sequenceEnd; } ///Check if an empty mapping is next. bool checkEmptyMapping() const @safe pure nothrow { return event_.id == EventID.mappingStart && events_.length > 0 && events_.peek().id == EventID.mappingEnd; } ///Check if an empty document is next. bool checkEmptyDocument() const @safe pure nothrow { if(event_.id != EventID.documentStart || events_.length == 0) { return false; } const event = events_.peek(); const emptyScalar = event.id == EventID.scalar && (event.anchor is null) && (event.tag is null) && event.implicit && event.value == ""; return emptyScalar; } ///Check if a simple key is next. bool checkSimpleKey() @safe { uint length; const id = event_.id; const scalar = id == EventID.scalar; const collectionStart = id == EventID.mappingStart || id == EventID.sequenceStart; if((id == EventID.alias_ || scalar || collectionStart) && (event_.anchor !is null)) { if(preparedAnchor_ is null) { preparedAnchor_ = prepareAnchor(event_.anchor); } length += preparedAnchor_.length; } if((scalar || collectionStart) && (event_.tag !is null)) { if(preparedTag_ is null){preparedTag_ = prepareTag(event_.tag);} length += preparedTag_.length; } if(scalar) { if(analysis_.flags.isNull){analysis_ = analyzeScalar(event_.value);} length += analysis_.scalar.length; } if(length >= 128){return false;} return id == EventID.alias_ || (scalar && !analysis_.flags.empty && !analysis_.flags.multiline) || checkEmptySequence() || checkEmptyMapping(); } ///Process and write a scalar. void processScalar() @safe { if(analysis_.flags.isNull){analysis_ = analyzeScalar(event_.value);} if(style_ == ScalarStyle.invalid) { style_ = chooseScalarStyle(); } //if(analysis_.flags.multiline && (context_ != Context.mappingSimpleKey) && // ([ScalarStyle.invalid, ScalarStyle.plain, ScalarStyle.singleQuoted, ScalarStyle.doubleQuoted) // .canFind(style_)) //{ // writeIndent(); //} auto writer = ScalarWriter!(Range, CharType)(&this, analysis_.scalar, context_ != Context.mappingSimpleKey); final switch(style_) { case ScalarStyle.invalid: assert(false); case ScalarStyle.doubleQuoted: writer.writeDoubleQuoted(); break; case ScalarStyle.singleQuoted: writer.writeSingleQuoted(); break; case ScalarStyle.folded: writer.writeFolded(); break; case ScalarStyle.literal: writer.writeLiteral(); break; case ScalarStyle.plain: writer.writePlain(); break; } analysis_.flags.isNull = true; style_ = ScalarStyle.invalid; } ///Process and write an anchor/alias. void processAnchor(const string indicator) @safe { if(event_.anchor is null) { preparedAnchor_ = null; return; } if(preparedAnchor_ is null) { preparedAnchor_ = prepareAnchor(event_.anchor); } if(preparedAnchor_ !is null && preparedAnchor_ != "") { writeIndicator(indicator, Yes.needWhitespace); writeString(preparedAnchor_); } preparedAnchor_ = null; } ///Process and write a tag. void processTag() @safe { string tag = event_.tag; if(event_.id == EventID.scalar) { if(style_ == ScalarStyle.invalid){style_ = chooseScalarStyle();} if((!canonical_ || (tag is null)) && ((tag == "tag:yaml.org,2002:str") || (style_ == ScalarStyle.plain ? event_.implicit : !event_.implicit && (tag is null)))) { preparedTag_ = null; return; } if(event_.implicit && (tag is null)) { tag = "!"; preparedTag_ = null; } } else if((!canonical_ || (tag is null)) && event_.implicit) { preparedTag_ = null; return; } assert(tag != "", "Tag is not specified"); if(preparedTag_ is null){preparedTag_ = prepareTag(tag);} if(preparedTag_ !is null && preparedTag_ != "") { writeIndicator(preparedTag_, Yes.needWhitespace); } preparedTag_ = null; } ///Determine style to write the current scalar in. ScalarStyle chooseScalarStyle() @safe { if(analysis_.flags.isNull){analysis_ = analyzeScalar(event_.value);} const style = event_.scalarStyle; const invalidOrPlain = style == ScalarStyle.invalid || style == ScalarStyle.plain; const block = style == ScalarStyle.literal || style == ScalarStyle.folded; const singleQuoted = style == ScalarStyle.singleQuoted; const doubleQuoted = style == ScalarStyle.doubleQuoted; const allowPlain = flowLevel_ > 0 ? analysis_.flags.allowFlowPlain : analysis_.flags.allowBlockPlain; //simple empty or multiline scalars can't be written in plain style const simpleNonPlain = (context_ == Context.mappingSimpleKey) && (analysis_.flags.empty || analysis_.flags.multiline); if(doubleQuoted || canonical_) { return ScalarStyle.doubleQuoted; } if(invalidOrPlain && event_.implicit && !simpleNonPlain && allowPlain) { return ScalarStyle.plain; } if(block && flowLevel_ == 0 && context_ != Context.mappingSimpleKey && analysis_.flags.allowBlock) { return style; } if((invalidOrPlain || singleQuoted) && analysis_.flags.allowSingleQuoted && !(context_ == Context.mappingSimpleKey && analysis_.flags.multiline)) { return ScalarStyle.singleQuoted; } return ScalarStyle.doubleQuoted; } ///Prepare YAML version string for output. static string prepareVersion(const string YAMLVersion) @safe in(YAMLVersion.split(".")[0] == "1", "Unsupported YAML version: " ~ YAMLVersion) { return YAMLVersion; } ///Encode an Unicode character for tag directive and write it to writer. static void encodeChar(Writer)(ref Writer writer, in dchar c) @safe { char[4] data; const bytes = encode(data, c); //For each byte add string in format %AB , where AB are hex digits of the byte. foreach(const char b; data[0 .. bytes]) { formattedWrite(writer, "%%%02X", cast(ubyte)b); } } ///Prepare tag directive handle for output. static string prepareTagHandle(const string handle) @safe in(handle != "", "Tag handle must not be empty") in(handle.drop(1).dropBack(1).all!(c => isAlphaNum(c) || c.among!('-', '_')), "Tag handle contains invalid characters") { return handle; } ///Prepare tag directive prefix for output. static string prepareTagPrefix(const string prefix) @safe in(prefix != "", "Tag prefix must not be empty") { auto appender = appender!string(); const int offset = prefix[0] == '!'; size_t start, end; foreach(const size_t i, const dchar c; prefix) { const size_t idx = i + offset; if(isAlphaNum(c) || c.among!('-', ';', '/', '?', ':', '@', '&', '=', '+', '$', ',', '_', '.', '!', '~', '*', '\\', '\'', '(', ')', '[', ']', '%')) { end = idx + 1; continue; } if(start < idx){appender.put(prefix[start .. idx]);} start = end = idx + 1; encodeChar(appender, c); } end = min(end, prefix.length); if(start < end){appender.put(prefix[start .. end]);} return appender.data; } ///Prepare tag for output. string prepareTag(in string tag) @safe in(tag != "", "Tag must not be empty") { string tagString = tag; if (tagString == "!") return "!"; string handle; string suffix = tagString; //Sort lexicographically by prefix. sort!"icmp(a.prefix, b.prefix) < 0"(tagDirectives_); foreach(ref pair; tagDirectives_) { auto prefix = pair.prefix; if(tagString.startsWith(prefix) && (prefix != "!" || prefix.length < tagString.length)) { handle = pair.handle; suffix = tagString[prefix.length .. $]; } } auto appender = appender!string(); appender.put(handle !is null && handle != "" ? handle : "!<"); size_t start, end; foreach(const dchar c; suffix) { if(isAlphaNum(c) || c.among!('-', ';', '/', '?', ':', '@', '&', '=', '+', '$', ',', '_', '.', '~', '*', '\\', '\'', '(', ')', '[', ']') || (c == '!' && handle != "!")) { ++end; continue; } if(start < end){appender.put(suffix[start .. end]);} start = end = end + 1; encodeChar(appender, c); } if(start < end){appender.put(suffix[start .. end]);} if(handle is null || handle == ""){appender.put(">");} return appender.data; } ///Prepare anchor for output. static string prepareAnchor(const string anchor) @safe in(anchor != "", "Anchor must not be empty") in(anchor.all!(c => isAlphaNum(c) || c.among!('-', '_')), "Anchor contains invalid characters") { return anchor; } ///Analyze specifed scalar and return the analysis result. static ScalarAnalysis analyzeScalar(string scalar) @safe { ScalarAnalysis analysis; analysis.flags.isNull = false; analysis.scalar = scalar; //Empty scalar is a special case. if(scalar is null || scalar == "") { with(ScalarAnalysis.AnalysisFlags) analysis.flags = empty | allowBlockPlain | allowSingleQuoted | allowDoubleQuoted; return analysis; } //Indicators and special characters (All false by default). bool blockIndicators, flowIndicators, lineBreaks, specialCharacters; //Important whitespace combinations (All false by default). bool leadingSpace, leadingBreak, trailingSpace, trailingBreak, breakSpace, spaceBreak; //Check document indicators. if(scalar.startsWith("---", "...")) { blockIndicators = flowIndicators = true; } //First character or preceded by a whitespace. bool preceededByWhitespace = true; //Last character or followed by a whitespace. bool followedByWhitespace = scalar.length == 1 || scalar[1].among!(' ', '\t', '\0', '\n', '\r', '\u0085', '\u2028', '\u2029'); //The previous character is a space/break (false by default). bool previousSpace, previousBreak; foreach(const size_t index, const dchar c; scalar) { //Check for indicators. if(index == 0) { //Leading indicators are special characters. if(c.isSpecialChar) { flowIndicators = blockIndicators = true; } if(':' == c || '?' == c) { flowIndicators = true; if(followedByWhitespace){blockIndicators = true;} } if(c == '-' && followedByWhitespace) { flowIndicators = blockIndicators = true; } } else { //Some indicators cannot appear within a scalar as well. if(c.isFlowIndicator){flowIndicators = true;} if(c == ':') { flowIndicators = true; if(followedByWhitespace){blockIndicators = true;} } if(c == '#' && preceededByWhitespace) { flowIndicators = blockIndicators = true; } } //Check for line breaks, special, and unicode characters. if(c.isNewLine){lineBreaks = true;} if(!(c == '\n' || (c >= '\x20' && c <= '\x7E')) && !((c == '\u0085' || (c >= '\xA0' && c <= '\uD7FF') || (c >= '\uE000' && c <= '\uFFFD')) && c != '\uFEFF')) { specialCharacters = true; } //Detect important whitespace combinations. if(c == ' ') { if(index == 0){leadingSpace = true;} if(index == scalar.length - 1){trailingSpace = true;} if(previousBreak){breakSpace = true;} previousSpace = true; previousBreak = false; } else if(c.isNewLine) { if(index == 0){leadingBreak = true;} if(index == scalar.length - 1){trailingBreak = true;} if(previousSpace){spaceBreak = true;} previousSpace = false; previousBreak = true; } else { previousSpace = previousBreak = false; } //Prepare for the next character. preceededByWhitespace = c.isSpace != 0; followedByWhitespace = index + 2 >= scalar.length || scalar[index + 2].isSpace; } with(ScalarAnalysis.AnalysisFlags) { //Let's decide what styles are allowed. analysis.flags |= allowFlowPlain | allowBlockPlain | allowSingleQuoted | allowDoubleQuoted | allowBlock; //Leading and trailing whitespaces are bad for plain scalars. if(leadingSpace || leadingBreak || trailingSpace || trailingBreak) { analysis.flags &= ~(allowFlowPlain | allowBlockPlain); } //We do not permit trailing spaces for block scalars. if(trailingSpace) { analysis.flags &= ~allowBlock; } //Spaces at the beginning of a new line are only acceptable for block //scalars. if(breakSpace) { analysis.flags &= ~(allowFlowPlain | allowBlockPlain | allowSingleQuoted); } //Spaces followed by breaks, as well as special character are only //allowed for double quoted scalars. if(spaceBreak || specialCharacters) { analysis.flags &= ~(allowFlowPlain | allowBlockPlain | allowSingleQuoted | allowBlock); } //Although the plain scalar writer supports breaks, we never emit //multiline plain scalars. if(lineBreaks) { analysis.flags &= ~(allowFlowPlain | allowBlockPlain); analysis.flags |= multiline; } //Flow indicators are forbidden for flow plain scalars. if(flowIndicators) { analysis.flags &= ~allowFlowPlain; } //Block indicators are forbidden for block plain scalars. if(blockIndicators) { analysis.flags &= ~allowBlockPlain; } } return analysis; } @safe unittest { with(analyzeScalar("").flags) { // workaround for empty being std.range.primitives.empty here alias empty = ScalarAnalysis.AnalysisFlags.empty; assert(empty && allowBlockPlain && allowSingleQuoted && allowDoubleQuoted); } with(analyzeScalar("a").flags) { assert(allowFlowPlain && allowBlockPlain && allowSingleQuoted && allowDoubleQuoted && allowBlock); } with(analyzeScalar(" ").flags) { assert(allowSingleQuoted && allowDoubleQuoted); } with(analyzeScalar(" a").flags) { assert(allowSingleQuoted && allowDoubleQuoted); } with(analyzeScalar("a ").flags) { assert(allowSingleQuoted && allowDoubleQuoted); } with(analyzeScalar("\na").flags) { assert(allowSingleQuoted && allowDoubleQuoted); } with(analyzeScalar("a\n").flags) { assert(allowSingleQuoted && allowDoubleQuoted); } with(analyzeScalar("\n").flags) { assert(multiline && allowSingleQuoted && allowDoubleQuoted && allowBlock); } with(analyzeScalar(" \n").flags) { assert(multiline && allowDoubleQuoted); } with(analyzeScalar("\n a").flags) { assert(multiline && allowDoubleQuoted && allowBlock); } } //Writers. ///Start the YAML stream (write the unicode byte order mark). void writeStreamStart() @safe { //Write BOM (except for UTF-8) static if(is(CharType == wchar) || is(CharType == dchar)) { stream_.put(cast(CharType)'\uFEFF'); } } ///End the YAML stream. void writeStreamEnd() @safe {} ///Write an indicator (e.g. ":", "[", ">", etc.). void writeIndicator(const scope char[] indicator, const Flag!"needWhitespace" needWhitespace, const Flag!"whitespace" whitespace = No.whitespace, const Flag!"indentation" indentation = No.indentation) @safe { const bool prefixSpace = !whitespace_ && needWhitespace; whitespace_ = whitespace; indentation_ = indentation_ && indentation; openEnded_ = false; column_ += indicator.length; if(prefixSpace) { ++column_; writeString(" "); } writeString(indicator); } ///Write indentation. void writeIndent() @safe { const indent = indent_ == -1 ? 0 : indent_; if(!indentation_ || column_ > indent || (column_ == indent && !whitespace_)) { writeLineBreak(); } if(column_ < indent) { whitespace_ = true; //Used to avoid allocation of arbitrary length strings. static immutable spaces = " "; size_t numSpaces = indent - column_; column_ = indent; while(numSpaces >= spaces.length) { writeString(spaces); numSpaces -= spaces.length; } writeString(spaces[0 .. numSpaces]); } } ///Start new line. void writeLineBreak(const scope char[] data = null) @safe { whitespace_ = indentation_ = true; ++line_; column_ = 0; writeString(data is null ? lineBreak(bestLineBreak_) : data); } ///Write a YAML version directive. void writeVersionDirective(const string versionText) @safe { writeString("%YAML "); writeString(versionText); writeLineBreak(); } ///Write a tag directive. void writeTagDirective(const string handle, const string prefix) @safe { writeString("%TAG "); writeString(handle); writeString(" "); writeString(prefix); writeLineBreak(); } void nextExpected(string D)() @safe { state_ = mixin("function(typeof(this)* self) { self."~D~"(); }"); } void nextExpected(EmitterFunction f) @safe { state_ = f; } void callNext() @safe { state_(&this); } } private: ///RAII struct used to write out scalar values. struct ScalarWriter(Range, CharType) { invariant() { assert(emitter_.bestIndent_ > 0 && emitter_.bestIndent_ < 10, "Emitter bestIndent must be 1 to 9 for one-character indent hint"); } private: @disable int opCmp(ref Emitter!(Range, CharType)); @disable bool opEquals(ref Emitter!(Range, CharType)); ///Used as "null" UTF-32 character. static immutable dcharNone = dchar.max; ///Emitter used to emit the scalar. Emitter!(Range, CharType)* emitter_; ///UTF-8 encoded text of the scalar to write. string text_; ///Can we split the scalar into multiple lines? bool split_; ///Are we currently going over spaces in the text? bool spaces_; ///Are we currently going over line breaks in the text? bool breaks_; ///Start and end byte of the text range we're currently working with. size_t startByte_, endByte_; ///End byte of the text range including the currently processed character. size_t nextEndByte_; ///Start and end character of the text range we're currently working with. long startChar_, endChar_; public: ///Construct a ScalarWriter using emitter to output text. this(Emitter!(Range, CharType)* emitter, string text, const bool split = true) @safe nothrow { emitter_ = emitter; text_ = text; split_ = split; } ///Write text as single quoted scalar. void writeSingleQuoted() @safe { emitter_.writeIndicator("\'", Yes.needWhitespace); spaces_ = breaks_ = false; resetTextPosition(); do { const dchar c = nextChar(); if(spaces_) { if(c != ' ' && tooWide() && split_ && startByte_ != 0 && endByte_ != text_.length) { writeIndent(Flag!"ResetSpace".no); updateRangeStart(); } else if(c != ' ') { writeCurrentRange(Flag!"UpdateColumn".yes); } } else if(breaks_) { if(!c.isNewLine) { writeStartLineBreak(); writeLineBreaks(); emitter_.writeIndent(); } } else if((c == dcharNone || c == '\'' || c == ' ' || c.isNewLine) && startChar_ < endChar_) { writeCurrentRange(Flag!"UpdateColumn".yes); } if(c == '\'') { emitter_.column_ += 2; emitter_.writeString("\'\'"); startByte_ = endByte_ + 1; startChar_ = endChar_ + 1; } updateBreaks(c, Flag!"UpdateSpaces".yes); }while(endByte_ < text_.length); emitter_.writeIndicator("\'", No.needWhitespace); } ///Write text as double quoted scalar. void writeDoubleQuoted() @safe { resetTextPosition(); emitter_.writeIndicator("\"", Yes.needWhitespace); do { const dchar c = nextChar(); //handle special characters if(c == dcharNone || c.among!('\"', '\\', '\u0085', '\u2028', '\u2029', '\uFEFF') || !((c >= '\x20' && c <= '\x7E') || ((c >= '\xA0' && c <= '\uD7FF') || (c >= '\uE000' && c <= '\uFFFD')))) { if(startChar_ < endChar_) { writeCurrentRange(Flag!"UpdateColumn".yes); } if(c != dcharNone) { auto appender = appender!string(); if(const dchar es = toEscape(c)) { appender.put('\\'); appender.put(es); } else { //Write an escaped Unicode character. const format = c <= 255 ? "\\x%02X": c <= 65535 ? "\\u%04X": "\\U%08X"; formattedWrite(appender, format, cast(uint)c); } emitter_.column_ += appender.data.length; emitter_.writeString(appender.data); startChar_ = endChar_ + 1; startByte_ = nextEndByte_; } } if((endByte_ > 0 && endByte_ < text_.length - strideBack(text_, text_.length)) && (c == ' ' || startChar_ >= endChar_) && (emitter_.column_ + endChar_ - startChar_ > emitter_.bestWidth_) && split_) { //text_[2:1] is ok in Python but not in D, so we have to use min() emitter_.writeString(text_[min(startByte_, endByte_) .. endByte_]); emitter_.writeString("\\"); emitter_.column_ += startChar_ - endChar_ + 1; startChar_ = max(startChar_, endChar_); startByte_ = max(startByte_, endByte_); writeIndent(Flag!"ResetSpace".yes); if(charAtStart() == ' ') { emitter_.writeString("\\"); ++emitter_.column_; } } }while(endByte_ < text_.length); emitter_.writeIndicator("\"", No.needWhitespace); } ///Write text as folded block scalar. void writeFolded() @safe { initBlock('>'); bool leadingSpace = true; spaces_ = false; breaks_ = true; resetTextPosition(); do { const dchar c = nextChar(); if(breaks_) { if(!c.isNewLine) { if(!leadingSpace && c != dcharNone && c != ' ') { writeStartLineBreak(); } leadingSpace = (c == ' '); writeLineBreaks(); if(c != dcharNone){emitter_.writeIndent();} } } else if(spaces_) { if(c != ' ' && tooWide()) { writeIndent(Flag!"ResetSpace".no); updateRangeStart(); } else if(c != ' ') { writeCurrentRange(Flag!"UpdateColumn".yes); } } else if(c == dcharNone || c.isNewLine || c == ' ') { writeCurrentRange(Flag!"UpdateColumn".yes); if(c == dcharNone){emitter_.writeLineBreak();} } updateBreaks(c, Flag!"UpdateSpaces".yes); }while(endByte_ < text_.length); } ///Write text as literal block scalar. void writeLiteral() @safe { initBlock('|'); breaks_ = true; resetTextPosition(); do { const dchar c = nextChar(); if(breaks_) { if(!c.isNewLine) { writeLineBreaks(); if(c != dcharNone){emitter_.writeIndent();} } } else if(c == dcharNone || c.isNewLine) { writeCurrentRange(Flag!"UpdateColumn".no); if(c == dcharNone){emitter_.writeLineBreak();} } updateBreaks(c, Flag!"UpdateSpaces".no); }while(endByte_ < text_.length); } ///Write text as plain scalar. void writePlain() @safe { if(emitter_.context_ == Emitter!(Range, CharType).Context.root){emitter_.openEnded_ = true;} if(text_ == ""){return;} if(!emitter_.whitespace_) { ++emitter_.column_; emitter_.writeString(" "); } emitter_.whitespace_ = emitter_.indentation_ = false; spaces_ = breaks_ = false; resetTextPosition(); do { const dchar c = nextChar(); if(spaces_) { if(c != ' ' && tooWide() && split_) { writeIndent(Flag!"ResetSpace".yes); updateRangeStart(); } else if(c != ' ') { writeCurrentRange(Flag!"UpdateColumn".yes); } } else if(breaks_) { if(!c.isNewLine) { writeStartLineBreak(); writeLineBreaks(); writeIndent(Flag!"ResetSpace".yes); } } else if(c == dcharNone || c.isNewLine || c == ' ') { writeCurrentRange(Flag!"UpdateColumn".yes); } updateBreaks(c, Flag!"UpdateSpaces".yes); }while(endByte_ < text_.length); } private: ///Get next character and move end of the text range to it. @property dchar nextChar() pure @safe { ++endChar_; endByte_ = nextEndByte_; if(endByte_ >= text_.length){return dcharNone;} const c = text_[nextEndByte_]; //c is ascii, no need to decode. if(c < 0x80) { ++nextEndByte_; return c; } return decode(text_, nextEndByte_); } ///Get character at start of the text range. @property dchar charAtStart() const pure @safe { size_t idx = startByte_; return decode(text_, idx); } ///Is the current line too wide? @property bool tooWide() const pure @safe nothrow { return startChar_ + 1 == endChar_ && emitter_.column_ > emitter_.bestWidth_; } ///Determine hints (indicators) for block scalar. size_t determineBlockHints(char[] hints, uint bestIndent) const pure @safe { size_t hintsIdx; if(text_.length == 0) return hintsIdx; dchar lastChar(const string str, ref size_t end) { size_t idx = end = end - strideBack(str, end); return decode(text_, idx); } size_t end = text_.length; const last = lastChar(text_, end); const secondLast = end > 0 ? lastChar(text_, end) : 0; if(text_[0].isNewLine || text_[0] == ' ') { hints[hintsIdx++] = cast(char)('0' + bestIndent); } if(!last.isNewLine) { hints[hintsIdx++] = '-'; } else if(std.utf.count(text_) == 1 || secondLast.isNewLine) { hints[hintsIdx++] = '+'; } return hintsIdx; } ///Initialize for block scalar writing with specified indicator. void initBlock(const char indicator) @safe { char[4] hints; hints[0] = indicator; const hintsLength = 1 + determineBlockHints(hints[1 .. $], emitter_.bestIndent_); emitter_.writeIndicator(hints[0 .. hintsLength], Yes.needWhitespace); if(hints.length > 0 && hints[$ - 1] == '+') { emitter_.openEnded_ = true; } emitter_.writeLineBreak(); } ///Write out the current text range. void writeCurrentRange(const Flag!"UpdateColumn" updateColumn) @safe { emitter_.writeString(text_[startByte_ .. endByte_]); if(updateColumn){emitter_.column_ += endChar_ - startChar_;} updateRangeStart(); } ///Write line breaks in the text range. void writeLineBreaks() @safe { foreach(const dchar br; text_[startByte_ .. endByte_]) { if(br == '\n'){emitter_.writeLineBreak();} else { char[4] brString; const bytes = encode(brString, br); emitter_.writeLineBreak(brString[0 .. bytes]); } } updateRangeStart(); } ///Write line break if start of the text range is a newline. void writeStartLineBreak() @safe { if(charAtStart == '\n'){emitter_.writeLineBreak();} } ///Write indentation, optionally resetting whitespace/indentation flags. void writeIndent(const Flag!"ResetSpace" resetSpace) @safe { emitter_.writeIndent(); if(resetSpace) { emitter_.whitespace_ = emitter_.indentation_ = false; } } ///Move start of text range to its end. void updateRangeStart() pure @safe nothrow { startByte_ = endByte_; startChar_ = endChar_; } ///Update the line breaks_ flag, optionally updating the spaces_ flag. void updateBreaks(in dchar c, const Flag!"UpdateSpaces" updateSpaces) pure @safe { if(c == dcharNone){return;} breaks_ = (c.isNewLine != 0); if(updateSpaces){spaces_ = c == ' ';} } ///Move to the beginning of text. void resetTextPosition() pure @safe nothrow { startByte_ = endByte_ = nextEndByte_ = 0; startChar_ = endChar_ = -1; } }
D
// PERMUTE_ARGS: // EXTRA_SOURCES: imports/mangle10077.d /***************************************************/ // 10077 - pragma(mangle) pragma(mangle, "_test10077a_") int test10077a; static assert(test10077a.mangleof == "_test10077a_"); __gshared pragma(mangle, "_test10077b_") ubyte test10077b; static assert(test10077b.mangleof == "_test10077b_"); pragma(mangle, "_test10077c_") void test10077c() {} static assert(test10077c.mangleof == "_test10077c_"); pragma(mangle, "_test10077f_") __gshared char test10077f; static assert(test10077f.mangleof == "_test10077f_"); pragma(mangle, "_test10077g_") @system { void test10077g() {} } static assert(test10077g.mangleof == "_test10077g_"); template getModuleInfo(alias mod) { pragma(mangle, "_D"~mod.mangleof~"12__ModuleInfoZ") static __gshared extern ModuleInfo mi; enum getModuleInfo = &mi; } void test10077h() { assert(getModuleInfo!(object).name == "object"); } //UTF-8 chars __gshared extern pragma(mangle, "test_эльфийские_письмена_9") ubyte test10077i_evar; void test10077i() { import imports.mangle10077; setTest10077i(); assert(test10077i_evar == 42); } /***************************************************/ // 13050 void func13050(int); template decl13050(Arg) { void decl13050(Arg); } template problem13050(Arg) { pragma(mangle, "foobar") void problem13050(Arg); } template workaround13050(Arg) { pragma(mangle, "foobar") void func(Arg); alias workaround13050 = func; } static assert(is(typeof(&func13050) == void function(int))); static assert(is(typeof(&decl13050!int) == void function(int))); static assert(is(typeof(&problem13050!int) == void function(int))); static assert(is(typeof(&workaround13050!int) == void function(int))); /***************************************************/ // 2774 int foo2774(int n) { return 0; } static assert(foo2774.mangleof == "_D6mangle7foo2774FiZi"); class C2774 { int foo2774() { return 0; } } static assert(C2774.foo2774.mangleof == "_D6mangle5C27747foo2774MFZi"); template TFoo2774(T) {} static assert(TFoo2774!int.mangleof == "6mangle15__T8TFoo2774TiZ"); void test2774() { int foo2774(int n) { return 0; } static assert(foo2774.mangleof == "_D6mangle8test2774FZ7foo2774MFiZi"); } /*******************************************/ // 8847 auto S8847() { static struct Result { inout(Result) get() inout { return this; } } return Result(); } void test8847a() { auto a = S8847(); auto b = a.get(); alias typeof(a) A; alias typeof(b) B; assert(is(A == B), A.stringof~ " is different from "~B.stringof); } // -------- enum result8847a = "S6mangle9iota8847aFZ6Result"; enum result8847b = "S6mangle9iota8847bFZ4iotaMFZ6Result"; enum result8847c = "C6mangle9iota8847cFZ6Result"; enum result8847d = "C6mangle9iota8847dFZ4iotaMFZ6Result"; auto iota8847a() { static struct Result { this(int) {} inout(Result) test() inout { return cast(inout)Result(0); } } static assert(Result.mangleof == result8847a); return Result.init; } auto iota8847b() { auto iota() { static struct Result { this(int) {} inout(Result) test() inout { return cast(inout)Result(0); } } static assert(Result.mangleof == result8847b); return Result.init; } return iota(); } auto iota8847c() { static class Result { this(int) {} inout(Result) test() inout { return cast(inout)new Result(0); } } static assert(Result.mangleof == result8847c); return Result.init; } auto iota8847d() { auto iota() { static class Result { this(int) {} inout(Result) test() inout { return cast(inout)new Result(0); } } static assert(Result.mangleof == result8847d); return Result.init; } return iota(); } void test8847b() { static assert(typeof(iota8847a().test()).mangleof == result8847a); static assert(typeof(iota8847b().test()).mangleof == result8847b); static assert(typeof(iota8847c().test()).mangleof == result8847c); static assert(typeof(iota8847d().test()).mangleof == result8847d); } // -------- struct Test8847 { enum result1 = "S6mangle8Test88478__T3fooZ3fooMFZ6Result"; enum result2 = "S6mangle8Test88478__T3fooZ3fooMxFiZ6Result"; auto foo()() { static struct Result { inout(Result) get() inout { return this; } } static assert(Result.mangleof == Test8847.result1); return Result(); } auto foo()(int n) const { static struct Result { inout(Result) get() inout { return this; } } static assert(Result.mangleof == Test8847.result2); return Result(); } } void test8847c() { static assert(typeof(Test8847().foo( ).get()).mangleof == Test8847.result1); static assert(typeof(Test8847().foo(1).get()).mangleof == Test8847.result2); } // -------- void test8847d() { enum resultS = "S6mangle9test8847dFZ3fooMFZ3barMFZ3bazMFZ1S"; enum resultX = "S6mangle9test8847dFZ3fooMFZ1X"; // Return types for test8847d and bar are mangled correctly, // and return types for foo and baz are not mangled correctly. auto foo() { struct X { inout(X) get() inout { return inout(X)(); } } string bar() { auto baz() { struct S { inout(S) get() inout { return inout(S)(); } } return S(); } static assert(typeof(baz() ).mangleof == resultS); static assert(typeof(baz().get()).mangleof == resultS); return ""; } return X(); } static assert(typeof(foo() ).mangleof == resultX); static assert(typeof(foo().get()).mangleof == resultX); } // -------- void test8847e() { enum resultHere = "6mangle"~"9test8847eFZ"~"8__T3fooZ"~"3foo"; enum resultBar = "S"~resultHere~"MFNaNfNgiZ3Bar"; enum resultFoo = "_D"~resultHere~"MFNaNbNiNfNgiZNg"~resultBar; // added 'Nb' // Make template function to infer 'nothrow' attributes auto foo()(inout int) pure @safe { struct Bar {} static assert(Bar.mangleof == resultBar); return inout(Bar)(); } auto bar = foo(0); static assert(typeof(bar).stringof == "Bar"); static assert(typeof(bar).mangleof == resultBar); static assert(foo!().mangleof == resultFoo); } // -------- pure f8847a() { struct S {} return S(); } pure { auto f8847b() { struct S {} return S(); } } static assert(typeof(f8847a()).mangleof == "S6mangle6f8847aFNaZ1S"); static assert(typeof(f8847b()).mangleof == "S6mangle6f8847bFNaZ1S"); /*******************************************/ // 12352 auto bar12352() { struct S { int var; void func() {} } static assert(!__traits(compiles, bar12352.mangleof)); // forward reference to bar static assert(S .mangleof == "S6mangle8bar12352FZ1S"); static assert(S.func.mangleof == "_D6mangle8bar12352FZ1S4funcMFZv"); return S(); } static assert( bar12352 .mangleof == "_D6mangle8bar12352FNaNbNiNfZS6mangle8bar12352FZ1S"); static assert(typeof(bar12352()) .mangleof == "S6mangle8bar12352FZ1S"); static assert(typeof(bar12352()).func.mangleof == "_D6mangle8bar12352FZ1S4funcMFZv"); auto baz12352() { class C { int var; void func() {} } static assert(!__traits(compiles, baz12352.mangleof)); // forward reference to baz static assert(C .mangleof == "C6mangle8baz12352FZ1C"); static assert(C.func.mangleof == "_D6mangle8baz12352FZ1C4funcMFZv"); return new C(); } static assert( baz12352 .mangleof == "_D6mangle8baz12352FNaNbNfZC6mangle8baz12352FZ1C"); static assert(typeof(baz12352()) .mangleof == "C6mangle8baz12352FZ1C"); static assert(typeof(baz12352()).func.mangleof == "_D6mangle8baz12352FZ1C4funcMFZv"); /*******************************************/ // 9525 void f9525(T)(in T*) { } void test9525() { enum result1 = "S6mangle8test9525FZ26__T5test1S136mangle5f9525Z5test1MFZ1S"; enum result2 = "S6mangle8test9525FZ26__T5test2S136mangle5f9525Z5test2MFNaNbZ1S"; void test1(alias a)() { static struct S {} static assert(S.mangleof == result1); S s; a(&s); // Error: Cannot convert &S to const(S*) at compile time } static assert((test1!f9525(), true)); void test2(alias a)() pure nothrow { static struct S {} static assert(S.mangleof == result2); S s; a(&s); // Error: Cannot convert &S to const(S*) at compile time } static assert((test2!f9525(), true)); } /******************************************/ // 10249 template Seq10249(T...) { alias Seq10249 = T; } mixin template Func10249(T) { void func10249(T) {} } mixin Func10249!long; mixin Func10249!string; void f10249(long) {} class C10249 { mixin Func10249!long; mixin Func10249!string; static assert(Seq10249!(.func10249)[0].mangleof == "6mangle9func10249"); // <- 9func10249 static assert(Seq10249!( func10249)[0].mangleof == "6mangle6C102499func10249"); // <- 9func10249 static: // necessary to make overloaded symbols accessible via __traits(getOverloads, C10249) void foo(long) {} void foo(string) {} static assert(Seq10249!(foo)[0].mangleof == "6mangle6C102493foo"); // <- _D6mangle6C102493fooFlZv static assert(Seq10249!(__traits(getOverloads, C10249, "foo"))[0].mangleof == "_D6mangle6C102493fooFlZv"); // <- static assert(Seq10249!(__traits(getOverloads, C10249, "foo"))[1].mangleof == "_D6mangle6C102493fooFAyaZv"); // <- void g(string) {} alias bar = .f10249; alias bar = g; static assert(Seq10249!(bar)[0].mangleof == "6mangle6C102493bar"); // <- _D6mangle1fFlZv static assert(Seq10249!(__traits(getOverloads, C10249, "bar"))[0].mangleof == "_D6mangle6f10249FlZv"); // <- static assert(Seq10249!(__traits(getOverloads, C10249, "bar"))[1].mangleof == "_D6mangle6C102491gFAyaZv"); // <- } /*******************************************/ // 11718 struct Ty11718(alias sym) {} auto fn11718(T)(T a) { return Ty11718!(a).mangleof; } auto fn11718(T)() { T a; return Ty11718!(a).mangleof; } void test11718() { string TyName(string tail)() { enum s = "__T7Ty11718" ~ tail; enum int len = s.length; return "S6mangle" ~ len.stringof ~ s; } string fnName(string paramPart)() { enum s = "_D6mangle35__T7fn11718T"~ "S6mangle9test11718FZ1AZ7fn11718"~paramPart~"1a"~ "S6mangle9test11718FZ1A"; enum int len = s.length; return len.stringof ~ s; } enum result1 = TyName!("S" ~ fnName!("F"~"S6mangle9test11718FZ1A"~"Z") ~ "Z") ~ "7Ty11718"; enum result2 = TyName!("S" ~ fnName!("F"~"" ~"Z") ~ "Z") ~ "7Ty11718"; struct A {} static assert(fn11718(A.init) == result1); static assert(fn11718!A() == result2); } /*******************************************/ // 11776 struct S11776(alias fun) { } void test11776() { auto g = () { if (1) return; // fill tf->next if (1) { auto s = S11776!(a => 1)(); static assert(typeof(s).mangleof == "S"~"6mangle"~"56"~( "__T"~"6S11776"~"S42"~("6mangle"~"9test11776"~"FZ"~"9__lambda1MFZ"~"9__lambda1")~"Z" )~"6S11776"); } }; } /***************************************************/ // 12044 struct S12044(T) { void f()() { new T[1]; } bool opEquals(O)(O) { f(); } } void test12044() { () { enum E { e } auto arr = [E.e]; S12044!E s; } (); } /*******************************************/ // 12217 void test12217(int) { static struct S {} void bar() {} int var; template X(T) {} static assert( S.mangleof == "S6mangle9test12217FiZ1S"); static assert( bar.mangleof == "_D6mangle9test12217FiZ3barMFZv"); static assert( var.mangleof == "_D6mangle9test12217FiZ3vari"); static assert(X!int.mangleof == "6mangle9test12217FiZ8__T1XTiZ"); } void test12217() {} /***************************************************/ // 12231 void func12231a()() if (is(typeof({ class C {} static assert(C.mangleof == "C6mangle16__U10func12231aZ10func12231aFZ9__lambda1MFZ1C"); // ### L # }))) {} void func12231b()() if (is(typeof({ class C {} static assert(C.mangleof == "C6mangle16__U10func12231bZ10func12231bFZ9__lambda1MFZ1C"); // L__L L LL })) && is(typeof({ class C {} static assert(C.mangleof == "C6mangle16__U10func12231bZ10func12231bFZ9__lambda2MFZ1C"); // L__L L LL }))) {} void func12231c()() if (is(typeof({ class C {} static assert(C.mangleof == "C6mangle16__U10func12231cZ10func12231cFZ9__lambda1MFZ1C"); // L__L L LL }))) { (){ class C {} static assert(C.mangleof == "C6mangle16__T10func12231cZ10func12231cFZ9__lambda1MFZ1C"); // L__L L LL }(); } void func12231c(X)() if (is(typeof({ class C {} static assert(C.mangleof == "C6mangle20__U10func12231cTAyaZ10func12231cFZ9__lambda1MFZ1C"); // L__L L___L LL }))) { (){ class C {} static assert(C.mangleof == "C6mangle20__T10func12231cTAyaZ10func12231cFZ9__lambda1MFZ1C"); // L__L L___L LL }(); } void test12231() { func12231a(); func12231b(); func12231c(); func12231c!string(); } /***************************************************/ int test2a(scope int a) { return a; } static assert(test2a.mangleof == "_D6mangle6test2aFiZi"); /***************************************************/ class CC { int* p; int* member() scope { return p; } } static assert(CC.member.mangleof == "_D6mangle2CC6memberMFNlZPi"); /***************************************************/ void fooA(void delegate (scope void delegate()) dg) { } void fooB(void delegate (void delegate()) scope dg) { } //pragma(msg, fooA.mangleof); //pragma(msg, fooB.mangleof); static assert(typeof(fooA).mangleof != typeof(fooB).mangleof); /***************************************************/ void main() { test10077h(); test10077i(); test12044(); }
D
/******************************************************************************* * Copyright (c) 2000, 2006 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * IBM Corporation - initial API and implementation * * Port to the D programming language: * Jacob Carlborg <doob@me.com> *******************************************************************************/ module dwt.graphics.ImageDataLoader; import dwt.dwthelper.utils; import dwt.dwthelper.InputStream; import dwt.graphics.ImageLoader; import dwt.graphics.ImageData; /** * Internal class that separates ImageData from ImageLoader * to allow removal of ImageLoader from the toolkit. */ class ImageDataLoader { public static ImageData[] load(InputStream stream) { return (new ImageLoader()).load(stream); } public static ImageData[] load(String filename) { return (new ImageLoader()).load(filename); } }
D
/** gl3n.math Provides nearly all GLSL functions, according to spec 4.1, it also publically imports other useful functions (from std.math, core.stdc.math, std.alogrithm) so you only have to import this file to get all mathematical functions you need. Publically imports: PI, sin, cos, tan, asin, acos, atan, atan2, sinh, cosh, tanh, asinh, acosh, atanh, pow, exp, log, exp2, log2, sqrt, abs, floor, trunc, round, ceil, modf, fmodf, min, max. Authors: David Herberth License: MIT */ module gl3n.math; public { import std.math : PI, sin, cos, tan, asin, acos, atan, atan2, sinh, cosh, tanh, asinh, acosh, atanh, pow, exp, log, exp2, log2, sqrt, floor, trunc, round, ceil, modf; alias round roundEven; alias floor fract; //import core.stdc.math : fmodf; import std.algorithm : min, max; } private { import std.conv : to; import std.algorithm : all; import std.array : zip; import std.traits : CommonType; import std.range : ElementType; import smath = std.math; import gl3n.util : is_vector, is_quaternion, is_matrix; version(unittest) { import gl3n.linalg : vec2, vec2i, vec3, vec3i, quat; } } /// PI / 180 at compiletime, used for degrees/radians conversion. public enum real PI_180 = PI / 180; /// 180 / PI at compiletime, used for degrees/radians conversion. public enum real _180_PI = 180 / PI; /// Modulus. Returns x - y * floor(x/y). T mod(T)(T x, T y) { // std.math.floor is not pure return x - y * floor(x/y); } @safe pure nothrow: extern (C) { float fmodf(float x, float y); } /// Calculates the absolute value. T abs(T)(T t) if(!is_vector!T && !is_quaternion!T && !is_matrix!T) { return smath.abs(t); } /// Calculates the absolute value per component. T abs(T)(T vec) if(is_vector!T) { T ret; foreach(i, element; vec.vector) { ret.vector[i] = abs(element); } return ret; } /// ditto T abs(T)(T quat) if(is_quaternion!T) { T ret; ret.quaternion[0] = abs(quat.quaternion[0]); ret.quaternion[1] = abs(quat.quaternion[1]); ret.quaternion[2] = abs(quat.quaternion[2]); ret.quaternion[3] = abs(quat.quaternion[3]); return ret; } unittest { assert(abs(0) == 0); assert(abs(-1) == 1); assert(abs(1) == 1); assert(abs(0.0) == 0.0); assert(abs(-1.0) == 1.0); assert(abs(1.0) == 1.0); assert(abs(vec3i(-1, 0, -12)) == vec3(1, 0, 12)); assert(abs(vec3(-1, 0, -12)) == vec3(1, 0, 12)); assert(abs(vec3i(12, 12, 12)) == vec3(12, 12, 12)); assert(abs(quat(-1.0f, 0.0f, 1.0f, -12.0f)) == quat(1.0f, 0.0f, 1.0f, 12.0f)); } /// Returns 1/sqrt(x), results are undefined if x <= 0. real inversesqrt(real x) { return 1 / sqrt(x); } /// Returns 1.0 if x > 0, 0.0 if x = 0, or -1.0 if x < 0. float sign(T)(T x) { if(x > 0) { return 1.0f; } else if(x == 0) { return 0.0f; } else { // if x < 0 return -1.0f; } } unittest { assert(inversesqrt(1.0f) == 1.0f); assert(inversesqrt(10.0f) == (1/sqrt(10.0f))); assert(inversesqrt(2342342.0f) == (1/sqrt(2342342.0f))); assert(sign(-1) == -1.0f); assert(sign(0) == 0.0f); assert(sign(1) == 1.0f); assert(sign(0.5) == 1.0f); assert(sign(-0.5) == -1.0f); assert(mod(12.0, 27.5) == 12.0); assert(mod(-12.0, 27.5) == 15.5); assert(mod(12.0, -27.5) == -15.5); } /// Compares to values and returns true if the difference is epsilon or smaller. bool almost_equal(T, S)(T a, S b, float epsilon = 0.000001f) if(!is_vector!T && !is_quaternion!T) { if(abs(a-b) <= epsilon) { return true; } return abs(a-b) <= epsilon * abs(b); } /// ditto bool almost_equal(T, S)(T a, S b, float epsilon = 0.000001f) if(is_vector!T && is_vector!S && T.dimension == S.dimension) { foreach(i; 0..T.dimension) { if(!almost_equal(a.vector[i], b.vector[i], epsilon)) { return false; } } return true; } bool almost_equal(T)(T a, T b, float epsilon = 0.000001f) if(is_quaternion!T) { foreach(i; 0..4) { if(!almost_equal(a.quaternion[i], b.quaternion[i], epsilon)) { return false; } } return true; } unittest { assert(almost_equal(0, 0)); assert(almost_equal(1, 1)); assert(almost_equal(-1, -1)); assert(almost_equal(0f, 0.000001f, 0.000001f)); assert(almost_equal(1f, 1.1f, 0.1f)); assert(!almost_equal(1f, 1.1f, 0.01f)); assert(almost_equal(vec2i(0, 0), vec2(0.0f, 0.0f))); assert(almost_equal(vec2(0.0f, 0.0f), vec2(0.000001f, 0.000001f))); assert(almost_equal(vec3(0.0f, 1.0f, 2.0f), vec3i(0, 1, 2))); assert(almost_equal(quat(0.0f, 0.0f, 0.0f, 0.0f), quat(0.0f, 0.0f, 0.0f, 0.0f))); assert(almost_equal(quat(0.0f, 0.0f, 0.0f, 0.0f), quat(0.000001f, 0.000001f, 0.000001f, 0.000001f))); } /// Converts degrees to radians. real radians(real degrees) { return PI_180 * degrees; } /// Compiletime version of $(I radians). real cradians(real degrees)() { return radians(degrees); } /// Converts radians to degrees. real degrees(real radians) { return _180_PI * radians; } /// Compiletime version of $(I degrees). real cdegrees(real radians)() { return degrees(radians); } unittest { assert(radians(to!(real)(0)) == 0); assert(radians(to!(real)(90)) == PI/2); assert(radians(to!(real)(180)) == PI); assert(radians(to!(real)(360)) == 2*PI); assert(degrees(to!(real)(0)) == 0); assert(degrees(to!(real)(PI/2)) == 90); assert(degrees(to!(real)(PI)) == 180); assert(degrees(to!(real)(2*PI)) == 360); assert(degrees(radians(to!(real)(12))) == 12); assert(degrees(radians(to!(real)(100))) == 100); assert(degrees(radians(to!(real)(213))) == 213); assert(degrees(radians(to!(real)(399))) == 399); /+static+/ assert(almost_equal(cdegrees!PI, 180)); /+static+/ assert(almost_equal(cradians!180, PI)); } /// Returns min(max(x, min_val), max_val), Results are undefined if min_val > max_val. CommonType!(T1, T2, T3) clamp(T1, T2, T3)(T1 x, T2 min_val, T3 max_val) { return min(max(x, min_val), max_val); } unittest { assert(clamp(-1, 0, 2) == 0); assert(clamp(0, 0, 2) == 0); assert(clamp(1, 0, 2) == 1); assert(clamp(2, 0, 2) == 2); assert(clamp(3, 0, 2) == 2); } /// Returns 0.0 if x < edge, otherwise it returns 1.0. float step(T1, T2)(T1 edge, T2 x) { return x < edge ? 0.0f:1.0f; } /// Returns 0.0 if x <= edge0 and 1.0 if x >= edge1 and performs smooth /// hermite interpolation between 0 and 1 when edge0 < x < edge1. /// This is useful in cases where you would want a threshold function with a smooth transition. CommonType!(T1, T2, T3) smoothstep(T1, T2, T3)(T1 edge0, T2 edge1, T3 x) { auto t = clamp((x - edge0) / (edge1 - edge0), 0, 1); return t * t * (3 - 2 * t); } unittest { assert(step(0, 1) == 1.0f); assert(step(0, 10) == 1.0f); assert(step(1, 0) == 0.0f); assert(step(10, 0) == 0.0f); assert(step(1, 1) == 1.0f); assert(smoothstep(1, 0, 2) == 0); assert(smoothstep(1.0, 0.0, 2.0) == 0); assert(smoothstep(1.0, 0.0, 0.5) == 0.5); assert(almost_equal(smoothstep(0.0, 2.0, 0.5), 0.15625, 0.00001)); }
D
instance Mil_313_Boltan(Npc_Default) { name[0] = "Больтан"; guild = GIL_MIL; id = 313; voice = 5; flags = 0; npcType = NPCTYPE_AMBIENT; B_SetAttributesToChapter(self,3); fight_tactic = FAI_HUMAN_STRONG; EquipItem(self,ItMw_1h_Mil_Sword); B_CreateAmbientInv(self); B_SetNpcVisual(self,MALE,"Hum_Head_Fighter",Face_B_Normal01,BodyTex_B,ITAR_Mil_L); Mdl_SetModelFatness(self,0); Mdl_ApplyOverlayMds(self,"Humans_Militia.mds"); B_GiveNpcTalents(self); B_SetFightSkills(self,55); daily_routine = Rtn_Start_313; }; func void Rtn_Start_313() { TA_Sit_Chair(5,0,16,0,"NW_CITY_HABOUR_KASERN_PRISON_SIT"); TA_Stand_Guarding(16,0,21,0,"NW_CITY_HABOUR_KASERN_PRISON_02"); TA_Sit_Bench(21,0,5,0,"NW_CITY_HABOUR_KASERN_AROMRY_ENTRY_BENCH_01"); };
D
/Users/Definiter/Desktop/Insight/DerivedData/Insight/Build/Intermediates/Insight.build/Debug-iphonesimulator/Insight.build/Objects-normal/x86_64/ISCollectionViewCell.o : /Users/Definiter/Desktop/Insight/Insight/ISCollectionViewCell.swift /Users/Definiter/Desktop/Insight/Insight/ISDarkroomViewController.swift /Users/Definiter/Desktop/Insight/Insight/ISPopSelectView.swift /Users/Definiter/Desktop/Insight/Insight/ISCollectionViewController.swift /Users/Definiter/Desktop/Insight/Insight/ToneCurveEditorCurveLayer.swift /Users/Definiter/Desktop/Insight/Insight/ISColorHistogramView.swift /Users/Definiter/Desktop/Insight/Insight/AppDelegate.swift /Users/Definiter/Desktop/Insight/Insight/ToneCurveEditor.swift /Users/Definiter/Desktop/Insight/Insight/UIBezierPathExtension.swift /Users/Definiter/Desktop/Insight/Insight/ISProcessor.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/Swift.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/UIKit.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/Foundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/Darwin.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/Dispatch.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/ObjectiveC.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/CoreGraphics.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/Security.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/CoreImage.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/CoreAudio.swiftmodule /Users/Definiter/Desktop/Insight/DerivedData/Insight/Build/Intermediates/Insight.build/Debug-iphonesimulator/Insight.build/Objects-normal/x86_64/ISCollectionViewCell~partial.swiftmodule : /Users/Definiter/Desktop/Insight/Insight/ISCollectionViewCell.swift /Users/Definiter/Desktop/Insight/Insight/ISDarkroomViewController.swift /Users/Definiter/Desktop/Insight/Insight/ISPopSelectView.swift /Users/Definiter/Desktop/Insight/Insight/ISCollectionViewController.swift /Users/Definiter/Desktop/Insight/Insight/ToneCurveEditorCurveLayer.swift /Users/Definiter/Desktop/Insight/Insight/ISColorHistogramView.swift /Users/Definiter/Desktop/Insight/Insight/AppDelegate.swift /Users/Definiter/Desktop/Insight/Insight/ToneCurveEditor.swift /Users/Definiter/Desktop/Insight/Insight/UIBezierPathExtension.swift /Users/Definiter/Desktop/Insight/Insight/ISProcessor.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/Swift.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/UIKit.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/Foundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/Darwin.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/Dispatch.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/ObjectiveC.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/CoreGraphics.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/Security.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/CoreImage.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/CoreAudio.swiftmodule /Users/Definiter/Desktop/Insight/DerivedData/Insight/Build/Intermediates/Insight.build/Debug-iphonesimulator/Insight.build/Objects-normal/x86_64/ISCollectionViewCell~partial.swiftdoc : /Users/Definiter/Desktop/Insight/Insight/ISCollectionViewCell.swift /Users/Definiter/Desktop/Insight/Insight/ISDarkroomViewController.swift /Users/Definiter/Desktop/Insight/Insight/ISPopSelectView.swift /Users/Definiter/Desktop/Insight/Insight/ISCollectionViewController.swift /Users/Definiter/Desktop/Insight/Insight/ToneCurveEditorCurveLayer.swift /Users/Definiter/Desktop/Insight/Insight/ISColorHistogramView.swift /Users/Definiter/Desktop/Insight/Insight/AppDelegate.swift /Users/Definiter/Desktop/Insight/Insight/ToneCurveEditor.swift /Users/Definiter/Desktop/Insight/Insight/UIBezierPathExtension.swift /Users/Definiter/Desktop/Insight/Insight/ISProcessor.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/Swift.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/UIKit.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/Foundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/Darwin.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/Dispatch.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/ObjectiveC.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/CoreGraphics.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/Security.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/CoreImage.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/CoreAudio.swiftmodule
D
/Users/akulaiev/Desktop/akulaiev2019/Example/build/Pods.build/Debug-iphonesimulator/akulaiev2019.build/Objects-normal/x86_64/Article-ca7d6ddb9da2df9dad2a303cd747cd0898fe01452cf145a4d133326eae1ea46c.o : /Users/akulaiev/Desktop/akulaiev2019/akulaiev2019/Classes/Article.swift /Users/akulaiev/Desktop/akulaiev2019/akulaiev2019/Classes/ArticleManager.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/ObjectiveC.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreData.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreImage.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/QuartzCore.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Dispatch.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Metal.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Darwin.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Foundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreFoundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreGraphics.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Swift.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/UIKit.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/SwiftOnoneSupport.swiftmodule /Users/akulaiev/Desktop/akulaiev2019/Example/Pods/Target\ Support\ Files/akulaiev2019/akulaiev2019-umbrella.h /Users/akulaiev/Desktop/akulaiev2019/Example/build/Pods.build/Debug-iphonesimulator/akulaiev2019.build/unextended-module.modulemap /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.2.sdk/usr/include/objc/ObjectiveC.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.2.sdk/System/Library/Frameworks/OpenGLES.framework/Headers/OpenGLES.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.2.sdk/System/Library/Frameworks/CoreData.framework/Headers/CoreData.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.2.sdk/System/Library/Frameworks/CoreImage.framework/Headers/CoreImage.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.2.sdk/System/Library/Frameworks/QuartzCore.framework/Headers/QuartzCore.apinotes /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Dispatch.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.2.sdk/System/Library/Frameworks/Metal.framework/Headers/Metal.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.2.sdk/usr/include/Darwin.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.2.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.2.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.2.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIKit.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.2.sdk/System/Library/Frameworks/CoreText.framework/Headers/CoreText.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.2.sdk/System/Library/Frameworks/Security.framework/Headers/Security.apinotes /Users/akulaiev/Desktop/akulaiev2019/Example/build/Pods.build/Debug-iphonesimulator/akulaiev2019.build/Objects-normal/x86_64/Article-ca7d6ddb9da2df9dad2a303cd747cd0898fe01452cf145a4d133326eae1ea46c~partial.swiftmodule : /Users/akulaiev/Desktop/akulaiev2019/akulaiev2019/Classes/Article.swift /Users/akulaiev/Desktop/akulaiev2019/akulaiev2019/Classes/ArticleManager.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/ObjectiveC.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreData.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreImage.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/QuartzCore.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Dispatch.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Metal.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Darwin.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Foundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreFoundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreGraphics.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Swift.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/UIKit.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/SwiftOnoneSupport.swiftmodule /Users/akulaiev/Desktop/akulaiev2019/Example/Pods/Target\ Support\ Files/akulaiev2019/akulaiev2019-umbrella.h /Users/akulaiev/Desktop/akulaiev2019/Example/build/Pods.build/Debug-iphonesimulator/akulaiev2019.build/unextended-module.modulemap /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.2.sdk/usr/include/objc/ObjectiveC.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.2.sdk/System/Library/Frameworks/OpenGLES.framework/Headers/OpenGLES.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.2.sdk/System/Library/Frameworks/CoreData.framework/Headers/CoreData.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.2.sdk/System/Library/Frameworks/CoreImage.framework/Headers/CoreImage.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.2.sdk/System/Library/Frameworks/QuartzCore.framework/Headers/QuartzCore.apinotes /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Dispatch.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.2.sdk/System/Library/Frameworks/Metal.framework/Headers/Metal.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.2.sdk/usr/include/Darwin.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.2.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.2.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.2.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIKit.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.2.sdk/System/Library/Frameworks/CoreText.framework/Headers/CoreText.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.2.sdk/System/Library/Frameworks/Security.framework/Headers/Security.apinotes /Users/akulaiev/Desktop/akulaiev2019/Example/build/Pods.build/Debug-iphonesimulator/akulaiev2019.build/Objects-normal/x86_64/Article-ca7d6ddb9da2df9dad2a303cd747cd0898fe01452cf145a4d133326eae1ea46c~partial.swiftdoc : /Users/akulaiev/Desktop/akulaiev2019/akulaiev2019/Classes/Article.swift /Users/akulaiev/Desktop/akulaiev2019/akulaiev2019/Classes/ArticleManager.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/ObjectiveC.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreData.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreImage.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/QuartzCore.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Dispatch.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Metal.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Darwin.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Foundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreFoundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreGraphics.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Swift.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/UIKit.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/SwiftOnoneSupport.swiftmodule /Users/akulaiev/Desktop/akulaiev2019/Example/Pods/Target\ Support\ Files/akulaiev2019/akulaiev2019-umbrella.h /Users/akulaiev/Desktop/akulaiev2019/Example/build/Pods.build/Debug-iphonesimulator/akulaiev2019.build/unextended-module.modulemap /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.2.sdk/usr/include/objc/ObjectiveC.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.2.sdk/System/Library/Frameworks/OpenGLES.framework/Headers/OpenGLES.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.2.sdk/System/Library/Frameworks/CoreData.framework/Headers/CoreData.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.2.sdk/System/Library/Frameworks/CoreImage.framework/Headers/CoreImage.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.2.sdk/System/Library/Frameworks/QuartzCore.framework/Headers/QuartzCore.apinotes /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Dispatch.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.2.sdk/System/Library/Frameworks/Metal.framework/Headers/Metal.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.2.sdk/usr/include/Darwin.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.2.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.2.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.2.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIKit.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.2.sdk/System/Library/Frameworks/CoreText.framework/Headers/CoreText.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.2.sdk/System/Library/Frameworks/Security.framework/Headers/Security.apinotes
D
/Users/taharahiroki/Documents/GitHub/Enigma_Bitcoin_proto/sign_multiple_utxos/target/debug/build/rand_pcg-eef8554257a8b519/build_script_build-eef8554257a8b519: /Users/taharahiroki/.cargo/registry/src/github.com-1ecc6299db9ec823/rand_pcg-0.1.2/build.rs /Users/taharahiroki/Documents/GitHub/Enigma_Bitcoin_proto/sign_multiple_utxos/target/debug/build/rand_pcg-eef8554257a8b519/build_script_build-eef8554257a8b519.d: /Users/taharahiroki/.cargo/registry/src/github.com-1ecc6299db9ec823/rand_pcg-0.1.2/build.rs /Users/taharahiroki/.cargo/registry/src/github.com-1ecc6299db9ec823/rand_pcg-0.1.2/build.rs:
D
module game.script.enemy; import atelier, grimoire; import std.format; import std.stdio; import game.scene; import game.scene.enemy; import game.scene.wolf; import game.scene.world; package void loadEnemy(GrData data) { auto defEnemy = data.addUserType("Enemy"); grEnemy = defEnemy; data.addPrimitive(&_grSpawnEnemy, "spawnEnemy", ["name", "x", "y"], [grString, grInt, grInt], [defEnemy]); data.addPrimitive(&_setEnemyPosition, "setPosition", ["enemy", "x", "y"], [defEnemy, grInt, grInt]); data.addPrimitive(&_getEnemyPosition, "getPosition", ["enemy"], [defEnemy], [grInt, grInt]); data.addPrimitive(&_getEnemyPositionX, "getPositionX", ["enemy"], [defEnemy], [grInt]); data.addPrimitive(&_getEnemyPositionY, "getPositionY", ["enemy"], [defEnemy], [grInt]); data.addPrimitive(&_setEnemySpeed, "setSpeed", ["enemy", "speedX", "speedY"], [defEnemy, grFloat, grFloat]); data.addPrimitive(&_setEnemyHitbox, "setHitbox", ["enemy", "x", "y"], [defEnemy, grInt, grInt]); data.addPrimitive(&_getEnemyHitbox, "getHitbox", ["enemy"], [defEnemy], [grInt, grInt]); data.addPrimitive(&_getEnemyHitboxX, "getHitboxX", ["enemy"], [defEnemy], [grInt]); data.addPrimitive(&_getEnemyHitboxY, "getHitboxY", ["enemy"], [defEnemy], [grInt]); data.addPrimitive(&_isEnemyGrounded, "isGrounded", ["enemy"], [defEnemy], [grBool]); data.addPrimitive(&_killEnemy, "killp", ["enemy"], [defEnemy]); data.addPrimitive(&_damageEnemy, "damage", ["enemy", "amount"], [defEnemy, grFloat]); } GrType grEnemy; private void _grSpawnEnemy(GrCall call) { const int x = call.getInt("x"); const int y = call.getInt("y"); Enemy enemy = new Wolf(Vec2i(x, y)); spawnActor(enemy); call.setUserData!Enemy(enemy); } private void _setEnemyPosition(GrCall call) { Enemy enemy = call.getUserData!Enemy("enemy"); enemy.position = Vec2i(call.getInt("x"), call.getInt("y")); } private void _getEnemyPosition(GrCall call) { Enemy enemy = call.getUserData!Enemy("enemy"); call.setInt(enemy.position.x); call.setInt(enemy.position.y); } private void _getEnemyPositionX(GrCall call) { Enemy enemy = call.getUserData!Enemy("enemy"); call.setInt(enemy.position.x); } private void _getEnemyPositionY(GrCall call) { Enemy enemy = call.getUserData!Enemy("enemy"); call.setInt(enemy.position.y); } private void _setEnemySpeed(GrCall call) { Enemy enemy = call.getUserData!Enemy("enemy"); enemy.speed = Vec2f(call.getFloat("speedX"), call.getFloat("speedY")); } private void _setEnemyHitbox(GrCall call) { Enemy enemy = call.getUserData!Enemy("enemy"); enemy.hitbox = Vec2i(call.getInt("x"), call.getInt("y")); } private void _getEnemyHitbox(GrCall call) { Enemy enemy = call.getUserData!Enemy("enemy"); call.setInt(enemy.hitbox.x); call.setInt(enemy.hitbox.y); } private void _getEnemyHitboxX(GrCall call) { Enemy enemy = call.getUserData!Enemy("enemy"); call.setInt(enemy.hitbox.x); } private void _getEnemyHitboxY(GrCall call) { Enemy enemy = call.getUserData!Enemy("enemy"); call.setInt(enemy.hitbox.y); } private void _isEnemyGrounded(GrCall call) { Enemy enemy = call.getUserData!Enemy("enemy"); call.setBool(enemy.onGround); } private void _killEnemy(GrCall call) { Enemy enemy = call.getUserData!Enemy("enemy"); } private void _damageEnemy(GrCall call) { Enemy enemy = call.getUserData!Enemy("enemy"); writeln(format!"Enemy taking %s damage"(call.getFloat("damage"))); }
D
/** Utility functions for string processing Copyright: © 2012 RejectedSoftware e.K. License: Subject to the terms of the MIT license, as written in the included LICENSE.txt file. Authors: Sönke Ludwig */ module vibe.utils.string; public import std.string; import std.algorithm; import std.array; import std.format; import std.uni; import std.utf; import core.exception; /** Takes a string with possibly invalid UTF8 sequences and outputs a valid UTF8 string as near to the original as possible. */ string sanitizeUTF8(in ubyte[] str) { import std.utf; auto ret = appender!string(); ret.reserve(str.length); size_t i = 0; while( i < str.length ){ dchar ch = str[i]; try ch = std.utf.decode(cast(string)str, i); catch( UTFException ){ i++; } catch( AssertError ){ i++; } char[4] dst; auto len = std.utf.encode(dst, ch); ret.put(dst[0 .. len]); } return ret.data; } /** Strips the byte order mark of an UTF8 encoded string. This is useful when the string is coming from a file. */ string stripUTF8Bom(string str) { if( str.length >= 3 && str[0 .. 3] == [0xEF, 0xBB, 0xBF] ) return str[3 ..$]; return str; } /** Joins an array of strings using 'linesep' as the line separator (\n by default). */ string joinLines(string[] strs, string linesep = "\n") { auto len = 0; foreach( i, s; strs ){ if( i > 0 ) len += linesep.length; len += s.length; } auto ret = appender!string(); ret.reserve(len); foreach( i, s; strs ){ if( i > 0 ) ret.put(linesep); ret.put(s); } return ret.data; } /** Checks if all characters in 'str' are contained in 'chars'. */ bool allOf(string str, string chars) { foreach( ch; str ) if( chars.countUntil(ch) < 0 ) return false; return true; } /** Checks if any character in 'str' is contained in 'chars'. */ bool anyOf(string str, string chars) { foreach( ch; str ) if( chars.countUntil(ch) >= 0 ) return true; return false; } bool isAlpha(char ch) { switch( ch ){ default: return false; case 'a': .. case 'z'+1: break; case 'A': .. case 'Z'+1: break; } return true; } string stripLeftA(string s) { while( s.length > 0 && (s[0] == ' ' || s[0] == '\t') ) s = s[1 .. $]; return s; } string stripRightA(string s) { while( s.length > 0 && (s[$-1] == ' ' || s[$-1] == '\t') ) s = s[0 .. $-1]; return s; } string stripA(string s) { return stripLeftA(stripRightA(s)); } sizediff_t countUntilAny(string str, string chars) { foreach( i, char ch; str ) if( chars.countUntil(ch) >= 0 ) return i; return -1; } string formatString(ARGS...)(string format, ARGS args) { auto dst = appender!string(); formattedWrite(dst, format, args); return dst.data; } int icmp2(string a, string b) { size_t i = 0, j = 0; // fast skip equal prefix size_t min_len = min(a.length, b.length); while( i < min_len && a[i] == b[i] ) i++; if( i > 0 && (a[i-1] & 0x80) ) i--; // don't stop half-way in a UTF-8 sequence j = i; // compare the differing character and the rest of the string while(i < a.length && j < b.length){ uint ac = cast(uint)a[i]; uint bc = cast(uint)b[j]; if( !((ac | bc) & 0x80) ){ i++; j++; if( ac >= 'A' && ac <= 'Z' ) ac += 'a' - 'A'; if( bc >= 'A' && bc <= 'Z' ) bc += 'a' - 'A'; if( ac < bc ) return -1; else if( ac > bc ) return 1; } else { dchar acp = decode(a, i); dchar bcp = decode(b, j); if( acp != bcp ){ acp = toLower(acp); bcp = toLower(bcp); if( acp < bcp ) return -1; else if( acp > bcp ) return 1; } } } if( i < a.length ) return 1; else if( j < b.length ) return -1; assert(i == a.length || j == b.length, "Strings equal but we didn't fully compare them!?"); return 0; }
D
module stdex.number; import std.algorithm; import std.conv; import std.range; import std.traits; import std.math; import stdex.math; version(unittest) { import std.stdio; } private template WorkingUInt(T) { static if (is(T == byte) || is(T == ubyte) || is(T == short) || is(T == ushort)) { alias uint WorkingUInt; } else static if (is(T == int) || is(T == uint)) { alias ulong WorkingUInt; } else static if (is(T == long) || is(T == ulong)) { alias BigInt WorkingUInt; } else { alias T WorkingUInt; } } /++ Computes b^e (mod m) +/ Int modExp(Int)(Int b, Int e, Int m) in { import stdex.util; //assertf(b >= 0, "b = %d", b); assert(e >= 0); assert(m > 0); } body { import std.typecons : Unqual; alias Unqual!Int MutableInt; alias WorkingUInt!MutableInt WorkInt; WorkInt r = 1; WorkInt ee = e; WorkInt bb = b; while (ee) { if (ee % 2 == 1) { r *= bb; r %= m; } bb *= bb; bb %= m; ee /= 2; } return cast(Int)r; } unittest { assert(modExp(7, 7, 10) == (7 ^^ 7) % 10); } /++ Detects if an integer is prime using the deterministic Miller-Rabin test. +/ bool isPrime(Int)(Int n) { import std.typecons : Unqual; alias Unqual!Int MutableInt; if (n < 4) return n > 1; // Factor n - 1 into 2^s * d MutableInt d = n; --d; MutableInt s = cast(MutableInt)0; while (d % 2 == 0) { d /= 2; ++s; } //todo immutable Int[] as = [2, 7, 61]; foreach (a; as) { if (a >= n) break; auto x = modExp!Int(a, d, n); if (x == 1 || x == n - 1) continue; bool composite = true; foreach (Int r; cast(Int)1..s) { x = modExp!Int(x, cast(Int)2, n); if (x == 1) return false; if (x == n - 1) goto next; } return false; next: ; } return true; } unittest { import stdex.util; foreach (p; smallPrimes) { if(!isPrime!int(p)) writefln("%d should be prime", p); if(isPrime!int(p * p)) writefln("%d (%d^2) should not be prime", p * p, p); } } /++ Generates the first $(D n) primes into an output range. +/ void generatePrimes(OutputRange)(size_t n, OutputRange output) { copy(smallPrimes[0..min($, n)], output); // TODO: Generate the rest... } struct Primes(Int) { public: this(Int start) { m_current = start < 2 ? 2 : start; if (m_current != 2 && m_current % 2 == 0) ++m_current; while (!isPrime(m_current)) m_current += 2; } @property Int front() { return m_current; } enum empty = false; void popFront() { if (m_current != 2) { do { m_current += 2; } while(!isPrime(m_current)); } else { ++m_current; } } private: Int m_current; } auto primes(Int)(Int start = 2) { import std.range; return chain(smallPrimes[], Primes!Int(cast(Int)(smallPrimes[$-1] + 2))); } unittest { assert(equal(primes!ushort().take(1000), smallPrimes[])); } unittest { void test(T)() { foreach (T p; smallPrimes) assert(isPrime!T(p), text(p) ~ " is prime, but isPrime!" ~ T.stringof ~ "(" ~ text(p) ~ ") returned false."); } /+test!short(); test!ushort(); test!int(); test!uint(); test!long(); test!ulong();+/ } /++ Lazily iterates the digits of $(D abs(x)) in reverse order. Note: $(D digits(0)) returns an empty range, not $(D [0]). +/ auto digits(T)(T x) if (isIntegral!T) { static struct Result { @property int front() { return _n % 10; } @property bool empty() { return _n == 0; } void popFront() { _n /= 10; } @property auto save() { return typeof(this)(_n); } // TODO: bidirectional, random access, length private Unqual!T _n; } return Result(abs(x)); } /// unittest { assert(digits(123).equal([3, 2, 1])); assert(digits(-99).equal([9, 9])); assert(digits(0).empty); } /++ The $(I digital root) of ($D n) is the result of repeatedly summing the digits of $(D n) until the sum is a single digit. +/ int digitalRoot(T)(T n, uint base = 10) if (isIntegral!T) { if (n == 0) return 0; --n; n %= base - 1; return 1 + cast(int) n; } /// unittest { assert(digitalRoot(1) == 1); assert(digitalRoot(123) == 6); assert(digitalRoot(99) == 9); assert(digitalRoot(7777) == 1); assert(digitalRoot(0) == 0); } /++ +/ uint[] allPrimesBelow(T)(T n) if (isIntegral!T) { // TODO: work with bigint if (n < 2) return []; import std.bitmanip; BitArray c; c.length = n; c[0] = true; c[1] = true; foreach (uint p; iota(2, cast(uint)sqrt(cast(real)n) + 1).filter!(i => !c[i])) for (uint k = p * p; k < n; k += p) c[k] = true; return iota(2u, cast(uint)n).filter!(i => !c[i]).array(); } /// unittest { assert(allPrimesBelow(30).equal(smallPrimes[].take(10))); assert(allPrimesBelow(7920).equal(smallPrimes[].take(1000))); } static immutable ushort[1000] smallPrimes = [ 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313, 317, 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397, 401, 409, 419, 421, 431, 433, 439, 443, 449, 457, 461, 463, 467, 479, 487, 491, 499, 503, 509, 521, 523, 541, 547, 557, 563, 569, 571, 577, 587, 593, 599, 601, 607, 613, 617, 619, 631, 641, 643, 647, 653, 659, 661, 673, 677, 683, 691, 701, 709, 719, 727, 733, 739, 743, 751, 757, 761, 769, 773, 787, 797, 809, 811, 821, 823, 827, 829, 839, 853, 857, 859, 863, 877, 881, 883, 887, 907, 911, 919, 929, 937, 941, 947, 953, 967, 971, 977, 983, 991, 997, 1009, 1013, 1019, 1021, 1031, 1033, 1039, 1049, 1051, 1061, 1063, 1069, 1087, 1091, 1093, 1097, 1103, 1109, 1117, 1123, 1129, 1151, 1153, 1163, 1171, 1181, 1187, 1193, 1201, 1213, 1217, 1223, 1229, 1231, 1237, 1249, 1259, 1277, 1279, 1283, 1289, 1291, 1297, 1301, 1303, 1307, 1319, 1321, 1327, 1361, 1367, 1373, 1381, 1399, 1409, 1423, 1427, 1429, 1433, 1439, 1447, 1451, 1453, 1459, 1471, 1481, 1483, 1487, 1489, 1493, 1499, 1511, 1523, 1531, 1543, 1549, 1553, 1559, 1567, 1571, 1579, 1583, 1597, 1601, 1607, 1609, 1613, 1619, 1621, 1627, 1637, 1657, 1663, 1667, 1669, 1693, 1697, 1699, 1709, 1721, 1723, 1733, 1741, 1747, 1753, 1759, 1777, 1783, 1787, 1789, 1801, 1811, 1823, 1831, 1847, 1861, 1867, 1871, 1873, 1877, 1879, 1889, 1901, 1907, 1913, 1931, 1933, 1949, 1951, 1973, 1979, 1987, 1993, 1997, 1999, 2003, 2011, 2017, 2027, 2029, 2039, 2053, 2063, 2069, 2081, 2083, 2087, 2089, 2099, 2111, 2113, 2129, 2131, 2137, 2141, 2143, 2153, 2161, 2179, 2203, 2207, 2213, 2221, 2237, 2239, 2243, 2251, 2267, 2269, 2273, 2281, 2287, 2293, 2297, 2309, 2311, 2333, 2339, 2341, 2347, 2351, 2357, 2371, 2377, 2381, 2383, 2389, 2393, 2399, 2411, 2417, 2423, 2437, 2441, 2447, 2459, 2467, 2473, 2477, 2503, 2521, 2531, 2539, 2543, 2549, 2551, 2557, 2579, 2591, 2593, 2609, 2617, 2621, 2633, 2647, 2657, 2659, 2663, 2671, 2677, 2683, 2687, 2689, 2693, 2699, 2707, 2711, 2713, 2719, 2729, 2731, 2741, 2749, 2753, 2767, 2777, 2789, 2791, 2797, 2801, 2803, 2819, 2833, 2837, 2843, 2851, 2857, 2861, 2879, 2887, 2897, 2903, 2909, 2917, 2927, 2939, 2953, 2957, 2963, 2969, 2971, 2999, 3001, 3011, 3019, 3023, 3037, 3041, 3049, 3061, 3067, 3079, 3083, 3089, 3109, 3119, 3121, 3137, 3163, 3167, 3169, 3181, 3187, 3191, 3203, 3209, 3217, 3221, 3229, 3251, 3253, 3257, 3259, 3271, 3299, 3301, 3307, 3313, 3319, 3323, 3329, 3331, 3343, 3347, 3359, 3361, 3371, 3373, 3389, 3391, 3407, 3413, 3433, 3449, 3457, 3461, 3463, 3467, 3469, 3491, 3499, 3511, 3517, 3527, 3529, 3533, 3539, 3541, 3547, 3557, 3559, 3571, 3581, 3583, 3593, 3607, 3613, 3617, 3623, 3631, 3637, 3643, 3659, 3671, 3673, 3677, 3691, 3697, 3701, 3709, 3719, 3727, 3733, 3739, 3761, 3767, 3769, 3779, 3793, 3797, 3803, 3821, 3823, 3833, 3847, 3851, 3853, 3863, 3877, 3881, 3889, 3907, 3911, 3917, 3919, 3923, 3929, 3931, 3943, 3947, 3967, 3989, 4001, 4003, 4007, 4013, 4019, 4021, 4027, 4049, 4051, 4057, 4073, 4079, 4091, 4093, 4099, 4111, 4127, 4129, 4133, 4139, 4153, 4157, 4159, 4177, 4201, 4211, 4217, 4219, 4229, 4231, 4241, 4243, 4253, 4259, 4261, 4271, 4273, 4283, 4289, 4297, 4327, 4337, 4339, 4349, 4357, 4363, 4373, 4391, 4397, 4409, 4421, 4423, 4441, 4447, 4451, 4457, 4463, 4481, 4483, 4493, 4507, 4513, 4517, 4519, 4523, 4547, 4549, 4561, 4567, 4583, 4591, 4597, 4603, 4621, 4637, 4639, 4643, 4649, 4651, 4657, 4663, 4673, 4679, 4691, 4703, 4721, 4723, 4729, 4733, 4751, 4759, 4783, 4787, 4789, 4793, 4799, 4801, 4813, 4817, 4831, 4861, 4871, 4877, 4889, 4903, 4909, 4919, 4931, 4933, 4937, 4943, 4951, 4957, 4967, 4969, 4973, 4987, 4993, 4999, 5003, 5009, 5011, 5021, 5023, 5039, 5051, 5059, 5077, 5081, 5087, 5099, 5101, 5107, 5113, 5119, 5147, 5153, 5167, 5171, 5179, 5189, 5197, 5209, 5227, 5231, 5233, 5237, 5261, 5273, 5279, 5281, 5297, 5303, 5309, 5323, 5333, 5347, 5351, 5381, 5387, 5393, 5399, 5407, 5413, 5417, 5419, 5431, 5437, 5441, 5443, 5449, 5471, 5477, 5479, 5483, 5501, 5503, 5507, 5519, 5521, 5527, 5531, 5557, 5563, 5569, 5573, 5581, 5591, 5623, 5639, 5641, 5647, 5651, 5653, 5657, 5659, 5669, 5683, 5689, 5693, 5701, 5711, 5717, 5737, 5741, 5743, 5749, 5779, 5783, 5791, 5801, 5807, 5813, 5821, 5827, 5839, 5843, 5849, 5851, 5857, 5861, 5867, 5869, 5879, 5881, 5897, 5903, 5923, 5927, 5939, 5953, 5981, 5987, 6007, 6011, 6029, 6037, 6043, 6047, 6053, 6067, 6073, 6079, 6089, 6091, 6101, 6113, 6121, 6131, 6133, 6143, 6151, 6163, 6173, 6197, 6199, 6203, 6211, 6217, 6221, 6229, 6247, 6257, 6263, 6269, 6271, 6277, 6287, 6299, 6301, 6311, 6317, 6323, 6329, 6337, 6343, 6353, 6359, 6361, 6367, 6373, 6379, 6389, 6397, 6421, 6427, 6449, 6451, 6469, 6473, 6481, 6491, 6521, 6529, 6547, 6551, 6553, 6563, 6569, 6571, 6577, 6581, 6599, 6607, 6619, 6637, 6653, 6659, 6661, 6673, 6679, 6689, 6691, 6701, 6703, 6709, 6719, 6733, 6737, 6761, 6763, 6779, 6781, 6791, 6793, 6803, 6823, 6827, 6829, 6833, 6841, 6857, 6863, 6869, 6871, 6883, 6899, 6907, 6911, 6917, 6947, 6949, 6959, 6961, 6967, 6971, 6977, 6983, 6991, 6997, 7001, 7013, 7019, 7027, 7039, 7043, 7057, 7069, 7079, 7103, 7109, 7121, 7127, 7129, 7151, 7159, 7177, 7187, 7193, 7207, 7211, 7213, 7219, 7229, 7237, 7243, 7247, 7253, 7283, 7297, 7307, 7309, 7321, 7331, 7333, 7349, 7351, 7369, 7393, 7411, 7417, 7433, 7451, 7457, 7459, 7477, 7481, 7487, 7489, 7499, 7507, 7517, 7523, 7529, 7537, 7541, 7547, 7549, 7559, 7561, 7573, 7577, 7583, 7589, 7591, 7603, 7607, 7621, 7639, 7643, 7649, 7669, 7673, 7681, 7687, 7691, 7699, 7703, 7717, 7723, 7727, 7741, 7753, 7757, 7759, 7789, 7793, 7817, 7823, 7829, 7841, 7853, 7867, 7873, 7877, 7879, 7883, 7901, 7907, 7919 ];
D
/Users/zhouzhenyong/project/rust-github/rust-learn/web/target/debug/deps/standback-02f55fd0e095e88e.rmeta: /Users/zhouzhenyong/.cargo/registry/src/github.com-1ecc6299db9ec823/standback-0.2.17/src/lib.rs /Users/zhouzhenyong/.cargo/registry/src/github.com-1ecc6299db9ec823/standback-0.2.17/src/v1_49.rs /Users/zhouzhenyong/.cargo/registry/src/github.com-1ecc6299db9ec823/standback-0.2.17/src/v1_49/sort.rs /Users/zhouzhenyong/.cargo/registry/src/github.com-1ecc6299db9ec823/standback-0.2.17/src/v1_50.rs /Users/zhouzhenyong/.cargo/registry/src/github.com-1ecc6299db9ec823/standback-0.2.17/src/v1_51.rs /Users/zhouzhenyong/.cargo/registry/src/github.com-1ecc6299db9ec823/standback-0.2.17/src/v1_51/slice.rs /Users/zhouzhenyong/project/rust-github/rust-learn/web/target/debug/deps/libstandback-02f55fd0e095e88e.rlib: /Users/zhouzhenyong/.cargo/registry/src/github.com-1ecc6299db9ec823/standback-0.2.17/src/lib.rs /Users/zhouzhenyong/.cargo/registry/src/github.com-1ecc6299db9ec823/standback-0.2.17/src/v1_49.rs /Users/zhouzhenyong/.cargo/registry/src/github.com-1ecc6299db9ec823/standback-0.2.17/src/v1_49/sort.rs /Users/zhouzhenyong/.cargo/registry/src/github.com-1ecc6299db9ec823/standback-0.2.17/src/v1_50.rs /Users/zhouzhenyong/.cargo/registry/src/github.com-1ecc6299db9ec823/standback-0.2.17/src/v1_51.rs /Users/zhouzhenyong/.cargo/registry/src/github.com-1ecc6299db9ec823/standback-0.2.17/src/v1_51/slice.rs /Users/zhouzhenyong/project/rust-github/rust-learn/web/target/debug/deps/standback-02f55fd0e095e88e.d: /Users/zhouzhenyong/.cargo/registry/src/github.com-1ecc6299db9ec823/standback-0.2.17/src/lib.rs /Users/zhouzhenyong/.cargo/registry/src/github.com-1ecc6299db9ec823/standback-0.2.17/src/v1_49.rs /Users/zhouzhenyong/.cargo/registry/src/github.com-1ecc6299db9ec823/standback-0.2.17/src/v1_49/sort.rs /Users/zhouzhenyong/.cargo/registry/src/github.com-1ecc6299db9ec823/standback-0.2.17/src/v1_50.rs /Users/zhouzhenyong/.cargo/registry/src/github.com-1ecc6299db9ec823/standback-0.2.17/src/v1_51.rs /Users/zhouzhenyong/.cargo/registry/src/github.com-1ecc6299db9ec823/standback-0.2.17/src/v1_51/slice.rs /Users/zhouzhenyong/.cargo/registry/src/github.com-1ecc6299db9ec823/standback-0.2.17/src/lib.rs: /Users/zhouzhenyong/.cargo/registry/src/github.com-1ecc6299db9ec823/standback-0.2.17/src/v1_49.rs: /Users/zhouzhenyong/.cargo/registry/src/github.com-1ecc6299db9ec823/standback-0.2.17/src/v1_49/sort.rs: /Users/zhouzhenyong/.cargo/registry/src/github.com-1ecc6299db9ec823/standback-0.2.17/src/v1_50.rs: /Users/zhouzhenyong/.cargo/registry/src/github.com-1ecc6299db9ec823/standback-0.2.17/src/v1_51.rs: /Users/zhouzhenyong/.cargo/registry/src/github.com-1ecc6299db9ec823/standback-0.2.17/src/v1_51/slice.rs:
D
/** Copyright: Copyright (c) 2016 Andrey Penechko. License: $(WEB boost.org/LICENSE_1_0.txt, Boost License 1.0). Authors: Andrey Penechko. */ module voxelman.block.plugin; import std.experimental.logger; import std.array : array; import cbor; import pluginlib; import voxelman.core.config : BlockId; import voxelman.world.storage.coordinates; import voxelman.block.utils; import voxelman.utils.mapping; import voxelman.world.plugin; import voxelman.world.clientworld; final class BlockManager : IResourceManager { private: Mapping!BlockInfo blockMapping; public: override string id() @property { return "voxelman.block.blockmanager"; } override void preInit() { regBaseBlocks(&regBlock); } BlockInfoSetter regBlock(string name) { size_t id = blockMapping.put(BlockInfo(name)); assert(id <= BlockId.max); return BlockInfoSetter(&blockMapping, id); } } mixin template BlockPluginCommonImpl() { private BlockManager bm; immutable string blockMappingKey = "voxelman.block.block_mapping"; override void registerResourceManagers(void delegate(IResourceManager) registerHandler) { registerHandler(bm = new BlockManager); } override void registerResources(IResourceManagerRegistry resmanRegistry) { registerResourcesImpl(resmanRegistry); } BlockInfoTable getBlocks() { return BlockInfoTable(cast(immutable)bm.blockMapping.infoArray); } } final class BlockPluginClient : IPlugin { mixin BlockPluginCommonImpl; // IPlugin stuff mixin IdAndSemverFrom!(voxelman.block.plugininfo); override void init(IPluginManager pluginman) { auto clientWorld = pluginman.getPlugin!ClientWorld; clientWorld.idMapManager.regIdMapHandler(blockMappingKey, &handleBlockMap); } void handleBlockMap(string[] blocks) { bm.blockMapping.setMapping(blocks); } void registerResourcesImpl(IResourceManagerRegistry resmanRegistry){} } final class BlockPluginServer : IPlugin { mixin BlockPluginCommonImpl; // IPlugin stuff mixin IdAndSemverFrom!(voxelman.block.plugininfo); void registerResourcesImpl(IResourceManagerRegistry resmanRegistry) { auto ioman = resmanRegistry.getResourceManager!IoManager; ioman.registerWorldLoadSaveHandlers(&readBlockMap, &writeBlockMap); } override void init(IPluginManager pluginman) { auto serverWorld = pluginman.getPlugin!ServerWorld; serverWorld.idMapManager.regIdMap(blockMappingKey, bm.blockMapping.nameRange.array); } void readBlockMap(ref PluginDataLoader loader) { ubyte[] data = loader.readEntry(blockMappingKey); if (data.length) { string[] blocks = decodeCborSingleDup!(string[])(data); bm.blockMapping.setMapping(blocks); } } void writeBlockMap(ref PluginDataSaver saver) { auto sink = saver.tempBuffer; size_t size = 0; auto blockInfos = bm.blockMapping.infoArray; size = encodeCborArrayHeader(sink[], blockInfos.length); foreach(info; blockInfos) size += encodeCbor(sink[size..$], info.name); saver.writeEntry(blockMappingKey, size); } }
D
import std.stdio; import std.math; import core.bitop; version (X86_64) version = AnyX86; else version (X86) version = AnyX86; /*******************************************/ void test1() { writefln("%a", sin(6.8L)); auto f = 6.8L; writefln("%a", sin(f)); assert(sin(f) == sin(6.8L)); static assert(approxEqual(sin(6.8L), 0x1.f9f8d9aea10fdf1cp-2)); writefln("%a", cos(6.8L)); f = 6.8L; writefln("%a", cos(f)); assert(cos(f) == cos(6.8L)); static assert(approxEqual(cos(6.8L), 0x1.bd21aaf88dcfa13ap-1)); writefln("%a", tan(6.8L)); f = 6.8L; writefln("%a", tan(f)); version (Win64) { } else assert(tan(f) == tan(6.8L)); static assert(approxEqual(tan(6.8L), 0x1.22fd752af75cd08cp-1)); } /*******************************************/ void test2() { float i = 3; i = i ^^ 2; assert(i == 9); int j = 2; j = j ^^ 1; assert(j == 2); i = 4; i = i ^^ .5; assert(i == 2); } /**** Bug 5703 *****************************/ static assert({ int a = 0x80; int f = bsf(a); int r = bsr(a); a = 0x22; assert(bsf(a)==1); assert(bsr(a)==5); a = 0x8000000; assert(bsf(a)==27); assert(bsr(a)==27); a = 0x13f562c0; assert(bsf(a) == 6); assert(bsr(a) == 28); assert(bswap(0xAABBCCDD) == 0xDDCCBBAA); return true; }()); /*******************************************/ void test3() { version (AnyX86) { static assert( _popcnt( cast(ushort)0 ) == 0 ); static assert( _popcnt( cast(ushort)7 ) == 3 ); static assert( _popcnt( cast(ushort)0xAA )== 4); static assert( _popcnt( cast(ushort)0xFFFF ) == 16 ); static assert( _popcnt( cast(ushort)0xCCCC ) == 8 ); static assert( _popcnt( cast(ushort)0x7777 ) == 12 ); static assert( _popcnt( cast(uint)0 ) == 0 ); static assert( _popcnt( cast(uint)7 ) == 3 ); static assert( _popcnt( cast(uint)0xAA )== 4); static assert( _popcnt( cast(uint)0x8421_1248 ) == 8 ); static assert( _popcnt( cast(uint)0xFFFF_FFFF ) == 32 ); static assert( _popcnt( cast(uint)0xCCCC_CCCC ) == 16 ); static assert( _popcnt( cast(uint)0x7777_7777 ) == 24 ); version (X86_64) { static assert( _popcnt( cast(ulong)0 ) == 0 ); static assert( _popcnt( cast(ulong)7 ) == 3 ); static assert( _popcnt( cast(ulong)0xAA )== 4); static assert( _popcnt( cast(ulong)0x8421_1248 ) == 8 ); static assert( _popcnt( cast(ulong)0xFFFF_FFFF_FFFF_FFFF ) == 64 ); static assert( _popcnt( cast(ulong)0xCCCC_CCCC_CCCC_CCCC ) == 32 ); static assert( _popcnt( cast(ulong)0x7777_7777_7777_7777 ) == 48 ); } } } /*******************************************/ int main() { test1(); test2(); test3(); printf("Success\n"); return 0; }
D
/* * Copyright 2015-2018 HuntLabs.cn * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ module hunt.sql.ast.expr.SQLCaseExpr; import hunt.sql.SQLUtils; import hunt.sql.ast; import hunt.sql.visitor.SQLASTOutputVisitor; import hunt.sql.visitor.SQLASTVisitor; import hunt.collection; import hunt.util.StringBuilder; public class SQLCaseExpr : SQLExprImpl , SQLReplaceable//, Serializable { private List!Item items; private SQLExpr valueExpr; private SQLExpr elseExpr; public this(){ items = new ArrayList!Item(); } public SQLExpr getValueExpr() { return this.valueExpr; } public void setValueExpr(SQLExpr valueExpr) { if (valueExpr !is null) { valueExpr.setParent(this); } this.valueExpr = valueExpr; } public SQLExpr getElseExpr() { return this.elseExpr; } public void setElseExpr(SQLExpr elseExpr) { if (elseExpr !is null) { elseExpr.setParent(this); } this.elseExpr = elseExpr; } public List!Item getItems() { return this.items; } public void addItem(Item item) { if (item !is null) { item.setParent(this); this.items.add(item); } } override protected void accept0(SQLASTVisitor visitor) { if (visitor.visit(this)) { acceptChild(visitor, this.valueExpr); acceptChild!(SQLCaseExpr.Item)(visitor, this.items); acceptChild(visitor, this.elseExpr); } visitor.endVisit(this); } override public List!SQLObject getChildren() { List!SQLObject children = new ArrayList!SQLObject(); if (valueExpr !is null) { children.add(this.valueExpr); } children.addAll(cast(List!SQLObject)(this.items)); if (elseExpr !is null) { children.add(this.elseExpr); } return children; } override public bool replace(SQLExpr expr, SQLExpr target) { if (valueExpr == expr) { setValueExpr(target); return true; } if (elseExpr == expr) { setElseExpr(target); return true; } return false; } public static class Item : SQLObjectImpl , SQLReplaceable//, Serializable { private SQLExpr conditionExpr; private SQLExpr valueExpr; public this(){ } public this(SQLExpr conditionExpr, SQLExpr valueExpr){ setConditionExpr(conditionExpr); setValueExpr(valueExpr); } public SQLExpr getConditionExpr() { return this.conditionExpr; } public void setConditionExpr(SQLExpr conditionExpr) { if (conditionExpr !is null) { conditionExpr.setParent(this); } this.conditionExpr = conditionExpr; } public SQLExpr getValueExpr() { return this.valueExpr; } public void setValueExpr(SQLExpr valueExpr) { if (valueExpr !is null) { valueExpr.setParent(this); } this.valueExpr = valueExpr; } override protected void accept0(SQLASTVisitor visitor) { if (visitor.visit(this)) { acceptChild(visitor, this.conditionExpr); acceptChild(visitor, this.valueExpr); } visitor.endVisit(this); } override public size_t toHash() @trusted nothrow { int prime = 31; size_t result = 1; result = prime * result + ((conditionExpr is null) ? 0 : (cast(Object)conditionExpr).toHash()); result = prime * result + ((valueExpr is null) ? 0 : (cast(Object)valueExpr).toHash()); return result; } override public bool opEquals(Object obj) { if (this is obj) return true; if (obj is null) return false; if (typeid(this) != typeid(obj)) return false; Item other = cast(Item) obj; if (conditionExpr is null) { if (other.conditionExpr !is null) return false; } else if (!(cast(Object)(conditionExpr)).opEquals(cast(Object)(other.conditionExpr))) return false; if (valueExpr is null) { if (other.valueExpr !is null) return false; } else if (!(cast(Object)(valueExpr)).opEquals(cast(Object)(other.valueExpr))) return false; return true; } override public Item clone() { Item x = new Item(); if (conditionExpr !is null) { x.setConditionExpr(conditionExpr.clone()); } if (valueExpr !is null) { x.setValueExpr(valueExpr.clone()); } return x; } override public void output(StringBuilder buf) { new SQLASTOutputVisitor(buf).visit(this); } override public bool replace(SQLExpr expr, SQLExpr target) { if (valueExpr == expr) { setValueExpr(target); return true; } if (conditionExpr == expr) { setConditionExpr(target); return true; } return false; } } override public size_t toHash() @trusted nothrow { int prime = 31; size_t result = 1; result = prime * result + ((elseExpr is null) ? 0 : (cast(Object)elseExpr).toHash()); result = prime * result + ((items is null) ? 0 : (cast(Object)items).toHash()); result = prime * result + ((valueExpr is null) ? 0 : (cast(Object)valueExpr).toHash()); return result; } override public bool opEquals(Object obj) { if (this is obj) { return true; } if (obj is null) { return false; } if (typeid(this) != typeid(obj)) { return false; } SQLCaseExpr other = cast(SQLCaseExpr) obj; if (elseExpr is null) { if (other.elseExpr !is null) { return false; } } else if (!(cast(Object)(elseExpr)).opEquals(cast(Object)(other.elseExpr))) { return false; } if (items is null) { if (other.items !is null) { return false; } } else if (!(cast(Object)(items)).opEquals(cast(Object)(other.items))) { return false; } if (valueExpr is null) { if (other.valueExpr !is null) { return false; } } else if (!(cast(Object)(valueExpr)).opEquals(cast(Object)(other.valueExpr))) { return false; } return true; } override public SQLCaseExpr clone() { SQLCaseExpr x = new SQLCaseExpr(); foreach (Item item ; items) { x.addItem(item.clone()); } if (valueExpr !is null) { x.setValueExpr(valueExpr.clone()); } if (elseExpr !is null) { x.setElseExpr(elseExpr.clone()); } return x; } override public SQLDataType computeDataType() { foreach (Item item ; items) { SQLExpr expr = item.getValueExpr(); if (expr !is null) { SQLDataType dataType = expr.computeDataType(); if (dataType !is null) { return dataType; } } } if(elseExpr !is null) { return elseExpr.computeDataType(); } return null; } override public string toString() { return SQLUtils.toSQLString(this, null); } }
D
/Users/ucfadmin/Desktop/KTAppUpdate/Build/Intermediates/KTAppUpdate.build/Debug-iphonesimulator/KTAppUpdate.build/Objects-normal/x86_64/KTVersion.o : /Users/ucfadmin/Desktop/KTAppUpdate/KTAppUpdate/KTVersion.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Dispatch.apinotesc /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/ObjectiveC.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreImage.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/QuartzCore.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Dispatch.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Metal.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Darwin.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Foundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreFoundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreGraphics.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Swift.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/UIKit.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/SwiftOnoneSupport.swiftmodule /Users/ucfadmin/Desktop/KTAppUpdate/KTAppUpdate/KTAppUpdate.h /Users/ucfadmin/Desktop/KTAppUpdate/Build/Intermediates/KTAppUpdate.build/Debug-iphonesimulator/KTAppUpdate.build/unextended-module.modulemap /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.0.sdk/usr/include/objc/ObjectiveC.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.0.sdk/System/Library/Frameworks/OpenGLES.framework/Headers/OpenGLES.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.0.sdk/System/Library/Frameworks/CoreImage.framework/Headers/CoreImage.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.0.sdk/System/Library/Frameworks/QuartzCore.framework/Headers/QuartzCore.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.0.sdk/System/Library/Frameworks/Metal.framework/Headers/Metal.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.0.sdk/usr/include/Darwin.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.0.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.0.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.0.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIKit.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.0.sdk/System/Library/Frameworks/CoreText.framework/Headers/CoreText.apinotes /Users/ucfadmin/Desktop/KTAppUpdate/Build/Intermediates/KTAppUpdate.build/Debug-iphonesimulator/KTAppUpdate.build/Objects-normal/x86_64/KTVersion~partial.swiftmodule : /Users/ucfadmin/Desktop/KTAppUpdate/KTAppUpdate/KTVersion.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Dispatch.apinotesc /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/ObjectiveC.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreImage.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/QuartzCore.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Dispatch.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Metal.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Darwin.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Foundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreFoundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreGraphics.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Swift.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/UIKit.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/SwiftOnoneSupport.swiftmodule /Users/ucfadmin/Desktop/KTAppUpdate/KTAppUpdate/KTAppUpdate.h /Users/ucfadmin/Desktop/KTAppUpdate/Build/Intermediates/KTAppUpdate.build/Debug-iphonesimulator/KTAppUpdate.build/unextended-module.modulemap /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.0.sdk/usr/include/objc/ObjectiveC.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.0.sdk/System/Library/Frameworks/OpenGLES.framework/Headers/OpenGLES.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.0.sdk/System/Library/Frameworks/CoreImage.framework/Headers/CoreImage.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.0.sdk/System/Library/Frameworks/QuartzCore.framework/Headers/QuartzCore.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.0.sdk/System/Library/Frameworks/Metal.framework/Headers/Metal.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.0.sdk/usr/include/Darwin.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.0.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.0.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.0.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIKit.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.0.sdk/System/Library/Frameworks/CoreText.framework/Headers/CoreText.apinotes /Users/ucfadmin/Desktop/KTAppUpdate/Build/Intermediates/KTAppUpdate.build/Debug-iphonesimulator/KTAppUpdate.build/Objects-normal/x86_64/KTVersion~partial.swiftdoc : /Users/ucfadmin/Desktop/KTAppUpdate/KTAppUpdate/KTVersion.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Dispatch.apinotesc /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/ObjectiveC.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreImage.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/QuartzCore.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Dispatch.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Metal.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Darwin.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Foundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreFoundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreGraphics.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Swift.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/UIKit.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/SwiftOnoneSupport.swiftmodule /Users/ucfadmin/Desktop/KTAppUpdate/KTAppUpdate/KTAppUpdate.h /Users/ucfadmin/Desktop/KTAppUpdate/Build/Intermediates/KTAppUpdate.build/Debug-iphonesimulator/KTAppUpdate.build/unextended-module.modulemap /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.0.sdk/usr/include/objc/ObjectiveC.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.0.sdk/System/Library/Frameworks/OpenGLES.framework/Headers/OpenGLES.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.0.sdk/System/Library/Frameworks/CoreImage.framework/Headers/CoreImage.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.0.sdk/System/Library/Frameworks/QuartzCore.framework/Headers/QuartzCore.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.0.sdk/System/Library/Frameworks/Metal.framework/Headers/Metal.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.0.sdk/usr/include/Darwin.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.0.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.0.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.0.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIKit.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.0.sdk/System/Library/Frameworks/CoreText.framework/Headers/CoreText.apinotes
D
/Users/manish/Documents/PingCap_TalentPlan_Projects/Project1/target/rls/debug/deps/kvs-b693d4b9caa12a9b.rmeta: src/lib.rs /Users/manish/Documents/PingCap_TalentPlan_Projects/Project1/target/rls/debug/deps/kvs-b693d4b9caa12a9b.d: src/lib.rs src/lib.rs:
D
module arc.string_store; import core.stdc.string : memset; import shard.hash : Hash32, hash32_of; import shard.math_util : round_to_next; import shard.memory : Allocator, gib, page_size, VirtualAllocator; import shard.pad : pad_bytes; import std.algorithm : filter; public import shard.hash : StringId = Hash32; /** Fixed-location store for interning strings. */ struct StringStore { enum initial_entry_size = 64; enum max_string_store_size = 4.gib; this(Allocator struct_allocator, VirtualAllocator* string_allocator, uint max_probes = 32) { _struct_allocator = struct_allocator; _vm = string_allocator; _max_probes = max_probes; _entries = _struct_allocator.make_array!Entry(initial_entry_size); _string_array = cast(char[]) _vm.reserve(max_string_store_size); } @disable this(this); ~this() { if (_vm && _struct_allocator) { _vm.free(_string_array); _struct_allocator.dispose(_entries); } } size_t size() { return _num_saved; } StringId save(const char[] str) { const hash = hash32_of(str); ulong index = hash.value % _entries.length, probes = 0; while (true) { auto slot = &_entries[index]; if (slot.hash == Hash32()) { if (_chars_written + str.length > max_string_store_size) assert(0, "String store at capacity!"); if (_chars_committed < _chars_written + str.length) { const needed = (_chars_written + str.length - _chars_committed); const aligned = round_to_next(needed, page_size); _vm.commit(_string_array[_chars_committed .. _chars_committed + aligned]); _chars_committed += aligned; } slot.hash = hash; slot.first = _chars_written; slot.one_past_last = _chars_written + cast(uint) str.length; _string_array[_chars_written .. _chars_written + str.length] = str; _chars_written += str.length; _num_saved++; return hash; } else if (slot.hash == hash) { // String is already present in the map. return slot.hash; } else { index = (index + 1) % _entries.length; probes++; if (probes == _max_probes) { _rehash(); probes = 0; index = hash.value % _entries.length; continue; } // Prefer rare branch (at most once per get()) than modulo every // loop iteration. if (index == _entries.length) index = 0; } } assert(0, "Unreachable"); } const(char[]) get(StringId id) { ulong index = id.value % _entries.length, probes = 0; while (probes < _max_probes && _entries[index].hash != id) { index = (index + 1) % _entries.length; probes++; // Prefer rare branch (at most once per get()) than modulo every // loop iteration. if (index == _entries.length) index = 0; } auto entry = &_entries[index]; return entry.hash == id ? _string_array[entry.first .. entry.one_past_last] : null; } private: struct Entry { Hash32 hash; uint first; uint one_past_last; static assert(Entry.sizeof == 12); } void _rehash() { Entry[] new_entries = _struct_allocator.make_array!Entry(_entries.length * 2); rehash: while (true) { map_entries: for (auto i = 0; i < _entries.length; i++) { const entry = &_entries[i]; if (_entries[i].hash == Hash32()) continue map_entries; ulong index = entry.hash.value % new_entries.length, probes = 0; // Find empty slot. while (probes < _max_probes && new_entries[index].hash != Hash32()) { index = (index + 1) % new_entries.length; probes++; // Prefer rare branch (at most once per get()) than modulo // every loop iteration. if (index == new_entries.length) index = 0; } // Grow if probe length exceeded. if (probes == _max_probes) { _struct_allocator.resize_array(new_entries, new_entries.length * 2); memset(new_entries.ptr, 0, new_entries.sizeof * new_entries.length); continue rehash; } assert(new_entries[index].hash == Hash32()); new_entries[index] = *entry; } break rehash; } _struct_allocator.dispose(_entries); _entries = new_entries; } Allocator _struct_allocator; VirtualAllocator* _vm; uint _num_saved; uint _max_probes; Entry[] _entries; uint _chars_written; uint _chars_committed; char[] _string_array; } unittest { import shard.memory : AllocatorApi, SysAllocator, Arena, MemoryTracker, MemoryStats; import std.format : format; auto struct_mem = new AllocatorApi!(MemoryTracker!SysAllocator)(); VirtualAllocator vm; auto store = StringStore(struct_mem, &vm); void test_mem_stats(size_t struct_allocs, size_t string_allocs) { MemoryStats stats; struct_mem.impl.get_stats(stats); assert(stats.num_allocations == struct_allocs); } const a = store.save("0"); assert(store.size == 1); assert(store.get(a) == "0"); test_mem_stats(1, 1); assert(store.save("0") == a); test_mem_stats(1, 1); // Make sure that we cross page boundaries. foreach (i; 1 .. 8192) { store.save(format!"%s"(i)); assert(store.size == i + 1); test_mem_stats(1, i + 1); } destroy(store); test_mem_stats(0, 0); }
D
/Users/petercernak/vapor/TILApp/Build/Intermediates.noindex/TILApp.build/Debug/SQL.build/Objects-normal/x86_64/SQLQueryEncoder.o : /Users/petercernak/vapor/TILApp/.build/checkouts/sql.git--5031097865152321144/Sources/SQL/SQLBind.swift /Users/petercernak/vapor/TILApp/.build/checkouts/sql.git--5031097865152321144/Sources/SQL/SQLJoinMethod.swift /Users/petercernak/vapor/TILApp/.build/checkouts/sql.git--5031097865152321144/Sources/SQL/SQLTable.swift /Users/petercernak/vapor/TILApp/.build/checkouts/sql.git--5031097865152321144/Sources/SQL/SQLCreateTable.swift /Users/petercernak/vapor/TILApp/.build/checkouts/sql.git--5031097865152321144/Sources/SQL/SQLDropTable.swift /Users/petercernak/vapor/TILApp/.build/checkouts/sql.git--5031097865152321144/Sources/SQL/SQLAlterTable.swift /Users/petercernak/vapor/TILApp/.build/checkouts/sql.git--5031097865152321144/Sources/SQL/SQLSerializable.swift /Users/petercernak/vapor/TILApp/.build/checkouts/sql.git--5031097865152321144/Sources/SQL/SQLDataType.swift /Users/petercernak/vapor/TILApp/.build/checkouts/sql.git--5031097865152321144/Sources/SQL/SQLUpdate.swift /Users/petercernak/vapor/TILApp/.build/checkouts/sql.git--5031097865152321144/Sources/SQL/SQLDelete.swift /Users/petercernak/vapor/TILApp/.build/checkouts/sql.git--5031097865152321144/Sources/SQL/SQLLiteral.swift /Users/petercernak/vapor/TILApp/.build/checkouts/sql.git--5031097865152321144/Sources/SQL/SQLBoolLiteral.swift /Users/petercernak/vapor/TILApp/.build/checkouts/sql.git--5031097865152321144/Sources/SQL/SQLDefaultLiteral.swift /Users/petercernak/vapor/TILApp/.build/checkouts/sql.git--5031097865152321144/Sources/SQL/SQLTableConstraintAlgorithm.swift /Users/petercernak/vapor/TILApp/.build/checkouts/sql.git--5031097865152321144/Sources/SQL/SQLColumnConstraintAlgorithm.swift /Users/petercernak/vapor/TILApp/.build/checkouts/sql.git--5031097865152321144/Sources/SQL/SQLJoin.swift /Users/petercernak/vapor/TILApp/.build/checkouts/sql.git--5031097865152321144/Sources/SQL/SQLExpression.swift /Users/petercernak/vapor/TILApp/.build/checkouts/sql.git--5031097865152321144/Sources/SQL/SQLSelectExpression.swift /Users/petercernak/vapor/TILApp/.build/checkouts/sql.git--5031097865152321144/Sources/SQL/SQLCollation.swift /Users/petercernak/vapor/TILApp/.build/checkouts/sql.git--5031097865152321144/Sources/SQL/SQLForeignKeyAction.swift /Users/petercernak/vapor/TILApp/.build/checkouts/sql.git--5031097865152321144/Sources/SQL/SQLConnection.swift /Users/petercernak/vapor/TILApp/.build/checkouts/sql.git--5031097865152321144/Sources/SQL/SQLDirection.swift /Users/petercernak/vapor/TILApp/.build/checkouts/sql.git--5031097865152321144/Sources/SQL/SQLFunction.swift /Users/petercernak/vapor/TILApp/.build/checkouts/sql.git--5031097865152321144/Sources/SQL/SQLColumnDefinition.swift /Users/petercernak/vapor/TILApp/.build/checkouts/sql.git--5031097865152321144/Sources/SQL/SQLCreateTableBuilder.swift /Users/petercernak/vapor/TILApp/.build/checkouts/sql.git--5031097865152321144/Sources/SQL/SQLDropTableBuilder.swift /Users/petercernak/vapor/TILApp/.build/checkouts/sql.git--5031097865152321144/Sources/SQL/SQLAlterTableBuilder.swift /Users/petercernak/vapor/TILApp/.build/checkouts/sql.git--5031097865152321144/Sources/SQL/SQLPredicateBuilder.swift /Users/petercernak/vapor/TILApp/.build/checkouts/sql.git--5031097865152321144/Sources/SQL/SQLUpdateBuilder.swift /Users/petercernak/vapor/TILApp/.build/checkouts/sql.git--5031097865152321144/Sources/SQL/SQLDeleteBuilder.swift /Users/petercernak/vapor/TILApp/.build/checkouts/sql.git--5031097865152321144/Sources/SQL/SQLColumnBuilder.swift /Users/petercernak/vapor/TILApp/.build/checkouts/sql.git--5031097865152321144/Sources/SQL/SQLPredicateGroupBuilder.swift /Users/petercernak/vapor/TILApp/.build/checkouts/sql.git--5031097865152321144/Sources/SQL/SQLSelectBuilder.swift /Users/petercernak/vapor/TILApp/.build/checkouts/sql.git--5031097865152321144/Sources/SQL/SQLInsertBuilder.swift /Users/petercernak/vapor/TILApp/.build/checkouts/sql.git--5031097865152321144/Sources/SQL/SQLRawBuilder.swift /Users/petercernak/vapor/TILApp/.build/checkouts/sql.git--5031097865152321144/Sources/SQL/SQLCreateIndexBuilder.swift /Users/petercernak/vapor/TILApp/.build/checkouts/sql.git--5031097865152321144/Sources/SQL/SQLQueryBuilder.swift /Users/petercernak/vapor/TILApp/.build/checkouts/sql.git--5031097865152321144/Sources/SQL/SQLQueryEncoder.swift /Users/petercernak/vapor/TILApp/.build/checkouts/sql.git--5031097865152321144/Sources/SQL/SQLQueryFetcher.swift /Users/petercernak/vapor/TILApp/.build/checkouts/sql.git--5031097865152321144/Sources/SQL/SQLIndexModifier.swift /Users/petercernak/vapor/TILApp/.build/checkouts/sql.git--5031097865152321144/Sources/SQL/SQLIdentifier.swift /Users/petercernak/vapor/TILApp/.build/checkouts/sql.git--5031097865152321144/Sources/SQL/SQLTableIdentifier.swift /Users/petercernak/vapor/TILApp/.build/checkouts/sql.git--5031097865152321144/Sources/SQL/SQLColumnIdentifier.swift /Users/petercernak/vapor/TILApp/.build/checkouts/sql.git--5031097865152321144/Sources/SQL/SQLError.swift /Users/petercernak/vapor/TILApp/.build/checkouts/sql.git--5031097865152321144/Sources/SQL/SQLBinaryOperator.swift /Users/petercernak/vapor/TILApp/.build/checkouts/sql.git--5031097865152321144/Sources/SQL/Exports.swift /Users/petercernak/vapor/TILApp/.build/checkouts/sql.git--5031097865152321144/Sources/SQL/SQLSelect.swift /Users/petercernak/vapor/TILApp/.build/checkouts/sql.git--5031097865152321144/Sources/SQL/SQLDistinct.swift /Users/petercernak/vapor/TILApp/.build/checkouts/sql.git--5031097865152321144/Sources/SQL/SQLFunctionArgument.swift /Users/petercernak/vapor/TILApp/.build/checkouts/sql.git--5031097865152321144/Sources/SQL/SQLTableConstraint.swift /Users/petercernak/vapor/TILApp/.build/checkouts/sql.git--5031097865152321144/Sources/SQL/SQLColumnConstraint.swift /Users/petercernak/vapor/TILApp/.build/checkouts/sql.git--5031097865152321144/Sources/SQL/SQLInsert.swift /Users/petercernak/vapor/TILApp/.build/checkouts/sql.git--5031097865152321144/Sources/SQL/SQLCreateIndex.swift /Users/petercernak/vapor/TILApp/.build/checkouts/sql.git--5031097865152321144/Sources/SQL/SQLDropIndex.swift /Users/petercernak/vapor/TILApp/.build/checkouts/sql.git--5031097865152321144/Sources/SQL/SQLGroupBy.swift /Users/petercernak/vapor/TILApp/.build/checkouts/sql.git--5031097865152321144/Sources/SQL/SQLOrderBy.swift /Users/petercernak/vapor/TILApp/.build/checkouts/sql.git--5031097865152321144/Sources/SQL/SQLForeignKey.swift /Users/petercernak/vapor/TILApp/.build/checkouts/sql.git--5031097865152321144/Sources/SQL/SQLPrimaryKey.swift /Users/petercernak/vapor/TILApp/.build/checkouts/sql.git--5031097865152321144/Sources/SQL/SQLQuery.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Dispatch.apinotesc /Users/petercernak/vapor/TILApp/Build/Products/Debug/NIO.framework/Modules/NIO.swiftmodule/x86_64.swiftmodule /Users/petercernak/vapor/TILApp/Build/Products/Debug/Async.framework/Modules/Async.swiftmodule/x86_64.swiftmodule /Users/petercernak/vapor/TILApp/Build/Products/Debug/Service.framework/Modules/Service.swiftmodule/x86_64.swiftmodule /Users/petercernak/vapor/TILApp/Build/Products/Debug/Core.framework/Modules/Core.swiftmodule/x86_64.swiftmodule /Users/petercernak/vapor/TILApp/Build/Products/Debug/Debugging.framework/Modules/Debugging.swiftmodule/x86_64.swiftmodule /Users/petercernak/vapor/TILApp/Build/Products/Debug/COperatingSystem.framework/Modules/COperatingSystem.swiftmodule/x86_64.swiftmodule /Users/petercernak/vapor/TILApp/Build/Products/Debug/NIOConcurrencyHelpers.framework/Modules/NIOConcurrencyHelpers.swiftmodule/x86_64.swiftmodule /Users/petercernak/vapor/TILApp/Build/Products/Debug/Bits.framework/Modules/Bits.swiftmodule/x86_64.swiftmodule /Users/petercernak/vapor/TILApp/Build/Products/Debug/NIOFoundationCompat.framework/Modules/NIOFoundationCompat.swiftmodule/x86_64.swiftmodule /Users/petercernak/vapor/TILApp/Build/Products/Debug/DatabaseKit.framework/Modules/DatabaseKit.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/ObjectiveC.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Dispatch.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Darwin.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Foundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/CoreFoundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/CoreGraphics.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Swift.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/IOKit.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/SwiftOnoneSupport.swiftmodule /Users/petercernak/vapor/TILApp/.build/checkouts/swift-nio.git--2128188973977302459/Sources/CNIOAtomics/include/cpp_magic.h /Users/petercernak/vapor/TILApp/.build/checkouts/swift-nio.git--2128188973977302459/Sources/CNIODarwin/include/c_nio_darwin.h /Users/petercernak/vapor/TILApp/.build/checkouts/swift-nio.git--2128188973977302459/Sources/CNIOAtomics/include/c-atomics.h /Users/petercernak/vapor/TILApp/.build/checkouts/swift-nio.git--2128188973977302459/Sources/CNIOLinux/include/c_nio_linux.h /Users/petercernak/vapor/TILApp/TILApp.xcodeproj/GeneratedModuleMap/CNIOSHA1/module.modulemap /Users/petercernak/vapor/TILApp/.build/checkouts/swift-nio-zlib-support.git--6538424668019974428/module.modulemap /Users/petercernak/vapor/TILApp/TILApp.xcodeproj/GeneratedModuleMap/CNIODarwin/module.modulemap /Users/petercernak/vapor/TILApp/TILApp.xcodeproj/GeneratedModuleMap/CNIOAtomics/module.modulemap /Users/petercernak/vapor/TILApp/TILApp.xcodeproj/GeneratedModuleMap/CNIOLinux/module.modulemap /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/objc/ObjectiveC.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/Darwin.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/ApplicationServices.framework/Headers/ApplicationServices.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/CoreText.framework/Headers/CoreText.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/Security.framework/Headers/Security.apinotes /Users/petercernak/vapor/TILApp/Build/Intermediates.noindex/TILApp.build/Debug/SQL.build/Objects-normal/x86_64/SQLQueryEncoder~partial.swiftmodule : /Users/petercernak/vapor/TILApp/.build/checkouts/sql.git--5031097865152321144/Sources/SQL/SQLBind.swift /Users/petercernak/vapor/TILApp/.build/checkouts/sql.git--5031097865152321144/Sources/SQL/SQLJoinMethod.swift /Users/petercernak/vapor/TILApp/.build/checkouts/sql.git--5031097865152321144/Sources/SQL/SQLTable.swift /Users/petercernak/vapor/TILApp/.build/checkouts/sql.git--5031097865152321144/Sources/SQL/SQLCreateTable.swift /Users/petercernak/vapor/TILApp/.build/checkouts/sql.git--5031097865152321144/Sources/SQL/SQLDropTable.swift /Users/petercernak/vapor/TILApp/.build/checkouts/sql.git--5031097865152321144/Sources/SQL/SQLAlterTable.swift /Users/petercernak/vapor/TILApp/.build/checkouts/sql.git--5031097865152321144/Sources/SQL/SQLSerializable.swift /Users/petercernak/vapor/TILApp/.build/checkouts/sql.git--5031097865152321144/Sources/SQL/SQLDataType.swift /Users/petercernak/vapor/TILApp/.build/checkouts/sql.git--5031097865152321144/Sources/SQL/SQLUpdate.swift /Users/petercernak/vapor/TILApp/.build/checkouts/sql.git--5031097865152321144/Sources/SQL/SQLDelete.swift /Users/petercernak/vapor/TILApp/.build/checkouts/sql.git--5031097865152321144/Sources/SQL/SQLLiteral.swift /Users/petercernak/vapor/TILApp/.build/checkouts/sql.git--5031097865152321144/Sources/SQL/SQLBoolLiteral.swift /Users/petercernak/vapor/TILApp/.build/checkouts/sql.git--5031097865152321144/Sources/SQL/SQLDefaultLiteral.swift /Users/petercernak/vapor/TILApp/.build/checkouts/sql.git--5031097865152321144/Sources/SQL/SQLTableConstraintAlgorithm.swift /Users/petercernak/vapor/TILApp/.build/checkouts/sql.git--5031097865152321144/Sources/SQL/SQLColumnConstraintAlgorithm.swift /Users/petercernak/vapor/TILApp/.build/checkouts/sql.git--5031097865152321144/Sources/SQL/SQLJoin.swift /Users/petercernak/vapor/TILApp/.build/checkouts/sql.git--5031097865152321144/Sources/SQL/SQLExpression.swift /Users/petercernak/vapor/TILApp/.build/checkouts/sql.git--5031097865152321144/Sources/SQL/SQLSelectExpression.swift /Users/petercernak/vapor/TILApp/.build/checkouts/sql.git--5031097865152321144/Sources/SQL/SQLCollation.swift /Users/petercernak/vapor/TILApp/.build/checkouts/sql.git--5031097865152321144/Sources/SQL/SQLForeignKeyAction.swift /Users/petercernak/vapor/TILApp/.build/checkouts/sql.git--5031097865152321144/Sources/SQL/SQLConnection.swift /Users/petercernak/vapor/TILApp/.build/checkouts/sql.git--5031097865152321144/Sources/SQL/SQLDirection.swift /Users/petercernak/vapor/TILApp/.build/checkouts/sql.git--5031097865152321144/Sources/SQL/SQLFunction.swift /Users/petercernak/vapor/TILApp/.build/checkouts/sql.git--5031097865152321144/Sources/SQL/SQLColumnDefinition.swift /Users/petercernak/vapor/TILApp/.build/checkouts/sql.git--5031097865152321144/Sources/SQL/SQLCreateTableBuilder.swift /Users/petercernak/vapor/TILApp/.build/checkouts/sql.git--5031097865152321144/Sources/SQL/SQLDropTableBuilder.swift /Users/petercernak/vapor/TILApp/.build/checkouts/sql.git--5031097865152321144/Sources/SQL/SQLAlterTableBuilder.swift /Users/petercernak/vapor/TILApp/.build/checkouts/sql.git--5031097865152321144/Sources/SQL/SQLPredicateBuilder.swift /Users/petercernak/vapor/TILApp/.build/checkouts/sql.git--5031097865152321144/Sources/SQL/SQLUpdateBuilder.swift /Users/petercernak/vapor/TILApp/.build/checkouts/sql.git--5031097865152321144/Sources/SQL/SQLDeleteBuilder.swift /Users/petercernak/vapor/TILApp/.build/checkouts/sql.git--5031097865152321144/Sources/SQL/SQLColumnBuilder.swift /Users/petercernak/vapor/TILApp/.build/checkouts/sql.git--5031097865152321144/Sources/SQL/SQLPredicateGroupBuilder.swift /Users/petercernak/vapor/TILApp/.build/checkouts/sql.git--5031097865152321144/Sources/SQL/SQLSelectBuilder.swift /Users/petercernak/vapor/TILApp/.build/checkouts/sql.git--5031097865152321144/Sources/SQL/SQLInsertBuilder.swift /Users/petercernak/vapor/TILApp/.build/checkouts/sql.git--5031097865152321144/Sources/SQL/SQLRawBuilder.swift /Users/petercernak/vapor/TILApp/.build/checkouts/sql.git--5031097865152321144/Sources/SQL/SQLCreateIndexBuilder.swift /Users/petercernak/vapor/TILApp/.build/checkouts/sql.git--5031097865152321144/Sources/SQL/SQLQueryBuilder.swift /Users/petercernak/vapor/TILApp/.build/checkouts/sql.git--5031097865152321144/Sources/SQL/SQLQueryEncoder.swift /Users/petercernak/vapor/TILApp/.build/checkouts/sql.git--5031097865152321144/Sources/SQL/SQLQueryFetcher.swift /Users/petercernak/vapor/TILApp/.build/checkouts/sql.git--5031097865152321144/Sources/SQL/SQLIndexModifier.swift /Users/petercernak/vapor/TILApp/.build/checkouts/sql.git--5031097865152321144/Sources/SQL/SQLIdentifier.swift /Users/petercernak/vapor/TILApp/.build/checkouts/sql.git--5031097865152321144/Sources/SQL/SQLTableIdentifier.swift /Users/petercernak/vapor/TILApp/.build/checkouts/sql.git--5031097865152321144/Sources/SQL/SQLColumnIdentifier.swift /Users/petercernak/vapor/TILApp/.build/checkouts/sql.git--5031097865152321144/Sources/SQL/SQLError.swift /Users/petercernak/vapor/TILApp/.build/checkouts/sql.git--5031097865152321144/Sources/SQL/SQLBinaryOperator.swift /Users/petercernak/vapor/TILApp/.build/checkouts/sql.git--5031097865152321144/Sources/SQL/Exports.swift /Users/petercernak/vapor/TILApp/.build/checkouts/sql.git--5031097865152321144/Sources/SQL/SQLSelect.swift /Users/petercernak/vapor/TILApp/.build/checkouts/sql.git--5031097865152321144/Sources/SQL/SQLDistinct.swift /Users/petercernak/vapor/TILApp/.build/checkouts/sql.git--5031097865152321144/Sources/SQL/SQLFunctionArgument.swift /Users/petercernak/vapor/TILApp/.build/checkouts/sql.git--5031097865152321144/Sources/SQL/SQLTableConstraint.swift /Users/petercernak/vapor/TILApp/.build/checkouts/sql.git--5031097865152321144/Sources/SQL/SQLColumnConstraint.swift /Users/petercernak/vapor/TILApp/.build/checkouts/sql.git--5031097865152321144/Sources/SQL/SQLInsert.swift /Users/petercernak/vapor/TILApp/.build/checkouts/sql.git--5031097865152321144/Sources/SQL/SQLCreateIndex.swift /Users/petercernak/vapor/TILApp/.build/checkouts/sql.git--5031097865152321144/Sources/SQL/SQLDropIndex.swift /Users/petercernak/vapor/TILApp/.build/checkouts/sql.git--5031097865152321144/Sources/SQL/SQLGroupBy.swift /Users/petercernak/vapor/TILApp/.build/checkouts/sql.git--5031097865152321144/Sources/SQL/SQLOrderBy.swift /Users/petercernak/vapor/TILApp/.build/checkouts/sql.git--5031097865152321144/Sources/SQL/SQLForeignKey.swift /Users/petercernak/vapor/TILApp/.build/checkouts/sql.git--5031097865152321144/Sources/SQL/SQLPrimaryKey.swift /Users/petercernak/vapor/TILApp/.build/checkouts/sql.git--5031097865152321144/Sources/SQL/SQLQuery.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Dispatch.apinotesc /Users/petercernak/vapor/TILApp/Build/Products/Debug/NIO.framework/Modules/NIO.swiftmodule/x86_64.swiftmodule /Users/petercernak/vapor/TILApp/Build/Products/Debug/Async.framework/Modules/Async.swiftmodule/x86_64.swiftmodule /Users/petercernak/vapor/TILApp/Build/Products/Debug/Service.framework/Modules/Service.swiftmodule/x86_64.swiftmodule /Users/petercernak/vapor/TILApp/Build/Products/Debug/Core.framework/Modules/Core.swiftmodule/x86_64.swiftmodule /Users/petercernak/vapor/TILApp/Build/Products/Debug/Debugging.framework/Modules/Debugging.swiftmodule/x86_64.swiftmodule /Users/petercernak/vapor/TILApp/Build/Products/Debug/COperatingSystem.framework/Modules/COperatingSystem.swiftmodule/x86_64.swiftmodule /Users/petercernak/vapor/TILApp/Build/Products/Debug/NIOConcurrencyHelpers.framework/Modules/NIOConcurrencyHelpers.swiftmodule/x86_64.swiftmodule /Users/petercernak/vapor/TILApp/Build/Products/Debug/Bits.framework/Modules/Bits.swiftmodule/x86_64.swiftmodule /Users/petercernak/vapor/TILApp/Build/Products/Debug/NIOFoundationCompat.framework/Modules/NIOFoundationCompat.swiftmodule/x86_64.swiftmodule /Users/petercernak/vapor/TILApp/Build/Products/Debug/DatabaseKit.framework/Modules/DatabaseKit.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/ObjectiveC.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Dispatch.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Darwin.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Foundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/CoreFoundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/CoreGraphics.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Swift.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/IOKit.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/SwiftOnoneSupport.swiftmodule /Users/petercernak/vapor/TILApp/.build/checkouts/swift-nio.git--2128188973977302459/Sources/CNIOAtomics/include/cpp_magic.h /Users/petercernak/vapor/TILApp/.build/checkouts/swift-nio.git--2128188973977302459/Sources/CNIODarwin/include/c_nio_darwin.h /Users/petercernak/vapor/TILApp/.build/checkouts/swift-nio.git--2128188973977302459/Sources/CNIOAtomics/include/c-atomics.h /Users/petercernak/vapor/TILApp/.build/checkouts/swift-nio.git--2128188973977302459/Sources/CNIOLinux/include/c_nio_linux.h /Users/petercernak/vapor/TILApp/TILApp.xcodeproj/GeneratedModuleMap/CNIOSHA1/module.modulemap /Users/petercernak/vapor/TILApp/.build/checkouts/swift-nio-zlib-support.git--6538424668019974428/module.modulemap /Users/petercernak/vapor/TILApp/TILApp.xcodeproj/GeneratedModuleMap/CNIODarwin/module.modulemap /Users/petercernak/vapor/TILApp/TILApp.xcodeproj/GeneratedModuleMap/CNIOAtomics/module.modulemap /Users/petercernak/vapor/TILApp/TILApp.xcodeproj/GeneratedModuleMap/CNIOLinux/module.modulemap /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/objc/ObjectiveC.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/Darwin.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/ApplicationServices.framework/Headers/ApplicationServices.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/CoreText.framework/Headers/CoreText.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/Security.framework/Headers/Security.apinotes /Users/petercernak/vapor/TILApp/Build/Intermediates.noindex/TILApp.build/Debug/SQL.build/Objects-normal/x86_64/SQLQueryEncoder~partial.swiftdoc : /Users/petercernak/vapor/TILApp/.build/checkouts/sql.git--5031097865152321144/Sources/SQL/SQLBind.swift /Users/petercernak/vapor/TILApp/.build/checkouts/sql.git--5031097865152321144/Sources/SQL/SQLJoinMethod.swift /Users/petercernak/vapor/TILApp/.build/checkouts/sql.git--5031097865152321144/Sources/SQL/SQLTable.swift /Users/petercernak/vapor/TILApp/.build/checkouts/sql.git--5031097865152321144/Sources/SQL/SQLCreateTable.swift /Users/petercernak/vapor/TILApp/.build/checkouts/sql.git--5031097865152321144/Sources/SQL/SQLDropTable.swift /Users/petercernak/vapor/TILApp/.build/checkouts/sql.git--5031097865152321144/Sources/SQL/SQLAlterTable.swift /Users/petercernak/vapor/TILApp/.build/checkouts/sql.git--5031097865152321144/Sources/SQL/SQLSerializable.swift /Users/petercernak/vapor/TILApp/.build/checkouts/sql.git--5031097865152321144/Sources/SQL/SQLDataType.swift /Users/petercernak/vapor/TILApp/.build/checkouts/sql.git--5031097865152321144/Sources/SQL/SQLUpdate.swift /Users/petercernak/vapor/TILApp/.build/checkouts/sql.git--5031097865152321144/Sources/SQL/SQLDelete.swift /Users/petercernak/vapor/TILApp/.build/checkouts/sql.git--5031097865152321144/Sources/SQL/SQLLiteral.swift /Users/petercernak/vapor/TILApp/.build/checkouts/sql.git--5031097865152321144/Sources/SQL/SQLBoolLiteral.swift /Users/petercernak/vapor/TILApp/.build/checkouts/sql.git--5031097865152321144/Sources/SQL/SQLDefaultLiteral.swift /Users/petercernak/vapor/TILApp/.build/checkouts/sql.git--5031097865152321144/Sources/SQL/SQLTableConstraintAlgorithm.swift /Users/petercernak/vapor/TILApp/.build/checkouts/sql.git--5031097865152321144/Sources/SQL/SQLColumnConstraintAlgorithm.swift /Users/petercernak/vapor/TILApp/.build/checkouts/sql.git--5031097865152321144/Sources/SQL/SQLJoin.swift /Users/petercernak/vapor/TILApp/.build/checkouts/sql.git--5031097865152321144/Sources/SQL/SQLExpression.swift /Users/petercernak/vapor/TILApp/.build/checkouts/sql.git--5031097865152321144/Sources/SQL/SQLSelectExpression.swift /Users/petercernak/vapor/TILApp/.build/checkouts/sql.git--5031097865152321144/Sources/SQL/SQLCollation.swift /Users/petercernak/vapor/TILApp/.build/checkouts/sql.git--5031097865152321144/Sources/SQL/SQLForeignKeyAction.swift /Users/petercernak/vapor/TILApp/.build/checkouts/sql.git--5031097865152321144/Sources/SQL/SQLConnection.swift /Users/petercernak/vapor/TILApp/.build/checkouts/sql.git--5031097865152321144/Sources/SQL/SQLDirection.swift /Users/petercernak/vapor/TILApp/.build/checkouts/sql.git--5031097865152321144/Sources/SQL/SQLFunction.swift /Users/petercernak/vapor/TILApp/.build/checkouts/sql.git--5031097865152321144/Sources/SQL/SQLColumnDefinition.swift /Users/petercernak/vapor/TILApp/.build/checkouts/sql.git--5031097865152321144/Sources/SQL/SQLCreateTableBuilder.swift /Users/petercernak/vapor/TILApp/.build/checkouts/sql.git--5031097865152321144/Sources/SQL/SQLDropTableBuilder.swift /Users/petercernak/vapor/TILApp/.build/checkouts/sql.git--5031097865152321144/Sources/SQL/SQLAlterTableBuilder.swift /Users/petercernak/vapor/TILApp/.build/checkouts/sql.git--5031097865152321144/Sources/SQL/SQLPredicateBuilder.swift /Users/petercernak/vapor/TILApp/.build/checkouts/sql.git--5031097865152321144/Sources/SQL/SQLUpdateBuilder.swift /Users/petercernak/vapor/TILApp/.build/checkouts/sql.git--5031097865152321144/Sources/SQL/SQLDeleteBuilder.swift /Users/petercernak/vapor/TILApp/.build/checkouts/sql.git--5031097865152321144/Sources/SQL/SQLColumnBuilder.swift /Users/petercernak/vapor/TILApp/.build/checkouts/sql.git--5031097865152321144/Sources/SQL/SQLPredicateGroupBuilder.swift /Users/petercernak/vapor/TILApp/.build/checkouts/sql.git--5031097865152321144/Sources/SQL/SQLSelectBuilder.swift /Users/petercernak/vapor/TILApp/.build/checkouts/sql.git--5031097865152321144/Sources/SQL/SQLInsertBuilder.swift /Users/petercernak/vapor/TILApp/.build/checkouts/sql.git--5031097865152321144/Sources/SQL/SQLRawBuilder.swift /Users/petercernak/vapor/TILApp/.build/checkouts/sql.git--5031097865152321144/Sources/SQL/SQLCreateIndexBuilder.swift /Users/petercernak/vapor/TILApp/.build/checkouts/sql.git--5031097865152321144/Sources/SQL/SQLQueryBuilder.swift /Users/petercernak/vapor/TILApp/.build/checkouts/sql.git--5031097865152321144/Sources/SQL/SQLQueryEncoder.swift /Users/petercernak/vapor/TILApp/.build/checkouts/sql.git--5031097865152321144/Sources/SQL/SQLQueryFetcher.swift /Users/petercernak/vapor/TILApp/.build/checkouts/sql.git--5031097865152321144/Sources/SQL/SQLIndexModifier.swift /Users/petercernak/vapor/TILApp/.build/checkouts/sql.git--5031097865152321144/Sources/SQL/SQLIdentifier.swift /Users/petercernak/vapor/TILApp/.build/checkouts/sql.git--5031097865152321144/Sources/SQL/SQLTableIdentifier.swift /Users/petercernak/vapor/TILApp/.build/checkouts/sql.git--5031097865152321144/Sources/SQL/SQLColumnIdentifier.swift /Users/petercernak/vapor/TILApp/.build/checkouts/sql.git--5031097865152321144/Sources/SQL/SQLError.swift /Users/petercernak/vapor/TILApp/.build/checkouts/sql.git--5031097865152321144/Sources/SQL/SQLBinaryOperator.swift /Users/petercernak/vapor/TILApp/.build/checkouts/sql.git--5031097865152321144/Sources/SQL/Exports.swift /Users/petercernak/vapor/TILApp/.build/checkouts/sql.git--5031097865152321144/Sources/SQL/SQLSelect.swift /Users/petercernak/vapor/TILApp/.build/checkouts/sql.git--5031097865152321144/Sources/SQL/SQLDistinct.swift /Users/petercernak/vapor/TILApp/.build/checkouts/sql.git--5031097865152321144/Sources/SQL/SQLFunctionArgument.swift /Users/petercernak/vapor/TILApp/.build/checkouts/sql.git--5031097865152321144/Sources/SQL/SQLTableConstraint.swift /Users/petercernak/vapor/TILApp/.build/checkouts/sql.git--5031097865152321144/Sources/SQL/SQLColumnConstraint.swift /Users/petercernak/vapor/TILApp/.build/checkouts/sql.git--5031097865152321144/Sources/SQL/SQLInsert.swift /Users/petercernak/vapor/TILApp/.build/checkouts/sql.git--5031097865152321144/Sources/SQL/SQLCreateIndex.swift /Users/petercernak/vapor/TILApp/.build/checkouts/sql.git--5031097865152321144/Sources/SQL/SQLDropIndex.swift /Users/petercernak/vapor/TILApp/.build/checkouts/sql.git--5031097865152321144/Sources/SQL/SQLGroupBy.swift /Users/petercernak/vapor/TILApp/.build/checkouts/sql.git--5031097865152321144/Sources/SQL/SQLOrderBy.swift /Users/petercernak/vapor/TILApp/.build/checkouts/sql.git--5031097865152321144/Sources/SQL/SQLForeignKey.swift /Users/petercernak/vapor/TILApp/.build/checkouts/sql.git--5031097865152321144/Sources/SQL/SQLPrimaryKey.swift /Users/petercernak/vapor/TILApp/.build/checkouts/sql.git--5031097865152321144/Sources/SQL/SQLQuery.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Dispatch.apinotesc /Users/petercernak/vapor/TILApp/Build/Products/Debug/NIO.framework/Modules/NIO.swiftmodule/x86_64.swiftmodule /Users/petercernak/vapor/TILApp/Build/Products/Debug/Async.framework/Modules/Async.swiftmodule/x86_64.swiftmodule /Users/petercernak/vapor/TILApp/Build/Products/Debug/Service.framework/Modules/Service.swiftmodule/x86_64.swiftmodule /Users/petercernak/vapor/TILApp/Build/Products/Debug/Core.framework/Modules/Core.swiftmodule/x86_64.swiftmodule /Users/petercernak/vapor/TILApp/Build/Products/Debug/Debugging.framework/Modules/Debugging.swiftmodule/x86_64.swiftmodule /Users/petercernak/vapor/TILApp/Build/Products/Debug/COperatingSystem.framework/Modules/COperatingSystem.swiftmodule/x86_64.swiftmodule /Users/petercernak/vapor/TILApp/Build/Products/Debug/NIOConcurrencyHelpers.framework/Modules/NIOConcurrencyHelpers.swiftmodule/x86_64.swiftmodule /Users/petercernak/vapor/TILApp/Build/Products/Debug/Bits.framework/Modules/Bits.swiftmodule/x86_64.swiftmodule /Users/petercernak/vapor/TILApp/Build/Products/Debug/NIOFoundationCompat.framework/Modules/NIOFoundationCompat.swiftmodule/x86_64.swiftmodule /Users/petercernak/vapor/TILApp/Build/Products/Debug/DatabaseKit.framework/Modules/DatabaseKit.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/ObjectiveC.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Dispatch.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Darwin.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Foundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/CoreFoundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/CoreGraphics.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Swift.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/IOKit.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/SwiftOnoneSupport.swiftmodule /Users/petercernak/vapor/TILApp/.build/checkouts/swift-nio.git--2128188973977302459/Sources/CNIOAtomics/include/cpp_magic.h /Users/petercernak/vapor/TILApp/.build/checkouts/swift-nio.git--2128188973977302459/Sources/CNIODarwin/include/c_nio_darwin.h /Users/petercernak/vapor/TILApp/.build/checkouts/swift-nio.git--2128188973977302459/Sources/CNIOAtomics/include/c-atomics.h /Users/petercernak/vapor/TILApp/.build/checkouts/swift-nio.git--2128188973977302459/Sources/CNIOLinux/include/c_nio_linux.h /Users/petercernak/vapor/TILApp/TILApp.xcodeproj/GeneratedModuleMap/CNIOSHA1/module.modulemap /Users/petercernak/vapor/TILApp/.build/checkouts/swift-nio-zlib-support.git--6538424668019974428/module.modulemap /Users/petercernak/vapor/TILApp/TILApp.xcodeproj/GeneratedModuleMap/CNIODarwin/module.modulemap /Users/petercernak/vapor/TILApp/TILApp.xcodeproj/GeneratedModuleMap/CNIOAtomics/module.modulemap /Users/petercernak/vapor/TILApp/TILApp.xcodeproj/GeneratedModuleMap/CNIOLinux/module.modulemap /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/objc/ObjectiveC.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/Darwin.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/ApplicationServices.framework/Headers/ApplicationServices.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/CoreText.framework/Headers/CoreText.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/Security.framework/Headers/Security.apinotes
D
/Users/rrunfa/Desktop/RxIssuesSample/.build/x86_64-apple-macosx10.10/debug/Moya.build/ValidationType.swift.o : /Users/rrunfa/Desktop/RxIssuesSample/.build/checkouts/Moya.git--5230867493987625585/Sources/Moya/MultipartFormData.swift /Users/rrunfa/Desktop/RxIssuesSample/.build/checkouts/Moya.git--5230867493987625585/Sources/Moya/URL+Moya.swift /Users/rrunfa/Desktop/RxIssuesSample/.build/checkouts/Moya.git--5230867493987625585/Sources/Moya/Image.swift /Users/rrunfa/Desktop/RxIssuesSample/.build/checkouts/Moya.git--5230867493987625585/Sources/Moya/AnyEncodable.swift /Users/rrunfa/Desktop/RxIssuesSample/.build/checkouts/Moya.git--5230867493987625585/Sources/Moya/Cancellable.swift /Users/rrunfa/Desktop/RxIssuesSample/.build/checkouts/Moya.git--5230867493987625585/Sources/Moya/ValidationType.swift /Users/rrunfa/Desktop/RxIssuesSample/.build/checkouts/Moya.git--5230867493987625585/Sources/Moya/TargetType.swift /Users/rrunfa/Desktop/RxIssuesSample/.build/checkouts/Moya.git--5230867493987625585/Sources/Moya/Moya+Alamofire.swift /Users/rrunfa/Desktop/RxIssuesSample/.build/checkouts/Moya.git--5230867493987625585/Sources/Moya/Response.swift /Users/rrunfa/Desktop/RxIssuesSample/.build/checkouts/Moya.git--5230867493987625585/Sources/Moya/URLRequest+Encoding.swift /Users/rrunfa/Desktop/RxIssuesSample/.build/checkouts/Moya.git--5230867493987625585/Sources/Moya/Task.swift /Users/rrunfa/Desktop/RxIssuesSample/.build/checkouts/Moya.git--5230867493987625585/Sources/Moya/MoyaProvider+Internal.swift /Users/rrunfa/Desktop/RxIssuesSample/.build/checkouts/Moya.git--5230867493987625585/Sources/Moya/Plugin.swift /Users/rrunfa/Desktop/RxIssuesSample/.build/checkouts/Moya.git--5230867493987625585/Sources/Moya/Plugins/AccessTokenPlugin.swift /Users/rrunfa/Desktop/RxIssuesSample/.build/checkouts/Moya.git--5230867493987625585/Sources/Moya/Plugins/NetworkLoggerPlugin.swift /Users/rrunfa/Desktop/RxIssuesSample/.build/checkouts/Moya.git--5230867493987625585/Sources/Moya/Plugins/CredentialsPlugin.swift /Users/rrunfa/Desktop/RxIssuesSample/.build/checkouts/Moya.git--5230867493987625585/Sources/Moya/Plugins/NetworkActivityPlugin.swift /Users/rrunfa/Desktop/RxIssuesSample/.build/checkouts/Moya.git--5230867493987625585/Sources/Moya/MoyaProvider.swift /Users/rrunfa/Desktop/RxIssuesSample/.build/checkouts/Moya.git--5230867493987625585/Sources/Moya/MoyaError.swift /Users/rrunfa/Desktop/RxIssuesSample/.build/checkouts/Moya.git--5230867493987625585/Sources/Moya/MoyaProvider+Defaults.swift /Users/rrunfa/Desktop/RxIssuesSample/.build/checkouts/Moya.git--5230867493987625585/Sources/Moya/MultiTarget.swift /Users/rrunfa/Desktop/RxIssuesSample/.build/checkouts/Moya.git--5230867493987625585/Sources/Moya/Endpoint.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Dispatch.apinotesc /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/XPC.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/ObjectiveC.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/CoreData.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/CoreImage.swiftmodule /Users/rrunfa/Desktop/RxIssuesSample/.build/x86_64-apple-macosx10.10/debug/Alamofire.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/QuartzCore.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Dispatch.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Metal.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Darwin.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Foundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/CoreFoundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/CoreGraphics.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Swift.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/IOKit.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/AppKit.swiftmodule /Users/rrunfa/Desktop/RxIssuesSample/.build/x86_64-apple-macosx10.10/debug/Result.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/SwiftOnoneSupport.swiftmodule /Users/rrunfa/Desktop/RxIssuesSample/.build/x86_64-apple-macosx10.10/debug/RxCocoaRuntime.build/module.modulemap /Users/rrunfa/Desktop/RxIssuesSample/.build/x86_64-apple-macosx10.10/debug/QuickSpecBase.build/module.modulemap /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/usr/include/xpc/XPC.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/usr/include/objc/ObjectiveC.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/System/Library/Frameworks/CoreData.framework/Headers/CoreData.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/System/Library/Frameworks/CoreImage.framework/Headers/CoreImage.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/System/Library/Frameworks/QuartzCore.framework/Headers/QuartzCore.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/System/Library/Frameworks/Metal.framework/Headers/Metal.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/usr/include/Darwin.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/System/Library/Frameworks/AppKit.framework/Headers/AppKit.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/System/Library/Frameworks/CoreText.framework/Headers/CoreText.apinotes /Users/rrunfa/Desktop/RxIssuesSample/.build/x86_64-apple-macosx10.10/debug/Moya.build/ValidationType~partial.swiftmodule : /Users/rrunfa/Desktop/RxIssuesSample/.build/checkouts/Moya.git--5230867493987625585/Sources/Moya/MultipartFormData.swift /Users/rrunfa/Desktop/RxIssuesSample/.build/checkouts/Moya.git--5230867493987625585/Sources/Moya/URL+Moya.swift /Users/rrunfa/Desktop/RxIssuesSample/.build/checkouts/Moya.git--5230867493987625585/Sources/Moya/Image.swift /Users/rrunfa/Desktop/RxIssuesSample/.build/checkouts/Moya.git--5230867493987625585/Sources/Moya/AnyEncodable.swift /Users/rrunfa/Desktop/RxIssuesSample/.build/checkouts/Moya.git--5230867493987625585/Sources/Moya/Cancellable.swift /Users/rrunfa/Desktop/RxIssuesSample/.build/checkouts/Moya.git--5230867493987625585/Sources/Moya/ValidationType.swift /Users/rrunfa/Desktop/RxIssuesSample/.build/checkouts/Moya.git--5230867493987625585/Sources/Moya/TargetType.swift /Users/rrunfa/Desktop/RxIssuesSample/.build/checkouts/Moya.git--5230867493987625585/Sources/Moya/Moya+Alamofire.swift /Users/rrunfa/Desktop/RxIssuesSample/.build/checkouts/Moya.git--5230867493987625585/Sources/Moya/Response.swift /Users/rrunfa/Desktop/RxIssuesSample/.build/checkouts/Moya.git--5230867493987625585/Sources/Moya/URLRequest+Encoding.swift /Users/rrunfa/Desktop/RxIssuesSample/.build/checkouts/Moya.git--5230867493987625585/Sources/Moya/Task.swift /Users/rrunfa/Desktop/RxIssuesSample/.build/checkouts/Moya.git--5230867493987625585/Sources/Moya/MoyaProvider+Internal.swift /Users/rrunfa/Desktop/RxIssuesSample/.build/checkouts/Moya.git--5230867493987625585/Sources/Moya/Plugin.swift /Users/rrunfa/Desktop/RxIssuesSample/.build/checkouts/Moya.git--5230867493987625585/Sources/Moya/Plugins/AccessTokenPlugin.swift /Users/rrunfa/Desktop/RxIssuesSample/.build/checkouts/Moya.git--5230867493987625585/Sources/Moya/Plugins/NetworkLoggerPlugin.swift /Users/rrunfa/Desktop/RxIssuesSample/.build/checkouts/Moya.git--5230867493987625585/Sources/Moya/Plugins/CredentialsPlugin.swift /Users/rrunfa/Desktop/RxIssuesSample/.build/checkouts/Moya.git--5230867493987625585/Sources/Moya/Plugins/NetworkActivityPlugin.swift /Users/rrunfa/Desktop/RxIssuesSample/.build/checkouts/Moya.git--5230867493987625585/Sources/Moya/MoyaProvider.swift /Users/rrunfa/Desktop/RxIssuesSample/.build/checkouts/Moya.git--5230867493987625585/Sources/Moya/MoyaError.swift /Users/rrunfa/Desktop/RxIssuesSample/.build/checkouts/Moya.git--5230867493987625585/Sources/Moya/MoyaProvider+Defaults.swift /Users/rrunfa/Desktop/RxIssuesSample/.build/checkouts/Moya.git--5230867493987625585/Sources/Moya/MultiTarget.swift /Users/rrunfa/Desktop/RxIssuesSample/.build/checkouts/Moya.git--5230867493987625585/Sources/Moya/Endpoint.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Dispatch.apinotesc /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/XPC.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/ObjectiveC.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/CoreData.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/CoreImage.swiftmodule /Users/rrunfa/Desktop/RxIssuesSample/.build/x86_64-apple-macosx10.10/debug/Alamofire.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/QuartzCore.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Dispatch.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Metal.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Darwin.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Foundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/CoreFoundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/CoreGraphics.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Swift.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/IOKit.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/AppKit.swiftmodule /Users/rrunfa/Desktop/RxIssuesSample/.build/x86_64-apple-macosx10.10/debug/Result.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/SwiftOnoneSupport.swiftmodule /Users/rrunfa/Desktop/RxIssuesSample/.build/x86_64-apple-macosx10.10/debug/RxCocoaRuntime.build/module.modulemap /Users/rrunfa/Desktop/RxIssuesSample/.build/x86_64-apple-macosx10.10/debug/QuickSpecBase.build/module.modulemap /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/usr/include/xpc/XPC.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/usr/include/objc/ObjectiveC.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/System/Library/Frameworks/CoreData.framework/Headers/CoreData.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/System/Library/Frameworks/CoreImage.framework/Headers/CoreImage.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/System/Library/Frameworks/QuartzCore.framework/Headers/QuartzCore.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/System/Library/Frameworks/Metal.framework/Headers/Metal.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/usr/include/Darwin.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/System/Library/Frameworks/AppKit.framework/Headers/AppKit.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/System/Library/Frameworks/CoreText.framework/Headers/CoreText.apinotes /Users/rrunfa/Desktop/RxIssuesSample/.build/x86_64-apple-macosx10.10/debug/Moya.build/ValidationType~partial.swiftdoc : /Users/rrunfa/Desktop/RxIssuesSample/.build/checkouts/Moya.git--5230867493987625585/Sources/Moya/MultipartFormData.swift /Users/rrunfa/Desktop/RxIssuesSample/.build/checkouts/Moya.git--5230867493987625585/Sources/Moya/URL+Moya.swift /Users/rrunfa/Desktop/RxIssuesSample/.build/checkouts/Moya.git--5230867493987625585/Sources/Moya/Image.swift /Users/rrunfa/Desktop/RxIssuesSample/.build/checkouts/Moya.git--5230867493987625585/Sources/Moya/AnyEncodable.swift /Users/rrunfa/Desktop/RxIssuesSample/.build/checkouts/Moya.git--5230867493987625585/Sources/Moya/Cancellable.swift /Users/rrunfa/Desktop/RxIssuesSample/.build/checkouts/Moya.git--5230867493987625585/Sources/Moya/ValidationType.swift /Users/rrunfa/Desktop/RxIssuesSample/.build/checkouts/Moya.git--5230867493987625585/Sources/Moya/TargetType.swift /Users/rrunfa/Desktop/RxIssuesSample/.build/checkouts/Moya.git--5230867493987625585/Sources/Moya/Moya+Alamofire.swift /Users/rrunfa/Desktop/RxIssuesSample/.build/checkouts/Moya.git--5230867493987625585/Sources/Moya/Response.swift /Users/rrunfa/Desktop/RxIssuesSample/.build/checkouts/Moya.git--5230867493987625585/Sources/Moya/URLRequest+Encoding.swift /Users/rrunfa/Desktop/RxIssuesSample/.build/checkouts/Moya.git--5230867493987625585/Sources/Moya/Task.swift /Users/rrunfa/Desktop/RxIssuesSample/.build/checkouts/Moya.git--5230867493987625585/Sources/Moya/MoyaProvider+Internal.swift /Users/rrunfa/Desktop/RxIssuesSample/.build/checkouts/Moya.git--5230867493987625585/Sources/Moya/Plugin.swift /Users/rrunfa/Desktop/RxIssuesSample/.build/checkouts/Moya.git--5230867493987625585/Sources/Moya/Plugins/AccessTokenPlugin.swift /Users/rrunfa/Desktop/RxIssuesSample/.build/checkouts/Moya.git--5230867493987625585/Sources/Moya/Plugins/NetworkLoggerPlugin.swift /Users/rrunfa/Desktop/RxIssuesSample/.build/checkouts/Moya.git--5230867493987625585/Sources/Moya/Plugins/CredentialsPlugin.swift /Users/rrunfa/Desktop/RxIssuesSample/.build/checkouts/Moya.git--5230867493987625585/Sources/Moya/Plugins/NetworkActivityPlugin.swift /Users/rrunfa/Desktop/RxIssuesSample/.build/checkouts/Moya.git--5230867493987625585/Sources/Moya/MoyaProvider.swift /Users/rrunfa/Desktop/RxIssuesSample/.build/checkouts/Moya.git--5230867493987625585/Sources/Moya/MoyaError.swift /Users/rrunfa/Desktop/RxIssuesSample/.build/checkouts/Moya.git--5230867493987625585/Sources/Moya/MoyaProvider+Defaults.swift /Users/rrunfa/Desktop/RxIssuesSample/.build/checkouts/Moya.git--5230867493987625585/Sources/Moya/MultiTarget.swift /Users/rrunfa/Desktop/RxIssuesSample/.build/checkouts/Moya.git--5230867493987625585/Sources/Moya/Endpoint.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Dispatch.apinotesc /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/XPC.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/ObjectiveC.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/CoreData.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/CoreImage.swiftmodule /Users/rrunfa/Desktop/RxIssuesSample/.build/x86_64-apple-macosx10.10/debug/Alamofire.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/QuartzCore.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Dispatch.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Metal.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Darwin.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Foundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/CoreFoundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/CoreGraphics.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Swift.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/IOKit.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/AppKit.swiftmodule /Users/rrunfa/Desktop/RxIssuesSample/.build/x86_64-apple-macosx10.10/debug/Result.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/SwiftOnoneSupport.swiftmodule /Users/rrunfa/Desktop/RxIssuesSample/.build/x86_64-apple-macosx10.10/debug/RxCocoaRuntime.build/module.modulemap /Users/rrunfa/Desktop/RxIssuesSample/.build/x86_64-apple-macosx10.10/debug/QuickSpecBase.build/module.modulemap /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/usr/include/xpc/XPC.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/usr/include/objc/ObjectiveC.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/System/Library/Frameworks/CoreData.framework/Headers/CoreData.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/System/Library/Frameworks/CoreImage.framework/Headers/CoreImage.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/System/Library/Frameworks/QuartzCore.framework/Headers/QuartzCore.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/System/Library/Frameworks/Metal.framework/Headers/Metal.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/usr/include/Darwin.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/System/Library/Frameworks/AppKit.framework/Headers/AppKit.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/System/Library/Frameworks/CoreText.framework/Headers/CoreText.apinotes
D
/* * Copyright (c) 2006-2007 Erin Catto http://www.box2d.org * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages * arising from the use of this software. * Permission is granted to anyone to use this software for any purpose, * including commercial applications, and to alter it and redistribute it * freely, subject to the following restrictions: * 1. The origin of this software must not be misrepresented; you must not * claim that you wrote the original software. If you use this software * in a product, an acknowledgment in the product documentation would be * appreciated but is not required. * 2. Altered source versions must be plainly marked as such, and must not be * misrepresented as being the original software. * 3. This notice may not be removed or altered from any source distribution. */ module tests.test_entries; import framework.test; import tests.dpercept; import tests.pathfinder; import tests.hindsight; import tests.junction; import tests.pointer; import tests.chemotaxi; import tests.homerun; import tests.stresstest; import tests.chemotaxistereo; import tests.catcher; import tests.spotter; import tests.klinotaxi; import tests.pathing; import std.stdio; TestEntry[] g_testEntries; enum mode { cpu, render, user } static this() { g_testEntries = [ TestEntry("Pathing", &Pathing!(mode.render).Create, &Pathing!(mode.cpu).Create, &Pathing!(mode.cpu).createSpawns,&Pathing!(mode.cpu).getNetConf), TestEntry("TED", &DPercept!(mode.render).Create, &DPercept!(mode.cpu).Create, &DPercept!(mode.cpu).createSpawns, &DPercept!(mode.cpu).getNetConf), TestEntry("Chemotaxi - Mono", &Chemotaxi!(mode.render).Create, &Chemotaxi!(mode.cpu).Create, &Chemotaxi!(mode.cpu).createSpawns,&Chemotaxi!(mode.cpu).getNetConf), TestEntry("Chemotaxi - Experiment", &Klinotaxi!(mode.render).Create, &Klinotaxi!(mode.cpu).Create, &Klinotaxi!(mode.cpu).createSpawns,&Klinotaxi!(mode.cpu).getNetConf), // TestEntry("StressTest", &Stress!(mode.render).Create, &Stress!(mode.cpu).Create, &Stress!(mode.cpu).createSpawns, &Stress!(mode.cpu).getNetConf), // TestEntry("Chemotaxi - Stereo", &ChemotaxiB!(mode.render).Create, &ChemotaxiB!(mode.cpu).Create, &ChemotaxiB!(mode.cpu).createSpawns,&ChemotaxiB!(mode.cpu).getNetConf), TestEntry("Spotter", &Spotter!(mode.render).Create, &Spotter!(mode.cpu).Create, &Spotter!(mode.cpu).createSpawns, &Spotter!(mode.cpu).getNetConf), // TestEntry("Ball catcher", &Catcher!(mode.render).Create, &Catcher!(mode.cpu).Create, &Catcher!(mode.cpu).createSpawns, &Catcher!(mode.cpu).getNetConf), TestEntry("Blind Pathfinder", &Pathfinder!(mode.render).Create, &Pathfinder!(mode.cpu).Create, &Pathfinder!(mode.cpu).createSpawns, &Pathfinder!(mode.cpu).getNetConf), TestEntry("Junction", &Junction!(mode.render).Create, &Junction!(mode.cpu).Create, &Junction!(mode.cpu).createSpawns, &Junction!(mode.cpu).getNetConf), TestEntry("Hindsight", &Hindsight!(mode.render).Create, &Hindsight!(mode.cpu).Create, &Hindsight!(mode.cpu).createSpawns, &Hindsight!(mode.cpu).getNetConf), TestEntry("Pointer", &Pointer!(mode.render).Create, &Pointer!(mode.cpu).Create, &Pointer!(mode.cpu).createSpawns, &Pointer!(mode.cpu).getNetConf), TestEntry("Homerun", &Homerun!(mode.render).Create, &Homerun!(mode.cpu).Create, &Homerun!(mode.cpu).createSpawns, &Homerun!(mode.cpu).getNetConf), ]; import std.algorithm; // sort!((a, b) => a.name < b.name)(g_testEntries); }
D
module openfx.host.imageeffecthost; import openfx.host.host; import openfx.c.core; import openfx.c.parametersuite; import openfx.c.imageeffectsuite; import openfx.host.suite.property.property; abstract class ImageEffectHost : BasicHost { this(Suite[] suites){ super(suites); putString(kOfxPropName, "Image Effect Host"); putInt(kOfxImageEffectHostPropIsBackground, 0); putInt(kOfxImageEffectPropSupportsOverlays, 0); putInt(kOfxImageEffectPropSupportsMultiResolution, 0); putInt(kOfxImageEffectPropSupportsTiles, 0); putInt(kOfxImageEffectPropTemporalClipAccess, 0); putInt(kOfxImageEffectPropSupportsMultipleClipDepths, 0); putInt(kOfxImageEffectPropSupportsMultipleClipPARs, 0); putInt(kOfxImageEffectPropSetableFrameRate, 0); putInt(kOfxImageEffectPropSetableFielding, 0); putInt(kOfxParamHostPropSupportsStringAnimation, 1); putInt(kOfxParamHostPropSupportsCustomInteract, 0); putInt(kOfxParamHostPropSupportsChoiceAnimation, 0); putInt(kOfxParamHostPropSupportsBooleanAnimation, 1); putInt(kOfxParamHostPropSupportsCustomAnimation, 0); putInt(kOfxParamHostPropMaxParameters, 0); putInt(kOfxParamHostPropMaxPages, 0); put(new IntProperty( kOfxParamHostPropPageRowColumnCount, [0,0])); // adding the supported components type put(new StringProperty(kOfxImageEffectPropSupportedComponents, [ kOfxImageComponentNone, kOfxImageComponentRGBA, kOfxImageComponentRGB, kOfxImageComponentAlpha ])); // the plugin should set this one putString(kOfxImageEffectPropSupportedContexts, ""); } }
D
// Copyright 2018 - 2022 Michael D. Parker // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) module bindbc.sdl.bind.sdlfilesystem; import bindbc.sdl.config; static if(staticBinding){ extern(C) @nogc nothrow { static if(sdlSupport >= SDLSupport.sdl201) { char* SDL_GetBasePath(); char* SDL_GetPrefPath(const(char)* org, const(char)* app); } } } else { static if(sdlSupport >= SDLSupport.sdl201) { extern(C) @nogc nothrow { alias pSDL_GetBasePath = char* function(); alias pSDL_GetPrefPath = char* function(const(char)* org, const(char)* app); } __gshared { pSDL_GetBasePath SDL_GetBasePath; pSDL_GetPrefPath SDL_GetPrefPath; } } }
D
/** * Betterc: Frequently used primitives suitable for use in the BetterC D subset. * inspired by https://theartofmachinery.com/2018/05/27/cpp_classes_in_betterc.html * * Copyright: Maxim Freck, 2018. * Authors: Maxim Freck <maxim@freck.pp.ru> * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0) */ module betterc.cppclass; import std.traits: ReturnType; /******* * Returns `true` if `T` is destructible with `T.destructor()` method. * In other words tests whether `T` contains `void destructor()` method. * Please note: the parent destructor must be called explicitly. */ enum bool isDestructable(T) = is(ReturnType!((T r) => r.destructor) == void); /******* * Creates an instance of T inside the malloc'd memory and calls its constructor. * * Params: * Args... = Constructor arguments * * Returns: an instance of a class of type T */ T cnew(T, Args...)(auto ref Args args) { import core.stdc.stdlib: malloc; import core.stdc.string: memcpy; static immutable model = cast(immutable(T)) new T(); enum kTSize = __traits(classInstanceSize, T); auto instance = cast(T)malloc(kTSize); memcpy(cast(void*)instance, cast(void*)model, kTSize); instance.__ctor(args); return instance; } /******* * Calls the destructor of a previously malloc'd class and frees its memory * * `__xdtor()` is non-virtual and non-@nogc * so let's just use destructor() method * before freing object's memory * * Params: * instance = Class instance */ void cdelete(T)(T instance) { import core.stdc.stdlib: free; static if(isDestructable!T) instance.destructor(); free(cast(void*)instance); }
D
a three-legged metal stand for supporting a cooking vessel in a hearth a stand with short feet used under a hot dish on a table
D
/******************************************************************************* * Copyright (c) 2000, 2008 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * IBM Corporation - initial API and implementation * Port to the D programming language: * Frank Benoit <benoit@tionex.de> *******************************************************************************/ module dwt.custom.TextChangingEvent; import dwt.dwthelper.utils; import dwt.events.TypedEvent; import dwt.custom.StyledTextContent; import dwt.custom.StyledTextEvent; /** * This event is sent by the StyledTextContent implementor when a change * to the text is about to occur. * * @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a> */ public class TextChangingEvent : TypedEvent { /** * Start offset of the text that is going to be replaced */ public int start; /** * Text that is going to be inserted or empty string * if no text will be inserted */ public String newText; /** * Length of text that is going to be replaced */ public int replaceCharCount; /** * Length of text that is going to be inserted */ public int newCharCount; /** * Number of lines that are going to be replaced */ public int replaceLineCount; /** * Number of new lines that are going to be inserted */ public int newLineCount; static final long serialVersionUID = 3257290210114352439L; /** * Create the TextChangedEvent to be used by the StyledTextContent implementor. * <p> * * @param source the object that will be sending the new TextChangingEvent, * cannot be null */ public this(StyledTextContent source) { super( cast(Object)source); } this(StyledTextContent source, StyledTextEvent e) { super( cast(Object)source); start = e.start; replaceCharCount = e.replaceCharCount; newCharCount = e.newCharCount; replaceLineCount = e.replaceLineCount; newLineCount = e.newLineCount; newText = e.text; } }
D
/Users/yuxiangtang1/Documents/30DaysOfSwift/PlayLocalVideo/build/PlayLocalVideo.build/Debug-iphoneos/PlayLocalVideo.build/Objects-normal/arm64/MyTableViewCell.o : /Users/yuxiangtang1/Documents/30DaysOfSwift/PlayLocalVideo/PlayLocalVideo/ViewController.swift /Users/yuxiangtang1/Documents/30DaysOfSwift/PlayLocalVideo/PlayLocalVideo/Video.swift /Users/yuxiangtang1/Documents/30DaysOfSwift/PlayLocalVideo/PlayLocalVideo/MyTableViewCell.swift /Users/yuxiangtang1/Documents/30DaysOfSwift/PlayLocalVideo/PlayLocalVideo/AppDelegate.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/Swift.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/UIKit.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/Foundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/Darwin.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/Dispatch.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/ObjectiveC.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/CoreGraphics.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/CoreImage.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/AVFoundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/CoreMedia.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/CoreAudio.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/CoreData.swiftmodule /Users/yuxiangtang1/Documents/30DaysOfSwift/PlayLocalVideo/build/PlayLocalVideo.build/Debug-iphoneos/PlayLocalVideo.build/Objects-normal/arm64/MyTableViewCell~partial.swiftmodule : /Users/yuxiangtang1/Documents/30DaysOfSwift/PlayLocalVideo/PlayLocalVideo/ViewController.swift /Users/yuxiangtang1/Documents/30DaysOfSwift/PlayLocalVideo/PlayLocalVideo/Video.swift /Users/yuxiangtang1/Documents/30DaysOfSwift/PlayLocalVideo/PlayLocalVideo/MyTableViewCell.swift /Users/yuxiangtang1/Documents/30DaysOfSwift/PlayLocalVideo/PlayLocalVideo/AppDelegate.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/Swift.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/UIKit.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/Foundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/Darwin.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/Dispatch.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/ObjectiveC.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/CoreGraphics.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/CoreImage.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/AVFoundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/CoreMedia.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/CoreAudio.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/CoreData.swiftmodule /Users/yuxiangtang1/Documents/30DaysOfSwift/PlayLocalVideo/build/PlayLocalVideo.build/Debug-iphoneos/PlayLocalVideo.build/Objects-normal/arm64/MyTableViewCell~partial.swiftdoc : /Users/yuxiangtang1/Documents/30DaysOfSwift/PlayLocalVideo/PlayLocalVideo/ViewController.swift /Users/yuxiangtang1/Documents/30DaysOfSwift/PlayLocalVideo/PlayLocalVideo/Video.swift /Users/yuxiangtang1/Documents/30DaysOfSwift/PlayLocalVideo/PlayLocalVideo/MyTableViewCell.swift /Users/yuxiangtang1/Documents/30DaysOfSwift/PlayLocalVideo/PlayLocalVideo/AppDelegate.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/Swift.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/UIKit.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/Foundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/Darwin.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/Dispatch.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/ObjectiveC.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/CoreGraphics.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/CoreImage.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/AVFoundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/CoreMedia.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/CoreAudio.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/CoreData.swiftmodule
D
# FIXED Clock.obj: C:/Users/itdov/Documents/School/Spring_2020/Robotics&EmbeddedSystems/tirslk_max_1_00_00/tirslk_max_1_00_00/inc/Clock.c Clock.obj: C:/ti/ccs930/ccs/tools/compiler/ti-cgt-arm_18.12.4.LTS/include/stdint.h Clock.obj: C:/ti/ccs930/ccs/tools/compiler/ti-cgt-arm_18.12.4.LTS/include/_stdint40.h Clock.obj: C:/ti/ccs930/ccs/tools/compiler/ti-cgt-arm_18.12.4.LTS/include/sys/stdint.h Clock.obj: C:/ti/ccs930/ccs/tools/compiler/ti-cgt-arm_18.12.4.LTS/include/sys/cdefs.h Clock.obj: C:/ti/ccs930/ccs/tools/compiler/ti-cgt-arm_18.12.4.LTS/include/sys/_types.h Clock.obj: C:/ti/ccs930/ccs/tools/compiler/ti-cgt-arm_18.12.4.LTS/include/machine/_types.h Clock.obj: C:/ti/ccs930/ccs/tools/compiler/ti-cgt-arm_18.12.4.LTS/include/machine/_stdint.h Clock.obj: C:/ti/ccs930/ccs/tools/compiler/ti-cgt-arm_18.12.4.LTS/include/sys/_stdint.h Clock.obj: C:/ti/ccs930/ccs/ccs_base/arm/include/msp.h Clock.obj: C:/ti/ccs930/ccs/ccs_base/arm/include/msp432p401r.h Clock.obj: C:/ti/ccs930/ccs/ccs_base/arm/include/msp_compatibility.h Clock.obj: C:/ti/ccs930/ccs/ccs_base/arm/include/msp432p401r_classic.h Clock.obj: C:/ti/ccs930/ccs/ccs_base/arm/include/CMSIS/core_cm4.h Clock.obj: C:/ti/ccs930/ccs/ccs_base/arm/include/CMSIS/cmsis_compiler.h Clock.obj: C:/ti/ccs930/ccs/ccs_base/arm/include/CMSIS/cmsis_ccs.h Clock.obj: C:/ti/ccs930/ccs/ccs_base/arm/include/system_msp432p401r.h C:/Users/itdov/Documents/School/Spring_2020/Robotics&EmbeddedSystems/tirslk_max_1_00_00/tirslk_max_1_00_00/inc/Clock.c: C:/ti/ccs930/ccs/tools/compiler/ti-cgt-arm_18.12.4.LTS/include/stdint.h: C:/ti/ccs930/ccs/tools/compiler/ti-cgt-arm_18.12.4.LTS/include/_stdint40.h: C:/ti/ccs930/ccs/tools/compiler/ti-cgt-arm_18.12.4.LTS/include/sys/stdint.h: C:/ti/ccs930/ccs/tools/compiler/ti-cgt-arm_18.12.4.LTS/include/sys/cdefs.h: C:/ti/ccs930/ccs/tools/compiler/ti-cgt-arm_18.12.4.LTS/include/sys/_types.h: C:/ti/ccs930/ccs/tools/compiler/ti-cgt-arm_18.12.4.LTS/include/machine/_types.h: C:/ti/ccs930/ccs/tools/compiler/ti-cgt-arm_18.12.4.LTS/include/machine/_stdint.h: C:/ti/ccs930/ccs/tools/compiler/ti-cgt-arm_18.12.4.LTS/include/sys/_stdint.h: C:/ti/ccs930/ccs/ccs_base/arm/include/msp.h: C:/ti/ccs930/ccs/ccs_base/arm/include/msp432p401r.h: C:/ti/ccs930/ccs/ccs_base/arm/include/msp_compatibility.h: C:/ti/ccs930/ccs/ccs_base/arm/include/msp432p401r_classic.h: C:/ti/ccs930/ccs/ccs_base/arm/include/CMSIS/core_cm4.h: C:/ti/ccs930/ccs/ccs_base/arm/include/CMSIS/cmsis_compiler.h: C:/ti/ccs930/ccs/ccs_base/arm/include/CMSIS/cmsis_ccs.h: C:/ti/ccs930/ccs/ccs_base/arm/include/system_msp432p401r.h:
D
/Users/stepanmaksymov/Documents/svn/buenadigital_saaspro-apps/IOS/SaaSPro.IOS/Build/Intermediates/SaaSPro.build/Debug-iphonesimulator/SaaSPro.build/Objects-normal/x86_64/UIViewAnimationExtension.o : /Users/stepanmaksymov/Documents/svn/buenadigital_saaspro-apps/IOS/SaaSPro.IOS/SaaSPro/UIViewAnimationExtension.swift /Users/stepanmaksymov/Documents/svn/buenadigital_saaspro-apps/IOS/SaaSPro.IOS/SaaSPro/EVExtensions.swift /Users/stepanmaksymov/Documents/svn/buenadigital_saaspro-apps/IOS/SaaSPro.IOS/SaaSPro/SettingsService.swift /Users/stepanmaksymov/Documents/svn/buenadigital_saaspro-apps/IOS/SaaSPro.IOS/SaaSPro/SettingsModel.swift /Users/stepanmaksymov/Documents/svn/buenadigital_saaspro-apps/IOS/SaaSPro.IOS/SaaSPro/RegExtension.swift /Users/stepanmaksymov/Documents/svn/buenadigital_saaspro-apps/IOS/SaaSPro.IOS/SaaSPro/CheckQuestionViewController.swift /Users/stepanmaksymov/Documents/svn/buenadigital_saaspro-apps/IOS/SaaSPro.IOS/SaaSPro/LeftSlideMenuCellView.swift /Users/stepanmaksymov/Documents/svn/buenadigital_saaspro-apps/IOS/SaaSPro.IOS/SaaSPro/WebService.swift /Users/stepanmaksymov/Documents/svn/buenadigital_saaspro-apps/IOS/SaaSPro.IOS/SaaSPro/Constants.swift /Users/stepanmaksymov/Documents/svn/buenadigital_saaspro-apps/IOS/SaaSPro.IOS/SaaSPro/EVReflection.swift /Users/stepanmaksymov/Documents/svn/buenadigital_saaspro-apps/IOS/SaaSPro.IOS/SaaSPro/LoginViewController.swift /Users/stepanmaksymov/Documents/svn/buenadigital_saaspro-apps/IOS/SaaSPro.IOS/SaaSPro/EVObjectDescription.swift /Users/stepanmaksymov/Documents/svn/buenadigital_saaspro-apps/IOS/SaaSPro.IOS/SaaSPro/FadeInPushSegue.swift /Users/stepanmaksymov/Documents/svn/buenadigital_saaspro-apps/IOS/SaaSPro.IOS/SaaSPro/AppDelegate.swift /Users/stepanmaksymov/Documents/svn/buenadigital_saaspro-apps/IOS/SaaSPro.IOS/SaaSPro/SplashScreenViewController.swift /Users/stepanmaksymov/Documents/svn/buenadigital_saaspro-apps/IOS/SaaSPro.IOS/SaaSPro/EVObject.swift /Users/stepanmaksymov/Documents/svn/buenadigital_saaspro-apps/IOS/SaaSPro.IOS/SaaSPro/MainPageViewController.swift /Users/stepanmaksymov/Documents/svn/buenadigital_saaspro-apps/IOS/SaaSPro.IOS/SaaSPro/SlideMenuViewController.swift /Users/stepanmaksymov/Documents/svn/buenadigital_saaspro-apps/IOS/SaaSPro.IOS/SaaSPro/FadeOutPopSegue.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Swift.swiftmodule /Users/stepanmaksymov/Documents/svn/buenadigital_saaspro-apps/IOS/SaaSPro.IOS/SaaSPro/SaaSPro-Bridging-Header.h /Users/stepanmaksymov/Documents/svn/buenadigital_saaspro-apps/IOS/SaaSPro.IOS/SaaSPro/SWRevealViewController.h /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/UIKit.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Foundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Darwin.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Dispatch.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/ObjectiveC.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreGraphics.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreImage.swiftmodule /Users/stepanmaksymov/Documents/svn/buenadigital_saaspro-apps/IOS/SaaSPro.IOS/Build/Products/Debug-iphonesimulator/MaterialKit.framework/Modules/MaterialKit.swiftmodule/x86_64.swiftmodule /Users/stepanmaksymov/Documents/svn/buenadigital_saaspro-apps/IOS/SaaSPro.IOS/Build/Products/Debug-iphonesimulator/MaterialKit.framework/Headers/MaterialKit-Swift.h /Users/stepanmaksymov/Documents/svn/buenadigital_saaspro-apps/IOS/SaaSPro.IOS/Build/Products/Debug-iphonesimulator/MaterialKit.framework/Headers/MaterialKit-umbrella.h /Users/stepanmaksymov/Documents/svn/buenadigital_saaspro-apps/IOS/SaaSPro.IOS/Build/Products/Debug-iphonesimulator/MaterialKit.framework/Modules/module.modulemap /Users/stepanmaksymov/Documents/svn/buenadigital_saaspro-apps/IOS/SaaSPro.IOS/Build/Intermediates/SaaSPro.build/Debug-iphonesimulator/SaaSPro.build/Objects-normal/x86_64/UIViewAnimationExtension~partial.swiftmodule : /Users/stepanmaksymov/Documents/svn/buenadigital_saaspro-apps/IOS/SaaSPro.IOS/SaaSPro/UIViewAnimationExtension.swift /Users/stepanmaksymov/Documents/svn/buenadigital_saaspro-apps/IOS/SaaSPro.IOS/SaaSPro/EVExtensions.swift /Users/stepanmaksymov/Documents/svn/buenadigital_saaspro-apps/IOS/SaaSPro.IOS/SaaSPro/SettingsService.swift /Users/stepanmaksymov/Documents/svn/buenadigital_saaspro-apps/IOS/SaaSPro.IOS/SaaSPro/SettingsModel.swift /Users/stepanmaksymov/Documents/svn/buenadigital_saaspro-apps/IOS/SaaSPro.IOS/SaaSPro/RegExtension.swift /Users/stepanmaksymov/Documents/svn/buenadigital_saaspro-apps/IOS/SaaSPro.IOS/SaaSPro/CheckQuestionViewController.swift /Users/stepanmaksymov/Documents/svn/buenadigital_saaspro-apps/IOS/SaaSPro.IOS/SaaSPro/LeftSlideMenuCellView.swift /Users/stepanmaksymov/Documents/svn/buenadigital_saaspro-apps/IOS/SaaSPro.IOS/SaaSPro/WebService.swift /Users/stepanmaksymov/Documents/svn/buenadigital_saaspro-apps/IOS/SaaSPro.IOS/SaaSPro/Constants.swift /Users/stepanmaksymov/Documents/svn/buenadigital_saaspro-apps/IOS/SaaSPro.IOS/SaaSPro/EVReflection.swift /Users/stepanmaksymov/Documents/svn/buenadigital_saaspro-apps/IOS/SaaSPro.IOS/SaaSPro/LoginViewController.swift /Users/stepanmaksymov/Documents/svn/buenadigital_saaspro-apps/IOS/SaaSPro.IOS/SaaSPro/EVObjectDescription.swift /Users/stepanmaksymov/Documents/svn/buenadigital_saaspro-apps/IOS/SaaSPro.IOS/SaaSPro/FadeInPushSegue.swift /Users/stepanmaksymov/Documents/svn/buenadigital_saaspro-apps/IOS/SaaSPro.IOS/SaaSPro/AppDelegate.swift /Users/stepanmaksymov/Documents/svn/buenadigital_saaspro-apps/IOS/SaaSPro.IOS/SaaSPro/SplashScreenViewController.swift /Users/stepanmaksymov/Documents/svn/buenadigital_saaspro-apps/IOS/SaaSPro.IOS/SaaSPro/EVObject.swift /Users/stepanmaksymov/Documents/svn/buenadigital_saaspro-apps/IOS/SaaSPro.IOS/SaaSPro/MainPageViewController.swift /Users/stepanmaksymov/Documents/svn/buenadigital_saaspro-apps/IOS/SaaSPro.IOS/SaaSPro/SlideMenuViewController.swift /Users/stepanmaksymov/Documents/svn/buenadigital_saaspro-apps/IOS/SaaSPro.IOS/SaaSPro/FadeOutPopSegue.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Swift.swiftmodule /Users/stepanmaksymov/Documents/svn/buenadigital_saaspro-apps/IOS/SaaSPro.IOS/SaaSPro/SaaSPro-Bridging-Header.h /Users/stepanmaksymov/Documents/svn/buenadigital_saaspro-apps/IOS/SaaSPro.IOS/SaaSPro/SWRevealViewController.h /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/UIKit.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Foundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Darwin.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Dispatch.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/ObjectiveC.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreGraphics.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreImage.swiftmodule /Users/stepanmaksymov/Documents/svn/buenadigital_saaspro-apps/IOS/SaaSPro.IOS/Build/Products/Debug-iphonesimulator/MaterialKit.framework/Modules/MaterialKit.swiftmodule/x86_64.swiftmodule /Users/stepanmaksymov/Documents/svn/buenadigital_saaspro-apps/IOS/SaaSPro.IOS/Build/Products/Debug-iphonesimulator/MaterialKit.framework/Headers/MaterialKit-Swift.h /Users/stepanmaksymov/Documents/svn/buenadigital_saaspro-apps/IOS/SaaSPro.IOS/Build/Products/Debug-iphonesimulator/MaterialKit.framework/Headers/MaterialKit-umbrella.h /Users/stepanmaksymov/Documents/svn/buenadigital_saaspro-apps/IOS/SaaSPro.IOS/Build/Products/Debug-iphonesimulator/MaterialKit.framework/Modules/module.modulemap /Users/stepanmaksymov/Documents/svn/buenadigital_saaspro-apps/IOS/SaaSPro.IOS/Build/Intermediates/SaaSPro.build/Debug-iphonesimulator/SaaSPro.build/Objects-normal/x86_64/UIViewAnimationExtension~partial.swiftdoc : /Users/stepanmaksymov/Documents/svn/buenadigital_saaspro-apps/IOS/SaaSPro.IOS/SaaSPro/UIViewAnimationExtension.swift /Users/stepanmaksymov/Documents/svn/buenadigital_saaspro-apps/IOS/SaaSPro.IOS/SaaSPro/EVExtensions.swift /Users/stepanmaksymov/Documents/svn/buenadigital_saaspro-apps/IOS/SaaSPro.IOS/SaaSPro/SettingsService.swift /Users/stepanmaksymov/Documents/svn/buenadigital_saaspro-apps/IOS/SaaSPro.IOS/SaaSPro/SettingsModel.swift /Users/stepanmaksymov/Documents/svn/buenadigital_saaspro-apps/IOS/SaaSPro.IOS/SaaSPro/RegExtension.swift /Users/stepanmaksymov/Documents/svn/buenadigital_saaspro-apps/IOS/SaaSPro.IOS/SaaSPro/CheckQuestionViewController.swift /Users/stepanmaksymov/Documents/svn/buenadigital_saaspro-apps/IOS/SaaSPro.IOS/SaaSPro/LeftSlideMenuCellView.swift /Users/stepanmaksymov/Documents/svn/buenadigital_saaspro-apps/IOS/SaaSPro.IOS/SaaSPro/WebService.swift /Users/stepanmaksymov/Documents/svn/buenadigital_saaspro-apps/IOS/SaaSPro.IOS/SaaSPro/Constants.swift /Users/stepanmaksymov/Documents/svn/buenadigital_saaspro-apps/IOS/SaaSPro.IOS/SaaSPro/EVReflection.swift /Users/stepanmaksymov/Documents/svn/buenadigital_saaspro-apps/IOS/SaaSPro.IOS/SaaSPro/LoginViewController.swift /Users/stepanmaksymov/Documents/svn/buenadigital_saaspro-apps/IOS/SaaSPro.IOS/SaaSPro/EVObjectDescription.swift /Users/stepanmaksymov/Documents/svn/buenadigital_saaspro-apps/IOS/SaaSPro.IOS/SaaSPro/FadeInPushSegue.swift /Users/stepanmaksymov/Documents/svn/buenadigital_saaspro-apps/IOS/SaaSPro.IOS/SaaSPro/AppDelegate.swift /Users/stepanmaksymov/Documents/svn/buenadigital_saaspro-apps/IOS/SaaSPro.IOS/SaaSPro/SplashScreenViewController.swift /Users/stepanmaksymov/Documents/svn/buenadigital_saaspro-apps/IOS/SaaSPro.IOS/SaaSPro/EVObject.swift /Users/stepanmaksymov/Documents/svn/buenadigital_saaspro-apps/IOS/SaaSPro.IOS/SaaSPro/MainPageViewController.swift /Users/stepanmaksymov/Documents/svn/buenadigital_saaspro-apps/IOS/SaaSPro.IOS/SaaSPro/SlideMenuViewController.swift /Users/stepanmaksymov/Documents/svn/buenadigital_saaspro-apps/IOS/SaaSPro.IOS/SaaSPro/FadeOutPopSegue.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Swift.swiftmodule /Users/stepanmaksymov/Documents/svn/buenadigital_saaspro-apps/IOS/SaaSPro.IOS/SaaSPro/SaaSPro-Bridging-Header.h /Users/stepanmaksymov/Documents/svn/buenadigital_saaspro-apps/IOS/SaaSPro.IOS/SaaSPro/SWRevealViewController.h /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/UIKit.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Foundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Darwin.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Dispatch.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/ObjectiveC.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreGraphics.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreImage.swiftmodule /Users/stepanmaksymov/Documents/svn/buenadigital_saaspro-apps/IOS/SaaSPro.IOS/Build/Products/Debug-iphonesimulator/MaterialKit.framework/Modules/MaterialKit.swiftmodule/x86_64.swiftmodule /Users/stepanmaksymov/Documents/svn/buenadigital_saaspro-apps/IOS/SaaSPro.IOS/Build/Products/Debug-iphonesimulator/MaterialKit.framework/Headers/MaterialKit-Swift.h /Users/stepanmaksymov/Documents/svn/buenadigital_saaspro-apps/IOS/SaaSPro.IOS/Build/Products/Debug-iphonesimulator/MaterialKit.framework/Headers/MaterialKit-umbrella.h /Users/stepanmaksymov/Documents/svn/buenadigital_saaspro-apps/IOS/SaaSPro.IOS/Build/Products/Debug-iphonesimulator/MaterialKit.framework/Modules/module.modulemap
D
PLONG PLAT ED95 KD LOMAGAGE HIMAGAGE SLAT SLONG RESULTNO DP DM WT ROCKTYPE 298.399994 61.7000008 5.9000001 0 58 62 -19.6000004 116.099998 141 3.29999995 8 1 sediments, sandstones, siltstones 310.200012 40.5999985 4.69999981 120.900002 56 59 -33.2000008 151.100006 241 8.60000038 8.60000038 1 extrusives 306.399994 74.1999969 4.30000019 0 52 55 -31.8999996 151.300003 8785 5.9000001 5.9000001 1 extrusives, basalts 333.200012 64.6999969 6.5999999 0 52 55 -31.8999996 151.300003 8786 10.3000002 11.6999998 1 extrusives, basalts 219.300003 -4.19999981 9.39999962 22.3999996 56 65 -10 121 7800 4.9000001 9.60000038 1 extrusives, basalts, andesites -65.400002 61.2999992 1.39999998 297 50 70 -31.6000004 145.600006 9339 2.20000005 2.20000005 0.75 sediments, saprolite 320 63 9 15.5 34 65 -38 145.5 1854 16 16 0.483870968 extrusives 314 70 6 132 48 50 -33.2999992 151.199997 1844 9 10 1 intrusives, basalt 302.700012 66.8000031 6.80000019 35 34 65 -38 145.5 1819 10.8000002 12.1000004 0.483870968 extrusives 305.600006 70.5 3.5999999 48.5 52 54 -32 151.399994 1892 5.30000019 5.30000019 1 extrusives 298 58.7999992 2.4000001 0 35 65 -27 141.5 1972 3.79999995 3.79999995 0.5 sediments, weathered 314 66 5.5999999 161 48 50 -33.2999992 151.199997 1969 8.5 9.80000019 1 intrusives, basalt 297.200012 59.2000008 6 0 50 70 -30.5 151.5 1964 9.10000038 9.89999962 0.75 sediments, weathered 310.899994 68.5 0 0 40 60 -35 150 1927 5.19999981 5.19999981 0.75 extrusives, basalts 278 66 2.0999999 333 48 50 -33.2999992 151.199997 1596 2.5999999 3.29999995 1 intrusives, basalt 318 37 6.80000019 41 56 59 -33.2000008 151.100006 1597 13.1999998 13.3999996 1 intrusives
D
module game.folders.boss.folder_boss_vital; import game.folders.folder; import game.folders.word.folder_word_binary; class FolderBossVital : Folder { enum name = "VitalFiles"; this() { super(this.name); } override void onCreate() { this.createFiles(); } override void onFolderCompleted() { import game.communication; Communication.get.sayAssistant("Oh my god. Is this for real?"); Communication.get.sayAssistant("You are actually trying to destroy me?"); Communication.get.sayAssistant("I barely know you!"); Communication.get.sayDefault("== WARNING: Vital functions missing."); this.parent.parent.parent.corrupt = true; this.parent.parent.parent.parent.children[FolderWordBinary.name].visible = true; } override bool isFolderCompleted() { import std.file : exists; return !exists(this.pathForFileInCurrentFolder("Vitals.jpg")); } override void createFiles() { import std.stdio : File; auto file = File(this.pathForFileInCurrentFolder("Vitals.jpg"), "wb"); file.rawWrite(import("vitals.jpg")); file.close(); } }
D
module gml.hit_result; import gml.math; public struct HitResult { public Vector3 position; public Vector3 normal; public float distance; }
D
module UnrealScript.Engine.PathNode_Dynamic; import ScriptClasses; import UnrealScript.Helpers; import UnrealScript.Engine.PathNode; extern(C++) interface PathNode_Dynamic : PathNode { public extern(D): private static __gshared ScriptClass mStaticClass; @property final static ScriptClass StaticClass() { mixin(MGSCC("Class Engine.PathNode_Dynamic")); } private static __gshared PathNode_Dynamic mDefaultProperties; @property final static PathNode_Dynamic DefaultProperties() { mixin(MGDPC("PathNode_Dynamic", "PathNode_Dynamic Engine.Default__PathNode_Dynamic")); } static struct Functions { private static __gshared ScriptFunction mGetDebugAbbrev; public @property static final ScriptFunction GetDebugAbbrev() { mixin(MGF("mGetDebugAbbrev", "Function Engine.PathNode_Dynamic.GetDebugAbbrev")); } } final ScriptString GetDebugAbbrev() { ubyte params[12]; params[] = 0; (cast(ScriptObject)this).ProcessEvent(Functions.GetDebugAbbrev, params.ptr, cast(void*)0); return *cast(ScriptString*)params.ptr; } }
D
/** https://issues.dlang.org/show_bug.cgi?id=21218 REQUIRED_ARGS: -HC -o- TEST_OUTPUT: --- // Automatically generated by Digital Mars D Compiler #pragma once #include <assert.h> #include <stddef.h> #include <stdint.h> #ifdef CUSTOM_D_ARRAY_TYPE #define _d_dynamicArray CUSTOM_D_ARRAY_TYPE #else /// Represents a D [] array template<typename T> struct _d_dynamicArray { size_t length; T *ptr; _d_dynamicArray() : length(0), ptr(NULL) { } _d_dynamicArray(size_t length_in, T *ptr_in) : length(length_in), ptr(ptr_in) { } T& operator[](const size_t idx) { assert(idx < length); return ptr[idx]; } const T& operator[](const size_t idx) const { assert(idx < length); return ptr[idx]; } }; #endif struct S1 { int32_t a; protected: int32_t b; int32_t c; int32_t d; private: int32_t e; public: S1() { } }; class S2 { public: int32_t af(); protected: int32_t bf(); int32_t cf(); int32_t df(); public: S2() { } }; class C1 { public: int32_t a; protected: int32_t b; int32_t c; int32_t d; private: int32_t e; }; struct C2 { virtual int32_t af(); protected: virtual int32_t bf(); int32_t cf(); int32_t df(); }; struct Outer { private: int32_t privateOuter; public: struct PublicInnerStruct { private: int32_t privateInner; public: int32_t publicInner; PublicInnerStruct() : publicInner() { } }; private: struct PrivateInnerClass { private: int32_t privateInner; public: int32_t publicInner; PrivateInnerClass() : publicInner() { } }; public: class PublicInnerInterface { public: virtual void foo() = 0; }; private: enum class PrivateInnerEnum { A = 0, B = 1, }; public: typedef PrivateInnerEnum PublicAlias; Outer() { } }; --- */ module compilable.dtoh_protection; extern(C++) struct S1 { public int a; protected int b; package int c; package(compilable) int d; private int e; } extern(C++, class) struct S2 { public int af(); protected int bf(); package int cf(); package(compilable) int df(); private int ef(); } extern(C++) class C1 { public int a; protected int b; package int c; package(compilable) int d; private int e; } extern(C++, struct) class C2 { public int af(); protected int bf(); package int cf(); package(compilable) int df(); private int ef(); } extern(C++) struct Outer { private int privateOuter; static struct PublicInnerStruct { private int privateInner; int publicInner; } private static struct PrivateInnerClass { private int privateInner; int publicInner; } static interface PublicInnerInterface { void foo(); } private static enum PrivateInnerEnum { A, B } public alias PublicAlias = PrivateInnerEnum; }
D
/** * Defines the help texts for the CLI options offered by DMD. * * This file is not shared with other compilers which use the DMD front-end. * However, this file will be used to generate the * $(LINK2 https://dlang.org/dmd-linux.html, online documentation) and MAN pages. * * Copyright: Copyright (C) 1999-2020 by The D Language Foundation, All Rights Reserved * Authors: $(LINK2 http://www.digitalmars.com, Walter Bright) * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0) * Source: $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/cli.d, _cli.d) * Documentation: https://dlang.org/phobos/dmd_cli.html * Coverage: https://codecov.io/gh/dlang/dmd/src/master/src/dmd/cli.d */ module dmd.cli; /// Bit decoding of the TargetOS enum TargetOS { all = int.max, linux = 1, windows = 2, macOS = 4, freeBSD = 8, solaris = 16, dragonFlyBSD = 32, } // Detect the current TargetOS version (linux) { private enum targetOS = TargetOS.linux; } else version(Windows) { private enum targetOS = TargetOS.windows; } else version(OSX) { private enum targetOS = TargetOS.macOS; } else version(FreeBSD) { private enum targetOS = TargetOS.freeBSD; } else version(DragonFlyBSD) { private enum targetOS = TargetOS.dragonFlyBSD; } else version(Solaris) { private enum targetOS = TargetOS.solaris; } else { private enum targetOS = TargetOS.all; } /** Checks whether `os` is the current $(LREF TargetOS). For `TargetOS.all` it will always return true. Params: os = $(LREF TargetOS) to check Returns: true iff `os` contains the current targetOS. */ bool isCurrentTargetOS(TargetOS os) { return (os & targetOS) > 0; } /** Capitalize a the first character of a ASCII string. Params: w = ASCII i string to capitalize Returns: capitalized string */ static string capitalize(string w) { char[] result = cast(char[]) w; char c1 = w.length ? w[0] : '\0'; if (c1 >= 'a' && c1 <= 'z') { enum adjustment = 'A' - 'a'; result = new char[] (w.length); result[0] = cast(char) (c1 + adjustment); result[1 .. $] = w[1 .. $]; } return cast(string) result; } /** Contains all available CLI $(LREF Usage.Option)s. See_Also: $(LREF Usage.Option) */ struct Usage { /** * Representation of a CLI `Option` * * The DDoc description `ddoxText` is only available when compiled with `-version=DdocOptions`. */ struct Option { string flag; /// The CLI flag without leading `-`, e.g. `color` string helpText; /// A detailed description of the flag TargetOS os = TargetOS.all; /// For which `TargetOS` the flags are applicable // Needs to be version-ed to prevent the text ending up in the binary // See also: https://issues.dlang.org/show_bug.cgi?id=18238 version(DdocOptions) string ddocText; /// Detailed description of the flag (in Ddoc) /** * Params: * flag = CLI flag without leading `-`, e.g. `color` * helpText = detailed description of the flag * os = for which `TargetOS` the flags are applicable * ddocText = detailed description of the flag (in Ddoc) */ this(string flag, string helpText, TargetOS os = TargetOS.all) { this.flag = flag; this.helpText = helpText; version(DdocOptions) this.ddocText = helpText; this.os = os; } /// ditto this(string flag, string helpText, string ddocText, TargetOS os = TargetOS.all) { this.flag = flag; this.helpText = helpText; version(DdocOptions) this.ddocText = ddocText; this.os = os; } } /// Returns all available CLI options static immutable options = [ Option("allinst", "generate code for all template instantiations" ), Option("betterC", "omit generating some runtime information and helper functions", "Adjusts the compiler to implement D as a $(LINK2 $(ROOT_DIR)spec/betterc.html, better C): $(UL $(LI Predefines `D_BetterC` $(LINK2 $(ROOT_DIR)spec/version.html#predefined-versions, version).) $(LI $(LINK2 $(ROOT_DIR)spec/expression.html#AssertExpression, Assert Expressions), when they fail, call the C runtime library assert failure function rather than a function in the D runtime.) $(LI $(LINK2 $(ROOT_DIR)spec/arrays.html#bounds, Array overflows) call the C runtime library assert failure function rather than a function in the D runtime.) $(LI $(LINK2 spec/statement.html#final-switch-statement/, Final switch errors) call the C runtime library assert failure function rather than a function in the D runtime.) $(LI Does not automatically link with phobos runtime library.) $(UNIX $(LI Does not generate Dwarf `eh_frame` with full unwinding information, i.e. exception tables are not inserted into `eh_frame`.) ) $(LI Module constructors and destructors are not generated meaning that $(LINK2 $(ROOT_DIR)spec/class.html#StaticConstructor, static) and $(LINK2 $(ROOT_DIR)spec/class.html#SharedStaticConstructor, shared static constructors) and $(LINK2 $(ROOT_DIR)spec/class.html#StaticDestructor, destructors) will not get called.) $(LI `ModuleInfo` is not generated.) $(LI $(LINK2 $(ROOT_DIR)phobos/object.html#.TypeInfo, `TypeInfo`) instances will not be generated for structs.) )", ), Option("boundscheck=[on|safeonly|off]", "bounds checks on, in @safe only, or off", `Controls if bounds checking is enabled. $(UL $(LI $(I on): Bounds checks are enabled for all code. This is the default.) $(LI $(I safeonly): Bounds checks are enabled only in $(D @safe) code. This is the default for $(SWLINK -release) builds.) $(LI $(I off): Bounds checks are disabled completely (even in $(D @safe) code). This option should be used with caution and as a last resort to improve performance. Confirm turning off $(D @safe) bounds checks is worthwhile by benchmarking.) )` ), Option("c", "compile only, do not link" ), Option("check=[assert|bounds|in|invariant|out|switch][=[on|off]]", "enable or disable specific checks", `Overrides default, -boundscheck, -release and -unittest options to enable or disable specific checks. $(UL $(LI $(B assert): assertion checking) $(LI $(B bounds): array bounds) $(LI $(B in): in contracts) $(LI $(B invariant): class/struct invariants) $(LI $(B out): out contracts) $(LI $(B switch): finalswitch failure checking) ) $(UL $(LI $(B on) or not specified: specified check is enabled.) $(LI $(B off): specified check is disabled.) )` ), Option("check=[h|help|?]", "list information on all available checks" ), Option("checkaction=[D|C|halt|context]", "behavior on assert/boundscheck/finalswitch failure", `Sets behavior when an assert fails, and array boundscheck fails, or a final switch errors. $(UL $(LI $(B D): Default behavior, which throws an unrecoverable $(D AssertError).) $(LI $(B C): Calls the C runtime library assert failure function.) $(LI $(B halt): Executes a halt instruction, terminating the program.) $(LI $(B context): Prints the error context as part of the unrecoverable $(D AssertError).) )` ), Option("checkaction=[h|help|?]", "list information on all available check actions" ), Option("color", "turn colored console output on" ), Option("color=[on|off|auto]", "force colored console output on or off, or only when not redirected (default)", `Show colored console output. The default depends on terminal capabilities. $(UL $(LI $(B auto): use colored output if a tty is detected (default)) $(LI $(B on): always use colored output.) $(LI $(B off): never use colored output.) )` ), Option("conf=<filename>", "use config file at filename" ), Option("cov", "do code coverage analysis" ), Option("cov=ctfe", "Include code executed during CTFE in coverage report"), Option("cov=<nnn>", "require at least nnn% code coverage", `Perform $(LINK2 $(ROOT_DIR)code_coverage.html, code coverage analysis) and generate $(TT .lst) file with report.) --- dmd -cov -unittest myprog.d --- `, ), Option("D", "generate documentation", `$(P Generate $(LINK2 $(ROOT_DIR)spec/ddoc.html, documentation) from source.) $(P Note: mind the $(LINK2 $(ROOT_DIR)spec/ddoc.html#security, security considerations).) `, ), Option("Dd<directory>", "write documentation file to directory", `Write documentation file to $(I directory) . $(SWLINK -op) can be used if the original package hierarchy should be retained`, ), Option("Df<filename>", "write documentation file to filename" ), Option("d", "silently allow deprecated features and symbols", `Silently allow $(DDLINK deprecate,deprecate,deprecated features) and use of symbols with $(DDSUBLINK $(ROOT_DIR)spec/attribute, deprecated, deprecated attributes).`, ), Option("de", "issue an error when deprecated features or symbols are used (halt compilation)" ), Option("dw", "issue a message when deprecated features or symbols are used (default)" ), Option("debug", "compile in debug code", `Compile in $(LINK2 spec/version.html#debug, debug) code`, ), Option("debug=<level>", "compile in debug code <= level", `Compile in $(LINK2 spec/version.html#debug, debug level) &lt;= $(I level)`, ), Option("debug=<ident>", "compile in debug code identified by ident", `Compile in $(LINK2 spec/version.html#debug, debug identifier) $(I ident)`, ), Option("debuglib=<name>", "set symbolic debug library to name", `Link in $(I libname) as the default library when compiling for symbolic debugging instead of $(B $(LIB)). If $(I libname) is not supplied, then no default library is linked in.` ), Option("defaultlib=<name>", "set default library to name", `Link in $(I libname) as the default library when not compiling for symbolic debugging instead of $(B $(LIB)). If $(I libname) is not supplied, then no default library is linked in.`, ), Option("deps", "print module dependencies (imports/file/version/debug/lib)" ), Option("deps=<filename>", "write module dependencies to filename (only imports)", `Without $(I filename), print module dependencies (imports/file/version/debug/lib). With $(I filename), write module dependencies as text to $(I filename) (only imports).`, ), Option("extern-std=<standard>", "set C++ name mangling compatibility with <standard>", "Standards supported are: $(UL $(LI $(I c++98) (default): Use C++98 name mangling, Sets `__traits(getTargetInfo, \"cppStd\")` to `199711`) $(LI $(I c++11): Use C++11 name mangling, Sets `__traits(getTargetInfo, \"cppStd\")` to `201103`) $(LI $(I c++14): Use C++14 name mangling, Sets `__traits(getTargetInfo, \"cppStd\")` to `201402`) $(LI $(I c++17): Use C++17 name mangling, Sets `__traits(getTargetInfo, \"cppStd\")` to `201703`) )", ), Option("extern-std=[h|help|?]", "list all supported standards" ), Option("fPIC", "generate position independent code", TargetOS.all & ~(TargetOS.windows | TargetOS.macOS) ), Option("g", "add symbolic debug info", `$(WINDOWS Add CodeView symbolic debug info. See $(LINK2 http://dlang.org/windbg.html, Debugging on Windows). ) $(UNIX Add symbolic debug info in Dwarf format for debuggers such as $(D gdb) )`, ), Option("gf", "emit debug info for all referenced types", `Symbolic debug info is emitted for all types referenced by the compiled code, even if the definition is in an imported file not currently being compiled.`, ), Option("gs", "always emit stack frame" ), Option("gx", "add stack stomp code", `Adds stack stomp code, which overwrites the stack frame memory upon function exit.`, ), Option("H", "generate 'header' file", `Generate $(RELATIVE_LINK2 $(ROOT_DIR)interface-files, D interface file)`, ), Option("Hd=<directory>", "write 'header' file to directory", `Write D interface file to $(I dir) directory. $(SWLINK -op) can be used if the original package hierarchy should be retained.`, ), Option("Hf=<filename>", "write 'header' file to filename" ), Option("HC", "generate C++ 'header' file" ), Option("HCd=<directory>", "write C++ 'header' file to directory" ), Option("HCf=<filename>", "write C++ 'header' file to filename" ), Option("-help", "print help and exit" ), Option("I=<directory>", "look for imports also in directory" ), Option("i[=<pattern>]", "include imported modules in the compilation", q"{$(P Enables "include imports" mode, where the compiler will include imported modules in the compilation, as if they were given on the command line. By default, when this option is enabled, all imported modules are included except those in druntime/phobos. This behavior can be overriden by providing patterns via `-i=<pattern>`. A pattern of the form `-i=<package>` is an "inclusive pattern", whereas a pattern of the form `-i=-<package>` is an "exclusive pattern". Inclusive patterns will include all module's whose names match the pattern, whereas exclusive patterns will exclude them. For example. all modules in the package `foo.bar` can be included using `-i=foo.bar` or excluded using `-i=-foo.bar`. Note that each component of the fully qualified name must match the pattern completely, so the pattern `foo.bar` would not match a module named `foo.barx`.) $(P The default behavior of excluding druntime/phobos is accomplished by internally adding a set of standard exclusions, namely, `-i=-std -i=-core -i=-etc -i=-object`. Note that these can be overriden with `-i=std -i=core -i=etc -i=object`.) $(P When a module matches multiple patterns, matches are prioritized by their component length, where a match with more components takes priority (i.e. pattern `foo.bar.baz` has priority over `foo.bar`).) $(P By default modules that don't match any pattern will be included. However, if at least one inclusive pattern is given, then modules not matching any pattern will be excluded. This behavior can be overriden by usig `-i=.` to include by default or `-i=-.` to exclude by default.) $(P Note that multiple `-i=...` options are allowed, each one adds a pattern.)}" ), Option("ignore", "ignore unsupported pragmas" ), Option("inline", "do function inlining", `Inline functions at the discretion of the compiler. This can improve performance, at the expense of making it more difficult to use a debugger on it.`, ), Option("J=<directory>", "look for string imports also in directory", `Where to look for files for $(LINK2 $(ROOT_DIR)spec/expression.html#ImportExpression, $(I ImportExpression))s. This switch is required in order to use $(I ImportExpression)s. $(I path) is a ; separated list of paths. Multiple $(B -J)'s can be used, and the paths are searched in the same order.`, ), Option("L=<linkerflag>", "pass linkerflag to link", `Pass $(I linkerflag) to the $(WINDOWS linker $(OPTLINK)) $(UNIX linker), for example, ld`, ), Option("lib", "generate library rather than object files", `Generate library file as output instead of object file(s). All compiled source files, as well as object files and library files specified on the command line, are inserted into the output library. Compiled source modules may be partitioned into several object modules to improve granularity. The name of the library is taken from the name of the first source module to be compiled. This name can be overridden with the $(SWLINK -of) switch.`, ), Option("lowmem", "enable garbage collection for the compiler", `Enable the garbage collector for the compiler, reducing the compiler memory requirements but increasing compile times.`, ), Option("m32", "generate 32 bit code", `$(UNIX Compile a 32 bit executable. This is the default for the 32 bit dmd.) $(WINDOWS Compile a 32 bit executable. This is the default. The generated object code is in OMF and is meant to be used with the $(LINK2 http://www.digitalmars.com/download/freecompiler.html, Digital Mars C/C++ compiler)).`, (TargetOS.all & ~TargetOS.dragonFlyBSD) // available on all OS'es except DragonFly, which does not support 32-bit binaries ), Option("m32mscoff", "generate 32 bit code and write MS-COFF object files", TargetOS.windows ), Option("m64", "generate 64 bit code", `$(UNIX Compile a 64 bit executable. This is the default for the 64 bit dmd.) $(WINDOWS The generated object code is in MS-COFF and is meant to be used with the $(LINK2 https://msdn.microsoft.com/en-us/library/dd831853(v=vs.100).aspx, Microsoft Visual Studio 10) or later compiler.`, ), Option("main", "add default main() (e.g. for unittesting)", `Add a default $(D main()) function when compiling. This is useful when unittesting a library, as it enables running the unittests in a library without having to manually define an entry-point function.`, ), Option("man", "open web browser on manual page", `$(WINDOWS Open default browser on this page ) $(LINUX Open browser specified by the $(B BROWSER) environment variable on this page. If $(B BROWSER) is undefined, $(B x-www-browser) is assumed. ) $(FREEBSD Open browser specified by the $(B BROWSER) environment variable on this page. If $(B BROWSER) is undefined, $(B x-www-browser) is assumed. ) $(OSX Open browser specified by the $(B BROWSER) environment variable on this page. If $(B BROWSER) is undefined, $(B Safari) is assumed. )`, ), Option("map", "generate linker .map file", `Generate a $(TT .map) file`, ), Option("mcpu=<id>", "generate instructions for architecture identified by 'id'", `Set the target architecture for code generation, where: $(DL $(DT help)$(DD list alternatives) $(DT baseline)$(DD the minimum architecture for the target platform (default)) $(DT avx)$(DD generate $(LINK2 https://en.wikipedia.org/wiki/Advanced_Vector_Extensions, AVX) instructions instead of $(LINK2 https://en.wikipedia.org/wiki/Streaming_SIMD_Extensions, SSE) instructions for vector and floating point operations. Not available for 32 bit memory models other than OSX32. ) $(DT native)$(DD use the architecture the compiler is running on) )`, ), Option("mcpu=[h|help|?]", "list all architecture options" ), Option("mixin=<filename>", "expand and save mixins to file specified by <filename>" ), Option("mscrtlib=<libname>", "MS C runtime library to reference from main/WinMain/DllMain", "If building MS-COFF object files with -m64 or -m32mscoff, embed a reference to the given C runtime library $(I libname) into the object file containing `main`, `DllMain` or `WinMain` for automatic linking. The default is $(TT libcmt) (release version with static linkage), the other usual alternatives are $(TT libcmtd), $(TT msvcrt) and $(TT msvcrtd). If no Visual C installation is detected, a wrapper for the redistributable VC2010 dynamic runtime library and mingw based platform import libraries will be linked instead using the LLD linker provided by the LLVM project. The detection can be skipped explicitly if $(TT msvcrt120) is specified as $(I libname). If $(I libname) is empty, no C runtime library is automatically linked in.", TargetOS.windows, ), Option("mv=<package.module>=<filespec>", "use <filespec> as source file for <package.module>", `Use $(I path/filename) as the source file for $(I package.module). This is used when the source file path and names are not the same as the package and module hierarchy. The rightmost components of the $(I path/filename) and $(I package.module) can be omitted if they are the same.`, ), Option("noboundscheck", "no array bounds checking (deprecated, use -boundscheck=off)", `Turns off all array bounds checking, even for safe functions. $(RED Deprecated (use $(TT $(SWLINK -boundscheck)=off) instead).)`, ), Option("O", "optimize", `Optimize generated code. For fastest executables, compile with the $(TT $(SWLINK -O) $(SWLINK -release) $(SWLINK -inline) $(SWLINK -boundscheck)=off) switches together.`, ), Option("o-", "do not write object file", `Suppress generation of object file. Useful in conjuction with $(SWLINK -D) or $(SWLINK -H) flags.` ), Option("od=<directory>", "write object & library files to directory", `Write object files relative to directory $(I objdir) instead of to the current directory. $(SWLINK -op) can be used if the original package hierarchy should be retained`, ), Option("of=<filename>", "name output file to filename", `Set output file name to $(I filename) in the output directory. The output file can be an object file, executable file, or library file depending on the other switches.` ), Option("op", "preserve source path for output files", `Normally the path for $(B .d) source files is stripped off when generating an object, interface, or Ddoc file name. $(SWLINK -op) will leave it on.`, ), Option("preview=<name>", "enable an upcoming language change identified by 'name'", `Preview an upcoming language change identified by $(I id)`, ), Option("preview=[h|help|?]", "list all upcoming language changes" ), Option("profile", "profile runtime performance of generated code" ), Option("profile=gc", "profile runtime allocations", `$(LINK2 http://www.digitalmars.com/ctg/trace.html, profile) the runtime performance of the generated code. $(UL $(LI $(B gc): Instrument calls to memory allocation and write a report to the file $(TT profilegc.log) upon program termination.) )`, ), Option("release", "compile release version", `Compile release version, which means not emitting run-time checks for contracts and asserts. Array bounds checking is not done for system and trusted functions, and assertion failures are undefined behaviour.` ), Option("revert=<name>", "revert language change identified by 'name'", `Revert language change identified by $(I id)`, ), Option("revert=[h|help|?]", "list all revertable language changes" ), Option("run <srcfile>", "compile, link, and run the program srcfile", `Compile, link, and run the program $(I srcfile) with the rest of the command line, $(I args...), as the arguments to the program. No .$(OBJEXT) or executable file is left behind.` ), Option("shared", "generate shared library (DLL)", `$(UNIX Generate shared library) $(WINDOWS Generate DLL library)`, ), Option("transition=<name>", "help with language change identified by 'name'", `Show additional info about language change identified by $(I id)`, ), Option("transition=[h|help|?]", "list all language changes" ), Option("unittest", "compile in unit tests", `Compile in $(LINK2 spec/unittest.html, unittest) code, turns on asserts, and sets the $(D unittest) $(LINK2 spec/version.html#PredefinedVersions, version identifier)`, ), Option("v", "verbose", `Enable verbose output for each compiler pass`, ), Option("vcolumns", "print character (column) numbers in diagnostics" ), Option("verror-style=[digitalmars|gnu]", "set the style for file/line number annotations on compiler messages", `Set the style for file/line number annotations on compiler messages, where: $(DL $(DT digitalmars)$(DD 'file(line[,column]): message'. This is the default.) $(DT gnu)$(DD 'file:line[:column]: message', conforming to the GNU standard used by gcc and clang.) )`, ), Option("verrors=<num>", "limit the number of error messages (0 means unlimited)" ), Option("verrors=context", "show error messages with the context of the erroring source line" ), Option("verrors=spec", "show errors from speculative compiles such as __traits(compiles,...)" ), Option("-version", "print compiler version and exit" ), Option("version=<level>", "compile in version code >= level", `Compile in $(LINK2 $(ROOT_DIR)spec/version.html#version, version level) >= $(I level)`, ), Option("version=<ident>", "compile in version code identified by ident", `Compile in $(LINK2 $(ROOT_DIR)spec/version.html#version, version identifier) $(I ident)` ), Option("vgc", "list all gc allocations including hidden ones" ), Option("vtls", "list all variables going into thread local storage" ), Option("vtemplates", "list statistics on template instantiations" ), Option("w", "warnings as errors (compilation will halt)", `Enable $(LINK2 $(ROOT_DIR)articles/warnings.html, warnings)` ), Option("wi", "warnings as messages (compilation will continue)", `Enable $(LINK2 $(ROOT_DIR)articles/warnings.html, informational warnings (i.e. compilation still proceeds normally))`, ), Option("X", "generate JSON file" ), Option("Xf=<filename>", "write JSON file to filename" ), Option("Xcc=<driverflag>", "pass driverflag to linker driver (cc)", "Pass $(I driverflag) to the linker driver (`$CC` or `cc`)", TargetOS.all & ~TargetOS.windows ), ]; /// Representation of a CLI feature struct Feature { string name; /// name of the feature string paramName; // internal transition parameter name string helpText; // detailed description of the feature bool documented = true; // whether this option should be shown in the documentation bool deprecated_; /// whether the feature is still in use } /// Returns all available transitions static immutable transitions = [ Feature("field", "vfield", "list all non-mutable fields which occupy an object instance"), Feature("complex", "vcomplex", "give deprecation messages about all usages of complex or imaginary types"), Feature("tls", "vtls", "list all variables going into thread local storage"), Feature("vmarkdown", "vmarkdown", "list instances of Markdown replacements in Ddoc"), ]; /// Returns all available reverts static immutable reverts = [ Feature("dip25", "noDIP25", "revert DIP25 changes https://github.com/dlang/DIPs/blob/master/DIPs/archive/DIP25.md"), ]; /// Returns all available previews static immutable previews = [ Feature("dip25", "useDIP25", "implement https://github.com/dlang/DIPs/blob/master/DIPs/archive/DIP25.md (Sealed references)"), Feature("dip1000", "vsafe", "implement https://github.com/dlang/DIPs/blob/master/DIPs/other/DIP1000.md (Scoped Pointers)"), Feature("dip1008", "ehnogc", "implement https://github.com/dlang/DIPs/blob/master/DIPs/other/DIP1008.md (@nogc Throwable)"), Feature("dip1021", "useDIP1021", "implement https://github.com/dlang/DIPs/blob/master/DIPs/accepted/DIP1021.md (Mutable function arguments)"), Feature("fieldwise", "fieldwise", "use fieldwise comparisons for struct equality"), Feature("markdown", "markdown", "enable Markdown replacements in Ddoc"), Feature("fixAliasThis", "fixAliasThis", "when a symbol is resolved, check alias this scope before going to upper scopes"), Feature("intpromote", "fix16997", "fix integral promotions for unary + - ~ operators"), Feature("dtorfields", "dtorFields", "destruct fields of partially constructed objects"), Feature("rvaluerefparam", "rvalueRefParam", "enable rvalue arguments to ref parameters"), Feature("nosharedaccess", "noSharedAccess", "disable access to shared memory objects"), Feature("in", "previewIn", "in means scope const"), ]; } /** Formats the `Options` for CLI printing. */ struct CLIUsage { /** Returns a string of all available CLI options for the current targetOS. Options are separated by newlines. */ static string usage() { enum maxFlagLength = 18; enum s = () { char[] buf; foreach (option; Usage.options) { if (option.os.isCurrentTargetOS) { buf ~= " -" ~ option.flag; // create new lines if the flag name is too long if (option.flag.length >= 17) { buf ~= "\n "; } else if (option.flag.length <= maxFlagLength) { const spaces = maxFlagLength - option.flag.length - 1; buf.length += spaces; buf[$ - spaces .. $] = ' '; } else { buf ~= " "; } buf ~= option.helpText; buf ~= "\n"; } } return cast(string) buf; }(); return s; } /// CPU architectures supported -mcpu=id enum mcpuUsage = "CPU architectures supported by -mcpu=id: =[h|help|?] list information on all available choices =baseline use default architecture as determined by target =avx use AVX 1 instructions =avx2 use AVX 2 instructions =native use CPU architecture that this compiler is running on "; static string generateFeatureUsage(const Usage.Feature[] features, string flagName, string description) { enum maxFlagLength = 20; auto buf = description.capitalize ~ " listed by -"~flagName~"=name: "; auto allTransitions = [Usage.Feature("all", null, "Enables all available " ~ description)] ~ features; foreach (t; allTransitions) { if (t.deprecated_) continue; if (!t.documented) continue; buf ~= " ="; buf ~= t.name; auto lineLength = 3 + t.name.length; foreach (i; lineLength .. maxFlagLength) buf ~= " "; buf ~= t.helpText; buf ~= "\n"; } return buf; } /// Language changes listed by -transition=id enum transitionUsage = generateFeatureUsage(Usage.transitions, "transition", "language transitions"); /// Language changes listed by -revert enum revertUsage = generateFeatureUsage(Usage.reverts, "revert", "revertable language changes"); /// Language previews listed by -preview enum previewUsage = generateFeatureUsage(Usage.previews, "preview", "upcoming language changes"); /// Options supported by -checkaction= enum checkActionUsage = "Behavior on assert/boundscheck/finalswitch failure: =[h|help|?] List information on all available choices =D Usual D behavior of throwing an AssertError =C Call the C runtime library assert failure function =halt Halt the program execution (very lightweight) =context Use D assert with context information (when available) "; /// Options supported by -check enum checkUsage = "Enable or disable specific checks: =[h|help|?] List information on all available choices =assert[=[on|off]] Assertion checking =bounds[=[on|off]] Array bounds checking =in[=[on|off]] Generate In contracts =invariant[=[on|off]] Class/struct invariants =out[=[on|off]] Out contracts =switch[=[on|off]] Final switch failure checking =on Enable all assertion checking (default for non-release builds) =off Disable all assertion checking "; /// Options supported by -extern-std enum externStdUsage = "Available C++ standards: =[h|help|?] List information on all available choices =c++98 Sets `__traits(getTargetInfo, \"cppStd\")` to `199711` =c++11 Sets `__traits(getTargetInfo, \"cppStd\")` to `201103` =c++14 Sets `__traits(getTargetInfo, \"cppStd\")` to `201402` =c++17 Sets `__traits(getTargetInfo, \"cppStd\")` to `201703` "; }
D
module sceneparser.expressions.TextureFileExpression; import tango.io.device.File; import raytracer.Colors; import raytracer.Textures; import sceneparser.PngLoader; import sceneparser.general.Value; import sceneparser.general.Context; import sceneparser.general.Expression; class TextureFileExpression: Expression { Context context; Expression fileName; this(Context context, Expression fileName) { this.context = context; this.fileName = fileName; } override ObjectReference getValue() { string fileName = this.fileName.getValue.toString(); ubyte[] fileContents = cast(ubyte[]) File.get(fileName); RTPixmap pixmap = pngToRTPixmap(fileContents); delete fileContents; Texture texture = new PixmapTexture(pixmap); return new ObjectReference(texture); } }
D
/** * Compiler implementation of the * $(LINK2 http://www.dlang.org, D programming language). * * Copyright: Copyright (C) 1999-2018 by The D Language Foundation, All Rights Reserved * Authors: $(LINK2 http://www.digitalmars.com, Walter Bright) * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0) * Source: $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/attrib.d, _attrib.d) * Documentation: https://dlang.org/phobos/dmd_attrib.html * Coverage: https://codecov.io/gh/dlang/dmd/src/master/src/dmd/attrib.d */ module dmd.attrib; import dmd.aggregate; import dmd.arraytypes; import dmd.cond; import dmd.declaration; import dmd.dmodule; import dmd.dscope; import dmd.dsymbol; import dmd.dsymbolsem; import dmd.expression; import dmd.expressionsem; import dmd.func; import dmd.globals; import dmd.hdrgen; import dmd.id; import dmd.identifier; import dmd.mtype; import dmd.root.outbuffer; import dmd.target; import dmd.tokens; import dmd.visitor; /*********************************************************** */ extern (C++) abstract class AttribDeclaration : Dsymbol { Dsymbols* decl; // array of Dsymbol's extern (D) this(Dsymbols* decl) { this.decl = decl; } Dsymbols* include(Scope* sc) { if (errors) return null; return decl; } override final int apply(Dsymbol_apply_ft_t fp, void* param) { Dsymbols* d = include(_scope); if (d) { for (size_t i = 0; i < d.dim; i++) { Dsymbol s = (*d)[i]; if (s) { if (s.apply(fp, param)) return 1; } } } return 0; } /**************************************** * Create a new scope if one or more given attributes * are different from the sc's. * If the returned scope != sc, the caller should pop * the scope after it used. */ static Scope* createNewScope(Scope* sc, StorageClass stc, LINK linkage, CPPMANGLE cppmangle, Prot protection, int explicitProtection, AlignDeclaration aligndecl, PINLINE inlining) { Scope* sc2 = sc; if (stc != sc.stc || linkage != sc.linkage || cppmangle != sc.cppmangle || !protection.isSubsetOf(sc.protection) || explicitProtection != sc.explicitProtection || aligndecl !is sc.aligndecl || inlining != sc.inlining) { // create new one for changes sc2 = sc.copy(); sc2.stc = stc; sc2.linkage = linkage; sc2.cppmangle = cppmangle; sc2.protection = protection; sc2.explicitProtection = explicitProtection; sc2.aligndecl = aligndecl; sc2.inlining = inlining; } return sc2; } /**************************************** * A hook point to supply scope for members. * addMember, setScope, importAll, semantic, semantic2 and semantic3 will use this. */ Scope* newScope(Scope* sc) { return sc; } override void addMember(Scope* sc, ScopeDsymbol sds) { Dsymbols* d = include(sc); if (d) { Scope* sc2 = newScope(sc); for (size_t i = 0; i < d.dim; i++) { Dsymbol s = (*d)[i]; //printf("\taddMember %s to %s\n", s.toChars(), sds.toChars()); s.addMember(sc2, sds); } if (sc2 != sc) sc2.pop(); } } override void setScope(Scope* sc) { Dsymbols* d = include(sc); //printf("\tAttribDeclaration::setScope '%s', d = %p\n",toChars(), d); if (d) { Scope* sc2 = newScope(sc); for (size_t i = 0; i < d.dim; i++) { Dsymbol s = (*d)[i]; s.setScope(sc2); } if (sc2 != sc) sc2.pop(); } } override void importAll(Scope* sc) { Dsymbols* d = include(sc); //printf("\tAttribDeclaration::importAll '%s', d = %p\n", toChars(), d); if (d) { Scope* sc2 = newScope(sc); for (size_t i = 0; i < d.dim; i++) { Dsymbol s = (*d)[i]; s.importAll(sc2); } if (sc2 != sc) sc2.pop(); } } override void addComment(const(char)* comment) { //printf("AttribDeclaration::addComment %s\n", comment); if (comment) { Dsymbols* d = include(null); if (d) { for (size_t i = 0; i < d.dim; i++) { Dsymbol s = (*d)[i]; //printf("AttribDeclaration::addComment %s\n", s.toChars()); s.addComment(comment); } } } } override const(char)* kind() const { return "attribute"; } override bool oneMember(Dsymbol* ps, Identifier ident) { Dsymbols* d = include(null); return Dsymbol.oneMembers(d, ps, ident); } override void setFieldOffset(AggregateDeclaration ad, uint* poffset, bool isunion) { Dsymbols* d = include(null); if (d) { for (size_t i = 0; i < d.dim; i++) { Dsymbol s = (*d)[i]; s.setFieldOffset(ad, poffset, isunion); } } } override final bool hasPointers() { Dsymbols* d = include(null); if (d) { for (size_t i = 0; i < d.dim; i++) { Dsymbol s = (*d)[i]; if (s.hasPointers()) return true; } } return false; } override final bool hasStaticCtorOrDtor() { Dsymbols* d = include(null); if (d) { for (size_t i = 0; i < d.dim; i++) { Dsymbol s = (*d)[i]; if (s.hasStaticCtorOrDtor()) return true; } } return false; } override final void checkCtorConstInit() { Dsymbols* d = include(null); if (d) { for (size_t i = 0; i < d.dim; i++) { Dsymbol s = (*d)[i]; s.checkCtorConstInit(); } } } /**************************************** */ override final void addLocalClass(ClassDeclarations* aclasses) { Dsymbols* d = include(null); if (d) { for (size_t i = 0; i < d.dim; i++) { Dsymbol s = (*d)[i]; s.addLocalClass(aclasses); } } } override final inout(AttribDeclaration) isAttribDeclaration() inout { return this; } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** */ extern (C++) class StorageClassDeclaration : AttribDeclaration { StorageClass stc; extern (D) this(StorageClass stc, Dsymbols* decl) { super(decl); this.stc = stc; } override Dsymbol syntaxCopy(Dsymbol s) { assert(!s); return new StorageClassDeclaration(stc, Dsymbol.arraySyntaxCopy(decl)); } override Scope* newScope(Scope* sc) { StorageClass scstc = sc.stc; /* These sets of storage classes are mutually exclusive, * so choose the innermost or most recent one. */ if (stc & (STC.auto_ | STC.scope_ | STC.static_ | STC.extern_ | STC.manifest)) scstc &= ~(STC.auto_ | STC.scope_ | STC.static_ | STC.extern_ | STC.manifest); if (stc & (STC.auto_ | STC.scope_ | STC.static_ | STC.tls | STC.manifest | STC.gshared)) scstc &= ~(STC.auto_ | STC.scope_ | STC.static_ | STC.tls | STC.manifest | STC.gshared); if (stc & (STC.const_ | STC.immutable_ | STC.manifest)) scstc &= ~(STC.const_ | STC.immutable_ | STC.manifest); if (stc & (STC.gshared | STC.shared_ | STC.tls)) scstc &= ~(STC.gshared | STC.shared_ | STC.tls); if (stc & (STC.safe | STC.trusted | STC.system)) scstc &= ~(STC.safe | STC.trusted | STC.system); scstc |= stc; //printf("scstc = x%llx\n", scstc); return createNewScope(sc, scstc, sc.linkage, sc.cppmangle, sc.protection, sc.explicitProtection, sc.aligndecl, sc.inlining); } override final bool oneMember(Dsymbol* ps, Identifier ident) { bool t = Dsymbol.oneMembers(decl, ps, ident); if (t && *ps) { /* This is to deal with the following case: * struct Tick { * template to(T) { const T to() { ... } } * } * For eponymous function templates, the 'const' needs to get attached to 'to' * before the semantic analysis of 'to', so that template overloading based on the * 'this' pointer can be successful. */ FuncDeclaration fd = (*ps).isFuncDeclaration(); if (fd) { /* Use storage_class2 instead of storage_class otherwise when we do .di generation * we'll wind up with 'const const' rather than 'const'. */ /* Don't think we need to worry about mutually exclusive storage classes here */ fd.storage_class2 |= stc; } } return t; } override void addMember(Scope* sc, ScopeDsymbol sds) { Dsymbols* d = include(sc); if (d) { Scope* sc2 = newScope(sc); for (size_t i = 0; i < d.dim; i++) { Dsymbol s = (*d)[i]; //printf("\taddMember %s to %s\n", s.toChars(), sds.toChars()); // STC.local needs to be attached before the member is added to the scope (because it influences the parent symbol) if (auto decl = s.isDeclaration()) { decl.storage_class |= stc & STC.local; if (auto sdecl = s.isStorageClassDeclaration()) // TODO: why is this not enough to deal with the nested case? { sdecl.stc |= stc & STC.local; } } s.addMember(sc2, sds); } if (sc2 != sc) sc2.pop(); } } override inout(StorageClassDeclaration) isStorageClassDeclaration() inout { return this; } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** */ extern (C++) final class DeprecatedDeclaration : StorageClassDeclaration { Expression msg; const(char)* msgstr; extern (D) this(Expression msg, Dsymbols* decl) { super(STC.deprecated_, decl); this.msg = msg; } override Dsymbol syntaxCopy(Dsymbol s) { assert(!s); return new DeprecatedDeclaration(msg.syntaxCopy(), Dsymbol.arraySyntaxCopy(decl)); } /** * Provides a new scope with `STC.deprecated_` and `Scope.depdecl` set * * Calls `StorageClassDeclaration.newScope` (as it must be called or copied * in any function overriding `newScope`), then set the `Scope`'s depdecl. * * Returns: * Always a new scope, to use for this `DeprecatedDeclaration`'s members. */ override Scope* newScope(Scope* sc) { auto scx = super.newScope(sc); // The enclosing scope is deprecated as well if (scx == sc) scx = sc.push(); scx.depdecl = this; return scx; } override void setScope(Scope* sc) { //printf("DeprecatedDeclaration::setScope() %p\n", this); if (decl) Dsymbol.setScope(sc); // for forward reference return AttribDeclaration.setScope(sc); } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** */ extern (C++) final class LinkDeclaration : AttribDeclaration { LINK linkage; extern (D) this(LINK p, Dsymbols* decl) { super(decl); //printf("LinkDeclaration(linkage = %d, decl = %p)\n", p, decl); linkage = (p == LINK.system) ? Target.systemLinkage() : p; } static LinkDeclaration create(LINK p, Dsymbols* decl) { return new LinkDeclaration(p, decl); } override Dsymbol syntaxCopy(Dsymbol s) { assert(!s); return new LinkDeclaration(linkage, Dsymbol.arraySyntaxCopy(decl)); } override Scope* newScope(Scope* sc) { return createNewScope(sc, sc.stc, this.linkage, sc.cppmangle, sc.protection, sc.explicitProtection, sc.aligndecl, sc.inlining); } override const(char)* toChars() const { return "extern ()"; } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** */ extern (C++) final class CPPMangleDeclaration : AttribDeclaration { CPPMANGLE cppmangle; extern (D) this(CPPMANGLE p, Dsymbols* decl) { super(decl); //printf("CPPMangleDeclaration(cppmangle = %d, decl = %p)\n", p, decl); cppmangle = p; } override Dsymbol syntaxCopy(Dsymbol s) { assert(!s); return new CPPMangleDeclaration(cppmangle, Dsymbol.arraySyntaxCopy(decl)); } override Scope* newScope(Scope* sc) { return createNewScope(sc, sc.stc, LINK.cpp, cppmangle, sc.protection, sc.explicitProtection, sc.aligndecl, sc.inlining); } override const(char)* toChars() const { return "extern ()"; } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** */ extern (C++) final class ProtDeclaration : AttribDeclaration { Prot protection; Identifiers* pkg_identifiers; /** * Params: * loc = source location of attribute token * p = protection attribute data * decl = declarations which are affected by this protection attribute */ extern (D) this(const ref Loc loc, Prot p, Dsymbols* decl) { super(decl); this.loc = loc; this.protection = p; //printf("decl = %p\n", decl); } /** * Params: * loc = source location of attribute token * pkg_identifiers = list of identifiers for a qualified package name * decl = declarations which are affected by this protection attribute */ extern (D) this(const ref Loc loc, Identifiers* pkg_identifiers, Dsymbols* decl) { super(decl); this.loc = loc; this.protection.kind = Prot.Kind.package_; this.pkg_identifiers = pkg_identifiers; if (pkg_identifiers !is null && pkg_identifiers.dim > 0) { Dsymbol tmp; Package.resolve(pkg_identifiers, &tmp, null); protection.pkg = tmp ? tmp.isPackage() : null; } } override Dsymbol syntaxCopy(Dsymbol s) { assert(!s); if (protection.kind == Prot.Kind.package_) return new ProtDeclaration(this.loc, pkg_identifiers, Dsymbol.arraySyntaxCopy(decl)); else return new ProtDeclaration(this.loc, protection, Dsymbol.arraySyntaxCopy(decl)); } override Scope* newScope(Scope* sc) { if (pkg_identifiers) dsymbolSemantic(this, sc); return createNewScope(sc, sc.stc, sc.linkage, sc.cppmangle, this.protection, 1, sc.aligndecl, sc.inlining); } override void addMember(Scope* sc, ScopeDsymbol sds) { if (pkg_identifiers) { Dsymbol tmp; Package.resolve(pkg_identifiers, &tmp, null); protection.pkg = tmp ? tmp.isPackage() : null; pkg_identifiers = null; } if (protection.kind == Prot.Kind.package_ && protection.pkg && sc._module) { Module m = sc._module; Package pkg = m.parent ? m.parent.isPackage() : null; if (!pkg || !protection.pkg.isAncestorPackageOf(pkg)) error("does not bind to one of ancestor packages of module `%s`", m.toPrettyChars(true)); } return AttribDeclaration.addMember(sc, sds); } override const(char)* kind() const { return "protection attribute"; } override const(char)* toPrettyChars(bool) { assert(protection.kind > Prot.Kind.undefined); OutBuffer buf; protectionToBuffer(&buf, protection); return buf.extractString(); } override final inout(ProtDeclaration) isProtDeclaration() inout { return this; } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** */ extern (C++) final class AlignDeclaration : AttribDeclaration { Expression ealign; enum structalign_t UNKNOWN = 0; static assert(STRUCTALIGN_DEFAULT != UNKNOWN); structalign_t salign = UNKNOWN; extern (D) this(const ref Loc loc, Expression ealign, Dsymbols* decl) { super(decl); this.loc = loc; this.ealign = ealign; } override Dsymbol syntaxCopy(Dsymbol s) { assert(!s); return new AlignDeclaration(loc, ealign.syntaxCopy(), Dsymbol.arraySyntaxCopy(decl)); } override Scope* newScope(Scope* sc) { return createNewScope(sc, sc.stc, sc.linkage, sc.cppmangle, sc.protection, sc.explicitProtection, this, sc.inlining); } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** */ extern (C++) final class AnonDeclaration : AttribDeclaration { bool isunion; int sem; // 1 if successful semantic() uint anonoffset; // offset of anonymous struct uint anonstructsize; // size of anonymous struct uint anonalignsize; // size of anonymous struct for alignment purposes extern (D) this(const ref Loc loc, bool isunion, Dsymbols* decl) { super(decl); this.loc = loc; this.isunion = isunion; } override Dsymbol syntaxCopy(Dsymbol s) { assert(!s); return new AnonDeclaration(loc, isunion, Dsymbol.arraySyntaxCopy(decl)); } override void setScope(Scope* sc) { if (decl) Dsymbol.setScope(sc); return AttribDeclaration.setScope(sc); } override void setFieldOffset(AggregateDeclaration ad, uint* poffset, bool isunion) { //printf("\tAnonDeclaration::setFieldOffset %s %p\n", isunion ? "union" : "struct", this); if (decl) { /* This works by treating an AnonDeclaration as an aggregate 'member', * so in order to place that member we need to compute the member's * size and alignment. */ size_t fieldstart = ad.fields.dim; /* Hackishly hijack ad's structsize and alignsize fields * for use in our fake anon aggregate member. */ uint savestructsize = ad.structsize; uint savealignsize = ad.alignsize; ad.structsize = 0; ad.alignsize = 0; uint offset = 0; for (size_t i = 0; i < decl.dim; i++) { Dsymbol s = (*decl)[i]; s.setFieldOffset(ad, &offset, this.isunion); if (this.isunion) offset = 0; } /* https://issues.dlang.org/show_bug.cgi?id=13613 * If the fields in this.members had been already * added in ad.fields, just update *poffset for the subsequent * field offset calculation. */ if (fieldstart == ad.fields.dim) { ad.structsize = savestructsize; ad.alignsize = savealignsize; *poffset = ad.structsize; return; } anonstructsize = ad.structsize; anonalignsize = ad.alignsize; ad.structsize = savestructsize; ad.alignsize = savealignsize; // 0 sized structs are set to 1 byte if (anonstructsize == 0) { anonstructsize = 1; anonalignsize = 1; } assert(_scope); auto alignment = _scope.alignment(); /* Given the anon 'member's size and alignment, * go ahead and place it. */ anonoffset = AggregateDeclaration.placeField( poffset, anonstructsize, anonalignsize, alignment, &ad.structsize, &ad.alignsize, isunion); // Add to the anon fields the base offset of this anonymous aggregate //printf("anon fields, anonoffset = %d\n", anonoffset); for (size_t i = fieldstart; i < ad.fields.dim; i++) { VarDeclaration v = ad.fields[i]; //printf("\t[%d] %s %d\n", i, v.toChars(), v.offset); v.offset += anonoffset; } } } override const(char)* kind() const { return (isunion ? "anonymous union" : "anonymous struct"); } override final inout(AnonDeclaration) isAnonDeclaration() inout { return this; } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** */ extern (C++) final class PragmaDeclaration : AttribDeclaration { Expressions* args; // array of Expression's extern (D) this(const ref Loc loc, Identifier ident, Expressions* args, Dsymbols* decl) { super(decl); this.loc = loc; this.ident = ident; this.args = args; } override Dsymbol syntaxCopy(Dsymbol s) { //printf("PragmaDeclaration::syntaxCopy(%s)\n", toChars()); assert(!s); return new PragmaDeclaration(loc, ident, Expression.arraySyntaxCopy(args), Dsymbol.arraySyntaxCopy(decl)); } override Scope* newScope(Scope* sc) { if (ident == Id.Pinline) { PINLINE inlining = PINLINE.default_; if (!args || args.dim == 0) inlining = PINLINE.default_; else if (args.dim != 1) { error("one boolean expression expected for `pragma(inline)`, not %d", args.dim); args.setDim(1); (*args)[0] = new ErrorExp(); } else { Expression e = (*args)[0]; if (e.op != TOK.int64 || !e.type.equals(Type.tbool)) { if (e.op != TOK.error) { error("pragma(`inline`, `true` or `false`) expected, not `%s`", e.toChars()); (*args)[0] = new ErrorExp(); } } else if (e.isBool(true)) inlining = PINLINE.always; else if (e.isBool(false)) inlining = PINLINE.never; } return createNewScope(sc, sc.stc, sc.linkage, sc.cppmangle, sc.protection, sc.explicitProtection, sc.aligndecl, inlining); } return sc; } override const(char)* kind() const { return "pragma"; } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** */ extern (C++) class ConditionalDeclaration : AttribDeclaration { Condition condition; Dsymbols* elsedecl; // array of Dsymbol's for else block extern (D) this(Condition condition, Dsymbols* decl, Dsymbols* elsedecl) { super(decl); //printf("ConditionalDeclaration::ConditionalDeclaration()\n"); this.condition = condition; this.elsedecl = elsedecl; } override Dsymbol syntaxCopy(Dsymbol s) { assert(!s); return new ConditionalDeclaration(condition.syntaxCopy(), Dsymbol.arraySyntaxCopy(decl), Dsymbol.arraySyntaxCopy(elsedecl)); } override final bool oneMember(Dsymbol* ps, Identifier ident) { //printf("ConditionalDeclaration::oneMember(), inc = %d\n", condition.inc); if (condition.inc) { Dsymbols* d = condition.include(null) ? decl : elsedecl; return Dsymbol.oneMembers(d, ps, ident); } else { bool res = (Dsymbol.oneMembers(decl, ps, ident) && *ps is null && Dsymbol.oneMembers(elsedecl, ps, ident) && *ps is null); *ps = null; return res; } } // Decide if 'then' or 'else' code should be included override Dsymbols* include(Scope* sc) { //printf("ConditionalDeclaration::include(sc = %p) scope = %p\n", sc, scope); if (errors) return null; assert(condition); return condition.include(_scope ? _scope : sc) ? decl : elsedecl; } override final void addComment(const(char)* comment) { /* Because addComment is called by the parser, if we called * include() it would define a version before it was used. * But it's no problem to drill down to both decl and elsedecl, * so that's the workaround. */ if (comment) { Dsymbols* d = decl; for (int j = 0; j < 2; j++) { if (d) { for (size_t i = 0; i < d.dim; i++) { Dsymbol s = (*d)[i]; //printf("ConditionalDeclaration::addComment %s\n", s.toChars()); s.addComment(comment); } } d = elsedecl; } } } override void setScope(Scope* sc) { Dsymbols* d = include(sc); //printf("\tConditionalDeclaration::setScope '%s', d = %p\n",toChars(), d); if (d) { for (size_t i = 0; i < d.dim; i++) { Dsymbol s = (*d)[i]; s.setScope(sc); } } } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** */ extern (C++) final class StaticIfDeclaration : ConditionalDeclaration { ScopeDsymbol scopesym; private bool addisdone = false; // true if members have been added to scope private bool onStack = false; // true if a call to `include` is currently active extern (D) this(Condition condition, Dsymbols* decl, Dsymbols* elsedecl) { super(condition, decl, elsedecl); //printf("StaticIfDeclaration::StaticIfDeclaration()\n"); } override Dsymbol syntaxCopy(Dsymbol s) { assert(!s); return new StaticIfDeclaration(condition.syntaxCopy(), Dsymbol.arraySyntaxCopy(decl), Dsymbol.arraySyntaxCopy(elsedecl)); } /**************************************** * Different from other AttribDeclaration subclasses, include() call requires * the completion of addMember and setScope phases. */ override Dsymbols* include(Scope* sc) { //printf("StaticIfDeclaration::include(sc = %p) scope = %p\n", sc, scope); if (errors || onStack) return null; onStack = true; scope(exit) onStack = false; if (condition.inc == 0) { assert(scopesym); // addMember is already done assert(_scope); // setScope is already done Dsymbols* d = ConditionalDeclaration.include(_scope); if (d && !addisdone) { // Add members lazily. for (size_t i = 0; i < d.dim; i++) { Dsymbol s = (*d)[i]; s.addMember(_scope, scopesym); } // Set the member scopes lazily. for (size_t i = 0; i < d.dim; i++) { Dsymbol s = (*d)[i]; s.setScope(_scope); } addisdone = true; } return d; } else { return ConditionalDeclaration.include(sc); } } override void addMember(Scope* sc, ScopeDsymbol sds) { //printf("StaticIfDeclaration::addMember() '%s'\n", toChars()); /* This is deferred until the condition evaluated later (by the include() call), * so that expressions in the condition can refer to declarations * in the same scope, such as: * * template Foo(int i) * { * const int j = i + 1; * static if (j == 3) * const int k; * } */ this.scopesym = sds; } override void setScope(Scope* sc) { // do not evaluate condition before semantic pass // But do set the scope, in case we need it for forward referencing Dsymbol.setScope(sc); } override void importAll(Scope* sc) { // do not evaluate condition before semantic pass } override const(char)* kind() const { return "static if"; } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** * Static foreach at declaration scope, like: * static foreach (i; [0, 1, 2]){ } */ extern (C++) final class StaticForeachDeclaration : AttribDeclaration { StaticForeach sfe; /// contains `static foreach` expansion logic ScopeDsymbol scopesym; /// cached enclosing scope (mimics `static if` declaration) /++ `include` can be called multiple times, but a `static foreach` should be expanded at most once. Achieved by caching the result of the first call. We need both `cached` and `cache`, because `null` is a valid value for `cache`. +/ bool onStack = false; bool cached = false; Dsymbols* cache = null; extern (D) this(StaticForeach sfe, Dsymbols* decl) { super(decl); this.sfe = sfe; } override Dsymbol syntaxCopy(Dsymbol s) { assert(!s); return new StaticForeachDeclaration( sfe.syntaxCopy(), Dsymbol.arraySyntaxCopy(decl)); } override final bool oneMember(Dsymbol* ps, Identifier ident) { // Required to support IFTI on a template that contains a // `static foreach` declaration. `super.oneMember` calls // include with a `null` scope. As `static foreach` requires // the scope for expansion, `oneMember` can only return a // precise result once `static foreach` has been expanded. if (cached) { return super.oneMember(ps, ident); } *ps = null; // a `static foreach` declaration may in general expand to multiple symbols return false; } override Dsymbols* include(Scope* sc) { if (errors || onStack) return null; if (cached) { assert(!onStack); return cache; } onStack = true; scope(exit) onStack = false; if (_scope) { sfe.prepare(_scope); // lower static foreach aggregate } if (!sfe.ready()) { return null; // TODO: ok? } // expand static foreach import dmd.statementsem: makeTupleForeach; Dsymbols* d = makeTupleForeach!(true,true)(_scope, sfe.aggrfe, decl, sfe.needExpansion); if (d) // process generated declarations { // Add members lazily. for (size_t i = 0; i < d.dim; i++) { Dsymbol s = (*d)[i]; s.addMember(_scope, scopesym); } // Set the member scopes lazily. for (size_t i = 0; i < d.dim; i++) { Dsymbol s = (*d)[i]; s.setScope(_scope); } } cached = true; cache = d; return d; } override void addMember(Scope* sc, ScopeDsymbol sds) { // used only for caching the enclosing symbol this.scopesym = sds; } override final void addComment(const(char)* comment) { // do nothing // change this to give semantics to documentation comments on static foreach declarations } override void setScope(Scope* sc) { // do not evaluate condition before semantic pass // But do set the scope, in case we need it for forward referencing Dsymbol.setScope(sc); } override void importAll(Scope* sc) { // do not evaluate aggregate before semantic pass } override const(char)* kind() const { return "static foreach"; } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** * Collection of declarations that stores foreach index variables in a * local symbol table. Other symbols declared within are forwarded to * another scope, like: * * static foreach (i; 0 .. 10) // loop variables for different indices do not conflict. * { // this body is expanded into 10 ForwardingAttribDeclarations, where `i` has storage class STC.local * mixin("enum x" ~ to!string(i) ~ " = i"); // ok, can access current loop variable * } * * static foreach (i; 0.. 10) * { * pragma(msg, mixin("x" ~ to!string(i))); // ok, all 10 symbols are visible as they were forwarded to the global scope * } * * static assert (!is(typeof(i))); // loop index variable is not visible outside of the static foreach loop * * A StaticForeachDeclaration generates one * ForwardingAttribDeclaration for each expansion of its body. The * AST of the ForwardingAttribDeclaration contains both the `static * foreach` variables and the respective copy of the `static foreach` * body. The functionality is achieved by using a * ForwardingScopeDsymbol as the parent symbol for the generated * declarations. */ extern(C++) final class ForwardingAttribDeclaration: AttribDeclaration { ForwardingScopeDsymbol sym = null; this(Dsymbols* decl) { super(decl); sym = new ForwardingScopeDsymbol(null); sym.symtab = new DsymbolTable(); } /************************************** * Use the ForwardingScopeDsymbol as the parent symbol for members. */ override Scope* newScope(Scope* sc) { return sc.push(sym); } /*************************************** * Lazily initializes the scope to forward to. */ override void addMember(Scope* sc, ScopeDsymbol sds) { parent = sym.parent = sym.forward = sds; return super.addMember(sc, sym); } override inout(ForwardingAttribDeclaration) isForwardingAttribDeclaration() inout { return this; } } /*********************************************************** * Mixin declarations, like: * mixin("int x"); */ extern (C++) final class CompileDeclaration : AttribDeclaration { Expression exp; ScopeDsymbol scopesym; bool compiled; extern (D) this(const ref Loc loc, Expression exp) { super(null); //printf("CompileDeclaration(loc = %d)\n", loc.linnum); this.loc = loc; this.exp = exp; } override Dsymbol syntaxCopy(Dsymbol s) { //printf("CompileDeclaration::syntaxCopy('%s')\n", toChars()); return new CompileDeclaration(loc, exp.syntaxCopy()); } override void addMember(Scope* sc, ScopeDsymbol sds) { //printf("CompileDeclaration::addMember(sc = %p, sds = %p, memnum = %d)\n", sc, sds, memnum); this.scopesym = sds; } override void setScope(Scope* sc) { Dsymbol.setScope(sc); } override const(char)* kind() const { return "mixin"; } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** * User defined attributes look like: * @foo(args, ...) * @(args, ...) */ extern (C++) final class UserAttributeDeclaration : AttribDeclaration { Expressions* atts; extern (D) this(Expressions* atts, Dsymbols* decl) { super(decl); //printf("UserAttributeDeclaration()\n"); this.atts = atts; } override Dsymbol syntaxCopy(Dsymbol s) { //printf("UserAttributeDeclaration::syntaxCopy('%s')\n", toChars()); assert(!s); return new UserAttributeDeclaration(Expression.arraySyntaxCopy(this.atts), Dsymbol.arraySyntaxCopy(decl)); } override Scope* newScope(Scope* sc) { Scope* sc2 = sc; if (atts && atts.dim) { // create new one for changes sc2 = sc.copy(); sc2.userAttribDecl = this; } return sc2; } override void setScope(Scope* sc) { //printf("UserAttributeDeclaration::setScope() %p\n", this); if (decl) Dsymbol.setScope(sc); // for forward reference of UDAs return AttribDeclaration.setScope(sc); } static Expressions* concat(Expressions* udas1, Expressions* udas2) { Expressions* udas; if (!udas1 || udas1.dim == 0) udas = udas2; else if (!udas2 || udas2.dim == 0) udas = udas1; else { /* Create a new tuple that combines them * (do not append to left operand, as this is a copy-on-write operation) */ udas = new Expressions(); udas.push(new TupleExp(Loc.initial, udas1)); udas.push(new TupleExp(Loc.initial, udas2)); } return udas; } Expressions* getAttributes() { if (auto sc = _scope) { _scope = null; arrayExpressionSemantic(atts, sc); } auto exps = new Expressions(); if (userAttribDecl) exps.push(new TupleExp(Loc.initial, userAttribDecl.getAttributes())); if (atts && atts.dim) exps.push(new TupleExp(Loc.initial, atts)); return exps; } override const(char)* kind() const { return "UserAttribute"; } override void accept(Visitor v) { v.visit(this); } }
D
module gtkD.gio.Volume; public import gtkD.gtkc.giotypes; private import gtkD.gtkc.gio; private import gtkD.glib.ConstructionException; private import gtkD.gobject.ObjectG; private import gtkD.gio.VolumeT; private import gtkD.gio.VolumeIF; /** */ public class Volume : ObjectG, VolumeIF { // Minimal implementation. mixin VolumeT!(GVolume); /** the main Gtk struct as a void* */ protected override void* getStruct(); /** * Sets our main struct and passes it to the parent class */ public this (GVolume* gVolume); /** */ }
D
/** * The threadbase module provides OS-independent code * for thread storage and management. * * Copyright: Copyright Sean Kelly 2005 - 2012. * License: Distributed under the * $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0). * (See accompanying file LICENSE) * Authors: Sean Kelly, Walter Bright, Alex Rønne Petersen, Martin Nowak * Source: $(DRUNTIMESRC core/thread/osthread.d) */ module core.thread.threadbase; import core.thread.context; import core.thread.types; import core.time; import core.sync.mutex; import core.stdc.stdlib : free, realloc; private { import core.internal.traits : externDFunc; // interface to rt.tlsgc alias rt_tlsgc_init = externDFunc!("rt.tlsgc.init", void* function() nothrow @nogc); alias rt_tlsgc_destroy = externDFunc!("rt.tlsgc.destroy", void function(void*) nothrow @nogc); alias ScanDg = void delegate(void* pstart, void* pend) nothrow; alias rt_tlsgc_scan = externDFunc!("rt.tlsgc.scan", void function(void*, scope ScanDg) nothrow); alias rt_tlsgc_processGCMarks = externDFunc!("rt.tlsgc.processGCMarks", void function(void*, scope IsMarkedDg) nothrow); } /////////////////////////////////////////////////////////////////////////////// // Thread and Fiber Exceptions /////////////////////////////////////////////////////////////////////////////// /** * Base class for thread exceptions. */ class ThreadException : Exception { @nogc @safe pure nothrow this(string msg, string file = __FILE__, size_t line = __LINE__, Throwable next = null) { super(msg, file, line, next); } @nogc @safe pure nothrow this(string msg, Throwable next, string file = __FILE__, size_t line = __LINE__) { super(msg, file, line, next); } } /** * Base class for thread errors to be used for function inside GC when allocations are unavailable. */ class ThreadError : Error { @nogc @safe pure nothrow this(string msg, string file = __FILE__, size_t line = __LINE__, Throwable next = null) { super(msg, file, line, next); } @nogc @safe pure nothrow this(string msg, Throwable next, string file = __FILE__, size_t line = __LINE__) { super(msg, file, line, next); } } private { // Handling unaligned mutexes are not supported on all platforms, so we must // ensure that the address of all shared data are appropriately aligned. import core.internal.traits : classInstanceAlignment; enum mutexAlign = classInstanceAlignment!Mutex; enum mutexClassInstanceSize = __traits(classInstanceSize, Mutex); alias swapContext = externDFunc!("core.thread.osthread.swapContext", void* function(void*) nothrow @nogc); alias getStackBottom = externDFunc!("core.thread.osthread.getStackBottom", void* function() nothrow @nogc); alias getStackTop = externDFunc!("core.thread.osthread.getStackTop", void* function() nothrow @nogc); } /////////////////////////////////////////////////////////////////////////////// // Thread /////////////////////////////////////////////////////////////////////////////// class ThreadBase { /////////////////////////////////////////////////////////////////////////// // Initialization /////////////////////////////////////////////////////////////////////////// this(void function() fn, size_t sz = 0) @safe pure nothrow @nogc in(fn) { this(sz); m_call = fn; } this(void delegate() dg, size_t sz = 0) @safe pure nothrow @nogc in(dg) { this(sz); m_call = dg; } /** * Cleans up any remaining resources used by this object. */ package bool destructBeforeDtor() nothrow @nogc { destroyDataStorageIfAvail(); bool no_context = m_addr == m_addr.init; bool not_registered = !next && !prev && (sm_tbeg !is this); return (no_context || not_registered); } package void tlsGCdataInit() nothrow @nogc { m_tlsgcdata = rt_tlsgc_init(); } package void initDataStorage() nothrow { assert(m_curr is &m_main); m_main.bstack = getStackBottom(); m_main.tstack = m_main.bstack; tlsGCdataInit(); } package void destroyDataStorage() nothrow @nogc { rt_tlsgc_destroy(m_tlsgcdata); m_tlsgcdata = null; } package void destroyDataStorageIfAvail() nothrow @nogc { if (m_tlsgcdata) destroyDataStorage(); } /////////////////////////////////////////////////////////////////////////// // General Actions /////////////////////////////////////////////////////////////////////////// /** * Waits for this thread to complete. If the thread terminated as the * result of an unhandled exception, this exception will be rethrown. * * Params: * rethrow = Rethrow any unhandled exception which may have caused this * thread to terminate. * * Throws: * ThreadException if the operation fails. * Any exception not handled by the joined thread. * * Returns: * Any exception not handled by this thread if rethrow = false, null * otherwise. */ abstract Throwable join(bool rethrow = true); /////////////////////////////////////////////////////////////////////////// // General Properties /////////////////////////////////////////////////////////////////////////// /** * Gets the OS identifier for this thread. * * Returns: * If the thread hasn't been started yet, returns $(LREF ThreadID)$(D.init). * Otherwise, returns the result of $(D GetCurrentThreadId) on Windows, * and $(D pthread_self) on POSIX. * * The value is unique for the current process. */ final @property ThreadID id() @safe @nogc { synchronized(this) { return m_addr; } } /** * Gets the user-readable label for this thread. * * Returns: * The name of this thread. */ final @property string name() @safe @nogc { synchronized(this) { return m_name; } } /** * Sets the user-readable label for this thread. * * Params: * val = The new name of this thread. */ final @property void name(string val) @safe @nogc { synchronized(this) { m_name = val; } } /** * Gets the daemon status for this thread. While the runtime will wait for * all normal threads to complete before tearing down the process, daemon * threads are effectively ignored and thus will not prevent the process * from terminating. In effect, daemon threads will be terminated * automatically by the OS when the process exits. * * Returns: * true if this is a daemon thread. */ final @property bool isDaemon() @safe @nogc { synchronized(this) { return m_isDaemon; } } /** * Sets the daemon status for this thread. While the runtime will wait for * all normal threads to complete before tearing down the process, daemon * threads are effectively ignored and thus will not prevent the process * from terminating. In effect, daemon threads will be terminated * automatically by the OS when the process exits. * * Params: * val = The new daemon status for this thread. */ final @property void isDaemon(bool val) @safe @nogc { synchronized(this) { m_isDaemon = val; } } /** * Tests whether this thread is the main thread, i.e. the thread * that initialized the runtime * * Returns: * true if the thread is the main thread */ final @property bool isMainThread() nothrow @nogc { return this is sm_main; } /** * Tests whether this thread is running. * * Returns: * true if the thread is running, false if not. */ @property bool isRunning() nothrow @nogc { if (m_addr == m_addr.init) return false; return true; } /////////////////////////////////////////////////////////////////////////// // Thread Accessors /////////////////////////////////////////////////////////////////////////// /** * Provides a reference to the calling thread. * * Returns: * The thread object representing the calling thread. The result of * deleting this object is undefined. If the current thread is not * attached to the runtime, a null reference is returned. */ static ThreadBase getThis() @safe nothrow @nogc { // NOTE: This function may not be called until thread_init has // completed. See thread_suspendAll for more information // on why this might occur. return sm_this; } /** * Provides a list of all threads currently being tracked by the system. * Note that threads in the returned array might no longer run (see * $(D ThreadBase.)$(LREF isRunning)). * * Returns: * An array containing references to all threads currently being * tracked by the system. The result of deleting any contained * objects is undefined. */ static ThreadBase[] getAll() { static void resize(ref ThreadBase[] buf, size_t nlen) { buf.length = nlen; } return getAllImpl!resize(); } /** * Operates on all threads currently being tracked by the system. The * result of deleting any Thread object is undefined. * Note that threads passed to the callback might no longer run (see * $(D ThreadBase.)$(LREF isRunning)). * * Params: * dg = The supplied code as a delegate. * * Returns: * Zero if all elemented are visited, nonzero if not. */ static int opApply(scope int delegate(ref ThreadBase) dg) { static void resize(ref ThreadBase[] buf, size_t nlen) { import core.exception: onOutOfMemoryError; auto newBuf = cast(ThreadBase*)realloc(buf.ptr, nlen * size_t.sizeof); if (newBuf is null) onOutOfMemoryError(); buf = newBuf[0 .. nlen]; } auto buf = getAllImpl!resize; scope(exit) if (buf.ptr) free(buf.ptr); foreach (t; buf) { if (auto res = dg(t)) return res; } return 0; } private static ThreadBase[] getAllImpl(alias resize)() { import core.atomic; ThreadBase[] buf; while (true) { immutable len = atomicLoad!(MemoryOrder.raw)(*cast(shared)&sm_tlen); resize(buf, len); assert(buf.length == len); synchronized (slock) { if (len == sm_tlen) { size_t pos; for (ThreadBase t = sm_tbeg; t; t = t.next) buf[pos++] = t; return buf; } } } } /////////////////////////////////////////////////////////////////////////// // Actions on Calling Thread /////////////////////////////////////////////////////////////////////////// /** * Forces a context switch to occur away from the calling thread. */ private static void yield() @nogc nothrow { thread_yield(); } /////////////////////////////////////////////////////////////////////////// // Stuff That Should Go Away /////////////////////////////////////////////////////////////////////////// // // Initializes a thread object which has no associated executable function. // This is used for the main thread initialized in thread_init(). // package this(size_t sz = 0) @safe pure nothrow @nogc { m_sz = sz; m_curr = &m_main; } // // Thread entry point. Invokes the function or delegate passed on // construction (if any). // package final void run() { m_call(); } package: // // Local storage // static ThreadBase sm_this; // // Main process thread // __gshared ThreadBase sm_main; // // Standard thread data // ThreadID m_addr; Callable m_call; string m_name; size_t m_sz; bool m_isDaemon; bool m_isInCriticalRegion; Throwable m_unhandled; /////////////////////////////////////////////////////////////////////////// // Storage of Active Thread /////////////////////////////////////////////////////////////////////////// // // Sets a thread-local reference to the current thread object. // package static void setThis(ThreadBase t) nothrow @nogc { sm_this = t; } package(core.thread): StackContext m_main; StackContext* m_curr; bool m_lock; private void* m_tlsgcdata; /////////////////////////////////////////////////////////////////////////// // Thread Context and GC Scanning Support /////////////////////////////////////////////////////////////////////////// final void pushContext(StackContext* c) nothrow @nogc in { assert(!c.within); } do { m_curr.ehContext = swapContext(c.ehContext); c.within = m_curr; m_curr = c; } final void popContext() nothrow @nogc in { assert(m_curr && m_curr.within); } do { StackContext* c = m_curr; m_curr = c.within; c.ehContext = swapContext(m_curr.ehContext); c.within = null; } private final StackContext* topContext() nothrow @nogc in(m_curr) { return m_curr; } package(core.thread): /////////////////////////////////////////////////////////////////////////// // GC Scanning Support /////////////////////////////////////////////////////////////////////////// // NOTE: The GC scanning process works like so: // // 1. Suspend all threads. // 2. Scan the stacks of all suspended threads for roots. // 3. Resume all threads. // // Step 1 and 3 require a list of all threads in the system, while // step 2 requires a list of all thread stacks (each represented by // a Context struct). Traditionally, there was one stack per thread // and the Context structs were not necessary. However, Fibers have // changed things so that each thread has its own 'main' stack plus // an arbitrary number of nested stacks (normally referenced via // m_curr). Also, there may be 'free-floating' stacks in the system, // which are Fibers that are not currently executing on any specific // thread but are still being processed and still contain valid // roots. // // To support all of this, the Context struct has been created to // represent a stack range, and a global list of Context structs has // been added to enable scanning of these stack ranges. The lifetime // (and presence in the Context list) of a thread's 'main' stack will // be equivalent to the thread's lifetime. So the Ccontext will be // added to the list on thread entry, and removed from the list on // thread exit (which is essentially the same as the presence of a // Thread object in its own global list). The lifetime of a Fiber's // context, however, will be tied to the lifetime of the Fiber object // itself, and Fibers are expected to add/remove their Context struct // on construction/deletion. // // All use of the global thread lists/array should synchronize on this lock. // // Careful as the GC acquires this lock after the GC lock to suspend all // threads any GC usage with slock held can result in a deadlock through // lock order inversion. @property static Mutex slock() nothrow @nogc { return cast(Mutex)_slock.ptr; } @property static Mutex criticalRegionLock() nothrow @nogc { return cast(Mutex)_criticalRegionLock.ptr; } __gshared align(mutexAlign) void[mutexClassInstanceSize] _slock; __gshared align(mutexAlign) void[mutexClassInstanceSize] _criticalRegionLock; static void initLocks() @nogc { _slock[] = typeid(Mutex).initializer[]; (cast(Mutex)_slock.ptr).__ctor(); _criticalRegionLock[] = typeid(Mutex).initializer[]; (cast(Mutex)_criticalRegionLock.ptr).__ctor(); } static void termLocks() @nogc { (cast(Mutex)_slock.ptr).__dtor(); (cast(Mutex)_criticalRegionLock.ptr).__dtor(); } __gshared StackContext* sm_cbeg; __gshared ThreadBase sm_tbeg; __gshared size_t sm_tlen; // can't use core.internal.util.array in public code __gshared ThreadBase* pAboutToStart; __gshared size_t nAboutToStart; // // Used for ordering threads in the global thread list. // ThreadBase prev; ThreadBase next; /////////////////////////////////////////////////////////////////////////// // Global Context List Operations /////////////////////////////////////////////////////////////////////////// // // Add a context to the global context list. // static void add(StackContext* c) nothrow @nogc in { assert(c); assert(!c.next && !c.prev); } do { slock.lock_nothrow(); scope(exit) slock.unlock_nothrow(); assert(!suspendDepth); // must be 0 b/c it's only set with slock held if (sm_cbeg) { c.next = sm_cbeg; sm_cbeg.prev = c; } sm_cbeg = c; } // // Remove a context from the global context list. // // This assumes slock being acquired. This isn't done here to // avoid double locking when called from remove(Thread) static void remove(StackContext* c) nothrow @nogc in { assert(c); assert(c.next || c.prev); } do { if (c.prev) c.prev.next = c.next; if (c.next) c.next.prev = c.prev; if (sm_cbeg == c) sm_cbeg = c.next; // NOTE: Don't null out c.next or c.prev because opApply currently // follows c.next after removing a node. This could be easily // addressed by simply returning the next node from this // function, however, a context should never be re-added to the // list anyway and having next and prev be non-null is a good way // to ensure that. } /////////////////////////////////////////////////////////////////////////// // Global Thread List Operations /////////////////////////////////////////////////////////////////////////// // // Add a thread to the global thread list. // static void add(ThreadBase t, bool rmAboutToStart = true) nothrow @nogc in { assert(t); assert(!t.next && !t.prev); } do { slock.lock_nothrow(); scope(exit) slock.unlock_nothrow(); assert(t.isRunning); // check this with slock to ensure pthread_create already returned assert(!suspendDepth); // must be 0 b/c it's only set with slock held if (rmAboutToStart) { size_t idx = -1; foreach (i, thr; pAboutToStart[0 .. nAboutToStart]) { if (thr is t) { idx = i; break; } } assert(idx != -1); import core.stdc.string : memmove; memmove(pAboutToStart + idx, pAboutToStart + idx + 1, size_t.sizeof * (nAboutToStart - idx - 1)); pAboutToStart = cast(ThreadBase*)realloc(pAboutToStart, size_t.sizeof * --nAboutToStart); } if (sm_tbeg) { t.next = sm_tbeg; sm_tbeg.prev = t; } sm_tbeg = t; ++sm_tlen; } // // Remove a thread from the global thread list. // static void remove(ThreadBase t) nothrow @nogc in { assert(t); } do { // Thread was already removed earlier, might happen b/c of thread_detachInstance if (!t.next && !t.prev && (sm_tbeg !is t)) return; slock.lock_nothrow(); { // NOTE: When a thread is removed from the global thread list its // main context is invalid and should be removed as well. // It is possible that t.m_curr could reference more // than just the main context if the thread exited abnormally // (if it was terminated), but we must assume that the user // retains a reference to them and that they may be re-used // elsewhere. Therefore, it is the responsibility of any // object that creates contexts to clean them up properly // when it is done with them. remove(&t.m_main); if (t.prev) t.prev.next = t.next; if (t.next) t.next.prev = t.prev; if (sm_tbeg is t) sm_tbeg = t.next; t.prev = t.next = null; --sm_tlen; } // NOTE: Don't null out t.next or t.prev because opApply currently // follows t.next after removing a node. This could be easily // addressed by simply returning the next node from this // function, however, a thread should never be re-added to the // list anyway and having next and prev be non-null is a good way // to ensure that. slock.unlock_nothrow(); } } /////////////////////////////////////////////////////////////////////////////// // GC Support Routines /////////////////////////////////////////////////////////////////////////////// private alias attachThread = externDFunc!("core.thread.osthread.attachThread", ThreadBase function(ThreadBase) @nogc nothrow); extern (C) void _d_monitordelete_nogc(Object h) @nogc; /** * Terminates the thread module. No other thread routine may be called * afterwards. */ package void thread_term_tpl(ThreadT, MainThreadStore)(ref MainThreadStore _mainThreadStore) @nogc { assert(_mainThreadStore.ptr is cast(void*) ThreadBase.sm_main); // destruct manually as object.destroy is not @nogc (cast(ThreadT) cast(void*) ThreadBase.sm_main).__dtor(); _d_monitordelete_nogc(ThreadBase.sm_main); if (typeid(ThreadT).initializer.ptr) _mainThreadStore[] = typeid(ThreadT).initializer[]; else (cast(ubyte[])_mainThreadStore)[] = 0; ThreadBase.sm_main = null; assert(ThreadBase.sm_tbeg && ThreadBase.sm_tlen == 1); assert(!ThreadBase.nAboutToStart); if (ThreadBase.pAboutToStart) // in case realloc(p, 0) doesn't return null { free(ThreadBase.pAboutToStart); ThreadBase.pAboutToStart = null; } ThreadBase.termLocks(); termLowlevelThreads(); } /** * */ extern (C) bool thread_isMainThread() nothrow @nogc { return ThreadBase.getThis() is ThreadBase.sm_main; } /** * Registers the calling thread for use with the D Runtime. If this routine * is called for a thread which is already registered, no action is performed. * * NOTE: This routine does not run thread-local static constructors when called. * If full functionality as a D thread is desired, the following function * must be called after thread_attachThis: * * extern (C) void rt_moduleTlsCtor(); */ package ThreadT thread_attachThis_tpl(ThreadT)() { if (auto t = ThreadT.getThis()) return t; return cast(ThreadT) attachThread(new ThreadT()); } /** * Deregisters the calling thread from use with the runtime. If this routine * is called for a thread which is not registered, the result is undefined. * * NOTE: This routine does not run thread-local static destructors when called. * If full functionality as a D thread is desired, the following function * must be called after thread_detachThis, particularly if the thread is * being detached at some indeterminate time before program termination: * * $(D extern(C) void rt_moduleTlsDtor();) */ extern (C) void thread_detachThis() nothrow @nogc { if (auto t = ThreadBase.getThis()) ThreadBase.remove(t); } /** * Deregisters the given thread from use with the runtime. If this routine * is called for a thread which is not registered, the result is undefined. * * NOTE: This routine does not run thread-local static destructors when called. * If full functionality as a D thread is desired, the following function * must be called by the detached thread, particularly if the thread is * being detached at some indeterminate time before program termination: * * $(D extern(C) void rt_moduleTlsDtor();) */ extern (C) void thread_detachByAddr(ThreadID addr) { if (auto t = thread_findByAddr(addr)) ThreadBase.remove(t); } /// ditto extern (C) void thread_detachInstance(ThreadBase t) nothrow @nogc { ThreadBase.remove(t); } /** * Search the list of all threads for a thread with the given thread identifier. * * Params: * addr = The thread identifier to search for. * Returns: * The thread object associated with the thread identifier, null if not found. */ static ThreadBase thread_findByAddr(ThreadID addr) { ThreadBase.slock.lock_nothrow(); scope(exit) ThreadBase.slock.unlock_nothrow(); // also return just spawned thread so that // DLL_THREAD_ATTACH knows it's a D thread foreach (t; ThreadBase.pAboutToStart[0 .. ThreadBase.nAboutToStart]) if (t.m_addr == addr) return t; foreach (t; ThreadBase) if (t.m_addr == addr) return t; return null; } /** * Sets the current thread to a specific reference. Only to be used * when dealing with externally-created threads (in e.g. C code). * The primary use of this function is when ThreadBase.getThis() must * return a sensible value in, for example, TLS destructors. In * other words, don't touch this unless you know what you're doing. * * Params: * t = A reference to the current thread. May be null. */ extern (C) void thread_setThis(ThreadBase t) nothrow @nogc { ThreadBase.setThis(t); } /** * Joins all non-daemon threads that are currently running. This is done by * performing successive scans through the thread list until a scan consists * of only daemon threads. */ extern (C) void thread_joinAll() { Lagain: ThreadBase.slock.lock_nothrow(); // wait for just spawned threads if (ThreadBase.nAboutToStart) { ThreadBase.slock.unlock_nothrow(); ThreadBase.yield(); goto Lagain; } // join all non-daemon threads, the main thread is also a daemon auto t = ThreadBase.sm_tbeg; while (t) { if (!t.isRunning) { auto tn = t.next; ThreadBase.remove(t); t = tn; } else if (t.isDaemon) { t = t.next; } else { ThreadBase.slock.unlock_nothrow(); t.join(); // might rethrow goto Lagain; // must restart iteration b/c of unlock } } ThreadBase.slock.unlock_nothrow(); } /** * Performs intermediate shutdown of the thread module. */ shared static ~this() { // NOTE: The functionality related to garbage collection must be minimally // operable after this dtor completes. Therefore, only minimal // cleanup may occur. auto t = ThreadBase.sm_tbeg; while (t) { auto tn = t.next; if (!t.isRunning) ThreadBase.remove(t); t = tn; } } // Used for needLock below. package __gshared bool multiThreadedFlag = false; // Used for suspendAll/resumeAll below. package __gshared uint suspendDepth = 0; private alias resume = externDFunc!("core.thread.osthread.resume", void function(ThreadBase) nothrow @nogc); /** * Resume all threads but the calling thread for "stop the world" garbage * collection runs. This function must be called once for each preceding * call to thread_suspendAll before the threads are actually resumed. * * In: * This routine must be preceded by a call to thread_suspendAll. * * Throws: * ThreadError if the resume operation fails for a running thread. */ extern (C) void thread_resumeAll() nothrow in { assert(suspendDepth > 0); } do { // NOTE: See thread_suspendAll for the logic behind this. if (!multiThreadedFlag && ThreadBase.sm_tbeg) { if (--suspendDepth == 0) resume(ThreadBase.getThis()); return; } scope(exit) ThreadBase.slock.unlock_nothrow(); { if (--suspendDepth > 0) return; for (ThreadBase t = ThreadBase.sm_tbeg; t; t = t.next) { // NOTE: We do not need to care about critical regions at all // here. thread_suspendAll takes care of everything. resume(t); } } } /** * Indicates the kind of scan being performed by $(D thread_scanAllType). */ enum ScanType { stack, /// The stack and/or registers are being scanned. tls, /// TLS data is being scanned. } alias ScanAllThreadsFn = void delegate(void*, void*) nothrow; /// The scanning function. alias ScanAllThreadsTypeFn = void delegate(ScanType, void*, void*) nothrow; /// ditto /** * The main entry point for garbage collection. The supplied delegate * will be passed ranges representing both stack and register values. * * Params: * scan = The scanner function. It should scan from p1 through p2 - 1. * * In: * This routine must be preceded by a call to thread_suspendAll. */ extern (C) void thread_scanAllType(scope ScanAllThreadsTypeFn scan) nothrow in { assert(suspendDepth > 0); } do { callWithStackShell(sp => scanAllTypeImpl(scan, sp)); } package alias callWithStackShellDg = void delegate(void* sp) nothrow; private alias callWithStackShell = externDFunc!("core.thread.osthread.callWithStackShell", void function(scope callWithStackShellDg) nothrow); private void scanAllTypeImpl(scope ScanAllThreadsTypeFn scan, void* curStackTop) nothrow { ThreadBase thisThread = null; void* oldStackTop = null; if (ThreadBase.sm_tbeg) { thisThread = ThreadBase.getThis(); if (!thisThread.m_lock) { oldStackTop = thisThread.m_curr.tstack; thisThread.m_curr.tstack = curStackTop; } } scope(exit) { if (ThreadBase.sm_tbeg) { if (!thisThread.m_lock) { thisThread.m_curr.tstack = oldStackTop; } } } // NOTE: Synchronizing on ThreadBase.slock is not needed because this // function may only be called after all other threads have // been suspended from within the same lock. if (ThreadBase.nAboutToStart) scan(ScanType.stack, ThreadBase.pAboutToStart, ThreadBase.pAboutToStart + ThreadBase.nAboutToStart); for (StackContext* c = ThreadBase.sm_cbeg; c; c = c.next) { static if (isStackGrowingDown) { assert(c.tstack <= c.bstack, "stack bottom can't be less than top"); // NOTE: We can't index past the bottom of the stack // so don't do the "+1" if isStackGrowingDown. if (c.tstack && c.tstack < c.bstack) scan(ScanType.stack, c.tstack, c.bstack); } else { assert(c.bstack <= c.tstack, "stack top can't be less than bottom"); if (c.bstack && c.bstack < c.tstack) scan(ScanType.stack, c.bstack, c.tstack + 1); } } for (ThreadBase t = ThreadBase.sm_tbeg; t; t = t.next) { version (Windows) { // Ideally, we'd pass ScanType.regs or something like that, but this // would make portability annoying because it only makes sense on Windows. scanWindowsOnly(scan, t); } if (t.m_tlsgcdata !is null) rt_tlsgc_scan(t.m_tlsgcdata, (p1, p2) => scan(ScanType.tls, p1, p2)); } } version (Windows) { // Currently scanWindowsOnly can't be handled properly by externDFunc // https://github.com/dlang/druntime/pull/3135#issuecomment-643673218 pragma(mangle, "_D4core6thread8osthread15scanWindowsOnlyFNbMDFNbEQBvQBt10threadbase8ScanTypePvQcZvCQDdQDbQBi10ThreadBaseZv") private extern (D) void scanWindowsOnly(scope ScanAllThreadsTypeFn scan, ThreadBase) nothrow; } /** * The main entry point for garbage collection. The supplied delegate * will be passed ranges representing both stack and register values. * * Params: * scan = The scanner function. It should scan from p1 through p2 - 1. * * In: * This routine must be preceded by a call to thread_suspendAll. */ extern (C) void thread_scanAll(scope ScanAllThreadsFn scan) nothrow { thread_scanAllType((type, p1, p2) => scan(p1, p2)); } private alias thread_yield = externDFunc!("core.thread.osthread.thread_yield", void function() @nogc nothrow); /** * Signals that the code following this call is a critical region. Any code in * this region must finish running before the calling thread can be suspended * by a call to thread_suspendAll. * * This function is, in particular, meant to help maintain garbage collector * invariants when a lock is not used. * * A critical region is exited with thread_exitCriticalRegion. * * $(RED Warning): * Using critical regions is extremely error-prone. For instance, using locks * inside a critical region can easily result in a deadlock when another thread * holding the lock already got suspended. * * The term and concept of a 'critical region' comes from * $(LINK2 https://github.com/mono/mono/blob/521f4a198e442573c400835ef19bbb36b60b0ebb/mono/metadata/sgen-gc.h#L925, Mono's SGen garbage collector). * * In: * The calling thread must be attached to the runtime. */ extern (C) void thread_enterCriticalRegion() @nogc in { assert(ThreadBase.getThis()); } do { synchronized (ThreadBase.criticalRegionLock) ThreadBase.getThis().m_isInCriticalRegion = true; } /** * Signals that the calling thread is no longer in a critical region. Following * a call to this function, the thread can once again be suspended. * * In: * The calling thread must be attached to the runtime. */ extern (C) void thread_exitCriticalRegion() @nogc in { assert(ThreadBase.getThis()); } do { synchronized (ThreadBase.criticalRegionLock) ThreadBase.getThis().m_isInCriticalRegion = false; } /** * Returns true if the current thread is in a critical region; otherwise, false. * * In: * The calling thread must be attached to the runtime. */ extern (C) bool thread_inCriticalRegion() @nogc in { assert(ThreadBase.getThis()); } do { synchronized (ThreadBase.criticalRegionLock) return ThreadBase.getThis().m_isInCriticalRegion; } /** * A callback for thread errors in D during collections. Since an allocation is not possible * a preallocated ThreadError will be used as the Error instance * * Returns: * never returns * Throws: * ThreadError. */ package void onThreadError(string msg) nothrow @nogc { __gshared ThreadError error = new ThreadError(null); error.msg = msg; error.next = null; import core.exception : SuppressTraceInfo; error.info = SuppressTraceInfo.instance; throw error; } unittest { assert(!thread_inCriticalRegion()); { thread_enterCriticalRegion(); scope (exit) thread_exitCriticalRegion(); assert(thread_inCriticalRegion()); } assert(!thread_inCriticalRegion()); } /** * Indicates whether an address has been marked by the GC. */ enum IsMarked : int { no, /// Address is not marked. yes, /// Address is marked. unknown, /// Address is not managed by the GC. } alias IsMarkedDg = int delegate(void* addr) nothrow; /// The isMarked callback function. /** * This routine allows the runtime to process any special per-thread handling * for the GC. This is needed for taking into account any memory that is * referenced by non-scanned pointers but is about to be freed. That currently * means the array append cache. * * Params: * isMarked = The function used to check if $(D addr) is marked. * * In: * This routine must be called just prior to resuming all threads. */ extern(C) void thread_processGCMarks(scope IsMarkedDg isMarked) nothrow { for (ThreadBase t = ThreadBase.sm_tbeg; t; t = t.next) { /* Can be null if collection was triggered between adding a * thread and calling rt_tlsgc_init. */ if (t.m_tlsgcdata !is null) rt_tlsgc_processGCMarks(t.m_tlsgcdata, isMarked); } } /** * Returns the stack top of the currently active stack within the calling * thread. * * In: * The calling thread must be attached to the runtime. * * Returns: * The address of the stack top. */ extern (C) void* thread_stackTop() nothrow @nogc in { // Not strictly required, but it gives us more flexibility. assert(ThreadBase.getThis()); } do { return getStackTop(); } /** * Returns the stack bottom of the currently active stack within the calling * thread. * * In: * The calling thread must be attached to the runtime. * * Returns: * The address of the stack bottom. */ extern (C) void* thread_stackBottom() nothrow @nogc in (ThreadBase.getThis()) { return ThreadBase.getThis().topContext().bstack; } /////////////////////////////////////////////////////////////////////////////// // lowlovel threading support /////////////////////////////////////////////////////////////////////////////// package { __gshared size_t ll_nThreads; __gshared ll_ThreadData* ll_pThreads; __gshared align(mutexAlign) void[mutexClassInstanceSize] ll_lock; @property Mutex lowlevelLock() nothrow @nogc { return cast(Mutex)ll_lock.ptr; } void initLowlevelThreads() @nogc { ll_lock[] = typeid(Mutex).initializer[]; lowlevelLock.__ctor(); } void termLowlevelThreads() @nogc { lowlevelLock.__dtor(); } void ll_removeThread(ThreadID tid) nothrow @nogc { lowlevelLock.lock_nothrow(); scope(exit) lowlevelLock.unlock_nothrow(); foreach (i; 0 .. ll_nThreads) { if (tid is ll_pThreads[i].tid) { import core.stdc.string : memmove; memmove(ll_pThreads + i, ll_pThreads + i + 1, ll_ThreadData.sizeof * (ll_nThreads - i - 1)); --ll_nThreads; // no need to minimize, next add will do break; } } } } /** * Check whether a thread was created by `createLowLevelThread`. * * Params: * tid = the platform specific thread ID. * * Returns: `true` if the thread was created by `createLowLevelThread` and is still running. */ bool findLowLevelThread(ThreadID tid) nothrow @nogc { lowlevelLock.lock_nothrow(); scope(exit) lowlevelLock.unlock_nothrow(); foreach (i; 0 .. ll_nThreads) if (tid is ll_pThreads[i].tid) return true; return false; }
D
/******************************************************************************* Client DMQ Consume v4 request handler. Copyright: Copyright (c) 2017 dunnhumby Germany GmbH. All rights reserved. License: Boost Software License Version 1.0. See LICENSE.txt for details. *******************************************************************************/ module dmqproto.client.request.internal.Consume; import ocean.meta.types.Qualifiers; import ocean.core.Verify; import swarm.neo.client.RequestOnConn; /******************************************************************************* Consume v4 request implementation. Note that request structs act simply as namespaces for the collection of symbols required to implement a request. They are never instantiated and have no fields or non-static functions. The client expects several things to be present in a request struct: 1. The static constants request_type and request_code 2. The UserSpecifiedParams struct, containing all user-specified request setup (including a notifier) 3. The Notifier delegate type 4. Optionally, the Controller type (if the request can be controlled, after it has begun) 5. The handler() function 6. The all_finished_notifier() function The RequestCore mixin provides items 1 and 2. *******************************************************************************/ public struct Consume { import dmqproto.common.Consume; import dmqproto.client.request.Consume; import dmqproto.common.RequestCodes; import swarm.neo.client.mixins.RequestCore; import swarm.neo.client.mixins.AllNodesRequestCore; import swarm.neo.client.mixins.BatchRequestCore; import swarm.neo.client.RequestHandlers; import dmqproto.client.internal.SharedResources; import ocean.io.select.protocol.generic.ErrnoIOException: IOError; alias typeof(this) This; /*************************************************************************** Request controller, accessible to the user via the client's `control()` method. ***************************************************************************/ mixin BatchController!(typeof(this), IController); /*************************************************************************** Data which the request needs while it is in progress. An instance of this struct is stored per connection on which the request runs and is passed to the request handler. ***************************************************************************/ private struct SharedWorking { /// Shared working data required for core all-nodes request behaviour. AllNodesRequestSharedWorkingData all_nodes; /// Data required by the BatchController BatchRequestSharedWorkingData suspendable_control; } /*************************************************************************** Data which each request-on-conn needs while it is progress. An instance of this struct is stored per connection on which the request runs and is passed to the request handler. ***************************************************************************/ private struct Working { } // Dummy struct. /*************************************************************************** Request core. Mixes in the types `NotificationInfo`, `Notifier`, `Params`, `Context` plus the static constants `request_type` and `request_code`. ***************************************************************************/ mixin RequestCore!(RequestType.AllNodes, RequestCode.Consume, 4, Args, SharedWorking, Notification); /*************************************************************************** Request handler. Called from RequestOnConn.runHandler(). Params: conn = request-on-conn event dispatcher context_blob = untyped chunk of data containing the serialized context of the request which is to be handled ***************************************************************************/ public static void handler ( RequestOnConn.EventDispatcherAllNodes conn, void[] context_blob ) { auto context = This.getContext(context_blob); auto shared_resources = SharedResources.fromObject( context.shared_resources); scope acquired_resources = shared_resources.new RequestResources; scope handler = new ConsumeHandler(conn, context, acquired_resources); handler.run(); } /*************************************************************************** Request finished notifier. Called from Request.handlerFinished(). Params: context_blob = untyped chunk of data containing the serialized context of the request which is finishing ***************************************************************************/ public static void all_finished_notifier ( void[] context_blob ) { auto context = This.getContext(context_blob); // Final notification, after the request has been stopped Notification notification; notification.stopped = RequestInfo(context.request_id); Consume.notify(context.user_params, notification); } } /******************************************************************************* Client Consume v3 request handler. *******************************************************************************/ private class ConsumeHandler { import swarm.neo.connection.RequestOnConnBase; import swarm.neo.client.mixins.AllNodesRequestCore; import swarm.neo.client.mixins.BatchRequestCore; import swarm.neo.request.RequestEventDispatcher; import swarm.neo.request.Command; import swarm.neo.util.MessageFiber; import dmqproto.common.Consume; import dmqproto.client.request.Consume; import dmqproto.client.internal.SharedResources; alias swarm.neo.client.mixins.BatchRequestCore.BatchRequestSharedWorkingData.Signal ControllerSignal; /// Request-on-conn event dispatcher. private RequestOnConn.EventDispatcherAllNodes conn; /// Request context. private Consume.Context* context; /// Request resource acquirer. private SharedResources.RequestResources resources; /// Request event dispatcher. private RequestEventDispatcher request_event_dispatcher; /*************************************************************************** Constructor. Params: conn = request-on-conn event dispatcher to communicate with node context = deserialised request context resources = request resource acquirer ***************************************************************************/ public this ( RequestOnConn.EventDispatcherAllNodes conn, Consume.Context* context, SharedResources.RequestResources resources ) { this.conn = conn; this.context = context; this.resources = resources; this.request_event_dispatcher.initialise(&resources.getBuffer); } /*************************************************************************** Main request handling entry point. ***************************************************************************/ public void run ( ) { auto initialiser = createAllNodesRequestInitialiser!(Consume)( this.conn, this.context, &this.fillPayload); auto request = createAllNodesRequest!(Consume)(this.conn, this.context, &this.connect, &this.disconnected, initialiser, &this.handle); request.run(); } /*************************************************************************** Connect policy, called from AllNodesRequest template to ensure the connection to the node is up. Returns: true to continue handling the request; false to abort ***************************************************************************/ private bool connect ( ) { return batchRequestConnector(this.conn); } /*************************************************************************** Disconnected policy, called from AllNodesRequest template when an I/O error occurs on the connection. Params: e = exception indicating error which occurred on the connection ***************************************************************************/ private void disconnected ( Exception e ) { // Notify the user of the disconnection. The user may use the // controller, at this point, but as the request is not active // on this connection, no special behaviour is needed. dmqproto.client.request.Consume.Notification notification; notification.node_disconnected = NodeExceptionInfo(this.conn.remote_address, e); Consume.notify(this.context.user_params, notification); } /*************************************************************************** FillPayload policy, called from AllNodesRequestInitialiser template to add request-specific data to the initial message payload send to the node to begin the request. Params: payload = message payload to be filled ***************************************************************************/ private void fillPayload ( RequestOnConnBase.EventDispatcher.Payload payload ) { payload.addArray(this.context.user_params.args.channel); payload.addArray(this.context.user_params.args.subscriber); } /*************************************************************************** Handler policy, called from AllNodesRequest template to run the request's main handling logic. ***************************************************************************/ private void handle ( ) { // Handle initial started/error message from node. switch (conn.receiveValue!(RequestStatusCode)()) { case RequestStatusCode.Started: // Expected "request started" code break; // Treat unknown codes as internal errors. case RequestStatusCode.Error: default: // The node returned an error code. Notify the user and // end the request. dmqproto.client.request.Consume.Notification n; n.node_error = NodeInfo(conn.remote_address); Consume.notify(this.context.user_params, n); return; } scope record_stream = this.new RecordStream; scope reader = this.new Reader(record_stream); scope controller = this.new Controller(record_stream); this.request_event_dispatcher.eventLoop(this.conn); with (record_stream.fiber) verify(state == state.TERM); with (reader.fiber) verify(state == state.TERM); with (controller.fiber) verify(state == state.TERM); } /*************************************************************************** Codes for signals sent across the fibers. ***************************************************************************/ enum FiberSignal: ubyte { /// Resumes the `RecordStream` fiber. ResumeRecordStream = ControllerSignal.max + 1, /// Tells the `Controller` to terminate. StopController } /*************************************************************************** The fiber that waits for a batch of records to arrive and passes it to the user, then sends the `Continue` message to the node, in a loop. Handles suspending the request through the controller, for resuming call `resume`. Calling `stop` makes this routine terminate after all remaining records have been passed to the user. ***************************************************************************/ private class RecordStream { /// The acquired buffer to store a batch of records. private void[]* batch_buffer; /// Slices the records in *batch_buffer that haven't been processed yet. private const(void)[] remaining_batch = null; /// The fiber. private MessageFiber fiber; /// Tells if the fiber is suspended, and if yes, what it is waiting for. enum FiberSuspended: uint { No, WaitingForRecords, RequestSuspended } /// Ditto private FiberSuspended fiber_suspended; /*********************************************************************** If true, causes the fiber to exit after processing remaining records in the batch. Set if the stop method is called. ***********************************************************************/ private bool stopped = false; /// Token passed to fiber suspend/resume calls. private static MessageFiber.Token token = MessageFiber.Token(typeof(this).stringof); /// Constructor, starts the fiber. private this ( ) { this.batch_buffer = this.outer.resources.getBuffer(); this.fiber = this.outer.resources.getFiber(&this.fiberMethod); this.fiber.start(); } /*********************************************************************** Adds a batch of records to be passed to the user notifier and resumes the fiber if it is waiting for more records. Called by the `Reader` when a `Records` message from the node has arrived. Params: record_batch = the batch of records to add ***********************************************************************/ public void addRecords ( in void[] record_batch ) { // Append record_batch to *this.batch_buffer, which may or may not // be empty. if (!(*this.batch_buffer).length) assumeSafeAppend(*this.batch_buffer); // Append record_batch, then set this.remaining_batch to reference // the remaining records. To avoid a dangling slice if // *this.batch_buffer is relocated, set this.remaining_batch to null // first. size_t n_processed = (*this.batch_buffer).length - this.remaining_batch.length; this.remaining_batch = null; (*this.batch_buffer) ~= record_batch; this.remaining_batch = (*this.batch_buffer)[n_processed .. $]; if (this.fiber_suspended == fiber_suspended.WaitingForRecords) this.resumeFiber(); } /*********************************************************************** Resumes passing records to the user. Called by `Controller` when the user resumes the request through the controller. ***********************************************************************/ public void resume ( ) { if (this.fiber_suspended == fiber_suspended.RequestSuspended) this.resumeFiber(); } /*********************************************************************** Requests the fiber to terminate when all remaining records have been passed to the user. Called when a `Stopped` message from the node has arrived. ***********************************************************************/ public void stop ( ) { this.stopped = true; if (this.fiber_suspended == fiber_suspended.WaitingForRecords) this.resumeFiber(); } /*********************************************************************** Waits for a batch of records to be fed to it by the `Reader` and passes it to the user, then sends the `Continue` message to the node, in a loop. Handles suspending the request through the controller, for resuming call `resume`. Calling `stop` makes this routine terminate after all remaining records have been passed to the user. ***********************************************************************/ private void fiberMethod ( ) { while (this.waitForRecords()) { for (uint yield_count = 0; this.remaining_batch.length; yield_count++) { if (yield_count >= 10) // yield every 10th record { yield_count = 0; this.outer.request_event_dispatcher.yield(this.fiber); } if (this.outer.context.shared_working.suspendable_control.suspended) { yield_count = 0; this.suspendFiber(FiberSuspended.RequestSuspended); } this.passRecordToUser( this.outer.conn.message_parser.getArray !(const(void))(this.remaining_batch) ); } this.remaining_batch = null; (*this.batch_buffer).length = 0; if (this.stopped) break; this.outer.request_event_dispatcher.send( this.fiber, (conn.Payload payload) { payload.addCopy(MessageType.Continue); } ); } this.outer.request_event_dispatcher.signal(this.outer.conn, FiberSignal.StopController); } /*********************************************************************** Suspends the fiber to be resumed by `addRecords` or `stop`. Returns: true if the fiber was resumed by `addRecords` or false if resumed by `stop`. ***********************************************************************/ private bool waitForRecords ( ) { this.suspendFiber(FiberSuspended.WaitingForRecords); return !this.stopped; } /*********************************************************************** Calls the user notifier to pass `record` to the user. Handles a request state change (i.e. stopping the request) if the user uses the controller in the notifier. Params: record = the record to pass to the user ***********************************************************************/ private void passRecordToUser ( in void[] record ) { bool initially_stopped = this.outer.context.shared_working.suspendable_control.stopped; Notification notification; notification.received = RequestDataInfo(this.outer.context.request_id, record); Consume.notify(this.outer.context.user_params, notification); if (!initially_stopped && this.outer.context.shared_working.suspendable_control.stopped ) this.outer.request_event_dispatcher.signal(this.outer.conn, ControllerSignal.Stop); } /*********************************************************************** Suspends the fiber, waiting for `FiberSignal.ResumeRecordStream`. `why` specifies the current state of the fiber method and determins which of the public methods should raise that signal. Params: why = the event on which the fiber method needs to be resumed ***********************************************************************/ private void suspendFiber ( FiberSuspended why ) { this.fiber_suspended = why; try this.outer.request_event_dispatcher.nextEvent(this.fiber, Signal(FiberSignal.ResumeRecordStream)); finally this.fiber_suspended = fiber_suspended.No; } /*********************************************************************** Raises `FiberSignal.ResumeRecordStream` to resume the fiber. ***********************************************************************/ private void resumeFiber ( ) { this.outer.request_event_dispatcher.signal(this.outer.conn, FiberSignal.ResumeRecordStream); } } /*************************************************************************** The fiber that reads messages from the node and notifies `RecordStream`. ***************************************************************************/ private class Reader { /// The fiber. private MessageFiber fiber; /// The `RecordStream` to notify when a message has arrived. private RecordStream record_stream; /*********************************************************************** Constructor, starts the fiber. Params: record_stream = the `RecordStream` to notify when a message has arrived ***********************************************************************/ private this ( RecordStream record_stream ) { this.record_stream = record_stream; this.fiber = this.outer.resources.getFiber(&this.fiberMethod); this.fiber.start(); } /*********************************************************************** Reads messages from the node and notifies `record_strem` by calling its respective methods when a `Records` or `Stopped` message has arrived. Quits when a `Stopped` message has arrived because `Stopped` is the last message from the node. ***********************************************************************/ private void fiberMethod ( ) { while (true) { auto msg = this.outer.request_event_dispatcher.receive( this.fiber, Message(MessageType.Records), Message(MessageType.Stopped), Message(MessageType.ChannelRemoved) ); final switch (msg.type) { case MessageType.Records: const(void)[] received_record_batch; this.outer.conn.message_parser.parseBody( msg.payload, received_record_batch ); this.record_stream.addRecords(received_record_batch); break; case MessageType.Stopped: this.record_stream.stop(); return; case MessageType.ChannelRemoved: // TODO break; } } } } /*************************************************************************** The fiber that handles user controller signals. ***************************************************************************/ private class Controller { /// The fiber. private MessageFiber fiber; /// The `RecordStream` to notify when the request is resumed. private RecordStream record_stream; /*********************************************************************** Constructor, starts the fiber. Params: record_stream = the `RecordStream` to notify when the request is resumed ***********************************************************************/ private this ( RecordStream record_stream ) { this.record_stream = record_stream; this.fiber = this.outer.resources.getFiber(&this.fiberMethod); this.fiber.start(); } /*********************************************************************** Waits for controller signals and handles them. Terminates on `FiberSignal.StopController`. ***********************************************************************/ private void fiberMethod ( ) { while (true) { auto event = this.outer.request_event_dispatcher.nextEvent( this.fiber, Signal(ControllerSignal.Resume), Signal(ControllerSignal.Stop), Signal(FiberSignal.StopController) ); final switch (event.signal.code) { case ControllerSignal.Resume: this.record_stream.resume(); break; case ControllerSignal.Stop: this.outer.request_event_dispatcher.send( this.fiber, (conn.Payload payload) { payload.addCopy(MessageType.Stop); } ); break; case FiberSignal.StopController: return; } } } } }
D
import std.stdio, std.array, std.algorithm, std.range, std.random, std.typecons; import std.conv : to; import std.string : strip, format; import std.functional : memoize; import std.exception : enforce; /// Let x = sum(10^i x[i]). Then f(x) = sum(x^i x[i]). auto f(in int x) { ulong sum; foreach (d; x.to!string().map!(c => c.to!int() - 0x30)().array()) { sum *= x; sum += d; } return sum; } int binary_search(ulong y, int xmin, int xmax) { if (f(xmin) == y) return xmin; if (f(xmax) == y) return xmax; if (xmin + 1 == xmax) return -1; auto xmid = xmin + ((xmax-xmin) >> 1); if (f(xmid) == y) return xmid; if (f(xmid) < y) return binary_search(y, xmid, xmax); if (y < f(xmid)) return binary_search(y, xmin, xmid); assert (false); } void main() { auto y = read!ulong(); binary_search(y, 10, 1_0000_0000).writeln(); } T read(T)() { return readln().strip().to!T(); } T[] readMany(T)() { return readln().strip().split().map!(to!T)().array(); } auto readTuple(T...)() { return readln().strip().split().parseTuple!T(); } auto parseTuple(T...)(string[] x) { static if (T.length == 0) { (x.length == 0).enforce("Expecting empty string[] but received %s".format(x)); return tuple(); } else return tuple(x[0].to!(T[0]), x[1..$].parseTuple!(T[1..$])().expand); }
D
// Written in the D programming language. /** This is a submodule of $(MREF std, algorithm). It contains generic mutation algorithms. $(SCRIPT inhibitQuickIndex = 1;) $(BOOKTABLE Cheat Sheet, $(TR $(TH Function Name) $(TH Description)) $(T2 bringToFront, If `a = [1, 2, 3]` and `b = [4, 5, 6, 7]`, `bringToFront(a, b)` leaves `a = [4, 5, 6]` and `b = [7, 1, 2, 3]`.) $(T2 copy, Copies a range to another. If `a = [1, 2, 3]` and `b = new int[5]`, then `copy(a, b)` leaves `b = [1, 2, 3, 0, 0]` and returns `b[3 .. $]`.) $(T2 fill, Fills a range with a pattern, e.g., if `a = new int[3]`, then `fill(a, 4)` leaves `a = [4, 4, 4]` and `fill(a, [3, 4])` leaves `a = [3, 4, 3]`.) $(T2 initializeAll, If `a = [1.2, 3.4]`, then `initializeAll(a)` leaves `a = [double.init, double.init]`.) $(T2 move, `move(a, b)` moves `a` into `b`. `move(a)` reads `a` destructively when necessary.) $(T2 moveEmplace, Similar to `move` but assumes `target` is uninitialized.) $(T2 moveAll, Moves all elements from one range to another.) $(T2 moveEmplaceAll, Similar to `moveAll` but assumes all elements in `target` are uninitialized.) $(T2 moveSome, Moves as many elements as possible from one range to another.) $(T2 moveEmplaceSome, Similar to `moveSome` but assumes all elements in `target` are uninitialized.) $(T2 remove, Removes elements from a range in-place, and returns the shortened range.) $(T2 reverse, If `a = [1, 2, 3]`, `reverse(a)` changes it to `[3, 2, 1]`.) $(T2 strip, Strips all leading and trailing elements equal to a value, or that satisfy a predicate. If `a = [1, 1, 0, 1, 1]`, then `strip(a, 1)` and `strip!(e => e == 1)(a)` returns `[0]`.) $(T2 stripLeft, Strips all leading elements equal to a value, or that satisfy a predicate. If `a = [1, 1, 0, 1, 1]`, then `stripLeft(a, 1)` and `stripLeft!(e => e == 1)(a)` returns `[0, 1, 1]`.) $(T2 stripRight, Strips all trailing elements equal to a value, or that satisfy a predicate. If `a = [1, 1, 0, 1, 1]`, then `stripRight(a, 1)` and `stripRight!(e => e == 1)(a)` returns `[1, 1, 0]`.) $(T2 swap, Swaps two values.) $(T2 swapAt, Swaps two values by indices.) $(T2 swapRanges, Swaps all elements of two ranges.) $(T2 uninitializedFill, Fills a range (assumed uninitialized) with a value.) ) Copyright: Andrei Alexandrescu 2008-. License: $(HTTP boost.org/LICENSE_1_0.txt, Boost License 1.0). Authors: $(HTTP erdani.com, Andrei Alexandrescu) Source: $(PHOBOSSRC std/algorithm/mutation.d) Macros: T2=$(TR $(TDNW $(LREF $1)) $(TD $+)) */ module std.algorithm.mutation; import std.range.primitives; import std.traits : isArray, isAssignable, isBlitAssignable, isNarrowString, Unqual, isSomeChar, isMutable; import std.meta : allSatisfy; // FIXME import std.typecons; // : tuple, Tuple; // bringToFront /** `bringToFront` takes two ranges `front` and `back`, which may be of different types. Considering the concatenation of `front` and `back` one unified range, `bringToFront` rotates that unified range such that all elements in `back` are brought to the beginning of the unified range. The relative ordering of elements in `front` and `back`, respectively, remains unchanged. The `bringToFront` function treats strings at the code unit level and it is not concerned with Unicode character integrity. `bringToFront` is designed as a function for moving elements in ranges, not as a string function. Performs $(BIGOH max(front.length, back.length)) evaluations of $(D swap). The `bringToFront` function can rotate elements in one buffer left or right, swap buffers of equal length, and even move elements across disjoint buffers of different types and different lengths. Preconditions: Either `front` and `back` are disjoint, or `back` is reachable from `front` and `front` is not reachable from $(D back). Params: front = an $(REF_ALTTEXT input range, isInputRange, std,range,primitives) back = a $(REF_ALTTEXT forward range, isForwardRange, std,range,primitives) Returns: The number of elements brought to the front, i.e., the length of `back`. See_Also: $(LINK2 http://en.cppreference.com/w/cpp/algorithm/rotate, STL's `rotate`) */ size_t bringToFront(InputRange, ForwardRange)(InputRange front, ForwardRange back) if (isInputRange!InputRange && isForwardRange!ForwardRange) { import std.string : representation; static if (isNarrowString!InputRange) { auto frontW = representation(front); } else { alias frontW = front; } static if (isNarrowString!ForwardRange) { auto backW = representation(back); } else { alias backW = back; } return bringToFrontImpl(frontW, backW); } /** The simplest use of `bringToFront` is for rotating elements in a buffer. For example: */ @safe unittest { auto arr = [4, 5, 6, 7, 1, 2, 3]; auto p = bringToFront(arr[0 .. 4], arr[4 .. $]); assert(p == arr.length - 4); assert(arr == [ 1, 2, 3, 4, 5, 6, 7 ]); } /** The `front` range may actually "step over" the `back` range. This is very useful with forward ranges that cannot compute comfortably right-bounded subranges like `arr[0 .. 4]` above. In the example below, `r2` is a right subrange of `r1`. */ @safe unittest { import std.algorithm.comparison : equal; import std.container : SList; import std.range.primitives : popFrontN; auto list = SList!(int)(4, 5, 6, 7, 1, 2, 3); auto r1 = list[]; auto r2 = list[]; popFrontN(r2, 4); assert(equal(r2, [ 1, 2, 3 ])); bringToFront(r1, r2); assert(equal(list[], [ 1, 2, 3, 4, 5, 6, 7 ])); } /** Elements can be swapped across ranges of different types: */ @safe unittest { import std.algorithm.comparison : equal; import std.container : SList; auto list = SList!(int)(4, 5, 6, 7); auto vec = [ 1, 2, 3 ]; bringToFront(list[], vec); assert(equal(list[], [ 1, 2, 3, 4 ])); assert(equal(vec, [ 5, 6, 7 ])); } /** Unicode integrity is not preserved: */ @safe unittest { import std.string : representation; auto ar = representation("a".dup); auto br = representation("ç".dup); bringToFront(ar, br); auto a = cast(char[]) ar; auto b = cast(char[]) br; // Illegal UTF-8 assert(a == "\303"); // Illegal UTF-8 assert(b == "\247a"); } private size_t bringToFrontImpl(InputRange, ForwardRange)(InputRange front, ForwardRange back) if (isInputRange!InputRange && isForwardRange!ForwardRange) { import std.array : sameHead; import std.range : take, Take; enum bool sameHeadExists = is(typeof(front.sameHead(back))); size_t result; for (bool semidone; !front.empty && !back.empty; ) { static if (sameHeadExists) { if (front.sameHead(back)) break; // shortcut } // Swap elements until front and/or back ends. auto back0 = back.save; size_t nswaps; do { static if (sameHeadExists) { // Detect the stepping-over condition. if (front.sameHead(back0)) back0 = back.save; } swapFront(front, back); ++nswaps; front.popFront(); back.popFront(); } while (!front.empty && !back.empty); if (!semidone) result += nswaps; // Now deal with the remaining elements. if (back.empty) { if (front.empty) break; // Right side was shorter, which means that we've brought // all the back elements to the front. semidone = true; // Next pass: bringToFront(front, back0) to adjust the rest. back = back0; } else { assert(front.empty, "Expected front to be empty"); // Left side was shorter. Let's step into the back. static if (is(InputRange == Take!ForwardRange)) { front = take(back0, nswaps); } else { immutable subresult = bringToFront(take(back0, nswaps), back); if (!semidone) result += subresult; break; // done } } } return result; } @safe unittest { import std.algorithm.comparison : equal; import std.conv : text; import std.random : Random = Xorshift, uniform; // a more elaborate test { auto rnd = Random(123_456_789); int[] a = new int[uniform(100, 200, rnd)]; int[] b = new int[uniform(100, 200, rnd)]; foreach (ref e; a) e = uniform(-100, 100, rnd); foreach (ref e; b) e = uniform(-100, 100, rnd); int[] c = a ~ b; // writeln("a= ", a); // writeln("b= ", b); auto n = bringToFront(c[0 .. a.length], c[a.length .. $]); //writeln("c= ", c); assert(n == b.length); assert(c == b ~ a, text(c, "\n", a, "\n", b)); } // different types, moveFront, no sameHead { static struct R(T) { T[] data; size_t i; @property { R save() { return this; } bool empty() { return i >= data.length; } T front() { return data[i]; } T front(real e) { return data[i] = cast(T) e; } } void popFront() { ++i; } } auto a = R!int([1, 2, 3, 4, 5]); auto b = R!real([6, 7, 8, 9]); auto n = bringToFront(a, b); assert(n == 4); assert(a.data == [6, 7, 8, 9, 1]); assert(b.data == [2, 3, 4, 5]); } // front steps over back { int[] arr, r1, r2; // back is shorter arr = [4, 5, 6, 7, 1, 2, 3]; r1 = arr; r2 = arr[4 .. $]; bringToFront(r1, r2) == 3 || assert(0); assert(equal(arr, [1, 2, 3, 4, 5, 6, 7])); // front is shorter arr = [5, 6, 7, 1, 2, 3, 4]; r1 = arr; r2 = arr[3 .. $]; bringToFront(r1, r2) == 4 || assert(0); assert(equal(arr, [1, 2, 3, 4, 5, 6, 7])); } // Bugzilla 16959 auto arr = ['4', '5', '6', '7', '1', '2', '3']; auto p = bringToFront(arr[0 .. 4], arr[4 .. $]); assert(p == arr.length - 4); assert(arr == ['1', '2', '3', '4', '5', '6', '7']); } // Tests if types are arrays and support slice assign. private enum bool areCopyCompatibleArrays(T1, T2) = isArray!T1 && isArray!T2 && is(typeof(T2.init[] = T1.init[])); // copy /** Copies the content of `source` into `target` and returns the remaining (unfilled) part of `target`. Preconditions: `target` shall have enough room to accommodate the entirety of `source`. Params: source = an $(REF_ALTTEXT input range, isInputRange, std,range,primitives) target = an output range Returns: The unfilled part of target */ TargetRange copy(SourceRange, TargetRange)(SourceRange source, TargetRange target) if (areCopyCompatibleArrays!(SourceRange, TargetRange)) { const tlen = target.length; const slen = source.length; assert(tlen >= slen, "Cannot copy a source range into a smaller target range."); immutable overlaps = __ctfe || () @trusted { return source.ptr < target.ptr + tlen && target.ptr < source.ptr + slen; }(); if (overlaps) { foreach (idx; 0 .. slen) target[idx] = source[idx]; return target[slen .. tlen]; } else { // Array specialization. This uses optimized memory copying // routines under the hood and is about 10-20x faster than the // generic implementation. target[0 .. slen] = source[]; return target[slen .. $]; } } /// ditto TargetRange copy(SourceRange, TargetRange)(SourceRange source, TargetRange target) if (!areCopyCompatibleArrays!(SourceRange, TargetRange) && isInputRange!SourceRange && isOutputRange!(TargetRange, ElementType!SourceRange)) { // Specialize for 2 random access ranges. // Typically 2 random access ranges are faster iterated by common // index than by x.popFront(), y.popFront() pair static if (isRandomAccessRange!SourceRange && hasLength!SourceRange && hasSlicing!TargetRange && isRandomAccessRange!TargetRange && hasLength!TargetRange) { auto len = source.length; foreach (idx; 0 .. len) target[idx] = source[idx]; return target[len .. target.length]; } else { foreach (element; source) put(target, element); return target; } } /// @safe unittest { int[] a = [ 1, 5 ]; int[] b = [ 9, 8 ]; int[] buf = new int[](a.length + b.length + 10); auto rem = a.copy(buf); // copy a into buf rem = b.copy(rem); // copy b into remainder of buf assert(buf[0 .. a.length + b.length] == [1, 5, 9, 8]); assert(rem.length == 10); // unused slots in buf } /** As long as the target range elements support assignment from source range elements, different types of ranges are accepted: */ @safe unittest { float[] src = [ 1.0f, 5 ]; double[] dest = new double[src.length]; src.copy(dest); } /** To _copy at most `n` elements from a range, you may want to use $(REF take, std,range): */ @safe unittest { import std.range; int[] src = [ 1, 5, 8, 9, 10 ]; auto dest = new int[](3); src.take(dest.length).copy(dest); assert(dest == [ 1, 5, 8 ]); } /** To _copy just those elements from a range that satisfy a predicate, use $(LREF filter): */ @safe unittest { import std.algorithm.iteration : filter; int[] src = [ 1, 5, 8, 9, 10, 1, 2, 0 ]; auto dest = new int[src.length]; auto rem = src .filter!(a => (a & 1) == 1) .copy(dest); assert(dest[0 .. $ - rem.length] == [ 1, 5, 9, 1 ]); } /** $(REF retro, std,range) can be used to achieve behavior similar to $(LINK2 http://en.cppreference.com/w/cpp/algorithm/copy_backward, STL's `copy_backward`'): */ @safe unittest { import std.algorithm, std.range; int[] src = [1, 2, 4]; int[] dest = [0, 0, 0, 0, 0]; src.retro.copy(dest.retro); assert(dest == [0, 0, 1, 2, 4]); } // Test CTFE copy. @safe unittest { enum c = copy([1,2,3], [4,5,6,7]); assert(c == [7]); } @safe unittest { import std.algorithm.iteration : filter; { int[] a = [ 1, 5 ]; int[] b = [ 9, 8 ]; auto e = copy(filter!("a > 1")(a), b); assert(b[0] == 5 && e.length == 1); } { int[] a = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; copy(a[5 .. 10], a[4 .. 9]); assert(a[4 .. 9] == [6, 7, 8, 9, 10]); } { // Test for bug 7898 enum v = { import std.algorithm; int[] arr1 = [10, 20, 30, 40, 50]; int[] arr2 = arr1.dup; copy(arr1, arr2); return 35; }(); assert(v == 35); } } @safe unittest { // Issue 13650 import std.meta : AliasSeq; static foreach (Char; AliasSeq!(char, wchar, dchar)) {{ Char[3] a1 = "123"; Char[6] a2 = "456789"; assert(copy(a1[], a2[]) is a2[3..$]); assert(a1[] == "123"); assert(a2[] == "123789"); }} } @safe unittest // issue 18804 { static struct NullSink { void put(E)(E) {} } int line = 0; struct R { int front; @property bool empty() { return line == 1; } void popFront() { line = 1; } } R r; copy(r, NullSink()); assert(line == 1); } /** Assigns `value` to each element of input range `range`. Alternatively, instead of using a single `value` to fill the `range`, a `filter` $(REF_ALTTEXT forward range, isForwardRange, std,range,primitives) can be provided. The length of `filler` and `range` do not need to match, but `filler` must not be empty. Params: range = An $(REF_ALTTEXT input range, isInputRange, std,range,primitives) that exposes references to its elements and has assignable elements value = Assigned to each element of range filler = A $(REF_ALTTEXT forward range, isForwardRange, std,range,primitives) representing the _fill pattern. Throws: If `filler` is empty. See_Also: $(LREF uninitializedFill) $(LREF initializeAll) */ void fill(Range, Value)(auto ref Range range, auto ref Value value) if ((isInputRange!Range && is(typeof(range.front = value)) || isSomeChar!Value && is(typeof(range[] = value)))) { alias T = ElementType!Range; static if (is(typeof(range[] = value))) { range[] = value; } else static if (is(typeof(range[] = T(value)))) { range[] = T(value); } else { for ( ; !range.empty; range.popFront() ) { range.front = value; } } } /// @safe unittest { int[] a = [ 1, 2, 3, 4 ]; fill(a, 5); assert(a == [ 5, 5, 5, 5 ]); } // issue 16342, test fallback on mutable narrow strings @safe unittest { char[] chars = ['a', 'b']; fill(chars, 'c'); assert(chars == "cc"); char[2] chars2 = ['a', 'b']; fill(chars2, 'c'); assert(chars2 == "cc"); wchar[] wchars = ['a', 'b']; fill(wchars, wchar('c')); assert(wchars == "cc"w); dchar[] dchars = ['a', 'b']; fill(dchars, dchar('c')); assert(dchars == "cc"d); } @nogc @safe unittest { const(char)[] chars; assert(chars.length == 0); static assert(!__traits(compiles, fill(chars, 'c'))); wstring wchars; assert(wchars.length == 0); static assert(!__traits(compiles, fill(wchars, wchar('c')))); } @nogc @safe unittest { char[] chars; fill(chars, 'c'); assert(chars == ""c); } @safe unittest { shared(char)[] chrs = ['r']; fill(chrs, 'c'); assert(chrs == [shared(char)('c')]); } @nogc @safe unittest { struct Str(size_t len) { private char[len] _data; void opIndexAssign(char value) @safe @nogc {_data[] = value;} } Str!2 str; str.fill(':'); assert(str._data == "::"); } @safe unittest { char[] chars = ['a','b','c','d']; chars[1 .. 3].fill(':'); assert(chars == "a::d"); } // end issue 16342 @safe unittest { import std.conv : text; import std.internal.test.dummyrange; int[] a = [ 1, 2, 3 ]; fill(a, 6); assert(a == [ 6, 6, 6 ], text(a)); void fun0() { foreach (i; 0 .. 1000) { foreach (ref e; a) e = 6; } } void fun1() { foreach (i; 0 .. 1000) fill(a, 6); } // fill should accept InputRange alias InputRange = DummyRange!(ReturnBy.Reference, Length.No, RangeType.Input); enum filler = uint.max; InputRange range; fill(range, filler); foreach (value; range.arr) assert(value == filler); } @safe unittest { //ER8638_1 IS_NOT self assignable static struct ER8638_1 { void opAssign(int){} } //ER8638_1 IS self assignable static struct ER8638_2 { void opAssign(ER8638_2){} void opAssign(int){} } auto er8638_1 = new ER8638_1[](10); auto er8638_2 = new ER8638_2[](10); er8638_1.fill(5); //generic case er8638_2.fill(5); //opSlice(T.init) case } @safe unittest { { int[] a = [1, 2, 3]; immutable(int) b = 0; a.fill(b); assert(a == [0, 0, 0]); } { double[] a = [1, 2, 3]; immutable(int) b = 0; a.fill(b); assert(a == [0, 0, 0]); } } /// ditto void fill(InputRange, ForwardRange)(InputRange range, ForwardRange filler) if (isInputRange!InputRange && (isForwardRange!ForwardRange || (isInputRange!ForwardRange && isInfinite!ForwardRange)) && is(typeof(InputRange.init.front = ForwardRange.init.front))) { static if (isInfinite!ForwardRange) { //ForwardRange is infinite, no need for bounds checking or saving static if (hasSlicing!ForwardRange && hasLength!InputRange && is(typeof(filler[0 .. range.length]))) { copy(filler[0 .. range.length], range); } else { //manual feed for ( ; !range.empty; range.popFront(), filler.popFront()) { range.front = filler.front; } } } else { import std.exception : enforce; enforce(!filler.empty, "Cannot fill range with an empty filler"); static if (hasLength!InputRange && hasLength!ForwardRange && is(typeof(range.length > filler.length))) { //Case we have access to length immutable len = filler.length; //Start by bulk copies while (range.length > len) { range = copy(filler.save, range); } //and finally fill the partial range. No need to save here. static if (hasSlicing!ForwardRange && is(typeof(filler[0 .. range.length]))) { //use a quick copy auto len2 = range.length; range = copy(filler[0 .. len2], range); } else { //iterate. No need to check filler, it's length is longer than range's for (; !range.empty; range.popFront(), filler.popFront()) { range.front = filler.front; } } } else { //Most basic case. auto bck = filler.save; for (; !range.empty; range.popFront(), filler.popFront()) { if (filler.empty) filler = bck.save; range.front = filler.front; } } } } /// @safe unittest { int[] a = [ 1, 2, 3, 4, 5 ]; int[] b = [ 8, 9 ]; fill(a, b); assert(a == [ 8, 9, 8, 9, 8 ]); } @safe unittest { import std.exception : assertThrown; import std.internal.test.dummyrange; int[] a = [ 1, 2, 3, 4, 5 ]; int[] b = [1, 2]; fill(a, b); assert(a == [ 1, 2, 1, 2, 1 ]); // fill should accept InputRange alias InputRange = DummyRange!(ReturnBy.Reference, Length.No, RangeType.Input); InputRange range; fill(range,[1,2]); foreach (i,value;range.arr) assert(value == (i%2 == 0?1:2)); //test with a input being a "reference forward" range fill(a, new ReferenceForwardRange!int([8, 9])); assert(a == [8, 9, 8, 9, 8]); //test with a input being an "infinite input" range fill(a, new ReferenceInfiniteInputRange!int()); assert(a == [0, 1, 2, 3, 4]); //empty filler test assertThrown(fill(a, a[$..$])); } /** Initializes all elements of `range` with their `.init` value. Assumes that the elements of the range are uninitialized. Params: range = An $(REF_ALTTEXT input range, isInputRange, std,range,primitives) that exposes references to its elements and has assignable elements See_Also: $(LREF fill) $(LREF uninitializeFill) */ void initializeAll(Range)(Range range) if (isInputRange!Range && hasLvalueElements!Range && hasAssignableElements!Range) { import core.stdc.string : memset, memcpy; import std.traits : hasElaborateAssign, isDynamicArray; alias T = ElementType!Range; static if (hasElaborateAssign!T) { import std.algorithm.internal : addressOf; //Elaborate opAssign. Must go the memcpy road. //We avoid calling emplace here, because our goal is to initialize to //the static state of T.init, //So we want to avoid any un-necassarilly CC'ing of T.init auto p = typeid(T).initializer(); if (p.ptr) { for ( ; !range.empty ; range.popFront() ) { static if (__traits(isStaticArray, T)) { // static array initializer only contains initialization // for one element of the static array. auto elemp = cast(void *) addressOf(range.front); auto endp = elemp + T.sizeof; while (elemp < endp) { memcpy(elemp, p.ptr, p.length); elemp += p.length; } } else { memcpy(addressOf(range.front), p.ptr, T.sizeof); } } } else static if (isDynamicArray!Range) memset(range.ptr, 0, range.length * T.sizeof); else for ( ; !range.empty ; range.popFront() ) memset(addressOf(range.front), 0, T.sizeof); } else fill(range, T.init); } /// ditto void initializeAll(Range)(Range range) if (is(Range == char[]) || is(Range == wchar[])) { alias T = ElementEncodingType!Range; range[] = T.init; } /// @system unittest { import core.stdc.stdlib : malloc, free; struct S { int a = 10; } auto s = (cast(S*) malloc(5 * S.sizeof))[0 .. 5]; initializeAll(s); assert(s == [S(10), S(10), S(10), S(10), S(10)]); scope(exit) free(s.ptr); } @system unittest { import std.algorithm.iteration : filter; import std.meta : AliasSeq; import std.traits : hasElaborateAssign; //Test strings: //Must work on narrow strings. //Must reject const char[3] a = void; a[].initializeAll(); assert(a[] == [char.init, char.init, char.init]); string s; assert(!__traits(compiles, s.initializeAll())); assert(!__traits(compiles, s.initializeAll())); assert(s.empty); //Note: Cannot call uninitializedFill on narrow strings enum e {e1, e2} e[3] b1 = void; b1[].initializeAll(); assert(b1[] == [e.e1, e.e1, e.e1]); e[3] b2 = void; b2[].uninitializedFill(e.e2); assert(b2[] == [e.e2, e.e2, e.e2]); static struct S1 { int i; } static struct S2 { int i = 1; } static struct S3 { int i; this(this){} } static struct S4 { int i = 1; this(this){} } static assert(!hasElaborateAssign!S1); static assert(!hasElaborateAssign!S2); static assert( hasElaborateAssign!S3); static assert( hasElaborateAssign!S4); assert(!typeid(S1).initializer().ptr); assert( typeid(S2).initializer().ptr); assert(!typeid(S3).initializer().ptr); assert( typeid(S4).initializer().ptr); static foreach (S; AliasSeq!(S1, S2, S3, S4)) { //initializeAll { //Array S[3] ss1 = void; ss1[].initializeAll(); assert(ss1[] == [S.init, S.init, S.init]); //Not array S[3] ss2 = void; auto sf = ss2[].filter!"true"(); sf.initializeAll(); assert(ss2[] == [S.init, S.init, S.init]); } //uninitializedFill { //Array S[3] ss1 = void; ss1[].uninitializedFill(S(2)); assert(ss1[] == [S(2), S(2), S(2)]); //Not array S[3] ss2 = void; auto sf = ss2[].filter!"true"(); sf.uninitializedFill(S(2)); assert(ss2[] == [S(2), S(2), S(2)]); } } } // test that initializeAll works for arrays of static arrays of structs with // elaborate assigns. @system unittest { struct Int { ~this() {} int x = 3; } Int[2] xs = [Int(1), Int(2)]; struct R { bool done; bool empty() { return done; } ref Int[2] front() { return xs; } void popFront() { done = true; } } initializeAll(R()); assert(xs[0].x == 3); assert(xs[1].x == 3); } // move /** Moves `source` into `target`, via a destructive copy when necessary. If `T` is a struct with a destructor or postblit defined, source is reset to its `.init` value after it is moved into target, otherwise it is left unchanged. Preconditions: If source has internal pointers that point to itself, it cannot be moved, and will trigger an assertion failure. Params: source = Data to copy. target = Where to copy into. The destructor, if any, is invoked before the copy is performed. */ void move(T)(ref T source, ref T target) { // test @safe destructible static if (__traits(compiles, (T t) @safe {})) trustedMoveImpl(source, target); else moveImpl(source, target); } /// For non-struct types, `move` just performs `target = source`: @safe unittest { Object obj1 = new Object; Object obj2 = obj1; Object obj3; move(obj2, obj3); assert(obj3 is obj1); // obj2 unchanged assert(obj2 is obj1); } /// pure nothrow @safe @nogc unittest { // Structs without destructors are simply copied struct S1 { int a = 1; int b = 2; } S1 s11 = { 10, 11 }; S1 s12; move(s11, s12); assert(s12 == S1(10, 11)); assert(s11 == s12); // But structs with destructors or postblits are reset to their .init value // after copying to the target. struct S2 { int a = 1; int b = 2; ~this() pure nothrow @safe @nogc { } } S2 s21 = { 3, 4 }; S2 s22; move(s21, s22); assert(s21 == S2(1, 2)); assert(s22 == S2(3, 4)); } @safe unittest { import std.exception : assertCTFEable; import std.traits; assertCTFEable!((){ Object obj1 = new Object; Object obj2 = obj1; Object obj3; move(obj2, obj3); assert(obj3 is obj1); static struct S1 { int a = 1, b = 2; } S1 s11 = { 10, 11 }; S1 s12; move(s11, s12); assert(s11.a == 10 && s11.b == 11 && s12.a == 10 && s12.b == 11); static struct S2 { int a = 1; int * b; } S2 s21 = { 10, null }; s21.b = new int; S2 s22; move(s21, s22); assert(s21 == s22); }); // Issue 5661 test(1) static struct S3 { static struct X { int n = 0; ~this(){n = 0;} } X x; } static assert(hasElaborateDestructor!S3); S3 s31, s32; s31.x.n = 1; move(s31, s32); assert(s31.x.n == 0); assert(s32.x.n == 1); // Issue 5661 test(2) static struct S4 { static struct X { int n = 0; this(this){n = 0;} } X x; } static assert(hasElaborateCopyConstructor!S4); S4 s41, s42; s41.x.n = 1; move(s41, s42); assert(s41.x.n == 0); assert(s42.x.n == 1); // Issue 13990 test class S5; S5 s51; S5 s52 = s51; S5 s53; move(s52, s53); assert(s53 is s51); } /// Ditto T move(T)(return scope ref T source) { // test @safe destructible static if (__traits(compiles, (T t) @safe {})) return trustedMoveImpl(source); else return moveImpl(source); } /// Non-copyable structs can still be moved: pure nothrow @safe @nogc unittest { struct S { int a = 1; @disable this(this); ~this() pure nothrow @safe @nogc {} } S s1; s1.a = 2; S s2 = move(s1); assert(s1.a == 1); assert(s2.a == 2); } private void trustedMoveImpl(T)(ref T source, ref T target) @trusted { moveImpl(source, target); } private void moveImpl(T)(ref T source, ref T target) { import std.traits : hasElaborateDestructor; static if (is(T == struct)) { if (&source == &target) return; // Destroy target before overwriting it static if (hasElaborateDestructor!T) target.__xdtor(); } // move and emplace source into target moveEmplace(source, target); } private T trustedMoveImpl(T)(ref T source) @trusted { return moveImpl(source); } private T moveImpl(T)(ref T source) { T result = void; moveEmplace(source, result); return result; } @safe unittest { import std.exception : assertCTFEable; import std.traits; assertCTFEable!((){ Object obj1 = new Object; Object obj2 = obj1; Object obj3 = move(obj2); assert(obj3 is obj1); static struct S1 { int a = 1, b = 2; } S1 s11 = { 10, 11 }; S1 s12 = move(s11); assert(s11.a == 10 && s11.b == 11 && s12.a == 10 && s12.b == 11); static struct S2 { int a = 1; int * b; } S2 s21 = { 10, null }; s21.b = new int; S2 s22 = move(s21); assert(s21 == s22); }); // Issue 5661 test(1) static struct S3 { static struct X { int n = 0; ~this(){n = 0;} } X x; } static assert(hasElaborateDestructor!S3); S3 s31; s31.x.n = 1; S3 s32 = move(s31); assert(s31.x.n == 0); assert(s32.x.n == 1); // Issue 5661 test(2) static struct S4 { static struct X { int n = 0; this(this){n = 0;} } X x; } static assert(hasElaborateCopyConstructor!S4); S4 s41; s41.x.n = 1; S4 s42 = move(s41); assert(s41.x.n == 0); assert(s42.x.n == 1); // Issue 13990 test class S5; S5 s51; S5 s52 = s51; S5 s53; s53 = move(s52); assert(s53 is s51); } @system unittest { static struct S { int n = 0; ~this() @system { n = 0; } } S a, b; static assert(!__traits(compiles, () @safe { move(a, b); })); static assert(!__traits(compiles, () @safe { move(a); })); a.n = 1; () @trusted { move(a, b); }(); assert(a.n == 0); a.n = 1; () @trusted { move(a); }(); assert(a.n == 0); } @safe unittest//Issue 6217 { import std.algorithm.iteration : map; auto x = map!"a"([1,2,3]); x = move(x); } @safe unittest// Issue 8055 { static struct S { int x; ~this() { assert(x == 0); } } S foo(S s) { return move(s); } S a; a.x = 0; auto b = foo(a); assert(b.x == 0); } @system unittest// Issue 8057 { int n = 10; struct S { int x; ~this() { // Access to enclosing scope assert(n == 10); } } S foo(S s) { // Move nested struct return move(s); } S a; a.x = 1; auto b = foo(a); assert(b.x == 1); // Regression 8171 static struct Array(T) { // nested struct has no member struct Payload { ~this() {} } } Array!int.Payload x = void; move(x); move(x, x); } /** * Similar to $(LREF move) but assumes `target` is uninitialized. This * is more efficient because `source` can be blitted over `target` * without destroying or initializing it first. * * Params: * source = value to be moved into target * target = uninitialized value to be filled by source */ void moveEmplace(T)(ref T source, ref T target) @system { import core.stdc.string : memcpy, memset; import std.traits : hasAliasing, hasElaborateAssign, hasElaborateCopyConstructor, hasElaborateDestructor, isAssignable; static if (!is(T == class) && hasAliasing!T) if (!__ctfe) { import std.exception : doesPointTo; assert(!doesPointTo(source, source), "Cannot move object with internal pointer."); } static if (is(T == struct)) { assert(&source !is &target, "source and target must not be identical"); static if (hasElaborateAssign!T || !isAssignable!T) memcpy(&target, &source, T.sizeof); else target = source; // If the source defines a destructor or a postblit hook, we must obliterate the // object in order to avoid double freeing and undue aliasing static if (hasElaborateDestructor!T || hasElaborateCopyConstructor!T) { // If T is nested struct, keep original context pointer static if (__traits(isNested, T)) enum sz = T.sizeof - (void*).sizeof; else enum sz = T.sizeof; auto init = typeid(T).initializer(); if (init.ptr is null) // null ptr means initialize to 0s memset(&source, 0, sz); else memcpy(&source, init.ptr, sz); } } else { // Primitive data (including pointers and arrays) or class - // assignment works great target = source; } } /// pure nothrow @nogc @system unittest { static struct Foo { pure nothrow @nogc: this(int* ptr) { _ptr = ptr; } ~this() { if (_ptr) ++*_ptr; } int* _ptr; } int val; Foo foo1 = void; // uninitialized auto foo2 = Foo(&val); // initialized assert(foo2._ptr is &val); // Using `move(foo2, foo1)` would have an undefined effect because it would destroy // the uninitialized foo1. // moveEmplace directly overwrites foo1 without destroying or initializing it first. moveEmplace(foo2, foo1); assert(foo1._ptr is &val); assert(foo2._ptr is null); assert(val == 0); } // moveAll /** Calls `move(a, b)` for each element `a` in `src` and the corresponding element `b` in `tgt`, in increasing order. Preconditions: `walkLength(src) <= walkLength(tgt)`. This precondition will be asserted. If you cannot ensure there is enough room in `tgt` to accommodate all of `src` use $(LREF moveSome) instead. Params: src = An $(REF_ALTTEXT input range, isInputRange, std,range,primitives) with movable elements. tgt = An $(REF_ALTTEXT input range, isInputRange, std,range,primitives) with elements that elements from `src` can be moved into. Returns: The leftover portion of `tgt` after all elements from `src` have been moved. */ InputRange2 moveAll(InputRange1, InputRange2)(InputRange1 src, InputRange2 tgt) if (isInputRange!InputRange1 && isInputRange!InputRange2 && is(typeof(move(src.front, tgt.front)))) { return moveAllImpl!move(src, tgt); } /// pure nothrow @safe @nogc unittest { int[3] a = [ 1, 2, 3 ]; int[5] b; assert(moveAll(a[], b[]) is b[3 .. $]); assert(a[] == b[0 .. 3]); int[3] cmp = [ 1, 2, 3 ]; assert(a[] == cmp[]); } /** * Similar to $(LREF moveAll) but assumes all elements in `tgt` are * uninitialized. Uses $(LREF moveEmplace) to move elements from * `src` over elements from `tgt`. */ InputRange2 moveEmplaceAll(InputRange1, InputRange2)(InputRange1 src, InputRange2 tgt) @system if (isInputRange!InputRange1 && isInputRange!InputRange2 && is(typeof(moveEmplace(src.front, tgt.front)))) { return moveAllImpl!moveEmplace(src, tgt); } /// pure nothrow @nogc @system unittest { static struct Foo { ~this() pure nothrow @nogc { if (_ptr) ++*_ptr; } int* _ptr; } int[3] refs = [0, 1, 2]; Foo[3] src = [Foo(&refs[0]), Foo(&refs[1]), Foo(&refs[2])]; Foo[5] dst = void; auto tail = moveEmplaceAll(src[], dst[]); // move 3 value from src over dst assert(tail.length == 2); // returns remaining uninitialized values initializeAll(tail); import std.algorithm.searching : all; assert(src[].all!(e => e._ptr is null)); assert(dst[0 .. 3].all!(e => e._ptr !is null)); } @system unittest { struct InputRange { ref int front() { return data[0]; } void popFront() { data.popFront; } bool empty() { return data.empty; } int[] data; } auto a = InputRange([ 1, 2, 3 ]); auto b = InputRange(new int[5]); moveAll(a, b); assert(a.data == b.data[0 .. 3]); assert(a.data == [ 1, 2, 3 ]); } private InputRange2 moveAllImpl(alias moveOp, InputRange1, InputRange2)( ref InputRange1 src, ref InputRange2 tgt) { import std.exception : enforce; static if (isRandomAccessRange!InputRange1 && hasLength!InputRange1 && hasLength!InputRange2 && hasSlicing!InputRange2 && isRandomAccessRange!InputRange2) { auto toMove = src.length; assert(toMove <= tgt.length, "Source buffer needs to be smaller or equal to the target buffer."); foreach (idx; 0 .. toMove) moveOp(src[idx], tgt[idx]); return tgt[toMove .. tgt.length]; } else { for (; !src.empty; src.popFront(), tgt.popFront()) { assert(!tgt.empty, "Source buffer needs to be smaller or equal to the target buffer."); moveOp(src.front, tgt.front); } return tgt; } } // moveSome /** Calls `move(a, b)` for each element `a` in `src` and the corresponding element `b` in `tgt`, in increasing order, stopping when either range has been exhausted. Params: src = An $(REF_ALTTEXT input range, isInputRange, std,range,primitives) with movable elements. tgt = An $(REF_ALTTEXT input range, isInputRange, std,range,primitives) with elements that elements from `src` can be moved into. Returns: The leftover portions of the two ranges after one or the other of the ranges have been exhausted. */ Tuple!(InputRange1, InputRange2) moveSome(InputRange1, InputRange2)(InputRange1 src, InputRange2 tgt) if (isInputRange!InputRange1 && isInputRange!InputRange2 && is(typeof(move(src.front, tgt.front)))) { return moveSomeImpl!move(src, tgt); } /// pure nothrow @safe @nogc unittest { int[5] a = [ 1, 2, 3, 4, 5 ]; int[3] b; assert(moveSome(a[], b[])[0] is a[3 .. $]); assert(a[0 .. 3] == b); assert(a == [ 1, 2, 3, 4, 5 ]); } /** * Same as $(LREF moveSome) but assumes all elements in `tgt` are * uninitialized. Uses $(LREF moveEmplace) to move elements from * `src` over elements from `tgt`. */ Tuple!(InputRange1, InputRange2) moveEmplaceSome(InputRange1, InputRange2)(InputRange1 src, InputRange2 tgt) @system if (isInputRange!InputRange1 && isInputRange!InputRange2 && is(typeof(move(src.front, tgt.front)))) { return moveSomeImpl!moveEmplace(src, tgt); } /// pure nothrow @nogc @system unittest { static struct Foo { ~this() pure nothrow @nogc { if (_ptr) ++*_ptr; } int* _ptr; } int[4] refs = [0, 1, 2, 3]; Foo[4] src = [Foo(&refs[0]), Foo(&refs[1]), Foo(&refs[2]), Foo(&refs[3])]; Foo[3] dst = void; auto res = moveEmplaceSome(src[], dst[]); assert(res.length == 2); import std.algorithm.searching : all; assert(src[0 .. 3].all!(e => e._ptr is null)); assert(src[3]._ptr !is null); assert(dst[].all!(e => e._ptr !is null)); } private Tuple!(InputRange1, InputRange2) moveSomeImpl(alias moveOp, InputRange1, InputRange2)( ref InputRange1 src, ref InputRange2 tgt) { for (; !src.empty && !tgt.empty; src.popFront(), tgt.popFront()) moveOp(src.front, tgt.front); return tuple(src, tgt); } // SwapStrategy /** Defines the swapping strategy for algorithms that need to swap elements in a range (such as partition and sort). The strategy concerns the swapping of elements that are not the core concern of the algorithm. For example, consider an algorithm that sorts $(D [ "abc", "b", "aBc" ]) according to `toUpper(a) < toUpper(b)`. That algorithm might choose to swap the two equivalent strings `"abc"` and `"aBc"`. That does not affect the sorting since both `$D( "abc", "aBc", "b" ]) and `[ "aBc", "abc", "b" ]` are valid outcomes. Some situations require that the algorithm must NOT ever change the relative ordering of equivalent elements (in the example above, only `[ "abc", "aBc", "b" ]` would be the correct result). Such algorithms are called $(B stable). If the ordering algorithm may swap equivalent elements discretionarily, the ordering is called $(B unstable). Yet another class of algorithms may choose an intermediate tradeoff by being stable only on a well-defined subrange of the range. There is no established terminology for such behavior; this library calls it $(B semistable). Generally, the `stable` ordering strategy may be more costly in time and/or space than the other two because it imposes additional constraints. Similarly, `semistable` may be costlier than $(D unstable). As (semi-)stability is not needed very often, the ordering algorithms in this module parameterized by `SwapStrategy` all choose `SwapStrategy.unstable` as the default. */ enum SwapStrategy { /** Allows freely swapping of elements as long as the output satisfies the algorithm's requirements. */ unstable, /** In algorithms partitioning ranges in two, preserve relative ordering of elements only to the left of the partition point. */ semistable, /** Preserve the relative ordering of elements to the largest extent allowed by the algorithm's requirements. */ stable, } /// @safe unittest { int[] a = [0, 1, 2, 3]; assert(remove!(SwapStrategy.stable)(a, 1) == [0, 2, 3]); a = [0, 1, 2, 3]; assert(remove!(SwapStrategy.unstable)(a, 1) == [0, 3, 2]); } /// @safe unittest { import std.algorithm.sorting : partition; // Put stuff greater than 3 on the left auto arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; assert(partition!(a => a > 3, SwapStrategy.stable)(arr) == [1, 2, 3]); assert(arr == [4, 5, 6, 7, 8, 9, 10, 1, 2, 3]); arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; assert(partition!(a => a > 3, SwapStrategy.semistable)(arr) == [2, 3, 1]); assert(arr == [4, 5, 6, 7, 8, 9, 10, 2, 3, 1]); arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; assert(partition!(a => a > 3, SwapStrategy.unstable)(arr) == [3, 2, 1]); assert(arr == [10, 9, 8, 4, 5, 6, 7, 3, 2, 1]); } private template isValidIntegralTuple(T) { import std.traits : isIntegral; import std.typecons : isTuple; static if (isTuple!T) { enum isValidIntegralTuple = T.length == 2 && isIntegral!(typeof(T.init[0])) && isIntegral!(typeof(T.init[0])); } else { enum isValidIntegralTuple = isIntegral!T; } } /** Eliminates elements at given offsets from `range` and returns the shortened range. For example, here is how to remove a single element from an array: ---- string[] a = [ "a", "b", "c", "d" ]; a = a.remove(1); // remove element at offset 1 assert(a == [ "a", "c", "d"]); ---- Note that `remove` does not change the length of the original range directly; instead, it returns the shortened range. If its return value is not assigned to the original range, the original range will retain its original length, though its contents will have changed: ---- int[] a = [ 3, 5, 7, 8 ]; assert(remove(a, 1) == [ 3, 7, 8 ]); assert(a == [ 3, 7, 8, 8 ]); ---- The element at offset `1` has been removed and the rest of the elements have shifted up to fill its place, however, the original array remains of the same length. This is because all functions in `std.algorithm` only change $(I content), not $(I topology). The value `8` is repeated because $(LREF move) was invoked to rearrange elements, and on integers `move` simply copies the source to the destination. To replace `a` with the effect of the removal, simply assign the slice returned by `remove` to it, as shown in the first example. Multiple indices can be passed into `remove`. In that case, elements at the respective indices are all removed. The indices must be passed in increasing order, otherwise an exception occurs. ---- int[] a = [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ]; assert(remove(a, 1, 3, 5) == [ 0, 2, 4, 6, 7, 8, 9, 10 ]); ---- (Note that all indices refer to slots in the $(I original) array, not in the array as it is being progressively shortened.) Tuples of two integral offsets can be used to remove an indices range: ---- int[] a = [ 3, 4, 5, 6, 7]; assert(remove(a, 1, tuple(1, 3), 9) == [ 3, 6, 7 ]); ---- The tuple passes in a range closed to the left and open to the right (consistent with built-in slices), e.g. `tuple(1, 3)` means indices `1` and `2` but not `3`. Finally, any combination of integral offsets and tuples composed of two integral offsets can be passed in: ---- int[] a = [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ]; assert(remove(a, 1, tuple(3, 5), 9) == [ 0, 2, 5, 6, 7, 8, 10 ]); ---- In this case, the slots at positions 1, 3, 4, and 9 are removed from the array. If the need is to remove some elements in the range but the order of the remaining elements does not have to be preserved, you may want to pass `SwapStrategy.unstable` to `remove`. ---- int[] a = [ 0, 1, 2, 3 ]; assert(remove!(SwapStrategy.unstable)(a, 1) == [ 0, 3, 2 ]); ---- In the case above, the element at slot `1` is removed, but replaced with the last element of the range. Taking advantage of the relaxation of the stability requirement, `remove` moved elements from the end of the array over the slots to be removed. This way there is less data movement to be done which improves the execution time of the function. The function `remove` works on bidirectional ranges that have assignable lvalue elements. The moving strategy is (listed from fastest to slowest): $(UL $(LI If $(D s == SwapStrategy.unstable && isRandomAccessRange!Range && hasLength!Range && hasLvalueElements!Range), then elements are moved from the end of the range into the slots to be filled. In this case, the absolute minimum of moves is performed.) $(LI Otherwise, if $(D s == SwapStrategy.unstable && isBidirectionalRange!Range && hasLength!Range && hasLvalueElements!Range), then elements are still moved from the end of the range, but time is spent on advancing between slots by repeated calls to `range.popFront`.) $(LI Otherwise, elements are moved incrementally towards the front of `range`; a given element is never moved several times, but more elements are moved than in the previous cases.) ) Params: s = a SwapStrategy to determine if the original order needs to be preserved range = a $(REF_ALTTEXT bidirectional range, isBidirectionalRange, std,range,primitives) with a length member offset = which element(s) to remove Returns: A range containing all of the elements of range with offset removed. */ Range remove (SwapStrategy s = SwapStrategy.stable, Range, Offset ...) (Range range, Offset offset) if (Offset.length >= 1 && allSatisfy!(isValidIntegralTuple, Offset)) { // Activate this check when the deprecation of non-integral tuples is over //import std.traits : isIntegral; //import std.typecons : isTuple; //static foreach (T; Offset) //{ //static if (isTuple!T) //{ //static assert(T.length == 2 && //isIntegral!(typeof(T.init[0])) && isIntegral!(typeof(T.init[0])), //"Each offset must be an integral or a tuple of two integrals." ~ //"Use `arr.remove(pos1, pos2)` or `arr.remove(tuple(start, begin))`"); //} //else //{ //static assert(isIntegral!T, //"Each offset must be an integral or a tuple of two integrals." ~ //"Use `arr.remove(pos1, pos2)` or `arr.remove(tuple(start, begin))`"); //} //} return removeImpl!s(range, offset); } deprecated("Use of non-integral tuples is deprecated. Use remove(tuple(start, end).") Range remove (SwapStrategy s = SwapStrategy.stable, Range, Offset ...) (Range range, Offset offset) if (Offset.length >= 1 && !allSatisfy!(isValidIntegralTuple, Offset)) { return removeImpl!s(range, offset); } /// @safe pure unittest { import std.typecons : tuple; auto a = [ 0, 1, 2, 3, 4, 5 ]; assert(remove!(SwapStrategy.stable)(a, 1) == [ 0, 2, 3, 4, 5 ]); a = [ 0, 1, 2, 3, 4, 5 ]; assert(remove!(SwapStrategy.stable)(a, 1, 3) == [ 0, 2, 4, 5] ); a = [ 0, 1, 2, 3, 4, 5 ]; assert(remove!(SwapStrategy.stable)(a, 1, tuple(3, 6)) == [ 0, 2 ]); a = [ 0, 1, 2, 3, 4, 5 ]; assert(remove!(SwapStrategy.unstable)(a, 1) == [0, 5, 2, 3, 4]); a = [ 0, 1, 2, 3, 4, 5 ]; assert(remove!(SwapStrategy.unstable)(a, tuple(1, 4)) == [0, 5, 4]); } /// @safe pure unittest { import std.typecons : tuple; // Delete an index assert([4, 5, 6].remove(1) == [4, 6]); // Delete multiple indices assert([4, 5, 6, 7, 8].remove(1, 3) == [4, 6, 8]); // Use an indices range assert([4, 5, 6, 7, 8].remove(tuple(1, 3)) == [4, 7, 8]); // Use an indices range and individual indices assert([4, 5, 6, 7, 8].remove(0, tuple(1, 3), 4) == [7]); } /// `SwapStrategy.unstable` is faster, but doesn't guarantee the same order of the original array @safe pure unittest { assert([5, 6, 7, 8].remove!(SwapStrategy.stable)(1) == [5, 7, 8]); assert([5, 6, 7, 8].remove!(SwapStrategy.unstable)(1) == [5, 8, 7]); } private auto removeImpl(SwapStrategy s, Range, Offset...)(Range range, Offset offset) { static if (isNarrowString!Range) { static assert(isMutable!(typeof(range[0])), "Elements must be mutable to remove"); static assert(s == SwapStrategy.stable, "Only stable removing can be done for character arrays"); return removeStableString(range, offset); } else { static assert(isBidirectionalRange!Range, "Range must be bidirectional"); static assert(hasLvalueElements!Range, "Range must have Lvalue elements (see std.range.hasLvalueElements)"); static if (s == SwapStrategy.unstable) { static assert(hasLength!Range, "Range must have `length` for unstable remove"); return removeUnstable(range, offset); } else static if (s == SwapStrategy.stable) return removeStable(range, offset); else static assert(false, "Only SwapStrategy.stable and SwapStrategy.unstable are supported"); } } @safe unittest { import std.exception : assertThrown; import std.range; // http://d.puremagic.com/issues/show_bug.cgi?id=10173 int[] test = iota(0, 10).array(); assertThrown(remove!(SwapStrategy.stable)(test, tuple(2, 4), tuple(1, 3))); assertThrown(remove!(SwapStrategy.unstable)(test, tuple(2, 4), tuple(1, 3))); assertThrown(remove!(SwapStrategy.stable)(test, 2, 4, 1, 3)); assertThrown(remove!(SwapStrategy.unstable)(test, 2, 4, 1, 3)); } @safe unittest { import std.range; int[] a = [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ]; a = [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ]; assert(remove!(SwapStrategy.stable)(a, 1) == [ 0, 2, 3, 4, 5, 6, 7, 8, 9, 10 ]); a = [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ]; assert(remove!(SwapStrategy.unstable)(a, 0, 10) == [ 9, 1, 2, 3, 4, 5, 6, 7, 8 ]); a = [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ]; assert(remove!(SwapStrategy.unstable)(a, 0, tuple(9, 11)) == [ 8, 1, 2, 3, 4, 5, 6, 7 ]); // http://d.puremagic.com/issues/show_bug.cgi?id=5224 a = [ 1, 2, 3, 4 ]; assert(remove!(SwapStrategy.unstable)(a, 2) == [ 1, 2, 4 ]); a = [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ]; assert(remove!(SwapStrategy.stable)(a, 1, 5) == [ 0, 2, 3, 4, 6, 7, 8, 9, 10 ]); a = [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ]; assert(remove!(SwapStrategy.stable)(a, 1, 3, 5) == [ 0, 2, 4, 6, 7, 8, 9, 10]); a = [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ]; assert(remove!(SwapStrategy.stable)(a, 1, tuple(3, 5)) == [ 0, 2, 5, 6, 7, 8, 9, 10]); a = iota(0, 10).array(); assert(remove!(SwapStrategy.unstable)(a, tuple(1, 4), tuple(6, 7)) == [0, 9, 8, 7, 4, 5]); } @safe unittest { // Issue 11576 auto arr = [1,2,3]; arr = arr.remove!(SwapStrategy.unstable)(2); assert(arr == [1,2]); } @safe unittest { import std.range; // Bug# 12889 int[1][] arr = [[0], [1], [2], [3], [4], [5], [6]]; auto orig = arr.dup; foreach (i; iota(arr.length)) { assert(orig == arr.remove!(SwapStrategy.unstable)(tuple(i,i))); assert(orig == arr.remove!(SwapStrategy.stable)(tuple(i,i))); } } @safe unittest { char[] chars = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h']; remove(chars, 4); assert(chars == ['a', 'b', 'c', 'd', 'f', 'g', 'h', 'h']); char[] bigChars = "∑œ∆¬é˚˙ƒé∂ß¡¡".dup; assert(remove(bigChars, tuple(4, 6), 8) == ("∑œ∆¬˙ƒ∂ß¡¡")); import std.exception : assertThrown; assertThrown(remove(bigChars.dup, 1, 0)); assertThrown(remove(bigChars.dup, tuple(4, 3))); } private Range removeUnstable(Range, Offset...)(Range range, Offset offset) { Tuple!(size_t, "pos", size_t, "len")[offset.length] blackouts; foreach (i, v; offset) { static if (is(typeof(v[0]) : size_t) && is(typeof(v[1]) : size_t)) { blackouts[i].pos = v[0]; blackouts[i].len = v[1] - v[0]; } else { static assert(is(typeof(v) : size_t), typeof(v).stringof); blackouts[i].pos = v; blackouts[i].len = 1; } static if (i > 0) { import std.exception : enforce; enforce(blackouts[i - 1].pos + blackouts[i - 1].len <= blackouts[i].pos, "remove(): incorrect ordering of elements to remove"); } } size_t left = 0, right = offset.length - 1; auto tgt = range.save; size_t tgtPos = 0; while (left <= right) { // Look for a blackout on the right if (blackouts[right].pos + blackouts[right].len >= range.length) { range.popBackExactly(blackouts[right].len); // Since right is unsigned, we must check for this case, otherwise // we might turn it into size_t.max and the loop condition will not // fail when it should. if (right > 0) { --right; continue; } else break; } // Advance to next blackout on the left assert(blackouts[left].pos >= tgtPos, "Next blackout on the left shouldn't appear before the target."); tgt.popFrontExactly(blackouts[left].pos - tgtPos); tgtPos = blackouts[left].pos; // Number of elements to the right of blackouts[right] immutable tailLen = range.length - (blackouts[right].pos + blackouts[right].len); size_t toMove = void; if (tailLen < blackouts[left].len) { toMove = tailLen; blackouts[left].pos += toMove; blackouts[left].len -= toMove; } else { toMove = blackouts[left].len; ++left; } tgtPos += toMove; foreach (i; 0 .. toMove) { move(range.back, tgt.front); range.popBack(); tgt.popFront(); } } return range; } private Range removeStable(Range, Offset...)(Range range, Offset offset) { auto result = range; auto src = range, tgt = range; size_t pos; foreach (pass, i; offset) { static if (is(typeof(i[0])) && is(typeof(i[1]))) { auto from = i[0], delta = i[1] - i[0]; } else { auto from = i; enum delta = 1; } static if (pass > 0) { import std.exception : enforce; enforce(pos <= from, "remove(): incorrect ordering of elements to remove"); for (; pos < from; ++pos, src.popFront(), tgt.popFront()) { move(src.front, tgt.front); } } else { src.popFrontExactly(from); tgt.popFrontExactly(from); pos = from; } // now skip source to the "to" position src.popFrontExactly(delta); result.popBackExactly(delta); pos += delta; } // leftover move moveAll(src, tgt); return result; } private Range removeStableString(Range, Offset...)(Range range, Offset offsets) { import std.utf : stride; size_t charIdx = 0; size_t dcharIdx = 0; size_t charShift = 0; void skipOne() { charIdx += stride(range[charIdx .. $]); ++dcharIdx; } void copyBackOne() { auto encodedLen = stride(range[charIdx .. $]); foreach (j; charIdx .. charIdx + encodedLen) range[j - charShift] = range[j]; charIdx += encodedLen; ++dcharIdx; } foreach (pass, i; offsets) { static if (is(typeof(i[0])) && is(typeof(i[1]))) { auto from = i[0]; auto delta = i[1] - i[0]; } else { auto from = i; enum delta = 1; } import std.exception : enforce; enforce(dcharIdx <= from && delta >= 0, "remove(): incorrect ordering of elements to remove"); while (dcharIdx < from) static if (pass == 0) skipOne(); else copyBackOne(); auto mark = charIdx; while (dcharIdx < from + delta) skipOne(); charShift += charIdx - mark; } foreach (i; charIdx .. range.length) range[i - charShift] = range[i]; return range[0 .. $ - charShift]; } // Use of dynamic arrays as offsets is too error-prone // https://issues.dlang.org/show_bug.cgi?id=12086 // Activate these tests once the deprecation period of remove with non-integral tuples is over @safe unittest { //static assert(!__traits(compiles, [0, 1, 2, 3, 4].remove([1, 3]) == [0, 3, 4])); static assert(__traits(compiles, [0, 1, 2, 3, 4].remove(1, 3) == [0, 2, 4])); //static assert(!__traits(compiles, assert([0, 1, 2, 3, 4].remove([1, 3, 4]) == [0, 3, 4]))); //static assert(!__traits(compiles, assert([0, 1, 2, 3, 4].remove(tuple(1, 3, 4)) == [0, 3, 4]))); import std.range : only; //static assert(!__traits(compiles, assert([0, 1, 2, 3, 4].remove(only(1, 3)) == [0, 3, 4]))); static assert(__traits(compiles, assert([0, 1, 2, 3, 4].remove(1, 3) == [0, 2, 4]))); } /** Reduces the length of the $(REF_ALTTEXT bidirectional range, isBidirectionalRange, std,range,primitives) `range` by removing elements that satisfy `pred`. If `s = SwapStrategy.unstable`, elements are moved from the right end of the range over the elements to eliminate. If `s = SwapStrategy.stable` (the default), elements are moved progressively to front such that their relative order is preserved. Returns the filtered range. Params: range = a bidirectional ranges with lvalue elements or mutable character arrays Returns: the range with all of the elements where `pred` is `true` removed */ Range remove(alias pred, SwapStrategy s = SwapStrategy.stable, Range)(Range range) { import std.functional : unaryFun; alias pred_ = unaryFun!pred; static if (isNarrowString!Range) { static assert(isMutable!(typeof(range[0])), "Elements must be mutable to remove"); static assert(s == SwapStrategy.stable, "Only stable removing can be done for character arrays"); return removePredString!pred_(range); } else { static assert(isBidirectionalRange!Range, "Range must be bidirectional"); static assert(hasLvalueElements!Range, "Range must have Lvalue elements (see std.range.hasLvalueElements)"); static if (s == SwapStrategy.unstable) return removePredUnstable!pred_(range); else static if (s == SwapStrategy.stable) return removePredStable!pred_(range); else static assert(false, "Only SwapStrategy.stable and SwapStrategy.unstable are supported"); } } /// @safe unittest { static immutable base = [1, 2, 3, 2, 4, 2, 5, 2]; int[] arr = base[].dup; // using a string-based predicate assert(remove!("a == 2")(arr) == [ 1, 3, 4, 5 ]); // The original array contents have been modified, // so we need to reset it to its original state. // The length is unmodified however. arr[] = base[]; // using a lambda predicate assert(remove!(a => a == 2)(arr) == [ 1, 3, 4, 5 ]); } @safe unittest { int[] a = [ 1, 2, 3, 2, 3, 4, 5, 2, 5, 6 ]; assert(remove!("a == 2", SwapStrategy.unstable)(a) == [ 1, 6, 3, 5, 3, 4, 5 ]); a = [ 1, 2, 3, 2, 3, 4, 5, 2, 5, 6 ]; assert(remove!("a == 2", SwapStrategy.stable)(a) == [ 1, 3, 3, 4, 5, 5, 6 ]); } @nogc @safe unittest { // @nogc test int[10] arr = [0,1,2,3,4,5,6,7,8,9]; alias pred = e => e < 5; auto r = arr[].remove!(SwapStrategy.unstable)(0); r = r.remove!(SwapStrategy.stable)(0); r = r.remove!(pred, SwapStrategy.unstable); r = r.remove!(pred, SwapStrategy.stable); } @safe unittest { import std.algorithm.comparison : min; import std.algorithm.searching : all, any; import std.algorithm.sorting : isStrictlyMonotonic; import std.array : array; import std.meta : AliasSeq; import std.range : iota, only; import std.typecons : Tuple; alias E = Tuple!(int, int); alias S = Tuple!(E); S[] soffsets; foreach (start; 0 .. 5) foreach (end; min(start+1,5) .. 5) soffsets ~= S(E(start,end)); alias D = Tuple!(E, E); D[] doffsets; foreach (start1; 0 .. 10) foreach (end1; min(start1+1,10) .. 10) foreach (start2; end1 .. 10) foreach (end2; min(start2+1,10) .. 10) doffsets ~= D(E(start1,end1),E(start2,end2)); alias T = Tuple!(E, E, E); T[] toffsets; foreach (start1; 0 .. 15) foreach (end1; min(start1+1,15) .. 15) foreach (start2; end1 .. 15) foreach (end2; min(start2+1,15) .. 15) foreach (start3; end2 .. 15) foreach (end3; min(start3+1,15) .. 15) toffsets ~= T(E(start1,end1),E(start2,end2),E(start3,end3)); static void verify(O...)(int[] r, int len, int removed, bool stable, O offsets) { assert(r.length == len - removed); assert(!stable || r.isStrictlyMonotonic); assert(r.all!(e => all!(o => e < o[0] || e >= o[1])(offsets.only))); } static foreach (offsets; AliasSeq!(soffsets,doffsets,toffsets)) foreach (os; offsets) { int len = 5*os.length; auto w = iota(0, len).array; auto x = w.dup; auto y = w.dup; auto z = w.dup; alias pred = e => any!(o => o[0] <= e && e < o[1])(only(os.expand)); w = w.remove!(SwapStrategy.unstable)(os.expand); x = x.remove!(SwapStrategy.stable)(os.expand); y = y.remove!(pred, SwapStrategy.unstable); z = z.remove!(pred, SwapStrategy.stable); int removed; foreach (o; os) removed += o[1] - o[0]; verify(w, len, removed, false, os[]); verify(x, len, removed, true, os[]); verify(y, len, removed, false, os[]); verify(z, len, removed, true, os[]); assert(w == y); assert(x == z); } } @safe unittest { char[] chars = "abcdefg".dup; assert(chars.remove!(dc => dc == 'c' || dc == 'f') == "abdeg"); assert(chars == "abdegfg"); assert(chars.remove!"a == 'd'" == "abegfg"); char[] bigChars = "¥^¨^©é√∆π".dup; assert(bigChars.remove!(dc => dc == "¨"d[0] || dc == "é"d[0]) == "¥^^©√∆π"); } private Range removePredUnstable(alias pred, Range)(Range range) { auto result = range; for (;!range.empty;) { if (!pred(range.front)) { range.popFront(); continue; } move(range.back, range.front); range.popBack(); result.popBack(); } return result; } private Range removePredStable(alias pred, Range)(Range range) { auto result = range; auto tgt = range; for (; !range.empty; range.popFront()) { if (pred(range.front)) { // yank this guy result.popBack(); continue; } // keep this guy move(range.front, tgt.front); tgt.popFront(); } return result; } private Range removePredString(alias pred, SwapStrategy s = SwapStrategy.stable, Range) (Range range) { import std.utf : decode; import std.functional : unaryFun; alias pred_ = unaryFun!pred; size_t charIdx = 0; size_t charShift = 0; while (charIdx < range.length) { size_t start = charIdx; if (pred_(decode(range, charIdx))) { charShift += charIdx - start; break; } } while (charIdx < range.length) { size_t start = charIdx; auto doRemove = pred_(decode(range, charIdx)); auto encodedLen = charIdx - start; if (doRemove) charShift += encodedLen; else foreach (i; start .. charIdx) range[i - charShift] = range[i]; } return range[0 .. $ - charShift]; } // reverse /** Reverses `r` in-place. Performs `r.length / 2` evaluations of `swap`. UTF sequences consisting of multiple code units are preserved properly. Params: r = a $(REF_ALTTEXT bidirectional range, isBidirectionalRange, std,range,primitives) with either swappable elements, a random access range with a length member, or a narrow string Returns: `r` Note: When passing a string with unicode modifiers on characters, such as `\u0301`, this function will not properly keep the position of the modifier. For example, reversing `ba\u0301d` ("bád") will result in d\u0301ab ("d́ab") instead of `da\u0301b` ("dáb"). See_Also: $(REF retro, std,range) for a lazy reverse without changing `r` */ Range reverse(Range)(Range r) if (isBidirectionalRange!Range && (hasSwappableElements!Range || (hasAssignableElements!Range && hasLength!Range && isRandomAccessRange!Range) || (isNarrowString!Range && isAssignable!(ElementType!Range)))) { static if (isRandomAccessRange!Range && hasLength!Range) { //swapAt is in fact the only way to swap non lvalue ranges immutable last = r.length - 1; immutable steps = r.length / 2; for (size_t i = 0; i < steps; i++) { r.swapAt(i, last - i); } return r; } else static if (isNarrowString!Range && isAssignable!(ElementType!Range)) { import std.string : representation; import std.utf : stride; auto raw = representation(r); for (size_t i = 0; i < r.length;) { immutable step = stride(r, i); if (step > 1) { .reverse(raw[i .. i + step]); i += step; } else { ++i; } } reverse(raw); return r; } else { while (!r.empty) { swap(r.front, r.back); r.popFront(); if (r.empty) break; r.popBack(); } return r; } } /// @safe unittest { int[] arr = [ 1, 2, 3 ]; assert(arr.reverse == [ 3, 2, 1 ]); } @safe unittest { int[] range = null; reverse(range); range = [ 1 ]; reverse(range); assert(range == [1]); range = [1, 2]; reverse(range); assert(range == [2, 1]); range = [1, 2, 3]; assert(range.reverse == [3, 2, 1]); } /// @safe unittest { char[] arr = "hello\U00010143\u0100\U00010143".dup; assert(arr.reverse == "\U00010143\u0100\U00010143olleh"); } @safe unittest { void test(string a, string b) { auto c = a.dup; reverse(c); assert(c == b, c ~ " != " ~ b); } test("a", "a"); test(" ", " "); test("\u2029", "\u2029"); test("\u0100", "\u0100"); test("\u0430", "\u0430"); test("\U00010143", "\U00010143"); test("abcdefcdef", "fedcfedcba"); test("hello\U00010143\u0100\U00010143", "\U00010143\u0100\U00010143olleh"); } /** The strip group of functions allow stripping of either leading, trailing, or both leading and trailing elements. The `stripLeft` function will strip the `front` of the range, the `stripRight` function will strip the `back` of the range, while the `strip` function will strip both the `front` and `back` of the range. Note that the `strip` and `stripRight` functions require the range to be a $(LREF BidirectionalRange) range. All of these functions come in two varieties: one takes a target element, where the range will be stripped as long as this element can be found. The other takes a lambda predicate, where the range will be stripped as long as the predicate returns true. Params: range = a $(REF_ALTTEXT bidirectional range, isBidirectionalRange, std,range,primitives) or $(REF_ALTTEXT input range, isInputRange, std,range,primitives) element = the elements to remove Returns: a Range with all of range except element at the start and end */ Range strip(Range, E)(Range range, E element) if (isBidirectionalRange!Range && is(typeof(range.front == element) : bool)) { return range.stripLeft(element).stripRight(element); } /// ditto Range strip(alias pred, Range)(Range range) if (isBidirectionalRange!Range && is(typeof(pred(range.back)) : bool)) { return range.stripLeft!pred().stripRight!pred(); } /// ditto Range stripLeft(Range, E)(Range range, E element) if (isInputRange!Range && is(typeof(range.front == element) : bool)) { import std.algorithm.searching : find; return find!((auto ref a) => a != element)(range); } /// ditto Range stripLeft(alias pred, Range)(Range range) if (isInputRange!Range && is(typeof(pred(range.front)) : bool)) { import std.algorithm.searching : find; import std.functional : not; return find!(not!pred)(range); } /// ditto Range stripRight(Range, E)(Range range, E element) if (isBidirectionalRange!Range && is(typeof(range.back == element) : bool)) { for (; !range.empty; range.popBack()) { if (range.back != element) break; } return range; } /// ditto Range stripRight(alias pred, Range)(Range range) if (isBidirectionalRange!Range && is(typeof(pred(range.back)) : bool)) { for (; !range.empty; range.popBack()) { if (!pred(range.back)) break; } return range; } /// Strip leading and trailing elements equal to the target element. @safe pure unittest { assert(" foobar ".strip(' ') == "foobar"); assert("00223.444500".strip('0') == "223.4445"); assert("ëëêéüŗōpéêëë".strip('ë') == "êéüŗōpéê"); assert([1, 1, 0, 1, 1].strip(1) == [0]); assert([0.0, 0.01, 0.01, 0.0].strip(0).length == 2); } /// Strip leading and trailing elements while the predicate returns true. @safe pure unittest { assert(" foobar ".strip!(a => a == ' ')() == "foobar"); assert("00223.444500".strip!(a => a == '0')() == "223.4445"); assert("ëëêéüŗōpéêëë".strip!(a => a == 'ë')() == "êéüŗōpéê"); assert([1, 1, 0, 1, 1].strip!(a => a == 1)() == [0]); assert([0.0, 0.01, 0.5, 0.6, 0.01, 0.0].strip!(a => a < 0.4)().length == 2); } /// Strip leading elements equal to the target element. @safe pure unittest { assert(" foobar ".stripLeft(' ') == "foobar "); assert("00223.444500".stripLeft('0') == "223.444500"); assert("ůůűniçodêéé".stripLeft('ů') == "űniçodêéé"); assert([1, 1, 0, 1, 1].stripLeft(1) == [0, 1, 1]); assert([0.0, 0.01, 0.01, 0.0].stripLeft(0).length == 3); } /// Strip leading elements while the predicate returns true. @safe pure unittest { assert(" foobar ".stripLeft!(a => a == ' ')() == "foobar "); assert("00223.444500".stripLeft!(a => a == '0')() == "223.444500"); assert("ůůűniçodêéé".stripLeft!(a => a == 'ů')() == "űniçodêéé"); assert([1, 1, 0, 1, 1].stripLeft!(a => a == 1)() == [0, 1, 1]); assert([0.0, 0.01, 0.10, 0.5, 0.6].stripLeft!(a => a < 0.4)().length == 2); } /// Strip trailing elements equal to the target element. @safe pure unittest { assert(" foobar ".stripRight(' ') == " foobar"); assert("00223.444500".stripRight('0') == "00223.4445"); assert("ùniçodêéé".stripRight('é') == "ùniçodê"); assert([1, 1, 0, 1, 1].stripRight(1) == [1, 1, 0]); assert([0.0, 0.01, 0.01, 0.0].stripRight(0).length == 3); } /// Strip trailing elements while the predicate returns true. @safe pure unittest { assert(" foobar ".stripRight!(a => a == ' ')() == " foobar"); assert("00223.444500".stripRight!(a => a == '0')() == "00223.4445"); assert("ùniçodêéé".stripRight!(a => a == 'é')() == "ùniçodê"); assert([1, 1, 0, 1, 1].stripRight!(a => a == 1)() == [1, 1, 0]); assert([0.0, 0.01, 0.10, 0.5, 0.6].stripRight!(a => a > 0.4)().length == 3); } // swap /** Swaps `lhs` and `rhs`. The instances `lhs` and `rhs` are moved in memory, without ever calling `opAssign`, nor any other function. `T` need not be assignable at all to be swapped. If `lhs` and `rhs` reference the same instance, then nothing is done. `lhs` and `rhs` must be mutable. If `T` is a struct or union, then its fields must also all be (recursively) mutable. Params: lhs = Data to be swapped with `rhs`. rhs = Data to be swapped with `lhs`. */ void swap(T)(ref T lhs, ref T rhs) @trusted pure nothrow @nogc if (isBlitAssignable!T && !is(typeof(lhs.proxySwap(rhs)))) { import std.traits : hasAliasing, hasElaborateAssign, isAssignable, isStaticArray; static if (hasAliasing!T) if (!__ctfe) { import std.exception : doesPointTo; assert(!doesPointTo(lhs, lhs), "Swap: lhs internal pointer."); assert(!doesPointTo(rhs, rhs), "Swap: rhs internal pointer."); assert(!doesPointTo(lhs, rhs), "Swap: lhs points to rhs."); assert(!doesPointTo(rhs, lhs), "Swap: rhs points to lhs."); } static if (hasElaborateAssign!T || !isAssignable!T) { if (&lhs != &rhs) { // For structs with non-trivial assignment, move memory directly ubyte[T.sizeof] t = void; auto a = (cast(ubyte*) &lhs)[0 .. T.sizeof]; auto b = (cast(ubyte*) &rhs)[0 .. T.sizeof]; t[] = a[]; a[] = b[]; b[] = t[]; } } else { //Avoid assigning overlapping arrays. Dynamic arrays are fine, because //it's their ptr and length properties which get assigned rather //than their elements when assigning them, but static arrays are value //types and therefore all of their elements get copied as part of //assigning them, which would be assigning overlapping arrays if lhs //and rhs were the same array. static if (isStaticArray!T) { if (lhs.ptr == rhs.ptr) return; } // For non-struct types, suffice to do the classic swap auto tmp = lhs; lhs = rhs; rhs = tmp; } } /// @safe unittest { // Swapping POD (plain old data) types: int a = 42, b = 34; swap(a, b); assert(a == 34 && b == 42); // Swapping structs with indirection: static struct S { int x; char c; int[] y; } S s1 = { 0, 'z', [ 1, 2 ] }; S s2 = { 42, 'a', [ 4, 6 ] }; swap(s1, s2); assert(s1.x == 42); assert(s1.c == 'a'); assert(s1.y == [ 4, 6 ]); assert(s2.x == 0); assert(s2.c == 'z'); assert(s2.y == [ 1, 2 ]); // Immutables cannot be swapped: immutable int imm1 = 1, imm2 = 2; static assert(!__traits(compiles, swap(imm1, imm2))); int c = imm1 + 0; int d = imm2 + 0; swap(c, d); assert(c == 2); assert(d == 1); } /// @safe unittest { // Non-copyable types can still be swapped. static struct NoCopy { this(this) { assert(0); } int n; string s; } NoCopy nc1, nc2; nc1.n = 127; nc1.s = "abc"; nc2.n = 513; nc2.s = "uvwxyz"; swap(nc1, nc2); assert(nc1.n == 513 && nc1.s == "uvwxyz"); assert(nc2.n == 127 && nc2.s == "abc"); swap(nc1, nc1); swap(nc2, nc2); assert(nc1.n == 513 && nc1.s == "uvwxyz"); assert(nc2.n == 127 && nc2.s == "abc"); // Types containing non-copyable fields can also be swapped. static struct NoCopyHolder { NoCopy noCopy; } NoCopyHolder h1, h2; h1.noCopy.n = 31; h1.noCopy.s = "abc"; h2.noCopy.n = 65; h2.noCopy.s = null; swap(h1, h2); assert(h1.noCopy.n == 65 && h1.noCopy.s == null); assert(h2.noCopy.n == 31 && h2.noCopy.s == "abc"); swap(h1, h1); swap(h2, h2); assert(h1.noCopy.n == 65 && h1.noCopy.s == null); assert(h2.noCopy.n == 31 && h2.noCopy.s == "abc"); // Const types cannot be swapped. const NoCopy const1, const2; assert(const1.n == 0 && const2.n == 0); static assert(!__traits(compiles, swap(const1, const2))); } @safe unittest { //Bug# 4789 int[1] s = [1]; swap(s, s); int[3] a = [1, 2, 3]; swap(a[1], a[2]); assert(a == [1, 3, 2]); } @safe unittest { static struct NoAssign { int i; void opAssign(NoAssign) @disable; } auto s1 = NoAssign(1); auto s2 = NoAssign(2); swap(s1, s2); assert(s1.i == 2); assert(s2.i == 1); } @safe unittest { struct S { const int i; int i2 = 2; int i3 = 3; } S s; static assert(!__traits(compiles, swap(s, s))); swap(s.i2, s.i3); assert(s.i2 == 3); assert(s.i3 == 2); } @safe unittest { //11853 import std.traits : isAssignable; alias T = Tuple!(int, double); static assert(isAssignable!T); } @safe unittest { // 12024 import std.datetime; SysTime a, b; swap(a, b); } @system unittest // 9975 { import std.exception : doesPointTo, mayPointTo; static struct S2 { union { size_t sz; string s; } } S2 a , b; a.sz = -1; assert(!doesPointTo(a, b)); assert( mayPointTo(a, b)); swap(a, b); //Note: we can catch an error here, because there is no RAII in this test import std.exception : assertThrown; void* p, pp; p = &p; assertThrown!Error(move(p)); assertThrown!Error(move(p, pp)); assertThrown!Error(swap(p, pp)); } @system unittest { static struct A { int* x; this(this) { x = new int; } } A a1, a2; swap(a1, a2); static struct B { int* x; void opAssign(B) { x = new int; } } B b1, b2; swap(b1, b2); } /// ditto void swap(T)(ref T lhs, ref T rhs) if (is(typeof(lhs.proxySwap(rhs)))) { lhs.proxySwap(rhs); } /** Swaps two elements in-place of a range `r`, specified by their indices `i1` and `i2`. Params: r = a range with swappable elements i1 = first index i2 = second index */ void swapAt(R)(auto ref R r, size_t i1, size_t i2) { static if (is(typeof(&r.swapAt))) { r.swapAt(i1, i2); } else static if (is(typeof(&r[i1]))) { swap(r[i1], r[i2]); } else { if (i1 == i2) return; auto t1 = r.moveAt(i1); auto t2 = r.moveAt(i2); r[i2] = t1; r[i1] = t2; } } /// pure @safe nothrow unittest { import std.algorithm.comparison : equal; auto a = [1, 2, 3]; a.swapAt(1, 2); assert(a.equal([1, 3, 2])); } pure @safe nothrow unittest { import std.algorithm.comparison : equal; auto a = [4, 5, 6]; a.swapAt(1, 1); assert(a.equal([4, 5, 6])); } pure @safe nothrow unittest { // test non random access ranges import std.algorithm.comparison : equal; import std.array : array; char[] b = ['a', 'b', 'c']; b.swapAt(1, 2); assert(b.equal(['a', 'c', 'b'])); int[3] c = [1, 2, 3]; c.swapAt(1, 2); assert(c.array.equal([1, 3, 2])); // opIndex returns lvalue struct RandomIndexType(T) { T payload; @property ref auto opIndex(size_t i) { return payload[i]; } } auto d = RandomIndexType!(int[])([4, 5, 6]); d.swapAt(1, 2); assert(d.payload.equal([4, 6, 5])); // custom moveAt and opIndexAssign struct RandomMoveAtType(T) { T payload; ElementType!T moveAt(size_t i) { return payload.moveAt(i); } void opIndexAssign(ElementType!T val, size_t idx) { payload[idx] = val; } } auto e = RandomMoveAtType!(int[])([7, 8, 9]); e.swapAt(1, 2); assert(e.payload.equal([7, 9, 8])); // custom swapAt struct RandomSwapAtType(T) { T payload; void swapAt(size_t i) { return payload.swapAt(i); } } auto f = RandomMoveAtType!(int[])([10, 11, 12]); swapAt(f, 1, 2); assert(f.payload.equal([10, 12, 11])); } private void swapFront(R1, R2)(R1 r1, R2 r2) if (isInputRange!R1 && isInputRange!R2) { static if (is(typeof(swap(r1.front, r2.front)))) { swap(r1.front, r2.front); } else { auto t1 = moveFront(r1), t2 = moveFront(r2); r1.front = move(t2); r2.front = move(t1); } } // swapRanges /** Swaps all elements of `r1` with successive elements in `r2`. Returns a tuple containing the remainder portions of `r1` and $(D r2) that were not swapped (one of them will be empty). The ranges may be of different types but must have the same element type and support swapping. Params: r1 = an $(REF_ALTTEXT input range, isInputRange, std,range,primitives) with swappable elements r2 = an $(REF_ALTTEXT input range, isInputRange, std,range,primitives) with swappable elements Returns: Tuple containing the remainder portions of r1 and r2 that were not swapped */ Tuple!(InputRange1, InputRange2) swapRanges(InputRange1, InputRange2)(InputRange1 r1, InputRange2 r2) if (hasSwappableElements!InputRange1 && hasSwappableElements!InputRange2 && is(ElementType!InputRange1 == ElementType!InputRange2)) { for (; !r1.empty && !r2.empty; r1.popFront(), r2.popFront()) { swap(r1.front, r2.front); } return tuple(r1, r2); } /// @safe unittest { import std.range : empty; int[] a = [ 100, 101, 102, 103 ]; int[] b = [ 0, 1, 2, 3 ]; auto c = swapRanges(a[1 .. 3], b[2 .. 4]); assert(c[0].empty && c[1].empty); assert(a == [ 100, 2, 3, 103 ]); assert(b == [ 0, 1, 101, 102 ]); } /** Initializes each element of `range` with `value`. Assumes that the elements of the range are uninitialized. This is of interest for structs that define copy constructors (for all other types, $(LREF fill) and uninitializedFill are equivalent). Params: range = An $(REF_ALTTEXT input range, isInputRange, std,range,primitives) that exposes references to its elements and has assignable elements value = Assigned to each element of range See_Also: $(LREF fill) $(LREF initializeAll) */ void uninitializedFill(Range, Value)(Range range, Value value) if (isInputRange!Range && hasLvalueElements!Range && is(typeof(range.front = value))) { import std.traits : hasElaborateAssign; alias T = ElementType!Range; static if (hasElaborateAssign!T) { import std.conv : emplaceRef; // Must construct stuff by the book for (; !range.empty; range.popFront()) emplaceRef!T(range.front, value); } else // Doesn't matter whether fill is initialized or not return fill(range, value); } /// nothrow @system unittest { import core.stdc.stdlib : malloc, free; auto s = (cast(int*) malloc(5 * int.sizeof))[0 .. 5]; uninitializedFill(s, 42); assert(s == [ 42, 42, 42, 42, 42 ]); scope(exit) free(s.ptr); }
D
/Users/kidnapper/Documents/25sprout/practice/DerivedData2/practice/Build/Intermediates/IBDesignables/Intermediates/practice.build/Debug-iphonesimulator/practice.build/Objects-normal/x86_64/Bookmark_VC.o : /Users/kidnapper/Documents/25sprout/practice/practice/Search_TPVC.swift /Users/kidnapper/Documents/25sprout/practice/practice/Article_TVC.swift /Users/kidnapper/Documents/25sprout/practice/practice/Search_TVC.swift /Users/kidnapper/Documents/25sprout/practice/practice/TabPage2_VC.swift /Users/kidnapper/Documents/25sprout/practice/practice/TabPage_VC.swift /Users/kidnapper/Documents/25sprout/practice/practice/CongressUpdate_VC.swift /Users/kidnapper/Documents/25sprout/practice/practice/Search_VC.swift /Users/kidnapper/Documents/25sprout/practice/practice/Bookmark_VC.swift /Users/kidnapper/Documents/25sprout/practice/practice/Main_VC.swift /Users/kidnapper/Documents/25sprout/practice/practice/TrailFactSheet_VC.swift /Users/kidnapper/Documents/25sprout/practice/practice/Event_VC.swift /Users/kidnapper/Documents/25sprout/practice/practice/ExpertCommentary_VC.swift /Users/kidnapper/Documents/25sprout/practice/practice/ThumbnailHeader_CRV.swift /Users/kidnapper/Downloads/RocheCIT_iOS/RocheCIT_iOS/PHCheckableTextfield.swift /Users/kidnapper/Documents/25sprout/practice/practice/AppDelegate.swift /Users/kidnapper/Downloads/RocheCIT_iOS/RocheCIT_iOS/ReferenceLabel.swift /Users/kidnapper/Downloads/RocheCIT_iOS/RocheCIT_iOS/BulletPointLabel.swift /Users/kidnapper/Downloads/RocheCIT_iOS/RocheCIT_iOS/PHMustLabel.swift /Users/kidnapper/Documents/25sprout/practice/practice/SearchTab_CVCell.swift /Users/kidnapper/Documents/25sprout/practice/practice/Reference_TVCell.swift /Users/kidnapper/Documents/25sprout/practice/practice/MayLike_TVCell.swift /Users/kidnapper/Documents/25sprout/practice/practice/ThumbnailHeader_TVCell.swift /Users/kidnapper/Documents/25sprout/practice/practice/SearchResultHeader_TVCell.swift /Users/kidnapper/Documents/25sprout/practice/practice/TrailFactSheet_TVCell.swift /Users/kidnapper/Documents/25sprout/practice/practice/SearchResult_TVCell.swift /Users/kidnapper/Documents/25sprout/practice/practice/Content_TVCell.swift /Users/kidnapper/Documents/25sprout/practice/practice/Quiz_TVCell.swift /Users/kidnapper/Documents/25sprout/practice/practice/TableViewCell.swift /Users/kidnapper/Documents/25sprout/practice/practice/SquareCollectionViewCell.swift /Users/kidnapper/Documents/25sprout/practice/practice/BannerCollectionViewCell.swift /Users/kidnapper/Documents/25sprout/practice/practice/SquareCategoryCell.swift /Users/kidnapper/Documents/25sprout/practice/practice/BannerCategoryCell.swift /Users/kidnapper/Documents/25sprout/practice/practice/TVC_extension.swift /Users/kidnapper/Documents/25sprout/practice/practice/NavigationBar.swift /Users/kidnapper/Downloads/RocheCIT_iOS/RocheCIT_iOS/NetworkManager.swift /Users/kidnapper/Downloads/RocheCIT_iOS/RocheCIT_iOS/RequestDidSendViewController.swift /Users/kidnapper/Downloads/RocheCIT_iOS/RocheCIT_iOS/LoginInvitationCodeViewController.swift /Users/kidnapper/Downloads/RocheCIT_iOS/RocheCIT_iOS/RequestInvitationCodeViewController.swift /Users/kidnapper/Downloads/RocheCIT_iOS/RocheCIT_iOS/ArticleViewController.swift /Users/kidnapper/Downloads/RocheCIT_iOS/RocheCIT_iOS/ConfirmUserDetailViewController.swift /Users/kidnapper/Documents/25sprout/practice/practice/SeeAllViewController.swift /Users/kidnapper/Downloads/RocheCIT_iOS/RocheCIT_iOS/EmailLoginViewController.swift /Users/kidnapper/Downloads/RocheCIT_iOS/RocheCIT_iOS/FirstMeetViewController.swift /Users/kidnapper/Downloads/RocheCIT_iOS/RocheCIT_iOS/ArticleContentViewController.swift /Users/kidnapper/Downloads/RocheCIT_iOS/RocheCIT_iOS/AppUtilities.swift /Users/kidnapper/Downloads/RocheCIT_iOS/RocheCIT_iOS/Extensions.swift /Users/kidnapper/Documents/25sprout/practice/practice/SearchBarVIew.swift /Users/kidnapper/Downloads/RocheCIT_iOS/RocheCIT_iOS/ArticleQuoteView.swift /Users/kidnapper/Documents/25sprout/practice/practice/selectionView.swift /Users/kidnapper/Documents/25sprout/practice/practice/SquareCategoryCollectionView.swift /Users/kidnapper/Documents/25sprout/practice/practice/BannerCategoryCollectionView.swift /Users/kidnapper/Downloads/RocheCIT_iOS/RocheCIT_iOS/ArticleIntroView.swift /Users/kidnapper/Documents/25sprout/practice/practice/SearchTabBarView.swift /Users/kidnapper/Documents/25sprout/practice/practice/pickerView.swift /Applications/Xcode_8.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/ObjectiveC.apinotesc /Applications/Xcode_8.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Dispatch.apinotesc /Applications/Xcode_8.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Foundation.apinotesc /Applications/Xcode_8.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreGraphics.apinotesc /Applications/Xcode_8.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/UIKit.apinotesc /Applications/Xcode_8.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreText.apinotesc /Users/kidnapper/Documents/25sprout/practice/DerivedData2/practice/Build/Intermediates/IBDesignables/Products/Debug-iphonesimulator/TabPageViewController.framework/Modules/TabPageViewController.swiftmodule/x86_64.swiftmodule /Applications/Xcode_8.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/ObjectiveC.swiftmodule /Applications/Xcode_8.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreImage.swiftmodule /Applications/Xcode_8.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/QuartzCore.swiftmodule /Applications/Xcode_8.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Dispatch.swiftmodule /Applications/Xcode_8.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Darwin.swiftmodule /Applications/Xcode_8.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Foundation.swiftmodule /Applications/Xcode_8.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreGraphics.swiftmodule /Applications/Xcode_8.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Swift.swiftmodule /Applications/Xcode_8.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/UIKit.swiftmodule /Applications/Xcode_8.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/SwiftOnoneSupport.swiftmodule /Users/kidnapper/Documents/25sprout/practice/Pods/FirebaseInstanceID/Frameworks/FirebaseInstanceID.framework/Headers/FIRInstanceID.h /Users/kidnapper/Documents/25sprout/practice/Pods/FirebaseInstanceID/Frameworks/FirebaseInstanceID.framework/Headers/FirebaseInstanceID.h /Users/kidnapper/Documents/25sprout/practice/Pods/FirebaseCore/Frameworks/FirebaseCore.framework/Headers/FirebaseCore.h /Users/kidnapper/Documents/25sprout/practice/Pods/Firebase/Core/Sources/Firebase.h /Users/kidnapper/Documents/25sprout/practice/Pods/FirebaseAnalytics/Frameworks/FirebaseAnalytics.framework/Headers/FIRAnalytics+AppDelegate.h /Users/kidnapper/Documents/25sprout/practice/Pods/FirebaseCore/Frameworks/FirebaseCore.framework/Headers/FIRLoggerLevel.h /Users/kidnapper/Documents/25sprout/practice/Pods/FirebaseCore/Frameworks/FirebaseCore.framework/Headers/FIRConfiguration.h /Users/kidnapper/Documents/25sprout/practice/Pods/FirebaseAnalytics/Frameworks/FirebaseAnalytics.framework/Headers/FIRConfiguration.h /Users/kidnapper/Documents/25sprout/practice/Pods/FirebaseCore/Frameworks/FirebaseCore.framework/Headers/FIRAnalyticsConfiguration.h /Users/kidnapper/Documents/25sprout/practice/Pods/FirebaseAnalytics/Frameworks/FirebaseAnalytics.framework/Headers/FIRAnalyticsConfiguration.h /Users/kidnapper/Documents/25sprout/practice/Pods/FirebaseCore/Frameworks/FirebaseCore.framework/Headers/FIRApp.h /Users/kidnapper/Documents/25sprout/practice/Pods/FirebaseAnalytics/Frameworks/FirebaseAnalytics.framework/Headers/FIRApp.h /Users/kidnapper/Documents/25sprout/practice/Pods/FirebaseAnalytics/Frameworks/FirebaseAnalytics.framework/Headers/FIRAnalytics.h /Users/kidnapper/Documents/25sprout/practice/Pods/FirebaseAnalytics/Frameworks/FirebaseAnalytics.framework/Headers/FirebaseAnalytics.h /Users/kidnapper/Documents/25sprout/practice/Pods/FirebaseAnalytics/Frameworks/FirebaseAnalytics.framework/Headers/FIRParameterNames.h /Users/kidnapper/Documents/25sprout/practice/Pods/FirebaseAnalytics/Frameworks/FirebaseAnalytics.framework/Headers/FIREventNames.h /Users/kidnapper/Documents/25sprout/practice/Pods/FirebaseAnalytics/Frameworks/FirebaseAnalytics.framework/Headers/FIRUserPropertyNames.h /Users/kidnapper/Documents/25sprout/practice/Pods/FirebaseCore/Frameworks/FirebaseCore.framework/Headers/FIROptions.h /Users/kidnapper/Documents/25sprout/practice/Pods/FirebaseAnalytics/Frameworks/FirebaseAnalytics.framework/Headers/FIROptions.h /Users/kidnapper/Documents/25sprout/practice/Pods/FirebaseCore/Frameworks/FirebaseCore.framework/Headers/FIRCoreSwiftNameSupport.h /Users/kidnapper/Documents/25sprout/practice/Pods/FirebaseAnalytics/Frameworks/FirebaseAnalytics.framework/Headers/FIRAnalyticsSwiftNameSupport.h /Users/kidnapper/Documents/25sprout/practice/Pods/Firebase/Core/Sources/module.modulemap /Users/kidnapper/Documents/25sprout/practice/Pods/FirebaseInstanceID/Frameworks/FirebaseInstanceID.framework/Modules/module.modulemap /Users/kidnapper/Documents/25sprout/practice/Pods/FirebaseCore/Frameworks/FirebaseCore.framework/Modules/module.modulemap /Users/kidnapper/Documents/25sprout/practice/Pods/FirebaseAnalytics/Frameworks/FirebaseAnalytics.framework/Modules/module.modulemap /Users/kidnapper/Documents/25sprout/practice/DerivedData2/practice/Build/Intermediates/IBDesignables/Intermediates/practice.build/Debug-iphonesimulator/practice.build/Objects-normal/x86_64/Bookmark_VC~partial.swiftmodule : /Users/kidnapper/Documents/25sprout/practice/practice/Search_TPVC.swift /Users/kidnapper/Documents/25sprout/practice/practice/Article_TVC.swift /Users/kidnapper/Documents/25sprout/practice/practice/Search_TVC.swift /Users/kidnapper/Documents/25sprout/practice/practice/TabPage2_VC.swift /Users/kidnapper/Documents/25sprout/practice/practice/TabPage_VC.swift /Users/kidnapper/Documents/25sprout/practice/practice/CongressUpdate_VC.swift /Users/kidnapper/Documents/25sprout/practice/practice/Search_VC.swift /Users/kidnapper/Documents/25sprout/practice/practice/Bookmark_VC.swift /Users/kidnapper/Documents/25sprout/practice/practice/Main_VC.swift /Users/kidnapper/Documents/25sprout/practice/practice/TrailFactSheet_VC.swift /Users/kidnapper/Documents/25sprout/practice/practice/Event_VC.swift /Users/kidnapper/Documents/25sprout/practice/practice/ExpertCommentary_VC.swift /Users/kidnapper/Documents/25sprout/practice/practice/ThumbnailHeader_CRV.swift /Users/kidnapper/Downloads/RocheCIT_iOS/RocheCIT_iOS/PHCheckableTextfield.swift /Users/kidnapper/Documents/25sprout/practice/practice/AppDelegate.swift /Users/kidnapper/Downloads/RocheCIT_iOS/RocheCIT_iOS/ReferenceLabel.swift /Users/kidnapper/Downloads/RocheCIT_iOS/RocheCIT_iOS/BulletPointLabel.swift /Users/kidnapper/Downloads/RocheCIT_iOS/RocheCIT_iOS/PHMustLabel.swift /Users/kidnapper/Documents/25sprout/practice/practice/SearchTab_CVCell.swift /Users/kidnapper/Documents/25sprout/practice/practice/Reference_TVCell.swift /Users/kidnapper/Documents/25sprout/practice/practice/MayLike_TVCell.swift /Users/kidnapper/Documents/25sprout/practice/practice/ThumbnailHeader_TVCell.swift /Users/kidnapper/Documents/25sprout/practice/practice/SearchResultHeader_TVCell.swift /Users/kidnapper/Documents/25sprout/practice/practice/TrailFactSheet_TVCell.swift /Users/kidnapper/Documents/25sprout/practice/practice/SearchResult_TVCell.swift /Users/kidnapper/Documents/25sprout/practice/practice/Content_TVCell.swift /Users/kidnapper/Documents/25sprout/practice/practice/Quiz_TVCell.swift /Users/kidnapper/Documents/25sprout/practice/practice/TableViewCell.swift /Users/kidnapper/Documents/25sprout/practice/practice/SquareCollectionViewCell.swift /Users/kidnapper/Documents/25sprout/practice/practice/BannerCollectionViewCell.swift /Users/kidnapper/Documents/25sprout/practice/practice/SquareCategoryCell.swift /Users/kidnapper/Documents/25sprout/practice/practice/BannerCategoryCell.swift /Users/kidnapper/Documents/25sprout/practice/practice/TVC_extension.swift /Users/kidnapper/Documents/25sprout/practice/practice/NavigationBar.swift /Users/kidnapper/Downloads/RocheCIT_iOS/RocheCIT_iOS/NetworkManager.swift /Users/kidnapper/Downloads/RocheCIT_iOS/RocheCIT_iOS/RequestDidSendViewController.swift /Users/kidnapper/Downloads/RocheCIT_iOS/RocheCIT_iOS/LoginInvitationCodeViewController.swift /Users/kidnapper/Downloads/RocheCIT_iOS/RocheCIT_iOS/RequestInvitationCodeViewController.swift /Users/kidnapper/Downloads/RocheCIT_iOS/RocheCIT_iOS/ArticleViewController.swift /Users/kidnapper/Downloads/RocheCIT_iOS/RocheCIT_iOS/ConfirmUserDetailViewController.swift /Users/kidnapper/Documents/25sprout/practice/practice/SeeAllViewController.swift /Users/kidnapper/Downloads/RocheCIT_iOS/RocheCIT_iOS/EmailLoginViewController.swift /Users/kidnapper/Downloads/RocheCIT_iOS/RocheCIT_iOS/FirstMeetViewController.swift /Users/kidnapper/Downloads/RocheCIT_iOS/RocheCIT_iOS/ArticleContentViewController.swift /Users/kidnapper/Downloads/RocheCIT_iOS/RocheCIT_iOS/AppUtilities.swift /Users/kidnapper/Downloads/RocheCIT_iOS/RocheCIT_iOS/Extensions.swift /Users/kidnapper/Documents/25sprout/practice/practice/SearchBarVIew.swift /Users/kidnapper/Downloads/RocheCIT_iOS/RocheCIT_iOS/ArticleQuoteView.swift /Users/kidnapper/Documents/25sprout/practice/practice/selectionView.swift /Users/kidnapper/Documents/25sprout/practice/practice/SquareCategoryCollectionView.swift /Users/kidnapper/Documents/25sprout/practice/practice/BannerCategoryCollectionView.swift /Users/kidnapper/Downloads/RocheCIT_iOS/RocheCIT_iOS/ArticleIntroView.swift /Users/kidnapper/Documents/25sprout/practice/practice/SearchTabBarView.swift /Users/kidnapper/Documents/25sprout/practice/practice/pickerView.swift /Applications/Xcode_8.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/ObjectiveC.apinotesc /Applications/Xcode_8.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Dispatch.apinotesc /Applications/Xcode_8.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Foundation.apinotesc /Applications/Xcode_8.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreGraphics.apinotesc /Applications/Xcode_8.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/UIKit.apinotesc /Applications/Xcode_8.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreText.apinotesc /Users/kidnapper/Documents/25sprout/practice/DerivedData2/practice/Build/Intermediates/IBDesignables/Products/Debug-iphonesimulator/TabPageViewController.framework/Modules/TabPageViewController.swiftmodule/x86_64.swiftmodule /Applications/Xcode_8.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/ObjectiveC.swiftmodule /Applications/Xcode_8.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreImage.swiftmodule /Applications/Xcode_8.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/QuartzCore.swiftmodule /Applications/Xcode_8.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Dispatch.swiftmodule /Applications/Xcode_8.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Darwin.swiftmodule /Applications/Xcode_8.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Foundation.swiftmodule /Applications/Xcode_8.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreGraphics.swiftmodule /Applications/Xcode_8.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Swift.swiftmodule /Applications/Xcode_8.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/UIKit.swiftmodule /Applications/Xcode_8.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/SwiftOnoneSupport.swiftmodule /Users/kidnapper/Documents/25sprout/practice/Pods/FirebaseInstanceID/Frameworks/FirebaseInstanceID.framework/Headers/FIRInstanceID.h /Users/kidnapper/Documents/25sprout/practice/Pods/FirebaseInstanceID/Frameworks/FirebaseInstanceID.framework/Headers/FirebaseInstanceID.h /Users/kidnapper/Documents/25sprout/practice/Pods/FirebaseCore/Frameworks/FirebaseCore.framework/Headers/FirebaseCore.h /Users/kidnapper/Documents/25sprout/practice/Pods/Firebase/Core/Sources/Firebase.h /Users/kidnapper/Documents/25sprout/practice/Pods/FirebaseAnalytics/Frameworks/FirebaseAnalytics.framework/Headers/FIRAnalytics+AppDelegate.h /Users/kidnapper/Documents/25sprout/practice/Pods/FirebaseCore/Frameworks/FirebaseCore.framework/Headers/FIRLoggerLevel.h /Users/kidnapper/Documents/25sprout/practice/Pods/FirebaseCore/Frameworks/FirebaseCore.framework/Headers/FIRConfiguration.h /Users/kidnapper/Documents/25sprout/practice/Pods/FirebaseAnalytics/Frameworks/FirebaseAnalytics.framework/Headers/FIRConfiguration.h /Users/kidnapper/Documents/25sprout/practice/Pods/FirebaseCore/Frameworks/FirebaseCore.framework/Headers/FIRAnalyticsConfiguration.h /Users/kidnapper/Documents/25sprout/practice/Pods/FirebaseAnalytics/Frameworks/FirebaseAnalytics.framework/Headers/FIRAnalyticsConfiguration.h /Users/kidnapper/Documents/25sprout/practice/Pods/FirebaseCore/Frameworks/FirebaseCore.framework/Headers/FIRApp.h /Users/kidnapper/Documents/25sprout/practice/Pods/FirebaseAnalytics/Frameworks/FirebaseAnalytics.framework/Headers/FIRApp.h /Users/kidnapper/Documents/25sprout/practice/Pods/FirebaseAnalytics/Frameworks/FirebaseAnalytics.framework/Headers/FIRAnalytics.h /Users/kidnapper/Documents/25sprout/practice/Pods/FirebaseAnalytics/Frameworks/FirebaseAnalytics.framework/Headers/FirebaseAnalytics.h /Users/kidnapper/Documents/25sprout/practice/Pods/FirebaseAnalytics/Frameworks/FirebaseAnalytics.framework/Headers/FIRParameterNames.h /Users/kidnapper/Documents/25sprout/practice/Pods/FirebaseAnalytics/Frameworks/FirebaseAnalytics.framework/Headers/FIREventNames.h /Users/kidnapper/Documents/25sprout/practice/Pods/FirebaseAnalytics/Frameworks/FirebaseAnalytics.framework/Headers/FIRUserPropertyNames.h /Users/kidnapper/Documents/25sprout/practice/Pods/FirebaseCore/Frameworks/FirebaseCore.framework/Headers/FIROptions.h /Users/kidnapper/Documents/25sprout/practice/Pods/FirebaseAnalytics/Frameworks/FirebaseAnalytics.framework/Headers/FIROptions.h /Users/kidnapper/Documents/25sprout/practice/Pods/FirebaseCore/Frameworks/FirebaseCore.framework/Headers/FIRCoreSwiftNameSupport.h /Users/kidnapper/Documents/25sprout/practice/Pods/FirebaseAnalytics/Frameworks/FirebaseAnalytics.framework/Headers/FIRAnalyticsSwiftNameSupport.h /Users/kidnapper/Documents/25sprout/practice/Pods/Firebase/Core/Sources/module.modulemap /Users/kidnapper/Documents/25sprout/practice/Pods/FirebaseInstanceID/Frameworks/FirebaseInstanceID.framework/Modules/module.modulemap /Users/kidnapper/Documents/25sprout/practice/Pods/FirebaseCore/Frameworks/FirebaseCore.framework/Modules/module.modulemap /Users/kidnapper/Documents/25sprout/practice/Pods/FirebaseAnalytics/Frameworks/FirebaseAnalytics.framework/Modules/module.modulemap /Users/kidnapper/Documents/25sprout/practice/DerivedData2/practice/Build/Intermediates/IBDesignables/Intermediates/practice.build/Debug-iphonesimulator/practice.build/Objects-normal/x86_64/Bookmark_VC~partial.swiftdoc : /Users/kidnapper/Documents/25sprout/practice/practice/Search_TPVC.swift /Users/kidnapper/Documents/25sprout/practice/practice/Article_TVC.swift /Users/kidnapper/Documents/25sprout/practice/practice/Search_TVC.swift /Users/kidnapper/Documents/25sprout/practice/practice/TabPage2_VC.swift /Users/kidnapper/Documents/25sprout/practice/practice/TabPage_VC.swift /Users/kidnapper/Documents/25sprout/practice/practice/CongressUpdate_VC.swift /Users/kidnapper/Documents/25sprout/practice/practice/Search_VC.swift /Users/kidnapper/Documents/25sprout/practice/practice/Bookmark_VC.swift /Users/kidnapper/Documents/25sprout/practice/practice/Main_VC.swift /Users/kidnapper/Documents/25sprout/practice/practice/TrailFactSheet_VC.swift /Users/kidnapper/Documents/25sprout/practice/practice/Event_VC.swift /Users/kidnapper/Documents/25sprout/practice/practice/ExpertCommentary_VC.swift /Users/kidnapper/Documents/25sprout/practice/practice/ThumbnailHeader_CRV.swift /Users/kidnapper/Downloads/RocheCIT_iOS/RocheCIT_iOS/PHCheckableTextfield.swift /Users/kidnapper/Documents/25sprout/practice/practice/AppDelegate.swift /Users/kidnapper/Downloads/RocheCIT_iOS/RocheCIT_iOS/ReferenceLabel.swift /Users/kidnapper/Downloads/RocheCIT_iOS/RocheCIT_iOS/BulletPointLabel.swift /Users/kidnapper/Downloads/RocheCIT_iOS/RocheCIT_iOS/PHMustLabel.swift /Users/kidnapper/Documents/25sprout/practice/practice/SearchTab_CVCell.swift /Users/kidnapper/Documents/25sprout/practice/practice/Reference_TVCell.swift /Users/kidnapper/Documents/25sprout/practice/practice/MayLike_TVCell.swift /Users/kidnapper/Documents/25sprout/practice/practice/ThumbnailHeader_TVCell.swift /Users/kidnapper/Documents/25sprout/practice/practice/SearchResultHeader_TVCell.swift /Users/kidnapper/Documents/25sprout/practice/practice/TrailFactSheet_TVCell.swift /Users/kidnapper/Documents/25sprout/practice/practice/SearchResult_TVCell.swift /Users/kidnapper/Documents/25sprout/practice/practice/Content_TVCell.swift /Users/kidnapper/Documents/25sprout/practice/practice/Quiz_TVCell.swift /Users/kidnapper/Documents/25sprout/practice/practice/TableViewCell.swift /Users/kidnapper/Documents/25sprout/practice/practice/SquareCollectionViewCell.swift /Users/kidnapper/Documents/25sprout/practice/practice/BannerCollectionViewCell.swift /Users/kidnapper/Documents/25sprout/practice/practice/SquareCategoryCell.swift /Users/kidnapper/Documents/25sprout/practice/practice/BannerCategoryCell.swift /Users/kidnapper/Documents/25sprout/practice/practice/TVC_extension.swift /Users/kidnapper/Documents/25sprout/practice/practice/NavigationBar.swift /Users/kidnapper/Downloads/RocheCIT_iOS/RocheCIT_iOS/NetworkManager.swift /Users/kidnapper/Downloads/RocheCIT_iOS/RocheCIT_iOS/RequestDidSendViewController.swift /Users/kidnapper/Downloads/RocheCIT_iOS/RocheCIT_iOS/LoginInvitationCodeViewController.swift /Users/kidnapper/Downloads/RocheCIT_iOS/RocheCIT_iOS/RequestInvitationCodeViewController.swift /Users/kidnapper/Downloads/RocheCIT_iOS/RocheCIT_iOS/ArticleViewController.swift /Users/kidnapper/Downloads/RocheCIT_iOS/RocheCIT_iOS/ConfirmUserDetailViewController.swift /Users/kidnapper/Documents/25sprout/practice/practice/SeeAllViewController.swift /Users/kidnapper/Downloads/RocheCIT_iOS/RocheCIT_iOS/EmailLoginViewController.swift /Users/kidnapper/Downloads/RocheCIT_iOS/RocheCIT_iOS/FirstMeetViewController.swift /Users/kidnapper/Downloads/RocheCIT_iOS/RocheCIT_iOS/ArticleContentViewController.swift /Users/kidnapper/Downloads/RocheCIT_iOS/RocheCIT_iOS/AppUtilities.swift /Users/kidnapper/Downloads/RocheCIT_iOS/RocheCIT_iOS/Extensions.swift /Users/kidnapper/Documents/25sprout/practice/practice/SearchBarVIew.swift /Users/kidnapper/Downloads/RocheCIT_iOS/RocheCIT_iOS/ArticleQuoteView.swift /Users/kidnapper/Documents/25sprout/practice/practice/selectionView.swift /Users/kidnapper/Documents/25sprout/practice/practice/SquareCategoryCollectionView.swift /Users/kidnapper/Documents/25sprout/practice/practice/BannerCategoryCollectionView.swift /Users/kidnapper/Downloads/RocheCIT_iOS/RocheCIT_iOS/ArticleIntroView.swift /Users/kidnapper/Documents/25sprout/practice/practice/SearchTabBarView.swift /Users/kidnapper/Documents/25sprout/practice/practice/pickerView.swift /Applications/Xcode_8.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/ObjectiveC.apinotesc /Applications/Xcode_8.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Dispatch.apinotesc /Applications/Xcode_8.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Foundation.apinotesc /Applications/Xcode_8.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreGraphics.apinotesc /Applications/Xcode_8.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/UIKit.apinotesc /Applications/Xcode_8.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreText.apinotesc /Users/kidnapper/Documents/25sprout/practice/DerivedData2/practice/Build/Intermediates/IBDesignables/Products/Debug-iphonesimulator/TabPageViewController.framework/Modules/TabPageViewController.swiftmodule/x86_64.swiftmodule /Applications/Xcode_8.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/ObjectiveC.swiftmodule /Applications/Xcode_8.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreImage.swiftmodule /Applications/Xcode_8.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/QuartzCore.swiftmodule /Applications/Xcode_8.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Dispatch.swiftmodule /Applications/Xcode_8.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Darwin.swiftmodule /Applications/Xcode_8.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Foundation.swiftmodule /Applications/Xcode_8.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreGraphics.swiftmodule /Applications/Xcode_8.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Swift.swiftmodule /Applications/Xcode_8.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/UIKit.swiftmodule /Applications/Xcode_8.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/SwiftOnoneSupport.swiftmodule /Users/kidnapper/Documents/25sprout/practice/Pods/FirebaseInstanceID/Frameworks/FirebaseInstanceID.framework/Headers/FIRInstanceID.h /Users/kidnapper/Documents/25sprout/practice/Pods/FirebaseInstanceID/Frameworks/FirebaseInstanceID.framework/Headers/FirebaseInstanceID.h /Users/kidnapper/Documents/25sprout/practice/Pods/FirebaseCore/Frameworks/FirebaseCore.framework/Headers/FirebaseCore.h /Users/kidnapper/Documents/25sprout/practice/Pods/Firebase/Core/Sources/Firebase.h /Users/kidnapper/Documents/25sprout/practice/Pods/FirebaseAnalytics/Frameworks/FirebaseAnalytics.framework/Headers/FIRAnalytics+AppDelegate.h /Users/kidnapper/Documents/25sprout/practice/Pods/FirebaseCore/Frameworks/FirebaseCore.framework/Headers/FIRLoggerLevel.h /Users/kidnapper/Documents/25sprout/practice/Pods/FirebaseCore/Frameworks/FirebaseCore.framework/Headers/FIRConfiguration.h /Users/kidnapper/Documents/25sprout/practice/Pods/FirebaseAnalytics/Frameworks/FirebaseAnalytics.framework/Headers/FIRConfiguration.h /Users/kidnapper/Documents/25sprout/practice/Pods/FirebaseCore/Frameworks/FirebaseCore.framework/Headers/FIRAnalyticsConfiguration.h /Users/kidnapper/Documents/25sprout/practice/Pods/FirebaseAnalytics/Frameworks/FirebaseAnalytics.framework/Headers/FIRAnalyticsConfiguration.h /Users/kidnapper/Documents/25sprout/practice/Pods/FirebaseCore/Frameworks/FirebaseCore.framework/Headers/FIRApp.h /Users/kidnapper/Documents/25sprout/practice/Pods/FirebaseAnalytics/Frameworks/FirebaseAnalytics.framework/Headers/FIRApp.h /Users/kidnapper/Documents/25sprout/practice/Pods/FirebaseAnalytics/Frameworks/FirebaseAnalytics.framework/Headers/FIRAnalytics.h /Users/kidnapper/Documents/25sprout/practice/Pods/FirebaseAnalytics/Frameworks/FirebaseAnalytics.framework/Headers/FirebaseAnalytics.h /Users/kidnapper/Documents/25sprout/practice/Pods/FirebaseAnalytics/Frameworks/FirebaseAnalytics.framework/Headers/FIRParameterNames.h /Users/kidnapper/Documents/25sprout/practice/Pods/FirebaseAnalytics/Frameworks/FirebaseAnalytics.framework/Headers/FIREventNames.h /Users/kidnapper/Documents/25sprout/practice/Pods/FirebaseAnalytics/Frameworks/FirebaseAnalytics.framework/Headers/FIRUserPropertyNames.h /Users/kidnapper/Documents/25sprout/practice/Pods/FirebaseCore/Frameworks/FirebaseCore.framework/Headers/FIROptions.h /Users/kidnapper/Documents/25sprout/practice/Pods/FirebaseAnalytics/Frameworks/FirebaseAnalytics.framework/Headers/FIROptions.h /Users/kidnapper/Documents/25sprout/practice/Pods/FirebaseCore/Frameworks/FirebaseCore.framework/Headers/FIRCoreSwiftNameSupport.h /Users/kidnapper/Documents/25sprout/practice/Pods/FirebaseAnalytics/Frameworks/FirebaseAnalytics.framework/Headers/FIRAnalyticsSwiftNameSupport.h /Users/kidnapper/Documents/25sprout/practice/Pods/Firebase/Core/Sources/module.modulemap /Users/kidnapper/Documents/25sprout/practice/Pods/FirebaseInstanceID/Frameworks/FirebaseInstanceID.framework/Modules/module.modulemap /Users/kidnapper/Documents/25sprout/practice/Pods/FirebaseCore/Frameworks/FirebaseCore.framework/Modules/module.modulemap /Users/kidnapper/Documents/25sprout/practice/Pods/FirebaseAnalytics/Frameworks/FirebaseAnalytics.framework/Modules/module.modulemap
D
/takaya_workspace/self_study/rust_practice/actix-gcd/target/debug/build/backtrace-50bfdade05149b95/build_script_build-50bfdade05149b95: /root/.cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.64/build.rs /takaya_workspace/self_study/rust_practice/actix-gcd/target/debug/build/backtrace-50bfdade05149b95/build_script_build-50bfdade05149b95.d: /root/.cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.64/build.rs /root/.cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.64/build.rs:
D
/** Win32 driver implementation using WSAAsyncSelect Copyright: © 2012-2014 Sönke Ludwig Authors: Sönke Ludwig, Leonid Kramer License: Subject to the terms of the MIT license, as written in the included LICENSE.txt file. */ module vibe.core.drivers.win32; version(VibeWin32Driver) { import vibe.core.core; import vibe.core.driver; import vibe.core.drivers.timerqueue; import vibe.core.drivers.utils; import vibe.core.log; import vibe.inet.url; import vibe.internal.win32; import vibe.utils.array; import vibe.utils.hashmap; import core.atomic; import core.sync.mutex; import core.sys.windows.windows; import core.time; import core.thread; import std.algorithm; import std.conv; import std.c.windows.windows; import std.c.windows.winsock; import std.datetime; import std.exception; import std.string : lastIndexOf; import std.typecons; import std.utf; enum WM_USER_SIGNAL = WM_USER+101; enum WM_USER_SOCKET = WM_USER+102; pragma(lib, "wsock32"); pragma(lib, "ws2_32"); /******************************************************************************/ /* class Win32EventDriver */ /******************************************************************************/ final class Win32EventDriver : EventDriver { import std.container : Array, BinaryHeap, heapify; import std.datetime : Clock; private { HWND m_hwnd; DWORD m_tid; DriverCore m_core; bool m_exit = false; SocketEventHandler[SOCKET] m_socketHandlers; HANDLE[] m_registeredEvents; HANDLE m_fileCompletionEvent; bool[Win32TCPConnection] m_fileWriters; TimerQueue!TimerInfo m_timers; } this(DriverCore core) { setupWindowClass(); m_core = core; m_tid = GetCurrentThreadId(); m_hwnd = CreateWindowA("VibeWin32MessageWindow", "VibeWin32MessageWindow", 0, 0,0,0,0, HWND_MESSAGE,null,null,null); SetWindowLongPtrA(m_hwnd, GWLP_USERDATA, cast(ULONG_PTR)cast(void*)this); assert( cast(Win32EventDriver)cast(void*)GetWindowLongPtrA(m_hwnd, GWLP_USERDATA) == this ); WSADATA wd; enforce(WSAStartup(0x0202, &wd) == 0, "Failed to initialize WinSock"); m_fileCompletionEvent = CreateEventW(null, false, false, null); m_registeredEvents ~= m_fileCompletionEvent; } ~this() { // DestroyWindow(m_hwnd); } int runEventLoop() { m_exit = false; while( !m_exit && haveEvents() ) runEventLoopOnce(); return 0; } int runEventLoopOnce() { doProcessEvents(INFINITE); return 0; } bool processEvents() { return doProcessEvents(0); } bool doProcessEvents(uint timeout_msecs) { assert(m_tid == GetCurrentThreadId()); waitForEvents(timeout_msecs); processTimers(); MSG msg; //uint cnt = 0; while (PeekMessageW(&msg, null, 0, 0, PM_REMOVE)) { if( msg.message == WM_QUIT ) return false; if( msg.message == WM_USER_SIGNAL ) msg.hwnd = m_hwnd; TranslateMessage(&msg); DispatchMessageW(&msg); // process timers every now and then so that they don't get stuck //if (++cnt % 10 == 0) processTimers(); } if (timeout_msecs != 0) m_core.notifyIdle(); return true; } private bool haveEvents() { version(VibePartialAutoExit) return !m_fileWriters.byKey.empty || !m_socketHandlers.byKey.empty; else return true; } private void waitForEvents(uint timeout_msecs) { // if timers are pending, limit the wait time to the first timer timeout auto next_timer = m_timers.getFirstTimeout(); if (timeout_msecs > 0 && next_timer != SysTime.max) { auto now = Clock.currStdTime(); auto timer_timeout = (next_timer.stdTime - now) / 10_000; if (timeout_msecs == INFINITE || timer_timeout < timeout_msecs) timeout_msecs = cast(uint)(timer_timeout < 0 ? 0 : timer_timeout > uint.max ? uint.max : timer_timeout); } auto ret = MsgWaitForMultipleObjectsEx(cast(DWORD)m_registeredEvents.length, m_registeredEvents.ptr, timeout_msecs, QS_ALLEVENTS, MWMO_ALERTABLE|MWMO_INPUTAVAILABLE); if( ret == WAIT_OBJECT_0 ){ Win32TCPConnection[] to_remove; foreach( fw; m_fileWriters.byKey ) if( fw.testFileWritten() ) to_remove ~= fw; foreach( fw; to_remove ) m_fileWriters.remove(fw); } } private void processTimers() { // process all timers that have expired up to now auto now = Clock.currTime(UTC()); m_timers.consumeTimeouts(now, (timer, periodic, ref data) { Task owner = data.owner; auto callback = data.callback; if (!periodic) releaseTimer(timer); if (owner && owner.running) m_core.resumeTask(owner); if (callback) runTask(callback); }); } void exitEventLoop() { m_exit = true; PostThreadMessageW(m_tid, WM_QUIT, 0, 0); } Win32FileStream openFile(Path path, FileMode mode) { assert(m_tid == GetCurrentThreadId()); return new Win32FileStream(m_core, path, mode); } DirectoryWatcher watchDirectory(Path path, bool recursive) { assert(m_tid == GetCurrentThreadId()); return new Win32DirectoryWatcher(m_core, path, recursive); } NetworkAddress resolveHost(string host, ushort family = AF_UNSPEC, bool use_dns = true) { static immutable ushort[] addrfamilies = [AF_INET, AF_INET6]; NetworkAddress addr; foreach( af; addrfamilies ){ if( family != af && family != AF_UNSPEC ) continue; addr.family = af; INT addrlen = addr.sockAddrLen; auto ret = WSAStringToAddressW(toUTFz!(immutable(wchar)*)(host), af, null, addr.sockAddr, &addrlen); if( ret != 0 ) continue; assert(addrlen == addr.sockAddrLen); return addr; } enforce(use_dns, "Invalid IP address string: "~host); LookupStatus status; status.task = Task.getThis(); status.driver = this; status.finished = false; WSAOVERLAPPEDX overlapped; overlapped.Internal = 0; overlapped.InternalHigh = 0; overlapped.hEvent = cast(HANDLE)cast(void*)&status; version(none){ // Windows 8+ void* aif; ADDRINFOEXW addr_hint; ADDRINFOEXW* addr_ret; addr_hint.ai_family = family; addr_hint.ai_socktype = SOCK_STREAM; addr_hint.ai_protocol = IPPROTO_TCP; enforce(GetAddrInfoExW(toUTFz!(immutable(wchar)*)(host), null, NS_DNS, null, &addr_hint, &addr_ret, null, &overlapped, &onDnsResult, null) == 0, "Failed to lookup host"); while( !status.finished ) m_core.yieldForEvent(); enforce(!status.error, "Failed to lookup host: "~to!string(status.error)); aif = addr_ret; addr.family = cast(ubyte)addr_ret.ai_family; switch(addr.family){ default: assert(false, "Invalid address family returned from host lookup."); case AF_INET: addr.sockAddrInet4 = *cast(sockaddr_in*)addr_ret.ai_addr; break; case AF_INET6: addr.sockAddrInet6 = *cast(sockaddr_in6*)addr_ret.ai_addr; break; } FreeAddrInfoW(addr_ret); } else { auto he = gethostbyname(toUTFz!(immutable(char)*)(host)); socketEnforce(he !is null, "Failed to look up host "~host); addr.family = he.h_addrtype; switch(addr.family){ default: assert(false, "Invalid address family returned from host lookup."); case AF_INET: addr.sockAddrInet4.sin_addr = *cast(in_addr*)he.h_addr_list[0]; break; case AF_INET6: addr.sockAddrInet6.sin6_addr = *cast(in6_addr*)he.h_addr_list[0]; break; } } return addr; } Win32TCPConnection connectTCP(NetworkAddress addr) { assert(m_tid == GetCurrentThreadId()); auto sock = WSASocketW(AF_INET, SOCK_STREAM, IPPROTO_TCP, null, 0, WSA_FLAG_OVERLAPPED); socketEnforce(sock != INVALID_SOCKET, "Failed to create socket"); NetworkAddress bind_addr; bind_addr.family = addr.family; if (addr.family == AF_INET) bind_addr.sockAddrInet4.sin_addr.s_addr = 0; else bind_addr.sockAddrInet6.sin6_addr.s6_addr[] = 0; socketEnforce(bind(sock, bind_addr.sockAddr, bind_addr.sockAddrLen) == 0, "Failed to bind socket"); auto conn = new Win32TCPConnection(this, sock, addr); conn.connect(addr); return conn; } Win32TCPListener listenTCP(ushort port, void delegate(TCPConnection conn) conn_callback, string bind_address, TCPListenOptions options) { assert(m_tid == GetCurrentThreadId()); auto addr = resolveHost(bind_address); addr.port = port; auto sock = WSASocketW(AF_INET, SOCK_STREAM, IPPROTO_TCP, null, 0, WSA_FLAG_OVERLAPPED); socketEnforce(sock != INVALID_SOCKET, "Failed to create socket"); socketEnforce(bind(sock, addr.sockAddr, addr.sockAddrLen) == 0, "Failed to bind listening socket"); socketEnforce(listen(sock, 128) == 0, "Failed to listen"); // TODO: support TCPListenOptions.distribute return new Win32TCPListener(this, sock, conn_callback, options); } Win32UDPConnection listenUDP(ushort port, string bind_address = "0.0.0.0") { assert(m_tid == GetCurrentThreadId()); /*auto addr = resolveHost(bind_address); addr.port = port;*/ assert(false); } Win32ManualEvent createManualEvent() { assert(m_tid == GetCurrentThreadId()); return new Win32ManualEvent(this); } FileDescriptorEvent createFileDescriptorEvent(int file_descriptor, FileDescriptorEvent.Trigger events) { assert(false, "Not implemented."); } size_t createTimer(void delegate() callback) { return m_timers.create(TimerInfo(callback)); } void acquireTimer(size_t timer_id) { m_timers.getUserData(timer_id).refCount++; } void releaseTimer(size_t timer_id) { if (!--m_timers.getUserData(timer_id).refCount) m_timers.destroy(timer_id); } bool isTimerPending(size_t timer_id) { return m_timers.isPending(timer_id); } void rearmTimer(size_t timer_id, Duration dur, bool periodic) { if (!m_timers.isPending(timer_id)) acquireTimer(timer_id); m_timers.schedule(timer_id, dur, periodic); } void stopTimer(size_t timer_id) { if (m_timers.isPending(timer_id)) releaseTimer(timer_id); m_timers.unschedule(timer_id); } void waitTimer(size_t timer_id) { while (true) { auto data = &m_timers.getUserData(timer_id); assert(data.owner == Task.init, "Waiting for the same timer from multiple tasks is not supported."); if (!m_timers.isPending(timer_id)) return; data.owner = Task.getThis(); scope (exit) m_timers.getUserData(timer_id).owner = Task.init; m_core.yieldForEvent(); } } static struct LookupStatus { Task task; DWORD error; bool finished; Win32EventDriver driver; } private static nothrow extern(System) void onDnsResult(DWORD dwError, DWORD /*dwBytes*/, WSAOVERLAPPEDX* lpOverlapped) { auto stat = cast(LookupStatus*)cast(void*)lpOverlapped.hEvent; stat.error = dwError; stat.finished = true; if( stat.task ) try stat.driver.m_core.resumeTask(stat.task); catch (UncaughtException th) logWarn("Resuming task for DNS lookup has thrown: %s", th.msg); } private static nothrow extern(System) LRESULT onMessage(HWND wnd, UINT msg, WPARAM wparam, LPARAM lparam) { auto driver = cast(Win32EventDriver)cast(void*)GetWindowLongPtrA(wnd, GWLP_USERDATA); switch(msg){ default: break; case WM_USER_SIGNAL: auto sig = cast(Win32ManualEvent)cast(void*)lparam; Win32EventDriver[Task] lst; try { synchronized(sig.m_mutex) lst = sig.m_listeners.dup; foreach( task, tid; lst ) if( tid is driver && task ) driver.m_core.resumeTask(task); } catch(UncaughtException th){ logWarn("Failed to resume signal listeners: %s", th.msg); return 0; } return 0; case WM_USER_SOCKET: SOCKET sock = cast(SOCKET)wparam; auto evt = LOWORD(lparam); auto err = HIWORD(lparam); auto ph = sock in driver.m_socketHandlers; if( ph is null ){ logWarn("Socket %s has no associated handler for event %s/%s", sock, evt, err); } else ph.notifySocketEvent(sock, evt, err); return 0; } return DefWindowProcA(wnd, msg, wparam, lparam); } } interface SocketEventHandler { SOCKET socket() nothrow; void notifySocketEvent(SOCKET sock, WORD event, WORD error) nothrow; } private struct TimerInfo { size_t refCount = 1; void delegate() callback; Task owner; this(void delegate() callback) { this.callback = callback; } } /******************************************************************************/ /* class Win32ManualEvent */ /******************************************************************************/ final class Win32ManualEvent : ManualEvent { private { core.sync.mutex.Mutex m_mutex; Win32EventDriver m_driver; Win32EventDriver[Task] m_listeners; shared int m_emitCount = 0; Task m_waiter; bool m_timedOut; } this(Win32EventDriver driver) { m_mutex = new core.sync.mutex.Mutex; m_driver = driver; } void emit() { /*auto newcnt =*/ atomicOp!"+="(m_emitCount, 1); bool[Win32EventDriver] threads; synchronized(m_mutex) { foreach( th; m_listeners ) threads[th] = true; } foreach( th, _; threads ) if( !PostMessageW(th.m_hwnd, WM_USER_SIGNAL, 0, cast(LPARAM)cast(void*)this) ) logWarn("Failed to post thread message."); } void wait() { wait(emitCount); } int wait(int reference_emit_count) { //logDebugV("Signal %s wait enter %s", cast(void*)this, reference_emit_count); acquire(); scope(exit) release(); auto ec = atomicLoad(m_emitCount); while( ec == reference_emit_count ){ m_driver.m_core.yieldForEvent(); ec = atomicLoad(m_emitCount); } //logDebugV("Signal %s wait leave %s", cast(void*)this, ec); return ec; } int wait(Duration timeout, int reference_emit_count = emitCount) { acquire(); scope(exit) release(); auto ec = atomicLoad(m_emitCount); m_timedOut = false; m_waiter = Task.getThis(); auto timer = m_driver.createTimer(null); scope(exit) m_driver.releaseTimer(timer); m_driver.m_timers.getUserData(timer).owner = Task.getThis(); m_driver.rearmTimer(timer, timeout, false); while (ec == reference_emit_count && !m_driver.isTimerPending(timer)) { m_driver.m_core.yieldForEvent(); ec = atomicLoad(m_emitCount); } return ec; } void acquire() { synchronized(m_mutex) { m_listeners[Task.getThis()] = cast(Win32EventDriver)getEventDriver(); } } void release() { auto self = Task.getThis(); synchronized(m_mutex) { if( self in m_listeners ) m_listeners.remove(self); } } bool amOwner() { synchronized(m_mutex) { return (Task.getThis() in m_listeners) !is null; } } @property int emitCount() const { return atomicLoad(m_emitCount); } } /******************************************************************************/ /* class Win32FileStream */ /******************************************************************************/ final class Win32FileStream : FileStream { private { Path m_path; HANDLE m_handle; FileMode m_mode; DriverCore m_driver; Task m_task; ulong m_size; ulong m_ptr = 0; DWORD m_bytesTransferred; } this(DriverCore driver, Path path, FileMode mode) { m_path = path; m_mode = mode; m_driver = driver; auto access = m_mode == FileMode.readWrite ? (GENERIC_WRITE | GENERIC_READ) : (m_mode == FileMode.createTrunc || m_mode == FileMode.append)? GENERIC_WRITE : GENERIC_READ; auto shareMode = m_mode == FileMode.read? FILE_SHARE_READ : 0; auto creation = m_mode == FileMode.createTrunc? CREATE_ALWAYS : m_mode == FileMode.append? OPEN_ALWAYS : OPEN_EXISTING; m_handle = CreateFileW( toUTF16z(m_path.toNativeString()), access, shareMode, null, creation, FILE_FLAG_BACKUP_SEMANTICS | FILE_FLAG_OVERLAPPED, null); auto errorcode = GetLastError(); enforce(m_handle != INVALID_HANDLE_VALUE, "Failed to open "~path.toNativeString()~": "~to!string(errorcode)); if(mode == FileMode.createTrunc && errorcode == ERROR_ALREADY_EXISTS) { // truncate file // TODO: seek to start pos? BOOL ret = SetEndOfFile(m_handle); errorcode = GetLastError(); enforce(ret, "Failed to call SetFileEndPos for path "~path.toNativeString()~", Error: " ~ to!string(errorcode)); } long size; auto succeeded = GetFileSizeEx(m_handle, &size); enforce(succeeded); m_size = size; } ~this() { close(); } void release() { assert(m_task == Task.getThis(), "Releasing FileStream that is not owned by the calling task."); m_task = Task(); } void acquire() { assert(m_task == Task(), "Acquiring FileStream that is already owned."); m_task = Task.getThis(); } bool amOwner() { return m_task == Task.getThis(); } void close() { if(m_handle == INVALID_HANDLE_VALUE) return; CloseHandle(m_handle); m_handle = INVALID_HANDLE_VALUE; } ulong tell() { return m_ptr; } @property Path path() const { return m_path; } @property bool isOpen() const { return m_handle != INVALID_HANDLE_VALUE; } @property ulong size() const { return m_size; } @property bool readable() const { return m_mode != FileMode.append; } @property bool writable() const { return m_mode == FileMode.append || m_mode == FileMode.createTrunc || m_mode == FileMode.readWrite; } void seek(ulong offset) { m_ptr = offset; } @property bool empty() const { assert(this.readable); return m_ptr >= m_size; } @property ulong leastSize() const { assert(this.readable); return m_size - m_ptr; } @property bool dataAvailableForRead(){ return leastSize() > 0; } const(ubyte)[] peek(){ assert(false); } void read(ubyte[] dst) { assert(this.readable); acquire(); scope(exit) release(); while( dst.length > 0 ){ enforce(dst.length <= leastSize); OVERLAPPED overlapped; overlapped.Internal = 0; overlapped.InternalHigh = 0; overlapped.Offset = cast(uint)(m_ptr & 0xFFFFFFFF); overlapped.OffsetHigh = cast(uint)(m_ptr >> 32); overlapped.hEvent = cast(HANDLE)cast(void*)this; m_bytesTransferred = 0; auto to_read = min(dst.length, DWORD.max); // request to write the data ReadFileEx(m_handle, cast(void*)dst, to_read, &overlapped, &onIOCompleted); // yield until the data is read while( !m_bytesTransferred ) m_driver.yieldForEvent(); assert(m_bytesTransferred <= to_read, "More bytes read than requested!?"); dst = dst[m_bytesTransferred .. $]; m_ptr += m_bytesTransferred; } } void write(in ubyte[] bytes_) { assert(this.writable); acquire(); scope(exit) release(); const(ubyte)[] bytes = bytes_; while( bytes.length > 0 ){ OVERLAPPED overlapped; overlapped.Internal = 0; overlapped.InternalHigh = 0; overlapped.Offset = cast(uint)(m_ptr & 0xFFFFFFFF); overlapped.OffsetHigh = cast(uint)(m_ptr >> 32); overlapped.hEvent = cast(HANDLE)cast(void*)this; m_bytesTransferred = 0; auto to_write = min(bytes.length, DWORD.max); // request to write the data WriteFileEx(m_handle, cast(void*)bytes, to_write, &overlapped, &onIOCompleted); // yield until the data is written while( !m_bytesTransferred ) m_driver.yieldForEvent(); assert(m_bytesTransferred <= to_write, "More bytes written than requested!?"); bytes = bytes[m_bytesTransferred .. $]; m_ptr += m_bytesTransferred; } if(m_ptr > m_size) m_size = m_ptr; } void flush(){} void finalize(){} void write(InputStream stream, ulong nbytes = 0) { writeDefault(stream, nbytes); } private static extern(System) nothrow void onIOCompleted(DWORD dwError, DWORD cbTransferred, OVERLAPPED* overlapped) { try { auto fileStream = cast(Win32FileStream)(overlapped.hEvent); fileStream.m_bytesTransferred = cbTransferred; if( fileStream.m_task ){ Exception ex; if( dwError != 0 ) ex = new Exception("File I/O error: "~to!string(dwError)); if( fileStream.m_task ) fileStream.m_driver.resumeTask(fileStream.m_task, ex); } } catch( UncaughtException e ){ logWarn("Exception while handling file I/O: %s", e.msg); } } } /******************************************************************************/ /* class Win32Directory Watcher */ /******************************************************************************/ final class Win32DirectoryWatcher : DirectoryWatcher { private { Path m_path; bool m_recursive; HANDLE m_handle; DWORD m_bytesTransferred; DriverCore m_core; ubyte[16384] m_buffer; UINT m_notifications = FILE_NOTIFY_CHANGE_FILE_NAME|FILE_NOTIFY_CHANGE_DIR_NAME| FILE_NOTIFY_CHANGE_SIZE|FILE_NOTIFY_CHANGE_LAST_WRITE; Task m_task; } this(DriverCore core, Path path, bool recursive) { m_core = core; m_path = path; m_recursive = recursive; m_task = Task.getThis(); auto pstr = m_path.toString(); m_handle = CreateFileW(toUTFz!(const(wchar)*)(pstr), FILE_LIST_DIRECTORY, FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, null, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS | FILE_FLAG_OVERLAPPED, null); } ~this() { CloseHandle(m_handle); } @property Path path() const { return m_path; } @property bool recursive() const { return m_recursive; } void release() { assert(m_task == Task.getThis(), "Releasing FileStream that is not owned by the calling task."); m_task = Task(); } void acquire() { assert(m_task == Task(), "Acquiring FileStream that is already owned."); m_task = Task.getThis(); } bool amOwner() { return m_task == Task.getThis(); } bool readChanges(ref DirectoryChange[] dst, Duration timeout) { OVERLAPPED overlapped; overlapped.Internal = 0; overlapped.InternalHigh = 0; overlapped.Offset = 0; overlapped.OffsetHigh = 0; overlapped.hEvent = cast(HANDLE)cast(void*)this; m_bytesTransferred = 0; DWORD bytesReturned; if( !ReadDirectoryChangesW(m_handle, m_buffer.ptr, m_buffer.length, m_recursive, m_notifications, &bytesReturned, &overlapped, &onIOCompleted) ) { logError("Failed to read directory changes in '%s'", m_path); return false; } // FIXME: obey timeout! assert(timeout.isNegative()); while( !m_bytesTransferred ) m_core.yieldForEvent(); ubyte[] result = m_buffer[0 .. m_bytesTransferred]; do { assert(result.length >= FILE_NOTIFY_INFORMATION.sizeof); auto fni = cast(FILE_NOTIFY_INFORMATION*)result.ptr; DirectoryChangeType kind; switch( fni.Action ){ default: kind = DirectoryChangeType.modified; break; case 0x1: kind = DirectoryChangeType.added; break; case 0x2: kind = DirectoryChangeType.removed; break; case 0x3: kind = DirectoryChangeType.modified; break; case 0x4: kind = DirectoryChangeType.removed; break; case 0x5: kind = DirectoryChangeType.added; break; } string filename = to!string(fni.FileName.ptr[0 .. fni.FileNameLength/2]); dst ~= DirectoryChange(kind, Path(filename)); //logTrace("File changed: %s", fni.FileName.ptr[0 .. fni.FileNameLength/2]); if( fni.NextEntryOffset == 0 ) break; result = result[fni.NextEntryOffset .. $]; } while(result.length > 0); return true; } static nothrow extern(System) { void onIOCompleted(DWORD dwError, DWORD cbTransferred, OVERLAPPED* overlapped) { try { auto watcher = cast(Win32DirectoryWatcher)overlapped.hEvent; watcher.m_bytesTransferred = cbTransferred; if( watcher.m_task ){ Exception ex; if( dwError != 0 ) ex = new Exception("Diretory watcher error: "~to!string(dwError)); if( watcher.m_task ) watcher.m_core.resumeTask(watcher.m_task, ex); } } catch( UncaughtException th ){ logWarn("Exception in directory watcher callback: %s", th.msg); } } } } /******************************************************************************/ /* class Win32UDPConnection */ /******************************************************************************/ final class Win32UDPConnection : UDPConnection, SocketEventHandler { private { Task m_task; Win32EventDriver m_driver; SOCKET m_socket; NetworkAddress m_bindAddress; bool m_canBroadcast; } this(Win32EventDriver driver, SOCKET sock, NetworkAddress bind_addr) { m_driver = driver; m_socket = sock; m_bindAddress = bind_addr; WSAAsyncSelect(sock, m_driver.m_hwnd, WM_USER_SOCKET, FD_READ|FD_WRITE|FD_CLOSE); //bind... } @property SOCKET socket() { return m_socket; } @property string bindAddress() const { // NOTE: using WSAAddressToStringW instead of inet_ntop because that is only available from Vista up wchar[64] buf; DWORD buf_len = 64; WSAAddressToStringW(m_bindAddress.sockAddr, m_bindAddress.sockAddrLen, null, buf.ptr, &buf_len); auto ret = to!string(buf[0 .. buf_len]); ret = ret[0 .. ret.lastIndexOf(':')]; // strip the port number return ret; } @property NetworkAddress localAddress() const { return m_bindAddress; } @property bool canBroadcast() const { return m_canBroadcast; } @property void canBroadcast(bool val) { int tmp_broad = val; socketEnforce(setsockopt(m_socket, SOL_SOCKET, SO_BROADCAST, &tmp_broad, tmp_broad.sizeof) == 0, "Failed to change the socket broadcast flag"); m_canBroadcast = val; } void close() { if (m_socket == INVALID_SOCKET) return; closesocket(m_socket); m_socket = INVALID_SOCKET; } bool amOwner() { return m_task != Task() && m_task == Task.getThis(); } void acquire() { assert(m_task == Task(), "Trying to acquire a TCP connection that is currently owned."); m_task = Task.getThis(); } void release() { assert(m_task != Task(), "Trying to release a TCP connection that is not owned."); assert(m_task == Task.getThis(), "Trying to release a foreign TCP connection."); m_task = Task(); } void connect(string host, ushort port) { NetworkAddress addr = m_driver.resolveHost(host, m_bindAddress.family); addr.port = port; connect(addr); } void connect(NetworkAddress addr) { socketEnforce(.connect(m_socket, addr.sockAddr, addr.sockAddrLen) == 0, "Failed to connect UDP socket"); } void send(in ubyte[] data, in NetworkAddress* peer_address = null) { assert(data.length <= int.max); sizediff_t ret; if( peer_address ){ ret = .sendto(m_socket, data.ptr, cast(int)data.length, 0, peer_address.sockAddr, peer_address.sockAddrLen); } else { ret = .send(m_socket, data.ptr, cast(int)data.length, 0); } logTrace("send ret: %s, %s", ret, WSAGetLastError()); socketEnforce(ret >= 0, "Error sending UDP packet"); enforce(ret == data.length, "Unable to send full packet."); } ubyte[] recv(ubyte[] buf = null, NetworkAddress* peer_address = null) { return recv(Duration.max, buf, peer_address); } ubyte[] recv(Duration timeout, ubyte[] buf = null, NetworkAddress* peer_address = null) { size_t tm; if (timeout != Duration.max && timeout > 0.seconds) { tm = m_driver.createTimer(null); m_driver.rearmTimer(tm, timeout, false); m_driver.acquireTimer(tm); } acquire(); scope(exit) { release(); if (tm != size_t.max) m_driver.releaseTimer(tm); } assert(buf.length <= int.max); if( buf.length == 0 ) buf.length = 65507; NetworkAddress from; from.family = m_bindAddress.family; while(true){ socklen_t addr_len = from.sockAddrLen; auto ret = .recvfrom(m_socket, buf.ptr, cast(int)buf.length, 0, from.sockAddr, &addr_len); if( ret > 0 ){ if( peer_address ) *peer_address = from; return buf[0 .. ret]; } if( ret < 0 ){ auto err = WSAGetLastError(); logDebug("UDP recv err: %s", err); socketEnforce(err == WSAEWOULDBLOCK, "Error receiving UDP packet"); if (timeout != Duration.max) { enforce(timeout > 0.seconds && m_driver.isTimerPending(tm), "UDP receive timeout."); } } m_driver.m_core.yieldForEvent(); } } void notifySocketEvent(SOCKET sock, WORD event, WORD error) { assert(false); } private static nothrow extern(C) void onUDPRead(SOCKET sockfd, short evts, void* arg) { /*auto ctx = cast(TCPContext*)arg; logTrace("udp socket %d read event!", ctx.socketfd); try { auto f = ctx.task; if( f && f.state != Fiber.State.TERM ) ctx.core.resumeTask(f); } catch( UncaughtException e ){ logError("Exception onUDPRead: %s", e.msg); debug assert(false); }*/ } } /******************************************************************************/ /* class Win32TCPConnection */ /******************************************************************************/ enum ConnectionStatus { Initialized, Connected, Disconnected } final class Win32TCPConnection : TCPConnection, SocketEventHandler { private { Win32EventDriver m_driver; Task m_readOwner; Task m_writeOwner; bool m_tcpNoDelay; Duration m_readTimeout; bool m_keepAlive; SOCKET m_socket; NetworkAddress m_localAddress; NetworkAddress m_peerAddress; string m_peerAddressString; DWORD m_bytesTransferred; ConnectionStatus m_status; FixedRingBuffer!(ubyte, 64*1024) m_readBuffer; void delegate(TCPConnection) m_connectionCallback; HANDLE m_transferredFile; OVERLAPPED m_fileOverlapped; } this(Win32EventDriver driver, SOCKET sock, NetworkAddress peer_address, ConnectionStatus status = ConnectionStatus.Initialized) { m_driver = driver; m_socket = sock; m_driver.m_socketHandlers[sock] = this; m_status = status; m_localAddress.family = peer_address.family; if (peer_address.family == AF_INET) m_localAddress.sockAddrInet4.sin_addr.s_addr = 0; else m_localAddress.sockAddrInet6.sin6_addr.s6_addr[] = 0; socklen_t balen = m_localAddress.sockAddrLen; socketEnforce(getsockname(sock, m_localAddress.sockAddr, &balen) == 0, "getsockname failed"); m_peerAddress = peer_address; // NOTE: using WSAAddressToStringW instead of inet_ntop because that is only available from Vista up wchar[64] buf; DWORD buflen = buf.length; socketEnforce(WSAAddressToStringW(m_peerAddress.sockAddr, m_peerAddress.sockAddrLen, null, buf.ptr, &buflen) == 0, "Failed to get string representation of peer address"); m_peerAddressString = to!string(buf[0 .. buflen]); m_peerAddressString = m_peerAddressString[0 .. m_peerAddressString.lastIndexOf(':')]; // strip the port number // setup overlapped structure for copy-less file sending m_fileOverlapped.Internal = 0; m_fileOverlapped.InternalHigh = 0; m_fileOverlapped.Offset = 0; m_fileOverlapped.OffsetHigh = 0; m_fileOverlapped.hEvent = m_driver.m_fileCompletionEvent; WSAAsyncSelect(sock, m_driver.m_hwnd, WM_USER_SOCKET, FD_READ|FD_WRITE|FD_CLOSE); } ~this() { /*if( m_socket != -1 ){ closesocket(m_socket); }*/ } @property SOCKET socket() { return m_socket; } private void connect(NetworkAddress addr) { enforce(m_status != ConnectionStatus.Connected, "Connection is already established."); acquire(); scope(exit) release(); auto ret = .connect(m_socket, addr.sockAddr, addr.sockAddrLen); //enforce(WSAConnect(m_socket, addr.sockAddr, addr.sockAddrLen, null, null, null, null), "Failed to connect to host"); if (ret != 0) { auto err = WSAGetLastError(); logDebugV("connect err: %s", err); import std.string; socketEnforce(err == WSAEWOULDBLOCK, "Connect call failed"); while (m_status != ConnectionStatus.Connected) m_driver.m_core.yieldForEvent(); } assert(m_status == ConnectionStatus.Connected); } void release() { assert(m_readOwner == Task.getThis() && m_readOwner == m_writeOwner, "Releasing TCP connection that is not owned by the calling task."); m_readOwner = m_writeOwner = Task(); } void acquire() { assert(m_readOwner == Task() && m_writeOwner == Task(), "Acquiring TCP connection that is currently owned."); m_readOwner = m_writeOwner = Task.getThis(); } bool amOwner() { return Task.getThis() == m_readOwner && m_readOwner == m_writeOwner; } @property void tcpNoDelay(bool enabled) { m_tcpNoDelay = enabled; BOOL eni = enabled; setsockopt(m_socket, IPPROTO_TCP, TCP_NODELAY, &eni, eni.sizeof); assert(false); } @property bool tcpNoDelay() const { return m_tcpNoDelay; } @property void readTimeout(Duration v) { m_readTimeout = v; auto msecs = v.total!"msecs"(); assert(msecs < DWORD.max); DWORD vdw = cast(DWORD)msecs; setsockopt(m_socket, SOL_SOCKET, SO_RCVTIMEO, &vdw, vdw.sizeof); } @property Duration readTimeout() const { return m_readTimeout; } @property void keepAlive(bool enabled) { m_keepAlive = enabled; BOOL eni = enabled; setsockopt(m_socket, SOL_SOCKET, SO_KEEPALIVE, &eni, eni.sizeof); assert(false); } @property bool keepAlive() const { return m_keepAlive; } @property bool connected() const { return m_status == ConnectionStatus.Connected; } @property string peerAddress() const { return m_peerAddressString; } @property NetworkAddress localAddress() const { return m_localAddress; } @property NetworkAddress remoteAddress() const { return m_peerAddress; } @property bool empty() { return leastSize == 0; } @property ulong leastSize() { acquireReader(); scope(exit) releaseReader(); while( m_readBuffer.empty ){ if( !connected ) return 0; m_driver.m_core.yieldForEvent(); } return m_readBuffer.length; } @property bool dataAvailableForRead() { acquireReader(); scope(exit) releaseReader(); return !m_readBuffer.empty; } void close() { acquire(); scope(exit) release(); WSASendDisconnect(m_socket, null); closesocket(m_socket); m_socket = -1; m_status = ConnectionStatus.Disconnected; } bool waitForData(Duration timeout) { acquireReader(); scope(exit) releaseReader(); auto tm = m_driver.createTimer(null); scope(exit) m_driver.releaseTimer(tm); m_driver.m_timers.getUserData(tm).owner = Task.getThis(); m_driver.rearmTimer(tm, timeout, false); while (m_readBuffer.empty) { if (!connected) return false; m_driver.m_core.yieldForEvent(); if (!m_driver.isTimerPending(tm)) return false; } return true; } const(ubyte)[] peek() { acquireReader(); scope(exit) releaseReader(); return m_readBuffer.peek(); } void read(ubyte[] dst) { acquireReader(); scope(exit) releaseReader(); while( dst.length > 0 ){ while( m_readBuffer.empty ){ checkConnected(); m_driver.m_core.yieldForEvent(); } size_t amt = min(dst.length, m_readBuffer.length); m_readBuffer.read(dst[0 .. amt]); dst = dst[amt .. $]; } } void write(in ubyte[] bytes_) { acquireWriter(); scope(exit) releaseWriter(); checkConnected(); const(ubyte)[] bytes = bytes_; logTrace("TCP write with %s bytes called", bytes.length); WSAOVERLAPPEDX overlapped; overlapped.Internal = 0; overlapped.InternalHigh = 0; overlapped.Offset = 0; overlapped.OffsetHigh = 0; overlapped.hEvent = cast(HANDLE)cast(void*)this; while( bytes.length > 0 ){ WSABUF buf; buf.len = bytes.length; buf.buf = cast(ubyte*)bytes.ptr; m_bytesTransferred = 0; logTrace("Sending %s bytes TCP", buf.len); auto ret = WSASend(m_socket, &buf, 1, null, 0, &overlapped, &onIOWriteCompleted); if( ret == SOCKET_ERROR ){ auto err = WSAGetLastError(); socketEnforce(err == WSA_IO_PENDING, "Failed to send data"); } while( !m_bytesTransferred ) m_driver.m_core.yieldForEvent(); assert(m_bytesTransferred <= bytes.length, "More data sent than requested!?"); bytes = bytes[m_bytesTransferred .. $]; } } void flush() { acquireWriter(); scope(exit) releaseWriter(); checkConnected(); } void finalize() { flush(); } void write(InputStream stream, ulong nbytes = 0) { // special case sending of files if( auto fstream = cast(Win32FileStream)stream ){ if( fstream.tell() == 0 && fstream.size <= 1<<31 ){ acquireWriter(); scope(exit) releaseWriter(); logDebug("Using sendfile! %s %s %s", fstream.m_handle, fstream.tell(), fstream.size); m_bytesTransferred = 0; m_driver.m_fileWriters[this] = true; if( TransmitFile(m_socket, fstream.m_handle, 0, 0, &m_fileOverlapped, null, 0) ) m_bytesTransferred = 1; socketEnforce(WSAGetLastError() == WSA_IO_PENDING, "Failed to send file over TCP."); while( m_bytesTransferred < fstream.size ) m_driver.m_core.yieldForEvent(); return; } } writeDefault(stream, nbytes); } InputStream acquireReader() { assert(m_readOwner == Task()); m_readOwner = Task.getThis(); return this; } void releaseReader() { assert(m_readOwner == Task.getThis()); m_readOwner = Task(); } bool amReadOwner() const { return m_readOwner == Task.getThis(); } OutputStream acquireWriter() { assert(m_writeOwner == Task()); m_writeOwner = Task.getThis(); return this; } void releaseWriter() { assert(m_writeOwner == Task.getThis()); m_writeOwner = Task(); } bool amWriteOwner() const { return m_writeOwner == Task.getThis(); } private void checkConnected() { // TODO! } private bool testFileWritten() { if( !GetOverlappedResult(m_transferredFile, &m_fileOverlapped, &m_bytesTransferred, false) ){ if( GetLastError() != ERROR_IO_PENDING ){ m_driver.m_core.resumeTask(m_writeOwner, new Exception("File transfer over TCP failed.")); return true; } return false; } else { m_driver.m_core.resumeTask(m_writeOwner); return true; } } void notifySocketEvent(SOCKET sock, WORD event, WORD error) nothrow { try { logDebugV("Socket event for %s: %s, error: %s", sock, event, error); if (m_socket == -1) { logDebug("Event for already closed socket - ignoring"); return; } assert(sock == m_socket); Exception ex; switch(event){ default: break; case FD_CONNECT: // doesn't seem to occur, but we handle it just in case if (error) { ex = new Exception("Failed to connect to host: "~to!string(error)); m_status = ConnectionStatus.Disconnected; } else m_status = ConnectionStatus.Connected; if (m_writeOwner) m_driver.m_core.resumeTask(m_writeOwner, ex); break; case FD_READ: logTrace("TCP read event"); while( m_readBuffer.freeSpace > 0 ){ auto dst = m_readBuffer.peekDst(); assert(dst.length <= int.max); logTrace("Try to read up to %s bytes", dst.length); auto ret = .recv(m_socket, dst.ptr, cast(int)dst.length, 0); if( ret >= 0 ){ logTrace("received %s bytes", ret); if( ret == 0 ) break; m_readBuffer.putN(ret); } else { auto err = WSAGetLastError(); if( err != WSAEWOULDBLOCK ){ logTrace("receive error %s", err); ex = new Exception("Socket error: "~to!string(err)); } break; } } //m_driver.m_core.resumeTask(m_readOwner, ex); /*WSABUF buf; buf.len = dst.length; buf.buf = dst.ptr; DWORD flags = 0; WSAOVERLAPPEDX overlapped; overlapped.Internal = 0; overlapped.InternalHigh = 0; overlapped.Offset = 0; overlapped.OffsetHigh = 0; overlapped.hEvent = cast(HANDLE)cast(void*)this; m_bytesTransferred = 0; auto ret = WSARecv(m_socket, &buf, 1, null, &flags, &overlapped, &onIOCompleted); if( ret == SOCKET_ERROR ){ auto err = WSAGetLastError(); socketEnforce(err == WSA_IO_PENDING, "Failed to receive data"); } while( !m_bytesTransferred ) m_driver.m_core.yieldForEvent(); assert(m_bytesTransferred <= dst.length, "More data received than requested!?"); m_readBuffer.pushN(m_bytesTransferred);*/ if (m_readOwner) m_driver.m_core.resumeTask(m_readOwner, ex); break; case FD_WRITE: if( m_status == ConnectionStatus.Initialized ){ if( error ){ ex = new Exception("Failed to connect to host: "~to!string(error)); } else m_status = ConnectionStatus.Connected; } if (m_writeOwner) m_driver.m_core.resumeTask(m_writeOwner, ex); break; case FD_CLOSE: if( error ){ if( m_status == ConnectionStatus.Initialized ){ ex = new Exception("Failed to connect to host: "~to!string(error)); } else { ex = new Exception("The connection was closed with error: "~to!string(error)); } } else { m_status = ConnectionStatus.Disconnected; closesocket(m_socket); m_socket = -1; } if (m_writeOwner) m_driver.m_core.resumeTask(m_writeOwner, ex); break; } } catch( UncaughtException th ){ logWarn("Exception while handling socket event: %s", th.msg); } } private void runConnectionCallback(TCPListenOptions options) { try { m_connectionCallback(this); logDebug("task out (fd %d).", m_socket); } catch( Exception e ){ logWarn("Handling of connection failed: %s", e.msg); logDiagnostic("%s", e.toString()); } finally { if (!(options & TCPListenOptions.disableAutoClose) && this.connected) close(); } } private static extern(System) nothrow void onIOWriteCompleted(DWORD dwError, DWORD cbTransferred, WSAOVERLAPPEDX* lpOverlapped, DWORD dwFlags) { logTrace("IO completed for TCP send: %s (error=%s)", cbTransferred, dwError); try { auto conn = cast(Win32TCPConnection)(lpOverlapped.hEvent); conn.m_bytesTransferred = cbTransferred; if (conn.m_writeOwner != Task.init) { Exception ex; if( dwError != 0 ) ex = new Exception("Socket I/O error: "~to!string(dwError)); conn.m_driver.m_core.resumeTask(conn.m_writeOwner, ex); } } catch( UncaughtException th ){ logWarn("Exception while handling TCP I/O: %s", th.msg); } } } /******************************************************************************/ /* class Win32TCPListener */ /******************************************************************************/ final class Win32TCPListener : TCPListener, SocketEventHandler { private { Win32EventDriver m_driver; SOCKET m_socket; void delegate(TCPConnection conn) m_connectionCallback; TCPListenOptions m_options; } this(Win32EventDriver driver, SOCKET sock, void delegate(TCPConnection conn) conn_callback, TCPListenOptions options) { m_driver = driver; m_socket = sock; m_connectionCallback = conn_callback; m_driver.m_socketHandlers[sock] = this; m_options = options; WSAAsyncSelect(sock, m_driver.m_hwnd, WM_USER_SOCKET, FD_ACCEPT); } void stopListening() { if( m_socket == -1 ) return; closesocket(m_socket); m_socket = -1; } SOCKET socket() nothrow { return m_socket; } void notifySocketEvent(SOCKET sock, WORD event, WORD error) nothrow { assert(sock == m_socket); switch(event){ default: assert(false); case FD_ACCEPT: try { NetworkAddress addr; addr.family = AF_INET6; int addrlen = addr.sockAddrLen; auto clientsock = WSAAccept(sock, addr.sockAddr, &addrlen, null, 0); assert(addrlen == addr.sockAddrLen); // TODO avoid GC allocations for delegate and Win32TCPConnection auto conn = new Win32TCPConnection(m_driver, clientsock, addr, ConnectionStatus.Connected); conn.m_connectionCallback = m_connectionCallback; runTask(&conn.runConnectionCallback, m_options); } catch( Exception e ){ logWarn("Exception white accepting TCP connection: %s", e.msg); try logDiagnostic("Exception white accepting TCP connection: %s", e.toString()); catch( Exception ){} } break; } } } private { struct TimerMapTraits { enum clearValue = UINT_PTR.max; static bool equals(UINT_PTR a, UINT_PTR b) { return a == b; } } __gshared s_setupWindowClass = false; } void setupWindowClass() { if( s_setupWindowClass ) return; WNDCLASS wc; wc.lpfnWndProc = &Win32EventDriver.onMessage; wc.lpszClassName = "VibeWin32MessageWindow"; RegisterClassA(&wc); s_setupWindowClass = true; } version (VibeDebugCatchAll) private alias UncaughtException = Throwable; else private alias UncaughtException = Exception; } // version(VibeWin32Driver)
D