code
stringlengths
3
10M
language
stringclasses
31 values
/Users/WenNiao/myproject/iosprojects/HackerNews/build/Pods.build/Debug-iphonesimulator/Alamofire.build/Objects-normal/x86_64/Request.o : /Users/WenNiao/myproject/iosprojects/HackerNews/Pods/Alamofire/Source/Alamofire.swift /Users/WenNiao/myproject/iosprojects/HackerNews/Pods/Alamofire/Source/Download.swift /Users/WenNiao/myproject/iosprojects/HackerNews/Pods/Alamofire/Source/Error.swift /Users/WenNiao/myproject/iosprojects/HackerNews/Pods/Alamofire/Source/Manager.swift /Users/WenNiao/myproject/iosprojects/HackerNews/Pods/Alamofire/Source/MultipartFormData.swift /Users/WenNiao/myproject/iosprojects/HackerNews/Pods/Alamofire/Source/NetworkReachabilityManager.swift /Users/WenNiao/myproject/iosprojects/HackerNews/Pods/Alamofire/Source/Notifications.swift /Users/WenNiao/myproject/iosprojects/HackerNews/Pods/Alamofire/Source/ParameterEncoding.swift /Users/WenNiao/myproject/iosprojects/HackerNews/Pods/Alamofire/Source/Request.swift /Users/WenNiao/myproject/iosprojects/HackerNews/Pods/Alamofire/Source/Response.swift /Users/WenNiao/myproject/iosprojects/HackerNews/Pods/Alamofire/Source/ResponseSerialization.swift /Users/WenNiao/myproject/iosprojects/HackerNews/Pods/Alamofire/Source/Result.swift /Users/WenNiao/myproject/iosprojects/HackerNews/Pods/Alamofire/Source/ServerTrustPolicy.swift /Users/WenNiao/myproject/iosprojects/HackerNews/Pods/Alamofire/Source/Stream.swift /Users/WenNiao/myproject/iosprojects/HackerNews/Pods/Alamofire/Source/Timeline.swift /Users/WenNiao/myproject/iosprojects/HackerNews/Pods/Alamofire/Source/Upload.swift /Users/WenNiao/myproject/iosprojects/HackerNews/Pods/Alamofire/Source/Validation.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Swift.swiftmodule /Users/WenNiao/myproject/iosprojects/HackerNews/Pods/Target\ Support\ Files/Alamofire/Alamofire-umbrella.h /Users/WenNiao/myproject/iosprojects/HackerNews/build/Pods.build/Debug-iphonesimulator/Alamofire.build/unextended-module.modulemap /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/WenNiao/myproject/iosprojects/HackerNews/build/Pods.build/Debug-iphonesimulator/Alamofire.build/Objects-normal/x86_64/Request~partial.swiftmodule : /Users/WenNiao/myproject/iosprojects/HackerNews/Pods/Alamofire/Source/Alamofire.swift /Users/WenNiao/myproject/iosprojects/HackerNews/Pods/Alamofire/Source/Download.swift /Users/WenNiao/myproject/iosprojects/HackerNews/Pods/Alamofire/Source/Error.swift /Users/WenNiao/myproject/iosprojects/HackerNews/Pods/Alamofire/Source/Manager.swift /Users/WenNiao/myproject/iosprojects/HackerNews/Pods/Alamofire/Source/MultipartFormData.swift /Users/WenNiao/myproject/iosprojects/HackerNews/Pods/Alamofire/Source/NetworkReachabilityManager.swift /Users/WenNiao/myproject/iosprojects/HackerNews/Pods/Alamofire/Source/Notifications.swift /Users/WenNiao/myproject/iosprojects/HackerNews/Pods/Alamofire/Source/ParameterEncoding.swift /Users/WenNiao/myproject/iosprojects/HackerNews/Pods/Alamofire/Source/Request.swift /Users/WenNiao/myproject/iosprojects/HackerNews/Pods/Alamofire/Source/Response.swift /Users/WenNiao/myproject/iosprojects/HackerNews/Pods/Alamofire/Source/ResponseSerialization.swift /Users/WenNiao/myproject/iosprojects/HackerNews/Pods/Alamofire/Source/Result.swift /Users/WenNiao/myproject/iosprojects/HackerNews/Pods/Alamofire/Source/ServerTrustPolicy.swift /Users/WenNiao/myproject/iosprojects/HackerNews/Pods/Alamofire/Source/Stream.swift /Users/WenNiao/myproject/iosprojects/HackerNews/Pods/Alamofire/Source/Timeline.swift /Users/WenNiao/myproject/iosprojects/HackerNews/Pods/Alamofire/Source/Upload.swift /Users/WenNiao/myproject/iosprojects/HackerNews/Pods/Alamofire/Source/Validation.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Swift.swiftmodule /Users/WenNiao/myproject/iosprojects/HackerNews/Pods/Target\ Support\ Files/Alamofire/Alamofire-umbrella.h /Users/WenNiao/myproject/iosprojects/HackerNews/build/Pods.build/Debug-iphonesimulator/Alamofire.build/unextended-module.modulemap /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/WenNiao/myproject/iosprojects/HackerNews/build/Pods.build/Debug-iphonesimulator/Alamofire.build/Objects-normal/x86_64/Request~partial.swiftdoc : /Users/WenNiao/myproject/iosprojects/HackerNews/Pods/Alamofire/Source/Alamofire.swift /Users/WenNiao/myproject/iosprojects/HackerNews/Pods/Alamofire/Source/Download.swift /Users/WenNiao/myproject/iosprojects/HackerNews/Pods/Alamofire/Source/Error.swift /Users/WenNiao/myproject/iosprojects/HackerNews/Pods/Alamofire/Source/Manager.swift /Users/WenNiao/myproject/iosprojects/HackerNews/Pods/Alamofire/Source/MultipartFormData.swift /Users/WenNiao/myproject/iosprojects/HackerNews/Pods/Alamofire/Source/NetworkReachabilityManager.swift /Users/WenNiao/myproject/iosprojects/HackerNews/Pods/Alamofire/Source/Notifications.swift /Users/WenNiao/myproject/iosprojects/HackerNews/Pods/Alamofire/Source/ParameterEncoding.swift /Users/WenNiao/myproject/iosprojects/HackerNews/Pods/Alamofire/Source/Request.swift /Users/WenNiao/myproject/iosprojects/HackerNews/Pods/Alamofire/Source/Response.swift /Users/WenNiao/myproject/iosprojects/HackerNews/Pods/Alamofire/Source/ResponseSerialization.swift /Users/WenNiao/myproject/iosprojects/HackerNews/Pods/Alamofire/Source/Result.swift /Users/WenNiao/myproject/iosprojects/HackerNews/Pods/Alamofire/Source/ServerTrustPolicy.swift /Users/WenNiao/myproject/iosprojects/HackerNews/Pods/Alamofire/Source/Stream.swift /Users/WenNiao/myproject/iosprojects/HackerNews/Pods/Alamofire/Source/Timeline.swift /Users/WenNiao/myproject/iosprojects/HackerNews/Pods/Alamofire/Source/Upload.swift /Users/WenNiao/myproject/iosprojects/HackerNews/Pods/Alamofire/Source/Validation.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Swift.swiftmodule /Users/WenNiao/myproject/iosprojects/HackerNews/Pods/Target\ Support\ Files/Alamofire/Alamofire-umbrella.h /Users/WenNiao/myproject/iosprojects/HackerNews/build/Pods.build/Debug-iphonesimulator/Alamofire.build/unextended-module.modulemap /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
D
/** A HTTP 1.1/1.0 server implementation. Copyright: © 2012-2013 RejectedSoftware e.K. License: Subject to the terms of the MIT license, as written in the included LICENSE.txt file. Authors: Sönke Ludwig, Jan Krüger, Ilya Shipunov */ module vibe.http.server; public import vibe.core.net; public import vibe.http.common; public import vibe.http.session; import vibe.core.file; import vibe.core.log; import vibe.data.json; import vibe.http.dist; import vibe.http.log; import vibe.inet.message; import vibe.inet.url; import vibe.inet.webform; import vibe.internal.interfaceproxy : InterfaceProxy, asInterface; import vibe.stream.counting; import vibe.stream.operations; import vibe.stream.tls; import vibe.stream.wrapper : ConnectionProxyStream, createConnectionProxyStream, createConnectionProxyStreamFL; import vibe.stream.zlib; import vibe.textfilter.urlencode; import vibe.utils.array; import vibe.internal.allocator; import vibe.internal.freelistref; import vibe.utils.string; import core.atomic; import core.vararg; import std.algorithm : canFind; import std.array; import std.conv; import std.datetime; import std.encoding : sanitize; import std.exception; import std.format; import std.functional; import std.string; import std.typecons; import std.uri; /**************************************************************************************************/ /* Public functions */ /**************************************************************************************************/ /** Starts a HTTP server listening on the specified port. request_handler will be called for each HTTP request that is made. The res parameter of the callback then has to be filled with the response data. request_handler can be either HTTPServerRequestDelegate/HTTPServerRequestFunction or a class/struct with a member function 'handleRequest' that has the same signature. Note that if the application has been started with the --disthost command line switch, listenHTTP() will automatically listen on the specified VibeDist host instead of locally. This allows for a seamless switch from single-host to multi-host scenarios without changing the code. If you need to listen locally, use listenHTTPPlain() instead. Params: settings = Customizes the HTTP servers functionality. request_handler = This callback is invoked for each incoming request and is responsible for generating the response. Returns: A handle is returned that can be used to stop listening for further HTTP requests with the supplied settings. Another call to `listenHTTP` can be used afterwards to start listening again. */ HTTPListener listenHTTP(HTTPServerSettings settings, HTTPServerRequestDelegate request_handler) @safe { enforce(settings.bindAddresses.length, "Must provide at least one bind address for a HTTP server."); HTTPServerContext ctx; ctx.id = () @trusted { return atomicOp!"+="(g_contextIDCounter, 1); } (); ctx.settings = settings; ctx.requestHandler = request_handler; if (settings.accessLogger) ctx.loggers ~= settings.accessLogger; if (settings.accessLogToConsole) ctx.loggers ~= new HTTPConsoleLogger(settings, settings.accessLogFormat); if (settings.accessLogFile.length) ctx.loggers ~= new HTTPFileLogger(settings, settings.accessLogFormat, settings.accessLogFile); synchronized (() @trusted { return g_listenersMutex; } ()) addContext(ctx); // if a VibeDist host was specified on the command line, register there instead of listening // directly. if (s_distHost.length && !settings.disableDistHost) { listenHTTPDist(settings, request_handler, s_distHost, s_distPort); } else { listenHTTPPlain(settings); } return HTTPListener(ctx.id); } /// ditto HTTPListener listenHTTP(HTTPServerSettings settings, HTTPServerRequestFunction request_handler) @safe { return listenHTTP(settings, () @trusted { return toDelegate(request_handler); } ()); } /// ditto HTTPListener listenHTTP(HTTPServerSettings settings, HTTPServerRequestHandler request_handler) @safe { return listenHTTP(settings, &request_handler.handleRequest); } /// ditto HTTPListener listenHTTP(HTTPServerSettings settings, HTTPServerRequestDelegateS request_handler) @safe { return listenHTTP(settings, cast(HTTPServerRequestDelegate)request_handler); } /// ditto HTTPListener listenHTTP(HTTPServerSettings settings, HTTPServerRequestFunctionS request_handler) @safe { return listenHTTP(settings, () @trusted { return toDelegate(request_handler); } ()); } /// ditto HTTPListener listenHTTP(HTTPServerSettings settings, HTTPServerRequestHandlerS request_handler) @safe { return listenHTTP(settings, &request_handler.handleRequest); } /// ditto deprecated("Use an @safe request handler.") HTTPListener listenHTTP(HTTPServerSettings settings, void delegate(HTTPServerRequest, HTTPServerResponse) @system request_handler) @safe { return listenHTTP(settings, (req, res) @trusted => request_handler(req, res)); } /// ditto deprecated("Use an @safe request handler.") HTTPListener listenHTTP(HTTPServerSettings settings, void function(HTTPServerRequest, HTTPServerResponse) @system request_handler) @safe { return listenHTTP(settings, (req, res) @trusted => request_handler(req, res)); } /// ditto deprecated("Use an @safe request handler.") HTTPListener listenHTTP(HTTPServerSettings settings, void delegate(scope HTTPServerRequest, scope HTTPServerResponse) @system request_handler) @safe { return listenHTTP(settings, (scope req, scope res) @trusted => request_handler(req, res)); } /// ditto deprecated("Use an @safe request handler.") HTTPListener listenHTTP(HTTPServerSettings settings, void function(scope HTTPServerRequest, scope HTTPServerResponse) @system request_handler) @safe { return listenHTTP(settings, (scope req, scope res) @trusted => request_handler(req, res)); } /** Provides a HTTP request handler that responds with a static Diet template. */ @property HTTPServerRequestDelegateS staticTemplate(string template_file)() { return (scope HTTPServerRequest req, scope HTTPServerResponse res){ res.render!(template_file, req); }; } /** Provides a HTTP request handler that responds with a static redirection to the specified URL. Params: url = The URL to redirect to status = Redirection status to use $(LPAREN)by default this is $(D HTTPStatus.found)$(RPAREN). Returns: Returns a $(D HTTPServerRequestDelegate) that performs the redirect */ HTTPServerRequestDelegate staticRedirect(string url, HTTPStatus status = HTTPStatus.found) @safe { return (HTTPServerRequest req, HTTPServerResponse res){ res.redirect(url, status); }; } /// ditto HTTPServerRequestDelegate staticRedirect(URL url, HTTPStatus status = HTTPStatus.found) @safe { return (HTTPServerRequest req, HTTPServerResponse res){ res.redirect(url, status); }; } /// unittest { import vibe.http.router; void test() { auto router = new URLRouter; router.get("/old_url", staticRedirect("http://example.org/new_url", HTTPStatus.movedPermanently)); listenHTTP(new HTTPServerSettings, router); } } /** Sets a VibeDist host to register with. */ void setVibeDistHost(string host, ushort port) @safe { s_distHost = host; s_distPort = port; } /** Renders the given Diet template and makes all ALIASES available to the template. You can call this function as a pseudo-member of `HTTPServerResponse` using D's uniform function call syntax. See_also: `vibe.templ.diet.compileDietFile` Examples: --- string title = "Hello, World!"; int pageNumber = 1; res.render!("mytemplate.dt", title, pageNumber); --- */ @property void render(string template_file, ALIASES...)(HTTPServerResponse res) { res.headers["Content-Type"] = "text/html; charset=UTF-8"; version (Have_diet_ng) { import vibe.stream.wrapper : StreamOutputRange; import diet.html : compileHTMLDietFile; auto output = StreamOutputRange(res.bodyWriter); compileHTMLDietFile!(template_file, ALIASES, DefaultFilters)(output); } else { import vibe.templ.diet; compileDietFile!(template_file, ALIASES)(res.bodyWriter); } } version (Have_diet_ng) { import diet.traits; @dietTraits private struct DefaultFilters { import diet.html : HTMLOutputStyle; import std.string : splitLines; version (VibeOutputCompactHTML) enum HTMLOutputStyle htmlOutputStyle = HTMLOutputStyle.compact; else enum HTMLOutputStyle htmlOutputStyle = HTMLOutputStyle.pretty; static string filterCss(I)(I text, size_t indent = 0) { auto lines = splitLines(text); string indent_string = "\n"; while (indent-- > 0) indent_string ~= '\t'; string ret = indent_string~"<style type=\"text/css\"><!--"; indent_string = indent_string ~ '\t'; foreach (ln; lines) ret ~= indent_string ~ ln; indent_string = indent_string[0 .. $-1]; ret ~= indent_string ~ "--></style>"; return ret; } static string filterJavascript(I)(I text, size_t indent = 0) { auto lines = splitLines(text); string indent_string = "\n"; while (indent-- > 0) indent_string ~= '\t'; string ret = indent_string~"<script type=\"application/javascript\">"; ret ~= indent_string~'\t' ~ "//<![CDATA["; foreach (ln; lines) ret ~= indent_string ~ '\t' ~ ln; ret ~= indent_string ~ '\t' ~ "//]]>" ~ indent_string ~ "</script>"; return ret; } static string filterMarkdown(I)(I text) { import vibe.textfilter.markdown : markdown = filterMarkdown; // TODO: indent return markdown(text); } static string filterHtmlescape(I)(I text) { import vibe.textfilter.html : htmlEscape; // TODO: indent return htmlEscape(text); } static this() { filters["css"] = (input, scope output) { output(filterCss(input)); }; filters["javascript"] = (input, scope output) { output(filterJavascript(input)); }; filters["markdown"] = (input, scope output) { output(filterMarkdown(cast(string)input)); }; filters["htmlescape"] = (input, scope output) { output(filterHtmlescape(input)); }; } static FilterCallback[string] filters; } unittest { static string compile(string diet)() { import std.array : appender; import std.string : strip; import diet.html : compileHTMLDietString; auto dst = appender!string; dst.compileHTMLDietString!(diet, DefaultFilters); return strip(cast(string)(dst.data)); } assert(compile!":css .test" == "<style type=\"text/css\"><!--\n\t.test\n--></style>"); assert(compile!":javascript test();" == "<script type=\"application/javascript\">\n\t//<![CDATA[\n\ttest();\n\t//]]>\n</script>"); assert(compile!":markdown **test**" == "<p><strong>test</strong>\n</p>"); assert(compile!":htmlescape <test>" == "&lt;test&gt;"); assert(compile!":css !{\".test\"}" == "<style type=\"text/css\"><!--\n\t.test\n--></style>"); assert(compile!":javascript !{\"test();\"}" == "<script type=\"application/javascript\">\n\t//<![CDATA[\n\ttest();\n\t//]]>\n</script>"); assert(compile!":markdown !{\"**test**\"}" == "<p><strong>test</strong>\n</p>"); assert(compile!":htmlescape !{\"<test>\"}" == "&lt;test&gt;"); assert(compile!":javascript\n\ttest();" == "<script type=\"application/javascript\">\n\t//<![CDATA[\n\ttest();\n\t//]]>\n</script>"); } } /** Creates a HTTPServerRequest suitable for writing unit tests. */ HTTPServerRequest createTestHTTPServerRequest(URL url, HTTPMethod method = HTTPMethod.GET, InputStream data = null) @safe { InetHeaderMap headers; return createTestHTTPServerRequest(url, method, headers, data); } /// ditto HTTPServerRequest createTestHTTPServerRequest(URL url, HTTPMethod method, InetHeaderMap headers, InputStream data = null) @safe { auto tls = url.schema == "https"; auto ret = new HTTPServerRequest(Clock.currTime(UTC()), url.port ? url.port : tls ? 443 : 80); ret.path = url.pathString; ret.queryString = url.queryString; ret.username = url.username; ret.password = url.password; ret.requestURL = url.localURI; ret.method = method; ret.tls = tls; ret.headers = headers; ret.bodyReader = data; return ret; } /** Creates a HTTPServerResponse suitable for writing unit tests. */ HTTPServerResponse createTestHTTPServerResponse(OutputStream data_sink = null, SessionStore session_store = null) @safe { import vibe.stream.wrapper; HTTPServerSettings settings; if (session_store) { settings = new HTTPServerSettings; settings.sessionStore = session_store; } if (!data_sink) data_sink = new NullOutputStream; auto stream = createProxyStream(null, data_sink); auto ret = new HTTPServerResponse(stream, null, settings, () @trusted { return processAllocator(); } ()); return ret; } /**************************************************************************************************/ /* Public types */ /**************************************************************************************************/ /// Delegate based request handler alias HTTPServerRequestDelegate = void delegate(HTTPServerRequest req, HTTPServerResponse res) @safe; /// Static function based request handler alias HTTPServerRequestFunction = void function(HTTPServerRequest req, HTTPServerResponse res) @safe; /// Interface for class based request handlers interface HTTPServerRequestHandler { /// Handles incoming HTTP requests void handleRequest(HTTPServerRequest req, HTTPServerResponse res) @safe ; } /// Delegate based request handler with scoped parameters alias HTTPServerRequestDelegateS = void delegate(scope HTTPServerRequest req, scope HTTPServerResponse res) @safe; /// Static function based request handler with scoped parameters alias HTTPServerRequestFunctionS = void function(scope HTTPServerRequest req, scope HTTPServerResponse res) @safe; /// Interface for class based request handlers with scoped parameters interface HTTPServerRequestHandlerS { /// Handles incoming HTTP requests void handleRequest(scope HTTPServerRequest req, scope HTTPServerResponse res) @safe; } unittest { static assert(is(HTTPServerRequestDelegateS : HTTPServerRequestDelegate)); static assert(is(HTTPServerRequestFunctionS : HTTPServerRequestFunction)); } /// Aggregates all information about an HTTP error status. final class HTTPServerErrorInfo { /// The HTTP status code int code; /// The error message string message; /// Extended error message with debug information such as a stack trace string debugMessage; /// The error exception, if any Throwable exception; } /// Delegate type used for user defined error page generator callbacks. alias HTTPServerErrorPageHandler = void delegate(HTTPServerRequest req, HTTPServerResponse res, HTTPServerErrorInfo error) @safe; /** Specifies optional features of the HTTP server. Disabling unneeded features can speed up the server or reduce its memory usage. Note that the options parseFormBody, parseJsonBody and parseMultiPartBody will also drain the HTTPServerRequest.bodyReader stream whenever a request body with form or JSON data is encountered. */ enum HTTPServerOption { none = 0, /// Fills the .path, .queryString fields in the request parseURL = 1<<0, /// Fills the .query field in the request parseQueryString = 1<<1 | parseURL, /// Fills the .form field in the request parseFormBody = 1<<2, /// Fills the .json field in the request parseJsonBody = 1<<3, /// Enables use of the .nextPart() method in the request parseMultiPartBody = 1<<4, // todo /// Fills the .cookies field in the request parseCookies = 1<<5, /// Distributes request processing among worker threads distribute = 1<<6, /** Enables stack traces (HTTPServerErrorInfo.debugMessage). Note that generating the stack traces are generally a costly operation that should usually be avoided in production environments. It can also reveal internal information about the application, such as function addresses, which can help an attacker to abuse possible security holes. */ errorStackTraces = 1<<7, /// Enable port reuse in listenTCP() reusePort = 1<<8, /** The default set of options. Includes all options, except for distribute. */ defaults = parseURL | parseQueryString | parseFormBody | parseJsonBody | parseMultiPartBody | parseCookies | errorStackTraces, /// deprecated None = none, /// deprecated ParseURL = parseURL, /// deprecated ParseQueryString = parseQueryString, /// deprecated ParseFormBody = parseFormBody, /// deprecated ParseJsonBody = parseJsonBody, /// deprecated ParseMultiPartBody = parseMultiPartBody, /// deprecated ParseCookies = parseCookies } /** Contains all settings for configuring a basic HTTP server. The defaults are sufficient for most normal uses. */ final class HTTPServerSettings { /** The port on which the HTTP server is listening. The default value is 80. If you are running a TLS enabled server you may want to set this to 443 instead. */ ushort port = 80; /** The interfaces on which the HTTP server is listening. By default, the server will listen on all IPv4 and IPv6 interfaces. */ string[] bindAddresses = ["::", "0.0.0.0"]; /** Determines the server host name. If multiple servers are listening on the same port, the host name will determine which one gets a request. */ string hostName; /** Configures optional features of the HTTP server Disabling unneeded features can improve performance or reduce the server load in case of invalid or unwanted requests (DoS). By default, HTTPServerOption.defaults is used. */ HTTPServerOption options = HTTPServerOption.defaults; /** Time of a request after which the connection is closed with an error; not supported yet The default limit of 0 means that the request time is not limited. */ Duration maxRequestTime;// = dur!"seconds"(0); /** Maximum time between two request on a keep-alive connection The default value is 10 seconds. */ Duration keepAliveTimeout;// = dur!"seconds"(10); /// Maximum number of transferred bytes per request after which the connection is closed with /// an error ulong maxRequestSize = 2097152; /// Maximum number of transferred bytes for the request header. This includes the request line /// the url and all headers. ulong maxRequestHeaderSize = 8192; /// Sets a custom handler for displaying error pages for HTTP errors @property HTTPServerErrorPageHandler errorPageHandler() @safe { return errorPageHandler_; } /// ditto @property void errorPageHandler(HTTPServerErrorPageHandler del) @safe { errorPageHandler_ = del; } /// ditto deprecated("Use an @safe error handler instead.") @property void errorPageHandler(void delegate(HTTPServerRequest, HTTPServerResponse, HTTPServerErrorInfo) @system del) @safe { this.errorPageHandler = (req, res, err) @trusted { del(req, res, err); }; } private HTTPServerErrorPageHandler errorPageHandler_ = null; /// If set, a HTTPS server will be started instead of plain HTTP. TLSContext tlsContext; /// Session management is enabled if a session store instance is provided SessionStore sessionStore; string sessionIdCookie = "vibe.session_id"; /// import vibe.core.core : vibeVersionString; string serverString = "vibe.d/" ~ vibeVersionString; /** Specifies the format used for the access log. The log format is given using the Apache server syntax. By default NCSA combined is used. --- "%h - %u %t \"%r\" %s %b \"%{Referer}i\" \"%{User-Agent}i\"" --- */ string accessLogFormat = "%h - %u %t \"%r\" %s %b \"%{Referer}i\" \"%{User-Agent}i\""; /// Spefifies the name of a file to which access log messages are appended. string accessLogFile = ""; /// If set, access log entries will be output to the console. bool accessLogToConsole = false; /** Specifies a custom access logger instance. */ HTTPLogger accessLogger; /// Returns a duplicate of the settings object. @property HTTPServerSettings dup() @safe { auto ret = new HTTPServerSettings; foreach (mem; __traits(allMembers, HTTPServerSettings)) { static if (mem == "sslContext") {} else static if (mem == "bindAddresses") ret.bindAddresses = bindAddresses.dup; else static if (__traits(compiles, __traits(getMember, ret, mem) = __traits(getMember, this, mem))) __traits(getMember, ret, mem) = __traits(getMember, this, mem); } return ret; } /// Disable support for VibeDist and instead start listening immediately. bool disableDistHost = false; /** Responds to "Accept-Encoding" by using compression if possible. Compression can also be manually enabled by setting the "Content-Encoding" header of the HTTP response appropriately before sending the response body. This setting is disabled by default. Also note that there are still some known issues with the GZIP compression code. */ bool useCompressionIfPossible = false; /** Interval between WebSocket ping frames. The default value is 60 seconds; set to Duration.zero to disable pings. */ Duration webSocketPingInterval;// = dur!"seconds"(60); this() @safe { // need to use the contructor because the Ubuntu 13.10 GDC cannot CTFE dur() maxRequestTime = 0.seconds; keepAliveTimeout = 10.seconds; webSocketPingInterval = 60.seconds; } } /** Options altering how sessions are created. Multiple values can be or'ed together. See_Also: HTTPServerResponse.startSession */ enum SessionOption { /// No options. none = 0, /** Instructs the browser to disallow accessing the session ID from JavaScript. See_Also: Cookie.httpOnly */ httpOnly = 1<<0, /** Instructs the browser to disallow sending the session ID over unencrypted connections. By default, the type of the connection on which the session is started will be used to determine if secure or noSecure is used. See_Also: noSecure, Cookie.secure */ secure = 1<<1, /** Instructs the browser to allow sending the session ID over unencrypted connections. By default, the type of the connection on which the session is started will be used to determine if secure or noSecure is used. See_Also: secure, Cookie.secure */ noSecure = 1<<2 } /** Represents a HTTP request as received by the server side. */ final class HTTPServerRequest : HTTPRequest { private { SysTime m_timeCreated; HTTPServerSettings m_settings; ushort m_port; } public { /// The IP address of the client string peer; /// ditto NetworkAddress clientAddress; /// Determines if the request should be logged to the access log file. bool noLog; /// Determines if the request was issued over an TLS encrypted channel. bool tls; /** Information about the TLS certificate provided by the client. Remarks: This field is only set if `tls` is true, and the peer presented a client certificate. */ TLSCertificateInformation clientCertificate; /** The _path part of the URL. Remarks: This field is only set if HTTPServerOption.parseURL is set. */ string path; /** The user name part of the URL, if present. Remarks: This field is only set if HTTPServerOption.parseURL is set. */ string username; /** The _password part of the URL, if present. Remarks: This field is only set if HTTPServerOption.parseURL is set. */ string password; /** The _query string part of the URL. Remarks: This field is only set if HTTPServerOption.parseURL is set. */ string queryString; /** Contains the list of _cookies that are stored on the client. Note that the a single cookie name may occur multiple times if multiple cookies have that name but different paths or domains that all match the request URI. By default, the first cookie will be returned, which is the or one of the cookies with the closest path match. Remarks: This field is only set if HTTPServerOption.parseCookies is set. */ CookieValueMap cookies; /** Contains all _form fields supplied using the _query string. The fields are stored in the same order as they are received. Remarks: This field is only set if HTTPServerOption.parseQueryString is set. */ FormFields query; import vibe.utils.dictionarylist; /** A map of general parameters for the request. This map is supposed to be used by middleware functionality to store information for later stages. For example vibe.http.router.URLRouter uses this map to store the value of any named placeholders. */ DictionaryList!(string, true, 8) params; /** Supplies the request body as a stream. Note that when certain server options are set (such as HTTPServerOption.parseJsonBody) and a matching request was sent, the returned stream will be empty. If needed, remove those options and do your own processing of the body when launching the server. HTTPServerOption has a list of all options that affect the request body. */ InputStream bodyReader; /** Contains the parsed Json for a JSON request. Remarks: This field is only set if HTTPServerOption.parseJsonBody is set. A JSON request must have the Content-Type "application/json" or "application/vnd.api+json". */ Json json; /** Contains the parsed parameters of a HTML POST _form request. The fields are stored in the same order as they are received. Remarks: This field is only set if HTTPServerOption.parseFormBody is set. A form request must either have the Content-Type "application/x-www-form-urlencoded" or "multipart/form-data". */ FormFields form; /** Contains information about any uploaded file for a HTML _form request. Remarks: This field is only set if HTTPServerOption.parseFormBody is set and if the Content-Type is "multipart/form-data". */ FilePartFormFields files; /** The current Session object. This field is set if HTTPServerResponse.startSession() has been called on a previous response and if the client has sent back the matching cookie. Remarks: Requires the HTTPServerOption.parseCookies option. */ Session session; } package { /** The settings of the server serving this request. */ @property const(HTTPServerSettings) serverSettings() const @safe { return m_settings; } } this(SysTime time, ushort port) @safe { m_timeCreated = time.toUTC(); m_port = port; } /** Time when this request started processing. */ @property inout(SysTime) timeCreated() inout @safe { return m_timeCreated; } /** The full URL that corresponds to this request. The host URL includes the protocol, host and optionally the user and password that was used for this request. This field is useful to construct self referencing URLs. Note that the port is currently not set, so that this only works if the standard port is used. */ @property URL fullURL() const @safe { URL url; auto xfh = this.headers.get("X-Forwarded-Host"); auto xfp = this.headers.get("X-Forwarded-Port"); auto xfpr = this.headers.get("X-Forwarded-Proto"); // Set URL host segment. if (xfh.length) { url.host = xfh; } else if (!this.host.empty) { url.host = this.host; } else if (!m_settings.hostName.empty) { url.host = m_settings.hostName; } else { url.host = m_settings.bindAddresses[0]; } // Set URL schema segment. if (xfpr.length) { url.schema = xfpr; } else if (this.tls) { url.schema = "https"; } else { url.schema = "http"; } // Set URL port segment. if (xfp.length) { try { url.port = xfp.to!ushort; } catch (ConvException) { // TODO : Consider responding with a 400/etc. error from here. logWarn("X-Forwarded-Port header was not valid port (%s)", xfp); } } else if (!xfh) { if (url.schema == "https") { if (m_port != 443U) url.port = m_port; } else { if (m_port != 80U) url.port = m_port; } } url.host = url.host.split(":")[0]; url.username = this.username; url.password = this.password; url.path = Path(path); url.queryString = queryString; return url; } /** The relative path to the root folder. Using this function instead of absolute URLs for embedded links can be useful to avoid dead link when the site is piped through a reverse-proxy. The returned string always ends with a slash. */ @property string rootDir() const @safe { if (path.length == 0) return "./"; auto depth = count(path[1 .. $], '/'); return depth == 0 ? "./" : replicate("../", depth); } } /** Represents a HTTP response as sent from the server side. */ final class HTTPServerResponse : HTTPResponse { private { InterfaceProxy!Stream m_conn; InterfaceProxy!ConnectionStream m_rawConnection; OutputStream m_bodyWriter; IAllocator m_requestAlloc; FreeListRef!ChunkedOutputStream m_chunkedBodyWriter; FreeListRef!CountingOutputStream m_countingWriter; FreeListRef!ZlibOutputStream m_zlibOutputStream; HTTPServerSettings m_settings; Session m_session; bool m_headerWritten = false; bool m_isHeadResponse = false; bool m_tls; SysTime m_timeFinalized; } static if (!is(Stream == InterfaceProxy!Stream)) { this(Stream conn, ConnectionStream raw_connection, HTTPServerSettings settings, IAllocator req_alloc) @safe { this(InterfaceProxy!Stream(conn), InterfaceProxy!ConnectionStream(raw_connection), settings, req_alloc); } } this(InterfaceProxy!Stream conn, InterfaceProxy!ConnectionStream raw_connection, HTTPServerSettings settings, IAllocator req_alloc) @safe { m_conn = conn; m_rawConnection = raw_connection; m_countingWriter = createCountingOutputStreamFL(conn); m_settings = settings; m_requestAlloc = req_alloc; } /** Returns the time at which the request was finalized. Note that this field will only be set after `finalize` has been called. */ @property SysTime timeFinalized() @safe { return m_timeFinalized; } /** Determines if the HTTP header has already been written. */ @property bool headerWritten() const @safe { return m_headerWritten; } /** Determines if the response does not need a body. */ bool isHeadResponse() const @safe { return m_isHeadResponse; } /** Determines if the response is sent over an encrypted connection. */ bool tls() const @safe { return m_tls; } /// Writes the entire response body at once. void writeBody(in ubyte[] data, string content_type = null) @safe { if (content_type != "") headers["Content-Type"] = content_type; headers["Content-Length"] = formatAlloc(m_requestAlloc, "%d", data.length); bodyWriter.write(data); } /// ditto void writeBody(string data, string content_type = "text/plain; charset=UTF-8") @safe { writeBody(cast(const(ubyte)[])data, content_type); } /// ditto void writeBody(in ubyte[] data, int status, string content_type = null) @safe { statusCode = status; writeBody(data, content_type); } /// ditto void writeBody(string data, int status, string content_type = "text/plain; charset=UTF-8") @safe { statusCode = status; writeBody(data, content_type); } /// ditto void writeBody(scope InputStream data, string content_type = null) @safe { if (content_type != "") headers["Content-Type"] = content_type; bodyWriter.write(data); } /** Writes the whole response body at once, without doing any further encoding. The caller has to make sure that the appropriate headers are set correctly (i.e. Content-Type and Content-Encoding). Note that the version taking a RandomAccessStream may perform additional optimizations such as sending a file directly from the disk to the network card using a DMA transfer. */ void writeRawBody(RandomAccessStream stream) @safe { assert(!m_headerWritten, "A body was already written!"); writeHeader(); if (m_isHeadResponse) return; auto bytes = stream.size - stream.tell(); m_conn.write(stream); m_countingWriter.increment(bytes); } /// ditto void writeRawBody(InputStream stream, size_t num_bytes = 0) @safe { assert(!m_headerWritten, "A body was already written!"); writeHeader(); if (m_isHeadResponse) return; if (num_bytes > 0) { m_conn.write(stream, num_bytes); m_countingWriter.increment(num_bytes); } else m_countingWriter.write(stream, num_bytes); } /// ditto void writeRawBody(RandomAccessStream stream, int status) @safe { statusCode = status; writeRawBody(stream); } /// ditto void writeRawBody(InputStream stream, int status, size_t num_bytes = 0) @safe { statusCode = status; writeRawBody(stream, num_bytes); } /// Writes a JSON message with the specified status void writeJsonBody(T)(T data, int status, bool allow_chunked = false) { statusCode = status; writeJsonBody(data, allow_chunked); } /// ditto void writeJsonBody(T)(T data, int status, string content_type, bool allow_chunked = false) { statusCode = status; writeJsonBody(data, content_type, allow_chunked); } /// ditto void writeJsonBody(T)(T data, string content_type, bool allow_chunked = false) { headers["Content-Type"] = content_type; writeJsonBody(data, allow_chunked); } /// ditto void writeJsonBody(T)(T data, bool allow_chunked = false) { doWriteJsonBody!(T, false)(data, allow_chunked); } /// ditto void writePrettyJsonBody(T)(T data, bool allow_chunked = false) { doWriteJsonBody!(T, true)(data, allow_chunked); } private void doWriteJsonBody(T, bool PRETTY)(T data, bool allow_chunked = false) { import std.traits; import vibe.stream.wrapper; static if (!is(T == Json) && is(typeof(data.data())) && isArray!(typeof(data.data()))) { static assert(!is(T == Appender!(typeof(data.data()))), "Passed an Appender!T to writeJsonBody - this is most probably not doing what's indended."); } if ("Content-Type" !in headers) headers["Content-Type"] = "application/json; charset=UTF-8"; // set an explicit content-length field if chunked encoding is not allowed if (!allow_chunked) { import vibe.internal.rangeutil; long length = 0; auto counter = RangeCounter(() @trusted { return &length; } ()); static if (PRETTY) serializeToPrettyJson(counter, data); else serializeToJson(counter, data); headers["Content-Length"] = formatAlloc(m_requestAlloc, "%d", length); } auto rng = StreamOutputRange(bodyWriter); static if (PRETTY) serializeToPrettyJson(() @trusted { return &rng; } (), data); else serializeToJson(() @trusted { return &rng; } (), data); } /** * Writes the response with no body. * * This method should be used in situations where no body is * requested, such as a HEAD request. For an empty body, just use writeBody, * as this method causes problems with some keep-alive connections. */ void writeVoidBody() @safe { if (!m_isHeadResponse) { assert("Content-Length" !in headers); assert("Transfer-Encoding" !in headers); } assert(!headerWritten); writeHeader(); m_conn.flush(); } /** A stream for writing the body of the HTTP response. Note that after 'bodyWriter' has been accessed for the first time, it is not allowed to change any header or the status code of the response. */ @property OutputStream bodyWriter() @safe { assert(!!m_conn); if (m_bodyWriter) return m_bodyWriter; assert(!m_headerWritten, "A void body was already written!"); if (m_isHeadResponse) { // for HEAD requests, we define a NullOutputWriter for convenience // - no body will be written. However, the request handler should call writeVoidBody() // and skip writing of the body in this case. if ("Content-Length" !in headers) headers["Transfer-Encoding"] = "chunked"; writeHeader(); m_bodyWriter = new NullOutputStream; return m_bodyWriter; } if ("Content-Encoding" in headers && "Content-Length" in headers) { // we do not known how large the compressed body will be in advance // so remove the content-length and use chunked transfer headers.remove("Content-Length"); } if (auto pcl = "Content-Length" in headers) { writeHeader(); m_countingWriter.writeLimit = (*pcl).to!ulong; m_bodyWriter = m_countingWriter; } else { headers["Transfer-Encoding"] = "chunked"; writeHeader(); m_chunkedBodyWriter = createChunkedOutputStreamFL(m_countingWriter); m_bodyWriter = m_chunkedBodyWriter; } if (auto pce = "Content-Encoding" in headers) { if (icmp2(*pce, "gzip") == 0) { m_zlibOutputStream = createGzipOutputStreamFL(m_bodyWriter); m_bodyWriter = m_zlibOutputStream; } else if (icmp2(*pce, "deflate") == 0) { m_zlibOutputStream = createDeflateOutputStreamFL(m_bodyWriter); m_bodyWriter = m_zlibOutputStream; } else { logWarn("Unsupported Content-Encoding set in response: '"~*pce~"'"); } } return m_bodyWriter; } /** Sends a redirect request to the client. Params: url = The URL to redirect to status = The HTTP redirect status (3xx) to send - by default this is $(D HTTPStatus.found) */ void redirect(string url, int status = HTTPStatus.Found) @safe { statusCode = status; headers["Location"] = url; writeBody("redirecting..."); } /// ditto void redirect(URL url, int status = HTTPStatus.Found) @safe { redirect(url.toString(), status); } /// @safe unittest { import vibe.http.router; void request_handler(HTTPServerRequest req, HTTPServerResponse res) { res.redirect("http://example.org/some_other_url"); } void test() { auto router = new URLRouter; router.get("/old_url", &request_handler); listenHTTP(new HTTPServerSettings, router); } } /** Special method sending a SWITCHING_PROTOCOLS response to the client. Notice: For the overload that returns a `ConnectionStream`, it must be ensured that the returned instance doesn't outlive the request handler callback. Params: protocol = The protocol set in the "Upgrade" header of the response. Use an empty string to skip setting this field. */ ConnectionStream switchProtocol(string protocol) @safe { statusCode = HTTPStatus.SwitchingProtocols; if (protocol.length) headers["Upgrade"] = protocol; writeVoidBody(); return createConnectionProxyStream(m_conn, m_rawConnection); } /// ditto void switchProtocol(string protocol, scope void delegate(scope ConnectionStream) @safe del) @safe { statusCode = HTTPStatus.SwitchingProtocols; if (protocol.length) headers["Upgrade"] = protocol; writeVoidBody(); () @trusted { auto conn = createConnectionProxyStreamFL(m_conn, m_rawConnection); del(conn); } (); finalize(); if (m_rawConnection && m_rawConnection.connected) m_rawConnection.close(); // connection not reusable after a protocol upgrade } /** Special method for handling CONNECT proxy tunnel Notice: For the overload that returns a `ConnectionStream`, it must be ensured that the returned instance doesn't outlive the request handler callback. */ ConnectionStream connectProxy() @safe { return createConnectionProxyStream(m_conn, m_rawConnection); } /// ditto void connectProxy(scope void delegate(scope ConnectionStream) @safe del) @safe { () @trusted { auto conn = createConnectionProxyStreamFL(m_conn, m_rawConnection); del(conn); } (); finalize(); m_rawConnection.close(); // connection not reusable after a protocol upgrade } /** Sets the specified cookie value. Params: name = Name of the cookie value = New cookie value - pass null to clear the cookie path = Path (as seen by the client) of the directory tree in which the cookie is visible */ Cookie setCookie(string name, string value, string path = "/", Cookie.Encoding encoding = Cookie.Encoding.url) @safe { auto cookie = new Cookie(); cookie.path = path; cookie.setValue(value, encoding); if (value is null) { cookie.maxAge = 0; cookie.expires = "Thu, 01 Jan 1970 00:00:00 GMT"; } cookies[name] = cookie; return cookie; } /** Initiates a new session. The session is stored in the SessionStore that was specified when creating the server. Depending on this, the session can be persistent or temporary and specific to this server instance. */ Session startSession(string path = "/", SessionOption options = SessionOption.httpOnly) @safe { assert(m_settings.sessionStore, "no session store set"); assert(!m_session, "Try to start a session, but already started one."); bool secure; if (options & SessionOption.secure) secure = true; else if (options & SessionOption.noSecure) secure = false; else secure = this.tls; m_session = m_settings.sessionStore.create(); m_session.set("$sessionCookiePath", path); m_session.set("$sessionCookieSecure", secure); auto cookie = setCookie(m_settings.sessionIdCookie, m_session.id, path); cookie.secure = secure; cookie.httpOnly = (options & SessionOption.httpOnly) != 0; return m_session; } /** Terminates the current session (if any). */ void terminateSession() @safe { if (!m_session) return; auto cookie = setCookie(m_settings.sessionIdCookie, null, m_session.get!string("$sessionCookiePath")); cookie.secure = m_session.get!bool("$sessionCookieSecure"); m_session.destroy(); m_session = Session.init; } @property ulong bytesWritten() @safe { return m_countingWriter.bytesWritten; } /** Waits until either the connection closes, data arrives, or until the given timeout is reached. Returns: $(D true) if the connection was closed and $(D false) if either the timeout was reached, or if data has arrived for consumption. See_Also: `connected` */ bool waitForConnectionClose(Duration timeout = Duration.max) @safe { if (!m_rawConnection || !m_rawConnection.connected) return true; m_rawConnection.waitForData(timeout); return !m_rawConnection.connected; } /** Determines if the underlying connection is still alive. Returns $(D true) if the remote peer is still connected and $(D false) if the remote peer closed the connection. See_Also: `waitForConnectionClose` */ @property bool connected() @safe { if (!m_rawConnection) return false; return m_rawConnection.connected; } /** Finalizes the response. This is usually called automatically by the server. This method can be called manually after writing the response to force all network traffic associated with the current request to be finalized. After the call returns, the `timeFinalized` property will be set. */ void finalize() @safe { if (m_zlibOutputStream) { m_zlibOutputStream.finalize(); m_zlibOutputStream.destroy(); } if (m_chunkedBodyWriter) { m_chunkedBodyWriter.finalize(); m_chunkedBodyWriter.destroy(); } // ignore exceptions caused by an already closed connection - the client // may have closed the connection already and this doesn't usually indicate // a problem. if (m_rawConnection && m_rawConnection.connected) { try if (m_conn) m_conn.flush(); catch (Exception e) logDebug("Failed to flush connection after finishing HTTP response: %s", e.msg); if (!isHeadResponse && bytesWritten < headers.get("Content-Length", "0").to!long) { logDebug("HTTP response only written partially before finalization. Terminating connection."); m_rawConnection.close(); } m_rawConnection = InterfaceProxy!ConnectionStream.init; } if (m_conn) { m_conn = InterfaceProxy!Stream.init; m_timeFinalized = Clock.currTime(UTC()); } } private void writeHeader() @safe { import vibe.stream.wrapper; assert(!m_bodyWriter && !m_headerWritten, "Try to write header after body has already begun."); m_headerWritten = true; auto dst = StreamOutputRange!(InterfaceProxy!Stream)(m_conn); void writeLine(T...)(string fmt, T args) @safe { formattedWrite(() @trusted { return &dst; } (), fmt, args); dst.put("\r\n"); logTrace(fmt, args); } logTrace("---------------------"); logTrace("HTTP server response:"); logTrace("---------------------"); // write the status line writeLine("%s %d %s", getHTTPVersionString(this.httpVersion), this.statusCode, this.statusPhrase.length ? this.statusPhrase : httpStatusText(this.statusCode)); // write all normal headers foreach (k, v; this.headers) { dst.put(k); dst.put(": "); dst.put(v); dst.put("\r\n"); logTrace("%s: %s", k, v); } logTrace("---------------------"); // write cookies foreach (n, cookie; this.cookies) { dst.put("Set-Cookie: "); cookie.writeString(() @trusted { return &dst; } (), n); dst.put("\r\n"); } // finalize response header dst.put("\r\n"); } } /** Represents the request listener for a specific `listenHTTP` call. This struct can be used to stop listening for HTTP requests at runtime. */ struct HTTPListener { private { size_t m_contextID; } private this(size_t id) @safe { m_contextID = id; } /** Stops handling HTTP requests and closes the TCP listening port if possible. */ void stopListening() @safe { import std.algorithm : countUntil; synchronized (() @trusted { return g_listenersMutex; } ()) { auto contexts = getContexts(); auto idx = contexts.countUntil!(c => c.id == m_contextID); if (idx < 0) return; // remove context entry auto ctx = getContexts()[idx]; removeContext(idx); // stop listening on all unused TCP ports auto port = ctx.settings.port; foreach (addr; ctx.settings.bindAddresses) { // any other context still occupying the same addr/port? if (getContexts().canFind!(c => c.settings.port == port && c.settings.bindAddresses.canFind(addr))) continue; auto lidx = () @trusted { return g_listeners; } ().countUntil!(l => l.bindAddress == addr && l.bindPort == port); if (lidx >= 0) { () @trusted { return g_listeners; } ()[lidx].listener.stopListening(); logInfo("Stopped to listen for HTTP%s requests on %s:%s", ctx.settings.tlsContext ? "S": "", addr, port); () @trusted { g_listeners = g_listeners[0 .. lidx] ~ g_listeners[lidx+1 .. $]; } (); } } } } } /**************************************************************************************************/ /* Private types */ /**************************************************************************************************/ private struct HTTPServerContext { HTTPServerRequestDelegate requestHandler; HTTPServerSettings settings; HTTPLogger[] loggers; size_t id; } private final class HTTPListenInfo { TCPListener listener; string bindAddress; ushort bindPort; TLSContext tlsContext; this(string bind_address, ushort bind_port, TLSContext tls_context) @safe { this.bindAddress = bind_address; this.bindPort = bind_port; this.tlsContext = tls_context; } } private enum MaxHTTPHeaderLineLength = 4096; private final class LimitedHTTPInputStream : LimitedInputStream { @safe: this(InterfaceProxy!InputStream stream, ulong byte_limit, bool silent_limit = false) { super(stream.asInterface!InputStream, byte_limit, silent_limit, true); } override void onSizeLimitReached() { throw new HTTPStatusException(HTTPStatus.requestEntityTooLarge); } } private final class TimeoutHTTPInputStream : InputStream { @safe: private { long m_timeref; long m_timeleft; InterfaceProxy!InputStream m_in; } this(InterfaceProxy!InputStream stream, Duration timeleft, SysTime reftime) { enforce(timeleft > dur!"seconds"(0), "Timeout required"); m_in = stream; m_timeleft = timeleft.total!"hnsecs"(); m_timeref = reftime.stdTime(); } @property bool empty() { enforce(m_in, "InputStream missing"); return m_in.empty(); } @property ulong leastSize() { enforce(m_in, "InputStream missing"); return m_in.leastSize(); } @property bool dataAvailableForRead() { enforce(m_in, "InputStream missing"); return m_in.dataAvailableForRead; } const(ubyte)[] peek() { return m_in.peek(); } void read(ubyte[] dst) { enforce(m_in, "InputStream missing"); checkTimeout(); m_in.read(dst); } private void checkTimeout() @safe { auto curr = Clock.currStdTime(); auto diff = curr - m_timeref; if (diff > m_timeleft) throw new HTTPStatusException(HTTPStatus.RequestTimeout); m_timeleft -= diff; m_timeref = curr; } } /**************************************************************************************************/ /* Private functions */ /**************************************************************************************************/ private { import core.sync.mutex; shared string s_distHost; shared ushort s_distPort = 11000; shared size_t g_contextIDCounter = 1; // protects g_listeners and *write* accesses to g_contexts __gshared Mutex g_listenersMutex; __gshared HTTPListenInfo[] g_listeners; // accessed for every request, needs to be kept thread-safe by only atomically assigning new // arrays (COW). shared immutable(HTTPServerContext)[] would be the right candidate here, but // is impractical due to type system limitations. align(16) shared HTTPServerContext[] g_contexts; HTTPServerContext[] getContexts() @trusted { static if (g_contexts.sizeof == 16 && has128BitCAS || g_contexts.sizeof == 8 && has64BitCAS) { return cast(HTTPServerContext[])atomicLoad(g_contexts); } else { synchronized (g_listenersMutex) return cast(HTTPServerContext[])g_contexts; } } void addContext(HTTPServerContext ctx) @trusted { static if (g_contexts.sizeof == 16 && has128BitCAS || g_contexts.sizeof == 8 && has64BitCAS) { // NOTE: could optimize this using a CAS, but not really worth it synchronized (g_listenersMutex) { atomicStore(g_contexts, g_contexts ~ cast(shared)ctx); } } else { synchronized (g_listenersMutex) { g_contexts = g_contexts ~ cast(shared)ctx; } } } void removeContext(size_t idx) @safe { // write a new complete array reference to avoid race conditions during removal auto contexts = g_contexts; auto newarr = contexts[0 .. idx] ~ contexts[idx+1 .. $]; () @trusted { atomicStore(g_contexts, newarr); } (); } } /** [private] Starts a HTTP server listening on the specified port. This is the same as listenHTTP() except that it does not use a VibeDist host for remote listening, even if specified on the command line. */ private void listenHTTPPlain(HTTPServerSettings settings) @safe { import std.algorithm : canFind; static TCPListener doListen(HTTPListenInfo listen_info, bool dist, bool reusePort) @safe { try { TCPListenOptions options = TCPListenOptions.defaults; if(dist) options |= TCPListenOptions.distribute; else options &= ~TCPListenOptions.distribute; if(reusePort) options |= TCPListenOptions.reusePort; else options &= ~TCPListenOptions.reusePort; auto ret = listenTCP(listen_info.bindPort, (TCPConnection conn) nothrow @safe { try handleHTTPConnection(conn, listen_info); catch (Exception e) { logError("HTTP connection hander has thrown: %s", e.msg); debug logDebug("Full error: %s", () @trusted { return e.toString().sanitize(); } ()); try conn.close(); catch (Exception e) logError("Failed to close connection: %s", e.msg); } }, listen_info.bindAddress, options); auto proto = listen_info.tlsContext ? "https" : "http"; auto urladdr = listen_info.bindAddress; if (urladdr.canFind(':')) urladdr = "["~urladdr~"]"; logInfo("Listening for requests on %s://%s:%s/", proto, urladdr, listen_info.bindPort); return ret; } catch( Exception e ) { logWarn("Failed to listen on %s:%s", listen_info.bindAddress, listen_info.bindPort); return TCPListener.init; } } void addVHost(ref HTTPListenInfo lst) @safe { TLSContext onSNI(string servername) @safe { foreach (ctx; getContexts()) if (ctx.settings.bindAddresses.canFind(lst.bindAddress) && ctx.settings.port == lst.bindPort && ctx.settings.hostName.icmp(servername) == 0) { logDebug("Found context for SNI host '%s'.", servername); return ctx.settings.tlsContext; } logDebug("No context found for SNI host '%s'.", servername); return null; } if (settings.tlsContext !is lst.tlsContext && lst.tlsContext.kind != TLSContextKind.serverSNI) { logDebug("Create SNI TLS context for %s, port %s", lst.bindAddress, lst.bindPort); lst.tlsContext = createTLSContext(TLSContextKind.serverSNI); lst.tlsContext.sniCallback = &onSNI; } foreach (ctx; getContexts()) { if (ctx.settings.port != settings.port) continue; if (!ctx.settings.bindAddresses.canFind(lst.bindAddress)) continue; /*enforce(ctx.settings.hostName != settings.hostName, "A server with the host name '"~settings.hostName~"' is already " "listening on "~addr~":"~to!string(settings.port)~".");*/ } } bool any_successful = false; synchronized (() @trusted { return g_listenersMutex; } ()) { // Check for every bind address/port, if a new listening socket needs to be created and // check for conflicting servers foreach (addr; settings.bindAddresses) { bool found_listener = false; foreach (i, ref lst; () @trusted { return g_listeners; } ()) { if (lst.bindAddress == addr && lst.bindPort == settings.port) { addVHost(lst); assert(!settings.tlsContext || settings.tlsContext is lst.tlsContext || lst.tlsContext.kind == TLSContextKind.serverSNI, format("Got multiple overlapping TLS bind addresses (port %s), but no SNI TLS context!?", settings.port)); found_listener = true; any_successful = true; break; } } if (!found_listener) { auto linfo = new HTTPListenInfo(addr, settings.port, settings.tlsContext); if (auto tcp_lst = doListen(linfo, (settings.options & HTTPServerOption.distribute) != 0, (settings.options & HTTPServerOption.reusePort) != 0)) // DMD BUG 2043 { linfo.listener = tcp_lst; found_listener = true; any_successful = true; () @trusted { g_listeners ~= linfo; } (); } } if (settings.hostName.length) { auto proto = settings.tlsContext ? "https" : "http"; auto port = settings.tlsContext && settings.port == 443 || !settings.tlsContext && settings.port == 80 ? "" : ":" ~ settings.port.to!string; logInfo("Added virtual host %s://%s%s/ (%s)", proto, settings.hostName, port, addr); } } } enforce(any_successful, "Failed to listen for incoming HTTP connections on any of the supplied interfaces."); } private void handleHTTPConnection(TCPConnection connection, HTTPListenInfo listen_info) @safe { InterfaceProxy!Stream http_stream; http_stream = connection; // Set NODELAY to true, to avoid delays caused by sending the response // header and body in separate chunks. Note that to avoid other performance // issues (caused by tiny packets), this requires using an output buffer in // the event driver, which is the case at least for the default libevent // based driver. connection.tcpNoDelay = true; version(VibeNoSSL) {} else { import std.traits : ReturnType; ReturnType!(createTLSStreamFL!(typeof(http_stream))) tls_stream; } if (!connection.waitForData(10.seconds())) { logDebug("Client didn't send the initial request in a timely manner. Closing connection."); return; } // If this is a HTTPS server, initiate TLS if (listen_info.tlsContext) { version (VibeNoSSL) assert(false, "No TLS support compiled in (VibeNoSSL)"); else { logDebug("Accept TLS connection: %s", listen_info.tlsContext.kind); // TODO: reverse DNS lookup for peer_name of the incoming connection for TLS client certificate verification purposes tls_stream = createTLSStreamFL(http_stream, listen_info.tlsContext, TLSStreamState.accepting, null, connection.remoteAddress); http_stream = tls_stream; } } while (!connection.empty) { HTTPServerSettings settings; bool keep_alive; () @trusted { import std.algorithm.comparison : max; auto request_allocator_s = AllocatorList!((n) => Region!GCAllocator(max(n, 1024)), NullAllocator).init; scope request_allocator = request_allocator_s.allocatorObject; handleRequest(http_stream, connection, listen_info, settings, keep_alive, request_allocator); } (); if (!keep_alive) { logTrace("No keep-alive - disconnecting client."); break; } logTrace("Waiting for next request..."); // wait for another possible request on a keep-alive connection if (!connection.waitForData(settings.keepAliveTimeout)) { if (!connection.connected) logTrace("Client disconnected."); else logDebug("Keep-alive connection timed out!"); break; } } logTrace("Done handling connection."); } private bool handleRequest(InterfaceProxy!Stream http_stream, TCPConnection tcp_connection, HTTPListenInfo listen_info, ref HTTPServerSettings settings, ref bool keep_alive, scope IAllocator request_allocator) @safe { import std.algorithm.searching : canFind; SysTime reqtime = Clock.currTime(UTC()); // some instances that live only while the request is running FreeListRef!HTTPServerRequest req = FreeListRef!HTTPServerRequest(reqtime, listen_info.bindPort); FreeListRef!TimeoutHTTPInputStream timeout_http_input_stream; FreeListRef!LimitedHTTPInputStream limited_http_input_stream; FreeListRef!ChunkedInputStream chunked_input_stream; // store the IP address (IPv4 addresses forwarded over IPv6 are stored in IPv4 format) auto peer_address_string = tcp_connection.peerAddress; if (peer_address_string.startsWith("::ffff:") && peer_address_string[7 .. $].indexOf(":") < 0) req.peer = peer_address_string[7 .. $]; else req.peer = peer_address_string; req.clientAddress = tcp_connection.remoteAddress; // Default to the first virtual host for this listener HTTPServerRequestDelegate request_task; HTTPServerContext context; foreach (ctx; getContexts()) if (ctx.settings.port == listen_info.bindPort) { bool found = false; foreach (addr; ctx.settings.bindAddresses) if (addr == listen_info.bindAddress) found = true; if (!found) continue; context = ctx; settings = ctx.settings; request_task = ctx.requestHandler; break; } if (!settings) { logWarn("Didn't find a HTTP listening context for incoming connection. Dropping."); keep_alive = false; return false; } // temporarily set to the default settings, the virtual host specific settings will be set further down req.m_settings = settings; // Create the response object InterfaceProxy!ConnectionStream cproxy = tcp_connection; auto res = FreeListRef!HTTPServerResponse(http_stream, cproxy, settings, request_allocator/*.Scoped_payload*/); req.tls = res.m_tls = listen_info.tlsContext !is null; if (req.tls) { static if (is(InterfaceProxy!ConnectionStream == ConnectionStream)) req.clientCertificate = (cast(TLSStream)http_stream).peerCertificate; else req.clientCertificate = http_stream.extract!(FreeListRef!TLSStream).peerCertificate; } // Error page handler void errorOut(int code, string msg, string debug_msg, Throwable ex) @safe { assert(!res.headerWritten); // stack traces sometimes contain random bytes - make sure they are replaced debug_msg = sanitizeUTF8(cast(const(ubyte)[])debug_msg); res.statusCode = code; if (settings && settings.errorPageHandler) { /*scope*/ auto err = new HTTPServerErrorInfo; err.code = code; err.message = msg; err.debugMessage = debug_msg; err.exception = ex; settings.errorPageHandler_(req, res, err); } else { if (debug_msg.length) res.writeBody(format("%s - %s\n\n%s\n\nInternal error information:\n%s", code, httpStatusText(code), msg, debug_msg)); else res.writeBody(format("%s - %s\n\n%s", code, httpStatusText(code), msg)); } assert(res.headerWritten); } bool parsed = false; /*bool*/ keep_alive = false; // parse the request try { logTrace("reading request.."); // limit the total request time InterfaceProxy!InputStream reqReader = http_stream; if (settings.maxRequestTime > dur!"seconds"(0) && settings.maxRequestTime != Duration.max) { timeout_http_input_stream = FreeListRef!TimeoutHTTPInputStream(reqReader, settings.maxRequestTime, reqtime); reqReader = timeout_http_input_stream; } // basic request parsing parseRequestHeader(req, reqReader, request_allocator, settings.maxRequestHeaderSize); logTrace("Got request header."); // find the matching virtual host string reqhost; ushort reqport = 0; { string s = req.host; enforceHTTP(s.length > 0 || req.httpVersion <= HTTPVersion.HTTP_1_0, HTTPStatus.badRequest, "Missing Host header."); if (s.startsWith('[')) { // IPv6 address auto idx = s.indexOf(']'); enforce(idx > 0, "Missing closing ']' for IPv6 address."); reqhost = s[1 .. idx]; s = s[idx+1 .. $]; } else if (s.length) { // host name or IPv4 address auto idx = s.indexOf(':'); if (idx < 0) idx = s.length; enforceHTTP(idx > 0, HTTPStatus.badRequest, "Missing Host header."); reqhost = s[0 .. idx]; s = s[idx .. $]; } if (s.startsWith(':')) reqport = s[1 .. $].to!ushort; } foreach (ctx; getContexts()) if (icmp2(ctx.settings.hostName, reqhost) == 0 && (!reqport || reqport == ctx.settings.port)) { if (ctx.settings.port != listen_info.bindPort) continue; bool found = false; foreach (addr; ctx.settings.bindAddresses) if (addr == listen_info.bindAddress) found = true; if (!found) continue; context = ctx; settings = ctx.settings; request_task = ctx.requestHandler; break; } req.m_settings = settings; res.m_settings = settings; // setup compressed output if (settings.useCompressionIfPossible) { if (auto pae = "Accept-Encoding" in req.headers) { if (canFind(*pae, "gzip")) { res.headers["Content-Encoding"] = "gzip"; } else if (canFind(*pae, "deflate")) { res.headers["Content-Encoding"] = "deflate"; } } } // limit request size if (auto pcl = "Content-Length" in req.headers) { string v = *pcl; auto contentLength = parse!ulong(v); // DMDBUG: to! thinks there is a H in the string enforceBadRequest(v.length == 0, "Invalid content-length"); enforceBadRequest(settings.maxRequestSize <= 0 || contentLength <= settings.maxRequestSize, "Request size too big"); limited_http_input_stream = FreeListRef!LimitedHTTPInputStream(reqReader, contentLength); } else if (auto pt = "Transfer-Encoding" in req.headers) { enforceBadRequest(icmp(*pt, "chunked") == 0); chunked_input_stream = createChunkedInputStreamFL(reqReader); InterfaceProxy!InputStream ciproxy = chunked_input_stream; limited_http_input_stream = FreeListRef!LimitedHTTPInputStream(ciproxy, settings.maxRequestSize, true); } else { limited_http_input_stream = FreeListRef!LimitedHTTPInputStream(reqReader, 0); } req.bodyReader = limited_http_input_stream; // handle Expect header if (auto pv = "Expect" in req.headers) { if (icmp2(*pv, "100-continue") == 0) { logTrace("sending 100 continue"); http_stream.write("HTTP/1.1 100 Continue\r\n\r\n"); } } // URL parsing if desired if (settings.options & HTTPServerOption.parseURL) { auto url = URL.parse(req.requestURL); req.path = urlDecode(url.pathString); req.queryString = url.queryString; req.username = url.username; req.password = url.password; } // query string parsing if desired if (settings.options & HTTPServerOption.parseQueryString) { if (!(settings.options & HTTPServerOption.parseURL)) logWarn("Query string parsing requested but URL parsing is disabled!"); parseURLEncodedForm(req.queryString, req.query); } // cookie parsing if desired if (settings.options & HTTPServerOption.parseCookies) { auto pv = "cookie" in req.headers; if (pv) parseCookies(*pv, req.cookies); } // lookup the session if (settings.sessionStore) { // use the first cookie that contains a valid session ID in case // of multiple matching session cookies foreach (val; req.cookies.getAll(settings.sessionIdCookie)) { req.session = settings.sessionStore.open(val); res.m_session = req.session; if (req.session) break; } } if (settings.options & HTTPServerOption.parseFormBody) { auto ptype = "Content-Type" in req.headers; if (ptype) parseFormData(req.form, req.files, *ptype, req.bodyReader, MaxHTTPHeaderLineLength); } if (settings.options & HTTPServerOption.parseJsonBody) { if (icmp2(req.contentType, "application/json") == 0 || icmp2(req.contentType, "application/vnd.api+json") == 0 ) { auto bodyStr = () @trusted { return cast(string)req.bodyReader.readAll(); } (); if (!bodyStr.empty) req.json = parseJson(bodyStr); } } // write default headers if (req.method == HTTPMethod.HEAD) res.m_isHeadResponse = true; if (settings.serverString.length) res.headers["Server"] = settings.serverString; res.headers["Date"] = formatRFC822DateAlloc(request_allocator, reqtime); if (req.persistent) res.headers["Keep-Alive"] = formatAlloc(request_allocator, "timeout=%d", settings.keepAliveTimeout.total!"seconds"()); // finished parsing the request parsed = true; logTrace("persist: %s", req.persistent); keep_alive = req.persistent; // handle the request logTrace("handle request (body %d)", req.bodyReader.leastSize); res.httpVersion = req.httpVersion; request_task(req, res); // if no one has written anything, return 404 if (!res.headerWritten) { string dbg_msg; logDiagnostic("No response written for %s", req.requestURL); if (settings.options & HTTPServerOption.errorStackTraces) dbg_msg = format("No routes match path '%s'", req.requestURL); errorOut(HTTPStatus.notFound, httpStatusText(HTTPStatus.notFound), dbg_msg, null); } } catch (HTTPStatusException err) { string dbg_msg; if (settings.options & HTTPServerOption.errorStackTraces) { if (err.debugMessage != "") dbg_msg = err.debugMessage; else dbg_msg = () @trusted { return err.toString().sanitize; } (); } if (!res.headerWritten) errorOut(err.status, err.msg, dbg_msg, err); else logDiagnostic("HTTPSterrorOutatusException while writing the response: %s", err.msg); debug logDebug("Exception while handling request %s %s: %s", req.method, req.requestURL, () @trusted { return err.toString().sanitize; } ()); if (!parsed || res.headerWritten || justifiesConnectionClose(err.status)) keep_alive = false; } catch (UncaughtException e) { auto status = parsed ? HTTPStatus.internalServerError : HTTPStatus.badRequest; string dbg_msg; if (settings.options & HTTPServerOption.errorStackTraces) dbg_msg = () @trusted { return e.toString().sanitize; } (); if (!res.headerWritten && tcp_connection.connected) errorOut(status, httpStatusText(status), dbg_msg, e); else logDiagnostic("Error while writing the response: %s", e.msg); debug logDebug("Exception while handling request %s %s: %s", req.method, req.requestURL, () @trusted { return e.toString().sanitize(); } ()); if (!parsed || res.headerWritten || !cast(Exception)e) keep_alive = false; } if (tcp_connection.connected) { if (req.bodyReader && !req.bodyReader.empty) { nullSink.write(req.bodyReader); logTrace("dropped body"); } } // finalize (e.g. for chunked encoding) res.finalize(); foreach (k, v ; req.files) { if (existsFile(v.tempPath)) { removeFile(v.tempPath); logDebug("Deleted upload tempfile %s", v.tempPath.toString()); } } if (!req.noLog) { // log the request to access log foreach (log; context.loggers) log.log(req, res); } //logTrace("return %s (used pool memory: %s/%s)", keep_alive, request_allocator.allocatedSize, request_allocator.totalSize); logTrace("return %s", keep_alive); return keep_alive != false; } private void parseRequestHeader(InputStream)(HTTPServerRequest req, InputStream http_stream, IAllocator alloc, ulong max_header_size) if (isInputStream!InputStream) { auto stream = FreeListRef!LimitedHTTPInputStream(http_stream, max_header_size); logTrace("HTTP server reading status line"); auto reqln = () @trusted { return cast(string)stream.readLine(MaxHTTPHeaderLineLength, "\r\n", alloc); }(); logTrace("--------------------"); logTrace("HTTP server request:"); logTrace("--------------------"); logTrace("%s", reqln); //Method auto pos = reqln.indexOf(' '); enforceBadRequest(pos >= 0, "invalid request method"); req.method = httpMethodFromString(reqln[0 .. pos]); reqln = reqln[pos+1 .. $]; //Path pos = reqln.indexOf(' '); enforceBadRequest(pos >= 0, "invalid request path"); req.requestURL = reqln[0 .. pos]; reqln = reqln[pos+1 .. $]; req.httpVersion = parseHTTPVersion(reqln); //headers parseRFC5322Header(stream, req.headers, MaxHTTPHeaderLineLength, alloc, false); foreach (k, v; req.headers) logTrace("%s: %s", k, v); logTrace("--------------------"); } private void parseCookies(string str, ref CookieValueMap cookies) @safe { import std.encoding : sanitize; import std.array : split; import std.string : strip; import std.algorithm.iteration : map, filter, each; import vibe.http.common : Cookie; () @trusted { return str.sanitize; } () .split(";") .map!(kv => kv.strip.split("=")) .filter!(kv => kv.length == 2) //ignore illegal cookies .each!(kv => cookies.add(kv[0], kv[1], Cookie.Encoding.raw) ); } unittest { auto cvm = CookieValueMap(); parseCookies("foo=bar;; baz=zinga; öö=üü ; møøse=was=sacked; onlyval1; =onlyval2; onlykey=", cvm); assert(cvm["foo"] == "bar"); assert(cvm["baz"] == "zinga"); assert(cvm["öö"] == "üü"); assert( "møøse" ! in cvm); //illegal cookie gets ignored assert( "onlyval1" ! in cvm); //illegal cookie gets ignored assert(cvm["onlykey"] == ""); assert(cvm[""] == "onlyval2"); assert(cvm.length() == 5); cvm = CookieValueMap(); parseCookies("", cvm); assert(cvm.length() == 0); cvm = CookieValueMap(); parseCookies(";;=", cvm); assert(cvm.length() == 1); assert(cvm[""] == ""); } shared static this() { g_listenersMutex = new Mutex; version (VibeNoDefaultArgs) {} else { string disthost = s_distHost; ushort distport = s_distPort; import vibe.core.args : readOption; readOption("disthost|d", () @trusted { return &disthost; } (), "Sets the name of a vibedist server to use for load balancing."); readOption("distport", () @trusted { return &distport; } (), "Sets the port used for load balancing."); setVibeDistHost(disthost, distport); } } private string formatRFC822DateAlloc(IAllocator alloc, SysTime time) @safe { auto app = AllocAppender!string(alloc); writeRFC822DateTimeString(app, time); return () @trusted { return app.data; } (); } version (VibeDebugCatchAll) private alias UncaughtException = Throwable; else private alias UncaughtException = Exception;
D
module about_templates; import helpers; import dunit; class AboutTemplates { mixin UnitTest; T twice(T)(T value){ //shortcut syntax return 2 * value; } T twice(T : string)(T value){ // specialization return value ~ value; } @Test public void functionTemplates() { auto val1 = twice!int(2); // instantiation assertEquals(val1, FILL_IN_THIS_NUMBER); auto val2 = twice("hello"); assertEquals(val2, FILL_IN_THIS_STRING); } }
D
module android.java.android.view.KeyCharacterMap_KeyData_d_interface; import arsd.jni : IJavaObjectImplementation, JavaPackageId, JavaName, IJavaObject, ImportExportImpl, JavaInterfaceMembers; static import arsd.jni; import import0 = android.java.java.lang.Class_d_interface; @JavaName("KeyCharacterMap$KeyData") final class KeyCharacterMap_KeyData : IJavaObject { static immutable string[] _d_canCastTo = [ ]; @Import this(arsd.jni.Default); @Import import0.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/view/KeyCharacterMap$KeyData;"; }
D
an attack intended to ruin someone's reputation murder of a public figure by surprise attack
D
instance DIA_Dar_EXIT(C_Info) { npc = Sld_810_Dar; nr = 999; condition = DIA_Dar_EXIT_Condition; information = DIA_Dar_EXIT_Info; permanent = TRUE; description = Dialog_Ende; }; func int DIA_Dar_EXIT_Condition() { if(Kapitel < 3) { return TRUE; }; }; func void DIA_Dar_EXIT_Info() { AI_StopProcessInfos(self); }; instance DIA_Dar_Hallo(C_Info) { npc = Sld_810_Dar; nr = 1; condition = DIA_Dar_Hallo_Condition; information = DIA_Dar_Hallo_Info; permanent = FALSE; description = "What are you smoking there?"; }; func int DIA_Dar_Hallo_Condition() { return TRUE; }; func void DIA_Dar_Hallo_Info() { AI_Output(other,self,"DIA_Dar_Hallo_15_00"); //What are you smoking there? AI_Output(self,other,"DIA_Dar_Hallo_03_01"); //Want a toke? Info_ClearChoices(DIA_Dar_Hallo); Info_AddChoice(DIA_Dar_Hallo,"No.",DIA_Dar_Hallo_Nein); Info_AddChoice(DIA_Dar_Hallo,"Sure.",DIA_Dar_Hallo_Ja); }; func void DIA_Dar_Hallo_Ja() { AI_Output(other,self,"DIA_Dar_Hallo_Ja_15_00"); //Sure. CreateInvItem(other,ItMi_Joint); B_UseItem(other,ItMi_Joint); AI_Output(self,other,"DIA_Dar_Hallo_Ja_03_01"); //Not bad, eh? AI_Output(other,self,"DIA_Dar_Hallo_Ja_15_02"); //Where did you get the stuff? CreateInvItem(self,ItMi_Joint); B_UseItem(self,ItMi_Joint); AI_Output(self,other,"DIA_Dar_Hallo_Ja_03_03"); //(grins) I have my sources. Info_ClearChoices(DIA_Dar_Hallo); }; func void DIA_Dar_Hallo_Nein() { AI_Output(other,self,"DIA_Dar_Hallo_Nein_15_00"); //No. Info_ClearChoices(DIA_Dar_Hallo); }; var int Dar_einmal; instance DIA_Dar_PERM(C_Info) { npc = Sld_810_Dar; nr = 2; condition = DIA_Dar_PERM_Condition; information = DIA_Dar_PERM_Info; permanent = TRUE; description = "Do you do anything besides smoke?"; }; func int DIA_Dar_PERM_Condition() { if(Npc_KnowsInfo(other,DIA_Dar_Hallo)) { return TRUE; }; }; func void DIA_Dar_PERM_Info() { AI_Output(other,self,"DIA_Dar_PERM_15_00"); //Do you do anything besides smoke? if((Dar_LostAgainstCipher == TRUE) && (Dar_einmal == FALSE)) { AI_Output(self,other,"DIA_Dar_PERM_03_01"); //(sarcastic) Sometimes I let some vengeful swampweed junkies beat me up.. Dar_einmal = TRUE; } else { AI_Output(self,other,"DIA_Dar_PERM_03_02"); //Not at the moment. }; }; instance DIA_Dar_WannaJoin(C_Info) { npc = Sld_810_Dar; nr = 3; condition = DIA_Dar_WannaJoin_Condition; information = DIA_Dar_WannaJoin_Info; permanent = FALSE; description = "I want to join the mercenaries. Do you mind?"; }; func int DIA_Dar_WannaJoin_Condition() { if(Npc_KnowsInfo(other,DIA_Dar_Hallo) && (other.guild == GIL_NONE) && (Dar_LostAgainstCipher == FALSE)) { return TRUE; }; }; func void DIA_Dar_WannaJoin_Info() { AI_Output(other,self,"DIA_Dar_WannaJoin_15_00"); //I want to join the mercenaries. Do you mind? AI_Output(self,other,"DIA_Dar_WannaJoin_03_01"); //Who cares. }; instance DIA_Dar_DuDieb(C_Info) { npc = Sld_810_Dar; nr = 4; condition = DIA_Dar_DuDieb_Condition; information = DIA_Dar_DuDieb_Info; permanent = FALSE; description = "Cipher told me that someone stole a package of swampweed from him ..."; }; func int DIA_Dar_DuDieb_Condition() { if(Npc_KnowsInfo(other,DIA_Cipher_TradeWhat) && (MIS_Cipher_Paket == LOG_Running)) { return TRUE; }; }; func void DIA_Dar_DuDieb_Info() { AI_Output(other,self,"DIA_Dar_DuDieb_15_00"); //Cipher told me that someone stole a package of swampweed from him ... AI_Output(self,other,"DIA_Dar_DuDieb_03_01"); //(laughs subdued and moronically) AI_Output(other,self,"DIA_Dar_DuDieb_15_02"); //Would you know anything about that? AI_Output(self,other,"DIA_Dar_DuDieb_03_03"); //(very short) No. Dar_Verdacht = TRUE; }; instance DIA_Dar_WoPaket(C_Info) { npc = Sld_810_Dar; nr = 4; condition = DIA_Dar_WoPaket_Condition; information = DIA_Dar_WoPaket_Info; permanent = TRUE; description = "Where's the package?"; }; func int DIA_Dar_WoPaket_Condition() { if(Npc_KnowsInfo(other,DIA_Dar_DuDieb) && (Dar_Dieb == FALSE) && (MIS_Cipher_Paket == LOG_Running)) { return TRUE; }; }; func void DIA_Dar_WoPaket_Info() { AI_Output(other,self,"DIA_Dar_WoPaket_15_00"); //(threatens) Where's the package? if(self.aivar[AIV_LastFightAgainstPlayer] == FIGHT_LOST) { AI_Output(self,other,"DIA_Dar_WoPaket_03_01"); //Okay, okay, okay. I sold it to some bum in town. AI_Output(self,other,"DIA_Dar_WoPaket_03_02"); //It was at the harbor. I can't remember what he looked like. AI_Output(other,self,"DIA_Dar_WoPaket_15_03"); //Could it be that you need another thrashing? AI_Output(self,other,"DIA_Dar_WoPaket_03_04"); //Honest, man, I was totally stoned. I don't have the slightest idea what the guy looked like. AI_Output(self,other,"DIA_Dar_WoPaket_03_05"); //It was at the harbor near the boat-builders'. That's all I can remember. Dar_Dieb = TRUE; B_LogEntry(Topic_CipherPaket,"Dar's admitted he stole the package of weed. He sold it in the harbor district of Khorinis, near the boat-builder's."); } else { AI_Output(self,other,"DIA_Dar_WoPaket_03_06"); //What do I know? }; }; instance DIA_Dar_AufsMaul(C_Info) { npc = Sld_810_Dar; nr = 5; condition = DIA_Dar_AufsMaul_Condition; information = DIA_Dar_AufsMaul_Info; permanent = FALSE; description = "I'll knock it out of you!"; }; func int DIA_Dar_AufsMaul_Condition() { if(Npc_KnowsInfo(other,DIA_Dar_DuDieb) && (Dar_Dieb == FALSE) && (self.aivar[AIV_LastFightAgainstPlayer] != FIGHT_LOST)) { return TRUE; }; }; func void DIA_Dar_AufsMaul_Info() { AI_Output(other,self,"DIA_Dar_AufsMaul_15_00"); //I'll knock it out of you! AI_Output(self,other,"DIA_Dar_AufsMaul_03_01"); //Relax. I'm way too stoned to fight with you! B_GiveInvItems(self,other,ItMi_Joint,1); AI_Output(self,other,"DIA_Dar_AufsMaul_03_02"); //Here, first take a big toke! }; instance DIA_Dar_Kameradenschwein(C_Info) { npc = Sld_810_Dar; nr = 1; condition = DIA_Dar_Kameradenschwein_Condition; information = DIA_Dar_Kameradenschwein_Info; permanent = FALSE; important = TRUE; }; func int DIA_Dar_Kameradenschwein_Condition() { if((Dar_LostAgainstCipher == TRUE) && (self.aivar[AIV_LastFightComment] == FALSE)) { return TRUE; }; }; func void DIA_Dar_Kameradenschwein_Info() { AI_Output(self,other,"DIA_Dar_Kameradenschwein_03_00"); //Blabbermouth! You told Cipher I took his weed! if(Npc_KnowsInfo(other,DIA_Dar_WannaJoin) && (other.guild == GIL_NONE)) { AI_Output(self,other,"DIA_Dar_Kameradenschwein_03_01"); //Like hell will I vote for you. }; }; instance DIA_Dar_Pilztabak(C_Info) { npc = Sld_810_Dar; nr = 6; condition = DIA_Dar_Pilztabak_Condition; information = DIA_Dar_Pilztabak_Info; permanent = FALSE; description = "Have you ever tried shroom tobacco?"; }; func int DIA_Dar_Pilztabak_Condition() { if(Npc_HasItems(other,ItMi_PilzTabak) > 0) { return TRUE; }; }; func void DIA_Dar_Pilztabak_Info() { AI_Output(other,self,"DIA_Dar_Pilztabak_15_00"); //Have you ever tried shroom tobacco? AI_Output(self,other,"DIA_Dar_Pilztabak_03_01"); //Sounds interesting. Give it here. B_GiveInvItems(other,self,ItMi_PilzTabak,1); AI_Output(self,other,"DIA_Dar_Pilztabak_03_02"); //All right, here we go ... CreateInvItem(self,ItMi_Joint); B_UseItem(self,ItMi_Joint); AI_Output(self,other,"DIA_Dar_Pilztabak_03_03"); //Have you ever smoked that stuff YOURSELF? AI_Output(other,self,"DIA_Dar_Pilztabak_15_04"); //Well ... CreateInvItem(self,ItMi_Joint); B_UseItem(self,ItMi_Joint); AI_Output(self,other,"DIA_Dar_Pilztabak_03_05"); //Have you or haven't you? AI_Output(other,self,"DIA_Dar_Pilztabak_15_06"); //I've been sort of busy ... AI_Output(self,other,"DIA_Dar_Pilztabak_03_07"); //Oh, shit! AI_PlayAni(self,"T_MAGRUN_2_HEASHOOT"); AI_Output(self,other,"DIA_Dar_Pilztabak_03_08"); //Holy Rhobar! AI_PlayAni(self,"T_HEASHOOT_2_STAND"); AI_Output(self,other,"DIA_Dar_Pilztabak_03_09"); //That stuff is way too harsh! Don't even try it! B_GivePlayerXP(XP_Ambient); }; instance DIA_Dar_KAP3_EXIT(C_Info) { npc = Sld_810_Dar; nr = 999; condition = DIA_Dar_KAP3_EXIT_Condition; information = DIA_Dar_KAP3_EXIT_Info; permanent = TRUE; description = Dialog_Ende; }; func int DIA_Dar_KAP3_EXIT_Condition() { if(Kapitel == 3) { return TRUE; }; }; func void DIA_Dar_KAP3_EXIT_Info() { AI_StopProcessInfos(self); }; instance DIA_Dar_KAP4_EXIT(C_Info) { npc = Sld_810_Dar; nr = 999; condition = DIA_Dar_KAP4_EXIT_Condition; information = DIA_Dar_KAP4_EXIT_Info; permanent = TRUE; description = Dialog_Ende; }; func int DIA_Dar_KAP4_EXIT_Condition() { if(Kapitel == 4) { return TRUE; }; }; func void DIA_Dar_KAP4_EXIT_Info() { AI_StopProcessInfos(self); }; instance DIA_Dar_ORCRING(C_Info) { npc = Sld_810_Dar; nr = 4; condition = DIA_Dar_ORCRING_Condition; information = DIA_Dar_ORCRING_Info; description = "There seem to be some mercenaries missing here."; }; func int DIA_Dar_ORCRING_Condition() { if(Kapitel >= 4) { return TRUE; }; }; func void DIA_Dar_ORCRING_Info() { AI_Output(other,self,"DIA_Dar_ORCRING_15_00"); //There seem to be some mercenaries missing here. AI_Output(self,other,"DIA_Dar_ORCRING_03_01"); //Sure. That's true. Sylvio is miles away, and he took half the crew with him. AI_Output(self,other,"DIA_Dar_ORCRING_03_02"); //Who cares. I've got a better chance of becoming someone with Lee's boys. All I need is a bang. AI_Output(self,other,"DIA_Dar_ORCRING_03_03"); //If I could bring proof that I'm a real tough guy, maybe I could even become one of Lee's bodyguards. Info_ClearChoices(DIA_Dar_ORCRING); Info_AddChoice(DIA_Dar_ORCRING,"That doesn't concern me.",DIA_Dar_ORCRING_no); Info_AddChoice(DIA_Dar_ORCRING,"Tough guy? You?",DIA_Dar_ORCRING_necken); if((hero.guild == GIL_SLD) || (hero.guild == GIL_DJG) || (hero.guild == GIL_KDF)) { Info_AddChoice(DIA_Dar_ORCRING,"What would that look like?",DIA_Dar_ORCRING_wie); }; }; func void DIA_Dar_ORCRING_necken() { AI_Output(other,self,"DIA_Dar_ORCRING_necken_15_00"); //Tough guy? You? AI_Output(self,other,"DIA_Dar_ORCRING_necken_03_01"); //(angry) Oh, come on, shut up. Who are you anyway? if((hero.guild == GIL_MIL) || (hero.guild == GIL_PAL)) { AI_Output(self,other,"DIA_Dar_ORCRING_necken_03_02"); //Some puffed-up nitwit from the city. You dorks got nothing going for you. }; if((hero.guild == GIL_SLD) || (hero.guild == GIL_DJG)) { AI_Output(self,other,"DIA_Dar_ORCRING_necken_03_03"); //You've only been here for a couple of days, and you're spouting off already. }; if(hero.guild == GIL_KDF) { AI_Output(self,other,"DIA_Dar_ORCRING_necken_03_04"); //Who you trying to scare with your stupid magic bullshit? Not me anyway. }; if((hero.guild == GIL_MIL) || (hero.guild == GIL_PAL)) { AI_Output(self,other,"DIA_Dar_ORCRING_necken_03_05"); //Now that I think about it, splitting your skull is exactly what would get me a lot of respect with Lee's boys. Info_ClearChoices(DIA_Dar_ORCRING); Info_AddChoice(DIA_Dar_ORCRING,"I've got no time for this kind of bullshit.",DIA_Dar_ORCRING_necken_no); Info_AddChoice(DIA_Dar_ORCRING,"OK. Just try it.",DIA_Dar_ORCRING_necken_schlagen); } else { AI_Output(self,other,"DIA_Dar_ORCRING_necken_03_06"); //Just you wait. I'll find a way to make an impression on Lee. }; }; var int Dar_FightAgainstPaladin; func void DIA_Dar_ORCRING_necken_schlagen() { Dar_FightAgainstPaladin = TRUE; AI_Output(other,self,"DIA_Dar_ORCRING_necken_schlagen_15_00"); //OK. Just try it. AI_Output(self,other,"DIA_Dar_ORCRING_necken_schlagen_03_01"); //Ooh, I can't wait. AI_StopProcessInfos(self); B_Attack(self,other,AR_NONE,1); }; func void DIA_Dar_ORCRING_necken_no() { AI_Output(other,self,"DIA_Dar_ORCRING_necken_no_15_00"); //I've got no time for this kind of bullshit. AI_Output(self,other,"DIA_Dar_ORCRING_necken_no_03_01"); //Oh, yeah. The shining knight of justice, I forgot. Too bad. I thought you had more guts. AI_StopProcessInfos(self); }; func void DIA_Dar_ORCRING_wie() { AI_Output(other,self,"DIA_Dar_ORCRING_wie_15_00"); //What would that look like? AI_Output(self,other,"DIA_Dar_ORCRING_wie_03_01"); //I don't know exactly. Some kind of orc trophy wouldn't be bad. AI_Output(self,other,"DIA_Dar_ORCRING_wie_03_02"); //Some kind of insignia from the orc leaders or something. A banner, an armband or a ring, or something like that. AI_Output(self,other,"DIA_Dar_ORCRING_wie_03_03"); //I can't make any kind of impression here with much less. That much is obvious. Log_CreateTopic(TOPIC_Dar_BringOrcEliteRing,LOG_MISSION); Log_SetTopicStatus(TOPIC_Dar_BringOrcEliteRing,LOG_Running); B_LogEntry(TOPIC_Dar_BringOrcEliteRing,"Dar wants to be a bigshot among the mercenaries. He wants an orc trophy. A banner, an armband, a ring or something."); MIS_Dar_BringOrcEliteRing = LOG_Running; Info_ClearChoices(DIA_Dar_ORCRING); }; func void DIA_Dar_ORCRING_no() { AI_Output(other,self,"DIA_Dar_ORCRING_no_15_00"); //That doesn't concern me. AI_Output(self,other,"DIA_Dar_ORCRING_no_03_01"); //(angry) Of course not. I'd have been amazed. Info_ClearChoices(DIA_Dar_ORCRING); }; instance DIA_Dar_FIGHTAGAINSTPALOVER(C_Info) { npc = Sld_810_Dar; nr = 4; condition = DIA_Dar_FIGHTAGAINSTPALOVER_Condition; information = DIA_Dar_FIGHTAGAINSTPALOVER_Info; important = TRUE; }; func int DIA_Dar_FIGHTAGAINSTPALOVER_Condition() { if((Dar_FightAgainstPaladin == TRUE) && ((hero.guild == GIL_MIL) || (hero.guild == GIL_PAL))) { return TRUE; }; }; func void DIA_Dar_FIGHTAGAINSTPALOVER_Info() { AI_Output(self,other,"DIA_Dar_FIGHTAGAINSTPALOVER_03_00"); //All right, I know Lee won't exactly be thrilled if I get into it again with you. AI_Output(self,other,"DIA_Dar_FIGHTAGAINSTPALOVER_03_01"); //I don't want to make any enemies here. So let's forget the nonsense, okay? B_GivePlayerXP(XP_Ambient); AI_StopProcessInfos(self); }; instance DIA_Dar_BRINGORCELITERING(C_Info) { npc = Sld_810_Dar; nr = 4; condition = DIA_Dar_BRINGORCELITERING_Condition; information = DIA_Dar_BRINGORCELITERING_Info; description = "I've got the orc trophy you were looking for."; }; func int DIA_Dar_BRINGORCELITERING_Condition() { if((MIS_Dar_BringOrcEliteRing == LOG_Running) && ((hero.guild == GIL_SLD) || (hero.guild == GIL_DJG) || (hero.guild == GIL_KDF)) && Npc_HasItems(other,ItRi_OrcEliteRing)) { return TRUE; }; }; func void DIA_Dar_BRINGORCELITERING_Info() { AI_Output(other,self,"DIA_Dar_BRINGORCELITERING_15_00"); //I've got the orc trophy you were looking for. AI_Output(self,other,"DIA_Dar_BRINGORCELITERING_03_01"); //What's this you've brought me? AI_Output(other,self,"DIA_Dar_BRINGORCELITERING_15_02"); //The ring of an orcish warlord. AI_Output(self,other,"DIA_Dar_BRINGORCELITERING_03_03"); //Wow, in that case ... What do you want for it? MIS_Dar_BringOrcEliteRing = LOG_SUCCESS; Info_ClearChoices(DIA_Dar_BRINGORCELITERING); Info_AddChoice(DIA_Dar_BRINGORCELITERING,"What can you offer me?",DIA_Dar_BRINGORCELITERING_was); if((hero.guild == GIL_SLD) || (hero.guild == GIL_DJG)) { Info_AddChoice(DIA_Dar_BRINGORCELITERING,"Give me some gold.",DIA_Dar_BRINGORCELITERING_geld); }; }; func void DIA_Dar_BRINGORCELITERING_geld() { AI_Output(other,self,"DIA_Dar_BRINGORCELITERING_geld_15_00"); //Give me some gold. if((hero.guild == GIL_SLD) || (hero.guild == GIL_DJG)) { AI_Output(self,other,"DIA_Dar_BRINGORCELITERING_geld_03_01"); //Mmh. 600 gold coins? AI_Output(other,self,"DIA_Dar_BRINGORCELITERING_geld_15_02"); //What was that? }; AI_Output(self,other,"DIA_Dar_BRINGORCELITERING_geld_03_03"); //Okay. I'll give you 1200 gold coins for it. if((hero.guild == GIL_SLD) || (hero.guild == GIL_DJG)) { AI_Output(self,other,"DIA_Dar_BRINGORCELITERING_geld_03_04"); //Take it or keep the ring. }; Info_ClearChoices(DIA_Dar_BRINGORCELITERING); Info_AddChoice(DIA_Dar_BRINGORCELITERING,"That's not enough.",DIA_Dar_BRINGORCELITERING_geld_no); Info_AddChoice(DIA_Dar_BRINGORCELITERING,"It's a deal.",DIA_Dar_BRINGORCELITERING_geld_ok); }; func void DIA_Dar_BRINGORCELITERING_geld_ok() { AI_Output(other,self,"DIA_Dar_BRINGORCELITERING_geld_ok_15_00"); //It's a deal. Here's the ring. B_GiveInvItems(other,self,ItRi_OrcEliteRing,1); AI_Output(self,other,"DIA_Dar_BRINGORCELITERING_geld_ok_03_01"); //Thanks. I can't wait to hear what the others will say about it. CreateInvItems(self,ItMi_Gold,1200); B_GiveInvItems(self,other,ItMi_Gold,1200); B_GivePlayerXP(XP_Dar_BringOrcEliteRing); Info_ClearChoices(DIA_Dar_BRINGORCELITERING); }; func void DIA_Dar_BRINGORCELITERING_geld_no() { AI_Output(other,self,"DIA_Dar_BRINGORCELITERING_geld_no_15_00"); //That's not enough. AI_Output(self,other,"DIA_Dar_BRINGORCELITERING_geld_no_03_01"); //And I think it's too much. This business is too shady for me. No offense. Info_ClearChoices(DIA_Dar_BRINGORCELITERING); }; func void DIA_Dar_BRINGORCELITERING_was() { AI_Output(other,self,"DIA_Dar_BRINGORCELITERING_was_15_00"); //What can you offer me? AI_Output(self,other,"DIA_Dar_BRINGORCELITERING_was_03_01"); //Either take the money, or this amulet that I ... well, let's say, acquired a while ago. AI_Output(self,other,"DIA_Dar_BRINGORCELITERING_was_03_02"); //It improves your dexterity. I've tried it myself. Info_ClearChoices(DIA_Dar_BRINGORCELITERING); Info_AddChoice(DIA_Dar_BRINGORCELITERING,"Give me some gold.",DIA_Dar_BRINGORCELITERING_geld); Info_AddChoice(DIA_Dar_BRINGORCELITERING,"Give me the amulet.",DIA_Dar_BRINGORCELITERING_was_am); }; func void DIA_Dar_BRINGORCELITERING_was_am() { AI_Output(other,self,"DIA_Dar_BRINGORCELITERING_was_am_15_00"); //Give me the amulet. AI_Output(self,other,"DIA_Dar_BRINGORCELITERING_was_am_03_01"); //Sure thing. Have fun with it. Now gimme that ring. B_GiveInvItems(other,self,ItRi_OrcEliteRing,1); CreateInvItems(self,ItAm_Dex_01,1); B_GiveInvItems(self,other,ItAm_Dex_01,1); B_GivePlayerXP(XP_Dar_BringOrcEliteRing); AI_Output(self,other,"DIA_Dar_BRINGORCELITERING_was_am_03_02"); //It was a pleasure. Info_ClearChoices(DIA_Dar_BRINGORCELITERING); }; instance DIA_Dar_KAP5_EXIT(C_Info) { npc = Sld_810_Dar; nr = 999; condition = DIA_Dar_KAP5_EXIT_Condition; information = DIA_Dar_KAP5_EXIT_Info; permanent = TRUE; description = Dialog_Ende; }; func int DIA_Dar_KAP5_EXIT_Condition() { if(Kapitel == 5) { return TRUE; }; }; func void DIA_Dar_KAP5_EXIT_Info() { AI_StopProcessInfos(self); }; instance DIA_Dar_KAP6_EXIT(C_Info) { npc = Sld_810_Dar; nr = 999; condition = DIA_Dar_KAP6_EXIT_Condition; information = DIA_Dar_KAP6_EXIT_Info; permanent = TRUE; description = Dialog_Ende; }; func int DIA_Dar_KAP6_EXIT_Condition() { if(Kapitel == 6) { return TRUE; }; }; func void DIA_Dar_KAP6_EXIT_Info() { AI_StopProcessInfos(self); }; instance DIA_Dar_PICKPOCKET(C_Info) { npc = Sld_810_Dar; nr = 900; condition = DIA_Dar_PICKPOCKET_Condition; information = DIA_Dar_PICKPOCKET_Info; permanent = TRUE; description = Pickpocket_80; }; func int DIA_Dar_PICKPOCKET_Condition() { return C_Beklauen(67,35); }; func void DIA_Dar_PICKPOCKET_Info() { Info_ClearChoices(DIA_Dar_PICKPOCKET); Info_AddChoice(DIA_Dar_PICKPOCKET,Dialog_Back,DIA_Dar_PICKPOCKET_BACK); Info_AddChoice(DIA_Dar_PICKPOCKET,DIALOG_PICKPOCKET,DIA_Dar_PICKPOCKET_DoIt); }; func void DIA_Dar_PICKPOCKET_DoIt() { B_Beklauen(); Info_ClearChoices(DIA_Dar_PICKPOCKET); }; func void DIA_Dar_PICKPOCKET_BACK() { Info_ClearChoices(DIA_Dar_PICKPOCKET); };
D
#!/usr/bin/env rdmd import std.stdio; import std.string; import std.range; import std.conv; void main() { int c = 12; z = (x=>x++); writeln(typeid(z)); }
D
/* * Copyright 2017 The Android Open Source Project * * 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. */ package androidx.browser.browseractions; import static androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP; import android.app.PendingIntent; import android.content.Context; import android.content.Intent; import android.content.pm.PackageManager; import android.content.pm.ResolveInfo; import android.net.Uri; import android.os.Build; import android.os.Bundle; import android.text.TextUtils; import androidx.annotation.DrawableRes; import androidx.annotation.IntDef; import androidx.annotation.NonNull; import androidx.annotation.RestrictTo; import androidx.annotation.VisibleForTesting; import androidx.core.content.ContextCompat; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.util.ArrayList; import java.util.Arrays; import java.util.List; /** * Class holding the {@link Intent} and start bundle for a Browser Actions Activity. * * <p> * <strong>Note:</strong> The constants below are public for the browser implementation's benefit. * You are strongly encouraged to use {@link BrowserActionsIntent.Builder}.</p> */ public class BrowserActionsIntent { private static final String TAG = "BrowserActions"; // Used to verify that an URL intent handler exists. private static final String TEST_URL = "https://www.example.com"; /** * Extra that specifies {@link PendingIntent} indicating which Application sends the {@link * BrowserActionsIntent}. */ public static final String EXTRA_APP_ID = "androidx.browser.browseractions.APP_ID"; /** * Indicates that the user explicitly opted out of Browser Actions in the calling application. */ public static final String ACTION_BROWSER_ACTIONS_OPEN = "androidx.browser.browseractions.browser_action_open"; /** * Extra resource id that specifies the icon of a custom item shown in the Browser Actions menu. */ public static final String KEY_ICON_ID = "androidx.browser.browseractions.ICON_ID"; /** * Extra string that specifies the title of a custom item shown in the Browser Actions menu. */ public static final String KEY_TITLE = "androidx.browser.browseractions.TITLE"; /** * Extra PendingIntent to be launched when a custom item is selected in the Browser Actions * menu. */ public static final String KEY_ACTION = "androidx.browser.browseractions.ACTION"; /** * Extra that specifies the type of url for the Browser Actions menu. */ public static final String EXTRA_TYPE = "androidx.browser.browseractions.extra.TYPE"; /** * Extra that specifies List<Bundle> used for adding custom items to the Browser Actions menu. */ public static final String EXTRA_MENU_ITEMS = "androidx.browser.browseractions.extra.MENU_ITEMS"; /** * Extra that specifies the PendingIntent to be launched when a browser specified menu item is * selected. The id of the chosen item will be notified through the data of its Intent. */ public static final String EXTRA_SELECTED_ACTION_PENDING_INTENT = "androidx.browser.browseractions.extra.SELECTED_ACTION_PENDING_INTENT"; /** * The maximum allowed number of custom items. */ public static final int MAX_CUSTOM_ITEMS = 5; /** * Defines the types of url for Browser Actions menu. */ /** @hide */ @RestrictTo(LIBRARY_GROUP) @IntDef({URL_TYPE_NONE, URL_TYPE_IMAGE, URL_TYPE_VIDEO, URL_TYPE_AUDIO, URL_TYPE_FILE, URL_TYPE_PLUGIN}) @Retention(RetentionPolicy.SOURCE) public @interface BrowserActionsUrlType {} public static final int URL_TYPE_NONE = 0; public static final int URL_TYPE_IMAGE = 1; public static final int URL_TYPE_VIDEO = 2; public static final int URL_TYPE_AUDIO = 3; public static final int URL_TYPE_FILE = 4; public static final int URL_TYPE_PLUGIN = 5; /** * Defines the the ids of the browser specified menu items in Browser Actions. * TODO(ltian): A long term solution need, since other providers might have customized menus. */ /** @hide */ @RestrictTo(LIBRARY_GROUP) @IntDef({ITEM_INVALID_ITEM, ITEM_OPEN_IN_NEW_TAB, ITEM_OPEN_IN_INCOGNITO, ITEM_DOWNLOAD, ITEM_COPY, ITEM_SHARE}) @Retention(RetentionPolicy.SOURCE) public @interface BrowserActionsItemId {} public static final int ITEM_INVALID_ITEM = -1; public static final int ITEM_OPEN_IN_NEW_TAB = 0; public static final int ITEM_OPEN_IN_INCOGNITO = 1; public static final int ITEM_DOWNLOAD = 2; public static final int ITEM_COPY = 3; public static final int ITEM_SHARE = 4; /** * An {@link Intent} used to start the Browser Actions Activity. */ @NonNull private final Intent mIntent; /** * Gets the Intent of {@link BrowserActionsIntent}. * @return the Intent of {@link BrowserActionsIntent}. */ @NonNull public Intent getIntent() { return mIntent; } private BrowserActionsIntent(@NonNull Intent intent) { this.mIntent = intent; } /** @hide */ @VisibleForTesting @RestrictTo(LIBRARY_GROUP) interface BrowserActionsFallDialogListener { void onDialogShown(); } private static BrowserActionsFallDialogListener sDialogListenter; /** * Builder class for opening a Browser Actions context menu. */ public static final class Builder { private final Intent mIntent = new Intent(BrowserActionsIntent.ACTION_BROWSER_ACTIONS_OPEN); private Context mContext; private Uri mUri; @BrowserActionsUrlType private int mType; private ArrayList<Bundle> mMenuItems = null; private PendingIntent mOnItemSelectedPendingIntent = null; /** * Constructs a {@link BrowserActionsIntent.Builder} object associated with default setting * for a selected url. * @param context The context requesting the Browser Actions context menu. * @param uri The selected url for Browser Actions menu. */ public Builder(Context context, Uri uri) { mContext = context; mUri = uri; mType = URL_TYPE_NONE; mMenuItems = new ArrayList<>(); } /** * Sets the type of Browser Actions context menu. * @param type The type of url. */ public Builder setUrlType(@BrowserActionsUrlType int type) { mType = type; return this; } /** * Sets the custom items list. * Only maximum MAX_CUSTOM_ITEMS custom items are allowed, * otherwise throws an {@link IllegalStateException}. * @param items The list of {@link BrowserActionItem} for custom items. */ public Builder setCustomItems(ArrayList<BrowserActionItem> items) { if (items.size() > MAX_CUSTOM_ITEMS) { throw new IllegalStateException( "Exceeded maximum toolbar item count of " + MAX_CUSTOM_ITEMS); } for (int i = 0; i < items.size(); i++) { if (TextUtils.isEmpty(items.get(i).getTitle()) || items.get(i).getAction() == null) { throw new IllegalArgumentException( "Custom item should contain a non-empty title and non-null intent."); } else { mMenuItems.add(getBundleFromItem(items.get(i))); } } return this; } /** * Sets the custom items list. * Only maximum MAX_CUSTOM_ITEMS custom items are allowed, * otherwise throws an {@link IllegalStateException}. * @param items The varargs of {@link BrowserActionItem} for custom items. */ public Builder setCustomItems(BrowserActionItem... items) { return setCustomItems(new ArrayList<BrowserActionItem>(Arrays.asList(items))); } /** * Set the PendingIntent to be launched when a a browser specified menu item is selected. * @param onItemSelectedPendingIntent The PendingIntent to be launched. */ public Builder setOnItemSelectedAction(PendingIntent onItemSelectedPendingIntent) { mOnItemSelectedPendingIntent = onItemSelectedPendingIntent; return this; } /** * Populates a {@link Bundle} to hold a custom item for Browser Actions menu. * @param item A custom item for Browser Actions menu. * @return The Bundle of custom item. */ private Bundle getBundleFromItem(BrowserActionItem item) { Bundle bundle = new Bundle(); bundle.putString(KEY_TITLE, item.getTitle()); bundle.putParcelable(KEY_ACTION, item.getAction()); if (item.getIconId() != 0) bundle.putInt(KEY_ICON_ID, item.getIconId()); return bundle; } /** * Combines all the options that have been set and returns a new {@link * BrowserActionsIntent} object. */ public BrowserActionsIntent build() { mIntent.setData(mUri); mIntent.putExtra(EXTRA_TYPE, mType); mIntent.putParcelableArrayListExtra(EXTRA_MENU_ITEMS, mMenuItems); PendingIntent pendingIntent = PendingIntent.getActivity(mContext, 0, new Intent(), 0); mIntent.putExtra(EXTRA_APP_ID, pendingIntent); if (mOnItemSelectedPendingIntent != null) { mIntent.putExtra( EXTRA_SELECTED_ACTION_PENDING_INTENT, mOnItemSelectedPendingIntent); } return new BrowserActionsIntent(mIntent); } } /** * Construct a BrowserActionsIntent with default settings and launch it to open a Browser * Actions menu. * @param context The context requesting for a Browser Actions menu. * @param uri The url for Browser Actions menu. */ public static void openBrowserAction(Context context, Uri uri) { BrowserActionsIntent intent = new BrowserActionsIntent.Builder(context, uri).build(); launchIntent(context, intent.getIntent()); } /** * Construct a BrowserActionsIntent with custom settings and launch it to open a Browser Actions * menu. * @param context The context requesting for a Browser Actions menu. * @param uri The url for Browser Actions menu. * @param type The type of the url for context menu to be opened. * @param items List of custom items to be added to Browser Actions menu. * @param pendingIntent The PendingIntent to be launched when a browser specified menu item is * selected. */ public static void openBrowserAction(Context context, Uri uri, int type, ArrayList<BrowserActionItem> items, PendingIntent pendingIntent) { BrowserActionsIntent intent = new BrowserActionsIntent.Builder(context, uri) .setUrlType(type) .setCustomItems(items) .setOnItemSelectedAction(pendingIntent) .build(); launchIntent(context, intent.getIntent()); } /** * Launch an Intent to open a Browser Actions menu. * It first checks if any Browser Actions provider is available to create the menu. * If the default Browser supports Browser Actions, menu will be opened by the default Browser, * otherwise show a intent picker. * If not provider, a Browser Actions menu is opened locally from support library. * @param context The context requesting for a Browser Actions menu. * @param intent The {@link Intent} holds the setting for Browser Actions menu. */ public static void launchIntent(Context context, Intent intent) { List<ResolveInfo> handlers = getBrowserActionsIntentHandlers(context); launchIntent(context, intent, handlers); } /** @hide */ @RestrictTo(LIBRARY_GROUP) @VisibleForTesting static void launchIntent(Context context, Intent intent, List<ResolveInfo> handlers) { if (handlers == null || handlers.size() == 0) { openFallbackBrowserActionsMenu(context, intent); return; } else if (handlers.size() == 1) { intent.setPackage(handlers.get(0).activityInfo.packageName); } else { Intent viewIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(TEST_URL)); PackageManager pm = context.getPackageManager(); ResolveInfo defaultHandler = pm.resolveActivity(viewIntent, PackageManager.MATCH_DEFAULT_ONLY); if (defaultHandler != null) { String defaultPackageName = defaultHandler.activityInfo.packageName; for (int i = 0; i < handlers.size(); i++) { if (defaultPackageName.equals(handlers.get(i).activityInfo.packageName)) { intent.setPackage(defaultPackageName); break; } } } } ContextCompat.startActivity(context, intent, null); } /** * Returns a list of Browser Actions providers available to handle the {@link * BrowserActionsIntent}. * @param context The context requesting for a Browser Actions menu. * @return List of Browser Actions providers available to handle the intent. */ private static List<ResolveInfo> getBrowserActionsIntentHandlers(Context context) { Intent intent = new Intent(BrowserActionsIntent.ACTION_BROWSER_ACTIONS_OPEN, Uri.parse(TEST_URL)); PackageManager pm = context.getPackageManager(); return pm.queryIntentActivities(intent, PackageManager.MATCH_ALL); } private static void openFallbackBrowserActionsMenu(Context context, Intent intent) { Uri uri = intent.getData(); int type = intent.getIntExtra(EXTRA_TYPE, URL_TYPE_NONE); ArrayList<Bundle> bundles = intent.getParcelableArrayListExtra(EXTRA_MENU_ITEMS); List<BrowserActionItem> items = bundles != null ? parseBrowserActionItems(bundles) : null; openFallbackBrowserActionsMenu(context, uri, type, items); } /** @hide */ @RestrictTo(LIBRARY_GROUP) @VisibleForTesting static void setDialogShownListenter(BrowserActionsFallDialogListener dialogListener) { sDialogListenter = dialogListener; } /** * Open a Browser Actions menu from support library. * @param context The context requesting for a Browser Actions menu. * @param uri The url for Browser Actions menu. * @param type The type of the url for context menu to be opened. * @param menuItems List of custom items to add to Browser Actions menu. */ private static void openFallbackBrowserActionsMenu( Context context, Uri uri, int type, List<BrowserActionItem> menuItems) { BrowserActionsFallbackMenuUi menuUi = new BrowserActionsFallbackMenuUi(context, uri, menuItems); menuUi.displayMenu(); if (sDialogListenter != null) { sDialogListenter.onDialogShown(); } } /** * Gets custom item list for browser action menu. * @param bundles Data for custom items from {@link BrowserActionsIntent}. * @return List of {@link BrowserActionItem} */ public static List<BrowserActionItem> parseBrowserActionItems(ArrayList<Bundle> bundles) { List<BrowserActionItem> mActions = new ArrayList<>(); for (int i = 0; i < bundles.size(); i++) { Bundle bundle = bundles.get(i); String title = bundle.getString(BrowserActionsIntent.KEY_TITLE); PendingIntent action = bundle.getParcelable(BrowserActionsIntent.KEY_ACTION); @DrawableRes int iconId = bundle.getInt(BrowserActionsIntent.KEY_ICON_ID); if (TextUtils.isEmpty(title) || action == null) { throw new IllegalArgumentException( "Custom item should contain a non-empty title and non-null intent."); } else { BrowserActionItem item = new BrowserActionItem(title, action, iconId); mActions.add(item); } } return mActions; } /** * Get the package name of the creator application. * @param intent The {@link BrowserActionsIntent}. * @return The creator package name. */ @SuppressWarnings("deprecation") public static String getCreatorPackageName(Intent intent) { PendingIntent pendingIntent = intent.getParcelableExtra(BrowserActionsIntent.EXTRA_APP_ID); if (pendingIntent != null) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) { return pendingIntent.getCreatorPackage(); } else { return pendingIntent.getTargetPackage(); } } return null; } }
D
/* * Copyright (C) 2001-2006 Bart Massey, Jamey Sharp, and Josh Triplett. * All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * 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 AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Except as contained in this notice, the names of the authors or their * institutions shall not be used in advertising or otherwise to promote the * sale, use or other dealings in this Software without prior written * authorization from the authors. */ module std.c.xcb.xcb; import std.c.xcb.xproto; /** * @file xcb.d */ /** * @defgroup XCB_Core_API XCB Core API * @brief Core API of the XCB library. * * @{ */ /* Pre-defined constants */ /** Current protocol version */ const int X_PROTOCOL = 11; /** Current minor version */ const int X_PROTOCOL_REVISION = 0; /** X_TCP_PORT + display number = server port for TCP transport */ const int X_TCP_PORT = 6000; /** xcb connection errors because of socket, pipe and other stream errors. */ const int XCB_CONN_ERROR = 1; /** xcb connection shutdown because of extension not sppported */ const int XCB_CONN_CLOSED_EXT_NOTSUPPORTED = 2; /** malloc(), calloc() and realloc() error upon failure, for eg ENOMEM */ const int XCB_CONN_CLOSED_MEM_INSUFFICIENT = 3; /** Connection closed, exceeding request length that server accepts. */ const int XCB_CONN_CLOSED_REQ_LEN_EXCEED = 4; /** Connection closed, error during parsing display string. */ const int XCB_CONN_CLOSED_PARSE_ERR = 5; //#define XCB_TYPE_PAD(T,I) (-(I) & (sizeof(T) > 4 ? 3 : sizeof(T) - 1)) int XCB_TYPE_PAD (T)(T t, int i) { return -(i) & (t.sizeof > 4 ? 3 : t.sizeof - 1); } /* Opaque structures */ /** * @brief XCB Connection structure. * * A structure that contain all data that XCB needs to communicate with an X server. */ struct xcb_connection_t {}; /**< Opaque structure containing all data that XCB needs to communicate with an X server. */ /* Other types */ /** * @brief Generic iterator. * * A generic iterator structure. */ struct xcb_generic_iterator_t { void *data; /**< Data of the current iterator */ int rem; /**< remaining elements */ int index; /**< index of the current iterator */ } /** * @brief Generic reply. * * A generic reply structure. */ struct xcb_generic_reply_t { ubyte response_type; /**< Type of the response */ ubyte pad0; /**< Padding */ ushort sequence; /**< Sequence number */ uint length; /**< Length of the response */ } /** * @brief Generic event. * * A generic event structure. */ struct xcb_generic_event_t { ubyte response_type; /**< Type of the response */ ubyte pad0; /**< Padding */ ushort sequence; /**< Sequence number */ uint pad[7]; /**< Padding */ uint full_sequence; /**< full sequence */ } /** * @brief GE event * * An event as sent by the XGE extension. The length field specifies the * number of 4-byte blocks trailing the struct. */ struct xcb_ge_event_t { ubyte response_type; /**< Type of the response */ ubyte pad0; /**< Padding */ ushort sequence; /**< Sequence number */ uint length; ushort event_type; ushort pad1; uint pad[5]; /**< Padding */ uint full_sequence; /**< full sequence */ } /** * @brief Generic error. * * A generic error structure. */ struct xcb_generic_error_t { ubyte response_type; /**< Type of the response */ ubyte error_code; /**< Error code */ ushort sequence; /**< Sequence number */ uint resource_id; /** < Resource ID for requests with side effects only */ ushort minor_code; /** < Minor opcode of the failed request */ ubyte major_code; /** < Major opcode of the failed request */ ubyte pad0; uint pad[5]; /**< Padding */ uint full_sequence; /**< full sequence */ } /** * @brief Generic cookie. * * A generic cookie structure. */ struct xcb_void_cookie_t { uint sequence; /**< Sequence number */ } /** XCB_NONE is the universal null resource or null atom parameter value for many core X requests */ const uint XCB_NONE = 0; /** XCB_COPY_FROM_PARENT can be used for many xcb_create_window parameters */ const uint XCB_COPY_FROM_PARENT = 0; /** XCB_CURRENT_TIME can be used in most requests that take an xcb_timestamp_t */ const uint XCB_CURRENT_TIME = 0; /** XCB_NO_SYMBOL fills in unused entries in xcb_keysym_t tables */ const uint XCB_NO_SYMBOL = 0; /* xcb_auth.c */ /** * @brief Container for authorization information. * * A container for authorization information to be sent to the X server. */ struct xcb_auth_info_t { int namelen; /**< Length of the string name (as returned by strlen). */ char *name; /**< String containing the authentication protocol name, such as "MIT-MAGIC-COOKIE-1" or "XDM-AUTHORIZATION-1". */ int datalen; /**< Length of the data member. */ char *data; /**< Data interpreted in a protocol-specific manner. */ } /* xcb_out.c */ extern(C) { /** * @brief Forces any buffered output to be written to the server. * @param c: The connection to the X server. * @return > @c 0 on success, <= @c 0 otherwise. * * Forces any buffered output to be written to the server. Blocks * until the write is complete. */ int xcb_flush(xcb_connection_t *c); /** * @brief Returns the maximum request length that this server accepts. * @param c: The connection to the X server. * @return The maximum request length field. * * In the absence of the BIG-REQUESTS extension, returns the * maximum request length field from the connection setup data, which * may be as much as 65535. If the server supports BIG-REQUESTS, then * the maximum request length field from the reply to the * BigRequestsEnable request will be returned instead. * * Note that this length is measured in four-byte units, making the * theoretical maximum lengths roughly 256kB without BIG-REQUESTS and * 16GB with. */ uint xcb_get_maximum_request_length(xcb_connection_t *c); /** * @brief Prefetch the maximum request length without blocking. * @param c: The connection to the X server. * * Without blocking, does as much work as possible toward computing * the maximum request length accepted by the X server. * * Invoking this function may cause a call to xcb_big_requests_enable, * but will not block waiting for the reply. * xcb_get_maximum_request_length will return the prefetched data * after possibly blocking while the reply is retrieved. * * Note that in order for this function to be fully non-blocking, the * application must previously have called * xcb_prefetch_extension_data(c, &xcb_big_requests_id) and the reply * must have already arrived. */ void xcb_prefetch_maximum_request_length(xcb_connection_t *c); /* xcb_in.c */ /** * @brief Returns the next event or error from the server. * @param c: The connection to the X server. * @return The next event from the server. * * Returns the next event or error from the server, or returns null in * the event of an I/O error. Blocks until either an event or error * arrive, or an I/O error occurs. */ xcb_generic_event_t *xcb_wait_for_event(xcb_connection_t *c); /** * @brief Returns the next event or error from the server. * @param c: The connection to the X server. * error status of the operation. * @return The next event from the server. * * Returns the next event or error from the server, if one is * available, or returns @c NULL otherwise. If no event is available, that * might be because an I/O error like connection close occurred while * attempting to read the next event, in which case the connection is * shut down when this function returns. */ xcb_generic_event_t *xcb_poll_for_event(xcb_connection_t *c); /** * @brief Returns the next event without reading from the connection. * @param c: The connection to the X server. * @return The next already queued event from the server. * * This is a version of xcb_poll_for_event that only examines the * event queue for new events. The function doesn't try to read new * events from the connection if no queued events are found. * * This function is useful for callers that know in advance that all * interesting events have already been read from the connection. For * example, callers might use xcb_wait_for_reply and be interested * only of events that preceded a specific reply. */ xcb_generic_event_t *xcb_poll_for_queued_event(xcb_connection_t *c); /** * @brief Return the error for a request, or NULL if none can ever arrive. * @param c: The connection to the X server. * @param cookie: The request cookie. * @return The error for the request, or NULL if none can ever arrive. * * The xcb_void_cookie_t cookie supplied to this function must have resulted * from a call to xcb_[request_name]_checked(). This function will block * until one of two conditions happens. If an error is received, it will be * returned. If a reply to a subsequent request has already arrived, no error * can arrive for this request, so this function will return NULL. * * Note that this function will perform a sync if needed to ensure that the * sequence number will advance beyond that provided in cookie; this is a * convenience to avoid races in determining whether the sync is needed. */ xcb_generic_error_t *xcb_request_check(xcb_connection_t *c, xcb_void_cookie_t cookie); /** * @brief Discards the reply for a request. * @param c: The connection to the X server. * @param sequence: The request sequence number from a cookie. * * Discards the reply for a request. Additionally, any error generated * by the request is also discarded (unless it was an _unchecked request * and the error has already arrived). * * This function will not block even if the reply is not yet available. * * Note that the sequence really does have to come from an xcb cookie; * this function is not designed to operate on socket-handoff replies. */ void xcb_discard_reply(xcb_connection_t *c, uint sequence); /* xcb_ext.c */ /** * @typedef typedef struct xcb_extension_t xcb_extension_t */ struct xcb_extension_t {}; /**< Opaque structure used as key for xcb_get_extension_data_t. */ /** * @brief Caches reply information from QueryExtension requests. * @param c: The connection. * @param ext: The extension data. * @return A pointer to the xcb_query_extension_reply_t for the extension. * * This function is the primary interface to the "extension cache", * which caches reply information from QueryExtension * requests. Invoking this function may cause a call to * xcb_query_extension to retrieve extension information from the * server, and may block until extension data is received from the * server. * * The result must not be freed. This storage is managed by the cache * itself. */ /+const+/ xcb_query_extension_reply_t *xcb_get_extension_data(xcb_connection_t *c, xcb_extension_t *ext); /** * @brief Prefetch of extension data into the extension cache * @param c: The connection. * @param ext: The extension data. * * This function allows a "prefetch" of extension data into the * extension cache. Invoking the function may cause a call to * xcb_query_extension, but will not block waiting for the * reply. xcb_get_extension_data will return the prefetched data after * possibly blocking while it is retrieved. */ void xcb_prefetch_extension_data(xcb_connection_t *c, xcb_extension_t *ext); /* xcb_conn.c */ /** * @brief Access the data returned by the server. * @param c: The connection. * @return A pointer to an xcb_setup_t structure. * * Accessor for the data returned by the server when the xcb_connection_t * was initialized. This data includes * - the server's required format for images, * - a list of available visuals, * - a list of available screens, * - the server's maximum request length (in the absence of the * BIG-REQUESTS extension), * - and other assorted information. * * See the X protocol specification for more details. * * The result must not be freed. */ /+const+/ xcb_setup_t *xcb_get_setup(xcb_connection_t *c); /** * @brief Access the file descriptor of the connection. * @param c: The connection. * @return The file descriptor. * * Accessor for the file descriptor that was passed to the * xcb_connect_to_fd call that returned @p c. */ int xcb_get_file_descriptor(xcb_connection_t *c); /** * @brief Test whether the connection has shut down due to a fatal error. * @param c: The connection. * @return > 0 if the connection is in an error state; 0 otherwise. * * Some errors that occur in the context of an xcb_connection_t * are unrecoverable. When such an error occurs, the * connection is shut down and further operations on the * xcb_connection_t have no effect. * * @return XCB_CONN_ERROR, because of socket errors, pipe errors or other stream errors. * @return XCB_CONN_CLOSED_EXT_NOTSUPPORTED, when extension not supported. * @return XCB_CONN_CLOSED_MEM_INSUFFICIENT, when memory not available. * @return XCB_CONN_CLOSED_REQ_LEN_EXCEED, exceeding request length that server accepts. * @return XCB_CONN_CLOSED_PARSE_ERR, error during parsing display string. */ int xcb_connection_has_error(xcb_connection_t *c); /** * @brief Connects to the X server. * @param fd: The file descriptor. * @param auth_info: Authentication data. * @return A newly allocated xcb_connection_t structure. * * Connects to an X server, given the open socket @p fd and the * xcb_auth_info_t @p auth_info. The file descriptor @p fd is * bidirectionally connected to an X server. If the connection * should be unauthenticated, @p auth_info must be @c * NULL. */ xcb_connection_t *xcb_connect_to_fd(int fd, xcb_auth_info_t *auth_info); /** * @brief Closes the connection. * @param c: The connection. * * Closes the file descriptor and frees all memory associated with the * connection @c c. */ void xcb_disconnect(xcb_connection_t *c); /* xcb_util.c */ /** * @brief Parses a display string name in the form documented by X(7x). * @param name: The name of the display. * @param host: A pointer to a malloc'd copy of the hostname. * @param display: A pointer to the display number. * @param screen: A pointer to the screen number. * @return 0 on failure, non 0 otherwise. * * Parses the display string name @p display_name in the form * documented by X(7x). Has no side effects on failure. If * @p displayname is @c NULL or empty, it uses the environment * variable DISPLAY. @p hostp is a pointer to a newly allocated string * that contain the host name. @p displayp is set to the display * number and @p screenp to the preferred screen number. @p screenp * can be @c NULL. If @p displayname does not contain a screen number, * it is set to @c 0. */ int xcb_parse_display(/+const+/ char *name, char **host, int *display, int *screen); /** * @brief Connects to the X server. * @param displayname: The name of the display. * @param screenp: A pointer to a preferred screen number. * @return A newly allocated xcb_connection_t structure. * * Connects to the X server specified by @p displayname. If @p * displayname is @c NULL, uses the value of the DISPLAY environment * variable. If a particular screen on that server is preferred, the * int pointed to by @p screenp (if not @c NULL) will be set to that * screen; otherwise the screen will be set to 0. */ xcb_connection_t *xcb_connect(/+const+/ char *displayname, int *screenp); /** * @brief Connects to the X server, using an authorization information. * @param display: The name of the display. * @param auth: The authorization information. * @param screen: A pointer to a preferred screen number. * @return A newly allocated xcb_connection_t structure. * * Connects to the X server specified by @p displayname, using the * authorization @p auth. If a particular screen on that server is * preferred, the int pointed to by @p screenp (if not @c NULL) will * be set to that screen; otherwise @p screenp will be set to 0. */ xcb_connection_t *xcb_connect_to_display_with_auth_info(/+const+/ char *display, xcb_auth_info_t *auth, int *screen); /* xcb_xid.c */ /** * @brief Allocates an XID for a new object. * @param c: The connection. * @return A newly allocated XID. * * Allocates an XID for a new object. Typically used just prior to * various object creation functions, such as xcb_create_window. */ uint xcb_generate_id(xcb_connection_t *c); } // extern(C) /** * @} */
D
extern (C++) int add(int a, int b){ return a + b; }
D
INSTANCE Mod_7122_ASS_Maysara_NW (Npc_Default) { // ------ NSC ------ name = "Maysara"; guild = GIL_OUT; id = 7122; voice = 0; flags = 0; npctype = NPCTYPE_MAIN; // ------ Attribute ------ B_SetAttributesToChapter (self, 4); // ------ Kampf-Taktik ------ fight_tactic = FAI_HUMAN_NORMAL; // ------ Equippte Waffen ------ EquipItem (self, ItMw_Assassinenkralle); EquipItem (self, ItRw_Todesbogen); // ------ Inventory ------ B_CreateAmbientInv (self); // ------ visuals ------ B_SetNpcVisual (self, MALE, "Hum_Head_Bald", Face_B_Normal_Sharky, BodyTex_B, ITAR_Assassine_01); Mdl_SetModelFatness (self,0); //Mdl_ApplyOverlayMds (self, "Humans_Relaxed.mds"); // ------ NSC-relevante Talente vergeben ------ B_GiveNpcTalents (self); // ------ Kampf-Talente ------ B_SetFightSkills (self, 50); // ------ TA anmelden ------ daily_routine = Rtn_Start_7122; }; FUNC VOID Rtn_Start_7122() { TA_Smalltalk (07,20,01,20,"WP_ASSASSINE_32"); TA_Smalltalk (01,20,07,20,"WP_ASSASSINE_32"); }; FUNC VOID Rtn_Schlacht_7122() { TA_Stand_Guarding (07,20,01,20,"WP_ASSASSINE_51"); TA_Stand_Guarding (01,20,07,20,"WP_ASSASSINE_51"); }; FUNC VOID Rtn_Tot_7122() { TA_Stand_Guarding (07,20,01,20,"TOT"); TA_Stand_Guarding (01,20,07,20,"TOT"); };
D
/Users/vishesh/Downloads/SkipQueue/build/SkipQueue.build/Debug-iphoneos/SkipQueue.build/Objects-normal/armv7/customCellMalls.o : /Users/vishesh/Downloads/SkipQueue/SkipQueue/OTPVC.swift /Users/vishesh/Downloads/SkipQueue/SkipQueue/locationVC.swift /Users/vishesh/Downloads/SkipQueue/SkipQueue/mallsVC.swift /Users/vishesh/Downloads/SkipQueue/SkipQueue/ViewController.swift /Users/vishesh/Downloads/SkipQueue/SkipQueue/customCellMalls.swift /Users/vishesh/Downloads/SkipQueue/SkipQueue/AppDelegate.swift /Users/vishesh/Downloads/SkipQueue/SkipQueue/register.swift /Users/vishesh/Downloads/SkipQueue/SkipQueue/DatabaseManager.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/armv7/Swift.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/armv7/SwiftOnoneSupport.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/armv7/Foundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/armv7/Darwin.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/armv7/Dispatch.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/armv7/ObjectiveC.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/armv7/CoreGraphics.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/armv7/UIKit.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/armv7/QuartzCore.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/armv7/CoreImage.swiftmodule /Users/vishesh/Downloads/SkipQueue/build/SkipQueue.build/Debug-iphoneos/SkipQueue.build/Objects-normal/armv7/customCellMalls~partial.swiftmodule : /Users/vishesh/Downloads/SkipQueue/SkipQueue/OTPVC.swift /Users/vishesh/Downloads/SkipQueue/SkipQueue/locationVC.swift /Users/vishesh/Downloads/SkipQueue/SkipQueue/mallsVC.swift /Users/vishesh/Downloads/SkipQueue/SkipQueue/ViewController.swift /Users/vishesh/Downloads/SkipQueue/SkipQueue/customCellMalls.swift /Users/vishesh/Downloads/SkipQueue/SkipQueue/AppDelegate.swift /Users/vishesh/Downloads/SkipQueue/SkipQueue/register.swift /Users/vishesh/Downloads/SkipQueue/SkipQueue/DatabaseManager.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/armv7/Swift.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/armv7/SwiftOnoneSupport.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/armv7/Foundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/armv7/Darwin.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/armv7/Dispatch.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/armv7/ObjectiveC.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/armv7/CoreGraphics.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/armv7/UIKit.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/armv7/QuartzCore.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/armv7/CoreImage.swiftmodule /Users/vishesh/Downloads/SkipQueue/build/SkipQueue.build/Debug-iphoneos/SkipQueue.build/Objects-normal/armv7/customCellMalls~partial.swiftdoc : /Users/vishesh/Downloads/SkipQueue/SkipQueue/OTPVC.swift /Users/vishesh/Downloads/SkipQueue/SkipQueue/locationVC.swift /Users/vishesh/Downloads/SkipQueue/SkipQueue/mallsVC.swift /Users/vishesh/Downloads/SkipQueue/SkipQueue/ViewController.swift /Users/vishesh/Downloads/SkipQueue/SkipQueue/customCellMalls.swift /Users/vishesh/Downloads/SkipQueue/SkipQueue/AppDelegate.swift /Users/vishesh/Downloads/SkipQueue/SkipQueue/register.swift /Users/vishesh/Downloads/SkipQueue/SkipQueue/DatabaseManager.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/armv7/Swift.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/armv7/SwiftOnoneSupport.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/armv7/Foundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/armv7/Darwin.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/armv7/Dispatch.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/armv7/ObjectiveC.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/armv7/CoreGraphics.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/armv7/UIKit.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/armv7/QuartzCore.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/armv7/CoreImage.swiftmodule
D
void main() { auto ip = readAs!(int[]), A = ip[0], B = ip[1], C = ip[2]; if(ip.sort().uniq.array.length == 2) writeln("Yes"); else writeln("No"); } // =================================== import std.stdio; import std.string; import std.functional; import std.algorithm; import std.range; import std.traits; import std.math; import std.container; import std.bigint; import std.numeric; import std.conv; import std.typecons; import std.uni; import std.ascii; import std.bitmanip; import core.bitop; T readAs(T)() if (isBasicType!T) { return readln.chomp.to!T; } T readAs(T)() if (isArray!T) { return readln.split.to!T; } T[][] readMatrix(T)(uint height, uint width) if (!isSomeChar!T) { auto res = new T[][](height, width); foreach(i; 0..height) { res[i] = readAs!(T[]); } return res; } T[][] readMatrix(T)(uint height, uint width) if (isSomeChar!T) { auto res = new T[][](height, width); foreach(i; 0..height) { auto s = rs; foreach(j; 0..width) res[i][j] = s[j].to!T; } return res; } int ri() { return readAs!int; } double rd() { return readAs!double; } string rs() { return readln.chomp; }
D
/mnt/c/Users/zeliwang/hello_world/digital_signature/target/release/deps/bincode-10422321c7d3b41b.rmeta: /home/zeliwang/.cargo/registry/src/mirrors.ustc.edu.cn-61ef6e0cd06fb9b8/bincode-1.1.4/src/lib.rs /home/zeliwang/.cargo/registry/src/mirrors.ustc.edu.cn-61ef6e0cd06fb9b8/bincode-1.1.4/src/config.rs /home/zeliwang/.cargo/registry/src/mirrors.ustc.edu.cn-61ef6e0cd06fb9b8/bincode-1.1.4/src/de/mod.rs /home/zeliwang/.cargo/registry/src/mirrors.ustc.edu.cn-61ef6e0cd06fb9b8/bincode-1.1.4/src/de/read.rs /home/zeliwang/.cargo/registry/src/mirrors.ustc.edu.cn-61ef6e0cd06fb9b8/bincode-1.1.4/src/error.rs /home/zeliwang/.cargo/registry/src/mirrors.ustc.edu.cn-61ef6e0cd06fb9b8/bincode-1.1.4/src/internal.rs /home/zeliwang/.cargo/registry/src/mirrors.ustc.edu.cn-61ef6e0cd06fb9b8/bincode-1.1.4/src/ser/mod.rs /mnt/c/Users/zeliwang/hello_world/digital_signature/target/release/deps/libbincode-10422321c7d3b41b.rlib: /home/zeliwang/.cargo/registry/src/mirrors.ustc.edu.cn-61ef6e0cd06fb9b8/bincode-1.1.4/src/lib.rs /home/zeliwang/.cargo/registry/src/mirrors.ustc.edu.cn-61ef6e0cd06fb9b8/bincode-1.1.4/src/config.rs /home/zeliwang/.cargo/registry/src/mirrors.ustc.edu.cn-61ef6e0cd06fb9b8/bincode-1.1.4/src/de/mod.rs /home/zeliwang/.cargo/registry/src/mirrors.ustc.edu.cn-61ef6e0cd06fb9b8/bincode-1.1.4/src/de/read.rs /home/zeliwang/.cargo/registry/src/mirrors.ustc.edu.cn-61ef6e0cd06fb9b8/bincode-1.1.4/src/error.rs /home/zeliwang/.cargo/registry/src/mirrors.ustc.edu.cn-61ef6e0cd06fb9b8/bincode-1.1.4/src/internal.rs /home/zeliwang/.cargo/registry/src/mirrors.ustc.edu.cn-61ef6e0cd06fb9b8/bincode-1.1.4/src/ser/mod.rs /mnt/c/Users/zeliwang/hello_world/digital_signature/target/release/deps/bincode-10422321c7d3b41b.d: /home/zeliwang/.cargo/registry/src/mirrors.ustc.edu.cn-61ef6e0cd06fb9b8/bincode-1.1.4/src/lib.rs /home/zeliwang/.cargo/registry/src/mirrors.ustc.edu.cn-61ef6e0cd06fb9b8/bincode-1.1.4/src/config.rs /home/zeliwang/.cargo/registry/src/mirrors.ustc.edu.cn-61ef6e0cd06fb9b8/bincode-1.1.4/src/de/mod.rs /home/zeliwang/.cargo/registry/src/mirrors.ustc.edu.cn-61ef6e0cd06fb9b8/bincode-1.1.4/src/de/read.rs /home/zeliwang/.cargo/registry/src/mirrors.ustc.edu.cn-61ef6e0cd06fb9b8/bincode-1.1.4/src/error.rs /home/zeliwang/.cargo/registry/src/mirrors.ustc.edu.cn-61ef6e0cd06fb9b8/bincode-1.1.4/src/internal.rs /home/zeliwang/.cargo/registry/src/mirrors.ustc.edu.cn-61ef6e0cd06fb9b8/bincode-1.1.4/src/ser/mod.rs /home/zeliwang/.cargo/registry/src/mirrors.ustc.edu.cn-61ef6e0cd06fb9b8/bincode-1.1.4/src/lib.rs: /home/zeliwang/.cargo/registry/src/mirrors.ustc.edu.cn-61ef6e0cd06fb9b8/bincode-1.1.4/src/config.rs: /home/zeliwang/.cargo/registry/src/mirrors.ustc.edu.cn-61ef6e0cd06fb9b8/bincode-1.1.4/src/de/mod.rs: /home/zeliwang/.cargo/registry/src/mirrors.ustc.edu.cn-61ef6e0cd06fb9b8/bincode-1.1.4/src/de/read.rs: /home/zeliwang/.cargo/registry/src/mirrors.ustc.edu.cn-61ef6e0cd06fb9b8/bincode-1.1.4/src/error.rs: /home/zeliwang/.cargo/registry/src/mirrors.ustc.edu.cn-61ef6e0cd06fb9b8/bincode-1.1.4/src/internal.rs: /home/zeliwang/.cargo/registry/src/mirrors.ustc.edu.cn-61ef6e0cd06fb9b8/bincode-1.1.4/src/ser/mod.rs:
D
/** Base class for BSD socket based driver implementations. See_also: `eventcore.drivers.select`, `eventcore.drivers.epoll`, `eventcore.drivers.kqueue` */ module eventcore.drivers.posix; @safe: /*@nogc:*/ nothrow: public import eventcore.driver; import eventcore.drivers.timer; import eventcore.drivers.threadedfile; import eventcore.internal.consumablequeue : ConsumableQueue; import eventcore.internal.utils; import std.socket : Address, AddressFamily, InternetAddress, Internet6Address, UnknownAddress; version (Posix) { import std.socket : UnixAddress; import core.sys.posix.netdb : AI_ADDRCONFIG, AI_V4MAPPED, addrinfo, freeaddrinfo, getaddrinfo; import core.sys.posix.netinet.in_; import core.sys.posix.netinet.tcp; import core.sys.posix.sys.un; import core.sys.posix.unistd : close, read, write; import core.stdc.errno : errno, EAGAIN, EINPROGRESS; import core.sys.posix.fcntl; } version (Windows) { import core.sys.windows.winsock2; alias sockaddr_storage = SOCKADDR_STORAGE; alias EAGAIN = WSAEWOULDBLOCK; extern (C) int read(int fd, void *buffer, uint count) nothrow; extern (C) int write(int fd, const(void) *buffer, uint count) nothrow; extern (C) int close(int fd) nothrow @safe; } version (linux) { extern (C) int eventfd(uint initval, int flags); enum EFD_NONBLOCK = 0x800; } private long currStdTime() { import std.datetime : Clock; scope (failure) assert(false); return Clock.currStdTime; } final class PosixEventDriver(Loop : PosixEventLoop) : EventDriver { @safe: /*@nogc:*/ nothrow: private { alias CoreDriver = PosixEventDriverCore!(Loop, TimerDriver, EventsDriver); alias EventsDriver = PosixEventDriverEvents!Loop; version (linux) alias SignalsDriver = SignalFDEventDriverSignals!Loop; else alias SignalsDriver = DummyEventDriverSignals!Loop; alias TimerDriver = LoopTimeoutTimerDriver; alias SocketsDriver = PosixEventDriverSockets!Loop; /*version (linux) alias DNSDriver = EventDriverDNS_GAIA!(EventsDriver, SignalsDriver); else*/ alias DNSDriver = EventDriverDNS_GAI!(EventsDriver, SignalsDriver); alias FileDriver = ThreadedFileEventDriver!EventsDriver; version (linux) alias WatcherDriver = InotifyEventDriverWatchers!Loop; else alias WatcherDriver = PosixEventDriverWatchers!Loop; Loop m_loop; CoreDriver m_core; EventsDriver m_events; SignalsDriver m_signals; LoopTimeoutTimerDriver m_timers; SocketsDriver m_sockets; DNSDriver m_dns; FileDriver m_files; WatcherDriver m_watchers; } this() { m_loop = new Loop; m_events = new EventsDriver(m_loop); m_signals = new SignalsDriver(m_loop); m_timers = new TimerDriver; m_core = new CoreDriver(m_loop, m_timers, m_events); m_sockets = new SocketsDriver(m_loop); m_dns = new DNSDriver(m_events, m_signals); m_files = new FileDriver(m_events); m_watchers = new WatcherDriver(m_loop); } // force overriding these in the (final) sub classes to avoid virtual calls final override @property CoreDriver core() { return m_core; } final override @property EventsDriver events() { return m_events; } final override @property SignalsDriver signals() { return m_signals; } final override @property TimerDriver timers() { return m_timers; } final override @property SocketsDriver sockets() { return m_sockets; } final override @property DNSDriver dns() { return m_dns; } final override @property FileDriver files() { return m_files; } final override @property WatcherDriver watchers() { return m_watchers; } final override void dispose() { m_files.dispose(); m_dns.dispose(); m_loop.dispose(); } } final class PosixEventDriverCore(Loop : PosixEventLoop, Timers : EventDriverTimers, Events : EventDriverEvents) : EventDriverCore { @safe: nothrow: import core.time : Duration; protected alias ExtraEventsCallback = bool delegate(long); private { Loop m_loop; Timers m_timers; Events m_events; bool m_exit = false; FD m_wakeupEvent; } protected this(Loop loop, Timers timers, Events events) { m_loop = loop; m_timers = timers; m_wakeupEvent = events.create(); } @property size_t waiterCount() const { return m_loop.m_waiterCount; } final override ExitReason processEvents(Duration timeout) { import std.algorithm : min; import core.time : hnsecs, seconds; if (m_exit) { m_exit = false; return ExitReason.exited; } if (!waiterCount) return ExitReason.outOfWaiters; bool got_events; if (timeout <= 0.seconds) { got_events = m_loop.doProcessEvents(0.seconds); m_timers.process(currStdTime); } else { long now = currStdTime; do { auto nextto = min(m_timers.getNextTimeout(now), timeout); got_events = m_loop.doProcessEvents(nextto); long prev_step = now; now = currStdTime; got_events |= m_timers.process(now); if (timeout != Duration.max) timeout -= (now - prev_step).hnsecs; } while (timeout > 0.seconds && !m_exit && !got_events); } if (m_exit) { m_exit = false; return ExitReason.exited; } if (!waiterCount) return ExitReason.outOfWaiters; if (got_events) return ExitReason.idle; return ExitReason.timeout; } final override void exit() { m_exit = true; long one = 1; () @trusted { .write(m_wakeupEvent, &one, one.sizeof); } (); } final override void clearExitFlag() { m_exit = false; } final protected override void* rawUserData(StreamSocketFD descriptor, size_t size, DataInitializer initialize, DataInitializer destroy) @system { FDSlot* fds = &m_loop.m_fds[descriptor].common; assert(fds.userDataDestructor is null || fds.userDataDestructor is destroy, "Requesting user data with differing type (destructor)."); assert(size <= FDSlot.userData.length, "Requested user data is too large."); if (size > FDSlot.userData.length) assert(false); if (!fds.userDataDestructor) { initialize(fds.userData.ptr); fds.userDataDestructor = destroy; } return m_loop.m_fds[descriptor].common.userData.ptr; } } final class PosixEventDriverSockets(Loop : PosixEventLoop) : EventDriverSockets { @safe: /*@nogc:*/ nothrow: private Loop m_loop; this(Loop loop) { m_loop = loop; } final override StreamSocketFD connectStream(scope Address address, scope Address bind_address, ConnectCallback on_connect) { auto sock = cast(StreamSocketFD)createSocket(address.addressFamily, SOCK_STREAM); if (sock == -1) return StreamSocketFD.invalid; void invalidateSocket() @nogc @trusted nothrow { closeSocket(sock); sock = StreamSocketFD.invalid; } int bret; () @trusted { // scope + bind() if (bind_address !is null) { bret = bind(sock, bind_address.name, bind_address.nameLen); } else { scope bind_addr = new UnknownAddress; bind_addr.name.sa_family = cast(ushort)address.addressFamily; bind_addr.name.sa_data[] = 0; bret = bind(sock, bind_addr.name, bind_addr.nameLen); } } (); if (bret != 0) { invalidateSocket(); on_connect(sock, ConnectStatus.bindFailure); return sock; } m_loop.initFD(sock); m_loop.registerFD(sock, EventMask.read|EventMask.write|EventMask.status); m_loop.m_fds[sock].specific = StreamSocketSlot.init; auto ret = () @trusted { return connect(sock, address.name, address.nameLen); } (); if (ret == 0) { m_loop.m_fds[sock].specific.state = ConnectionState.connected; on_connect(sock, ConnectStatus.connected); } else { auto err = getSocketError(); if (err == EINPROGRESS) { with (m_loop.m_fds[sock].streamSocket) { connectCallback = on_connect; state = ConnectionState.connecting; } m_loop.setNotifyCallback!(EventType.write)(sock, &onConnect); } else { m_loop.clearFD(sock); m_loop.unregisterFD(sock); invalidateSocket(); on_connect(sock, ConnectStatus.unknownError); return sock; } } return sock; } private void onConnect(FD sock) { m_loop.setNotifyCallback!(EventType.write)(sock, null); with (m_loop.m_fds[sock].streamSocket) { state = ConnectionState.connected; connectCallback(cast(StreamSocketFD)sock, ConnectStatus.connected); connectCallback = null; } } private void onConnectError(FD sock) { // FIXME: determine the correct kind of error! with (m_loop.m_fds[sock].streamSocket) { state = ConnectionState.closed; connectCallback(cast(StreamSocketFD)sock, ConnectStatus.refused); connectCallback = null; } } final override StreamListenSocketFD listenStream(scope Address address, AcceptCallback on_accept) { log("Listen stream"); auto sock = cast(StreamListenSocketFD)createSocket(address.addressFamily, SOCK_STREAM); void invalidateSocket() @nogc @trusted nothrow { closeSocket(sock); sock = StreamSocketFD.invalid; } () @trusted { int tmp_reuse = 1; // FIXME: error handling! if (setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, &tmp_reuse, tmp_reuse.sizeof) != 0) { log("setsockopt failed."); invalidateSocket(); } else if (bind(sock, address.name, address.nameLen) != 0) { log("bind failed."); invalidateSocket(); } else if (listen(sock, 128) != 0) { log("listen failed."); invalidateSocket(); } else log("Success!"); } (); if (sock == StreamListenSocketFD.invalid) return sock; m_loop.initFD(sock); m_loop.m_fds[sock].specific = StreamListenSocketSlot.init; if (on_accept) waitForConnections(sock, on_accept); return sock; } final override void waitForConnections(StreamListenSocketFD sock, AcceptCallback on_accept) { log("wait for conn"); m_loop.registerFD(sock, EventMask.read); m_loop.m_fds[sock].streamListen.acceptCallback = on_accept; m_loop.setNotifyCallback!(EventType.read)(sock, &onAccept); onAccept(sock); } private void onAccept(FD listenfd) { foreach (i; 0 .. 20) { int sockfd; sockaddr_storage addr; version (Windows) int addr_len = addr.sizeof; else uint addr_len = addr.sizeof; () @trusted { sockfd = accept(listenfd, () @trusted { return cast(sockaddr*)&addr; } (), &addr_len); } (); if (sockfd == -1) break; setSocketNonBlocking(cast(SocketFD)sockfd); auto fd = cast(StreamSocketFD)sockfd; m_loop.initFD(fd); m_loop.m_fds[fd].specific = StreamSocketSlot.init; m_loop.registerFD(fd, EventMask.read|EventMask.write|EventMask.status); //print("accept %d", sockfd); m_loop.m_fds[listenfd].streamListen.acceptCallback(cast(StreamListenSocketFD)listenfd, fd); } } ConnectionState getConnectionState(StreamSocketFD sock) { return m_loop.m_fds[sock].streamSocket.state; } final override void setTCPNoDelay(StreamSocketFD socket, bool enable) { int opt = enable; () @trusted { setsockopt(socket, IPPROTO_TCP, TCP_NODELAY, cast(char*)&opt, opt.sizeof); } (); } final override void read(StreamSocketFD socket, ubyte[] buffer, IOMode mode, IOCallback on_read_finish) { if (buffer.length == 0) { on_read_finish(socket, IOStatus.ok, 0); return; } sizediff_t ret; () @trusted { ret = .recv(socket, buffer.ptr, buffer.length, 0); } (); if (ret < 0) { auto err = getSocketError(); if (err != EAGAIN) { print("sock error %s!", err); on_read_finish(socket, IOStatus.error, 0); return; } } if (ret == 0) { on_read_finish(socket, IOStatus.disconnected, 0); return; } if (ret < 0 && mode == IOMode.immediate) { on_read_finish(socket, IOStatus.wouldBlock, 0); return; } if (ret > 0) { buffer = buffer[ret .. $]; if (mode != IOMode.all || buffer.length == 0) { on_read_finish(socket, IOStatus.ok, ret); return; } } // NOTE: since we know that not all data was read from the stream // socket, the next call to recv is guaranteed to return EGAIN // and we can avoid that call. with (m_loop.m_fds[socket].streamSocket) { readCallback = on_read_finish; readMode = mode; bytesRead = ret > 0 ? ret : 0; readBuffer = buffer; } m_loop.setNotifyCallback!(EventType.read)(socket, &onSocketRead); } override void cancelRead(StreamSocketFD socket) { assert(m_loop.m_fds[socket].streamSocket.readCallback !is null, "Cancelling read when there is no read in progress."); m_loop.setNotifyCallback!(EventType.read)(socket, null); with (m_loop.m_fds[socket].streamSocket) { readBuffer = null; } } private void onSocketRead(FD fd) { auto slot = () @trusted { return &m_loop.m_fds[fd].streamSocket(); } (); auto socket = cast(StreamSocketFD)fd; void finalize()(IOStatus status) { m_loop.setNotifyCallback!(EventType.read)(socket, null); //m_fds[fd].readBuffer = null; slot.readCallback(socket, status, slot.bytesRead); } sizediff_t ret; () @trusted { ret = .recv(socket, slot.readBuffer.ptr, slot.readBuffer.length, 0); } (); if (ret < 0) { auto err = getSocketError(); if (err != EAGAIN) { finalize(IOStatus.error); return; } } if (ret == 0) { slot.state = ConnectionState.passiveClose; finalize(IOStatus.disconnected); return; } if (ret > 0) { slot.bytesRead += ret; slot.readBuffer = slot.readBuffer[ret .. $]; if (slot.readMode != IOMode.all || slot.readBuffer.length == 0) { finalize(IOStatus.ok); return; } } } final override void write(StreamSocketFD socket, const(ubyte)[] buffer, IOMode mode, IOCallback on_write_finish) { if (buffer.length == 0) { on_write_finish(socket, IOStatus.ok, 0); return; } sizediff_t ret; () @trusted { ret = .send(socket, buffer.ptr, buffer.length, 0); } (); if (ret < 0) { auto err = getSocketError(); if (err != EAGAIN) { on_write_finish(socket, IOStatus.error, 0); return; } } size_t bytes_written = 0; if (ret == 0) { on_write_finish(socket, IOStatus.disconnected, 0); return; } if (ret < 0 && mode == IOMode.immediate) { on_write_finish(socket, IOStatus.wouldBlock, 0); return; } if (ret > 0) { bytes_written += ret; buffer = buffer[ret .. $]; if (mode != IOMode.all || buffer.length == 0) { on_write_finish(socket, IOStatus.ok, bytes_written); return; } } // NOTE: since we know that not all data was writtem to the stream // socket, the next call to send is guaranteed to return EGAIN // and we can avoid that call. with (m_loop.m_fds[socket].streamSocket) { writeCallback = on_write_finish; writeMode = mode; bytesWritten = ret > 0 ? ret : 0; writeBuffer = buffer; } m_loop.setNotifyCallback!(EventType.write)(socket, &onSocketWrite); } override void cancelWrite(StreamSocketFD socket) { assert(m_loop.m_fds[socket].streamSocket.writeCallback !is null, "Cancelling write when there is no write in progress."); m_loop.setNotifyCallback!(EventType.write)(socket, null); m_loop.m_fds[socket].streamSocket.writeBuffer = null; } private void onSocketWrite(FD fd) { auto slot = () @trusted { return &m_loop.m_fds[fd].streamSocket(); } (); auto socket = cast(StreamSocketFD)fd; sizediff_t ret; () @trusted { ret = .send(socket, slot.writeBuffer.ptr, slot.writeBuffer.length, 0); } (); if (ret < 0) { auto err = getSocketError(); if (err != EAGAIN) { m_loop.setNotifyCallback!(EventType.write)(socket, null); slot.writeCallback(socket, IOStatus.error, slot.bytesRead); return; } } if (ret == 0) { m_loop.setNotifyCallback!(EventType.write)(socket, null); slot.writeCallback(cast(StreamSocketFD)socket, IOStatus.disconnected, slot.bytesWritten); return; } if (ret > 0) { slot.bytesWritten += ret; slot.writeBuffer = slot.writeBuffer[ret .. $]; if (slot.writeMode != IOMode.all || slot.writeBuffer.length == 0) { m_loop.setNotifyCallback!(EventType.write)(socket, null); slot.writeCallback(cast(StreamSocketFD)socket, IOStatus.ok, slot.bytesWritten); return; } } } final override void waitForData(StreamSocketFD socket, IOCallback on_data_available) { sizediff_t ret; ubyte dummy; () @trusted { ret = recv(socket, &dummy, 1, MSG_PEEK); } (); if (ret < 0) { auto err = getSocketError(); if (err != EAGAIN) { on_data_available(socket, IOStatus.error, 0); return; } } size_t bytes_read = 0; if (ret == 0) { on_data_available(socket, IOStatus.disconnected, 0); return; } if (ret > 0) { on_data_available(socket, IOStatus.ok, 0); return; } with (m_loop.m_fds[socket].streamSocket) { readCallback = on_data_available; readMode = IOMode.once; bytesRead = 0; readBuffer = null; } m_loop.setNotifyCallback!(EventType.read)(socket, &onSocketDataAvailable); } private void onSocketDataAvailable(FD fd) { auto slot = () @trusted { return &m_loop.m_fds[fd].streamSocket(); } (); auto socket = cast(StreamSocketFD)fd; void finalize()(IOStatus status) { m_loop.setNotifyCallback!(EventType.read)(socket, null); //m_fds[fd].readBuffer = null; slot.readCallback(socket, status, 0); } sizediff_t ret; ubyte tmp; () @trusted { ret = recv(socket, &tmp, 1, MSG_PEEK); } (); if (ret < 0) { auto err = getSocketError(); if (err != EAGAIN) finalize(IOStatus.error); } else finalize(ret ? IOStatus.ok : IOStatus.disconnected); } final override void shutdown(StreamSocketFD socket, bool shut_read, bool shut_write) { auto st = m_loop.m_fds[socket].streamSocket.state; () @trusted { .shutdown(socket, shut_read ? shut_write ? SHUT_RDWR : SHUT_RD : shut_write ? SHUT_WR : 0); } (); if (st == ConnectionState.passiveClose) shut_read = true; if (st == ConnectionState.activeClose) shut_write = true; m_loop.m_fds[socket].streamSocket.state = shut_read ? shut_write ? ConnectionState.closed : ConnectionState.passiveClose : shut_write ? ConnectionState.activeClose : ConnectionState.connected; } DatagramSocketFD createDatagramSocket(scope Address bind_address, scope Address target_address) { auto sock = cast(DatagramSocketFD)createSocket(bind_address.addressFamily, SOCK_DGRAM); if (sock == -1) return DatagramSocketFD.invalid; if (bind_address && () @trusted { return bind(sock, bind_address.name, bind_address.nameLen); } () != 0) { closeSocket(sock); return DatagramSocketFD.init; } if (target_address && () @trusted { return connect(sock, target_address.name, target_address.nameLen); } () != 0) { closeSocket(sock); return DatagramSocketFD.init; } m_loop.initFD(sock); m_loop.m_fds[sock].specific = DgramSocketSlot.init; m_loop.registerFD(sock, EventMask.read|EventMask.write|EventMask.status); return sock; } void receive(DatagramSocketFD socket, ubyte[] buffer, IOMode mode, DatagramIOCallback on_receive_finish) @trusted { // DMD 2.072.0-b2: scope considered unsafe import std.typecons : scoped; assert(mode != IOMode.all, "Only IOMode.immediate and IOMode.once allowed for datagram sockets."); sizediff_t ret; scope src_addr = new UnknownAddress(); socklen_t src_addr_len = src_addr.nameLen; () @trusted { ret = .recvfrom(socket, buffer.ptr, buffer.length, 0, src_addr.name, &src_addr_len); } (); if (ret < 0) { auto err = getSocketError(); if (err != EAGAIN) { print("sock error %s!", err); on_receive_finish(socket, IOStatus.error, 0, null); return; } if (mode == IOMode.immediate) { on_receive_finish(socket, IOStatus.wouldBlock, 0, null); } else { with (m_loop.m_fds[socket].datagramSocket) { readCallback = on_receive_finish; readMode = mode; bytesRead = 0; readBuffer = buffer; } m_loop.setNotifyCallback!(EventType.read)(socket, &onDgramRead); } return; } on_receive_finish(socket, IOStatus.ok, ret, src_addr); } void cancelReceive(DatagramSocketFD socket) { assert(m_loop.m_fds[socket].datagramSocket.readCallback !is null, "Cancelling read when there is no read in progress."); m_loop.setNotifyCallback!(EventType.read)(socket, null); m_loop.m_fds[socket].datagramSocket.readBuffer = null; } private void onDgramRead(FD fd) @trusted { // DMD 2.072.0-b2: scope considered unsafe auto slot = () @trusted { return &m_loop.m_fds[fd].datagramSocket(); } (); auto socket = cast(DatagramSocketFD)fd; sizediff_t ret; scope src_addr = new UnknownAddress; socklen_t src_addr_len = src_addr.nameLen; () @trusted { ret = .recvfrom(socket, slot.readBuffer.ptr, slot.readBuffer.length, 0, src_addr.name, &src_addr_len); } (); if (ret < 0) { auto err = getSocketError(); if (err != EAGAIN) { m_loop.setNotifyCallback!(EventType.read)(socket, null); slot.readCallback(socket, IOStatus.error, 0, null); return; } } m_loop.setNotifyCallback!(EventType.read)(socket, null); () @trusted { return cast(DatagramIOCallback)slot.readCallback; } ()(socket, IOStatus.ok, ret, src_addr); } void send(DatagramSocketFD socket, const(ubyte)[] buffer, IOMode mode, Address target_address, DatagramIOCallback on_send_finish) { assert(mode != IOMode.all, "Only IOMode.immediate and IOMode.once allowed for datagram sockets."); sizediff_t ret; if (target_address) { () @trusted { ret = .sendto(socket, buffer.ptr, buffer.length, 0, target_address.name, target_address.nameLen); } (); m_loop.m_fds[socket].datagramSocket.targetAddr = target_address; } else { () @trusted { ret = .send(socket, buffer.ptr, buffer.length, 0); } (); } if (ret < 0) { auto err = getSocketError(); if (err != EAGAIN) { print("sock error %s!", err); on_send_finish(socket, IOStatus.error, 0, null); return; } if (mode == IOMode.immediate) { on_send_finish(socket, IOStatus.wouldBlock, 0, null); } else { with (m_loop.m_fds[socket].datagramSocket) { writeCallback = on_send_finish; writeMode = mode; bytesWritten = 0; writeBuffer = buffer; } m_loop.setNotifyCallback!(EventType.write)(socket, &onDgramWrite); } return; } on_send_finish(socket, IOStatus.ok, ret, null); } void cancelSend(DatagramSocketFD socket) { assert(m_loop.m_fds[socket].datagramSocket.writeCallback !is null, "Cancelling write when there is no write in progress."); m_loop.setNotifyCallback!(EventType.write)(socket, null); m_loop.m_fds[socket].datagramSocket.writeBuffer = null; } private void onDgramWrite(FD fd) { auto slot = () @trusted { return &m_loop.m_fds[fd].datagramSocket(); } (); auto socket = cast(DatagramSocketFD)fd; sizediff_t ret; if (slot.targetAddr) { () @trusted { ret = .sendto(socket, slot.writeBuffer.ptr, slot.writeBuffer.length, 0, slot.targetAddr.name, slot.targetAddr.nameLen); } (); } else { () @trusted { ret = .send(socket, slot.writeBuffer.ptr, slot.writeBuffer.length, 0); } (); } if (ret < 0) { auto err = getSocketError(); if (err != EAGAIN) { m_loop.setNotifyCallback!(EventType.write)(socket, null); () @trusted { return cast(DatagramIOCallback)slot.writeCallback; } ()(socket, IOStatus.error, 0, null); return; } } m_loop.setNotifyCallback!(EventType.write)(socket, null); () @trusted { return cast(DatagramIOCallback)slot.writeCallback; } ()(socket, IOStatus.ok, ret, null); } final override void addRef(SocketFD fd) { assert(m_loop.m_fds[fd].common.refCount > 0, "Adding reference to unreferenced socket FD."); m_loop.m_fds[fd].common.refCount++; } final override bool releaseRef(SocketFD fd) { assert(m_loop.m_fds[fd].common.refCount > 0, "Releasing reference to unreferenced socket FD."); if (--m_loop.m_fds[fd].common.refCount == 0) { m_loop.unregisterFD(fd); m_loop.clearFD(fd); closeSocket(fd); return false; } return true; } private SocketFD createSocket(AddressFamily family, int type) { int sock; () @trusted { sock = socket(family, type, 0); } (); if (sock == -1) return SocketFD.invalid; setSocketNonBlocking(cast(SocketFD)sock); return cast(SocketFD)sock; } } /// getaddrinfo_a based asynchronous lookups final class EventDriverDNS_GAI(Events : EventDriverEvents, Signals : EventDriverSignals) : EventDriverDNS { import std.parallelism : task, taskPool; import std.string : toStringz; private { static struct Lookup { DNSLookupCallback callback; addrinfo* result; int retcode; string name; } ChoppedVector!Lookup m_lookups; Events m_events; EventID m_event; size_t m_maxHandle; } this(Events events, Signals signals) { m_events = events; m_event = events.create(); m_events.wait(m_event, &onDNSSignal); } void dispose() { m_events.cancelWait(m_event, &onDNSSignal); m_events.releaseRef(m_event); } override DNSLookupID lookupHost(string name, DNSLookupCallback on_lookup_finished) { auto handle = getFreeHandle(); if (handle > m_maxHandle) m_maxHandle = handle; assert(!m_lookups[handle].result); Lookup* l = () @trusted { return &m_lookups[handle]; } (); l.name = name; l.callback = on_lookup_finished; auto events = () @trusted { return cast(shared)m_events; } (); auto t = task!taskFun(l, AddressFamily.UNSPEC, events, m_event); try taskPool.put(t); catch (Exception e) return DNSLookupID.invalid; return handle; } /// public static void taskFun(Lookup* lookup, int af, shared(Events) events, EventID event) { addrinfo hints; hints.ai_flags = AI_ADDRCONFIG; version (linx) hints.ai_flags |= AI_V4MAPPED; hints.ai_family = af; () @trusted { lookup.retcode = getaddrinfo(lookup.name.toStringz(), null, af == AddressFamily.UNSPEC ? null : &hints, &lookup.result); } (); events.trigger(event); } override void cancelLookup(DNSLookupID handle) { m_lookups[handle].callback = null; } private void onDNSSignal(EventID event) @trusted nothrow { size_t lastmax; foreach (i, ref l; m_lookups) { if (i > m_maxHandle) break; if (l.callback) { if (l.result || l.retcode) { auto cb = l.callback; auto ai = l.result; DNSStatus status; switch (l.retcode) { default: status = DNSStatus.error; break; case 0: status = DNSStatus.ok; break; } l.callback = null; l.result = null; l.retcode = 0; if (i == m_maxHandle) m_maxHandle = lastmax; passToDNSCallback(cast(DNSLookupID)cast(int)i, cb, status, ai); } else lastmax = i; } } m_events.wait(m_event, &onDNSSignal); } private DNSLookupID getFreeHandle() @safe nothrow { assert(m_lookups.length <= int.max); foreach (i, ref l; m_lookups) if (!l.callback) return cast(DNSLookupID)cast(int)i; return cast(DNSLookupID)cast(int)m_lookups.length; } } /// getaddrinfo+thread based lookup - does not support true cancellation final class EventDriverDNS_GAIA(Events : EventDriverEvents, Signals : EventDriverSignals) : EventDriverDNS { import core.sys.posix.signal : SIGEV_SIGNAL, SIGRTMIN, sigevent; private { static struct Lookup { gaicb ctx; DNSLookupCallback callback; } ChoppedVector!Lookup m_lookups; Signals m_signals; int m_dnsSignal; SignalListenID m_sighandle; } @safe nothrow: this(Events events, Signals signals) { m_signals = signals; m_dnsSignal = () @trusted { return SIGRTMIN; } (); m_sighandle = signals.listen(m_dnsSignal, &onDNSSignal); } void dispose() { m_signals.releaseRef(m_sighandle); } override DNSLookupID lookupHost(string name, DNSLookupCallback on_lookup_finished) { import std.string : toStringz; auto handle = getFreeHandle(); sigevent evt; evt.sigev_notify = SIGEV_SIGNAL; evt.sigev_signo = m_dnsSignal; gaicb* res = &m_lookups[handle].ctx; res.ar_name = name.toStringz(); auto ret = () @trusted { return getaddrinfo_a(GAI_NOWAIT, &res, 1, &evt); } (); if (ret != 0) return DNSLookupID.invalid; m_lookups[handle].callback = on_lookup_finished; return handle; } override void cancelLookup(DNSLookupID handle) { gai_cancel(&m_lookups[handle].ctx); m_lookups[handle].callback = null; } private void onDNSSignal(SignalListenID, SignalStatus status, int signal) @safe nothrow { assert(status == SignalStatus.ok); foreach (i, ref l; m_lookups) { if (!l.callback) continue; auto err = gai_error(&l.ctx); if (err == EAI_INPROGRESS) continue; DNSStatus status; switch (err) { default: status = DNSStatus.error; break; case 0: status = DNSStatus.ok; break; } auto cb = l.callback; auto ai = l.ctx.ar_result; l.callback = null; l.ctx.ar_result = null; passToDNSCallback(cast(DNSLookupID)cast(int)i, cb, status, ai); } } private DNSLookupID getFreeHandle() { foreach (i, ref l; m_lookups) if (!l.callback) return cast(DNSLookupID)cast(int)i; return cast(DNSLookupID)cast(int)m_lookups.length; } } version (linux) extern(C) { import core.sys.posix.signal : sigevent; struct gaicb { const(char)* ar_name; const(char)* ar_service; const(addrinfo)* ar_request; addrinfo* ar_result; } enum GAI_NOWAIT = 1; enum EAI_INPROGRESS = -100; int getaddrinfo_a(int mode, gaicb** list, int nitems, sigevent *sevp); int gai_error(gaicb *req); int gai_cancel(gaicb *req); } private void passToDNSCallback(DNSLookupID id, scope DNSLookupCallback cb, DNSStatus status, addrinfo* ai_orig) @trusted nothrow { import std.typecons : scoped; static final class RefAddr : Address { sockaddr* sa; socklen_t len; override @property sockaddr* name() { return sa; } override @property const(sockaddr)* name() const { return sa; } override @property socklen_t nameLen() const { return len; } } try { typeof(scoped!RefAddr())[16] addrs_prealloc = [ scoped!RefAddr(), scoped!RefAddr(), scoped!RefAddr(), scoped!RefAddr(), scoped!RefAddr(), scoped!RefAddr(), scoped!RefAddr(), scoped!RefAddr(), scoped!RefAddr(), scoped!RefAddr(), scoped!RefAddr(), scoped!RefAddr(), scoped!RefAddr(), scoped!RefAddr(), scoped!RefAddr(), scoped!RefAddr() ]; //Address[16] addrs; auto addrs = new Address[16]; // FIXME: avoid heap allocation auto ai = ai_orig; size_t addr_count = 0; while (ai !is null && addr_count < addrs.length) { RefAddr ua = new RefAddr;//addrs_prealloc[addr_count]; // FIXME: avoid heap allocation ua.sa = ai.ai_addr; ua.len = ai.ai_addrlen; addrs[addr_count] = ua; addr_count++; ai = ai.ai_next; } cb(id, status, addrs[0 .. addr_count]); freeaddrinfo(ai_orig); } catch (Exception e) assert(false, e.msg); } final class PosixEventDriverEvents(Loop : PosixEventLoop) : EventDriverEvents { @safe: /*@nogc:*/ nothrow: private Loop m_loop; this(Loop loop) { m_loop = loop; } final override EventID create() { version (linux) { auto id = cast(EventID)eventfd(0, EFD_NONBLOCK); m_loop.initFD(id); m_loop.m_fds[id].specific = EventSlot(new ConsumableQueue!EventCallback); // FIXME: avoid dynamic memory allocation m_loop.registerFD(id, EventMask.read); m_loop.setNotifyCallback!(EventType.read)(id, &onEvent); return id; } else assert(false, "OS not supported!"); } final override void trigger(EventID event, bool notify_all = true) { assert(event < m_loop.m_fds.length, "Invalid event ID passed to triggerEvent."); if (notify_all) { //log("emitting only for this thread (%s waiters)", m_fds[event].waiters.length); foreach (w; m_loop.m_fds[event].event.waiters.consume) { //log("emitting waiter %s %s", cast(void*)w.funcptr, w.ptr); w(event); } } else { if (!m_loop.m_fds[event].event.waiters.empty) m_loop.m_fds[event].event.waiters.consumeOne()(event); } } final override void trigger(EventID event, bool notify_all = true) shared @trusted { import core.atomic : atomicStore; auto thisus = cast(PosixEventDriverEvents)this; assert(event < thisus.m_loop.m_fds.length, "Invalid event ID passed to shared triggerEvent."); long one = 1; //log("emitting for all threads"); if (notify_all) atomicStore(thisus.m_loop.m_fds[event].event.triggerAll, true); () @trusted { .write(event, &one, one.sizeof); } (); } final override void wait(EventID event, EventCallback on_event) { assert(event < m_loop.m_fds.length, "Invalid event ID passed to waitForEvent."); return m_loop.m_fds[event].event.waiters.put(on_event); } final override void cancelWait(EventID event, EventCallback on_event) { import std.algorithm.searching : countUntil; import std.algorithm.mutation : remove; m_loop.m_fds[event].event.waiters.removePending(on_event); } private void onEvent(FD fd) @trusted { ulong cnt; EventID event = cast(EventID)fd; () @trusted { .read(event, &cnt, cnt.sizeof); } (); import core.atomic : cas; auto all = cas(&m_loop.m_fds[event].event.triggerAll, true, false); trigger(event, all); } final override void addRef(EventID descriptor) { assert(m_loop.m_fds[descriptor.value].common.refCount > 0, "Adding reference to unreferenced event FD."); m_loop.m_fds[descriptor.value].common.refCount++; } final override bool releaseRef(EventID descriptor) { assert(m_loop.m_fds[descriptor].common.refCount > 0, "Releasing reference to unreferenced event FD."); if (--m_loop.m_fds[descriptor].common.refCount == 0) { () @trusted nothrow { scope (failure) assert(false); destroy(m_loop.m_fds[descriptor].event.waiters); assert(m_loop.m_fds[descriptor].event.waiters is null); } (); m_loop.unregisterFD(descriptor); m_loop.clearFD(descriptor); close(descriptor); return false; } return true; } } final class SignalFDEventDriverSignals(Loop : PosixEventLoop) : EventDriverSignals { @safe: /*@nogc:*/ nothrow: import core.sys.posix.signal; import core.sys.linux.sys.signalfd; private Loop m_loop; this(Loop loop) { m_loop = loop; } override SignalListenID listen(int sig, SignalCallback on_signal) { auto fd = () @trusted { sigset_t sset; sigemptyset(&sset); sigaddset(&sset, sig); if (sigprocmask(SIG_BLOCK, &sset, null) != 0) return SignalListenID.invalid; return SignalListenID(signalfd(-1, &sset, SFD_NONBLOCK)); } (); m_loop.initFD(cast(FD)fd); m_loop.m_fds[fd].specific = SignalSlot(on_signal); m_loop.registerFD(cast(FD)fd, EventMask.read); m_loop.setNotifyCallback!(EventType.read)(cast(FD)fd, &onSignal); onSignal(cast(FD)fd); return fd; } override void addRef(SignalListenID descriptor) { assert(m_loop.m_fds[descriptor].common.refCount > 0, "Adding reference to unreferenced event FD."); m_loop.m_fds[descriptor].common.refCount++; } override bool releaseRef(SignalListenID descriptor) { FD fd = cast(FD)descriptor; assert(m_loop.m_fds[fd].common.refCount > 0, "Releasing reference to unreferenced event FD."); if (--m_loop.m_fds[fd].common.refCount == 0) { m_loop.unregisterFD(fd); m_loop.clearFD(fd); close(fd); return false; } return true; } private void onSignal(FD fd) { SignalListenID lid = cast(SignalListenID)fd; signalfd_siginfo nfo; do { auto ret = () @trusted { return read(fd, &nfo, nfo.sizeof); } (); if (ret == -1 && errno == EAGAIN) break; auto cb = m_loop.m_fds[fd].signal.callback; if (ret != nfo.sizeof) { cb(lid, SignalStatus.error, -1); return; } addRef(lid); cb(lid, SignalStatus.ok, nfo.ssi_signo); releaseRef(lid); } while (m_loop.m_fds[fd].common.refCount > 0); } } final class DummyEventDriverSignals(Loop : PosixEventLoop) : EventDriverSignals { @safe: /*@nogc:*/ nothrow: private Loop m_loop; this(Loop loop) { m_loop = loop; } override SignalListenID listen(int sig, SignalCallback on_signal) { assert(false); } override void addRef(SignalListenID descriptor) { assert(false); } override bool releaseRef(SignalListenID descriptor) { assert(false); } } final class InotifyEventDriverWatchers(Loop : PosixEventLoop) : EventDriverWatchers { import core.sys.posix.fcntl, core.sys.posix.unistd, core.sys.linux.sys.inotify; import std.file; private { Loop m_loop; string[int][int] m_watches; // TODO: use a @nogc (allocator based) map } this(Loop loop) { m_loop = loop; } final override WatcherID watchDirectory(string path, bool recursive, FileChangesCallback callback) { enum IN_NONBLOCK = 0x800; // value in core.sys.linux.sys.inotify is incorrect auto handle = () @trusted { return inotify_init1(IN_NONBLOCK); } (); if (handle == -1) return WatcherID.invalid; addWatch(handle, path); if (recursive) { try { if (path.isDir) () @trusted { foreach (de; path.dirEntries(SpanMode.shallow)) if (de.isDir) addWatch(handle, de.name); } (); } catch (Exception e) { // TODO: decide if this should be ignored or if the error should be forwarded } } m_loop.initFD(FD(handle)); m_loop.registerFD(FD(handle), EventMask.read); m_loop.setNotifyCallback!(EventType.read)(FD(handle), &onChanges); m_loop.m_fds[handle].specific = WatcherSlot(callback); processEvents(WatcherID(handle)); return WatcherID(handle); } final override void addRef(WatcherID descriptor) { assert(m_loop.m_fds[descriptor].common.refCount > 0, "Adding reference to unreferenced event FD."); m_loop.m_fds[descriptor].common.refCount++; } final override bool releaseRef(WatcherID descriptor) { FD fd = cast(FD)descriptor; assert(m_loop.m_fds[fd].common.refCount > 0, "Releasing reference to unreferenced event FD."); if (--m_loop.m_fds[fd].common.refCount == 0) { m_loop.unregisterFD(fd); m_loop.clearFD(fd); m_watches.remove(fd); /*errnoEnforce(*/close(fd)/* == 0)*/; return false; } return true; } private void onChanges(FD fd) { processEvents(cast(WatcherID)fd); } private void processEvents(WatcherID id) { import core.stdc.stdio : FILENAME_MAX; import core.stdc.string : strlen; ubyte[inotify_event.sizeof + FILENAME_MAX + 1] buf = void; while (true) { auto ret = () @trusted { return read(id, &buf[0], buf.length); } (); if (ret == -1 && errno == EAGAIN) break; assert(ret <= buf.length); auto rem = buf[0 .. ret]; while (rem.length > 0) { auto ev = () @trusted { return cast(inotify_event*)rem.ptr; } (); FileChange ch; if (ev.mask & (IN_CREATE|IN_MOVED_TO)) ch.kind = FileChangeKind.added; else if (ev.mask & (IN_DELETE|IN_DELETE_SELF|IN_MOVE_SELF|IN_MOVED_FROM)) ch.kind = FileChangeKind.removed; else if (ev.mask & IN_MODIFY) ch.kind = FileChangeKind.modified; auto name = () @trusted { return ev.name.ptr[0 .. strlen(ev.name.ptr)]; } (); ch.directory = m_watches[id][ev.wd]; ch.isDirectory = (ev.mask & IN_ISDIR) != 0; ch.name = name; addRef(id); auto cb = m_loop.m_fds[ id].watcher.callback; cb(id, ch); if (!releaseRef(id)) break; rem = rem[inotify_event.sizeof + ev.len .. $]; } } } private bool addWatch(int handle, string path) { import std.string : toStringz; enum EVENTS = IN_CREATE | IN_DELETE | IN_DELETE_SELF | IN_MODIFY | IN_MOVE_SELF | IN_MOVED_FROM | IN_MOVED_TO; immutable wd = () @trusted { return inotify_add_watch(handle, path.toStringz, EVENTS); } (); if (wd == -1) return false; m_watches[cast(int)handle][wd] = path; return true; } } final class PosixEventDriverWatchers(Loop : PosixEventLoop) : EventDriverWatchers { @safe: /*@nogc:*/ nothrow: private Loop m_loop; this(Loop loop) { m_loop = loop; } final override WatcherID watchDirectory(string path, bool recursive, FileChangesCallback on_change) { assert(false, "TODO!"); } final override void addRef(WatcherID descriptor) { assert(false, "TODO!"); } final override bool releaseRef(WatcherID descriptor) { assert(false, "TODO!"); } } package class PosixEventLoop { @safe: nothrow: import core.time : Duration; package { AlgebraicChoppedVector!(FDSlot, StreamSocketSlot, StreamListenSocketSlot, DgramSocketSlot, DNSSlot, WatcherSlot, EventSlot, SignalSlot) m_fds; size_t m_waiterCount = 0; } protected @property int maxFD() const { return cast(int)m_fds.length; } protected abstract void dispose(); protected abstract bool doProcessEvents(Duration dur); /// Registers the FD for general notification reception. protected abstract void registerFD(FD fd, EventMask mask); /// Unregisters the FD for general notification reception. protected abstract void unregisterFD(FD fd); /// Updates the event mask to use for listening for notifications. protected abstract void updateFD(FD fd, EventMask mask); final protected void notify(EventType evt)(FD fd) { //assert(m_fds[fd].callback[evt] !is null, "Notifying FD which is not listening for event."); if (m_fds[fd.value].common.callback[evt]) m_fds[fd.value].common.callback[evt](fd); } final protected void enumerateFDs(EventType evt)(scope FDEnumerateCallback del) { // TODO: optimize! foreach (i; 0 .. cast(int)m_fds.length) if (m_fds[i].common.callback[evt]) del(cast(FD)i); } package void setNotifyCallback(EventType evt)(FD fd, FDSlotCallback callback) { assert((callback !is null) != (m_fds[fd.value].common.callback[evt] !is null), "Overwriting notification callback."); // ensure that the FD doesn't get closed before the callback gets called. if (callback !is null) { m_waiterCount++; m_fds[fd.value].common.refCount++; } else { m_fds[fd.value].common.refCount--; m_waiterCount--; } m_fds[fd.value].common.callback[evt] = callback; } package void initFD(FD fd) { m_fds[fd.value].common.refCount = 1; } package void clearFD(FD fd) { if (m_fds[fd.value].common.userDataDestructor) () @trusted { m_fds[fd.value].common.userDataDestructor(m_fds[fd.value].common.userData.ptr); } (); m_fds[fd.value] = m_fds.FullField.init; } } alias FDEnumerateCallback = void delegate(FD); alias FDSlotCallback = void delegate(FD); private struct FDSlot { FDSlotCallback[EventType.max+1] callback; uint refCount; DataInitializer userDataDestructor; ubyte[16*size_t.sizeof] userData; @property EventMask eventMask() const nothrow { EventMask ret = cast(EventMask)0; if (callback[EventType.read] !is null) ret |= EventMask.read; if (callback[EventType.write] !is null) ret |= EventMask.write; if (callback[EventType.status] !is null) ret |= EventMask.status; return ret; } } private struct StreamSocketSlot { alias Handle = StreamSocketFD; size_t bytesRead; ubyte[] readBuffer; IOMode readMode; IOCallback readCallback; // FIXME: this type only works for stream sockets size_t bytesWritten; const(ubyte)[] writeBuffer; IOMode writeMode; IOCallback writeCallback; // FIXME: this type only works for stream sockets ConnectCallback connectCallback; ConnectionState state; } private struct StreamListenSocketSlot { alias Handle = StreamListenSocketFD; AcceptCallback acceptCallback; } private struct DgramSocketSlot { alias Handle = DatagramSocketFD; size_t bytesRead; ubyte[] readBuffer; IOMode readMode; DatagramIOCallback readCallback; // FIXME: this type only works for stream sockets size_t bytesWritten; const(ubyte)[] writeBuffer; IOMode writeMode; DatagramIOCallback writeCallback; // FIXME: this type only works for stream sockets Address targetAddr; } private struct DNSSlot { alias Handle = DNSLookupID; DNSLookupCallback callback; } private struct WatcherSlot { alias Handle = WatcherID; FileChangesCallback callback; } private struct EventSlot { alias Handle = EventID; ConsumableQueue!EventCallback waiters; shared bool triggerAll; } private struct SignalSlot { alias Handle = SignalListenID; SignalCallback callback; } enum EventType { read, write, status } enum EventMask { read = 1<<0, write = 1<<1, status = 1<<2 } private void closeSocket(SocketFD sockfd) @nogc { version (Windows) () @trusted { closesocket(sockfd); } (); else close(sockfd); } private void setSocketNonBlocking(SocketFD sockfd) { version (Windows) { size_t enable = 1; () @trusted { ioctlsocket(sockfd, FIONBIO, &enable); } (); } else { () @trusted { fcntl(sockfd, F_SETFL, O_NONBLOCK, 1); } (); } } private int getSocketError() @nogc { version (Windows) return WSAGetLastError(); else return errno; } void log(ARGS...)(string fmt, ARGS args) @trusted { import std.stdio : writef, writefln; import core.thread : Thread; try { writef("[%s]: ", Thread.getThis().name); writefln(fmt, args); } catch (Exception) {} } /*version (Windows) { import std.c.windows.windows; import std.c.windows.winsock; alias EWOULDBLOCK = WSAEWOULDBLOCK; extern(System) DWORD FormatMessageW(DWORD dwFlags, const(void)* lpSource, DWORD dwMessageId, DWORD dwLanguageId, LPWSTR lpBuffer, DWORD nSize, void* Arguments); class WSAErrorException : Exception { int error; this(string message, string file = __FILE__, size_t line = __LINE__) { error = WSAGetLastError(); this(message, error, file, line); } this(string message, int error, string file = __FILE__, size_t line = __LINE__) { import std.string : format; ushort* errmsg; FormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER|FORMAT_MESSAGE_FROM_SYSTEM|FORMAT_MESSAGE_IGNORE_INSERTS, null, error, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), cast(LPWSTR)&errmsg, 0, null); size_t len = 0; while (errmsg[len]) len++; auto errmsgd = (cast(wchar[])errmsg[0 .. len]).idup; LocalFree(errmsg); super(format("%s: %s (%s)", message, errmsgd, error), file, line); } } alias SystemSocketException = WSAErrorException; } else { import std.exception : ErrnoException; alias SystemSocketException = ErrnoException; } T socketEnforce(T)(T value, lazy string msg = null, string file = __FILE__, size_t line = __LINE__) { import std.exception : enforceEx; return enforceEx!SystemSocketException(value, msg, file, line); }*/
D
// This file is written in D programming language /** * Daemon implementation for GNU/Linux platform. * * The main symbols you might be interested in: * * $(B sendSignalDynamic) and $(B endSignal) - is easy way to send signals to created daemons * * $(B runDaemon) - forks daemon process and places hooks that are described by $(B Daemon) template * * Copyright: © 2013-2014 Anton Gushcha * License: Subject to the terms of the MIT license, as written in the included LICENSE file. * Authors: NCrashed <ncrashed@gmail.com> */ module daemonize.linux; version(linux): static if( __VERSION__ < 2066 ) private enum nogc; import std.conv; import std.exception; import std.file; import std.path; import std.process; import std.stdio; import std.string; import std.c.linux.linux; import std.c.stdlib; import core.sys.linux.errno; import daemonize.daemon; import daemonize.string; import daemonize.keymap; import dlogg.log; /// Returns local pid file that is used when no custom one is specified string defaultPidFile(string daemonName) { return expandTilde(buildPath("~", ".daemonize", daemonName ~ ".pid")); } /// Returns local lock file that is used when no custom one is specified string defaultLockFile(string daemonName) { return expandTilde(buildPath("~", ".daemonize", daemonName ~ ".lock")); } /// Checks is $(B sig) is actually built-in @nogc @safe bool isNativeSignal(Signal sig) pure nothrow { switch(sig) { case(Signal.Abort): return true; case(Signal.HangUp): return true; case(Signal.Interrupt): return true; case(Signal.Quit): return true; case(Signal.Terminate): return true; default: return false; } } /// Checks is $(B sig) is not actually built-in @nogc @safe bool isCustomSignal(Signal sig) pure nothrow { return !isNativeSignal(sig); } /** * Main template in the module that actually creates daemon process. * $(B DaemonInfo) is a $(B Daemon) instance that holds name of the daemon * and hooks for numerous $(B Signal)s. * * Daemon is detached from terminal, therefore it needs a preinitialized $(B logger). * * As soon as daemon is ready the function executes $(B main) delegate that returns * application return code. * * Daemon uses pid and lock files. Pid file holds process id for communications with * other applications. If $(B pidFilePath) isn't set, the default path to pid file is * '~/.daemonize/<daemonName>.pid'. Lock file prevents from execution of numerous copies * of daemons. If $(B lockFilePath) isn't set, the default path to lock file is * '~/.daemonize/<daemonName>.lock'. If you want several instances of one daemon, redefine * pid and lock files paths. * * Sometimes lock and pid files are located at `/var/run` directory and needs a root access. * If $(B userId) and $(B groupId) parameters are set, daemon tries to create lock and pid files * and drops root privileges. * * Example: * --------- * * alias daemon = Daemon!( * "DaemonizeExample1", // unique name * * // Setting associative map signal -> callbacks * KeyValueList!( * Composition!(Signal.Terminate, Signal.Quit, Signal.Shutdown, Signal.Stop), (logger, signal) * { * logger.logInfo("Exiting..."); * return false; // returning false will terminate daemon * }, * Signal.HangUp, (logger) * { * logger.logInfo("Hello World!"); * return true; // continue execution * } * ), * * // Main function where your code is * (logger, shouldExit) { * // will stop the daemon in 5 minutes * auto time = Clock.currSystemTick + cast(TickDuration)5.dur!"minutes"; * bool timeout = false; * while(!shouldExit() && time > Clock.currSystemTick) { } * * logger.logInfo("Exiting main function!"); * * return 0; * } * ); * * return buildDaemon!daemon.run(logger); * --------- */ template buildDaemon(alias DaemonInfo) if(isDaemon!DaemonInfo || isDaemonClient!DaemonInfo) { alias daemon = readDaemonInfo!DaemonInfo; static if(isDaemon!DaemonInfo) { int run(shared ILogger logger , string pidFilePath = "", string lockFilePath = "" , int userId = -1, int groupId = -1) { // Local locak file if(lockFilePath == "") { lockFilePath = defaultLockFile(DaemonInfo.daemonName); } // Local pid file if(pidFilePath == "") { pidFilePath = defaultPidFile(DaemonInfo.daemonName); } savedLogger = logger; savedPidFilePath = pidFilePath; savedLockFilePath = lockFilePath; // Handling lockfile if any enforceLockFile(lockFilePath, userId); scope(exit) deleteLockFile(lockFilePath); // Saving process ID and session ID pid_t pid, sid; // For off the parent process pid = fork(); if(pid < 0) { savedLogger.logError("Failed to start daemon: fork failed"); // Deleting fresh lockfile deleteLockFile(lockFilePath); terminate(EXIT_FAILURE); } // If we got good PID, then we can exit the parent process if(pid > 0) { // handling pidfile if any writePidFile(pidFilePath, pid, userId); savedLogger.logInfo(text("Daemon is detached with pid ", pid)); terminate(EXIT_SUCCESS, false); } // dropping root privileges dropRootPrivileges(groupId, userId); // Change the file mode mask and suppress printing to console umask(0); savedLogger.minOutputLevel(LoggingLevel.Muted); // Handling of deleting pid file scope(exit) deletePidFile(pidFilePath); // Create a new SID for the child process sid = setsid(); if (sid < 0) { deleteLockFile(lockFilePath); deletePidFile(pidFilePath); terminate(EXIT_FAILURE); } // Close out the standard file descriptors close(0); close(1); close(2); void bindSignal(int sig, sighandler_t handler) { enforce(signal(sig, handler) != SIG_ERR, text("Cannot catch signal ", sig)); } // Bind native signals // other signals cause application to hang or cause no signal detection // sigusr1 sigusr2 are used by garbage collector bindSignal(SIGABRT, &signal_handler_daemon); bindSignal(SIGTERM, &signal_handler_daemon); bindSignal(SIGQUIT, &signal_handler_daemon); bindSignal(SIGINT, &signal_handler_daemon); bindSignal(SIGQUIT, &signal_handler_daemon); bindSignal(SIGHUP, &signal_handler_daemon); assert(daemon.canFitRealtimeSignals, "Cannot fit all custom signals to real-time signals range!"); foreach(signame; daemon.customSignals) { bindSignal(daemon.mapRealTimeSignal(signame), &signal_handler_daemon); } int code = EXIT_FAILURE; try code = DaemonInfo.mainFunc(savedLogger, &shouldExitFunc ); catch (Throwable th) { savedLogger.logError(text("Catched unhandled throwable at daemon level at ", th.file, ": ", th.line, " : ", th.msg)); savedLogger.logError("Terminating..."); } finally { deleteLockFile(lockFilePath); deletePidFile(pidFilePath); } terminate(code); return 0; } } /** * As custom signals are mapped to realtime signals at runtime, it is complicated * to calculate signal number by hands. The function simplifies sending signals * to daemons that were created by the package. * * The $(B DaemonInfo) could be a full description of desired daemon or simplified one * (template ($B DaemonClient). That info is used to remap custom signals to realtime ones. * * $(B daemonName) is passed as runtime parameter to be able read service name at runtime. * $(B signal) is the signal that you want to send. $(B pidFilePath) is optional parameter * that overrides default algorithm of finding pid files (calculated from $(B daemonName) in form * of '~/.daemonize/<daemonName>.pid'). * * See_Also: $(B sendSignal) version of the function that takes daemon name from $(B DaemonInfo). */ void sendSignalDynamic(shared ILogger logger, string daemonName, Signal signal, string pidFilePath = "") { savedLogger = logger; // Try to find at default place if(pidFilePath == "") { pidFilePath = defaultPidFile(daemonName); } // Reading file int pid = readPidFile(pidFilePath); logger.logInfo(text("Sending signal ", signal, " to daemon ", daemonName, " (pid ", pid, ")")); kill(pid, daemon.mapSignal(signal)); } /// ditto void sendSignal(shared ILogger logger, Signal signal, string pidFilePath = "") { sendSignalDynamic(logger, DaemonInfo.daemonName, signal, pidFilePath); } /** * In GNU/Linux daemon doesn't require deinstallation. */ void uninstall() {} /** * Saves info about exception into daemon $(B logger) */ static class LoggedException : Exception { @safe nothrow this(string msg, string file = __FILE__, size_t line = __LINE__, Throwable next = null) { savedLogger.logError(msg); super(msg, file, line, next); } @safe nothrow this(string msg, Throwable next, string file = __FILE__, size_t line = __LINE__) { savedLogger.logError(msg); super(msg, file, line, next); } } private { shared ILogger savedLogger; string savedPidFilePath; string savedLockFilePath; __gshared bool shouldExit; bool shouldExitFunc() { return shouldExit; } /// Actual signal handler static if(isDaemon!DaemonInfo) extern(C) void signal_handler_daemon(int sig) nothrow { foreach(signal; DaemonInfo.signalMap.keys) { alias handler = DaemonInfo.signalMap.get!signal; static if(isComposition!signal) { foreach(subsignal; signal.signals) { if(daemon.mapSignal(subsignal) == sig) { try { static if(__traits(compiles, {handler(savedLogger, subsignal);})) bool res = handler(savedLogger, subsignal); else bool res = handler(savedLogger); if(!res) { deleteLockFile(savedLockFilePath); deletePidFile(savedPidFilePath); shouldExit = true; //terminate(EXIT_SUCCESS); } else return; } catch(Throwable th) { savedLogger.logError(text("Caught at signal ", subsignal," handler: ", th)); } } } } else { if(daemon.mapSignal(signal) == sig) { try { static if(__traits(compiles, handler(savedLogger, signal))) bool res = handler(savedLogger, signal); else bool res = handler(savedLogger); if(!res) { deleteLockFile(savedLockFilePath); deletePidFile(savedPidFilePath); shouldExit = true; //terminate(EXIT_SUCCESS); } else return; } catch(Throwable th) { savedLogger.logError(text("Caught at signal ", signal," handler: ", th)); } } } } } /** * Checks existence of special lock file at $(B path) and prevents from * continuing if there is it. Also changes permissions for the file if * $(B userid) not -1. */ void enforceLockFile(string path, int userid) { if(path.exists) { savedLogger.logError(text("There is another daemon instance running: lock file is '",path,"'")); savedLogger.logInfo("Remove the file if previous instance if daemon has crashed"); terminate(-1); } else { if(!path.dirName.exists) { mkdirRecurse(path.dirName); } auto file = File(path, "w"); file.close(); } // if root, change permission on file to be able to remove later if (getuid() == 0 && userid >= 0) { savedLogger.logDebug("Changing permissions for lock file: ", path); executeShell(text("chown ", userid," ", path.dirName)); executeShell(text("chown ", userid," ", path)); } } /** * Removing lock file while terminating. */ void deleteLockFile(string path) { if(path.exists) { try { path.remove(); } catch(Exception e) { savedLogger.logWarning(text("Failed to remove lock file: ", path)); return; } } } /** * Writing down file with process id $(B pid) to $(B path) and changes * permissions to $(B userid) (if not -1 and there is root dropping). */ void writePidFile(string path, int pid, uint userid) { try { if(!path.dirName.exists) { mkdirRecurse(path.dirName); } auto file = File(path, "w"); scope(exit) file.close(); file.write(pid); // if root, change permission on file to be able to remove later if (getuid() == 0 && userid >= 0) { savedLogger.logDebug("Changing permissions for pid file: ", path); executeShell(text("chown ", userid," ", path.dirName)); executeShell(text("chown ", userid," ", path)); } } catch(Exception e) { savedLogger.logWarning(text("Failed to write pid file: ", path)); return; } } /// Removing process id file void deletePidFile(string path) { try { path.remove(); } catch(Exception e) { savedLogger.logWarning(text("Failed to remove pid file: ", path)); return; } } /** * Dropping root privileges to $(B groupid) and $(B userid). */ void dropRootPrivileges(int groupid, int userid) { if (getuid() == 0) { if(groupid < 0 || userid < 0) { savedLogger.logWarning("Running as root, but doesn't specified groupid and/or userid for" " privileges lowing!"); return; } savedLogger.logInfo("Running as root, dropping privileges..."); // process is running as root, drop privileges if (setgid(groupid) != 0) { savedLogger.logError(text("setgid: Unable to drop group privileges: ", strerror(errno).fromStringz)); assert(false); } if (setuid(userid) != 0) { savedLogger.logError(text("setuid: Unable to drop user privileges: ", strerror(errno).fromStringz)); assert(false); } } } /// Terminating application with cleanup void terminate(int code, bool isDaemon = true) nothrow { if(isDaemon) { savedLogger.logInfo("Daemon is terminating with code: " ~ to!string(code)); savedLogger.finalize(); gc_term(); try { _d_critical_term(); _d_monitor_staticdtor(); } catch (Exception ex) { } } exit(code); } /// Tries to read a number from $(B filename) int readPidFile(string filename) { std.stdio.writeln(filename); if(!filename.exists) throw new LoggedException("Cannot find pid file at '" ~ filename ~ "'!"); auto file = File(filename, "r"); return file.readln.to!int; } } } private { // https://issues.dlang.org/show_bug.cgi?id=13282 extern (C) nothrow { int __libc_current_sigrtmin(); int __libc_current_sigrtmax(); } extern (C) nothrow { // These are for control of termination // druntime rt.critical_ void _d_critical_term(); // druntime rt.monitor_ void _d_monitor_staticdtor(); void gc_term(); alias int pid_t; // daemon functions pid_t fork(); int umask(int); int setsid(); int close(int fd); // Signal trapping in Linux alias void function(int) sighandler_t; sighandler_t signal(int signum, sighandler_t handler); char* strerror(int errnum) pure; } /// Handles utilities for signal mapping from local representation to GNU/Linux one template readDaemonInfo(alias DaemonInfo) if(isDaemon!DaemonInfo || isDaemonClient!DaemonInfo) { template extractCustomSignals(T...) { static if(T.length < 2) alias extractCustomSignals = T[0]; else static if(isComposition!(T[1])) alias extractCustomSignals = StrictExpressionList!(T[0].expand, staticFilter!(isCustomSignal, T[1].signals)); else static if(isCustomSignal(T[1])) alias extractCustomSignals = StrictExpressionList!(T[0].expand, T[1]); else alias extractCustomSignals = T[0]; } template extractNativeSignals(T...) { static if(T.length < 2) alias extractNativeSignals = T[0]; else static if(isComposition!(T[1])) alias extractNativeSignals = StrictExpressionList!(T[0].expand, staticFilter!(isNativeSignal, T[1].signals)); else static if(isNativeSignal(T[1])) alias extractNativeSignals = StrictExpressionList!(T[0].expand, T[1]); else alias extractNativeSignals = T[0]; } static if(isDaemon!DaemonInfo) { alias customSignals = staticFold!(extractCustomSignals, StrictExpressionList!(), DaemonInfo.signalMap.keys).expand; //pragma(msg, [customSignals]); alias nativeSignals = staticFold!(extractNativeSignals, StrictExpressionList!(), DaemonInfo.signalMap.keys).expand; //pragma(msg, [nativeSignals]); } else { alias customSignals = staticFold!(extractCustomSignals, StrictExpressionList!(), DaemonInfo.signals).expand; //pragma(msg, [customSignals]); alias nativeSignals = staticFold!(extractNativeSignals, StrictExpressionList!(), DaemonInfo.signals).expand; //pragma(msg, [nativeSignals]); } /** * Checks if all not native signals can be binded * to real-time signals. */ bool canFitRealtimeSignals() { return customSignals.length <= __libc_current_sigrtmax - __libc_current_sigrtmin; } /// Converts platform independent signal to native @safe int mapSignal(Signal sig) nothrow { switch(sig) { case(Signal.Abort): return SIGABRT; case(Signal.HangUp): return SIGHUP; case(Signal.Interrupt): return SIGINT; case(Signal.Quit): return SIGQUIT; case(Signal.Terminate): return SIGTERM; default: return mapRealTimeSignal(sig); } } /// Converting custom signal to real-time signal @trusted int mapRealTimeSignal(Signal sig) nothrow { assert(!isNativeSignal(sig)); int counter = 0; foreach(key; customSignals) { if(sig == key) return counter + __libc_current_sigrtmin; else counter++; } assert(false, "Parameter signal not in daemon description!"); } } }
D
/** * Compiler implementation of the * $(LINK2 http://www.dlang.org, D programming language). * * Template implementation. * * Copyright: Copyright (C) 1999-2019 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/dtemplate.d, _dtemplate.d) * Documentation: https://dlang.org/phobos/dmd_dtemplate.html * Coverage: https://codecov.io/gh/dlang/dmd/src/master/src/dmd/dtemplate.d */ module dmd.dtemplate; import core.stdc.stdio; import core.stdc.string; import dmd.aggregate; import dmd.aliasthis; import dmd.arraytypes; import dmd.dcast; import dmd.dclass; import dmd.declaration; import dmd.dmangle; import dmd.dmodule; import dmd.dscope; import dmd.dsymbol; import dmd.dsymbolsem; import dmd.errors; import dmd.expression; import dmd.expressionsem; import dmd.func; import dmd.globals; import dmd.hdrgen; import dmd.id; import dmd.identifier; import dmd.impcnvtab; import dmd.init; import dmd.initsem; import dmd.mtype; import dmd.opover; import dmd.root.outbuffer; import dmd.root.rootobject; import dmd.semantic2; import dmd.semantic3; import dmd.tokens; import dmd.typesem; import dmd.visitor; import dmd.templateparamsem; //debug = FindExistingInstance; // print debug stats of findExistingInstance private enum LOG = false; enum IDX_NOTFOUND = 0x12345678; /******************************************** * These functions substitute for dynamic_cast. dynamic_cast does not work * on earlier versions of gcc. */ extern (C++) inout(Expression) isExpression(inout RootObject o) { //return dynamic_cast<Expression *>(o); if (!o || o.dyncast() != DYNCAST.expression) return null; return cast(inout(Expression))o; } extern (C++) inout(Dsymbol) isDsymbol(inout RootObject o) { //return dynamic_cast<Dsymbol *>(o); if (!o || o.dyncast() != DYNCAST.dsymbol) return null; return cast(inout(Dsymbol))o; } extern (C++) inout(Type) isType(inout RootObject o) { //return dynamic_cast<Type *>(o); if (!o || o.dyncast() != DYNCAST.type) return null; return cast(inout(Type))o; } extern (C++) inout(Tuple) isTuple(inout RootObject o) { //return dynamic_cast<Tuple *>(o); if (!o || o.dyncast() != DYNCAST.tuple) return null; return cast(inout(Tuple))o; } extern (C++) inout(Parameter) isParameter(inout RootObject o) { //return dynamic_cast<Parameter *>(o); if (!o || o.dyncast() != DYNCAST.parameter) return null; return cast(inout(Parameter))o; } extern (C++) inout(TemplateParameter) isTemplateParameter(inout RootObject o) { if (!o || o.dyncast() != DYNCAST.templateparameter) return null; return cast(inout(TemplateParameter))o; } /************************************** * Is this Object an error? */ extern (C++) bool isError(const RootObject o) { if (const t = isType(o)) return (t.ty == Terror); if (const e = isExpression(o)) return (e.op == TOK.error || !e.type || e.type.ty == Terror); if (const v = isTuple(o)) return arrayObjectIsError(&v.objects); const s = isDsymbol(o); assert(s); if (s.errors) return true; return s.parent ? isError(s.parent) : false; } /************************************** * Are any of the Objects an error? */ extern (C++) bool arrayObjectIsError(const Objects* args) { foreach (const o; *args) { if (isError(o)) return true; } return false; } /*********************** * Try to get arg as a type. */ extern (C++) inout(Type) getType(inout RootObject o) { inout t = isType(o); if (!t) { if (inout e = isExpression(o)) return e.type; } return t; } extern (C++) Dsymbol getDsymbol(RootObject oarg) { //printf("getDsymbol()\n"); //printf("e %p s %p t %p v %p\n", isExpression(oarg), isDsymbol(oarg), isType(oarg), isTuple(oarg)); Dsymbol sa; if (Expression ea = isExpression(oarg)) { // Try to convert Expression to symbol if (ea.op == TOK.variable) sa = (cast(VarExp)ea).var; else if (ea.op == TOK.function_) { if ((cast(FuncExp)ea).td) sa = (cast(FuncExp)ea).td; else sa = (cast(FuncExp)ea).fd; } else if (ea.op == TOK.template_) sa = (cast(TemplateExp)ea).td; else sa = null; } else { // Try to convert Type to symbol if (Type ta = isType(oarg)) sa = ta.toDsymbol(null); else sa = isDsymbol(oarg); // if already a symbol } return sa; } private Expression getValue(ref Dsymbol s) { if (s) { if (VarDeclaration v = s.isVarDeclaration()) { if (v.storage_class & STC.manifest) return v.getConstInitializer(); } } return null; } /*********************** * Try to get value from manifest constant */ private Expression getValue(Expression e) { if (e && e.op == TOK.variable) { VarDeclaration v = (cast(VarExp)e).var.isVarDeclaration(); if (v && v.storage_class & STC.manifest) { e = v.getConstInitializer(); } } return e; } private Expression getExpression(RootObject o) { auto s = isDsymbol(o); return s ? .getValue(s) : .getValue(isExpression(o)); } /****************************** * If o1 matches o2, return true. * Else, return false. */ private bool match(RootObject o1, RootObject o2) { enum log = false; static if (log) { printf("match() o1 = %p %s (%d), o2 = %p %s (%d)\n", o1, o1.toChars(), o1.dyncast(), o2, o2.toChars(), o2.dyncast()); } /* A proper implementation of the various equals() overrides * should make it possible to just do o1.equals(o2), but * we'll do that another day. */ /* Manifest constants should be compared by their values, * at least in template arguments. */ if (auto t1 = isType(o1)) { auto t2 = isType(o2); if (!t2) goto Lnomatch; static if (log) { printf("\tt1 = %s\n", t1.toChars()); printf("\tt2 = %s\n", t2.toChars()); } if (!t1.equals(t2)) goto Lnomatch; goto Lmatch; } if (auto e1 = getExpression(o1)) { auto e2 = getExpression(o2); if (!e2) goto Lnomatch; static if (log) { printf("\te1 = %s '%s' %s\n", e1.type.toChars(), Token.toChars(e1.op), e1.toChars()); printf("\te2 = %s '%s' %s\n", e2.type.toChars(), Token.toChars(e2.op), e2.toChars()); } // two expressions can be equal although they do not have the same // type; that happens when they have the same value. So check type // as well as expression equality to ensure templates are properly // matched. if (!e1.type.equals(e2.type) || !e1.equals(e2)) goto Lnomatch; goto Lmatch; } if (auto s1 = isDsymbol(o1)) { auto s2 = isDsymbol(o2); if (!s2) goto Lnomatch; static if (log) { printf("\ts1 = %s \n", s1.kind(), s1.toChars()); printf("\ts2 = %s \n", s2.kind(), s2.toChars()); } if (!s1.equals(s2)) goto Lnomatch; if (s1.parent != s2.parent && !s1.isFuncDeclaration() && !s2.isFuncDeclaration()) goto Lnomatch; goto Lmatch; } if (auto u1 = isTuple(o1)) { auto u2 = isTuple(o2); if (!u2) goto Lnomatch; static if (log) { printf("\tu1 = %s\n", u1.toChars()); printf("\tu2 = %s\n", u2.toChars()); } if (!arrayObjectMatch(&u1.objects, &u2.objects)) goto Lnomatch; goto Lmatch; } Lmatch: static if (log) printf("\t. match\n"); return true; Lnomatch: static if (log) printf("\t. nomatch\n"); return false; } /************************************ * Match an array of them. */ private bool arrayObjectMatch(Objects* oa1, Objects* oa2) { if (oa1 == oa2) return true; if (oa1.dim != oa2.dim) return false; immutable oa1dim = oa1.dim; auto oa1d = (*oa1).data; auto oa2d = (*oa2).data; foreach (j; 0 .. oa1dim) { RootObject o1 = oa1d[j]; RootObject o2 = oa2d[j]; if (!match(o1, o2)) { return false; } } return true; } /************************************ * Return hash of Objects. */ private hash_t arrayObjectHash(Objects* oa1) { import dmd.root.hash : mixHash; hash_t hash = 0; foreach (o1; *oa1) { /* Must follow the logic of match() */ if (auto t1 = isType(o1)) hash = mixHash(hash, cast(size_t)t1.deco); else if (auto e1 = getExpression(o1)) hash = mixHash(hash, expressionHash(e1)); else if (auto s1 = isDsymbol(o1)) { auto fa1 = s1.isFuncAliasDeclaration(); if (fa1) s1 = fa1.toAliasFunc(); hash = mixHash(hash, mixHash(cast(size_t)cast(void*)s1.getIdent(), cast(size_t)cast(void*)s1.parent)); } else if (auto u1 = isTuple(o1)) hash = mixHash(hash, arrayObjectHash(&u1.objects)); } return hash; } /************************************ * Computes hash of expression. * Handles all Expression classes and MUST match their equals method, * i.e. e1.equals(e2) implies expressionHash(e1) == expressionHash(e2). */ private hash_t expressionHash(Expression e) { import dmd.root.ctfloat : CTFloat; import dmd.root.hash : calcHash, mixHash; switch (e.op) { case TOK.int64: return cast(size_t) (cast(IntegerExp)e).getInteger(); case TOK.float64: return CTFloat.hash((cast(RealExp)e).value); case TOK.complex80: auto ce = cast(ComplexExp)e; return mixHash(CTFloat.hash(ce.toReal), CTFloat.hash(ce.toImaginary)); case TOK.identifier: return cast(size_t)cast(void*) (cast(IdentifierExp)e).ident; case TOK.null_: return cast(size_t)cast(void*) (cast(NullExp)e).type; case TOK.string_: auto se = cast(StringExp)e; return calcHash(se.string, se.len * se.sz); case TOK.tuple: { auto te = cast(TupleExp)e; size_t hash = 0; hash += te.e0 ? expressionHash(te.e0) : 0; foreach (elem; *te.exps) hash = mixHash(hash, expressionHash(elem)); return hash; } case TOK.arrayLiteral: { auto ae = cast(ArrayLiteralExp)e; size_t hash; foreach (i; 0 .. ae.elements.dim) hash = mixHash(hash, expressionHash(ae.getElement(i))); return hash; } case TOK.assocArrayLiteral: { auto ae = cast(AssocArrayLiteralExp)e; size_t hash; foreach (i; 0 .. ae.keys.dim) // reduction needs associative op as keys are unsorted (use XOR) hash ^= mixHash(expressionHash((*ae.keys)[i]), expressionHash((*ae.values)[i])); return hash; } case TOK.structLiteral: { auto se = cast(StructLiteralExp)e; size_t hash; foreach (elem; *se.elements) hash = mixHash(hash, elem ? expressionHash(elem) : 0); return hash; } case TOK.variable: return cast(size_t)cast(void*) (cast(VarExp)e).var; case TOK.function_: return cast(size_t)cast(void*) (cast(FuncExp)e).fd; default: // no custom equals for this expression assert((&e.equals).funcptr is &RootObject.equals); // equals based on identity return cast(size_t)cast(void*) e; } } RootObject objectSyntaxCopy(RootObject o) { if (!o) return null; if (Type t = isType(o)) return t.syntaxCopy(); if (Expression e = isExpression(o)) return e.syntaxCopy(); return o; } extern (C++) final class Tuple : RootObject { Objects objects; extern (D) this() {} /** Params: numObjects = The initial number of objects. */ extern (D) this(size_t numObjects) { objects.setDim(numObjects); } // kludge for template.isType() override DYNCAST dyncast() const { return DYNCAST.tuple; } override const(char)* toChars() { return objects.toChars(); } } struct TemplatePrevious { TemplatePrevious* prev; Scope* sc; Objects* dedargs; } /*********************************************************** * [mixin] template Identifier (parameters) [Constraint] * https://dlang.org/spec/template.html * https://dlang.org/spec/template-mixin.html */ extern (C++) final class TemplateDeclaration : ScopeDsymbol { TemplateParameters* parameters; // array of TemplateParameter's TemplateParameters* origParameters; // originals for Ddoc Expression constraint; // Hash table to look up TemplateInstance's of this TemplateDeclaration TemplateInstance[TemplateInstanceBox] instances; TemplateDeclaration overnext; // next overloaded TemplateDeclaration TemplateDeclaration overroot; // first in overnext list FuncDeclaration funcroot; // first function in unified overload list Dsymbol onemember; // if !=null then one member of this template bool literal; // this template declaration is a literal bool ismixin; // this is a mixin template declaration bool isstatic; // this is static template declaration Prot protection; int inuse; /// for recursive expansion detection // threaded list of previous instantiation attempts on stack TemplatePrevious* previous; extern (D) this(const ref Loc loc, Identifier id, TemplateParameters* parameters, Expression constraint, Dsymbols* decldefs, bool ismixin = false, bool literal = false) { super(id); static if (LOG) { printf("TemplateDeclaration(this = %p, id = '%s')\n", this, id.toChars()); } version (none) { if (parameters) for (int i = 0; i < parameters.dim; i++) { TemplateParameter tp = (*parameters)[i]; //printf("\tparameter[%d] = %p\n", i, tp); TemplateTypeParameter ttp = tp.isTemplateTypeParameter(); if (ttp) { printf("\tparameter[%d] = %s : %s\n", i, tp.ident.toChars(), ttp.specType ? ttp.specType.toChars() : ""); } } } this.loc = loc; this.parameters = parameters; this.origParameters = parameters; this.constraint = constraint; this.members = decldefs; this.literal = literal; this.ismixin = ismixin; this.isstatic = true; this.protection = Prot(Prot.Kind.undefined); // Compute in advance for Ddoc's use // https://issues.dlang.org/show_bug.cgi?id=11153: ident could be NULL if parsing fails. if (members && ident) { Dsymbol s; if (Dsymbol.oneMembers(members, &s, ident) && s) { onemember = s; s.parent = this; } } } override Dsymbol syntaxCopy(Dsymbol) { //printf("TemplateDeclaration.syntaxCopy()\n"); TemplateParameters* p = null; if (parameters) { p = new TemplateParameters(parameters.dim); for (size_t i = 0; i < p.dim; i++) (*p)[i] = (*parameters)[i].syntaxCopy(); } return new TemplateDeclaration(loc, ident, p, constraint ? constraint.syntaxCopy() : null, Dsymbol.arraySyntaxCopy(members), ismixin, literal); } /********************************** * Overload existing TemplateDeclaration 'this' with the new one 's'. * Return true if successful; i.e. no conflict. */ override bool overloadInsert(Dsymbol s) { static if (LOG) { printf("TemplateDeclaration.overloadInsert('%s')\n", s.toChars()); } FuncDeclaration fd = s.isFuncDeclaration(); if (fd) { if (funcroot) return funcroot.overloadInsert(fd); funcroot = fd; return funcroot.overloadInsert(this); } TemplateDeclaration td = s.isTemplateDeclaration(); if (!td) return false; TemplateDeclaration pthis = this; TemplateDeclaration* ptd; for (ptd = &pthis; *ptd; ptd = &(*ptd).overnext) { } td.overroot = this; *ptd = td; static if (LOG) { printf("\ttrue: no conflict\n"); } return true; } override bool hasStaticCtorOrDtor() { return false; // don't scan uninstantiated templates } override const(char)* kind() const { return (onemember && onemember.isAggregateDeclaration()) ? onemember.kind() : "template"; } override const(char)* toChars() { if (literal) return Dsymbol.toChars(); OutBuffer buf; HdrGenState hgs; buf.writestring(ident.toChars()); buf.writeByte('('); for (size_t i = 0; i < parameters.dim; i++) { TemplateParameter tp = (*parameters)[i]; if (i) buf.writestring(", "); .toCBuffer(tp, &buf, &hgs); } buf.writeByte(')'); if (onemember) { FuncDeclaration fd = onemember.isFuncDeclaration(); if (fd && fd.type) { TypeFunction tf = cast(TypeFunction)fd.type; buf.writestring(parametersTypeToChars(tf.parameterList)); } } if (constraint) { buf.writestring(" if ("); .toCBuffer(constraint, &buf, &hgs); buf.writeByte(')'); } return buf.extractString(); } override Prot prot() { return protection; } /**************************** * Check to see if constraint is satisfied. */ extern (D) bool evaluateConstraint(TemplateInstance ti, Scope* sc, Scope* paramscope, Objects* dedargs, FuncDeclaration fd) { /* Detect recursive attempts to instantiate this template declaration, * https://issues.dlang.org/show_bug.cgi?id=4072 * void foo(T)(T x) if (is(typeof(foo(x)))) { } * static assert(!is(typeof(foo(7)))); * Recursive attempts are regarded as a constraint failure. */ /* There's a chicken-and-egg problem here. We don't know yet if this template * instantiation will be a local one (enclosing is set), and we won't know until * after selecting the correct template. Thus, function we're nesting inside * is not on the sc scope chain, and this can cause errors in FuncDeclaration.getLevel(). * Workaround the problem by setting a flag to relax the checking on frame errors. */ for (TemplatePrevious* p = previous; p; p = p.prev) { if (arrayObjectMatch(p.dedargs, dedargs)) { //printf("recursive, no match p.sc=%p %p %s\n", p.sc, this, this.toChars()); /* It must be a subscope of p.sc, other scope chains are not recursive * instantiations. */ for (Scope* scx = sc; scx; scx = scx.enclosing) { if (scx == p.sc) return false; } } /* BUG: should also check for ref param differences */ } TemplatePrevious pr; pr.prev = previous; pr.sc = paramscope; pr.dedargs = dedargs; previous = &pr; // add this to threaded list Scope* scx = paramscope.push(ti); scx.parent = ti; scx.tinst = null; scx.minst = null; assert(!ti.symtab); if (fd) { /* Declare all the function parameters as variables and add them to the scope * Making parameters is similar to FuncDeclaration.semantic3 */ TypeFunction tf = cast(TypeFunction)fd.type; assert(tf.ty == Tfunction); scx.parent = fd; Parameters* fparameters = tf.parameterList.parameters; size_t nfparams = tf.parameterList.length; for (size_t i = 0; i < nfparams; i++) { Parameter fparam = tf.parameterList[i]; fparam.storageClass &= (STC.in_ | STC.out_ | STC.ref_ | STC.lazy_ | STC.final_ | STC.TYPECTOR | STC.nodtor); fparam.storageClass |= STC.parameter; if (tf.parameterList.varargs == VarArg.typesafe && i + 1 == nfparams) { fparam.storageClass |= STC.variadic; /* Don't need to set STC.scope_ because this will only * be evaluated at compile time */ } } for (size_t i = 0; i < fparameters.dim; i++) { Parameter fparam = (*fparameters)[i]; if (!fparam.ident) continue; // don't add it, if it has no name auto v = new VarDeclaration(loc, fparam.type, fparam.ident, null); v.storage_class = fparam.storageClass; v.dsymbolSemantic(scx); if (!ti.symtab) ti.symtab = new DsymbolTable(); if (!scx.insert(v)) error("parameter `%s.%s` is already defined", toChars(), v.toChars()); else v.parent = fd; } if (isstatic) fd.storage_class |= STC.static_; auto hiddenParams = fd.declareThis(scx, fd.isThis()); fd.vthis = hiddenParams.vthis; fd.selectorParameter = hiddenParams.selectorParameter; } Expression e = constraint.syntaxCopy(); import dmd.staticcond; assert(ti.inst is null); ti.inst = ti; // temporary instantiation to enable genIdent() scx.flags |= SCOPE.constraint; bool errors; bool result = evalStaticCondition(scx, constraint, e, errors); ti.inst = null; ti.symtab = null; scx = scx.pop(); previous = pr.prev; // unlink from threaded list if (errors) return false; return result; } /****************************** * Create a scope for the parameters of the TemplateInstance * `ti` in the parent scope sc from the ScopeDsymbol paramsym. * * If paramsym is null a new ScopeDsymbol is used in place of * paramsym. * Params: * ti = the TemplateInstance whose parameters to generate the scope for. * sc = the parent scope of ti * Returns: * a scope for the parameters of ti */ Scope* scopeForTemplateParameters(TemplateInstance ti, Scope* sc) { ScopeDsymbol paramsym = new ScopeDsymbol(); paramsym.parent = _scope.parent; Scope* paramscope = _scope.push(paramsym); paramscope.tinst = ti; paramscope.minst = sc.minst; paramscope.callsc = sc; paramscope.stc = 0; return paramscope; } /*************************************** * Given that ti is an instance of this TemplateDeclaration, * deduce the types of the parameters to this, and store * those deduced types in dedtypes[]. * Input: * flag 1: don't do semantic() because of dummy types * 2: don't change types in matchArg() * Output: * dedtypes deduced arguments * Return match level. */ extern (D) MATCH matchWithInstance(Scope* sc, TemplateInstance ti, Objects* dedtypes, Expressions* fargs, int flag) { enum LOGM = 0; static if (LOGM) { printf("\n+TemplateDeclaration.matchWithInstance(this = %s, ti = %s, flag = %d)\n", toChars(), ti.toChars(), flag); } version (none) { printf("dedtypes.dim = %d, parameters.dim = %d\n", dedtypes.dim, parameters.dim); if (ti.tiargs.dim) printf("ti.tiargs.dim = %d, [0] = %p\n", ti.tiargs.dim, (*ti.tiargs)[0]); } MATCH m; size_t dedtypes_dim = dedtypes.dim; dedtypes.zero(); if (errors) return MATCH.nomatch; size_t parameters_dim = parameters.dim; int variadic = isVariadic() !is null; // If more arguments than parameters, no match if (ti.tiargs.dim > parameters_dim && !variadic) { static if (LOGM) { printf(" no match: more arguments than parameters\n"); } return MATCH.nomatch; } assert(dedtypes_dim == parameters_dim); assert(dedtypes_dim >= ti.tiargs.dim || variadic); assert(_scope); // Set up scope for template parameters Scope* paramscope = scopeForTemplateParameters(ti,sc); // Attempt type deduction m = MATCH.exact; for (size_t i = 0; i < dedtypes_dim; i++) { MATCH m2; TemplateParameter tp = (*parameters)[i]; Declaration sparam; //printf("\targument [%d]\n", i); static if (LOGM) { //printf("\targument [%d] is %s\n", i, oarg ? oarg.toChars() : "null"); TemplateTypeParameter ttp = tp.isTemplateTypeParameter(); if (ttp) printf("\tparameter[%d] is %s : %s\n", i, tp.ident.toChars(), ttp.specType ? ttp.specType.toChars() : ""); } inuse++; m2 = tp.matchArg(ti.loc, paramscope, ti.tiargs, i, parameters, dedtypes, &sparam); inuse--; //printf("\tm2 = %d\n", m2); if (m2 == MATCH.nomatch) { version (none) { printf("\tmatchArg() for parameter %i failed\n", i); } goto Lnomatch; } if (m2 < m) m = m2; if (!flag) sparam.dsymbolSemantic(paramscope); if (!paramscope.insert(sparam)) // TODO: This check can make more early { // in TemplateDeclaration.semantic, and // then we don't need to make sparam if flags == 0 goto Lnomatch; } } if (!flag) { /* Any parameter left without a type gets the type of * its corresponding arg */ for (size_t i = 0; i < dedtypes_dim; i++) { if (!(*dedtypes)[i]) { assert(i < ti.tiargs.dim); (*dedtypes)[i] = cast(Type)(*ti.tiargs)[i]; } } } if (m > MATCH.nomatch && constraint && !flag) { if (ti.hasNestedArgs(ti.tiargs, this.isstatic)) // TODO: should gag error ti.parent = ti.enclosing; else ti.parent = this.parent; // Similar to doHeaderInstantiation FuncDeclaration fd = onemember ? onemember.isFuncDeclaration() : null; if (fd) { assert(fd.type.ty == Tfunction); TypeFunction tf = cast(TypeFunction)fd.type.syntaxCopy(); fd = new FuncDeclaration(fd.loc, fd.endloc, fd.ident, fd.storage_class, tf); fd.parent = ti; fd.inferRetType = true; // Shouldn't run semantic on default arguments and return type. for (size_t i = 0; i < tf.parameterList.parameters.dim; i++) (*tf.parameterList.parameters)[i].defaultArg = null; tf.next = null; // Resolve parameter types and 'auto ref's. tf.fargs = fargs; uint olderrors = global.startGagging(); fd.type = tf.typeSemantic(loc, paramscope); if (global.endGagging(olderrors)) { assert(fd.type.ty != Tfunction); goto Lnomatch; } assert(fd.type.ty == Tfunction); fd.originalType = fd.type; // for mangling } // TODO: dedtypes => ti.tiargs ? if (!evaluateConstraint(ti, sc, paramscope, dedtypes, fd)) goto Lnomatch; } static if (LOGM) { // Print out the results printf("--------------------------\n"); printf("template %s\n", toChars()); printf("instance %s\n", ti.toChars()); if (m > MATCH.nomatch) { for (size_t i = 0; i < dedtypes_dim; i++) { TemplateParameter tp = (*parameters)[i]; RootObject oarg; printf(" [%d]", i); if (i < ti.tiargs.dim) oarg = (*ti.tiargs)[i]; else oarg = null; tp.print(oarg, (*dedtypes)[i]); } } else goto Lnomatch; } static if (LOGM) { printf(" match = %d\n", m); } goto Lret; Lnomatch: static if (LOGM) { printf(" no match\n"); } m = MATCH.nomatch; Lret: paramscope.pop(); static if (LOGM) { printf("-TemplateDeclaration.matchWithInstance(this = %p, ti = %p) = %d\n", this, ti, m); } return m; } /******************************************** * Determine partial specialization order of 'this' vs td2. * Returns: * match this is at least as specialized as td2 * 0 td2 is more specialized than this */ MATCH leastAsSpecialized(Scope* sc, TemplateDeclaration td2, Expressions* fargs) { enum LOG_LEASTAS = 0; static if (LOG_LEASTAS) { printf("%s.leastAsSpecialized(%s)\n", toChars(), td2.toChars()); } /* This works by taking the template parameters to this template * declaration and feeding them to td2 as if it were a template * instance. * If it works, then this template is at least as specialized * as td2. */ // Set type arguments to dummy template instance to be types // generated from the parameters to this template declaration auto tiargs = new Objects(); tiargs.reserve(parameters.dim); for (size_t i = 0; i < parameters.dim; i++) { TemplateParameter tp = (*parameters)[i]; if (tp.dependent) break; RootObject p = cast(RootObject)tp.dummyArg(); if (!p) break; tiargs.push(p); } scope TemplateInstance ti = new TemplateInstance(Loc.initial, ident, tiargs); // create dummy template instance // Temporary Array to hold deduced types Objects dedtypes = Objects(td2.parameters.dim); // Attempt a type deduction MATCH m = td2.matchWithInstance(sc, ti, &dedtypes, fargs, 1); if (m > MATCH.nomatch) { /* A non-variadic template is more specialized than a * variadic one. */ TemplateTupleParameter tp = isVariadic(); if (tp && !tp.dependent && !td2.isVariadic()) goto L1; static if (LOG_LEASTAS) { printf(" matches %d, so is least as specialized\n", m); } return m; } L1: static if (LOG_LEASTAS) { printf(" doesn't match, so is not as specialized\n"); } return MATCH.nomatch; } /************************************************* * Match function arguments against a specific template function. * Input: * ti * sc instantiation scope * fd * tthis 'this' argument if !NULL * fargs arguments to function * Output: * fd Partially instantiated function declaration * ti.tdtypes Expression/Type deduced template arguments * Returns: * match level * bit 0-3 Match template parameters by inferred template arguments * bit 4-7 Match template parameters by initial template arguments */ extern (D) MATCH deduceFunctionTemplateMatch(TemplateInstance ti, Scope* sc, ref FuncDeclaration fd, Type tthis, Expressions* fargs) { size_t nfparams; size_t nfargs; size_t ntargs; // array size of tiargs size_t fptupindex = IDX_NOTFOUND; MATCH match = MATCH.exact; MATCH matchTiargs = MATCH.exact; ParameterList fparameters; // function parameter list VarArg fvarargs; // function varargs uint wildmatch = 0; size_t inferStart = 0; Loc instLoc = ti.loc; Objects* tiargs = ti.tiargs; auto dedargs = new Objects(); Objects* dedtypes = &ti.tdtypes; // for T:T*, the dedargs is the T*, dedtypes is the T version (none) { printf("\nTemplateDeclaration.deduceFunctionTemplateMatch() %s\n", toChars()); for (size_t i = 0; i < (fargs ? fargs.dim : 0); i++) { Expression e = (*fargs)[i]; printf("\tfarg[%d] is %s, type is %s\n", i, e.toChars(), e.type.toChars()); } printf("fd = %s\n", fd.toChars()); printf("fd.type = %s\n", fd.type.toChars()); if (tthis) printf("tthis = %s\n", tthis.toChars()); } assert(_scope); dedargs.setDim(parameters.dim); dedargs.zero(); dedtypes.setDim(parameters.dim); dedtypes.zero(); if (errors || fd.errors) return MATCH.nomatch; // Set up scope for parameters Scope* paramscope = scopeForTemplateParameters(ti,sc); TemplateTupleParameter tp = isVariadic(); Tuple declaredTuple = null; version (none) { for (size_t i = 0; i < dedargs.dim; i++) { printf("\tdedarg[%d] = ", i); RootObject oarg = (*dedargs)[i]; if (oarg) printf("%s", oarg.toChars()); printf("\n"); } } ntargs = 0; if (tiargs) { // Set initial template arguments ntargs = tiargs.dim; size_t n = parameters.dim; if (tp) n--; if (ntargs > n) { if (!tp) goto Lnomatch; /* The extra initial template arguments * now form the tuple argument. */ auto t = new Tuple(ntargs - n); assert(parameters.dim); (*dedargs)[parameters.dim - 1] = t; for (size_t i = 0; i < t.objects.dim; i++) { t.objects[i] = (*tiargs)[n + i]; } declareParameter(paramscope, tp, t); declaredTuple = t; } else n = ntargs; memcpy(dedargs.tdata(), tiargs.tdata(), n * (*dedargs.tdata()).sizeof); for (size_t i = 0; i < n; i++) { assert(i < parameters.dim); Declaration sparam = null; MATCH m = (*parameters)[i].matchArg(instLoc, paramscope, dedargs, i, parameters, dedtypes, &sparam); //printf("\tdeduceType m = %d\n", m); if (m <= MATCH.nomatch) goto Lnomatch; if (m < matchTiargs) matchTiargs = m; sparam.dsymbolSemantic(paramscope); if (!paramscope.insert(sparam)) goto Lnomatch; } if (n < parameters.dim && !declaredTuple) { inferStart = n; } else inferStart = parameters.dim; //printf("tiargs matchTiargs = %d\n", matchTiargs); } version (none) { for (size_t i = 0; i < dedargs.dim; i++) { printf("\tdedarg[%d] = ", i); RootObject oarg = (*dedargs)[i]; if (oarg) printf("%s", oarg.toChars()); printf("\n"); } } fparameters = fd.getParameterList(); nfparams = fparameters.length; // number of function parameters nfargs = fargs ? fargs.dim : 0; // number of function arguments /* Check for match of function arguments with variadic template * parameter, such as: * * void foo(T, A...)(T t, A a); * void main() { foo(1,2,3); } */ if (tp) // if variadic { // TemplateTupleParameter always makes most lesser matching. matchTiargs = MATCH.convert; if (nfparams == 0 && nfargs != 0) // if no function parameters { if (!declaredTuple) { auto t = new Tuple(); //printf("t = %p\n", t); (*dedargs)[parameters.dim - 1] = t; declareParameter(paramscope, tp, t); declaredTuple = t; } } else { /* Figure out which of the function parameters matches * the tuple template parameter. Do this by matching * type identifiers. * Set the index of this function parameter to fptupindex. */ for (fptupindex = 0; fptupindex < nfparams; fptupindex++) { auto fparam = (*fparameters.parameters)[fptupindex]; // fparameters[fptupindex] ? if (fparam.type.ty != Tident) continue; TypeIdentifier tid = cast(TypeIdentifier)fparam.type; if (!tp.ident.equals(tid.ident) || tid.idents.dim) continue; if (fparameters.varargs != VarArg.none) // variadic function doesn't goto Lnomatch; // go with variadic template goto L1; } fptupindex = IDX_NOTFOUND; L1: } } if (toParent().isModule() || (_scope.stc & STC.static_)) tthis = null; if (tthis) { bool hasttp = false; // Match 'tthis' to any TemplateThisParameter's for (size_t i = 0; i < parameters.dim; i++) { TemplateThisParameter ttp = (*parameters)[i].isTemplateThisParameter(); if (ttp) { hasttp = true; Type t = new TypeIdentifier(Loc.initial, ttp.ident); MATCH m = deduceType(tthis, paramscope, t, parameters, dedtypes); if (m <= MATCH.nomatch) goto Lnomatch; if (m < match) match = m; // pick worst match } } // Match attributes of tthis against attributes of fd if (fd.type && !fd.isCtorDeclaration()) { StorageClass stc = _scope.stc | fd.storage_class2; // Propagate parent storage class, https://issues.dlang.org/show_bug.cgi?id=5504 Dsymbol p = parent; while (p.isTemplateDeclaration() || p.isTemplateInstance()) p = p.parent; AggregateDeclaration ad = p.isAggregateDeclaration(); if (ad) stc |= ad.storage_class; ubyte mod = fd.type.mod; if (stc & STC.immutable_) mod = MODFlags.immutable_; else { if (stc & (STC.shared_ | STC.synchronized_)) mod |= MODFlags.shared_; if (stc & STC.const_) mod |= MODFlags.const_; if (stc & STC.wild) mod |= MODFlags.wild; } ubyte thismod = tthis.mod; if (hasttp) mod = MODmerge(thismod, mod); MATCH m = MODmethodConv(thismod, mod); if (m <= MATCH.nomatch) goto Lnomatch; if (m < match) match = m; } } // Loop through the function parameters { //printf("%s\n\tnfargs = %d, nfparams = %d, tuple_dim = %d\n", toChars(), nfargs, nfparams, declaredTuple ? declaredTuple.objects.dim : 0); //printf("\ttp = %p, fptupindex = %d, found = %d, declaredTuple = %s\n", tp, fptupindex, fptupindex != IDX_NOTFOUND, declaredTuple ? declaredTuple.toChars() : NULL); size_t argi = 0; size_t nfargs2 = nfargs; // nfargs + supplied defaultArgs for (size_t parami = 0; parami < nfparams; parami++) { Parameter fparam = fparameters[parami]; // Apply function parameter storage classes to parameter types Type prmtype = fparam.type.addStorageClass(fparam.storageClass); Expression farg; /* See function parameters which wound up * as part of a template tuple parameter. */ if (fptupindex != IDX_NOTFOUND && parami == fptupindex) { assert(prmtype.ty == Tident); TypeIdentifier tid = cast(TypeIdentifier)prmtype; if (!declaredTuple) { /* The types of the function arguments * now form the tuple argument. */ declaredTuple = new Tuple(); (*dedargs)[parameters.dim - 1] = declaredTuple; /* Count function parameters with no defaults following a tuple parameter. * void foo(U, T...)(int y, T, U, double, int bar = 0) {} // rem == 2 (U, double) */ size_t rem = 0; for (size_t j = parami + 1; j < nfparams; j++) { Parameter p = fparameters[j]; if (p.defaultArg) { break; } if (!reliesOnTemplateParameters(p.type, (*parameters)[inferStart .. parameters.dim])) { Type pt = p.type.syntaxCopy().typeSemantic(fd.loc, paramscope); rem += pt.ty == Ttuple ? (cast(TypeTuple)pt).arguments.dim : 1; } else { ++rem; } } if (nfargs2 - argi < rem) goto Lnomatch; declaredTuple.objects.setDim(nfargs2 - argi - rem); for (size_t i = 0; i < declaredTuple.objects.dim; i++) { farg = (*fargs)[argi + i]; // Check invalid arguments to detect errors early. if (farg.op == TOK.error || farg.type.ty == Terror) goto Lnomatch; if (!(fparam.storageClass & STC.lazy_) && farg.type.ty == Tvoid) goto Lnomatch; Type tt; MATCH m; if (ubyte wm = deduceWildHelper(farg.type, &tt, tid)) { wildmatch |= wm; m = MATCH.constant; } else { m = deduceTypeHelper(farg.type, &tt, tid); } if (m <= MATCH.nomatch) goto Lnomatch; if (m < match) match = m; /* Remove top const for dynamic array types and pointer types */ if ((tt.ty == Tarray || tt.ty == Tpointer) && !tt.isMutable() && (!(fparam.storageClass & STC.ref_) || (fparam.storageClass & STC.auto_) && !farg.isLvalue())) { tt = tt.mutableOf(); } declaredTuple.objects[i] = tt; } declareParameter(paramscope, tp, declaredTuple); } else { // https://issues.dlang.org/show_bug.cgi?id=6810 // If declared tuple is not a type tuple, // it cannot be function parameter types. for (size_t i = 0; i < declaredTuple.objects.dim; i++) { if (!isType(declaredTuple.objects[i])) goto Lnomatch; } } assert(declaredTuple); argi += declaredTuple.objects.dim; continue; } // If parameter type doesn't depend on inferred template parameters, // semantic it to get actual type. if (!reliesOnTemplateParameters(prmtype, (*parameters)[inferStart .. parameters.dim])) { // should copy prmtype to avoid affecting semantic result prmtype = prmtype.syntaxCopy().typeSemantic(fd.loc, paramscope); if (prmtype.ty == Ttuple) { TypeTuple tt = cast(TypeTuple)prmtype; size_t tt_dim = tt.arguments.dim; for (size_t j = 0; j < tt_dim; j++, ++argi) { Parameter p = (*tt.arguments)[j]; if (j == tt_dim - 1 && fparameters.varargs == VarArg.typesafe && parami + 1 == nfparams && argi < nfargs) { prmtype = p.type; goto Lvarargs; } if (argi >= nfargs) { if (p.defaultArg) continue; goto Lnomatch; } farg = (*fargs)[argi]; if (!farg.implicitConvTo(p.type)) goto Lnomatch; } continue; } } if (argi >= nfargs) // if not enough arguments { if (!fparam.defaultArg) goto Lvarargs; /* https://issues.dlang.org/show_bug.cgi?id=2803 * Before the starting of type deduction from the function * default arguments, set the already deduced parameters into paramscope. * It's necessary to avoid breaking existing acceptable code. Cases: * * 1. Already deduced template parameters can appear in fparam.defaultArg: * auto foo(A, B)(A a, B b = A.stringof); * foo(1); * // at fparam == 'B b = A.string', A is equivalent with the deduced type 'int' * * 2. If prmtype depends on default-specified template parameter, the * default type should be preferred. * auto foo(N = size_t, R)(R r, N start = 0) * foo([1,2,3]); * // at fparam `N start = 0`, N should be 'size_t' before * // the deduction result from fparam.defaultArg. */ if (argi == nfargs) { for (size_t i = 0; i < dedtypes.dim; i++) { Type at = isType((*dedtypes)[i]); if (at && at.ty == Tnone) { TypeDeduced xt = cast(TypeDeduced)at; (*dedtypes)[i] = xt.tded; // 'unbox' } } for (size_t i = ntargs; i < dedargs.dim; i++) { TemplateParameter tparam = (*parameters)[i]; RootObject oarg = (*dedargs)[i]; RootObject oded = (*dedtypes)[i]; if (!oarg) { if (oded) { if (tparam.specialization() || !tparam.isTemplateTypeParameter()) { /* The specialization can work as long as afterwards * the oded == oarg */ (*dedargs)[i] = oded; MATCH m2 = tparam.matchArg(instLoc, paramscope, dedargs, i, parameters, dedtypes, null); //printf("m2 = %d\n", m2); if (m2 <= MATCH.nomatch) goto Lnomatch; if (m2 < matchTiargs) matchTiargs = m2; // pick worst match if (!(*dedtypes)[i].equals(oded)) error("specialization not allowed for deduced parameter `%s`", tparam.ident.toChars()); } else { if (MATCH.convert < matchTiargs) matchTiargs = MATCH.convert; } (*dedargs)[i] = declareParameter(paramscope, tparam, oded); } else { inuse++; oded = tparam.defaultArg(instLoc, paramscope); inuse--; if (oded) (*dedargs)[i] = declareParameter(paramscope, tparam, oded); } } } } nfargs2 = argi + 1; /* If prmtype does not depend on any template parameters: * * auto foo(T)(T v, double x = 0); * foo("str"); * // at fparam == 'double x = 0' * * or, if all template parameters in the prmtype are already deduced: * * auto foo(R)(R range, ElementType!R sum = 0); * foo([1,2,3]); * // at fparam == 'ElementType!R sum = 0' * * Deducing prmtype from fparam.defaultArg is not necessary. */ if (prmtype.deco || prmtype.syntaxCopy().trySemantic(loc, paramscope)) { ++argi; continue; } // Deduce prmtype from the defaultArg. farg = fparam.defaultArg.syntaxCopy(); farg = farg.expressionSemantic(paramscope); farg = resolveProperties(paramscope, farg); } else { farg = (*fargs)[argi]; } { // Check invalid arguments to detect errors early. if (farg.op == TOK.error || farg.type.ty == Terror) goto Lnomatch; Type att = null; Lretry: version (none) { printf("\tfarg.type = %s\n", farg.type.toChars()); printf("\tfparam.type = %s\n", prmtype.toChars()); } Type argtype = farg.type; if (!(fparam.storageClass & STC.lazy_) && argtype.ty == Tvoid && farg.op != TOK.function_) goto Lnomatch; // https://issues.dlang.org/show_bug.cgi?id=12876 // Optimize argument to allow CT-known length matching farg = farg.optimize(WANTvalue, (fparam.storageClass & (STC.ref_ | STC.out_)) != 0); //printf("farg = %s %s\n", farg.type.toChars(), farg.toChars()); RootObject oarg = farg; if ((fparam.storageClass & STC.ref_) && (!(fparam.storageClass & STC.auto_) || farg.isLvalue())) { /* Allow expressions that have CT-known boundaries and type [] to match with [dim] */ Type taai; if (argtype.ty == Tarray && (prmtype.ty == Tsarray || prmtype.ty == Taarray && (taai = (cast(TypeAArray)prmtype).index).ty == Tident && (cast(TypeIdentifier)taai).idents.dim == 0)) { if (farg.op == TOK.string_) { StringExp se = cast(StringExp)farg; argtype = se.type.nextOf().sarrayOf(se.len); } else if (farg.op == TOK.arrayLiteral) { ArrayLiteralExp ae = cast(ArrayLiteralExp)farg; argtype = ae.type.nextOf().sarrayOf(ae.elements.dim); } else if (farg.op == TOK.slice) { SliceExp se = cast(SliceExp)farg; if (Type tsa = toStaticArrayType(se)) argtype = tsa; } } oarg = argtype; } else if ((fparam.storageClass & STC.out_) == 0 && (argtype.ty == Tarray || argtype.ty == Tpointer) && templateParameterLookup(prmtype, parameters) != IDX_NOTFOUND && (cast(TypeIdentifier)prmtype).idents.dim == 0) { /* The farg passing to the prmtype always make a copy. Therefore, * we can shrink the set of the deduced type arguments for prmtype * by adjusting top-qualifier of the argtype. * * prmtype argtype ta * T <- const(E)[] const(E)[] * T <- const(E[]) const(E)[] * qualifier(T) <- const(E)[] const(E[]) * qualifier(T) <- const(E[]) const(E[]) */ Type ta = argtype.castMod(prmtype.mod ? argtype.nextOf().mod : 0); if (ta != argtype) { Expression ea = farg.copy(); ea.type = ta; oarg = ea; } } if (fparameters.varargs == VarArg.typesafe && parami + 1 == nfparams && argi + 1 < nfargs) goto Lvarargs; uint wm = 0; MATCH m = deduceType(oarg, paramscope, prmtype, parameters, dedtypes, &wm, inferStart); //printf("\tL%d deduceType m = %d, wm = x%x, wildmatch = x%x\n", __LINE__, m, wm, wildmatch); wildmatch |= wm; /* If no match, see if the argument can be matched by using * implicit conversions. */ if (m == MATCH.nomatch && prmtype.deco) m = farg.implicitConvTo(prmtype); if (m == MATCH.nomatch) { AggregateDeclaration ad = isAggregate(farg.type); if (ad && ad.aliasthis && argtype != att) { if (!att && argtype.checkAliasThisRec()) // https://issues.dlang.org/show_bug.cgi?id=12537 att = argtype; /* If a semantic error occurs while doing alias this, * eg purity(https://issues.dlang.org/show_bug.cgi?id=7295), * just regard it as not a match. */ if (auto e = resolveAliasThis(sc, farg, true)) { farg = e; goto Lretry; } } } if (m > MATCH.nomatch && (fparam.storageClass & (STC.ref_ | STC.auto_)) == STC.ref_) { if (!farg.isLvalue()) { if ((farg.op == TOK.string_ || farg.op == TOK.slice) && (prmtype.ty == Tsarray || prmtype.ty == Taarray)) { // Allow conversion from T[lwr .. upr] to ref T[upr-lwr] } else goto Lnomatch; } } if (m > MATCH.nomatch && (fparam.storageClass & STC.out_)) { if (!farg.isLvalue()) goto Lnomatch; if (!farg.type.isMutable()) // https://issues.dlang.org/show_bug.cgi?id=11916 goto Lnomatch; } if (m == MATCH.nomatch && (fparam.storageClass & STC.lazy_) && prmtype.ty == Tvoid && farg.type.ty != Tvoid) m = MATCH.convert; if (m != MATCH.nomatch) { if (m < match) match = m; // pick worst match argi++; continue; } } Lvarargs: /* The following code for variadic arguments closely * matches TypeFunction.callMatch() */ if (!(fparameters.varargs == VarArg.typesafe && parami + 1 == nfparams)) goto Lnomatch; /* Check for match with function parameter T... */ Type tb = prmtype.toBasetype(); switch (tb.ty) { // 6764 fix - TypeAArray may be TypeSArray have not yet run semantic(). case Tsarray: case Taarray: { // Perhaps we can do better with this, see TypeFunction.callMatch() if (tb.ty == Tsarray) { TypeSArray tsa = cast(TypeSArray)tb; dinteger_t sz = tsa.dim.toInteger(); if (sz != nfargs - argi) goto Lnomatch; } else if (tb.ty == Taarray) { TypeAArray taa = cast(TypeAArray)tb; Expression dim = new IntegerExp(instLoc, nfargs - argi, Type.tsize_t); size_t i = templateParameterLookup(taa.index, parameters); if (i == IDX_NOTFOUND) { Expression e; Type t; Dsymbol s; Scope *sco; uint errors = global.startGagging(); /* ref: https://issues.dlang.org/show_bug.cgi?id=11118 * The parameter isn't part of the template * ones, let's try to find it in the * instantiation scope 'sc' and the one * belonging to the template itself. */ sco = sc; taa.index.resolve(instLoc, sco, &e, &t, &s); if (!e) { sco = paramscope; taa.index.resolve(instLoc, sco, &e, &t, &s); } global.endGagging(errors); if (!e) { goto Lnomatch; } e = e.ctfeInterpret(); e = e.implicitCastTo(sco, Type.tsize_t); e = e.optimize(WANTvalue); if (!dim.equals(e)) goto Lnomatch; } else { // This code matches code in TypeInstance.deduceType() TemplateParameter tprm = (*parameters)[i]; TemplateValueParameter tvp = tprm.isTemplateValueParameter(); if (!tvp) goto Lnomatch; Expression e = cast(Expression)(*dedtypes)[i]; if (e) { if (!dim.equals(e)) goto Lnomatch; } else { Type vt = tvp.valType.typeSemantic(Loc.initial, sc); MATCH m = dim.implicitConvTo(vt); if (m <= MATCH.nomatch) goto Lnomatch; (*dedtypes)[i] = dim; } } } goto case Tarray; } case Tarray: { TypeArray ta = cast(TypeArray)tb; Type tret = fparam.isLazyArray(); for (; argi < nfargs; argi++) { Expression arg = (*fargs)[argi]; assert(arg); MATCH m; /* If lazy array of delegates, * convert arg(s) to delegate(s) */ if (tret) { if (ta.next.equals(arg.type)) { m = MATCH.exact; } else { m = arg.implicitConvTo(tret); if (m == MATCH.nomatch) { if (tret.toBasetype().ty == Tvoid) m = MATCH.convert; } } } else { uint wm = 0; m = deduceType(arg, paramscope, ta.next, parameters, dedtypes, &wm, inferStart); wildmatch |= wm; } if (m == MATCH.nomatch) goto Lnomatch; if (m < match) match = m; } goto Lmatch; } case Tclass: case Tident: goto Lmatch; default: goto Lnomatch; } assert(0); } //printf(". argi = %d, nfargs = %d, nfargs2 = %d\n", argi, nfargs, nfargs2); if (argi != nfargs2 && fparameters.varargs == VarArg.none) goto Lnomatch; } Lmatch: for (size_t i = 0; i < dedtypes.dim; i++) { Type at = isType((*dedtypes)[i]); if (at) { if (at.ty == Tnone) { TypeDeduced xt = cast(TypeDeduced)at; at = xt.tded; // 'unbox' } (*dedtypes)[i] = at.merge2(); } } for (size_t i = ntargs; i < dedargs.dim; i++) { TemplateParameter tparam = (*parameters)[i]; //printf("tparam[%d] = %s\n", i, tparam.ident.toChars()); /* For T:T*, the dedargs is the T*, dedtypes is the T * But for function templates, we really need them to match */ RootObject oarg = (*dedargs)[i]; RootObject oded = (*dedtypes)[i]; //printf("1dedargs[%d] = %p, dedtypes[%d] = %p\n", i, oarg, i, oded); //if (oarg) printf("oarg: %s\n", oarg.toChars()); //if (oded) printf("oded: %s\n", oded.toChars()); if (!oarg) { if (oded) { if (tparam.specialization() || !tparam.isTemplateTypeParameter()) { /* The specialization can work as long as afterwards * the oded == oarg */ (*dedargs)[i] = oded; MATCH m2 = tparam.matchArg(instLoc, paramscope, dedargs, i, parameters, dedtypes, null); //printf("m2 = %d\n", m2); if (m2 <= MATCH.nomatch) goto Lnomatch; if (m2 < matchTiargs) matchTiargs = m2; // pick worst match if (!(*dedtypes)[i].equals(oded)) error("specialization not allowed for deduced parameter `%s`", tparam.ident.toChars()); } else { // Discussion: https://issues.dlang.org/show_bug.cgi?id=16484 if (MATCH.convert < matchTiargs) matchTiargs = MATCH.convert; } } else { inuse++; oded = tparam.defaultArg(instLoc, paramscope); inuse--; if (!oded) { // if tuple parameter and // tuple parameter was not in function parameter list and // we're one or more arguments short (i.e. no tuple argument) if (tparam == tp && fptupindex == IDX_NOTFOUND && ntargs <= dedargs.dim - 1) { // make tuple argument an empty tuple oded = new Tuple(); } else goto Lnomatch; } if (isError(oded)) goto Lerror; ntargs++; /* At the template parameter T, the picked default template argument * X!int should be matched to T in order to deduce dependent * template parameter A. * auto foo(T : X!A = X!int, A...)() { ... } * foo(); // T <-- X!int, A <-- (int) */ if (tparam.specialization()) { (*dedargs)[i] = oded; MATCH m2 = tparam.matchArg(instLoc, paramscope, dedargs, i, parameters, dedtypes, null); //printf("m2 = %d\n", m2); if (m2 <= MATCH.nomatch) goto Lnomatch; if (m2 < matchTiargs) matchTiargs = m2; // pick worst match if (!(*dedtypes)[i].equals(oded)) error("specialization not allowed for deduced parameter `%s`", tparam.ident.toChars()); } } oded = declareParameter(paramscope, tparam, oded); (*dedargs)[i] = oded; } } /* https://issues.dlang.org/show_bug.cgi?id=7469 * As same as the code for 7469 in findBestMatch, * expand a Tuple in dedargs to normalize template arguments. */ if (auto d = dedargs.dim) { if (auto va = isTuple((*dedargs)[d - 1])) { dedargs.setDim(d - 1); dedargs.insert(d - 1, &va.objects); } } ti.tiargs = dedargs; // update to the normalized template arguments. // Partially instantiate function for constraint and fd.leastAsSpecialized() { assert(paramscope.scopesym); Scope* sc2 = _scope; sc2 = sc2.push(paramscope.scopesym); sc2 = sc2.push(ti); sc2.parent = ti; sc2.tinst = ti; sc2.minst = sc.minst; fd = doHeaderInstantiation(ti, sc2, fd, tthis, fargs); sc2 = sc2.pop(); sc2 = sc2.pop(); if (!fd) goto Lnomatch; } if (constraint) { if (!evaluateConstraint(ti, sc, paramscope, dedargs, fd)) goto Lnomatch; } version (none) { for (size_t i = 0; i < dedargs.dim; i++) { RootObject o = (*dedargs)[i]; printf("\tdedargs[%d] = %d, %s\n", i, o.dyncast(), o.toChars()); } } paramscope.pop(); //printf("\tmatch %d\n", match); return cast(MATCH)(match | (matchTiargs << 4)); Lnomatch: paramscope.pop(); //printf("\tnomatch\n"); return MATCH.nomatch; Lerror: // todo: for the future improvement paramscope.pop(); //printf("\terror\n"); return MATCH.nomatch; } /************************************************** * Declare template parameter tp with value o, and install it in the scope sc. */ RootObject declareParameter(Scope* sc, TemplateParameter tp, RootObject o) { //printf("TemplateDeclaration.declareParameter('%s', o = %p)\n", tp.ident.toChars(), o); Type ta = isType(o); Expression ea = isExpression(o); Dsymbol sa = isDsymbol(o); Tuple va = isTuple(o); Declaration d; VarDeclaration v = null; if (ea && ea.op == TOK.type) ta = ea.type; else if (ea && ea.op == TOK.scope_) sa = (cast(ScopeExp)ea).sds; else if (ea && (ea.op == TOK.this_ || ea.op == TOK.super_)) sa = (cast(ThisExp)ea).var; else if (ea && ea.op == TOK.function_) { if ((cast(FuncExp)ea).td) sa = (cast(FuncExp)ea).td; else sa = (cast(FuncExp)ea).fd; } if (ta) { //printf("type %s\n", ta.toChars()); d = new AliasDeclaration(Loc.initial, tp.ident, ta); } else if (sa) { //printf("Alias %s %s;\n", sa.ident.toChars(), tp.ident.toChars()); d = new AliasDeclaration(Loc.initial, tp.ident, sa); } else if (ea) { // tdtypes.data[i] always matches ea here Initializer _init = new ExpInitializer(loc, ea); TemplateValueParameter tvp = tp.isTemplateValueParameter(); Type t = tvp ? tvp.valType : null; v = new VarDeclaration(loc, t, tp.ident, _init); v.storage_class = STC.manifest | STC.templateparameter; d = v; } else if (va) { //printf("\ttuple\n"); d = new TupleDeclaration(loc, tp.ident, &va.objects); } else { assert(0); } d.storage_class |= STC.templateparameter; if (ta) { Type t = ta; // consistent with Type.checkDeprecated() while (t.ty != Tenum) { if (!t.nextOf()) break; t = (cast(TypeNext)t).next; } if (Dsymbol s = t.toDsymbol(sc)) { if (s.isDeprecated()) d.storage_class |= STC.deprecated_; } } else if (sa) { if (sa.isDeprecated()) d.storage_class |= STC.deprecated_; } if (!sc.insert(d)) error("declaration `%s` is already defined", tp.ident.toChars()); d.dsymbolSemantic(sc); /* So the caller's o gets updated with the result of semantic() being run on o */ if (v) o = v._init.initializerToExpression(); return o; } /************************************************* * Limited function template instantiation for using fd.leastAsSpecialized() */ extern (D) FuncDeclaration doHeaderInstantiation(TemplateInstance ti, Scope* sc2, FuncDeclaration fd, Type tthis, Expressions* fargs) { assert(fd); version (none) { printf("doHeaderInstantiation this = %s\n", toChars()); } // function body and contracts are not need if (fd.isCtorDeclaration()) fd = new CtorDeclaration(fd.loc, fd.endloc, fd.storage_class, fd.type.syntaxCopy()); else fd = new FuncDeclaration(fd.loc, fd.endloc, fd.ident, fd.storage_class, fd.type.syntaxCopy()); fd.parent = ti; assert(fd.type.ty == Tfunction); TypeFunction tf = cast(TypeFunction)fd.type; tf.fargs = fargs; if (tthis) { // Match 'tthis' to any TemplateThisParameter's bool hasttp = false; for (size_t i = 0; i < parameters.dim; i++) { TemplateParameter tp = (*parameters)[i]; TemplateThisParameter ttp = tp.isTemplateThisParameter(); if (ttp) hasttp = true; } if (hasttp) { tf = cast(TypeFunction)tf.addSTC(ModToStc(tthis.mod)); assert(!tf.deco); } } Scope* scx = sc2.push(); // Shouldn't run semantic on default arguments and return type. for (size_t i = 0; i < tf.parameterList.parameters.dim; i++) (*tf.parameterList.parameters)[i].defaultArg = null; if (fd.isCtorDeclaration()) { // For constructors, emitting return type is necessary for // isReturnIsolated() in functionResolve. scx.flags |= SCOPE.ctor; Dsymbol parent = toParent2(); Type tret; AggregateDeclaration ad = parent.isAggregateDeclaration(); if (!ad || parent.isUnionDeclaration()) { tret = Type.tvoid; } else { tret = ad.handleType(); assert(tret); tret = tret.addStorageClass(fd.storage_class | scx.stc); tret = tret.addMod(tf.mod); } tf.next = tret; if (ad && ad.isStructDeclaration()) tf.isref = 1; //printf("tf = %s\n", tf.toChars()); } else tf.next = null; fd.type = tf; fd.type = fd.type.addSTC(scx.stc); fd.type = fd.type.typeSemantic(fd.loc, scx); scx = scx.pop(); if (fd.type.ty != Tfunction) return null; fd.originalType = fd.type; // for mangling //printf("\t[%s] fd.type = %s, mod = %x, ", loc.toChars(), fd.type.toChars(), fd.type.mod); //printf("fd.needThis() = %d\n", fd.needThis()); return fd; } debug (FindExistingInstance) { __gshared uint nFound, nNotFound, nAdded, nRemoved; shared static ~this() { printf("debug (FindExistingInstance) nFound %u, nNotFound: %u, nAdded: %u, nRemoved: %u\n", nFound, nNotFound, nAdded, nRemoved); } } /**************************************************** * Given a new instance tithis of this TemplateDeclaration, * see if there already exists an instance. * If so, return that existing instance. */ extern (D) TemplateInstance findExistingInstance(TemplateInstance tithis, Expressions* fargs) { //printf("findExistingInstance(%p)\n", tithis); tithis.fargs = fargs; auto tibox = TemplateInstanceBox(tithis); auto p = tibox in instances; debug (FindExistingInstance) ++(p ? nFound : nNotFound); //if (p) printf("\tfound %p\n", *p); else printf("\tnot found\n"); return p ? *p : null; } /******************************************** * Add instance ti to TemplateDeclaration's table of instances. * Return a handle we can use to later remove it if it fails instantiation. */ extern (D) TemplateInstance addInstance(TemplateInstance ti) { //printf("addInstance() %p %p\n", instances, ti); auto tibox = TemplateInstanceBox(ti); instances[tibox] = ti; debug (FindExistingInstance) ++nAdded; return ti; } /******************************************* * Remove TemplateInstance from table of instances. * Input: * handle returned by addInstance() */ extern (D) void removeInstance(TemplateInstance ti) { //printf("removeInstance()\n"); auto tibox = TemplateInstanceBox(ti); debug (FindExistingInstance) ++nRemoved; instances.remove(tibox); } override inout(TemplateDeclaration) isTemplateDeclaration() inout { return this; } /** * Check if the last template parameter is a tuple one, * and returns it if so, else returns `null`. * * Returns: * The last template parameter if it's a `TemplateTupleParameter` */ TemplateTupleParameter isVariadic() { size_t dim = parameters.dim; if (dim == 0) return null; return (*parameters)[dim - 1].isTemplateTupleParameter(); } /*********************************** * We can overload templates. */ override bool isOverloadable() { return true; } override void accept(Visitor v) { v.visit(this); } } extern (C++) final class TypeDeduced : Type { Type tded; Expressions argexps; // corresponding expressions Types tparams; // tparams[i].mod extern (D) this(Type tt, Expression e, Type tparam) { super(Tnone); tded = tt; argexps.push(e); tparams.push(tparam); } void update(Expression e, Type tparam) { argexps.push(e); tparams.push(tparam); } void update(Type tt, Expression e, Type tparam) { tded = tt; argexps.push(e); tparams.push(tparam); } MATCH matchAll(Type tt) { MATCH match = MATCH.exact; for (size_t j = 0; j < argexps.dim; j++) { Expression e = argexps[j]; assert(e); if (e == emptyArrayElement) continue; Type t = tt.addMod(tparams[j].mod).substWildTo(MODFlags.const_); MATCH m = e.implicitConvTo(t); if (match > m) match = m; if (match <= MATCH.nomatch) break; } return match; } } /************************************************* * Given function arguments, figure out which template function * to expand, and return matching result. * Params: * m = matching result * dstart = the root of overloaded function templates * loc = instantiation location * sc = instantiation scope * tiargs = initial list of template arguments * tthis = if !NULL, the 'this' pointer argument * fargs = arguments to function * pMessage = address to store error message, or null */ void functionResolve(Match* m, Dsymbol dstart, Loc loc, Scope* sc, Objects* tiargs, Type tthis, Expressions* fargs, const(char)** pMessage = null) { version (none) { printf("functionResolve() dstart = %s\n", dstart.toChars()); printf(" tiargs:\n"); if (tiargs) { for (size_t i = 0; i < tiargs.dim; i++) { RootObject arg = (*tiargs)[i]; printf("\t%s\n", arg.toChars()); } } printf(" fargs:\n"); for (size_t i = 0; i < (fargs ? fargs.dim : 0); i++) { Expression arg = (*fargs)[i]; printf("\t%s %s\n", arg.type.toChars(), arg.toChars()); //printf("\tty = %d\n", arg.type.ty); } //printf("stc = %llx\n", dstart.scope.stc); //printf("match:t/f = %d/%d\n", ta_last, m.last); } // results int property = 0; // 0: uninitialized // 1: seen @property // 2: not @property size_t ov_index = 0; TemplateDeclaration td_best; TemplateInstance ti_best; MATCH ta_last = m.last != MATCH.nomatch ? MATCH.exact : MATCH.nomatch; Type tthis_best; int applyFunction(FuncDeclaration fd) { // skip duplicates if (fd == m.lastf) return 0; // explicitly specified tiargs never match to non template function if (tiargs && tiargs.dim > 0) return 0; // constructors need a valid scope in order to detect semantic errors if (!fd.isCtorDeclaration && fd.semanticRun < PASS.semanticdone) { Ungag ungag = fd.ungagSpeculative(); fd.dsymbolSemantic(null); } if (fd.semanticRun < PASS.semanticdone) { .error(loc, "forward reference to template `%s`", fd.toChars()); return 1; } //printf("fd = %s %s, fargs = %s\n", fd.toChars(), fd.type.toChars(), fargs.toChars()); m.anyf = fd; auto tf = cast(TypeFunction)fd.type; int prop = tf.isproperty ? 1 : 2; if (property == 0) property = prop; else if (property != prop) error(fd.loc, "cannot overload both property and non-property functions"); /* For constructors, qualifier check will be opposite direction. * Qualified constructor always makes qualified object, then will be checked * that it is implicitly convertible to tthis. */ Type tthis_fd = fd.needThis() ? tthis : null; bool isCtorCall = tthis_fd && fd.isCtorDeclaration(); if (isCtorCall) { //printf("%s tf.mod = x%x tthis_fd.mod = x%x %d\n", tf.toChars(), // tf.mod, tthis_fd.mod, fd.isReturnIsolated()); if (MODimplicitConv(tf.mod, tthis_fd.mod) || tf.isWild() && tf.isShared() == tthis_fd.isShared() || fd.isReturnIsolated()) { /* && tf.isShared() == tthis_fd.isShared()*/ // Uniquely constructed object can ignore shared qualifier. // TODO: Is this appropriate? tthis_fd = null; } else return 0; // MATCH.nomatch } /* Fix Issue 17970: If a struct is declared as shared the dtor is automatically considered to be shared, but when the struct is instantiated the instance is no longer considered to be shared when the function call matching is done. The fix makes it so that if a struct declaration is shared, when the destructor is called, the instantiated struct is also considered shared. */ if (auto dt = fd.isDtorDeclaration()) { auto dtmod = dt.type.toTypeFunction(); auto shared_dtor = dtmod.mod & MODFlags.shared_; auto shared_this = tthis_fd !is null ? tthis_fd.mod & MODFlags.shared_ : 0; if (shared_dtor && !shared_this) tthis_fd = dtmod; else if (shared_this && !shared_dtor && tthis_fd !is null) tf.mod = tthis_fd.mod; } MATCH mfa = tf.callMatch(tthis_fd, fargs, 0, pMessage); //printf("test1: mfa = %d\n", mfa); if (mfa > MATCH.nomatch) { if (mfa > m.last) goto LfIsBetter; if (mfa < m.last) goto LlastIsBetter; /* See if one of the matches overrides the other. */ assert(m.lastf); if (m.lastf.overrides(fd)) goto LlastIsBetter; if (fd.overrides(m.lastf)) goto LfIsBetter; /* Try to disambiguate using template-style partial ordering rules. * In essence, if f() and g() are ambiguous, if f() can call g(), * but g() cannot call f(), then pick f(). * This is because f() is "more specialized." */ { MATCH c1 = fd.leastAsSpecialized(m.lastf); MATCH c2 = m.lastf.leastAsSpecialized(fd); //printf("c1 = %d, c2 = %d\n", c1, c2); if (c1 > c2) goto LfIsBetter; if (c1 < c2) goto LlastIsBetter; } /* The 'overrides' check above does covariant checking only * for virtual member functions. It should do it for all functions, * but in order to not risk breaking code we put it after * the 'leastAsSpecialized' check. * In the future try moving it before. * I.e. a not-the-same-but-covariant match is preferred, * as it is more restrictive. */ if (!m.lastf.type.equals(fd.type)) { //printf("cov: %d %d\n", m.lastf.type.covariant(fd.type), fd.type.covariant(m.lastf.type)); if (m.lastf.type.covariant(fd.type) == 1) goto LlastIsBetter; if (fd.type.covariant(m.lastf.type) == 1) goto LfIsBetter; } /* If the two functions are the same function, like: * int foo(int); * int foo(int x) { ... } * then pick the one with the body. */ if (tf.equals(m.lastf.type) && fd.storage_class == m.lastf.storage_class && fd.parent == m.lastf.parent && fd.protection == m.lastf.protection && fd.linkage == m.lastf.linkage) { if (fd.fbody && !m.lastf.fbody) goto LfIsBetter; if (!fd.fbody && m.lastf.fbody) goto LlastIsBetter; } // https://issues.dlang.org/show_bug.cgi?id=14450 // Prefer exact qualified constructor for the creating object type if (isCtorCall && tf.mod != m.lastf.type.mod) { if (tthis.mod == tf.mod) goto LfIsBetter; if (tthis.mod == m.lastf.type.mod) goto LlastIsBetter; } m.nextf = fd; m.count++; return 0; LlastIsBetter: return 0; LfIsBetter: td_best = null; ti_best = null; ta_last = MATCH.exact; m.last = mfa; m.lastf = fd; tthis_best = tthis_fd; ov_index = 0; m.count = 1; return 0; } return 0; } int applyTemplate(TemplateDeclaration td) { //printf("applyTemplate()\n"); if (td.inuse) { td.error(loc, "recursive template expansion"); return 1; } if (td == td_best) // skip duplicates return 0; if (!sc) sc = td._scope; // workaround for Type.aliasthisOf if (td.semanticRun == PASS.init && td._scope) { // Try to fix forward reference. Ungag errors while doing so. Ungag ungag = td.ungagSpeculative(); td.dsymbolSemantic(td._scope); } if (td.semanticRun == PASS.init) { .error(loc, "forward reference to template `%s`", td.toChars()); Lerror: m.lastf = null; m.count = 0; m.last = MATCH.nomatch; return 1; } //printf("td = %s\n", td.toChars()); auto f = td.onemember ? td.onemember.isFuncDeclaration() : null; if (!f) { if (!tiargs) tiargs = new Objects(); auto ti = new TemplateInstance(loc, td, tiargs); Objects dedtypes = Objects(td.parameters.dim); assert(td.semanticRun != PASS.init); MATCH mta = td.matchWithInstance(sc, ti, &dedtypes, fargs, 0); //printf("matchWithInstance = %d\n", mta); if (mta <= MATCH.nomatch || mta < ta_last) // no match or less match return 0; ti.templateInstanceSemantic(sc, fargs); if (!ti.inst) // if template failed to expand return 0; Dsymbol s = ti.inst.toAlias(); FuncDeclaration fd; if (auto tdx = s.isTemplateDeclaration()) { Objects dedtypesX; // empty tiargs // https://issues.dlang.org/show_bug.cgi?id=11553 // Check for recursive instantiation of tdx. for (TemplatePrevious* p = tdx.previous; p; p = p.prev) { if (arrayObjectMatch(p.dedargs, &dedtypesX)) { //printf("recursive, no match p.sc=%p %p %s\n", p.sc, this, this.toChars()); /* It must be a subscope of p.sc, other scope chains are not recursive * instantiations. */ for (Scope* scx = sc; scx; scx = scx.enclosing) { if (scx == p.sc) { error(loc, "recursive template expansion while looking for `%s.%s`", ti.toChars(), tdx.toChars()); goto Lerror; } } } /* BUG: should also check for ref param differences */ } TemplatePrevious pr; pr.prev = tdx.previous; pr.sc = sc; pr.dedargs = &dedtypesX; tdx.previous = &pr; // add this to threaded list fd = resolveFuncCall(loc, sc, s, null, tthis, fargs, FuncResolveFlag.quiet); tdx.previous = pr.prev; // unlink from threaded list } else if (s.isFuncDeclaration()) { fd = resolveFuncCall(loc, sc, s, null, tthis, fargs, FuncResolveFlag.quiet); } else goto Lerror; if (!fd) return 0; if (fd.type.ty != Tfunction) { m.lastf = fd; // to propagate "error match" m.count = 1; m.last = MATCH.nomatch; return 1; } Type tthis_fd = fd.needThis() && !fd.isCtorDeclaration() ? tthis : null; auto tf = cast(TypeFunction)fd.type; MATCH mfa = tf.callMatch(tthis_fd, fargs); if (mfa < m.last) return 0; if (mta < ta_last) goto Ltd_best2; if (mta > ta_last) goto Ltd2; if (mfa < m.last) goto Ltd_best2; if (mfa > m.last) goto Ltd2; Lambig2: // td_best and td are ambiguous //printf("Lambig2\n"); m.nextf = fd; m.count++; return 0; Ltd_best2: return 0; Ltd2: // td is the new best match assert(td._scope); td_best = td; ti_best = null; property = 0; // (backward compatibility) ta_last = mta; m.last = mfa; m.lastf = fd; tthis_best = tthis_fd; ov_index = 0; m.nextf = null; m.count = 1; return 0; } //printf("td = %s\n", td.toChars()); for (size_t ovi = 0; f; f = f.overnext0, ovi++) { if (f.type.ty != Tfunction || f.errors) goto Lerror; /* This is a 'dummy' instance to evaluate constraint properly. */ auto ti = new TemplateInstance(loc, td, tiargs); ti.parent = td.parent; // Maybe calculating valid 'enclosing' is unnecessary. auto fd = f; int x = td.deduceFunctionTemplateMatch(ti, sc, fd, tthis, fargs); MATCH mta = cast(MATCH)(x >> 4); MATCH mfa = cast(MATCH)(x & 0xF); //printf("match:t/f = %d/%d\n", mta, mfa); if (!fd || mfa == MATCH.nomatch) continue; Type tthis_fd = fd.needThis() ? tthis : null; bool isCtorCall = tthis_fd && fd.isCtorDeclaration(); if (isCtorCall) { // Constructor call requires additional check. auto tf = cast(TypeFunction)fd.type; assert(tf.next); if (MODimplicitConv(tf.mod, tthis_fd.mod) || tf.isWild() && tf.isShared() == tthis_fd.isShared() || fd.isReturnIsolated()) { tthis_fd = null; } else continue; // MATCH.nomatch } if (mta < ta_last) goto Ltd_best; if (mta > ta_last) goto Ltd; if (mfa < m.last) goto Ltd_best; if (mfa > m.last) goto Ltd; if (td_best) { // Disambiguate by picking the most specialized TemplateDeclaration MATCH c1 = td.leastAsSpecialized(sc, td_best, fargs); MATCH c2 = td_best.leastAsSpecialized(sc, td, fargs); //printf("1: c1 = %d, c2 = %d\n", c1, c2); if (c1 > c2) goto Ltd; if (c1 < c2) goto Ltd_best; } assert(fd && m.lastf); { // Disambiguate by tf.callMatch auto tf1 = cast(TypeFunction)fd.type; assert(tf1.ty == Tfunction); auto tf2 = cast(TypeFunction)m.lastf.type; assert(tf2.ty == Tfunction); MATCH c1 = tf1.callMatch(tthis_fd, fargs); MATCH c2 = tf2.callMatch(tthis_best, fargs); //printf("2: c1 = %d, c2 = %d\n", c1, c2); if (c1 > c2) goto Ltd; if (c1 < c2) goto Ltd_best; } { // Disambiguate by picking the most specialized FunctionDeclaration MATCH c1 = fd.leastAsSpecialized(m.lastf); MATCH c2 = m.lastf.leastAsSpecialized(fd); //printf("3: c1 = %d, c2 = %d\n", c1, c2); if (c1 > c2) goto Ltd; if (c1 < c2) goto Ltd_best; } // https://issues.dlang.org/show_bug.cgi?id=14450 // Prefer exact qualified constructor for the creating object type if (isCtorCall && fd.type.mod != m.lastf.type.mod) { if (tthis.mod == fd.type.mod) goto Ltd; if (tthis.mod == m.lastf.type.mod) goto Ltd_best; } m.nextf = fd; m.count++; continue; Ltd_best: // td_best is the best match so far //printf("Ltd_best\n"); continue; Ltd: // td is the new best match //printf("Ltd\n"); assert(td._scope); td_best = td; ti_best = ti; property = 0; // (backward compatibility) ta_last = mta; m.last = mfa; m.lastf = fd; tthis_best = tthis_fd; ov_index = ovi; m.nextf = null; m.count = 1; continue; } return 0; } auto td = dstart.isTemplateDeclaration(); if (td && td.funcroot) dstart = td.funcroot; overloadApply(dstart, (Dsymbol s) { if (s.errors) return 0; if (auto fd = s.isFuncDeclaration()) return applyFunction(fd); if (auto td = s.isTemplateDeclaration()) return applyTemplate(td); return 0; }, sc); //printf("td_best = %p, m.lastf = %p\n", td_best, m.lastf); if (td_best && ti_best && m.count == 1) { // Matches to template function assert(td_best.onemember && td_best.onemember.isFuncDeclaration()); /* The best match is td_best with arguments tdargs. * Now instantiate the template. */ assert(td_best._scope); if (!sc) sc = td_best._scope; // workaround for Type.aliasthisOf auto ti = new TemplateInstance(loc, td_best, ti_best.tiargs); ti.templateInstanceSemantic(sc, fargs); m.lastf = ti.toAlias().isFuncDeclaration(); if (!m.lastf) goto Lnomatch; if (ti.errors) { Lerror: m.count = 1; assert(m.lastf); m.last = MATCH.nomatch; return; } // look forward instantiated overload function // Dsymbol.oneMembers is alredy called in TemplateInstance.semantic. // it has filled overnext0d while (ov_index--) { m.lastf = m.lastf.overnext0; assert(m.lastf); } tthis_best = m.lastf.needThis() && !m.lastf.isCtorDeclaration() ? tthis : null; auto tf = cast(TypeFunction)m.lastf.type; if (tf.ty == Terror) goto Lerror; assert(tf.ty == Tfunction); if (!tf.callMatch(tthis_best, fargs)) goto Lnomatch; /* As https://issues.dlang.org/show_bug.cgi?id=3682 shows, * a template instance can be matched while instantiating * that same template. Thus, the function type can be incomplete. Complete it. * * https://issues.dlang.org/show_bug.cgi?id=9208 * For auto function, completion should be deferred to the end of * its semantic3. Should not complete it in here. */ if (tf.next && !m.lastf.inferRetType) { m.lastf.type = tf.typeSemantic(loc, sc); } } else if (m.lastf) { // Matches to non template function, // or found matches were ambiguous. assert(m.count >= 1); } else { Lnomatch: m.count = 0; m.lastf = null; m.last = MATCH.nomatch; } } /* ======================== Type ============================================ */ /**** * Given an identifier, figure out which TemplateParameter it is. * Return IDX_NOTFOUND if not found. */ private size_t templateIdentifierLookup(Identifier id, TemplateParameters* parameters) { for (size_t i = 0; i < parameters.dim; i++) { TemplateParameter tp = (*parameters)[i]; if (tp.ident.equals(id)) return i; } return IDX_NOTFOUND; } private size_t templateParameterLookup(Type tparam, TemplateParameters* parameters) { if (tparam.ty == Tident) { TypeIdentifier tident = cast(TypeIdentifier)tparam; //printf("\ttident = '%s'\n", tident.toChars()); return templateIdentifierLookup(tident.ident, parameters); } return IDX_NOTFOUND; } private ubyte deduceWildHelper(Type t, Type* at, Type tparam) { if ((tparam.mod & MODFlags.wild) == 0) return 0; *at = null; auto X(T, U)(T U, U T) { return (U << 4) | T; } switch (X(tparam.mod, t.mod)) { case X(MODFlags.wild, 0): case X(MODFlags.wild, MODFlags.const_): case X(MODFlags.wild, MODFlags.shared_): case X(MODFlags.wild, MODFlags.shared_ | MODFlags.const_): case X(MODFlags.wild, MODFlags.immutable_): case X(MODFlags.wildconst, 0): case X(MODFlags.wildconst, MODFlags.const_): case X(MODFlags.wildconst, MODFlags.shared_): case X(MODFlags.wildconst, MODFlags.shared_ | MODFlags.const_): case X(MODFlags.wildconst, MODFlags.immutable_): case X(MODFlags.shared_ | MODFlags.wild, MODFlags.shared_): case X(MODFlags.shared_ | MODFlags.wild, MODFlags.shared_ | MODFlags.const_): case X(MODFlags.shared_ | MODFlags.wild, MODFlags.immutable_): case X(MODFlags.shared_ | MODFlags.wildconst, MODFlags.shared_): case X(MODFlags.shared_ | MODFlags.wildconst, MODFlags.shared_ | MODFlags.const_): case X(MODFlags.shared_ | MODFlags.wildconst, MODFlags.immutable_): { ubyte wm = (t.mod & ~MODFlags.shared_); if (wm == 0) wm = MODFlags.mutable; ubyte m = (t.mod & (MODFlags.const_ | MODFlags.immutable_)) | (tparam.mod & t.mod & MODFlags.shared_); *at = t.unqualify(m); return wm; } case X(MODFlags.wild, MODFlags.wild): case X(MODFlags.wild, MODFlags.wildconst): case X(MODFlags.wild, MODFlags.shared_ | MODFlags.wild): case X(MODFlags.wild, MODFlags.shared_ | MODFlags.wildconst): case X(MODFlags.wildconst, MODFlags.wild): case X(MODFlags.wildconst, MODFlags.wildconst): case X(MODFlags.wildconst, MODFlags.shared_ | MODFlags.wild): case X(MODFlags.wildconst, MODFlags.shared_ | MODFlags.wildconst): case X(MODFlags.shared_ | MODFlags.wild, MODFlags.shared_ | MODFlags.wild): case X(MODFlags.shared_ | MODFlags.wild, MODFlags.shared_ | MODFlags.wildconst): case X(MODFlags.shared_ | MODFlags.wildconst, MODFlags.shared_ | MODFlags.wild): case X(MODFlags.shared_ | MODFlags.wildconst, MODFlags.shared_ | MODFlags.wildconst): { *at = t.unqualify(tparam.mod & t.mod); return MODFlags.wild; } default: return 0; } } /** * Returns the common type of the 2 types. */ private Type rawTypeMerge(Type t1, Type t2) { if (t1.equals(t2)) return t1; if (t1.equivalent(t2)) return t1.castMod(MODmerge(t1.mod, t2.mod)); auto t1b = t1.toBasetype(); auto t2b = t2.toBasetype(); if (t1b.equals(t2b)) return t1b; if (t1b.equivalent(t2b)) return t1b.castMod(MODmerge(t1b.mod, t2b.mod)); auto ty = cast(TY)impcnvResult[t1b.ty][t2b.ty]; if (ty != Terror) return Type.basic[ty]; return null; } private MATCH deduceTypeHelper(Type t, Type* at, Type tparam) { // 9*9 == 81 cases auto X(T, U)(T U, U T) { return (U << 4) | T; } switch (X(tparam.mod, t.mod)) { case X(0, 0): case X(0, MODFlags.const_): case X(0, MODFlags.wild): case X(0, MODFlags.wildconst): case X(0, MODFlags.shared_): case X(0, MODFlags.shared_ | MODFlags.const_): case X(0, MODFlags.shared_ | MODFlags.wild): case X(0, MODFlags.shared_ | MODFlags.wildconst): case X(0, MODFlags.immutable_): // foo(U) T => T // foo(U) const(T) => const(T) // foo(U) inout(T) => inout(T) // foo(U) inout(const(T)) => inout(const(T)) // foo(U) shared(T) => shared(T) // foo(U) shared(const(T)) => shared(const(T)) // foo(U) shared(inout(T)) => shared(inout(T)) // foo(U) shared(inout(const(T))) => shared(inout(const(T))) // foo(U) immutable(T) => immutable(T) { *at = t; return MATCH.exact; } case X(MODFlags.const_, MODFlags.const_): case X(MODFlags.wild, MODFlags.wild): case X(MODFlags.wildconst, MODFlags.wildconst): case X(MODFlags.shared_, MODFlags.shared_): case X(MODFlags.shared_ | MODFlags.const_, MODFlags.shared_ | MODFlags.const_): case X(MODFlags.shared_ | MODFlags.wild, MODFlags.shared_ | MODFlags.wild): case X(MODFlags.shared_ | MODFlags.wildconst, MODFlags.shared_ | MODFlags.wildconst): case X(MODFlags.immutable_, MODFlags.immutable_): // foo(const(U)) const(T) => T // foo(inout(U)) inout(T) => T // foo(inout(const(U))) inout(const(T)) => T // foo(shared(U)) shared(T) => T // foo(shared(const(U))) shared(const(T)) => T // foo(shared(inout(U))) shared(inout(T)) => T // foo(shared(inout(const(U)))) shared(inout(const(T))) => T // foo(immutable(U)) immutable(T) => T { *at = t.mutableOf().unSharedOf(); return MATCH.exact; } case X(MODFlags.const_, 0): case X(MODFlags.const_, MODFlags.wild): case X(MODFlags.const_, MODFlags.wildconst): case X(MODFlags.const_, MODFlags.shared_ | MODFlags.const_): case X(MODFlags.const_, MODFlags.shared_ | MODFlags.wild): case X(MODFlags.const_, MODFlags.shared_ | MODFlags.wildconst): case X(MODFlags.const_, MODFlags.immutable_): case X(MODFlags.wild, MODFlags.shared_ | MODFlags.wild): case X(MODFlags.wildconst, MODFlags.shared_ | MODFlags.wildconst): case X(MODFlags.shared_ | MODFlags.const_, MODFlags.immutable_): // foo(const(U)) T => T // foo(const(U)) inout(T) => T // foo(const(U)) inout(const(T)) => T // foo(const(U)) shared(const(T)) => shared(T) // foo(const(U)) shared(inout(T)) => shared(T) // foo(const(U)) shared(inout(const(T))) => shared(T) // foo(const(U)) immutable(T) => T // foo(inout(U)) shared(inout(T)) => shared(T) // foo(inout(const(U))) shared(inout(const(T))) => shared(T) // foo(shared(const(U))) immutable(T) => T { *at = t.mutableOf(); return MATCH.constant; } case X(MODFlags.const_, MODFlags.shared_): // foo(const(U)) shared(T) => shared(T) { *at = t; return MATCH.constant; } case X(MODFlags.shared_, MODFlags.shared_ | MODFlags.const_): case X(MODFlags.shared_, MODFlags.shared_ | MODFlags.wild): case X(MODFlags.shared_, MODFlags.shared_ | MODFlags.wildconst): case X(MODFlags.shared_ | MODFlags.const_, MODFlags.shared_): // foo(shared(U)) shared(const(T)) => const(T) // foo(shared(U)) shared(inout(T)) => inout(T) // foo(shared(U)) shared(inout(const(T))) => inout(const(T)) // foo(shared(const(U))) shared(T) => T { *at = t.unSharedOf(); return MATCH.constant; } case X(MODFlags.wildconst, MODFlags.immutable_): case X(MODFlags.shared_ | MODFlags.const_, MODFlags.shared_ | MODFlags.wildconst): case X(MODFlags.shared_ | MODFlags.wildconst, MODFlags.immutable_): case X(MODFlags.shared_ | MODFlags.wildconst, MODFlags.shared_ | MODFlags.wild): // foo(inout(const(U))) immutable(T) => T // foo(shared(const(U))) shared(inout(const(T))) => T // foo(shared(inout(const(U)))) immutable(T) => T // foo(shared(inout(const(U)))) shared(inout(T)) => T { *at = t.unSharedOf().mutableOf(); return MATCH.constant; } case X(MODFlags.shared_ | MODFlags.const_, MODFlags.shared_ | MODFlags.wild): // foo(shared(const(U))) shared(inout(T)) => T { *at = t.unSharedOf().mutableOf(); return MATCH.constant; } case X(MODFlags.wild, 0): case X(MODFlags.wild, MODFlags.const_): case X(MODFlags.wild, MODFlags.wildconst): case X(MODFlags.wild, MODFlags.immutable_): case X(MODFlags.wild, MODFlags.shared_): case X(MODFlags.wild, MODFlags.shared_ | MODFlags.const_): case X(MODFlags.wild, MODFlags.shared_ | MODFlags.wildconst): case X(MODFlags.wildconst, 0): case X(MODFlags.wildconst, MODFlags.const_): case X(MODFlags.wildconst, MODFlags.wild): case X(MODFlags.wildconst, MODFlags.shared_): case X(MODFlags.wildconst, MODFlags.shared_ | MODFlags.const_): case X(MODFlags.wildconst, MODFlags.shared_ | MODFlags.wild): case X(MODFlags.shared_, 0): case X(MODFlags.shared_, MODFlags.const_): case X(MODFlags.shared_, MODFlags.wild): case X(MODFlags.shared_, MODFlags.wildconst): case X(MODFlags.shared_, MODFlags.immutable_): case X(MODFlags.shared_ | MODFlags.const_, 0): case X(MODFlags.shared_ | MODFlags.const_, MODFlags.const_): case X(MODFlags.shared_ | MODFlags.const_, MODFlags.wild): case X(MODFlags.shared_ | MODFlags.const_, MODFlags.wildconst): case X(MODFlags.shared_ | MODFlags.wild, 0): case X(MODFlags.shared_ | MODFlags.wild, MODFlags.const_): case X(MODFlags.shared_ | MODFlags.wild, MODFlags.wild): case X(MODFlags.shared_ | MODFlags.wild, MODFlags.wildconst): case X(MODFlags.shared_ | MODFlags.wild, MODFlags.immutable_): case X(MODFlags.shared_ | MODFlags.wild, MODFlags.shared_): case X(MODFlags.shared_ | MODFlags.wild, MODFlags.shared_ | MODFlags.const_): case X(MODFlags.shared_ | MODFlags.wild, MODFlags.shared_ | MODFlags.wildconst): case X(MODFlags.shared_ | MODFlags.wildconst, 0): case X(MODFlags.shared_ | MODFlags.wildconst, MODFlags.const_): case X(MODFlags.shared_ | MODFlags.wildconst, MODFlags.wild): case X(MODFlags.shared_ | MODFlags.wildconst, MODFlags.wildconst): case X(MODFlags.shared_ | MODFlags.wildconst, MODFlags.shared_): case X(MODFlags.shared_ | MODFlags.wildconst, MODFlags.shared_ | MODFlags.const_): case X(MODFlags.immutable_, 0): case X(MODFlags.immutable_, MODFlags.const_): case X(MODFlags.immutable_, MODFlags.wild): case X(MODFlags.immutable_, MODFlags.wildconst): case X(MODFlags.immutable_, MODFlags.shared_): case X(MODFlags.immutable_, MODFlags.shared_ | MODFlags.const_): case X(MODFlags.immutable_, MODFlags.shared_ | MODFlags.wild): case X(MODFlags.immutable_, MODFlags.shared_ | MODFlags.wildconst): // foo(inout(U)) T => nomatch // foo(inout(U)) const(T) => nomatch // foo(inout(U)) inout(const(T)) => nomatch // foo(inout(U)) immutable(T) => nomatch // foo(inout(U)) shared(T) => nomatch // foo(inout(U)) shared(const(T)) => nomatch // foo(inout(U)) shared(inout(const(T))) => nomatch // foo(inout(const(U))) T => nomatch // foo(inout(const(U))) const(T) => nomatch // foo(inout(const(U))) inout(T) => nomatch // foo(inout(const(U))) shared(T) => nomatch // foo(inout(const(U))) shared(const(T)) => nomatch // foo(inout(const(U))) shared(inout(T)) => nomatch // foo(shared(U)) T => nomatch // foo(shared(U)) const(T) => nomatch // foo(shared(U)) inout(T) => nomatch // foo(shared(U)) inout(const(T)) => nomatch // foo(shared(U)) immutable(T) => nomatch // foo(shared(const(U))) T => nomatch // foo(shared(const(U))) const(T) => nomatch // foo(shared(const(U))) inout(T) => nomatch // foo(shared(const(U))) inout(const(T)) => nomatch // foo(shared(inout(U))) T => nomatch // foo(shared(inout(U))) const(T) => nomatch // foo(shared(inout(U))) inout(T) => nomatch // foo(shared(inout(U))) inout(const(T)) => nomatch // foo(shared(inout(U))) immutable(T) => nomatch // foo(shared(inout(U))) shared(T) => nomatch // foo(shared(inout(U))) shared(const(T)) => nomatch // foo(shared(inout(U))) shared(inout(const(T))) => nomatch // foo(shared(inout(const(U)))) T => nomatch // foo(shared(inout(const(U)))) const(T) => nomatch // foo(shared(inout(const(U)))) inout(T) => nomatch // foo(shared(inout(const(U)))) inout(const(T)) => nomatch // foo(shared(inout(const(U)))) shared(T) => nomatch // foo(shared(inout(const(U)))) shared(const(T)) => nomatch // foo(immutable(U)) T => nomatch // foo(immutable(U)) const(T) => nomatch // foo(immutable(U)) inout(T) => nomatch // foo(immutable(U)) inout(const(T)) => nomatch // foo(immutable(U)) shared(T) => nomatch // foo(immutable(U)) shared(const(T)) => nomatch // foo(immutable(U)) shared(inout(T)) => nomatch // foo(immutable(U)) shared(inout(const(T))) => nomatch return MATCH.nomatch; default: assert(0); } } __gshared Expression emptyArrayElement = null; /* These form the heart of template argument deduction. * Given 'this' being the type argument to the template instance, * it is matched against the template declaration parameter specialization * 'tparam' to determine the type to be used for the parameter. * Example: * template Foo(T:T*) // template declaration * Foo!(int*) // template instantiation * Input: * this = int* * tparam = T* * parameters = [ T:T* ] // Array of TemplateParameter's * Output: * dedtypes = [ int ] // Array of Expression/Type's */ MATCH deduceType(RootObject o, Scope* sc, Type tparam, TemplateParameters* parameters, Objects* dedtypes, uint* wm = null, size_t inferStart = 0, bool ignoreAliasThis = false) { extern (C++) final class DeduceType : Visitor { alias visit = Visitor.visit; public: Scope* sc; Type tparam; TemplateParameters* parameters; Objects* dedtypes; uint* wm; size_t inferStart; bool ignoreAliasThis; MATCH result; extern (D) this(Scope* sc, Type tparam, TemplateParameters* parameters, Objects* dedtypes, uint* wm, size_t inferStart, bool ignoreAliasThis) { this.sc = sc; this.tparam = tparam; this.parameters = parameters; this.dedtypes = dedtypes; this.wm = wm; this.inferStart = inferStart; this.ignoreAliasThis = ignoreAliasThis; result = MATCH.nomatch; } override void visit(Type t) { if (!tparam) goto Lnomatch; if (t == tparam) goto Lexact; if (tparam.ty == Tident) { // Determine which parameter tparam is size_t i = templateParameterLookup(tparam, parameters); if (i == IDX_NOTFOUND) { if (!sc) goto Lnomatch; /* Need a loc to go with the semantic routine. */ Loc loc; if (parameters.dim) { TemplateParameter tp = (*parameters)[0]; loc = tp.loc; } /* BUG: what if tparam is a template instance, that * has as an argument another Tident? */ tparam = tparam.typeSemantic(loc, sc); assert(tparam.ty != Tident); result = deduceType(t, sc, tparam, parameters, dedtypes, wm); return; } TemplateParameter tp = (*parameters)[i]; TypeIdentifier tident = cast(TypeIdentifier)tparam; if (tident.idents.dim > 0) { //printf("matching %s to %s\n", tparam.toChars(), t.toChars()); Dsymbol s = t.toDsymbol(sc); for (size_t j = tident.idents.dim; j-- > 0;) { RootObject id = tident.idents[j]; if (id.dyncast() == DYNCAST.identifier) { if (!s || !s.parent) goto Lnomatch; Dsymbol s2 = s.parent.search(Loc.initial, cast(Identifier)id); if (!s2) goto Lnomatch; s2 = s2.toAlias(); //printf("[%d] s = %s %s, s2 = %s %s\n", j, s.kind(), s.toChars(), s2.kind(), s2.toChars()); if (s != s2) { if (Type tx = s2.getType()) { if (s != tx.toDsymbol(sc)) goto Lnomatch; } else goto Lnomatch; } s = s.parent; } else goto Lnomatch; } //printf("[e] s = %s\n", s?s.toChars():"(null)"); if (tp.isTemplateTypeParameter()) { Type tt = s.getType(); if (!tt) goto Lnomatch; Type at = cast(Type)(*dedtypes)[i]; if (at && at.ty == Tnone) at = (cast(TypeDeduced)at).tded; if (!at || tt.equals(at)) { (*dedtypes)[i] = tt; goto Lexact; } } if (tp.isTemplateAliasParameter()) { Dsymbol s2 = cast(Dsymbol)(*dedtypes)[i]; if (!s2 || s == s2) { (*dedtypes)[i] = s; goto Lexact; } } goto Lnomatch; } // Found the corresponding parameter tp if (!tp.isTemplateTypeParameter()) goto Lnomatch; Type at = cast(Type)(*dedtypes)[i]; Type tt; if (ubyte wx = wm ? deduceWildHelper(t, &tt, tparam) : 0) { // type vs (none) if (!at) { (*dedtypes)[i] = tt; *wm |= wx; result = MATCH.constant; return; } // type vs expressions if (at.ty == Tnone) { TypeDeduced xt = cast(TypeDeduced)at; result = xt.matchAll(tt); if (result > MATCH.nomatch) { (*dedtypes)[i] = tt; if (result > MATCH.constant) result = MATCH.constant; // limit level for inout matches } return; } // type vs type if (tt.equals(at)) { (*dedtypes)[i] = tt; // Prefer current type match goto Lconst; } if (tt.implicitConvTo(at.constOf())) { (*dedtypes)[i] = at.constOf().mutableOf(); *wm |= MODFlags.const_; goto Lconst; } if (at.implicitConvTo(tt.constOf())) { (*dedtypes)[i] = tt.constOf().mutableOf(); *wm |= MODFlags.const_; goto Lconst; } goto Lnomatch; } else if (MATCH m = deduceTypeHelper(t, &tt, tparam)) { // type vs (none) if (!at) { (*dedtypes)[i] = tt; result = m; return; } // type vs expressions if (at.ty == Tnone) { TypeDeduced xt = cast(TypeDeduced)at; result = xt.matchAll(tt); if (result > MATCH.nomatch) { (*dedtypes)[i] = tt; } return; } // type vs type if (tt.equals(at)) { goto Lexact; } if (tt.ty == Tclass && at.ty == Tclass) { result = tt.implicitConvTo(at); return; } if (tt.ty == Tsarray && at.ty == Tarray && tt.nextOf().implicitConvTo(at.nextOf()) >= MATCH.constant) { goto Lexact; } } goto Lnomatch; } if (tparam.ty == Ttypeof) { /* Need a loc to go with the semantic routine. */ Loc loc; if (parameters.dim) { TemplateParameter tp = (*parameters)[0]; loc = tp.loc; } tparam = tparam.typeSemantic(loc, sc); } if (t.ty != tparam.ty) { if (Dsymbol sym = t.toDsymbol(sc)) { if (sym.isforwardRef() && !tparam.deco) goto Lnomatch; } MATCH m = t.implicitConvTo(tparam); if (m == MATCH.nomatch && !ignoreAliasThis) { if (t.ty == Tclass) { TypeClass tc = cast(TypeClass)t; if (tc.sym.aliasthis && !(tc.att & AliasThisRec.tracingDT)) { if (auto ato = t.aliasthisOf()) { tc.att = cast(AliasThisRec)(tc.att | AliasThisRec.tracingDT); m = deduceType(ato, sc, tparam, parameters, dedtypes, wm); tc.att = cast(AliasThisRec)(tc.att & ~AliasThisRec.tracingDT); } } } else if (t.ty == Tstruct) { TypeStruct ts = cast(TypeStruct)t; if (ts.sym.aliasthis && !(ts.att & AliasThisRec.tracingDT)) { if (auto ato = t.aliasthisOf()) { ts.att = cast(AliasThisRec)(ts.att | AliasThisRec.tracingDT); m = deduceType(ato, sc, tparam, parameters, dedtypes, wm); ts.att = cast(AliasThisRec)(ts.att & ~AliasThisRec.tracingDT); } } } } result = m; return; } if (t.nextOf()) { if (tparam.deco && !tparam.hasWild()) { result = t.implicitConvTo(tparam); return; } Type tpn = tparam.nextOf(); if (wm && t.ty == Taarray && tparam.isWild()) { // https://issues.dlang.org/show_bug.cgi?id=12403 // In IFTI, stop inout matching on transitive part of AA types. tpn = tpn.substWildTo(MODFlags.mutable); } result = deduceType(t.nextOf(), sc, tpn, parameters, dedtypes, wm); return; } Lexact: result = MATCH.exact; return; Lnomatch: result = MATCH.nomatch; return; Lconst: result = MATCH.constant; } override void visit(TypeVector t) { if (tparam.ty == Tvector) { TypeVector tp = cast(TypeVector)tparam; result = deduceType(t.basetype, sc, tp.basetype, parameters, dedtypes, wm); return; } visit(cast(Type)t); } override void visit(TypeDArray t) { visit(cast(Type)t); } override void visit(TypeSArray t) { // Extra check that array dimensions must match if (tparam) { if (tparam.ty == Tarray) { MATCH m = deduceType(t.next, sc, tparam.nextOf(), parameters, dedtypes, wm); result = (m >= MATCH.constant) ? MATCH.convert : MATCH.nomatch; return; } TemplateParameter tp = null; Expression edim = null; size_t i; if (tparam.ty == Tsarray) { TypeSArray tsa = cast(TypeSArray)tparam; if (tsa.dim.op == TOK.variable && (cast(VarExp)tsa.dim).var.storage_class & STC.templateparameter) { Identifier id = (cast(VarExp)tsa.dim).var.ident; i = templateIdentifierLookup(id, parameters); assert(i != IDX_NOTFOUND); tp = (*parameters)[i]; } else edim = tsa.dim; } else if (tparam.ty == Taarray) { TypeAArray taa = cast(TypeAArray)tparam; i = templateParameterLookup(taa.index, parameters); if (i != IDX_NOTFOUND) tp = (*parameters)[i]; else { Expression e; Type tx; Dsymbol s; taa.index.resolve(Loc.initial, sc, &e, &tx, &s); edim = s ? getValue(s) : getValue(e); } } if (tp && tp.matchArg(sc, t.dim, i, parameters, dedtypes, null) || edim && edim.toInteger() == t.dim.toInteger()) { result = deduceType(t.next, sc, tparam.nextOf(), parameters, dedtypes, wm); return; } } visit(cast(Type)t); } override void visit(TypeAArray t) { // Extra check that index type must match if (tparam && tparam.ty == Taarray) { TypeAArray tp = cast(TypeAArray)tparam; if (!deduceType(t.index, sc, tp.index, parameters, dedtypes)) { result = MATCH.nomatch; return; } } visit(cast(Type)t); } override void visit(TypeFunction t) { // Extra check that function characteristics must match if (tparam && tparam.ty == Tfunction) { TypeFunction tp = cast(TypeFunction)tparam; if (t.parameterList.varargs != tp.parameterList.varargs || t.linkage != tp.linkage) { result = MATCH.nomatch; return; } foreach (fparam; *tp.parameterList.parameters) { // https://issues.dlang.org/show_bug.cgi?id=2579 // Apply function parameter storage classes to parameter types fparam.type = fparam.type.addStorageClass(fparam.storageClass); fparam.storageClass &= ~(STC.TYPECTOR | STC.in_); // https://issues.dlang.org/show_bug.cgi?id=15243 // Resolve parameter type if it's not related with template parameters if (!reliesOnTemplateParameters(fparam.type, (*parameters)[inferStart .. parameters.dim])) { auto tx = fparam.type.typeSemantic(Loc.initial, sc); if (tx.ty == Terror) { result = MATCH.nomatch; return; } fparam.type = tx; } } size_t nfargs = t.parameterList.length; size_t nfparams = tp.parameterList.length; /* See if tuple match */ if (nfparams > 0 && nfargs >= nfparams - 1) { /* See if 'A' of the template parameter matches 'A' * of the type of the last function parameter. */ Parameter fparam = tp.parameterList[nfparams - 1]; assert(fparam); assert(fparam.type); if (fparam.type.ty != Tident) goto L1; TypeIdentifier tid = cast(TypeIdentifier)fparam.type; if (tid.idents.dim) goto L1; /* Look through parameters to find tuple matching tid.ident */ size_t tupi = 0; for (; 1; tupi++) { if (tupi == parameters.dim) goto L1; TemplateParameter tx = (*parameters)[tupi]; TemplateTupleParameter tup = tx.isTemplateTupleParameter(); if (tup && tup.ident.equals(tid.ident)) break; } /* The types of the function arguments [nfparams - 1 .. nfargs] * now form the tuple argument. */ size_t tuple_dim = nfargs - (nfparams - 1); /* See if existing tuple, and whether it matches or not */ RootObject o = (*dedtypes)[tupi]; if (o) { // Existing deduced argument must be a tuple, and must match Tuple tup = isTuple(o); if (!tup || tup.objects.dim != tuple_dim) { result = MATCH.nomatch; return; } for (size_t i = 0; i < tuple_dim; i++) { Parameter arg = t.parameterList[nfparams - 1 + i]; if (!arg.type.equals(tup.objects[i])) { result = MATCH.nomatch; return; } } } else { // Create new tuple auto tup = new Tuple(tuple_dim); for (size_t i = 0; i < tuple_dim; i++) { Parameter arg = t.parameterList[nfparams - 1 + i]; tup.objects[i] = arg.type; } (*dedtypes)[tupi] = tup; } nfparams--; // don't consider the last parameter for type deduction goto L2; } L1: if (nfargs != nfparams) { result = MATCH.nomatch; return; } L2: for (size_t i = 0; i < nfparams; i++) { Parameter a = t .parameterList[i]; Parameter ap = tp.parameterList[i]; if (!a.isCovariant(t.isref, ap) || !deduceType(a.type, sc, ap.type, parameters, dedtypes)) { result = MATCH.nomatch; return; } } } visit(cast(Type)t); } override void visit(TypeIdentifier t) { // Extra check if (tparam && tparam.ty == Tident) { TypeIdentifier tp = cast(TypeIdentifier)tparam; for (size_t i = 0; i < t.idents.dim; i++) { RootObject id1 = t.idents[i]; RootObject id2 = tp.idents[i]; if (!id1.equals(id2)) { result = MATCH.nomatch; return; } } } visit(cast(Type)t); } override void visit(TypeInstance t) { // Extra check if (tparam && tparam.ty == Tinstance && t.tempinst.tempdecl) { TemplateDeclaration tempdecl = t.tempinst.tempdecl.isTemplateDeclaration(); assert(tempdecl); TypeInstance tp = cast(TypeInstance)tparam; //printf("tempinst.tempdecl = %p\n", tempdecl); //printf("tp.tempinst.tempdecl = %p\n", tp.tempinst.tempdecl); if (!tp.tempinst.tempdecl) { //printf("tp.tempinst.name = '%s'\n", tp.tempinst.name.toChars()); /* Handle case of: * template Foo(T : sa!(T), alias sa) */ size_t i = templateIdentifierLookup(tp.tempinst.name, parameters); if (i == IDX_NOTFOUND) { /* Didn't find it as a parameter identifier. Try looking * it up and seeing if is an alias. * https://issues.dlang.org/show_bug.cgi?id=1454 */ auto tid = new TypeIdentifier(tp.loc, tp.tempinst.name); Type tx; Expression e; Dsymbol s; tid.resolve(tp.loc, sc, &e, &tx, &s); if (tx) { s = tx.toDsymbol(sc); if (TemplateInstance ti = s ? s.parent.isTemplateInstance() : null) { // https://issues.dlang.org/show_bug.cgi?id=14290 // Try to match with ti.tempecl, // only when ti is an enclosing instance. Dsymbol p = sc.parent; while (p && p != ti) p = p.parent; if (p) s = ti.tempdecl; } } if (s) { s = s.toAlias(); TemplateDeclaration td = s.isTemplateDeclaration(); if (td) { if (td.overroot) td = td.overroot; for (; td; td = td.overnext) { if (td == tempdecl) goto L2; } } } goto Lnomatch; } TemplateParameter tpx = (*parameters)[i]; if (!tpx.matchArg(sc, tempdecl, i, parameters, dedtypes, null)) goto Lnomatch; } else if (tempdecl != tp.tempinst.tempdecl) goto Lnomatch; L2: for (size_t i = 0; 1; i++) { //printf("\ttest: tempinst.tiargs[%d]\n", i); RootObject o1 = null; if (i < t.tempinst.tiargs.dim) o1 = (*t.tempinst.tiargs)[i]; else if (i < t.tempinst.tdtypes.dim && i < tp.tempinst.tiargs.dim) { // Pick up default arg o1 = t.tempinst.tdtypes[i]; } else if (i >= tp.tempinst.tiargs.dim) break; if (i >= tp.tempinst.tiargs.dim) { size_t dim = tempdecl.parameters.dim - (tempdecl.isVariadic() ? 1 : 0); while (i < dim && ((*tempdecl.parameters)[i].dependent || (*tempdecl.parameters)[i].hasDefaultArg())) { i++; } if (i >= dim) break; // match if all remained parameters are dependent goto Lnomatch; } RootObject o2 = (*tp.tempinst.tiargs)[i]; Type t2 = isType(o2); size_t j = (t2 && t2.ty == Tident && i == tp.tempinst.tiargs.dim - 1) ? templateParameterLookup(t2, parameters) : IDX_NOTFOUND; if (j != IDX_NOTFOUND && j == parameters.dim - 1 && (*parameters)[j].isTemplateTupleParameter()) { /* Given: * struct A(B...) {} * alias A!(int, float) X; * static if (is(X Y == A!(Z), Z...)) {} * deduce that Z is a tuple(int, float) */ /* Create tuple from remaining args */ size_t vtdim = (tempdecl.isVariadic() ? t.tempinst.tiargs.dim : t.tempinst.tdtypes.dim) - i; auto vt = new Tuple(vtdim); for (size_t k = 0; k < vtdim; k++) { RootObject o; if (k < t.tempinst.tiargs.dim) o = (*t.tempinst.tiargs)[i + k]; else // Pick up default arg o = t.tempinst.tdtypes[i + k]; vt.objects[k] = o; } Tuple v = cast(Tuple)(*dedtypes)[j]; if (v) { if (!match(v, vt)) goto Lnomatch; } else (*dedtypes)[j] = vt; break; } else if (!o1) break; Type t1 = isType(o1); Dsymbol s1 = isDsymbol(o1); Dsymbol s2 = isDsymbol(o2); Expression e1 = s1 ? getValue(s1) : getValue(isExpression(o1)); Expression e2 = isExpression(o2); version (none) { Tuple v1 = isTuple(o1); Tuple v2 = isTuple(o2); if (t1) printf("t1 = %s\n", t1.toChars()); if (t2) printf("t2 = %s\n", t2.toChars()); if (e1) printf("e1 = %s\n", e1.toChars()); if (e2) printf("e2 = %s\n", e2.toChars()); if (s1) printf("s1 = %s\n", s1.toChars()); if (s2) printf("s2 = %s\n", s2.toChars()); if (v1) printf("v1 = %s\n", v1.toChars()); if (v2) printf("v2 = %s\n", v2.toChars()); } if (t1 && t2) { if (!deduceType(t1, sc, t2, parameters, dedtypes)) goto Lnomatch; } else if (e1 && e2) { Le: e1 = e1.ctfeInterpret(); /* If it is one of the template parameters for this template, * we should not attempt to interpret it. It already has a value. */ if (e2.op == TOK.variable && ((cast(VarExp)e2).var.storage_class & STC.templateparameter)) { /* * (T:Number!(e2), int e2) */ j = templateIdentifierLookup((cast(VarExp)e2).var.ident, parameters); if (j != IDX_NOTFOUND) goto L1; // The template parameter was not from this template // (it may be from a parent template, for example) } e2 = e2.expressionSemantic(sc); // https://issues.dlang.org/show_bug.cgi?id=13417 e2 = e2.ctfeInterpret(); //printf("e1 = %s, type = %s %d\n", e1.toChars(), e1.type.toChars(), e1.type.ty); //printf("e2 = %s, type = %s %d\n", e2.toChars(), e2.type.toChars(), e2.type.ty); if (!e1.equals(e2)) { if (!e2.implicitConvTo(e1.type)) goto Lnomatch; e2 = e2.implicitCastTo(sc, e1.type); e2 = e2.ctfeInterpret(); if (!e1.equals(e2)) goto Lnomatch; } } else if (e1 && t2 && t2.ty == Tident) { j = templateParameterLookup(t2, parameters); L1: if (j == IDX_NOTFOUND) { t2.resolve((cast(TypeIdentifier)t2).loc, sc, &e2, &t2, &s2); if (e2) goto Le; goto Lnomatch; } if (!(*parameters)[j].matchArg(sc, e1, j, parameters, dedtypes, null)) goto Lnomatch; } else if (s1 && s2) { Ls: if (!s1.equals(s2)) goto Lnomatch; } else if (s1 && t2 && t2.ty == Tident) { j = templateParameterLookup(t2, parameters); if (j == IDX_NOTFOUND) { t2.resolve((cast(TypeIdentifier)t2).loc, sc, &e2, &t2, &s2); if (s2) goto Ls; goto Lnomatch; } if (!(*parameters)[j].matchArg(sc, s1, j, parameters, dedtypes, null)) goto Lnomatch; } else goto Lnomatch; } } visit(cast(Type)t); return; Lnomatch: //printf("no match\n"); result = MATCH.nomatch; } override void visit(TypeStruct t) { /* If this struct is a template struct, and we're matching * it against a template instance, convert the struct type * to a template instance, too, and try again. */ TemplateInstance ti = t.sym.parent.isTemplateInstance(); if (tparam && tparam.ty == Tinstance) { if (ti && ti.toAlias() == t.sym) { auto tx = new TypeInstance(Loc.initial, ti); result = deduceType(tx, sc, tparam, parameters, dedtypes, wm); return; } /* Match things like: * S!(T).foo */ TypeInstance tpi = cast(TypeInstance)tparam; if (tpi.idents.dim) { RootObject id = tpi.idents[tpi.idents.dim - 1]; if (id.dyncast() == DYNCAST.identifier && t.sym.ident.equals(cast(Identifier)id)) { Type tparent = t.sym.parent.getType(); if (tparent) { /* Slice off the .foo in S!(T).foo */ tpi.idents.dim--; result = deduceType(tparent, sc, tpi, parameters, dedtypes, wm); tpi.idents.dim++; return; } } } } // Extra check if (tparam && tparam.ty == Tstruct) { TypeStruct tp = cast(TypeStruct)tparam; //printf("\t%d\n", (MATCH) t.implicitConvTo(tp)); if (wm && t.deduceWild(tparam, false)) { result = MATCH.constant; return; } result = t.implicitConvTo(tp); return; } visit(cast(Type)t); } override void visit(TypeEnum t) { // Extra check if (tparam && tparam.ty == Tenum) { TypeEnum tp = cast(TypeEnum)tparam; if (t.sym == tp.sym) visit(cast(Type)t); else result = MATCH.nomatch; return; } Type tb = t.toBasetype(); if (tb.ty == tparam.ty || tb.ty == Tsarray && tparam.ty == Taarray) { result = deduceType(tb, sc, tparam, parameters, dedtypes, wm); return; } visit(cast(Type)t); } /* Helper for TypeClass.deduceType(). * Classes can match with implicit conversion to a base class or interface. * This is complicated, because there may be more than one base class which * matches. In such cases, one or more parameters remain ambiguous. * For example, * * interface I(X, Y) {} * class C : I(uint, double), I(char, double) {} * C x; * foo(T, U)( I!(T, U) x) * * deduces that U is double, but T remains ambiguous (could be char or uint). * * Given a baseclass b, and initial deduced types 'dedtypes', this function * tries to match tparam with b, and also tries all base interfaces of b. * If a match occurs, numBaseClassMatches is incremented, and the new deduced * types are ANDed with the current 'best' estimate for dedtypes. */ static void deduceBaseClassParameters(ref BaseClass b, Scope* sc, Type tparam, TemplateParameters* parameters, Objects* dedtypes, Objects* best, ref int numBaseClassMatches) { TemplateInstance parti = b.sym ? b.sym.parent.isTemplateInstance() : null; if (parti) { // Make a temporary copy of dedtypes so we don't destroy it auto tmpdedtypes = new Objects(dedtypes.dim); memcpy(tmpdedtypes.tdata(), dedtypes.tdata(), dedtypes.dim * (void*).sizeof); auto t = new TypeInstance(Loc.initial, parti); MATCH m = deduceType(t, sc, tparam, parameters, tmpdedtypes); if (m > MATCH.nomatch) { // If this is the first ever match, it becomes our best estimate if (numBaseClassMatches == 0) memcpy(best.tdata(), tmpdedtypes.tdata(), tmpdedtypes.dim * (void*).sizeof); else for (size_t k = 0; k < tmpdedtypes.dim; ++k) { // If we've found more than one possible type for a parameter, // mark it as unknown. if ((*tmpdedtypes)[k] != (*best)[k]) (*best)[k] = (*dedtypes)[k]; } ++numBaseClassMatches; } } // Now recursively test the inherited interfaces foreach (ref bi; b.baseInterfaces) { deduceBaseClassParameters(bi, sc, tparam, parameters, dedtypes, best, numBaseClassMatches); } } override void visit(TypeClass t) { //printf("TypeClass.deduceType(this = %s)\n", t.toChars()); /* If this class is a template class, and we're matching * it against a template instance, convert the class type * to a template instance, too, and try again. */ TemplateInstance ti = t.sym.parent.isTemplateInstance(); if (tparam && tparam.ty == Tinstance) { if (ti && ti.toAlias() == t.sym) { auto tx = new TypeInstance(Loc.initial, ti); MATCH m = deduceType(tx, sc, tparam, parameters, dedtypes, wm); // Even if the match fails, there is still a chance it could match // a base class. if (m != MATCH.nomatch) { result = m; return; } } /* Match things like: * S!(T).foo */ TypeInstance tpi = cast(TypeInstance)tparam; if (tpi.idents.dim) { RootObject id = tpi.idents[tpi.idents.dim - 1]; if (id.dyncast() == DYNCAST.identifier && t.sym.ident.equals(cast(Identifier)id)) { Type tparent = t.sym.parent.getType(); if (tparent) { /* Slice off the .foo in S!(T).foo */ tpi.idents.dim--; result = deduceType(tparent, sc, tpi, parameters, dedtypes, wm); tpi.idents.dim++; return; } } } // If it matches exactly or via implicit conversion, we're done visit(cast(Type)t); if (result != MATCH.nomatch) return; /* There is still a chance to match via implicit conversion to * a base class or interface. Because there could be more than one such * match, we need to check them all. */ int numBaseClassMatches = 0; // Have we found an interface match? // Our best guess at dedtypes auto best = new Objects(dedtypes.dim); ClassDeclaration s = t.sym; while (s && s.baseclasses.dim > 0) { // Test the base class deduceBaseClassParameters(*(*s.baseclasses)[0], sc, tparam, parameters, dedtypes, best, numBaseClassMatches); // Test the interfaces inherited by the base class foreach (b; s.interfaces) { deduceBaseClassParameters(*b, sc, tparam, parameters, dedtypes, best, numBaseClassMatches); } s = (*s.baseclasses)[0].sym; } if (numBaseClassMatches == 0) { result = MATCH.nomatch; return; } // If we got at least one match, copy the known types into dedtypes memcpy(dedtypes.tdata(), best.tdata(), best.dim * (void*).sizeof); result = MATCH.convert; return; } // Extra check if (tparam && tparam.ty == Tclass) { TypeClass tp = cast(TypeClass)tparam; //printf("\t%d\n", (MATCH) t.implicitConvTo(tp)); if (wm && t.deduceWild(tparam, false)) { result = MATCH.constant; return; } result = t.implicitConvTo(tp); return; } visit(cast(Type)t); } override void visit(Expression e) { //printf("Expression.deduceType(e = %s)\n", e.toChars()); size_t i = templateParameterLookup(tparam, parameters); if (i == IDX_NOTFOUND || (cast(TypeIdentifier)tparam).idents.dim > 0) { if (e == emptyArrayElement && tparam.ty == Tarray) { Type tn = (cast(TypeNext)tparam).next; result = deduceType(emptyArrayElement, sc, tn, parameters, dedtypes, wm); return; } e.type.accept(this); return; } TemplateTypeParameter tp = (*parameters)[i].isTemplateTypeParameter(); if (!tp) return; // nomatch if (e == emptyArrayElement) { if ((*dedtypes)[i]) { result = MATCH.exact; return; } if (tp.defaultType) { tp.defaultType.accept(this); return; } } /* Returns `true` if `t` is a reference type, or an array of reference types */ bool isTopRef(Type t) { auto tb = t.baseElemOf(); return tb.ty == Tclass || tb.ty == Taarray || tb.ty == Tstruct && tb.hasPointers(); } Type at = cast(Type)(*dedtypes)[i]; Type tt; if (ubyte wx = deduceWildHelper(e.type, &tt, tparam)) { *wm |= wx; result = MATCH.constant; } else if (MATCH m = deduceTypeHelper(e.type, &tt, tparam)) { result = m; } else if (!isTopRef(e.type)) { /* https://issues.dlang.org/show_bug.cgi?id=15653 * In IFTI, recognize top-qualifier conversions * through the value copy, e.g. * int --> immutable(int) * immutable(string[]) --> immutable(string)[] */ tt = e.type.mutableOf(); result = MATCH.convert; } else return; // nomatch // expression vs (none) if (!at) { (*dedtypes)[i] = new TypeDeduced(tt, e, tparam); return; } TypeDeduced xt = null; if (at.ty == Tnone) { xt = cast(TypeDeduced)at; at = xt.tded; } // From previous matched expressions to current deduced type MATCH match1 = xt ? xt.matchAll(tt) : MATCH.nomatch; // From current expressions to previous deduced type Type pt = at.addMod(tparam.mod); if (*wm) pt = pt.substWildTo(*wm); MATCH match2 = e.implicitConvTo(pt); if (match1 > MATCH.nomatch && match2 > MATCH.nomatch) { if (at.implicitConvTo(tt) <= MATCH.nomatch) match1 = MATCH.nomatch; // Prefer at else if (tt.implicitConvTo(at) <= MATCH.nomatch) match2 = MATCH.nomatch; // Prefer tt else if (tt.isTypeBasic() && tt.ty == at.ty && tt.mod != at.mod) { if (!tt.isMutable() && !at.isMutable()) tt = tt.mutableOf().addMod(MODmerge(tt.mod, at.mod)); else if (tt.isMutable()) { if (at.mod == 0) // Prefer unshared match1 = MATCH.nomatch; else match2 = MATCH.nomatch; } else if (at.isMutable()) { if (tt.mod == 0) // Prefer unshared match2 = MATCH.nomatch; else match1 = MATCH.nomatch; } //printf("tt = %s, at = %s\n", tt.toChars(), at.toChars()); } else { match1 = MATCH.nomatch; match2 = MATCH.nomatch; } } if (match1 > MATCH.nomatch) { // Prefer current match: tt if (xt) xt.update(tt, e, tparam); else (*dedtypes)[i] = tt; result = match1; return; } if (match2 > MATCH.nomatch) { // Prefer previous match: (*dedtypes)[i] if (xt) xt.update(e, tparam); result = match2; return; } /* Deduce common type */ if (Type t = rawTypeMerge(at, tt)) { if (xt) xt.update(t, e, tparam); else (*dedtypes)[i] = t; pt = tt.addMod(tparam.mod); if (*wm) pt = pt.substWildTo(*wm); result = e.implicitConvTo(pt); return; } result = MATCH.nomatch; } MATCH deduceEmptyArrayElement() { if (!emptyArrayElement) { emptyArrayElement = new IdentifierExp(Loc.initial, Id.p); // dummy emptyArrayElement.type = Type.tvoid; } assert(tparam.ty == Tarray); Type tn = (cast(TypeNext)tparam).next; return deduceType(emptyArrayElement, sc, tn, parameters, dedtypes, wm); } override void visit(NullExp e) { if (tparam.ty == Tarray && e.type.ty == Tnull) { // tparam:T[] <- e:null (void[]) result = deduceEmptyArrayElement(); return; } visit(cast(Expression)e); } override void visit(StringExp e) { Type taai; if (e.type.ty == Tarray && (tparam.ty == Tsarray || tparam.ty == Taarray && (taai = (cast(TypeAArray)tparam).index).ty == Tident && (cast(TypeIdentifier)taai).idents.dim == 0)) { // Consider compile-time known boundaries e.type.nextOf().sarrayOf(e.len).accept(this); return; } visit(cast(Expression)e); } override void visit(ArrayLiteralExp e) { if ((!e.elements || !e.elements.dim) && e.type.toBasetype().nextOf().ty == Tvoid && tparam.ty == Tarray) { // tparam:T[] <- e:[] (void[]) result = deduceEmptyArrayElement(); return; } if (tparam.ty == Tarray && e.elements && e.elements.dim) { Type tn = (cast(TypeDArray)tparam).next; result = MATCH.exact; if (e.basis) { MATCH m = deduceType(e.basis, sc, tn, parameters, dedtypes, wm); if (m < result) result = m; } for (size_t i = 0; i < e.elements.dim; i++) { if (result <= MATCH.nomatch) break; auto el = (*e.elements)[i]; if (!el) continue; MATCH m = deduceType(el, sc, tn, parameters, dedtypes, wm); if (m < result) result = m; } return; } Type taai; if (e.type.ty == Tarray && (tparam.ty == Tsarray || tparam.ty == Taarray && (taai = (cast(TypeAArray)tparam).index).ty == Tident && (cast(TypeIdentifier)taai).idents.dim == 0)) { // Consider compile-time known boundaries e.type.nextOf().sarrayOf(e.elements.dim).accept(this); return; } visit(cast(Expression)e); } override void visit(AssocArrayLiteralExp e) { if (tparam.ty == Taarray && e.keys && e.keys.dim) { TypeAArray taa = cast(TypeAArray)tparam; result = MATCH.exact; for (size_t i = 0; i < e.keys.dim; i++) { MATCH m1 = deduceType((*e.keys)[i], sc, taa.index, parameters, dedtypes, wm); if (m1 < result) result = m1; if (result <= MATCH.nomatch) break; MATCH m2 = deduceType((*e.values)[i], sc, taa.next, parameters, dedtypes, wm); if (m2 < result) result = m2; if (result <= MATCH.nomatch) break; } return; } visit(cast(Expression)e); } override void visit(FuncExp e) { //printf("e.type = %s, tparam = %s\n", e.type.toChars(), tparam.toChars()); if (e.td) { Type to = tparam; if (!to.nextOf() || to.nextOf().ty != Tfunction) return; TypeFunction tof = cast(TypeFunction)to.nextOf(); // Parameter types inference from 'tof' assert(e.td._scope); TypeFunction tf = cast(TypeFunction)e.fd.type; //printf("\ttof = %s\n", tof.toChars()); //printf("\ttf = %s\n", tf.toChars()); size_t dim = tf.parameterList.length; if (tof.parameterList.length != dim || tof.parameterList.varargs != tf.parameterList.varargs) return; auto tiargs = new Objects(); tiargs.reserve(e.td.parameters.dim); for (size_t i = 0; i < e.td.parameters.dim; i++) { TemplateParameter tp = (*e.td.parameters)[i]; size_t u = 0; for (; u < dim; u++) { Parameter p = tf.parameterList[u]; if (p.type.ty == Tident && (cast(TypeIdentifier)p.type).ident == tp.ident) { break; } } assert(u < dim); Parameter pto = tof.parameterList[u]; if (!pto) break; Type t = pto.type.syntaxCopy(); // https://issues.dlang.org/show_bug.cgi?id=11774 if (reliesOnTemplateParameters(t, (*parameters)[inferStart .. parameters.dim])) return; t = t.typeSemantic(e.loc, sc); if (t.ty == Terror) return; tiargs.push(t); } // Set target of return type inference if (!tf.next && tof.next) e.fd.treq = tparam; auto ti = new TemplateInstance(e.loc, e.td, tiargs); Expression ex = (new ScopeExp(e.loc, ti)).expressionSemantic(e.td._scope); // Reset inference target for the later re-semantic e.fd.treq = null; if (ex.op == TOK.error) return; if (ex.op != TOK.function_) return; visit(ex.type); return; } Type t = e.type; if (t.ty == Tdelegate && tparam.ty == Tpointer) return; // Allow conversion from implicit function pointer to delegate if (e.tok == TOK.reserved && t.ty == Tpointer && tparam.ty == Tdelegate) { TypeFunction tf = cast(TypeFunction)t.nextOf(); t = (new TypeDelegate(tf)).merge(); } //printf("tparam = %s <= e.type = %s, t = %s\n", tparam.toChars(), e.type.toChars(), t.toChars()); visit(t); } override void visit(SliceExp e) { Type taai; if (e.type.ty == Tarray && (tparam.ty == Tsarray || tparam.ty == Taarray && (taai = (cast(TypeAArray)tparam).index).ty == Tident && (cast(TypeIdentifier)taai).idents.dim == 0)) { // Consider compile-time known boundaries if (Type tsa = toStaticArrayType(e)) { tsa.accept(this); return; } } visit(cast(Expression)e); } override void visit(CommaExp e) { e.e2.accept(this); } } scope DeduceType v = new DeduceType(sc, tparam, parameters, dedtypes, wm, inferStart, ignoreAliasThis); if (Type t = isType(o)) t.accept(v); else if (Expression e = isExpression(o)) { assert(wm); e.accept(v); } else assert(0); return v.result; } /*********************************************************** * Check whether the type t representation relies on one or more the template parameters. * Params: * t = Tested type, if null, returns false. * tparams = Template parameters. * iStart = Start index of tparams to limit the tested parameters. If it's * nonzero, tparams[0..iStart] will be excluded from the test target. */ bool reliesOnTident(Type t, TemplateParameters* tparams, size_t iStart = 0) { return reliesOnTemplateParameters(t, (*tparams)[0 .. tparams.dim]); } /*********************************************************** * Check whether the type t representation relies on one or more the template parameters. * Params: * t = Tested type, if null, returns false. * tparams = Template parameters. */ private bool reliesOnTemplateParameters(Type t, TemplateParameter[] tparams) { bool visitVector(TypeVector t) { return t.basetype.reliesOnTemplateParameters(tparams); } bool visitAArray(TypeAArray t) { return t.next.reliesOnTemplateParameters(tparams) || t.index.reliesOnTemplateParameters(tparams); } bool visitFunction(TypeFunction t) { foreach (i; 0 .. t.parameterList.length) { Parameter fparam = t.parameterList[i]; if (fparam.type.reliesOnTemplateParameters(tparams)) return true; } return t.next.reliesOnTemplateParameters(tparams); } bool visitIdentifier(TypeIdentifier t) { foreach (tp; tparams) { if (tp.ident.equals(t.ident)) return true; } return false; } bool visitInstance(TypeInstance t) { foreach (tp; tparams) { if (t.tempinst.name == tp.ident) return true; } if (t.tempinst.tiargs) foreach (arg; *t.tempinst.tiargs) { if (Type ta = isType(arg)) { if (ta.reliesOnTemplateParameters(tparams)) return true; } } return false; } bool visitTypeof(TypeTypeof t) { //printf("TypeTypeof.reliesOnTemplateParameters('%s')\n", t.toChars()); return t.exp.reliesOnTemplateParameters(tparams); } bool visitTuple(TypeTuple t) { if (t.arguments) foreach (arg; *t.arguments) { if (arg.type.reliesOnTemplateParameters(tparams)) return true; } return false; } if (!t) return false; Type tb = t.toBasetype(); switch (tb.ty) { case Tvector: return visitVector(tb.isTypeVector()); case Taarray: return visitAArray(tb.isTypeAArray()); case Tfunction: return visitFunction(tb.isTypeFunction()); case Tident: return visitIdentifier(tb.isTypeIdentifier()); case Tinstance: return visitInstance(tb.isTypeInstance()); case Ttypeof: return visitTypeof(tb.isTypeTypeof()); case Ttuple: return visitTuple(tb.isTypeTuple()); case Tenum: return false; default: return tb.nextOf().reliesOnTemplateParameters(tparams); } } /*********************************************************** * Check whether the expression representation relies on one or more the template parameters. * Params: * e = expression to test * tparams = Template parameters. * Returns: * true if it does */ private bool reliesOnTemplateParameters(Expression e, TemplateParameter[] tparams) { extern (C++) final class ReliesOnTemplateParameters : Visitor { alias visit = Visitor.visit; public: TemplateParameter[] tparams; bool result; extern (D) this(TemplateParameter[] tparams) { this.tparams = tparams; } override void visit(Expression e) { //printf("Expression.reliesOnTemplateParameters('%s')\n", e.toChars()); } override void visit(IdentifierExp e) { //printf("IdentifierExp.reliesOnTemplateParameters('%s')\n", e.toChars()); foreach (tp; tparams) { if (e.ident == tp.ident) { result = true; return; } } } override void visit(TupleExp e) { //printf("TupleExp.reliesOnTemplateParameters('%s')\n", e.toChars()); if (e.exps) { foreach (ea; *e.exps) { ea.accept(this); if (result) return; } } } override void visit(ArrayLiteralExp e) { //printf("ArrayLiteralExp.reliesOnTemplateParameters('%s')\n", e.toChars()); if (e.elements) { foreach (el; *e.elements) { el.accept(this); if (result) return; } } } override void visit(AssocArrayLiteralExp e) { //printf("AssocArrayLiteralExp.reliesOnTemplateParameters('%s')\n", e.toChars()); foreach (ek; *e.keys) { ek.accept(this); if (result) return; } foreach (ev; *e.values) { ev.accept(this); if (result) return; } } override void visit(StructLiteralExp e) { //printf("StructLiteralExp.reliesOnTemplateParameters('%s')\n", e.toChars()); if (e.elements) { foreach (ea; *e.elements) { ea.accept(this); if (result) return; } } } override void visit(TypeExp e) { //printf("TypeExp.reliesOnTemplateParameters('%s')\n", e.toChars()); result = e.type.reliesOnTemplateParameters(tparams); } override void visit(NewExp e) { //printf("NewExp.reliesOnTemplateParameters('%s')\n", e.toChars()); if (e.thisexp) e.thisexp.accept(this); if (!result && e.newargs) { foreach (ea; *e.newargs) { ea.accept(this); if (result) return; } } result = e.newtype.reliesOnTemplateParameters(tparams); if (!result && e.arguments) { foreach (ea; *e.arguments) { ea.accept(this); if (result) return; } } } override void visit(NewAnonClassExp e) { //printf("NewAnonClassExp.reliesOnTemplateParameters('%s')\n", e.toChars()); result = true; } override void visit(FuncExp e) { //printf("FuncExp.reliesOnTemplateParameters('%s')\n", e.toChars()); result = true; } override void visit(TypeidExp e) { //printf("TypeidExp.reliesOnTemplateParameters('%s')\n", e.toChars()); if (auto ea = isExpression(e.obj)) ea.accept(this); else if (auto ta = isType(e.obj)) result = ta.reliesOnTemplateParameters(tparams); } override void visit(TraitsExp e) { //printf("TraitsExp.reliesOnTemplateParameters('%s')\n", e.toChars()); if (e.args) { foreach (oa; *e.args) { if (auto ea = isExpression(oa)) ea.accept(this); else if (auto ta = isType(oa)) result = ta.reliesOnTemplateParameters(tparams); if (result) return; } } } override void visit(IsExp e) { //printf("IsExp.reliesOnTemplateParameters('%s')\n", e.toChars()); result = e.targ.reliesOnTemplateParameters(tparams); } override void visit(UnaExp e) { //printf("UnaExp.reliesOnTemplateParameters('%s')\n", e.toChars()); e.e1.accept(this); } override void visit(DotTemplateInstanceExp e) { //printf("DotTemplateInstanceExp.reliesOnTemplateParameters('%s')\n", e.toChars()); visit(cast(UnaExp)e); if (!result && e.ti.tiargs) { foreach (oa; *e.ti.tiargs) { if (auto ea = isExpression(oa)) ea.accept(this); else if (auto ta = isType(oa)) result = ta.reliesOnTemplateParameters(tparams); if (result) return; } } } override void visit(CallExp e) { //printf("CallExp.reliesOnTemplateParameters('%s')\n", e.toChars()); visit(cast(UnaExp)e); if (!result && e.arguments) { foreach (ea; *e.arguments) { ea.accept(this); if (result) return; } } } override void visit(CastExp e) { //printf("CallExp.reliesOnTemplateParameters('%s')\n", e.toChars()); visit(cast(UnaExp)e); // e.to can be null for cast() with no type if (!result && e.to) result = e.to.reliesOnTemplateParameters(tparams); } override void visit(SliceExp e) { //printf("SliceExp.reliesOnTemplateParameters('%s')\n", e.toChars()); visit(cast(UnaExp)e); if (!result && e.lwr) e.lwr.accept(this); if (!result && e.upr) e.upr.accept(this); } override void visit(IntervalExp e) { //printf("IntervalExp.reliesOnTemplateParameters('%s')\n", e.toChars()); e.lwr.accept(this); if (!result) e.upr.accept(this); } override void visit(ArrayExp e) { //printf("ArrayExp.reliesOnTemplateParameters('%s')\n", e.toChars()); visit(cast(UnaExp)e); if (!result && e.arguments) { foreach (ea; *e.arguments) ea.accept(this); } } override void visit(BinExp e) { //printf("BinExp.reliesOnTemplateParameters('%s')\n", e.toChars()); e.e1.accept(this); if (!result) e.e2.accept(this); } override void visit(CondExp e) { //printf("BinExp.reliesOnTemplateParameters('%s')\n", e.toChars()); e.econd.accept(this); if (!result) visit(cast(BinExp)e); } } scope ReliesOnTemplateParameters v = new ReliesOnTemplateParameters(tparams); e.accept(v); return v.result; } /*********************************************************** * https://dlang.org/spec/template.html#TemplateParameter */ extern (C++) class TemplateParameter : RootObject { Loc loc; Identifier ident; /* True if this is a part of precedent parameter specialization pattern. * * template A(T : X!TL, alias X, TL...) {} * // X and TL are dependent template parameter * * A dependent template parameter should return MATCH.exact in matchArg() * to respect the match level of the corresponding precedent parameter. */ bool dependent; /* ======================== TemplateParameter =============================== */ extern (D) this(const ref Loc loc, Identifier ident) { this.loc = loc; this.ident = ident; } TemplateTypeParameter isTemplateTypeParameter() { return null; } TemplateValueParameter isTemplateValueParameter() { return null; } TemplateAliasParameter isTemplateAliasParameter() { return null; } TemplateThisParameter isTemplateThisParameter() { return null; } TemplateTupleParameter isTemplateTupleParameter() { return null; } abstract TemplateParameter syntaxCopy(); abstract bool declareParameter(Scope* sc); abstract void print(RootObject oarg, RootObject oded); abstract RootObject specialization(); abstract RootObject defaultArg(Loc instLoc, Scope* sc); abstract bool hasDefaultArg(); override const(char)* toChars() { return this.ident.toChars(); } override DYNCAST dyncast() const pure @nogc nothrow @safe { return DYNCAST.templateparameter; } /******************************************* * Match to a particular TemplateParameter. * Input: * instLoc location that the template is instantiated. * tiargs[] actual arguments to template instance * i i'th argument * parameters[] template parameters * dedtypes[] deduced arguments to template instance * *psparam set to symbol declared and initialized to dedtypes[i] */ MATCH matchArg(Loc instLoc, Scope* sc, Objects* tiargs, size_t i, TemplateParameters* parameters, Objects* dedtypes, Declaration* psparam) { RootObject oarg; if (i < tiargs.dim) oarg = (*tiargs)[i]; else { // Get default argument instead oarg = defaultArg(instLoc, sc); if (!oarg) { assert(i < dedtypes.dim); // It might have already been deduced oarg = (*dedtypes)[i]; if (!oarg) goto Lnomatch; } } return matchArg(sc, oarg, i, parameters, dedtypes, psparam); Lnomatch: if (psparam) *psparam = null; return MATCH.nomatch; } abstract MATCH matchArg(Scope* sc, RootObject oarg, size_t i, TemplateParameters* parameters, Objects* dedtypes, Declaration* psparam); /* Create dummy argument based on parameter. */ abstract void* dummyArg(); void accept(Visitor v) { v.visit(this); } } /*********************************************************** * https://dlang.org/spec/template.html#TemplateTypeParameter * Syntax: * ident : specType = defaultType */ extern (C++) class TemplateTypeParameter : TemplateParameter { Type specType; // if !=null, this is the type specialization Type defaultType; extern (D) __gshared Type tdummy = null; extern (D) this(const ref Loc loc, Identifier ident, Type specType, Type defaultType) { super(loc, ident); this.ident = ident; this.specType = specType; this.defaultType = defaultType; } override final TemplateTypeParameter isTemplateTypeParameter() { return this; } override TemplateParameter syntaxCopy() { return new TemplateTypeParameter(loc, ident, specType ? specType.syntaxCopy() : null, defaultType ? defaultType.syntaxCopy() : null); } override final bool declareParameter(Scope* sc) { //printf("TemplateTypeParameter.declareParameter('%s')\n", ident.toChars()); auto ti = new TypeIdentifier(loc, ident); Declaration ad = new AliasDeclaration(loc, ident, ti); return sc.insert(ad) !is null; } override final void print(RootObject oarg, RootObject oded) { printf(" %s\n", ident.toChars()); Type t = isType(oarg); Type ta = isType(oded); assert(ta); if (specType) printf("\tSpecialization: %s\n", specType.toChars()); if (defaultType) printf("\tDefault: %s\n", defaultType.toChars()); printf("\tParameter: %s\n", t ? t.toChars() : "NULL"); printf("\tDeduced Type: %s\n", ta.toChars()); } override final RootObject specialization() { return specType; } override final RootObject defaultArg(Loc instLoc, Scope* sc) { Type t = defaultType; if (t) { t = t.syntaxCopy(); t = t.typeSemantic(loc, sc); // use the parameter loc } return t; } override final bool hasDefaultArg() { return defaultType !is null; } override final MATCH matchArg(Scope* sc, RootObject oarg, size_t i, TemplateParameters* parameters, Objects* dedtypes, Declaration* psparam) { //printf("TemplateTypeParameter.matchArg('%s')\n", ident.toChars()); MATCH m = MATCH.exact; Type ta = isType(oarg); if (!ta) { //printf("%s %p %p %p\n", oarg.toChars(), isExpression(oarg), isDsymbol(oarg), isTuple(oarg)); goto Lnomatch; } //printf("ta is %s\n", ta.toChars()); if (specType) { if (!ta || ta == tdummy) goto Lnomatch; //printf("\tcalling deduceType(): ta is %s, specType is %s\n", ta.toChars(), specType.toChars()); MATCH m2 = deduceType(ta, sc, specType, parameters, dedtypes); if (m2 <= MATCH.nomatch) { //printf("\tfailed deduceType\n"); goto Lnomatch; } if (m2 < m) m = m2; if ((*dedtypes)[i]) { Type t = cast(Type)(*dedtypes)[i]; if (dependent && !t.equals(ta)) // https://issues.dlang.org/show_bug.cgi?id=14357 goto Lnomatch; /* This is a self-dependent parameter. For example: * template X(T : T*) {} * template X(T : S!T, alias S) {} */ //printf("t = %s ta = %s\n", t.toChars(), ta.toChars()); ta = t; } } else { if ((*dedtypes)[i]) { // Must match already deduced type Type t = cast(Type)(*dedtypes)[i]; if (!t.equals(ta)) { //printf("t = %s ta = %s\n", t.toChars(), ta.toChars()); goto Lnomatch; } } else { // So that matches with specializations are better m = MATCH.convert; } } (*dedtypes)[i] = ta; if (psparam) *psparam = new AliasDeclaration(loc, ident, ta); //printf("\tm = %d\n", m); return dependent ? MATCH.exact : m; Lnomatch: if (psparam) *psparam = null; //printf("\tm = %d\n", MATCH.nomatch); return MATCH.nomatch; } override final void* dummyArg() { Type t = specType; if (!t) { // Use this for alias-parameter's too (?) if (!tdummy) tdummy = new TypeIdentifier(loc, ident); t = tdummy; } return cast(void*)t; } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** * https://dlang.org/spec/template.html#TemplateThisParameter * Syntax: * this ident : specType = defaultType */ extern (C++) final class TemplateThisParameter : TemplateTypeParameter { extern (D) this(const ref Loc loc, Identifier ident, Type specType, Type defaultType) { super(loc, ident, specType, defaultType); } override TemplateThisParameter isTemplateThisParameter() { return this; } override TemplateParameter syntaxCopy() { return new TemplateThisParameter(loc, ident, specType ? specType.syntaxCopy() : null, defaultType ? defaultType.syntaxCopy() : null); } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** * https://dlang.org/spec/template.html#TemplateValueParameter * Syntax: * valType ident : specValue = defaultValue */ extern (C++) final class TemplateValueParameter : TemplateParameter { Type valType; Expression specValue; Expression defaultValue; extern (D) __gshared Expression[void*] edummies; extern (D) this(const ref Loc loc, Identifier ident, Type valType, Expression specValue, Expression defaultValue) { super(loc, ident); this.ident = ident; this.valType = valType; this.specValue = specValue; this.defaultValue = defaultValue; } override TemplateValueParameter isTemplateValueParameter() { return this; } override TemplateParameter syntaxCopy() { return new TemplateValueParameter(loc, ident, valType.syntaxCopy(), specValue ? specValue.syntaxCopy() : null, defaultValue ? defaultValue.syntaxCopy() : null); } override bool declareParameter(Scope* sc) { auto v = new VarDeclaration(loc, valType, ident, null); v.storage_class = STC.templateparameter; return sc.insert(v) !is null; } override void print(RootObject oarg, RootObject oded) { printf(" %s\n", ident.toChars()); Expression ea = isExpression(oded); if (specValue) printf("\tSpecialization: %s\n", specValue.toChars()); printf("\tParameter Value: %s\n", ea ? ea.toChars() : "NULL"); } override RootObject specialization() { return specValue; } override RootObject defaultArg(Loc instLoc, Scope* sc) { Expression e = defaultValue; if (e) { e = e.syntaxCopy(); uint olderrs = global.errors; if ((e = e.expressionSemantic(sc)) is null) return null; if ((e = resolveProperties(sc, e)) is null) return null; e = e.resolveLoc(instLoc, sc); // use the instantiated loc e = e.optimize(WANTvalue); if (global.errors != olderrs) e = new ErrorExp(); } return e; } override bool hasDefaultArg() { return defaultValue !is null; } override MATCH matchArg(Scope* sc, RootObject oarg, size_t i, TemplateParameters* parameters, Objects* dedtypes, Declaration* psparam) { //printf("TemplateValueParameter.matchArg('%s')\n", ident.toChars()); MATCH m = MATCH.exact; Expression ei = isExpression(oarg); Type vt; if (!ei && oarg) { Dsymbol si = isDsymbol(oarg); FuncDeclaration f = si ? si.isFuncDeclaration() : null; if (!f || !f.fbody || f.needThis()) goto Lnomatch; ei = new VarExp(loc, f); ei = ei.expressionSemantic(sc); /* If a function is really property-like, and then * it's CTFEable, ei will be a literal expression. */ uint olderrors = global.startGagging(); ei = resolveProperties(sc, ei); ei = ei.ctfeInterpret(); if (global.endGagging(olderrors) || ei.op == TOK.error) goto Lnomatch; /* https://issues.dlang.org/show_bug.cgi?id=14520 * A property-like function can match to both * TemplateAlias and ValueParameter. But for template overloads, * it should always prefer alias parameter to be consistent * template match result. * * template X(alias f) { enum X = 1; } * template X(int val) { enum X = 2; } * int f1() { return 0; } // CTFEable * int f2(); // body-less function is not CTFEable * enum x1 = X!f1; // should be 1 * enum x2 = X!f2; // should be 1 * * e.g. The x1 value must be same even if the f1 definition will be moved * into di while stripping body code. */ m = MATCH.convert; } if (ei && ei.op == TOK.variable) { // Resolve const variables that we had skipped earlier ei = ei.ctfeInterpret(); } //printf("\tvalType: %s, ty = %d\n", valType.toChars(), valType.ty); vt = valType.typeSemantic(loc, sc); //printf("ei: %s, ei.type: %s\n", ei.toChars(), ei.type.toChars()); //printf("vt = %s\n", vt.toChars()); if (ei.type) { MATCH m2 = ei.implicitConvTo(vt); //printf("m: %d\n", m); if (m2 < m) m = m2; if (m <= MATCH.nomatch) goto Lnomatch; ei = ei.implicitCastTo(sc, vt); ei = ei.ctfeInterpret(); } if (specValue) { if (ei is null || (cast(void*)ei.type in edummies && edummies[cast(void*)ei.type] == ei)) goto Lnomatch; Expression e = specValue; sc = sc.startCTFE(); e = e.expressionSemantic(sc); e = resolveProperties(sc, e); sc = sc.endCTFE(); e = e.implicitCastTo(sc, vt); e = e.ctfeInterpret(); ei = ei.syntaxCopy(); sc = sc.startCTFE(); ei = ei.expressionSemantic(sc); sc = sc.endCTFE(); ei = ei.implicitCastTo(sc, vt); ei = ei.ctfeInterpret(); //printf("\tei: %s, %s\n", ei.toChars(), ei.type.toChars()); //printf("\te : %s, %s\n", e.toChars(), e.type.toChars()); if (!ei.equals(e)) goto Lnomatch; } else { if ((*dedtypes)[i]) { // Must match already deduced value Expression e = cast(Expression)(*dedtypes)[i]; if (!ei || !ei.equals(e)) goto Lnomatch; } } (*dedtypes)[i] = ei; if (psparam) { Initializer _init = new ExpInitializer(loc, ei); Declaration sparam = new VarDeclaration(loc, vt, ident, _init); sparam.storage_class = STC.manifest; *psparam = sparam; } return dependent ? MATCH.exact : m; Lnomatch: //printf("\tno match\n"); if (psparam) *psparam = null; return MATCH.nomatch; } override void* dummyArg() { Expression e = specValue; if (!e) { // Create a dummy value auto pe = cast(void*)valType in edummies; if (!pe) { e = valType.defaultInit(Loc.initial); edummies[cast(void*)valType] = e; } else e = *pe; } return cast(void*)e; } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** * https://dlang.org/spec/template.html#TemplateAliasParameter * Syntax: * specType ident : specAlias = defaultAlias */ extern (C++) final class TemplateAliasParameter : TemplateParameter { Type specType; RootObject specAlias; RootObject defaultAlias; extern (D) __gshared Dsymbol sdummy = null; extern (D) this(const ref Loc loc, Identifier ident, Type specType, RootObject specAlias, RootObject defaultAlias) { super(loc, ident); this.ident = ident; this.specType = specType; this.specAlias = specAlias; this.defaultAlias = defaultAlias; } override TemplateAliasParameter isTemplateAliasParameter() { return this; } override TemplateParameter syntaxCopy() { return new TemplateAliasParameter(loc, ident, specType ? specType.syntaxCopy() : null, objectSyntaxCopy(specAlias), objectSyntaxCopy(defaultAlias)); } override bool declareParameter(Scope* sc) { auto ti = new TypeIdentifier(loc, ident); Declaration ad = new AliasDeclaration(loc, ident, ti); return sc.insert(ad) !is null; } override void print(RootObject oarg, RootObject oded) { printf(" %s\n", ident.toChars()); Dsymbol sa = isDsymbol(oded); assert(sa); printf("\tParameter alias: %s\n", sa.toChars()); } override RootObject specialization() { return specAlias; } override RootObject defaultArg(Loc instLoc, Scope* sc) { RootObject da = defaultAlias; Type ta = isType(defaultAlias); if (ta) { if (ta.ty == Tinstance) { // If the default arg is a template, instantiate for each type da = ta.syntaxCopy(); } } RootObject o = aliasParameterSemantic(loc, sc, da, null); // use the parameter loc return o; } override bool hasDefaultArg() { return defaultAlias !is null; } override MATCH matchArg(Scope* sc, RootObject oarg, size_t i, TemplateParameters* parameters, Objects* dedtypes, Declaration* psparam) { //printf("TemplateAliasParameter.matchArg('%s')\n", ident.toChars()); MATCH m = MATCH.exact; Type ta = isType(oarg); RootObject sa = ta && !ta.deco ? null : getDsymbol(oarg); Expression ea = isExpression(oarg); if (ea && (ea.op == TOK.this_ || ea.op == TOK.super_)) sa = (cast(ThisExp)ea).var; else if (ea && ea.op == TOK.scope_) sa = (cast(ScopeExp)ea).sds; if (sa) { if ((cast(Dsymbol)sa).isAggregateDeclaration()) m = MATCH.convert; /* specType means the alias must be a declaration with a type * that matches specType. */ if (specType) { Declaration d = (cast(Dsymbol)sa).isDeclaration(); if (!d) goto Lnomatch; if (!d.type.equals(specType)) goto Lnomatch; } } else { sa = oarg; if (ea) { if (specType) { if (!ea.type.equals(specType)) goto Lnomatch; } } else if (ta && ta.ty == Tinstance && !specAlias) { /* Specialized parameter should be preferred * match to the template type parameter. * template X(alias a) {} // a == this * template X(alias a : B!A, alias B, A...) {} // B!A => ta */ } else if (sa && sa == TemplateTypeParameter.tdummy) { /* https://issues.dlang.org/show_bug.cgi?id=2025 * Aggregate Types should preferentially * match to the template type parameter. * template X(alias a) {} // a == this * template X(T) {} // T => sa */ } else goto Lnomatch; } if (specAlias) { if (sa == sdummy) goto Lnomatch; Dsymbol sx = isDsymbol(sa); if (sa != specAlias && sx) { Type talias = isType(specAlias); if (!talias) goto Lnomatch; TemplateInstance ti = sx.isTemplateInstance(); if (!ti && sx.parent) { ti = sx.parent.isTemplateInstance(); if (ti && ti.name != sx.ident) goto Lnomatch; } if (!ti) goto Lnomatch; Type t = new TypeInstance(Loc.initial, ti); MATCH m2 = deduceType(t, sc, talias, parameters, dedtypes); if (m2 <= MATCH.nomatch) goto Lnomatch; } } else if ((*dedtypes)[i]) { // Must match already deduced symbol RootObject si = (*dedtypes)[i]; if (!sa || si != sa) goto Lnomatch; } (*dedtypes)[i] = sa; if (psparam) { if (Dsymbol s = isDsymbol(sa)) { *psparam = new AliasDeclaration(loc, ident, s); } else if (Type t = isType(sa)) { *psparam = new AliasDeclaration(loc, ident, t); } else { assert(ea); // Declare manifest constant Initializer _init = new ExpInitializer(loc, ea); auto v = new VarDeclaration(loc, null, ident, _init); v.storage_class = STC.manifest; v.dsymbolSemantic(sc); *psparam = v; } } return dependent ? MATCH.exact : m; Lnomatch: if (psparam) *psparam = null; //printf("\tm = %d\n", MATCH.nomatch); return MATCH.nomatch; } override void* dummyArg() { RootObject s = specAlias; if (!s) { if (!sdummy) sdummy = new Dsymbol(); s = sdummy; } return cast(void*)s; } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** * https://dlang.org/spec/template.html#TemplateSequenceParameter * Syntax: * ident ... */ extern (C++) final class TemplateTupleParameter : TemplateParameter { extern (D) this(const ref Loc loc, Identifier ident) { super(loc, ident); this.ident = ident; } override TemplateTupleParameter isTemplateTupleParameter() { return this; } override TemplateParameter syntaxCopy() { return new TemplateTupleParameter(loc, ident); } override bool declareParameter(Scope* sc) { auto ti = new TypeIdentifier(loc, ident); Declaration ad = new AliasDeclaration(loc, ident, ti); return sc.insert(ad) !is null; } override void print(RootObject oarg, RootObject oded) { printf(" %s... [", ident.toChars()); Tuple v = isTuple(oded); assert(v); //printf("|%d| ", v.objects.dim); for (size_t i = 0; i < v.objects.dim; i++) { if (i) printf(", "); RootObject o = v.objects[i]; Dsymbol sa = isDsymbol(o); if (sa) printf("alias: %s", sa.toChars()); Type ta = isType(o); if (ta) printf("type: %s", ta.toChars()); Expression ea = isExpression(o); if (ea) printf("exp: %s", ea.toChars()); assert(!isTuple(o)); // no nested Tuple arguments } printf("]\n"); } override RootObject specialization() { return null; } override RootObject defaultArg(Loc instLoc, Scope* sc) { return null; } override bool hasDefaultArg() { return false; } override MATCH matchArg(Loc instLoc, Scope* sc, Objects* tiargs, size_t i, TemplateParameters* parameters, Objects* dedtypes, Declaration* psparam) { /* The rest of the actual arguments (tiargs[]) form the match * for the variadic parameter. */ assert(i + 1 == dedtypes.dim); // must be the last one Tuple ovar; if (Tuple u = isTuple((*dedtypes)[i])) { // It has already been deduced ovar = u; } else if (i + 1 == tiargs.dim && isTuple((*tiargs)[i])) ovar = isTuple((*tiargs)[i]); else { ovar = new Tuple(); //printf("ovar = %p\n", ovar); if (i < tiargs.dim) { //printf("i = %d, tiargs.dim = %d\n", i, tiargs.dim); ovar.objects.setDim(tiargs.dim - i); for (size_t j = 0; j < ovar.objects.dim; j++) ovar.objects[j] = (*tiargs)[i + j]; } } return matchArg(sc, ovar, i, parameters, dedtypes, psparam); } override MATCH matchArg(Scope* sc, RootObject oarg, size_t i, TemplateParameters* parameters, Objects* dedtypes, Declaration* psparam) { //printf("TemplateTupleParameter.matchArg('%s')\n", ident.toChars()); Tuple ovar = isTuple(oarg); if (!ovar) return MATCH.nomatch; if ((*dedtypes)[i]) { Tuple tup = isTuple((*dedtypes)[i]); if (!tup) return MATCH.nomatch; if (!match(tup, ovar)) return MATCH.nomatch; } (*dedtypes)[i] = ovar; if (psparam) *psparam = new TupleDeclaration(loc, ident, &ovar.objects); return dependent ? MATCH.exact : MATCH.convert; } override void* dummyArg() { return null; } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** * https://dlang.org/spec/template.html#explicit_tmp_instantiation * Given: * foo!(args) => * name = foo * tiargs = args */ extern (C++) class TemplateInstance : ScopeDsymbol { Identifier name; // Array of Types/Expressions of template // instance arguments [int*, char, 10*10] Objects* tiargs; // Array of Types/Expressions corresponding // to TemplateDeclaration.parameters // [int, char, 100] Objects tdtypes; // Modules imported by this template instance Modules importedModules; Dsymbol tempdecl; // referenced by foo.bar.abc Dsymbol enclosing; // if referencing local symbols, this is the context Dsymbol aliasdecl; // !=null if instance is an alias for its sole member TemplateInstance inst; // refer to existing instance ScopeDsymbol argsym; // argument symbol table int inuse; // for recursive expansion detection int nest; // for recursive pretty printing detection bool semantictiargsdone; // has semanticTiargs() been done? bool havetempdecl; // if used second constructor bool gagged; // if the instantiation is done with error gagging hash_t hash; // cached result of toHash() Expressions* fargs; // for function template, these are the function arguments TemplateInstances* deferred; Module memberOf; // if !null, then this TemplateInstance appears in memberOf.members[] // Used to determine the instance needs code generation. // Note that these are inaccurate until semantic analysis phase completed. TemplateInstance tinst; // enclosing template instance TemplateInstance tnext; // non-first instantiated instances Module minst; // the top module that instantiated this instance extern (D) this(const ref Loc loc, Identifier ident, Objects* tiargs) { super(null); static if (LOG) { printf("TemplateInstance(this = %p, ident = '%s')\n", this, ident ? ident.toChars() : "null"); } this.loc = loc; this.name = ident; this.tiargs = tiargs; } /***************** * This constructor is only called when we figured out which function * template to instantiate. */ extern (D) this(const ref Loc loc, TemplateDeclaration td, Objects* tiargs) { super(null); static if (LOG) { printf("TemplateInstance(this = %p, tempdecl = '%s')\n", this, td.toChars()); } this.loc = loc; this.name = td.ident; this.tiargs = tiargs; this.tempdecl = td; this.semantictiargsdone = true; this.havetempdecl = true; assert(tempdecl._scope); } extern (D) static Objects* arraySyntaxCopy(Objects* objs) { Objects* a = null; if (objs) { a = new Objects(objs.dim); for (size_t i = 0; i < objs.dim; i++) (*a)[i] = objectSyntaxCopy((*objs)[i]); } return a; } override Dsymbol syntaxCopy(Dsymbol s) { TemplateInstance ti = s ? cast(TemplateInstance)s : new TemplateInstance(loc, name, null); ti.tiargs = arraySyntaxCopy(tiargs); TemplateDeclaration td; if (inst && tempdecl && (td = tempdecl.isTemplateDeclaration()) !is null) td.ScopeDsymbol.syntaxCopy(ti); else ScopeDsymbol.syntaxCopy(ti); return ti; } // resolve real symbol override final Dsymbol toAlias() { static if (LOG) { printf("TemplateInstance.toAlias()\n"); } if (!inst) { // Maybe we can resolve it if (_scope) { dsymbolSemantic(this, _scope); } if (!inst) { error("cannot resolve forward reference"); errors = true; return this; } } if (inst != this) return inst.toAlias(); if (aliasdecl) { return aliasdecl.toAlias(); } return inst; } override const(char)* kind() const { return "template instance"; } override bool oneMember(Dsymbol* ps, Identifier ident) { *ps = null; return true; } override const(char)* toChars() { OutBuffer buf; toCBufferInstance(this, &buf); return buf.extractString(); } override final const(char)* toPrettyCharsHelper() { OutBuffer buf; toCBufferInstance(this, &buf, true); return buf.extractString(); } /************************************** * Given an error instantiating the TemplateInstance, * give the nested TemplateInstance instantiations that got * us here. Those are a list threaded into the nested scopes. */ final void printInstantiationTrace() { if (global.gag) return; const(uint) max_shown = 6; const(char)* format = "instantiated from here: `%s`"; // determine instantiation depth and number of recursive instantiations int n_instantiations = 1; int n_totalrecursions = 0; for (TemplateInstance cur = this; cur; cur = cur.tinst) { ++n_instantiations; // If two instantiations use the same declaration, they are recursive. // (this works even if they are instantiated from different places in the // same template). // In principle, we could also check for multiple-template recursion, but it's // probably not worthwhile. if (cur.tinst && cur.tempdecl && cur.tinst.tempdecl && cur.tempdecl.loc.equals(cur.tinst.tempdecl.loc)) ++n_totalrecursions; } // show full trace only if it's short or verbose is on if (n_instantiations <= max_shown || global.params.verbose) { for (TemplateInstance cur = this; cur; cur = cur.tinst) { cur.errors = true; errorSupplemental(cur.loc, format, cur.toChars()); } } else if (n_instantiations - n_totalrecursions <= max_shown) { // By collapsing recursive instantiations into a single line, // we can stay under the limit. int recursionDepth = 0; for (TemplateInstance cur = this; cur; cur = cur.tinst) { cur.errors = true; if (cur.tinst && cur.tempdecl && cur.tinst.tempdecl && cur.tempdecl.loc.equals(cur.tinst.tempdecl.loc)) { ++recursionDepth; } else { if (recursionDepth) errorSupplemental(cur.loc, "%d recursive instantiations from here: `%s`", recursionDepth + 2, cur.toChars()); else errorSupplemental(cur.loc, format, cur.toChars()); recursionDepth = 0; } } } else { // Even after collapsing the recursions, the depth is too deep. // Just display the first few and last few instantiations. uint i = 0; for (TemplateInstance cur = this; cur; cur = cur.tinst) { cur.errors = true; if (i == max_shown / 2) errorSupplemental(cur.loc, "... (%d instantiations, -v to show) ...", n_instantiations - max_shown); if (i < max_shown / 2 || i >= n_instantiations - max_shown + max_shown / 2) errorSupplemental(cur.loc, format, cur.toChars()); ++i; } } } /************************************* * Lazily generate identifier for template instance. * This is because 75% of the ident's are never needed. */ override final Identifier getIdent() { if (!ident && inst && !errors) ident = genIdent(tiargs); // need an identifier for name mangling purposes. return ident; } /************************************* * Compare proposed template instantiation with existing template instantiation. * Note that this is not commutative because of the auto ref check. * Params: * o = existing template instantiation * Returns: * 0 for match, 1 for no match */ override final int compare(RootObject o) { TemplateInstance ti = cast(TemplateInstance)o; //printf("this = %p, ti = %p\n", this, ti); assert(tdtypes.dim == ti.tdtypes.dim); // Nesting must match if (enclosing != ti.enclosing) { //printf("test2 enclosing %s ti.enclosing %s\n", enclosing ? enclosing.toChars() : "", ti.enclosing ? ti.enclosing.toChars() : ""); goto Lnotequals; } //printf("parent = %s, ti.parent = %s\n", parent.toPrettyChars(), ti.parent.toPrettyChars()); if (!arrayObjectMatch(&tdtypes, &ti.tdtypes)) goto Lnotequals; /* Template functions may have different instantiations based on * "auto ref" parameters. */ if (auto fd = ti.toAlias().isFuncDeclaration()) { if (!fd.errors) { auto fparameters = fd.getParameterList(); size_t nfparams = fparameters.length; // Num function parameters for (size_t j = 0; j < nfparams; j++) { Parameter fparam = fparameters[j]; if (fparam.storageClass & STC.autoref) // if "auto ref" { if (!fargs) goto Lnotequals; if (fargs.dim <= j) break; Expression farg = (*fargs)[j]; if (farg.isLvalue()) { if (!(fparam.storageClass & STC.ref_)) goto Lnotequals; // auto ref's don't match } else { if (fparam.storageClass & STC.ref_) goto Lnotequals; // auto ref's don't match } } } } } return 0; Lnotequals: return 1; } final hash_t toHash() { if (!hash) { hash = cast(size_t)cast(void*)enclosing; hash += arrayObjectHash(&tdtypes); hash += hash == 0; } return hash; } /*********************************************** * Returns true if this is not instantiated in non-root module, and * is a part of non-speculative instantiatiation. * * Note: minst does not stabilize until semantic analysis is completed, * so don't call this function during semantic analysis to return precise result. */ final bool needsCodegen() { // Now -allInst is just for the backward compatibility. if (global.params.allInst) { //printf("%s minst = %s, enclosing (%s).isNonRoot = %d\n", // toPrettyChars(), minst ? minst.toChars() : NULL, // enclosing ? enclosing.toPrettyChars() : NULL, enclosing && enclosing.inNonRoot()); if (enclosing) { /* https://issues.dlang.org/show_bug.cgi?id=14588 * If the captured context is not a function * (e.g. class), the instance layout determination is guaranteed, * because the semantic/semantic2 pass will be executed * even for non-root instances. */ if (!enclosing.isFuncDeclaration()) return true; /* https://issues.dlang.org/show_bug.cgi?id=14834 * If the captured context is a function, * this excessive instantiation may cause ODR violation, because * -allInst and others doesn't guarantee the semantic3 execution * for that function. * * If the enclosing is also an instantiated function, * we have to rely on the ancestor's needsCodegen() result. */ if (TemplateInstance ti = enclosing.isInstantiated()) return ti.needsCodegen(); /* https://issues.dlang.org/show_bug.cgi?id=13415 * If and only if the enclosing scope needs codegen, * this nested templates would also need code generation. */ return !enclosing.inNonRoot(); } return true; } if (!minst) { // If this is a speculative instantiation, // 1. do codegen if ancestors really needs codegen. // 2. become non-speculative if siblings are not speculative TemplateInstance tnext = this.tnext; TemplateInstance tinst = this.tinst; // At first, disconnect chain first to prevent infinite recursion. this.tnext = null; this.tinst = null; // Determine necessity of tinst before tnext. if (tinst && tinst.needsCodegen()) { minst = tinst.minst; // cache result assert(minst); assert(minst.isRoot() || minst.rootImports()); return true; } if (tnext && (tnext.needsCodegen() || tnext.minst)) { minst = tnext.minst; // cache result assert(minst); return minst.isRoot() || minst.rootImports(); } // Elide codegen because this is really speculative. return false; } /* Even when this is reached to the codegen pass, * a non-root nested template should not generate code, * due to avoid ODR violation. */ if (enclosing && enclosing.inNonRoot()) { if (tinst) { auto r = tinst.needsCodegen(); minst = tinst.minst; // cache result return r; } if (tnext) { auto r = tnext.needsCodegen(); minst = tnext.minst; // cache result return r; } return false; } /* The issue is that if the importee is compiled with a different -debug * setting than the importer, the importer may believe it exists * in the compiled importee when it does not, when the instantiation * is behind a conditional debug declaration. */ // workaround for https://issues.dlang.org/show_bug.cgi?id=11239 if (global.params.useUnitTests || global.params.debuglevel) { // Prefer instantiations from root modules, to maximize link-ability. if (minst.isRoot()) return true; TemplateInstance tnext = this.tnext; TemplateInstance tinst = this.tinst; this.tnext = null; this.tinst = null; if (tinst && tinst.needsCodegen()) { minst = tinst.minst; // cache result assert(minst); assert(minst.isRoot() || minst.rootImports()); return true; } if (tnext && tnext.needsCodegen()) { minst = tnext.minst; // cache result assert(minst); assert(minst.isRoot() || minst.rootImports()); return true; } // https://issues.dlang.org/show_bug.cgi?id=2500 case if (minst.rootImports()) return true; // Elide codegen because this is not included in root instances. return false; } else { // Prefer instantiations from non-root module, to minimize object code size. /* If a TemplateInstance is ever instantiated by non-root modules, * we do not have to generate code for it, * because it will be generated when the non-root module is compiled. * * But, if the non-root 'minst' imports any root modules, it might still need codegen. * * The problem is if A imports B, and B imports A, and both A * and B instantiate the same template, does the compilation of A * or the compilation of B do the actual instantiation? * * See https://issues.dlang.org/show_bug.cgi?id=2500. */ if (!minst.isRoot() && !minst.rootImports()) return false; TemplateInstance tnext = this.tnext; this.tnext = null; if (tnext && !tnext.needsCodegen() && tnext.minst) { minst = tnext.minst; // cache result assert(!minst.isRoot()); return false; } // Do codegen because this is not included in non-root instances. return true; } } /********************************************** * Find template declaration corresponding to template instance. * * Returns: * false if finding fails. * Note: * This function is reentrant against error occurrence. If returns false, * any members of this object won't be modified, and repetition call will * reproduce same error. */ extern (D) final bool findTempDecl(Scope* sc, WithScopeSymbol* pwithsym) { if (pwithsym) *pwithsym = null; if (havetempdecl) return true; //printf("TemplateInstance.findTempDecl() %s\n", toChars()); if (!tempdecl) { /* Given: * foo!( ... ) * figure out which TemplateDeclaration foo refers to. */ Identifier id = name; Dsymbol scopesym; Dsymbol s = sc.search(loc, id, &scopesym); if (!s) { s = sc.search_correct(id); if (s) error("template `%s` is not defined, did you mean %s?", id.toChars(), s.toChars()); else error("template `%s` is not defined", id.toChars()); return false; } static if (LOG) { printf("It's an instance of '%s' kind '%s'\n", s.toChars(), s.kind()); if (s.parent) printf("s.parent = '%s'\n", s.parent.toChars()); } if (pwithsym) *pwithsym = scopesym.isWithScopeSymbol(); /* We might have found an alias within a template when * we really want the template. */ TemplateInstance ti; if (s.parent && (ti = s.parent.isTemplateInstance()) !is null) { if (ti.tempdecl && ti.tempdecl.ident == id) { /* This is so that one can refer to the enclosing * template, even if it has the same name as a member * of the template, if it has a !(arguments) */ TemplateDeclaration td = ti.tempdecl.isTemplateDeclaration(); assert(td); if (td.overroot) // if not start of overloaded list of TemplateDeclaration's td = td.overroot; // then get the start s = td; } } if (!updateTempDecl(sc, s)) { return false; } } assert(tempdecl); // Look for forward references auto tovers = tempdecl.isOverloadSet(); foreach (size_t oi; 0 .. tovers ? tovers.a.dim : 1) { Dsymbol dstart = tovers ? tovers.a[oi] : tempdecl; int r = overloadApply(dstart, (Dsymbol s) { auto td = s.isTemplateDeclaration(); if (!td) return 0; if (td.semanticRun == PASS.init) { if (td._scope) { // Try to fix forward reference. Ungag errors while doing so. Ungag ungag = td.ungagSpeculative(); td.dsymbolSemantic(td._scope); } if (td.semanticRun == PASS.init) { error("`%s` forward references template declaration `%s`", toChars(), td.toChars()); return 1; } } return 0; }); if (r) return false; } return true; } /********************************************** * Confirm s is a valid template, then store it. * Input: * sc * s candidate symbol of template. It may be: * TemplateDeclaration * FuncDeclaration with findTemplateDeclRoot() != NULL * OverloadSet which contains candidates * Returns: * true if updating succeeds. */ extern (D) final bool updateTempDecl(Scope* sc, Dsymbol s) { if (s) { Identifier id = name; s = s.toAlias(); /* If an OverloadSet, look for a unique member that is a template declaration */ OverloadSet os = s.isOverloadSet(); if (os) { s = null; for (size_t i = 0; i < os.a.dim; i++) { Dsymbol s2 = os.a[i]; if (FuncDeclaration f = s2.isFuncDeclaration()) s2 = f.findTemplateDeclRoot(); else s2 = s2.isTemplateDeclaration(); if (s2) { if (s) { tempdecl = os; return true; } s = s2; } } if (!s) { error("template `%s` is not defined", id.toChars()); return false; } } OverDeclaration od = s.isOverDeclaration(); if (od) { tempdecl = od; // TODO: more strict check return true; } /* It should be a TemplateDeclaration, not some other symbol */ if (FuncDeclaration f = s.isFuncDeclaration()) tempdecl = f.findTemplateDeclRoot(); else tempdecl = s.isTemplateDeclaration(); if (!tempdecl) { if (!s.parent && global.errors) return false; if (!s.parent && s.getType()) { Dsymbol s2 = s.getType().toDsymbol(sc); if (!s2) { .error(loc, "`%s` is not a valid template instance, because `%s` is not a template declaration but a type (`%s == %s`)", toChars(), id.toChars(), id.toChars(), s.getType.kind()); return false; } s = s2; } debug { //if (!s.parent) printf("s = %s %s\n", s.kind(), s.toChars()); } //assert(s.parent); TemplateInstance ti = s.parent ? s.parent.isTemplateInstance() : null; if (ti && (ti.name == s.ident || ti.toAlias().ident == s.ident) && ti.tempdecl) { /* This is so that one can refer to the enclosing * template, even if it has the same name as a member * of the template, if it has a !(arguments) */ TemplateDeclaration td = ti.tempdecl.isTemplateDeclaration(); assert(td); if (td.overroot) // if not start of overloaded list of TemplateDeclaration's td = td.overroot; // then get the start tempdecl = td; } else { error("`%s` is not a template declaration, it is a %s", id.toChars(), s.kind()); return false; } } } return (tempdecl !is null); } /********************************** * Run semantic of tiargs as arguments of template. * Input: * loc * sc * tiargs array of template arguments * flags 1: replace const variables with their initializers * 2: don't devolve Parameter to Type * Returns: * false if one or more arguments have errors. */ extern (D) static bool semanticTiargs(const ref Loc loc, Scope* sc, Objects* tiargs, int flags) { // Run semantic on each argument, place results in tiargs[] //printf("+TemplateInstance.semanticTiargs()\n"); if (!tiargs) return true; bool err = false; for (size_t j = 0; j < tiargs.dim; j++) { RootObject o = (*tiargs)[j]; Type ta = isType(o); Expression ea = isExpression(o); Dsymbol sa = isDsymbol(o); //printf("1: (*tiargs)[%d] = %p, s=%p, v=%p, ea=%p, ta=%p\n", j, o, isDsymbol(o), isTuple(o), ea, ta); if (ta) { //printf("type %s\n", ta.toChars()); // It might really be an Expression or an Alias ta.resolve(loc, sc, &ea, &ta, &sa, (flags & 1) != 0); if (ea) goto Lexpr; if (sa) goto Ldsym; if (ta is null) { assert(global.errors); ta = Type.terror; } Ltype: if (ta.ty == Ttuple) { // Expand tuple TypeTuple tt = cast(TypeTuple)ta; size_t dim = tt.arguments.dim; tiargs.remove(j); if (dim) { tiargs.reserve(dim); for (size_t i = 0; i < dim; i++) { Parameter arg = (*tt.arguments)[i]; if (flags & 2 && (arg.ident || arg.userAttribDecl)) tiargs.insert(j + i, arg); else tiargs.insert(j + i, arg.type); } } j--; continue; } if (ta.ty == Terror) { err = true; continue; } (*tiargs)[j] = ta.merge2(); } else if (ea) { Lexpr: //printf("+[%d] ea = %s %s\n", j, Token.toChars(ea.op), ea.toChars()); if (flags & 1) // only used by __traits { ea = ea.expressionSemantic(sc); // must not interpret the args, excepting template parameters if (ea.op != TOK.variable || ((cast(VarExp)ea).var.storage_class & STC.templateparameter)) { ea = ea.optimize(WANTvalue); } } else { sc = sc.startCTFE(); ea = ea.expressionSemantic(sc); sc = sc.endCTFE(); if (ea.op == TOK.variable) { /* This test is to skip substituting a const var with * its initializer. The problem is the initializer won't * match with an 'alias' parameter. Instead, do the * const substitution in TemplateValueParameter.matchArg(). */ } else if (definitelyValueParameter(ea)) { if (ea.checkValue()) // check void expression ea = new ErrorExp(); uint olderrs = global.errors; ea = ea.ctfeInterpret(); if (global.errors != olderrs) ea = new ErrorExp(); } } //printf("-[%d] ea = %s %s\n", j, Token.toChars(ea.op), ea.toChars()); if (ea.op == TOK.tuple) { // Expand tuple TupleExp te = cast(TupleExp)ea; size_t dim = te.exps.dim; tiargs.remove(j); if (dim) { tiargs.reserve(dim); for (size_t i = 0; i < dim; i++) tiargs.insert(j + i, (*te.exps)[i]); } j--; continue; } if (ea.op == TOK.error) { err = true; continue; } (*tiargs)[j] = ea; if (ea.op == TOK.type) { ta = ea.type; goto Ltype; } if (ea.op == TOK.scope_) { sa = (cast(ScopeExp)ea).sds; goto Ldsym; } if (ea.op == TOK.function_) { FuncExp fe = cast(FuncExp)ea; /* A function literal, that is passed to template and * already semanticed as function pointer, never requires * outer frame. So convert it to global function is valid. */ if (fe.fd.tok == TOK.reserved && fe.type.ty == Tpointer) { // change to non-nested fe.fd.tok = TOK.function_; fe.fd.vthis = null; } else if (fe.td) { /* If template argument is a template lambda, * get template declaration itself. */ //sa = fe.td; //goto Ldsym; } } if (ea.op == TOK.dotVariable && !(flags & 1)) { // translate expression to dsymbol. sa = (cast(DotVarExp)ea).var; goto Ldsym; } if (ea.op == TOK.template_) { sa = (cast(TemplateExp)ea).td; goto Ldsym; } if (ea.op == TOK.dotTemplateDeclaration && !(flags & 1)) { // translate expression to dsymbol. sa = (cast(DotTemplateExp)ea).td; goto Ldsym; } } else if (sa) { Ldsym: //printf("dsym %s %s\n", sa.kind(), sa.toChars()); if (sa.errors) { err = true; continue; } TupleDeclaration d = sa.toAlias().isTupleDeclaration(); if (d) { // Expand tuple tiargs.remove(j); tiargs.insert(j, d.objects); j--; continue; } if (FuncAliasDeclaration fa = sa.isFuncAliasDeclaration()) { FuncDeclaration f = fa.toAliasFunc(); if (!fa.hasOverloads && f.isUnique()) { // Strip FuncAlias only when the aliased function // does not have any overloads. sa = f; } } (*tiargs)[j] = sa; TemplateDeclaration td = sa.isTemplateDeclaration(); if (td && td.semanticRun == PASS.init && td.literal) { td.dsymbolSemantic(sc); } FuncDeclaration fd = sa.isFuncDeclaration(); if (fd) fd.functionSemantic(); } else if (isParameter(o)) { } else { assert(0); } //printf("1: (*tiargs)[%d] = %p\n", j, (*tiargs)[j]); } version (none) { printf("-TemplateInstance.semanticTiargs()\n"); for (size_t j = 0; j < tiargs.dim; j++) { RootObject o = (*tiargs)[j]; Type ta = isType(o); Expression ea = isExpression(o); Dsymbol sa = isDsymbol(o); Tuple va = isTuple(o); printf("\ttiargs[%d] = ta %p, ea %p, sa %p, va %p\n", j, ta, ea, sa, va); } } return !err; } /********************************** * Run semantic on the elements of tiargs. * Input: * sc * Returns: * false if one or more arguments have errors. * Note: * This function is reentrant against error occurrence. If returns false, * all elements of tiargs won't be modified. */ extern (D) final bool semanticTiargs(Scope* sc) { //printf("+TemplateInstance.semanticTiargs() %s\n", toChars()); if (semantictiargsdone) return true; if (semanticTiargs(loc, sc, tiargs, 0)) { // cache the result iff semantic analysis succeeded entirely semantictiargsdone = 1; return true; } return false; } extern (D) final bool findBestMatch(Scope* sc, Expressions* fargs) { if (havetempdecl) { TemplateDeclaration tempdecl = this.tempdecl.isTemplateDeclaration(); assert(tempdecl); assert(tempdecl._scope); // Deduce tdtypes tdtypes.setDim(tempdecl.parameters.dim); if (!tempdecl.matchWithInstance(sc, this, &tdtypes, fargs, 2)) { error("incompatible arguments for template instantiation"); return false; } // TODO: Normalizing tiargs for https://issues.dlang.org/show_bug.cgi?id=7469 is necessary? return true; } static if (LOG) { printf("TemplateInstance.findBestMatch()\n"); } uint errs = global.errors; TemplateDeclaration td_last = null; Objects dedtypes; /* Since there can be multiple TemplateDeclaration's with the same * name, look for the best match. */ auto tovers = tempdecl.isOverloadSet(); foreach (size_t oi; 0 .. tovers ? tovers.a.dim : 1) { TemplateDeclaration td_best; TemplateDeclaration td_ambig; MATCH m_best = MATCH.nomatch; Dsymbol dstart = tovers ? tovers.a[oi] : tempdecl; overloadApply(dstart, (Dsymbol s) { auto td = s.isTemplateDeclaration(); if (!td) return 0; if (td.inuse) { td.error(loc, "recursive template expansion"); return 1; } if (td == td_best) // skip duplicates return 0; //printf("td = %s\n", td.toPrettyChars()); // If more arguments than parameters, // then this is no match. if (td.parameters.dim < tiargs.dim) { if (!td.isVariadic()) return 0; } dedtypes.setDim(td.parameters.dim); dedtypes.zero(); assert(td.semanticRun != PASS.init); MATCH m = td.matchWithInstance(sc, this, &dedtypes, fargs, 0); //printf("matchWithInstance = %d\n", m); if (m <= MATCH.nomatch) // no match at all return 0; if (m < m_best) goto Ltd_best; if (m > m_best) goto Ltd; // Disambiguate by picking the most specialized TemplateDeclaration { MATCH c1 = td.leastAsSpecialized(sc, td_best, fargs); MATCH c2 = td_best.leastAsSpecialized(sc, td, fargs); //printf("c1 = %d, c2 = %d\n", c1, c2); if (c1 > c2) goto Ltd; if (c1 < c2) goto Ltd_best; } td_ambig = td; return 0; Ltd_best: // td_best is the best match so far td_ambig = null; return 0; Ltd: // td is the new best match td_ambig = null; td_best = td; m_best = m; tdtypes.setDim(dedtypes.dim); memcpy(tdtypes.tdata(), dedtypes.tdata(), tdtypes.dim * (void*).sizeof); return 0; }); if (td_ambig) { .error(loc, "%s `%s.%s` matches more than one template declaration:\n%s: `%s`\nand\n%s: `%s`", td_best.kind(), td_best.parent.toPrettyChars(), td_best.ident.toChars(), td_best.loc.toChars(), td_best.toChars(), td_ambig.loc.toChars(), td_ambig.toChars()); return false; } if (td_best) { if (!td_last) td_last = td_best; else if (td_last != td_best) { ScopeDsymbol.multiplyDefined(loc, td_last, td_best); return false; } } } if (td_last) { /* https://issues.dlang.org/show_bug.cgi?id=7469 * Normalize tiargs by using corresponding deduced * template value parameters and tuples for the correct mangling. * * By doing this before hasNestedArgs, CTFEable local variable will be * accepted as a value parameter. For example: * * void foo() { * struct S(int n) {} // non-global template * const int num = 1; // CTFEable local variable * S!num s; // S!1 is instantiated, not S!num * } */ size_t dim = td_last.parameters.dim - (td_last.isVariadic() ? 1 : 0); for (size_t i = 0; i < dim; i++) { if (tiargs.dim <= i) tiargs.push(tdtypes[i]); assert(i < tiargs.dim); auto tvp = (*td_last.parameters)[i].isTemplateValueParameter(); if (!tvp) continue; assert(tdtypes[i]); // tdtypes[i] is already normalized to the required type in matchArg (*tiargs)[i] = tdtypes[i]; } if (td_last.isVariadic() && tiargs.dim == dim && tdtypes[dim]) { Tuple va = isTuple(tdtypes[dim]); assert(va); tiargs.pushSlice(va.objects[]); } } else if (errors && inst) { // instantiation was failed with error reporting assert(global.errors); return false; } else { auto tdecl = tempdecl.isTemplateDeclaration(); if (errs != global.errors) errorSupplemental(loc, "while looking for match for `%s`", toChars()); else if (tdecl && !tdecl.overnext) { // Only one template, so we can give better error message error("does not match template declaration `%s`", tdecl.toChars()); } else .error(loc, "%s `%s.%s` does not match any template declaration", tempdecl.kind(), tempdecl.parent.toPrettyChars(), tempdecl.ident.toChars()); return false; } /* The best match is td_last */ tempdecl = td_last; static if (LOG) { printf("\tIt's a match with template declaration '%s'\n", tempdecl.toChars()); } return (errs == global.errors); } /***************************************************** * Determine if template instance is really a template function, * and that template function needs to infer types from the function * arguments. * * Like findBestMatch, iterate possible template candidates, * but just looks only the necessity of type inference. */ extern (D) final bool needsTypeInference(Scope* sc, int flag = 0) { //printf("TemplateInstance.needsTypeInference() %s\n", toChars()); if (semanticRun != PASS.init) return false; uint olderrs = global.errors; Objects dedtypes; size_t count = 0; auto tovers = tempdecl.isOverloadSet(); foreach (size_t oi; 0 .. tovers ? tovers.a.dim : 1) { Dsymbol dstart = tovers ? tovers.a[oi] : tempdecl; int r = overloadApply(dstart, (Dsymbol s) { auto td = s.isTemplateDeclaration(); if (!td) return 0; if (td.inuse) { td.error(loc, "recursive template expansion"); return 1; } /* If any of the overloaded template declarations need inference, * then return true */ if (!td.onemember) return 0; if (auto td2 = td.onemember.isTemplateDeclaration()) { if (!td2.onemember || !td2.onemember.isFuncDeclaration()) return 0; if (tiargs.dim >= td.parameters.dim - (td.isVariadic() ? 1 : 0)) return 0; return 1; } auto fd = td.onemember.isFuncDeclaration(); if (!fd || fd.type.ty != Tfunction) return 0; foreach (tp; *td.parameters) { if (tp.isTemplateThisParameter()) return 1; } /* Determine if the instance arguments, tiargs, are all that is necessary * to instantiate the template. */ //printf("tp = %p, td.parameters.dim = %d, tiargs.dim = %d\n", tp, td.parameters.dim, tiargs.dim); auto tf = cast(TypeFunction)fd.type; if (size_t dim = tf.parameterList.length) { auto tp = td.isVariadic(); if (tp && td.parameters.dim > 1) return 1; if (!tp && tiargs.dim < td.parameters.dim) { // Can remain tiargs be filled by default arguments? foreach (size_t i; tiargs.dim .. td.parameters.dim) { if (!(*td.parameters)[i].hasDefaultArg()) return 1; } } foreach (size_t i; 0 .. dim) { // 'auto ref' needs inference. if (tf.parameterList[i].storageClass & STC.auto_) return 1; } } if (!flag) { /* Calculate the need for overload resolution. * When only one template can match with tiargs, inference is not necessary. */ dedtypes.setDim(td.parameters.dim); dedtypes.zero(); if (td.semanticRun == PASS.init) { if (td._scope) { // Try to fix forward reference. Ungag errors while doing so. Ungag ungag = td.ungagSpeculative(); td.dsymbolSemantic(td._scope); } if (td.semanticRun == PASS.init) { error("`%s` forward references template declaration `%s`", toChars(), td.toChars()); return 1; } } MATCH m = td.matchWithInstance(sc, this, &dedtypes, null, 0); if (m <= MATCH.nomatch) return 0; } /* If there is more than one function template which matches, we may * need type inference (see https://issues.dlang.org/show_bug.cgi?id=4430) */ return ++count > 1 ? 1 : 0; }); if (r) return true; } if (olderrs != global.errors) { if (!global.gag) { errorSupplemental(loc, "while looking for match for `%s`", toChars()); semanticRun = PASS.semanticdone; inst = this; } errors = true; } //printf("false\n"); return false; } /***************************************** * Determines if a TemplateInstance will need a nested * generation of the TemplateDeclaration. * Sets enclosing property if so, and returns != 0; */ extern (D) final bool hasNestedArgs(Objects* args, bool isstatic) { int nested = 0; //printf("TemplateInstance.hasNestedArgs('%s')\n", tempdecl.ident.toChars()); version (none) { if (!enclosing) { if (TemplateInstance ti = tempdecl.isInstantiated()) enclosing = ti.enclosing; } } /* A nested instance happens when an argument references a local * symbol that is on the stack. */ for (size_t i = 0; i < args.dim; i++) { RootObject o = (*args)[i]; Expression ea = isExpression(o); Dsymbol sa = isDsymbol(o); Tuple va = isTuple(o); if (ea) { if (ea.op == TOK.variable) { sa = (cast(VarExp)ea).var; goto Lsa; } if (ea.op == TOK.this_) { sa = (cast(ThisExp)ea).var; goto Lsa; } if (ea.op == TOK.function_) { if ((cast(FuncExp)ea).td) sa = (cast(FuncExp)ea).td; else sa = (cast(FuncExp)ea).fd; goto Lsa; } // Emulate Expression.toMangleBuffer call that had exist in TemplateInstance.genIdent. if (ea.op != TOK.int64 && ea.op != TOK.float64 && ea.op != TOK.complex80 && ea.op != TOK.null_ && ea.op != TOK.string_ && ea.op != TOK.arrayLiteral && ea.op != TOK.assocArrayLiteral && ea.op != TOK.structLiteral) { ea.error("expression `%s` is not a valid template value argument", ea.toChars()); errors = true; } } else if (sa) { Lsa: sa = sa.toAlias(); TemplateDeclaration td = sa.isTemplateDeclaration(); if (td) { TemplateInstance ti = sa.toParent().isTemplateInstance(); if (ti && ti.enclosing) sa = ti; } TemplateInstance ti = sa.isTemplateInstance(); Declaration d = sa.isDeclaration(); if ((td && td.literal) || (ti && ti.enclosing) || (d && !d.isDataseg() && !(d.storage_class & STC.manifest) && (!d.isFuncDeclaration() || d.isFuncDeclaration().isNested()) && !isTemplateMixin())) { // if module level template if (isstatic) { Dsymbol dparent = sa.toParent2(); if (!dparent) goto L1; else if (!enclosing) enclosing = dparent; else if (enclosing != dparent) { /* Select the more deeply nested of the two. * Error if one is not nested inside the other. */ for (Dsymbol p = enclosing; p; p = p.parent) { if (p == dparent) goto L1; // enclosing is most nested } for (Dsymbol p = dparent; p; p = p.parent) { if (p == enclosing) { enclosing = dparent; goto L1; // dparent is most nested } } error("`%s` is nested in both `%s` and `%s`", toChars(), enclosing.toChars(), dparent.toChars()); errors = true; } L1: //printf("\tnested inside %s\n", enclosing.toChars()); nested |= 1; } else { error("cannot use local `%s` as parameter to non-global template `%s`", sa.toChars(), tempdecl.toChars()); errors = true; } } } else if (va) { nested |= cast(int)hasNestedArgs(&va.objects, isstatic); } } //printf("-TemplateInstance.hasNestedArgs('%s') = %d\n", tempdecl.ident.toChars(), nested); return nested != 0; } /***************************************** * Append 'this' to the specific module members[] */ extern (D) final Dsymbols* appendToModuleMember() { Module mi = minst; // instantiated . inserted module if (global.params.useUnitTests || global.params.debuglevel) { // Turn all non-root instances to speculative if (mi && !mi.isRoot()) mi = null; } //printf("%s.appendToModuleMember() enclosing = %s mi = %s\n", // toPrettyChars(), // enclosing ? enclosing.toPrettyChars() : null, // mi ? mi.toPrettyChars() : null); if (!mi || mi.isRoot()) { /* If the instantiated module is speculative or root, insert to the * member of a root module. Then: * - semantic3 pass will get called on the instance members. * - codegen pass will get a selection chance to do/skip it. */ static Dsymbol getStrictEnclosing(TemplateInstance ti) { do { if (ti.enclosing) return ti.enclosing; ti = ti.tempdecl.isInstantiated(); } while (ti); return null; } Dsymbol enc = getStrictEnclosing(this); // insert target is made stable by using the module // where tempdecl is declared. mi = (enc ? enc : tempdecl).getModule(); if (!mi.isRoot()) mi = mi.importedFrom; assert(mi.isRoot()); } else { /* If the instantiated module is non-root, insert to the member of the * non-root module. Then: * - semantic3 pass won't be called on the instance. * - codegen pass won't reach to the instance. */ } //printf("\t-. mi = %s\n", mi.toPrettyChars()); if (memberOf is mi) // already a member { debug // make sure it really is a member { auto a = mi.members; for (size_t i = 0; 1; ++i) { assert(i != a.dim); if (this == (*a)[i]) break; } } return null; } Dsymbols* a = mi.members; a.push(this); memberOf = mi; if (mi.semanticRun >= PASS.semantic2done && mi.isRoot()) Module.addDeferredSemantic2(this); if (mi.semanticRun >= PASS.semantic3done && mi.isRoot()) Module.addDeferredSemantic3(this); return a; } /**************************************************** * Declare parameters of template instance, initialize them with the * template instance arguments. */ extern (D) final void declareParameters(Scope* sc) { TemplateDeclaration tempdecl = this.tempdecl.isTemplateDeclaration(); assert(tempdecl); //printf("TemplateInstance.declareParameters()\n"); for (size_t i = 0; i < tdtypes.dim; i++) { TemplateParameter tp = (*tempdecl.parameters)[i]; //RootObject *o = (*tiargs)[i]; RootObject o = tdtypes[i]; // initializer for tp //printf("\ttdtypes[%d] = %p\n", i, o); tempdecl.declareParameter(sc, tp, o); } } /**************************************** * This instance needs an identifier for name mangling purposes. * Create one by taking the template declaration name and adding * the type signature for it. */ extern (D) final Identifier genIdent(Objects* args) { //printf("TemplateInstance.genIdent('%s')\n", tempdecl.ident.toChars()); assert(args is tiargs); OutBuffer buf; mangleToBuffer(this, &buf); //printf("\tgenIdent = %s\n", buf.peekString()); return Identifier.idPool(buf.peekSlice()); } extern (D) final void expandMembers(Scope* sc2) { members.foreachDsymbol( (s) { s.setScope (sc2); } ); members.foreachDsymbol( (s) { s.importAll(sc2); } ); void symbolDg(Dsymbol s) { //printf("\t[%d] semantic on '%s' %p kind %s in '%s'\n", i, s.toChars(), s, s.kind(), this.toChars()); //printf("test: enclosing = %d, sc2.parent = %s\n", enclosing, sc2.parent.toChars()); //if (enclosing) // s.parent = sc.parent; //printf("test3: enclosing = %d, s.parent = %s\n", enclosing, s.parent.toChars()); s.dsymbolSemantic(sc2); //printf("test4: enclosing = %d, s.parent = %s\n", enclosing, s.parent.toChars()); Module.runDeferredSemantic(); } members.foreachDsymbol(&symbolDg); } extern (D) final void tryExpandMembers(Scope* sc2) { __gshared int nest; // extracted to a function to allow windows SEH to work without destructors in the same function //printf("%d\n", nest); if (++nest > 500) { global.gag = 0; // ensure error message gets printed error("recursive expansion"); fatal(); } expandMembers(sc2); nest--; } extern (D) final void trySemantic3(Scope* sc2) { // extracted to a function to allow windows SEH to work without destructors in the same function __gshared int nest; //printf("%d\n", nest); if (++nest > 300) { global.gag = 0; // ensure error message gets printed error("recursive expansion"); fatal(); } semantic3(this, sc2); --nest; } override final inout(TemplateInstance) isTemplateInstance() inout { return this; } override void accept(Visitor v) { v.visit(this); } } /************************************** * IsExpression can evaluate the specified type speculatively, and even if * it instantiates any symbols, they are normally unnecessary for the * final executable. * However, if those symbols leak to the actual code, compiler should remark * them as non-speculative to generate their code and link to the final executable. */ void unSpeculative(Scope* sc, RootObject o) { if (!o) return; if (Tuple tup = isTuple(o)) { for (size_t i = 0; i < tup.objects.dim; i++) { unSpeculative(sc, tup.objects[i]); } return; } Dsymbol s = getDsymbol(o); if (!s) return; if (Declaration d = s.isDeclaration()) { if (VarDeclaration vd = d.isVarDeclaration()) o = vd.type; else if (AliasDeclaration ad = d.isAliasDeclaration()) { o = ad.getType(); if (!o) o = ad.toAlias(); } else o = d.toAlias(); s = getDsymbol(o); if (!s) return; } if (TemplateInstance ti = s.isTemplateInstance()) { // If the instance is already non-speculative, // or it is leaked to the speculative scope. if (ti.minst !is null || sc.minst is null) return; // Remark as non-speculative instance. ti.minst = sc.minst; if (!ti.tinst) ti.tinst = sc.tinst; unSpeculative(sc, ti.tempdecl); } if (TemplateInstance ti = s.isInstantiated()) unSpeculative(sc, ti); } /********************************** * Return true if e could be valid only as a template value parameter. * Return false if it might be an alias or tuple. * (Note that even in this case, it could still turn out to be a value). */ bool definitelyValueParameter(Expression e) { // None of these can be value parameters if (e.op == TOK.tuple || e.op == TOK.scope_ || e.op == TOK.type || e.op == TOK.dotType || e.op == TOK.template_ || e.op == TOK.dotTemplateDeclaration || e.op == TOK.function_ || e.op == TOK.error || e.op == TOK.this_ || e.op == TOK.super_) return false; if (e.op != TOK.dotVariable) return true; /* Template instantiations involving a DotVar expression are difficult. * In most cases, they should be treated as a value parameter, and interpreted. * But they might also just be a fully qualified name, which should be treated * as an alias. */ // x.y.f cannot be a value FuncDeclaration f = (cast(DotVarExp)e).var.isFuncDeclaration(); if (f) return false; while (e.op == TOK.dotVariable) { e = (cast(DotVarExp)e).e1; } // this.x.y and super.x.y couldn't possibly be valid values. if (e.op == TOK.this_ || e.op == TOK.super_) return false; // e.type.x could be an alias if (e.op == TOK.dotType) return false; // var.x.y is the only other possible form of alias if (e.op != TOK.variable) return true; VarDeclaration v = (cast(VarExp)e).var.isVarDeclaration(); // func.x.y is not an alias if (!v) return true; // https://issues.dlang.org/show_bug.cgi?id=16685 // var.x.y where var is a constant available at compile time if (v.storage_class & STC.manifest) return true; // TODO: Should we force CTFE if it is a global constant? return false; } /*********************************************************** * https://dlang.org/spec/template-mixin.html * Syntax: * mixin MixinTemplateName [TemplateArguments] [Identifier]; */ extern (C++) final class TemplateMixin : TemplateInstance { TypeQualified tqual; extern (D) this(const ref Loc loc, Identifier ident, TypeQualified tqual, Objects* tiargs) { super(loc, tqual.idents.dim ? cast(Identifier)tqual.idents[tqual.idents.dim - 1] : (cast(TypeIdentifier)tqual).ident, tiargs ? tiargs : new Objects()); //printf("TemplateMixin(ident = '%s')\n", ident ? ident.toChars() : ""); this.ident = ident; this.tqual = tqual; } override Dsymbol syntaxCopy(Dsymbol s) { auto tm = new TemplateMixin(loc, ident, cast(TypeQualified)tqual.syntaxCopy(), tiargs); return TemplateInstance.syntaxCopy(tm); } override const(char)* kind() const { return "mixin"; } override bool oneMember(Dsymbol* ps, Identifier ident) { return Dsymbol.oneMember(ps, ident); } override int apply(Dsymbol_apply_ft_t fp, void* param) { if (_scope) // if fwd reference dsymbolSemantic(this, null); // try to resolve it return members.foreachDsymbol( (s) { return s && s.apply(fp, param); } ); } override bool hasPointers() { //printf("TemplateMixin.hasPointers() %s\n", toChars()); return members.foreachDsymbol( (s) { return s.hasPointers(); } ) != 0; } override void setFieldOffset(AggregateDeclaration ad, uint* poffset, bool isunion) { //printf("TemplateMixin.setFieldOffset() %s\n", toChars()); if (_scope) // if fwd reference dsymbolSemantic(this, null); // try to resolve it members.foreachDsymbol( (s) { s.setFieldOffset(ad, poffset, isunion); } ); } override const(char)* toChars() { OutBuffer buf; toCBufferInstance(this, &buf); return buf.extractString(); } extern (D) bool findTempDecl(Scope* sc) { // Follow qualifications to find the TemplateDeclaration if (!tempdecl) { Expression e; Type t; Dsymbol s; tqual.resolve(loc, sc, &e, &t, &s); if (!s) { error("is not defined"); return false; } s = s.toAlias(); tempdecl = s.isTemplateDeclaration(); OverloadSet os = s.isOverloadSet(); /* If an OverloadSet, look for a unique member that is a template declaration */ if (os) { Dsymbol ds = null; for (size_t i = 0; i < os.a.dim; i++) { Dsymbol s2 = os.a[i].isTemplateDeclaration(); if (s2) { if (ds) { tempdecl = os; break; } ds = s2; } } } if (!tempdecl) { error("`%s` isn't a template", s.toChars()); return false; } } assert(tempdecl); // Look for forward references auto tovers = tempdecl.isOverloadSet(); foreach (size_t oi; 0 .. tovers ? tovers.a.dim : 1) { Dsymbol dstart = tovers ? tovers.a[oi] : tempdecl; int r = overloadApply(dstart, (Dsymbol s) { auto td = s.isTemplateDeclaration(); if (!td) return 0; if (td.semanticRun == PASS.init) { if (td._scope) td.dsymbolSemantic(td._scope); else { semanticRun = PASS.init; return 1; } } return 0; }); if (r) return false; } return true; } override inout(TemplateMixin) isTemplateMixin() inout { return this; } override void accept(Visitor v) { v.visit(this); } } /************************************ * This struct is needed for TemplateInstance to be the key in an associative array. * Fixing https://issues.dlang.org/show_bug.cgi?id=15812 and * https://issues.dlang.org/show_bug.cgi?id=15813 would make it unnecessary. */ struct TemplateInstanceBox { TemplateInstance ti; this(TemplateInstance ti) { this.ti = ti; this.ti.toHash(); assert(this.ti.hash); } size_t toHash() const @trusted pure nothrow { assert(ti.hash); return ti.hash; } bool opEquals(ref const TemplateInstanceBox s) @trusted const { bool res = void; if (ti.inst && s.ti.inst) /* This clause is only used when an instance with errors * is replaced with a correct instance. */ res = ti is s.ti; else /* Used when a proposed instance is used to see if there's * an existing instance. */ res = (cast()s.ti).compare(cast()ti) == 0; debug (FindExistingInstance) ++(res ? nHits : nCollisions); return res; } debug (FindExistingInstance) { __gshared uint nHits, nCollisions; shared static ~this() { printf("debug (FindExistingInstance) TemplateInstanceBox.equals hits: %u collisions: %u\n", nHits, nCollisions); } } }
D
/Users/lb/Documents/Project/LearnVapor/.build/x86_64-apple-macosx10.10/debug/Validation.build/Validators/OrValidator.swift.o : /Users/lb/Documents/Project/LearnVapor/.build/checkouts/validation.git--4420399646601355644/Sources/Validation/Validatable.swift /Users/lb/Documents/Project/LearnVapor/.build/checkouts/validation.git--4420399646601355644/Sources/Validation/ValidatorType.swift /Users/lb/Documents/Project/LearnVapor/.build/checkouts/validation.git--4420399646601355644/Sources/Validation/ValidationError.swift /Users/lb/Documents/Project/LearnVapor/.build/checkouts/validation.git--4420399646601355644/Sources/Validation/Validator.swift /Users/lb/Documents/Project/LearnVapor/.build/checkouts/validation.git--4420399646601355644/Sources/Validation/Validators/URLValidator.swift /Users/lb/Documents/Project/LearnVapor/.build/checkouts/validation.git--4420399646601355644/Sources/Validation/Validators/AndValidator.swift /Users/lb/Documents/Project/LearnVapor/.build/checkouts/validation.git--4420399646601355644/Sources/Validation/Validators/RangeValidator.swift /Users/lb/Documents/Project/LearnVapor/.build/checkouts/validation.git--4420399646601355644/Sources/Validation/Validators/NilIgnoringValidator.swift /Users/lb/Documents/Project/LearnVapor/.build/checkouts/validation.git--4420399646601355644/Sources/Validation/Validators/NilValidator.swift /Users/lb/Documents/Project/LearnVapor/.build/checkouts/validation.git--4420399646601355644/Sources/Validation/Validators/EmailValidator.swift /Users/lb/Documents/Project/LearnVapor/.build/checkouts/validation.git--4420399646601355644/Sources/Validation/Validators/InValidator.swift /Users/lb/Documents/Project/LearnVapor/.build/checkouts/validation.git--4420399646601355644/Sources/Validation/Validators/OrValidator.swift /Users/lb/Documents/Project/LearnVapor/.build/checkouts/validation.git--4420399646601355644/Sources/Validation/Validators/CharacterSetValidator.swift /Users/lb/Documents/Project/LearnVapor/.build/checkouts/validation.git--4420399646601355644/Sources/Validation/Validators/CountValidator.swift /Users/lb/Documents/Project/LearnVapor/.build/checkouts/validation.git--4420399646601355644/Sources/Validation/Validators/NotValidator.swift /Users/lb/Documents/Project/LearnVapor/.build/checkouts/validation.git--4420399646601355644/Sources/Validation/Validators/EmptyValidator.swift /Users/lb/Documents/Project/LearnVapor/.build/checkouts/validation.git--4420399646601355644/Sources/Validation/Validations.swift /Users/lb/Documents/Project/LearnVapor/.build/checkouts/validation.git--4420399646601355644/Sources/Validation/Exports.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/ObjectiveC.swiftmodule /Users/lb/Documents/Project/LearnVapor/.build/x86_64-apple-macosx10.10/debug/NIO.swiftmodule /Users/lb/Documents/Project/LearnVapor/.build/x86_64-apple-macosx10.10/debug/Async.swiftmodule /Users/lb/Documents/Project/LearnVapor/.build/x86_64-apple-macosx10.10/debug/Core.swiftmodule /Users/lb/Documents/Project/LearnVapor/.build/x86_64-apple-macosx10.10/debug/Debugging.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Dispatch.swiftmodule /Users/lb/Documents/Project/LearnVapor/.build/x86_64-apple-macosx10.10/debug/COperatingSystem.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 /Users/lb/Documents/Project/LearnVapor/.build/x86_64-apple-macosx10.10/debug/NIOConcurrencyHelpers.swiftmodule /Users/lb/Documents/Project/LearnVapor/.build/x86_64-apple-macosx10.10/debug/Bits.swiftmodule /Users/lb/Documents/Project/LearnVapor/.build/x86_64-apple-macosx10.10/debug/NIOFoundationCompat.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/lb/Documents/Project/LearnVapor/.build/checkouts/swift-nio.git-8756902686293799568/Sources/CNIOAtomics/include/cpp_magic.h /Users/lb/Documents/Project/LearnVapor/.build/checkouts/swift-nio.git-8756902686293799568/Sources/CNIODarwin/include/c_nio_darwin.h /Users/lb/Documents/Project/LearnVapor/.build/checkouts/swift-nio.git-8756902686293799568/Sources/CNIOAtomics/include/c-atomics.h /Users/lb/Documents/Project/LearnVapor/.build/checkouts/swift-nio.git-8756902686293799568/Sources/CNIOLinux/include/c_nio_linux.h /Users/lb/Documents/Project/LearnVapor/.build/checkouts/swift-nio-zlib-support.git--4783613459776704231/module.modulemap /Users/lb/Documents/Project/LearnVapor/.build/x86_64-apple-macosx10.10/debug/CNIOSHA1.build/module.modulemap /Users/lb/Documents/Project/LearnVapor/.build/x86_64-apple-macosx10.10/debug/CNIOOpenSSL.build/module.modulemap /Users/lb/Documents/Project/LearnVapor/.build/x86_64-apple-macosx10.10/debug/CCryptoOpenSSL.build/module.modulemap /Users/lb/Documents/Project/LearnVapor/.build/x86_64-apple-macosx10.10/debug/CNIOZlib.build/module.modulemap /Users/lb/Documents/Project/LearnVapor/.build/x86_64-apple-macosx10.10/debug/CNIODarwin.build/module.modulemap /Users/lb/Documents/Project/LearnVapor/.build/x86_64-apple-macosx10.10/debug/CNIOHTTPParser.build/module.modulemap /Users/lb/Documents/Project/LearnVapor/.build/x86_64-apple-macosx10.10/debug/CNIOAtomics.build/module.modulemap /Users/lb/Documents/Project/LearnVapor/.build/x86_64-apple-macosx10.10/debug/CNIOLinux.build/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/lb/Documents/Project/LearnVapor/.build/x86_64-apple-macosx10.10/debug/Validation.build/OrValidator~partial.swiftmodule : /Users/lb/Documents/Project/LearnVapor/.build/checkouts/validation.git--4420399646601355644/Sources/Validation/Validatable.swift /Users/lb/Documents/Project/LearnVapor/.build/checkouts/validation.git--4420399646601355644/Sources/Validation/ValidatorType.swift /Users/lb/Documents/Project/LearnVapor/.build/checkouts/validation.git--4420399646601355644/Sources/Validation/ValidationError.swift /Users/lb/Documents/Project/LearnVapor/.build/checkouts/validation.git--4420399646601355644/Sources/Validation/Validator.swift /Users/lb/Documents/Project/LearnVapor/.build/checkouts/validation.git--4420399646601355644/Sources/Validation/Validators/URLValidator.swift /Users/lb/Documents/Project/LearnVapor/.build/checkouts/validation.git--4420399646601355644/Sources/Validation/Validators/AndValidator.swift /Users/lb/Documents/Project/LearnVapor/.build/checkouts/validation.git--4420399646601355644/Sources/Validation/Validators/RangeValidator.swift /Users/lb/Documents/Project/LearnVapor/.build/checkouts/validation.git--4420399646601355644/Sources/Validation/Validators/NilIgnoringValidator.swift /Users/lb/Documents/Project/LearnVapor/.build/checkouts/validation.git--4420399646601355644/Sources/Validation/Validators/NilValidator.swift /Users/lb/Documents/Project/LearnVapor/.build/checkouts/validation.git--4420399646601355644/Sources/Validation/Validators/EmailValidator.swift /Users/lb/Documents/Project/LearnVapor/.build/checkouts/validation.git--4420399646601355644/Sources/Validation/Validators/InValidator.swift /Users/lb/Documents/Project/LearnVapor/.build/checkouts/validation.git--4420399646601355644/Sources/Validation/Validators/OrValidator.swift /Users/lb/Documents/Project/LearnVapor/.build/checkouts/validation.git--4420399646601355644/Sources/Validation/Validators/CharacterSetValidator.swift /Users/lb/Documents/Project/LearnVapor/.build/checkouts/validation.git--4420399646601355644/Sources/Validation/Validators/CountValidator.swift /Users/lb/Documents/Project/LearnVapor/.build/checkouts/validation.git--4420399646601355644/Sources/Validation/Validators/NotValidator.swift /Users/lb/Documents/Project/LearnVapor/.build/checkouts/validation.git--4420399646601355644/Sources/Validation/Validators/EmptyValidator.swift /Users/lb/Documents/Project/LearnVapor/.build/checkouts/validation.git--4420399646601355644/Sources/Validation/Validations.swift /Users/lb/Documents/Project/LearnVapor/.build/checkouts/validation.git--4420399646601355644/Sources/Validation/Exports.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/ObjectiveC.swiftmodule /Users/lb/Documents/Project/LearnVapor/.build/x86_64-apple-macosx10.10/debug/NIO.swiftmodule /Users/lb/Documents/Project/LearnVapor/.build/x86_64-apple-macosx10.10/debug/Async.swiftmodule /Users/lb/Documents/Project/LearnVapor/.build/x86_64-apple-macosx10.10/debug/Core.swiftmodule /Users/lb/Documents/Project/LearnVapor/.build/x86_64-apple-macosx10.10/debug/Debugging.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Dispatch.swiftmodule /Users/lb/Documents/Project/LearnVapor/.build/x86_64-apple-macosx10.10/debug/COperatingSystem.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 /Users/lb/Documents/Project/LearnVapor/.build/x86_64-apple-macosx10.10/debug/NIOConcurrencyHelpers.swiftmodule /Users/lb/Documents/Project/LearnVapor/.build/x86_64-apple-macosx10.10/debug/Bits.swiftmodule /Users/lb/Documents/Project/LearnVapor/.build/x86_64-apple-macosx10.10/debug/NIOFoundationCompat.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/lb/Documents/Project/LearnVapor/.build/checkouts/swift-nio.git-8756902686293799568/Sources/CNIOAtomics/include/cpp_magic.h /Users/lb/Documents/Project/LearnVapor/.build/checkouts/swift-nio.git-8756902686293799568/Sources/CNIODarwin/include/c_nio_darwin.h /Users/lb/Documents/Project/LearnVapor/.build/checkouts/swift-nio.git-8756902686293799568/Sources/CNIOAtomics/include/c-atomics.h /Users/lb/Documents/Project/LearnVapor/.build/checkouts/swift-nio.git-8756902686293799568/Sources/CNIOLinux/include/c_nio_linux.h /Users/lb/Documents/Project/LearnVapor/.build/checkouts/swift-nio-zlib-support.git--4783613459776704231/module.modulemap /Users/lb/Documents/Project/LearnVapor/.build/x86_64-apple-macosx10.10/debug/CNIOSHA1.build/module.modulemap /Users/lb/Documents/Project/LearnVapor/.build/x86_64-apple-macosx10.10/debug/CNIOOpenSSL.build/module.modulemap /Users/lb/Documents/Project/LearnVapor/.build/x86_64-apple-macosx10.10/debug/CCryptoOpenSSL.build/module.modulemap /Users/lb/Documents/Project/LearnVapor/.build/x86_64-apple-macosx10.10/debug/CNIOZlib.build/module.modulemap /Users/lb/Documents/Project/LearnVapor/.build/x86_64-apple-macosx10.10/debug/CNIODarwin.build/module.modulemap /Users/lb/Documents/Project/LearnVapor/.build/x86_64-apple-macosx10.10/debug/CNIOHTTPParser.build/module.modulemap /Users/lb/Documents/Project/LearnVapor/.build/x86_64-apple-macosx10.10/debug/CNIOAtomics.build/module.modulemap /Users/lb/Documents/Project/LearnVapor/.build/x86_64-apple-macosx10.10/debug/CNIOLinux.build/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/lb/Documents/Project/LearnVapor/.build/x86_64-apple-macosx10.10/debug/Validation.build/OrValidator~partial.swiftdoc : /Users/lb/Documents/Project/LearnVapor/.build/checkouts/validation.git--4420399646601355644/Sources/Validation/Validatable.swift /Users/lb/Documents/Project/LearnVapor/.build/checkouts/validation.git--4420399646601355644/Sources/Validation/ValidatorType.swift /Users/lb/Documents/Project/LearnVapor/.build/checkouts/validation.git--4420399646601355644/Sources/Validation/ValidationError.swift /Users/lb/Documents/Project/LearnVapor/.build/checkouts/validation.git--4420399646601355644/Sources/Validation/Validator.swift /Users/lb/Documents/Project/LearnVapor/.build/checkouts/validation.git--4420399646601355644/Sources/Validation/Validators/URLValidator.swift /Users/lb/Documents/Project/LearnVapor/.build/checkouts/validation.git--4420399646601355644/Sources/Validation/Validators/AndValidator.swift /Users/lb/Documents/Project/LearnVapor/.build/checkouts/validation.git--4420399646601355644/Sources/Validation/Validators/RangeValidator.swift /Users/lb/Documents/Project/LearnVapor/.build/checkouts/validation.git--4420399646601355644/Sources/Validation/Validators/NilIgnoringValidator.swift /Users/lb/Documents/Project/LearnVapor/.build/checkouts/validation.git--4420399646601355644/Sources/Validation/Validators/NilValidator.swift /Users/lb/Documents/Project/LearnVapor/.build/checkouts/validation.git--4420399646601355644/Sources/Validation/Validators/EmailValidator.swift /Users/lb/Documents/Project/LearnVapor/.build/checkouts/validation.git--4420399646601355644/Sources/Validation/Validators/InValidator.swift /Users/lb/Documents/Project/LearnVapor/.build/checkouts/validation.git--4420399646601355644/Sources/Validation/Validators/OrValidator.swift /Users/lb/Documents/Project/LearnVapor/.build/checkouts/validation.git--4420399646601355644/Sources/Validation/Validators/CharacterSetValidator.swift /Users/lb/Documents/Project/LearnVapor/.build/checkouts/validation.git--4420399646601355644/Sources/Validation/Validators/CountValidator.swift /Users/lb/Documents/Project/LearnVapor/.build/checkouts/validation.git--4420399646601355644/Sources/Validation/Validators/NotValidator.swift /Users/lb/Documents/Project/LearnVapor/.build/checkouts/validation.git--4420399646601355644/Sources/Validation/Validators/EmptyValidator.swift /Users/lb/Documents/Project/LearnVapor/.build/checkouts/validation.git--4420399646601355644/Sources/Validation/Validations.swift /Users/lb/Documents/Project/LearnVapor/.build/checkouts/validation.git--4420399646601355644/Sources/Validation/Exports.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/ObjectiveC.swiftmodule /Users/lb/Documents/Project/LearnVapor/.build/x86_64-apple-macosx10.10/debug/NIO.swiftmodule /Users/lb/Documents/Project/LearnVapor/.build/x86_64-apple-macosx10.10/debug/Async.swiftmodule /Users/lb/Documents/Project/LearnVapor/.build/x86_64-apple-macosx10.10/debug/Core.swiftmodule /Users/lb/Documents/Project/LearnVapor/.build/x86_64-apple-macosx10.10/debug/Debugging.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Dispatch.swiftmodule /Users/lb/Documents/Project/LearnVapor/.build/x86_64-apple-macosx10.10/debug/COperatingSystem.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 /Users/lb/Documents/Project/LearnVapor/.build/x86_64-apple-macosx10.10/debug/NIOConcurrencyHelpers.swiftmodule /Users/lb/Documents/Project/LearnVapor/.build/x86_64-apple-macosx10.10/debug/Bits.swiftmodule /Users/lb/Documents/Project/LearnVapor/.build/x86_64-apple-macosx10.10/debug/NIOFoundationCompat.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/lb/Documents/Project/LearnVapor/.build/checkouts/swift-nio.git-8756902686293799568/Sources/CNIOAtomics/include/cpp_magic.h /Users/lb/Documents/Project/LearnVapor/.build/checkouts/swift-nio.git-8756902686293799568/Sources/CNIODarwin/include/c_nio_darwin.h /Users/lb/Documents/Project/LearnVapor/.build/checkouts/swift-nio.git-8756902686293799568/Sources/CNIOAtomics/include/c-atomics.h /Users/lb/Documents/Project/LearnVapor/.build/checkouts/swift-nio.git-8756902686293799568/Sources/CNIOLinux/include/c_nio_linux.h /Users/lb/Documents/Project/LearnVapor/.build/checkouts/swift-nio-zlib-support.git--4783613459776704231/module.modulemap /Users/lb/Documents/Project/LearnVapor/.build/x86_64-apple-macosx10.10/debug/CNIOSHA1.build/module.modulemap /Users/lb/Documents/Project/LearnVapor/.build/x86_64-apple-macosx10.10/debug/CNIOOpenSSL.build/module.modulemap /Users/lb/Documents/Project/LearnVapor/.build/x86_64-apple-macosx10.10/debug/CCryptoOpenSSL.build/module.modulemap /Users/lb/Documents/Project/LearnVapor/.build/x86_64-apple-macosx10.10/debug/CNIOZlib.build/module.modulemap /Users/lb/Documents/Project/LearnVapor/.build/x86_64-apple-macosx10.10/debug/CNIODarwin.build/module.modulemap /Users/lb/Documents/Project/LearnVapor/.build/x86_64-apple-macosx10.10/debug/CNIOHTTPParser.build/module.modulemap /Users/lb/Documents/Project/LearnVapor/.build/x86_64-apple-macosx10.10/debug/CNIOAtomics.build/module.modulemap /Users/lb/Documents/Project/LearnVapor/.build/x86_64-apple-macosx10.10/debug/CNIOLinux.build/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
/* * This file has been automatically generated by Soupply and released under the MIT license. */ module soupply.bedrock150.packet; import xpacket; import soupply.util : Pad; alias Bedrock150Packet = Pad!(2, PacketImpl!(Endian.littleEndian, varuint, varuint));
D
/** * Autogenerated by Thrift Compiler (0.14.0) * * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING * @generated */ module AuthService; import thrift.base; import thrift.codegen.base; import thrift.util.hashset; import line_types; interface AuthService { string normalizePhoneNumber(string countryCode, string phoneNumber, string countryCodeHint); void respondE2EELoginRequest(string verifier, ref const(E2EEPublicKey) publicKey, string encryptedKeyChain, string hashKeyChain, ErrorCode errorCode); string confirmE2EELogin(string verifier, string deviceSecret); void logoutZ(); LoginResult loginZ(ref const(LoginRequest) loginRequest); SecurityCenterResult issueTokenForAccountMigrationSettings(bool enforce); SecurityCenterResult issueTokenForAccountMigration(string migrationSessionId); string verifyQrcodeWithE2EE(string verifier, string pinCode, ErrorCode errorCode, ref const(E2EEPublicKey) publicKey, string encryptedKeyChain, string hashKeyChain); alias line_types.TalkException TalkException; enum methodMeta = [ TMethodMeta(`normalizePhoneNumber`, [TParamMeta(`countryCode`, 2), TParamMeta(`phoneNumber`, 3), TParamMeta(`countryCodeHint`, 4)], [TExceptionMeta(`e`, 1, `TalkException`)] ), TMethodMeta(`respondE2EELoginRequest`, [TParamMeta(`verifier`, 1), TParamMeta(`publicKey`, 2), TParamMeta(`encryptedKeyChain`, 3), TParamMeta(`hashKeyChain`, 4), TParamMeta(`errorCode`, 5)], [TExceptionMeta(`e`, 1, `TalkException`)] ), TMethodMeta(`confirmE2EELogin`, [TParamMeta(`verifier`, 1), TParamMeta(`deviceSecret`, 2)], [TExceptionMeta(`e`, 1, `TalkException`)] ), TMethodMeta(`logoutZ`, [], [TExceptionMeta(`e`, 1, `TalkException`)] ), TMethodMeta(`loginZ`, [TParamMeta(`loginRequest`, 2)], [TExceptionMeta(`e`, 1, `TalkException`)] ), TMethodMeta(`issueTokenForAccountMigrationSettings`, [TParamMeta(`enforce`, 2)], [TExceptionMeta(`e`, 1, `TalkException`)] ), TMethodMeta(`issueTokenForAccountMigration`, [TParamMeta(`migrationSessionId`, 2)], [TExceptionMeta(`e`, 1, `TalkException`)] ), TMethodMeta(`verifyQrcodeWithE2EE`, [TParamMeta(`verifier`, 2), TParamMeta(`pinCode`, 3), TParamMeta(`errorCode`, 4), TParamMeta(`publicKey`, 5), TParamMeta(`encryptedKeyChain`, 6), TParamMeta(`hashKeyChain`, 7)], [TExceptionMeta(`e`, 1, `TalkException`)] ) ]; }
D
// Used only for testing -- imports all windows headers. module win32.testall; import win32.core; import win32.windows; import win32.commctrl; import win32.setupapi; import win32.directx.dinput8; import win32.directx.dsound8; import win32.directx.d3d9; import win32.directx.d3dx9; import win32.directx.dxerr; import win32.directx.dxerr8; import win32.directx.dxerr9; import win32.directx.d3d10; import win32.directx.d3d10effect; import win32.directx.d3d10shader; import win32.directx.d3dx10; import win32.directx.dxgi; import win32.oleacc; import win32.comcat; import win32.cpl; import win32.cplext; import win32.custcntl; import win32.ocidl; import win32.olectl; import win32.oledlg; import win32.objsafe; import win32.ole; import win32.shldisp; import win32.shlobj; import win32.shlwapi; import win32.regstr; import win32.richole; import win32.tmschema; import win32.servprov; import win32.exdisp; import win32.exdispid; import win32.idispids; import win32.mshtml; import win32.lm; import win32.lmbrowsr; import win32.sql; import win32.sqlext; import win32.sqlucode; import win32.odbcinst; import win32.imagehlp; import win32.intshcut; import win32.iphlpapi; import win32.isguids; import win32.subauth; import win32.rasdlg; import win32.rassapi; import win32.mapi; import win32.mciavi; import win32.mcx; import win32.mgmtapi; import win32.nddeapi; import win32.msacm; import win32.nspapi; import win32.ntdef; import win32.ntldap; import win32.ntsecapi; import win32.pbt; import win32.powrprof; import win32.rapi; import win32.wininet; import win32.winioctl; import win32.winldap; import win32.dbt; import win32.rpcdce2; import win32.tlhelp32; import win32.httpext; import win32.lmwksta; import win32.mswsock; import win32.objidl; import win32.ole2ver; import win32.psapi; import win32.raserror; import win32.usp10; import win32.vfw; version (WindowsVista) { version = WINDOWS_XP_UP; } else version (Windows2003) { version = WINDOWS_XP_UP; } else version (WindowsXP) { version = WINDOWS_XP_UP; } version (WINDOWS_XP_UP) { import win32.errorrep; import win32.lmmsg; import win32.reason; import win32.secext; } import win32.aclapi; import win32.aclui; import win32.dhcpcsdk; import win32.lmserver; import win32.ntdll; version (Win32_Winsock1) { import win32.winsock; }
D
module ws.inotify; import core.sys.linux.sys.inotify, core.sys.posix.sys.time, core.sys.posix.unistd, core.sys.posix.sys.select, core.stdc.errno, std.string, std.stdio, std.algorithm, std.conv, std.file, ws.event; version(Posix): __gshared: class Inotify { enum EVENT_BUFFER_LENGTH = (inotify_event.sizeof + 16) * 1024; static int inotify = -1; static timeval timeOut; static fd_set descriptorSet; static Watcher[int] staticWatchers; enum { Add, Remove, Modify } shared static this(){ if(inotify >= 0) return; inotify = inotify_init; if(inotify < 0) throw new Exception("Failed to initialize inotify: %s".format(errno)); timeOut.tv_sec = 0; timeOut.tv_usec = 0; FD_ZERO(&descriptorSet); } static class Watcher { this(){ event = new Event!(string, string, int); } string directory; Event!(string, string, int) event; } static void watch(string path, void delegate(string, string, int) event){ assert(inotify >= 0); if(!path.isDir) throw new Exception("\"" ~ path ~ "\" is not a directory. Please don't watch single files, they need to be \"re-watched\" in almost all cases on change"); foreach(wd, watcher; staticWatchers){ if(watcher.directory == path){ watcher.event ~= event; return; } } if(staticWatchers.values.find!(a => a.directory == path).length){ return; } int wd = inotify_add_watch(inotify, path.toStringz, IN_CLOSE_WRITE | IN_MOVED_FROM | IN_MOVED_TO | IN_CREATE | IN_DELETE | IN_MASK_ADD); if(wd < 0) throw new Exception("inotify error in %s: %s".format(path, errno)); auto watcher = new Watcher; watcher.directory = path; watcher.event ~= event; staticWatchers[wd] = watcher; } static void update(){ FD_SET(inotify, &descriptorSet); int ret = select(inotify + 1, &descriptorSet, null, null, &timeOut); if(ret < 0){ perror("select"); }else if(FD_ISSET(inotify, &descriptorSet)){ ssize_t len, i = 0; byte[EVENT_BUFFER_LENGTH] buff = 0; len = read(inotify, buff.ptr, buff.length); while(i < len){ auto pevent = cast(inotify_event*)&buff[i]; auto watcher = staticWatchers[pevent.wd]; watcher.event( watcher.directory, (cast(char*)&pevent.name).to!string, pevent.mask & IN_CLOSE_WRITE ? Modify : pevent.mask & (IN_MOVED_TO | IN_CREATE) ? Add : pevent.mask & (IN_MOVED_FROM | IN_DELETE) ? Remove : -1); i += inotify_event.sizeof + pevent.len; } } } }
D
module dmagick.c.color; import core.stdc.stdio; import dmagick.c.exception; import dmagick.c.image; import dmagick.c.magickType; import dmagick.c.magickVersion; import dmagick.c.pixel; alias ptrdiff_t ssize_t; extern(C) { enum ComplianceType { UndefinedCompliance, NoCompliance = 0x0000, CSSCompliance = 0x0001, SVGCompliance = 0x0001, X11Compliance = 0x0002, XPMCompliance = 0x0004, MVGCompliance = 0x0008, AllCompliance = 0x7fffffff } struct ColorInfo { char* path, name; ComplianceType compliance; MagickPixelPacket color; MagickBooleanType exempt, stealth; ColorInfo* previous, next; size_t signature; } struct ErrorInfo { double mean_error_per_pixel, normalized_mean_error, normalized_maximum_error; } char** GetColorList(const(char)*, size_t*, ExceptionInfo*); const(ColorInfo)* GetColorInfo(const(char)*, ExceptionInfo*); const(ColorInfo)** GetColorInfoList(const(char)*, size_t*, ExceptionInfo*); MagickBooleanType ColorComponentGenesis(); MagickBooleanType IsColorSimilar(const(Image)*, const(PixelPacket)*, const(PixelPacket)*); MagickBooleanType IsGrayImage(const(Image)*, ExceptionInfo*); MagickBooleanType IsImageSimilar(const(Image)*, const(Image)*, ssize_t* x,ssize_t* y, ExceptionInfo*); MagickBooleanType IsMagickColorSimilar(const(MagickPixelPacket)*, const(MagickPixelPacket)*); MagickBooleanType IsMonochromeImage(const(Image)*, ExceptionInfo*); MagickBooleanType IsOpacitySimilar(const(Image)*, const(PixelPacket)*, const(PixelPacket)*); MagickBooleanType IsOpaqueImage(const(Image)*, ExceptionInfo*); MagickBooleanType ListColorInfo(FILE*, ExceptionInfo*); static if ( MagickLibVersion >= 0x664 ) { MagickBooleanType QueryColorCompliance(const(char)*, const ComplianceType, PixelPacket*, ExceptionInfo*); } MagickBooleanType QueryColorDatabase(const(char)*, PixelPacket*, ExceptionInfo*); MagickBooleanType QueryColorname(const(Image)*, const(PixelPacket)*, const ComplianceType, char*, ExceptionInfo*); static if ( MagickLibVersion >= 0x664 ) { MagickBooleanType QueryMagickColorCompliance(const(char)*, const ComplianceType, MagickPixelPacket*, ExceptionInfo*); } MagickBooleanType QueryMagickColor(const(char)*, MagickPixelPacket*, ExceptionInfo*); MagickBooleanType QueryMagickColorname(const(Image)*, const(MagickPixelPacket)*, const ComplianceType, char*, ExceptionInfo*); void ColorComponentTerminus(); void ConcatenateColorComponent(const(MagickPixelPacket)*, const ChannelType, const ComplianceType, char*); void GetColorTuple(const(MagickPixelPacket)*, const MagickBooleanType, char*); }
D
import std.json; import std.stdio; import std.file; import std.string; import std.random; import std.conv; import std.format; bool isIn(string check, string str) { writeln("checking if is in:"); writeln(check); writeln(str); if (check == str) { return true; } return false; } string pickSymptom(string sympList[],string type, int end, int start) //Pick a symptom from the list { string symptom = ""; if (type == "") { symptom = sympList[uniform(start,end)]; //If we're doing non-typed symptoms return symptom; } symptom = sympList[uniform(0,end)]; while (indexOf(symptom,type) < 0) //While the first char is not one of the type chars { symptom = sympList[uniform(0,end)]; } return symptom; } bool checkChoosen(string choosenList[], string symptom) //Check if the picked symptom is already been picked { bool isIn = false; //XXX For some reason this gets a range violation because i is always gets to one more than it really should for some reason... writeln("Length"); writeln(choosenList.length); if (choosenList.length <= 1) { return false; } foreach(int i, string choosen; choosenList) { if (choosen == symptom) { isIn = true; break; } } return isIn; } void main(string[] args) { //Open a file containing ilst of patiant IDs (else use for loop iterator) //Open file with Anthrax Symptoms //Open file with other symptoms //define json structure //Loop for how ever many patiants we asked for File ids; File symptoms; File ReportMethods; File LocationPairs; int realstart = 0; int realend = 0; int fakeend = 0; int fakestart = 0; int numPatiants = 0; if (args.length >= 9) //Open the files { ids = File(args[1], "r"); //This is now the patiants loaded from sample people symptoms = File(args[2], "r"); realstart = to!int(args[3]); realend = to!int(args[4]); fakestart = to!int(args[5]); fakeend = to!int(args[6]); ReportMethods = File(args[7], "r"); LocationPairs = File(args[8], "r"); numPatiants = to!int(args[9]); } else if (args.length == 2) { if (args[1] == "help") { writeln( "JSONFile idsfile symptomsfile [startOfRealSymptoms] [EndOfRealSymptoms] [StartOfFakeSymptoms] [EndOfFakeSymptoms] reportmethods locationpairs [numberOfPatiants]"); return; } } else { return ; } int lineCount = 1; // JSONValue j = parseJSON(JSONStructureString); writefln("Doing %s Patiants", args[]); writeln("here?"); JSONValue patiants = parseJSON(ids.readln()); //List of patiants writeln("Not here!"); writeln("READ in patiant"); //Read in all the anthrax symptoms //XXX For now we have statically defined limits to how many symptoms there are - We could make this dynamic //TODO Put all this inside a function - Its horrible out here! string[] symptomsList; lineCount = 0; while(!symptoms.eof()) { string line = strip (symptoms.readln()); symptomsList ~= line; lineCount++; } string[] ReportMethodsList; lineCount = 0; while(!ReportMethods.eof()) { string line = strip (ReportMethods.readln()); ReportMethodsList ~= line; lineCount++; } writeln(ReportMethodsList); JSONValue[] LocationPairsList; lineCount = 0; while(!LocationPairs.eof()) { string line = strip (LocationPairs.readln()); LocationPairsList ~= parseJSON(line); lineCount++; } writeln("read in some location pairs"); writefln("The asymptoms list is %s long", symptomsList.length); writeln(symptomsList); //How many symptoms does each patiant have maximum? int RealSymptomLim = 6; int OtherSymptomLim = 5; int RealSymptomStart = realstart; int OtherSymptomStart = realend+1; //HOW MANY REAL ANTHRAX SYMPTOMS HAVE WE GOT? //WHAT ABOUT THE DIFFERENT KINDS OF ANTHRAX????? //XXX string[2] types = ["%","$"]; writeln("done processing shit"); int i = 0; writeln(numPatiants); while (i < numPatiants) //For every ID { if (i >= numPatiants) //Check because EOF doesnt happen until i is already out of range { break; } patiants.array[i].object["report_method"] = JSONValue(strip(ReportMethodsList[uniform(0,ReportMethodsList.length-1)])); //Get random report method patiants.array[i].object["report_location"] = JSONValue(LocationPairsList[uniform(0,LocationPairsList.length-1)]); //Get random report method writeln(patiants.array[i].object["report_method"].toString()); string RealSymptoms[]; RealSymptoms.length = RealSymptomLim; int noRealSimps = uniform(0, RealSymptomLim); int noFakeSimps = uniform(1, OtherSymptomLim); writeln("real symps:"); writeln(noRealSimps); writeln("fake symps:"); writeln(noFakeSimps); string type = types[uniform (0, types.length)]; //pick a type of anthrax for this patiant string[] choosenSymptomsList; //The symptoms we've got already, no duplicates! string[] choosenFakeSymptomsList; writefln("Choose: %s", type); writeln(type); string symptom = ""; bool again = false; //XXX TODO Add the picking of symptoms to a function, so we can call it over and over again! if (noRealSimps > 0) { for (int k = 0; k < noRealSimps; k++) //Get real symptoms 0 to max. Will sometimes pick 0 { //make sure that the symptom we pick, conforms with the type we picked earlier. symptom = pickSymptom(symptomsList,type,realend,0 ); //Pick a symptoim while(checkChoosen(choosenSymptomsList, symptom) == true) //Check it isnt already picked { symptom = pickSymptom(symptomsList,type,realend, 0); //If it is, pick another one and check again } //When we get here, we should have picked a symptom writeln("We also attempt to add to an array here"); choosenSymptomsList ~= symptom; writeln("choosen list"); writeln(choosenSymptomsList); string symptomObject = format("{\"name\": \"%s\"},", chompPrefix(symptom, to!string(type))); if (k == 0) { patiants.array[i].object["Symptoms"] = JSONValue([parseJSON(symptomObject)]); //Pick a few real symptoms. } else { patiants.array[i].object["Symptoms"].array ~= parseJSON(symptomObject); //Pick a few real symptoms. } } } string FakeSymptoms[]; FakeSymptoms.length = symptomsList.length; for (int f = 0; f < noFakeSimps; f++) //Get real symptoms 0 to max. Will sometimes pick 0 { writeln("Choosing fake symptoms"); symptom = pickSymptom(symptomsList, "", fakeend, fakestart); while(checkChoosen(choosenFakeSymptomsList, symptom) == true) { symptom = pickSymptom(symptomsList, "", fakeend, fakestart); } string symptomObject = format("{\"name\": \"%s\"},", chompPrefix(symptom, to!string(type))); if (f == 0 && noRealSimps == 0) { patiants.array[i].object["Symptoms"] = JSONValue([parseJSON(symptomObject)]); //Pick a few real symptoms. } else { patiants.array[i].object["Symptoms"].array ~= parseJSON(symptomObject); //Pick a few real symptoms. } choosenFakeSymptomsList ~= symptom; } i++; } foreach(int p, JSONValue patiant; patiants.array) { string patiantJSON = patiant.toPrettyString(); append("Patiants.json", patiantJSON); append("Patiants.json", "\n"); // writeln(patiantJSON); } }
D
module legend; import dfl.all, resizer; class Legend: dfl.form.Form { // Do not modify or move this block of variables. //~Entice Designer variables begin here. dfl.textbox.TextBox textBox; dfl.button.Button btnClose; //~Entice Designer variables end here. Resizer resizer; this() { initializeLegend(); } private void initializeLegend() { // Do not manually modify this function. //~Entice Designer 0.8.5.02 code begins here. //~DFL Form text = "Legend"; clientSize = dfl.all.Size(520, 394); //~DFL dfl.textbox.TextBox=textBox textBox = new dfl.textbox.TextBox(); textBox.name = "textBox"; textBox.bounds = dfl.all.Rect(16, 16, 488, 344); textBox.parent = this; textBox.multiline = true; textBox.readOnly = true; textBox.scrollBars = dfl.all.ScrollBars.VERTICAL; //~DFL dfl.button.Button=btnClose btnClose = new dfl.button.Button(); btnClose.name = "btnClose"; btnClose.text = "Close"; btnClose.bounds = dfl.all.Rect(424, 368, 80, 24); btnClose.parent = this; //~Entice Designer 0.8.5.02 code ends here. showInTaskbar = false; textBox.text = import("legend.txt"); btnClose.click ~= (Control c, EventArgs a) => close(); resizer = new Resizer(this); resizer.let(btnClose, XCoord.moves, YCoord.moves); resizer.let(textBox, XCoord.resizes, YCoord.resizes); resizer.prepare(); this.activated ~= (Form frm, EventArgs args) => btnClose.focus(); this.load ~= (Form f, EventArgs a) => centerToParent(); } override void onResize(EventArgs ea) { resizer.go(); } }
D
//-------- Spell Commands -------- // SPL_DONTINVEST = 0; // Es können keine weiteren Manapunkte investiert werden. Erst durch CTRL loslassen geht der Spell ab // SPL_RECEIVEINVEST = 1; // Wirkung durchgeführt, es können weitere Invest kommen, zB.bei Heal nach jedem Pöppel // SPL_SENDCAST = 2; // Starte den Zauber-Effekt (wie CTRL loslassen), automatischer Abbruch // SPL_SENDSTOP = 3; // Beende Zauber ohne Effekt // SPL_NEXTLEVEL = 4; // setze den Spruch auf den nächsten Level func int Spell_Logic_Firewall (var int manaInvested) { //PrintDebugNpc (PD_MAGIC, "Spell_Logic_Fireball"); //Handle scroll: Correct_ScrollMana(SPL_SENDCAST_FIREWALL,manaInvested); //Yeah, its simply and working :D if (manaInvested ==(SPL_SENDCAST_FIREWALL-30)) || (manaInvested ==(SPL_SENDCAST_FIREWALL-20)) || (manaInvested ==(SPL_SENDCAST_FIREWALL-10)) { return SPL_NEXTLEVEL; }; if (manaInvested >= SPL_SENDCAST_FIREWALL) { npc_firewall_orgin=Hlp_GetInstanceID(self); glob_firewall_bounces=0;//anti bug - when last bouncing was canceled return SPL_SENDCAST; Multicast(); }; return SPL_RECEIVEINVEST; };
D
/** * Copyright: Copyright (c) 2011 Jacob Carlborg. All rights reserved. * Authors: Jacob Carlborg * Version: Initial created: Oct 6, 2011 * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) */ module dstep.translator.Translator; import std.file; import std.array; import clang.c.Index; import clang.Cursor; import clang.File; import clang.Index; import clang.TranslationUnit; import clang.Type; import clang.Util; import dstep.core.Exceptions; import dstep.Configuration; import dstep.translator.Context; import dstep.translator.Declaration; import dstep.translator.Enum; import dstep.translator.IncludeHandler; import dstep.translator.objc.Category; import dstep.translator.objc.ObjcInterface; import dstep.translator.Options; import dstep.translator.Output; import dstep.translator.MacroDefinition; import dstep.translator.Record; import dstep.translator.Type; public import dstep.translator.Options; class TranslationException : DStepException { this (string message, string file = __FILE__, size_t line = __LINE__) { super(message, file, line); } } class Translator { private { TranslationUnit translationUnit; string outputFile; string inputFilename; File inputFile; Language language; string[string] deferredDeclarations; } Context context; this (TranslationUnit translationUnit, Options options = Options.init) { this.inputFilename = translationUnit.spelling; this.translationUnit = translationUnit; outputFile = options.outputFile; language = options.language; inputFile = translationUnit.file(inputFilename); context = new Context(translationUnit, options, this); } void translate () { write(outputFile, translateToString()); } Output translateCursors() { Output result = new Output(context.commentIndex); bool first = true; foreach (cursor, parent; translationUnit.cursor.allInOrder) { if (!skipDeclaration(cursor)) { if (first) { if (result.flushHeaderComment()) result.separator(); externDeclaration(result); first = false; } translateInGlobalScope(result, cursor, parent); } } if (context.commentIndex) result.flushLocation(context.commentIndex.queryLastLocation()); foreach (value; deferredDeclarations.values) result.singleLine(value); result.finalize(); return result; } string translateToString() { import std.algorithm.mutation : strip; Output main = translateCursors(); Output head = new Output(); moduleDeclaration(head); context.includeHandler.toImports(head); return main.header ~ head.data ~ main.content; } void translateInGlobalScope( Output output, Cursor cursor, Cursor parent = Cursor.empty) { translate(output, cursor, parent); if (!context.globalScope.empty) { output.separator(); output.output(context.globalScope); output.separator(); context.globalScope.reset(); } } void translate ( Output output, Cursor cursor, Cursor parent = Cursor.empty) { with (CXCursorKind) { switch (cursor.kind) { case objCInterfaceDecl: output.flushLocation(cursor.extent, false); translateObjCInterfaceDecl(output, cursor, parent); break; case objCProtocolDecl: output.flushLocation(cursor.extent, false); translateObjCProtocolDecl(output, cursor, parent); break; case objCCategoryDecl: output.flushLocation(cursor.extent, false); translateObjCCategoryDecl(output, cursor, parent); break; case varDecl: output.flushLocation(cursor.extent); translateVarDecl(output, cursor, parent); break; case functionDecl: translateFunctionDecl(output, cursor, parent); break; case typedefDecl: translateTypedefDecl(output, cursor); break; case structDecl: translateRecord(output, context, cursor); break; case enumDecl: translateEnum(output, context, cursor); break; case unionDecl: translateRecord(output, context, cursor); break; case macroDefinition: output.flushLocation(cursor.extent); translateMacroDefinition(output, cursor, parent); break; case macroExpansion: output.flushLocation(cursor.extent); break; default: break; } } } void translateObjCInterfaceDecl(Output output, Cursor cursor, Cursor parent) { (new ObjcInterface!(ClassData)(cursor, parent, this)).translate(output); } void translateObjCProtocolDecl(Output output, Cursor cursor, Cursor parent) { (new ObjcInterface!(InterfaceData)(cursor, parent, this)).translate(output); } void translateObjCCategoryDecl(Output output, Cursor cursor, Cursor parent) { (new Category(cursor, parent, this)).translate(output); } void translateVarDecl(Output output, Cursor cursor, Cursor parent) { version (D1) string storageClass = "extern "; else string storageClass = "extern __gshared "; variable(output, cursor, storageClass); } void translateFunctionDecl(Output output, Cursor cursor, Cursor parent) { output.flushLocation(cursor.extent); immutable auto name = translateIdentifier(cursor.spelling); output.adaptiveSourceNode(translateFunction(context, cursor.func, name)); output.append(";"); } void declareRecordForTypedef(Output output, Cursor typedef_) { assert(typedef_.kind == CXCursorKind.typedefDecl); auto underlying = typedef_.underlyingCursor(); if (underlying.isEmpty) return; if (underlying.isEmpty || underlying.kind != CXCursorKind.structDecl && underlying.kind != CXCursorKind.unionDecl) return; if (context.alreadyDefined(underlying.canonical)) return; bool skipdef = shouldSkipRecordDefinition(context, underlying); if (underlying.definition.isEmpty || skipdef) translateRecordDecl(output, context, underlying); } bool shouldSkipAlias(Cursor typedef_) { assert(typedef_.kind == CXCursorKind.typedefDecl); return context.options.reduceAliases && typedef_.type.isAliasReducible; } void translateTypedefDecl(Output output, Cursor typedef_) { assert(typedef_.kind == CXCursorKind.typedefDecl); output.flushLocation(typedef_.extent); auto underlying = typedef_.underlyingCursor; if (!context.shouldSkipRecord(underlying) && !shouldSkipAlias(typedef_)) { declareRecordForTypedef(output, typedef_); if (underlying.isEmpty || (underlying.spelling != typedef_.spelling && underlying.spelling != "")) { auto canonical = typedef_.type.canonical; auto spelling = typedef_.spelling; auto type = translateType(context, typedef_, canonical); version (D1) { output.adaptiveSourceNode( type.wrapWith("alias ", " " ~ spelling ~ ";")); } else { output.adaptiveSourceNode( type.wrapWith("alias " ~ spelling ~ " = ", ";")); } context.markAsDefined(typedef_); } } } void translateMacroDefinition(Output output, Cursor cursor, Cursor parent) { if (context.options.translateMacros) { dstep.translator.MacroDefinition.translateMacroDefinition( output, context, cursor); } } void variable (Output output, Cursor cursor, string prefix = "") { translateVariable(output, context, cursor, prefix); } private: bool skipDeclaration (Cursor cursor) { return (inputFilename != "" && inputFile != cursor.location.spelling.file) || context.options.skipSymbols.contains(cursor.spelling) || cursor.isPredefined; } void moduleDeclaration (Output output) { if (context.options.packageName != "") { output.singleLine("module %s;", fullModuleName( context.options.packageName, context.options.outputFile, context.options.normalizeModules)); output.separator(); } } void externDeclaration (Output output) { final switch (language) { case Language.c: output.singleLine("extern (C):"); break; case Language.objC: output.singleLine("extern (Objective-C):"); break; } foreach (attribute; context.options.globalAttributes) output.singleLine("%s:", attribute); output.separator(); } } SourceNode translateFunction ( Context context, FunctionCursor func, string name, bool isStatic = false) { bool isVariadic(Context context, size_t numParams, FunctionCursor func) { if (func.isVariadic) { if (context.options.zeroParamIsVararg) return true; else if (numParams == 0) return false; else return true; } return false; } Parameter[] params; if (func.type.isValid) // This will be invalid for Objective-C methods params.reserve(func.type.func.arguments.length); foreach (param ; func.parameters) { auto type = translateType(context, param); params ~= Parameter(type, param.spelling); } auto resultType = translateType(context, func, func.resultType); auto multiline = func.extent.isMultiline && !context.options.singleLineFunctionSignatures; auto spacer = context.options.spaceAfterFunctionName ? " " : ""; return translateFunction( resultType, name, params, isVariadic(context, params.length, func), isStatic ? "static " : "", spacer, multiline); } package struct Parameter { SourceNode type; string name; bool isConst; } package SourceNode translateFunction ( SourceNode resultType, string name, Parameter[] parameters, bool variadic, string prefix = "", string spacer = " ", bool multiline = false) { import std.format : format; string[] params; params.reserve(parameters.length); foreach (param ; parameters) { string p; version(D1) { p ~= param.type; } else { if (param.isConst) p ~= "const("; p ~= param.type.makeString(); if (param.isConst) p ~= ')'; } if (param.name.length) p ~= " " ~ translateIdentifier(param.name); params ~= p; } if (variadic) params ~= "..."; auto result = makeSourceNode( format("%s%s %s%s(", prefix, resultType.makeString(), name, spacer), params, ",", ")"); return multiline ? result : result.flatten(); } void translateVariable (Output output, Context context, Cursor cursor, string prefix = "") { if (!context.alreadyDefined(cursor.canonical)) { auto type = translateType(context, cursor, cursor.type); auto identifier = translateIdentifier(cursor.spelling); output.adaptiveSourceNode(type.wrapWith(prefix, " " ~ identifier ~ ";")); context.markAsDefined(cursor.canonical); } } string translateIdentifier (string str) { return isDKeyword(str) ? str ~ '_' : str; } void handleInclude (Context context, Type type) { import std.algorithm.searching; import std.path; if (type.kind == CXTypeKind.typedef_ && type.spelling == "time_t" && type.declaration.path.asNormalizedPath.array.endsWith("sys\\types.h")) context.includeHandler.addInclude("time.h"); else context.includeHandler.addInclude(type.declaration.path); } bool isDKeyword (string str) { switch (str) { case "abstract": case "alias": case "align": case "asm": case "assert": case "auto": case "body": case "bool": case "break": case "byte": case "case": case "cast": case "catch": case "cdouble": case "cent": case "cfloat": case "char": case "class": case "const": case "continue": case "creal": case "dchar": case "debug": case "default": case "delegate": case "delete": case "deprecated": case "do": case "double": case "else": case "enum": case "export": case "extern": case "false": case "final": case "finally": case "float": case "for": case "foreach": case "foreach_reverse": case "function": case "goto": case "idouble": case "if": case "ifloat": case "import": case "in": case "inout": case "int": case "interface": case "invariant": case "ireal": case "is": case "lazy": case "long": case "macro": case "mixin": case "module": case "new": case "nothrow": case "null": case "out": case "override": case "package": case "pragma": case "private": case "protected": case "public": case "pure": case "real": case "ref": case "return": case "scope": case "shared": case "short": case "static": case "struct": case "super": case "switch": case "synchronized": case "template": case "this": case "throw": case "true": case "try": case "typedef": case "typeid": case "typeof": case "ubyte": case "ucent": case "uint": case "ulong": case "union": case "unittest": case "ushort": case "version": case "void": case "volatile": case "wchar": case "while": case "with": case "__FILE__": case "__LINE__": case "__DATE__": case "__TIME__": case "__TIMESTAMP__": case "__VENDOR__": case "__VERSION__": return true; default: break; } if (true /*D2*/) { switch (str) { case "immutable": case "nothrow": case "pure": case "shared": case "__gshared": case "__thread": case "__traits": case "__EOF__": return true; default: return str.length && str[0] == '@'; } } return false; }
D
module primitives; private mixin template Access() { ref auto get(string accessPattern)() inout { return mixin(accessPattern); } } struct Point2 { uint x; uint y; pure nothrow @safe @nogc: uint distanceTo(const ref Point2 other) { import std.math : hypot; int dx = x - other.x; int dy = y - other.y; return cast(uint)hypot(dx, dy); } } Point2 up(Point2 p) { return Point2(p.x, p.y - 1); } Point2 down(Point2 p) { return Point2(p.x, p.y + 1); } Point2 left(Point2 p) { return Point2(p.x - 1, p.y); } Point2 right(Point2 p) { return Point2(p.x + 1, p.y); } Point2 upLeft(Point2 p) { return Point2(p.x - 1, p.y - 1); } Point2 upRight(Point2 p) { return Point2(p.x + 1, p.y - 1); } Point2 downLeft(Point2 p) { return Point2(p.x - 1, p.y + 1); } Point2 downRight(Point2 p) { return Point2(p.x + 1, p.y + 1); } Point2 swap(Point2 p) { return Point2(p.y, p.x); } alias Size2 = Point2; struct Line2 { Point2 start; Point2 end; mixin Access; alias x1 = get!"start.x"; alias y1 = get!"start.y"; alias x2 = get!"end.x"; alias y2 = get!"end.y"; } struct Rectangle2 { Point2 min; Point2 max; } struct Metrics { Size2 screenSize; Size2 pixelSize; @disable this(this); this(Size2 screenSize, Size2 pixelSize) { this.screenSize = screenSize; this.pixelSize = pixelSize; } bool inRange(Point2 p) inout { return (p.x >= 0 && p.x < screenSize.x) && (p.y >= 0 && p.y < screenSize.y); } bool inRange(uint x, uint y) inout { return (x >= 0 && x < screenSize.x) && (y >= 0 && y < screenSize.y); } } struct ScreenPoint { Point2 point; alias point this; uint distanceTo(const ref ScreenPoint other) { return this.point.distanceTo(other.point); } this(Point2 p, const ref Metrics metrics) { this(p.x, p.y, metrics); } this(uint x, uint y, const ref Metrics metrics) { this.x = x / metrics.pixelSize.x; this.y = y / metrics.pixelSize.y; assert(metrics.inRange(this), "The point is outside of the screen!"); } static ScreenPoint make(uint x, uint y) { ScreenPoint res; res.x = x; res.y = y; return res; } } alias ScreenSize = ScreenPoint; struct ScreenLine { ScreenPoint start; ScreenPoint end; mixin Access; alias x1 = get!"start.x"; alias y1 = get!"start.y"; alias x2 = get!"end.x"; alias y2 = get!"end.y"; this(Line2 l, const ref Metrics metrics) { this(l.start.x, l.start.y, l.end.x, l.end.y, metrics); } this(const ref ScreenPoint start, const ref ScreenPoint end) { this.start = start; this.end = end; } this(uint x1, uint y1, uint x2, uint y2, const ref Metrics metrics) { this.start = ScreenPoint(x1, y1, metrics); this.end = ScreenPoint(x2, y2, metrics); } } struct ScreenRectangle { ScreenPoint min; ScreenPoint max; this(const ref ScreenPoint min, const ref ScreenPoint max) { this.min = min; this.max = max; } this(uint xMin, uint yMin, uint xMax, uint yMax, const ref Metrics metrics) { this.min = ScreenPoint(xMin, yMin, metrics); this.max = ScreenPoint(xMax, yMax, metrics); } }
D
import std.datetime; import std.conv; import std.array; import std.stdio; import std.string : format; import mqttd; shared static this() { import vibe.core.log : setLogFormat, FileLogger; import vibe.core.core : sleep, runTask; setLogFormat(FileLogger.Format.threadTime); auto settings = Settings(); settings.clientId = "publisher"; auto mqtt = new MqttClient(settings); mqtt.connect(); auto publisherQ0 = runTask(() { while (mqtt.connected) { mqtt.publish("chat/simple", "QoS0 message"); sleep(3.seconds()); } }); auto publisherQ1 = runTask(() { sleep(1.seconds()); while (mqtt.connected) { mqtt.publish("chat/qos1", "QoS1 message", QoSLevel.QoS1); sleep(3.seconds()); } }); auto publisherQ2 = runTask(() { sleep(2.seconds()); while (mqtt.connected) { mqtt.publish("chat/qos2", "QoS2 message", QoSLevel.QoS2); sleep(3.seconds()); } }); }
D
/** * Compiler implementation of the * $(LINK2 http://www.dlang.org, D programming language). * * Copyright: Copyright (C) 1999-2019 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/dclass.d, _dclass.d) * Documentation: https://dlang.org/phobos/dmd_dclass.html * Coverage: https://codecov.io/gh/dlang/dmd/src/master/src/dmd/dclass.d */ module dmd.dclass; import core.stdc.stdio; import core.stdc.string; import dmd.aggregate; import dmd.arraytypes; import dmd.gluelayer; import dmd.declaration; import dmd.dscope; import dmd.dsymbol; import dmd.dsymbolsem; import dmd.func; import dmd.globals; import dmd.id; import dmd.identifier; import dmd.mtype; import dmd.objc; import dmd.root.rmem; import dmd.target; import dmd.visitor; enum Abstract : int { fwdref = 0, // whether an abstract class is not yet computed yes, // is abstract class no, // is not abstract class } /*********************************************************** */ struct BaseClass { Type type; // (before semantic processing) ClassDeclaration sym; uint offset; // 'this' pointer offset // for interfaces: Array of FuncDeclaration's making up the vtbl[] FuncDeclarations vtbl; // if BaseClass is an interface, these // are a copy of the InterfaceDeclaration.interfaces BaseClass[] baseInterfaces; extern (D) this(Type type) { //printf("BaseClass(this = %p, '%s')\n", this, type.toChars()); this.type = type; } /**************************************** * Fill in vtbl[] for base class based on member functions of class cd. * Input: * vtbl if !=NULL, fill it in * newinstance !=0 means all entries must be filled in by members * of cd, not members of any base classes of cd. * Returns: * true if any entries were filled in by members of cd (not exclusively * by base classes) */ extern (C++) bool fillVtbl(ClassDeclaration cd, FuncDeclarations* vtbl, int newinstance) { bool result = false; //printf("BaseClass.fillVtbl(this='%s', cd='%s')\n", sym.toChars(), cd.toChars()); if (vtbl) vtbl.setDim(sym.vtbl.dim); // first entry is ClassInfo reference for (size_t j = sym.vtblOffset(); j < sym.vtbl.dim; j++) { FuncDeclaration ifd = sym.vtbl[j].isFuncDeclaration(); FuncDeclaration fd; TypeFunction tf; //printf(" vtbl[%d] is '%s'\n", j, ifd ? ifd.toChars() : "null"); assert(ifd); // Find corresponding function in this class tf = ifd.type.toTypeFunction(); fd = cd.findFunc(ifd.ident, tf); if (fd && !fd.isAbstract()) { //printf(" found\n"); // Check that calling conventions match if (fd.linkage != ifd.linkage) fd.error("linkage doesn't match interface function"); // Check that it is current //printf("newinstance = %d fd.toParent() = %s ifd.toParent() = %s\n", //newinstance, fd.toParent().toChars(), ifd.toParent().toChars()); if (newinstance && fd.toParent() != cd && ifd.toParent() == sym) cd.error("interface function `%s` is not implemented", ifd.toFullSignature()); if (fd.toParent() == cd) result = true; } else { //printf(" not found %p\n", fd); // BUG: should mark this class as abstract? if (!cd.isAbstract()) cd.error("interface function `%s` is not implemented", ifd.toFullSignature()); fd = null; } if (vtbl) (*vtbl)[j] = fd; } return result; } extern (D) void copyBaseInterfaces(BaseClasses* vtblInterfaces) { //printf("+copyBaseInterfaces(), %s\n", sym.toChars()); // if (baseInterfaces.length) // return; auto bc = cast(BaseClass*)mem.xcalloc(sym.interfaces.length, BaseClass.sizeof); baseInterfaces = bc[0 .. sym.interfaces.length]; //printf("%s.copyBaseInterfaces()\n", sym.toChars()); for (size_t i = 0; i < baseInterfaces.length; i++) { BaseClass* b = &baseInterfaces[i]; BaseClass* b2 = sym.interfaces[i]; assert(b2.vtbl.dim == 0); // should not be filled yet memcpy(b, b2, BaseClass.sizeof); if (i) // single inheritance is i==0 vtblInterfaces.push(b); // only need for M.I. b.copyBaseInterfaces(vtblInterfaces); } //printf("-copyBaseInterfaces\n"); } } enum ClassFlags : int { none = 0x0, isCOMclass = 0x1, noPointers = 0x2, hasOffTi = 0x4, hasCtor = 0x8, hasGetMembers = 0x10, hasTypeInfo = 0x20, isAbstract = 0x40, isCPPclass = 0x80, hasDtor = 0x100, } /*********************************************************** */ extern (C++) class ClassDeclaration : AggregateDeclaration { extern (C++) __gshared { // Names found by reading object.d in druntime ClassDeclaration object; ClassDeclaration throwable; ClassDeclaration exception; ClassDeclaration errorException; ClassDeclaration cpp_type_info_ptr; // Object.__cpp_type_info_ptr } ClassDeclaration baseClass; // NULL only if this is Object FuncDeclaration staticCtor; FuncDeclaration staticDtor; Dsymbols vtbl; // Array of FuncDeclaration's making up the vtbl[] Dsymbols vtblFinal; // More FuncDeclaration's that aren't in vtbl[] // Array of BaseClass's; first is super, rest are Interface's BaseClasses* baseclasses; /* Slice of baseclasses[] that does not include baseClass */ BaseClass*[] interfaces; // array of base interfaces that have their own vtbl[] BaseClasses* vtblInterfaces; // the ClassInfo object for this ClassDeclaration TypeInfoClassDeclaration vclassinfo; // true if this is a COM class bool com; /// true if this is a scope class bool stack; /// if this is a C++ class, this is the slot reserved for the virtual destructor int cppDtorVtblIndex = -1; /// to prevent recursive attempts private bool inuse; /// true if this class has an identifier, but was originally declared anonymous /// used in support of https://issues.dlang.org/show_bug.cgi?id=17371 private bool isActuallyAnonymous; Abstract isabstract; /// set the progress of base classes resolving Baseok baseok; /** * Data for a class declaration that is needed for the Objective-C * integration. */ ObjcClassDeclaration objc; Symbol* cpp_type_info_ptr_sym; // cached instance of class Id.cpp_type_info_ptr final extern (D) this(const ref Loc loc, Identifier id, BaseClasses* baseclasses, Dsymbols* members, bool inObject) { objc = ObjcClassDeclaration(this); if (!id) { isActuallyAnonymous = true; } super(loc, id ? id : Identifier.generateId("__anonclass")); __gshared const(char)* msg = "only object.d can define this reserved class name"; if (baseclasses) { // Actually, this is a transfer this.baseclasses = baseclasses; } else this.baseclasses = new BaseClasses(); this.members = members; //printf("ClassDeclaration(%s), dim = %d\n", ident.toChars(), this.baseclasses.dim); // For forward references type = new TypeClass(this); if (id) { // Look for special class names if (id == Id.__sizeof || id == Id.__xalignof || id == Id._mangleof) error("illegal class name"); // BUG: What if this is the wrong TypeInfo, i.e. it is nested? if (id.toChars()[0] == 'T') { if (id == Id.TypeInfo) { if (!inObject) error("%s", msg); Type.dtypeinfo = this; } if (id == Id.TypeInfo_Class) { if (!inObject) error("%s", msg); Type.typeinfoclass = this; } if (id == Id.TypeInfo_Interface) { if (!inObject) error("%s", msg); Type.typeinfointerface = this; } if (id == Id.TypeInfo_Struct) { if (!inObject) error("%s", msg); Type.typeinfostruct = this; } if (id == Id.TypeInfo_Pointer) { if (!inObject) error("%s", msg); Type.typeinfopointer = this; } if (id == Id.TypeInfo_Array) { if (!inObject) error("%s", msg); Type.typeinfoarray = this; } if (id == Id.TypeInfo_StaticArray) { //if (!inObject) // Type.typeinfostaticarray.error("%s", msg); Type.typeinfostaticarray = this; } if (id == Id.TypeInfo_AssociativeArray) { if (!inObject) error("%s", msg); Type.typeinfoassociativearray = this; } if (id == Id.TypeInfo_Enum) { if (!inObject) error("%s", msg); Type.typeinfoenum = this; } if (id == Id.TypeInfo_Function) { if (!inObject) error("%s", msg); Type.typeinfofunction = this; } if (id == Id.TypeInfo_Delegate) { if (!inObject) error("%s", msg); Type.typeinfodelegate = this; } if (id == Id.TypeInfo_Tuple) { if (!inObject) error("%s", msg); Type.typeinfotypelist = this; } if (id == Id.TypeInfo_Const) { if (!inObject) error("%s", msg); Type.typeinfoconst = this; } if (id == Id.TypeInfo_Invariant) { if (!inObject) error("%s", msg); Type.typeinfoinvariant = this; } if (id == Id.TypeInfo_Shared) { if (!inObject) error("%s", msg); Type.typeinfoshared = this; } if (id == Id.TypeInfo_Wild) { if (!inObject) error("%s", msg); Type.typeinfowild = this; } if (id == Id.TypeInfo_Vector) { if (!inObject) error("%s", msg); Type.typeinfovector = this; } } if (id == Id.Object) { if (!inObject) error("%s", msg); object = this; } if (id == Id.Throwable) { if (!inObject) error("%s", msg); throwable = this; } if (id == Id.Exception) { if (!inObject) error("%s", msg); exception = this; } if (id == Id.Error) { if (!inObject) error("%s", msg); errorException = this; } if (id == Id.cpp_type_info_ptr) { if (!inObject) error("%s", msg); cpp_type_info_ptr = this; } } baseok = Baseok.none; } static ClassDeclaration create(Loc loc, Identifier id, BaseClasses* baseclasses, Dsymbols* members, bool inObject) { return new ClassDeclaration(loc, id, baseclasses, members, inObject); } override Dsymbol syntaxCopy(Dsymbol s) { //printf("ClassDeclaration.syntaxCopy('%s')\n", toChars()); ClassDeclaration cd = s ? cast(ClassDeclaration)s : new ClassDeclaration(loc, ident, null, null, false); cd.storage_class |= storage_class; cd.baseclasses.setDim(this.baseclasses.dim); for (size_t i = 0; i < cd.baseclasses.dim; i++) { BaseClass* b = (*this.baseclasses)[i]; auto b2 = new BaseClass(b.type.syntaxCopy()); (*cd.baseclasses)[i] = b2; } return ScopeDsymbol.syntaxCopy(cd); } override Scope* newScope(Scope* sc) { auto sc2 = super.newScope(sc); if (isCOMclass()) { /* This enables us to use COM objects under Linux and * work with things like XPCOM */ sc2.linkage = target.systemLinkage(); } return sc2; } /********************************************* * Determine if 'this' is a base class of cd. * This is used to detect circular inheritance only. */ final bool isBaseOf2(ClassDeclaration cd) { if (!cd) return false; //printf("ClassDeclaration.isBaseOf2(this = '%s', cd = '%s')\n", toChars(), cd.toChars()); for (size_t i = 0; i < cd.baseclasses.dim; i++) { BaseClass* b = (*cd.baseclasses)[i]; if (b.sym == this || isBaseOf2(b.sym)) return true; } return false; } enum OFFSET_RUNTIME = 0x76543210; enum OFFSET_FWDREF = 0x76543211; /******************************************* * Determine if 'this' is a base class of cd. */ bool isBaseOf(ClassDeclaration cd, int* poffset) { //printf("ClassDeclaration.isBaseOf(this = '%s', cd = '%s')\n", toChars(), cd.toChars()); if (poffset) *poffset = 0; while (cd) { /* cd.baseClass might not be set if cd is forward referenced. */ if (!cd.baseClass && cd.semanticRun < PASS.semanticdone && !cd.isInterfaceDeclaration()) { cd.dsymbolSemantic(null); if (!cd.baseClass && cd.semanticRun < PASS.semanticdone) cd.error("base class is forward referenced by `%s`", toChars()); } if (this == cd.baseClass) return true; cd = cd.baseClass; } return false; } /********************************************* * Determine if 'this' has complete base class information. * This is used to detect forward references in covariant overloads. */ final bool isBaseInfoComplete() const { return baseok >= Baseok.done; } override final Dsymbol search(const ref Loc loc, Identifier ident, int flags = SearchLocalsOnly) { //printf("%s.ClassDeclaration.search('%s', flags=x%x)\n", toChars(), ident.toChars(), flags); //if (_scope) printf("%s baseok = %d\n", toChars(), baseok); if (_scope && baseok < Baseok.done) { if (!inuse) { // must semantic on base class/interfaces inuse = true; dsymbolSemantic(this, null); inuse = false; } } if (!members || !symtab) // opaque or addMember is not yet done { error("is forward referenced when looking for `%s`", ident.toChars()); //*(char*)0=0; return null; } auto s = ScopeDsymbol.search(loc, ident, flags); // don't search imports of base classes if (flags & SearchImportsOnly) return s; if (!s) { // Search bases classes in depth-first, left to right order for (size_t i = 0; i < baseclasses.dim; i++) { BaseClass* b = (*baseclasses)[i]; if (b.sym) { if (!b.sym.symtab) error("base `%s` is forward referenced", b.sym.ident.toChars()); else { import dmd.access : symbolIsVisible; s = b.sym.search(loc, ident, flags); if (!s) continue; else if (s == this) // happens if s is nested in this and derives from this s = null; else if (!(flags & IgnoreSymbolVisibility) && !(s.prot().kind == Prot.Kind.protected_) && !symbolIsVisible(this, s)) s = null; else break; } } } } return s; } /************************************ * Search base classes in depth-first, left-to-right order for * a class or interface named 'ident'. * Stops at first found. Does not look for additional matches. * Params: * ident = identifier to search for * Returns: * ClassDeclaration if found, null if not */ final ClassDeclaration searchBase(Identifier ident) { foreach (b; *baseclasses) { auto cdb = b.type.isClassHandle(); if (!cdb) // https://issues.dlang.org/show_bug.cgi?id=10616 return null; if (cdb.ident.equals(ident)) return cdb; auto result = cdb.searchBase(ident); if (result) return result; } return null; } final override void finalizeSize() { assert(sizeok != Sizeok.done); // Set the offsets of the fields and determine the size of the class if (baseClass) { assert(baseClass.sizeok == Sizeok.done); alignsize = baseClass.alignsize; structsize = baseClass.structsize; if (classKind == ClassKind.cpp && global.params.isWindows) structsize = (structsize + alignsize - 1) & ~(alignsize - 1); } else if (isInterfaceDeclaration()) { if (interfaces.length == 0) { alignsize = target.ptrsize; structsize = target.ptrsize; // allow room for __vptr } } else { alignsize = target.ptrsize; structsize = target.ptrsize; // allow room for __vptr if (hasMonitor()) structsize += target.ptrsize; // allow room for __monitor } //printf("finalizeSize() %s, sizeok = %d\n", toChars(), sizeok); size_t bi = 0; // index into vtblInterfaces[] /**** * Runs through the inheritance graph to set the BaseClass.offset fields. * Recursive in order to account for the size of the interface classes, if they are * more than just interfaces. * Params: * cd = interface to look at * baseOffset = offset of where cd will be placed * Returns: * subset of instantiated size used by cd for interfaces */ uint membersPlace(ClassDeclaration cd, uint baseOffset) { //printf(" membersPlace(%s, %d)\n", cd.toChars(), baseOffset); uint offset = baseOffset; foreach (BaseClass* b; cd.interfaces) { if (b.sym.sizeok != Sizeok.done) b.sym.finalizeSize(); assert(b.sym.sizeok == Sizeok.done); if (!b.sym.alignsize) b.sym.alignsize = target.ptrsize; alignmember(b.sym.alignsize, b.sym.alignsize, &offset); assert(bi < vtblInterfaces.dim); BaseClass* bv = (*vtblInterfaces)[bi]; if (b.sym.interfaces.length == 0) { //printf("\tvtblInterfaces[%d] b=%p b.sym = %s, offset = %d\n", bi, bv, bv.sym.toChars(), offset); bv.offset = offset; ++bi; // All the base interfaces down the left side share the same offset for (BaseClass* b2 = bv; b2.baseInterfaces.length; ) { b2 = &b2.baseInterfaces[0]; b2.offset = offset; //printf("\tvtblInterfaces[%d] b=%p sym = %s, offset = %d\n", bi, b2, b2.sym.toChars(), b2.offset); } } membersPlace(b.sym, offset); //printf(" %s size = %d\n", b.sym.toChars(), b.sym.structsize); offset += b.sym.structsize; if (alignsize < b.sym.alignsize) alignsize = b.sym.alignsize; } return offset - baseOffset; } structsize += membersPlace(this, structsize); if (isInterfaceDeclaration()) { sizeok = Sizeok.done; return; } // FIXME: Currently setFieldOffset functions need to increase fields // to calculate each variable offsets. It can be improved later. fields.setDim(0); uint offset = structsize; foreach (s; *members) { s.setFieldOffset(this, &offset, false); } sizeok = Sizeok.done; // Calculate fields[i].overlapped checkOverlappedFields(); } /************** * Returns: true if there's a __monitor field */ final bool hasMonitor() { return classKind == ClassKind.d; } override bool isAnonymous() { return isActuallyAnonymous; } final bool isFuncHidden(FuncDeclaration fd) { //printf("ClassDeclaration.isFuncHidden(class = %s, fd = %s)\n", toChars(), fd.toPrettyChars()); Dsymbol s = search(Loc.initial, fd.ident, IgnoreAmbiguous | IgnoreErrors); if (!s) { //printf("not found\n"); /* Because, due to a hack, if there are multiple definitions * of fd.ident, NULL is returned. */ return false; } s = s.toAlias(); if (auto os = s.isOverloadSet()) { foreach (sm; os.a) { auto fm = sm.isFuncDeclaration(); if (overloadApply(fm, s => fd == s.isFuncDeclaration())) return false; } return true; } else { auto f = s.isFuncDeclaration(); //printf("%s fdstart = %p\n", s.kind(), fdstart); if (overloadApply(f, s => fd == s.isFuncDeclaration())) return false; return !fd.parent.isTemplateMixin(); } } /**************** * Find virtual function matching identifier and type. * Used to build virtual function tables for interface implementations. * Params: * ident = function's identifier * tf = function's type * Returns: * function symbol if found, null if not * Errors: * prints error message if more than one match */ final FuncDeclaration findFunc(Identifier ident, TypeFunction tf) { //printf("ClassDeclaration.findFunc(%s, %s) %s\n", ident.toChars(), tf.toChars(), toChars()); FuncDeclaration fdmatch = null; FuncDeclaration fdambig = null; void updateBestMatch(FuncDeclaration fd) { fdmatch = fd; fdambig = null; //printf("Lfd fdmatch = %s %s [%s]\n", fdmatch.toChars(), fdmatch.type.toChars(), fdmatch.loc.toChars()); } void searchVtbl(ref Dsymbols vtbl) { foreach (s; vtbl) { auto fd = s.isFuncDeclaration(); if (!fd) continue; // the first entry might be a ClassInfo //printf("\t[%d] = %s\n", i, fd.toChars()); if (ident == fd.ident && fd.type.covariant(tf) == 1) { //printf("fd.parent.isClassDeclaration() = %p\n", fd.parent.isClassDeclaration()); if (!fdmatch) { updateBestMatch(fd); continue; } if (fd == fdmatch) continue; { // Function type matching: exact > covariant MATCH m1 = tf.equals(fd.type) ? MATCH.exact : MATCH.nomatch; MATCH m2 = tf.equals(fdmatch.type) ? MATCH.exact : MATCH.nomatch; if (m1 > m2) { updateBestMatch(fd); continue; } else if (m1 < m2) continue; } { MATCH m1 = (tf.mod == fd.type.mod) ? MATCH.exact : MATCH.nomatch; MATCH m2 = (tf.mod == fdmatch.type.mod) ? MATCH.exact : MATCH.nomatch; if (m1 > m2) { updateBestMatch(fd); continue; } else if (m1 < m2) continue; } { // The way of definition: non-mixin > mixin MATCH m1 = fd.parent.isClassDeclaration() ? MATCH.exact : MATCH.nomatch; MATCH m2 = fdmatch.parent.isClassDeclaration() ? MATCH.exact : MATCH.nomatch; if (m1 > m2) { updateBestMatch(fd); continue; } else if (m1 < m2) continue; } fdambig = fd; //printf("Lambig fdambig = %s %s [%s]\n", fdambig.toChars(), fdambig.type.toChars(), fdambig.loc.toChars()); } //else printf("\t\t%d\n", fd.type.covariant(tf)); } } searchVtbl(vtbl); for (auto cd = this; cd; cd = cd.baseClass) { searchVtbl(cd.vtblFinal); } if (fdambig) error("ambiguous virtual function `%s`", fdambig.toChars()); return fdmatch; } /**************************************** */ final bool isCOMclass() const { return com; } bool isCOMinterface() const { return false; } final bool isCPPclass() const { return classKind == ClassKind.cpp; } bool isCPPinterface() const { return false; } /**************************************** */ final bool isAbstract() { enum log = false; if (isabstract != Abstract.fwdref) return isabstract == Abstract.yes; if (log) printf("isAbstract(%s)\n", toChars()); bool no() { if (log) printf("no\n"); isabstract = Abstract.no; return false; } bool yes() { if (log) printf("yes\n"); isabstract = Abstract.yes; return true; } if (storage_class & STC.abstract_ || _scope && _scope.stc & STC.abstract_) return yes(); if (errors) return no(); /* https://issues.dlang.org/show_bug.cgi?id=11169 * Resolve forward references to all class member functions, * and determine whether this class is abstract. */ extern (C++) static int func(Dsymbol s, void* param) { auto fd = s.isFuncDeclaration(); if (!fd) return 0; if (fd.storage_class & STC.static_) return 0; if (fd.isAbstract()) return 1; return 0; } for (size_t i = 0; i < members.dim; i++) { auto s = (*members)[i]; if (s.apply(&func, cast(void*)this)) { return yes(); } } /* If the base class is not abstract, then this class cannot * be abstract. */ if (!isInterfaceDeclaration() && (!baseClass || !baseClass.isAbstract())) return no(); /* If any abstract functions are inherited, but not overridden, * then the class is abstract. Do this by checking the vtbl[]. * Need to do semantic() on class to fill the vtbl[]. */ this.dsymbolSemantic(null); /* The next line should work, but does not because when ClassDeclaration.dsymbolSemantic() * is called recursively it can set PASS.semanticdone without finishing it. */ //if (semanticRun < PASS.semanticdone) { /* Could not complete semantic(). Try running semantic() on * each of the virtual functions, * which will fill in the vtbl[] overrides. */ extern (C++) static int virtualSemantic(Dsymbol s, void* param) { auto fd = s.isFuncDeclaration(); if (fd && !(fd.storage_class & STC.static_) && !fd.isUnitTestDeclaration()) fd.dsymbolSemantic(null); return 0; } for (size_t i = 0; i < members.dim; i++) { auto s = (*members)[i]; s.apply(&virtualSemantic, cast(void*)this); } } /* Finally, check the vtbl[] */ foreach (i; 1 .. vtbl.dim) { auto fd = vtbl[i].isFuncDeclaration(); //if (fd) printf("\tvtbl[%d] = [%s] %s\n", i, fd.loc.toChars(), fd.toPrettyChars()); if (!fd || fd.isAbstract()) { return yes(); } } return no(); } /**************************************** * Determine if slot 0 of the vtbl[] is reserved for something else. * For class objects, yes, this is where the classinfo ptr goes. * For COM interfaces, no. * For non-COM interfaces, yes, this is where the Interface ptr goes. * Returns: * 0 vtbl[0] is first virtual function pointer * 1 vtbl[0] is classinfo/interfaceinfo pointer */ int vtblOffset() const { return classKind == ClassKind.cpp ? 0 : 1; } /**************************************** */ override const(char)* kind() const { return "class"; } /**************************************** */ override final void addLocalClass(ClassDeclarations* aclasses) { if (classKind != ClassKind.objc) aclasses.push(this); } override final void addObjcSymbols(ClassDeclarations* classes, ClassDeclarations* categories) { .objc.addSymbols(this, classes, categories); } // Back end Dsymbol vtblsym; final Dsymbol vtblSymbol() { if (!vtblsym) { auto vtype = Type.tvoidptr.immutableOf().sarrayOf(vtbl.dim); auto var = new VarDeclaration(loc, vtype, Identifier.idPool("__vtbl"), null, STC.immutable_ | STC.static_); var.addMember(null, this); var.isdataseg = 1; var.linkage = LINK.d; var.semanticRun = PASS.semanticdone; // no more semantic wanted vtblsym = var; } return vtblsym; } override final inout(ClassDeclaration) isClassDeclaration() inout { return this; } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** */ extern (C++) final class InterfaceDeclaration : ClassDeclaration { extern (D) this(const ref Loc loc, Identifier id, BaseClasses* baseclasses) { super(loc, id, baseclasses, null, false); if (id == Id.IUnknown) // IUnknown is the root of all COM interfaces { com = true; classKind = ClassKind.cpp; // IUnknown is also a C++ interface } } override Dsymbol syntaxCopy(Dsymbol s) { InterfaceDeclaration id = s ? cast(InterfaceDeclaration)s : new InterfaceDeclaration(loc, ident, null); return ClassDeclaration.syntaxCopy(id); } override Scope* newScope(Scope* sc) { auto sc2 = super.newScope(sc); if (com) sc2.linkage = LINK.windows; else if (classKind == ClassKind.cpp) sc2.linkage = LINK.cpp; else if (classKind == ClassKind.objc) sc2.linkage = LINK.objc; return sc2; } /******************************************* * Determine if 'this' is a base class of cd. * (Actually, if it is an interface supported by cd) * Output: * *poffset offset to start of class * OFFSET_RUNTIME must determine offset at runtime * Returns: * false not a base * true is a base */ override bool isBaseOf(ClassDeclaration cd, int* poffset) { //printf("%s.InterfaceDeclaration.isBaseOf(cd = '%s')\n", toChars(), cd.toChars()); assert(!baseClass); foreach (b; cd.interfaces) { //printf("\tX base %s\n", b.sym.toChars()); if (this == b.sym) { //printf("\tfound at offset %d\n", b.offset); if (poffset) { // don't return incorrect offsets // https://issues.dlang.org/show_bug.cgi?id=16980 *poffset = cd.sizeok == Sizeok.done ? b.offset : OFFSET_FWDREF; } // printf("\tfound at offset %d\n", b.offset); return true; } if (isBaseOf(b, poffset)) return true; } if (cd.baseClass && isBaseOf(cd.baseClass, poffset)) return true; if (poffset) *poffset = 0; return false; } bool isBaseOf(BaseClass* bc, int* poffset) { //printf("%s.InterfaceDeclaration.isBaseOf(bc = '%s')\n", toChars(), bc.sym.toChars()); for (size_t j = 0; j < bc.baseInterfaces.length; j++) { BaseClass* b = &bc.baseInterfaces[j]; //printf("\tY base %s\n", b.sym.toChars()); if (this == b.sym) { //printf("\tfound at offset %d\n", b.offset); if (poffset) { *poffset = b.offset; } return true; } if (isBaseOf(b, poffset)) { return true; } } if (poffset) *poffset = 0; return false; } /******************************************* */ override const(char)* kind() const { return "interface"; } /**************************************** * Determine if slot 0 of the vtbl[] is reserved for something else. * For class objects, yes, this is where the ClassInfo ptr goes. * For COM interfaces, no. * For non-COM interfaces, yes, this is where the Interface ptr goes. */ override int vtblOffset() const { if (isCOMinterface() || isCPPinterface()) return 0; return 1; } override bool isCPPinterface() const { return classKind == ClassKind.cpp; } override bool isCOMinterface() const { return com; } override inout(InterfaceDeclaration) isInterfaceDeclaration() inout { return this; } override void accept(Visitor v) { v.visit(this); } }
D
const int Value_Ru_Icelance = 1000; const int Value_Ru_Whirlwind = 1000; const int Value_Ru_Thunderstorm = 1500; const int Value_Ru_Geyser = 1500; const int Value_Ru_Waterfist = 2000; const int Value_Ru_Greententacle = 2500; const int Value_Ru_Swarm = 1500; const int Value_Ru_Energyball = 3500; const int Value_Ru_SuckEnergy = 3500; const int Value_Ru_Skull = 2000; const int Value_Ru_SummonGuardian = 2000; const int Value_Ru_SummonZombie = 2000; const int Value_Ru_Beliar = 100; const int Value_Ru_Water = 200; instance ItRu_Thunderstorm(C_Item) { name = NAME_Rune; mainflag = ITEM_KAT_RUNE; flags = 0; value = Value_Ru_Thunderstorm; visual = "ItRu_Water05.3DS"; material = MAT_STONE; spell = SPL_Thunderstorm; mag_circle = 3; wear = WEAR_EFFECT; effect = "SPELLFX_WEAKGLIMMER_BLUE"; description = NAME_SPL_Thunderstorm; text[0] = NAME_Mag_Circle; count[0] = mag_circle; text[1] = NAME_Manakosten; count[1] = SPL_Cost_Thunderstorm; text[2] = NAME_Dam_Magic; count[2] = SPL_DAMAGE_Thunderstorm; text[5] = NAME_Value; count[5] = value; }; instance ItRu_Whirlwind(C_Item) { name = NAME_Rune; mainflag = ITEM_KAT_RUNE; flags = 0; value = Value_Ru_Whirlwind; visual = "ItRu_Water02.3DS"; material = MAT_STONE; spell = SPL_Whirlwind; mag_circle = 2; wear = WEAR_EFFECT; effect = "SPELLFX_WEAKGLIMMER_BLUE"; description = NAME_SPL_Whirlwind; text[0] = NAME_Mag_Circle; count[0] = mag_circle; text[1] = NAME_Manakosten; count[1] = SPL_Cost_Whirlwind; text[2] = NAME_Dam_Magic; count[2] = 60; //text[3] = "Чистый урон в секунду:"; //count[3] = SPL_Whirlwind_DAMAGE; text[3] = NAME_Sec_Duration; count[3] = SPL_TIME_WHIRLWIND; text[5] = NAME_Value; count[5] = value; }; instance ItRu_Geyser(C_Item) { name = NAME_Rune; mainflag = ITEM_KAT_RUNE; flags = 0; value = Value_Ru_Geyser; visual = "ItRu_Water01.3DS"; material = MAT_STONE; spell = SPL_Geyser; mag_circle = 3; wear = WEAR_EFFECT; effect = "SPELLFX_WEAKGLIMMER_BLUE"; description = NAME_SPL_Geyser; text[0] = NAME_Mag_Circle; count[0] = mag_circle; text[1] = NAME_Manakosten; count[1] = SPL_Cost_Geyser; text[2] = NAME_Dam_Magic; count[2] = SPL_DAMAGE_Geyser; text[4] = NAME_Addon_SpellDontKill; text[5] = NAME_Value; count[5] = value; }; instance ItRu_Waterfist(C_Item) { name = NAME_Rune; mainflag = ITEM_KAT_RUNE; flags = 0; value = Value_Ru_Waterfist; visual = "ItRu_Water03.3DS"; material = MAT_STONE; spell = SPL_WaterFist; mag_circle = 4; wear = WEAR_EFFECT; effect = "SPELLFX_WEAKGLIMMER_BLUE"; description = NAME_SPL_WaterFist; text[0] = NAME_Mag_Circle; count[0] = mag_circle; text[1] = NAME_Manakosten; count[1] = SPL_Cost_Waterfist; text[2] = NAME_Dam_Magic; count[2] = SPL_DAMAGE_Waterfist; text[4] = NAME_Addon_SpellDontKill; text[5] = NAME_Value; count[5] = value; }; instance ItRu_Icelance(C_Item) { name = NAME_Rune; mainflag = ITEM_KAT_RUNE; flags = 0; value = Value_Ru_Icelance; visual = "ItRu_Water04.3DS"; material = MAT_STONE; spell = SPL_IceLance; mag_circle = 2; wear = WEAR_EFFECT; effect = "SPELLFX_WEAKGLIMMER_BLUE"; description = NAME_SPL_IceLance; text[0] = NAME_Mag_Circle; count[0] = mag_circle; text[1] = NAME_Manakosten; count[1] = SPL_Cost_Icelance; text[2] = NAME_Dam_Magic; count[2] = SPL_DAMAGE_Icelance; text[5] = NAME_Value; count[5] = value; }; instance ItRu_BeliarsRage(C_Item) { name = NAME_Rune; mainflag = ITEM_KAT_RUNE; flags = 0; value = Value_Ru_Energyball; visual = "ItRu_Beliar04.3DS"; material = MAT_STONE; spell = SPL_Energyball; mag_circle = 3; wear = WEAR_EFFECT; effect = "SPELLFX_WEAKGLIMMER_RED"; description = NAME_SPL_BeliarsRage; text[0] = NAME_Mag_Circle; count[0] = mag_circle; text[1] = NAME_Manakosten; count[1] = SPL_Cost_Energyball; text[2] = NAME_Dam_Magic; count[2] = SPL_DAMAGE_Energyball; text[5] = NAME_Value; count[5] = value; }; instance ItRu_SuckEnergy(C_Item) { name = NAME_Rune; mainflag = ITEM_KAT_RUNE; flags = 0; value = Value_Ru_SuckEnergy; visual = "ItRu_Beliar01.3DS"; material = MAT_STONE; spell = SPL_SuckEnergy; mag_circle = 2; wear = WEAR_EFFECT; effect = "SPELLFX_WEAKGLIMMER_RED"; description = NAME_SPL_SuckEnergy; text[0] = NAME_Mag_Circle; count[0] = mag_circle; text[1] = NAME_Manakosten; count[1] = SPL_Cost_SuckEnergy; text[2] = "Чистый урон в секунду:"; count[2] = SPL_SuckEnergy_Damage; text[3] = NAME_Sec_Duration; count[3] = 8; text[4] = NAME_Addon_SpellDontKill; text[5] = NAME_Value; count[5] = value; }; instance ItRu_GreenTentacle(C_Item) { name = NAME_Rune; mainflag = ITEM_KAT_RUNE; flags = 0; value = Value_Ru_Greententacle; visual = "ItRu_Beliar03.3DS"; material = MAT_STONE; spell = SPL_GreenTentacle; mag_circle = 1; wear = WEAR_EFFECT; effect = "SPELLFX_WEAKGLIMMER_RED"; description = NAME_SPL_GreenTentacle; text[0] = NAME_Mag_Circle; count[0] = mag_circle; text[1] = NAME_Manakosten; count[1] = SPL_Cost_Greententacle; text[2] = NAME_Sec_Duration; count[2] = SPL_TIME_Greententacle; text[5] = NAME_Value; count[5] = value; }; instance ItRu_Swarm(C_Item) { name = NAME_Rune; mainflag = ITEM_KAT_RUNE; flags = 0; value = Value_Ru_Swarm; visual = "ItRu_Beliar02.3DS"; material = MAT_STONE; spell = SPL_Swarm; mag_circle = 4; wear = WEAR_EFFECT; effect = "SPELLFX_WEAKGLIMMER_RED"; description = NAME_SPL_Swarm; text[0] = NAME_Mag_Circle; count[0] = mag_circle; text[1] = NAME_Manakosten; count[1] = SPL_Cost_Swarm; text[2] = "Чистый урон в секунду:"; count[2] = SPL_Swarm_Damage; text[3] = NAME_Sec_Duration; count[3] = SPL_TIME_Swarm; text[5] = NAME_Value; count[5] = value; }; instance ItRu_Skull(C_Item) { name = NAME_Rune; mainflag = ITEM_KAT_RUNE; flags = 0; value = Value_Ru_Skull; visual = "ItRu_Beliar05.3DS"; material = MAT_STONE; spell = SPL_Skull; mag_circle = 5; wear = WEAR_EFFECT; effect = "SPELLFX_WEAKGLIMMER_RED"; description = NAME_SPL_Skull; text[0] = NAME_Mag_Circle; count[0] = mag_circle; text[1] = NAME_MinManakosten; count[1] = SPL_Cost_Skull; text[2] = NAME_Dam_Magic; count[2] = SPL_Damage_Skull; text[4] = NAME_Addon_NeedsAllMana; text[5] = NAME_Value; count[5] = value; }; instance ItRu_SummonZombie(C_Item) { name = NAME_Rune; mainflag = ITEM_KAT_RUNE; flags = 0; value = Value_Ru_SummonZombie; visual = "ItRu_Beliar07.3DS"; material = MAT_STONE; spell = SPL_SummonZombie; mag_circle = 4; wear = WEAR_EFFECT; effect = "SPELLFX_WEAKGLIMMER_RED"; description = NAME_SPL_SummonZombie; text[0] = NAME_Mag_Circle; count[0] = mag_circle; text[1] = NAME_Manakosten; count[1] = SPL_Cost_SummonZombie; text[5] = NAME_Value; count[5] = value; }; instance ItRu_SummonGuardian(C_Item) { name = NAME_Rune; mainflag = ITEM_KAT_RUNE; flags = 0; value = Value_Ru_SummonGuardian; visual = "ItRu_Beliar06.3DS"; material = MAT_STONE; spell = SPL_SummonGuardian; mag_circle = 3; wear = WEAR_EFFECT; effect = "SPELLFX_WEAKGLIMMER_RED"; description = NAME_SPL_SummonGuardian; text[0] = NAME_Mag_Circle; count[0] = mag_circle; text[1] = NAME_Manakosten; count[1] = SPL_Cost_SummonGuardian; text[5] = NAME_Value; count[5] = value; }; //Надувание людей (тест) instance ItRu_Inflate(C_Item) { name = NAME_Rune; mainflag = ITEM_KAT_RUNE; flags = 0; value = 0; visual = "ItRu_Inflate.3DS"; material = MAT_STONE; spell = SPL_Inflate; mag_circle = 3; wear = WEAR_EFFECT; effect = "SPELLFX_WEAKGLIMMER_BLUE"; description = NAME_SPL_Inflate; text[0] = NAME_Mag_Circle; count[0] = mag_circle; text[1] = NAME_Manakosten; count[1] = SPL_Cost_Inflate; text[2] = "Чистый урон в секунду:"; count[2] = SPL_Inflate_Damage; text[3] = NAME_Sec_Duration; count[3] = SPL_TIME_Inflate; };
D
import std.stdio, std.string, std.algorithm, std.range; final class ArgumentException : Exception { this(string text) pure nothrow @safe /*@nogc*/ { super(text); } } alias TDependencies = string[][string]; string[][] topoSort(TDependencies d) pure /*nothrow @safe*/ { foreach (immutable k, v; d) d[k] = v.sort().uniq.filter!(s => s != k).array; foreach (immutable s; d.byValue.join.sort().uniq) if (s !in d) d[s] = []; string[][] sorted; while (true) { string[] ordered; foreach (immutable item, const dep; d) if (dep.empty) ordered ~= item; if (!ordered.empty) sorted ~= ordered.sort().release; else break; TDependencies dd; foreach (immutable item, const dep; d) if (!ordered.canFind(item)) dd[item] = dep.dup.filter!(s => !ordered.canFind(s)).array; d = dd; } //if (!d.empty) if (d.length > 0) throw new ArgumentException(format( "A cyclic dependency exists amongst:\n%s", d)); return sorted; } void main() { immutable data = "des_system_lib std synopsys std_cell_lib des_system_lib dw02 dw01 ramlib ieee dw01 ieee dw01 dware gtech dw02 ieee dw02 dware dw03 std synopsys dware dw03 dw02 dw01 ieee gtech dw04 dw04 ieee dw01 dware gtech dw05 dw05 ieee dware dw06 dw06 ieee dware dw07 ieee dware dware ieee dware gtech ieee gtech ramlib std ieee std_cell_lib ieee std_cell_lib synopsys"; TDependencies deps; foreach (immutable line; data.splitLines) deps[line.split[0]] = line.split[1 .. $]; auto depw = deps.dup; foreach (immutable idx, const subOrder; depw.topoSort) writefln("#%d : %s", idx + 1, subOrder); writeln; depw = deps.dup; depw["dw01"] ~= "dw04"; foreach (const subOrder; depw.topoSort) // Should throw. subOrder.writeln; }
D
import kratos.ecs; import kratos.component.camera; import kratos.component.meshrenderer; import kratos.component.transform; import kratos.resource.loader.imageloader; import kratos.graphics.texture; import kgl3n; class TerrainTile : Component { string textureName; private { @dependency { Transform transform; MeshRenderer meshRenderer; CameraSelection cameraSelection; } enum textureUniformName = "texture"; uint currentLevel = -1; } void frameUpdate() { auto distance = (cameraSelection.mainCamera.transform.worldTransformation.position - transform.worldTransformation.position).magnitude; auto lod = (distance / 1024).max(0).log2.max(0).to!uint; if(currentLevel != lod) { meshRenderer.mesh.renderState.shader.uniforms[textureUniformName] = TextureManager.create(loadImage(textureName, lod)); currentLevel = lod; } } }
D
# FIXED simplelink/source/driver.obj: C:/ti/CC3100SDK_1.1.0/cc3100-sdk/simplelink/source/driver.c simplelink/source/driver.obj: C:/ti/CC3100SDK_1.1.0/cc3100-sdk/simplelink/include/simplelink.h simplelink/source/driver.obj: C:/ti/CC3100SDK_1.1.0/cc3100-sdk/platform/msp430f5529lp/user.h simplelink/source/driver.obj: C:/ti/ccsv7/tools/compiler/msp430_4.3.8/include/string.h simplelink/source/driver.obj: C:/ti/ccsv7/tools/compiler/msp430_4.3.8/include/linkage.h simplelink/source/driver.obj: C:/ti/ccsv7/ccs_base/msp430/include/msp430.h simplelink/source/driver.obj: C:/ti/ccsv7/ccs_base/msp430/include/msp430f5529.h simplelink/source/driver.obj: C:/ti/ccsv7/ccs_base/msp430/include/in430.h simplelink/source/driver.obj: C:/ti/ccsv7/tools/compiler/msp430_4.3.8/include/intrinsics.h simplelink/source/driver.obj: C:/ti/CC3100SDK_1.1.0/cc3100-sdk/platform/msp430f5529lp/board.h simplelink/source/driver.obj: C:/ti/ccsv7/tools/compiler/msp430_4.3.8/include/stdint.h simplelink/source/driver.obj: C:/ti/CC3100SDK_1.1.0/cc3100-sdk/platform/msp430f5529lp/cli_uart.h simplelink/source/driver.obj: C:/ti/CC3100SDK_1.1.0/cc3100-sdk/platform/msp430f5529lp/spi.h simplelink/source/driver.obj: C:/ti/CC3100SDK_1.1.0/cc3100-sdk/simplelink/include/../source/objInclusion.h simplelink/source/driver.obj: C:/ti/CC3100SDK_1.1.0/cc3100-sdk/simplelink/include/simplelink.h simplelink/source/driver.obj: C:/ti/CC3100SDK_1.1.0/cc3100-sdk/simplelink/include/trace.h simplelink/source/driver.obj: C:/ti/CC3100SDK_1.1.0/cc3100-sdk/simplelink/include/fs.h simplelink/source/driver.obj: C:/ti/CC3100SDK_1.1.0/cc3100-sdk/simplelink/include/socket.h simplelink/source/driver.obj: C:/ti/CC3100SDK_1.1.0/cc3100-sdk/simplelink/include/netapp.h simplelink/source/driver.obj: C:/ti/CC3100SDK_1.1.0/cc3100-sdk/simplelink/include/wlan.h simplelink/source/driver.obj: C:/ti/CC3100SDK_1.1.0/cc3100-sdk/simplelink/include/device.h simplelink/source/driver.obj: C:/ti/CC3100SDK_1.1.0/cc3100-sdk/simplelink/include/netcfg.h simplelink/source/driver.obj: C:/ti/CC3100SDK_1.1.0/cc3100-sdk/simplelink/include/wlan_rx_filters.h simplelink/source/driver.obj: C:/ti/CC3100SDK_1.1.0/cc3100-sdk/simplelink/include/../source/nonos.h simplelink/source/driver.obj: C:/ti/CC3100SDK_1.1.0/cc3100-sdk/simplelink/source/protocol.h simplelink/source/driver.obj: C:/ti/CC3100SDK_1.1.0/cc3100-sdk/simplelink/source/driver.h simplelink/source/driver.obj: C:/ti/CC3100SDK_1.1.0/cc3100-sdk/simplelink/source/flowcont.h C:/ti/CC3100SDK_1.1.0/cc3100-sdk/simplelink/source/driver.c: C:/ti/CC3100SDK_1.1.0/cc3100-sdk/simplelink/include/simplelink.h: C:/ti/CC3100SDK_1.1.0/cc3100-sdk/platform/msp430f5529lp/user.h: C:/ti/ccsv7/tools/compiler/msp430_4.3.8/include/string.h: C:/ti/ccsv7/tools/compiler/msp430_4.3.8/include/linkage.h: C:/ti/ccsv7/ccs_base/msp430/include/msp430.h: C:/ti/ccsv7/ccs_base/msp430/include/msp430f5529.h: C:/ti/ccsv7/ccs_base/msp430/include/in430.h: C:/ti/ccsv7/tools/compiler/msp430_4.3.8/include/intrinsics.h: C:/ti/CC3100SDK_1.1.0/cc3100-sdk/platform/msp430f5529lp/board.h: C:/ti/ccsv7/tools/compiler/msp430_4.3.8/include/stdint.h: C:/ti/CC3100SDK_1.1.0/cc3100-sdk/platform/msp430f5529lp/cli_uart.h: C:/ti/CC3100SDK_1.1.0/cc3100-sdk/platform/msp430f5529lp/spi.h: C:/ti/CC3100SDK_1.1.0/cc3100-sdk/simplelink/include/../source/objInclusion.h: C:/ti/CC3100SDK_1.1.0/cc3100-sdk/simplelink/include/simplelink.h: C:/ti/CC3100SDK_1.1.0/cc3100-sdk/simplelink/include/trace.h: C:/ti/CC3100SDK_1.1.0/cc3100-sdk/simplelink/include/fs.h: C:/ti/CC3100SDK_1.1.0/cc3100-sdk/simplelink/include/socket.h: C:/ti/CC3100SDK_1.1.0/cc3100-sdk/simplelink/include/netapp.h: C:/ti/CC3100SDK_1.1.0/cc3100-sdk/simplelink/include/wlan.h: C:/ti/CC3100SDK_1.1.0/cc3100-sdk/simplelink/include/device.h: C:/ti/CC3100SDK_1.1.0/cc3100-sdk/simplelink/include/netcfg.h: C:/ti/CC3100SDK_1.1.0/cc3100-sdk/simplelink/include/wlan_rx_filters.h: C:/ti/CC3100SDK_1.1.0/cc3100-sdk/simplelink/include/../source/nonos.h: C:/ti/CC3100SDK_1.1.0/cc3100-sdk/simplelink/source/protocol.h: C:/ti/CC3100SDK_1.1.0/cc3100-sdk/simplelink/source/driver.h: C:/ti/CC3100SDK_1.1.0/cc3100-sdk/simplelink/source/flowcont.h:
D
.hd dseek$ "seek on a disk device" 01/24/82 integer function dseek$ (pos, f, ra) file_mark pos file_des f integer ra .sp Library: vswtlb (standard Subsystem library) .fs 'Dseek$' is an internal Subsystem routine that performs the function of 'seekf' for disk files only. The first argument is a long integer value which specifies the amount of relative or absolute positioning, depending on the value of the third argument, 'ra'. If 'ra' equals ABS then positioning is from the beginning of the file; if 'ra' equals REL then positioning is from the current position. The second argument is the file descriptor of the file whose file pointer is being manipulated. The function return is OK if the positioning was successful, ERR if 'ra' is ABS and 'pos' is negative, ERR if 'ra' is neither ABS nor REL, and EOF otherwise. 'Dseek$' is not intended for general use; it is not protected from user error, and may cause termination of the user's program if used incorrectly. It should always be referenced through 'seekf'. .im 'Dseek$' calls the Primos subroutine PRWF$$ to set the file pointer of a disk file. .ca Primos prwf$$ .bu EOF is returned if any error occurs during disk read; the user is not informed of the actual error that occurs. .sa seekf (2)
D
/** * Copyright: Copyright Digital Mars 2000 - 2010. * License: <a href="http://www.boost.org/LICENSE_1_0.txt">Boost License 1.0</a>. This is like the hashtable implementation, but only stores a key. It stores entries directly in the table where possible. or otherwise link chains them. References to the keys should not be stored by code, since operations may move the data nodes. Remove is not supported during iteration with opApply, foreach, etc. Integer indexes are stored and directly used as the hash. authors: Michael Rynn */ module hash.hashset; import core.memory; import core.exception; import std.traits; import core.stdc.string : memset, memcpy; import hash.util; import std.stdio; import std.variant; //version = NodeHeap; version = miss_stats; version = prime_size; version(NodeHeap) { import tangy.util.container.Container; pragma(msg, "hashtablist uses NodeHeap"); } private { extern (C) void* gc_malloc( size_t sz, uint ba = 0 ); extern (C) void* gc_calloc( size_t sz, uint ba = 0 ); extern (C) void gc_free( void* p ); } class AAKeyError : Error { this(string msg) { super(msg); } } /// The node structure for the hash table trees. private immutable Variant sNullVariant; private import std.c.stdlib; private struct HtlEntry(K) { //alias HtlEntry* EntryPtr; static if (K.sizeof > size_t.sizeof || is(K==class) || is(K==interface)) hash_t hash_; HtlEntry* next_; K key_; void swap(HtlEntry* other) { static if (K.sizeof > size_t.sizeof || is(K==class) || is(K==interface)) { hash_t temph = other.hash_; other.hash_ = hash_; hash_ = temph; } HtlEntry* temp = other.next_; other.next_ = next_; next_ = temp; K tempkey = other.key_; other.key_ = key_; key_ = tempkey; } void wipe() { next_ = null; static if(!is(K == Variant)) key_ = K.init; else key_ = sNullVariant; static if (K.sizeof > size_t.sizeof || is(K==class) || is(K==interface)) hash_ = 0; } } struct HashSet(K) { private alias HashSetImpl!(K) ClassImpl; alias HtlEntry!(K)* NodePtr; private ClassImpl imp_; // opIn_r can make sense as a (temporary) pointer to the key K* opIn_r(K k) { //wrap if (imp_ is null) return null; NodePtr np = imp_.getNode(k); if (np is null) return null; return &np.key_; } // treat as a virtual boolean array, no need for exception if missing bool opIndex(K k) { if (imp_ !is null) { NodePtr np = imp_.getNode(k); if (np !is null) return true; } return false; } // if value is true, insert the key if not available, else delete it void opIndexAssign(bool value, K k) { if (value) { if (imp_ is null) imp_ = new ClassImpl(); } else { if (imp_ !is null) imp_.getNode(k,NodeOp.node_destroy); } } void detach() { imp_ = null; } void clear() { if (imp_ !is null) imp_.clear(); } @property void rehash() { if (imp_ !is null) imp_.rehash; } @property HashSet init() { HashSet result; return result; } @property HashSet allocate() { HashSet result; result.imp_ = new ClassImpl(); return result; } @property K[] keys() { if (imp_ is null) return null; return imp_.keys(); } bool put(K k) { if (imp_ is null) imp_ = new ClassImpl(); size_t preNodes = imp_.nodes_; NodePtr e = imp_.getNode(k, NodeOp.node_create); return (imp_.nodes_ > preNodes); } /** return stored key if it exists, store it if it doesn't */ K get(K key) { if (imp_ is null) imp_ = new ClassImpl(); NodePtr e = imp_.getNode(key, NodeOp.node_create); return e.key_; } @property size_t capacity() { if (imp_ is null) return 0; //'return imp_.used; return imp_.capacity; } @property bool contains(K k) { return (imp_ is null) ? false : (imp_.getNode(k) !is null); } @property void capacity(size_t cap) { if (imp_ is null) imp_ = new ClassImpl(); imp_.capacity(cap); } @property double loadRatio() { if (imp_ is null) return 0; //'return imp_.used; return imp_.loadRatio; } @property void loadRatio(double ratio) { if (imp_ is null) imp_ = new ClassImpl(); imp_.loadRatio(ratio); } version(miss_stats) { @property size_t rehash_ct() { if (imp_ is null) return 0; //'return imp_.used; return imp_.rehash_ct; } @property size_t misses() { if (imp_ is null) return 0; //'return imp_.used; return imp_.misses; } @property uint[] list_stats() { if (imp_ is null) return null; //'return imp_.used; return imp_.list_stats; } } @property size_t length() { if (imp_ is null) return 0; //'return imp_.used; return imp_.nodes_; } @property HashSet dup() { HashSet copy; if (imp_ !is null) { copy.imp_ = new ClassImpl(imp_); } return copy; } bool remove(K key) { return (imp_ is null) ? false : imp_.remove(key); } public int opApply(int delegate(ref K key) dg) { return (imp_ !is null) ? imp_.opApply(dg) : 0; } } /// implementation as a class enum NodeOp { node_find, node_create, node_destroy } class HashSetImpl(K) { private: alias typeof(this) SelfType; private { alias HtlEntry!(K) Node; alias Node* NodePtr; } enum : double { LOAD_FACTOR = 1.0} version(NodeHeap) { private alias Container.DefaultCollect Heap; private alias Heap!(Node) Alloc; private Alloc heap; ~this() { heap.collect(true); } } enum : size_t { null_chain = size_t.max } Node[] table_; size_t nodes_; size_t capacity_; // how many nodes before next rehash double load_factor_; // a ratio of capacity to indication of fullness //size_t mask_; // TODO: replace this with TypeInfo_AssociativeArray when available in _aaGet() TypeInfo keyti_; version(miss_stats) { size_t max_misses_; size_t rehash_ct_; } public this(size_t cap = 0) { load_factor_ = LOAD_FACTOR; keyti_ = typeid(K); if (cap > 0) { capacity(cap); } } public this(SelfType copyme) { load_factor_ = copyme.load_factor_; keyti_ = typeid(K); capacity(copyme.capacity); foreach(k ; copyme) this.getNode(k, NodeOp.node_create); } @property size_t capacity() { return capacity_; } /// Uses loadFactor to calculate /// cannot be used to reduce capacity @property void capacity(size_t cap) { size_t nlen = cast(size_t)(cap / load_factor_); nlen = getNextPrime(nlen); resizeTable(nlen); } /// Does not trigger a rehash or resize directly. @property void loadRatio(double ratio) { if (ratio < 0.5) ratio = 0.5; else if (ratio > 16.0) ratio = 16.0; load_factor_ = ratio; } @property public double loadRatio() { return load_factor_; } @property public final size_t length() { return nodes_; } private static hash_t overhash(hash_t h) { h ^= (h >>> 20) ^ (h >>> 12); return h ^ (h >>> 7) ^ (h >>> 4); } version (miss_stats) { @property size_t misses() { return max_misses_; } @property size_t rehash_ct() { return rehash_ct_; } /// 0: table length, 1 : unoccupied nodes, /// 2* : followed by [n-2] : number of nodes on bucket n @property uint[] list_stats() { uint result[]; uint emptyCt = 0; result.length = 16; result[0] = table_.length; foreach(ref e ; table_) { if(e.next_ !is null) // entry is occupied { uint listct = 1; NodePtr np = e.next_; if (np != cast(NodePtr) null_chain) { while(np !is null) { listct++; np = np.next_; } } if (listct >= result.length-1) { result.length = listct + 2; } result[listct+1] += 1; } else { emptyCt++; } } result[1] = emptyCt; return result; } } /// return a node pointer. Null if not found, or cannot create /// if create was true, set it to false if the node was not created private static void freeTable(ref Node[] ntable) { delete ntable; ntable = null; } private static Node[] allocTable(size_t newsize) { return new Node[newsize]; } /** Return a pointer to a existing node, or null, if create is false. Return a pointer to existing node, or create a new node with the key, if create is true. */ private final NodePtr getNode(K key, NodeOp op = NodeOp.node_find) { if (table_ is null) { if (op == NodeOp.node_create) { version(prime_size) size_t nlen = getNextPrime(1); else { size_t nlen = 128; mask_ = 127; } table_ = new Node[nlen]; capacity_ = cast(size_t)(table_.length * load_factor_); // capacity tolerance } else return null; } else if ((op == NodeOp.node_create) && (nodes_ >= capacity_)) { capacity(nodes_ * 4); } immutable table_size = table_.length; static if (K.sizeof > size_t.sizeof || is(K==class) || is(K==interface)) { hash_t key_hash = keyti_.getHash(&key); } else { hash_t key_hash = overhash(key); } size_t my_chair = key_hash; version(prime_size) size_t nix = (my_chair % table_size); else size_t nix = (my_chair & mask_); NodePtr e = &table_[nix]; // last node tested NodePtr np = e.next_; version(miss_stats) size_t misses = 0; bool match_e() { static if (K.sizeof > size_t.sizeof || is(K==class) || is(K==interface)) { if ((key_hash == e.hash_) && (keyti_.compare(&key, &e.key_)==0)) //if ((key_hash == e.hash_) && keyti_.equals(&key, &e.key_)) { return true; } } else { if (key == e.key_) { return true; } } return false; } NodePtr extra_e() { version(NodeHeap) NodePtr e2 = heap.allocate(); else NodePtr e2 = cast(Node*)gc_calloc(Node.sizeof); e2.key_ = key; static if (K.sizeof > size_t.sizeof || is(K==class)|| is(K==interface)) e2.hash_ = key_hash; e2.next_ = null; return e2; } if (np is null) { // prime table is empty if (op != NodeOp.node_create) return null; // cannot find or destroy e.key_ = key; static if (K.sizeof > size_t.sizeof || is(K==class)|| is(K==interface)) e.hash_ = key_hash; e.next_ = cast(NodePtr) null_chain; nodes_++; return e; } else if (np == cast(NodePtr) null_chain) { // only prime entry to consider bool matched = match_e(); final switch(op) { case NodeOp.node_find: return matched ? e : null; case NodeOp.node_create: if (matched) return e; else { NodePtr e2 = extra_e(); e.next_ = e2; nodes_++; return e2; } case NodeOp.node_destroy: if (matched) { nodes_--; return e; } else return null; } } else { // chained search ending in null, at least one node in chain NodePtr *last_link = null; // track this in case of destroy size_t link_count = 0; for(; e !is null ;link_count++) { np = e.next_; if (match_e()) { if (op != NodeOp.node_destroy) return e; if (link_count == 0) // { assert(np !is null); // swap with node in prime table, to return a disposable node e.swap(np); if (e.next_ is null) e.next_ = cast(NodePtr) null_chain; e = np; } else if (link_count == 1) { if (np is null) { *last_link = cast(NodePtr) null_chain; } else { *last_link = np; } } else { *last_link = np; } nodes_--; return e; } last_link = cast(NodePtr*)&e.next_; e = np; } // no matches, last_link if (op != NodeOp.node_create) return null; NodePtr e3 = extra_e(); *last_link = e3; nodes_++; return e3; } assert(0); } /** Set existed to be true if the key did not exist before Return the value in the node. */ public final K set(K k, ref bool existed) { uint preCount = nodes_; NodePtr e = getNode(k, NodeOp.node_create); existed = (nodes_ > preCount); return e.key_; } public final bool put(K k) { auto preCount = nodes_; NodePtr e = getNode(k, NodeOp.node_create); return (nodes_ > preCount); } public final K* opIn_r(K k) { NodePtr e = getNode(k); if (e is null) return null; return &e.key_; } public final K get(K k) { NodePtr e = getNode(k, NodeOp.node_create); return e.key_; } public final bool contains(K k) { return (getNode(k) !is null); } /+ public final bool get(K k, ref V val ) { NodePtr e = getNode(k); if (e is null) { static if (!is(V==Variant)) val = V.init; return false; } val = e.value_; return true; } +/ public final bool opIndex(K k) { return getNode(k) != null; } /+ private void assign(ref V value, K k) { NodePtr e = getNode(k, NodeOp.node_create); e.value_ = value; if (nodes_ > capacity_) { rehash(); } } +/ public void opIndexAssign(bool value, K k) { getNode(k, value ? NodeOp.node_create : NodeOp.node_destroy); } // test if this is directly in the table, or a link private void trash(NodePtr e) { if ( (e < table_.ptr) || e >= (table_.ptr + table_.length)) { // chained memory block version(NodeHeap) { heap.collect(e); } } else { // prime table block, e.wipe(); } } // return if the key existed before the call public bool remove(K k) { NodePtr e = getNode(k, NodeOp.node_destroy); if (e is null) return false; trash(e); return true; } private void resizeTable(size_t nlen) { // Unfortunately, resize is no longer simple. // Some chained nodes will turn into prime, // Some prime nodes might be chained // rather than some more complex code, re-use getNode Node[] oldtable = table_; table_ = new Node[nlen]; size_t oldnodes = nodes_; nodes_ = 0; capacity_ = cast(size_t)(table_.length * load_factor_); if (oldnodes) { uint checkct = 0; foreach (ref te; oldtable) { NodePtr np = te.next_; if (np !is null) { NodePtr e = getNode(te.key_,NodeOp.node_create); checkct++; if (np != cast(NodePtr) null_chain) { while (np !is null) { NodePtr temp = np; e = getNode(temp.key_,NodeOp.node_create); checkct++; np = np.next_; version(NodeHeap) heap.collect(temp); } } } } } freeTable(oldtable); assert(oldnodes == nodes_); } private void rehash() { capacity( cast(size_t) (nodes_ * load_factor_)); } private void deleteAllNodes() { foreach(ref te ; table_) { if (te.next_ !is null) { NodePtr np = te.next_; te.next_ = null; if (np != cast(NodePtr) null_chain) { do { NodePtr e = np; np = e.next_; version(NodeHeap) heap.collect(e); else gc_free(e); } while (np !is null); } } } freeTable(table_); nodes_ = 0; } private void clean() { if (table_ is null) return; version(NodeHeap) { heap.clear(); freeTable(table_); nodes_ = 0; } else { deleteAllNodes(); } } public void clear() { clean(); } /* * We use this template to cast a static array to a dynamic one in opApply, * since the dmd specs don't allow them as ref parameters :F */ private template DeconstArrayType(T) { static if(isStaticArray!(T)) { alias typeof(T.init[0])[] type; //the equivalent dynamic array } else { alias T type; } } alias DeconstArrayType!(K).type K_; public int opApply(int delegate(ref K_ key) dg) { int result; foreach (ref te;table_) { NodePtr np = te.next_; if (np !is null) { result = dg(te.key_); if (result || nodes_ == 0) break; if (np != cast(NodePtr) null_chain) { do { NodePtr e = np; np = e.next_; result = dg(e.key_); if (result || nodes_ == 0) break; } while (np !is null); } } } return result; } public K[] keys() { K[] keyBlock = new K[](this.nodes_); size_t ix = 0; if(keyBlock.length > 0) { foreach(ref te ; table_) { NodePtr np = cast(NodePtr)te.next_; if (np !is null) { keyBlock[ix++] = te.key_; if (np != cast(NodePtr) null_chain) { do { keyBlock[ix++] = np.key_; np = np.next_; } while (np !is null); } } } } return keyBlock; } } template isReferenceType(T) { enum isReferenceType = is(T : const(void*)) || is( T == class ) || is( T == interface ) || is( T == delegate ); } void unit_test() { // HashSet!(int) aa; bool test; int *ptest; // test unused key assign aa[0] = true; // test dummy key assign aa[1] = true; assert(aa.get(0)); assert(aa.get(1)); // test missing key string msg = "test missing key"; assert (!aa.get(100),msg); try { test = aa[100]; assert(0,"no missing key exception"); } catch(AAKeyError e) { // ok } aa[100] = true; ptest = 100 in aa; assert(ptest !is null); auto keys = aa.keys; assert(keys[0..3] == [0,1,100]); auto bb = aa.dup; keys = bb.keys; assert(keys[0..3] == [0,1,100]); bb.clear; assert(aa.length == 3); }
D
<?xml version="1.0" encoding="ASCII" standalone="no"?> <di:SashWindowsMngr xmlns:di="http://www.eclipse.org/papyrus/0.7.0/sashdi" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmi:version="2.0"> <pageList> <availablePage> <emfPageIdentifier href="VAR_7_BeT-3514964588.notation#_copSALmGEeKQQp7P9cQvNQ"/> </availablePage> </pageList> <sashModel currentSelection="//@sashModel/@windows.0/@children.0"> <windows> <children xsi:type="di:TabFolder"> <children> <emfPageIdentifier href="VAR_7_BeT-3514964588.notation#_copSALmGEeKQQp7P9cQvNQ"/> </children> </children> </windows> </sashModel> </di:SashWindowsMngr>
D
// symbols.d // // Copyright Peter Williams 2013 <pwil3058@bigpond.net.au>. // // 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 symbols; import std.string; import std.regex; import sets; import idnumber; import workarounds; import grallina.babs.lexan; alias uint SymbolId; enum SpecialSymbols : SymbolId { start, end, invalid_token, parse_error }; enum SymbolType {token, tag, non_terminal}; enum Associativity {nonassoc, left, right}; alias uint Precedence; struct AssociativePrecedence { Associativity associativity; Precedence precedence; @property bool is_explicitly_set() { return precedence != 0; } } class FirstsData { Set!TokenSymbol tokenset; bool transparent; this(Set!TokenSymbol tokenset, bool transparent) { this.tokenset = tokenset; this.transparent = transparent; } override string toString() { return format("Firsts: %s; Transparent: %s", tokenset, transparent); } } bool is_allowable_name(string name) { return name.length < 2 || (name[0..2] != "dd" && name[0..2] != "DD"); } class Symbol { mixin IdNumber!(SymbolId); const SymbolType type; const string name; AssociativePrecedence associative_precedence; CharLocation defined_at; CharLocation[] used_at; string field_name; string pattern; FirstsData firsts_data; this(SymbolId id, string sname, SymbolType stype, CharLocation location, bool is_definition=true) { this.id = id; name = sname; type = stype; if (type == SymbolType.token) { // FIRST() for a token is trivial firsts_data = new FirstsData(Set!TokenSymbol(this), false); } else { firsts_data = null; } if (is_definition) { defined_at = location; } else { used_at ~= location; } } @property Associativity associativity() { return associative_precedence.associativity; } @property Precedence precedence() { return associative_precedence.precedence; } @property bool is_defined() { return defined_at != CharLocation(0, 0); } @property bool is_used() { return used_at.length > 0; } override string toString() { if (type == SymbolType.token && pattern.length > 0 && pattern[0] == '"') { return pattern; } return name; } } alias Symbol TokenSymbol; alias Symbol TagSymbol; alias Symbol NonTerminalSymbol; struct FieldDefinition { string field_name; string field_type; string conversion_function_name; CharLocation defined_at; } import std.stdio; struct SymbolTable { private SymbolId next_symbol_id = SpecialSymbols.max + 1; private static Symbol[SpecialSymbols.max + 1] special_symbols; private TokenSymbol[string] tokens; // indexed by token name private TokenSymbol[string] literal_tokens; // indexed by literal string private TagSymbol[string] tags; // indexed by name private NonTerminalSymbol[string] non_terminals; // indexed by name private FieldDefinition[string] field_definitions; // indexed by name private string[] skip_rule_list; private auto current_precedence = Precedence.max; invariant () { import std.stdio; auto check_sum = 0; // Sum of arithmetic series for (auto i = SpecialSymbols.min; i <= SpecialSymbols.max; i++) { assert(special_symbols[i].id == i); check_sum += i; } assert(next_symbol_id == (SpecialSymbols.max + tokens.length + tags.length + non_terminals.length + 1)); foreach (literal; literal_tokens.keys) { auto literal_token = literal_tokens[literal]; assert(literal_token.pattern == literal); assert(tokens[literal_token.name] is literal_token); } foreach (key; tokens.byKey()) { auto token = tokens[key]; assert(token.name == key && token.type == SymbolType.token); assert(token.pattern[0] == '"' ? literal_tokens[token.pattern] is token : token.pattern !in literal_tokens); assert(token.id > SpecialSymbols.max && token.id < next_symbol_id); check_sum += token.id; } foreach (key; tags.byKey()) { auto tag = tags[key]; assert(tag.name == key && tag.type == SymbolType.tag); assert(tag.id > SpecialSymbols.max && tag.id < next_symbol_id); check_sum += tag.id; } foreach (key; non_terminals.byKey()) { auto non_terminal = non_terminals[key]; assert(non_terminal.name == key && non_terminal.type == SymbolType.non_terminal); assert(non_terminal.id > SpecialSymbols.max && non_terminal.id < next_symbol_id); check_sum += non_terminal.id; } assert(check_sum == ((next_symbol_id * (next_symbol_id - 1)) / 2)); } static this() { special_symbols[SpecialSymbols.start] = new Symbol(SpecialSymbols.start, "ddSTART", SymbolType.non_terminal, CharLocation(0, 0)); special_symbols[SpecialSymbols.end] = new Symbol(SpecialSymbols.end, "ddEND", SymbolType.token, CharLocation(0, 0)); special_symbols[SpecialSymbols.invalid_token] = new Symbol(SpecialSymbols.invalid_token, "ddINVALID_TOKEN", SymbolType.token, CharLocation(0, 0)); special_symbols[SpecialSymbols.parse_error] = new Symbol(SpecialSymbols.parse_error, "ddERROR", SymbolType.non_terminal, CharLocation(0, 0)); special_symbols[SpecialSymbols.parse_error].firsts_data = new FirstsData(Set!Symbol(), true); } TokenSymbol new_token(string new_token_name, string pattern, CharLocation location, string field_name = "") in { assert(!is_known_symbol(new_token_name)); } body { auto token = cast(TokenSymbol) new Symbol(next_symbol_id++, new_token_name, SymbolType.token, location); token.pattern = pattern; token.field_name = field_name; tokens[new_token_name] = token; if (pattern[0] == '"') { literal_tokens[pattern] = token; } return token; } TagSymbol new_tag(string new_tag_name, CharLocation location) in { assert(!is_known_symbol(new_tag_name)); } body { auto tag = cast(TagSymbol) new Symbol(next_symbol_id++, new_tag_name, SymbolType.tag, location); tags[new_tag_name] = tag; return tag; } @property size_t token_count() { return tokens.length; } @property size_t non_terminal_count() { return non_terminals.length; } bool is_known_token(string symbol_name) { return (symbol_name in tokens) !is null; } bool is_known_literal(string literal) { return (literal in literal_tokens) !is null; } bool is_known_tag(string symbol_name) { return (symbol_name in tags) !is null; } bool is_known_non_terminal(string symbol_name) { return (symbol_name in non_terminals) !is null; } bool is_known_symbol(string symbol_name) { return symbol_name in tokens || symbol_name in tags || symbol_name in non_terminals; } Symbol get_symbol(string symbol_name) { if (symbol_name in tokens) { return tokens[symbol_name]; } else if (symbol_name in non_terminals) { return non_terminals[symbol_name]; } else if (symbol_name in tags) { return tags[symbol_name]; } return null; } Symbol get_special_symbol(SymbolId symbol_id) { return special_symbols[symbol_id]; } Symbol get_symbol(string symbol_name, CharLocation location, bool auto_create=false) { auto symbol = get_symbol(symbol_name); if (symbol !is null) { symbol.used_at ~= location; } else if (auto_create) { // if it's referenced without being defined it's a non terminal symbol = cast(NonTerminalSymbol) new Symbol(next_symbol_id++, symbol_name, SymbolType.non_terminal, location, false); non_terminals[symbol_name] = symbol; } return symbol; } TokenSymbol get_literal_token(string literal, CharLocation location) { auto token_symbol = literal_tokens.get(literal, null); if (token_symbol !is null) { token_symbol.used_at ~= location; } return token_symbol; } CharLocation get_declaration_point(string symbol_name) in { assert(is_known_symbol(symbol_name)); } body { if (symbol_name in tokens) { return tokens[symbol_name].defined_at; } else if (symbol_name in non_terminals) { return non_terminals[symbol_name].defined_at; } else if (symbol_name in tags) { return tags[symbol_name].defined_at; } assert(0); } void set_precedences(Associativity assoc, string[] symbol_names, CharLocation location) in { foreach (symbol_name; symbol_names) { assert(!is_known_non_terminal(symbol_name)); assert(!is_known_tag(symbol_name)); } } body { foreach (symbol_name; symbol_names) { auto symbol = tokens.get(symbol_name, null); if (symbol is null) { symbol = new_tag(symbol_name, location); } symbol.associative_precedence = AssociativePrecedence(assoc, current_precedence); } current_precedence--; } void set_precedences(Associativity assoc, Symbol[] symbols) in { foreach (symbol; symbols) { assert(symbol.type != SymbolType.non_terminal); } } body { foreach (symbol; symbols) { symbol.associative_precedence = AssociativePrecedence(assoc, current_precedence); } current_precedence--; } void new_field(string field_name, string field_type, string conv_func_name, CharLocation defined_at) in { assert(!is_known_field(field_name)); } body { field_definitions[field_name] = FieldDefinition(field_name, field_type, conv_func_name); } bool is_known_field(string field_name) { return (field_name in field_definitions) !is null; } void add_skip_rule(string new_rule) in { assert(new_rule.length > 3); } body { skip_rule_list ~= new_rule; } NonTerminalSymbol define_non_terminal(string symbol_name, CharLocation location) in { assert(!is_known_token(symbol_name) && !is_known_tag(symbol_name)); assert(!is_known_non_terminal(symbol_name) || !non_terminals[symbol_name].is_defined()); } body { auto symbol = non_terminals.get(symbol_name, null); if (symbol !is null) { symbol.defined_at = location; } else { symbol = cast(NonTerminalSymbol) new Symbol(next_symbol_id++, symbol_name, SymbolType.non_terminal, location, true); non_terminals[symbol_name] = symbol; } return symbol; } NonTerminalSymbol[] get_undefined_symbols() { NonTerminalSymbol[] undefined_symbols; foreach (nts; non_terminals) { if (!nts.is_defined) { undefined_symbols ~= nts; } } return undefined_symbols; } Symbol[] get_unused_symbols() { Symbol[] unused_symbols; foreach (symbols; [tokens, tags, non_terminals]) { foreach (symbol; symbols) { if (!symbol.is_used) { unused_symbols ~= symbol; } } } return unused_symbols; } TokenSymbol[] get_tokens_ordered() out (result) { mixin WorkAroundClassCmpLimitations!TokenSymbol; for (auto i = 0; i < result.length; i++) { if (i > 0) assert(WA_CMP_ECAST(result[i -1]) < WA_CMP_ECAST(result[i])); assert(result[i].type == SymbolType.token); } assert(result.length == tokens.length); } body { return tokens.values.sort; } TokenSymbol[] get_special_tokens_ordered() out (result) { mixin WorkAroundClassCmpLimitations!TokenSymbol; for (auto i = 0; i < result.length; i++) { if (i > 0) assert(WA_CMP_ECAST(result[i -1]) < WA_CMP_ECAST(result[i])); assert(result[i].type == SymbolType.token); assert(result[i].id >= SpecialSymbols.min); assert(result[i].id <= SpecialSymbols.max); } } body { // special_symbols is ordered so just pick the tokens TokenSymbol[] special_tokens_ordered; foreach (symbol; special_symbols) { if (symbol.type == SymbolType.token) { special_tokens_ordered ~= symbol; } } return special_tokens_ordered; } NonTerminalSymbol[] get_non_terminals_ordered() out (result) { mixin WorkAroundClassCmpLimitations!TokenSymbol; for (auto i = 0; i < result.length; i++) { if (i > 0) assert(WA_CMP_ECAST(result[i -1]) < WA_CMP_ECAST(result[i])); assert(result[i].type == SymbolType.non_terminal); } assert(result.length == non_terminals.length); } body { return non_terminals.values.sort; } NonTerminalSymbol[] get_special_non_terminals_ordered() out (result) { mixin WorkAroundClassCmpLimitations!TokenSymbol; for (auto i = 0; i < result.length; i++) { if (i > 0) assert(WA_CMP_ECAST(result[i -1]) < WA_CMP_ECAST(result[i])); assert(result[i].type == SymbolType.non_terminal); assert(result[i].id >= SpecialSymbols.min); assert(result[i].id <= SpecialSymbols.max); } } body { NonTerminalSymbol[] special_non_terminals; foreach (symbol; special_symbols) { if (symbol.type == SymbolType.non_terminal) { special_non_terminals ~= symbol; } } return special_non_terminals; } CharLocation get_field_defined_at(string field_name) { return field_definitions[field_name].defined_at; } FieldDefinition[] get_field_definitions() { return field_definitions.values; } string[] get_skip_rules() { return skip_rule_list.dup; } string[] get_description() { auto text_lines = ["Fields:"]; if (field_definitions.length == 0) { text_lines ~= " <none>"; } else { foreach (key; field_definitions.keys.sort) { with (field_definitions[key]) { if (conversion_function_name.length == 0) { text_lines ~= format(" %s: %s: %s to!(%s)(string str)", field_name, field_type, field_type, field_type); } else { text_lines ~= format(" %s: %s: %s %s(string str)", field_name, field_type, field_type, conversion_function_name); } } } } text_lines ~= "Tokens:"; if (tokens.length == 0) { text_lines ~= " <none>"; } else { foreach (token; get_tokens_ordered()) { with (token) { text_lines ~= format(" %s: %s: %s: %s: %s: %s", id, name, pattern, field_name, associativity, precedence); text_lines ~= format(" Defined At: %s", defined_at); text_lines ~= format(" Used At: %s", used_at); } } } text_lines ~= "Precedence Tags:"; if (tags.length == 0) { text_lines ~= " <none>"; } else { foreach (tagKey; tags.keys.sort) { with (tags[tagKey]) { text_lines ~= format(" %s: %s: %s: %s", id, name, associativity, precedence); text_lines ~= format(" Defined At: %s", defined_at); text_lines ~= format(" Used At: %s", used_at); } } } text_lines ~= "Non Terminal Symbols:"; if (non_terminals.length == 0) { text_lines ~= " <none>"; } else { foreach (non_terminal; get_non_terminals_ordered()) { with (non_terminal) { text_lines ~= format(" %s: %s:", id, name); text_lines ~= format(" Defined At: %s", defined_at); text_lines ~= format(" Used At: %s", used_at); } } } return text_lines; } } unittest { auto st = SymbolTable(); assert(st.get_special_symbol(SpecialSymbols.start).name == "ddSTART"); }
D
// This file is part of Visual D // // Visual D integrates the D programming language into Visual Studio // Copyright (c) 2010 by Rainer Schuetze, All Rights Reserved // // 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 visuald.pkgutil; import visuald.hierutil; import visuald.comutil; import visuald.logutil; import visuald.dpackage; import std.algorithm; import std.conv; import std.utf; import sdk.vsi.vsshell; void showStatusBarText(wstring txt) { auto pIVsStatusbar = queryService!(IVsStatusbar); if(pIVsStatusbar) { scope(exit) release(pIVsStatusbar); pIVsStatusbar.SetText((txt ~ "\0"w).ptr); } } void showStatusBarText(string txt) { showStatusBarText(to!wstring(txt)); } void deleteVisualDOutputPane() { auto win = queryService!(IVsOutputWindow)(); if(!win) return; scope(exit) release(win); win.DeletePane(&g_outputPaneCLSID); } void clearOutputPane() { auto win = queryService!(IVsOutputWindow)(); if(!win) return; scope(exit) release(win); IVsOutputWindowPane pane; if(win.GetPane(&g_outputPaneCLSID, &pane) == S_OK && pane) pane.Clear(); release(pane); } IVsOutputWindowPane getVisualDOutputPane() { auto win = queryService!(IVsOutputWindow)(); if(!win) return null; scope(exit) release(win); IVsOutputWindowPane pane; if(win.GetPane(&g_outputPaneCLSID, &pane) == S_OK && pane) return pane; if(win.CreatePane(&g_outputPaneCLSID, "Visual D", false, true) == S_OK) if(win.GetPane(&g_outputPaneCLSID, &pane) == S_OK && pane) return pane; if(win.GetPane(&GUID_BuildOutputWindowPane, &pane) != S_OK || !pane) return null; return pane; } IVsOutputWindowPane getBuildOutputPane() { auto win = queryService!(IVsOutputWindow)(); if(!win) return null; scope(exit) release(win); IVsOutputWindowPane pane; if(win.GetPane(&GUID_BuildOutputWindowPane, &pane) != S_OK || !pane) return null; return pane; } class OutputPaneBuffer { static shared(string) buffer; static shared(Object) syncOut = new shared(Object); static void push(string msg) { synchronized(OutputPaneBuffer.syncOut) buffer ~= msg; } static string pop() { string msg; synchronized(OutputPaneBuffer.syncOut) { msg = buffer; buffer = buffer.init; } return msg; } static void flush() { if(buffer.length) { string msg = pop(); writeToBuildOutputPane(msg); } } } void writeToBuildOutputPane(string msg) { if(IVsOutputWindowPane pane = getVisualDOutputPane()) { scope(exit) release(pane); pane.Activate(); pane.OutputString(_toUTF16z(msg)); } else OutputPaneBuffer.push(msg); } bool OutputErrorString(string msg) { if (IVsOutputWindowPane pane = getVisualDOutputPane()) { scope(exit) release(pane); pane.OutputString(toUTF16z(msg)); } return false; } bool tryWithExceptionToBuildOutputPane(T)(T dg, string errInfo = "") { try { dg(); return true; } catch(Exception e) { string msg = e.toString(); if(errInfo.length) msg = errInfo ~ ": " ~ msg; writeToBuildOutputPane(msg); logCall("EXCEPTION: " ~ msg); } return false; } string _browseFile(T)(HWND parentHwnd, string title, string filter, string initdir) { if (auto pIVsUIShell = ComPtr!(IVsUIShell)(queryService!(IVsUIShell), false)) { wchar[260] fileName; fileName[0] = 0; T ofn; ofn.lStructSize = ofn.sizeof; ofn.hwndOwner = parentHwnd; ofn.pwzDlgTitle = toUTF16z(title); ofn.pwzFileName = fileName.ptr; ofn.nMaxFileName = fileName.length; ofn.pwzInitialDir = toUTF16z(initdir); ofn.pwzFilter = toUTF16z(filter); static if(is(T == VSOPENFILENAMEW)) auto rc = pIVsUIShell.GetOpenFileNameViaDlg(&ofn); else auto rc = pIVsUIShell.GetSaveFileNameViaDlg(&ofn); if (rc == S_OK) return to!string(fileName); } return null; } string browseFile(HWND parentHwnd, string title, string filter, string initdir = null) { return _browseFile!(VSOPENFILENAMEW)(parentHwnd, title, filter, initdir); } string browseSaveFile(HWND parentHwnd, string title, string filter, string initdir = null) { return _browseFile!(VSSAVEFILENAMEW)(parentHwnd, title, filter, initdir); } string browseDirectory(HWND parentHwnd, string title, string initdir = null) { if (auto pIVsUIShell = ComPtr!(IVsUIShell)(queryService!(IVsUIShell), false)) { wchar[260] dirName; dirName[0] = 0; VSBROWSEINFOW bi; bi.lStructSize = bi.sizeof; bi.hwndOwner = parentHwnd; bi.pwzDlgTitle = toUTF16z(title); bi.pwzDirName = dirName.ptr; bi.nMaxDirName = dirName.length; bi.pwzInitialDir = toUTF16z(initdir); if (pIVsUIShell.GetDirectoryViaBrowseDlg(&bi) == S_OK) return to!string(dirName); } return null; } /////////////////////////////////////////////////////////////////////// // version = DEBUG_GC; version(DEBUG_GC) { import rsgc.gc; import rsgc.gcx; import rsgc.gcstats; import std.string; void writeGCStatsToOutputPane() { GCStats stats = gc_stats(); writeToBuildOutputPane(format("numpools = %s, poolsize = %s, usedsize = %s, freelistsize = %s\n", stats.numpools, stats.poolsize, stats.usedsize, stats.freelistsize)); writeToBuildOutputPane(format("pool[B_16] = %s\n", stats.numpool[B_16] )); writeToBuildOutputPane(format("pool[B_32] = %s\n", stats.numpool[B_32] )); writeToBuildOutputPane(format("pool[B_64] = %s\n", stats.numpool[B_64] )); writeToBuildOutputPane(format("pool[B_128] = %s\n", stats.numpool[B_128] )); writeToBuildOutputPane(format("pool[B_256] = %s\n", stats.numpool[B_256] )); writeToBuildOutputPane(format("pool[B_512] = %s\n", stats.numpool[B_512] )); writeToBuildOutputPane(format("pool[B_1024] = %s\n", stats.numpool[B_1024] )); writeToBuildOutputPane(format("pool[B_2048] = %s\n", stats.numpool[B_2048] )); writeToBuildOutputPane(format("pool[B_PAGE] = %s\n", stats.numpool[B_PAGE] )); writeToBuildOutputPane(format("pool[B_PAGE+] = %s\n", stats.numpool[B_PAGEPLUS])); writeToBuildOutputPane(format("pool[B_FREE] = %s\n", stats.numpool[B_FREE] )); writeToBuildOutputPane(format("pool[B_UNCOM] = %s\n", stats.numpool[B_UNCOMMITTED])); writeClasses(); } extern extern(C) __gshared ModuleInfo*[] _moduleinfo_array; void writeClasses() { foreach(mi; _moduleinfo_array) { auto classes = mi.localClasses(); foreach(c; classes) { string flags; if(c.m_flags & 1) flags ~= " IUnknown"; if(c.m_flags & 2) flags ~= " NoGC"; if(c.m_flags & 4) flags ~= " OffTI"; if(c.m_flags & 8) flags ~= " Constr"; if(c.m_flags & 16) flags ~= " xgetM"; if(c.m_flags & 32) flags ~= " tinfo"; if(c.m_flags & 64) flags ~= " abstract"; writeToBuildOutputPane(text(c.name, ": ", c.init.length, " bytes, flags: ", flags, "\n")); foreach(m; c.getMembers([])) { auto cm = cast() m; writeToBuildOutputPane(text(" ", cm.name(), "\n")); } } } } } /////////////////////////////////////////////////////////////////////// HRESULT GetSelectionForward(IVsTextView view, int*startLine, int*startCol, int*endLine, int*endCol) { HRESULT hr = view.GetSelection(startLine, startCol, endLine, endCol); if(FAILED(hr)) return hr; if(*startLine > *endLine) { std.algorithm.swap(*startLine, *endLine); std.algorithm.swap(*startCol, *endCol); } else if(*startLine == *endLine && *startCol > *endCol) std.algorithm.swap(*startCol, *endCol); return hr; } /////////////////////////////////////////////////////////////////////// // Hardware Breakpoint Functions enum { HWBRK_TYPE_CODE, HWBRK_TYPE_READWRITE, HWBRK_TYPE_WRITE, } alias int HWBRK_TYPE; enum { HWBRK_SIZE_1, HWBRK_SIZE_2, HWBRK_SIZE_4, HWBRK_SIZE_8, } alias int HWBRK_SIZE; struct HWBRK { public: void* a; HANDLE hT; HWBRK_TYPE Type; HWBRK_SIZE Size; HANDLE hEv; int iReg; int Opr; bool SUCC; } void SetBits(ref uint dw, int lowBit, int bits, int newValue) { DWORD_PTR mask = (1 << bits) - 1; dw = (dw & ~(mask << lowBit)) | (newValue << lowBit); } extern(Windows) DWORD thSuspend(LPVOID lpParameter) { HWBRK* h = cast(HWBRK*)lpParameter; int j = 0; int y = 0; j = SuspendThread(h.hT); y = GetLastError(); h.SUCC = th(h); j = ResumeThread(h.hT); y = GetLastError(); SetEvent(h.hEv); return 0; } bool th(HWBRK* h) { int j = 0; int y = 0; CONTEXT ct; ct.ContextFlags = CONTEXT_DEBUG_REGISTERS; j = GetThreadContext(h.hT,&ct); y = GetLastError(); int FlagBit = 0; bool Dr0Busy = false; bool Dr1Busy = false; bool Dr2Busy = false; bool Dr3Busy = false; if (ct.Dr7 & 1) Dr0Busy = true; if (ct.Dr7 & 4) Dr1Busy = true; if (ct.Dr7 & 16) Dr2Busy = true; if (ct.Dr7 & 64) Dr3Busy = true; if (h.Opr == 1) { // Remove if (h.iReg == 0) { FlagBit = 0; ct.Dr0 = 0; Dr0Busy = false; } if (h.iReg == 1) { FlagBit = 2; ct.Dr1 = 0; Dr1Busy = false; } if (h.iReg == 2) { FlagBit = 4; ct.Dr2 = 0; Dr2Busy = false; } if (h.iReg == 3) { FlagBit = 6; ct.Dr3 = 0; Dr3Busy = false; } ct.Dr7 &= ~(1 << FlagBit); } else { if (!Dr0Busy) { h.iReg = 0; ct.Dr0 = cast(DWORD)h.a; Dr0Busy = true; } else if (!Dr1Busy) { h.iReg = 1; ct.Dr1 = cast(DWORD)h.a; Dr1Busy = true; } else if (!Dr2Busy) { h.iReg = 2; ct.Dr2 = cast(DWORD)h.a; Dr2Busy = true; } else if (!Dr3Busy) { h.iReg = 3; ct.Dr3 = cast(DWORD)h.a; Dr3Busy = true; } else { return false; } ct.Dr6 = 0; int st = 0; if (h.Type == HWBRK_TYPE_CODE) st = 0; if (h.Type == HWBRK_TYPE_READWRITE) st = 3; if (h.Type == HWBRK_TYPE_WRITE) st = 1; int le = 0; if (h.Size == HWBRK_SIZE_1) le = 0; if (h.Size == HWBRK_SIZE_2) le = 1; if (h.Size == HWBRK_SIZE_4) le = 3; if (h.Size == HWBRK_SIZE_8) le = 2; SetBits(ct.Dr7, 16 + h.iReg*4, 2, st); SetBits(ct.Dr7, 18 + h.iReg*4, 2, le); SetBits(ct.Dr7, h.iReg*2,1,1); } ct.ContextFlags = CONTEXT_DEBUG_REGISTERS; j = SetThreadContext(h.hT,&ct); y = GetLastError(); ct.ContextFlags = CONTEXT_DEBUG_REGISTERS; j = GetThreadContext(h.hT,&ct); y = GetLastError(); return true; } extern(C) HANDLE SetHardwareBreakpoint(HANDLE hThread,HWBRK_TYPE Type,HWBRK_SIZE Size,void* s) { //HWBRK* h = new HWBRK; HWBRK h; h.a = s; h.Size = Size; h.Type = Type; h.hT = hThread; if (hThread == GetCurrentThread()) { DWORD pid = GetCurrentThreadId(); h.hT = OpenThread(THREAD_SUSPEND_RESUME|THREAD_GET_CONTEXT|THREAD_SET_CONTEXT,0,pid); } version(none) { h.hEv = CreateEvent(null,0,0,null); h.Opr = 0; // Set Break HANDLE hY = CreateThread(null,0,&thSuspend,cast(LPVOID)&h,0,null); WaitForSingleObject(h.hEv,INFINITE); CloseHandle(h.hEv); h.hEv = null; } else { th(&h); } if (hThread == GetCurrentThread()) { CloseHandle(h.hT); } h.hT = hThread; // if (!h.SUCC) { // delete h; return null; } // return cast(HANDLE)h; } extern(C) bool RemoveHardwareBreakpoint(HANDLE hBrk) { HWBRK* h = cast(HWBRK*)hBrk; if (!h) return false; bool C = false; if (h.hT == GetCurrentThread()) { DWORD pid = GetCurrentThreadId(); h.hT = OpenThread(THREAD_ALL_ACCESS,0,pid); C = true; } h.hEv = CreateEvent(null,0,0,null); h.Opr = 1; // Remove Break HANDLE hY = CreateThread(null,0,&thSuspend,cast(LPVOID)h,0,null); WaitForSingleObject(h.hEv,INFINITE); CloseHandle(h.hEv); h.hEv = null; if (C) { CloseHandle(h.hT); } delete h; return true; } //import pkgutil; import sdk.port.base; import visuald.dllmain; void setHWBreakpopints() { char[] data = new char[16]; HANDLE hnd; void* addr1 = data.ptr - 0x71bffc0 + 0x71bf720; void* addr2 = data.ptr - 0x71bffc0 + 0x71bf8a0; void* addr3 = data.ptr - 0x71eff60 + 0x71e6420; void* addr4 = data.ptr - 0x71eff60 + 0x71e6440; hnd = SetHardwareBreakpoint(GetCurrentThread(), HWBRK_TYPE_WRITE, HWBRK_SIZE_4, addr1); //hnd = SetHardwareBreakpoint(GetCurrentThread(), HWBRK_TYPE_READWRITE, HWBRK_SIZE_4, addr2); //hnd = SetHardwareBreakpoint(GetCurrentThread(), HWBRK_TYPE_WRITE, HWBRK_SIZE_4, addr3); //hnd = SetHardwareBreakpoint(GetCurrentThread(), HWBRK_TYPE_WRITE, HWBRK_SIZE_4, addr4); addr1 = null; addr2 = null; addr3 = null; addr4 = null; }
D
/root/apps/dev/CodingYourAmbition/clone-mul-message-passing/target/debug/deps/clone_mul_message_passing-b99de73a258bdc27: src/main.rs /root/apps/dev/CodingYourAmbition/clone-mul-message-passing/target/debug/deps/clone_mul_message_passing-b99de73a258bdc27.d: src/main.rs src/main.rs:
D
instance DIA_ADDON_BDT_10031_WACHE_EXIT(C_INFO) { npc = bdt_10031_addon_wache; nr = 999; condition = dia_addon_10031_wache_exit_condition; information = dia_addon_10031_wache_exit_info; permanent = TRUE; description = DIALOG_ENDE; }; func int dia_addon_10031_wache_exit_condition() { return TRUE; }; func void dia_addon_10031_wache_exit_info() { AI_StopProcessInfos(self); }; instance DIA_ADDON_BDT_10031_WACHE_SCATTY(C_INFO) { npc = bdt_10031_addon_wache; nr = 2; condition = dia_addon_10031_wache_scatty_condition; information = dia_addon_10031_wache_scatty_info; permanent = FALSE; important = TRUE; }; func int dia_addon_10031_wache_scatty_condition() { return TRUE; }; func void dia_addon_10031_wache_scatty_info() { AI_Output(self,other,"DIA_Addon_BDT_10031_Wache_Scatty_06_00"); //Hej, snad nechceš jít dolovat? Nezapomeň si vzít nějaké vybavení od Scattyho. AI_Output(other,self,"DIA_Addon_BDT_10031_Wache_Scatty_15_01"); //Co potřebuji? AI_Output(self,other,"DIA_Addon_BDT_10031_Wache_Scatty_06_02"); //Aspoň krumpáč. A nějaké jídlo ti taky nebude na škodu. AI_Output(self,other,"DIA_Addon_BDT_10031_Wache_Scatty_06_03"); //A taky pár léčivých lektvarů? Jsou tam důlní červi. AI_StopProcessInfos(self); }; var int wache_joker; instance DIA_ADDON_BDT_10031_WACHE_HI(C_INFO) { npc = bdt_10031_addon_wache; nr = 2; condition = dia_addon_10031_wache_hi_condition; information = dia_addon_10031_wache_hi_info; permanent = TRUE; description = "Vše ok?"; }; func int dia_addon_10031_wache_hi_condition() { return TRUE; }; func void dia_addon_10031_wache_hi_info() { AI_Output(other,self,"DIA_Addon_BDT_10031_Wache_Hi_15_00"); //Vše ok? if((SKLAVEN_FLUCHT == TRUE) && (WACHE_JOKER == FALSE)) { AI_Output(self,other,"DIA_Addon_BDT_10031_Wache_Hi_06_01"); //Chlape, otroci mají naspěch. AI_Output(self,other,"DIA_Addon_BDT_10031_Wache_Hi_06_02"); //Když se doslechli, že jsou volní, utíkali pryč jako králici! WACHE_JOKER = TRUE; }; AI_Output(self,other,"DIA_Addon_BDT_10031_Wache_Hi_06_03"); //Ano. Nedělej bordel a bude vše v pořádku. };
D
module d2d.system; public import d2d.system.env;
D
/** * Perform constant folding. * * Copyright: Copyright (C) 1999-2021 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/optimize.d, _optimize.d) * Documentation: https://dlang.org/phobos/dmd_optimize.html * Coverage: https://codecov.io/gh/dlang/dmd/src/master/src/dmd/optimize.d */ module dmd.optimize; import core.stdc.stdio; import dmd.constfold; import dmd.ctfeexpr; import dmd.dclass; import dmd.declaration; import dmd.dsymbol; import dmd.dsymbolsem; import dmd.errors; import dmd.expression; import dmd.expressionsem; import dmd.globals; import dmd.init; import dmd.mtype; import dmd.root.ctfloat; import dmd.sideeffect; import dmd.tokens; import dmd.visitor; /************************************* * If variable has a const initializer, * return that initializer. * Returns: * initializer if there is one, * null if not, * ErrorExp if error */ Expression expandVar(int result, VarDeclaration v) { //printf("expandVar(result = %d, v = %p, %s)\n", result, v, v ? v.toChars() : "null"); /******** * Params: * e = initializer expression */ Expression initializerReturn(Expression e) { if (e.type != v.type) { e = e.castTo(null, v.type); } v.inuse++; e = e.optimize(result); v.inuse--; //if (e) printf("\te = %p, %s, e.type = %d, %s\n", e, e.toChars(), e.type.ty, e.type.toChars()); return e; } static Expression nullReturn() { return null; } static Expression errorReturn() { return ErrorExp.get(); } if (!v) return nullReturn(); if (!v.originalType && v.semanticRun < PASS.semanticdone) // semantic() not yet run v.dsymbolSemantic(null); if (v.type && (v.isConst() || v.isImmutable() || v.storage_class & STC.manifest)) { Type tb = v.type.toBasetype(); if (v.storage_class & STC.manifest || tb.isscalar() || ((result & WANTexpand) && (tb.ty != Tsarray && tb.ty != Tstruct))) { if (v._init) { if (v.inuse) { if (v.storage_class & STC.manifest) { v.error("recursive initialization of constant"); return errorReturn(); } return nullReturn(); } Expression ei = v.getConstInitializer(); if (!ei) { if (v.storage_class & STC.manifest) { v.error("enum cannot be initialized with `%s`", v._init.toChars()); return errorReturn(); } return nullReturn(); } if (ei.op == TOK.construct || ei.op == TOK.blit) { AssignExp ae = cast(AssignExp)ei; ei = ae.e2; if (ei.isConst() == 1) { } else if (ei.op == TOK.string_) { // https://issues.dlang.org/show_bug.cgi?id=14459 // Do not constfold the string literal // if it's typed as a C string, because the value expansion // will drop the pointer identity. if (!(result & WANTexpand) && ei.type.toBasetype().ty == Tpointer) return nullReturn(); } else return nullReturn(); if (ei.type == v.type) { // const variable initialized with const expression } else if (ei.implicitConvTo(v.type) >= MATCH.constant) { // const var initialized with non-const expression ei = ei.implicitCastTo(null, v.type); ei = ei.expressionSemantic(null); } else return nullReturn(); } else if (!(v.storage_class & STC.manifest) && ei.isConst() != 1 && ei.op != TOK.string_ && ei.op != TOK.address) { return nullReturn(); } if (!ei.type) { return nullReturn(); } else { // Should remove the copy() operation by // making all mods to expressions copy-on-write return initializerReturn(ei.copy()); } } else { // v does not have an initializer version (all) { return nullReturn(); } else { // BUG: what if const is initialized in constructor? auto e = v.type.defaultInit(); e.loc = e1.loc; return initializerReturn(e); } } assert(0); } } return nullReturn(); } private Expression fromConstInitializer(int result, Expression e1) { //printf("fromConstInitializer(result = %x, %s)\n", result, e1.toChars()); //static int xx; if (xx++ == 10) assert(0); Expression e = e1; if (e1.op == TOK.variable) { VarExp ve = cast(VarExp)e1; VarDeclaration v = ve.var.isVarDeclaration(); e = expandVar(result, v); if (e) { // If it is a comma expression involving a declaration, we mustn't // perform a copy -- we'd get two declarations of the same variable. // See bugzilla 4465. if (e.op == TOK.comma && (cast(CommaExp)e).e1.op == TOK.declaration) e = e1; else if (e.type != e1.type && e1.type && e1.type.ty != Tident) { // Type 'paint' operation e = e.copy(); e.type = e1.type; } e.loc = e1.loc; } else { e = e1; } } return e; } /* It is possible for constant folding to change an array expression of * unknown length, into one where the length is known. * If the expression 'arr' is a literal, set lengthVar to be its length. */ package void setLengthVarIfKnown(VarDeclaration lengthVar, Expression arr) { if (!lengthVar) return; if (lengthVar._init && !lengthVar._init.isVoidInitializer()) return; // we have previously calculated the length size_t len; if (arr.op == TOK.string_) len = (cast(StringExp)arr).len; else if (arr.op == TOK.arrayLiteral) len = (cast(ArrayLiteralExp)arr).elements.dim; else { Type t = arr.type.toBasetype(); if (t.ty == Tsarray) len = cast(size_t)(cast(TypeSArray)t).dim.toInteger(); else return; // we don't know the length yet } Expression dollar = new IntegerExp(Loc.initial, len, Type.tsize_t); lengthVar._init = new ExpInitializer(Loc.initial, dollar); lengthVar.storage_class |= STC.static_ | STC.const_; } /* Same as above, but determines the length from 'type'. */ package void setLengthVarIfKnown(VarDeclaration lengthVar, Type type) { if (!lengthVar) return; if (lengthVar._init && !lengthVar._init.isVoidInitializer()) return; // we have previously calculated the length size_t len; Type t = type.toBasetype(); if (t.ty == Tsarray) len = cast(size_t)(cast(TypeSArray)t).dim.toInteger(); else return; // we don't know the length yet Expression dollar = new IntegerExp(Loc.initial, len, Type.tsize_t); lengthVar._init = new ExpInitializer(Loc.initial, dollar); lengthVar.storage_class |= STC.static_ | STC.const_; } /********************************* * Constant fold an Expression. * Params: * e = expression to const fold; this may get modified in-place * result = WANTvalue, WANTexpand, or both * keepLvalue = `e` is an lvalue, and keep it as an lvalue since it is * an argument to a `ref` or `out` parameter, or the operand of `&` operator * Returns: * Constant folded version of `e` */ Expression Expression_optimize(Expression e, int result, bool keepLvalue) { extern (C++) final class OptimizeVisitor : Visitor { alias visit = Visitor.visit; Expression ret; private const int result; private const bool keepLvalue; extern (D) this(Expression e, int result, bool keepLvalue) { this.ret = e; // default result is original expression this.result = result; this.keepLvalue = keepLvalue; } void error() { ret = ErrorExp.get(); } bool expOptimize(ref Expression e, int flags, bool keepLvalue = false) { if (!e) return false; Expression ex = Expression_optimize(e, flags, keepLvalue); if (ex.op == TOK.error) { ret = ex; // store error result return true; } else { e = ex; // modify original return false; } } bool unaOptimize(UnaExp e, int flags) { return expOptimize(e.e1, flags); } bool binOptimize(BinExp e, int flags, bool keepLhsLvalue = false) { expOptimize(e.e1, flags, keepLhsLvalue); expOptimize(e.e2, flags); return ret.op == TOK.error; } override void visit(Expression e) { //printf("Expression::optimize(result = x%x) %s\n", result, e.toChars()); } override void visit(VarExp e) { VarDeclaration v = e.var.isVarDeclaration(); if (!(keepLvalue && v && !(v.storage_class & STC.manifest))) ret = fromConstInitializer(result, e); // if unoptimized, try to optimize the dtor expression // (e.g., might be a LogicalExp with constant lhs) if (ret == e && v && v.edtor) { // prevent infinite recursion (`<var>.~this()`) if (!v.inuse) { v.inuse++; expOptimize(v.edtor, WANTvalue); v.inuse--; } } } override void visit(TupleExp e) { expOptimize(e.e0, WANTvalue); for (size_t i = 0; i < e.exps.dim; i++) { expOptimize((*e.exps)[i], WANTvalue); } } override void visit(ArrayLiteralExp e) { if (e.elements) { expOptimize(e.basis, result & WANTexpand); for (size_t i = 0; i < e.elements.dim; i++) { expOptimize((*e.elements)[i], result & WANTexpand); } } } override void visit(AssocArrayLiteralExp e) { assert(e.keys.dim == e.values.dim); for (size_t i = 0; i < e.keys.dim; i++) { expOptimize((*e.keys)[i], result & WANTexpand); expOptimize((*e.values)[i], result & WANTexpand); } } override void visit(StructLiteralExp e) { if (e.stageflags & stageOptimize) return; int old = e.stageflags; e.stageflags |= stageOptimize; if (e.elements) { for (size_t i = 0; i < e.elements.dim; i++) { expOptimize((*e.elements)[i], result & WANTexpand); } } e.stageflags = old; } override void visit(UnaExp e) { //printf("UnaExp::optimize() %s\n", e.toChars()); if (unaOptimize(e, result)) return; } override void visit(NegExp e) { if (unaOptimize(e, result)) return; if (e.e1.isConst() == 1) { ret = Neg(e.type, e.e1).copy(); } } override void visit(ComExp e) { if (unaOptimize(e, result)) return; if (e.e1.isConst() == 1) { ret = Com(e.type, e.e1).copy(); } } override void visit(NotExp e) { if (unaOptimize(e, result)) return; if (e.e1.isConst() == 1) { ret = Not(e.type, e.e1).copy(); } } override void visit(SymOffExp e) { assert(e.var); } override void visit(AddrExp e) { //printf("AddrExp::optimize(result = %d) %s\n", result, e.toChars()); /* Rewrite &(a,b) as (a,&b) */ if (e.e1.op == TOK.comma) { CommaExp ce = cast(CommaExp)e.e1; auto ae = new AddrExp(e.loc, ce.e2, e.type); ret = new CommaExp(ce.loc, ce.e1, ae); ret.type = e.type; return; } // Keep lvalue-ness if (expOptimize(e.e1, result, true)) return; // Convert &*ex to ex if (e.e1.op == TOK.star) { Expression ex = (cast(PtrExp)e.e1).e1; if (e.type.equals(ex.type)) ret = ex; else if (e.type.toBasetype().equivalent(ex.type.toBasetype())) { ret = ex.copy(); ret.type = e.type; } return; } if (e.e1.op == TOK.variable) { VarExp ve = cast(VarExp)e.e1; if (!ve.var.isOut() && !ve.var.isRef() && !ve.var.isImportedSymbol()) { ret = new SymOffExp(e.loc, ve.var, 0, ve.hasOverloads); ret.type = e.type; return; } } if (e.e1.op == TOK.index) { // Convert &array[n] to &array+n IndexExp ae = cast(IndexExp)e.e1; if (ae.e2.op == TOK.int64 && ae.e1.op == TOK.variable) { sinteger_t index = ae.e2.toInteger(); VarExp ve = cast(VarExp)ae.e1; if (ve.type.ty == Tsarray && !ve.var.isImportedSymbol()) { TypeSArray ts = cast(TypeSArray)ve.type; sinteger_t dim = ts.dim.toInteger(); if (index < 0 || index >= dim) { e.error("array index %lld is out of bounds `[0..%lld]`", index, dim); return error(); } import core.checkedint : mulu; bool overflow; const offset = mulu(index, ts.nextOf().size(e.loc), overflow); if (overflow) { e.error("array offset overflow"); return error(); } ret = new SymOffExp(e.loc, ve.var, offset); ret.type = e.type; return; } } } } override void visit(PtrExp e) { //printf("PtrExp::optimize(result = x%x) %s\n", result, e.toChars()); if (expOptimize(e.e1, result)) return; // Convert *&ex to ex // But only if there is no type punning involved if (e.e1.op == TOK.address) { Expression ex = (cast(AddrExp)e.e1).e1; if (e.type.equals(ex.type)) ret = ex; else if (e.type.toBasetype().equivalent(ex.type.toBasetype())) { ret = ex.copy(); ret.type = e.type; } } if (keepLvalue) return; // Constant fold *(&structliteral + offset) if (e.e1.op == TOK.add) { Expression ex = Ptr(e.type, e.e1).copy(); if (!CTFEExp.isCantExp(ex)) { ret = ex; return; } } if (e.e1.op == TOK.symbolOffset) { SymOffExp se = cast(SymOffExp)e.e1; VarDeclaration v = se.var.isVarDeclaration(); Expression ex = expandVar(result, v); if (ex && ex.op == TOK.structLiteral) { StructLiteralExp sle = cast(StructLiteralExp)ex; ex = sle.getField(e.type, cast(uint)se.offset); if (ex && !CTFEExp.isCantExp(ex)) { ret = ex; return; } } } } override void visit(DotVarExp e) { //printf("DotVarExp::optimize(result = x%x) %s\n", result, e.toChars()); if (expOptimize(e.e1, result)) return; if (keepLvalue) return; Expression ex = e.e1; if (ex.op == TOK.variable) { VarExp ve = cast(VarExp)ex; VarDeclaration v = ve.var.isVarDeclaration(); ex = expandVar(result, v); } if (ex && ex.op == TOK.structLiteral) { StructLiteralExp sle = cast(StructLiteralExp)ex; VarDeclaration vf = e.var.isVarDeclaration(); if (vf && !vf.overlapped) { /* https://issues.dlang.org/show_bug.cgi?id=13021 * Prevent optimization if vf has overlapped fields. */ ex = sle.getField(e.type, vf.offset); if (ex && !CTFEExp.isCantExp(ex)) { ret = ex; return; } } } } override void visit(NewExp e) { expOptimize(e.thisexp, WANTvalue); // Optimize parameters if (e.newargs) { for (size_t i = 0; i < e.newargs.dim; i++) { expOptimize((*e.newargs)[i], WANTvalue); } } if (e.arguments) { for (size_t i = 0; i < e.arguments.dim; i++) { expOptimize((*e.arguments)[i], WANTvalue); } } } override void visit(CallExp e) { //printf("CallExp::optimize(result = %d) %s\n", result, e.toChars()); // Optimize parameters with keeping lvalue-ness if (expOptimize(e.e1, result)) return; if (e.arguments) { Type t1 = e.e1.type.toBasetype(); if (t1.ty == Tdelegate) t1 = t1.nextOf(); // t1 can apparently be void for __ArrayDtor(T) calls if (auto tf = t1.isTypeFunction()) { for (size_t i = 0; i < e.arguments.dim; i++) { Parameter p = tf.parameterList[i]; bool keep = p && p.isReference(); expOptimize((*e.arguments)[i], WANTvalue, keep); } } } } override void visit(CastExp e) { //printf("CastExp::optimize(result = %d) %s\n", result, e.toChars()); //printf("from %s to %s\n", e.type.toChars(), e.to.toChars()); //printf("from %s\n", e.type.toChars()); //printf("e1.type %s\n", e.e1.type.toChars()); //printf("type = %p\n", e.type); assert(e.type); TOK op1 = e.e1.op; Expression e1old = e.e1; if (expOptimize(e.e1, result, keepLvalue)) return; if (!keepLvalue) e.e1 = fromConstInitializer(result, e.e1); if (e.e1 == e1old && e.e1.op == TOK.arrayLiteral && e.type.toBasetype().ty == Tpointer && e.e1.type.toBasetype().ty != Tsarray) { // Casting this will result in the same expression, and // infinite loop because of Expression::implicitCastTo() return; // no change } if ((e.e1.op == TOK.string_ || e.e1.op == TOK.arrayLiteral) && (e.type.ty == Tpointer || e.type.ty == Tarray)) { const esz = e.type.nextOf().size(e.loc); const e1sz = e.e1.type.toBasetype().nextOf().size(e.e1.loc); if (esz == SIZE_INVALID || e1sz == SIZE_INVALID) return error(); if (e1sz == esz) { // https://issues.dlang.org/show_bug.cgi?id=12937 // If target type is void array, trying to paint // e.e1 with that type will cause infinite recursive optimization. if (e.type.nextOf().ty == Tvoid) return; ret = e.e1.castTo(null, e.type); //printf(" returning1 %s\n", ret.toChars()); return; } } if (e.e1.op == TOK.structLiteral && e.e1.type.implicitConvTo(e.type) >= MATCH.constant) { //printf(" returning2 %s\n", e.e1.toChars()); L1: // Returning e1 with changing its type ret = (e1old == e.e1 ? e.e1.copy() : e.e1); ret.type = e.type; return; } /* The first test here is to prevent infinite loops */ if (op1 != TOK.arrayLiteral && e.e1.op == TOK.arrayLiteral) { ret = e.e1.castTo(null, e.to); return; } if (e.e1.op == TOK.null_ && (e.type.ty == Tpointer || e.type.ty == Tclass || e.type.ty == Tarray)) { //printf(" returning3 %s\n", e.e1.toChars()); goto L1; } if (e.type.ty == Tclass && e.e1.type.ty == Tclass) { import dmd.aggregate : Sizeok; // See if we can remove an unnecessary cast ClassDeclaration cdfrom = e.e1.type.isClassHandle(); ClassDeclaration cdto = e.type.isClassHandle(); if (cdto == ClassDeclaration.object && !cdfrom.isInterfaceDeclaration()) goto L1; // can always convert a class to Object // Need to determine correct offset before optimizing away the cast. // https://issues.dlang.org/show_bug.cgi?id=16980 cdfrom.size(e.loc); assert(cdfrom.sizeok == Sizeok.done); assert(cdto.sizeok == Sizeok.done || !cdto.isBaseOf(cdfrom, null)); int offset; if (cdto.isBaseOf(cdfrom, &offset) && offset == 0) { //printf(" returning4 %s\n", e.e1.toChars()); goto L1; } } if (e.e1.type.mutableOf().unSharedOf().equals(e.to.mutableOf().unSharedOf())) { //printf(" returning5 %s\n", e.e1.toChars()); goto L1; } if (e.e1.isConst()) { if (e.e1.op == TOK.symbolOffset) { if (e.type.toBasetype().ty != Tsarray) { const esz = e.type.size(e.loc); const e1sz = e.e1.type.size(e.e1.loc); if (esz == SIZE_INVALID || e1sz == SIZE_INVALID) return error(); if (esz == e1sz) goto L1; } return; } if (e.to.toBasetype().ty != Tvoid) { if (e.e1.type.equals(e.type) && e.type.equals(e.to)) ret = e.e1; else ret = Cast(e.loc, e.type, e.to, e.e1).copy(); } } //printf(" returning6 %s\n", ret.toChars()); } override void visit(BinAssignExp e) { //printf("BinAssignExp::optimize(result = %d) %s\n", result, e.toChars()); if (binOptimize(e, result, /*keepLhsLvalue*/ true)) return; if (e.op == TOK.leftShiftAssign || e.op == TOK.rightShiftAssign || e.op == TOK.unsignedRightShiftAssign) { if (e.e2.isConst() == 1) { sinteger_t i2 = e.e2.toInteger(); d_uns64 sz = e.e1.type.size(e.e1.loc); assert(sz != SIZE_INVALID); sz *= 8; if (i2 < 0 || i2 >= sz) { e.error("shift assign by %lld is outside the range `0..%llu`", i2, cast(ulong)sz - 1); return error(); } } } } override void visit(BinExp e) { //printf("BinExp::optimize(result = %d) %s\n", result, e.toChars()); const keepLhsLvalue = e.op == TOK.construct || e.op == TOK.blit || e.op == TOK.assign || e.op == TOK.plusPlus || e.op == TOK.minusMinus || e.op == TOK.prePlusPlus || e.op == TOK.preMinusMinus; binOptimize(e, result, keepLhsLvalue); } override void visit(AddExp e) { //printf("AddExp::optimize(%s)\n", e.toChars()); if (binOptimize(e, result)) return; if (e.e1.isConst() && e.e2.isConst()) { if (e.e1.op == TOK.symbolOffset && e.e2.op == TOK.symbolOffset) return; ret = Add(e.loc, e.type, e.e1, e.e2).copy(); } } override void visit(MinExp e) { if (binOptimize(e, result)) return; if (e.e1.isConst() && e.e2.isConst()) { if (e.e2.op == TOK.symbolOffset) return; ret = Min(e.loc, e.type, e.e1, e.e2).copy(); } } override void visit(MulExp e) { //printf("MulExp::optimize(result = %d) %s\n", result, e.toChars()); if (binOptimize(e, result)) return; if (e.e1.isConst() == 1 && e.e2.isConst() == 1) { ret = Mul(e.loc, e.type, e.e1, e.e2).copy(); } } override void visit(DivExp e) { //printf("DivExp::optimize(%s)\n", e.toChars()); if (binOptimize(e, result)) return; if (e.e1.isConst() == 1 && e.e2.isConst() == 1) { ret = Div(e.loc, e.type, e.e1, e.e2).copy(); } } override void visit(ModExp e) { if (binOptimize(e, result)) return; if (e.e1.isConst() == 1 && e.e2.isConst() == 1) { ret = Mod(e.loc, e.type, e.e1, e.e2).copy(); } } extern (D) void shift_optimize(BinExp e, UnionExp function(const ref Loc, Type, Expression, Expression) shift) { if (binOptimize(e, result)) return; if (e.e2.isConst() == 1) { sinteger_t i2 = e.e2.toInteger(); d_uns64 sz = e.e1.type.size(e.e1.loc); assert(sz != SIZE_INVALID); sz *= 8; if (i2 < 0 || i2 >= sz) { e.error("shift by %lld is outside the range `0..%llu`", i2, cast(ulong)sz - 1); return error(); } if (e.e1.isConst() == 1) ret = (*shift)(e.loc, e.type, e.e1, e.e2).copy(); } } override void visit(ShlExp e) { //printf("ShlExp::optimize(result = %d) %s\n", result, e.toChars()); shift_optimize(e, &Shl); } override void visit(ShrExp e) { //printf("ShrExp::optimize(result = %d) %s\n", result, e.toChars()); shift_optimize(e, &Shr); } override void visit(UshrExp e) { //printf("UshrExp::optimize(result = %d) %s\n", result, toChars()); shift_optimize(e, &Ushr); } override void visit(AndExp e) { if (binOptimize(e, result)) return; if (e.e1.isConst() == 1 && e.e2.isConst() == 1) ret = And(e.loc, e.type, e.e1, e.e2).copy(); } override void visit(OrExp e) { if (binOptimize(e, result)) return; if (e.e1.isConst() == 1 && e.e2.isConst() == 1) ret = Or(e.loc, e.type, e.e1, e.e2).copy(); } override void visit(XorExp e) { if (binOptimize(e, result)) return; if (e.e1.isConst() == 1 && e.e2.isConst() == 1) ret = Xor(e.loc, e.type, e.e1, e.e2).copy(); } override void visit(PowExp e) { if (binOptimize(e, result)) return; // All negative integral powers are illegal. if (e.e1.type.isintegral() && (e.e2.op == TOK.int64) && cast(sinteger_t)e.e2.toInteger() < 0) { e.error("cannot raise `%s` to a negative integer power. Did you mean `(cast(real)%s)^^%s` ?", e.e1.type.toBasetype().toChars(), e.e1.toChars(), e.e2.toChars()); return error(); } // If e2 *could* have been an integer, make it one. if (e.e2.op == TOK.float64 && e.e2.toReal() == real_t(cast(sinteger_t)e.e2.toReal())) { // This only applies to floating point, or positive integral powers. if (e.e1.type.isfloating() || cast(sinteger_t)e.e2.toInteger() >= 0) e.e2 = new IntegerExp(e.loc, e.e2.toInteger(), Type.tint64); } if (e.e1.isConst() == 1 && e.e2.isConst() == 1) { Expression ex = Pow(e.loc, e.type, e.e1, e.e2).copy(); if (!CTFEExp.isCantExp(ex)) { ret = ex; return; } } } override void visit(CommaExp e) { //printf("CommaExp::optimize(result = %d) %s\n", result, e.toChars()); // Comma needs special treatment, because it may // contain compiler-generated declarations. We can interpret them, but // otherwise we must NOT attempt to constant-fold them. // In particular, if the comma returns a temporary variable, it needs // to be an lvalue (this is particularly important for struct constructors) expOptimize(e.e1, WANTvalue); expOptimize(e.e2, result, keepLvalue); if (ret.op == TOK.error) return; if (!e.e1 || e.e1.op == TOK.int64 || e.e1.op == TOK.float64 || !hasSideEffect(e.e1)) { ret = e.e2; if (ret) ret.type = e.type; } //printf("-CommaExp::optimize(result = %d) %s\n", result, e.e.toChars()); } override void visit(ArrayLengthExp e) { //printf("ArrayLengthExp::optimize(result = %d) %s\n", result, e.toChars()); if (unaOptimize(e, WANTexpand)) return; // CTFE interpret static immutable arrays (to get better diagnostics) if (e.e1.op == TOK.variable) { VarDeclaration v = (cast(VarExp)e.e1).var.isVarDeclaration(); if (v && (v.storage_class & STC.static_) && (v.storage_class & STC.immutable_) && v._init) { if (Expression ci = v.getConstInitializer()) e.e1 = ci; } } if (e.e1.op == TOK.string_ || e.e1.op == TOK.arrayLiteral || e.e1.op == TOK.assocArrayLiteral || e.e1.type.toBasetype().ty == Tsarray) { ret = ArrayLength(e.type, e.e1).copy(); } } override void visit(EqualExp e) { //printf("EqualExp::optimize(result = %x) %s\n", result, e.toChars()); if (binOptimize(e, WANTvalue)) return; Expression e1 = fromConstInitializer(result, e.e1); Expression e2 = fromConstInitializer(result, e.e2); if (e1.op == TOK.error) { ret = e1; return; } if (e2.op == TOK.error) { ret = e2; return; } ret = Equal(e.op, e.loc, e.type, e1, e2).copy(); if (CTFEExp.isCantExp(ret)) ret = e; } override void visit(IdentityExp e) { //printf("IdentityExp::optimize(result = %d) %s\n", result, e.toChars()); if (binOptimize(e, WANTvalue)) return; if ((e.e1.isConst() && e.e2.isConst()) || (e.e1.op == TOK.null_ && e.e2.op == TOK.null_)) { ret = Identity(e.op, e.loc, e.type, e.e1, e.e2).copy(); if (CTFEExp.isCantExp(ret)) ret = e; } } override void visit(IndexExp e) { //printf("IndexExp::optimize(result = %d) %s\n", result, e.toChars()); if (expOptimize(e.e1, result & WANTexpand)) return; Expression ex = fromConstInitializer(result, e.e1); // We might know $ now setLengthVarIfKnown(e.lengthVar, ex); if (expOptimize(e.e2, WANTvalue)) return; // Don't optimize to an array literal element directly in case an lvalue is requested if (keepLvalue && ex.op == TOK.arrayLiteral) return; ret = Index(e.type, ex, e.e2).copy(); if (CTFEExp.isCantExp(ret) || (!ret.isErrorExp() && keepLvalue && !ret.isLvalue())) ret = e; } override void visit(SliceExp e) { //printf("SliceExp::optimize(result = %d) %s\n", result, e.toChars()); if (expOptimize(e.e1, result & WANTexpand)) return; if (!e.lwr) { if (e.e1.op == TOK.string_) { // Convert slice of string literal into dynamic array Type t = e.e1.type.toBasetype(); if (Type tn = t.nextOf()) ret = e.e1.castTo(null, tn.arrayOf()); } } else { e.e1 = fromConstInitializer(result, e.e1); // We might know $ now setLengthVarIfKnown(e.lengthVar, e.e1); expOptimize(e.lwr, WANTvalue); expOptimize(e.upr, WANTvalue); if (ret.op == TOK.error) return; ret = Slice(e.type, e.e1, e.lwr, e.upr).copy(); if (CTFEExp.isCantExp(ret)) ret = e; } // https://issues.dlang.org/show_bug.cgi?id=14649 // Leave the slice form so it might be // a part of array operation. // Assume that the backend codegen will handle the form `e[]` // as an equal to `e` itself. if (ret.op == TOK.string_) { e.e1 = ret; e.lwr = null; e.upr = null; ret = e; } //printf("-SliceExp::optimize() %s\n", ret.toChars()); } override void visit(LogicalExp e) { //printf("LogicalExp::optimize(%d) %s\n", result, e.toChars()); if (expOptimize(e.e1, WANTvalue)) return; const oror = e.op == TOK.orOr; if (e.e1.isBool(oror)) { // Replace with (e1, oror) ret = IntegerExp.createBool(oror); ret = Expression.combine(e.e1, ret); if (e.type.toBasetype().ty == Tvoid) { ret = new CastExp(e.loc, ret, Type.tvoid); ret.type = e.type; } ret = Expression_optimize(ret, result, false); return; } expOptimize(e.e2, WANTvalue); if (e.e1.isConst()) { if (e.e2.isConst()) { bool n1 = e.e1.isBool(true); bool n2 = e.e2.isBool(true); ret = new IntegerExp(e.loc, oror ? (n1 || n2) : (n1 && n2), e.type); } else if (e.e1.isBool(!oror)) { if (e.type.toBasetype().ty == Tvoid) ret = e.e2; else { ret = new CastExp(e.loc, e.e2, e.type); ret.type = e.type; } } } } override void visit(CmpExp e) { //printf("CmpExp::optimize() %s\n", e.toChars()); if (binOptimize(e, WANTvalue)) return; Expression e1 = fromConstInitializer(result, e.e1); Expression e2 = fromConstInitializer(result, e.e2); ret = Cmp(e.op, e.loc, e.type, e1, e2).copy(); if (CTFEExp.isCantExp(ret)) ret = e; } override void visit(CatExp e) { //printf("CatExp::optimize(%d) %s\n", result, e.toChars()); if (binOptimize(e, result)) return; if (e.e1.op == TOK.concatenate) { // https://issues.dlang.org/show_bug.cgi?id=12798 // optimize ((expr ~ str1) ~ str2) CatExp ce1 = cast(CatExp)e.e1; scope CatExp cex = new CatExp(e.loc, ce1.e2, e.e2); cex.type = e.type; Expression ex = Expression_optimize(cex, result, false); if (ex != cex) { e.e1 = ce1.e1; e.e2 = ex; } } // optimize "str"[] -> "str" if (e.e1.op == TOK.slice) { SliceExp se1 = cast(SliceExp)e.e1; if (se1.e1.op == TOK.string_ && !se1.lwr) e.e1 = se1.e1; } if (e.e2.op == TOK.slice) { SliceExp se2 = cast(SliceExp)e.e2; if (se2.e1.op == TOK.string_ && !se2.lwr) e.e2 = se2.e1; } ret = Cat(e.loc, e.type, e.e1, e.e2).copy(); if (CTFEExp.isCantExp(ret)) ret = e; } override void visit(CondExp e) { if (expOptimize(e.econd, WANTvalue)) return; if (e.econd.isBool(true)) ret = Expression_optimize(e.e1, result, keepLvalue); else if (e.econd.isBool(false)) ret = Expression_optimize(e.e2, result, keepLvalue); else { expOptimize(e.e1, result, keepLvalue); expOptimize(e.e2, result, keepLvalue); } } } scope OptimizeVisitor v = new OptimizeVisitor(e, result, keepLvalue); // Optimize the expression until it can no longer be simplified. size_t b; while (1) { if (b++ == global.recursionLimit) { e.error("infinite loop while optimizing expression"); fatal(); } auto ex = v.ret; ex.accept(v); if (ex == v.ret) break; } return v.ret; }
D
// double module std.typeinfo.ti_double; private import std.math; class TypeInfo_d : TypeInfo { char[] toString() { return "double"; } hash_t getHash(void *p) { return (cast(uint *)p)[0] + (cast(uint *)p)[1]; } static int _equals(double f1, double f2) { return f1 == f2 || (isnan(f1) && isnan(f2)); } static int _compare(double d1, double d2) { if (d1 !<>= d2) // if either are NaN { if (isnan(d1)) { if (isnan(d2)) return 0; return -1; } return 1; } return (d1 == d2) ? 0 : ((d1 < d2) ? -1 : 1); } int equals(void *p1, void *p2) { return _equals(*cast(double *)p1, *cast(double *)p2); } int compare(void *p1, void *p2) { return _compare(*cast(double *)p1, *cast(double *)p2); } size_t tsize() { return double.sizeof; } void swap(void *p1, void *p2) { double t; t = *cast(double *)p1; *cast(double *)p1 = *cast(double *)p2; *cast(double *)p2 = t; } void[] init() { static double r; return (cast(double *)&r)[0 .. 1]; } }
D
instance PIR_1353_Addon_Morgan(Npc_Default) { name[0] = "Морган"; guild = GIL_PIR; id = 1353; voice = 7; flags = FALSE; npcType = npctype_main; B_SetAttributesToChapter(self,3); fight_tactic = FAI_HUMAN_MASTER; EquipItem(self,ItMw_Doppelaxt); B_SetNpcVisual(self,MALE,"Hum_Head_FatBald",Face_L_Tough_Santino,BodyTex_L,ITAR_PIR_M_Addon); Mdl_SetModelFatness(self,1); Mdl_ApplyOverlayMds(self,"Humans_Relaxed.mds"); B_GiveNpcTalents(self); B_SetFightSkills(self,90); daily_routine = Rtn_START_1353; }; func void Rtn_START_1353() { TA_Sleep(5,0,20,0,"ADW_PIRATECAMP_CAVE_BED"); TA_Sleep(20,0,5,0,"ADW_PIRATECAMP_CAVE_BED"); }; func void Rtn_GregIsBack_1353() { TA_Saw(23,0,9,0,"ADW_PIRATECAMP_SAW_01"); TA_Saw(9,0,23,0,"ADW_PIRATECAMP_SAW_01"); }; func void rtn_tot_1353() { TA_Stand_Guarding(8,0,23,0,"TOT"); TA_Stand_Guarding(23,0,8,0,"TOT"); };
D
module UnrealScript.UTGame.UTDeathmatch; import ScriptClasses; import UnrealScript.Helpers; import UnrealScript.Engine.Pawn; import UnrealScript.UTGame.UTGame; import UnrealScript.UTGame.UTBot; extern(C++) interface UTDeathmatch : UTGame { public extern(D): private static __gshared ScriptClass mStaticClass; @property final static ScriptClass StaticClass() { mixin(MGSCC("Class UTGame.UTDeathmatch")); } private static __gshared UTDeathmatch mDefaultProperties; @property final static UTDeathmatch DefaultProperties() { mixin(MGDPC("UTDeathmatch", "UTDeathmatch UTGame.Default__UTDeathmatch")); } static struct Functions { private static __gshared { ScriptFunction mWantsPickups; ScriptFunction mGetHandicapNeed; } public @property static final { ScriptFunction WantsPickups() { mixin(MGF("mWantsPickups", "Function UTGame.UTDeathmatch.WantsPickups")); } ScriptFunction GetHandicapNeed() { mixin(MGF("mGetHandicapNeed", "Function UTGame.UTDeathmatch.GetHandicapNeed")); } } } final: bool WantsPickups(UTBot B) { ubyte params[8]; params[] = 0; *cast(UTBot*)params.ptr = B; (cast(ScriptObject)this).ProcessEvent(Functions.WantsPickups, params.ptr, cast(void*)0); return *cast(bool*)&params[4]; } int GetHandicapNeed(Pawn Other) { ubyte params[8]; params[] = 0; *cast(Pawn*)params.ptr = Other; (cast(ScriptObject)this).ProcessEvent(Functions.GetHandicapNeed, params.ptr, cast(void*)0); return *cast(int*)&params[4]; } }
D
/Users/Yowa/WorkSpace/Pokedex/Build/Intermediates/Pokedex.build/Debug/Core.build/Objects-normal/x86_64/Bytes+Base64.o : /Users/Yowa/WorkSpace/Pokedex/Packages/Core-1.0.0/Sources/Core/Array.swift /Users/Yowa/WorkSpace/Pokedex/Packages/Core-1.0.0/Sources/Core/Bool+String.swift /Users/Yowa/WorkSpace/Pokedex/Packages/Core-1.0.0/Sources/Core/Box.swift /Users/Yowa/WorkSpace/Pokedex/Packages/Core-1.0.0/Sources/Core/Collection+Safe.swift /Users/Yowa/WorkSpace/Pokedex/Packages/Core-1.0.0/Sources/Core/Dispatch.swift /Users/Yowa/WorkSpace/Pokedex/Packages/Core-1.0.0/Sources/Core/DispatchTime+Utilities.swift /Users/Yowa/WorkSpace/Pokedex/Packages/Core-1.0.0/Sources/Core/Equatable.swift /Users/Yowa/WorkSpace/Pokedex/Packages/Core-1.0.0/Sources/Core/Extractable.swift /Users/Yowa/WorkSpace/Pokedex/Packages/Core-1.0.0/Sources/Core/FileProtocol.swift /Users/Yowa/WorkSpace/Pokedex/Packages/Core-1.0.0/Sources/Core/Lock.swift /Users/Yowa/WorkSpace/Pokedex/Packages/Core-1.0.0/Sources/Core/PercentEncoding.swift /Users/Yowa/WorkSpace/Pokedex/Packages/Core-1.0.0/Sources/Core/Portal.swift /Users/Yowa/WorkSpace/Pokedex/Packages/Core-1.0.0/Sources/Core/Result.swift /Users/Yowa/WorkSpace/Pokedex/Packages/Core-1.0.0/Sources/Core/RFC1123.swift /Users/Yowa/WorkSpace/Pokedex/Packages/Core-1.0.0/Sources/Core/Semaphore.swift /Users/Yowa/WorkSpace/Pokedex/Packages/Core-1.0.0/Sources/Core/Sequence.swift /Users/Yowa/WorkSpace/Pokedex/Packages/Core-1.0.0/Sources/Core/StaticDataBuffer.swift /Users/Yowa/WorkSpace/Pokedex/Packages/Core-1.0.0/Sources/Core/Strand.swift /Users/Yowa/WorkSpace/Pokedex/Packages/Core-1.0.0/Sources/Core/String+CaseInsensitiveCompare.swift /Users/Yowa/WorkSpace/Pokedex/Packages/Core-1.0.0/Sources/Core/String.swift /Users/Yowa/WorkSpace/Pokedex/Packages/Core-1.0.0/Sources/Core/UnsignedInteger.swift /Users/Yowa/WorkSpace/Pokedex/Packages/Core-1.0.0/Sources/Core/Byte/Byte+Random.swift /Users/Yowa/WorkSpace/Pokedex/Packages/Core-1.0.0/Sources/Core/Byte/Byte.swift /Users/Yowa/WorkSpace/Pokedex/Packages/Core-1.0.0/Sources/Core/Byte/ByteAliases.swift /Users/Yowa/WorkSpace/Pokedex/Packages/Core-1.0.0/Sources/Core/Byte/Bytes+Base64.swift /Users/Yowa/WorkSpace/Pokedex/Packages/Core-1.0.0/Sources/Core/Byte/Bytes.swift /Users/Yowa/WorkSpace/Pokedex/Packages/Core-1.0.0/Sources/Core/Byte/BytesConvertible.swift /Users/Yowa/WorkSpace/Pokedex/Packages/Core-1.0.0/Sources/Core/Byte/BytesSlice+PatternMatching.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/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/ObjectiveC.swiftmodule /Users/Yowa/WorkSpace/Pokedex/Build/Products/Debug/libc.framework/Modules/libc.swiftmodule/x86_64.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/CoreGraphics.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/IOKit.swiftmodule /Users/Yowa/WorkSpace/Pokedex/Build/Intermediates/Pokedex.build/Debug/Core.build/Objects-normal/x86_64/Bytes+Base64~partial.swiftmodule : /Users/Yowa/WorkSpace/Pokedex/Packages/Core-1.0.0/Sources/Core/Array.swift /Users/Yowa/WorkSpace/Pokedex/Packages/Core-1.0.0/Sources/Core/Bool+String.swift /Users/Yowa/WorkSpace/Pokedex/Packages/Core-1.0.0/Sources/Core/Box.swift /Users/Yowa/WorkSpace/Pokedex/Packages/Core-1.0.0/Sources/Core/Collection+Safe.swift /Users/Yowa/WorkSpace/Pokedex/Packages/Core-1.0.0/Sources/Core/Dispatch.swift /Users/Yowa/WorkSpace/Pokedex/Packages/Core-1.0.0/Sources/Core/DispatchTime+Utilities.swift /Users/Yowa/WorkSpace/Pokedex/Packages/Core-1.0.0/Sources/Core/Equatable.swift /Users/Yowa/WorkSpace/Pokedex/Packages/Core-1.0.0/Sources/Core/Extractable.swift /Users/Yowa/WorkSpace/Pokedex/Packages/Core-1.0.0/Sources/Core/FileProtocol.swift /Users/Yowa/WorkSpace/Pokedex/Packages/Core-1.0.0/Sources/Core/Lock.swift /Users/Yowa/WorkSpace/Pokedex/Packages/Core-1.0.0/Sources/Core/PercentEncoding.swift /Users/Yowa/WorkSpace/Pokedex/Packages/Core-1.0.0/Sources/Core/Portal.swift /Users/Yowa/WorkSpace/Pokedex/Packages/Core-1.0.0/Sources/Core/Result.swift /Users/Yowa/WorkSpace/Pokedex/Packages/Core-1.0.0/Sources/Core/RFC1123.swift /Users/Yowa/WorkSpace/Pokedex/Packages/Core-1.0.0/Sources/Core/Semaphore.swift /Users/Yowa/WorkSpace/Pokedex/Packages/Core-1.0.0/Sources/Core/Sequence.swift /Users/Yowa/WorkSpace/Pokedex/Packages/Core-1.0.0/Sources/Core/StaticDataBuffer.swift /Users/Yowa/WorkSpace/Pokedex/Packages/Core-1.0.0/Sources/Core/Strand.swift /Users/Yowa/WorkSpace/Pokedex/Packages/Core-1.0.0/Sources/Core/String+CaseInsensitiveCompare.swift /Users/Yowa/WorkSpace/Pokedex/Packages/Core-1.0.0/Sources/Core/String.swift /Users/Yowa/WorkSpace/Pokedex/Packages/Core-1.0.0/Sources/Core/UnsignedInteger.swift /Users/Yowa/WorkSpace/Pokedex/Packages/Core-1.0.0/Sources/Core/Byte/Byte+Random.swift /Users/Yowa/WorkSpace/Pokedex/Packages/Core-1.0.0/Sources/Core/Byte/Byte.swift /Users/Yowa/WorkSpace/Pokedex/Packages/Core-1.0.0/Sources/Core/Byte/ByteAliases.swift /Users/Yowa/WorkSpace/Pokedex/Packages/Core-1.0.0/Sources/Core/Byte/Bytes+Base64.swift /Users/Yowa/WorkSpace/Pokedex/Packages/Core-1.0.0/Sources/Core/Byte/Bytes.swift /Users/Yowa/WorkSpace/Pokedex/Packages/Core-1.0.0/Sources/Core/Byte/BytesConvertible.swift /Users/Yowa/WorkSpace/Pokedex/Packages/Core-1.0.0/Sources/Core/Byte/BytesSlice+PatternMatching.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/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/ObjectiveC.swiftmodule /Users/Yowa/WorkSpace/Pokedex/Build/Products/Debug/libc.framework/Modules/libc.swiftmodule/x86_64.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/CoreGraphics.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/IOKit.swiftmodule /Users/Yowa/WorkSpace/Pokedex/Build/Intermediates/Pokedex.build/Debug/Core.build/Objects-normal/x86_64/Bytes+Base64~partial.swiftdoc : /Users/Yowa/WorkSpace/Pokedex/Packages/Core-1.0.0/Sources/Core/Array.swift /Users/Yowa/WorkSpace/Pokedex/Packages/Core-1.0.0/Sources/Core/Bool+String.swift /Users/Yowa/WorkSpace/Pokedex/Packages/Core-1.0.0/Sources/Core/Box.swift /Users/Yowa/WorkSpace/Pokedex/Packages/Core-1.0.0/Sources/Core/Collection+Safe.swift /Users/Yowa/WorkSpace/Pokedex/Packages/Core-1.0.0/Sources/Core/Dispatch.swift /Users/Yowa/WorkSpace/Pokedex/Packages/Core-1.0.0/Sources/Core/DispatchTime+Utilities.swift /Users/Yowa/WorkSpace/Pokedex/Packages/Core-1.0.0/Sources/Core/Equatable.swift /Users/Yowa/WorkSpace/Pokedex/Packages/Core-1.0.0/Sources/Core/Extractable.swift /Users/Yowa/WorkSpace/Pokedex/Packages/Core-1.0.0/Sources/Core/FileProtocol.swift /Users/Yowa/WorkSpace/Pokedex/Packages/Core-1.0.0/Sources/Core/Lock.swift /Users/Yowa/WorkSpace/Pokedex/Packages/Core-1.0.0/Sources/Core/PercentEncoding.swift /Users/Yowa/WorkSpace/Pokedex/Packages/Core-1.0.0/Sources/Core/Portal.swift /Users/Yowa/WorkSpace/Pokedex/Packages/Core-1.0.0/Sources/Core/Result.swift /Users/Yowa/WorkSpace/Pokedex/Packages/Core-1.0.0/Sources/Core/RFC1123.swift /Users/Yowa/WorkSpace/Pokedex/Packages/Core-1.0.0/Sources/Core/Semaphore.swift /Users/Yowa/WorkSpace/Pokedex/Packages/Core-1.0.0/Sources/Core/Sequence.swift /Users/Yowa/WorkSpace/Pokedex/Packages/Core-1.0.0/Sources/Core/StaticDataBuffer.swift /Users/Yowa/WorkSpace/Pokedex/Packages/Core-1.0.0/Sources/Core/Strand.swift /Users/Yowa/WorkSpace/Pokedex/Packages/Core-1.0.0/Sources/Core/String+CaseInsensitiveCompare.swift /Users/Yowa/WorkSpace/Pokedex/Packages/Core-1.0.0/Sources/Core/String.swift /Users/Yowa/WorkSpace/Pokedex/Packages/Core-1.0.0/Sources/Core/UnsignedInteger.swift /Users/Yowa/WorkSpace/Pokedex/Packages/Core-1.0.0/Sources/Core/Byte/Byte+Random.swift /Users/Yowa/WorkSpace/Pokedex/Packages/Core-1.0.0/Sources/Core/Byte/Byte.swift /Users/Yowa/WorkSpace/Pokedex/Packages/Core-1.0.0/Sources/Core/Byte/ByteAliases.swift /Users/Yowa/WorkSpace/Pokedex/Packages/Core-1.0.0/Sources/Core/Byte/Bytes+Base64.swift /Users/Yowa/WorkSpace/Pokedex/Packages/Core-1.0.0/Sources/Core/Byte/Bytes.swift /Users/Yowa/WorkSpace/Pokedex/Packages/Core-1.0.0/Sources/Core/Byte/BytesConvertible.swift /Users/Yowa/WorkSpace/Pokedex/Packages/Core-1.0.0/Sources/Core/Byte/BytesSlice+PatternMatching.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/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/ObjectiveC.swiftmodule /Users/Yowa/WorkSpace/Pokedex/Build/Products/Debug/libc.framework/Modules/libc.swiftmodule/x86_64.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/CoreGraphics.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/IOKit.swiftmodule
D
/home/alansky/Dev/Parity/substrate-node-template/target/release/build/sc-network-c8401f3390b72674/build_script_build-c8401f3390b72674: /home/alansky/.cargo/registry/src/github.com-1ecc6299db9ec823/sc-network-0.8.0/build.rs /home/alansky/Dev/Parity/substrate-node-template/target/release/build/sc-network-c8401f3390b72674/build_script_build-c8401f3390b72674.d: /home/alansky/.cargo/registry/src/github.com-1ecc6299db9ec823/sc-network-0.8.0/build.rs /home/alansky/.cargo/registry/src/github.com-1ecc6299db9ec823/sc-network-0.8.0/build.rs:
D
/** * * THIS FILE IS AUTO-GENERATED BY ./parse_specs.d FOR MCU at90c8534 WITH ARCHITECTURE avr2 * */ module avr.specs.specs_at90c8534; enum __AVR_ARCH__ = 2; enum __AVR_ASM_ONLY__ = false; enum __AVR_ENHANCED__ = false; enum __AVR_HAVE_MUL__ = false; enum __AVR_HAVE_JMP_CALL__ = false; enum __AVR_MEGA__ = false; enum __AVR_HAVE_LPMX__ = false; enum __AVR_HAVE_MOVW__ = false; enum __AVR_HAVE_ELPM__ = false; enum __AVR_HAVE_ELPMX__ = false; enum __AVR_HAVE_EIJMP_EICALL_ = false; enum __AVR_2_BYTE_PC__ = true; enum __AVR_3_BYTE_PC__ = false; enum __AVR_XMEGA__ = false; enum __AVR_HAVE_RAMPX__ = false; enum __AVR_HAVE_RAMPY__ = false; enum __AVR_HAVE_RAMPZ__ = false; enum __AVR_HAVE_RAMPD__ = false; enum __AVR_TINY__ = false; enum __AVR_PM_BASE_ADDRESS__ = 0; enum __AVR_SFR_OFFSET__ = 32; enum __AVR_DEVICE_NAME__ = "at90c8534";
D
/* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). * Version 3.0.0 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. * ----------------------------------------------------------------------------- */ module vtkContextDevice3D; static import vtkd_im; static import core.stdc.config; static import std.conv; static import std.string; static import std.conv; static import std.string; static import vtkObjectBase; static import vtkPen; static import vtkBrush; static import vtkMatrix4x4; static import vtkRecti; static import vtkObject; class vtkContextDevice3D : vtkObject.vtkObject { private void* swigCPtr; public this(void* cObject, bool ownCObject) { super(vtkd_im.vtkContextDevice3D_Upcast(cObject), ownCObject); swigCPtr = cObject; } public static void* swigGetCPtr(vtkContextDevice3D obj) { return (obj is null) ? null : obj.swigCPtr; } mixin vtkd_im.SwigOperatorDefinitions; public override void dispose() { synchronized(this) { if (swigCPtr !is null) { if (swigCMemOwn) { swigCMemOwn = false; throw new object.Exception("C++ destructor does not have public access"); } swigCPtr = null; super.dispose(); } } } public static int IsTypeOf(string type) { auto ret = vtkd_im.vtkContextDevice3D_IsTypeOf((type ? std.string.toStringz(type) : null)); return ret; } public static vtkContextDevice3D SafeDownCast(vtkObjectBase.vtkObjectBase o) { void* cPtr = vtkd_im.vtkContextDevice3D_SafeDownCast(vtkObjectBase.vtkObjectBase.swigGetCPtr(o)); vtkContextDevice3D ret = (cPtr is null) ? null : new vtkContextDevice3D(cPtr, false); return ret; } public vtkContextDevice3D NewInstance() const { void* cPtr = vtkd_im.vtkContextDevice3D_NewInstance(cast(void*)swigCPtr); vtkContextDevice3D ret = (cPtr is null) ? null : new vtkContextDevice3D(cPtr, false); return ret; } alias vtkObject.vtkObject.NewInstance NewInstance; public void DrawPoly(float* verts, int n, ubyte* colors, int nc) { vtkd_im.vtkContextDevice3D_DrawPoly__SWIG_0(cast(void*)swigCPtr, cast(void*)verts, n, cast(void*)colors, nc); } public void DrawPoly(float* verts, int n, ubyte* colors) { vtkd_im.vtkContextDevice3D_DrawPoly__SWIG_1(cast(void*)swigCPtr, cast(void*)verts, n, cast(void*)colors); } public void DrawPoly(float* verts, int n) { vtkd_im.vtkContextDevice3D_DrawPoly__SWIG_2(cast(void*)swigCPtr, cast(void*)verts, n); } public void DrawPoints(float* verts, int n, ubyte* colors, int nc) { vtkd_im.vtkContextDevice3D_DrawPoints__SWIG_0(cast(void*)swigCPtr, cast(void*)verts, n, cast(void*)colors, nc); } public void DrawPoints(float* verts, int n, ubyte* colors) { vtkd_im.vtkContextDevice3D_DrawPoints__SWIG_1(cast(void*)swigCPtr, cast(void*)verts, n, cast(void*)colors); } public void DrawPoints(float* verts, int n) { vtkd_im.vtkContextDevice3D_DrawPoints__SWIG_2(cast(void*)swigCPtr, cast(void*)verts, n); } public void DrawTriangleMesh(float* mesh, int n, ubyte* colors, int nc) { vtkd_im.vtkContextDevice3D_DrawTriangleMesh(cast(void*)swigCPtr, cast(void*)mesh, n, cast(void*)colors, nc); } public void ApplyPen(vtkPen.vtkPen pen) { vtkd_im.vtkContextDevice3D_ApplyPen(cast(void*)swigCPtr, vtkPen.vtkPen.swigGetCPtr(pen)); } public void ApplyBrush(vtkBrush.vtkBrush brush) { vtkd_im.vtkContextDevice3D_ApplyBrush(cast(void*)swigCPtr, vtkBrush.vtkBrush.swigGetCPtr(brush)); } public void SetMatrix(vtkMatrix4x4.vtkMatrix4x4 m) { vtkd_im.vtkContextDevice3D_SetMatrix(cast(void*)swigCPtr, vtkMatrix4x4.vtkMatrix4x4.swigGetCPtr(m)); } public void GetMatrix(vtkMatrix4x4.vtkMatrix4x4 m) { vtkd_im.vtkContextDevice3D_GetMatrix(cast(void*)swigCPtr, vtkMatrix4x4.vtkMatrix4x4.swigGetCPtr(m)); } public void MultiplyMatrix(vtkMatrix4x4.vtkMatrix4x4 m) { vtkd_im.vtkContextDevice3D_MultiplyMatrix(cast(void*)swigCPtr, vtkMatrix4x4.vtkMatrix4x4.swigGetCPtr(m)); } public void PushMatrix() { vtkd_im.vtkContextDevice3D_PushMatrix(cast(void*)swigCPtr); } public void PopMatrix() { vtkd_im.vtkContextDevice3D_PopMatrix(cast(void*)swigCPtr); } public void SetClipping(vtkRecti.vtkRecti rect) { vtkd_im.vtkContextDevice3D_SetClipping(cast(void*)swigCPtr, vtkRecti.vtkRecti.swigGetCPtr(rect)); if (vtkd_im.SwigPendingException.isPending) throw vtkd_im.SwigPendingException.retrieve(); } public void DisableClipping() { vtkd_im.vtkContextDevice3D_DisableClipping(cast(void*)swigCPtr); } public void EnableClipping(bool enable) { vtkd_im.vtkContextDevice3D_EnableClipping(cast(void*)swigCPtr, enable); } public void EnableClippingPlane(int i, double* planeEquation) { vtkd_im.vtkContextDevice3D_EnableClippingPlane(cast(void*)swigCPtr, i, cast(void*)planeEquation); } public void DisableClippingPlane(int i) { vtkd_im.vtkContextDevice3D_DisableClippingPlane(cast(void*)swigCPtr, i); } }
D
/Users/gbs/Xcode/souless/DerivedData/souless/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/Kingfisher.build/Objects-normal/x86_64/KingfisherOptionsInfo.o : /Users/gbs/Xcode/souless/Pods/Kingfisher/Sources/String+MD5.swift /Users/gbs/Xcode/souless/Pods/Kingfisher/Sources/Resource.swift /Users/gbs/Xcode/souless/Pods/Kingfisher/Sources/Image.swift /Users/gbs/Xcode/souless/Pods/Kingfisher/Sources/ImageCache.swift /Users/gbs/Xcode/souless/Pods/Kingfisher/Sources/ImageTransition.swift /Users/gbs/Xcode/souless/Pods/Kingfisher/Sources/KingfisherOptionsInfo.swift /Users/gbs/Xcode/souless/Pods/Kingfisher/Sources/ImageDownloader.swift /Users/gbs/Xcode/souless/Pods/Kingfisher/Sources/Placeholder.swift /Users/gbs/Xcode/souless/Pods/Kingfisher/Sources/KingfisherManager.swift /Users/gbs/Xcode/souless/Pods/Kingfisher/Sources/ImagePrefetcher.swift /Users/gbs/Xcode/souless/Pods/Kingfisher/Sources/UIButton+Kingfisher.swift /Users/gbs/Xcode/souless/Pods/Kingfisher/Sources/ImageView+Kingfisher.swift /Users/gbs/Xcode/souless/Pods/Kingfisher/Sources/Kingfisher.swift /Users/gbs/Xcode/souless/Pods/Kingfisher/Sources/ImageModifier.swift /Users/gbs/Xcode/souless/Pods/Kingfisher/Sources/RequestModifier.swift /Users/gbs/Xcode/souless/Pods/Kingfisher/Sources/ThreadHelper.swift /Users/gbs/Xcode/souless/Pods/Kingfisher/Sources/Filter.swift /Users/gbs/Xcode/souless/Pods/Kingfisher/Sources/CacheSerializer.swift /Users/gbs/Xcode/souless/Pods/Kingfisher/Sources/FormatIndicatedCacheSerializer.swift /Users/gbs/Xcode/souless/Pods/Kingfisher/Sources/ImageProcessor.swift /Users/gbs/Xcode/souless/Pods/Kingfisher/Sources/Indicator.swift /Users/gbs/Xcode/souless/Pods/Kingfisher/Sources/AnimatedImageView.swift /Users/gbs/Xcode/souless/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/souless/Pods/Target\ Support\ Files/Kingfisher/Kingfisher-umbrella.h /Users/gbs/Xcode/souless/Pods/Kingfisher/Sources/Kingfisher.h /Users/gbs/Xcode/souless/DerivedData/souless/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/souless/DerivedData/souless/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/Kingfisher.build/Objects-normal/x86_64/KingfisherOptionsInfo~partial.swiftmodule : /Users/gbs/Xcode/souless/Pods/Kingfisher/Sources/String+MD5.swift /Users/gbs/Xcode/souless/Pods/Kingfisher/Sources/Resource.swift /Users/gbs/Xcode/souless/Pods/Kingfisher/Sources/Image.swift /Users/gbs/Xcode/souless/Pods/Kingfisher/Sources/ImageCache.swift /Users/gbs/Xcode/souless/Pods/Kingfisher/Sources/ImageTransition.swift /Users/gbs/Xcode/souless/Pods/Kingfisher/Sources/KingfisherOptionsInfo.swift /Users/gbs/Xcode/souless/Pods/Kingfisher/Sources/ImageDownloader.swift /Users/gbs/Xcode/souless/Pods/Kingfisher/Sources/Placeholder.swift /Users/gbs/Xcode/souless/Pods/Kingfisher/Sources/KingfisherManager.swift /Users/gbs/Xcode/souless/Pods/Kingfisher/Sources/ImagePrefetcher.swift /Users/gbs/Xcode/souless/Pods/Kingfisher/Sources/UIButton+Kingfisher.swift /Users/gbs/Xcode/souless/Pods/Kingfisher/Sources/ImageView+Kingfisher.swift /Users/gbs/Xcode/souless/Pods/Kingfisher/Sources/Kingfisher.swift /Users/gbs/Xcode/souless/Pods/Kingfisher/Sources/ImageModifier.swift /Users/gbs/Xcode/souless/Pods/Kingfisher/Sources/RequestModifier.swift /Users/gbs/Xcode/souless/Pods/Kingfisher/Sources/ThreadHelper.swift /Users/gbs/Xcode/souless/Pods/Kingfisher/Sources/Filter.swift /Users/gbs/Xcode/souless/Pods/Kingfisher/Sources/CacheSerializer.swift /Users/gbs/Xcode/souless/Pods/Kingfisher/Sources/FormatIndicatedCacheSerializer.swift /Users/gbs/Xcode/souless/Pods/Kingfisher/Sources/ImageProcessor.swift /Users/gbs/Xcode/souless/Pods/Kingfisher/Sources/Indicator.swift /Users/gbs/Xcode/souless/Pods/Kingfisher/Sources/AnimatedImageView.swift /Users/gbs/Xcode/souless/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/souless/Pods/Target\ Support\ Files/Kingfisher/Kingfisher-umbrella.h /Users/gbs/Xcode/souless/Pods/Kingfisher/Sources/Kingfisher.h /Users/gbs/Xcode/souless/DerivedData/souless/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/souless/DerivedData/souless/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/Kingfisher.build/Objects-normal/x86_64/KingfisherOptionsInfo~partial.swiftdoc : /Users/gbs/Xcode/souless/Pods/Kingfisher/Sources/String+MD5.swift /Users/gbs/Xcode/souless/Pods/Kingfisher/Sources/Resource.swift /Users/gbs/Xcode/souless/Pods/Kingfisher/Sources/Image.swift /Users/gbs/Xcode/souless/Pods/Kingfisher/Sources/ImageCache.swift /Users/gbs/Xcode/souless/Pods/Kingfisher/Sources/ImageTransition.swift /Users/gbs/Xcode/souless/Pods/Kingfisher/Sources/KingfisherOptionsInfo.swift /Users/gbs/Xcode/souless/Pods/Kingfisher/Sources/ImageDownloader.swift /Users/gbs/Xcode/souless/Pods/Kingfisher/Sources/Placeholder.swift /Users/gbs/Xcode/souless/Pods/Kingfisher/Sources/KingfisherManager.swift /Users/gbs/Xcode/souless/Pods/Kingfisher/Sources/ImagePrefetcher.swift /Users/gbs/Xcode/souless/Pods/Kingfisher/Sources/UIButton+Kingfisher.swift /Users/gbs/Xcode/souless/Pods/Kingfisher/Sources/ImageView+Kingfisher.swift /Users/gbs/Xcode/souless/Pods/Kingfisher/Sources/Kingfisher.swift /Users/gbs/Xcode/souless/Pods/Kingfisher/Sources/ImageModifier.swift /Users/gbs/Xcode/souless/Pods/Kingfisher/Sources/RequestModifier.swift /Users/gbs/Xcode/souless/Pods/Kingfisher/Sources/ThreadHelper.swift /Users/gbs/Xcode/souless/Pods/Kingfisher/Sources/Filter.swift /Users/gbs/Xcode/souless/Pods/Kingfisher/Sources/CacheSerializer.swift /Users/gbs/Xcode/souless/Pods/Kingfisher/Sources/FormatIndicatedCacheSerializer.swift /Users/gbs/Xcode/souless/Pods/Kingfisher/Sources/ImageProcessor.swift /Users/gbs/Xcode/souless/Pods/Kingfisher/Sources/Indicator.swift /Users/gbs/Xcode/souless/Pods/Kingfisher/Sources/AnimatedImageView.swift /Users/gbs/Xcode/souless/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/souless/Pods/Target\ Support\ Files/Kingfisher/Kingfisher-umbrella.h /Users/gbs/Xcode/souless/Pods/Kingfisher/Sources/Kingfisher.h /Users/gbs/Xcode/souless/DerivedData/souless/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
/Users/jon_thornburg/Desktop/FireChat/DerivedData/FireChat/Build/Intermediates/FireChat.build/Debug-iphonesimulator/FireChat.build/Objects-normal/x86_64/AppDelegate.o : /Users/jon_thornburg/Desktop/FireChat/FireChat/NewMessagesController.swift /Users/jon_thornburg/Desktop/FireChat/FireChat/MessagesController.swift /Users/jon_thornburg/Desktop/FireChat/FireChat/LoginController.swift /Users/jon_thornburg/Desktop/FireChat/FireChat/LoginController\ +\ handlers.swift /Users/jon_thornburg/Desktop/FireChat/FireChat/FirebaseCalls.swift /Users/jon_thornburg/Desktop/FireChat/FireChat/User.swift /Users/jon_thornburg/Desktop/FireChat/FireChat/AppDelegate.swift /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/Foundation.swiftmodule /Users/jon_thornburg/Desktop/FireChat/Pods/Firebase/Analytics/Sources/module.modulemap /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/UIKit.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreImage.swiftmodule /Users/jon_thornburg/Desktop/FireChat/Pods/FirebaseAnalytics/Frameworks/frameworks/FirebaseAnalytics.framework/Headers/FIROptions.h /Users/jon_thornburg/Desktop/FireChat/Pods/FirebaseAnalytics/Frameworks/frameworks/FirebaseAnalytics.framework/Headers/FIRConfiguration.h /Users/jon_thornburg/Desktop/FireChat/Pods/FirebaseAnalytics/Frameworks/frameworks/FirebaseAnalytics.framework/Headers/FIRApp.h /Users/jon_thornburg/Desktop/FireChat/Pods/FirebaseAnalytics/Frameworks/frameworks/FirebaseAnalytics.framework/Headers/FIRAnalyticsConfiguration.h /Users/jon_thornburg/Desktop/FireChat/Pods/FirebaseAnalytics/Frameworks/frameworks/FirebaseAnalytics.framework/Headers/FIRUserPropertyNames.h /Users/jon_thornburg/Desktop/FireChat/Pods/FirebaseAnalytics/Frameworks/frameworks/FirebaseAnalytics.framework/Headers/FIRParameterNames.h /Users/jon_thornburg/Desktop/FireChat/Pods/FirebaseAnalytics/Frameworks/frameworks/FirebaseAnalytics.framework/Headers/FIREventNames.h /Users/jon_thornburg/Desktop/FireChat/Pods/FirebaseAnalytics/Frameworks/frameworks/FirebaseAnalytics.framework/Headers/FIRAnalytics.h /Users/jon_thornburg/Desktop/FireChat/Pods/FirebaseAnalytics/Frameworks/frameworks/FirebaseAnalytics.framework/Headers/FIRAnalytics+AppDelegate.h /Users/jon_thornburg/Desktop/FireChat/Pods/FirebaseAnalytics/Frameworks/frameworks/FirebaseAnalytics.framework/Headers/FirebaseAnalytics.h /Users/jon_thornburg/Desktop/FireChat/Pods/FirebaseAnalytics/Frameworks/frameworks/FirebaseAnalytics.framework/Modules/module.modulemap /Users/jon_thornburg/Desktop/FireChat/Pods/FirebaseAuth/Frameworks/frameworks/FirebaseAuth.framework/Headers/FIRUserInfo.h /Users/jon_thornburg/Desktop/FireChat/Pods/FirebaseAuth/Frameworks/frameworks/FirebaseAuth.framework/Headers/FIRUser.h /Users/jon_thornburg/Desktop/FireChat/Pods/FirebaseAuth/Frameworks/frameworks/FirebaseAuth.framework/Headers/FIRAuthCredential.h /Users/jon_thornburg/Desktop/FireChat/Pods/FirebaseAuth/Frameworks/frameworks/FirebaseAuth.framework/Headers/FIRAuthErrors.h /Users/jon_thornburg/Desktop/FireChat/Pods/FirebaseAuth/Frameworks/frameworks/FirebaseAuth.framework/Headers/FIRAuth.h /Users/jon_thornburg/Desktop/FireChat/Pods/FirebaseAuth/Frameworks/frameworks/FirebaseAuth.framework/Headers/FIRTwitterAuthProvider.h /Users/jon_thornburg/Desktop/FireChat/Pods/FirebaseAuth/Frameworks/frameworks/FirebaseAuth.framework/Headers/FIRGoogleAuthProvider.h /Users/jon_thornburg/Desktop/FireChat/Pods/FirebaseAuth/Frameworks/frameworks/FirebaseAuth.framework/Headers/FIRGitHubAuthProvider.h /Users/jon_thornburg/Desktop/FireChat/Pods/FirebaseAuth/Frameworks/frameworks/FirebaseAuth.framework/Headers/FIRFacebookAuthProvider.h /Users/jon_thornburg/Desktop/FireChat/Pods/FirebaseAuth/Frameworks/frameworks/FirebaseAuth.framework/Headers/FIREmailPasswordAuthProvider.h /Users/jon_thornburg/Desktop/FireChat/Pods/FirebaseAuth/Frameworks/frameworks/FirebaseAuth.framework/Headers/FirebaseAuth.h /Users/jon_thornburg/Desktop/FireChat/Pods/FirebaseAuth/Frameworks/frameworks/FirebaseAuth.framework/Modules/module.modulemap /Users/jon_thornburg/Desktop/FireChat/Pods/FirebaseDatabase/Frameworks/FirebaseDatabase.framework/Headers/FIRServerValue.h /Users/jon_thornburg/Desktop/FireChat/Pods/FirebaseDatabase/Frameworks/FirebaseDatabase.framework/Headers/FIRTransactionResult.h /Users/jon_thornburg/Desktop/FireChat/Pods/FirebaseDatabase/Frameworks/FirebaseDatabase.framework/Headers/FIRMutableData.h /Users/jon_thornburg/Desktop/FireChat/Pods/FirebaseDatabase/Frameworks/FirebaseDatabase.framework/Headers/FIRDataSnapshot.h /Users/jon_thornburg/Desktop/FireChat/Pods/FirebaseDatabase/Frameworks/FirebaseDatabase.framework/Headers/FIRDataEventType.h /Users/jon_thornburg/Desktop/FireChat/Pods/FirebaseDatabase/Frameworks/FirebaseDatabase.framework/Headers/FIRDatabaseQuery.h /Users/jon_thornburg/Desktop/FireChat/Pods/FirebaseDatabase/Frameworks/FirebaseDatabase.framework/Headers/FIRDatabaseReference.h /Users/jon_thornburg/Desktop/FireChat/Pods/FirebaseDatabase/Frameworks/FirebaseDatabase.framework/Headers/FIRDatabase.h /Users/jon_thornburg/Desktop/FireChat/Pods/FirebaseDatabase/Frameworks/FirebaseDatabase.framework/Headers/FirebaseDatabase.h /Users/jon_thornburg/Desktop/FireChat/Pods/FirebaseDatabase/Frameworks/FirebaseDatabase.framework/Modules/module.modulemap /Users/jon_thornburg/Desktop/FireChat/Pods/FirebaseInstanceID/Frameworks/frameworks/FirebaseInstanceID.framework/Headers/FIRInstanceID.h /Users/jon_thornburg/Desktop/FireChat/Pods/FirebaseInstanceID/Frameworks/frameworks/FirebaseInstanceID.framework/Headers/FirebaseInstanceID.h /Users/jon_thornburg/Desktop/FireChat/Pods/FirebaseInstanceID/Frameworks/frameworks/FirebaseInstanceID.framework/Modules/module.modulemap /Users/jon_thornburg/Desktop/FireChat/Pods/FirebaseStorage/Frameworks/FirebaseStorage.framework/Headers/FIRStorageTaskSnapshot.h /Users/jon_thornburg/Desktop/FireChat/Pods/FirebaseStorage/Frameworks/FirebaseStorage.framework/Headers/FIRStorageUploadTask.h /Users/jon_thornburg/Desktop/FireChat/Pods/FirebaseStorage/Frameworks/FirebaseStorage.framework/Headers/FIRStorageReference.h /Users/jon_thornburg/Desktop/FireChat/Pods/FirebaseStorage/Frameworks/FirebaseStorage.framework/Headers/FIRStorageMetadata.h /Users/jon_thornburg/Desktop/FireChat/Pods/FirebaseStorage/Frameworks/FirebaseStorage.framework/Headers/FIRStorageTask.h /Users/jon_thornburg/Desktop/FireChat/Pods/FirebaseStorage/Frameworks/FirebaseStorage.framework/Headers/FIRStorageObservableTask.h /Users/jon_thornburg/Desktop/FireChat/Pods/FirebaseStorage/Frameworks/FirebaseStorage.framework/Headers/FIRStorageDownloadTask.h /Users/jon_thornburg/Desktop/FireChat/Pods/FirebaseStorage/Frameworks/FirebaseStorage.framework/Headers/FIRStorageConstants.h /Users/jon_thornburg/Desktop/FireChat/Pods/FirebaseStorage/Frameworks/FirebaseStorage.framework/Headers/FIRStorage.h /Users/jon_thornburg/Desktop/FireChat/Pods/FirebaseStorage/Frameworks/FirebaseStorage.framework/Headers/FirebaseStorage.h /Users/jon_thornburg/Desktop/FireChat/Pods/FirebaseStorage/Frameworks/FirebaseStorage.framework/Modules/module.modulemap /Users/jon_thornburg/Desktop/FireChat/Pods/Firebase/Analytics/Sources/Firebase.h /Users/jon_thornburg/Desktop/FireChat/DerivedData/FireChat/Build/Intermediates/FireChat.build/Debug-iphonesimulator/FireChat.build/Objects-normal/x86_64/AppDelegate~partial.swiftmodule : /Users/jon_thornburg/Desktop/FireChat/FireChat/NewMessagesController.swift /Users/jon_thornburg/Desktop/FireChat/FireChat/MessagesController.swift /Users/jon_thornburg/Desktop/FireChat/FireChat/LoginController.swift /Users/jon_thornburg/Desktop/FireChat/FireChat/LoginController\ +\ handlers.swift /Users/jon_thornburg/Desktop/FireChat/FireChat/FirebaseCalls.swift /Users/jon_thornburg/Desktop/FireChat/FireChat/User.swift /Users/jon_thornburg/Desktop/FireChat/FireChat/AppDelegate.swift /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/Foundation.swiftmodule /Users/jon_thornburg/Desktop/FireChat/Pods/Firebase/Analytics/Sources/module.modulemap /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/UIKit.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreImage.swiftmodule /Users/jon_thornburg/Desktop/FireChat/Pods/FirebaseAnalytics/Frameworks/frameworks/FirebaseAnalytics.framework/Headers/FIROptions.h /Users/jon_thornburg/Desktop/FireChat/Pods/FirebaseAnalytics/Frameworks/frameworks/FirebaseAnalytics.framework/Headers/FIRConfiguration.h /Users/jon_thornburg/Desktop/FireChat/Pods/FirebaseAnalytics/Frameworks/frameworks/FirebaseAnalytics.framework/Headers/FIRApp.h /Users/jon_thornburg/Desktop/FireChat/Pods/FirebaseAnalytics/Frameworks/frameworks/FirebaseAnalytics.framework/Headers/FIRAnalyticsConfiguration.h /Users/jon_thornburg/Desktop/FireChat/Pods/FirebaseAnalytics/Frameworks/frameworks/FirebaseAnalytics.framework/Headers/FIRUserPropertyNames.h /Users/jon_thornburg/Desktop/FireChat/Pods/FirebaseAnalytics/Frameworks/frameworks/FirebaseAnalytics.framework/Headers/FIRParameterNames.h /Users/jon_thornburg/Desktop/FireChat/Pods/FirebaseAnalytics/Frameworks/frameworks/FirebaseAnalytics.framework/Headers/FIREventNames.h /Users/jon_thornburg/Desktop/FireChat/Pods/FirebaseAnalytics/Frameworks/frameworks/FirebaseAnalytics.framework/Headers/FIRAnalytics.h /Users/jon_thornburg/Desktop/FireChat/Pods/FirebaseAnalytics/Frameworks/frameworks/FirebaseAnalytics.framework/Headers/FIRAnalytics+AppDelegate.h /Users/jon_thornburg/Desktop/FireChat/Pods/FirebaseAnalytics/Frameworks/frameworks/FirebaseAnalytics.framework/Headers/FirebaseAnalytics.h /Users/jon_thornburg/Desktop/FireChat/Pods/FirebaseAnalytics/Frameworks/frameworks/FirebaseAnalytics.framework/Modules/module.modulemap /Users/jon_thornburg/Desktop/FireChat/Pods/FirebaseAuth/Frameworks/frameworks/FirebaseAuth.framework/Headers/FIRUserInfo.h /Users/jon_thornburg/Desktop/FireChat/Pods/FirebaseAuth/Frameworks/frameworks/FirebaseAuth.framework/Headers/FIRUser.h /Users/jon_thornburg/Desktop/FireChat/Pods/FirebaseAuth/Frameworks/frameworks/FirebaseAuth.framework/Headers/FIRAuthCredential.h /Users/jon_thornburg/Desktop/FireChat/Pods/FirebaseAuth/Frameworks/frameworks/FirebaseAuth.framework/Headers/FIRAuthErrors.h /Users/jon_thornburg/Desktop/FireChat/Pods/FirebaseAuth/Frameworks/frameworks/FirebaseAuth.framework/Headers/FIRAuth.h /Users/jon_thornburg/Desktop/FireChat/Pods/FirebaseAuth/Frameworks/frameworks/FirebaseAuth.framework/Headers/FIRTwitterAuthProvider.h /Users/jon_thornburg/Desktop/FireChat/Pods/FirebaseAuth/Frameworks/frameworks/FirebaseAuth.framework/Headers/FIRGoogleAuthProvider.h /Users/jon_thornburg/Desktop/FireChat/Pods/FirebaseAuth/Frameworks/frameworks/FirebaseAuth.framework/Headers/FIRGitHubAuthProvider.h /Users/jon_thornburg/Desktop/FireChat/Pods/FirebaseAuth/Frameworks/frameworks/FirebaseAuth.framework/Headers/FIRFacebookAuthProvider.h /Users/jon_thornburg/Desktop/FireChat/Pods/FirebaseAuth/Frameworks/frameworks/FirebaseAuth.framework/Headers/FIREmailPasswordAuthProvider.h /Users/jon_thornburg/Desktop/FireChat/Pods/FirebaseAuth/Frameworks/frameworks/FirebaseAuth.framework/Headers/FirebaseAuth.h /Users/jon_thornburg/Desktop/FireChat/Pods/FirebaseAuth/Frameworks/frameworks/FirebaseAuth.framework/Modules/module.modulemap /Users/jon_thornburg/Desktop/FireChat/Pods/FirebaseDatabase/Frameworks/FirebaseDatabase.framework/Headers/FIRServerValue.h /Users/jon_thornburg/Desktop/FireChat/Pods/FirebaseDatabase/Frameworks/FirebaseDatabase.framework/Headers/FIRTransactionResult.h /Users/jon_thornburg/Desktop/FireChat/Pods/FirebaseDatabase/Frameworks/FirebaseDatabase.framework/Headers/FIRMutableData.h /Users/jon_thornburg/Desktop/FireChat/Pods/FirebaseDatabase/Frameworks/FirebaseDatabase.framework/Headers/FIRDataSnapshot.h /Users/jon_thornburg/Desktop/FireChat/Pods/FirebaseDatabase/Frameworks/FirebaseDatabase.framework/Headers/FIRDataEventType.h /Users/jon_thornburg/Desktop/FireChat/Pods/FirebaseDatabase/Frameworks/FirebaseDatabase.framework/Headers/FIRDatabaseQuery.h /Users/jon_thornburg/Desktop/FireChat/Pods/FirebaseDatabase/Frameworks/FirebaseDatabase.framework/Headers/FIRDatabaseReference.h /Users/jon_thornburg/Desktop/FireChat/Pods/FirebaseDatabase/Frameworks/FirebaseDatabase.framework/Headers/FIRDatabase.h /Users/jon_thornburg/Desktop/FireChat/Pods/FirebaseDatabase/Frameworks/FirebaseDatabase.framework/Headers/FirebaseDatabase.h /Users/jon_thornburg/Desktop/FireChat/Pods/FirebaseDatabase/Frameworks/FirebaseDatabase.framework/Modules/module.modulemap /Users/jon_thornburg/Desktop/FireChat/Pods/FirebaseInstanceID/Frameworks/frameworks/FirebaseInstanceID.framework/Headers/FIRInstanceID.h /Users/jon_thornburg/Desktop/FireChat/Pods/FirebaseInstanceID/Frameworks/frameworks/FirebaseInstanceID.framework/Headers/FirebaseInstanceID.h /Users/jon_thornburg/Desktop/FireChat/Pods/FirebaseInstanceID/Frameworks/frameworks/FirebaseInstanceID.framework/Modules/module.modulemap /Users/jon_thornburg/Desktop/FireChat/Pods/FirebaseStorage/Frameworks/FirebaseStorage.framework/Headers/FIRStorageTaskSnapshot.h /Users/jon_thornburg/Desktop/FireChat/Pods/FirebaseStorage/Frameworks/FirebaseStorage.framework/Headers/FIRStorageUploadTask.h /Users/jon_thornburg/Desktop/FireChat/Pods/FirebaseStorage/Frameworks/FirebaseStorage.framework/Headers/FIRStorageReference.h /Users/jon_thornburg/Desktop/FireChat/Pods/FirebaseStorage/Frameworks/FirebaseStorage.framework/Headers/FIRStorageMetadata.h /Users/jon_thornburg/Desktop/FireChat/Pods/FirebaseStorage/Frameworks/FirebaseStorage.framework/Headers/FIRStorageTask.h /Users/jon_thornburg/Desktop/FireChat/Pods/FirebaseStorage/Frameworks/FirebaseStorage.framework/Headers/FIRStorageObservableTask.h /Users/jon_thornburg/Desktop/FireChat/Pods/FirebaseStorage/Frameworks/FirebaseStorage.framework/Headers/FIRStorageDownloadTask.h /Users/jon_thornburg/Desktop/FireChat/Pods/FirebaseStorage/Frameworks/FirebaseStorage.framework/Headers/FIRStorageConstants.h /Users/jon_thornburg/Desktop/FireChat/Pods/FirebaseStorage/Frameworks/FirebaseStorage.framework/Headers/FIRStorage.h /Users/jon_thornburg/Desktop/FireChat/Pods/FirebaseStorage/Frameworks/FirebaseStorage.framework/Headers/FirebaseStorage.h /Users/jon_thornburg/Desktop/FireChat/Pods/FirebaseStorage/Frameworks/FirebaseStorage.framework/Modules/module.modulemap /Users/jon_thornburg/Desktop/FireChat/Pods/Firebase/Analytics/Sources/Firebase.h /Users/jon_thornburg/Desktop/FireChat/DerivedData/FireChat/Build/Intermediates/FireChat.build/Debug-iphonesimulator/FireChat.build/Objects-normal/x86_64/AppDelegate~partial.swiftdoc : /Users/jon_thornburg/Desktop/FireChat/FireChat/NewMessagesController.swift /Users/jon_thornburg/Desktop/FireChat/FireChat/MessagesController.swift /Users/jon_thornburg/Desktop/FireChat/FireChat/LoginController.swift /Users/jon_thornburg/Desktop/FireChat/FireChat/LoginController\ +\ handlers.swift /Users/jon_thornburg/Desktop/FireChat/FireChat/FirebaseCalls.swift /Users/jon_thornburg/Desktop/FireChat/FireChat/User.swift /Users/jon_thornburg/Desktop/FireChat/FireChat/AppDelegate.swift /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/Foundation.swiftmodule /Users/jon_thornburg/Desktop/FireChat/Pods/Firebase/Analytics/Sources/module.modulemap /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/UIKit.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreImage.swiftmodule /Users/jon_thornburg/Desktop/FireChat/Pods/FirebaseAnalytics/Frameworks/frameworks/FirebaseAnalytics.framework/Headers/FIROptions.h /Users/jon_thornburg/Desktop/FireChat/Pods/FirebaseAnalytics/Frameworks/frameworks/FirebaseAnalytics.framework/Headers/FIRConfiguration.h /Users/jon_thornburg/Desktop/FireChat/Pods/FirebaseAnalytics/Frameworks/frameworks/FirebaseAnalytics.framework/Headers/FIRApp.h /Users/jon_thornburg/Desktop/FireChat/Pods/FirebaseAnalytics/Frameworks/frameworks/FirebaseAnalytics.framework/Headers/FIRAnalyticsConfiguration.h /Users/jon_thornburg/Desktop/FireChat/Pods/FirebaseAnalytics/Frameworks/frameworks/FirebaseAnalytics.framework/Headers/FIRUserPropertyNames.h /Users/jon_thornburg/Desktop/FireChat/Pods/FirebaseAnalytics/Frameworks/frameworks/FirebaseAnalytics.framework/Headers/FIRParameterNames.h /Users/jon_thornburg/Desktop/FireChat/Pods/FirebaseAnalytics/Frameworks/frameworks/FirebaseAnalytics.framework/Headers/FIREventNames.h /Users/jon_thornburg/Desktop/FireChat/Pods/FirebaseAnalytics/Frameworks/frameworks/FirebaseAnalytics.framework/Headers/FIRAnalytics.h /Users/jon_thornburg/Desktop/FireChat/Pods/FirebaseAnalytics/Frameworks/frameworks/FirebaseAnalytics.framework/Headers/FIRAnalytics+AppDelegate.h /Users/jon_thornburg/Desktop/FireChat/Pods/FirebaseAnalytics/Frameworks/frameworks/FirebaseAnalytics.framework/Headers/FirebaseAnalytics.h /Users/jon_thornburg/Desktop/FireChat/Pods/FirebaseAnalytics/Frameworks/frameworks/FirebaseAnalytics.framework/Modules/module.modulemap /Users/jon_thornburg/Desktop/FireChat/Pods/FirebaseAuth/Frameworks/frameworks/FirebaseAuth.framework/Headers/FIRUserInfo.h /Users/jon_thornburg/Desktop/FireChat/Pods/FirebaseAuth/Frameworks/frameworks/FirebaseAuth.framework/Headers/FIRUser.h /Users/jon_thornburg/Desktop/FireChat/Pods/FirebaseAuth/Frameworks/frameworks/FirebaseAuth.framework/Headers/FIRAuthCredential.h /Users/jon_thornburg/Desktop/FireChat/Pods/FirebaseAuth/Frameworks/frameworks/FirebaseAuth.framework/Headers/FIRAuthErrors.h /Users/jon_thornburg/Desktop/FireChat/Pods/FirebaseAuth/Frameworks/frameworks/FirebaseAuth.framework/Headers/FIRAuth.h /Users/jon_thornburg/Desktop/FireChat/Pods/FirebaseAuth/Frameworks/frameworks/FirebaseAuth.framework/Headers/FIRTwitterAuthProvider.h /Users/jon_thornburg/Desktop/FireChat/Pods/FirebaseAuth/Frameworks/frameworks/FirebaseAuth.framework/Headers/FIRGoogleAuthProvider.h /Users/jon_thornburg/Desktop/FireChat/Pods/FirebaseAuth/Frameworks/frameworks/FirebaseAuth.framework/Headers/FIRGitHubAuthProvider.h /Users/jon_thornburg/Desktop/FireChat/Pods/FirebaseAuth/Frameworks/frameworks/FirebaseAuth.framework/Headers/FIRFacebookAuthProvider.h /Users/jon_thornburg/Desktop/FireChat/Pods/FirebaseAuth/Frameworks/frameworks/FirebaseAuth.framework/Headers/FIREmailPasswordAuthProvider.h /Users/jon_thornburg/Desktop/FireChat/Pods/FirebaseAuth/Frameworks/frameworks/FirebaseAuth.framework/Headers/FirebaseAuth.h /Users/jon_thornburg/Desktop/FireChat/Pods/FirebaseAuth/Frameworks/frameworks/FirebaseAuth.framework/Modules/module.modulemap /Users/jon_thornburg/Desktop/FireChat/Pods/FirebaseDatabase/Frameworks/FirebaseDatabase.framework/Headers/FIRServerValue.h /Users/jon_thornburg/Desktop/FireChat/Pods/FirebaseDatabase/Frameworks/FirebaseDatabase.framework/Headers/FIRTransactionResult.h /Users/jon_thornburg/Desktop/FireChat/Pods/FirebaseDatabase/Frameworks/FirebaseDatabase.framework/Headers/FIRMutableData.h /Users/jon_thornburg/Desktop/FireChat/Pods/FirebaseDatabase/Frameworks/FirebaseDatabase.framework/Headers/FIRDataSnapshot.h /Users/jon_thornburg/Desktop/FireChat/Pods/FirebaseDatabase/Frameworks/FirebaseDatabase.framework/Headers/FIRDataEventType.h /Users/jon_thornburg/Desktop/FireChat/Pods/FirebaseDatabase/Frameworks/FirebaseDatabase.framework/Headers/FIRDatabaseQuery.h /Users/jon_thornburg/Desktop/FireChat/Pods/FirebaseDatabase/Frameworks/FirebaseDatabase.framework/Headers/FIRDatabaseReference.h /Users/jon_thornburg/Desktop/FireChat/Pods/FirebaseDatabase/Frameworks/FirebaseDatabase.framework/Headers/FIRDatabase.h /Users/jon_thornburg/Desktop/FireChat/Pods/FirebaseDatabase/Frameworks/FirebaseDatabase.framework/Headers/FirebaseDatabase.h /Users/jon_thornburg/Desktop/FireChat/Pods/FirebaseDatabase/Frameworks/FirebaseDatabase.framework/Modules/module.modulemap /Users/jon_thornburg/Desktop/FireChat/Pods/FirebaseInstanceID/Frameworks/frameworks/FirebaseInstanceID.framework/Headers/FIRInstanceID.h /Users/jon_thornburg/Desktop/FireChat/Pods/FirebaseInstanceID/Frameworks/frameworks/FirebaseInstanceID.framework/Headers/FirebaseInstanceID.h /Users/jon_thornburg/Desktop/FireChat/Pods/FirebaseInstanceID/Frameworks/frameworks/FirebaseInstanceID.framework/Modules/module.modulemap /Users/jon_thornburg/Desktop/FireChat/Pods/FirebaseStorage/Frameworks/FirebaseStorage.framework/Headers/FIRStorageTaskSnapshot.h /Users/jon_thornburg/Desktop/FireChat/Pods/FirebaseStorage/Frameworks/FirebaseStorage.framework/Headers/FIRStorageUploadTask.h /Users/jon_thornburg/Desktop/FireChat/Pods/FirebaseStorage/Frameworks/FirebaseStorage.framework/Headers/FIRStorageReference.h /Users/jon_thornburg/Desktop/FireChat/Pods/FirebaseStorage/Frameworks/FirebaseStorage.framework/Headers/FIRStorageMetadata.h /Users/jon_thornburg/Desktop/FireChat/Pods/FirebaseStorage/Frameworks/FirebaseStorage.framework/Headers/FIRStorageTask.h /Users/jon_thornburg/Desktop/FireChat/Pods/FirebaseStorage/Frameworks/FirebaseStorage.framework/Headers/FIRStorageObservableTask.h /Users/jon_thornburg/Desktop/FireChat/Pods/FirebaseStorage/Frameworks/FirebaseStorage.framework/Headers/FIRStorageDownloadTask.h /Users/jon_thornburg/Desktop/FireChat/Pods/FirebaseStorage/Frameworks/FirebaseStorage.framework/Headers/FIRStorageConstants.h /Users/jon_thornburg/Desktop/FireChat/Pods/FirebaseStorage/Frameworks/FirebaseStorage.framework/Headers/FIRStorage.h /Users/jon_thornburg/Desktop/FireChat/Pods/FirebaseStorage/Frameworks/FirebaseStorage.framework/Headers/FirebaseStorage.h /Users/jon_thornburg/Desktop/FireChat/Pods/FirebaseStorage/Frameworks/FirebaseStorage.framework/Modules/module.modulemap /Users/jon_thornburg/Desktop/FireChat/Pods/Firebase/Analytics/Sources/Firebase.h
D
module util.base32; /********************* * Encoding routines. ********************/ /** * Find out the size of the string in base32 given the size * of the data to encode. */ size_t getBase32Size(size_t length) { if (length == 0) { return 0; } return ((length * 8 - 1) / 5) + 1; } size_t encode( bool discardPartial = false, )(const(ubyte)[] data, ubyte[] buffer) in { assert(buffer.length >= getBase32Size(data.length)); } body { return encode!(c => char(c & 0x1f), discardPartial)( data, *(cast(char[]*) &buffer), ); } size_t encode( alias encodeChar, bool discardPartial = false, )(const(ubyte)[] data, char[] buffer) in { assert(buffer.length >= getBase32Size(data.length)); } body { size_t i; void putChar(uint n) { buffer[i++] = encodeChar(n & 0x1f); } while (data.length >= 5) { scope(success) data = data[5 .. $]; uint b0 = *(cast(uint*) data.ptr); uint b1 = *(cast(uint*) (data.ptr + 1)); // Only required on little endian. import core.bitop; b0 = bswap(b0); b1 = bswap(b1); putChar(b0 >> 27); putChar(b0 >> 22); putChar(b0 >> 17); putChar(b0 >> 12); putChar(b1 >> 15); putChar(b1 >> 10); putChar(b1 >> 5); putChar(b1); } // We got a multiple of 5 number of bits to encode, bail early. if (data.length == 0) { return i; } ubyte[7] suffixBuffer; ubyte[] suffix; switch(data.length) { case 1: suffix = suffixBuffer[0 .. 2]; suffix[1] = cast(ubyte) (data[0] << 2); goto Next1; case 2: suffix = suffixBuffer[0 .. 4]; suffix[3] = cast(ubyte) (data[1] << 4); goto Next2; case 3: suffix = suffixBuffer[0 .. 5]; suffix[4] = cast(ubyte) (data[2] << 1); goto Next3; case 4: suffix = suffixBuffer[0 .. 7]; suffix[6] = cast(ubyte) (data[3] << 3); suffix[5] = cast(ubyte) (data[3] >> 2); suffix[4] = cast(ubyte) (data[2] << 1 | data[3] >> 7); goto Next3; Next3: suffix[3] = cast(ubyte) (data[1] << 4 | data[2] >> 4); goto Next2; Next2: suffix[2] = cast(ubyte) (data[1] >> 1); suffix[1] = cast(ubyte) (data[0] << 2 | data[1] >> 6); goto Next1; Next1: suffix[0] = cast(ubyte) (data[0] >> 3); break; default: assert(0); } static if (discardPartial) { suffix = suffix[0 .. $ - 1]; } /** * We run the actual encoding at the end to make sure * getChar calls are made in order. This allow various * checksum computation to be backed in getChar. */ foreach(s; suffix) { putChar(s); } return i; } unittest { void test(const(ubyte)[] data, string expected) { char[128] buffer; auto l = expected.length; auto sbuf = buffer[0 .. l]; assert(encode!getZBase32(data, buffer) == l); assert(sbuf == expected, sbuf ~ " vs " ~ expected); } test([], ""); test([0x00], "yy"); test([0x01], "yr"); test([0x81], "or"); test([0xff], "9h"); test([0x00, 0x00], "yyyy"); test([0xf5, 0x99], "6sco"); test([0xff, 0xff], "999o"); test([0x00, 0x00, 0x00], "yyyyy"); test([0xab, 0xcd, 0xef], "ixg66"); test([0xff, 0xff, 0xff], "99996"); test([0x00, 0x00, 0x00, 0x00], "yyyyyyy"); test([0x89, 0xab, 0xcd, 0xef], "tgih55a"); test([0xff, 0xff, 0xff, 0xff], "999999a"); test([0x00, 0x00, 0x00, 0x00, 0x00], "yyyyyyyy"); test([0x67, 0x89, 0xab, 0xcd, 0xef], "c6r4zuxx"); test([0xff, 0xff, 0xff, 0xff, 0xff], "99999999"); test([0x00, 0x00, 0x00, 0x00, 0x00, 0x00], "yyyyyyyyyy"); test([0x45, 0x67, 0x89, 0xab, 0xcd, 0xef], "eiuauk6p7h"); test([0xff, 0xff, 0xff, 0xff, 0xff, 0xff], "999999999h"); } /** * Support for RFC4648 base32 * * https://tools.ietf.org/html/rfc4648#section-6 */ char getBase32(uint n) in { assert(n == (n & 0x1f)); } body { // As '2' == 26, this should simplify :) auto r = (n < 26) ? 'A' + n : '2' + n - 26; return cast(char) r; } unittest { void test(uint n, char c) { assert(getBase32(n) == c); } test(0, 'A'); test(1, 'B'); test(9, 'J'); test(12, 'M'); test(25, 'Z'); test(26, '2'); test(27, '3'); test(31, '7'); } /** * Support for RFC4648 base32hex * * https://tools.ietf.org/html/rfc4648#section-7 */ char getBase32Hex(uint n) in { assert(n == (n & 0x1f)); } body { auto r = (n < 10) ? '0' + n : 'A' + n - 10; return cast(char) r; } unittest { void test(uint n, char c) { assert(getBase32Hex(n) == c); } test(0, '0'); test(1, '1'); test(4, '4'); test(9, '9'); test(10, 'A'); test(15, 'F'); test(27, 'R'); test(31, 'V'); } /** * Support for zbase32 * * http://philzimmermann.com/docs/human-oriented-base-32-encoding.txt */ char getZBase32(uint n) in { assert(n == (n & 0x1f)); } body { return "ybndrfg8ejkmcpqxot1uwisza345h769".ptr[n]; } unittest { void test(uint n, char c) { assert(getZBase32(n) == c); } test(0, 'y'); test(1, 'b'); test(4, 'r'); test(9, 'j'); test(10, 'k'); test(15, 'x'); test(27, '5'); test(31, '9'); } /** * Support for bech32 * * https://github.com/bitcoin/bips/blob/master/bip-0173.mediawiki#Bech32 */ char getBech32(uint n) in { assert(n == (n & 0x1f)); } body { return "qpzry9x8gf2tvdw0s3jn54khce6mua7l".ptr[n]; } unittest { void test(uint n, char c) { assert(getBech32(n) == c); } test(0, 'q'); test(1, 'p'); test(4, 'y'); test(9, 'f'); test(10, '2'); test(15, '0'); test(27, 'm'); test(31, 'l'); } /********************* * Decoding routines. ********************/ /** * Find out the size of the data given the size * of the string to decode. */ size_t getSizeFromBase32(size_t length) { if (length == 0) { return 0; } return ((length * 5 - 1) / 8) + 1; } size_t decode( bool discardPartial = true, )(const ubyte[] str, ubyte[] data) in { // assert(data.length >= getSizeFromBase32(str.length)); } body { return decode!(c => uint(c))(*( cast(const char[]*) &str), data); } size_t decode( alias decodeChar, bool discardPartial = true, )(const(char)[] str, ubyte[] data) in { // assert(data.length >= getSizeFromBase32(str.length)); } body { size_t i; uint getByte() out(r) { assert(r == (r & 0x1f)); } body { return decodeChar(str[i++]); } // Useful ? /+ while ((str.length - i) >= 8 && data.ptr >= 8) { scope(success) data = data[5 .. $]; auto b0 = getByte(); auto b1 = getByte(); auto b2 = getByte(); auto b3 = getByte(); auto b4 = getByte(); auto b5 = getByte(); auto b6 = getByte(); auto b7 = getByte(); auto n = ((cast(ulong) b0) << 35) | ((cast(ulong) b1) << 30): n |= (b2 << 25) | (b3 << 20) | (b4 << 15); n |= (b5 << 10) | (b6 << 5) | b7; import core.bitop; *(cast(ulong*) data.ptr) = bswap(n << 24); } // +/ // May we are running out of str and we can't patch ulong. while ((str.length - i) >= 8) { scope(success) data = data[5 .. $]; auto c0 = getByte(); auto c1 = getByte(); auto c2 = getByte(); auto c3 = getByte(); auto c4 = getByte(); auto c5 = getByte(); auto c6 = getByte(); auto c7 = getByte(); auto h = (c0 << 3) | (c1 >> 2); data[0] = h & 0xff; auto n = (c1 << 30) | (c2 << 25) | (c3 << 20); n |= (c4 << 15) | (c5 << 10) | (c6 << 5) | c7; import core.bitop; *(cast(uint*) (data.ptr + 1)) = bswap(n); } // If we are done, bail out ! if (str.length == i) { return i; } ubyte[5] suffixBuffer; ubyte[] suffix; auto suffixSize = str.length - i; switch (suffixSize) { case 1: suffix = suffixBuffer[0 .. 1]; suffix[0] = (getByte() << 3) & 0x1f; break; case 2: suffix = suffixBuffer[0 .. 2]; auto c0 = getByte(); auto c1 = getByte(); auto n = (c0 << 27) | (c1 << 22); import core.bitop; *(cast(ushort*) suffix.ptr) = bswap(n) & 0xffff; break; case 3: suffix = suffixBuffer[0 .. 2]; auto c0 = getByte(); auto c1 = getByte(); auto c2 = getByte(); auto n = (c0 << 27) | (c1 << 22) | (c2 << 17); import core.bitop; *(cast(ushort*) suffix.ptr) = bswap(n) & 0xffff; break; case 4: suffix = suffixBuffer[0 .. 3]; auto c0 = getByte(); auto c1 = getByte(); auto c2 = getByte(); auto c3 = getByte(); auto h = (c0 << 3) | (c1 >> 2); suffix[0] = h & 0xff; auto n = (c1 << 30) | (c2 << 25) | (c3 << 20); import core.bitop; *(cast(ushort*) (suffix.ptr + 1)) = bswap(n) & 0xffff; break; case 5: suffix = suffixBuffer[0 .. 4]; auto c0 = getByte(); auto c1 = getByte(); auto c2 = getByte(); auto c3 = getByte(); auto c4 = getByte(); auto n = (c0 << 27) | (c1 << 22); n |= (c2 << 17) | (c3 << 12) | (c4 << 7); import core.bitop; *(cast(uint*) suffix.ptr) = bswap(n); break; case 6: suffix = suffixBuffer[0 .. 4]; auto c0 = getByte(); auto c1 = getByte(); auto c2 = getByte(); auto c3 = getByte(); auto c4 = getByte(); auto c5 = getByte(); auto n = (c0 << 27) | (c1 << 22) | (c2 << 17); n |= (c3 << 12) | (c4 << 7) | (c4 << 2); import core.bitop; *(cast(uint*) suffix.ptr) = bswap(n); break; case 7: suffix = suffixBuffer[0 .. 5]; auto c0 = getByte(); auto c1 = getByte(); auto c2 = getByte(); auto c3 = getByte(); auto c4 = getByte(); auto c5 = getByte(); auto c6 = getByte(); auto h = (c0 << 3) | (c1 >> 2); suffix[0] = h & 0xff; auto n = (c1 << 30) | (c2 << 25) | (c3 << 20); n |= (c4 << 15) | (c5 << 10) | (c6 << 5); import core.bitop; *(cast(uint*) (suffix.ptr + 1)) = bswap(n); break; default: assert(0); } static if (discardPartial) { suffix = suffix[0 .. $ - 1]; } import core.stdc.string; memcpy(data.ptr, suffix.ptr, suffix.length); return i; } unittest { void test(const(ubyte)[] expected, string str) { ubyte[128] buffer; auto l = expected.length; auto sbuf = buffer[0 .. l]; assert(decode!getFromZBase32(str, sbuf) == str.length); import std.conv; assert(sbuf == expected, sbuf.to!string() ~ " vs " ~ expected.to!string()); } test([], ""); test([0x00], "yy"); test([0x01], "yr"); test([0x81], "or"); test([0xff], "9h"); test([0x00, 0x00], "yyyy"); test([0xf5, 0x99], "6sco"); test([0xff, 0xff], "999o"); test([0x00, 0x00, 0x00], "yyyyy"); test([0xab, 0xcd, 0xef], "ixg66"); test([0xff, 0xff, 0xff], "99996"); test([0x00, 0x00, 0x00, 0x00], "yyyyyyy"); test([0x89, 0xab, 0xcd, 0xef], "tgih55a"); test([0xff, 0xff, 0xff, 0xff], "999999a"); test([0x00, 0x00, 0x00, 0x00, 0x00], "yyyyyyyy"); test([0x67, 0x89, 0xab, 0xcd, 0xef], "c6r4zuxx"); test([0xff, 0xff, 0xff, 0xff, 0xff], "99999999"); test([0x00, 0x00, 0x00, 0x00, 0x00, 0x00], "yyyyyyyyyy"); test([0x45, 0x67, 0x89, 0xab, 0xcd, 0xef], "eiuauk6p7h"); test([0xff, 0xff, 0xff, 0xff, 0xff, 0xff], "999999999h"); } /** * Support for RFC4648 base32 * * https://tools.ietf.org/html/rfc4648#section-6 */ uint getFromBase32(char n) out(r) { assert(r == (r & 0x1f)); } body { // We do not really care about the case here. uint l = (n | 0x20) - 'a'; if (l < 26) { return l; } // As '2' == 26, this should simplify :) uint d = n - '2'; if (d < 8) { return d + 26; } throw new Exception("Invalid input " ~ n); } unittest { void test(uint n, char c) { assert(getFromBase32(c) == n); } test(0, 'A'); test(1, 'B'); test(9, 'J'); test(12, 'M'); test(25, 'Z'); test(0, 'a'); test(1, 'b'); test(9, 'j'); test(12, 'm'); test(25, 'z'); test(26, '2'); test(27, '3'); test(31, '7'); } /** * Support for RFC4648 base32hex * * https://tools.ietf.org/html/rfc4648#section-7 */ uint getFromBase32Hex(char c) out(r) { assert(r == (r & 0x1f)); } body { uint n = c - '0'; if (n < 10) { return n; } // We do not really care about the case here. uint l = (c | 0x20) - 'a'; if (l < 22) { return l + 10; } throw new Exception("Invalid input " ~ c); } unittest { void test(uint n, char c) { assert(getFromBase32Hex(c) == n); } test(0, '0'); test(1, '1'); test(4, '4'); test(9, '9'); test(10, 'A'); test(15, 'F'); test(27, 'R'); test(31, 'V'); test(10, 'a'); test(15, 'f'); test(27, 'r'); test(31, 'v'); } /** * Support for zbase32 * * http://philzimmermann.com/docs/human-oriented-base-32-encoding.txt */ uint getFromZBase32(char c) out(r) { assert(r == (r & 0x1f)); } body { enum Table = buildCaseInsensitiveTruthTable!getZBase32(); auto n = Table[c]; if (n != (n & 0x1f)) { throw new Exception("Invalid input " ~ c); } return n; } unittest { void test(uint n, char c) { assert(getFromZBase32(c) == n); } test(0, 'y'); test(1, 'b'); test(4, 'r'); test(9, 'j'); test(10, 'k'); test(15, 'x'); test(27, '5'); test(31, '9'); test(0, 'Y'); test(1, 'B'); test(4, 'R'); test(9, 'J'); test(10, 'K'); test(15, 'X'); } /** * Support for bech32 * * https://github.com/bitcoin/bips/blob/master/bip-0173.mediawiki#Bech32 */ uint getFromBech32(char c) out(r) { assert(r == (r & 0x1f)); } body { enum Table = buildCaseInsensitiveTruthTable!getBech32(); auto n = Table[c]; if (n != (n & 0x1f)) { throw new Exception("Invalid input " ~ c); } return n; } unittest { void test(uint n, char c) { assert(getFromBech32(c) == n); } test(0, 'q'); test(1, 'p'); test(4, 'y'); test(9, 'f'); test(10, '2'); test(15, '0'); test(27, 'm'); test(31, 'l'); test(0, 'Q'); test(1, 'P'); test(4, 'Y'); test(9, 'F'); test(27, 'M'); test(31, 'L'); } private auto buildTruthTable(alias getChar)() { ubyte[256] table; foreach (i; 0 .. 256) { table[i] = 0xff; } foreach (ubyte i; 0 .. 32) { table[getChar(i)] = i; } return table; } private auto buildCaseInsensitiveTruthTable(alias getChar)() { ubyte[256] table = buildTruthTable!getChar(); foreach (C; 'A' .. 'Z') { auto c = C | 0x20; if (table[c] != 0xff && table[C] == 0xff) { table[C] = table[c]; } else if (table[c] == 0xff && table[C] != 0xff) { table[c] = table[C]; } } return table; }
D
#!/usr/bin/rdmd /** Unit testing framework ('dunit') * * Allows to define unittests simply as methods which names start * with 'test'. * The only thing necessary to create a unit test class, is to * declare the mixin TestMixin inside the class. This will register * the class and its test methods for the test runner. * * License: <a href="http://www.boost.org/LICENSE_1_0.txt">Boost License 1.0</a>. * Authors: Juan Manuel Cabo * Version: 0.6 * Source: dunit.d * Last update: 2012-03-21 */ /* Copyright Juan Manuel Cabo 2012. * 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 ExampleTests; import std.stdio, std.string; import core.thread; import dunit; //Minimal example: class ATestClass { mixin TestMixin; void testExample() { assertEquals("bla", "b"~"la"); } } /** * Look!! no test base class needed!! */ class AbcTest { //This declaration here is the only thing needed to mark a class //as a unit test class: mixin TestMixin; //Variable members that start with 'test' are allowed. public int testN = 3; public int testM = 4; //Any method whose name starts with 'test' is run as a unit test: //(NOTE: this is bound at compile time, there is no overhead). public void test1() { assert(true); } public void test2() { //You can use D's assert() function: assert(1 == 2 / 2); //Or dunit convenience asserts (just edit dunit.d to add more): assertEquals(1, 2/2); //The expected and actual values will be shown in the output: assertEquals("my string looks dazzling", "my dtring looks sazzling"); } //Test methods with default arguments work, as long as they can //be called without arguments, ie: as testDefaultArguments() for instance: public void testDefaultArguments(int a=4, int b=3) { } //Even if the method is private to the unit test class, it is still run. private void test5(int a=4) { } //This test was disabled just by adding an underscore to the name: public void _testAnother() { assert(false, "fails"); } //Optional initialization and de-initialization. // setUp() and tearDown() are called around each individual test. // setUpClass() and tearDownClass() are called once around the whole unit test. public void setUp() { } public void tearDown() { } public void setUpClass() { } public void tearDownClass() { } } class DerivedTest : AbcTest { mixin TestMixin; //Base class tests will be run!!!!!! // //You can for instance override setUpClass() and change the target //implementation of a family of classes that you are testing. // //For instance: Run a set of tests against all derived classes of //the Stream class. You do this by keeping all the tests in a parent //test class, and creating a derived TestFixture for each one, //that all it has to do is instantiate the instance under test in the //overriden setUpClass(). } /** * You can write asynchronous tests too!! Test those socket listeners of * yours, or your active thread objects, etc.!! */ class AsynchronousTestExample { mixin TestMixin; Thread theThread; bool threadDidItsThing; //Prepare the test: void setUp() { threadDidItsThing = false; theThread = new Thread(&threadFunction); } //Cleanup: void tearDown() { theThread.join(); theThread = null; } void threadFunction() { threadDidItsThing = true; } void testThreadActuallyRuns() { assertEquals(false, threadDidItsThing); //Start the thread theThread.start(); //Assert that within a period of time (500ms by default), the variable //threadDidItsThing gets toggled: assertWithTimeout({return threadDidItsThing;}); } } version = DUnit; version(DUnit) { //-All you need to run the tests, is to declare // // mixin DUnitMain. // //-You can alternatively call // // dunit.runTests_Progress(); for java style results // output (SHOWS COLORS IF IN UNIX !!!) // or // dunit.runTests_Tree(); for a more verbose output // //from your main function. mixin DUnitMain; //void main() {dunit.runTests_Tree();} } else { int main (string[] args) { writeln("production"); } } /* * Alternatively, you can run your DUnit tests when passing -unittest * to the compiler. This only needs to be declared once for the whole * application, and will run all the DUnit tests in all modules before the * application starts: */ unittest { dunit.runTests(); } /* Run this file with (works in Windows/Linux): dmd exampleTests.d dunit.d ./exampleTests The output will be (java style): ...F....F... There were 2 failures: 1) test2(AbcTest)core.exception.AssertError@exampleTests.d(61): Expected: 'my string looks dazzling', but was: 'my dtring looks sazzling' 2) test2(DerivedTest)core.exception.AssertError@exampleTests.d(61): Expected: 'my string looks dazzling', but was: 'my dtring looks sazzling' FAILURES!!! Tests run: 10, Failures: 2, Errors: 0 If you use the more verbose method dunit.runTests_Tree(), then the output is: Unit tests: ATestClass OK: 0.01 ms testExample() AbcTest OK: 0.00 ms test1() FAILED: test2(): core.exception.AssertError@exampleTests.d(62): Expected: 'my string looks dazzling', but was: 'my dtring looks sazzling' OK: 0.00 ms testDefaultArguments() OK: 0.00 ms test5() DerivedTest OK: 0.01 ms test1() FAILED: test2(): core.exception.AssertError@exampleTests.d(62): Expected: 'my string looks dazzling', but was: 'my dtring looks sazzling' OK: 0.00 ms testDefaultArguments() OK: 0.00 ms test5() AsynchronousTestExample OK: 11.00 ms testThreadActuallyRuns() HAVE FUN! */
D
a sleeveless dress resembling an apron
D
/* * Copyright (C) 2015 Google Inc. * * 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. */ package benchmarks.regression; import java.net.IDN; public class IdnBenchmark { public void timeToUnicode(int reps) { for (int i = 0; i < reps; i++) { IDN.toASCII("fass.de"); IDN.toASCII("faß.de"); IDN.toASCII("fäß.de"); IDN.toASCII("a\u200Cb"); IDN.toASCII("öbb.at"); IDN.toASCII("abc・日本.co.jp"); IDN.toASCII("日本.co.jp"); IDN.toASCII("x\u0327\u0301.de"); IDN.toASCII("σόλοσ.gr"); } } public void timeToAscii(int reps) { for (int i = 0; i < reps; i++) { IDN.toUnicode("xn--fss-qla.de"); IDN.toUnicode("xn--n00d.com"); IDN.toUnicode("xn--bb-eka.at"); IDN.toUnicode("xn--og-09a.de"); IDN.toUnicode("xn--53h.de"); IDN.toUnicode("xn--iny-zx5a.de"); IDN.toUnicode("xn--abc-rs4b422ycvb.co.jp"); IDN.toUnicode("xn--wgv71a.co.jp"); IDN.toUnicode("xn--x-xbb7i.de"); IDN.toUnicode("xn--wxaikc6b.gr"); IDN.toUnicode("xn--wxaikc6b.xn--gr-gtd9a1b0g.de"); } } }
D
module org.serviio.upnp.service.contentdirectory.command.image.ListImagePlaylistsCommand; import org.serviio.library.entities.AccessGroup; import org.serviio.library.metadata.MediaFileType; import org.serviio.profile.Profile; import org.serviio.upnp.service.contentdirectory.ObjectType; import org.serviio.upnp.service.contentdirectory.classes.ObjectClassType; import org.serviio.upnp.service.contentdirectory.command.AbstractListPlaylistsCommand; public class ListImagePlaylistsCommand : AbstractListPlaylistsCommand { public this(String objectId, ObjectType objectType, ObjectClassType containerClassType, ObjectClassType itemClassType, Profile rendererProfile, AccessGroup accessGroup, String idPrefix, int startIndex, int count) { super(objectId, objectType, containerClassType, itemClassType, rendererProfile, accessGroup, idPrefix, startIndex, count, MediaFileType.IMAGE); } } /* Location: D:\Program Files\Serviio\lib\serviio.jar * Qualified Name: org.serviio.upnp.service.contentdirectory.command.image.ListImagePlaylistsCommand * JD-Core Version: 0.6.2 */
D
<?xml version="1.0" encoding="ASCII" standalone="no"?> <di:SashWindowsMngr xmlns:di="http://www.eclipse.org/papyrus/0.7.0/sashdi" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmi:version="2.0"> <pageList> <availablePage> <emfPageIdentifier href="VAR_1_BeT-9932816587.notation#_copSALmGEeKQQp7P9cQvNQ"/> </availablePage> </pageList> <sashModel currentSelection="//@sashModel/@windows.0/@children.0"> <windows> <children xsi:type="di:TabFolder"> <children> <emfPageIdentifier href="VAR_1_BeT-9932816587.notation#_copSALmGEeKQQp7P9cQvNQ"/> </children> </children> </windows> </sashModel> </di:SashWindowsMngr>
D
/** * Contains TelegramInputTextMessageContent */ module tg.inline.types.telegram_input_text_message_content; import tg.core.type, tg.core.exception, tg.core.array; import std.json, tg.type; /** * Represents the content of a text message to be sent as the result of an inline query. */ class TelegramInputTextMessageContent : TelegramType { /** * Creates new type object */ nothrow pure public this () @safe { _message_text = ""; _parse_mode = ""; _entities = null; _disable_web_page_preview = false; } /** Add constructor with data init from response */ mixin(TelegramTypeConstructor); override public void setFromJson (JSONValue data) { if ( "message_text" !in data ) throw new TelegramException("Could not find reqired entry : message_text"); _message_text = data["message_text"].str(); if ( "parse_mode" in data ) _parse_mode = data["parse_mode"].str(); if ( "entities" in data ) _entities = toTelegram!TelegramMessageEntity(data["entities"]); if ( "disable_web_page_preview" in data ) _disable_web_page_preview = data["disable_web_page_preview"].boolean(); } override public JSONValue getAsJson () { JSONValue data = parseJSON(""); data["message_text"] = _message_text; if ( _parse_mode != "" ) data["parse_mode"] = _parse_mode; if ( _entities !is null ) data["entities"] = _entities.getAsJson(); data["disable_web_page_preview"] = _disable_web_page_preview; return data; } /** Text of the message to be sent, 1-4096 characters */ private string _message_text; /** * Getter for '_message_text' * Returns: Current value of '_message_text' */ @property string messageText () { return _message_text; } /** * Setter for '_message_text' * Params: messageTextNew = New value of '_message_text' * Returns: New value of '_message_text' */ @property string messageText ( string messageTextNew ) { return _message_text = messageTextNew; } /** <em>Optional</em>. Mode for parsing entities in the message text. See formatting options for more details. */ private string _parse_mode; /** * Getter for '_parse_mode' * Returns: Current value of '_parse_mode' */ @property string parseMode () { return _parse_mode; } /** * Setter for '_parse_mode' * Params: parseModeNew = New value of '_parse_mode' * Returns: New value of '_parse_mode' */ @property string parseMode ( string parseModeNew ) { return _parse_mode = parseModeNew; } /** <em>Optional</em>. List of special entities that appear in message text, which can be specified instead of <em>parse_mode</em> */ private TelegramMessageEntity[] _entities; /** * Getter for '_entities' * Returns: Current value of '_entities' */ @property TelegramMessageEntity[] entities () { return _entities; } /** * Setter for '_entities' * Params: entitiesNew = New value of '_entities' * Returns: New value of '_entities' */ @property TelegramMessageEntity[] entities ( TelegramMessageEntity[] entitiesNew ) { return _entities = entitiesNew; } /** <em>Optional</em>. Disables link previews for links in the sent message */ private bool _disable_web_page_preview; /** * Getter for '_disable_web_page_preview' * Returns: Current value of '_disable_web_page_preview' */ @property bool disableWebPagePreview () { return _disable_web_page_preview; } /** * Setter for '_disable_web_page_preview' * Params: disableWebPagePreviewNew = New value of '_disable_web_page_preview' * Returns: New value of '_disable_web_page_preview' */ @property bool disableWebPagePreview ( bool disableWebPagePreviewNew ) { return _disable_web_page_preview = disableWebPagePreviewNew; } }
D
 module std.stdint; public import rt.core.stdc.stdint;
D
/Users/suhapattabanoglu/Documents/Libraries/RWPickFlavor/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/Alamofire.build/Objects-normal/x86_64/MultipartFormData.o : /Users/suhapattabanoglu/Documents/Libraries/RWPickFlavor/Pods/Alamofire/Source/MultipartFormData.swift /Users/suhapattabanoglu/Documents/Libraries/RWPickFlavor/Pods/Alamofire/Source/Timeline.swift /Users/suhapattabanoglu/Documents/Libraries/RWPickFlavor/Pods/Alamofire/Source/DispatchQueue+Alamofire.swift /Users/suhapattabanoglu/Documents/Libraries/RWPickFlavor/Pods/Alamofire/Source/Alamofire.swift /Users/suhapattabanoglu/Documents/Libraries/RWPickFlavor/Pods/Alamofire/Source/Response.swift /Users/suhapattabanoglu/Documents/Libraries/RWPickFlavor/Pods/Alamofire/Source/TaskDelegate.swift /Users/suhapattabanoglu/Documents/Libraries/RWPickFlavor/Pods/Alamofire/Source/SessionDelegate.swift /Users/suhapattabanoglu/Documents/Libraries/RWPickFlavor/Pods/Alamofire/Source/ParameterEncoding.swift /Users/suhapattabanoglu/Documents/Libraries/RWPickFlavor/Pods/Alamofire/Source/Validation.swift /Users/suhapattabanoglu/Documents/Libraries/RWPickFlavor/Pods/Alamofire/Source/ResponseSerialization.swift /Users/suhapattabanoglu/Documents/Libraries/RWPickFlavor/Pods/Alamofire/Source/SessionManager.swift /Users/suhapattabanoglu/Documents/Libraries/RWPickFlavor/Pods/Alamofire/Source/NetworkReachabilityManager.swift /Users/suhapattabanoglu/Documents/Libraries/RWPickFlavor/Pods/Alamofire/Source/AFError.swift /Users/suhapattabanoglu/Documents/Libraries/RWPickFlavor/Pods/Alamofire/Source/Notifications.swift /Users/suhapattabanoglu/Documents/Libraries/RWPickFlavor/Pods/Alamofire/Source/Result.swift /Users/suhapattabanoglu/Documents/Libraries/RWPickFlavor/Pods/Alamofire/Source/Request.swift /Users/suhapattabanoglu/Documents/Libraries/RWPickFlavor/Pods/Alamofire/Source/ServerTrustPolicy.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/suhapattabanoglu/Documents/Libraries/RWPickFlavor/Pods/Headers/Public/Alamofire/Alamofire-umbrella.h /Users/suhapattabanoglu/Documents/Libraries/RWPickFlavor/Pods/Headers/Public/Alamofire/Alamofire.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/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/suhapattabanoglu/Documents/Libraries/RWPickFlavor/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/Alamofire.build/Objects-normal/x86_64/MultipartFormData~partial.swiftmodule : /Users/suhapattabanoglu/Documents/Libraries/RWPickFlavor/Pods/Alamofire/Source/MultipartFormData.swift /Users/suhapattabanoglu/Documents/Libraries/RWPickFlavor/Pods/Alamofire/Source/Timeline.swift /Users/suhapattabanoglu/Documents/Libraries/RWPickFlavor/Pods/Alamofire/Source/DispatchQueue+Alamofire.swift /Users/suhapattabanoglu/Documents/Libraries/RWPickFlavor/Pods/Alamofire/Source/Alamofire.swift /Users/suhapattabanoglu/Documents/Libraries/RWPickFlavor/Pods/Alamofire/Source/Response.swift /Users/suhapattabanoglu/Documents/Libraries/RWPickFlavor/Pods/Alamofire/Source/TaskDelegate.swift /Users/suhapattabanoglu/Documents/Libraries/RWPickFlavor/Pods/Alamofire/Source/SessionDelegate.swift /Users/suhapattabanoglu/Documents/Libraries/RWPickFlavor/Pods/Alamofire/Source/ParameterEncoding.swift /Users/suhapattabanoglu/Documents/Libraries/RWPickFlavor/Pods/Alamofire/Source/Validation.swift /Users/suhapattabanoglu/Documents/Libraries/RWPickFlavor/Pods/Alamofire/Source/ResponseSerialization.swift /Users/suhapattabanoglu/Documents/Libraries/RWPickFlavor/Pods/Alamofire/Source/SessionManager.swift /Users/suhapattabanoglu/Documents/Libraries/RWPickFlavor/Pods/Alamofire/Source/NetworkReachabilityManager.swift /Users/suhapattabanoglu/Documents/Libraries/RWPickFlavor/Pods/Alamofire/Source/AFError.swift /Users/suhapattabanoglu/Documents/Libraries/RWPickFlavor/Pods/Alamofire/Source/Notifications.swift /Users/suhapattabanoglu/Documents/Libraries/RWPickFlavor/Pods/Alamofire/Source/Result.swift /Users/suhapattabanoglu/Documents/Libraries/RWPickFlavor/Pods/Alamofire/Source/Request.swift /Users/suhapattabanoglu/Documents/Libraries/RWPickFlavor/Pods/Alamofire/Source/ServerTrustPolicy.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/suhapattabanoglu/Documents/Libraries/RWPickFlavor/Pods/Headers/Public/Alamofire/Alamofire-umbrella.h /Users/suhapattabanoglu/Documents/Libraries/RWPickFlavor/Pods/Headers/Public/Alamofire/Alamofire.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/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/suhapattabanoglu/Documents/Libraries/RWPickFlavor/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/Alamofire.build/Objects-normal/x86_64/MultipartFormData~partial.swiftdoc : /Users/suhapattabanoglu/Documents/Libraries/RWPickFlavor/Pods/Alamofire/Source/MultipartFormData.swift /Users/suhapattabanoglu/Documents/Libraries/RWPickFlavor/Pods/Alamofire/Source/Timeline.swift /Users/suhapattabanoglu/Documents/Libraries/RWPickFlavor/Pods/Alamofire/Source/DispatchQueue+Alamofire.swift /Users/suhapattabanoglu/Documents/Libraries/RWPickFlavor/Pods/Alamofire/Source/Alamofire.swift /Users/suhapattabanoglu/Documents/Libraries/RWPickFlavor/Pods/Alamofire/Source/Response.swift /Users/suhapattabanoglu/Documents/Libraries/RWPickFlavor/Pods/Alamofire/Source/TaskDelegate.swift /Users/suhapattabanoglu/Documents/Libraries/RWPickFlavor/Pods/Alamofire/Source/SessionDelegate.swift /Users/suhapattabanoglu/Documents/Libraries/RWPickFlavor/Pods/Alamofire/Source/ParameterEncoding.swift /Users/suhapattabanoglu/Documents/Libraries/RWPickFlavor/Pods/Alamofire/Source/Validation.swift /Users/suhapattabanoglu/Documents/Libraries/RWPickFlavor/Pods/Alamofire/Source/ResponseSerialization.swift /Users/suhapattabanoglu/Documents/Libraries/RWPickFlavor/Pods/Alamofire/Source/SessionManager.swift /Users/suhapattabanoglu/Documents/Libraries/RWPickFlavor/Pods/Alamofire/Source/NetworkReachabilityManager.swift /Users/suhapattabanoglu/Documents/Libraries/RWPickFlavor/Pods/Alamofire/Source/AFError.swift /Users/suhapattabanoglu/Documents/Libraries/RWPickFlavor/Pods/Alamofire/Source/Notifications.swift /Users/suhapattabanoglu/Documents/Libraries/RWPickFlavor/Pods/Alamofire/Source/Result.swift /Users/suhapattabanoglu/Documents/Libraries/RWPickFlavor/Pods/Alamofire/Source/Request.swift /Users/suhapattabanoglu/Documents/Libraries/RWPickFlavor/Pods/Alamofire/Source/ServerTrustPolicy.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/suhapattabanoglu/Documents/Libraries/RWPickFlavor/Pods/Headers/Public/Alamofire/Alamofire-umbrella.h /Users/suhapattabanoglu/Documents/Libraries/RWPickFlavor/Pods/Headers/Public/Alamofire/Alamofire.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/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
/Users/nice/HelloWord/.build/x86_64-apple-macosx10.10/debug/Vapor.build/Request/HTTPMethod+String.swift.o : /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/Utilities/FileIO.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/Content/FormDataCoder+HTTP.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/Sessions/SessionData.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/Utilities/Thread.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/Content/URLEncoded.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/Deprecated.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/Commands/ServeCommand.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/Commands/RoutesCommand.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/Commands/BootCommand.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/Routing/Router+Method.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/Sessions/SessionCache.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/Response/ResponseCodable.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/Request/RequestCodable.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/Routing/Router+Middleware.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/Middleware/Middleware.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/Middleware/CORSMiddleware.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/Middleware/FileMiddleware.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/Middleware/DateMiddleware.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/Middleware/ErrorMiddleware.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/Sessions/SessionsMiddleware.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/Routing/Router+LazyMiddleware.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/Response/Response.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/Utilities/AnyResponse.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/Middleware/MiddlewareConfig.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/Server/NIOServerConfig.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/Sessions/SessionsConfig.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/Content/ContentConfig.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/Request/HTTPMethod+String.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/Routing/Router+Path.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/Content/JSONCoder+Custom.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/Sessions/Request+Session.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/Sessions/Session.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/Application.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/Routing/RouteCollection.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/Routing/Router+Function.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/Services/VaporProvider.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/Response/Responder.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/Response/BasicResponder.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/Response/ApplicationResponder.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/WebSocket/WebSocketResponder.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/Content/PlaintextEncoder.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/Content/HTTPMessageContainer.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/Routing/ParametersContainer.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/Content/ContentContainer.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/Content/QueryContainer.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/Routing/Router.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/Routing/EngineRouter.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/Server/Server.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/Server/NIOServer.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/Server/RunningServer.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/WebSocket/WebSocketServer.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/WebSocket/NIOWebSocketServer.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/Error/Error.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/Logging/Logger+LogError.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/Error/AbortError.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/Sessions/Sessions.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/Sessions/KeyedCacheSessions.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/Sessions/MemorySessions.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/Content/ContentCoders.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/Utilities/Exports.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/Response/HTTPStatus.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/Response/Redirect.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/Content/SingleValueGet.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/Services/Config+Default.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/Commands/CommandConfig+Default.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/Services/Services+Default.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/Client/Client.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/Client/FoundationClient.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/WebSocket/WebSocketClient.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/WebSocket/NIOWebSocketClient.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/Routing/Router+Content.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/Content/Content.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/Error/Abort.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/Request/Request.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/View/Vapor+View.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Dispatch.apinotesc /Users/nice/HelloWord/.build/x86_64-apple-macosx10.10/debug/NIOHTTP1.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/ObjectiveC.swiftmodule /Users/nice/HelloWord/.build/x86_64-apple-macosx10.10/debug/NIOOpenSSL.swiftmodule /Users/nice/HelloWord/.build/x86_64-apple-macosx10.10/debug/NIO.swiftmodule /Users/nice/HelloWord/.build/x86_64-apple-macosx10.10/debug/HTTP.swiftmodule /Users/nice/HelloWord/.build/x86_64-apple-macosx10.10/debug/NIOTLS.swiftmodule /Users/nice/HelloWord/.build/x86_64-apple-macosx10.10/debug/Async.swiftmodule /Users/nice/HelloWord/.build/x86_64-apple-macosx10.10/debug/Command.swiftmodule /Users/nice/HelloWord/.build/x86_64-apple-macosx10.10/debug/Service.swiftmodule /Users/nice/HelloWord/.build/x86_64-apple-macosx10.10/debug/Console.swiftmodule /Users/nice/HelloWord/.build/x86_64-apple-macosx10.10/debug/Core.swiftmodule /Users/nice/HelloWord/.build/x86_64-apple-macosx10.10/debug/Logging.swiftmodule /Users/nice/HelloWord/.build/x86_64-apple-macosx10.10/debug/Debugging.swiftmodule /Users/nice/HelloWord/.build/x86_64-apple-macosx10.10/debug/Routing.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Dispatch.swiftmodule /Users/nice/HelloWord/.build/x86_64-apple-macosx10.10/debug/COperatingSystem.swiftmodule /Users/nice/HelloWord/.build/x86_64-apple-macosx10.10/debug/Random.swiftmodule /Users/nice/HelloWord/.build/x86_64-apple-macosx10.10/debug/URLEncodedForm.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Darwin.swiftmodule /Users/nice/HelloWord/.build/x86_64-apple-macosx10.10/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/nice/HelloWord/.build/x86_64-apple-macosx10.10/debug/Crypto.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/CoreGraphics.swiftmodule /Users/nice/HelloWord/.build/x86_64-apple-macosx10.10/debug/NIOConcurrencyHelpers.swiftmodule /Users/nice/HelloWord/.build/x86_64-apple-macosx10.10/debug/Bits.swiftmodule /Users/nice/HelloWord/.build/x86_64-apple-macosx10.10/debug/NIOFoundationCompat.swiftmodule /Users/nice/HelloWord/.build/x86_64-apple-macosx10.10/debug/WebSocket.swiftmodule /Users/nice/HelloWord/.build/x86_64-apple-macosx10.10/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/nice/HelloWord/.build/x86_64-apple-macosx10.10/debug/DatabaseKit.swiftmodule /Users/nice/HelloWord/.build/x86_64-apple-macosx10.10/debug/TemplateKit.swiftmodule /Users/nice/HelloWord/.build/x86_64-apple-macosx10.10/debug/Multipart.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/SwiftOnoneSupport.swiftmodule /Users/nice/HelloWord/.build/checkouts/swift-nio.git-5005363973595484456/Sources/CNIOSHA1/include/c_nio_sha1.h /usr/local/Cellar/libressl/2.7.4/include/openssl/asn1.h /usr/local/Cellar/libressl/2.7.4/include/openssl/tls1.h /usr/local/Cellar/libressl/2.7.4/include/openssl/dtls1.h /usr/local/Cellar/libressl/2.7.4/include/openssl/pkcs12.h /usr/local/Cellar/libressl/2.7.4/include/openssl/ssl2.h /usr/local/Cellar/libressl/2.7.4/include/openssl/pem2.h /usr/local/Cellar/libressl/2.7.4/include/openssl/ssl23.h /usr/local/Cellar/libressl/2.7.4/include/openssl/ssl3.h /usr/local/Cellar/libressl/2.7.4/include/openssl/x509v3.h /usr/local/Cellar/libressl/2.7.4/include/openssl/md5.h /usr/local/Cellar/libressl/2.7.4/include/openssl/pkcs7.h /usr/local/Cellar/libressl/2.7.4/include/openssl/x509.h /usr/local/Cellar/libressl/2.7.4/include/openssl/sha.h /usr/local/Cellar/libressl/2.7.4/include/openssl/dsa.h /usr/local/Cellar/libressl/2.7.4/include/openssl/ecdsa.h /usr/local/Cellar/libressl/2.7.4/include/openssl/rsa.h /Users/nice/HelloWord/.build/checkouts/swift-nio.git-5005363973595484456/Sources/CNIOZlib/include/c_nio_zlib.h /usr/local/Cellar/libressl/2.7.4/include/openssl/obj_mac.h /usr/local/Cellar/libressl/2.7.4/include/openssl/hmac.h /usr/local/Cellar/libressl/2.7.4/include/openssl/ec.h /Users/nice/HelloWord/.build/checkouts/swift-nio.git-5005363973595484456/Sources/CNIOAtomics/include/cpp_magic.h /usr/local/Cellar/libressl/2.7.4/include/openssl/rand.h /usr/local/Cellar/libressl/2.7.4/include/openssl/conf.h /usr/local/Cellar/libressl/2.7.4/include/openssl/opensslconf.h /usr/local/Cellar/libressl/2.7.4/include/openssl/dh.h /usr/local/Cellar/libressl/2.7.4/include/openssl/ecdh.h /usr/local/Cellar/libressl/2.7.4/include/openssl/lhash.h /usr/local/Cellar/libressl/2.7.4/include/openssl/stack.h /usr/local/Cellar/libressl/2.7.4/include/openssl/safestack.h /usr/local/Cellar/libressl/2.7.4/include/openssl/ssl.h /Users/nice/HelloWord/.build/checkouts/swift-nio-ssl.git-8502154137117992337/Sources/CNIOOpenSSL/include/c_nio_openssl.h /Users/nice/HelloWord/.build/checkouts/crypto.git--3937561158972323303/Sources/CCryptoOpenSSL/include/c_crypto_openssl.h /usr/local/Cellar/libressl/2.7.4/include/openssl/pem.h /usr/local/Cellar/libressl/2.7.4/include/openssl/bn.h /Users/nice/HelloWord/.build/checkouts/swift-nio.git-5005363973595484456/Sources/CNIODarwin/include/c_nio_darwin.h /usr/local/Cellar/libressl/2.7.4/include/openssl/bio.h /usr/local/Cellar/libressl/2.7.4/include/openssl/crypto.h /usr/local/Cellar/libressl/2.7.4/include/openssl/srtp.h /usr/local/Cellar/libressl/2.7.4/include/openssl/evp.h /usr/local/Cellar/libressl/2.7.4/include/openssl/ossl_typ.h /usr/local/Cellar/libressl/2.7.4/include/openssl/buffer.h /Users/nice/HelloWord/.build/checkouts/swift-nio.git-5005363973595484456/Sources/CNIOHTTPParser/include/c_nio_http_parser.h /usr/local/Cellar/libressl/2.7.4/include/openssl/err.h /Users/nice/HelloWord/.build/checkouts/swift-nio.git-5005363973595484456/Sources/CNIOAtomics/include/c-atomics.h /usr/local/Cellar/libressl/2.7.4/include/openssl/opensslfeatures.h /usr/local/Cellar/libressl/2.7.4/include/openssl/objects.h /usr/local/Cellar/libressl/2.7.4/include/openssl/opensslv.h /Users/nice/HelloWord/.build/checkouts/swift-nio.git-5005363973595484456/Sources/CNIOLinux/include/c_nio_linux.h /usr/local/Cellar/libressl/2.7.4/include/openssl/x509_vfy.h /Users/nice/HelloWord/.build/checkouts/swift-nio-zlib-support.git--6556802241718767980/module.modulemap /Users/nice/HelloWord/.build/checkouts/swift-nio-ssl-support.git--3664958863524920767/module.modulemap /Users/nice/HelloWord/.build/x86_64-apple-macosx10.10/debug/CNIOSHA1.build/module.modulemap /Users/nice/HelloWord/.build/x86_64-apple-macosx10.10/debug/CNIOOpenSSL.build/module.modulemap /Users/nice/HelloWord/.build/x86_64-apple-macosx10.10/debug/CCryptoOpenSSL.build/module.modulemap /Users/nice/HelloWord/.build/x86_64-apple-macosx10.10/debug/CNIOZlib.build/module.modulemap /Users/nice/HelloWord/.build/x86_64-apple-macosx10.10/debug/CNIODarwin.build/module.modulemap /Users/nice/HelloWord/.build/x86_64-apple-macosx10.10/debug/CNIOHTTPParser.build/module.modulemap /Users/nice/HelloWord/.build/x86_64-apple-macosx10.10/debug/CNIOAtomics.build/module.modulemap /Users/nice/HelloWord/.build/x86_64-apple-macosx10.10/debug/CNIOLinux.build/module.modulemap /Users/nice/HelloWord/.build/checkouts/crypto.git--3937561158972323303/Sources/CBase32/include/module.modulemap /Users/nice/HelloWord/.build/checkouts/crypto.git--3937561158972323303/Sources/CBcrypt/include/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/nice/HelloWord/.build/x86_64-apple-macosx10.10/debug/Vapor.build/HTTPMethod+String~partial.swiftmodule : /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/Utilities/FileIO.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/Content/FormDataCoder+HTTP.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/Sessions/SessionData.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/Utilities/Thread.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/Content/URLEncoded.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/Deprecated.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/Commands/ServeCommand.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/Commands/RoutesCommand.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/Commands/BootCommand.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/Routing/Router+Method.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/Sessions/SessionCache.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/Response/ResponseCodable.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/Request/RequestCodable.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/Routing/Router+Middleware.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/Middleware/Middleware.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/Middleware/CORSMiddleware.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/Middleware/FileMiddleware.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/Middleware/DateMiddleware.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/Middleware/ErrorMiddleware.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/Sessions/SessionsMiddleware.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/Routing/Router+LazyMiddleware.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/Response/Response.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/Utilities/AnyResponse.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/Middleware/MiddlewareConfig.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/Server/NIOServerConfig.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/Sessions/SessionsConfig.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/Content/ContentConfig.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/Request/HTTPMethod+String.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/Routing/Router+Path.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/Content/JSONCoder+Custom.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/Sessions/Request+Session.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/Sessions/Session.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/Application.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/Routing/RouteCollection.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/Routing/Router+Function.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/Services/VaporProvider.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/Response/Responder.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/Response/BasicResponder.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/Response/ApplicationResponder.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/WebSocket/WebSocketResponder.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/Content/PlaintextEncoder.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/Content/HTTPMessageContainer.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/Routing/ParametersContainer.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/Content/ContentContainer.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/Content/QueryContainer.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/Routing/Router.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/Routing/EngineRouter.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/Server/Server.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/Server/NIOServer.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/Server/RunningServer.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/WebSocket/WebSocketServer.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/WebSocket/NIOWebSocketServer.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/Error/Error.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/Logging/Logger+LogError.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/Error/AbortError.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/Sessions/Sessions.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/Sessions/KeyedCacheSessions.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/Sessions/MemorySessions.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/Content/ContentCoders.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/Utilities/Exports.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/Response/HTTPStatus.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/Response/Redirect.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/Content/SingleValueGet.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/Services/Config+Default.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/Commands/CommandConfig+Default.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/Services/Services+Default.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/Client/Client.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/Client/FoundationClient.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/WebSocket/WebSocketClient.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/WebSocket/NIOWebSocketClient.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/Routing/Router+Content.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/Content/Content.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/Error/Abort.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/Request/Request.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/View/Vapor+View.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Dispatch.apinotesc /Users/nice/HelloWord/.build/x86_64-apple-macosx10.10/debug/NIOHTTP1.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/ObjectiveC.swiftmodule /Users/nice/HelloWord/.build/x86_64-apple-macosx10.10/debug/NIOOpenSSL.swiftmodule /Users/nice/HelloWord/.build/x86_64-apple-macosx10.10/debug/NIO.swiftmodule /Users/nice/HelloWord/.build/x86_64-apple-macosx10.10/debug/HTTP.swiftmodule /Users/nice/HelloWord/.build/x86_64-apple-macosx10.10/debug/NIOTLS.swiftmodule /Users/nice/HelloWord/.build/x86_64-apple-macosx10.10/debug/Async.swiftmodule /Users/nice/HelloWord/.build/x86_64-apple-macosx10.10/debug/Command.swiftmodule /Users/nice/HelloWord/.build/x86_64-apple-macosx10.10/debug/Service.swiftmodule /Users/nice/HelloWord/.build/x86_64-apple-macosx10.10/debug/Console.swiftmodule /Users/nice/HelloWord/.build/x86_64-apple-macosx10.10/debug/Core.swiftmodule /Users/nice/HelloWord/.build/x86_64-apple-macosx10.10/debug/Logging.swiftmodule /Users/nice/HelloWord/.build/x86_64-apple-macosx10.10/debug/Debugging.swiftmodule /Users/nice/HelloWord/.build/x86_64-apple-macosx10.10/debug/Routing.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Dispatch.swiftmodule /Users/nice/HelloWord/.build/x86_64-apple-macosx10.10/debug/COperatingSystem.swiftmodule /Users/nice/HelloWord/.build/x86_64-apple-macosx10.10/debug/Random.swiftmodule /Users/nice/HelloWord/.build/x86_64-apple-macosx10.10/debug/URLEncodedForm.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Darwin.swiftmodule /Users/nice/HelloWord/.build/x86_64-apple-macosx10.10/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/nice/HelloWord/.build/x86_64-apple-macosx10.10/debug/Crypto.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/CoreGraphics.swiftmodule /Users/nice/HelloWord/.build/x86_64-apple-macosx10.10/debug/NIOConcurrencyHelpers.swiftmodule /Users/nice/HelloWord/.build/x86_64-apple-macosx10.10/debug/Bits.swiftmodule /Users/nice/HelloWord/.build/x86_64-apple-macosx10.10/debug/NIOFoundationCompat.swiftmodule /Users/nice/HelloWord/.build/x86_64-apple-macosx10.10/debug/WebSocket.swiftmodule /Users/nice/HelloWord/.build/x86_64-apple-macosx10.10/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/nice/HelloWord/.build/x86_64-apple-macosx10.10/debug/DatabaseKit.swiftmodule /Users/nice/HelloWord/.build/x86_64-apple-macosx10.10/debug/TemplateKit.swiftmodule /Users/nice/HelloWord/.build/x86_64-apple-macosx10.10/debug/Multipart.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/SwiftOnoneSupport.swiftmodule /Users/nice/HelloWord/.build/checkouts/swift-nio.git-5005363973595484456/Sources/CNIOSHA1/include/c_nio_sha1.h /usr/local/Cellar/libressl/2.7.4/include/openssl/asn1.h /usr/local/Cellar/libressl/2.7.4/include/openssl/tls1.h /usr/local/Cellar/libressl/2.7.4/include/openssl/dtls1.h /usr/local/Cellar/libressl/2.7.4/include/openssl/pkcs12.h /usr/local/Cellar/libressl/2.7.4/include/openssl/ssl2.h /usr/local/Cellar/libressl/2.7.4/include/openssl/pem2.h /usr/local/Cellar/libressl/2.7.4/include/openssl/ssl23.h /usr/local/Cellar/libressl/2.7.4/include/openssl/ssl3.h /usr/local/Cellar/libressl/2.7.4/include/openssl/x509v3.h /usr/local/Cellar/libressl/2.7.4/include/openssl/md5.h /usr/local/Cellar/libressl/2.7.4/include/openssl/pkcs7.h /usr/local/Cellar/libressl/2.7.4/include/openssl/x509.h /usr/local/Cellar/libressl/2.7.4/include/openssl/sha.h /usr/local/Cellar/libressl/2.7.4/include/openssl/dsa.h /usr/local/Cellar/libressl/2.7.4/include/openssl/ecdsa.h /usr/local/Cellar/libressl/2.7.4/include/openssl/rsa.h /Users/nice/HelloWord/.build/checkouts/swift-nio.git-5005363973595484456/Sources/CNIOZlib/include/c_nio_zlib.h /usr/local/Cellar/libressl/2.7.4/include/openssl/obj_mac.h /usr/local/Cellar/libressl/2.7.4/include/openssl/hmac.h /usr/local/Cellar/libressl/2.7.4/include/openssl/ec.h /Users/nice/HelloWord/.build/checkouts/swift-nio.git-5005363973595484456/Sources/CNIOAtomics/include/cpp_magic.h /usr/local/Cellar/libressl/2.7.4/include/openssl/rand.h /usr/local/Cellar/libressl/2.7.4/include/openssl/conf.h /usr/local/Cellar/libressl/2.7.4/include/openssl/opensslconf.h /usr/local/Cellar/libressl/2.7.4/include/openssl/dh.h /usr/local/Cellar/libressl/2.7.4/include/openssl/ecdh.h /usr/local/Cellar/libressl/2.7.4/include/openssl/lhash.h /usr/local/Cellar/libressl/2.7.4/include/openssl/stack.h /usr/local/Cellar/libressl/2.7.4/include/openssl/safestack.h /usr/local/Cellar/libressl/2.7.4/include/openssl/ssl.h /Users/nice/HelloWord/.build/checkouts/swift-nio-ssl.git-8502154137117992337/Sources/CNIOOpenSSL/include/c_nio_openssl.h /Users/nice/HelloWord/.build/checkouts/crypto.git--3937561158972323303/Sources/CCryptoOpenSSL/include/c_crypto_openssl.h /usr/local/Cellar/libressl/2.7.4/include/openssl/pem.h /usr/local/Cellar/libressl/2.7.4/include/openssl/bn.h /Users/nice/HelloWord/.build/checkouts/swift-nio.git-5005363973595484456/Sources/CNIODarwin/include/c_nio_darwin.h /usr/local/Cellar/libressl/2.7.4/include/openssl/bio.h /usr/local/Cellar/libressl/2.7.4/include/openssl/crypto.h /usr/local/Cellar/libressl/2.7.4/include/openssl/srtp.h /usr/local/Cellar/libressl/2.7.4/include/openssl/evp.h /usr/local/Cellar/libressl/2.7.4/include/openssl/ossl_typ.h /usr/local/Cellar/libressl/2.7.4/include/openssl/buffer.h /Users/nice/HelloWord/.build/checkouts/swift-nio.git-5005363973595484456/Sources/CNIOHTTPParser/include/c_nio_http_parser.h /usr/local/Cellar/libressl/2.7.4/include/openssl/err.h /Users/nice/HelloWord/.build/checkouts/swift-nio.git-5005363973595484456/Sources/CNIOAtomics/include/c-atomics.h /usr/local/Cellar/libressl/2.7.4/include/openssl/opensslfeatures.h /usr/local/Cellar/libressl/2.7.4/include/openssl/objects.h /usr/local/Cellar/libressl/2.7.4/include/openssl/opensslv.h /Users/nice/HelloWord/.build/checkouts/swift-nio.git-5005363973595484456/Sources/CNIOLinux/include/c_nio_linux.h /usr/local/Cellar/libressl/2.7.4/include/openssl/x509_vfy.h /Users/nice/HelloWord/.build/checkouts/swift-nio-zlib-support.git--6556802241718767980/module.modulemap /Users/nice/HelloWord/.build/checkouts/swift-nio-ssl-support.git--3664958863524920767/module.modulemap /Users/nice/HelloWord/.build/x86_64-apple-macosx10.10/debug/CNIOSHA1.build/module.modulemap /Users/nice/HelloWord/.build/x86_64-apple-macosx10.10/debug/CNIOOpenSSL.build/module.modulemap /Users/nice/HelloWord/.build/x86_64-apple-macosx10.10/debug/CCryptoOpenSSL.build/module.modulemap /Users/nice/HelloWord/.build/x86_64-apple-macosx10.10/debug/CNIOZlib.build/module.modulemap /Users/nice/HelloWord/.build/x86_64-apple-macosx10.10/debug/CNIODarwin.build/module.modulemap /Users/nice/HelloWord/.build/x86_64-apple-macosx10.10/debug/CNIOHTTPParser.build/module.modulemap /Users/nice/HelloWord/.build/x86_64-apple-macosx10.10/debug/CNIOAtomics.build/module.modulemap /Users/nice/HelloWord/.build/x86_64-apple-macosx10.10/debug/CNIOLinux.build/module.modulemap /Users/nice/HelloWord/.build/checkouts/crypto.git--3937561158972323303/Sources/CBase32/include/module.modulemap /Users/nice/HelloWord/.build/checkouts/crypto.git--3937561158972323303/Sources/CBcrypt/include/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/nice/HelloWord/.build/x86_64-apple-macosx10.10/debug/Vapor.build/HTTPMethod+String~partial.swiftdoc : /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/Utilities/FileIO.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/Content/FormDataCoder+HTTP.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/Sessions/SessionData.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/Utilities/Thread.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/Content/URLEncoded.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/Deprecated.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/Commands/ServeCommand.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/Commands/RoutesCommand.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/Commands/BootCommand.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/Routing/Router+Method.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/Sessions/SessionCache.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/Response/ResponseCodable.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/Request/RequestCodable.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/Routing/Router+Middleware.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/Middleware/Middleware.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/Middleware/CORSMiddleware.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/Middleware/FileMiddleware.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/Middleware/DateMiddleware.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/Middleware/ErrorMiddleware.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/Sessions/SessionsMiddleware.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/Routing/Router+LazyMiddleware.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/Response/Response.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/Utilities/AnyResponse.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/Middleware/MiddlewareConfig.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/Server/NIOServerConfig.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/Sessions/SessionsConfig.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/Content/ContentConfig.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/Request/HTTPMethod+String.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/Routing/Router+Path.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/Content/JSONCoder+Custom.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/Sessions/Request+Session.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/Sessions/Session.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/Application.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/Routing/RouteCollection.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/Routing/Router+Function.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/Services/VaporProvider.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/Response/Responder.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/Response/BasicResponder.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/Response/ApplicationResponder.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/WebSocket/WebSocketResponder.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/Content/PlaintextEncoder.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/Content/HTTPMessageContainer.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/Routing/ParametersContainer.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/Content/ContentContainer.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/Content/QueryContainer.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/Routing/Router.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/Routing/EngineRouter.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/Server/Server.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/Server/NIOServer.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/Server/RunningServer.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/WebSocket/WebSocketServer.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/WebSocket/NIOWebSocketServer.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/Error/Error.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/Logging/Logger+LogError.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/Error/AbortError.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/Sessions/Sessions.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/Sessions/KeyedCacheSessions.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/Sessions/MemorySessions.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/Content/ContentCoders.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/Utilities/Exports.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/Response/HTTPStatus.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/Response/Redirect.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/Content/SingleValueGet.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/Services/Config+Default.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/Commands/CommandConfig+Default.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/Services/Services+Default.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/Client/Client.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/Client/FoundationClient.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/WebSocket/WebSocketClient.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/WebSocket/NIOWebSocketClient.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/Routing/Router+Content.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/Content/Content.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/Error/Abort.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/Request/Request.swift /Users/nice/HelloWord/.build/checkouts/vapor.git-950337452186757751/Sources/Vapor/View/Vapor+View.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Dispatch.apinotesc /Users/nice/HelloWord/.build/x86_64-apple-macosx10.10/debug/NIOHTTP1.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/ObjectiveC.swiftmodule /Users/nice/HelloWord/.build/x86_64-apple-macosx10.10/debug/NIOOpenSSL.swiftmodule /Users/nice/HelloWord/.build/x86_64-apple-macosx10.10/debug/NIO.swiftmodule /Users/nice/HelloWord/.build/x86_64-apple-macosx10.10/debug/HTTP.swiftmodule /Users/nice/HelloWord/.build/x86_64-apple-macosx10.10/debug/NIOTLS.swiftmodule /Users/nice/HelloWord/.build/x86_64-apple-macosx10.10/debug/Async.swiftmodule /Users/nice/HelloWord/.build/x86_64-apple-macosx10.10/debug/Command.swiftmodule /Users/nice/HelloWord/.build/x86_64-apple-macosx10.10/debug/Service.swiftmodule /Users/nice/HelloWord/.build/x86_64-apple-macosx10.10/debug/Console.swiftmodule /Users/nice/HelloWord/.build/x86_64-apple-macosx10.10/debug/Core.swiftmodule /Users/nice/HelloWord/.build/x86_64-apple-macosx10.10/debug/Logging.swiftmodule /Users/nice/HelloWord/.build/x86_64-apple-macosx10.10/debug/Debugging.swiftmodule /Users/nice/HelloWord/.build/x86_64-apple-macosx10.10/debug/Routing.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Dispatch.swiftmodule /Users/nice/HelloWord/.build/x86_64-apple-macosx10.10/debug/COperatingSystem.swiftmodule /Users/nice/HelloWord/.build/x86_64-apple-macosx10.10/debug/Random.swiftmodule /Users/nice/HelloWord/.build/x86_64-apple-macosx10.10/debug/URLEncodedForm.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Darwin.swiftmodule /Users/nice/HelloWord/.build/x86_64-apple-macosx10.10/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/nice/HelloWord/.build/x86_64-apple-macosx10.10/debug/Crypto.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/CoreGraphics.swiftmodule /Users/nice/HelloWord/.build/x86_64-apple-macosx10.10/debug/NIOConcurrencyHelpers.swiftmodule /Users/nice/HelloWord/.build/x86_64-apple-macosx10.10/debug/Bits.swiftmodule /Users/nice/HelloWord/.build/x86_64-apple-macosx10.10/debug/NIOFoundationCompat.swiftmodule /Users/nice/HelloWord/.build/x86_64-apple-macosx10.10/debug/WebSocket.swiftmodule /Users/nice/HelloWord/.build/x86_64-apple-macosx10.10/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/nice/HelloWord/.build/x86_64-apple-macosx10.10/debug/DatabaseKit.swiftmodule /Users/nice/HelloWord/.build/x86_64-apple-macosx10.10/debug/TemplateKit.swiftmodule /Users/nice/HelloWord/.build/x86_64-apple-macosx10.10/debug/Multipart.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/SwiftOnoneSupport.swiftmodule /Users/nice/HelloWord/.build/checkouts/swift-nio.git-5005363973595484456/Sources/CNIOSHA1/include/c_nio_sha1.h /usr/local/Cellar/libressl/2.7.4/include/openssl/asn1.h /usr/local/Cellar/libressl/2.7.4/include/openssl/tls1.h /usr/local/Cellar/libressl/2.7.4/include/openssl/dtls1.h /usr/local/Cellar/libressl/2.7.4/include/openssl/pkcs12.h /usr/local/Cellar/libressl/2.7.4/include/openssl/ssl2.h /usr/local/Cellar/libressl/2.7.4/include/openssl/pem2.h /usr/local/Cellar/libressl/2.7.4/include/openssl/ssl23.h /usr/local/Cellar/libressl/2.7.4/include/openssl/ssl3.h /usr/local/Cellar/libressl/2.7.4/include/openssl/x509v3.h /usr/local/Cellar/libressl/2.7.4/include/openssl/md5.h /usr/local/Cellar/libressl/2.7.4/include/openssl/pkcs7.h /usr/local/Cellar/libressl/2.7.4/include/openssl/x509.h /usr/local/Cellar/libressl/2.7.4/include/openssl/sha.h /usr/local/Cellar/libressl/2.7.4/include/openssl/dsa.h /usr/local/Cellar/libressl/2.7.4/include/openssl/ecdsa.h /usr/local/Cellar/libressl/2.7.4/include/openssl/rsa.h /Users/nice/HelloWord/.build/checkouts/swift-nio.git-5005363973595484456/Sources/CNIOZlib/include/c_nio_zlib.h /usr/local/Cellar/libressl/2.7.4/include/openssl/obj_mac.h /usr/local/Cellar/libressl/2.7.4/include/openssl/hmac.h /usr/local/Cellar/libressl/2.7.4/include/openssl/ec.h /Users/nice/HelloWord/.build/checkouts/swift-nio.git-5005363973595484456/Sources/CNIOAtomics/include/cpp_magic.h /usr/local/Cellar/libressl/2.7.4/include/openssl/rand.h /usr/local/Cellar/libressl/2.7.4/include/openssl/conf.h /usr/local/Cellar/libressl/2.7.4/include/openssl/opensslconf.h /usr/local/Cellar/libressl/2.7.4/include/openssl/dh.h /usr/local/Cellar/libressl/2.7.4/include/openssl/ecdh.h /usr/local/Cellar/libressl/2.7.4/include/openssl/lhash.h /usr/local/Cellar/libressl/2.7.4/include/openssl/stack.h /usr/local/Cellar/libressl/2.7.4/include/openssl/safestack.h /usr/local/Cellar/libressl/2.7.4/include/openssl/ssl.h /Users/nice/HelloWord/.build/checkouts/swift-nio-ssl.git-8502154137117992337/Sources/CNIOOpenSSL/include/c_nio_openssl.h /Users/nice/HelloWord/.build/checkouts/crypto.git--3937561158972323303/Sources/CCryptoOpenSSL/include/c_crypto_openssl.h /usr/local/Cellar/libressl/2.7.4/include/openssl/pem.h /usr/local/Cellar/libressl/2.7.4/include/openssl/bn.h /Users/nice/HelloWord/.build/checkouts/swift-nio.git-5005363973595484456/Sources/CNIODarwin/include/c_nio_darwin.h /usr/local/Cellar/libressl/2.7.4/include/openssl/bio.h /usr/local/Cellar/libressl/2.7.4/include/openssl/crypto.h /usr/local/Cellar/libressl/2.7.4/include/openssl/srtp.h /usr/local/Cellar/libressl/2.7.4/include/openssl/evp.h /usr/local/Cellar/libressl/2.7.4/include/openssl/ossl_typ.h /usr/local/Cellar/libressl/2.7.4/include/openssl/buffer.h /Users/nice/HelloWord/.build/checkouts/swift-nio.git-5005363973595484456/Sources/CNIOHTTPParser/include/c_nio_http_parser.h /usr/local/Cellar/libressl/2.7.4/include/openssl/err.h /Users/nice/HelloWord/.build/checkouts/swift-nio.git-5005363973595484456/Sources/CNIOAtomics/include/c-atomics.h /usr/local/Cellar/libressl/2.7.4/include/openssl/opensslfeatures.h /usr/local/Cellar/libressl/2.7.4/include/openssl/objects.h /usr/local/Cellar/libressl/2.7.4/include/openssl/opensslv.h /Users/nice/HelloWord/.build/checkouts/swift-nio.git-5005363973595484456/Sources/CNIOLinux/include/c_nio_linux.h /usr/local/Cellar/libressl/2.7.4/include/openssl/x509_vfy.h /Users/nice/HelloWord/.build/checkouts/swift-nio-zlib-support.git--6556802241718767980/module.modulemap /Users/nice/HelloWord/.build/checkouts/swift-nio-ssl-support.git--3664958863524920767/module.modulemap /Users/nice/HelloWord/.build/x86_64-apple-macosx10.10/debug/CNIOSHA1.build/module.modulemap /Users/nice/HelloWord/.build/x86_64-apple-macosx10.10/debug/CNIOOpenSSL.build/module.modulemap /Users/nice/HelloWord/.build/x86_64-apple-macosx10.10/debug/CCryptoOpenSSL.build/module.modulemap /Users/nice/HelloWord/.build/x86_64-apple-macosx10.10/debug/CNIOZlib.build/module.modulemap /Users/nice/HelloWord/.build/x86_64-apple-macosx10.10/debug/CNIODarwin.build/module.modulemap /Users/nice/HelloWord/.build/x86_64-apple-macosx10.10/debug/CNIOHTTPParser.build/module.modulemap /Users/nice/HelloWord/.build/x86_64-apple-macosx10.10/debug/CNIOAtomics.build/module.modulemap /Users/nice/HelloWord/.build/x86_64-apple-macosx10.10/debug/CNIOLinux.build/module.modulemap /Users/nice/HelloWord/.build/checkouts/crypto.git--3937561158972323303/Sources/CBase32/include/module.modulemap /Users/nice/HelloWord/.build/checkouts/crypto.git--3937561158972323303/Sources/CBcrypt/include/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
// REQUIRED_ARGS: import std.c.stdio; /********************************************************/ //int delegate(int, char[]) *p; class Foo { int bar(int i, char[] s) { return 4; } } class Bar : Foo { override int bar(int i, char[] s) { return 5; } } void test1() { int delegate(int, char[]) dg; Foo f = new Foo(); Bar b = new Bar(); int x; dg = &f.bar; x = dg(3, null); assert(x == 4); f = b; dg = &f.bar; x = dg(3, null); assert(x == 5); } /********************************************************/ int foo2() { return 3; } void test2() { int function () fp; fp = &foo2; assert(fp() == 3); } /********************************************************/ class Foo3 { int bar(int i, char[] s) { return 47; } void test() { int delegate(int, char[]) dg; dg = &bar; printf("%d %d\n", dg(3, null), result()); assert(dg(3, null) == result()); dg = &this.bar; printf("%d %d\n", dg(3, null), result()); assert(dg(3, null) == result()); } int result() { return 47; } } class Bar3 : Foo3 { override int bar(int i, char[] s) { return 48; } override int result() { return 48; } void test2() { int delegate(int, char[]) dg; dg = &super.bar; assert(dg(3, null) == 47); } } void test3() { Foo3 f = new Foo3(); f.test(); Bar3 b = new Bar3(); b.test(); b.test2(); } /********************************************************/ int foo4(int x) { return 1; } int foo4(char x) { return 2; } int foo4(int x, int y) { return 3; } void test4() { int function (char) fp; fp = &foo4; assert(fp(0) == 2); } /********************************************************/ class Abc { int foo1(int x) { return 1; } int foo1(char x) { return 2; } int foo1(int x, int y) { return 3; } } void test5() { int delegate(char) dg; Abc a = new Abc(); dg = &a.foo1; assert(dg(0) == 2); } /********************************************************/ int delegate(int) bar6; int[int delegate(int)] aa6; void test6() { aa6[bar6] = 0; } /********************************************************/ void foo7(void delegate(int) dg) { dg(1); //writefln("%s", dg(3)); } void test7() { foo7(delegate(int i) { printf("i = %d\n", i); } ); } /********************************************************/ void foo8(int delegate(int) dg) { printf("%d\n", dg(3)); assert(dg(3) == 6); } void test8() { foo8(delegate(int i) { return i * 2; } ); } /********************************************************/ void foo9(int delegate(int) dg) { assert(dg(3) == 6); } void test9() { foo9( (int i) { return i * 2; } ); } /********************************************************/ void foo10(int delegate() dg) { assert(dg() == 6); } void test10() { int i = 3; foo10( { return i * 2; } ); } /********************************************************/ class Foo11 { int x = 7; int func() { return x; } } void test11() { int delegate() dg; Foo11 f = new Foo11; dg.ptr = cast(void*)f; dg.funcptr = &Foo11.func; assert(dg() == 7); } /********************************************************/ class A12 { public: int delegate(int, int) dgs[4]; int function(int, int) fps[4]; int delegate(int, int) dg; int function(int, int) fp; int f(int x, int y) { printf("here "); int res = x + y; printf("%d\n", res); return res; } void bug_1() { // fp = &f; // fp(1,2); dg = &f; dg(1,2); // fps[] = [&f, &f, &f, &(f)]; // bug 1: this line shouldn't compile // this.fps[0](1, 2); // seg-faults here! dgs[] = [&(f), &(f), &(f), &(f)]; // bug 1: why this line can't compile? this.dgs[0](1, 2); dgs[] = [&(this.f), &(this.f), &(this.f), &(this.f)]; this.dgs[0](1, 2); } } void test12() { A12 a = new A12(); a.bug_1(); } /********************************************************/ // 1570 class A13 { int f() { return 1; } } class B13 : A13 { override int f() { return 2; } } void test13() { B13 b = new B13; assert(b.f() == 2); assert(b.A13.f() == 1); assert((&b.f)() == 2); assert((&b.A13.f)() == 1); } /********************************************************/ // 2472 class A2472 { void foo() {} } void test2472() { auto a = new A2472; auto fp1 = (&a.foo).funcptr; auto dg = &a.foo; auto fp2 = dg.funcptr; assert(fp1 == fp2); } /********************************************************/ int main() { test1(); test2(); test3(); test4(); test5(); test6(); test7(); test8(); test9(); test10(); test11(); test12(); test13(); test2472(); printf("Success\n"); return 0; }
D
import std.stdio; import openmethods; mixin(registerMethods); unittest { }
D
the official symbols of a family, state, etc. decorate with heraldic arms
D
/mnt/d/dev/blockchain/wormhole/solana/bridge/program/target/rls/debug/deps/fixed_hash-61919979c6b5a806.rmeta: /home/franglin/.cargo/registry/src/github.com-1ecc6299db9ec823/fixed-hash-0.7.0/src/lib.rs /home/franglin/.cargo/registry/src/github.com-1ecc6299db9ec823/fixed-hash-0.7.0/src/hash.rs /mnt/d/dev/blockchain/wormhole/solana/bridge/program/target/rls/debug/deps/fixed_hash-61919979c6b5a806.d: /home/franglin/.cargo/registry/src/github.com-1ecc6299db9ec823/fixed-hash-0.7.0/src/lib.rs /home/franglin/.cargo/registry/src/github.com-1ecc6299db9ec823/fixed-hash-0.7.0/src/hash.rs /home/franglin/.cargo/registry/src/github.com-1ecc6299db9ec823/fixed-hash-0.7.0/src/lib.rs: /home/franglin/.cargo/registry/src/github.com-1ecc6299db9ec823/fixed-hash-0.7.0/src/hash.rs:
D
module d.rt.array; extern(C): void __sd_array_outofbounds(string file, int line) { import core.stdc.stdlib, core.stdc.stdio; printf("bound check fail: %s:%d\n", file.ptr, line); exit(1); }
D
module tests.range; import reggae; import unit_threaded; import std.array; void testDepFirstLeaf() { depthFirst(Target("letarget")).array.shouldEqual([]); } void testDepthFirstOneDependencyLevel() { auto target = Target("letarget", "lecmdfoo bar other", [Target("foo"), Target("bar")]); auto depth = depthFirst(target); depth.array.shouldEqual([target]); } void testDepthFirstTwoDependencyLevels() { auto fooObj = Target("foo.o", "gcc -c -o foo.o foo.c", [Target("foo.c")]); auto barObj = Target("bar.o", "gcc -c -o bar.o bar.c", [Target("bar.c")]); auto header = Target("hdr.h", "genhdr $in", [Target("hdr.i")]); auto impLeaf = Target("leaf"); //implicit dependencies should show up, but only if they're not leaves auto target = Target("app", "gcc -o letarget foo.o bar.o", [fooObj, barObj], [header, impLeaf]); auto depth = depthFirst(target); depth.array.shouldEqual([fooObj, barObj, header, target]); } void testDepthFirstProtocolExample() { const protoSrcs = Target([`$builddir/gen/protocol.c`, `$builddir/gen/protocol.h`], `./compiler $in`, [Target(`protocol.proto`)]); const protoObj = Target(`$builddir/bin/protocol.o`, `gcc -o $out -c $builddir/gen/protocol.c`, [], [protoSrcs]); const protoD = Target(`$builddir/gen/protocol.d`, `echo "extern(C) " > $out; cat $builddir/gen/protocol.h >> $out`, [], [protoSrcs]); const app = Target(`app`, `dmd -of$out $in`, [Target(`src/main.d`), protoObj, protoD]); depthFirst(app).array.shouldEqual( [protoSrcs, protoObj, protoSrcs, protoD, app]); } void testByDepthLevelLeaf() { ByDepthLevel(Target("letarget")).array.shouldEqual([]); } void testByDepthLevelOneLevel() { const target = Target("letarget", "lecmdfoo bar other", [Target("foo"), Target("bar")]); auto byLevel = ByDepthLevel(target); byLevel.array.shouldEqual([[target]]); } void testByDepthLevelTwoDependencyLevels() { auto fooC = Target("foo.c"); auto barC = Target("bar.c"); auto fooObj = Target("foo.o", "gcc -c -o foo.o foo.c", [fooC]); auto barObj = Target("bar.o", "gcc -c -o bar.o bar.c", [barC]); auto hdrI = Target("hdr.i"); auto header = Target("hdr.h", "genhdr $in", [hdrI]); auto impLeaf = Target("leaf"); //implicit dependencies should show up, but only if they're not leaves auto target = Target("app", "gcc -o letarget foo.o bar.o", [fooObj, barObj], [header, impLeaf]); auto rng = ByDepthLevel(target); //reverse order should show up: first level 1, then level 0 //level 2 doesn't show up since they're all leaves (fooC, barC, hdrI) rng.array.shouldEqual( [ [fooObj, barObj, header], //level 1 [target], //level 0 ]); } void testLeavesEmpty() { Leaves(Target("leaf")).array.shouldEqual([Target("leaf")]); } void testLeavesTwoLevels() { auto fooC = Target("foo.c"); auto barC = Target("bar.c"); auto fooObj = Target("foo.o", "gcc -c -o foo.o foo.c", [fooC]); auto barObj = Target("bar.o", "gcc -c -o bar.o bar.c", [barC]); auto hdrI = Target("hdr.i"); auto header = Target("hdr.h", "genhdr $in", [hdrI]); auto impLeaf = Target("leaf"); //implicit dependencies should show up, but only if they're not leaves auto target = Target("app", "gcc -o letarget foo.o bar.o", [fooObj, barObj], [header, impLeaf]); Leaves(target).array.shouldEqual([fooC, barC, hdrI, impLeaf]); }
D
/Users/gem/Desktop/MovieMoya/the-movie-db/DerivedData/TheNewMovie/Build/Intermediates.noindex/IBDesignables/Intermediates.noindex/Pods.build/Debug-iphonesimulator/Kingfisher.build/Objects-normal/x86_64/RedirectHandler.o : /Users/gem/Desktop/MovieMoya/the-movie-db/Pods/Kingfisher/Sources/Utility/String+MD5.swift /Users/gem/Desktop/MovieMoya/the-movie-db/Pods/Kingfisher/Sources/General/Deprecated.swift /Users/gem/Desktop/MovieMoya/the-movie-db/Pods/Kingfisher/Sources/General/ImageSource/Source.swift /Users/gem/Desktop/MovieMoya/the-movie-db/Pods/Kingfisher/Sources/General/ImageSource/Resource.swift /Users/gem/Desktop/MovieMoya/the-movie-db/Pods/Kingfisher/Sources/Image/Image.swift /Users/gem/Desktop/MovieMoya/the-movie-db/Pods/Kingfisher/Sources/Image/GIFAnimatedImage.swift /Users/gem/Desktop/MovieMoya/the-movie-db/Pods/Kingfisher/Sources/Cache/Storage.swift /Users/gem/Desktop/MovieMoya/the-movie-db/Pods/Kingfisher/Sources/Cache/DiskStorage.swift /Users/gem/Desktop/MovieMoya/the-movie-db/Pods/Kingfisher/Sources/Cache/MemoryStorage.swift /Users/gem/Desktop/MovieMoya/the-movie-db/Pods/Kingfisher/Sources/Cache/ImageCache.swift /Users/gem/Desktop/MovieMoya/the-movie-db/Pods/Kingfisher/Sources/Networking/AuthenticationChallengeResponsable.swift /Users/gem/Desktop/MovieMoya/the-movie-db/Pods/Kingfisher/Sources/Utility/Runtime.swift /Users/gem/Desktop/MovieMoya/the-movie-db/Pods/Kingfisher/Sources/Utility/Delegate.swift /Users/gem/Desktop/MovieMoya/the-movie-db/Pods/Kingfisher/Sources/Networking/SessionDelegate.swift /Users/gem/Desktop/MovieMoya/the-movie-db/Pods/Kingfisher/Sources/Networking/ImageDownloaderDelegate.swift /Users/gem/Desktop/MovieMoya/the-movie-db/Pods/Kingfisher/Sources/Utility/CallbackQueue.swift /Users/gem/Desktop/MovieMoya/the-movie-db/Pods/Kingfisher/Sources/Image/ImageDrawing.swift /Users/gem/Desktop/MovieMoya/the-movie-db/Pods/Kingfisher/Sources/Networking/SessionDataTask.swift /Users/gem/Desktop/MovieMoya/the-movie-db/Pods/Kingfisher/Sources/Image/ImageTransition.swift /Users/gem/Desktop/MovieMoya/the-movie-db/Pods/Kingfisher/Sources/General/KingfisherOptionsInfo.swift /Users/gem/Desktop/MovieMoya/the-movie-db/Pods/Kingfisher/Sources/Networking/ImageDownloader.swift /Users/gem/Desktop/MovieMoya/the-movie-db/Pods/Kingfisher/Sources/General/ImageSource/ImageDataProvider.swift /Users/gem/Desktop/MovieMoya/the-movie-db/Pods/Kingfisher/Sources/Image/Placeholder.swift /Users/gem/Desktop/MovieMoya/the-movie-db/Pods/Kingfisher/Sources/General/KingfisherManager.swift /Users/gem/Desktop/MovieMoya/the-movie-db/Pods/Kingfisher/Sources/Networking/ImagePrefetcher.swift /Users/gem/Desktop/MovieMoya/the-movie-db/Pods/Kingfisher/Sources/Extensions/UIButton+Kingfisher.swift /Users/gem/Desktop/MovieMoya/the-movie-db/Pods/Kingfisher/Sources/Extensions/ImageView+Kingfisher.swift /Users/gem/Desktop/MovieMoya/the-movie-db/Pods/Kingfisher/Sources/General/Kingfisher.swift /Users/gem/Desktop/MovieMoya/the-movie-db/Pods/Kingfisher/Sources/Networking/ImageModifier.swift /Users/gem/Desktop/MovieMoya/the-movie-db/Pods/Kingfisher/Sources/Networking/RequestModifier.swift /Users/gem/Desktop/MovieMoya/the-movie-db/Pods/Kingfisher/Sources/Networking/RedirectHandler.swift /Users/gem/Desktop/MovieMoya/the-movie-db/Pods/Kingfisher/Sources/Image/Filter.swift /Users/gem/Desktop/MovieMoya/the-movie-db/Pods/Kingfisher/Sources/Cache/CacheSerializer.swift /Users/gem/Desktop/MovieMoya/the-movie-db/Pods/Kingfisher/Sources/Cache/FormatIndicatedCacheSerializer.swift /Users/gem/Desktop/MovieMoya/the-movie-db/Pods/Kingfisher/Sources/General/KingfisherError.swift /Users/gem/Desktop/MovieMoya/the-movie-db/Pods/Kingfisher/Sources/Networking/ImageDataProcessor.swift /Users/gem/Desktop/MovieMoya/the-movie-db/Pods/Kingfisher/Sources/Image/ImageProcessor.swift /Users/gem/Desktop/MovieMoya/the-movie-db/Pods/Kingfisher/Sources/Views/Indicator.swift /Users/gem/Desktop/MovieMoya/the-movie-db/Pods/Kingfisher/Sources/Utility/SizeExtensions.swift /Users/gem/Desktop/MovieMoya/the-movie-db/Pods/Kingfisher/Sources/Utility/ExtensionHelpers.swift /Users/gem/Desktop/MovieMoya/the-movie-db/Pods/Kingfisher/Sources/Image/ImageFormat.swift /Users/gem/Desktop/MovieMoya/the-movie-db/Pods/Kingfisher/Sources/Utility/Result.swift /Users/gem/Desktop/MovieMoya/the-movie-db/Pods/Kingfisher/Sources/Views/AnimatedImageView.swift /Users/gem/Desktop/MovieMoya/the-movie-db/Pods/Kingfisher/Sources/Utility/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/gem/Desktop/MovieMoya/the-movie-db/Pods/Target\ Support\ Files/Kingfisher/Kingfisher-umbrella.h /Users/gem/Desktop/MovieMoya/the-movie-db/Pods/Kingfisher/Sources/Kingfisher.h /Users/gem/Desktop/MovieMoya/the-movie-db/DerivedData/TheNewMovie/Build/Intermediates.noindex/IBDesignables/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/gem/Desktop/MovieMoya/the-movie-db/DerivedData/TheNewMovie/Build/Intermediates.noindex/IBDesignables/Intermediates.noindex/Pods.build/Debug-iphonesimulator/Kingfisher.build/Objects-normal/x86_64/RedirectHandler~partial.swiftmodule : /Users/gem/Desktop/MovieMoya/the-movie-db/Pods/Kingfisher/Sources/Utility/String+MD5.swift /Users/gem/Desktop/MovieMoya/the-movie-db/Pods/Kingfisher/Sources/General/Deprecated.swift /Users/gem/Desktop/MovieMoya/the-movie-db/Pods/Kingfisher/Sources/General/ImageSource/Source.swift /Users/gem/Desktop/MovieMoya/the-movie-db/Pods/Kingfisher/Sources/General/ImageSource/Resource.swift /Users/gem/Desktop/MovieMoya/the-movie-db/Pods/Kingfisher/Sources/Image/Image.swift /Users/gem/Desktop/MovieMoya/the-movie-db/Pods/Kingfisher/Sources/Image/GIFAnimatedImage.swift /Users/gem/Desktop/MovieMoya/the-movie-db/Pods/Kingfisher/Sources/Cache/Storage.swift /Users/gem/Desktop/MovieMoya/the-movie-db/Pods/Kingfisher/Sources/Cache/DiskStorage.swift /Users/gem/Desktop/MovieMoya/the-movie-db/Pods/Kingfisher/Sources/Cache/MemoryStorage.swift /Users/gem/Desktop/MovieMoya/the-movie-db/Pods/Kingfisher/Sources/Cache/ImageCache.swift /Users/gem/Desktop/MovieMoya/the-movie-db/Pods/Kingfisher/Sources/Networking/AuthenticationChallengeResponsable.swift /Users/gem/Desktop/MovieMoya/the-movie-db/Pods/Kingfisher/Sources/Utility/Runtime.swift /Users/gem/Desktop/MovieMoya/the-movie-db/Pods/Kingfisher/Sources/Utility/Delegate.swift /Users/gem/Desktop/MovieMoya/the-movie-db/Pods/Kingfisher/Sources/Networking/SessionDelegate.swift /Users/gem/Desktop/MovieMoya/the-movie-db/Pods/Kingfisher/Sources/Networking/ImageDownloaderDelegate.swift /Users/gem/Desktop/MovieMoya/the-movie-db/Pods/Kingfisher/Sources/Utility/CallbackQueue.swift /Users/gem/Desktop/MovieMoya/the-movie-db/Pods/Kingfisher/Sources/Image/ImageDrawing.swift /Users/gem/Desktop/MovieMoya/the-movie-db/Pods/Kingfisher/Sources/Networking/SessionDataTask.swift /Users/gem/Desktop/MovieMoya/the-movie-db/Pods/Kingfisher/Sources/Image/ImageTransition.swift /Users/gem/Desktop/MovieMoya/the-movie-db/Pods/Kingfisher/Sources/General/KingfisherOptionsInfo.swift /Users/gem/Desktop/MovieMoya/the-movie-db/Pods/Kingfisher/Sources/Networking/ImageDownloader.swift /Users/gem/Desktop/MovieMoya/the-movie-db/Pods/Kingfisher/Sources/General/ImageSource/ImageDataProvider.swift /Users/gem/Desktop/MovieMoya/the-movie-db/Pods/Kingfisher/Sources/Image/Placeholder.swift /Users/gem/Desktop/MovieMoya/the-movie-db/Pods/Kingfisher/Sources/General/KingfisherManager.swift /Users/gem/Desktop/MovieMoya/the-movie-db/Pods/Kingfisher/Sources/Networking/ImagePrefetcher.swift /Users/gem/Desktop/MovieMoya/the-movie-db/Pods/Kingfisher/Sources/Extensions/UIButton+Kingfisher.swift /Users/gem/Desktop/MovieMoya/the-movie-db/Pods/Kingfisher/Sources/Extensions/ImageView+Kingfisher.swift /Users/gem/Desktop/MovieMoya/the-movie-db/Pods/Kingfisher/Sources/General/Kingfisher.swift /Users/gem/Desktop/MovieMoya/the-movie-db/Pods/Kingfisher/Sources/Networking/ImageModifier.swift /Users/gem/Desktop/MovieMoya/the-movie-db/Pods/Kingfisher/Sources/Networking/RequestModifier.swift /Users/gem/Desktop/MovieMoya/the-movie-db/Pods/Kingfisher/Sources/Networking/RedirectHandler.swift /Users/gem/Desktop/MovieMoya/the-movie-db/Pods/Kingfisher/Sources/Image/Filter.swift /Users/gem/Desktop/MovieMoya/the-movie-db/Pods/Kingfisher/Sources/Cache/CacheSerializer.swift /Users/gem/Desktop/MovieMoya/the-movie-db/Pods/Kingfisher/Sources/Cache/FormatIndicatedCacheSerializer.swift /Users/gem/Desktop/MovieMoya/the-movie-db/Pods/Kingfisher/Sources/General/KingfisherError.swift /Users/gem/Desktop/MovieMoya/the-movie-db/Pods/Kingfisher/Sources/Networking/ImageDataProcessor.swift /Users/gem/Desktop/MovieMoya/the-movie-db/Pods/Kingfisher/Sources/Image/ImageProcessor.swift /Users/gem/Desktop/MovieMoya/the-movie-db/Pods/Kingfisher/Sources/Views/Indicator.swift /Users/gem/Desktop/MovieMoya/the-movie-db/Pods/Kingfisher/Sources/Utility/SizeExtensions.swift /Users/gem/Desktop/MovieMoya/the-movie-db/Pods/Kingfisher/Sources/Utility/ExtensionHelpers.swift /Users/gem/Desktop/MovieMoya/the-movie-db/Pods/Kingfisher/Sources/Image/ImageFormat.swift /Users/gem/Desktop/MovieMoya/the-movie-db/Pods/Kingfisher/Sources/Utility/Result.swift /Users/gem/Desktop/MovieMoya/the-movie-db/Pods/Kingfisher/Sources/Views/AnimatedImageView.swift /Users/gem/Desktop/MovieMoya/the-movie-db/Pods/Kingfisher/Sources/Utility/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/gem/Desktop/MovieMoya/the-movie-db/Pods/Target\ Support\ Files/Kingfisher/Kingfisher-umbrella.h /Users/gem/Desktop/MovieMoya/the-movie-db/Pods/Kingfisher/Sources/Kingfisher.h /Users/gem/Desktop/MovieMoya/the-movie-db/DerivedData/TheNewMovie/Build/Intermediates.noindex/IBDesignables/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/gem/Desktop/MovieMoya/the-movie-db/DerivedData/TheNewMovie/Build/Intermediates.noindex/IBDesignables/Intermediates.noindex/Pods.build/Debug-iphonesimulator/Kingfisher.build/Objects-normal/x86_64/RedirectHandler~partial.swiftdoc : /Users/gem/Desktop/MovieMoya/the-movie-db/Pods/Kingfisher/Sources/Utility/String+MD5.swift /Users/gem/Desktop/MovieMoya/the-movie-db/Pods/Kingfisher/Sources/General/Deprecated.swift /Users/gem/Desktop/MovieMoya/the-movie-db/Pods/Kingfisher/Sources/General/ImageSource/Source.swift /Users/gem/Desktop/MovieMoya/the-movie-db/Pods/Kingfisher/Sources/General/ImageSource/Resource.swift /Users/gem/Desktop/MovieMoya/the-movie-db/Pods/Kingfisher/Sources/Image/Image.swift /Users/gem/Desktop/MovieMoya/the-movie-db/Pods/Kingfisher/Sources/Image/GIFAnimatedImage.swift /Users/gem/Desktop/MovieMoya/the-movie-db/Pods/Kingfisher/Sources/Cache/Storage.swift /Users/gem/Desktop/MovieMoya/the-movie-db/Pods/Kingfisher/Sources/Cache/DiskStorage.swift /Users/gem/Desktop/MovieMoya/the-movie-db/Pods/Kingfisher/Sources/Cache/MemoryStorage.swift /Users/gem/Desktop/MovieMoya/the-movie-db/Pods/Kingfisher/Sources/Cache/ImageCache.swift /Users/gem/Desktop/MovieMoya/the-movie-db/Pods/Kingfisher/Sources/Networking/AuthenticationChallengeResponsable.swift /Users/gem/Desktop/MovieMoya/the-movie-db/Pods/Kingfisher/Sources/Utility/Runtime.swift /Users/gem/Desktop/MovieMoya/the-movie-db/Pods/Kingfisher/Sources/Utility/Delegate.swift /Users/gem/Desktop/MovieMoya/the-movie-db/Pods/Kingfisher/Sources/Networking/SessionDelegate.swift /Users/gem/Desktop/MovieMoya/the-movie-db/Pods/Kingfisher/Sources/Networking/ImageDownloaderDelegate.swift /Users/gem/Desktop/MovieMoya/the-movie-db/Pods/Kingfisher/Sources/Utility/CallbackQueue.swift /Users/gem/Desktop/MovieMoya/the-movie-db/Pods/Kingfisher/Sources/Image/ImageDrawing.swift /Users/gem/Desktop/MovieMoya/the-movie-db/Pods/Kingfisher/Sources/Networking/SessionDataTask.swift /Users/gem/Desktop/MovieMoya/the-movie-db/Pods/Kingfisher/Sources/Image/ImageTransition.swift /Users/gem/Desktop/MovieMoya/the-movie-db/Pods/Kingfisher/Sources/General/KingfisherOptionsInfo.swift /Users/gem/Desktop/MovieMoya/the-movie-db/Pods/Kingfisher/Sources/Networking/ImageDownloader.swift /Users/gem/Desktop/MovieMoya/the-movie-db/Pods/Kingfisher/Sources/General/ImageSource/ImageDataProvider.swift /Users/gem/Desktop/MovieMoya/the-movie-db/Pods/Kingfisher/Sources/Image/Placeholder.swift /Users/gem/Desktop/MovieMoya/the-movie-db/Pods/Kingfisher/Sources/General/KingfisherManager.swift /Users/gem/Desktop/MovieMoya/the-movie-db/Pods/Kingfisher/Sources/Networking/ImagePrefetcher.swift /Users/gem/Desktop/MovieMoya/the-movie-db/Pods/Kingfisher/Sources/Extensions/UIButton+Kingfisher.swift /Users/gem/Desktop/MovieMoya/the-movie-db/Pods/Kingfisher/Sources/Extensions/ImageView+Kingfisher.swift /Users/gem/Desktop/MovieMoya/the-movie-db/Pods/Kingfisher/Sources/General/Kingfisher.swift /Users/gem/Desktop/MovieMoya/the-movie-db/Pods/Kingfisher/Sources/Networking/ImageModifier.swift /Users/gem/Desktop/MovieMoya/the-movie-db/Pods/Kingfisher/Sources/Networking/RequestModifier.swift /Users/gem/Desktop/MovieMoya/the-movie-db/Pods/Kingfisher/Sources/Networking/RedirectHandler.swift /Users/gem/Desktop/MovieMoya/the-movie-db/Pods/Kingfisher/Sources/Image/Filter.swift /Users/gem/Desktop/MovieMoya/the-movie-db/Pods/Kingfisher/Sources/Cache/CacheSerializer.swift /Users/gem/Desktop/MovieMoya/the-movie-db/Pods/Kingfisher/Sources/Cache/FormatIndicatedCacheSerializer.swift /Users/gem/Desktop/MovieMoya/the-movie-db/Pods/Kingfisher/Sources/General/KingfisherError.swift /Users/gem/Desktop/MovieMoya/the-movie-db/Pods/Kingfisher/Sources/Networking/ImageDataProcessor.swift /Users/gem/Desktop/MovieMoya/the-movie-db/Pods/Kingfisher/Sources/Image/ImageProcessor.swift /Users/gem/Desktop/MovieMoya/the-movie-db/Pods/Kingfisher/Sources/Views/Indicator.swift /Users/gem/Desktop/MovieMoya/the-movie-db/Pods/Kingfisher/Sources/Utility/SizeExtensions.swift /Users/gem/Desktop/MovieMoya/the-movie-db/Pods/Kingfisher/Sources/Utility/ExtensionHelpers.swift /Users/gem/Desktop/MovieMoya/the-movie-db/Pods/Kingfisher/Sources/Image/ImageFormat.swift /Users/gem/Desktop/MovieMoya/the-movie-db/Pods/Kingfisher/Sources/Utility/Result.swift /Users/gem/Desktop/MovieMoya/the-movie-db/Pods/Kingfisher/Sources/Views/AnimatedImageView.swift /Users/gem/Desktop/MovieMoya/the-movie-db/Pods/Kingfisher/Sources/Utility/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/gem/Desktop/MovieMoya/the-movie-db/Pods/Target\ Support\ Files/Kingfisher/Kingfisher-umbrella.h /Users/gem/Desktop/MovieMoya/the-movie-db/Pods/Kingfisher/Sources/Kingfisher.h /Users/gem/Desktop/MovieMoya/the-movie-db/DerivedData/TheNewMovie/Build/Intermediates.noindex/IBDesignables/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
import hades.graphics_shader; extern(C) { void gr_postprocessor_create(); void gr_postprocessor_destroy(); int gr_postprocessor_attach(gr_shader *s); void gr_postprocessor_detach(int id); void gr_postprocessor_commit(); }
D
/** * Authors: Szabo Bogdan <szabobogdan@yahoo.com> * Date: 9 29, 2015 * License: Subject to the terms of the MIT license, as written in the included LICENSE.txt file. * Copyright: Public Domain */ module swaggerize.test.validation; import swaggerize.validation; import swaggerize.definitions; import swaggerize.parser; import swaggerize.exceptions; import vibe.http.server; import vibe.data.json; import std.datetime; import std.stdio; //@testName("it should raise exception when path validation fails") unittest { HTTPServerRequest request = new HTTPServerRequest(Clock.currTime, 8080); request.method = HTTPMethod.GET; request.path = "/api/test/asd"; request.params["id"] = "asd"; request.headers["Content-Type"] = "application/json"; Parameter parameter; parameter.in_ = Parameter.In.path; parameter.name = "id"; parameter.other = Json.emptyObject; parameter.other["type"] = "integer"; Operation operation; operation.responses["200"] = Response(); operation.parameters ~= parameter; Swagger definition; definition.basePath = "/api"; definition.paths["/test/{id}"] = Path(); definition.paths["/test/{id}"].operations[Path.OperationsType.get] = operation; bool exceptionRaised = false; try { request.validate!(Parameter.In.path)(definition); } catch(SwaggerValidationException e) { exceptionRaised = true; } assert(exceptionRaised); } //@testName("it should not raise exception when path validation succedes") unittest { HTTPServerRequest request = new HTTPServerRequest(Clock.currTime, 8080); request.method = HTTPMethod.GET; request.path = "/api/test/1"; request.params["id"] = "1"; request.headers["Content-Type"] = "application/json"; Parameter parameter; parameter.in_ = Parameter.In.path; parameter.name = "id"; parameter.other = Json.emptyObject; parameter.other["type"] = "integer"; Operation operation; operation.responses["200"] = Response(); operation.parameters ~= parameter; Swagger definition; definition.basePath = "/api"; definition.paths["/test/{id}"] = Path(); definition.paths["/test/{id}"].operations[Path.OperationsType.get] = operation; request.validate!(Parameter.In.path)(definition); } //@testName("it should raise exception when query validation fails") unittest { HTTPServerRequest request = new HTTPServerRequest(Clock.currTime, 8080); request.method = HTTPMethod.GET; request.path = "/api/test"; request.query["id"] = "asd"; request.headers["Content-Type"] = "application/json"; Parameter parameter; parameter.in_ = Parameter.In.query; parameter.name = "id"; parameter.other = Json.emptyObject; parameter.other["type"] = "integer"; Operation operation; operation.responses["200"] = Response(); operation.parameters ~= parameter; Swagger definition; definition.basePath = "/api"; definition.paths["/test"] = Path(); definition.paths["/test"].operations[Path.OperationsType.get] = operation; bool exceptionRaised = false; try { request.validate!(Parameter.In.query)(definition); } catch(SwaggerValidationException e) { exceptionRaised = true; } assert(exceptionRaised); } //@testName("it should not raise exception when query succedes") unittest { HTTPServerRequest request = new HTTPServerRequest(Clock.currTime, 8080); request.method = HTTPMethod.GET; request.path = "/api/test"; request.query["id"] = "123"; request.headers["Content-Type"] = "application/json"; Parameter parameter; parameter.in_ = Parameter.In.query; parameter.name = "id"; parameter.other = Json.emptyObject; parameter.other["type"] = "integer"; Operation operation; operation.responses["200"] = Response(); operation.parameters ~= parameter; Swagger definition; definition.basePath = "/api"; definition.paths["/test"] = Path(); definition.paths["/test"].operations[Path.OperationsType.get] = operation; request.validate!(Parameter.In.query)(definition); } //@testName("it should raise exception when query parameter is missing") unittest { HTTPServerRequest request = new HTTPServerRequest(Clock.currTime, 8080); request.method = HTTPMethod.GET; request.path = "/api/test"; request.headers["Content-Type"] = "application/json"; Parameter parameter; parameter.in_ = Parameter.In.query; parameter.name = "id"; parameter.required = true; parameter.other = Json.emptyObject; parameter.other["type"] = "integer"; Operation operation; operation.responses["200"] = Response(); operation.parameters ~= parameter; Swagger definition; definition.basePath = "/api"; definition.paths["/test"] = Path(); definition.paths["/test"].operations[Path.OperationsType.get] = operation; bool exceptionRaised = false; try { request.validate!(Parameter.In.query)(definition); } catch(SwaggerParameterException e) { exceptionRaised = true; } assert(exceptionRaised); } //@testName("it should raise exception when there is an extra query parameter") unittest { HTTPServerRequest request = new HTTPServerRequest(Clock.currTime, 8080); request.method = HTTPMethod.GET; request.path = "/api/test"; request.query["id"] = "123"; request.query["value"] = "123"; request.headers["Content-Type"] = "application/json"; Parameter parameter; parameter.in_ = Parameter.In.query; parameter.name = "id"; parameter.other = Json.emptyObject; parameter.other["type"] = "integer"; Operation operation; operation.responses["200"] = Response(); operation.parameters ~= parameter; Swagger definition; definition.basePath = "/api"; definition.paths["/test"] = Path(); definition.paths["/test"].operations[Path.OperationsType.get] = operation; bool exceptionRaised = false; try { request.validate!(Parameter.In.query)(definition); } catch(SwaggerParameterException e) { exceptionRaised = true; } assert(exceptionRaised); } //@testName("it should not raise exception when there is an extra header parameter") unittest { HTTPServerRequest request = new HTTPServerRequest(Clock.currTime, 8080); request.method = HTTPMethod.GET; request.path = "/api/test"; request.headers["id"] = "123"; request.headers["Content-Type"] = "application/json"; Operation operation; operation.responses["200"] = Response(); Swagger definition; definition.basePath = "/api"; definition.paths["/test"] = Path(); definition.paths["/test"].operations[Path.OperationsType.get] = operation; request.validateExistence!(Parameter.In.header)(definition); } //@testName("it should raise exception when there is an extra required header parameter") unittest { HTTPServerRequest request = new HTTPServerRequest(Clock.currTime, 8080); request.method = HTTPMethod.GET; request.path = "/api/test"; request.headers["id"] = "123"; request.headers["Content-Type"] = "application/json"; Parameter parameter; parameter.in_ = Parameter.In.header; parameter.name = "id"; parameter.required = true; parameter.other = Json.emptyObject; parameter.other["type"] = "integer"; Operation operation; operation.responses["200"] = Response(); Swagger definition; definition.basePath = "/api"; definition.paths["/test"] = Path(); definition.paths["/test"].operations[Path.OperationsType.get] = operation; bool exceptionRaised = false; try { request.validateExistence!(Parameter.In.header)(definition); } catch(SwaggerParameterException e) { exceptionRaised = true; } assert(!exceptionRaised); } //@testName("it should raise exception when required body root property is missing") unittest { auto definition = swaggerizeYaml("./source/test/examples/bodyValidation.yaml"); HTTPServerRequest request = new HTTPServerRequest(Clock.currTime, 8080); request.method = HTTPMethod.GET; request.path = "/department"; request.json = `{ }`.parseJsonString; request.headers["Content-Type"] = "application/json"; request.headers["Content-Type"] = "application/json"; bool exceptionRaised = false; try { request.validateBody(definition); } catch (SwaggerParameterException e) { exceptionRaised = true; } assert(exceptionRaised); } //@testName("it should raise exception when body type is invalid") unittest { auto definition = swaggerizeYaml("./source/test/examples/bodyValidation.yaml"); HTTPServerRequest request = new HTTPServerRequest(Clock.currTime, 8080); request.method = HTTPMethod.GET; request.path = "/department"; request.json = `{ "department": "hello" }`.parseJsonString; request.headers["Content-Type"] = "application/json"; bool exceptionRaised = false; try { request.validateBody(definition); } catch (SwaggerValidationException e) { exceptionRaised = true; } assert(exceptionRaised); } //@testName("it should raise exception when required schema property is missing") unittest { auto definition = swaggerizeYaml("./source/test/examples/bodyValidation.yaml"); HTTPServerRequest request = new HTTPServerRequest(Clock.currTime, 8080); request.method = HTTPMethod.GET; request.path = "/department"; request.json = `{ "department": { } }`.parseJsonString; request.headers["Content-Type"] = "application/json"; bool exceptionRaised = false; try { request.validateBody(definition); } catch (SwaggerParameterException e) { exceptionRaised = true; } assert(exceptionRaised); } //@testName("it should raise exception when extra params are found") unittest { auto definition = swaggerizeYaml("./source/test/examples/bodyValidation.yaml"); HTTPServerRequest request = new HTTPServerRequest(Clock.currTime, 8080); request.method = HTTPMethod.GET; request.path = "/department"; request.json = `{ "department": { "number": "one", "name": "hello" } }`.parseJsonString; request.headers["Content-Type"] = "application/json"; bool exceptionRaised = false; try { request.validateBody(definition); } catch (SwaggerParameterException e) { exceptionRaised = true; } assert(exceptionRaised); } //@testName("it should raise exception when schema type is invalid") unittest { auto definition = swaggerizeYaml("./source/test/examples/bodyValidation.yaml"); HTTPServerRequest request = new HTTPServerRequest(Clock.currTime, 8080); request.method = HTTPMethod.GET; request.path = "/department"; request.json = `{ "department": { "number": "one" } }`.parseJsonString; request.headers["Content-Type"] = "application/json"; bool exceptionRaised; try { request.validateBody(definition); } catch (SwaggerValidationException e) { exceptionRaised = true; } assert(exceptionRaised); } //@testName("it should not raise exception when body data is valid") unittest { auto definition = swaggerizeYaml("./source/test/examples/bodyValidation.yaml"); HTTPServerRequest request = new HTTPServerRequest(Clock.currTime, 8080); request.method = HTTPMethod.GET; request.path = "/department"; request.json = `{ "department": { "number": 1 } }`.parseJsonString; request.headers["Content-Type"] = "application/json"; request.validateBody(definition); } //@testName("it should not raise exception when nested body data is valid") unittest { auto definition = swaggerizeYaml("./source/test/examples/bodyValidation.yaml"); HTTPServerRequest request = new HTTPServerRequest(Clock.currTime, 8080); request.method = HTTPMethod.GET; request.path = "/department_deep"; request.json = `{ "department": {"data": {"number": 1 } } }`.parseJsonString; request.headers["Content-Type"] = "application/json"; request.validateBody(definition); }
D
const input = `1,380,379,385,1008,2689,888873,381,1005,381,12,99,109,2690,1102,0,1,383,1101,0,0,382,21001,382,0,1,20102,1,383,2,21101,0,37,0,1105,1,578,4,382,4,383,204,1,1001,382,1,382,1007,382,41,381,1005,381,22,1001,383,1,383,1007,383,25,381,1005,381,18,1006,385,69,99,104,-1,104,0,4,386,3,384,1007,384,0,381,1005,381,94,107,0,384,381,1005,381,108,1105,1,161,107,1,392,381,1006,381,161,1101,-1,0,384,1106,0,119,1007,392,39,381,1006,381,161,1102,1,1,384,20101,0,392,1,21101,23,0,2,21102,0,1,3,21102,138,1,0,1105,1,549,1,392,384,392,21001,392,0,1,21101,23,0,2,21101,3,0,3,21102,1,161,0,1105,1,549,1101,0,0,384,20001,388,390,1,20101,0,389,2,21101,0,180,0,1106,0,578,1206,1,213,1208,1,2,381,1006,381,205,20001,388,390,1,20101,0,389,2,21101,205,0,0,1105,1,393,1002,390,-1,390,1102,1,1,384,21001,388,0,1,20001,389,391,2,21101,228,0,0,1105,1,578,1206,1,261,1208,1,2,381,1006,381,253,20101,0,388,1,20001,389,391,2,21101,253,0,0,1106,0,393,1002,391,-1,391,1101,0,1,384,1005,384,161,20001,388,390,1,20001,389,391,2,21101,279,0,0,1106,0,578,1206,1,316,1208,1,2,381,1006,381,304,20001,388,390,1,20001,389,391,2,21101,0,304,0,1106,0,393,1002,390,-1,390,1002,391,-1,391,1101,0,1,384,1005,384,161,20102,1,388,1,20101,0,389,2,21101,0,0,3,21101,0,338,0,1106,0,549,1,388,390,388,1,389,391,389,21001,388,0,1,21002,389,1,2,21102,4,1,3,21101,0,365,0,1105,1,549,1007,389,24,381,1005,381,75,104,-1,104,0,104,0,99,0,1,0,0,0,0,0,0,230,18,20,1,1,20,109,3,21201,-2,0,1,22101,0,-1,2,21101,0,0,3,21102,1,414,0,1106,0,549,22102,1,-2,1,22102,1,-1,2,21101,0,429,0,1105,1,601,2102,1,1,435,1,386,0,386,104,-1,104,0,4,386,1001,387,-1,387,1005,387,451,99,109,-3,2106,0,0,109,8,22202,-7,-6,-3,22201,-3,-5,-3,21202,-4,64,-2,2207,-3,-2,381,1005,381,492,21202,-2,-1,-1,22201,-3,-1,-3,2207,-3,-2,381,1006,381,481,21202,-4,8,-2,2207,-3,-2,381,1005,381,518,21202,-2,-1,-1,22201,-3,-1,-3,2207,-3,-2,381,1006,381,507,2207,-3,-4,381,1005,381,540,21202,-4,-1,-1,22201,-3,-1,-3,2207,-3,-4,381,1006,381,529,22102,1,-3,-7,109,-8,2106,0,0,109,4,1202,-2,41,566,201,-3,566,566,101,639,566,566,2101,0,-1,0,204,-3,204,-2,204,-1,109,-4,2105,1,0,109,3,1202,-1,41,594,201,-2,594,594,101,639,594,594,20102,1,0,-2,109,-3,2106,0,0,109,3,22102,25,-2,1,22201,1,-1,1,21101,0,521,2,21102,1,1011,3,21102,1,1025,4,21102,630,1,0,1106,0,456,21201,1,1664,-2,109,-3,2105,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,2,2,0,2,0,2,0,2,0,0,2,2,0,2,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,2,0,0,2,0,1,1,0,0,0,0,2,0,0,2,0,2,2,2,2,0,2,0,0,0,2,2,0,0,2,2,2,2,0,0,0,0,0,2,0,0,0,0,2,2,0,1,1,0,0,0,0,0,2,0,0,0,2,0,0,0,0,0,0,2,2,0,2,0,0,0,0,2,0,0,0,0,2,0,0,0,0,2,2,2,0,0,1,1,0,0,2,2,2,0,0,0,2,0,0,0,0,0,2,2,0,0,2,0,2,0,0,0,2,2,0,0,0,2,0,0,0,2,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,2,0,0,0,0,2,0,0,2,0,0,0,0,2,0,0,2,0,2,0,2,0,2,0,0,1,1,0,0,0,0,0,2,2,0,0,2,2,0,0,0,0,2,0,0,2,2,0,0,0,2,2,0,0,2,0,0,0,2,2,2,2,2,0,2,0,1,1,0,0,0,0,2,0,2,0,0,2,0,0,0,0,0,0,2,0,0,2,0,2,2,2,0,2,2,2,0,0,0,0,0,2,0,0,2,0,0,1,1,0,2,0,0,2,0,0,0,0,2,0,0,0,0,2,2,0,2,0,0,0,0,2,0,0,0,0,0,2,0,2,0,0,2,0,0,2,0,0,1,1,0,2,2,2,0,0,0,0,2,2,2,2,2,2,0,0,0,0,0,0,0,2,0,0,2,0,2,0,2,2,0,2,2,0,2,0,2,0,0,1,1,0,0,2,0,0,2,0,2,0,0,2,0,0,2,0,0,0,2,0,0,0,0,2,0,0,2,0,0,2,2,0,2,0,0,0,0,2,2,0,1,1,0,0,2,2,0,0,2,2,0,2,2,0,0,0,0,0,2,0,0,0,0,2,2,2,0,0,2,0,2,0,2,2,0,0,2,0,2,0,0,1,1,0,0,2,2,2,0,0,2,2,0,2,2,2,0,0,0,2,2,2,0,2,0,0,0,0,0,2,0,0,2,0,2,0,0,0,0,0,0,0,1,1,0,2,0,0,0,2,2,0,2,0,0,2,0,2,2,2,0,0,2,2,0,2,0,0,0,0,0,0,2,2,0,2,2,0,2,0,0,2,0,1,1,0,0,2,0,0,2,2,0,0,0,0,0,2,2,0,2,2,2,0,2,0,2,2,2,0,0,2,0,2,2,2,0,0,0,0,0,0,2,0,1,1,0,2,0,2,0,2,2,2,2,0,0,0,2,0,0,0,2,2,0,0,0,0,2,0,2,2,0,0,0,0,2,0,2,0,0,2,0,0,0,1,1,0,0,0,0,2,0,0,2,0,0,2,2,0,2,0,0,0,2,0,0,0,0,0,0,2,0,0,2,0,0,0,0,0,0,0,0,0,2,0,1,1,0,2,0,0,0,2,0,0,0,2,2,0,2,0,0,2,0,0,2,2,0,2,0,0,2,0,0,0,0,0,0,0,0,2,0,0,2,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,34,58,37,19,14,62,51,10,28,52,86,20,39,30,61,36,77,73,19,11,17,74,7,54,40,59,20,92,18,13,85,72,83,58,18,68,10,22,94,22,25,40,67,96,55,96,42,16,80,80,96,35,19,79,81,63,91,5,72,68,80,93,79,36,91,47,71,82,45,29,51,36,10,62,57,29,17,16,4,88,75,81,70,77,32,2,38,37,35,86,41,35,61,71,72,22,14,33,12,10,10,56,30,3,90,71,24,62,69,31,47,2,18,77,43,20,64,85,50,43,43,73,16,23,98,4,23,53,82,15,88,1,39,78,43,57,65,8,45,79,17,44,32,76,31,3,25,71,45,16,42,61,89,21,93,4,98,66,68,5,13,19,48,65,29,5,24,59,29,49,57,39,21,96,10,8,25,82,17,42,46,49,83,4,81,32,14,7,76,62,31,74,55,19,39,63,89,41,38,28,34,34,88,7,77,43,87,10,47,85,39,31,88,69,40,72,51,49,64,46,64,14,66,95,95,58,38,88,82,35,6,58,3,21,33,58,9,95,43,52,13,22,22,10,11,47,35,33,31,58,93,83,13,14,55,71,88,42,73,83,91,84,62,78,80,15,26,50,8,15,6,91,89,3,12,53,47,47,82,67,12,77,6,63,88,94,53,19,97,36,34,59,91,27,37,45,44,31,8,58,16,7,74,76,83,17,28,42,85,19,1,61,73,84,37,15,43,52,80,48,51,98,70,77,28,55,78,85,64,32,22,82,69,7,82,55,78,24,5,89,55,4,34,28,71,76,81,90,96,2,2,77,41,32,24,60,10,11,26,64,66,19,11,77,11,82,81,1,52,2,79,43,47,87,63,73,3,81,69,66,53,4,83,88,13,5,62,94,55,58,4,93,96,58,40,69,64,56,80,71,85,44,45,24,80,59,53,15,85,92,89,95,69,77,53,27,72,3,54,49,9,35,10,85,43,86,9,42,69,29,64,96,17,72,47,24,2,13,40,45,62,19,41,85,28,68,73,20,52,56,19,57,1,36,64,18,26,41,94,81,45,35,29,32,28,87,86,53,71,54,67,68,47,53,17,40,61,58,74,2,51,43,23,62,54,13,80,67,88,94,1,62,85,7,12,87,51,4,69,25,57,6,79,94,15,75,93,46,19,28,84,72,84,59,60,59,59,14,11,30,57,53,75,83,72,61,65,50,26,49,23,40,82,11,67,8,55,13,22,41,32,33,89,37,69,11,24,24,8,21,89,11,46,89,88,59,3,7,43,85,74,92,72,60,85,82,33,82,71,14,21,41,4,78,88,4,22,81,30,92,17,9,62,69,84,47,6,86,49,94,11,96,21,1,5,1,45,19,60,59,17,85,67,42,21,11,79,39,27,72,54,19,69,50,52,78,78,6,16,96,86,37,58,79,9,45,10,73,29,53,75,63,50,66,6,69,8,74,68,88,9,88,87,50,34,45,12,43,43,58,14,29,32,77,77,97,45,29,41,94,21,91,52,22,74,44,48,11,20,68,9,51,7,85,93,74,59,16,34,60,12,3,18,17,4,71,44,49,79,68,54,96,74,21,74,60,59,16,77,65,97,84,54,52,37,95,9,3,41,9,72,82,82,95,31,71,56,50,59,93,57,79,16,9,74,72,47,1,9,5,55,63,64,80,40,93,54,11,57,26,76,19,85,41,80,90,92,27,61,24,83,93,96,95,28,68,80,11,60,65,36,2,46,75,59,52,11,36,74,62,52,6,23,85,93,61,36,26,70,2,13,97,52,92,96,87,63,63,31,2,50,25,34,79,46,4,48,51,74,96,74,7,43,82,84,50,59,53,13,51,8,81,36,93,10,31,10,50,76,69,33,3,71,1,1,65,68,57,69,15,64,81,59,38,38,89,79,80,52,44,59,26,96,21,38,38,79,2,96,2,92,73,49,14,71,74,66,94,98,63,28,59,26,30,67,1,61,84,92,47,24,27,41,57,95,89,6,96,48,43,7,82,42,5,27,15,32,89,53,3,35,63,84,97,92,77,50,38,73,10,50,89,95,96,77,61,51,90,22,75,41,77,1,14,72,68,91,10,80,28,25,10,86,54,10,87,55,40,79,16,35,8,82,51,70,84,12,72,74,4,88,71,69,83,9,55,10,57,9,3,40,74,72,61,75,64,54,32,61,26,53,48,45,22,6,83,21,21,9,4,7,65,98,78,17,54,35,95,79,36,53,59,84,53,14,20,94,12,31,54,86,39,95,82,38,8,22,58,50,27,32,53,79,49,71,76,18,64,75,64,88,58,88,27,62,31,54,11,59,11,3,42,66,85,41,888873`; import cpu; import std.stdio; import std.algorithm; import std.range; import std.array; import std.conv; struct Point{ int x, y; } void main(){ long[] insts = input.split(",").map!(to!long).array; insts[0] = 2; // writeln(insts); IOPort input, output; CPU cpu = CPU(insts, &input, &output); const w = 42, h = 25; char[] board = new char[w*h]; board[] = ' '; while(true){ const stat = cpu.run(); writeln(stat, " outtiles: ", output.length/3); int[Point] tiles; foreach(ch; output.data.chunks(3).map!array){ Point p = Point(cast(int)ch[0], cast(int)ch[1]); int t = cast(int)ch[2]; if( p.x < 0){ writeln("score: ", t); continue; } tiles[p] = t; // w = max(w, p.x); // h = max(h, p.y); } // h++; // w++; output.data = []; writeln(w, ", ", h); foreach(p, t; tiles){ if(t == 1) board[p.y*w + p.x] = 'W'; else if(t == 2) board[p.y*w + p.x] = 'B'; else if(t == 3) board[p.y*w + p.x] = 'P'; else if(t == 4) board[p.y*w + p.x] = 'O'; else board[p.y*w + p.x] = ' '; } /*foreach(i, x; board){ if(i % w == 0) writeln(); write(x); }*/ //auto inp = readln(); // writeln('`', inp, '`'); auto pIndex = board.length - board.find('P').length; auto pCol = pIndex % w; auto ballIndex = board.length - board.find('O').length; auto bCol = ballIndex % w; if(pCol < bCol){ input ~= 1; } else if(pCol > bCol){ input ~= -1;} else { input ~= 0;} if(stat == cpu.RetCode.Halted){ break; } /* if(inp[0] == 'a'){ writeln("left"); input ~= -1; } else if(inp[0] == 's'){ writeln("right"); input ~= 1; } else { writeln("neutral"); input ~= 0; }*/ } writeln(output.data.chunks(3).count!(x => x[2] == 2)); }
D
module gdrive.models.permission; import std.json; import std.datetime : SysTime; import common.common; import vibe.data.json : optional; public struct Permission { /** The ID of this permission. This is a unique identifier for the grantee, and is published in User resources as permissionId. IDs should be treated as opaque values.*/ private static const string ID = "id"; string _id; mixin(GetterSetter!("string", "Permission")(ID)); /** A link to the user's profile photo, if available.*/ private static const string PHOTOLINK = "photoLink"; @optional string _photoLink; mixin(GetterSetter!("string", "Permission")(PHOTOLINK)); /** Identifies what kind of resource this is. Value: the fixed string "drive#permission".*/ private static const string KIND = "kind"; string _kind; mixin(GetterSetter!("string", "Permission")(KIND)); /** The time at which this permission will expire (RFC 3339 date-time). Expiration times have the following restrictions: - They can only be set on user and group permissions - The time must be in the future - The time cannot be more than a year in the future*/ private static const string EXPIRATIONTIME = "expirationTime"; string _expirationTime; mixin(GetterSetter!("string", "Permission")(EXPIRATIONTIME)); /** Details of whether the permissions on this shared drive item are inherited or directly on this item. This is an output-only field which is present only for shared drive items.*/ private static const string PERMISSIONDETAILS = "permissionDetails"; public struct PermissionDetails { /** Whether this permission is inherited. This field is always populated. This is an output-only field.*/ private static const string INHERITED = "inherited"; bool _inherited; mixin(GetterSetter!("bool", "PermissionDetails")(INHERITED)); /** The ID of the item from which this permission is inherited. This is an output-only field.*/ private static const string INHERITEDFROM = "inheritedFrom"; string _inheritedFrom; mixin(GetterSetter!("string", "PermissionDetails")(INHERITEDFROM)); /** The primary role for this user. While new values may be added in the future, the following are currently possible: - organizer - fileOrganizer - writer - commenter - reader*/ private static const string ROLE = "role"; string _role; mixin(GetterSetter!("string", "PermissionDetails")(ROLE)); /** The permission type for this user. While new values may be added in future, the following are currently possible: - file - member*/ private static const string PERMISSIONTYPE = "permissionType"; string _permissionType; mixin(GetterSetter!("string", "PermissionDetails")(PERMISSIONTYPE)); } PermissionDetails[] _permissionDetails; mixin(GetterSetter!("PermissionDetails[]", "Permission")(PERMISSIONDETAILS)); /** Deprecated - use permissionDetails instead.*/ private static const string TEAMDRIVEPERMISSIONDETAILS = "teamDrivePermissionDetails"; public struct TeamDrivePermissionDetails { /** Deprecated - use permissionDetails/inherited instead.*/ private static const string INHERITED = "inherited"; bool _inherited; mixin(GetterSetter!("bool", "TeamDrivePermissionDetails")(INHERITED)); /** Deprecated - use permissionDetails/permissionType instead.*/ private static const string TEAMDRIVEPERMISSIONTYPE = "teamDrivePermissionType"; string _teamDrivePermissionType; mixin(GetterSetter!("string", "TeamDrivePermissionDetails")(TEAMDRIVEPERMISSIONTYPE)); /** Deprecated - use permissionDetails/inheritedFrom instead.*/ private static const string INHERITEDFROM = "inheritedFrom"; string _inheritedFrom; mixin(GetterSetter!("string", "TeamDrivePermissionDetails")(INHERITEDFROM)); /** Deprecated - use permissionDetails/role instead.*/ private static const string ROLE = "role"; string _role; mixin(GetterSetter!("string", "TeamDrivePermissionDetails")(ROLE)); } TeamDrivePermissionDetails[] _teamDrivePermissionDetails; mixin(GetterSetter!("TeamDrivePermissionDetails[]", "Permission")(TEAMDRIVEPERMISSIONDETAILS)); /** The email address of the user or group to which this permission refers.*/ private static const string EMAILADDRESS = "emailAddress"; string _emailAddress; mixin(GetterSetter!("string", "Permission")(EMAILADDRESS)); /** The domain to which this permission refers.*/ private static const string DOMAIN = "domain"; string _domain; mixin(GetterSetter!("string", "Permission")(DOMAIN)); /** The "pretty" name of the value of the permission. The following is a list of examples for each type of permission: - user - User's full name, as defined for their Google account, such as "Joe Smith." - group - Name of the Google Group, such as "The Company Administrators." - domain - String domain name, such as "thecompany.com." - anyone - No displayName is present.*/ private static const string DISPLAYNAME = "displayName"; string _displayName; mixin(GetterSetter!("string", "Permission")(DISPLAYNAME)); /** Whether the permission allows the file to be discovered through search. This is only applicable for permissions of type domain or anyone.*/ private static const string ALLOWFILEDISCOVERY = "allowFileDiscovery"; bool _allowFileDiscovery; mixin(GetterSetter!("bool", "Permission")(ALLOWFILEDISCOVERY)); /** The type of the grantee. Valid values are: - user - group - domain - anyone When creating a permission, if type is user or group, you must provide an emailAddress for the user or group. When type is domain, you must provide a domain. There isn't extra information required for a anyone type.*/ private static const string TYPE = "type"; string _type; mixin(GetterSetter!("string", "Permission")(TYPE)); /** Whether the account associated with this permission has been deleted. This field only pertains to user and group permissions.*/ private static const string DELETED = "deleted"; bool _deleted; mixin(GetterSetter!("bool", "Permission")(DELETED)); /** The role granted by this permission. While new values may be supported in the future, the following are currently allowed: - owner - organizer - fileOrganizer - writer - commenter - reader*/ private static const string ROLE = "role"; string _role; mixin(GetterSetter!("string", "Permission")(ROLE)); /** Indicates the view for this permission. Only populated for permissions that belong to a view. published is the only supported value.*/ private static const string VIEW = "view"; string _view; mixin(GetterSetter!("string", "Permission")(VIEW)); }
D
the state of being under the control of another person someone held in bondage
D
module dido.panel; // This is a custom-made GUI for dido // reflow and render is pretty manual public import dido.panel.mainpanel; public import dido.panel.menupanel; public import dido.panel.commandlinepanel; public import dido.panel.textarea; public import dido.panel.solutionpanel; public import dido.panel.outputpanel; public import dido.panel.westpanel;
D
/Users/andyzhu/Git/IOS_Development/SmashTag/DerivedData/SmashTag/Build/Intermediates/SmashTag.build/Debug-iphonesimulator/SmashTag.build/Objects-normal/x86_64/MediaItem.o : /Users/andyzhu/Git/IOS_Development/SmashTag/SmashTag/AppDelegate.swift /Users/andyzhu/Git/IOS_Development/SmashTag/SmashTag/Twitter/TwitterRequest.swift /Users/andyzhu/Git/IOS_Development/SmashTag/SmashTag/Twitter/User.swift /Users/andyzhu/Git/IOS_Development/SmashTag/SmashTag/TweetTableViewController.swift /Users/andyzhu/Git/IOS_Development/SmashTag/SmashTag/Twitter/MediaItem.swift /Users/andyzhu/Git/IOS_Development/SmashTag/SmashTag/Twitter/Tweet.swift /Users/andyzhu/Git/IOS_Development/SmashTag/SmashTag/TweetTableViewCell.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 /Users/andyzhu/Git/IOS_Development/SmashTag/DerivedData/SmashTag/Build/Intermediates/SmashTag.build/Debug-iphonesimulator/SmashTag.build/Objects-normal/x86_64/MediaItem~partial.swiftmodule : /Users/andyzhu/Git/IOS_Development/SmashTag/SmashTag/AppDelegate.swift /Users/andyzhu/Git/IOS_Development/SmashTag/SmashTag/Twitter/TwitterRequest.swift /Users/andyzhu/Git/IOS_Development/SmashTag/SmashTag/Twitter/User.swift /Users/andyzhu/Git/IOS_Development/SmashTag/SmashTag/TweetTableViewController.swift /Users/andyzhu/Git/IOS_Development/SmashTag/SmashTag/Twitter/MediaItem.swift /Users/andyzhu/Git/IOS_Development/SmashTag/SmashTag/Twitter/Tweet.swift /Users/andyzhu/Git/IOS_Development/SmashTag/SmashTag/TweetTableViewCell.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 /Users/andyzhu/Git/IOS_Development/SmashTag/DerivedData/SmashTag/Build/Intermediates/SmashTag.build/Debug-iphonesimulator/SmashTag.build/Objects-normal/x86_64/MediaItem~partial.swiftdoc : /Users/andyzhu/Git/IOS_Development/SmashTag/SmashTag/AppDelegate.swift /Users/andyzhu/Git/IOS_Development/SmashTag/SmashTag/Twitter/TwitterRequest.swift /Users/andyzhu/Git/IOS_Development/SmashTag/SmashTag/Twitter/User.swift /Users/andyzhu/Git/IOS_Development/SmashTag/SmashTag/TweetTableViewController.swift /Users/andyzhu/Git/IOS_Development/SmashTag/SmashTag/Twitter/MediaItem.swift /Users/andyzhu/Git/IOS_Development/SmashTag/SmashTag/Twitter/Tweet.swift /Users/andyzhu/Git/IOS_Development/SmashTag/SmashTag/TweetTableViewCell.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
D
/Users/merrill/workspace/rust_tutorial/final_project/hello/target/debug/deps/main-1fa1fd695b6193ce: src/bin/main.rs /Users/merrill/workspace/rust_tutorial/final_project/hello/target/debug/deps/main-1fa1fd695b6193ce.d: src/bin/main.rs src/bin/main.rs:
D
/Users/DboyLiao/Works/Projects/lipsync_tools/mobile/NumSwift/NumSwift/DerivedData/NumSwift/Build/Intermediates/NumSwift.build/Debug-iphoneos/NumSwift.build/Objects-normal/armv7/Complex.o : /Users/DboyLiao/Works/Projects/lipsync_tools/mobile/NumSwift/NumSwift/Source/Trigonometry.swift /Users/DboyLiao/Works/Projects/lipsync_tools/mobile/NumSwift/NumSwift/Source/FFT.swift /Users/DboyLiao/Works/Projects/lipsync_tools/mobile/NumSwift/NumSwift/Source/Convolution.swift /Users/DboyLiao/Works/Projects/lipsync_tools/mobile/NumSwift/NumSwift/Source/Signal/Hilbert.swift /Users/DboyLiao/Works/Projects/lipsync_tools/mobile/NumSwift/NumSwift/Source/Power.swift /Users/DboyLiao/Works/Projects/lipsync_tools/mobile/NumSwift/NumSwift/Source/Sort.swift /Users/DboyLiao/Works/Projects/lipsync_tools/mobile/NumSwift/NumSwift/Source/Utilities.swift /Users/DboyLiao/Works/Projects/lipsync_tools/mobile/NumSwift/NumSwift/Source/Exponential.swift /Users/DboyLiao/Works/Projects/lipsync_tools/mobile/NumSwift/NumSwift/Source/Complex.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/armv7/Swift.swiftmodule /Users/DboyLiao/Works/Projects/lipsync_tools/mobile/NumSwift/NumSwift/NumSwift/NumSwift.h /Users/DboyLiao/Works/Projects/lipsync_tools/mobile/NumSwift/NumSwift/DerivedData/NumSwift/Build/Intermediates/NumSwift.build/Debug-iphoneos/NumSwift.build/unextended-module.modulemap /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/armv7/UIKit.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/armv7/Foundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/armv7/Darwin.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/armv7/Dispatch.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/armv7/ObjectiveC.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/armv7/CoreGraphics.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/armv7/CoreImage.swiftmodule /Users/DboyLiao/Works/Projects/lipsync_tools/mobile/NumSwift/NumSwift/DerivedData/NumSwift/Build/Intermediates/NumSwift.build/Debug-iphoneos/NumSwift.build/Objects-normal/armv7/Complex~partial.swiftmodule : /Users/DboyLiao/Works/Projects/lipsync_tools/mobile/NumSwift/NumSwift/Source/Trigonometry.swift /Users/DboyLiao/Works/Projects/lipsync_tools/mobile/NumSwift/NumSwift/Source/FFT.swift /Users/DboyLiao/Works/Projects/lipsync_tools/mobile/NumSwift/NumSwift/Source/Convolution.swift /Users/DboyLiao/Works/Projects/lipsync_tools/mobile/NumSwift/NumSwift/Source/Signal/Hilbert.swift /Users/DboyLiao/Works/Projects/lipsync_tools/mobile/NumSwift/NumSwift/Source/Power.swift /Users/DboyLiao/Works/Projects/lipsync_tools/mobile/NumSwift/NumSwift/Source/Sort.swift /Users/DboyLiao/Works/Projects/lipsync_tools/mobile/NumSwift/NumSwift/Source/Utilities.swift /Users/DboyLiao/Works/Projects/lipsync_tools/mobile/NumSwift/NumSwift/Source/Exponential.swift /Users/DboyLiao/Works/Projects/lipsync_tools/mobile/NumSwift/NumSwift/Source/Complex.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/armv7/Swift.swiftmodule /Users/DboyLiao/Works/Projects/lipsync_tools/mobile/NumSwift/NumSwift/NumSwift/NumSwift.h /Users/DboyLiao/Works/Projects/lipsync_tools/mobile/NumSwift/NumSwift/DerivedData/NumSwift/Build/Intermediates/NumSwift.build/Debug-iphoneos/NumSwift.build/unextended-module.modulemap /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/armv7/UIKit.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/armv7/Foundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/armv7/Darwin.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/armv7/Dispatch.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/armv7/ObjectiveC.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/armv7/CoreGraphics.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/armv7/CoreImage.swiftmodule /Users/DboyLiao/Works/Projects/lipsync_tools/mobile/NumSwift/NumSwift/DerivedData/NumSwift/Build/Intermediates/NumSwift.build/Debug-iphoneos/NumSwift.build/Objects-normal/armv7/Complex~partial.swiftdoc : /Users/DboyLiao/Works/Projects/lipsync_tools/mobile/NumSwift/NumSwift/Source/Trigonometry.swift /Users/DboyLiao/Works/Projects/lipsync_tools/mobile/NumSwift/NumSwift/Source/FFT.swift /Users/DboyLiao/Works/Projects/lipsync_tools/mobile/NumSwift/NumSwift/Source/Convolution.swift /Users/DboyLiao/Works/Projects/lipsync_tools/mobile/NumSwift/NumSwift/Source/Signal/Hilbert.swift /Users/DboyLiao/Works/Projects/lipsync_tools/mobile/NumSwift/NumSwift/Source/Power.swift /Users/DboyLiao/Works/Projects/lipsync_tools/mobile/NumSwift/NumSwift/Source/Sort.swift /Users/DboyLiao/Works/Projects/lipsync_tools/mobile/NumSwift/NumSwift/Source/Utilities.swift /Users/DboyLiao/Works/Projects/lipsync_tools/mobile/NumSwift/NumSwift/Source/Exponential.swift /Users/DboyLiao/Works/Projects/lipsync_tools/mobile/NumSwift/NumSwift/Source/Complex.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/armv7/Swift.swiftmodule /Users/DboyLiao/Works/Projects/lipsync_tools/mobile/NumSwift/NumSwift/NumSwift/NumSwift.h /Users/DboyLiao/Works/Projects/lipsync_tools/mobile/NumSwift/NumSwift/DerivedData/NumSwift/Build/Intermediates/NumSwift.build/Debug-iphoneos/NumSwift.build/unextended-module.modulemap /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/armv7/UIKit.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/armv7/Foundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/armv7/Darwin.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/armv7/Dispatch.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/armv7/ObjectiveC.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/armv7/CoreGraphics.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/armv7/CoreImage.swiftmodule
D
module perfontain.managers.hotkey; import std.experimental.all, perfontain; final class HotkeyManager { this() { PE.onKey.permanent(&onKey); } void update(string name, SDL_Keycode[] keys...) { auto e = _arr.find!(a => a.name == name); e.length || throwError(`trying to update unknown hotkey: %s`, name); PE.settings.hotkeys[name] = e[0].keys = keys.dup; } auto add(Hotkey h, bool permanent = true) { auto e = new Hotkey(h.tupleof); _arr ~= e; if(auto n = e.name) { if(auto p = n in PE.settings.hotkeys) { e.keys = *p; } else { PE.settings.hotkeys[n] = e.keys; } } return permanent ? null : new ConnectionPoint({ _arr = _arr.remove(_arr.countUntil(e)); }); } private: bool onKey(SDL_Keycode k, bool st) { if(st) { foreach(h; _arr) { if(h.keys.isPermutation(PE.window.keys)) { if(h.dg()) { return true; } break; } } } return false; } Hotkey*[] _arr; } struct Hotkey { this(string n, bool delegate() f, SDL_Keycode[] ks...) { dg = f; name = n; keys = ks.dup; } string name; bool delegate() dg; SDL_Keycode[] keys; }
D
module piped.text.lines; public import std.string : KeepTerminator; import std.range : isInputRange; import util; import piped.circularbuffer; import piped.threads; /** * Splits a source into Unix text lines. If 'keepTerminator' is set, \n will be kept on the resulting lines, * except maybe on the last line where it may not be in the source. */ auto splitLines(T)(T source, in KeepTerminator keepTerminator = KeepTerminator.no) { return LineRange(source.toSequencerThread(), keepTerminator); } private struct LineRange { private: CSequencerThread supplier; /// The thread that supplies us with text to line break. This pointer keeps it from being collected by the GC before we can read out all buffer data. It is also used to join that thread with ours, once all text is read. SBufferPtr* get; /// A shortcut to the supplier thread's 'get' buffer pointer. ℕ lineSize; /// Byte size of the current line including line-break characters. ℕ lineLength; /// The line length as returned by front(). Same as lineSize if line-breaks are kept. const(char)[] peek; /// A range of bytes that lie ahead in the buffer. It is extended when no line-break is found in it. bool _empty; /// Set, after the last available line has been popped. bool removeTerminator; /// If set, the returned lines will have line-break characters removed. @disable this(); this(CSequencerThread supplier, in KeepTerminator keepTerminator) { this.supplier = supplier; this.get = supplier.source; this.removeTerminator = (keepTerminator == KeepTerminator.no); this.supplier.addUser(); this.popFront(); } public: this(this) { this.supplier.addUser(); } ~this() { this.supplier.removeUser(); } @property bool empty() const pure nothrow { return this._empty; } void popFront() in { assert(!this._empty); } body { // popFront() 101: Release the buffer space we no longer need to expose through front(). this.get.commit(this.lineSize); this.peek.drop(this.lineSize); // Look for the next line-break in 'peek', eventually fetching more buffer space from our supplier. auto b = this.peek.ptr; try while (true) { // End or sentinel pointer const e = this.peek.ptr + this.peek.length; // First we skip as many blocks of machine word size that don't contain line-breaks as possible. for (auto skipFast = (e - b) / ℕ.sizeof; skipFast; skipFast--) { if (contains!'\n'( *(cast(ℕ*) b) )) break; b += ℕ.sizeof; } // Then we examine byte by byte and return when we find a complete line of text. while (b !is e) { if (*b == '\n') { this.lineLength = this.lineSize = b - this.peek.ptr + 1; this.lineLength -= this.removeTerminator; return; } b++; } // We require at least one more byte. If the supply is out, we catch the exception below. immutable pos = this.peek.length; this.peek = cast(const(char)[]) this.get.mapAtLeast(pos + 1); b = this.peek.ptr + pos; } catch (ConsumerStarvedException e) { // There is no more line-breaks in the text. We might still have an unterminated line in // the buffer though. Note: We get here a second time, if '_empty' isn't set below yet. this.peek = cast(const(char)[]) this.get.mapAvailable(); this.lineLength = this.lineSize = this.peek.length; this._empty = (this.lineSize == 0); } } @property const(char)[] front() const pure nothrow in { assert(!this._empty); } body { return this.peek[0 .. this.lineLength]; } } static assert(isInputRange!LineRange);
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/dsymbolsem.d, _dsymbolsem.d) * Documentation: https://dlang.org/phobos/dmd_dsymbolsem.html * Coverage: https://codecov.io/gh/dlang/dmd/src/master/src/dmd/dsymbolsem.d */ module dmd.dsymbolsem; import core.stdc.stdio; import core.stdc.string; import dmd.aggregate; import dmd.aliasthis; import dmd.arraytypes; import dmd.astcodegen; import dmd.attrib; import dmd.blockexit; import dmd.clone; import dmd.dcast; import dmd.dclass; import dmd.declaration; import dmd.denum; import dmd.dimport; import dmd.dinterpret; import dmd.dmodule; import dmd.dscope; import dmd.dstruct; import dmd.dsymbol; import dmd.dtemplate; import dmd.dversion; import dmd.errors; import dmd.escape; import dmd.expression; import dmd.expressionsem; import dmd.func; import dmd.globals; import dmd.id; import dmd.identifier; import dmd.init; import dmd.initsem; import dmd.hdrgen; import dmd.mars; import dmd.mtype; import dmd.nogc; import dmd.nspace; import dmd.objc; import dmd.opover; import dmd.parse; import dmd.root.filename; import dmd.root.outbuffer; import dmd.root.rmem; import dmd.root.rootobject; import dmd.semantic2; import dmd.semantic3; import dmd.sideeffect; import dmd.statementsem; import dmd.staticassert; import dmd.tokens; import dmd.utf; import dmd.utils; import dmd.statement; import dmd.target; import dmd.templateparamsem; import dmd.typesem; import dmd.visitor; enum LOG = false; /***************************************** * Create inclusive postblit for struct by aggregating * all the postblits in postblits[] with the postblits for * all the members. * Note the close similarity with AggregateDeclaration::buildDtor(), * and the ordering changes (runs forward instead of backwards). */ private extern (C++) FuncDeclaration buildPostBlit(StructDeclaration sd, Scope* sc) { //printf("StructDeclaration::buildPostBlit() %s\n", sd.toChars()); if (sd.isUnionDeclaration()) return null; // by default, the storage class of the created postblit StorageClass stc = STC.safe | STC.nothrow_ | STC.pure_ | STC.nogc; Loc declLoc = sd.postblits.dim ? sd.postblits[0].loc : sd.loc; Loc loc; // internal code should have no loc to prevent coverage // if any of the postblits are disabled, then the generated postblit // will be disabled for (size_t i = 0; i < sd.postblits.dim; i++) { stc |= sd.postblits[i].storage_class & STC.disable; } auto postblitCalls = new Statements(); // iterate through all the struct fields that are not disabled for (size_t i = 0; i < sd.fields.dim && !(stc & STC.disable); i++) { auto structField = sd.fields[i]; if (structField.storage_class & STC.ref_) continue; if (structField.overlapped) continue; // if it's a struct declaration or an array of structs Type tv = structField.type.baseElemOf(); if (tv.ty != Tstruct) continue; auto sdv = (cast(TypeStruct)tv).sym; // which has a postblit declaration if (!sdv.postblit) continue; assert(!sdv.isUnionDeclaration()); // perform semantic on the member postblit in order to // be able to aggregate it later on with the rest of the // postblits sdv.postblit.functionSemantic(); stc = mergeFuncAttrs(stc, sdv.postblit); stc = mergeFuncAttrs(stc, sdv.dtor); // if any of the struct member fields has disabled // its postblit, then `sd` is not copyable, so no // postblit is generated if (stc & STC.disable) { postblitCalls.setDim(0); break; } Expression ex; tv = structField.type.toBasetype(); if (tv.ty == Tstruct) { // this.v.__xpostblit() ex = new ThisExp(loc); ex = new DotVarExp(loc, ex, structField); // This is a hack so we can call postblits on const/immutable objects. ex = new AddrExp(loc, ex); ex = new CastExp(loc, ex, structField.type.mutableOf().pointerTo()); ex = new PtrExp(loc, ex); if (stc & STC.safe) stc = (stc & ~STC.safe) | STC.trusted; ex = new DotVarExp(loc, ex, sdv.postblit, false); ex = new CallExp(loc, ex); } else { // _ArrayPostblit((cast(S*)this.v.ptr)[0 .. n]) uinteger_t length = 1; while (tv.ty == Tsarray) { length *= (cast(TypeSArray)tv).dim.toUInteger(); tv = tv.nextOf().toBasetype(); } if (length == 0) continue; ex = new ThisExp(loc); ex = new DotVarExp(loc, ex, structField); // This is a hack so we can call postblits on const/immutable objects. ex = new DotIdExp(loc, ex, Id.ptr); ex = new CastExp(loc, ex, sdv.type.pointerTo()); if (stc & STC.safe) stc = (stc & ~STC.safe) | STC.trusted; ex = new SliceExp(loc, ex, new IntegerExp(loc, 0, Type.tsize_t), new IntegerExp(loc, length, Type.tsize_t)); // Prevent redundant bounds check (cast(SliceExp)ex).upperIsInBounds = true; (cast(SliceExp)ex).lowerIsLessThanUpper = true; ex = new CallExp(loc, new IdentifierExp(loc, Id._ArrayPostblit), ex); } postblitCalls.push(new ExpStatement(loc, ex)); // combine in forward order /* https://issues.dlang.org/show_bug.cgi?id=10972 * When the following field postblit calls fail, * this field should be destructed for Exception Safety. */ if (!sdv.dtor) continue; sdv.dtor.functionSemantic(); tv = structField.type.toBasetype(); if (tv.ty == Tstruct) { // this.v.__xdtor() ex = new ThisExp(loc); ex = new DotVarExp(loc, ex, structField); // This is a hack so we can call destructors on const/immutable objects. ex = new AddrExp(loc, ex); ex = new CastExp(loc, ex, structField.type.mutableOf().pointerTo()); ex = new PtrExp(loc, ex); if (stc & STC.safe) stc = (stc & ~STC.safe) | STC.trusted; ex = new DotVarExp(loc, ex, sdv.dtor, false); ex = new CallExp(loc, ex); } else { // _ArrayDtor((cast(S*)this.v.ptr)[0 .. n]) uinteger_t length = 1; while (tv.ty == Tsarray) { length *= (cast(TypeSArray)tv).dim.toUInteger(); tv = tv.nextOf().toBasetype(); } //if (n == 0) // continue; ex = new ThisExp(loc); ex = new DotVarExp(loc, ex, structField); // This is a hack so we can call destructors on const/immutable objects. ex = new DotIdExp(loc, ex, Id.ptr); ex = new CastExp(loc, ex, sdv.type.pointerTo()); if (stc & STC.safe) stc = (stc & ~STC.safe) | STC.trusted; ex = new SliceExp(loc, ex, new IntegerExp(loc, 0, Type.tsize_t), new IntegerExp(loc, length, Type.tsize_t)); // Prevent redundant bounds check (cast(SliceExp)ex).upperIsInBounds = true; (cast(SliceExp)ex).lowerIsLessThanUpper = true; ex = new CallExp(loc, new IdentifierExp(loc, Id._ArrayDtor), ex); } postblitCalls.push(new OnScopeStatement(loc, TOK.onScopeFailure, new ExpStatement(loc, ex))); } void checkShared() { if (sd.type.isShared()) stc |= STC.shared_; } // Build our own "postblit" which executes a, but only if needed. if (postblitCalls.dim || (stc & STC.disable)) { //printf("Building __fieldPostBlit()\n"); checkShared(); auto dd = new PostBlitDeclaration(declLoc, Loc.initial, stc, Id.__fieldPostblit); dd.generated = true; dd.storage_class |= STC.inference; dd.fbody = (stc & STC.disable) ? null : new CompoundStatement(loc, postblitCalls); sd.postblits.shift(dd); sd.members.push(dd); dd.dsymbolSemantic(sc); } // create __xpostblit, which is the generated postblit FuncDeclaration xpostblit = null; switch (sd.postblits.dim) { case 0: break; case 1: xpostblit = sd.postblits[0]; break; default: Expression e = null; stc = STC.safe | STC.nothrow_ | STC.pure_ | STC.nogc; for (size_t i = 0; i < sd.postblits.dim; i++) { auto fd = sd.postblits[i]; stc = mergeFuncAttrs(stc, fd); if (stc & STC.disable) { e = null; break; } Expression ex = new ThisExp(loc); ex = new DotVarExp(loc, ex, fd, false); ex = new CallExp(loc, ex); e = Expression.combine(e, ex); } checkShared(); auto dd = new PostBlitDeclaration(declLoc, Loc.initial, stc, Id.__aggrPostblit); dd.generated = true; dd.storage_class |= STC.inference; dd.fbody = new ExpStatement(loc, e); sd.members.push(dd); dd.dsymbolSemantic(sc); xpostblit = dd; break; } // Add an __xpostblit alias to make the inclusive postblit accessible if (xpostblit) { auto _alias = new AliasDeclaration(Loc.initial, Id.__xpostblit, xpostblit); _alias.dsymbolSemantic(sc); sd.members.push(_alias); _alias.addMember(sc, sd); // add to symbol table } return xpostblit; } private uint setMangleOverride(Dsymbol s, char* sym) { AttribDeclaration ad = s.isAttribDeclaration(); if (ad) { Dsymbols* decls = ad.include(null); uint nestedCount = 0; if (decls && decls.dim) for (size_t i = 0; i < decls.dim; ++i) nestedCount += setMangleOverride((*decls)[i], sym); return nestedCount; } else if (s.isFuncDeclaration() || s.isVarDeclaration()) { s.isDeclaration().mangleOverride = sym; return 1; } else return 0; } /************************************* * Does semantic analysis on the public face of declarations. */ extern(C++) void dsymbolSemantic(Dsymbol dsym, Scope* sc) { scope v = new DsymbolSemanticVisitor(sc); dsym.accept(v); } structalign_t getAlignment(AlignDeclaration ad, Scope* sc) { if (ad.salign != ad.UNKNOWN) return ad.salign; if (!ad.ealign) return ad.salign = STRUCTALIGN_DEFAULT; sc = sc.startCTFE(); ad.ealign = ad.ealign.expressionSemantic(sc); ad.ealign = resolveProperties(sc, ad.ealign); sc = sc.endCTFE(); ad.ealign = ad.ealign.ctfeInterpret(); if (ad.ealign.op == TOK.error) return ad.salign = STRUCTALIGN_DEFAULT; Type tb = ad.ealign.type.toBasetype(); auto n = ad.ealign.toInteger(); if (n < 1 || n & (n - 1) || structalign_t.max < n || !tb.isintegral()) { error(ad.loc, "alignment must be an integer positive power of 2, not %s", ad.ealign.toChars()); return ad.salign = STRUCTALIGN_DEFAULT; } return ad.salign = cast(structalign_t)n; } const(char)* getMessage(DeprecatedDeclaration dd) { if (auto sc = dd._scope) { dd._scope = null; sc = sc.startCTFE(); dd.msg = dd.msg.expressionSemantic(sc); dd.msg = resolveProperties(sc, dd.msg); sc = sc.endCTFE(); dd.msg = dd.msg.ctfeInterpret(); if (auto se = dd.msg.toStringExp()) dd.msgstr = se.toStringz().ptr; else dd.msg.error("compile time constant expected, not `%s`", dd.msg.toChars()); } return dd.msgstr; } // Returns true if a contract can appear without a function body. package bool allowsContractWithoutBody(FuncDeclaration funcdecl) { assert(!funcdecl.fbody); /* Contracts can only appear without a body when they are virtual * interface functions or abstract. */ Dsymbol parent = funcdecl.toParent(); InterfaceDeclaration id = parent.isInterfaceDeclaration(); if (!funcdecl.isAbstract() && (funcdecl.fensure || funcdecl.frequire) && !(id && funcdecl.isVirtual())) { auto cd = parent.isClassDeclaration(); if (!(cd && cd.isAbstract())) return false; } return true; } private extern(C++) final class DsymbolSemanticVisitor : Visitor { alias visit = Visitor.visit; Scope* sc; this(Scope* sc) { this.sc = sc; } override void visit(Dsymbol dsym) { dsym.error("%p has no semantic routine", dsym); } override void visit(ScopeDsymbol) { } override void visit(Declaration) { } override void visit(AliasThis dsym) { if (dsym.semanticRun != PASS.init) return; if (dsym._scope) { sc = dsym._scope; dsym._scope = null; } if (!sc) return; dsym.semanticRun = PASS.semantic; Dsymbol p = sc.parent.pastMixin(); AggregateDeclaration ad = p.isAggregateDeclaration(); if (!ad) { error(dsym.loc, "alias this can only be a member of aggregate, not %s `%s`", p.kind(), p.toChars()); return; } assert(ad.members); Dsymbol s = ad.search(dsym.loc, dsym.ident); if (!s) { s = sc.search(dsym.loc, dsym.ident, null); if (s) error(dsym.loc, "`%s` is not a member of `%s`", s.toChars(), ad.toChars()); else error(dsym.loc, "undefined identifier `%s`", dsym.ident.toChars()); return; } if (ad.aliasthis && s != ad.aliasthis) { error(dsym.loc, "there can be only one alias this"); return; } /* disable the alias this conversion so the implicit conversion check * doesn't use it. */ ad.aliasthis = null; Dsymbol sx = s; if (sx.isAliasDeclaration()) sx = sx.toAlias(); Declaration d = sx.isDeclaration(); if (d && !d.isTupleDeclaration()) { /* https://issues.dlang.org/show_bug.cgi?id=18429 * * If the identifier in the AliasThis declaration * is defined later and is a voldemort type, we must * perform semantic on the declaration to deduce the type. */ if (!d.type) d.dsymbolSemantic(sc); Type t = d.type; assert(t); if (ad.type.implicitConvTo(t) > MATCH.nomatch) { error(dsym.loc, "alias this is not reachable as `%s` already converts to `%s`", ad.toChars(), t.toChars()); } } ad.aliasthis = s; dsym.semanticRun = PASS.semanticdone; } override void visit(AliasDeclaration dsym) { if (dsym.semanticRun >= PASS.semanticdone) return; assert(dsym.semanticRun <= PASS.semantic); dsym.storage_class |= sc.stc & STC.deprecated_; dsym.protection = sc.protection; dsym.userAttribDecl = sc.userAttribDecl; if (!sc.func && dsym.inNonRoot()) return; aliasSemantic(dsym, sc); } override void visit(VarDeclaration dsym) { version (none) { printf("VarDeclaration::semantic('%s', parent = '%s') sem = %d\n", toChars(), sc.parent ? sc.parent.toChars() : null, sem); printf(" type = %s\n", type ? type.toChars() : "null"); printf(" stc = x%x\n", sc.stc); printf(" storage_class = x%llx\n", storage_class); printf("linkage = %d\n", sc.linkage); //if (strcmp(toChars(), "mul") == 0) assert(0); } //if (semanticRun > PASS.init) // return; //semanticRun = PSSsemantic; if (dsym.semanticRun >= PASS.semanticdone) return; Scope* scx = null; if (dsym._scope) { sc = dsym._scope; scx = sc; dsym._scope = null; } if (!sc) return; dsym.semanticRun = PASS.semantic; /* Pick up storage classes from context, but except synchronized, * override, abstract, and final. */ dsym.storage_class |= (sc.stc & ~(STC.synchronized_ | STC.override_ | STC.abstract_ | STC.final_)); if (dsym.storage_class & STC.extern_ && dsym._init) dsym.error("extern symbols cannot have initializers"); dsym.userAttribDecl = sc.userAttribDecl; AggregateDeclaration ad = dsym.isThis(); if (ad) dsym.storage_class |= ad.storage_class & STC.TYPECTOR; /* If auto type inference, do the inference */ int inferred = 0; if (!dsym.type) { dsym.inuse++; // Infering the type requires running semantic, // so mark the scope as ctfe if required bool needctfe = (dsym.storage_class & (STC.manifest | STC.static_)) != 0; if (needctfe) sc = sc.startCTFE(); //printf("inferring type for %s with init %s\n", toChars(), _init.toChars()); dsym._init = dsym._init.inferType(sc); dsym.type = dsym._init.initializerToExpression().type; if (needctfe) sc = sc.endCTFE(); dsym.inuse--; inferred = 1; /* This is a kludge to support the existing syntax for RAII * declarations. */ dsym.storage_class &= ~STC.auto_; dsym.originalType = dsym.type.syntaxCopy(); } else { if (!dsym.originalType) dsym.originalType = dsym.type.syntaxCopy(); /* Prefix function attributes of variable declaration can affect * its type: * pure nothrow void function() fp; * static assert(is(typeof(fp) == void function() pure nothrow)); */ Scope* sc2 = sc.push(); sc2.stc |= (dsym.storage_class & STC.FUNCATTR); dsym.inuse++; dsym.type = dsym.type.typeSemantic(dsym.loc, sc2); dsym.inuse--; sc2.pop(); } //printf(" semantic type = %s\n", type ? type.toChars() : "null"); if (dsym.type.ty == Terror) dsym.errors = true; dsym.type.checkDeprecated(dsym.loc, sc); dsym.linkage = sc.linkage; dsym.parent = sc.parent; //printf("this = %p, parent = %p, '%s'\n", this, parent, parent.toChars()); dsym.protection = sc.protection; /* If scope's alignment is the default, use the type's alignment, * otherwise the scope overrrides. */ dsym.alignment = sc.alignment(); if (dsym.alignment == STRUCTALIGN_DEFAULT) dsym.alignment = dsym.type.alignment(); // use type's alignment //printf("sc.stc = %x\n", sc.stc); //printf("storage_class = x%x\n", storage_class); if (global.params.vcomplex) dsym.type.checkComplexTransition(dsym.loc, sc); // Calculate type size + safety checks if (sc.func && !sc.intypeof) { if (dsym.storage_class & STC.gshared && !dsym.isMember()) { if (sc.func.setUnsafe()) dsym.error("__gshared not allowed in safe functions; use shared"); } } Dsymbol parent = dsym.toParent(); Type tb = dsym.type.toBasetype(); Type tbn = tb.baseElemOf(); if (tb.ty == Tvoid && !(dsym.storage_class & STC.lazy_)) { if (inferred) { dsym.error("type `%s` is inferred from initializer `%s`, and variables cannot be of type `void`", dsym.type.toChars(), dsym._init.toChars()); } else dsym.error("variables cannot be of type `void`"); dsym.type = Type.terror; tb = dsym.type; } if (tb.ty == Tfunction) { dsym.error("cannot be declared to be a function"); dsym.type = Type.terror; tb = dsym.type; } if (tb.ty == Tstruct) { TypeStruct ts = cast(TypeStruct)tb; if (!ts.sym.members) { dsym.error("no definition of struct `%s`", ts.toChars()); } } if ((dsym.storage_class & STC.auto_) && !inferred) dsym.error("storage class `auto` has no effect if type is not inferred, did you mean `scope`?"); if (tb.ty == Ttuple) { /* Instead, declare variables for each of the tuple elements * and add those. */ TypeTuple tt = cast(TypeTuple)tb; size_t nelems = Parameter.dim(tt.arguments); Expression ie = (dsym._init && !dsym._init.isVoidInitializer()) ? dsym._init.initializerToExpression() : null; if (ie) ie = ie.expressionSemantic(sc); if (nelems > 0 && ie) { auto iexps = new Expressions(); iexps.push(ie); auto exps = new Expressions(); for (size_t pos = 0; pos < iexps.dim; pos++) { Lexpand1: Expression e = (*iexps)[pos]; Parameter arg = Parameter.getNth(tt.arguments, pos); arg.type = arg.type.typeSemantic(dsym.loc, sc); //printf("[%d] iexps.dim = %d, ", pos, iexps.dim); //printf("e = (%s %s, %s), ", Token::tochars[e.op], e.toChars(), e.type.toChars()); //printf("arg = (%s, %s)\n", arg.toChars(), arg.type.toChars()); if (e != ie) { if (iexps.dim > nelems) goto Lnomatch; if (e.type.implicitConvTo(arg.type)) continue; } if (e.op == TOK.tuple) { TupleExp te = cast(TupleExp)e; if (iexps.dim - 1 + te.exps.dim > nelems) goto Lnomatch; iexps.remove(pos); iexps.insert(pos, te.exps); (*iexps)[pos] = Expression.combine(te.e0, (*iexps)[pos]); goto Lexpand1; } else if (isAliasThisTuple(e)) { auto v = copyToTemp(0, "__tup", e); v.dsymbolSemantic(sc); auto ve = new VarExp(dsym.loc, v); ve.type = e.type; exps.setDim(1); (*exps)[0] = ve; expandAliasThisTuples(exps, 0); for (size_t u = 0; u < exps.dim; u++) { Lexpand2: Expression ee = (*exps)[u]; arg = Parameter.getNth(tt.arguments, pos + u); arg.type = arg.type.typeSemantic(dsym.loc, sc); //printf("[%d+%d] exps.dim = %d, ", pos, u, exps.dim); //printf("ee = (%s %s, %s), ", Token::tochars[ee.op], ee.toChars(), ee.type.toChars()); //printf("arg = (%s, %s)\n", arg.toChars(), arg.type.toChars()); size_t iexps_dim = iexps.dim - 1 + exps.dim; if (iexps_dim > nelems) goto Lnomatch; if (ee.type.implicitConvTo(arg.type)) continue; if (expandAliasThisTuples(exps, u) != -1) goto Lexpand2; } if ((*exps)[0] != ve) { Expression e0 = (*exps)[0]; (*exps)[0] = new CommaExp(dsym.loc, new DeclarationExp(dsym.loc, v), e0); (*exps)[0].type = e0.type; iexps.remove(pos); iexps.insert(pos, exps); goto Lexpand1; } } } if (iexps.dim < nelems) goto Lnomatch; ie = new TupleExp(dsym._init.loc, iexps); } Lnomatch: if (ie && ie.op == TOK.tuple) { TupleExp te = cast(TupleExp)ie; size_t tedim = te.exps.dim; if (tedim != nelems) { error(dsym.loc, "tuple of %d elements cannot be assigned to tuple of %d elements", cast(int)tedim, cast(int)nelems); for (size_t u = tedim; u < nelems; u++) // fill dummy expression te.exps.push(new ErrorExp()); } } auto exps = new Objects(); exps.setDim(nelems); for (size_t i = 0; i < nelems; i++) { Parameter arg = Parameter.getNth(tt.arguments, i); OutBuffer buf; buf.printf("__%s_field_%llu", dsym.ident.toChars(), cast(ulong)i); auto id = Identifier.idPool(buf.peekSlice()); Initializer ti; if (ie) { Expression einit = ie; if (ie.op == TOK.tuple) { TupleExp te = cast(TupleExp)ie; einit = (*te.exps)[i]; if (i == 0) einit = Expression.combine(te.e0, einit); } ti = new ExpInitializer(einit.loc, einit); } else ti = dsym._init ? dsym._init.syntaxCopy() : null; StorageClass storage_class = STC.temp | dsym.storage_class; if (arg.storageClass & STC.parameter) storage_class |= arg.storageClass; auto v = new VarDeclaration(dsym.loc, arg.type, id, ti, storage_class); //printf("declaring field %s of type %s\n", v.toChars(), v.type.toChars()); v.dsymbolSemantic(sc); if (sc.scopesym) { //printf("adding %s to %s\n", v.toChars(), sc.scopesym.toChars()); if (sc.scopesym.members) // Note this prevents using foreach() over members, because the limits can change sc.scopesym.members.push(v); } Expression e = new DsymbolExp(dsym.loc, v); (*exps)[i] = e; } auto v2 = new TupleDeclaration(dsym.loc, dsym.ident, exps); v2.parent = dsym.parent; v2.isexp = true; dsym.aliassym = v2; dsym.semanticRun = PASS.semanticdone; return; } /* Storage class can modify the type */ dsym.type = dsym.type.addStorageClass(dsym.storage_class); /* Adjust storage class to reflect type */ if (dsym.type.isConst()) { dsym.storage_class |= STC.const_; if (dsym.type.isShared()) dsym.storage_class |= STC.shared_; } else if (dsym.type.isImmutable()) dsym.storage_class |= STC.immutable_; else if (dsym.type.isShared()) dsym.storage_class |= STC.shared_; else if (dsym.type.isWild()) dsym.storage_class |= STC.wild; if (StorageClass stc = dsym.storage_class & (STC.synchronized_ | STC.override_ | STC.abstract_ | STC.final_)) { if (stc == STC.final_) dsym.error("cannot be `final`, perhaps you meant `const`?"); else { OutBuffer buf; stcToBuffer(&buf, stc); dsym.error("cannot be `%s`", buf.peekString()); } dsym.storage_class &= ~stc; // strip off } if (dsym.storage_class & STC.scope_) { StorageClass stc = dsym.storage_class & (STC.static_ | STC.extern_ | STC.manifest | STC.tls | STC.gshared); if (stc) { OutBuffer buf; stcToBuffer(&buf, stc); dsym.error("cannot be `scope` and `%s`", buf.peekString()); } else if (dsym.isMember()) { dsym.error("field cannot be `scope`"); } else if (!dsym.type.hasPointers()) { dsym.storage_class &= ~STC.scope_; // silently ignore; may occur in generic code } } if (dsym.storage_class & (STC.static_ | STC.extern_ | STC.manifest | STC.templateparameter | STC.tls | STC.gshared | STC.ctfe)) { } else { AggregateDeclaration aad = parent.isAggregateDeclaration(); if (aad) { if (global.params.vfield && dsym.storage_class & (STC.const_ | STC.immutable_) && dsym._init && !dsym._init.isVoidInitializer()) { const(char)* s = (dsym.storage_class & STC.immutable_) ? "immutable" : "const"; message(dsym.loc, "`%s.%s` is `%s` field", ad.toPrettyChars(), dsym.toChars(), s); } dsym.storage_class |= STC.field; if (tbn.ty == Tstruct && (cast(TypeStruct)tbn).sym.noDefaultCtor) { if (!dsym.isThisDeclaration() && !dsym._init) aad.noDefaultCtor = true; } } InterfaceDeclaration id = parent.isInterfaceDeclaration(); if (id) { dsym.error("field not allowed in interface"); } else if (aad && aad.sizeok == Sizeok.done) { dsym.error("cannot be further field because it will change the determined %s size", aad.toChars()); } /* Templates cannot add fields to aggregates */ TemplateInstance ti = parent.isTemplateInstance(); if (ti) { // Take care of nested templates while (1) { TemplateInstance ti2 = ti.tempdecl.parent.isTemplateInstance(); if (!ti2) break; ti = ti2; } // If it's a member template AggregateDeclaration ad2 = ti.tempdecl.isMember(); if (ad2 && dsym.storage_class != STC.undefined_) { dsym.error("cannot use template to add field to aggregate `%s`", ad2.toChars()); } } } if ((dsym.storage_class & (STC.ref_ | STC.parameter | STC.foreach_ | STC.temp | STC.result)) == STC.ref_ && dsym.ident != Id.This) { dsym.error("only parameters or `foreach` declarations can be `ref`"); } if (dsym.type.hasWild()) { if (dsym.storage_class & (STC.static_ | STC.extern_ | STC.tls | STC.gshared | STC.manifest | STC.field) || dsym.isDataseg()) { dsym.error("only parameters or stack based variables can be `inout`"); } FuncDeclaration func = sc.func; if (func) { if (func.fes) func = func.fes.func; bool isWild = false; for (FuncDeclaration fd = func; fd; fd = fd.toParent2().isFuncDeclaration()) { if ((cast(TypeFunction)fd.type).iswild) { isWild = true; break; } } if (!isWild) { dsym.error("`inout` variables can only be declared inside `inout` functions"); } } } if (!(dsym.storage_class & (STC.ctfe | STC.ref_ | STC.result)) && tbn.ty == Tstruct && (cast(TypeStruct)tbn).sym.noDefaultCtor) { if (!dsym._init) { if (dsym.isField()) { /* For fields, we'll check the constructor later to make sure it is initialized */ dsym.storage_class |= STC.nodefaultctor; } else if (dsym.storage_class & STC.parameter) { } else dsym.error("default construction is disabled for type `%s`", dsym.type.toChars()); } } FuncDeclaration fd = parent.isFuncDeclaration(); if (dsym.type.isscope() && !(dsym.storage_class & STC.nodtor)) { if (dsym.storage_class & (STC.field | STC.out_ | STC.ref_ | STC.static_ | STC.manifest | STC.tls | STC.gshared) || !fd) { dsym.error("globals, statics, fields, manifest constants, ref and out parameters cannot be `scope`"); } if (!(dsym.storage_class & STC.scope_)) { if (!(dsym.storage_class & STC.parameter) && dsym.ident != Id.withSym) dsym.error("reference to `scope class` must be `scope`"); } } // Calculate type size + safety checks if (sc.func && !sc.intypeof) { if (dsym._init && dsym._init.isVoidInitializer() && dsym.type.hasPointers()) // get type size { if (sc.func.setUnsafe()) dsym.error("`void` initializers for pointers not allowed in safe functions"); } else if (!dsym._init && !(dsym.storage_class & (STC.static_ | STC.extern_ | STC.tls | STC.gshared | STC.manifest | STC.field | STC.parameter)) && dsym.type.hasVoidInitPointers()) { if (sc.func.setUnsafe()) dsym.error("`void` initializers for pointers not allowed in safe functions"); } } if (!dsym._init && !fd) { // If not mutable, initializable by constructor only dsym.storage_class |= STC.ctorinit; } if (dsym._init) dsym.storage_class |= STC.init; // remember we had an explicit initializer else if (dsym.storage_class & STC.manifest) dsym.error("manifest constants must have initializers"); bool isBlit = false; d_uns64 sz; if (!dsym._init && !(dsym.storage_class & (STC.static_ | STC.gshared | STC.extern_)) && fd && (!(dsym.storage_class & (STC.field | STC.in_ | STC.foreach_ | STC.parameter | STC.result)) || (dsym.storage_class & STC.out_)) && (sz = dsym.type.size()) != 0) { // Provide a default initializer //printf("Providing default initializer for '%s'\n", toChars()); if (sz == SIZE_INVALID && dsym.type.ty != Terror) dsym.error("size of type `%s` is invalid", dsym.type.toChars()); Type tv = dsym.type; while (tv.ty == Tsarray) // Don't skip Tenum tv = tv.nextOf(); if (tv.needsNested()) { /* Nested struct requires valid enclosing frame pointer. * In StructLiteralExp::toElem(), it's calculated. */ assert(tbn.ty == Tstruct); checkFrameAccess(dsym.loc, sc, (cast(TypeStruct)tbn).sym); Expression e = tv.defaultInitLiteral(dsym.loc); e = new BlitExp(dsym.loc, new VarExp(dsym.loc, dsym), e); e = e.expressionSemantic(sc); dsym._init = new ExpInitializer(dsym.loc, e); goto Ldtor; } if (tv.ty == Tstruct && (cast(TypeStruct)tv).sym.zeroInit) { /* If a struct is all zeros, as a special case * set it's initializer to the integer 0. * In AssignExp::toElem(), we check for this and issue * a memset() to initialize the struct. * Must do same check in interpreter. */ Expression e = new IntegerExp(dsym.loc, 0, Type.tint32); e = new BlitExp(dsym.loc, new VarExp(dsym.loc, dsym), e); e.type = dsym.type; // don't type check this, it would fail dsym._init = new ExpInitializer(dsym.loc, e); goto Ldtor; } if (dsym.type.baseElemOf().ty == Tvoid) { dsym.error("`%s` does not have a default initializer", dsym.type.toChars()); } else if (auto e = dsym.type.defaultInit(dsym.loc)) { dsym._init = new ExpInitializer(dsym.loc, e); } // Default initializer is always a blit isBlit = true; } if (dsym._init) { sc = sc.push(); sc.stc &= ~(STC.TYPECTOR | STC.pure_ | STC.nothrow_ | STC.nogc | STC.ref_ | STC.disable); ExpInitializer ei = dsym._init.isExpInitializer(); if (ei) // https://issues.dlang.org/show_bug.cgi?id=13424 // Preset the required type to fail in FuncLiteralDeclaration::semantic3 ei.exp = inferType(ei.exp, dsym.type); // If inside function, there is no semantic3() call if (sc.func || sc.intypeof == 1) { // If local variable, use AssignExp to handle all the various // possibilities. if (fd && !(dsym.storage_class & (STC.manifest | STC.static_ | STC.tls | STC.gshared | STC.extern_)) && !dsym._init.isVoidInitializer()) { //printf("fd = '%s', var = '%s'\n", fd.toChars(), toChars()); if (!ei) { ArrayInitializer ai = dsym._init.isArrayInitializer(); Expression e; if (ai && tb.ty == Taarray) e = ai.toAssocArrayLiteral(); else e = dsym._init.initializerToExpression(); if (!e) { // Run semantic, but don't need to interpret dsym._init = dsym._init.initializerSemantic(sc, dsym.type, INITnointerpret); e = dsym._init.initializerToExpression(); if (!e) { dsym.error("is not a static and cannot have static initializer"); e = new ErrorExp(); } } ei = new ExpInitializer(dsym._init.loc, e); dsym._init = ei; } Expression exp = ei.exp; Expression e1 = new VarExp(dsym.loc, dsym); if (isBlit) exp = new BlitExp(dsym.loc, e1, exp); else exp = new ConstructExp(dsym.loc, e1, exp); dsym.canassign++; exp = exp.expressionSemantic(sc); dsym.canassign--; exp = exp.optimize(WANTvalue); if (exp.op == TOK.error) { dsym._init = new ErrorInitializer(); ei = null; } else ei.exp = exp; if (ei && dsym.isScope()) { Expression ex = ei.exp; while (ex.op == TOK.comma) ex = (cast(CommaExp)ex).e2; if (ex.op == TOK.blit || ex.op == TOK.construct) ex = (cast(AssignExp)ex).e2; if (ex.op == TOK.new_) { // See if initializer is a NewExp that can be allocated on the stack NewExp ne = cast(NewExp)ex; if (dsym.type.toBasetype().ty == Tclass) { if (ne.newargs && ne.newargs.dim > 1) { dsym.mynew = true; } else { ne.onstack = 1; dsym.onstack = true; } } } else if (ex.op == TOK.function_) { // or a delegate that doesn't escape a reference to the function FuncDeclaration f = (cast(FuncExp)ex).fd; f.tookAddressOf--; } } } else { // https://issues.dlang.org/show_bug.cgi?id=14166 // Don't run CTFE for the temporary variables inside typeof dsym._init = dsym._init.initializerSemantic(sc, dsym.type, sc.intypeof == 1 ? INITnointerpret : INITinterpret); } } else if (parent.isAggregateDeclaration()) { dsym._scope = scx ? scx : sc.copy(); dsym._scope.setNoFree(); } else if (dsym.storage_class & (STC.const_ | STC.immutable_ | STC.manifest) || dsym.type.isConst() || dsym.type.isImmutable()) { /* Because we may need the results of a const declaration in a * subsequent type, such as an array dimension, before semantic2() * gets ordinarily run, try to run semantic2() now. * Ignore failure. */ if (!inferred) { uint errors = global.errors; dsym.inuse++; if (ei) { Expression exp = ei.exp.syntaxCopy(); bool needctfe = dsym.isDataseg() || (dsym.storage_class & STC.manifest); if (needctfe) sc = sc.startCTFE(); exp = exp.expressionSemantic(sc); exp = resolveProperties(sc, exp); if (needctfe) sc = sc.endCTFE(); Type tb2 = dsym.type.toBasetype(); Type ti = exp.type.toBasetype(); /* The problem is the following code: * struct CopyTest { * double x; * this(double a) { x = a * 10.0;} * this(this) { x += 2.0; } * } * const CopyTest z = CopyTest(5.3); // ok * const CopyTest w = z; // not ok, postblit not run * static assert(w.x == 55.0); * because the postblit doesn't get run on the initialization of w. */ if (ti.ty == Tstruct) { StructDeclaration sd = (cast(TypeStruct)ti).sym; /* Look to see if initializer involves a copy constructor * (which implies a postblit) */ // there is a copy constructor // and exp is the same struct if (sd.postblit && tb2.toDsymbol(null) == sd) { // The only allowable initializer is a (non-copy) constructor if (exp.isLvalue()) dsym.error("of type struct `%s` uses `this(this)`, which is not allowed in static initialization", tb2.toChars()); } } ei.exp = exp; } dsym._init = dsym._init.initializerSemantic(sc, dsym.type, INITinterpret); dsym.inuse--; if (global.errors > errors) { dsym._init = new ErrorInitializer(); dsym.type = Type.terror; } } else { dsym._scope = scx ? scx : sc.copy(); dsym._scope.setNoFree(); } } sc = sc.pop(); } Ldtor: /* Build code to execute destruction, if necessary */ dsym.edtor = dsym.callScopeDtor(sc); if (dsym.edtor) { /* If dsym is a local variable, who's type is a struct with a scope destructor, * then make dsym scope, too. */ if (global.params.vsafe && !(dsym.storage_class & (STC.parameter | STC.temp | STC.field | STC.in_ | STC.foreach_ | STC.result | STC.manifest)) && !dsym.isDataseg() && !dsym.doNotInferScope && dsym.type.hasPointers()) { auto tv = dsym.type.baseElemOf(); if (tv.ty == Tstruct && (cast(TypeStruct)tv).sym.dtor.storage_class & STC.scope_) { dsym.storage_class |= STC.scope_; } } if (sc.func && dsym.storage_class & (STC.static_ | STC.gshared)) dsym.edtor = dsym.edtor.expressionSemantic(sc._module._scope); else dsym.edtor = dsym.edtor.expressionSemantic(sc); version (none) { // currently disabled because of std.stdio.stdin, stdout and stderr if (dsym.isDataseg() && !(dsym.storage_class & STC.extern_)) dsym.error("static storage variables cannot have destructors"); } } dsym.semanticRun = PASS.semanticdone; if (dsym.type.toBasetype().ty == Terror) dsym.errors = true; if(sc.scopesym && !sc.scopesym.isAggregateDeclaration()) { for (ScopeDsymbol sym = sc.scopesym; sym && dsym.endlinnum == 0; sym = sym.parent ? sym.parent.isScopeDsymbol() : null) dsym.endlinnum = sym.endlinnum; } } override void visit(TypeInfoDeclaration dsym) { assert(dsym.linkage == LINK.c); } override void visit(Import imp) { //printf("Import::semantic('%s') %s\n", toPrettyChars(), id.toChars()); if (imp.semanticRun > PASS.init) return; if (imp._scope) { sc = imp._scope; imp._scope = null; } if (!sc) return; imp.semanticRun = PASS.semantic; // Load if not already done so if (!imp.mod) { imp.load(sc); if (imp.mod) imp.mod.importAll(null); } if (imp.mod) { // Modules need a list of each imported module //printf("%s imports %s\n", sc._module.toChars(), imp.mod.toChars()); sc._module.aimports.push(imp.mod); if (sc.explicitProtection) imp.protection = sc.protection; if (!imp.aliasId && !imp.names.dim) // neither a selective nor a renamed import { ScopeDsymbol scopesym; for (Scope* scd = sc; scd; scd = scd.enclosing) { if (!scd.scopesym) continue; scopesym = scd.scopesym; break; } if (!imp.isstatic) { scopesym.importScope(imp.mod, imp.protection); } // Mark the imported packages as accessible from the current // scope. This access check is necessary when using FQN b/c // we're using a single global package tree. // https://issues.dlang.org/show_bug.cgi?id=313 if (imp.packages) { // import a.b.c.d; auto p = imp.pkg; // a scopesym.addAccessiblePackage(p, imp.protection); foreach (id; (*imp.packages)[1 .. imp.packages.dim]) // [b, c] { p = cast(Package) p.symtab.lookup(id); scopesym.addAccessiblePackage(p, imp.protection); } } scopesym.addAccessiblePackage(imp.mod, imp.protection); // d } imp.mod.dsymbolSemantic(null); if (imp.mod.needmoduleinfo) { //printf("module4 %s because of %s\n", sc.module.toChars(), mod.toChars()); sc._module.needmoduleinfo = 1; } sc = sc.push(imp.mod); sc.protection = imp.protection; for (size_t i = 0; i < imp.aliasdecls.dim; i++) { AliasDeclaration ad = imp.aliasdecls[i]; //printf("\tImport %s alias %s = %s, scope = %p\n", toPrettyChars(), aliases[i].toChars(), names[i].toChars(), ad._scope); Dsymbol sym = imp.mod.search(imp.loc, imp.names[i] /*, IgnorePrivateImports */); if (sym) { // Deprecated in 2018-01. // Change to error in 2019-01 by deleteting the following 5 lines and uncommenting // the IgnorePrivateImports parameter from above. // @@@DEPRECATED_2019-01@@@. Dsymbol s = imp.mod.search(imp.loc, imp.names[i], IgnorePrivateImports); if (!s) .deprecation(imp.loc, "Symbol `%s` is not visible from module `%s` because it is privately imported in module `%s`", sym.toPrettyChars, sc._module.toChars(), imp.mod.toChars()); // Deprecated in 2018-01. // Change to error in 2019-01. // @@@DEPRECATED_2019-01@@@. import dmd.access : symbolIsVisible; if (!symbolIsVisible(sc, sym)) imp.mod.deprecation(imp.loc, "member `%s` is not visible from module `%s`", imp.names[i].toChars(), sc._module.toChars()); ad.dsymbolSemantic(sc); // If the import declaration is in non-root module, // analysis of the aliased symbol is deferred. // Therefore, don't see the ad.aliassym or ad.type here. } else { Dsymbol s = imp.mod.search_correct(imp.names[i]); if (s) imp.mod.error(imp.loc, "import `%s` not found, did you mean %s `%s`?", imp.names[i].toChars(), s.kind(), s.toPrettyChars()); else imp.mod.error(imp.loc, "import `%s` not found", imp.names[i].toChars()); ad.type = Type.terror; } } sc = sc.pop(); } imp.semanticRun = PASS.semanticdone; // object self-imports itself, so skip that // https://issues.dlang.org/show_bug.cgi?id=7547 // don't list pseudo modules __entrypoint.d, __main.d // https://issues.dlang.org/show_bug.cgi?id=11117 // https://issues.dlang.org/show_bug.cgi?id=11164 if (global.params.moduleDeps !is null && !(imp.id == Id.object && sc._module.ident == Id.object) && sc._module.ident != Id.entrypoint && strcmp(sc._module.ident.toChars(), "__main") != 0) { /* The grammar of the file is: * ImportDeclaration * ::= BasicImportDeclaration [ " : " ImportBindList ] [ " -> " * ModuleAliasIdentifier ] "\n" * * BasicImportDeclaration * ::= ModuleFullyQualifiedName " (" FilePath ") : " Protection|"string" * " [ " static" ] : " ModuleFullyQualifiedName " (" FilePath ")" * * FilePath * - any string with '(', ')' and '\' escaped with the '\' character */ OutBuffer* ob = global.params.moduleDeps; Module imod = sc.instantiatingModule(); if (!global.params.moduleDepsFile) ob.writestring("depsImport "); ob.writestring(imod.toPrettyChars()); ob.writestring(" ("); escapePath(ob, imod.srcfile.toChars()); ob.writestring(") : "); // use protection instead of sc.protection because it couldn't be // resolved yet, see the comment above protectionToBuffer(ob, imp.protection); ob.writeByte(' '); if (imp.isstatic) { stcToBuffer(ob, STC.static_); ob.writeByte(' '); } ob.writestring(": "); if (imp.packages) { for (size_t i = 0; i < imp.packages.dim; i++) { Identifier pid = (*imp.packages)[i]; ob.printf("%s.", pid.toChars()); } } ob.writestring(imp.id.toChars()); ob.writestring(" ("); if (imp.mod) escapePath(ob, imp.mod.srcfile.toChars()); else ob.writestring("???"); ob.writeByte(')'); for (size_t i = 0; i < imp.names.dim; i++) { if (i == 0) ob.writeByte(':'); else ob.writeByte(','); Identifier name = imp.names[i]; Identifier _alias = imp.aliases[i]; if (!_alias) { ob.printf("%s", name.toChars()); _alias = name; } else ob.printf("%s=%s", _alias.toChars(), name.toChars()); } if (imp.aliasId) ob.printf(" -> %s", imp.aliasId.toChars()); ob.writenl(); } //printf("-Import::semantic('%s'), pkg = %p\n", toChars(), pkg); } void attribSemantic(AttribDeclaration ad) { if (ad.semanticRun != PASS.init) return; ad.semanticRun = PASS.semantic; Dsymbols* d = ad.include(sc); //printf("\tAttribDeclaration::semantic '%s', d = %p\n",toChars(), d); if (d) { Scope* sc2 = ad.newScope(sc); bool errors; for (size_t i = 0; i < d.dim; i++) { Dsymbol s = (*d)[i]; s.dsymbolSemantic(sc2); errors |= s.errors; } ad.errors |= errors; if (sc2 != sc) sc2.pop(); } ad.semanticRun = PASS.semanticdone; } override void visit(AttribDeclaration atd) { attribSemantic(atd); } override void visit(AnonDeclaration scd) { //printf("\tAnonDeclaration::semantic %s %p\n", isunion ? "union" : "struct", this); assert(sc.parent); auto p = sc.parent.pastMixin(); auto ad = p.isAggregateDeclaration(); if (!ad) { error(scd.loc, "%s can only be a part of an aggregate, not %s `%s`", scd.kind(), p.kind(), p.toChars()); scd.errors = true; return; } if (scd.decl) { sc = sc.push(); sc.stc &= ~(STC.auto_ | STC.scope_ | STC.static_ | STC.tls | STC.gshared); sc.inunion = scd.isunion; sc.flags = 0; for (size_t i = 0; i < scd.decl.dim; i++) { Dsymbol s = (*scd.decl)[i]; s.dsymbolSemantic(sc); } sc = sc.pop(); } } override void visit(PragmaDeclaration pd) { // Should be merged with PragmaStatement //printf("\tPragmaDeclaration::semantic '%s'\n", pd.toChars()); if (pd.ident == Id.msg) { if (pd.args) { for (size_t i = 0; i < pd.args.dim; i++) { Expression e = (*pd.args)[i]; sc = sc.startCTFE(); e = e.expressionSemantic(sc); e = resolveProperties(sc, e); sc = sc.endCTFE(); // pragma(msg) is allowed to contain types as well as expressions if (e.type && e.type.ty == Tvoid) { error(pd.loc, "Cannot pass argument `%s` to `pragma msg` because it is `void`", e.toChars()); return; } e = ctfeInterpretForPragmaMsg(e); if (e.op == TOK.error) { errorSupplemental(pd.loc, "while evaluating `pragma(msg, %s)`", (*pd.args)[i].toChars()); return; } StringExp se = e.toStringExp(); if (se) { se = se.toUTF8(sc); fprintf(stderr, "%.*s", cast(int)se.len, se.string); } else fprintf(stderr, "%s", e.toChars()); } fprintf(stderr, "\n"); } goto Lnodecl; } else if (pd.ident == Id.lib) { if (!pd.args || pd.args.dim != 1) pd.error("string expected for library name"); else { auto se = semanticString(sc, (*pd.args)[0], "library name"); if (!se) goto Lnodecl; (*pd.args)[0] = se; auto name = cast(char*)mem.xmalloc(se.len + 1); memcpy(name, se.string, se.len); name[se.len] = 0; if (global.params.verbose) message("library %s", name); if (global.params.moduleDeps && !global.params.moduleDepsFile) { OutBuffer* ob = global.params.moduleDeps; Module imod = sc.instantiatingModule(); ob.writestring("depsLib "); ob.writestring(imod.toPrettyChars()); ob.writestring(" ("); escapePath(ob, imod.srcfile.toChars()); ob.writestring(") : "); ob.writestring(name); ob.writenl(); } mem.xfree(name); } goto Lnodecl; } else if (pd.ident == Id.startaddress) { if (!pd.args || pd.args.dim != 1) pd.error("function name expected for start address"); else { /* https://issues.dlang.org/show_bug.cgi?id=11980 * resolveProperties and ctfeInterpret call are not necessary. */ Expression e = (*pd.args)[0]; sc = sc.startCTFE(); e = e.expressionSemantic(sc); sc = sc.endCTFE(); (*pd.args)[0] = e; Dsymbol sa = getDsymbol(e); if (!sa || !sa.isFuncDeclaration()) pd.error("function name expected for start address, not `%s`", e.toChars()); } goto Lnodecl; } else if (pd.ident == Id.Pinline) { goto Ldecl; } else if (pd.ident == Id.mangle) { if (!pd.args) pd.args = new Expressions(); if (pd.args.dim != 1) { pd.error("string expected for mangled name"); pd.args.setDim(1); (*pd.args)[0] = new ErrorExp(); // error recovery goto Ldecl; } auto se = semanticString(sc, (*pd.args)[0], "mangled name"); if (!se) goto Ldecl; (*pd.args)[0] = se; // Will be used later if (!se.len) { pd.error("zero-length string not allowed for mangled name"); goto Ldecl; } if (se.sz != 1) { pd.error("mangled name characters can only be of type `char`"); goto Ldecl; } version (all) { /* Note: D language specification should not have any assumption about backend * implementation. Ideally pragma(mangle) can accept a string of any content. * * Therefore, this validation is compiler implementation specific. */ for (size_t i = 0; i < se.len;) { char* p = se.string; dchar c = p[i]; if (c < 0x80) { if (c >= 'A' && c <= 'Z' || c >= 'a' && c <= 'z' || c >= '0' && c <= '9' || c != 0 && strchr("$%().:?@[]_", c)) { ++i; continue; } else { pd.error("char 0x%02x not allowed in mangled name", c); break; } } if (const msg = utf_decodeChar(se.string, se.len, i, c)) { pd.error("%s", msg); break; } if (!isUniAlpha(c)) { pd.error("char `0x%04x` not allowed in mangled name", c); break; } } } } else if (pd.ident == Id.crt_constructor || pd.ident == Id.crt_destructor) { if (pd.args && pd.args.dim != 0) pd.error("takes no argument"); goto Ldecl; } else if (global.params.ignoreUnsupportedPragmas) { if (global.params.verbose) { /* Print unrecognized pragmas */ OutBuffer buf; buf.writestring(pd.ident.toChars()); if (pd.args) { for (size_t i = 0; i < pd.args.dim; i++) { Expression e = (*pd.args)[i]; sc = sc.startCTFE(); e = e.expressionSemantic(sc); e = resolveProperties(sc, e); sc = sc.endCTFE(); e = e.ctfeInterpret(); if (i == 0) buf.writestring(" ("); else buf.writeByte(','); buf.writestring(e.toChars()); } if (pd.args.dim) buf.writeByte(')'); } message("pragma %s", buf.peekString()); } goto Lnodecl; } else error(pd.loc, "unrecognized `pragma(%s)`", pd.ident.toChars()); Ldecl: if (pd.decl) { Scope* sc2 = pd.newScope(sc); for (size_t i = 0; i < pd.decl.dim; i++) { Dsymbol s = (*pd.decl)[i]; s.dsymbolSemantic(sc2); if (pd.ident == Id.mangle) { assert(pd.args && pd.args.dim == 1); if (auto se = (*pd.args)[0].toStringExp()) { char* name = cast(char*)mem.xmalloc(se.len + 1); memcpy(name, se.string, se.len); name[se.len] = 0; uint cnt = setMangleOverride(s, name); if (cnt > 1) pd.error("can only apply to a single declaration"); } } } if (sc2 != sc) sc2.pop(); } return; Lnodecl: if (pd.decl) { pd.error("is missing a terminating `;`"); goto Ldecl; // do them anyway, to avoid segfaults. } } override void visit(StaticIfDeclaration sid) { attribSemantic(sid); } override void visit(StaticForeachDeclaration sfd) { attribSemantic(sfd); } private Dsymbols* compileIt(CompileDeclaration cd) { //printf("CompileDeclaration::compileIt(loc = %d) %s\n", cd.loc.linnum, cd.exp.toChars()); auto se = semanticString(sc, cd.exp, "argument to mixin"); if (!se) return null; se = se.toUTF8(sc); uint errors = global.errors; scope p = new Parser!ASTCodegen(cd.loc, sc._module, se.toStringz(), false); p.nextToken(); auto d = p.parseDeclDefs(0); if (p.errors) { assert(global.errors != errors); // should have caught all these cases return null; } if (p.token.value != TOK.endOfFile) { cd.exp.error("incomplete mixin declaration `%s`", se.toChars()); return null; } return d; } override void visit(CompileDeclaration cd) { //printf("CompileDeclaration::semantic()\n"); if (!cd.compiled) { cd.decl = compileIt(cd); cd.AttribDeclaration.addMember(sc, cd.scopesym); cd.compiled = true; if (cd._scope && cd.decl) { for (size_t i = 0; i < cd.decl.dim; i++) { Dsymbol s = (*cd.decl)[i]; s.setScope(cd._scope); } } } attribSemantic(cd); } override void visit(UserAttributeDeclaration uad) { //printf("UserAttributeDeclaration::semantic() %p\n", this); if (uad.decl && !uad._scope) uad.Dsymbol.setScope(sc); // for function local symbols return attribSemantic(uad); } override void visit(StaticAssert sa) { if (sa.semanticRun < PASS.semanticdone) sa.semanticRun = PASS.semanticdone; } override void visit(DebugSymbol ds) { //printf("DebugSymbol::semantic() %s\n", toChars()); if (ds.semanticRun < PASS.semanticdone) ds.semanticRun = PASS.semanticdone; } override void visit(VersionSymbol vs) { if (vs.semanticRun < PASS.semanticdone) vs.semanticRun = PASS.semanticdone; } override void visit(Package pkg) { if (pkg.semanticRun < PASS.semanticdone) pkg.semanticRun = PASS.semanticdone; } override void visit(Module m) { if (m.semanticRun != PASS.init) return; //printf("+Module::semantic(this = %p, '%s'): parent = %p\n", this, toChars(), parent); m.semanticRun = PASS.semantic; // Note that modules get their own scope, from scratch. // This is so regardless of where in the syntax a module // gets imported, it is unaffected by context. Scope* sc = m._scope; // see if already got one from importAll() if (!sc) { Scope.createGlobal(m); // create root scope } //printf("Module = %p, linkage = %d\n", sc.scopesym, sc.linkage); // Pass 1 semantic routines: do public side of the definition for (size_t i = 0; i < m.members.dim; i++) { Dsymbol s = (*m.members)[i]; //printf("\tModule('%s'): '%s'.dsymbolSemantic()\n", toChars(), s.toChars()); s.dsymbolSemantic(sc); m.runDeferredSemantic(); } if (m.userAttribDecl) { m.userAttribDecl.dsymbolSemantic(sc); } if (!m._scope) { sc = sc.pop(); sc.pop(); // 2 pops because Scope::createGlobal() created 2 } m.semanticRun = PASS.semanticdone; //printf("-Module::semantic(this = %p, '%s'): parent = %p\n", this, toChars(), parent); } override void visit(EnumDeclaration ed) { //printf("EnumDeclaration::semantic(sd = %p, '%s') %s\n", sc.scopesym, sc.scopesym.toChars(), toChars()); //printf("EnumDeclaration::semantic() %p %s\n", this, toChars()); if (ed.semanticRun >= PASS.semanticdone) return; // semantic() already completed if (ed.semanticRun == PASS.semantic) { assert(ed.memtype); error(ed.loc, "circular reference to enum base type `%s`", ed.memtype.toChars()); ed.errors = true; ed.semanticRun = PASS.semanticdone; return; } uint dprogress_save = Module.dprogress; Scope* scx = null; if (ed._scope) { sc = ed._scope; scx = ed._scope; // save so we don't make redundant copies ed._scope = null; } if (!sc) return; ed.parent = sc.parent; ed.type = ed.type.typeSemantic(ed.loc, sc); ed.protection = sc.protection; if (sc.stc & STC.deprecated_) ed.isdeprecated = true; ed.userAttribDecl = sc.userAttribDecl; ed.semanticRun = PASS.semantic; if (!ed.members && !ed.memtype) // enum ident; { ed.semanticRun = PASS.semanticdone; return; } if (!ed.symtab) ed.symtab = new DsymbolTable(); /* The separate, and distinct, cases are: * 1. enum { ... } * 2. enum : memtype { ... } * 3. enum ident { ... } * 4. enum ident : memtype { ... } * 5. enum ident : memtype; * 6. enum ident; */ if (ed.memtype) { ed.memtype = ed.memtype.typeSemantic(ed.loc, sc); /* Check to see if memtype is forward referenced */ if (ed.memtype.ty == Tenum) { EnumDeclaration sym = cast(EnumDeclaration)ed.memtype.toDsymbol(sc); if (!sym.memtype || !sym.members || !sym.symtab || sym._scope) { // memtype is forward referenced, so try again later ed._scope = scx ? scx : sc.copy(); ed._scope.setNoFree(); ed._scope._module.addDeferredSemantic(ed); Module.dprogress = dprogress_save; //printf("\tdeferring %s\n", toChars()); ed.semanticRun = PASS.init; return; } } if (ed.memtype.ty == Tvoid) { ed.error("base type must not be `void`"); ed.memtype = Type.terror; } if (ed.memtype.ty == Terror) { ed.errors = true; if (ed.members) { for (size_t i = 0; i < ed.members.dim; i++) { Dsymbol s = (*ed.members)[i]; s.errors = true; // poison all the members } } ed.semanticRun = PASS.semanticdone; return; } } ed.semanticRun = PASS.semanticdone; if (!ed.members) // enum ident : memtype; return; if (ed.members.dim == 0) { ed.error("enum `%s` must have at least one member", ed.toChars()); ed.errors = true; return; } Module.dprogress++; Scope* sce; if (ed.isAnonymous()) sce = sc; else { sce = sc.push(ed); sce.parent = ed; } sce = sce.startCTFE(); sce.setNoFree(); // needed for getMaxMinValue() /* Each enum member gets the sce scope */ for (size_t i = 0; i < ed.members.dim; i++) { EnumMember em = (*ed.members)[i].isEnumMember(); if (em) em._scope = sce; } if (!ed.added) { /* addMember() is not called when the EnumDeclaration appears as a function statement, * so we have to do what addMember() does and install the enum members in the right symbol * table */ ScopeDsymbol scopesym = null; if (ed.isAnonymous()) { /* Anonymous enum members get added to enclosing scope. */ for (Scope* sct = sce; 1; sct = sct.enclosing) { assert(sct); if (sct.scopesym) { scopesym = sct.scopesym; if (!sct.scopesym.symtab) sct.scopesym.symtab = new DsymbolTable(); break; } } } else { // Otherwise enum members are in the EnumDeclaration's symbol table scopesym = ed; } for (size_t i = 0; i < ed.members.dim; i++) { EnumMember em = (*ed.members)[i].isEnumMember(); if (em) { em.ed = ed; em.addMember(sc, scopesym); } } } for (size_t i = 0; i < ed.members.dim; i++) { EnumMember em = (*ed.members)[i].isEnumMember(); if (em) em.dsymbolSemantic(em._scope); } //printf("defaultval = %lld\n", defaultval); //if (defaultval) printf("defaultval: %s %s\n", defaultval.toChars(), defaultval.type.toChars()); //printf("members = %s\n", members.toChars()); } override void visit(EnumMember em) { //printf("EnumMember::semantic() %s\n", toChars()); void errorReturn() { em.errors = true; em.semanticRun = PASS.semanticdone; } if (em.errors || em.semanticRun >= PASS.semanticdone) return; if (em.semanticRun == PASS.semantic) { em.error("circular reference to `enum` member"); return errorReturn(); } assert(em.ed); em.ed.dsymbolSemantic(sc); if (em.ed.errors) return errorReturn(); if (em.errors || em.semanticRun >= PASS.semanticdone) return; if (em._scope) sc = em._scope; if (!sc) return; em.semanticRun = PASS.semantic; em.protection = em.ed.isAnonymous() ? em.ed.protection : Prot(Prot.Kind.public_); em.linkage = LINK.d; em.storage_class = STC.manifest; em.userAttribDecl = em.ed.isAnonymous() ? em.ed.userAttribDecl : null; // The first enum member is special bool first = (em == (*em.ed.members)[0]); if (em.origType) { em.origType = em.origType.typeSemantic(em.loc, sc); em.type = em.origType; assert(em.value); // "type id;" is not a valid enum member declaration } if (em.value) { Expression e = em.value; assert(e.dyncast() == DYNCAST.expression); e = e.expressionSemantic(sc); e = resolveProperties(sc, e); e = e.ctfeInterpret(); if (e.op == TOK.error) return errorReturn(); if (first && !em.ed.memtype && !em.ed.isAnonymous()) { em.ed.memtype = e.type; if (em.ed.memtype.ty == Terror) { em.ed.errors = true; return errorReturn(); } if (em.ed.memtype.ty != Terror) { /* https://issues.dlang.org/show_bug.cgi?id=11746 * All of named enum members should have same type * with the first member. If the following members were referenced * during the first member semantic, their types should be unified. */ for (size_t i = 0; i < em.ed.members.dim; i++) { EnumMember enm = (*em.ed.members)[i].isEnumMember(); if (!enm || enm == em || enm.semanticRun < PASS.semanticdone || enm.origType) continue; //printf("[%d] em = %s, em.semanticRun = %d\n", i, toChars(), em.semanticRun); Expression ev = enm.value; ev = ev.implicitCastTo(sc, em.ed.memtype); ev = ev.ctfeInterpret(); ev = ev.castTo(sc, em.ed.type); if (ev.op == TOK.error) em.ed.errors = true; enm.value = ev; } if (em.ed.errors) { em.ed.memtype = Type.terror; return errorReturn(); } } } if (em.ed.memtype && !em.origType) { e = e.implicitCastTo(sc, em.ed.memtype); e = e.ctfeInterpret(); // save origValue for better json output em.origValue = e; if (!em.ed.isAnonymous()) { e = e.castTo(sc, em.ed.type.addMod(e.type.mod)); // https://issues.dlang.org/show_bug.cgi?id=12385 e = e.ctfeInterpret(); } } else if (em.origType) { e = e.implicitCastTo(sc, em.origType); e = e.ctfeInterpret(); assert(em.ed.isAnonymous()); // save origValue for better json output em.origValue = e; } em.value = e; } else if (first) { Type t; if (em.ed.memtype) t = em.ed.memtype; else { t = Type.tint32; if (!em.ed.isAnonymous()) em.ed.memtype = t; } Expression e = new IntegerExp(em.loc, 0, t); e = e.ctfeInterpret(); // save origValue for better json output em.origValue = e; if (!em.ed.isAnonymous()) { e = e.castTo(sc, em.ed.type); e = e.ctfeInterpret(); } em.value = e; } else { /* Find the previous enum member, * and set this to be the previous value + 1 */ EnumMember emprev = null; for (size_t i = 0; i < em.ed.members.dim; i++) { EnumMember enm = (*em.ed.members)[i].isEnumMember(); if (enm) { if (enm == em) break; emprev = enm; } } assert(emprev); if (emprev.semanticRun < PASS.semanticdone) // if forward reference emprev.dsymbolSemantic(emprev._scope); // resolve it if (emprev.errors) return errorReturn(); Expression eprev = emprev.value; // .toHeadMutable() due to https://issues.dlang.org/show_bug.cgi?id=18645 Type tprev = eprev.type.toHeadMutable().equals(em.ed.type.toHeadMutable()) ? em.ed.memtype : eprev.type; Expression emax = tprev.getProperty(em.ed.loc, Id.max, 0); emax = emax.expressionSemantic(sc); emax = emax.ctfeInterpret(); // Set value to (eprev + 1). // But first check that (eprev != emax) assert(eprev); Expression e = new EqualExp(TOK.equal, em.loc, eprev, emax); e = e.expressionSemantic(sc); e = e.ctfeInterpret(); if (e.toInteger()) { em.error("initialization with `%s.%s+1` causes overflow for type `%s`", emprev.ed.toChars(), emprev.toChars(), em.ed.memtype.toChars()); return errorReturn(); } // Now set e to (eprev + 1) e = new AddExp(em.loc, eprev, new IntegerExp(em.loc, 1, Type.tint32)); e = e.expressionSemantic(sc); e = e.castTo(sc, eprev.type); e = e.ctfeInterpret(); // save origValue (without cast) for better json output if (e.op != TOK.error) // avoid duplicate diagnostics { assert(emprev.origValue); em.origValue = new AddExp(em.loc, emprev.origValue, new IntegerExp(em.loc, 1, Type.tint32)); em.origValue = em.origValue.expressionSemantic(sc); em.origValue = em.origValue.ctfeInterpret(); } if (e.op == TOK.error) return errorReturn(); if (e.type.isfloating()) { // Check that e != eprev (not always true for floats) Expression etest = new EqualExp(TOK.equal, em.loc, e, eprev); etest = etest.expressionSemantic(sc); etest = etest.ctfeInterpret(); if (etest.toInteger()) { em.error("has inexact value due to loss of precision"); return errorReturn(); } } em.value = e; } if (!em.origType) em.type = em.value.type; assert(em.origValue); em.semanticRun = PASS.semanticdone; } override void visit(TemplateDeclaration tempdecl) { static if (LOG) { printf("TemplateDeclaration.dsymbolSemantic(this = %p, id = '%s')\n", this, tempdecl.ident.toChars()); printf("sc.stc = %llx\n", sc.stc); printf("sc.module = %s\n", sc._module.toChars()); } if (tempdecl.semanticRun != PASS.init) return; // semantic() already run if (tempdecl._scope) { sc = tempdecl._scope; tempdecl._scope = null; } if (!sc) return; // Remember templates defined in module object that we need to know about if (sc._module && sc._module.ident == Id.object) { if (tempdecl.ident == Id.RTInfo) Type.rtinfo = tempdecl; } /* Remember Scope for later instantiations, but make * a copy since attributes can change. */ if (!tempdecl._scope) { tempdecl._scope = sc.copy(); tempdecl._scope.setNoFree(); } tempdecl.semanticRun = PASS.semantic; tempdecl.parent = sc.parent; tempdecl.protection = sc.protection; tempdecl.isstatic = tempdecl.toParent().isModule() || (tempdecl._scope.stc & STC.static_); if (!tempdecl.isstatic) { if (auto ad = tempdecl.parent.pastMixin().isAggregateDeclaration()) ad.makeNested(); } // Set up scope for parameters auto paramsym = new ScopeDsymbol(); paramsym.parent = tempdecl.parent; Scope* paramscope = sc.push(paramsym); paramscope.stc = 0; if (global.params.doDocComments) { tempdecl.origParameters = new TemplateParameters(); tempdecl.origParameters.setDim(tempdecl.parameters.dim); for (size_t i = 0; i < tempdecl.parameters.dim; i++) { TemplateParameter tp = (*tempdecl.parameters)[i]; (*tempdecl.origParameters)[i] = tp.syntaxCopy(); } } for (size_t i = 0; i < tempdecl.parameters.dim; i++) { TemplateParameter tp = (*tempdecl.parameters)[i]; if (!tp.declareParameter(paramscope)) { error(tp.loc, "parameter `%s` multiply defined", tp.ident.toChars()); tempdecl.errors = true; } if (!tp.tpsemantic(paramscope, tempdecl.parameters)) { tempdecl.errors = true; } if (i + 1 != tempdecl.parameters.dim && tp.isTemplateTupleParameter()) { tempdecl.error("template tuple parameter must be last one"); tempdecl.errors = true; } } /* Calculate TemplateParameter.dependent */ TemplateParameters tparams; tparams.setDim(1); for (size_t i = 0; i < tempdecl.parameters.dim; i++) { TemplateParameter tp = (*tempdecl.parameters)[i]; tparams[0] = tp; for (size_t j = 0; j < tempdecl.parameters.dim; j++) { // Skip cases like: X(T : T) if (i == j) continue; if (TemplateTypeParameter ttp = (*tempdecl.parameters)[j].isTemplateTypeParameter()) { if (reliesOnTident(ttp.specType, &tparams)) tp.dependent = true; } else if (TemplateAliasParameter tap = (*tempdecl.parameters)[j].isTemplateAliasParameter()) { if (reliesOnTident(tap.specType, &tparams) || reliesOnTident(isType(tap.specAlias), &tparams)) { tp.dependent = true; } } } } paramscope.pop(); // Compute again tempdecl.onemember = null; if (tempdecl.members) { Dsymbol s; if (Dsymbol.oneMembers(tempdecl.members, &s, tempdecl.ident) && s) { tempdecl.onemember = s; s.parent = tempdecl; } } /* BUG: should check: * o no virtual functions or non-static data members of classes */ tempdecl.semanticRun = PASS.semanticdone; } override void visit(TemplateInstance ti) { templateInstanceSemantic(ti, sc, null); } override void visit(TemplateMixin tm) { static if (LOG) { printf("+TemplateMixin.dsymbolSemantic('%s', this=%p)\n",tm.toChars(), tm); fflush(stdout); } if (tm.semanticRun != PASS.init) { // When a class/struct contains mixin members, and is done over // because of forward references, never reach here so semanticRun // has been reset to PASS.init. static if (LOG) { printf("\tsemantic done\n"); } return; } tm.semanticRun = PASS.semantic; static if (LOG) { printf("\tdo semantic\n"); } Scope* scx = null; if (tm._scope) { sc = tm._scope; scx = tm._scope; // save so we don't make redundant copies tm._scope = null; } /* Run semantic on each argument, place results in tiargs[], * then find best match template with tiargs */ if (!tm.findTempDecl(sc) || !tm.semanticTiargs(sc) || !tm.findBestMatch(sc, null)) { if (tm.semanticRun == PASS.init) // forward reference had occurred { //printf("forward reference - deferring\n"); tm._scope = scx ? scx : sc.copy(); tm._scope.setNoFree(); tm._scope._module.addDeferredSemantic(tm); return; } tm.inst = tm; tm.errors = true; return; // error recovery } auto tempdecl = tm.tempdecl.isTemplateDeclaration(); assert(tempdecl); if (!tm.ident) { /* Assign scope local unique identifier, as same as lambdas. */ const(char)* s = "__mixin"; if (FuncDeclaration func = sc.parent.isFuncDeclaration()) { tm.symtab = func.localsymtab; if (tm.symtab) { // Inside template constraint, symtab is not set yet. goto L1; } } else { tm.symtab = sc.parent.isScopeDsymbol().symtab; L1: assert(tm.symtab); tm.ident = Identifier.generateId(s, tm.symtab.len + 1); tm.symtab.insert(tm); } } tm.inst = tm; tm.parent = sc.parent; /* Detect recursive mixin instantiations. */ for (Dsymbol s = tm.parent; s; s = s.parent) { //printf("\ts = '%s'\n", s.toChars()); TemplateMixin tmix = s.isTemplateMixin(); if (!tmix || tempdecl != tmix.tempdecl) continue; /* Different argument list lengths happen with variadic args */ if (tm.tiargs.dim != tmix.tiargs.dim) continue; for (size_t i = 0; i < tm.tiargs.dim; i++) { RootObject o = (*tm.tiargs)[i]; Type ta = isType(o); Expression ea = isExpression(o); Dsymbol sa = isDsymbol(o); RootObject tmo = (*tmix.tiargs)[i]; if (ta) { Type tmta = isType(tmo); if (!tmta) goto Lcontinue; if (!ta.equals(tmta)) goto Lcontinue; } else if (ea) { Expression tme = isExpression(tmo); if (!tme || !ea.equals(tme)) goto Lcontinue; } else if (sa) { Dsymbol tmsa = isDsymbol(tmo); if (sa != tmsa) goto Lcontinue; } else assert(0); } tm.error("recursive mixin instantiation"); return; Lcontinue: continue; } // Copy the syntax trees from the TemplateDeclaration tm.members = Dsymbol.arraySyntaxCopy(tempdecl.members); if (!tm.members) return; tm.symtab = new DsymbolTable(); for (Scope* sce = sc; 1; sce = sce.enclosing) { ScopeDsymbol sds = sce.scopesym; if (sds) { sds.importScope(tm, Prot(Prot.Kind.public_)); break; } } static if (LOG) { printf("\tcreate scope for template parameters '%s'\n", tm.toChars()); } Scope* scy = sc.push(tm); scy.parent = tm; tm.argsym = new ScopeDsymbol(); tm.argsym.parent = scy.parent; Scope* argscope = scy.push(tm.argsym); uint errorsave = global.errors; // Declare each template parameter as an alias for the argument type tm.declareParameters(argscope); // Add members to enclosing scope, as well as this scope for (size_t i = 0; i < tm.members.dim; i++) { Dsymbol s = (*tm.members)[i]; s.addMember(argscope, tm); //printf("sc.parent = %p, sc.scopesym = %p\n", sc.parent, sc.scopesym); //printf("s.parent = %s\n", s.parent.toChars()); } // Do semantic() analysis on template instance members static if (LOG) { printf("\tdo semantic() on template instance members '%s'\n", tm.toChars()); } Scope* sc2 = argscope.push(tm); //size_t deferred_dim = Module.deferred.dim; static __gshared int nest; //printf("%d\n", nest); if (++nest > 500) { global.gag = 0; // ensure error message gets printed tm.error("recursive expansion"); fatal(); } for (size_t i = 0; i < tm.members.dim; i++) { Dsymbol s = (*tm.members)[i]; s.setScope(sc2); } for (size_t i = 0; i < tm.members.dim; i++) { Dsymbol s = (*tm.members)[i]; s.importAll(sc2); } for (size_t i = 0; i < tm.members.dim; i++) { Dsymbol s = (*tm.members)[i]; s.dsymbolSemantic(sc2); } nest--; /* In DeclDefs scope, TemplateMixin does not have to handle deferred symbols. * Because the members would already call Module.addDeferredSemantic() for themselves. * See Struct, Class, Interface, and EnumDeclaration.dsymbolSemantic(). */ //if (!sc.func && Module.deferred.dim > deferred_dim) {} AggregateDeclaration ad = tm.toParent().isAggregateDeclaration(); if (sc.func && !ad) { tm.semantic2(sc2); tm.semantic3(sc2); } // Give additional context info if error occurred during instantiation if (global.errors != errorsave) { tm.error("error instantiating"); tm.errors = true; } sc2.pop(); argscope.pop(); scy.pop(); static if (LOG) { printf("-TemplateMixin.dsymbolSemantic('%s', this=%p)\n", tm.toChars(), tm); } } override void visit(Nspace ns) { if (ns.semanticRun != PASS.init) return; static if (LOG) { printf("+Nspace::semantic('%s')\n", ns.toChars()); } if (ns._scope) { sc = ns._scope; ns._scope = null; } if (!sc) return; ns.semanticRun = PASS.semantic; ns.parent = sc.parent; if (ns.members) { assert(sc); sc = sc.push(ns); sc.linkage = LINK.cpp; // note that namespaces imply C++ linkage sc.parent = ns; foreach (s; *ns.members) { s.importAll(sc); } foreach (s; *ns.members) { static if (LOG) { printf("\tmember '%s', kind = '%s'\n", s.toChars(), s.kind()); } s.dsymbolSemantic(sc); } sc.pop(); } ns.semanticRun = PASS.semanticdone; static if (LOG) { printf("-Nspace::semantic('%s')\n", ns.toChars()); } } void funcDeclarationSemantic(FuncDeclaration funcdecl) { TypeFunction f; AggregateDeclaration ad; InterfaceDeclaration id; version (none) { printf("FuncDeclaration::semantic(sc = %p, this = %p, '%s', linkage = %d)\n", sc, funcdecl, funcdecl.toPrettyChars(), sc.linkage); if (funcdecl.isFuncLiteralDeclaration()) printf("\tFuncLiteralDeclaration()\n"); printf("sc.parent = %s, parent = %s\n", sc.parent.toChars(), funcdecl.parent ? funcdecl.parent.toChars() : ""); printf("type: %p, %s\n", funcdecl.type, funcdecl.type.toChars()); } if (funcdecl.semanticRun != PASS.init && funcdecl.isFuncLiteralDeclaration()) { /* Member functions that have return types that are * forward references can have semantic() run more than * once on them. * See test\interface2.d, test20 */ return; } if (funcdecl.semanticRun >= PASS.semanticdone) return; assert(funcdecl.semanticRun <= PASS.semantic); funcdecl.semanticRun = PASS.semantic; if (funcdecl._scope) { sc = funcdecl._scope; funcdecl._scope = null; } if (!sc || funcdecl.errors) return; funcdecl.parent = sc.parent; Dsymbol parent = funcdecl.toParent(); funcdecl.foverrides.setDim(0); // reset in case semantic() is being retried for this function funcdecl.storage_class |= sc.stc & ~STC.ref_; ad = funcdecl.isThis(); // Don't nest structs b/c of generated methods which should not access the outer scopes. // https://issues.dlang.org/show_bug.cgi?id=16627 if (ad && !funcdecl.generated) { funcdecl.storage_class |= ad.storage_class & (STC.TYPECTOR | STC.synchronized_); ad.makeNested(); } if (sc.func) funcdecl.storage_class |= sc.func.storage_class & STC.disable; // Remove prefix storage classes silently. if ((funcdecl.storage_class & STC.TYPECTOR) && !(ad || funcdecl.isNested())) funcdecl.storage_class &= ~STC.TYPECTOR; //printf("function storage_class = x%llx, sc.stc = x%llx, %x\n", storage_class, sc.stc, Declaration::isFinal()); if (sc.flags & SCOPE.compile) funcdecl.flags |= FUNCFLAG.compileTimeOnly; // don't emit code for this function FuncLiteralDeclaration fld = funcdecl.isFuncLiteralDeclaration(); if (fld && fld.treq) { Type treq = fld.treq; assert(treq.nextOf().ty == Tfunction); if (treq.ty == Tdelegate) fld.tok = TOK.delegate_; else if (treq.ty == Tpointer && treq.nextOf().ty == Tfunction) fld.tok = TOK.function_; else assert(0); funcdecl.linkage = treq.nextOf().toTypeFunction().linkage; } else funcdecl.linkage = sc.linkage; funcdecl.inlining = sc.inlining; funcdecl.protection = sc.protection; funcdecl.userAttribDecl = sc.userAttribDecl; if (!funcdecl.originalType) funcdecl.originalType = funcdecl.type.syntaxCopy(); if (funcdecl.type.ty != Tfunction) { if (funcdecl.type.ty != Terror) { funcdecl.error("`%s` must be a function instead of `%s`", funcdecl.toChars(), funcdecl.type.toChars()); funcdecl.type = Type.terror; } funcdecl.errors = true; return; } if (!funcdecl.type.deco) { sc = sc.push(); sc.stc |= funcdecl.storage_class & (STC.disable | STC.deprecated_); // forward to function type TypeFunction tf = funcdecl.type.toTypeFunction(); if (sc.func) { /* If the nesting parent is pure without inference, * then this function defaults to pure too. * * auto foo() pure { * auto bar() {} // become a weak purity function * class C { // nested class * auto baz() {} // become a weak purity function * } * * static auto boo() {} // typed as impure * // Even though, boo cannot call any impure functions. * // See also Expression::checkPurity(). * } */ if (tf.purity == PURE.impure && (funcdecl.isNested() || funcdecl.isThis())) { FuncDeclaration fd = null; for (Dsymbol p = funcdecl.toParent2(); p; p = p.toParent2()) { if (AggregateDeclaration adx = p.isAggregateDeclaration()) { if (adx.isNested()) continue; break; } if ((fd = p.isFuncDeclaration()) !is null) break; } /* If the parent's purity is inferred, then this function's purity needs * to be inferred first. */ if (fd && fd.isPureBypassingInference() >= PURE.weak && !funcdecl.isInstantiated()) { tf.purity = PURE.fwdref; // default to pure } } } if (tf.isref) sc.stc |= STC.ref_; if (tf.isscope) sc.stc |= STC.scope_; if (tf.isnothrow) sc.stc |= STC.nothrow_; if (tf.isnogc) sc.stc |= STC.nogc; if (tf.isproperty) sc.stc |= STC.property; if (tf.purity == PURE.fwdref) sc.stc |= STC.pure_; if (tf.trust != TRUST.default_) sc.stc &= ~(STC.safe | STC.system | STC.trusted); if (tf.trust == TRUST.safe) sc.stc |= STC.safe; if (tf.trust == TRUST.system) sc.stc |= STC.system; if (tf.trust == TRUST.trusted) sc.stc |= STC.trusted; if (funcdecl.isCtorDeclaration()) { sc.flags |= SCOPE.ctor; Type tret = ad.handleType(); assert(tret); tret = tret.addStorageClass(funcdecl.storage_class | sc.stc); tret = tret.addMod(funcdecl.type.mod); tf.next = tret; if (ad.isStructDeclaration()) sc.stc |= STC.ref_; } // 'return' on a non-static class member function implies 'scope' as well if (ad && ad.isClassDeclaration() && (tf.isreturn || sc.stc & STC.return_) && !(sc.stc & STC.static_)) sc.stc |= STC.scope_; // If 'this' has no pointers, remove 'scope' as it has no meaning if (sc.stc & STC.scope_ && ad && ad.isStructDeclaration() && !ad.type.hasPointers()) { sc.stc &= ~STC.scope_; tf.isscope = false; } sc.linkage = funcdecl.linkage; if (!tf.isNaked() && !(funcdecl.isThis() || funcdecl.isNested())) { OutBuffer buf; MODtoBuffer(&buf, tf.mod); funcdecl.error("without `this` cannot be `%s`", buf.peekString()); tf.mod = 0; // remove qualifiers } /* Apply const, immutable, wild and shared storage class * to the function type. Do this before type semantic. */ auto stc = funcdecl.storage_class; if (funcdecl.type.isImmutable()) stc |= STC.immutable_; if (funcdecl.type.isConst()) stc |= STC.const_; if (funcdecl.type.isShared() || funcdecl.storage_class & STC.synchronized_) stc |= STC.shared_; if (funcdecl.type.isWild()) stc |= STC.wild; funcdecl.type = funcdecl.type.addSTC(stc); funcdecl.type = funcdecl.type.typeSemantic(funcdecl.loc, sc); sc = sc.pop(); } if (funcdecl.type.ty != Tfunction) { if (funcdecl.type.ty != Terror) { funcdecl.error("`%s` must be a function instead of `%s`", funcdecl.toChars(), funcdecl.type.toChars()); funcdecl.type = Type.terror; } funcdecl.errors = true; return; } else { // Merge back function attributes into 'originalType'. // It's used for mangling, ddoc, and json output. TypeFunction tfo = funcdecl.originalType.toTypeFunction(); TypeFunction tfx = funcdecl.type.toTypeFunction(); tfo.mod = tfx.mod; tfo.isscope = tfx.isscope; tfo.isscopeinferred = tfx.isscopeinferred; tfo.isref = tfx.isref; tfo.isnothrow = tfx.isnothrow; tfo.isnogc = tfx.isnogc; tfo.isproperty = tfx.isproperty; tfo.purity = tfx.purity; tfo.trust = tfx.trust; funcdecl.storage_class &= ~(STC.TYPECTOR | STC.FUNCATTR); } f = cast(TypeFunction)funcdecl.type; if ((funcdecl.storage_class & STC.auto_) && !f.isref && !funcdecl.inferRetType) funcdecl.error("storage class `auto` has no effect if return type is not inferred"); /* Functions can only be 'scope' if they have a 'this' */ if (f.isscope && !funcdecl.isNested() && !ad) { funcdecl.error("functions cannot be `scope`"); } if (f.isreturn && !funcdecl.needThis() && !funcdecl.isNested()) { /* Non-static nested functions have a hidden 'this' pointer to which * the 'return' applies */ funcdecl.error("`static` member has no `this` to which `return` can apply"); } if (funcdecl.isAbstract() && !funcdecl.isVirtual()) { const(char)* sfunc; if (funcdecl.isStatic()) sfunc = "static"; else if (funcdecl.protection.kind == Prot.Kind.private_ || funcdecl.protection.kind == Prot.Kind.package_) sfunc = protectionToChars(funcdecl.protection.kind); else sfunc = "final"; funcdecl.error("`%s` functions cannot be `abstract`", sfunc); } if (funcdecl.isOverride() && !funcdecl.isVirtual()) { Prot.Kind kind = funcdecl.prot().kind; if ((kind == Prot.Kind.private_ || kind == Prot.Kind.package_) && funcdecl.isMember()) funcdecl.error("`%s` method is not virtual and cannot override", protectionToChars(kind)); else funcdecl.error("cannot override a non-virtual function"); } if (funcdecl.isAbstract() && funcdecl.isFinalFunc()) funcdecl.error("cannot be both `final` and `abstract`"); version (none) { if (funcdecl.isAbstract() && funcdecl.fbody) funcdecl.error("`abstract` functions cannot have bodies"); } version (none) { if (funcdecl.isStaticConstructor() || funcdecl.isStaticDestructor()) { if (!funcdecl.isStatic() || funcdecl.type.nextOf().ty != Tvoid) funcdecl.error("static constructors / destructors must be `static void`"); if (f.arguments && f.arguments.dim) funcdecl.error("static constructors / destructors must have empty parameter list"); // BUG: check for invalid storage classes } } id = parent.isInterfaceDeclaration(); if (id) { funcdecl.storage_class |= STC.abstract_; if (funcdecl.isCtorDeclaration() || funcdecl.isPostBlitDeclaration() || funcdecl.isDtorDeclaration() || funcdecl.isInvariantDeclaration() || funcdecl.isNewDeclaration() || funcdecl.isDelete()) funcdecl.error("constructors, destructors, postblits, invariants, new and delete functions are not allowed in interface `%s`", id.toChars()); if (funcdecl.fbody && funcdecl.isVirtual()) funcdecl.error("function body only allowed in `final` functions in interface `%s`", id.toChars()); } if (UnionDeclaration ud = parent.isUnionDeclaration()) { if (funcdecl.isPostBlitDeclaration() || funcdecl.isDtorDeclaration() || funcdecl.isInvariantDeclaration()) funcdecl.error("destructors, postblits and invariants are not allowed in union `%s`", ud.toChars()); } if (StructDeclaration sd = parent.isStructDeclaration()) { if (funcdecl.isCtorDeclaration()) { goto Ldone; } } if (ClassDeclaration cd = parent.isClassDeclaration()) { if (funcdecl.isCtorDeclaration()) { goto Ldone; } if (funcdecl.storage_class & STC.abstract_) cd.isabstract = Abstract.yes; // if static function, do not put in vtbl[] if (!funcdecl.isVirtual()) { //printf("\tnot virtual\n"); goto Ldone; } // Suppress further errors if the return type is an error if (funcdecl.type.nextOf() == Type.terror) goto Ldone; bool may_override = false; for (size_t i = 0; i < cd.baseclasses.dim; i++) { BaseClass* b = (*cd.baseclasses)[i]; ClassDeclaration cbd = b.type.toBasetype().isClassHandle(); if (!cbd) continue; for (size_t j = 0; j < cbd.vtbl.dim; j++) { FuncDeclaration f2 = cbd.vtbl[j].isFuncDeclaration(); if (!f2 || f2.ident != funcdecl.ident) continue; if (cbd.parent && cbd.parent.isTemplateInstance()) { if (!f2.functionSemantic()) goto Ldone; } may_override = true; } } if (may_override && funcdecl.type.nextOf() is null) { /* If same name function exists in base class but 'this' is auto return, * cannot find index of base class's vtbl[] to override. */ funcdecl.error("return type inference is not supported if may override base class function"); } /* Find index of existing function in base class's vtbl[] to override * (the index will be the same as in cd's current vtbl[]) */ int vi = cd.baseClass ? funcdecl.findVtblIndex(&cd.baseClass.vtbl, cast(int)cd.baseClass.vtbl.dim) : -1; bool doesoverride = false; switch (vi) { case -1: Lintro: /* Didn't find one, so * This is an 'introducing' function which gets a new * slot in the vtbl[]. */ // Verify this doesn't override previous final function if (cd.baseClass) { Dsymbol s = cd.baseClass.search(funcdecl.loc, funcdecl.ident); if (s) { FuncDeclaration f2 = s.isFuncDeclaration(); if (f2) { f2 = f2.overloadExactMatch(funcdecl.type); if (f2 && f2.isFinalFunc() && f2.prot().kind != Prot.Kind.private_) funcdecl.error("cannot override `final` function `%s`", f2.toPrettyChars()); } } } /* These quirky conditions mimic what VC++ appears to do */ if (global.params.mscoff && cd.classKind == ClassKind.cpp && cd.baseClass && cd.baseClass.vtbl.dim) { /* if overriding an interface function, then this is not * introducing and don't put it in the class vtbl[] */ funcdecl.interfaceVirtual = funcdecl.overrideInterface(); if (funcdecl.interfaceVirtual) { //printf("\tinterface function %s\n", toChars()); cd.vtblFinal.push(funcdecl); goto Linterfaces; } } if (funcdecl.isFinalFunc()) { // Don't check here, as it may override an interface function //if (isOverride()) // error("is marked as override, but does not override any function"); cd.vtblFinal.push(funcdecl); } else { //printf("\tintroducing function %s\n", toChars()); funcdecl.introducing = 1; if (cd.classKind == ClassKind.cpp && Target.reverseCppOverloads) { // with dmc, overloaded functions are grouped and in reverse order funcdecl.vtblIndex = cast(int)cd.vtbl.dim; for (size_t i = 0; i < cd.vtbl.dim; i++) { if (cd.vtbl[i].ident == funcdecl.ident && cd.vtbl[i].parent == parent) { funcdecl.vtblIndex = cast(int)i; break; } } // shift all existing functions back for (size_t i = cd.vtbl.dim; i > funcdecl.vtblIndex; i--) { FuncDeclaration fd = cd.vtbl[i - 1].isFuncDeclaration(); assert(fd); fd.vtblIndex++; } cd.vtbl.insert(funcdecl.vtblIndex, funcdecl); } else { // Append to end of vtbl[] vi = cast(int)cd.vtbl.dim; cd.vtbl.push(funcdecl); funcdecl.vtblIndex = vi; } } break; case -2: // can't determine because of forward references funcdecl.errors = true; return; default: { FuncDeclaration fdv = cd.baseClass.vtbl[vi].isFuncDeclaration(); FuncDeclaration fdc = cd.vtbl[vi].isFuncDeclaration(); // This function is covariant with fdv if (fdc == funcdecl) { doesoverride = true; break; } if (fdc.toParent() == parent) { //printf("vi = %d,\tthis = %p %s %s @ [%s]\n\tfdc = %p %s %s @ [%s]\n\tfdv = %p %s %s @ [%s]\n", // vi, this, this.toChars(), this.type.toChars(), this.loc.toChars(), // fdc, fdc .toChars(), fdc .type.toChars(), fdc .loc.toChars(), // fdv, fdv .toChars(), fdv .type.toChars(), fdv .loc.toChars()); // fdc overrides fdv exactly, then this introduces new function. if (fdc.type.mod == fdv.type.mod && funcdecl.type.mod != fdv.type.mod) goto Lintro; } if (fdv.isDeprecated) deprecation(funcdecl.loc, "`%s` is overriding the deprecated method `%s`", funcdecl.toPrettyChars, fdv.toPrettyChars); // This function overrides fdv if (fdv.isFinalFunc()) funcdecl.error("cannot override `final` function `%s`", fdv.toPrettyChars()); if (!funcdecl.isOverride()) { if (fdv.isFuture()) { deprecation(funcdecl.loc, "`@__future` base class method `%s` is being overridden by `%s`; rename the latter", fdv.toPrettyChars(), funcdecl.toPrettyChars()); // Treat 'this' as an introducing function, giving it a separate hierarchy in the vtbl[] goto Lintro; } else { int vi2 = funcdecl.findVtblIndex(&cd.baseClass.vtbl, cast(int)cd.baseClass.vtbl.dim, false); if (vi2 < 0) // https://issues.dlang.org/show_bug.cgi?id=17349 deprecation(funcdecl.loc, "cannot implicitly override base class method `%s` with `%s`; add `override` attribute", fdv.toPrettyChars(), funcdecl.toPrettyChars()); else error(funcdecl.loc, "cannot implicitly override base class method `%s` with `%s`; add `override` attribute", fdv.toPrettyChars(), funcdecl.toPrettyChars()); } } doesoverride = true; if (fdc.toParent() == parent) { // If both are mixins, or both are not, then error. // If either is not, the one that is not overrides the other. bool thismixin = funcdecl.parent.isClassDeclaration() !is null; bool fdcmixin = fdc.parent.isClassDeclaration() !is null; if (thismixin == fdcmixin) { funcdecl.error("multiple overrides of same function"); } else if (!thismixin) // fdc overrides fdv { // this doesn't override any function break; } } cd.vtbl[vi] = funcdecl; funcdecl.vtblIndex = vi; /* Remember which functions this overrides */ funcdecl.foverrides.push(fdv); /* This works by whenever this function is called, * it actually returns tintro, which gets dynamically * cast to type. But we know that tintro is a base * of type, so we could optimize it by not doing a * dynamic cast, but just subtracting the isBaseOf() * offset if the value is != null. */ if (fdv.tintro) funcdecl.tintro = fdv.tintro; else if (!funcdecl.type.equals(fdv.type)) { /* Only need to have a tintro if the vptr * offsets differ */ int offset; if (fdv.type.nextOf().isBaseOf(funcdecl.type.nextOf(), &offset)) { funcdecl.tintro = fdv.type; } } break; } } /* Go through all the interface bases. * If this function is covariant with any members of those interface * functions, set the tintro. */ Linterfaces: foreach (b; cd.interfaces) { vi = funcdecl.findVtblIndex(&b.sym.vtbl, cast(int)b.sym.vtbl.dim); switch (vi) { case -1: break; case -2: // can't determine because of forward references funcdecl.errors = true; return; default: { auto fdv = cast(FuncDeclaration)b.sym.vtbl[vi]; Type ti = null; /* Remember which functions this overrides */ funcdecl.foverrides.push(fdv); /* Should we really require 'override' when implementing * an interface function? */ //if (!isOverride()) // warning(loc, "overrides base class function %s, but is not marked with 'override'", fdv.toPrettyChars()); if (fdv.tintro) ti = fdv.tintro; else if (!funcdecl.type.equals(fdv.type)) { /* Only need to have a tintro if the vptr * offsets differ */ int offset; if (fdv.type.nextOf().isBaseOf(funcdecl.type.nextOf(), &offset)) { ti = fdv.type; } } if (ti) { if (funcdecl.tintro) { if (!funcdecl.tintro.nextOf().equals(ti.nextOf()) && !funcdecl.tintro.nextOf().isBaseOf(ti.nextOf(), null) && !ti.nextOf().isBaseOf(funcdecl.tintro.nextOf(), null)) { funcdecl.error("incompatible covariant types `%s` and `%s`", funcdecl.tintro.toChars(), ti.toChars()); } } funcdecl.tintro = ti; } goto L2; } } } if (!doesoverride && funcdecl.isOverride() && (funcdecl.type.nextOf() || !may_override)) { BaseClass* bc = null; Dsymbol s = null; for (size_t i = 0; i < cd.baseclasses.dim; i++) { bc = (*cd.baseclasses)[i]; s = bc.sym.search_correct(funcdecl.ident); if (s) break; } if (s) { auto fd = s.isFuncDeclaration(); assert(fd); HdrGenState hgs; OutBuffer buf1, buf2; functionToBufferFull(cast(TypeFunction)(fd.type), &buf1, new Identifier(fd.toPrettyChars()), &hgs, null); functionToBufferFull(cast(TypeFunction)(funcdecl.type), &buf2, new Identifier(funcdecl.toPrettyChars()), &hgs, null); error(funcdecl.loc, "function `%s` does not override any function, did you mean to override `%s`?", buf2.extractString(), buf1.extractString()); } else funcdecl.error("does not override any function"); } L2: /* Go through all the interface bases. * Disallow overriding any final functions in the interface(s). */ foreach (b; cd.interfaces) { if (b.sym) { Dsymbol s = search_function(b.sym, funcdecl.ident); if (s) { FuncDeclaration f2 = s.isFuncDeclaration(); if (f2) { f2 = f2.overloadExactMatch(funcdecl.type); if (f2 && f2.isFinalFunc() && f2.prot().kind != Prot.Kind.private_) funcdecl.error("cannot override `final` function `%s.%s`", b.sym.toChars(), f2.toPrettyChars()); } } } } if (funcdecl.isOverride) { if (funcdecl.storage_class & STC.disable) deprecation(funcdecl.loc, "`%s` cannot be annotated with `@disable` because it is overriding a function in the base class", funcdecl.toPrettyChars); if (funcdecl.isDeprecated) deprecation(funcdecl.loc, "`%s` cannot be marked as `deprecated` because it is overriding a function in the base class", funcdecl.toPrettyChars); } } else if (funcdecl.isOverride() && !parent.isTemplateInstance()) funcdecl.error("`override` only applies to class member functions"); // Reflect this.type to f because it could be changed by findVtblIndex f = funcdecl.type.toTypeFunction(); Ldone: if (!funcdecl.fbody && !funcdecl.allowsContractWithoutBody()) funcdecl.error("`in` and `out` contracts can only appear without a body when they are virtual interface functions or abstract"); /* Do not allow template instances to add virtual functions * to a class. */ if (funcdecl.isVirtual()) { TemplateInstance ti = parent.isTemplateInstance(); if (ti) { // Take care of nested templates while (1) { TemplateInstance ti2 = ti.tempdecl.parent.isTemplateInstance(); if (!ti2) break; ti = ti2; } // If it's a member template ClassDeclaration cd = ti.tempdecl.isClassMember(); if (cd) { funcdecl.error("cannot use template to add virtual function to class `%s`", cd.toChars()); } } } if (funcdecl.isMain()) funcdecl.checkDmain(); // Check main() parameters and return type /* Purity and safety can be inferred for some functions by examining * the function body. */ if (funcdecl.canInferAttributes(sc)) funcdecl.initInferAttributes(); Module.dprogress++; funcdecl.semanticRun = PASS.semanticdone; /* Save scope for possible later use (if we need the * function internals) */ funcdecl._scope = sc.copy(); funcdecl._scope.setNoFree(); static __gshared bool printedMain = false; // semantic might run more than once if (global.params.verbose && !printedMain) { const(char)* type = funcdecl.isMain() ? "main" : funcdecl.isWinMain() ? "winmain" : funcdecl.isDllMain() ? "dllmain" : cast(const(char)*)null; Module mod = sc._module; if (type && mod) { printedMain = true; const(char)* name = FileName.searchPath(global.path, mod.srcfile.toChars(), true); message("entry %-10s\t%s", type, name); } } if (funcdecl.fbody && funcdecl.isMain() && sc._module.isRoot()) genCmain(sc); assert(funcdecl.type.ty != Terror || funcdecl.errors); } /// Do the semantic analysis on the external interface to the function. override void visit(FuncDeclaration funcdecl) { funcDeclarationSemantic(funcdecl); } override void visit(CtorDeclaration ctd) { //printf("CtorDeclaration::semantic() %s\n", toChars()); if (ctd.semanticRun >= PASS.semanticdone) return; if (ctd._scope) { sc = ctd._scope; ctd._scope = null; } ctd.parent = sc.parent; Dsymbol p = ctd.toParent2(); AggregateDeclaration ad = p.isAggregateDeclaration(); if (!ad) { error(ctd.loc, "constructor can only be a member of aggregate, not %s `%s`", p.kind(), p.toChars()); ctd.type = Type.terror; ctd.errors = true; return; } sc = sc.push(); sc.stc &= ~STC.static_; // not a static constructor sc.flags |= SCOPE.ctor; funcDeclarationSemantic(ctd); sc.pop(); if (ctd.errors) return; TypeFunction tf = ctd.type.toTypeFunction(); /* See if it's the default constructor * But, template constructor should not become a default constructor. */ if (ad && (!ctd.parent.isTemplateInstance() || ctd.parent.isTemplateMixin())) { immutable dim = Parameter.dim(tf.parameters); if (auto sd = ad.isStructDeclaration()) { if (dim == 0 && tf.varargs == 0) // empty default ctor w/o any varargs { if (ctd.fbody || !(ctd.storage_class & STC.disable)) { ctd.error("default constructor for structs only allowed " ~ "with `@disable`, no body, and no parameters"); ctd.storage_class |= STC.disable; ctd.fbody = null; } sd.noDefaultCtor = true; } else if (dim == 0 && tf.varargs) // allow varargs only ctor { } else if (dim && Parameter.getNth(tf.parameters, 0).defaultArg) { // if the first parameter has a default argument, then the rest does as well if (ctd.storage_class & STC.disable) { ctd.deprecation("is marked `@disable`, so it cannot have default "~ "arguments for all parameters."); deprecationSupplemental(ctd.loc, "Use `@disable this();` if you want to disable default initialization."); } else ctd.deprecation("all parameters have default arguments, "~ "but structs cannot have default constructors."); } } else if (dim == 0 && tf.varargs == 0) { ad.defaultCtor = ctd; } } } override void visit(PostBlitDeclaration pbd) { //printf("PostBlitDeclaration::semantic() %s\n", toChars()); //printf("ident: %s, %s, %p, %p\n", ident.toChars(), Id::dtor.toChars(), ident, Id::dtor); //printf("stc = x%llx\n", sc.stc); if (pbd.semanticRun >= PASS.semanticdone) return; if (pbd._scope) { sc = pbd._scope; pbd._scope = null; } pbd.parent = sc.parent; Dsymbol p = pbd.toParent2(); StructDeclaration ad = p.isStructDeclaration(); if (!ad) { error(pbd.loc, "postblit can only be a member of struct, not %s `%s`", p.kind(), p.toChars()); pbd.type = Type.terror; pbd.errors = true; return; } if (pbd.ident == Id.postblit && pbd.semanticRun < PASS.semantic) ad.postblits.push(pbd); if (!pbd.type) pbd.type = new TypeFunction(null, Type.tvoid, false, LINK.d, pbd.storage_class); sc = sc.push(); sc.stc &= ~STC.static_; // not static sc.linkage = LINK.d; funcDeclarationSemantic(pbd); sc.pop(); } override void visit(DtorDeclaration dd) { //printf("DtorDeclaration::semantic() %s\n", toChars()); //printf("ident: %s, %s, %p, %p\n", ident.toChars(), Id::dtor.toChars(), ident, Id::dtor); if (dd.semanticRun >= PASS.semanticdone) return; if (dd._scope) { sc = dd._scope; dd._scope = null; } dd.parent = sc.parent; Dsymbol p = dd.toParent2(); AggregateDeclaration ad = p.isAggregateDeclaration(); if (!ad) { error(dd.loc, "destructor can only be a member of aggregate, not %s `%s`", p.kind(), p.toChars()); dd.type = Type.terror; dd.errors = true; return; } if (dd.ident == Id.dtor && dd.semanticRun < PASS.semantic) ad.dtors.push(dd); if (!dd.type) dd.type = new TypeFunction(null, Type.tvoid, false, LINK.d, dd.storage_class); sc = sc.push(); sc.stc &= ~STC.static_; // not a static destructor if (sc.linkage != LINK.cpp) sc.linkage = LINK.d; funcDeclarationSemantic(dd); sc.pop(); } override void visit(StaticCtorDeclaration scd) { //printf("StaticCtorDeclaration::semantic()\n"); if (scd.semanticRun >= PASS.semanticdone) return; if (scd._scope) { sc = scd._scope; scd._scope = null; } scd.parent = sc.parent; Dsymbol p = scd.parent.pastMixin(); if (!p.isScopeDsymbol()) { const(char)* s = (scd.isSharedStaticCtorDeclaration() ? "shared " : ""); error(scd.loc, "`%sstatic` constructor can only be member of module/aggregate/template, not %s `%s`", s, p.kind(), p.toChars()); scd.type = Type.terror; scd.errors = true; return; } if (!scd.type) scd.type = new TypeFunction(null, Type.tvoid, false, LINK.d, scd.storage_class); /* If the static ctor appears within a template instantiation, * it could get called multiple times by the module constructors * for different modules. Thus, protect it with a gate. */ if (scd.isInstantiated() && scd.semanticRun < PASS.semantic) { /* Add this prefix to the function: * static int gate; * if (++gate != 1) return; * Note that this is not thread safe; should not have threads * during static construction. */ auto v = new VarDeclaration(Loc.initial, Type.tint32, Id.gate, null); v.storage_class = STC.temp | (scd.isSharedStaticCtorDeclaration() ? STC.static_ : STC.tls); auto sa = new Statements(); Statement s = new ExpStatement(Loc.initial, v); sa.push(s); Expression e = new IdentifierExp(Loc.initial, v.ident); e = new AddAssignExp(Loc.initial, e, new IntegerExp(1)); e = new EqualExp(TOK.notEqual, Loc.initial, e, new IntegerExp(1)); s = new IfStatement(Loc.initial, null, e, new ReturnStatement(Loc.initial, null), null, Loc.initial); sa.push(s); if (scd.fbody) sa.push(scd.fbody); scd.fbody = new CompoundStatement(Loc.initial, sa); } funcDeclarationSemantic(scd); // We're going to need ModuleInfo Module m = scd.getModule(); if (!m) m = sc._module; if (m) { m.needmoduleinfo = 1; //printf("module1 %s needs moduleinfo\n", m.toChars()); } } override void visit(StaticDtorDeclaration sdd) { if (sdd.semanticRun >= PASS.semanticdone) return; if (sdd._scope) { sc = sdd._scope; sdd._scope = null; } sdd.parent = sc.parent; Dsymbol p = sdd.parent.pastMixin(); if (!p.isScopeDsymbol()) { const(char)* s = (sdd.isSharedStaticDtorDeclaration() ? "shared " : ""); error(sdd.loc, "`%sstatic` destructor can only be member of module/aggregate/template, not %s `%s`", s, p.kind(), p.toChars()); sdd.type = Type.terror; sdd.errors = true; return; } if (!sdd.type) sdd.type = new TypeFunction(null, Type.tvoid, false, LINK.d, sdd.storage_class); /* If the static ctor appears within a template instantiation, * it could get called multiple times by the module constructors * for different modules. Thus, protect it with a gate. */ if (sdd.isInstantiated() && sdd.semanticRun < PASS.semantic) { /* Add this prefix to the function: * static int gate; * if (--gate != 0) return; * Increment gate during constructor execution. * Note that this is not thread safe; should not have threads * during static destruction. */ auto v = new VarDeclaration(Loc.initial, Type.tint32, Id.gate, null); v.storage_class = STC.temp | (sdd.isSharedStaticDtorDeclaration() ? STC.static_ : STC.tls); auto sa = new Statements(); Statement s = new ExpStatement(Loc.initial, v); sa.push(s); Expression e = new IdentifierExp(Loc.initial, v.ident); e = new AddAssignExp(Loc.initial, e, new IntegerExp(-1)); e = new EqualExp(TOK.notEqual, Loc.initial, e, new IntegerExp(0)); s = new IfStatement(Loc.initial, null, e, new ReturnStatement(Loc.initial, null), null, Loc.initial); sa.push(s); if (sdd.fbody) sa.push(sdd.fbody); sdd.fbody = new CompoundStatement(Loc.initial, sa); sdd.vgate = v; } funcDeclarationSemantic(sdd); // We're going to need ModuleInfo Module m = sdd.getModule(); if (!m) m = sc._module; if (m) { m.needmoduleinfo = 1; //printf("module2 %s needs moduleinfo\n", m.toChars()); } } override void visit(InvariantDeclaration invd) { if (invd.semanticRun >= PASS.semanticdone) return; if (invd._scope) { sc = invd._scope; invd._scope = null; } invd.parent = sc.parent; Dsymbol p = invd.parent.pastMixin(); AggregateDeclaration ad = p.isAggregateDeclaration(); if (!ad) { error(invd.loc, "`invariant` can only be a member of aggregate, not %s `%s`", p.kind(), p.toChars()); invd.type = Type.terror; invd.errors = true; return; } if (invd.ident != Id.classInvariant && invd.semanticRun < PASS.semantic && !ad.isUnionDeclaration() // users are on their own with union fields ) ad.invs.push(invd); if (!invd.type) invd.type = new TypeFunction(null, Type.tvoid, false, LINK.d, invd.storage_class); sc = sc.push(); sc.stc &= ~STC.static_; // not a static invariant sc.stc |= STC.const_; // invariant() is always const sc.flags = (sc.flags & ~SCOPE.contract) | SCOPE.invariant_; sc.linkage = LINK.d; funcDeclarationSemantic(invd); sc.pop(); } override void visit(UnitTestDeclaration utd) { if (utd.semanticRun >= PASS.semanticdone) return; if (utd._scope) { sc = utd._scope; utd._scope = null; } utd.protection = sc.protection; utd.parent = sc.parent; Dsymbol p = utd.parent.pastMixin(); if (!p.isScopeDsymbol()) { error(utd.loc, "`unittest` can only be a member of module/aggregate/template, not %s `%s`", p.kind(), p.toChars()); utd.type = Type.terror; utd.errors = true; return; } if (global.params.useUnitTests) { if (!utd.type) utd.type = new TypeFunction(null, Type.tvoid, false, LINK.d, utd.storage_class); Scope* sc2 = sc.push(); sc2.linkage = LINK.d; funcDeclarationSemantic(utd); sc2.pop(); } version (none) { // We're going to need ModuleInfo even if the unit tests are not // compiled in, because other modules may import this module and refer // to this ModuleInfo. // (This doesn't make sense to me?) Module m = utd.getModule(); if (!m) m = sc._module; if (m) { //printf("module3 %s needs moduleinfo\n", m.toChars()); m.needmoduleinfo = 1; } } } override void visit(NewDeclaration nd) { //printf("NewDeclaration::semantic()\n"); // `@disable new();` should not be deprecated if (!nd.isDisabled()) { // @@@DEPRECATED_2.084@@@ // Should be changed to an error in 2.084 deprecation(nd.loc, "class allocators have been deprecated, consider moving the allocation strategy outside of the class"); } if (nd.semanticRun >= PASS.semanticdone) return; if (nd._scope) { sc = nd._scope; nd._scope = null; } nd.parent = sc.parent; Dsymbol p = nd.parent.pastMixin(); if (!p.isAggregateDeclaration()) { error(nd.loc, "allocator can only be a member of aggregate, not %s `%s`", p.kind(), p.toChars()); nd.type = Type.terror; nd.errors = true; return; } Type tret = Type.tvoid.pointerTo(); if (!nd.type) nd.type = new TypeFunction(nd.parameters, tret, nd.varargs, LINK.d, nd.storage_class); nd.type = nd.type.typeSemantic(nd.loc, sc); // allow for `@disable new();` to force users of a type to use an external allocation strategy if (!nd.isDisabled()) { // Check that there is at least one argument of type size_t TypeFunction tf = nd.type.toTypeFunction(); if (Parameter.dim(tf.parameters) < 1) { nd.error("at least one argument of type `size_t` expected"); } else { Parameter fparam = Parameter.getNth(tf.parameters, 0); if (!fparam.type.equals(Type.tsize_t)) nd.error("first argument must be type `size_t`, not `%s`", fparam.type.toChars()); } } funcDeclarationSemantic(nd); } override void visit(DeleteDeclaration deld) { //printf("DeleteDeclaration::semantic()\n"); // @@@DEPRECATED_2.084@@@ // Should be changed to an error in 2.084 deprecation(deld.loc, "class deallocators have been deprecated, consider moving the deallocation strategy outside of the class"); if (deld.semanticRun >= PASS.semanticdone) return; if (deld._scope) { sc = deld._scope; deld._scope = null; } deld.parent = sc.parent; Dsymbol p = deld.parent.pastMixin(); if (!p.isAggregateDeclaration()) { error(deld.loc, "deallocator can only be a member of aggregate, not %s `%s`", p.kind(), p.toChars()); deld.type = Type.terror; deld.errors = true; return; } if (!deld.type) deld.type = new TypeFunction(deld.parameters, Type.tvoid, 0, LINK.d, deld.storage_class); deld.type = deld.type.typeSemantic(deld.loc, sc); // Check that there is only one argument of type void* TypeFunction tf = deld.type.toTypeFunction(); if (Parameter.dim(tf.parameters) != 1) { deld.error("one argument of type `void*` expected"); } else { Parameter fparam = Parameter.getNth(tf.parameters, 0); if (!fparam.type.equals(Type.tvoid.pointerTo())) deld.error("one argument of type `void*` expected, not `%s`", fparam.type.toChars()); } funcDeclarationSemantic(deld); } override void visit(StructDeclaration sd) { //printf("StructDeclaration::semantic(this=%p, '%s', sizeok = %d)\n", this, toPrettyChars(), sizeok); //static int count; if (++count == 20) assert(0); if (sd.semanticRun >= PASS.semanticdone) return; int errors = global.errors; //printf("+StructDeclaration::semantic(this=%p, '%s', sizeok = %d)\n", this, toPrettyChars(), sizeok); Scope* scx = null; if (sd._scope) { sc = sd._scope; scx = sd._scope; // save so we don't make redundant copies sd._scope = null; } if (!sd.parent) { assert(sc.parent && sc.func); sd.parent = sc.parent; } assert(sd.parent && !sd.isAnonymous()); if (sd.errors) sd.type = Type.terror; if (sd.semanticRun == PASS.init) sd.type = sd.type.addSTC(sc.stc | sd.storage_class); sd.type = sd.type.typeSemantic(sd.loc, sc); if (sd.type.ty == Tstruct && (cast(TypeStruct)sd.type).sym != sd) { auto ti = (cast(TypeStruct)sd.type).sym.isInstantiated(); if (ti && isError(ti)) (cast(TypeStruct)sd.type).sym = sd; } // Ungag errors when not speculative Ungag ungag = sd.ungagSpeculative(); if (sd.semanticRun == PASS.init) { sd.protection = sc.protection; sd.alignment = sc.alignment(); sd.storage_class |= sc.stc; if (sd.storage_class & STC.deprecated_) sd.isdeprecated = true; if (sd.storage_class & STC.abstract_) sd.error("structs, unions cannot be `abstract`"); sd.userAttribDecl = sc.userAttribDecl; } else if (sd.symtab && !scx) return; sd.semanticRun = PASS.semantic; if (!sd.members) // if opaque declaration { sd.semanticRun = PASS.semanticdone; return; } if (!sd.symtab) { sd.symtab = new DsymbolTable(); for (size_t i = 0; i < sd.members.dim; i++) { auto s = (*sd.members)[i]; //printf("adding member '%s' to '%s'\n", s.toChars(), this.toChars()); s.addMember(sc, sd); } } auto sc2 = sd.newScope(sc); /* Set scope so if there are forward references, we still might be able to * resolve individual members like enums. */ for (size_t i = 0; i < sd.members.dim; i++) { auto s = (*sd.members)[i]; //printf("struct: setScope %s %s\n", s.kind(), s.toChars()); s.setScope(sc2); } for (size_t i = 0; i < sd.members.dim; i++) { auto s = (*sd.members)[i]; s.importAll(sc2); } for (size_t i = 0; i < sd.members.dim; i++) { auto s = (*sd.members)[i]; s.dsymbolSemantic(sc2); sd.errors |= s.errors; } if (sd.errors) sd.type = Type.terror; if (!sd.determineFields()) { if (sd.type.ty != Terror) { sd.error(sd.loc, "circular or forward reference"); sd.errors = true; sd.type = Type.terror; } sc2.pop(); sd.semanticRun = PASS.semanticdone; return; } /* Following special member functions creation needs semantic analysis * completion of sub-structs in each field types. For example, buildDtor * needs to check existence of elaborate dtor in type of each fields. * See the case in compilable/test14838.d */ foreach (v; sd.fields) { Type tb = v.type.baseElemOf(); if (tb.ty != Tstruct) continue; auto sdec = (cast(TypeStruct)tb).sym; if (sdec.semanticRun >= PASS.semanticdone) continue; sc2.pop(); sd._scope = scx ? scx : sc.copy(); sd._scope.setNoFree(); sd._scope._module.addDeferredSemantic(sd); //printf("\tdeferring %s\n", toChars()); return; } /* Look for special member functions. */ sd.aggNew = cast(NewDeclaration)sd.search(Loc.initial, Id.classNew); sd.aggDelete = cast(DeleteDeclaration)sd.search(Loc.initial, Id.classDelete); // Look for the constructor sd.ctor = sd.searchCtor(); sd.dtor = buildDtor(sd, sc2); sd.postblit = buildPostBlit(sd, sc2); buildOpAssign(sd, sc2); buildOpEquals(sd, sc2); if (global.params.useTypeInfo && Type.dtypeinfo) // these functions are used for TypeInfo { sd.xeq = buildXopEquals(sd, sc2); sd.xcmp = buildXopCmp(sd, sc2); sd.xhash = buildXtoHash(sd, sc2); } sd.inv = buildInv(sd, sc2); Module.dprogress++; sd.semanticRun = PASS.semanticdone; //printf("-StructDeclaration::semantic(this=%p, '%s')\n", this, toChars()); sc2.pop(); if (sd.ctor) { Dsymbol scall = sd.search(Loc.initial, Id.call); if (scall) { uint xerrors = global.startGagging(); sc = sc.push(); sc.tinst = null; sc.minst = null; auto fcall = resolveFuncCall(sd.loc, sc, scall, null, null, null, 1); sc = sc.pop(); global.endGagging(xerrors); if (fcall && fcall.isStatic()) { sd.error(fcall.loc, "`static opCall` is hidden by constructors and can never be called"); errorSupplemental(fcall.loc, "Please use a factory method instead, or replace all constructors with `static opCall`."); } } } if (global.errors != errors) { // The type is no good. sd.type = Type.terror; sd.errors = true; if (sd.deferred) sd.deferred.errors = true; } if (sd.deferred && !global.gag) { sd.deferred.semantic2(sc); sd.deferred.semantic3(sc); } version (none) { if (sd.type.ty == Tstruct && (cast(TypeStruct)sd.type).sym != sd) { printf("this = %p %s\n", sd, sd.toChars()); printf("type = %d sym = %p\n", sd.type.ty, (cast(TypeStruct)sd.type).sym); } } assert(sd.type.ty != Tstruct || (cast(TypeStruct)sd.type).sym == sd); } final void interfaceSemantic(ClassDeclaration cd) { cd.vtblInterfaces = new BaseClasses(); cd.vtblInterfaces.reserve(cd.interfaces.length); foreach (b; cd.interfaces) { cd.vtblInterfaces.push(b); b.copyBaseInterfaces(cd.vtblInterfaces); } } override void visit(ClassDeclaration cldec) { //printf("ClassDeclaration.dsymbolSemantic(%s), type = %p, sizeok = %d, this = %p\n", toChars(), type, sizeok, this); //printf("\tparent = %p, '%s'\n", sc.parent, sc.parent ? sc.parent.toChars() : ""); //printf("sc.stc = %x\n", sc.stc); //{ static int n; if (++n == 20) *(char*)0=0; } if (cldec.semanticRun >= PASS.semanticdone) return; int errors = global.errors; //printf("+ClassDeclaration.dsymbolSemantic(%s), type = %p, sizeok = %d, this = %p\n", toChars(), type, sizeok, this); Scope* scx = null; if (cldec._scope) { sc = cldec._scope; scx = cldec._scope; // save so we don't make redundant copies cldec._scope = null; } if (!cldec.parent) { assert(sc.parent); cldec.parent = sc.parent; } if (cldec.errors) cldec.type = Type.terror; cldec.type = cldec.type.typeSemantic(cldec.loc, sc); if (cldec.type.ty == Tclass && (cast(TypeClass)cldec.type).sym != cldec) { auto ti = (cast(TypeClass)cldec.type).sym.isInstantiated(); if (ti && isError(ti)) (cast(TypeClass)cldec.type).sym = cldec; } // Ungag errors when not speculative Ungag ungag = cldec.ungagSpeculative(); if (cldec.semanticRun == PASS.init) { cldec.protection = sc.protection; cldec.storage_class |= sc.stc; if (cldec.storage_class & STC.deprecated_) cldec.isdeprecated = true; if (cldec.storage_class & STC.auto_) cldec.error("storage class `auto` is invalid when declaring a class, did you mean to use `scope`?"); if (cldec.storage_class & STC.scope_) cldec.stack = true; if (cldec.storage_class & STC.abstract_) cldec.isabstract = Abstract.yes; cldec.userAttribDecl = sc.userAttribDecl; if (sc.linkage == LINK.cpp) cldec.classKind = ClassKind.cpp; if (sc.linkage == LINK.objc) objc.setObjc(cldec); } else if (cldec.symtab && !scx) { cldec.semanticRun = PASS.semanticdone; return; } cldec.semanticRun = PASS.semantic; if (cldec.baseok < Baseok.done) { /* https://issues.dlang.org/show_bug.cgi?id=12078 * https://issues.dlang.org/show_bug.cgi?id=12143 * https://issues.dlang.org/show_bug.cgi?id=15733 * While resolving base classes and interfaces, a base may refer * the member of this derived class. In that time, if all bases of * this class can be determined, we can go forward the semantc process * beyond the Lancestorsdone. To do the recursive semantic analysis, * temporarily set and unset `_scope` around exp(). */ T resolveBase(T)(lazy T exp) { if (!scx) { scx = sc.copy(); scx.setNoFree(); } static if (!is(T == void)) { cldec._scope = scx; auto r = exp(); cldec._scope = null; return r; } else { cldec._scope = scx; exp(); cldec._scope = null; } } cldec.baseok = Baseok.start; // Expand any tuples in baseclasses[] for (size_t i = 0; i < cldec.baseclasses.dim;) { auto b = (*cldec.baseclasses)[i]; b.type = resolveBase(b.type.typeSemantic(cldec.loc, sc)); Type tb = b.type.toBasetype(); if (tb.ty == Ttuple) { TypeTuple tup = cast(TypeTuple)tb; cldec.baseclasses.remove(i); size_t dim = Parameter.dim(tup.arguments); for (size_t j = 0; j < dim; j++) { Parameter arg = Parameter.getNth(tup.arguments, j); b = new BaseClass(arg.type); cldec.baseclasses.insert(i + j, b); } } else i++; } if (cldec.baseok >= Baseok.done) { //printf("%s already semantic analyzed, semanticRun = %d\n", toChars(), semanticRun); if (cldec.semanticRun >= PASS.semanticdone) return; goto Lancestorsdone; } // See if there's a base class as first in baseclasses[] if (cldec.baseclasses.dim) { BaseClass* b = (*cldec.baseclasses)[0]; Type tb = b.type.toBasetype(); TypeClass tc = (tb.ty == Tclass) ? cast(TypeClass)tb : null; if (!tc) { if (b.type != Type.terror) cldec.error("base type must be `class` or `interface`, not `%s`", b.type.toChars()); cldec.baseclasses.remove(0); goto L7; } if (tc.sym.isDeprecated()) { if (!cldec.isDeprecated()) { // Deriving from deprecated class makes this one deprecated too cldec.isdeprecated = true; tc.checkDeprecated(cldec.loc, sc); } } if (tc.sym.isInterfaceDeclaration()) goto L7; for (ClassDeclaration cdb = tc.sym; cdb; cdb = cdb.baseClass) { if (cdb == cldec) { cldec.error("circular inheritance"); cldec.baseclasses.remove(0); goto L7; } } /* https://issues.dlang.org/show_bug.cgi?id=11034 * Class inheritance hierarchy * and instance size of each classes are orthogonal information. * Therefore, even if tc.sym.sizeof == Sizeok.none, * we need to set baseClass field for class covariance check. */ cldec.baseClass = tc.sym; b.sym = cldec.baseClass; if (tc.sym.baseok < Baseok.done) resolveBase(tc.sym.dsymbolSemantic(null)); // Try to resolve forward reference if (tc.sym.baseok < Baseok.done) { //printf("\ttry later, forward reference of base class %s\n", tc.sym.toChars()); if (tc.sym._scope) tc.sym._scope._module.addDeferredSemantic(tc.sym); cldec.baseok = Baseok.none; } L7: } // Treat the remaining entries in baseclasses as interfaces // Check for errors, handle forward references bool multiClassError = false; for (size_t i = (cldec.baseClass ? 1 : 0); i < cldec.baseclasses.dim;) { BaseClass* b = (*cldec.baseclasses)[i]; Type tb = b.type.toBasetype(); TypeClass tc = (tb.ty == Tclass) ? cast(TypeClass)tb : null; if (!tc || !tc.sym.isInterfaceDeclaration()) { // It's a class if (tc) { if (!multiClassError) { error(cldec.loc,"`%s`: multiple class inheritance is not supported." ~ " Use multiple interface inheritance and/or composition.", cldec.toPrettyChars()); multiClassError = true; } if (tc.sym.fields.dim) errorSupplemental(cldec.loc,"`%s` has fields, consider making it a member of `%s`", b.type.toChars(), cldec.type.toChars()); else errorSupplemental(cldec.loc,"`%s` has no fields, consider making it an `interface`", b.type.toChars()); } // It's something else: e.g. `int` in `class Foo : Bar, int { ... }` else if (b.type != Type.terror) { error(cldec.loc,"`%s`: base type must be `interface`, not `%s`", cldec.toPrettyChars(), b.type.toChars()); } cldec.baseclasses.remove(i); continue; } // Check for duplicate interfaces for (size_t j = (cldec.baseClass ? 1 : 0); j < i; j++) { BaseClass* b2 = (*cldec.baseclasses)[j]; if (b2.sym == tc.sym) { cldec.error("inherits from duplicate interface `%s`", b2.sym.toChars()); cldec.baseclasses.remove(i); continue; } } if (tc.sym.isDeprecated()) { if (!cldec.isDeprecated()) { // Deriving from deprecated class makes this one deprecated too cldec.isdeprecated = true; tc.checkDeprecated(cldec.loc, sc); } } b.sym = tc.sym; if (tc.sym.baseok < Baseok.done) resolveBase(tc.sym.dsymbolSemantic(null)); // Try to resolve forward reference if (tc.sym.baseok < Baseok.done) { //printf("\ttry later, forward reference of base %s\n", tc.sym.toChars()); if (tc.sym._scope) tc.sym._scope._module.addDeferredSemantic(tc.sym); cldec.baseok = Baseok.none; } i++; } if (cldec.baseok == Baseok.none) { // Forward referencee of one or more bases, try again later cldec._scope = scx ? scx : sc.copy(); cldec._scope.setNoFree(); cldec._scope._module.addDeferredSemantic(cldec); //printf("\tL%d semantic('%s') failed due to forward references\n", __LINE__, toChars()); return; } cldec.baseok = Baseok.done; // If no base class, and this is not an Object, use Object as base class if (!cldec.baseClass && cldec.ident != Id.Object && !cldec.classKind == ClassKind.cpp) { void badObjectDotD() { cldec.error("missing or corrupt object.d"); fatal(); } if (!cldec.object || cldec.object.errors) badObjectDotD(); Type t = cldec.object.type; t = t.typeSemantic(cldec.loc, sc).toBasetype(); if (t.ty == Terror) badObjectDotD(); assert(t.ty == Tclass); TypeClass tc = cast(TypeClass)t; auto b = new BaseClass(tc); cldec.baseclasses.shift(b); cldec.baseClass = tc.sym; assert(!cldec.baseClass.isInterfaceDeclaration()); b.sym = cldec.baseClass; } if (cldec.baseClass) { if (cldec.baseClass.storage_class & STC.final_) cldec.error("cannot inherit from class `%s` because it is `final`", cldec.baseClass.toChars()); // Inherit properties from base class if (cldec.baseClass.isCOMclass()) cldec.com = true; if (cldec.baseClass.isCPPclass()) cldec.classKind = ClassKind.cpp; if (cldec.baseClass.stack) cldec.stack = true; cldec.enclosing = cldec.baseClass.enclosing; cldec.storage_class |= cldec.baseClass.storage_class & STC.TYPECTOR; } cldec.interfaces = cldec.baseclasses.tdata()[(cldec.baseClass ? 1 : 0) .. cldec.baseclasses.dim]; foreach (b; cldec.interfaces) { // If this is an interface, and it derives from a COM interface, // then this is a COM interface too. if (b.sym.isCOMinterface()) cldec.com = true; if (cldec.classKind == ClassKind.cpp && !b.sym.isCPPinterface()) { error(cldec.loc, "C++ class `%s` cannot implement D interface `%s`", cldec.toPrettyChars(), b.sym.toPrettyChars()); } } interfaceSemantic(cldec); } Lancestorsdone: //printf("\tClassDeclaration.dsymbolSemantic(%s) baseok = %d\n", toChars(), baseok); if (!cldec.members) // if opaque declaration { cldec.semanticRun = PASS.semanticdone; return; } if (!cldec.symtab) { cldec.symtab = new DsymbolTable(); /* https://issues.dlang.org/show_bug.cgi?id=12152 * The semantic analysis of base classes should be finished * before the members semantic analysis of this class, in order to determine * vtbl in this class. However if a base class refers the member of this class, * it can be resolved as a normal forward reference. * Call addMember() and setScope() to make this class members visible from the base classes. */ for (size_t i = 0; i < cldec.members.dim; i++) { auto s = (*cldec.members)[i]; s.addMember(sc, cldec); } auto sc2 = cldec.newScope(sc); /* Set scope so if there are forward references, we still might be able to * resolve individual members like enums. */ for (size_t i = 0; i < cldec.members.dim; i++) { auto s = (*cldec.members)[i]; //printf("[%d] setScope %s %s, sc2 = %p\n", i, s.kind(), s.toChars(), sc2); s.setScope(sc2); } sc2.pop(); } for (size_t i = 0; i < cldec.baseclasses.dim; i++) { BaseClass* b = (*cldec.baseclasses)[i]; Type tb = b.type.toBasetype(); assert(tb.ty == Tclass); TypeClass tc = cast(TypeClass)tb; if (tc.sym.semanticRun < PASS.semanticdone) { // Forward referencee of one or more bases, try again later cldec._scope = scx ? scx : sc.copy(); cldec._scope.setNoFree(); if (tc.sym._scope) tc.sym._scope._module.addDeferredSemantic(tc.sym); cldec._scope._module.addDeferredSemantic(cldec); //printf("\tL%d semantic('%s') failed due to forward references\n", __LINE__, toChars()); return; } } if (cldec.baseok == Baseok.done) { cldec.baseok = Baseok.semanticdone; // initialize vtbl if (cldec.baseClass) { if (cldec.classKind == ClassKind.cpp && cldec.baseClass.vtbl.dim == 0) { cldec.error("C++ base class `%s` needs at least one virtual function", cldec.baseClass.toChars()); } // Copy vtbl[] from base class cldec.vtbl.setDim(cldec.baseClass.vtbl.dim); memcpy(cldec.vtbl.tdata(), cldec.baseClass.vtbl.tdata(), (void*).sizeof * cldec.vtbl.dim); cldec.vthis = cldec.baseClass.vthis; } else { // No base class, so this is the root of the class hierarchy cldec.vtbl.setDim(0); if (cldec.vtblOffset()) cldec.vtbl.push(cldec); // leave room for classinfo as first member } /* If this is a nested class, add the hidden 'this' * member which is a pointer to the enclosing scope. */ if (cldec.vthis) // if inheriting from nested class { // Use the base class's 'this' member if (cldec.storage_class & STC.static_) cldec.error("static class cannot inherit from nested class `%s`", cldec.baseClass.toChars()); if (cldec.toParent2() != cldec.baseClass.toParent2() && (!cldec.toParent2() || !cldec.baseClass.toParent2().getType() || !cldec.baseClass.toParent2().getType().isBaseOf(cldec.toParent2().getType(), null))) { if (cldec.toParent2()) { cldec.error("is nested within `%s`, but super class `%s` is nested within `%s`", cldec.toParent2().toChars(), cldec.baseClass.toChars(), cldec.baseClass.toParent2().toChars()); } else { cldec.error("is not nested, but super class `%s` is nested within `%s`", cldec.baseClass.toChars(), cldec.baseClass.toParent2().toChars()); } cldec.enclosing = null; } } else cldec.makeNested(); } auto sc2 = cldec.newScope(sc); for (size_t i = 0; i < cldec.members.dim; ++i) { auto s = (*cldec.members)[i]; s.importAll(sc2); } // Note that members.dim can grow due to tuple expansion during semantic() for (size_t i = 0; i < cldec.members.dim; ++i) { auto s = (*cldec.members)[i]; s.dsymbolSemantic(sc2); } if (!cldec.determineFields()) { assert(cldec.type == Type.terror); sc2.pop(); return; } /* Following special member functions creation needs semantic analysis * completion of sub-structs in each field types. */ foreach (v; cldec.fields) { Type tb = v.type.baseElemOf(); if (tb.ty != Tstruct) continue; auto sd = (cast(TypeStruct)tb).sym; if (sd.semanticRun >= PASS.semanticdone) continue; sc2.pop(); cldec._scope = scx ? scx : sc.copy(); cldec._scope.setNoFree(); cldec._scope._module.addDeferredSemantic(cldec); //printf("\tdeferring %s\n", toChars()); return; } /* Look for special member functions. * They must be in this class, not in a base class. */ // Can be in base class cldec.aggNew = cast(NewDeclaration)cldec.search(Loc.initial, Id.classNew); cldec.aggDelete = cast(DeleteDeclaration)cldec.search(Loc.initial, Id.classDelete); // Look for the constructor cldec.ctor = cldec.searchCtor(); if (!cldec.ctor && cldec.noDefaultCtor) { // A class object is always created by constructor, so this check is legitimate. foreach (v; cldec.fields) { if (v.storage_class & STC.nodefaultctor) error(v.loc, "field `%s` must be initialized in constructor", v.toChars()); } } // If this class has no constructor, but base class has a default // ctor, create a constructor: // this() { } if (!cldec.ctor && cldec.baseClass && cldec.baseClass.ctor) { auto fd = resolveFuncCall(cldec.loc, sc2, cldec.baseClass.ctor, null, cldec.type, null, 1); if (!fd) // try shared base ctor instead fd = resolveFuncCall(cldec.loc, sc2, cldec.baseClass.ctor, null, cldec.type.sharedOf, null, 1); if (fd && !fd.errors) { //printf("Creating default this(){} for class %s\n", toChars()); auto btf = fd.type.toTypeFunction(); auto tf = new TypeFunction(null, null, 0, LINK.d, fd.storage_class); tf.mod = btf.mod; tf.purity = btf.purity; tf.isnothrow = btf.isnothrow; tf.isnogc = btf.isnogc; tf.trust = btf.trust; auto ctor = new CtorDeclaration(cldec.loc, Loc.initial, 0, tf); ctor.fbody = new CompoundStatement(Loc.initial, new Statements()); cldec.members.push(ctor); ctor.addMember(sc, cldec); ctor.dsymbolSemantic(sc2); cldec.ctor = ctor; cldec.defaultCtor = ctor; } else { cldec.error("cannot implicitly generate a default constructor when base class `%s` is missing a default constructor", cldec.baseClass.toPrettyChars()); } } cldec.dtor = buildDtor(cldec, sc2); if (auto f = hasIdentityOpAssign(cldec, sc2)) { if (!(f.storage_class & STC.disable)) cldec.error(f.loc, "identity assignment operator overload is illegal"); } cldec.inv = buildInv(cldec, sc2); Module.dprogress++; cldec.semanticRun = PASS.semanticdone; //printf("-ClassDeclaration.dsymbolSemantic(%s), type = %p\n", toChars(), type); //members.print(); sc2.pop(); /* isAbstract() is undecidable in some cases because of circular dependencies. * Now that semantic is finished, get a definitive result, and error if it is not the same. */ if (cldec.isabstract != Abstract.fwdref) // if evaluated it before completion { const isabstractsave = cldec.isabstract; cldec.isabstract = Abstract.fwdref; cldec.isAbstract(); // recalculate if (cldec.isabstract != isabstractsave) { cldec.error("cannot infer `abstract` attribute due to circular dependencies"); } } if (cldec.type.ty == Tclass && (cast(TypeClass)cldec.type).sym != cldec) { // https://issues.dlang.org/show_bug.cgi?id=17492 ClassDeclaration cd = (cast(TypeClass)cldec.type).sym; version (none) { printf("this = %p %s\n", cldec, cldec.toPrettyChars()); printf("type = %d sym = %p, %s\n", cldec.type.ty, cd, cd.toPrettyChars()); } cldec.error("already exists at %s. Perhaps in another function with the same name?", cd.loc.toChars()); } if (global.errors != errors) { // The type is no good. cldec.type = Type.terror; cldec.errors = true; if (cldec.deferred) cldec.deferred.errors = true; } // Verify fields of a synchronized class are not public if (cldec.storage_class & STC.synchronized_) { foreach (vd; cldec.fields) { if (!vd.isThisDeclaration() && !vd.prot().isMoreRestrictiveThan(Prot(Prot.Kind.public_))) { vd.error("Field members of a `synchronized` class cannot be `%s`", protectionToChars(vd.prot().kind)); } } } if (cldec.deferred && !global.gag) { cldec.deferred.semantic2(sc); cldec.deferred.semantic3(sc); } //printf("-ClassDeclaration.dsymbolSemantic(%s), type = %p, sizeok = %d, this = %p\n", toChars(), type, sizeok, this); } override void visit(InterfaceDeclaration idec) { //printf("InterfaceDeclaration.dsymbolSemantic(%s), type = %p\n", toChars(), type); if (idec.semanticRun >= PASS.semanticdone) return; int errors = global.errors; //printf("+InterfaceDeclaration.dsymbolSemantic(%s), type = %p\n", toChars(), type); Scope* scx = null; if (idec._scope) { sc = idec._scope; scx = idec._scope; // save so we don't make redundant copies idec._scope = null; } if (!idec.parent) { assert(sc.parent && sc.func); idec.parent = sc.parent; } assert(idec.parent && !idec.isAnonymous()); if (idec.errors) idec.type = Type.terror; idec.type = idec.type.typeSemantic(idec.loc, sc); if (idec.type.ty == Tclass && (cast(TypeClass)idec.type).sym != idec) { auto ti = (cast(TypeClass)idec.type).sym.isInstantiated(); if (ti && isError(ti)) (cast(TypeClass)idec.type).sym = idec; } // Ungag errors when not speculative Ungag ungag = idec.ungagSpeculative(); if (idec.semanticRun == PASS.init) { idec.protection = sc.protection; idec.storage_class |= sc.stc; if (idec.storage_class & STC.deprecated_) idec.isdeprecated = true; idec.userAttribDecl = sc.userAttribDecl; } else if (idec.symtab) { if (idec.sizeok == Sizeok.done || !scx) { idec.semanticRun = PASS.semanticdone; return; } } idec.semanticRun = PASS.semantic; if (idec.baseok < Baseok.done) { T resolveBase(T)(lazy T exp) { if (!scx) { scx = sc.copy(); scx.setNoFree(); } static if (!is(T == void)) { idec._scope = scx; auto r = exp(); idec._scope = null; return r; } else { idec._scope = scx; exp(); idec._scope = null; } } idec.baseok = Baseok.start; // Expand any tuples in baseclasses[] for (size_t i = 0; i < idec.baseclasses.dim;) { auto b = (*idec.baseclasses)[i]; b.type = resolveBase(b.type.typeSemantic(idec.loc, sc)); Type tb = b.type.toBasetype(); if (tb.ty == Ttuple) { TypeTuple tup = cast(TypeTuple)tb; idec.baseclasses.remove(i); size_t dim = Parameter.dim(tup.arguments); for (size_t j = 0; j < dim; j++) { Parameter arg = Parameter.getNth(tup.arguments, j); b = new BaseClass(arg.type); idec.baseclasses.insert(i + j, b); } } else i++; } if (idec.baseok >= Baseok.done) { //printf("%s already semantic analyzed, semanticRun = %d\n", toChars(), semanticRun); if (idec.semanticRun >= PASS.semanticdone) return; goto Lancestorsdone; } if (!idec.baseclasses.dim && sc.linkage == LINK.cpp) idec.classKind = ClassKind.cpp; if (sc.linkage == LINK.objc) objc.setObjc(idec); // Check for errors, handle forward references for (size_t i = 0; i < idec.baseclasses.dim;) { BaseClass* b = (*idec.baseclasses)[i]; Type tb = b.type.toBasetype(); TypeClass tc = (tb.ty == Tclass) ? cast(TypeClass)tb : null; if (!tc || !tc.sym.isInterfaceDeclaration()) { if (b.type != Type.terror) idec.error("base type must be `interface`, not `%s`", b.type.toChars()); idec.baseclasses.remove(i); continue; } // Check for duplicate interfaces for (size_t j = 0; j < i; j++) { BaseClass* b2 = (*idec.baseclasses)[j]; if (b2.sym == tc.sym) { idec.error("inherits from duplicate interface `%s`", b2.sym.toChars()); idec.baseclasses.remove(i); continue; } } if (tc.sym == idec || idec.isBaseOf2(tc.sym)) { idec.error("circular inheritance of interface"); idec.baseclasses.remove(i); continue; } if (tc.sym.isDeprecated()) { if (!idec.isDeprecated()) { // Deriving from deprecated class makes this one deprecated too idec.isdeprecated = true; tc.checkDeprecated(idec.loc, sc); } } b.sym = tc.sym; if (tc.sym.baseok < Baseok.done) resolveBase(tc.sym.dsymbolSemantic(null)); // Try to resolve forward reference if (tc.sym.baseok < Baseok.done) { //printf("\ttry later, forward reference of base %s\n", tc.sym.toChars()); if (tc.sym._scope) tc.sym._scope._module.addDeferredSemantic(tc.sym); idec.baseok = Baseok.none; } i++; } if (idec.baseok == Baseok.none) { // Forward referencee of one or more bases, try again later idec._scope = scx ? scx : sc.copy(); idec._scope.setNoFree(); idec._scope._module.addDeferredSemantic(idec); return; } idec.baseok = Baseok.done; idec.interfaces = idec.baseclasses.tdata()[0 .. idec.baseclasses.dim]; foreach (b; idec.interfaces) { // If this is an interface, and it derives from a COM interface, // then this is a COM interface too. if (b.sym.isCOMinterface()) idec.com = true; if (b.sym.isCPPinterface()) idec.classKind = ClassKind.cpp; } interfaceSemantic(idec); } Lancestorsdone: if (!idec.members) // if opaque declaration { idec.semanticRun = PASS.semanticdone; return; } if (!idec.symtab) idec.symtab = new DsymbolTable(); for (size_t i = 0; i < idec.baseclasses.dim; i++) { BaseClass* b = (*idec.baseclasses)[i]; Type tb = b.type.toBasetype(); assert(tb.ty == Tclass); TypeClass tc = cast(TypeClass)tb; if (tc.sym.semanticRun < PASS.semanticdone) { // Forward referencee of one or more bases, try again later idec._scope = scx ? scx : sc.copy(); idec._scope.setNoFree(); if (tc.sym._scope) tc.sym._scope._module.addDeferredSemantic(tc.sym); idec._scope._module.addDeferredSemantic(idec); return; } } if (idec.baseok == Baseok.done) { idec.baseok = Baseok.semanticdone; objc.setMetaclass(idec); // initialize vtbl if (idec.vtblOffset()) idec.vtbl.push(idec); // leave room at vtbl[0] for classinfo // Cat together the vtbl[]'s from base interfaces foreach (i, b; idec.interfaces) { // Skip if b has already appeared for (size_t k = 0; k < i; k++) { if (b == idec.interfaces[k]) goto Lcontinue; } // Copy vtbl[] from base class if (b.sym.vtblOffset()) { size_t d = b.sym.vtbl.dim; if (d > 1) { idec.vtbl.reserve(d - 1); for (size_t j = 1; j < d; j++) idec.vtbl.push(b.sym.vtbl[j]); } } else { idec.vtbl.append(&b.sym.vtbl); } Lcontinue: } } for (size_t i = 0; i < idec.members.dim; i++) { Dsymbol s = (*idec.members)[i]; s.addMember(sc, idec); } auto sc2 = idec.newScope(sc); /* Set scope so if there are forward references, we still might be able to * resolve individual members like enums. */ for (size_t i = 0; i < idec.members.dim; i++) { Dsymbol s = (*idec.members)[i]; //printf("setScope %s %s\n", s.kind(), s.toChars()); s.setScope(sc2); } for (size_t i = 0; i < idec.members.dim; i++) { Dsymbol s = (*idec.members)[i]; s.importAll(sc2); } for (size_t i = 0; i < idec.members.dim; i++) { Dsymbol s = (*idec.members)[i]; s.dsymbolSemantic(sc2); } Module.dprogress++; idec.semanticRun = PASS.semanticdone; //printf("-InterfaceDeclaration.dsymbolSemantic(%s), type = %p\n", toChars(), type); //members.print(); sc2.pop(); if (global.errors != errors) { // The type is no good. idec.type = Type.terror; } version (none) { if (type.ty == Tclass && (cast(TypeClass)idec.type).sym != idec) { printf("this = %p %s\n", idec, idec.toChars()); printf("type = %d sym = %p\n", idec.type.ty, (cast(TypeClass)idec.type).sym); } } assert(idec.type.ty != Tclass || (cast(TypeClass)idec.type).sym == idec); } } void templateInstanceSemantic(TemplateInstance tempinst, Scope* sc, Expressions* fargs) { //printf("[%s] TemplateInstance.dsymbolSemantic('%s', this=%p, gag = %d, sc = %p)\n", loc.toChars(), toChars(), this, global.gag, sc); version (none) { for (Dsymbol s = tempinst; s; s = s.parent) { printf("\t%s\n", s.toChars()); } printf("Scope\n"); for (Scope* scx = sc; scx; scx = scx.enclosing) { printf("\t%s parent %s\n", scx._module ? scx._module.toChars() : "null", scx.parent ? scx.parent.toChars() : "null"); } } static if (LOG) { printf("\n+TemplateInstance.dsymbolSemantic('%s', this=%p)\n", tempinst.toChars(), tempinst); } if (tempinst.inst) // if semantic() was already run { static if (LOG) { printf("-TemplateInstance.dsymbolSemantic('%s', this=%p) already run\n", inst.toChars(), tempinst.inst); } return; } if (tempinst.semanticRun != PASS.init) { static if (LOG) { printf("Recursive template expansion\n"); } auto ungag = Ungag(global.gag); if (!tempinst.gagged) global.gag = 0; tempinst.error(tempinst.loc, "recursive template expansion"); if (tempinst.gagged) tempinst.semanticRun = PASS.init; else tempinst.inst = tempinst; tempinst.errors = true; return; } // Get the enclosing template instance from the scope tinst tempinst.tinst = sc.tinst; // Get the instantiating module from the scope minst tempinst.minst = sc.minst; // https://issues.dlang.org/show_bug.cgi?id=10920 // If the enclosing function is non-root symbol, // this instance should be speculative. if (!tempinst.tinst && sc.func && sc.func.inNonRoot()) { tempinst.minst = null; } tempinst.gagged = (global.gag > 0); tempinst.semanticRun = PASS.semantic; static if (LOG) { printf("\tdo semantic\n"); } /* Find template declaration first, * then run semantic on each argument (place results in tiargs[]), * last find most specialized template from overload list/set. */ if (!tempinst.findTempDecl(sc, null) || !tempinst.semanticTiargs(sc) || !tempinst.findBestMatch(sc, fargs)) { Lerror: if (tempinst.gagged) { // https://issues.dlang.org/show_bug.cgi?id=13220 // Roll back status for later semantic re-running tempinst.semanticRun = PASS.init; } else tempinst.inst = tempinst; tempinst.errors = true; return; } TemplateDeclaration tempdecl = tempinst.tempdecl.isTemplateDeclaration(); assert(tempdecl); // If tempdecl is a mixin, disallow it if (tempdecl.ismixin) { tempinst.error("mixin templates are not regular templates"); goto Lerror; } tempinst.hasNestedArgs(tempinst.tiargs, tempdecl.isstatic); if (tempinst.errors) goto Lerror; /* See if there is an existing TemplateInstantiation that already * implements the typeargs. If so, just refer to that one instead. */ tempinst.inst = tempdecl.findExistingInstance(tempinst, fargs); TemplateInstance errinst = null; if (!tempinst.inst) { // So, we need to implement 'this' instance. } else if (tempinst.inst.gagged && !tempinst.gagged && tempinst.inst.errors) { // If the first instantiation had failed, re-run semantic, // so that error messages are shown. errinst = tempinst.inst; } else { // It's a match tempinst.parent = tempinst.inst.parent; tempinst.errors = tempinst.inst.errors; // If both this and the previous instantiation were gagged, // use the number of errors that happened last time. global.errors += tempinst.errors; global.gaggedErrors += tempinst.errors; // If the first instantiation was gagged, but this is not: if (tempinst.inst.gagged) { // It had succeeded, mark it is a non-gagged instantiation, // and reuse it. tempinst.inst.gagged = tempinst.gagged; } tempinst.tnext = tempinst.inst.tnext; tempinst.inst.tnext = tempinst; /* A module can have explicit template instance and its alias * in module scope (e,g, `alias Base64 = Base64Impl!('+', '/');`). * If the first instantiation 'inst' had happened in non-root module, * compiler can assume that its instantiated code would be included * in the separately compiled obj/lib file (e.g. phobos.lib). * * However, if 'this' second instantiation happened in root module, * compiler might need to invoke its codegen * (https://issues.dlang.org/show_bug.cgi?id=2500 & https://issues.dlang.org/show_bug.cgi?id=2644). * But whole import graph is not determined until all semantic pass finished, * so 'inst' should conservatively finish the semantic3 pass for the codegen. */ if (tempinst.minst && tempinst.minst.isRoot() && !(tempinst.inst.minst && tempinst.inst.minst.isRoot())) { /* Swap the position of 'inst' and 'this' in the instantiation graph. * Then, the primary instance `inst` will be changed to a root instance. * * Before: * non-root -> A!() -> B!()[inst] -> C!() * | * root -> D!() -> B!()[this] * * After: * non-root -> A!() -> B!()[this] * | * root -> D!() -> B!()[inst] -> C!() */ Module mi = tempinst.minst; TemplateInstance ti = tempinst.tinst; tempinst.minst = tempinst.inst.minst; tempinst.tinst = tempinst.inst.tinst; tempinst.inst.minst = mi; tempinst.inst.tinst = ti; if (tempinst.minst) // if inst was not speculative { /* Add 'inst' once again to the root module members[], then the * instance members will get codegen chances. */ tempinst.inst.appendToModuleMember(); } } static if (LOG) { printf("\tit's a match with instance %p, %d\n", tempinst.inst, tempinst.inst.semanticRun); } return; } static if (LOG) { printf("\timplement template instance %s '%s'\n", tempdecl.parent.toChars(), tempinst.toChars()); printf("\ttempdecl %s\n", tempdecl.toChars()); } uint errorsave = global.errors; tempinst.inst = tempinst; tempinst.parent = tempinst.enclosing ? tempinst.enclosing : tempdecl.parent; //printf("parent = '%s'\n", parent.kind()); TemplateInstance tempdecl_instance_idx = tempdecl.addInstance(tempinst); //getIdent(); // Store the place we added it to in target_symbol_list(_idx) so we can // remove it later if we encounter an error. Dsymbols* target_symbol_list = tempinst.appendToModuleMember(); size_t target_symbol_list_idx = target_symbol_list ? target_symbol_list.dim - 1 : 0; // Copy the syntax trees from the TemplateDeclaration tempinst.members = Dsymbol.arraySyntaxCopy(tempdecl.members); // resolve TemplateThisParameter for (size_t i = 0; i < tempdecl.parameters.dim; i++) { if ((*tempdecl.parameters)[i].isTemplateThisParameter() is null) continue; Type t = isType((*tempinst.tiargs)[i]); assert(t); if (StorageClass stc = ModToStc(t.mod)) { //printf("t = %s, stc = x%llx\n", t.toChars(), stc); auto s = new Dsymbols(); s.push(new StorageClassDeclaration(stc, tempinst.members)); tempinst.members = s; } break; } // Create our own scope for the template parameters Scope* _scope = tempdecl._scope; if (tempdecl.semanticRun == PASS.init) { tempinst.error("template instantiation `%s` forward references template declaration `%s`", tempinst.toChars(), tempdecl.toChars()); return; } static if (LOG) { printf("\tcreate scope for template parameters '%s'\n", tempinst.toChars()); } tempinst.argsym = new ScopeDsymbol(); tempinst.argsym.parent = _scope.parent; _scope = _scope.push(tempinst.argsym); _scope.tinst = tempinst; _scope.minst = tempinst.minst; //scope.stc = 0; // Declare each template parameter as an alias for the argument type Scope* paramscope = _scope.push(); paramscope.stc = 0; paramscope.protection = Prot(Prot.Kind.public_); // https://issues.dlang.org/show_bug.cgi?id=14169 // template parameters should be public tempinst.declareParameters(paramscope); paramscope.pop(); // Add members of template instance to template instance symbol table //parent = scope.scopesym; tempinst.symtab = new DsymbolTable(); for (size_t i = 0; i < tempinst.members.dim; i++) { Dsymbol s = (*tempinst.members)[i]; static if (LOG) { printf("\t[%d] adding member '%s' %p kind %s to '%s'\n", i, s.toChars(), s, s.kind(), tempinst.toChars()); } s.addMember(_scope, tempinst); } static if (LOG) { printf("adding members done\n"); } /* See if there is only one member of template instance, and that * member has the same name as the template instance. * If so, this template instance becomes an alias for that member. */ //printf("members.dim = %d\n", members.dim); if (tempinst.members.dim) { Dsymbol s; if (Dsymbol.oneMembers(tempinst.members, &s, tempdecl.ident) && s) { //printf("tempdecl.ident = %s, s = '%s'\n", tempdecl.ident.toChars(), s.kind(), s.toPrettyChars()); //printf("setting aliasdecl\n"); tempinst.aliasdecl = s; } } /* If function template declaration */ if (fargs && tempinst.aliasdecl) { FuncDeclaration fd = tempinst.aliasdecl.isFuncDeclaration(); if (fd) { /* Transmit fargs to type so that TypeFunction.dsymbolSemantic() can * resolve any "auto ref" storage classes. */ TypeFunction tf = cast(TypeFunction)fd.type; if (tf && tf.ty == Tfunction) tf.fargs = fargs; } } // Do semantic() analysis on template instance members static if (LOG) { printf("\tdo semantic() on template instance members '%s'\n", tempinst.toChars()); } Scope* sc2; sc2 = _scope.push(tempinst); //printf("enclosing = %d, sc.parent = %s\n", enclosing, sc.parent.toChars()); sc2.parent = tempinst; sc2.tinst = tempinst; sc2.minst = tempinst.minst; tempinst.tryExpandMembers(sc2); tempinst.semanticRun = PASS.semanticdone; /* ConditionalDeclaration may introduce eponymous declaration, * so we should find it once again after semantic. */ if (tempinst.members.dim) { Dsymbol s; if (Dsymbol.oneMembers(tempinst.members, &s, tempdecl.ident) && s) { if (!tempinst.aliasdecl || tempinst.aliasdecl != s) { //printf("tempdecl.ident = %s, s = '%s'\n", tempdecl.ident.toChars(), s.kind(), s.toPrettyChars()); //printf("setting aliasdecl 2\n"); tempinst.aliasdecl = s; } } } if (global.errors != errorsave) goto Laftersemantic; /* If any of the instantiation members didn't get semantic() run * on them due to forward references, we cannot run semantic2() * or semantic3() yet. */ { bool found_deferred_ad = false; for (size_t i = 0; i < Module.deferred.dim; i++) { Dsymbol sd = Module.deferred[i]; AggregateDeclaration ad = sd.isAggregateDeclaration(); if (ad && ad.parent && ad.parent.isTemplateInstance()) { //printf("deferred template aggregate: %s %s\n", // sd.parent.toChars(), sd.toChars()); found_deferred_ad = true; if (ad.parent == tempinst) { ad.deferred = tempinst; break; } } } if (found_deferred_ad || Module.deferred.dim) goto Laftersemantic; } /* The problem is when to parse the initializer for a variable. * Perhaps VarDeclaration.dsymbolSemantic() should do it like it does * for initializers inside a function. */ //if (sc.parent.isFuncDeclaration()) { /* https://issues.dlang.org/show_bug.cgi?id=782 * this has problems if the classes this depends on * are forward referenced. Find a way to defer semantic() * on this template. */ tempinst.semantic2(sc2); } if (global.errors != errorsave) goto Laftersemantic; if ((sc.func || (sc.flags & SCOPE.fullinst)) && !tempinst.tinst) { /* If a template is instantiated inside function, the whole instantiation * should be done at that position. But, immediate running semantic3 of * dependent templates may cause unresolved forward reference. * https://issues.dlang.org/show_bug.cgi?id=9050 * To avoid the issue, don't run semantic3 until semantic and semantic2 done. */ TemplateInstances deferred; tempinst.deferred = &deferred; //printf("Run semantic3 on %s\n", toChars()); tempinst.trySemantic3(sc2); for (size_t i = 0; i < deferred.dim; i++) { //printf("+ run deferred semantic3 on %s\n", deferred[i].toChars()); deferred[i].semantic3(null); } tempinst.deferred = null; } else if (tempinst.tinst) { bool doSemantic3 = false; if (sc.func && tempinst.aliasdecl && tempinst.aliasdecl.toAlias().isFuncDeclaration()) { /* Template function instantiation should run semantic3 immediately * for attribute inference. */ doSemantic3 = true; } else if (sc.func) { /* A lambda function in template arguments might capture the * instantiated scope context. For the correct context inference, * all instantiated functions should run the semantic3 immediately. * See also compilable/test14973.d */ foreach (oarg; tempinst.tdtypes) { auto s = getDsymbol(oarg); if (!s) continue; if (auto td = s.isTemplateDeclaration()) { if (!td.literal) continue; assert(td.members && td.members.dim == 1); s = (*td.members)[0]; } if (auto fld = s.isFuncLiteralDeclaration()) { if (fld.tok == TOK.reserved) { doSemantic3 = true; break; } } } //printf("[%s] %s doSemantic3 = %d\n", loc.toChars(), toChars(), doSemantic3); } if (doSemantic3) tempinst.trySemantic3(sc2); TemplateInstance ti = tempinst.tinst; int nest = 0; while (ti && !ti.deferred && ti.tinst) { ti = ti.tinst; if (++nest > 500) { global.gag = 0; // ensure error message gets printed tempinst.error("recursive expansion"); fatal(); } } if (ti && ti.deferred) { //printf("deferred semantic3 of %p %s, ti = %s, ti.deferred = %p\n", this, toChars(), ti.toChars()); for (size_t i = 0;; i++) { if (i == ti.deferred.dim) { ti.deferred.push(tempinst); break; } if ((*ti.deferred)[i] == tempinst) break; } } } if (tempinst.aliasdecl) { /* https://issues.dlang.org/show_bug.cgi?id=13816 * AliasDeclaration tries to resolve forward reference * twice (See inuse check in AliasDeclaration.toAlias()). It's * necessary to resolve mutual references of instantiated symbols, but * it will left a true recursive alias in tuple declaration - an * AliasDeclaration A refers TupleDeclaration B, and B contains A * in its elements. To correctly make it an error, we strictly need to * resolve the alias of eponymous member. */ tempinst.aliasdecl = tempinst.aliasdecl.toAlias2(); } Laftersemantic: sc2.pop(); _scope.pop(); // Give additional context info if error occurred during instantiation if (global.errors != errorsave) { if (!tempinst.errors) { if (!tempdecl.literal) tempinst.error(tempinst.loc, "error instantiating"); if (tempinst.tinst) tempinst.tinst.printInstantiationTrace(); } tempinst.errors = true; if (tempinst.gagged) { // Errors are gagged, so remove the template instance from the // instance/symbol lists we added it to and reset our state to // finish clean and so we can try to instantiate it again later // (see https://issues.dlang.org/show_bug.cgi?id=4302 and https://issues.dlang.org/show_bug.cgi?id=6602). tempdecl.removeInstance(tempdecl_instance_idx); if (target_symbol_list) { // Because we added 'this' in the last position above, we // should be able to remove it without messing other indices up. assert((*target_symbol_list)[target_symbol_list_idx] == tempinst); target_symbol_list.remove(target_symbol_list_idx); tempinst.memberOf = null; // no longer a member } tempinst.semanticRun = PASS.init; tempinst.inst = null; tempinst.symtab = null; } } else if (errinst) { /* https://issues.dlang.org/show_bug.cgi?id=14541 * If the previous gagged instance had failed by * circular references, currrent "error reproduction instantiation" * might succeed, because of the difference of instantiated context. * On such case, the cached error instance needs to be overridden by the * succeeded instance. */ //printf("replaceInstance()\n"); assert(errinst.errors); auto ti1 = TemplateInstanceBox(errinst); tempdecl.instances.remove(ti1); auto ti2 = TemplateInstanceBox(tempinst); tempdecl.instances[ti2] = tempinst; } static if (LOG) { printf("-TemplateInstance.dsymbolSemantic('%s', this=%p)\n", toChars(), this); } } // function used to perform semantic on AliasDeclaration void aliasSemantic(AliasDeclaration ds, Scope* sc) { //printf("AliasDeclaration::semantic() %s\n", toChars()); if (ds.aliassym) { auto fd = ds.aliassym.isFuncLiteralDeclaration(); auto td = ds.aliassym.isTemplateDeclaration(); if (fd || td && td.literal) { if (fd && fd.semanticRun >= PASS.semanticdone) return; Expression e = new FuncExp(ds.loc, ds.aliassym); e = e.expressionSemantic(sc); if (e.op == TOK.function_) { FuncExp fe = cast(FuncExp)e; ds.aliassym = fe.td ? cast(Dsymbol)fe.td : fe.fd; } else { ds.aliassym = null; ds.type = Type.terror; } return; } if (ds.aliassym.isTemplateInstance()) ds.aliassym.dsymbolSemantic(sc); return; } ds.inuse = 1; // Given: // alias foo.bar.abc def; // it is not knowable from the syntax whether this is an alias // for a type or an alias for a symbol. It is up to the semantic() // pass to distinguish. // If it is a type, then type is set and getType() will return that // type. If it is a symbol, then aliassym is set and type is NULL - // toAlias() will return aliasssym. uint errors = global.errors; Type oldtype = ds.type; // Ungag errors when not instantiated DeclDefs scope alias auto ungag = Ungag(global.gag); //printf("%s parent = %s, gag = %d, instantiated = %d\n", toChars(), parent, global.gag, isInstantiated()); if (ds.parent && global.gag && !ds.isInstantiated() && !ds.toParent2().isFuncDeclaration()) { //printf("%s type = %s\n", toPrettyChars(), type.toChars()); global.gag = 0; } // https://issues.dlang.org/show_bug.cgi?id=18480 // Detect `alias sym = sym;` to prevent creating loops in overload overnext lists. // Selective imports are allowed to alias to the same name `import mod : sym=sym`. if (ds.type.ty == Tident && !ds._import) { auto tident = cast(TypeIdentifier)ds.type; if (tident.ident is ds.ident && !tident.idents.dim) { error(ds.loc, "`alias %s = %s;` cannot alias itself, use a qualified name to create an overload set", ds.ident.toChars(), tident.ident.toChars()); ds.type = Type.terror; } } /* This section is needed because Type.resolve() will: * const x = 3; * alias y = x; * try to convert identifier x to 3. */ auto s = ds.type.toDsymbol(sc); if (errors != global.errors) { s = null; ds.type = Type.terror; } if (s && s == ds) { ds.error("cannot resolve"); s = null; ds.type = Type.terror; } if (!s || !s.isEnumMember()) { Type t; Expression e; Scope* sc2 = sc; if (ds.storage_class & (STC.ref_ | STC.nothrow_ | STC.nogc | STC.pure_ | STC.disable)) { // For 'ref' to be attached to function types, and picked // up by Type.resolve(), it has to go into sc. sc2 = sc.push(); sc2.stc |= ds.storage_class & (STC.ref_ | STC.nothrow_ | STC.nogc | STC.pure_ | STC.shared_ | STC.disable); } ds.type = ds.type.addSTC(ds.storage_class); ds.type.resolve(ds.loc, sc2, &e, &t, &s); if (sc2 != sc) sc2.pop(); if (e) // Try to convert Expression to Dsymbol { s = getDsymbol(e); if (!s) { if (e.op != TOK.error) ds.error("cannot alias an expression `%s`", e.toChars()); t = Type.terror; } } ds.type = t; } if (s == ds) { assert(global.errors); ds.type = Type.terror; s = null; } if (!s) // it's a type alias { //printf("alias %s resolved to type %s\n", toChars(), type.toChars()); ds.type = ds.type.typeSemantic(ds.loc, sc); ds.aliassym = null; } else // it's a symbolic alias { //printf("alias %s resolved to %s %s\n", toChars(), s.kind(), s.toChars()); ds.type = null; ds.aliassym = s; } if (global.gag && errors != global.errors) { ds.type = oldtype; ds.aliassym = null; } ds.inuse = 0; ds.semanticRun = PASS.semanticdone; if (auto sx = ds.overnext) { ds.overnext = null; if (!ds.overloadInsert(sx)) ScopeDsymbol.multiplyDefined(Loc.initial, sx, ds); } }
D
module des.gui.sdlgl; public: import derelict.opengl3.gl3; import derelict.sdl2.sdl; import des.gui.sdlgl.context; import des.gui.sdlgl.window;
D
send away towards a designated goal
D
//#fileifdef MC152 /* * To change this template, choose Tools | Templates * and open the template in the editor. */ package stanhebben.minetweaker.mods.ic2.values; import stanhebben.minetweaker.api.TweakerExecuteException; import stanhebben.minetweaker.api.value.TweakerField; import stanhebben.minetweaker.api.value.TweakerValue; import stanhebben.minetweaker.mods.ic2.functions.MaceratorAddRecipeFunction; import stanhebben.minetweaker.mods.ic2.functions.MaceratorRemoveFunction; import stanhebben.minetweaker.mods.ic2.functions.MaceratorRemoveRecipeFunction; /** * * @author Stanneke */ public class MaceratorValue extends TweakerValue { public static final MaceratorValue INSTANCE = new MaceratorValue(); private MaceratorValue() {} @Override public TweakerValue index(String index) { switch (TweakerField.get(index)) { case ADDRECIPE: return MaceratorAddRecipeFunction.INSTANCE; case REMOVERECIPE: return MaceratorRemoveRecipeFunction.INSTANCE; case REMOVE: return MaceratorRemoveFunction.INSTANCE; } throw new TweakerExecuteException("No such member in macerator: " + index); } @Override public String toString() { return "ic2.macerator"; } }
D
/Users/okasho/serverProject/tryswift/get_and_post/swift/.build/debug/Core.build/Byte/Bytes.swift.o : /Users/okasho/serverProject/tryswift/get_and_post/swift/Packages/Core-1.1.1/Sources/Core/Array.swift /Users/okasho/serverProject/tryswift/get_and_post/swift/Packages/Core-1.1.1/Sources/Core/Bool+String.swift /Users/okasho/serverProject/tryswift/get_and_post/swift/Packages/Core-1.1.1/Sources/Core/Box.swift /Users/okasho/serverProject/tryswift/get_and_post/swift/Packages/Core-1.1.1/Sources/Core/Collection+Safe.swift /Users/okasho/serverProject/tryswift/get_and_post/swift/Packages/Core-1.1.1/Sources/Core/Dispatch.swift /Users/okasho/serverProject/tryswift/get_and_post/swift/Packages/Core-1.1.1/Sources/Core/DispatchTime+Utilities.swift /Users/okasho/serverProject/tryswift/get_and_post/swift/Packages/Core-1.1.1/Sources/Core/Equatable.swift /Users/okasho/serverProject/tryswift/get_and_post/swift/Packages/Core-1.1.1/Sources/Core/Extractable.swift /Users/okasho/serverProject/tryswift/get_and_post/swift/Packages/Core-1.1.1/Sources/Core/FileProtocol.swift /Users/okasho/serverProject/tryswift/get_and_post/swift/Packages/Core-1.1.1/Sources/Core/Lock.swift /Users/okasho/serverProject/tryswift/get_and_post/swift/Packages/Core-1.1.1/Sources/Core/PercentEncoding.swift /Users/okasho/serverProject/tryswift/get_and_post/swift/Packages/Core-1.1.1/Sources/Core/Portal.swift /Users/okasho/serverProject/tryswift/get_and_post/swift/Packages/Core-1.1.1/Sources/Core/Result.swift /Users/okasho/serverProject/tryswift/get_and_post/swift/Packages/Core-1.1.1/Sources/Core/RFC1123.swift /Users/okasho/serverProject/tryswift/get_and_post/swift/Packages/Core-1.1.1/Sources/Core/Semaphore.swift /Users/okasho/serverProject/tryswift/get_and_post/swift/Packages/Core-1.1.1/Sources/Core/Sequence.swift /Users/okasho/serverProject/tryswift/get_and_post/swift/Packages/Core-1.1.1/Sources/Core/StaticDataBuffer.swift /Users/okasho/serverProject/tryswift/get_and_post/swift/Packages/Core-1.1.1/Sources/Core/Strand.swift /Users/okasho/serverProject/tryswift/get_and_post/swift/Packages/Core-1.1.1/Sources/Core/String+CaseInsensitiveCompare.swift /Users/okasho/serverProject/tryswift/get_and_post/swift/Packages/Core-1.1.1/Sources/Core/String.swift /Users/okasho/serverProject/tryswift/get_and_post/swift/Packages/Core-1.1.1/Sources/Core/UnsignedInteger.swift /Users/okasho/serverProject/tryswift/get_and_post/swift/Packages/Core-1.1.1/Sources/Core/Byte/Byte+Random.swift /Users/okasho/serverProject/tryswift/get_and_post/swift/Packages/Core-1.1.1/Sources/Core/Byte/Byte.swift /Users/okasho/serverProject/tryswift/get_and_post/swift/Packages/Core-1.1.1/Sources/Core/Byte/ByteAliases.swift /Users/okasho/serverProject/tryswift/get_and_post/swift/Packages/Core-1.1.1/Sources/Core/Byte/Bytes+Base64.swift /Users/okasho/serverProject/tryswift/get_and_post/swift/Packages/Core-1.1.1/Sources/Core/Byte/Bytes.swift /Users/okasho/serverProject/tryswift/get_and_post/swift/Packages/Core-1.1.1/Sources/Core/Byte/BytesConvertible.swift /Users/okasho/serverProject/tryswift/get_and_post/swift/Packages/Core-1.1.1/Sources/Core/Byte/BytesSlice+PatternMatching.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/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/ObjectiveC.swiftmodule /Users/okasho/serverProject/tryswift/get_and_post/swift/.build/debug/libc.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/CoreGraphics.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/IOKit.swiftmodule /Users/okasho/serverProject/tryswift/get_and_post/swift/.build/debug/Core.build/Bytes~partial.swiftmodule : /Users/okasho/serverProject/tryswift/get_and_post/swift/Packages/Core-1.1.1/Sources/Core/Array.swift /Users/okasho/serverProject/tryswift/get_and_post/swift/Packages/Core-1.1.1/Sources/Core/Bool+String.swift /Users/okasho/serverProject/tryswift/get_and_post/swift/Packages/Core-1.1.1/Sources/Core/Box.swift /Users/okasho/serverProject/tryswift/get_and_post/swift/Packages/Core-1.1.1/Sources/Core/Collection+Safe.swift /Users/okasho/serverProject/tryswift/get_and_post/swift/Packages/Core-1.1.1/Sources/Core/Dispatch.swift /Users/okasho/serverProject/tryswift/get_and_post/swift/Packages/Core-1.1.1/Sources/Core/DispatchTime+Utilities.swift /Users/okasho/serverProject/tryswift/get_and_post/swift/Packages/Core-1.1.1/Sources/Core/Equatable.swift /Users/okasho/serverProject/tryswift/get_and_post/swift/Packages/Core-1.1.1/Sources/Core/Extractable.swift /Users/okasho/serverProject/tryswift/get_and_post/swift/Packages/Core-1.1.1/Sources/Core/FileProtocol.swift /Users/okasho/serverProject/tryswift/get_and_post/swift/Packages/Core-1.1.1/Sources/Core/Lock.swift /Users/okasho/serverProject/tryswift/get_and_post/swift/Packages/Core-1.1.1/Sources/Core/PercentEncoding.swift /Users/okasho/serverProject/tryswift/get_and_post/swift/Packages/Core-1.1.1/Sources/Core/Portal.swift /Users/okasho/serverProject/tryswift/get_and_post/swift/Packages/Core-1.1.1/Sources/Core/Result.swift /Users/okasho/serverProject/tryswift/get_and_post/swift/Packages/Core-1.1.1/Sources/Core/RFC1123.swift /Users/okasho/serverProject/tryswift/get_and_post/swift/Packages/Core-1.1.1/Sources/Core/Semaphore.swift /Users/okasho/serverProject/tryswift/get_and_post/swift/Packages/Core-1.1.1/Sources/Core/Sequence.swift /Users/okasho/serverProject/tryswift/get_and_post/swift/Packages/Core-1.1.1/Sources/Core/StaticDataBuffer.swift /Users/okasho/serverProject/tryswift/get_and_post/swift/Packages/Core-1.1.1/Sources/Core/Strand.swift /Users/okasho/serverProject/tryswift/get_and_post/swift/Packages/Core-1.1.1/Sources/Core/String+CaseInsensitiveCompare.swift /Users/okasho/serverProject/tryswift/get_and_post/swift/Packages/Core-1.1.1/Sources/Core/String.swift /Users/okasho/serverProject/tryswift/get_and_post/swift/Packages/Core-1.1.1/Sources/Core/UnsignedInteger.swift /Users/okasho/serverProject/tryswift/get_and_post/swift/Packages/Core-1.1.1/Sources/Core/Byte/Byte+Random.swift /Users/okasho/serverProject/tryswift/get_and_post/swift/Packages/Core-1.1.1/Sources/Core/Byte/Byte.swift /Users/okasho/serverProject/tryswift/get_and_post/swift/Packages/Core-1.1.1/Sources/Core/Byte/ByteAliases.swift /Users/okasho/serverProject/tryswift/get_and_post/swift/Packages/Core-1.1.1/Sources/Core/Byte/Bytes+Base64.swift /Users/okasho/serverProject/tryswift/get_and_post/swift/Packages/Core-1.1.1/Sources/Core/Byte/Bytes.swift /Users/okasho/serverProject/tryswift/get_and_post/swift/Packages/Core-1.1.1/Sources/Core/Byte/BytesConvertible.swift /Users/okasho/serverProject/tryswift/get_and_post/swift/Packages/Core-1.1.1/Sources/Core/Byte/BytesSlice+PatternMatching.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/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/ObjectiveC.swiftmodule /Users/okasho/serverProject/tryswift/get_and_post/swift/.build/debug/libc.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/CoreGraphics.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/IOKit.swiftmodule /Users/okasho/serverProject/tryswift/get_and_post/swift/.build/debug/Core.build/Bytes~partial.swiftdoc : /Users/okasho/serverProject/tryswift/get_and_post/swift/Packages/Core-1.1.1/Sources/Core/Array.swift /Users/okasho/serverProject/tryswift/get_and_post/swift/Packages/Core-1.1.1/Sources/Core/Bool+String.swift /Users/okasho/serverProject/tryswift/get_and_post/swift/Packages/Core-1.1.1/Sources/Core/Box.swift /Users/okasho/serverProject/tryswift/get_and_post/swift/Packages/Core-1.1.1/Sources/Core/Collection+Safe.swift /Users/okasho/serverProject/tryswift/get_and_post/swift/Packages/Core-1.1.1/Sources/Core/Dispatch.swift /Users/okasho/serverProject/tryswift/get_and_post/swift/Packages/Core-1.1.1/Sources/Core/DispatchTime+Utilities.swift /Users/okasho/serverProject/tryswift/get_and_post/swift/Packages/Core-1.1.1/Sources/Core/Equatable.swift /Users/okasho/serverProject/tryswift/get_and_post/swift/Packages/Core-1.1.1/Sources/Core/Extractable.swift /Users/okasho/serverProject/tryswift/get_and_post/swift/Packages/Core-1.1.1/Sources/Core/FileProtocol.swift /Users/okasho/serverProject/tryswift/get_and_post/swift/Packages/Core-1.1.1/Sources/Core/Lock.swift /Users/okasho/serverProject/tryswift/get_and_post/swift/Packages/Core-1.1.1/Sources/Core/PercentEncoding.swift /Users/okasho/serverProject/tryswift/get_and_post/swift/Packages/Core-1.1.1/Sources/Core/Portal.swift /Users/okasho/serverProject/tryswift/get_and_post/swift/Packages/Core-1.1.1/Sources/Core/Result.swift /Users/okasho/serverProject/tryswift/get_and_post/swift/Packages/Core-1.1.1/Sources/Core/RFC1123.swift /Users/okasho/serverProject/tryswift/get_and_post/swift/Packages/Core-1.1.1/Sources/Core/Semaphore.swift /Users/okasho/serverProject/tryswift/get_and_post/swift/Packages/Core-1.1.1/Sources/Core/Sequence.swift /Users/okasho/serverProject/tryswift/get_and_post/swift/Packages/Core-1.1.1/Sources/Core/StaticDataBuffer.swift /Users/okasho/serverProject/tryswift/get_and_post/swift/Packages/Core-1.1.1/Sources/Core/Strand.swift /Users/okasho/serverProject/tryswift/get_and_post/swift/Packages/Core-1.1.1/Sources/Core/String+CaseInsensitiveCompare.swift /Users/okasho/serverProject/tryswift/get_and_post/swift/Packages/Core-1.1.1/Sources/Core/String.swift /Users/okasho/serverProject/tryswift/get_and_post/swift/Packages/Core-1.1.1/Sources/Core/UnsignedInteger.swift /Users/okasho/serverProject/tryswift/get_and_post/swift/Packages/Core-1.1.1/Sources/Core/Byte/Byte+Random.swift /Users/okasho/serverProject/tryswift/get_and_post/swift/Packages/Core-1.1.1/Sources/Core/Byte/Byte.swift /Users/okasho/serverProject/tryswift/get_and_post/swift/Packages/Core-1.1.1/Sources/Core/Byte/ByteAliases.swift /Users/okasho/serverProject/tryswift/get_and_post/swift/Packages/Core-1.1.1/Sources/Core/Byte/Bytes+Base64.swift /Users/okasho/serverProject/tryswift/get_and_post/swift/Packages/Core-1.1.1/Sources/Core/Byte/Bytes.swift /Users/okasho/serverProject/tryswift/get_and_post/swift/Packages/Core-1.1.1/Sources/Core/Byte/BytesConvertible.swift /Users/okasho/serverProject/tryswift/get_and_post/swift/Packages/Core-1.1.1/Sources/Core/Byte/BytesSlice+PatternMatching.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/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/ObjectiveC.swiftmodule /Users/okasho/serverProject/tryswift/get_and_post/swift/.build/debug/libc.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/CoreGraphics.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/IOKit.swiftmodule
D
module java.text.ParseException; import java.lang.all; class ParseException : Exception { this(String e = null) { super(e); } }
D
/Users/eduardo.herrera/Desktop/Edu/Projects/iOS/PayMe/PayMe/DerivedData/PayMe/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/Gloss.build/Objects-normal/x86_64/Encoder.o : /Users/eduardo.herrera/Desktop/Edu/Projects/iOS/PayMe/PayMe/Pods/Gloss/Sources/ExtensionDecodable.swift /Users/eduardo.herrera/Desktop/Edu/Projects/iOS/PayMe/PayMe/Pods/Gloss/Sources/Decoder.swift /Users/eduardo.herrera/Desktop/Edu/Projects/iOS/PayMe/PayMe/Pods/Gloss/Sources/Encoder.swift /Users/eduardo.herrera/Desktop/Edu/Projects/iOS/PayMe/PayMe/Pods/Gloss/Sources/Operators.swift /Users/eduardo.herrera/Desktop/Edu/Projects/iOS/PayMe/PayMe/Pods/Gloss/Sources/Gloss.swift /Users/eduardo.herrera/Desktop/Edu/Projects/iOS/PayMe/PayMe/Pods/Gloss/Sources/ExtensionArray.swift /Users/eduardo.herrera/Desktop/Edu/Projects/iOS/PayMe/PayMe/Pods/Gloss/Sources/ExtensionDictionary.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/eduardo.herrera/Desktop/Edu/Projects/iOS/PayMe/PayMe/Pods/Target\ Support\ Files/Gloss/Gloss-umbrella.h /Users/eduardo.herrera/Desktop/Edu/Projects/iOS/PayMe/PayMe/DerivedData/PayMe/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/Gloss.build/unextended-module.modulemap /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.3.sdk/usr/include/objc/ObjectiveC.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.3.sdk/System/Library/Frameworks/OpenGLES.framework/Headers/OpenGLES.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.3.sdk/System/Library/Frameworks/CoreImage.framework/Headers/CoreImage.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.3.sdk/System/Library/Frameworks/QuartzCore.framework/Headers/QuartzCore.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.3.sdk/System/Library/Frameworks/Metal.framework/Headers/Metal.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.3.sdk/usr/include/Darwin.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.3.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.3.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.3.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIKit.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.3.sdk/System/Library/Frameworks/CoreText.framework/Headers/CoreText.apinotes /Users/eduardo.herrera/Desktop/Edu/Projects/iOS/PayMe/PayMe/DerivedData/PayMe/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/Gloss.build/Objects-normal/x86_64/Encoder~partial.swiftmodule : /Users/eduardo.herrera/Desktop/Edu/Projects/iOS/PayMe/PayMe/Pods/Gloss/Sources/ExtensionDecodable.swift /Users/eduardo.herrera/Desktop/Edu/Projects/iOS/PayMe/PayMe/Pods/Gloss/Sources/Decoder.swift /Users/eduardo.herrera/Desktop/Edu/Projects/iOS/PayMe/PayMe/Pods/Gloss/Sources/Encoder.swift /Users/eduardo.herrera/Desktop/Edu/Projects/iOS/PayMe/PayMe/Pods/Gloss/Sources/Operators.swift /Users/eduardo.herrera/Desktop/Edu/Projects/iOS/PayMe/PayMe/Pods/Gloss/Sources/Gloss.swift /Users/eduardo.herrera/Desktop/Edu/Projects/iOS/PayMe/PayMe/Pods/Gloss/Sources/ExtensionArray.swift /Users/eduardo.herrera/Desktop/Edu/Projects/iOS/PayMe/PayMe/Pods/Gloss/Sources/ExtensionDictionary.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/eduardo.herrera/Desktop/Edu/Projects/iOS/PayMe/PayMe/Pods/Target\ Support\ Files/Gloss/Gloss-umbrella.h /Users/eduardo.herrera/Desktop/Edu/Projects/iOS/PayMe/PayMe/DerivedData/PayMe/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/Gloss.build/unextended-module.modulemap /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.3.sdk/usr/include/objc/ObjectiveC.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.3.sdk/System/Library/Frameworks/OpenGLES.framework/Headers/OpenGLES.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.3.sdk/System/Library/Frameworks/CoreImage.framework/Headers/CoreImage.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.3.sdk/System/Library/Frameworks/QuartzCore.framework/Headers/QuartzCore.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.3.sdk/System/Library/Frameworks/Metal.framework/Headers/Metal.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.3.sdk/usr/include/Darwin.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.3.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.3.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.3.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIKit.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.3.sdk/System/Library/Frameworks/CoreText.framework/Headers/CoreText.apinotes /Users/eduardo.herrera/Desktop/Edu/Projects/iOS/PayMe/PayMe/DerivedData/PayMe/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/Gloss.build/Objects-normal/x86_64/Encoder~partial.swiftdoc : /Users/eduardo.herrera/Desktop/Edu/Projects/iOS/PayMe/PayMe/Pods/Gloss/Sources/ExtensionDecodable.swift /Users/eduardo.herrera/Desktop/Edu/Projects/iOS/PayMe/PayMe/Pods/Gloss/Sources/Decoder.swift /Users/eduardo.herrera/Desktop/Edu/Projects/iOS/PayMe/PayMe/Pods/Gloss/Sources/Encoder.swift /Users/eduardo.herrera/Desktop/Edu/Projects/iOS/PayMe/PayMe/Pods/Gloss/Sources/Operators.swift /Users/eduardo.herrera/Desktop/Edu/Projects/iOS/PayMe/PayMe/Pods/Gloss/Sources/Gloss.swift /Users/eduardo.herrera/Desktop/Edu/Projects/iOS/PayMe/PayMe/Pods/Gloss/Sources/ExtensionArray.swift /Users/eduardo.herrera/Desktop/Edu/Projects/iOS/PayMe/PayMe/Pods/Gloss/Sources/ExtensionDictionary.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/eduardo.herrera/Desktop/Edu/Projects/iOS/PayMe/PayMe/Pods/Target\ Support\ Files/Gloss/Gloss-umbrella.h /Users/eduardo.herrera/Desktop/Edu/Projects/iOS/PayMe/PayMe/DerivedData/PayMe/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/Gloss.build/unextended-module.modulemap /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.3.sdk/usr/include/objc/ObjectiveC.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.3.sdk/System/Library/Frameworks/OpenGLES.framework/Headers/OpenGLES.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.3.sdk/System/Library/Frameworks/CoreImage.framework/Headers/CoreImage.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.3.sdk/System/Library/Frameworks/QuartzCore.framework/Headers/QuartzCore.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.3.sdk/System/Library/Frameworks/Metal.framework/Headers/Metal.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.3.sdk/usr/include/Darwin.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.3.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.3.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.3.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIKit.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.3.sdk/System/Library/Frameworks/CoreText.framework/Headers/CoreText.apinotes
D
// D import file generated from 'crypto_generichash.d' renamed to 'crypto_generichash.d' (method [only for original == header file] results in very compact code and obviates to overhaul comments now) module sodium.crypto_generichash; import sodium.crypto_generichash_blake2b; extern (C) { enum crypto_generichash_BYTES_MIN = crypto_generichash_blake2b_BYTES_MIN; size_t crypto_generichash_bytes_min(); enum crypto_generichash_BYTES_MAX = crypto_generichash_blake2b_BYTES_MAX; size_t crypto_generichash_bytes_max(); enum crypto_generichash_BYTES = crypto_generichash_blake2b_BYTES; size_t crypto_generichash_bytes(); enum crypto_generichash_KEYBYTES_MIN = crypto_generichash_blake2b_KEYBYTES_MIN; size_t crypto_generichash_keybytes_min(); enum crypto_generichash_KEYBYTES_MAX = crypto_generichash_blake2b_KEYBYTES_MAX; size_t crypto_generichash_keybytes_max(); enum crypto_generichash_KEYBYTES = crypto_generichash_blake2b_KEYBYTES; size_t crypto_generichash_keybytes(); immutable(char*) crypto_generichash_PRIMITIVE = "blake2b"; const(char)* crypto_generichash_primitive(); alias crypto_generichash_state = crypto_generichash_blake2b_state; size_t crypto_generichash_statebytes(); int crypto_generichash(ubyte* out_, size_t outlen, const(ubyte)* in_, ulong inlen, const(ubyte)* key, size_t keylen); int crypto_generichash_init(crypto_generichash_state* state, const(ubyte)* key, const size_t keylen, const size_t outlen); int crypto_generichash_update(crypto_generichash_state* state, const(ubyte)* in_, ulong inlen); int crypto_generichash_final(crypto_generichash_state* state, ubyte* out_, const size_t outlen); }
D
the state of aggregation of soil and its condition for supporting plant growth arable land that is worked by plowing and sowing and raising crops
D
module android.java.android.graphics.drawable.RippleDrawable_d_interface; import arsd.jni : IJavaObjectImplementation, JavaPackageId, JavaName, IJavaObject, ImportExportImpl, JavaInterfaceMembers; static import arsd.jni; import import6 = android.java.android.graphics.Rect_d_interface; import import5 = android.java.android.content.res.Resources_Theme_d_interface; import import8 = android.java.android.graphics.Canvas_d_interface; import import12 = android.java.android.graphics.BlendMode_d_interface; import import18 = android.java.android.util.TypedValue_d_interface; import import3 = android.java.org.xmlpull.v1.XmlPullParser_d_interface; import import2 = android.java.android.content.res.Resources_d_interface; import import11 = android.java.android.graphics.ColorFilter_d_interface; import import9 = android.java.android.graphics.drawable.Drawable_ConstantState_d_interface; import import14 = android.java.android.graphics.PorterDuff_Mode_d_interface; import import0 = android.java.android.content.res.ColorStateList_d_interface; import import4 = android.java.android.util.AttributeSet_d_interface; import import1 = android.java.android.graphics.drawable.Drawable_d_interface; import import16 = android.java.android.graphics.Insets_d_interface; import import19 = android.java.android.graphics.BitmapFactory_Options_d_interface; import import7 = android.java.android.graphics.Outline_d_interface; import import20 = android.java.java.lang.Class_d_interface; import import17 = android.java.java.io.InputStream_d_interface; import import10 = android.java.java.lang.Runnable_d_interface; import import13 = android.java.android.graphics.drawable.Drawable_Callback_d_interface; import import15 = android.java.android.graphics.Region_d_interface; final class RippleDrawable : IJavaObject { static immutable string[] _d_canCastTo = [ ]; @Import this(import0.ColorStateList, import1.Drawable, import1.Drawable); @Import void jumpToCurrentState(); @Import int getOpacity(); @Import bool setVisible(bool, bool); @Import bool isProjected(); @Import bool isStateful(); @Import void setColor(import0.ColorStateList); @Import void setRadius(int); @Import int getRadius(); @Import void inflate(import2.Resources, import3.XmlPullParser, import4.AttributeSet, import5.Resources_Theme); @Import bool setDrawableByLayerId(int, import1.Drawable); @Import void setPaddingMode(int); @Import void applyTheme(import5.Resources_Theme); @Import bool canApplyTheme(); @Import void setHotspot(float, float); @Import void setHotspotBounds(int, int, int, int); @Import void getHotspotBounds(import6.Rect); @Import void getOutline(import7.Outline); @Import void draw(import8.Canvas); @Import void invalidateSelf(); @Import import6.Rect getDirtyBounds(); @Import import9.Drawable_ConstantState getConstantState(); @Import import1.Drawable mutate(); @Import int addLayer(import1.Drawable); @Import import1.Drawable findDrawableByLayerId(int); @Import void setId(int, int); @Import int getId(int); @Import int getNumberOfLayers(); @Import int findIndexByLayerId(int); @Import void setDrawable(int, import1.Drawable); @Import import1.Drawable getDrawable(int); @Import void setLayerSize(int, int, int); @Import void setLayerWidth(int, int); @Import int getLayerWidth(int); @Import void setLayerHeight(int, int); @Import int getLayerHeight(int); @Import void setLayerGravity(int, int); @Import int getLayerGravity(int); @Import void setLayerInset(int, int, int, int, int); @Import void setLayerInsetRelative(int, int, int, int, int); @Import void setLayerInsetLeft(int, int); @Import int getLayerInsetLeft(int); @Import void setLayerInsetRight(int, int); @Import int getLayerInsetRight(int); @Import void setLayerInsetTop(int, int); @Import int getLayerInsetTop(int); @Import void setLayerInsetBottom(int, int); @Import int getLayerInsetBottom(int); @Import void setLayerInsetStart(int, int); @Import int getLayerInsetStart(int); @Import void setLayerInsetEnd(int, int); @Import int getLayerInsetEnd(int); @Import int getPaddingMode(); @Import void invalidateDrawable(import1.Drawable); @Import void scheduleDrawable(import1.Drawable, import10.Runnable, long); @Import void unscheduleDrawable(import1.Drawable, import10.Runnable); @Import int getChangingConfigurations(); @Import bool getPadding(import6.Rect); @Import void setPadding(int, int, int, int); @Import void setPaddingRelative(int, int, int, int); @Import int getLeftPadding(); @Import int getRightPadding(); @Import int getStartPadding(); @Import int getEndPadding(); @Import int getTopPadding(); @Import int getBottomPadding(); @Import void setDither(bool); @Import void setAlpha(int); @Import int getAlpha(); @Import void setColorFilter(import11.ColorFilter); @Import void setTintList(import0.ColorStateList); @Import void setTintBlendMode(import12.BlendMode); @Import void setOpacity(int); @Import void setAutoMirrored(bool); @Import bool isAutoMirrored(); @Import int getIntrinsicWidth(); @Import int getIntrinsicHeight(); @Import bool onLayoutDirectionChanged(int); @Import void setBounds(int, int, int, int); @Import void setBounds(import6.Rect); @Import void copyBounds(import6.Rect); @Import import6.Rect copyBounds(); @Import import6.Rect getBounds(); @Import void setChangingConfigurations(int); @Import void setFilterBitmap(bool); @Import bool isFilterBitmap(); @Import void setCallback(import13.Drawable_Callback); @Import import13.Drawable_Callback getCallback(); @Import void scheduleSelf(import10.Runnable, long); @Import void unscheduleSelf(import10.Runnable); @Import int getLayoutDirection(); @Import bool setLayoutDirection(int); @Import void setColorFilter(int, import14.PorterDuff_Mode); @Import void setTint(int); @Import void setTintMode(import14.PorterDuff_Mode); @Import import11.ColorFilter getColorFilter(); @Import void clearColorFilter(); @Import bool setState(int[]); @Import int[] getState(); @Import import1.Drawable getCurrent(); @Import bool setLevel(int); @Import int getLevel(); @Import bool isVisible(); @Import static int resolveOpacity(int, int); @Import import15.Region getTransparentRegion(); @Import int getMinimumWidth(); @Import int getMinimumHeight(); @Import import16.Insets getOpticalInsets(); @Import static import1.Drawable createFromStream(import17.InputStream, string); @Import static import1.Drawable createFromResourceStream(import2.Resources, import18.TypedValue, import17.InputStream, string); @Import static import1.Drawable createFromResourceStream(import2.Resources, import18.TypedValue, import17.InputStream, string, import19.BitmapFactory_Options); @Import static import1.Drawable createFromXml(import2.Resources, import3.XmlPullParser); @Import static import1.Drawable createFromXml(import2.Resources, import3.XmlPullParser, import5.Resources_Theme); @Import static import1.Drawable createFromXmlInner(import2.Resources, import3.XmlPullParser, import4.AttributeSet); @Import static import1.Drawable createFromXmlInner(import2.Resources, import3.XmlPullParser, import4.AttributeSet, import5.Resources_Theme); @Import static import1.Drawable createFromPath(string); @Import void inflate(import2.Resources, import3.XmlPullParser, import4.AttributeSet); @Import import20.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/graphics/drawable/RippleDrawable;"; }
D
measuring instrument in which the echo of a pulse of microwave radiation is used to detect and locate distant objects
D
# FIXED ICall/icall_cc2650.obj: /home/raffaele-bithiatec/opt/ti/simplelink_cc2640r2_sdk_4_10_00_10/source/ti/blestack/icall/src/icall_cc2650.c ICall/icall_cc2650.obj: /home/raffaele-bithiatec/opt/ti/simplelink_cc2640r2_sdk_4_10_00_10/source/ti/blestack/icall/src/icall_platform.h ICall/icall_cc2650.obj: /home/raffaele-bithiatec/opt/ti/ccs910/ccs/tools/compiler/ti-cgt-arm_18.12.2.LTS/include/stdint.h ICall/icall_cc2650.obj: /home/raffaele-bithiatec/opt/ti/ccs910/ccs/tools/compiler/ti-cgt-arm_18.12.2.LTS/include/_stdint40.h ICall/icall_cc2650.obj: /home/raffaele-bithiatec/opt/ti/ccs910/ccs/tools/compiler/ti-cgt-arm_18.12.2.LTS/include/sys/stdint.h ICall/icall_cc2650.obj: /home/raffaele-bithiatec/opt/ti/ccs910/ccs/tools/compiler/ti-cgt-arm_18.12.2.LTS/include/sys/cdefs.h ICall/icall_cc2650.obj: /home/raffaele-bithiatec/opt/ti/ccs910/ccs/tools/compiler/ti-cgt-arm_18.12.2.LTS/include/sys/_types.h ICall/icall_cc2650.obj: /home/raffaele-bithiatec/opt/ti/ccs910/ccs/tools/compiler/ti-cgt-arm_18.12.2.LTS/include/machine/_types.h ICall/icall_cc2650.obj: /home/raffaele-bithiatec/opt/ti/ccs910/ccs/tools/compiler/ti-cgt-arm_18.12.2.LTS/include/machine/_stdint.h ICall/icall_cc2650.obj: /home/raffaele-bithiatec/opt/ti/ccs910/ccs/tools/compiler/ti-cgt-arm_18.12.2.LTS/include/sys/_stdint.h ICall/icall_cc2650.obj: /home/raffaele-bithiatec/opt/ti/simplelink_cc2640r2_sdk_4_10_00_10/source/ti/blestack/icall/src/inc/icall.h ICall/icall_cc2650.obj: /home/raffaele-bithiatec/opt/ti/ccs910/ccs/tools/compiler/ti-cgt-arm_18.12.2.LTS/include/stdbool.h ICall/icall_cc2650.obj: /home/raffaele-bithiatec/opt/ti/ccs910/ccs/tools/compiler/ti-cgt-arm_18.12.2.LTS/include/stdlib.h ICall/icall_cc2650.obj: /home/raffaele-bithiatec/opt/ti/ccs910/ccs/tools/compiler/ti-cgt-arm_18.12.2.LTS/include/_ti_config.h ICall/icall_cc2650.obj: /home/raffaele-bithiatec/opt/ti/ccs910/ccs/tools/compiler/ti-cgt-arm_18.12.2.LTS/include/linkage.h ICall/icall_cc2650.obj: /home/raffaele-bithiatec/opt/ti/simplelink_cc2640r2_sdk_4_10_00_10/source/ti/blestack/hal/src/inc/hal_assert.h ICall/icall_cc2650.obj: /home/raffaele-bithiatec/opt/ti/simplelink_cc2640r2_sdk_4_10_00_10/source/ti/blestack/hal/src/target/_common/hal_types.h ICall/icall_cc2650.obj: /home/raffaele-bithiatec/opt/ti/simplelink_cc2640r2_sdk_4_10_00_10/source/ti/blestack/hal/src/target/_common/../_common/cc26xx/_hal_types.h ICall/icall_cc2650.obj: /home/raffaele-bithiatec/opt/ti/simplelink_cc2640r2_sdk_4_10_00_10/source/ti/blestack/hal/src/inc/hal_defs.h ICall/icall_cc2650.obj: /home/raffaele-bithiatec/opt/ti/ccs910/ccs/tools/compiler/ti-cgt-arm_18.12.2.LTS/include/stdlib.h ICall/icall_cc2650.obj: /home/raffaele-bithiatec/opt/ti/simplelink_cc2640r2_sdk_4_10_00_10/source/ti/blestack/icall/src/inc/icall_cc26xx_defs.h ICall/icall_cc2650.obj: /home/raffaele-bithiatec/opt/ti/simplelink_cc2640r2_sdk_4_10_00_10/kernel/tirtos/packages/ti/sysbios/BIOS.h ICall/icall_cc2650.obj: /home/raffaele-bithiatec/opt/ti/ccs910/xdctools_3_51_03_28_core/packages/xdc/std.h ICall/icall_cc2650.obj: /home/raffaele-bithiatec/opt/ti/ccs910/ccs/tools/compiler/ti-cgt-arm_18.12.2.LTS/include/stdarg.h ICall/icall_cc2650.obj: /home/raffaele-bithiatec/opt/ti/ccs910/ccs/tools/compiler/ti-cgt-arm_18.12.2.LTS/include/stddef.h ICall/icall_cc2650.obj: /home/raffaele-bithiatec/opt/ti/simplelink_cc2640r2_sdk_4_10_00_10/kernel/tirtos/packages/ti/targets/arm/elf/std.h ICall/icall_cc2650.obj: /home/raffaele-bithiatec/opt/ti/simplelink_cc2640r2_sdk_4_10_00_10/kernel/tirtos/packages/ti/targets/arm/elf/M3.h ICall/icall_cc2650.obj: /home/raffaele-bithiatec/opt/ti/simplelink_cc2640r2_sdk_4_10_00_10/kernel/tirtos/packages/ti/targets/std.h ICall/icall_cc2650.obj: /home/raffaele-bithiatec/opt/ti/ccs910/xdctools_3_51_03_28_core/packages/xdc/runtime/xdc.h ICall/icall_cc2650.obj: /home/raffaele-bithiatec/opt/ti/ccs910/xdctools_3_51_03_28_core/packages/xdc/runtime/Types.h ICall/icall_cc2650.obj: /home/raffaele-bithiatec/opt/ti/ccs910/xdctools_3_51_03_28_core/packages/xdc/runtime/Types__prologue.h ICall/icall_cc2650.obj: /home/raffaele-bithiatec/opt/ti/ccs910/xdctools_3_51_03_28_core/packages/xdc/runtime/package/package.defs.h ICall/icall_cc2650.obj: /home/raffaele-bithiatec/opt/ti/ccs910/xdctools_3_51_03_28_core/packages/xdc/runtime/Types__epilogue.h ICall/icall_cc2650.obj: /home/raffaele-bithiatec/opt/ti/simplelink_cc2640r2_sdk_4_10_00_10/kernel/tirtos/packages/ti/sysbios/BIOS__prologue.h ICall/icall_cc2650.obj: /home/raffaele-bithiatec/opt/ti/simplelink_cc2640r2_sdk_4_10_00_10/kernel/tirtos/packages/ti/sysbios/package/package.defs.h ICall/icall_cc2650.obj: /home/raffaele-bithiatec/opt/ti/ccs910/xdctools_3_51_03_28_core/packages/xdc/runtime/Error.h ICall/icall_cc2650.obj: /home/raffaele-bithiatec/opt/ti/ccs910/xdctools_3_51_03_28_core/packages/xdc/runtime/Types.h ICall/icall_cc2650.obj: /home/raffaele-bithiatec/opt/ti/ccs910/xdctools_3_51_03_28_core/packages/xdc/runtime/Error__prologue.h ICall/icall_cc2650.obj: /home/raffaele-bithiatec/opt/ti/ccs910/xdctools_3_51_03_28_core/packages/xdc/runtime/Main.h ICall/icall_cc2650.obj: /home/raffaele-bithiatec/opt/ti/ccs910/xdctools_3_51_03_28_core/packages/xdc/runtime/Types.h ICall/icall_cc2650.obj: /home/raffaele-bithiatec/opt/ti/ccs910/xdctools_3_51_03_28_core/packages/xdc/runtime/IModule.h ICall/icall_cc2650.obj: /home/raffaele-bithiatec/opt/ti/ccs910/xdctools_3_51_03_28_core/packages/xdc/runtime/Types.h ICall/icall_cc2650.obj: /home/raffaele-bithiatec/opt/ti/ccs910/xdctools_3_51_03_28_core/packages/xdc/runtime/Types.h ICall/icall_cc2650.obj: /home/raffaele-bithiatec/opt/ti/ccs910/xdctools_3_51_03_28_core/packages/xdc/runtime/IHeap.h ICall/icall_cc2650.obj: /home/raffaele-bithiatec/opt/ti/ccs910/xdctools_3_51_03_28_core/packages/xdc/runtime/Types.h ICall/icall_cc2650.obj: /home/raffaele-bithiatec/opt/ti/ccs910/xdctools_3_51_03_28_core/packages/xdc/runtime/IInstance.h ICall/icall_cc2650.obj: /home/raffaele-bithiatec/opt/ti/ccs910/xdctools_3_51_03_28_core/packages/xdc/runtime/Types.h ICall/icall_cc2650.obj: /home/raffaele-bithiatec/opt/ti/ccs910/xdctools_3_51_03_28_core/packages/xdc/runtime/IModule.h ICall/icall_cc2650.obj: /home/raffaele-bithiatec/opt/ti/ccs910/xdctools_3_51_03_28_core/packages/xdc/runtime/Error.h ICall/icall_cc2650.obj: /home/raffaele-bithiatec/opt/ti/ccs910/xdctools_3_51_03_28_core/packages/xdc/runtime/Memory.h ICall/icall_cc2650.obj: /home/raffaele-bithiatec/opt/ti/ccs910/xdctools_3_51_03_28_core/packages/xdc/runtime/Types.h ICall/icall_cc2650.obj: /home/raffaele-bithiatec/opt/ti/ccs910/xdctools_3_51_03_28_core/packages/xdc/runtime/IModule.h ICall/icall_cc2650.obj: /home/raffaele-bithiatec/opt/ti/ccs910/xdctools_3_51_03_28_core/packages/xdc/runtime/IHeap.h ICall/icall_cc2650.obj: /home/raffaele-bithiatec/opt/ti/ccs910/xdctools_3_51_03_28_core/packages/xdc/runtime/Error.h ICall/icall_cc2650.obj: /home/raffaele-bithiatec/opt/ti/ccs910/xdctools_3_51_03_28_core/packages/xdc/runtime/package/Memory_HeapProxy.h ICall/icall_cc2650.obj: /home/raffaele-bithiatec/opt/ti/ccs910/xdctools_3_51_03_28_core/packages/xdc/runtime/Types.h ICall/icall_cc2650.obj: /home/raffaele-bithiatec/opt/ti/ccs910/xdctools_3_51_03_28_core/packages/xdc/runtime/IInstance.h ICall/icall_cc2650.obj: /home/raffaele-bithiatec/opt/ti/ccs910/xdctools_3_51_03_28_core/packages/xdc/runtime/IHeap.h ICall/icall_cc2650.obj: /home/raffaele-bithiatec/opt/ti/ccs910/xdctools_3_51_03_28_core/packages/xdc/runtime/Error.h ICall/icall_cc2650.obj: /home/raffaele-bithiatec/opt/ti/ccs910/xdctools_3_51_03_28_core/packages/xdc/runtime/IGateProvider.h ICall/icall_cc2650.obj: /home/raffaele-bithiatec/opt/ti/ccs910/xdctools_3_51_03_28_core/packages/xdc/runtime/Types.h ICall/icall_cc2650.obj: /home/raffaele-bithiatec/opt/ti/ccs910/xdctools_3_51_03_28_core/packages/xdc/runtime/IInstance.h ICall/icall_cc2650.obj: /home/raffaele-bithiatec/opt/ti/ccs910/xdctools_3_51_03_28_core/packages/xdc/runtime/IModule.h ICall/icall_cc2650.obj: /home/raffaele-bithiatec/opt/ti/ccs910/xdctools_3_51_03_28_core/packages/xdc/runtime/package/Main_Module_GateProxy.h ICall/icall_cc2650.obj: /home/raffaele-bithiatec/opt/ti/ccs910/xdctools_3_51_03_28_core/packages/xdc/runtime/Types.h ICall/icall_cc2650.obj: /home/raffaele-bithiatec/opt/ti/ccs910/xdctools_3_51_03_28_core/packages/xdc/runtime/IInstance.h ICall/icall_cc2650.obj: /home/raffaele-bithiatec/opt/ti/ccs910/xdctools_3_51_03_28_core/packages/xdc/runtime/IGateProvider.h ICall/icall_cc2650.obj: /home/raffaele-bithiatec/opt/ti/ccs910/xdctools_3_51_03_28_core/packages/xdc/runtime/IModule.h ICall/icall_cc2650.obj: /home/raffaele-bithiatec/opt/ti/ccs910/xdctools_3_51_03_28_core/packages/xdc/runtime/Types.h ICall/icall_cc2650.obj: /home/raffaele-bithiatec/opt/ti/ccs910/xdctools_3_51_03_28_core/packages/xdc/runtime/Error__epilogue.h ICall/icall_cc2650.obj: /home/raffaele-bithiatec/opt/ti/ccs910/xdctools_3_51_03_28_core/packages/xdc/runtime/Types.h ICall/icall_cc2650.obj: /home/raffaele-bithiatec/opt/ti/ccs910/xdctools_3_51_03_28_core/packages/xdc/runtime/IModule.h ICall/icall_cc2650.obj: /home/raffaele-bithiatec/opt/ti/ccs910/xdctools_3_51_03_28_core/packages/xdc/runtime/IGateProvider.h ICall/icall_cc2650.obj: /home/raffaele-bithiatec/opt/ti/simplelink_cc2640r2_sdk_4_10_00_10/kernel/tirtos/packages/ti/sysbios/package/BIOS_RtsGateProxy.h ICall/icall_cc2650.obj: /home/raffaele-bithiatec/opt/ti/ccs910/xdctools_3_51_03_28_core/packages/xdc/runtime/Types.h ICall/icall_cc2650.obj: /home/raffaele-bithiatec/opt/ti/ccs910/xdctools_3_51_03_28_core/packages/xdc/runtime/IInstance.h ICall/icall_cc2650.obj: /home/raffaele-bithiatec/opt/ti/ccs910/xdctools_3_51_03_28_core/packages/xdc/runtime/IGateProvider.h ICall/icall_cc2650.obj: /home/raffaele-bithiatec/opt/ti/simplelink_cc2640r2_sdk_4_10_00_10/kernel/tirtos/packages/ti/sysbios/BIOS__epilogue.h ICall/icall_cc2650.obj: /home/raffaele-bithiatec/opt/ti/simplelink_cc2640r2_sdk_4_10_00_10/kernel/tirtos/packages/ti/sysbios/package/BIOS_RtsGateProxy.h ICall/icall_cc2650.obj: /home/raffaele-bithiatec/opt/ti/simplelink_cc2640r2_sdk_4_10_00_10/source/ti/drivers/Power.h ICall/icall_cc2650.obj: /home/raffaele-bithiatec/opt/ti/simplelink_cc2640r2_sdk_4_10_00_10/source/ti/drivers/utils/List.h ICall/icall_cc2650.obj: /home/raffaele-bithiatec/opt/ti/simplelink_cc2640r2_sdk_4_10_00_10/source/ti/drivers/power/PowerCC26XX.h ICall/icall_cc2650.obj: /home/raffaele-bithiatec/opt/ti/simplelink_cc2640r2_sdk_4_10_00_10/source/ti/drivers/dpl/HwiP.h ICall/icall_cc2650.obj: /home/raffaele-bithiatec/opt/ti/simplelink_cc2640r2_sdk_4_10_00_10/source/ti/drivers/dpl/ClockP.h /home/raffaele-bithiatec/opt/ti/simplelink_cc2640r2_sdk_4_10_00_10/source/ti/blestack/icall/src/icall_cc2650.c: /home/raffaele-bithiatec/opt/ti/simplelink_cc2640r2_sdk_4_10_00_10/source/ti/blestack/icall/src/icall_platform.h: /home/raffaele-bithiatec/opt/ti/ccs910/ccs/tools/compiler/ti-cgt-arm_18.12.2.LTS/include/stdint.h: /home/raffaele-bithiatec/opt/ti/ccs910/ccs/tools/compiler/ti-cgt-arm_18.12.2.LTS/include/_stdint40.h: /home/raffaele-bithiatec/opt/ti/ccs910/ccs/tools/compiler/ti-cgt-arm_18.12.2.LTS/include/sys/stdint.h: /home/raffaele-bithiatec/opt/ti/ccs910/ccs/tools/compiler/ti-cgt-arm_18.12.2.LTS/include/sys/cdefs.h: /home/raffaele-bithiatec/opt/ti/ccs910/ccs/tools/compiler/ti-cgt-arm_18.12.2.LTS/include/sys/_types.h: /home/raffaele-bithiatec/opt/ti/ccs910/ccs/tools/compiler/ti-cgt-arm_18.12.2.LTS/include/machine/_types.h: /home/raffaele-bithiatec/opt/ti/ccs910/ccs/tools/compiler/ti-cgt-arm_18.12.2.LTS/include/machine/_stdint.h: /home/raffaele-bithiatec/opt/ti/ccs910/ccs/tools/compiler/ti-cgt-arm_18.12.2.LTS/include/sys/_stdint.h: /home/raffaele-bithiatec/opt/ti/simplelink_cc2640r2_sdk_4_10_00_10/source/ti/blestack/icall/src/inc/icall.h: /home/raffaele-bithiatec/opt/ti/ccs910/ccs/tools/compiler/ti-cgt-arm_18.12.2.LTS/include/stdbool.h: /home/raffaele-bithiatec/opt/ti/ccs910/ccs/tools/compiler/ti-cgt-arm_18.12.2.LTS/include/stdlib.h: /home/raffaele-bithiatec/opt/ti/ccs910/ccs/tools/compiler/ti-cgt-arm_18.12.2.LTS/include/_ti_config.h: /home/raffaele-bithiatec/opt/ti/ccs910/ccs/tools/compiler/ti-cgt-arm_18.12.2.LTS/include/linkage.h: /home/raffaele-bithiatec/opt/ti/simplelink_cc2640r2_sdk_4_10_00_10/source/ti/blestack/hal/src/inc/hal_assert.h: /home/raffaele-bithiatec/opt/ti/simplelink_cc2640r2_sdk_4_10_00_10/source/ti/blestack/hal/src/target/_common/hal_types.h: /home/raffaele-bithiatec/opt/ti/simplelink_cc2640r2_sdk_4_10_00_10/source/ti/blestack/hal/src/target/_common/../_common/cc26xx/_hal_types.h: /home/raffaele-bithiatec/opt/ti/simplelink_cc2640r2_sdk_4_10_00_10/source/ti/blestack/hal/src/inc/hal_defs.h: /home/raffaele-bithiatec/opt/ti/ccs910/ccs/tools/compiler/ti-cgt-arm_18.12.2.LTS/include/stdlib.h: /home/raffaele-bithiatec/opt/ti/simplelink_cc2640r2_sdk_4_10_00_10/source/ti/blestack/icall/src/inc/icall_cc26xx_defs.h: /home/raffaele-bithiatec/opt/ti/simplelink_cc2640r2_sdk_4_10_00_10/kernel/tirtos/packages/ti/sysbios/BIOS.h: /home/raffaele-bithiatec/opt/ti/ccs910/xdctools_3_51_03_28_core/packages/xdc/std.h: /home/raffaele-bithiatec/opt/ti/ccs910/ccs/tools/compiler/ti-cgt-arm_18.12.2.LTS/include/stdarg.h: /home/raffaele-bithiatec/opt/ti/ccs910/ccs/tools/compiler/ti-cgt-arm_18.12.2.LTS/include/stddef.h: /home/raffaele-bithiatec/opt/ti/simplelink_cc2640r2_sdk_4_10_00_10/kernel/tirtos/packages/ti/targets/arm/elf/std.h: /home/raffaele-bithiatec/opt/ti/simplelink_cc2640r2_sdk_4_10_00_10/kernel/tirtos/packages/ti/targets/arm/elf/M3.h: /home/raffaele-bithiatec/opt/ti/simplelink_cc2640r2_sdk_4_10_00_10/kernel/tirtos/packages/ti/targets/std.h: /home/raffaele-bithiatec/opt/ti/ccs910/xdctools_3_51_03_28_core/packages/xdc/runtime/xdc.h: /home/raffaele-bithiatec/opt/ti/ccs910/xdctools_3_51_03_28_core/packages/xdc/runtime/Types.h: /home/raffaele-bithiatec/opt/ti/ccs910/xdctools_3_51_03_28_core/packages/xdc/runtime/Types__prologue.h: /home/raffaele-bithiatec/opt/ti/ccs910/xdctools_3_51_03_28_core/packages/xdc/runtime/package/package.defs.h: /home/raffaele-bithiatec/opt/ti/ccs910/xdctools_3_51_03_28_core/packages/xdc/runtime/Types__epilogue.h: /home/raffaele-bithiatec/opt/ti/simplelink_cc2640r2_sdk_4_10_00_10/kernel/tirtos/packages/ti/sysbios/BIOS__prologue.h: /home/raffaele-bithiatec/opt/ti/simplelink_cc2640r2_sdk_4_10_00_10/kernel/tirtos/packages/ti/sysbios/package/package.defs.h: /home/raffaele-bithiatec/opt/ti/ccs910/xdctools_3_51_03_28_core/packages/xdc/runtime/Error.h: /home/raffaele-bithiatec/opt/ti/ccs910/xdctools_3_51_03_28_core/packages/xdc/runtime/Types.h: /home/raffaele-bithiatec/opt/ti/ccs910/xdctools_3_51_03_28_core/packages/xdc/runtime/Error__prologue.h: /home/raffaele-bithiatec/opt/ti/ccs910/xdctools_3_51_03_28_core/packages/xdc/runtime/Main.h: /home/raffaele-bithiatec/opt/ti/ccs910/xdctools_3_51_03_28_core/packages/xdc/runtime/Types.h: /home/raffaele-bithiatec/opt/ti/ccs910/xdctools_3_51_03_28_core/packages/xdc/runtime/IModule.h: /home/raffaele-bithiatec/opt/ti/ccs910/xdctools_3_51_03_28_core/packages/xdc/runtime/Types.h: /home/raffaele-bithiatec/opt/ti/ccs910/xdctools_3_51_03_28_core/packages/xdc/runtime/Types.h: /home/raffaele-bithiatec/opt/ti/ccs910/xdctools_3_51_03_28_core/packages/xdc/runtime/IHeap.h: /home/raffaele-bithiatec/opt/ti/ccs910/xdctools_3_51_03_28_core/packages/xdc/runtime/Types.h: /home/raffaele-bithiatec/opt/ti/ccs910/xdctools_3_51_03_28_core/packages/xdc/runtime/IInstance.h: /home/raffaele-bithiatec/opt/ti/ccs910/xdctools_3_51_03_28_core/packages/xdc/runtime/Types.h: /home/raffaele-bithiatec/opt/ti/ccs910/xdctools_3_51_03_28_core/packages/xdc/runtime/IModule.h: /home/raffaele-bithiatec/opt/ti/ccs910/xdctools_3_51_03_28_core/packages/xdc/runtime/Error.h: /home/raffaele-bithiatec/opt/ti/ccs910/xdctools_3_51_03_28_core/packages/xdc/runtime/Memory.h: /home/raffaele-bithiatec/opt/ti/ccs910/xdctools_3_51_03_28_core/packages/xdc/runtime/Types.h: /home/raffaele-bithiatec/opt/ti/ccs910/xdctools_3_51_03_28_core/packages/xdc/runtime/IModule.h: /home/raffaele-bithiatec/opt/ti/ccs910/xdctools_3_51_03_28_core/packages/xdc/runtime/IHeap.h: /home/raffaele-bithiatec/opt/ti/ccs910/xdctools_3_51_03_28_core/packages/xdc/runtime/Error.h: /home/raffaele-bithiatec/opt/ti/ccs910/xdctools_3_51_03_28_core/packages/xdc/runtime/package/Memory_HeapProxy.h: /home/raffaele-bithiatec/opt/ti/ccs910/xdctools_3_51_03_28_core/packages/xdc/runtime/Types.h: /home/raffaele-bithiatec/opt/ti/ccs910/xdctools_3_51_03_28_core/packages/xdc/runtime/IInstance.h: /home/raffaele-bithiatec/opt/ti/ccs910/xdctools_3_51_03_28_core/packages/xdc/runtime/IHeap.h: /home/raffaele-bithiatec/opt/ti/ccs910/xdctools_3_51_03_28_core/packages/xdc/runtime/Error.h: /home/raffaele-bithiatec/opt/ti/ccs910/xdctools_3_51_03_28_core/packages/xdc/runtime/IGateProvider.h: /home/raffaele-bithiatec/opt/ti/ccs910/xdctools_3_51_03_28_core/packages/xdc/runtime/Types.h: /home/raffaele-bithiatec/opt/ti/ccs910/xdctools_3_51_03_28_core/packages/xdc/runtime/IInstance.h: /home/raffaele-bithiatec/opt/ti/ccs910/xdctools_3_51_03_28_core/packages/xdc/runtime/IModule.h: /home/raffaele-bithiatec/opt/ti/ccs910/xdctools_3_51_03_28_core/packages/xdc/runtime/package/Main_Module_GateProxy.h: /home/raffaele-bithiatec/opt/ti/ccs910/xdctools_3_51_03_28_core/packages/xdc/runtime/Types.h: /home/raffaele-bithiatec/opt/ti/ccs910/xdctools_3_51_03_28_core/packages/xdc/runtime/IInstance.h: /home/raffaele-bithiatec/opt/ti/ccs910/xdctools_3_51_03_28_core/packages/xdc/runtime/IGateProvider.h: /home/raffaele-bithiatec/opt/ti/ccs910/xdctools_3_51_03_28_core/packages/xdc/runtime/IModule.h: /home/raffaele-bithiatec/opt/ti/ccs910/xdctools_3_51_03_28_core/packages/xdc/runtime/Types.h: /home/raffaele-bithiatec/opt/ti/ccs910/xdctools_3_51_03_28_core/packages/xdc/runtime/Error__epilogue.h: /home/raffaele-bithiatec/opt/ti/ccs910/xdctools_3_51_03_28_core/packages/xdc/runtime/Types.h: /home/raffaele-bithiatec/opt/ti/ccs910/xdctools_3_51_03_28_core/packages/xdc/runtime/IModule.h: /home/raffaele-bithiatec/opt/ti/ccs910/xdctools_3_51_03_28_core/packages/xdc/runtime/IGateProvider.h: /home/raffaele-bithiatec/opt/ti/simplelink_cc2640r2_sdk_4_10_00_10/kernel/tirtos/packages/ti/sysbios/package/BIOS_RtsGateProxy.h: /home/raffaele-bithiatec/opt/ti/ccs910/xdctools_3_51_03_28_core/packages/xdc/runtime/Types.h: /home/raffaele-bithiatec/opt/ti/ccs910/xdctools_3_51_03_28_core/packages/xdc/runtime/IInstance.h: /home/raffaele-bithiatec/opt/ti/ccs910/xdctools_3_51_03_28_core/packages/xdc/runtime/IGateProvider.h: /home/raffaele-bithiatec/opt/ti/simplelink_cc2640r2_sdk_4_10_00_10/kernel/tirtos/packages/ti/sysbios/BIOS__epilogue.h: /home/raffaele-bithiatec/opt/ti/simplelink_cc2640r2_sdk_4_10_00_10/kernel/tirtos/packages/ti/sysbios/package/BIOS_RtsGateProxy.h: /home/raffaele-bithiatec/opt/ti/simplelink_cc2640r2_sdk_4_10_00_10/source/ti/drivers/Power.h: /home/raffaele-bithiatec/opt/ti/simplelink_cc2640r2_sdk_4_10_00_10/source/ti/drivers/utils/List.h: /home/raffaele-bithiatec/opt/ti/simplelink_cc2640r2_sdk_4_10_00_10/source/ti/drivers/power/PowerCC26XX.h: /home/raffaele-bithiatec/opt/ti/simplelink_cc2640r2_sdk_4_10_00_10/source/ti/drivers/dpl/HwiP.h: /home/raffaele-bithiatec/opt/ti/simplelink_cc2640r2_sdk_4_10_00_10/source/ti/drivers/dpl/ClockP.h:
D
// Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/protobuf/struct.proto module google.protobuf.struct_; import std.json : JSONValue; import google.protobuf; class Struct { @Proto(1) Value[string] fields = protoDefaultValue!(Value[string]); this() { } this(JSONValue value) { fromJSONValue(value); } JSONValue toJSONValue()() { import std.array : assocArray; import std.algorithm : map; import std.typecons : tuple; return JSONValue(fields.byKeyValue.map!(a => tuple(a.key, a.value.toJSONValue)).assocArray); } auto fromJSONValue()(JSONValue value) { import std.array : assocArray; import std.algorithm : map; import std.exception : enforce; import std.json : JSON_TYPE; import std.typecons : tuple; if (value.type == JSON_TYPE.NULL) { fields = protoDefaultValue!(Value[string]); return this; } enforce!ProtobufException(value.type == JSON_TYPE.OBJECT, "JSON object expected"); fields = value.object.byKeyValue.map!(a => tuple(a.key, new Value(a.value))).assocArray; return this; } } class Value { enum KindCase { kindNotSet = 0, nullValue = 1, numberValue = 2, stringValue = 3, boolValue = 4, structValue = 5, listValue = 6, } KindCase _kindCase = KindCase.kindNotSet; @property KindCase kindCase() { return _kindCase; } void clearKind() { _kindCase = KindCase.kindNotSet; } @Oneof("_kindCase") union { @Proto(1) NullValue _nullValue = protoDefaultValue!NullValue; mixin(oneofAccessors!_nullValue); @Proto(2) double _numberValue; mixin(oneofAccessors!_numberValue); @Proto(3) string _stringValue; mixin(oneofAccessors!_stringValue); @Proto(4) bool _boolValue; mixin(oneofAccessors!_boolValue); @Proto(5) Struct _structValue; mixin(oneofAccessors!_structValue); @Proto(6) ListValue _listValue; mixin(oneofAccessors!_listValue); } this() { } this(JSONValue jsonValue) { fromJSONValue(jsonValue); } override bool opEquals(Object o) { auto other = cast(Value) o; if (other is null) return false; if (kindCase != other.kindCase) return false; final switch (kindCase) { case KindCase.kindNotSet: return true; case KindCase.nullValue: return nullValue == other.nullValue; case KindCase.numberValue: return numberValue == other.numberValue; case KindCase.stringValue: return stringValue == other.stringValue; case KindCase.boolValue: return boolValue == other.boolValue; case KindCase.structValue: return structValue == other.structValue; case KindCase.listValue: return listValue == other.listValue; } } JSONValue toJSONValue()() { import std.array : array, assocArray; import std.algorithm : map; import std.typecons : tuple; final switch (kindCase) { case KindCase.kindNotSet: return JSONValue(null); case KindCase.nullValue: return JSONValue(null); case KindCase.numberValue: return JSONValue(numberValue); case KindCase.stringValue: return JSONValue(stringValue); case KindCase.boolValue: return JSONValue(boolValue); case KindCase.structValue: return JSONValue(structValue.fields.byKeyValue.map!(a => tuple(a.key, a.value.toJSONValue)).assocArray); case KindCase.listValue: return JSONValue(listValue.values.map!(a => a.toJSONValue).array); } } auto fromJSONValue()(JSONValue jsonValue) { import std.array : array, assocArray; import std.algorithm : map; import std.json : JSON_TYPE; import std.typecons : tuple; switch (jsonValue.type) { case JSON_TYPE.NULL: nullValue = NullValue.NULL_VALUE; break; case JSON_TYPE.STRING: stringValue = jsonValue.str; break; case JSON_TYPE.INTEGER: numberValue = jsonValue.integer; break; case JSON_TYPE.UINTEGER: numberValue = jsonValue.uinteger; break; case JSON_TYPE.FLOAT: numberValue = jsonValue.floating; break; case JSON_TYPE.OBJECT: if (structValue is null) structValue = new Struct; structValue.fields = jsonValue.object.byKeyValue.map!(a => tuple(a.key, new Value(a.value))).assocArray; break; case JSON_TYPE.ARRAY: if (listValue is null) listValue = new ListValue; listValue.values = jsonValue.array.map!(a => new Value(a)).array; break; case JSON_TYPE.TRUE: boolValue = true; break; case JSON_TYPE.FALSE: boolValue = false; break; default: throw new ProtobufException("Unexpected JSON type"); } return this; } } enum NullValue { NULL_VALUE = 0, } class ListValue { @Proto(1) Value[] values = protoDefaultValue!(Value[]); this() { } this(JSONValue value) { fromJSONValue(value); } JSONValue toJSONValue()() { import std.array : array; import std.algorithm : map; return JSONValue(values.map!(a => a.toJSONValue).array); } auto fromJSONValue()(JSONValue value) { import std.array : array; import std.algorithm : map; import std.exception : enforce; import std.json : JSON_TYPE; if (value.type == JSON_TYPE.NULL) { values = protoDefaultValue!(Value[]); return this; } enforce!ProtobufException(value.type == JSON_TYPE.ARRAY, "JSON array expected"); values = value.array.map!(a => new Value(a)).array; return this; } }
D
/++ + Authors: Stephan Dilly, lastname dot firstname at gmail dot com + Copyright: MIT +/ module ask.alexaskill; import vibe.d; import ask.types; import ask.locale; import ask.baseintent; /// annotation to mark an intent callback, use name to specify the exact intent name as specified in the intent schema struct CustomIntent { /// string name; } /++ + Abstract base class to inherit your skill from. + + There are two ways to implement a alexa intent: + * add a @CustomIntent annotation to a method in your skill class + * create an intent class inheriting from `BaseIntent` and register it using `addIntent` +/ abstract class AlexaSkill(T) : ITextManager { /// private immutable AlexaText[] localeText; /// private BaseIntent[] intents; /++ + constructor that requires the loca table as input + + params: + text = loca table to use for that request + + see_also: + `AlexaText`, `LocaParser` +/ public this(immutable AlexaText[] text) { localeText = text; } /// public int runInEventLoop(AlexaEvent event, AlexaContext context, Duration timeout = 2.seconds) { import std.stdio : writeln, stderr; runTask({ scope (exit) exitEventLoop(); stderr.writefln("execute request: %s", event.request.type); auto result = executeEvent(event, context); writeln(serializeToJson(result).toPrettyString()); }); setTimer(timeout, { writeln("{}"); stderr.writeln("intent timeout"); exitEventLoop(); }); return runEventLoop(); } /// package AlexaResult executeEvent(AlexaEvent event, AlexaContext context) { AlexaResult result; if (event.request.type == AlexaRequest.Type.LaunchRequest) result = onLaunch(event, context); else if (event.request.type == AlexaRequest.Type.IntentRequest) result = onIntent(event, context); else if (event.request.type == AlexaRequest.Type.SessionEndedRequest) onSessionEnd(event, context); return result; } /++ + adds an intent handler + + see_also: + `BaseIntent` +/ public void addIntent(BaseIntent intent) { intents ~= intent; intent.textManager = this; } /++ + returns the localized text string depending on the loaded locale database + + see_also: + `this`, `ITextManager` +/ string getText(int _key) const pure nothrow { return localeText[_key].text; } /// see https://developer.amazon.com/public/solutions/alexa/alexa-skills-kit/docs/custom-standard-request-types-reference#launchrequest protected AlexaResult onLaunch(AlexaEvent, AlexaContext) { throw new Exception("not implemented"); } /// see https://developer.amazon.com/public/solutions/alexa/alexa-skills-kit/docs/custom-standard-request-types-reference#intentrequest private AlexaResult onIntent(AlexaEvent event, AlexaContext context) { import std.traits : hasUDA, getUDAs; foreach (i, member; __traits(derivedMembers, T)) { enum isPublic = __traits(getProtection, __traits(getMember, cast(T) this, member)) == "public"; static if (isPublic && hasUDA!(__traits(getMember, T, member), CustomIntent)) { enum name = getUDAs!(__traits(getMember, T, member), CustomIntent)[0].name; if (event.request.intent.name == name) { mixin("return (cast(T)this)." ~ member ~ "(event, context);"); } } } return tryRegisteredIntents(event, context); } /// private AlexaResult tryRegisteredIntents(AlexaEvent event, AlexaContext context) { const eventIntent = event.request.intent.name; foreach (baseIntent; intents) { if (baseIntent.name == eventIntent) return baseIntent.onIntent(event, context); } return noIntentMatch(event, context); } /// protected AlexaResult noIntentMatch(AlexaEvent event, AlexaContext) { import std.stdio : stderr; stderr.writefln("no intent did match: %s", event.request.intent.name); return AlexaResult(); } /// see https://developer.amazon.com/public/solutions/alexa/alexa-skills-kit/docs/custom-standard-request-types-reference#sessionendedrequest protected void onSessionEnd(AlexaEvent, AlexaContext) { } }
D
module windows.js; public import windows.automation; public import windows.com; public import windows.debug; extern(Windows): enum JsRuntimeVersion { JsRuntimeVersion10 = 0, JsRuntimeVersion11 = 1, JsRuntimeVersionEdge = -1, } @DllImport("chakra.dll") JsErrorCode JsCreateRuntime(JsRuntimeAttributes attributes, JsRuntimeVersion runtimeVersion, JsThreadServiceCallback threadService, void** runtime); @DllImport("chakra.dll") JsErrorCode JsCollectGarbage(void* runtime); @DllImport("chakra.dll") JsErrorCode JsDisposeRuntime(void* runtime); @DllImport("chakra.dll") JsErrorCode JsGetRuntimeMemoryUsage(void* runtime, uint* memoryUsage); @DllImport("chakra.dll") JsErrorCode JsGetRuntimeMemoryLimit(void* runtime, uint* memoryLimit); @DllImport("chakra.dll") JsErrorCode JsSetRuntimeMemoryLimit(void* runtime, uint memoryLimit); @DllImport("chakra.dll") JsErrorCode JsSetRuntimeMemoryAllocationCallback(void* runtime, void* callbackState, JsMemoryAllocationCallback allocationCallback); @DllImport("chakra.dll") JsErrorCode JsSetRuntimeBeforeCollectCallback(void* runtime, void* callbackState, JsBeforeCollectCallback beforeCollectCallback); @DllImport("chakra.dll") JsErrorCode JsAddRef(void* ref, uint* count); @DllImport("chakra.dll") JsErrorCode JsRelease(void* ref, uint* count); @DllImport("chakra.dll") JsErrorCode JsCreateContext(void* runtime, IDebugApplication32 debugApplication, void** newContext); @DllImport("chakra.dll") JsErrorCode JsGetCurrentContext(void** currentContext); @DllImport("chakra.dll") JsErrorCode JsSetCurrentContext(void* context); @DllImport("chakra.dll") JsErrorCode JsGetRuntime(void* context, void** runtime); @DllImport("chakra.dll") JsErrorCode JsStartDebugging(IDebugApplication32 debugApplication); @DllImport("chakra.dll") JsErrorCode JsIdle(uint* nextIdleTick); @DllImport("chakra.dll") JsErrorCode JsParseScript(const(ushort)* script, uint sourceContext, const(ushort)* sourceUrl, void** result); @DllImport("chakra.dll") JsErrorCode JsRunScript(const(ushort)* script, uint sourceContext, const(ushort)* sourceUrl, void** result); @DllImport("chakra.dll") JsErrorCode JsSerializeScript(const(ushort)* script, char* buffer, uint* bufferSize); @DllImport("chakra.dll") JsErrorCode JsParseSerializedScript(const(ushort)* script, ubyte* buffer, uint sourceContext, const(ushort)* sourceUrl, void** result); @DllImport("chakra.dll") JsErrorCode JsRunSerializedScript(const(ushort)* script, ubyte* buffer, uint sourceContext, const(ushort)* sourceUrl, void** result); @DllImport("chakra.dll") JsErrorCode JsGetPropertyIdFromName(const(ushort)* name, void** propertyId); @DllImport("chakra.dll") JsErrorCode JsGetPropertyNameFromId(void* propertyId, const(ushort)** name); @DllImport("chakra.dll") JsErrorCode JsGetUndefinedValue(void** undefinedValue); @DllImport("chakra.dll") JsErrorCode JsGetNullValue(void** nullValue); @DllImport("chakra.dll") JsErrorCode JsGetTrueValue(void** trueValue); @DllImport("chakra.dll") JsErrorCode JsGetFalseValue(void** falseValue); @DllImport("chakra.dll") JsErrorCode JsBoolToBoolean(ubyte value, void** booleanValue); @DllImport("chakra.dll") JsErrorCode JsBooleanToBool(void* value, bool* boolValue); @DllImport("chakra.dll") JsErrorCode JsConvertValueToBoolean(void* value, void** booleanValue); @DllImport("chakra.dll") JsErrorCode JsGetValueType(void* value, JsValueType* type); @DllImport("chakra.dll") JsErrorCode JsDoubleToNumber(double doubleValue, void** value); @DllImport("chakra.dll") JsErrorCode JsIntToNumber(int intValue, void** value); @DllImport("chakra.dll") JsErrorCode JsNumberToDouble(void* value, double* doubleValue); @DllImport("chakra.dll") JsErrorCode JsConvertValueToNumber(void* value, void** numberValue); @DllImport("chakra.dll") JsErrorCode JsGetStringLength(void* stringValue, int* length); @DllImport("chakra.dll") JsErrorCode JsPointerToString(char* stringValue, uint stringLength, void** value); @DllImport("chakra.dll") JsErrorCode JsStringToPointer(void* value, const(ushort)** stringValue, uint* stringLength); @DllImport("chakra.dll") JsErrorCode JsConvertValueToString(void* value, void** stringValue); @DllImport("chakra.dll") JsErrorCode JsVariantToValue(VARIANT* variant, void** value); @DllImport("chakra.dll") JsErrorCode JsValueToVariant(void* object, VARIANT* variant); @DllImport("chakra.dll") JsErrorCode JsGetGlobalObject(void** globalObject); @DllImport("chakra.dll") JsErrorCode JsCreateObject(void** object); @DllImport("chakra.dll") JsErrorCode JsCreateExternalObject(void* data, JsFinalizeCallback finalizeCallback, void** object); @DllImport("chakra.dll") JsErrorCode JsConvertValueToObject(void* value, void** object); @DllImport("chakra.dll") JsErrorCode JsGetPrototype(void* object, void** prototypeObject); @DllImport("chakra.dll") JsErrorCode JsSetPrototype(void* object, void* prototypeObject); @DllImport("chakra.dll") JsErrorCode JsGetExtensionAllowed(void* object, bool* value); @DllImport("chakra.dll") JsErrorCode JsPreventExtension(void* object); @DllImport("chakra.dll") JsErrorCode JsGetProperty(void* object, void* propertyId, void** value); @DllImport("chakra.dll") JsErrorCode JsGetOwnPropertyDescriptor(void* object, void* propertyId, void** propertyDescriptor); @DllImport("chakra.dll") JsErrorCode JsGetOwnPropertyNames(void* object, void** propertyNames); @DllImport("chakra.dll") JsErrorCode JsSetProperty(void* object, void* propertyId, void* value, ubyte useStrictRules); @DllImport("chakra.dll") JsErrorCode JsHasProperty(void* object, void* propertyId, bool* hasProperty); @DllImport("chakra.dll") JsErrorCode JsDeleteProperty(void* object, void* propertyId, ubyte useStrictRules, void** result); @DllImport("chakra.dll") JsErrorCode JsDefineProperty(void* object, void* propertyId, void* propertyDescriptor, bool* result); @DllImport("chakra.dll") JsErrorCode JsHasIndexedProperty(void* object, void* index, bool* result); @DllImport("chakra.dll") JsErrorCode JsGetIndexedProperty(void* object, void* index, void** result); @DllImport("chakra.dll") JsErrorCode JsSetIndexedProperty(void* object, void* index, void* value); @DllImport("chakra.dll") JsErrorCode JsDeleteIndexedProperty(void* object, void* index); @DllImport("chakra.dll") JsErrorCode JsEquals(void* object1, void* object2, bool* result); @DllImport("chakra.dll") JsErrorCode JsStrictEquals(void* object1, void* object2, bool* result); @DllImport("chakra.dll") JsErrorCode JsHasExternalData(void* object, bool* value); @DllImport("chakra.dll") JsErrorCode JsGetExternalData(void* object, void** externalData); @DllImport("chakra.dll") JsErrorCode JsSetExternalData(void* object, void* externalData); @DllImport("chakra.dll") JsErrorCode JsCreateArray(uint length, void** result); @DllImport("chakra.dll") JsErrorCode JsCallFunction(void* function, char* arguments, ushort argumentCount, void** result); @DllImport("chakra.dll") JsErrorCode JsConstructObject(void* function, char* arguments, ushort argumentCount, void** result); @DllImport("chakra.dll") JsErrorCode JsCreateFunction(JsNativeFunction nativeFunction, void* callbackState, void** function); @DllImport("chakra.dll") JsErrorCode JsCreateError(void* message, void** error); @DllImport("chakra.dll") JsErrorCode JsCreateRangeError(void* message, void** error); @DllImport("chakra.dll") JsErrorCode JsCreateReferenceError(void* message, void** error); @DllImport("chakra.dll") JsErrorCode JsCreateSyntaxError(void* message, void** error); @DllImport("chakra.dll") JsErrorCode JsCreateTypeError(void* message, void** error); @DllImport("chakra.dll") JsErrorCode JsCreateURIError(void* message, void** error); @DllImport("chakra.dll") JsErrorCode JsHasException(bool* hasException); @DllImport("chakra.dll") JsErrorCode JsGetAndClearException(void** exception); @DllImport("chakra.dll") JsErrorCode JsSetException(void* exception); @DllImport("chakra.dll") JsErrorCode JsDisableRuntimeExecution(void* runtime); @DllImport("chakra.dll") JsErrorCode JsEnableRuntimeExecution(void* runtime); @DllImport("chakra.dll") JsErrorCode JsIsRuntimeExecutionDisabled(void* runtime, bool* isDisabled); @DllImport("chakra.dll") JsErrorCode JsStartProfiling(IActiveScriptProfilerCallback callback, __MIDL___MIDL_itf_activprof_0000_0000_0002 eventMask, uint context); @DllImport("chakra.dll") JsErrorCode JsStopProfiling(HRESULT reason); @DllImport("chakra.dll") JsErrorCode JsEnumerateHeap(IActiveScriptProfilerHeapEnum* enumerator); @DllImport("chakra.dll") JsErrorCode JsIsEnumeratingHeap(bool* isEnumeratingHeap); enum JsErrorCode { JsNoError = 0, JsErrorCategoryUsage = 65536, JsErrorInvalidArgument = 65537, JsErrorNullArgument = 65538, JsErrorNoCurrentContext = 65539, JsErrorInExceptionState = 65540, JsErrorNotImplemented = 65541, JsErrorWrongThread = 65542, JsErrorRuntimeInUse = 65543, JsErrorBadSerializedScript = 65544, JsErrorInDisabledState = 65545, JsErrorCannotDisableExecution = 65546, JsErrorHeapEnumInProgress = 65547, JsErrorArgumentNotObject = 65548, JsErrorInProfileCallback = 65549, JsErrorInThreadServiceCallback = 65550, JsErrorCannotSerializeDebugScript = 65551, JsErrorAlreadyDebuggingContext = 65552, JsErrorAlreadyProfilingContext = 65553, JsErrorIdleNotEnabled = 65554, JsErrorCategoryEngine = 131072, JsErrorOutOfMemory = 131073, JsErrorCategoryScript = 196608, JsErrorScriptException = 196609, JsErrorScriptCompile = 196610, JsErrorScriptTerminated = 196611, JsErrorScriptEvalDisabled = 196612, JsErrorCategoryFatal = 262144, JsErrorFatal = 262145, } enum JsRuntimeAttributes { JsRuntimeAttributeNone = 0, JsRuntimeAttributeDisableBackgroundWork = 1, JsRuntimeAttributeAllowScriptInterrupt = 2, JsRuntimeAttributeEnableIdleProcessing = 4, JsRuntimeAttributeDisableNativeCodeGeneration = 8, JsRuntimeAttributeDisableEval = 16, } enum JsMemoryEventType { JsMemoryAllocate = 0, JsMemoryFree = 1, JsMemoryFailure = 2, } alias JsMemoryAllocationCallback = extern(Windows) bool function(void* callbackState, JsMemoryEventType allocationEvent, uint allocationSize); alias JsBeforeCollectCallback = extern(Windows) void function(void* callbackState); alias JsBackgroundWorkItemCallback = extern(Windows) void function(void* callbackState); alias JsThreadServiceCallback = extern(Windows) bool function(JsBackgroundWorkItemCallback callback, void* callbackState); enum JsValueType { JsUndefined = 0, JsNull = 1, JsNumber = 2, JsString = 3, JsBoolean = 4, JsObject = 5, JsFunction = 6, JsError = 7, JsArray = 8, } alias JsFinalizeCallback = extern(Windows) void function(void* data); alias JsNativeFunction = extern(Windows) void* function(void* callee, bool isConstructCall, void** arguments, ushort argumentCount, void* callbackState);
D
module implements; import std.typetuple; import allmembers; /** * Statically check if symbol 'a' implements interface I * (that is, if all members of I are found in members of a. */ template implements(alias a, I) if (is(I == interface)) { alias implementsImpl!(a, AllMembers!I) implements; } template implementsImpl(alias a, Items...) { static if (Items.length == 0) enum implementsImpl = true; else static if (staticIndexOf!(Items[0], AllMembers!a) == -1) enum implementsImpl = false; else enum implementsImpl = implementsImpl!(a, Items[1..$]); } interface I { int foo(int i); void foo(); string toString(); } class Bad { void foo(int i) {} } struct Good { int field; int foo(int i) { return i;} void foo() { field = 1;} string toString() { return "I'm a good struct!";} } unittest { assert( implements!(Good, I)); assert(!implements!(Bad, I)); }
D
<?xml version="1.0" encoding="ASCII" standalone="no"?> <di:SashWindowsMngr xmlns:di="http://www.eclipse.org/papyrus/0.7.0/sashdi" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmi:version="2.0"> <pageList> <availablePage> <emfPageIdentifier href="VAR_9_BeT-7531616241.notation#_copSALmGEeKQQp7P9cQvNQ"/> </availablePage> </pageList> <sashModel currentSelection="//@sashModel/@windows.0/@children.0"> <windows> <children xsi:type="di:TabFolder"> <children> <emfPageIdentifier href="VAR_9_BeT-7531616241.notation#_copSALmGEeKQQp7P9cQvNQ"/> </children> </children> </windows> </sashModel> </di:SashWindowsMngr>
D
/Users/lishijun1/Documents/swiftworkspace/JDCloudSDKSwift/jdcloud-sdk-swift-github/JDCloudSDKSwift/.build/x86_64-apple-macosx10.10/debug/JDCloudSDKOss.build/Client/PutBucketExecutor.swift.o : /Users/lishijun1/Documents/swiftworkspace/JDCloudSDKSwift/jdcloud-sdk-swift-github/JDCloudSDKSwift/Sources/JDCloudSDKOss/API/ListBucketsResponse.swift /Users/lishijun1/Documents/swiftworkspace/JDCloudSDKSwift/jdcloud-sdk-swift-github/JDCloudSDKSwift/Sources/JDCloudSDKOss/API/HeadBucketResponse.swift /Users/lishijun1/Documents/swiftworkspace/JDCloudSDKSwift/jdcloud-sdk-swift-github/JDCloudSDKSwift/Sources/JDCloudSDKOss/API/DeleteBucketResponse.swift /Users/lishijun1/Documents/swiftworkspace/JDCloudSDKSwift/jdcloud-sdk-swift-github/JDCloudSDKSwift/Sources/JDCloudSDKOss/API/PutBucketResponse.swift /Users/lishijun1/Documents/swiftworkspace/JDCloudSDKSwift/jdcloud-sdk-swift-github/JDCloudSDKSwift/Sources/JDCloudSDKOss/Model/User.swift /Users/lishijun1/Documents/swiftworkspace/JDCloudSDKSwift/jdcloud-sdk-swift-github/JDCloudSDKSwift/Sources/JDCloudSDKOss/Client/ListBucketsExecutor.swift /Users/lishijun1/Documents/swiftworkspace/JDCloudSDKSwift/jdcloud-sdk-swift-github/JDCloudSDKSwift/Sources/JDCloudSDKOss/Client/HeadBucketExecutor.swift /Users/lishijun1/Documents/swiftworkspace/JDCloudSDKSwift/jdcloud-sdk-swift-github/JDCloudSDKSwift/Sources/JDCloudSDKOss/Client/DeleteBucketExecutor.swift /Users/lishijun1/Documents/swiftworkspace/JDCloudSDKSwift/jdcloud-sdk-swift-github/JDCloudSDKSwift/Sources/JDCloudSDKOss/Client/PutBucketExecutor.swift /Users/lishijun1/Documents/swiftworkspace/JDCloudSDKSwift/jdcloud-sdk-swift-github/JDCloudSDKSwift/Sources/JDCloudSDKOss/Model/Bucket.swift /Users/lishijun1/Documents/swiftworkspace/JDCloudSDKSwift/jdcloud-sdk-swift-github/JDCloudSDKSwift/Sources/JDCloudSDKOss/API/ListBucketsResult.swift /Users/lishijun1/Documents/swiftworkspace/JDCloudSDKSwift/jdcloud-sdk-swift-github/JDCloudSDKSwift/Sources/JDCloudSDKOss/API/HeadBucketResult.swift /Users/lishijun1/Documents/swiftworkspace/JDCloudSDKSwift/jdcloud-sdk-swift-github/JDCloudSDKSwift/Sources/JDCloudSDKOss/API/DeleteBucketResult.swift /Users/lishijun1/Documents/swiftworkspace/JDCloudSDKSwift/jdcloud-sdk-swift-github/JDCloudSDKSwift/Sources/JDCloudSDKOss/API/PutBucketResult.swift /Users/lishijun1/Documents/swiftworkspace/JDCloudSDKSwift/jdcloud-sdk-swift-github/JDCloudSDKSwift/Sources/JDCloudSDKOss/Client/OssClient.swift /Users/lishijun1/Documents/swiftworkspace/JDCloudSDKSwift/jdcloud-sdk-swift-github/JDCloudSDKSwift/Sources/JDCloudSDKOss/API/ListBucketsRequest.swift /Users/lishijun1/Documents/swiftworkspace/JDCloudSDKSwift/jdcloud-sdk-swift-github/JDCloudSDKSwift/Sources/JDCloudSDKOss/API/HeadBucketRequest.swift /Users/lishijun1/Documents/swiftworkspace/JDCloudSDKSwift/jdcloud-sdk-swift-github/JDCloudSDKSwift/Sources/JDCloudSDKOss/API/DeleteBucketRequest.swift /Users/lishijun1/Documents/swiftworkspace/JDCloudSDKSwift/jdcloud-sdk-swift-github/JDCloudSDKSwift/Sources/JDCloudSDKOss/API/PutBucketRequest.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/ObjectiveC.swiftmodule /Users/lishijun1/Documents/swiftworkspace/JDCloudSDKSwift/jdcloud-sdk-swift-github/JDCloudSDKSwift/.build/x86_64-apple-macosx10.10/debug/JDCloudSDKCore.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 /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/lishijun1/Documents/swiftworkspace/JDCloudSDKSwift/jdcloud-sdk-swift-github/JDCloudSDKSwift/.build/x86_64-apple-macosx10.10/debug/JDCloudSDKOss.build/PutBucketExecutor~partial.swiftmodule : /Users/lishijun1/Documents/swiftworkspace/JDCloudSDKSwift/jdcloud-sdk-swift-github/JDCloudSDKSwift/Sources/JDCloudSDKOss/API/ListBucketsResponse.swift /Users/lishijun1/Documents/swiftworkspace/JDCloudSDKSwift/jdcloud-sdk-swift-github/JDCloudSDKSwift/Sources/JDCloudSDKOss/API/HeadBucketResponse.swift /Users/lishijun1/Documents/swiftworkspace/JDCloudSDKSwift/jdcloud-sdk-swift-github/JDCloudSDKSwift/Sources/JDCloudSDKOss/API/DeleteBucketResponse.swift /Users/lishijun1/Documents/swiftworkspace/JDCloudSDKSwift/jdcloud-sdk-swift-github/JDCloudSDKSwift/Sources/JDCloudSDKOss/API/PutBucketResponse.swift /Users/lishijun1/Documents/swiftworkspace/JDCloudSDKSwift/jdcloud-sdk-swift-github/JDCloudSDKSwift/Sources/JDCloudSDKOss/Model/User.swift /Users/lishijun1/Documents/swiftworkspace/JDCloudSDKSwift/jdcloud-sdk-swift-github/JDCloudSDKSwift/Sources/JDCloudSDKOss/Client/ListBucketsExecutor.swift /Users/lishijun1/Documents/swiftworkspace/JDCloudSDKSwift/jdcloud-sdk-swift-github/JDCloudSDKSwift/Sources/JDCloudSDKOss/Client/HeadBucketExecutor.swift /Users/lishijun1/Documents/swiftworkspace/JDCloudSDKSwift/jdcloud-sdk-swift-github/JDCloudSDKSwift/Sources/JDCloudSDKOss/Client/DeleteBucketExecutor.swift /Users/lishijun1/Documents/swiftworkspace/JDCloudSDKSwift/jdcloud-sdk-swift-github/JDCloudSDKSwift/Sources/JDCloudSDKOss/Client/PutBucketExecutor.swift /Users/lishijun1/Documents/swiftworkspace/JDCloudSDKSwift/jdcloud-sdk-swift-github/JDCloudSDKSwift/Sources/JDCloudSDKOss/Model/Bucket.swift /Users/lishijun1/Documents/swiftworkspace/JDCloudSDKSwift/jdcloud-sdk-swift-github/JDCloudSDKSwift/Sources/JDCloudSDKOss/API/ListBucketsResult.swift /Users/lishijun1/Documents/swiftworkspace/JDCloudSDKSwift/jdcloud-sdk-swift-github/JDCloudSDKSwift/Sources/JDCloudSDKOss/API/HeadBucketResult.swift /Users/lishijun1/Documents/swiftworkspace/JDCloudSDKSwift/jdcloud-sdk-swift-github/JDCloudSDKSwift/Sources/JDCloudSDKOss/API/DeleteBucketResult.swift /Users/lishijun1/Documents/swiftworkspace/JDCloudSDKSwift/jdcloud-sdk-swift-github/JDCloudSDKSwift/Sources/JDCloudSDKOss/API/PutBucketResult.swift /Users/lishijun1/Documents/swiftworkspace/JDCloudSDKSwift/jdcloud-sdk-swift-github/JDCloudSDKSwift/Sources/JDCloudSDKOss/Client/OssClient.swift /Users/lishijun1/Documents/swiftworkspace/JDCloudSDKSwift/jdcloud-sdk-swift-github/JDCloudSDKSwift/Sources/JDCloudSDKOss/API/ListBucketsRequest.swift /Users/lishijun1/Documents/swiftworkspace/JDCloudSDKSwift/jdcloud-sdk-swift-github/JDCloudSDKSwift/Sources/JDCloudSDKOss/API/HeadBucketRequest.swift /Users/lishijun1/Documents/swiftworkspace/JDCloudSDKSwift/jdcloud-sdk-swift-github/JDCloudSDKSwift/Sources/JDCloudSDKOss/API/DeleteBucketRequest.swift /Users/lishijun1/Documents/swiftworkspace/JDCloudSDKSwift/jdcloud-sdk-swift-github/JDCloudSDKSwift/Sources/JDCloudSDKOss/API/PutBucketRequest.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/ObjectiveC.swiftmodule /Users/lishijun1/Documents/swiftworkspace/JDCloudSDKSwift/jdcloud-sdk-swift-github/JDCloudSDKSwift/.build/x86_64-apple-macosx10.10/debug/JDCloudSDKCore.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 /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/lishijun1/Documents/swiftworkspace/JDCloudSDKSwift/jdcloud-sdk-swift-github/JDCloudSDKSwift/.build/x86_64-apple-macosx10.10/debug/JDCloudSDKOss.build/PutBucketExecutor~partial.swiftdoc : /Users/lishijun1/Documents/swiftworkspace/JDCloudSDKSwift/jdcloud-sdk-swift-github/JDCloudSDKSwift/Sources/JDCloudSDKOss/API/ListBucketsResponse.swift /Users/lishijun1/Documents/swiftworkspace/JDCloudSDKSwift/jdcloud-sdk-swift-github/JDCloudSDKSwift/Sources/JDCloudSDKOss/API/HeadBucketResponse.swift /Users/lishijun1/Documents/swiftworkspace/JDCloudSDKSwift/jdcloud-sdk-swift-github/JDCloudSDKSwift/Sources/JDCloudSDKOss/API/DeleteBucketResponse.swift /Users/lishijun1/Documents/swiftworkspace/JDCloudSDKSwift/jdcloud-sdk-swift-github/JDCloudSDKSwift/Sources/JDCloudSDKOss/API/PutBucketResponse.swift /Users/lishijun1/Documents/swiftworkspace/JDCloudSDKSwift/jdcloud-sdk-swift-github/JDCloudSDKSwift/Sources/JDCloudSDKOss/Model/User.swift /Users/lishijun1/Documents/swiftworkspace/JDCloudSDKSwift/jdcloud-sdk-swift-github/JDCloudSDKSwift/Sources/JDCloudSDKOss/Client/ListBucketsExecutor.swift /Users/lishijun1/Documents/swiftworkspace/JDCloudSDKSwift/jdcloud-sdk-swift-github/JDCloudSDKSwift/Sources/JDCloudSDKOss/Client/HeadBucketExecutor.swift /Users/lishijun1/Documents/swiftworkspace/JDCloudSDKSwift/jdcloud-sdk-swift-github/JDCloudSDKSwift/Sources/JDCloudSDKOss/Client/DeleteBucketExecutor.swift /Users/lishijun1/Documents/swiftworkspace/JDCloudSDKSwift/jdcloud-sdk-swift-github/JDCloudSDKSwift/Sources/JDCloudSDKOss/Client/PutBucketExecutor.swift /Users/lishijun1/Documents/swiftworkspace/JDCloudSDKSwift/jdcloud-sdk-swift-github/JDCloudSDKSwift/Sources/JDCloudSDKOss/Model/Bucket.swift /Users/lishijun1/Documents/swiftworkspace/JDCloudSDKSwift/jdcloud-sdk-swift-github/JDCloudSDKSwift/Sources/JDCloudSDKOss/API/ListBucketsResult.swift /Users/lishijun1/Documents/swiftworkspace/JDCloudSDKSwift/jdcloud-sdk-swift-github/JDCloudSDKSwift/Sources/JDCloudSDKOss/API/HeadBucketResult.swift /Users/lishijun1/Documents/swiftworkspace/JDCloudSDKSwift/jdcloud-sdk-swift-github/JDCloudSDKSwift/Sources/JDCloudSDKOss/API/DeleteBucketResult.swift /Users/lishijun1/Documents/swiftworkspace/JDCloudSDKSwift/jdcloud-sdk-swift-github/JDCloudSDKSwift/Sources/JDCloudSDKOss/API/PutBucketResult.swift /Users/lishijun1/Documents/swiftworkspace/JDCloudSDKSwift/jdcloud-sdk-swift-github/JDCloudSDKSwift/Sources/JDCloudSDKOss/Client/OssClient.swift /Users/lishijun1/Documents/swiftworkspace/JDCloudSDKSwift/jdcloud-sdk-swift-github/JDCloudSDKSwift/Sources/JDCloudSDKOss/API/ListBucketsRequest.swift /Users/lishijun1/Documents/swiftworkspace/JDCloudSDKSwift/jdcloud-sdk-swift-github/JDCloudSDKSwift/Sources/JDCloudSDKOss/API/HeadBucketRequest.swift /Users/lishijun1/Documents/swiftworkspace/JDCloudSDKSwift/jdcloud-sdk-swift-github/JDCloudSDKSwift/Sources/JDCloudSDKOss/API/DeleteBucketRequest.swift /Users/lishijun1/Documents/swiftworkspace/JDCloudSDKSwift/jdcloud-sdk-swift-github/JDCloudSDKSwift/Sources/JDCloudSDKOss/API/PutBucketRequest.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/ObjectiveC.swiftmodule /Users/lishijun1/Documents/swiftworkspace/JDCloudSDKSwift/jdcloud-sdk-swift-github/JDCloudSDKSwift/.build/x86_64-apple-macosx10.10/debug/JDCloudSDKCore.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 /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
/** * Contains all implicitly declared types and variables. * * Copyright: Copyright Digital Mars 2000 - 2011. * License: <a href="http://www.boost.org/LICENSE_1_0.txt">Boost License 1.0</a>. * Authors: Walter Bright, Sean Kelly * * Copyright Digital Mars 2000 - 2011. * Distributed under the Boost Software License, Version 1.0. * (See accompanying file LICENSE or copy at * http://www.boost.org/LICENSE_1_0.txt) */ module object; private { extern(C) void rt_finalize(void *ptr, bool det=true); } alias typeof(int.sizeof) size_t; alias typeof(cast(void*)0 - cast(void*)0) ptrdiff_t; alias ptrdiff_t sizediff_t; //For backwards compatibility only. alias size_t hash_t; //For backwards compatibility only. alias bool equals_t; //For backwards compatibility only. alias immutable(char)[] string; alias immutable(wchar)[] wstring; alias immutable(dchar)[] dstring; class Object { string toString(); size_t toHash() @trusted nothrow; int opCmp(Object o); bool opEquals(Object o); bool opEquals(Object lhs, Object rhs); interface Monitor { void lock(); void unlock(); } static Object factory(string classname); } bool opEquals(const Object lhs, const Object rhs); bool opEquals(Object lhs, Object rhs); //bool opEquals(TypeInfo lhs, TypeInfo rhs); void setSameMutex(shared Object ownee, shared Object owner); struct Interface { TypeInfo_Class classinfo; void*[] vtbl; ptrdiff_t offset; // offset to Interface 'this' from Object 'this' } struct OffsetTypeInfo { size_t offset; TypeInfo ti; } class TypeInfo { size_t getHash(in void* p) @trusted nothrow const; bool equals(in void* p1, in void* p2) const; int compare(in void* p1, in void* p2) const; @property size_t tsize() nothrow pure const @safe; void swap(void* p1, void* p2) const; @property const(TypeInfo) next() nothrow pure const; const(void)[] init() nothrow pure const @safe; // TODO: make this a property, but may need to be renamed to diambiguate with T.init... @property uint flags() nothrow pure const @safe; // 1: // has possible pointers into GC memory const(OffsetTypeInfo)[] offTi() const; void destroy(void* p) const; void postblit(void* p) const; @property size_t talign() nothrow pure const @safe; version (X86_64) int argTypes(out TypeInfo arg1, out TypeInfo arg2) @safe nothrow; @property immutable(void)* rtInfo() nothrow pure const @safe; } class TypeInfo_Typedef : TypeInfo { TypeInfo base; string name; void[] m_init; } class TypeInfo_Enum : TypeInfo_Typedef { } class TypeInfo_Pointer : TypeInfo { TypeInfo m_next; } class TypeInfo_Array : TypeInfo { override string toString() const; override bool opEquals(Object o); override size_t getHash(in void* p) @trusted const; override bool equals(in void* p1, in void* p2) const; override int compare(in void* p1, in void* p2) const; override @property size_t tsize() nothrow pure const; override void swap(void* p1, void* p2) const; override @property const(TypeInfo) next() nothrow pure const; override @property uint flags() nothrow pure const; override @property size_t talign() nothrow pure const; version (X86_64) override int argTypes(out TypeInfo arg1, out TypeInfo arg2); TypeInfo value; } class TypeInfo_Vector : TypeInfo { TypeInfo base; } class TypeInfo_StaticArray : TypeInfo { TypeInfo value; size_t len; } class TypeInfo_AssociativeArray : TypeInfo { TypeInfo value; TypeInfo key; TypeInfo impl; } class TypeInfo_Function : TypeInfo { TypeInfo next; string deco; } class TypeInfo_Delegate : TypeInfo { TypeInfo next; string deco; } class TypeInfo_Class : TypeInfo { @property auto info() @safe nothrow pure const { return this; } @property auto typeinfo() @safe nothrow pure const { return this; } byte[] init; // class static initializer string name; // class name void*[] vtbl; // virtual function pointer table Interface[] interfaces; TypeInfo_Class base; void* destructor; void function(Object) classInvariant; uint m_flags; // 1: // is IUnknown or is derived from IUnknown // 2: // has no possible pointers into GC memory // 4: // has offTi[] member // 8: // has constructors // 16: // has xgetMembers member // 32: // has typeinfo member void* deallocator; OffsetTypeInfo[] m_offTi; void* defaultConstructor; immutable(void)* m_rtInfo; // data for precise GC static const(TypeInfo_Class) find(in char[] classname); Object create() const; } alias TypeInfo_Class ClassInfo; class TypeInfo_Interface : TypeInfo { ClassInfo info; } class TypeInfo_Struct : TypeInfo { string name; void[] m_init; @safe pure nothrow { uint function(in void*) xtoHash; bool function(in void*, in void*) xopEquals; int function(in void*, in void*) xopCmp; string function(in void*) xtoString; uint m_flags; } void function(void*) xdtor; void function(void*) xpostblit; uint m_align; version (X86_64) { TypeInfo m_arg1; TypeInfo m_arg2; } immutable(void)* m_rtInfo; } class TypeInfo_Tuple : TypeInfo { TypeInfo[] elements; } class TypeInfo_Const : TypeInfo { TypeInfo next; } class TypeInfo_Invariant : TypeInfo_Const { } class TypeInfo_Shared : TypeInfo_Const { } class TypeInfo_Inout : TypeInfo_Const { } abstract class MemberInfo { @property string name() nothrow pure; } class MemberInfo_field : MemberInfo { this(string name, TypeInfo ti, size_t offset); override @property string name() nothrow pure; @property TypeInfo typeInfo() nothrow pure; @property size_t offset() nothrow pure; } class MemberInfo_function : MemberInfo { enum { Virtual = 1, Member = 2, Static = 4, } this(string name, TypeInfo ti, void* fp, uint flags); override @property string name() nothrow pure; @property TypeInfo typeInfo() nothrow pure; @property void* fp() nothrow pure; @property uint flags() nothrow pure; } struct ModuleInfo { struct New { uint flags; uint index; } struct Old { string name; ModuleInfo*[] importedModules; TypeInfo_Class[] localClasses; uint flags; void function() ctor; void function() dtor; void function() unitTest; void* xgetMembers; void function() ictor; void function() tlsctor; void function() tlsdtor; uint index; void*[1] reserved; } union { New n; Old o; } @property bool isNew() nothrow pure; @property uint index() nothrow pure; @property void index(uint i) nothrow pure; @property uint flags() nothrow pure; @property void flags(uint f) nothrow pure; @property void function() tlsctor() nothrow pure; @property void function() tlsdtor() nothrow pure; @property void* xgetMembers() nothrow pure; @property void function() ctor() nothrow pure; @property void function() dtor() nothrow pure; @property void function() ictor() nothrow pure; @property void function() unitTest() nothrow pure; @property ModuleInfo*[] importedModules() nothrow pure; @property TypeInfo_Class[] localClasses() nothrow pure; @property string name() nothrow pure; static int opApply(scope int delegate(ref ModuleInfo*) dg); } class Throwable : Object { interface TraceInfo { int opApply(scope int delegate(ref const(char[]))) const; int opApply(scope int delegate(ref size_t, ref const(char[]))) const; string toString() const; } string msg; string file; size_t line; TraceInfo info; Throwable next; @safe pure nothrow this(string msg, Throwable next = null); @safe pure nothrow this(string msg, string file, size_t line, Throwable next = null); override string toString(); } class Exception : Throwable { @safe pure nothrow this(string msg, string file = __FILE__, size_t line = __LINE__, Throwable next = null) { super(msg, file, line, next); } @safe pure nothrow this(string msg, Throwable next, string file = __FILE__, size_t line = __LINE__) { super(msg, file, line, next); } } class Error : Throwable { @safe pure nothrow this(string msg, Throwable next = null) { super(msg, next); bypassedException = null; } @safe pure nothrow this(string msg, string file, size_t line, Throwable next = null) { super(msg, file, line, next); bypassedException = null; } Throwable bypassedException; } extern (C) { // from druntime/src/compiler/dmd/aaA.d size_t _aaLen(void* p); void* _aaGet(void** pp, TypeInfo keyti, size_t valuesize, ...); void* _aaGetRvalue(void* p, TypeInfo keyti, size_t valuesize, ...); void* _aaIn(void* p, TypeInfo keyti); void _aaDel(void* p, TypeInfo keyti, ...); void[] _aaValues(void* p, size_t keysize, size_t valuesize); void[] _aaKeys(void* p, size_t keysize); void* _aaRehash(void** pp, TypeInfo keyti); extern (D) alias scope int delegate(void *) _dg_t; int _aaApply(void* aa, size_t keysize, _dg_t dg); extern (D) alias scope int delegate(void *, void *) _dg2_t; int _aaApply2(void* aa, size_t keysize, _dg2_t dg); void* _d_assocarrayliteralT(TypeInfo_AssociativeArray ti, size_t length, ...); } struct AssociativeArray(Key, Value) { private: // Duplicates of the stuff found in druntime/src/rt/aaA.d struct Slot { Slot *next; size_t hash; Key key; Value value; } struct Hashtable { Slot*[] b; size_t nodes; TypeInfo keyti; Slot*[4] binit; } void* p; // really Hashtable* struct Range { // State Slot*[] slots; Slot* current; this(void * aa) { if (!aa) return; auto pImpl = cast(Hashtable*) aa; slots = pImpl.b; nextSlot(); } void nextSlot() { foreach (i, slot; slots) { if (!slot) continue; current = slot; slots = slots.ptr[i .. slots.length]; break; } } public: @property bool empty() const { return current is null; } @property ref inout(Slot) front() inout { assert(current); return *current; } void popFront() { assert(current); current = current.next; if (!current) { slots = slots[1 .. $]; nextSlot(); } } } public: @property size_t length() { return _aaLen(p); } Value[Key] rehash() @property { auto p = _aaRehash(&p, typeid(Value[Key])); return *cast(Value[Key]*)(&p); } Value[] values() @property { auto a = _aaValues(p, Key.sizeof, Value.sizeof); return *cast(Value[]*) &a; } Key[] keys() @property { auto a = _aaKeys(p, Key.sizeof); return *cast(Key[]*) &a; } int opApply(scope int delegate(ref Key, ref Value) dg) { return _aaApply2(p, Key.sizeof, cast(_dg2_t)dg); } int opApply(scope int delegate(ref Value) dg) { return _aaApply(p, Key.sizeof, cast(_dg_t)dg); } Value get(Key key, lazy Value defaultValue) { auto p = key in *cast(Value[Key]*)(&p); return p ? *p : defaultValue; } static if (is(typeof({ Value[Key] r; r[Key.init] = Value.init; }()))) @property Value[Key] dup() { Value[Key] result; foreach (k, v; this) { result[k] = v; } return result; } @property auto byKey() { static struct Result { Range state; this(void* p) { state = Range(p); } @property ref Key front() { return state.front.key; } alias state this; } return Result(p); } @property auto byValue() { static struct Result { Range state; this(void* p) { state = Range(p); } @property ref Value front() { return state.front.value; } alias state this; } return Result(p); } } unittest { auto a = [ 1:"one", 2:"two", 3:"three" ]; auto b = a.dup; assert(b == [ 1:"one", 2:"two", 3:"three" ]); } // Scheduled for deprecation in December 2012. // Please use destroy instead of clear. alias destroy clear; void destroy(T)(T obj) if (is(T == class)) { rt_finalize(cast(void*)obj); } void destroy(T)(T obj) if (is(T == interface)) { destroy(cast(Object)obj); } void destroy(T)(ref T obj) if (is(T == struct)) { typeid(T).destroy(&obj); auto buf = (cast(ubyte*) &obj)[0 .. T.sizeof]; auto init = cast(ubyte[])typeid(T).init(); if(init.ptr is null) // null ptr means initialize to 0s buf[] = 0; else buf[] = init[]; } void destroy(T : U[n], U, size_t n)(ref T obj) { obj = T.init; } void destroy(T)(ref T obj) if (!is(T == struct) && !is(T == interface) && !is(T == class) && !_isStaticArray!T) { obj = T.init; } template _isStaticArray(T : U[N], U, size_t N) { enum bool _isStaticArray = true; } template _isStaticArray(T) { enum bool _isStaticArray = false; } private { extern (C) void _d_arrayshrinkfit(TypeInfo ti, void[] arr); extern (C) size_t _d_arraysetcapacity(TypeInfo ti, size_t newcapacity, void *arrptr) pure nothrow; } @property size_t capacity(T)(T[] arr) pure nothrow { return _d_arraysetcapacity(typeid(T[]), 0, cast(void *)&arr); } size_t reserve(T)(ref T[] arr, size_t newcapacity) pure nothrow { return _d_arraysetcapacity(typeid(T[]), newcapacity, cast(void *)&arr); } void assumeSafeAppend(T)(T[] arr) { _d_arrayshrinkfit(typeid(T[]), *(cast(void[]*)&arr)); } bool _ArrayEq(T1, T2)(T1[] a1, T2[] a2) { if (a1.length != a2.length) return false; foreach(i, a; a1) { if (a != a2[i]) return false; } return true; } bool _xopEquals(in void* ptr, in void* ptr); void __ctfeWrite(T...)(auto ref T) {} void __ctfeWriteln(T...)(auto ref T values) { __ctfeWrite(values, "\n"); } template RTInfo(T) { enum RTInfo = cast(void*)0x12345678; } version (unittest) { string __unittest_toString(T)(ref T value) pure nothrow @trusted { static if (is(T == string)) return `"` ~ value ~ `"`; // TODO: Escape internal double-quotes. else { version (druntime_unittest) { return T.stringof; } else { enum phobos_impl = q{ import std.traits; alias Unqual!T U; static if (isFloatingPoint!U) { import std.string; enum format_string = is(U == float) ? "%.7g" : is(U == double) ? "%.16g" : "%.20g"; return (cast(string function(...) pure nothrow @safe)&format)(format_string, value); } else { import std.conv; alias to!string toString; alias toString!T f; return (cast(string function(T) pure nothrow @safe)&f)(value); } }; enum tango_impl = q{ import tango.util.Convert; alias to!(string, T) f; return (cast(string function(T) pure nothrow @safe)&f)(value); }; static if (__traits(compiles, { mixin(phobos_impl); })) mixin(phobos_impl); else static if (__traits(compiles, { mixin(tango_impl); })) mixin(tango_impl); else return T.stringof; } } } }
D
func int _IsBetween(var int a, var int b, var int c) //zReal, zReal, zReal { if ((lf(a, c) && lf(c, b)) || (lf(b, c) && lf(c, a))) // (a < c) и (c < b) или (b < c) & (c < a) { return TRUE; }; return FALSE; }; func int _IsNear(var int a, var int b) //zReal, zReal { if (lf(subf(a, b), mkf(50)) && gf(subf(a, b), mkf(-50))) //(a - b < 50) && (a - b > -50) { return TRUE; }; return FALSE; }; // занята ли уже эта позиция итемом // проверка по bbox3D func int C_CheckItemFreePos(var int x, var int y, var int z) //zReal, zReal, zReal { var zCListSort ItmList; ItmList = _^(MEM_World.voblist_items); //zCListSort var int loop; loop = MEM_StackPos.position; if (ItmList.data) { var zCVob itm; itm = _^(ItmList.data); if (_IsNear(itm.trafoObjToWorld[3], x) && _IsNear(itm.trafoObjToWorld[7], y) && _IsNear(itm.trafoObjToWorld[11], z)) { // MEM_Debug(ConcatStrings("SP isnt free ", itm._zCObject_objectName)); // MEM_Debug(CS5(toStringf(itm.trafoObjToWorld[3]),",",toStringf(itm.trafoObjToWorld[7]),",",toStringf(itm.trafoObjToWorld[11]))); // MEM_Debug(CS5(toStringf(x),",",toStringf(y),",",toStringf(z))); return FALSE; }; }; if (ItmList.next) { ItmList = _^(ItmList.next); MEM_StackPos.position = loop; }; return TRUE; };
D