code stringlengths 3 10M | language stringclasses 31 values |
|---|---|
/*
* Copyright (c) 2017-2019 sel-project
*
* 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 OR COPYRIGHT HOLDERS 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.
*
*/
/**
* Copyright: Copyright (c) 2017-2019 sel-project
* License: MIT
* Authors: Kripth
* Source: $(HTTP github.com/sel-project/selery/source/selery/plugin.d, selery/plugin.d)
*/
module selery.plugin;
import core.atomic : atomicOp;
import selery.about;
import selery.lang : Translatable;
private shared uint _id;
/**
* Informations about a plugin and registration-related
* utilities.
*/
class Plugin {
public immutable uint id;
/**
* Plugin's name as declared in plugin.toml.
*/
public immutable string name;
/**
* Plugin's absolute path, used to load plugin'a assets.
*/
public immutable string path;
/**
* Plugin's authors as declared in plugin.toml.
*/
public immutable string[] authors;
/**
* Plugin's version.
*/
public immutable string version_;
/**
* Indicates whether the plugin has a main class.
*/
public immutable bool main;
public void delegate()[] onstart, onreload, onstop;
public this(string name, string path, string[] authors, string version_, bool main) {
assert(version_.length);
this.id = atomicOp!"+="(_id, 1);
this.name = name;
this.path = path;
this.authors = authors.idup;
this.version_ = version_;
this.main = main;
}
}
// attributes for main classes
enum start;
enum reload;
enum stop;
// attributes for events
enum event;
enum global;
enum inherit;
enum cancel;
struct Description {
enum : ubyte {
EMPTY,
TEXT,
TRANSLATABLE
}
public ubyte type = EMPTY;
union {
string text;
Translatable translatable;
}
this(string text) {
this.type = TEXT;
this.text = text;
}
this(Translatable translatable) {
this.type = TRANSLATABLE;
this.translatable = translatable;
}
}
// attributes for commands
struct command {
string command;
string[] aliases;
Description description;
public this(string command, string[] aliases=[], Description description=Description.init) {
this.command = command;
this.aliases = aliases;
this.description = description;
}
public this(string command, string[] aliases, string description) {
this(command, aliases, Description(description));
}
public this(string command, string[] aliases, Translatable description) {
this(command, aliases, Description(description));
}
public this(string command, string description) {
this(command, [], description);
}
public this(string command, Translatable description) {
this(command, [], description);
}
}
struct permissionLevel { ubyte permissionLevel; }
enum op = permissionLevel(1);
struct permission { string[] permissions; this(string[] permissions...){ this.permissions = permissions; } }
alias permissions = permission;
enum hidden;
enum unimplemented;
void loadPluginAttributes(bool main, EventBase, GlobalEventBase, bool inheritance, CommandBase, bool tasks, T, S)(T class_, Plugin plugin, S storage) {
enum bool events = !is(typeof(EventBase) == bool);
enum bool globals = !is(typeof(GlobalEventBase) == bool);
enum bool commands = !is(typeof(CommandBase) == bool);
import std.traits : getSymbolsByUDA, hasUDA, getUDAs, Parameters;
foreach(member ; __traits(allMembers, T)) {
static if(is(typeof(__traits(getMember, T, member)) == function)) { //TODO must be public and not a template
mixin("alias F = T." ~ member ~ ";");
enum del = "&class_." ~ member;
// start/stop
static if(main) {
static if(hasUDA!(F, start) && Parameters!F.length == 0) {
plugin.onstart ~= mixin(del);
}
static if(hasUDA!(F, reload) && Parameters!F.length == 0) {
plugin.onreload ~= mixin(del);
}
static if(hasUDA!(F, stop) && Parameters!F.length == 0) {
plugin.onstop ~= mixin(del);
}
}
// events
enum isValid(E) = is(Parameters!F[0] == interface) || is(Parameters!F[0] : E);
static if(events && Parameters!F.length == 1 && ((events && hasUDA!(F, event) && isValid!EventBase) || (globals && hasUDA!(F, global) && isValid!GlobalEventBase))) {
static if(hasUDA!(F, cancel)) {
//TODO event must be cancellable
auto ev = delegate(Parameters!F[0] e){ e.cancel(); };
} else {
auto ev = mixin(del);
}
static if(events && hasUDA!(F, event)) {
storage.addEventListener(ev);
}
static if(globals && hasUDA!(F, global)) {
(cast()storage.globalListener).addEventListener(ev);
}
}
// commands
static if(commands && hasUDA!(F, command) && Parameters!F.length >= 1 && is(Parameters!F[0] : CommandBase)) {
enum c = getUDAs!(F, command)[0];
static if(hasUDA!(F, permissionLevel)) enum pl = getUDAs!(F, permissionLevel)[0].permissionLevel;
else enum ubyte pl = 0;
static if(hasUDA!(F, permission)) enum p = getUDAs!(F, permission)[0].permissions;
else enum string[] p = [];
storage.registerCommand!F(mixin(del), c.command, c.description, c.aliases, pl, p, hasUDA!(F, hidden), !hasUDA!(F, unimplemented));
}
}
}
}
| D |
/*
* Copyright 2015-2018 HuntLabs.cn
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
module hunt.sql.ast.statement.SQLTableSourceImpl;
import hunt.collection;
import hunt.sql.SQLUtils;
import hunt.sql.ast.SQLExpr;
import hunt.sql.ast.SQLHint;
import hunt.sql.ast.SQLObjectImpl;
import hunt.sql.util.FnvHash;
import hunt.sql.ast.statement.SQLColumnDefinition;
import hunt.sql.ast.statement.SQLTableSource;
public abstract class SQLTableSourceImpl : SQLObjectImpl , SQLTableSource {
protected string _alias;
protected List!SQLHint hints;
protected SQLExpr flashback;
protected long aliasHashCod64;
public this(){
}
public this(string alias_p){
this._alias = alias_p;
}
public string getAlias() {
return this._alias;
}
public void setAlias(string alias_p) {
this._alias = alias_p;
this.aliasHashCod64 = 0L;
}
public int getHintsSize() {
if (hints is null) {
return 0;
}
return hints.size();
}
public List!SQLHint getHints() {
if (hints is null) {
hints = new ArrayList!SQLHint(2);
}
return hints;
}
public void setHints(List!SQLHint hints) {
this.hints = hints;
}
override public SQLTableSource clone() {
throw new Exception(typeof(this).stringof);
}
public string computeAlias() {
return _alias;
}
public SQLExpr getFlashback() {
return flashback;
}
public void setFlashback(SQLExpr flashback) {
if (flashback !is null) {
flashback.setParent(this);
}
this.flashback = flashback;
}
public bool containsAlias(string alias_p) {
if (SQLUtils.nameEquals(this._alias, alias_p)) {
return true;
}
return false;
}
public long aliasHashCode64() {
if (aliasHashCod64 == 0
&& _alias !is null) {
aliasHashCod64 = FnvHash.hashCode64(_alias);
}
return aliasHashCod64;
}
public SQLColumnDefinition findColumn(string columnName) {
if (columnName is null) {
return null;
}
long hash = FnvHash.hashCode64(_alias);
return findColumn(hash);
}
public SQLColumnDefinition findColumn(long columnNameHash) {
return null;
}
public SQLTableSource findTableSourceWithColumn(string columnName) {
if (columnName is null) {
return null;
}
long hash = FnvHash.hashCode64(_alias);
return findTableSourceWithColumn(hash);
}
public SQLTableSource findTableSourceWithColumn(long columnNameHash) {
return null;
}
public SQLTableSource findTableSource(string alias_p) {
long hash = FnvHash.hashCode64(alias_p);
return findTableSource(hash);
}
public SQLTableSource findTableSource(long alias_hash) {
long hash = this.aliasHashCode64();
if (hash != 0 && hash == alias_hash) {
return this;
}
return null;
}
}
| D |
// betterC code style
import mir.ndslice.slice: sliced;
import mir.ndslice.topology: canonical;
import mir.lapack: gesv, lapackint;
// column major storage
__gshared double[9] a = [
1.0, 2, -1,
-1.0, 2, 5,
1.0, -4, 0];
// ditto
__gshared double[6] b = [
2.0, -6, 9,
0 , -6, 1];
// ditto
__gshared double[6] t = [
1.0, 2, 3,
-1.0, 0, 1];
__gshared lapackint[3] ipiv = [0, 0, 0];
// nothrow @nogc extern(C)
int main()
{
// Canonical kind is required
auto as = a[].sliced(3, 3).canonical;
auto bs = b[].sliced(2, 3).canonical;
auto ts = b[].sliced(2, 3).canonical;
auto ipivs = ipiv[].sliced(3);
// Solve systems of linear equations AX = B for X.
// X stores in B
auto info = gesv(as, ipivs, bs);
if (info)
return cast(int)(info << 1);
// Check result
if (bs != ts)
return 1;
// OK
return 0;
}
| D |
/Users/kareemismail/XCodeProjects/FM2Apps/Movie/build/Pods.build/Debug-iphonesimulator/Alamofire.build/Objects-normal/x86_64/SessionDelegate.o : /Users/kareemismail/XCodeProjects/FM2Apps/Movie/Pods/Alamofire/Source/MultipartFormData.swift /Users/kareemismail/XCodeProjects/FM2Apps/Movie/Pods/Alamofire/Source/Timeline.swift /Users/kareemismail/XCodeProjects/FM2Apps/Movie/Pods/Alamofire/Source/DispatchQueue+Alamofire.swift /Users/kareemismail/XCodeProjects/FM2Apps/Movie/Pods/Alamofire/Source/Alamofire.swift /Users/kareemismail/XCodeProjects/FM2Apps/Movie/Pods/Alamofire/Source/Response.swift /Users/kareemismail/XCodeProjects/FM2Apps/Movie/Pods/Alamofire/Source/TaskDelegate.swift /Users/kareemismail/XCodeProjects/FM2Apps/Movie/Pods/Alamofire/Source/SessionDelegate.swift /Users/kareemismail/XCodeProjects/FM2Apps/Movie/Pods/Alamofire/Source/ParameterEncoding.swift /Users/kareemismail/XCodeProjects/FM2Apps/Movie/Pods/Alamofire/Source/Validation.swift /Users/kareemismail/XCodeProjects/FM2Apps/Movie/Pods/Alamofire/Source/ResponseSerialization.swift /Users/kareemismail/XCodeProjects/FM2Apps/Movie/Pods/Alamofire/Source/SessionManager.swift /Users/kareemismail/XCodeProjects/FM2Apps/Movie/Pods/Alamofire/Source/NetworkReachabilityManager.swift /Users/kareemismail/XCodeProjects/FM2Apps/Movie/Pods/Alamofire/Source/AFError.swift /Users/kareemismail/XCodeProjects/FM2Apps/Movie/Pods/Alamofire/Source/Notifications.swift /Users/kareemismail/XCodeProjects/FM2Apps/Movie/Pods/Alamofire/Source/Result.swift /Users/kareemismail/XCodeProjects/FM2Apps/Movie/Pods/Alamofire/Source/Request.swift /Users/kareemismail/XCodeProjects/FM2Apps/Movie/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/kareemismail/XCodeProjects/FM2Apps/Movie/Pods/Target\ Support\ Files/Alamofire/Alamofire-umbrella.h /Users/kareemismail/XCodeProjects/FM2Apps/Movie/build/Pods.build/Debug-iphonesimulator/Alamofire.build/unextended-module.modulemap /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.4.sdk/usr/include/objc/ObjectiveC.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.4.sdk/System/Library/Frameworks/OpenGLES.framework/Headers/OpenGLES.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.4.sdk/System/Library/Frameworks/CoreImage.framework/Headers/CoreImage.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.4.sdk/System/Library/Frameworks/QuartzCore.framework/Headers/QuartzCore.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.4.sdk/System/Library/Frameworks/Metal.framework/Headers/Metal.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.4.sdk/usr/include/Darwin.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.4.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.4.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.4.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIKit.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.4.sdk/System/Library/Frameworks/CoreText.framework/Headers/CoreText.apinotes
/Users/kareemismail/XCodeProjects/FM2Apps/Movie/build/Pods.build/Debug-iphonesimulator/Alamofire.build/Objects-normal/x86_64/SessionDelegate~partial.swiftmodule : /Users/kareemismail/XCodeProjects/FM2Apps/Movie/Pods/Alamofire/Source/MultipartFormData.swift /Users/kareemismail/XCodeProjects/FM2Apps/Movie/Pods/Alamofire/Source/Timeline.swift /Users/kareemismail/XCodeProjects/FM2Apps/Movie/Pods/Alamofire/Source/DispatchQueue+Alamofire.swift /Users/kareemismail/XCodeProjects/FM2Apps/Movie/Pods/Alamofire/Source/Alamofire.swift /Users/kareemismail/XCodeProjects/FM2Apps/Movie/Pods/Alamofire/Source/Response.swift /Users/kareemismail/XCodeProjects/FM2Apps/Movie/Pods/Alamofire/Source/TaskDelegate.swift /Users/kareemismail/XCodeProjects/FM2Apps/Movie/Pods/Alamofire/Source/SessionDelegate.swift /Users/kareemismail/XCodeProjects/FM2Apps/Movie/Pods/Alamofire/Source/ParameterEncoding.swift /Users/kareemismail/XCodeProjects/FM2Apps/Movie/Pods/Alamofire/Source/Validation.swift /Users/kareemismail/XCodeProjects/FM2Apps/Movie/Pods/Alamofire/Source/ResponseSerialization.swift /Users/kareemismail/XCodeProjects/FM2Apps/Movie/Pods/Alamofire/Source/SessionManager.swift /Users/kareemismail/XCodeProjects/FM2Apps/Movie/Pods/Alamofire/Source/NetworkReachabilityManager.swift /Users/kareemismail/XCodeProjects/FM2Apps/Movie/Pods/Alamofire/Source/AFError.swift /Users/kareemismail/XCodeProjects/FM2Apps/Movie/Pods/Alamofire/Source/Notifications.swift /Users/kareemismail/XCodeProjects/FM2Apps/Movie/Pods/Alamofire/Source/Result.swift /Users/kareemismail/XCodeProjects/FM2Apps/Movie/Pods/Alamofire/Source/Request.swift /Users/kareemismail/XCodeProjects/FM2Apps/Movie/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/kareemismail/XCodeProjects/FM2Apps/Movie/Pods/Target\ Support\ Files/Alamofire/Alamofire-umbrella.h /Users/kareemismail/XCodeProjects/FM2Apps/Movie/build/Pods.build/Debug-iphonesimulator/Alamofire.build/unextended-module.modulemap /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.4.sdk/usr/include/objc/ObjectiveC.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.4.sdk/System/Library/Frameworks/OpenGLES.framework/Headers/OpenGLES.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.4.sdk/System/Library/Frameworks/CoreImage.framework/Headers/CoreImage.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.4.sdk/System/Library/Frameworks/QuartzCore.framework/Headers/QuartzCore.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.4.sdk/System/Library/Frameworks/Metal.framework/Headers/Metal.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.4.sdk/usr/include/Darwin.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.4.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.4.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.4.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIKit.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.4.sdk/System/Library/Frameworks/CoreText.framework/Headers/CoreText.apinotes
/Users/kareemismail/XCodeProjects/FM2Apps/Movie/build/Pods.build/Debug-iphonesimulator/Alamofire.build/Objects-normal/x86_64/SessionDelegate~partial.swiftdoc : /Users/kareemismail/XCodeProjects/FM2Apps/Movie/Pods/Alamofire/Source/MultipartFormData.swift /Users/kareemismail/XCodeProjects/FM2Apps/Movie/Pods/Alamofire/Source/Timeline.swift /Users/kareemismail/XCodeProjects/FM2Apps/Movie/Pods/Alamofire/Source/DispatchQueue+Alamofire.swift /Users/kareemismail/XCodeProjects/FM2Apps/Movie/Pods/Alamofire/Source/Alamofire.swift /Users/kareemismail/XCodeProjects/FM2Apps/Movie/Pods/Alamofire/Source/Response.swift /Users/kareemismail/XCodeProjects/FM2Apps/Movie/Pods/Alamofire/Source/TaskDelegate.swift /Users/kareemismail/XCodeProjects/FM2Apps/Movie/Pods/Alamofire/Source/SessionDelegate.swift /Users/kareemismail/XCodeProjects/FM2Apps/Movie/Pods/Alamofire/Source/ParameterEncoding.swift /Users/kareemismail/XCodeProjects/FM2Apps/Movie/Pods/Alamofire/Source/Validation.swift /Users/kareemismail/XCodeProjects/FM2Apps/Movie/Pods/Alamofire/Source/ResponseSerialization.swift /Users/kareemismail/XCodeProjects/FM2Apps/Movie/Pods/Alamofire/Source/SessionManager.swift /Users/kareemismail/XCodeProjects/FM2Apps/Movie/Pods/Alamofire/Source/NetworkReachabilityManager.swift /Users/kareemismail/XCodeProjects/FM2Apps/Movie/Pods/Alamofire/Source/AFError.swift /Users/kareemismail/XCodeProjects/FM2Apps/Movie/Pods/Alamofire/Source/Notifications.swift /Users/kareemismail/XCodeProjects/FM2Apps/Movie/Pods/Alamofire/Source/Result.swift /Users/kareemismail/XCodeProjects/FM2Apps/Movie/Pods/Alamofire/Source/Request.swift /Users/kareemismail/XCodeProjects/FM2Apps/Movie/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/kareemismail/XCodeProjects/FM2Apps/Movie/Pods/Target\ Support\ Files/Alamofire/Alamofire-umbrella.h /Users/kareemismail/XCodeProjects/FM2Apps/Movie/build/Pods.build/Debug-iphonesimulator/Alamofire.build/unextended-module.modulemap /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.4.sdk/usr/include/objc/ObjectiveC.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.4.sdk/System/Library/Frameworks/OpenGLES.framework/Headers/OpenGLES.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.4.sdk/System/Library/Frameworks/CoreImage.framework/Headers/CoreImage.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.4.sdk/System/Library/Frameworks/QuartzCore.framework/Headers/QuartzCore.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.4.sdk/System/Library/Frameworks/Metal.framework/Headers/Metal.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.4.sdk/usr/include/Darwin.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.4.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.4.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.4.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIKit.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.4.sdk/System/Library/Frameworks/CoreText.framework/Headers/CoreText.apinotes
| D |
/**
* D header file for POSIX.
*
* Copyright: Copyright Sean Kelly 2005 - 2009.
* License: $(HTTP www.boost.org/LICENSE_1_0.txt, Boost License 1.0).
* Authors: Sean Kelly, Alex Rønne Petersen
* Standards: The Open Group Base Specifications Issue 6, IEEE Std 1003.1, 2004 Edition
*/
/* Copyright Sean Kelly 2005 - 2009.
* 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 core.sys.posix.sys.socket;
private import core.sys.posix.config;
public import core.sys.posix.sys.types; // for ssize_t
public import core.sys.posix.sys.uio; // for iovec
version (OSX)
version = Darwin;
else version (iOS)
version = Darwin;
else version (TVOS)
version = Darwin;
else version (WatchOS)
version = Darwin;
version (ARM) version = ARM_Any;
version (AArch64) version = ARM_Any;
version (HPPA) version = HPPA_Any;
version (MIPS32) version = MIPS_Any;
version (MIPS64) version = MIPS_Any;
version (PPC) version = PPC_Any;
version (PPC64) version = PPC_Any;
version (RISCV32) version = RISCV_Any;
version (RISCV64) version = RISCV_Any;
version (S390) version = IBMZ_Any;
version (SPARC) version = SPARC_Any;
version (SPARC64) version = SPARC_Any;
version (SystemZ) version = IBMZ_Any;
version (X86) version = X86_Any;
version (X86_64) version = X86_Any;
version (Posix):
extern (C) nothrow @nogc:
@system:
//
// Required
//
/*
socklen_t
sa_family_t
struct sockaddr
{
sa_family_t sa_family;
char sa_data[];
}
struct sockaddr_storage
{
sa_family_t ss_family;
}
struct msghdr
{
void* msg_name;
socklen_t msg_namelen;
struct iovec* msg_iov;
int msg_iovlen;
void* msg_control;
socklen_t msg_controllen;
int msg_flags;
}
struct iovec {} // from core.sys.posix.sys.uio
struct cmsghdr
{
socklen_t cmsg_len;
int cmsg_level;
int cmsg_type;
}
SCM_RIGHTS
CMSG_DATA(cmsg)
CMSG_NXTHDR(mhdr,cmsg)
CMSG_FIRSTHDR(mhdr)
struct linger
{
int l_onoff;
int l_linger;
}
SOCK_DGRAM
SOCK_SEQPACKET
SOCK_STREAM
SOL_SOCKET
SO_ACCEPTCONN
SO_BROADCAST
SO_DEBUG
SO_DONTROUTE
SO_ERROR
SO_KEEPALIVE
SO_LINGER
SO_OOBINLINE
SO_RCVBUF
SO_RCVLOWAT
SO_RCVTIMEO
SO_REUSEADDR
SO_SNDBUF
SO_SNDLOWAT
SO_SNDTIMEO
SO_TYPE
SOMAXCONN
MSG_CTRUNC
MSG_DONTROUTE
MSG_EOR
MSG_OOB
MSG_PEEK
MSG_TRUNC
MSG_WAITALL
AF_INET
AF_UNIX
AF_UNSPEC
SHUT_RD
SHUT_RDWR
SHUT_WR
int accept(int, sockaddr*, socklen_t*);
int bind(int, const scope sockaddr*, socklen_t);
int connect(int, const scope sockaddr*, socklen_t);
int getpeername(int, sockaddr*, socklen_t*);
int getsockname(int, sockaddr*, socklen_t*);
int getsockopt(int, int, int, void*, socklen_t*);
int listen(int, int);
ssize_t recv(int, void*, size_t, int);
ssize_t recvfrom(int, void*, size_t, int, sockaddr*, socklen_t*);
ssize_t recvmsg(int, msghdr*, int);
ssize_t send(int, const scope void*, size_t, int);
ssize_t sendmsg(int, const scope msghdr*, int);
ssize_t sendto(int, const scope void*, size_t, int, const scope sockaddr*, socklen_t);
int setsockopt(int, int, int, const scope void*, socklen_t);
int shutdown(int, int);
int socket(int, int, int);
int sockatmark(int);
int socketpair(int, int, int, ref int[2]);
*/
version (CRuntime_Glibc)
{
// Some of the constants below and from the Bionic section are really from
// the linux kernel headers.
alias uint socklen_t;
alias ushort sa_family_t;
struct sockaddr
{
sa_family_t sa_family;
byte[14] sa_data;
}
private enum : size_t
{
_SS_SIZE = 128,
_SS_PADSIZE = _SS_SIZE - (c_ulong.sizeof * 2)
}
struct sockaddr_storage
{
sa_family_t ss_family;
c_ulong __ss_align;
byte[_SS_PADSIZE] __ss_padding;
}
struct msghdr
{
void* msg_name;
socklen_t msg_namelen;
iovec* msg_iov;
size_t msg_iovlen;
void* msg_control;
size_t msg_controllen;
int msg_flags;
}
struct cmsghdr
{
size_t cmsg_len;
int cmsg_level;
int cmsg_type;
static if ( false /* (!is( __STRICT_ANSI__ ) && __GNUC__ >= 2) || __STDC_VERSION__ >= 199901L */ )
{
ubyte[1] __cmsg_data;
}
}
enum : uint
{
SCM_RIGHTS = 0x01
}
static if ( false /* (!is( __STRICT_ANSI__ ) && __GNUC__ >= 2) || __STDC_VERSION__ >= 199901L */ )
{
extern (D) ubyte[1] CMSG_DATA( cmsghdr* cmsg ) pure nothrow @nogc { return cmsg.__cmsg_data; }
}
else
{
extern (D) inout(ubyte)* CMSG_DATA( return inout(cmsghdr)* cmsg ) pure nothrow @nogc { return cast(ubyte*)( cmsg + 1 ); }
}
private inout(cmsghdr)* __cmsg_nxthdr(inout(msghdr)*, inout(cmsghdr)*) pure nothrow @nogc;
extern (D) inout(cmsghdr)* CMSG_NXTHDR(inout(msghdr)* msg, inout(cmsghdr)* cmsg) pure nothrow @nogc
{
return __cmsg_nxthdr(msg, cmsg);
}
extern (D) inout(cmsghdr)* CMSG_FIRSTHDR( inout(msghdr)* mhdr ) pure nothrow @nogc
{
return ( cast(size_t)mhdr.msg_controllen >= cmsghdr.sizeof
? cast(inout(cmsghdr)*) mhdr.msg_control
: cast(inout(cmsghdr)*) null );
}
extern (D)
{
size_t CMSG_ALIGN( size_t len ) pure nothrow @nogc
{
return (len + size_t.sizeof - 1) & cast(size_t) (~(size_t.sizeof - 1));
}
size_t CMSG_LEN( size_t len ) pure nothrow @nogc
{
return CMSG_ALIGN(cmsghdr.sizeof) + len;
}
}
extern (D) size_t CMSG_SPACE(size_t len) pure nothrow @nogc
{
return CMSG_ALIGN(len) + CMSG_ALIGN(cmsghdr.sizeof);
}
struct linger
{
int l_onoff;
int l_linger;
}
version (X86_Any)
{
enum
{
SOCK_DGRAM = 2,
SOCK_SEQPACKET = 5,
SOCK_STREAM = 1
}
enum
{
SOL_SOCKET = 1
}
enum
{
SO_ACCEPTCONN = 30,
SO_BROADCAST = 6,
SO_DEBUG = 1,
SO_DONTROUTE = 5,
SO_ERROR = 4,
SO_KEEPALIVE = 9,
SO_LINGER = 13,
SO_OOBINLINE = 10,
SO_RCVBUF = 8,
SO_RCVLOWAT = 18,
SO_RCVTIMEO = 20,
SO_REUSEADDR = 2,
SO_REUSEPORT = 15,
SO_SNDBUF = 7,
SO_SNDLOWAT = 19,
SO_SNDTIMEO = 21,
SO_TYPE = 3
}
}
else version (HPPA_Any)
{
enum
{
SOCK_DGRAM = 2,
SOCK_SEQPACKET = 5,
SOCK_STREAM = 1,
}
enum
{
SOL_SOCKET = 0xffff
}
enum
{
SO_ACCEPTCONN = 0x401c,
SO_BROADCAST = 0x0020,
SO_DEBUG = 0x0001,
SO_DONTROUTE = 0x0010,
SO_ERROR = 0x1007,
SO_KEEPALIVE = 0x0008,
SO_LINGER = 0x0080,
SO_OOBINLINE = 0x0100,
SO_RCVBUF = 0x1002,
SO_RCVLOWAT = 0x1004,
SO_RCVTIMEO = 0x1006,
SO_REUSEADDR = 0x0004,
SO_SNDBUF = 0x1001,
SO_SNDLOWAT = 0x1003,
SO_SNDTIMEO = 0x1005,
SO_TYPE = 0x1008,
}
}
else version (MIPS_Any)
{
enum
{
SOCK_DGRAM = 1,
SOCK_SEQPACKET = 5,
SOCK_STREAM = 2,
}
enum
{
SOL_SOCKET = 0xffff
}
enum
{
SO_ACCEPTCONN = 0x1009,
SO_BROADCAST = 0x0020,
SO_DEBUG = 0x0001,
SO_DONTROUTE = 0x0010,
SO_ERROR = 0x1007,
SO_KEEPALIVE = 0x0008,
SO_LINGER = 0x0080,
SO_OOBINLINE = 0x0100,
SO_RCVBUF = 0x1002,
SO_RCVLOWAT = 0x1004,
SO_RCVTIMEO = 0x1006,
SO_REUSEADDR = 0x0004,
SO_SNDBUF = 0x1001,
SO_SNDLOWAT = 0x1003,
SO_SNDTIMEO = 0x1005,
SO_TYPE = 0x1008,
}
}
else version (PPC_Any)
{
enum
{
SOCK_DGRAM = 2,
SOCK_SEQPACKET = 5,
SOCK_STREAM = 1
}
enum
{
SOL_SOCKET = 1
}
enum
{
SO_ACCEPTCONN = 30,
SO_BROADCAST = 6,
SO_DEBUG = 1,
SO_DONTROUTE = 5,
SO_ERROR = 4,
SO_KEEPALIVE = 9,
SO_LINGER = 13,
SO_OOBINLINE = 10,
SO_RCVBUF = 8,
SO_RCVLOWAT = 16,
SO_RCVTIMEO = 18,
SO_REUSEADDR = 2,
SO_SNDBUF = 7,
SO_SNDLOWAT = 17,
SO_SNDTIMEO = 19,
SO_TYPE = 3
}
}
else version (ARM_Any)
{
enum
{
SOCK_DGRAM = 2,
SOCK_SEQPACKET = 5,
SOCK_STREAM = 1
}
enum
{
SOL_SOCKET = 1
}
enum
{
SO_ACCEPTCONN = 30,
SO_BROADCAST = 6,
SO_DEBUG = 1,
SO_DONTROUTE = 5,
SO_ERROR = 4,
SO_KEEPALIVE = 9,
SO_LINGER = 13,
SO_OOBINLINE = 10,
SO_RCVBUF = 8,
SO_RCVLOWAT = 18,
SO_RCVTIMEO = 20,
SO_REUSEADDR = 2,
SO_REUSEPORT = 15,
SO_SNDBUF = 7,
SO_SNDLOWAT = 19,
SO_SNDTIMEO = 21,
SO_TYPE = 3
}
}
else version (RISCV_Any)
{
enum
{
SOCK_DGRAM = 2,
SOCK_SEQPACKET = 5,
SOCK_STREAM = 1
}
enum
{
SOL_SOCKET = 1
}
enum
{
SO_ACCEPTCONN = 30,
SO_BROADCAST = 6,
SO_DEBUG = 1,
SO_DONTROUTE = 5,
SO_ERROR = 4,
SO_KEEPALIVE = 9,
SO_LINGER = 13,
SO_OOBINLINE = 10,
SO_RCVBUF = 8,
SO_RCVLOWAT = 18,
SO_RCVTIMEO = 20,
SO_REUSEADDR = 2,
SO_SNDBUF = 7,
SO_SNDLOWAT = 19,
SO_SNDTIMEO = 21,
SO_TYPE = 3
}
}
else version (SPARC_Any)
{
enum
{
SOCK_DGRAM = 2,
SOCK_SEQPACKET = 5,
SOCK_STREAM = 1
}
enum
{
SOL_SOCKET = 1
}
enum
{
SO_ACCEPTCONN = 30,
SO_BROADCAST = 6,
SO_DEBUG = 1,
SO_DONTROUTE = 5,
SO_ERROR = 4,
SO_KEEPALIVE = 9,
SO_LINGER = 13,
SO_OOBINLINE = 10,
SO_RCVBUF = 8,
SO_RCVLOWAT = 18,
SO_RCVTIMEO = 20,
SO_REUSEADDR = 2,
SO_SNDBUF = 7,
SO_SNDLOWAT = 19,
SO_SNDTIMEO = 21,
SO_TYPE = 3
}
}
else version (IBMZ_Any)
{
enum
{
SOCK_DGRAM = 2,
SOCK_SEQPACKET = 5,
SOCK_STREAM = 1
}
enum
{
SOL_SOCKET = 1
}
enum
{
SO_ACCEPTCONN = 30,
SO_BROADCAST = 6,
SO_DEBUG = 1,
SO_DONTROUTE = 5,
SO_ERROR = 4,
SO_KEEPALIVE = 9,
SO_LINGER = 13,
SO_OOBINLINE = 10,
SO_RCVBUF = 8,
SO_RCVLOWAT = 18,
SO_RCVTIMEO = 20,
SO_REUSEADDR = 2,
SO_SNDBUF = 7,
SO_SNDLOWAT = 19,
SO_SNDTIMEO = 21,
SO_TYPE = 3
}
}
else
static assert(0, "unimplemented");
enum
{
SOMAXCONN = 128
}
enum : uint
{
MSG_CTRUNC = 0x08,
MSG_DONTROUTE = 0x04,
MSG_EOR = 0x80,
MSG_OOB = 0x01,
MSG_PEEK = 0x02,
MSG_TRUNC = 0x20,
MSG_WAITALL = 0x100,
MSG_NOSIGNAL = 0x4000
}
enum
{
AF_APPLETALK = 5,
AF_INET = 2,
AF_IPX = 4,
AF_UNIX = 1,
AF_UNSPEC = 0,
PF_APPLETALK = AF_APPLETALK,
PF_IPX = AF_IPX
}
enum int SOCK_RDM = 4;
enum
{
SHUT_RD,
SHUT_WR,
SHUT_RDWR
}
int accept(int, scope sockaddr*, scope socklen_t*);
int bind(int, const scope sockaddr*, socklen_t);
int connect(int, const scope sockaddr*, socklen_t);
int getpeername(int, scope sockaddr*, scope socklen_t*);
int getsockname(int, scope sockaddr*, scope socklen_t*);
int getsockopt(int, int, int, scope void*, scope socklen_t*);
int listen(int, int) @safe;
ssize_t recv(int, scope void*, size_t, int);
ssize_t recvfrom(int, scope void*, size_t, int, scope sockaddr*, scope socklen_t*);
ssize_t recvmsg(int, scope msghdr*, int);
ssize_t send(int, const scope void*, size_t, int);
ssize_t sendmsg(int, const scope msghdr*, int);
ssize_t sendto(int, const scope void*, size_t, int, const scope sockaddr*, socklen_t);
int setsockopt(int, int, int, const scope void*, socklen_t);
int shutdown(int, int) @safe;
int socket(int, int, int) @safe;
int sockatmark(int) @safe;
int socketpair(int, int, int, ref int[2]) @safe;
}
else version (Darwin)
{
alias uint socklen_t;
alias ubyte sa_family_t;
struct sockaddr
{
ubyte sa_len;
sa_family_t sa_family;
byte[14] sa_data;
}
private enum : size_t
{
_SS_PAD1 = long.sizeof - ubyte.sizeof - sa_family_t.sizeof,
_SS_PAD2 = 128 - ubyte.sizeof - sa_family_t.sizeof - _SS_PAD1 - long.sizeof
}
struct sockaddr_storage
{
ubyte ss_len;
sa_family_t ss_family;
byte[_SS_PAD1] __ss_pad1;
long __ss_align;
byte[_SS_PAD2] __ss_pad2;
}
struct msghdr
{
void* msg_name;
socklen_t msg_namelen;
iovec* msg_iov;
int msg_iovlen;
void* msg_control;
socklen_t msg_controllen;
int msg_flags;
}
struct cmsghdr
{
socklen_t cmsg_len;
int cmsg_level;
int cmsg_type;
}
enum : uint
{
SCM_RIGHTS = 0x01
}
/+
CMSG_DATA(cmsg) ((unsigned char *)(cmsg) + \
ALIGN(sizeof(struct cmsghdr)))
CMSG_NXTHDR(mhdr, cmsg) \
(((unsigned char *)(cmsg) + ALIGN((cmsg)->cmsg_len) + \
ALIGN(sizeof(struct cmsghdr)) > \
(unsigned char *)(mhdr)->msg_control +(mhdr)->msg_controllen) ? \
(struct cmsghdr *)0 /* NULL */ : \
(struct cmsghdr *)((unsigned char *)(cmsg) + ALIGN((cmsg)->cmsg_len)))
CMSG_FIRSTHDR(mhdr) ((struct cmsghdr *)(mhdr)->msg_control)
+/
struct linger
{
int l_onoff;
int l_linger;
}
enum
{
SOCK_DGRAM = 2,
SOCK_RDM = 4,
SOCK_SEQPACKET = 5,
SOCK_STREAM = 1
}
enum : uint
{
SOL_SOCKET = 0xffff
}
enum : uint
{
SO_ACCEPTCONN = 0x0002,
SO_BROADCAST = 0x0020,
SO_DEBUG = 0x0001,
SO_DONTROUTE = 0x0010,
SO_ERROR = 0x1007,
SO_KEEPALIVE = 0x0008,
SO_LINGER = 0x1080,
SO_NOSIGPIPE = 0x1022, // non-standard
SO_OOBINLINE = 0x0100,
SO_RCVBUF = 0x1002,
SO_RCVLOWAT = 0x1004,
SO_RCVTIMEO = 0x1006,
SO_REUSEADDR = 0x0004,
SO_REUSEPORT = 0x0200,
SO_SNDBUF = 0x1001,
SO_SNDLOWAT = 0x1003,
SO_SNDTIMEO = 0x1005,
SO_TYPE = 0x1008
}
enum
{
SOMAXCONN = 128
}
enum : uint
{
MSG_CTRUNC = 0x20,
MSG_DONTROUTE = 0x4,
MSG_EOR = 0x8,
MSG_OOB = 0x1,
MSG_PEEK = 0x2,
MSG_TRUNC = 0x10,
MSG_WAITALL = 0x40
}
enum
{
AF_APPLETALK = 16,
AF_INET = 2,
AF_IPX = 23,
AF_UNIX = 1,
AF_UNSPEC = 0,
PF_APPLETALK = AF_APPLETALK,
PF_IPX = AF_IPX
}
enum
{
SHUT_RD,
SHUT_WR,
SHUT_RDWR
}
int accept(int, scope sockaddr*, scope socklen_t*);
int bind(int, const scope sockaddr*, socklen_t);
int connect(int, const scope sockaddr*, socklen_t);
int getpeername(int, scope sockaddr*, scope socklen_t*);
int getsockname(int, scope sockaddr*, scope socklen_t*);
int getsockopt(int, int, int, scope void*, scope socklen_t*);
int listen(int, int) @safe;
ssize_t recv(int, scope void*, size_t, int);
ssize_t recvfrom(int, scope void*, size_t, int, scope sockaddr*, scope socklen_t*);
ssize_t recvmsg(int, scope msghdr*, int);
ssize_t send(int, const scope void*, size_t, int);
ssize_t sendmsg(int, const scope msghdr*, int);
ssize_t sendto(int, const scope void*, size_t, int, const scope sockaddr*, socklen_t);
int setsockopt(int, int, int, const scope void*, socklen_t);
int shutdown(int, int) @safe;
int socket(int, int, int) @safe;
int sockatmark(int) @safe;
int socketpair(int, int, int, ref int[2]) @safe;
}
else version (FreeBSD)
{
alias uint socklen_t;
alias ubyte sa_family_t;
struct sockaddr
{
ubyte sa_len;
sa_family_t sa_family;
byte[14] sa_data;
}
private
{
enum _SS_ALIGNSIZE = long.sizeof;
enum _SS_MAXSIZE = 128;
enum _SS_PAD1SIZE = _SS_ALIGNSIZE - ubyte.sizeof - sa_family_t.sizeof;
enum _SS_PAD2SIZE = _SS_MAXSIZE - ubyte.sizeof - sa_family_t.sizeof - _SS_PAD1SIZE - _SS_ALIGNSIZE;
}
struct sockaddr_storage
{
ubyte ss_len;
sa_family_t ss_family;
byte[_SS_PAD1SIZE] __ss_pad1;
long __ss_align;
byte[_SS_PAD2SIZE] __ss_pad2;
}
struct msghdr
{
void* msg_name;
socklen_t msg_namelen;
iovec* msg_iov;
int msg_iovlen;
void* msg_control;
socklen_t msg_controllen;
int msg_flags;
}
struct cmsghdr
{
socklen_t cmsg_len;
int cmsg_level;
int cmsg_type;
}
enum : uint
{
SCM_RIGHTS = 0x01
}
private // <machine/param.h>
{
enum _ALIGNBYTES = /+c_int+/ int.sizeof - 1;
extern (D) size_t _ALIGN( size_t p ) { return (p + _ALIGNBYTES) & ~_ALIGNBYTES; }
}
extern (D) ubyte* CMSG_DATA( cmsghdr* cmsg )
{
return cast(ubyte*) cmsg + _ALIGN( cmsghdr.sizeof );
}
extern (D) cmsghdr* CMSG_NXTHDR( msghdr* mhdr, cmsghdr* cmsg )
{
if ( cmsg == null )
{
return CMSG_FIRSTHDR( mhdr );
}
else
{
if ( cast(ubyte*) cmsg + _ALIGN( cmsg.cmsg_len ) + _ALIGN( cmsghdr.sizeof ) >
cast(ubyte*) mhdr.msg_control + mhdr.msg_controllen )
return null;
else
return cast(cmsghdr*) (cast(ubyte*) cmsg + _ALIGN( cmsg.cmsg_len ));
}
}
extern (D) cmsghdr* CMSG_FIRSTHDR( msghdr* mhdr )
{
return mhdr.msg_controllen >= cmsghdr.sizeof ? cast(cmsghdr*) mhdr.msg_control : null;
}
struct linger
{
int l_onoff;
int l_linger;
}
enum
{
SOCK_DGRAM = 2,
SOCK_RDM = 4,
SOCK_SEQPACKET = 5,
SOCK_STREAM = 1
}
enum : uint
{
SOL_SOCKET = 0xffff
}
enum : uint
{
SO_ACCEPTCONN = 0x0002,
SO_BROADCAST = 0x0020,
SO_DEBUG = 0x0001,
SO_DONTROUTE = 0x0010,
SO_ERROR = 0x1007,
SO_KEEPALIVE = 0x0008,
SO_LINGER = 0x0080,
SO_NOSIGPIPE = 0x0800, // non-standard
SO_OOBINLINE = 0x0100,
SO_RCVBUF = 0x1002,
SO_RCVLOWAT = 0x1004,
SO_RCVTIMEO = 0x1006,
SO_REUSEADDR = 0x0004,
SO_REUSEPORT = 0x0200,
SO_SNDBUF = 0x1001,
SO_SNDLOWAT = 0x1003,
SO_SNDTIMEO = 0x1005,
SO_TYPE = 0x1008
}
enum
{
SOMAXCONN = 128
}
enum : uint
{
MSG_CTRUNC = 0x20,
MSG_DONTROUTE = 0x4,
MSG_EOR = 0x8,
MSG_OOB = 0x1,
MSG_PEEK = 0x2,
MSG_TRUNC = 0x10,
MSG_WAITALL = 0x40,
MSG_NOSIGNAL = 0x20000
}
enum
{
AF_APPLETALK = 16,
AF_INET = 2,
AF_IPX = 23,
AF_UNIX = 1,
AF_UNSPEC = 0
}
enum
{
SHUT_RD = 0,
SHUT_WR = 1,
SHUT_RDWR = 2
}
int accept(int, scope sockaddr*, scope socklen_t*);
int bind(int, const scope sockaddr*, socklen_t);
int connect(int, const scope sockaddr*, socklen_t);
int getpeername(int, scope sockaddr*, scope socklen_t*);
int getsockname(int, scope sockaddr*, scope socklen_t*);
int getsockopt(int, int, int, scope void*, scope socklen_t*);
int listen(int, int) @safe;
ssize_t recv(int, scope void*, size_t, int);
ssize_t recvfrom(int, scope void*, size_t, int, scope sockaddr*, scope socklen_t*);
ssize_t recvmsg(int, scope msghdr*, int);
ssize_t send(int, const scope void*, size_t, int);
ssize_t sendmsg(int, const scope msghdr*, int);
ssize_t sendto(int, const scope void*, size_t, int, const scope sockaddr*, socklen_t);
int setsockopt(int, int, int, const scope void*, socklen_t);
int shutdown(int, int) @safe;
int socket(int, int, int) @safe;
int sockatmark(int) @safe;
int socketpair(int, int, int, ref int[2]) @safe;
}
else version (NetBSD)
{
alias uint socklen_t;
alias ubyte sa_family_t;
struct sockaddr
{
ubyte sa_len;
sa_family_t sa_family;
byte[14] sa_data;
}
private
{
enum _SS_ALIGNSIZE = long.sizeof;
enum _SS_MAXSIZE = 128;
enum _SS_PAD1SIZE = _SS_ALIGNSIZE - ubyte.sizeof - sa_family_t.sizeof;
enum _SS_PAD2SIZE = _SS_MAXSIZE - ubyte.sizeof - sa_family_t.sizeof - _SS_PAD1SIZE - _SS_ALIGNSIZE;
}
struct sockaddr_storage
{
ubyte ss_len;
sa_family_t ss_family;
byte[_SS_PAD1SIZE] __ss_pad1;
long __ss_align;
byte[_SS_PAD2SIZE] __ss_pad2;
}
struct msghdr
{
void* msg_name;
socklen_t msg_namelen;
iovec* msg_iov;
int msg_iovlen;
void* msg_control;
socklen_t msg_controllen;
int msg_flags;
}
struct cmsghdr
{
socklen_t cmsg_len;
int cmsg_level;
int cmsg_type;
}
enum : uint
{
SCM_RIGHTS = 0x01
}
private // <machine/param.h>
{
enum _ALIGNBYTES = /+c_int+/ int.sizeof - 1;
extern (D) size_t _ALIGN( size_t p ) { return (p + _ALIGNBYTES) & ~_ALIGNBYTES; }
}
extern (D) ubyte* CMSG_DATA( cmsghdr* cmsg )
{
return cast(ubyte*) cmsg + _ALIGN( cmsghdr.sizeof );
}
extern (D) cmsghdr* CMSG_NXTHDR( msghdr* mhdr, cmsghdr* cmsg )
{
if ( cmsg == null )
{
return CMSG_FIRSTHDR( mhdr );
}
else
{
if ( cast(ubyte*) cmsg + _ALIGN( cmsg.cmsg_len ) + _ALIGN( cmsghdr.sizeof ) >
cast(ubyte*) mhdr.msg_control + mhdr.msg_controllen )
return null;
else
return cast(cmsghdr*) (cast(ubyte*) cmsg + _ALIGN( cmsg.cmsg_len ));
}
}
extern (D) cmsghdr* CMSG_FIRSTHDR( msghdr* mhdr )
{
return mhdr.msg_controllen >= cmsghdr.sizeof ? cast(cmsghdr*) mhdr.msg_control : null;
}
struct linger
{
int l_onoff;
int l_linger;
}
enum
{
SOCK_DGRAM = 2,
SOCK_RDM = 4,
SOCK_SEQPACKET = 5,
SOCK_STREAM = 1
}
enum : uint
{
SOL_SOCKET = 0xffff
}
enum : uint
{
SO_DEBUG = 0x0001, /* turn on debugging info recording */
SO_ACCEPTCONN = 0x0002, /* socket has had listen() */
SO_REUSEADDR = 0x0004, /* allow local address reuse */
SO_KEEPALIVE = 0x0008, /* keep connections alive */
SO_DONTROUTE = 0x0010, /* just use interface addresses */
SO_BROADCAST = 0x0020, /* permit sending of broadcast msgs */
SO_USELOOPBACK = 0x0040, /* bypass hardware when possible */
SO_LINGER = 0x0080, /* linger on close if data present */
SO_OOBINLINE = 0x0100, /* leave received OOB data in line */
SO_REUSEPORT = 0x0200, /* allow local address & port reuse */
/* SO_OTIMESTAMP 0x0400 */
SO_NOSIGPIPE = 0x0800, /* no SIGPIPE from EPIPE */
SO_ACCEPTFILTER = 0x1000, /* there is an accept filter */
SO_TIMESTAMP = 0x2000, /* timestamp received dgram traffic */
/*
* Additional options, not kept in so_options.
*/
SO_SNDBUF = 0x1001, /* send buffer size */
SO_RCVBUF = 0x1002, /* receive buffer size */
SO_SNDLOWAT = 0x1003, /* send low-water mark */
SO_RCVLOWAT = 0x1004, /* receive low-water mark */
/* SO_OSNDTIMEO 0x1005 */
/* SO_ORCVTIMEO 0x1006 */
SO_ERROR = 0x1007, /* get error status and clear */
SO_TYPE = 0x1008, /* get socket type */
SO_OVERFLOWED = 0x1009, /* datagrams: return packets dropped */
SO_NOHEADER = 0x100a, /* user supplies no header to kernel;
* kernel removes header and supplies
* payload
*/
SO_SNDTIMEO = 0x100b, /* send timeout */
SO_RCVTIMEO = 0x100c /* receive timeout */
}
enum
{
SOMAXCONN = 128
}
enum : uint
{
MSG_OOB = 0x0001, /* process out-of-band data */
MSG_PEEK = 0x0002, /* peek at incoming message */
MSG_DONTROUTE = 0x0004, /* send without using routing tables */
MSG_EOR = 0x0008, /* data completes record */
MSG_TRUNC = 0x0010, /* data discarded before delivery */
MSG_CTRUNC = 0x0020, /* control data lost before delivery */
MSG_WAITALL = 0x0040, /* wait for full request or error */
MSG_DONTWAIT = 0x0080, /* this message should be nonblocking */
MSG_BCAST = 0x0100, /* this message was rcvd using link-level brdcst */
MSG_MCAST = 0x0200, /* this message was rcvd using link-level mcast */
MSG_NOSIGNAL = 0x0400 /* do not generate SIGPIPE on EOF */
}
enum
{
AF_APPLETALK = 16,
AF_INET = 2,
AF_IPX = 23,
AF_UNIX = 1,
AF_UNSPEC = 0
}
enum
{
SHUT_RD = 0,
SHUT_WR = 1,
SHUT_RDWR = 2
}
int accept(int, scope sockaddr*, scope socklen_t*);
int bind(int, const scope sockaddr*, socklen_t);
int connect(int, const scope sockaddr*, socklen_t);
int getpeername(int, scope sockaddr*, scope socklen_t*);
int getsockname(int, scope sockaddr*, scope socklen_t*);
int getsockopt(int, int, int, scope void*, scope socklen_t*);
int listen(int, int) @safe;
ssize_t recv(int, scope void*, size_t, int);
ssize_t recvfrom(int, scope void*, size_t, int, scope sockaddr*, scope socklen_t*);
ssize_t recvmsg(int, scope msghdr*, int);
ssize_t send(int, const scope void*, size_t, int);
ssize_t sendmsg(int, const scope msghdr*, int);
ssize_t sendto(int, const scope void*, size_t, int, const scope sockaddr*, socklen_t);
int setsockopt(int, int, int, const scope void*, socklen_t);
int shutdown(int, int) @safe;
int socket(int, int, int) @safe;
int sockatmark(int) @safe;
int socketpair(int, int, int, ref int[2]) @safe;
}
else version (OpenBSD)
{
alias uint socklen_t;
alias ubyte sa_family_t;
struct sockaddr
{
ubyte sa_len;
sa_family_t sa_family;
byte[14] sa_data;
}
struct sockaddr_storage
{
ubyte ss_len;
sa_family_t ss_family;
byte[6] __ss_pad1;
long __ss_align;
byte[240] __ss_pad2;
}
struct msghdr
{
void* msg_name;
socklen_t msg_namelen;
iovec* msg_iov;
uint msg_iovlen;
void* msg_control;
socklen_t msg_controllen;
int msg_flags;
}
struct cmsghdr
{
socklen_t cmsg_len;
int cmsg_level;
int cmsg_type;
}
enum : uint
{
SCM_RIGHTS = 0x01
}
private // <sys/_types.h>
{
extern (D) size_t _ALIGN(size_t p) { return (p + _ALIGNBYTES) & ~_ALIGNBYTES; }
}
extern (D) ubyte* CMSG_DATA(cmsghdr* cmsg)
{
return cast(ubyte*) cmsg + _ALIGN(cmsghdr.sizeof);
}
extern (D) cmsghdr* CMSG_NXTHDR(msghdr* mhdr, cmsghdr* cmsg)
{
if (cast(ubyte*) cmsg + _ALIGN(cmsg.cmsg_len) + _ALIGN(cmsghdr.sizeof) >
cast(ubyte*) mhdr.msg_control + mhdr.msg_controllen)
return null;
else
return cast(cmsghdr*) (cast(ubyte*) cmsg + _ALIGN(cmsg.cmsg_len));
}
extern (D) cmsghdr* CMSG_FIRSTHDR(msghdr* mhdr)
{
return mhdr.msg_controllen >= cmsghdr.sizeof ? cast(cmsghdr*) mhdr.msg_control : null;
}
struct linger
{
int l_onoff;
int l_linger;
}
enum
{
SOCK_DGRAM = 2,
SOCK_RDM = 4,
SOCK_SEQPACKET = 5,
SOCK_STREAM = 1
}
enum : uint
{
SOL_SOCKET = 0xffff
}
enum : uint
{
SO_DEBUG = 0x0001,
SO_ACCEPTCONN = 0x0002,
SO_REUSEADDR = 0x0004,
SO_KEEPALIVE = 0x0008,
SO_DONTROUTE = 0x0010,
SO_BROADCAST = 0x0020,
SO_USELOOPBACK = 0x0040,
SO_LINGER = 0x0080,
SO_OOBINLINE = 0x0100,
SO_REUSEPORT = 0x0200,
SO_TIMESTAMP = 0x0800,
SO_BINDANY = 0x1000,
SO_ZEROSIZE = 0x2000,
SO_SNDBUF = 0x1001,
SO_RCVBUF = 0x1002,
SO_SNDLOWAT = 0x1003,
SO_RCVLOWAT = 0x1004,
SO_SNDTIMEO = 0x1005,
SO_RCVTIMEO = 0x1006,
SO_ERROR = 0x1007,
SO_TYPE = 0x1008,
SO_NETPROC = 0x1020,
SO_RTABLE = 0x1021,
SO_PEERCRED = 0x1022,
SO_SPLICE = 0x1023,
}
enum
{
SOMAXCONN = 128
}
enum : uint
{
MSG_OOB = 0x001,
MSG_PEEK = 0x002,
MSG_DONTROUTE = 0x004,
MSG_EOR = 0x008,
MSG_TRUNC = 0x010,
MSG_CTRUNC = 0x020,
MSG_WAITALL = 0x040,
MSG_DONTWAIT = 0x080,
MSG_BCAST = 0x100,
MSG_MCAST = 0x200,
MSG_NOSIGNAL = 0x400,
MSG_CMSG_CLOEXEC = 0x800,
}
enum
{
AF_APPLETALK = 16,
AF_INET = 2,
AF_IPX = 23,
AF_UNIX = 1,
AF_UNSPEC = 0
}
enum
{
SHUT_RD = 0,
SHUT_WR = 1,
SHUT_RDWR = 2
}
int accept(int, scope sockaddr*, scope socklen_t*);
int bind(int, const scope sockaddr*, socklen_t);
int connect(int, const scope sockaddr*, socklen_t);
int getpeername(int, scope sockaddr*, scope socklen_t*);
int getsockname(int, scope sockaddr*, scope socklen_t*);
int getsockopt(int, int, int, scope void*, scope socklen_t*);
int listen(int, int) @safe;
ssize_t recv(int, scope void*, size_t, int);
ssize_t recvfrom(int, scope void*, size_t, int, scope sockaddr*, scope socklen_t*);
ssize_t recvmsg(int, scope msghdr*, int);
ssize_t send(int, const scope void*, size_t, int);
ssize_t sendmsg(int, const scope msghdr*, int);
ssize_t sendto(int, const scope void*, size_t, int, const scope sockaddr*, socklen_t);
int setsockopt(int, int, int, const scope void*, socklen_t);
int shutdown(int, int) @safe;
int socket(int, int, int) @safe;
int sockatmark(int) @safe;
int socketpair(int, int, int, ref int[2]) @safe;
}
else version (DragonFlyBSD)
{
alias uint socklen_t;
alias ubyte sa_family_t;
enum
{
SOCK_STREAM = 1,
SOCK_DGRAM = 2,
//SOCK_RAW = 3, // defined below
SOCK_RDM = 4,
SOCK_SEQPACKET = 5,
}
enum SOCK_CLOEXEC = 0x10000000;
enum SOCK_NONBLOCK = 0x20000000;
enum : uint
{
SO_DEBUG = 0x0001,
SO_ACCEPTCONN = 0x0002,
SO_REUSEADDR = 0x0004,
SO_KEEPALIVE = 0x0008,
SO_DONTROUTE = 0x0010,
SO_BROADCAST = 0x0020,
SO_USELOOPBACK = 0x0040,
SO_LINGER = 0x0080,
SO_OOBINLINE = 0x0100,
SO_REUSEPORT = 0x0200,
SO_TIMESTAMP = 0x0400,
SO_NOSIGPIPE = 0x0800, // non-standard
SO_ACCEPTFILTER = 0x1000,
SO_SNDBUF = 0x1001,
SO_RCVBUF = 0x1002,
SO_SNDLOWAT = 0x1003,
SO_RCVLOWAT = 0x1004,
SO_SNDTIMEO = 0x1005,
SO_RCVTIMEO = 0x1006,
SO_ERROR = 0x1007,
SO_TYPE = 0x1008,
SO_SNDSPACE = 0x100a, // get appr. send buffer free space
SO_CPUHINT = 0x1030, // get socket's owner cpuid hint
}
struct linger
{
int l_onoff;
int l_linger;
}
struct accept_filter_arg {
byte[16] af_name;
byte[256-16] af_arg;
}
enum : uint
{
SOL_SOCKET = 0xffff
}
enum
{
AF_UNSPEC = 0,
AF_LOCAL = 1,
AF_UNIX = AF_LOCAL,
AF_INET = 2,
AF_APPLETALK = 16,
AF_IPX = 23,
}
struct sockaddr
{
ubyte sa_len;
sa_family_t sa_family;
byte[14] sa_data;
}
enum SOCK_MAXADDRLEN = 255;
struct sockproto {
ushort sp_family;
ushort sp_protocol;
}
private
{
enum _SS_ALIGNSIZE = long.sizeof;
enum _SS_MAXSIZE = 128;
enum _SS_PAD1SIZE = _SS_ALIGNSIZE - ubyte.sizeof - sa_family_t.sizeof;
enum _SS_PAD2SIZE = _SS_MAXSIZE - ubyte.sizeof - sa_family_t.sizeof - _SS_PAD1SIZE - _SS_ALIGNSIZE;
}
struct sockaddr_storage
{
ubyte ss_len;
sa_family_t ss_family;
byte[_SS_PAD1SIZE] __ss_pad1;
long __ss_align;
byte[_SS_PAD2SIZE] __ss_pad2;
}
struct msghdr
{
void* msg_name;
socklen_t msg_namelen;
iovec* msg_iov;
int msg_iovlen;
void* msg_control;
socklen_t msg_controllen;
int msg_flags;
}
enum SOMAXCONN = 128;
enum SOMAXOPT_SIZE = 65536;
enum SOMAXOPT_SIZE0 = (32 * 1024 * 1024);
enum : uint
{
MSG_OOB = 0x00000001,
MSG_PEEK = 0x00000002,
MSG_DONTROUTE = 0x00000004,
MSG_EOR = 0x00000008,
MSG_TRUNC = 0x00000010,
MSG_CTRUNC = 0x00000020,
MSG_WAITALL = 0x00000040,
MSG_DONTWAIT = 0x00000080,
MSG_EOF = 0x00000100,
MSG_UNUSED09 = 0x00000200,
MSG_NOSIGNAL = 0x00000400,
MSG_SYNC = 0x00000800,
MSG_CMSG_CLOEXEC = 0x00001000,
/* These override FIONBIO. MSG_FNONBLOCKING is functionally equivalent to MSG_DONTWAIT.*/
MSG_FBLOCKING = 0x00010000,
MSG_FNONBLOCKING = 0x00020000,
MSG_FMASK = 0xFFFF0000,
}
struct cmsghdr
{
socklen_t cmsg_len;
int cmsg_level;
int cmsg_type;
}
enum CMGROUP_MAX = 16;
struct cmsgcred {
pid_t cmcred_pid;
uid_t cmcred_uid;
uid_t cmcred_euid;
gid_t cmcred_gid;
short cmcred_ngroups;
gid_t[CMGROUP_MAX] cmcred_groups;
};
enum : uint
{
SCM_RIGHTS = 0x01
}
private // <machine/param.h>
{
enum _ALIGNBYTES = /+c_int+/ int.sizeof - 1;
extern (D) size_t _ALIGN( size_t p ) { return (p + _ALIGNBYTES) & ~_ALIGNBYTES; }
}
extern (D) ubyte* CMSG_DATA( cmsghdr* cmsg )
{
return cast(ubyte*) cmsg + _ALIGN( cmsghdr.sizeof );
}
extern (D) cmsghdr* CMSG_NXTHDR( msghdr* mhdr, cmsghdr* cmsg )
{
if ( cmsg == null )
{
return CMSG_FIRSTHDR( mhdr );
}
else
{
if ( cast(ubyte*) cmsg + _ALIGN( cmsg.cmsg_len ) + _ALIGN( cmsghdr.sizeof ) >
cast(ubyte*) mhdr.msg_control + mhdr.msg_controllen )
return null;
else
return cast(cmsghdr*) (cast(ubyte*) cmsg + _ALIGN( cmsg.cmsg_len ));
}
}
extern (D) cmsghdr* CMSG_FIRSTHDR( msghdr* mhdr )
{
return mhdr.msg_controllen >= cmsghdr.sizeof ? cast(cmsghdr*) mhdr.msg_control : null;
}
enum
{
SHUT_RD = 0,
SHUT_WR = 1,
SHUT_RDWR = 2
}
/*
/+ sendfile(2) header/trailer struct +/
struct sf_hdtr {
iovec * headers;
int hdr_cnt;
iovec * trailers;
int trl_cnt;
};
*/
int accept(int, sockaddr*, socklen_t*);
// int accept4(int, sockaddr*, socklen_t*, int);
int bind(int, const scope sockaddr*, socklen_t);
int connect(int, const scope sockaddr*, socklen_t);
// int extconnect(int, int, sockaddr*, socklen_t);
int getpeername(int, sockaddr*, socklen_t*);
int getsockname(int, sockaddr*, socklen_t*);
int getsockopt(int, int, int, void*, socklen_t*);
int listen(int, int);
ssize_t recv(int, void*, size_t, int);
ssize_t recvfrom(int, void*, size_t, int, sockaddr*, socklen_t*);
ssize_t recvmsg(int, msghdr*, int);
ssize_t send(int, const scope void*, size_t, int);
ssize_t sendto(int, const scope void*, size_t, int, const scope sockaddr*, socklen_t);
ssize_t sendmsg(int, const scope msghdr*, int);
// int sendfile(int, int, off_t, size_t, sf_hdtr *, off_t *, int);
int setsockopt(int, int, int, const scope void*, socklen_t);
int shutdown(int, int);
int sockatmark(int);
int socket(int, int, int);
int socketpair(int, int, int, ref int[2]);
// void pfctlinput(int, struct sockaddr *);
}
else version (Solaris)
{
alias uint socklen_t;
alias ushort sa_family_t;
struct sockaddr
{
sa_family_t sa_family;
char[14] sa_data = 0;
}
alias double sockaddr_maxalign_t;
private
{
enum _SS_ALIGNSIZE = sockaddr_maxalign_t.sizeof;
enum _SS_MAXSIZE = 256;
enum _SS_PAD1SIZE = _SS_ALIGNSIZE - sa_family_t.sizeof;
enum _SS_PAD2SIZE = _SS_MAXSIZE - sa_family_t.sizeof + _SS_PAD1SIZE + _SS_ALIGNSIZE;
}
struct sockaddr_storage
{
sa_family_t ss_family;
char[_SS_PAD1SIZE] _ss_pad1 = void;
sockaddr_maxalign_t _ss_align;
char[_SS_PAD2SIZE] _ss_pad2 = void;
}
struct msghdr
{
void* msg_name;
socklen_t msg_namelen;
iovec* msg_iov;
int msg_iovlen;
void* msg_control;
socklen_t msg_controllen;
int msg_flags;
}
struct cmsghdr
{
socklen_t cmsg_len;
int cmsg_level;
int cmsg_type;
}
enum : uint
{
SCM_RIGHTS = 0x1010
}
// FIXME: CMSG_DATA, CMSG_NXTHDR, CMSG_FIRSTHDR missing
struct linger
{
int l_onoff;
int l_linger;
}
enum
{
SOCK_STREAM = 2,
SOCK_DGRAM = 1,
SOCK_RDM = 5,
SOCK_SEQPACKET = 6,
}
enum : uint
{
SOL_SOCKET = 0xffff
}
enum : uint
{
SO_ACCEPTCONN = 0x0002,
SO_BROADCAST = 0x0020,
SO_DEBUG = 0x0001,
SO_DONTROUTE = 0x0010,
SO_ERROR = 0x1007,
SO_KEEPALIVE = 0x0008,
SO_LINGER = 0x0080,
SO_OOBINLINE = 0x0100,
SO_RCVBUF = 0x1002,
SO_RCVLOWAT = 0x1004,
SO_RCVTIMEO = 0x1006,
SO_REUSEADDR = 0x0004,
SO_SNDBUF = 0x1001,
SO_SNDLOWAT = 0x1003,
SO_SNDTIMEO = 0x1005,
SO_TYPE = 0x1008,
SO_USELOOPBACK = 0x0040, // non-standard
SO_DGRAM_ERRIND = 0x0200, // non-standard
SO_RECVUCRED = 0x0400, // non-standard
}
enum
{
SOMAXCONN = 128
}
enum : uint
{
MSG_CTRUNC = 0x10,
MSG_DONTROUTE = 0x4,
MSG_EOR = 0x8,
MSG_OOB = 0x1,
MSG_PEEK = 0x2,
MSG_TRUNC = 0x20,
MSG_WAITALL = 0x40
}
enum
{
AF_IPX = 23,
AF_APPLETALK = 16,
AF_INET = 2,
AF_UNIX = 1,
AF_UNSPEC = 0
}
enum
{
SHUT_RD,
SHUT_WR,
SHUT_RDWR
}
int accept(int, scope sockaddr*, scope socklen_t*);
int bind(int, const scope sockaddr*, socklen_t);
int connect(int, const scope sockaddr*, socklen_t);
int getpeername(int, scope sockaddr*, scope socklen_t*);
int getsockname(int, scope sockaddr*, scope socklen_t*);
int getsockopt(int, int, int, scope void*, scope socklen_t*);
int listen(int, int) @safe;
ssize_t recv(int, scope void*, size_t, int);
ssize_t recvfrom(int, scope void*, size_t, int, scope sockaddr*, scope socklen_t*);
ssize_t recvmsg(int, scope msghdr*, int);
ssize_t send(int, const scope void*, size_t, int);
ssize_t sendmsg(int, const scope msghdr*, int);
ssize_t sendto(int, const scope void*, size_t, int, const scope sockaddr*, socklen_t);
int setsockopt(int, int, int, const scope void*, socklen_t);
int shutdown(int, int) @safe;
int socket(int, int, int) @safe;
int sockatmark(int) @safe;
int socketpair(int, int, int, ref int[2]) @safe;
}
else version (CRuntime_Bionic)
{
alias int socklen_t;
alias ushort sa_family_t;
struct sockaddr
{
sa_family_t sa_family;
byte[14] sa_data;
}
private enum size_t _K_SS_MAXSIZE = 128;
struct sockaddr_storage
{
ushort ss_family;
byte[_K_SS_MAXSIZE - ushort.sizeof] __data;
}
enum : uint
{
SCM_RIGHTS = 0x01
}
private enum _ALIGNBYTES = c_long.sizeof - 1;
extern (D)
{
size_t CMSG_ALIGN( size_t len )
{
return (len + _ALIGNBYTES) & ~_ALIGNBYTES;
}
void* CMSG_DATA( cmsghdr* cmsg )
{
return cast(void*) (cast(char*) cmsg + CMSG_ALIGN( cmsghdr.sizeof ));
}
cmsghdr* CMSG_NXTHDR( msghdr* mhdr, cmsghdr* cmsg )
{
cmsghdr* __ptr = cast(cmsghdr*) ((cast(ubyte*) cmsg) + CMSG_ALIGN(cmsg.cmsg_len));
return cast(c_ulong)( cast(char*)(__ptr+1) - cast(char*) mhdr.msg_control) > mhdr.msg_controllen ? null : __ptr;
}
cmsghdr* CMSG_FIRSTHDR( msghdr* mhdr )
{
return mhdr.msg_controllen >= cmsghdr.sizeof ? cast(cmsghdr*) mhdr.msg_control : null;
}
}
struct linger
{
int l_onoff;
int l_linger;
}
struct msghdr
{
void* msg_name;
int msg_namelen;
iovec* msg_iov;
__kernel_size_t msg_iovlen;
void* msg_control;
__kernel_size_t msg_controllen;
uint msg_flags;
}
struct cmsghdr
{
__kernel_size_t cmsg_len;
int cmsg_level;
int cmsg_type;
}
alias size_t __kernel_size_t;
enum
{
SOCK_DGRAM = 2,
SOCK_SEQPACKET = 5,
SOCK_STREAM = 1
}
enum
{
SOL_SOCKET = 1
}
enum
{
SO_ACCEPTCONN = 30,
SO_BROADCAST = 6,
SO_DEBUG = 1,
SO_DONTROUTE = 5,
SO_ERROR = 4,
SO_KEEPALIVE = 9,
SO_LINGER = 13,
SO_OOBINLINE = 10,
SO_RCVBUF = 8,
SO_RCVLOWAT = 18,
SO_RCVTIMEO = 20,
SO_REUSEADDR = 2,
SO_SNDBUF = 7,
SO_SNDLOWAT = 19,
SO_SNDTIMEO = 21,
SO_TYPE = 3
}
enum
{
SOMAXCONN = 128
}
enum : uint
{
MSG_CTRUNC = 0x08,
MSG_DONTROUTE = 0x04,
MSG_EOR = 0x80,
MSG_OOB = 0x01,
MSG_PEEK = 0x02,
MSG_TRUNC = 0x20,
MSG_WAITALL = 0x100
}
enum
{
AF_APPLETALK = 5,
AF_INET = 2,
AF_IPX = 4,
AF_UNIX = 1,
AF_UNSPEC = 0
}
enum
{
SHUT_RD,
SHUT_WR,
SHUT_RDWR
}
enum SOCK_RDM = 4;
int accept(int, scope sockaddr*, scope socklen_t*);
int bind(int, const scope sockaddr*, socklen_t);
int connect(int, const scope sockaddr*, socklen_t);
int getpeername(int, scope sockaddr*, scope socklen_t*);
int getsockname(int, scope sockaddr*, scope socklen_t*);
int getsockopt(int, int, int, scope void*, scope socklen_t*);
int listen(int, int) @safe;
ssize_t recv(int, scope void*, size_t, int);
ssize_t recvfrom(int, scope void*, size_t, int, scope sockaddr*, scope socklen_t*);
int recvmsg(int, scope msghdr*, int);
ssize_t send(int, const scope void*, size_t, int);
int sendmsg(int, const scope msghdr*, int);
ssize_t sendto(int, const scope void*, size_t, int, const scope sockaddr*, socklen_t);
int setsockopt(int, int, int, const scope void*, socklen_t);
int shutdown(int, int) @safe;
int socket(int, int, int) @safe;
int sockatmark(int) @safe;
int socketpair(int, int, int, ref int[2]) @safe;
}
else version (CRuntime_Musl)
{
alias uint socklen_t;
alias ushort sa_family_t;
struct sockaddr
{
sa_family_t sa_family;
byte[14] sa_data;
}
private enum : size_t
{
_SS_SIZE = 128,
_SS_PADSIZE = _SS_SIZE - c_ulong.sizeof - sa_family_t.sizeof
}
struct sockaddr_storage
{
sa_family_t ss_family;
byte[_SS_PADSIZE] __ss_padding;
c_ulong __ss_align;
}
enum
{
SOCK_STREAM = 1,
SOCK_DGRAM = 2,
SOCK_RDM = 4,
SOCK_SEQPACKET = 5,
SOCK_DCCP = 6,
SOCK_PACKET = 10
}
enum
{
AF_UNSPEC = 0,
AF_LOCAL = 1,
AF_UNIX = AF_LOCAL,
AF_FILE = AF_LOCAL,
AF_INET = 2,
AF_AX25 = 3,
AF_IPX = 4,
AF_APPLETALK = 5,
PF_APPLETALK = AF_APPLETALK,
PF_IPX = AF_IPX
}
enum
{
SHUT_RD,
SHUT_WR,
SHUT_RDWR
}
enum
{
SOL_SOCKET = 1
}
enum
{
SO_DEBUG = 1
}
version (MIPS_Any)
{
enum
{
SO_REUSEADDR = 0x0004,
SO_TYPE = 0x1008,
SO_ERROR = 0x1007,
SO_DONTROUTE = 0x0010,
SO_BROADCAST = 0x0020,
SO_SNDBUF = 0x1001,
SO_RCVBUF = 0x1002,
SO_KEEPALIVE = 0x0008,
SO_OOBINLINE = 0x0100,
SO_LINGER = 0x0080,
SO_REUSEPORT = 0x0200,
SO_RCVLOWAT = 0x1004,
SO_SNDLOWAT = 0x1003,
SO_RCVTIMEO = 0x1006,
SO_SNDTIMEO = 0x1005,
SO_ACCEPTCONN = 0x1009
}
}
else
{
enum
{
SO_REUSEADDR = 2,
SO_TYPE = 3,
SO_ERROR = 4,
SO_DONTROUTE = 5,
SO_BROADCAST = 6,
SO_SNDBUF = 7,
SO_RCVBUF = 8,
SO_KEEPALIVE = 9,
SO_OOBINLINE = 10,
SO_LINGER = 13,
SO_REUSEPORT = 15,
SO_RCVLOWAT = 18,
SO_SNDLOWAT = 19,
SO_RCVTIMEO = 20,
SO_SNDTIMEO = 21,
SO_ACCEPTCONN = 30
}
}
enum : uint
{
MSG_OOB = 0x01,
MSG_PEEK = 0x02,
MSG_DONTROUTE = 0x04,
MSG_CTRUNC = 0x08,
MSG_TRUNC = 0x20,
MSG_EOR = 0x80,
MSG_WAITALL = 0x100,
MSG_NOSIGNAL = 0x4000
}
struct linger
{
int l_onoff;
int l_linger;
}
struct msghdr {
void *msg_name;
socklen_t msg_namelen;
iovec *msg_iov;
int msg_iovlen, __pad1;
void *msg_control;
socklen_t msg_controllen, __pad2;
int msg_flags;
}
int accept(int, sockaddr*, socklen_t*);
int bind(int, const scope sockaddr*, socklen_t);
int connect(int, const scope sockaddr*, socklen_t);
int getpeername(int, sockaddr*, socklen_t*);
int getsockname(int, sockaddr*, socklen_t*);
int getsockopt(int, int, int, void*, socklen_t*);
int listen(int, int);
ssize_t recv(int, void*, size_t, int);
ssize_t recvfrom(int, void*, size_t, int, sockaddr*, socklen_t*);
ssize_t recvmsg(int, msghdr*, int);
ssize_t send(int, const scope void*, size_t, int);
ssize_t sendmsg(int, const scope msghdr*, int);
ssize_t sendto(int, const scope void*, size_t, int, const scope sockaddr*, socklen_t);
int setsockopt(int, int, int, const scope void*, socklen_t);
int shutdown(int, int);
int socket(int, int, int);
int sockatmark(int);
int socketpair(int, int, int, ref int[2]);
}
else version (CRuntime_UClibc)
{
alias uint socklen_t;
alias ushort sa_family_t;
struct sockaddr
{
sa_family_t sa_family;
byte[14] sa_data;
}
private enum : size_t
{
_SS_SIZE = 128,
_SS_PADSIZE = _SS_SIZE - (c_ulong.sizeof * 2)
}
struct sockaddr_storage
{
sa_family_t ss_family;
c_ulong __ss_align;
byte[_SS_PADSIZE] __ss_padding;
}
struct msghdr
{
void* msg_name;
socklen_t msg_namelen;
iovec* msg_iov;
size_t msg_iovlen;
void* msg_control;
size_t msg_controllen;
int msg_flags;
}
struct cmsghdr
{
size_t cmsg_len;
int cmsg_level;
int cmsg_type;
}
enum : uint
{
SCM_RIGHTS = 0x01
}
extern (D) inout(ubyte)* CMSG_DATA( inout(cmsghdr)* cmsg ) pure nothrow @nogc { return cast(ubyte*)( cmsg + 1 ); }
private inout(cmsghdr)* __cmsg_nxthdr(inout(msghdr)*, inout(cmsghdr)*) pure nothrow @nogc;
extern (D) inout(cmsghdr)* CMSG_NXTHDR(inout(msghdr)* msg, inout(cmsghdr)* cmsg) pure nothrow @nogc
{
return __cmsg_nxthdr(msg, cmsg);
}
extern (D) inout(cmsghdr)* CMSG_FIRSTHDR( inout(msghdr)* mhdr ) pure nothrow @nogc
{
return ( cast(size_t)mhdr.msg_controllen >= cmsghdr.sizeof
? cast(inout(cmsghdr)*) mhdr.msg_control
: cast(inout(cmsghdr)*) null );
}
extern (D)
{
size_t CMSG_ALIGN( size_t len ) pure nothrow @nogc
{
return (len + size_t.sizeof - 1) & cast(size_t) (~(size_t.sizeof - 1));
}
size_t CMSG_LEN( size_t len ) pure nothrow @nogc
{
return CMSG_ALIGN(cmsghdr.sizeof) + len;
}
}
extern (D) size_t CMSG_SPACE(size_t len) pure nothrow @nogc
{
return CMSG_ALIGN(len) + CMSG_ALIGN(cmsghdr.sizeof);
}
struct linger
{
int l_onoff;
int l_linger;
}
version (X86_Any)
{
enum
{
SOCK_DGRAM = 2,
SOCK_SEQPACKET = 5,
SOCK_STREAM = 1,
SOCK_CLOEXEC = 0x80000, // octal 02000000
SOCK_NONBLOCK = 0x800 // octal 00004000
}
}
else version (MIPS_Any)
{
enum
{
SOCK_DGRAM = 1,
SOCK_SEQPACKET = 5,
SOCK_STREAM = 2,
SOCK_CLOEXEC = 0x80000, // octal 02000000
SOCK_NONBLOCK = 0x80 // octal 00000200
}
}
else version (ARM_Any)
{
enum
{
SOCK_DGRAM = 2,
SOCK_SEQPACKET = 5,
SOCK_STREAM = 1,
SOCK_CLOEXEC = 0x80000, // octal 02000000
SOCK_NONBLOCK = 0x800 // octal 00004000
}
}
else
static assert(0, "unimplemented");
enum
{
SO_ACCEPTCONN = 30,
SO_BROADCAST = 6,
SO_DEBUG = 1,
SO_DONTROUTE = 5,
SO_ERROR = 4,
SO_KEEPALIVE = 9,
SO_LINGER = 13,
SO_OOBINLINE = 10,
SO_RCVBUF = 8,
SO_RCVLOWAT = 18,
SO_RCVTIMEO = 20,
SO_REUSEADDR = 2,
SO_SNDBUF = 7,
SO_SNDLOWAT = 19,
SO_SNDTIMEO = 21,
SO_TYPE = 3,
SOL_SOCKET = 1,
SOL_TCP = 6,
SOMAXCONN = 128
}
enum : uint
{
MSG_CTRUNC = 0x08,
MSG_DONTROUTE = 0x04,
MSG_EOR = 0x80,
MSG_OOB = 0x01,
MSG_PEEK = 0x02,
MSG_TRUNC = 0x20,
MSG_WAITALL = 0x100,
MSG_NOSIGNAL = 0x4000
}
enum
{
AF_APPLETALK = 5,
AF_INET = 2,
AF_IPX = 4,
AF_UNIX = 1,
AF_UNSPEC = 0,
PF_APPLETALK = AF_APPLETALK,
PF_IPX = AF_IPX
}
enum int SOCK_RDM = 4;
enum
{
SHUT_RD,
SHUT_WR,
SHUT_RDWR
}
int accept(int, sockaddr*, socklen_t*);
int bind(int, const scope sockaddr*, socklen_t);
int connect(int, const scope sockaddr*, socklen_t);
int getpeername(int, sockaddr*, socklen_t*);
int getsockname(int, sockaddr*, socklen_t*);
int getsockopt(int, int, int, void*, socklen_t*);
int listen(int, int);
ssize_t recv(int, void*, size_t, int);
ssize_t recvfrom(int, void*, size_t, int, sockaddr*, socklen_t*);
ssize_t recvmsg(int, msghdr*, int);
ssize_t send(int, const scope void*, size_t, int);
ssize_t sendmsg(int, const scope msghdr*, int);
ssize_t sendto(int, const scope void*, size_t, int, const scope sockaddr*, socklen_t);
int setsockopt(int, int, int, const scope void*, socklen_t);
int shutdown(int, int);
int socket(int, int, int);
int sockatmark(int);
int socketpair(int, int, int, ref int[2]);
}
else
{
static assert(false, "Unsupported platform");
}
//
// IPV6 (IP6)
//
/*
AF_INET6
*/
version (CRuntime_Glibc)
{
enum
{
AF_INET6 = 10
}
}
else version (Darwin)
{
enum
{
AF_INET6 = 30
}
}
else version (FreeBSD)
{
enum
{
AF_INET6 = 28
}
}
else version (NetBSD)
{
enum
{
AF_INET6 = 24
}
}
else version (OpenBSD)
{
enum
{
AF_INET6 = 24
}
}
else version (DragonFlyBSD)
{
enum
{
AF_INET6 = 28
}
}
else version (Solaris)
{
enum
{
AF_INET6 = 26,
}
}
else version (CRuntime_Bionic)
{
enum
{
AF_INET6 = 10
}
}
else version (CRuntime_Musl)
{
enum AF_INET6 = 10;
}
else version (CRuntime_UClibc)
{
enum
{
AF_INET6 = 10
}
}
else
{
static assert(false, "Unsupported platform");
}
//
// Raw Sockets (RS)
//
/*
SOCK_RAW
*/
version (CRuntime_Glibc)
{
enum
{
SOCK_RAW = 3
}
}
else version (Darwin)
{
enum
{
SOCK_RAW = 3
}
}
else version (FreeBSD)
{
enum
{
SOCK_RAW = 3
}
}
else version (NetBSD)
{
enum
{
SOCK_RAW = 3
}
}
else version (OpenBSD)
{
enum
{
SOCK_RAW = 3
}
}
else version (DragonFlyBSD)
{
enum
{
SOCK_RAW = 3
}
}
else version (Solaris)
{
enum
{
SOCK_RAW = 4,
}
}
else version (CRuntime_Bionic)
{
enum
{
SOCK_RAW = 3
}
}
else version (CRuntime_Musl)
{
enum
{
SOCK_RAW = 3
}
}
else version (CRuntime_UClibc)
{
enum
{
SOCK_RAW = 3
}
}
else
{
static assert(false, "Unsupported platform");
}
| D |
/**
* The demangle module converts mangled D symbols to a representation similar
* to what would have existed in code.
*
* Copyright: Copyright Sean Kelly 2010 - 2014.
* License: Distributed under the
* $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0).
* (See accompanying file LICENSE)
* Authors: Sean Kelly
* Source: $(DRUNTIMESRC core/_demangle.d)
*/
module core.demangle;
debug(trace) import core.stdc.stdio : printf;
debug(info) import core.stdc.stdio : printf;
private struct Demangle
{
// NOTE: This implementation currently only works with mangled function
// names as they exist in an object file. Type names mangled via
// the .mangleof property are effectively incomplete as far as the
// ABI is concerned and so are not considered to be mangled symbol
// names.
// NOTE: This implementation builds the demangled buffer in place by
// writing data as it is decoded and then rearranging it later as
// needed. In practice this results in very little data movement,
// and the performance cost is more than offset by the gain from
// not allocating dynamic memory to assemble the name piecemeal.
//
// If the destination buffer is too small, parsing will restart
// with a larger buffer. Since this generally means only one
// allocation during the course of a parsing run, this is still
// faster than assembling the result piecemeal.
enum AddType { no, yes }
this( const(char)[] buf_, char[] dst_ = null )
{
this( buf_, AddType.yes, dst_ );
}
this( const(char)[] buf_, AddType addType_, char[] dst_ = null )
{
buf = buf_;
addType = addType_;
dst = dst_;
}
enum size_t minBufSize = 4000;
const(char)[] buf = null;
char[] dst = null;
size_t pos = 0;
size_t len = 0;
AddType addType = AddType.yes;
static class ParseException : Exception
{
@safe pure nothrow this( string msg )
{
super( msg );
}
}
static class OverflowException : Exception
{
@safe pure nothrow this( string msg )
{
super( msg );
}
}
static void error( string msg = "Invalid symbol" )
{
//throw new ParseException( msg );
debug(info) printf( "error: %.*s\n", cast(int) msg.length, msg.ptr );
throw __ctfe ? new ParseException(msg)
: cast(ParseException) cast(void*) typeid(ParseException).initializer;
}
static void overflow( string msg = "Buffer overflow" )
{
//throw new OverflowException( msg );
debug(info) printf( "overflow: %.*s\n", cast(int) msg.length, msg.ptr );
throw cast(OverflowException) cast(void*) typeid(OverflowException).initializer;
}
//////////////////////////////////////////////////////////////////////////
// Type Testing and Conversion
//////////////////////////////////////////////////////////////////////////
static bool isAlpha( char val )
{
return ('a' <= val && 'z' >= val) ||
('A' <= val && 'Z' >= val) ||
(0x80 & val); // treat all unicode as alphabetic
}
static bool isDigit( char val )
{
return '0' <= val && '9' >= val;
}
static bool isHexDigit( char val )
{
return ('0' <= val && '9' >= val) ||
('a' <= val && 'f' >= val) ||
('A' <= val && 'F' >= val);
}
static ubyte ascii2hex( char val )
{
if (val >= 'a' && val <= 'f')
return cast(ubyte)(val - 'a' + 10);
if (val >= 'A' && val <= 'F')
return cast(ubyte)(val - 'A' + 10);
if (val >= '0' && val <= '9')
return cast(ubyte)(val - '0');
error();
return 0;
}
//////////////////////////////////////////////////////////////////////////
// Data Output
//////////////////////////////////////////////////////////////////////////
static bool contains( const(char)[] a, const(char)[] b )
{
if (a.length && b.length)
{
auto bend = b.ptr + b.length;
auto aend = a.ptr + a.length;
return a.ptr <= b.ptr && bend <= aend;
}
return false;
}
char[] shift( const(char)[] val )
{
void exch( size_t a, size_t b )
{
char t = dst[a];
dst[a] = dst[b];
dst[b] = t;
}
if( val.length )
{
assert( contains( dst[0 .. len], val ) );
debug(info) printf( "shifting (%.*s)\n", cast(int) val.length, val.ptr );
for( size_t n = 0; n < val.length; n++ )
{
for( size_t v = val.ptr - dst.ptr; v + 1 < len; v++ )
{
exch( v, v + 1 );
}
}
return dst[len - val.length .. len];
}
return null;
}
char[] append( const(char)[] val )
{
if( val.length )
{
if( !dst.length )
dst.length = minBufSize;
assert( !contains( dst[0 .. len], val ) );
debug(info) printf( "appending (%.*s)\n", cast(int) val.length, val.ptr );
if( dst.ptr + len == val.ptr &&
dst.length - len >= val.length )
{
// data is already in place
auto t = dst[len .. len + val.length];
len += val.length;
return t;
}
if( dst.length - len >= val.length )
{
dst[len .. len + val.length] = val[];
auto t = dst[len .. len + val.length];
len += val.length;
return t;
}
overflow();
}
return null;
}
void putComma(size_t n)
{
pragma(inline, false);
if (n)
put(", ");
}
char[] put(char c)
{
char[1] val = c;
return put(val[]);
}
char[] put( const(char)[] val )
{
if( val.length )
{
if( !contains( dst[0 .. len], val ) )
return append( val );
return shift( val );
}
return null;
}
void putAsHex( size_t val, int width = 0 )
{
import core.internal.string;
UnsignedStringBuf buf;
auto s = unsignedToTempString(val, buf, 16);
int slen = cast(int)s.length;
if (slen < width)
{
foreach(i; slen .. width)
put('0');
}
put(s);
}
void pad( const(char)[] val )
{
if( val.length )
{
append( " " );
put( val );
}
}
void silent( lazy void dg )
{
debug(trace) printf( "silent+\n" );
debug(trace) scope(success) printf( "silent-\n" );
auto n = len; dg(); len = n;
}
//////////////////////////////////////////////////////////////////////////
// Parsing Utility
//////////////////////////////////////////////////////////////////////////
@property bool empty()
{
return pos >= buf.length;
}
@property char front()
{
if( pos < buf.length )
return buf[pos];
return char.init;
}
void test( char val )
{
if( val != front )
error();
}
void popFront()
{
if( pos++ >= buf.length )
error();
}
void match( char val )
{
test( val );
popFront();
}
void match( const(char)[] val )
{
foreach(char e; val )
{
test( e );
popFront();
}
}
void eat( char val )
{
if( val == front )
popFront();
}
//////////////////////////////////////////////////////////////////////////
// Parsing Implementation
//////////////////////////////////////////////////////////////////////////
/*
Number:
Digit
Digit Number
*/
const(char)[] sliceNumber()
{
debug(trace) printf( "sliceNumber+\n" );
debug(trace) scope(success) printf( "sliceNumber-\n" );
auto beg = pos;
while( true )
{
auto t = front;
if (t >= '0' && t <= '9')
popFront();
else
return buf[beg .. pos];
}
}
size_t decodeNumber()
{
debug(trace) printf( "decodeNumber+\n" );
debug(trace) scope(success) printf( "decodeNumber-\n" );
return decodeNumber( sliceNumber() );
}
size_t decodeNumber( const(char)[] num )
{
debug(trace) printf( "decodeNumber+\n" );
debug(trace) scope(success) printf( "decodeNumber-\n" );
size_t val = 0;
foreach( c; num )
{
import core.checkedint : mulu, addu;
bool overflow = false;
val = mulu(val, 10, overflow);
val = addu(val, c - '0', overflow);
if (overflow)
error();
}
return val;
}
void parseReal()
{
debug(trace) printf( "parseReal+\n" );
debug(trace) scope(success) printf( "parseReal-\n" );
char[64] tbuf = void;
size_t tlen = 0;
real val = void;
if( 'I' == front )
{
match( "INF" );
put( "real.infinity" );
return;
}
if( 'N' == front )
{
popFront();
if( 'I' == front )
{
match( "INF" );
put( "-real.infinity" );
return;
}
if( 'A' == front )
{
match( "AN" );
put( "real.nan" );
return;
}
tbuf[tlen++] = '-';
}
tbuf[tlen++] = '0';
tbuf[tlen++] = 'X';
if( !isHexDigit( front ) )
error( "Expected hex digit" );
tbuf[tlen++] = front;
tbuf[tlen++] = '.';
popFront();
while( isHexDigit( front ) )
{
tbuf[tlen++] = front;
popFront();
}
match( 'P' );
tbuf[tlen++] = 'p';
if( 'N' == front )
{
tbuf[tlen++] = '-';
popFront();
}
else
{
tbuf[tlen++] = '+';
}
while( isDigit( front ) )
{
tbuf[tlen++] = front;
popFront();
}
tbuf[tlen] = 0;
debug(info) printf( "got (%s)\n", tbuf.ptr );
import core.stdc.stdlib : strtold;
val = strtold( tbuf.ptr, null );
import core.stdc.stdio : snprintf;
tlen = snprintf( tbuf.ptr, tbuf.length, "%#Lg", val );
debug(info) printf( "converted (%.*s)\n", cast(int) tlen, tbuf.ptr );
put( tbuf[0 .. tlen] );
}
/*
LName:
Number Name
Name:
Namestart
Namestart Namechars
Namestart:
_
Alpha
Namechar:
Namestart
Digit
Namechars:
Namechar
Namechar Namechars
*/
void parseLName()
{
debug(trace) printf( "parseLName+\n" );
debug(trace) scope(success) printf( "parseLName-\n" );
auto n = decodeNumber();
if( !n || n > buf.length || n > buf.length - pos )
error( "LName must be at least 1 character" );
if( '_' != front && !isAlpha( front ) )
error( "Invalid character in LName" );
foreach(char e; buf[pos + 1 .. pos + n] )
{
if( '_' != e && !isAlpha( e ) && !isDigit( e ) )
error( "Invalid character in LName" );
}
put( buf[pos .. pos + n] );
pos += n;
}
/*
Type:
Shared
Const
Immutable
Wild
TypeArray
TypeVector
TypeStaticArray
TypeAssocArray
TypePointer
TypeFunction
TypeIdent
TypeClass
TypeStruct
TypeEnum
TypeTypedef
TypeDelegate
TypeNone
TypeVoid
TypeByte
TypeUbyte
TypeShort
TypeUshort
TypeInt
TypeUint
TypeLong
TypeUlong
TypeCent
TypeUcent
TypeFloat
TypeDouble
TypeReal
TypeIfloat
TypeIdouble
TypeIreal
TypeCfloat
TypeCdouble
TypeCreal
TypeBool
TypeChar
TypeWchar
TypeDchar
TypeTuple
Shared:
O Type
Const:
x Type
Immutable:
y Type
Wild:
Ng Type
TypeArray:
A Type
TypeVector:
Nh Type
TypeStaticArray:
G Number Type
TypeAssocArray:
H Type Type
TypePointer:
P Type
TypeFunction:
CallConvention FuncAttrs Arguments ArgClose Type
TypeIdent:
I LName
TypeClass:
C LName
TypeStruct:
S LName
TypeEnum:
E LName
TypeTypedef:
T LName
TypeDelegate:
D TypeFunction
TypeNone:
n
TypeVoid:
v
TypeByte:
g
TypeUbyte:
h
TypeShort:
s
TypeUshort:
t
TypeInt:
i
TypeUint:
k
TypeLong:
l
TypeUlong:
m
TypeCent
zi
TypeUcent
zk
TypeFloat:
f
TypeDouble:
d
TypeReal:
e
TypeIfloat:
o
TypeIdouble:
p
TypeIreal:
j
TypeCfloat:
q
TypeCdouble:
r
TypeCreal:
c
TypeBool:
b
TypeChar:
a
TypeWchar:
u
TypeDchar:
w
TypeTuple:
B Number Arguments
*/
char[] parseType( char[] name = null )
{
static immutable string[23] primitives = [
"char", // a
"bool", // b
"creal", // c
"double", // d
"real", // e
"float", // f
"byte", // g
"ubyte", // h
"int", // i
"ireal", // j
"uint", // k
"long", // l
"ulong", // m
null, // n
"ifloat", // o
"idouble", // p
"cfloat", // q
"cdouble", // r
"short", // s
"ushort", // t
"wchar", // u
"void", // v
"dchar", // w
];
debug(trace) printf( "parseType+\n" );
debug(trace) scope(success) printf( "parseType-\n" );
auto beg = len;
auto t = front;
switch( t )
{
case 'O': // Shared (O Type)
popFront();
put( "shared(" );
parseType();
put( ')' );
pad( name );
return dst[beg .. len];
case 'x': // Const (x Type)
popFront();
put( "const(" );
parseType();
put( ')' );
pad( name );
return dst[beg .. len];
case 'y': // Immutable (y Type)
popFront();
put( "immutable(" );
parseType();
put( ')' );
pad( name );
return dst[beg .. len];
case 'N':
popFront();
switch( front )
{
case 'g': // Wild (Ng Type)
popFront();
// TODO: Anything needed here?
put( "inout(" );
parseType();
put( ')' );
return dst[beg .. len];
case 'h': // TypeVector (Nh Type)
popFront();
put( "__vector(" );
parseType();
put( ')' );
return dst[beg .. len];
default:
error();
assert( 0 );
}
case 'A': // TypeArray (A Type)
popFront();
parseType();
put( "[]" );
pad( name );
return dst[beg .. len];
case 'G': // TypeStaticArray (G Number Type)
popFront();
auto num = sliceNumber();
parseType();
put( '[' );
put( num );
put( ']' );
pad( name );
return dst[beg .. len];
case 'H': // TypeAssocArray (H Type Type)
popFront();
// skip t1
auto tx = parseType();
parseType();
put( '[' );
put( tx );
put( ']' );
pad( name );
return dst[beg .. len];
case 'P': // TypePointer (P Type)
popFront();
parseType();
put( '*' );
pad( name );
return dst[beg .. len];
case 'F': case 'U': case 'W': case 'V': case 'R': // TypeFunction
return parseTypeFunction( name );
case 'I': // TypeIdent (I LName)
case 'C': // TypeClass (C LName)
case 'S': // TypeStruct (S LName)
case 'E': // TypeEnum (E LName)
case 'T': // TypeTypedef (T LName)
popFront();
parseQualifiedName();
pad( name );
return dst[beg .. len];
case 'D': // TypeDelegate (D TypeFunction)
popFront();
parseTypeFunction( name, IsDelegate.yes );
return dst[beg .. len];
case 'n': // TypeNone (n)
popFront();
// TODO: Anything needed here?
return dst[beg .. len];
case 'B': // TypeTuple (B Number Arguments)
popFront();
// TODO: Handle this.
return dst[beg .. len];
case 'Z': // Internal symbol
// This 'type' is used for untyped internal symbols, i.e.:
// __array
// __init
// __vtbl
// __Class
// __Interface
// __ModuleInfo
popFront();
return dst[beg .. len];
default:
if (t >= 'a' && t <= 'w')
{
popFront();
put( primitives[cast(size_t)(t - 'a')] );
pad( name );
return dst[beg .. len];
}
else if (t == 'z')
{
popFront();
switch( front )
{
case 'i':
popFront();
put( "cent" );
pad( name );
return dst[beg .. len];
case 'k':
popFront();
put( "ucent" );
pad( name );
return dst[beg .. len];
default:
error();
assert( 0 );
}
}
error();
return null;
}
}
/*
TypeFunction:
CallConvention FuncAttrs Arguments ArgClose Type
CallConvention:
F // D
U // C
W // Windows
V // Pascal
R // C++
FuncAttrs:
FuncAttr
FuncAttr FuncAttrs
FuncAttr:
empty
FuncAttrPure
FuncAttrNothrow
FuncAttrProperty
FuncAttrRef
FuncAttrTrusted
FuncAttrSafe
FuncAttrPure:
Na
FuncAttrNothrow:
Nb
FuncAttrRef:
Nc
FuncAttrProperty:
Nd
FuncAttrTrusted:
Ne
FuncAttrSafe:
Nf
FuncAttrNogc:
Ni
FuncAttrReturn:
Nj
Arguments:
Argument
Argument Arguments
Argument:
Argument2
M Argument2 // scope
Argument2:
Type
J Type // out
K Type // ref
L Type // lazy
ArgClose
X // variadic T t,...) style
Y // variadic T t...) style
Z // not variadic
*/
void parseCallConvention()
{
// CallConvention
switch( front )
{
case 'F': // D
popFront();
break;
case 'U': // C
popFront();
put( "extern (C) " );
break;
case 'W': // Windows
popFront();
put( "extern (Windows) " );
break;
case 'V': // Pascal
popFront();
put( "extern (Pascal) " );
break;
case 'R': // C++
popFront();
put( "extern (C++) " );
break;
default:
error();
}
}
void parseFuncAttr()
{
// FuncAttrs
breakFuncAttrs:
while( 'N' == front )
{
popFront();
switch( front )
{
case 'a': // FuncAttrPure
popFront();
put( "pure " );
continue;
case 'b': // FuncAttrNoThrow
popFront();
put( "nothrow " );
continue;
case 'c': // FuncAttrRef
popFront();
put( "ref " );
continue;
case 'd': // FuncAttrProperty
popFront();
put( "@property " );
continue;
case 'e': // FuncAttrTrusted
popFront();
put( "@trusted " );
continue;
case 'f': // FuncAttrSafe
popFront();
put( "@safe " );
continue;
case 'g':
case 'h':
case 'k':
// NOTE: The inout parameter type is represented as "Ng".
// The vector parameter type is represented as "Nh".
// The return parameter type is represented as "Nk".
// These make it look like a FuncAttr, but infact
// if we see these, then we know we're really in
// the parameter list. Rewind and break.
pos--;
break breakFuncAttrs;
case 'i': // FuncAttrNogc
popFront();
put( "@nogc " );
continue;
case 'j': // FuncAttrReturn
popFront();
put( "return " );
continue;
default:
error();
}
}
}
void parseFuncArguments()
{
// Arguments
for( size_t n = 0; true; n++ )
{
debug(info) printf( "tok (%c)\n", front );
switch( front )
{
case 'X': // ArgClose (variadic T t...) style)
popFront();
put( "..." );
return;
case 'Y': // ArgClose (variadic T t,...) style)
popFront();
put( ", ..." );
return;
case 'Z': // ArgClose (not variadic)
popFront();
return;
default:
break;
}
putComma(n);
if( 'M' == front )
{
popFront();
put( "scope " );
}
if( 'N' == front )
{
popFront();
if( 'k' == front ) // Return (Nk Parameter2)
{
popFront();
put( "return " );
}
else
pos--;
}
switch( front )
{
case 'J': // out (J Type)
popFront();
put( "out " );
parseType();
continue;
case 'K': // ref (K Type)
popFront();
put( "ref " );
parseType();
continue;
case 'L': // lazy (L Type)
popFront();
put( "lazy " );
parseType();
continue;
default:
parseType();
}
}
}
enum IsDelegate { no, yes }
// returns the argument list with the left parenthesis, but not the right
char[] parseTypeFunction( char[] name = null, IsDelegate isdg = IsDelegate.no )
{
debug(trace) printf( "parseTypeFunction+\n" );
debug(trace) scope(success) printf( "parseTypeFunction-\n" );
auto beg = len;
parseCallConvention();
parseFuncAttr();
beg = len;
put( '(' );
scope(success)
{
put( ')' );
auto t = len;
parseType();
put( ' ' );
if( name.length )
{
if( !contains( dst[0 .. len], name ) )
put( name );
else if( shift( name ).ptr != name.ptr )
{
beg -= name.length;
t -= name.length;
}
}
else if( IsDelegate.yes == isdg )
put( "delegate" );
else
put( "function" );
shift( dst[beg .. t] );
}
parseFuncArguments();
return dst[beg..len];
}
static bool isCallConvention( char ch )
{
switch( ch )
{
case 'F', 'U', 'V', 'W', 'R':
return true;
default:
return false;
}
}
/*
Value:
n
Number
i Number
N Number
e HexFloat
c HexFloat c HexFloat
A Number Value...
HexFloat:
NAN
INF
NINF
N HexDigits P Exponent
HexDigits P Exponent
Exponent:
N Number
Number
HexDigits:
HexDigit
HexDigit HexDigits
HexDigit:
Digit
A
B
C
D
E
F
*/
void parseValue( char[] name = null, char type = '\0' )
{
debug(trace) printf( "parseValue+\n" );
debug(trace) scope(success) printf( "parseValue-\n" );
// printf( "*** %c\n", front );
switch( front )
{
case 'n':
popFront();
put( "null" );
return;
case 'i':
popFront();
if( '0' > front || '9' < front )
error( "Number expected" );
goto case;
case '0': .. case '9':
parseIntegerValue( name, type );
return;
case 'N':
popFront();
put( '-' );
parseIntegerValue( name, type );
return;
case 'e':
popFront();
parseReal();
return;
case 'c':
popFront();
parseReal();
put( '+' );
match( 'c' );
parseReal();
put( 'i' );
return;
case 'a': case 'w': case 'd':
char t = front;
popFront();
auto n = decodeNumber();
match( '_' );
put( '"' );
foreach (i; 0..n)
{
auto a = ascii2hex( front ); popFront();
auto b = ascii2hex( front ); popFront();
auto v = cast(char)((a << 4) | b);
if (' ' <= v && v <= '~') // ASCII printable
{
put(v);
}
else
{
put("\\x");
putAsHex(v, 2);
}
}
put( '"' );
if( 'a' != t )
put(t);
return;
case 'A':
// NOTE: This is kind of a hack. An associative array literal
// [1:2, 3:4] is represented as HiiA2i1i2i3i4, so the type
// is "Hii" and the value is "A2i1i2i3i4". Thus the only
// way to determine that this is an AA value rather than an
// array value is for the caller to supply the type char.
// Hopefully, this will change so that the value is
// "H2i1i2i3i4", rendering this unnecesary.
if( 'H' == type )
goto LassocArray;
// A Number Value...
// An array literal. Value is repeated Number times.
popFront();
put( '[' );
auto n = decodeNumber();
foreach( i; 0 .. n )
{
putComma(i);
parseValue();
}
put( ']' );
return;
case 'H':
LassocArray:
// H Number Value...
// An associative array literal. Value is repeated 2*Number times.
popFront();
put( '[' );
auto n = decodeNumber();
foreach( i; 0 .. n )
{
putComma(i);
parseValue();
put(':');
parseValue();
}
put( ']' );
return;
case 'S':
// S Number Value...
// A struct literal. Value is repeated Number times.
popFront();
if( name.length )
put( name );
put( '(' );
auto n = decodeNumber();
foreach( i; 0 .. n )
{
putComma(i);
parseValue();
}
put( ')' );
return;
default:
error();
}
}
void parseIntegerValue( char[] name = null, char type = '\0' )
{
debug(trace) printf( "parseIntegerValue+\n" );
debug(trace) scope(success) printf( "parseIntegerValue-\n" );
switch( type )
{
case 'a': // char
case 'u': // wchar
case 'w': // dchar
{
auto val = sliceNumber();
auto num = decodeNumber( val );
switch( num )
{
case '\'':
put( "'\\''" );
return;
// \", \?
case '\\':
put( "'\\\\'" );
return;
case '\a':
put( "'\\a'" );
return;
case '\b':
put( "'\\b'" );
return;
case '\f':
put( "'\\f'" );
return;
case '\n':
put( "'\\n'" );
return;
case '\r':
put( "'\\r'" );
return;
case '\t':
put( "'\\t'" );
return;
case '\v':
put( "'\\v'" );
return;
default:
switch( type )
{
case 'a':
if( num >= 0x20 && num < 0x7F )
{
put( '\'' );
put( cast(char)num );
put( '\'' );
return;
}
put( "\\x" );
putAsHex( num, 2 );
return;
case 'u':
put( "'\\u" );
putAsHex( num, 4 );
put( '\'' );
return;
case 'w':
put( "'\\U" );
putAsHex( num, 8 );
put( '\'' );
return;
default:
assert( 0 );
}
}
}
case 'b': // bool
put( decodeNumber() ? "true" : "false" );
return;
case 'h', 't', 'k': // ubyte, ushort, uint
put( sliceNumber() );
put( 'u' );
return;
case 'l': // long
put( sliceNumber() );
put( 'L' );
return;
case 'm': // ulong
put( sliceNumber() );
put( "uL" );
return;
default:
put( sliceNumber() );
return;
}
}
/*
TemplateArgs:
TemplateArg
TemplateArg TemplateArgs
TemplateArg:
TemplateArgX
H TemplateArgX
TemplateArgX:
T Type
V Type Value
S LName
*/
void parseTemplateArgs()
{
debug(trace) printf( "parseTemplateArgs+\n" );
debug(trace) scope(success) printf( "parseTemplateArgs-\n" );
for( size_t n = 0; true; n++ )
{
if( front == 'H' )
popFront();
switch( front )
{
case 'T':
popFront();
putComma(n);
parseType();
continue;
case 'V':
popFront();
putComma(n);
// NOTE: In the few instances where the type is actually
// desired in the output it should precede the value
// generated by parseValue, so it is safe to simply
// decrement len and let put/append do its thing.
char t = front; // peek at type for parseValue
char[] name; silent( name = parseType() );
parseValue( name, t );
continue;
case 'S':
popFront();
putComma(n);
if ( mayBeMangledNameArg() )
{
auto l = len;
auto p = pos;
try
{
debug(trace) printf( "may be mangled name arg\n" );
parseMangledNameArg();
continue;
}
catch( ParseException e )
{
len = l;
pos = p;
debug(trace) printf( "not a mangled name arg\n" );
}
}
parseQualifiedName();
continue;
default:
return;
}
}
}
bool mayBeMangledNameArg()
{
debug(trace) printf( "mayBeMangledNameArg+\n" );
debug(trace) scope(success) printf( "mayBeMangledNameArg-\n" );
auto p = pos;
scope(exit) pos = p;
auto n = decodeNumber();
return n >= 4 &&
pos < buf.length && '_' == buf[pos++] &&
pos < buf.length && 'D' == buf[pos++] &&
isDigit(buf[pos]);
}
void parseMangledNameArg()
{
debug(trace) printf( "parseMangledNameArg+\n" );
debug(trace) scope(success) printf( "parseMangledNameArg-\n" );
auto n = decodeNumber();
parseMangledName( n );
}
/*
TemplateInstanceName:
Number __T LName TemplateArgs Z
*/
void parseTemplateInstanceName()
{
debug(trace) printf( "parseTemplateInstanceName+\n" );
debug(trace) scope(success) printf( "parseTemplateInstanceName-\n" );
auto sav = pos;
scope(failure) pos = sav;
auto n = decodeNumber();
auto beg = pos;
match( "__T" );
parseLName();
put( "!(" );
parseTemplateArgs();
match( 'Z' );
if( pos - beg != n )
error( "Template name length mismatch" );
put( ')' );
}
bool mayBeTemplateInstanceName()
{
debug(trace) printf( "mayBeTemplateInstanceName+\n" );
debug(trace) scope(success) printf( "mayBeTemplateInstanceName-\n" );
auto p = pos;
scope(exit) pos = p;
auto n = decodeNumber();
return n >= 5 &&
pos < buf.length && '_' == buf[pos++] &&
pos < buf.length && '_' == buf[pos++] &&
pos < buf.length && 'T' == buf[pos++];
}
/*
SymbolName:
LName
TemplateInstanceName
*/
void parseSymbolName()
{
debug(trace) printf( "parseSymbolName+\n" );
debug(trace) scope(success) printf( "parseSymbolName-\n" );
// LName -> Number
// TemplateInstanceName -> Number "__T"
switch( front )
{
case '0': .. case '9':
if( mayBeTemplateInstanceName() )
{
auto t = len;
try
{
debug(trace) printf( "may be template instance name\n" );
parseTemplateInstanceName();
return;
}
catch( ParseException e )
{
debug(trace) printf( "not a template instance name\n" );
len = t;
}
}
parseLName();
return;
default:
error();
}
}
/*
QualifiedName:
SymbolName
SymbolName QualifiedName
*/
char[] parseQualifiedName()
{
debug(trace) printf( "parseQualifiedName+\n" );
debug(trace) scope(success) printf( "parseQualifiedName-\n" );
size_t beg = len;
size_t n = 0;
do
{
if( n++ )
put( '.' );
parseSymbolName();
if( isCallConvention( front ) )
{
// try to demangle a function, in case we are pointing to some function local
auto prevpos = pos;
auto prevlen = len;
// we don't want calling convention and attributes in the qualified name
parseCallConvention();
parseFuncAttr();
len = prevlen;
put( '(' );
parseFuncArguments();
put( ')' );
if( !isDigit( front ) ) // voldemort types don't have a return type on the function
{
auto funclen = len;
parseType();
if( !isDigit( front ) )
{
// not part of a qualified name, so back up
pos = prevpos;
len = prevlen;
}
else
len = funclen; // remove return type from qualified name
}
}
} while( isDigit( front ) );
return dst[beg .. len];
}
/*
MangledName:
_D QualifiedName Type
_D QualifiedName M Type
*/
void parseMangledName(size_t n = 0)
{
debug(trace) printf( "parseMangledName+\n" );
debug(trace) scope(success) printf( "parseMangledName-\n" );
char[] name = null;
auto end = pos + n;
eat( '_' );
match( 'D' );
do
{
name = parseQualifiedName();
debug(info) printf( "name (%.*s)\n", cast(int) name.length, name.ptr );
if( 'M' == front )
popFront(); // has 'this' pointer
if( AddType.yes == addType )
parseType( name );
if( pos >= buf.length || (n != 0 && pos >= end) )
return;
put( '.' );
} while( true );
}
char[] doDemangle(alias FUNC)()
{
while( true )
{
try
{
debug(info) printf( "demangle(%.*s)\n", cast(int) buf.length, buf.ptr );
FUNC();
return dst[0 .. len];
}
catch( OverflowException e )
{
debug(trace) printf( "overflow... restarting\n" );
auto a = minBufSize;
auto b = 2 * dst.length;
auto newsz = a < b ? b : a;
debug(info) printf( "growing dst to %lu bytes\n", newsz );
dst.length = newsz;
pos = len = 0;
continue;
}
catch( ParseException e )
{
debug(info)
{
auto msg = e.toString();
printf( "error: %.*s\n", cast(int) msg.length, msg.ptr );
}
if( dst.length < buf.length )
dst.length = buf.length;
dst[0 .. buf.length] = buf[];
return dst[0 .. buf.length];
}
}
}
char[] demangleName()
{
return doDemangle!parseMangledName();
}
char[] demangleType()
{
return doDemangle!parseType();
}
}
/**
* Demangles D mangled names. If it is not a D mangled name, it returns its
* argument name.
*
* Params:
* buf = The string to demangle.
* dst = An optional destination buffer.
*
* Returns:
* The demangled name or the original string if the name is not a mangled D
* name.
*/
char[] demangle( const(char)[] buf, char[] dst = null )
{
//return Demangle(buf, dst)();
auto d = Demangle(buf, dst);
return d.demangleName();
}
/**
* Demangles a D mangled type.
*
* Params:
* buf = The string to demangle.
* dst = An optional destination buffer.
*
* Returns:
* The demangled type name or the original string if the name is not a
* mangled D type.
*/
char[] demangleType( const(char)[] buf, char[] dst = null )
{
auto d = Demangle(buf, dst);
return d.demangleType();
}
/**
* Mangles a D symbol.
*
* Params:
* T = The type of the symbol.
* fqn = The fully qualified name of the symbol.
* dst = An optional destination buffer.
*
* Returns:
* The mangled name for a symbols of type T and the given fully
* qualified name.
*/
char[] mangle(T)(const(char)[] fqn, char[] dst = null) @safe pure nothrow
{
import core.internal.string : numDigits, unsignedToTempString;
static struct DotSplitter
{
@safe pure nothrow:
const(char)[] s;
@property bool empty() const { return !s.length; }
@property const(char)[] front() const
{
immutable i = indexOfDot();
return i == -1 ? s[0 .. $] : s[0 .. i];
}
void popFront()
{
immutable i = indexOfDot();
s = i == -1 ? s[$ .. $] : s[i+1 .. $];
}
private ptrdiff_t indexOfDot() const
{
foreach (i, c; s) if (c == '.') return i;
return -1;
}
}
size_t len = "_D".length;
foreach (comp; DotSplitter(fqn))
len += numDigits(comp.length) + comp.length;
len += T.mangleof.length;
if (dst.length < len) dst.length = len;
size_t i = "_D".length;
dst[0 .. i] = "_D";
foreach (comp; DotSplitter(fqn))
{
const ndigits = numDigits(comp.length);
unsignedToTempString(comp.length, dst[i .. i + ndigits]);
i += ndigits;
dst[i .. i + comp.length] = comp[];
i += comp.length;
}
dst[i .. i + T.mangleof.length] = T.mangleof[];
i += T.mangleof.length;
return dst[0 .. i];
}
///
unittest
{
assert(mangle!int("a.b") == "_D1a1bi");
assert(mangle!(char[])("test.foo") == "_D4test3fooAa");
assert(mangle!(int function(int))("a.b") == "_D1a1bPFiZi");
}
unittest
{
static assert(mangle!int("a.b") == "_D1a1bi");
auto buf = new char[](10);
buf = mangle!int("a.b", buf);
assert(buf == "_D1a1bi");
buf = mangle!(char[])("test.foo", buf);
assert(buf == "_D4test3fooAa");
buf = mangle!(real delegate(int))("modµ.dg");
assert(buf == "_D5modµ2dgDFiZe", buf);
}
/**
* Mangles a D function.
*
* Params:
* T = function pointer type.
* fqn = The fully qualified name of the symbol.
* dst = An optional destination buffer.
*
* Returns:
* The mangled name for a function with function pointer type T and
* the given fully qualified name.
*/
char[] mangleFunc(T:FT*, FT)(const(char)[] fqn, char[] dst = null) @safe pure nothrow if (is(FT == function))
{
static if (isExternD!FT)
{
return mangle!FT(fqn, dst);
}
else static if (hasPlainMangling!FT)
{
dst.length = fqn.length;
dst[] = fqn[];
return dst;
}
else static if (isExternCPP!FT)
{
static assert(0, "Can't mangle extern(C++) functions.");
}
else
{
static assert(0, "Can't mangle function with unknown linkage ("~FT.stringof~").");
}
}
///
unittest
{
assert(mangleFunc!(int function(int))("a.b") == "_D1a1bFiZi");
assert(mangleFunc!(int function(Object))("object.Object.opEquals") == "_D6object6Object8opEqualsFC6ObjectZi");
}
unittest
{
int function(lazy int[], ...) fp;
assert(mangle!(typeof(fp))("demangle.test") == "_D8demangle4testPFLAiYi");
assert(mangle!(typeof(*fp))("demangle.test") == "_D8demangle4testFLAiYi");
}
private template isExternD(FT) if (is(FT == function))
{
enum isExternD = FT.mangleof[0] == 'F';
}
private template isExternCPP(FT) if (is(FT == function))
{
enum isExternCPP = FT.mangleof[0] == 'R';
}
private template hasPlainMangling(FT) if (is(FT == function))
{
enum c = FT.mangleof[0];
// C || Pascal || Windows
enum hasPlainMangling = c == 'U' || c == 'V' || c == 'W';
}
unittest
{
static extern(D) void fooD();
static extern(C) void fooC();
static extern(Pascal) void fooP();
static extern(Windows) void fooW();
static extern(C++) void fooCPP();
bool check(FT)(bool isD, bool isCPP, bool isPlain)
{
return isExternD!FT == isD && isExternCPP!FT == isCPP &&
hasPlainMangling!FT == isPlain;
}
static assert(check!(typeof(fooD))(true, false, false));
static assert(check!(typeof(fooC))(false, false, true));
static assert(check!(typeof(fooP))(false, false, true));
static assert(check!(typeof(fooW))(false, false, true));
static assert(check!(typeof(fooCPP))(false, true, false));
static assert(__traits(compiles, mangleFunc!(typeof(&fooD))("")));
static assert(__traits(compiles, mangleFunc!(typeof(&fooC))("")));
static assert(__traits(compiles, mangleFunc!(typeof(&fooP))("")));
static assert(__traits(compiles, mangleFunc!(typeof(&fooW))("")));
static assert(!__traits(compiles, mangleFunc!(typeof(&fooCPP))("")));
}
/***
* C name mangling is done by adding a prefix on some platforms.
*/
version(Win32)
enum string cPrefix = "_";
else version(OSX)
enum string cPrefix = "_";
else
enum string cPrefix = "";
version(unittest)
{
immutable string[2][] table =
[
["printf", "printf"],
["_foo", "_foo"],
["_D88", "_D88"],
["_D4test3fooAa", "char[] test.foo"],
["_D8demangle8demangleFAaZAa", "char[] demangle.demangle(char[])"],
["_D6object6Object8opEqualsFC6ObjectZi", "int object.Object.opEquals(Object)"],
["_D4test2dgDFiYd", "double test.dg(int, ...)"],
//["_D4test58__T9factorialVde67666666666666860140VG5aa5_68656c6c6fVPvnZ9factorialf", ""],
//["_D4test101__T9factorialVde67666666666666860140Vrc9a999999999999d9014000000000000000c00040VG5aa5_68656c6c6fVPvnZ9factorialf", ""],
["_D4test34__T3barVG3uw3_616263VG3wd3_646566Z1xi", "int test.bar!(\"abc\"w, \"def\"d).x"],
["_D8demangle4testFLC6ObjectLDFLiZiZi", "int demangle.test(lazy Object, lazy int delegate(lazy int))"],
["_D8demangle4testFAiXi", "int demangle.test(int[]...)"],
["_D8demangle4testFAiYi", "int demangle.test(int[], ...)"],
["_D8demangle4testFLAiXi", "int demangle.test(lazy int[]...)"],
["_D8demangle4testFLAiYi", "int demangle.test(lazy int[], ...)"],
["_D6plugin8generateFiiZAya", "immutable(char)[] plugin.generate(int, int)"],
["_D6plugin8generateFiiZAxa", "const(char)[] plugin.generate(int, int)"],
["_D6plugin8generateFiiZAOa", "shared(char)[] plugin.generate(int, int)"],
["_D8demangle3fnAFZ3fnBMFZv", "void demangle.fnA().fnB()"],
["_D8demangle4mainFZ1S3fnCMFZv", "void demangle.main().S.fnC()"],
["_D8demangle4mainFZ1S3fnDMFZv", "void demangle.main().S.fnD()"],
["_D8demangle20__T2fnVAiA4i1i2i3i4Z2fnFZv", "void demangle.fn!([1, 2, 3, 4]).fn()"],
["_D8demangle10__T2fnVi1Z2fnFZv", "void demangle.fn!(1).fn()"],
["_D8demangle26__T2fnVS8demangle1SS2i1i2Z2fnFZv", "void demangle.fn!(demangle.S(1, 2)).fn()"],
["_D8demangle13__T2fnVeeNANZ2fnFZv", "void demangle.fn!(real.nan).fn()"],
["_D8demangle14__T2fnVeeNINFZ2fnFZv", "void demangle.fn!(-real.infinity).fn()"],
["_D8demangle13__T2fnVeeINFZ2fnFZv", "void demangle.fn!(real.infinity).fn()"],
["_D8demangle21__T2fnVHiiA2i1i2i3i4Z2fnFZv", "void demangle.fn!([1:2, 3:4]).fn()"],
["_D8demangle2fnFNgiZNgi", "inout(int) demangle.fn(inout(int))"],
["_D8demangle29__T2fnVa97Va9Va0Vu257Vw65537Z2fnFZv", "void demangle.fn!('a', '\\t', \\x00, '\\u0101', '\\U00010001').fn()"],
["_D2gc11gctemplates56__T8mkBitmapTS3std5range13__T4iotaTiTiZ4iotaFiiZ6ResultZ8mkBitmapFNbNiNfPmmZv",
"nothrow @nogc @safe void gc.gctemplates.mkBitmap!(std.range.iota!(int, int).iota(int, int).Result).mkBitmap(ulong*, ulong)"],
["_D8serenity9persister6Sqlite69__T15SqlitePersisterTS8serenity9persister6Sqlite11__unittest6FZ4TestZ15SqlitePersister12__T7opIndexZ7opIndexMFmZS8serenity9persister6Sqlite11__unittest6FZ4Test",
"serenity.persister.Sqlite.__unittest6().Test serenity.persister.Sqlite.SqlitePersister!(serenity.persister.Sqlite.__unittest6().Test).SqlitePersister.opIndex!().opIndex(ulong)"],
["_D8bug100274mainFZ5localMFZi","int bug10027.main().local()"],
["_D8demangle4testFNhG16gZv", "void demangle.test(__vector(byte[16]))"],
["_D8demangle4testFNhG8sZv", "void demangle.test(__vector(short[8]))"],
["_D8demangle4testFNhG4iZv", "void demangle.test(__vector(int[4]))"],
["_D8demangle4testFNhG2lZv", "void demangle.test(__vector(long[2]))"],
["_D8demangle4testFNhG4fZv", "void demangle.test(__vector(float[4]))"],
["_D8demangle4testFNhG2dZv", "void demangle.test(__vector(double[2]))"],
["_D8demangle4testFNhG4fNhG4fZv", "void demangle.test(__vector(float[4]), __vector(float[4]))"],
["_D8bug1119234__T3fooS23_D8bug111924mainFZ3bariZ3fooMFZv","void bug11192.foo!(int bug11192.main().bar).foo()"],
["_D13libd_demangle12__ModuleInfoZ", "libd_demangle.__ModuleInfo"],
["_D15TypeInfo_Struct6__vtblZ", "TypeInfo_Struct.__vtbl"],
["_D3std5stdio12__ModuleInfoZ", "std.stdio.__ModuleInfo"],
["_D3std6traits15__T8DemangleTkZ8Demangle6__initZ", "std.traits.Demangle!(uint).Demangle.__init"],
["_D3foo3Bar7__ClassZ", "foo.Bar.__Class"],
["_D3foo3Bar6__vtblZ", "foo.Bar.__vtbl"],
["_D3foo3Bar11__interfaceZ", "foo.Bar.__interface"],
["_D3foo7__arrayZ", "foo.__array"],
["_D8link657428__T3fooVE8link65746Methodi0Z3fooFZi", "int link6574.foo!(0).foo()"],
["_D8link657429__T3fooHVE8link65746Methodi0Z3fooFZi", "int link6574.foo!(0).foo()"],
["_D4test22__T4funcVAyaa3_610a62Z4funcFNaNbNiNfZAya", `pure nothrow @nogc @safe immutable(char)[] test.func!("a\x0ab").func()`],
["_D3foo3barFzkZzi", "cent foo.bar(ucent)"],
];
template staticIota(int x)
{
template Seq(T...){ alias T Seq; }
static if (x == 0)
alias Seq!() staticIota;
else
alias Seq!(staticIota!(x - 1), x - 1) staticIota;
}
}
unittest
{
foreach( i, name; table )
{
auto r = demangle( name[0] );
assert( r == name[1],
"demangled \"" ~ name[0] ~ "\" as \"" ~ r ~ "\" but expected \"" ~ name[1] ~ "\"");
}
foreach( i; staticIota!(table.length) )
{
enum r = demangle( table[i][0] );
static assert( r == table[i][1],
"demangled \"" ~ table[i][0] ~ "\" as \"" ~ r ~ "\" but expected \"" ~ table[i][1] ~ "\"");
}
}
/*
*
*/
string decodeDmdString( const(char)[] ln, ref size_t p )
{
string s;
uint zlen, zpos;
// decompress symbol
while( p < ln.length )
{
int ch = cast(ubyte) ln[p++];
if( (ch & 0xc0) == 0xc0 )
{
zlen = (ch & 0x7) + 1;
zpos = ((ch >> 3) & 7) + 1; // + zlen;
if( zpos > s.length )
break;
s ~= s[$ - zpos .. $ - zpos + zlen];
}
else if( ch >= 0x80 )
{
if( p >= ln.length )
break;
int ch2 = cast(ubyte) ln[p++];
zlen = (ch2 & 0x7f) | ((ch & 0x38) << 4);
if( p >= ln.length )
break;
int ch3 = cast(ubyte) ln[p++];
zpos = (ch3 & 0x7f) | ((ch & 7) << 7);
if( zpos > s.length )
break;
s ~= s[$ - zpos .. $ - zpos + zlen];
}
else if( Demangle.isAlpha(cast(char)ch) || Demangle.isDigit(cast(char)ch) || ch == '_' )
s ~= cast(char) ch;
else
{
p--;
break;
}
}
return s;
}
| D |
module parse;
import std.string;
import std.array;
import std.algorithm;
import std.stdio;
enum Status
{
fail,
pass,
unresolved
}
struct TestEntry
{
Status status;
string file;
string info;
}
struct Test
{
TestEntry[] entries;
Status status;
}
struct TestSection
{
string name;
Test[] tests;
size_t passed;
size_t numTests;
size_t failed;
size_t unresolved;
}
struct TestRun
{
string name;
TestHash tests;
size_t passed;
size_t numTests;
size_t failed;
size_t unresolved;
Test[string] allTests;
//TODO: Sub-TestRuns (e.g -fno-section-anchors, etc)
}
alias TestSection[string] TestHash;
Status overallStatus(Test test)
{
Status stat = Status.pass;
foreach(entry; test.entries)
{
if(entry.status == Status.fail && stat != Status.unresolved)
stat = Status.fail;
else if(entry.status == Status.unresolved)
stat = Status.unresolved;
}
return stat;
}
TestRun analyzeTestRun(string name, string fileName)
{
TestRun run;
run.name = name;
auto file = File(fileName);
foreach(line; file.byLine)
{
TestEntry t;
if(line.startsWith("FAIL:"))
{
t.status = Status.fail;
fillName(line, t);
if(!(t.file in run.allTests))
run.allTests[t.file] = Test.init;
run.allTests[t.file].entries ~= t;
}
else if(line.startsWith("PASS:"))
{
t.status = Status.pass;
fillName(line, t);
if(!(t.file in run.allTests))
run.allTests[t.file] = Test.init;
run.allTests[t.file].entries ~= t;
}
else if(line.startsWith("UNRESOLVED:"))
{
t.status = Status.unresolved;
fillName(line, t);
if(!(t.file in run.allTests))
run.allTests[t.file] = Test.init;
run.allTests[t.file].entries ~= t;
}
}
foreach(key, ref val; run.allTests)
{
val.status = overallStatus(val);
final switch(val.status)
{
case Status.pass:
run.passed++;
break;
case Status.fail:
run.failed++;
break;
case Status.unresolved:
run.unresolved++;
break;
}
run.numTests++;
}
auto sectionTests = splitTests(run.allTests.keys);
foreach(sectionName, tests; sectionTests)
{
TestSection sect;
sect.name = sectionName;
foreach(test; tests)
{
if(test in run.allTests)
{
sect.tests ~= run.allTests[test];
final switch(run.allTests[test].status)
{
case Status.pass:
sect.passed++;
break;
case Status.fail:
sect.failed++;
break;
case Status.unresolved:
sect.unresolved++;
break;
}
sect.numTests++;
}
}
run.tests[sect.name] = sect;
}
return run;
}
void fillName(const(char)[] line, ref TestEntry test)
{
auto rest = findSplit(line, ": ")[2];
auto res = findSplit(rest, " ");
test.file = res[0].idup;
test.info = res[2].idup;
}
string[][string] splitTests(string[] tests)
{
string[][string] result;
foreach(key; tests)
{
auto category = findSplit(key, "/")[0];
result[category] ~= key;
}
return result;
}
size_t[string] analyzeLog(string logFile)
{
size_t[string] result;
auto file = File(logFile);
size_t last = 1, current = 1;
foreach(line; file.byLine)
{
if(line.startsWith("FAIL:") || line.startsWith("PASS:") || line.startsWith("UNRESOLVED:"))
{
auto rest = findSplit(line, ": ")[2];
auto res = findSplit(rest, " ");
auto name = res[0].idup;
if(!(name in result))
result[name] = last;
last = current + 1;
}
current++;
}
return result;
}
| D |
module android.java.android.icu.text.MeasureFormat;
public import android.java.android.icu.text.MeasureFormat_d_interface;
import arsd.jni : ImportExportImpl;
mixin ImportExportImpl!MeasureFormat;
import import5 = android.java.java.lang.StringBuffer;
import import0 = android.java.android.icu.text.MeasureFormat;
import import7 = android.java.android.icu.util.Measure;
import import12 = android.java.java.lang.Class;
import import9 = android.java.java.lang.StringBuilder;
import import11 = android.java.java.text.AttributedCharacterIterator;
| D |
/*
* Copyright: Copyright Johannes Teichrieb 2019
* License: opensource.org/licenses/MIT
*/
module util.aspectid;
/*
* specification:
*
* aspectid sides with simplicity, incurring slight syntax restrictions:
* - don't comment out enum class Aspect definition
* - no comments or macros between enum and opening {
* - don't use preprocessor within enum class Aspect { } block (macros, include, conditional)
* - no commented out '{' or '}' between Aspect's 'enum' and ';'
* - comments within { } are fine
*
* verifying enum values is problematic:
* - can't determine foo = VAL without preprocessor
* - can't determine foo = AnotherEnum::bar without compiling
* We'll only allow assignment of numeric offset >= 0 to the first enum.
*
* Extended version which allows
* - assignment to arbitrary enums: foo, bar = 2
* - assignment of own enumerators: foo, bar = foo + 2
* would need to detect collisions:
* (foo, bar = foo), (foo = 2, bar, baz = 2), (foo, bar, baz = foo + 1), etc.
* Without collision detection, names could be wrong,
* which is much worse than prohibiting arbitrary assignment.
*
* '_end' enumerator at the end is required; no name is generated for it
*/
import std.format : format;
import std.array : Appender;
import std.regex : ctRegex, Captures, matchFirst;
import util.removecomments;
void main(string[] args)
{
import std.getopt;
import std.file;
import std.path : extension, dirName, buildPath;
string src;
auto opt = getopt(args,
config.required,
"src", "Source root.", &src);
// TODO option to remove generated files
if (opt.helpWanted)
{
defaultGetoptPrinter("Generate and include names for Aspect enums in .h files.", opt.options);
return;
}
void writeIfContentDiffers(string file, string expect)
{
string read;
try
{
read = cast(immutable char[]) file.read;
}
catch (FileException) { }
if (read != expect)
file.write(expect);
}
foreach (e; dirEntries(src, SpanMode.depth, false))
{
if (!e.isFile || e.name.extension != ".h")
continue;
string content = cast(string) read(e.name);
string[] includeFileName;
string[] includeFileContent;
string maybeModified = content.maybeUpdateInclude!makeIdLut(includeFileName, includeFileContent);
if (content != maybeModified)
e.name.write(maybeModified);
foreach (i, include; includeFileName)
writeIfContentDiffers(e.name.dirName.buildPath(include), includeFileContent[i]);
}
}
@safe:
class ParseException : Exception
{
this(string msg, string file = __FILE__, size_t line = __LINE__, Throwable next = null) pure nothrow
{
super(msg, file, line, next);
}
}
struct Parser
{
struct Aspect
{
string name;
string[] e;
uint offset;
string upToPost;
string post;
}
this(string _input)
{
input = _input;
toParse = input;
matchNext();
}
bool empty() pure nothrow const
{
return cap.empty;
}
Aspect front() pure
in (!empty)
{
return _front;
}
void popFront()
in (!empty)
{
matchNext();
}
private:
void matchNext()
{
cap = matchFirst(toParse, r);
if (!cap.empty)
convCap();
toParse = cap.post;
}
void convCap() pure @trusted
{
_front.name = cap[1];
try
_front.e = convEnums(cap[2], _front.offset);
catch (ParseException e)
throw new ParseException(format!"Failed to parse '%s': %s"(_front.name, e.msg));
const pPost = cap.post.ptr;
const pInput = input.ptr;
_front.upToPost = pInput[0 .. pPost - pInput];
_front.post = cap.post;
}
string[] convEnums(string s, out uint offset) pure const
{
import std.algorithm : map, filter, canFind;
import std.array : array, split;
import std.string : strip;
string[] enums = s
.removeCommentsReplaceStrings
.split(',')
.map!strip
.filter!"a.length"
.array;
if (enums.length < 2)
throw new ParseException("Aspect should have at least 2 enums (including '_end')");
foreach (e; enums[1 .. $])
if (e.canFind('='))
throw new ParseException("Only first enumerator can be assigned");
if (enums[$ - 1] != "_end")
throw new ParseException("Missing '_end' enumerator");
enums = enums[0 .. $ - 1];
uint getOffsetStrippingEq(ref string s)
{
import std.algorithm : findSplit;
import std.conv : to;
if (!s.canFind('='))
return 0;
auto enumAndVal = s.findSplit("=");
s = enumAndVal[0].strip;
uint offset;
try
offset = enumAndVal[2].strip.to!uint;
catch (Exception)
throw new ParseException("Only positive integers can be assigned");
return offset;
}
offset = getOffsetStrippingEq(enums[0]);
return enums;
}
enum aspectEnumNamePattern = r"enum\s+class\s+(\w*Aspect)";
enum aspectEnumPattern = aspectEnumNamePattern ~ r"[^{]*\{([^}]*)\}\s*;";
static immutable r = ctRegex!aspectEnumPattern;
string input;
string toParse;
Captures!string cap;
Aspect _front;
}
version (unittest)
{
import std.exception : assertThrown;
import std.file : readText;
enum testInputDir = "test/aspectid/";
}
@("empty input") unittest
{
auto parser = Parser("");
assert(parser.empty);
}
@("non empty input") unittest
{
const input = "#include <cstdio>\n\nclass Foo { int i; };\n";
auto parser = Parser(input);
assert(parser.empty);
}
@("non aspect enum") unittest
{
const input = "#include <cstddef>\n\nenum class Foo { one, two };\n";
auto parser = Parser(input);
assert(parser.empty);
}
@("aspect enum") unittest
{
const input = "#include <cstdint>\n\nenum class Aspect { foo, _end };\n";
auto parser = Parser(input);
assert(!parser.empty);
assert("Aspect" == parser.front.name);
assert(["foo"] == parser.front.e);
assert(0 == parser.front.offset);
assert(input[0 .. $ - 1] == parser.front.upToPost);
assert("\n" == parser.front.post);
}
@("empty post") unittest
{
const input = "enum class FooAspect {bar,_end};";
auto parser = Parser(input);
auto res = parser.front;
assert("FooAspect" == res.name);
assert(["bar"] == res.e);
assert(0 == res.offset);
assert(input == res.upToPost);
assert(!res.post.length);
}
@("trailing ,") unittest
{
const input = "enum class Aspect { foo\n, _end ,\n };";
auto res = Parser(input).front;
assert(["foo"] == res.e);
assert(0 == res.offset);
}
@("popFront") unittest
{
const input = "enum class Aspect { foo, _end };";
auto parser = Parser(input);
assert(!parser.empty);
parser.popFront();
assert(parser.empty);
}
@("specified type") unittest
{
const input = "enum class Aspect:unsinged\nint{\none,\n_end\n};\n";
assert(["one"] == Parser(input).front.e);
}
@("commented enums") unittest
{
const input = "enum class Aspect { one, // the quick brown fox
// jumps over\n two,\n _end /* _end enum */, };";
auto res = Parser(input).front;
assert(["one", "two"] == res.e);
assert(0 == res.offset);
}
@("two enums") unittest
{
import std.algorithm : findSplitAfter;
const input = "enum class AAspect : int\n{\none,two,_end }\n;
enum class BAspect :unsigned int{ three, four, _end } ;
";
auto parser = Parser(input);
auto res = parser.front;
assert("AAspect" == res.name);
assert(["one", "two"] == res.e);
auto a = input.findSplitAfter(";");
assert(a[0] == res.upToPost);
assert(a[1] == res.post);
parser.popFront();
assert(!parser.empty);
res = parser.front;
assert("BAspect" == res.name);
assert(["three", "four"] == res.e);
auto b = a[1].findSplitAfter(";");
assert(a[0] ~ b[0] == res.upToPost);
assert(b[1] == res.post);
parser.popFront();
assert(parser.empty);
}
@("assign 0 has no effect") unittest
{
const input = "enum class Aspect { foo = 0, _end };";
auto res = Parser(input).front;
assert(["foo"] == res.e);
assert(0 == res.offset);
}
@("assign") unittest
{
const input = "enum class Aspect { foo = 42, bar, _end };";
auto parser = Parser(input);
assert(["foo", "bar"] == parser.front.e);
assert(42 == parser.front.offset);
}
@("assign negative int throws") unittest
{
assertThrown(Parser("enum class Aspect { foo = -1, bar, _end };"));
}
@("assing non int throws") unittest
{
assertThrown(Parser("enum class Aspect { foo = FIRST, _end };"));
}
@("assign following element throws") unittest
{
assertThrown(Parser("enum class Aspect { foo = 1, bar = 3, _end };"));
assertThrown(Parser("enum class Aspect { foo, bar = 2, _end };"));
}
@("'_end' not being last throws") unittest
{
assertThrown(Parser("enum class Aspect { foo, _end, bar };"));
}
@("large offset") unittest
{
// this would result in a large LUT, but it's not parser's concern
assert(1000000 == Parser("enum class Aspect { foo = 1000000, _end };").front.offset);
}
@("slightly convoluted input") unittest
{
const input = readText(testInputDir ~ "miscaspects.h");
auto parser = Parser(input);
assert("ModuleAAspect" == parser.front.name);
assert(["aOne", "aTwo"] == parser.front.e);
assert(0 == parser.front.offset);
parser.popFront();
assert("Aspect" == parser.front.name);
assert(["bOne", "bTwo", "end"] == parser.front.e);
assert(42 == parser.front.offset);
parser.popFront();
assert("ModuleCAspect" == parser.front.name);
assert(["cOne", "cTwo", "_end_wrong"] == parser.front.e);
assert(16 == parser.front.offset);
parser.popFront();
assert(parser.empty);
}
private enum indent = " ";
string makeIdLut(string aspectName, string[] enums, uint offset) pure
{
checkOffset(offset);
Appender!string app;
app ~= idLutPrefix(aspectName);
foreach (i; 0 .. offset)
app ~= "0, ";
app ~= idLiteral(aspectName, enums[0]);
enums = enums[1 .. $];
while (enums.length)
{
app ~= ", ";
app ~= idLiteral(aspectName, enums[0]);
enums = enums[1 .. $];
}
app ~= idLutEnd;
return app.data;
}
private string idLutPrefix(string aspectName) pure nothrow
{
Appender!string app;
app ~= "template<>\n";
app ~= "struct _AspectIdLut<";
app ~= aspectName;
app ~= "> {\n";
app ~= indent;
app ~= "static constexpr uint32_t id(";
app ~= aspectName;
app ~= " e) {\n";
app ~= indent;
app ~= indent;
app ~= "constexpr uint32_t a[] = { ";
return app.data;
}
private enum idLutEnd = " };\n" ~ indent ~ indent ~ "return a[static_cast<int>(e)];\n" ~ indent ~ "}\n};\n";
private string idLiteral(string aspectName, string enumerator) pure nothrow
{
import std.digest.crc;
CRC32 crc;
crc.put(cast(const ubyte[]) aspectName.stripSuffix);
crc.put('.');
crc.put(cast(const ubyte[]) enumerator);
return "0x" ~ crc.finish.toHexString!(Order.decreasing, LetterCase.lower);
}
private string stripSuffix(string aspectName) pure nothrow
{
import std.string : endsWith;
enum suffix = "Aspect";
assert(aspectName.endsWith(suffix));
return aspectName[0 .. $ - suffix.length];
}
@("stripSuffix") unittest
{
assert("Foo" == stripSuffix("FooAspect"));
}
@("stripSuffix suffix only") unittest
{
assert("" == stripSuffix("Aspect"));
}
@("makeIdLut single enumerator") unittest
{
Appender!string expect;
expect ~= idLutPrefix("Aspect");
expect ~= idLiteral("Aspect", "foo");
expect ~= idLutEnd;
assert(expect.data == makeIdLut("Aspect", ["foo"], 0));
}
@("makeIdLut two enumerators") unittest
{
Appender!string expect;
expect ~= idLutPrefix("Aspect");
expect ~= idLiteral("Aspect", "foo") ~ ", ";
expect ~= idLiteral("Aspect", "bar");
expect ~= idLutEnd;
assert(expect.data == makeIdLut("Aspect", ["foo", "bar"], 0));
}
@("makeIdLut offset single enumerator") unittest
{
Appender!string expect;
expect ~= idLutPrefix("Aspect");
expect ~= "0, ";
expect ~= idLiteral("Aspect", "foo");
expect ~= idLutEnd;
assert(expect.data == makeIdLut("Aspect", ["foo"], 1));
}
@("makeIdLut offset multiple enumerators") unittest
{
Appender!string expect;
expect ~= idLutPrefix("Aspect");
expect ~= "0, 0, ";
expect ~= idLiteral("Aspect", "one") ~ ", ";
expect ~= idLiteral("Aspect", "two") ~ ", ";
expect ~= idLiteral("Aspect", "three");
expect ~= idLutEnd;
assert(expect.data == makeIdLut("Aspect", ["one", "two", "three"], 2));
}
private enum nameLutQualifier = "static constexpr const char* ";
string makeNameLut(string aspectName, string[] enums, uint offset) pure
in (enums)
{
enum : string {
qualifier = nameLutQualifier,
postName = "Name[] = {\n",
}
checkOffset(offset);
Appender!string app;
app ~= qualifier;
app ~= aspectName;
app ~= postName;
foreach (i; 0 .. offset)
{
app ~= indent;
app ~= "nullptr,\n";
}
app ~= indent;
app ~= '"';
app ~= enums[0];
app ~= '"';
enums = enums[1 .. $];
while (enums.length)
{
app ~= ",\n";
app ~= indent;
app ~= '"';
app ~= enums[0];
app ~= '"';
enums = enums[1 .. $];
}
app ~= "\n};\n";
return app.data;
}
@("single enumerator") unittest
{
const expect = nameLutQualifier ~ "AspectName[] = {\n \"foo\"\n};\n";
assert(expect == makeNameLut("Aspect", ["foo"], 0));
}
@("two enumerators") unittest
{
const expect = nameLutQualifier ~ "FooBarAspectName[] = {\n \"foo\",\n \"bar\"\n};\n";
assert(expect == makeNameLut("FooBarAspect", ["foo", "bar"], 0));
}
@("multiple enumerators") unittest
{
const expect = nameLutQualifier ~ "NumberAspectName[] = {\n"
~ " \"one\",\n \"two\",\n \"three\"\n};\n";
assert(expect == makeNameLut("NumberAspect", ["one", "two", "three"], 0));
}
@("offset single enumerator") unittest
{
const expect = nameLutQualifier ~ "FooAspectName[] = {\n nullptr,\n \"foo\"\n};\n";
assert(expect == makeNameLut("FooAspect", ["foo"], 1));
}
@("offset multiple enumerators") unittest
{
const expect = nameLutQualifier ~ "NumberAspectName[] = {\n nullptr,\n nullptr,\n"
~ " nullptr,\n nullptr,\n \"one\",\n \"two\",\n \"three\"\n};\n";
assert(expect == makeNameLut("NumberAspect", ["one", "two", "three"], 4));
}
void checkOffset(uint offset) pure
{
enum offsetMax = 256;
if (offset > offsetMax)
throw new Exception(format!"Offset %d would result in a large LUT. Max offset: %d"(offset, offsetMax));
}
private enum includeFileNamePrefix = "_gen_";
private enum includeComment = " // generated\n";
version (unittest)
string maybeUpdateInclude(string s) @trusted
{
string[] dummy1, dummy2;
return maybeUpdateInclude!makeNameLut(s, dummy1, dummy2);
}
// TODO refactor to struct
string maybeUpdateInclude(alias pred)(string s, out string[] includeFileName, out string[] content) @trusted
{
import std.algorithm : find;
static immutable r = ctRegex!(`^\s*#include "` ~ includeFileNamePrefix ~ `(\w*Aspect).h"`);
auto parser = Parser(s);
if (parser.empty)
return s;
Appender!string app;
void appendInclude()
{
app ~= "\n\n";
app ~= parser.front.name.getInclude;
app ~= includeComment;
}
immutable char* inputEnd = s.ptr + s.length;
immutable (char)* p = s.ptr;
for (; !parser.empty; parser.popFront())
{
auto front = parser.front;
includeFileName ~= getIncludeFileName(front.name);
content ~= pred(front.name, front.e, front.offset);
immutable char* pEnd = front.upToPost.ptr + front.upToPost.length;
app ~= p[0 .. pEnd - p];
p = front.post.ptr;
auto cap = front.post.matchFirst(r);
const bool missing = cap.empty;
const bool wrongName = !cap.empty && cap[1] != front.name;
if (wrongName)
p = cap.post.find('\n').ptr; // strip old include
if (missing || wrongName)
{
if (p < inputEnd && *p == '\n')
++p;
appendInclude();
}
}
app ~= p[0 .. inputEnd - p];
return app.data;
}
private string getIncludeFileName(string aspectName) pure nothrow
{
auto app = Appender!string(includeFileNamePrefix);
app ~= aspectName;
app ~= ".h";
return app.data;
}
@("getIncludeFileName") unittest
{
const expect = includeFileNamePrefix ~ "FooAspect.h";
assert(expect == getIncludeFileName("FooAspect"));
}
private string getInclude(string aspectName) pure nothrow
{
auto app = Appender!string("#include \"");
app ~= getIncludeFileName(aspectName);
app ~= '"';
return app.data;
}
@("getInclude") unittest
{
const expect = "#include \"" ~ getIncludeFileName("FooAspect") ~ '"';
assert(expect == getInclude("FooAspect"));
}
@("no effect on non aspect enum") unittest
{
const input = "#inclue <cstdio>\n\nenum class Foo {\nfoo,\nbar\n};\n";
assert(input == input.maybeUpdateInclude);
}
@("missing include is inserted") unittest
{
const input = "#include <cstdint>\n\nenum class FooAspect { foo, _end };";
const expect = input ~ "\n\n" ~ "FooAspect".getInclude ~ includeComment;
assert(expect == input.maybeUpdateInclude);
}
@("matching include is not changed") unittest
{
const input = "#include <cstddef>\n\nenum class FooAspect { foo, _end };\n" ~ "FooAspect".getInclude;
assert(input == input.maybeUpdateInclude);
}
@("include is overwritten on name mismatch") unittest
{
const input = "enum class FooAspect { foo, _end };\n" ~ "Aspect".getInclude;
const expect = "enum class FooAspect { foo, _end };\n\n" ~ "FooAspect".getInclude ~ includeComment;
assert(expect == input.maybeUpdateInclude);
}
@("two includes") unittest
{
const input = readText(testInputDir ~ "twoincludes.h");
const expect = readText(testInputDir ~ "twoincludes-expect.h");
assert(expect == input.maybeUpdateInclude);
}
@("multiple misc includes") unittest
{
const input = readText(testInputDir ~ "multincludes.h");
const expect = readText(testInputDir ~ "multincludes-expect.h");
assert(expect == input.maybeUpdateInclude);
}
@("no effect on expected input") unittest
{
const expect = readText(testInputDir ~ "multincludes-expect.h");
assert(expect == expect.maybeUpdateInclude);
}
| D |
/* REQUIRED_ARGS: compilable/imports/test17541_2.d compilable/imports/test17541_3.d
*/
// https://issues.dlang.org/show_bug.cgi?id=17541
module one;
import two;
import three;
struct BB
{
enum MAX_NUM_FIBERS = 4096;
TWOR!1 t;
TT!(int) tt;
auto foo()
{
tt.insertabcdefg(1);
}
}
BB bb;
@nogc bar()
{
bb.foo();
}
| D |
/Users/caochengfei/Desktop/swiftServiceTest/.build/x86_64-apple-macosx10.10/debug/PerfectLib.build/JSONConvertible.swift.o : /Users/caochengfei/Desktop/swiftServiceTest/.build/checkouts/PerfectLib.git-3712999737848873669/Sources/PerfectLib/JSONConvertible.swift /Users/caochengfei/Desktop/swiftServiceTest/.build/checkouts/PerfectLib.git-3712999737848873669/Sources/PerfectLib/File.swift /Users/caochengfei/Desktop/swiftServiceTest/.build/checkouts/PerfectLib.git-3712999737848873669/Sources/PerfectLib/Log.swift /Users/caochengfei/Desktop/swiftServiceTest/.build/checkouts/PerfectLib.git-3712999737848873669/Sources/PerfectLib/PerfectServer.swift /Users/caochengfei/Desktop/swiftServiceTest/.build/checkouts/PerfectLib.git-3712999737848873669/Sources/PerfectLib/Dir.swift /Users/caochengfei/Desktop/swiftServiceTest/.build/checkouts/PerfectLib.git-3712999737848873669/Sources/PerfectLib/PerfectError.swift /Users/caochengfei/Desktop/swiftServiceTest/.build/checkouts/PerfectLib.git-3712999737848873669/Sources/PerfectLib/Utilities.swift /Users/caochengfei/Desktop/swiftServiceTest/.build/checkouts/PerfectLib.git-3712999737848873669/Sources/PerfectLib/Bytes.swift /Users/caochengfei/Desktop/swiftServiceTest/.build/checkouts/PerfectLib.git-3712999737848873669/Sources/PerfectLib/SysProcess.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/os.apinotesc /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/XPC.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/ObjectiveC.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/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/os.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.13.sdk/usr/include/xpc/XPC.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/usr/include/objc/ObjectiveC.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/usr/include/Darwin.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/System/Library/Frameworks/CoreText.framework/Headers/CoreText.apinotes
/Users/caochengfei/Desktop/swiftServiceTest/.build/x86_64-apple-macosx10.10/debug/PerfectLib.build/JSONConvertible~partial.swiftmodule : /Users/caochengfei/Desktop/swiftServiceTest/.build/checkouts/PerfectLib.git-3712999737848873669/Sources/PerfectLib/JSONConvertible.swift /Users/caochengfei/Desktop/swiftServiceTest/.build/checkouts/PerfectLib.git-3712999737848873669/Sources/PerfectLib/File.swift /Users/caochengfei/Desktop/swiftServiceTest/.build/checkouts/PerfectLib.git-3712999737848873669/Sources/PerfectLib/Log.swift /Users/caochengfei/Desktop/swiftServiceTest/.build/checkouts/PerfectLib.git-3712999737848873669/Sources/PerfectLib/PerfectServer.swift /Users/caochengfei/Desktop/swiftServiceTest/.build/checkouts/PerfectLib.git-3712999737848873669/Sources/PerfectLib/Dir.swift /Users/caochengfei/Desktop/swiftServiceTest/.build/checkouts/PerfectLib.git-3712999737848873669/Sources/PerfectLib/PerfectError.swift /Users/caochengfei/Desktop/swiftServiceTest/.build/checkouts/PerfectLib.git-3712999737848873669/Sources/PerfectLib/Utilities.swift /Users/caochengfei/Desktop/swiftServiceTest/.build/checkouts/PerfectLib.git-3712999737848873669/Sources/PerfectLib/Bytes.swift /Users/caochengfei/Desktop/swiftServiceTest/.build/checkouts/PerfectLib.git-3712999737848873669/Sources/PerfectLib/SysProcess.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/os.apinotesc /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/XPC.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/ObjectiveC.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/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/os.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.13.sdk/usr/include/xpc/XPC.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/usr/include/objc/ObjectiveC.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/usr/include/Darwin.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/System/Library/Frameworks/CoreText.framework/Headers/CoreText.apinotes
/Users/caochengfei/Desktop/swiftServiceTest/.build/x86_64-apple-macosx10.10/debug/PerfectLib.build/JSONConvertible~partial.swiftdoc : /Users/caochengfei/Desktop/swiftServiceTest/.build/checkouts/PerfectLib.git-3712999737848873669/Sources/PerfectLib/JSONConvertible.swift /Users/caochengfei/Desktop/swiftServiceTest/.build/checkouts/PerfectLib.git-3712999737848873669/Sources/PerfectLib/File.swift /Users/caochengfei/Desktop/swiftServiceTest/.build/checkouts/PerfectLib.git-3712999737848873669/Sources/PerfectLib/Log.swift /Users/caochengfei/Desktop/swiftServiceTest/.build/checkouts/PerfectLib.git-3712999737848873669/Sources/PerfectLib/PerfectServer.swift /Users/caochengfei/Desktop/swiftServiceTest/.build/checkouts/PerfectLib.git-3712999737848873669/Sources/PerfectLib/Dir.swift /Users/caochengfei/Desktop/swiftServiceTest/.build/checkouts/PerfectLib.git-3712999737848873669/Sources/PerfectLib/PerfectError.swift /Users/caochengfei/Desktop/swiftServiceTest/.build/checkouts/PerfectLib.git-3712999737848873669/Sources/PerfectLib/Utilities.swift /Users/caochengfei/Desktop/swiftServiceTest/.build/checkouts/PerfectLib.git-3712999737848873669/Sources/PerfectLib/Bytes.swift /Users/caochengfei/Desktop/swiftServiceTest/.build/checkouts/PerfectLib.git-3712999737848873669/Sources/PerfectLib/SysProcess.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/os.apinotesc /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/XPC.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/ObjectiveC.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/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/os.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.13.sdk/usr/include/xpc/XPC.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/usr/include/objc/ObjectiveC.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/usr/include/Darwin.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/System/Library/Frameworks/CoreText.framework/Headers/CoreText.apinotes
| D |
a shortened form of a word or phrase
shortening something by omitting parts of it
| D |
/**
* Routines to handle elems.
*
* Compiler implementation of the
* $(LINK2 https://www.dlang.org, D programming language).
*
* Copyright: Copyright (C) 1985-1998 by Symantec
* Copyright (C) 2000-2023 by The D Language Foundation, All Rights Reserved
* Authors: $(LINK2 https://www.digitalmars.com, Walter Bright)
* License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
* Source: $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/backend/elem.d, backend/elem.d)
*/
module dmd.backend.elem;
enum HYDRATE = false;
enum DEHYDRATE = false;
import core.stdc.stdarg;
import core.stdc.stdio;
import core.stdc.stdlib;
import core.stdc.string;
import dmd.backend.cdef;
import dmd.backend.cc;
import dmd.backend.cgcv;
import dmd.backend.code;
import dmd.backend.code_x86;
import dmd.backend.dlist;
import dmd.backend.dt;
import dmd.backend.dvec;
import dmd.backend.el;
import dmd.backend.evalu8 : el_toldoubled;
import dmd.backend.global;
import dmd.backend.goh;
import dmd.backend.mem;
import dmd.backend.obj;
import dmd.backend.oper;
import dmd.backend.rtlsym;
import dmd.backend.ty;
import dmd.backend.type;
version (CRuntime_Microsoft)
{
import dmd.root.longdouble;
}
/+
version (CRuntime_Microsoft) extern (C++)
{
alias real_t = real;
private struct longdouble_soft { real_t r; }
size_t ld_sprint(char* str, size_t size, int fmt, longdouble_soft x);
}
+/
nothrow:
@safe:
version (STATS)
{
private __gshared
{
int elfreed = 0; /* number of freed elems */
int eprm_cnt; /* max # of allocs at any point */
}
}
/*******************************
* Do our own storage allocation of elems.
*/
private __gshared
{
elem *nextfree = null; /* pointer to next free elem */
int elcount = 0; /* number of allocated elems */
int elem_size = elem.sizeof;
debug
int elmax; /* max # of allocs at any point */
}
/////////////////////////////
// Table to gather redundant strings in.
struct STAB
{
Symbol *sym; // symbol that refers to the string
char[] str; // the string
}
private __gshared
{
STAB[16] stable;
int stable_si;
}
/************************
* Initialize el package.
*/
@trusted
void el_init()
{
if (!configv.addlinenumbers)
elem_size = elem.sizeof - Srcpos.sizeof;
}
/*******************************
* Initialize for another run through.
*/
@trusted
void el_reset()
{
stable_si = 0;
for (int i = 0; i < stable.length; i++)
mem_free(stable[i].str.ptr);
memset(stable.ptr,0,stable.sizeof);
}
/************************
* Terminate el package.
*/
@trusted
void el_term()
{
static if (TERMCODE)
{
for (int i = 0; i < stable.length; i++)
mem_free(stable[i].str.ptr);
debug printf("Max # of elems = %d\n",elmax);
if (elcount != 0)
printf("unfreed elems = %d\n",elcount);
while (nextfree)
{
elem *e;
e = nextfree.EV.E1;
mem_ffree(nextfree);
nextfree = e;
}
}
else
{
assert(elcount == 0);
}
}
/***********************
* Allocate an element.
*/
@trusted
elem *el_calloc()
{
elem *e;
elcount++;
if (nextfree)
{
e = nextfree;
nextfree = e.EV.E1;
}
else
e = cast(elem *) mem_fmalloc(elem.sizeof);
version (STATS)
eprm_cnt++;
//MEMCLEAR(e, (*e).sizeof);
memset(e, 0, (*e).sizeof);
debug
{
e.id = elem.IDelem;
if (elcount > elmax)
elmax = elcount;
}
/*printf("el_calloc() = %p\n",e);*/
return e;
}
/***************
* Free element
*/
@trusted
void el_free(elem *e)
{
L1:
if (!e) return;
elem_debug(e);
//printf("el_free(%p)\n",e);
//elem_print(e);
if (e.Ecount--)
return; // usage count
elcount--;
const op = e.Eoper;
switch (op)
{
case OPconst:
break;
case OPvar:
break;
case OPrelconst:
break;
case OPstring:
case OPasm:
mem_free(e.EV.Vstring);
break;
default:
debug assert(op < OPMAX);
if (!OTleaf(op))
{
if (OTbinary(op))
el_free(e.EV.E2);
elem* en = e.EV.E1;
debug memset(e,0xFF,elem_size);
e.EV.E1 = nextfree;
nextfree = e;
version (STATS)
elfreed++;
e = en;
goto L1;
}
break;
}
debug memset(e,0xFF,elem_size);
e.EV.E1 = nextfree;
nextfree = e;
version (STATS)
elfreed++;
}
version (STATS)
{
/* count number of elems available on free list */
void el_count_free()
{
elem *e;
int count;
for(e=nextfree;e;e=e.EV.E1)
count++;
printf("Requests for elems %d\n",elcount);
printf("Requests to free elems %d\n",elfreed);
printf("Number of elems %d\n",eprm_cnt);
printf("Number of elems currently on free list %d\n",count);
}
}
/*********************
* Combine e1 and e2 with a comma-expression.
* Be careful about either or both being null.
*/
elem * el_combine(elem *e1,elem *e2)
{
if (e1)
{
if (e2)
{
e1 = el_bin(OPcomma,e2.Ety,e1,e2);
}
}
else
e1 = e2;
return e1;
}
/*********************
* Combine e1 and e2 as parameters to a function.
* Be careful about either or both being null.
*/
elem * el_param(elem *e1,elem *e2)
{
//printf("el_param(%p, %p)\n", e1, e2);
if (e1)
{
if (e2)
{
e1 = el_bin(OPparam,TYvoid,e1,e2);
}
}
else
e1 = e2;
return e1;
}
/*********************************
* Create parameter list, terminated by a null.
*/
@trusted
elem *el_params(elem *e1, ...)
{
elem *e;
va_list ap;
e = null;
va_start(ap, e1);
for (; e1; e1 = va_arg!(elem *)(ap))
{
e = el_param(e, e1);
}
va_end(ap);
return e;
}
/*****************************************
* Do an array of parameters as a balanced
* binary tree.
*/
@trusted
elem *el_params(void **args, int length)
{
if (length == 0)
return null;
if (length == 1)
return cast(elem *)args[0];
int mid = length >> 1;
return el_param(el_params(args, mid),
el_params(args + mid, length - mid));
}
/*****************************************
* Do an array of parameters as a balanced
* binary tree.
*/
@trusted
elem *el_combines(void **args, int length)
{
if (length == 0)
return null;
if (length == 1)
return cast(elem *)args[0];
int mid = length >> 1;
return el_combine(el_combines(args, mid),
el_combines(args + mid, length - mid));
}
/**************************************
* Return number of op nodes
*/
@trusted
size_t el_opN(const elem *e, OPER op)
{
if (e.Eoper == op)
return el_opN(e.EV.E1, op) + el_opN(e.EV.E2, op);
else
return 1;
}
/******************************************
* Fill an array with the ops.
*/
@trusted
void el_opArray(elem ***parray, elem *e, OPER op)
{
if (e.Eoper == op)
{
el_opArray(parray, e.EV.E1, op);
el_opArray(parray, e.EV.E2, op);
}
else
{
**parray = e;
++(*parray);
}
}
@trusted
void el_opFree(elem *e, OPER op)
{
if (e.Eoper == op)
{
el_opFree(e.EV.E1, op);
el_opFree(e.EV.E2, op);
e.EV.E1 = null;
e.EV.E2 = null;
el_free(e);
}
}
/*****************************************
* Do an array of parameters as a tree
*/
@trusted
extern (C) elem *el_opCombine(elem **args, size_t length, OPER op, tym_t ty)
{
if (length == 0)
return null;
if (length == 1)
return args[0];
return el_bin(op, ty, el_opCombine(args, length - 1, op, ty), args[length - 1]);
}
/***************************************
* Return a list of the parameters.
*/
int el_nparams(const elem *e)
{
return cast(int)el_opN(e, OPparam);
}
/******************************************
* Fill an array with the parameters.
*/
@trusted
void el_paramArray(elem ***parray, elem *e)
{
if (e.Eoper == OPparam)
{
el_paramArray(parray, e.EV.E1);
el_paramArray(parray, e.EV.E2);
freenode(e);
}
else
{
**parray = e;
++(*parray);
}
}
/*************************************
* Create a quad word out of two dwords.
*/
elem *el_pair(tym_t tym, elem *lo, elem *hi)
{
static if (0)
{
lo = el_una(OPu32_64, TYullong, lo);
hi = el_una(OPu32_64, TYullong, hi);
hi = el_bin(OPshl, TYullong, hi, el_long(TYint, 32));
return el_bin(OPor, tym, lo, hi);
}
else
{
return el_bin(OPpair, tym, lo, hi);
}
}
/*************************
* Copy an element (not the tree!).
*/
@trusted
void el_copy(elem *to, const elem *from)
{
assert(to && from);
elem_debug(from);
elem_debug(to);
memcpy(to,from,elem_size);
elem_debug(to);
}
/***********************************
* Allocate a temporary, and return temporary elem.
*/
@trusted
elem * el_alloctmp(tym_t ty)
{
Symbol *s;
s = symbol_generate(SC.auto_,type_fake(ty));
symbol_add(s);
s.Sfl = FLauto;
s.Sflags = SFLfree | SFLunambig | GTregcand;
return el_var(s);
}
/********************************
* Select the e1 child of e.
*/
@trusted
elem * el_selecte1(elem *e)
{
elem *e1;
assert(!PARSER);
elem_debug(e);
assert(!OTleaf(e.Eoper));
e1 = e.EV.E1;
elem_debug(e1);
if (e.EV.E2) elem_debug(e.EV.E2);
e.EV.E1 = null; // so e1 won't be freed
if (configv.addlinenumbers)
{
if (e.Esrcpos.Slinnum)
e1.Esrcpos = e.Esrcpos;
}
e1.Ety = e.Ety;
//if (tyaggregate(e1.Ety))
// e1.Enumbytes = e.Enumbytes;
if (!e1.Ejty)
e1.Ejty = e.Ejty;
el_free(e);
return e1;
}
/********************************
* Select the e2 child of e.
*/
@trusted
elem * el_selecte2(elem *e)
{
elem *e2;
//printf("el_selecte2(%p)\n",e);
elem_debug(e);
assert(OTbinary(e.Eoper));
if (e.EV.E1)
elem_debug(e.EV.E1);
e2 = e.EV.E2;
elem_debug(e2);
e.EV.E2 = null; // so e2 won't be freed
if (configv.addlinenumbers)
{
if (e.Esrcpos.Slinnum)
e2.Esrcpos = e.Esrcpos;
}
if (PARSER)
el_settype(e2,e.ET);
else
{
e2.Ety = e.Ety;
//if (tyaggregate(e.Ety))
// e2.Enumbytes = e.Enumbytes;
}
el_free(e);
return e2;
}
/*************************
* Create and return a duplicate of e, including its leaves.
* No CSEs.
*/
@trusted
elem * el_copytree(elem *e)
{
elem *d;
if (!e)
return e;
elem_debug(e);
d = el_calloc();
el_copy(d,e);
d.Ecount = 0;
if (!OTleaf(e.Eoper))
{
d.EV.E1 = el_copytree(e.EV.E1);
if (OTbinary(e.Eoper))
d.EV.E2 = el_copytree(e.EV.E2);
}
else
{
switch (e.Eoper)
{
case OPstring:
static if (0)
{
if (OPTIMIZER)
{
/* Convert the string to a static symbol and
then just refer to it, because two OPstrings can't
refer to the same string.
*/
el_convstring(e); // convert string to symbol
d.Eoper = OPrelconst;
d.EV.Vsym = e.EV.Vsym;
break;
}
}
static if (0)
{
case OPrelconst:
e.EV.sm.ethis = null;
break;
}
case OPasm:
d.EV.Vstring = cast(char *) mem_malloc(d.EV.Vstrlen);
memcpy(d.EV.Vstring,e.EV.Vstring,e.EV.Vstrlen);
break;
default:
break;
}
}
return d;
}
/*******************************
* Replace (e) with ((stmp = e),stmp)
*/
@trusted
elem *exp2_copytotemp(elem *e)
{
//printf("exp2_copytotemp()\n");
elem_debug(e);
tym_t ty = tybasic(e.Ety);
type *t;
if ((ty == TYstruct || ty == TYarray) && e.ET)
t = e.ET;
else
t = type_fake(ty);
Symbol *stmp = symbol_genauto(t);
elem *eeq = el_bin(OPeq,e.Ety,el_var(stmp),e);
elem *er = el_bin(OPcomma,e.Ety,eeq,el_var(stmp));
if (ty == TYstruct || ty == TYarray)
{
eeq.Eoper = OPstreq;
eeq.ET = e.ET;
eeq.EV.E1.ET = e.ET;
er.ET = e.ET;
er.EV.E2.ET = e.ET;
}
return er;
}
/*************************
* Similar to el_copytree(e). But if e has any side effects, it's replaced
* with (tmp = e) and tmp is returned.
*/
@trusted
elem * el_same(elem **pe)
{
elem *e = *pe;
if (e && el_sideeffect(e))
{
*pe = exp2_copytotemp(e); /* convert to ((tmp=e),tmp) */
e = (*pe).EV.E2; /* point at tmp */
}
return el_copytree(e);
}
/*************************
* Thin wrapper of exp2_copytotemp. Different from el_same,
* always makes a temporary.
*/
@trusted
elem *el_copytotmp(elem **pe)
{
//printf("copytotemp()\n");
elem *e = *pe;
if (e)
{
*pe = exp2_copytotemp(e);
e = (*pe).EV.E2;
}
return el_copytree(e);
}
/*************************************
* Does symbol s appear in tree e?
* Returns:
* 1 yes
* 0 no
*/
@trusted
int el_appears(const(elem)* e, const Symbol *s)
{
symbol_debug(s);
while (1)
{
elem_debug(e);
if (!OTleaf(e.Eoper))
{
if (OTbinary(e.Eoper) && el_appears(e.EV.E2,s))
return 1;
e = e.EV.E1;
}
else
{
switch (e.Eoper)
{
case OPvar:
case OPrelconst:
if (e.EV.Vsym == s)
return 1;
break;
default:
break;
}
break;
}
}
return 0;
}
/*****************************************
* Look for symbol that is a base of addressing mode e.
* Returns:
* s symbol used as base
* null couldn't find a base symbol
*/
static if (0)
{
Symbol *el_basesym(elem *e)
{
Symbol *s;
s = null;
while (1)
{
elem_debug(e);
switch (e.Eoper)
{
case OPvar:
s = e.EV.Vsym;
break;
case OPcomma:
e = e.EV.E2;
continue;
case OPind:
s = el_basesym(e.EV.E1);
break;
case OPadd:
s = el_basesym(e.EV.E1);
if (!s)
s = el_basesym(e.EV.E2);
break;
}
break;
}
return s;
}
}
/****************************************
* Does any definition of lvalue ed appear in e?
* Returns:
* true if there is one
*/
@trusted
bool el_anydef(const elem *ed, const(elem)* e)
{
const edop = ed.Eoper;
const s = (edop == OPvar) ? ed.EV.Vsym : null;
while (1)
{
const op = e.Eoper;
if (!OTleaf(op))
{
auto e1 = e.EV.E1;
if (OTdef(op))
{
if (e1.Eoper == OPvar && e1.EV.Vsym == s)
return true;
// This doesn't cover all the cases
if (e1.Eoper == edop && el_match(e1,ed))
return true;
}
if (OTbinary(op) && el_anydef(ed,e.EV.E2))
return true;
e = e1;
}
else
break;
}
return false;
}
/************************
* Make a binary operator node.
*/
@trusted
elem* el_bint(OPER op,type *t,elem *e1,elem *e2)
{
elem *e;
/* e2 is null when OPpostinc is built */
assert(op < OPMAX && OTbinary(op) && e1);
assert(PARSER);
e = el_calloc();
if (t)
{
e.ET = t;
type_debug(t);
e.ET.Tcount++;
}
e.Eoper = cast(ubyte)op;
elem_debug(e1);
if (e2)
elem_debug(e2);
e.EV.E1 = e1;
e.EV.E2 = e2;
return e;
}
@trusted
elem* el_bin(OPER op,tym_t ty,elem *e1,elem *e2)
{
static if (0)
{
if (!(op < OPMAX && OTbinary(op) && e1 && e2))
*cast(char *)0=0;
}
assert(op < OPMAX && OTbinary(op) && e1 && e2);
elem_debug(e1);
elem_debug(e2);
elem* e = el_calloc();
e.Ety = ty;
e.Eoper = cast(ubyte)op;
e.EV.E1 = e1;
e.EV.E2 = e2;
if (op == OPcomma && tyaggregate(ty))
e.ET = e2.ET;
return e;
}
/************************
* Make a unary operator node.
*/
@trusted
elem* el_unat(OPER op,type *t,elem *e1)
{
debug if (!(op < OPMAX && OTunary(op) && e1))
printf("op = x%x, e1 = %p\n",op,e1);
assert(op < OPMAX && OTunary(op) && e1);
assert(PARSER);
elem_debug(e1);
elem* e = el_calloc();
e.Eoper = cast(ubyte)op;
e.EV.E1 = e1;
if (t)
{
type_debug(t);
t.Tcount++;
e.ET = t;
}
return e;
}
@trusted
elem* el_una(OPER op,tym_t ty,elem *e1)
{
debug if (!(op < OPMAX && OTunary(op) && e1))
printf("op = x%x, e1 = %p\n",op,e1);
assert(op < OPMAX && OTunary(op) && e1);
elem_debug(e1);
elem* e = el_calloc();
e.Ety = ty;
e.Eoper = cast(ubyte)op;
e.EV.E1 = e1;
return e;
}
/*******************
* Make a constant node out of integral type.
*/
@trusted
extern (C) elem * el_longt(type *t,targ_llong val)
{
assert(PARSER);
elem* e = el_calloc();
e.Eoper = OPconst;
e.ET = t;
if (e.ET)
{
type_debug(t);
e.ET.Tcount++;
}
e.EV.Vllong = val;
return e;
}
extern (C) // necessary because D <=> C++ mangling of "long long" is not consistent across memory models
{
elem * el_long(tym_t t,targ_llong val)
{
elem* e = el_calloc();
e.Eoper = OPconst;
e.Ety = t;
switch (tybasic(t))
{
case TYfloat:
case TYifloat:
e.EV.Vfloat = val;
break;
case TYdouble:
case TYidouble:
e.EV.Vdouble = val;
break;
case TYldouble:
case TYildouble:
e.EV.Vldouble = val;
break;
case TYcfloat:
case TYcdouble:
case TYcldouble:
assert(0);
default:
e.EV.Vllong = val;
break;
}
return e;
}
/******************************
* Create a const integer vector elem
* Params:
* ty = type of the vector
* val = value to broadcast to the vector elements
* Returns:
* created OPconst elem
*/
@trusted
elem* el_vectorConst(tym_t ty, ulong val)
{
elem* e = el_calloc();
e.Eoper = OPconst;
e.Ety = ty;
const sz = tysize(ty);
if (val == 0 || !((val & 0xFF) + 1))
{
memset(&e.EV, cast(ubyte)val, sz);
return e;
}
switch (tybasic(ty))
{
case TYschar16:
case TYuchar16:
case TYschar32:
case TYuchar32:
foreach (i; 0 .. sz)
{
e.EV.Vuchar32[i] = cast(ubyte)val;
}
break;
case TYshort8:
case TYushort8:
case TYshort16:
case TYushort16:
foreach (i; 0 .. sz / 2)
{
e.EV.Vushort16[i] = cast(ushort)val;
}
break;
case TYlong4:
case TYulong4:
case TYlong8:
case TYulong8:
foreach (i; 0 .. sz / 4)
{
e.EV.Vulong8[i] = cast(uint)val;
}
break;
case TYllong2:
case TYullong2:
case TYllong4:
case TYullong4:
foreach (i; 0 .. sz / 8)
{
e.EV.Vullong4[i] = val;
}
break;
default:
assert(0);
}
return e;
}
}
/*******************************
* Set new type for elem.
*/
elem * el_settype(elem *e,type *t)
{
assert(0);
}
/*******************************
* Create elem that is the size of a type.
*/
elem * el_typesize(type *t)
{
assert(0);
}
/************************************
* Returns: true if function has any side effects.
*/
@trusted
bool el_funcsideeff(const elem *e)
{
const(Symbol)* s;
if (e.Eoper == OPvar &&
tyfunc((s = e.EV.Vsym).Stype.Tty) &&
((s.Sfunc && s.Sfunc.Fflags3 & Fnosideeff) || s == funcsym_p)
)
return false;
return true; // assume it does have side effects
}
/****************************
* Returns: true if elem has any side effects.
*/
@trusted
bool el_sideeffect(const elem *e)
{
assert(e);
const op = e.Eoper;
assert(op < OPMAX);
elem_debug(e);
return typemask(e) & (mTYvolatile | mTYshared) ||
OTsideff(op) ||
(OTunary(op) && el_sideeffect(e.EV.E1)) ||
(OTbinary(op) && (el_sideeffect(e.EV.E1) ||
el_sideeffect(e.EV.E2)));
}
/******************************
* Input:
* ea lvalue (might be an OPbit)
* Returns:
* 0 eb has no dependency on ea
* 1 eb might have a dependency on ea
* 2 eb definitely depends on ea
*/
@trusted
int el_depends(const(elem)* ea, const elem *eb)
{
L1:
elem_debug(ea);
elem_debug(eb);
switch (ea.Eoper)
{
case OPbit:
ea = ea.EV.E1;
goto L1;
case OPvar:
case OPind:
break;
default:
assert(0);
}
switch (eb.Eoper)
{
case OPconst:
case OPrelconst:
case OPstring:
goto Lnodep;
case OPvar:
if (ea.Eoper == OPvar && ea.EV.Vsym != eb.EV.Vsym)
goto Lnodep;
break;
default:
break; // this could use improvement
}
return 1;
Lnodep:
return 0;
}
/*************************
* Returns:
* true elem evaluates right-to-left
* false elem evaluates left-to-right
*/
@trusted
bool ERTOL(const elem *e)
{
elem_debug(e);
assert(!PARSER);
return OTrtol(e.Eoper) &&
(!OTopeq(e.Eoper) || config.inline8087 || !tyfloating(e.Ety));
}
/********************************
* Determine if expression may return.
* Does not detect all cases, errs on the side of saying it returns.
* Params:
* e = tree
* Returns:
* false if expression never returns.
*/
@trusted
bool el_returns(const(elem)* e)
{
while (1)
{
elem_debug(e);
switch (e.Eoper)
{
case OPcall:
case OPucall:
e = e.EV.E1;
if (e.Eoper == OPvar && e.EV.Vsym.Sflags & SFLexit)
return false;
break;
case OPhalt:
return false;
case OPandand:
case OPoror:
e = e.EV.E1;
continue;
case OPcolon:
case OPcolon2:
return el_returns(e.EV.E1) || el_returns(e.EV.E2);
default:
if (OTbinary(e.Eoper))
{
if (!el_returns(e.EV.E2))
return false;
e = e.EV.E1;
continue;
}
if (OTunary(e.Eoper))
{
e = e.EV.E1;
continue;
}
break;
}
break;
}
return true;
}
/********************************
* Scan down commas and return the controlling elem.
*/
@trusted
elem *el_scancommas(elem *e)
{
while (e.Eoper == OPcomma)
e = e.EV.E2;
return e;
}
/***************************
* Count number of commas in the expression.
*/
@trusted
int el_countCommas(const(elem)* e)
{
int ncommas = 0;
while (1)
{
if (OTbinary(e.Eoper))
{
ncommas += (e.Eoper == OPcomma) + el_countCommas(e.EV.E2);
}
else if (OTunary(e.Eoper))
{
}
else
break;
e = e.EV.E1;
}
return ncommas;
}
/************************************
* Convert floating point constant to a read-only symbol.
* Needed iff floating point code can't load immediate constants.
*/
@trusted
elem *el_convfloat(elem *e)
{
ubyte[32] buffer = void;
assert(config.inline8087);
// Do not convert if the constants can be loaded with the special FPU instructions
if (tycomplex(e.Ety))
{
if (loadconst(e, 0) && loadconst(e, 1))
return e;
}
else if (loadconst(e, 0))
return e;
go.changes++;
tym_t ty = e.Ety;
int sz = tysize(ty);
assert(sz <= buffer.length);
void *p;
switch (tybasic(ty))
{
case TYfloat:
case TYifloat:
p = &e.EV.Vfloat;
assert(sz == (e.EV.Vfloat).sizeof);
break;
case TYdouble:
case TYidouble:
case TYdouble_alias:
p = &e.EV.Vdouble;
assert(sz == (e.EV.Vdouble).sizeof);
break;
case TYldouble:
case TYildouble:
/* The size, alignment, and padding of long doubles may be different
* from host to target
*/
p = buffer.ptr;
memset(buffer.ptr, 0, sz); // ensure padding is 0
memcpy(buffer.ptr, &e.EV.Vldouble, 10);
break;
case TYcfloat:
p = &e.EV.Vcfloat;
assert(sz == (e.EV.Vcfloat).sizeof);
break;
case TYcdouble:
p = &e.EV.Vcdouble;
assert(sz == (e.EV.Vcdouble).sizeof);
break;
case TYcldouble:
p = buffer.ptr;
memset(buffer.ptr, 0, sz);
memcpy(buffer.ptr, &e.EV.Vcldouble.re, 10);
memcpy(buffer.ptr + tysize(TYldouble), &e.EV.Vcldouble.im, 10);
break;
default:
assert(0);
}
static if (0)
{
printf("%gL+%gLi\n", cast(double)e.EV.Vcldouble.re, cast(double)e.EV.Vcldouble.im);
printf("el_convfloat() %g %g sz=%d\n", e.EV.Vcdouble.re, e.EV.Vcdouble.im, sz);
printf("el_convfloat(): sz = %d\n", sz);
ushort *p = cast(ushort *)&e.EV.Vcldouble;
for (int i = 0; i < sz/2; i++) printf("%04x ", p[i]);
printf("\n");
}
Symbol *s = out_readonly_sym(ty, p, sz);
el_free(e);
e = el_var(s);
e.Ety = ty;
if (e.Eoper == OPvar)
e.Ety |= mTYconst;
//printf("s: %s %d:x%x\n", s.Sident, s.Sseg, s.Soffset);
return e;
}
/************************************
* Convert vector constant to a read-only symbol.
* Needed iff vector code can't load immediate constants.
*/
@trusted
elem *el_convxmm(elem *e)
{
ubyte[eve.sizeof] buffer = void;
// Do not convert if the constants can be loaded with the special XMM instructions
if (loadxmmconst(e))
return e;
go.changes++;
tym_t ty = e.Ety;
int sz = tysize(ty);
assert(sz <= buffer.length);
void *p = &e.EV;
static if (0)
{
printf("el_convxmm(): sz = %d\n", sz);
for (size i = 0; i < sz; i++) printf("%02x ", (cast(ubyte *)p)[i]);
printf("\n");
}
Symbol *s = out_readonly_sym(ty, p, sz);
el_free(e);
e = el_var(s);
e.Ety = ty;
if (e.Eoper == OPvar)
e.Ety |= mTYconst;
//printf("s: %s %d:x%x\n", s.Sident, s.Sseg, s.Soffset);
return e;
}
/********************************
* Convert reference to a string to reference to a symbol
* stored in the static data segment.
*/
@trusted
elem *el_convstring(elem *e)
{
//printf("el_convstring()\n");
int i;
Symbol *s;
char *p;
assert(!PARSER);
elem_debug(e);
assert(e.Eoper == OPstring);
p = e.EV.Vstring;
e.EV.Vstring = null;
size_t len = e.EV.Vstrlen;
// Handle strings that go into the code segment
if (tybasic(e.Ety) == TYcptr ||
(tyfv(e.Ety) && config.flags3 & CFG3strcod))
{
assert(config.objfmt == OBJ_OMF); // option not done yet for others
s = symbol_generate(SC.static_, type_fake(mTYcs | e.Ety));
s.Sfl = FLcsdata;
s.Soffset = Offset(cseg);
s.Sseg = cseg;
symbol_keep(s);
if (!eecontext.EEcompile || eecontext.EEin)
{
objmod.bytes(cseg,Offset(cseg),cast(uint)len,p);
Offset(cseg) += len;
}
mem_free(p);
goto L1;
}
if (eecontext.EEin) // if compiling debugger expression
{
s = out_readonly_sym(e.Ety, p, cast(int)len);
mem_free(p);
goto L1;
}
// See if e is already in the string table
for (i = 0; i < stable.length; i++)
{
if (stable[i].str.length == len &&
memcmp(stable[i].str.ptr,p,len) == 0)
{
// Replace e with that symbol
mem_free(p);
s = stable[i].sym;
goto L1;
}
}
// Replace string with a symbol that refers to that string
// in the DATA segment
if (eecontext.EEcompile)
{
s = symboldata(Offset(DATA),e.Ety);
s.Sseg = DATA;
}
else
s = out_readonly_sym(e.Ety,p,cast(int)len);
// Remember the string for possible reuse later
//printf("Adding %d, '%s'\n",stable_si,p);
mem_free(stable[stable_si].str.ptr);
stable[stable_si].str = p[0 .. cast(size_t)len];
stable[stable_si].sym = s;
stable_si = (stable_si + 1) & (stable.length - 1);
L1:
// Refer e to the symbol generated
elem *ex = el_ptr(s);
ex.Ety = e.Ety;
if (e.EV.Voffset)
{
if (ex.Eoper == OPrelconst)
ex.EV.Voffset += e.EV.Voffset;
else
ex = el_bin(OPadd, ex.Ety, ex, el_long(TYint, e.EV.Voffset));
}
el_free(e);
return ex;
}
/********************************************
* If e is a long double constant, and it is perfectly representable as a
* double constant, convert it to a double constant.
* Note that this must NOT be done in contexts where there are no further
* operations, since then it could change the type (eg, in the function call
* printf("%La", 2.0L); the 2.0 must stay as a long double).
*/
static if (1)
{
@trusted
void shrinkLongDoubleConstantIfPossible(elem *e)
{
if (e.Eoper == OPconst && e.Ety == TYldouble)
{
/* Check to see if it can be converted into a double (this happens
* when the low bits are all zero, and the exponent is in the
* double range).
* Use 'volatile' to prevent optimizer from folding away the conversions,
* and thereby missing the truncation in the conversion to double.
*/
auto v = e.EV.Vldouble;
double vDouble;
version (CRuntime_Microsoft)
{
static if (is(typeof(v) == real))
*(&vDouble) = v;
else
*(&vDouble) = cast(double)v;
}
else
*(&vDouble) = v;
if (v == vDouble) // This will fail if compiler does NaN incorrectly!
{
// Yes, we can do it!
e.EV.Vdouble = vDouble;
e.Ety = TYdouble;
}
}
}
}
/*************************
* Run through a tree converting it to CODGEN.
*/
@trusted
elem *el_convert(elem *e)
{
//printf("el_convert(%p)\n", e);
elem_debug(e);
const op = e.Eoper;
switch (op)
{
case OPvar:
break;
case OPconst:
if (tyvector(e.Ety))
e = el_convxmm(e);
else if (tyfloating(e.Ety) && config.inline8087)
e = el_convfloat(e);
break;
case OPstring:
go.changes++;
e = el_convstring(e);
break;
case OPnullptr:
e = el_long(e.Ety, 0);
break;
case OPmul:
/* special floating-point case: allow x*2 to be x+x
* in this case, we preserve the constant 2.
*/
if (tyreal(e.Ety) && // don't bother with imaginary or complex
e.EV.E2.Eoper == OPconst && el_toldoubled(e.EV.E2) == 2.0L)
{
e.EV.E1 = el_convert(e.EV.E1);
/* Don't call el_convert(e.EV.E2), we want it to stay as a constant
* which will be detected by code gen.
*/
break;
}
goto case OPdiv;
case OPdiv:
case OPadd:
case OPmin:
// For a*b,a+b,a-b,a/b, if a long double constant is involved, convert it to a double constant.
if (tyreal(e.Ety))
shrinkLongDoubleConstantIfPossible(e.EV.E1);
if (tyreal(e.Ety))
shrinkLongDoubleConstantIfPossible(e.EV.E2);
goto default;
default:
if (OTbinary(op))
{
e.EV.E1 = el_convert(e.EV.E1);
e.EV.E2 = el_convert(e.EV.E2);
}
else if (OTunary(op))
{
e.EV.E1 = el_convert(e.EV.E1);
}
break;
}
return e;
}
/************************
* Make a constant elem.
* ty = type of elem
* *pconst = union of constant data
*/
@trusted
elem * el_const(tym_t ty, eve *pconst)
{
elem *e;
e = el_calloc();
e.Eoper = OPconst;
e.Ety = ty;
memcpy(&e.EV,pconst,(e.EV).sizeof);
return e;
}
/**************************
* Insert constructor information into tree.
* A corresponding el_ddtor() must be called later.
* Params:
* e = code to construct the object
* decl = VarDeclaration of variable being constructed
*/
static if (0)
{
elem *el_dctor(elem *e,void *decl)
{
elem *ector = el_calloc();
ector.Eoper = OPdctor;
ector.Ety = TYvoid;
ector.EV.ed.Edecl = decl;
if (e)
e = el_bin(OPinfo,e.Ety,ector,e);
else
/* Remember that a "constructor" may execute no code, hence
* the need for OPinfo if there is code to execute.
*/
e = ector;
return e;
}
}
/**************************
* Insert destructor information into tree.
* e code to destruct the object
* decl VarDeclaration of variable being destructed
* (must match decl for corresponding OPctor)
*/
static if (0)
{
elem *el_ddtor(elem *e,void *decl)
{
/* A destructor always executes code, or we wouldn't need
* eh for it.
* An OPddtor must match 1:1 with an OPdctor
*/
elem *edtor = el_calloc();
edtor.Eoper = OPddtor;
edtor.Ety = TYvoid;
edtor.EV.ed.Edecl = decl;
edtor.EV.ed.Eleft = e;
return edtor;
}
}
/*********************************************
* Create constructor/destructor pair of elems.
* Caution: The pattern generated here must match that detected in e2ir.c's visit(CallExp).
* Params:
* ec = code to construct (may be null)
* ed = code to destruct
* pedtor = set to destructor node
* Returns:
* constructor node
*/
@trusted
elem *el_ctor_dtor(elem *ec, elem *ed, elem **pedtor)
{
elem *er;
if (config.ehmethod == EHmethod.EH_DWARF)
{
/* Construct (note that OPinfo is evaluated RTOL):
* er = (OPdctor OPinfo (__flag = 0, ec))
* edtor = __flag = 1, (OPddtor ((__exception_object = _EAX), ed, (!__flag && _Unsafe_Resume(__exception_object))))
*/
/* Declare __flag, __EAX, __exception_object variables.
* Use volatile to prevent optimizer from messing them up, since optimizer doesn't know about
* landing pads (the landing pad will be on the OPddtor's EV.ed.Eleft)
*/
Symbol *sflag = symbol_name("__flag", SC.auto_, type_fake(mTYvolatile | TYbool));
Symbol *sreg = symbol_name("__EAX", SC.pseudo, type_fake(mTYvolatile | TYnptr));
sreg.Sreglsw = 0; // EAX, RAX, whatevs
Symbol *seo = symbol_name("__exception_object", SC.auto_, tspvoid);
symbol_add(sflag);
symbol_add(sreg);
symbol_add(seo);
elem *ector = el_calloc();
ector.Eoper = OPdctor;
ector.Ety = TYvoid;
// ector.EV.ed.Edecl = decl;
eve c = void;
memset(&c, 0, c.sizeof);
elem *e_flag_0 = el_bin(OPeq, TYvoid, el_var(sflag), el_const(TYbool, &c)); // __flag = 0
er = el_bin(OPinfo, ec ? ec.Ety : TYvoid, ector, el_combine(e_flag_0, ec));
/* A destructor always executes code, or we wouldn't need
* eh for it.
* An OPddtor must match 1:1 with an OPdctor
*/
elem *edtor = el_calloc();
edtor.Eoper = OPddtor;
edtor.Ety = TYvoid;
// edtor.EV.Edecl = decl;
// edtor.EV.E1 = e;
c.Vint = 1;
elem *e_flag_1 = el_bin(OPeq, TYvoid, el_var(sflag), el_const(TYbool, &c)); // __flag = 1
elem *e_eax = el_bin(OPeq, TYvoid, el_var(seo), el_var(sreg)); // __exception_object = __EAX
elem *eu = el_bin(OPcall, TYvoid, el_var(getRtlsym(RTLSYM.UNWIND_RESUME)), el_var(seo));
eu = el_bin(OPandand, TYvoid, el_una(OPnot, TYbool, el_var(sflag)), eu);
edtor.EV.E1 = el_combine(el_combine(e_eax, ed), eu);
*pedtor = el_combine(e_flag_1, edtor);
}
else
{
/* Construct (note that OPinfo is evaluated RTOL):
* er = (OPdctor OPinfo ec)
* edtor = (OPddtor ed)
*/
elem *ector = el_calloc();
ector.Eoper = OPdctor;
ector.Ety = TYvoid;
// ector.EV.ed.Edecl = decl;
if (ec)
er = el_bin(OPinfo,ec.Ety,ector,ec);
else
/* Remember that a "constructor" may execute no code, hence
* the need for OPinfo if there is code to execute.
*/
er = ector;
/* A destructor always executes code, or we wouldn't need
* eh for it.
* An OPddtor must match 1:1 with an OPdctor
*/
elem *edtor = el_calloc();
edtor.Eoper = OPddtor;
edtor.Ety = TYvoid;
// edtor.EV.Edecl = decl;
edtor.EV.E1 = ed;
*pedtor = edtor;
}
return er;
}
/**************************
* Insert destructor information into tree.
* edtor pointer to object being destructed
* e code to do the destruction
*/
elem *el_dtor(elem *edtor,elem *e)
{
if (edtor)
{
edtor = el_unat(OPdtor,edtor.ET,edtor);
if (e)
e = el_bint(OPcomma,e.ET,edtor,e);
else
e = edtor;
}
return e;
}
/**********************************
* Create an elem of the constant 0, of the type t.
*/
@trusted
elem *el_zero(type *t)
{
assert(PARSER);
elem* e = el_calloc();
e.Eoper = OPconst;
e.ET = t;
if (t)
{
type_debug(t);
e.ET.Tcount++;
}
return(e);
}
/*******************
* Find and return pointer to parent of e starting at *pe.
* Return null if can't find it.
*/
@trusted
elem ** el_parent(elem *e,elem **pe)
{
assert(e && pe && *pe);
elem_debug(e);
elem_debug(*pe);
if (e == *pe)
return pe;
else if (OTunary((*pe).Eoper))
return el_parent(e,&((*pe).EV.E1));
else if (OTbinary((*pe).Eoper))
{
elem **pe2;
return ((pe2 = el_parent(e,&((*pe).EV.E1))) != null)
? pe2
: el_parent(e,&((*pe).EV.E2));
}
else
return null;
}
/*******************************
* Returns: true if trees match.
*/
@trusted
private bool el_matchx(const(elem)* n1, const(elem)* n2, int gmatch2)
{
if (n1 == n2)
return true;
if (!n1 || !n2)
return false;
elem_debug(n1);
elem_debug(n2);
L1:
const op = n1.Eoper;
if (op != n2.Eoper)
return false;
auto tym = typemask(n1);
auto tym2 = typemask(n2);
if (tym != tym2)
{
if ((tym & ~mTYbasic) != (tym2 & ~mTYbasic))
{
if (!(gmatch2 & 2))
return false;
}
tym = tybasic(tym);
tym2 = tybasic(tym2);
if (tyequiv[tym] != tyequiv[tym2] &&
!((gmatch2 & 8) && touns(tym) == touns(tym2))
)
return false;
gmatch2 &= ~8;
}
if (OTunary(op))
{
L2:
if (PARSER)
{
n1 = n1.EV.E1;
n2 = n2.EV.E1;
assert(n1 && n2);
goto L1;
}
else if (OPTIMIZER)
{
if (op == OPstrpar || op == OPstrctor)
{ if (/*n1.Enumbytes != n2.Enumbytes ||*/ n1.ET != n2.ET)
return false;
}
n1 = n1.EV.E1;
n2 = n2.EV.E1;
assert(n1 && n2);
goto L1;
}
else
{
if (n1.EV.E1 == n2.EV.E1)
goto ismatch;
n1 = n1.EV.E1;
n2 = n2.EV.E1;
assert(n1 && n2);
goto L1;
}
}
else if (OTbinary(op))
{
if (!PARSER)
{
if (op == OPstreq)
{
if (/*n1.Enumbytes != n2.Enumbytes ||*/ n1.ET != n2.ET)
return false;
}
}
if (el_matchx(n1.EV.E2, n2.EV.E2, gmatch2))
{
goto L2; // check left tree
}
return false;
}
else /* leaf elem */
{
switch (op)
{
case OPconst:
if (gmatch2 & 1)
break;
Lagain:
switch (tybasic(tym))
{
case TYshort:
case TYwchar_t:
case TYushort:
case TYchar16:
case_short:
if (n1.EV.Vshort != n2.EV.Vshort)
return false;
break;
case TYlong:
case TYulong:
case TYdchar:
case_long:
if (n1.EV.Vlong != n2.EV.Vlong)
return false;
break;
case TYllong:
case TYullong:
case_llong:
if (n1.EV.Vllong != n2.EV.Vllong)
return false;
break;
case TYcent:
case TYucent:
if (n1.EV.Vcent != n2.EV.Vcent)
return false;
break;
case TYenum:
if (PARSER)
{ tym = n1.ET.Tnext.Tty;
goto Lagain;
}
goto case TYuint;
case TYint:
case TYuint:
if (_tysize[TYint] == SHORTSIZE)
goto case_short;
else
goto case_long;
case TYnullptr:
case TYnptr:
case TYnref:
case TYsptr:
case TYcptr:
case TYimmutPtr:
case TYsharePtr:
case TYrestrictPtr:
case TYfgPtr:
if (_tysize[TYnptr] == SHORTSIZE)
goto case_short;
else if (_tysize[TYnptr] == LONGSIZE)
goto case_long;
else
{ assert(_tysize[TYnptr] == LLONGSIZE);
goto case_llong;
}
case TYbool:
case TYchar:
case TYuchar:
case TYschar:
if (n1.EV.Vschar != n2.EV.Vschar)
return false;
break;
case TYfptr:
case TYhptr:
case TYvptr:
/* Far pointers on the 386 are longer than
any integral type...
*/
if (memcmp(&n1.EV, &n2.EV, tysize(tym)))
return false;
break;
/* Compare bit patterns w/o worrying about
exceptions, unordered comparisons, etc.
*/
case TYfloat:
case TYifloat:
if (memcmp(&n1.EV,&n2.EV,(n1.EV.Vfloat).sizeof))
return false;
break;
case TYdouble:
case TYdouble_alias:
case TYidouble:
if (memcmp(&n1.EV,&n2.EV,(n1.EV.Vdouble).sizeof))
return false;
break;
case TYldouble:
case TYildouble:
static if ((n1.EV.Vldouble).sizeof > 10)
{
/* sizeof is 12, but actual size is 10 */
if (memcmp(&n1.EV,&n2.EV,10))
return false;
}
else
{
if (memcmp(&n1.EV,&n2.EV,(n1.EV.Vldouble).sizeof))
return false;
}
break;
case TYcfloat:
if (memcmp(&n1.EV,&n2.EV,(n1.EV.Vcfloat).sizeof))
return false;
break;
case TYcdouble:
if (memcmp(&n1.EV,&n2.EV,(n1.EV.Vcdouble).sizeof))
return false;
break;
case TYfloat4:
case TYdouble2:
case TYschar16:
case TYuchar16:
case TYshort8:
case TYushort8:
case TYlong4:
case TYulong4:
case TYllong2:
case TYullong2:
if (n1.EV.Vcent != n2.EV.Vcent)
return false;
break;
case TYfloat8:
case TYdouble4:
case TYschar32:
case TYuchar32:
case TYshort16:
case TYushort16:
case TYlong8:
case TYulong8:
case TYllong4:
case TYullong4:
if (memcmp(&n1.EV,&n2.EV,32)) // 32 byte vector types (256 bit)
return false;
break;
case TYcldouble:
static if ((n1.EV.Vldouble).sizeof > 10)
{
/* sizeof is 12, but actual size of each part is 10 */
if (memcmp(&n1.EV,&n2.EV,10) ||
memcmp(&n1.EV.Vldouble + 1, &n2.EV.Vldouble + 1, 10))
return false;
}
else
{
if (memcmp(&n1.EV,&n2.EV,(n1.EV.Vcldouble).sizeof))
return false;
}
break;
case TYvoid:
break; // voids always match
default:
elem_print(n1);
assert(0);
}
break;
case OPrelconst:
case OPvar:
symbol_debug(n1.EV.Vsym);
symbol_debug(n2.EV.Vsym);
if (n1.EV.Voffset != n2.EV.Voffset)
return false;
if (n1.EV.Vsym != n2.EV.Vsym)
return false;
break;
case OPasm:
case OPstring:
{
const n = n2.EV.Vstrlen;
if (n1.EV.Vstrlen != n ||
n1.EV.Voffset != n2.EV.Voffset ||
memcmp(n1.EV.Vstring, n2.EV.Vstring, n))
return false; /* check bytes in the string */
break;
}
case OPstrthis:
case OPframeptr:
case OPhalt:
case OPgot:
break;
default:
printf("op: %s\n", oper_str(op));
assert(0);
}
ismatch:
return true;
}
assert(0);
}
/*******************************
* Returns: true if trees match.
*/
bool el_match(const elem* n1, const elem* n2)
{
return el_matchx(n1, n2, 0);
}
/*********************************
* Kludge on el_match(). Same, but ignore differences in OPconst.
*/
bool el_match2(const elem* n1, const elem* n2)
{
return el_matchx(n1,n2,1);
}
/*********************************
* Kludge on el_match(). Same, but ignore differences in type modifiers.
*/
bool el_match3(const elem* n1, const elem* n2)
{
return el_matchx(n1,n2,2);
}
/*********************************
* Kludge on el_match(). Same, but ignore differences in spelling of var's.
*/
bool el_match4(const elem* n1, const elem* n2)
{
return el_matchx(n1,n2,2|4);
}
/*********************************
* Kludge on el_match(). Same, but regard signed/unsigned as equivalent.
*/
bool el_match5(const elem* n1, const elem* n2)
{
return el_matchx(n1,n2,8);
}
/******************************
* Extract long value from constant parser elem.
*/
@trusted
targ_llong el_tolongt(elem *e)
{
const parsersave = PARSER;
PARSER = 1;
const result = el_tolong(e);
PARSER = parsersave;
return result;
}
/******************************
* Extract long value from constant elem.
*/
@trusted
targ_llong el_tolong(elem *e)
{
elem_debug(e);
if (e.Eoper != OPconst)
elem_print(e);
assert(e.Eoper == OPconst);
auto ty = tybasic(typemask(e));
targ_llong result;
switch (ty)
{
case TYchar:
if (config.flags & CFGuchar)
goto Uchar;
goto case TYschar;
case TYschar:
result = e.EV.Vschar;
break;
case TYuchar:
case TYbool:
Uchar:
result = e.EV.Vuchar;
break;
case TYshort:
Ishort:
result = e.EV.Vshort;
break;
case TYushort:
case TYwchar_t:
case TYchar16:
Ushort:
result = e.EV.Vushort;
break;
case TYsptr:
case TYcptr:
case TYnptr:
case TYnullptr:
case TYnref:
case TYimmutPtr:
case TYsharePtr:
case TYrestrictPtr:
case TYfgPtr:
if (_tysize[TYnptr] == SHORTSIZE)
goto Ushort;
if (_tysize[TYnptr] == LONGSIZE)
goto Ulong;
if (_tysize[TYnptr] == LLONGSIZE)
goto Ullong;
assert(0);
case TYuint:
if (_tysize[TYint] == SHORTSIZE)
goto Ushort;
goto Ulong;
case TYulong:
case TYdchar:
case TYfptr:
case TYhptr:
case TYvptr:
case TYvoid: /* some odd cases */
Ulong:
result = e.EV.Vulong;
break;
case TYint:
if (_tysize[TYint] == SHORTSIZE)
goto Ishort;
goto Ilong;
case TYlong:
Ilong:
result = e.EV.Vlong;
break;
case TYllong:
case TYullong:
Ullong:
result = e.EV.Vullong;
break;
case TYdouble_alias:
case TYldouble:
case TYdouble:
case TYfloat:
case TYildouble:
case TYidouble:
case TYifloat:
case TYcldouble:
case TYcdouble:
case TYcfloat:
result = cast(targ_llong)el_toldoubled(e);
break;
case TYcent:
case TYucent:
goto Ullong; // should do better than this when actually doing arithmetic on cents
default:
elem_print(e);
assert(0);
}
return result;
}
/***********************************
* Determine if constant e is all ones or all zeros.
* Params:
* e = elem to test
* bit = 0: all zeros
* 1: 1
* -1: all ones
* Returns:
* true if it is
*/
bool el_allbits(const elem* e,int bit)
{
elem_debug(e);
assert(e.Eoper == OPconst);
targ_llong value = e.EV.Vullong;
switch (tysize(e.Ety))
{
case 1: value = cast(byte) value;
break;
case 2: value = cast(short) value;
break;
case 4: value = cast(int) value;
break;
case 8: break;
default:
assert(0);
}
if (bit == -1)
value++;
else if (bit == 1)
value--;
return value == 0;
}
/********************************************
* Determine if constant e is a 32 bit or less value, or is a 32 bit value sign extended to 64 bits.
*/
bool el_signx32(const elem* e)
{
elem_debug(e);
assert(e.Eoper == OPconst);
if (tysize(e.Ety) == 8)
{
if (e.EV.Vullong != cast(int)e.EV.Vullong)
return false;
}
return true;
}
/******************************
* Extract long double value from constant elem.
* Silently ignore types which are not floating point values.
*/
version (CRuntime_Microsoft)
{
longdouble_soft el_toldouble(elem *e)
{
longdouble_soft result;
elem_debug(e);
assert(e.Eoper == OPconst);
switch (tybasic(typemask(e)))
{
case TYfloat:
case TYifloat:
result = longdouble_soft(e.EV.Vfloat);
break;
case TYdouble:
case TYidouble:
case TYdouble_alias:
result = longdouble_soft(e.EV.Vdouble);
break;
case TYldouble:
case TYildouble:
static if (is(typeof(e.EV.Vldouble) == real))
result = longdouble_soft(e.EV.Vldouble);
else
result = longdouble_soft(cast(real)e.EV.Vldouble);
break;
default:
result = longdouble_soft(0);
break;
}
return result;
}
}
else
{
targ_ldouble el_toldouble(elem *e)
{
targ_ldouble result;
elem_debug(e);
assert(e.Eoper == OPconst);
switch (tybasic(typemask(e)))
{
case TYfloat:
case TYifloat:
result = e.EV.Vfloat;
break;
case TYdouble:
case TYidouble:
case TYdouble_alias:
result = e.EV.Vdouble;
break;
case TYldouble:
case TYildouble:
result = e.EV.Vldouble;
break;
default:
result = 0;
break;
}
return result;
}
}
/********************************
* Is elem type-dependent or value-dependent?
* Returns: true if so
*/
@trusted
bool el_isdependent(elem* e)
{
if (type_isdependent(e.ET))
return true;
while (1)
{
if (e.PEFflags & PEFdependent)
return true;
if (OTunary(e.Eoper))
e = e.EV.E1;
else if (OTbinary(e.Eoper))
{
if (el_isdependent(e.EV.E2))
return true;
e = e.EV.E1;
}
else
break;
}
return false;
}
/****************************************
* Returns: alignment size of elem e
*/
@trusted
uint el_alignsize(elem *e)
{
const tym = tybasic(e.Ety);
uint alignsize = tyalignsize(tym);
if (alignsize == cast(uint)-1 ||
(e.Ety & (mTYxmmgpr | mTYgprxmm)))
{
assert(e.ET);
alignsize = type_alignsize(e.ET);
}
return alignsize;
}
/*******************************
* Check for errors in a tree.
*/
debug
{
@trusted
void el_check(const(elem)* e)
{
elem_debug(e);
while (1)
{
if (OTunary(e.Eoper))
e = e.EV.E1;
else if (OTbinary(e.Eoper))
{
el_check(e.EV.E2);
e = e.EV.E1;
}
else
break;
}
}
}
/*******************************
* Write out expression elem.
*/
@trusted
void elem_print(const elem* e, int nestlevel = 0)
{
foreach (i; 0 .. nestlevel)
printf(" ");
printf("el:%p ",e);
if (!e)
{
printf("\n");
return;
}
elem_debug(e);
if (configv.addlinenumbers)
{
if (e.Esrcpos.Sfilename)
printf("%s(%u) ", e.Esrcpos.Sfilename, e.Esrcpos.Slinnum);
}
if (!PARSER)
{
printf("cnt=%d ",e.Ecount);
if (!OPTIMIZER)
printf("cs=%d ",e.Ecomsub);
}
printf("%s ", oper_str(e.Eoper));
enum scpp = false;
if (scpp && PARSER)
{
if (e.ET)
{
type_debug(e.ET);
if (tybasic(e.ET.Tty) == TYstruct)
printf("%d ", cast(int)type_size(e.ET));
printf("%s\n", tym_str(e.ET.Tty));
}
}
else
{
if ((e.Eoper == OPstrpar || e.Eoper == OPstrctor || e.Eoper == OPstreq) ||
e.Ety == TYstruct || e.Ety == TYarray)
if (e.ET)
printf("%d ", cast(int)type_size(e.ET));
printf("%s ", tym_str(e.Ety));
}
if (OTunary(e.Eoper))
{
if (e.EV.E2)
printf("%p %p\n",e.EV.E1,e.EV.E2);
else
printf("%p\n",e.EV.E1);
elem_print(e.EV.E1, nestlevel + 1);
}
else if (OTbinary(e.Eoper))
{
if (!PARSER && e.Eoper == OPstreq && e.ET)
printf("bytes=%d ", cast(int)type_size(e.ET));
printf("%p %p\n",e.EV.E1,e.EV.E2);
elem_print(e.EV.E1, nestlevel + 1);
elem_print(e.EV.E2, nestlevel + 1);
}
else
{
switch (e.Eoper)
{
case OPrelconst:
printf(" %lld+&",cast(ulong)e.EV.Voffset);
printf(" %s",e.EV.Vsym.Sident.ptr);
break;
case OPvar:
if (e.EV.Voffset)
printf(" %lld+",cast(ulong)e.EV.Voffset);
printf(" %s",e.EV.Vsym.Sident.ptr);
break;
case OPasm:
case OPstring:
printf(" '%s',%lld",e.EV.Vstring,cast(ulong)e.EV.Voffset);
break;
case OPconst:
elem_print_const(e);
break;
default:
break;
}
printf("\n");
}
}
@trusted
void elem_print_const(const elem* e)
{
assert(e.Eoper == OPconst);
tym_t tym = tybasic(typemask(e));
case_tym:
switch (tym)
{ case TYbool:
case TYchar:
case TYschar:
case TYuchar:
printf("%d ",e.EV.Vuchar);
break;
case TYsptr:
case TYcptr:
case TYnullptr:
case TYnptr:
case TYnref:
case TYimmutPtr:
case TYsharePtr:
case TYrestrictPtr:
case TYfgPtr:
if (_tysize[TYnptr] == LONGSIZE)
goto L1;
if (_tysize[TYnptr] == SHORTSIZE)
goto L3;
if (_tysize[TYnptr] == LLONGSIZE)
goto L2;
assert(0);
case TYenum:
if (PARSER)
{ tym = e.ET.Tnext.Tty;
goto case_tym;
}
goto case TYint;
case TYint:
case TYuint:
case TYvoid: /* in case (void)(1) */
if (tysize(TYint) == LONGSIZE)
goto L1;
goto case TYshort;
case TYshort:
case TYwchar_t:
case TYushort:
case TYchar16:
L3:
printf("%d ",e.EV.Vint);
break;
case TYlong:
case TYulong:
case TYdchar:
case TYfptr:
case TYvptr:
case TYhptr:
L1:
printf("%dL ",e.EV.Vlong);
break;
case TYllong:
L2:
printf("%lldLL ",cast(ulong)e.EV.Vllong);
break;
case TYullong:
printf("%lluLL ",cast(ulong)e.EV.Vullong);
break;
case TYcent:
case TYucent:
printf("%lluLL+%lluLL ", cast(ulong)e.EV.Vcent.hi, cast(ulong)e.EV.Vcent.lo);
break;
case TYfloat:
printf("%gf ",cast(double)e.EV.Vfloat);
break;
case TYdouble:
case TYdouble_alias:
printf("%g ",cast(double)e.EV.Vdouble);
break;
case TYldouble:
{
version (CRuntime_Microsoft)
{
const buffer_len = 3 + 3 * (targ_ldouble).sizeof + 1;
char[buffer_len] buffer = void;
static if (is(typeof(e.EV.Vldouble) == real))
ld_sprint(buffer.ptr, buffer_len, 'g', longdouble_soft(e.EV.Vldouble));
else
ld_sprint(buffer.ptr, buffer_len, 'g', longdouble_soft(cast(real)e.EV.Vldouble));
printf("%s ", buffer.ptr);
}
else
printf("%Lg ", e.EV.Vldouble);
break;
}
case TYifloat:
printf("%gfi ", cast(double)e.EV.Vfloat);
break;
case TYidouble:
printf("%gi ", cast(double)e.EV.Vdouble);
break;
case TYildouble:
printf("%gLi ", cast(double)e.EV.Vldouble);
break;
case TYcfloat:
printf("%gf+%gfi ", cast(double)e.EV.Vcfloat.re, cast(double)e.EV.Vcfloat.im);
break;
case TYcdouble:
printf("%g+%gi ", cast(double)e.EV.Vcdouble.re, cast(double)e.EV.Vcdouble.im);
break;
case TYcldouble:
printf("%gL+%gLi ", cast(double)e.EV.Vcldouble.re, cast(double)e.EV.Vcldouble.im);
break;
// SIMD 16 byte vector types // D type
case TYfloat4:
case TYdouble2:
case TYschar16:
case TYuchar16:
case TYshort8:
case TYushort8:
case TYlong4:
case TYulong4:
case TYllong2:
case TYullong2:
printf("%llxLL+%llxLL ", cast(long)e.EV.Vcent.hi, cast(long)e.EV.Vcent.lo);
break;
// SIMD 32 byte (256 bit) vector types
case TYfloat8: // float[8]
case TYdouble4: // double[4]
case TYschar32: // byte[32]
case TYuchar32: // ubyte[32]
case TYshort16: // short[16]
case TYushort16: // ushort[16]
case TYlong8: // int[8]
case TYulong8: // uint[8]
case TYllong4: // long[4]
case TYullong4: // ulong[4]
printf("x%llx,x%llx,x%llx,x%llx ",
e.EV.Vullong4[3],e.EV.Vullong4[2],e.EV.Vullong4[1],e.EV.Vullong4[0]);
break;
// SIMD 64 byte (512 bit) vector types
case TYfloat16: // float[16]
case TYdouble8: // double[8]
case TYschar64: // byte[64]
case TYuchar64: // ubyte[64]
case TYshort32: // short[32]
case TYushort32: // ushort[32]
case TYlong16: // int[16]
case TYulong16: // uint[16]
case TYllong8: // long[8]
case TYullong8: // ulong[8]
printf("512 bit vector "); // not supported yet with union eve
break;
default:
printf("Invalid type ");
printf("%s\n", tym_str(typemask(e)));
/*assert(0);*/
}
}
/**********************************
* Hydrate an elem.
*/
static if (HYDRATE)
{
void el_hydrate(elem **pe)
{
if (!isdehydrated(*pe))
return;
assert(PARSER);
elem* e = cast(elem *) ph_hydrate(cast(void**)pe);
elem_debug(e);
debug if (!(e.Eoper < OPMAX))
printf("e = x%lx, e.Eoper = %d\n",e,e.Eoper);
debug assert(e.Eoper < OPMAX);
type_hydrate(&e.ET);
if (configv.addlinenumbers)
{
filename_translate(&e.Esrcpos);
srcpos_hydrate(&e.Esrcpos);
}
if (!OTleaf(e.Eoper))
{
el_hydrate(&e.EV.E1);
if (OTbinary(e.Eoper))
el_hydrate(&e.EV.E2);
else if (e.Eoper == OPctor)
{
}
}
else
{
switch (e.Eoper)
{
case OPstring:
case OPasm:
ph_hydrate(cast(void**)&e.EV.Vstring);
break;
case OPrelconst:
//if (tybasic(e.ET.Tty) == TYmemptr)
//el_hydrate(&e.EV.sm.ethis);
case OPvar:
symbol_hydrate(&e.EV.Vsym);
symbol_debug(e.EV.Vsym);
break;
default:
break;
}
}
}
}
/**********************************
* Dehydrate an elem.
*/
static if (DEHYDRATE)
{
void el_dehydrate(elem **pe)
{
elem* e = *pe;
if (e == null || isdehydrated(e))
return;
assert(PARSER);
elem_debug(e);
debug if (!(e.Eoper < OPMAX))
printf("e = x%lx, e.Eoper = %d\n",e,e.Eoper);
debug_assert(e.Eoper < OPMAX);
ph_dehydrate(pe);
version (DEBUG_XSYMGEN)
{
if (xsym_gen && ph_in_head(e))
return;
}
type_dehydrate(&e.ET);
if (configv.addlinenumbers)
srcpos_dehydrate(&e.Esrcpos);
if (!OTleaf(e.Eoper))
{
el_dehydrate(&e.EV.E1);
if (OTbinary(e.Eoper))
el_dehydrate(&e.EV.E2);
}
else
{
switch (e.Eoper)
{
case OPstring:
case OPasm:
ph_dehydrate(&e.EV.Vstring);
break;
case OPrelconst:
//if (tybasic(e.ET.Tty) == TYmemptr)
//el_dehydrate(&e.EV.sm.ethis);
case OPvar:
symbol_dehydrate(&e.EV.Vsym);
break;
default:
break;
}
}
}
}
| D |
/*******************************************************************************
D language bindings for libsodium's crypto_core_ed25519.h
License: ISC (see LICENSE.txt)
*******************************************************************************/
module libsodium.crypto_core_ed25519;
@nogc nothrow:
import libsodium.export_;
extern (C):
enum crypto_core_ed25519_BYTES = 32;
size_t crypto_core_ed25519_bytes ();
enum crypto_core_ed25519_UNIFORMBYTES = 32;
size_t crypto_core_ed25519_uniformbytes ();
enum crypto_core_ed25519_SCALARBYTES = 32;
size_t crypto_core_ed25519_scalarbytes ();
enum crypto_core_ed25519_NONREDUCEDSCALARBYTES = 64;
size_t crypto_core_ed25519_nonreducedscalarbytes ();
int crypto_core_ed25519_is_valid_point (const(ubyte)* p);
int crypto_core_ed25519_add (ubyte* r, const(ubyte)* p, const(ubyte)* q);
int crypto_core_ed25519_sub (ubyte* r, const(ubyte)* p, const(ubyte)* q);
int crypto_core_ed25519_from_uniform (ubyte* p, const(ubyte)* r);
void crypto_core_ed25519_scalar_random (ubyte* r);
int crypto_core_ed25519_scalar_invert (ubyte* recip, const(ubyte)* s);
void crypto_core_ed25519_scalar_negate (ubyte* neg, const(ubyte)* s);
void crypto_core_ed25519_scalar_complement (ubyte* comp, const(ubyte)* s);
void crypto_core_ed25519_scalar_add (
ubyte* z,
const(ubyte)* x,
const(ubyte)* y);
void crypto_core_ed25519_scalar_sub (
ubyte* z,
const(ubyte)* x,
const(ubyte)* y);
/*
* The interval `s` is sampled from should be at least 317 bits to ensure almost
* uniformity of `r` over `L`.
*/
void crypto_core_ed25519_scalar_reduce (ubyte* r, const(ubyte)* s);
| D |
// Copyright 2019 - 2021 Michael D. Parker
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
module bindbc.freetype.bind.ftotval;
import bindbc.freetype.config;
import bindbc.freetype.config;
import bindbc.freetype.bind.freetype,
bindbc.freetype.bind.fttypes;
enum {
FT_VALIDATE_BASE = 0x0100,
FT_VALIDATE_GDEF = 0x0200,
FT_VALIDATE_GPOS = 0x0400,
FT_VALIDATE_GSUB = 0x0800,
FT_VALIDATE_JSTF = 0x1000,
FT_VALIDATE_MATH = 0x2000,
FT_VALIDATE_OT = FT_VALIDATE_BASE |
FT_VALIDATE_GDEF |
FT_VALIDATE_GPOS |
FT_VALIDATE_GSUB |
FT_VALIDATE_JSTF |
FT_VALIDATE_MATH,
}
static if(staticBinding) {
extern(C) @nogc nothrow {
FT_Error da_FT_OpenType_Validate(FT_Face face, FT_UInt validation_flags, FT_Bytes* BASE_table, FT_Bytes* GDEF_table, FT_Bytes* GPOS_table, FT_Bytes* GSUB_table, FT_Bytes* JSTF_table);
void da_FT_OpenType_Free(FT_Face face, FT_Bytes table);
}
}
else {
extern(C) @nogc nothrow {
alias pFT_OpenType_Validate = FT_Error function(FT_Face face, FT_UInt validation_flags, FT_Bytes* BASE_table, FT_Bytes* GDEF_table, FT_Bytes* GPOS_table, FT_Bytes* GSUB_table, FT_Bytes* JSTF_table);
alias pFT_OpenType_Free = void function (FT_Face face, FT_Bytes table);
}
__gshared {
pFT_OpenType_Validate FT_OpenType_Validate;
pFT_OpenType_Free FT_OpenType_Free;
}
} | D |
/Users/student/Documents/Marketplace/DerivedData/Build/Intermediates/Marketplace.build/Debug-iphonesimulator/Marketplace.build/Objects-normal/x86_64/SignInTableView.o : /Users/student/Documents/Marketplace/Marketplace/CoreDataComponents/Network/Download.swift /Users/student/Documents/Marketplace/Marketplace/CoreDataComponents/Network/Upload.swift /Users/student/Documents/Marketplace/Marketplace/CoreDataComponents/ObjectAdapters/ItemDataSource.swift /Users/student/Documents/Marketplace/Marketplace/CoreDataComponents/ObjectAdapters/FunctionDataSource.swift /Users/student/Documents/Marketplace/Marketplace/CoreDataComponents/ObjectAdapters/UserDataSource.swift /Users/student/Documents/Marketplace/Marketplace/CoreDataComponents/ObjectAdapters/TagsDataSource.swift /Users/student/Documents/Marketplace/Marketplace/CoreDataComponents/ObjectAdapters/InboxDataSource.swift /Users/student/Documents/Marketplace/Marketplace/CoreDataComponents/DataModels/Sale.swift /Users/student/Documents/Marketplace/Marketplace/CoreDataComponents/Network/CoreDataStore.swift /Users/student/Documents/Marketplace/Marketplace/Misc/AppDelegate.swift /Users/student/Documents/Marketplace/Marketplace/Models/ItemModel.swift /Users/student/Documents/Marketplace/Marketplace/Models/UserModel.swift /Users/student/Documents/Marketplace/Marketplace/Views/Inbox/InboxMsgTableCell.swift /Users/student/Documents/Marketplace/Marketplace/Views/ItemTableViewCell.swift /Users/student/Documents/Marketplace/Marketplace/CoreDataComponents/DataModels/Item.swift /Users/student/Documents/Marketplace/Marketplace/CoreDataComponents/DataModels/User.swift /Users/student/Documents/Marketplace/Marketplace/CoreDataComponents/ObjectAdapters/TagSchemaProcessor.swift /Users/student/Documents/Marketplace/Marketplace/CoreDataComponents/ObjectAdapters/ItemSchemaProcessor.swift /Users/student/Documents/Marketplace/Marketplace/CoreDataComponents/ObjectAdapters/FunctionSchemaProcessor.swift /Users/student/Documents/Marketplace/Marketplace/CoreDataComponents/ObjectAdapters/UserSchemaProcessor.swift /Users/student/Documents/Marketplace/Marketplace/CoreDataComponents/ObjectAdapters/InboxSchemaProcessor.swift /Users/student/Documents/Marketplace/Marketplace/CoreDataComponents/Network/CoreDataCommonMethods.swift /Users/student/Documents/Marketplace/Marketplace/CoreDataComponents/DataModels/Sale+CoreDataProperties.swift /Users/student/Documents/Marketplace/Marketplace/CoreDataComponents/DataModels/Item+CoreDataProperties.swift /Users/student/Documents/Marketplace/Marketplace/CoreDataComponents/DataModels/User+CoreDataProperties.swift /Users/student/Documents/Marketplace/Marketplace/CoreDataComponents/DataModels/Pictures+CoreDataProperties.swift /Users/student/Documents/Marketplace/Marketplace/CoreDataComponents/DataModels/Tags+CoreDataProperties.swift /Users/student/Documents/Marketplace/Marketplace/CoreDataComponents/DataModels/Inbox+CoreDataProperties.swift /Users/student/Documents/Marketplace/Marketplace/CoreDataComponents/DataModels/Pictures.swift /Users/student/Documents/Marketplace/Marketplace/CoreDataComponents/DataModels/Tags.swift /Users/student/Documents/Marketplace/Marketplace/Views/ForgotPasswordView.swift /Users/student/Documents/Marketplace/Marketplace/Views/UploadImageView.swift /Users/student/Documents/Marketplace/Marketplace/Views/SendMessageView.swift /Users/student/Documents/Marketplace/Marketplace/Views/SearchTableView.swift /Users/student/Documents/Marketplace/Marketplace/Views/UploadItemTableView.swift /Users/student/Documents/Marketplace/Marketplace/Views/SignInTableView.swift /Users/student/Documents/Marketplace/Marketplace/Views/RegisterTableView.swift /Users/student/Documents/Marketplace/Marketplace/Views/SearchParametersTableView.swift /Users/student/Documents/Marketplace/Marketplace/Views/MenuTableView.swift /Users/student/Documents/Marketplace/Marketplace/Views/Inbox/InboxTableView.swift /Users/student/Documents/Marketplace/Marketplace/Views/UserProfileView.swift /Users/student/Documents/Marketplace/Marketplace/Views/EditProfileView.swift /Users/student/Documents/Marketplace/Marketplace/Views/HomeView.swift /Users/student/Documents/Marketplace/Marketplace/Views/RatingView.swift /Users/student/Documents/Marketplace/Marketplace/Views/Inbox/InboxDetailView.swift /Users/student/Documents/Marketplace/Marketplace/Views/ItemView.swift /Users/student/Documents/Marketplace/Marketplace/Views/CheckoutView.swift /Users/student/Documents/Marketplace/Marketplace/CoreDataComponents/DataModels/Inbox.swift /Users/student/Documents/Marketplace/Marketplace/Misc/Handy.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/CoreMedia.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreData.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/simd.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/CoreLocation.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/AVFoundation.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/CoreAudio.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/Photos.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/student/Documents/Marketplace/Marketplace-Bridging-Header.h /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.0.sdk/usr/include/objc/ObjectiveC.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.0.sdk/System/Library/Frameworks/MessageUI.framework/Headers/MessageUI.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.0.sdk/System/Library/Frameworks/OpenGLES.framework/Headers/OpenGLES.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.0.sdk/System/Library/Frameworks/CoreData.framework/Headers/CoreData.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.0.sdk/System/Library/Frameworks/CoreImage.framework/Headers/CoreImage.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.0.sdk/System/Library/Frameworks/QuartzCore.framework/Headers/QuartzCore.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.0.sdk/System/Library/Frameworks/Metal.framework/Headers/Metal.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.0.sdk/usr/include/Darwin.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.0.sdk/System/Library/Frameworks/CoreLocation.framework/Headers/CoreLocation.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.0.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.0.sdk/System/Library/Frameworks/AVFoundation.framework/Headers/AVFoundation.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.0.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.0.sdk/System/Library/Frameworks/Photos.framework/Headers/Photos.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.0.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIKit.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.0.sdk/System/Library/Frameworks/CoreText.framework/Headers/CoreText.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.0.sdk/System/Library/Frameworks/AudioToolbox.framework/Headers/AudioToolbox.apinotes
/Users/student/Documents/Marketplace/DerivedData/Build/Intermediates/Marketplace.build/Debug-iphonesimulator/Marketplace.build/Objects-normal/x86_64/SignInTableView~partial.swiftmodule : /Users/student/Documents/Marketplace/Marketplace/CoreDataComponents/Network/Download.swift /Users/student/Documents/Marketplace/Marketplace/CoreDataComponents/Network/Upload.swift /Users/student/Documents/Marketplace/Marketplace/CoreDataComponents/ObjectAdapters/ItemDataSource.swift /Users/student/Documents/Marketplace/Marketplace/CoreDataComponents/ObjectAdapters/FunctionDataSource.swift /Users/student/Documents/Marketplace/Marketplace/CoreDataComponents/ObjectAdapters/UserDataSource.swift /Users/student/Documents/Marketplace/Marketplace/CoreDataComponents/ObjectAdapters/TagsDataSource.swift /Users/student/Documents/Marketplace/Marketplace/CoreDataComponents/ObjectAdapters/InboxDataSource.swift /Users/student/Documents/Marketplace/Marketplace/CoreDataComponents/DataModels/Sale.swift /Users/student/Documents/Marketplace/Marketplace/CoreDataComponents/Network/CoreDataStore.swift /Users/student/Documents/Marketplace/Marketplace/Misc/AppDelegate.swift /Users/student/Documents/Marketplace/Marketplace/Models/ItemModel.swift /Users/student/Documents/Marketplace/Marketplace/Models/UserModel.swift /Users/student/Documents/Marketplace/Marketplace/Views/Inbox/InboxMsgTableCell.swift /Users/student/Documents/Marketplace/Marketplace/Views/ItemTableViewCell.swift /Users/student/Documents/Marketplace/Marketplace/CoreDataComponents/DataModels/Item.swift /Users/student/Documents/Marketplace/Marketplace/CoreDataComponents/DataModels/User.swift /Users/student/Documents/Marketplace/Marketplace/CoreDataComponents/ObjectAdapters/TagSchemaProcessor.swift /Users/student/Documents/Marketplace/Marketplace/CoreDataComponents/ObjectAdapters/ItemSchemaProcessor.swift /Users/student/Documents/Marketplace/Marketplace/CoreDataComponents/ObjectAdapters/FunctionSchemaProcessor.swift /Users/student/Documents/Marketplace/Marketplace/CoreDataComponents/ObjectAdapters/UserSchemaProcessor.swift /Users/student/Documents/Marketplace/Marketplace/CoreDataComponents/ObjectAdapters/InboxSchemaProcessor.swift /Users/student/Documents/Marketplace/Marketplace/CoreDataComponents/Network/CoreDataCommonMethods.swift /Users/student/Documents/Marketplace/Marketplace/CoreDataComponents/DataModels/Sale+CoreDataProperties.swift /Users/student/Documents/Marketplace/Marketplace/CoreDataComponents/DataModels/Item+CoreDataProperties.swift /Users/student/Documents/Marketplace/Marketplace/CoreDataComponents/DataModels/User+CoreDataProperties.swift /Users/student/Documents/Marketplace/Marketplace/CoreDataComponents/DataModels/Pictures+CoreDataProperties.swift /Users/student/Documents/Marketplace/Marketplace/CoreDataComponents/DataModels/Tags+CoreDataProperties.swift /Users/student/Documents/Marketplace/Marketplace/CoreDataComponents/DataModels/Inbox+CoreDataProperties.swift /Users/student/Documents/Marketplace/Marketplace/CoreDataComponents/DataModels/Pictures.swift /Users/student/Documents/Marketplace/Marketplace/CoreDataComponents/DataModels/Tags.swift /Users/student/Documents/Marketplace/Marketplace/Views/ForgotPasswordView.swift /Users/student/Documents/Marketplace/Marketplace/Views/UploadImageView.swift /Users/student/Documents/Marketplace/Marketplace/Views/SendMessageView.swift /Users/student/Documents/Marketplace/Marketplace/Views/SearchTableView.swift /Users/student/Documents/Marketplace/Marketplace/Views/UploadItemTableView.swift /Users/student/Documents/Marketplace/Marketplace/Views/SignInTableView.swift /Users/student/Documents/Marketplace/Marketplace/Views/RegisterTableView.swift /Users/student/Documents/Marketplace/Marketplace/Views/SearchParametersTableView.swift /Users/student/Documents/Marketplace/Marketplace/Views/MenuTableView.swift /Users/student/Documents/Marketplace/Marketplace/Views/Inbox/InboxTableView.swift /Users/student/Documents/Marketplace/Marketplace/Views/UserProfileView.swift /Users/student/Documents/Marketplace/Marketplace/Views/EditProfileView.swift /Users/student/Documents/Marketplace/Marketplace/Views/HomeView.swift /Users/student/Documents/Marketplace/Marketplace/Views/RatingView.swift /Users/student/Documents/Marketplace/Marketplace/Views/Inbox/InboxDetailView.swift /Users/student/Documents/Marketplace/Marketplace/Views/ItemView.swift /Users/student/Documents/Marketplace/Marketplace/Views/CheckoutView.swift /Users/student/Documents/Marketplace/Marketplace/CoreDataComponents/DataModels/Inbox.swift /Users/student/Documents/Marketplace/Marketplace/Misc/Handy.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/CoreMedia.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreData.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/simd.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/CoreLocation.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/AVFoundation.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/CoreAudio.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/Photos.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/student/Documents/Marketplace/Marketplace-Bridging-Header.h /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.0.sdk/usr/include/objc/ObjectiveC.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.0.sdk/System/Library/Frameworks/MessageUI.framework/Headers/MessageUI.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.0.sdk/System/Library/Frameworks/OpenGLES.framework/Headers/OpenGLES.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.0.sdk/System/Library/Frameworks/CoreData.framework/Headers/CoreData.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.0.sdk/System/Library/Frameworks/CoreImage.framework/Headers/CoreImage.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.0.sdk/System/Library/Frameworks/QuartzCore.framework/Headers/QuartzCore.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.0.sdk/System/Library/Frameworks/Metal.framework/Headers/Metal.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.0.sdk/usr/include/Darwin.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.0.sdk/System/Library/Frameworks/CoreLocation.framework/Headers/CoreLocation.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.0.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.0.sdk/System/Library/Frameworks/AVFoundation.framework/Headers/AVFoundation.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.0.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.0.sdk/System/Library/Frameworks/Photos.framework/Headers/Photos.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.0.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIKit.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.0.sdk/System/Library/Frameworks/CoreText.framework/Headers/CoreText.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.0.sdk/System/Library/Frameworks/AudioToolbox.framework/Headers/AudioToolbox.apinotes
/Users/student/Documents/Marketplace/DerivedData/Build/Intermediates/Marketplace.build/Debug-iphonesimulator/Marketplace.build/Objects-normal/x86_64/SignInTableView~partial.swiftdoc : /Users/student/Documents/Marketplace/Marketplace/CoreDataComponents/Network/Download.swift /Users/student/Documents/Marketplace/Marketplace/CoreDataComponents/Network/Upload.swift /Users/student/Documents/Marketplace/Marketplace/CoreDataComponents/ObjectAdapters/ItemDataSource.swift /Users/student/Documents/Marketplace/Marketplace/CoreDataComponents/ObjectAdapters/FunctionDataSource.swift /Users/student/Documents/Marketplace/Marketplace/CoreDataComponents/ObjectAdapters/UserDataSource.swift /Users/student/Documents/Marketplace/Marketplace/CoreDataComponents/ObjectAdapters/TagsDataSource.swift /Users/student/Documents/Marketplace/Marketplace/CoreDataComponents/ObjectAdapters/InboxDataSource.swift /Users/student/Documents/Marketplace/Marketplace/CoreDataComponents/DataModels/Sale.swift /Users/student/Documents/Marketplace/Marketplace/CoreDataComponents/Network/CoreDataStore.swift /Users/student/Documents/Marketplace/Marketplace/Misc/AppDelegate.swift /Users/student/Documents/Marketplace/Marketplace/Models/ItemModel.swift /Users/student/Documents/Marketplace/Marketplace/Models/UserModel.swift /Users/student/Documents/Marketplace/Marketplace/Views/Inbox/InboxMsgTableCell.swift /Users/student/Documents/Marketplace/Marketplace/Views/ItemTableViewCell.swift /Users/student/Documents/Marketplace/Marketplace/CoreDataComponents/DataModels/Item.swift /Users/student/Documents/Marketplace/Marketplace/CoreDataComponents/DataModels/User.swift /Users/student/Documents/Marketplace/Marketplace/CoreDataComponents/ObjectAdapters/TagSchemaProcessor.swift /Users/student/Documents/Marketplace/Marketplace/CoreDataComponents/ObjectAdapters/ItemSchemaProcessor.swift /Users/student/Documents/Marketplace/Marketplace/CoreDataComponents/ObjectAdapters/FunctionSchemaProcessor.swift /Users/student/Documents/Marketplace/Marketplace/CoreDataComponents/ObjectAdapters/UserSchemaProcessor.swift /Users/student/Documents/Marketplace/Marketplace/CoreDataComponents/ObjectAdapters/InboxSchemaProcessor.swift /Users/student/Documents/Marketplace/Marketplace/CoreDataComponents/Network/CoreDataCommonMethods.swift /Users/student/Documents/Marketplace/Marketplace/CoreDataComponents/DataModels/Sale+CoreDataProperties.swift /Users/student/Documents/Marketplace/Marketplace/CoreDataComponents/DataModels/Item+CoreDataProperties.swift /Users/student/Documents/Marketplace/Marketplace/CoreDataComponents/DataModels/User+CoreDataProperties.swift /Users/student/Documents/Marketplace/Marketplace/CoreDataComponents/DataModels/Pictures+CoreDataProperties.swift /Users/student/Documents/Marketplace/Marketplace/CoreDataComponents/DataModels/Tags+CoreDataProperties.swift /Users/student/Documents/Marketplace/Marketplace/CoreDataComponents/DataModels/Inbox+CoreDataProperties.swift /Users/student/Documents/Marketplace/Marketplace/CoreDataComponents/DataModels/Pictures.swift /Users/student/Documents/Marketplace/Marketplace/CoreDataComponents/DataModels/Tags.swift /Users/student/Documents/Marketplace/Marketplace/Views/ForgotPasswordView.swift /Users/student/Documents/Marketplace/Marketplace/Views/UploadImageView.swift /Users/student/Documents/Marketplace/Marketplace/Views/SendMessageView.swift /Users/student/Documents/Marketplace/Marketplace/Views/SearchTableView.swift /Users/student/Documents/Marketplace/Marketplace/Views/UploadItemTableView.swift /Users/student/Documents/Marketplace/Marketplace/Views/SignInTableView.swift /Users/student/Documents/Marketplace/Marketplace/Views/RegisterTableView.swift /Users/student/Documents/Marketplace/Marketplace/Views/SearchParametersTableView.swift /Users/student/Documents/Marketplace/Marketplace/Views/MenuTableView.swift /Users/student/Documents/Marketplace/Marketplace/Views/Inbox/InboxTableView.swift /Users/student/Documents/Marketplace/Marketplace/Views/UserProfileView.swift /Users/student/Documents/Marketplace/Marketplace/Views/EditProfileView.swift /Users/student/Documents/Marketplace/Marketplace/Views/HomeView.swift /Users/student/Documents/Marketplace/Marketplace/Views/RatingView.swift /Users/student/Documents/Marketplace/Marketplace/Views/Inbox/InboxDetailView.swift /Users/student/Documents/Marketplace/Marketplace/Views/ItemView.swift /Users/student/Documents/Marketplace/Marketplace/Views/CheckoutView.swift /Users/student/Documents/Marketplace/Marketplace/CoreDataComponents/DataModels/Inbox.swift /Users/student/Documents/Marketplace/Marketplace/Misc/Handy.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/CoreMedia.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreData.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/simd.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/CoreLocation.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/AVFoundation.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/CoreAudio.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/Photos.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/student/Documents/Marketplace/Marketplace-Bridging-Header.h /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.0.sdk/usr/include/objc/ObjectiveC.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.0.sdk/System/Library/Frameworks/MessageUI.framework/Headers/MessageUI.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.0.sdk/System/Library/Frameworks/OpenGLES.framework/Headers/OpenGLES.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.0.sdk/System/Library/Frameworks/CoreData.framework/Headers/CoreData.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.0.sdk/System/Library/Frameworks/CoreImage.framework/Headers/CoreImage.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.0.sdk/System/Library/Frameworks/QuartzCore.framework/Headers/QuartzCore.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.0.sdk/System/Library/Frameworks/Metal.framework/Headers/Metal.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.0.sdk/usr/include/Darwin.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.0.sdk/System/Library/Frameworks/CoreLocation.framework/Headers/CoreLocation.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.0.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.0.sdk/System/Library/Frameworks/AVFoundation.framework/Headers/AVFoundation.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.0.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.0.sdk/System/Library/Frameworks/Photos.framework/Headers/Photos.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.0.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIKit.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.0.sdk/System/Library/Frameworks/CoreText.framework/Headers/CoreText.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.0.sdk/System/Library/Frameworks/AudioToolbox.framework/Headers/AudioToolbox.apinotes
| D |
module dnv.kernel;
import std.conv : to;
import dnv.storage;
import dnv.compiler;
import dnv.driver;
import dnv.error;
import derelict.cuda.driverapi : CUfunction;
void* vptr(F)(ref F f) {
static if (is(typeof(f.ptr))) {
return to!(void*)(&f.ptr);
} else {
return to!(void*)(&f);
}
}
class KernelBase(Compiler, Launcher) {
/*
FIXME: CUresult.CUDA_ERROR_INVALID_HANDLE
- init device in this or opCall?
- multi device support
NOTE: Kernel can be factored into Kernel!(Compiler, Launcher)
- Compiler: Static, Dynamic, Unsafe ... and user-defined
- Launcher: Simple, Heavy, Shared, Async ... and user-defined
*/
CUfunction func;
Launcher launch;
Compiler compiler;
// FIXME: need better prediction
static if (is(typeof(compiler.cargs))) {
this() {
compiler.build(vfunc, compiler.code);
}
} else {
this(Code code) {
compiler.build(vfunc, code);
}
}
void* vfunc() {
return to!(void*)(&func);
}
void opCall() {}
void opCall(Ts...)(Ts targs) {
compiler.assertArgs(targs);
void[] vargs;
foreach (i, t; targs) {
vargs ~= [vptr(targs[i])];
}
launch.setup(targs);
check(dnv.driver.launch(vptr(func), vargs.ptr, launch.grids.ptr, launch.blocks.ptr));
}
}
alias RuntimeKernel(L = SimpleLauncher) = KernelBase!(UnsafeCompiler, L);
alias TypedKernel(Code code, L = SimpleLauncher) = KernelBase!(StaticCompiler!code, L);
unittest {
import std.stdio;
import std.random;
import std.range;
auto empty = new RuntimeKernel!()
(Code("empty", "", "int i = blockDim.x * blockIdx.x + threadIdx.x;"));
empty();
int n = 10;
auto gen = () => new Array!float(generate!(() => uniform(-1f, 1f)).take(n).array());
auto a = gen();
auto b = gen();
auto c = new Array!float(n);
auto saxpy = new RuntimeKernel!()(
Code(
"saxpy", q{float *A, float *B, float *C, int numElements},
q{
int i = blockDim.x * blockIdx.x + threadIdx.x;
if (i < numElements) C[i] = A[i] + B[i];
})
);
saxpy(a, b, c, n);
foreach (ai, bi, ci; zip(a.to_cpu(), b.to_cpu(), c.to_cpu())) {
assert(ai + bi == ci);
}
enum code = Code(
"saxpy", q{float *A, float *B, float *C, int numElements},
q{
int i = blockDim.x * blockIdx.x + threadIdx.x;
if (i < numElements) C[i] = A[i] + B[i];
});
auto tsaxpy = new TypedKernel!(code);
tsaxpy(a, b, c, n);
foreach (ai, bi, ci; zip(a.to_cpu(), b.to_cpu(), c.to_cpu())) {
assert(ai + bi == ci);
}
}
| D |
/*
* Copyright 2015-2018 HuntLabs.cn
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
module hunt.sql.dialect.postgresql.visitor.PGOutputVisitor;
import hunt.sql.ast;
import hunt.sql.ast.expr;
import hunt.sql.ast.statement;
// import hunt.sql.dialect.oracle.ast.OracleDataTypeIntervalDay;
// import hunt.sql.dialect.oracle.ast.OracleDataTypeIntervalYear;
// import hunt.sql.dialect.oracle.ast.clause;
// import hunt.sql.dialect.oracle.ast.expr;
// import hunt.sql.dialect.oracle.ast.stmt;
// import hunt.sql.dialect.oracle.parser.OracleFunctionDataType;
// import hunt.sql.dialect.oracle.parser.OracleProcedureDataType;
// import hunt.sql.dialect.oracle.visitor.OracleASTVisitor;
import hunt.sql.dialect.postgresql.ast.expr.PGBoxExpr;
import hunt.sql.dialect.postgresql.ast.expr.PGCidrExpr;
import hunt.sql.dialect.postgresql.ast.expr.PGCircleExpr;
import hunt.sql.dialect.postgresql.ast.expr.PGExtractExpr;
import hunt.sql.dialect.postgresql.ast.expr.PGInetExpr;
import hunt.sql.dialect.postgresql.ast.expr.PGLineSegmentsExpr;
import hunt.sql.dialect.postgresql.ast.expr.PGMacAddrExpr;
import hunt.sql.dialect.postgresql.ast.expr.PGPointExpr;
import hunt.sql.dialect.postgresql.ast.expr.PGPolygonExpr;
import hunt.sql.dialect.postgresql.ast.expr.PGTypeCastExpr;
import hunt.sql.dialect.postgresql.ast.stmt;
import hunt.sql.dialect.postgresql.ast.stmt.PGSelectQueryBlock;
// import hunt.sql.dialect.postgresql.ast.stmt.PGSelectQueryBlock.FetchClause;
// import hunt.sql.dialect.postgresql.ast.stmt.PGSelectQueryBlock.ForClause;
// import hunt.sql.dialect.postgresql.ast.stmt.PGSelectQueryBlock.WindowClause;
import hunt.sql.visitor.SQLASTOutputVisitor;
import hunt.sql.util.FnvHash;
import hunt.sql.util.DBType;
import hunt.sql.dialect.postgresql.visitor.PGASTVisitor;
import hunt.Byte;
import hunt.collection;
import hunt.logging;
import hunt.String;
import hunt.util.Appendable;
import hunt.util.Common;
import hunt.text;
import std.array;
import std.format;
import std.uni;
import std.algorithm.searching;
public class PGOutputVisitor : SQLASTOutputVisitor , PGASTVisitor//, OracleASTVisitor
{
alias visit = SQLASTOutputVisitor.visit;
alias endVisit = SQLASTOutputVisitor.endVisit;
public this(Appendable appender){
super(appender);
this.dbType = DBType.POSTGRESQL.name;
}
public this(Appendable appender, bool parameterized){
super(appender, parameterized);
this.dbType = DBType.POSTGRESQL.name;
}
override
public void endVisit(PGSelectQueryBlock.WindowClause x) {
}
override
public bool visit(PGSelectQueryBlock.WindowClause x) {
print0(ucase ? "WINDOW " : "window ");
x.getName().accept(this);
print0(ucase ? " AS " : " as ");
for (int i = 0; i < x.getDefinition().size(); ++i) {
if (i != 0) {
println(", ");
}
print('(');
x.getDefinition().get(i).accept(this);
print(')');
}
return false;
}
override
public void endVisit(PGSelectQueryBlock.FetchClause x) {
}
override
public bool visit(PGSelectQueryBlock.FetchClause x) {
print0(ucase ? "FETCH " : "fetch ");
if (PGSelectQueryBlock.FetchClause.Option.FIRST == (x.getOption())) {
print0(ucase ? "FIRST " : "first ");
} else if (PGSelectQueryBlock.FetchClause.Option.NEXT == (x.getOption())) {
print0(ucase ? "NEXT " : "next ");
}
x.getCount().accept(this);
print0(ucase ? " ROWS ONLY" : " rows only");
return false;
}
override
public void endVisit(PGSelectQueryBlock.ForClause x) {
}
override
public bool visit(PGSelectQueryBlock.ForClause x) {
print0(ucase ? "FOR " : "for ");
if (PGSelectQueryBlock.ForClause.Option.UPDATE == (x.getOption())) {
print0(ucase ? "UPDATE " : "update ");
} else if (PGSelectQueryBlock.ForClause.Option.SHARE == (x.getOption())) {
print0(ucase ? "SHARE " : "share ");
}
if (x.getOf().size() > 0) {
for (int i = 0; i < x.getOf().size(); ++i) {
if (i != 0) {
println(", ");
}
x.getOf().get(i).accept(this);
}
}
if (x.isNoWait()) {
print0(ucase ? " NOWAIT" : " nowait");
}
return false;
}
public bool visit(PGSelectQueryBlock x) {
print0(ucase ? "SELECT " : "select ");
if (SQLSetQuantifier.ALL == x.getDistionOption()) {
print0(ucase ? "ALL " : "all ");
} else if (SQLSetQuantifier.DISTINCT == x.getDistionOption()) {
print0(ucase ? "DISTINCT " : "distinct ");
if (x.getDistinctOn() !is null && x.getDistinctOn().size() > 0) {
print0(ucase ? "ON " : "on ");
printAndAccept!SQLExpr((x.getDistinctOn()), ", ");
}
}
printSelectList(x.getSelectList());
if (x.getInto() !is null) {
println();
if (x.getIntoOption().name.length != 0) {
print0(x.getIntoOption().name());
print(' ');
}
print0(ucase ? "INTO " : "into ");
x.getInto().accept(this);
}
if (x.getFrom() !is null) {
println();
print0(ucase ? "FROM " : "from ");
x.getFrom().accept(this);
}
if (x.getWhere() !is null) {
println();
print0(ucase ? "WHERE " : "where ");
x.getWhere().accept(this);
}
if (x.getGroupBy() !is null) {
println();
x.getGroupBy().accept(this);
}
if (x.getWindow() !is null) {
println();
x.getWindow().accept(this);
}
if (x.getOrderBy() !is null) {
println();
x.getOrderBy().accept(this);
}
if (x.getLimit() !is null) {
println();
x.getLimit().accept(this);
}
if (x.getFetch() !is null) {
println();
x.getFetch().accept(this);
}
if (x.getForClause() !is null) {
println();
x.getForClause().accept(this);
}
return false;
}
override
public bool visit(SQLTruncateStatement x) {
print0(ucase ? "TRUNCATE TABLE " : "truncate table ");
if (x.isOnly()) {
print0(ucase ? "ONLY " : "only ");
}
printlnAndAccept!(SQLExprTableSource)((x.getTableSources()), ", ");
if (x.getRestartIdentity() !is null) {
if (x.getRestartIdentity().booleanValue()) {
print0(ucase ? " RESTART IDENTITY" : " restart identity");
} else {
print0(ucase ? " CONTINUE IDENTITY" : " continue identity");
}
}
if (x.getCascade() !is null) {
if (x.getCascade().booleanValue()) {
print0(ucase ? " CASCADE" : " cascade");
} else {
print0(ucase ? " RESTRICT" : " restrict");
}
}
return false;
}
override
public void endVisit(PGDeleteStatement x) {
}
override
public bool visit(PGDeleteStatement x) {
if (x.getWith() !is null) {
x.getWith().accept(this);
println();
}
print0(ucase ? "DELETE FROM " : "delete from ");
if (x.isOnly()) {
print0(ucase ? "ONLY " : "only ");
}
printTableSourceExpr(x.getTableName());
if (x.getAlias() !is null) {
print0(ucase ? " AS " : " as ");
print0(x.getAlias());
}
SQLTableSource using = x.getUsing();
if (using !is null) {
println();
print0(ucase ? "USING " : "using ");
using.accept(this);
}
if (x.getWhere() !is null) {
println();
print0(ucase ? "WHERE " : "where ");
this.indentCount++;
x.getWhere().accept(this);
this.indentCount--;
}
if (x.isReturning()) {
println();
print0(ucase ? "RETURNING *" : "returning *");
}
return false;
}
override
public void endVisit(PGInsertStatement x) {
}
override
public bool visit(PGInsertStatement x) {
if (x.getWith() !is null) {
x.getWith().accept(this);
println();
}
print0(ucase ? "INSERT INTO " : "insert into ");
x.getTableSource().accept(this);
printInsertColumns(x.getColumns());
if (x.getValues() !is null) {
println();
print0(ucase ? "VALUES " : "values ");
printlnAndAccept!(ValuesClause)((x.getValuesList()), ", ");
} else {
if (x.getQuery() !is null) {
println();
x.getQuery().accept(this);
}
}
List!(SQLExpr) onConflictTarget = x.getOnConflictTarget();
List!(SQLUpdateSetItem) onConflictUpdateSetItems = x.getOnConflictUpdateSetItems();
bool onConflictDoNothing = x.isOnConflictDoNothing();
if (onConflictDoNothing
|| (onConflictTarget !is null && onConflictTarget.size() > 0)
|| (onConflictUpdateSetItems !is null && onConflictUpdateSetItems.size() > 0)) {
println();
print0(ucase ? "ON CONFLICT" : "on conflict");
if ((onConflictTarget !is null && onConflictTarget.size() > 0)) {
print0(" (");
printAndAccept!SQLExpr((onConflictTarget), ", ");
print(')');
}
SQLName onConflictConstraint = x.getOnConflictConstraint();
if (onConflictConstraint !is null) {
print0(ucase ? " ON CONSTRAINT " : " on constraint ");
printExpr(onConflictConstraint);
}
SQLExpr onConflictWhere = x.getOnConflictWhere();
if (onConflictWhere !is null) {
print0(ucase ? " WHERE " : " where ");
printExpr(onConflictWhere);
}
if (onConflictDoNothing) {
print0(ucase ? " DO NOTHING" : " do nothing");
} else if ((onConflictUpdateSetItems !is null && onConflictUpdateSetItems.size() > 0)) {
print0(ucase ? " UPDATE SET " : " update set ");
printAndAccept!SQLUpdateSetItem((onConflictUpdateSetItems), ", ");
}
}
if (x.getReturning() !is null) {
println();
print0(ucase ? "RETURNING " : "returning ");
x.getReturning().accept(this);
}
return false;
}
override
public void endVisit(PGSelectStatement x) {
}
override
public bool visit(PGSelectStatement x) {
return visit(cast(SQLSelectStatement) x);
}
override
public void endVisit(PGUpdateStatement x) {
}
override
public bool visit(PGUpdateStatement x) {
SQLWithSubqueryClause with_p = x.getWith();
if (with_p !is null) {
visit(with_p);
println();
}
print0(ucase ? "UPDATE " : "update ");
if (x.isOnly()) {
print0(ucase ? "ONLY " : "only ");
}
printTableSource(x.getTableSource());
println();
print0(ucase ? "SET " : "set ");
for (int i = 0, size = x.getItems().size(); i < size; ++i) {
if (i != 0) {
print0(", ");
}
SQLUpdateSetItem item = x.getItems().get(i);
visit(item);
}
SQLTableSource from = x.getFrom();
if (from !is null) {
println();
print0(ucase ? "FROM " : "from ");
printTableSource(from);
}
SQLExpr where = x.getWhere();
if (where !is null) {
println();
indentCount++;
print0(ucase ? "WHERE " : "where ");
printExpr(where);
indentCount--;
}
List!(SQLExpr) returning = x.getReturning();
if (returning.size() > 0) {
println();
print0(ucase ? "RETURNING " : "returning ");
printAndAccept!SQLExpr((returning), ", ");
}
return false;
}
override
public void endVisit(PGSelectQueryBlock x) {
}
override
public bool visit(PGFunctionTableSource x) {
x.getExpr().accept(this);
if (x.getAlias() !is null) {
print0(ucase ? " AS " : " as ");
print0(x.getAlias());
}
if (x.getParameters().size() > 0) {
print('(');
printAndAccept!SQLParameter((x.getParameters()), ", ");
print(')');
}
return false;
}
override
public void endVisit(PGFunctionTableSource x) {
}
override
public void endVisit(PGTypeCastExpr x) {
}
override
public bool visit(PGTypeCastExpr x) {
SQLExpr expr = x.getExpr();
SQLDataType dataType = x.getDataType();
if (dataType.nameHashCode64() == FnvHash.Constants.VARBIT) {
dataType.accept(this);
print(' ');
printExpr(expr);
return false;
}
if (expr !is null) {
if (cast(SQLBinaryOpExpr)(expr) !is null) {
print('(');
expr.accept(this);
print(')');
} else if (cast(PGTypeCastExpr)(expr) !is null && dataType.getArguments().size() == 0) {
dataType.accept(this);
print('(');
visit(cast(PGTypeCastExpr) expr);
print(')');
return false;
} else {
expr.accept(this);
}
}
print0("::");
dataType.accept(this);
return false;
}
override
public void endVisit(PGValuesQuery x) {
}
override
public bool visit(PGValuesQuery x) {
print0(ucase ? "VALUES(" : "values(");
printAndAccept!SQLExpr((x.getValues()), ", ");
print(')');
return false;
}
override
public void endVisit(PGExtractExpr x) {
}
override
public bool visit(PGExtractExpr x) {
print0(ucase ? "EXTRACT (" : "extract (");
print0(x.getField().name());
print0(ucase ? " FROM " : " from ");
x.getSource().accept(this);
print(')');
return false;
}
override
public bool visit(PGBoxExpr x) {
print0(ucase ? "BOX " : "box ");
x.getValue().accept(this);
return false;
}
override
public void endVisit(PGBoxExpr x) {
}
override
public bool visit(PGPointExpr x) {
print0(ucase ? "POINT " : "point ");
x.getValue().accept(this);
return false;
}
override
public void endVisit(PGPointExpr x) {
}
override
public bool visit(PGMacAddrExpr x) {
print0("macaddr ");
x.getValue().accept(this);
return false;
}
override
public void endVisit(PGMacAddrExpr x) {
}
override
public bool visit(PGInetExpr x) {
print0("inet ");
x.getValue().accept(this);
return false;
}
override
public void endVisit(PGInetExpr x) {
}
override
public bool visit(PGCidrExpr x) {
print0("cidr ");
x.getValue().accept(this);
return false;
}
override
public void endVisit(PGCidrExpr x) {
}
override
public bool visit(PGPolygonExpr x) {
print0("polygon ");
x.getValue().accept(this);
return false;
}
override
public void endVisit(PGPolygonExpr x) {
}
override
public bool visit(PGCircleExpr x) {
print0("circle ");
x.getValue().accept(this);
return false;
}
override
public void endVisit(PGCircleExpr x) {
}
override
public bool visit(PGLineSegmentsExpr x) {
print0("lseg ");
x.getValue().accept(this);
return false;
}
override
public void endVisit(PGLineSegmentsExpr x) {
}
override
public bool visit(SQLBinaryExpr x) {
print0(ucase ? "B'" : "b'");
print0(x.getText());
print('\'');
return false;
}
override
public void endVisit(PGShowStatement x) {
}
override bool visit(SQLBlobExpr x) {
print0("'\\x");
print0(x.getHex());
print('\'');
return false;
}
override void endVisit(SQLBlobExpr x) {
}
override
public bool visit(PGShowStatement x) {
print0(ucase ? "SHOW " : "show ");
x.getExpr().accept(this);
return false;
}
override public bool visit(SQLLimit x) {
print0(ucase ? "LIMIT " : "limit ");
x.getRowCount().accept(this);
if (x.getOffset() !is null) {
print0(ucase ? " OFFSET " : " offset ");
x.getOffset().accept(this);
}
return false;
}
override
public void endVisit(PGStartTransactionStatement x) {
}
override
public bool visit(PGStartTransactionStatement x) {
print0(ucase ? "START TRANSACTION" : "start transaction");
return false;
}
override
public void endVisit(PGConnectToStatement x) {
}
override
public bool visit(PGConnectToStatement x) {
print0(ucase ? "CONNECT TO " : "connect to ");
x.getTarget().accept(this);
return false;
}
override
public bool visit(SQLSetStatement x) {
print0(ucase ? "SET " : "set ");
SQLSetStatement.Option option = x.getOption();
if (option.name.length != 0) {
print(option.name());
print(' ');
}
List!(SQLAssignItem) items = x.getItems();
for (int i = 0; i < items.size(); i++) {
if (i != 0) {
print0(", ");
}
SQLAssignItem item = x.getItems().get(i);
SQLExpr target = item.getTarget();
target.accept(this);
SQLExpr value = item.getValue();
if (cast(SQLIdentifierExpr)(target) !is null
&& (cast(SQLIdentifierExpr) target).getName().equalsIgnoreCase("TIME ZONE")) {
print(' ');
} else {
if (cast(SQLPropertyExpr)(value) !is null
&& cast(SQLVariantRefExpr)((cast(SQLPropertyExpr) value).getOwner()) !is null) {
print0(" := ");
} else {
print0(" TO ");
}
}
if (cast(SQLListExpr)(value) !is null) {
SQLListExpr listExpr = cast(SQLListExpr) value;
printAndAccept!SQLExpr((listExpr.getItems()), ", ");
} else {
value.accept(this);
}
}
return false;
}
override
public bool visit(SQLCreateUserStatement x) {
print0(ucase ? "CREATE USER " : "create user ");
x.getUser().accept(this);
print0(ucase ? " PASSWORD " : " password ");
SQLExpr passoword = x.getPassword();
if (cast(SQLIdentifierExpr)(passoword) !is null) {
print('\'');
passoword.accept(this);
print('\'');
} else {
passoword.accept(this);
}
return false;
}
override protected void printGrantPrivileges(SQLGrantStatement x) {
List!(SQLExpr) privileges = x.getPrivileges();
int i = 0;
foreach(SQLExpr privilege ; privileges) {
if (i != 0) {
print(", ");
}
if (cast(SQLIdentifierExpr)(privilege) !is null) {
string name = (cast(SQLIdentifierExpr) privilege).getName();
if ("RESOURCE".equalsIgnoreCase(name)) {
continue;
}
}
privilege.accept(this);
i++;
}
}
override public bool visit(SQLGrantStatement x) {
if (x.getOn() is null) {
print("ALTER ROLE ");
x.getTo().accept(this);
print(' ');
Set!(SQLIdentifierExpr) pgPrivilegs = new LinkedHashSet!(SQLIdentifierExpr)();
foreach(SQLExpr privilege ; x.getPrivileges()) {
if (cast(SQLIdentifierExpr)(privilege) !is null) {
string name = (cast(SQLIdentifierExpr) privilege).getName();
if (equalsIgnoreCase(name, "CONNECT")) {
pgPrivilegs.add(new SQLIdentifierExpr("LOGIN"));
}
if (toLower(name).startsWith("create ")) {
pgPrivilegs.add(new SQLIdentifierExpr("CREATEDB"));
}
}
}
int i = 0;
foreach(SQLIdentifierExpr privilege ; pgPrivilegs) {
if (i != 0) {
print(' ');
}
privilege.accept(this);
i++;
}
return false;
}
return super.visit(x);
}
/** **************************************************************************/
// for oracle to postsql
/** **************************************************************************/
// public bool visit(OracleSysdateExpr x) {
// print0(ucase ? "CURRENT_TIMESTAMP" : "CURRENT_TIMESTAMP");
// return false;
// }
// override
// public void endVisit(OracleSysdateExpr x) {
// }
// override
// public bool visit(OracleExceptionStatement x) {
// return false;
// }
// override
// public void endVisit(OracleExceptionStatement x) {
// }
// override
// public bool visit(OracleExceptionStatement.Item x) {
// return false;
// }
// override
// public void endVisit(OracleExceptionStatement.Item x) {
// }
// override
// public bool visit(OracleArgumentExpr x) {
// return false;
// }
// override
// public void endVisit(OracleArgumentExpr x) {
// }
// override
// public bool visit(OracleSetTransactionStatement x) {
// return false;
// }
// override
// public void endVisit(OracleSetTransactionStatement x) {
// }
// override
// public bool visit(OracleExplainStatement x) {
// return false;
// }
// override
// public void endVisit(OracleExplainStatement x) {
// }
// override
// public bool visit(OracleAlterTableDropPartition x) {
// return false;
// }
// override
// public void endVisit(OracleAlterTableDropPartition x) {
// }
// override
// public bool visit(OracleAlterTableTruncatePartition x) {
// return false;
// }
// override
// public void endVisit(OracleAlterTableTruncatePartition x) {
// }
// override
// public bool visit(OracleAlterTableSplitPartition.TableSpaceItem x) {
// return false;
// }
// override
// public void endVisit(OracleAlterTableSplitPartition.TableSpaceItem x) {
// }
// override
// public bool visit(OracleAlterTableSplitPartition.UpdateIndexesClause x) {
// return false;
// }
// override
// public void endVisit(OracleAlterTableSplitPartition.UpdateIndexesClause x) {
// }
// override
// public bool visit(OracleAlterTableSplitPartition.NestedTablePartitionSpec x) {
// return false;
// }
// override
// public void endVisit(OracleAlterTableSplitPartition.NestedTablePartitionSpec x) {
// }
// override
// public bool visit(OracleAlterTableSplitPartition x) {
// return false;
// }
// override
// public void endVisit(OracleAlterTableSplitPartition x) {
// }
// override
// public bool visit(OracleAlterTableModify x) {
// return false;
// }
// override
// public void endVisit(OracleAlterTableModify x) {
// }
// override
// public bool visit(OracleCreateIndexStatement x) {
// return false;
// }
// override
// public void endVisit(OracleCreateIndexStatement x) {
// }
// override
// public bool visit(OracleForStatement x) {
// return false;
// }
// override
// public void endVisit(OracleForStatement x) {
// }
// public bool visit(OracleSizeExpr x) {
// x.getValue().accept(this);
// print0(x.getUnit().name());
// return false;
// }
// override
// public void endVisit(OracleSizeExpr x) {
// }
// override
// public bool visit(OracleFileSpecification x) {
// return false;
// }
// override
// public void endVisit(OracleFileSpecification x) {
// }
// override
// public bool visit(OracleAlterTablespaceAddDataFile x) {
// return false;
// }
// override
// public void endVisit(OracleAlterTablespaceAddDataFile x) {
// }
// override
// public bool visit(OracleAlterTablespaceStatement x) {
// return false;
// }
// override
// public void endVisit(OracleAlterTablespaceStatement x) {
// }
// override
// public bool visit(OracleExitStatement x) {
// return false;
// }
// override
// public void endVisit(OracleExitStatement x) {
// }
// override
// public bool visit(OracleContinueStatement x) {
// return false;
// }
// override
// public void endVisit(OracleContinueStatement x) {
// }
// override
// public bool visit(OracleRaiseStatement x) {
// return false;
// }
// override
// public void endVisit(OracleRaiseStatement x) {
// }
// override
// public bool visit(OracleCreateDatabaseDbLinkStatement x) {
// return false;
// }
// override
// public void endVisit(OracleCreateDatabaseDbLinkStatement x) {
// }
// override
// public bool visit(OracleDropDbLinkStatement x) {
// return false;
// }
// override
// public void endVisit(OracleDropDbLinkStatement x) {
// }
// override
// public bool visit(OracleDataTypeIntervalYear x) {
// return false;
// }
// override
// public void endVisit(OracleDataTypeIntervalYear x) {
// }
// override
// public bool visit(OracleDataTypeIntervalDay x) {
// return false;
// }
// override
// public void endVisit(OracleDataTypeIntervalDay x) {
// }
// override
// public bool visit(OracleUsingIndexClause x) {
// return false;
// }
// override
// public void endVisit(OracleUsingIndexClause x) {
// }
// override
// public bool visit(OracleLobStorageClause x) {
// return false;
// }
// override
// public void endVisit(OracleLobStorageClause x) {
// }
// public bool visit(OracleSelectTableReference x) {
// if (x.isOnly()) {
// print0(ucase ? "ONLY (" : "only (");
// printTableSourceExpr(x.getExpr());
// if (x.getPartition() !is null) {
// print(' ');
// x.getPartition().accept(this);
// }
// print(')');
// } else {
// printTableSourceExpr(x.getExpr());
// if (x.getPartition() !is null) {
// print(' ');
// x.getPartition().accept(this);
// }
// }
// if (x.getHints().size() > 0) {
// this.printHints(x.getHints());
// }
// if (x.getSampleClause() !is null) {
// print(' ');
// x.getSampleClause().accept(this);
// }
// if (x.getPivot() !is null) {
// println();
// x.getPivot().accept(this);
// }
// printAlias(x.getAlias());
// return false;
// }
// override
// public void endVisit(OracleSelectTableReference x) {
// }
// override
// public bool visit(PartitionExtensionClause x) {
// return false;
// }
// override
// public void endVisit(PartitionExtensionClause x) {
// }
private void printHints(List!(SQLHint) hints) {
if (hints.size() > 0) {
print0("/*~ ");
printAndAccept!SQLHint((hints), ", ");
print0(" */");
}
}
// public bool visit(OracleIntervalExpr x) {
// if (cast(SQLLiteralExpr)x.getValue() !is null) {
// print0(ucase ? "INTERVAL " : "interval ");
// x.getValue().accept(this);
// print(' ');
// } else {
// print('(');
// x.getValue().accept(this);
// print0(") ");
// }
// print0(x.getType().name());
// if (x.getPrecision() !is null) {
// print('(');
// printExpr(x.getPrecision());
// if (x.getFactionalSecondsPrecision() !is null) {
// print0(", ");
// print(x.getFactionalSecondsPrecision().intValue());
// }
// print(')');
// }
// if (x.getToType() !is null) {
// print0(ucase ? " TO " : " to ");
// print0(x.getToType().name());
// if (x.getToFactionalSecondsPrecision() !is null) {
// print('(');
// printExpr(x.getToFactionalSecondsPrecision());
// print(')');
// }
// }
// return false;
// }
// override
// public bool visit(OracleOuterExpr x) {
// x.getExpr().accept(this);
// print0("(+)");
// return false;
// }
// override
// public void endVisit(OracleDatetimeExpr x) {
// }
// public bool visit(OracleBinaryFloatExpr x) {
// print0(x.getValue().toString());
// print('F');
// return false;
// }
// override
// public void endVisit(OracleBinaryFloatExpr x) {
// }
// public bool visit(OracleBinaryDoubleExpr x) {
// print0(x.getValue().toString());
// print('D');
// return false;
// }
// override
// public void endVisit(OracleBinaryDoubleExpr x) {
// }
// override
// public void endVisit(OracleCursorExpr x) {
// }
// override
// public bool visit(OracleIsSetExpr x) {
// x.getNestedTable().accept(this);
// print0(ucase ? " IS A SET" : " is a set");
// return false;
// }
// override
// public void endVisit(OracleIsSetExpr x) {
// }
// override
// public bool visit(ModelClause.ReturnRowsClause x) {
// if (x.isAll()) {
// print0(ucase ? "RETURN ALL ROWS" : "return all rows");
// } else {
// print0(ucase ? "RETURN UPDATED ROWS" : "return updated rows");
// }
// return false;
// }
// override
// public void endVisit(ModelClause.ReturnRowsClause x) {
// }
// override
// public bool visit(ModelClause.MainModelClause x) {
// if (x.getMainModelName() !is null) {
// print0(ucase ? " MAIN " : " main ");
// x.getMainModelName().accept(this);
// }
// println();
// x.getModelColumnClause().accept(this);
// foreach(ModelClause.CellReferenceOption opt ; x.getCellReferenceOptions()) {
// println();
// print0(opt.name);
// }
// println();
// x.getModelRulesClause().accept(this);
// return false;
// }
// override
// public void endVisit(ModelClause.MainModelClause x) {
// }
// override
// public bool visit(ModelClause.ModelColumnClause x) {
// if (x.getQueryPartitionClause() !is null) {
// x.getQueryPartitionClause().accept(this);
// println();
// }
// print0(ucase ? "DIMENSION BY (" : "dimension by (");
// printAndAccept(x.getDimensionByColumns(), ", ");
// print(')');
// println();
// print0(ucase ? "MEASURES (" : "measures (");
// printAndAccept(x.getMeasuresColumns(), ", ");
// print(')');
// return false;
// }
// override
// public void endVisit(ModelClause.ModelColumnClause x) {
// }
// override
// public bool visit(ModelClause.QueryPartitionClause x) {
// print0(ucase ? "PARTITION BY (" : "partition by (");
// printAndAccept(x.getExprList(), ", ");
// print(')');
// return false;
// }
// override
// public void endVisit(ModelClause.QueryPartitionClause x) {
// }
// override
// public bool visit(ModelClause.ModelColumn x) {
// x.getExpr().accept(this);
// if (x.getAlias() !is null) {
// print(' ');
// print0(x.getAlias());
// }
// return false;
// }
// override
// public void endVisit(ModelClause.ModelColumn x) {
// }
// override
// public bool visit(ModelClause.ModelRulesClause x) {
// if (x.getOptions().size() > 0) {
// print0(ucase ? "RULES" : "rules");
// foreach(ModelClause.ModelRuleOption opt ; x.getOptions()) {
// print(' ');
// print0(opt.name);
// }
// }
// if (x.getIterate() !is null) {
// print0(ucase ? " ITERATE (" : " iterate (");
// x.getIterate().accept(this);
// print(')');
// if (x.getUntil() !is null) {
// print0(ucase ? " UNTIL (" : " until (");
// x.getUntil().accept(this);
// print(')');
// }
// }
// print0(" (");
// printAndAccept(x.getCellAssignmentItems(), ", ");
// print(')');
// return false;
// }
// override
// public void endVisit(ModelClause.ModelRulesClause x) {
// }
// override
// public bool visit(ModelClause.CellAssignmentItem x) {
// if (x.getOption() !is null) {
// print0(x.getOption().name);
// print(' ');
// }
// x.getCellAssignment().accept(this);
// if (x.getOrderBy() !is null) {
// print(' ');
// x.getOrderBy().accept(this);
// }
// print0(" = ");
// x.getExpr().accept(this);
// return false;
// }
// override
// public void endVisit(ModelClause.CellAssignmentItem x) {
// }
// override
// public bool visit(ModelClause.CellAssignment x) {
// x.getMeasureColumn().accept(this);
// print0("[");
// printAndAccept(x.getConditions(), ", ");
// print0("]");
// return false;
// }
// override
// public void endVisit(ModelClause.CellAssignment x) {
// }
// override
// public bool visit(ModelClause x) {
// print0(ucase ? "MODEL" : "model");
// this.indentCount++;
// foreach(ModelClause.CellReferenceOption opt ; x.getCellReferenceOptions()) {
// print(' ');
// print0(opt.name);
// }
// if (x.getReturnRowsClause() !is null) {
// print(' ');
// x.getReturnRowsClause().accept(this);
// }
// foreach(ModelClause.ReferenceModelClause item ; x.getReferenceModelClauses()) {
// print(' ');
// item.accept(this);
// }
// x.getMainModel().accept(this);
// this.indentCount--;
// return false;
// }
// override
// public void endVisit(ModelClause x) {
// }
// override
// public bool visit(OracleReturningClause x) {
// print0(ucase ? "RETURNING " : "returning ");
// printAndAccept(x.getItems(), ", ");
// print0(ucase ? " INTO " : " into ");
// printAndAccept(x.getValues(), ", ");
// return false;
// }
// override
// public void endVisit(OracleReturningClause x) {
// }
// override
// public bool visit(OracleInsertStatement x) {
// //visit(cast(SQLInsertStatement) x);
// print0(ucase ? "INSERT " : "insert ");
// if (x.getHints().size() > 0) {
// printAndAccept(x.getHints(), ", ");
// print(' ');
// }
// print0(ucase ? "INTO " : "into ");
// x.getTableSource().accept(this);
// printInsertColumns(x.getColumns());
// if (x.getValues() !is null) {
// println();
// print0(ucase ? "VALUES " : "values ");
// x.getValues().accept(this);
// } else {
// if (x.getQuery() !is null) {
// println();
// x.getQuery().accept(this);
// }
// }
// if (x.getReturning() !is null) {
// println();
// x.getReturning().accept(this);
// }
// if (x.getErrorLogging() !is null) {
// println();
// x.getErrorLogging().accept(this);
// }
// return false;
// }
// override
// public void endVisit(OracleInsertStatement x) {
// }
// override
// public bool visit(OracleMultiInsertStatement.InsertIntoClause x) {
// print0(ucase ? "INTO " : "into ");
// x.getTableSource().accept(this);
// if (x.getColumns().size() > 0) {
// this.indentCount++;
// println();
// print('(');
// for (int i = 0, size = x.getColumns().size(); i < size; ++i) {
// if (i != 0) {
// if (i % 5 == 0) {
// println();
// }
// print0(", ");
// }
// x.getColumns().get(i).accept(this);
// }
// print(')');
// this.indentCount--;
// }
// if (x.getValues() !is null) {
// println();
// print0(ucase ? "VALUES " : "values ");
// x.getValues().accept(this);
// } else {
// if (x.getQuery() !is null) {
// println();
// x.getQuery().accept(this);
// }
// }
// return false;
// }
// override
// public void endVisit(OracleMultiInsertStatement.InsertIntoClause x) {
// }
// override
// public bool visit(OracleMultiInsertStatement x) {
// print0(ucase ? "INSERT " : "insert ");
// if (x.getHints().size() > 0) {
// this.printHints(x.getHints());
// }
// if (x.getOption() !is null) {
// print0(x.getOption().name());
// print(' ');
// }
// for (int i = 0, size = x.getEntries().size(); i < size; ++i) {
// this.indentCount++;
// println();
// x.getEntries().get(i).accept(this);
// this.indentCount--;
// }
// println();
// x.getSubQuery().accept(this);
// return false;
// }
// override
// public void endVisit(OracleMultiInsertStatement x) {
// }
// override
// public bool visit(OracleMultiInsertStatement.ConditionalInsertClause x) {
// for (int i = 0, size = x.getItems().size(); i < size; ++i) {
// if (i != 0) {
// println();
// }
// OracleMultiInsertStatement.ConditionalInsertClauseItem item = x.getItems().get(i);
// item.accept(this);
// }
// if (x.getElseItem() !is null) {
// println();
// print0(ucase ? "ELSE" : "else");
// this.indentCount++;
// println();
// x.getElseItem().accept(this);
// this.indentCount--;
// }
// return false;
// }
// override
// public void endVisit(OracleMultiInsertStatement.ConditionalInsertClause x) {
// }
// override
// public bool visit(OracleMultiInsertStatement.ConditionalInsertClauseItem x) {
// print0(ucase ? "WHEN " : "when ");
// x.getWhen().accept(this);
// print0(ucase ? " THEN" : " then");
// this.indentCount++;
// println();
// x.getThen().accept(this);
// this.indentCount--;
// return false;
// }
// override
// public void endVisit(OracleMultiInsertStatement.ConditionalInsertClauseItem x) {
// }
// override
// public bool visit(OracleSelectQueryBlock x) {
// if (isPrettyFormat() && x.hasBeforeComment()) {
// printlnComments(x.getBeforeCommentsDirect());
// }
// print0(ucase ? "SELECT " : "select ");
// if (x.getHintsSize() > 0) {
// printAndAccept(x.getHints(), ", ");
// print(' ');
// }
// if (SQLSetQuantifier.ALL == x.getDistionOption()) {
// print0(ucase ? "ALL " : "all ");
// } else if (SQLSetQuantifier.DISTINCT == x.getDistionOption()) {
// print0(ucase ? "DISTINCT " : "distinct ");
// } else if (SQLSetQuantifier.UNIQUE == x.getDistionOption()) {
// print0(ucase ? "UNIQUE " : "unique ");
// }
// printSelectList(x.getSelectList());
// if (x.getInto() !is null) {
// println();
// print0(ucase ? "INTO " : "into ");
// x.getInto().accept(this);
// }
// println();
// print0(ucase ? "FROM " : "from ");
// if (x.getFrom() is null) {
// print0(ucase ? "DUAL" : "dual");
// } else {
// x.getFrom().accept(this);
// }
// if (x.getWhere() !is null) {
// println();
// print0(ucase ? "WHERE " : "where ");
// x.getWhere().accept(this);
// }
// printHierarchical(x);
// if (x.getGroupBy() !is null) {
// println();
// x.getGroupBy().accept(this);
// }
// if (x.getModelClause() !is null) {
// println();
// x.getModelClause().accept(this);
// }
// SQLOrderBy orderBy = x.getOrderBy();
// if (orderBy !is null) {
// println();
// orderBy.accept(this);
// }
// printFetchFirst(x);
// if (x.isForUpdate()) {
// println();
// print0(ucase ? "FOR UPDATE" : "for update");
// if (x.getForUpdateOfSize() > 0) {
// print('(');
// printAndAccept(x.getForUpdateOf(), ", ");
// print(')');
// }
// if (x.isNoWait()) {
// print0(ucase ? " NOWAIT" : " nowait");
// } else if (x.isSkipLocked()) {
// print0(ucase ? " SKIP LOCKED" : " skip locked");
// } else if (x.getWaitTime() !is null) {
// print0(ucase ? " WAIT " : " wait ");
// x.getWaitTime().accept(this);
// }
// }
// return false;
// }
// override
// public void endVisit(OracleSelectQueryBlock x) {
// }
// override
// public bool visit(OracleLockTableStatement x) {
// print0(ucase ? "LOCK TABLE " : "lock table ");
// x.getTable().accept(this);
// print0(ucase ? " IN " : " in ");
// print0(x.getLockMode().toString());
// print0(ucase ? " MODE " : " mode ");
// if (x.isNoWait()) {
// print0(ucase ? "NOWAIT" : "nowait");
// } else if (x.getWait() !is null) {
// print0(ucase ? "WAIT " : "wait ");
// x.getWait().accept(this);
// }
// return false;
// }
// override
// public void endVisit(OracleLockTableStatement x) {
// }
// override
// public bool visit(OracleAlterSessionStatement x) {
// print0(ucase ? "ALTER SESSION SET " : "alter session set ");
// printAndAccept(x.getItems(), ", ");
// return false;
// }
// override
// public void endVisit(OracleAlterSessionStatement x) {
// }
// public bool visit(OracleRangeExpr x) {
// x.getLowBound().accept(this);
// print0("..");
// x.getUpBound().accept(this);
// return false;
// }
// override
// public void endVisit(OracleRangeExpr x) {
// }
// override
// public bool visit(OracleAlterIndexStatement x) {
// print0(ucase ? "ALTER INDEX " : "alter index ");
// x.getName().accept(this);
// if (x.getRenameTo() !is null) {
// print0(ucase ? " RENAME TO " : " rename to ");
// x.getRenameTo().accept(this);
// }
// if (x.getMonitoringUsage() !is null) {
// print0(ucase ? " MONITORING USAGE" : " monitoring usage");
// }
// if (x.getRebuild() !is null) {
// print(' ');
// x.getRebuild().accept(this);
// }
// if (x.getParallel() !is null) {
// print0(ucase ? " PARALLEL" : " parallel");
// x.getParallel().accept(this);
// }
// return false;
// }
// override
// public void endVisit(OracleAlterIndexStatement x) {
// }
// public bool visit(OracleCheck x) {
// visit(cast(SQLCheck) x);
// return false;
// }
// override
// public void endVisit(OracleCheck x) {
// }
// override
// public bool visit(OracleSupplementalIdKey x) {
// print0(ucase ? "SUPPLEMENTAL LOG DATA (" : "supplemental log data (");
// int count = 0;
// if (x.isAll()) {
// print0(ucase ? "ALL" : "all");
// count++;
// }
// if (x.isPrimaryKey()) {
// if (count != 0) {
// print0(", ");
// }
// print0(ucase ? "PRIMARY KEY" : "primary key");
// count++;
// }
// if (x.isUnique()) {
// if (count != 0) {
// print0(", ");
// }
// print0(ucase ? "UNIQUE" : "unique");
// count++;
// }
// if (x.isUniqueIndex()) {
// if (count != 0) {
// print0(", ");
// }
// print0(ucase ? "UNIQUE INDEX" : "unique index");
// count++;
// }
// if (x.isForeignKey()) {
// if (count != 0) {
// print0(", ");
// }
// print0(ucase ? "FOREIGN KEY" : "foreign key");
// count++;
// }
// print0(ucase ? ") COLUMNS" : ") columns");
// return false;
// }
// override
// public void endVisit(OracleSupplementalIdKey x) {
// }
// override
// public bool visit(OracleSupplementalLogGrp x) {
// print0(ucase ? "SUPPLEMENTAL LOG GROUP " : "supplemental log group ");
// x.getGroup().accept(this);
// print0(" (");
// printAndAccept(x.getColumns(), ", ");
// print(')');
// if (x.isAlways()) {
// print0(ucase ? " ALWAYS" : " always");
// }
// return false;
// }
// override
// public void endVisit(OracleSupplementalLogGrp x) {
// }
// override
// public bool visit(OracleCreateTableStatement.Organization x) {
// string type = x.getType();
// print0(ucase ? "ORGANIZATION " : "organization ");
// print0(ucase ? type : toLower(type));
// printOracleSegmentAttributes(x);
// if (x.getPctthreshold() !is null) {
// println();
// print0(ucase ? "PCTTHRESHOLD " : "pctthreshold ");
// print(x.getPctfree());
// }
// if ("EXTERNAL".equalsIgnoreCase(type)) {
// print0(" (");
// this.indentCount++;
// if (x.getExternalType() !is null) {
// println();
// print0(ucase ? "TYPE " : "type ");
// x.getExternalType().accept(this);
// }
// if (x.getExternalDirectory() !is null) {
// println();
// print0(ucase ? "DEFAULT DIRECTORY " : "default directory ");
// x.getExternalDirectory().accept(this);
// }
// if (x.getExternalDirectoryRecordFormat() !is null) {
// println();
// this.indentCount++;
// print0(ucase ? "ACCESS PARAMETERS (" : "access parameters (");
// x.getExternalDirectoryRecordFormat().accept(this);
// this.indentCount--;
// println();
// print(')');
// }
// if (x.getExternalDirectoryLocation().size() > 0) {
// println();
// print0(ucase ? "LOCATION (" : " location(");
// printAndAccept(x.getExternalDirectoryLocation(), ", ");
// print(')');
// }
// this.indentCount--;
// println();
// print(')');
// if (x.getExternalRejectLimit() !is null) {
// println();
// print0(ucase ? "REJECT LIMIT " : "reject limit ");
// x.getExternalRejectLimit().accept(this);
// }
// }
// return false;
// }
// override
// public void endVisit(OracleCreateTableStatement.Organization x) {
// }
// override
// public bool visit(OracleCreateTableStatement.OIDIndex x) {
// print0(ucase ? "OIDINDEX" : "oidindex");
// if (x.getName() !is null) {
// print(' ');
// x.getName().accept(this);
// }
// print(" (");
// this.indentCount++;
// printOracleSegmentAttributes(x);
// this.indentCount--;
// println();
// print(")");
// return false;
// }
// override
// public void endVisit(OracleCreateTableStatement.OIDIndex x) {
// }
// override
// public bool visit(OracleCreatePackageStatement x) {
// if (x.isOrReplace()) {
// print0(ucase ? "CREATE OR REPLACE PACKAGE " : "create or replace procedure ");
// } else {
// print0(ucase ? "CREATE PACKAGE " : "create procedure ");
// }
// if (x.isBody()) {
// print0(ucase ? "BODY " : "body ");
// }
// x.getName().accept(this);
// if (x.isBody()) {
// println();
// print0(ucase ? "BEGIN" : "begin");
// }
// this.indentCount++;
// List!(SQLStatement) statements = x.getStatements();
// for (int i = 0, size = statements.size(); i < size; ++i) {
// println();
// SQLStatement stmt = statements.get(i);
// stmt.accept(this);
// }
// this.indentCount--;
// if (x.isBody() || statements.size() > 0) {
// println();
// print0(ucase ? "END " : "end ");
// x.getName().accept(this);
// print(';');
// }
// return false;
// }
// override
// public void endVisit(OracleCreatePackageStatement x) {
// }
// override
// public bool visit(OracleExecuteImmediateStatement x) {
// print0(ucase ? "EXECUTE IMMEDIATE " : "execute immediate ");
// x.getDynamicSql().accept(this);
// List!(SQLExpr) into = x.getInto();
// if (into.size() > 0) {
// print0(ucase ? " INTO " : " into ");
// printAndAccept(into, ", ");
// }
// List!(SQLArgument) using = x.getArguments();
// if (using.size() > 0) {
// print0(ucase ? " USING " : " using ");
// printAndAccept(using, ", ");
// }
// List!(SQLExpr) returnInto = x.getReturnInto();
// if (returnInto.size() > 0) {
// print0(ucase ? " RETURNNING INTO " : " returnning into ");
// printAndAccept(returnInto, ", ");
// }
// return false;
// }
// override
// public void endVisit(OracleExecuteImmediateStatement x) {
// }
// override
// public bool visit(OracleTreatExpr x) {
// print0(ucase ? "TREAT (" : "treat (");
// x.getExpr().accept(this);
// print0(ucase ? " AS " : " as ");
// if (x.isRef()) {
// print0(ucase ? "REF " : "ref ");
// }
// x.getType().accept(this);
// print(')');
// return false;
// }
// override
// public void endVisit(OracleTreatExpr x) {
// }
// override
// public bool visit(OracleCreateSynonymStatement x) {
// if (x.isOrReplace()) {
// print0(ucase ? "CREATE OR REPLACE " : "create or replace ");
// } else {
// print0(ucase ? "CREATE " : "create ");
// }
// if (x.isPublic()) {
// print0(ucase ? "PUBLIC " : "public ");
// }
// print0(ucase ? "SYNONYM " : "synonym ");
// x.getName().accept(this);
// print0(ucase ? " FOR " : " for ");
// x.getObject().accept(this);
// return false;
// }
// override
// public void endVisit(OracleCreateSynonymStatement x) {
// }
// override
// public bool visit(OracleCreateTypeStatement x) {
// if (x.isOrReplace()) {
// print0(ucase ? "CREATE OR REPLACE TYPE " : "create or replace type ");
// } else {
// print0(ucase ? "CREATE TYPE " : "create type ");
// }
// if (x.isBody()) {
// print0(ucase ? "BODY " : "body ");
// }
// x.getName().accept(this);
// SQLName under = x.getUnder();
// if (under !is null) {
// print0(ucase ? " UNDER " : " under ");
// under.accept(this);
// }
// SQLName authId = x.getAuthId();
// if (authId !is null) {
// print0(ucase ? " AUTHID " : " authid ");
// authId.accept(this);
// }
// if (x.isForce()) {
// print0(ucase ? "FORCE " : "force ");
// }
// List!(SQLParameter) parameters = x.getParameters();
// SQLDataType tableOf = x.getTableOf();
// if (x.isObject()) {
// print0(" AS OBJECT");
// }
// if (parameters.size() > 0) {
// if (x.isParen()) {
// print(" (");
// } else {
// print0(ucase ? " IS" : " is");
// }
// indentCount++;
// println();
// for (int i = 0; i < parameters.size(); ++i) {
// SQLParameter param = parameters.get(i);
// param.accept(this);
// SQLDataType dataType = param.getDataType();
// if (i < parameters.size() - 1) {
// if (cast(OracleFunctionDataType)(dataType) !is null
// && (cast(OracleFunctionDataType) dataType).getBlock() !is null) {
// // skip
// println();
// } else if (cast(OracleProcedureDataType)(dataType) !is null
// && (cast(OracleProcedureDataType) dataType).getBlock() !is null) {
// // skip
// println();
// } else {
// println(", ");
// }
// }
// }
// indentCount--;
// println();
// if (x.isParen()) {
// print0(")");
// } else {
// print0("END");
// }
// } else if (tableOf !is null) {
// print0(ucase ? " AS TABLE OF " : " as table of ");
// tableOf.accept(this);
// } else if (x.getVarraySizeLimit() !is null) {
// print0(ucase ? " VARRAY (" : " varray (");
// x.getVarraySizeLimit().accept(this);
// print0(ucase ? ") OF " : ") of ");
// x.getVarrayDataType().accept(this);
// }
// bool isFinal = x.getFinal();
// if (isFinal !is null) {
// if (isFinal.booleanValue()) {
// print0(ucase ? " FINAL" : " ");
// } else {
// print0(ucase ? " NOT FINAL" : " not ");
// }
// }
// bool instantiable = x.getInstantiable();
// if (instantiable !is null) {
// if (instantiable.booleanValue()) {
// print0(ucase ? " INSTANTIABLE" : " instantiable");
// } else {
// print0(ucase ? " NOT INSTANTIABLE" : " not instantiable");
// }
// }
// return false;
// }
// override
// public void endVisit(OracleCreateTypeStatement x) {
// }
// override
// public bool visit(OraclePipeRowStatement x) {
// print0(ucase ? "PIPE ROW(" : "pipe row(");
// printAndAccept(x.getParameters(), ", ");
// print(')');
// return false;
// }
// override
// public void endVisit(OraclePipeRowStatement x) {
// }
// public bool visit(OraclePrimaryKey x) {
// visit(cast(SQLPrimaryKey) x);
// return false;
// }
// override
// public void endVisit(OraclePrimaryKey x) {
// }
// override
// public bool visit(OracleCreateTableStatement x) {
// printCreateTable(x, false);
// if (x.getOf() !is null) {
// println();
// print0(ucase ? "OF " : "of ");
// x.getOf().accept(this);
// }
// if (x.getOidIndex() !is null) {
// println();
// x.getOidIndex().accept(this);
// }
// if (x.getOrganization() !is null) {
// println();
// this.indentCount++;
// x.getOrganization().accept(this);
// this.indentCount--;
// }
// printOracleSegmentAttributes(x);
// if (x.isInMemoryMetadata()) {
// println();
// print0(ucase ? "IN_MEMORY_METADATA" : "in_memory_metadata");
// }
// if (x.isCursorSpecificSegment()) {
// println();
// print0(ucase ? "CURSOR_SPECIFIC_SEGMENT" : "cursor_specific_segment");
// }
// if (x.getParallel() == Boolean.TRUE) {
// println();
// print0(ucase ? "PARALLEL" : "parallel");
// } else if (x.getParallel() == Boolean.FALSE) {
// println();
// print0(ucase ? "NOPARALLEL" : "noparallel");
// }
// if (x.getCache() == Boolean.TRUE) {
// println();
// print0(ucase ? "CACHE" : "cache");
// } else if (x.getCache() == Boolean.FALSE) {
// println();
// print0(ucase ? "NOCACHE" : "nocache");
// }
// if (x.getLobStorage() !is null) {
// println();
// x.getLobStorage().accept(this);
// }
// if (x.isOnCommitPreserveRows()) {
// println();
// print0(ucase ? "ON COMMIT PRESERVE ROWS" : "on commit preserve rows");
// } else if (x.isOnCommitDeleteRows()) {
// println();
// print0(ucase ? "ON COMMIT DELETE ROWS" : "on commit delete rows");
// }
// if (x.isMonitoring()) {
// println();
// print0(ucase ? "MONITORING" : "monitoring");
// }
// SQLPartitionBy partitionBy = x.getPartitioning();
// if (partitionBy !is null) {
// println();
// print0(ucase ? "PARTITION BY " : "partition by ");
// partitionBy.accept(this);
// }
// if (x.getCluster() !is null) {
// println();
// print0(ucase ? "CLUSTER " : "cluster ");
// x.getCluster().accept(this);
// print0(" (");
// printAndAccept(x.getClusterColumns(), ",");
// print0(")");
// }
// if (x.getSelect() !is null) {
// println();
// print0(ucase ? "AS" : "as");
// println();
// x.getSelect().accept(this);
// }
// return false;
// }
// override
// public void endVisit(OracleCreateTableStatement x) {
// }
// override
// public bool visit(OracleAlterIndexStatement.Rebuild x) {
// print0(ucase ? "REBUILD" : "rebuild");
// if (x.getOption() !is null) {
// print(' ');
// x.getOption().accept(this);
// }
// return false;
// }
// override
// public void endVisit(OracleAlterIndexStatement.Rebuild x) {
// }
// override
// public bool visit(OracleStorageClause x) {
// return false;
// }
// override
// public void endVisit(OracleStorageClause x) {
// }
// override
// public bool visit(OracleGotoStatement x) {
// print0(ucase ? "GOTO " : "GOTO ");
// x.getLabel().accept(this);
// return false;
// }
// override
// public void endVisit(OracleGotoStatement x) {
// }
// override
// public bool visit(OracleLabelStatement x) {
// print0("<<");
// x.getLabel().accept(this);
// print0(">>");
// return false;
// }
// override
// public void endVisit(OracleLabelStatement x) {
// }
// override
// public bool visit(OracleAlterTriggerStatement x) {
// print0(ucase ? "ALTER TRIGGER " : "alter trigger ");
// x.getName().accept(this);
// if (x.isCompile()) {
// print0(ucase ? " COMPILE" : " compile");
// }
// if (x.getEnable() !is null) {
// if (x.getEnable().booleanValue()) {
// print0(ucase ? "ENABLE" : "enable");
// } else {
// print0(ucase ? "DISABLE" : "disable");
// }
// }
// return false;
// }
// override
// public void endVisit(OracleAlterTriggerStatement x) {
// }
// override
// public bool visit(OracleAlterSynonymStatement x) {
// print0(ucase ? "ALTER SYNONYM " : "alter synonym ");
// x.getName().accept(this);
// if (x.isCompile()) {
// print0(ucase ? " COMPILE" : " compile");
// }
// if (x.getEnable() !is null) {
// if (x.getEnable().booleanValue()) {
// print0(ucase ? "ENABLE" : "enable");
// } else {
// print0(ucase ? "DISABLE" : "disable");
// }
// }
// return false;
// }
// override
// public void endVisit(OracleAlterSynonymStatement x) {
// }
// override
// public bool visit(OracleAlterViewStatement x) {
// print0(ucase ? "ALTER VIEW " : "alter view ");
// x.getName().accept(this);
// if (x.isCompile()) {
// print0(ucase ? " COMPILE" : " compile");
// }
// if (x.getEnable() !is null) {
// if (x.getEnable().booleanValue()) {
// print0(ucase ? "ENABLE" : "enable");
// } else {
// print0(ucase ? "DISABLE" : "disable");
// }
// }
// return false;
// }
// override
// public void endVisit(OracleAlterViewStatement x) {
// }
// override
// public bool visit(OracleAlterTableMoveTablespace x) {
// print0(ucase ? " MOVE TABLESPACE " : " move tablespace ");
// x.getName().accept(this);
// return false;
// }
// override
// public void endVisit(OracleAlterTableMoveTablespace x) {
// }
// public bool visit(OracleForeignKey x) {
// visit(cast(SQLForeignKeyImpl) x);
// return false;
// }
// override
// public void endVisit(OracleForeignKey x) {
// }
// public bool visit(OracleUnique x) {
// visit(cast(SQLUnique) x);
// return false;
// }
// override
// public void endVisit(OracleUnique x) {
// }
// public bool visit(OracleSelectSubqueryTableSource x) {
// print('(');
// this.indentCount++;
// println();
// x.getSelect().accept(this);
// this.indentCount--;
// println();
// print(')');
// if (x.getPivot() !is null) {
// println();
// x.getPivot().accept(this);
// }
// printFlashback(x.getFlashback());
// if ((x.getAlias() !is null) && (x.getAlias().length != 0)) {
// print(' ');
// print0(x.getAlias());
// }
// return false;
// }
// override
// public bool visit(OracleSelectUnPivot x) {
// print0(ucase ? "UNPIVOT" : "unpivot");
// if (x.getNullsIncludeType() !is null) {
// print(' ');
// print0(OracleSelectUnPivot.NullsIncludeType.toString(x.getNullsIncludeType(), ucase));
// }
// print0(" (");
// if (x.getItems().size() == 1) {
// (cast(SQLExpr) x.getItems().get(0)).accept(this);
// } else {
// print0(" (");
// printAndAccept(x.getItems(), ", ");
// print(')');
// }
// if (x.getPivotFor().size() > 0) {
// print0(ucase ? " FOR " : " for ");
// if (x.getPivotFor().size() == 1) {
// (cast(SQLExpr) x.getPivotFor().get(0)).accept(this);
// } else {
// print('(');
// printAndAccept(x.getPivotFor(), ", ");
// print(')');
// }
// }
// if (x.getPivotIn().size() > 0) {
// print0(ucase ? " IN (" : " in (");
// printAndAccept(x.getPivotIn(), ", ");
// print(')');
// }
// print(')');
// return false;
// }
// override
// public bool visit(OracleUpdateStatement x) {
// print0(ucase ? "UPDATE " : "update ");
// if (x.getHints().size() > 0) {
// printAndAccept(x.getHints(), ", ");
// print(' ');
// }
// if (x.isOnly()) {
// print0(ucase ? "ONLY (" : "only (");
// x.getTableSource().accept(this);
// print(')');
// } else {
// x.getTableSource().accept(this);
// }
// printAlias(x.getAlias());
// println();
// print0(ucase ? "SET " : "set ");
// for (int i = 0, size = x.getItems().size(); i < size; ++i) {
// if (i != 0) {
// print0(", ");
// }
// x.getItems().get(i).accept(this);
// }
// if (x.getWhere() !is null) {
// println();
// print0(ucase ? "WHERE " : "where ");
// this.indentCount++;
// x.getWhere().accept(this);
// this.indentCount--;
// }
// if (x.getReturning().size() > 0) {
// println();
// print0(ucase ? "RETURNING " : "returning ");
// printAndAccept(x.getReturning(), ", ");
// print0(ucase ? " INTO " : " into ");
// printAndAccept(x.getReturningInto(), ", ");
// }
// return false;
// }
// override
// public bool visit(SampleClause x) {
// print0(ucase ? "SAMPLE " : "sample ");
// if (x.isBlock()) {
// print0(ucase ? "BLOCK " : "block ");
// }
// print('(');
// printAndAccept(x.getPercent(), ", ");
// print(')');
// if (x.getSeedValue() !is null) {
// print0(ucase ? " SEED (" : " seed (");
// x.getSeedValue().accept(this);
// print(')');
// }
// return false;
// }
// override
// public void endVisit(SampleClause x) {
// }
// public bool visit(OracleSelectJoin x) {
// x.getLeft().accept(this);
// SQLTableSource right = x.getRight();
// if (x.getJoinType() == SQLJoinTableSource.JoinType.COMMA) {
// print0(", ");
// x.getRight().accept(this);
// } else {
// bool isRoot = cast(SQLSelectQueryBlock)x.getParent() !is null;
// if (isRoot) {
// this.indentCount++;
// }
// println();
// print0(ucase ? x.getJoinType().name : x.getJoinType().name_lcase);
// print(' ');
// if (cast(SQLJoinTableSource)(right) !is null) {
// print('(');
// right.accept(this);
// print(')');
// } else {
// right.accept(this);
// }
// if (isRoot) {
// this.indentCount--;
// }
// if (x.getCondition() !is null) {
// print0(ucase ? " ON " : " on ");
// x.getCondition().accept(this);
// print(' ');
// }
// if (x.getUsing().size() > 0) {
// print0(ucase ? " USING (" : " using (");
// printAndAccept(x.getUsing(), ", ");
// print(')');
// }
// printFlashback(x.getFlashback());
// }
// return false;
// }
// override
// public bool visit(OracleSelectPivot x) {
// print0(ucase ? "PIVOT" : "pivot");
// if (x.isXml()) {
// print0(ucase ? " XML" : " xml");
// }
// print0(" (");
// printAndAccept(x.getItems(), ", ");
// if (x.getPivotFor().size() > 0) {
// print0(ucase ? " FOR " : " for ");
// if (x.getPivotFor().size() == 1) {
// (cast(SQLExpr) x.getPivotFor().get(0)).accept(this);
// } else {
// print('(');
// printAndAccept(x.getPivotFor(), ", ");
// print(')');
// }
// }
// if (x.getPivotIn().size() > 0) {
// print0(ucase ? " IN (" : " in (");
// printAndAccept(x.getPivotIn(), ", ");
// print(')');
// }
// print(')');
// return false;
// }
// override
// public bool visit(OracleSelectPivot.Item x) {
// x.getExpr().accept(this);
// if ((x.getAlias() !is null) && (x.getAlias().length > 0)) {
// print0(ucase ? " AS " : " as ");
// print0(x.getAlias());
// }
// return false;
// }
// override
// public bool visit(OracleSelectRestriction.CheckOption x) {
// print0(ucase ? "CHECK OPTION" : "check option");
// if (x.getConstraint() !is null) {
// print(' ');
// x.getConstraint().accept(this);
// }
// return false;
// }
// override
// public bool visit(OracleSelectRestriction.ReadOnly x) {
// print0(ucase ? "READ ONLY" : "read only");
// return false;
// }
// public bool visit(OracleDbLinkExpr x) {
// SQLExpr expr = x.getExpr();
// if (expr !is null) {
// expr.accept(this);
// print('@');
// }
// print0(x.getDbLink());
// return false;
// }
// override
// public void endVisit(OracleAnalytic x) {
// }
// override
// public void endVisit(OracleAnalyticWindowing x) {
// }
// public void endVisit(OracleDbLinkExpr x) {
// }
// override
// public void endVisit(OracleDeleteStatement x) {
// }
// override
// public void endVisit(OracleIntervalExpr x) {
// }
// override
// public void endVisit(OracleOuterExpr x) {
// }
// override
// public void endVisit(OracleSelectJoin x) {
// }
// override
// public void endVisit(OracleSelectPivot x) {
// }
// override
// public void endVisit(OracleSelectPivot.Item x) {
// }
// override
// public void endVisit(OracleSelectRestriction.CheckOption x) {
// }
// override
// public void endVisit(OracleSelectRestriction.ReadOnly x) {
// }
// override
// public void endVisit(OracleSelectSubqueryTableSource x) {
// }
// override
// public void endVisit(OracleSelectUnPivot x) {
// }
// override
// public void endVisit(OracleUpdateStatement x) {
// }
// public bool visit(OracleDeleteStatement x) {
// return visit(cast(SQLDeleteStatement) x);
// }
private void printFlashback(SQLExpr flashback) {
if (flashback is null) {
return;
}
println();
if (cast(SQLBetweenExpr)(flashback) !is null) {
flashback.accept(this);
} else {
print0(ucase ? "AS OF " : "as of ");
flashback.accept(this);
}
}
// public bool visit(OracleWithSubqueryEntry x) {
// print0(x.getAlias());
// if (x.getColumns().size() > 0) {
// print0(" (");
// printAndAccept(x.getColumns(), ", ");
// print(')');
// }
// print0(ucase ? " AS " : " as ");
// print('(');
// this.indentCount++;
// println();
// x.getSubQuery().accept(this);
// this.indentCount--;
// println();
// print(')');
// if (x.getSearchClause() !is null) {
// println();
// x.getSearchClause().accept(this);
// }
// if (x.getCycleClause() !is null) {
// println();
// x.getCycleClause().accept(this);
// }
// return false;
// }
// override
// public void endVisit(OracleWithSubqueryEntry x) {
// }
// override
// public bool visit(SearchClause x) {
// print0(ucase ? "SEARCH " : "search ");
// print0(x.getType().name());
// print0(ucase ? " FIRST BY " : " first by ");
// printAndAccept(x.getItems(), ", ");
// print0(ucase ? " SET " : " set ");
// x.getOrderingColumn().accept(this);
// return false;
// }
// override
// public void endVisit(SearchClause x) {
// }
// override
// public bool visit(CycleClause x) {
// print0(ucase ? "CYCLE " : "cycle ");
// printAndAccept(x.getAliases(), ", ");
// print0(ucase ? " SET " : " set ");
// x.getMark().accept(this);
// print0(ucase ? " TO " : " to ");
// x.getValue().accept(this);
// print0(ucase ? " DEFAULT " : " default ");
// x.getDefaultValue().accept(this);
// return false;
// }
// override
// public void endVisit(CycleClause x) {
// }
// public bool visit(OracleAnalytic x) {
// print0(ucase ? "OVER (" : "over (");
// bool space = false;
// if (x.getPartitionBy().size() > 0) {
// print0(ucase ? "PARTITION BY " : "partition by ");
// printAndAccept(x.getPartitionBy(), ", ");
// space = true;
// }
// SQLOrderBy orderBy = x.getOrderBy();
// if (orderBy !is null) {
// if (space) {
// print(' ');
// }
// visit(orderBy);
// space = true;
// }
// OracleAnalyticWindowing windowing = x.getWindowing();
// if (windowing !is null) {
// if (space) {
// print(' ');
// }
// visit(windowing);
// }
// print(')');
// return false;
// }
// public bool visit(OracleAnalyticWindowing x) {
// print0(x.getType().name().toUpperCase());
// print(' ');
// x.getExpr().accept(this);
// return false;
// }
// override
// public bool visit(OracleIsOfTypeExpr x) {
// printExpr(x.getExpr());
// print0(ucase ? " IS OF TYPE (" : " is of type (");
// List!(SQLExpr) types = x.getTypes();
// for (int i = 0, size = types.size(); i < size; ++i) {
// if (i != 0) {
// print0(", ");
// }
// SQLExpr type = types.get(i);
// if (Boolean.TRUE == type.getAttribute("ONLY")) {
// print0(ucase ? "ONLY " : "only ");
// }
// type.accept(this);
// }
// print(')');
// return false;
// }
// public void endVisit(OracleIsOfTypeExpr x) {
// }
// override
// public bool visit(OracleRunStatement x) {
// print0("@@");
// printExpr(x.getExpr());
// return false;
// }
// override
// public void endVisit(OracleRunStatement x) {
// }
override
public bool visit(SQLIfStatement.Else x) {
print0(ucase ? "ELSE" : "else");
this.indentCount++;
println();
for (int i = 0, size = x.getStatements().size(); i < size; ++i) {
if (i != 0) {
println();
}
SQLStatement item = x.getStatements().get(i);
item.accept(this);
}
this.indentCount--;
return false;
}
override
public bool visit(SQLIfStatement.ElseIf x) {
print0(ucase ? "ELSE IF " : "else if ");
x.getCondition().accept(this);
print0(ucase ? " THEN" : " then");
this.indentCount++;
for (int i = 0, size = x.getStatements().size(); i < size; ++i) {
println();
SQLStatement item = x.getStatements().get(i);
item.accept(this);
}
this.indentCount--;
return false;
}
override
public bool visit(SQLIfStatement x) {
print0(ucase ? "IF " : "if ");
int lines = this.lines;
this.indentCount++;
x.getCondition().accept(this);
this.indentCount--;
if (lines != this.lines) {
println();
} else {
print(' ');
}
print0(ucase ? "THEN" : "then");
this.indentCount++;
for (int i = 0, size = x.getStatements().size(); i < size; ++i) {
println();
SQLStatement item = x.getStatements().get(i);
item.accept(this);
}
this.indentCount--;
foreach(SQLIfStatement.ElseIf elseIf ; x.getElseIfList()) {
println();
elseIf.accept(this);
}
if (x.getElseItem() !is null) {
println();
x.getElseItem().accept(this);
}
println();
print0(ucase ? "END IF" : "end if");
return false;
}
override
public bool visit(SQLCreateIndexStatement x) {
print0(ucase ? "CREATE " : "create ");
if (x.getType() !is null) {
print0(x.getType());
print(' ');
}
print0(ucase ? "INDEX " : "index ");
x.getName().accept(this);
if (x.getUsing() !is null) {
print0(ucase ? " USING " : " using ");
print0(x.getUsing());
}
print0(ucase ? " ON " : " on ");
x.getTable().accept(this);
print0(" (");
printAndAccept!SQLSelectOrderByItem((x.getItems()), ", ");
print(')');
SQLExpr comment = x.getComment();
if (comment !is null) {
print0(ucase ? " COMMENT " : " comment ");
comment.accept(this);
}
return false;
}
override
public bool visit(SQLAlterTableAddColumn x) {
bool odps = isOdps();
print0(ucase ? "ADD COLUMN " : "add column ");
printAndAccept!SQLColumnDefinition((x.getColumns()), ", ");
return false;
}
override protected void visitAggreateRest(SQLAggregateExpr x) {
SQLOrderBy orderBy = x.getWithinGroup();
if (orderBy !is null) {
print(' ');
orderBy.accept(this);
}
}
override protected void print0(Bytes data) {
string s = format("E'%(\\\\%03o%)'", data.value());
print0(s);
}
alias print0 = SQLASTOutputVisitor.print0;
}
| D |
/**************************************************************************
ЗОМБИ
Нежить. Можно призывать. Несколько видов (внешне).
Трофеи: нет.
Квестовые: приспешники Ворона, зомби в Яркендаре,
пробудившийся Бладвин (не исп.).
***************************************************************************/
prototype Mst_Default_Zombie(C_Npc)
{
name[0] = "Зомби";
guild = GIL_ZOMBIE;
aivar[AIV_MM_REAL_ID] = ID_ZOMBIE;
level = 20;
attribute[ATR_STRENGTH] = 100;
attribute[ATR_DEXTERITY] = 100;
attribute[ATR_HITPOINTS_MAX] = 400;
attribute[ATR_HITPOINTS] = 400;
attribute[ATR_MANA_MAX] = 100;
attribute[ATR_MANA] = 100;
protection[PROT_BLUNT] = 50;
protection[PROT_EDGE] = 50;
protection[PROT_POINT] = 50;
protection[PROT_FIRE] = 50;
protection[PROT_FLY] = 50;
protection[PROT_MAGIC] = 0;
damagetype = DAM_EDGE;
fight_tactic = FAI_ZOMBIE;
senses = SENSE_HEAR | SENSE_SEE | SENSE_SMELL;
senses_range = PERC_DIST_MONSTER_ACTIVE_MAX;
aivar[AIV_MM_Behaviour] = 0;
aivar[AIV_MM_FollowTime] = FOLLOWTIME_MEDIUM;
start_aistate = ZS_MM_AllScheduler;
aivar[AIV_MM_RestStart] = OnlyRoutine;
};
func void B_SetVisuals_Zombie01()
{
Mdl_SetVisual(self,"Zombie.mds");
Mdl_SetVisualBody(self,"Zom_Body",0,0,"Zom_Head",0,DEFAULT,-1);
};
func void B_SetVisuals_Zombie02()
{
Mdl_SetVisual(self,"Zombie.mds");
Mdl_SetVisualBody(self,"Zom_Body",0,0,"Zom_Head",1,DEFAULT,-1);
};
func void B_SetVisuals_Zombie03()
{
Mdl_SetVisual(self,"Zombie.mds");
Mdl_SetVisualBody(self,"Zom_Body",0,1,"Zom_Head",0,DEFAULT,-1);
};
func void B_SetVisuals_Zombie04()
{
Mdl_SetVisual(self,"Zombie.mds");
Mdl_SetVisualBody(self,"Zom_Body",0,1,"Zom_Head",1,DEFAULT,-1);
};
instance Zombie01(Mst_Default_Zombie)
{
B_SetVisuals_Zombie01();
Npc_SetToFistMode(self);
};
instance Zombie02(Mst_Default_Zombie)
{
B_SetVisuals_Zombie02();
Npc_SetToFistMode(self);
};
instance Zombie03(Mst_Default_Zombie)
{
B_SetVisuals_Zombie03();
Npc_SetToFistMode(self);
};
instance Zombie04(Mst_Default_Zombie)
{
B_SetVisuals_Zombie04();
Npc_SetToFistMode(self);
};
instance Zombie_Addon_Knecht(Mst_Default_Zombie)
{
name[0] = "Приспешник Ворона";
Mdl_SetVisual(self,"Zombie.mds");
Mdl_SetVisualBody(self,"Zom_Body",0,0,"Zom_Head",0,DEFAULT,ITAR_Thorus_Addon);
Npc_SetToFistMode(self);
};
instance Zombie_Addon_Bloodwyn(Mst_Default_Zombie)
{
name[0] = "Пробудившийся Бладвин";
level = 25;
attribute[ATR_HITPOINTS_MAX] = 1600;
attribute[ATR_HITPOINTS] = 1600;
Mdl_SetVisual(self,"Zombie.mds");
Mdl_SetVisualBody(self,"Zom_Body",0,0,"Zom_Head",0,DEFAULT,ITAR_Thorus_Addon);
Npc_SetToFistMode(self);
};
func void ZS_Pal_ZOMBIE()
{
self.senses = SENSE_SMELL;
self.senses_range = 2000;
Npc_SetPercTime(self,1);
Npc_PercEnable(self,PERC_ASSESSPLAYER,B_Pal_ZOMBIE_RISE);
self.aivar[AIV_TAPOSITION] = NOTINPOS;
};
func int ZS_Pal_ZOMBIE_Loop()
{
if(self.aivar[AIV_TAPOSITION] == NOTINPOS)
{
AI_PlayAni(self,"T_DOWN");
self.aivar[AIV_TAPOSITION] = ISINPOS;
};
return LOOP_CONTINUE;
};
func void ZS_Pal_ZOMBIE_END()
{
};
func void B_Pal_ZOMBIE_RISE()
{
if(Npc_GetDistToNpc(self,hero) <= 1400)
{
AI_PlayAni(self,"T_RISE");
AI_StartState(self,ZS_MM_Attack,0,"");
self.bodyStateInterruptableOverride = FALSE;
self.start_aistate = ZS_MM_AllScheduler;
self.aivar[AIV_MM_RestStart] = OnlyRoutine;
};
};
func void B_SetVisuals_Pal_Zombie01()
{
Mdl_SetVisual(self,"Zombie.mds");
Mdl_SetVisualBody(self,"Zom_Body",0,0,"Zom_Head",0,DEFAULT,itar_pal_skel);
};
func void B_SetVisuals_Pal_Zombie02()
{
Mdl_SetVisual(self,"Zombie.mds");
Mdl_SetVisualBody(self,"Zom_Body",0,0,"Zom_Head",1,DEFAULT,itar_pal_skel);
};
func void B_SetVisuals_Pal_Zombie03()
{
Mdl_SetVisual(self,"Zombie.mds");
Mdl_SetVisualBody(self,"Zom_Body",0,1,"Zom_Head",0,DEFAULT,itar_pal_skel);
};
func void B_SetVisuals_Pal_Zombie04()
{
Mdl_SetVisual(self,"Zombie.mds");
Mdl_SetVisualBody(self,"Zom_Body",0,1,"Zom_Head",1,DEFAULT,itar_pal_skel);
};
instance Pal_Zombie01(Mst_Default_Zombie)
{
B_SetVisuals_Pal_Zombie01();
Npc_SetToFistMode(self);
start_aistate = ZS_Pal_ZOMBIE;
aivar[AIV_MM_RestStart] = OnlyRoutine;
};
instance Pal_Zombie02(Mst_Default_Zombie)
{
B_SetVisuals_Pal_Zombie02();
Npc_SetToFistMode(self);
start_aistate = ZS_Pal_ZOMBIE;
aivar[AIV_MM_RestStart] = OnlyRoutine;
};
instance Pal_Zombie03(Mst_Default_Zombie)
{
B_SetVisuals_Pal_Zombie03();
Npc_SetToFistMode(self);
start_aistate = ZS_Pal_ZOMBIE;
aivar[AIV_MM_RestStart] = OnlyRoutine;
};
instance Pal_Zombie04(Mst_Default_Zombie)
{
B_SetVisuals_Pal_Zombie04();
Npc_SetToFistMode(self);
start_aistate = ZS_Pal_ZOMBIE;
aivar[AIV_MM_RestStart] = OnlyRoutine;
};
func void B_SetVisuals_Maya_Zombie01()
{
Mdl_SetVisual(self,"Zombie.mds");
Mdl_SetVisualBody(self,"Zom_Body",0,0,"Zom_Head",0,DEFAULT,ITAR_MayaZombie_Addon);
};
func void B_SetVisuals_Maya_Zombie02()
{
Mdl_SetVisual(self,"Zombie.mds");
Mdl_SetVisualBody(self,"Zom_Body",0,0,"Zom_Head",1,DEFAULT,ITAR_MayaZombie_Addon);
};
func void B_SetVisuals_Maya_Zombie03()
{
Mdl_SetVisual(self,"Zombie.mds");
Mdl_SetVisualBody(self,"Zom_Body",0,1,"Zom_Head",0,DEFAULT,ITAR_MayaZombie_Addon);
};
func void B_SetVisuals_Maya_Zombie04()
{
Mdl_SetVisual(self,"Zombie.mds");
Mdl_SetVisualBody(self,"Zom_Body",0,1,"Zom_Head",1,DEFAULT,ITAR_MayaZombie_Addon);
};
instance MayaZombie01(Mst_Default_Zombie)
{
B_SetVisuals_Maya_Zombie01();
Npc_SetToFistMode(self);
start_aistate = ZS_Pal_ZOMBIE;
aivar[AIV_MM_RestStart] = OnlyRoutine;
};
instance MayaZombie02(Mst_Default_Zombie)
{
B_SetVisuals_Maya_Zombie02();
Npc_SetToFistMode(self);
};
instance MayaZombie03(Mst_Default_Zombie)
{
B_SetVisuals_Maya_Zombie03();
Npc_SetToFistMode(self);
start_aistate = ZS_Pal_ZOMBIE;
aivar[AIV_MM_RestStart] = OnlyRoutine;
};
instance MayaZombie04(Mst_Default_Zombie)
{
B_SetVisuals_Maya_Zombie04();
Npc_SetToFistMode(self);
};
instance MayaZombie04_Totenw(Mst_Default_Zombie)
{
B_SetVisuals_Maya_Zombie04();
Npc_SetToFistMode(self);
};
instance Summoned_ZOMBIE(Mst_Default_Zombie)
{
name[0] = NAME_Addon_Summoned_Zombie;
guild = GIL_SummonedZombie;
aivar[AIV_MM_REAL_ID] = ID_SummonedZombie;
level = 0;
attribute[ATR_STRENGTH] = 200;
attribute[ATR_DEXTERITY] = 200;
aivar[AIV_PARTYMEMBER] = TRUE;
B_SetAttitude(self,ATT_FRIENDLY);
start_aistate = ZS_MM_Rtn_Summoned;
B_SetVisuals_Maya_Zombie04();
Npc_SetToFistMode(self);
};
| D |
module android.java.java.util.Spliterator;
public import android.java.java.util.Spliterator_d_interface;
import arsd.jni : ImportExportImpl;
mixin ImportExportImpl!Spliterator;
import import3 = android.java.java.lang.Class;
import import1 = android.java.java.util.Spliterator;
import import2 = android.java.java.util.Comparator;
| D |
instance Mod_2011_TPL_GorNaDrak_MT (Npc_Default)
{
//-------- primary data --------
name = "Gor Na Drak";
npctype = npctype_Main;
guild = GIL_OUT;
level = 21;
voice = 0;
id = 2011;
//-------- abilities --------
attribute[ATR_STRENGTH] = 100;
attribute[ATR_DEXTERITY] = 80;
attribute[ATR_MANA_MAX] = 0;
attribute[ATR_MANA] = 0;
attribute[ATR_HITPOINTS_MAX] = 292;
attribute[ATR_HITPOINTS] = 292;
//-------- visuals --------
// animations
Mdl_SetVisual (self,"HUMANS.MDS");
Mdl_ApplyOverlayMds (self,"Humans_Mage.mds");
// body mesh ,bdytex,skin,head mesh ,headtex,teethtex,ruestung
Mdl_SetVisualBody (self,"hum_body_Naked0", 1, 1 ,"Hum_Head_Bald", 168, 1, TPL_ARMOR_H);
Mdl_SetModelFatness(self,0);
fight_tactic = FAI_HUMAN_MASTER;
//-------- Talente --------
//-------- inventory --------
EquipItem (self, ItMw_Zweihaender2);
//-------------Daily Routine-------------
daily_routine = Rtn_start_2011;
};
FUNC VOID Rtn_start_2011 () //ST-OM-Pendler (MC-Jäger)
{
TA_Smalltalk (06,00,14,00,"PSI_WALK_05");
TA_Smalltalk (14,00,06,00,"PSI_WALK_05");
}; | D |
module arrow.IntegerDataType;
private import arrow.NumericDataType;
private import arrow.c.functions;
public import arrow.c.types;
/** */
public class IntegerDataType : NumericDataType
{
/** the main Gtk struct */
protected GArrowIntegerDataType* gArrowIntegerDataType;
/** Get the main Gtk struct */
public GArrowIntegerDataType* getIntegerDataTypeStruct(bool transferOwnership = false)
{
if (transferOwnership)
ownedRef = false;
return gArrowIntegerDataType;
}
/** the main Gtk struct as a void* */
protected override void* getStruct()
{
return cast(void*)gArrowIntegerDataType;
}
/**
* Sets our main struct and passes it to the parent class.
*/
public this (GArrowIntegerDataType* gArrowIntegerDataType, bool ownedRef = false)
{
this.gArrowIntegerDataType = gArrowIntegerDataType;
super(cast(GArrowNumericDataType*)gArrowIntegerDataType, ownedRef);
}
/** */
public static GType getType()
{
return garrow_integer_data_type_get_type();
}
/**
* Returns: %TRUE if the data type is signed, %FALSE otherwise.
*
* Since: 1.0.0
*/
public bool isSigned()
{
return garrow_integer_data_type_is_signed(gArrowIntegerDataType) != 0;
}
}
| D |
/home/john/Documents/freebsdrust/std/target/debug/deps/lazy_static-20b52bc0a22ffdbc.rmeta: /home/john/.cargo/registry/src/github.com-1ecc6299db9ec823/lazy_static-1.4.0/src/lib.rs /home/john/.cargo/registry/src/github.com-1ecc6299db9ec823/lazy_static-1.4.0/src/inline_lazy.rs
/home/john/Documents/freebsdrust/std/target/debug/deps/liblazy_static-20b52bc0a22ffdbc.rlib: /home/john/.cargo/registry/src/github.com-1ecc6299db9ec823/lazy_static-1.4.0/src/lib.rs /home/john/.cargo/registry/src/github.com-1ecc6299db9ec823/lazy_static-1.4.0/src/inline_lazy.rs
/home/john/Documents/freebsdrust/std/target/debug/deps/lazy_static-20b52bc0a22ffdbc.d: /home/john/.cargo/registry/src/github.com-1ecc6299db9ec823/lazy_static-1.4.0/src/lib.rs /home/john/.cargo/registry/src/github.com-1ecc6299db9ec823/lazy_static-1.4.0/src/inline_lazy.rs
/home/john/.cargo/registry/src/github.com-1ecc6299db9ec823/lazy_static-1.4.0/src/lib.rs:
/home/john/.cargo/registry/src/github.com-1ecc6299db9ec823/lazy_static-1.4.0/src/inline_lazy.rs:
| D |
import std.stdio, std.algorithm, std.conv, std.array, std.string, std.math, std.typecons, std.numeric, std.container, std.range;
void get(Args...)(ref Args args)
{
import std.traits, std.meta, std.typecons;
static if (Args.length == 1) {
alias Arg = Args[0];
static if (isArray!Arg) {
static if (isSomeChar!(ElementType!Arg)) {
args[0] = readln.chomp.to!Arg;
} else {
args[0] = readln.split.to!Arg;
}
} else static if (isTuple!Arg) {
auto input = readln.split;
static foreach (i; 0..Fields!Arg.length) {
args[0][i] = input[i].to!(Fields!Arg[i]);
}
} else {
args[0] = readln.chomp.to!Arg;
}
} else {
auto input = readln.split;
assert(input.length == Args.length);
static foreach (i; 0..Args.length) {
args[i] = input[i].to!(Args[i]);
}
}
}
void get_lines(Args...)(size_t N, ref Args args)
{
import std.traits, std.range;
static foreach (i; 0..Args.length) {
static assert(isArray!(Args[i]));
args[i].length = N;
}
foreach (i; 0..N) {
static if (Args.length == 1) {
get(args[0][i]);
} else {
auto input = readln.split;
static foreach (j; 0..Args.length) {
args[j][i] = input[j].to!(ElementType!(Args[j]));
}
}
}
}
void main()
{
int N; get(N);
char[] S, T; get(S); get(T);
if (S.count('1') != T.count('1')) return writeln(-1);
int c, r;
foreach (i; 0..N) {
if (S[i] == '1' && T[i] == '0') {
if (r < 0) ++c;
++r;
} else if (S[i] == '0' && T[i] == '1') {
if (r > 0) ++c;
--r;
} else if (S[i] == '0' && T[i] == '0' && r) {
++c;
}
}
writeln(c);
}
/*
1110110
1010111
1010111
1010111
9
011000110
110000011
*/
| D |
/**
* Defines a D type.
*
* Copyright: Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
* Authors: $(LINK2 https://www.digitalmars.com, Walter Bright)
* License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
* Source: $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/mtype.d, _mtype.d)
* Documentation: https://dlang.org/phobos/dmd_mtype.html
* Coverage: https://codecov.io/gh/dlang/dmd/src/master/src/dmd/mtype.d
*/
module dmd.mtype;
import core.checkedint;
import core.stdc.stdarg;
import core.stdc.stdio;
import core.stdc.stdlib;
import core.stdc.string;
import dmd.aggregate;
import dmd.arraytypes;
import dmd.attrib;
import dmd.astenums;
import dmd.ast_node;
import dmd.gluelayer;
import dmd.dclass;
import dmd.declaration;
import dmd.denum;
import dmd.dmangle;
import dmd.dscope;
import dmd.dstruct;
import dmd.dsymbol;
import dmd.dsymbolsem;
import dmd.dtemplate;
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.init;
import dmd.location;
import dmd.opover;
import dmd.root.ctfloat;
import dmd.common.outbuffer;
import dmd.root.rmem;
import dmd.root.rootobject;
import dmd.root.stringtable;
import dmd.target;
import dmd.tokens;
import dmd.typesem;
import dmd.visitor;
enum LOGDOTEXP = 0; // log ::dotExp()
enum LOGDEFAULTINIT = 0; // log ::defaultInit()
enum SIZE_INVALID = (~cast(uinteger_t)0); // error return from size() functions
/***************************
* Return !=0 if modfrom can be implicitly converted to modto
*/
bool MODimplicitConv(MOD modfrom, MOD modto) pure nothrow @nogc @safe
{
if (modfrom == modto)
return true;
//printf("MODimplicitConv(from = %x, to = %x)\n", modfrom, modto);
auto X(T, U)(T m, U n)
{
return ((m << 4) | n);
}
switch (X(modfrom & ~MODFlags.shared_, modto & ~MODFlags.shared_))
{
case X(0, MODFlags.const_):
case X(MODFlags.wild, MODFlags.const_):
case X(MODFlags.wild, MODFlags.wildconst):
case X(MODFlags.wildconst, MODFlags.const_):
return (modfrom & MODFlags.shared_) == (modto & MODFlags.shared_);
case X(MODFlags.immutable_, MODFlags.const_):
case X(MODFlags.immutable_, MODFlags.wildconst):
return true;
default:
return false;
}
}
/***************************
* Return MATCH.exact or MATCH.constant if a method of type '() modfrom' can call a method of type '() modto'.
*/
MATCH MODmethodConv(MOD modfrom, MOD modto) pure nothrow @nogc @safe
{
if (modfrom == modto)
return MATCH.exact;
if (MODimplicitConv(modfrom, modto))
return MATCH.constant;
auto X(T, U)(T m, U n)
{
return ((m << 4) | n);
}
switch (X(modfrom, modto))
{
case X(0, MODFlags.wild):
case X(MODFlags.immutable_, MODFlags.wild):
case X(MODFlags.const_, MODFlags.wild):
case X(MODFlags.wildconst, MODFlags.wild):
case X(MODFlags.shared_, MODFlags.shared_ | MODFlags.wild):
case X(MODFlags.shared_ | MODFlags.immutable_, MODFlags.shared_ | MODFlags.wild):
case X(MODFlags.shared_ | MODFlags.const_, MODFlags.shared_ | MODFlags.wild):
case X(MODFlags.shared_ | MODFlags.wildconst, MODFlags.shared_ | MODFlags.wild):
return MATCH.constant;
default:
return MATCH.nomatch;
}
}
/***************************
* Merge mod bits to form common mod.
*/
MOD MODmerge(MOD mod1, MOD mod2) pure nothrow @nogc @safe
{
if (mod1 == mod2)
return mod1;
//printf("MODmerge(1 = %x, 2 = %x)\n", mod1, mod2);
MOD result = 0;
if ((mod1 | mod2) & MODFlags.shared_)
{
// If either type is shared, the result will be shared
result |= MODFlags.shared_;
mod1 &= ~MODFlags.shared_;
mod2 &= ~MODFlags.shared_;
}
if (mod1 == 0 || mod1 == MODFlags.mutable || mod1 == MODFlags.const_ || mod2 == 0 || mod2 == MODFlags.mutable || mod2 == MODFlags.const_)
{
// If either type is mutable or const, the result will be const.
result |= MODFlags.const_;
}
else
{
// MODFlags.immutable_ vs MODFlags.wild
// MODFlags.immutable_ vs MODFlags.wildconst
// MODFlags.wild vs MODFlags.wildconst
assert(mod1 & MODFlags.wild || mod2 & MODFlags.wild);
result |= MODFlags.wildconst;
}
return result;
}
/*********************************
* Store modifier name into buf.
*/
void MODtoBuffer(OutBuffer* buf, MOD mod) nothrow
{
buf.writestring(MODtoString(mod));
}
/*********************************
* Returns:
* a human readable representation of `mod`,
* which is the token `mod` corresponds to
*/
const(char)* MODtoChars(MOD mod) nothrow pure
{
/// Works because we return a literal
return MODtoString(mod).ptr;
}
/// Ditto
string MODtoString(MOD mod) nothrow pure
{
final switch (mod)
{
case 0:
return "";
case MODFlags.immutable_:
return "immutable";
case MODFlags.shared_:
return "shared";
case MODFlags.shared_ | MODFlags.const_:
return "shared const";
case MODFlags.const_:
return "const";
case MODFlags.shared_ | MODFlags.wild:
return "shared inout";
case MODFlags.wild:
return "inout";
case MODFlags.shared_ | MODFlags.wildconst:
return "shared inout const";
case MODFlags.wildconst:
return "inout const";
}
}
/*************************************************
* Pick off one of the trust flags from trust,
* and return a string representation of it.
*/
string trustToString(TRUST trust) pure nothrow @nogc @safe
{
final switch (trust)
{
case TRUST.default_:
return null;
case TRUST.system:
return "@system";
case TRUST.trusted:
return "@trusted";
case TRUST.safe:
return "@safe";
}
}
unittest
{
assert(trustToString(TRUST.default_) == "");
assert(trustToString(TRUST.system) == "@system");
assert(trustToString(TRUST.trusted) == "@trusted");
assert(trustToString(TRUST.safe) == "@safe");
}
/************************************
* Convert MODxxxx to STCxxx
*/
StorageClass ModToStc(uint mod) pure nothrow @nogc @safe
{
StorageClass stc = 0;
if (mod & MODFlags.immutable_)
stc |= STC.immutable_;
if (mod & MODFlags.const_)
stc |= STC.const_;
if (mod & MODFlags.wild)
stc |= STC.wild;
if (mod & MODFlags.shared_)
stc |= STC.shared_;
return stc;
}
///Returns true if ty is char, wchar, or dchar
bool isSomeChar(TY ty) pure nothrow @nogc @safe
{
return ty == Tchar || ty == Twchar || ty == Tdchar;
}
/************************************
* Determine mutability of indirections in (ref) t.
*
* Returns: When the type has any mutable indirections, returns 0.
* When all indirections are immutable, returns 2.
* Otherwise, when the type has const/inout indirections, returns 1.
*
* Params:
* isref = if true, check `ref t`; otherwise, check just `t`
* t = the type that is being checked
*/
int mutabilityOfType(bool isref, Type t)
{
if (isref)
{
if (t.mod & MODFlags.immutable_)
return 2;
if (t.mod & (MODFlags.const_ | MODFlags.wild))
return 1;
return 0;
}
t = t.baseElemOf();
if (!t.hasPointers() || t.mod & MODFlags.immutable_)
return 2;
/* Accept immutable(T)[] and immutable(T)* as being strongly pure
*/
if (t.ty == Tarray || t.ty == Tpointer)
{
Type tn = t.nextOf().toBasetype();
if (tn.mod & MODFlags.immutable_)
return 2;
if (tn.mod & (MODFlags.const_ | MODFlags.wild))
return 1;
}
/* The rest of this is too strict; fix later.
* For example, the only pointer members of a struct may be immutable,
* which would maintain strong purity.
* (Just like for dynamic arrays and pointers above.)
*/
if (t.mod & (MODFlags.const_ | MODFlags.wild))
return 1;
/* Should catch delegates and function pointers, and fold in their purity
*/
return 0;
}
/****************
* dotExp() bit flags
*/
enum DotExpFlag
{
none = 0,
gag = 1, // don't report "not a property" error and just return null
noDeref = 2, // the use of the expression will not attempt a dereference
noAliasThis = 4, // don't do 'alias this' resolution
}
/// Result of a check whether two types are covariant
enum Covariant
{
distinct = 0, /// types are distinct
yes = 1, /// types are covariant
no = 2, /// arguments match as far as overloading goes, but types are not covariant
fwdref = 3, /// cannot determine covariance because of forward references
}
/***********************************************************
*/
extern (C++) abstract class Type : ASTNode
{
TY ty;
MOD mod; // modifiers MODxxxx
char* deco;
static struct Mcache
{
/* These are cached values that are lazily evaluated by constOf(), immutableOf(), etc.
* They should not be referenced by anybody but mtype.d.
* They can be null if not lazily evaluated yet.
* Note that there is no "shared immutable", because that is just immutable
* The point of this is to reduce the size of each Type instance as
* we bank on the idea that usually only one of variants exist.
* It will also speed up code because these are rarely referenced and
* so need not be in the cache.
*/
Type cto; // MODFlags.const_
Type ito; // MODFlags.immutable_
Type sto; // MODFlags.shared_
Type scto; // MODFlags.shared_ | MODFlags.const_
Type wto; // MODFlags.wild
Type wcto; // MODFlags.wildconst
Type swto; // MODFlags.shared_ | MODFlags.wild
Type swcto; // MODFlags.shared_ | MODFlags.wildconst
}
private Mcache* mcache;
Type pto; // merged pointer to this type
Type rto; // reference to this type
Type arrayof; // array of this type
TypeInfoDeclaration vtinfo; // TypeInfo object for this Type
type* ctype; // for back end
extern (C++) __gshared Type tvoid;
extern (C++) __gshared Type tint8;
extern (C++) __gshared Type tuns8;
extern (C++) __gshared Type tint16;
extern (C++) __gshared Type tuns16;
extern (C++) __gshared Type tint32;
extern (C++) __gshared Type tuns32;
extern (C++) __gshared Type tint64;
extern (C++) __gshared Type tuns64;
extern (C++) __gshared Type tint128;
extern (C++) __gshared Type tuns128;
extern (C++) __gshared Type tfloat32;
extern (C++) __gshared Type tfloat64;
extern (C++) __gshared Type tfloat80;
extern (C++) __gshared Type timaginary32;
extern (C++) __gshared Type timaginary64;
extern (C++) __gshared Type timaginary80;
extern (C++) __gshared Type tcomplex32;
extern (C++) __gshared Type tcomplex64;
extern (C++) __gshared Type tcomplex80;
extern (C++) __gshared Type tbool;
extern (C++) __gshared Type tchar;
extern (C++) __gshared Type twchar;
extern (C++) __gshared Type tdchar;
// Some special types
extern (C++) __gshared Type tshiftcnt;
extern (C++) __gshared Type tvoidptr; // void*
extern (C++) __gshared Type tstring; // immutable(char)[]
extern (C++) __gshared Type twstring; // immutable(wchar)[]
extern (C++) __gshared Type tdstring; // immutable(dchar)[]
extern (C++) __gshared Type terror; // for error recovery
extern (C++) __gshared Type tnull; // for null type
extern (C++) __gshared Type tnoreturn; // for bottom type typeof(*null)
extern (C++) __gshared Type tsize_t; // matches size_t alias
extern (C++) __gshared Type tptrdiff_t; // matches ptrdiff_t alias
extern (C++) __gshared Type thash_t; // matches hash_t alias
extern (C++) __gshared ClassDeclaration dtypeinfo;
extern (C++) __gshared ClassDeclaration typeinfoclass;
extern (C++) __gshared ClassDeclaration typeinfointerface;
extern (C++) __gshared ClassDeclaration typeinfostruct;
extern (C++) __gshared ClassDeclaration typeinfopointer;
extern (C++) __gshared ClassDeclaration typeinfoarray;
extern (C++) __gshared ClassDeclaration typeinfostaticarray;
extern (C++) __gshared ClassDeclaration typeinfoassociativearray;
extern (C++) __gshared ClassDeclaration typeinfovector;
extern (C++) __gshared ClassDeclaration typeinfoenum;
extern (C++) __gshared ClassDeclaration typeinfofunction;
extern (C++) __gshared ClassDeclaration typeinfodelegate;
extern (C++) __gshared ClassDeclaration typeinfotypelist;
extern (C++) __gshared ClassDeclaration typeinfoconst;
extern (C++) __gshared ClassDeclaration typeinfoinvariant;
extern (C++) __gshared ClassDeclaration typeinfoshared;
extern (C++) __gshared ClassDeclaration typeinfowild;
extern (C++) __gshared TemplateDeclaration rtinfo;
extern (C++) __gshared Type[TMAX] basic;
extern (D) __gshared StringTable!Type stringtable;
extern (D) private static immutable ubyte[TMAX] sizeTy = ()
{
ubyte[TMAX] sizeTy = __traits(classInstanceSize, TypeBasic);
sizeTy[Tsarray] = __traits(classInstanceSize, TypeSArray);
sizeTy[Tarray] = __traits(classInstanceSize, TypeDArray);
sizeTy[Taarray] = __traits(classInstanceSize, TypeAArray);
sizeTy[Tpointer] = __traits(classInstanceSize, TypePointer);
sizeTy[Treference] = __traits(classInstanceSize, TypeReference);
sizeTy[Tfunction] = __traits(classInstanceSize, TypeFunction);
sizeTy[Tdelegate] = __traits(classInstanceSize, TypeDelegate);
sizeTy[Tident] = __traits(classInstanceSize, TypeIdentifier);
sizeTy[Tinstance] = __traits(classInstanceSize, TypeInstance);
sizeTy[Ttypeof] = __traits(classInstanceSize, TypeTypeof);
sizeTy[Tenum] = __traits(classInstanceSize, TypeEnum);
sizeTy[Tstruct] = __traits(classInstanceSize, TypeStruct);
sizeTy[Tclass] = __traits(classInstanceSize, TypeClass);
sizeTy[Ttuple] = __traits(classInstanceSize, TypeTuple);
sizeTy[Tslice] = __traits(classInstanceSize, TypeSlice);
sizeTy[Treturn] = __traits(classInstanceSize, TypeReturn);
sizeTy[Terror] = __traits(classInstanceSize, TypeError);
sizeTy[Tnull] = __traits(classInstanceSize, TypeNull);
sizeTy[Tvector] = __traits(classInstanceSize, TypeVector);
sizeTy[Ttraits] = __traits(classInstanceSize, TypeTraits);
sizeTy[Tmixin] = __traits(classInstanceSize, TypeMixin);
sizeTy[Tnoreturn] = __traits(classInstanceSize, TypeNoreturn);
sizeTy[Ttag] = __traits(classInstanceSize, TypeTag);
return sizeTy;
}();
final extern (D) this(TY ty) scope
{
this.ty = ty;
}
const(char)* kind() const nothrow pure @nogc @safe
{
assert(false); // should be overridden
}
final Type copy() nothrow const
{
Type t = cast(Type)mem.xmalloc(sizeTy[ty]);
memcpy(cast(void*)t, cast(void*)this, sizeTy[ty]);
return t;
}
Type syntaxCopy()
{
fprintf(stderr, "this = %s, ty = %d\n", toChars(), ty);
assert(0);
}
override bool equals(const RootObject o) const
{
Type t = cast(Type)o;
//printf("Type::equals(%s, %s)\n", toChars(), t.toChars());
// deco strings are unique
// and semantic() has been run
if (this == o || ((t && deco == t.deco) && deco !is null))
{
//printf("deco = '%s', t.deco = '%s'\n", deco, t.deco);
return true;
}
//if (deco && t && t.deco) printf("deco = '%s', t.deco = '%s'\n", deco, t.deco);
return false;
}
final bool equivalent(Type t)
{
return immutableOf().equals(t.immutableOf());
}
// kludge for template.isType()
override final DYNCAST dyncast() const
{
return DYNCAST.type;
}
/// Returns a non-zero unique ID for this Type, or returns 0 if the Type does not (yet) have a unique ID.
/// If `semantic()` has not been run, 0 is returned.
final size_t getUniqueID() const
{
return cast(size_t) deco;
}
extern (D)
final Mcache* getMcache()
{
if (!mcache)
mcache = cast(Mcache*) mem.xcalloc(Mcache.sizeof, 1);
return mcache;
}
/*******************************
* Covariant means that 'this' can substitute for 't',
* i.e. a pure function is a match for an impure type.
* Params:
* t = type 'this' is covariant with
* pstc = if not null, store STCxxxx which would make it covariant
* cppCovariant = true if extern(C++) function types should follow C++ covariant rules
* Returns:
* An enum value of either `Covariant.yes` or a reason it's not covariant.
*/
final Covariant covariant(Type t, StorageClass* pstc = null, bool cppCovariant = false)
{
version (none)
{
printf("Type::covariant(t = %s) %s\n", t.toChars(), toChars());
printf("deco = %p, %p\n", deco, t.deco);
// printf("ty = %d\n", next.ty);
printf("mod = %x, %x\n", mod, t.mod);
}
if (pstc)
*pstc = 0;
StorageClass stc = 0;
bool notcovariant = false;
if (equals(t))
return Covariant.yes;
TypeFunction t1 = this.isTypeFunction();
TypeFunction t2 = t.isTypeFunction();
if (!t1 || !t2)
goto Ldistinct;
if (t1.parameterList.varargs != t2.parameterList.varargs)
goto Ldistinct;
if (t1.parameterList.parameters && t2.parameterList.parameters)
{
if (t1.parameterList.length != t2.parameterList.length)
goto Ldistinct;
foreach (i, fparam1; t1.parameterList)
{
Parameter fparam2 = t2.parameterList[i];
Type tp1 = fparam1.type;
Type tp2 = fparam2.type;
if (!tp1.equals(tp2))
{
if (tp1.ty == tp2.ty)
{
if (auto tc1 = tp1.isTypeClass())
{
if (tc1.sym == (cast(TypeClass)tp2).sym && MODimplicitConv(tp2.mod, tp1.mod))
goto Lcov;
}
else if (auto ts1 = tp1.isTypeStruct())
{
if (ts1.sym == (cast(TypeStruct)tp2).sym && MODimplicitConv(tp2.mod, tp1.mod))
goto Lcov;
}
else if (tp1.ty == Tpointer)
{
if (tp2.implicitConvTo(tp1))
goto Lcov;
}
else if (tp1.ty == Tarray)
{
if (tp2.implicitConvTo(tp1))
goto Lcov;
}
else if (tp1.ty == Tdelegate)
{
if (tp2.implicitConvTo(tp1))
goto Lcov;
}
}
goto Ldistinct;
}
Lcov:
notcovariant |= !fparam1.isCovariant(t1.isref, fparam2);
/* https://issues.dlang.org/show_bug.cgi?id=23135
* extern(C++) mutable parameters are not covariant with const.
*/
if (t1.linkage == LINK.cpp && cppCovariant)
{
notcovariant |= tp1.isNaked() != tp2.isNaked();
if (auto tpn1 = tp1.nextOf())
notcovariant |= tpn1.isNaked() != tp2.nextOf().isNaked();
}
}
}
else if (t1.parameterList.parameters != t2.parameterList.parameters)
{
if (t1.parameterList.length || t2.parameterList.length)
goto Ldistinct;
}
// The argument lists match
if (notcovariant)
goto Lnotcovariant;
if (t1.linkage != t2.linkage)
goto Lnotcovariant;
{
// Return types
Type t1n = t1.next;
Type t2n = t2.next;
if (!t1n || !t2n) // happens with return type inference
goto Lnotcovariant;
if (t1n.equals(t2n))
goto Lcovariant;
if (t1n.ty == Tclass && t2n.ty == Tclass)
{
/* If same class type, but t2n is const, then it's
* covariant. Do this test first because it can work on
* forward references.
*/
if ((cast(TypeClass)t1n).sym == (cast(TypeClass)t2n).sym && MODimplicitConv(t1n.mod, t2n.mod))
goto Lcovariant;
// If t1n is forward referenced:
ClassDeclaration cd = (cast(TypeClass)t1n).sym;
if (cd.semanticRun < PASS.semanticdone && !cd.isBaseInfoComplete())
cd.dsymbolSemantic(null);
if (!cd.isBaseInfoComplete())
{
return Covariant.fwdref;
}
}
if (t1n.ty == Tstruct && t2n.ty == Tstruct)
{
if ((cast(TypeStruct)t1n).sym == (cast(TypeStruct)t2n).sym && MODimplicitConv(t1n.mod, t2n.mod))
goto Lcovariant;
}
else if (t1n.ty == t2n.ty && t1n.implicitConvTo(t2n))
{
if (t1.isref && t2.isref)
{
// Treat like pointers to t1n and t2n
if (t1n.constConv(t2n) < MATCH.constant)
goto Lnotcovariant;
}
goto Lcovariant;
}
else if (t1n.ty == Tnull)
{
// NULL is covariant with any pointer type, but not with any
// dynamic arrays, associative arrays or delegates.
// https://issues.dlang.org/show_bug.cgi?id=8589
// https://issues.dlang.org/show_bug.cgi?id=19618
Type t2bn = t2n.toBasetype();
if (t2bn.ty == Tnull || t2bn.ty == Tpointer || t2bn.ty == Tclass)
goto Lcovariant;
}
// bottom type is covariant to any type
else if (t1n.ty == Tnoreturn)
goto Lcovariant;
}
goto Lnotcovariant;
Lcovariant:
if (t1.isref != t2.isref)
goto Lnotcovariant;
if (!t1.isref && (t1.isScopeQual || t2.isScopeQual))
{
StorageClass stc1 = t1.isScopeQual ? STC.scope_ : 0;
StorageClass stc2 = t2.isScopeQual ? STC.scope_ : 0;
if (t1.isreturn)
{
stc1 |= STC.return_;
if (!t1.isScopeQual)
stc1 |= STC.ref_;
}
if (t2.isreturn)
{
stc2 |= STC.return_;
if (!t2.isScopeQual)
stc2 |= STC.ref_;
}
if (!Parameter.isCovariantScope(t1.isref, stc1, stc2))
goto Lnotcovariant;
}
// We can subtract 'return ref' from 'this', but cannot add it
else if (t1.isreturn && !t2.isreturn)
goto Lnotcovariant;
/* https://issues.dlang.org/show_bug.cgi?id=23135
* extern(C++) mutable member functions are not covariant with const.
*/
if (t1.linkage == LINK.cpp && cppCovariant && t1.isNaked() != t2.isNaked())
goto Lnotcovariant;
/* Can convert mutable to const
*/
if (!MODimplicitConv(t2.mod, t1.mod))
{
version (none)
{
//stop attribute inference with const
// If adding 'const' will make it covariant
if (MODimplicitConv(t2.mod, MODmerge(t1.mod, MODFlags.const_)))
stc |= STC.const_;
else
goto Lnotcovariant;
}
else
{
goto Ldistinct;
}
}
/* Can convert pure to impure, nothrow to throw, and nogc to gc
*/
if (!t1.purity && t2.purity)
stc |= STC.pure_;
if (!t1.isnothrow && t2.isnothrow)
stc |= STC.nothrow_;
if (!t1.isnogc && t2.isnogc)
stc |= STC.nogc;
/* Can convert safe/trusted to system
*/
if (t1.trust <= TRUST.system && t2.trust >= TRUST.trusted)
{
// Should we infer trusted or safe? Go with safe.
stc |= STC.safe;
}
if (stc)
{
if (pstc)
*pstc = stc;
goto Lnotcovariant;
}
//printf("\tcovaraint: 1\n");
return Covariant.yes;
Ldistinct:
//printf("\tcovaraint: 0\n");
return Covariant.distinct;
Lnotcovariant:
//printf("\tcovaraint: 2\n");
return Covariant.no;
}
/********************************
* For pretty-printing a type.
*/
final override const(char)* toChars() const
{
OutBuffer buf;
buf.reserve(16);
HdrGenState hgs;
hgs.fullQual = (ty == Tclass && !mod);
.toCBuffer(this, &buf, null, &hgs);
return buf.extractChars();
}
/// ditto
final char* toPrettyChars(bool QualifyTypes = false)
{
OutBuffer buf;
buf.reserve(16);
HdrGenState hgs;
hgs.fullQual = QualifyTypes;
.toCBuffer(this, &buf, null, &hgs);
return buf.extractChars();
}
static void _init()
{
stringtable._init(14_000);
// Set basic types
__gshared TY* basetab =
[
Tvoid,
Tint8,
Tuns8,
Tint16,
Tuns16,
Tint32,
Tuns32,
Tint64,
Tuns64,
Tint128,
Tuns128,
Tfloat32,
Tfloat64,
Tfloat80,
Timaginary32,
Timaginary64,
Timaginary80,
Tcomplex32,
Tcomplex64,
Tcomplex80,
Tbool,
Tchar,
Twchar,
Tdchar,
Terror
];
for (size_t i = 0; basetab[i] != Terror; i++)
{
Type t = new TypeBasic(basetab[i]);
t = t.merge();
basic[basetab[i]] = t;
}
basic[Terror] = new TypeError();
tnoreturn = new TypeNoreturn();
tnoreturn.deco = tnoreturn.merge().deco;
basic[Tnoreturn] = tnoreturn;
tvoid = basic[Tvoid];
tint8 = basic[Tint8];
tuns8 = basic[Tuns8];
tint16 = basic[Tint16];
tuns16 = basic[Tuns16];
tint32 = basic[Tint32];
tuns32 = basic[Tuns32];
tint64 = basic[Tint64];
tuns64 = basic[Tuns64];
tint128 = basic[Tint128];
tuns128 = basic[Tuns128];
tfloat32 = basic[Tfloat32];
tfloat64 = basic[Tfloat64];
tfloat80 = basic[Tfloat80];
timaginary32 = basic[Timaginary32];
timaginary64 = basic[Timaginary64];
timaginary80 = basic[Timaginary80];
tcomplex32 = basic[Tcomplex32];
tcomplex64 = basic[Tcomplex64];
tcomplex80 = basic[Tcomplex80];
tbool = basic[Tbool];
tchar = basic[Tchar];
twchar = basic[Twchar];
tdchar = basic[Tdchar];
tshiftcnt = tint32;
terror = basic[Terror];
tnoreturn = basic[Tnoreturn];
tnull = new TypeNull();
tnull.deco = tnull.merge().deco;
tvoidptr = tvoid.pointerTo();
tstring = tchar.immutableOf().arrayOf();
twstring = twchar.immutableOf().arrayOf();
tdstring = tdchar.immutableOf().arrayOf();
const isLP64 = target.isLP64;
tsize_t = basic[isLP64 ? Tuns64 : Tuns32];
tptrdiff_t = basic[isLP64 ? Tint64 : Tint32];
thash_t = tsize_t;
}
/**
* Deinitializes the global state of the compiler.
*
* This can be used to restore the state set by `_init` to its original
* state.
*/
static void deinitialize()
{
stringtable = stringtable.init;
}
final uinteger_t size()
{
return size(Loc.initial);
}
uinteger_t size(const ref Loc loc)
{
error(loc, "no size for type `%s`", toChars());
return SIZE_INVALID;
}
uint alignsize()
{
return cast(uint)size(Loc.initial);
}
final Type trySemantic(const ref Loc loc, Scope* sc)
{
//printf("+trySemantic(%s) %d\n", toChars(), global.errors);
// Needed to display any deprecations that were gagged
auto tcopy = this.syntaxCopy();
const errors = global.startGagging();
Type t = typeSemantic(this, loc, sc);
if (global.endGagging(errors) || t.ty == Terror) // if any errors happened
{
t = null;
}
else
{
// If `typeSemantic` succeeded, there may have been deprecations that
// were gagged due the `startGagging` above. Run again to display
// those deprecations. https://issues.dlang.org/show_bug.cgi?id=19107
if (global.gaggedWarnings > 0)
typeSemantic(tcopy, loc, sc);
}
//printf("-trySemantic(%s) %d\n", toChars(), global.errors);
return t;
}
/*************************************
* This version does a merge even if the deco is already computed.
* Necessary for types that have a deco, but are not merged.
*/
final Type merge2()
{
//printf("merge2(%s)\n", toChars());
Type t = this;
assert(t);
if (!t.deco)
return t.merge();
auto sv = stringtable.lookup(t.deco, strlen(t.deco));
if (sv && sv.value)
{
t = sv.value;
assert(t.deco);
}
else
assert(0);
return t;
}
/*********************************
* Store this type's modifier name into buf.
*/
final void modToBuffer(OutBuffer* buf) nothrow const
{
if (mod)
{
buf.writeByte(' ');
MODtoBuffer(buf, mod);
}
}
/*********************************
* Return this type's modifier name.
*/
final char* modToChars() nothrow const
{
OutBuffer buf;
buf.reserve(16);
modToBuffer(&buf);
return buf.extractChars();
}
bool isintegral()
{
return false;
}
// real, imaginary, or complex
bool isfloating()
{
return false;
}
bool isreal()
{
return false;
}
bool isimaginary()
{
return false;
}
bool iscomplex()
{
return false;
}
bool isscalar()
{
return false;
}
bool isunsigned()
{
return false;
}
bool isscope()
{
return false;
}
bool isString()
{
return false;
}
/**************************
* When T is mutable,
* Given:
* T a, b;
* Can we bitwise assign:
* a = b;
* ?
*/
bool isAssignable()
{
return true;
}
/**************************
* Returns true if T can be converted to boolean value.
*/
bool isBoolean()
{
return isscalar();
}
/*********************************
* Check type to see if it is based on a deprecated symbol.
*/
void checkDeprecated(const ref Loc loc, Scope* sc)
{
if (Dsymbol s = toDsymbol(sc))
{
s.checkDeprecated(loc, sc);
}
}
final bool isConst() const nothrow pure @nogc @safe
{
return (mod & MODFlags.const_) != 0;
}
final bool isImmutable() const nothrow pure @nogc @safe
{
return (mod & MODFlags.immutable_) != 0;
}
final bool isMutable() const nothrow pure @nogc @safe
{
return (mod & (MODFlags.const_ | MODFlags.immutable_ | MODFlags.wild)) == 0;
}
final bool isShared() const nothrow pure @nogc @safe
{
return (mod & MODFlags.shared_) != 0;
}
final bool isSharedConst() const nothrow pure @nogc @safe
{
return (mod & (MODFlags.shared_ | MODFlags.const_)) == (MODFlags.shared_ | MODFlags.const_);
}
final bool isWild() const nothrow pure @nogc @safe
{
return (mod & MODFlags.wild) != 0;
}
final bool isWildConst() const nothrow pure @nogc @safe
{
return (mod & MODFlags.wildconst) == MODFlags.wildconst;
}
final bool isSharedWild() const nothrow pure @nogc @safe
{
return (mod & (MODFlags.shared_ | MODFlags.wild)) == (MODFlags.shared_ | MODFlags.wild);
}
final bool isNaked() const nothrow pure @nogc @safe
{
return mod == 0;
}
/********************************
* Return a copy of this type with all attributes null-initialized.
* Useful for creating a type with different modifiers.
*/
final Type nullAttributes() nothrow const
{
uint sz = sizeTy[ty];
Type t = cast(Type)mem.xmalloc(sz);
memcpy(cast(void*)t, cast(void*)this, sz);
// t.mod = NULL; // leave mod unchanged
t.deco = null;
t.arrayof = null;
t.pto = null;
t.rto = null;
t.vtinfo = null;
t.ctype = null;
t.mcache = null;
if (t.ty == Tstruct)
(cast(TypeStruct)t).att = AliasThisRec.fwdref;
if (t.ty == Tclass)
(cast(TypeClass)t).att = AliasThisRec.fwdref;
return t;
}
/********************************
* Convert to 'const'.
*/
final Type constOf()
{
//printf("Type::constOf() %p %s\n", this, toChars());
if (mod == MODFlags.const_)
return this;
if (mcache && mcache.cto)
{
assert(mcache.cto.mod == MODFlags.const_);
return mcache.cto;
}
Type t = makeConst();
t = t.merge();
t.fixTo(this);
//printf("-Type::constOf() %p %s\n", t, t.toChars());
return t;
}
/********************************
* Convert to 'immutable'.
*/
final Type immutableOf()
{
//printf("Type::immutableOf() %p %s\n", this, toChars());
if (isImmutable())
return this;
if (mcache && mcache.ito)
{
assert(mcache.ito.isImmutable());
return mcache.ito;
}
Type t = makeImmutable();
t = t.merge();
t.fixTo(this);
//printf("\t%p\n", t);
return t;
}
/********************************
* Make type mutable.
*/
final Type mutableOf()
{
//printf("Type::mutableOf() %p, %s\n", this, toChars());
Type t = this;
if (isImmutable())
{
getMcache();
t = mcache.ito; // immutable => naked
assert(!t || (t.isMutable() && !t.isShared()));
}
else if (isConst())
{
getMcache();
if (isShared())
{
if (isWild())
t = mcache.swcto; // shared wild const -> shared
else
t = mcache.sto; // shared const => shared
}
else
{
if (isWild())
t = mcache.wcto; // wild const -> naked
else
t = mcache.cto; // const => naked
}
assert(!t || t.isMutable());
}
else if (isWild())
{
getMcache();
if (isShared())
t = mcache.sto; // shared wild => shared
else
t = mcache.wto; // wild => naked
assert(!t || t.isMutable());
}
if (!t)
{
t = makeMutable();
t = t.merge();
t.fixTo(this);
}
else
t = t.merge();
assert(t.isMutable());
return t;
}
final Type sharedOf()
{
//printf("Type::sharedOf() %p, %s\n", this, toChars());
if (mod == MODFlags.shared_)
return this;
if (mcache && mcache.sto)
{
assert(mcache.sto.mod == MODFlags.shared_);
return mcache.sto;
}
Type t = makeShared();
t = t.merge();
t.fixTo(this);
//printf("\t%p\n", t);
return t;
}
final Type sharedConstOf()
{
//printf("Type::sharedConstOf() %p, %s\n", this, toChars());
if (mod == (MODFlags.shared_ | MODFlags.const_))
return this;
if (mcache && mcache.scto)
{
assert(mcache.scto.mod == (MODFlags.shared_ | MODFlags.const_));
return mcache.scto;
}
Type t = makeSharedConst();
t = t.merge();
t.fixTo(this);
//printf("\t%p\n", t);
return t;
}
/********************************
* Make type unshared.
* 0 => 0
* const => const
* immutable => immutable
* shared => 0
* shared const => const
* wild => wild
* wild const => wild const
* shared wild => wild
* shared wild const => wild const
*/
final Type unSharedOf()
{
//printf("Type::unSharedOf() %p, %s\n", this, toChars());
Type t = this;
if (isShared())
{
getMcache();
if (isWild())
{
if (isConst())
t = mcache.wcto; // shared wild const => wild const
else
t = mcache.wto; // shared wild => wild
}
else
{
if (isConst())
t = mcache.cto; // shared const => const
else
t = mcache.sto; // shared => naked
}
assert(!t || !t.isShared());
}
if (!t)
{
t = this.nullAttributes();
t.mod = mod & ~MODFlags.shared_;
t.ctype = ctype;
t = t.merge();
t.fixTo(this);
}
else
t = t.merge();
assert(!t.isShared());
return t;
}
/********************************
* Convert to 'wild'.
*/
final Type wildOf()
{
//printf("Type::wildOf() %p %s\n", this, toChars());
if (mod == MODFlags.wild)
return this;
if (mcache && mcache.wto)
{
assert(mcache.wto.mod == MODFlags.wild);
return mcache.wto;
}
Type t = makeWild();
t = t.merge();
t.fixTo(this);
//printf("\t%p %s\n", t, t.toChars());
return t;
}
final Type wildConstOf()
{
//printf("Type::wildConstOf() %p %s\n", this, toChars());
if (mod == MODFlags.wildconst)
return this;
if (mcache && mcache.wcto)
{
assert(mcache.wcto.mod == MODFlags.wildconst);
return mcache.wcto;
}
Type t = makeWildConst();
t = t.merge();
t.fixTo(this);
//printf("\t%p %s\n", t, t.toChars());
return t;
}
final Type sharedWildOf()
{
//printf("Type::sharedWildOf() %p, %s\n", this, toChars());
if (mod == (MODFlags.shared_ | MODFlags.wild))
return this;
if (mcache && mcache.swto)
{
assert(mcache.swto.mod == (MODFlags.shared_ | MODFlags.wild));
return mcache.swto;
}
Type t = makeSharedWild();
t = t.merge();
t.fixTo(this);
//printf("\t%p %s\n", t, t.toChars());
return t;
}
final Type sharedWildConstOf()
{
//printf("Type::sharedWildConstOf() %p, %s\n", this, toChars());
if (mod == (MODFlags.shared_ | MODFlags.wildconst))
return this;
if (mcache && mcache.swcto)
{
assert(mcache.swcto.mod == (MODFlags.shared_ | MODFlags.wildconst));
return mcache.swcto;
}
Type t = makeSharedWildConst();
t = t.merge();
t.fixTo(this);
//printf("\t%p %s\n", t, t.toChars());
return t;
}
/**********************************
* For our new type 'this', which is type-constructed from t,
* fill in the cto, ito, sto, scto, wto shortcuts.
*/
final void fixTo(Type t)
{
// If fixing this: immutable(T*) by t: immutable(T)*,
// cache t to this.xto won't break transitivity.
Type mto = null;
Type tn = nextOf();
if (!tn || ty != Tsarray && tn.mod == t.nextOf().mod)
{
switch (t.mod)
{
case 0:
mto = t;
break;
case MODFlags.const_:
getMcache();
mcache.cto = t;
break;
case MODFlags.wild:
getMcache();
mcache.wto = t;
break;
case MODFlags.wildconst:
getMcache();
mcache.wcto = t;
break;
case MODFlags.shared_:
getMcache();
mcache.sto = t;
break;
case MODFlags.shared_ | MODFlags.const_:
getMcache();
mcache.scto = t;
break;
case MODFlags.shared_ | MODFlags.wild:
getMcache();
mcache.swto = t;
break;
case MODFlags.shared_ | MODFlags.wildconst:
getMcache();
mcache.swcto = t;
break;
case MODFlags.immutable_:
getMcache();
mcache.ito = t;
break;
default:
break;
}
}
assert(mod != t.mod);
if (mod)
{
getMcache();
t.getMcache();
}
switch (mod)
{
case 0:
break;
case MODFlags.const_:
mcache.cto = mto;
t.mcache.cto = this;
break;
case MODFlags.wild:
mcache.wto = mto;
t.mcache.wto = this;
break;
case MODFlags.wildconst:
mcache.wcto = mto;
t.mcache.wcto = this;
break;
case MODFlags.shared_:
mcache.sto = mto;
t.mcache.sto = this;
break;
case MODFlags.shared_ | MODFlags.const_:
mcache.scto = mto;
t.mcache.scto = this;
break;
case MODFlags.shared_ | MODFlags.wild:
mcache.swto = mto;
t.mcache.swto = this;
break;
case MODFlags.shared_ | MODFlags.wildconst:
mcache.swcto = mto;
t.mcache.swcto = this;
break;
case MODFlags.immutable_:
t.mcache.ito = this;
if (t.mcache.cto)
t.mcache.cto.getMcache().ito = this;
if (t.mcache.sto)
t.mcache.sto.getMcache().ito = this;
if (t.mcache.scto)
t.mcache.scto.getMcache().ito = this;
if (t.mcache.wto)
t.mcache.wto.getMcache().ito = this;
if (t.mcache.wcto)
t.mcache.wcto.getMcache().ito = this;
if (t.mcache.swto)
t.mcache.swto.getMcache().ito = this;
if (t.mcache.swcto)
t.mcache.swcto.getMcache().ito = this;
break;
default:
assert(0);
}
check();
t.check();
//printf("fixTo: %s, %s\n", toChars(), t.toChars());
}
/***************************
* Look for bugs in constructing types.
*/
final void check()
{
if (mcache)
with (mcache)
switch (mod)
{
case 0:
if (cto)
assert(cto.mod == MODFlags.const_);
if (ito)
assert(ito.mod == MODFlags.immutable_);
if (sto)
assert(sto.mod == MODFlags.shared_);
if (scto)
assert(scto.mod == (MODFlags.shared_ | MODFlags.const_));
if (wto)
assert(wto.mod == MODFlags.wild);
if (wcto)
assert(wcto.mod == MODFlags.wildconst);
if (swto)
assert(swto.mod == (MODFlags.shared_ | MODFlags.wild));
if (swcto)
assert(swcto.mod == (MODFlags.shared_ | MODFlags.wildconst));
break;
case MODFlags.const_:
if (cto)
assert(cto.mod == 0);
if (ito)
assert(ito.mod == MODFlags.immutable_);
if (sto)
assert(sto.mod == MODFlags.shared_);
if (scto)
assert(scto.mod == (MODFlags.shared_ | MODFlags.const_));
if (wto)
assert(wto.mod == MODFlags.wild);
if (wcto)
assert(wcto.mod == MODFlags.wildconst);
if (swto)
assert(swto.mod == (MODFlags.shared_ | MODFlags.wild));
if (swcto)
assert(swcto.mod == (MODFlags.shared_ | MODFlags.wildconst));
break;
case MODFlags.wild:
if (cto)
assert(cto.mod == MODFlags.const_);
if (ito)
assert(ito.mod == MODFlags.immutable_);
if (sto)
assert(sto.mod == MODFlags.shared_);
if (scto)
assert(scto.mod == (MODFlags.shared_ | MODFlags.const_));
if (wto)
assert(wto.mod == 0);
if (wcto)
assert(wcto.mod == MODFlags.wildconst);
if (swto)
assert(swto.mod == (MODFlags.shared_ | MODFlags.wild));
if (swcto)
assert(swcto.mod == (MODFlags.shared_ | MODFlags.wildconst));
break;
case MODFlags.wildconst:
assert(!cto || cto.mod == MODFlags.const_);
assert(!ito || ito.mod == MODFlags.immutable_);
assert(!sto || sto.mod == MODFlags.shared_);
assert(!scto || scto.mod == (MODFlags.shared_ | MODFlags.const_));
assert(!wto || wto.mod == MODFlags.wild);
assert(!wcto || wcto.mod == 0);
assert(!swto || swto.mod == (MODFlags.shared_ | MODFlags.wild));
assert(!swcto || swcto.mod == (MODFlags.shared_ | MODFlags.wildconst));
break;
case MODFlags.shared_:
if (cto)
assert(cto.mod == MODFlags.const_);
if (ito)
assert(ito.mod == MODFlags.immutable_);
if (sto)
assert(sto.mod == 0);
if (scto)
assert(scto.mod == (MODFlags.shared_ | MODFlags.const_));
if (wto)
assert(wto.mod == MODFlags.wild);
if (wcto)
assert(wcto.mod == MODFlags.wildconst);
if (swto)
assert(swto.mod == (MODFlags.shared_ | MODFlags.wild));
if (swcto)
assert(swcto.mod == (MODFlags.shared_ | MODFlags.wildconst));
break;
case MODFlags.shared_ | MODFlags.const_:
if (cto)
assert(cto.mod == MODFlags.const_);
if (ito)
assert(ito.mod == MODFlags.immutable_);
if (sto)
assert(sto.mod == MODFlags.shared_);
if (scto)
assert(scto.mod == 0);
if (wto)
assert(wto.mod == MODFlags.wild);
if (wcto)
assert(wcto.mod == MODFlags.wildconst);
if (swto)
assert(swto.mod == (MODFlags.shared_ | MODFlags.wild));
if (swcto)
assert(swcto.mod == (MODFlags.shared_ | MODFlags.wildconst));
break;
case MODFlags.shared_ | MODFlags.wild:
if (cto)
assert(cto.mod == MODFlags.const_);
if (ito)
assert(ito.mod == MODFlags.immutable_);
if (sto)
assert(sto.mod == MODFlags.shared_);
if (scto)
assert(scto.mod == (MODFlags.shared_ | MODFlags.const_));
if (wto)
assert(wto.mod == MODFlags.wild);
if (wcto)
assert(wcto.mod == MODFlags.wildconst);
if (swto)
assert(swto.mod == 0);
if (swcto)
assert(swcto.mod == (MODFlags.shared_ | MODFlags.wildconst));
break;
case MODFlags.shared_ | MODFlags.wildconst:
assert(!cto || cto.mod == MODFlags.const_);
assert(!ito || ito.mod == MODFlags.immutable_);
assert(!sto || sto.mod == MODFlags.shared_);
assert(!scto || scto.mod == (MODFlags.shared_ | MODFlags.const_));
assert(!wto || wto.mod == MODFlags.wild);
assert(!wcto || wcto.mod == MODFlags.wildconst);
assert(!swto || swto.mod == (MODFlags.shared_ | MODFlags.wild));
assert(!swcto || swcto.mod == 0);
break;
case MODFlags.immutable_:
if (cto)
assert(cto.mod == MODFlags.const_);
if (ito)
assert(ito.mod == 0);
if (sto)
assert(sto.mod == MODFlags.shared_);
if (scto)
assert(scto.mod == (MODFlags.shared_ | MODFlags.const_));
if (wto)
assert(wto.mod == MODFlags.wild);
if (wcto)
assert(wcto.mod == MODFlags.wildconst);
if (swto)
assert(swto.mod == (MODFlags.shared_ | MODFlags.wild));
if (swcto)
assert(swcto.mod == (MODFlags.shared_ | MODFlags.wildconst));
break;
default:
assert(0);
}
Type tn = nextOf();
if (tn && ty != Tfunction && tn.ty != Tfunction && ty != Tenum)
{
// Verify transitivity
switch (mod)
{
case 0:
case MODFlags.const_:
case MODFlags.wild:
case MODFlags.wildconst:
case MODFlags.shared_:
case MODFlags.shared_ | MODFlags.const_:
case MODFlags.shared_ | MODFlags.wild:
case MODFlags.shared_ | MODFlags.wildconst:
case MODFlags.immutable_:
assert(tn.mod == MODFlags.immutable_ || (tn.mod & mod) == mod);
break;
default:
assert(0);
}
tn.check();
}
}
/*************************************
* Apply STCxxxx bits to existing type.
* Use *before* semantic analysis is run.
*/
final Type addSTC(StorageClass stc)
{
Type t = this;
if (t.isImmutable())
{
}
else if (stc & STC.immutable_)
{
t = t.makeImmutable();
}
else
{
if ((stc & STC.shared_) && !t.isShared())
{
if (t.isWild())
{
if (t.isConst())
t = t.makeSharedWildConst();
else
t = t.makeSharedWild();
}
else
{
if (t.isConst())
t = t.makeSharedConst();
else
t = t.makeShared();
}
}
if ((stc & STC.const_) && !t.isConst())
{
if (t.isShared())
{
if (t.isWild())
t = t.makeSharedWildConst();
else
t = t.makeSharedConst();
}
else
{
if (t.isWild())
t = t.makeWildConst();
else
t = t.makeConst();
}
}
if ((stc & STC.wild) && !t.isWild())
{
if (t.isShared())
{
if (t.isConst())
t = t.makeSharedWildConst();
else
t = t.makeSharedWild();
}
else
{
if (t.isConst())
t = t.makeWildConst();
else
t = t.makeWild();
}
}
}
return t;
}
/************************************
* Apply MODxxxx bits to existing type.
*/
final Type castMod(MOD mod)
{
Type t;
switch (mod)
{
case 0:
t = unSharedOf().mutableOf();
break;
case MODFlags.const_:
t = unSharedOf().constOf();
break;
case MODFlags.wild:
t = unSharedOf().wildOf();
break;
case MODFlags.wildconst:
t = unSharedOf().wildConstOf();
break;
case MODFlags.shared_:
t = mutableOf().sharedOf();
break;
case MODFlags.shared_ | MODFlags.const_:
t = sharedConstOf();
break;
case MODFlags.shared_ | MODFlags.wild:
t = sharedWildOf();
break;
case MODFlags.shared_ | MODFlags.wildconst:
t = sharedWildConstOf();
break;
case MODFlags.immutable_:
t = immutableOf();
break;
default:
assert(0);
}
return t;
}
/************************************
* Add MODxxxx bits to existing type.
* We're adding, not replacing, so adding const to
* a shared type => "shared const"
*/
final Type addMod(MOD mod)
{
/* Add anything to immutable, and it remains immutable
*/
Type t = this;
if (!t.isImmutable())
{
//printf("addMod(%x) %s\n", mod, toChars());
switch (mod)
{
case 0:
break;
case MODFlags.const_:
if (isShared())
{
if (isWild())
t = sharedWildConstOf();
else
t = sharedConstOf();
}
else
{
if (isWild())
t = wildConstOf();
else
t = constOf();
}
break;
case MODFlags.wild:
if (isShared())
{
if (isConst())
t = sharedWildConstOf();
else
t = sharedWildOf();
}
else
{
if (isConst())
t = wildConstOf();
else
t = wildOf();
}
break;
case MODFlags.wildconst:
if (isShared())
t = sharedWildConstOf();
else
t = wildConstOf();
break;
case MODFlags.shared_:
if (isWild())
{
if (isConst())
t = sharedWildConstOf();
else
t = sharedWildOf();
}
else
{
if (isConst())
t = sharedConstOf();
else
t = sharedOf();
}
break;
case MODFlags.shared_ | MODFlags.const_:
if (isWild())
t = sharedWildConstOf();
else
t = sharedConstOf();
break;
case MODFlags.shared_ | MODFlags.wild:
if (isConst())
t = sharedWildConstOf();
else
t = sharedWildOf();
break;
case MODFlags.shared_ | MODFlags.wildconst:
t = sharedWildConstOf();
break;
case MODFlags.immutable_:
t = immutableOf();
break;
default:
assert(0);
}
}
return t;
}
/************************************
* Add storage class modifiers to type.
*/
Type addStorageClass(StorageClass stc)
{
/* Just translate to MOD bits and let addMod() do the work
*/
MOD mod = 0;
if (stc & STC.immutable_)
mod = MODFlags.immutable_;
else
{
if (stc & (STC.const_ | STC.in_))
mod |= MODFlags.const_;
if (stc & STC.wild)
mod |= MODFlags.wild;
if (stc & STC.shared_)
mod |= MODFlags.shared_;
}
return addMod(mod);
}
final Type pointerTo()
{
if (ty == Terror)
return this;
if (!pto)
{
Type t = new TypePointer(this);
if (ty == Tfunction)
{
t.deco = t.merge().deco;
pto = t;
}
else
pto = t.merge();
}
return pto;
}
final Type referenceTo()
{
if (ty == Terror)
return this;
if (!rto)
{
Type t = new TypeReference(this);
rto = t.merge();
}
return rto;
}
final Type arrayOf()
{
if (ty == Terror)
return this;
if (!arrayof)
{
Type t = new TypeDArray(this);
arrayof = t.merge();
}
return arrayof;
}
// Make corresponding static array type without semantic
final Type sarrayOf(dinteger_t dim)
{
assert(deco);
Type t = new TypeSArray(this, new IntegerExp(Loc.initial, dim, Type.tsize_t));
// according to TypeSArray::semantic()
t = t.addMod(mod);
t = t.merge();
return t;
}
final bool hasDeprecatedAliasThis()
{
auto ad = isAggregate(this);
return ad && ad.aliasthis && (ad.aliasthis.isDeprecated || ad.aliasthis.sym.isDeprecated);
}
final Type aliasthisOf()
{
auto ad = isAggregate(this);
if (!ad || !ad.aliasthis)
return null;
auto s = ad.aliasthis.sym;
if (s.isAliasDeclaration())
s = s.toAlias();
if (s.isTupleDeclaration())
return null;
if (auto vd = s.isVarDeclaration())
{
auto t = vd.type;
if (vd.needThis())
t = t.addMod(this.mod);
return t;
}
Dsymbol callable = s.isFuncDeclaration();
callable = callable ? callable : s.isTemplateDeclaration();
if (callable)
{
auto fd = resolveFuncCall(Loc.initial, null, callable, null, this, ArgumentList(), FuncResolveFlag.quiet);
if (!fd || fd.errors || !fd.functionSemantic())
return Type.terror;
auto t = fd.type.nextOf();
if (!t) // https://issues.dlang.org/show_bug.cgi?id=14185
return Type.terror;
t = t.substWildTo(mod == 0 ? MODFlags.mutable : mod);
return t;
}
if (auto d = s.isDeclaration())
{
assert(d.type);
return d.type;
}
if (auto ed = s.isEnumDeclaration())
{
return ed.type;
}
//printf("%s\n", s.kind());
return null;
}
/**
* Check whether this type has endless `alias this` recursion.
* Returns:
* `true` if this type has an `alias this` that can be implicitly
* converted back to this type itself.
*/
extern (D) final bool checkAliasThisRec()
{
Type tb = toBasetype();
AliasThisRec* pflag;
if (tb.ty == Tstruct)
pflag = &(cast(TypeStruct)tb).att;
else if (tb.ty == Tclass)
pflag = &(cast(TypeClass)tb).att;
else
return false;
AliasThisRec flag = cast(AliasThisRec)(*pflag & AliasThisRec.typeMask);
if (flag == AliasThisRec.fwdref)
{
Type att = aliasthisOf();
flag = att && att.implicitConvTo(this) ? AliasThisRec.yes : AliasThisRec.no;
}
*pflag = cast(AliasThisRec)(flag | (*pflag & ~AliasThisRec.typeMask));
return flag == AliasThisRec.yes;
}
Type makeConst()
{
//printf("Type::makeConst() %p, %s\n", this, toChars());
if (mcache && mcache.cto)
return mcache.cto;
Type t = this.nullAttributes();
t.mod = MODFlags.const_;
//printf("-Type::makeConst() %p, %s\n", t, toChars());
return t;
}
Type makeImmutable()
{
if (mcache && mcache.ito)
return mcache.ito;
Type t = this.nullAttributes();
t.mod = MODFlags.immutable_;
return t;
}
Type makeShared()
{
if (mcache && mcache.sto)
return mcache.sto;
Type t = this.nullAttributes();
t.mod = MODFlags.shared_;
return t;
}
Type makeSharedConst()
{
if (mcache && mcache.scto)
return mcache.scto;
Type t = this.nullAttributes();
t.mod = MODFlags.shared_ | MODFlags.const_;
return t;
}
Type makeWild()
{
if (mcache && mcache.wto)
return mcache.wto;
Type t = this.nullAttributes();
t.mod = MODFlags.wild;
return t;
}
Type makeWildConst()
{
if (mcache && mcache.wcto)
return mcache.wcto;
Type t = this.nullAttributes();
t.mod = MODFlags.wildconst;
return t;
}
Type makeSharedWild()
{
if (mcache && mcache.swto)
return mcache.swto;
Type t = this.nullAttributes();
t.mod = MODFlags.shared_ | MODFlags.wild;
return t;
}
Type makeSharedWildConst()
{
if (mcache && mcache.swcto)
return mcache.swcto;
Type t = this.nullAttributes();
t.mod = MODFlags.shared_ | MODFlags.wildconst;
return t;
}
Type makeMutable()
{
Type t = this.nullAttributes();
t.mod = mod & MODFlags.shared_;
return t;
}
Dsymbol toDsymbol(Scope* sc)
{
return null;
}
/*******************************
* If this is a shell around another type,
* get that other type.
*/
final Type toBasetype()
{
/* This function is used heavily.
* De-virtualize it so it can be easily inlined.
*/
TypeEnum te;
return ((te = isTypeEnum()) !is null) ? te.toBasetype2() : this;
}
bool isBaseOf(Type t, int* poffset)
{
return 0; // assume not
}
/********************************
* Determine if 'this' can be implicitly converted
* to type 'to'.
* Returns:
* MATCH.nomatch, MATCH.convert, MATCH.constant, MATCH.exact
*/
MATCH implicitConvTo(Type to)
{
//printf("Type::implicitConvTo(this=%p, to=%p)\n", this, to);
//printf("from: %s\n", toChars());
//printf("to : %s\n", to.toChars());
if (this.equals(to))
return MATCH.exact;
return MATCH.nomatch;
}
/*******************************
* Determine if converting 'this' to 'to' is an identity operation,
* a conversion to const operation, or the types aren't the same.
* Returns:
* MATCH.exact 'this' == 'to'
* MATCH.constant 'to' is const
* MATCH.nomatch conversion to mutable or invariant
*/
MATCH constConv(Type to)
{
//printf("Type::constConv(this = %s, to = %s)\n", toChars(), to.toChars());
if (equals(to))
return MATCH.exact;
if (ty == to.ty && MODimplicitConv(mod, to.mod))
return MATCH.constant;
return MATCH.nomatch;
}
/***************************************
* Compute MOD bits matching `this` argument type to wild parameter type.
* Params:
* t = corresponding parameter type
* isRef = parameter is `ref` or `out`
* Returns:
* MOD bits
*/
MOD deduceWild(Type t, bool isRef)
{
//printf("Type::deduceWild this = '%s', tprm = '%s'\n", toChars(), tprm.toChars());
if (t.isWild())
{
if (isImmutable())
return MODFlags.immutable_;
else if (isWildConst())
{
if (t.isWildConst())
return MODFlags.wild;
else
return MODFlags.wildconst;
}
else if (isWild())
return MODFlags.wild;
else if (isConst())
return MODFlags.const_;
else if (isMutable())
return MODFlags.mutable;
else
assert(0);
}
return 0;
}
Type substWildTo(uint mod)
{
//printf("+Type::substWildTo this = %s, mod = x%x\n", toChars(), mod);
Type t;
if (Type tn = nextOf())
{
// substitution has no effect on function pointer type.
if (ty == Tpointer && tn.ty == Tfunction)
{
t = this;
goto L1;
}
t = tn.substWildTo(mod);
if (t == tn)
t = this;
else
{
if (ty == Tpointer)
t = t.pointerTo();
else if (ty == Tarray)
t = t.arrayOf();
else if (ty == Tsarray)
t = new TypeSArray(t, (cast(TypeSArray)this).dim.syntaxCopy());
else if (ty == Taarray)
{
t = new TypeAArray(t, (cast(TypeAArray)this).index.syntaxCopy());
}
else if (ty == Tdelegate)
{
t = new TypeDelegate(t.isTypeFunction());
}
else
assert(0);
t = t.merge();
}
}
else
t = this;
L1:
if (isWild())
{
if (mod == MODFlags.immutable_)
{
t = t.immutableOf();
}
else if (mod == MODFlags.wildconst)
{
t = t.wildConstOf();
}
else if (mod == MODFlags.wild)
{
if (isWildConst())
t = t.wildConstOf();
else
t = t.wildOf();
}
else if (mod == MODFlags.const_)
{
t = t.constOf();
}
else
{
if (isWildConst())
t = t.constOf();
else
t = t.mutableOf();
}
}
if (isConst())
t = t.addMod(MODFlags.const_);
if (isShared())
t = t.addMod(MODFlags.shared_);
//printf("-Type::substWildTo t = %s\n", t.toChars());
return t;
}
final Type unqualify(uint m)
{
Type t = mutableOf().unSharedOf();
Type tn = ty == Tenum ? null : nextOf();
if (tn && tn.ty != Tfunction)
{
Type utn = tn.unqualify(m);
if (utn != tn)
{
if (ty == Tpointer)
t = utn.pointerTo();
else if (ty == Tarray)
t = utn.arrayOf();
else if (ty == Tsarray)
t = new TypeSArray(utn, (cast(TypeSArray)this).dim);
else if (ty == Taarray)
{
t = new TypeAArray(utn, (cast(TypeAArray)this).index);
}
else
assert(0);
t = t.merge();
}
}
t = t.addMod(mod & ~m);
return t;
}
/**************************
* Return type with the top level of it being mutable.
*/
inout(Type) toHeadMutable() inout
{
if (!mod)
return this;
Type unqualThis = cast(Type) this;
// `mutableOf` needs a mutable `this` only for caching
return cast(inout(Type)) unqualThis.mutableOf();
}
inout(ClassDeclaration) isClassHandle() inout
{
return null;
}
/************************************
* Return alignment to use for this type.
*/
structalign_t alignment()
{
structalign_t s;
s.setDefault();
return s;
}
/***************************************
* Use when we prefer the default initializer to be a literal,
* rather than a global immutable variable.
*/
Expression defaultInitLiteral(const ref Loc loc)
{
static if (LOGDEFAULTINIT)
{
printf("Type::defaultInitLiteral() '%s'\n", toChars());
}
return defaultInit(this, loc);
}
// if initializer is 0
bool isZeroInit(const ref Loc loc)
{
return false; // assume not
}
final Identifier getTypeInfoIdent()
{
// _init_10TypeInfo_%s
OutBuffer buf;
buf.reserve(32);
mangleToBuffer(this, &buf);
const slice = buf[];
// Allocate buffer on stack, fail over to using malloc()
char[128] namebuf;
const namelen = 19 + size_t.sizeof * 3 + slice.length + 1;
auto name = namelen <= namebuf.length ? namebuf.ptr : cast(char*)Mem.check(malloc(namelen));
const length = snprintf(name, namelen, "_D%lluTypeInfo_%.*s6__initZ",
cast(ulong)(9 + slice.length), cast(int)slice.length, slice.ptr);
//printf("%p %s, deco = %s, name = %s\n", this, toChars(), deco, name);
assert(0 < length && length < namelen); // don't overflow the buffer
auto id = Identifier.idPool(name[0 .. length]);
if (name != namebuf.ptr)
free(name);
return id;
}
/***************************************
* Return !=0 if the type or any of its subtypes is wild.
*/
int hasWild() const
{
return mod & MODFlags.wild;
}
/***************************************
* Return !=0 if type has pointers that need to
* be scanned by the GC during a collection cycle.
*/
bool hasPointers()
{
//printf("Type::hasPointers() %s, %d\n", toChars(), ty);
return false;
}
/*************************************
* Detect if type has pointer fields that are initialized to void.
* Local stack variables with such void fields can remain uninitialized,
* leading to pointer bugs.
* Returns:
* true if so
*/
bool hasVoidInitPointers()
{
return false;
}
/*************************************
* Detect if this is an unsafe type because of the presence of `@system` members
* Returns:
* true if so
*/
bool hasSystemFields()
{
return false;
}
/***************************************
* Returns: true if type has any invariants
*/
bool hasInvariant()
{
//printf("Type::hasInvariant() %s, %d\n", toChars(), ty);
return false;
}
/*************************************
* If this is a type of something, return that something.
*/
Type nextOf()
{
return null;
}
/*************************************
* If this is a type of static array, return its base element type.
*/
final Type baseElemOf()
{
Type t = toBasetype();
TypeSArray tsa;
while ((tsa = t.isTypeSArray()) !is null)
t = tsa.next.toBasetype();
return t;
}
/*******************************************
* Compute number of elements for a (possibly multidimensional) static array,
* or 1 for other types.
* Params:
* loc = for error message
* Returns:
* number of elements, uint.max on overflow
*/
final uint numberOfElems(const ref Loc loc)
{
//printf("Type::numberOfElems()\n");
uinteger_t n = 1;
Type tb = this;
while ((tb = tb.toBasetype()).ty == Tsarray)
{
bool overflow = false;
n = mulu(n, (cast(TypeSArray)tb).dim.toUInteger(), overflow);
if (overflow || n >= uint.max)
{
error(loc, "static array `%s` size overflowed to %llu", toChars(), cast(ulong)n);
return uint.max;
}
tb = (cast(TypeSArray)tb).next;
}
return cast(uint)n;
}
/****************************************
* Return the mask that an integral type will
* fit into.
*/
final uinteger_t sizemask()
{
uinteger_t m;
switch (toBasetype().ty)
{
case Tbool:
m = 1;
break;
case Tchar:
case Tint8:
case Tuns8:
m = 0xFF;
break;
case Twchar:
case Tint16:
case Tuns16:
m = 0xFFFFU;
break;
case Tdchar:
case Tint32:
case Tuns32:
m = 0xFFFFFFFFU;
break;
case Tint64:
case Tuns64:
m = 0xFFFFFFFFFFFFFFFFUL;
break;
default:
assert(0);
}
return m;
}
/********************************
* true if when type goes out of scope, it needs a destructor applied.
* Only applies to value types, not ref types.
*/
bool needsDestruction()
{
return false;
}
/********************************
* true if when type is copied, it needs a copy constructor or postblit
* applied. Only applies to value types, not ref types.
*/
bool needsCopyOrPostblit()
{
return false;
}
/*********************************
*
*/
bool needsNested()
{
return false;
}
/*************************************
* https://issues.dlang.org/show_bug.cgi?id=14488
* Check if the inner most base type is complex or imaginary.
* Should only give alerts when set to emit transitional messages.
* Params:
* loc = The source location.
* sc = scope of the type
*/
extern (D) final bool checkComplexTransition(const ref Loc loc, Scope* sc)
{
if (sc.isDeprecated())
return false;
// Don't complain if we're inside a template constraint
// https://issues.dlang.org/show_bug.cgi?id=21831
if (sc.flags & SCOPE.constraint)
return false;
Type t = baseElemOf();
while (t.ty == Tpointer || t.ty == Tarray)
t = t.nextOf().baseElemOf();
// Basetype is an opaque enum, nothing to check.
if (t.ty == Tenum && !(cast(TypeEnum)t).sym.memtype)
return false;
if (t.isimaginary() || t.iscomplex())
{
if (sc.flags & SCOPE.Cfile)
return true; // complex/imaginary not deprecated in C code
Type rt;
switch (t.ty)
{
case Tcomplex32:
case Timaginary32:
rt = Type.tfloat32;
break;
case Tcomplex64:
case Timaginary64:
rt = Type.tfloat64;
break;
case Tcomplex80:
case Timaginary80:
rt = Type.tfloat80;
break;
default:
assert(0);
}
// @@@DEPRECATED_2.117@@@
// Deprecated in 2.097 - Can be made an error from 2.117.
// The deprecation period is longer than usual as `cfloat`,
// `cdouble`, and `creal` were quite widely used.
if (t.iscomplex())
{
deprecation(loc, "use of complex type `%s` is deprecated, use `std.complex.Complex!(%s)` instead",
toChars(), rt.toChars());
return true;
}
else
{
deprecation(loc, "use of imaginary type `%s` is deprecated, use `%s` instead",
toChars(), rt.toChars());
return true;
}
}
return false;
}
// For eliminating dynamic_cast
TypeBasic isTypeBasic()
{
return null;
}
final pure inout nothrow @nogc
{
/****************
* Is this type a pointer to a function?
* Returns:
* the function type if it is
*/
inout(TypeFunction) isPtrToFunction()
{
return (ty == Tpointer && (cast(TypePointer)this).next.ty == Tfunction)
? cast(typeof(return))(cast(TypePointer)this).next
: null;
}
/*****************
* Is this type a function, delegate, or pointer to a function?
* Returns:
* the function type if it is
*/
inout(TypeFunction) isFunction_Delegate_PtrToFunction()
{
return ty == Tfunction ? cast(typeof(return))this :
ty == Tdelegate ? cast(typeof(return))(cast(TypePointer)this).next :
ty == Tpointer && (cast(TypePointer)this).next.ty == Tfunction ?
cast(typeof(return))(cast(TypePointer)this).next :
null;
}
}
final pure inout nothrow @nogc @safe
{
inout(TypeError) isTypeError() { return ty == Terror ? cast(typeof(return))this : null; }
inout(TypeVector) isTypeVector() { return ty == Tvector ? cast(typeof(return))this : null; }
inout(TypeSArray) isTypeSArray() { return ty == Tsarray ? cast(typeof(return))this : null; }
inout(TypeDArray) isTypeDArray() { return ty == Tarray ? cast(typeof(return))this : null; }
inout(TypeAArray) isTypeAArray() { return ty == Taarray ? cast(typeof(return))this : null; }
inout(TypePointer) isTypePointer() { return ty == Tpointer ? cast(typeof(return))this : null; }
inout(TypeReference) isTypeReference() { return ty == Treference ? cast(typeof(return))this : null; }
inout(TypeFunction) isTypeFunction() { return ty == Tfunction ? cast(typeof(return))this : null; }
inout(TypeDelegate) isTypeDelegate() { return ty == Tdelegate ? cast(typeof(return))this : null; }
inout(TypeIdentifier) isTypeIdentifier() { return ty == Tident ? cast(typeof(return))this : null; }
inout(TypeInstance) isTypeInstance() { return ty == Tinstance ? cast(typeof(return))this : null; }
inout(TypeTypeof) isTypeTypeof() { return ty == Ttypeof ? cast(typeof(return))this : null; }
inout(TypeReturn) isTypeReturn() { return ty == Treturn ? cast(typeof(return))this : null; }
inout(TypeStruct) isTypeStruct() { return ty == Tstruct ? cast(typeof(return))this : null; }
inout(TypeEnum) isTypeEnum() { return ty == Tenum ? cast(typeof(return))this : null; }
inout(TypeClass) isTypeClass() { return ty == Tclass ? cast(typeof(return))this : null; }
inout(TypeTuple) isTypeTuple() { return ty == Ttuple ? cast(typeof(return))this : null; }
inout(TypeSlice) isTypeSlice() { return ty == Tslice ? cast(typeof(return))this : null; }
inout(TypeNull) isTypeNull() { return ty == Tnull ? cast(typeof(return))this : null; }
inout(TypeMixin) isTypeMixin() { return ty == Tmixin ? cast(typeof(return))this : null; }
inout(TypeTraits) isTypeTraits() { return ty == Ttraits ? cast(typeof(return))this : null; }
inout(TypeNoreturn) isTypeNoreturn() { return ty == Tnoreturn ? cast(typeof(return))this : null; }
inout(TypeTag) isTypeTag() { return ty == Ttag ? cast(typeof(return))this : null; }
}
override void accept(Visitor v)
{
v.visit(this);
}
final TypeFunction toTypeFunction()
{
if (ty != Tfunction)
assert(0);
return cast(TypeFunction)this;
}
extern (D) static Types* arraySyntaxCopy(Types* types)
{
Types* a = null;
if (types)
{
a = new Types(types.length);
foreach (i, t; *types)
{
(*a)[i] = t ? t.syntaxCopy() : null;
}
}
return a;
}
}
/***********************************************************
*/
extern (C++) final class TypeError : Type
{
extern (D) this()
{
super(Terror);
}
override const(char)* kind() const
{
return "error";
}
override TypeError syntaxCopy()
{
// No semantic analysis done, no need to copy
return this;
}
override uinteger_t size(const ref Loc loc)
{
return SIZE_INVALID;
}
override Expression defaultInitLiteral(const ref Loc loc)
{
return ErrorExp.get();
}
override void accept(Visitor v)
{
v.visit(this);
}
}
/***********************************************************
*/
extern (C++) abstract class TypeNext : Type
{
Type next;
final extern (D) this(TY ty, Type next)
{
super(ty);
this.next = next;
}
override final void checkDeprecated(const ref Loc loc, Scope* sc)
{
Type.checkDeprecated(loc, sc);
if (next) // next can be NULL if TypeFunction and auto return type
next.checkDeprecated(loc, sc);
}
override final int hasWild() const
{
if (ty == Tfunction)
return 0;
if (ty == Tdelegate)
return Type.hasWild();
return mod & MODFlags.wild || (next && next.hasWild());
}
/*******************************
* For TypeFunction, nextOf() can return NULL if the function return
* type is meant to be inferred, and semantic() hasn't yet ben run
* on the function. After semantic(), it must no longer be NULL.
*/
override final Type nextOf()
{
return next;
}
override final Type makeConst()
{
//printf("TypeNext::makeConst() %p, %s\n", this, toChars());
if (mcache && mcache.cto)
{
assert(mcache.cto.mod == MODFlags.const_);
return mcache.cto;
}
TypeNext t = cast(TypeNext)Type.makeConst();
if (ty != Tfunction && next.ty != Tfunction && !next.isImmutable())
{
if (next.isShared())
{
if (next.isWild())
t.next = next.sharedWildConstOf();
else
t.next = next.sharedConstOf();
}
else
{
if (next.isWild())
t.next = next.wildConstOf();
else
t.next = next.constOf();
}
}
//printf("TypeNext::makeConst() returns %p, %s\n", t, t.toChars());
return t;
}
override final Type makeImmutable()
{
//printf("TypeNext::makeImmutable() %s\n", toChars());
if (mcache && mcache.ito)
{
assert(mcache.ito.isImmutable());
return mcache.ito;
}
TypeNext t = cast(TypeNext)Type.makeImmutable();
if (ty != Tfunction && next.ty != Tfunction && !next.isImmutable())
{
t.next = next.immutableOf();
}
return t;
}
override final Type makeShared()
{
//printf("TypeNext::makeShared() %s\n", toChars());
if (mcache && mcache.sto)
{
assert(mcache.sto.mod == MODFlags.shared_);
return mcache.sto;
}
TypeNext t = cast(TypeNext)Type.makeShared();
if (ty != Tfunction && next.ty != Tfunction && !next.isImmutable())
{
if (next.isWild())
{
if (next.isConst())
t.next = next.sharedWildConstOf();
else
t.next = next.sharedWildOf();
}
else
{
if (next.isConst())
t.next = next.sharedConstOf();
else
t.next = next.sharedOf();
}
}
//printf("TypeNext::makeShared() returns %p, %s\n", t, t.toChars());
return t;
}
override final Type makeSharedConst()
{
//printf("TypeNext::makeSharedConst() %s\n", toChars());
if (mcache && mcache.scto)
{
assert(mcache.scto.mod == (MODFlags.shared_ | MODFlags.const_));
return mcache.scto;
}
TypeNext t = cast(TypeNext)Type.makeSharedConst();
if (ty != Tfunction && next.ty != Tfunction && !next.isImmutable())
{
if (next.isWild())
t.next = next.sharedWildConstOf();
else
t.next = next.sharedConstOf();
}
//printf("TypeNext::makeSharedConst() returns %p, %s\n", t, t.toChars());
return t;
}
override final Type makeWild()
{
//printf("TypeNext::makeWild() %s\n", toChars());
if (mcache && mcache.wto)
{
assert(mcache.wto.mod == MODFlags.wild);
return mcache.wto;
}
TypeNext t = cast(TypeNext)Type.makeWild();
if (ty != Tfunction && next.ty != Tfunction && !next.isImmutable())
{
if (next.isShared())
{
if (next.isConst())
t.next = next.sharedWildConstOf();
else
t.next = next.sharedWildOf();
}
else
{
if (next.isConst())
t.next = next.wildConstOf();
else
t.next = next.wildOf();
}
}
//printf("TypeNext::makeWild() returns %p, %s\n", t, t.toChars());
return t;
}
override final Type makeWildConst()
{
//printf("TypeNext::makeWildConst() %s\n", toChars());
if (mcache && mcache.wcto)
{
assert(mcache.wcto.mod == MODFlags.wildconst);
return mcache.wcto;
}
TypeNext t = cast(TypeNext)Type.makeWildConst();
if (ty != Tfunction && next.ty != Tfunction && !next.isImmutable())
{
if (next.isShared())
t.next = next.sharedWildConstOf();
else
t.next = next.wildConstOf();
}
//printf("TypeNext::makeWildConst() returns %p, %s\n", t, t.toChars());
return t;
}
override final Type makeSharedWild()
{
//printf("TypeNext::makeSharedWild() %s\n", toChars());
if (mcache && mcache.swto)
{
assert(mcache.swto.isSharedWild());
return mcache.swto;
}
TypeNext t = cast(TypeNext)Type.makeSharedWild();
if (ty != Tfunction && next.ty != Tfunction && !next.isImmutable())
{
if (next.isConst())
t.next = next.sharedWildConstOf();
else
t.next = next.sharedWildOf();
}
//printf("TypeNext::makeSharedWild() returns %p, %s\n", t, t.toChars());
return t;
}
override final Type makeSharedWildConst()
{
//printf("TypeNext::makeSharedWildConst() %s\n", toChars());
if (mcache && mcache.swcto)
{
assert(mcache.swcto.mod == (MODFlags.shared_ | MODFlags.wildconst));
return mcache.swcto;
}
TypeNext t = cast(TypeNext)Type.makeSharedWildConst();
if (ty != Tfunction && next.ty != Tfunction && !next.isImmutable())
{
t.next = next.sharedWildConstOf();
}
//printf("TypeNext::makeSharedWildConst() returns %p, %s\n", t, t.toChars());
return t;
}
override final Type makeMutable()
{
//printf("TypeNext::makeMutable() %p, %s\n", this, toChars());
TypeNext t = cast(TypeNext)Type.makeMutable();
if (ty == Tsarray)
{
t.next = next.mutableOf();
}
//printf("TypeNext::makeMutable() returns %p, %s\n", t, t.toChars());
return t;
}
override MATCH constConv(Type to)
{
//printf("TypeNext::constConv from = %s, to = %s\n", toChars(), to.toChars());
if (equals(to))
return MATCH.exact;
if (!(ty == to.ty && MODimplicitConv(mod, to.mod)))
return MATCH.nomatch;
Type tn = to.nextOf();
if (!(tn && next.ty == tn.ty))
return MATCH.nomatch;
MATCH m;
if (to.isConst()) // whole tail const conversion
{
// Recursive shared level check
m = next.constConv(tn);
if (m == MATCH.exact)
m = MATCH.constant;
}
else
{
//printf("\tnext => %s, to.next => %s\n", next.toChars(), tn.toChars());
m = next.equals(tn) ? MATCH.constant : MATCH.nomatch;
}
return m;
}
override final MOD deduceWild(Type t, bool isRef)
{
if (ty == Tfunction)
return 0;
ubyte wm;
Type tn = t.nextOf();
if (!isRef && (ty == Tarray || ty == Tpointer) && tn)
{
wm = next.deduceWild(tn, true);
if (!wm)
wm = Type.deduceWild(t, true);
}
else
{
wm = Type.deduceWild(t, isRef);
if (!wm && tn)
wm = next.deduceWild(tn, true);
}
return wm;
}
final void transitive()
{
/* Invoke transitivity of type attributes
*/
next = next.addMod(mod);
}
override void accept(Visitor v)
{
v.visit(this);
}
}
/***********************************************************
*/
extern (C++) final class TypeBasic : Type
{
const(char)* dstring;
uint flags;
extern (D) this(TY ty) scope
{
super(ty);
const(char)* d;
uint flags = 0;
switch (ty)
{
case Tvoid:
d = Token.toChars(TOK.void_);
break;
case Tint8:
d = Token.toChars(TOK.int8);
flags |= TFlags.integral;
break;
case Tuns8:
d = Token.toChars(TOK.uns8);
flags |= TFlags.integral | TFlags.unsigned;
break;
case Tint16:
d = Token.toChars(TOK.int16);
flags |= TFlags.integral;
break;
case Tuns16:
d = Token.toChars(TOK.uns16);
flags |= TFlags.integral | TFlags.unsigned;
break;
case Tint32:
d = Token.toChars(TOK.int32);
flags |= TFlags.integral;
break;
case Tuns32:
d = Token.toChars(TOK.uns32);
flags |= TFlags.integral | TFlags.unsigned;
break;
case Tfloat32:
d = Token.toChars(TOK.float32);
flags |= TFlags.floating | TFlags.real_;
break;
case Tint64:
d = Token.toChars(TOK.int64);
flags |= TFlags.integral;
break;
case Tuns64:
d = Token.toChars(TOK.uns64);
flags |= TFlags.integral | TFlags.unsigned;
break;
case Tint128:
d = Token.toChars(TOK.int128);
flags |= TFlags.integral;
break;
case Tuns128:
d = Token.toChars(TOK.uns128);
flags |= TFlags.integral | TFlags.unsigned;
break;
case Tfloat64:
d = Token.toChars(TOK.float64);
flags |= TFlags.floating | TFlags.real_;
break;
case Tfloat80:
d = Token.toChars(TOK.float80);
flags |= TFlags.floating | TFlags.real_;
break;
case Timaginary32:
d = Token.toChars(TOK.imaginary32);
flags |= TFlags.floating | TFlags.imaginary;
break;
case Timaginary64:
d = Token.toChars(TOK.imaginary64);
flags |= TFlags.floating | TFlags.imaginary;
break;
case Timaginary80:
d = Token.toChars(TOK.imaginary80);
flags |= TFlags.floating | TFlags.imaginary;
break;
case Tcomplex32:
d = Token.toChars(TOK.complex32);
flags |= TFlags.floating | TFlags.complex;
break;
case Tcomplex64:
d = Token.toChars(TOK.complex64);
flags |= TFlags.floating | TFlags.complex;
break;
case Tcomplex80:
d = Token.toChars(TOK.complex80);
flags |= TFlags.floating | TFlags.complex;
break;
case Tbool:
d = "bool";
flags |= TFlags.integral | TFlags.unsigned;
break;
case Tchar:
d = Token.toChars(TOK.char_);
flags |= TFlags.integral | TFlags.unsigned;
break;
case Twchar:
d = Token.toChars(TOK.wchar_);
flags |= TFlags.integral | TFlags.unsigned;
break;
case Tdchar:
d = Token.toChars(TOK.dchar_);
flags |= TFlags.integral | TFlags.unsigned;
break;
default:
assert(0);
}
this.dstring = d;
this.flags = flags;
merge(this);
}
override const(char)* kind() const
{
return dstring;
}
override TypeBasic syntaxCopy()
{
// No semantic analysis done on basic types, no need to copy
return this;
}
override uinteger_t size(const ref Loc loc)
{
uint size;
//printf("TypeBasic::size()\n");
switch (ty)
{
case Tint8:
case Tuns8:
size = 1;
break;
case Tint16:
case Tuns16:
size = 2;
break;
case Tint32:
case Tuns32:
case Tfloat32:
case Timaginary32:
size = 4;
break;
case Tint64:
case Tuns64:
case Tfloat64:
case Timaginary64:
size = 8;
break;
case Tfloat80:
case Timaginary80:
size = target.realsize;
break;
case Tcomplex32:
size = 8;
break;
case Tcomplex64:
case Tint128:
case Tuns128:
size = 16;
break;
case Tcomplex80:
size = target.realsize * 2;
break;
case Tvoid:
//size = Type::size(); // error message
size = 1;
break;
case Tbool:
size = 1;
break;
case Tchar:
size = 1;
break;
case Twchar:
size = 2;
break;
case Tdchar:
size = 4;
break;
default:
assert(0);
}
//printf("TypeBasic::size() = %d\n", size);
return size;
}
override uint alignsize()
{
return target.alignsize(this);
}
override bool isintegral()
{
//printf("TypeBasic::isintegral('%s') x%x\n", toChars(), flags);
return (flags & TFlags.integral) != 0;
}
override bool isfloating()
{
return (flags & TFlags.floating) != 0;
}
override bool isreal()
{
return (flags & TFlags.real_) != 0;
}
override bool isimaginary()
{
return (flags & TFlags.imaginary) != 0;
}
override bool iscomplex()
{
return (flags & TFlags.complex) != 0;
}
override bool isscalar()
{
return (flags & (TFlags.integral | TFlags.floating)) != 0;
}
override bool isunsigned()
{
return (flags & TFlags.unsigned) != 0;
}
override MATCH implicitConvTo(Type to)
{
//printf("TypeBasic::implicitConvTo(%s) from %s\n", to.toChars(), toChars());
if (this == to)
return MATCH.exact;
if (ty == to.ty)
{
if (mod == to.mod)
return MATCH.exact;
else if (MODimplicitConv(mod, to.mod))
return MATCH.constant;
else if (!((mod ^ to.mod) & MODFlags.shared_)) // for wild matching
return MATCH.constant;
else
return MATCH.convert;
}
if (ty == Tvoid || to.ty == Tvoid)
return MATCH.nomatch;
if (to.ty == Tbool)
return MATCH.nomatch;
TypeBasic tob;
if (to.ty == Tvector && to.deco)
{
TypeVector tv = cast(TypeVector)to;
tob = tv.elementType();
}
else if (auto te = to.isTypeEnum())
{
EnumDeclaration ed = te.sym;
if (ed.isSpecial())
{
/* Special enums that allow implicit conversions to them
* with a MATCH.convert
*/
tob = to.toBasetype().isTypeBasic();
}
else
return MATCH.nomatch;
}
else
tob = to.isTypeBasic();
if (!tob)
return MATCH.nomatch;
if (flags & TFlags.integral)
{
// Disallow implicit conversion of integers to imaginary or complex
if (tob.flags & (TFlags.imaginary | TFlags.complex))
return MATCH.nomatch;
// If converting from integral to integral
if (tob.flags & TFlags.integral)
{
const sz = size(Loc.initial);
const tosz = tob.size(Loc.initial);
/* Can't convert to smaller size
*/
if (sz > tosz)
return MATCH.nomatch;
/* Can't change sign if same size
*/
//if (sz == tosz && (flags ^ tob.flags) & TFlags.unsigned)
// return MATCH.nomatch;
}
}
else if (flags & TFlags.floating)
{
// Disallow implicit conversion of floating point to integer
if (tob.flags & TFlags.integral)
return MATCH.nomatch;
assert(tob.flags & TFlags.floating || to.ty == Tvector);
// Disallow implicit conversion from complex to non-complex
if (flags & TFlags.complex && !(tob.flags & TFlags.complex))
return MATCH.nomatch;
// Disallow implicit conversion of real or imaginary to complex
if (flags & (TFlags.real_ | TFlags.imaginary) && tob.flags & TFlags.complex)
return MATCH.nomatch;
// Disallow implicit conversion to-from real and imaginary
if ((flags & (TFlags.real_ | TFlags.imaginary)) != (tob.flags & (TFlags.real_ | TFlags.imaginary)))
return MATCH.nomatch;
}
return MATCH.convert;
}
override bool isZeroInit(const ref Loc loc)
{
switch (ty)
{
case Tchar:
case Twchar:
case Tdchar:
case Timaginary32:
case Timaginary64:
case Timaginary80:
case Tfloat32:
case Tfloat64:
case Tfloat80:
case Tcomplex32:
case Tcomplex64:
case Tcomplex80:
return false; // no
default:
return true; // yes
}
}
// For eliminating dynamic_cast
override TypeBasic isTypeBasic()
{
return this;
}
override void accept(Visitor v)
{
v.visit(this);
}
}
/***********************************************************
* The basetype must be one of:
* byte[16],ubyte[16],short[8],ushort[8],int[4],uint[4],long[2],ulong[2],float[4],double[2]
* For AVX:
* byte[32],ubyte[32],short[16],ushort[16],int[8],uint[8],long[4],ulong[4],float[8],double[4]
*/
extern (C++) final class TypeVector : Type
{
Type basetype;
extern (D) this(Type basetype)
{
super(Tvector);
this.basetype = basetype;
}
static TypeVector create(Type basetype)
{
return new TypeVector(basetype);
}
override const(char)* kind() const
{
return "vector";
}
override TypeVector syntaxCopy()
{
return new TypeVector(basetype.syntaxCopy());
}
override uinteger_t size(const ref Loc loc)
{
return basetype.size();
}
override uint alignsize()
{
return cast(uint)basetype.size();
}
override bool isintegral()
{
//printf("TypeVector::isintegral('%s') x%x\n", toChars(), flags);
return basetype.nextOf().isintegral();
}
override bool isfloating()
{
return basetype.nextOf().isfloating();
}
override bool isscalar()
{
return basetype.nextOf().isscalar();
}
override bool isunsigned()
{
return basetype.nextOf().isunsigned();
}
override bool isBoolean()
{
return false;
}
override MATCH implicitConvTo(Type to)
{
//printf("TypeVector::implicitConvTo(%s) from %s\n", to.toChars(), toChars());
if (this == to)
return MATCH.exact;
if (to.ty != Tvector)
return MATCH.nomatch;
TypeVector tv = cast(TypeVector)to;
assert(basetype.ty == Tsarray && tv.basetype.ty == Tsarray);
// Can't convert to a vector which has different size.
if (basetype.size() != tv.basetype.size())
return MATCH.nomatch;
// Allow conversion to void[]
if (tv.basetype.nextOf().ty == Tvoid)
return MATCH.convert;
// Otherwise implicitly convertible only if basetypes are.
return basetype.implicitConvTo(tv.basetype);
}
override Expression defaultInitLiteral(const ref Loc loc)
{
//printf("TypeVector::defaultInitLiteral()\n");
assert(basetype.ty == Tsarray);
Expression e = basetype.defaultInitLiteral(loc);
auto ve = new VectorExp(loc, e, this);
ve.type = this;
ve.dim = cast(int)(basetype.size(loc) / elementType().size(loc));
return ve;
}
TypeBasic elementType()
{
assert(basetype.ty == Tsarray);
TypeSArray t = cast(TypeSArray)basetype;
TypeBasic tb = t.nextOf().isTypeBasic();
assert(tb);
return tb;
}
override bool isZeroInit(const ref Loc loc)
{
return basetype.isZeroInit(loc);
}
override void accept(Visitor v)
{
v.visit(this);
}
}
/***********************************************************
*/
extern (C++) abstract class TypeArray : TypeNext
{
final extern (D) this(TY ty, Type next)
{
super(ty, next);
}
override void accept(Visitor v)
{
v.visit(this);
}
}
/***********************************************************
* Static array, one with a fixed dimension
*/
extern (C++) final class TypeSArray : TypeArray
{
Expression dim;
extern (D) this(Type t, Expression dim)
{
super(Tsarray, t);
//printf("TypeSArray(%s)\n", dim.toChars());
this.dim = dim;
}
extern (D) this(Type t) // for incomplete type
{
super(Tsarray, t);
//printf("TypeSArray()\n");
this.dim = new IntegerExp(0);
}
override const(char)* kind() const
{
return "sarray";
}
override TypeSArray syntaxCopy()
{
Type t = next.syntaxCopy();
Expression e = dim.syntaxCopy();
auto result = new TypeSArray(t, e);
result.mod = mod;
return result;
}
/***
* C11 6.7.6.2-4 incomplete array type
* Returns: true if incomplete type
*/
bool isIncomplete()
{
return dim.isIntegerExp() && dim.isIntegerExp().getInteger() == 0;
}
override uinteger_t size(const ref Loc loc)
{
//printf("TypeSArray::size()\n");
const n = numberOfElems(loc);
const elemsize = baseElemOf().size(loc);
bool overflow = false;
const sz = mulu(n, elemsize, overflow);
if (overflow || sz >= uint.max)
{
if (elemsize != SIZE_INVALID && n != uint.max)
error(loc, "static array `%s` size overflowed to %lld", toChars(), cast(long)sz);
return SIZE_INVALID;
}
return sz;
}
override uint alignsize()
{
return next.alignsize();
}
override bool isString()
{
TY nty = next.toBasetype().ty;
return nty.isSomeChar;
}
override bool isZeroInit(const ref Loc loc)
{
return next.isZeroInit(loc);
}
override structalign_t alignment()
{
return next.alignment();
}
override MATCH constConv(Type to)
{
if (auto tsa = to.isTypeSArray())
{
if (!dim.equals(tsa.dim))
return MATCH.nomatch;
}
return TypeNext.constConv(to);
}
override MATCH implicitConvTo(Type to)
{
//printf("TypeSArray::implicitConvTo(to = %s) this = %s\n", to.toChars(), toChars());
if (auto ta = to.isTypeDArray())
{
if (!MODimplicitConv(next.mod, ta.next.mod))
return MATCH.nomatch;
/* Allow conversion to void[]
*/
if (ta.next.ty == Tvoid)
{
return MATCH.convert;
}
MATCH m = next.constConv(ta.next);
if (m > MATCH.nomatch)
{
return MATCH.convert;
}
return MATCH.nomatch;
}
if (auto tsa = to.isTypeSArray())
{
if (this == to)
return MATCH.exact;
if (dim.equals(tsa.dim))
{
MATCH m = next.implicitConvTo(tsa.next);
/* Allow conversion to non-interface base class.
*/
if (m == MATCH.convert &&
next.ty == Tclass)
{
if (auto toc = tsa.next.isTypeClass)
{
if (!toc.sym.isInterfaceDeclaration)
return MATCH.convert;
}
}
/* Since static arrays are value types, allow
* conversions from const elements to non-const
* ones, just like we allow conversion from const int
* to int.
*/
if (m >= MATCH.constant)
{
if (mod != to.mod)
m = MATCH.constant;
return m;
}
}
}
return MATCH.nomatch;
}
override Expression defaultInitLiteral(const ref Loc loc)
{
static if (LOGDEFAULTINIT)
{
printf("TypeSArray::defaultInitLiteral() '%s'\n", toChars());
}
size_t d = cast(size_t)dim.toInteger();
Expression elementinit;
if (next.ty == Tvoid)
elementinit = tuns8.defaultInitLiteral(loc);
else
elementinit = next.defaultInitLiteral(loc);
auto elements = new Expressions(d);
foreach (ref e; *elements)
e = null;
auto ae = new ArrayLiteralExp(Loc.initial, this, elementinit, elements);
return ae;
}
override bool hasPointers()
{
/* Don't want to do this, because:
* struct S { T* array[0]; }
* may be a variable length struct.
*/
//if (dim.toInteger() == 0)
// return false;
if (next.ty == Tvoid)
{
// Arrays of void contain arbitrary data, which may include pointers
return true;
}
else
return next.hasPointers();
}
override bool hasSystemFields()
{
return next.hasSystemFields();
}
override bool hasVoidInitPointers()
{
return next.hasVoidInitPointers();
}
override bool hasInvariant()
{
return next.hasInvariant();
}
override bool needsDestruction()
{
return next.needsDestruction();
}
override bool needsCopyOrPostblit()
{
return next.needsCopyOrPostblit();
}
/*********************************
*
*/
override bool needsNested()
{
return next.needsNested();
}
override void accept(Visitor v)
{
v.visit(this);
}
}
/***********************************************************
* Dynamic array, no dimension
*/
extern (C++) final class TypeDArray : TypeArray
{
extern (D) this(Type t)
{
super(Tarray, t);
//printf("TypeDArray(t = %p)\n", t);
}
override const(char)* kind() const
{
return "darray";
}
override TypeDArray syntaxCopy()
{
Type t = next.syntaxCopy();
if (t == next)
return this;
auto result = new TypeDArray(t);
result.mod = mod;
return result;
}
override uinteger_t size(const ref Loc loc)
{
//printf("TypeDArray::size()\n");
return target.ptrsize * 2;
}
override uint alignsize()
{
// A DArray consists of two ptr-sized values, so align it on pointer size
// boundary
return target.ptrsize;
}
override bool isString()
{
TY nty = next.toBasetype().ty;
return nty.isSomeChar;
}
override bool isZeroInit(const ref Loc loc)
{
return true;
}
override bool isBoolean()
{
return true;
}
override MATCH implicitConvTo(Type to)
{
//printf("TypeDArray::implicitConvTo(to = %s) this = %s\n", to.toChars(), toChars());
if (equals(to))
return MATCH.exact;
if (auto ta = to.isTypeDArray())
{
if (!MODimplicitConv(next.mod, ta.next.mod))
return MATCH.nomatch; // not const-compatible
/* Allow conversion to void[]
*/
if (next.ty != Tvoid && ta.next.ty == Tvoid)
{
return MATCH.convert;
}
MATCH m = next.constConv(ta.next);
if (m > MATCH.nomatch)
{
if (m == MATCH.exact && mod != to.mod)
m = MATCH.constant;
return m;
}
}
return Type.implicitConvTo(to);
}
override bool hasPointers()
{
return true;
}
override void accept(Visitor v)
{
v.visit(this);
}
}
/***********************************************************
*/
extern (C++) final class TypeAArray : TypeArray
{
Type index; // key type
Loc loc;
extern (D) this(Type t, Type index)
{
super(Taarray, t);
this.index = index;
}
static TypeAArray create(Type t, Type index)
{
return new TypeAArray(t, index);
}
override const(char)* kind() const
{
return "aarray";
}
override TypeAArray syntaxCopy()
{
Type t = next.syntaxCopy();
Type ti = index.syntaxCopy();
if (t == next && ti == index)
return this;
auto result = new TypeAArray(t, ti);
result.mod = mod;
return result;
}
override uinteger_t size(const ref Loc loc)
{
return target.ptrsize;
}
override bool isZeroInit(const ref Loc loc)
{
return true;
}
override bool isBoolean()
{
return true;
}
override bool hasPointers()
{
return true;
}
override MATCH implicitConvTo(Type to)
{
//printf("TypeAArray::implicitConvTo(to = %s) this = %s\n", to.toChars(), toChars());
if (equals(to))
return MATCH.exact;
if (auto ta = to.isTypeAArray())
{
if (!MODimplicitConv(next.mod, ta.next.mod))
return MATCH.nomatch; // not const-compatible
if (!MODimplicitConv(index.mod, ta.index.mod))
return MATCH.nomatch; // not const-compatible
MATCH m = next.constConv(ta.next);
MATCH mi = index.constConv(ta.index);
if (m > MATCH.nomatch && mi > MATCH.nomatch)
{
return MODimplicitConv(mod, to.mod) ? MATCH.constant : MATCH.nomatch;
}
}
return Type.implicitConvTo(to);
}
override MATCH constConv(Type to)
{
if (auto taa = to.isTypeAArray())
{
MATCH mindex = index.constConv(taa.index);
MATCH mkey = next.constConv(taa.next);
// Pick the worst match
return mkey < mindex ? mkey : mindex;
}
return Type.constConv(to);
}
override void accept(Visitor v)
{
v.visit(this);
}
}
/***********************************************************
*/
extern (C++) final class TypePointer : TypeNext
{
extern (D) this(Type t)
{
super(Tpointer, t);
}
static TypePointer create(Type t)
{
return new TypePointer(t);
}
override const(char)* kind() const
{
return "pointer";
}
override TypePointer syntaxCopy()
{
Type t = next.syntaxCopy();
if (t == next)
return this;
auto result = new TypePointer(t);
result.mod = mod;
return result;
}
override uinteger_t size(const ref Loc loc)
{
return target.ptrsize;
}
override MATCH implicitConvTo(Type to)
{
//printf("TypePointer::implicitConvTo(to = %s) %s\n", to.toChars(), toChars());
if (equals(to))
return MATCH.exact;
// Only convert between pointers
auto tp = to.isTypePointer();
if (!tp)
return MATCH.nomatch;
assert(this.next);
assert(tp.next);
// Conversion to void*
if (tp.next.ty == Tvoid)
{
// Function pointer conversion doesn't check constness?
if (this.next.ty == Tfunction)
return MATCH.convert;
if (!MODimplicitConv(next.mod, tp.next.mod))
return MATCH.nomatch; // not const-compatible
return this.next.ty == Tvoid ? MATCH.constant : MATCH.convert;
}
// Conversion between function pointers
if (auto thisTf = this.next.isTypeFunction())
return thisTf.implicitPointerConv(tp.next);
// Default, no implicit conversion between the pointer targets
MATCH m = next.constConv(tp.next);
if (m == MATCH.exact && mod != to.mod)
m = MATCH.constant;
return m;
}
override MATCH constConv(Type to)
{
if (next.ty == Tfunction)
{
if (to.nextOf() && next.equals((cast(TypeNext)to).next))
return Type.constConv(to);
else
return MATCH.nomatch;
}
return TypeNext.constConv(to);
}
override bool isscalar()
{
return true;
}
override bool isZeroInit(const ref Loc loc)
{
return true;
}
override bool hasPointers()
{
return true;
}
override void accept(Visitor v)
{
v.visit(this);
}
}
/***********************************************************
*/
extern (C++) final class TypeReference : TypeNext
{
extern (D) this(Type t)
{
super(Treference, t);
// BUG: what about references to static arrays?
}
override const(char)* kind() const
{
return "reference";
}
override TypeReference syntaxCopy()
{
Type t = next.syntaxCopy();
if (t == next)
return this;
auto result = new TypeReference(t);
result.mod = mod;
return result;
}
override uinteger_t size(const ref Loc loc)
{
return target.ptrsize;
}
override bool isZeroInit(const ref Loc loc)
{
return true;
}
override void accept(Visitor v)
{
v.visit(this);
}
}
enum RET : int
{
regs = 1, // returned in registers
stack = 2, // returned on stack
}
enum TRUSTformat : int
{
TRUSTformatDefault, // do not emit @system when trust == TRUST.default_
TRUSTformatSystem, // emit @system when trust == TRUST.default_
}
alias TRUSTformatDefault = TRUSTformat.TRUSTformatDefault;
alias TRUSTformatSystem = TRUSTformat.TRUSTformatSystem;
/***********************************************************
*/
extern (C++) final class TypeFunction : TypeNext
{
// .next is the return type
ParameterList parameterList; // function parameters
// These flags can be accessed like `bool` properties,
// getters and setters are generated for them
private extern (D) static struct BitFields
{
bool isnothrow; /// nothrow
bool isnogc; /// is @nogc
bool isproperty; /// can be called without parentheses
bool isref; /// returns a reference
bool isreturn; /// 'this' is returned by ref
bool isScopeQual; /// 'this' is scope
bool isreturninferred; /// 'this' is return from inference
bool isscopeinferred; /// 'this' is scope from inference
bool islive; /// is @live
bool incomplete; /// return type or default arguments removed
bool isInOutParam; /// inout on the parameters
bool isInOutQual; /// inout on the qualifier
bool isctor; /// the function is a constructor
bool isreturnscope; /// `this` is returned by value
}
import dmd.common.bitfields : generateBitFields;
mixin(generateBitFields!(BitFields, ushort));
LINK linkage; // calling convention
TRUST trust; // level of trust
PURE purity = PURE.impure;
byte inuse;
Expressions* fargs; // function arguments
extern (D) this(ParameterList pl, Type treturn, LINK linkage, StorageClass stc = 0)
{
super(Tfunction, treturn);
//if (!treturn) *(char*)0=0;
// assert(treturn);
assert(VarArg.none <= pl.varargs && pl.varargs <= VarArg.max);
this.parameterList = pl;
this.linkage = linkage;
if (stc & STC.pure_)
this.purity = PURE.fwdref;
if (stc & STC.nothrow_)
this.isnothrow = true;
if (stc & STC.nogc)
this.isnogc = true;
if (stc & STC.property)
this.isproperty = true;
if (stc & STC.live)
this.islive = true;
if (stc & STC.ref_)
this.isref = true;
if (stc & STC.return_)
this.isreturn = true;
if (stc & STC.returnScope)
this.isreturnscope = true;
if (stc & STC.returninferred)
this.isreturninferred = true;
if (stc & STC.scope_)
this.isScopeQual = true;
if (stc & STC.scopeinferred)
this.isscopeinferred = true;
this.trust = TRUST.default_;
if (stc & STC.safe)
this.trust = TRUST.safe;
else if (stc & STC.system)
this.trust = TRUST.system;
else if (stc & STC.trusted)
this.trust = TRUST.trusted;
}
static TypeFunction create(Parameters* parameters, Type treturn, ubyte varargs, LINK linkage, StorageClass stc = 0)
{
return new TypeFunction(ParameterList(parameters, cast(VarArg)varargs), treturn, linkage, stc);
}
override const(char)* kind() const
{
return "function";
}
override TypeFunction syntaxCopy()
{
Type treturn = next ? next.syntaxCopy() : null;
auto t = new TypeFunction(parameterList.syntaxCopy(), treturn, linkage);
t.mod = mod;
t.isnothrow = isnothrow;
t.isnogc = isnogc;
t.islive = islive;
t.purity = purity;
t.isproperty = isproperty;
t.isref = isref;
t.isreturn = isreturn;
t.isreturnscope = isreturnscope;
t.isScopeQual = isScopeQual;
t.isreturninferred = isreturninferred;
t.isscopeinferred = isscopeinferred;
t.isInOutParam = isInOutParam;
t.isInOutQual = isInOutQual;
t.trust = trust;
t.fargs = fargs;
t.isctor = isctor;
return t;
}
/********************************************
* Set 'purity' field of 'this'.
* Do this lazily, as the parameter types might be forward referenced.
*/
void purityLevel()
{
TypeFunction tf = this;
if (tf.purity != PURE.fwdref)
return;
purity = PURE.const_; // assume strong until something weakens it
/* Evaluate what kind of purity based on the modifiers for the parameters
*/
foreach (i, fparam; tf.parameterList)
{
Type t = fparam.type;
if (!t)
continue;
if (fparam.storageClass & (STC.lazy_ | STC.out_))
{
purity = PURE.weak;
break;
}
const pref = (fparam.storageClass & STC.ref_) != 0;
if (mutabilityOfType(pref, t) == 0)
purity = PURE.weak;
}
tf.purity = purity;
}
/********************************************
* Return true if there are lazy parameters.
*/
bool hasLazyParameters()
{
foreach (i, fparam; parameterList)
{
if (fparam.isLazy())
return true;
}
return false;
}
/*******************************
* Check for `extern (D) U func(T t, ...)` variadic function type,
* which has `_arguments[]` added as the first argument.
* Returns:
* true if D-style variadic
*/
bool isDstyleVariadic() const pure nothrow
{
return linkage == LINK.d && parameterList.varargs == VarArg.variadic;
}
/************************************
* Take the specified storage class for p,
* and use the function signature to infer whether
* STC.scope_ and STC.return_ should be OR'd in.
* (This will not affect the name mangling.)
* Params:
* tthis = type of `this` parameter, null if none
* p = parameter to this function
* Returns:
* storage class with STC.scope_ or STC.return_ OR'd in
*/
StorageClass parameterStorageClass(Type tthis, Parameter p)
{
//printf("parameterStorageClass(p: %s)\n", p.toChars());
auto stc = p.storageClass;
// When the preview switch is enable, `in` parameters are `scope`
if (stc & STC.in_ && global.params.previewIn)
return stc | STC.scope_;
if (stc & (STC.scope_ | STC.return_ | STC.lazy_) || purity == PURE.impure)
return stc;
/* If haven't inferred the return type yet, can't infer storage classes
*/
if (!nextOf() || !isnothrow())
return stc;
purityLevel();
static bool mayHavePointers(Type t)
{
if (auto ts = t.isTypeStruct())
{
auto sym = ts.sym;
if (sym.members && !sym.determineFields() && sym.type != Type.terror)
// struct is forward referenced, so "may have" pointers
return true;
}
return t.hasPointers();
}
// See if p can escape via any of the other parameters
if (purity == PURE.weak)
{
// Check escaping through parameters
foreach (i, fparam; parameterList)
{
Type t = fparam.type;
if (!t)
continue;
t = t.baseElemOf(); // punch thru static arrays
if (t.isMutable() && t.hasPointers())
{
if (fparam.isReference() && fparam != p)
return stc;
if (t.ty == Tdelegate)
return stc; // could escape thru delegate
if (t.ty == Tclass)
return stc;
/* if t is a pointer to mutable pointer
*/
if (auto tn = t.nextOf())
{
if (tn.isMutable() && mayHavePointers(tn))
return stc; // escape through pointers
}
}
}
// Check escaping through `this`
if (tthis && tthis.isMutable())
{
foreach (VarDeclaration v; isAggregate(tthis).fields)
{
if (v.hasPointers())
return stc;
}
}
}
// Check escaping through return value
Type tret = nextOf().toBasetype();
if (isref || tret.hasPointers())
{
return stc | STC.scope_ | STC.return_ | STC.returnScope;
}
else
return stc | STC.scope_;
}
override Type addStorageClass(StorageClass stc)
{
//printf("addStorageClass(%llx) %d\n", stc, (stc & STC.scope_) != 0);
TypeFunction t = Type.addStorageClass(stc).toTypeFunction();
if ((stc & STC.pure_ && !t.purity) ||
(stc & STC.nothrow_ && !t.isnothrow) ||
(stc & STC.nogc && !t.isnogc) ||
(stc & STC.scope_ && !t.isScopeQual) ||
(stc & STC.safe && t.trust < TRUST.trusted))
{
// Klunky to change these
auto tf = new TypeFunction(t.parameterList, t.next, t.linkage, 0);
tf.mod = t.mod;
tf.fargs = fargs;
tf.purity = t.purity;
tf.isnothrow = t.isnothrow;
tf.isnogc = t.isnogc;
tf.isproperty = t.isproperty;
tf.isref = t.isref;
tf.isreturn = t.isreturn;
tf.isreturnscope = t.isreturnscope;
tf.isScopeQual = t.isScopeQual;
tf.isreturninferred = t.isreturninferred;
tf.isscopeinferred = t.isscopeinferred;
tf.trust = t.trust;
tf.isInOutParam = t.isInOutParam;
tf.isInOutQual = t.isInOutQual;
tf.isctor = t.isctor;
if (stc & STC.pure_)
tf.purity = PURE.fwdref;
if (stc & STC.nothrow_)
tf.isnothrow = true;
if (stc & STC.nogc)
tf.isnogc = true;
if (stc & STC.safe)
tf.trust = TRUST.safe;
if (stc & STC.scope_)
{
tf.isScopeQual = true;
if (stc & STC.scopeinferred)
tf.isscopeinferred = true;
}
tf.deco = tf.merge().deco;
t = tf;
}
return t;
}
override Type substWildTo(uint)
{
if (!iswild && !(mod & MODFlags.wild))
return this;
// Substitude inout qualifier of function type to mutable or immutable
// would break type system. Instead substitude inout to the most weak
// qualifer - const.
uint m = MODFlags.const_;
assert(next);
Type tret = next.substWildTo(m);
Parameters* params = parameterList.parameters;
if (mod & MODFlags.wild)
params = parameterList.parameters.copy();
for (size_t i = 0; i < params.length; i++)
{
Parameter p = (*params)[i];
Type t = p.type.substWildTo(m);
if (t == p.type)
continue;
if (params == parameterList.parameters)
params = parameterList.parameters.copy();
(*params)[i] = new Parameter(p.storageClass, t, null, null, null);
}
if (next == tret && params == parameterList.parameters)
return this;
// Similar to TypeFunction::syntaxCopy;
auto t = new TypeFunction(ParameterList(params, parameterList.varargs), tret, linkage);
t.mod = ((mod & MODFlags.wild) ? (mod & ~MODFlags.wild) | MODFlags.const_ : mod);
t.isnothrow = isnothrow;
t.isnogc = isnogc;
t.purity = purity;
t.isproperty = isproperty;
t.isref = isref;
t.isreturn = isreturn;
t.isreturnscope = isreturnscope;
t.isScopeQual = isScopeQual;
t.isreturninferred = isreturninferred;
t.isscopeinferred = isscopeinferred;
t.isInOutParam = false;
t.isInOutQual = false;
t.trust = trust;
t.fargs = fargs;
t.isctor = isctor;
return t.merge();
}
// arguments get specially formatted
private const(char)* getParamError(Expression arg, Parameter par)
{
if (global.gag && !global.params.showGaggedErrors)
return null;
// show qualification when toChars() is the same but types are different
// https://issues.dlang.org/show_bug.cgi?id=19948
// when comparing the type with strcmp, we need to drop the qualifier
auto at = arg.type.mutableOf().toChars();
bool qual = !arg.type.equals(par.type) && strcmp(at, par.type.mutableOf().toChars()) == 0;
if (qual)
at = arg.type.toPrettyChars(true);
OutBuffer buf;
// only mention rvalue if it's relevant
const rv = !arg.isLvalue() && par.isReference();
buf.printf("cannot pass %sargument `%s` of type `%s` to parameter `%s`",
rv ? "rvalue ".ptr : "".ptr, arg.toChars(), at,
parameterToChars(par, this, qual));
return buf.extractChars();
}
private extern(D) const(char)* getMatchError(A...)(const(char)* format, A args)
{
if (global.gag && !global.params.showGaggedErrors)
return null;
OutBuffer buf;
buf.printf(format, args);
return buf.extractChars();
}
/********************************
* 'args' are being matched to function 'this'
* Determine match level.
* Params:
* tthis = type of `this` pointer, null if not member function
* argumentList = arguments to function call
* flag = 1: performing a partial ordering match
* pMessage = address to store error message, or null
* sc = context
* Returns:
* MATCHxxxx
*/
extern (D) MATCH callMatch(Type tthis, ArgumentList argumentList, int flag = 0, const(char)** pMessage = null, Scope* sc = null)
{
//printf("TypeFunction::callMatch() %s\n", toChars());
MATCH match = MATCH.exact; // assume exact match
ubyte wildmatch = 0;
if (tthis)
{
Type t = tthis;
if (t.toBasetype().ty == Tpointer)
t = t.toBasetype().nextOf(); // change struct* to struct
if (t.mod != mod)
{
if (MODimplicitConv(t.mod, mod))
match = MATCH.constant;
else if ((mod & MODFlags.wild) && MODimplicitConv(t.mod, (mod & ~MODFlags.wild) | MODFlags.const_))
{
match = MATCH.constant;
}
else
return MATCH.nomatch;
}
if (isWild())
{
if (t.isWild())
wildmatch |= MODFlags.wild;
else if (t.isConst())
wildmatch |= MODFlags.const_;
else if (t.isImmutable())
wildmatch |= MODFlags.immutable_;
else
wildmatch |= MODFlags.mutable;
}
}
const nparams = parameterList.length;
if (argumentList.length > nparams)
{
if (parameterList.varargs == VarArg.none)
{
// suppress early exit if an error message is wanted,
// so we can check any matching args are valid
if (!pMessage)
return MATCH.nomatch;
}
// too many args; no match
match = MATCH.convert; // match ... with a "conversion" match level
}
// https://issues.dlang.org/show_bug.cgi?id=22997
if (parameterList.varargs == VarArg.none && nparams > argumentList.length && !parameterList.hasDefaultArgs)
{
OutBuffer buf;
buf.printf("too few arguments, expected %d, got %d", cast(int)nparams, cast(int)argumentList.length);
if (pMessage)
*pMessage = buf.extractChars();
return MATCH.nomatch;
}
auto resolvedArgs = resolveNamedArgs(argumentList, pMessage);
Expression[] args;
if (!resolvedArgs)
{
if (!pMessage || *pMessage)
return MATCH.nomatch;
// if no message was provided, it was because of overflow which will be diagnosed below
match = MATCH.nomatch;
args = argumentList.arguments ? (*argumentList.arguments)[] : null;
}
else
{
args = (*resolvedArgs)[];
}
foreach (u, p; parameterList)
{
if (u >= args.length)
break;
Expression arg = args[u];
if (!arg)
continue; // default argument
Type tprm = p.type;
Type targ = arg.type;
if (!(p.isLazy() && tprm.ty == Tvoid && targ.ty != Tvoid))
{
const isRef = p.isReference();
wildmatch |= targ.deduceWild(tprm, isRef);
}
}
if (wildmatch)
{
/* Calculate wild matching modifier
*/
if (wildmatch & MODFlags.const_ || wildmatch & (wildmatch - 1))
wildmatch = MODFlags.const_;
else if (wildmatch & MODFlags.immutable_)
wildmatch = MODFlags.immutable_;
else if (wildmatch & MODFlags.wild)
wildmatch = MODFlags.wild;
else
{
assert(wildmatch & MODFlags.mutable);
wildmatch = MODFlags.mutable;
}
}
foreach (u, p; parameterList)
{
MATCH m;
assert(p);
// One or more arguments remain
if (u < args.length)
{
Expression arg = args[u];
if (!arg)
continue; // default argument
m = argumentMatchParameter(this, p, arg, wildmatch, flag, sc, pMessage);
}
else if (p.defaultArg)
continue;
/* prefer matching the element type rather than the array
* type when more arguments are present with T[]...
*/
if (parameterList.varargs == VarArg.typesafe && u + 1 == nparams && args.length > nparams)
goto L1;
//printf("\tm = %d\n", m);
if (m == MATCH.nomatch) // if no match
{
L1:
if (parameterList.varargs == VarArg.typesafe && u + 1 == nparams) // if last varargs param
{
auto trailingArgs = args[u .. $];
if (auto vmatch = matchTypeSafeVarArgs(this, p, trailingArgs, pMessage))
return vmatch < match ? vmatch : match;
// Error message was already generated in `matchTypeSafeVarArgs`
return MATCH.nomatch;
}
if (pMessage && u >= args.length)
*pMessage = getMatchError("missing argument for parameter #%d: `%s`",
u + 1, parameterToChars(p, this, false));
// If an error happened previously, `pMessage` was already filled
else if (pMessage && !*pMessage)
*pMessage = getParamError(args[u], p);
return MATCH.nomatch;
}
if (m < match)
match = m; // pick worst match
}
if (pMessage && !parameterList.varargs && args.length > nparams)
{
// all parameters had a match, but there are surplus args
*pMessage = getMatchError("expected %d argument(s), not %d", nparams, args.length);
return MATCH.nomatch;
}
//printf("match = %d\n", match);
return match;
}
/********************************
* Convert an `argumentList`, which may contain named arguments, into
* a list of arguments in the order of the parameter list.
*
* Params:
* argumentList = array of function arguments
* pMessage = address to store error message, or `null`
* Returns: re-ordered argument list, or `null` on error
*/
extern(D) Expressions* resolveNamedArgs(ArgumentList argumentList, const(char)** pMessage)
{
Expression[] args = argumentList.arguments ? (*argumentList.arguments)[] : null;
Identifier[] names = argumentList.names ? (*argumentList.names)[] : null;
auto newArgs = new Expressions(parameterList.length);
newArgs.zero();
size_t ci = 0;
bool hasNamedArgs = false;
foreach (i, arg; args)
{
if (!arg)
{
ci++;
continue;
}
auto name = i < names.length ? names[i] : null;
if (name)
{
hasNamedArgs = true;
const pi = findParameterIndex(name);
if (pi == -1)
{
if (pMessage)
*pMessage = getMatchError("no parameter named `%s`", name.toChars());
return null;
}
ci = pi;
}
if (ci >= newArgs.length)
{
if (!parameterList.varargs)
{
// Without named args, let the caller diagnose argument overflow
if (hasNamedArgs && pMessage)
*pMessage = getMatchError("argument `%s` goes past end of parameter list", arg.toChars());
return null;
}
while (ci >= newArgs.length)
newArgs.push(null);
}
if ((*newArgs)[ci])
{
if (pMessage)
*pMessage = getMatchError("parameter `%s` assigned twice", parameterList[ci].toChars());
return null;
}
(*newArgs)[ci++] = arg;
}
foreach (i, arg; (*newArgs)[])
{
if (arg || parameterList[i].defaultArg)
continue;
if (parameterList.varargs != VarArg.none && i + 1 == newArgs.length)
continue;
if (pMessage)
*pMessage = getMatchError("missing argument for parameter #%d: `%s`",
i + 1, parameterToChars(parameterList[i], this, false));
return null;
}
// strip trailing nulls from default arguments
size_t e = newArgs.length;
while (e > 0 && (*newArgs)[e - 1] is null)
{
--e;
}
newArgs.setDim(e);
return newArgs;
}
/+
+ Checks whether this function type is convertible to ` to`
+ when used in a function pointer / delegate.
+
+ Params:
+ to = target type
+
+ Returns:
+ MATCH.nomatch: `to` is not a covaraint function
+ MATCH.convert: `to` is a covaraint function
+ MATCH.exact: `to` is identical to this function
+/
private MATCH implicitPointerConv(Type to)
{
assert(to);
if (this.equals(to))
return MATCH.constant;
if (this.covariant(to) == Covariant.yes)
{
Type tret = this.nextOf();
Type toret = to.nextOf();
if (tret.ty == Tclass && toret.ty == Tclass)
{
/* https://issues.dlang.org/show_bug.cgi?id=10219
* Check covariant interface return with offset tweaking.
* interface I {}
* class C : Object, I {}
* I function() dg = function C() {} // should be error
*/
int offset = 0;
if (toret.isBaseOf(tret, &offset) && offset != 0)
return MATCH.nomatch;
}
return MATCH.convert;
}
return MATCH.nomatch;
}
/** Extends TypeNext.constConv by also checking for matching attributes **/
override MATCH constConv(Type to)
{
// Attributes need to match exactly, otherwise it's an implicit conversion
if (this.ty != to.ty || !this.attributesEqual(cast(TypeFunction) to))
return MATCH.nomatch;
return super.constConv(to);
}
extern (D) bool checkRetType(const ref Loc loc)
{
Type tb = next.toBasetype();
if (tb.ty == Tfunction)
{
error(loc, "functions cannot return a function");
next = Type.terror;
}
if (tb.ty == Ttuple)
{
error(loc, "functions cannot return a tuple");
next = Type.terror;
}
if (!isref && (tb.ty == Tstruct || tb.ty == Tsarray))
{
if (auto ts = tb.baseElemOf().isTypeStruct())
{
if (!ts.sym.members)
{
error(loc, "functions cannot return opaque type `%s` by value", tb.toChars());
next = Type.terror;
}
}
}
if (tb.ty == Terror)
return true;
return false;
}
/// Returns: `true` the function is `isInOutQual` or `isInOutParam` ,`false` otherwise.
bool iswild() const pure nothrow @safe @nogc
{
return isInOutParam || isInOutQual;
}
/// Returns: whether `this` function type has the same attributes (`@safe`,...) as `other`
extern (D) bool attributesEqual(const scope TypeFunction other, bool trustSystemEqualsDefault = true) const pure nothrow @safe @nogc
{
// @@@DEPRECATED_2.112@@@
// See semantic2.d Semantic2Visitor.visit(FuncDeclaration):
// Two overloads that are identical except for one having an explicit `@system`
// attribute is currently in deprecation, and will become an error in 2.104 for
// `extern(C)`, and 2.112 for `extern(D)` code respectively. Once the deprecation
// period has passed, the trustSystemEqualsDefault=true behaviour should be made
// the default, then we can remove the `cannot overload extern(...) function`
// errors as they will become dead code as a result.
return (this.trust == other.trust ||
(trustSystemEqualsDefault && this.trust <= TRUST.system && other.trust <= TRUST.system)) &&
this.purity == other.purity &&
this.isnothrow == other.isnothrow &&
this.isnogc == other.isnogc &&
this.islive == other.islive;
}
override void accept(Visitor v)
{
v.visit(this);
}
/**
* Look for the index of parameter `ident` in the parameter list
*
* Params:
* ident = identifier of parameter to search for
* Returns: index of parameter with name `ident` or -1 if not found
*/
private extern(D) ptrdiff_t findParameterIndex(Identifier ident)
{
foreach (i, p; this.parameterList)
{
if (p.ident == ident)
return i;
}
return -1;
}
}
/***********************************************************
*/
extern (C++) final class TypeDelegate : TypeNext
{
// .next is a TypeFunction
extern (D) this(TypeFunction t)
{
super(Tfunction, t);
ty = Tdelegate;
}
static TypeDelegate create(TypeFunction t)
{
return new TypeDelegate(t);
}
override const(char)* kind() const
{
return "delegate";
}
override TypeDelegate syntaxCopy()
{
auto tf = next.syntaxCopy().isTypeFunction();
if (tf == next)
return this;
auto result = new TypeDelegate(tf);
result.mod = mod;
return result;
}
override Type addStorageClass(StorageClass stc)
{
TypeDelegate t = cast(TypeDelegate)Type.addStorageClass(stc);
return t;
}
override uinteger_t size(const ref Loc loc)
{
return target.ptrsize * 2;
}
override uint alignsize()
{
return target.ptrsize;
}
override MATCH implicitConvTo(Type to)
{
//printf("TypeDelegate.implicitConvTo(this=%p, to=%p)\n", this, to);
//printf("from: %s\n", toChars());
//printf("to : %s\n", to.toChars());
if (this.equals(to))
return MATCH.exact;
if (auto toDg = to.isTypeDelegate())
{
MATCH m = this.next.isTypeFunction().implicitPointerConv(toDg.next);
// Retain the old behaviour for this refactoring
// Should probably be changed to constant to match function pointers
if (m > MATCH.convert)
m = MATCH.convert;
return m;
}
return MATCH.nomatch;
}
override bool isZeroInit(const ref Loc loc)
{
return true;
}
override bool isBoolean()
{
return true;
}
override bool hasPointers()
{
return true;
}
override void accept(Visitor v)
{
v.visit(this);
}
}
/**
* This is a shell containing a TraitsExp that can be
* either resolved to a type or to a symbol.
*
* The point is to allow AliasDeclarationY to use `__traits()`, see https://issues.dlang.org/show_bug.cgi?id=7804.
*/
extern (C++) final class TypeTraits : Type
{
Loc loc;
/// The expression to resolve as type or symbol.
TraitsExp exp;
/// Cached type/symbol after semantic analysis.
RootObject obj;
final extern (D) this(const ref Loc loc, TraitsExp exp)
{
super(Ttraits);
this.loc = loc;
this.exp = exp;
}
override const(char)* kind() const
{
return "traits";
}
override TypeTraits syntaxCopy()
{
TraitsExp te = exp.syntaxCopy();
TypeTraits tt = new TypeTraits(loc, te);
tt.mod = mod;
return tt;
}
override Dsymbol toDsymbol(Scope* sc)
{
Type t;
Expression e;
Dsymbol s;
resolve(this, loc, sc, e, t, s);
if (t && t.ty != Terror)
s = t.toDsymbol(sc);
else if (e)
s = getDsymbol(e);
return s;
}
override void accept(Visitor v)
{
v.visit(this);
}
override uinteger_t size(const ref Loc loc)
{
return SIZE_INVALID;
}
}
/******
* Implements mixin types.
*
* Semantic analysis will convert it to a real type.
*/
extern (C++) final class TypeMixin : Type
{
Loc loc;
Expressions* exps;
RootObject obj; // cached result of semantic analysis.
extern (D) this(const ref Loc loc, Expressions* exps)
{
super(Tmixin);
this.loc = loc;
this.exps = exps;
}
override const(char)* kind() const
{
return "mixin";
}
override TypeMixin syntaxCopy()
{
return new TypeMixin(loc, Expression.arraySyntaxCopy(exps));
}
override Dsymbol toDsymbol(Scope* sc)
{
Type t;
Expression e;
Dsymbol s;
resolve(this, loc, sc, e, t, s);
if (t)
s = t.toDsymbol(sc);
else if (e)
s = getDsymbol(e);
return s;
}
override void accept(Visitor v)
{
v.visit(this);
}
}
/***********************************************************
*/
extern (C++) abstract class TypeQualified : Type
{
Loc loc;
// array of Identifier and TypeInstance,
// representing ident.ident!tiargs.ident. ... etc.
Objects idents;
final extern (D) this(TY ty, Loc loc)
{
super(ty);
this.loc = loc;
}
// abstract override so that using `TypeQualified.syntaxCopy` gets
// us a `TypeQualified`
abstract override TypeQualified syntaxCopy();
final void syntaxCopyHelper(TypeQualified t)
{
//printf("TypeQualified::syntaxCopyHelper(%s) %s\n", t.toChars(), toChars());
idents.setDim(t.idents.length);
for (size_t i = 0; i < idents.length; i++)
{
RootObject id = t.idents[i];
with (DYNCAST) final switch (id.dyncast())
{
case object:
break;
case expression:
Expression e = cast(Expression)id;
e = e.syntaxCopy();
id = e;
break;
case dsymbol:
TemplateInstance ti = cast(TemplateInstance)id;
ti = ti.syntaxCopy(null);
id = ti;
break;
case type:
Type tx = cast(Type)id;
tx = tx.syntaxCopy();
id = tx;
break;
case identifier:
case tuple:
case parameter:
case statement:
case condition:
case templateparameter:
case initializer:
}
idents[i] = id;
}
}
final void addIdent(Identifier ident)
{
idents.push(ident);
}
final void addInst(TemplateInstance inst)
{
idents.push(inst);
}
final void addIndex(RootObject e)
{
idents.push(e);
}
override uinteger_t size(const ref Loc loc)
{
error(this.loc, "size of type `%s` is not known", toChars());
return SIZE_INVALID;
}
override void accept(Visitor v)
{
v.visit(this);
}
}
/***********************************************************
*/
extern (C++) final class TypeIdentifier : TypeQualified
{
Identifier ident;
// The symbol representing this identifier, before alias resolution
Dsymbol originalSymbol;
extern (D) this(const ref Loc loc, Identifier ident)
{
super(Tident, loc);
this.ident = ident;
}
static TypeIdentifier create(const ref Loc loc, Identifier ident)
{
return new TypeIdentifier(loc, ident);
}
override const(char)* kind() const
{
return "identifier";
}
override TypeIdentifier syntaxCopy()
{
auto t = new TypeIdentifier(loc, ident);
t.syntaxCopyHelper(this);
t.mod = mod;
return t;
}
/*****************************************
* See if type resolves to a symbol, if so,
* return that symbol.
*/
override Dsymbol toDsymbol(Scope* sc)
{
//printf("TypeIdentifier::toDsymbol('%s')\n", toChars());
if (!sc)
return null;
Type t;
Expression e;
Dsymbol s;
resolve(this, loc, sc, e, t, s);
if (t && t.ty != Tident)
s = t.toDsymbol(sc);
if (e)
s = getDsymbol(e);
return s;
}
override void accept(Visitor v)
{
v.visit(this);
}
}
/***********************************************************
* Similar to TypeIdentifier, but with a TemplateInstance as the root
*/
extern (C++) final class TypeInstance : TypeQualified
{
TemplateInstance tempinst;
extern (D) this(const ref Loc loc, TemplateInstance tempinst)
{
super(Tinstance, loc);
this.tempinst = tempinst;
}
override const(char)* kind() const
{
return "instance";
}
override TypeInstance syntaxCopy()
{
//printf("TypeInstance::syntaxCopy() %s, %d\n", toChars(), idents.length);
auto t = new TypeInstance(loc, tempinst.syntaxCopy(null));
t.syntaxCopyHelper(this);
t.mod = mod;
return t;
}
override Dsymbol toDsymbol(Scope* sc)
{
Type t;
Expression e;
Dsymbol s;
//printf("TypeInstance::semantic(%s)\n", toChars());
resolve(this, loc, sc, e, t, s);
if (t && t.ty != Tinstance)
s = t.toDsymbol(sc);
return s;
}
override void accept(Visitor v)
{
v.visit(this);
}
}
/***********************************************************
*/
extern (C++) final class TypeTypeof : TypeQualified
{
Expression exp;
int inuse;
extern (D) this(const ref Loc loc, Expression exp)
{
super(Ttypeof, loc);
this.exp = exp;
}
override const(char)* kind() const
{
return "typeof";
}
override TypeTypeof syntaxCopy()
{
//printf("TypeTypeof::syntaxCopy() %s\n", toChars());
auto t = new TypeTypeof(loc, exp.syntaxCopy());
t.syntaxCopyHelper(this);
t.mod = mod;
return t;
}
override Dsymbol toDsymbol(Scope* sc)
{
//printf("TypeTypeof::toDsymbol('%s')\n", toChars());
Expression e;
Type t;
Dsymbol s;
resolve(this, loc, sc, e, t, s);
return s;
}
override uinteger_t size(const ref Loc loc)
{
if (exp.type)
return exp.type.size(loc);
else
return TypeQualified.size(loc);
}
override void accept(Visitor v)
{
v.visit(this);
}
}
/***********************************************************
*/
extern (C++) final class TypeReturn : TypeQualified
{
extern (D) this(const ref Loc loc)
{
super(Treturn, loc);
}
override const(char)* kind() const
{
return "return";
}
override TypeReturn syntaxCopy()
{
auto t = new TypeReturn(loc);
t.syntaxCopyHelper(this);
t.mod = mod;
return t;
}
override Dsymbol toDsymbol(Scope* sc)
{
Expression e;
Type t;
Dsymbol s;
resolve(this, loc, sc, e, t, s);
return s;
}
override void accept(Visitor v)
{
v.visit(this);
}
}
/***********************************************************
*/
extern (C++) final class TypeStruct : Type
{
StructDeclaration sym;
AliasThisRec att = AliasThisRec.fwdref;
bool inuse = false; // struct currently subject of recursive method call
extern (D) this(StructDeclaration sym)
{
super(Tstruct);
this.sym = sym;
}
static TypeStruct create(StructDeclaration sym)
{
return new TypeStruct(sym);
}
override const(char)* kind() const
{
return "struct";
}
override uinteger_t size(const ref Loc loc)
{
return sym.size(loc);
}
override uint alignsize()
{
sym.size(Loc.initial); // give error for forward references
return sym.alignsize;
}
override TypeStruct syntaxCopy()
{
return this;
}
override Dsymbol toDsymbol(Scope* sc)
{
return sym;
}
override structalign_t alignment()
{
if (sym.alignment.isUnknown())
sym.size(sym.loc);
return sym.alignment;
}
/***************************************
* Use when we prefer the default initializer to be a literal,
* rather than a global immutable variable.
*/
override Expression defaultInitLiteral(const ref Loc loc)
{
static if (LOGDEFAULTINIT)
{
printf("TypeStruct::defaultInitLiteral() '%s'\n", toChars());
}
sym.size(loc);
if (sym.sizeok != Sizeok.done)
return ErrorExp.get();
auto structelems = new Expressions(sym.nonHiddenFields());
uint offset = 0;
foreach (j; 0 .. structelems.length)
{
VarDeclaration vd = sym.fields[j];
Expression e;
if (vd.inuse)
{
error(loc, "circular reference to `%s`", vd.toPrettyChars());
return ErrorExp.get();
}
if (vd.offset < offset || vd.type.size() == 0)
e = null;
else if (vd._init)
{
if (vd._init.isVoidInitializer())
e = null;
else
e = vd.getConstInitializer(false);
}
else
e = vd.type.defaultInitLiteral(loc);
if (e && e.op == EXP.error)
return e;
if (e)
offset = vd.offset + cast(uint)vd.type.size();
(*structelems)[j] = e;
}
auto structinit = new StructLiteralExp(loc, sym, structelems);
/* Copy from the initializer symbol for larger symbols,
* otherwise the literals expressed as code get excessively large.
*/
if (size(loc) > target.ptrsize * 4 && !needsNested())
structinit.useStaticInit = true;
structinit.type = this;
return structinit;
}
override bool isZeroInit(const ref Loc loc)
{
// Determine zeroInit here, as this can be called before semantic2
sym.determineSize(sym.loc);
return sym.zeroInit;
}
override bool isAssignable()
{
bool assignable = true;
uint offset = ~0; // dead-store initialize to prevent spurious warning
sym.determineSize(sym.loc);
/* If any of the fields are const or immutable,
* then one cannot assign this struct.
*/
for (size_t i = 0; i < sym.fields.length; i++)
{
VarDeclaration v = sym.fields[i];
//printf("%s [%d] v = (%s) %s, v.offset = %d, v.parent = %s\n", sym.toChars(), i, v.kind(), v.toChars(), v.offset, v.parent.kind());
if (i == 0)
{
}
else if (v.offset == offset)
{
/* If any fields of anonymous union are assignable,
* then regard union as assignable.
* This is to support unsafe things like Rebindable templates.
*/
if (assignable)
continue;
}
else
{
if (!assignable)
return false;
}
assignable = v.type.isMutable() && v.type.isAssignable();
offset = v.offset;
//printf(" -> assignable = %d\n", assignable);
}
return assignable;
}
override bool isBoolean()
{
return false;
}
override bool needsDestruction()
{
return sym.dtor !is null;
}
override bool needsCopyOrPostblit()
{
return sym.hasCopyCtor || sym.postblit;
}
override bool needsNested()
{
if (inuse) return false; // circular type, error instead of crashing
inuse = true;
scope(exit) inuse = false;
if (sym.isNested())
return true;
for (size_t i = 0; i < sym.fields.length; i++)
{
VarDeclaration v = sym.fields[i];
if (!v.isDataseg() && v.type.needsNested())
return true;
}
return false;
}
override bool hasPointers()
{
if (sym.members && !sym.determineFields() && sym.type != Type.terror)
error(sym.loc, "no size because of forward references");
sym.determineTypeProperties();
return sym.hasPointerField;
}
override bool hasVoidInitPointers()
{
sym.size(Loc.initial); // give error for forward references
sym.determineTypeProperties();
return sym.hasVoidInitPointers;
}
override bool hasSystemFields()
{
sym.size(Loc.initial); // give error for forward references
sym.determineTypeProperties();
return sym.hasSystemFields;
}
override bool hasInvariant()
{
sym.size(Loc.initial); // give error for forward references
sym.determineTypeProperties();
return sym.hasInvariant() || sym.hasFieldWithInvariant;
}
extern (D) MATCH implicitConvToWithoutAliasThis(Type to)
{
MATCH m;
if (ty == to.ty && sym == (cast(TypeStruct)to).sym)
{
m = MATCH.exact; // exact match
if (mod != to.mod)
{
m = MATCH.constant;
if (MODimplicitConv(mod, to.mod))
{
}
else
{
/* Check all the fields. If they can all be converted,
* allow the conversion.
*/
uint offset = ~0; // dead-store to prevent spurious warning
for (size_t i = 0; i < sym.fields.length; i++)
{
VarDeclaration v = sym.fields[i];
if (i == 0)
{
}
else if (v.offset == offset)
{
if (m > MATCH.nomatch)
continue;
}
else
{
if (m == MATCH.nomatch)
return m;
}
// 'from' type
Type tvf = v.type.addMod(mod);
// 'to' type
Type tv = v.type.addMod(to.mod);
// field match
MATCH mf = tvf.implicitConvTo(tv);
//printf("\t%s => %s, match = %d\n", v.type.toChars(), tv.toChars(), mf);
if (mf == MATCH.nomatch)
return mf;
if (mf < m) // if field match is worse
m = mf;
offset = v.offset;
}
}
}
}
return m;
}
extern (D) MATCH implicitConvToThroughAliasThis(Type to)
{
MATCH m;
if (!(ty == to.ty && sym == (cast(TypeStruct)to).sym) && sym.aliasthis && !(att & AliasThisRec.tracing))
{
if (auto ato = aliasthisOf())
{
att = cast(AliasThisRec)(att | AliasThisRec.tracing);
m = ato.implicitConvTo(to);
att = cast(AliasThisRec)(att & ~AliasThisRec.tracing);
}
else
m = MATCH.nomatch; // no match
}
return m;
}
override MATCH implicitConvTo(Type to)
{
//printf("TypeStruct::implicitConvTo(%s => %s)\n", toChars(), to.toChars());
MATCH m = implicitConvToWithoutAliasThis(to);
return m ? m : implicitConvToThroughAliasThis(to);
}
override MATCH constConv(Type to)
{
if (equals(to))
return MATCH.exact;
if (ty == to.ty && sym == (cast(TypeStruct)to).sym && MODimplicitConv(mod, to.mod))
return MATCH.constant;
return MATCH.nomatch;
}
override MOD deduceWild(Type t, bool isRef)
{
if (ty == t.ty && sym == (cast(TypeStruct)t).sym)
return Type.deduceWild(t, isRef);
ubyte wm = 0;
if (t.hasWild() && sym.aliasthis && !(att & AliasThisRec.tracing))
{
if (auto ato = aliasthisOf())
{
att = cast(AliasThisRec)(att | AliasThisRec.tracing);
wm = ato.deduceWild(t, isRef);
att = cast(AliasThisRec)(att & ~AliasThisRec.tracing);
}
}
return wm;
}
override inout(Type) toHeadMutable() inout
{
return this;
}
override void accept(Visitor v)
{
v.visit(this);
}
}
/***********************************************************
*/
extern (C++) final class TypeEnum : Type
{
EnumDeclaration sym;
extern (D) this(EnumDeclaration sym)
{
super(Tenum);
this.sym = sym;
}
override const(char)* kind() const
{
return "enum";
}
override TypeEnum syntaxCopy()
{
return this;
}
override uinteger_t size(const ref Loc loc)
{
return sym.getMemtype(loc).size(loc);
}
Type memType(const ref Loc loc = Loc.initial)
{
return sym.getMemtype(loc);
}
override uint alignsize()
{
Type t = memType();
if (t.ty == Terror)
return 4;
return t.alignsize();
}
override Dsymbol toDsymbol(Scope* sc)
{
return sym;
}
override bool isintegral()
{
return memType().isintegral();
}
override bool isfloating()
{
return memType().isfloating();
}
override bool isreal()
{
return memType().isreal();
}
override bool isimaginary()
{
return memType().isimaginary();
}
override bool iscomplex()
{
return memType().iscomplex();
}
override bool isscalar()
{
return memType().isscalar();
}
override bool isunsigned()
{
return memType().isunsigned();
}
override bool isBoolean()
{
return memType().isBoolean();
}
override bool isString()
{
return memType().isString();
}
override bool isAssignable()
{
return memType().isAssignable();
}
override bool needsDestruction()
{
return memType().needsDestruction();
}
override bool needsCopyOrPostblit()
{
return memType().needsCopyOrPostblit();
}
override bool needsNested()
{
return memType().needsNested();
}
override MATCH implicitConvTo(Type to)
{
MATCH m;
//printf("TypeEnum::implicitConvTo() %s to %s\n", toChars(), to.toChars());
if (ty == to.ty && sym == (cast(TypeEnum)to).sym)
m = (mod == to.mod) ? MATCH.exact : MATCH.constant;
else if (sym.getMemtype(Loc.initial).implicitConvTo(to))
m = MATCH.convert; // match with conversions
else
m = MATCH.nomatch; // no match
return m;
}
override MATCH constConv(Type to)
{
if (equals(to))
return MATCH.exact;
if (ty == to.ty && sym == (cast(TypeEnum)to).sym && MODimplicitConv(mod, to.mod))
return MATCH.constant;
return MATCH.nomatch;
}
extern (D) Type toBasetype2()
{
if (!sym.members && !sym.memtype)
return this;
auto tb = sym.getMemtype(Loc.initial).toBasetype();
return tb.castMod(mod); // retain modifier bits from 'this'
}
override bool isZeroInit(const ref Loc loc)
{
return sym.getDefaultValue(loc).toBool().hasValue(false);
}
override bool hasPointers()
{
return memType().hasPointers();
}
override bool hasVoidInitPointers()
{
return memType().hasVoidInitPointers();
}
override bool hasSystemFields()
{
return memType().hasSystemFields();
}
override bool hasInvariant()
{
return memType().hasInvariant();
}
override Type nextOf()
{
return memType().nextOf();
}
override void accept(Visitor v)
{
v.visit(this);
}
}
/***********************************************************
*/
extern (C++) final class TypeClass : Type
{
ClassDeclaration sym;
AliasThisRec att = AliasThisRec.fwdref;
CPPMANGLE cppmangle = CPPMANGLE.def;
extern (D) this(ClassDeclaration sym)
{
super(Tclass);
this.sym = sym;
}
override const(char)* kind() const
{
return "class";
}
override uinteger_t size(const ref Loc loc)
{
return target.ptrsize;
}
override TypeClass syntaxCopy()
{
return this;
}
override Dsymbol toDsymbol(Scope* sc)
{
return sym;
}
override inout(ClassDeclaration) isClassHandle() inout
{
return sym;
}
override bool isBaseOf(Type t, int* poffset)
{
if (t && t.ty == Tclass)
{
ClassDeclaration cd = (cast(TypeClass)t).sym;
if (cd.semanticRun < PASS.semanticdone && !cd.isBaseInfoComplete())
cd.dsymbolSemantic(null);
if (sym.semanticRun < PASS.semanticdone && !sym.isBaseInfoComplete())
sym.dsymbolSemantic(null);
if (sym.isBaseOf(cd, poffset))
return true;
}
return false;
}
extern (D) MATCH implicitConvToWithoutAliasThis(Type to)
{
// Run semantic before checking whether class is convertible
ClassDeclaration cdto = to.isClassHandle();
if (cdto)
{
//printf("TypeClass::implicitConvTo(to = '%s') %s, isbase = %d %d\n", to.toChars(), toChars(), cdto.isBaseInfoComplete(), sym.isBaseInfoComplete());
if (cdto.semanticRun < PASS.semanticdone && !cdto.isBaseInfoComplete())
cdto.dsymbolSemantic(null);
if (sym.semanticRun < PASS.semanticdone && !sym.isBaseInfoComplete())
sym.dsymbolSemantic(null);
}
MATCH m = constConv(to);
if (m > MATCH.nomatch)
return m;
if (cdto && cdto.isBaseOf(sym, null) && MODimplicitConv(mod, to.mod))
{
//printf("'to' is base\n");
return MATCH.convert;
}
return MATCH.nomatch;
}
extern (D) MATCH implicitConvToThroughAliasThis(Type to)
{
MATCH m;
if (sym.aliasthis && !(att & AliasThisRec.tracing))
{
if (auto ato = aliasthisOf())
{
att = cast(AliasThisRec)(att | AliasThisRec.tracing);
m = ato.implicitConvTo(to);
att = cast(AliasThisRec)(att & ~AliasThisRec.tracing);
}
}
return m;
}
override MATCH implicitConvTo(Type to)
{
//printf("TypeClass::implicitConvTo(to = '%s') %s\n", to.toChars(), toChars());
MATCH m = implicitConvToWithoutAliasThis(to);
return m ? m : implicitConvToThroughAliasThis(to);
}
override MATCH constConv(Type to)
{
if (equals(to))
return MATCH.exact;
if (ty == to.ty && sym == (cast(TypeClass)to).sym && MODimplicitConv(mod, to.mod))
return MATCH.constant;
/* Conversion derived to const(base)
*/
int offset = 0;
if (to.isBaseOf(this, &offset) && offset == 0 && MODimplicitConv(mod, to.mod))
{
// Disallow:
// derived to base
// inout(derived) to inout(base)
if (!to.isMutable() && !to.isWild())
return MATCH.convert;
}
return MATCH.nomatch;
}
override MOD deduceWild(Type t, bool isRef)
{
ClassDeclaration cd = t.isClassHandle();
if (cd && (sym == cd || cd.isBaseOf(sym, null)))
return Type.deduceWild(t, isRef);
ubyte wm = 0;
if (t.hasWild() && sym.aliasthis && !(att & AliasThisRec.tracing))
{
if (auto ato = aliasthisOf())
{
att = cast(AliasThisRec)(att | AliasThisRec.tracing);
wm = ato.deduceWild(t, isRef);
att = cast(AliasThisRec)(att & ~AliasThisRec.tracing);
}
}
return wm;
}
override inout(Type) toHeadMutable() inout
{
return this;
}
override bool isZeroInit(const ref Loc loc)
{
return true;
}
override bool isscope()
{
return sym.stack;
}
override bool isBoolean()
{
return true;
}
override bool hasPointers()
{
return true;
}
override void accept(Visitor v)
{
v.visit(this);
}
}
/***********************************************************
*/
extern (C++) final class TypeTuple : Type
{
// 'logically immutable' cached global - don't modify!
__gshared TypeTuple empty = new TypeTuple();
Parameters* arguments; // types making up the tuple
extern (D) this(Parameters* arguments)
{
super(Ttuple);
//printf("TypeTuple(this = %p)\n", this);
this.arguments = arguments;
//printf("TypeTuple() %p, %s\n", this, toChars());
debug
{
if (arguments)
{
for (size_t i = 0; i < arguments.length; i++)
{
Parameter arg = (*arguments)[i];
assert(arg && arg.type);
}
}
}
}
/****************
* Form TypeTuple from the types of the expressions.
* Assume exps[] is already tuple expanded.
*/
extern (D) this(Expressions* exps)
{
super(Ttuple);
auto arguments = new Parameters(exps ? exps.length : 0);
if (exps)
{
for (size_t i = 0; i < exps.length; i++)
{
Expression e = (*exps)[i];
if (e.type.ty == Ttuple)
e.error("cannot form tuple of tuples");
auto arg = new Parameter(STC.undefined_, e.type, null, null, null);
(*arguments)[i] = arg;
}
}
this.arguments = arguments;
//printf("TypeTuple() %p, %s\n", this, toChars());
}
static TypeTuple create(Parameters* arguments)
{
return new TypeTuple(arguments);
}
/*******************************************
* Type tuple with 0, 1 or 2 types in it.
*/
extern (D) this()
{
super(Ttuple);
arguments = new Parameters();
}
extern (D) this(Type t1)
{
super(Ttuple);
arguments = new Parameters();
arguments.push(new Parameter(0, t1, null, null, null));
}
extern (D) this(Type t1, Type t2)
{
super(Ttuple);
arguments = new Parameters();
arguments.push(new Parameter(0, t1, null, null, null));
arguments.push(new Parameter(0, t2, null, null, null));
}
static TypeTuple create()
{
return new TypeTuple();
}
static TypeTuple create(Type t1)
{
return new TypeTuple(t1);
}
static TypeTuple create(Type t1, Type t2)
{
return new TypeTuple(t1, t2);
}
override const(char)* kind() const
{
return "tuple";
}
override TypeTuple syntaxCopy()
{
Parameters* args = Parameter.arraySyntaxCopy(arguments);
auto t = new TypeTuple(args);
t.mod = mod;
return t;
}
override bool equals(const RootObject o) const
{
Type t = cast(Type)o;
//printf("TypeTuple::equals(%s, %s)\n", toChars(), t.toChars());
if (this == t)
return true;
if (auto tt = t.isTypeTuple())
{
if (arguments.length == tt.arguments.length)
{
for (size_t i = 0; i < tt.arguments.length; i++)
{
const Parameter arg1 = (*arguments)[i];
Parameter arg2 = (*tt.arguments)[i];
if (!arg1.type.equals(arg2.type))
return false;
}
return true;
}
}
return false;
}
override MATCH implicitConvTo(Type to)
{
if (this == to)
return MATCH.exact;
if (auto tt = to.isTypeTuple())
{
if (arguments.length == tt.arguments.length)
{
MATCH m = MATCH.exact;
for (size_t i = 0; i < tt.arguments.length; i++)
{
Parameter arg1 = (*arguments)[i];
Parameter arg2 = (*tt.arguments)[i];
MATCH mi = arg1.type.implicitConvTo(arg2.type);
if (mi < m)
m = mi;
}
return m;
}
}
return MATCH.nomatch;
}
override void accept(Visitor v)
{
v.visit(this);
}
}
/***********************************************************
* This is so we can slice a TypeTuple
*/
extern (C++) final class TypeSlice : TypeNext
{
Expression lwr;
Expression upr;
extern (D) this(Type next, Expression lwr, Expression upr)
{
super(Tslice, next);
//printf("TypeSlice[%s .. %s]\n", lwr.toChars(), upr.toChars());
this.lwr = lwr;
this.upr = upr;
}
override const(char)* kind() const
{
return "slice";
}
override TypeSlice syntaxCopy()
{
auto t = new TypeSlice(next.syntaxCopy(), lwr.syntaxCopy(), upr.syntaxCopy());
t.mod = mod;
return t;
}
override void accept(Visitor v)
{
v.visit(this);
}
}
/***********************************************************
*/
extern (C++) final class TypeNull : Type
{
extern (D) this()
{
//printf("TypeNull %p\n", this);
super(Tnull);
}
override const(char)* kind() const
{
return "null";
}
override TypeNull syntaxCopy()
{
// No semantic analysis done, no need to copy
return this;
}
override MATCH implicitConvTo(Type to)
{
//printf("TypeNull::implicitConvTo(this=%p, to=%p)\n", this, to);
//printf("from: %s\n", toChars());
//printf("to : %s\n", to.toChars());
MATCH m = Type.implicitConvTo(to);
if (m != MATCH.nomatch)
return m;
// NULL implicitly converts to any pointer type or dynamic array
//if (type.ty == Tpointer && type.nextOf().ty == Tvoid)
{
Type tb = to.toBasetype();
if (tb.ty == Tnull || tb.ty == Tpointer || tb.ty == Tarray || tb.ty == Taarray || tb.ty == Tclass || tb.ty == Tdelegate)
return MATCH.constant;
}
return MATCH.nomatch;
}
override bool hasPointers()
{
/* Although null isn't dereferencable, treat it as a pointer type for
* attribute inference, generic code, etc.
*/
return true;
}
override bool isBoolean()
{
return true;
}
override uinteger_t size(const ref Loc loc)
{
return tvoidptr.size(loc);
}
override void accept(Visitor v)
{
v.visit(this);
}
}
/***********************************************************
*/
extern (C++) final class TypeNoreturn : Type
{
extern (D) this()
{
//printf("TypeNoreturn %p\n", this);
super(Tnoreturn);
}
override const(char)* kind() const
{
return "noreturn";
}
override TypeNoreturn syntaxCopy()
{
// No semantic analysis done, no need to copy
return this;
}
override MATCH implicitConvTo(Type to)
{
//printf("TypeNoreturn::implicitConvTo(this=%p, to=%p)\n", this, to);
//printf("from: %s\n", toChars());
//printf("to : %s\n", to.toChars());
if (this.equals(to))
return MATCH.exact;
// Different qualifiers?
if (to.ty == Tnoreturn)
return MATCH.constant;
// Implicitly convertible to any type
return MATCH.convert;
}
override MATCH constConv(Type to)
{
// Either another noreturn or conversion to any type
return this.implicitConvTo(to);
}
override bool isBoolean()
{
return true; // bottom type can be implicitly converted to any other type
}
override uinteger_t size(const ref Loc loc)
{
return 0;
}
override uint alignsize()
{
return 0;
}
override void accept(Visitor v)
{
v.visit(this);
}
}
/***********************************************************
* Unlike D, C can declare/define struct/union/enum tag names
* inside Declarators, instead of separately as in D.
* The order these appear in the symbol table must be in lexical
* order. There isn't enough info at the parsing stage to determine if
* it's a declaration or a reference to an existing name, so this Type
* collects the necessary info and defers it to semantic().
*/
extern (C++) final class TypeTag : Type
{
Loc loc; /// location of declaration
TOK tok; /// TOK.struct_, TOK.union_, TOK.enum_
structalign_t packalign; /// alignment of struct/union fields
Identifier id; /// tag name identifier
Type base; /// base type for enums otherwise null
Dsymbols* members; /// members of struct, null if none
Type resolved; /// type after semantic() in case there are more others
/// pointing to this instance, which can happen with
/// struct S { int a; } s1, *s2;
MOD mod; /// modifiers to apply after type is resolved (only MODFlags.const_ at the moment)
extern (D) this(const ref Loc loc, TOK tok, Identifier id, structalign_t packalign, Type base, Dsymbols* members)
{
//printf("TypeTag ctor %s %p\n", id ? id.toChars() : "null".ptr, this);
super(Ttag);
this.loc = loc;
this.tok = tok;
this.id = id;
this.packalign = packalign;
this.base = base;
this.members = members;
this.mod = 0;
}
override const(char)* kind() const
{
return "tag";
}
override TypeTag syntaxCopy()
{
//printf("TypeTag syntaxCopy()\n");
// No semantic analysis done, no need to copy
return this;
}
override void accept(Visitor v)
{
v.visit(this);
}
}
/***********************************************************
* Represents a function's formal parameters + variadics info.
* Length, indexing and iteration are based on a depth-first tuple expansion.
* https://dlang.org/spec/function.html#ParameterList
*/
extern (C++) struct ParameterList
{
/// The raw (unexpanded) formal parameters, possibly containing tuples.
Parameters* parameters;
StorageClass stc; // storage class of ...
VarArg varargs = VarArg.none;
bool hasIdentifierList; // true if C identifier-list style
this(Parameters* parameters, VarArg varargs = VarArg.none, StorageClass stc = 0)
{
this.parameters = parameters;
this.varargs = varargs;
this.stc = stc;
}
/// Returns the number of expanded parameters. Complexity: O(N).
size_t length()
{
return Parameter.dim(parameters);
}
/// Returns the expanded parameter at the given index, or null if out of
/// bounds. Complexity: O(i).
Parameter opIndex(size_t i)
{
return Parameter.getNth(parameters, i);
}
/// Iterates over the expanded parameters. Complexity: O(N).
/// Prefer this to avoid the O(N + N^2/2) complexity of calculating length
/// and calling N times opIndex.
extern (D) int opApply(scope Parameter.ForeachDg dg)
{
return Parameter._foreach(parameters, dg);
}
/// Iterates over the expanded parameters, matching them with the unexpanded
/// ones, for semantic processing
extern (D) int opApply(scope Parameter.SemanticForeachDg dg)
{
return Parameter._foreach(this.parameters, dg);
}
extern (D) ParameterList syntaxCopy()
{
return ParameterList(Parameter.arraySyntaxCopy(parameters), varargs);
}
/// Compares this to another ParameterList (and expands tuples if necessary)
extern (D) bool opEquals(scope ref ParameterList other) const
{
if (stc != other.stc || varargs != other.varargs || (!parameters != !other.parameters))
return false;
if (this.parameters is other.parameters)
return true;
size_t idx;
bool diff;
// Pairwise compare each parameter
// Can this avoid the O(n) indexing for the second list?
foreach (_, p1; cast() this)
{
auto p2 = other[idx++];
if (!p2 || p1 != p2) {
diff = true;
break;
}
}
// Ensure no remaining parameters in `other`
return !diff && other[idx] is null;
}
/// Returns: `true` if any parameter has a default argument
extern(D) bool hasDefaultArgs()
{
foreach (oidx, oparam, eidx, eparam; this)
{
if (eparam.defaultArg)
return true;
}
return false;
}
// Returns: `true` if any parameter doesn't have a default argument
extern(D) bool hasArgsWithoutDefault()
{
foreach (oidx, oparam, eidx, eparam; this)
{
if (!eparam.defaultArg)
return true;
}
return false;
}
}
/***********************************************************
*/
extern (C++) final class Parameter : ASTNode
{
import dmd.attrib : UserAttributeDeclaration;
StorageClass storageClass;
Type type;
Identifier ident;
Expression defaultArg;
UserAttributeDeclaration userAttribDecl; // user defined attributes
extern (D) this(StorageClass storageClass, Type type, Identifier ident, Expression defaultArg, UserAttributeDeclaration userAttribDecl)
{
this.type = type;
this.ident = ident;
this.storageClass = storageClass;
this.defaultArg = defaultArg;
this.userAttribDecl = userAttribDecl;
}
static Parameter create(StorageClass storageClass, Type type, Identifier ident, Expression defaultArg, UserAttributeDeclaration userAttribDecl)
{
return new Parameter(storageClass, type, ident, defaultArg, userAttribDecl);
}
Parameter syntaxCopy()
{
return new Parameter(storageClass, type ? type.syntaxCopy() : null, ident, defaultArg ? defaultArg.syntaxCopy() : null, userAttribDecl ? userAttribDecl.syntaxCopy(null) : null);
}
/****************************************************
* Determine if parameter is a lazy array of delegates.
* If so, return the return type of those delegates.
* If not, return NULL.
*
* Returns T if the type is one of the following forms:
* T delegate()[]
* T delegate()[dim]
*/
Type isLazyArray()
{
Type tb = type.toBasetype();
if (tb.ty == Tsarray || tb.ty == Tarray)
{
Type tel = (cast(TypeArray)tb).next.toBasetype();
if (auto td = tel.isTypeDelegate())
{
TypeFunction tf = td.next.toTypeFunction();
if (tf.parameterList.varargs == VarArg.none && tf.parameterList.length == 0)
{
return tf.next; // return type of delegate
}
}
}
return null;
}
/// Returns: Whether the function parameter is lazy
bool isLazy() const @safe pure nothrow @nogc
{
return (this.storageClass & (STC.lazy_)) != 0;
}
/// Returns: Whether the function parameter is a reference (out / ref)
bool isReference() const @safe pure nothrow @nogc
{
return (this.storageClass & (STC.ref_ | STC.out_)) != 0;
}
// kludge for template.isType()
override DYNCAST dyncast() const
{
return DYNCAST.parameter;
}
override void accept(Visitor v)
{
v.visit(this);
}
extern (D) static Parameters* arraySyntaxCopy(Parameters* parameters)
{
Parameters* params = null;
if (parameters)
{
params = new Parameters(parameters.length);
for (size_t i = 0; i < params.length; i++)
(*params)[i] = (*parameters)[i].syntaxCopy();
}
return params;
}
/***************************************
* Determine number of arguments, folding in tuples.
*/
static size_t dim(Parameters* parameters)
{
size_t nargs = 0;
int dimDg(size_t n, Parameter p)
{
++nargs;
return 0;
}
_foreach(parameters, &dimDg);
return nargs;
}
/**
* Get nth `Parameter`, folding in tuples.
*
* Since `parameters` can include tuples, which would increase its
* length, this function allows to get the `nth` parameter as if
* all tuples transitively contained in `parameters` were flattened.
*
* Params:
* parameters = Array of `Parameter` to iterate over
* nth = Index of the desired parameter.
*
* Returns:
* The parameter at index `nth` (taking tuples into account),
* or `null` if out of bound.
*/
static Parameter getNth(Parameters* parameters, size_t nth)
{
Parameter param;
int getNthParamDg(size_t n, Parameter p)
{
if (n == nth)
{
param = p;
return 1;
}
return 0;
}
int res = _foreach(parameters, &getNthParamDg);
return res ? param : null;
}
/// Type of delegate when iterating solely on the parameters
alias ForeachDg = extern (D) int delegate(size_t paramidx, Parameter param);
/// Type of delegate when iterating on both the original set of parameters,
/// and the type tuple. Useful for semantic analysis.
/// 'o' stands for 'original' and 'e' stands for 'expanded'.
alias SemanticForeachDg = extern (D) int delegate(
size_t oidx, Parameter oparam, size_t eidx, Parameter eparam);
/***************************************
* Expands tuples in args in depth first order. Calls
* dg(void *ctx, size_t argidx, Parameter *arg) for each Parameter.
* If dg returns !=0, stops and returns that value else returns 0.
* Use this function to avoid the O(N + N^2/2) complexity of
* calculating dim and calling N times getNth.
*/
extern (D) static int _foreach(Parameters* parameters, scope ForeachDg dg)
{
assert(dg !is null);
return _foreach(parameters, (_oidx, _oparam, idx, param) => dg(idx, param));
}
/// Ditto
extern (D) static int _foreach(
Parameters* parameters, scope SemanticForeachDg dg)
{
assert(dg !is null);
if (parameters is null)
return 0;
size_t eidx;
foreach (oidx; 0 .. parameters.length)
{
Parameter oparam = (*parameters)[oidx];
if (auto r = _foreachImpl(dg, oidx, oparam, eidx, /* eparam */ oparam))
return r;
}
return 0;
}
/// Implementation of the iteration process, which recurses in itself
/// and just forwards `oidx` and `oparam`.
extern (D) private static int _foreachImpl(scope SemanticForeachDg dg,
size_t oidx, Parameter oparam, ref size_t eidx, Parameter eparam)
{
if (eparam is null)
return 0;
Type t = eparam.type.toBasetype();
if (auto tu = t.isTypeTuple())
{
// Check for empty tuples
if (tu.arguments is null)
return 0;
foreach (nidx; 0 .. tu.arguments.length)
{
Parameter nextep = (*tu.arguments)[nidx];
if (auto r = _foreachImpl(dg, oidx, oparam, eidx, nextep))
return r;
}
}
else
{
if (auto r = dg(oidx, oparam, eidx, eparam))
return r;
// The only place where we should increment eidx is here,
// as a TypeTuple doesn't count as a parameter (for arity)
// it it is empty.
eidx++;
}
return 0;
}
override const(char)* toChars() const
{
return ident ? ident.toChars() : "__anonymous_param";
}
/*********************************
* Compute covariance of parameters `this` and `p`
* as determined by the storage classes of both.
*
* Params:
* returnByRef = true if the function returns by ref
* p = Parameter to compare with
* previewIn = Whether `-preview=in` is being used, and thus if
* `in` means `scope [ref]`.
*
* Returns:
* true = `this` can be used in place of `p`
* false = nope
*/
bool isCovariant(bool returnByRef, const Parameter p, bool previewIn = global.params.previewIn)
const pure nothrow @nogc @safe
{
ulong thisSTC = this.storageClass;
ulong otherSTC = p.storageClass;
if (previewIn)
{
if (thisSTC & STC.in_)
thisSTC |= STC.scope_;
if (otherSTC & STC.in_)
otherSTC |= STC.scope_;
}
const mask = STC.ref_ | STC.out_ | STC.lazy_ | (previewIn ? STC.in_ : 0);
if ((thisSTC & mask) != (otherSTC & mask))
return false;
return isCovariantScope(returnByRef, thisSTC, otherSTC);
}
extern (D) private static bool isCovariantScope(bool returnByRef, StorageClass from, StorageClass to) pure nothrow @nogc @safe
{
// Workaround for failing covariance when finding a common type of delegates,
// some of which have parameters with inferred scope
// https://issues.dlang.org/show_bug.cgi?id=21285
// The root cause is that scopeinferred is not part of the mangle, and mangle
// is used for type equality checks
if (to & STC.returninferred)
to &= ~STC.return_;
// note: f(return int* x) currently 'infers' scope without inferring `return`, in that case keep STC.scope
if (to & STC.scopeinferred && !(to & STC.return_))
to &= ~STC.scope_;
if (from == to)
return true;
/* result is true if the 'from' can be used as a 'to'
*/
if ((from ^ to) & STC.ref_) // differing in 'ref' means no covariance
return false;
/* workaround until we get STC.returnScope reliably set correctly
*/
if (returnByRef)
{
from &= ~STC.returnScope;
to &= ~STC.returnScope;
}
else
{
from |= STC.returnScope;
to |= STC.returnScope;
}
return covariant[buildScopeRef(from)][buildScopeRef(to)];
}
extern (D) private static bool[ScopeRef.max + 1][ScopeRef.max + 1] covariantInit() pure nothrow @nogc @safe
{
/* Initialize covariant[][] with this:
From\To n rs s
None X
ReturnScope X X
Scope X X X
From\To r rr rs rr-s r-rs
Ref X X
ReturnRef X
RefScope X X X X X
ReturnRef-Scope X X
Ref-ReturnScope X X X
*/
bool[ScopeRef.max + 1][ScopeRef.max + 1] covariant;
foreach (i; 0 .. ScopeRef.max + 1)
{
covariant[i][i] = true;
covariant[ScopeRef.RefScope][i] = true;
}
covariant[ScopeRef.ReturnScope][ScopeRef.None] = true;
covariant[ScopeRef.Scope ][ScopeRef.None] = true;
covariant[ScopeRef.Scope ][ScopeRef.ReturnScope] = true;
covariant[ScopeRef.Ref ][ScopeRef.ReturnRef] = true;
covariant[ScopeRef.ReturnRef_Scope][ScopeRef.ReturnRef] = true;
covariant[ScopeRef.Ref_ReturnScope][ScopeRef.Ref ] = true;
covariant[ScopeRef.Ref_ReturnScope][ScopeRef.ReturnRef] = true;
return covariant;
}
extern (D) private static immutable bool[ScopeRef.max + 1][ScopeRef.max + 1] covariant = covariantInit();
extern (D) bool opEquals(const Parameter other) const
{
return this.storageClass == other.storageClass
&& this.type == other.type;
}
}
/*************************************************************
* For printing two types with qualification when necessary.
* Params:
* t1 = The first type to receive the type name for
* t2 = The second type to receive the type name for
* Returns:
* The fully-qualified names of both types if the two type names are not the same,
* or the unqualified names of both types if the two type names are the same.
*/
const(char*)[2] toAutoQualChars(Type t1, Type t2)
{
auto s1 = t1.toChars();
auto s2 = t2.toChars();
// show qualification only if it's different
if (!t1.equals(t2) && strcmp(s1, s2) == 0)
{
s1 = t1.toPrettyChars(true);
s2 = t2.toPrettyChars(true);
}
return [s1, s2];
}
/**
* For each active modifier (MODFlags.const_, MODFlags.immutable_, etc) call `fp` with a
* void* for the work param and a string representation of the attribute.
*/
void modifiersApply(const TypeFunction tf, void delegate(string) dg)
{
immutable ubyte[4] modsArr = [MODFlags.const_, MODFlags.immutable_, MODFlags.wild, MODFlags.shared_];
foreach (modsarr; modsArr)
{
if (tf.mod & modsarr)
{
dg(MODtoString(modsarr));
}
}
}
/**
* For each active attribute (ref/const/nogc/etc) call `fp` with a void* for the
* work param and a string representation of the attribute.
*/
void attributesApply(const TypeFunction tf, void delegate(string) dg, TRUSTformat trustFormat = TRUSTformatDefault)
{
if (tf.purity)
dg("pure");
if (tf.isnothrow)
dg("nothrow");
if (tf.isnogc)
dg("@nogc");
if (tf.isproperty)
dg("@property");
if (tf.isref)
dg("ref");
if (tf.isreturn && !tf.isreturninferred)
dg("return");
if (tf.isScopeQual && !tf.isscopeinferred)
dg("scope");
if (tf.islive)
dg("@live");
TRUST trustAttrib = tf.trust;
if (trustAttrib == TRUST.default_)
{
if (trustFormat != TRUSTformatSystem)
return;
trustAttrib = TRUST.system; // avoid calling with an empty string
}
dg(trustToString(trustAttrib));
}
/**
* If the type is a class or struct, returns the symbol for it,
* else null.
*/
extern (C++) AggregateDeclaration isAggregate(Type t)
{
t = t.toBasetype();
if (t.ty == Tclass)
return (cast(TypeClass)t).sym;
if (t.ty == Tstruct)
return (cast(TypeStruct)t).sym;
return null;
}
/***************************************************
* Determine if type t can be indexed or sliced given that it is not an
* aggregate with operator overloads.
* Params:
* t = type to check
* Returns:
* true if an expression of type t can be e1 in an array expression
*/
bool isIndexableNonAggregate(Type t)
{
t = t.toBasetype();
return (t.ty == Tpointer || t.ty == Tsarray || t.ty == Tarray || t.ty == Taarray ||
t.ty == Ttuple || t.ty == Tvector);
}
/***************************************************
* Determine if type t is copyable.
* Params:
* t = type to check
* Returns:
* true if we can copy it
*/
bool isCopyable(Type t)
{
//printf("isCopyable() %s\n", t.toChars());
if (auto ts = t.isTypeStruct())
{
if (ts.sym.postblit &&
ts.sym.postblit.storage_class & STC.disable)
return false;
if (ts.sym.hasCopyCtor)
{
// check if there is a matching overload of the copy constructor and whether it is disabled or not
// `assert(ctor)` fails on Win32 and Win_32_64. See: https://auto-tester.puremagic.com/pull-history.ghtml?projectid=1&repoid=1&pullid=10575
Dsymbol ctor = search_function(ts.sym, Id.ctor);
assert(ctor);
scope el = new IdentifierExp(Loc.initial, Id.p); // dummy lvalue
el.type = cast() ts;
Expressions* args = new Expressions();
args.push(el);
FuncDeclaration f = resolveFuncCall(Loc.initial, null, ctor, null, cast()ts, ArgumentList(args), FuncResolveFlag.quiet);
if (!f || f.storage_class & STC.disable)
return false;
}
}
return true;
}
/***************************************
* Computes how a parameter may be returned.
* Shrinking the representation is necessary because StorageClass is so wide
* Params:
* stc = storage class of parameter
* Returns:
* value from enum ScopeRef
*/
ScopeRef buildScopeRef(StorageClass stc) pure nothrow @nogc @safe
{
if (stc & STC.out_)
stc |= STC.ref_; // treat `out` and `ref` the same
ScopeRef result;
final switch (stc & (STC.ref_ | STC.scope_ | STC.return_))
{
case 0: result = ScopeRef.None; break;
/* can occur in case test/compilable/testsctreturn.d
* related to https://issues.dlang.org/show_bug.cgi?id=20149
* where inout adds `return` without `scope` or `ref`
*/
case STC.return_: result = ScopeRef.Return; break;
case STC.ref_: result = ScopeRef.Ref; break;
case STC.scope_: result = ScopeRef.Scope; break;
case STC.return_ | STC.ref_: result = ScopeRef.ReturnRef; break;
case STC.return_ | STC.scope_: result = ScopeRef.ReturnScope; break;
case STC.ref_ | STC.scope_: result = ScopeRef.RefScope; break;
case STC.return_ | STC.ref_ | STC.scope_:
result = stc & STC.returnScope ? ScopeRef.Ref_ReturnScope
: ScopeRef.ReturnRef_Scope;
break;
}
return result;
}
/**
* Classification of 'scope-return-ref' possibilities
*/
enum ScopeRef
{
None,
Scope,
ReturnScope,
Ref,
ReturnRef,
RefScope,
ReturnRef_Scope,
Ref_ReturnScope,
Return,
}
/*********************************
* Give us a nice string for debugging purposes.
* Params:
* sr = value
* Returns:
* corresponding string
*/
const(char)* toChars(ScopeRef sr) pure nothrow @nogc @safe
{
with (ScopeRef)
{
static immutable char*[ScopeRef.max + 1] names =
[
None: "None",
Scope: "Scope",
ReturnScope: "ReturnScope",
Ref: "Ref",
ReturnRef: "ReturnRef",
RefScope: "RefScope",
ReturnRef_Scope: "ReturnRef_Scope",
Ref_ReturnScope: "Ref_ReturnScope",
Return: "Return",
];
return names[sr];
}
}
/**
* Used by `callMatch` to check if the copy constructor may be called to
* copy the argument
*
* This is done by seeing if a call to the copy constructor can be made:
* ```
* typeof(tprm) __copytmp;
* copytmp.__copyCtor(arg);
* ```
*/
private extern(D) bool isCopyConstructorCallable (StructDeclaration argStruct,
Expression arg, Type tprm, Scope* sc, const(char)** pMessage)
{
auto tmp = new VarDeclaration(arg.loc, tprm, Identifier.generateId("__copytmp"), null);
tmp.storage_class = STC.rvalue | STC.temp | STC.ctfe;
tmp.dsymbolSemantic(sc);
Expression ve = new VarExp(arg.loc, tmp);
Expression e = new DotIdExp(arg.loc, ve, Id.ctor);
e = new CallExp(arg.loc, e, arg);
//printf("e = %s\n", e.toChars());
if (.trySemantic(e, sc))
return true;
if (pMessage)
{
/* https://issues.dlang.org/show_bug.cgi?id=22202
*
* If a function was deduced by semantic on the CallExp,
* it means that resolveFuncCall completed succesfully.
* Therefore, there exists a callable copy constructor,
* however, it cannot be called because scope constraints
* such as purity, safety or nogc.
*/
OutBuffer buf;
auto callExp = e.isCallExp();
if (auto f = callExp.f)
{
char[] s;
if (!f.isPure && sc.func.setImpure())
s ~= "pure ";
if (!f.isSafe() && !f.isTrusted() && sc.setUnsafe())
s ~= "@safe ";
if (!f.isNogc && sc.func.setGC(arg.loc, null))
s ~= "nogc ";
if (s)
{
s[$-1] = '\0';
buf.printf("`%s` copy constructor cannot be called from a `%s` context", f.type.toChars(), s.ptr);
}
else if (f.isGenerated() && f.isDisabled())
{
/* https://issues.dlang.org/show_bug.cgi?id=23097
* Compiler generated copy constructor failed.
*/
buf.printf("generating a copy constructor for `struct %s` failed, therefore instances of it are uncopyable",
argStruct.toChars());
}
else
{
/* Although a copy constructor may exist, no suitable match was found.
* i.e: `inout` constructor creates `const` object, not mutable.
* Fallback to using the original generic error before https://issues.dlang.org/show_bug.cgi?id=22202.
*/
goto Lnocpctor;
}
}
else
{
Lnocpctor:
buf.printf("`struct %s` does not define a copy constructor for `%s` to `%s` copies",
argStruct.toChars(), arg.type.toChars(), tprm.toChars());
}
*pMessage = buf.extractChars();
}
return false;
}
/**
* Match a single parameter to an argument.
*
* This function is called by `TypeFunction.callMatch` while iterating over
* the list of parameter. Here we check if `arg` is a match for `p`,
* which is mostly about checking if `arg.type` converts to `p`'s type
* and some check about value reference.
*
* Params:
* tf = The `TypeFunction`, only used for error reporting
* p = The parameter of `tf` being matched
* arg = Argument being passed (bound) to `p`
* wildmatch = Wild (`inout`) matching level, derived from the full argument list
* flag = A non-zero value means we're doing a partial ordering check
* (no value semantic check)
* sc = Scope we are in
* pMessage = A buffer to write the error in, or `null`
*
* Returns: Whether `trailingArgs` match `p`.
*/
private extern(D) MATCH argumentMatchParameter (TypeFunction tf, Parameter p,
Expression arg, ubyte wildmatch, int flag, Scope* sc, const(char)** pMessage)
{
//printf("arg: %s, type: %s\n", arg.toChars(), arg.type.toChars());
MATCH m;
Type targ = arg.type;
Type tprm = wildmatch ? p.type.substWildTo(wildmatch) : p.type;
if (p.isLazy() && tprm.ty == Tvoid && targ.ty != Tvoid)
m = MATCH.convert;
else if (flag)
{
// for partial ordering, value is an irrelevant mockup, just look at the type
m = targ.implicitConvTo(tprm);
}
else
{
const isRef = p.isReference();
StructDeclaration argStruct, prmStruct;
// first look for a copy constructor
if (arg.isLvalue() && !isRef && targ.ty == Tstruct && tprm.ty == Tstruct)
{
// if the argument and the parameter are of the same unqualified struct type
argStruct = (cast(TypeStruct)targ).sym;
prmStruct = (cast(TypeStruct)tprm).sym;
}
// check if the copy constructor may be called to copy the argument
if (argStruct && argStruct == prmStruct && argStruct.hasCopyCtor)
{
if (!isCopyConstructorCallable(argStruct, arg, tprm, sc, pMessage))
return MATCH.nomatch;
m = MATCH.exact;
}
else
{
import dmd.dcast : cimplicitConvTo;
m = (sc && sc.flags & SCOPE.Cfile) ? arg.cimplicitConvTo(tprm) : arg.implicitConvTo(tprm);
}
}
// Non-lvalues do not match ref or out parameters
if (p.isReference())
{
// https://issues.dlang.org/show_bug.cgi?id=13783
// Don't use toBasetype() to handle enum types.
Type ta = targ;
Type tp = tprm;
//printf("fparam[%d] ta = %s, tp = %s\n", u, ta.toChars(), tp.toChars());
if (m && !arg.isLvalue())
{
if (p.storageClass & STC.out_)
{
if (pMessage) *pMessage = tf.getParamError(arg, p);
return MATCH.nomatch;
}
if (arg.op == EXP.string_ && tp.ty == Tsarray)
{
if (ta.ty != Tsarray)
{
Type tn = tp.nextOf().castMod(ta.nextOf().mod);
dinteger_t dim = (cast(StringExp)arg).len;
ta = tn.sarrayOf(dim);
}
}
else if (arg.op == EXP.slice && tp.ty == Tsarray)
{
// Allow conversion from T[lwr .. upr] to ref T[upr-lwr]
if (ta.ty != Tsarray)
{
Type tn = ta.nextOf();
dinteger_t dim = (cast(TypeSArray)tp).dim.toUInteger();
ta = tn.sarrayOf(dim);
}
}
else if ((p.storageClass & STC.in_) && global.params.previewIn)
{
// Allow converting a literal to an `in` which is `ref`
if (arg.op == EXP.arrayLiteral && tp.ty == Tsarray)
{
Type tn = tp.nextOf();
dinteger_t dim = (cast(TypeSArray)tp).dim.toUInteger();
ta = tn.sarrayOf(dim);
}
// Need to make this a rvalue through a temporary
m = MATCH.convert;
}
else if (global.params.rvalueRefParam != FeatureState.enabled ||
p.storageClass & STC.out_ ||
!arg.type.isCopyable()) // can't copy to temp for ref parameter
{
if (pMessage) *pMessage = tf.getParamError(arg, p);
return MATCH.nomatch;
}
else
{
/* in functionParameters() we'll convert this
* rvalue into a temporary
*/
m = MATCH.convert;
}
}
/* If the match is not already perfect or if the arg
is not a lvalue then try the `alias this` chain
see https://issues.dlang.org/show_bug.cgi?id=15674
and https://issues.dlang.org/show_bug.cgi?id=21905
*/
if (ta != tp || !arg.isLvalue())
{
Type firsttab = ta.toBasetype();
while (1)
{
Type tab = ta.toBasetype();
Type tat = tab.aliasthisOf();
if (!tat || !tat.implicitConvTo(tprm))
break;
if (tat == tab || tat == firsttab)
break;
ta = tat;
}
}
/* A ref variable should work like a head-const reference.
* e.g. disallows:
* ref T <- an lvalue of const(T) argument
* ref T[dim] <- an lvalue of const(T[dim]) argument
*/
if (!ta.constConv(tp))
{
if (pMessage) *pMessage = tf.getParamError(arg, p);
return MATCH.nomatch;
}
}
return m;
}
/**
* Match the remaining arguments `trailingArgs` with parameter `p`.
*
* Assume we already checked that `p` is the last parameter of `tf`,
* and we want to know whether the arguments would match `p`.
*
* Params:
* tf = The `TypeFunction`, only used for error reporting
* p = The last parameter of `tf` which is variadic
* trailingArgs = The remaining arguments that should match `p`
* pMessage = A buffer to write the error in, or `null`
*
* Returns: Whether `trailingArgs` match `p`.
*/
private extern(D) MATCH matchTypeSafeVarArgs(TypeFunction tf, Parameter p,
Expression[] trailingArgs, const(char)** pMessage)
{
Type tb = p.type.toBasetype();
switch (tb.ty)
{
case Tsarray:
TypeSArray tsa = cast(TypeSArray)tb;
dinteger_t sz = tsa.dim.toInteger();
if (sz != trailingArgs.length)
{
if (pMessage)
*pMessage = tf.getMatchError("expected %llu variadic argument(s), not %zu",
sz, trailingArgs.length);
return MATCH.nomatch;
}
goto case Tarray;
case Tarray:
{
MATCH match = MATCH.exact;
TypeArray ta = cast(TypeArray)tb;
foreach (arg; trailingArgs)
{
MATCH m;
assert(arg);
/* If lazy array of delegates,
* convert arg(s) to delegate(s)
*/
Type tret = p.isLazyArray();
if (tret)
{
if (ta.next.equals(arg.type))
m = MATCH.exact;
else if (tret.toBasetype().ty == Tvoid)
m = MATCH.convert;
else
{
m = arg.implicitConvTo(tret);
if (m == MATCH.nomatch)
m = arg.implicitConvTo(ta.next);
}
}
else
m = arg.implicitConvTo(ta.next);
if (m == MATCH.nomatch)
{
if (pMessage) *pMessage = tf.getParamError(arg, p);
return MATCH.nomatch;
}
if (m < match)
match = m;
}
return match;
}
case Tclass:
// We leave it up to the actual constructor call to do the matching.
return MATCH.exact;
default:
// We can have things as `foo(int[int] wat...)` but they only match
// with an associative array proper.
if (pMessage && trailingArgs.length) *pMessage = tf.getParamError(trailingArgs[0], p);
return MATCH.nomatch;
}
}
/**
* Creates an appropriate vector type for `tv` that will hold one boolean
* result for each element of the vector type. The result of vector comparisons
* is a single or doubleword mask of all 1s (comparison true) or all 0s
* (comparison false). This SIMD mask type does not have an equivalent D type,
* however its closest equivalent would be an integer vector of the same unit
* size and length.
*
* Params:
* tv = The `TypeVector` to build a vector from.
* Returns:
* A vector type suitable for the result of a vector comparison operation.
*/
TypeVector toBooleanVector(TypeVector tv)
{
Type telem = tv.elementType();
switch (telem.ty)
{
case Tvoid:
case Tint8:
case Tuns8:
case Tint16:
case Tuns16:
case Tint32:
case Tuns32:
case Tint64:
case Tuns64:
// No need to build an equivalent mask type.
return tv;
case Tfloat32:
telem = Type.tuns32;
break;
case Tfloat64:
telem = Type.tuns64;
break;
default:
assert(0);
}
TypeSArray tsa = tv.basetype.isTypeSArray();
assert(tsa !is null);
return new TypeVector(new TypeSArray(telem, tsa.dim));
}
/*************************************************
* Dispatch to function based on static type of Type.
*/
mixin template VisitType(Result)
{
Result VisitType(Type t)
{
final switch (t.ty)
{
case TY.Tvoid:
case TY.Tint8:
case TY.Tuns8:
case TY.Tint16:
case TY.Tuns16:
case TY.Tint32:
case TY.Tuns32:
case TY.Tint64:
case TY.Tuns64:
case TY.Tfloat32:
case TY.Tfloat64:
case TY.Tfloat80:
case TY.Timaginary32:
case TY.Timaginary64:
case TY.Timaginary80:
case TY.Tcomplex32:
case TY.Tcomplex64:
case TY.Tcomplex80:
case TY.Tbool:
case TY.Tchar:
case TY.Twchar:
case TY.Tdchar:
case TY.Tint128:
case TY.Tuns128: mixin(visitTYCase("Basic"));
case TY.Tarray: mixin(visitTYCase("DArray"));
case TY.Tsarray: mixin(visitTYCase("SArray"));
case TY.Taarray: mixin(visitTYCase("AArray"));
case TY.Tpointer: mixin(visitTYCase("Pointer"));
case TY.Treference: mixin(visitTYCase("Reference"));
case TY.Tfunction: mixin(visitTYCase("Function"));
case TY.Tident: mixin(visitTYCase("Identifier"));
case TY.Tclass: mixin(visitTYCase("Class"));
case TY.Tstruct: mixin(visitTYCase("Struct"));
case TY.Tenum: mixin(visitTYCase("Enum"));
case TY.Tdelegate: mixin(visitTYCase("Delegate"));
case TY.Terror: mixin(visitTYCase("Error"));
case TY.Tinstance: mixin(visitTYCase("Instance"));
case TY.Ttypeof: mixin(visitTYCase("Typeof"));
case TY.Ttuple: mixin(visitTYCase("Tuple"));
case TY.Tslice: mixin(visitTYCase("Slice"));
case TY.Treturn: mixin(visitTYCase("Return"));
case TY.Tnull: mixin(visitTYCase("Null"));
case TY.Tvector: mixin(visitTYCase("Vector"));
case TY.Ttraits: mixin(visitTYCase("Traits"));
case TY.Tmixin: mixin(visitTYCase("Mixin"));
case TY.Tnoreturn: mixin(visitTYCase("Noreturn"));
case TY.Ttag: mixin(visitTYCase("Tag"));
case TY.Tnone: assert(0);
}
}
}
/****************************************
* CTFE-only helper function for VisitInitializer.
* Params:
* handler = string for the name of the visit handler
* Returns: boilerplate code for a case
*/
pure string visitTYCase(string handler)
{
if (__ctfe)
{
return
"
enum isVoid = is(Result == void);
auto tx = t.isType"~handler~"();
static if (__traits(compiles, visit"~handler~"(tx)))
{
static if (isVoid)
{
visit"~handler~"(tx);
return;
}
else
{
if (Result r = visit"~handler~"(tx))
return r;
return Result.init;
}
}
else static if (__traits(compiles, visitDefaultCase(t)))
{
static if (isVoid)
{
visitDefaultCase(tx);
return;
}
else
{
if (Result r = visitDefaultCase(t))
return r;
return Result.init;
}
}
else
static assert(0, "~handler~");
";
}
assert(0);
}
| D |
module minima.tile;
enum TileName
{
empty,
dirt,
bricks,
}
struct TileData
{
bool isSolid;
}
private TileData[TileName] _tileDataMapping;
static this()
{
_tileDataMapping = [
TileName.empty: TileData(false),
TileName.dirt: TileData(true),
TileName.bricks: TileData(true),
];
}
TileData getData(TileName tileName)
{
return _tileDataMapping[tileName];
}
| D |
void main() {
auto getPos = (int a) { return a >= 0; };
import std.stdio;
int[] arr =[1, 2, -20, 3, -50, -34, 4, 6, 7];
writeln("Prevous arr: ", arr);
writeln(filt!int(getPos, arr));
}
auto filt(T)(bool function(T) dg, T[] arr ) {
import std.range;
T[] arr2;
for(; ! arr.empty; arr.popFront) {
if (dg(arr[0]))
arr2 ~= arr.front;
}
return arr2;
}
| D |
///Syscall definitions and direct calls that bypass our libc intercepts
module photon.linux.syscalls;
version(linux):
import core.sys.posix.sys.types;
import core.sys.posix.netinet.in_;
import core.sys.posix.poll;
import core.sys.linux.epoll;
import core.sys.linux.timerfd;
import photon.linux.support;
version (X86) {
enum int SYS_READ = 0x3, SYS_SOCKETPAIR = 0x168; //TODO test on x86
int syscall(int ident, int n, int arg1, int arg2)
{
int ret;
asm nothrow
{
mov EAX, ident;
mov EBX, n[EBP];
mov ECX, arg1[EBP];
mov EDX, arg2[EBP];
int 0x80;
mov ret, EAX;
}
return ret;
}
int syscall(int ident, int n, int arg1, int arg2, int arg3)
{
int ret;
asm nothrow
{
mov EAX, ident;
mov EBX, n[EBP];
mov ECX, arg1[EBP];
mov EDX, arg2[EBP];
mov ESI, arg3[EBP];
int 0x80;
mov ret, EAX;
}
return ret;
}
int syscall(int ident, int n, int arg1, int arg2, int arg3, int arg4)
{
int ret;
asm nothrow
{
mov EAX, ident;
mov EBX, n[EBP];
mov ECX, arg1[EBP];
mov EDX, arg2[EBP];
mov ESI, arg3[EBP];
mov EDI, arg4[EBP];
int 0x80;
mov ret, EAX;
}
return ret;
}
} else version (X86_64) {
enum int
SYS_READ = 0x0,
SYS_WRITE = 0x1,
SYS_CLOSE = 3,
SYS_POLL = 7,
SYS_GETTID = 186,
SYS_SOCKETPAIR = 0x35,
SYS_ACCEPT = 0x2b,
SYS_ACCEPT4 = 0x120,
SYS_CONNECT = 0x2a,
SYS_SENDTO = 0x2c,
SYS_RECVFROM = 45;
size_t syscall(size_t ident) nothrow
{
size_t ret;
asm nothrow
{
mov RAX, ident;
syscall;
mov ret, RAX;
}
return ret;
}
size_t syscall(size_t ident, size_t n) nothrow
{
size_t ret;
asm nothrow
{
mov RAX, ident;
mov RDI, n;
syscall;
mov ret, RAX;
}
return ret;
}
size_t syscall(size_t ident, size_t n, size_t arg1, size_t arg2) nothrow
{
size_t ret;
asm nothrow
{
mov RAX, ident;
mov RDI, n;
mov RSI, arg1;
mov RDX, arg2;
syscall;
mov ret, RAX;
}
return ret;
}
size_t syscall(size_t ident, size_t n, size_t arg1, size_t arg2, size_t arg3) nothrow
{
size_t ret;
asm nothrow
{
mov RAX, ident;
mov RDI, n;
mov RSI, arg1;
mov RDX, arg2;
mov R10, arg3;
syscall;
mov ret, RAX;
}
return ret;
}
size_t syscall(size_t ident, size_t n, size_t arg1, size_t arg2, size_t arg3, size_t arg4) nothrow
{
size_t ret;
asm nothrow
{
mov RAX, ident;
mov RDI, n;
mov RSI, arg1;
mov RDX, arg2;
mov R10, arg3;
mov R8, arg4;
syscall;
mov ret, RAX;
}
return ret;
}
size_t syscall(size_t ident, size_t n, size_t arg1, size_t arg2, size_t arg3, size_t arg4, size_t arg5) nothrow
{
size_t ret;
asm nothrow
{
mov RAX, ident;
mov RDI, n;
mov RSI, arg1;
mov RDX, arg2;
mov R10, arg3;
mov R8, arg4;
mov R9, arg5;
syscall;
mov ret, RAX;
}
return ret;
}
}
int gettid()
{
return cast(int)syscall(SYS_GETTID);
}
ssize_t raw_read(int fd, void *buf, size_t count) nothrow {
logf("Raw read on FD=%d", fd);
return syscall(SYS_READ, fd, cast(ssize_t) buf, cast(ssize_t) count).withErrorno;
}
ssize_t raw_write(int fd, const void *buf, size_t count) nothrow
{
logf("Raw write on FD=%d", fd);
return syscall(SYS_WRITE, fd, cast(size_t) buf, count).withErrorno;
}
ssize_t raw_poll(pollfd *fds, nfds_t nfds, int timeout)
{
logf("Raw poll");
return syscall(SYS_POLL, cast(size_t)fds, cast(size_t) nfds, timeout).withErrorno;
}
| D |
import std.stdio,std.string;
void main() {
auto hdr = r"#PBS -q regular
#PBS -l mppwidth=96
#PBS -l walltime=10:00:00
#PBS -j oe
#PBS -V
cd $PBS_O_WORKDIR
aprun -n 64 -N 16 -S 8 ../exec/recon_lasdamas_zspace_weighted -configfn ini/recon_ngc_%02d.xml -log_summary
";
foreach(i;0..1) {
auto ff = File(format("ngc.%02d.qsub",i),"w");
ff.writeln(format(hdr,i));
}
}
| D |
// ************
// ZS_Fight_Alrik
// ************
const int Fight_AlrikFreq = 4;
func void ZS_Fight_Alrik ()
{
Perception_Set_Normal();
B_UseHat (self);
B_ResetAll (self);
if (self.aivar[AIV_Schwierigkeitsgrad] < Mod_Schwierigkeit)
|| (self.aivar[AIV_Schwierigkeitsgrad] > Mod_Schwierigkeit)
{
B_SetSchwierigkeit();
};
AI_SetWalkmode (self,NPC_WALK);
if (Npc_GetDistToWP (self,self.wp) > TA_DIST_SELFWP_MAX)
{
AI_GotoWP (self, self.wp);
};
};
func int ZS_Fight_Alrik_Loop ()
{
if (Hlp_GetInstanceID(self) == Hlp_GetInstanceID(Mod_547_NONE_Alrik_NW))
&& (Mod_1051_VLK_Buerger_NW.attribute[ATR_HITPOINTS] > 1)
{
Npc_SetTarget(self, Mod_1051_VLK_Buerger_NW);
B_Attack (self, Mod_1051_VLK_Buerger_NW, AR_None, 0);
}
else if (Hlp_GetInstanceID(self) == Hlp_GetInstanceID(Mod_1051_VLK_Buerger_NW))
&& (Mod_1051_VLK_Buerger_NW.attribute[ATR_HITPOINTS] > 1)
{
Npc_SetTarget(self, Mod_547_NONE_Alrik_NW);
B_Attack (self, Mod_547_NONE_Alrik_NW, AR_None, 0);
};
return LOOP_CONTINUE;
};
func void ZS_Fight_Alrik_End ()
{
};
| D |
/**
* Windows API header module
*
* Translated from MinGW Windows headers
*
* Authors: Stewart Gordon
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
* Source: $(DRUNTIMESRC src/core/sys/windows/_winver.d)
*/
module core.sys.windows.winver;
version (Windows):
@system:
import core.sys.windows.w32api;
import core.sys.windows.winbase;
import core.sys.windows.sdkddkver;
version (ANSI) {} else version = Unicode;
pragma(lib, "version");
private import core.sys.windows.windef;
// FIXME: type weirdness
enum {
VS_FILE_INFO = 16,
VS_VERSION_INFO = 1,
VS_USER_DEFINED = 100
}
enum {
VS_FFI_SIGNATURE = 0xFEEF04BD,
VS_FFI_STRUCVERSION = 0x10000,
VS_FFI_FILEFLAGSMASK = 0x3F
}
enum {
VS_FF_DEBUG = 1,
VS_FF_PRERELEASE = 2,
VS_FF_PATCHED = 4,
VS_FF_PRIVATEBUILD = 8,
VS_FF_INFOINFERRED = 16,
VS_FF_SPECIALBUILD = 32
}
enum {
VOS_UNKNOWN = 0,
VOS_DOS = 0x10000,
VOS_OS216 = 0x20000,
VOS_OS232 = 0x30000,
VOS_NT = 0x40000,
VOS__BASE = 0,
VOS__WINDOWS16 = 1,
VOS__PM16 = 2,
VOS__PM32 = 3,
VOS__WINDOWS32 = 4,
VOS_DOS_WINDOWS16 = 0x10001,
VOS_DOS_WINDOWS32 = 0x10004,
VOS_OS216_PM16 = 0x20002,
VOS_OS232_PM32 = 0x30003,
VOS_NT_WINDOWS32 = 0x40004
}
enum {
VFT_UNKNOWN = 0,
VFT_APP = 1,
VFT_DLL = 2,
VFT_DRV = 3,
VFT_FONT = 4,
VFT_VXD = 5,
VFT_STATIC_LIB = 7
}
enum {
VFT2_UNKNOWN = 0,
VFT2_DRV_PRINTER = 1,
VFT2_DRV_KEYBOARD = 2,
VFT2_DRV_LANGUAGE = 3,
VFT2_DRV_DISPLAY = 4,
VFT2_DRV_MOUSE = 5,
VFT2_DRV_NETWORK = 6,
VFT2_DRV_SYSTEM = 7,
VFT2_DRV_INSTALLABLE = 8,
VFT2_DRV_SOUND = 9,
VFT2_DRV_COMM = 10,
VFT2_DRV_INPUTMETHOD = 11,
VFT2_FONT_RASTER = 1,
VFT2_FONT_VECTOR = 2,
VFT2_FONT_TRUETYPE = 3
}
enum : DWORD {
VFFF_ISSHAREDFILE = 1
}
enum : DWORD {
VFF_CURNEDEST = 1,
VFF_FILEINUSE = 2,
VFF_BUFFTOOSMALL = 4
}
enum : DWORD {
VIFF_FORCEINSTALL = 1,
VIFF_DONTDELETEOLD
}
enum {
VIF_TEMPFILE = 0x00001,
VIF_MISMATCH = 0x00002,
VIF_SRCOLD = 0x00004,
VIF_DIFFLANG = 0x00008,
VIF_DIFFCODEPG = 0x00010,
VIF_DIFFTYPE = 0x00020,
VIF_WRITEPROT = 0x00040,
VIF_FILEINUSE = 0x00080,
VIF_OUTOFSPACE = 0x00100,
VIF_ACCESSVIOLATION = 0x00200,
VIF_SHARINGVIOLATION = 0x00400,
VIF_CANNOTCREATE = 0x00800,
VIF_CANNOTDELETE = 0x01000,
VIF_CANNOTRENAME = 0x02000,
VIF_CANNOTDELETECUR = 0x04000,
VIF_OUTOFMEMORY = 0x08000,
VIF_CANNOTREADSRC = 0x10000,
VIF_CANNOTREADDST = 0x20000,
VIF_BUFFTOOSMALL = 0x40000
}
struct VS_FIXEDFILEINFO {
DWORD dwSignature;
DWORD dwStrucVersion;
DWORD dwFileVersionMS;
DWORD dwFileVersionLS;
DWORD dwProductVersionMS;
DWORD dwProductVersionLS;
DWORD dwFileFlagsMask;
DWORD dwFileFlags;
DWORD dwFileOS;
DWORD dwFileType;
DWORD dwFileSubtype;
DWORD dwFileDateMS;
DWORD dwFileDateLS;
}
extern (Windows) {
DWORD VerFindFileA(DWORD, LPCSTR, LPCSTR, LPCSTR, LPSTR, PUINT, LPSTR,
PUINT);
DWORD VerFindFileW(DWORD, LPCWSTR, LPCWSTR, LPCWSTR, LPWSTR, PUINT, LPWSTR,
PUINT);
DWORD VerInstallFileA(DWORD, LPCSTR, LPCSTR, LPCSTR, LPCSTR, LPCSTR, LPSTR,
PUINT);
DWORD VerInstallFileW(DWORD, LPCWSTR, LPCWSTR, LPCWSTR, LPCWSTR, LPCWSTR,
LPWSTR, PUINT);
DWORD GetFileVersionInfoSizeA(LPCSTR, PDWORD);
DWORD GetFileVersionInfoSizeW(LPCWSTR, PDWORD);
BOOL GetFileVersionInfoA(LPCSTR, DWORD, DWORD, PVOID);
BOOL GetFileVersionInfoW(LPCWSTR, DWORD, DWORD, PVOID);
DWORD VerLanguageNameA(DWORD, LPSTR, DWORD);
DWORD VerLanguageNameW(DWORD, LPWSTR, DWORD);
BOOL VerQueryValueA(LPCVOID, LPCSTR, LPVOID*, PUINT);
BOOL VerQueryValueW(LPCVOID, LPCWSTR, LPVOID*, PUINT);
}
version (Unicode) {
alias VerFindFileW VerFindFile;
alias VerQueryValueW VerQueryValue;
alias VerInstallFileW VerInstallFile;
alias GetFileVersionInfoSizeW GetFileVersionInfoSize;
alias GetFileVersionInfoW GetFileVersionInfo;
alias VerLanguageNameW VerLanguageName;
alias VerQueryValueW VerQueryValue;
} else {
alias VerQueryValueA VerQueryValue;
alias VerFindFileA VerFindFile;
alias VerInstallFileA VerInstallFile;
alias GetFileVersionInfoSizeA GetFileVersionInfoSize;
alias GetFileVersionInfoA GetFileVersionInfo;
alias VerLanguageNameA VerLanguageName;
alias VerQueryValueA VerQueryValue;
}
alias VERSIONHELPERAPI = BOOL;
VERSIONHELPERAPI IsWindowsVersionOrGreater(WORD wMajorVersion, WORD wMinorVersion, WORD wServicePackMajor)
{
OSVERSIONINFOEXW osvi;
const DWORDLONG dwlConditionMask = VerSetConditionMask(
VerSetConditionMask(
VerSetConditionMask(0, VER_MAJORVERSION, VER_GREATER_EQUAL),
VER_MINORVERSION,
VER_GREATER_EQUAL),
VER_SERVICEPACKMAJOR, VER_GREATER_EQUAL
);
osvi.dwMajorVersion = wMajorVersion;
osvi.dwMinorVersion = wMinorVersion;
osvi.wServicePackMajor = wServicePackMajor;
return VerifyVersionInfoW(&osvi, VER_MAJORVERSION | VER_MINORVERSION | VER_SERVICEPACKMAJOR, dwlConditionMask) != FALSE;
}
VERSIONHELPERAPI IsWindowsXPOrGreater()
{
return IsWindowsVersionOrGreater(HIBYTE(_WIN32_WINNT_WINXP), LOBYTE(_WIN32_WINNT_WINXP), 0);
}
VERSIONHELPERAPI IsWindowsXPSP1OrGreater()
{
return IsWindowsVersionOrGreater(HIBYTE(_WIN32_WINNT_WINXP), LOBYTE(_WIN32_WINNT_WINXP), 1);
}
VERSIONHELPERAPI IsWindowsXPSP2OrGreater()
{
return IsWindowsVersionOrGreater(HIBYTE(_WIN32_WINNT_WINXP), LOBYTE(_WIN32_WINNT_WINXP), 2);
}
VERSIONHELPERAPI IsWindowsXPSP3OrGreater()
{
return IsWindowsVersionOrGreater(HIBYTE(_WIN32_WINNT_WINXP), LOBYTE(_WIN32_WINNT_WINXP), 3);
}
VERSIONHELPERAPI IsWindowsVistaOrGreater()
{
return IsWindowsVersionOrGreater(HIBYTE(_WIN32_WINNT_VISTA), LOBYTE(_WIN32_WINNT_VISTA), 0);
}
VERSIONHELPERAPI IsWindowsVistaSP1OrGreater()
{
return IsWindowsVersionOrGreater(HIBYTE(_WIN32_WINNT_VISTA), LOBYTE(_WIN32_WINNT_VISTA), 1);
}
VERSIONHELPERAPI IsWindowsVistaSP2OrGreater()
{
return IsWindowsVersionOrGreater(HIBYTE(_WIN32_WINNT_VISTA), LOBYTE(_WIN32_WINNT_VISTA), 2);
}
VERSIONHELPERAPI IsWindows7OrGreater()
{
return IsWindowsVersionOrGreater(HIBYTE(_WIN32_WINNT_WIN7), LOBYTE(_WIN32_WINNT_WIN7), 0);
}
VERSIONHELPERAPI IsWindows7SP1OrGreater()
{
return IsWindowsVersionOrGreater(HIBYTE(_WIN32_WINNT_WIN7), LOBYTE(_WIN32_WINNT_WIN7), 1);
}
VERSIONHELPERAPI IsWindows8OrGreater()
{
return IsWindowsVersionOrGreater(HIBYTE(_WIN32_WINNT_WIN8), LOBYTE(_WIN32_WINNT_WIN8), 0);
}
VERSIONHELPERAPI IsWindows8Point1OrGreater()
{
return IsWindowsVersionOrGreater(HIBYTE(_WIN32_WINNT_WINBLUE), LOBYTE(_WIN32_WINNT_WINBLUE), 0);
}
VERSIONHELPERAPI IsWindows10OrGreater()
{
return IsWindowsVersionOrGreater(HIBYTE(_WIN32_WINNT_WIN10), LOBYTE(_WIN32_WINNT_WIN10), 0);
}
VERSIONHELPERAPI IsWindowsServer()
{
OSVERSIONINFOEXW osvi = { OSVERSIONINFOEXW.sizeof, 0, 0, 0, 0, [0], 0, 0, 0, VER_NT_WORKSTATION };
const DWORDLONG dwlConditionMask = VerSetConditionMask( 0, VER_PRODUCT_TYPE, VER_EQUAL );
return !VerifyVersionInfoW(&osvi, VER_PRODUCT_TYPE, dwlConditionMask);
}
| D |
instance Mod_7419_OUT_Leonhard_REL (Npc_Default)
{
// ------ NSC ------
name = "Leonhard";
guild = GIL_OUT;
id = 7419;
voice = 9;
flags = 0;
npctype = NPCTYPE_MAIN;
// ------ AIVARS ------
aivar[AIV_ToughGuy] = TRUE;
aivar[AIV_ToughGuyNewsOverride] = TRUE;
aivar[AIV_IGNORE_Murder] = TRUE;
aivar[AIV_IGNORE_Theft] = TRUE;
aivar[AIV_IGNORE_Sheepkiller] = TRUE;
// ------ Attribute ------
B_SetAttributesToChapter (self, 3);
// ------ Kampf-Taktik ------
fight_tactic = FAI_HUMAN_STRONG;
// ------ Equippte Waffen ------
// ------ Inventory ------
// ------ visuals ------
B_SetNpcVisual (self, MALE, "Hum_Head_Bald", Face_N_Weak_Orry, BodyTex_N, ITAR_Vlk_M);
Mdl_SetModelFatness (self,1.8);
Mdl_ApplyOverlayMds (self, "Humans_Arrogance.mds");
// ------ NSC-relevante Talente vergeben ------
B_GiveNpcTalents (self);
// ------ Kampf-Talente ------
B_SetFightSkills (self, 50);
// ------ TA anmelden ------
daily_routine = Rtn_Start_7419;
};
FUNC VOID Rtn_Start_7419()
{
TA_Sit_Campfire (07,45,19,45,"REL_CITY_360");
TA_Sit_Campfire (19,45,07,45,"REL_CITY_360");
};
FUNC VOID Rtn_Endres_7419 ()
{
TA_Stand_Guarding (08,05,22,05,"REL_CITY_002");
TA_Stand_Guarding (22,05,08,05,"REL_CITY_002");
};
FUNC VOID Rtn_Strafe_7419 ()
{
TA_Pick_FP (08,05,16,05,"REL_SURFACE_107");
TA_Stand_Guarding (16,05,18,05,"BRAUERKESSEL");
TA_Stand_Guarding (18,05,08,05,"REL_CITY_002");
}; | D |
module android.java.android.os.RemoteException_d_interface;
import arsd.jni : IJavaObjectImplementation, JavaPackageId, JavaName, IJavaObject, ImportExportImpl, JavaInterfaceMembers;
static import arsd.jni;
import import1 = android.java.java.io.PrintStream_d_interface;
import import4 = android.java.java.lang.Class_d_interface;
import import3 = android.java.java.lang.StackTraceElement_d_interface;
import import2 = android.java.java.io.PrintWriter_d_interface;
import import0 = android.java.java.lang.JavaThrowable_d_interface;
final class RemoteException : IJavaObject {
static immutable string[] _d_canCastTo = [
];
@Import this(arsd.jni.Default);
@Import this(string);
@Import string getMessage();
@Import string getLocalizedMessage();
@Import import0.JavaThrowable getCause();
@Import import0.JavaThrowable initCause(import0.JavaThrowable);
@Import @JavaName("toString") string toString_();
override string toString() { return arsd.jni.javaObjectToString(this); }
@Import void printStackTrace();
@Import void printStackTrace(import1.PrintStream);
@Import void printStackTrace(import2.PrintWriter);
@Import import0.JavaThrowable fillInStackTrace();
@Import import3.StackTraceElement[] getStackTrace();
@Import void setStackTrace(import3.StackTraceElement[]);
@Import void addSuppressed(import0.JavaThrowable);
@Import import0.JavaThrowable[] getSuppressed();
@Import import4.Class getClass();
@Import int hashCode();
@Import bool equals(IJavaObject);
@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/os/RemoteException;";
}
| D |
/Users/michael/Desktop/Buildcoin/ChartTest/build/Pods.build/Debug-iphonesimulator/Charts.build/Objects-normal/x86_64/XAxisRenderer.o : /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Data/Implementations/Standard/ChartData.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Data/Implementations/Standard/CombinedChartData.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Data/Implementations/Standard/PieChartData.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Data/Implementations/Standard/BubbleChartData.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Data/Implementations/Standard/BarLineScatterCandleBubbleChartData.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Data/Implementations/Standard/CandleChartData.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Data/Implementations/Standard/LineChartData.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Data/Implementations/Standard/BarChartData.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Data/Implementations/Standard/RadarChartData.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Data/Implementations/Standard/ScatterChartData.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Jobs/ViewPortJob.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Jobs/AnimatedViewPortJob.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Jobs/MoveViewJob.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Jobs/AnimatedMoveViewJob.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Jobs/ZoomViewJob.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Jobs/AnimatedZoomViewJob.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Components/Legend.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Components/MarkerImage.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Highlight/Range.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Components/ChartLimitLine.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Renderers/ChartDataRendererBase.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Renderers/AxisRendererBase.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Components/AxisBase.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Components/ComponentBase.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Charts/ChartViewBase.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Charts/BarLineChartViewBase.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Charts/PieRadarChartViewBase.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Data/Implementations/Standard/ChartDataEntryBase.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Animation/ChartAnimationEasing.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Utils/Fill.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Utils/Platform.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Components/Description.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Interfaces/ChartDataProvider.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Interfaces/CombinedChartDataProvider.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Interfaces/BubbleChartDataProvider.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Interfaces/BarLineScatterCandleBubbleChartDataProvider.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Interfaces/CandleChartDataProvider.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Interfaces/LineChartDataProvider.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Interfaces/BarChartDataProvider.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Interfaces/ScatterChartDataProvider.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Components/IMarker.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Utils/ViewPortHandler.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Utils/Transformer.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Renderers/Renderer.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Renderers/LegendRenderer.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Renderers/BarLineScatterCandleBubbleRenderer.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Renderers/Scatter/IShapeRenderer.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Renderers/Scatter/XShapeRenderer.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Renderers/Scatter/CircleShapeRenderer.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Renderers/Scatter/TriangleShapeRenderer.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Renderers/Scatter/SquareShapeRenderer.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Renderers/Scatter/ChevronDownShapeRenderer.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Renderers/Scatter/ChevronUpShapeRenderer.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Renderers/Scatter/CrossShapeRenderer.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Renderers/LineScatterCandleRadarRenderer.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Renderers/LineRadarRenderer.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Renderers/XAxisRenderer.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Renderers/YAxisRenderer.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Renderers/CombinedChartRenderer.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Renderers/PieChartRenderer.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Renderers/BubbleChartRenderer.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Renderers/LineChartRenderer.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Renderers/CandleStickChartRenderer.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Renderers/BarChartRenderer.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Renderers/HorizontalBarChartRenderer.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Renderers/RadarChartRenderer.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Renderers/ScatterChartRenderer.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Highlight/IHighlighter.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Highlight/CombinedHighlighter.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Highlight/PieHighlighter.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Highlight/BarHighlighter.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Highlight/HorizontalBarHighlighter.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Highlight/RadarHighlighter.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Highlight/PieRadarHighlighter.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Highlight/ChartHighlighter.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Formatters/IValueFormatter.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Formatters/IAxisValueFormatter.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Formatters/DefaultAxisValueFormatter.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Formatters/IndexAxisValueFormatter.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Formatters/DefaultValueFormatter.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Formatters/IFillFormatter.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Formatters/DefaultFillFormatter.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Animation/Animator.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Filters/DataApproximator.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Utils/ChartColorTemplates.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Components/XAxis.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Components/YAxis.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Utils/ChartUtils.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Data/Implementations/ChartBaseDataSet.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Data/Implementations/Standard/ChartDataSet.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Data/Interfaces/IChartDataSet.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Data/Implementations/Standard/PieChartDataSet.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Data/Interfaces/IPieChartDataSet.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Data/Implementations/Standard/BubbleChartDataSet.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Data/Interfaces/IBubbleChartDataSet.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Data/Implementations/Standard/BarLineScatterCandleBubbleChartDataSet.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Data/Interfaces/IBarLineScatterCandleBubbleChartDataSet.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Data/Implementations/Standard/CandleChartDataSet.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Data/Interfaces/ICandleChartDataSet.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Data/Implementations/Standard/LineChartDataSet.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Data/Interfaces/ILineChartDataSet.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Data/Implementations/Standard/BarChartDataSet.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Data/Interfaces/IBarChartDataSet.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Data/Implementations/Standard/RadarChartDataSet.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Data/Interfaces/IRadarChartDataSet.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Data/Implementations/Standard/LineScatterCandleRadarChartDataSet.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Data/Interfaces/ILineScatterCandleRadarChartDataSet.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Data/Implementations/Standard/LineRadarChartDataSet.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Data/Interfaces/ILineRadarChartDataSet.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Data/Implementations/Standard/ScatterChartDataSet.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Data/Interfaces/IScatterChartDataSet.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Highlight/Highlight.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Utils/TransformerHorizontalBarChart.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Renderers/XAxisRendererHorizontalBarChart.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Renderers/YAxisRendererHorizontalBarChart.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Renderers/XAxisRendererRadarChart.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Renderers/YAxisRendererRadarChart.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Components/MarkerView.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Charts/CombinedChartView.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Charts/PieChartView.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Charts/BubbleChartView.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Charts/LineChartView.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Charts/CandleStickChartView.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Charts/BarChartView.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Charts/HorizontalBarChartView.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Charts/RadarChartView.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Charts/ScatterChartView.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Data/Implementations/Standard/ChartDataEntry.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Data/Implementations/Standard/PieChartDataEntry.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Data/Implementations/Standard/BubbleChartDataEntry.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Data/Implementations/Standard/CandleChartDataEntry.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Data/Implementations/Standard/BarChartDataEntry.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Data/Implementations/Standard/RadarChartDataEntry.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Components/LegendEntry.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/michael/Desktop/Buildcoin/ChartTest/Pods/Target\ Support\ Files/Charts/Charts-umbrella.h /Users/michael/Desktop/Buildcoin/ChartTest/build/Pods.build/Debug-iphonesimulator/Charts.build/unextended-module.modulemap /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.0.sdk/usr/include/objc/ObjectiveC.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.0.sdk/System/Library/Frameworks/OpenGLES.framework/Headers/OpenGLES.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.0.sdk/System/Library/Frameworks/CoreImage.framework/Headers/CoreImage.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.0.sdk/System/Library/Frameworks/QuartzCore.framework/Headers/QuartzCore.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.0.sdk/System/Library/Frameworks/Metal.framework/Headers/Metal.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.0.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.0.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.0.sdk/System/Library/Frameworks/CoreText.framework/Headers/CoreText.apinotes
/Users/michael/Desktop/Buildcoin/ChartTest/build/Pods.build/Debug-iphonesimulator/Charts.build/Objects-normal/x86_64/XAxisRenderer~partial.swiftmodule : /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Data/Implementations/Standard/ChartData.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Data/Implementations/Standard/CombinedChartData.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Data/Implementations/Standard/PieChartData.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Data/Implementations/Standard/BubbleChartData.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Data/Implementations/Standard/BarLineScatterCandleBubbleChartData.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Data/Implementations/Standard/CandleChartData.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Data/Implementations/Standard/LineChartData.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Data/Implementations/Standard/BarChartData.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Data/Implementations/Standard/RadarChartData.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Data/Implementations/Standard/ScatterChartData.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Jobs/ViewPortJob.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Jobs/AnimatedViewPortJob.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Jobs/MoveViewJob.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Jobs/AnimatedMoveViewJob.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Jobs/ZoomViewJob.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Jobs/AnimatedZoomViewJob.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Components/Legend.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Components/MarkerImage.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Highlight/Range.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Components/ChartLimitLine.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Renderers/ChartDataRendererBase.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Renderers/AxisRendererBase.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Components/AxisBase.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Components/ComponentBase.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Charts/ChartViewBase.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Charts/BarLineChartViewBase.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Charts/PieRadarChartViewBase.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Data/Implementations/Standard/ChartDataEntryBase.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Animation/ChartAnimationEasing.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Utils/Fill.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Utils/Platform.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Components/Description.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Interfaces/ChartDataProvider.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Interfaces/CombinedChartDataProvider.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Interfaces/BubbleChartDataProvider.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Interfaces/BarLineScatterCandleBubbleChartDataProvider.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Interfaces/CandleChartDataProvider.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Interfaces/LineChartDataProvider.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Interfaces/BarChartDataProvider.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Interfaces/ScatterChartDataProvider.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Components/IMarker.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Utils/ViewPortHandler.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Utils/Transformer.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Renderers/Renderer.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Renderers/LegendRenderer.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Renderers/BarLineScatterCandleBubbleRenderer.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Renderers/Scatter/IShapeRenderer.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Renderers/Scatter/XShapeRenderer.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Renderers/Scatter/CircleShapeRenderer.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Renderers/Scatter/TriangleShapeRenderer.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Renderers/Scatter/SquareShapeRenderer.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Renderers/Scatter/ChevronDownShapeRenderer.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Renderers/Scatter/ChevronUpShapeRenderer.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Renderers/Scatter/CrossShapeRenderer.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Renderers/LineScatterCandleRadarRenderer.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Renderers/LineRadarRenderer.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Renderers/XAxisRenderer.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Renderers/YAxisRenderer.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Renderers/CombinedChartRenderer.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Renderers/PieChartRenderer.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Renderers/BubbleChartRenderer.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Renderers/LineChartRenderer.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Renderers/CandleStickChartRenderer.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Renderers/BarChartRenderer.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Renderers/HorizontalBarChartRenderer.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Renderers/RadarChartRenderer.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Renderers/ScatterChartRenderer.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Highlight/IHighlighter.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Highlight/CombinedHighlighter.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Highlight/PieHighlighter.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Highlight/BarHighlighter.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Highlight/HorizontalBarHighlighter.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Highlight/RadarHighlighter.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Highlight/PieRadarHighlighter.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Highlight/ChartHighlighter.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Formatters/IValueFormatter.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Formatters/IAxisValueFormatter.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Formatters/DefaultAxisValueFormatter.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Formatters/IndexAxisValueFormatter.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Formatters/DefaultValueFormatter.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Formatters/IFillFormatter.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Formatters/DefaultFillFormatter.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Animation/Animator.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Filters/DataApproximator.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Utils/ChartColorTemplates.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Components/XAxis.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Components/YAxis.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Utils/ChartUtils.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Data/Implementations/ChartBaseDataSet.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Data/Implementations/Standard/ChartDataSet.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Data/Interfaces/IChartDataSet.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Data/Implementations/Standard/PieChartDataSet.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Data/Interfaces/IPieChartDataSet.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Data/Implementations/Standard/BubbleChartDataSet.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Data/Interfaces/IBubbleChartDataSet.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Data/Implementations/Standard/BarLineScatterCandleBubbleChartDataSet.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Data/Interfaces/IBarLineScatterCandleBubbleChartDataSet.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Data/Implementations/Standard/CandleChartDataSet.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Data/Interfaces/ICandleChartDataSet.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Data/Implementations/Standard/LineChartDataSet.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Data/Interfaces/ILineChartDataSet.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Data/Implementations/Standard/BarChartDataSet.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Data/Interfaces/IBarChartDataSet.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Data/Implementations/Standard/RadarChartDataSet.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Data/Interfaces/IRadarChartDataSet.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Data/Implementations/Standard/LineScatterCandleRadarChartDataSet.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Data/Interfaces/ILineScatterCandleRadarChartDataSet.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Data/Implementations/Standard/LineRadarChartDataSet.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Data/Interfaces/ILineRadarChartDataSet.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Data/Implementations/Standard/ScatterChartDataSet.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Data/Interfaces/IScatterChartDataSet.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Highlight/Highlight.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Utils/TransformerHorizontalBarChart.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Renderers/XAxisRendererHorizontalBarChart.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Renderers/YAxisRendererHorizontalBarChart.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Renderers/XAxisRendererRadarChart.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Renderers/YAxisRendererRadarChart.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Components/MarkerView.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Charts/CombinedChartView.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Charts/PieChartView.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Charts/BubbleChartView.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Charts/LineChartView.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Charts/CandleStickChartView.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Charts/BarChartView.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Charts/HorizontalBarChartView.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Charts/RadarChartView.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Charts/ScatterChartView.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Data/Implementations/Standard/ChartDataEntry.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Data/Implementations/Standard/PieChartDataEntry.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Data/Implementations/Standard/BubbleChartDataEntry.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Data/Implementations/Standard/CandleChartDataEntry.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Data/Implementations/Standard/BarChartDataEntry.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Data/Implementations/Standard/RadarChartDataEntry.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Components/LegendEntry.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/michael/Desktop/Buildcoin/ChartTest/Pods/Target\ Support\ Files/Charts/Charts-umbrella.h /Users/michael/Desktop/Buildcoin/ChartTest/build/Pods.build/Debug-iphonesimulator/Charts.build/unextended-module.modulemap /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.0.sdk/usr/include/objc/ObjectiveC.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.0.sdk/System/Library/Frameworks/OpenGLES.framework/Headers/OpenGLES.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.0.sdk/System/Library/Frameworks/CoreImage.framework/Headers/CoreImage.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.0.sdk/System/Library/Frameworks/QuartzCore.framework/Headers/QuartzCore.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.0.sdk/System/Library/Frameworks/Metal.framework/Headers/Metal.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.0.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.0.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.0.sdk/System/Library/Frameworks/CoreText.framework/Headers/CoreText.apinotes
/Users/michael/Desktop/Buildcoin/ChartTest/build/Pods.build/Debug-iphonesimulator/Charts.build/Objects-normal/x86_64/XAxisRenderer~partial.swiftdoc : /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Data/Implementations/Standard/ChartData.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Data/Implementations/Standard/CombinedChartData.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Data/Implementations/Standard/PieChartData.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Data/Implementations/Standard/BubbleChartData.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Data/Implementations/Standard/BarLineScatterCandleBubbleChartData.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Data/Implementations/Standard/CandleChartData.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Data/Implementations/Standard/LineChartData.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Data/Implementations/Standard/BarChartData.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Data/Implementations/Standard/RadarChartData.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Data/Implementations/Standard/ScatterChartData.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Jobs/ViewPortJob.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Jobs/AnimatedViewPortJob.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Jobs/MoveViewJob.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Jobs/AnimatedMoveViewJob.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Jobs/ZoomViewJob.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Jobs/AnimatedZoomViewJob.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Components/Legend.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Components/MarkerImage.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Highlight/Range.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Components/ChartLimitLine.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Renderers/ChartDataRendererBase.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Renderers/AxisRendererBase.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Components/AxisBase.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Components/ComponentBase.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Charts/ChartViewBase.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Charts/BarLineChartViewBase.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Charts/PieRadarChartViewBase.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Data/Implementations/Standard/ChartDataEntryBase.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Animation/ChartAnimationEasing.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Utils/Fill.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Utils/Platform.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Components/Description.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Interfaces/ChartDataProvider.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Interfaces/CombinedChartDataProvider.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Interfaces/BubbleChartDataProvider.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Interfaces/BarLineScatterCandleBubbleChartDataProvider.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Interfaces/CandleChartDataProvider.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Interfaces/LineChartDataProvider.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Interfaces/BarChartDataProvider.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Interfaces/ScatterChartDataProvider.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Components/IMarker.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Utils/ViewPortHandler.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Utils/Transformer.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Renderers/Renderer.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Renderers/LegendRenderer.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Renderers/BarLineScatterCandleBubbleRenderer.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Renderers/Scatter/IShapeRenderer.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Renderers/Scatter/XShapeRenderer.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Renderers/Scatter/CircleShapeRenderer.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Renderers/Scatter/TriangleShapeRenderer.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Renderers/Scatter/SquareShapeRenderer.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Renderers/Scatter/ChevronDownShapeRenderer.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Renderers/Scatter/ChevronUpShapeRenderer.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Renderers/Scatter/CrossShapeRenderer.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Renderers/LineScatterCandleRadarRenderer.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Renderers/LineRadarRenderer.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Renderers/XAxisRenderer.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Renderers/YAxisRenderer.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Renderers/CombinedChartRenderer.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Renderers/PieChartRenderer.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Renderers/BubbleChartRenderer.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Renderers/LineChartRenderer.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Renderers/CandleStickChartRenderer.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Renderers/BarChartRenderer.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Renderers/HorizontalBarChartRenderer.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Renderers/RadarChartRenderer.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Renderers/ScatterChartRenderer.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Highlight/IHighlighter.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Highlight/CombinedHighlighter.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Highlight/PieHighlighter.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Highlight/BarHighlighter.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Highlight/HorizontalBarHighlighter.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Highlight/RadarHighlighter.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Highlight/PieRadarHighlighter.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Highlight/ChartHighlighter.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Formatters/IValueFormatter.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Formatters/IAxisValueFormatter.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Formatters/DefaultAxisValueFormatter.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Formatters/IndexAxisValueFormatter.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Formatters/DefaultValueFormatter.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Formatters/IFillFormatter.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Formatters/DefaultFillFormatter.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Animation/Animator.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Filters/DataApproximator.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Utils/ChartColorTemplates.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Components/XAxis.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Components/YAxis.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Utils/ChartUtils.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Data/Implementations/ChartBaseDataSet.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Data/Implementations/Standard/ChartDataSet.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Data/Interfaces/IChartDataSet.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Data/Implementations/Standard/PieChartDataSet.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Data/Interfaces/IPieChartDataSet.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Data/Implementations/Standard/BubbleChartDataSet.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Data/Interfaces/IBubbleChartDataSet.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Data/Implementations/Standard/BarLineScatterCandleBubbleChartDataSet.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Data/Interfaces/IBarLineScatterCandleBubbleChartDataSet.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Data/Implementations/Standard/CandleChartDataSet.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Data/Interfaces/ICandleChartDataSet.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Data/Implementations/Standard/LineChartDataSet.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Data/Interfaces/ILineChartDataSet.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Data/Implementations/Standard/BarChartDataSet.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Data/Interfaces/IBarChartDataSet.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Data/Implementations/Standard/RadarChartDataSet.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Data/Interfaces/IRadarChartDataSet.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Data/Implementations/Standard/LineScatterCandleRadarChartDataSet.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Data/Interfaces/ILineScatterCandleRadarChartDataSet.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Data/Implementations/Standard/LineRadarChartDataSet.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Data/Interfaces/ILineRadarChartDataSet.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Data/Implementations/Standard/ScatterChartDataSet.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Data/Interfaces/IScatterChartDataSet.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Highlight/Highlight.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Utils/TransformerHorizontalBarChart.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Renderers/XAxisRendererHorizontalBarChart.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Renderers/YAxisRendererHorizontalBarChart.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Renderers/XAxisRendererRadarChart.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Renderers/YAxisRendererRadarChart.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Components/MarkerView.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Charts/CombinedChartView.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Charts/PieChartView.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Charts/BubbleChartView.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Charts/LineChartView.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Charts/CandleStickChartView.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Charts/BarChartView.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Charts/HorizontalBarChartView.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Charts/RadarChartView.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Charts/ScatterChartView.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Data/Implementations/Standard/ChartDataEntry.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Data/Implementations/Standard/PieChartDataEntry.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Data/Implementations/Standard/BubbleChartDataEntry.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Data/Implementations/Standard/CandleChartDataEntry.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Data/Implementations/Standard/BarChartDataEntry.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Data/Implementations/Standard/RadarChartDataEntry.swift /Users/michael/Desktop/Buildcoin/ChartTest/Pods/Charts/Source/Charts/Components/LegendEntry.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/michael/Desktop/Buildcoin/ChartTest/Pods/Target\ Support\ Files/Charts/Charts-umbrella.h /Users/michael/Desktop/Buildcoin/ChartTest/build/Pods.build/Debug-iphonesimulator/Charts.build/unextended-module.modulemap /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.0.sdk/usr/include/objc/ObjectiveC.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.0.sdk/System/Library/Frameworks/OpenGLES.framework/Headers/OpenGLES.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.0.sdk/System/Library/Frameworks/CoreImage.framework/Headers/CoreImage.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.0.sdk/System/Library/Frameworks/QuartzCore.framework/Headers/QuartzCore.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.0.sdk/System/Library/Frameworks/Metal.framework/Headers/Metal.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.0.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.0.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.0.sdk/System/Library/Frameworks/CoreText.framework/Headers/CoreText.apinotes
| D |
/*******************************************************************************
* Copyright (c) 2000, 2008 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IBM Corporation - initial API and implementation
* Port to the D programming language:
* Frank Benoit <benoit@tionex.de>
*******************************************************************************/
module org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Layout;
import org.eclipse.swt.widgets.Scrollable;
import java.lang.System;
import java.lang.all;
/**
* Instances of this class lay out the control children of a
* <code>Composite</code> in a grid.
* <p>
* <code>GridLayout</code> has a number of configuration fields, and the
* controls it lays out can have an associated layout data object, called
* <code>GridData</code>. The power of <code>GridLayout</code> lies in the
* ability to configure <code>GridData</code> for each control in the layout.
* </p>
* <p>
* The following code creates a shell managed by a <code>GridLayout</code>
* with 3 columns:
* <pre>
* Display display = new Display();
* Shell shell = new Shell(display);
* GridLayout gridLayout = new GridLayout();
* gridLayout.numColumns = 3;
* shell.setLayout(gridLayout);
* </pre>
* The <code>numColumns</code> field is the most important field in a
* <code>GridLayout</code>. Widgets are laid out in columns from left
* to right, and a new row is created when <code>numColumns</code> + 1
* controls are added to the <code>Composite<code>.
* </p>
*
* @see GridData
* @see <a href="http://www.eclipse.org/swt/snippets/#gridlayout">GridLayout snippets</a>
* @see <a href="http://www.eclipse.org/swt/examples.php">SWT Example: LayoutExample</a>
* @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a>
*/
public final class GridLayout : Layout {
/**
* numColumns specifies the number of cell columns in the layout.
* If numColumns has a value less than 1, the layout will not
* set the size and position of any controls.
*
* The default value is 1.
*/
public int numColumns = 1;
/**
* makeColumnsEqualWidth specifies whether all columns in the layout
* will be forced to have the same width.
*
* The default value is false.
*/
public bool makeColumnsEqualWidth = false;
/**
* marginWidth specifies the number of pixels of horizontal margin
* that will be placed along the left and right edges of the layout.
*
* The default value is 5.
*/
public int marginWidth = 5;
/**
* marginHeight specifies the number of pixels of vertical margin
* that will be placed along the top and bottom edges of the layout.
*
* The default value is 5.
*/
public int marginHeight = 5;
/**
* marginLeft specifies the number of pixels of horizontal margin
* that will be placed along the left edge of the layout.
*
* The default value is 0.
*
* @since 3.1
*/
public int marginLeft = 0;
/**
* marginTop specifies the number of pixels of vertical margin
* that will be placed along the top edge of the layout.
*
* The default value is 0.
*
* @since 3.1
*/
public int marginTop = 0;
/**
* marginRight specifies the number of pixels of horizontal margin
* that will be placed along the right edge of the layout.
*
* The default value is 0.
*
* @since 3.1
*/
public int marginRight = 0;
/**
* marginBottom specifies the number of pixels of vertical margin
* that will be placed along the bottom edge of the layout.
*
* The default value is 0.
*
* @since 3.1
*/
public int marginBottom = 0;
/**
* horizontalSpacing specifies the number of pixels between the right
* edge of one cell and the left edge of its neighbouring cell to
* the right.
*
* The default value is 5.
*/
public int horizontalSpacing = 5;
/**
* verticalSpacing specifies the number of pixels between the bottom
* edge of one cell and the top edge of its neighbouring cell underneath.
*
* The default value is 5.
*/
public int verticalSpacing = 5;
/**
* Constructs a new instance of this class.
*/
public this () {}
/**
* Constructs a new instance of this class given the
* number of columns, and whether or not the columns
* should be forced to have the same width.
* If numColumns has a value less than 1, the layout will not
* set the size and position of any controls.
*
* @param numColumns the number of columns in the grid
* @param makeColumnsEqualWidth whether or not the columns will have equal width
*
* @since 2.0
*/
public this (int numColumns, bool makeColumnsEqualWidth) {
this.numColumns = numColumns;
this.makeColumnsEqualWidth = makeColumnsEqualWidth;
}
override protected Point computeSize (Composite composite, int wHint, int hHint, bool flushCache_) {
Point size = layout (composite, false, 0, 0, wHint, hHint, flushCache_);
if (wHint !is SWT.DEFAULT) size.x = wHint;
if (hHint !is SWT.DEFAULT) size.y = hHint;
return size;
}
override protected bool flushCache (Control control) {
Object data = control.getLayoutData ();
if (data !is null) (cast(GridData) data).flushCache ();
return true;
}
GridData getData (Control [][] grid, int row, int column, int rowCount, int columnCount, bool first) {
Control control = grid [row] [column];
if (control !is null) {
GridData data = cast(GridData) control.getLayoutData ();
int hSpan = Math.max (1, Math.min (data.horizontalSpan, columnCount));
int vSpan = Math.max (1, data.verticalSpan);
int i = first ? row + vSpan - 1 : row - vSpan + 1;
int j = first ? column + hSpan - 1 : column - hSpan + 1;
if (0 <= i && i < rowCount) {
if (0 <= j && j < columnCount) {
if (control is grid [i][j]) return data;
}
}
}
return null;
}
override protected void layout (Composite composite, bool flushCache_) {
Rectangle rect = composite.getClientArea ();
layout (composite, true, rect.x, rect.y, rect.width, rect.height, flushCache_);
}
Point layout (Composite composite, bool move, int x, int y, int width, int height, bool flushCache_) {
if (numColumns < 1) {
return new Point (marginLeft + marginWidth * 2 + marginRight, marginTop + marginHeight * 2 + marginBottom);
}
Control [] children = composite.getChildren ();
int count = 0;
for (int i=0; i<children.length; i++) {
Control control = children [i];
GridData data = cast(GridData) control.getLayoutData ();
if (data is null || !data.exclude) {
children [count++] = children [i];
}
}
if (count is 0) {
return new Point (marginLeft + marginWidth * 2 + marginRight, marginTop + marginHeight * 2 + marginBottom);
}
for (int i=0; i<count; i++) {
Control child = children [i];
GridData data = cast(GridData) child.getLayoutData ();
if (data is null) child.setLayoutData (data = new GridData ());
if (flushCache_) data.flushCache ();
data.computeSize (child, data.widthHint, data.heightHint, flushCache_);
if (data.grabExcessHorizontalSpace && data.minimumWidth > 0) {
if (data.cacheWidth < data.minimumWidth) {
int trim = 0;
//TEMPORARY CODE
if ( auto sa = cast(Scrollable)child ) {
Rectangle rect = sa.computeTrim (0, 0, 0, 0);
trim = rect.width;
} else {
trim = child.getBorderWidth () * 2;
}
data.cacheWidth = data.cacheHeight = SWT.DEFAULT;
data.computeSize (child, Math.max (0, data.minimumWidth - trim), data.heightHint, false);
}
}
if (data.grabExcessVerticalSpace && data.minimumHeight > 0) {
data.cacheHeight = Math.max (data.cacheHeight, data.minimumHeight);
}
}
/* Build the grid */
int row = 0, column = 0, rowCount = 0, columnCount = numColumns;
Control [][] grid = new Control [][]( 4, columnCount );
for (int i=0; i<count; i++) {
Control child = children [i];
GridData data = cast(GridData) child.getLayoutData ();
int hSpan = Math.max (1, Math.min (data.horizontalSpan, columnCount));
int vSpan = Math.max (1, data.verticalSpan);
while (true) {
int lastRow = row + vSpan;
if (lastRow >= grid.length) {
Control [][] newGrid = new Control[][]( lastRow + 4, columnCount );
SimpleType!(Control[]).arraycopy (grid, 0, newGrid, 0, cast(int)/*64bit*/grid.length);
grid = newGrid;
}
if (grid [row] is null) {
grid [row] = new Control [columnCount];
}
while (column < columnCount && grid [row] [column] !is null) {
column++;
}
int endCount = column + hSpan;
if (endCount <= columnCount) {
int index = column;
while (index < endCount && grid [row] [index] is null) {
index++;
}
if (index is endCount) break;
column = index;
}
if (column + hSpan >= columnCount) {
column = 0;
row++;
}
}
for (int j=0; j<vSpan; j++) {
if (grid [row + j] is null) {
grid [row + j] = new Control [columnCount];
}
for (int k=0; k<hSpan; k++) {
grid [row + j] [column + k] = child;
}
}
rowCount = Math.max (rowCount, row + vSpan);
column += hSpan;
}
/* Column widths */
int availableWidth = width - horizontalSpacing * (columnCount - 1) - (marginLeft + marginWidth * 2 + marginRight);
int expandCount = 0;
int [] widths = new int [columnCount];
int [] minWidths = new int [columnCount];
bool [] expandColumn = new bool [columnCount];
for (int j=0; j<columnCount; j++) {
for (int i=0; i<rowCount; i++) {
GridData data = getData (grid, i, j, rowCount, columnCount, true);
if (data !is null) {
int hSpan = Math.max (1, Math.min (data.horizontalSpan, columnCount));
if (hSpan is 1) {
int w = data.cacheWidth + data.horizontalIndent;
widths [j] = Math.max (widths [j], w);
if (data.grabExcessHorizontalSpace) {
if (!expandColumn [j]) expandCount++;
expandColumn [j] = true;
}
if (!data.grabExcessHorizontalSpace || data.minimumWidth !is 0) {
w = !data.grabExcessHorizontalSpace || data.minimumWidth is SWT.DEFAULT ? data.cacheWidth : data.minimumWidth;
w += data.horizontalIndent;
minWidths [j] = Math.max (minWidths [j], w);
}
}
}
}
for (int i=0; i<rowCount; i++) {
GridData data = getData (grid, i, j, rowCount, columnCount, false);
if (data !is null) {
int hSpan = Math.max (1, Math.min (data.horizontalSpan, columnCount));
if (hSpan > 1) {
int spanWidth = 0, spanMinWidth = 0, spanExpandCount = 0;
for (int k=0; k<hSpan; k++) {
spanWidth += widths [j-k];
spanMinWidth += minWidths [j-k];
if (expandColumn [j-k]) spanExpandCount++;
}
if (data.grabExcessHorizontalSpace && spanExpandCount is 0) {
expandCount++;
expandColumn [j] = true;
}
int w = data.cacheWidth + data.horizontalIndent - spanWidth - (hSpan - 1) * horizontalSpacing;
if (w > 0) {
if (makeColumnsEqualWidth) {
int equalWidth = (w + spanWidth) / hSpan;
int remainder = (w + spanWidth) % hSpan, last = -1;
for (int k = 0; k < hSpan; k++) {
widths [last=j-k] = Math.max (equalWidth, widths [j-k]);
}
if (last > -1) widths [last] += remainder;
} else {
if (spanExpandCount is 0) {
widths [j] += w;
} else {
int delta = w / spanExpandCount;
int remainder = w % spanExpandCount, last = -1;
for (int k = 0; k < hSpan; k++) {
if (expandColumn [j-k]) {
widths [last=j-k] += delta;
}
}
if (last > -1) widths [last] += remainder;
}
}
}
if (!data.grabExcessHorizontalSpace || data.minimumWidth !is 0) {
w = !data.grabExcessHorizontalSpace || data.minimumWidth is SWT.DEFAULT ? data.cacheWidth : data.minimumWidth;
w += data.horizontalIndent - spanMinWidth - (hSpan - 1) * horizontalSpacing;
if (w > 0) {
if (spanExpandCount is 0) {
minWidths [j] += w;
} else {
int delta = w / spanExpandCount;
int remainder = w % spanExpandCount, last = -1;
for (int k = 0; k < hSpan; k++) {
if (expandColumn [j-k]) {
minWidths [last=j-k] += delta;
}
}
if (last > -1) minWidths [last] += remainder;
}
}
}
}
}
}
}
if (makeColumnsEqualWidth) {
int minColumnWidth = 0;
int columnWidth = 0;
for (int i=0; i<columnCount; i++) {
minColumnWidth = Math.max (minColumnWidth, minWidths [i]);
columnWidth = Math.max (columnWidth, widths [i]);
}
columnWidth = width is SWT.DEFAULT || expandCount is 0 ? columnWidth : Math.max (minColumnWidth, availableWidth / columnCount);
for (int i=0; i<columnCount; i++) {
expandColumn [i] = expandCount > 0;
widths [i] = columnWidth;
}
} else {
if (width !is SWT.DEFAULT && expandCount > 0) {
int totalWidth = 0;
for (int i=0; i<columnCount; i++) {
totalWidth += widths [i];
}
int c = expandCount;
int delta = (availableWidth - totalWidth) / c;
int remainder = (availableWidth - totalWidth) % c;
int last = -1;
while (totalWidth !is availableWidth) {
for (int j=0; j<columnCount; j++) {
if (expandColumn [j]) {
if (widths [j] + delta > minWidths [j]) {
widths [last = j] = widths [j] + delta;
} else {
widths [j] = minWidths [j];
expandColumn [j] = false;
c--;
}
}
}
if (last > -1) widths [last] += remainder;
for (int j=0; j<columnCount; j++) {
for (int i=0; i<rowCount; i++) {
GridData data = getData (grid, i, j, rowCount, columnCount, false);
if (data !is null) {
int hSpan = Math.max (1, Math.min (data.horizontalSpan, columnCount));
if (hSpan > 1) {
if (!data.grabExcessHorizontalSpace || data.minimumWidth !is 0) {
int spanWidth = 0, spanExpandCount = 0;
for (int k=0; k<hSpan; k++) {
spanWidth += widths [j-k];
if (expandColumn [j-k]) spanExpandCount++;
}
int w = !data.grabExcessHorizontalSpace || data.minimumWidth is SWT.DEFAULT ? data.cacheWidth : data.minimumWidth;
w += data.horizontalIndent - spanWidth - (hSpan - 1) * horizontalSpacing;
if (w > 0) {
if (spanExpandCount is 0) {
widths [j] += w;
} else {
int delta2 = w / spanExpandCount;
int remainder2 = w % spanExpandCount, last2 = -1;
for (int k = 0; k < hSpan; k++) {
if (expandColumn [j-k]) {
widths [last2=j-k] += delta2;
}
}
if (last2 > -1) widths [last2] += remainder2;
}
}
}
}
}
}
}
if (c is 0) break;
totalWidth = 0;
for (int i=0; i<columnCount; i++) {
totalWidth += widths [i];
}
delta = (availableWidth - totalWidth) / c;
remainder = (availableWidth - totalWidth) % c;
last = -1;
}
}
}
/* Wrapping */
GridData [] flush = null;
int flushLength = 0;
if (width !is SWT.DEFAULT) {
for (int j=0; j<columnCount; j++) {
for (int i=0; i<rowCount; i++) {
GridData data = getData (grid, i, j, rowCount, columnCount, false);
if (data !is null) {
if (data.heightHint is SWT.DEFAULT) {
Control child = grid [i][j];
//TEMPORARY CODE
int hSpan = Math.max (1, Math.min (data.horizontalSpan, columnCount));
int currentWidth = 0;
for (int k=0; k<hSpan; k++) {
currentWidth += widths [j-k];
}
currentWidth += (hSpan - 1) * horizontalSpacing - data.horizontalIndent;
if ((currentWidth !is data.cacheWidth && data.horizontalAlignment is SWT.FILL) || (data.cacheWidth > currentWidth)) {
int trim = 0;
if ( auto sa = cast(Scrollable)child ) {
Rectangle rect = sa.computeTrim (0, 0, 0, 0);
trim = rect.width;
} else {
trim = child.getBorderWidth () * 2;
}
data.cacheWidth = data.cacheHeight = SWT.DEFAULT;
data.computeSize (child, Math.max (0, currentWidth - trim), data.heightHint, false);
if (data.grabExcessVerticalSpace && data.minimumHeight > 0) {
data.cacheHeight = Math.max (data.cacheHeight, data.minimumHeight);
}
if (flush is null) flush = new GridData [count];
flush [flushLength++] = data;
}
}
}
}
}
}
/* Row heights */
int availableHeight = height - verticalSpacing * (rowCount - 1) - (marginTop + marginHeight * 2 + marginBottom);
expandCount = 0;
int [] heights = new int [rowCount];
int [] minHeights = new int [rowCount];
bool [] expandRow = new bool [rowCount];
for (int i=0; i<rowCount; i++) {
for (int j=0; j<columnCount; j++) {
GridData data = getData (grid, i, j, rowCount, columnCount, true);
if (data !is null) {
int vSpan = Math.max (1, Math.min (data.verticalSpan, rowCount));
if (vSpan is 1) {
int h = data.cacheHeight + data.verticalIndent;
heights [i] = Math.max (heights [i], h);
if (data.grabExcessVerticalSpace) {
if (!expandRow [i]) expandCount++;
expandRow [i] = true;
}
if (!data.grabExcessVerticalSpace || data.minimumHeight !is 0) {
h = !data.grabExcessVerticalSpace || data.minimumHeight is SWT.DEFAULT ? data.cacheHeight : data.minimumHeight;
h += data.verticalIndent;
minHeights [i] = Math.max (minHeights [i], h);
}
}
}
}
for (int j=0; j<columnCount; j++) {
GridData data = getData (grid, i, j, rowCount, columnCount, false);
if (data !is null) {
int vSpan = Math.max (1, Math.min (data.verticalSpan, rowCount));
if (vSpan > 1) {
int spanHeight = 0, spanMinHeight = 0, spanExpandCount = 0;
for (int k=0; k<vSpan; k++) {
spanHeight += heights [i-k];
spanMinHeight += minHeights [i-k];
if (expandRow [i-k]) spanExpandCount++;
}
if (data.grabExcessVerticalSpace && spanExpandCount is 0) {
expandCount++;
expandRow [i] = true;
}
int h = data.cacheHeight + data.verticalIndent - spanHeight - (vSpan - 1) * verticalSpacing;
if (h > 0) {
if (spanExpandCount is 0) {
heights [i] += h;
} else {
int delta = h / spanExpandCount;
int remainder = h % spanExpandCount, last = -1;
for (int k = 0; k < vSpan; k++) {
if (expandRow [i-k]) {
heights [last=i-k] += delta;
}
}
if (last > -1) heights [last] += remainder;
}
}
if (!data.grabExcessVerticalSpace || data.minimumHeight !is 0) {
h = !data.grabExcessVerticalSpace || data.minimumHeight is SWT.DEFAULT ? data.cacheHeight : data.minimumHeight;
h += data.verticalIndent - spanMinHeight - (vSpan - 1) * verticalSpacing;
if (h > 0) {
if (spanExpandCount is 0) {
minHeights [i] += h;
} else {
int delta = h / spanExpandCount;
int remainder = h % spanExpandCount, last = -1;
for (int k = 0; k < vSpan; k++) {
if (expandRow [i-k]) {
minHeights [last=i-k] += delta;
}
}
if (last > -1) minHeights [last] += remainder;
}
}
}
}
}
}
}
if (height !is SWT.DEFAULT && expandCount > 0) {
int totalHeight = 0;
for (int i=0; i<rowCount; i++) {
totalHeight += heights [i];
}
int c = expandCount;
int delta = (availableHeight - totalHeight) / c;
int remainder = (availableHeight - totalHeight) % c;
int last = -1;
while (totalHeight !is availableHeight) {
for (int i=0; i<rowCount; i++) {
if (expandRow [i]) {
if (heights [i] + delta > minHeights [i]) {
heights [last = i] = heights [i] + delta;
} else {
heights [i] = minHeights [i];
expandRow [i] = false;
c--;
}
}
}
if (last > -1) heights [last] += remainder;
for (int i=0; i<rowCount; i++) {
for (int j=0; j<columnCount; j++) {
GridData data = getData (grid, i, j, rowCount, columnCount, false);
if (data !is null) {
int vSpan = Math.max (1, Math.min (data.verticalSpan, rowCount));
if (vSpan > 1) {
if (!data.grabExcessVerticalSpace || data.minimumHeight !is 0) {
int spanHeight = 0, spanExpandCount = 0;
for (int k=0; k<vSpan; k++) {
spanHeight += heights [i-k];
if (expandRow [i-k]) spanExpandCount++;
}
int h = !data.grabExcessVerticalSpace || data.minimumHeight is SWT.DEFAULT ? data.cacheHeight : data.minimumHeight;
h += data.verticalIndent - spanHeight - (vSpan - 1) * verticalSpacing;
if (h > 0) {
if (spanExpandCount is 0) {
heights [i] += h;
} else {
int delta2 = h / spanExpandCount;
int remainder2 = h % spanExpandCount, last2 = -1;
for (int k = 0; k < vSpan; k++) {
if (expandRow [i-k]) {
heights [last2=i-k] += delta2;
}
}
if (last2 > -1) heights [last2] += remainder2;
}
}
}
}
}
}
}
if (c is 0) break;
totalHeight = 0;
for (int i=0; i<rowCount; i++) {
totalHeight += heights [i];
}
delta = (availableHeight - totalHeight) / c;
remainder = (availableHeight - totalHeight) % c;
last = -1;
}
}
/* Position the controls */
if (move) {
int gridY = y + marginTop + marginHeight;
for (int i=0; i<rowCount; i++) {
int gridX = x + marginLeft + marginWidth;
for (int j=0; j<columnCount; j++) {
GridData data = getData (grid, i, j, rowCount, columnCount, true);
if (data !is null) {
int hSpan = Math.max (1, Math.min (data.horizontalSpan, columnCount));
int vSpan = Math.max (1, data.verticalSpan);
int cellWidth = 0, cellHeight = 0;
for (int k=0; k<hSpan; k++) {
cellWidth += widths [j+k];
}
for (int k=0; k<vSpan; k++) {
cellHeight += heights [i+k];
}
cellWidth += horizontalSpacing * (hSpan - 1);
int childX = gridX + data.horizontalIndent;
int childWidth = Math.min (data.cacheWidth, cellWidth);
switch (data.horizontalAlignment) {
case SWT.CENTER:
case GridData.CENTER:
childX += Math.max (0, (cellWidth - data.horizontalIndent - childWidth) / 2);
break;
case SWT.RIGHT:
case SWT.END:
case GridData.END:
childX += Math.max (0, cellWidth - data.horizontalIndent - childWidth);
break;
case SWT.FILL:
childWidth = cellWidth - data.horizontalIndent;
break;
default:
}
cellHeight += verticalSpacing * (vSpan - 1);
int childY = gridY + data.verticalIndent;
int childHeight = Math.min (data.cacheHeight, cellHeight);
switch (data.verticalAlignment) {
case SWT.CENTER:
case GridData.CENTER:
childY += Math.max (0, (cellHeight - data.verticalIndent - childHeight) / 2);
break;
case SWT.BOTTOM:
case SWT.END:
case GridData.END:
childY += Math.max (0, cellHeight - data.verticalIndent - childHeight);
break;
case SWT.FILL:
childHeight = cellHeight - data.verticalIndent;
break;
default:
}
Control child = grid [i][j];
if (child !is null) {
child.setBounds (childX, childY, childWidth, childHeight);
}
}
gridX += widths [j] + horizontalSpacing;
}
gridY += heights [i] + verticalSpacing;
}
}
// clean up cache
for (int i = 0; i < flushLength; i++) {
flush [i].cacheWidth = flush [i].cacheHeight = -1;
}
int totalDefaultWidth = 0;
int totalDefaultHeight = 0;
for (int i=0; i<columnCount; i++) {
totalDefaultWidth += widths [i];
}
for (int i=0; i<rowCount; i++) {
totalDefaultHeight += heights [i];
}
totalDefaultWidth += horizontalSpacing * (columnCount - 1) + marginLeft + marginWidth * 2 + marginRight;
totalDefaultHeight += verticalSpacing * (rowCount - 1) + marginTop + marginHeight * 2 + marginBottom;
return new Point (totalDefaultWidth, totalDefaultHeight);
}
String getName () {
String string = this.classinfo.name;
int index = string.lastIndexOf('.');
if (index is -1 ) return string;
return string[ index + 1 .. string.length ];
}
/**
* Returns a string containing a concise, human-readable
* description of the receiver.
*
* @return a string representation of the layout
*/
override public String toString () {
String string = getName ()~" {";
if (numColumns !is 1) string ~= "numColumns="~String_valueOf(numColumns)~" ";
if (makeColumnsEqualWidth) string ~= "makeColumnsEqualWidth="~String_valueOf(makeColumnsEqualWidth)~" ";
if (marginWidth !is 0) string ~= "marginWidth="~String_valueOf(marginWidth)~" ";
if (marginHeight !is 0) string ~= "marginHeight="~String_valueOf(marginHeight)~" ";
if (marginLeft !is 0) string ~= "marginLeft="~String_valueOf(marginLeft)~" ";
if (marginRight !is 0) string ~= "marginRight="~String_valueOf(marginRight)~" ";
if (marginTop !is 0) string ~= "marginTop="~String_valueOf(marginTop)~" ";
if (marginBottom !is 0) string ~= "marginBottom="~String_valueOf(marginBottom)~" ";
if (horizontalSpacing !is 0) string ~= "horizontalSpacing="~String_valueOf(horizontalSpacing)~" ";
if (verticalSpacing !is 0) string ~= "verticalSpacing="~String_valueOf(verticalSpacing)~" ";
string = string.trim();
string ~= "}";
return string;
}
}
| D |
/// Module containing code for desktop implementations.
/// Currently supported: SDL
/// Planned: Win32, X-Window, GTK
module d3d.desktop;
public:
import d3d.desktop.desktopcomponent;
import d3d.desktop.sdlwindow;
| D |
/*
* Copyright (C) 2016 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 com.google.caliper.BeforeExperiment;
import java.text.DateFormat;
import java.util.Locale;
public final class DateFormatBenchmark {
private Locale locale1;
private Locale locale2;
private Locale locale3;
private Locale locale4;
@BeforeExperiment
protected void setUp() throws Exception {
locale1 = Locale.TAIWAN;
locale2 = Locale.GERMANY;
locale3 = Locale.FRANCE;
locale4 = Locale.ITALY;
}
public void timeGetDateTimeInstance(int reps) throws Exception {
for (int i = 0; i < reps; ++i) {
DateFormat.getDateTimeInstance();
}
}
public void timeGetDateTimeInstance_multiple(int reps) throws Exception {
for (int i = 0; i < reps; ++i) {
DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT, locale1);
DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT, locale2);
DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT, locale3);
DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT, locale4);
}
}
}
| D |
module test.codec.websocket;
import hunt.http.codec.websocket.encode.Generator;
import hunt.http.WebSocketFrame;
import hunt.util.Common;
import hunt.io.BufferUtils;
import hunt.util.TypeUtils;
import hunt.Assert;
import hunt.io.ByteBuffer;
import hunt.collection.ArrayList;
import hunt.collection.List;
import java.util.Locale;
/**
* Capture outgoing network bytes.
*/
public class OutgoingNetworkBytesCapture : OutgoingFrames {
private final Generator generator;
private List!(ByteBuffer) captured;
public OutgoingNetworkBytesCapture(Generator generator) {
this.generator = generator;
this.captured = new ArrayList<>();
}
public void assertBytes(int idx, string expectedHex) {
Assert.assertThat("Capture index does not exist", idx, lessThan(captured.size()));
ByteBuffer buf = captured.get(idx);
string actualHex = TypeUtils.toHexString(BufferUtils.toArray(buf)).toUpper();
Assert.assertThat("captured[" ~ idx ~ "]", actualHex, is(expectedHex.toUpper()));
}
public List!(ByteBuffer) getCaptured() {
return captured;
}
override
public void outgoingFrame(Frame frame, Callback callback) {
ByteBuffer buf = BufferUtils.allocate(Generator.MAX_HEADER_LENGTH + frame.getPayloadLength());
generator.generateWholeFrame(frame, buf);
BufferUtils.flipToFlush(buf, 0);
captured.add(buf);
if (callback != null) {
callback.succeeded();
}
}
}
| D |
/Users/Natalia/FunChatik/Jenkins/build/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/Socket.IO-Client-Swift.build/Objects-normal/x86_64/SocketRawView.o : /Users/Natalia/FunChatik/Pods/Socket.IO-Client-Swift/Source/SocketIO/Engine/SocketEngineSpec.swift /Users/Natalia/FunChatik/Pods/Socket.IO-Client-Swift/Source/SocketIO/Manager/SocketManagerSpec.swift /Users/Natalia/FunChatik/Pods/Socket.IO-Client-Swift/Source/SocketIO/Client/SocketIOClientSpec.swift /Users/Natalia/FunChatik/Pods/Socket.IO-Client-Swift/Source/SocketIO/Engine/SocketEnginePollable.swift /Users/Natalia/FunChatik/Pods/Socket.IO-Client-Swift/Source/SocketIO/Parse/SocketParsable.swift /Users/Natalia/FunChatik/Pods/Socket.IO-Client-Swift/Source/SocketIO/Engine/SocketEngine.swift /Users/Natalia/FunChatik/Pods/Socket.IO-Client-Swift/Source/SocketIO/Engine/SocketEnginePacketType.swift /Users/Natalia/FunChatik/Pods/Socket.IO-Client-Swift/Source/SocketIO/Client/SocketIOClientConfiguration.swift /Users/Natalia/FunChatik/Pods/Socket.IO-Client-Swift/Source/SocketIO/Client/SocketIOClientOption.swift /Users/Natalia/FunChatik/Pods/Socket.IO-Client-Swift/Source/SocketIO/Util/SocketStringReader.swift /Users/Natalia/FunChatik/Pods/Socket.IO-Client-Swift/Source/SocketIO/Ack/SocketAckManager.swift /Users/Natalia/FunChatik/Pods/Socket.IO-Client-Swift/Source/SocketIO/Manager/SocketManager.swift /Users/Natalia/FunChatik/Pods/Socket.IO-Client-Swift/Source/SocketIO/Util/SocketLogger.swift /Users/Natalia/FunChatik/Pods/Socket.IO-Client-Swift/Source/SocketIO/Client/SocketEventHandler.swift /Users/Natalia/FunChatik/Pods/Socket.IO-Client-Swift/Source/SocketIO/Ack/SocketAckEmitter.swift /Users/Natalia/FunChatik/Pods/Socket.IO-Client-Swift/Source/SocketIO/Util/SocketTypes.swift /Users/Natalia/FunChatik/Pods/Socket.IO-Client-Swift/Source/SocketIO/Util/SocketExtensions.swift /Users/Natalia/FunChatik/Pods/Socket.IO-Client-Swift/Source/SocketIO/Client/SocketIOStatus.swift /Users/Natalia/FunChatik/Pods/Socket.IO-Client-Swift/Source/SocketIO/Parse/SocketPacket.swift /Users/Natalia/FunChatik/Pods/Socket.IO-Client-Swift/Source/SocketIO/Engine/SocketEngineWebsocket.swift /Users/Natalia/FunChatik/Pods/Socket.IO-Client-Swift/Source/SocketIO/Client/SocketIOClient.swift /Users/Natalia/FunChatik/Pods/Socket.IO-Client-Swift/Source/SocketIO/Engine/SocketEngineClient.swift /Users/Natalia/FunChatik/Pods/Socket.IO-Client-Swift/Source/SocketIO/Client/SocketAnyEvent.swift /Users/Natalia/FunChatik/Pods/Socket.IO-Client-Swift/Source/SocketIO/Client/SocketRawView.swift /Users/Natalia/FunChatik/Pods/Socket.IO-Client-Swift/Source/SocketIO/Util/SSLSecurity.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Dispatch.apinotesc /Users/Natalia/FunChatik/Jenkins/build/Build/Products/Debug-iphonesimulator/Starscream/Starscream.framework/Modules/Starscream.swiftmodule/x86_64.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/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/Natalia/FunChatik/Pods/Target\ Support\ Files/Starscream/Starscream-umbrella.h /Users/Natalia/FunChatik/Pods/Target\ Support\ Files/Socket.IO-Client-Swift/Socket.IO-Client-Swift-umbrella.h /Users/Natalia/FunChatik/Jenkins/build/Build/Products/Debug-iphonesimulator/Starscream/Starscream.framework/Headers/Starscream-Swift.h /Users/Natalia/FunChatik/Jenkins/build/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/Socket.IO-Client-Swift.build/unextended-module.modulemap /Users/Natalia/FunChatik/Pods/Starscream/zlib/module.modulemap /Users/Natalia/FunChatik/Jenkins/build/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/Starscream.build/module.modulemap /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.4.sdk/usr/include/objc/ObjectiveC.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.4.sdk/System/Library/Frameworks/OpenGLES.framework/Headers/OpenGLES.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.4.sdk/System/Library/Frameworks/CoreImage.framework/Headers/CoreImage.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.4.sdk/System/Library/Frameworks/QuartzCore.framework/Headers/QuartzCore.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.4.sdk/System/Library/Frameworks/Metal.framework/Headers/Metal.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.4.sdk/usr/include/Darwin.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.4.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.4.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.4.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIKit.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.4.sdk/System/Library/Frameworks/CoreText.framework/Headers/CoreText.apinotes
/Users/Natalia/FunChatik/Jenkins/build/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/Socket.IO-Client-Swift.build/Objects-normal/x86_64/SocketRawView~partial.swiftmodule : /Users/Natalia/FunChatik/Pods/Socket.IO-Client-Swift/Source/SocketIO/Engine/SocketEngineSpec.swift /Users/Natalia/FunChatik/Pods/Socket.IO-Client-Swift/Source/SocketIO/Manager/SocketManagerSpec.swift /Users/Natalia/FunChatik/Pods/Socket.IO-Client-Swift/Source/SocketIO/Client/SocketIOClientSpec.swift /Users/Natalia/FunChatik/Pods/Socket.IO-Client-Swift/Source/SocketIO/Engine/SocketEnginePollable.swift /Users/Natalia/FunChatik/Pods/Socket.IO-Client-Swift/Source/SocketIO/Parse/SocketParsable.swift /Users/Natalia/FunChatik/Pods/Socket.IO-Client-Swift/Source/SocketIO/Engine/SocketEngine.swift /Users/Natalia/FunChatik/Pods/Socket.IO-Client-Swift/Source/SocketIO/Engine/SocketEnginePacketType.swift /Users/Natalia/FunChatik/Pods/Socket.IO-Client-Swift/Source/SocketIO/Client/SocketIOClientConfiguration.swift /Users/Natalia/FunChatik/Pods/Socket.IO-Client-Swift/Source/SocketIO/Client/SocketIOClientOption.swift /Users/Natalia/FunChatik/Pods/Socket.IO-Client-Swift/Source/SocketIO/Util/SocketStringReader.swift /Users/Natalia/FunChatik/Pods/Socket.IO-Client-Swift/Source/SocketIO/Ack/SocketAckManager.swift /Users/Natalia/FunChatik/Pods/Socket.IO-Client-Swift/Source/SocketIO/Manager/SocketManager.swift /Users/Natalia/FunChatik/Pods/Socket.IO-Client-Swift/Source/SocketIO/Util/SocketLogger.swift /Users/Natalia/FunChatik/Pods/Socket.IO-Client-Swift/Source/SocketIO/Client/SocketEventHandler.swift /Users/Natalia/FunChatik/Pods/Socket.IO-Client-Swift/Source/SocketIO/Ack/SocketAckEmitter.swift /Users/Natalia/FunChatik/Pods/Socket.IO-Client-Swift/Source/SocketIO/Util/SocketTypes.swift /Users/Natalia/FunChatik/Pods/Socket.IO-Client-Swift/Source/SocketIO/Util/SocketExtensions.swift /Users/Natalia/FunChatik/Pods/Socket.IO-Client-Swift/Source/SocketIO/Client/SocketIOStatus.swift /Users/Natalia/FunChatik/Pods/Socket.IO-Client-Swift/Source/SocketIO/Parse/SocketPacket.swift /Users/Natalia/FunChatik/Pods/Socket.IO-Client-Swift/Source/SocketIO/Engine/SocketEngineWebsocket.swift /Users/Natalia/FunChatik/Pods/Socket.IO-Client-Swift/Source/SocketIO/Client/SocketIOClient.swift /Users/Natalia/FunChatik/Pods/Socket.IO-Client-Swift/Source/SocketIO/Engine/SocketEngineClient.swift /Users/Natalia/FunChatik/Pods/Socket.IO-Client-Swift/Source/SocketIO/Client/SocketAnyEvent.swift /Users/Natalia/FunChatik/Pods/Socket.IO-Client-Swift/Source/SocketIO/Client/SocketRawView.swift /Users/Natalia/FunChatik/Pods/Socket.IO-Client-Swift/Source/SocketIO/Util/SSLSecurity.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Dispatch.apinotesc /Users/Natalia/FunChatik/Jenkins/build/Build/Products/Debug-iphonesimulator/Starscream/Starscream.framework/Modules/Starscream.swiftmodule/x86_64.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/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/Natalia/FunChatik/Pods/Target\ Support\ Files/Starscream/Starscream-umbrella.h /Users/Natalia/FunChatik/Pods/Target\ Support\ Files/Socket.IO-Client-Swift/Socket.IO-Client-Swift-umbrella.h /Users/Natalia/FunChatik/Jenkins/build/Build/Products/Debug-iphonesimulator/Starscream/Starscream.framework/Headers/Starscream-Swift.h /Users/Natalia/FunChatik/Jenkins/build/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/Socket.IO-Client-Swift.build/unextended-module.modulemap /Users/Natalia/FunChatik/Pods/Starscream/zlib/module.modulemap /Users/Natalia/FunChatik/Jenkins/build/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/Starscream.build/module.modulemap /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.4.sdk/usr/include/objc/ObjectiveC.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.4.sdk/System/Library/Frameworks/OpenGLES.framework/Headers/OpenGLES.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.4.sdk/System/Library/Frameworks/CoreImage.framework/Headers/CoreImage.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.4.sdk/System/Library/Frameworks/QuartzCore.framework/Headers/QuartzCore.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.4.sdk/System/Library/Frameworks/Metal.framework/Headers/Metal.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.4.sdk/usr/include/Darwin.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.4.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.4.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.4.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIKit.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.4.sdk/System/Library/Frameworks/CoreText.framework/Headers/CoreText.apinotes
/Users/Natalia/FunChatik/Jenkins/build/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/Socket.IO-Client-Swift.build/Objects-normal/x86_64/SocketRawView~partial.swiftdoc : /Users/Natalia/FunChatik/Pods/Socket.IO-Client-Swift/Source/SocketIO/Engine/SocketEngineSpec.swift /Users/Natalia/FunChatik/Pods/Socket.IO-Client-Swift/Source/SocketIO/Manager/SocketManagerSpec.swift /Users/Natalia/FunChatik/Pods/Socket.IO-Client-Swift/Source/SocketIO/Client/SocketIOClientSpec.swift /Users/Natalia/FunChatik/Pods/Socket.IO-Client-Swift/Source/SocketIO/Engine/SocketEnginePollable.swift /Users/Natalia/FunChatik/Pods/Socket.IO-Client-Swift/Source/SocketIO/Parse/SocketParsable.swift /Users/Natalia/FunChatik/Pods/Socket.IO-Client-Swift/Source/SocketIO/Engine/SocketEngine.swift /Users/Natalia/FunChatik/Pods/Socket.IO-Client-Swift/Source/SocketIO/Engine/SocketEnginePacketType.swift /Users/Natalia/FunChatik/Pods/Socket.IO-Client-Swift/Source/SocketIO/Client/SocketIOClientConfiguration.swift /Users/Natalia/FunChatik/Pods/Socket.IO-Client-Swift/Source/SocketIO/Client/SocketIOClientOption.swift /Users/Natalia/FunChatik/Pods/Socket.IO-Client-Swift/Source/SocketIO/Util/SocketStringReader.swift /Users/Natalia/FunChatik/Pods/Socket.IO-Client-Swift/Source/SocketIO/Ack/SocketAckManager.swift /Users/Natalia/FunChatik/Pods/Socket.IO-Client-Swift/Source/SocketIO/Manager/SocketManager.swift /Users/Natalia/FunChatik/Pods/Socket.IO-Client-Swift/Source/SocketIO/Util/SocketLogger.swift /Users/Natalia/FunChatik/Pods/Socket.IO-Client-Swift/Source/SocketIO/Client/SocketEventHandler.swift /Users/Natalia/FunChatik/Pods/Socket.IO-Client-Swift/Source/SocketIO/Ack/SocketAckEmitter.swift /Users/Natalia/FunChatik/Pods/Socket.IO-Client-Swift/Source/SocketIO/Util/SocketTypes.swift /Users/Natalia/FunChatik/Pods/Socket.IO-Client-Swift/Source/SocketIO/Util/SocketExtensions.swift /Users/Natalia/FunChatik/Pods/Socket.IO-Client-Swift/Source/SocketIO/Client/SocketIOStatus.swift /Users/Natalia/FunChatik/Pods/Socket.IO-Client-Swift/Source/SocketIO/Parse/SocketPacket.swift /Users/Natalia/FunChatik/Pods/Socket.IO-Client-Swift/Source/SocketIO/Engine/SocketEngineWebsocket.swift /Users/Natalia/FunChatik/Pods/Socket.IO-Client-Swift/Source/SocketIO/Client/SocketIOClient.swift /Users/Natalia/FunChatik/Pods/Socket.IO-Client-Swift/Source/SocketIO/Engine/SocketEngineClient.swift /Users/Natalia/FunChatik/Pods/Socket.IO-Client-Swift/Source/SocketIO/Client/SocketAnyEvent.swift /Users/Natalia/FunChatik/Pods/Socket.IO-Client-Swift/Source/SocketIO/Client/SocketRawView.swift /Users/Natalia/FunChatik/Pods/Socket.IO-Client-Swift/Source/SocketIO/Util/SSLSecurity.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Dispatch.apinotesc /Users/Natalia/FunChatik/Jenkins/build/Build/Products/Debug-iphonesimulator/Starscream/Starscream.framework/Modules/Starscream.swiftmodule/x86_64.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/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/Natalia/FunChatik/Pods/Target\ Support\ Files/Starscream/Starscream-umbrella.h /Users/Natalia/FunChatik/Pods/Target\ Support\ Files/Socket.IO-Client-Swift/Socket.IO-Client-Swift-umbrella.h /Users/Natalia/FunChatik/Jenkins/build/Build/Products/Debug-iphonesimulator/Starscream/Starscream.framework/Headers/Starscream-Swift.h /Users/Natalia/FunChatik/Jenkins/build/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/Socket.IO-Client-Swift.build/unextended-module.modulemap /Users/Natalia/FunChatik/Pods/Starscream/zlib/module.modulemap /Users/Natalia/FunChatik/Jenkins/build/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/Starscream.build/module.modulemap /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.4.sdk/usr/include/objc/ObjectiveC.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.4.sdk/System/Library/Frameworks/OpenGLES.framework/Headers/OpenGLES.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.4.sdk/System/Library/Frameworks/CoreImage.framework/Headers/CoreImage.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.4.sdk/System/Library/Frameworks/QuartzCore.framework/Headers/QuartzCore.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.4.sdk/System/Library/Frameworks/Metal.framework/Headers/Metal.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.4.sdk/usr/include/Darwin.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.4.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.4.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.4.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIKit.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.4.sdk/System/Library/Frameworks/CoreText.framework/Headers/CoreText.apinotes
| D |
module example_2;
import std.stdio;
import std.math;
import rpp.client.rpc;
import utilities;
int main(char[][] args)
{
initRPP(`127.0.0.1`, 54000);
real start = 0;
real end = 20;
int points = 1000;
real[] x = linspace(start, end, points);
real[] u = new real[x.length];
real[] u1 = new real[x.length];
foreach(int i, _x; x)
u[i] = sin(_x)*sin(0.5*sin(_x)*_x);
foreach(int i, _x; x)
u1[i] = sin(0.5*sin(_x)*_x);
figure();
plot(x, u, "r", x, u1, "b");
setupPlot("$x$", "$u$", ["$u$", "$u_1$"], 12, "northwest");
title("Some lines!");
return 0;
} | D |
/**
* Skadi.d Web Framework
*
* Forked from: https://github.com/mbierlee/poodinis
* Authors: Mike Bierlee, Faianca
* Copyright: Copyright (c) 2015 Mike Bierlee, Faianca
* License: MIT License, see LICENSE
*/
module skadi.container.container;
import std.string;
import std.algorithm;
import std.concurrency;
debug {
import std.stdio;
}
public import skadi.container.registration;
public import skadi.container.inject;
/**
* Exception thrown when errors occur while resolving a type in a dependency container.
*/
class ResolveException : Exception
{
this(string message, TypeInfo resolveType)
{
super(format("Exception while resolving type %s: %s", resolveType.toString(), message));
}
}
/**
* Exception thrown when errors occur while registering a type in a dependency container.
*/
class RegistrationException : Exception
{
this(string message, TypeInfo registrationType)
{
super(format("Exception while registering type %s: %s", registrationType.toString(), message));
}
}
/**
* Options which influence the process of registering dependencies
*/
public enum RegistrationOptions
{
/**
* When registering a type by its supertype, providing this option will also register
* a linked registration to the type itself.
*
* This allows you to resolve that type both by super type and concrete type using the
* same registration scope (and instance managed by this scope).
*/
ADD_CONCRETE_TYPE_REGISTRATION
}
/**
* The dependency container maintains all dependencies registered with it.
*
* Dependencies registered by a container can be resolved as long as they are still registered with the container.
* Upon resolving a dependency, an instance is fetched according to a specific scope which dictates how instances of
* dependencies are created. Resolved dependencies will be injected before being returned.
*
* In most cases you want to use a global singleton dependency container provided by getInstance() to manage all dependencies.
* You can still create new instances of this class for exceptional situations.
*/
synchronized class Container
{
private Registration[][TypeInfo] registrations;
private Registration[] injectStack;
/**
* Register a dependency by concrete class type.
*
* A dependency registered by concrete class type can only be resolved by concrete class type.
* No qualifiers can be used when resolving dependencies which are registered by concrete type.
*
* The default registration scope is "single instance" scope.
*
* Returns:
* A registration is returned which can be used to change the registration scope.
*/
public Registration register(ConcreteType)()
{
return register!(ConcreteType, ConcreteType)();
}
/**
* Register a dependency by super type.
*
* A dependency registered by super type can only be resolved by super type. A qualifier is typically
* used to resolve dependencies registered by super type.
*
* The default registration scope is "single instance" scope.
*
* See_Also: singleInstance, newInstance, existingInstance, RegistrationOptions
*/
public Registration register(SuperType, ConcreteType : SuperType, RegistrationOptionsTuple...)(RegistrationOptionsTuple options)
{
TypeInfo registeredType = typeid(SuperType);
TypeInfo_Class concreteType = typeid(ConcreteType);
debug(skadiVerbose) {
writeln(format("DEBUG: Register type %s (as %s)", concreteType.toString(), registeredType.toString()));
}
auto existingRegistration = getExistingRegistration(registeredType, concreteType);
if (existingRegistration) {
return existingRegistration;
}
auto newRegistration = new InjectedRegistration!ConcreteType(registeredType, this);
newRegistration.singleInstance();
if (hasOption(options, RegistrationOptions.ADD_CONCRETE_TYPE_REGISTRATION)) {
static if (!is(SuperType == ConcreteType)) {
auto concreteTypeRegistration = register!ConcreteType;
concreteTypeRegistration.linkTo(newRegistration);
} else {
throw new RegistrationException("Option ADD_CONCRETE_TYPE_REGISTRATION cannot be used when registering a concrete type registration", concreteType);
}
}
registrations[registeredType] ~= cast(shared(Registration)) newRegistration;
return newRegistration;
}
private bool hasOption(RegistrationOptionsTuple...)(RegistrationOptionsTuple options, RegistrationOptions option)
{
foreach(presentOption ; options) {
if (presentOption == option) {
return true;
}
}
return false;
}
private Registration getExistingRegistration(TypeInfo registrationType, TypeInfo qualifierType)
{
auto existingCandidates = registrationType in registrations;
if (existingCandidates) {
return getRegistration(cast(Registration[]) *existingCandidates, qualifierType);
}
return null;
}
private Registration getRegistration(Registration[] candidates, TypeInfo concreteType)
{
foreach(existingRegistration ; candidates) {
if (existingRegistration.instantiatableType == concreteType) {
return existingRegistration;
}
}
return null;
}
/**
* Resolve dependencies.
*
* Dependencies can only resolved using this method if they are registered by concrete type or the only
* concrete type registered by super type.
*
* Resolved dependencies are automatically injected before being returned.
*
* Returns:
* An instance is returned which is created according to the registration scope with which they are registered.
*
* Throws:
* ResolveException when type is not registered.
* You need to use the resolve method which allows you to specify a qualifier.
*/
public RegistrationType resolve(RegistrationType)()
{
return resolve!(RegistrationType, RegistrationType)();
}
/**
* Resolve dependencies using a qualifier.
*
* Dependencies can only resolved using this method if they are registered by super type.
*
* Resolved dependencies are automatically injected before being returned.
*
* Returns:
* An instance is returned which is created according to the registration scope with which they are registered.
*
* Throws:
* ResolveException when type is not registered or there are multiple candidates available for type.
*/
public QualifierType resolve(RegistrationType, QualifierType : RegistrationType)()
{
TypeInfo resolveType = typeid(RegistrationType);
TypeInfo qualifierType = typeid(QualifierType);
debug(skadiVerbose) {
writeln("DEBUG: Resolving type " ~ resolveType.toString() ~ " with qualifier " ~ qualifierType.toString());
}
auto candidates = resolveType in registrations;
if (!candidates) {
throw new ResolveException("Type not registered.", resolveType);
}
Registration registration = getQualifiedRegistration(resolveType, qualifierType, cast(Registration[]) *candidates);
return resolveInjectedInstance!QualifierType(registration);
}
private QualifierType resolveInjectedInstance(QualifierType)(Registration registration)
{
QualifierType instance;
if (!(cast(Registration[]) injectStack).canFind(registration)) {
injectStack ~= cast(shared(Registration)) registration;
instance = cast(QualifierType) registration.getInstance(new InjectInstantiationContext());
injectStack = injectStack[0 .. $-1];
} else {
auto injectContext = new InjectInstantiationContext();
injectContext.injectInstance = false;
instance = cast(QualifierType) registration.getInstance(injectContext);
}
return instance;
}
/**
* Resolve all dependencies registered to a super type.
*
* Returns:
* An array of injected instances is returned. The order is undetermined.
*/
public RegistrationType[] resolveAll(RegistrationType)()
{
RegistrationType[] instances;
TypeInfo resolveType = typeid(RegistrationType);
auto qualifiedRegistrations = resolveType in registrations;
if (!qualifiedRegistrations) {
throw new ResolveException("Type not registered.", resolveType);
}
foreach(registration ; cast(Registration[]) *qualifiedRegistrations) {
instances ~= resolveInjectedInstance!RegistrationType(registration);
}
return instances;
}
private Registration getQualifiedRegistration(TypeInfo resolveType, TypeInfo qualifierType, Registration[] candidates)
{
if (resolveType == qualifierType) {
if (candidates.length > 1) {
string candidateList = candidates.toConcreteTypeListString();
throw new ResolveException("Multiple qualified candidates available: " ~ candidateList ~ ". Please use a qualifier.", resolveType);
}
return candidates[0];
}
return getRegistration(candidates, qualifierType);
}
/**
* Clears all dependency registrations managed by this container.
*/
public void clearAllRegistrations()
{
registrations.destroy();
}
/**
* Removes a registered dependency by type.
*
* A dependency can be removed either by super type or concrete type, depending on how they are registered.
*
*/
public void removeRegistration(RegistrationType)()
{
registrations.remove(typeid(RegistrationType));
}
/**
* Returns a global singleton instance of a dependency container.
*/
public static shared(Container) getInstance()
{
static shared Container instance;
if (instance is null) {
instance = new Container();
}
return instance;
}
}
| D |
module android.java.android.graphics.ColorSpace_Rgb_TransferParameters_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("ColorSpace$Rgb$TransferParameters")
final class ColorSpace_Rgb_TransferParameters : IJavaObject {
static immutable string[] _d_canCastTo = [
];
@Import this(double, double, double, double, double);
@Import this(double, double, double, double, double, double, double);
@Import bool equals(IJavaObject);
@Import int hashCode();
@Import import0.Class getClass();
@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/ColorSpace$Rgb$TransferParameters;";
}
| D |
import core.stdc.config;
import core.stdc.stdarg: va_list;
static import core.simd;
static import std.conv;
struct Int128 { long lower; long upper; }
struct UInt128 { ulong lower; ulong upper; }
struct __locale_data { int dummy; }
alias _Bool = bool;
struct dpp {
static struct Opaque(int N) {
void[N] bytes;
}
static bool isEmpty(T)() {
return T.tupleof.length == 0;
}
static struct Move(T) {
T* ptr;
}
static auto move(T)(ref T value) {
return Move!T(&value);
}
mixin template EnumD(string name, T, string prefix) if(is(T == enum)) {
private static string _memberMixinStr(string member) {
import std.conv: text;
import std.array: replace;
return text(` `, member.replace(prefix, ""), ` = `, T.stringof, `.`, member, `,`);
}
private static string _enumMixinStr() {
import std.array: join;
string[] ret;
ret ~= "enum " ~ name ~ "{";
static foreach(member; __traits(allMembers, T)) {
ret ~= _memberMixinStr(member);
}
ret ~= "}";
return ret.join("\n");
}
mixin(_enumMixinStr());
}
}
extern(C)
{
alias fsfilcnt_t = c_ulong;
alias fsblkcnt_t = c_ulong;
alias blkcnt_t = c_long;
alias blksize_t = c_long;
alias register_t = c_long;
alias u_int64_t = c_ulong;
alias u_int32_t = uint;
alias u_int16_t = ushort;
alias u_int8_t = ubyte;
alias key_t = int;
alias caddr_t = char*;
alias daddr_t = int;
alias ssize_t = c_long;
alias id_t = uint;
alias pid_t = int;
alias off_t = c_long;
alias uid_t = uint;
alias nlink_t = c_ulong;
alias mode_t = uint;
alias gid_t = uint;
alias dev_t = c_ulong;
alias ino_t = c_ulong;
alias loff_t = c_long;
alias fsid_t = __fsid_t;
alias u_quad_t = c_ulong;
alias quad_t = c_long;
alias u_long = c_ulong;
alias u_int = uint;
alias u_short = ushort;
alias u_char = ubyte;
c_ulong gnu_dev_makedev(uint, uint) @nogc nothrow;
uint gnu_dev_minor(c_ulong) @nogc nothrow;
uint gnu_dev_major(c_ulong) @nogc nothrow;
int pselect(int, fd_set*, fd_set*, fd_set*, const(timespec)*, const(__sigset_t)*) @nogc nothrow;
int select(int, fd_set*, fd_set*, fd_set*, timeval*) @nogc nothrow;
alias fd_mask = c_long;
struct fd_set
{
c_long[16] __fds_bits;
}
alias __fd_mask = c_long;
alias suseconds_t = c_long;
enum _Anonymous_0
{
P_ALL = 0,
P_PID = 1,
P_PGID = 2,
}
enum P_ALL = _Anonymous_0.P_ALL;
enum P_PID = _Anonymous_0.P_PID;
enum P_PGID = _Anonymous_0.P_PGID;
alias idtype_t = _Anonymous_0;
static c_ulong __uint64_identity(c_ulong) @nogc nothrow;
static uint __uint32_identity(uint) @nogc nothrow;
static ushort __uint16_identity(ushort) @nogc nothrow;
alias timer_t = void*;
alias time_t = c_long;
struct timeval
{
c_long tv_sec;
c_long tv_usec;
}
struct timespec
{
c_long tv_sec;
c_long tv_nsec;
}
alias sigset_t = __sigset_t;
alias clockid_t = int;
alias clock_t = c_long;
struct __sigset_t
{
c_ulong[16] __val;
}
alias __sig_atomic_t = int;
alias __socklen_t = uint;
alias __intptr_t = c_long;
alias __caddr_t = char*;
alias __loff_t = c_long;
alias __syscall_ulong_t = c_ulong;
alias __syscall_slong_t = c_long;
alias __ssize_t = c_long;
alias __fsword_t = c_long;
alias __fsfilcnt64_t = c_ulong;
alias __fsfilcnt_t = c_ulong;
alias __fsblkcnt64_t = c_ulong;
alias __fsblkcnt_t = c_ulong;
alias __blkcnt64_t = c_long;
alias __blkcnt_t = c_long;
alias __blksize_t = c_long;
alias __timer_t = void*;
alias __clockid_t = int;
alias __key_t = int;
alias __daddr_t = int;
alias __suseconds_t = c_long;
alias __useconds_t = uint;
alias __time_t = c_long;
alias __id_t = uint;
alias __rlim64_t = c_ulong;
alias __rlim_t = c_ulong;
alias __clock_t = c_long;
struct __fsid_t
{
int[2] __val;
}
alias __pid_t = int;
alias __off64_t = c_long;
alias __off_t = c_long;
alias __nlink_t = c_ulong;
alias __mode_t = uint;
alias __ino64_t = c_ulong;
alias __ino_t = c_ulong;
alias __gid_t = uint;
alias __uid_t = uint;
alias __dev_t = c_ulong;
alias __uintmax_t = c_ulong;
alias __intmax_t = c_long;
alias __u_quad_t = c_ulong;
alias __quad_t = c_long;
alias __uint64_t = c_ulong;
alias __int64_t = c_long;
alias __uint32_t = uint;
alias __int32_t = int;
alias __uint16_t = ushort;
alias __int16_t = short;
alias __uint8_t = ubyte;
alias __int8_t = byte;
alias __u_long = c_ulong;
alias __u_int = uint;
alias __u_short = ushort;
alias __u_char = ubyte;
struct __pthread_cond_s
{
static union _Anonymous_1
{
ulong __wseq;
static struct _Anonymous_2
{
uint __low;
uint __high;
}
_Anonymous_2 __wseq32;
}
_Anonymous_1 _anonymous_3;
auto __wseq() @property @nogc pure nothrow { return _anonymous_3.__wseq; }
void __wseq(_T_)(auto ref _T_ val) @property @nogc pure nothrow { _anonymous_3.__wseq = val; }
auto __wseq32() @property @nogc pure nothrow { return _anonymous_3.__wseq32; }
void __wseq32(_T_)(auto ref _T_ val) @property @nogc pure nothrow { _anonymous_3.__wseq32 = val; }
static union _Anonymous_4
{
ulong __g1_start;
static struct _Anonymous_5
{
uint __low;
uint __high;
}
_Anonymous_5 __g1_start32;
}
_Anonymous_4 _anonymous_6;
auto __g1_start() @property @nogc pure nothrow { return _anonymous_6.__g1_start; }
void __g1_start(_T_)(auto ref _T_ val) @property @nogc pure nothrow { _anonymous_6.__g1_start = val; }
auto __g1_start32() @property @nogc pure nothrow { return _anonymous_6.__g1_start32; }
void __g1_start32(_T_)(auto ref _T_ val) @property @nogc pure nothrow { _anonymous_6.__g1_start32 = val; }
uint[2] __g_refs;
uint[2] __g_size;
uint __g1_orig_size;
uint __wrefs;
uint[2] __g_signals;
}
struct __pthread_mutex_s
{
int __lock;
uint __count;
int __owner;
uint __nusers;
int __kind;
short __spins;
short __elision;
__pthread_internal_list __list;
}
struct __pthread_internal_list
{
__pthread_internal_list* __prev;
__pthread_internal_list* __next;
}
alias __pthread_list_t = __pthread_internal_list;
struct WrenVM;
struct WrenHandle;
alias WrenReallocateFn = void* function(void*, c_ulong);
alias WrenForeignMethodFn = void function(WrenVM*);
alias WrenFinalizerFn = void function(void*);
alias WrenResolveModuleFn = const(char)* function(WrenVM*, const(char)*, const(char)*);
alias WrenLoadModuleFn = char* function(WrenVM*, const(char)*);
alias WrenBindForeignMethodFn = void function(WrenVM*) function(WrenVM*, const(char)*, const(char)*, bool, const(char)*);
alias WrenWriteFn = void function(WrenVM*, const(char)*);
alias WrenErrorType = _Anonymous_7;
enum _Anonymous_7
{
WREN_ERROR_COMPILE = 0,
WREN_ERROR_RUNTIME = 1,
WREN_ERROR_STACK_TRACE = 2,
}
enum WREN_ERROR_COMPILE = _Anonymous_7.WREN_ERROR_COMPILE;
enum WREN_ERROR_RUNTIME = _Anonymous_7.WREN_ERROR_RUNTIME;
enum WREN_ERROR_STACK_TRACE = _Anonymous_7.WREN_ERROR_STACK_TRACE;
alias WrenErrorFn = void function(WrenVM*, WrenErrorType, const(char)*, int, const(char)*);
struct WrenForeignClassMethods
{
void function(WrenVM*) allocate;
void function(void*) finalize;
}
alias WrenBindForeignClassFn = WrenForeignClassMethods function(WrenVM*, const(char)*, const(char)*);
struct WrenConfiguration
{
void* function(void*, c_ulong) reallocateFn;
const(char)* function(WrenVM*, const(char)*, const(char)*) resolveModuleFn;
char* function(WrenVM*, const(char)*) loadModuleFn;
void function(WrenVM*) function(WrenVM*, const(char)*, const(char)*, bool, const(char)*) bindForeignMethodFn;
WrenForeignClassMethods function(WrenVM*, const(char)*, const(char)*) bindForeignClassFn;
void function(WrenVM*, const(char)*) writeFn;
void function(WrenVM*, WrenErrorType, const(char)*, int, const(char)*) errorFn;
c_ulong initialHeapSize;
c_ulong minHeapSize;
int heapGrowthPercent;
void* userData;
}
alias WrenInterpretResult = _Anonymous_8;
enum _Anonymous_8
{
WREN_RESULT_SUCCESS = 0,
WREN_RESULT_COMPILE_ERROR = 1,
WREN_RESULT_RUNTIME_ERROR = 2,
}
enum WREN_RESULT_SUCCESS = _Anonymous_8.WREN_RESULT_SUCCESS;
enum WREN_RESULT_COMPILE_ERROR = _Anonymous_8.WREN_RESULT_COMPILE_ERROR;
enum WREN_RESULT_RUNTIME_ERROR = _Anonymous_8.WREN_RESULT_RUNTIME_ERROR;
alias WrenType = _Anonymous_9;
enum _Anonymous_9
{
WREN_TYPE_BOOL = 0,
WREN_TYPE_NUM = 1,
WREN_TYPE_FOREIGN = 2,
WREN_TYPE_LIST = 3,
WREN_TYPE_NULL = 4,
WREN_TYPE_STRING = 5,
WREN_TYPE_UNKNOWN = 6,
}
enum WREN_TYPE_BOOL = _Anonymous_9.WREN_TYPE_BOOL;
enum WREN_TYPE_NUM = _Anonymous_9.WREN_TYPE_NUM;
enum WREN_TYPE_FOREIGN = _Anonymous_9.WREN_TYPE_FOREIGN;
enum WREN_TYPE_LIST = _Anonymous_9.WREN_TYPE_LIST;
enum WREN_TYPE_NULL = _Anonymous_9.WREN_TYPE_NULL;
enum WREN_TYPE_STRING = _Anonymous_9.WREN_TYPE_STRING;
enum WREN_TYPE_UNKNOWN = _Anonymous_9.WREN_TYPE_UNKNOWN;
void wrenInitConfiguration(WrenConfiguration*) @nogc nothrow;
WrenVM* wrenNewVM(WrenConfiguration*) @nogc nothrow;
void wrenFreeVM(WrenVM*) @nogc nothrow;
void wrenCollectGarbage(WrenVM*) @nogc nothrow;
WrenInterpretResult wrenInterpret(WrenVM*, const(char)*, const(char)*) @nogc nothrow;
WrenHandle* wrenMakeCallHandle(WrenVM*, const(char)*) @nogc nothrow;
WrenInterpretResult wrenCall(WrenVM*, WrenHandle*) @nogc nothrow;
void wrenReleaseHandle(WrenVM*, WrenHandle*) @nogc nothrow;
int wrenGetSlotCount(WrenVM*) @nogc nothrow;
void wrenEnsureSlots(WrenVM*, int) @nogc nothrow;
WrenType wrenGetSlotType(WrenVM*, int) @nogc nothrow;
bool wrenGetSlotBool(WrenVM*, int) @nogc nothrow;
const(char)* wrenGetSlotBytes(WrenVM*, int, int*) @nogc nothrow;
double wrenGetSlotDouble(WrenVM*, int) @nogc nothrow;
void* wrenGetSlotForeign(WrenVM*, int) @nogc nothrow;
const(char)* wrenGetSlotString(WrenVM*, int) @nogc nothrow;
WrenHandle* wrenGetSlotHandle(WrenVM*, int) @nogc nothrow;
void wrenSetSlotBool(WrenVM*, int, bool) @nogc nothrow;
void wrenSetSlotBytes(WrenVM*, int, const(char)*, c_ulong) @nogc nothrow;
void wrenSetSlotDouble(WrenVM*, int, double) @nogc nothrow;
void* wrenSetSlotNewForeign(WrenVM*, int, int, c_ulong) @nogc nothrow;
void wrenSetSlotNewList(WrenVM*, int) @nogc nothrow;
void wrenSetSlotNull(WrenVM*, int) @nogc nothrow;
void wrenSetSlotString(WrenVM*, int, const(char)*) @nogc nothrow;
void wrenSetSlotHandle(WrenVM*, int, WrenHandle*) @nogc nothrow;
int wrenGetListCount(WrenVM*, int) @nogc nothrow;
void wrenGetListElement(WrenVM*, int, int, int) @nogc nothrow;
void wrenInsertInList(WrenVM*, int, int, int) @nogc nothrow;
void wrenGetVariable(WrenVM*, const(char)*, const(char)*, int) @nogc nothrow;
void wrenAbortFiber(WrenVM*, int) @nogc nothrow;
void* wrenGetUserData(WrenVM*) @nogc nothrow;
void wrenSetUserData(WrenVM*, void*) @nogc nothrow;
alias int64_t = c_long;
alias int32_t = int;
pragma(mangle, "alloca") void* alloca_(c_ulong) @nogc nothrow;
alias int16_t = short;
alias int8_t = byte;
union pthread_barrierattr_t
{
char[4] __size;
int __align;
}
union pthread_barrier_t
{
char[32] __size;
c_long __align;
}
alias pthread_spinlock_t = int;
alias size_t = c_ulong;
alias wchar_t = int;
union pthread_rwlockattr_t
{
char[8] __size;
c_long __align;
}
union pthread_rwlock_t
{
__pthread_rwlock_arch_t __data;
char[56] __size;
c_long __align;
}
union pthread_cond_t
{
__pthread_cond_s __data;
char[48] __size;
long __align;
}
union pthread_mutex_t
{
__pthread_mutex_s __data;
char[40] __size;
c_long __align;
}
union pthread_attr_t
{
char[56] __size;
c_long __align;
}
alias pthread_once_t = int;
alias pthread_key_t = uint;
union pthread_condattr_t
{
char[4] __size;
int __align;
}
union pthread_mutexattr_t
{
char[4] __size;
int __align;
}
alias pthread_t = c_ulong;
struct __pthread_rwlock_arch_t
{
uint __readers;
uint __writers;
uint __wrphase_futex;
uint __writers_futex;
uint __pad3;
uint __pad4;
int __cur_writer;
int __shared;
byte __rwelision;
ubyte[7] __pad1;
c_ulong __pad2;
uint __flags;
}
alias _Float64x = real;
alias _Float32x = double;
alias _Float64 = double;
alias _Float32 = float;
struct div_t
{
int quot;
int rem;
}
struct ldiv_t
{
c_long quot;
c_long rem;
}
struct lldiv_t
{
long quot;
long rem;
}
c_ulong __ctype_get_mb_cur_max() @nogc nothrow;
double atof(const(char)*) @nogc nothrow;
int atoi(const(char)*) @nogc nothrow;
c_long atol(const(char)*) @nogc nothrow;
long atoll(const(char)*) @nogc nothrow;
double strtod(const(char)*, char**) @nogc nothrow;
float strtof(const(char)*, char**) @nogc nothrow;
real strtold(const(char)*, char**) @nogc nothrow;
c_long strtol(const(char)*, char**, int) @nogc nothrow;
c_ulong strtoul(const(char)*, char**, int) @nogc nothrow;
long strtoq(const(char)*, char**, int) @nogc nothrow;
ulong strtouq(const(char)*, char**, int) @nogc nothrow;
long strtoll(const(char)*, char**, int) @nogc nothrow;
ulong strtoull(const(char)*, char**, int) @nogc nothrow;
char* l64a(c_long) @nogc nothrow;
c_long a64l(const(char)*) @nogc nothrow;
c_long random() @nogc nothrow;
void srandom(uint) @nogc nothrow;
char* initstate(uint, char*, c_ulong) @nogc nothrow;
char* setstate(char*) @nogc nothrow;
struct random_data
{
int* fptr;
int* rptr;
int* state;
int rand_type;
int rand_deg;
int rand_sep;
int* end_ptr;
}
int random_r(random_data*, int*) @nogc nothrow;
int srandom_r(uint, random_data*) @nogc nothrow;
int initstate_r(uint, char*, c_ulong, random_data*) @nogc nothrow;
int setstate_r(char*, random_data*) @nogc nothrow;
int rand() @nogc nothrow;
void srand(uint) @nogc nothrow;
int rand_r(uint*) @nogc nothrow;
double drand48() @nogc nothrow;
double erand48(ushort*) @nogc nothrow;
c_long lrand48() @nogc nothrow;
c_long nrand48(ushort*) @nogc nothrow;
c_long mrand48() @nogc nothrow;
c_long jrand48(ushort*) @nogc nothrow;
void srand48(c_long) @nogc nothrow;
ushort* seed48(ushort*) @nogc nothrow;
void lcong48(ushort*) @nogc nothrow;
struct drand48_data
{
ushort[3] __x;
ushort[3] __old_x;
ushort __c;
ushort __init;
ulong __a;
}
int drand48_r(drand48_data*, double*) @nogc nothrow;
int erand48_r(ushort*, drand48_data*, double*) @nogc nothrow;
int lrand48_r(drand48_data*, c_long*) @nogc nothrow;
int nrand48_r(ushort*, drand48_data*, c_long*) @nogc nothrow;
int mrand48_r(drand48_data*, c_long*) @nogc nothrow;
int jrand48_r(ushort*, drand48_data*, c_long*) @nogc nothrow;
int srand48_r(c_long, drand48_data*) @nogc nothrow;
int seed48_r(ushort*, drand48_data*) @nogc nothrow;
int lcong48_r(ushort*, drand48_data*) @nogc nothrow;
void* malloc(c_ulong) @nogc nothrow;
void* calloc(c_ulong, c_ulong) @nogc nothrow;
void* realloc(void*, c_ulong) @nogc nothrow;
void free(void*) @nogc nothrow;
void* valloc(c_ulong) @nogc nothrow;
int posix_memalign(void**, c_ulong, c_ulong) @nogc nothrow;
void* aligned_alloc(c_ulong, c_ulong) @nogc nothrow;
void abort() @nogc nothrow;
int atexit(void function()) @nogc nothrow;
int at_quick_exit(void function()) @nogc nothrow;
int on_exit(void function(int, void*), void*) @nogc nothrow;
void exit(int) @nogc nothrow;
void quick_exit(int) @nogc nothrow;
void _Exit(int) @nogc nothrow;
char* getenv(const(char)*) @nogc nothrow;
int putenv(char*) @nogc nothrow;
int setenv(const(char)*, const(char)*, int) @nogc nothrow;
int unsetenv(const(char)*) @nogc nothrow;
int clearenv() @nogc nothrow;
char* mktemp(char*) @nogc nothrow;
int mkstemp(char*) @nogc nothrow;
int mkstemps(char*, int) @nogc nothrow;
char* mkdtemp(char*) @nogc nothrow;
int system(const(char)*) @nogc nothrow;
char* realpath(const(char)*, char*) @nogc nothrow;
alias __compar_fn_t = int function(const(void)*, const(void)*);
void* bsearch(const(void)*, const(void)*, c_ulong, c_ulong, int function(const(void)*, const(void)*)) @nogc nothrow;
void qsort(void*, c_ulong, c_ulong, int function(const(void)*, const(void)*)) @nogc nothrow;
int abs(int) @nogc nothrow;
c_long labs(c_long) @nogc nothrow;
long llabs(long) @nogc nothrow;
div_t div(int, int) @nogc nothrow;
ldiv_t ldiv(c_long, c_long) @nogc nothrow;
lldiv_t lldiv(long, long) @nogc nothrow;
char* ecvt(double, int, int*, int*) @nogc nothrow;
char* fcvt(double, int, int*, int*) @nogc nothrow;
char* gcvt(double, int, char*) @nogc nothrow;
char* qecvt(real, int, int*, int*) @nogc nothrow;
char* qfcvt(real, int, int*, int*) @nogc nothrow;
char* qgcvt(real, int, char*) @nogc nothrow;
int ecvt_r(double, int, int*, int*, char*, c_ulong) @nogc nothrow;
int fcvt_r(double, int, int*, int*, char*, c_ulong) @nogc nothrow;
int qecvt_r(real, int, int*, int*, char*, c_ulong) @nogc nothrow;
int qfcvt_r(real, int, int*, int*, char*, c_ulong) @nogc nothrow;
int mblen(const(char)*, c_ulong) @nogc nothrow;
int mbtowc(int*, const(char)*, c_ulong) @nogc nothrow;
int wctomb(char*, int) @nogc nothrow;
c_ulong mbstowcs(int*, const(char)*, c_ulong) @nogc nothrow;
c_ulong wcstombs(char*, const(int)*, c_ulong) @nogc nothrow;
int rpmatch(const(char)*) @nogc nothrow;
int getsubopt(char**, char**, char**) @nogc nothrow;
int getloadavg(double*, int) @nogc nothrow;
static if(!is(typeof(__HAVE_FLOAT32X))) {
private enum enumMixinStr___HAVE_FLOAT32X = `enum __HAVE_FLOAT32X = 1;`;
static if(is(typeof({ mixin(enumMixinStr___HAVE_FLOAT32X); }))) {
mixin(enumMixinStr___HAVE_FLOAT32X);
}
}
static if(!is(typeof(__HAVE_FLOAT128X))) {
private enum enumMixinStr___HAVE_FLOAT128X = `enum __HAVE_FLOAT128X = 0;`;
static if(is(typeof({ mixin(enumMixinStr___HAVE_FLOAT128X); }))) {
mixin(enumMixinStr___HAVE_FLOAT128X);
}
}
static if(!is(typeof(__HAVE_DISTINCT_FLOAT16))) {
private enum enumMixinStr___HAVE_DISTINCT_FLOAT16 = `enum __HAVE_DISTINCT_FLOAT16 = __HAVE_FLOAT16;`;
static if(is(typeof({ mixin(enumMixinStr___HAVE_DISTINCT_FLOAT16); }))) {
mixin(enumMixinStr___HAVE_DISTINCT_FLOAT16);
}
}
static if(!is(typeof(__HAVE_DISTINCT_FLOAT32))) {
private enum enumMixinStr___HAVE_DISTINCT_FLOAT32 = `enum __HAVE_DISTINCT_FLOAT32 = 0;`;
static if(is(typeof({ mixin(enumMixinStr___HAVE_DISTINCT_FLOAT32); }))) {
mixin(enumMixinStr___HAVE_DISTINCT_FLOAT32);
}
}
static if(!is(typeof(__HAVE_DISTINCT_FLOAT64))) {
private enum enumMixinStr___HAVE_DISTINCT_FLOAT64 = `enum __HAVE_DISTINCT_FLOAT64 = 0;`;
static if(is(typeof({ mixin(enumMixinStr___HAVE_DISTINCT_FLOAT64); }))) {
mixin(enumMixinStr___HAVE_DISTINCT_FLOAT64);
}
}
static if(!is(typeof(__HAVE_DISTINCT_FLOAT32X))) {
private enum enumMixinStr___HAVE_DISTINCT_FLOAT32X = `enum __HAVE_DISTINCT_FLOAT32X = 0;`;
static if(is(typeof({ mixin(enumMixinStr___HAVE_DISTINCT_FLOAT32X); }))) {
mixin(enumMixinStr___HAVE_DISTINCT_FLOAT32X);
}
}
static if(!is(typeof(__HAVE_DISTINCT_FLOAT64X))) {
private enum enumMixinStr___HAVE_DISTINCT_FLOAT64X = `enum __HAVE_DISTINCT_FLOAT64X = 0;`;
static if(is(typeof({ mixin(enumMixinStr___HAVE_DISTINCT_FLOAT64X); }))) {
mixin(enumMixinStr___HAVE_DISTINCT_FLOAT64X);
}
}
static if(!is(typeof(__HAVE_DISTINCT_FLOAT128X))) {
private enum enumMixinStr___HAVE_DISTINCT_FLOAT128X = `enum __HAVE_DISTINCT_FLOAT128X = 0;`;
static if(is(typeof({ mixin(enumMixinStr___HAVE_DISTINCT_FLOAT128X); }))) {
mixin(enumMixinStr___HAVE_DISTINCT_FLOAT128X);
}
}
static if(!is(typeof(__HAVE_FLOAT64))) {
private enum enumMixinStr___HAVE_FLOAT64 = `enum __HAVE_FLOAT64 = 1;`;
static if(is(typeof({ mixin(enumMixinStr___HAVE_FLOAT64); }))) {
mixin(enumMixinStr___HAVE_FLOAT64);
}
}
static if(!is(typeof(__HAVE_FLOATN_NOT_TYPEDEF))) {
private enum enumMixinStr___HAVE_FLOATN_NOT_TYPEDEF = `enum __HAVE_FLOATN_NOT_TYPEDEF = 0;`;
static if(is(typeof({ mixin(enumMixinStr___HAVE_FLOATN_NOT_TYPEDEF); }))) {
mixin(enumMixinStr___HAVE_FLOATN_NOT_TYPEDEF);
}
}
static if(!is(typeof(__HAVE_FLOAT32))) {
private enum enumMixinStr___HAVE_FLOAT32 = `enum __HAVE_FLOAT32 = 1;`;
static if(is(typeof({ mixin(enumMixinStr___HAVE_FLOAT32); }))) {
mixin(enumMixinStr___HAVE_FLOAT32);
}
}
static if(!is(typeof(__HAVE_FLOAT16))) {
private enum enumMixinStr___HAVE_FLOAT16 = `enum __HAVE_FLOAT16 = 0;`;
static if(is(typeof({ mixin(enumMixinStr___HAVE_FLOAT16); }))) {
mixin(enumMixinStr___HAVE_FLOAT16);
}
}
static if(!is(typeof(__BYTE_ORDER))) {
private enum enumMixinStr___BYTE_ORDER = `enum __BYTE_ORDER = __LITTLE_ENDIAN;`;
static if(is(typeof({ mixin(enumMixinStr___BYTE_ORDER); }))) {
mixin(enumMixinStr___BYTE_ORDER);
}
}
static if(!is(typeof(_BITS_BYTESWAP_H))) {
private enum enumMixinStr__BITS_BYTESWAP_H = `enum _BITS_BYTESWAP_H = 1;`;
static if(is(typeof({ mixin(enumMixinStr__BITS_BYTESWAP_H); }))) {
mixin(enumMixinStr__BITS_BYTESWAP_H);
}
}
static if(!is(typeof(MB_CUR_MAX))) {
private enum enumMixinStr_MB_CUR_MAX = `enum MB_CUR_MAX = ( __ctype_get_mb_cur_max ( ) );`;
static if(is(typeof({ mixin(enumMixinStr_MB_CUR_MAX); }))) {
mixin(enumMixinStr_MB_CUR_MAX);
}
}
static if(!is(typeof(EXIT_SUCCESS))) {
private enum enumMixinStr_EXIT_SUCCESS = `enum EXIT_SUCCESS = 0;`;
static if(is(typeof({ mixin(enumMixinStr_EXIT_SUCCESS); }))) {
mixin(enumMixinStr_EXIT_SUCCESS);
}
}
static if(!is(typeof(__CFLOAT32))) {
private enum enumMixinStr___CFLOAT32 = `enum __CFLOAT32 = _Complex float;`;
static if(is(typeof({ mixin(enumMixinStr___CFLOAT32); }))) {
mixin(enumMixinStr___CFLOAT32);
}
}
static if(!is(typeof(EXIT_FAILURE))) {
private enum enumMixinStr_EXIT_FAILURE = `enum EXIT_FAILURE = 1;`;
static if(is(typeof({ mixin(enumMixinStr_EXIT_FAILURE); }))) {
mixin(enumMixinStr_EXIT_FAILURE);
}
}
static if(!is(typeof(RAND_MAX))) {
private enum enumMixinStr_RAND_MAX = `enum RAND_MAX = 2147483647;`;
static if(is(typeof({ mixin(enumMixinStr_RAND_MAX); }))) {
mixin(enumMixinStr_RAND_MAX);
}
}
static if(!is(typeof(__CFLOAT64))) {
private enum enumMixinStr___CFLOAT64 = `enum __CFLOAT64 = _Complex double;`;
static if(is(typeof({ mixin(enumMixinStr___CFLOAT64); }))) {
mixin(enumMixinStr___CFLOAT64);
}
}
static if(!is(typeof(__lldiv_t_defined))) {
private enum enumMixinStr___lldiv_t_defined = `enum __lldiv_t_defined = 1;`;
static if(is(typeof({ mixin(enumMixinStr___lldiv_t_defined); }))) {
mixin(enumMixinStr___lldiv_t_defined);
}
}
static if(!is(typeof(__ldiv_t_defined))) {
private enum enumMixinStr___ldiv_t_defined = `enum __ldiv_t_defined = 1;`;
static if(is(typeof({ mixin(enumMixinStr___ldiv_t_defined); }))) {
mixin(enumMixinStr___ldiv_t_defined);
}
}
static if(!is(typeof(__CFLOAT32X))) {
private enum enumMixinStr___CFLOAT32X = `enum __CFLOAT32X = _Complex double;`;
static if(is(typeof({ mixin(enumMixinStr___CFLOAT32X); }))) {
mixin(enumMixinStr___CFLOAT32X);
}
}
static if(!is(typeof(__CFLOAT64X))) {
private enum enumMixinStr___CFLOAT64X = `enum __CFLOAT64X = _Complex long double;`;
static if(is(typeof({ mixin(enumMixinStr___CFLOAT64X); }))) {
mixin(enumMixinStr___CFLOAT64X);
}
}
static if(!is(typeof(_STDLIB_H))) {
private enum enumMixinStr__STDLIB_H = `enum _STDLIB_H = 1;`;
static if(is(typeof({ mixin(enumMixinStr__STDLIB_H); }))) {
mixin(enumMixinStr__STDLIB_H);
}
}
static if(!is(typeof(_STDC_PREDEF_H))) {
private enum enumMixinStr__STDC_PREDEF_H = `enum _STDC_PREDEF_H = 1;`;
static if(is(typeof({ mixin(enumMixinStr__STDC_PREDEF_H); }))) {
mixin(enumMixinStr__STDC_PREDEF_H);
}
}
static if(!is(typeof(__GLIBC_MINOR__))) {
private enum enumMixinStr___GLIBC_MINOR__ = `enum __GLIBC_MINOR__ = 27;`;
static if(is(typeof({ mixin(enumMixinStr___GLIBC_MINOR__); }))) {
mixin(enumMixinStr___GLIBC_MINOR__);
}
}
static if(!is(typeof(__GLIBC__))) {
private enum enumMixinStr___GLIBC__ = `enum __GLIBC__ = 2;`;
static if(is(typeof({ mixin(enumMixinStr___GLIBC__); }))) {
mixin(enumMixinStr___GLIBC__);
}
}
static if(!is(typeof(__GNU_LIBRARY__))) {
private enum enumMixinStr___GNU_LIBRARY__ = `enum __GNU_LIBRARY__ = 6;`;
static if(is(typeof({ mixin(enumMixinStr___GNU_LIBRARY__); }))) {
mixin(enumMixinStr___GNU_LIBRARY__);
}
}
static if(!is(typeof(__GLIBC_USE_DEPRECATED_GETS))) {
private enum enumMixinStr___GLIBC_USE_DEPRECATED_GETS = `enum __GLIBC_USE_DEPRECATED_GETS = 0;`;
static if(is(typeof({ mixin(enumMixinStr___GLIBC_USE_DEPRECATED_GETS); }))) {
mixin(enumMixinStr___GLIBC_USE_DEPRECATED_GETS);
}
}
static if(!is(typeof(__USE_FORTIFY_LEVEL))) {
private enum enumMixinStr___USE_FORTIFY_LEVEL = `enum __USE_FORTIFY_LEVEL = 0;`;
static if(is(typeof({ mixin(enumMixinStr___USE_FORTIFY_LEVEL); }))) {
mixin(enumMixinStr___USE_FORTIFY_LEVEL);
}
}
static if(!is(typeof(__USE_ATFILE))) {
private enum enumMixinStr___USE_ATFILE = `enum __USE_ATFILE = 1;`;
static if(is(typeof({ mixin(enumMixinStr___USE_ATFILE); }))) {
mixin(enumMixinStr___USE_ATFILE);
}
}
static if(!is(typeof(__USE_MISC))) {
private enum enumMixinStr___USE_MISC = `enum __USE_MISC = 1;`;
static if(is(typeof({ mixin(enumMixinStr___USE_MISC); }))) {
mixin(enumMixinStr___USE_MISC);
}
}
static if(!is(typeof(_ATFILE_SOURCE))) {
private enum enumMixinStr__ATFILE_SOURCE = `enum _ATFILE_SOURCE = 1;`;
static if(is(typeof({ mixin(enumMixinStr__ATFILE_SOURCE); }))) {
mixin(enumMixinStr__ATFILE_SOURCE);
}
}
static if(!is(typeof(__USE_XOPEN2K8))) {
private enum enumMixinStr___USE_XOPEN2K8 = `enum __USE_XOPEN2K8 = 1;`;
static if(is(typeof({ mixin(enumMixinStr___USE_XOPEN2K8); }))) {
mixin(enumMixinStr___USE_XOPEN2K8);
}
}
static if(!is(typeof(__USE_ISOC99))) {
private enum enumMixinStr___USE_ISOC99 = `enum __USE_ISOC99 = 1;`;
static if(is(typeof({ mixin(enumMixinStr___USE_ISOC99); }))) {
mixin(enumMixinStr___USE_ISOC99);
}
}
static if(!is(typeof(__HAVE_FLOAT128))) {
private enum enumMixinStr___HAVE_FLOAT128 = `enum __HAVE_FLOAT128 = 0;`;
static if(is(typeof({ mixin(enumMixinStr___HAVE_FLOAT128); }))) {
mixin(enumMixinStr___HAVE_FLOAT128);
}
}
static if(!is(typeof(__USE_ISOC95))) {
private enum enumMixinStr___USE_ISOC95 = `enum __USE_ISOC95 = 1;`;
static if(is(typeof({ mixin(enumMixinStr___USE_ISOC95); }))) {
mixin(enumMixinStr___USE_ISOC95);
}
}
static if(!is(typeof(__HAVE_DISTINCT_FLOAT128))) {
private enum enumMixinStr___HAVE_DISTINCT_FLOAT128 = `enum __HAVE_DISTINCT_FLOAT128 = 0;`;
static if(is(typeof({ mixin(enumMixinStr___HAVE_DISTINCT_FLOAT128); }))) {
mixin(enumMixinStr___HAVE_DISTINCT_FLOAT128);
}
}
static if(!is(typeof(__HAVE_FLOAT64X))) {
private enum enumMixinStr___HAVE_FLOAT64X = `enum __HAVE_FLOAT64X = 1;`;
static if(is(typeof({ mixin(enumMixinStr___HAVE_FLOAT64X); }))) {
mixin(enumMixinStr___HAVE_FLOAT64X);
}
}
static if(!is(typeof(__HAVE_FLOAT64X_LONG_DOUBLE))) {
private enum enumMixinStr___HAVE_FLOAT64X_LONG_DOUBLE = `enum __HAVE_FLOAT64X_LONG_DOUBLE = 1;`;
static if(is(typeof({ mixin(enumMixinStr___HAVE_FLOAT64X_LONG_DOUBLE); }))) {
mixin(enumMixinStr___HAVE_FLOAT64X_LONG_DOUBLE);
}
}
static if(!is(typeof(__USE_XOPEN2K))) {
private enum enumMixinStr___USE_XOPEN2K = `enum __USE_XOPEN2K = 1;`;
static if(is(typeof({ mixin(enumMixinStr___USE_XOPEN2K); }))) {
mixin(enumMixinStr___USE_XOPEN2K);
}
}
static if(!is(typeof(__USE_POSIX199506))) {
private enum enumMixinStr___USE_POSIX199506 = `enum __USE_POSIX199506 = 1;`;
static if(is(typeof({ mixin(enumMixinStr___USE_POSIX199506); }))) {
mixin(enumMixinStr___USE_POSIX199506);
}
}
static if(!is(typeof(__USE_POSIX199309))) {
private enum enumMixinStr___USE_POSIX199309 = `enum __USE_POSIX199309 = 1;`;
static if(is(typeof({ mixin(enumMixinStr___USE_POSIX199309); }))) {
mixin(enumMixinStr___USE_POSIX199309);
}
}
static if(!is(typeof(__USE_POSIX2))) {
private enum enumMixinStr___USE_POSIX2 = `enum __USE_POSIX2 = 1;`;
static if(is(typeof({ mixin(enumMixinStr___USE_POSIX2); }))) {
mixin(enumMixinStr___USE_POSIX2);
}
}
static if(!is(typeof(__USE_POSIX))) {
private enum enumMixinStr___USE_POSIX = `enum __USE_POSIX = 1;`;
static if(is(typeof({ mixin(enumMixinStr___USE_POSIX); }))) {
mixin(enumMixinStr___USE_POSIX);
}
}
static if(!is(typeof(_POSIX_C_SOURCE))) {
private enum enumMixinStr__POSIX_C_SOURCE = `enum _POSIX_C_SOURCE = 200809L;`;
static if(is(typeof({ mixin(enumMixinStr__POSIX_C_SOURCE); }))) {
mixin(enumMixinStr__POSIX_C_SOURCE);
}
}
static if(!is(typeof(__GLIBC_USE_LIB_EXT2))) {
private enum enumMixinStr___GLIBC_USE_LIB_EXT2 = `enum __GLIBC_USE_LIB_EXT2 = 0;`;
static if(is(typeof({ mixin(enumMixinStr___GLIBC_USE_LIB_EXT2); }))) {
mixin(enumMixinStr___GLIBC_USE_LIB_EXT2);
}
}
static if(!is(typeof(__GLIBC_USE_IEC_60559_BFP_EXT))) {
private enum enumMixinStr___GLIBC_USE_IEC_60559_BFP_EXT = `enum __GLIBC_USE_IEC_60559_BFP_EXT = 0;`;
static if(is(typeof({ mixin(enumMixinStr___GLIBC_USE_IEC_60559_BFP_EXT); }))) {
mixin(enumMixinStr___GLIBC_USE_IEC_60559_BFP_EXT);
}
}
static if(!is(typeof(__GLIBC_USE_IEC_60559_FUNCS_EXT))) {
private enum enumMixinStr___GLIBC_USE_IEC_60559_FUNCS_EXT = `enum __GLIBC_USE_IEC_60559_FUNCS_EXT = 0;`;
static if(is(typeof({ mixin(enumMixinStr___GLIBC_USE_IEC_60559_FUNCS_EXT); }))) {
mixin(enumMixinStr___GLIBC_USE_IEC_60559_FUNCS_EXT);
}
}
static if(!is(typeof(__GLIBC_USE_IEC_60559_TYPES_EXT))) {
private enum enumMixinStr___GLIBC_USE_IEC_60559_TYPES_EXT = `enum __GLIBC_USE_IEC_60559_TYPES_EXT = 0;`;
static if(is(typeof({ mixin(enumMixinStr___GLIBC_USE_IEC_60559_TYPES_EXT); }))) {
mixin(enumMixinStr___GLIBC_USE_IEC_60559_TYPES_EXT);
}
}
static if(!is(typeof(_BITS_PTHREADTYPES_ARCH_H))) {
private enum enumMixinStr__BITS_PTHREADTYPES_ARCH_H = `enum _BITS_PTHREADTYPES_ARCH_H = 1;`;
static if(is(typeof({ mixin(enumMixinStr__BITS_PTHREADTYPES_ARCH_H); }))) {
mixin(enumMixinStr__BITS_PTHREADTYPES_ARCH_H);
}
}
static if(!is(typeof(_POSIX_SOURCE))) {
private enum enumMixinStr__POSIX_SOURCE = `enum _POSIX_SOURCE = 1;`;
static if(is(typeof({ mixin(enumMixinStr__POSIX_SOURCE); }))) {
mixin(enumMixinStr__POSIX_SOURCE);
}
}
static if(!is(typeof(__USE_POSIX_IMPLICITLY))) {
private enum enumMixinStr___USE_POSIX_IMPLICITLY = `enum __USE_POSIX_IMPLICITLY = 1;`;
static if(is(typeof({ mixin(enumMixinStr___USE_POSIX_IMPLICITLY); }))) {
mixin(enumMixinStr___USE_POSIX_IMPLICITLY);
}
}
static if(!is(typeof(__SIZEOF_PTHREAD_MUTEX_T))) {
private enum enumMixinStr___SIZEOF_PTHREAD_MUTEX_T = `enum __SIZEOF_PTHREAD_MUTEX_T = 40;`;
static if(is(typeof({ mixin(enumMixinStr___SIZEOF_PTHREAD_MUTEX_T); }))) {
mixin(enumMixinStr___SIZEOF_PTHREAD_MUTEX_T);
}
}
static if(!is(typeof(__SIZEOF_PTHREAD_ATTR_T))) {
private enum enumMixinStr___SIZEOF_PTHREAD_ATTR_T = `enum __SIZEOF_PTHREAD_ATTR_T = 56;`;
static if(is(typeof({ mixin(enumMixinStr___SIZEOF_PTHREAD_ATTR_T); }))) {
mixin(enumMixinStr___SIZEOF_PTHREAD_ATTR_T);
}
}
static if(!is(typeof(__SIZEOF_PTHREAD_RWLOCK_T))) {
private enum enumMixinStr___SIZEOF_PTHREAD_RWLOCK_T = `enum __SIZEOF_PTHREAD_RWLOCK_T = 56;`;
static if(is(typeof({ mixin(enumMixinStr___SIZEOF_PTHREAD_RWLOCK_T); }))) {
mixin(enumMixinStr___SIZEOF_PTHREAD_RWLOCK_T);
}
}
static if(!is(typeof(__SIZEOF_PTHREAD_BARRIER_T))) {
private enum enumMixinStr___SIZEOF_PTHREAD_BARRIER_T = `enum __SIZEOF_PTHREAD_BARRIER_T = 32;`;
static if(is(typeof({ mixin(enumMixinStr___SIZEOF_PTHREAD_BARRIER_T); }))) {
mixin(enumMixinStr___SIZEOF_PTHREAD_BARRIER_T);
}
}
static if(!is(typeof(__SIZEOF_PTHREAD_MUTEXATTR_T))) {
private enum enumMixinStr___SIZEOF_PTHREAD_MUTEXATTR_T = `enum __SIZEOF_PTHREAD_MUTEXATTR_T = 4;`;
static if(is(typeof({ mixin(enumMixinStr___SIZEOF_PTHREAD_MUTEXATTR_T); }))) {
mixin(enumMixinStr___SIZEOF_PTHREAD_MUTEXATTR_T);
}
}
static if(!is(typeof(__SIZEOF_PTHREAD_COND_T))) {
private enum enumMixinStr___SIZEOF_PTHREAD_COND_T = `enum __SIZEOF_PTHREAD_COND_T = 48;`;
static if(is(typeof({ mixin(enumMixinStr___SIZEOF_PTHREAD_COND_T); }))) {
mixin(enumMixinStr___SIZEOF_PTHREAD_COND_T);
}
}
static if(!is(typeof(__SIZEOF_PTHREAD_CONDATTR_T))) {
private enum enumMixinStr___SIZEOF_PTHREAD_CONDATTR_T = `enum __SIZEOF_PTHREAD_CONDATTR_T = 4;`;
static if(is(typeof({ mixin(enumMixinStr___SIZEOF_PTHREAD_CONDATTR_T); }))) {
mixin(enumMixinStr___SIZEOF_PTHREAD_CONDATTR_T);
}
}
static if(!is(typeof(__SIZEOF_PTHREAD_RWLOCKATTR_T))) {
private enum enumMixinStr___SIZEOF_PTHREAD_RWLOCKATTR_T = `enum __SIZEOF_PTHREAD_RWLOCKATTR_T = 8;`;
static if(is(typeof({ mixin(enumMixinStr___SIZEOF_PTHREAD_RWLOCKATTR_T); }))) {
mixin(enumMixinStr___SIZEOF_PTHREAD_RWLOCKATTR_T);
}
}
static if(!is(typeof(__SIZEOF_PTHREAD_BARRIERATTR_T))) {
private enum enumMixinStr___SIZEOF_PTHREAD_BARRIERATTR_T = `enum __SIZEOF_PTHREAD_BARRIERATTR_T = 4;`;
static if(is(typeof({ mixin(enumMixinStr___SIZEOF_PTHREAD_BARRIERATTR_T); }))) {
mixin(enumMixinStr___SIZEOF_PTHREAD_BARRIERATTR_T);
}
}
static if(!is(typeof(__PTHREAD_MUTEX_LOCK_ELISION))) {
private enum enumMixinStr___PTHREAD_MUTEX_LOCK_ELISION = `enum __PTHREAD_MUTEX_LOCK_ELISION = 1;`;
static if(is(typeof({ mixin(enumMixinStr___PTHREAD_MUTEX_LOCK_ELISION); }))) {
mixin(enumMixinStr___PTHREAD_MUTEX_LOCK_ELISION);
}
}
static if(!is(typeof(__PTHREAD_MUTEX_NUSERS_AFTER_KIND))) {
private enum enumMixinStr___PTHREAD_MUTEX_NUSERS_AFTER_KIND = `enum __PTHREAD_MUTEX_NUSERS_AFTER_KIND = 0;`;
static if(is(typeof({ mixin(enumMixinStr___PTHREAD_MUTEX_NUSERS_AFTER_KIND); }))) {
mixin(enumMixinStr___PTHREAD_MUTEX_NUSERS_AFTER_KIND);
}
}
static if(!is(typeof(__PTHREAD_MUTEX_USE_UNION))) {
private enum enumMixinStr___PTHREAD_MUTEX_USE_UNION = `enum __PTHREAD_MUTEX_USE_UNION = 0;`;
static if(is(typeof({ mixin(enumMixinStr___PTHREAD_MUTEX_USE_UNION); }))) {
mixin(enumMixinStr___PTHREAD_MUTEX_USE_UNION);
}
}
static if(!is(typeof(__USE_ISOC11))) {
private enum enumMixinStr___USE_ISOC11 = `enum __USE_ISOC11 = 1;`;
static if(is(typeof({ mixin(enumMixinStr___USE_ISOC11); }))) {
mixin(enumMixinStr___USE_ISOC11);
}
}
static if(!is(typeof(_DEFAULT_SOURCE))) {
private enum enumMixinStr__DEFAULT_SOURCE = `enum _DEFAULT_SOURCE = 1;`;
static if(is(typeof({ mixin(enumMixinStr__DEFAULT_SOURCE); }))) {
mixin(enumMixinStr__DEFAULT_SOURCE);
}
}
static if(!is(typeof(__PTHREAD_RWLOCK_ELISION_EXTRA))) {
private enum enumMixinStr___PTHREAD_RWLOCK_ELISION_EXTRA = `enum __PTHREAD_RWLOCK_ELISION_EXTRA = 0 , { 0 , 0 , 0 , 0 , 0 , 0 , 0 };`;
static if(is(typeof({ mixin(enumMixinStr___PTHREAD_RWLOCK_ELISION_EXTRA); }))) {
mixin(enumMixinStr___PTHREAD_RWLOCK_ELISION_EXTRA);
}
}
static if(!is(typeof(__PTHREAD_RWLOCK_INT_FLAGS_SHARED))) {
private enum enumMixinStr___PTHREAD_RWLOCK_INT_FLAGS_SHARED = `enum __PTHREAD_RWLOCK_INT_FLAGS_SHARED = 1;`;
static if(is(typeof({ mixin(enumMixinStr___PTHREAD_RWLOCK_INT_FLAGS_SHARED); }))) {
mixin(enumMixinStr___PTHREAD_RWLOCK_INT_FLAGS_SHARED);
}
}
static if(!is(typeof(_BITS_PTHREADTYPES_COMMON_H))) {
private enum enumMixinStr__BITS_PTHREADTYPES_COMMON_H = `enum _BITS_PTHREADTYPES_COMMON_H = 1;`;
static if(is(typeof({ mixin(enumMixinStr__BITS_PTHREADTYPES_COMMON_H); }))) {
mixin(enumMixinStr__BITS_PTHREADTYPES_COMMON_H);
}
}
static if(!is(typeof(_FEATURES_H))) {
private enum enumMixinStr__FEATURES_H = `enum _FEATURES_H = 1;`;
static if(is(typeof({ mixin(enumMixinStr__FEATURES_H); }))) {
mixin(enumMixinStr__FEATURES_H);
}
}
static if(!is(typeof(__have_pthread_attr_t))) {
private enum enumMixinStr___have_pthread_attr_t = `enum __have_pthread_attr_t = 1;`;
static if(is(typeof({ mixin(enumMixinStr___have_pthread_attr_t); }))) {
mixin(enumMixinStr___have_pthread_attr_t);
}
}
static if(!is(typeof(BYTE_ORDER))) {
private enum enumMixinStr_BYTE_ORDER = `enum BYTE_ORDER = __LITTLE_ENDIAN;`;
static if(is(typeof({ mixin(enumMixinStr_BYTE_ORDER); }))) {
mixin(enumMixinStr_BYTE_ORDER);
}
}
static if(!is(typeof(PDP_ENDIAN))) {
private enum enumMixinStr_PDP_ENDIAN = `enum PDP_ENDIAN = __PDP_ENDIAN;`;
static if(is(typeof({ mixin(enumMixinStr_PDP_ENDIAN); }))) {
mixin(enumMixinStr_PDP_ENDIAN);
}
}
static if(!is(typeof(BIG_ENDIAN))) {
private enum enumMixinStr_BIG_ENDIAN = `enum BIG_ENDIAN = __BIG_ENDIAN;`;
static if(is(typeof({ mixin(enumMixinStr_BIG_ENDIAN); }))) {
mixin(enumMixinStr_BIG_ENDIAN);
}
}
static if(!is(typeof(LITTLE_ENDIAN))) {
private enum enumMixinStr_LITTLE_ENDIAN = `enum LITTLE_ENDIAN = __LITTLE_ENDIAN;`;
static if(is(typeof({ mixin(enumMixinStr_LITTLE_ENDIAN); }))) {
mixin(enumMixinStr_LITTLE_ENDIAN);
}
}
static if(!is(typeof(__FLOAT_WORD_ORDER))) {
private enum enumMixinStr___FLOAT_WORD_ORDER = `enum __FLOAT_WORD_ORDER = __LITTLE_ENDIAN;`;
static if(is(typeof({ mixin(enumMixinStr___FLOAT_WORD_ORDER); }))) {
mixin(enumMixinStr___FLOAT_WORD_ORDER);
}
}
static if(!is(typeof(__PDP_ENDIAN))) {
private enum enumMixinStr___PDP_ENDIAN = `enum __PDP_ENDIAN = 3412;`;
static if(is(typeof({ mixin(enumMixinStr___PDP_ENDIAN); }))) {
mixin(enumMixinStr___PDP_ENDIAN);
}
}
static if(!is(typeof(__BIG_ENDIAN))) {
private enum enumMixinStr___BIG_ENDIAN = `enum __BIG_ENDIAN = 4321;`;
static if(is(typeof({ mixin(enumMixinStr___BIG_ENDIAN); }))) {
mixin(enumMixinStr___BIG_ENDIAN);
}
}
static if(!is(typeof(__LITTLE_ENDIAN))) {
private enum enumMixinStr___LITTLE_ENDIAN = `enum __LITTLE_ENDIAN = 1234;`;
static if(is(typeof({ mixin(enumMixinStr___LITTLE_ENDIAN); }))) {
mixin(enumMixinStr___LITTLE_ENDIAN);
}
}
static if(!is(typeof(_ENDIAN_H))) {
private enum enumMixinStr__ENDIAN_H = `enum _ENDIAN_H = 1;`;
static if(is(typeof({ mixin(enumMixinStr__ENDIAN_H); }))) {
mixin(enumMixinStr__ENDIAN_H);
}
}
static if(!is(typeof(NULL))) {
private enum enumMixinStr_NULL = `enum NULL = ( cast( void * ) 0 );`;
static if(is(typeof({ mixin(enumMixinStr_NULL); }))) {
mixin(enumMixinStr_NULL);
}
}
static if(!is(typeof(__bool_true_false_are_defined))) {
private enum enumMixinStr___bool_true_false_are_defined = `enum __bool_true_false_are_defined = 1;`;
static if(is(typeof({ mixin(enumMixinStr___bool_true_false_are_defined); }))) {
mixin(enumMixinStr___bool_true_false_are_defined);
}
}
static if(!is(typeof(false_))) {
private enum enumMixinStr_false_ = `enum false_ = 0;`;
static if(is(typeof({ mixin(enumMixinStr_false_); }))) {
mixin(enumMixinStr_false_);
}
}
static if(!is(typeof(true_))) {
private enum enumMixinStr_true_ = `enum true_ = 1;`;
static if(is(typeof({ mixin(enumMixinStr_true_); }))) {
mixin(enumMixinStr_true_);
}
}
static if(!is(typeof(bool_))) {
private enum enumMixinStr_bool_ = `enum bool_ = _Bool;`;
static if(is(typeof({ mixin(enumMixinStr_bool_); }))) {
mixin(enumMixinStr_bool_);
}
}
static if(!is(typeof(__GNUC_VA_LIST))) {
private enum enumMixinStr___GNUC_VA_LIST = `enum __GNUC_VA_LIST = 1;`;
static if(is(typeof({ mixin(enumMixinStr___GNUC_VA_LIST); }))) {
mixin(enumMixinStr___GNUC_VA_LIST);
}
}
static if(!is(typeof(__FD_ZERO_STOS))) {
private enum enumMixinStr___FD_ZERO_STOS = `enum __FD_ZERO_STOS = "stosq";`;
static if(is(typeof({ mixin(enumMixinStr___FD_ZERO_STOS); }))) {
mixin(enumMixinStr___FD_ZERO_STOS);
}
}
static if(!is(typeof(_BITS_STDINT_INTN_H))) {
private enum enumMixinStr__BITS_STDINT_INTN_H = `enum _BITS_STDINT_INTN_H = 1;`;
static if(is(typeof({ mixin(enumMixinStr__BITS_STDINT_INTN_H); }))) {
mixin(enumMixinStr__BITS_STDINT_INTN_H);
}
}
static if(!is(typeof(_ALLOCA_H))) {
private enum enumMixinStr__ALLOCA_H = `enum _ALLOCA_H = 1;`;
static if(is(typeof({ mixin(enumMixinStr__ALLOCA_H); }))) {
mixin(enumMixinStr__ALLOCA_H);
}
}
static if(!is(typeof(WREN_VERSION_NUMBER))) {
private enum enumMixinStr_WREN_VERSION_NUMBER = `enum WREN_VERSION_NUMBER = ( WREN_VERSION_MAJOR * 1000000 + WREN_VERSION_MINOR * 1000 + WREN_VERSION_PATCH );`;
static if(is(typeof({ mixin(enumMixinStr_WREN_VERSION_NUMBER); }))) {
mixin(enumMixinStr_WREN_VERSION_NUMBER);
}
}
static if(!is(typeof(_BITS_SYSMACROS_H))) {
private enum enumMixinStr__BITS_SYSMACROS_H = `enum _BITS_SYSMACROS_H = 1;`;
static if(is(typeof({ mixin(enumMixinStr__BITS_SYSMACROS_H); }))) {
mixin(enumMixinStr__BITS_SYSMACROS_H);
}
}
static if(!is(typeof(WREN_VERSION_STRING))) {
private enum enumMixinStr_WREN_VERSION_STRING = `enum WREN_VERSION_STRING = "0.3.0";`;
static if(is(typeof({ mixin(enumMixinStr_WREN_VERSION_STRING); }))) {
mixin(enumMixinStr_WREN_VERSION_STRING);
}
}
static if(!is(typeof(__SYSMACROS_DECLARE_MAJOR))) {
private enum enumMixinStr___SYSMACROS_DECLARE_MAJOR = `enum __SYSMACROS_DECLARE_MAJOR = ( DECL_TEMPL ) DECL_TEMPL ( unsigned int , major , ( __dev_t __dev ) );`;
static if(is(typeof({ mixin(enumMixinStr___SYSMACROS_DECLARE_MAJOR); }))) {
mixin(enumMixinStr___SYSMACROS_DECLARE_MAJOR);
}
}
static if(!is(typeof(__SYSMACROS_DEFINE_MAJOR))) {
private enum enumMixinStr___SYSMACROS_DEFINE_MAJOR = `enum __SYSMACROS_DEFINE_MAJOR = ( DECL_TEMPL ) ( DECL_TEMPL ) DECL_TEMPL ( unsigned int , major , ( __dev_t __dev ) ) ( DECL_TEMPL ) { unsigned int __major ; __major = ( ( __dev & cast( __dev_t ) 0x00000000000fff00u ) >> 8 ) ; __major |= ( ( __dev & cast( __dev_t ) 0xfffff00000000000u ) >> 32 ) ; return __major ; };`;
static if(is(typeof({ mixin(enumMixinStr___SYSMACROS_DEFINE_MAJOR); }))) {
mixin(enumMixinStr___SYSMACROS_DEFINE_MAJOR);
}
}
static if(!is(typeof(__SYSMACROS_DECLARE_MINOR))) {
private enum enumMixinStr___SYSMACROS_DECLARE_MINOR = `enum __SYSMACROS_DECLARE_MINOR = ( DECL_TEMPL ) DECL_TEMPL ( unsigned int , minor , ( __dev_t __dev ) );`;
static if(is(typeof({ mixin(enumMixinStr___SYSMACROS_DECLARE_MINOR); }))) {
mixin(enumMixinStr___SYSMACROS_DECLARE_MINOR);
}
}
static if(!is(typeof(__SYSMACROS_DEFINE_MINOR))) {
private enum enumMixinStr___SYSMACROS_DEFINE_MINOR = `enum __SYSMACROS_DEFINE_MINOR = ( DECL_TEMPL ) ( DECL_TEMPL ) DECL_TEMPL ( unsigned int , minor , ( __dev_t __dev ) ) ( DECL_TEMPL ) { unsigned int __minor ; __minor = ( ( __dev & cast( __dev_t ) 0x00000000000000ffu ) >> 0 ) ; __minor |= ( ( __dev & cast( __dev_t ) 0x00000ffffff00000u ) >> 12 ) ; return __minor ; };`;
static if(is(typeof({ mixin(enumMixinStr___SYSMACROS_DEFINE_MINOR); }))) {
mixin(enumMixinStr___SYSMACROS_DEFINE_MINOR);
}
}
static if(!is(typeof(__SYSMACROS_DECLARE_MAKEDEV))) {
private enum enumMixinStr___SYSMACROS_DECLARE_MAKEDEV = `enum __SYSMACROS_DECLARE_MAKEDEV = ( DECL_TEMPL ) DECL_TEMPL ( __dev_t , makedev , ( unsigned int __major , unsigned int __minor ) );`;
static if(is(typeof({ mixin(enumMixinStr___SYSMACROS_DECLARE_MAKEDEV); }))) {
mixin(enumMixinStr___SYSMACROS_DECLARE_MAKEDEV);
}
}
static if(!is(typeof(__SYSMACROS_DEFINE_MAKEDEV))) {
private enum enumMixinStr___SYSMACROS_DEFINE_MAKEDEV = `enum __SYSMACROS_DEFINE_MAKEDEV = ( DECL_TEMPL ) ( DECL_TEMPL ) DECL_TEMPL ( __dev_t , makedev , ( unsigned int __major , unsigned int __minor ) ) ( DECL_TEMPL ) { __dev_t __dev ; __dev = ( ( cast( __dev_t ) ( __major & 0x00000fffu ) ) << 8 ) ; __dev |= ( ( cast( __dev_t ) ( __major & 0xfffff000u ) ) << 32 ) ; __dev |= ( ( cast( __dev_t ) ( __minor & 0x000000ffu ) ) << 0 ) ; __dev |= ( ( cast( __dev_t ) ( __minor & 0xffffff00u ) ) << 12 ) ; return __dev ; };`;
static if(is(typeof({ mixin(enumMixinStr___SYSMACROS_DEFINE_MAKEDEV); }))) {
mixin(enumMixinStr___SYSMACROS_DEFINE_MAKEDEV);
}
}
static if(!is(typeof(_THREAD_SHARED_TYPES_H))) {
private enum enumMixinStr__THREAD_SHARED_TYPES_H = `enum _THREAD_SHARED_TYPES_H = 1;`;
static if(is(typeof({ mixin(enumMixinStr__THREAD_SHARED_TYPES_H); }))) {
mixin(enumMixinStr__THREAD_SHARED_TYPES_H);
}
}
static if(!is(typeof(WREN_VERSION_PATCH))) {
private enum enumMixinStr_WREN_VERSION_PATCH = `enum WREN_VERSION_PATCH = 0;`;
static if(is(typeof({ mixin(enumMixinStr_WREN_VERSION_PATCH); }))) {
mixin(enumMixinStr_WREN_VERSION_PATCH);
}
}
static if(!is(typeof(WREN_VERSION_MINOR))) {
private enum enumMixinStr_WREN_VERSION_MINOR = `enum WREN_VERSION_MINOR = 3;`;
static if(is(typeof({ mixin(enumMixinStr_WREN_VERSION_MINOR); }))) {
mixin(enumMixinStr_WREN_VERSION_MINOR);
}
}
static if(!is(typeof(WREN_VERSION_MAJOR))) {
private enum enumMixinStr_WREN_VERSION_MAJOR = `enum WREN_VERSION_MAJOR = 0;`;
static if(is(typeof({ mixin(enumMixinStr_WREN_VERSION_MAJOR); }))) {
mixin(enumMixinStr_WREN_VERSION_MAJOR);
}
}
static if(!is(typeof(__PTHREAD_SPINS_DATA))) {
private enum enumMixinStr___PTHREAD_SPINS_DATA = `enum __PTHREAD_SPINS_DATA = short __spins ; short __elision;`;
static if(is(typeof({ mixin(enumMixinStr___PTHREAD_SPINS_DATA); }))) {
mixin(enumMixinStr___PTHREAD_SPINS_DATA);
}
}
static if(!is(typeof(__PTHREAD_SPINS))) {
private enum enumMixinStr___PTHREAD_SPINS = `enum __PTHREAD_SPINS = 0 , 0;`;
static if(is(typeof({ mixin(enumMixinStr___PTHREAD_SPINS); }))) {
mixin(enumMixinStr___PTHREAD_SPINS);
}
}
static if(!is(typeof(__PTHREAD_MUTEX_HAVE_PREV))) {
private enum enumMixinStr___PTHREAD_MUTEX_HAVE_PREV = `enum __PTHREAD_MUTEX_HAVE_PREV = 1;`;
static if(is(typeof({ mixin(enumMixinStr___PTHREAD_MUTEX_HAVE_PREV); }))) {
mixin(enumMixinStr___PTHREAD_MUTEX_HAVE_PREV);
}
}
static if(!is(typeof(_BITS_TYPES_H))) {
private enum enumMixinStr__BITS_TYPES_H = `enum _BITS_TYPES_H = 1;`;
static if(is(typeof({ mixin(enumMixinStr__BITS_TYPES_H); }))) {
mixin(enumMixinStr__BITS_TYPES_H);
}
}
static if(!is(typeof(__S16_TYPE))) {
private enum enumMixinStr___S16_TYPE = `enum __S16_TYPE = short int;`;
static if(is(typeof({ mixin(enumMixinStr___S16_TYPE); }))) {
mixin(enumMixinStr___S16_TYPE);
}
}
static if(!is(typeof(__U16_TYPE))) {
private enum enumMixinStr___U16_TYPE = `enum __U16_TYPE = unsigned short int;`;
static if(is(typeof({ mixin(enumMixinStr___U16_TYPE); }))) {
mixin(enumMixinStr___U16_TYPE);
}
}
static if(!is(typeof(__S32_TYPE))) {
private enum enumMixinStr___S32_TYPE = `enum __S32_TYPE = int;`;
static if(is(typeof({ mixin(enumMixinStr___S32_TYPE); }))) {
mixin(enumMixinStr___S32_TYPE);
}
}
static if(!is(typeof(__U32_TYPE))) {
private enum enumMixinStr___U32_TYPE = `enum __U32_TYPE = unsigned int;`;
static if(is(typeof({ mixin(enumMixinStr___U32_TYPE); }))) {
mixin(enumMixinStr___U32_TYPE);
}
}
static if(!is(typeof(__SLONGWORD_TYPE))) {
private enum enumMixinStr___SLONGWORD_TYPE = `enum __SLONGWORD_TYPE = long int;`;
static if(is(typeof({ mixin(enumMixinStr___SLONGWORD_TYPE); }))) {
mixin(enumMixinStr___SLONGWORD_TYPE);
}
}
static if(!is(typeof(__ULONGWORD_TYPE))) {
private enum enumMixinStr___ULONGWORD_TYPE = `enum __ULONGWORD_TYPE = unsigned long int;`;
static if(is(typeof({ mixin(enumMixinStr___ULONGWORD_TYPE); }))) {
mixin(enumMixinStr___ULONGWORD_TYPE);
}
}
static if(!is(typeof(__SQUAD_TYPE))) {
private enum enumMixinStr___SQUAD_TYPE = `enum __SQUAD_TYPE = long int;`;
static if(is(typeof({ mixin(enumMixinStr___SQUAD_TYPE); }))) {
mixin(enumMixinStr___SQUAD_TYPE);
}
}
static if(!is(typeof(__UQUAD_TYPE))) {
private enum enumMixinStr___UQUAD_TYPE = `enum __UQUAD_TYPE = unsigned long int;`;
static if(is(typeof({ mixin(enumMixinStr___UQUAD_TYPE); }))) {
mixin(enumMixinStr___UQUAD_TYPE);
}
}
static if(!is(typeof(__SWORD_TYPE))) {
private enum enumMixinStr___SWORD_TYPE = `enum __SWORD_TYPE = long int;`;
static if(is(typeof({ mixin(enumMixinStr___SWORD_TYPE); }))) {
mixin(enumMixinStr___SWORD_TYPE);
}
}
static if(!is(typeof(__UWORD_TYPE))) {
private enum enumMixinStr___UWORD_TYPE = `enum __UWORD_TYPE = unsigned long int;`;
static if(is(typeof({ mixin(enumMixinStr___UWORD_TYPE); }))) {
mixin(enumMixinStr___UWORD_TYPE);
}
}
static if(!is(typeof(__SLONG32_TYPE))) {
private enum enumMixinStr___SLONG32_TYPE = `enum __SLONG32_TYPE = int;`;
static if(is(typeof({ mixin(enumMixinStr___SLONG32_TYPE); }))) {
mixin(enumMixinStr___SLONG32_TYPE);
}
}
static if(!is(typeof(__ULONG32_TYPE))) {
private enum enumMixinStr___ULONG32_TYPE = `enum __ULONG32_TYPE = unsigned int;`;
static if(is(typeof({ mixin(enumMixinStr___ULONG32_TYPE); }))) {
mixin(enumMixinStr___ULONG32_TYPE);
}
}
static if(!is(typeof(__S64_TYPE))) {
private enum enumMixinStr___S64_TYPE = `enum __S64_TYPE = long int;`;
static if(is(typeof({ mixin(enumMixinStr___S64_TYPE); }))) {
mixin(enumMixinStr___S64_TYPE);
}
}
static if(!is(typeof(__U64_TYPE))) {
private enum enumMixinStr___U64_TYPE = `enum __U64_TYPE = unsigned long int;`;
static if(is(typeof({ mixin(enumMixinStr___U64_TYPE); }))) {
mixin(enumMixinStr___U64_TYPE);
}
}
static if(!is(typeof(__STD_TYPE))) {
private enum enumMixinStr___STD_TYPE = `enum __STD_TYPE = typedef;`;
static if(is(typeof({ mixin(enumMixinStr___STD_TYPE); }))) {
mixin(enumMixinStr___STD_TYPE);
}
}
static if(!is(typeof(_SIGSET_NWORDS))) {
private enum enumMixinStr__SIGSET_NWORDS = `enum _SIGSET_NWORDS = ( 1024 / ( 8 * ( unsigned long int ) .sizeof ) );`;
static if(is(typeof({ mixin(enumMixinStr__SIGSET_NWORDS); }))) {
mixin(enumMixinStr__SIGSET_NWORDS);
}
}
static if(!is(typeof(__clock_t_defined))) {
private enum enumMixinStr___clock_t_defined = `enum __clock_t_defined = 1;`;
static if(is(typeof({ mixin(enumMixinStr___clock_t_defined); }))) {
mixin(enumMixinStr___clock_t_defined);
}
}
static if(!is(typeof(__clockid_t_defined))) {
private enum enumMixinStr___clockid_t_defined = `enum __clockid_t_defined = 1;`;
static if(is(typeof({ mixin(enumMixinStr___clockid_t_defined); }))) {
mixin(enumMixinStr___clockid_t_defined);
}
}
static if(!is(typeof(__sigset_t_defined))) {
private enum enumMixinStr___sigset_t_defined = `enum __sigset_t_defined = 1;`;
static if(is(typeof({ mixin(enumMixinStr___sigset_t_defined); }))) {
mixin(enumMixinStr___sigset_t_defined);
}
}
static if(!is(typeof(__timespec_defined))) {
private enum enumMixinStr___timespec_defined = `enum __timespec_defined = 1;`;
static if(is(typeof({ mixin(enumMixinStr___timespec_defined); }))) {
mixin(enumMixinStr___timespec_defined);
}
}
static if(!is(typeof(__timeval_defined))) {
private enum enumMixinStr___timeval_defined = `enum __timeval_defined = 1;`;
static if(is(typeof({ mixin(enumMixinStr___timeval_defined); }))) {
mixin(enumMixinStr___timeval_defined);
}
}
static if(!is(typeof(__time_t_defined))) {
private enum enumMixinStr___time_t_defined = `enum __time_t_defined = 1;`;
static if(is(typeof({ mixin(enumMixinStr___time_t_defined); }))) {
mixin(enumMixinStr___time_t_defined);
}
}
static if(!is(typeof(__timer_t_defined))) {
private enum enumMixinStr___timer_t_defined = `enum __timer_t_defined = 1;`;
static if(is(typeof({ mixin(enumMixinStr___timer_t_defined); }))) {
mixin(enumMixinStr___timer_t_defined);
}
}
static if(!is(typeof(_BITS_TYPESIZES_H))) {
private enum enumMixinStr__BITS_TYPESIZES_H = `enum _BITS_TYPESIZES_H = 1;`;
static if(is(typeof({ mixin(enumMixinStr__BITS_TYPESIZES_H); }))) {
mixin(enumMixinStr__BITS_TYPESIZES_H);
}
}
static if(!is(typeof(__SYSCALL_SLONG_TYPE))) {
private enum enumMixinStr___SYSCALL_SLONG_TYPE = `enum __SYSCALL_SLONG_TYPE = long int;`;
static if(is(typeof({ mixin(enumMixinStr___SYSCALL_SLONG_TYPE); }))) {
mixin(enumMixinStr___SYSCALL_SLONG_TYPE);
}
}
static if(!is(typeof(__SYSCALL_ULONG_TYPE))) {
private enum enumMixinStr___SYSCALL_ULONG_TYPE = `enum __SYSCALL_ULONG_TYPE = unsigned long int;`;
static if(is(typeof({ mixin(enumMixinStr___SYSCALL_ULONG_TYPE); }))) {
mixin(enumMixinStr___SYSCALL_ULONG_TYPE);
}
}
static if(!is(typeof(__DEV_T_TYPE))) {
private enum enumMixinStr___DEV_T_TYPE = `enum __DEV_T_TYPE = unsigned long int;`;
static if(is(typeof({ mixin(enumMixinStr___DEV_T_TYPE); }))) {
mixin(enumMixinStr___DEV_T_TYPE);
}
}
static if(!is(typeof(__UID_T_TYPE))) {
private enum enumMixinStr___UID_T_TYPE = `enum __UID_T_TYPE = unsigned int;`;
static if(is(typeof({ mixin(enumMixinStr___UID_T_TYPE); }))) {
mixin(enumMixinStr___UID_T_TYPE);
}
}
static if(!is(typeof(__GID_T_TYPE))) {
private enum enumMixinStr___GID_T_TYPE = `enum __GID_T_TYPE = unsigned int;`;
static if(is(typeof({ mixin(enumMixinStr___GID_T_TYPE); }))) {
mixin(enumMixinStr___GID_T_TYPE);
}
}
static if(!is(typeof(__INO_T_TYPE))) {
private enum enumMixinStr___INO_T_TYPE = `enum __INO_T_TYPE = unsigned long int;`;
static if(is(typeof({ mixin(enumMixinStr___INO_T_TYPE); }))) {
mixin(enumMixinStr___INO_T_TYPE);
}
}
static if(!is(typeof(__INO64_T_TYPE))) {
private enum enumMixinStr___INO64_T_TYPE = `enum __INO64_T_TYPE = unsigned long int;`;
static if(is(typeof({ mixin(enumMixinStr___INO64_T_TYPE); }))) {
mixin(enumMixinStr___INO64_T_TYPE);
}
}
static if(!is(typeof(__MODE_T_TYPE))) {
private enum enumMixinStr___MODE_T_TYPE = `enum __MODE_T_TYPE = unsigned int;`;
static if(is(typeof({ mixin(enumMixinStr___MODE_T_TYPE); }))) {
mixin(enumMixinStr___MODE_T_TYPE);
}
}
static if(!is(typeof(__NLINK_T_TYPE))) {
private enum enumMixinStr___NLINK_T_TYPE = `enum __NLINK_T_TYPE = unsigned long int;`;
static if(is(typeof({ mixin(enumMixinStr___NLINK_T_TYPE); }))) {
mixin(enumMixinStr___NLINK_T_TYPE);
}
}
static if(!is(typeof(__FSWORD_T_TYPE))) {
private enum enumMixinStr___FSWORD_T_TYPE = `enum __FSWORD_T_TYPE = long int;`;
static if(is(typeof({ mixin(enumMixinStr___FSWORD_T_TYPE); }))) {
mixin(enumMixinStr___FSWORD_T_TYPE);
}
}
static if(!is(typeof(__OFF_T_TYPE))) {
private enum enumMixinStr___OFF_T_TYPE = `enum __OFF_T_TYPE = long int;`;
static if(is(typeof({ mixin(enumMixinStr___OFF_T_TYPE); }))) {
mixin(enumMixinStr___OFF_T_TYPE);
}
}
static if(!is(typeof(__OFF64_T_TYPE))) {
private enum enumMixinStr___OFF64_T_TYPE = `enum __OFF64_T_TYPE = long int;`;
static if(is(typeof({ mixin(enumMixinStr___OFF64_T_TYPE); }))) {
mixin(enumMixinStr___OFF64_T_TYPE);
}
}
static if(!is(typeof(__PID_T_TYPE))) {
private enum enumMixinStr___PID_T_TYPE = `enum __PID_T_TYPE = int;`;
static if(is(typeof({ mixin(enumMixinStr___PID_T_TYPE); }))) {
mixin(enumMixinStr___PID_T_TYPE);
}
}
static if(!is(typeof(__RLIM_T_TYPE))) {
private enum enumMixinStr___RLIM_T_TYPE = `enum __RLIM_T_TYPE = unsigned long int;`;
static if(is(typeof({ mixin(enumMixinStr___RLIM_T_TYPE); }))) {
mixin(enumMixinStr___RLIM_T_TYPE);
}
}
static if(!is(typeof(__RLIM64_T_TYPE))) {
private enum enumMixinStr___RLIM64_T_TYPE = `enum __RLIM64_T_TYPE = unsigned long int;`;
static if(is(typeof({ mixin(enumMixinStr___RLIM64_T_TYPE); }))) {
mixin(enumMixinStr___RLIM64_T_TYPE);
}
}
static if(!is(typeof(__BLKCNT_T_TYPE))) {
private enum enumMixinStr___BLKCNT_T_TYPE = `enum __BLKCNT_T_TYPE = long int;`;
static if(is(typeof({ mixin(enumMixinStr___BLKCNT_T_TYPE); }))) {
mixin(enumMixinStr___BLKCNT_T_TYPE);
}
}
static if(!is(typeof(__BLKCNT64_T_TYPE))) {
private enum enumMixinStr___BLKCNT64_T_TYPE = `enum __BLKCNT64_T_TYPE = long int;`;
static if(is(typeof({ mixin(enumMixinStr___BLKCNT64_T_TYPE); }))) {
mixin(enumMixinStr___BLKCNT64_T_TYPE);
}
}
static if(!is(typeof(__FSBLKCNT_T_TYPE))) {
private enum enumMixinStr___FSBLKCNT_T_TYPE = `enum __FSBLKCNT_T_TYPE = unsigned long int;`;
static if(is(typeof({ mixin(enumMixinStr___FSBLKCNT_T_TYPE); }))) {
mixin(enumMixinStr___FSBLKCNT_T_TYPE);
}
}
static if(!is(typeof(__FSBLKCNT64_T_TYPE))) {
private enum enumMixinStr___FSBLKCNT64_T_TYPE = `enum __FSBLKCNT64_T_TYPE = unsigned long int;`;
static if(is(typeof({ mixin(enumMixinStr___FSBLKCNT64_T_TYPE); }))) {
mixin(enumMixinStr___FSBLKCNT64_T_TYPE);
}
}
static if(!is(typeof(__FSFILCNT_T_TYPE))) {
private enum enumMixinStr___FSFILCNT_T_TYPE = `enum __FSFILCNT_T_TYPE = unsigned long int;`;
static if(is(typeof({ mixin(enumMixinStr___FSFILCNT_T_TYPE); }))) {
mixin(enumMixinStr___FSFILCNT_T_TYPE);
}
}
static if(!is(typeof(__FSFILCNT64_T_TYPE))) {
private enum enumMixinStr___FSFILCNT64_T_TYPE = `enum __FSFILCNT64_T_TYPE = unsigned long int;`;
static if(is(typeof({ mixin(enumMixinStr___FSFILCNT64_T_TYPE); }))) {
mixin(enumMixinStr___FSFILCNT64_T_TYPE);
}
}
static if(!is(typeof(__ID_T_TYPE))) {
private enum enumMixinStr___ID_T_TYPE = `enum __ID_T_TYPE = unsigned int;`;
static if(is(typeof({ mixin(enumMixinStr___ID_T_TYPE); }))) {
mixin(enumMixinStr___ID_T_TYPE);
}
}
static if(!is(typeof(__CLOCK_T_TYPE))) {
private enum enumMixinStr___CLOCK_T_TYPE = `enum __CLOCK_T_TYPE = long int;`;
static if(is(typeof({ mixin(enumMixinStr___CLOCK_T_TYPE); }))) {
mixin(enumMixinStr___CLOCK_T_TYPE);
}
}
static if(!is(typeof(__TIME_T_TYPE))) {
private enum enumMixinStr___TIME_T_TYPE = `enum __TIME_T_TYPE = long int;`;
static if(is(typeof({ mixin(enumMixinStr___TIME_T_TYPE); }))) {
mixin(enumMixinStr___TIME_T_TYPE);
}
}
static if(!is(typeof(__USECONDS_T_TYPE))) {
private enum enumMixinStr___USECONDS_T_TYPE = `enum __USECONDS_T_TYPE = unsigned int;`;
static if(is(typeof({ mixin(enumMixinStr___USECONDS_T_TYPE); }))) {
mixin(enumMixinStr___USECONDS_T_TYPE);
}
}
static if(!is(typeof(__SUSECONDS_T_TYPE))) {
private enum enumMixinStr___SUSECONDS_T_TYPE = `enum __SUSECONDS_T_TYPE = long int;`;
static if(is(typeof({ mixin(enumMixinStr___SUSECONDS_T_TYPE); }))) {
mixin(enumMixinStr___SUSECONDS_T_TYPE);
}
}
static if(!is(typeof(__DADDR_T_TYPE))) {
private enum enumMixinStr___DADDR_T_TYPE = `enum __DADDR_T_TYPE = int;`;
static if(is(typeof({ mixin(enumMixinStr___DADDR_T_TYPE); }))) {
mixin(enumMixinStr___DADDR_T_TYPE);
}
}
static if(!is(typeof(__KEY_T_TYPE))) {
private enum enumMixinStr___KEY_T_TYPE = `enum __KEY_T_TYPE = int;`;
static if(is(typeof({ mixin(enumMixinStr___KEY_T_TYPE); }))) {
mixin(enumMixinStr___KEY_T_TYPE);
}
}
static if(!is(typeof(__CLOCKID_T_TYPE))) {
private enum enumMixinStr___CLOCKID_T_TYPE = `enum __CLOCKID_T_TYPE = int;`;
static if(is(typeof({ mixin(enumMixinStr___CLOCKID_T_TYPE); }))) {
mixin(enumMixinStr___CLOCKID_T_TYPE);
}
}
static if(!is(typeof(__TIMER_T_TYPE))) {
private enum enumMixinStr___TIMER_T_TYPE = `enum __TIMER_T_TYPE = void *;`;
static if(is(typeof({ mixin(enumMixinStr___TIMER_T_TYPE); }))) {
mixin(enumMixinStr___TIMER_T_TYPE);
}
}
static if(!is(typeof(__BLKSIZE_T_TYPE))) {
private enum enumMixinStr___BLKSIZE_T_TYPE = `enum __BLKSIZE_T_TYPE = long int;`;
static if(is(typeof({ mixin(enumMixinStr___BLKSIZE_T_TYPE); }))) {
mixin(enumMixinStr___BLKSIZE_T_TYPE);
}
}
static if(!is(typeof(__FSID_T_TYPE))) {
private enum enumMixinStr___FSID_T_TYPE = `enum __FSID_T_TYPE = { int __val [ 2 ] ; };`;
static if(is(typeof({ mixin(enumMixinStr___FSID_T_TYPE); }))) {
mixin(enumMixinStr___FSID_T_TYPE);
}
}
static if(!is(typeof(__SSIZE_T_TYPE))) {
private enum enumMixinStr___SSIZE_T_TYPE = `enum __SSIZE_T_TYPE = long int;`;
static if(is(typeof({ mixin(enumMixinStr___SSIZE_T_TYPE); }))) {
mixin(enumMixinStr___SSIZE_T_TYPE);
}
}
static if(!is(typeof(__CPU_MASK_TYPE))) {
private enum enumMixinStr___CPU_MASK_TYPE = `enum __CPU_MASK_TYPE = unsigned long int;`;
static if(is(typeof({ mixin(enumMixinStr___CPU_MASK_TYPE); }))) {
mixin(enumMixinStr___CPU_MASK_TYPE);
}
}
static if(!is(typeof(__OFF_T_MATCHES_OFF64_T))) {
private enum enumMixinStr___OFF_T_MATCHES_OFF64_T = `enum __OFF_T_MATCHES_OFF64_T = 1;`;
static if(is(typeof({ mixin(enumMixinStr___OFF_T_MATCHES_OFF64_T); }))) {
mixin(enumMixinStr___OFF_T_MATCHES_OFF64_T);
}
}
static if(!is(typeof(__INO_T_MATCHES_INO64_T))) {
private enum enumMixinStr___INO_T_MATCHES_INO64_T = `enum __INO_T_MATCHES_INO64_T = 1;`;
static if(is(typeof({ mixin(enumMixinStr___INO_T_MATCHES_INO64_T); }))) {
mixin(enumMixinStr___INO_T_MATCHES_INO64_T);
}
}
static if(!is(typeof(__RLIM_T_MATCHES_RLIM64_T))) {
private enum enumMixinStr___RLIM_T_MATCHES_RLIM64_T = `enum __RLIM_T_MATCHES_RLIM64_T = 1;`;
static if(is(typeof({ mixin(enumMixinStr___RLIM_T_MATCHES_RLIM64_T); }))) {
mixin(enumMixinStr___RLIM_T_MATCHES_RLIM64_T);
}
}
static if(!is(typeof(__FD_SETSIZE))) {
private enum enumMixinStr___FD_SETSIZE = `enum __FD_SETSIZE = 1024;`;
static if(is(typeof({ mixin(enumMixinStr___FD_SETSIZE); }))) {
mixin(enumMixinStr___FD_SETSIZE);
}
}
static if(!is(typeof(_BITS_UINTN_IDENTITY_H))) {
private enum enumMixinStr__BITS_UINTN_IDENTITY_H = `enum _BITS_UINTN_IDENTITY_H = 1;`;
static if(is(typeof({ mixin(enumMixinStr__BITS_UINTN_IDENTITY_H); }))) {
mixin(enumMixinStr__BITS_UINTN_IDENTITY_H);
}
}
static if(!is(typeof(WNOHANG))) {
private enum enumMixinStr_WNOHANG = `enum WNOHANG = 1;`;
static if(is(typeof({ mixin(enumMixinStr_WNOHANG); }))) {
mixin(enumMixinStr_WNOHANG);
}
}
static if(!is(typeof(WUNTRACED))) {
private enum enumMixinStr_WUNTRACED = `enum WUNTRACED = 2;`;
static if(is(typeof({ mixin(enumMixinStr_WUNTRACED); }))) {
mixin(enumMixinStr_WUNTRACED);
}
}
static if(!is(typeof(WSTOPPED))) {
private enum enumMixinStr_WSTOPPED = `enum WSTOPPED = 2;`;
static if(is(typeof({ mixin(enumMixinStr_WSTOPPED); }))) {
mixin(enumMixinStr_WSTOPPED);
}
}
static if(!is(typeof(WEXITED))) {
private enum enumMixinStr_WEXITED = `enum WEXITED = 4;`;
static if(is(typeof({ mixin(enumMixinStr_WEXITED); }))) {
mixin(enumMixinStr_WEXITED);
}
}
static if(!is(typeof(WCONTINUED))) {
private enum enumMixinStr_WCONTINUED = `enum WCONTINUED = 8;`;
static if(is(typeof({ mixin(enumMixinStr_WCONTINUED); }))) {
mixin(enumMixinStr_WCONTINUED);
}
}
static if(!is(typeof(WNOWAIT))) {
private enum enumMixinStr_WNOWAIT = `enum WNOWAIT = 0x01000000;`;
static if(is(typeof({ mixin(enumMixinStr_WNOWAIT); }))) {
mixin(enumMixinStr_WNOWAIT);
}
}
static if(!is(typeof(__WNOTHREAD))) {
private enum enumMixinStr___WNOTHREAD = `enum __WNOTHREAD = 0x20000000;`;
static if(is(typeof({ mixin(enumMixinStr___WNOTHREAD); }))) {
mixin(enumMixinStr___WNOTHREAD);
}
}
static if(!is(typeof(__WALL))) {
private enum enumMixinStr___WALL = `enum __WALL = 0x40000000;`;
static if(is(typeof({ mixin(enumMixinStr___WALL); }))) {
mixin(enumMixinStr___WALL);
}
}
static if(!is(typeof(__WCLONE))) {
private enum enumMixinStr___WCLONE = `enum __WCLONE = 0x80000000;`;
static if(is(typeof({ mixin(enumMixinStr___WCLONE); }))) {
mixin(enumMixinStr___WCLONE);
}
}
static if(!is(typeof(__ENUM_IDTYPE_T))) {
private enum enumMixinStr___ENUM_IDTYPE_T = `enum __ENUM_IDTYPE_T = 1;`;
static if(is(typeof({ mixin(enumMixinStr___ENUM_IDTYPE_T); }))) {
mixin(enumMixinStr___ENUM_IDTYPE_T);
}
}
static if(!is(typeof(__W_CONTINUED))) {
private enum enumMixinStr___W_CONTINUED = `enum __W_CONTINUED = 0xffff;`;
static if(is(typeof({ mixin(enumMixinStr___W_CONTINUED); }))) {
mixin(enumMixinStr___W_CONTINUED);
}
}
static if(!is(typeof(__WCOREFLAG))) {
private enum enumMixinStr___WCOREFLAG = `enum __WCOREFLAG = 0x80;`;
static if(is(typeof({ mixin(enumMixinStr___WCOREFLAG); }))) {
mixin(enumMixinStr___WCOREFLAG);
}
}
static if(!is(typeof(__WORDSIZE))) {
private enum enumMixinStr___WORDSIZE = `enum __WORDSIZE = 64;`;
static if(is(typeof({ mixin(enumMixinStr___WORDSIZE); }))) {
mixin(enumMixinStr___WORDSIZE);
}
}
static if(!is(typeof(__WORDSIZE_TIME64_COMPAT32))) {
private enum enumMixinStr___WORDSIZE_TIME64_COMPAT32 = `enum __WORDSIZE_TIME64_COMPAT32 = 1;`;
static if(is(typeof({ mixin(enumMixinStr___WORDSIZE_TIME64_COMPAT32); }))) {
mixin(enumMixinStr___WORDSIZE_TIME64_COMPAT32);
}
}
static if(!is(typeof(__SYSCALL_WORDSIZE))) {
private enum enumMixinStr___SYSCALL_WORDSIZE = `enum __SYSCALL_WORDSIZE = 64;`;
static if(is(typeof({ mixin(enumMixinStr___SYSCALL_WORDSIZE); }))) {
mixin(enumMixinStr___SYSCALL_WORDSIZE);
}
}
static if(!is(typeof(_SYS_CDEFS_H))) {
private enum enumMixinStr__SYS_CDEFS_H = `enum _SYS_CDEFS_H = 1;`;
static if(is(typeof({ mixin(enumMixinStr__SYS_CDEFS_H); }))) {
mixin(enumMixinStr__SYS_CDEFS_H);
}
}
static if(!is(typeof(__THROW))) {
private enum enumMixinStr___THROW = `enum __THROW = __attribute__ ( ( __nothrow__ ) );`;
static if(is(typeof({ mixin(enumMixinStr___THROW); }))) {
mixin(enumMixinStr___THROW);
}
}
static if(!is(typeof(__THROWNL))) {
private enum enumMixinStr___THROWNL = `enum __THROWNL = __attribute__ ( ( __nothrow__ ) );`;
static if(is(typeof({ mixin(enumMixinStr___THROWNL); }))) {
mixin(enumMixinStr___THROWNL);
}
}
static if(!is(typeof(__ptr_t))) {
private enum enumMixinStr___ptr_t = `enum __ptr_t = void *;`;
static if(is(typeof({ mixin(enumMixinStr___ptr_t); }))) {
mixin(enumMixinStr___ptr_t);
}
}
static if(!is(typeof(__flexarr))) {
private enum enumMixinStr___flexarr = `enum __flexarr = [ ];`;
static if(is(typeof({ mixin(enumMixinStr___flexarr); }))) {
mixin(enumMixinStr___flexarr);
}
}
static if(!is(typeof(__glibc_c99_flexarr_available))) {
private enum enumMixinStr___glibc_c99_flexarr_available = `enum __glibc_c99_flexarr_available = 1;`;
static if(is(typeof({ mixin(enumMixinStr___glibc_c99_flexarr_available); }))) {
mixin(enumMixinStr___glibc_c99_flexarr_available);
}
}
static if(!is(typeof(__attribute_malloc__))) {
private enum enumMixinStr___attribute_malloc__ = `enum __attribute_malloc__ = __attribute__ ( ( __malloc__ ) );`;
static if(is(typeof({ mixin(enumMixinStr___attribute_malloc__); }))) {
mixin(enumMixinStr___attribute_malloc__);
}
}
static if(!is(typeof(__attribute_pure__))) {
private enum enumMixinStr___attribute_pure__ = `enum __attribute_pure__ = __attribute__ ( ( __pure__ ) );`;
static if(is(typeof({ mixin(enumMixinStr___attribute_pure__); }))) {
mixin(enumMixinStr___attribute_pure__);
}
}
static if(!is(typeof(__attribute_const__))) {
private enum enumMixinStr___attribute_const__ = `enum __attribute_const__ = __attribute__ ( cast( __const__ ) );`;
static if(is(typeof({ mixin(enumMixinStr___attribute_const__); }))) {
mixin(enumMixinStr___attribute_const__);
}
}
static if(!is(typeof(__attribute_used__))) {
private enum enumMixinStr___attribute_used__ = `enum __attribute_used__ = __attribute__ ( ( __used__ ) );`;
static if(is(typeof({ mixin(enumMixinStr___attribute_used__); }))) {
mixin(enumMixinStr___attribute_used__);
}
}
static if(!is(typeof(__attribute_noinline__))) {
private enum enumMixinStr___attribute_noinline__ = `enum __attribute_noinline__ = __attribute__ ( ( __noinline__ ) );`;
static if(is(typeof({ mixin(enumMixinStr___attribute_noinline__); }))) {
mixin(enumMixinStr___attribute_noinline__);
}
}
static if(!is(typeof(__attribute_deprecated__))) {
private enum enumMixinStr___attribute_deprecated__ = `enum __attribute_deprecated__ = __attribute__ ( ( __deprecated__ ) );`;
static if(is(typeof({ mixin(enumMixinStr___attribute_deprecated__); }))) {
mixin(enumMixinStr___attribute_deprecated__);
}
}
static if(!is(typeof(__attribute_warn_unused_result__))) {
private enum enumMixinStr___attribute_warn_unused_result__ = `enum __attribute_warn_unused_result__ = __attribute__ ( ( __warn_unused_result__ ) );`;
static if(is(typeof({ mixin(enumMixinStr___attribute_warn_unused_result__); }))) {
mixin(enumMixinStr___attribute_warn_unused_result__);
}
}
static if(!is(typeof(__always_inline))) {
private enum enumMixinStr___always_inline = `enum __always_inline = __inline __attribute__ ( ( __always_inline__ ) );`;
static if(is(typeof({ mixin(enumMixinStr___always_inline); }))) {
mixin(enumMixinStr___always_inline);
}
}
static if(!is(typeof(__extern_inline))) {
private enum enumMixinStr___extern_inline = `enum __extern_inline = extern __inline __attribute__ ( ( __gnu_inline__ ) );`;
static if(is(typeof({ mixin(enumMixinStr___extern_inline); }))) {
mixin(enumMixinStr___extern_inline);
}
}
static if(!is(typeof(__extern_always_inline))) {
private enum enumMixinStr___extern_always_inline = `enum __extern_always_inline = extern __inline __attribute__ ( ( __always_inline__ ) ) __attribute__ ( ( __gnu_inline__ ) );`;
static if(is(typeof({ mixin(enumMixinStr___extern_always_inline); }))) {
mixin(enumMixinStr___extern_always_inline);
}
}
static if(!is(typeof(__fortify_function))) {
private enum enumMixinStr___fortify_function = `enum __fortify_function = extern __inline __attribute__ ( ( __always_inline__ ) ) __attribute__ ( ( __gnu_inline__ ) ) ;`;
static if(is(typeof({ mixin(enumMixinStr___fortify_function); }))) {
mixin(enumMixinStr___fortify_function);
}
}
static if(!is(typeof(__restrict_arr))) {
private enum enumMixinStr___restrict_arr = `enum __restrict_arr = __restrict;`;
static if(is(typeof({ mixin(enumMixinStr___restrict_arr); }))) {
mixin(enumMixinStr___restrict_arr);
}
}
static if(!is(typeof(__HAVE_GENERIC_SELECTION))) {
private enum enumMixinStr___HAVE_GENERIC_SELECTION = `enum __HAVE_GENERIC_SELECTION = 1;`;
static if(is(typeof({ mixin(enumMixinStr___HAVE_GENERIC_SELECTION); }))) {
mixin(enumMixinStr___HAVE_GENERIC_SELECTION);
}
}
static if(!is(typeof(_SYS_SELECT_H))) {
private enum enumMixinStr__SYS_SELECT_H = `enum _SYS_SELECT_H = 1;`;
static if(is(typeof({ mixin(enumMixinStr__SYS_SELECT_H); }))) {
mixin(enumMixinStr__SYS_SELECT_H);
}
}
static if(!is(typeof(__NFDBITS))) {
private enum enumMixinStr___NFDBITS = `enum __NFDBITS = ( 8 * cast( int ) ( __fd_mask ) .sizeof );`;
static if(is(typeof({ mixin(enumMixinStr___NFDBITS); }))) {
mixin(enumMixinStr___NFDBITS);
}
}
static if(!is(typeof(FD_SETSIZE))) {
private enum enumMixinStr_FD_SETSIZE = `enum FD_SETSIZE = 1024;`;
static if(is(typeof({ mixin(enumMixinStr_FD_SETSIZE); }))) {
mixin(enumMixinStr_FD_SETSIZE);
}
}
static if(!is(typeof(NFDBITS))) {
private enum enumMixinStr_NFDBITS = `enum NFDBITS = ( 8 * cast( int ) ( __fd_mask ) .sizeof );`;
static if(is(typeof({ mixin(enumMixinStr_NFDBITS); }))) {
mixin(enumMixinStr_NFDBITS);
}
}
static if(!is(typeof(_SYS_SYSMACROS_H))) {
private enum enumMixinStr__SYS_SYSMACROS_H = `enum _SYS_SYSMACROS_H = 1;`;
static if(is(typeof({ mixin(enumMixinStr__SYS_SYSMACROS_H); }))) {
mixin(enumMixinStr__SYS_SYSMACROS_H);
}
}
static if(!is(typeof(__SYSMACROS_DECL_TEMPL))) {
private enum enumMixinStr___SYSMACROS_DECL_TEMPL = `enum __SYSMACROS_DECL_TEMPL = ( rtype , name , proto ) extern rtype gnu_dev_ ## name proto __attribute__ ( ( __nothrow__ ) ) __attribute__ ( cast( __const__ ) ) ;;`;
static if(is(typeof({ mixin(enumMixinStr___SYSMACROS_DECL_TEMPL); }))) {
mixin(enumMixinStr___SYSMACROS_DECL_TEMPL);
}
}
static if(!is(typeof(__SYSMACROS_IMPL_TEMPL))) {
private enum enumMixinStr___SYSMACROS_IMPL_TEMPL = `enum __SYSMACROS_IMPL_TEMPL = ( rtype , name , proto ) __extension__ extern __inline __attribute__ ( ( __gnu_inline__ ) ) __attribute__ ( cast( __const__ ) ) rtype __attribute__ ( ( __nothrow__ ) ) gnu_dev_ ## name proto;`;
static if(is(typeof({ mixin(enumMixinStr___SYSMACROS_IMPL_TEMPL); }))) {
mixin(enumMixinStr___SYSMACROS_IMPL_TEMPL);
}
}
static if(!is(typeof(_SYS_TYPES_H))) {
private enum enumMixinStr__SYS_TYPES_H = `enum _SYS_TYPES_H = 1;`;
static if(is(typeof({ mixin(enumMixinStr__SYS_TYPES_H); }))) {
mixin(enumMixinStr__SYS_TYPES_H);
}
}
static if(!is(typeof(__BIT_TYPES_DEFINED__))) {
private enum enumMixinStr___BIT_TYPES_DEFINED__ = `enum __BIT_TYPES_DEFINED__ = 1;`;
static if(is(typeof({ mixin(enumMixinStr___BIT_TYPES_DEFINED__); }))) {
mixin(enumMixinStr___BIT_TYPES_DEFINED__);
}
}
}
| D |
module UnrealScript.Engine.Texture2D;
import ScriptClasses;
import UnrealScript.Helpers;
import UnrealScript.Core.UObject;
import UnrealScript.Engine.Texture;
extern(C++) interface Texture2D : Texture
{
public extern(D):
private static __gshared ScriptClass mStaticClass;
@property final static ScriptClass StaticClass() { mixin(MGSCC("Class Engine.Texture2D")); }
private static __gshared Texture2D mDefaultProperties;
@property final static Texture2D DefaultProperties() { mixin(MGDPC("Texture2D", "Texture2D Engine.Default__Texture2D")); }
static struct Functions
{
private static __gshared
{
ScriptFunction mSetForceMipLevelsToBeResident;
ScriptFunction mCreate;
}
public @property static final
{
ScriptFunction SetForceMipLevelsToBeResident() { mixin(MGF("mSetForceMipLevelsToBeResident", "Function Engine.Texture2D.SetForceMipLevelsToBeResident")); }
ScriptFunction Create() { mixin(MGF("mCreate", "Function Engine.Texture2D.Create")); }
}
}
struct Texture2DMipMap
{
private ubyte __buffer__[60];
public extern(D):
private static __gshared ScriptStruct mStaticClass;
@property final static ScriptStruct StaticClass() { mixin(MGSCS("ScriptStruct Engine.Texture2D.Texture2DMipMap")); }
@property final auto ref
{
int SizeY() { mixin(MGPS("int", 56)); }
int SizeX() { mixin(MGPS("int", 52)); }
UObject.UntypedBulkData_Mirror Data() { mixin(MGPS("UObject.UntypedBulkData_Mirror", 0)); }
}
}
struct TextureLinkedListMirror
{
private ubyte __buffer__[12];
public extern(D):
private static __gshared ScriptStruct mStaticClass;
@property final static ScriptStruct StaticClass() { mixin(MGSCS("ScriptStruct Engine.Texture2D.TextureLinkedListMirror")); }
@property final auto ref
{
Pointer PrevLink() { mixin(MGPS("Pointer", 8)); }
Pointer Next() { mixin(MGPS("Pointer", 4)); }
Pointer Element() { mixin(MGPS("Pointer", 0)); }
}
}
@property final
{
auto ref
{
ScriptArray!(ubyte) SystemMemoryData() { mixin(MGPC("ScriptArray!(ubyte)", 324)); }
float Timer() { mixin(MGPC("float", 364)); }
int FirstResourceMemMip() { mixin(MGPC("int", 360)); }
Pointer ResourceMem() { mixin(MGPC("Pointer", 356)); }
int MipTailBaseIdx() { mixin(MGPC("int", 352)); }
int StreamingIndex() { mixin(MGPC("int", 348)); }
Texture2D.TextureLinkedListMirror StreamableTexturesLink() { mixin(MGPC("Texture2D.TextureLinkedListMirror", 336)); }
UObject.ThreadSafeCounter PendingMipChangeRequestStatus() { mixin(MGPC("UObject.ThreadSafeCounter", 320)); }
int ResidentMips() { mixin(MGPC("int", 316)); }
int RequestedMips() { mixin(MGPC("int", 312)); }
UObject.Guid TextureFileCacheGuid() { mixin(MGPC("UObject.Guid", 296)); }
ScriptName TextureFileCacheName() { mixin(MGPC("ScriptName", 288)); }
float ForceMipLevelsToBeResidentTimestamp() { mixin(MGPC("float", 284)); }
Texture.TextureAddress AddressY() { mixin(MGPC("Texture.TextureAddress", 278)); }
Texture.TextureAddress AddressX() { mixin(MGPC("Texture.TextureAddress", 277)); }
Texture.EPixelFormat FormatVar() { mixin(MGPC("Texture.EPixelFormat", 276)); }
int OriginalSizeY() { mixin(MGPC("int", 272)); }
int OriginalSizeX() { mixin(MGPC("int", 268)); }
int SizeY() { mixin(MGPC("int", 264)); }
int SizeX() { mixin(MGPC("int", 260)); }
UObject.IndirectArray_Mirror CachedPVRTCMips() { mixin(MGPC("UObject.IndirectArray_Mirror", 248)); }
UObject.IndirectArray_Mirror Mips() { mixin(MGPC("UObject.IndirectArray_Mirror", 236)); }
}
bool bGlobalForceMipLevelsToBeResident() { mixin(MGBPC(280, 0x10)); }
bool bGlobalForceMipLevelsToBeResident(bool val) { mixin(MSBPC(280, 0x10)); }
bool bForceMiplevelsToBeResident() { mixin(MGBPC(280, 0x8)); }
bool bForceMiplevelsToBeResident(bool val) { mixin(MSBPC(280, 0x8)); }
bool bHasBeenLoadedFromPersistentArchive() { mixin(MGBPC(280, 0x4)); }
bool bHasBeenLoadedFromPersistentArchive(bool val) { mixin(MSBPC(280, 0x4)); }
bool bHasCancelationPending() { mixin(MGBPC(280, 0x2)); }
bool bHasCancelationPending(bool val) { mixin(MSBPC(280, 0x2)); }
bool bIsStreamable() { mixin(MGBPC(280, 0x1)); }
bool bIsStreamable(bool val) { mixin(MSBPC(280, 0x1)); }
}
final:
void SetForceMipLevelsToBeResident(float Seconds, int* CinematicTextureGroups = null)
{
ubyte params[8];
params[] = 0;
*cast(float*)params.ptr = Seconds;
if (CinematicTextureGroups !is null)
*cast(int*)¶ms[4] = *CinematicTextureGroups;
(cast(ScriptObject)this).ProcessEvent(Functions.SetForceMipLevelsToBeResident, params.ptr, cast(void*)0);
}
static Texture2D Create(int InSizeX, int InSizeY, Texture.EPixelFormat* InFormat = null)
{
ubyte params[16];
params[] = 0;
*cast(int*)params.ptr = InSizeX;
*cast(int*)¶ms[4] = InSizeY;
if (InFormat !is null)
*cast(Texture.EPixelFormat*)¶ms[8] = *InFormat;
StaticClass.ProcessEvent(Functions.Create, params.ptr, cast(void*)0);
return *cast(Texture2D*)¶ms[12];
}
}
| D |
module shaker;
public import box;
public import random;
public import sign;
public import secretbox;
| D |
module hio.drivers.epoll;
version(linux):
import std.datetime;
import std.string;
import std.container;
import std.exception;
import std.experimental.logger;
import std.typecons;
import std.traits;
import std.algorithm: min, max;
import std.experimental.allocator;
import std.experimental.allocator.mallocator;
import core.memory: GC;
import std.algorithm.comparison: max;
import core.stdc.string: strerror;
import core.stdc.errno: errno, EAGAIN, EINTR;
import core.stdc.stdio: printf;
import core.sys.linux.epoll;
import core.sys.linux.timerfd;
import core.sys.linux.sys.signalfd;
import core.sys.posix.unistd: close, read;
import core.sys.posix.time : itimerspec, CLOCK_MONOTONIC , timespec;
import core.memory;
import timingwheels;
import hio.events;
import hio.common;
private enum InExpTimersSize = 16;
private alias TW = TimingWheels!Timer;
private alias TWAdvanceResult = ReturnType!(TW.advance!(TW));
struct NativeEventLoopImpl {
immutable bool native = true;
immutable string _name = "epoll";
private {
bool stopped = false;
bool inshutdown = false;
enum MAXEVENTS = 1024;
enum TOTAL_FILE_HANDLERS = 16*1024;
int epoll_fd = -1;
int signal_fd = -1;
sigset_t mask;
align(1) epoll_event[MAXEVENTS] events;
Duration tick = 5.msecs;
TW timingwheels;
TWAdvanceResult advancedTimersHash;
long advancedTimersHashLength;
Timer[InExpTimersSize] advancedTimersArray;
long advancedTimersArrayLength;
Timer[] overdue; // timers added with expiration in past
Signal[][int] signals;
FileEventHandler[] fileHandlers;
}
@disable this(this) {}
void initialize() @trusted nothrow {
if ( epoll_fd == -1 ) {
epoll_fd = (() @trusted => epoll_create(MAXEVENTS))();
}
fileHandlers = Mallocator.instance.makeArray!FileEventHandler(TOTAL_FILE_HANDLERS);
GC.addRange(&fileHandlers[0], fileHandlers.length * FileEventHandler.sizeof);
timingwheels.init();
}
void deinit() @trusted {
if (epoll_fd>=0)
{
close(epoll_fd);
epoll_fd = -1;
}
if (signal_fd>=0)
{
close(signal_fd);
signal_fd = -1;
}
//precise_timers = null;
if (fileHandlers !is null)
{
GC.removeRange(&fileHandlers[0]);
Mallocator.instance.dispose(fileHandlers);
fileHandlers = null;
}
timingwheels = TimingWheels!(Timer)();
timingwheels.init();
advancedTimersHash = TWAdvanceResult.init;
}
void stop() @safe {
stopped = true;
}
int _calculate_timeout(SysTime deadline) {
auto now_real = Clock.currTime;
Duration delta = deadline - now_real;
debug(hioepoll) safe_tracef("deadline - now_real: %s", delta);
auto nextTWtimer = timingwheels.timeUntilNextEvent(tick, now_real.stdTime);
debug(hioepoll) safe_tracef("nextTWtimer: %s", nextTWtimer);
delta = min(delta, nextTWtimer);
delta = max(delta, 0.seconds);
return cast(int)delta.total!"msecs";
}
private void execute_overdue_timers()
{
debug(hioepoll) tracef("calling overdue timers");
while (overdue.length > 0)
{
// execute timers which user requested with negative delay
Timer t = overdue[0];
overdue = overdue[1..$];
if ( t is null)
{
// timer was removed
continue;
}
debug(hioepoll) tracef("execute overdue %s", t);
assert(t._armed);
t._armed = false;
HandlerDelegate h = t._handler;
try {
if (inshutdown)
{
h(AppEvent.SHUTDOWN);
}
else
{
h(AppEvent.TMO);
}
} catch (Exception e) {
errorf("Uncaught exception: %s", e);
}
}
}
void shutdown() @safe
in(!stopped && !inshutdown)
{
// scan through all timers
auto a = timingwheels.allTimers();
foreach(t; a.timers)
{
try
{
debug(hioepoll) tracef("send shutdown to timer %s", t);
t._handler(AppEvent.SHUTDOWN);
}
catch(Exception e)
{
errorf("Error on event SHUTDOWN in %s", t);
}
}
// scan through active file descriptors
// and send SHUTDOWN event
if (fileHandlers is null)
{
return;
}
for(int i=0;i<TOTAL_FILE_HANDLERS;i++)
{
if (fileHandlers[i] is null)
{
continue;
}
try
{
debug(hioepoll) tracef("send shutdown to filehandler %s", fileHandlers[i]);
fileHandlers[i].eventHandler(i, AppEvent.SHUTDOWN);
}
catch(Exception e)
{
() @trusted {printf("exception: %s:%d: %s", __FILE__.ptr, __LINE__, toStringz(e.toString));}();
}
}
inshutdown = true;
}
/**
*
**/
void run(Duration d) {
immutable bool runInfinitely = (d == Duration.max);
/**
* eventloop will exit when we reach deadline
* it is allowed to have d == 0.seconds,
* which mean we wil run events once
**/
SysTime deadline = Clock.currTime + d;
debug(hioepoll) tracef("evl run %s",runInfinitely? "infinitely": "for %s".format(d));
scope ( exit )
{
stopped = false;
}
while( !stopped ) {
debug(hioepoll) tracef("event loop iteration");
if (stopped) {
break;
}
int timeout_ms = _calculate_timeout(deadline);
debug(hioepoll) safe_tracef("wait in poll for %s.ms", timeout_ms);
int ready = epoll_wait(epoll_fd, &events[0], MAXEVENTS, timeout_ms);
debug(hioepoll) tracef("got %d events", ready);
SysTime now_real = Clock.currTime;
if ( ready == -1 && errno == EINTR) {
continue;
}
if ( ready < 0 ) {
errorf("epoll_wait returned error %s", fromStringz(strerror(errno)));
// throw new Exception("epoll errno");
}
debug(hioepoll) tracef("events: %s", events[0..ready]);
foreach(i; 0..ready) {
auto e = events[i];
//debug printf("epoll wait: fd:%d: 0x%0x\n", e.data.fd, e.events);
debug(hioepoll) tracef("got event %s", e);
int fd = e.data.fd;
if ( fd == signal_fd ) {
enum siginfo_items = 8;
signalfd_siginfo[siginfo_items] info;
debug(hioepoll) trace("got signal");
assert(signal_fd != -1);
while (true) {
auto rc = read(signal_fd, &info, info.sizeof);
if ( rc < 0 && errno == EAGAIN ) {
break;
}
enforce(rc > 0);
auto got_signals = rc / signalfd_siginfo.sizeof;
debug(hioepoll) tracef("read info %d, %s", got_signals, info[0..got_signals]);
foreach(si; 0..got_signals) {
auto signum = info[si].ssi_signo;
debug(hioepoll) tracef("signum: %d", signum);
foreach(s; signals[signum]) {
debug(hioepoll) tracef("processing signal handler %s", s);
try {
SigHandlerDelegate h = s._handler;
h(signum);
} catch (Exception e) {
errorf("Uncaught exception: %s", e);
}
}
}
}
continue;
}
AppEvent ae;
if ( e.events & EPOLLIN ) {
ae |= AppEvent.IN;
}
if (e.events & EPOLLOUT) {
ae |= AppEvent.OUT;
}
if (e.events & EPOLLERR) {
ae |= AppEvent.ERR;
}
if (e.events & EPOLLHUP) {
ae |= AppEvent.HUP;
}
debug(hioepoll) tracef("process event %02x on fd: %s, handler: %s", e.events, e.data.fd, fileHandlers[fd]);
if ( fileHandlers[fd] !is null ) {
try {
fileHandlers[fd].eventHandler(e.data.fd, ae);
}
catch (Exception e) {
errorf("On file handler: %d, %s", fd, e);
throw e;
}
}
}
auto toCatchUp = timingwheels.ticksToCatchUp(tick, now_real.stdTime);
if(toCatchUp>0)
{
/*
** Some timers expired.
** --------------------
** Most of the time the number of this timers is low, so we optimize for
** this case: copy this small number of timers into small array, then ite-
** rate over this array.
**
** Another case - number of expired timers > InExpTimersSize, so we can't
** copy timers to this array. Then we just iterate over the result.
**
** Why do we need random access to any expired timer (so we have to save
** it in array or in map) - because any timer handler may wish to cancel
** another timer (and this another timer can also be in 'advance' result).
** Example - expired timer wakes up some task which cancel socket io timer.
*/
advancedTimersHash = timingwheels.advance(toCatchUp);
if (advancedTimersHash.length < InExpTimersSize)
{
debug(hioepoll) tracef("calling timers");
//
// this case happens most of the time - low number of timers per tick
// save expired timers into small array.
//
int j = 0;
foreach(t; advancedTimersHash.timers)
{
advancedTimersArray[j++] = t;
}
advancedTimersArrayLength = j;
for(j=0;j < advancedTimersArrayLength; j++)
{
Timer t = advancedTimersArray[j];
if ( t is null )
{
continue;
}
HandlerDelegate h = t._handler;
assert(t._armed);
t._armed = false;
try {
h(AppEvent.TMO);
} catch (Exception e) {
errorf("Uncaught exception: %s", e);
}
}
}
else
{
debug(hioepoll) tracef("calling timers");
advancedTimersHashLength = advancedTimersHash.length;
foreach (t; advancedTimersHash.timers)
{
HandlerDelegate h = t._handler;
assert(t._armed);
t._armed = false;
try {
h(AppEvent.TMO);
} catch (Exception e) {
errorf("Uncaught exception: %s", e);
}
}
}
advancedTimersArrayLength = 0;
advancedTimersHashLength = 0;
}
execute_overdue_timers();
if (!runInfinitely && now_real >= deadline)
{
debug(hioepoll) safe_tracef("reached deadline, return");
return;
}
}
}
void start_timer(Timer t) @safe {
debug(hioepoll) tracef("insert timer: %s", t);
if ( inshutdown)
{
throw new LoopShutdownException("starting timer");
}
assert(!t._armed);
t._armed = true;
auto now = Clock.currTime;
auto d = t._expires - now;
d = max(d, 0.seconds);
if ( d < tick ) {
overdue ~= t;
debug(hioepoll) tracef("inserted overdue timer: %s", t);
return;
}
ulong twNow = timingwheels.currStdTime(tick);
Duration twdelay = (now.stdTime - twNow).hnsecs;
debug(hioepoll) safe_tracef("tw delay: %s", (now.stdTime - twNow).hnsecs);
timingwheels.schedule(t, (d + twdelay)/tick);
}
void stop_timer(Timer t) @safe {
debug(hioepoll) tracef("remove timer %s", t);
if ( advancedTimersArrayLength > 0)
{
for(int j=0; j<advancedTimersArrayLength;j++)
{
if ( t is advancedTimersArray[j])
{
advancedTimersArray[j] = null;
return;
}
}
}
else if (advancedTimersHashLength>0 && advancedTimersHash.contains(t.id))
{
advancedTimersHash.remove(t.id);
return;
}
else if (overdue.length > 0)
{
for(int i=0;i<overdue.length;i++)
{
if (overdue[i] is t)
{
overdue[i] = null;
debug(hioepoll) tracef("remove timer from overdue %s", t);
}
}
}
// static destructors can try to stop timers after loop deinit, so we check totalTimers
if (timingwheels.totalTimers() > 0)
{
timingwheels.cancel(t);
}
}
//
// signals
//
void start_signal(Signal s) {
debug(hioepoll) tracef("start signal %s", s);
debug(hioepoll) tracef("signals: %s", signals);
auto r = s._signum in signals;
if ( r is null || r.length == 0 ) {
// enable signal only through kevent
_add_kernel_signal(s);
}
signals[s._signum] ~= s;
}
void stop_signal(Signal s) {
debug(hioepoll) trace("stop signal");
auto r = s._signum in signals;
if ( r is null ) {
throw new NotFoundException("You tried to stop signal that was not started");
}
Signal[] new_row;
foreach(a; *r) {
if (a._id == s._id) {
continue;
}
new_row ~= a;
}
if ( new_row.length == 0 ) {
*r = null;
_del_kernel_signal(s);
// reenable old signal behaviour
} else {
*r = new_row;
}
debug(hioepoll) tracef("new signals %d row %s", s._signum, new_row);
}
void _add_kernel_signal(Signal s) {
debug(hioepoll) tracef("add kernel signal %d, id: %d", s._signum, s._id);
sigset_t m;
sigemptyset(&m);
sigaddset(&m, s._signum);
pthread_sigmask(SIG_BLOCK, &m, null);
sigaddset(&mask, s._signum);
if ( signal_fd == -1 ) {
signal_fd = signalfd(-1, &mask, SFD_NONBLOCK|SFD_CLOEXEC);
debug(hioepoll) tracef("signalfd %d", signal_fd);
epoll_event e;
e.events = EPOLLIN|EPOLLET;
e.data.fd = signal_fd;
auto rc = epoll_ctl(epoll_fd, EPOLL_CTL_ADD, signal_fd, &e);
enforce(rc >= 0, "epoll_ctl add(%s): %s".format(e, fromStringz(strerror(errno))));
} else {
signalfd(signal_fd, &mask, 0);
}
}
void _del_kernel_signal(Signal s) {
debug(hioepoll) tracef("del kernel signal %d, id: %d", s._signum, s._id);
sigset_t m;
sigemptyset(&m);
sigaddset(&m, s._signum);
pthread_sigmask(SIG_UNBLOCK, &m, null);
sigdelset(&mask, s._signum);
assert(signal_fd != -1);
signalfd(signal_fd, &mask, 0);
}
void wait_for_user_event(int event_id, FileEventHandler handler) @safe {
epoll_event e;
e.events = EPOLLIN;
e.data.fd = event_id;
auto rc = (() @trusted => epoll_ctl(epoll_fd, EPOLL_CTL_ADD, event_id, &e))();
enforce(rc >= 0, "epoll_ctl add(%s): %s".format(e, s_strerror(errno)));
fileHandlers[event_id] = handler;
}
void stop_wait_for_user_event(int event_id, FileEventHandler handler) @safe {
epoll_event e;
e.events = EPOLLIN;
e.data.fd = event_id;
auto rc = (() @trusted => epoll_ctl(epoll_fd, EPOLL_CTL_DEL, event_id, &e))();
fileHandlers[event_id] = null;
}
int get_kernel_id() pure @safe nothrow @nogc {
return epoll_fd;
}
//
// files/sockets
//
void detach(int fd) @safe {
debug(hioepoll) tracef("detaching fd(%d) from fileHandlers[%d]", fd, fileHandlers.length);
fileHandlers[fd] = null;
}
void start_poll(int fd, AppEvent ev, FileEventHandler f) @trusted {
assert(epoll_fd != -1);
debug(hioepoll) tracef("start poll for %s on fd: %s (inshutdown: %s)", ev, fd, inshutdown);
if ( inshutdown )
{
//throw new LoopShutdownException("start polling");
f.eventHandler(fd, AppEvent.SHUTDOWN);
return;
}
epoll_event e;
e.events = appEventToSysEvent(ev);
if ( ev & AppEvent.EXT_EPOLLEXCLUSIVE )
{
e.events |= EPOLLEXCLUSIVE;
}
e.data.fd = fd;
//debug printf("epoll ctl: fd:%d: 0x%0x\n", e.data.fd, e.events);
auto rc = epoll_ctl(epoll_fd, EPOLL_CTL_ADD, fd, &e);
enforce(rc >= 0, "epoll_ctl add(%d, %s): %s".format(fd, e, fromStringz(strerror(errno))));
fileHandlers[fd] = f;
}
void stop_poll(int fd, AppEvent ev) @trusted {
assert(epoll_fd != -1);
epoll_event e;
e.events = appEventToSysEvent(ev);
e.data.fd = fd;
auto rc = epoll_ctl(epoll_fd, EPOLL_CTL_DEL, fd, &e);
}
auto appEventToSysEvent(AppEvent ae) pure @safe {
import core.bitop;
// clear EXT_ flags
ae &= AppEvent.ALL;
assert( popcnt(ae) == 1, "Set one event at a time, you tried %x, %s".format(ae, appeventToString(ae)));
assert( ae <= AppEvent.CONN, "You can ask for IN,OUT,CONN events");
switch ( ae ) {
case AppEvent.IN:
return EPOLLIN;
case AppEvent.OUT:
return EPOLLOUT;
//case AppEvent.CONN:
// return EVFILT_READ;
default:
throw new Exception("You can't wait for event %X".format(ae));
}
}
}
| D |
/*
* All content copyright Terracotta, Inc., unless otherwise indicated. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy
* of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
*/
module hunt.quartz.dbstore.DBConnectionManager;
import hunt.collection.HashMap;
import hunt.entity;
import hunt.Exceptions;
import hunt.logging.ConsoleLogger;
alias Connection = EntityManager;
/**
* <p>
* Manages a collection of ConnectionProviders, and provides transparent access
* to their connections.
* </p>
*
* @see ConnectionProvider
* @see PoolingConnectionProvider
* @see JNDIConnectionProvider
* @see hunt.quartz.utils.weblogic.WeblogicConnectionProvider
*
* @author James House
* @author Sharada Jambula
* @author Mohammad Rezaei
*/
class DBConnectionManager {
/*
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*
* Constants.
*
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*/
enum string DB_PROPS_PREFIX = "hunt.quartz.db.";
/*
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*
* Data members.
*
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*/
private __gshared DBConnectionManager instance;
shared static this() {
instance = new DBConnectionManager();
}
/*
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*
* Constructors.
*
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*/
/**
* <p>
* Private constructor
* </p>
*
*/
private this() {
}
void initialize(EntityOption option) {
_option = option;
}
private EntityOption _option;
/*
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*
* Interface.
*
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*/
// void addConnectionProvider(string dataSourceName,
// ConnectionProvider provider) {
// this.providers.put(dataSourceName, provider);
// }
/**
* Get a database connection from the DataSource with the given name.
*
* @return a database connection
* @exception SQLException
* if an error occurs, or there is no DataSource with the
* given name.
*/
Connection getConnection() {
if (em is null) {
version(HUNT_QUARTZ_DEBUG) trace("creating EntityManager for " ~ _option.database.database);
EntityManagerFactory entityManagerFactory = Persistence.createEntityManagerFactory(_option.database.driver,
_option);
em = entityManagerFactory.currentEntityManager();
}
return em;
}
private static EntityManager em;
/**
* Get the class instance.
*
* @return an instance of this class
*/
static DBConnectionManager getInstance() {
// since the instance variable is initialized at class loading time,
// it's not necessary to synchronize this method */
return instance;
}
/**
* Shuts down database connections from the DataSource with the given name,
* if applicable for the underlying provider.
*
* @exception SQLException
* if an error occurs, or there is no DataSource with the
* given name.
*/
void shutdown(string dsName) {
// ConnectionProvider provider = providers.get(dsName);
// if (provider is null) {
// throw new SQLException("There is no DataSource named '"
// ~ dsName ~ "'");
// }
// provider.shutdown();
}
// ConnectionProvider getConnectionProvider(string key) {
// return providers.get(key);
// }
}
| D |
/** sspi.d
Converted from 'sspi.h'.
Version: V7.0
Authors: Koji Kishita
*/
module c.winodws.sspi;
import c.windows.sdkddkver;
import c.windows.windef;
import c.windows.winternl;
import c.windows.guiddef;
extern(C){
enum ISSP_LEVEL = 32;
enum ISSP_MODE = 1;
alias WCHAR SEC_WCHAR;
alias CHAR SEC_CHAR;
alias LONG SECURITY_STATUS;
version(UNICODE){
alias SEC_WCHAR* SECURITY_PSTR;
alias const(SEC_WCHAR)* SECURITY_PCSTR;
}else{
alias SEC_CHAR* SECURITY_PSTR;
alias const(SEC_CHAR)* SECURITY_PCSTR;
}
struct SecHandle {
ULONG_PTR dwLower;
ULONG_PTR dwUpper;
}
alias SecHandle* PSecHandle;
// SecInvalidateHandle( x ) ((PSecHandle) (x))->dwLower = ((PSecHandle) (x))->dwUpper = ((ULONG_PTR) ((INT_PTR)-1)) ;
// SecIsValidHandle( x ) ( ( ((PSecHandle) (x))->dwLower != ((ULONG_PTR) ((INT_PTR) -1 ))) && ( ((PSecHandle) (x))->dwUpper != ((ULONG_PTR) ((INT_PTR) -1 ))) )
enum SEC_DELETED_HANDLE = cast(ULONG_PTR)-2;
enum CredHandle : SecHandle {init = (SecHandle).init}
enum PCredHandle : PSecHandle {init = (PSecHandle).init}
enum CtxtHandle : SecHandle {init = (SecHandle).init}
enum PCtxtHandle : PSecHandle {init = (PSecHandle).init}
//alias ulong QWORD; to windef
alias QWORD SECURITY_INTEGER;
alias SECURITY_INTEGER* PSECURITY_INTEGER;
alias SECURITY_INTEGER TimeStamp;
alias SECURITY_INTEGER* PTimeStamp;
/*struct SECURITY_STRING {
ushort Length;
ushort MaximumLength;
ushort* Buffer;
}
alias SECURITY_STRING* PSECURITY_STRING;*/
alias UNICODE_STRING SECURITY_STRING;
alias SECURITY_STRING* PSECURITY_STRING;
struct SecPkgInfoW {
uint fCapabilities;
ushort wVersion;
ushort wRPCID;
uint cbMaxToken;
SEC_WCHAR* Name;
SEC_WCHAR* Comment;
}
alias SecPkgInfoW* PSecPkgInfoW;
struct SecPkgInfoA {
uint fCapabilities;
ushort wVersion;
ushort wRPCID;
uint cbMaxToken;
SEC_CHAR* Name;
SEC_CHAR* Comment;
}
alias SecPkgInfoA* PSecPkgInfoA;
version(UNICODE){
alias SecPkgInfoW SecPkgInfo;
alias PSecPkgInfoW PSecPkgInfo;
}else{
alias SecPkgInfoA SecPkgInfo;
alias PSecPkgInfoA PSecPkgInfo;
}
enum {
SECPKG_FLAG_INTEGRITY = 0x00000001,
SECPKG_FLAG_PRIVACY = 0x00000002,
SECPKG_FLAG_TOKEN_ONLY = 0x00000004,
SECPKG_FLAG_DATAGRAM = 0x00000008,
SECPKG_FLAG_CONNECTION = 0x00000010,
SECPKG_FLAG_MULTI_REQUIRED = 0x00000020,
SECPKG_FLAG_CLIENT_ONLY = 0x00000040,
SECPKG_FLAG_EXTENDED_ERROR = 0x00000080,
SECPKG_FLAG_IMPERSONATION = 0x00000100,
SECPKG_FLAG_ACCEPT_WIN32_NAME = 0x00000200,
SECPKG_FLAG_STREAM = 0x00000400,
SECPKG_FLAG_NEGOTIABLE = 0x00000800,
SECPKG_FLAG_GSS_COMPATIBLE = 0x00001000,
SECPKG_FLAG_LOGON = 0x00002000,
SECPKG_FLAG_ASCII_BUFFERS = 0x00004000,
SECPKG_FLAG_FRAGMENT = 0x00008000,
SECPKG_FLAG_MUTUAL_AUTH = 0x00010000,
SECPKG_FLAG_DELEGATION = 0x00020000,
SECPKG_FLAG_READONLY_WITH_CHECKSUM = 0x00040000,
SECPKG_FLAG_RESTRICTED_TOKENS = 0x00080000,
SECPKG_FLAG_NEGO_EXTENDER = 0x00100000,
SECPKG_FLAG_NEGOTIABLE2 = 0x00200000,
}
enum SECPKG_ID_NONE = 0xFFFF;
struct SecBuffer {
uint cbBuffer;
uint BufferType;
void* pvBuffer;
}
alias SecBuffer* PSecBuffer;
struct SecBufferDesc {
uint ulVersion;
uint cBuffers;
PSecBuffer pBuffers;
}
alias SecBufferDesc* PSecBufferDesc;
enum {
SECBUFFER_VERSION = 0,
SECBUFFER_EMPTY = 0,
SECBUFFER_DATA = 1,
SECBUFFER_TOKEN = 2,
SECBUFFER_PKG_PARAMS = 3,
SECBUFFER_MISSING = 4,
SECBUFFER_EXTRA = 5,
SECBUFFER_STREAM_TRAILER = 6,
SECBUFFER_STREAM_HEADER = 7,
SECBUFFER_NEGOTIATION_INFO = 8,
SECBUFFER_PADDING = 9,
SECBUFFER_STREAM = 10,
SECBUFFER_MECHLIST = 11,
SECBUFFER_MECHLIST_SIGNATURE = 12,
SECBUFFER_TARGET = 13,
SECBUFFER_CHANNEL_BINDINGS = 14,
SECBUFFER_CHANGE_PASS_RESPONSE = 15,
SECBUFFER_TARGET_HOST = 16,
SECBUFFER_ALERT = 17,
}
enum {
SECBUFFER_ATTRMASK = 0xF0000000,
SECBUFFER_READONLY = 0x80000000,
SECBUFFER_READONLY_WITH_CHECKSUM = 0x10000000,
SECBUFFER_RESERVED = 0x60000000,
}
struct SEC_NEGOTIATION_INFO {
uint Size;
uint NameLength;
SEC_WCHAR* Name;
void* Reserved;
}
alias SEC_NEGOTIATION_INFO* PSEC_NEGOTIATION_INFO ;
struct SEC_CHANNEL_BINDINGS {
uint dwInitiatorAddrType;
uint cbInitiatorLength;
uint dwInitiatorOffset;
uint dwAcceptorAddrType;
uint cbAcceptorLength;
uint dwAcceptorOffset;
uint cbApplicationDataLength;
uint dwApplicationDataOffset;
}
alias SEC_CHANNEL_BINDINGS* PSEC_CHANNEL_BINDINGS ;
enum {
SECURITY_NATIVE_DREP = 0x00000010,
SECURITY_NETWORK_DREP = 0x00000000,
SECPKG_CRED_INBOUND = 0x00000001,
SECPKG_CRED_OUTBOUND = 0x00000002,
SECPKG_CRED_BOTH = 0x00000003,
SECPKG_CRED_DEFAULT = 0x00000004,
SECPKG_CRED_RESERVED = 0xF0000000,
SECPKG_CRED_AUTOLOGON_RESTRICTED = 0x00000010,
SECPKG_CRED_PROCESS_POLICY_ONLY = 0x00000020,
ISC_REQ_DELEGATE = 0x00000001,
ISC_REQ_MUTUAL_AUTH = 0x00000002,
ISC_REQ_REPLAY_DETECT = 0x00000004,
ISC_REQ_SEQUENCE_DETECT = 0x00000008,
ISC_REQ_CONFIDENTIALITY = 0x00000010,
ISC_REQ_USE_SESSION_KEY = 0x00000020,
ISC_REQ_PROMPT_FOR_CREDS = 0x00000040,
ISC_REQ_USE_SUPPLIED_CREDS = 0x00000080,
ISC_REQ_ALLOCATE_MEMORY = 0x00000100,
ISC_REQ_USE_DCE_STYLE = 0x00000200,
ISC_REQ_DATAGRAM = 0x00000400,
ISC_REQ_CONNECTION = 0x00000800,
ISC_REQ_CALL_LEVEL = 0x00001000,
ISC_REQ_FRAGMENT_SUPPLIED = 0x00002000,
ISC_REQ_EXTENDED_ERROR = 0x00004000,
ISC_REQ_STREAM = 0x00008000,
ISC_REQ_INTEGRITY = 0x00010000,
ISC_REQ_IDENTIFY = 0x00020000,
ISC_REQ_NULL_SESSION = 0x00040000,
ISC_REQ_MANUAL_CRED_VALIDATION = 0x00080000,
ISC_REQ_RESERVED1 = 0x00100000,
ISC_REQ_FRAGMENT_TO_FIT = 0x00200000,
ISC_REQ_FORWARD_CREDENTIALS = 0x00400000,
ISC_REQ_NO_INTEGRITY = 0x00800000,
ISC_REQ_USE_HTTP_STYLE = 0x01000000,
ISC_RET_DELEGATE = 0x00000001,
ISC_RET_MUTUAL_AUTH = 0x00000002,
ISC_RET_REPLAY_DETECT = 0x00000004,
ISC_RET_SEQUENCE_DETECT = 0x00000008,
ISC_RET_CONFIDENTIALITY = 0x00000010,
ISC_RET_USE_SESSION_KEY = 0x00000020,
ISC_RET_USED_COLLECTED_CREDS = 0x00000040,
ISC_RET_USED_SUPPLIED_CREDS = 0x00000080,
ISC_RET_ALLOCATED_MEMORY = 0x00000100,
ISC_RET_USED_DCE_STYLE = 0x00000200,
ISC_RET_DATAGRAM = 0x00000400,
ISC_RET_CONNECTION = 0x00000800,
ISC_RET_INTERMEDIATE_RETURN = 0x00001000,
ISC_RET_CALL_LEVEL = 0x00002000,
ISC_RET_EXTENDED_ERROR = 0x00004000,
ISC_RET_STREAM = 0x00008000,
ISC_RET_INTEGRITY = 0x00010000,
ISC_RET_IDENTIFY = 0x00020000,
ISC_RET_NULL_SESSION = 0x00040000,
ISC_RET_MANUAL_CRED_VALIDATION = 0x00080000,
ISC_RET_RESERVED1 = 0x00100000,
ISC_RET_FRAGMENT_ONLY = 0x00200000,
ISC_RET_FORWARD_CREDENTIALS = 0x00400000,
ISC_RET_USED_HTTP_STYLE = 0x01000000,
ISC_RET_NO_ADDITIONAL_TOKEN = 0x02000000,
ISC_RET_REAUTHENTICATION = 0x08000000,
ASC_REQ_DELEGATE = 0x00000001,
ASC_REQ_MUTUAL_AUTH = 0x00000002,
ASC_REQ_REPLAY_DETECT = 0x00000004,
ASC_REQ_SEQUENCE_DETECT = 0x00000008,
ASC_REQ_CONFIDENTIALITY = 0x00000010,
ASC_REQ_USE_SESSION_KEY = 0x00000020,
ASC_REQ_ALLOCATE_MEMORY = 0x00000100,
ASC_REQ_USE_DCE_STYLE = 0x00000200,
ASC_REQ_DATAGRAM = 0x00000400,
ASC_REQ_CONNECTION = 0x00000800,
ASC_REQ_CALL_LEVEL = 0x00001000,
ASC_REQ_EXTENDED_ERROR = 0x00008000,
ASC_REQ_STREAM = 0x00010000,
ASC_REQ_INTEGRITY = 0x00020000,
ASC_REQ_LICENSING = 0x00040000,
ASC_REQ_IDENTIFY = 0x00080000,
ASC_REQ_ALLOW_NULL_SESSION = 0x00100000,
ASC_REQ_ALLOW_NON_USER_LOGONS = 0x00200000,
ASC_REQ_ALLOW_CONTEXT_REPLAY = 0x00400000,
ASC_REQ_FRAGMENT_TO_FIT = 0x00800000,
ASC_REQ_FRAGMENT_SUPPLIED = 0x00002000,
ASC_REQ_NO_TOKEN = 0x01000000,
ASC_REQ_PROXY_BINDINGS = 0x04000000,
ASC_REQ_ALLOW_MISSING_BINDINGS = 0x10000000,
ASC_RET_DELEGATE = 0x00000001,
ASC_RET_MUTUAL_AUTH = 0x00000002,
ASC_RET_REPLAY_DETECT = 0x00000004,
ASC_RET_SEQUENCE_DETECT = 0x00000008,
ASC_RET_CONFIDENTIALITY = 0x00000010,
ASC_RET_USE_SESSION_KEY = 0x00000020,
ASC_RET_ALLOCATED_MEMORY = 0x00000100,
ASC_RET_USED_DCE_STYLE = 0x00000200,
ASC_RET_DATAGRAM = 0x00000400,
ASC_RET_CONNECTION = 0x00000800,
ASC_RET_CALL_LEVEL = 0x00002000,
ASC_RET_THIRD_LEG_FAILED = 0x00004000,
ASC_RET_EXTENDED_ERROR = 0x00008000,
ASC_RET_STREAM = 0x00010000,
ASC_RET_INTEGRITY = 0x00020000,
ASC_RET_LICENSING = 0x00040000,
ASC_RET_IDENTIFY = 0x00080000,
ASC_RET_NULL_SESSION = 0x00100000,
ASC_RET_ALLOW_NON_USER_LOGONS = 0x00200000,
ASC_RET_ALLOW_CONTEXT_REPLAY = 0x00400000,
ASC_RET_FRAGMENT_ONLY = 0x00800000,
ASC_RET_NO_TOKEN = 0x01000000,
ASC_RET_NO_ADDITIONAL_TOKEN = 0x02000000,
ASC_RET_NO_PROXY_BINDINGS = 0x04000000,
ASC_RET_MISSING_BINDINGS = 0x10000000,
}
enum {
SECPKG_CRED_ATTR_NAMES = 1,
SECPKG_CRED_ATTR_SSI_PROVIDER = 2,
}
struct SecPkgCredentials_NamesW {
SEC_WCHAR* sUserName;
}
alias SecPkgCredentials_NamesW* PSecPkgCredentials_NamesW;
struct SecPkgCredentials_NamesA {
SEC_CHAR* sUserName;
}
alias SecPkgCredentials_NamesA* PSecPkgCredentials_NamesA;
version(UNICODE){
alias SecPkgCredentials_NamesW SecPkgCredentials_Names;
alias PSecPkgCredentials_NamesW PSecPkgCredentials_Names;
}else{
alias SecPkgCredentials_NamesA SecPkgCredentials_Names;
alias PSecPkgCredentials_NamesA PSecPkgCredentials_Names;
}
//NTDDI_VERSION > NTDDI_WS03
struct SecPkgCredentials_SSIProviderW {
SEC_WCHAR* sProviderName;
uint ProviderInfoLength;
char* ProviderInfo;
}
alias SecPkgCredentials_SSIProviderW* PSecPkgCredentials_SSIProviderW;
struct SecPkgCredentials_SSIProviderA {
SEC_CHAR* sProviderName;
uint ProviderInfoLength;
char* ProviderInfo;
}
alias SecPkgCredentials_SSIProviderA* PSecPkgCredentials_SSIProviderA;
version(UNICODE){
alias SecPkgCredentials_SSIProviderW SecPkgCredentials_SSIProvider;
alias PSecPkgCredentials_SSIProviderW PSecPkgCredentials_SSIProvider;
}else{
alias SecPkgCredentials_SSIProviderA SecPkgCredentials_SSIProvider;
alias PSecPkgCredentials_SSIProviderA PSecPkgCredentials_SSIProvider;
}
enum {
SECPKG_ATTR_SIZES = 0,
SECPKG_ATTR_NAMES = 1,
SECPKG_ATTR_LIFESPAN = 2,
SECPKG_ATTR_DCE_INFO = 3,
SECPKG_ATTR_STREAM_SIZES = 4,
SECPKG_ATTR_KEY_INFO = 5,
SECPKG_ATTR_AUTHORITY = 6,
SECPKG_ATTR_PROTO_INFO = 7,
SECPKG_ATTR_PASSWORD_EXPIRY = 8,
SECPKG_ATTR_SESSION_KEY = 9,
SECPKG_ATTR_PACKAGE_INFO = 10,
SECPKG_ATTR_USER_FLAGS = 11,
SECPKG_ATTR_NEGOTIATION_INFO = 12,
SECPKG_ATTR_NATIVE_NAMES = 13,
SECPKG_ATTR_FLAGS = 14,
SECPKG_ATTR_USE_VALIDATED = 15,
SECPKG_ATTR_CREDENTIAL_NAME = 16,
SECPKG_ATTR_TARGET_INFORMATION = 17,
SECPKG_ATTR_ACCESS_TOKEN = 18,
SECPKG_ATTR_TARGET = 19,
SECPKG_ATTR_AUTHENTICATION_ID = 20,
SECPKG_ATTR_LOGOFF_TIME = 21,
SECPKG_ATTR_NEGO_KEYS = 22,
SECPKG_ATTR_PROMPTING_NEEDED = 24,
SECPKG_ATTR_UNIQUE_BINDINGS = 25,
SECPKG_ATTR_ENDPOINT_BINDINGS = 26,
SECPKG_ATTR_CLIENT_SPECIFIED_TARGET = 27,
SECPKG_ATTR_LAST_CLIENT_TOKEN_STATUS = 30,
SECPKG_ATTR_NEGO_PKG_INFO = 31,
SECPKG_ATTR_NEGO_STATUS = 32,
SECPKG_ATTR_CONTEXT_DELETED = 33,
SECPKG_ATTR_SUBJECT_SECURITY_ATTRIBUTES = 128,
}
struct SecPkgContext_SubjectAttributes {
void* AttributeInfo;
}
alias SecPkgContext_SubjectAttributes* PSecPkgContext_SubjectAttributes;
enum {
SECPKG_ATTR_NEGO_INFO_FLAG_NO_KERBEROS = 0x1,
SECPKG_ATTR_NEGO_INFO_FLAG_NO_NTLM = 0x2,
}
enum {
SecPkgCredClass_None = 0,
SecPkgCredClass_Ephemeral = 10,
SecPkgCredClass_PersistedGeneric = 20,
SecPkgCredClass_PersistedSpecific = 30,
SecPkgCredClass_Explicit = 40,
}
alias int SECPKG_CRED_CLASS;
alias SECPKG_CRED_CLASS* PSECPKG_CRED_CLASS;
struct SecPkgContext_CredInfo {
SECPKG_CRED_CLASS CredClass;
uint IsPromptingNeeded;
}
alias SecPkgContext_CredInfo* PSecPkgContext_CredInfo;
struct SecPkgContext_NegoPackageInfo {
uint PackageMask;
}
alias SecPkgContext_NegoPackageInfo* PSecPkgContext_NegoPackageInfo;
struct SecPkgContext_NegoStatus {
uint LastStatus;
}
alias SecPkgContext_NegoStatus* PSecPkgContext_NegoStatus;
struct SecPkgContext_Sizes {
uint cbMaxToken;
uint cbMaxSignature;
uint cbBlockSize;
uint cbSecurityTrailer;
}
alias SecPkgContext_Sizes* PSecPkgContext_Sizes;
struct SecPkgContext_StreamSizes {
uint cbHeader;
uint cbTrailer;
uint cbMaximumMessage;
uint cBuffers;
uint cbBlockSize;
}
alias SecPkgContext_StreamSizes* PSecPkgContext_StreamSizes;
struct SecPkgContext_NamesW {
SEC_WCHAR* sUserName;
}
alias SecPkgContext_NamesW* PSecPkgContext_NamesW;
enum {
SecPkgAttrLastClientTokenYes,
SecPkgAttrLastClientTokenNo,
SecPkgAttrLastClientTokenMaybe
}
alias int SECPKG_ATTR_LCT_STATUS;
alias SECPKG_ATTR_LCT_STATUS* PSECPKG_ATTR_LCT_STATUS;
struct SecPkgContext_LastClientTokenStatus {
SECPKG_ATTR_LCT_STATUS LastClientTokenStatus;
}
alias SecPkgContext_LastClientTokenStatus* PSecPkgContext_LastClientTokenStatus;
struct SecPkgContext_NamesA {
SEC_CHAR* sUserName;
}
alias SecPkgContext_NamesA* PSecPkgContext_NamesA;
version(UNICODE){
alias SecPkgContext_NamesW SecPkgContext_Names;
alias PSecPkgContext_NamesW PSecPkgContext_Names;
}else{
alias SecPkgContext_NamesA SecPkgContext_Names;
alias PSecPkgContext_NamesA PSecPkgContext_Names;
}
struct SecPkgContext_Lifespan {
TimeStamp tsStart;
TimeStamp tsExpiry;
}
alias SecPkgContext_Lifespan* PSecPkgContext_Lifespan;
struct SecPkgContext_DceInfo {
uint AuthzSvc;
void* pPac;
}
alias SecPkgContext_DceInfo* PSecPkgContext_DceInfo;
struct SecPkgContext_KeyInfoA {
SEC_CHAR* sSignatureAlgorithmName;
SEC_CHAR* sEncryptAlgorithmName;
uint KeySize;
uint SignatureAlgorithm;
uint EncryptAlgorithm;
}
alias SecPkgContext_KeyInfoA* PSecPkgContext_KeyInfoA;
struct SecPkgContext_KeyInfoW {
SEC_WCHAR* sSignatureAlgorithmName;
SEC_WCHAR* sEncryptAlgorithmName;
uint KeySize;
uint SignatureAlgorithm;
uint EncryptAlgorithm;
}
alias SecPkgContext_KeyInfoW* PSecPkgContext_KeyInfoW;
version(UNICODE){
alias SecPkgContext_KeyInfoW SecPkgContext_KeyInfo;
alias PSecPkgContext_KeyInfoW PSecPkgContext_KeyInfo;
}else{
alias SecPkgContext_KeyInfoA SecPkgContext_KeyInfo;
alias PSecPkgContext_KeyInfoA PSecPkgContext_KeyInfo;
}
struct SecPkgContext_AuthorityA {
SEC_CHAR* sAuthorityName;
}
alias SecPkgContext_AuthorityA* PSecPkgContext_AuthorityA;
struct SecPkgContext_AuthorityW {
SEC_WCHAR* sAuthorityName;
}
alias SecPkgContext_AuthorityW* PSecPkgContext_AuthorityW;
version(UNICODE){
alias SecPkgContext_AuthorityW SecPkgContext_Authority;
alias PSecPkgContext_AuthorityW PSecPkgContext_Authority;
}else{
alias SecPkgContext_AuthorityA SecPkgContext_Authority;
alias PSecPkgContext_AuthorityA PSecPkgContext_Authority;
}
struct SecPkgContext_ProtoInfoA {
SEC_CHAR* sProtocolName;
uint majorVersion;
uint minorVersion;
}
alias SecPkgContext_ProtoInfoA* PSecPkgContext_ProtoInfoA;
struct SecPkgContext_ProtoInfoW {
SEC_WCHAR* sProtocolName;
uint majorVersion;
uint minorVersion;
}
alias SecPkgContext_ProtoInfoW* PSecPkgContext_ProtoInfoW;
version(UNICODE){
alias SecPkgContext_ProtoInfoW SecPkgContext_ProtoInfo;
alias PSecPkgContext_ProtoInfoW PSecPkgContext_ProtoInfo;
}else{
alias SecPkgContext_ProtoInfoA SecPkgContext_ProtoInfo;
alias PSecPkgContext_ProtoInfoA PSecPkgContext_ProtoInfo;
}
struct SecPkgContext_PasswordExpiry {
TimeStamp tsPasswordExpires;
}
alias SecPkgContext_PasswordExpiry* PSecPkgContext_PasswordExpiry;
//NTDDI_VERSION > NTDDI_WS03
struct SecPkgContext_LogoffTime {
TimeStamp tsLogoffTime;
}
alias SecPkgContext_LogoffTime* PSecPkgContext_LogoffTime;
struct SecPkgContext_SessionKey {
uint SessionKeyLength;
ubyte* SessionKey;
}
alias SecPkgContext_SessionKey* PSecPkgContext_SessionKey;
struct SecPkgContext_NegoKeys {
uint KeyType;
ushort KeyLength;
ubyte* KeyValue;
uint VerifyKeyType;
ushort VerifyKeyLength;
ubyte* VerifyKeyValue;
}
alias SecPkgContext_NegoKeys* PSecPkgContext_NegoKeys;
struct SecPkgContext_PackageInfoW {
PSecPkgInfoW PackageInfo;
}
alias SecPkgContext_PackageInfoW* PSecPkgContext_PackageInfoW;
struct SecPkgContext_PackageInfoA {
PSecPkgInfoA PackageInfo;
}
alias SecPkgContext_PackageInfoA* PSecPkgContext_PackageInfoA;
struct SecPkgContext_UserFlags {
uint UserFlags;
}
alias SecPkgContext_UserFlags* PSecPkgContext_UserFlags;
struct SecPkgContext_Flags {
uint Flags;
}
alias SecPkgContext_Flags* PSecPkgContext_Flags;
version(UNICODE){
alias SecPkgContext_PackageInfoW SecPkgContext_PackageInfo;
alias PSecPkgContext_PackageInfoW PSecPkgContext_PackageInfo;
}else{
alias SecPkgContext_PackageInfoA SecPkgContext_PackageInfo;
alias PSecPkgContext_PackageInfoA PSecPkgContext_PackageInfo;
}
struct SecPkgContext_NegotiationInfoA {
PSecPkgInfoA PackageInfo;
uint NegotiationState;
}
alias SecPkgContext_NegotiationInfoA* PSecPkgContext_NegotiationInfoA ;
struct SecPkgContext_NegotiationInfoW {
PSecPkgInfoW PackageInfo;
uint NegotiationState;
}
alias SecPkgContext_NegotiationInfoW* PSecPkgContext_NegotiationInfoW ;
version(UNICODE){
alias SecPkgContext_NegotiationInfoW SecPkgContext_NegotiationInfo;
alias PSecPkgContext_NegotiationInfoW PSecPkgContext_NegotiationInfo;
}else{
alias SecPkgContext_NegotiationInfoA SecPkgContext_NegotiationInfo;
alias PSecPkgContext_NegotiationInfoA PSecPkgContext_NegotiationInfo;
}
enum {
SECPKG_NEGOTIATION_COMPLETE = 0,
SECPKG_NEGOTIATION_OPTIMISTIC = 1,
SECPKG_NEGOTIATION_IN_PROGRESS = 2,
SECPKG_NEGOTIATION_DIRECT = 3,
SECPKG_NEGOTIATION_TRY_MULTICRED = 4,
}
struct SecPkgContext_NativeNamesW {
SEC_WCHAR* sClientName;
SEC_WCHAR* sServerName;
}
alias SecPkgContext_NativeNamesW* PSecPkgContext_NativeNamesW;
struct SecPkgContext_NativeNamesA {
SEC_CHAR* sClientName;
SEC_CHAR* sServerName;
}
alias SecPkgContext_NativeNamesA* PSecPkgContext_NativeNamesA;
version(UNICODE){
alias SecPkgContext_NativeNamesW SecPkgContext_NativeNames;
alias PSecPkgContext_NativeNamesW PSecPkgContext_NativeNames;
}else{
alias SecPkgContext_NativeNamesA SecPkgContext_NativeNames;
alias PSecPkgContext_NativeNamesA PSecPkgContext_NativeNames;
}
struct SecPkgContext_CredentialNameW {
uint CredentialType;
SEC_WCHAR* sCredentialName;
}
alias SecPkgContext_CredentialNameW* PSecPkgContext_CredentialNameW;
struct SecPkgContext_CredentialNameA {
uint CredentialType;
SEC_CHAR* sCredentialName;
}
alias SecPkgContext_CredentialNameA* PSecPkgContext_CredentialNameA;
version(UNICODE){
alias SecPkgContext_CredentialNameW SecPkgContext_CredentialName;
alias PSecPkgContext_CredentialNameW PSecPkgContext_CredentialName;
}else{
alias SecPkgContext_CredentialNameA SecPkgContext_CredentialName;
alias PSecPkgContext_CredentialNameA PSecPkgContext_CredentialName;
}
struct SecPkgContext_AccessToken {
void* AccessToken;
}
alias SecPkgContext_AccessToken* PSecPkgContext_AccessToken;
struct SecPkgContext_TargetInformation {
uint MarshalledTargetInfoLength;
ubyte* MarshalledTargetInfo;
}
alias SecPkgContext_TargetInformation* PSecPkgContext_TargetInformation;
struct SecPkgContext_AuthzID {
uint AuthzIDLength;
char* AuthzID;
}
alias SecPkgContext_AuthzID* PSecPkgContext_AuthzID;
struct SecPkgContext_Target {
uint TargetLength;
char* Target;
}
alias SecPkgContext_Target* PSecPkgContext_Target;
struct SecPkgContext_ClientSpecifiedTarget {
SEC_WCHAR* sTargetName;
}
alias SecPkgContext_ClientSpecifiedTarget* PSecPkgContext_ClientSpecifiedTarget;
struct SecPkgContext_Bindings {
uint BindingsLength;
SEC_CHANNEL_BINDINGS* Bindings;
}
alias SecPkgContext_Bindings* PSecPkgContext_Bindings;
alias void function(void* Arg,void* Principal, uint KeyVer, void** Key, SECURITY_STATUS* Status) SEC_GET_KEY_FN;
enum {
SECPKG_CONTEXT_EXPORT_RESET_NEW = 0x00000001,
SECPKG_CONTEXT_EXPORT_DELETE_OLD = 0x00000002,
SECPKG_CONTEXT_EXPORT_TO_KERNEL = 0x00000004,
}
export extern(Windows)export extern(Windows) SECURITY_STATUS AcquireCredentialsHandleW(LPWSTR pszPrincipal, LPWSTR pszPackage, uint fCredentialUse, void* pvLogonId, void* pAuthData, SEC_GET_KEY_FN pGetKeyFn, void* pvGetKeyArgument, PCredHandle phCredential, PTimeStamp ptsExpiry);
alias SECURITY_STATUS function(SEC_WCHAR*, SEC_WCHAR*, uint, void*, void*, SEC_GET_KEY_FN, void*, PCredHandle, PTimeStamp) ACQUIRE_CREDENTIALS_HANDLE_FN_W;
export extern(Windows) SECURITY_STATUS AcquireCredentialsHandleA(LPSTR pszPrincipal, LPSTR pszPackage, uint fCredentialUse, void* pvLogonId, void* pAuthData, SEC_GET_KEY_FN pGetKeyFn, void* pvGetKeyArgument, PCredHandle phCredential, PTimeStamp ptsExpiry);
alias SECURITY_STATUS function(SEC_CHAR*, SEC_CHAR*, uint, void*, void*, SEC_GET_KEY_FN, void*, PCredHandle, PTimeStamp) ACQUIRE_CREDENTIALS_HANDLE_FN_A;
version(UNICODE){
alias AcquireCredentialsHandleW AcquireCredentialsHandle;
alias ACQUIRE_CREDENTIALS_HANDLE_FN_W ACQUIRE_CREDENTIALS_HANDLE_FN;
}else{
alias AcquireCredentialsHandleA AcquireCredentialsHandle;
alias ACQUIRE_CREDENTIALS_HANDLE_FN_A ACQUIRE_CREDENTIALS_HANDLE_FN;
}
export extern(Windows)export extern(Windows) SECURITY_STATUS FreeCredentialsHandle(PCredHandle phCredential);
alias SECURITY_STATUS function(PCredHandle) FREE_CREDENTIALS_HANDLE_FN;
export extern(Windows)export extern(Windows) SECURITY_STATUS AddCredentialsW(PCredHandle hCredentials, LPWSTR pszPrincipal, LPWSTR pszPackage, uint fCredentialUse, void* pAuthData, SEC_GET_KEY_FN pGetKeyFn, void* pvGetKeyArgument, PTimeStamp ptsExpiry);
alias SECURITY_STATUS function(PCredHandle, SEC_WCHAR*, SEC_WCHAR*, uint, void*, SEC_GET_KEY_FN, void*, PTimeStamp) ADD_CREDENTIALS_FN_W;
export extern(Windows) SECURITY_STATUS AddCredentialsA(PCredHandle hCredentials, LPSTR pszPrincipal,LPSTR pszPackage, uint fCredentialUse, void* pAuthData, SEC_GET_KEY_FN pGetKeyFn, void* pvGetKeyArgument, PTimeStamp ptsExpiry);
alias SECURITY_STATUS function(PCredHandle, SEC_CHAR*, SEC_CHAR*, uint, void*, SEC_GET_KEY_FN, void*, PTimeStamp) ADD_CREDENTIALS_FN_A;
version(UNICODE){
alias AddCredentialsW AddCredentials;
alias ADD_CREDENTIALS_FN_W ADD_CREDENTIALS_FN;
}else{
alias AddCredentialsA AddCredentials;
alias ADD_CREDENTIALS_FN_A ADD_CREDENTIALS_FN;
}
export extern(Windows) SECURITY_STATUS ChangeAccountPasswordW(SEC_WCHAR* pszPackageName, SEC_WCHAR* pszDomainName, SEC_WCHAR* pszAccountName, SEC_WCHAR* pszOldPassword, SEC_WCHAR* pszNewPassword, BOOLEAN bImpersonating, uint dwReserved, PSecBufferDesc pOutput);
alias SECURITY_STATUS function(SEC_WCHAR*, SEC_WCHAR*, SEC_WCHAR*, SEC_WCHAR*, SEC_WCHAR*, BOOLEAN, uint, PSecBufferDesc) CHANGE_PASSWORD_FN_W;
export extern(Windows) SECURITY_STATUS ChangeAccountPasswordA(SEC_CHAR* pszPackageName, SEC_CHAR* pszDomainName, SEC_CHAR* pszAccountName, SEC_CHAR* pszOldPassword, SEC_CHAR* pszNewPassword, BOOLEAN bImpersonating, uint dwReserved, PSecBufferDesc pOutput);
alias SECURITY_STATUS function(SEC_CHAR*, SEC_CHAR*, SEC_CHAR*, SEC_CHAR*, SEC_CHAR*, BOOLEAN, uint, PSecBufferDesc) CHANGE_PASSWORD_FN_A;
version(UNICODE){
alias ChangeAccountPasswordW ChangeAccountPassword;
alias CHANGE_PASSWORD_FN_W CHANGE_PASSWORD_FN;
}else{
alias ChangeAccountPasswordA ChangeAccountPassword;
alias CHANGE_PASSWORD_FN_A CHANGE_PASSWORD_FN;
}
export extern(Windows)export extern(Windows) SECURITY_STATUS InitializeSecurityContextW(PCredHandle phCredential, PCtxtHandle phContext, SEC_WCHAR* pszTargetName, uint fContextReq, uint Reserved1, uint TargetDataRep, PSecBufferDesc pInput, uint Reserved2, PCtxtHandle phNewContext, PSecBufferDesc pOutput, uint* pfContextAttr, PTimeStamp ptsExpiry);
alias SECURITY_STATUS function(PCredHandle, PCtxtHandle, SEC_WCHAR*, uint, uint, uint, PSecBufferDesc, uint, PCtxtHandle, PSecBufferDesc, uint*, PTimeStamp) INITIALIZE_SECURITY_CONTEXT_FN_W;
export extern(Windows) SECURITY_STATUS InitializeSecurityContextA(PCredHandle phCredential, PCtxtHandle phContext, SEC_CHAR* pszTargetName, uint fContextReq, uint Reserved1, uint TargetDataRep, PSecBufferDesc pInput, uint Reserved2, PCtxtHandle phNewContext, PSecBufferDesc pOutput, uint* pfContextAttr, PTimeStamp ptsExpiry);
alias SECURITY_STATUS function(PCredHandle, PCtxtHandle, SEC_CHAR*, uint, uint, uint, PSecBufferDesc, uint, PCtxtHandle, PSecBufferDesc, uint*, PTimeStamp) INITIALIZE_SECURITY_CONTEXT_FN_A;
version(UNICODE){
alias InitializeSecurityContextW InitializeSecurityContext;
alias INITIALIZE_SECURITY_CONTEXT_FN_W INITIALIZE_SECURITY_CONTEXT_FN;
}else{
alias InitializeSecurityContextA InitializeSecurityContext;
alias INITIALIZE_SECURITY_CONTEXT_FN_A INITIALIZE_SECURITY_CONTEXT_FN;
}
export extern(Windows)export extern(Windows) SECURITY_STATUS AcceptSecurityContext(PCredHandle phCredential, PCtxtHandle phContext, PSecBufferDesc pInput, uint fContextReq, uint TargetDataRep, PCtxtHandle phNewContext, PSecBufferDesc pOutput, uint* pfContextAttr, PTimeStamp ptsExpiry);
alias SECURITY_STATUS function(PCredHandle, PCtxtHandle, PSecBufferDesc, uint, uint, PCtxtHandle, PSecBufferDesc, uint*, PTimeStamp) ACCEPT_SECURITY_CONTEXT_FN;
export extern(Windows) SECURITY_STATUS CompleteAuthToken(PCtxtHandle phContext, PSecBufferDesc pToken);
alias SECURITY_STATUS function(PCtxtHandle, PSecBufferDesc) COMPLETE_AUTH_TOKEN_FN;
export extern(Windows)export extern(Windows) SECURITY_STATUS ImpersonateSecurityContext(PCtxtHandle phContext);
alias SECURITY_STATUS function(PCtxtHandle) IMPERSONATE_SECURITY_CONTEXT_FN;
export extern(Windows)export extern(Windows) SECURITY_STATUS RevertSecurityContext(PCtxtHandle phContext);
alias SECURITY_STATUS function(PCtxtHandle) REVERT_SECURITY_CONTEXT_FN;
export extern(Windows)export extern(Windows) SECURITY_STATUS QuerySecurityContextToken(PCtxtHandle phContext, void** Token);
alias SECURITY_STATUS function(PCtxtHandle, void**) QUERY_SECURITY_CONTEXT_TOKEN_FN;
export extern(Windows)export extern(Windows) SECURITY_STATUS DeleteSecurityContext(PCtxtHandle phContext);
alias SECURITY_STATUS function(PCtxtHandle) DELETE_SECURITY_CONTEXT_FN;
export extern(Windows)export extern(Windows) SECURITY_STATUS ApplyControlToken(PCtxtHandle phContext, PSecBufferDesc pInput);
alias SECURITY_STATUS function(PCtxtHandle, PSecBufferDesc) APPLY_CONTROL_TOKEN_FN;
export extern(Windows)export extern(Windows) SECURITY_STATUS QueryContextAttributesW(PCtxtHandle phContext, uint ulAttribute, void* pBuffer);
alias SECURITY_STATUS function(PCtxtHandle, uint, void*) QUERY_CONTEXT_ATTRIBUTES_FN_W;
export extern(Windows) SECURITY_STATUS QueryContextAttributesA(PCtxtHandle phContext, uint ulAttribute, void* pBuffer);
alias SECURITY_STATUS function(PCtxtHandle, uint, void*) QUERY_CONTEXT_ATTRIBUTES_FN_A;
version(UNICODE){
alias QueryContextAttributesW QueryContextAttributes;
alias QUERY_CONTEXT_ATTRIBUTES_FN_W QUERY_CONTEXT_ATTRIBUTES_FN;
}else{
alias QueryContextAttributesA QueryContextAttributes;
alias QUERY_CONTEXT_ATTRIBUTES_FN_A QUERY_CONTEXT_ATTRIBUTES_FN;
}
export extern(Windows) SECURITY_STATUS SetContextAttributesW(PCtxtHandle phContext, uint ulAttribute, void* pBuffer, uint cbBuffer);
alias SECURITY_STATUS function(PCtxtHandle, uint, void*, uint) SET_CONTEXT_ATTRIBUTES_FN_W;
export extern(Windows) SECURITY_STATUS SetContextAttributesA(PCtxtHandle phContext, uint ulAttribute, void* pBuffer, uint cbBuffer);
alias SECURITY_STATUS function(PCtxtHandle, uint, void*, uint) SET_CONTEXT_ATTRIBUTES_FN_A;
version(UNICODE){
alias SetContextAttributesW SetContextAttributes;
alias SET_CONTEXT_ATTRIBUTES_FN_W SET_CONTEXT_ATTRIBUTES_FN;
}else{
alias SetContextAttributesA SetContextAttributes;
alias SET_CONTEXT_ATTRIBUTES_FN_A SET_CONTEXT_ATTRIBUTES_FN;
}
export extern(Windows)export extern(Windows) SECURITY_STATUS QueryCredentialsAttributesW(PCredHandle phCredential, uint ulAttribute, void* pBuffer);
alias SECURITY_STATUS function(PCredHandle, uint, void*) QUERY_CREDENTIALS_ATTRIBUTES_FN_W;
export extern(Windows) SECURITY_STATUS QueryCredentialsAttributesA(PCredHandle phCredential, uint ulAttribute, void* pBuffer);
alias SECURITY_STATUS function(PCredHandle, uint, void*) QUERY_CREDENTIALS_ATTRIBUTES_FN_A;
version(UNICODE){
alias QueryCredentialsAttributesW QueryCredentialsAttributes;
alias QUERY_CREDENTIALS_ATTRIBUTES_FN_W QUERY_CREDENTIALS_ATTRIBUTES_FN;
}else{
alias QueryCredentialsAttributesA QueryCredentialsAttributes;
alias QUERY_CREDENTIALS_ATTRIBUTES_FN_A QUERY_CREDENTIALS_ATTRIBUTES_FN;
}
static if(NTDDI_VERSION > NTDDI_WS03){
export extern(Windows)export extern(Windows) SECURITY_STATUS SetCredentialsAttributesW(PCredHandle phCredential, uint ulAttribute, void* pBuffer, uint cbBuffer);
//
alias SECURITY_STATUS function(PCredHandle, uint, void*, uint) SET_CREDENTIALS_ATTRIBUTES_FN_W;
export extern(Windows) SECURITY_STATUS SetCredentialsAttributesA(PCredHandle phCredential, uint ulAttribute, void* pBuffer, uint cbBuffer);
alias SECURITY_STATUS function(PCredHandle, uint, void*, uint) SET_CREDENTIALS_ATTRIBUTES_FN_A;
version(UNICODE){
alias SetCredentialsAttributesW SetCredentialsAttributes;
alias SET_CREDENTIALS_ATTRIBUTES_FN_W SET_CREDENTIALS_ATTRIBUTES_FN;
}else{
alias SetCredentialsAttributesA SetCredentialsAttributes;
alias SET_CREDENTIALS_ATTRIBUTES_FN_A SET_CREDENTIALS_ATTRIBUTES_FN;
}
export extern(Windows) SECURITY_STATUS FreeContextBuffer(PVOID pvContextBuffer);
alias SECURITY_STATUS function(PVOID) FREE_CONTEXT_BUFFER_FN;
export extern(Windows)export extern(Windows) SECURITY_STATUS MakeSignature(PCtxtHandle phContext, uint fQOP, PSecBufferDesc pMessage, uint MessageSeqNo);
alias SECURITY_STATUS function(PCtxtHandle, uint, PSecBufferDesc, uint) MAKE_SIGNATURE_FN;
export extern(Windows)export extern(Windows) SECURITY_STATUS VerifySignature(PCtxtHandle phContext, PSecBufferDesc pMessage, uint MessageSeqNo, uint* pfQOP);
alias SECURITY_STATUS function(PCtxtHandle, PSecBufferDesc, uint, uint*) VERIFY_SIGNATURE_FN;
enum {
SECQOP_WRAP_NO_ENCRYPT = 0x80000001,
SECQOP_WRAP_OOB_DATA = 0x40000000,
}
export extern(Windows) SECURITY_STATUS EncryptMessage(PCtxtHandle phContext, uint fQOP, PSecBufferDesc pMessage, uint MessageSeqNo);
alias SECURITY_STATUS function(PCtxtHandle, uint, PSecBufferDesc, uint) ENCRYPT_MESSAGE_FN;
export extern(Windows) SECURITY_STATUS DecryptMessage(PCtxtHandle phContext, PSecBufferDesc pMessage, uint MessageSeqNo, uint* pfQOP);
alias SECURITY_STATUS function(PCtxtHandle, PSecBufferDesc, uint, uint*) DECRYPT_MESSAGE_FN;
export extern(Windows)export extern(Windows) SECURITY_STATUS EnumerateSecurityPackagesW(uint* pcPackages, PSecPkgInfoW* ppPackageInfo);
alias SECURITY_STATUS function(uint*, PSecPkgInfoW*) ENUMERATE_SECURITY_PACKAGES_FN_W;
export extern(Windows) SECURITY_STATUS EnumerateSecurityPackagesA(uint* pcPackages, PSecPkgInfoA* ppPackageInfo);
alias SECURITY_STATUS function(uint*, PSecPkgInfoA*) ENUMERATE_SECURITY_PACKAGES_FN_A;
version(UNICODE){
alias EnumerateSecurityPackagesW EnumerateSecurityPackages;
alias ENUMERATE_SECURITY_PACKAGES_FN_W ENUMERATE_SECURITY_PACKAGES_FN;
}else{
alias EnumerateSecurityPackagesA EnumerateSecurityPackages;
alias ENUMERATE_SECURITY_PACKAGES_FN_A ENUMERATE_SECURITY_PACKAGES_FN;
}
export extern(Windows)export extern(Windows) SECURITY_STATUS QuerySecurityPackageInfoW(LPWSTR pszPackageName, PSecPkgInfoW* ppPackageInfo);
alias SECURITY_STATUS function(SEC_WCHAR*, PSecPkgInfoW*) QUERY_SECURITY_PACKAGE_INFO_FN_W;
export extern(Windows) SECURITY_STATUS QuerySecurityPackageInfoA(LPSTR pszPackageName, PSecPkgInfoA* ppPackageInfo);
alias SECURITY_STATUS function(SEC_CHAR*, PSecPkgInfoA*) QUERY_SECURITY_PACKAGE_INFO_FN_A;
version(UNICODE){
alias QuerySecurityPackageInfoW QuerySecurityPackageInfo;
alias QUERY_SECURITY_PACKAGE_INFO_FN_W QUERY_SECURITY_PACKAGE_INFO_FN;
}else{
alias QuerySecurityPackageInfoA QuerySecurityPackageInfo;
alias QUERY_SECURITY_PACKAGE_INFO_FN_A QUERY_SECURITY_PACKAGE_INFO_FN;
}
enum {
SecFull,
SecService,
SecTree,
SecDirectory,
SecObject
}
alias int SecDelegationType;
alias SecDelegationType* PSecDelegationType;
export extern(Windows) SECURITY_STATUS DelegateSecurityContext( PCtxtHandle phContext, LPSTR pszTarget, SecDelegationType DelegationType, PTimeStamp pExpiry, PSecBuffer pPackageParameters, PSecBufferDesc pOutput);
export extern(Windows)export extern(Windows) SECURITY_STATUS ExportSecurityContext(PCtxtHandle phContext, ULONG fFlags, PSecBuffer pPackedContext, void** pToken);
alias SECURITY_STATUS function(PCtxtHandle, ULONG, PSecBuffer, void**) EXPORT_SECURITY_CONTEXT_FN;
export extern(Windows)export extern(Windows) SECURITY_STATUS ImportSecurityContextW(LPWSTR pszPackage, PSecBuffer pPackedContext, void* Token, PCtxtHandle phContext);
alias SECURITY_STATUS function(SEC_WCHAR*, PSecBuffer, VOID*, PCtxtHandle) IMPORT_SECURITY_CONTEXT_FN_W;
export extern(Windows) SECURITY_STATUS ImportSecurityContextA(LPSTR pszPackage, PSecBuffer pPackedContext, VOID* Token, PCtxtHandle phContext);
alias SECURITY_STATUS function(SEC_CHAR*, PSecBuffer, void*, PCtxtHandle) IMPORT_SECURITY_CONTEXT_FN_A;
version(UNICODE){
alias ImportSecurityContextW ImportSecurityContext;
alias IMPORT_SECURITY_CONTEXT_FN_W IMPORT_SECURITY_CONTEXT_FN;
}else{
alias ImportSecurityContextA ImportSecurityContext;
alias IMPORT_SECURITY_CONTEXT_FN_A IMPORT_SECURITY_CONTEXT_FN;
}
version(none){ // ISSP_MODE == 0
export extern(Windows) NTSTATUS SecMakeSPN(PUNICODE_STRING ServiceClass, PUNICODE_STRING ServiceName, PUNICODE_STRING InstanceName, USHORT InstancePort, PUNICODE_STRING Referrer, PUNICODE_STRING Spn, PULONG Length, BOOLEAN Allocate);
export extern(Windows) NTSTATUS SecMakeSPNEx(PUNICODE_STRING ServiceClass, PUNICODE_STRING ServiceName, PUNICODE_STRING InstanceName, USHORT InstancePort, PUNICODE_STRING Referrer, PUNICODE_STRING TargetInfo, PUNICODE_STRING Spn, PULONG Length, BOOLEAN Allocate);
static if(OSVER(NTDDI_VERSION) > NTDDI_WS03){
export extern(Windows) NTSTATUS SecMakeSPNEx2(PUNICODE_STRING ServiceClass, PUNICODE_STRING ServiceName, PUNICODE_STRING InstanceName, USHORT InstancePort, PUNICODE_STRING Referrer, PUNICODE_STRING InTargetInfo, PUNICODE_STRING Spn, PULONG TotalSize, BOOLEAN Allocate, BOOLEAN IsTargetInfoMarshaled);
}
export extern(Windows) NTSTATUS SecLookupAccountSid(PSID Sid, PULONG NameSize, PUNICODE_STRING NameBuffer, PULONG DomainSize, PUNICODE_STRING DomainBuffer, PSID_NAME_USE NameUse);
export extern(Windows) NTSTATUS SecLookupAccountName(PUNICODE_STRING Name, PULONG SidSize, PSID Sid, PSID_NAME_USE NameUse, PULONG DomainSize, PUNICODE_STRING ReferencedDomain);
static if(OSVER(NTDDI_VERSION) > NTDDI_WINXP)
export extern(Windows) NTSTATUS SecLookupWellKnownSid(WELL_KNOWN_SID_TYPE SidType, PSID Sid, ULONG SidBufferSize, PULONG SidSize);
}
const char* SECURITY_ENTRYPOINT_ANSIW = "InitSecurityInterfaceW";
const char* SECURITY_ENTRYPOINT_ANSIA = "InitSecurityInterfaceA";
const wchar* SECURITY_ENTRYPOINTW = "InitSecurityInterfaceW";
const char* SECURITY_ENTRYPOINTA = "InitSecurityInterfaceA";
const char* SECURITY_ENTRYPOINT16 = "INITSECURITYINTERFACEA";
version(UNICODE){
alias SECURITY_ENTRYPOINTW SECURITY_ENTRYPOINT;
alias SECURITY_ENTRYPOINT_ANSIW SECURITY_ENTRYPOINT_ANSI;
}else{
alias SECURITY_ENTRYPOINTA SECURITY_ENTRYPOINT;
alias SECURITY_ENTRYPOINT_ANSIA SECURITY_ENTRYPOINT_ANSI;
}
struct SecurityFunctionTableW {
uint dwVersion;
ENUMERATE_SECURITY_PACKAGES_FN_W EnumerateSecurityPackagesW;
QUERY_CREDENTIALS_ATTRIBUTES_FN_W QueryCredentialsAttributesW;
ACQUIRE_CREDENTIALS_HANDLE_FN_W AcquireCredentialsHandleW;
FREE_CREDENTIALS_HANDLE_FN FreeCredentialsHandle;
void* Reserved2;
INITIALIZE_SECURITY_CONTEXT_FN_W InitializeSecurityContextW;
ACCEPT_SECURITY_CONTEXT_FN AcceptSecurityContext;
COMPLETE_AUTH_TOKEN_FN CompleteAuthToken;
DELETE_SECURITY_CONTEXT_FN DeleteSecurityContext;
APPLY_CONTROL_TOKEN_FN ApplyControlToken;
QUERY_CONTEXT_ATTRIBUTES_FN_W QueryContextAttributesW;
IMPERSONATE_SECURITY_CONTEXT_FN ImpersonateSecurityContext;
REVERT_SECURITY_CONTEXT_FN RevertSecurityContext;
MAKE_SIGNATURE_FN MakeSignature;
VERIFY_SIGNATURE_FN VerifySignature;
FREE_CONTEXT_BUFFER_FN FreeContextBuffer;
QUERY_SECURITY_PACKAGE_INFO_FN_W QuerySecurityPackageInfoW;
void* Reserved3;
void* Reserved4;
EXPORT_SECURITY_CONTEXT_FN ExportSecurityContext;
IMPORT_SECURITY_CONTEXT_FN_W ImportSecurityContextW;
ADD_CREDENTIALS_FN_W AddCredentialsW ;
void* Reserved8;
QUERY_SECURITY_CONTEXT_TOKEN_FN QuerySecurityContextToken;
ENCRYPT_MESSAGE_FN EncryptMessage;
DECRYPT_MESSAGE_FN DecryptMessage;
SET_CONTEXT_ATTRIBUTES_FN_W SetContextAttributesW;
//NTDDI_VERSION > NTDDI_WS03SP1
SET_CREDENTIALS_ATTRIBUTES_FN_W SetCredentialsAttributesW;
CHANGE_PASSWORD_FN_W ChangeAccountPasswordW;
}
alias SecurityFunctionTableW* PSecurityFunctionTableW;
struct SecurityFunctionTableA {
uint dwVersion;
ENUMERATE_SECURITY_PACKAGES_FN_A EnumerateSecurityPackagesA;
QUERY_CREDENTIALS_ATTRIBUTES_FN_A QueryCredentialsAttributesA;
ACQUIRE_CREDENTIALS_HANDLE_FN_A AcquireCredentialsHandleA;
FREE_CREDENTIALS_HANDLE_FN FreeCredentialHandle;
void* Reserved2;
INITIALIZE_SECURITY_CONTEXT_FN_A InitializeSecurityContextA;
ACCEPT_SECURITY_CONTEXT_FN AcceptSecurityContext;
COMPLETE_AUTH_TOKEN_FN CompleteAuthToken;
DELETE_SECURITY_CONTEXT_FN DeleteSecurityContext;
APPLY_CONTROL_TOKEN_FN ApplyControlToken;
QUERY_CONTEXT_ATTRIBUTES_FN_A QueryContextAttributesA;
IMPERSONATE_SECURITY_CONTEXT_FN ImpersonateSecurityContext;
REVERT_SECURITY_CONTEXT_FN RevertSecurityContext;
MAKE_SIGNATURE_FN MakeSignature;
VERIFY_SIGNATURE_FN VerifySignature;
FREE_CONTEXT_BUFFER_FN FreeContextBuffer;
QUERY_SECURITY_PACKAGE_INFO_FN_A QuerySecurityPackageInfoA;
void* Reserved3;
void* Reserved4;
EXPORT_SECURITY_CONTEXT_FN ExportSecurityContext;
IMPORT_SECURITY_CONTEXT_FN_A ImportSecurityContextA;
ADD_CREDENTIALS_FN_A AddCredentialsA ;
void* Reserved8;
QUERY_SECURITY_CONTEXT_TOKEN_FN QuerySecurityContextToken;
ENCRYPT_MESSAGE_FN EncryptMessage;
DECRYPT_MESSAGE_FN DecryptMessage;
SET_CONTEXT_ATTRIBUTES_FN_A SetContextAttributesA;
SET_CREDENTIALS_ATTRIBUTES_FN_A SetCredentialsAttributesA;
CHANGE_PASSWORD_FN_A ChangeAccountPasswordA;
}
alias SecurityFunctionTableA* PSecurityFunctionTableA;
version(UNICODE){
alias SecurityFunctionTableW SecurityFunctionTable;
alias PSecurityFunctionTableW PSecurityFunctionTable;
}else{
alias SecurityFunctionTableA SecurityFunctionTable;
alias PSecurityFunctionTableA PSecurityFunctionTable;
}
enum {
SECURITY_SUPPORT_PROVIDER_INTERFACE_VERSION = 1,
SECURITY_SUPPORT_PROVIDER_INTERFACE_VERSION_2 = 2,
SECURITY_SUPPORT_PROVIDER_INTERFACE_VERSION_3 = 3,
SECURITY_SUPPORT_PROVIDER_INTERFACE_VERSION_4 = 4,
}
export extern(Windows) PSecurityFunctionTableA InitSecurityInterfaceA();
alias PSecurityFunctionTableA function() INIT_SECURITY_INTERFACE_A;
export extern(Windows) PSecurityFunctionTableW InitSecurityInterfaceW();
alias PSecurityFunctionTableW function() INIT_SECURITY_INTERFACE_W;
version(UNICODE){
alias InitSecurityInterfaceW InitSecurityInterface;
alias INIT_SECURITY_INTERFACE_W INIT_SECURITY_INTERFACE;
}else{
alias InitSecurityInterfaceA InitSecurityInterface;
alias INIT_SECURITY_INTERFACE_A INIT_SECURITY_INTERFACE;
}
export extern(Windows) SECURITY_STATUS SaslEnumerateProfilesA(LPSTR* ProfileList, ULONG* ProfileCount);
export extern(Windows) SECURITY_STATUS SaslEnumerateProfilesW(LPWSTR* ProfileList, ULONG* ProfileCount);
version(UNICODE)
alias SaslEnumerateProfilesW SaslEnumerateProfiles;
else
alias SaslEnumerateProfilesA SaslEnumerateProfiles;
export extern(Windows) SECURITY_STATUS SaslGetProfilePackageA(LPSTR ProfileName, PSecPkgInfoA* PackageInfo);
export extern(Windows) SECURITY_STATUS SaslGetProfilePackageW(LPWSTR ProfileName, PSecPkgInfoW* PackageInfo);
version(UNICODE)
alias SaslGetProfilePackageW SaslGetProfilePackage;
else
alias SaslGetProfilePackageA SaslGetProfilePackage;
export extern(Windows) SECURITY_STATUS SaslIdentifyPackageA(PSecBufferDesc pInput, PSecPkgInfoA* PackageInfo);
export extern(Windows) SECURITY_STATUS SaslIdentifyPackageW(PSecBufferDesc pInput, PSecPkgInfoW* PackageInfo);
version(UNICODE)
alias SaslIdentifyPackageW SaslIdentifyPackage;
else
alias SaslIdentifyPackageA SaslIdentifyPackage;
export extern(Windows) SECURITY_STATUS SaslInitializeSecurityContextW(PCredHandle phCredential, PCtxtHandle phContext, LPWSTR pszTargetName, uint fContextReq, uint Reserved1, uint TargetDataRep, PSecBufferDesc pInput, uint Reserved2, PCtxtHandle phNewContext, PSecBufferDesc pOutput, uint* pfContextAttr, PTimeStamp ptsExpiry);
export extern(Windows) SECURITY_STATUS SaslInitializeSecurityContextA(PCredHandle phCredential, PCtxtHandle phContext, LPSTR pszTargetName, uint fContextReq, uint Reserved1, uint TargetDataRep, PSecBufferDesc pInput, uint Reserved2, PCtxtHandle phNewContext, PSecBufferDesc pOutput, uint* pfContextAttr, PTimeStamp ptsExpiry);
version(UNICODE)
alias SaslInitializeSecurityContextW SaslInitializeSecurityContext;
else
alias SaslInitializeSecurityContextA SaslInitializeSecurityContext;
export extern(Windows) SECURITY_STATUS SaslAcceptSecurityContext(PCredHandle phCredential, PCtxtHandle phContext, PSecBufferDesc pInput, uint fContextReq, uint TargetDataRep, PCtxtHandle phNewContext, PSecBufferDesc pOutput, uint* pfContextAttr, PTimeStamp ptsExpiry);
enum {
SASL_OPTION_SEND_SIZE = 1,
SASL_OPTION_RECV_SIZE = 2,
SASL_OPTION_AUTHZ_STRING = 3,
SASL_OPTION_AUTHZ_PROCESSING = 4,
}
enum {
Sasl_AuthZIDForbidden,
Sasl_AuthZIDProcessed
}
alias int SASL_AUTHZID_STATE ;
export extern(Windows) SECURITY_STATUS SaslSetContextOption(PCtxtHandle ContextHandle, ULONG Option, PVOID Value, ULONG Size);
export extern(Windows) SECURITY_STATUS SaslGetContextOption(PCtxtHandle ContextHandle, ULONG Option, PVOID Value, ULONG Size, PULONG Needed);
enum SEC_WINNT_AUTH_IDENTITY_VERSION_2 = 0x201;
struct SEC_WINNT_AUTH_IDENTITY_EX2 {
uint Version;
ushort cbHeaderLength;
uint cbStructureLength;
uint UserOffset;
ushort UserLength;
uint DomainOffset;
ushort DomainLength;
uint PackedCredentialsOffset;
ushort PackedCredentialsLength;
uint Flags;
uint PackageListOffset;
ushort PackageListLength;
}
alias SEC_WINNT_AUTH_IDENTITY_EX2* PSEC_WINNT_AUTH_IDENTITY_EX2;
enum {
SEC_WINNT_AUTH_IDENTITY_ANSI = 0x1,
SEC_WINNT_AUTH_IDENTITY_UNICODE = 0x2,
}
struct SEC_WINNT_AUTH_IDENTITY_W {
ushort* User;
uint UserLength;
ushort* Domain;
uint DomainLength;
ushort* Password;
uint PasswordLength;
uint Flags;
}
alias SEC_WINNT_AUTH_IDENTITY_W* PSEC_WINNT_AUTH_IDENTITY_W;
struct SEC_WINNT_AUTH_IDENTITY_A {
ubyte* User;
uint UserLength;
ubyte* Domain;
uint DomainLength;
ubyte* Password;
uint PasswordLength;
uint Flags;
}
alias SEC_WINNT_AUTH_IDENTITY_A* PSEC_WINNT_AUTH_IDENTITY_A;
version(UNICODE)
alias SEC_WINNT_AUTH_IDENTITY_W SEC_WINNT_AUTH_IDENTITY;
alias PSEC_WINNT_AUTH_IDENTITY_W PSEC_WINNT_AUTH_IDENTITY;
}else{
alias SEC_WINNT_AUTH_IDENTITY_A SEC_WINNT_AUTH_IDENTITY;
alias PSEC_WINNT_AUTH_IDENTITY_A PSEC_WINNT_AUTH_IDENTITY;
}
enum SEC_WINNT_AUTH_IDENTITY_VERSION = 0x200;
struct SEC_WINNT_AUTH_IDENTITY_EXW {
uint Version;
uint Length;
ushort* User;
uint UserLength;
ushort*Domain;
uint DomainLength;
ushort* Password;
uint PasswordLength;
uint Flags;
ushort* PackageList;
uint PackageListLength;
}
alias SEC_WINNT_AUTH_IDENTITY_EXW* PSEC_WINNT_AUTH_IDENTITY_EXW;
struct SEC_WINNT_AUTH_IDENTITY_EXA {
uint Version;
uint Length;
ubyte* User;
uint UserLength;
ubyte* Domain;
uint DomainLength;
ubyte* Password;
uint PasswordLength;
uint Flags;
ubyte* PackageList;
uint PackageListLength;
}
alias SEC_WINNT_AUTH_IDENTITY_EXA* PSEC_WINNT_AUTH_IDENTITY_EXA;
version(UNICODE){
alias SEC_WINNT_AUTH_IDENTITY_EXW SEC_WINNT_AUTH_IDENTITY_EX;
alias PSEC_WINNT_AUTH_IDENTITY_EXW PSEC_WINNT_AUTH_IDENTITY_EX;
}else{
alias SEC_WINNT_AUTH_IDENTITY_EXA SEC_WINNT_AUTH_IDENTITY_EX;
}
union SEC_WINNT_AUTH_IDENTITY_INFO {
SEC_WINNT_AUTH_IDENTITY_EXW AuthIdExw;
SEC_WINNT_AUTH_IDENTITY_EXA AuthIdExa;
SEC_WINNT_AUTH_IDENTITY_A AuthId_a;
SEC_WINNT_AUTH_IDENTITY_W AuthId_w;
SEC_WINNT_AUTH_IDENTITY_EX2 AuthIdEx2;
}
alias SEC_WINNT_AUTH_IDENTITY_INFO* PSEC_WINNT_AUTH_IDENTITY_INFO;
enum {
SEC_WINNT_AUTH_IDENTITY_FLAGS_PROCESS_ENCRYPTED = 0x10,
SEC_WINNT_AUTH_IDENTITY_FLAGS_SYSTEM_PROTECTED = 0x20,
SEC_WINNT_AUTH_IDENTITY_FLAGS_RESERVED = 0x10000,
SEC_WINNT_AUTH_IDENTITY_FLAGS_NULL_USER = 0x20000,
SEC_WINNT_AUTH_IDENTITY_FLAGS_NULL_DOMAIN = 0x40000,
SEC_WINNT_AUTH_IDENTITY_FLAGS_SSPIPFC_USE_MASK = 0xFF000000,
SEC_WINNT_AUTH_IDENTITY_FLAGS_SSPIPFC_SAVE_CRED_BY_CALLER = 0x80000000,
SEC_WINNT_AUTH_IDENTITY_FLAGS_SSPIPFC_SAVE_CRED_CHECKED = 0x40000000,
SEC_WINNT_AUTH_IDENTITY_FLAGS_VALID_SSPIPFC_FLAGS = SEC_WINNT_AUTH_IDENTITY_FLAGS_SSPIPFC_SAVE_CRED_BY_CALLER | SEC_WINNT_AUTH_IDENTITY_FLAGS_SSPIPFC_SAVE_CRED_CHECKED,
}
alias PSEC_WINNT_AUTH_IDENTITY_INFO PSEC_WINNT_AUTH_IDENTITY_OPAQUE;
enum {
SSPIPFC_SAVE_CRED_BY_CALLER = 0x00000001,
SSPIPFC_VALID_FLAGS = SSPIPFC_SAVE_CRED_BY_CALLER,
}
uint SspiPromptForCredentialsW(PCWSTR pszTargetName, PCREDUI_INFOW pUiInfo, uint dwAuthError, PCWSTR pszPackage, PSEC_WINNT_AUTH_IDENTITY_OPAQUE pInputAuthIdentity, PSEC_WINNT_AUTH_IDENTITY_OPAQUE* ppAuthIdentity, int* pfSave, uint dwFlags);
uint SspiPromptForCredentialsA(PCSTR pszTargetName, PCREDUI_INFOA pUiInfo, uint dwAuthError, PCSTR pszPackage, PSEC_WINNT_AUTH_IDENTITY_OPAQUE pInputAuthIdentity, PSEC_WINNT_AUTH_IDENTITY_OPAQUE* ppAuthIdentity, int* pfSave, uint dwFlags);
version(UNICODE)
alias SspiPromptForCredentialsW SspiPromptForCredentials;
else
alias SspiPromptForCredentialsA SspiPromptForCredentials;
struct SEC_WINNT_AUTH_BYTE_VECTOR {
uint ByteArrayOffset;
ushort ByteArrayLength;
}
alias SEC_WINNT_AUTH_BYTE_VECTOR* PSEC_WINNT_AUTH_BYTE_VECTOR;
struct SEC_WINNT_AUTH_DATA {
GUID CredType;
SEC_WINNT_AUTH_BYTE_VECTOR CredData;
}
alias SEC_WINNT_AUTH_DATA* PSEC_WINNT_AUTH_DATA;
struct SEC_WINNT_AUTH_PACKED_CREDENTIALS {
ushort cbHeaderLength;
ushort cbStructureLength;
SEC_WINNT_AUTH_DATA AuthData;
}
alias SEC_WINNT_AUTH_PACKED_CREDENTIALS* PSEC_WINNT_AUTH_PACKED_CREDENTIALS;
static const GUID SEC_WINNT_AUTH_DATA_TYPE_PASSWORD =
{0x28bfc32f, 0x10f6, 0x4738, [0x98, 0xd1, 0x1a, 0xc0, 0x61, 0xdf, 0x71, 0x6a]};
static const GUID SEC_WINNT_AUTH_DATA_TYPE_CERT =
{0x235f69ad, 0x73fb, 0x4dbc, [0x82, 0x3, 0x6, 0x29, 0xe7, 0x39, 0x33, 0x9b]};
struct SEC_WINNT_AUTH_DATA_PASSWORD {
SEC_WINNT_AUTH_BYTE_VECTOR UnicodePassword;
}
alias SEC_WINNT_AUTH_DATA_PASSWORD PSEC_WINNT_AUTH_DATA_PASSWORD;
static const GUID SEC_WINNT_AUTH_DATA_TYPE_CSP_DATA =
{0x68fd9879, 0x79c, 0x4dfe, [0x82, 0x81, 0x57, 0x8a, 0xad, 0xc1, 0xc1, 0x0]};
struct SEC_WINNT_AUTH_CERTIFICATE_DATA {
ushort cbHeaderLength;
ushort cbStructureLength;
SEC_WINNT_AUTH_BYTE_VECTOR Certificate;
}
alias SEC_WINNT_AUTH_CERTIFICATE_DATA* PSEC_WINNT_AUTH_CERTIFICATE_DATA;
struct SEC_WINNT_CREDUI_CONTEXT_VECTOR {
ULONG CredUIContextArrayOffset;
USHORT CredUIContextCount;
}
alias SEC_WINNT_CREDUI_CONTEXT_VECTOR* PSEC_WINNT_CREDUI_CONTEXT_VECTOR;
struct SEC_WINNT_AUTH_SHORT_VECTOR {
ULONG ShortArrayOffset;
USHORT ShortArrayCount;
}
alias SEC_WINNT_AUTH_SHORT_VECTOR* PSEC_WINNT_AUTH_SHORT_VECTOR;
export extern(Windows) SECURITY_STATUS SspiGetCredUIContext(HANDLE ContextHandle, GUID* CredType, LUID* LogonId, PSEC_WINNT_CREDUI_CONTEXT_VECTOR* CredUIContexts, HANDLE* TokenHandle);
export extern(Windows) SECURITY_STATUS SspiUpdateCredentials(HANDLE ContextHandle, GUID* CredType, ULONG FlatCredUIContextLength, PUCHAR FlatCredUIContext);
struct CREDUIWIN_MARSHALED_CONTEXT {
GUID StructureType;
USHORT cbHeaderLength;
LUID LogonId;
GUID MarshaledDataType;
ULONG MarshaledDataOffset;
USHORT MarshaledDataLength;
}
alias CREDUIWIN_MARSHALED_CONTEXT* PCREDUIWIN_MARSHALED_CONTEXT;
struct SEC_WINNT_CREDUI_CONTEXT {
USHORT cbHeaderLength;
HANDLE CredUIContextHandle;
PCREDUI_INFOW UIInfo;
ULONG dwAuthError;
PSEC_WINNT_AUTH_IDENTITY_OPAQUE pInputAuthIdentity;
PUNICODE_STRING TargetName;
}
alias SEC_WINNT_CREDUI_CONTEXT* PSEC_WINNT_CREDUI_CONTEXT;
static const GUID CREDUIWIN_STRUCTURE_TYPE_SSPIPFC =
{0x3c3e93d9, 0xd96b, 0x49b5, [0x94, 0xa7, 0x45, 0x85, 0x92, 0x8, 0x83, 0x37]};
const GUID SSPIPFC_STRUCTURE_TYPE_CREDUI_CONTEXT =
{0xc2fffe6f, 0x503d, 0x4c3d, [0xa9, 0x5e, 0xbc, 0xe8, 0x21, 0x21, 0x3d, 0x44]};
struct SEC_WINNT_AUTH_PACKED_CREDENTIALS_EX {
ushort cbHeaderLength;
uint Flags;
SEC_WINNT_AUTH_BYTE_VECTOR PackedCredentials;
SEC_WINNT_AUTH_SHORT_VECTOR PackageList;
}
alias SEC_WINNT_AUTH_PACKED_CREDENTIALS_EX* PSEC_WINNT_AUTH_PACKED_CREDENTIALS_EX;
export extern(Windows) SECURITY_STATUS SspiUnmarshalCredUIContext(PUCHAR MarshaledCredUIContext, ULONG MarshaledCredUIContextLength, PSEC_WINNT_CREDUI_CONTEXT* CredUIContext);
export extern(Windows) SECURITY_STATUS SspiPrepareForCredRead(PSEC_WINNT_AUTH_IDENTITY_OPAQUE AuthIdentity, PCWSTR pszTargetName, PULONG pCredmanCredentialType, PCWSTR* ppszCredmanTargetName);
export extern(Windows) SECURITY_STATUS SspiPrepareForCredWrite(PSEC_WINNT_AUTH_IDENTITY_OPAQUE AuthIdentity, PCWSTR pszTargetName, PULONG pCredmanCredentialType, PCWSTR* ppszCredmanTargetName, PCWSTR* ppszCredmanUserName, PUCHAR* ppCredentialBlob, PULONG pCredentialBlobSize);
export extern(Windows) SECURITY_STATUS SspiEncryptAuthIdentity(PSEC_WINNT_AUTH_IDENTITY_OPAQUE AuthData);
export extern(Windows) SECURITY_STATUS SspiDecryptAuthIdentity(PSEC_WINNT_AUTH_IDENTITY_OPAQUE EncryptedAuthData);
export extern(Windows) BOOLEAN SspiIsAuthIdentityEncrypted(PSEC_WINNT_AUTH_IDENTITY_OPAQUE EncryptedAuthData);
static if(NTDDI_VERSION >= NTDDI_WIN7){
export extern(Windows) SECURITY_STATUS SspiEncodeAuthIdentityAsStrings(PSEC_WINNT_AUTH_IDENTITY_OPAQUE pAuthIdentity, PCWSTR* ppszUserName, PCWSTR* ppszDomainName, PCWSTR* ppszPackedCredentialsString);
export extern(Windows) SECURITY_STATUS SspiValidateAuthIdentity(PSEC_WINNT_AUTH_IDENTITY_OPAQUE AuthData);
export extern(Windows) SECURITY_STATUS SspiCopyAuthIdentity(PSEC_WINNT_AUTH_IDENTITY_OPAQUE AuthData, PSEC_WINNT_AUTH_IDENTITY_OPAQUE* AuthDataCopy);
export extern(Windows) VOID SspiFreeAuthIdentity(PSEC_WINNT_AUTH_IDENTITY_OPAQUE AuthData);
export extern(Windows) VOID SspiZeroAuthIdentity(PSEC_WINNT_AUTH_IDENTITY_OPAQUE AuthData);
export extern(Windows) VOID SspiLocalFree(PVOID DataBuffer);
export extern(Windows) SECURITY_STATUS SspiEncodeStringsAsAuthIdentity(PCWSTR pszUserName, PCWSTR pszDomainName, PCWSTR pszPackedCredentialsString, PSEC_WINNT_AUTH_IDENTITY_OPAQUE* ppAuthIdentity);
export extern(Windows) SECURITY_STATUS SspiCompareAuthIdentities(PSEC_WINNT_AUTH_IDENTITY_OPAQUE AuthIdentity1, PSEC_WINNT_AUTH_IDENTITY_OPAQUE AuthIdentity2, PBOOLEAN SameSuppliedUser, PBOOLEAN SameSuppliedIdentity);
export extern(Windows) SECURITY_STATUS SspiMarshalAuthIdentity(PSEC_WINNT_AUTH_IDENTITY_OPAQUE AuthIdentity, uint* AuthIdentityLength, char** AuthIdentityByteArray);
export extern(Windows) SECURITY_STATUS SspiUnmarshalAuthIdentity(uint AuthIdentityLength, char* AuthIdentityByteArray, PSEC_WINNT_AUTH_IDENTITY_OPAQUE* ppAuthIdentity);
export extern(Windows) BOOLEAN SspiIsPromptingNeeded(uint ErrorOrNtStatus);
export extern(Windows) SECURITY_STATUS SspiGetTargetHostName(PCWSTR pszTargetName, PWSTR* pszHostName);
export extern(Windows) SECURITY_STATUS SspiExcludePackage(PSEC_WINNT_AUTH_IDENTITY_OPAQUE AuthIdentity, PCWSTR pszPackageName, PSEC_WINNT_AUTH_IDENTITY_OPAQUE* ppNewAuthIdentity);
}
//(NTDDI_VERSION >= NTDDI_WIN7)
enum {
SEC_WINNT_AUTH_IDENTITY_MARSHALLED = 0x4,
SEC_WINNT_AUTH_IDENTITY_ONLY = 0x8,
}
struct SECURITY_PACKAGE_OPTIONS {
uint Size;
uint Type;
uint Flags;
uint SignatureSize;
void* Signature;
}
alias SECURITY_PACKAGE_OPTIONS* PSECURITY_PACKAGE_OPTIONS;
enum {
SECPKG_OPTIONS_TYPE_UNKNOWN = 0,
SECPKG_OPTIONS_TYPE_LSA = 1,
SECPKG_OPTIONS_TYPE_SSPI = 2,
}
enum SECPKG_OPTIONS_PERMANENT = 0x00000001;
export extern(Windows) SECURITY_STATUS AddSecurityPackageA(LPSTR pszPackageName, PSECURITY_PACKAGE_OPTIONS pOptions);
export extern(Windows) SECURITY_STATUS AddSecurityPackageW(LPWSTR pszPackageName, PSECURITY_PACKAGE_OPTIONS pOptions);
version(UNICODE)
alias AddSecurityPackageW AddSecurityPackage;
else
alias AddSecurityPackageA AddSecurityPackage;
export extern(Windows) SECURITY_STATUS DeleteSecurityPackageA(LPSTR pszPackageName);
export extern(Windows) SECURITY_STATUS DeleteSecurityPackageW(LPWSTR pszPackageName);
version(UNICODE)
alias DeleteSecurityPackageW DeleteSecurityPackage;
else
alias DeleteSecurityPackageA DeleteSecurityPackage;
}// extern(C)
| D |
a person who expects the worst
| D |
module app;
import vibe.core.core;
import vibe.core.log;
import vibe.core.stream;
import vibe.stream.operations;
import vibe.stream.wrapper;
import vibe.stream.tls;
import vibe.stream.taskpipe;
import std.encoding : sanitize;
TLSContext createContext(TLSContextKind kind, string cert, string key, string trust, TLSPeerValidationMode mode)
{
auto ctx = createTLSContext(kind);
ctx.peerValidationMode = mode;
if (cert.length) ctx.useCertificateChainFile(cert);
if (key.length) ctx.usePrivateKeyFile(key);
if (trust.length) ctx.useTrustedCertificateFile(trust);
return ctx;
}
void createPipePair(out Stream a, out Stream b)
{
auto p1 = new TaskPipe;
auto p2 = new TaskPipe;
a = createProxyStream(p1, p2);
b = createProxyStream(p2, p1);
}
enum Expected {
success,
fail,
dontCare
}
void testConn(
Expected cli_expect, string cli_cert, string cli_key, string cli_trust, string cli_peer, TLSPeerValidationMode cli_mode,
Expected srv_expect, string srv_cert, string srv_key, string srv_trust, string srv_peer, TLSPeerValidationMode srv_mode)
{
Stream ctunnel, stunnel;
logInfo("Test client %s (%s, %s, %s, %s), server %s (%s, %s, %s, %s)",
cli_expect, cli_cert, cli_key, cli_trust, cli_peer,
srv_expect, srv_cert, srv_key, srv_trust, srv_peer);
createPipePair(ctunnel, stunnel);
auto t1 = runTask({
try {
auto sctx = createContext(TLSContextKind.server, srv_cert, srv_key, srv_trust, srv_mode);
TLSStream sconn;
try {
sconn = createTLSStream(stunnel, sctx, TLSStreamState.accepting, srv_peer);
logDiagnostic("Successfully initiated server tunnel.");
assert(srv_expect != Expected.fail, "Server expected to fail TLS connection.");
} catch (Exception e) {
if (srv_expect == Expected.dontCare) logDiagnostic("Server tunnel failed (dont-care): %s", e.msg);
else if (srv_expect == Expected.fail) logDiagnostic("Server tunnel failed as expected: %s", e.msg);
else {
logError("Server tunnel failed: %s", e.toString().sanitize);
assert(false, "Server not expected to fail TLS connection.");
}
return;
}
if (cli_expect == Expected.fail) return;
assert(sconn.readLine() == "foo");
sconn.write("bar\r\n");
sconn.finalize();
} catch (Exception e) assert(false, e.msg);
});
auto t2 = runTask({
try {
auto cctx = createContext(TLSContextKind.client, cli_cert, cli_key, cli_trust, cli_mode);
TLSStream cconn;
try {
cconn = createTLSStream(ctunnel, cctx, TLSStreamState.connecting, cli_peer);
logDiagnostic("Successfully initiated client tunnel.");
assert(cli_expect != Expected.fail, "Client expected to fail TLS connection.");
} catch (Exception e) {
if (cli_expect == Expected.dontCare) logDiagnostic("Client tunnel failed (dont-care): %s", e.msg);
else if (cli_expect == Expected.fail) logDiagnostic("Client tunnel failed as expected: %s", e.msg);
else {
logError("Client tunnel failed: %s", e.toString().sanitize);
assert(false, "Client not expected to fail TLS connection.");
}
return;
}
if (srv_expect == Expected.fail) return;
cconn.write("foo\r\n");
assert(cconn.readLine() == "bar");
cconn.finalize();
} catch (Exception e) assert(false, e.msg);
});
t1.join();
t2.join();
}
void testValidation()
{
//
// Server certificates
//
// fail for untrusted server cert
testConn(
Expected.fail, null, null, null, "localhost", TLSPeerValidationMode.trustedCert,
Expected.fail, "server.crt", "server.key", null, null, TLSPeerValidationMode.none
);
// succeed for untrusted server cert with disabled validation
testConn(
Expected.success, null, null, null, null, TLSPeerValidationMode.none,
Expected.success, "server.crt", "server.key", null, null, TLSPeerValidationMode.none
);
// succeed for untrusted server cert if ignored
testConn(
Expected.success, null, null, null, "localhost", TLSPeerValidationMode.requireCert|TLSPeerValidationMode.checkPeer,
Expected.success, "server.crt", "server.key", null, null, TLSPeerValidationMode.none
);
// fail for trusted server cert with no/wrong host name
testConn(
Expected.fail, null, null, "ca.crt", "wronghost", TLSPeerValidationMode.trustedCert,
Expected.success, "server.crt", "server.key", null, null, TLSPeerValidationMode.none
);
// succeed for trusted server cert with no/wrong host name if ignored
testConn(
Expected.success, null, null, "ca.crt", "wronghost", TLSPeerValidationMode.trustedCert & ~TLSPeerValidationMode.checkPeer,
Expected.success, "server.crt", "server.key", null, null, TLSPeerValidationMode.none
);
// succeed for trusted server cert
testConn(
Expected.success, null, null, "ca.crt", "localhost", TLSPeerValidationMode.trustedCert,
Expected.success, "server.crt", "server.key", null, null, TLSPeerValidationMode.none
);
// succeed with no certificates
/*testConn(
false, null, null, null, null,
false, null, null, null, null
);*/
//
// Client certificates
//
// fail for untrusted server cert
testConn(
Expected.dontCare, "client.crt", "client.key", null, null, TLSPeerValidationMode.none,
Expected.fail, "server.crt", "server.key", null, null, TLSPeerValidationMode.trustedCert
);
// succeed for untrusted server cert with disabled validation
testConn(
Expected.success, "client.crt", "client.key", null, null, TLSPeerValidationMode.none,
Expected.success, "server.crt", "server.key", null, null, TLSPeerValidationMode.none
);
// succeed for untrusted server cert if ignored
testConn(
Expected.success, "client.crt", "client.key", null, null, TLSPeerValidationMode.none,
Expected.success, "server.crt", "server.key", null, null, TLSPeerValidationMode.requireCert
);
// succeed for trusted server cert
testConn(
Expected.success, "client.crt", "client.key", null, null, TLSPeerValidationMode.none,
Expected.success, "server.crt", "server.key", "ca.crt", null, TLSPeerValidationMode.trustedCert & ~TLSPeerValidationMode.checkPeer
);
}
void testConn(TLSVersion cli_version, TLSVersion srv_version, bool expect_success)
{
Stream ctunnel, stunnel;
logInfo("Test for %s client %s, server %s", expect_success ? "success" : "failure",
cli_version, srv_version);
createPipePair(ctunnel, stunnel);
auto t1 = runTask({
try {
TLSContext sctx;
try sctx = createTLSContext(TLSContextKind.server, srv_version);
catch (Exception e) {
assert(!expect_success, "Failed to create TLS context: " ~ e.msg);
ctunnel.finalize();
stunnel.finalize();
return;
}
sctx.useCertificateChainFile("server.crt");
sctx.usePrivateKeyFile("server.key");
sctx.peerValidationMode = TLSPeerValidationMode.none;
TLSStream sconn;
try {
sconn = createTLSStream(stunnel, sctx, TLSStreamState.accepting, null);
logDiagnostic("Successfully initiated server tunnel.");
assert(expect_success, "Server expected to fail TLS connection.");
} catch (Exception e) {
if (expect_success) {
logError("Server tunnel failed: %s", e.toString().sanitize);
assert(false, "Server not expected to fail TLS connection.");
}
logDiagnostic("Server tunnel failed as expected: %s", e.msg);
return;
}
if (!expect_success) return;
assert(sconn.readLine() == "foo");
sconn.write("bar\r\n");
sconn.finalize();
} catch (Exception e) assert(false, e.msg);
});
auto t2 = runTask({
try {
TLSContext cctx;
try cctx = createTLSContext(TLSContextKind.client, cli_version);
catch (Exception e) {
assert(!expect_success, "Failed to create TLS context: " ~ e.msg);
ctunnel.finalize();
stunnel.finalize();
return;
}
cctx.peerValidationMode = TLSPeerValidationMode.none;
TLSStream cconn;
try {
cconn = createTLSStream(ctunnel, cctx, TLSStreamState.connecting, null);
logDiagnostic("Successfully initiated client tunnel.");
assert(expect_success, "Client expected to fail TLS connection.");
} catch (Exception e) {
if (expect_success) {
logError("Client tunnel failed: %s", e.toString().sanitize);
assert(false, "Client not expected to fail TLS connection.");
}
logDiagnostic("Client tunnel failed as expected: %s", e.msg);
ctunnel.finalize();
stunnel.finalize();
return;
}
if (!expect_success) return;
cconn.write("foo\r\n");
assert(cconn.readLine() == "bar");
cconn.finalize();
} catch (Exception e) assert(false, e.msg);
});
t1.join();
t2.join();
}
void testVersion()
{
// NOTE: SSLv3 is not supported anymore by current OpenSSL versions
// NOTE: Ubuntu 20.04 has removed support for TLSv1/TLSv1.1 from OpenSSL
version (linux) enum support_old_tls = false;
else enum support_old_tls = true;
testConn(TLSVersion.ssl3, TLSVersion.any, false);
testConn(TLSVersion.ssl3, TLSVersion.ssl3, false);
testConn(TLSVersion.ssl3, TLSVersion.tls1, false);
testConn(TLSVersion.ssl3, TLSVersion.tls1_1, false);
testConn(TLSVersion.ssl3, TLSVersion.tls1_2, false);
if (support_old_tls) testConn(TLSVersion.tls1, TLSVersion.any, true);
testConn(TLSVersion.tls1, TLSVersion.ssl3, false);
if (support_old_tls) testConn(TLSVersion.tls1, TLSVersion.tls1, true);
testConn(TLSVersion.tls1, TLSVersion.tls1_1, false);
testConn(TLSVersion.tls1, TLSVersion.tls1_2, false);
if (support_old_tls) testConn(TLSVersion.tls1_1, TLSVersion.any, true);
testConn(TLSVersion.tls1_1, TLSVersion.ssl3, false);
testConn(TLSVersion.tls1_1, TLSVersion.tls1, false);
if (support_old_tls) testConn(TLSVersion.tls1_1, TLSVersion.tls1_1, true);
testConn(TLSVersion.tls1_1, TLSVersion.tls1_2, false);
testConn(TLSVersion.tls1_2, TLSVersion.any, true);
testConn(TLSVersion.tls1_2, TLSVersion.ssl3, false);
testConn(TLSVersion.tls1_2, TLSVersion.tls1, false);
testConn(TLSVersion.tls1_2, TLSVersion.tls1_1, false);
testConn(TLSVersion.tls1_2, TLSVersion.tls1_2, true);
testConn(TLSVersion.any, TLSVersion.any, true);
testConn(TLSVersion.any, TLSVersion.ssl3, false);
if (support_old_tls) testConn(TLSVersion.any, TLSVersion.tls1, true);
if (support_old_tls) testConn(TLSVersion.any, TLSVersion.tls1_1, true);
testConn(TLSVersion.any, TLSVersion.tls1_2, true);
}
void main()
{
testValidation();
testVersion();
}
| D |
//Written in the D programming language
/++
$(LUCKY Regular expressions) are commonly used method of pattern matching
on strings, with $(I regex) being a catchy word for a pattern in this domain
specific language. Typical problems usually solved by regular expressions
include validation of user input and ubiquitous find & replace
in text processing utilities.
Synposis:
---
import std.regex;
import std.stdio;
void main()
{
//print out all possible dd/mm/yy(yy) dates found in user input
//g - global, find all matches
auto r = regex(r"\b[0-9][0-9]?/[0-9][0-9]?/[0-9][0-9](?:[0-9][0-9])?\b", "g");
foreach(line; stdin.byLine)
{
//match returns a range that can be iterated
//to get all of subsequent matches
foreach(c; match(line, r))
writeln(c.hit);
}
}
...
//create static regex at compile-time, contains fast native code
enum ctr = ctRegex!(`^.*/([^/]+)/?$`);
//works just like normal regex:
auto m2 = match("foo/bar", ctr); //first match found here if any
assert(m2); // be sure to check if there is a match, before examining contents!
assert(m2.captures[1] == "bar");//captures is a range of submatches, 0 - full match
...
//result of match is directly testable with if/assert/while
//e.g. test if a string consists of letters:
assert(match("Letter", `^\p{L}+$`));
---
The general usage guideline is keeping regex complexity on the side of simplicity,
as its capabilities reside in purely character-level manipulation,
and as such are ill suited for tasks involving higher level invariants
like matching an integer number $(U bounded) in [a,b] interval.
Checks of this sort of are better addressed by additional post-processing.
The basic syntax shouldn't surprize experienced users of regular expressions.
Thankfully, nowdays the web is bustling with resources to help newcomers, and a good
$(WEB www.regular-expressions.info, reference with tutorial ) on regular expressions
could be found.
This library uses ECMAScript syntax flavor with the following extensions:
$(UL
$(LI Named subexpressions, with Python syntax. )
$(LI Unicode properties such as Scripts, Blocks and common binary properties e.g Alphabetic, White_Space, Hex_Digit etc.)
$(LI Arbitrary length and complexity lookbehind, including lookahead in lookbehind and vise-versa.)
)
$(REG_START Pattern syntax )
$(I std.regex operates on codepoint level,
'character' in this table denotes single unicode codepoint.)
$(REG_TABLE
$(REG_TITLE Pattern element, Semantics )
$(REG_TITLE Atoms, Match single characters )
$(REG_ROW any character except [|*+?(), Matches the character itself. )
$(REG_ROW ., In single line mode matches any charcter.
Otherwise it matches any character except '\n' and '\r'. )
$(REG_ROW [class], Matches single character
that belongs to this character class. )
$(REG_ROW [^class], Matches single character that
does $(U not) belong to this character class.)
$(REG_ROW \cC, Matches the control character corresponding to letter C)
$(REG_ROW \xXX, Matches a character with hexadecimal value of XX. )
$(REG_ROW \uXXXX, Matches a character with hexadecimal value of XXXX. )
$(REG_ROW \U00YYYYYY, Matches a character with hexadecimal value of YYYYYY. )
$(REG_ROW \f, Matches a formfeed character. )
$(REG_ROW \n, Matches a linefeed character. )
$(REG_ROW \r, Matches a carriage return character. )
$(REG_ROW \t, Matches a tab character. )
$(REG_ROW \v, Matches a vertical tab character. )
$(REG_ROW \d, Matches any unicode digit. )
$(REG_ROW \D, Matches any character but unicode digit. )
$(REG_ROW \w, Matches any word character (note: this includes numbers).)
$(REG_ROW \W, Matches any non-word character.)
$(REG_ROW \s, Matches whitespace, same as \p{White_Space}.)
$(REG_ROW \S, Matches any character but these recognized as $(I \s ). )
$(REG_ROW \\, Matches \ character. )
$(REG_ROW \c where c is one of [|*+?(), Matches the character c itself. )
$(REG_ROW \p{PropertyName}, Matches character that belongs
to unicode PropertyName set.
Single letter abreviations could be used without surrounding {,}. )
$(REG_ROW \P{PropertyName}, Matches character that does not belong
to unicode PropertyName set.
Single letter abreviations could be used without surrounding {,}. )
$(REG_ROW \p{InBasicLatin}, Matches any character that is part of
BasicLatin unicode $(U block).)
$(REG_ROW \P{InBasicLatin}, Matches any character except ones in
BasicLatin unicode $(U block).)
$(REG_ROW \p{Cyrilic}, Matches any character that is part of
Cyrilic $(U script).)
$(REG_ROW \P{Cyrilic}, Matches any character except ones in
Cyrilic $(U script).)
$(REG_TITLE Quantifiers, Specify repetition of other elements)
$(REG_ROW *, Matches previous character/subexpression 0 or more times.
Greedy version - tries as many times as possible.)
$(REG_ROW *?, Matches previous character/subexpression 0 or more times.
Lazy version - stops as early as possible.)
$(REG_ROW +, Matches previous character/subexpression 1 or more times.
Greedy version - tries as many times as possible.)
$(REG_ROW +?, Matches previous character/subexpression 1 or more times.
Lazy version - stops as early as possible.)
$(REG_ROW {n}, Matches previous character/subexpression n exactly times. )
$(REG_ROW {n,}, Matches previous character/subexpression n times or more.
Greedy version - tries as many times as possible. )
$(REG_ROW {n,}?, Matches previous character/subexpression n times or more.
Lazy version - stops as early as possible.)
$(REG_ROW {n,m}, Matches previous character/subexpression n to m times.
Greedy version - tries as many times as possible. )
$(REG_ROW {n,m}?, Matches previous character/subexpression n to m times.
Lazy version - stops as early as possible, but no less then n times.)
$(REG_TITLE Other, Subexpressions & alternations )
$(REG_ROW (regex), Matches subexpression regex,
saving matched portion of text for later retrival. )
$(REG_ROW (?:regex), Matches subexpression regex,
$(U not) saving matched portion of text. Useful to speed up matching. )
$(REG_ROW A|B, Matches subexpression A, failing that matches B. )
$(REG_ROW (?P<name>regex), Matches named subexpression
regex labeling it with name 'name'.
When refering to matched portion of text,
names work like aliases in addition to direct numbers.
)
$(REG_TITLE Assertions, Match position rather then character )
$(REG_ROW ^, Matches at the begining of input or line (in multiline mode).)
$(REG_ROW $, Matches at the end of input or line (in multiline mode). )
$(REG_ROW \b, Matches at word boundary. )
$(REG_ROW \B, Matches when $(U not) at word boundary. )
$(REG_ROW (?=regex), Zero-width lookahead assertion.
Matches at a point where the subexpression
regex could be matched starting from current position.
)
$(REG_ROW (?!regex), Zero-width negative lookahead assertion.
Matches at a point where the subexpression
regex could $(U not ) be matched starting from current position.
)
$(REG_ROW (?<=regex), Zero-width lookbehind assertion. Matches at a point
where the subexpression regex could be matched ending
at current position (matching goes backwards).
)
$(REG_ROW (?<!regex), Zero-width negative lookbehind assertion.
Matches at a point where the subexpression regex could $(U not)
be matched ending at current position (matching goes backwards).
)
)
$(REG_START Character classes )
$(REG_TABLE
$(REG_TITLE Pattern element, Semantics )
$(REG_ROW Any atom, Have the same meaning as outside of character class.)
$(REG_ROW a-z, Includes characters a, b, c, ..., z. )
$(REG_ROW [a||b], [a--b], [a~~b], [a&&b], Where a, b are arbitrary classes,
means union, set difference, symmetric set difference, and intersection respectively.
$(I Any sequence of character class elements implicitly forms union.) )
)
$(REG_START Regex flags )
$(REG_TABLE
$(REG_TITLE Flag, Semantics )
$(REG_ROW g, Global regex, repeat over the whole input. )
$(REG_ROW i, Case insensitive matching. )
$(REG_ROW m, Multi-line mode, match ^, $ on start and end line separators
as well as start and end of input.)
$(REG_ROW s, Single-line mode, makes . match '\n' and '\r' as well. )
$(REG_ROW x, Free-form syntax, ignores whitespace in pattern,
useful for formating complex regular expressions. )
)
$(B Unicode support)
This library provides full Level 1 support* according to
$(WEB http://unicode.org/reports/tr18/, UTS 18). Specifically:
$(UL
$(LI 1.1 Hex notation via any of \uxxxx, \U00YYYYYY, \xZZ.)
$(LI 1.2 Unicode properties.)
$(LI 1.3 Character classes with set operations.)
$(LI 1.4 Word boundaries use full set of "word" characters.)
$(LI 1.5 Using simple casefolding to match case
insensitevely across full range of codepoints.)
$(LI 1.6 Respecting line breaks as any of
\u000A | \u000B | \u000C | \u000D | \u0085 | \u2028 | \u2029 | \u000D\u000A.)
$(LI 1.7 Operating on codepoint level.)
)
*With exception of point 1.1.1, as of yet, normalization of input
is expected to be enforced by user.
All matches returned by pattern matching functionality in this library
are slices of original input. Notable exception being $(D replace) family of functions
that generate new string from input.
License: $(WEB boost.org/LICENSE_1_0.txt, Boost License 1.0).
Authors: Dmitry Olshansky,
API and utility constructs are based on original $(D std.regex)
by Walter Bright and Andrei Alexandrescu
Copyright: Copyright Dmitry Olshansky, 2011
Macros:
REG_ROW = $(TR $(TD $(I $1 )) $(TD $+) )
REG_TITLE = $(TR $(TD $(B $1)) $(TD $(B $2)) )
REG_TABLE = <table border="1" cellspacing="0" cellpadding="5" > $0 </table>
REG_START = <h3><div align="center"> $0 </div></h3>
+/
module std.regex;
import std.internal.uni, std.internal.uni_tab;//unicode property tables
import std.array, std.algorithm, std.range,
std.conv, std.exception, std.traits, std.typetuple,
std.uni, std.utf, std.format, std.typecons, std.bitmanip,
std.functional, std.exception;
import core.bitop, core.stdc.string, core.stdc.stdlib;
import ascii = std.ascii;
import std.string : representation;
version(unittest) debug import std.stdio;
private:
@safe:
//uncomment to get a barrage of debug info
//debug = fred_parser;
//debug = fred_matching;
//debug = fred_charset;
// IR bit pattern: 0b1_xxxxx_yy
// where yy indicates class of instruction, xxxxx for actual operation code
// 00: atom, a normal instruction
// 01: open, opening of a group, has length of contained IR in the low bits
// 10: close, closing of a group, has length of contained IR in the low bits
// 11 unused
//
// Loops with Q (non-greedy, with ? mark) must have the same size / other properties as non Q version
// Possible changes:
//* merge group, option, infinite/repeat start (to never copy during parsing of (a|b){1,2})
//* reorganize groups to make n args easier to find, or simplify the check for groups of similar ops
// (like lookaround), or make it easier to identify hotspots.
enum IR:uint {
Char = 0b1_00000_00, //a character
Any = 0b1_00001_00, //any character
CodepointSet = 0b1_00010_00, //a most generic CodepointSet [...]
Trie = 0b1_00011_00, //CodepointSet implemented as Trie
//match with any of a consecutive OrChar's in this sequence
//(used for case insensitive match)
//OrChar holds in upper two bits of data total number of OrChars in this _sequence_
//the drawback of this representation is that it is difficult
// to detect a jump in the middle of it
OrChar = 0b1_00100_00,
Nop = 0b1_00101_00, //no operation (padding)
End = 0b1_00110_00, //end of program
Bol = 0b1_00111_00, //beginning of a string ^
Eol = 0b1_01000_00, //end of a string $
Wordboundary = 0b1_01001_00, //boundary of a word
Notwordboundary = 0b1_01010_00, //not a word boundary
Backref = 0b1_01011_00, //backreference to a group (that has to be pinned, i.e. locally unique) (group index)
GroupStart = 0b1_01100_00, //start of a group (x) (groupIndex+groupPinning(1bit))
GroupEnd = 0b1_01101_00, //end of a group (x) (groupIndex+groupPinning(1bit))
Option = 0b1_01110_00, //start of an option within an alternation x | y (length)
GotoEndOr = 0b1_01111_00, //end of an option (length of the rest)
//... any additional atoms here
OrStart = 0b1_00000_01, //start of alternation group (length)
OrEnd = 0b1_00000_10, //end of the or group (length,mergeIndex)
//with this instruction order
//bit mask 0b1_00001_00 could be used to test/set greediness
InfiniteStart = 0b1_00001_01, //start of an infinite repetition x* (length)
InfiniteEnd = 0b1_00001_10, //end of infinite repetition x* (length,mergeIndex)
InfiniteQStart = 0b1_00010_01, //start of a non eager infinite repetition x*? (length)
InfiniteQEnd = 0b1_00010_10, //end of non eager infinite repetition x*? (length,mergeIndex)
RepeatStart = 0b1_00011_01, //start of a {n,m} repetition (length)
RepeatEnd = 0b1_00011_10, //end of x{n,m} repetition (length,step,minRep,maxRep)
RepeatQStart = 0b1_00100_01, //start of a non eager x{n,m}? repetition (length)
RepeatQEnd = 0b1_00100_10, //end of non eager x{n,m}? repetition (length,step,minRep,maxRep)
//
LookaheadStart = 0b1_00101_01, //begin of the lookahead group (length)
LookaheadEnd = 0b1_00101_10, //end of a lookahead group (length)
NeglookaheadStart = 0b1_00110_01, //start of a negative lookahead (length)
NeglookaheadEnd = 0b1_00110_10, //end of a negative lookahead (length)
LookbehindStart = 0b1_00111_01, //start of a lookbehind (length)
LookbehindEnd = 0b1_00111_10, //end of a lookbehind (length)
NeglookbehindStart= 0b1_01000_01, //start of a negative lookbehind (length)
NeglookbehindEnd = 0b1_01000_10, //end of negative lookbehind (length)
}
//a shorthand for IR length - full length of specific opcode evaluated at compile time
template IRL(IR code)
{
enum uint IRL = lengthOfIR(code);
}
static assert (IRL!(IR.LookaheadStart) == 3);
//how many parameters follow the IR, should be optimized fixing some IR bits
int immediateParamsIR(IR i){
switch (i){
case IR.OrEnd,IR.InfiniteEnd,IR.InfiniteQEnd:
return 1;
case IR.RepeatEnd, IR.RepeatQEnd:
return 4;
case IR.LookaheadStart, IR.NeglookaheadStart, IR.LookbehindStart, IR.NeglookbehindStart:
return 2;
default:
return 0;
}
}
//full length of IR instruction inlcuding all parameters that might follow it
int lengthOfIR(IR i)
{
return 1 + immediateParamsIR(i);
}
//full length of the paired IR instruction inlcuding all parameters that might follow it
int lengthOfPairedIR(IR i)
{
return 1 + immediateParamsIR(pairedIR(i));
}
//if the operation has a merge point (this relies on the order of the ops)
bool hasMerge(IR i)
{
return (i&0b11)==0b10 && i<=IR.RepeatQEnd;
}
//is an IR that opens a "group"
bool isStartIR(IR i)
{
return (i&0b11)==0b01;
}
//is an IR that ends a "group"
bool isEndIR(IR i)
{
return (i&0b11)==0b10;
}
//is a standalone IR
bool isAtomIR(IR i)
{
return (i&0b11)==0b00;
}
//makes respective pair out of IR i, swapping start/end bits of instruction
IR pairedIR(IR i)
{
assert(isStartIR(i) || isEndIR(i));
return cast(IR)(i ^ 0b11);
}
//encoded IR instruction
struct Bytecode
{
uint raw;
//natural constraints
enum maxSequence = 2+4;
enum maxData = 1<<22;
enum maxRaw = 1<<31;
this(IR code, uint data)
{
assert(data < (1<<22) && code < 256);
raw = code<<24 | data;
}
this(IR code, uint data, uint seq)
{
assert(data < (1<<22) && code < 256 );
assert(seq >= 2 && seq < maxSequence);
raw = code<<24 | ((seq-2)<<22) | data;
}
//store raw data
static Bytecode fromRaw(uint data)
{
Bytecode t;
t.raw = data;
return t;
}
//bit twiddling helpers
@property uint data() const { return raw & 0x003f_ffff; }
//ditto
@property uint sequence() const { return 2+((raw >>22) & 0x3); }
//ditto
@property IR code() const { return cast(IR)(raw>>24); }
//ditto
@property bool hotspot() const { return hasMerge(code); }
//test the class of this instruction
@property bool isAtom() const { return isAtomIR(code); }
//ditto
@property bool isStart() const { return isStartIR(code); }
//ditto
@property bool isEnd() const { return isEndIR(code); }
//number of arguments for this instruction
@property int args() const { return immediateParamsIR(code); }
//mark this GroupStart or GroupEnd as referenced in backreference
void setBackrefence()
{
assert(code == IR.GroupStart || code == IR.GroupEnd);
raw = raw | (1<<23);
}
//is referenced
@property bool backreference() const
{
assert(code == IR.GroupStart || code == IR.GroupEnd);
return cast(bool)(raw & (1<<23));
}
//mark as local reference (for backrefs in lookarounds)
void setLocalRef()
{
assert(code == IR.Backref);
raw = raw | (1<<23);
}
//is a local ref
@property bool localRef() const
{
assert(code == IR.Backref);
return cast(bool)(raw & (1<<23));
}
//human readable name of instruction
@trusted @property string mnemonic() const
{//@@@BUG@@@ to is @system
return to!string(code);
}
//full length of instruction
@property uint length() const
{
return lengthOfIR(code);
}
//full length of respective start/end of this instruction
@property uint pairedLength() const
{
return lengthOfPairedIR(code);
}
//returns bytecode of paired instruction (assuming this one is start or end)
@property Bytecode paired() const
{//depends on bit and struct layout order
assert(isStart || isEnd);
return Bytecode.fromRaw(raw ^ (0b11<<24));
}
//gets an index into IR block of the respective pair
uint indexOfPair(uint pc) const
{
assert(isStart || isEnd);
return isStart ? pc + data + length : pc - data - lengthOfPairedIR(code);
}
}
static assert(Bytecode.sizeof == 4);
//debugging tool, prints out instruction along with opcodes
@trusted string disassemble(in Bytecode[] irb, uint pc, in NamedGroup[] dict=[])
{
auto output = appender!string();
formattedWrite(output,"%s", irb[pc].mnemonic);
switch(irb[pc].code)
{
case IR.Char:
formattedWrite(output, " %s (0x%x)",cast(dchar)irb[pc].data, irb[pc].data);
break;
case IR.OrChar:
formattedWrite(output, " %s (0x%x) seq=%d", cast(dchar)irb[pc].data, irb[pc].data, irb[pc].sequence);
break;
case IR.RepeatStart, IR.InfiniteStart, IR.Option, IR.GotoEndOr, IR.OrStart:
//forward-jump instructions
uint len = irb[pc].data;
formattedWrite(output, " pc=>%u", pc+len+IRL!(IR.RepeatStart));
break;
case IR.RepeatEnd, IR.RepeatQEnd: //backward-jump instructions
uint len = irb[pc].data;
formattedWrite(output, " pc=>%u min=%u max=%u step=%u"
, pc-len, irb[pc+3].raw, irb[pc+4].raw, irb[pc+2].raw);
break;
case IR.InfiniteEnd, IR.InfiniteQEnd, IR.OrEnd: //ditto
uint len = irb[pc].data;
formattedWrite(output, " pc=>%u", pc-len);
break;
case IR.LookaheadEnd, IR.NeglookaheadEnd: //ditto
uint len = irb[pc].data;
formattedWrite(output, " pc=>%u", pc-len);
break;
case IR.GroupStart, IR.GroupEnd:
uint n = irb[pc].data;
string name;
foreach(v;dict)
if(v.group == n)
{
name = "'"~v.name~"'";
break;
}
formattedWrite(output, " %s #%u " ~ (irb[pc].backreference ? "referenced" : ""),
name, n);
break;
case IR.LookaheadStart, IR.NeglookaheadStart, IR.LookbehindStart, IR.NeglookbehindStart:
uint len = irb[pc].data;
uint start = irb[pc+1].raw, end = irb[pc+2].raw;
formattedWrite(output, " pc=>%u [%u..%u]", pc + len + IRL!(IR.LookaheadStart), start, end);
break;
case IR.Backref: case IR.CodepointSet: case IR.Trie:
uint n = irb[pc].data;
formattedWrite(output, " %u", n);
if(irb[pc].code == IR.Backref)
formattedWrite(output, " %s", irb[pc].localRef ? "local" : "global");
break;
default://all data-free instructions
}
if(irb[pc].hotspot)
formattedWrite(output, " Hotspot %u", irb[pc+1].raw);
return output.data;
}
//another pretty printer, writes out the bytecode of a regex and where the pc is
@trusted void prettyPrint(Sink,Char=const(char))
(Sink sink, const(Bytecode)[] irb, uint pc=uint.max, int indent=3, size_t index=0)
if (isOutputRange!(Sink,Char))
{//formattedWrite is @system
while(irb.length>0)
{
formattedWrite(sink,"%3d",index);
if(pc==0 && irb[0].code!=IR.Char)
{
for (int i=0;i<indent-2;++i)
put(sink,"=");
put(sink,"> ");
}
else
{
if(isEndIR(irb[0].code))
{
indent-=2;
}
if(indent>0)
{
string spaces=" ";
put(sink,spaces[0..(indent%spaces.length)]);
for (size_t i=indent/spaces.length;i>0;--i)
put(sink,spaces);
}
}
if(irb[0].code==IR.Char)
{
put(sink,`"`);
int i=0;
do{
put(sink,cast(char[])([cast(dchar)irb[i].data]));
++i;
} while(i<irb.length && irb[i].code==IR.Char);
put(sink,"\"");
if (pc<i){
put(sink,"\n");
for (int ii=indent+pc+1;ii>0;++ii)
put(sink,"=");
put(sink,"^");
}
index+=i;
irb=irb[i..$];
}
else
{
put(sink,irb[0].mnemonic);
put(sink,"(");
formattedWrite(sink,"%d",irb[0].data);
int nArgs= irb[0].args;
for(int iarg=0;iarg<nArgs;++iarg)
{
if(iarg+1<irb.length)
formattedWrite(sink,",%d",irb[iarg+1].data);
else
put(sink,"*error* incomplete irb stream");
}
put(sink,")");
if(isStartIR(irb[0].code))
{
indent+=2;
}
index+=lengthOfIR(irb[0].code);
irb=irb[lengthOfIR(irb[0].code)..$];
}
put(sink,"\n");
}
}
//index entry structure for name --> number of submatch
struct NamedGroup
{
string name;
uint group;
}
//holds pair of start-end markers for a submatch
struct Group(DataIndex)
{
DataIndex begin, end;
@trusted string toString() const
{
auto a = appender!string();
formattedWrite(a, "%s..%s", begin, end);
return a.data;
}
}
//Regular expression engine/parser options:
// global - search all nonoverlapping matches in input
// casefold - case insensitive matching, do casefolding on match in unicode mode
// freeform - ignore whitespace in pattern, to match space use [ ] or \s
// multiline - switch ^, $ detect start and end of linesinstead of just start and end of input
enum RegexOption: uint {
global = 0x1,
casefold = 0x2,
freeform = 0x4,
nonunicode = 0x8,
multiline = 0x10,
singleline = 0x20
};
alias TypeTuple!('g', 'i', 'x', 'U', 'm', 's') RegexOptionNames;//do not reorder this list
static assert( RegexOption.max < 0x80);
enum RegexInfo : uint { oneShot = 0x80 };
private enum NEL = '\u0085', LS = '\u2028', PS = '\u2029';
//test if a given string starts with hex number of maxDigit that's a valid codepoint
//returns it's value and skips these maxDigit chars on success, throws on failure
dchar parseUniHex(Char)(ref Char[] str, uint maxDigit)
{
enforce(str.length >= maxDigit,"incomplete escape sequence");
uint val;
for(int k=0;k<maxDigit;k++)
{
auto current = str[k];//accepts ascii only, so it's OK to index directly
if('0' <= current && current <= '9')
val = val * 16 + current - '0';
else if('a' <= current && current <= 'f')
val = val * 16 + current -'a' + 10;
else if('A' <= current && current <= 'Z')
val = val * 16 + current - 'A' + 10;
else
throw new Exception("invalid escape sequence");
}
enforce(val <= 0x10FFFF, "invalid codepoint");
str = str[maxDigit..$];
return val;
}
//heuristic value determines maximum CodepointSet length suitable for linear search
enum maxCharsetUsed = 6;
enum maxCachedTries = 8;
alias CodepointTrie!8 Trie;
Trie[const(CodepointSet)] trieCache;
//accessor with caching
@trusted Trie getTrie(in CodepointSet set)
{// @@@BUG@@@ 6357 almost all properties of AA are not @safe
if(__ctfe || maxCachedTries == 0)
return Trie(set);
else
{
auto p = set in trieCache;
if(p)
return *p;
if(trieCache.length == maxCachedTries)
{
trieCache.clear();
trieCache = null;
}
return (trieCache[set] = Trie(set));
}
}
//property for \w character class
@property CodepointSet wordCharacter()
{
return memoizeExpr!("CodepointSet.init.add(unicodeAlphabetic).add(unicodeMn).add(unicodeMc)
.add(unicodeMe).add(unicodeNd).add(unicodePc)")();
}
@property Trie wordTrie()
{
return memoizeExpr!("Trie(wordCharacter)")();
}
auto memoizeExpr(string expr)()
{
if(__ctfe)
return mixin(expr);
alias typeof(mixin(expr)) T;
static T slot;
static bool initialized;
if(!initialized)
{
slot = mixin(expr);
initialized = true;
}
return slot;
}
/+
fetch codepoint set corresponding to a name (InBlock or binary property)
+/
@trusted const(CodepointSet) getUnicodeSet(in char[] name, bool negated, bool casefold)
{
alias comparePropertyName ucmp;
CodepointSet s;
//unicode property
//helper: direct access with a sanity check
if(ucmp(name, "L") == 0 || ucmp(name, "Letter") == 0)
{
s.add(unicodeLu).add(unicodeLl).add(unicodeLt)
.add(unicodeLo).add(unicodeLm);
}
else if(ucmp(name,"LC") == 0 || ucmp(name,"Cased Letter")==0)
{
s.add(unicodeLl).add(unicodeLu).add(unicodeLt);//Title case
}
else if(ucmp(name, "M") == 0 || ucmp(name, "Mark") == 0)
{
s.add(unicodeMn).add(unicodeMc).add(unicodeMe);
}
else if(ucmp(name, "P") == 0 || ucmp(name, "Punctuation") == 0)
{
s.add(unicodePc).add(unicodePd).add(unicodePs).add(unicodePe)
.add(unicodePi).add(unicodePf).add(unicodePo);
}
else if(ucmp(name, "S") == 0 || ucmp(name, "Symbol") == 0)
{
s.add(unicodeSm).add(unicodeSc).add(unicodeSk).add(unicodeSo);
}
else if(ucmp(name, "Z") == 0 || ucmp(name, "Separator") == 0)
{
s.add(unicodeZs).add(unicodeZl).add(unicodeZp);
}
else if(ucmp(name, "C") == 0 || ucmp(name, "Other") == 0)
{
s.add(unicodeCo).add(unicodeLo).add(unicodeNo)
.add(unicodeSo).add(unicodePo);
}
else if(ucmp(name, "any") == 0)
s.add(Interval(0,0x10FFFF));
else if(ucmp(name, "ascii") == 0)
s.add(Interval(0,0x7f));
else
{
version(fred_perfect_hashing)
{
uint key = phash(name);
if(key >= PHASHNKEYS || ucmp(name,unicodeProperties[key].name) != 0)
enforce(0, "invalid property name");
s = cast(CodepointSet)unicodeProperties[key].set;
}
else
{
auto range = assumeSorted!((x,y){ return ucmp(x.name, y.name) < 0; })(unicodeProperties);
//creating empty Codepointset is a workaround
auto eq = range.lowerBound(UnicodeProperty(cast(string)name,CodepointSet.init)).length;
enforce(eq!=range.length && ucmp(name,range[eq].name)==0,"invalid property name");
s = range[eq].set.dup;
}
}
if(casefold)
s = caseEnclose(s);
if(negated)
s.negate();
return cast(const CodepointSet)s;
}
//basic stack, just in case it gets used anywhere else then Parser
@trusted struct Stack(T, bool CTFE=false)
{
static if(!CTFE)
Appender!(T[]) stack;//compiles but bogus at CTFE
else
{
struct Proxy
{
T[] data;
void put(T val)
{
data ~= val;
}
void shrinkTo(size_t sz){ data = data[0..sz]; }
}
Proxy stack;
}
@property bool empty(){ return stack.data.empty; }
void push(T item)
{
stack.put(item);
}
@property ref T top()
{
assert(!empty);
return stack.data[$-1];
}
@property size_t length() { return stack.data.length; }
T pop()
{
assert(!empty);
auto t = stack.data[$-1];
stack.shrinkTo(stack.data.length-1);
return t;
}
}
//safety limits
enum maxGroupNumber = 2^^19;
enum maxLookaroundDepth = 16;
// *Bytecode.sizeof, i.e. 1Mb of bytecode alone
enum maxCompiledLength = 2^^18;
//amounts to up to 4 Mb of auxilary table for matching
enum maxCumulativeRepetitionLength = 2^^20;
template BasicElementOf(Range)
{
alias Unqual!(ElementEncodingType!Range) BasicElementOf;
}
struct Parser(R, bool CTFE=false)
if (isForwardRange!R && is(ElementType!R : dchar))
{
enum infinite = ~0u;
dchar _current;
bool empty;
R pat, origin; //keep full pattern for pretty printing error messages
Bytecode[] ir; //resulting bytecode
uint re_flags = 0; //global flags e.g. multiline + internal ones
Stack!(uint, CTFE) fixupStack; //stack of opened start instructions
NamedGroup[] dict; //maps name -> user group number
//current num of group, group nesting level and repetitions step
Stack!(uint, CTFE) groupStack;
uint nesting = 0;
uint lookaroundNest = 0;
uint counterDepth = 0; //current depth of nested counted repetitions
const(CodepointSet)[] charsets; //
const(Trie)[] tries; //
uint[] backrefed; //bitarray for groups
@trusted this(S)(R pattern, S flags)
if(isSomeString!S)
{
pat = origin = pattern;
if(!__ctfe)
ir.reserve(pat.length);
parseFlags(flags);
_current = ' ';//a safe default for freeform parsing
next();
if(__ctfe)
parseRegex();
else
{
try
{
parseRegex();
}
catch(Exception e)
{
error(e.msg);//also adds pattern location
}
}
put(Bytecode(IR.End, 0));
}
//mark referenced groups for latter processing
void markBackref(uint n)
{
if(n/32 >= backrefed.length)
backrefed.length = n/32 + 1;
backrefed[n/32] |= 1<<(n & 31);
}
@property dchar current(){ return _current; }
bool _next()
{
if(pat.empty)
{
empty = true;
return false;
}
//for CTFEability
size_t idx=0;
_current = decode(pat, idx);
pat = pat[idx..$];
return true;
}
void skipSpace()
{
while(isWhite(current) && _next()){ }
}
bool next()
{
if(re_flags & RegexOption.freeform)
{
bool r = _next();
skipSpace();
return r;
}
else
return _next();
}
void put(Bytecode code)
{
enforce(ir.length < maxCompiledLength
, "maximum compiled pattern length is exceeded");
if(__ctfe)
{
ir = ir ~ code;
}
else
ir ~= code;
}
void putRaw(uint number)
{
enforce(ir.length < maxCompiledLength
, "maximum compiled pattern length is exceeded");
ir ~= Bytecode.fromRaw(number);
}
//parsing number with basic overflow check
uint parseDecimal()
{
uint r=0;
while(ascii.isDigit(current))
{
if(r >= (uint.max/10))
error("Overflow in decimal number");
r = 10*r + cast(uint)(current-'0');
if(!next())
break;
}
return r;
}
//parse control code of form \cXXX, c assumed to be the current symbol
dchar parseControlCode()
{
enforce(next(), "Unfinished escape sequence");
enforce(('a' <= current && current <= 'z') || ('A' <= current && current <= 'Z'),
"Only letters are allowed after \\c");
return current & 0x1f;
}
//
@trusted void parseFlags(S)(S flags)
{//@@@BUG@@@ text is @system
foreach(ch; flags)//flags are ASCII anyway
{
L_FlagSwitch:
switch(ch)
{
foreach(i, op; __traits(allMembers, RegexOption))
{
case RegexOptionNames[i]:
if(re_flags & mixin("RegexOption."~op))
throw new RegexException(text("redundant flag specified: ",ch));
re_flags |= mixin("RegexOption."~op);
break L_FlagSwitch;
}
default:
if(__ctfe)
assert(text("unknown regex flag '",ch,"'"));
else
new RegexException(text("unknown regex flag '",ch,"'"));
}
}
}
//parse and store IR for regex pattern
@trusted void parseRegex()
{
fixupStack.push(0);
groupStack.push(1);//0 - whole match
auto maxCounterDepth = counterDepth;
uint fix;//fixup pointer
while(!empty)
{
debug(fred_parser)
writeln("*LR*\nSource: ", pat, "\nStack: ",fixupStack.stack.data);
switch(current)
{
case '(':
next();
nesting++;
uint nglob;
fixupStack.push(cast(uint)ir.length);
if(current == '?')
{
next();
switch(current)
{
case ':':
put(Bytecode(IR.Nop, 0));
next();
break;
case '=':
genLookaround(IR.LookaheadStart);
next();
break;
case '!':
genLookaround(IR.NeglookaheadStart);
next();
break;
case 'P':
next();
if(current != '<')
error("Expected '<' in named group");
string name;
while(next() && isAlpha(current))
{
name ~= current;
}
if(current != '>')
error("Expected '>' closing named group");
next();
nglob = groupStack.top++;
enforce(groupStack.top <= maxGroupNumber, "limit on submatches is exceeded");
auto t = NamedGroup(name, nglob);
if(__ctfe)
{
size_t ind;
for(ind=0; ind <dict.length; ind++)
if(t.name >= dict[ind].name)
break;
insertInPlaceAlt(dict, ind, t);
}
else
{
auto d = assumeSorted!"a.name < b.name"(dict);
auto ind = d.lowerBound(t).length;
insertInPlaceAlt(dict, ind, t);
}
put(Bytecode(IR.GroupStart, nglob));
break;
case '<':
next();
if(current == '=')
genLookaround(IR.LookbehindStart);
else if(current == '!')
genLookaround(IR.NeglookbehindStart);
else
error("'!' or '=' expected after '<'");
next();
break;
default:
error(" ':', '=', '<', 'P' or '!' expected after '(?' ");
}
}
else
{
nglob = groupStack.top++;
enforce(groupStack.top <= maxGroupNumber, "limit on number of submatches is exceeded");
put(Bytecode(IR.GroupStart, nglob));
}
break;
case ')':
enforce(nesting, "Unmatched ')'");
nesting--;
next();
fix = fixupStack.pop();
switch(ir[fix].code)
{
case IR.GroupStart:
put(Bytecode(IR.GroupEnd,ir[fix].data));
parseQuantifier(fix);
break;
case IR.LookaheadStart, IR.NeglookaheadStart, IR.LookbehindStart, IR.NeglookbehindStart:
assert(lookaroundNest);
fixLookaround(fix);
lookaroundNest--;
put(ir[fix].paired);
break;
case IR.Option: //| xxx )
//two fixups: last option + full OR
finishAlternation(fix);
fix = fixupStack.top;
switch(ir[fix].code)
{
case IR.GroupStart:
fixupStack.pop();
put(Bytecode(IR.GroupEnd,ir[fix].data));
parseQuantifier(fix);
break;
case IR.LookaheadStart, IR.NeglookaheadStart, IR.LookbehindStart, IR.NeglookbehindStart:
assert(lookaroundNest);
lookaroundNest--;
fix = fixupStack.pop();
fixLookaround(fix);
put(ir[fix].paired);
break;
default://(?:xxx)
fixupStack.pop();
parseQuantifier(fix);
}
break;
default://(?:xxx)
parseQuantifier(fix);
}
break;
case '|':
next();
fix = fixupStack.top;
if(ir.length > fix && ir[fix].code == IR.Option)
{
ir[fix] = Bytecode(ir[fix].code, cast(uint)ir.length - fix);
put(Bytecode(IR.GotoEndOr, 0));
fixupStack.top = cast(uint)ir.length; //replace latest fixup for Option
put(Bytecode(IR.Option, 0));
break;
}
//start a new option
if(fixupStack.length == 1)//only root entry
fix = -1;
uint len = cast(uint)ir.length - fix;
insertInPlaceAlt(ir, fix+1, Bytecode(IR.OrStart, 0), Bytecode(IR.Option, len));
assert(ir[fix+1].code == IR.OrStart);
put(Bytecode(IR.GotoEndOr, 0));
fixupStack.push(fix+1); //fixup for StartOR
fixupStack.push(cast(uint)ir.length); //for Option
put(Bytecode(IR.Option, 0));
break;
default://no groups or whatever
uint start = cast(uint)ir.length;
parseAtom();
parseQuantifier(start);
}
}
if(fixupStack.length != 1)
{
fix = fixupStack.pop();
enforce(ir[fix].code == IR.Option, "no matching ')'");
finishAlternation(fix);
enforce(fixupStack.length == 1, "no matching ')'");
}
}
//helper function, finalizes IR.Option, fix points to the first option of sequence
void finishAlternation(uint fix)
{
enforce(ir[fix].code == IR.Option, "no matching ')'");
ir[fix] = Bytecode(ir[fix].code, cast(uint)ir.length - fix - IRL!(IR.OrStart));
fix = fixupStack.pop();
enforce(ir[fix].code == IR.OrStart, "no matching ')'");
ir[fix] = Bytecode(IR.OrStart, cast(uint)ir.length - fix - IRL!(IR.OrStart));
put(Bytecode(IR.OrEnd, cast(uint)ir.length - fix - IRL!(IR.OrStart)));
uint pc = fix + IRL!(IR.OrStart);
while(ir[pc].code == IR.Option)
{
pc = pc + ir[pc].data;
if(ir[pc].code != IR.GotoEndOr)
break;
ir[pc] = Bytecode(IR.GotoEndOr, cast(uint)(ir.length - pc - IRL!(IR.OrEnd)));
pc += IRL!(IR.GotoEndOr);
}
put(Bytecode.fromRaw(0));
}
//parse and store IR for atom-quantifier pair
@trusted void parseQuantifier(uint offset)
{//moveAll is @system
uint replace = ir[offset].code == IR.Nop;
if(empty && !replace)
return;
uint min, max;
switch(current)
{
case '*':
min = 0;
max = infinite;
break;
case '?':
min = 0;
max = 1;
break;
case '+':
min = 1;
max = infinite;
break;
case '{':
enforce(next(), "Unexpected end of regex pattern");
enforce(ascii.isDigit(current), "First number required in repetition");
min = parseDecimal();
if(current == '}')
max = min;
else if(current == ',')
{
next();
if(ascii.isDigit(current))
max = parseDecimal();
else if(current == '}')
max = infinite;
else
error("Unexpected symbol in regex pattern");
skipSpace();
if(current != '}')
error("Unmatched '{' in regex pattern");
}
else
error("Unexpected symbol in regex pattern");
break;
default:
if(replace)
{
moveAllAlt(ir[offset+1..$],ir[offset..$-1]);
ir.length -= 1;
}
return;
}
uint len = cast(uint)ir.length - offset - replace;
bool greedy = true;
//check only if we managed to get new symbol
if(next() && current == '?')
{
greedy = false;
next();
}
if(max != infinite)
{
if(min != 1 || max != 1)
{
Bytecode op = Bytecode(greedy ? IR.RepeatStart : IR.RepeatQStart, len);
if(replace)
ir[offset] = op;
else
insertInPlaceAlt(ir, offset, op);
put(Bytecode(greedy ? IR.RepeatEnd : IR.RepeatQEnd, len));
put(Bytecode.init); //hotspot
putRaw(1);
putRaw(min);
putRaw(max);
counterDepth = std.algorithm.max(counterDepth, nesting+1);
}
}
else if(min) //&& max is infinite
{
if(min != 1)
{
Bytecode op = Bytecode(greedy ? IR.RepeatStart : IR.RepeatQStart, len);
if(replace)
ir[offset] = op;
else
insertInPlaceAlt(ir, offset, op);
offset += 1;//so it still points to the repeated block
put(Bytecode(greedy ? IR.RepeatEnd : IR.RepeatQEnd, len));
put(Bytecode.init); //hotspot
putRaw(1);
putRaw(min);
putRaw(min);
counterDepth = std.algorithm.max(counterDepth, nesting+1);
}
else if(replace)
{
if(__ctfe)//CTFE workaround: no moveAll and length -= x;
{
ir = ir[0..offset] ~ ir[offset+1..$];
}
else
{
moveAll(ir[offset+1 .. $],ir[offset .. $-1]);
ir.length -= 1;
}
}
put(Bytecode(greedy ? IR.InfiniteStart : IR.InfiniteQStart, len));
enforce(ir.length + len < maxCompiledLength, "maximum compiled pattern length is exceeded");
ir ~= ir[offset .. offset+len];
//IR.InfinteX is always a hotspot
put(Bytecode(greedy ? IR.InfiniteEnd : IR.InfiniteQEnd, len));
put(Bytecode.init); //merge index
}
else//vanila {0,inf}
{
Bytecode op = Bytecode(greedy ? IR.InfiniteStart : IR.InfiniteQStart, len);
if(replace)
ir[offset] = op;
else
insertInPlaceAlt(ir, offset, op);
//IR.InfinteX is always a hotspot
put(Bytecode(greedy ? IR.InfiniteEnd : IR.InfiniteQEnd, len));
put(Bytecode.init); //merge index
}
}
//parse and store IR for atom
void parseAtom()
{
if(empty)
return;
switch(current)
{
case '*', '?', '+', '|', '{', '}':
error("'*', '+', '?', '{', '}' not allowed in atom");
break;
case '.':
put(Bytecode(IR.Any, 0));
next();
break;
case '[':
parseCharset();
break;
case '\\':
enforce(_next(), "Unfinished escape sequence");
parseEscape();
break;
case '^':
put(Bytecode(IR.Bol, 0));
next();
break;
case '$':
put(Bytecode(IR.Eol, 0));
next();
break;
default:
if(re_flags & RegexOption.casefold)
{
dchar[5] data;
auto range = getCommonCasing(current, data);
assert(range.length <= 5);
if(range.length == 1)
put(Bytecode(IR.Char, range[0]));
else
foreach(v; range)
put(Bytecode(IR.OrChar, v, cast(uint)range.length));
}
else
put(Bytecode(IR.Char, current));
next();
}
}
//generate code for start of lookaround: (?= (?! (?<= (?<!
void genLookaround(IR opcode)
{
put(Bytecode(opcode, 0));
put(Bytecode.fromRaw(0));
put(Bytecode.fromRaw(0));
groupStack.push(0);
lookaroundNest++;
enforce(lookaroundNest <= maxLookaroundDepth
, "maximum lookaround depth is exceeded");
}
//fixup lookaround with start at offset fix
void fixLookaround(uint fix)
{
ir[fix] = Bytecode(ir[fix].code
, cast(uint)ir.length - fix - IRL!(IR.LookaheadStart));
auto g = groupStack.pop();
assert(!groupStack.empty);
ir[fix+1] = Bytecode.fromRaw(groupStack.top);
//groups are cumulative across lookarounds
ir[fix+2] = Bytecode.fromRaw(groupStack.top+g);
groupStack.top += g;
}
//CodepointSet operations relatively in order of priority
enum Operator:uint {
Open=0, Negate, Difference, SymDifference, Intersection, Union, None
};
//parse unit of CodepointSet spec, most notably escape sequences and char ranges
//also fetches next set operation
Tuple!(CodepointSet,Operator) parseCharTerm()
{
enum State{ Start, Char, Escape, Dash, DashEscape };
Operator op = Operator.None;;
dchar last;
CodepointSet set;
State state = State.Start;
static void addWithFlags(ref CodepointSet set, uint ch, uint re_flags)
{
if(re_flags & RegexOption.casefold)
{
dchar[5] chars;
auto range = getCommonCasing(ch, chars);
foreach(v; range)
set.add(v);
}
else
set.add(ch);
}
L_CharTermLoop:
for(;;)
{
final switch(state)
{
case State.Start:
switch(current)
{
case '[':
op = Operator.Union;
goto case;
case ']':
break L_CharTermLoop;
case '\\':
state = State.Escape;
break;
default:
state = State.Char;
last = current;
}
break;
case State.Char:
switch(current)
{
case '|':
if(last == '|')
{
op = Operator.Union;
next();
break L_CharTermLoop;
}
goto default;
case '-':
if(last == '-')
{
op = Operator.Difference;
next();
break L_CharTermLoop;
}
state = State.Dash;
break;
case '~':
if(last == '~')
{
op = Operator.SymDifference;
next();
break L_CharTermLoop;
}
goto default;
case '&':
if(last == '&')
{
op = Operator.Intersection;
next();
break L_CharTermLoop;
}
goto default;
case '\\':
set.add(last);
state = State.Escape;
break;
case '[':
op = Operator.Union;
goto case;
case ']':
set.add(last);
break L_CharTermLoop;
default:
addWithFlags(set, last, re_flags);
last = current;
}
break;
case State.Escape:
switch(current)
{
case 'f':
last = '\f';
state = State.Char;
break;
case 'n':
last = '\n';
state = State.Char;
break;
case 'r':
last = '\r';
state = State.Char;
break;
case 't':
last = '\t';
state = State.Char;
break;
case 'v':
last = '\v';
state = State.Char;
break;
case 'c':
last = parseControlCode();
state = State.Char;
break;
case '\\', '-', '[', ']', '(', ')', '*', '+', '?':
last = current;
state = State.Char;
break;
case 'p':
set.add(parseUnicodePropertySpec(false));
state = State.Start;
continue L_CharTermLoop; //next char already fetched
case 'P':
set.add(parseUnicodePropertySpec(true));
state = State.Start;
continue L_CharTermLoop; //next char already fetched
case 'x':
last = parseUniHex(pat, 2);
state = State.Char;
break;
case 'u':
last = parseUniHex(pat, 4);
state = State.Char;
break;
case 'U':
last = parseUniHex(pat, 8);
state = State.Char;
break;
case 'd':
set.add(unicodeNd);
state = State.Start;
break;
case 'D':
set.add(unicodeNd.dup.negate());
state = State.Start;
break;
case 's':
set.add(unicodeWhite_Space);
state = State.Start;
break;
case 'S':
set.add(unicodeWhite_Space.dup.negate());
state = State.Start;
break;
case 'w':
set.add(wordCharacter);
state = State.Start;
break;
case 'W':
set.add(wordCharacter.dup.negate());
state = State.Start;
break;
default:
enforce(false, "invalid escape sequence");
}
break;
case State.Dash:
switch(current)
{
case '[':
op = Operator.Union;
goto case;
case ']':
//means dash is a single char not an interval specifier
addWithFlags(set, last, re_flags);
set.add('-');
break L_CharTermLoop;
case '-'://set Difference again
addWithFlags(set, last, re_flags);
op = Operator.Difference;
next();//skip '-'
break L_CharTermLoop;
case '\\':
state = State.DashEscape;
break;
default:
enforce(last <= current, "inverted range");
if(re_flags & RegexOption.casefold)
{
for(uint ch = last; ch <= current; ch++)
addWithFlags(set, ch, re_flags);
}
else
set.add(Interval(last, current));
state = State.Start;
}
break;
case State.DashEscape: //xxxx-\yyyy
uint end;
switch(current)
{
case 'f':
end = '\f';
break;
case 'n':
end = '\n';
break;
case 'r':
end = '\r';
break;
case 't':
end = '\t';
break;
case 'v':
end = '\v';
break;
case '\\', '-', '[', ']', '(', ')', '*', '+', '?':
end = current;
break;
case 'c':
end = parseControlCode();
break;
case 'x':
end = parseUniHex(pat, 2);
break;
case 'u':
end = parseUniHex(pat, 4);
break;
case 'U':
end = parseUniHex(pat, 8);
break;
default:
error("invalid escape sequence");
}
enforce(last <= end,"inverted range");
set.add(Interval(last,end));
state = State.Start;
break;
}
enforce(next(), "unexpected end of CodepointSet");
}
return tuple(set, op);
}
alias Stack!(CodepointSet, CTFE) ValStack;
alias Stack!(Operator, CTFE) OpStack;
//parse and store IR for CodepointSet
void parseCharset()
{
ValStack vstack;
OpStack opstack;
//
static bool apply(Operator op, ref ValStack stack)
{
switch(op)
{
case Operator.Negate:
stack.top.negate();
break;
case Operator.Union:
auto s = stack.pop();//2nd operand
enforce(!stack.empty, "no operand for '||'");
stack.top.add(s);
break;
case Operator.Difference:
auto s = stack.pop();//2nd operand
enforce(!stack.empty, "no operand for '--'");
stack.top.sub(s);
break;
case Operator.SymDifference:
auto s = stack.pop();//2nd operand
enforce(!stack.empty, "no operand for '~~'");
stack.top.symmetricSub(s);
break;
case Operator.Intersection:
auto s = stack.pop();//2nd operand
enforce(!stack.empty, "no operand for '&&'");
stack.top.intersect(s);
break;
default:
return false;
}
return true;
}
static bool unrollWhile(alias cond)(ref ValStack vstack, ref OpStack opstack)
{
while(cond(opstack.top))
{
debug(fred_charset)
writeln(opstack.stack.data);
if(!apply(opstack.pop(),vstack))
return false;//syntax error
if(opstack.empty)
return false;
}
return true;
}
L_CharsetLoop:
do
{
switch(current)
{
case '[':
opstack.push(Operator.Open);
enforce(next(), "unexpected end of CodepointSet");
if(current == '^')
{
opstack.push(Operator.Negate);
enforce(next(), "unexpected end of CodepointSet");
}
//[] is prohibited
enforce(current != ']', "wrong CodepointSet");
goto default;
case ']':
enforce(unrollWhile!(unaryFun!"a != a.Open")(vstack, opstack)
, "CodepointSet syntax error");
enforce(!opstack.empty, "unmatched ']'");
opstack.pop();
next();
if(opstack.empty)
break L_CharsetLoop;
auto pair = parseCharTerm();
if(!pair[0].empty)//not only operator e.g. -- or ~~
{
vstack.top.add(pair[0]);//apply union
}
if(pair[1] != Operator.None)
{
if(opstack.top == Operator.Union)
unrollWhile!(unaryFun!"a == a.Union")(vstack, opstack);
opstack.push(pair[1]);
}
break;
//
default://yet another pair of term(op)?
auto pair = parseCharTerm();
if(pair[1] != Operator.None)
{
if(opstack.top == Operator.Union)
unrollWhile!(unaryFun!"a == a.Union")(vstack, opstack);
opstack.push(pair[1]);
}
vstack.push(pair[0]);
}
}while(!empty || !opstack.empty);
while(!opstack.empty)
apply(opstack.pop(),vstack);
assert(vstack.length == 1);
charsetToIr(vstack.top);
}
//try to generate optimal IR code for this CodepointSet
@trusted void charsetToIr(in CodepointSet set)
{//@@@BUG@@@ writeln is @system
uint chars = set.chars();
if(chars < Bytecode.maxSequence)
{
switch(chars)
{
case 1:
put(Bytecode(IR.Char, set.ivals[0]));
break;
case 0:
error("empty CodepointSet not allowed");
break;
default:
foreach(ch; set[])
put(Bytecode(IR.OrChar, ch, chars));
}
}
else
{
if(set.ivals.length > maxCharsetUsed)
{
auto t = getTrie(set);
put(Bytecode(IR.Trie, cast(uint)tries.length));
tries ~= t;
debug(fred_allocation) writeln("Trie generated");
}
else
{
put(Bytecode(IR.CodepointSet, cast(uint)charsets.length));
tries ~= Trie.init;
}
charsets ~= set;
assert(charsets.length == tries.length);
}
}
//parse and generate IR for escape stand alone escape sequence
@trusted void parseEscape()
{//accesses array of appender
switch(current)
{
case 'f': next(); put(Bytecode(IR.Char, '\f')); break;
case 'n': next(); put(Bytecode(IR.Char, '\n')); break;
case 'r': next(); put(Bytecode(IR.Char, '\r')); break;
case 't': next(); put(Bytecode(IR.Char, '\t')); break;
case 'v': next(); put(Bytecode(IR.Char, '\v')); break;
case 'd':
next();
charsetToIr(unicodeNd);
break;
case 'D':
next();
charsetToIr(unicodeNd.dup.negate());
break;
case 'b': next(); put(Bytecode(IR.Wordboundary, 0)); break;
case 'B': next(); put(Bytecode(IR.Notwordboundary, 0)); break;
case 's':
next();
charsetToIr(unicodeWhite_Space);
break;
case 'S':
next();
charsetToIr(unicodeWhite_Space.dup.negate());
break;
case 'w':
next();
charsetToIr(wordCharacter);
break;
case 'W':
next();
charsetToIr(wordCharacter.dup.negate());
break;
case 'p': case 'P':
auto CodepointSet = parseUnicodePropertySpec(current == 'P');
charsetToIr(CodepointSet);
break;
case 'x':
uint code = parseUniHex(pat, 2);
next();
put(Bytecode(IR.Char,code));
break;
case 'u': case 'U':
uint code = parseUniHex(pat, current == 'u' ? 4 : 8);
next();
put(Bytecode(IR.Char, code));
break;
case 'c': //control codes
Bytecode code = Bytecode(IR.Char, parseControlCode());
next();
put(code);
break;
case '0':
next();
put(Bytecode(IR.Char, 0));//NUL character
break;
case '1': .. case '9':
uint nref = cast(uint)current - '0';
uint maxBackref;
foreach(v; groupStack.stack.data)
maxBackref += v;
uint localLimit = maxBackref - groupStack.top;
enforce(nref < maxBackref, "Backref to unseen group");
//perl's disambiguation rule i.e.
//get next digit only if there is such group number
while(nref < maxBackref && next() && ascii.isDigit(current))
{
nref = nref * 10 + current - '0';
}
if(nref >= maxBackref)
nref /= 10;
if(nref >= localLimit)
{
put(Bytecode(IR.Backref, nref-localLimit));
ir[$-1].setLocalRef();
}
else
put(Bytecode(IR.Backref, nref));
markBackref(nref);
break;
default:
auto op = Bytecode(IR.Char, current);
next();
put(op);
}
}
//parse and return a CodepointSet for \p{...Property...} and \P{...Property..},
//\ - assumed to be processed, p - is current
const(CodepointSet) parseUnicodePropertySpec(bool negated)
{
alias comparePropertyName ucmp;
enum MAX_PROPERTY = 128;
char[MAX_PROPERTY] result;
uint k=0;
enforce(next());
if(current == '{')
{
while(k<MAX_PROPERTY && next() && current !='}' && current !=':')
if(current != '-' && current != ' ' && current != '_')
result[k++] = cast(char)ascii.toLower(current);
enforce(k != MAX_PROPERTY, "invalid property name");
enforce(current == '}', "} expected ");
}
else
{//single char properties e.g.: \pL, \pN ...
enforce(current < 0x80, "invalid property name");
result[k++] = cast(char)current;
}
auto s = getUnicodeSet(result[0..k], negated
, cast(bool)(re_flags & RegexOption.casefold));
enforce(!s.empty, "unrecognized unicode property spec");
next();
return s;
}
//
@trusted void error(string msg)
{
auto app = appender!string();
ir = null;
formattedWrite(app, "%s\nPattern with error: `%s` <--HERE-- `%s`",
msg, origin[0..$-pat.length], pat);
throw new RegexException(app.data);
}
alias BasicElementOf!R Char;
//packages parsing results into a RegEx object
@property Regex!Char program()
{
return Regex!Char(this);
}
}
/++
$(D Regex) object holds regular expression pattern in compiled form.
Instances of this object are constructed via calls to $(D regex).
This is an intended form for caching and storage of frequently
used regular expressions.
+/
public struct Regex(Char)
{
//temporary workaround for identifier lookup
const(CodepointSet)[] charsets; //
Bytecode[] ir; //compiled bytecode of pattern
/++
Test if this object doesn't contain any compiled pattern.
Example:
---
Regex!char r;
assert(r.empty);
r = regex("");//note: "" is a valid regex pattern
assert(!r.empty);
---
+/
@property bool empty() const nothrow { return ir is null; }
private:
NamedGroup[] dict; //maps name -> user group number
uint ngroup; //number of internal groups
uint maxCounterDepth; //max depth of nested {n,m} repetitions
uint hotspotTableSize; //number of entries in merge table
uint threadCount;
uint flags; //global regex flags
const(Trie)[] tries; //
uint[] backrefed; //bit array of backreferenced submatches
Kickstart!Char kickstart;
//bit access helper
uint isBackref(uint n)
{
if(n/32 >= backrefed.length)
return 0;
return backrefed[n/32] & (1<<(n&31));
}
//check if searching is not needed
void checkIfOneShot()
{
if(flags & RegexOption.multiline)
return;
L_CheckLoop:
for(uint i=0; i<ir.length; i+=ir[i].length)
{
switch(ir[i].code)
{
case IR.Bol:
flags |= RegexInfo.oneShot;
break L_CheckLoop;
case IR.GroupStart, IR.GroupEnd, IR.Eol, IR.Wordboundary, IR.Notwordboundary:
break;
default:
break L_CheckLoop;
}
}
}
/+
lightweight post process step,
only essentials
+/
@trusted void lightPostprocess()
{//@@@BUG@@@ write is @system
struct FixedStack(T)
{
T[] arr;
uint _top;
//this(T[] storage){ arr = storage; _top = -1; }
@property ref T top(){ assert(!empty); return arr[_top]; }
void push(T x){ arr[++_top] = x; }
T pop() { assert(!empty); return arr[_top--]; }
@property bool empty(){ return _top == -1; }
}
auto counterRange = FixedStack!uint(new uint[maxCounterDepth+1], -1);
counterRange.push(1);
ulong cumRange = 0;
for(uint i=0; i<ir.length; i+=ir[i].length)
{
if(ir[i].hotspot)
{
assert(i + 1 < ir.length
, "unexpected end of IR while looking for hotspot");
ir[i+1] = Bytecode.fromRaw(hotspotTableSize);
hotspotTableSize += counterRange.top;
}
switch(ir[i].code)
{
case IR.RepeatStart, IR.RepeatQStart:
uint repEnd = cast(uint)(i + ir[i].data + IRL!(IR.RepeatStart));
assert(ir[repEnd].code == ir[i].paired.code);
uint max = ir[repEnd + 4].raw;
ir[repEnd+2].raw = counterRange.top;
ir[repEnd+3].raw *= counterRange.top;
ir[repEnd+4].raw *= counterRange.top;
ulong cntRange = cast(ulong)(max)*counterRange.top;
cumRange += cntRange;
enforce(cumRange < maxCumulativeRepetitionLength
, "repetition length limit is exceeded");
counterRange.push(cast(uint)cntRange + counterRange.top);
threadCount += counterRange.top;
break;
case IR.RepeatEnd, IR.RepeatQEnd:
threadCount += counterRange.top;
counterRange.pop();
break;
case IR.GroupStart:
if(isBackref(ir[i].data))
ir[i].setBackrefence();
threadCount += counterRange.top;
break;
case IR.GroupEnd:
if(isBackref(ir[i].data))
ir[i].setBackrefence();
threadCount += counterRange.top;
break;
default:
threadCount += counterRange.top;
}
}
checkIfOneShot();
if(!(flags & RegexInfo.oneShot))
kickstart = Kickstart!Char(this, new uint[](256));
debug(fred_allocation) writefln("IR processed, max threads: %d", threadCount);
}
//IR code validator - proper nesting, illegal instructions, etc.
@trusted void validate()
{//@@@BUG@@@ text is @system
for(uint pc=0; pc<ir.length; pc+=ir[pc].length)
{
if(ir[pc].isStart || ir[pc].isEnd)
{
uint dest = ir[pc].indexOfPair(pc);
assert(dest < ir.length, text("Wrong length in opcode at pc="
, pc, " ", dest, " vs ", ir.length));
assert(ir[dest].paired == ir[pc]
,text("Wrong pairing of opcodes at pc=", pc, "and pc=", dest));
}
else if(ir[pc].isAtom)
{
}
else
assert(0, text("Unknown type of instruction at pc=", pc));
}
}
//print out disassembly a program's IR
@trusted debug public void print() const
{//@@@BUG@@@ write is system
import std.stdio;
writefln("PC\tINST\n");
prettyPrint(delegate void(const(char)[] s){ write(s); },ir);
writefln("\n");
for(uint i=0; i<ir.length; i+=ir[i].length)
{
writefln("%d\t%s ", i, disassemble(ir, i, dict));
}
writeln("Total merge table size: ", hotspotTableSize);
writeln("Max counter nesting depth: ", maxCounterDepth);
}
//
this(S,bool x)(Parser!(S,x) p)
{
if(__ctfe)//CTFE something funky going on with array
ir = p.ir.dup;
else
ir = p.ir;
dict = p.dict;
ngroup = p.groupStack.top;
maxCounterDepth = p.counterDepth;
flags = p.re_flags;
charsets = p.charsets;
tries = p.tries;
backrefed = p.backrefed;
lightPostprocess();
debug(fred_parser)
{
print();
}
debug validate();
}
}
//
@trusted uint lookupNamedGroup(String)(NamedGroup[] dict,String name)
{//equal is @system?
//@@@BUG@@@ assumeSorted kills "-inline"
//auto fnd = assumeSorted(map!"a.name"(dict)).lowerBound(name).length;
uint fnd;
for(fnd = 0; fnd<dict.length; fnd++)
if(equal(dict[fnd].name,name))
break;
enforce(fnd < dict.length, text("no submatch named ", name));
return dict[fnd].group;
}
//whether ch is one of unicode newline sequences
bool endOfLine(dchar front, bool seenCr)
{
return ((front == '\n') ^ seenCr) || front == '\r'
|| front == NEL || front == LS || front == PS;
}
//
bool startOfLine(dchar back, bool seenNl)
{
return ((back == '\r') ^ seenNl) || back == '\n'
|| back == NEL || back == LS || back == PS;
}
//Test if bytecode starting at pc in program 're' can match given codepoint
//Returns: length of matched atom if test is positive, 0 - can't tell, -1 if doesn't match
int quickTestFwd(RegEx)(uint pc, dchar front, const ref RegEx re)
{
static assert(IRL!(IR.OrChar) == 1);//used in code processing IR.OrChar
for(;;)
switch(re.ir[pc].code)
{
case IR.OrChar:
uint len = re.ir[pc].sequence;
uint end = pc + len;
if(re.ir[pc].data != front && re.ir[pc+1].data != front)
{
for(pc = pc+2; pc<end; pc++)
if(re.ir[pc].data == front)
break;
if(pc == end)
return -1;
}
return 0;
case IR.Char:
if(front == re.ir[pc].data)
return 0;
else
return -1;
case IR.Any:
return 0;
case IR.CodepointSet:
if(re.charsets[re.ir[pc].data].scanFor(front))
return 0;
else
return -1;
case IR.GroupStart, IR.GroupEnd:
pc += IRL!(IR.GroupStart);
break;
case IR.Trie:
if(re.tries[re.ir[pc].data][front])
return IRL!(IR.Trie);
else
return -1;
default:
return 0;
}
}
/*
Useful utility for self-testing, an infinite range of string samples
that _have_ to match given compiled regex.
Caveats: supports only a simple subset of bytecode.
*/
@trusted public struct SampleGenerator(Char)
{
import std.random;
const(Regex!Char) re;
Appender!(char[]) app;
uint limit, seed;
Xorshift gen;
//generator for pattern r, with soft maximum of threshold elements
//and a given random seed
this(in Regex!Char r, uint threshold, uint randomSeed)
{
re = r;
limit = threshold;
seed = randomSeed;
app = appender!(Char[])();
compose();
}
uint rand(uint x)
{
uint r = gen.front % x;
gen.popFront();
return r;
}
void compose()
{
uint pc = 0, counter = 0, dataLenOld = uint.max;
for(;;)
{
switch(re.ir[pc].code)
{
case IR.Char:
formattedWrite(app,"%s", cast(dchar)re.ir[pc].data);
pc += IRL!(IR.Char);
break;
case IR.OrChar:
uint len = re.ir[pc].sequence;
formattedWrite(app, "%s", cast(dchar)re.ir[pc + rand(len)].data);
pc += len;
break;
case IR.CodepointSet:
case IR.Trie:
auto set = re.charsets[re.ir[pc].data];
auto x = rand(set.ivals.length/2);
auto y = rand(set.ivals[x*2+1] - set.ivals[2*x]);
formattedWrite(app, "%s", cast(dchar)(set.ivals[2*x]+y));
pc += IRL!(IR.CodepointSet);
break;
case IR.Any:
uint x;
do
{
x = rand(0x11_000);
}while(x == '\r' || x == '\n' || !isValidDchar(x));
formattedWrite(app, "%s", cast(dchar)x);
pc += IRL!(IR.Any);
break;
case IR.GotoEndOr:
pc += IRL!(IR.GotoEndOr)+re.ir[pc].data;
assert(re.ir[pc].code == IR.OrEnd);
goto case;
case IR.OrEnd:
pc += IRL!(IR.OrEnd);
break;
case IR.OrStart:
pc += IRL!(IR.OrStart);
goto case;
case IR.Option:
uint next = pc + re.ir[pc].data + IRL!(IR.Option);
uint nOpt = 0;
//queue next Option
while(re.ir[next].code == IR.Option)
{
nOpt++;
next += re.ir[next].data + IRL!(IR.Option);
}
nOpt++;
nOpt = rand(nOpt);
for(;nOpt; nOpt--)
{
pc += re.ir[pc].data + IRL!(IR.Option);
}
assert(re.ir[pc].code == IR.Option);
pc += IRL!(IR.Option);
break;
case IR.RepeatStart:case IR.RepeatQStart:
pc += IRL!(IR.RepeatStart)+re.ir[pc].data;
goto case IR.RepeatEnd;
case IR.RepeatEnd:
case IR.RepeatQEnd:
uint len = re.ir[pc].data;
uint step = re.ir[pc+2].raw;
uint min = re.ir[pc+3].raw;
if(counter < min)
{
counter += step;
pc -= len;
break;
}
uint max = re.ir[pc+4].raw;
if(counter < max)
{
if(app.data.length < limit && rand(3) > 0)
{
pc -= len;
counter += step;
}
else
{
counter = counter%step;
pc += IRL!(IR.RepeatEnd);
}
}
else
{
counter = counter%step;
pc += IRL!(IR.RepeatEnd);
}
break;
case IR.InfiniteStart, IR.InfiniteQStart:
pc += re.ir[pc].data + IRL!(IR.InfiniteStart);
goto case IR.InfiniteEnd; //both Q and non-Q
case IR.InfiniteEnd:
case IR.InfiniteQEnd:
uint len = re.ir[pc].data;
if(app.data.length == dataLenOld)
{
pc += IRL!(IR.InfiniteEnd);
break;
}
dataLenOld = app.data.length;
if(app.data.length < limit && rand(3) > 0)
pc = pc - len;
else
pc = pc + IRL!(IR.InfiniteEnd);
break;
case IR.GroupStart, IR.GroupEnd:
pc += IRL!(IR.GroupStart);
break;
case IR.Bol, IR.Wordboundary, IR.Notwordboundary:
case IR.LookaheadStart, IR.NeglookaheadStart, IR.LookbehindStart, IR.NeglookbehindStart:
default:
return;
}
}
}
@property Char[] front()
{
return app.data;
}
@property empty(){ return false; }
void popFront()
{
app.shrinkTo(0);
compose();
}
}
/++
A $(D StaticRegex) is $(D Regex) object that contains specially
generated machine code to speed up matching.
Implicitly convertible to normal $(D Regex),
however doing so will result in loosing this additional capability.
+/
public struct StaticRegex(Char)
{
private:
alias BacktrackingMatcher!(true) Matcher;
alias bool function(ref Matcher!Char) MatchFn;
MatchFn nativeFn;
public:
Regex!Char _regex;
alias _regex this;
this(Regex!Char re, MatchFn fn)
{
_regex = re;
nativeFn = fn;
}
}
//utility for shiftOr, returns a minimum number of bytes to test in a Char
uint effectiveSize(Char)()
{
static if(is(Char == char))
return 1;
else static if(is(Char == wchar))
return 2;
else static if(is(Char == dchar))
return 3;
else
static assert(0);
}
/*
Kickstart engine using ShiftOr algorithm,
a bit parallel technique for inexact string searching.
*/
struct ShiftOr(Char)
{
private:
uint[] table;
uint fChar;
uint n_length;
enum charSize = effectiveSize!Char();
//maximum number of chars in CodepointSet to process
enum uint charsetThreshold = 32_000;
static struct ShiftThread
{
uint[] tab;
uint mask;
uint idx;
uint pc, counter, hops;
this(uint newPc, uint newCounter, uint[] table)
{
pc = newPc;
counter = newCounter;
mask = 1;
idx = 0;
hops = 0;
tab = table;
}
void setMask(uint idx, uint mask)
{
tab[idx] |= mask;
}
void setInvMask(uint idx, uint mask)
{
tab[idx] &= ~mask;
}
void set(alias setBits=setInvMask)(dchar ch)
{
static if(charSize == 3)
{
uint val = ch, tmask = mask;
setBits(val&0xFF, tmask);
tmask <<= 1;
val >>= 8;
setBits(val&0xFF, tmask);
tmask <<= 1;
val >>= 8;
assert(val <= 0x10);
setBits(val, tmask);
tmask <<= 1;
}
else
{
Char[dchar.sizeof/Char.sizeof] buf;
uint tmask = mask;
size_t total = encode(buf, ch);
for(size_t i=0; i<total; i++, tmask<<=1)
{
static if(charSize == 1)
setBits(buf[i], tmask);
else static if(charSize == 2)
{
setBits(buf[i]&0xFF, tmask);
tmask <<= 1;
setBits(buf[i]>>8, tmask);
}
}
}
}
void add(dchar ch){ return set!setInvMask(ch); }
void advance(uint s)
{
mask <<= s;
idx += s;
}
@property bool full(){ return !mask; }
}
static ShiftThread fork(ShiftThread t, uint newPc, uint newCounter)
{
ShiftThread nt = t;
nt.pc = newPc;
nt.counter = newCounter;
return nt;
}
@trusted static ShiftThread fetch(ref ShiftThread[] worklist)
{
auto t = worklist[$-1];
worklist.length -= 1;
if(!__ctfe)
worklist.assumeSafeAppend();
return t;
}
static uint charLen(uint ch)
{
assert(ch <= 0x10FFFF);
return codeLength!Char(cast(dchar)ch)*charSize;
}
public:
@trusted this(const ref Regex!Char re, uint[] memory)
{
assert(memory.length == 256);
fChar = uint.max;
L_FindChar:
for(size_t i = 0;;)
{
switch(re.ir[i].code)
{
case IR.Char:
fChar = re.ir[i].data;
static if(charSize != 3)
{
Char buf[dchar.sizeof/Char.sizeof];
encode(buf, fChar);
fChar = buf[0];
}
fChar = fChar & 0xFF;
break L_FindChar;
case IR.GroupStart, IR.GroupEnd:
i += IRL!(IR.GroupStart);
break;
case IR.Bol, IR.Wordboundary, IR.Notwordboundary:
i += IRL!(IR.Bol);
break;
default:
break L_FindChar;
}
}
table = memory;
table[] = uint.max;
ShiftThread[] trs;
ShiftThread t = ShiftThread(0, 0, table);
//locate first fixed char if any
n_length = 32;
for(;;)
{
L_Eval_Thread:
for(;;)
{
switch(re.ir[t.pc].code)
{
case IR.Char:
uint s = charLen(re.ir[t.pc].data);
if(t.idx+s > n_length)
goto L_StopThread;
t.add(re.ir[t.pc].data);
t.advance(s);
t.pc += IRL!(IR.Char);
break;
case IR.OrChar://assumes IRL!(OrChar) == 1
uint len = re.ir[t.pc].sequence;
uint end = t.pc + len;
uint[Bytecode.maxSequence] s;
uint numS;
for(uint i = 0; i<len; i++)
{
auto x = charLen(re.ir[t.pc+i].data);
if(countUntil(s[0..numS], x) < 0)
s[numS++] = x;
}
for(uint i = t.pc; i < end; i++)
{
t.add(re.ir[i].data);
}
for(uint i=0; i<numS; i++)
{
auto tx = fork(t, t.pc + len, t.counter);
if(tx.idx + s[i] <= n_length)
{
tx.advance(s[i]);
trs ~= tx;
}
}
if(!trs.empty)
t = fetch(trs);
else
goto L_StopThread;
break;
case IR.CodepointSet:
case IR.Trie:
auto set = re.charsets[re.ir[t.pc].data];
uint[4] s;
uint numS;
static if(charSize == 3)
{
s[0] = charSize;
numS = 1;
}
else
{
static if(charSize == 1)
static immutable codeBounds = [0x0, 0x7F, 0x80, 0x7FF, 0x800, 0xFFFF, 0x10000, 0x10FFFF];
else //== 2
static immutable codeBounds = [0x0, 0xFFFF, 0x10000, 0x10FFFF];
auto srange = assumeSorted!"a<=b"(set.ivals);
for(uint i = 0; i<codeBounds.length/2; i++)
{
auto start = srange.lowerBound(codeBounds[2*i]).length;
auto end = srange.lowerBound(codeBounds[2*i+1]).length;
if(end > start || (end == start && (end & 1)))
s[numS++] = (i+1)*charSize;
}
}
if(numS == 0 || t.idx + s[numS-1] > n_length)
goto L_StopThread;
auto chars = set.chars;
if(chars > charsetThreshold)
goto L_StopThread;
foreach(ch; set[])
{
//avoid surrogate pairs
if(0xD800 <= ch && ch <= 0xDFFF)
continue;
t.add(ch);
}
for(uint i=0; i<numS; i++)
{
auto tx = fork(t, t.pc + IRL!(IR.CodepointSet), t.counter);
tx.advance(s[i]);
trs ~= tx;
}
if(!trs.empty)
t = fetch(trs);
else
goto L_StopThread;
break;
case IR.Any:
goto L_StopThread;
case IR.GotoEndOr:
t.pc += IRL!(IR.GotoEndOr)+re.ir[t.pc].data;
assert(re.ir[t.pc].code == IR.OrEnd);
goto case;
case IR.OrEnd:
t.pc += IRL!(IR.OrEnd);
break;
case IR.OrStart:
t.pc += IRL!(IR.OrStart);
goto case;
case IR.Option:
uint next = t.pc + re.ir[t.pc].data + IRL!(IR.Option);
//queue next Option
if(re.ir[next].code == IR.Option)
{
trs ~= fork(t, next, t.counter);
}
t.pc += IRL!(IR.Option);
break;
case IR.RepeatStart:case IR.RepeatQStart:
t.pc += IRL!(IR.RepeatStart)+re.ir[t.pc].data;
goto case IR.RepeatEnd;
case IR.RepeatEnd:
case IR.RepeatQEnd:
uint len = re.ir[t.pc].data;
uint step = re.ir[t.pc+2].raw;
uint min = re.ir[t.pc+3].raw;
if(t.counter < min)
{
t.counter += step;
t.pc -= len;
break;
}
uint max = re.ir[t.pc+4].raw;
if(t.counter < max)
{
trs ~= fork(t, t.pc - len, t.counter + step);
t.counter = t.counter%step;
t.pc += IRL!(IR.RepeatEnd);
}
else
{
t.counter = t.counter%step;
t.pc += IRL!(IR.RepeatEnd);
}
break;
case IR.InfiniteStart, IR.InfiniteQStart:
t.pc += re.ir[t.pc].data + IRL!(IR.InfiniteStart);
goto case IR.InfiniteEnd; //both Q and non-Q
case IR.InfiniteEnd:
case IR.InfiniteQEnd:
uint len = re.ir[t.pc].data;
uint pc1, pc2; //branches to take in priority order
if(++t.hops == 32)
goto L_StopThread;
pc1 = t.pc + IRL!(IR.InfiniteEnd);
pc2 = t.pc - len;
trs ~= fork(t, pc2, t.counter);
t.pc = pc1;
break;
case IR.GroupStart, IR.GroupEnd:
t.pc += IRL!(IR.GroupStart);
break;
case IR.Bol, IR.Wordboundary, IR.Notwordboundary:
t.pc += IRL!(IR.Bol);
break;
case IR.LookaheadStart, IR.NeglookaheadStart, IR.LookbehindStart, IR.NeglookbehindStart:
t.pc += IRL!(IR.LookaheadStart) + IRL!(IR.LookaheadEnd) + re.ir[t.pc].data;
break;
default:
L_StopThread:
assert(re.ir[t.pc].code >= 0x80);
debug (fred_search) writeln("ShiftOr stumbled on ",re.ir[t.pc].mnemonic);
n_length = min(t.idx, n_length);
break L_Eval_Thread;
}
}
if(trs.empty)
break;
t = fetch(trs);
}
debug(fred_search)
{
writeln("Min length: ", n_length);
}
}
@property bool empty() const { return n_length == 0; }
@property uint length() const{ return n_length/charSize; }
// lookup compatible bit pattern in haystack, return starting index
// has a useful trait: if supplied with valid UTF indexes,
// returns only valid UTF indexes
// (that given the haystack in question is valid UTF string)
@trusted size_t search(const(Char)[] haystack, size_t idx)
{
assert(!empty);
auto p = cast(const(ubyte)*)(haystack.ptr+idx);
uint state = uint.max;
uint limit = 1u<<(n_length - 1u);
debug(fred_search) writefln("Limit: %32b",limit);
if(fChar != uint.max)
{
const(ubyte)* end = cast(ubyte*)(haystack.ptr + haystack.length);
const orginalAlign = cast(size_t)p & (Char.sizeof-1);
while(p != end)
{
if(!~state)
{
for(;;)
{
p = cast(ubyte*)memchr(p, fChar, end - p);
if(!p)
return haystack.length;
if((cast(size_t)p & (Char.sizeof-1)) == orginalAlign)
break;
if(++p == end)
return haystack.length;
}
state = ~1u;
assert((cast(size_t)p & (Char.sizeof-1)) == orginalAlign);
static if(charSize == 3)
{
state = (state<<1) | table[p[1]];
state = (state<<1) | table[p[2]];
p += 3;
}
}
//first char is already tested, see if that's all
if(!(state & limit))//division rounds down for dchar
return (p-cast(ubyte*)haystack.ptr)/Char.sizeof
-length+1;
static if(charSize == 3)
{
state = (state<<1) | table[p[1]];
state = (state<<1) | table[p[2]];
state = (state<<1) | table[p[3]];
p+=4;
}
else
{
state = (state<<1) | table[p[1]];
p++;
}
debug(fred_search) writefln("State: %32b", state);
}
}
else
{
//in this path we have to shift first
static if(charSize == 3)
{
const(ubyte)* end = cast(ubyte*)(haystack.ptr + haystack.length);
while(p != end)
{
state = (state<<1) | table[p[0]];
state = (state<<1) | table[p[1]];
state = (state<<1) | table[p[2]];
p += 4;
if(!(state & limit))//division rounds down for dchar
return (p-cast(ubyte*)haystack.ptr)/Char.sizeof
-length;
}
}
else
{
auto len = cast(ubyte*)(haystack.ptr + haystack.length) - p;
size_t i = 0;
if(len & 1)
{
state = (state<<1) | table[p[i++]];
if(!(state & limit))
return idx+i/Char.sizeof-length;
}
while(i<len)
{
state = (state<<1) | table[p[i++]];
if(!(state & limit))
return idx+i/Char.sizeof
-length;
state = (state<<1) | table[p[i++]];
if(!(state & limit))
return idx+i/Char.sizeof
-length;
debug(fred_search) writefln("State: %32b", state);
}
}
}
return haystack.length;
}
@system debug static void dump(uint[] table)
{//@@@BUG@@@ writef(ln) is @system
import std.stdio;
for(size_t i=0; i<table.length; i+=4)
{
writefln("%32b %32b %32b %32b",table[i], table[i+1], table[i+2], table[i+3]);
}
}
}
unittest
{
@trusted void test_fixed(alias Kick)()
{
foreach(i, v; TypeTuple!(char, wchar, dchar))
{
alias v Char;
alias immutable(v)[] String;
auto r = regex(to!String(`abc$`));
auto kick = Kick!Char(r, new uint[256]);
assert(kick.length == 3, text(Kick.stringof," ",v.stringof, " == ", kick.length));
auto r2 = regex(to!String(`(abc){2}a+`));
kick = Kick!Char(r2, new uint[256]);
assert(kick.length == 7, text(Kick.stringof,v.stringof," == ", kick.length));
auto r3 = regex(to!String(`\b(a{2}b{3}){2,4}`));
kick = Kick!Char(r3, new uint[256]);
assert(kick.length == 10, text(Kick.stringof,v.stringof," == ", kick.length));
auto r4 = regex(to!String(`\ba{2}c\bxyz`));
kick = Kick!Char(r4, new uint[256]);
assert(kick.length == 6, text(Kick.stringof,v.stringof, " == ", kick.length));
auto r5 = regex(to!String(`\ba{2}c\b`));
kick = Kick!Char(r5, new uint[256]);
size_t x = kick.search("aabaacaa", 0);
assert(x == 3, text(Kick.stringof,v.stringof," == ", kick.length));
x = kick.search("aabaacaa", x+1);
assert(x == 8, text(Kick.stringof,v.stringof," == ", kick.length));
}
}
@trusted void test_flex(alias Kick)()
{
foreach(i, v;TypeTuple!(char, wchar, dchar))
{
alias v Char;
alias immutable(v)[] String;
auto r = regex(to!String(`abc[a-z]`));
auto kick = Kick!Char(r, new uint[256]);
auto x = kick.search(to!String("abbabca"), 0);
assert(x == 3, text("real x is ", x, " ",v.stringof));
auto r2 = regex(to!String(`(ax|bd|cdy)`));
String s2 = to!String("abdcdyabax");
kick = Kick!Char(r2, new uint[256]);
x = kick.search(s2, 0);
assert(x == 1, text("real x is ", x));
x = kick.search(s2, x+1);
assert(x == 3, text("real x is ", x));
x = kick.search(s2, x+1);
assert(x == 8, text("real x is ", x));
auto rdot = regex(to!String(`...`));
kick = Kick!Char(rdot, new uint[256]);
assert(kick.length == 0);
auto rN = regex(to!String(`a(b+|c+)x`));
kick = Kick!Char(rN, new uint[256]);
assert(kick.length == 3);
assert(kick.search("ababx",0) == 2);
assert(kick.search("abaacba",0) == 3);//expected inexact
}
}
test_fixed!(ShiftOr)();
test_flex!(ShiftOr)();
}
alias ShiftOr Kickstart;
//Simple UTF-string abstraction compatible with stream interface
struct Input(Char)
if(is(Char :dchar))
{
alias size_t DataIndex;
alias const(Char)[] String;
String _origin;
size_t _index;
//constructs Input object out of plain string
this(String input, size_t idx=0)
{
_origin = input;
_index = idx;
}
//codepoint at current stream position
bool nextChar(ref dchar res, ref size_t pos)
{
if(_index == _origin.length)
return false;
pos = _index;
res = std.utf.decode(_origin, _index);
return true;
}
@property bool atEnd(){
return _index==_origin.length;
}
bool search(Kickstart)(ref Kickstart kick, ref dchar res, ref size_t pos)
{
size_t idx = kick.search(_origin, _index);
_index = idx;
return nextChar(res, pos);
}
//index of at End position
@property size_t lastIndex(){ return _origin.length; }
//support for backtracker engine, might not be present
void reset(size_t index){ _index = index; }
String opSlice(size_t start, size_t end){ return _origin[start..end]; }
struct BackLooper
{
alias size_t DataIndex;
String _origin;
size_t _index;
this(Input input)
{
_origin = input._origin;
_index = input._index;
}
@trusted bool nextChar(ref dchar res,ref size_t pos)
{
if(_index == 0)
return false;
_index -= std.utf.strideBack(_origin, _index);
if(_index == 0)
return false;
pos = _index;
res = _origin[0.._index].back;
return true;
}
@property atEnd(){ return _index==0 || _index==std.utf.strideBack(_origin, _index); }
@property auto loopBack(){ return Input(_origin, _index); }
//support for backtracker engine, might not be present
void reset(size_t index){ _index = index+std.utf.stride(_origin, index); }
String opSlice(size_t start, size_t end){ return _origin[end..start]; }
//index of at End position
@property size_t lastIndex(){ return 0; }
}
@property auto loopBack(){ return BackLooper(this); }
}
// Test stream against simple UTF-string stream abstraction (w/o normalization and such)
struct StreamTester(Char)
if (is(Char:dchar))
{
alias ulong DataIndex;
alias const(Char)[] String;
Input!(Char) refStream;
String allStr;
StreamCBuf!(Char) stream;
size_t[] splits;
size_t pos;
//adds the next chunk to the stream
bool addNextChunk()
{
if(splits.length<pos)
{
++pos;
if(pos<splits.length)
{
assert(splits[pos-1]<=splits[pos],"splits is not ordered");
stream.addChunk(allStr[splits[pos-1]..splits[pos]]);
}
else
{
stream.addChunk(allStr[splits[pos-1]..$]);
stream.hasEnd=true;
}
return true;
}
else
return false;
}
//constructs Input object out of plain string
this(String input, size_t[] splits)
{
allStr=input;
refStream=Input!(Char)(input,splits);
stream=new StreamCBuf!(Char)();
pos=0;
if (splits.length) {
stream.addChunk(allStr);
stream.hasEnd=true;
}
else
stream.addChunk(allStr[0..splits[0]]);
}
//codepoint at current stream position
bool nextChar(ref dchar res, ref size_t pos)
{
bool ret=stream.nextChar(res,pos);
dchar refRes;
size_t refPos;
if(!res)
{
if (stream.hasEnd && refStream.nextChar(refRes,refPos))
{
throw new Exception("stream eneded too early");
}
return false;
}
else
{
bool refRet=refStream.nextChar(refRes,refPos);
enforce(refRet==ret,"stream contiinued past end");
enforce(refRes==res,"incorrect char "~res~" vs "~refRes);
enforce(refPos==(pos &~(255UL<<48)),"incorrect pos, string wans't normalized???");
return true;
}
}
@property bool atEnd()
{
enforce(!stream.atEnd || refStream.atEnd,"stream ended too early");
return stream.atEnd;
}
bool search(Kickstart)(ref Kickstart kick, ref dchar res, ref ulong pos)
{
bool ret=stream.search(kick,res,pos);
dchar refRes;
size_t refPos;
if(ret)
{
bool refRet=refStream.search(kick,refRes,refPos);
enforce(refRet,"stream found spurious kickstart match");
enforce(refRes==res,"stream found different kickstart match "~res~" vs "~refRes);
enforce(refPos==(pos &~(255UL<<48)),"stream found different pos for kickstart match, non normalized input?: "~to!string(pos)~" vs "~to!string(refPos));
}
else if(hasEnd)
{
enforce(!refStream.search(kick,refRes,refPos),"stream missed kickstart match");
}
return ret;
}
//index of at End position
@property size_t lastIndex(){ return _origin.length; }
String opSlice(size_t start, size_t end)
{
return _origin[start..end];
}
struct BackLooper
{
alias ulong DataIndex;
Input!(Char).BackLooper refBacklooper;
StreamCBuf!(Char).BackLooper backlooper;
ulong startPos;
this(Input!(Char).BackLooper refBacklooper,StreamCBuf!(Char).BackLooper backlooper)
{
this.refBacklooper=refBacklooper;
this.backlooper=backlooper;
}
bool nextChar(ref dchar res,ref ulong pos)
{
bool ret=backlooper.nextChar(res,pos);
if(ret)
{
dchar refRes;
size_t refPos;
bool refRet=refBacklooper.nextChar(refRes,refPos);
enforce(refRet,"stream backlooper goes back beyond start");
enforce(refRes==res,"stream backlooper has different char "~res~" vs "~refRes);
enforce(refPos==(pos &~(255UL<<48)),"stream backlooper has different pos: "~to!string(pos)~" vs "~to!string(refPos));
}
else if (refBacklooper.nextChar(refPos,refPos))
{
enforce(refPos+historySize<=(startPos &~(255UL<<48)),"stream backlooper stopped before historyWindow");
}
return ret;
}
@property atEnd(){
if(backlooper.atEnd)
{
dchar res;
size_t pos;
if (refBacklooper.nextChar(res,pos))
{
// this should be mostly true for already normalized/decoded stuff
enforce(pos+backlooper.streamBuf.historySize<=(startPos &~(255UL<<48)),"backlooper stream ended too early");
}
}
else
{
enforce(backlooper.atEnd,"backlooper stream did not end");
}
return backlooper.atEnd;
}
@property auto loopBack(){ return Input(_origin, _index); }
//support for backtracker engine, might not be present
void reset(size_t index){ _index = index+std.utf.stride(_origin, index); }
String opSlice(size_t start, size_t end){ return _origin[end..start]; }
//index of at End position
@property size_t lastIndex(){ return 0; }
}
@property auto loopBack(){ return BackLooper(this); }
}
//both helperd below are internal, on its own are quite "explosive"
//unsafe, no initialization of elements
@system T[] mallocArray(T)(size_t len)
{
return (cast(T*)malloc(len*T.sizeof))[0..len];
}
//very unsafe, no initialization
@system T[] arrayInChunk(T)(size_t len, ref void[] chunk)
{
auto ret = (cast(T*)chunk.ptr)[0..len];
chunk = chunk[len*T.sizeof..$];
return ret;
}
/+
BacktrackingMatcher implements backtracking scheme of matching
regular expressions.
+/
template BacktrackingMatcher(bool CTregex)
{
@trusted struct BacktrackingMatcher(Char, Stream=Input!Char)
if(is(Char : dchar))
{
alias Stream.DataIndex DataIndex;
struct State
{//top bit in pc is set if saved along with matches
DataIndex index;
uint pc, counter, infiniteNesting;
}
static assert(State.sizeof % size_t.sizeof == 0);
enum stateSize = State.sizeof / size_t.sizeof;
enum initialStack = 1<<16;
alias const(Char)[] String;
static if(CTregex)
alias StaticRegex!Char RegEx;
else
alias Regex!Char RegEx;
RegEx re; //regex program
//Stream state
Stream s;
DataIndex index;
dchar front;
bool exhausted;
//backtracking machine state
uint pc, counter;
DataIndex lastState = 0; //top of state stack
DataIndex[] trackers;
static if(!CTregex)
uint infiniteNesting;
size_t[] memory;
//local slice of matches, global for backref
Group!DataIndex[] matches, backrefed;
static if(__traits(hasMember,Stream, "search"))
{
enum kicked = true;
}
else
enum kicked = false;
static size_t initialMemory(const ref RegEx re)
{
return (re.ngroup+1)*DataIndex.sizeof //trackers
+ stackSize(re)*size_t.sizeof;
}
static size_t stackSize(const ref RegEx re)
{
return initialStack*(stateSize + re.ngroup*(Group!DataIndex).sizeof/size_t.sizeof)+1;
}
@property bool atStart(){ return index == 0; }
@property bool atEnd(){ return index == s.lastIndex && s.atEnd; }
void next()
{
if(!s.nextChar(front, index))
index = s.lastIndex;
}
void search()
{
static if(kicked)
{
if(!s.search(re.kickstart, front, index))
{
index = s.lastIndex;
}
}
else
next();
}
//
void newStack()
{
auto chunk = mallocArray!(size_t)(stackSize(re));
chunk[0] = cast(size_t)(memory.ptr);
memory = chunk[1..$];
}
void initialize(ref RegEx program, Stream stream, void[] memBlock)
{
re = program;
s = stream;
exhausted = false;
trackers = arrayInChunk!(DataIndex)(re.ngroup+1, memBlock);
memory = cast(size_t[])memBlock;
memory[0] = 0; //hidden pointer
memory = memory[1..$];
backrefed = null;
}
//
this(ref RegEx program, Stream stream, void[] memBlock)
{
initialize(program, stream, memBlock);
next();
}
//
this(ref RegEx program, Stream stream, void[] memBlock, dchar ch, DataIndex idx)
{
initialize(program, stream, memBlock);
front = ch;
index = idx;
}
//
bool matchFinalize()
{
size_t start = index;
if(matchImpl())
{//stream is updated here
matches[0].begin = start;
matches[0].end = index;
if(!(re.flags & RegexOption.global) || atEnd)
exhausted = true;
if(start == index)//empty match advances input
next();
return true;
}
else
return false;
}
//lookup next match, fill matches with indices into input
bool match(Group!DataIndex matches[])
{
debug(fred_matching)
{
writeln("------------------------------------------");
}
if(exhausted) //all matches collected
return false;
this.matches = matches;
if(re.flags & RegexInfo.oneShot)
{
exhausted = true;
DataIndex start = index;
auto m = matchImpl();
if(m)
{
matches[0].begin = start;
matches[0].end = index;
}
return m;
}
static if(kicked)
auto searchFn = re.kickstart.empty ? &this.next :&this.search;
else
auto searchFn = &this.next;
for(;;)
{
if(matchFinalize())
return true;
else
{
if(atEnd)
break;
searchFn();
if(atEnd)
{
exhausted = true;
return matchFinalize();
}
}
}
exhausted = true;
return false;
}
/+
match subexpression against input,
results are stored in matches
+/
bool matchImpl()
{
static if(CTregex && is(typeof(re.nativeFn(this))))
{
if(re.nativeFn)
{
version(fred_ct) debug writeln("using C-T matcher");
return re.nativeFn(this);
}
}
else
{
pc = 0;
counter = 0;
lastState = 0;
infiniteNesting = -1;//intentional
auto start = s._index;
debug(fred_matching)
writeln("Try match starting at ", s[index..s.lastIndex]);
for(;;)
{
debug(fred_matching)
writefln("PC: %s\tCNT: %s\t%s \tfront: %s src: %s"
, pc, counter, disassemble(re.ir, pc, re.dict)
, front, s._index);
switch(re.ir[pc].code)
{
case IR.OrChar://assumes IRL!(OrChar) == 1
if(atEnd)
goto L_backtrack;
uint len = re.ir[pc].sequence;
uint end = pc + len;
if(re.ir[pc].data != front && re.ir[pc+1].data != front)
{
for(pc = pc+2; pc<end; pc++)
if(re.ir[pc].data == front)
break;
if(pc == end)
goto L_backtrack;
}
pc = end;
next();
break;
case IR.Char:
if(atEnd || front != re.ir[pc].data)
goto L_backtrack;
pc += IRL!(IR.Char);
next();
break;
case IR.Any:
if(atEnd || (!(re.flags & RegexOption.singleline)
&& (front == '\r' || front == '\n')))
goto L_backtrack;
pc += IRL!(IR.Any);
next();
break;
case IR.CodepointSet:
if(atEnd || !re.charsets[re.ir[pc].data].scanFor(front))
goto L_backtrack;
next();
pc += IRL!(IR.CodepointSet);
break;
case IR.Trie:
if(atEnd || !re.tries[re.ir[pc].data][front])
goto L_backtrack;
next();
pc += IRL!(IR.Trie);
break;
case IR.Wordboundary:
dchar back;
DataIndex bi;
//at start & end of input
if(atStart && wordTrie[front])
{
pc += IRL!(IR.Wordboundary);
break;
}
else if(atEnd && s.loopBack.nextChar(back, bi)
&& wordTrie[back])
{
pc += IRL!(IR.Wordboundary);
break;
}
else if(s.loopBack.nextChar(back, index))
{
bool af = wordTrie[front];
bool ab = wordTrie[back];
if(af ^ ab)
{
pc += IRL!(IR.Wordboundary);
break;
}
}
goto L_backtrack;
case IR.Notwordboundary:
dchar back;
DataIndex bi;
//at start & end of input
if(atStart && wordTrie[front])
goto L_backtrack;
else if(atEnd && s.loopBack.nextChar(back, bi)
&& wordTrie[back])
goto L_backtrack;
else if(s.loopBack.nextChar(back, index))
{
bool af = wordTrie[front];
bool ab = wordTrie[back];
if(af ^ ab)
goto L_backtrack;
}
pc += IRL!(IR.Wordboundary);
break;
case IR.Bol:
dchar back;
DataIndex bi;
if(atStart)
pc += IRL!(IR.Bol);
else if((re.flags & RegexOption.multiline)
&& s.loopBack.nextChar(back,bi)
&& endOfLine(back, front == '\n'))
{
pc += IRL!(IR.Bol);
}
else
goto L_backtrack;
break;
case IR.Eol:
dchar back;
DataIndex bi;
debug(fred_matching) writefln("EOL (front 0x%x) %s", front, s[index..s.lastIndex]);
//no matching inside \r\n
if(atEnd || ((re.flags & RegexOption.multiline)
&& s.loopBack.nextChar(back,bi)
&& endOfLine(front, back == '\r')))
{
pc += IRL!(IR.Eol);
}
else
goto L_backtrack;
break;
case IR.InfiniteStart, IR.InfiniteQStart:
trackers[infiniteNesting+1] = index;
pc += re.ir[pc].data + IRL!(IR.InfiniteStart);
//now pc is at end IR.Infininite(Q)End
uint len = re.ir[pc].data;
int test;
if(re.ir[pc].code == IR.InfiniteEnd)
{
test = quickTestFwd(pc+IRL!(IR.InfiniteEnd), front, re);
if(test >= 0)
pushState(pc+IRL!(IR.InfiniteEnd), counter);
infiniteNesting++;
pc -= len;
}
else
{
test = quickTestFwd(pc - len, front, re);
if(test >= 0)
{
infiniteNesting++;
pushState(pc - len, counter);
infiniteNesting--;
}
pc += IRL!(IR.InfiniteEnd);
}
break;
case IR.RepeatStart, IR.RepeatQStart:
pc += re.ir[pc].data + IRL!(IR.RepeatStart);
break;
case IR.RepeatEnd:
case IR.RepeatQEnd:
//len, step, min, max
uint len = re.ir[pc].data;
uint step = re.ir[pc+2].raw;
uint min = re.ir[pc+3].raw;
uint max = re.ir[pc+4].raw;
if(counter < min)
{
counter += step;
pc -= len;
}
else if(counter < max)
{
if(re.ir[pc].code == IR.RepeatEnd)
{
pushState(pc + IRL!(IR.RepeatEnd), counter%step);
counter += step;
pc -= len;
}
else
{
pushState(pc - len, counter + step);
counter = counter%step;
pc += IRL!(IR.RepeatEnd);
}
}
else
{
counter = counter%step;
pc += IRL!(IR.RepeatEnd);
}
break;
case IR.InfiniteEnd:
case IR.InfiniteQEnd:
uint len = re.ir[pc].data;
debug(fred_matching) writeln("Infinited nesting:", infiniteNesting);
assert(infiniteNesting < trackers.length);
if(trackers[infiniteNesting] == index)
{//source not consumed
pc += IRL!(IR.InfiniteEnd);
infiniteNesting--;
break;
}
else
trackers[infiniteNesting] = index;
int test;
if(re.ir[pc].code == IR.InfiniteEnd)
{
test = quickTestFwd(pc+IRL!(IR.InfiniteEnd), front, re);
if(test >= 0)
{
infiniteNesting--;
pushState(pc + IRL!(IR.InfiniteEnd), counter);
infiniteNesting++;
}
pc -= len;
}
else
{
test = quickTestFwd(pc-len, front, re);
if(test >= 0)
pushState(pc-len, counter);
pc += IRL!(IR.InfiniteEnd);
infiniteNesting--;
}
break;
case IR.OrEnd:
pc += IRL!(IR.OrEnd);
break;
case IR.OrStart:
pc += IRL!(IR.OrStart);
goto case;
case IR.Option:
uint len = re.ir[pc].data;
if(re.ir[pc+len].code == IR.GotoEndOr)//not a last one
{
pushState(pc + len + IRL!(IR.Option), counter); //remember 2nd branch
}
pc += IRL!(IR.Option);
break;
case IR.GotoEndOr:
pc = pc + re.ir[pc].data + IRL!(IR.GotoEndOr);
break;
case IR.GroupStart:
uint n = re.ir[pc].data;
matches[n].begin = index;
debug(fred_matching) writefln("IR group #%u starts at %u", n, index);
pc += IRL!(IR.GroupStart);
break;
case IR.GroupEnd:
uint n = re.ir[pc].data;
matches[n].end = index;
debug(fred_matching) writefln("IR group #%u ends at %u", n, index);
pc += IRL!(IR.GroupEnd);
break;
case IR.LookaheadStart:
case IR.NeglookaheadStart:
uint len = re.ir[pc].data;
auto save = index;
uint ms = re.ir[pc+1].raw, me = re.ir[pc+2].raw;
auto mem = malloc(initialMemory(re))[0..initialMemory(re)];
scope(exit) free(mem.ptr);
auto matcher = BacktrackingMatcher(re, s, mem, front, index);
matcher.matches = matches[ms .. me];
matcher.backrefed = backrefed.empty ? matches : backrefed;
matcher.re.ir = re.ir[pc+IRL!(IR.LookaheadStart) .. pc+IRL!(IR.LookaheadStart)+len+IRL!(IR.LookaheadEnd)];
bool match = matcher.matchImpl() ^ (re.ir[pc].code == IR.NeglookaheadStart);
s.reset(save);
next();
if(!match)
goto L_backtrack;
else
{
pc += IRL!(IR.LookaheadStart)+len+IRL!(IR.LookaheadEnd);
}
break;
case IR.LookbehindStart:
case IR.NeglookbehindStart:
uint len = re.ir[pc].data;
uint ms = re.ir[pc+1].raw, me = re.ir[pc+2].raw;
auto mem = malloc(initialMemory(re))[0..initialMemory(re)];
scope(exit) free(mem.ptr);
auto backMatcher = BacktrackingMatcher!(Char, typeof(s.loopBack))(re, s.loopBack, mem);
backMatcher.matches = matches[ms .. me];
backMatcher.re.ir = re.ir[pc .. pc+IRL!(IR.LookbehindStart)+len];
backMatcher.backrefed = backrefed.empty ? matches : backrefed;
bool match = backMatcher.matchBackImpl() ^ (re.ir[pc].code == IR.NeglookbehindStart);
if(!match)
goto L_backtrack;
else
{
pc += IRL!(IR.LookbehindStart)+len+IRL!(IR.LookbehindEnd);
}
break;
case IR.Backref:
uint n = re.ir[pc].data;
auto referenced = re.ir[pc].localRef
? s[matches[n].begin .. matches[n].end]
: s[backrefed[n].begin .. backrefed[n].end];
while(!atEnd && !referenced.empty && front == referenced.front)
{
next();
referenced.popFront();
}
if(referenced.empty)
pc++;
else
goto L_backtrack;
break;
case IR.Nop:
pc += IRL!(IR.Nop);
break;
case IR.LookaheadEnd:
case IR.NeglookaheadEnd:
case IR.End:
return true;
default:
assert(0);
L_backtrack:
if(!popState())
{
s.reset(start);
return false;
}
}
}
}
assert(0);
}
@property size_t stackAvail()
{
return memory.length - lastState;
}
bool prevStack()
{
size_t* prev = memory.ptr-1;
prev = cast(size_t*)*prev;//take out hidden pointer
if(!prev)
return false;
free(memory.ptr);//last segment is freed in RegexMatch
immutable size = initialStack*(stateSize + 2*re.ngroup);
memory = prev[0..size];
lastState = size;
return true;
}
void stackPush(T)(T val)
if(!isDynamicArray!T)
{
*cast(T*)&memory[lastState] = val;
enum delta = (T.sizeof+size_t.sizeof/2)/size_t.sizeof;
lastState += delta;
debug(fred_matching) writeln("push element SP= ", lastState);
}
void stackPush(T)(T[] val)
{
static assert(T.sizeof % size_t.sizeof == 0);
(cast(T*)&memory[lastState])[0..val.length]
= val[0..$];
lastState += val.length*(T.sizeof/size_t.sizeof);
debug(fred_matching) writeln("push array SP= ", lastState);
}
void stackPop(T)(ref T val)
if(!isDynamicArray!T)
{
enum delta = (T.sizeof+size_t.sizeof/2)/size_t.sizeof;
lastState -= delta;
val = *cast(T*)&memory[lastState];
debug(fred_matching) writeln("pop element SP= ", lastState);
}
void stackPop(T)(ref T[] val)
{
lastState -= val.length*(T.sizeof/size_t.sizeof);
val[0..$] = (cast(T*)&memory[lastState])[0..val.length];
debug(fred_matching) writeln("pop array SP= ", lastState);
}
static if(!CTregex)
{
//helper function, saves engine state
void pushState(uint pc, uint counter)
{
if(stateSize + matches.length > stackAvail)
{
newStack();
lastState = 0;
}
*cast(State*)&memory[lastState] =
State(index, pc, counter, infiniteNesting);
lastState += stateSize;
memory[lastState..lastState+2*matches.length] = cast(size_t[])matches[];
lastState += 2*matches.length;
debug(fred_matching)
writefln("Saved(pc=%s) front: %s src: %s"
, pc, front, s[index..s.lastIndex]);
}
//helper function, restores engine state
bool popState()
{
if(!lastState)
return prevStack();
lastState -= 2*matches.length;
auto pm = cast(size_t[])matches;
pm[] = memory[lastState .. lastState+2*matches.length];
lastState -= stateSize;
State* state = cast(State*)&memory[lastState];
index = state.index;
pc = state.pc;
counter = state.counter;
infiniteNesting = state.infiniteNesting;
debug(fred_matching)
{
writefln("Restored matches", front, s[index .. s.lastIndex]);
foreach(i, m; matches)
writefln("Sub(%d) : %s..%s", i, m.begin, m.end);
}
s.reset(index);
next();
debug(fred_matching)
writefln("Backtracked (pc=%s) front: %s src: %s"
, pc, front, s[index..s.lastIndex]);
return true;
}
/+
Match subexpression against input, executing re.ir backwards.
Results are stored in matches
+/
bool matchBackImpl()
{
pc = cast(uint)re.ir.length-1;
counter = 0;
lastState = 0;
infiniteNesting = -1;//intentional
auto start = index;
debug(fred_matching)
writeln("Try matchBack at ",retro(s[index..s.lastIndex]));
for(;;)
{
debug(fred_matching)
writefln("PC: %s\tCNT: %s\t%s \tfront: %s src: %s"
, pc, counter, disassemble(re.ir, pc, re.dict)
, front, retro(s[index..s.lastIndex]));
switch(re.ir[pc].code)
{
case IR.OrChar://assumes IRL!(OrChar) == 1
if(atEnd)
goto L_backtrack;
uint len = re.ir[pc].sequence;
uint end = pc - len;
if(re.ir[pc].data != front && re.ir[pc-1].data != front)
{
for(pc = pc-2; pc>end; pc--)
if(re.ir[pc].data == front)
break;
if(pc == end)
goto L_backtrack;
}
pc = end;
next();
break;
case IR.Char:
if(atEnd || front != re.ir[pc].data)
goto L_backtrack;
pc--;
next();
break;
case IR.Any:
if(atEnd || (!(re.flags & RegexOption.singleline)
&& (front == '\r' || front == '\n')))
goto L_backtrack;
pc--;
next();
break;
case IR.CodepointSet:
if(atEnd || !re.charsets[re.ir[pc].data].scanFor(front))
goto L_backtrack;
next();
pc--;
break;
case IR.Trie:
if(atEnd || !re.tries[re.ir[pc].data][front])
goto L_backtrack;
next();
pc--;
break;
case IR.Wordboundary:
dchar back;
DataIndex bi;
//at start & end of input
if(atStart && wordTrie[front])
{
pc--;
break;
}
else if(atEnd && s.loopBack.nextChar(back, bi)
&& wordTrie[back])
{
pc--;
break;
}
else if(s.loopBack.nextChar(back, index))
{
bool af = wordTrie[front];
bool ab = wordTrie[back];
if(af ^ ab)
{
pc--;
break;
}
}
goto L_backtrack;
case IR.Notwordboundary:
dchar back;
DataIndex bi;
//at start & end of input
if(atStart && wordTrie[front])
goto L_backtrack;
else if(atEnd && s.loopBack.nextChar(back, bi)
&& wordTrie[back])
goto L_backtrack;
else if(s.loopBack.nextChar(back, index))
{
bool af = wordTrie[front];
bool ab = wordTrie[back];
if(af ^ ab)
goto L_backtrack;
}
pc--;
break;
case IR.Bol:
dchar back;
DataIndex bi;
if(atStart)
pc--;
else if((re.flags & RegexOption.multiline)
&& s.loopBack.nextChar(back,bi)
&& endOfLine(back, front == '\n'))
{
pc--;
}
else
goto L_backtrack;
break;
case IR.Eol:
dchar back;
DataIndex bi;
debug(fred_matching)
writefln("EOL (front 0x%x) %s", front, s[index..s.lastIndex]);
//no matching inside \r\n
if((re.flags & RegexOption.multiline)
&& s.loopBack.nextChar(back,bi)
&& endOfLine(front, back == '\r'))
{
pc -= IRL!(IR.Eol);
}
else
goto L_backtrack;
break;
case IR.InfiniteStart, IR.InfiniteQStart:
uint len = re.ir[pc].data;
assert(infiniteNesting < trackers.length);
if(trackers[infiniteNesting] == index)
{//source not consumed
pc--; //out of loop
infiniteNesting--;
break;
}
else
trackers[infiniteNesting] = index;
if(re.ir[pc].code == IR.InfiniteStart)//greedy
{
infiniteNesting--;
pushState(pc-1, counter);//out of loop
infiniteNesting++;
pc += len;
}
else
{
pushState(pc+len, counter);
pc--;
infiniteNesting--;
}
break;
case IR.InfiniteEnd:
case IR.InfiniteQEnd://now it's a start
uint len = re.ir[pc].data;
trackers[infiniteNesting+1] = index;
pc -= len+IRL!(IR.InfiniteStart);
assert(re.ir[pc].code == IR.InfiniteStart
|| re.ir[pc].code == IR.InfiniteQStart);
debug(fred_matching)
writeln("(backmatch) Infinite nesting:", infiniteNesting);
if(re.ir[pc].code == IR.InfiniteStart)//greedy
{
pushState(pc-1, counter);
infiniteNesting++;
pc += len;
}
else
{
infiniteNesting++;
pushState(pc + len, counter);
infiniteNesting--;
pc--;
}
break;
case IR.RepeatStart, IR.RepeatQStart:
uint len = re.ir[pc].data;
uint tail = pc + len + 1;
uint step = re.ir[tail+2].raw;
uint min = re.ir[tail+3].raw;
uint max = re.ir[tail+4].raw;
if(counter < min)
{
counter += step;
pc += len;
}
else if(counter < max)
{
if(re.ir[pc].code == IR.RepeatStart)//greedy
{
pushState(pc-1, counter%step);
counter += step;
pc += len;
}
else
{
pushState(pc + len, counter + step);
counter = counter%step;
pc--;
}
}
else
{
counter = counter%step;
pc--;
}
break;
case IR.RepeatEnd:
case IR.RepeatQEnd:
pc -= re.ir[pc].data+IRL!(IR.RepeatStart);
assert(re.ir[pc].code == IR.RepeatStart || re.ir[pc].code == IR.RepeatQStart);
goto case IR.RepeatStart;
case IR.OrEnd:
uint len = re.ir[pc].data;
pc -= len;
assert(re.ir[pc].code == IR.Option);
len = re.ir[pc].data;
auto pc_save = pc+len-1;
pc = pc + len + IRL!(IR.Option);
while(re.ir[pc].code == IR.Option)
{
pushState(pc-IRL!(IR.GotoEndOr)-1, counter);
len = re.ir[pc].data;
pc += len + IRL!(IR.Option);
}
assert(re.ir[pc].code == IR.OrEnd);
pc--;
if(pc != pc_save)
{
pushState(pc, counter);
pc = pc_save;
}
break;
case IR.OrStart:
assert(0);
case IR.Option:
assert(re.ir[pc].code == IR.Option);
pc += re.ir[pc].data + IRL!(IR.Option);
if(re.ir[pc].code == IR.Option)
{
pc--;//hackish, assumes size of IR.Option == 1
if(re.ir[pc].code == IR.GotoEndOr)
{
pc += re.ir[pc].data + IRL!(IR.GotoEndOr);
}
}
assert(re.ir[pc].code == IR.OrEnd);
pc -= re.ir[pc].data + IRL!(IR.OrStart)+1;
break;
case IR.GotoEndOr:
assert(0);
case IR.GroupStart:
uint n = re.ir[pc].data;
matches[n].begin = index;
debug(fred_matching) writefln("IR group #%u starts at %u", n, index);
pc --;
break;
case IR.GroupEnd:
uint n = re.ir[pc].data;
matches[n].end = index;
debug(fred_matching) writefln("IR group #%u ends at %u", n, index);
pc --;
break;
case IR.LookaheadStart:
case IR.NeglookaheadStart:
assert(0);
case IR.LookaheadEnd:
case IR.NeglookaheadEnd:
uint len = re.ir[pc].data;
pc -= len + IRL!(IR.LookaheadStart);
uint ms = re.ir[pc+1].raw, me = re.ir[pc+2].raw;
auto mem = malloc(initialMemory(re))[0..initialMemory(re)];
scope(exit) free(mem.ptr);
auto matcher = BacktrackingMatcher!(Char, typeof(s.loopBack))(re, s.loopBack, mem);
matcher.matches = matches[ms .. me];
matcher.backrefed = backrefed.empty ? matches : backrefed;
matcher.re.ir = re.ir[pc+IRL!(IR.LookaheadStart) .. pc+IRL!(IR.LookaheadStart)+len+IRL!(IR.LookaheadEnd)];
bool match = matcher.matchImpl() ^ (re.ir[pc].code == IR.NeglookaheadStart);
if(!match)
goto L_backtrack;
else
{
pc --;
}
break;
case IR.LookbehindEnd:
case IR.NeglookbehindEnd:
uint len = re.ir[pc].data;
pc -= len + IRL!(IR.LookbehindStart);
auto save = index;
uint ms = re.ir[pc+1].raw, me = re.ir[pc+2].raw;
auto mem = malloc(initialMemory(re))[0..initialMemory(re)];
scope(exit) free(mem.ptr);
auto matcher = BacktrackingMatcher(re, s, mem, front, index);
matcher.re.ngroup = me - ms;
matcher.matches = matches[ms .. me];
matcher.backrefed = backrefed.empty ? matches : backrefed;
matcher.re.ir = re.ir[pc .. pc+IRL!(IR.LookbehindStart)+len];
bool match = matcher.matchBackImpl() ^ (re.ir[pc].code == IR.NeglookbehindStart);
s.reset(save);
next();
if(!match)
goto L_backtrack;
else
{
pc --;
}
break;
case IR.Backref:
uint n = re.ir[pc].data;
auto referenced = re.ir[pc].localRef
? s[matches[n].begin .. matches[n].end]
: s[backrefed[n].begin .. backrefed[n].end];
while(!atEnd && !referenced.empty && front == referenced.front)
{
next();
referenced.popFront();
}
if(referenced.empty)
pc--;
else
goto L_backtrack;
break;
case IR.Nop:
pc --;
break;
case IR.LookbehindStart:
case IR.NeglookbehindStart:
return true;
default:
assert(re.ir[pc].code < 0x80);
pc --; //data
break;
L_backtrack:
if(!popState())
{
s.reset(start);
return false;
}
}
}
return true;
}
}
}
}
//very shitty string formatter, $$ replaced with next argument converted to string
@trusted string ctSub( U...)(string format, U args)
{
bool seenDollar;
foreach(i, ch; format)
{
if(ch == '$')
{
if(seenDollar)
{
static if(args.length > 0)
{
return format[0..i-1] ~ to!string(args[0])
~ ctSub(format[i+1..$], args[1..$]);
}
else
assert(0);
}
else
seenDollar = true;
}
else
seenDollar = false;
}
return format;
}
//generate code for TypeTuple(S, S+1, S+2, ... E)
@system string ctGenSeq(int S, int E)
{
string s = "alias TypeTuple!(";
if(S < E)
s ~= to!string(S);
for(int i=S+1; i<E;i++)
{
s ~= ", ";
s ~= to!string(i);
}
return s ~") Sequence;";
}
//alias to TypeTuple(S, S+1, S+2, ... E)
template Sequence(int S, int E)
{
mixin(ctGenSeq(S,E));
}
struct CtContext
{
//dirty flags
bool counter, infNesting;
int nInfLoops; // to make a unique advancement counter per loop
int match, total_matches;
//state of codegenerator
struct CtState
{
string code;
int addr;
}
this(Char)(Regex!Char re)
{
match = 1;
total_matches = re.ngroup;
}
//restore state having current context
string restoreCode()
{
string text;
//stack is checked in L_backtrack
text ~= counter
? "
stackPop(counter);"
: "
counter = 0;";
if(match < total_matches)
{
text ~= ctSub("
stackPop(matches[1..$$]);", match);
text ~= ctSub("
matches[$$..$] = typeof(matches[0]).init;", match);
}
else
text ~= "
stackPop(matches[1..$]);";
return text;
}
//save state having current context
string saveCode(uint pc, string count_expr="counter")
{
string text = ctSub("
if(stackAvail < $$*(Group!(DataIndex)).sizeof/size_t.sizeof + $$)
{
newStack();
lastState = 0;
}", match-1, cast(int)counter + 2);
if(match < total_matches)
text ~= ctSub("
stackPush(matches[1..$$]);", match);
else
text ~= "
stackPush(matches[1..$]);";
text ~= counter ? ctSub("
stackPush($$);", count_expr) : "";
text ~= ctSub("
stackPush(index); stackPush($$); \n", pc);
return text;
}
//
CtState ctGenBlock(Bytecode[] ir, int addr)
{
CtState result;
result.addr = addr;
while(!ir.empty)
{
auto n = ctGenGroup(ir, result.addr);
result.code ~= n.code;
result.addr = n.addr;
}
return result;
}
//
CtState ctGenGroup(ref Bytecode[] ir, int addr)
{
CtState r;
assert(!ir.empty);
switch(ir[0].code)
{
case IR.InfiniteStart, IR.InfiniteQStart, IR.RepeatStart, IR.RepeatQStart:
bool infLoop =
ir[0].code == IR.InfiniteStart || ir[0].code == IR.InfiniteQStart;
infNesting = infNesting || infLoop;
if(infLoop)
nInfLoops++;
counter = counter ||
ir[0].code == IR.RepeatStart || ir[0].code == IR.RepeatQStart;
uint len = ir[0].data;
auto nir = ir[ir[0].length .. ir[0].length+len];
r = ctGenBlock(nir, addr+1);
//start/end codegen
//r.addr is at last test+ jump of loop, addr+1 is body of loop
nir = ir[ir[0].length+len..$];
r.code = ctGenFixupCode(ir[0..ir[0].length], addr, r.addr) ~ r.code;
r.code ~= ctGenFixupCode(nir, r.addr, addr+1);
r.addr += 2; //account end instruction + restore state
ir = nir;
break;
case IR.OrStart:
uint len = ir[0].data;
auto nir = ir[ir[0].length .. ir[0].length+len];
r = ctGenAlternation(nir, addr);
ir = ir[ir[0].length+len..$];
assert(ir[0].code == IR.OrEnd);
ir = ir[ir[0].length..$];
break;
default:
assert(ir[0].isAtom, text(ir[0].mnemonic));
r = ctGenAtom(ir, addr);
}
return r;
}
//generate source for bytecode contained in OrStart ... OrEnd
CtState ctGenAlternation(Bytecode[] ir, int addr)
{
CtState[] pieces;
CtState r;
enum optL = IRL!(IR.Option);
for(;;)
{
assert(ir[0].code == IR.Option);
auto len = ir[0].data;
auto nir = ir[optL .. optL+len-IRL!(IR.GotoEndOr)];
if(optL+len < ir.length && ir[optL+len].code == IR.Option)//not a last option
{
r = ctGenBlock(nir, addr+2);//space for Option + restore state
//r.addr+1 to account GotoEndOr at end of branch
r.code = ctGenFixupCode(ir[0 .. ir[0].length], addr, r.addr+1) ~ r.code;
addr = r.addr+1;//leave space for GotoEndOr
pieces ~= r;
ir = ir[optL+len..$];
}
else
{
pieces ~= ctGenBlock(ir[optL..$], addr);
addr = pieces[$-1].addr;
break;
}
}
r = pieces[0];
for(uint i=1; i<pieces.length; i++)
{
r.code ~= ctSub(`
case $$:
goto case $$; `, pieces[i-1].addr, addr);
r.code ~= pieces[i].code;
}
r.addr = addr;
return r;
}
// generate fixup code for instruction in ir,
// fixup means it has an alternative way for control flow
string ctGenFixupCode(ref Bytecode[] ir, int addr, int fixup)
{
string r;
string testCode;
r = ctSub(`
case $$: debug(fred_matching) writeln("$$");`,
addr, addr);
switch(ir[0].code)
{
case IR.InfiniteStart, IR.InfiniteQStart:
r ~= ctSub( `
tracker_$$ = DataIndex.max;
goto case $$;`, nInfLoops-1, fixup);
ir = ir[ir[0].length..$];
break;
case IR.InfiniteEnd:
testCode = ctQuickTest(ir[IRL!(IR.InfiniteEnd)..$],addr+1);
r ~= ctSub( `
if(tracker_$$ == index)
{//source not consumed
goto case $$;
}
tracker_$$ = index;
$$
{
$$
}
goto case $$;
case $$: //restore state and go out of loop
$$
goto case;`, nInfLoops-1, addr+2
, nInfLoops-1, testCode, saveCode(addr+1)
, fixup, addr+1, restoreCode());
ir = ir[ir[0].length..$];
break;
case IR.InfiniteQEnd:
testCode = ctQuickTest(ir[IRL!(IR.InfiniteEnd)..$],addr+1);
r ~= ctSub( `
if(tracker_$$ == index)
{//source not consumed
goto case $$;
}
tracker_$$ = index;
$$
{
$$
goto case $$;
}
else
goto case $$;
case $$://restore state and go inside loop
$$
goto case $$;`, nInfLoops-1, addr+2, nInfLoops-1
, testCode, saveCode(addr+1)
, addr+2, fixup, addr+1, restoreCode(), fixup);
ir = ir[ir[0].length..$];
break;
case IR.RepeatStart, IR.RepeatQStart:
r ~= ctSub( `
goto case $$;`, fixup);
ir = ir[ir[0].length..$];
break;
case IR.RepeatEnd, IR.RepeatQEnd:
//len, step, min, max
uint len = ir[0].data;
uint step = ir[2].raw;
uint min = ir[3].raw;
uint max = ir[4].raw;
r ~= ctSub(`
if(counter < $$)
{
debug(fred_matching) writeln("RepeatEnd min case pc=", $$);
counter += $$;
goto case $$;
}`, min, addr, step, fixup);
if(ir[0].code == IR.RepeatEnd)
{
string counter_expr = ctSub("counter % $$", step);
r ~= ctSub(`
else if(counter < $$)
{
$$
counter += $$;
goto case $$;
}`, max, saveCode(addr+1, counter_expr), step, fixup);
}
else
{
string counter_expr = ctSub("counter % $$", step);
r ~= ctSub(`
else if(counter < $$)
{
$$
counter = counter % $$;
goto case $$;
}`, max, saveCode(addr+1,counter_expr), step, addr+2);
}
r ~= ctSub(`
else
{
counter = counter % $$;
goto case $$;
}
case $$: //restore state
$$
goto case $$;`, step, addr+2, addr+1, restoreCode()
, ir[0].code == IR.RepeatEnd ? addr+2 : fixup );
ir = ir[ir[0].length..$];
break;
case IR.Option:
r ~= ctSub( `
{
$$
}
goto case $$;
case $$://restore thunk to go to the next group
$$
goto case $$;`, saveCode(addr+1), addr+2
, addr+1, restoreCode(), fixup);
ir = ir[ir[0].length..$];
break;
default:
assert(0, text(ir[0].mnemonic));
}
return r;
}
string ctQuickTest(Bytecode[] ir, int id)
{
uint pc=0;
while(pc < ir.length && ir[pc].isAtom)
{
if(ir[pc].code == IR.GroupStart || ir[pc].code == IR.GroupEnd)
{
pc++;
}
else
{
auto code = ctAtomCode(ir[pc..$], -1);
return ctSub(`
int test_$$()
{
$$ //$$
}
if(test_$$() >= 0)`, id, code ? code : "return 0;"
, ir[pc].mnemonic, id);
}
}
return "";
}
//process & generate source for simple bytecodes at front of ir using address addr
CtState ctGenAtom(ref Bytecode[] ir, int addr)
{
CtState result;
result.code = ctAtomCode(ir, addr);
ir.popFrontN(ir[0].code == IR.OrChar ? ir[0].sequence : ir[0].length);
result.addr = addr + 1;
return result;
}
//D code for atom at ir using address addr, addr < 0 means quickTest
string ctAtomCode(Bytecode[] ir, int addr)
{
string code;
string bailOut, nextInstr;
if(addr < 0)
{
bailOut = "return -1;";
nextInstr = "return 0;";
}
else
{
bailOut = "goto L_backtrack;";
nextInstr = ctSub("goto case $$;", addr+1);
code ~= ctSub( `
case $$: debug(fred_matching) writeln("#$$");
`, addr, addr);
}
switch(ir[0].code)
{
case IR.OrChar://assumes IRL!(OrChar) == 1
code ~= ctSub(`
if(atEnd)
$$`, bailOut);
uint len = ir[0].sequence;
for(uint i = 0; i<len; i++)
{
code ~= ctSub( `
if(front == $$)
{
$$
$$
}`, ir[i].data, addr >= 0 ? "next();" :"", nextInstr);
}
code ~= ctSub( `
$$`, bailOut);
break;
case IR.Char:
code ~= ctSub( `
if(atEnd || front != $$)
$$
$$
$$`, ir[0].data, bailOut, addr >= 0 ? "next();" :"", nextInstr);
break;
case IR.Any:
code ~= ctSub( `
if(atEnd || (!(re.flags & RegexOption.singleline)
&& (front == '\r' || front == '\n')))
$$
$$
$$`, bailOut, addr >= 0 ? "next();" :"",nextInstr);
break;
case IR.CodepointSet:
code ~= ctSub( `
if(atEnd || !re.charsets[$$].scanFor(front))
$$
$$
$$`, ir[0].data, bailOut, addr >= 0 ? "next();" :"", nextInstr);
break;
case IR.Trie:
code ~= ctSub( `
if(atEnd || !re.tries[$$][front])
$$
$$
$$`, ir[0].data, bailOut, addr >= 0 ? "next();" :"", nextInstr);
break;
case IR.Wordboundary:
code ~= ctSub( `
dchar back;
DataIndex bi;
if(atStart && wordTrie[front])
{
$$
}
else if(atEnd && s.loopBack.nextChar(back, bi)
&& wordTrie[back])
{
$$
}
else if(s.loopBack.nextChar(back, bi))
{
bool af = wordTrie[front];
bool ab = wordTrie[back];
if(af ^ ab)
{
$$
}
}
$$`
, nextInstr, nextInstr, nextInstr, bailOut);
break;
case IR.Notwordboundary:
code ~= ctSub( `
dchar back;
DataIndex bi;
//at start & end of input
if(atStart && wordTrie[front])
$$
else if(atEnd && s.loopBack.nextChar(back, bi)
&& wordTrie[back])
$$
else if(s.loopBack.nextChar(back, index))
{
bool af = wordTrie[front];
bool ab = wordTrie[back];
if(af ^ ab)
$$
}
$$`, bailOut, bailOut, bailOut, nextInstr);
break;
case IR.Bol:
code ~= ctSub(`
dchar back;
DataIndex bi;
if(atStart || ((re.flags & RegexOption.multiline)
&& s.loopBack.nextChar(back,bi)
&& endOfLine(back, front == '\n')))
{
$$
}
else
$$`, nextInstr, bailOut);
break;
case IR.Eol:
code ~= ctSub(`
dchar back;
DataIndex bi;
debug(fred_matching) writefln("EOL (front 0x%x) %s", front, s[index..s.lastIndex]);
//no matching inside \r\n
if(atEnd || ((re.flags & RegexOption.multiline)
&& s.loopBack.nextChar(back,bi)
&& endOfLine(front, back == '\r')))
{
$$
}
else
$$`, nextInstr, bailOut);
break;
case IR.GroupStart:
code ~= ctSub(`
matches[$$].begin = index;
$$`, ir[0].data, nextInstr);
match = ir[0].data+1;
break;
case IR.GroupEnd:
code ~= ctSub(`
matches[$$].end = index;
$$`, ir[0].data, nextInstr);
break;
case IR.Backref:
string mStr = ir[0].localRef
? ctSub("matches[$$].begin .. matches[$$].end];", ir[0].data, ir[0].data)
: ctSub("s[backrefed[$$].begin .. backrefed[$$].end];",ir[0].data, ir[0].data);
code ~= ctSub( `
$$
while(!atEnd && !referenced.empty && front == referenced.front)
{
next();
referenced.popFront();
}
if(referenced.empty)
$$
else
$$`, mStr, nextInstr, bailOut);
break;
case IR.Nop:
case IR.End:
break;
default:
assert(0, text(ir[0].mnemonic, "is not supported yet"));
}
return code;
}
//generate D code for the whole regex
public string ctGenRegEx(Char)(ref Regex!Char re)
{
auto bdy = ctGenBlock(re.ir, 0);
auto r = `
with(matcher)
{
pc = 0;
counter = 0;
lastState = 0;
auto start = s._index;`;
for(int i=0; i<nInfLoops; i++)
r ~= ctSub(`
size_t tracker_$$;`, i);
r ~= `
goto StartLoop;
debug(fred_matching) writeln("Try CT matching starting at ",s[index..s.lastIndex]);
L_backtrack:
if(lastState || prevStack())
{
stackPop(pc);
stackPop(index);
s.reset(index);
next();
}
else
{
s.reset(start);
return false;
}
StartLoop:
switch(pc)
{
`;
r ~= bdy.code;
r ~= ctSub(`
case $$: break;`,bdy.addr);
r ~= `
default:
assert(0);
}
return true;
}
`;
return r;
}
}
string ctGenRegExCode(Char)(Regex!Char re)
{
auto context = CtContext(re);
return context.ctGenRegEx(re);
}
//State of VM thread
struct Thread(DataIndex)
{
Thread* next; //intrusive linked list
uint pc;
uint counter; //loop counter
uint uopCounter; //counts micro operations inside one macro instruction (e.g. BackRef)
Group!DataIndex[1] matches;
}
//head-tail singly-linked list
struct ThreadList(DataIndex)
{
Thread!DataIndex* tip=null, toe=null;
//add new thread to the start of list
void insertFront(Thread!DataIndex* t)
{
if(tip)
{
t.next = tip;
tip = t;
}
else
{
t.next = null;
tip = toe = t;
}
}
//add new thread to the end of list
void insertBack(Thread!DataIndex* t)
{
if(toe)
{
toe.next = t;
toe = t;
}
else
tip = toe = t;
toe.next = null;
}
//move head element out of list
Thread!DataIndex* fetch()
{
auto t = tip;
if(tip == toe)
tip = toe = null;
else
tip = tip.next;
return t;
}
//non-destructive iteration of ThreadList
struct ThreadRange
{
const(Thread!DataIndex)* ct;
this(ThreadList tlist){ ct = tlist.tip; }
@property bool empty(){ return ct is null; }
@property const(Thread!DataIndex)* front(){ return ct; }
@property popFront()
{
assert(ct);
ct = ct.next;
}
}
@property bool empty()
{
return tip == null;
}
ThreadRange opSlice()
{
return ThreadRange(this);
}
}
//direction parameter for thompson one-shot match evaluator
enum OneShot { Fwd, Bwd };
/+
Thomspon matcher does all matching in lockstep,
never looking at the same char twice
+/
@trusted struct ThompsonMatcher(Char, Stream=Input!Char)
if(is(Char : dchar))
{
alias Stream.DataIndex DataIndex;
alias const(Char)[] String;
enum threadAllocSize = 16;
Thread!DataIndex* freelist;
ThreadList!DataIndex clist, nlist;
DataIndex[] merge;
Group!DataIndex[] backrefed;
Regex!Char re; //regex program
Stream s;
dchar front;
DataIndex index;
DataIndex genCounter; //merge trace counter, goes up on every dchar
size_t threadSize;
bool matched;
bool exhausted;
static if(__traits(hasMember,Stream, "search"))
{
enum kicked = true;
}
else
enum kicked = false;
static size_t getThreadSize(const ref Regex!Char re)
{
return re.ngroup
? (Thread!DataIndex).sizeof + (re.ngroup-1)*(Group!DataIndex).sizeof
: (Thread!DataIndex).sizeof - (Group!DataIndex).sizeof;
}
static size_t initialMemory(const ref Regex!Char re)
{
return getThreadSize(re)*re.threadCount + re.hotspotTableSize*size_t.sizeof;
}
//true if it's start of input
@property bool atStart(){ return index == 0; }
//true if it's end of input
@property bool atEnd(){ return index == s.lastIndex && s.atEnd; }
bool next()
{
if(!s.nextChar(front, index))
{
index = s.lastIndex;
return false;
}
return true;
}
static if(kicked)
{
bool search()
{
if(!s.search(re.kickstart, front, index))
{
index = s.lastIndex;
return false;
}
return true;
}
}
this()(Regex!Char program, Stream stream, void[] memory)
{
re = program;
s = stream;
threadSize = getThreadSize(re);
prepareFreeList(re.threadCount, memory);
if(re.hotspotTableSize)
{
merge = arrayInChunk!(DataIndex)(re.hotspotTableSize, memory);
merge[] = 0;
}
genCounter = 0;
}
this(S)(ref ThompsonMatcher!(Char,S) matcher, Bytecode[] piece, Stream stream)
{
s = stream;
re = matcher.re;
re.ir = piece;
threadSize = matcher.threadSize;
merge = matcher.merge;
genCounter = matcher.genCounter;
freelist = matcher.freelist;
}
this(this)
{
merge[] = 0;
debug(fred_allocation) writeln("ThompsonVM postblit!");
//free list is efectively shared ATM
}
enum MatchResult{
NoMatch,
PartialMatch,
Match,
}
//match the input and fill matches
bool match(Group!DataIndex[] matches)
{
debug(fred_matching)
writeln("------------------------------------------");
if(exhausted)
{
return false;
}
if(re.flags & RegexInfo.oneShot)
{
next();
exhausted = true;
return matchOneShot!(OneShot.Fwd)(matches)==MatchResult.Match;
}
static if(kicked)
auto searchFn = re.kickstart.empty ? &this.next : &this.search;
else
auto searchFn = &this.next;
if((!matched) && clist.empty)
{
searchFn();
}
else//char in question is fetched in prev call to match
{
matched = false;
}
if(!atEnd)//if no char
for(;;)
{
genCounter++;
debug(fred_matching)
{
writefln("Threaded matching threads at %s", s[index..s.lastIndex]);
foreach(t; clist[])
{
assert(t);
writef("pc=%s ",t.pc);
write(t.matches);
writeln();
}
}
for(Thread!DataIndex* t = clist.fetch(); t; t = clist.fetch())
{
eval!true(t, matches);
}
if(!matched)//if we already have match no need to push the engine
eval!true(createStart(index), matches);//new thread staring at this position
else if(nlist.empty)
{
debug(fred_matching) writeln("Stopped matching before consuming full input");
break;//not a partial match for sure
}
clist = nlist;
nlist = (ThreadList!DataIndex).init;
if(clist.tip is null)
{
if(!searchFn())
break;
}
else if(!next()){
if (!atEnd) return false;
exhausted = true;
break;
}
}
else
exhausted = true;
genCounter++; //increment also on each end
debug(fred_matching) writefln("Threaded matching threads at end");
//try out all zero-width posibilities
for(Thread!DataIndex* t = clist.fetch(); t; t = clist.fetch())
{
eval!false(t, matches);
}
if(!matched)
eval!false(createStart(index), matches);//new thread starting at end of input
if(matched && !(re.flags & RegexOption.global))
exhausted = true;
return matched;
}
/+
handle succesful threads
+/
void finish(const(Thread!DataIndex)* t, Group!DataIndex[] matches)
{
matches.ptr[0..re.ngroup] = t.matches.ptr[0..re.ngroup];
debug(fred_matching)
{
writef("FOUND pc=%s prog_len=%s",
t.pc, re.ir.length);
if(!matches.empty)
writefln(": %s..%s", matches[0].begin, matches[0].end);
foreach(v; matches)
writefln("%d .. %d", v.begin, v.end);
}
matched = true;
}
/+
match thread against codepoint, cutting trough all 0-width instructions
and taking care of control flow, then add it to nlist
+/
void eval(bool withInput)(Thread!DataIndex* t, Group!DataIndex[] matches)
{
ThreadList!DataIndex worklist;
debug(fred_matching) writeln("Evaluating thread");
for(;;)
{
debug(fred_matching)
{
writef("\tpc=%s [", t.pc);
foreach(x; worklist[])
writef(" %s ", x.pc);
writeln("]");
}
switch(re.ir[t.pc].code)
{
case IR.End:
finish(t, matches);
matches[0].end = index; //fix endpoint of the whole match
recycle(t);
//cut off low priority threads
recycle(clist);
recycle(worklist);
debug(fred_matching) writeln("Finished thread ", matches);
return;
case IR.Wordboundary:
dchar back;
DataIndex bi;
//at start & end of input
if(atStart && wordTrie[front])
{
t.pc += IRL!(IR.Wordboundary);
break;
}
else if(atEnd && s.loopBack.nextChar(back, bi)
&& wordTrie[back])
{
t.pc += IRL!(IR.Wordboundary);
break;
}
else if(s.loopBack.nextChar(back, index))
{
bool af = wordTrie[front];
bool ab = wordTrie[back];
if(af ^ ab)
{
t.pc += IRL!(IR.Wordboundary);
break;
}
}
recycle(t);
t = worklist.fetch();
if(!t)
return;
break;
case IR.Notwordboundary:
dchar back;
DataIndex bi;
//at start & end of input
if(atStart && wordTrie[front])
{
recycle(t);
t = worklist.fetch();
if(!t)
return;
break;
}
else if(atEnd && s.loopBack.nextChar(back, bi)
&& wordTrie[back])
{
recycle(t);
t = worklist.fetch();
if(!t)
return;
break;
}
else if(s.loopBack.nextChar(back, index))
{
bool af = wordTrie[front];
bool ab = wordTrie[back] != 0;
if(af ^ ab)
{
recycle(t);
t = worklist.fetch();
if(!t)
return;
break;
}
}
t.pc += IRL!(IR.Wordboundary);
break;
case IR.Bol:
dchar back;
DataIndex bi;
if(atStart
||( (re.flags & RegexOption.multiline)
&& s.loopBack.nextChar(back,bi)
&& startOfLine(back, front == '\n')))
{
t.pc += IRL!(IR.Bol);
}
else
{
recycle(t);
t = worklist.fetch();
if(!t)
return;
}
break;
case IR.Eol:
debug(fred_matching) writefln("EOL (front 0x%x) %s", front, s[index..s.lastIndex]);
dchar back;
DataIndex bi;
//no matching inside \r\n
if(atEnd || ((re.flags & RegexOption.multiline)
&& endOfLine(front, s.loopBack.nextChar(back, bi)
&& back == '\r')))
{
t.pc += IRL!(IR.Eol);
}
else
{
recycle(t);
t = worklist.fetch();
if(!t)
return;
}
break;
case IR.InfiniteStart, IR.InfiniteQStart:
t.pc += re.ir[t.pc].data + IRL!(IR.InfiniteStart);
goto case IR.InfiniteEnd; //both Q and non-Q
case IR.RepeatStart, IR.RepeatQStart:
t.pc += re.ir[t.pc].data + IRL!(IR.RepeatStart);
goto case IR.RepeatEnd; //both Q and non-Q
case IR.RepeatEnd:
case IR.RepeatQEnd:
//len, step, min, max
uint len = re.ir[t.pc].data;
uint step = re.ir[t.pc+2].raw;
uint min = re.ir[t.pc+3].raw;
if(t.counter < min)
{
t.counter += step;
t.pc -= len;
break;
}
if(merge[re.ir[t.pc + 1].raw+t.counter] < genCounter)
{
debug(fred_matching) writefln("A thread(pc=%s) passed there : %s ; GenCounter=%s mergetab=%s",
t.pc, index, genCounter, merge[re.ir[t.pc + 1].raw+t.counter] );
merge[re.ir[t.pc + 1].raw+t.counter] = genCounter;
}
else
{
debug(fred_matching) writefln("A thread(pc=%s) got merged there : %s ; GenCounter=%s mergetab=%s",
t.pc, index, genCounter, merge[re.ir[t.pc + 1].raw+t.counter] );
recycle(t);
t = worklist.fetch();
if(!t)
return;
break;
}
uint max = re.ir[t.pc+4].raw;
if(t.counter < max)
{
if(re.ir[t.pc].code == IR.RepeatEnd)
{
//queue out-of-loop thread
worklist.insertFront(fork(t, t.pc + IRL!(IR.RepeatEnd), t.counter % step));
t.counter += step;
t.pc -= len;
}
else
{
//queue into-loop thread
worklist.insertFront(fork(t, t.pc - len, t.counter + step));
t.counter %= step;
t.pc += IRL!(IR.RepeatEnd);
}
}
else
{
t.counter %= step;
t.pc += IRL!(IR.RepeatEnd);
}
break;
case IR.InfiniteEnd:
case IR.InfiniteQEnd:
if(merge[re.ir[t.pc + 1].raw+t.counter] < genCounter)
{
debug(fred_matching) writefln("A thread(pc=%s) passed there : %s ; GenCounter=%s mergetab=%s",
t.pc, index, genCounter, merge[re.ir[t.pc + 1].raw+t.counter] );
merge[re.ir[t.pc + 1].raw+t.counter] = genCounter;
}
else
{
debug(fred_matching) writefln("A thread(pc=%s) got merged there : %s ; GenCounter=%s mergetab=%s",
t.pc, index, genCounter, merge[re.ir[t.pc + 1].raw+t.counter] );
recycle(t);
t = worklist.fetch();
if(!t)
return;
break;
}
uint len = re.ir[t.pc].data;
uint pc1, pc2; //branches to take in priority order
if(re.ir[t.pc].code == IR.InfiniteEnd)
{
pc1 = t.pc - len;
pc2 = t.pc + IRL!(IR.InfiniteEnd);
}
else
{
pc1 = t.pc + IRL!(IR.InfiniteEnd);
pc2 = t.pc - len;
}
static if(withInput)
{
int test = quickTestFwd(pc1, front, re);
if(test > 0)
{
nlist.insertBack(fork(t, pc1 + test, t.counter));
t.pc = pc2;
}
else if(test == 0)
{
worklist.insertFront(fork(t, pc2, t.counter));
t.pc = pc1;
}
else
t.pc = pc2;
}
else
{
worklist.insertFront(fork(t, pc2, t.counter));
t.pc = pc1;
}
break;
case IR.OrEnd:
if(merge[re.ir[t.pc + 1].raw+t.counter] < genCounter)
{
debug(fred_matching) writefln("A thread(pc=%s) passed there : %s ; GenCounter=%s mergetab=%s",
t.pc, s[index..s.lastIndex], genCounter, merge[re.ir[t.pc + 1].raw+t.counter] );
merge[re.ir[t.pc + 1].raw+t.counter] = genCounter;
t.pc += IRL!(IR.OrEnd);
}
else
{
debug(fred_matching) writefln("A thread(pc=%s) got merged there : %s ; GenCounter=%s mergetab=%s",
t.pc, s[index..s.lastIndex], genCounter, merge[re.ir[t.pc + 1].raw+t.counter] );
recycle(t);
t = worklist.fetch();
if(!t)
return;
}
break;
case IR.OrStart:
t.pc += IRL!(IR.OrStart);
goto case;
case IR.Option:
uint next = t.pc + re.ir[t.pc].data + IRL!(IR.Option);
//queue next Option
if(re.ir[next].code == IR.Option)
{
worklist.insertFront(fork(t, next, t.counter));
}
t.pc += IRL!(IR.Option);
break;
case IR.GotoEndOr:
t.pc = t.pc + re.ir[t.pc].data + IRL!(IR.GotoEndOr);
goto case IR.OrEnd;
case IR.GroupStart:
uint n = re.ir[t.pc].data;
t.matches.ptr[n].begin = index;
t.pc += IRL!(IR.GroupStart);
break;
case IR.GroupEnd:
uint n = re.ir[t.pc].data;
t.matches.ptr[n].end = index;
t.pc += IRL!(IR.GroupEnd);
break;
case IR.Backref:
uint n = re.ir[t.pc].data;
Group!DataIndex* source = re.ir[t.pc].localRef ? t.matches.ptr : backrefed.ptr;
assert(source);
if(source[n].begin == source[n].end)//zero-width Backref!
{
t.pc += IRL!(IR.Backref);
}
else static if(withInput)
{
size_t idx = source[n].begin + t.uopCounter;
size_t end = source[n].end;
if(s[idx..end].front == front)
{
t.uopCounter += std.utf.stride(s[idx..end], 0);
if(t.uopCounter + source[n].begin == source[n].end)
{//last codepoint
t.pc += IRL!(IR.Backref);
t.uopCounter = 0;
}
nlist.insertBack(t);
}
else
recycle(t);
t = worklist.fetch();
if(!t)
return;
break;
}
else
{
recycle(t);
t = worklist.fetch();
if(!t)
return;
break;
}
break;
case IR.LookbehindStart:
case IR.NeglookbehindStart:
auto matcher =
ThompsonMatcher!(Char, typeof(s.loopBack))
(this, re.ir[t.pc..t.pc+re.ir[t.pc].data+IRL!(IR.LookbehindStart)], s.loopBack);
matcher.re.ngroup = re.ir[t.pc+2].raw - re.ir[t.pc+1].raw;
matcher.backrefed = backrefed.empty ? t.matches : backrefed;
//backMatch
matcher.next(); //load first character from behind
bool match = (matcher.matchOneShot!(OneShot.Bwd)(t.matches)==MatchResult.Match) ^ (re.ir[t.pc].code == IR.LookbehindStart);
freelist = matcher.freelist;
genCounter = matcher.genCounter;
if(match)
{
recycle(t);
t = worklist.fetch();
if(!t)
return;
break;
}
else
t.pc += re.ir[t.pc].data + IRL!(IR.LookbehindStart) + IRL!(IR.LookbehindEnd);
break;
case IR.LookaheadEnd:
case IR.NeglookaheadEnd:
t.pc = re.ir[t.pc].indexOfPair(t.pc);
assert(re.ir[t.pc].code == IR.LookaheadStart || re.ir[t.pc].code == IR.NeglookaheadStart);
uint ms = re.ir[t.pc+1].raw, me = re.ir[t.pc+2].raw;
finish(t, matches.ptr[ms..me]);
recycle(t);
//cut off low priority threads
recycle(clist);
recycle(worklist);
return;
case IR.LookaheadStart:
case IR.NeglookaheadStart:
auto save = index;
uint len = re.ir[t.pc].data;
uint ms = re.ir[t.pc+1].raw, me = re.ir[t.pc+2].raw;
bool positive = re.ir[t.pc].code == IR.LookaheadStart;
auto matcher = ThompsonMatcher(this, re.ir[t.pc .. t.pc+len+IRL!(IR.LookaheadEnd)+IRL!(IR.LookaheadStart)], s);
matcher.front = front;
matcher.index = index;
matcher.re.ngroup = me - ms;
matcher.backrefed = backrefed.empty ? t.matches : backrefed;
bool nomatch = (matcher.matchOneShot!(OneShot.Fwd)(t.matches, IRL!(IR.LookaheadStart)) == MatchResult.Match) ^ positive;
freelist = matcher.freelist;
genCounter = matcher.genCounter;
s.reset(index);
next();
if(nomatch)
{
recycle(t);
t = worklist.fetch();
if(!t)
return;
break;
}
else
t.pc += len + IRL!(IR.LookaheadEnd) + IRL!(IR.LookaheadStart);
break;
case IR.LookbehindEnd:
case IR.NeglookbehindEnd:
assert(0);
case IR.Nop:
t.pc += IRL!(IR.Nop);
break;
static if(withInput)
{
case IR.OrChar:
uint len = re.ir[t.pc].sequence;
uint end = t.pc + len;
static assert(IRL!(IR.OrChar) == 1);
for(; t.pc<end; t.pc++)
if(re.ir[t.pc].data == front)
break;
if(t.pc != end)
{
t.pc = end;
nlist.insertBack(t);
}
else
recycle(t);
t = worklist.fetch();
if(!t)
return;
break;
case IR.Char:
if(front == re.ir[t.pc].data)
{
t.pc += IRL!(IR.Char);
nlist.insertBack(t);
}
else
recycle(t);
t = worklist.fetch();
if(!t)
return;
break;
case IR.Any:
t.pc += IRL!(IR.Any);
if(!(re.flags & RegexOption.singleline)
&& (front == '\r' || front == '\n'))
recycle(t);
else
nlist.insertBack(t);
t = worklist.fetch();
if(!t)
return;
break;
case IR.CodepointSet:
if(re.charsets[re.ir[t.pc].data].scanFor(front))
{
t.pc += IRL!(IR.CodepointSet);
nlist.insertBack(t);
}
else
{
recycle(t);
}
t = worklist.fetch();
if(!t)
return;
break;
case IR.Trie:
if(re.tries[re.ir[t.pc].data][front])
{
t.pc += IRL!(IR.Trie);
nlist.insertBack(t);
}
else
{
recycle(t);
}
t = worklist.fetch();
if(!t)
return;
break;
default:
assert(0, "Unrecognized instruction " ~ re.ir[t.pc].mnemonic);
}
else
{
default:
recycle(t);
t = worklist.fetch();
if(t)
break;
else
return;
}
}
}
}
enum uint RestartPc=uint.max;
//match the input, evaluating IR without searching
MatchResult matchOneShot(OneShot direction)(Group!DataIndex[] matches, uint startPc=0)
{
debug(fred_matching)
{
writefln("---------------single shot match %s----------------- ",
direction == OneShot.Fwd ? "forward" : "backward");
}
static if(direction == OneShot.Fwd)
alias eval evalFn;
else
alias evalBack evalFn;
assert(clist == (ThreadList!DataIndex).init || startPc==RestartPc); // incorrect after a partial match
assert(nlist == (ThreadList!DataIndex).init || startPc==RestartPc);
if(!atEnd)//if no char
{
if (startPc!=RestartPc){
auto startT = createStart(index);
static if(direction == OneShot.Fwd)
startT.pc = startPc;
else
startT.pc = cast(uint)re.ir.length-IRL!(IR.LookbehindEnd);
genCounter++;
evalFn!true(startT, matches);
}
for(;;)
{
genCounter++;
debug(fred_matching)
{
static if(direction == OneShot.Fwd)
writefln("Threaded matching (forward) threads at %s", s[index..s.lastIndex]);
else
writefln("Threaded matching (backward) threads at %s", retro(s[index..s.lastIndex]));
foreach(t; clist[])
{
assert(t);
writef("pc=%s ",t.pc);
write(t.matches);
writeln();
}
}
for(Thread!DataIndex* t = clist.fetch(); t; t = clist.fetch())
{
evalFn!true(t, matches);
}
if(nlist.empty)
{
debug(fred_matching) writeln("Stopped matching before consuming full input");
break;//not a partial match for sure
}
clist = nlist;
nlist = (ThreadList!DataIndex).init;
if(!next()){
if (!atEnd) return MatchResult.PartialMatch;
break;
}
}
}
genCounter++; //increment also on each end
debug(fred_matching) writefln("Threaded matching (%s) threads at end",
direction == OneShot.Fwd ? "forward" : "backward");
//try out all zero-width posibilities
for(Thread!DataIndex* t = clist.fetch(); t; t = clist.fetch())
{
evalFn!false(t, matches);
}
return (matched?MatchResult.Match:MatchResult.NoMatch);
}
/+
a version of eval that executes IR backwards
+/
void evalBack(bool withInput)(Thread!DataIndex* t, Group!DataIndex[] matches)
{
ThreadList!DataIndex worklist;
debug(fred_matching) writeln("Evaluating thread backwards");
do
{
debug(fred_matching)
{
writef("\tpc=%s [", t.pc);
foreach(x; worklist[])
writef(" %s ", x.pc);
writeln("]");
}
debug(fred_matching) writeln(disassemble(re.ir, t.pc));
switch(re.ir[t.pc].code)
{
case IR.Wordboundary:
dchar back;
DataIndex bi;
//at start & end of input
if(atStart && wordTrie[front])
{
t.pc--;
break;
}
else if(atEnd && s.loopBack.nextChar(back, bi)
&& wordTrie[back])
{
t.pc--;
break;
}
else if(s.loopBack.nextChar(back, index))
{
bool af = wordTrie[front];
bool ab = wordTrie[back];
if(af ^ ab)
{
t.pc--;
break;
}
}
recycle(t);
t = worklist.fetch();
break;
case IR.Notwordboundary:
dchar back;
DataIndex bi;
//at start & end of input
if(atStart && wordTrie[front])
{
recycle(t);
t = worklist.fetch();
break;
}
else if(atEnd && s.loopBack.nextChar(back, bi)
&& wordTrie[back])
{
recycle(t);
t = worklist.fetch();
break;
}
else if(s.loopBack.nextChar(back, index))
{
bool af = wordTrie[front];
bool ab = wordTrie[back];
if(af ^ ab)
{
recycle(t);
t = worklist.fetch();
break;
}
}
t.pc--;
break;
case IR.Bol:
dchar back;
DataIndex bi;
if(atStart
||((re.flags & RegexOption.multiline)
&& s.loopBack.nextChar(back,bi)
&& startOfLine(back, front == '\n')))
{
t.pc--;
}
else
{
recycle(t);
t = worklist.fetch();
}
break;
case IR.Eol:
debug(fred_matching) writefln("EOL (front 0x%x) %s", front, s[index..s.lastIndex]);
dchar back;
DataIndex bi;
//no matching inside \r\n
if((re.flags & RegexOption.multiline)
&& endOfLine(front, s.loopBack.nextChar(back, bi)
&& back == '\r'))
{
t.pc--;
}
else
{
recycle(t);
t = worklist.fetch();
}
break;
case IR.InfiniteStart, IR.InfiniteQStart:
uint len = re.ir[t.pc].data;
uint mIdx = t.pc + len + IRL!(IR.InfiniteEnd); //we're always pointed at the tail of instruction
if(merge[re.ir[mIdx].raw+t.counter] < genCounter)
{
debug(fred_matching) writefln("A thread(pc=%s) passed there : %s ; GenCounter=%s mergetab=%s",
t.pc, index, genCounter, merge[re.ir[mIdx].raw+t.counter] );
merge[re.ir[mIdx].raw+t.counter] = genCounter;
}
else
{
debug(fred_matching) writefln("A thread(pc=%s) got merged there : %s ; GenCounter=%s mergetab=%s",
t.pc, index, genCounter, merge[re.ir[mIdx].raw+t.counter] );
recycle(t);
t = worklist.fetch();
break;
}
if(re.ir[t.pc].code == IR.InfiniteStart)//greedy
{
worklist.insertFront(fork(t, t.pc-1, t.counter));
t.pc += len;
}
else
{
worklist.insertFront(fork(t, t.pc+len, t.counter));
t.pc--;
}
break;
case IR.InfiniteEnd:
case IR.InfiniteQEnd://now it's a start
uint len = re.ir[t.pc].data;
t.pc -= len+IRL!(IR.InfiniteStart);
assert(re.ir[t.pc].code == IR.InfiniteStart || re.ir[t.pc].code == IR.InfiniteQStart);
goto case IR.InfiniteStart;
case IR.RepeatStart, IR.RepeatQStart:
uint len = re.ir[t.pc].data;
uint tail = t.pc + len + IRL!(IR.RepeatStart);
uint step = re.ir[tail+2].raw;
uint min = re.ir[tail+3].raw;
if(t.counter < min)
{
t.counter += step;
t.pc += len;
break;
}
uint max = re.ir[tail+4].raw;
if(merge[re.ir[tail+1].raw+t.counter] < genCounter)
{
debug(fred_matching) writefln("A thread(pc=%s) passed there : %s ; GenCounter=%s mergetab=%s",
t.pc, index, genCounter, merge[re.ir[tail+1].raw+t.counter] );
merge[re.ir[tail+1].raw+t.counter] = genCounter;
}
else
{
debug(fred_matching) writefln("A thread(pc=%s) got merged there : %s ; GenCounter=%s mergetab=%s",
t.pc, index, genCounter, merge[re.ir[tail+1].raw+t.counter] );
recycle(t);
t = worklist.fetch();
break;
}
if(t.counter < max)
{
if(re.ir[t.pc].code == IR.RepeatStart)//greedy
{
worklist.insertFront(fork(t, t.pc-1, t.counter%step));
t.counter += step;
t.pc += len;
}
else
{
worklist.insertFront(fork(t, t.pc + len, t.counter + step));
t.counter = t.counter%step;
t.pc--;
}
}
else
{
t.counter = t.counter%step;
t.pc--;
}
break;
case IR.RepeatEnd:
case IR.RepeatQEnd:
t.pc -= re.ir[t.pc].data+IRL!(IR.RepeatStart);
assert(re.ir[t.pc].code == IR.RepeatStart || re.ir[t.pc].code == IR.RepeatQStart);
goto case IR.RepeatStart;
case IR.OrEnd:
uint len = re.ir[t.pc].data;
t.pc -= len;
assert(re.ir[t.pc].code == IR.Option);
len = re.ir[t.pc].data;
t.pc = t.pc + len; //to IR.GotoEndOr or just before IR.OrEnd
break;
case IR.OrStart:
uint len = re.ir[t.pc].data;
uint mIdx = t.pc + len + IRL!(IR.OrEnd); //should point to the end of OrEnd
if(merge[re.ir[mIdx].raw+t.counter] < genCounter)
{
debug(fred_matching) writefln("A thread(t.pc=%s) passed there : %s ; GenCounter=%s mergetab=%s",
t.pc, index, genCounter, merge[re.ir[mIdx].raw+t.counter] );
merge[re.ir[mIdx].raw+t.counter] = genCounter;
}
else
{
debug(fred_matching) writefln("A thread(t.pc=%s) got merged there : %s ; GenCounter=%s mergetab=%s",
t.pc, index, genCounter, merge[re.ir[mIdx].raw+t.counter] );
recycle(t);
t = worklist.fetch();
break;
}
t.pc--;
break;
case IR.Option:
assert(re.ir[t.pc].code == IR.Option);
t.pc += re.ir[t.pc].data + IRL!(IR.Option);
if(re.ir[t.pc].code == IR.Option)
{
t.pc--;//hackish, assumes size of IR.Option == 1
if(re.ir[t.pc].code == IR.GotoEndOr)
{
t.pc += re.ir[t.pc].data + IRL!(IR.GotoEndOr);
}
}
assert(re.ir[t.pc].code == IR.OrEnd);
t.pc -= re.ir[t.pc].data + 1;
break;
case IR.GotoEndOr:
assert(re.ir[t.pc].code == IR.GotoEndOr);
uint npc = t.pc+IRL!(IR.GotoEndOr);
assert(re.ir[npc].code == IR.Option);
worklist.insertFront(fork(t, npc + re.ir[npc].data, t.counter));//queue next branch
t.pc--;
break;
case IR.GroupStart:
uint n = re.ir[t.pc].data;
t.matches.ptr[n].begin = index;
t.pc--;
break;
case IR.GroupEnd:
uint n = re.ir[t.pc].data;
t.matches.ptr[n].end = index;
t.pc--;
break;
case IR.Backref:
uint n = re.ir[t.pc].data;
auto source = re.ir[t.pc].localRef ? t.matches.ptr : backrefed.ptr;
assert(source);
if(source[n].begin == source[n].end)//zero-width Backref!
{
t.pc--;
}
else static if(withInput)
{
size_t idx = source[n].begin + t.uopCounter;
size_t end = source[n].end;
if(s[idx..end].front == front)//could be a BUG in backward matching
{
t.uopCounter += std.utf.stride(s[idx..end], 0);
if(t.uopCounter + source[n].begin == source[n].end)
{//last codepoint
t.pc--;
t.uopCounter = 0;
}
nlist.insertBack(t);
}
else
recycle(t);
t = worklist.fetch();
}
else
{
recycle(t);
t = worklist.fetch();
}
break;
case IR.LookbehindStart:
case IR.NeglookbehindStart:
uint ms = re.ir[t.pc+1].raw, me = re.ir[t.pc+2].raw;
finish(t, matches.ptr[ms .. me]);
recycle(t);
//cut off low priority threads
recycle(clist);
recycle(worklist);
return;
case IR.LookaheadStart:
case IR.NeglookaheadStart:
assert(0);
case IR.LookaheadEnd:
case IR.NeglookaheadEnd:
uint len = re.ir[t.pc].data;
t.pc -= len + IRL!(IR.LookaheadStart);
bool positive = re.ir[t.pc].code == IR.LookaheadStart;
auto matcher = ThompsonMatcher!(Char, typeof(s.loopBack))
(this
, re.ir[t.pc .. t.pc+len+IRL!(IR.LookbehindStart)+IRL!(IR.LookbehindEnd)]
, s.loopBack);
matcher.re.ngroup = re.ir[t.pc+2].raw - re.ir[t.pc+1].raw;
matcher.backrefed = backrefed.empty ? t.matches : backrefed;
matcher.next(); //fetch a char, since direction was reversed
bool match = (matcher.matchOneShot!(OneShot.Fwd)(t.matches, IRL!(IR.LookaheadStart)) == MatchResult.Match) ^ positive;
freelist = matcher.freelist;
if(match)
{
recycle(t);
t = worklist.fetch();
}
else
t.pc--;
break;
case IR.LookbehindEnd:
case IR.NeglookbehindEnd:
auto save = index;
uint len = re.ir[t.pc].data;
t.pc -= len + IRL!(IR.LookbehindStart);
uint ms = re.ir[t.pc+1].raw, me = re.ir[t.pc+2].raw;
bool positive = re.ir[t.pc].code == IR.LookbehindStart;
auto matcher = ThompsonMatcher(this, re.ir[t.pc .. t.pc+len+IRL!(IR.LookbehindStart)], s);
matcher.front = front;
matcher.index = index;
matcher.re.ngroup = me - ms;
matcher.backrefed = backrefed.empty ? t.matches : backrefed;
bool nomatch = (matcher.matchOneShot!(OneShot.Bwd)(t.matches) == MatchResult.Match) ^ positive;
freelist = matcher.freelist;
s.reset(index);
next();
if(nomatch)
{
recycle(t);
t = worklist.fetch();
if(!t)
return;
//
}
else
t.pc--;
break;
case IR.Nop:
t.pc--;
break;
static if(withInput)
{
case IR.OrChar://assumes IRL!(OrChar) == 1
uint len = re.ir[t.pc].sequence;
uint end = t.pc - len;
for(; t.pc>end; t.pc--)
if(re.ir[t.pc].data == front)
break;
if(t.pc != end)
{
t.pc = end;
nlist.insertBack(t);
}
else
recycle(t);
t = worklist.fetch();
break;
case IR.Char:
if(front == re.ir[t.pc].data)
{
t.pc--;
nlist.insertBack(t);
}
else
recycle(t);
t = worklist.fetch();
break;
case IR.Any:
t.pc--;
if(!(re.flags & RegexOption.singleline)
&& (front == '\r' || front == '\n'))
recycle(t);
else
nlist.insertBack(t);
t = worklist.fetch();
break;
case IR.CodepointSet:
if(re.charsets[re.ir[t.pc].data].scanFor(front))
{
t.pc--;
nlist.insertBack(t);
}
else
{
recycle(t);
}
t = worklist.fetch();
break;
case IR.Trie:
if(re.tries[re.ir[t.pc].data][front])
{
t.pc--;
nlist.insertBack(t);
}
else
{
recycle(t);
}
t = worklist.fetch();
break;
default:
assert(re.ir[t.pc].code < 0x80, "Unrecognized instruction " ~ re.ir[t.pc].mnemonic);
t.pc--;
}
else
{
default:
if(re.ir[t.pc].code < 0x80)
t.pc--;
else
{
recycle(t);
t = worklist.fetch();
}
}
}
}while(t);
}
//get a dirty recycled Thread
Thread!DataIndex* allocate()
{
assert(freelist, "not enough preallocated memory");
Thread!DataIndex* t = freelist;
freelist = freelist.next;
return t;
}
//link memory into a free list of Threads
void prepareFreeList(size_t size, ref void[] memory)
{
void[] mem = memory[0 .. threadSize*size];
memory = memory[threadSize*size..$];
freelist = cast(Thread!DataIndex*)&mem[0];
size_t i;
for(i=threadSize; i<threadSize*size; i+=threadSize)
(cast(Thread!DataIndex*)&mem[i-threadSize]).next = cast(Thread!DataIndex*)&mem[i];
(cast(Thread!DataIndex*)&mem[i-threadSize]).next = null;
}
//dispose a thread
void recycle(Thread!DataIndex* t)
{
t.next = freelist;
freelist = t;
}
//dispose list of threads
void recycle(ref ThreadList!DataIndex list)
{
auto t = list.tip;
while(t)
{
auto next = t.next;
recycle(t);
t = next;
}
list = list.init;
}
//creates a copy of master thread with given pc
Thread!DataIndex* fork(Thread!DataIndex* master, uint pc, uint counter)
{
auto t = allocate();
t.matches.ptr[0..re.ngroup] = master.matches.ptr[0..re.ngroup];
t.pc = pc;
t.counter = counter;
t.uopCounter = 0;
return t;
}
//creates a start thread
Thread!DataIndex* createStart(DataIndex index)
{
auto t = allocate();
t.matches.ptr[0..re.ngroup] = (Group!DataIndex).init;
t.matches[0].begin = index;
t.pc = 0;
t.counter = 0;
t.uopCounter = 0;
return t;
}
}
/++
$(D Captures) object contains submatches captured during a call
to $(D match) or iteration over $(D RegexMatch) range.
First element of range is the whole match.
Example, showing basic operations on $(D Captures):
----
import std.regex;
import std.range;
void main()
{
auto m = match("@abc#", regex(`(\w)(\w)(\w)`));
auto c = m.captures;
assert(c.pre == "@");// part of input preceeding match
assert(c.post == "#"); // immediately after match
assert(c.hit == c[0] && c.hit == "abc");// the whole match
assert(c[2] =="b");
assert(c.front == "abc");
c.popFront();
assert(c.front == "a");
assert(c.back == "c");
c.popBack();
assert(c.back == "b");
popFrontN(c, 2);
assert(c.empty);
}
----
+/
@trusted struct Captures(R,DIndex)
if(isSomeString!R)
{//@trusted because of union inside
alias DIndex DataIndex;
alias R String;
private:
R _input;
bool _empty;
enum smallString = 3;
union
{
Group!DataIndex[] big_matches;
Group!DataIndex[smallString] small_matches;
}
uint f, b;
uint ngroup;
NamedGroup[] names;
this(alias Engine)(ref RegexMatch!(R,Engine) rmatch)
{
_input = rmatch._input;
ngroup = rmatch._engine.re.ngroup;
names = rmatch._engine.re.dict;
newMatches();
b = ngroup;
f = 0;
}
@property Group!DataIndex[] matches()
{
return ngroup > smallString ? big_matches : small_matches[0..ngroup];
}
void newMatches()
{
if(ngroup > smallString)
big_matches = new Group!DataIndex[ngroup];
}
public:
///Slice of input prior to the match.
@property R pre()
{
return _empty ? _input[] : _input[0 .. matches[0].begin];
}
///Slice of input immediately after the match.
@property R post()
{
return _empty ? _input[] : _input[matches[0].end .. $];
}
///Slice of matched portion of input.
@property R hit()
{
assert(!_empty);
return _input[matches[0].begin .. matches[0].end];
}
///Range interface.
@property R front()
{
assert(!empty);
return _input[matches[f].begin .. matches[f].end];
}
///ditto
@property R back()
{
assert(!empty);
return _input[matches[b-1].begin .. matches[b-1].end];
}
///ditto
void popFront()
{
assert(!empty);
++f;
}
///ditto
void popBack()
{
assert(!empty);
--b;
}
///ditto
@property bool empty() const { return _empty || f >= b; }
///ditto
R opIndex()(size_t i) /*const*/ //@@@BUG@@@
{
assert(f+i < b,text("requested submatch number ", i,"is out of range"));
assert(matches[f+i].begin <= matches[f+i].end, text("wrong match: ", matches[f+i].begin, "..", matches[f+i].end));
return _input[matches[f+i].begin..matches[f+i].end];
}
/++
Lookup named submatch.
---
import std.regex;
import std.range;
auto m = match("a = 42;", regex(`(?P<var>\w+)\s*=\s*(?P<value>\d+);`));
auto c = m.captures;
assert(c["var"] == "a");
assert(c["value"] == "42");
popFrontN(c, 2);
//named groups are unaffected by range primitives
assert(c["var"] =="a");
assert(c.front == "42");
----
+/
R opIndex(String)(String i) /*const*/ //@@@BUG@@@
if(isSomeString!String)
{
size_t index = lookupNamedGroup(names, i);
return _input[matches[index].begin..matches[index].end];
}
///Number of matches in this object.
@property size_t length() const { return b-f; }
///A hook for compatibility with original std.regex.
@property ref captures(){ return this; }
}
/++
A regex engine state, as returned by $(D match) family of functions.
Effectively it's a forward range of Captures!R, produced
by lazily searching for matches in a given input.
alias Engine specifies an engine type to use during matching,
and is automatically deduced in a call to $(D match)/$(D bmatch).
+/
@trusted public struct RegexMatch(R, alias Engine=ThompsonMatcher)
if(isSomeString!R)
{
private:
alias BasicElementOf!R Char;
alias Engine!Char EngineType;
EngineType _engine;
R _input;
Captures!(R,EngineType.DataIndex) _captures;
void[] _memory;
this(RegEx)(RegEx prog, R input)
{
_input = input;
immutable size = EngineType.initialMemory(prog)+size_t.sizeof;
_memory = (enforce(malloc(size))[0..size]);
scope(failure) free(_memory.ptr);
*cast(size_t*)_memory.ptr = 1;
_engine = EngineType(prog, Input!Char(input), _memory[size_t.sizeof..$]);
_captures = Captures!(R,EngineType.DataIndex)(this);
_captures._empty = !_engine.match(_captures.matches);
debug(fred_counter) writefln("RefCount (ctor): %d", *cast(size_t*)_memory.ptr);
}
public:
this(this)
{
if(_memory.ptr)
{
++*cast(size_t*)_memory.ptr;
debug(fred_counter) writefln("RefCount (postblit): %d", *cast(size_t*)_memory.ptr);
}
}
~this()
{
if(_memory.ptr && --*cast(size_t*)_memory.ptr == 0)
{
free(cast(void*)_memory.ptr);
debug(fred_counter) writefln("RefCount (dtor): %d", *cast(size_t*)_memory.ptr);
}
}
///Shorthands for front.pre, front.post, front.hit.
@property R pre()
{
return _captures.pre;
}
///ditto
@property R post()
{
return _captures.post;
}
///ditto
@property R hit()
{
return _captures.hit;
}
/++
Functionality for processing subsequent matches of global regexes via range interface:
---
import std.regex;
auto m = match("Hello, world!", regex(`\w+`, "g"));
assert(m.front.hit == "Hello");
m.popFront();
assert(m.front.hit == "world");
m.popFront();
assert(m.empty);
---
+/
@property auto front()
{
return _captures;
}
///ditto
void popFront()
{ //previous one can have escaped references from Capture object
_captures.newMatches();
_captures._empty = !_engine.match(_captures.matches);
}
///ditto
auto save(){ return this; }
///Test if this match object is empty.
@property bool empty(){ return _captures._empty; }
///Same as !(x.empty), provided for its convenience in conditional statements.
T opCast(T:bool)(){ return !empty; }
/// Same as .front, provided for compatibility with original std.regex.
@property auto captures(){ return _captures; }
}
/++
Compile regular expression pattern for the later execution.
Returns: $(D Regex) object that works on inputs having
the same character width as $(D pattern).
Params:
pattern = Regular expression
flags = The _attributes (g, i, m and x accepted)
Throws: $(D RegexException) if there were any errors during compilation.
+/
public auto regex(S)(S pattern, const(char)[] flags="")
if(isSomeString!(S))
{
if(!__ctfe)
{
auto parser = Parser!(Unqual!(typeof(pattern)))(pattern, flags);
Regex!(BasicElementOf!S) r = parser.program;
return r;
}
else
{
auto parser = Parser!(Unqual!(typeof(pattern)), true)(pattern, flags);
Regex!(BasicElementOf!S) r = parser.program;
return r;
}
}
template ctRegexImpl(alias pattern, string flags=[])
{
enum r = regex(pattern, flags);
alias BasicElementOf!(typeof(pattern)) Char;
enum source = ctGenRegExCode(r);
alias BacktrackingMatcher!(true) Matcher;
@trusted bool func(ref Matcher!Char matcher)
{
version(fred_ct) debug pragma(msg, source);
mixin(source);
}
enum nr = StaticRegex!Char(r, &func);
}
/++
Experimental feature.
Compile regular expression using CTFE
and generate optimized native machine code for matching it.
Returns: StaticRegex object for faster matching.
Params:
pattern = Regular expression
flags = The _attributes (g, i, m and x accepted)
+/
public template ctRegex(alias pattern, alias flags=[])
{
enum ctRegex = ctRegexImpl!(pattern, flags).nr;
}
/++
Start matching $(D input) to regex pattern $(D re),
using Thompson NFA matching scheme.
This is the $(U recommended) method for matching regular expression.
$(D re) parameter can be one of three types:
$(UL
$(LI Plain string, in which case it's compiled to bytecode before matching. )
$(LI Regex!char (wchar/dchar) that contains pattern in form of
precompiled bytecode. )
$(LI StaticRegex!char (wchar/dchar) that contains pattern in form of
specially crafted native code. )
)
Returns: a $(D RegexMatch) object holding engine state after first match.
+/
public auto match(R, RegEx)(R input, RegEx re)
if(is(RegEx == Regex!(BasicElementOf!R)))
{
return RegexMatch!(Unqual!(typeof(input)),ThompsonMatcher)(re, input);
}
///ditto
public auto match(R, String)(R input, String re)
if(isSomeString!String)
{
return RegexMatch!(Unqual!(typeof(input)),ThompsonMatcher)(regex(re), input);
}
public auto match(R, RegEx)(R input, RegEx re)
if(is(RegEx == StaticRegex!(BasicElementOf!R)))
{
return RegexMatch!(Unqual!(typeof(input)),BacktrackingMatcher!true)(re, input);
}
/++
Start matching $(D input) to regex pattern $(D re),
using traditional $(LUCKY backtracking) matching scheme.
$(D re) parameter can be one of three types:
$(UL
$(LI Plain string, in which case it's compiled to bytecode before matching. )
$(LI Regex!char (wchar/dchar) that contains pattern in form of
precompiled bytecode. )
$(LI StaticRegex!char (wchar/dchar) that contains pattern in form of
specially crafted native code. )
)
Returns: a $(D RegexMatch) object holding engine
state after first match.
+/
public auto bmatch(R, RegEx)(R input, RegEx re)
if(is(RegEx == Regex!(BasicElementOf!R)))
{
return RegexMatch!(Unqual!(typeof(input)), BacktrackingMatcher!false)(re, input);
}
///ditto
public auto bmatch(R, String)(R input, String re)
if(isSomeString!String)
{
return RegexMatch!(Unqual!(typeof(input)), BacktrackingMatcher!false)(regex(re), input);
}
public auto bmatch(R, RegEx)(R input, RegEx re)
if(is(RegEx == StaticRegex!(BasicElementOf!R)))
{
return RegexMatch!(Unqual!(typeof(input)),BacktrackingMatcher!true)(re, input);
}
/++
Construct a new string from $(D input) by replacing each match with
a string generated from match according to $(D format) specifier.
To replace all occurances use regex with "g" flag, otherwise
only first occurrence gets replaced.
Params:
input = string to search
re = compiled regular expression to use
format = format string to generate replacements from
Example:
---
//Comify a number
auto com = regex(r"(?<=\d)(?=(\d\d\d)+\b)","g");
assert(replace("12000 + 42100 = 56000", com, ",") == "12,000 + 42,100 = 56,100");
---
The format string can reference parts of match using the following notation.
$(REG_TABLE
$(REG_TITLE Format specifier, Replaced by )
$(REG_ROW $&, the whole match. )
$(REG_ROW $`, part of input $(I preceding) the match. )
$(REG_ROW $', part of input $(I following) the match. )
$(REG_ROW $$, '$' character. )
$(REG_ROW \c , where c is any character, the character c itself. )
$(REG_ROW \\, '\' character. )
$(REG_ROW $1 .. $99, submatch number 1 to 99 respectively. )
)
---
assert(replace("noon", regex("^n"), "[$&]") == "[n]oon");
---
+/
public @trusted R replace(alias scheme=match, R, RegEx)(R input, RegEx re, R format)
if(isSomeString!R && is(RegEx == Regex!(BasicElementOf!R))
|| is(RegEx == StaticRegex!(BasicElementOf!R)))
{
auto app = appender!(R)();
auto matches = scheme(input, re);
size_t offset = 0;
foreach(ref m; matches)
{
app.put(m.pre[offset .. $]);
replaceFmt(format, m.captures, app);
offset = m.pre.length + m.hit.length;
}
app.put(input[offset .. $]);
return app.data;
}
/++
Search string for matches using regular expression pattern $(D re)
and pass captures for each match to user-defined functor $(D fun).
To replace all occurrances use regex with "g" flag, otherwise
only first occurrence gets replaced.
Returns: new string with all matches replaced by return values of $(D fun).
Params:
s = string to search
re = compiled regular expression
fun = delegate to use
Example:
Capitalize the letters 'a' and 'r':
---
string baz(Captures!(string) m)
{
return std.string.toUpper(m.hit);
}
auto s = replace!(baz)("Strap a rocket engine on a chicken.",
regex("[ar]", "g"));
assert(s == "StRAp A Rocket engine on A chicken.");
---
+/
public @trusted R replace(alias fun, R, RegEx, alias scheme=match)(R input, RegEx re)
if(isSomeString!R && is(RegEx == Regex!(BasicElementOf!R)))
{
auto app = appender!(R)();
auto matches = scheme(input, re);
size_t offset = 0;
foreach(m; matches)
{
app.put(m.pre[offset .. $]);
app.put(fun(m));
offset = m.pre.length + m.hit.length;
}
app.put(input[offset .. $]);
return app.data;
}
//produce replacement string from format using captures for substitue
public @trusted void replaceFmt(R, Capt, OutR)
(R format, Capt captures, OutR sink, bool ignoreBadSubs=false)
if(isOutputRange!(OutR, ElementEncodingType!R[]) &&
isOutputRange!(OutR, ElementEncodingType!(Capt.String)[]))
{
enum State { Normal, Escape, Dollar };
auto state = State.Normal;
size_t offset;
L_Replace_Loop:
while(!format.empty)
final switch(state)
{
case State.Normal:
for(offset = 0; offset < format.length; offset++)//no decoding
{
switch(format[offset])
{
case '\\':
state = State.Escape;
sink.put(format[0 .. offset]);
format = format[offset+1 .. $];//safe since special chars are ascii only
continue L_Replace_Loop;
case '$':
state = State.Dollar;
sink.put(format[0 .. offset]);
format = format[offset+1 .. $];//ditto
continue L_Replace_Loop;
default:
}
}
sink.put(format[0 .. offset]);
format = format[offset .. $];
break;
case State.Escape:
offset = std.utf.stride(format, 0);
sink.put(format[0 .. offset]);
format = format[offset .. $];
state = State.Normal;
break;
case State.Dollar:
if(ascii.isDigit(format[0]))
{
uint digit = parse!uint(format);
enforce(ignoreBadSubs || digit < captures.length, text("invalid submatch number ", digit));
if(digit < captures.length)
sink.put(captures[digit]);
}
else if(format[0] == '{')
{
auto x = find!"!std.ascii.isAlpha(a)"(format[1..$]);
enforce(!x.empty && x[0] == '}', "no matching '}' in replacement format");
auto name = format[1 .. $ - x.length];
format = x[1..$];
enforce(!name.empty, "invalid name in ${...} replacement format");
sink.put(captures[name]);
}
else if(format[0] == '&')
{
sink.put(captures[0]);
format = format[1 .. $];
}
else if(format[0] == '`')
{
sink.put(captures.pre);
format = format[1 .. $];
}
else if(format[0] == '\'')
{
sink.put(captures.post);
format = format[1 .. $];
}
else if(format[0] == '$')
{
sink.put(format[0 .. 1]);
format = format[1 .. $];
}
state = State.Normal;
break;
}
enforce(state == State.Normal, "invalid format string in regex replace");
}
/++
Range that splits a string using a regular expression as a
separator.
Example:
----
auto s1 = ", abc, de, fg, hi, ";
assert(equal(splitter(s1, regex(", *")),
["", "abc", "de", "fg", "hi", ""]));
----
+/
public struct Splitter(Range, alias Engine=ThompsonMatcher)
if(isSomeString!Range)
{
private:
Range _input;
size_t _offset;
alias RegexMatch!(Range, Engine) Rx;
Rx _match;
@trusted this(Range input, Regex!(BasicElementOf!Range) separator)
{//@@@BUG@@@ generated opAssign of RegexMatch is not @trusted
_input = input;
separator.flags |= RegexOption.global;
if (_input.empty)
{
//there is nothing to match at all, make _offset > 0
_offset = 1;
}
else
{
_match = Rx(separator, _input);
}
}
public:
auto ref opSlice()
{
return this.save();
}
///Forward range primitives.
@property Range front()
{
assert(!empty && _offset <= _match.pre.length
&& _match.pre.length <= _input.length);
return _input[_offset .. min($, _match.pre.length)];
}
///ditto
@property bool empty()
{
return _offset > _input.length;
}
///ditto
void popFront()
{
assert(!empty);
if (_match.empty)
{
//No more separators, work is done here
_offset = _input.length + 1;
}
else
{
//skip past the separator
_offset = _match.pre.length + _match.hit.length;
_match.popFront();
}
}
///ditto
@property auto save()
{
return this;
}
}
///A helper function, creates a $(D Spliiter) on range $(D r) separated by regex $(D pat).
public Splitter!(Range) splitter(Range, RegEx)(Range r, RegEx pat)
if( is(BasicElementOf!Range : dchar) && is(RegEx == Regex!(BasicElementOf!Range)))
{
return Splitter!(Range)(r, pat);
}
///An eager version of $(D splitter) that creates an array with splitted slices of $(D input).
public @trusted String[] split(String, RegEx)(String input, RegEx rx)
if(isSomeString!String && is(RegEx == Regex!(BasicElementOf!String)))
{
auto a = appender!(String[])();
foreach(e; splitter(input, rx))
a.put(e);
return a.data;
}
///Exception object thrown in case of errors during regex compilation.
public class RegexException : Exception
{
///
@trusted this(string msg, string file = __FILE__, size_t line = __LINE__)
{//@@@BUG@@@ Exception constructor is not @safe
super(msg, file, line);
}
}
//--------------------- TEST SUITE ---------------------------------
version(unittest)
{
@system:
unittest
{//sanity checks
regex("(a|b)*");
regex(`(?:([0-9A-F]+)\.\.([0-9A-F]+)|([0-9A-F]+))\s*;\s*(.*)\s*#`);
regex("abc|edf|ighrg");
auto r1 = regex("abc");
auto r2 = regex("(gylba)");
assert(match("abcdef", r1).hit == "abc");
assert(!match("wida",r2));
assert(bmatch("abcdef", r1).hit == "abc");
assert(!bmatch("wida", r2));
assert(match("abc", "abc".dup));
assert(bmatch("abc", "abc".dup));
Regex!char rc;
assert(rc.empty);
rc = regex("test");
assert(!rc.empty);
}
/* The test vectors in this file are altered from Henry Spencer's regexp
test code. His copyright notice is:
Copyright (c) 1986 by University of Toronto.
Written by Henry Spencer. Not derived from licensed software.
Permission is granted to anyone to use this software for any
purpose on any computer system, and to redistribute it freely,
subject to the following restrictions:
1. The author is not responsible for the consequences of use of
this software, no matter how awful, even if they arise
from defects in it.
2. The origin of this software must not be misrepresented, either
by explicit claim or by omission.
3. Altered versions must be plainly marked as such, and must not
be misrepresented as being the original software.
*/
unittest
{
struct TestVectors
{
string pattern;
string input;
string result;
string format;
string replace;
string flags;
};
enum TestVectors tv[] = [
TestVectors( "(a)b\\1", "abaab","y", "$&", "aba" ),
TestVectors( "()b\\1", "aaab", "y", "$&", "b" ),
TestVectors( "abc", "abc", "y", "$&", "abc" ),
TestVectors( "abc", "xbc", "n", "-", "-" ),
TestVectors( "abc", "axc", "n", "-", "-" ),
TestVectors( "abc", "abx", "n", "-", "-" ),
TestVectors( "abc", "xabcy","y", "$&", "abc" ),
TestVectors( "abc", "ababc","y", "$&", "abc" ),
TestVectors( "ab*c", "abc", "y", "$&", "abc" ),
TestVectors( "ab*bc", "abc", "y", "$&", "abc" ),
TestVectors( "ab*bc", "abbc", "y", "$&", "abbc" ),
TestVectors( "ab*bc", "abbbbc","y", "$&", "abbbbc" ),
TestVectors( "ab+bc", "abbc", "y", "$&", "abbc" ),
TestVectors( "ab+bc", "abc", "n", "-", "-" ),
TestVectors( "ab+bc", "abq", "n", "-", "-" ),
TestVectors( "ab+bc", "abbbbc","y", "$&", "abbbbc" ),
TestVectors( "ab?bc", "abbc", "y", "$&", "abbc" ),
TestVectors( "ab?bc", "abc", "y", "$&", "abc" ),
TestVectors( "ab?bc", "abbbbc","n", "-", "-" ),
TestVectors( "ab?c", "abc", "y", "$&", "abc" ),
TestVectors( "^abc$", "abc", "y", "$&", "abc" ),
TestVectors( "^abc$", "abcc", "n", "-", "-" ),
TestVectors( "^abc", "abcc", "y", "$&", "abc" ),
TestVectors( "^abc$", "aabc", "n", "-", "-" ),
TestVectors( "abc$", "aabc", "y", "$&", "abc" ),
TestVectors( "^", "abc", "y", "$&", "" ),
TestVectors( "$", "abc", "y", "$&", "" ),
TestVectors( "a.c", "abc", "y", "$&", "abc" ),
TestVectors( "a.c", "axc", "y", "$&", "axc" ),
TestVectors( "a.*c", "axyzc","y", "$&", "axyzc" ),
TestVectors( "a.*c", "axyzd","n", "-", "-" ),
TestVectors( "a[bc]d", "abc", "n", "-", "-" ),
TestVectors( "a[bc]d", "abd", "y", "$&", "abd" ),
TestVectors( "a[b-d]e", "abd", "n", "-", "-" ),
TestVectors( "a[b-d]e", "ace", "y", "$&", "ace" ),
TestVectors( "a[b-d]", "aac", "y", "$&", "ac" ),
TestVectors( "a[-b]", "a-", "y", "$&", "a-" ),
TestVectors( "a[b-]", "a-", "y", "$&", "a-" ),
TestVectors( "a[b-a]", "-", "c", "-", "-" ),
TestVectors( "a[]b", "-", "c", "-", "-" ),
TestVectors( "a[", "-", "c", "-", "-" ),
TestVectors( "a]", "a]", "y", "$&", "a]" ),
TestVectors( "a[\\]]b", "a]b", "y", "$&", "a]b" ),
TestVectors( "a[^bc]d", "aed", "y", "$&", "aed" ),
TestVectors( "a[^bc]d", "abd", "n", "-", "-" ),
TestVectors( "a[^-b]c", "adc", "y", "$&", "adc" ),
TestVectors( "a[^-b]c", "a-c", "n", "-", "-" ),
TestVectors( "a[^\\]b]c", "adc", "y", "$&", "adc" ),
TestVectors( "ab|cd", "abc", "y", "$&", "ab" ),
TestVectors( "ab|cd", "abcd", "y", "$&", "ab" ),
TestVectors( "()ef", "def", "y", "$&-$1", "ef-" ),
TestVectors( "()*", "-", "y", "-", "-" ),
TestVectors( "*a", "-", "c", "-", "-" ),
TestVectors( "^*", "-", "y", "-", "-" ),
TestVectors( "$*", "-", "y", "-", "-" ),
TestVectors( "(*)b", "-", "c", "-", "-" ),
TestVectors( "$b", "b", "n", "-", "-" ),
TestVectors( "a\\", "-", "c", "-", "-" ),
TestVectors( "a\\(b", "a(b", "y", "$&-$1", "a(b-" ),
TestVectors( "a\\(*b", "ab", "y", "$&", "ab" ),
TestVectors( "a\\(*b", "a((b", "y", "$&", "a((b" ),
TestVectors( "a\\\\b", "a\\b", "y", "$&", "a\\b" ),
TestVectors( "abc)", "-", "c", "-", "-" ),
TestVectors( "(abc", "-", "c", "-", "-" ),
TestVectors( "((a))", "abc", "y", "$&-$1-$2", "a-a-a" ),
TestVectors( "(a)b(c)", "abc", "y", "$&-$1-$2", "abc-a-c" ),
TestVectors( "a+b+c", "aabbabc","y", "$&", "abc" ),
TestVectors( "a**", "-", "c", "-", "-" ),
TestVectors( "a*?a", "aa", "y", "$&", "a" ),
TestVectors( "(a*)*", "aaa", "y", "-", "-" ),
TestVectors( "(a*)+", "aaa", "y", "-", "-" ),
TestVectors( "(a|)*", "-", "y", "-", "-" ),
TestVectors( "(a*|b)*", "aabb", "y", "-", "-" ),
TestVectors( "(a|b)*", "ab", "y", "$&-$1", "ab-b" ),
TestVectors( "(a+|b)*", "ab", "y", "$&-$1", "ab-b" ),
TestVectors( "(a+|b)+", "ab", "y", "$&-$1", "ab-b" ),
TestVectors( "(a+|b)?", "ab", "y", "$&-$1", "a-a" ),
TestVectors( "[^ab]*", "cde", "y", "$&", "cde" ),
TestVectors( "(^)*", "-", "y", "-", "-" ),
TestVectors( "(ab|)*", "-", "y", "-", "-" ),
TestVectors( ")(", "-", "c", "-", "-" ),
TestVectors( "", "abc", "y", "$&", "" ),
TestVectors( "abc", "", "n", "-", "-" ),
TestVectors( "a*", "", "y", "$&", "" ),
TestVectors( "([abc])*d", "abbbcd", "y", "$&-$1", "abbbcd-c" ),
TestVectors( "([abc])*bcd", "abcd", "y", "$&-$1", "abcd-a" ),
TestVectors( "a|b|c|d|e", "e", "y", "$&", "e" ),
TestVectors( "(a|b|c|d|e)f", "ef", "y", "$&-$1", "ef-e" ),
TestVectors( "((a*|b))*", "aabb", "y", "-", "-" ),
TestVectors( "abcd*efg", "abcdefg", "y", "$&", "abcdefg" ),
TestVectors( "ab*", "xabyabbbz", "y", "$&", "ab" ),
TestVectors( "ab*", "xayabbbz", "y", "$&", "a" ),
TestVectors( "(ab|cd)e", "abcde", "y", "$&-$1", "cde-cd" ),
TestVectors( "[abhgefdc]ij", "hij", "y", "$&", "hij" ),
TestVectors( "^(ab|cd)e", "abcde", "n", "x$1y", "xy" ),
TestVectors( "(abc|)ef", "abcdef", "y", "$&-$1", "ef-" ),
TestVectors( "(a|b)c*d", "abcd", "y", "$&-$1", "bcd-b" ),
TestVectors( "(ab|ab*)bc", "abc", "y", "$&-$1", "abc-a" ),
TestVectors( "a([bc]*)c*", "abc", "y", "$&-$1", "abc-bc" ),
TestVectors( "a([bc]*)(c*d)", "abcd", "y", "$&-$1-$2", "abcd-bc-d" ),
TestVectors( "a([bc]+)(c*d)", "abcd", "y", "$&-$1-$2", "abcd-bc-d" ),
TestVectors( "a([bc]*)(c+d)", "abcd", "y", "$&-$1-$2", "abcd-b-cd" ),
TestVectors( "a[bcd]*dcdcde", "adcdcde", "y", "$&", "adcdcde" ),
TestVectors( "a[bcd]+dcdcde", "adcdcde", "n", "-", "-" ),
TestVectors( "(ab|a)b*c", "abc", "y", "$&-$1", "abc-ab" ),
TestVectors( "((a)(b)c)(d)", "abcd", "y", "$1-$2-$3-$4", "abc-a-b-d" ),
TestVectors( "[a-zA-Z_][a-zA-Z0-9_]*", "alpha", "y", "$&", "alpha" ),
TestVectors( "^a(bc+|b[eh])g|.h$", "abh", "y", "$&-$1", "bh-" ),
TestVectors( "(bc+d$|ef*g.|h?i(j|k))", "effgz", "y", "$&-$1-$2", "effgz-effgz-" ),
TestVectors( "(bc+d$|ef*g.|h?i(j|k))", "ij", "y", "$&-$1-$2", "ij-ij-j" ),
TestVectors( "(bc+d$|ef*g.|h?i(j|k))", "effg", "n", "-", "-" ),
TestVectors( "(bc+d$|ef*g.|h?i(j|k))", "bcdd", "n", "-", "-" ),
TestVectors( "(bc+d$|ef*g.|h?i(j|k))", "reffgz", "y", "$&-$1-$2", "effgz-effgz-" ),
TestVectors( "(((((((((a)))))))))", "a", "y", "$&", "a" ),
TestVectors( "multiple words of text", "uh-uh", "n", "-", "-" ),
TestVectors( "multiple words", "multiple words, yeah", "y", "$&", "multiple words" ),
TestVectors( "(.*)c(.*)", "abcde", "y", "$&-$1-$2", "abcde-ab-de" ),
TestVectors( "\\((.*), (.*)\\)", "(a, b)", "y", "($2, $1)", "(b, a)" ),
TestVectors( "abcd", "abcd", "y", "$&-&-$$$&", "abcd-&-$abcd" ),
TestVectors( "a(bc)d", "abcd", "y", "$1-$$1-$$$1", "bc-$1-$bc" ),
TestVectors( "[k]", "ab", "n", "-", "-" ),
TestVectors( "[ -~]*", "abc", "y", "$&", "abc" ),
TestVectors( "[ -~ -~]*", "abc", "y", "$&", "abc" ),
TestVectors( "[ -~ -~ -~]*", "abc", "y", "$&", "abc" ),
TestVectors( "[ -~ -~ -~ -~]*", "abc", "y", "$&", "abc" ),
TestVectors( "[ -~ -~ -~ -~ -~]*", "abc", "y", "$&", "abc" ),
TestVectors( "[ -~ -~ -~ -~ -~ -~]*", "abc", "y", "$&", "abc" ),
TestVectors( "[ -~ -~ -~ -~ -~ -~ -~]*", "abc", "y", "$&", "abc" ),
TestVectors( "a{2}", "candy", "n", "", "" ),
TestVectors( "a{2}", "caandy", "y", "$&", "aa" ),
TestVectors( "a{2}", "caaandy", "y", "$&", "aa" ),
TestVectors( "a{2,}", "candy", "n", "", "" ),
TestVectors( "a{2,}", "caandy", "y", "$&", "aa" ),
TestVectors( "a{2,}", "caaaaaandy", "y", "$&", "aaaaaa" ),
TestVectors( "a{1,3}", "cndy", "n", "", "" ),
TestVectors( "a{1,3}", "candy", "y", "$&", "a" ),
TestVectors( "a{1,3}", "caandy", "y", "$&", "aa" ),
TestVectors( "a{1,3}", "caaaaaandy", "y", "$&", "aaa" ),
TestVectors( "e?le?", "angel", "y", "$&", "el" ),
TestVectors( "e?le?", "angle", "y", "$&", "le" ),
TestVectors( "\\bn\\w", "noonday", "y", "$&", "no" ),
TestVectors( "\\wy\\b", "possibly yesterday", "y", "$&", "ly" ),
TestVectors( "\\w\\Bn", "noonday", "y", "$&", "on" ),
TestVectors( "y\\B\\w", "possibly yesterday", "y", "$&", "ye" ),
TestVectors( "\\cJ", "abc\ndef", "y", "$&", "\n" ),
TestVectors( "\\d", "B2 is", "y", "$&", "2" ),
TestVectors( "\\D", "B2 is", "y", "$&", "B" ),
TestVectors( "\\s\\w*", "foo bar", "y", "$&", " bar" ),
TestVectors( "\\S\\w*", "foo bar", "y", "$&", "foo" ),
TestVectors( "abc", "ababc", "y", "$&", "abc" ),
TestVectors( "apple(,)\\sorange\\1", "apple, orange, cherry, peach", "y", "$&", "apple, orange," ),
TestVectors( "(\\w+)\\s(\\w+)", "John Smith", "y", "$2, $1", "Smith, John" ),
TestVectors( "\\n\\f\\r\\t\\v", "abc\n\f\r\t\vdef", "y", "$&", "\n\f\r\t\v" ),
TestVectors( ".*c", "abcde", "y", "$&", "abc" ),
TestVectors( "^\\w+((;|=)\\w+)+$", "some=host=tld", "y", "$&-$1-$2", "some=host=tld-=tld-=" ),
TestVectors( "^\\w+((\\.|-)\\w+)+$", "some.host.tld", "y", "$&-$1-$2", "some.host.tld-.tld-." ),
TestVectors( "q(a|b)*q", "xxqababqyy", "y", "$&-$1", "qababq-b" ),
TestVectors( "^(a)(b){0,1}(c*)", "abcc", "y", "$1 $2 $3", "a b cc" ),
TestVectors( "^(a)((b){0,1})(c*)", "abcc", "y", "$1 $2 $3", "a b b" ),
TestVectors( "^(a)(b)?(c*)", "abcc", "y", "$1 $2 $3", "a b cc" ),
TestVectors( "^(a)((b)?)(c*)", "abcc", "y", "$1 $2 $3", "a b b" ),
TestVectors( "^(a)(b){0,1}(c*)", "acc", "y", "$1 $2 $3", "a cc" ),
TestVectors( "^(a)((b){0,1})(c*)", "acc", "y", "$1 $2 $3", "a " ),
TestVectors( "^(a)(b)?(c*)", "acc", "y", "$1 $2 $3", "a cc" ),
TestVectors( "^(a)((b)?)(c*)", "acc", "y", "$1 $2 $3", "a " ),
TestVectors( "(?:ab){3}", "_abababc","y", "$&-$1", "ababab-" ),
TestVectors( "(?:a(?:x)?)+", "aaxaxx", "y", "$&-$1-$2", "aaxax--" ),
TestVectors( `\W\w\W`, "aa b!ca", "y", "$&", " b!"),
//more repetitions:
TestVectors( "(?:a{2,4}b{1,3}){1,2}", "aaabaaaabbb", "y", "$&", "aaabaaaabbb" ),
TestVectors( "(?:a{2,4}b{1,3}){1,2}?", "aaabaaaabbb", "y", "$&", "aaab" ),
//groups:
TestVectors( "(abc)|(edf)|(xyz)", "xyz", "y", "$1-$2-$3","--xyz"),
TestVectors( "(?P<q>\\d+)/(?P<d>\\d+)", "2/3", "y", "${d}/${q}", "3/2"),
//set operations:
TestVectors( "[a-z--d-f]", " dfa", "y", "$&", "a"),
TestVectors( "[abc[pq--acq]]{2}", "bqpaca", "y", "$&", "pa"),
TestVectors( "[a-z9&&abc0-9]{3}", "z90a0abc", "y", "$&", "abc"),
TestVectors( "[0-9a-f~~0-5a-z]{2}", "g0a58x", "y", "$&", "8x"),
TestVectors( "[abc[pq]xyz[rs]]{4}", "cqxr", "y", "$&", "cqxr"),
TestVectors( "[abcdf--[ab&&[bcd]][acd]]", "abcdefgh", "y", "$&", "f"),
//unicode blocks & properties:
TestVectors( `\P{Inlatin1suppl ement}`, "\u00c2!", "y", "$&", "!"),
TestVectors( `\p{InLatin-1 Supplement}\p{in-mathematical-operators}\P{Inlatin1suppl ement}`, "\u00c2\u2200\u00c3\u2203.", "y", "$&", "\u00c3\u2203."),
TestVectors( `[-+*/\p{in-mathematical-operators}]{2}`, "a+\u2212", "y", "$&", "+\u2212"),
TestVectors( `\p{Ll}+`, "XabcD", "y", "$&", "abc"),
TestVectors( `\p{Lu}+`, "абвГДЕ", "y", "$&", "ГДЕ"),
TestVectors( `^\p{Currency Symbol}\p{Sc}` "$₤", "y", "$&", "$₤"),
TestVectors( `\p{Common}\p{Thai}` "!ฆ", "y", "$&", "!ฆ"),
TestVectors( `[\d\s]*\D`, "12 \t3\U00001680\u0F20_2", "y", "$&", "12 \t3\U00001680\u0F20_"),
TestVectors( `[c-wф]фф`, "ффф", "y", "$&", "ффф"),
//case insensitive:
TestVectors( `^abcdEf$`, "AbCdEF" "y", "$&", "AbCdEF", "i"),
TestVectors( `Русский язык`, "рУсскИй ЯзЫк", "y", "$&", "рУсскИй ЯзЫк", "i"),
TestVectors( `ⒶⒷⓒ` , "ⓐⓑⒸ", "y", "$&", "ⓐⓑⒸ", "i"),
TestVectors( "\U00010400{2}", "\U00010428\U00010400 ", "y", "$&", "\U00010428\U00010400", "i"),
TestVectors( `[adzУ-Я]{4}`, "DzюА" "y", "$&", "DzЮа", "i"),
TestVectors( `\p{L}\p{Lu}{10}`, "абвгдеЖЗИКЛ", "y", "$&", "абвгдеЖЗИКЛ", "i"),
TestVectors( `(?:Dåb){3}`, "DåbDÅBdÅb", "y", "$&", "DåbDÅBdÅb", "i"),
//escapes:
TestVectors( `\u0041\u005a\U00000065\u0001`, "AZe\u0001", "y", "$&", "AZe\u0001"),
TestVectors( `\u`, "", "c", "-", "-"),
TestVectors( `\U`, "", "c", "-", "-"),
TestVectors( `\u003`, "", "c", "-", "-"),
TestVectors( `[\x00-\x7f]{4}`, "\x00\x09ab", "y", "$&", "\x00\x09ab"),
TestVectors( `[\cJ\cK\cA-\cD]{3}\cQ`, "\x01\x0B\x0A\x11", "y", "$&", "\x01\x0B\x0A\x11"),
TestVectors( `\r\n\v\t\f\\`, "\r\n\v\t\f\\", "y", "$&", "\r\n\v\t\f\\"),
TestVectors( `[\u0003\u0001]{2}`, "\u0001\u0003", "y", "$&", "\u0001\u0003"),
TestVectors( `^[\u0020-\u0080\u0001\n-\r]{8}`, "abc\u0001\v\f\r\n", "y", "$&", "abc\u0001\v\f\r\n"),
TestVectors( `\w+\S\w+`, "ab7!44c", "y", "$&", "ab7!44c"),
TestVectors( `\b\w+\b`, " abde4 ", "y", "$&", "abde4"),
TestVectors( `\b\w+\b`, " abde4", "y", "$&", "abde4"),
TestVectors( `\b\w+\b`, "abde4 ", "y", "$&", "abde4"),
TestVectors( `\pL\pS`, "a\u02DA", "y", "$&", "a\u02DA"),
TestVectors( `\pX`, "", "c", "-", "-"),
// ^, $, \b, \B, multiline :
TestVectors( `\r.*?$`, "abc\r\nxy", "y", "$&", "\r\nxy", "sm"),
TestVectors( `^a$^b$`, "a\r\nb\n", "n", "$&", "-", "m"),
TestVectors( `^a$\r\n^b$`,"a\r\nb\n", "y", "$&", "a\r\nb", "m"),
TestVectors( `^$`, "\r\n", "y", "$&", "", "m"),
TestVectors( `^a$\nx$`, "a\nx\u2028","y", "$&", "a\nx", "m"),
TestVectors( `^a$\nx$`, "a\nx\u2029","y", "$&", "a\nx", "m"),
TestVectors( `^a$\nx$`, "a\nx\u0085","y", "$&", "a\nx","m"),
TestVectors( `^x$`, "\u2028x", "y", "$&", "x", "m"),
TestVectors( `^x$`, "\u2029x", "y", "$&", "x", "m"),
TestVectors( `^x$`, "\u0085x", "y", "$&", "x", "m"),
TestVectors( `\b^.`, "ab", "y", "$&", "a"),
TestVectors( `\B^.`, "ab", "n", "-", "-"),
TestVectors( `^ab\Bc\B`, "\r\nabcd", "y", "$&", "abc", "m"),
TestVectors( `^.*$`, "12345678", "y", "$&", "12345678"),
// luckily obtained regression on incremental matching in backtracker
TestVectors( `^(?:(?:([0-9A-F]+)\.\.([0-9A-F]+)|([0-9A-F]+))\s*;\s*([^ ]*)\s*#|# (?:\w|_)+=((?:\w|_)+))`,
"0020 ; White_Space # ", "y", "$1-$2-$3", "--0020"),
//lookahead
TestVectors( "(foo.)(?=(bar))", "foobar foodbar", "y", "$&-$1-$2", "food-food-bar" ),
TestVectors( `\b(\d+)[a-z](?=\1)`, "123a123", "y", "$&-$1", "123a-123" ),
TestVectors( `\$(?!\d{3})\w+`, "$123 $abc", "y", "$&", "$abc"),
TestVectors( `(abc)(?=(ed(f))\3)`, "abcedff", "y", "-", "-"),
TestVectors( `\b[A-Za-z0-9.]+(?=(@(?!gmail)))`, "a@gmail,x@com", "y", "$&-$1", "x-@"),
TestVectors( `x()(abc)(?=(d)(e)(f)\2)`, "xabcdefabc", "y", "$&", "xabc"),
TestVectors( `x()(abc)(?=(d)(e)(f)()\3\4\5)`, "xabcdefdef", "y", "$&", "xabc"),
//lookback
TestVectors( `(?<=(ab))\d`, "12ba3ab4", "y", "$&-$1", "4-ab", "i"),
TestVectors( `\w(?<!\d)\w`, "123ab24", "y", "$&", "ab"),
TestVectors( `(?<=Dåb)x\w`, "DåbDÅBxdÅb", "y", "$&", "xd", "i"),
TestVectors( `(?<=(ab*c))x`, "abbbbcxac", "y", "$&-$1", "x-abbbbc"),
TestVectors( `(?<=(ab*?c))x`, "abbbbcxac", "y", "$&-$1", "x-abbbbc"),
TestVectors( `(?<=(a.*?c))x`, "ababbcxac", "y", "$&-$1", "x-abbc"),
TestVectors( `(?<=(a{2,4}b{1,3}))x`, "yyaaaabx", "y", "$&-$1", "x-aaaab"),
TestVectors( `(?<=((?:a{2,4}b{1,3}){1,2}))x`, "aabbbaaaabx", "y", "$&-$1", "x-aabbbaaaab"),
TestVectors( `(?<=((?:a{2,4}b{1,3}){1,2}?))x`, "aabbbaaaabx", "y", "$&-$1", "x-aaaab"),
TestVectors( `(?<=(abc|def|aef))x`, "abcx", "y", "$&-$1", "x-abc"),
TestVectors( `(?<=(abc|def|aef))x`, "aefx", "y", "$&-$1", "x-aef"),
TestVectors( `(?<=(abc|dabc))(x)`, "dabcx", "y", "$&-$1-$2", "x-abc-x"),
TestVectors( `(?<=(|abc))x`, "dabcx", "y", "$&-$1", "x-"),
TestVectors( `(?<=((ab|da)*))x`, "abdaabx", "y", "$&-$2-$1", "x-ab-abdaab"),
TestVectors( `a(?<=(ba(?<=(aba)(?<=aaba))))`, "aabaa", "y", "$&-$1-$2", "a-ba-aba"),
TestVectors( `.(?<!b).`, "bax", "y", "$&", "ax"),
TestVectors( `(?<=b(?<!ab)).`, "abbx", "y", "$&", "x"),
//mixed lookaround
TestVectors( `a(?<=a(?=b))b`, "ab", "y", "$&", "ab"),
TestVectors( `a(?<=a(?!b))c`, "ac", "y", "$&", "ac"),
];
string produceExpected(M,String)(auto ref M m, String fmt)
{
auto app = appender!(String)();
replaceFmt(fmt, m.captures, app, true);
return app.data;
}
void run_tests(alias matchFn)()
{
int i;
foreach(Char; TypeTuple!( char, wchar, dchar))
{
alias immutable(Char)[] String;
String produceExpected(M,Range)(auto ref M m, Range fmt)
{
auto app = appender!(String)();
replaceFmt(fmt, m.captures, app, true);
return app.data;
}
Regex!(Char) r;
foreach(a, tvd; tv)
{
uint c = tvd.result[0];
debug(fred_test) writeln(" Test #", a, " pattern: ", tvd.pattern, " with Char = ", Char.stringof);
try
{
i = 1;
r = regex(to!(String)(tvd.pattern), tvd.flags);
}
catch (RegexException e)
{
i = 0;
debug(fred_test) writeln(e.msg);
}
assert((c == 'c') ? !i : i, "failed to compile pattern "~tvd.pattern);
if(c != 'c')
{
auto m = matchFn(to!(String)(tvd.input), r);
i = !m.empty;
assert((c == 'y') ? i : !i, text(matchFn.stringof ~": failed to match pattern #", a ,": ", tvd.pattern));
if(c == 'y')
{
auto result = produceExpected(m, to!(String)(tvd.format));
assert(result == to!String(tvd.replace), text(matchFn.stringof ~": mismatch pattern #", a, ": ", tvd.pattern," expected: ",
tvd.replace, " vs ", result));
}
}
}
}
debug(fred_test) writeln("!!! FReD bulk test done "~matchFn.stringof~" !!!");
}
static string generate(uint n,uint[] black_list...)
{
string s = "TypeTuple!(";
for(uint i=0; i<n; i++)
{
uint j;
for(j =0; j<black_list.length; j++)
if(i == black_list[j])
break;
if(j == black_list.length)
{
s ~= to!string(i);
s ~= ",";
}
}
s ~= ")";
return s;
}
//CTFE parsing
version(fred_ct)
void ct_tests()
{
foreach(a, v; mixin(generate(140,38,39,40,52,55,57,62,63,67,80,190,191,192)))
{
enum tvd = tv[v];
enum r = regex(tvd.pattern, tvd.flags);
auto nr = regex(tvd.pattern, tvd.flags);
debug(fred_test)
{
writeln(" Test #", a, " pattern: ", tvd.pattern);
if(!equal(r.ir, nr.ir))
{
writeln("C-T version :");
r.print();
writeln("R-T version :");
nr.print();
assert(0, text("!C-T regex! failed to compile pattern #", a ,": ", tvd.pattern));
}
}
else
assert(equal(r.ir, nr.ir), text("!C-T regex! failed to compile pattern #", a ,": ", tvd.pattern));
}
debug(fred_test) writeln("!!! FReD C-T test done !!!");
}
version(fred_ct)
ct_tests();
else
{
run_tests!bmatch(); //backtracker
run_tests!match(); //thompson VM
}
}
version(fred_ct)
{
unittest
{
auto cr = ctRegex!("abc");
assert(bmatch("abc",cr).hit == "abc");
auto cr2 = ctRegex!("ab*c");
assert(bmatch("abbbbc",cr2).hit == "abbbbc");
auto cr3 = ctRegex!("^abc$");
assert(bmatch("abc",cr3).hit == "abc");
auto cr4 = ctRegex!(`\b(a\B[a-z]b)\b`);
assert(array(match("azb",cr4).captures) == ["azb", "azb"]);
auto cr5 = ctRegex!("(?:a{2,4}b{1,3}){1,2}");
assert(bmatch("aaabaaaabbb", cr5).hit == "aaabaaaabbb");
auto cr6 = ctRegex!("(?:a{2,4}b{1,3}){1,2}?"w);
assert(bmatch("aaabaaaabbb"w, cr6).hit == "aaab"w);
auto cr7 = ctRegex!(`\r.*?$`,"m");
assert(bmatch("abc\r\nxy", cr7).hit == "\r\nxy");
auto greed = ctRegex!("<packet.*?/packet>");
assert(bmatch("<packet>text</packet><packet>text</packet>", greed).hit
== "<packet>text</packet>");
auto cr8 = ctRegex!("^(a)(b)?(c*)");
auto m8 = bmatch("abcc",cr8);
assert(m8);
assert(m8.captures[1] == "a");
assert(m8.captures[2] == "b");
assert(m8.captures[3] == "cc");
auto cr9 = ctRegex!("q(a|b)*q");
auto m9 = match("xxqababqyy",cr9);
assert(m9);
assert(equal(bmatch("xxqababqyy",cr9).captures, ["qababq", "b"]));
auto rtr = regex("a|b|c");
enum ctr = regex("a|b|c");
assert(equal(rtr.ir,ctr.ir));
//CTFE parser BUG is triggered by group
//in the middle of alternation (at least not first and not last)
version(fred_bug)
{
enum testCT = regex(`abc|(edf)|xyz`);
auto testRT = regex(`abc|(edf)|xyz`);
debug
{
writeln("C-T version :");
testCT.print();
writeln("R-T version :");
testRT.print();
}
}
}
unittest
{
enum cx = ctRegex!"(A|B|C)";
auto mx = match("B",cx);
assert(mx);
assert(equal(mx.captures, [ "B", "B"]));
enum cx2 = ctRegex!"(A|B)*";
assert(match("BAAA",cx2));
enum cx3 = ctRegex!("a{3,4}","i");
auto mx3 = match("AaA",cx3);
assert(mx3);
assert(mx3.captures[0] == "AaA");
enum cx4 = ctRegex!(`^a{3,4}?[a-zA-Z0-9~]{1,2}`,"i");
auto mx4 = match("aaaabc", cx4);
assert(mx4);
assert(mx4.captures[0] == "aaaab");
auto cr8 = ctRegex!("(a)(b)?(c*)");
auto m8 = bmatch("abcc",cr8);
assert(m8);
assert(m8.captures[1] == "a");
assert(m8.captures[2] == "b");
assert(m8.captures[3] == "cc");
auto cr9 = ctRegex!(".*$", "gm");
auto m9 = match("First\rSecond");
assert(m9);
assert(equal(map!"a.hit"(m9.captures), ["First", "", "Second"]));
}
}
else
{
unittest
{
//global matching
void test_body(alias matchFn)()
{
string s = "a quick brown fox jumps over a lazy dog";
auto r1 = regex("\\b[a-z]+\\b","g");
string[] test;
foreach(m; matchFn(s, r1))
test ~= m.hit;
assert(equal(test, [ "a", "quick", "brown", "fox", "jumps", "over", "a", "lazy", "dog"]));
auto free_reg = regex(`
abc
\s+
"
(
[^"]+
| \\ "
)+
"
z
`, "x");
auto m = match(`abc "quoted string with \" inside"z`,free_reg);
assert(m);
string mails = " hey@you.com no@spam.net ";
auto rm = regex(`@(?<=\S+@)\S+`,"g");
assert(equal(map!"a[0]"(matchFn(mails, rm)), ["@you.com", "@spam.net"]));
auto m2 = matchFn("First line\nSecond line",regex(".*$","gm"));
assert(equal(map!"a[0]"(m2), ["First line", "", "Second line"]));
auto m2a = matchFn("First line\nSecond line",regex(".+$","gm"));
assert(equal(map!"a[0]"(m2a), ["First line", "Second line"]));
auto m2b = matchFn("First line\nSecond line",regex(".+?$","gm"));
assert(equal(map!"a[0]"(m2b), ["First line", "Second line"]));
debug(fred_test) writeln("!!! FReD FLAGS test done "~matchFn.stringof~" !!!");
}
test_body!bmatch();
test_body!match();
}
//tests for accomulated std.regex issues and other regressions
unittest
{
void test_body(alias matchFn)()
{
//issue 5857
//matching goes out of control if ... in (...){x} has .*/.+
auto c = matchFn("axxxzayyyyyzd",regex("(a.*z){2}d")).captures;
assert(c[0] == "axxxzayyyyyzd");
assert(c[1] == "ayyyyyz");
auto c2 = matchFn("axxxayyyyyd",regex("(a.*){2}d")).captures;
assert(c2[0] == "axxxayyyyyd");
assert(c2[1] == "ayyyyy");
//issue 2108
//greedy vs non-greedy
auto nogreed = regex("<packet.*?/packet>");
assert(matchFn("<packet>text</packet><packet>text</packet>", nogreed).hit
== "<packet>text</packet>");
auto greed = regex("<packet.*/packet>");
assert(matchFn("<packet>text</packet><packet>text</packet>", greed).hit
== "<packet>text</packet><packet>text</packet>");
//issue 4574
//empty successful match still advances the input
string[] pres, posts, hits;
foreach(m; matchFn("abcabc", regex("","g"))) {
pres ~= m.pre;
posts ~= m.post;
assert(m.hit.empty);
}
auto heads = [
"abcabc",
"abcab",
"abca",
"abc",
"ab",
"a",
""
];
auto tails = [
"abcabc",
"bcabc",
"cabc",
"abc",
"bc",
"c",
""
];
assert(pres == array(retro(heads)));
assert(posts == tails);
//issue 6076
//regression on .*
auto re = regex("c.*|d");
auto m = matchFn("mm", re);
assert(!m);
debug(fred_test) writeln("!!! FReD REGRESSION test done "~matchFn.stringof~" !!!");
auto rprealloc = regex(`((.){5}.{1,10}){5}`);
auto arr = array(replicate('0',100));
auto m2 = matchFn(arr, rprealloc);
assert(m2);
assert(collectException(
regex(r"^(import|file|binary|config)\s+([^\(]+)\(?([^\)]*)\)?\s*$")
) is null);
}
test_body!bmatch();
test_body!match();
}
//@@@BUG@@@ template function doesn't work inside unittest block
version(unittest)
Cap.String baz(Cap)(Cap m)
if (is(Cap==Captures!(Cap.String,Cap.DataIndex)))
{
return std.string.toUpper(m.hit);
}
// tests for replace
unittest
{
void test(alias matchFn)()
{
foreach(i, v; TypeTuple!(string, wstring, dstring))
{
alias v String;
assert(std.regex.replace!(matchFn)(to!String("ark rapacity"), regex(to!String("r")), to!String("c"))
== to!String("ack rapacity"));
assert(std.regex.replace!(matchFn)(to!String("ark rapacity"), regex(to!String("r"), "g"), to!String("c"))
== to!String("ack capacity"));
assert(std.regex.replace!(matchFn)(to!String("noon"), regex(to!String("^n")), to!String("[$&]"))
== to!String("[n]oon"));
assert(std.regex.replace!(matchFn)(to!String("test1 test2"), regex(to!String(`\w+`),"g"), to!String("$`:$'"))
== to!String(": test2 test1 :"));
auto s = std.regex.replace!(baz!(Captures!(String,size_t)))(to!String("Strap a rocket engine on a chicken."),
regex(to!String("[ar]"), "g"));
assert(s == "StRAp A Rocket engine on A chicken.");
}
debug(fred_test) writeln("!!! Replace test done "~matchFn.stringof~" !!!");
}
test!(bmatch)();
test!(match)();
}
// tests for splitter
unittest
{
auto s1 = ", abc, de, fg, hi, ";
auto sp1 = splitter(s1, regex(", *"));
auto w1 = ["", "abc", "de", "fg", "hi", ""];
assert(equal(sp1, w1));
auto s2 = ", abc, de, fg, hi";
auto sp2 = splitter(s2, regex(", *"));
auto w2 = ["", "abc", "de", "fg", "hi"];
uint cnt;
foreach(e; sp2) {
assert(w2[cnt++] == e);
}
assert(equal(sp2, w2));
}
unittest
{
char[] s1 = ", abc, de, fg, hi, ".dup;
auto sp2 = splitter(s1, regex(", *"));
}
unittest
{
auto s1 = ", abc, de, fg, hi, ";
auto w1 = ["", "abc", "de", "fg", "hi", ""];
assert(equal(split(s1, regex(", *")), w1[]));
}
}
}
| D |
instance DIA_MELVIN2_EXIT(C_INFO)
{
npc = nov_1373_melvin;
nr = 999;
condition = dia_melvin2_exit_condition;
information = dia_melvin2_exit_info;
permanent = 1;
description = DIALOG_ENDE;
};
func int dia_melvin2_exit_condition()
{
return 1;
};
func void dia_melvin2_exit_info()
{
AI_StopProcessInfos(self);
};
| D |
/afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/obj/x86_64-slc6-gcc49-opt/TruthWeightTools/obj/HiggsWeightTest.o /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/obj/x86_64-slc6-gcc49-opt/TruthWeightTools/obj/HiggsWeightTest.d : /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/TruthWeightTools/util/HiggsWeightTest.cxx /cvmfs/atlas.cern.ch/repo/ATLASLocalRootBase/x86_64/root/6.04.16-x86_64-slc6-gcc49-opt/include/TFile.h /cvmfs/atlas.cern.ch/repo/ATLASLocalRootBase/x86_64/root/6.04.16-x86_64-slc6-gcc49-opt/include/TDirectoryFile.h /cvmfs/atlas.cern.ch/repo/ATLASLocalRootBase/x86_64/root/6.04.16-x86_64-slc6-gcc49-opt/include/TDirectory.h /cvmfs/atlas.cern.ch/repo/ATLASLocalRootBase/x86_64/root/6.04.16-x86_64-slc6-gcc49-opt/include/TNamed.h /cvmfs/atlas.cern.ch/repo/ATLASLocalRootBase/x86_64/root/6.04.16-x86_64-slc6-gcc49-opt/include/TObject.h /cvmfs/atlas.cern.ch/repo/ATLASLocalRootBase/x86_64/root/6.04.16-x86_64-slc6-gcc49-opt/include/Rtypes.h /cvmfs/atlas.cern.ch/repo/ATLASLocalRootBase/x86_64/root/6.04.16-x86_64-slc6-gcc49-opt/include/RtypesCore.h /cvmfs/atlas.cern.ch/repo/ATLASLocalRootBase/x86_64/root/6.04.16-x86_64-slc6-gcc49-opt/include/RConfig.h /cvmfs/atlas.cern.ch/repo/ATLASLocalRootBase/x86_64/root/6.04.16-x86_64-slc6-gcc49-opt/include/RVersion.h /cvmfs/atlas.cern.ch/repo/ATLASLocalRootBase/x86_64/root/6.04.16-x86_64-slc6-gcc49-opt/include/DllImport.h /cvmfs/atlas.cern.ch/repo/ATLASLocalRootBase/x86_64/root/6.04.16-x86_64-slc6-gcc49-opt/include/Rtypeinfo.h /cvmfs/atlas.cern.ch/repo/ATLASLocalRootBase/x86_64/root/6.04.16-x86_64-slc6-gcc49-opt/include/snprintf.h /cvmfs/atlas.cern.ch/repo/ATLASLocalRootBase/x86_64/root/6.04.16-x86_64-slc6-gcc49-opt/include/strlcpy.h /cvmfs/atlas.cern.ch/repo/ATLASLocalRootBase/x86_64/root/6.04.16-x86_64-slc6-gcc49-opt/include/TGenericClassInfo.h /cvmfs/atlas.cern.ch/repo/ATLASLocalRootBase/x86_64/root/6.04.16-x86_64-slc6-gcc49-opt/include/TSchemaHelper.h /cvmfs/atlas.cern.ch/repo/ATLASLocalRootBase/x86_64/root/6.04.16-x86_64-slc6-gcc49-opt/include/TStorage.h /cvmfs/atlas.cern.ch/repo/ATLASLocalRootBase/x86_64/root/6.04.16-x86_64-slc6-gcc49-opt/include/TVersionCheck.h /cvmfs/atlas.cern.ch/repo/ATLASLocalRootBase/x86_64/root/6.04.16-x86_64-slc6-gcc49-opt/include/Riosfwd.h /cvmfs/atlas.cern.ch/repo/ATLASLocalRootBase/x86_64/root/6.04.16-x86_64-slc6-gcc49-opt/include/TBuffer.h /cvmfs/atlas.cern.ch/repo/ATLASLocalRootBase/x86_64/root/6.04.16-x86_64-slc6-gcc49-opt/include/TString.h /cvmfs/atlas.cern.ch/repo/ATLASLocalRootBase/x86_64/root/6.04.16-x86_64-slc6-gcc49-opt/include/TMathBase.h /cvmfs/atlas.cern.ch/repo/ATLASLocalRootBase/x86_64/root/6.04.16-x86_64-slc6-gcc49-opt/include/RStringView.h /cvmfs/atlas.cern.ch/repo/ATLASLocalRootBase/x86_64/root/6.04.16-x86_64-slc6-gcc49-opt/include/RConfigure.h /cvmfs/atlas.cern.ch/repo/ATLASLocalRootBase/x86_64/root/6.04.16-x86_64-slc6-gcc49-opt/include/RWrap_libcpp_string_view.h /cvmfs/atlas.cern.ch/repo/ATLASLocalRootBase/x86_64/root/6.04.16-x86_64-slc6-gcc49-opt/include/libcpp_string_view.h /cvmfs/atlas.cern.ch/repo/ATLASLocalRootBase/x86_64/root/6.04.16-x86_64-slc6-gcc49-opt/include/TList.h /cvmfs/atlas.cern.ch/repo/ATLASLocalRootBase/x86_64/root/6.04.16-x86_64-slc6-gcc49-opt/include/TSeqCollection.h /cvmfs/atlas.cern.ch/repo/ATLASLocalRootBase/x86_64/root/6.04.16-x86_64-slc6-gcc49-opt/include/TCollection.h /cvmfs/atlas.cern.ch/repo/ATLASLocalRootBase/x86_64/root/6.04.16-x86_64-slc6-gcc49-opt/include/TIterator.h /cvmfs/atlas.cern.ch/repo/ATLASLocalRootBase/x86_64/root/6.04.16-x86_64-slc6-gcc49-opt/include/TDatime.h /cvmfs/atlas.cern.ch/repo/ATLASLocalRootBase/x86_64/root/6.04.16-x86_64-slc6-gcc49-opt/include/TUUID.h /cvmfs/atlas.cern.ch/repo/ATLASLocalRootBase/x86_64/root/6.04.16-x86_64-slc6-gcc49-opt/include/TMap.h /cvmfs/atlas.cern.ch/repo/ATLASLocalRootBase/x86_64/root/6.04.16-x86_64-slc6-gcc49-opt/include/THashTable.h /cvmfs/atlas.cern.ch/repo/ATLASLocalRootBase/x86_64/root/6.04.16-x86_64-slc6-gcc49-opt/include/TUrl.h /cvmfs/atlas.cern.ch/repo/ATLASLocalRootBase/x86_64/root/6.04.16-x86_64-slc6-gcc49-opt/include/TError.h /cvmfs/atlas.cern.ch/repo/ATLASLocalRootBase/x86_64/root/6.04.16-x86_64-slc6-gcc49-opt/include/TTree.h /cvmfs/atlas.cern.ch/repo/ATLASLocalRootBase/x86_64/root/6.04.16-x86_64-slc6-gcc49-opt/include/TBranch.h /cvmfs/atlas.cern.ch/repo/ATLASLocalRootBase/x86_64/root/6.04.16-x86_64-slc6-gcc49-opt/include/TObjArray.h /cvmfs/atlas.cern.ch/repo/ATLASLocalRootBase/x86_64/root/6.04.16-x86_64-slc6-gcc49-opt/include/TAttFill.h /cvmfs/atlas.cern.ch/repo/ATLASLocalRootBase/x86_64/root/6.04.16-x86_64-slc6-gcc49-opt/include/TDataType.h /cvmfs/atlas.cern.ch/repo/ATLASLocalRootBase/x86_64/root/6.04.16-x86_64-slc6-gcc49-opt/include/TDictionary.h /cvmfs/atlas.cern.ch/repo/ATLASLocalRootBase/x86_64/root/6.04.16-x86_64-slc6-gcc49-opt/include/ESTLType.h /cvmfs/atlas.cern.ch/repo/ATLASLocalRootBase/x86_64/root/6.04.16-x86_64-slc6-gcc49-opt/include/TAttLine.h /cvmfs/atlas.cern.ch/repo/ATLASLocalRootBase/x86_64/root/6.04.16-x86_64-slc6-gcc49-opt/include/TAttMarker.h /cvmfs/atlas.cern.ch/repo/ATLASLocalRootBase/x86_64/root/6.04.16-x86_64-slc6-gcc49-opt/include/TArrayD.h /cvmfs/atlas.cern.ch/repo/ATLASLocalRootBase/x86_64/root/6.04.16-x86_64-slc6-gcc49-opt/include/TArray.h /cvmfs/atlas.cern.ch/repo/ATLASLocalRootBase/x86_64/root/6.04.16-x86_64-slc6-gcc49-opt/include/TArrayI.h /cvmfs/atlas.cern.ch/repo/ATLASLocalRootBase/x86_64/root/6.04.16-x86_64-slc6-gcc49-opt/include/TClass.h /cvmfs/atlas.cern.ch/repo/ATLASLocalRootBase/x86_64/root/6.04.16-x86_64-slc6-gcc49-opt/include/TObjString.h /cvmfs/atlas.cern.ch/repo/ATLASLocalRootBase/x86_64/root/6.04.16-x86_64-slc6-gcc49-opt/include/ThreadLocalStorage.h /cvmfs/atlas.cern.ch/repo/ATLASLocalRootBase/x86_64/root/6.04.16-x86_64-slc6-gcc49-opt/include/TVirtualTreePlayer.h /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/xAODRootAccess/Init.h /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/xAODRootAccess/tools/TReturnCode.h /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/xAODRootAccess/TEvent.h /cvmfs/atlas.cern.ch/repo/ATLASLocalRootBase/x86_64/root/6.04.16-x86_64-slc6-gcc49-opt/include/Rtypes.h /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/xAODEventFormat/EventFormat.h /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/xAODEventFormat/versions/EventFormat_v1.h /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/xAODEventFormat/EventFormatElement.h /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/xAODCore/CLASS_DEF.h /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/xAODCore/ClassID_traits.h /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/AthContainersInterfaces/IAuxStoreHolder.h /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/xAODRootAccessInterfaces/TVirtualEvent.h /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/xAODRootAccessInterfaces/TVirtualEvent.icc /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/xAODRootAccess/TEvent.icc /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/AthContainers/ClassName.h /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/AthContainers/ClassName.icc /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/AthContainers/tools/error.h /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/xAODRootAccess/tools/ReturnCheck.h /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/xAODRootAccess/tools/Message.h /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/xAODEventInfo/EventInfo.h /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/xAODEventInfo/versions/EventInfo_v1.h /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/AthContainers/AuxElement.h /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/AthContainersInterfaces/IAuxElement.h /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/AthContainersInterfaces/IConstAuxStore.h /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/AthContainersInterfaces/AuxTypes.h /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/CxxUtils/unordered_set.h /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/CxxUtils/hashtable.h /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/type_traits/remove_const.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/config.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/config/user.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/config/select_compiler_config.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/config/compiler/gcc.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/config/select_stdlib_config.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/config/stdlib/libstdcpp3.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/config/select_platform_config.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/config/platform/linux.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/config/posix_features.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/config/suffix.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/detail/workaround.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/AthContainersInterfaces/IAuxStore.h /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/AthLinks/DataLink.h /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/AthLinks/DataLinkBase.h /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/AthLinks/tools/selection_ns.h /cvmfs/atlas.cern.ch/repo/ATLASLocalRootBase/x86_64/root/6.04.16-x86_64-slc6-gcc49-opt/include/RVersion.h /cvmfs/atlas.cern.ch/repo/ATLASLocalRootBase/x86_64/root/6.04.16-x86_64-slc6-gcc49-opt/include/RootMetaSelection.h /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/AthLinks/DataLink.icc /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/xAODRootAccessInterfaces/TActiveEvent.h /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/AthContainers/AuxTypeRegistry.h /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/AthContainersInterfaces/IAuxTypeVector.h /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/AthContainersInterfaces/IAuxTypeVectorFactory.h /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/AthContainers/tools/AuxTypeVector.h /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/AthContainersInterfaces/IAuxSetOption.h /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/AthContainers/tools/AuxDataTraits.h /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/AthContainers/PackedContainer.h /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/AthContainers/PackedParameters.h /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/AthContainersInterfaces/AuxDataOption.h /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/AthContainersInterfaces/AuxDataOption.icc /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/AthContainers/PackedParameters.icc /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/CxxUtils/override.h /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/AthContainers/PackedContainer.icc /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/AthContainers/tools/AuxTypeVector.icc /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/AthContainers/tools/AuxTypeVectorFactory.h /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/AthContainers/tools/AuxTypeVectorFactory.icc /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/AthContainers/tools/threading.h /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/AthContainers/tools/threading.icc /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/AthContainers/AuxTypeRegistry.icc /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/AthContainers/AuxVectorData.h /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/AthContainers/tools/likely.h /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/AthContainers/tools/assume.h /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/AthContainers/AuxVectorData.icc /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/AthContainers/exceptions.h /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/CxxUtils/noreturn.h /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/AthContainers/AuxElement.icc /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/AthContainers/DataVector.h /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/AthContainers/OwnershipPolicy.h /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/AthContainers/IndexTrackingPolicy.h /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/AthContainers/AuxVectorBase.h /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/AthContainers/tools/ATHCONTAINERS_ASSERT.h /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/AthContainersInterfaces/AuxStore_traits.h /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/AthContainers/AuxVectorBase.icc /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/AthContainers/tools/DVLNoBase.h /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/AthContainers/tools/DVLInfo.h /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/AthContainers/tools/ClassID.h /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/AthContainers/tools/DVLInfo.icc /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/AthContainers/tools/DVLCast.h /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/AthContainers/tools/DVLIterator.h /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/AthContainers/tools/ElementProxy.h /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/AthContainers/tools/ElementProxy.icc /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/iterator/iterator_adaptor.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/static_assert.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/iterator.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/detail/iterator.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/iterator/iterator_categories.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/iterator/detail/config_def.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/mpl/eval_if.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/mpl/if.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/mpl/aux_/value_wknd.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/mpl/aux_/static_cast.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/mpl/aux_/config/workaround.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/mpl/aux_/config/integral.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/mpl/aux_/config/msvc.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/mpl/aux_/config/eti.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/mpl/aux_/na_spec.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/mpl/lambda_fwd.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/mpl/void_fwd.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/mpl/aux_/adl_barrier.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/mpl/aux_/config/adl.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/mpl/aux_/config/intel.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/mpl/aux_/config/gcc.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/mpl/aux_/na.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/mpl/bool.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/mpl/bool_fwd.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/mpl/integral_c_tag.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/mpl/aux_/config/static_constant.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/mpl/aux_/na_fwd.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/mpl/aux_/config/ctps.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/mpl/aux_/config/lambda.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/mpl/aux_/config/ttp.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/mpl/int.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/mpl/int_fwd.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/mpl/aux_/nttp_decl.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/mpl/aux_/config/nttp.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/mpl/aux_/integral_wrapper.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/preprocessor/cat.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/preprocessor/config/config.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/mpl/aux_/lambda_arity_param.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/mpl/aux_/template_arity_fwd.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/mpl/aux_/arity.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/mpl/aux_/config/dtp.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/mpl/aux_/preprocessor/params.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/mpl/aux_/config/preprocessor.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/preprocessor/comma_if.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/preprocessor/punctuation/comma_if.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/preprocessor/control/if.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/preprocessor/control/iif.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/preprocessor/logical/bool.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/preprocessor/facilities/empty.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/preprocessor/punctuation/comma.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/preprocessor/repeat.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/preprocessor/repetition/repeat.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/preprocessor/debug/error.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/preprocessor/detail/auto_rec.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/preprocessor/tuple/eat.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/preprocessor/inc.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/preprocessor/arithmetic/inc.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/mpl/aux_/preprocessor/enum.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/mpl/aux_/preprocessor/def_params_tail.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/mpl/limits/arity.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/preprocessor/logical/and.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/preprocessor/logical/bitand.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/preprocessor/identity.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/preprocessor/facilities/identity.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/preprocessor/empty.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/preprocessor/arithmetic/add.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/preprocessor/arithmetic/dec.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/preprocessor/control/while.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/preprocessor/list/fold_left.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/preprocessor/list/detail/fold_left.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/preprocessor/control/expr_iif.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/preprocessor/list/adt.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/preprocessor/detail/is_binary.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/preprocessor/detail/check.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/preprocessor/logical/compl.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/preprocessor/list/fold_right.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/preprocessor/list/detail/fold_right.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/preprocessor/list/reverse.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/preprocessor/control/detail/while.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/preprocessor/tuple/elem.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/preprocessor/facilities/expand.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/preprocessor/facilities/overload.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/preprocessor/variadic/size.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/preprocessor/tuple/rem.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/preprocessor/tuple/detail/is_single_return.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/preprocessor/variadic/elem.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/preprocessor/arithmetic/sub.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/mpl/aux_/config/overload_resolution.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/mpl/aux_/lambda_support.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/mpl/identity.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/mpl/placeholders.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/mpl/arg.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/mpl/arg_fwd.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/mpl/aux_/na_assert.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/mpl/assert.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/mpl/not.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/mpl/aux_/nested_type_wknd.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/mpl/aux_/yes_no.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/mpl/aux_/config/arrays.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/mpl/aux_/config/gpu.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/mpl/aux_/config/pp_counter.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/mpl/aux_/arity_spec.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/mpl/aux_/arg_typedef.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/mpl/aux_/config/use_preprocessed.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/mpl/aux_/include_preprocessed.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/mpl/aux_/config/compiler.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/preprocessor/stringize.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/mpl/aux_/preprocessed/gcc/arg.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/mpl/aux_/preprocessed/gcc/placeholders.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/type_traits/is_convertible.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/type_traits/intrinsics.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/type_traits/detail/config.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/version.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/type_traits/integral_constant.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/type_traits/detail/yes_no_type.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/type_traits/is_array.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/type_traits/is_arithmetic.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/type_traits/is_integral.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/type_traits/is_floating_point.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/type_traits/is_void.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/type_traits/is_abstract.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/type_traits/add_lvalue_reference.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/type_traits/add_reference.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/type_traits/add_rvalue_reference.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/type_traits/is_reference.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/type_traits/is_lvalue_reference.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/type_traits/is_rvalue_reference.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/type_traits/is_function.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/type_traits/detail/is_function_ptr_helper.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/type_traits/declval.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/iterator/detail/config_undef.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/iterator/iterator_facade.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/iterator/interoperable.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/mpl/or.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/mpl/aux_/preprocessed/gcc/or.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/iterator/iterator_traits.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/iterator/detail/facade_iterator_category.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/mpl/and.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/mpl/aux_/preprocessed/gcc/and.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/type_traits/is_same.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/type_traits/is_const.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/detail/indirect_traits.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/type_traits/is_pointer.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/type_traits/is_class.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/type_traits/is_volatile.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/type_traits/is_member_function_pointer.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/type_traits/detail/is_mem_fun_pointer_impl.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/type_traits/remove_cv.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/type_traits/is_member_pointer.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/type_traits/remove_reference.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/type_traits/remove_pointer.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/iterator/detail/enable_if.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/utility/addressof.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/core/addressof.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/type_traits/add_const.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/type_traits/add_pointer.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/type_traits/is_pod.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/type_traits/is_scalar.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/type_traits/is_enum.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/mpl/always.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/mpl/aux_/preprocessor/default_params.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/mpl/apply.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/mpl/apply_fwd.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/mpl/aux_/preprocessed/gcc/apply_fwd.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/mpl/apply_wrap.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/mpl/aux_/has_apply.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/mpl/has_xxx.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/mpl/aux_/type_wrapper.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/mpl/aux_/config/has_xxx.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/mpl/aux_/config/msvc_typename.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/preprocessor/array/elem.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/preprocessor/array/data.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/preprocessor/array/size.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/preprocessor/repetition/enum_params.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/preprocessor/repetition/enum_trailing_params.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/mpl/aux_/config/has_apply.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/mpl/aux_/msvc_never_true.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/mpl/aux_/preprocessed/gcc/apply_wrap.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/mpl/lambda.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/mpl/bind.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/mpl/bind_fwd.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/mpl/aux_/config/bind.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/mpl/aux_/preprocessed/gcc/bind_fwd.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/mpl/next.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/mpl/next_prior.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/mpl/aux_/common_name_wknd.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/mpl/protect.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/mpl/aux_/preprocessed/gcc/bind.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/mpl/aux_/full_lambda.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/mpl/quote.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/mpl/void.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/mpl/aux_/has_type.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/mpl/aux_/config/bcc.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/mpl/aux_/preprocessed/gcc/quote.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/mpl/aux_/template_arity.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/mpl/aux_/preprocessed/gcc/template_arity.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/mpl/aux_/preprocessed/gcc/full_lambda.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/mpl/aux_/preprocessed/gcc/apply.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/AthContainers/tools/DVL_iter_swap.h /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/AthContainers/tools/DVL_algorithms.h /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/AthContainers/tools/DVL_algorithms.icc /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/AthContainers/tools/IsMostDerivedFlag.h /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/type_traits.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/type_traits/add_cv.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/type_traits/add_volatile.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/type_traits/aligned_storage.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/type_traits/alignment_of.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/type_traits/type_with_alignment.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/type_traits/conditional.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/type_traits/common_type.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/type_traits/decay.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/type_traits/remove_bounds.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/type_traits/remove_extent.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/type_traits/detail/mp_defer.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/type_traits/copy_cv.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/type_traits/extent.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/type_traits/floating_point_promotion.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/type_traits/function_traits.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/type_traits/has_bit_and.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/type_traits/detail/has_binary_operator.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/type_traits/is_base_of.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/type_traits/is_base_and_derived.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/type_traits/is_fundamental.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/type_traits/has_bit_and_assign.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/type_traits/has_bit_or.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/type_traits/has_bit_or_assign.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/type_traits/has_bit_xor.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/type_traits/has_bit_xor_assign.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/type_traits/has_complement.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/type_traits/detail/has_prefix_operator.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/type_traits/has_dereference.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/type_traits/has_divides.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/type_traits/has_divides_assign.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/type_traits/has_equal_to.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/type_traits/has_greater.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/type_traits/has_greater_equal.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/type_traits/has_left_shift.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/type_traits/has_left_shift_assign.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/type_traits/has_less.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/type_traits/has_less_equal.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/type_traits/has_logical_and.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/type_traits/has_logical_not.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/type_traits/has_logical_or.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/type_traits/has_minus.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/type_traits/has_minus_assign.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/type_traits/has_modulus.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/type_traits/has_modulus_assign.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/type_traits/has_multiplies.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/type_traits/has_multiplies_assign.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/type_traits/has_negate.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/type_traits/has_new_operator.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/type_traits/has_not_equal_to.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/type_traits/has_nothrow_assign.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/type_traits/is_assignable.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/type_traits/has_nothrow_constructor.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/type_traits/is_default_constructible.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/type_traits/has_nothrow_copy.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/type_traits/is_copy_constructible.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/type_traits/is_constructible.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/type_traits/is_destructible.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/type_traits/has_nothrow_destructor.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/type_traits/has_trivial_destructor.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/type_traits/has_plus.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/type_traits/has_plus_assign.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/type_traits/has_post_decrement.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/type_traits/detail/has_postfix_operator.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/type_traits/has_post_increment.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/type_traits/has_pre_decrement.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/type_traits/has_pre_increment.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/type_traits/has_right_shift.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/type_traits/has_right_shift_assign.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/type_traits/has_trivial_assign.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/type_traits/has_trivial_constructor.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/type_traits/has_trivial_copy.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/type_traits/has_trivial_move_assign.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/type_traits/has_trivial_move_constructor.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/type_traits/has_unary_minus.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/type_traits/has_unary_plus.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/type_traits/has_virtual_destructor.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/type_traits/is_complex.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/type_traits/is_compound.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/type_traits/is_copy_assignable.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/noncopyable.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/core/noncopyable.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/type_traits/is_empty.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/type_traits/is_final.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/type_traits/is_float.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/type_traits/is_member_object_pointer.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/type_traits/is_nothrow_move_assignable.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/utility/enable_if.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/core/enable_if.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/type_traits/is_nothrow_move_constructible.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/type_traits/is_object.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/type_traits/is_polymorphic.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/type_traits/is_signed.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/type_traits/is_stateless.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/type_traits/is_union.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/type_traits/is_unsigned.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/type_traits/is_virtual_base_of.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/type_traits/make_signed.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/type_traits/make_unsigned.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/type_traits/rank.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/type_traits/remove_all_extents.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/type_traits/remove_volatile.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/type_traits/type_identity.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/type_traits/integral_promotion.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/type_traits/promote.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/AthContainers/DataVector.icc /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/AthContainers/tools/CompareAndPrint.h /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/AthLinks/ElementLink.h /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/AthLinks/ElementLinkBase.h /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/AthLinks/tools/TypeTools.h /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/AthLinks/ElementLink.icc /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/xAODCore/BaseInfo.h /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/xAODTruth/TruthEvent.h /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/xAODTruth/versions/TruthEvent_v1.h /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/xAODBase/ObjectType.h /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/xAODTruth/TruthEventBase.h /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/xAODTruth/versions/TruthEventBase_v1.h /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/xAODTruth/TruthParticleContainer.h /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/xAODTruth/TruthParticle.h /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/xAODTruth/versions/TruthParticle_v1.h /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/xAODBase/IParticle.h /cvmfs/atlas.cern.ch/repo/ATLASLocalRootBase/x86_64/root/6.04.16-x86_64-slc6-gcc49-opt/include/TLorentzVector.h /cvmfs/atlas.cern.ch/repo/ATLASLocalRootBase/x86_64/root/6.04.16-x86_64-slc6-gcc49-opt/include/TMath.h /cvmfs/atlas.cern.ch/repo/ATLASLocalRootBase/x86_64/root/6.04.16-x86_64-slc6-gcc49-opt/include/TError.h /cvmfs/atlas.cern.ch/repo/ATLASLocalRootBase/x86_64/root/6.04.16-x86_64-slc6-gcc49-opt/include/TVector3.h /cvmfs/atlas.cern.ch/repo/ATLASLocalRootBase/x86_64/root/6.04.16-x86_64-slc6-gcc49-opt/include/TVector2.h /cvmfs/atlas.cern.ch/repo/ATLASLocalRootBase/x86_64/root/6.04.16-x86_64-slc6-gcc49-opt/include/TMatrix.h /cvmfs/atlas.cern.ch/repo/ATLASLocalRootBase/x86_64/root/6.04.16-x86_64-slc6-gcc49-opt/include/TMatrixF.h /cvmfs/atlas.cern.ch/repo/ATLASLocalRootBase/x86_64/root/6.04.16-x86_64-slc6-gcc49-opt/include/TMatrixT.h /cvmfs/atlas.cern.ch/repo/ATLASLocalRootBase/x86_64/root/6.04.16-x86_64-slc6-gcc49-opt/include/TMatrixTBase.h /cvmfs/atlas.cern.ch/repo/ATLASLocalRootBase/x86_64/root/6.04.16-x86_64-slc6-gcc49-opt/include/TMatrixFBasefwd.h /cvmfs/atlas.cern.ch/repo/ATLASLocalRootBase/x86_64/root/6.04.16-x86_64-slc6-gcc49-opt/include/TMatrixDBasefwd.h /cvmfs/atlas.cern.ch/repo/ATLASLocalRootBase/x86_64/root/6.04.16-x86_64-slc6-gcc49-opt/include/TVectorFfwd.h /cvmfs/atlas.cern.ch/repo/ATLASLocalRootBase/x86_64/root/6.04.16-x86_64-slc6-gcc49-opt/include/TVectorDfwd.h /cvmfs/atlas.cern.ch/repo/ATLASLocalRootBase/x86_64/root/6.04.16-x86_64-slc6-gcc49-opt/include/TMatrixTUtils.h /cvmfs/atlas.cern.ch/repo/ATLASLocalRootBase/x86_64/root/6.04.16-x86_64-slc6-gcc49-opt/include/TMatrixFfwd.h /cvmfs/atlas.cern.ch/repo/ATLASLocalRootBase/x86_64/root/6.04.16-x86_64-slc6-gcc49-opt/include/TMatrixFUtils.h /cvmfs/atlas.cern.ch/repo/ATLASLocalRootBase/x86_64/root/6.04.16-x86_64-slc6-gcc49-opt/include/TMatrixFUtilsfwd.h /cvmfs/atlas.cern.ch/repo/ATLASLocalRootBase/x86_64/root/6.04.16-x86_64-slc6-gcc49-opt/include/TRotation.h /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/xAODBase/ObjectType.h /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/xAODTruth/TruthVertexContainerFwd.h /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/xAODTruth/TruthVertexFwd.h /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/xAODTruth/versions/TruthParticleContainer_v1.h /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/xAODBase/IParticleContainer.h /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/xAODTruth/TruthParticleContainerFwd.h /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/xAODTruth/TruthParticleFwd.h /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/xAODTruth/TruthVertexContainer.h /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/xAODTruth/TruthVertex.h /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/xAODTruth/versions/TruthVertex_v1.h /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/xAODTruth/versions/TruthVertexContainer_v1.h /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/xAODTruth/TruthEventContainer.h /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/xAODTruth/TruthEventBaseContainer.h /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/xAODTruth/versions/TruthEventBaseContainer_v1.h /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/xAODTruth/versions/TruthEventContainer_v1.h /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/AsgTools/ToolHandle.h /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/AsgTools/AsgToolsConf.h /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/AsgTools/StatusCode.h /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/AsgTools/Check.h /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/AsgTools/MsgStreamMacros.h /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/AsgTools/MsgLevel.h /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/AsgTools/ToolHandle.icc /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/AsgTools/ToolStore.h /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/AsgTools/IAsgTool.h /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/AsgTools/AsgToolMacros.h /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/TruthWeightTools/TruthWeightTools/TruthWeightTool.h /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/AsgTools/AsgMetadataTool.h /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/AsgTools/AsgTool.h /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/AsgTools/AsgMessaging.h /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/AsgTools/MsgStream.h /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/AsgTools/SgTEvent.h /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/AsgTools/SgTEvent.icc /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/xAODRootAccess/TStore.h /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/AthContainers/ConstDataVector.h /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/AthContainers/ConstDataVector.icc /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/iterator/transform_iterator.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/utility/result_of.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/preprocessor/iteration/iterate.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/preprocessor/slot/slot.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/preprocessor/slot/detail/def.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/preprocessor/repetition/enum_binary_params.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/preprocessor/repetition/enum_shifted_params.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/preprocessor/facilities/intercept.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/utility/declval.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/preprocessor/iteration/detail/iter/forward1.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/preprocessor/iteration/detail/bounds/lower1.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/preprocessor/slot/detail/shared.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/preprocessor/iteration/detail/bounds/upper1.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/boost/utility/detail/result_of_iterate.hpp /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/xAODRootAccess/TStore.icc /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/AthContainers/normalizedTypeinfoName.h /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/xAODRootAccess/tools/TDestructorRegistry.h /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/xAODRootAccess/tools/TDestructorRegistry.icc /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/xAODRootAccess/tools/TDestructor.h /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/xAODRootAccess/tools/TDestructor.icc /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/xAODRootAccess/tools/TCDVHolderT.h /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/xAODRootAccess/tools/THolder.h /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/xAODRootAccess/tools/TCDVHolderT.icc /cvmfs/atlas.cern.ch/repo/ATLASLocalRootBase/x86_64/root/6.04.16-x86_64-slc6-gcc49-opt/include/TClass.h /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/AsgTools/AsgTool.icc /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/AsgTools/PropertyMgr.h /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/AsgTools/Property.h /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/AsgTools/PropertyMgr.icc /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/AsgTools/TProperty.h /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/AsgTools/ToolHandleArray.h /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/AsgTools/ToolHandleArray.icc /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/AsgTools/TProperty.icc /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/AsgTools/SetProperty.h /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/AsgTools/SgTEventMeta.h /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/AsgTools/SgTEventMeta.icc /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/xAODRootAccess/TVirtualIncidentListener.h /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/xAODRootAccess/tools/TIncident.h /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/AsgTools/AsgMetadataTool.icc /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/TruthWeightTools/TruthWeightTools/ITruthWeightTool.h /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/TruthWeightTools/TruthWeightTools/IndexRetriever.h /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/xAODTruth/TruthMetaData.h /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/xAODTruth/versions/TruthMetaData_v1.h /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/xAODTruth/TruthMetaDataContainer.h /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/RootCoreBin/include/xAODTruth/versions/TruthMetaDataContainer_v1.h /afs/cern.ch/work/m/mmittal/private/MyAnalysisCode/TruthWeightTools/TruthWeightTools/HiggsWeightTool.h /cvmfs/atlas.cern.ch/repo/ATLASLocalRootBase/x86_64/root/6.04.16-x86_64-slc6-gcc49-opt/include/TRandom3.h /cvmfs/atlas.cern.ch/repo/ATLASLocalRootBase/x86_64/root/6.04.16-x86_64-slc6-gcc49-opt/include/TRandom.h /cvmfs/atlas.cern.ch/repo/ATLASLocalRootBase/x86_64/root/6.04.16-x86_64-slc6-gcc49-opt/include/TH1F.h /cvmfs/atlas.cern.ch/repo/ATLASLocalRootBase/x86_64/root/6.04.16-x86_64-slc6-gcc49-opt/include/TH1.h /cvmfs/atlas.cern.ch/repo/ATLASLocalRootBase/x86_64/root/6.04.16-x86_64-slc6-gcc49-opt/include/TAxis.h /cvmfs/atlas.cern.ch/repo/ATLASLocalRootBase/x86_64/root/6.04.16-x86_64-slc6-gcc49-opt/include/TAttAxis.h /cvmfs/atlas.cern.ch/repo/ATLASLocalRootBase/x86_64/root/6.04.16-x86_64-slc6-gcc49-opt/include/TArrayC.h /cvmfs/atlas.cern.ch/repo/ATLASLocalRootBase/x86_64/root/6.04.16-x86_64-slc6-gcc49-opt/include/TArrayS.h /cvmfs/atlas.cern.ch/repo/ATLASLocalRootBase/x86_64/root/6.04.16-x86_64-slc6-gcc49-opt/include/TArrayF.h /cvmfs/atlas.cern.ch/repo/ATLASLocalRootBase/x86_64/root/6.04.16-x86_64-slc6-gcc49-opt/include/Foption.h /cvmfs/atlas.cern.ch/repo/ATLASLocalRootBase/x86_64/root/6.04.16-x86_64-slc6-gcc49-opt/include/TFitResultPtr.h
| D |
module oxy.buffer;
import core.atomic;
import core.thread;
import std.stdio;
/**
* One-producer one-consumer lockless ring buffer implementation.
**/
class OPOCRingBuffer(T)
{
size_t capacity;
private
{
size_t mask;
shared size_t writei;
shared size_t readi;
T[] buffer;
}
this(size_t capacity)
{
this.buffer = new T[](capacity);
this.capacity = capacity;
this.mask = capacity - 1;
this.clear();
}
@property const bool empty()
{
atomicFence();
return this.readi == this.writei;
}
void clear()
{
atomicStore(this.readi, cast(size_t)0);
atomicStore(this.writei, cast(size_t)0);
}
bool enqueue(in T item)
{
const auto tail = atomicLoad(this.writei);
const auto nexttail = (tail + 1) & this.mask;
if (nexttail != atomicLoad(this.readi))
{
this.buffer[tail] = item;
atomicStore(this.writei, nexttail);
return true;
}
return false;
}
void forceEnqueue(in T item)
{
while (!this.enqueue(item)) { Thread.yield(); }
}
bool tryEnqueue(in T item, ref int spins)
{
while (spins--)
{
if (this.enqueue(item))
return true;
else
Thread.yield();
}
return false;
}
bool dequeue(out T output)
{
auto head = atomicLoad(this.readi);
if (head == atomicLoad(this.writei))
{
return false;
}
output = this.buffer[head];
atomicStore(this.readi, (head + 1) & this.mask);
return true;
}
void forceDequeue(out T output)
{
while (!this.dequeue(output)) { Thread.yield(); }
}
bool tryDequeue(out T output, ref int spins)
{
while (spins--)
{
if (this.dequeue(output))
return true;
else
Thread.yield();
}
return false;
}
}
alias Sample = float[2];
alias SampleBuffer = OPOCRingBuffer!(Sample);
| D |
module hunt.database.driver.mysql.impl.MySQLConnectionImpl;
import hunt.database.driver.mysql.impl.MySQLConnectionFactory;
import hunt.database.driver.mysql.impl.MySQLCollation;
import hunt.database.driver.mysql.MySQLConnectOptions;
import hunt.database.driver.mysql.MySQLConnection;
import hunt.database.driver.mysql.MySQLSetOption;
import hunt.database.driver.mysql.impl.command.ChangeUserCommand;
import hunt.database.driver.mysql.impl.command.DebugCommand;
import hunt.database.driver.mysql.impl.command.InitDbCommand;
import hunt.database.driver.mysql.impl.command.PingCommand;
import hunt.database.driver.mysql.impl.command.ResetConnectionCommand;
import hunt.database.driver.mysql.impl.command.SetOptionCommand;
import hunt.database.driver.mysql.impl.command.StatisticsCommand;
import hunt.database.driver.mysql.MySQLUtil;
import hunt.database.base.AsyncResult;
import hunt.database.base.Common;
import hunt.database.base.Transaction;
import hunt.database.base.impl.Connection;
import hunt.database.base.impl.command.CommandResponse;
import hunt.database.base.impl.command.PrepareStatementCommand;
import hunt.database.base.impl.NamedQueryDesc;
import hunt.database.base.impl.SqlConnectionImpl;
import hunt.logging.ConsoleLogger;
import hunt.collection.List;
import hunt.concurrency.Future;
import hunt.concurrency.FuturePromise;
import hunt.Exceptions;
alias MySQLNamedQueryDesc = NamedQueryDesc!("?", false);
/**
*
*/
class MySQLConnectionImpl : SqlConnectionImpl!(MySQLConnectionImpl), MySQLConnection {
static void connect(MySQLConnectOptions options, AsyncResultHandler!(MySQLConnection) handler) {
MySQLConnectionFactory client = new MySQLConnectionFactory(options);
version(HUNT_DB_DEBUG) trace("connecting ...");
client.connect( (ar) {
version(HUNT_DB_DEBUG) info("connection result: ", ar.succeeded());
if (ar.succeeded()) {
DbConnection conn = ar.result();
MySQLConnectionImpl p = new MySQLConnectionImpl(client, conn);
conn.initHolder(p);
if(handler !is null) {
handler(succeededResult!(MySQLConnection)(p));
}
} else if(handler !is null) {
handler(failedResult!(MySQLConnection)(ar.cause()));
}
});
}
private MySQLConnectionFactory factory;
this(MySQLConnectionFactory factory, DbConnection conn) {
super(conn);
this.factory = factory;
}
override
void handleNotification(int processId, string channel, string payload) {
throw new UnsupportedOperationException();
}
override
MySQLConnection ping(AsyncVoidHandler handler) {
PingCommand cmd = new PingCommand();
cmd.handler = (r) { handler(r); };
schedule(cmd);
return this;
}
override
MySQLConnection specifySchema(string schemaName, AsyncVoidHandler handler) {
InitDbCommand cmd = new InitDbCommand(schemaName);
cmd.handler = (r) { handler(r); };
schedule(cmd);
return this;
}
override
MySQLConnection getInternalStatistics(AsyncResultHandler!(string) handler) {
StatisticsCommand cmd = new StatisticsCommand();
cmd.handler = (r) { handler(r); };
schedule(cmd);
return this;
}
override
MySQLConnection setOption(MySQLSetOption option, AsyncVoidHandler handler) {
SetOptionCommand cmd = new SetOptionCommand(option);
cmd.handler = (r) { handler(r); };
schedule(cmd);
return this;
}
override
MySQLConnection resetConnection(AsyncVoidHandler handler) {
ResetConnectionCommand cmd = new ResetConnectionCommand();
cmd.handler = (r) { handler(r); };
schedule(cmd);
return this;
}
override
MySQLConnection dumpDebug(AsyncVoidHandler handler) {
DebugCommand cmd = new DebugCommand();
cmd.handler = (r) { handler(r); };
schedule(cmd);
return this;
}
override
MySQLConnection changeUser(MySQLConnectOptions options, AsyncVoidHandler handler) {
MySQLCollation collation;
try {
collation = MySQLCollation.valueOfName(options.getCollation());
} catch (IllegalArgumentException e) {
handler(failedResult!(Object)(e));
return this;
}
ChangeUserCommand cmd = new ChangeUserCommand(options.getUser(), options.getPassword(),
options.getDatabase(), collation, options.getProperties());
cmd.handler = (r) { handler(r); };
schedule(cmd);
return this;
}
// override protected AbstractNamedQueryDesc getNamedQueryDesc(string sql) {
// return new MySQLNamedQueryDesc(sql);
// }
// protected AbstractNamedQueryDesc getNamedQueryDesc(string sql) {
// throw new NotImplementedException("getNamedQueryDesc");
// }
Future!NamedQuery prepareNamedQueryAsync(string sql) {
version(HUNT_DB_DEBUG) trace(sql);
auto f = new FuturePromise!NamedQuery();
AbstractNamedQueryDesc queryDesc = new MySQLNamedQueryDesc(sql);
scheduleThen!(PreparedStatement)(new PrepareStatementCommand(queryDesc.getSql()),
(CommandResponse!PreparedStatement ar) {
if (ar.succeeded()) {
NamedQueryImpl queryImpl = new MySQLNamedQueryImpl(conn, ar.result(), queryDesc);
f.succeeded(queryImpl);
} else {
f.failed(cast(Exception)ar.cause());
}
}
);
return f;
}
NamedQuery prepareNamedQuery(string sql) {
auto f = prepareNamedQueryAsync(sql);
return f.get();
}
string escapeIdentifier(string identifier) {
// TODO: Tasks pending completion -@zxp at Fri, 20 Sep 2019 02:44:54 GMT
//
return identifier;
}
string escapeLiteral(string literal) {
return MySQLUtil.escapeLiteral(literal);
}
}
import hunt.database.driver.mysql.impl.codec.MySQLRowDesc;
import hunt.database.base.impl.NamedQueryDesc;
import hunt.database.base.impl.NamedQueryImpl;
import hunt.database.base.impl.PreparedQueryImpl;
import hunt.database.base.impl.RowDesc;
import hunt.database.base.impl.ArrayTuple;
import hunt.database.base.impl.Connection;
import hunt.database.base.impl.ParamDesc;
import hunt.database.base.impl.PreparedStatement;
import hunt.database.base.PreparedQuery;
import hunt.database.base.RowSet;
import std.variant;
/**
*
*/
class MySQLNamedQueryImpl : NamedQueryImpl {
this(DbConnection conn, PreparedStatement ps, AbstractNamedQueryDesc queryDesc) {
super(conn, ps, queryDesc);
}
void setParameter(string name, Variant value) {
version(HUNT_DEBUG) {
auto itemPtr = name in _parameters;
if(itemPtr !is null) {
warning("% will be overwrited with %s", name, value.toString());
}
}
// TODO: Tasks pending completion -@zhangxueping at 2019-10-01T13:35:23+08:00
// validate the type of parameter
// hunt.database.driver.mysql.impl.codec.ColumnDefinition;
// getPreparedStatement().paramDesc();
// MySQLRowDesc rowDesc = cast(MySQLRowDesc)getPreparedStatement().rowDesc();
// warning(rowDesc.toString());
// ParamDesc pd = getPreparedStatement().paramDesc();
// warning(pd.toString());
_parameters[name] = value;
}
} | D |
/**
* Convert statements to Intermediate Representation (IR) for the back-end.
*
* Copyright: Copyright (C) 1999-2020 by The D Language Foundation, All Rights Reserved
* Authors: $(LINK2 http://www.digitalmars.com, Walter Bright)
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
* Source: $(LINK2 https://github.com/dlang/dmd/blob/master/src/tocsym.d, _s2ir.d)
* Documentation: $(LINK https://dlang.org/phobos/dmd_s2ir.html)
* Coverage: $(LINK https://codecov.io/gh/dlang/dmd/src/master/src/dmd/s2ir.d)
*/
module dmd.s2ir;
import core.stdc.stdio;
import core.stdc.string;
import core.stdc.stddef;
import core.stdc.stdlib;
import core.stdc.time;
import dmd.root.array;
import dmd.root.rmem;
import dmd.root.rootobject;
import dmd.aggregate;
import dmd.dclass;
import dmd.declaration;
import dmd.denum;
import dmd.dmodule;
import dmd.dsymbol;
import dmd.dstruct;
import dmd.dtemplate;
import dmd.e2ir;
import dmd.errors;
import dmd.expression;
import dmd.func;
import dmd.globals;
import dmd.glue;
import dmd.id;
import dmd.init;
import dmd.mtype;
import dmd.statement;
import dmd.stmtstate;
import dmd.target;
import dmd.toctype;
import dmd.tocsym;
import dmd.toir;
import dmd.tokens;
import dmd.visitor;
import dmd.backend.cc;
import dmd.backend.cdef;
import dmd.backend.cgcv;
import dmd.backend.code;
import dmd.backend.code_x86;
import dmd.backend.cv4;
import dmd.backend.dlist;
import dmd.backend.dt;
import dmd.backend.el;
import dmd.backend.global;
import dmd.backend.obj;
import dmd.backend.oper;
import dmd.backend.rtlsym;
import dmd.backend.symtab;
import dmd.backend.ty;
import dmd.backend.type;
extern (C++):
alias toSymbol = dmd.tocsym.toSymbol;
alias toSymbol = dmd.glue.toSymbol;
alias StmtState = dmd.stmtstate.StmtState!block;
void elem_setLoc(elem *e, const ref Loc loc) pure nothrow
{
srcpos_setLoc(e.Esrcpos, loc);
}
private void block_setLoc(block *b, const ref Loc loc) pure nothrow
{
srcpos_setLoc(b.Bsrcpos, loc);
}
private void srcpos_setLoc(ref Srcpos s, const ref Loc loc) pure nothrow
{
s.set(loc.filename, loc.linnum, loc.charnum);
}
/***********************************************
* Generate code to set index into scope table.
*/
private void setScopeIndex(Blockx *blx, block *b, int scope_index)
{
if (config.ehmethod == EHmethod.EH_WIN32 && !(blx.funcsym.Sfunc.Fflags3 & Feh_none))
block_appendexp(b, nteh_setScopeTableIndex(blx, scope_index));
}
/****************************************
* Allocate a new block, and set the tryblock.
*/
private block *block_calloc(Blockx *blx)
{
block *b = dmd.backend.global.block_calloc();
b.Btry = blx.tryblock;
return b;
}
/**************************************
* Add in code to increment usage count for linnum.
*/
private void incUsage(IRState *irs, const ref Loc loc)
{
if (irs.params.cov && loc.linnum)
{
block_appendexp(irs.blx.curblock, incUsageElem(irs, loc));
}
}
private extern (C++) class S2irVisitor : Visitor
{
IRState* irs;
StmtState* stmtstate;
this(IRState *irs, StmtState* stmtstate)
{
this.irs = irs;
this.stmtstate = stmtstate;
}
alias visit = Visitor.visit;
/****************************************
* This should be overridden by each statement class.
*/
override void visit(Statement s)
{
assert(0);
}
/*************************************
*/
override void visit(ScopeGuardStatement s)
{
}
/****************************************
*/
override void visit(IfStatement s)
{
elem *e;
Blockx *blx = irs.blx;
//printf("IfStatement.toIR('%s')\n", s.condition.toChars());
StmtState mystate = StmtState(stmtstate, s);
// bexit is the block that gets control after this IfStatement is done
block *bexit = mystate.breakBlock ? mystate.breakBlock : dmd.backend.global.block_calloc();
incUsage(irs, s.loc);
e = toElemDtor(s.condition, irs);
block_appendexp(blx.curblock, e);
block *bcond = blx.curblock;
block_next(blx, BCiftrue, null);
bcond.appendSucc(blx.curblock);
if (s.ifbody)
Statement_toIR(s.ifbody, irs, &mystate);
blx.curblock.appendSucc(bexit);
if (s.elsebody)
{
block_next(blx, BCgoto, null);
bcond.appendSucc(blx.curblock);
Statement_toIR(s.elsebody, irs, &mystate);
blx.curblock.appendSucc(bexit);
}
else
bcond.appendSucc(bexit);
block_next(blx, BCgoto, bexit);
}
/**************************************
*/
override void visit(PragmaStatement s)
{
//printf("PragmaStatement.toIR()\n");
if (s.ident == Id.startaddress)
{
assert(s.args && s.args.dim == 1);
Expression e = (*s.args)[0];
Dsymbol sa = getDsymbol(e);
FuncDeclaration f = sa.isFuncDeclaration();
assert(f);
Symbol *sym = toSymbol(f);
irs.startaddress = sym;
}
}
/***********************
*/
override void visit(WhileStatement s)
{
assert(0); // was "lowered"
}
/******************************************
*/
override void visit(DoStatement s)
{
Blockx *blx = irs.blx;
StmtState mystate = StmtState(stmtstate, s);
mystate.breakBlock = block_calloc(blx);
mystate.contBlock = block_calloc(blx);
block *bpre = blx.curblock;
block_next(blx, BCgoto, null);
bpre.appendSucc(blx.curblock);
mystate.contBlock.appendSucc(blx.curblock);
mystate.contBlock.appendSucc(mystate.breakBlock);
if (s._body)
Statement_toIR(s._body, irs, &mystate);
blx.curblock.appendSucc(mystate.contBlock);
block_next(blx, BCgoto, mystate.contBlock);
incUsage(irs, s.condition.loc);
block_appendexp(mystate.contBlock, toElemDtor(s.condition, irs));
block_next(blx, BCiftrue, mystate.breakBlock);
}
/*****************************************
*/
override void visit(ForStatement s)
{
//printf("visit(ForStatement)) %u..%u\n", s.loc.linnum, s.endloc.linnum);
Blockx *blx = irs.blx;
StmtState mystate = StmtState(stmtstate, s);
mystate.breakBlock = block_calloc(blx);
mystate.contBlock = block_calloc(blx);
if (s._init)
Statement_toIR(s._init, irs, &mystate);
block *bpre = blx.curblock;
block_next(blx,BCgoto,null);
block *bcond = blx.curblock;
bpre.appendSucc(bcond);
mystate.contBlock.appendSucc(bcond);
if (s.condition)
{
incUsage(irs, s.condition.loc);
block_appendexp(bcond, toElemDtor(s.condition, irs));
block_next(blx,BCiftrue,null);
bcond.appendSucc(blx.curblock);
bcond.appendSucc(mystate.breakBlock);
}
else
{ /* No conditional, it's a straight goto
*/
block_next(blx,BCgoto,null);
bcond.appendSucc(blx.curblock);
}
if (s._body)
Statement_toIR(s._body, irs, &mystate);
/* End of the body goes to the continue block
*/
blx.curblock.appendSucc(mystate.contBlock);
block_setLoc(blx.curblock, s.endloc);
block_next(blx, BCgoto, mystate.contBlock);
if (s.increment)
{
incUsage(irs, s.increment.loc);
block_appendexp(mystate.contBlock, toElemDtor(s.increment, irs));
}
/* The 'break' block follows the for statement.
*/
block_next(blx,BCgoto, mystate.breakBlock);
}
/**************************************
*/
override void visit(ForeachStatement s)
{
printf("ForeachStatement.toIR() %s\n", s.toChars());
assert(0); // done by "lowering" in the front end
}
/**************************************
*/
override void visit(ForeachRangeStatement s)
{
assert(0);
}
/****************************************
*/
override void visit(BreakStatement s)
{
block *bbreak;
block *b;
Blockx *blx = irs.blx;
bbreak = stmtstate.getBreakBlock(s.ident);
assert(bbreak);
b = blx.curblock;
incUsage(irs, s.loc);
// Adjust exception handler scope index if in different try blocks
if (b.Btry != bbreak.Btry)
{
//setScopeIndex(blx, b, bbreak.Btry ? bbreak.Btry.Bscope_index : -1);
}
/* Nothing more than a 'goto' to the current break destination
*/
b.appendSucc(bbreak);
block_setLoc(b, s.loc);
block_next(blx, BCgoto, null);
}
/************************************
*/
override void visit(ContinueStatement s)
{
block *bcont;
block *b;
Blockx *blx = irs.blx;
//printf("ContinueStatement.toIR() %p\n", this);
bcont = stmtstate.getContBlock(s.ident);
assert(bcont);
b = blx.curblock;
incUsage(irs, s.loc);
// Adjust exception handler scope index if in different try blocks
if (b.Btry != bcont.Btry)
{
//setScopeIndex(blx, b, bcont.Btry ? bcont.Btry.Bscope_index : -1);
}
/* Nothing more than a 'goto' to the current continue destination
*/
b.appendSucc(bcont);
block_setLoc(b, s.loc);
block_next(blx, BCgoto, null);
}
/**************************************
*/
override void visit(GotoStatement s)
{
Blockx *blx = irs.blx;
assert(s.label.statement);
assert(s.tf == s.label.statement.tf);
block* bdest = cast(block*)s.label.statement.extra;
block *b = blx.curblock;
incUsage(irs, s.loc);
b.appendSucc(bdest);
block_setLoc(b, s.loc);
block_next(blx,BCgoto,null);
}
override void visit(LabelStatement s)
{
//printf("LabelStatement.toIR() %p, statement: `%s`\n", this, s.statement.toChars());
Blockx *blx = irs.blx;
block *bc = blx.curblock;
StmtState mystate = StmtState(stmtstate, s);
mystate.ident = s.ident;
block* bdest = cast(block*)s.extra;
// At last, we know which try block this label is inside
bdest.Btry = blx.tryblock;
block_next(blx, BCgoto, bdest);
bc.appendSucc(blx.curblock);
if (s.statement)
Statement_toIR(s.statement, irs, &mystate);
}
/**************************************
*/
override void visit(SwitchStatement s)
{
Blockx *blx = irs.blx;
//printf("SwitchStatement.toIR()\n");
StmtState mystate = StmtState(stmtstate, s);
mystate.switchBlock = blx.curblock;
/* Block for where "break" goes to
*/
mystate.breakBlock = block_calloc(blx);
/* Block for where "default" goes to.
* If there is a default statement, then that is where default goes.
* If not, then do:
* default: break;
* by making the default block the same as the break block.
*/
mystate.defaultBlock = s.sdefault ? block_calloc(blx) : mystate.breakBlock;
const numcases = s.cases ? s.cases.dim : 0;
/* allocate a block for each case
*/
if (numcases)
foreach (cs; *s.cases)
{
cs.extra = cast(void*)block_calloc(blx);
}
incUsage(irs, s.loc);
elem *econd = toElemDtor(s.condition, irs);
if (s.hasVars)
{ /* Generate a sequence of if-then-else blocks for the cases.
*/
if (econd.Eoper != OPvar)
{
elem *e = exp2_copytotemp(econd);
block_appendexp(mystate.switchBlock, e);
econd = e.EV.E2;
}
if (numcases)
foreach (cs; *s.cases)
{
elem *ecase = toElemDtor(cs.exp, irs);
elem *e = el_bin(OPeqeq, TYbool, el_copytree(econd), ecase);
block *b = blx.curblock;
block_appendexp(b, e);
block* cb = cast(block*)cs.extra;
block_next(blx, BCiftrue, null);
b.appendSucc(cb);
b.appendSucc(blx.curblock);
}
/* The final 'else' clause goes to the default
*/
block *b = blx.curblock;
block_next(blx, BCgoto, null);
b.appendSucc(mystate.defaultBlock);
Statement_toIR(s._body, irs, &mystate);
/* Have the end of the switch body fall through to the block
* following the switch statement.
*/
block_goto(blx, BCgoto, mystate.breakBlock);
return;
}
if (s.condition.type.isString())
{
// This codepath was replaced by lowering during semantic
// to object.__switch in druntime.
assert(0);
}
block_appendexp(mystate.switchBlock, econd);
block_next(blx,BCswitch,null);
// Corresponding free is in block_free
alias TCase = typeof(mystate.switchBlock.Bswitch[0]);
auto pu = cast(TCase *)Mem.check(.malloc(TCase.sizeof * (numcases + 1)));
mystate.switchBlock.Bswitch = pu;
/* First pair is the number of cases, and the default block
*/
*pu++ = numcases;
mystate.switchBlock.appendSucc(mystate.defaultBlock);
/* Fill in the first entry for each pair, which is the case value.
* CaseStatement.toIR() will fill in
* the second entry for each pair with the block.
*/
if (numcases)
foreach (cs; *s.cases)
*pu++ = cs.exp.toInteger();
Statement_toIR(s._body, irs, &mystate);
/* Have the end of the switch body fall through to the block
* following the switch statement.
*/
block_goto(blx, BCgoto, mystate.breakBlock);
}
override void visit(CaseStatement s)
{
Blockx *blx = irs.blx;
block *bcase = blx.curblock;
block* cb = cast(block*)s.extra;
block_next(blx, BCgoto, cb);
block *bsw = stmtstate.getSwitchBlock();
if (bsw.BC == BCswitch)
bsw.appendSucc(cb); // second entry in pair
bcase.appendSucc(cb);
incUsage(irs, s.loc);
if (s.statement)
Statement_toIR(s.statement, irs, stmtstate);
}
override void visit(DefaultStatement s)
{
Blockx *blx = irs.blx;
block *bcase = blx.curblock;
block *bdefault = stmtstate.getDefaultBlock();
block_next(blx,BCgoto,bdefault);
bcase.appendSucc(blx.curblock);
incUsage(irs, s.loc);
if (s.statement)
Statement_toIR(s.statement, irs, stmtstate);
}
override void visit(GotoDefaultStatement s)
{
block *b;
Blockx *blx = irs.blx;
block *bdest = stmtstate.getDefaultBlock();
b = blx.curblock;
// The rest is equivalent to GotoStatement
b.appendSucc(bdest);
incUsage(irs, s.loc);
block_next(blx,BCgoto,null);
}
override void visit(GotoCaseStatement s)
{
Blockx *blx = irs.blx;
block *bdest = cast(block*)s.cs.extra;
block *b = blx.curblock;
// The rest is equivalent to GotoStatement
b.appendSucc(bdest);
incUsage(irs, s.loc);
block_next(blx,BCgoto,null);
}
override void visit(SwitchErrorStatement s)
{
// SwitchErrors are lowered to a CallExpression to object.__switch_error() in druntime
// We still need the call wrapped in SwitchErrorStatement to pass compiler error checks.
assert(s.exp !is null, "SwitchErrorStatement needs to have a valid Expression.");
Blockx *blx = irs.blx;
//printf("SwitchErrorStatement.toIR(), exp = %s\n", s.exp ? s.exp.toChars() : "");
incUsage(irs, s.loc);
block_appendexp(blx.curblock, toElemDtor(s.exp, irs));
}
/**************************************
*/
override void visit(ReturnStatement s)
{
//printf("s2ir.ReturnStatement: %s\n", s.toChars());
Blockx *blx = irs.blx;
BC bc;
incUsage(irs, s.loc);
if (s.exp)
{
elem *e;
FuncDeclaration func = irs.getFunc();
assert(func);
auto tf = func.type.isTypeFunction();
assert(tf);
RET retmethod = retStyle(tf, func.needThis());
if (retmethod == RET.stack)
{
elem *es;
bool writetohp;
/* If returning struct literal, write result
* directly into return value
*/
if (auto sle = s.exp.isStructLiteralExp())
{
sle.sym = irs.shidden;
writetohp = true;
}
/* Detect function call that returns the same struct
* and construct directly into *shidden
*/
else if (auto ce = s.exp.isCallExp())
{
if (ce.e1.op == TOK.variable || ce.e1.op == TOK.star)
{
Type t = ce.e1.type.toBasetype();
if (t.ty == Tdelegate)
t = t.nextOf();
if (t.ty == Tfunction && retStyle(cast(TypeFunction)t, ce.f && ce.f.needThis()) == RET.stack)
{
irs.ehidden = el_var(irs.shidden);
e = toElemDtor(s.exp, irs);
e = el_una(OPaddr, TYnptr, e);
goto L1;
}
}
else if (auto dve = ce.e1.isDotVarExp())
{
auto fd = dve.var.isFuncDeclaration();
if (fd && fd.isCtorDeclaration())
{
if (auto sle = dve.e1.isStructLiteralExp())
{
sle.sym = irs.shidden;
writetohp = true;
}
}
Type t = ce.e1.type.toBasetype();
if (t.ty == Tdelegate)
t = t.nextOf();
if (t.ty == Tfunction && retStyle(cast(TypeFunction)t, fd && fd.needThis()) == RET.stack)
{
irs.ehidden = el_var(irs.shidden);
e = toElemDtor(s.exp, irs);
e = el_una(OPaddr, TYnptr, e);
goto L1;
}
}
}
e = toElemDtor(s.exp, irs);
assert(e);
if (writetohp ||
(func.nrvo_can && func.nrvo_var))
{
// Return value via hidden pointer passed as parameter
// Write exp; return shidden;
es = e;
}
else
{
// Return value via hidden pointer passed as parameter
// Write *shidden=exp; return shidden;
es = el_una(OPind,e.Ety,el_var(irs.shidden));
es = elAssign(es, e, s.exp.type, null);
}
e = el_var(irs.shidden);
e = el_bin(OPcomma, e.Ety, es, e);
}
else if (tf.isref)
{
// Reference return, so convert to a pointer
e = toElemDtor(s.exp, irs);
/* already taken care of for vresult in buildResultVar() and semantic3.d
* https://issues.dlang.org/show_bug.cgi?id=19384
*/
if (func.vresult)
if (BlitExp be = s.exp.isBlitExp())
{
if (VarExp ve = be.e1.isVarExp())
{
if (ve.var == func.vresult)
goto Lskip;
}
}
e = addressElem(e, s.exp.type.pointerTo());
Lskip:
}
else
{
e = toElemDtor(s.exp, irs);
assert(e);
}
L1:
elem_setLoc(e, s.loc);
block_appendexp(blx.curblock, e);
bc = BCretexp;
// if (type_zeroCopy(Type_toCtype(s.exp.type)))
// bc = BCret;
}
else
bc = BCret;
block *finallyBlock;
if (config.ehmethod != EHmethod.EH_DWARF &&
!irs.isNothrow() &&
(finallyBlock = stmtstate.getFinallyBlock()) != null)
{
assert(finallyBlock.BC == BC_finally);
blx.curblock.appendSucc(finallyBlock);
}
block_next(blx, bc, null);
}
/**************************************
*/
override void visit(ExpStatement s)
{
Blockx *blx = irs.blx;
//printf("ExpStatement.toIR(), exp: %p %s\n", s.exp, s.exp ? s.exp.toChars() : "");
if (s.exp)
{
if (s.exp.hasCode)
incUsage(irs, s.loc);
block_appendexp(blx.curblock, toElemDtor(s.exp, irs));
}
}
/**************************************
*/
override void visit(CompoundStatement s)
{
if (s.statements)
{
foreach (s2; *s.statements)
{
if (s2)
Statement_toIR(s2, irs, stmtstate);
}
}
}
/**************************************
*/
override void visit(UnrolledLoopStatement s)
{
Blockx *blx = irs.blx;
StmtState mystate = StmtState(stmtstate, s);
mystate.breakBlock = block_calloc(blx);
block *bpre = blx.curblock;
block_next(blx, BCgoto, null);
block *bdo = blx.curblock;
bpre.appendSucc(bdo);
block *bdox;
foreach (s2; *s.statements)
{
if (s2)
{
mystate.contBlock = block_calloc(blx);
Statement_toIR(s2, irs, &mystate);
bdox = blx.curblock;
block_next(blx, BCgoto, mystate.contBlock);
bdox.appendSucc(mystate.contBlock);
}
}
bdox = blx.curblock;
block_next(blx, BCgoto, mystate.breakBlock);
bdox.appendSucc(mystate.breakBlock);
}
/**************************************
*/
override void visit(ScopeStatement s)
{
if (s.statement)
{
Blockx *blx = irs.blx;
StmtState mystate = StmtState(stmtstate, s);
if (mystate.prev.ident)
mystate.ident = mystate.prev.ident;
Statement_toIR(s.statement, irs, &mystate);
if (mystate.breakBlock)
block_goto(blx,BCgoto,mystate.breakBlock);
}
}
/***************************************
*/
override void visit(WithStatement s)
{
//printf("WithStatement.toIR()\n");
if (s.exp.op == TOK.scope_ || s.exp.op == TOK.type)
{
}
else
{
// Declare with handle
auto sp = toSymbol(s.wthis);
symbol_add(sp);
// Perform initialization of with handle
auto ie = s.wthis._init.isExpInitializer();
assert(ie);
auto ei = toElemDtor(ie.exp, irs);
auto e = el_var(sp);
e = el_bin(OPeq,e.Ety, e, ei);
elem_setLoc(e, s.loc);
incUsage(irs, s.loc);
block_appendexp(irs.blx.curblock,e);
}
// Execute with block
if (s._body)
Statement_toIR(s._body, irs, stmtstate);
}
/***************************************
*/
override void visit(ThrowStatement s)
{
// throw(exp)
Blockx *blx = irs.blx;
incUsage(irs, s.loc);
elem *e = toElemDtor(s.exp, irs);
const int rtlthrow = config.ehmethod == EHmethod.EH_DWARF ? RTLSYM_THROWDWARF : RTLSYM_THROWC;
e = el_bin(OPcall, TYvoid, el_var(getRtlsym(rtlthrow)),e);
block_appendexp(blx.curblock, e);
block_next(blx, BCexit, null); // throw never returns
}
/***************************************
* Builds the following:
* _try
* block
* jcatch
* handler
* A try-catch statement.
*/
override void visit(TryCatchStatement s)
{
Blockx *blx = irs.blx;
if (blx.funcsym.Sfunc.Fflags3 & Feh_none) printf("visit %s\n", blx.funcsym.Sident.ptr);
if (blx.funcsym.Sfunc.Fflags3 & Feh_none) assert(0);
if (config.ehmethod == EHmethod.EH_WIN32)
nteh_declarvars(blx);
StmtState mystate = StmtState(stmtstate, s);
block *tryblock = block_goto(blx,BCgoto,null);
int previndex = blx.scope_index;
tryblock.Blast_index = previndex;
blx.scope_index = tryblock.Bscope_index = blx.next_index++;
// Set the current scope index
setScopeIndex(blx,tryblock,tryblock.Bscope_index);
// This is the catch variable
tryblock.jcatchvar = symbol_genauto(type_fake(mTYvolatile | TYnptr));
blx.tryblock = tryblock;
block *breakblock = block_calloc(blx);
block_goto(blx,BC_try,null);
if (s._body)
{
Statement_toIR(s._body, irs, &mystate);
}
blx.tryblock = tryblock.Btry;
// break block goes here
block_goto(blx, BCgoto, breakblock);
setScopeIndex(blx,blx.curblock, previndex);
blx.scope_index = previndex;
// create new break block that follows all the catches
block *breakblock2 = block_calloc(blx);
blx.curblock.appendSucc(breakblock2);
block_next(blx,BCgoto,null);
assert(s.catches);
if (config.ehmethod == EHmethod.EH_DWARF)
{
/*
* BCjcatch:
* __hander = __RDX;
* __exception_object = __RAX;
* jcatchvar = *(__exception_object - target.ptrsize); // old way
* jcatchvar = __dmd_catch_begin(__exception_object); // new way
* switch (__handler)
* case 1: // first catch handler
* *(sclosure + cs.var.offset) = cs.var;
* ...handler body ...
* break;
* ...
* default:
* HALT
*/
// volatile so optimizer won't delete it
Symbol *seax = symbol_name("__EAX", SCpseudo, type_fake(mTYvolatile | TYnptr));
seax.Sreglsw = 0; // EAX, RAX, whatevs
symbol_add(seax);
Symbol *sedx = symbol_name("__EDX", SCpseudo, type_fake(mTYvolatile | TYint));
sedx.Sreglsw = 2; // EDX, RDX, whatevs
symbol_add(sedx);
Symbol *shandler = symbol_name("__handler", SCauto, tstypes[TYint]);
symbol_add(shandler);
Symbol *seo = symbol_name("__exception_object", SCauto, tspvoid);
symbol_add(seo);
elem *e1 = el_bin(OPeq, TYvoid, el_var(shandler), el_var(sedx)); // __handler = __RDX
elem *e2 = el_bin(OPeq, TYvoid, el_var(seo), el_var(seax)); // __exception_object = __RAX
version (none)
{
// jcatchvar = *(__exception_object - target.ptrsize)
elem *e = el_bin(OPmin, TYnptr, el_var(seo), el_long(TYsize_t, target.ptrsize));
elem *e3 = el_bin(OPeq, TYvoid, el_var(tryblock.jcatchvar), el_una(OPind, TYnptr, e));
}
else
{
// jcatchvar = __dmd_catch_begin(__exception_object);
elem *ebegin = el_var(getRtlsym(RTLSYM_BEGIN_CATCH));
elem *e = el_bin(OPcall, TYnptr, ebegin, el_var(seo));
elem *e3 = el_bin(OPeq, TYvoid, el_var(tryblock.jcatchvar), e);
}
block *bcatch = blx.curblock;
tryblock.appendSucc(bcatch);
block_goto(blx, BCjcatch, null);
block *defaultblock = block_calloc(blx);
block *bswitch = blx.curblock;
bswitch.Belem = el_combine(el_combine(e1, e2),
el_combine(e3, el_var(shandler)));
const numcases = s.catches.dim;
bswitch.Bswitch = cast(targ_llong *) Mem.check(.malloc((targ_llong).sizeof * (numcases + 1)));
bswitch.Bswitch[0] = numcases;
bswitch.appendSucc(defaultblock);
block_next(blx, BCswitch, null);
foreach (i, cs; *s.catches)
{
bswitch.Bswitch[1 + i] = 1 + i;
if (cs.var)
cs.var.csym = tryblock.jcatchvar;
assert(cs.type);
/* The catch type can be a C++ class or a D class.
* If a D class, insert a pointer to TypeInfo into the typesTable[].
* If a C++ class, insert a pointer to __cpp_type_info_ptr into the typesTable[].
*/
Type tcatch = cs.type.toBasetype();
ClassDeclaration cd = tcatch.isClassHandle();
bool isCPPclass = cd.isCPPclass();
Symbol *catchtype;
if (isCPPclass)
{
catchtype = toSymbolCpp(cd);
if (i == 0)
{
// rewrite ebegin to use __cxa_begin_catch
Symbol *s2 = getRtlsym(RTLSYM_CXA_BEGIN_CATCH);
ebegin.EV.Vsym = s2;
}
}
else
catchtype = toSymbol(tcatch);
/* Look for catchtype in typesTable[] using linear search,
* insert if not already there,
* log index in Action Table (i.e. switch case table)
*/
func_t *f = blx.funcsym.Sfunc;
foreach (j, ct; f.typesTable[])
{
if (ct == catchtype)
{
bswitch.Bswitch[1 + i] = 1 + j; // index starts at 1
goto L1;
}
}
f.typesTable.push(catchtype);
bswitch.Bswitch[1 + i] = f.typesTable.length; // index starts at 1
L1:
block *bcase = blx.curblock;
bswitch.appendSucc(bcase);
if (cs.handler !is null)
{
StmtState catchState = StmtState(stmtstate, s);
/* Append to block:
* *(sclosure + cs.var.offset) = cs.var;
*/
if (cs.var && cs.var.offset) // if member of a closure
{
tym_t tym = totym(cs.var.type);
elem *ex = el_var(irs.sclosure);
ex = el_bin(OPadd, TYnptr, ex, el_long(TYsize_t, cs.var.offset));
ex = el_una(OPind, tym, ex);
ex = el_bin(OPeq, tym, ex, el_var(toSymbol(cs.var)));
block_appendexp(irs.blx.curblock, ex);
}
if (isCPPclass)
{
/* C++ catches need to end with call to __cxa_end_catch().
* Create:
* try { handler } finally { __cxa_end_catch(); }
* Note that this is worst case code because it always sets up an exception handler.
* At some point should try to do better.
*/
FuncDeclaration fdend = FuncDeclaration.genCfunc(null, Type.tvoid, "__cxa_end_catch");
Expression ec = VarExp.create(Loc.initial, fdend);
Expression ecc = CallExp.create(Loc.initial, ec);
ecc.type = Type.tvoid;
Statement sf = ExpStatement.create(Loc.initial, ecc);
Statement stf = TryFinallyStatement.create(Loc.initial, cs.handler, sf);
Statement_toIR(stf, irs, &catchState);
}
else
Statement_toIR(cs.handler, irs, &catchState);
}
blx.curblock.appendSucc(breakblock2);
if (i + 1 == numcases)
{
block_next(blx, BCgoto, defaultblock);
defaultblock.Belem = el_calloc();
defaultblock.Belem.Ety = TYvoid;
defaultblock.Belem.Eoper = OPhalt;
block_next(blx, BCexit, null);
}
else
block_next(blx, BCgoto, null);
}
/* Make a copy of the switch case table, which will later become the Action Table.
* Need a copy since the bswitch may get rewritten by the optimizer.
*/
alias TAction = typeof(bcatch.actionTable[0]);
bcatch.actionTable = cast(TAction*)Mem.check(.malloc(TAction.sizeof * (numcases + 1)));
foreach (i; 0 .. numcases + 1)
bcatch.actionTable[i] = cast(TAction)bswitch.Bswitch[i];
}
else
{
foreach (cs; *s.catches)
{
if (cs.var)
cs.var.csym = tryblock.jcatchvar;
block *bcatch = blx.curblock;
if (cs.type)
bcatch.Bcatchtype = toSymbol(cs.type.toBasetype());
tryblock.appendSucc(bcatch);
block_goto(blx, BCjcatch, null);
if (cs.type && irs.params.targetOS == TargetOS.Windows && irs.params.is64bit) // Win64
{
/* The linker will attempt to merge together identical functions,
* even if the catch types differ. So add a reference to the
* catch type here.
* https://issues.dlang.org/show_bug.cgi?id=10664
*/
auto tc = cs.type.toBasetype().isTypeClass();
if (!tc.sym.vclassinfo)
tc.sym.vclassinfo = TypeInfoClassDeclaration.create(tc);
auto sinfo = toSymbol(tc.sym.vclassinfo);
elem* ex = el_var(sinfo);
ex.Ety = mTYvolatile | TYnptr;
ex = el_una(OPind, TYint, ex);
block_appendexp(irs.blx.curblock, ex);
}
if (cs.handler !is null)
{
StmtState catchState = StmtState(stmtstate, s);
/* Append to block:
* *(sclosure + cs.var.offset) = cs.var;
*/
if (cs.var && cs.var.offset) // if member of a closure
{
tym_t tym = totym(cs.var.type);
elem *ex = el_var(irs.sclosure);
ex = el_bin(OPadd, TYnptr, ex, el_long(TYsize_t, cs.var.offset));
ex = el_una(OPind, tym, ex);
ex = el_bin(OPeq, tym, ex, el_var(toSymbol(cs.var)));
block_appendexp(irs.blx.curblock, ex);
}
Statement_toIR(cs.handler, irs, &catchState);
}
blx.curblock.appendSucc(breakblock2);
block_next(blx, BCgoto, null);
}
}
block_next(blx,cast(BC)blx.curblock.BC, breakblock2);
}
/****************************************
* A try-finally statement.
* Builds the following:
* _try
* block
* _finally
* finalbody
* _ret
*/
override void visit(TryFinallyStatement s)
{
//printf("TryFinallyStatement.toIR()\n");
Blockx *blx = irs.blx;
if (config.ehmethod == EHmethod.EH_WIN32 && !(blx.funcsym.Sfunc.Fflags3 & Feh_none))
nteh_declarvars(blx);
/* Successors to BC_try block:
* [0] start of try block code
* [1] BC_finally
*/
block *tryblock = block_goto(blx, BCgoto, null);
int previndex = blx.scope_index;
tryblock.Blast_index = previndex;
tryblock.Bscope_index = blx.next_index++;
blx.scope_index = tryblock.Bscope_index;
// Current scope index
setScopeIndex(blx,tryblock,tryblock.Bscope_index);
blx.tryblock = tryblock;
block_goto(blx,BC_try,null);
StmtState bodyirs = StmtState(stmtstate, s);
block *finallyblock = block_calloc(blx);
tryblock.appendSucc(finallyblock);
finallyblock.BC = BC_finally;
bodyirs.finallyBlock = finallyblock;
if (s._body)
Statement_toIR(s._body, irs, &bodyirs);
blx.tryblock = tryblock.Btry; // back to previous tryblock
setScopeIndex(blx,blx.curblock,previndex);
blx.scope_index = previndex;
block *breakblock = block_calloc(blx);
block *retblock = block_calloc(blx);
if (config.ehmethod == EHmethod.EH_DWARF && !(blx.funcsym.Sfunc.Fflags3 & Feh_none))
{
/* Build this:
* BCgoto [BC_try]
* BC_try [body] [BC_finally]
* body
* BCgoto [breakblock]
* BC_finally [BC_lpad] [finalbody] [breakblock]
* BC_lpad [finalbody]
* finalbody
* BCgoto [BC_ret]
* BC_ret
* breakblock
*/
blx.curblock.appendSucc(breakblock);
block_next(blx,BCgoto,finallyblock);
block *landingPad = block_goto(blx,BC_finally,null);
block_goto(blx,BC_lpad,null); // lpad is [0]
finallyblock.appendSucc(blx.curblock); // start of finalybody is [1]
finallyblock.appendSucc(breakblock); // breakblock is [2]
/* Declare flag variable
*/
Symbol *sflag = symbol_name("__flag", SCauto, tstypes[TYint]);
symbol_add(sflag);
finallyblock.flag = sflag;
finallyblock.b_ret = retblock;
assert(!finallyblock.Belem);
/* Add code to landingPad block:
* exception_object = RAX;
* _flag = 0;
*/
// Make it volatile so optimizer won't delete it
Symbol *sreg = symbol_name("__EAX", SCpseudo, type_fake(mTYvolatile | TYnptr));
sreg.Sreglsw = 0; // EAX, RAX, whatevs
symbol_add(sreg);
Symbol *seo = symbol_name("__exception_object", SCauto, tspvoid);
symbol_add(seo);
assert(!landingPad.Belem);
elem *e = el_bin(OPeq, TYvoid, el_var(seo), el_var(sreg));
landingPad.Belem = el_combine(e, el_bin(OPeq, TYvoid, el_var(sflag), el_long(TYint, 0)));
/* Add code to BC_ret block:
* (!_flag && _Unwind_Resume(exception_object));
*/
elem *eu = el_bin(OPcall, TYvoid, el_var(getRtlsym(RTLSYM_UNWIND_RESUME)), el_var(seo));
eu = el_bin(OPandand, TYvoid, el_una(OPnot, TYbool, el_var(sflag)), eu);
assert(!retblock.Belem);
retblock.Belem = eu;
StmtState finallyState = StmtState(stmtstate, s);
setScopeIndex(blx, blx.curblock, previndex);
if (s.finalbody)
Statement_toIR(s.finalbody, irs, &finallyState);
block_goto(blx, BCgoto, retblock);
block_next(blx,BC_ret,breakblock);
}
else if (config.ehmethod == EHmethod.EH_NONE || blx.funcsym.Sfunc.Fflags3 & Feh_none)
{
/* Build this:
* BCgoto [BC_try]
* BC_try [body] [BC_finally]
* body
* BCgoto [breakblock]
* BC_finally [BC_lpad] [finalbody] [breakblock]
* BC_lpad [finalbody]
* finalbody
* BCgoto [BC_ret]
* BC_ret
* breakblock
*/
if (s.bodyFallsThru)
{
// BCgoto [breakblock]
blx.curblock.appendSucc(breakblock);
block_next(blx,BCgoto,finallyblock);
}
else
{
if (!irs.params.optimize)
{
/* If this is reached at runtime, there's a bug
* in the computation of s.bodyFallsThru. Inserting a HALT
* makes it far easier to track down such failures.
* But it makes for slower code, so only generate it for
* non-optimized code.
*/
elem *e = el_calloc();
e.Ety = TYvoid;
e.Eoper = OPhalt;
elem_setLoc(e, s.loc);
block_appendexp(blx.curblock, e);
}
block_next(blx,BCexit,finallyblock);
}
block *landingPad = block_goto(blx,BC_finally,null);
block_goto(blx,BC_lpad,null); // lpad is [0]
finallyblock.appendSucc(blx.curblock); // start of finalybody is [1]
finallyblock.appendSucc(breakblock); // breakblock is [2]
/* Declare flag variable
*/
Symbol *sflag = symbol_name("__flag", SCauto, tstypes[TYint]);
symbol_add(sflag);
finallyblock.flag = sflag;
finallyblock.b_ret = retblock;
assert(!finallyblock.Belem);
landingPad.Belem = el_bin(OPeq, TYvoid, el_var(sflag), el_long(TYint, 0)); // __flag = 0;
StmtState finallyState = StmtState(stmtstate, s);
setScopeIndex(blx, blx.curblock, previndex);
if (s.finalbody)
Statement_toIR(s.finalbody, irs, &finallyState);
block_goto(blx, BCgoto, retblock);
block_next(blx,BC_ret,breakblock);
}
else
{
block_goto(blx,BCgoto, breakblock);
block_goto(blx,BCgoto,finallyblock);
/* Successors to BC_finally block:
* [0] landing pad, same as start of finally code
* [1] block that comes after BC_ret
*/
block_goto(blx,BC_finally,null);
StmtState finallyState = StmtState(stmtstate, s);
setScopeIndex(blx, blx.curblock, previndex);
if (s.finalbody)
Statement_toIR(s.finalbody, irs, &finallyState);
block_goto(blx, BCgoto, retblock);
block_next(blx,BC_ret,null);
/* Append the last successor to finallyblock, which is the first block past the BC_ret block.
*/
finallyblock.appendSucc(blx.curblock);
retblock.appendSucc(blx.curblock);
/* The BCfinally..BC_ret blocks form a function that gets called from stack unwinding.
* The successors to BC_ret blocks are both the next outer BCfinally and the destination
* after the unwinding is complete.
*/
for (block *b = tryblock; b != finallyblock; b = b.Bnext)
{
block *btry = b.Btry;
if (b.BC == BCgoto && b.numSucc() == 1)
{
block *bdest = b.nthSucc(0);
if (btry && bdest.Btry != btry)
{
//printf("test1 b %p b.Btry %p bdest %p bdest.Btry %p\n", b, btry, bdest, bdest.Btry);
block *bfinally = btry.nthSucc(1);
if (bfinally == finallyblock)
{
b.appendSucc(finallyblock);
}
}
}
// If the goto exits a try block, then the finally block is also a successor
if (b.BC == BCgoto && b.numSucc() == 2) // if goto exited a tryblock
{
block *bdest = b.nthSucc(0);
// If the last finally block executed by the goto
if (bdest.Btry == tryblock.Btry)
{
// The finally block will exit and return to the destination block
retblock.appendSucc(bdest);
}
}
if (b.BC == BC_ret && b.Btry == tryblock)
{
// b is nested inside this TryFinally, and so this finally will be called next
b.appendSucc(finallyblock);
}
}
}
}
/****************************************
*/
override void visit(SynchronizedStatement s)
{
assert(0);
}
/****************************************
*/
override void visit(InlineAsmStatement s)
// { .visit(irs, s); }
{
block *bpre;
block *basm;
Symbol *sym;
Blockx *blx = irs.blx;
//printf("AsmStatement.toIR(asmcode = %x)\n", asmcode);
bpre = blx.curblock;
block_next(blx,BCgoto,null);
basm = blx.curblock;
bpre.appendSucc(basm);
basm.Bcode = s.asmcode;
basm.Balign = cast(ubyte)s.asmalign;
// Loop through each instruction, fixing Dsymbols into Symbol's
for (code *c = s.asmcode; c; c = c.next)
{
switch (c.IFL1)
{
case FLblockoff:
case FLblock:
{
// FLblock and FLblockoff have LabelDsymbol's - convert to blocks
LabelDsymbol label = cast(LabelDsymbol)c.IEV1.Vlsym;
block *b = cast(block*)label.statement.extra;
basm.appendSucc(b);
c.IEV1.Vblock = b;
break;
}
case FLdsymbol:
case FLfunc:
sym = toSymbol(cast(Dsymbol)c.IEV1.Vdsym);
if (sym.Sclass == SCauto && sym.Ssymnum == SYMIDX.max)
symbol_add(sym);
c.IEV1.Vsym = sym;
c.IFL1 = sym.Sfl ? sym.Sfl : FLauto;
break;
default:
break;
}
// Repeat for second operand
switch (c.IFL2)
{
case FLblockoff:
case FLblock:
{
LabelDsymbol label = cast(LabelDsymbol)c.IEV2.Vlsym;
block *b = cast(block*)label.statement.extra;
basm.appendSucc(b);
c.IEV2.Vblock = b;
break;
}
case FLdsymbol:
case FLfunc:
{
Declaration d = cast(Declaration)c.IEV2.Vdsym;
sym = toSymbol(cast(Dsymbol)d);
if (sym.Sclass == SCauto && sym.Ssymnum == SYMIDX.max)
symbol_add(sym);
c.IEV2.Vsym = sym;
c.IFL2 = sym.Sfl ? sym.Sfl : FLauto;
if (d.isDataseg())
sym.Sflags |= SFLlivexit;
break;
}
default:
break;
}
}
basm.bIasmrefparam = s.refparam; // are parameters reference?
basm.usIasmregs = s.regs; // registers modified
block_next(blx,BCasm, null);
basm.prependSucc(blx.curblock);
if (s.naked)
{
blx.funcsym.Stype.Tty |= mTYnaked;
}
}
/****************************************
*/
override void visit(ImportStatement s)
{
}
static void Statement_toIR(Statement s, IRState *irs, StmtState* stmtstate)
{
scope v = new S2irVisitor(irs, stmtstate);
s.accept(v);
}
}
void Statement_toIR(Statement s, IRState *irs)
{
/* Generate a block for each label
*/
FuncDeclaration fd = irs.getFunc();
if (auto labtab = fd.labtab)
foreach (keyValue; labtab.tab.asRange)
{
//printf(" KV: %s = %s\n", keyValue.key.toChars(), keyValue.value.toChars());
LabelDsymbol label = cast(LabelDsymbol)keyValue.value;
if (label.statement)
label.statement.extra = dmd.backend.global.block_calloc();
}
StmtState stmtstate;
scope v = new S2irVisitor(irs, &stmtstate);
s.accept(v);
}
/***************************************************
* Insert finally block calls when doing a goto from
* inside a try block to outside.
* Done after blocks are generated because then we know all
* the edges of the graph, but before the Bpred's are computed.
* Only for EH_DWARF exception unwinding.
* Params:
* startblock = first block in function
*/
void insertFinallyBlockCalls(block *startblock)
{
int flagvalue = 0; // 0 is forunwind_resume
block *bcret = null;
block *bcretexp = null;
Symbol *stmp;
enum log = false;
static if (log)
{
printf("------- before ----------\n");
numberBlocks(startblock);
foreach (b; BlockRange(startblock)) WRblock(b);
printf("-------------------------\n");
}
block **pb;
block **pbnext;
for (pb = &startblock; *pb; pb = pbnext)
{
block *b = *pb;
pbnext = &b.Bnext;
if (!b.Btry)
continue;
switch (b.BC)
{
case BCret:
// Rewrite into a BCgoto => BCret
if (!bcret)
{
bcret = dmd.backend.global.block_calloc();
bcret.BC = BCret;
}
b.BC = BCgoto;
b.appendSucc(bcret);
goto case_goto;
case BCretexp:
{
// Rewrite into a BCgoto => BCretexp
elem *e = b.Belem;
tym_t ty = tybasic(e.Ety);
if (!bcretexp)
{
bcretexp = dmd.backend.global.block_calloc();
bcretexp.BC = BCretexp;
type *t;
if ((ty == TYstruct || ty == TYarray) && e.ET)
t = e.ET;
else
t = type_fake(ty);
stmp = symbol_genauto(t);
bcretexp.Belem = el_var(stmp);
if ((ty == TYstruct || ty == TYarray) && e.ET)
bcretexp.Belem.ET = t;
}
b.BC = BCgoto;
b.appendSucc(bcretexp);
b.Belem = elAssign(el_var(stmp), e, null, e.ET);
goto case_goto;
}
case BCgoto:
case_goto:
{
/* From this:
* BCgoto [breakblock]
* BC_try [body] [BC_finally]
* body
* BCgoto [breakblock]
* BC_finally [BC_lpad] [finalbody] [breakblock]
* BC_lpad [finalbody]
* finalbody
* BCgoto [BC_ret]
* BC_ret
* breakblock
*
* Build this:
* BCgoto [BC_try]
* BC_try [body] [BC_finally]
* body
*x BCgoto sflag=n; [finalbody]
* BC_finally [BC_lpad] [finalbody] [breakblock]
* BC_lpad [finalbody]
* finalbody
* BCgoto [BCiftrue]
*x BCiftrue (sflag==n) [breakblock]
*x BC_ret
* breakblock
*/
block *breakblock = b.nthSucc(0);
block *lasttry = breakblock.Btry;
block *blast = b;
++flagvalue;
for (block *bt = b.Btry; bt != lasttry; bt = bt.Btry)
{
assert(bt.BC == BC_try);
block *bf = bt.nthSucc(1);
if (bf.BC == BCjcatch)
continue; // skip try-catch
assert(bf.BC == BC_finally);
block *retblock = bf.b_ret;
assert(retblock.BC == BC_ret);
assert(retblock.numSucc() == 0);
// Append (_flag = flagvalue) to b.Belem
Symbol *sflag = bf.flag;
elem *e = el_bin(OPeq, TYint, el_var(sflag), el_long(TYint, flagvalue));
b.Belem = el_combine(b.Belem, e);
if (blast.BC == BCiftrue)
{
blast.setNthSucc(0, bf.nthSucc(1));
}
else
{
assert(blast.BC == BCgoto);
blast.setNthSucc(0, bf.nthSucc(1));
}
// Create new block, bnew, which will replace retblock
block *bnew = dmd.backend.global.block_calloc();
/* Rewrite BC_ret block as:
* if (sflag == flagvalue) goto breakblock; else goto bnew;
*/
e = el_bin(OPeqeq, TYbool, el_var(sflag), el_long(TYint, flagvalue));
retblock.Belem = el_combine(retblock.Belem, e);
retblock.BC = BCiftrue;
retblock.appendSucc(breakblock);
retblock.appendSucc(bnew);
bnew.Bnext = retblock.Bnext;
retblock.Bnext = bnew;
bnew.BC = BC_ret;
bnew.Btry = retblock.Btry;
bf.b_ret = bnew;
blast = retblock;
}
break;
}
default:
break;
}
}
if (bcret)
{
*pb = bcret;
pb = &(*pb).Bnext;
}
if (bcretexp)
*pb = bcretexp;
static if (log)
{
printf("------- after ----------\n");
numberBlocks(startblock);
foreach (b; BlockRange(startblock)) WRblock(b);
printf("-------------------------\n");
}
}
/***************************************************
* Insert gotos to finally blocks when doing a return or goto from
* inside a try block to outside.
* Done after blocks are generated because then we know all
* the edges of the graph, but before the Bpred's are computed.
* Only for functions with no exception handling.
* Very similar to insertFinallyBlockCalls().
* Params:
* startblock = first block in function
*/
void insertFinallyBlockGotos(block *startblock)
{
enum log = false;
// Insert all the goto's
insertFinallyBlockCalls(startblock);
/* Remove all the BC_try, BC_finally, BC_lpad and BC_ret
* blocks.
* Actually, just make them into no-ops and let the optimizer
* delete them.
*/
foreach (b; BlockRange(startblock))
{
b.Btry = null;
switch (b.BC)
{
case BC_try:
b.BC = BCgoto;
list_subtract(&b.Bsucc, b.nthSucc(1));
break;
case BC_finally:
b.BC = BCgoto;
list_subtract(&b.Bsucc, b.nthSucc(2));
list_subtract(&b.Bsucc, b.nthSucc(0));
break;
case BC_lpad:
b.BC = BCgoto;
break;
case BC_ret:
b.BC = BCexit;
break;
default:
break;
}
}
static if (log)
{
printf("------- after ----------\n");
numberBlocks(startblock);
foreach (b; BlockRange(startblock)) WRblock(b);
printf("-------------------------\n");
}
}
| D |
module yarn.vm;
import yarn.value;
import yarn.bytecode;
import yarn.vm.state;
import yarn.dialogue;
package(yarn) enum TokenType {
Whitespace,
Indent,
Dedent,
EndOfLine,
EndOfInput,
Number, // Numeric values
String, // Strings
TagMarker, // #
BeginCommand, // <<
EndCommand, // >>
Variable, // $foo
ShortcutOption, // ->
OptionStart,
OptionDelimit,
OptionEnd,
If,
ElseIf,
Else,
EndIf,
Set,
True,
False,
Null,
LeftParen,
RightParen,
Comma,
EqualTo,
GreaterThan,
GreaterThanOrEqualTo,
LessThan,
LessThanOrEqualTo,
NotEqualTo,
Or,
And,
Xor,
Not,
EqualToOrAssign, // Depending on context this can be assignment or equality operator
UnaryMinus,
Add,
Minus,
Multiply,
Divide,
Modulo,
AddAsign,
MinusAssign,
MultiplyAssign,
DivideAssign,
Comment,
Identifier,
Text
}
/**
The execution state of a YarnSpinner VM
*/
enum ExecutionState {
/**
Execution is stopped
*/
Stopped,
/**
VM is waiting on an option to be selected
*/
WaitingOnOptionSelection,
/**
VM is waiting for green light to continue the dialogue
*/
WaitingForContinue,
/**
VM is currently delivering content
*/
DeliveringContent,
/**
VM is running.
*/
Running
}
/**
A YarnSpinner VM
*/
class YarnVM {
private:
YarnState state;
YarnDialogue dialogue;
public:
/**
Dialogue to execute
*/
this(YarnDialogue dialogue) {
this.dialogue = dialogue;
}
/**
Runs the next instruction
*/
void runNext() {
}
} | D |
/Users/kimhyewon/Documents/Server/tennis/build/tennis.build/Debug/Core.build/Objects-normal/x86_64/Byte+Random.o : /Users/kimhyewon/Documents/Server/tennis/Packages/Core-1.0.0/Sources/Core/Array.swift /Users/kimhyewon/Documents/Server/tennis/Packages/Core-1.0.0/Sources/Core/Bool+String.swift /Users/kimhyewon/Documents/Server/tennis/Packages/Core-1.0.0/Sources/Core/Box.swift /Users/kimhyewon/Documents/Server/tennis/Packages/Core-1.0.0/Sources/Core/Collection+Safe.swift /Users/kimhyewon/Documents/Server/tennis/Packages/Core-1.0.0/Sources/Core/Dispatch.swift /Users/kimhyewon/Documents/Server/tennis/Packages/Core-1.0.0/Sources/Core/DispatchTime+Utilities.swift /Users/kimhyewon/Documents/Server/tennis/Packages/Core-1.0.0/Sources/Core/Equatable.swift /Users/kimhyewon/Documents/Server/tennis/Packages/Core-1.0.0/Sources/Core/Extractable.swift /Users/kimhyewon/Documents/Server/tennis/Packages/Core-1.0.0/Sources/Core/FileProtocol.swift /Users/kimhyewon/Documents/Server/tennis/Packages/Core-1.0.0/Sources/Core/Lock.swift /Users/kimhyewon/Documents/Server/tennis/Packages/Core-1.0.0/Sources/Core/PercentEncoding.swift /Users/kimhyewon/Documents/Server/tennis/Packages/Core-1.0.0/Sources/Core/Portal.swift /Users/kimhyewon/Documents/Server/tennis/Packages/Core-1.0.0/Sources/Core/Result.swift /Users/kimhyewon/Documents/Server/tennis/Packages/Core-1.0.0/Sources/Core/RFC1123.swift /Users/kimhyewon/Documents/Server/tennis/Packages/Core-1.0.0/Sources/Core/Semaphore.swift /Users/kimhyewon/Documents/Server/tennis/Packages/Core-1.0.0/Sources/Core/Sequence.swift /Users/kimhyewon/Documents/Server/tennis/Packages/Core-1.0.0/Sources/Core/StaticDataBuffer.swift /Users/kimhyewon/Documents/Server/tennis/Packages/Core-1.0.0/Sources/Core/Strand.swift /Users/kimhyewon/Documents/Server/tennis/Packages/Core-1.0.0/Sources/Core/String+CaseInsensitiveCompare.swift /Users/kimhyewon/Documents/Server/tennis/Packages/Core-1.0.0/Sources/Core/String.swift /Users/kimhyewon/Documents/Server/tennis/Packages/Core-1.0.0/Sources/Core/UnsignedInteger.swift /Users/kimhyewon/Documents/Server/tennis/Packages/Core-1.0.0/Sources/Core/Byte/Byte+Random.swift /Users/kimhyewon/Documents/Server/tennis/Packages/Core-1.0.0/Sources/Core/Byte/Byte.swift /Users/kimhyewon/Documents/Server/tennis/Packages/Core-1.0.0/Sources/Core/Byte/ByteAliases.swift /Users/kimhyewon/Documents/Server/tennis/Packages/Core-1.0.0/Sources/Core/Byte/Bytes+Base64.swift /Users/kimhyewon/Documents/Server/tennis/Packages/Core-1.0.0/Sources/Core/Byte/Bytes.swift /Users/kimhyewon/Documents/Server/tennis/Packages/Core-1.0.0/Sources/Core/Byte/BytesConvertible.swift /Users/kimhyewon/Documents/Server/tennis/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/kimhyewon/Documents/Server/tennis/build/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/kimhyewon/Documents/Server/tennis/build/tennis.build/Debug/Core.build/Objects-normal/x86_64/Byte+Random~partial.swiftmodule : /Users/kimhyewon/Documents/Server/tennis/Packages/Core-1.0.0/Sources/Core/Array.swift /Users/kimhyewon/Documents/Server/tennis/Packages/Core-1.0.0/Sources/Core/Bool+String.swift /Users/kimhyewon/Documents/Server/tennis/Packages/Core-1.0.0/Sources/Core/Box.swift /Users/kimhyewon/Documents/Server/tennis/Packages/Core-1.0.0/Sources/Core/Collection+Safe.swift /Users/kimhyewon/Documents/Server/tennis/Packages/Core-1.0.0/Sources/Core/Dispatch.swift /Users/kimhyewon/Documents/Server/tennis/Packages/Core-1.0.0/Sources/Core/DispatchTime+Utilities.swift /Users/kimhyewon/Documents/Server/tennis/Packages/Core-1.0.0/Sources/Core/Equatable.swift /Users/kimhyewon/Documents/Server/tennis/Packages/Core-1.0.0/Sources/Core/Extractable.swift /Users/kimhyewon/Documents/Server/tennis/Packages/Core-1.0.0/Sources/Core/FileProtocol.swift /Users/kimhyewon/Documents/Server/tennis/Packages/Core-1.0.0/Sources/Core/Lock.swift /Users/kimhyewon/Documents/Server/tennis/Packages/Core-1.0.0/Sources/Core/PercentEncoding.swift /Users/kimhyewon/Documents/Server/tennis/Packages/Core-1.0.0/Sources/Core/Portal.swift /Users/kimhyewon/Documents/Server/tennis/Packages/Core-1.0.0/Sources/Core/Result.swift /Users/kimhyewon/Documents/Server/tennis/Packages/Core-1.0.0/Sources/Core/RFC1123.swift /Users/kimhyewon/Documents/Server/tennis/Packages/Core-1.0.0/Sources/Core/Semaphore.swift /Users/kimhyewon/Documents/Server/tennis/Packages/Core-1.0.0/Sources/Core/Sequence.swift /Users/kimhyewon/Documents/Server/tennis/Packages/Core-1.0.0/Sources/Core/StaticDataBuffer.swift /Users/kimhyewon/Documents/Server/tennis/Packages/Core-1.0.0/Sources/Core/Strand.swift /Users/kimhyewon/Documents/Server/tennis/Packages/Core-1.0.0/Sources/Core/String+CaseInsensitiveCompare.swift /Users/kimhyewon/Documents/Server/tennis/Packages/Core-1.0.0/Sources/Core/String.swift /Users/kimhyewon/Documents/Server/tennis/Packages/Core-1.0.0/Sources/Core/UnsignedInteger.swift /Users/kimhyewon/Documents/Server/tennis/Packages/Core-1.0.0/Sources/Core/Byte/Byte+Random.swift /Users/kimhyewon/Documents/Server/tennis/Packages/Core-1.0.0/Sources/Core/Byte/Byte.swift /Users/kimhyewon/Documents/Server/tennis/Packages/Core-1.0.0/Sources/Core/Byte/ByteAliases.swift /Users/kimhyewon/Documents/Server/tennis/Packages/Core-1.0.0/Sources/Core/Byte/Bytes+Base64.swift /Users/kimhyewon/Documents/Server/tennis/Packages/Core-1.0.0/Sources/Core/Byte/Bytes.swift /Users/kimhyewon/Documents/Server/tennis/Packages/Core-1.0.0/Sources/Core/Byte/BytesConvertible.swift /Users/kimhyewon/Documents/Server/tennis/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/kimhyewon/Documents/Server/tennis/build/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/kimhyewon/Documents/Server/tennis/build/tennis.build/Debug/Core.build/Objects-normal/x86_64/Byte+Random~partial.swiftdoc : /Users/kimhyewon/Documents/Server/tennis/Packages/Core-1.0.0/Sources/Core/Array.swift /Users/kimhyewon/Documents/Server/tennis/Packages/Core-1.0.0/Sources/Core/Bool+String.swift /Users/kimhyewon/Documents/Server/tennis/Packages/Core-1.0.0/Sources/Core/Box.swift /Users/kimhyewon/Documents/Server/tennis/Packages/Core-1.0.0/Sources/Core/Collection+Safe.swift /Users/kimhyewon/Documents/Server/tennis/Packages/Core-1.0.0/Sources/Core/Dispatch.swift /Users/kimhyewon/Documents/Server/tennis/Packages/Core-1.0.0/Sources/Core/DispatchTime+Utilities.swift /Users/kimhyewon/Documents/Server/tennis/Packages/Core-1.0.0/Sources/Core/Equatable.swift /Users/kimhyewon/Documents/Server/tennis/Packages/Core-1.0.0/Sources/Core/Extractable.swift /Users/kimhyewon/Documents/Server/tennis/Packages/Core-1.0.0/Sources/Core/FileProtocol.swift /Users/kimhyewon/Documents/Server/tennis/Packages/Core-1.0.0/Sources/Core/Lock.swift /Users/kimhyewon/Documents/Server/tennis/Packages/Core-1.0.0/Sources/Core/PercentEncoding.swift /Users/kimhyewon/Documents/Server/tennis/Packages/Core-1.0.0/Sources/Core/Portal.swift /Users/kimhyewon/Documents/Server/tennis/Packages/Core-1.0.0/Sources/Core/Result.swift /Users/kimhyewon/Documents/Server/tennis/Packages/Core-1.0.0/Sources/Core/RFC1123.swift /Users/kimhyewon/Documents/Server/tennis/Packages/Core-1.0.0/Sources/Core/Semaphore.swift /Users/kimhyewon/Documents/Server/tennis/Packages/Core-1.0.0/Sources/Core/Sequence.swift /Users/kimhyewon/Documents/Server/tennis/Packages/Core-1.0.0/Sources/Core/StaticDataBuffer.swift /Users/kimhyewon/Documents/Server/tennis/Packages/Core-1.0.0/Sources/Core/Strand.swift /Users/kimhyewon/Documents/Server/tennis/Packages/Core-1.0.0/Sources/Core/String+CaseInsensitiveCompare.swift /Users/kimhyewon/Documents/Server/tennis/Packages/Core-1.0.0/Sources/Core/String.swift /Users/kimhyewon/Documents/Server/tennis/Packages/Core-1.0.0/Sources/Core/UnsignedInteger.swift /Users/kimhyewon/Documents/Server/tennis/Packages/Core-1.0.0/Sources/Core/Byte/Byte+Random.swift /Users/kimhyewon/Documents/Server/tennis/Packages/Core-1.0.0/Sources/Core/Byte/Byte.swift /Users/kimhyewon/Documents/Server/tennis/Packages/Core-1.0.0/Sources/Core/Byte/ByteAliases.swift /Users/kimhyewon/Documents/Server/tennis/Packages/Core-1.0.0/Sources/Core/Byte/Bytes+Base64.swift /Users/kimhyewon/Documents/Server/tennis/Packages/Core-1.0.0/Sources/Core/Byte/Bytes.swift /Users/kimhyewon/Documents/Server/tennis/Packages/Core-1.0.0/Sources/Core/Byte/BytesConvertible.swift /Users/kimhyewon/Documents/Server/tennis/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/kimhyewon/Documents/Server/tennis/build/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 |
// *************************************************************************
// Kapitel 1
// *************************************************************************
// *************************************************************************
// EXIT
// *************************************************************************
INSTANCE Info_Grd_6_EXIT(C_INFO)
{
// npc wird in B_AssignAmbientInfos_Grd_6 (s.u.) jeweils gesetzt
nr = 999;
condition = Info_Grd_6_EXIT_Condition;
information = Info_Grd_6_EXIT_Info;
permanent = 1;
description = DIALOG_ENDE;
};
FUNC INT Info_Grd_6_EXIT_Condition()
{
return 1;
};
FUNC VOID Info_Grd_6_EXIT_Info()
{
AI_StopProcessInfos (self);
};
// *************************************************************************
// Einer von Euch werden
// *************************************************************************
INSTANCE Info_Grd_6_EinerVonEuchWerden (C_INFO) // E1
{
nr = 1;
condition = Info_Grd_6_EinerVonEuchWerden_Condition;
information = Info_Grd_6_EinerVonEuchWerden_Info;
permanent = 1;
description = "Ich will Gardist werden.";
};
FUNC INT Info_Grd_6_EinerVonEuchWerden_Condition()
{
if (Gardist_Dabei == FALSE)
&& (Erzbaron_Dabei == FALSE)
&& (Schatten_Dabei == FALSE)
{
return TRUE;
};
};
FUNC VOID Info_Grd_6_EinerVonEuchWerden_Info()
{
AI_Output(hero,self,"Info_Grd_6_EinerVonEuchWerden_15_00"); //Könnt ihr noch einen guten Mann brauchen?
AI_Output(self,hero,"Info_Grd_6_EinerVonEuchWerden_06_01"); //Frischling, was? Wenn du ein Lager suchst, das dich aufnimmt, probier's doch bei den Sektenspinnern, die nehmen jeden.
AI_Output(self,hero,"Info_Grd_6_EinerVonEuchWerden_06_02"); //Bei uns wird nicht jeder genommen!
};
// *************************************************************************
// Wichtige Personen
// *************************************************************************
INSTANCE Info_Grd_6_WichtigePersonen(C_INFO)
{
nr = 1;
condition = Info_Grd_6_WichtigePersonen_Condition;
information = Info_Grd_6_WichtigePersonen_Info;
permanent = 1;
description = "Wer hat hier das Sagen?";
};
FUNC INT Info_Grd_6_WichtigePersonen_Condition()
{
return 1;
};
FUNC VOID Info_Grd_6_WichtigePersonen_Info()
{
AI_Output(hero,self,"Info_Grd_6_WichtigePersonen_15_00"); //Wer hat hier das Sagen?
AI_Output(self,hero,"Info_Grd_6_WichtigePersonen_06_01"); //Thorus kümmert sich drum das alles läuft.
};
// *************************************************************************
// Das Lager (Orts-Infos)
// *************************************************************************
INSTANCE Info_Grd_6_DasLager(C_INFO)
{
nr = 1;
condition = Info_Grd_6_DasLager_Condition;
information = Info_Grd_6_DasLager_Info;
permanent = 1;
description = "Ich bin neu hier. Was läuft denn so?";
};
FUNC INT Info_Grd_6_DasLager_Condition()
{
if (Schatten_Dabei == FALSE)
&& (Gardist_Dabei == FALSE)
&& (Erzbaron_Dabei == FALSE)
{
return 1;
};
};
FUNC VOID Info_Grd_6_DasLager_Info()
{
AI_Output(hero,self,"Info_Grd_6_DasLager_15_00"); //Ich bin neu hier.
AI_Output(self,hero,"Info_Grd_6_DasLager_06_01"); //Sehe ich.
AI_Output(hero,self,"Info_Grd_6_DasLager_15_02"); //Was läuft denn so?
AI_Output(self,hero,"Info_Grd_6_DasLager_06_03"); //Wer hier Ärger macht bekommt was aufs Maul.
Info_ClearChoices(Info_Grd_6_DasLager);
Info_AddChoice(Info_Grd_6_DasLager, "Verstehe.", Info_Grd_6_DasLager_Verstehe);
Info_AddChoice(Info_Grd_6_DasLager, "Was verstehst du unter Ärger?", Info_Grd_6_DasLager_WasIstAerger);
};
FUNC VOID Info_Grd_6_DasLager_Verstehe()
{
AI_Output(hero,self,"Info_Grd_6_DasLager_Verstehe_15_00"); //Verstehe.
Info_ClearChoices(Info_Grd_6_DasLager);
};
FUNC VOID Info_Grd_6_DasLager_WasIstAerger()
{
AI_Output(hero,self,"Info_Grd_6_DasLager_WasIstAerger_15_00"); //Was verstehst du unter Ärger?
AI_Output(self,hero,"Info_Grd_6_DasLager_WasIstAerger_06_01"); //Die meisten Buddler bezahlen uns, damit wir sie beschützen.
AI_Output(self,hero,"Info_Grd_6_DasLager_WasIstAerger_06_02"); //Wenn du dich mit einem von ihnen anlegst, lernst du uns kennen.
AI_Output(self,hero,"Info_Grd_6_DasLager_WasIstAerger_06_03"); //Erwische ich dich beim rumstöbern in fremden Hütten ...
AI_Output(hero,self,"Info_Grd_6_DasLager_WasIstAerger_15_04"); //Schon gut, ich hab's verstanden.
Info_ClearChoices(Info_Grd_6_DasLager);
};
// *************************************************************************
// Die Lage
// *************************************************************************
INSTANCE Info_Grd_6_DieLage(C_INFO) // E1
{
nr = 1;
condition = Info_Grd_6_DieLage_Condition;
information = Info_Grd_6_DieLage_Info;
permanent = 1;
description = "Wie sieht's aus?";
};
FUNC INT Info_Grd_6_DieLage_Condition()
{
return 1;
};
FUNC VOID Info_Grd_6_DieLage_Info()
{
AI_Output(hero,self,"Info_Grd_6_DieLage_15_00"); //Wie sieht's aus?
AI_Output(self,hero,"Info_Grd_6_DieLage_06_01"); //Willst du Ärger machen?
};
INSTANCE Info_Mod_GRD_6_Pickpocket (C_INFO)
{
nr = 6;
condition = Info_Mod_GRD_6_Pickpocket_Condition;
information = Info_Mod_GRD_6_Pickpocket_Info;
permanent = 1;
important = 0;
description = Pickpocket_120;
};
FUNC INT Info_Mod_GRD_6_Pickpocket_Condition()
{
C_Beklauen (90 + r_max(30), ItMi_Gold, 35 + r_max(10));
};
FUNC VOID Info_Mod_GRD_6_Pickpocket_Info()
{
Info_ClearChoices (Info_Mod_GRD_6_Pickpocket);
Info_AddChoice (Info_Mod_GRD_6_Pickpocket, DIALOG_BACK, Info_Mod_GRD_6_Pickpocket_BACK);
Info_AddChoice (Info_Mod_GRD_6_Pickpocket, DIALOG_PICKPOCKET, Info_Mod_GRD_6_Pickpocket_DoIt);
};
FUNC VOID Info_Mod_GRD_6_Pickpocket_BACK()
{
Info_ClearChoices (Info_Mod_GRD_6_Pickpocket);
};
FUNC VOID Info_Mod_GRD_6_Pickpocket_DoIt()
{
if (B_Beklauen() == TRUE)
{
Info_ClearChoices (Info_Mod_GRD_6_Pickpocket);
}
else
{
Info_ClearChoices (Info_Mod_GRD_6_Pickpocket);
Info_AddChoice (Info_Mod_GRD_6_Pickpocket, DIALOG_PP_BESCHIMPFEN, Info_Mod_GRD_6_Pickpocket_Beschimpfen);
Info_AddChoice (Info_Mod_GRD_6_Pickpocket, DIALOG_PP_BESTECHUNG, Info_Mod_GRD_6_Pickpocket_Bestechung);
Info_AddChoice (Info_Mod_GRD_6_Pickpocket, DIALOG_PP_HERAUSREDEN, Info_Mod_GRD_6_Pickpocket_Herausreden);
};
};
FUNC VOID Info_Mod_GRD_6_Pickpocket_Beschimpfen()
{
B_Say (hero, self, "$PICKPOCKET_BESCHIMPFEN");
B_Say (self, hero, "$DIRTYTHIEF");
Info_ClearChoices (Info_Mod_GRD_6_Pickpocket);
AI_StopProcessInfos (self);
B_Attack (self, hero, AR_Theft, 1);
};
FUNC VOID Info_Mod_GRD_6_Pickpocket_Bestechung()
{
B_Say (hero, self, "$PICKPOCKET_BESTECHUNG");
var int rnd; rnd = r_max(99);
if (rnd < 25)
|| ((rnd >= 25) && (rnd < 50) && (Npc_HasItems(hero, ItMi_Gold) < 50))
|| ((rnd >= 50) && (rnd < 75) && (Npc_HasItems(hero, ItMi_Gold) < 100))
|| ((rnd >= 75) && (rnd < 100) && (Npc_HasItems(hero, ItMi_Gold) < 200))
{
B_Say (self, hero, "$DIRTYTHIEF");
Info_ClearChoices (Info_Mod_GRD_6_Pickpocket);
AI_StopProcessInfos (self);
B_Attack (self, hero, AR_Theft, 1);
}
else
{
if (rnd >= 75)
{
B_GiveInvItems (hero, self, ItMi_Gold, 200);
}
else if (rnd >= 50)
{
B_GiveInvItems (hero, self, ItMi_Gold, 100);
}
else if (rnd >= 25)
{
B_GiveInvItems (hero, self, ItMi_Gold, 50);
};
B_Say (self, hero, "$PICKPOCKET_BESTECHUNG_01");
Info_ClearChoices (Info_Mod_GRD_6_Pickpocket);
AI_StopProcessInfos (self);
};
};
FUNC VOID Info_Mod_GRD_6_Pickpocket_Herausreden()
{
B_Say (hero, self, "$PICKPOCKET_HERAUSREDEN");
if (r_max(99) < Mod_Verhandlungsgeschick)
{
B_Say (self, hero, "$PICKPOCKET_HERAUSREDEN_01");
Info_ClearChoices (Info_Mod_GRD_6_Pickpocket);
}
else
{
B_Say (self, hero, "$PICKPOCKET_HERAUSREDEN_02");
};
};
// *************************************************************************
// -------------------------------------------------------------------------
FUNC VOID B_AssignAmbientInfos_GRD_6(var c_NPC slf)
{
Info_Grd_6_EXIT.npc = Hlp_GetInstanceID(slf);
Info_Grd_6_EinerVonEuchWerden.npc = Hlp_GetInstanceID(slf);
Info_Grd_6_WichtigePersonen.npc = Hlp_GetInstanceID(slf);
Info_Grd_6_DasLager.npc = Hlp_GetInstanceID(slf);
Info_Grd_6_DieLage.npc = Hlp_GetInstanceID(slf);
Info_Mod_GRD_6_Pickpocket.npc = Hlp_GetInstanceID(slf);
};
| D |
/Users/hannh/Documents/MyGitHub/ChartsTest2/Build/Intermediates/Charts.build/Debug-iphonesimulator/Charts.build/Objects-normal/x86_64/CandleStickChartView.o : /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Implementations/Standard/ChartData.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Implementations/Standard/CombinedChartData.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Implementations/Standard/PieChartData.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Implementations/Standard/BubbleChartData.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Implementations/Standard/BarLineScatterCandleBubbleChartData.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Implementations/Standard/CandleChartData.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Implementations/Standard/LineChartData.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Implementations/Standard/BarChartData.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Implementations/Standard/RadarChartData.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Implementations/Standard/ScatterChartData.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Jobs/ViewPortJob.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Jobs/AnimatedViewPortJob.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Jobs/MoveViewJob.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Jobs/AnimatedMoveViewJob.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Jobs/ZoomViewJob.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Jobs/AnimatedZoomViewJob.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Components/Legend.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Components/MarkerImage.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Highlight/Range.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Components/ChartLimitLine.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Renderers/ChartDataRendererBase.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Renderers/AxisRendererBase.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Components/AxisBase.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Components/ComponentBase.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Charts/ChartViewBase.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Charts/BarLineChartViewBase.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Charts/PieRadarChartViewBase.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Implementations/Standard/ChartDataEntryBase.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Animation/ChartAnimationEasing.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Utils/Fill.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Utils/Platform.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Components/Description.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Interfaces/ChartDataProvider.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Interfaces/CombinedChartDataProvider.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Interfaces/BubbleChartDataProvider.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Interfaces/BarLineScatterCandleBubbleChartDataProvider.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Interfaces/CandleChartDataProvider.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Interfaces/LineChartDataProvider.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Interfaces/BarChartDataProvider.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Interfaces/ScatterChartDataProvider.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Components/IMarker.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Utils/ViewPortHandler.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Utils/Transformer.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Renderers/Renderer.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Renderers/LegendRenderer.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Renderers/BarLineScatterCandleBubbleRenderer.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Renderers/Scatter/IShapeRenderer.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Renderers/Scatter/XShapeRenderer.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Renderers/Scatter/CircleShapeRenderer.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Renderers/Scatter/TriangleShapeRenderer.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Renderers/Scatter/SquareShapeRenderer.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Renderers/Scatter/ChevronDownShapeRenderer.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Renderers/Scatter/ChevronUpShapeRenderer.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Renderers/Scatter/CrossShapeRenderer.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Renderers/LineScatterCandleRadarRenderer.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Renderers/LineRadarRenderer.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Renderers/XAxisRenderer.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Renderers/YAxisRenderer.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Renderers/CombinedChartRenderer.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Renderers/PieChartRenderer.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Renderers/BubbleChartRenderer.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Renderers/LineChartRenderer.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Renderers/CandleStickChartRenderer.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Renderers/BarChartRenderer.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Renderers/HorizontalBarChartRenderer.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Renderers/RadarChartRenderer.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Renderers/ScatterChartRenderer.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Highlight/IHighlighter.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Highlight/CombinedHighlighter.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Highlight/PieHighlighter.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Highlight/BarHighlighter.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Highlight/HorizontalBarHighlighter.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Highlight/RadarHighlighter.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Highlight/PieRadarHighlighter.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Highlight/ChartHighlighter.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Formatters/IValueFormatter.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Formatters/IAxisValueFormatter.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Formatters/DefaultAxisValueFormatter.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Formatters/IndexAxisValueFormatter.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Formatters/DefaultValueFormatter.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Formatters/IFillFormatter.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Formatters/DefaultFillFormatter.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Animation/Animator.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Filters/DataApproximator.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Utils/ChartColorTemplates.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Components/XAxis.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Components/YAxis.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Utils/ChartUtils.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Implementations/ChartBaseDataSet.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Implementations/Standard/ChartDataSet.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Interfaces/IChartDataSet.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Implementations/Standard/PieChartDataSet.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Interfaces/IPieChartDataSet.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Implementations/Standard/BubbleChartDataSet.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Interfaces/IBubbleChartDataSet.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Implementations/Standard/BarLineScatterCandleBubbleChartDataSet.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Interfaces/IBarLineScatterCandleBubbleChartDataSet.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Implementations/Standard/CandleChartDataSet.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Interfaces/ICandleChartDataSet.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Implementations/Standard/LineChartDataSet.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Interfaces/ILineChartDataSet.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Implementations/Standard/BarChartDataSet.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Interfaces/IBarChartDataSet.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Implementations/Standard/RadarChartDataSet.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Interfaces/IRadarChartDataSet.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Implementations/Standard/LineScatterCandleRadarChartDataSet.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Interfaces/ILineScatterCandleRadarChartDataSet.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Implementations/Standard/LineRadarChartDataSet.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Interfaces/ILineRadarChartDataSet.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Implementations/Standard/ScatterChartDataSet.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Interfaces/IScatterChartDataSet.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Highlight/Highlight.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Utils/TransformerHorizontalBarChart.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Renderers/XAxisRendererHorizontalBarChart.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Renderers/YAxisRendererHorizontalBarChart.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Renderers/XAxisRendererRadarChart.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Renderers/YAxisRendererRadarChart.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Components/MarkerView.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Charts/CombinedChartView.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Charts/PieChartView.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Charts/BubbleChartView.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Charts/LineChartView.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Charts/CandleStickChartView.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Charts/BarChartView.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Charts/HorizontalBarChartView.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Charts/RadarChartView.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Charts/ScatterChartView.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Implementations/Standard/ChartDataEntry.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Implementations/Standard/PieChartDataEntry.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Implementations/Standard/BubbleChartDataEntry.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Implementations/Standard/CandleChartDataEntry.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Implementations/Standard/BarChartDataEntry.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Implementations/Standard/RadarChartDataEntry.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Components/LegendEntry.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/ObjectiveC.apinotesc /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/Foundation.apinotesc /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreGraphics.apinotesc /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/UIKit.apinotesc /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreText.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/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/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/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Supporting\ Files/Charts.h /Users/hannh/Documents/MyGitHub/ChartsTest2/Build/Intermediates/Charts.build/Debug-iphonesimulator/Charts.build/unextended-module.modulemap
/Users/hannh/Documents/MyGitHub/ChartsTest2/Build/Intermediates/Charts.build/Debug-iphonesimulator/Charts.build/Objects-normal/x86_64/CandleStickChartView~partial.swiftmodule : /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Implementations/Standard/ChartData.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Implementations/Standard/CombinedChartData.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Implementations/Standard/PieChartData.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Implementations/Standard/BubbleChartData.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Implementations/Standard/BarLineScatterCandleBubbleChartData.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Implementations/Standard/CandleChartData.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Implementations/Standard/LineChartData.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Implementations/Standard/BarChartData.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Implementations/Standard/RadarChartData.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Implementations/Standard/ScatterChartData.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Jobs/ViewPortJob.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Jobs/AnimatedViewPortJob.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Jobs/MoveViewJob.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Jobs/AnimatedMoveViewJob.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Jobs/ZoomViewJob.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Jobs/AnimatedZoomViewJob.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Components/Legend.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Components/MarkerImage.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Highlight/Range.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Components/ChartLimitLine.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Renderers/ChartDataRendererBase.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Renderers/AxisRendererBase.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Components/AxisBase.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Components/ComponentBase.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Charts/ChartViewBase.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Charts/BarLineChartViewBase.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Charts/PieRadarChartViewBase.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Implementations/Standard/ChartDataEntryBase.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Animation/ChartAnimationEasing.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Utils/Fill.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Utils/Platform.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Components/Description.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Interfaces/ChartDataProvider.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Interfaces/CombinedChartDataProvider.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Interfaces/BubbleChartDataProvider.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Interfaces/BarLineScatterCandleBubbleChartDataProvider.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Interfaces/CandleChartDataProvider.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Interfaces/LineChartDataProvider.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Interfaces/BarChartDataProvider.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Interfaces/ScatterChartDataProvider.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Components/IMarker.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Utils/ViewPortHandler.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Utils/Transformer.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Renderers/Renderer.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Renderers/LegendRenderer.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Renderers/BarLineScatterCandleBubbleRenderer.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Renderers/Scatter/IShapeRenderer.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Renderers/Scatter/XShapeRenderer.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Renderers/Scatter/CircleShapeRenderer.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Renderers/Scatter/TriangleShapeRenderer.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Renderers/Scatter/SquareShapeRenderer.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Renderers/Scatter/ChevronDownShapeRenderer.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Renderers/Scatter/ChevronUpShapeRenderer.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Renderers/Scatter/CrossShapeRenderer.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Renderers/LineScatterCandleRadarRenderer.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Renderers/LineRadarRenderer.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Renderers/XAxisRenderer.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Renderers/YAxisRenderer.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Renderers/CombinedChartRenderer.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Renderers/PieChartRenderer.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Renderers/BubbleChartRenderer.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Renderers/LineChartRenderer.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Renderers/CandleStickChartRenderer.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Renderers/BarChartRenderer.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Renderers/HorizontalBarChartRenderer.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Renderers/RadarChartRenderer.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Renderers/ScatterChartRenderer.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Highlight/IHighlighter.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Highlight/CombinedHighlighter.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Highlight/PieHighlighter.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Highlight/BarHighlighter.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Highlight/HorizontalBarHighlighter.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Highlight/RadarHighlighter.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Highlight/PieRadarHighlighter.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Highlight/ChartHighlighter.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Formatters/IValueFormatter.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Formatters/IAxisValueFormatter.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Formatters/DefaultAxisValueFormatter.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Formatters/IndexAxisValueFormatter.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Formatters/DefaultValueFormatter.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Formatters/IFillFormatter.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Formatters/DefaultFillFormatter.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Animation/Animator.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Filters/DataApproximator.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Utils/ChartColorTemplates.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Components/XAxis.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Components/YAxis.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Utils/ChartUtils.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Implementations/ChartBaseDataSet.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Implementations/Standard/ChartDataSet.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Interfaces/IChartDataSet.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Implementations/Standard/PieChartDataSet.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Interfaces/IPieChartDataSet.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Implementations/Standard/BubbleChartDataSet.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Interfaces/IBubbleChartDataSet.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Implementations/Standard/BarLineScatterCandleBubbleChartDataSet.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Interfaces/IBarLineScatterCandleBubbleChartDataSet.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Implementations/Standard/CandleChartDataSet.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Interfaces/ICandleChartDataSet.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Implementations/Standard/LineChartDataSet.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Interfaces/ILineChartDataSet.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Implementations/Standard/BarChartDataSet.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Interfaces/IBarChartDataSet.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Implementations/Standard/RadarChartDataSet.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Interfaces/IRadarChartDataSet.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Implementations/Standard/LineScatterCandleRadarChartDataSet.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Interfaces/ILineScatterCandleRadarChartDataSet.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Implementations/Standard/LineRadarChartDataSet.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Interfaces/ILineRadarChartDataSet.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Implementations/Standard/ScatterChartDataSet.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Interfaces/IScatterChartDataSet.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Highlight/Highlight.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Utils/TransformerHorizontalBarChart.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Renderers/XAxisRendererHorizontalBarChart.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Renderers/YAxisRendererHorizontalBarChart.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Renderers/XAxisRendererRadarChart.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Renderers/YAxisRendererRadarChart.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Components/MarkerView.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Charts/CombinedChartView.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Charts/PieChartView.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Charts/BubbleChartView.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Charts/LineChartView.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Charts/CandleStickChartView.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Charts/BarChartView.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Charts/HorizontalBarChartView.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Charts/RadarChartView.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Charts/ScatterChartView.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Implementations/Standard/ChartDataEntry.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Implementations/Standard/PieChartDataEntry.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Implementations/Standard/BubbleChartDataEntry.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Implementations/Standard/CandleChartDataEntry.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Implementations/Standard/BarChartDataEntry.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Implementations/Standard/RadarChartDataEntry.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Components/LegendEntry.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/ObjectiveC.apinotesc /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/Foundation.apinotesc /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreGraphics.apinotesc /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/UIKit.apinotesc /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreText.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/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/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/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Supporting\ Files/Charts.h /Users/hannh/Documents/MyGitHub/ChartsTest2/Build/Intermediates/Charts.build/Debug-iphonesimulator/Charts.build/unextended-module.modulemap
/Users/hannh/Documents/MyGitHub/ChartsTest2/Build/Intermediates/Charts.build/Debug-iphonesimulator/Charts.build/Objects-normal/x86_64/CandleStickChartView~partial.swiftdoc : /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Implementations/Standard/ChartData.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Implementations/Standard/CombinedChartData.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Implementations/Standard/PieChartData.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Implementations/Standard/BubbleChartData.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Implementations/Standard/BarLineScatterCandleBubbleChartData.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Implementations/Standard/CandleChartData.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Implementations/Standard/LineChartData.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Implementations/Standard/BarChartData.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Implementations/Standard/RadarChartData.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Implementations/Standard/ScatterChartData.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Jobs/ViewPortJob.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Jobs/AnimatedViewPortJob.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Jobs/MoveViewJob.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Jobs/AnimatedMoveViewJob.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Jobs/ZoomViewJob.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Jobs/AnimatedZoomViewJob.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Components/Legend.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Components/MarkerImage.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Highlight/Range.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Components/ChartLimitLine.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Renderers/ChartDataRendererBase.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Renderers/AxisRendererBase.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Components/AxisBase.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Components/ComponentBase.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Charts/ChartViewBase.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Charts/BarLineChartViewBase.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Charts/PieRadarChartViewBase.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Implementations/Standard/ChartDataEntryBase.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Animation/ChartAnimationEasing.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Utils/Fill.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Utils/Platform.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Components/Description.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Interfaces/ChartDataProvider.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Interfaces/CombinedChartDataProvider.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Interfaces/BubbleChartDataProvider.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Interfaces/BarLineScatterCandleBubbleChartDataProvider.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Interfaces/CandleChartDataProvider.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Interfaces/LineChartDataProvider.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Interfaces/BarChartDataProvider.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Interfaces/ScatterChartDataProvider.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Components/IMarker.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Utils/ViewPortHandler.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Utils/Transformer.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Renderers/Renderer.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Renderers/LegendRenderer.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Renderers/BarLineScatterCandleBubbleRenderer.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Renderers/Scatter/IShapeRenderer.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Renderers/Scatter/XShapeRenderer.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Renderers/Scatter/CircleShapeRenderer.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Renderers/Scatter/TriangleShapeRenderer.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Renderers/Scatter/SquareShapeRenderer.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Renderers/Scatter/ChevronDownShapeRenderer.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Renderers/Scatter/ChevronUpShapeRenderer.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Renderers/Scatter/CrossShapeRenderer.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Renderers/LineScatterCandleRadarRenderer.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Renderers/LineRadarRenderer.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Renderers/XAxisRenderer.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Renderers/YAxisRenderer.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Renderers/CombinedChartRenderer.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Renderers/PieChartRenderer.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Renderers/BubbleChartRenderer.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Renderers/LineChartRenderer.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Renderers/CandleStickChartRenderer.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Renderers/BarChartRenderer.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Renderers/HorizontalBarChartRenderer.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Renderers/RadarChartRenderer.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Renderers/ScatterChartRenderer.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Highlight/IHighlighter.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Highlight/CombinedHighlighter.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Highlight/PieHighlighter.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Highlight/BarHighlighter.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Highlight/HorizontalBarHighlighter.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Highlight/RadarHighlighter.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Highlight/PieRadarHighlighter.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Highlight/ChartHighlighter.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Formatters/IValueFormatter.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Formatters/IAxisValueFormatter.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Formatters/DefaultAxisValueFormatter.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Formatters/IndexAxisValueFormatter.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Formatters/DefaultValueFormatter.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Formatters/IFillFormatter.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Formatters/DefaultFillFormatter.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Animation/Animator.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Filters/DataApproximator.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Utils/ChartColorTemplates.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Components/XAxis.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Components/YAxis.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Utils/ChartUtils.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Implementations/ChartBaseDataSet.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Implementations/Standard/ChartDataSet.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Interfaces/IChartDataSet.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Implementations/Standard/PieChartDataSet.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Interfaces/IPieChartDataSet.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Implementations/Standard/BubbleChartDataSet.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Interfaces/IBubbleChartDataSet.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Implementations/Standard/BarLineScatterCandleBubbleChartDataSet.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Interfaces/IBarLineScatterCandleBubbleChartDataSet.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Implementations/Standard/CandleChartDataSet.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Interfaces/ICandleChartDataSet.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Implementations/Standard/LineChartDataSet.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Interfaces/ILineChartDataSet.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Implementations/Standard/BarChartDataSet.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Interfaces/IBarChartDataSet.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Implementations/Standard/RadarChartDataSet.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Interfaces/IRadarChartDataSet.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Implementations/Standard/LineScatterCandleRadarChartDataSet.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Interfaces/ILineScatterCandleRadarChartDataSet.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Implementations/Standard/LineRadarChartDataSet.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Interfaces/ILineRadarChartDataSet.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Implementations/Standard/ScatterChartDataSet.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Interfaces/IScatterChartDataSet.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Highlight/Highlight.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Utils/TransformerHorizontalBarChart.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Renderers/XAxisRendererHorizontalBarChart.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Renderers/YAxisRendererHorizontalBarChart.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Renderers/XAxisRendererRadarChart.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Renderers/YAxisRendererRadarChart.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Components/MarkerView.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Charts/CombinedChartView.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Charts/PieChartView.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Charts/BubbleChartView.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Charts/LineChartView.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Charts/CandleStickChartView.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Charts/BarChartView.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Charts/HorizontalBarChartView.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Charts/RadarChartView.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Charts/ScatterChartView.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Implementations/Standard/ChartDataEntry.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Implementations/Standard/PieChartDataEntry.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Implementations/Standard/BubbleChartDataEntry.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Implementations/Standard/CandleChartDataEntry.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Implementations/Standard/BarChartDataEntry.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Implementations/Standard/RadarChartDataEntry.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Components/LegendEntry.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/ObjectiveC.apinotesc /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/Foundation.apinotesc /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreGraphics.apinotesc /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/UIKit.apinotesc /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreText.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/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/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/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Supporting\ Files/Charts.h /Users/hannh/Documents/MyGitHub/ChartsTest2/Build/Intermediates/Charts.build/Debug-iphonesimulator/Charts.build/unextended-module.modulemap
| D |
module android.java.android.widget.TwoLineListItem_d_interface;
import arsd.jni : IJavaObjectImplementation, JavaPackageId, JavaName, IJavaObject, ImportExportImpl, JavaInterfaceMembers;
static import arsd.jni;
import import50 = android.java.android.view.contentcapture.ContentCaptureSession_d_interface;
import import37 = android.java.android.view.View_OnClickListener_d_interface;
import import12 = android.java.java.util.Collection_d_interface;
import import53 = android.java.android.view.View_OnApplyWindowInsetsListener_d_interface;
import import52 = android.java.android.view.accessibility.AccessibilityNodeProvider_d_interface;
import import47 = android.java.android.view.autofill.AutofillValue_d_interface;
import import83 = android.java.android.view.View_OnUnhandledKeyEventListener_d_interface;
import import43 = android.java.android.view.View_OnGenericMotionListener_d_interface;
import import84 = android.java.java.lang.Class_d_interface;
import import42 = android.java.android.view.View_OnTouchListener_d_interface;
import import45 = android.java.android.view.View_OnDragListener_d_interface;
import import72 = android.java.android.content.res.ColorStateList_d_interface;
import import23 = android.java.android.view.ViewParent_d_interface;
import import17 = android.java.android.view.PointerIcon_d_interface;
import import66 = android.java.android.view.WindowId_d_interface;
import import10 = android.java.android.view.accessibility.AccessibilityEvent_d_interface;
import import59 = android.java.android.view.TouchDelegate_d_interface;
import import61 = android.java.android.animation.StateListAnimator_d_interface;
import import9 = android.java.android.graphics.Rect_d_interface;
import import20 = android.java.android.view.ViewGroupOverlay_d_interface;
import import75 = android.java.android.view.ViewTreeObserver_d_interface;
import import70 = android.java.android.graphics.Canvas_d_interface;
import import63 = android.java.android.os.Handler_d_interface;
import import6 = android.java.android.view.View_d_interface;
import import21 = android.java.android.view.ViewGroup_OnHierarchyChangeListener_d_interface;
import import22 = android.java.android.animation.LayoutTransition_d_interface;
import import25 = android.java.android.view.animation.LayoutAnimationController_d_interface;
import import1 = android.java.android.util.AttributeSet_d_interface;
import import32 = android.java.android.graphics.drawable.Drawable_d_interface;
import import15 = android.java.android.view.KeyEvent_d_interface;
import import41 = android.java.android.view.View_OnKeyListener_d_interface;
import import40 = android.java.android.view.View_OnCreateContextMenuListener_d_interface;
import import44 = android.java.android.view.View_OnHoverListener_d_interface;
import import19 = android.java.android.os.Bundle_d_interface;
import import49 = android.java.android.view.autofill.AutofillId_d_interface;
import import51 = android.java.android.view.View_AccessibilityDelegate_d_interface;
import import82 = android.java.android.view.ViewPropertyAnimator_d_interface;
import import30 = android.java.java.util.Map_d_interface;
import import29 = android.java.android.view.ViewOverlay_d_interface;
import import64 = android.java.java.lang.Runnable_d_interface;
import import48 = android.java.android.util.SparseArray_d_interface;
import import68 = android.java.android.graphics.Paint_d_interface;
import import62 = android.java.android.view.ViewOutlineProvider_d_interface;
import import78 = android.java.android.content.ClipData_d_interface;
import import65 = android.java.android.os.IBinder_d_interface;
import import60 = android.java.android.graphics.Matrix_d_interface;
import import79 = android.java.android.view.View_DragShadowBuilder_d_interface;
import import55 = android.java.android.view.KeyEvent_DispatcherState_d_interface;
import import58 = android.java.android.view.ContextMenu_d_interface;
import import80 = android.java.android.view.ViewGroup_d_interface;
import import7 = android.java.android.view.ActionMode_d_interface;
import import39 = android.java.android.view.View_OnContextClickListener_d_interface;
import import57 = android.java.android.view.inputmethod.EditorInfo_d_interface;
import import14 = android.java.android.view.DragEvent_d_interface;
import import8 = android.java.android.view.ActionMode_Callback_d_interface;
import import13 = android.java.android.content.res.Configuration_d_interface;
import import27 = android.java.android.view.WindowInsets_d_interface;
import import5 = android.java.android.view.ViewGroup_LayoutParams_d_interface;
import import2 = android.java.android.widget.TextView_d_interface;
import import81 = android.java.android.view.View_OnCapturedPointerListener_d_interface;
import import38 = android.java.android.view.View_OnLongClickListener_d_interface;
import import4 = android.java.android.widget.RelativeLayout_LayoutParams_d_interface;
import import77 = android.java.android.view.View_OnSystemUiVisibilityChangeListener_d_interface;
import import24 = android.java.android.graphics.Point_d_interface;
import import69 = android.java.android.graphics.Bitmap_d_interface;
import import3 = android.java.java.lang.CharSequence_d_interface;
import import46 = android.java.android.view.accessibility.AccessibilityNodeInfo_d_interface;
import import74 = android.java.android.graphics.BlendMode_d_interface;
import import76 = android.java.android.view.animation.Animation_d_interface;
import import35 = android.java.android.view.View_OnLayoutChangeListener_d_interface;
import import71 = android.java.android.content.res.Resources_d_interface;
import import73 = android.java.android.graphics.PorterDuff_Mode_d_interface;
import import33 = android.java.android.view.View_OnScrollChangeListener_d_interface;
import import36 = android.java.android.view.View_OnAttachStateChangeListener_d_interface;
import import56 = android.java.android.view.inputmethod.InputConnection_d_interface;
import import28 = android.java.android.view.animation.Animation_AnimationListener_d_interface;
import import67 = android.java.android.view.Display_d_interface;
import import16 = android.java.android.view.MotionEvent_d_interface;
import import31 = android.java.android.content.res.TypedArray_d_interface;
import import11 = android.java.java.util.ArrayList_d_interface;
import import18 = android.java.android.view.ViewStructure_d_interface;
import import54 = android.java.java.util.List_d_interface;
import import34 = android.java.android.view.View_OnFocusChangeListener_d_interface;
import import26 = android.java.android.graphics.Region_d_interface;
import import0 = android.java.android.content.Context_d_interface;
final class TwoLineListItem : IJavaObject {
static immutable string[] _d_canCastTo = [
];
@Import this(import0.Context);
@Import this(import0.Context, import1.AttributeSet);
@Import this(import0.Context, import1.AttributeSet, int);
@Import this(import0.Context, import1.AttributeSet, int, int);
@Import import2.TextView getText1();
@Import import2.TextView getText2();
@Import import3.CharSequence getAccessibilityClassName();
@Import bool shouldDelayChildPressedState();
@Import void setIgnoreGravity(int);
@Import int getIgnoreGravity();
@Import int getGravity();
@Import void setGravity(int);
@Import void setHorizontalGravity(int);
@Import void setVerticalGravity(int);
@Import int getBaseline();
@Import void requestLayout();
@Import import4.RelativeLayout_LayoutParams generateLayoutParams(import1.AttributeSet);
@Import int getDescendantFocusability();
@Import void setDescendantFocusability(int);
@Import void requestChildFocus(import6.View, import6.View);
@Import void focusableViewAvailable(import6.View);
@Import bool showContextMenuForChild(import6.View);
@Import bool showContextMenuForChild(import6.View, float, float);
@Import import7.ActionMode startActionModeForChild(import6.View, import8.ActionMode_Callback);
@Import import7.ActionMode startActionModeForChild(import6.View, import8.ActionMode_Callback, int);
@Import import6.View focusSearch(import6.View, int);
@Import bool requestChildRectangleOnScreen(import6.View, import9.Rect, bool);
@Import bool requestSendAccessibilityEvent(import6.View, import10.AccessibilityEvent);
@Import bool onRequestSendAccessibilityEvent(import6.View, import10.AccessibilityEvent);
@Import void childHasTransientStateChanged(import6.View, bool);
@Import bool hasTransientState();
@Import bool dispatchUnhandledMove(import6.View, int);
@Import void clearChildFocus(import6.View);
@Import void clearFocus();
@Import import6.View getFocusedChild();
@Import bool hasFocus();
@Import import6.View findFocus();
@Import void addFocusables(import11.ArrayList, int, int);
@Import void addKeyboardNavigationClusters(import12.Collection, int);
@Import void setTouchscreenBlocksFocus(bool);
@Import bool getTouchscreenBlocksFocus();
@Import void findViewsWithText(import11.ArrayList, import3.CharSequence, int);
@Import void dispatchWindowFocusChanged(bool);
@Import void addTouchables(import11.ArrayList);
@Import void dispatchDisplayHint(int);
@Import void dispatchWindowVisibilityChanged(int);
@Import void dispatchConfigurationChanged(import13.Configuration);
@Import void recomputeViewAttributes(import6.View);
@Import void bringChildToFront(import6.View);
@Import bool dispatchDragEvent(import14.DragEvent);
@Import void dispatchWindowSystemUiVisiblityChanged(int);
@Import void dispatchSystemUiVisibilityChanged(int);
@Import bool dispatchKeyEventPreIme(import15.KeyEvent);
@Import bool dispatchKeyEvent(import15.KeyEvent);
@Import bool dispatchKeyShortcutEvent(import15.KeyEvent);
@Import bool dispatchTrackballEvent(import16.MotionEvent);
@Import bool dispatchCapturedPointerEvent(import16.MotionEvent);
@Import void dispatchPointerCaptureChanged(bool);
@Import import17.PointerIcon onResolvePointerIcon(import16.MotionEvent, int);
@Import void addChildrenForAccessibility(import11.ArrayList);
@Import bool onInterceptHoverEvent(import16.MotionEvent);
@Import bool dispatchTouchEvent(import16.MotionEvent);
@Import void setMotionEventSplittingEnabled(bool);
@Import bool isMotionEventSplittingEnabled();
@Import bool isTransitionGroup();
@Import void setTransitionGroup(bool);
@Import void requestDisallowInterceptTouchEvent(bool);
@Import bool onInterceptTouchEvent(import16.MotionEvent);
@Import bool requestFocus(int, import9.Rect);
@Import bool restoreDefaultFocus();
@Import void dispatchStartTemporaryDetach();
@Import void dispatchFinishTemporaryDetach();
@Import void dispatchProvideStructure(import18.ViewStructure);
@Import void dispatchProvideAutofillStructure(import18.ViewStructure, int);
@Import void notifySubtreeAccessibilityStateChanged(import6.View, import6.View, int);
@Import bool onNestedPrePerformAccessibilityAction(import6.View, int, import19.Bundle);
@Import import20.ViewGroupOverlay getOverlay();
@Import int getChildDrawingOrder(int);
@Import bool getClipChildren();
@Import void setClipChildren(bool);
@Import void setClipToPadding(bool);
@Import bool getClipToPadding();
@Import void dispatchSetSelected(bool);
@Import void dispatchSetActivated(bool);
@Import void dispatchDrawableHotspotChanged(float, float);
@Import void addView(import6.View);
@Import void addView(import6.View, int);
@Import void addView(import6.View, int, int);
@Import void addView(import6.View, import5.ViewGroup_LayoutParams);
@Import void addView(import6.View, int, import5.ViewGroup_LayoutParams);
@Import void updateViewLayout(import6.View, import5.ViewGroup_LayoutParams);
@Import void setOnHierarchyChangeListener(import21.ViewGroup_OnHierarchyChangeListener);
@Import void onViewAdded(import6.View);
@Import void onViewRemoved(import6.View);
@Import void removeView(import6.View);
@Import void removeViewInLayout(import6.View);
@Import void removeViewsInLayout(int, int);
@Import void removeViewAt(int);
@Import void removeViews(int, int);
@Import void setLayoutTransition(import22.LayoutTransition);
@Import import22.LayoutTransition getLayoutTransition();
@Import void removeAllViews();
@Import void removeAllViewsInLayout();
@Import void onDescendantInvalidated(import6.View, import6.View);
@Import void invalidateChild(import6.View, import9.Rect);
@Import import23.ViewParent invalidateChildInParent(int, import9.Rect[]);
@Import void offsetDescendantRectToMyCoords(import6.View, import9.Rect);
@Import void offsetRectIntoDescendantCoords(import6.View, import9.Rect);
@Import bool getChildVisibleRect(import6.View, import9.Rect, import24.Point);
@Import void layout(int, int, int, int);
@Import void startLayoutAnimation();
@Import void scheduleLayoutAnimation();
@Import void setLayoutAnimation(import25.LayoutAnimationController);
@Import import25.LayoutAnimationController getLayoutAnimation();
@Import bool isAnimationCacheEnabled();
@Import void setAnimationCacheEnabled(bool);
@Import bool isAlwaysDrawnWithCacheEnabled();
@Import void setAlwaysDrawnWithCacheEnabled(bool);
@Import int getPersistentDrawingCache();
@Import void setPersistentDrawingCache(int);
@Import int getLayoutMode();
@Import void setLayoutMode(int);
@Import int indexOfChild(import6.View);
@Import int getChildCount();
@Import import6.View getChildAt(int);
@Import static int getChildMeasureSpec(int, int, int);
@Import void clearDisappearingChildren();
@Import void startViewTransition(import6.View);
@Import void endViewTransition(import6.View);
@Import void suppressLayout(bool);
@Import bool isLayoutSuppressed();
@Import bool gatherTransparentRegion(import26.Region);
@Import void requestTransparentRegion(import6.View);
@Import import27.WindowInsets dispatchApplyWindowInsets(import27.WindowInsets);
@Import import28.Animation_AnimationListener getLayoutAnimationListener();
@Import void jumpDrawablesToCurrentState();
@Import void setAddStatesFromChildren(bool);
@Import bool addStatesFromChildren();
@Import void childDrawableStateChanged(import6.View);
@Import void setLayoutAnimationListener(import28.Animation_AnimationListener);
@Import bool onStartNestedScroll(import6.View, import6.View, int);
@Import void onNestedScrollAccepted(import6.View, import6.View, int);
@Import void onStopNestedScroll(import6.View);
@Import void onNestedScroll(import6.View, int, int, int, int);
@Import void onNestedPreScroll(import6.View, int, int, int[]);
@Import bool onNestedFling(import6.View, float, float, bool);
@Import bool onNestedPreFling(import6.View, float, float);
@Import int getNestedScrollAxes();
@Import int[] getAttributeResolutionStack(int);
@Import import30.Map getAttributeSourceResourceMap();
@Import int getExplicitStyle();
@Import void saveAttributeDataForStyleable(import0.Context, int, import1.AttributeSet, import31.TypedArray, int, int[]);
@Import @JavaName("toString") string toString_();
override string toString() { return arsd.jni.javaObjectToString(this); }
@Import int getVerticalFadingEdgeLength();
@Import void setFadingEdgeLength(int);
@Import int getHorizontalFadingEdgeLength();
@Import int getVerticalScrollbarWidth();
@Import void setVerticalScrollbarThumbDrawable(import32.Drawable);
@Import void setVerticalScrollbarTrackDrawable(import32.Drawable);
@Import void setHorizontalScrollbarThumbDrawable(import32.Drawable);
@Import void setHorizontalScrollbarTrackDrawable(import32.Drawable);
@Import import32.Drawable getVerticalScrollbarThumbDrawable();
@Import import32.Drawable getVerticalScrollbarTrackDrawable();
@Import import32.Drawable getHorizontalScrollbarThumbDrawable();
@Import import32.Drawable getHorizontalScrollbarTrackDrawable();
@Import void setVerticalScrollbarPosition(int);
@Import int getVerticalScrollbarPosition();
@Import void setScrollIndicators(int);
@Import void setScrollIndicators(int, int);
@Import int getScrollIndicators();
@Import void setOnScrollChangeListener(import33.View_OnScrollChangeListener);
@Import void setOnFocusChangeListener(import34.View_OnFocusChangeListener);
@Import void addOnLayoutChangeListener(import35.View_OnLayoutChangeListener);
@Import void removeOnLayoutChangeListener(import35.View_OnLayoutChangeListener);
@Import void addOnAttachStateChangeListener(import36.View_OnAttachStateChangeListener);
@Import void removeOnAttachStateChangeListener(import36.View_OnAttachStateChangeListener);
@Import import34.View_OnFocusChangeListener getOnFocusChangeListener();
@Import void setOnClickListener(import37.View_OnClickListener);
@Import bool hasOnClickListeners();
@Import void setOnLongClickListener(import38.View_OnLongClickListener);
@Import void setOnContextClickListener(import39.View_OnContextClickListener);
@Import void setOnCreateContextMenuListener(import40.View_OnCreateContextMenuListener);
@Import bool performClick();
@Import bool callOnClick();
@Import bool performLongClick();
@Import bool performLongClick(float, float);
@Import bool performContextClick(float, float);
@Import bool performContextClick();
@Import bool showContextMenu();
@Import bool showContextMenu(float, float);
@Import import7.ActionMode startActionMode(import8.ActionMode_Callback);
@Import import7.ActionMode startActionMode(import8.ActionMode_Callback, int);
@Import void setOnKeyListener(import41.View_OnKeyListener);
@Import void setOnTouchListener(import42.View_OnTouchListener);
@Import void setOnGenericMotionListener(import43.View_OnGenericMotionListener);
@Import void setOnHoverListener(import44.View_OnHoverListener);
@Import void setOnDragListener(import45.View_OnDragListener);
@Import void setRevealOnFocusHint(bool);
@Import bool getRevealOnFocusHint();
@Import bool requestRectangleOnScreen(import9.Rect);
@Import bool requestRectangleOnScreen(import9.Rect, bool);
@Import bool hasFocusable();
@Import bool hasExplicitFocusable();
@Import void setAccessibilityPaneTitle(import3.CharSequence);
@Import import3.CharSequence getAccessibilityPaneTitle();
@Import void sendAccessibilityEvent(int);
@Import void announceForAccessibility(import3.CharSequence);
@Import void sendAccessibilityEventUnchecked(import10.AccessibilityEvent);
@Import bool dispatchPopulateAccessibilityEvent(import10.AccessibilityEvent);
@Import void onPopulateAccessibilityEvent(import10.AccessibilityEvent);
@Import void onInitializeAccessibilityEvent(import10.AccessibilityEvent);
@Import import46.AccessibilityNodeInfo createAccessibilityNodeInfo();
@Import void onInitializeAccessibilityNodeInfo(import46.AccessibilityNodeInfo);
@Import void onProvideStructure(import18.ViewStructure);
@Import void onProvideAutofillStructure(import18.ViewStructure, int);
@Import void onProvideVirtualStructure(import18.ViewStructure);
@Import void onProvideAutofillVirtualStructure(import18.ViewStructure, int);
@Import void autofill(import47.AutofillValue);
@Import void autofill(import48.SparseArray);
@Import import49.AutofillId getAutofillId();
@Import void setAutofillId(import49.AutofillId);
@Import int getAutofillType();
@Import string[] getAutofillHints();
@Import import47.AutofillValue getAutofillValue();
@Import int getImportantForAutofill();
@Import void setImportantForAutofill(int);
@Import bool isImportantForAutofill();
@Import void setContentCaptureSession(import50.ContentCaptureSession);
@Import import50.ContentCaptureSession getContentCaptureSession();
@Import void addExtraDataToAccessibilityNodeInfo(import46.AccessibilityNodeInfo, string, import19.Bundle);
@Import bool isVisibleToUserForAutofill(int);
@Import import51.View_AccessibilityDelegate getAccessibilityDelegate();
@Import void setAccessibilityDelegate(import51.View_AccessibilityDelegate);
@Import import52.AccessibilityNodeProvider getAccessibilityNodeProvider();
@Import import3.CharSequence getContentDescription();
@Import void setContentDescription(import3.CharSequence);
@Import void setAccessibilityTraversalBefore(int);
@Import int getAccessibilityTraversalBefore();
@Import void setAccessibilityTraversalAfter(int);
@Import int getAccessibilityTraversalAfter();
@Import int getLabelFor();
@Import void setLabelFor(int);
@Import bool isFocused();
@Import bool isScrollContainer();
@Import void setScrollContainer(bool);
@Import int getDrawingCacheQuality();
@Import void setDrawingCacheQuality(int);
@Import bool getKeepScreenOn();
@Import void setKeepScreenOn(bool);
@Import int getNextFocusLeftId();
@Import void setNextFocusLeftId(int);
@Import int getNextFocusRightId();
@Import void setNextFocusRightId(int);
@Import int getNextFocusUpId();
@Import void setNextFocusUpId(int);
@Import int getNextFocusDownId();
@Import void setNextFocusDownId(int);
@Import int getNextFocusForwardId();
@Import void setNextFocusForwardId(int);
@Import int getNextClusterForwardId();
@Import void setNextClusterForwardId(int);
@Import bool isShown();
@Import import27.WindowInsets onApplyWindowInsets(import27.WindowInsets);
@Import void setOnApplyWindowInsetsListener(import53.View_OnApplyWindowInsetsListener);
@Import void setSystemGestureExclusionRects(import54.List);
@Import import54.List getSystemGestureExclusionRects();
@Import void getLocationInSurface(int[]);
@Import import27.WindowInsets getRootWindowInsets();
@Import import27.WindowInsets computeSystemWindowInsets(import27.WindowInsets, import9.Rect);
@Import void setFitsSystemWindows(bool);
@Import bool getFitsSystemWindows();
@Import void requestFitSystemWindows();
@Import void requestApplyInsets();
@Import int getVisibility();
@Import void setVisibility(int);
@Import bool isEnabled();
@Import void setEnabled(bool);
@Import void setFocusable(bool);
@Import void setFocusable(int);
@Import void setFocusableInTouchMode(bool);
@Import void setAutofillHints(string[]);
@Import void setSoundEffectsEnabled(bool);
@Import bool isSoundEffectsEnabled();
@Import void setHapticFeedbackEnabled(bool);
@Import bool isHapticFeedbackEnabled();
@Import void setLayoutDirection(int);
@Import int getLayoutDirection();
@Import void setHasTransientState(bool);
@Import bool isAttachedToWindow();
@Import bool isLaidOut();
@Import void setWillNotDraw(bool);
@Import bool willNotDraw();
@Import void setWillNotCacheDrawing(bool);
@Import bool willNotCacheDrawing();
@Import bool isClickable();
@Import void setClickable(bool);
@Import bool isLongClickable();
@Import void setLongClickable(bool);
@Import bool isContextClickable();
@Import void setContextClickable(bool);
@Import void setPressed(bool);
@Import bool isPressed();
@Import bool isSaveEnabled();
@Import void setSaveEnabled(bool);
@Import bool getFilterTouchesWhenObscured();
@Import void setFilterTouchesWhenObscured(bool);
@Import bool isSaveFromParentEnabled();
@Import void setSaveFromParentEnabled(bool);
@Import bool isFocusable();
@Import int getFocusable();
@Import bool isFocusableInTouchMode();
@Import bool isScreenReaderFocusable();
@Import void setScreenReaderFocusable(bool);
@Import bool isAccessibilityHeading();
@Import void setAccessibilityHeading(bool);
@Import import6.View focusSearch(int);
@Import bool isKeyboardNavigationCluster();
@Import void setKeyboardNavigationCluster(bool);
@Import bool isFocusedByDefault();
@Import void setFocusedByDefault(bool);
@Import import6.View keyboardNavigationClusterSearch(import6.View, int);
@Import void setDefaultFocusHighlightEnabled(bool);
@Import bool getDefaultFocusHighlightEnabled();
@Import import11.ArrayList getFocusables(int);
@Import void addFocusables(import11.ArrayList, int);
@Import import11.ArrayList getTouchables();
@Import bool isAccessibilityFocused();
@Import bool requestFocus();
@Import bool requestFocus(int);
@Import bool requestFocusFromTouch();
@Import int getImportantForAccessibility();
@Import void setAccessibilityLiveRegion(int);
@Import int getAccessibilityLiveRegion();
@Import void setImportantForAccessibility(int);
@Import bool isImportantForAccessibility();
@Import import23.ViewParent getParentForAccessibility();
@Import void setTransitionVisibility(int);
@Import bool dispatchNestedPrePerformAccessibilityAction(int, import19.Bundle);
@Import bool performAccessibilityAction(int, import19.Bundle);
@Import bool isTemporarilyDetached();
@Import void onStartTemporaryDetach();
@Import void onFinishTemporaryDetach();
@Import import55.KeyEvent_DispatcherState getKeyDispatcherState();
@Import bool onFilterTouchEventForSecurity(import16.MotionEvent);
@Import bool dispatchGenericMotionEvent(import16.MotionEvent);
@Import void onWindowFocusChanged(bool);
@Import bool hasWindowFocus();
@Import void onVisibilityAggregated(bool);
@Import int getWindowVisibility();
@Import void getWindowVisibleDisplayFrame(import9.Rect);
@Import bool isInTouchMode();
@Import import0.Context getContext();
@Import bool onKeyPreIme(int, import15.KeyEvent);
@Import bool onKeyDown(int, import15.KeyEvent);
@Import bool onKeyLongPress(int, import15.KeyEvent);
@Import bool onKeyUp(int, import15.KeyEvent);
@Import bool onKeyMultiple(int, int, import15.KeyEvent);
@Import bool onKeyShortcut(int, import15.KeyEvent);
@Import bool onCheckIsTextEditor();
@Import import56.InputConnection onCreateInputConnection(import57.EditorInfo);
@Import bool checkInputConnectionProxy(import6.View);
@Import void createContextMenu(import58.ContextMenu);
@Import bool onTrackballEvent(import16.MotionEvent);
@Import bool onGenericMotionEvent(import16.MotionEvent);
@Import bool onHoverEvent(import16.MotionEvent);
@Import bool isHovered();
@Import void setHovered(bool);
@Import void onHoverChanged(bool);
@Import bool onTouchEvent(import16.MotionEvent);
@Import void cancelLongPress();
@Import void setTouchDelegate(import59.TouchDelegate);
@Import import59.TouchDelegate getTouchDelegate();
@Import void requestUnbufferedDispatch(import16.MotionEvent);
@Import void bringToFront();
@Import import23.ViewParent getParent();
@Import void setScrollX(int);
@Import void setScrollY(int);
@Import int getScrollX();
@Import int getScrollY();
@Import int getWidth();
@Import int getHeight();
@Import void getDrawingRect(import9.Rect);
@Import int getMeasuredWidth();
@Import int getMeasuredWidthAndState();
@Import int getMeasuredHeight();
@Import int getMeasuredHeightAndState();
@Import int getMeasuredState();
@Import import60.Matrix getMatrix();
@Import float getCameraDistance();
@Import void setCameraDistance(float);
@Import float getRotation();
@Import void setRotation(float);
@Import float getRotationY();
@Import void setRotationY(float);
@Import float getRotationX();
@Import void setRotationX(float);
@Import float getScaleX();
@Import void setScaleX(float);
@Import float getScaleY();
@Import void setScaleY(float);
@Import float getPivotX();
@Import void setPivotX(float);
@Import float getPivotY();
@Import void setPivotY(float);
@Import bool isPivotSet();
@Import void resetPivot();
@Import float getAlpha();
@Import void forceHasOverlappingRendering(bool);
@Import bool getHasOverlappingRendering();
@Import bool hasOverlappingRendering();
@Import void setAlpha(float);
@Import void setTransitionAlpha(float);
@Import float getTransitionAlpha();
@Import void setForceDarkAllowed(bool);
@Import bool isForceDarkAllowed();
@Import int getTop();
@Import void setTop(int);
@Import int getBottom();
@Import bool isDirty();
@Import void setBottom(int);
@Import int getLeft();
@Import void setLeft(int);
@Import int getRight();
@Import void setRight(int);
@Import float getX();
@Import void setX(float);
@Import float getY();
@Import void setY(float);
@Import float getZ();
@Import void setZ(float);
@Import float getElevation();
@Import void setElevation(float);
@Import float getTranslationX();
@Import void setTranslationX(float);
@Import float getTranslationY();
@Import void setTranslationY(float);
@Import float getTranslationZ();
@Import void setTranslationZ(float);
@Import void setAnimationMatrix(import60.Matrix);
@Import import60.Matrix getAnimationMatrix();
@Import import61.StateListAnimator getStateListAnimator();
@Import void setStateListAnimator(import61.StateListAnimator);
@Import bool getClipToOutline();
@Import void setClipToOutline(bool);
@Import void setOutlineProvider(import62.ViewOutlineProvider);
@Import import62.ViewOutlineProvider getOutlineProvider();
@Import void invalidateOutline();
@Import void setOutlineSpotShadowColor(int);
@Import int getOutlineSpotShadowColor();
@Import void setOutlineAmbientShadowColor(int);
@Import int getOutlineAmbientShadowColor();
@Import void getHitRect(import9.Rect);
@Import void getFocusedRect(import9.Rect);
@Import bool getGlobalVisibleRect(import9.Rect, import24.Point);
@Import bool getGlobalVisibleRect(import9.Rect);
@Import bool getLocalVisibleRect(import9.Rect);
@Import void offsetTopAndBottom(int);
@Import void offsetLeftAndRight(int);
@Import import5.ViewGroup_LayoutParams getLayoutParams();
@Import void setLayoutParams(import5.ViewGroup_LayoutParams);
@Import void scrollTo(int, int);
@Import void scrollBy(int, int);
@Import void invalidate(import9.Rect);
@Import void invalidate(int, int, int, int);
@Import void invalidate();
@Import bool isOpaque();
@Import import63.Handler getHandler();
@Import bool post(import64.Runnable);
@Import bool postDelayed(import64.Runnable, long);
@Import void postOnAnimation(import64.Runnable);
@Import void postOnAnimationDelayed(import64.Runnable, long);
@Import bool removeCallbacks(import64.Runnable);
@Import void postInvalidate();
@Import void postInvalidate(int, int, int, int);
@Import void postInvalidateDelayed(long);
@Import void postInvalidateDelayed(long, int, int, int, int);
@Import void postInvalidateOnAnimation();
@Import void postInvalidateOnAnimation(int, int, int, int);
@Import void computeScroll();
@Import bool isHorizontalFadingEdgeEnabled();
@Import void setHorizontalFadingEdgeEnabled(bool);
@Import bool isVerticalFadingEdgeEnabled();
@Import void setVerticalFadingEdgeEnabled(bool);
@Import bool isHorizontalScrollBarEnabled();
@Import void setHorizontalScrollBarEnabled(bool);
@Import bool isVerticalScrollBarEnabled();
@Import void setVerticalScrollBarEnabled(bool);
@Import void setScrollbarFadingEnabled(bool);
@Import bool isScrollbarFadingEnabled();
@Import int getScrollBarDefaultDelayBeforeFade();
@Import void setScrollBarDefaultDelayBeforeFade(int);
@Import int getScrollBarFadeDuration();
@Import void setScrollBarFadeDuration(int);
@Import int getScrollBarSize();
@Import void setScrollBarSize(int);
@Import void setScrollBarStyle(int);
@Import int getScrollBarStyle();
@Import bool canScrollHorizontally(int);
@Import bool canScrollVertically(int);
@Import void onScreenStateChanged(int);
@Import void onRtlPropertiesChanged(int);
@Import bool canResolveLayoutDirection();
@Import bool isLayoutDirectionResolved();
@Import import65.IBinder getWindowToken();
@Import import66.WindowId getWindowId();
@Import import65.IBinder getApplicationWindowToken();
@Import import67.Display getDisplay();
@Import void cancelPendingInputEvents();
@Import void onCancelPendingInputEvents();
@Import void saveHierarchyState(import48.SparseArray);
@Import void restoreHierarchyState(import48.SparseArray);
@Import long getDrawingTime();
@Import void setDuplicateParentStateEnabled(bool);
@Import bool isDuplicateParentStateEnabled();
@Import void setLayerType(int, import68.Paint);
@Import void setLayerPaint(import68.Paint);
@Import int getLayerType();
@Import void buildLayer();
@Import void setDrawingCacheEnabled(bool);
@Import bool isDrawingCacheEnabled();
@Import import69.Bitmap getDrawingCache();
@Import import69.Bitmap getDrawingCache(bool);
@Import void destroyDrawingCache();
@Import void setDrawingCacheBackgroundColor(int);
@Import int getDrawingCacheBackgroundColor();
@Import void buildDrawingCache();
@Import void buildDrawingCache(bool);
@Import bool isInEditMode();
@Import bool isHardwareAccelerated();
@Import void setClipBounds(import9.Rect);
@Import import9.Rect getClipBounds();
@Import bool getClipBounds(import9.Rect);
@Import void draw(import70.Canvas);
@Import int getSolidColor();
@Import bool isLayoutRequested();
@Import void setLeftTopRightBottom(int, int, int, int);
@Import import71.Resources getResources();
@Import void invalidateDrawable(import32.Drawable);
@Import void scheduleDrawable(import32.Drawable, import64.Runnable, long);
@Import void unscheduleDrawable(import32.Drawable, import64.Runnable);
@Import void unscheduleDrawable(import32.Drawable);
@Import void drawableHotspotChanged(float, float);
@Import void refreshDrawableState();
@Import int[] getDrawableState();
@Import void setBackgroundColor(int);
@Import void setBackgroundResource(int);
@Import void setBackground(import32.Drawable);
@Import void setBackgroundDrawable(import32.Drawable);
@Import import32.Drawable getBackground();
@Import void setBackgroundTintList(import72.ColorStateList);
@Import import72.ColorStateList getBackgroundTintList();
@Import void setBackgroundTintMode(import73.PorterDuff_Mode);
@Import void setBackgroundTintBlendMode(import74.BlendMode);
@Import import73.PorterDuff_Mode getBackgroundTintMode();
@Import import74.BlendMode getBackgroundTintBlendMode();
@Import import32.Drawable getForeground();
@Import void setForeground(import32.Drawable);
@Import int getForegroundGravity();
@Import void setForegroundGravity(int);
@Import void setForegroundTintList(import72.ColorStateList);
@Import import72.ColorStateList getForegroundTintList();
@Import void setForegroundTintMode(import73.PorterDuff_Mode);
@Import void setForegroundTintBlendMode(import74.BlendMode);
@Import import73.PorterDuff_Mode getForegroundTintMode();
@Import import74.BlendMode getForegroundTintBlendMode();
@Import void onDrawForeground(import70.Canvas);
@Import void setPadding(int, int, int, int);
@Import void setPaddingRelative(int, int, int, int);
@Import int getSourceLayoutResId();
@Import int getPaddingTop();
@Import int getPaddingBottom();
@Import int getPaddingLeft();
@Import int getPaddingStart();
@Import int getPaddingRight();
@Import int getPaddingEnd();
@Import bool isPaddingRelative();
@Import void setSelected(bool);
@Import bool isSelected();
@Import void setActivated(bool);
@Import bool isActivated();
@Import import75.ViewTreeObserver getViewTreeObserver();
@Import import6.View getRootView();
@Import void transformMatrixToGlobal(import60.Matrix);
@Import void transformMatrixToLocal(import60.Matrix);
@Import void getLocationOnScreen(int[]);
@Import void getLocationInWindow(int[]);
@Import import6.View findViewById(int);
@Import import6.View requireViewById(int);
@Import import6.View findViewWithTag(IJavaObject);
@Import void setId(int);
@Import int getId();
@Import long getUniqueDrawingId();
@Import IJavaObject getTag();
@Import void setTag(IJavaObject);
@Import IJavaObject getTag(int);
@Import void setTag(int, IJavaObject);
@Import bool isInLayout();
@Import void forceLayout();
@Import void measure(int, int);
@Import static int combineMeasuredStates(int, int);
@Import static int resolveSize(int, int);
@Import static int resolveSizeAndState(int, int, int);
@Import static int getDefaultSize(int, int);
@Import int getMinimumHeight();
@Import void setMinimumHeight(int);
@Import int getMinimumWidth();
@Import void setMinimumWidth(int);
@Import import76.Animation getAnimation();
@Import void startAnimation(import76.Animation);
@Import void clearAnimation();
@Import void setAnimation(import76.Animation);
@Import void playSoundEffect(int);
@Import bool performHapticFeedback(int);
@Import bool performHapticFeedback(int, int);
@Import void setSystemUiVisibility(int);
@Import int getSystemUiVisibility();
@Import int getWindowSystemUiVisibility();
@Import void onWindowSystemUiVisibilityChanged(int);
@Import void setOnSystemUiVisibilityChangeListener(import77.View_OnSystemUiVisibilityChangeListener);
@Import bool startDrag(import78.ClipData, import79.View_DragShadowBuilder, IJavaObject, int);
@Import bool startDragAndDrop(import78.ClipData, import79.View_DragShadowBuilder, IJavaObject, int);
@Import void cancelDragAndDrop();
@Import void updateDragShadow(import79.View_DragShadowBuilder);
@Import bool onDragEvent(import14.DragEvent);
@Import static import6.View inflate(import0.Context, int, import80.ViewGroup);
@Import int getOverScrollMode();
@Import void setOverScrollMode(int);
@Import void setNestedScrollingEnabled(bool);
@Import bool isNestedScrollingEnabled();
@Import bool startNestedScroll(int);
@Import void stopNestedScroll();
@Import bool hasNestedScrollingParent();
@Import bool dispatchNestedScroll(int, int, int, int, int[]);
@Import bool dispatchNestedPreScroll(int, int, int, int[][]);
@Import bool dispatchNestedFling(float, float, bool);
@Import bool dispatchNestedPreFling(float, float);
@Import void setTextDirection(int);
@Import int getTextDirection();
@Import bool canResolveTextDirection();
@Import bool isTextDirectionResolved();
@Import void setTextAlignment(int);
@Import int getTextAlignment();
@Import bool canResolveTextAlignment();
@Import bool isTextAlignmentResolved();
@Import static int generateViewId();
@Import void setPointerIcon(import17.PointerIcon);
@Import import17.PointerIcon getPointerIcon();
@Import bool hasPointerCapture();
@Import void requestPointerCapture();
@Import void releasePointerCapture();
@Import void onPointerCaptureChange(bool);
@Import bool onCapturedPointerEvent(import16.MotionEvent);
@Import void setOnCapturedPointerListener(import81.View_OnCapturedPointerListener);
@Import import82.ViewPropertyAnimator animate();
@Import void setTransitionName(string);
@Import string getTransitionName();
@Import void setTooltipText(import3.CharSequence);
@Import import3.CharSequence getTooltipText();
@Import void addOnUnhandledKeyEventListener(import83.View_OnUnhandledKeyEventListener);
@Import void removeOnUnhandledKeyEventListener(import83.View_OnUnhandledKeyEventListener);
@Import import84.Class getClass();
@Import int hashCode();
@Import bool equals(IJavaObject);
@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/widget/TwoLineListItem;";
}
| D |
// Written in the D programming language.
/**
* Read/write data in the $(LINK2 http://www.info-zip.org, _zip archive) format.
* Makes use of the etc.c.zlib compression library.
*
* Bugs:
* $(UL
* $(LI Multi-disk zips not supported.)
* $(LI Only Zip version 20 formats are supported.)
* $(LI Only supports compression modes 0 (no compression) and 8 (deflate).)
* $(LI Does not support encryption.)
* $(LI $(BUGZILLA 592))
* $(LI $(BUGZILLA 2137))
* )
*
* Example:
* ---
// Read existing zip file.
import std.digest.crc, std.file, std.stdio, std.zip;
void main(string[] args)
{
// read a zip file into memory
auto zip = new ZipArchive(read(args[1]));
writeln("Archive: ", args[1]);
writefln("%-10s %-8s Name", "Length", "CRC-32");
// iterate over all zip members
foreach (name, am; zip.directory)
{
// print some data about each member
writefln("%10s %08x %s", am.expandedSize, am.crc32, name);
assert(am.expandedData.length == 0);
// decompress the archive member
zip.expand(am);
assert(am.expandedData.length == am.expandedSize);
}
}
// Create and write new zip file.
import std.file : write;
import std.string : representation;
void main()
{
char[] data = "Test data.\n".dup;
// Create an ArchiveMember for the test file.
ArchiveMember am = new ArchiveMember();
am.name = "test.txt";
am.expandedData(data.representation);
// Create an archive and add the member.
ZipArchive zip = new ZipArchive();
zip.addMember(am);
// Build the archive
void[] compressed_data = zip.build();
// Write to a file
write("test.zip", compressed_data);
}
* ---
*
* Copyright: Copyright Digital Mars 2000 - 2009.
* License: $(HTTP www.boost.org/LICENSE_1_0.txt, Boost License 1.0).
* Authors: $(HTTP digitalmars.com, Walter Bright)
* Source: $(PHOBOSSRC std/_zip.d)
*/
/* Copyright Digital Mars 2000 - 2009.
* 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 std.zip;
//debug=print;
/** Thrown on error.
*/
class ZipException : Exception
{
this(string msg) @safe
{
super("ZipException: " ~ msg);
}
}
/**
* Compression method used by ArchiveMember
*/
enum CompressionMethod : ushort
{
none = 0, /// No compression, just archiving
deflate = 8 /// Deflate algorithm. Use zlib library to compress
}
/**
* A member of the ZipArchive.
*/
final class ArchiveMember
{
import std.conv : to, octal;
import std.datetime : DosFileTime, SysTime, SysTimeToDosFileTime;
/**
* Read/Write: Usually the file name of the archive member; it is used to
* index the archive directory for the member. Each member must have a unique
* name[]. Do not change without removing member from the directory first.
*/
string name;
ubyte[] extra; /// Read/Write: extra data for this member.
string comment; /// Read/Write: comment associated with this member.
private ubyte[] _compressedData;
private ubyte[] _expandedData;
private uint offset;
private uint _crc32;
private uint _compressedSize;
private uint _expandedSize;
private CompressionMethod _compressionMethod;
private ushort _madeVersion = 20;
private ushort _extractVersion = 20;
private ushort _diskNumber;
private uint _externalAttributes;
private DosFileTime _time;
ushort flags; /// Read/Write: normally set to 0
ushort internalAttributes; /// Read/Write
@property ushort extractVersion() { return _extractVersion; } /// Read Only
@property uint crc32() { return _crc32; } /// Read Only: cyclic redundancy check (CRC) value
/// Read Only: size of data of member in compressed form.
@property uint compressedSize() { return _compressedSize; }
/// Read Only: size of data of member in expanded form.
@property uint expandedSize() { return _expandedSize; }
@property ushort diskNumber() { return _diskNumber; } /// Read Only: should be 0.
/// Read Only: data of member in compressed form.
@property ubyte[] compressedData() { return _compressedData; }
/// Read data of member in uncompressed form.
@property ubyte[] expandedData() { return _expandedData; }
/// Write data of member in uncompressed form.
@property @safe void expandedData(ubyte[] ed)
{
_expandedData = ed;
_expandedSize = to!uint(_expandedData.length);
// Clean old compressed data, if any
_compressedData.length = 0;
_compressedSize = 0;
}
/**
* Set the OS specific file attributes, as obtained by
* $(REF getAttributes, std,file) or $(REF DirEntry.attributes, std,file), for this archive member.
*/
@property @safe void fileAttributes(uint attr)
{
version (Posix)
{
_externalAttributes = (attr & 0xFFFF) << 16;
_madeVersion &= 0x00FF;
_madeVersion |= 0x0300; // attributes are in UNIX format
}
else version (Windows)
{
_externalAttributes = attr;
_madeVersion &= 0x00FF; // attributes are in MS-DOS and OS/2 format
}
else
{
static assert(0, "Unimplemented platform");
}
}
version (Posix) @safe unittest
{
auto am = new ArchiveMember();
am.fileAttributes = octal!100644;
assert(am._externalAttributes == octal!100644 << 16);
assert((am._madeVersion & 0xFF00) == 0x0300);
}
/**
* Get the OS specific file attributes for the archive member.
*
* Returns: The file attributes or 0 if the file attributes were
* encoded for an incompatible OS (Windows vs. Posix).
*
*/
@property uint fileAttributes() const
{
version (Posix)
{
if ((_madeVersion & 0xFF00) == 0x0300)
return _externalAttributes >> 16;
return 0;
}
else version (Windows)
{
if ((_madeVersion & 0xFF00) == 0x0000)
return _externalAttributes;
return 0;
}
else
{
static assert(0, "Unimplemented platform");
}
}
/// Set the last modification time for this member.
@property void time(SysTime time)
{
_time = SysTimeToDosFileTime(time);
}
/// ditto
@property void time(DosFileTime time)
{
_time = time;
}
/// Get the last modification time for this member.
@property DosFileTime time() const
{
return _time;
}
/**
* Read compression method used for this member
* See_Also:
* CompressionMethod
**/
@property @safe CompressionMethod compressionMethod() { return _compressionMethod; }
/**
* Write compression method used for this member
* See_Also:
* CompressionMethod
**/
@property void compressionMethod(CompressionMethod cm)
{
if (cm == _compressionMethod) return;
if (_compressedSize > 0)
throw new ZipException("Can't change compression method for a compressed element");
_compressionMethod = cm;
}
debug(print)
{
void print()
{
printf("name = '%.*s'\n", name.length, name.ptr);
printf("\tcomment = '%.*s'\n", comment.length, comment.ptr);
printf("\tmadeVersion = x%04x\n", _madeVersion);
printf("\textractVersion = x%04x\n", extractVersion);
printf("\tflags = x%04x\n", flags);
printf("\tcompressionMethod = %d\n", compressionMethod);
printf("\ttime = %d\n", time);
printf("\tcrc32 = x%08x\n", crc32);
printf("\texpandedSize = %d\n", expandedSize);
printf("\tcompressedSize = %d\n", compressedSize);
printf("\tinternalAttributes = x%04x\n", internalAttributes);
printf("\texternalAttributes = x%08x\n", externalAttributes);
}
}
}
/**
* Object representing the entire archive.
* ZipArchives are collections of ArchiveMembers.
*/
final class ZipArchive
{
import std.bitmanip : littleEndianToNative, nativeToLittleEndian;
import std.algorithm : max;
import std.conv : to;
import std.datetime : DosFileTime;
string comment; /// Read/Write: the archive comment. Must be less than 65536 bytes in length.
private ubyte[] _data;
private uint endrecOffset;
private uint _diskNumber;
private uint _diskStartDir;
private uint _numEntries;
private uint _totalEntries;
private bool _isZip64;
static const ushort zip64ExtractVersion = 45;
static const int digiSignLength = 6;
static const int eocd64LocLength = 20;
static const int eocd64Length = 56;
/// Read Only: array representing the entire contents of the archive.
@property @safe ubyte[] data() { return _data; }
/// Read Only: 0 since multi-disk zip archives are not supported.
@property @safe uint diskNumber() { return _diskNumber; }
/// Read Only: 0 since multi-disk zip archives are not supported
@property @safe uint diskStartDir() { return _diskStartDir; }
/// Read Only: number of ArchiveMembers in the directory.
@property @safe uint numEntries() { return _numEntries; }
@property @safe uint totalEntries() { return _totalEntries; } /// ditto
/// True when the archive is in Zip64 format.
@property @safe bool isZip64() { return _isZip64; }
/// Set this to true to force building a Zip64 archive.
@property @safe void isZip64(bool value) { _isZip64 = value; }
/**
* Read Only: array indexed by the name of each member of the archive.
* All the members of the archive can be accessed with a foreach loop:
* Example:
* --------------------
* ZipArchive archive = new ZipArchive(data);
* foreach (ArchiveMember am; archive.directory)
* {
* writefln("member name is '%s'", am.name);
* }
* --------------------
*/
@property @safe ArchiveMember[string] directory() { return _directory; }
private ArchiveMember[string] _directory;
debug (print)
{
@safe void print()
{
printf("\tdiskNumber = %u\n", diskNumber);
printf("\tdiskStartDir = %u\n", diskStartDir);
printf("\tnumEntries = %u\n", numEntries);
printf("\ttotalEntries = %u\n", totalEntries);
printf("\tcomment = '%.*s'\n", comment.length, comment.ptr);
}
}
/* ============ Creating a new archive =================== */
/** Constructor to use when creating a new archive.
*/
this() @safe
{
}
/** Add de to the archive.
*/
@safe void addMember(ArchiveMember de)
{
_directory[de.name] = de;
}
/** Delete de from the archive.
*/
@safe void deleteMember(ArchiveMember de)
{
_directory.remove(de.name);
}
/**
* Construct an archive out of the current members of the archive.
*
* Fills in the properties data[], diskNumber, diskStartDir, numEntries,
* totalEntries, and directory[].
* For each ArchiveMember, fills in properties crc32, compressedSize,
* compressedData[].
*
* Returns: array representing the entire archive.
*/
void[] build()
{ uint i;
uint directoryOffset;
if (comment.length > 0xFFFF)
throw new ZipException("archive comment longer than 65535");
// Compress each member; compute size
uint archiveSize = 0;
uint directorySize = 0;
foreach (ArchiveMember de; _directory)
{
if (!de._compressedData.length)
{
switch (de.compressionMethod)
{
case CompressionMethod.none:
de._compressedData = de._expandedData;
break;
case CompressionMethod.deflate:
import std.zlib : compress;
de._compressedData = cast(ubyte[])compress(cast(void[])de._expandedData);
de._compressedData = de._compressedData[2 .. de._compressedData.length - 4];
break;
default:
throw new ZipException("unsupported compression method");
}
de._compressedSize = to!uint(de._compressedData.length);
import std.zlib : crc32;
de._crc32 = crc32(0, cast(void[])de._expandedData);
}
assert(de._compressedData.length == de._compressedSize);
if (to!ulong(archiveSize) + 30 + de.name.length + de.extra.length + de.compressedSize
+ directorySize + 46 + de.name.length + de.extra.length + de.comment.length
+ 22 + comment.length + eocd64LocLength + eocd64Length > uint.max)
throw new ZipException("zip files bigger than 4 GB are unsupported");
archiveSize += 30 + de.name.length +
de.extra.length +
de.compressedSize;
directorySize += 46 + de.name.length +
de.extra.length +
de.comment.length;
}
if (!isZip64 && _directory.length > ushort.max)
_isZip64 = true;
uint dataSize = archiveSize + directorySize + 22 + cast(uint)comment.length;
if (isZip64)
dataSize += eocd64LocLength + eocd64Length;
_data = new ubyte[dataSize];
// Populate the data[]
// Store each archive member
i = 0;
foreach (ArchiveMember de; _directory)
{
de.offset = i;
_data[i .. i + 4] = cast(ubyte[])"PK\x03\x04";
putUshort(i + 4, de.extractVersion);
putUshort(i + 6, de.flags);
putUshort(i + 8, de._compressionMethod);
putUint (i + 10, cast(uint)de.time);
putUint (i + 14, de.crc32);
putUint (i + 18, de.compressedSize);
putUint (i + 22, to!uint(de.expandedSize));
putUshort(i + 26, cast(ushort)de.name.length);
putUshort(i + 28, cast(ushort)de.extra.length);
i += 30;
_data[i .. i + de.name.length] = (cast(ubyte[])de.name)[];
i += de.name.length;
_data[i .. i + de.extra.length] = (cast(ubyte[])de.extra)[];
i += de.extra.length;
_data[i .. i + de.compressedSize] = de.compressedData[];
i += de.compressedSize;
}
// Write directory
directoryOffset = i;
_numEntries = 0;
foreach (ArchiveMember de; _directory)
{
_data[i .. i + 4] = cast(ubyte[])"PK\x01\x02";
putUshort(i + 4, de._madeVersion);
putUshort(i + 6, de.extractVersion);
putUshort(i + 8, de.flags);
putUshort(i + 10, de._compressionMethod);
putUint (i + 12, cast(uint)de.time);
putUint (i + 16, de.crc32);
putUint (i + 20, de.compressedSize);
putUint (i + 24, de.expandedSize);
putUshort(i + 28, cast(ushort)de.name.length);
putUshort(i + 30, cast(ushort)de.extra.length);
putUshort(i + 32, cast(ushort)de.comment.length);
putUshort(i + 34, de.diskNumber);
putUshort(i + 36, de.internalAttributes);
putUint (i + 38, de._externalAttributes);
putUint (i + 42, de.offset);
i += 46;
_data[i .. i + de.name.length] = (cast(ubyte[])de.name)[];
i += de.name.length;
_data[i .. i + de.extra.length] = (cast(ubyte[])de.extra)[];
i += de.extra.length;
_data[i .. i + de.comment.length] = (cast(ubyte[])de.comment)[];
i += de.comment.length;
_numEntries++;
}
_totalEntries = numEntries;
if (isZip64)
{
// Write zip64 end of central directory record
uint eocd64Offset = i;
_data[i .. i + 4] = cast(ubyte[])"PK\x06\x06";
putUlong (i + 4, eocd64Length - 12);
putUshort(i + 12, zip64ExtractVersion);
putUshort(i + 14, zip64ExtractVersion);
putUint (i + 16, diskNumber);
putUint (i + 20, diskStartDir);
putUlong (i + 24, numEntries);
putUlong (i + 32, totalEntries);
putUlong (i + 40, directorySize);
putUlong (i + 48, directoryOffset);
i += eocd64Length;
// Write zip64 end of central directory record locator
_data[i .. i + 4] = cast(ubyte[])"PK\x06\x07";
putUint (i + 4, diskNumber);
putUlong (i + 8, eocd64Offset);
putUint (i + 16, 1);
i += eocd64LocLength;
}
// Write end record
endrecOffset = i;
_data[i .. i + 4] = cast(ubyte[])"PK\x05\x06";
putUshort(i + 4, cast(ushort)diskNumber);
putUshort(i + 6, cast(ushort)diskStartDir);
putUshort(i + 8, (numEntries > ushort.max ? ushort.max : cast(ushort)numEntries));
putUshort(i + 10, (totalEntries > ushort.max ? ushort.max : cast(ushort)totalEntries));
putUint (i + 12, directorySize);
putUint (i + 16, directoryOffset);
putUshort(i + 20, cast(ushort)comment.length);
i += 22;
// Write archive comment
assert(i + comment.length == data.length);
_data[i .. data.length] = (cast(ubyte[])comment)[];
return cast(void[])data;
}
/* ============ Reading an existing archive =================== */
/**
* Constructor to use when reading an existing archive.
*
* Fills in the properties data[], diskNumber, diskStartDir, numEntries,
* totalEntries, comment[], and directory[].
* For each ArchiveMember, fills in
* properties madeVersion, extractVersion, flags, compressionMethod, time,
* crc32, compressedSize, expandedSize, compressedData[], diskNumber,
* internalAttributes, externalAttributes, name[], extra[], comment[].
* Use expand() to get the expanded data for each ArchiveMember.
*
* Params:
* buffer = the entire contents of the archive.
*/
this(void[] buffer)
{ uint iend;
uint i;
int endcommentlength;
uint directorySize;
uint directoryOffset;
this._data = cast(ubyte[]) buffer;
if (data.length > uint.max - 2)
throw new ZipException("zip files bigger than 4 GB are unsupported");
// Find 'end record index' by searching backwards for signature
iend = (data.length > 66000 ? to!uint(data.length - 66000) : 0);
for (i = to!uint(data.length) - 22; 1; i--)
{
if (i < iend || i >= data.length)
throw new ZipException("no end record");
if (_data[i .. i + 4] == cast(ubyte[])"PK\x05\x06")
{
endcommentlength = getUshort(i + 20);
if (i + 22 + endcommentlength > data.length
|| i + 22 + endcommentlength < i)
continue;
comment = cast(string)(_data[i + 22 .. i + 22 + endcommentlength]);
endrecOffset = i;
uint k = i - eocd64LocLength;
if (k < i && _data[k .. k + 4] == cast(ubyte[])"PK\x06\x07")
{
_isZip64 = true;
i = k;
}
break;
}
}
if (isZip64)
{
// Read Zip64 record data
uint eocd64LocStart = i;
ulong eocdOffset = getUlong(i + 8);
if (eocdOffset + eocd64Length > _data.length)
throw new ZipException("corrupted directory");
i = to!uint(eocdOffset);
if (_data[i .. i + 4] != cast(ubyte[])"PK\x06\x06")
throw new ZipException("invalid Zip EOCD64 signature");
ulong eocd64Size = getUlong(i + 4);
if (eocd64Size + i - 12 > data.length)
throw new ZipException("invalid Zip EOCD64 size");
_diskNumber = getUint(i + 16);
_diskStartDir = getUint(i + 20);
ulong numEntriesUlong = getUlong(i + 24);
ulong totalEntriesUlong = getUlong(i + 32);
ulong directorySizeUlong = getUlong(i + 40);
ulong directoryOffsetUlong = getUlong(i + 48);
if (numEntriesUlong > uint.max)
throw new ZipException("supposedly more than 4294967296 files in archive");
if (numEntriesUlong != totalEntriesUlong)
throw new ZipException("multiple disk zips not supported");
if (directorySizeUlong > i || directoryOffsetUlong > i
|| directorySizeUlong + directoryOffsetUlong > i)
throw new ZipException("corrupted directory");
_numEntries = to!uint(numEntriesUlong);
_totalEntries = to!uint(totalEntriesUlong);
directorySize = to!uint(directorySizeUlong);
directoryOffset = to!uint(directoryOffsetUlong);
}
else
{
// Read end record data
_diskNumber = getUshort(i + 4);
_diskStartDir = getUshort(i + 6);
_numEntries = getUshort(i + 8);
_totalEntries = getUshort(i + 10);
if (numEntries != totalEntries)
throw new ZipException("multiple disk zips not supported");
directorySize = getUint(i + 12);
directoryOffset = getUint(i + 16);
if (directoryOffset + directorySize > i)
throw new ZipException("corrupted directory");
}
i = directoryOffset;
for (int n = 0; n < numEntries; n++)
{
/* The format of an entry is:
* 'PK' 1, 2
* directory info
* path
* extra data
* comment
*/
uint offset;
uint namelen;
uint extralen;
uint commentlen;
if (_data[i .. i + 4] != cast(ubyte[])"PK\x01\x02")
throw new ZipException("invalid directory entry 1");
ArchiveMember de = new ArchiveMember();
de._madeVersion = getUshort(i + 4);
de._extractVersion = getUshort(i + 6);
de.flags = getUshort(i + 8);
de._compressionMethod = cast(CompressionMethod)getUshort(i + 10);
de.time = cast(DosFileTime)getUint(i + 12);
de._crc32 = getUint(i + 16);
de._compressedSize = getUint(i + 20);
de._expandedSize = getUint(i + 24);
namelen = getUshort(i + 28);
extralen = getUshort(i + 30);
commentlen = getUshort(i + 32);
de._diskNumber = getUshort(i + 34);
de.internalAttributes = getUshort(i + 36);
de._externalAttributes = getUint(i + 38);
de.offset = getUint(i + 42);
i += 46;
if (i + namelen + extralen + commentlen > directoryOffset + directorySize)
throw new ZipException("invalid directory entry 2");
de.name = cast(string)(_data[i .. i + namelen]);
i += namelen;
de.extra = _data[i .. i + extralen];
i += extralen;
de.comment = cast(string)(_data[i .. i + commentlen]);
i += commentlen;
immutable uint dataOffset = de.offset + 30 + namelen + extralen;
if (dataOffset + de.compressedSize > endrecOffset)
throw new ZipException("Invalid directory entry offset or size.");
de._compressedData = _data[dataOffset .. dataOffset + de.compressedSize];
_directory[de.name] = de;
}
if (i != directoryOffset + directorySize)
throw new ZipException("invalid directory entry 3");
}
/*****
* Decompress the contents of archive member de and return the expanded
* data.
*
* Fills in properties extractVersion, flags, compressionMethod, time,
* crc32, compressedSize, expandedSize, expandedData[], name[], extra[].
*/
ubyte[] expand(ArchiveMember de)
{ uint namelen;
uint extralen;
if (_data[de.offset .. de.offset + 4] != cast(ubyte[])"PK\x03\x04")
throw new ZipException("invalid directory entry 4");
// These values should match what is in the main zip archive directory
de._extractVersion = getUshort(de.offset + 4);
de.flags = getUshort(de.offset + 6);
de._compressionMethod = cast(CompressionMethod)getUshort(de.offset + 8);
de.time = cast(DosFileTime)getUint(de.offset + 10);
de._crc32 = getUint(de.offset + 14);
de._compressedSize = max(getUint(de.offset + 18), de.compressedSize);
de._expandedSize = max(getUint(de.offset + 22), de.expandedSize);
namelen = getUshort(de.offset + 26);
extralen = getUshort(de.offset + 28);
debug(print)
{
printf("\t\texpandedSize = %d\n", de.expandedSize);
printf("\t\tcompressedSize = %d\n", de.compressedSize);
printf("\t\tnamelen = %d\n", namelen);
printf("\t\textralen = %d\n", extralen);
}
if (de.flags & 1)
throw new ZipException("encryption not supported");
int i;
i = de.offset + 30 + namelen + extralen;
if (i + de.compressedSize > endrecOffset)
throw new ZipException("invalid directory entry 5");
de._compressedData = _data[i .. i + de.compressedSize];
debug(print) arrayPrint(de.compressedData);
switch (de.compressionMethod)
{
case CompressionMethod.none:
de._expandedData = de.compressedData;
return de.expandedData;
case CompressionMethod.deflate:
// -15 is a magic value used to decompress zip files.
// It has the effect of not requiring the 2 byte header
// and 4 byte trailer.
import std.zlib : uncompress;
de._expandedData = cast(ubyte[])uncompress(cast(void[])de.compressedData, de.expandedSize, -15);
return de.expandedData;
default:
throw new ZipException("unsupported compression method");
}
}
/* ============ Utility =================== */
@safe ushort getUshort(int i)
{
ubyte[2] result = data[i .. i + 2];
return littleEndianToNative!ushort(result);
}
@safe uint getUint(int i)
{
ubyte[4] result = data[i .. i + 4];
return littleEndianToNative!uint(result);
}
@safe ulong getUlong(int i)
{
ubyte[8] result = data[i .. i + 8];
return littleEndianToNative!ulong(result);
}
@safe void putUshort(int i, ushort us)
{
data[i .. i + 2] = nativeToLittleEndian(us);
}
@safe void putUint(int i, uint ui)
{
data[i .. i + 4] = nativeToLittleEndian(ui);
}
@safe void putUlong(int i, ulong ul)
{
data[i .. i + 8] = nativeToLittleEndian(ul);
}
}
debug(print)
{
@safe void arrayPrint(ubyte[] array)
{
printf("array %p,%d\n", cast(void*)array, array.length);
for (int i = 0; i < array.length; i++)
{
printf("%02x ", array[i]);
if (((i + 1) & 15) == 0)
printf("\n");
}
printf("\n");
}
}
@system unittest
{
// @system due to (at least) ZipArchive.build
auto zip1 = new ZipArchive();
auto zip2 = new ZipArchive();
auto am1 = new ArchiveMember();
am1.name = "foo";
am1.expandedData = new ubyte[](1024);
zip1.addMember(am1);
auto data1 = zip1.build();
zip2.addMember(zip1.directory["foo"]);
zip2.build();
auto am2 = zip2.directory["foo"];
zip2.expand(am2);
assert(am1.expandedData == am2.expandedData);
auto zip3 = new ZipArchive(data1);
zip3.build();
assert(zip3.directory["foo"].compressedSize == am1.compressedSize);
// Test if packing and unpacking produces the original data
import std.random : uniform, MinstdRand0;
import std.stdio, std.conv;
MinstdRand0 gen;
const uint itemCount = 20, minSize = 10, maxSize = 500;
foreach (variant; 0..2)
{
bool useZip64 = !!variant;
zip1 = new ZipArchive();
zip1.isZip64 = useZip64;
ArchiveMember[itemCount] ams;
foreach (i; 0..itemCount)
{
ams[i] = new ArchiveMember();
ams[i].name = to!string(i);
ams[i].expandedData = new ubyte[](uniform(minSize, maxSize));
foreach (ref ubyte c; ams[i].expandedData)
c = cast(ubyte)(uniform(0, 256));
ams[i].compressionMethod = CompressionMethod.deflate;
zip1.addMember(ams[i]);
}
auto zippedData = zip1.build();
zip2 = new ZipArchive(zippedData);
assert(zip2.isZip64 == useZip64);
foreach (am; ams)
{
am2 = zip2.directory[am.name];
zip2.expand(am2);
assert(am.crc32 == am2.crc32);
assert(am.expandedData == am2.expandedData);
}
}
}
@system unittest
{
import std.zlib;
ubyte[] src = cast(ubyte[])
"the quick brown fox jumps over the lazy dog\r
the quick brown fox jumps over the lazy dog\r
";
auto dst = cast(ubyte[])compress(cast(void[])src);
auto after = cast(ubyte[])uncompress(cast(void[])dst);
assert(src == after);
}
@system unittest
{
// @system due to ZipArchive.build
import std.datetime;
ubyte[] buf = [1, 2, 3, 4, 5, 0, 7, 8, 9];
auto ar = new ZipArchive;
auto am = new ArchiveMember; // 10
am.name = "buf";
am.expandedData = buf;
am.compressionMethod = CompressionMethod.deflate;
am.time = SysTimeToDosFileTime(Clock.currTime());
ar.addMember(am); // 15
auto zip1 = ar.build();
auto arAfter = new ZipArchive(zip1);
assert(arAfter.directory.length == 1);
auto amAfter = arAfter.directory["buf"];
arAfter.expand(amAfter);
assert(amAfter.name == am.name);
assert(amAfter.expandedData == am.expandedData);
assert(amAfter.time == am.time);
}
// Non-Android Posix-only, because we can't rely on the unzip command being
// available on Android or Windows
version(Android) {} else
version(Posix) @system unittest
{
import std.datetime, std.file, std.format, std.path, std.process, std.stdio;
auto zr = new ZipArchive();
auto am = new ArchiveMember();
am.compressionMethod = CompressionMethod.deflate;
am.name = "foo.bar";
am.time = SysTimeToDosFileTime(Clock.currTime());
am.expandedData = cast(ubyte[])"We all live in a yellow submarine, a yellow submarine";
zr.addMember(am);
auto data2 = zr.build();
mkdirRecurse(deleteme);
scope(exit) rmdirRecurse(deleteme);
string zipFile = buildPath(deleteme, "foo.zip");
std.file.write(zipFile, cast(byte[])data2);
auto result = executeShell(format("unzip -l %s", zipFile));
scope(failure) writeln(result.output);
assert(result.status == 0);
}
| D |
/home/oliver/Projects/FPGA_Projects/CPU/toolchain/rust_assembler/target/debug/build/num-traits-185c2b1790646f97/build_script_build-185c2b1790646f97: /home/oliver/.cargo/registry/src/github.com-1ecc6299db9ec823/num-traits-0.2.14/build.rs
/home/oliver/Projects/FPGA_Projects/CPU/toolchain/rust_assembler/target/debug/build/num-traits-185c2b1790646f97/build_script_build-185c2b1790646f97.d: /home/oliver/.cargo/registry/src/github.com-1ecc6299db9ec823/num-traits-0.2.14/build.rs
/home/oliver/.cargo/registry/src/github.com-1ecc6299db9ec823/num-traits-0.2.14/build.rs:
| D |
/Users/oslo/code/swift_vapor_server/.build/debug/Console.build/Console/Style/Console+ConsoleStyle.swift.o : /Users/oslo/code/swift_vapor_server/Packages/Console-1.0.2/Sources/Console/Bar/Bar.swift /Users/oslo/code/swift_vapor_server/Packages/Console-1.0.2/Sources/Console/Command/Argument.swift /Users/oslo/code/swift_vapor_server/Packages/Console-1.0.2/Sources/Console/Command/Command+Print.swift /Users/oslo/code/swift_vapor_server/Packages/Console-1.0.2/Sources/Console/Command/Command.swift /Users/oslo/code/swift_vapor_server/Packages/Console-1.0.2/Sources/Console/Command/Group.swift /Users/oslo/code/swift_vapor_server/Packages/Console-1.0.2/Sources/Console/Command/Option.swift /Users/oslo/code/swift_vapor_server/Packages/Console-1.0.2/Sources/Console/Command/Runnable.swift /Users/oslo/code/swift_vapor_server/Packages/Console-1.0.2/Sources/Console/Command/Value.swift /Users/oslo/code/swift_vapor_server/Packages/Console-1.0.2/Sources/Console/Console/Console+Ask.swift /Users/oslo/code/swift_vapor_server/Packages/Console-1.0.2/Sources/Console/Console/Console+Center.swift /Users/oslo/code/swift_vapor_server/Packages/Console-1.0.2/Sources/Console/Console/Console+Confirm.swift /Users/oslo/code/swift_vapor_server/Packages/Console-1.0.2/Sources/Console/Console/Console+Options.swift /Users/oslo/code/swift_vapor_server/Packages/Console-1.0.2/Sources/Console/Console/Console+Print.swift /Users/oslo/code/swift_vapor_server/Packages/Console-1.0.2/Sources/Console/Console/Console+Run.swift /Users/oslo/code/swift_vapor_server/Packages/Console-1.0.2/Sources/Console/Console/Console.swift /Users/oslo/code/swift_vapor_server/Packages/Console-1.0.2/Sources/Console/Console/ConsoleError.swift /Users/oslo/code/swift_vapor_server/Packages/Console-1.0.2/Sources/Console/Stream/FileHandle+Stream.swift /Users/oslo/code/swift_vapor_server/Packages/Console-1.0.2/Sources/Console/Stream/Pipe+Stream.swift /Users/oslo/code/swift_vapor_server/Packages/Console-1.0.2/Sources/Console/Stream/Stream.swift /Users/oslo/code/swift_vapor_server/Packages/Console-1.0.2/Sources/Console/Terminal/ConsoleColor+Terminal.swift /Users/oslo/code/swift_vapor_server/Packages/Console-1.0.2/Sources/Console/Terminal/ConsoleStyle+Terminal.swift /Users/oslo/code/swift_vapor_server/Packages/Console-1.0.2/Sources/Console/Terminal/String+ANSI.swift /Users/oslo/code/swift_vapor_server/Packages/Console-1.0.2/Sources/Console/Terminal/Terminal+Command.swift /Users/oslo/code/swift_vapor_server/Packages/Console-1.0.2/Sources/Console/Terminal/Terminal.swift /Users/oslo/code/swift_vapor_server/Packages/Console-1.0.2/Sources/Console/Utilities/Bool+Polymorphic.swift /Users/oslo/code/swift_vapor_server/Packages/Console-1.0.2/Sources/Console/Utilities/String+Trim.swift /Users/oslo/code/swift_vapor_server/Packages/Console-1.0.2/Sources/Console/Bar/Loading/Console+LoadingBar.swift /Users/oslo/code/swift_vapor_server/Packages/Console-1.0.2/Sources/Console/Bar/Loading/LoadingBar.swift /Users/oslo/code/swift_vapor_server/Packages/Console-1.0.2/Sources/Console/Bar/Progress/Console+ProgressBar.swift /Users/oslo/code/swift_vapor_server/Packages/Console-1.0.2/Sources/Console/Bar/Progress/ProgressBar.swift /Users/oslo/code/swift_vapor_server/Packages/Console-1.0.2/Sources/Console/Console/Clear/ConsoleClear.swift /Users/oslo/code/swift_vapor_server/Packages/Console-1.0.2/Sources/Console/Console/Color/ConsoleColor.swift /Users/oslo/code/swift_vapor_server/Packages/Console-1.0.2/Sources/Console/Console/Style/Console+ConsoleStyle.swift /Users/oslo/code/swift_vapor_server/Packages/Console-1.0.2/Sources/Console/Console/Style/ConsoleStyle.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 /Users/oslo/code/swift_vapor_server/.build/debug/libc.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Darwin.swiftmodule /Users/oslo/code/swift_vapor_server/.build/debug/Polymorphic.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/Dispatch.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/ObjectiveC.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/CoreGraphics.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/IOKit.swiftmodule /Users/oslo/code/swift_vapor_server/.build/debug/Core.swiftmodule
/Users/oslo/code/swift_vapor_server/.build/debug/Console.build/Console+ConsoleStyle~partial.swiftmodule : /Users/oslo/code/swift_vapor_server/Packages/Console-1.0.2/Sources/Console/Bar/Bar.swift /Users/oslo/code/swift_vapor_server/Packages/Console-1.0.2/Sources/Console/Command/Argument.swift /Users/oslo/code/swift_vapor_server/Packages/Console-1.0.2/Sources/Console/Command/Command+Print.swift /Users/oslo/code/swift_vapor_server/Packages/Console-1.0.2/Sources/Console/Command/Command.swift /Users/oslo/code/swift_vapor_server/Packages/Console-1.0.2/Sources/Console/Command/Group.swift /Users/oslo/code/swift_vapor_server/Packages/Console-1.0.2/Sources/Console/Command/Option.swift /Users/oslo/code/swift_vapor_server/Packages/Console-1.0.2/Sources/Console/Command/Runnable.swift /Users/oslo/code/swift_vapor_server/Packages/Console-1.0.2/Sources/Console/Command/Value.swift /Users/oslo/code/swift_vapor_server/Packages/Console-1.0.2/Sources/Console/Console/Console+Ask.swift /Users/oslo/code/swift_vapor_server/Packages/Console-1.0.2/Sources/Console/Console/Console+Center.swift /Users/oslo/code/swift_vapor_server/Packages/Console-1.0.2/Sources/Console/Console/Console+Confirm.swift /Users/oslo/code/swift_vapor_server/Packages/Console-1.0.2/Sources/Console/Console/Console+Options.swift /Users/oslo/code/swift_vapor_server/Packages/Console-1.0.2/Sources/Console/Console/Console+Print.swift /Users/oslo/code/swift_vapor_server/Packages/Console-1.0.2/Sources/Console/Console/Console+Run.swift /Users/oslo/code/swift_vapor_server/Packages/Console-1.0.2/Sources/Console/Console/Console.swift /Users/oslo/code/swift_vapor_server/Packages/Console-1.0.2/Sources/Console/Console/ConsoleError.swift /Users/oslo/code/swift_vapor_server/Packages/Console-1.0.2/Sources/Console/Stream/FileHandle+Stream.swift /Users/oslo/code/swift_vapor_server/Packages/Console-1.0.2/Sources/Console/Stream/Pipe+Stream.swift /Users/oslo/code/swift_vapor_server/Packages/Console-1.0.2/Sources/Console/Stream/Stream.swift /Users/oslo/code/swift_vapor_server/Packages/Console-1.0.2/Sources/Console/Terminal/ConsoleColor+Terminal.swift /Users/oslo/code/swift_vapor_server/Packages/Console-1.0.2/Sources/Console/Terminal/ConsoleStyle+Terminal.swift /Users/oslo/code/swift_vapor_server/Packages/Console-1.0.2/Sources/Console/Terminal/String+ANSI.swift /Users/oslo/code/swift_vapor_server/Packages/Console-1.0.2/Sources/Console/Terminal/Terminal+Command.swift /Users/oslo/code/swift_vapor_server/Packages/Console-1.0.2/Sources/Console/Terminal/Terminal.swift /Users/oslo/code/swift_vapor_server/Packages/Console-1.0.2/Sources/Console/Utilities/Bool+Polymorphic.swift /Users/oslo/code/swift_vapor_server/Packages/Console-1.0.2/Sources/Console/Utilities/String+Trim.swift /Users/oslo/code/swift_vapor_server/Packages/Console-1.0.2/Sources/Console/Bar/Loading/Console+LoadingBar.swift /Users/oslo/code/swift_vapor_server/Packages/Console-1.0.2/Sources/Console/Bar/Loading/LoadingBar.swift /Users/oslo/code/swift_vapor_server/Packages/Console-1.0.2/Sources/Console/Bar/Progress/Console+ProgressBar.swift /Users/oslo/code/swift_vapor_server/Packages/Console-1.0.2/Sources/Console/Bar/Progress/ProgressBar.swift /Users/oslo/code/swift_vapor_server/Packages/Console-1.0.2/Sources/Console/Console/Clear/ConsoleClear.swift /Users/oslo/code/swift_vapor_server/Packages/Console-1.0.2/Sources/Console/Console/Color/ConsoleColor.swift /Users/oslo/code/swift_vapor_server/Packages/Console-1.0.2/Sources/Console/Console/Style/Console+ConsoleStyle.swift /Users/oslo/code/swift_vapor_server/Packages/Console-1.0.2/Sources/Console/Console/Style/ConsoleStyle.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 /Users/oslo/code/swift_vapor_server/.build/debug/libc.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Darwin.swiftmodule /Users/oslo/code/swift_vapor_server/.build/debug/Polymorphic.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/Dispatch.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/ObjectiveC.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/CoreGraphics.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/IOKit.swiftmodule /Users/oslo/code/swift_vapor_server/.build/debug/Core.swiftmodule
/Users/oslo/code/swift_vapor_server/.build/debug/Console.build/Console+ConsoleStyle~partial.swiftdoc : /Users/oslo/code/swift_vapor_server/Packages/Console-1.0.2/Sources/Console/Bar/Bar.swift /Users/oslo/code/swift_vapor_server/Packages/Console-1.0.2/Sources/Console/Command/Argument.swift /Users/oslo/code/swift_vapor_server/Packages/Console-1.0.2/Sources/Console/Command/Command+Print.swift /Users/oslo/code/swift_vapor_server/Packages/Console-1.0.2/Sources/Console/Command/Command.swift /Users/oslo/code/swift_vapor_server/Packages/Console-1.0.2/Sources/Console/Command/Group.swift /Users/oslo/code/swift_vapor_server/Packages/Console-1.0.2/Sources/Console/Command/Option.swift /Users/oslo/code/swift_vapor_server/Packages/Console-1.0.2/Sources/Console/Command/Runnable.swift /Users/oslo/code/swift_vapor_server/Packages/Console-1.0.2/Sources/Console/Command/Value.swift /Users/oslo/code/swift_vapor_server/Packages/Console-1.0.2/Sources/Console/Console/Console+Ask.swift /Users/oslo/code/swift_vapor_server/Packages/Console-1.0.2/Sources/Console/Console/Console+Center.swift /Users/oslo/code/swift_vapor_server/Packages/Console-1.0.2/Sources/Console/Console/Console+Confirm.swift /Users/oslo/code/swift_vapor_server/Packages/Console-1.0.2/Sources/Console/Console/Console+Options.swift /Users/oslo/code/swift_vapor_server/Packages/Console-1.0.2/Sources/Console/Console/Console+Print.swift /Users/oslo/code/swift_vapor_server/Packages/Console-1.0.2/Sources/Console/Console/Console+Run.swift /Users/oslo/code/swift_vapor_server/Packages/Console-1.0.2/Sources/Console/Console/Console.swift /Users/oslo/code/swift_vapor_server/Packages/Console-1.0.2/Sources/Console/Console/ConsoleError.swift /Users/oslo/code/swift_vapor_server/Packages/Console-1.0.2/Sources/Console/Stream/FileHandle+Stream.swift /Users/oslo/code/swift_vapor_server/Packages/Console-1.0.2/Sources/Console/Stream/Pipe+Stream.swift /Users/oslo/code/swift_vapor_server/Packages/Console-1.0.2/Sources/Console/Stream/Stream.swift /Users/oslo/code/swift_vapor_server/Packages/Console-1.0.2/Sources/Console/Terminal/ConsoleColor+Terminal.swift /Users/oslo/code/swift_vapor_server/Packages/Console-1.0.2/Sources/Console/Terminal/ConsoleStyle+Terminal.swift /Users/oslo/code/swift_vapor_server/Packages/Console-1.0.2/Sources/Console/Terminal/String+ANSI.swift /Users/oslo/code/swift_vapor_server/Packages/Console-1.0.2/Sources/Console/Terminal/Terminal+Command.swift /Users/oslo/code/swift_vapor_server/Packages/Console-1.0.2/Sources/Console/Terminal/Terminal.swift /Users/oslo/code/swift_vapor_server/Packages/Console-1.0.2/Sources/Console/Utilities/Bool+Polymorphic.swift /Users/oslo/code/swift_vapor_server/Packages/Console-1.0.2/Sources/Console/Utilities/String+Trim.swift /Users/oslo/code/swift_vapor_server/Packages/Console-1.0.2/Sources/Console/Bar/Loading/Console+LoadingBar.swift /Users/oslo/code/swift_vapor_server/Packages/Console-1.0.2/Sources/Console/Bar/Loading/LoadingBar.swift /Users/oslo/code/swift_vapor_server/Packages/Console-1.0.2/Sources/Console/Bar/Progress/Console+ProgressBar.swift /Users/oslo/code/swift_vapor_server/Packages/Console-1.0.2/Sources/Console/Bar/Progress/ProgressBar.swift /Users/oslo/code/swift_vapor_server/Packages/Console-1.0.2/Sources/Console/Console/Clear/ConsoleClear.swift /Users/oslo/code/swift_vapor_server/Packages/Console-1.0.2/Sources/Console/Console/Color/ConsoleColor.swift /Users/oslo/code/swift_vapor_server/Packages/Console-1.0.2/Sources/Console/Console/Style/Console+ConsoleStyle.swift /Users/oslo/code/swift_vapor_server/Packages/Console-1.0.2/Sources/Console/Console/Style/ConsoleStyle.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 /Users/oslo/code/swift_vapor_server/.build/debug/libc.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Darwin.swiftmodule /Users/oslo/code/swift_vapor_server/.build/debug/Polymorphic.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/Dispatch.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/ObjectiveC.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/CoreGraphics.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/IOKit.swiftmodule /Users/oslo/code/swift_vapor_server/.build/debug/Core.swiftmodule
| D |
module thBase.socket;
import thBase.string;
import thBase.casts;
import core.allocator;
import core.refcounted;
/**
* Patched socket source file. Makes accept() not throw an execption for non
* blocking sockets. Also provides POSIX error codes that work with WinSocks.
*
* Error codes taken from:
* - http://msdn.microsoft.com/en-us/library/ms740668(v=vs.85).aspx
* - http://pubs.opengroup.org/onlinepubs/009695399/functions/recv.html
*/
version(Windows)
enum { EINTR = 10004, EWOULDBLOCK = 10035, ECONNRESET = 10054 }
else
enum { EINTR = 4, EWOULDBLOCK = 11, ECONNRESET = 104 }
// Written in the D programming language
/*
Copyright (C) 2004-2005 Christopher E. Miller
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not
be misrepresented as being the original software.
3. This notice may not be removed or altered from any source
distribution.
socket.d 1.3
Jan 2005
Thanks to Benjamin Herr for his assistance.
*/
/**
* Notes: For Win32 systems, link with ws2_32.lib.
* Example: See /dmd/samples/d/listener.d.
* Authors: Christopher E. Miller
* Source: $(PHOBOSSRC std/_socket.d)
* Macros:
* WIKI=Phobos/StdSocket
*/
import core.stdc.stdint, std.c.string, std.c.stdlib,
std.traits;
import thBase.format;
version(unittest)
{
private import core.stdc.stdio : printf;
}
version(Posix)
{
version = BsdSockets;
}
version(Windows)
{
pragma (lib, "ws2_32.lib");
pragma (lib, "wsock32.lib");
private import std.c.windows.windows, std.c.windows.winsock;
private alias std.c.windows.winsock.timeval _ctimeval;
enum socket_t : SOCKET { INVALID_SOCKET = -1 };
private const int _SOCKET_ERROR = SOCKET_ERROR;
private int _lasterr()
{
return WSAGetLastError();
}
}
else version(BsdSockets)
{
version(Posix)
{
version(linux)
import std.c.linux.socket : AF_IPX, AF_APPLETALK, SOCK_RDM,
IPPROTO_IGMP, IPPROTO_GGP, IPPROTO_PUP, IPPROTO_IDP,
protoent, servent, hostent, SD_RECEIVE, SD_SEND, SD_BOTH,
MSG_NOSIGNAL, INADDR_NONE, getprotobyname, getprotobynumber,
getservbyname, getservbyport, gethostbyname, gethostbyaddr;
else version(OSX)
private import std.c.osx.socket;
else version(FreeBSD)
{
import core.sys.posix.sys.socket;
import core.sys.posix.sys.select;
import std.c.freebsd.socket;
private enum SD_RECEIVE = SHUT_RD;
private enum SD_SEND = SHUT_WR;
private enum SD_BOTH = SHUT_RDWR;
}
else
static assert(false);
private import core.sys.posix.fcntl;
private import core.sys.posix.unistd;
private import core.sys.posix.arpa.inet;
private import core.sys.posix.netinet.tcp;
private import core.sys.posix.netinet.in_;
private import core.sys.posix.sys.time;
//private import core.sys.posix.sys.select;
private import core.sys.posix.sys.socket;
private alias core.sys.posix.sys.time.timeval _ctimeval;
}
private import core.stdc.errno;
enum socket_t : int32_t { init = -1, INVALID_SOCKET = -1 }
private const int _SOCKET_ERROR = -1;
private int _lasterr()
{
return errno;
}
}
else
{
static assert(0); // No socket support yet.
}
/// Base exception thrown from a Socket.
class SocketException: Exception
{
int errorCode; /// Platform-specific error code.
this(string msg, int err = 0)
{
errorCode = err;
version(Posix)
{
if(errorCode > 0)
{
char[80] buf;
const(char)* cs;
version (linux)
{
cs = strerror_r(errorCode, buf.ptr, buf.length);
}
else version (OSX)
{
auto errs = strerror_r(errorCode, buf.ptr, buf.length);
if (errs == 0)
cs = buf.ptr;
else
{
cs = "Unknown error";
}
}
else version (FreeBSD)
{
auto errs = strerror_r(errorCode, buf.ptr, buf.length);
if (errs == 0)
cs = buf.ptr;
else
{
cs = "Unknown error";
}
}
else
{
static assert(0);
}
auto len = strlen(cs);
if(cs[len - 1] == '\n')
len--;
if(cs[len - 1] == '\r')
len--;
msg = cast(string) (msg ~ ": " ~ cs[0 .. len]);
}
}
super(msg);
}
}
shared static this()
{
version(Win32)
{
WSADATA wd;
// Winsock will still load if an older version is present.
// The version is just a request.
int val;
val = WSAStartup(0x2020, &wd);
if(val) // Request Winsock 2.2 for IPv6.
throw New!SocketException("Unable to initialize socket library", val);
}
}
shared static ~this()
{
try {
version(Win32)
{
WSACleanup();
}
} catch(Throwable e){ asm { int 3; } }
}
/**
* The communication domain used to resolve an address.
*/
enum AddressFamily: int
{
UNSPEC = AF_UNSPEC, ///
UNIX = AF_UNIX, /// local communication
INET = AF_INET, /// internet protocol version 4
IPX = AF_IPX, /// novell IPX
APPLETALK = AF_APPLETALK, /// appletalk
INET6 = AF_INET6, // internet protocol version 6
}
/**
* Communication semantics
*/
enum SocketType: int
{
STREAM = SOCK_STREAM, /// sequenced, reliable, two-way communication-based byte streams
DGRAM = SOCK_DGRAM, /// connectionless, unreliable datagrams with a fixed maximum length; data may be lost or arrive out of order
RAW = SOCK_RAW, /// raw protocol access
RDM = SOCK_RDM, /// reliably-delivered message datagrams
SEQPACKET = SOCK_SEQPACKET, /// sequenced, reliable, two-way connection-based datagrams with a fixed maximum length
}
/**
* Protocol
*/
enum ProtocolType: int
{
IP = IPPROTO_IP, /// internet protocol version 4
ICMP = IPPROTO_ICMP, /// internet control message protocol
IGMP = IPPROTO_IGMP, /// internet group management protocol
GGP = IPPROTO_GGP, /// gateway to gateway protocol
TCP = IPPROTO_TCP, /// transmission control protocol
PUP = IPPROTO_PUP, /// PARC universal packet protocol
UDP = IPPROTO_UDP, /// user datagram protocol
IDP = IPPROTO_IDP, /// Xerox NS protocol
IPV6 = IPPROTO_IPV6, /// internet protocol version 6
}
/**
* Protocol is a class for retrieving protocol information.
*/
class Protocol
{
ProtocolType type; /// These members are populated when one of the following functions are called without failure:
rcstring name; /// ditto
rcstring[] aliases; /// ditto
~this()
{
if(aliases.ptr !is null)
{
Delete(aliases.ptr);
aliases = null;
}
}
void populate(protoent* proto)
{
type = cast(ProtocolType)proto.p_proto;
name = fromCString(proto.p_name);
int i;
for(i = 0;; i++)
{
if(!proto.p_aliases[i])
break;
}
if(aliases.ptr != null)
{
Delete(aliases);
}
if(i)
{
aliases = NewArray!rcstring(i);
for(i = 0; i != aliases.length; i++)
{
aliases[i] = fromCString(proto.p_aliases[i]);
}
}
else
{
aliases = null;
}
}
/** Returns false on failure */
bool getProtocolByName(string name)
{
protoent* proto;
proto = getprotobyname(toCString(name));
if(!proto)
return false;
populate(proto);
return true;
}
/** Returns false on failure */
// Same as getprotobynumber().
bool getProtocolByType(ProtocolType type)
{
protoent* proto;
proto = getprotobynumber(type);
if(!proto)
return false;
populate(proto);
return true;
}
}
unittest
{
version (Windows)
{
// These fail, don't know why
//pragma(msg, " --- std.socket(" ~ __LINE__.stringof ~ ") broken test ---");
}
else
{
Protocol proto = new Protocol;
assert(proto.getProtocolByType(ProtocolType.TCP));
//printf("About protocol TCP:\n\tName: %.*s\n", proto.name);
// foreach(string s; proto.aliases)
// {
// printf("\tAlias: %.*s\n", s);
// }
assert(proto.name == "tcp");
assert(proto.aliases.length == 1 && proto.aliases[0] == "TCP");
}
}
/**
* Service is a class for retrieving service information.
*/
class Service
{
/** These members are populated when one of the following functions are called without failure: */
rcstring name;
rcstring[] aliases; /// ditto
ushort port; /// ditto
rcstring protocolName; /// ditto
~this()
{
if(aliases.ptr !is null)
{
Delete(aliases);
aliases = null;
}
}
void populate(servent* serv)
{
name = fromCString(serv.s_name);
port = ntohs(cast(ushort)serv.s_port);
protocolName = fromCString(serv.s_proto);
int i;
for(i = 0;; i++)
{
if(!serv.s_aliases[i])
break;
}
if(aliases.ptr !is null)
{
Delete(aliases);
}
if(i)
{
aliases = NewArray!rcstring(i);
for(i = 0; i != aliases.length; i++)
{
aliases[i] = fromCString(serv.s_aliases[i]);
}
}
else
{
aliases = null;
}
}
/**
* If a protocol name is omitted, any protocol will be matched.
* Returns: false on failure.
*/
bool getServiceByName(string name, string protocolName)
{
servent* serv;
serv = getservbyname(toCString(name), toCString(protocolName));
if(!serv)
return false;
populate(serv);
return true;
}
// Any protocol name will be matched.
/// ditto
bool getServiceByName(string name)
{
servent* serv;
serv = getservbyname(toCString(name), null);
if(!serv)
return false;
populate(serv);
return true;
}
/// ditto
bool getServiceByPort(ushort port, string protocolName)
{
servent* serv;
serv = getservbyport(port, toCString(protocolName));
if(!serv)
return false;
populate(serv);
return true;
}
// Any protocol name will be matched.
/// ditto
bool getServiceByPort(ushort port)
{
servent* serv;
serv = getservbyport(port, null);
if(!serv)
return false;
populate(serv);
return true;
}
}
unittest
{
Service serv = New!Service();
scope(exit) Delete(serv);
if(serv.getServiceByName("epmap", "tcp"))
{
// printf("About service epmap:\n\tService: %.*s\n"
// "\tPort: %d\n\tProtocol: %.*s\n",
// serv.name, serv.port, serv.protocolName);
// foreach(string s; serv.aliases)
// {
// printf("\tAlias: %.*s\n", s);
// }
// For reasons unknown this is loc-srv on Wine and epmap on Windows
assert(serv.name == "loc-srv" || serv.name == "epmap", serv.name[]);
assert(serv.port == 135);
assert(serv.protocolName == "tcp");
// This assert used to pass, don't know why it fails now
//assert(serv.aliases.length == 1 && serv.aliases[0] == "epmap");
}
else
{
printf("No service for epmap.\n");
}
}
/**
* Base exception thrown from an InternetHost.
*/
class HostException: Exception
{
int errorCode; /// Platform-specific error code.
this(string msg, int err = 0)
{
errorCode = err;
super(msg);
}
}
/**
* InternetHost is a class for resolving IPv4 addresses.
*/
class InternetHost
{
/** These members are populated when one of the following functions are called without failure: */
rcstring name;
rcstring[] aliases; /// ditto
uint32_t[] addrList; /// ditto
~this()
{
if(aliases.ptr !is null)
{
Delete(aliases.ptr);
aliases = null;
}
if(addrList.ptr !is null)
{
Delete(addrList);
addrList = null;
}
}
void validHostent(hostent* he)
{
if(he.h_addrtype != cast(int)AddressFamily.INET || he.h_length != 4)
throw New!HostException("Address family mismatch", _lasterr());
}
void populate(hostent* he)
{
int i;
char* p;
name = fromCString(he.h_name);
for(i = 0;; i++)
{
p = he.h_aliases[i];
if(!p)
break;
}
if(aliases.ptr !is null)
{
Delete(aliases);
}
if(i)
{
aliases = NewArray!rcstring(i);
for(i = 0; i != aliases.length; i++)
{
aliases[i] = fromCString(he.h_aliases[i]);
}
}
else
{
aliases = null;
}
for(i = 0;; i++)
{
p = he.h_addr_list[i];
if(!p)
break;
}
if(addrList.ptr !is null)
{
Delete(addrList);
}
if(i)
{
addrList = NewArray!uint32_t(i);
for(i = 0; i != addrList.length; i++)
{
addrList[i] = ntohl(*(cast(uint32_t*)he.h_addr_list[i]));
}
}
else
{
addrList = null;
}
}
/**
* Resolve host name. Returns false if unable to resolve.
*/
bool getHostByName(string name)
{
version(Windows)
{
// TODO gethostbyname is deprecated in windows, use getaddrinfo
auto he = gethostbyname(toCString(name));
if(!he)
return false;
validHostent(he);
populate(he);
}
else
{
// posix systems use global state for return value, so we
// must synchronize across all threads
synchronized(this.classinfo)
{
auto he = gethostbyname(toStringz(name));
if(!he)
return false;
validHostent(he);
populate(he);
}
}
return true;
}
/**
* Resolve IPv4 address number. Returns false if unable to resolve.
*/
bool getHostByAddr(uint addr)
{
uint x = htonl(addr);
version(Windows)
{
// TODO gethostbyaddr is deprecated in windows, use getnameinfo
auto he = gethostbyaddr(&x, 4, cast(int)AddressFamily.INET);
if(!he)
return false;
validHostent(he);
populate(he);
}
else
{
// posix systems use global state for return value, so we
// must synchronize across all threads
synchronized(this.classinfo)
{
auto he = gethostbyaddr(&x, 4, cast(int)AddressFamily.INET);
if(!he)
return false;
validHostent(he);
populate(he);
}
}
return true;
}
/**
* Same as previous, but addr is an IPv4 address string in the
* dotted-decimal form $(I a.b.c.d).
* Returns false if unable to resolve.
*/
bool getHostByAddr(string addr)
{
uint x = inet_addr(toCString(addr));
version(Windows)
{
// TODO gethostbyaddr is deprecated in windows, use getnameinfo
auto he = gethostbyaddr(&x, 4, cast(int)AddressFamily.INET);
if(!he)
return false;
validHostent(he);
populate(he);
}
else
{
// posix systems use global state for return value, so we
// must synchronize across all threads
synchronized(this.classinfo)
{
auto he = gethostbyaddr(&x, 4, cast(int)AddressFamily.INET);
if(!he)
return false;
validHostent(he);
populate(he);
}
}
return true;
}
}
/+
unittest
{
version(linux){
try
{
InternetHost ih = new InternetHost;
if (!ih.getHostByName("www.digitalmars.com"))
return; // don't fail if not connected to internet
//printf("addrList.length = %d\n", ih.addrList.length);
assert(ih.addrList.length);
InternetAddress ia = new InternetAddress(ih.addrList[0], InternetAddress.PORT_ANY);
assert(ih.name == "www.digitalmars.com" || ih.name == "digitalmars.com",
ih.name);
// printf("IP address = %.*s\nname = %.*s\n", ia.toAddrString(), ih.name);
// foreach(int i, string s; ih.aliases)
// {
// printf("aliases[%d] = %.*s\n", i, s);
// }
// printf("---\n");
assert(ih.getHostByAddr(ih.addrList[0]));
// printf("name = %.*s\n", ih.name);
// foreach(int i, string s; ih.aliases)
// {
// printf("aliases[%d] = %.*s\n", i, s);
// }
}
catch (Throwable e)
{
// Test fails or succeeds depending on environment!
printf(" --- std.socket(%u) broken test ---\n", __LINE__);
printf(" (%.*s)\n", e.toString());
}
}
}
+/
/**
* Base exception thrown from an Address.
*/
class AddressException: RCException
{
this(rcstring msg)
{
super(msg);
}
}
/**
* Address is an abstract class for representing a network addresses.
*/
abstract class Address : RefCounted
{
protected sockaddr* name();
protected int nameLen();
AddressFamily addressFamily(); /// Family of this address.
abstract to_string_t toString(); /// Human readable string representing this address.
}
/**
*
*/
class UnknownAddress: Address
{
protected:
sockaddr sa;
override sockaddr* name()
{
return &sa;
}
override int nameLen()
{
return sa.sizeof;
}
public:
override AddressFamily addressFamily()
{
return cast(AddressFamily)sa.sa_family;
}
override to_string_t toString()
{
return _T("Unknown");
}
}
/**
* InternetAddress is a class that represents an IPv4 (internet protocol version
* 4) address and port.
*/
class InternetAddress : Address
{
protected:
sockaddr_in sin;
override sockaddr* name()
{
return cast(sockaddr*)&sin;
}
override int nameLen()
{
return sin.sizeof;
}
public this()
{
}
public:
const uint ADDR_ANY = INADDR_ANY; /// Any IPv4 address number.
const uint ADDR_NONE = INADDR_NONE; /// An invalid IPv4 address number.
const ushort PORT_ANY = 0; /// Any IPv4 port number.
/// Overridden to return AddressFamily.INET.
override AddressFamily addressFamily()
{
return cast(AddressFamily)AddressFamily.INET;
}
/// Returns the IPv4 port number.
ushort port()
{
return ntohs(sin.sin_port);
}
/// Returns the IPv4 address number.
uint addr()
{
return ntohl(sin.sin_addr.s_addr);
}
/**
* Params:
* addr = an IPv4 address string in the dotted-decimal form a.b.c.d,
* or a host name that will be resolved using an InternetHost
* object.
* port = may be PORT_ANY as stated below.
*/
public this(string addr, ushort port)
{
uint uiaddr = parse(addr);
if(ADDR_NONE == uiaddr)
{
InternetHost ih = New!InternetHost();
scope(exit) Delete(ih);
if(!ih.getHostByName(addr))
//throw new AddressException("Invalid internet address");
throw New!AddressException(format("Unable to resolve host '%s'", addr));
uiaddr = ih.addrList[0];
}
sin.sin_family = AddressFamily.INET;
sin.sin_addr.s_addr = htonl(uiaddr);
sin.sin_port = htons(port);
}
/**
* Construct a new Address. addr may be ADDR_ANY (default) and port may
* be PORT_ANY, and the actual numbers may not be known until a connection
* is made.
*/
public this(uint addr, ushort port)
{
sin.sin_family = AddressFamily.INET;
sin.sin_addr.s_addr = htonl(addr);
sin.sin_port = htons(port);
}
/// ditto
public this(ushort port)
{
sin.sin_family = AddressFamily.INET;
sin.sin_addr.s_addr = 0; //any, "0.0.0.0"
sin.sin_port = htons(port);
}
/// Human readable string representing the IPv4 address and port in the form $(I a.b.c.d:e).
override to_string_t toString()
{
return format("%s:%d",inet_ntoa(sin.sin_addr),port());
}
/**
* Parse an IPv4 address string in the dotted-decimal form $(I a.b.c.d)
* and return the number.
* If the string is not a legitimate IPv4 address,
* ADDR_NONE is returned.
*/
static uint parse(string addr)
{
return ntohl(inet_addr(toCString(addr)));
}
}
unittest
{
try
{
SmartPtr!InternetAddress ia = New!InternetAddress("63.105.9.61", cast(ushort)80);
assert(ia.toString() == "63.105.9.61:80");
}
catch (Throwable e)
{
printf(" --- std.socket(%u) broken test ---\n", __LINE__);
printf(" (%.*s)\n", e.toString()[]);
}
}
/** */
class SocketAcceptException: SocketException
{
this(string msg, int err = 0)
{
super(msg, err);
}
}
/// How a socket is shutdown:
enum SocketShutdown: int
{
RECEIVE = SD_RECEIVE, /// socket receives are disallowed
SEND = SD_SEND, /// socket sends are disallowed
BOTH = SD_BOTH, /// both RECEIVE and SEND
}
/// Flags may be OR'ed together:
enum SocketFlags: int
{
NONE = 0, /// no flags specified
OOB = MSG_OOB, /// out-of-band stream data
PEEK = MSG_PEEK, /// peek at incoming data without removing it from the queue, only for receiving
DONTROUTE = MSG_DONTROUTE, /// data should not be subject to routing; this flag may be ignored. Only for sending
// NOSIGNAL = MSG_NOSIGNAL, /// don't send SIGPIPE signal on socket write error and instead return EPIPE
}
/// Duration timeout value.
extern(C) struct timeval
{
// D interface
int seconds; /// Number of seconds.
int microseconds; /// Number of additional microseconds.
// C interface
deprecated
{
alias seconds tv_sec;
alias microseconds tv_usec;
}
}
/// A collection of sockets for use with Socket.select.
class SocketSet
{
private:
uint maxsockets; /// max desired sockets, the fd_set might be capable of holding more
fd_set set;
version(Windows)
{
uint count()
{
return set.fd_count;
}
}
else version(BsdSockets)
{
int maxfd;
uint count;
}
public:
/// Set the maximum amount of sockets that may be added.
this(uint max)
{
maxsockets = max;
reset();
}
/// Uses the default maximum for the system.
this()
{
this(FD_SETSIZE);
}
/// Reset the SocketSet so that there are 0 Sockets in the collection.
void reset()
{
FD_ZERO(&set);
version(BsdSockets)
{
maxfd = -1;
count = 0;
}
}
void add(socket_t s)
in
{
// Make sure too many sockets don't get added.
assert(count < maxsockets);
}
body
{
FD_SET(s, &set);
version(BsdSockets)
{
++count;
if(s > maxfd)
maxfd = s;
}
}
/// Add a Socket to the collection. Adding more than the maximum has dangerous side affects.
void add(Socket s)
{
add(s.sock);
}
void remove(socket_t s)
{
FD_CLR(s, &set);
version(BsdSockets)
{
--count;
// note: adjusting maxfd would require scanning the set, not worth it
}
}
/// Remove this Socket from the collection.
void remove(Socket s)
{
remove(s.sock);
}
int isSet(socket_t s)
{
return FD_ISSET(s, &set);
}
/// Returns nonzero if this Socket is in the collection.
int isSet(Socket s)
{
return isSet(s.sock);
}
/// Return maximum amount of sockets that can be added, like FD_SETSIZE.
uint max()
{
return maxsockets;
}
fd_set* toFd_set()
{
return &set;
}
int selectn()
{
version(Windows)
{
return count;
}
else version(BsdSockets)
{
return maxfd + 1;
}
}
}
/// The level at which a socket option is defined:
enum SocketOptionLevel: int
{
SOCKET = SOL_SOCKET, /// socket level
IP = ProtocolType.IP, /// internet protocol version 4 level
ICMP = ProtocolType.ICMP, ///
IGMP = ProtocolType.IGMP, ///
GGP = ProtocolType.GGP, ///
TCP = ProtocolType.TCP, /// transmission control protocol level
PUP = ProtocolType.PUP, ///
UDP = ProtocolType.UDP, /// user datagram protocol level
IDP = ProtocolType.IDP, ///
IPV6 = ProtocolType.IPV6, /// internet protocol version 6 level
}
/// Linger information for use with SocketOption.LINGER.
extern(C) struct linger
{
// D interface
version(Windows)
{
uint16_t on; /// Nonzero for on.
uint16_t time; /// Linger time.
}
else version(BsdSockets)
{
int32_t on;
int32_t time;
}
// C interface
deprecated
{
alias on l_onoff;
alias time l_linger;
}
}
/// Specifies a socket option:
enum SocketOption: int
{
DEBUG = SO_DEBUG, /// record debugging information
BROADCAST = SO_BROADCAST, /// allow transmission of broadcast messages
REUSEADDR = SO_REUSEADDR, /// allow local reuse of address
LINGER = SO_LINGER, /// linger on close if unsent data is present
OOBINLINE = SO_OOBINLINE, /// receive out-of-band data in band
SNDBUF = SO_SNDBUF, /// send buffer size
RCVBUF = SO_RCVBUF, /// receive buffer size
DONTROUTE = SO_DONTROUTE, /// do not route
// SocketOptionLevel.TCP:
TCP_NODELAY = .TCP_NODELAY, /// disable the Nagle algorithm for send coalescing
// SocketOptionLevel.IPV6:
IPV6_UNICAST_HOPS = .IPV6_UNICAST_HOPS, ///
IPV6_MULTICAST_IF = .IPV6_MULTICAST_IF, ///
IPV6_MULTICAST_LOOP = .IPV6_MULTICAST_LOOP, ///
IPV6_JOIN_GROUP = .IPV6_JOIN_GROUP, ///
IPV6_LEAVE_GROUP = .IPV6_LEAVE_GROUP, ///
}
/**
* Socket is a class that creates a network communication endpoint using the
* Berkeley sockets interface.
*/
class Socket
{
private:
socket_t sock;
AddressFamily _family;
version(Windows)
bool _blocking = false; /// Property to get or set whether the socket is blocking or nonblocking.
// For use with accepting().
protected this()
{
}
public:
/**
* Create a blocking socket. If a single protocol type exists to support
* this socket type within the address family, the ProtocolType may be
* omitted.
*/
this(AddressFamily af, SocketType type, ProtocolType protocol)
{
sock = cast(socket_t)socket(af, type, protocol);
if(sock == socket_t.INVALID_SOCKET)
throw new SocketException("Unable to create socket", _lasterr());
_family = af;
}
// A single protocol exists to support this socket type within the
// protocol family, so the ProtocolType is assumed.
/// ditto
this(AddressFamily af, SocketType type)
{
this(af, type, cast(ProtocolType)0); // Pseudo protocol number.
}
/// ditto
this(AddressFamily af, SocketType type, string protocolName)
{
protoent* proto;
proto = getprotobyname(toCString(protocolName));
if(!proto)
throw New!SocketException("Unable to find the protocol", _lasterr());
this(af, type, cast(ProtocolType)proto.p_proto);
}
~this()
{
close();
}
/// Get underlying socket handle.
socket_t handle()
{
return sock;
}
/**
* I'm just sick of it... allows anyone to do proper error checking for
* nonblocking IO.
*/
static int errno(){
return _lasterr();
}
/**
* Get/set socket's blocking flag.
*
* When a socket is blocking, calls to receive(), accept(), and send()
* will block and wait for data/action.
* A non-blocking socket will immediately return instead of blocking.
*/
bool blocking()
{
version(Windows)
{
return _blocking;
}
else version(BsdSockets)
{
return !(fcntl(handle, F_GETFL, 0) & O_NONBLOCK);
}
}
/// ditto
void blocking(bool byes)
{
version(Win32)
{
uint num = !byes;
if(_SOCKET_ERROR == ioctlsocket(sock, FIONBIO, &num))
goto err;
_blocking = byes;
}
else version(BsdSockets)
{
int x = fcntl(sock, F_GETFL, 0);
if(-1 == x)
goto err;
if(byes)
x &= ~O_NONBLOCK;
else
x |= O_NONBLOCK;
if(-1 == fcntl(sock, F_SETFL, x))
goto err;
}
return; // Success.
err:
throw new SocketException("Unable to set socket blocking", _lasterr());
}
/// Get the socket's address family.
AddressFamily addressFamily() // getter
{
return _family;
}
/// Property that indicates if this is a valid, alive socket.
bool isAlive() // getter
{
int type;
socklen_t typesize = cast(socklen_t) type.sizeof;
return !getsockopt(sock, SOL_SOCKET, SO_TYPE, cast(char*)&type, &typesize);
}
/// Associate a local address with this socket.
void bind(SmartPtr!Address addr)
{
if(_SOCKET_ERROR == .bind(sock, addr.name(), addr.nameLen()))
throw New!SocketException("Unable to bind socket", _lasterr());
}
/**
* Establish a connection. If the socket is blocking, connect waits for
* the connection to be made. If the socket is nonblocking, connect
* returns immediately and the connection attempt is still in progress.
*/
void connect(Address to)
{
if(_SOCKET_ERROR == .connect(sock, to.name(), to.nameLen()))
{
int err;
err = _lasterr();
if(!blocking)
{
version(Windows)
{
if(WSAEWOULDBLOCK == err)
return;
}
else version(Posix)
{
if(EINPROGRESS == err)
return;
}
else
{
static assert(0);
}
}
throw new SocketException("Unable to connect socket", err);
}
}
/**
* Listen for an incoming connection. bind must be called before you can
* listen. The backlog is a request of how many pending incoming
* connections are queued until accept'ed.
*/
void listen(int backlog)
{
if(_SOCKET_ERROR == .listen(sock, backlog))
throw new SocketException("Unable to listen on socket", _lasterr());
}
/**
* Called by accept when a new Socket must be created for a new
* connection. To use a derived class, override this method and return an
* instance of your class. The returned Socket's handle must not be set;
* Socket has a protected constructor this() to use in this situation.
*/
// Override to use a derived class.
// The returned socket's handle must not be set.
protected Socket accepting()
{
return new Socket;
}
/**
* Accept an incoming connection. If the socket is blocking, accept
* waits for a connection request. Throws SocketAcceptException if unable
* to accept. See accepting for use with derived classes.
*/
Socket accept()
{
socket_t newsock;
//newsock = cast(socket_t).accept(sock, null, null); // DMD 0.101 error: found '(' when expecting ';' following 'statement
alias .accept topaccept;
newsock = cast(socket_t)topaccept(sock, null, null);
if(socket_t.INVALID_SOCKET == newsock){
// It's ok for nonblocking socket to fail with EWOULDBLOCK
auto errno = _lasterr();
if(!this.blocking && errno == EWOULDBLOCK)
return null;
throw New!SocketAcceptException("Unable to accept socket connection", _lasterr());
}
Socket newSocket;
try
{
newSocket = accepting();
assert(newSocket.sock == socket_t.INVALID_SOCKET);
newSocket.sock = newsock;
version(Win32)
newSocket._blocking = _blocking; //inherits blocking mode
newSocket._family = _family; //same family
}
catch(Throwable o)
{
_close(newsock);
throw o;
}
return newSocket;
}
/// Disables sends and/or receives.
void shutdown(SocketShutdown how)
{
.shutdown(sock, cast(int)how);
}
private static void _close(socket_t sock)
{
version(Win32)
{
.closesocket(sock);
}
else version(BsdSockets)
{
.close(sock);
}
}
/**
* Immediately drop any connections and release socket resources.
* Calling shutdown before close is recommended for connection-oriented
* sockets. The Socket object is no longer usable after close.
*/
//calling shutdown() before this is recommended
//for connection-oriented sockets
void close()
{
_close(sock);
sock = socket_t.INVALID_SOCKET;
}
private SmartPtr!Address newFamilyObject()
{
SmartPtr!Address result;
switch(_family)
{
case cast(AddressFamily)AddressFamily.INET:
result = New!InternetAddress();
break;
default:
result = New!UnknownAddress();
}
return result;
}
/// Returns the local machine's host name. Idea from mango.
static rcstring hostName() // getter
{
char[256] result; // Host names are limited to 255 chars.
if(_SOCKET_ERROR == .gethostname(result.ptr, result.length))
throw New!SocketException("Unable to obtain host name", _lasterr());
return fromCString(result.ptr);
}
/// Remote endpoint Address.
SmartPtr!Address remoteAddress()
{
SmartPtr!Address addr = newFamilyObject();
socklen_t nameLen = cast(socklen_t) addr.nameLen();
if(_SOCKET_ERROR == .getpeername(sock, addr.name(), &nameLen))
throw New!SocketException("Unable to obtain remote socket address", _lasterr());
assert(addr.addressFamily() == _family);
return addr;
}
/// Local endpoint Address.
SmartPtr!Address localAddress()
{
SmartPtr!Address addr = newFamilyObject();
socklen_t nameLen = cast(socklen_t) addr.nameLen();
if(_SOCKET_ERROR == .getsockname(sock, addr.name(), &nameLen))
throw New!SocketException("Unable to obtain local socket address", _lasterr());
assert(addr.addressFamily() == _family);
return addr;
}
/// Send or receive error code.
const int ERROR = _SOCKET_ERROR;
/**
* Send data on the connection. Returns the number of bytes actually
* sent, or ERROR on failure. If the socket is blocking and there is no
* buffer space left, send waits.
*/
//returns number of bytes actually sent, or -1 on error
Select!(size_t.sizeof > 4, long, int)
send(const(void)[] buf, SocketFlags flags)
{
static if(is(typeof(MSG_NOSIGNAL)))
{
flags |= MSG_NOSIGNAL;
}
auto sent = .send(sock, buf.ptr, int_cast!int(buf.length), cast(int)flags);
return sent;
}
/// ditto
Select!(size_t.sizeof > 4, long, int) send(const(void)[] buf)
{
static if(is(typeof(MSG_NOSIGNAL)))
{
return send(buf, SocketFlags.NOSIGNAL);
}
else
{
return send(buf, SocketFlags.NONE);
}
}
/**
* Send data to a specific destination Address. If the destination address is not specified, a connection must have been made and that address is used. If the socket is blocking and there is no buffer space left, sendTo waits.
*/
Select!(size_t.sizeof > 4, long, int)
sendTo(const(void)[] buf, SocketFlags flags, Address to)
{
static if(is(typeof(MSG_NOSIGNAL)))
{
flags |= SocketFlags.NOSIGNAL;
}
return .sendto(sock, buf.ptr, int_cast!int(buf.length), cast(int)flags, to.name(), to.nameLen());
}
/// ditto
Select!(size_t.sizeof > 4, long, int) sendTo(const(void)[] buf, Address to)
{
return sendTo(buf, SocketFlags.NONE, to);
}
//assumes you connect()ed
/// ditto
Select!(size_t.sizeof > 4, long, int) sendTo(const(void)[] buf, SocketFlags flags)
{
static if(is(typeof(MSG_NOSIGNAL)))
{
flags |= MSG_NOSIGNAL;
}
return .sendto(sock, buf.ptr, int_cast!int(buf.length), cast(int)flags, null, 0);
}
//assumes you connect()ed
/// ditto
Select!(size_t.sizeof > 4, long, int) sendTo(const(void)[] buf)
{
return sendTo(buf, SocketFlags.NONE);
}
/**
* Receive data on the connection. Returns the number of bytes actually
* received, 0 if the remote side has closed the connection, or ERROR on
* failure. If the socket is blocking, receive waits until there is data
* to be received.
*/
//returns number of bytes actually received, 0 on connection closure, or -1 on error
sizediff_t receive(void[] buf, SocketFlags flags)
{
return buf.length
? .recv(sock, buf.ptr, int_cast!int(buf.length), cast(int)flags)
: 0;
}
/// ditto
ptrdiff_t receive(void[] buf)
{
return receive(buf, SocketFlags.NONE);
}
/**
* Receive data and get the remote endpoint Address.
* If the socket is blocking, receiveFrom waits until there is data to
* be received.
* Returns: the number of bytes actually received,
* 0 if the remote side has closed the connection, or ERROR on failure.
*/
Select!(size_t.sizeof > 4, long, int)
receiveFrom(void[] buf, SocketFlags flags, ref SmartPtr!Address from)
{
if(!buf.length) //return 0 and don't think the connection closed
return 0;
from = newFamilyObject();
socklen_t nameLen = cast(socklen_t) from.nameLen();
auto read = .recvfrom(sock, buf.ptr, int_cast!int(buf.length), cast(int)flags, from.name(), &nameLen);
assert(from.addressFamily() == _family);
// if(!read) //connection closed
return read;
}
/// ditto
ptrdiff_t receiveFrom(void[] buf, ref SmartPtr!Address from)
{
return receiveFrom(buf, SocketFlags.NONE, from);
}
//assumes you connect()ed
/// ditto
Select!(size_t.sizeof > 4, long, int)
receiveFrom(void[] buf, SocketFlags flags)
{
if(!buf.length) //return 0 and don't think the connection closed
return 0;
auto read = .recvfrom(sock, buf.ptr, int_cast!int(buf.length), cast(int)flags, null, null);
// if(!read) //connection closed
return read;
}
//assumes you connect()ed
/// ditto
ptrdiff_t receiveFrom(void[] buf)
{
return receiveFrom(buf, SocketFlags.NONE);
}
/// Get a socket option. Returns the number of bytes written to result.
//returns the length, in bytes, of the actual result - very different from getsockopt()
int getOption(SocketOptionLevel level, SocketOption option, void[] result)
{
socklen_t len = cast(socklen_t) result.length;
if(_SOCKET_ERROR == .getsockopt(sock, cast(int)level, cast(int)option, result.ptr, &len))
throw new SocketException("Unable to get socket option", _lasterr());
return len;
}
/// Common case of getting integer and boolean options.
int getOption(SocketOptionLevel level, SocketOption option, out int32_t result)
{
return getOption(level, option, (&result)[0 .. 1]);
}
/// Get the linger option.
int getOption(SocketOptionLevel level, SocketOption option, out linger result)
{
//return getOption(cast(SocketOptionLevel)SocketOptionLevel.SOCKET, SocketOption.LINGER, (&result)[0 .. 1]);
return getOption(level, option, (&result)[0 .. 1]);
}
// Set a socket option.
void setOption(SocketOptionLevel level, SocketOption option, void[] value)
{
if(_SOCKET_ERROR == .setsockopt(sock, cast(int)level,
cast(int)option, value.ptr, cast(uint) value.length))
throw new SocketException("Unable to set socket option", _lasterr());
}
/// Common case for setting integer and boolean options.
void setOption(SocketOptionLevel level, SocketOption option, int32_t value)
{
setOption(level, option, (&value)[0 .. 1]);
}
/// Set the linger option.
void setOption(SocketOptionLevel level, SocketOption option, linger value)
{
//setOption(cast(SocketOptionLevel)SocketOptionLevel.SOCKET, SocketOption.LINGER, (&value)[0 .. 1]);
setOption(level, option, (&value)[0 .. 1]);
}
/**
* Wait for a socket to change status. A wait timeout timeval or int microseconds may be specified; if a timeout is not specified or the timeval is null, the maximum timeout is used. The timeval timeout has an unspecified value when select returns. Returns the number of sockets with status changes, 0 on timeout, or -1 on interruption. If the return value is greater than 0, the SocketSets are updated to only contain the sockets having status changes. For a connecting socket, a write status change means the connection is established and it's able to send. For a listening socket, a read status change means there is an incoming connection request and it's able to accept.
*/
//SocketSet's updated to include only those sockets which an event occured
//returns the number of events, 0 on timeout, or -1 on interruption
//for a connect()ing socket, writeability means connected
//for a listen()ing socket, readability means listening
//Winsock: possibly internally limited to 64 sockets per set
static int select(SocketSet checkRead, SocketSet checkWrite, SocketSet checkError, timeval* tv)
in
{
//make sure none of the SocketSet's are the same object
if(checkRead)
{
assert(checkRead !is checkWrite);
assert(checkRead !is checkError);
}
if(checkWrite)
{
assert(checkWrite !is checkError);
}
}
body
{
fd_set* fr, fw, fe;
int n = 0;
version(Win32)
{
// Windows has a problem with empty fd_set`s that aren't null.
fr = (checkRead && checkRead.count()) ? checkRead.toFd_set() : null;
fw = (checkWrite && checkWrite.count()) ? checkWrite.toFd_set() : null;
fe = (checkError && checkError.count()) ? checkError.toFd_set() : null;
}
else
{
if(checkRead)
{
fr = checkRead.toFd_set();
n = checkRead.selectn();
}
else
{
fr = null;
}
if(checkWrite)
{
fw = checkWrite.toFd_set();
int _n;
_n = checkWrite.selectn();
if(_n > n)
n = _n;
}
else
{
fw = null;
}
if(checkError)
{
fe = checkError.toFd_set();
int _n;
_n = checkError.selectn();
if(_n > n)
n = _n;
}
else
{
fe = null;
}
}
int result = .select(n, fr, fw, fe, cast(_ctimeval*)tv);
version(Windows)
{
if(_SOCKET_ERROR == result && WSAGetLastError() == WSAEINTR)
return -1;
}
else version(Posix)
{
if(_SOCKET_ERROR == result && errno == EINTR)
return -1;
}
else
{
static assert(0);
}
if(_SOCKET_ERROR == result)
throw new SocketException("Socket select error", _lasterr());
return result;
}
/// ditto
static int select(SocketSet checkRead, SocketSet checkWrite, SocketSet checkError, int microseconds)
{
timeval tv;
tv.seconds = microseconds / 1_000_000;
tv.microseconds = microseconds % 1_000_000;
return select(checkRead, checkWrite, checkError, &tv);
}
/// ditto
//maximum timeout
static int select(SocketSet checkRead, SocketSet checkWrite, SocketSet checkError)
{
return select(checkRead, checkWrite, checkError, null);
}
/+
bool poll(events)
{
int WSAEventSelect(socket_t s, WSAEVENT hEventObject, int lNetworkEvents); // Winsock 2 ?
int poll(pollfd* fds, int nfds, int timeout); // Unix ?
}
+/
}
/// TcpSocket is a shortcut class for a TCP Socket.
class TcpSocket: Socket
{
/// Constructs a blocking TCP Socket.
this(AddressFamily family)
{
super(family, SocketType.STREAM, ProtocolType.TCP);
}
/// Constructs a blocking TCP Socket.
this()
{
this(cast(AddressFamily)AddressFamily.INET);
}
//shortcut
/// Constructs a blocking TCP Socket and connects to an InternetAddress.
this(Address connectTo)
{
this(connectTo.addressFamily());
connect(connectTo);
}
}
/// UdpSocket is a shortcut class for a UDP Socket.
class UdpSocket: Socket
{
/// Constructs a blocking UDP Socket.
this(AddressFamily family)
{
super(family, SocketType.DGRAM, ProtocolType.UDP);
}
/// Constructs a blocking UDP Socket.
this()
{
this(cast(AddressFamily)AddressFamily.INET);
}
}
| D |
(Christian theology) a state of sanctification by God
elegance and beauty of movement or expression
a sense of propriety and consideration for others
a disposition to kindness and compassion
(Greek mythology) one of three sisters who were the givers of beauty and charm
a short prayer of thanks before a meal
(Christian theology) the free and unmerited favor or beneficence of God
make more attractive by adding ornament, colour, etc.
be beautiful to look at
| D |
module android.java.android.telephony.TelephonyManager_CellInfoCallback;
public import android.java.android.telephony.TelephonyManager_CellInfoCallback_d_interface;
import arsd.jni : ImportExportImpl;
mixin ImportExportImpl!TelephonyManager_CellInfoCallback;
import import2 = android.java.java.lang.Class;
| D |
int main() {
int a;
a = 0;
Print(a);
} | D |
/Users/kabeone/kabeone/rust/fuse/target/debug/fuse-f52af5b12f307b37: /Users/kabeone/kabeone/rust/fuse/src/check.rs /Users/kabeone/kabeone/rust/fuse/src/fs.rs /Users/kabeone/kabeone/rust/fuse/src/get_fs.rs /Users/kabeone/kabeone/rust/fuse/src/main.rs
| D |
module lib.solve;
import std.complex;
/// solve ax^2 + bx + c = 0
Complex!double[] solve2d(double a, double b, double c)
{
import std.math;
auto d = b * b - 4 * a * c;
if (d > 0) {
auto ans1 = (-b + sqrt(d)) / (2*a);
auto ans2 = (-b - sqrt(d)) / (2*a);
return [complex(ans1), complex(ans2)];
}
else if (d == 0) {
auto ans = (-b + sqrt(d)) / (2 * a);
return [complex(ans)];
}
else {
auto ans1 = complex(-b, sqrt(-d)) / (2 * a);
auto ans2 = ans1;
ans2.im = -ans2.im;
return [ans1, ans2];
}
}
| D |
/*******************************************************************************
copyright: Copyright (C) 1997--2004, Makoto Matsumoto,
Takuji Nishimura, and Eric Landry; All rights reserved
license: BSD style: $(LICENSE)
version: Jan 2008: Initial release
author: KeYeR (D interface) keyer@team0xf.com
fawzi (converted to engine)
*******************************************************************************/
module hurt.util.random.engines.twister;
/*******************************************************************************
Wrapper for the Mersenne twister.
The Mersenne twister is a pseudorandom number generator linked to
CR developed in 1997 by Makoto Matsumoto and Takuji Nishimura that
is based on a matrix linear recurrence over a finite binary field
F2. It provides for fast generation of very high quality pseudorandom
numbers, having been designed specifically to rectify many of the
flaws found in older algorithms.
Mersenne Twister has the following desirable properties:
---
1. It was designed to have a period of 2^19937 - 1 (the creators
of the algorithm proved this property).
2. It has a very high order of dimensional equidistribution.
This implies that there is negligible serial correlation between
successive values in the output sequence.
3. It passes numerous tests for statistical randomness, including
the stringent Diehard tests.
4. It is fast.
---
*******************************************************************************/
struct Twister
{
private enum : uint {
// Period parameters
N = 624,
M = 397,
MATRIX_A = 0x9908b0df, // constant vector a
UPPER_MASK = 0x80000000, // most significant w-r bits
LOWER_MASK = 0x7fffffff, // least significant r bits
}
enum int canCheckpoint=true;
enum int canSeed=true;
private uint[N] mt; // the array for the state vector
private uint mti=mt.length+1; // mti==mt.length+1 means mt[] is not initialized
/// returns a random uint
uint next ()
{
uint y;
static uint mag01[2] =[0, MATRIX_A];
if (mti >= mt.length) {
int kk;
for (kk=0;kk<mt.length-M;kk++)
{
y = (mt[kk]&UPPER_MASK)|(mt[kk+1]&LOWER_MASK);
mt[kk] = mt[kk+M] ^ (y >> 1) ^ mag01[y & 1U];
}
for (;kk<mt.length-1;kk++) {
y = (mt[kk]&UPPER_MASK)|(mt[kk+1]&LOWER_MASK);
mt[kk] = mt[kk+(M-mt.length)] ^ (y >> 1) ^ mag01[y & 1U];
}
y = (mt[mt.length-1]&UPPER_MASK)|(mt[0]&LOWER_MASK);
mt[mt.length-1] = mt[M-1] ^ (y >> 1) ^ mag01[y & 1U];
mti = 0;
}
y = mt[mti++];
y ^= (y >> 11);
y ^= (y << 7) & 0x9d2c5680UL;
y ^= (y << 15) & 0xefc60000UL;
y ^= (y >> 18);
return y;
}
/// returns a random byte
ubyte nextB(){
return cast(ubyte)(next() & 0xFF);
}
/// returns a random long
ulong nextL(){
return ((cast(ulong)next)<<32)+cast(ulong)next;
}
/// initializes the generator with a uint as seed
void seed (uint s)
{
mt[0]= s & 0xffff_ffffU; // this is very suspicious, was the previous line incorrectly translated from C???
for (mti=1; mti<mt.length; mti++){
mt[mti] = cast(uint)(1812433253UL * (mt[mti-1] ^ (mt[mti-1] >> 30)) + mti);
mt[mti] &= 0xffff_ffffUL; // this is very suspicious, was the previous line incorrectly translated from C???
}
}
/// adds entropy to the generator
void addEntropy(scope uint delegate() r){
int i, j, k;
i=1;
j=0;
for (k = mt.length; k; k--) {
mt[i] = cast(uint)((mt[i] ^ ((mt[i-1] ^ (mt[i-1] >> 30)) * 1664525UL))+ r() + j);
mt[i] &= 0xffff_ffffUL; // this is very suspicious, was the previous line incorrectly translated from C???
i++;
j++;
if (i >= mt.length){
mt[0] = mt[mt.length-1];
i=1;
}
}
for (k=mt.length-1; k; k--) {
mt[i] = cast(uint)((mt[i] ^ ((mt[i-1] ^ (mt[i-1] >> 30)) * 1566083941UL))- i);
mt[i] &= 0xffffffffUL; // this is very suspicious, was the previous line incorrectly translated from C???
i++;
if (i>=mt.length){
mt[0] = mt[mt.length-1];
i=1;
}
}
mt[0] |= 0x80000000UL;
mti=0;
}
/// seeds the generator
void seed(scope uint delegate() r){
seed (19650218UL);
addEntropy(r);
}
/// writes the current status in a string
/*char[] toString(){
char[] res=new char[7+(N+1)*9];
int i=0;
res[i..i+7]="Twister"[];
i+=7;
res[i]='_';
++i;
Integer.format(res[i..i+8],mti,cast(char[])"x8");
i+=8;
foreach (val;mt){
res[i]='_';
++i;
Integer.format(res[i..i+8],val,cast(char[])"x8");
i+=8;
}
assert(i==res.length,"unexpected size");
return res;
}
/// reads the current status from a string (that should have been trimmed)
/// returns the number of chars read
size_t fromString(const(char[]) s){
size_t i;
assert(s[0..7]=="Twister","unexpected kind, expected Twister");
i+=7;
assert(s[i]=='_',"no separator _ found");
++i;
size_t ate;
mti=cast(uint)Integer.convert(s[i..i+8],16,&ate);
assert(ate==8,"unexpected read size");
i+=8;
foreach (ref val;mt){
assert(s[i]=='_',"no separator _ found");
++i;
val=cast(uint)Integer.convert(s[i..i+8],16,&ate);
assert(ate==8,"unexpected read size");
i+=8;
}
return i;
}*/
}
| D |
a songbook containing a collection of hymns
| D |
import common_private;
@nogc
void syntax_error(A...)(A a) {
import core.stdc.stdio;
printf("\n");
printf("Syntax error: ");
log(a);
printf("\n");
}
@nogc
void fatal_error(A...)(A a) {
import core.stdc.stdio;
import core.stdc.stdlib;
printf("\n");
printf("Syntax error: ");
log(a);
printf("\n");
exit(1);
}
| D |
/Users/kirstenrichard/Desktop/substrate-moloch-dao/target/release/wbuild-runner/node-template-runtime9626994530545983703/target/x86_64-apple-darwin/release/deps/either-dfea4db9eca0192e.rmeta: /Users/kirstenrichard/.cargo/registry/src/github.com-1ecc6299db9ec823/either-1.5.3/src/lib.rs
/Users/kirstenrichard/Desktop/substrate-moloch-dao/target/release/wbuild-runner/node-template-runtime9626994530545983703/target/x86_64-apple-darwin/release/deps/libeither-dfea4db9eca0192e.rlib: /Users/kirstenrichard/.cargo/registry/src/github.com-1ecc6299db9ec823/either-1.5.3/src/lib.rs
/Users/kirstenrichard/Desktop/substrate-moloch-dao/target/release/wbuild-runner/node-template-runtime9626994530545983703/target/x86_64-apple-darwin/release/deps/either-dfea4db9eca0192e.d: /Users/kirstenrichard/.cargo/registry/src/github.com-1ecc6299db9ec823/either-1.5.3/src/lib.rs
/Users/kirstenrichard/.cargo/registry/src/github.com-1ecc6299db9ec823/either-1.5.3/src/lib.rs:
| D |
#!/usr/bin/env rdmd-dev-module
/** Extensions to std.parallelism.
*/
module parallelism_ex;
/** See also: http://forum.dlang.org/thread/irlkdkrgrnadgsgkvcjt@forum.dlang.org#post-vxbhxqgfhuwytdqkripq:40forum.dlang.org
*/
private auto pmap(alias fun, R)(R range) if(isInputRange!R)
{
import std.parallelism;
import core.sync.mutex;
static __gshared Mutex mutex;
if (mutex is null) mutex = new Mutex;
typeof (fun(range.front))[] values;
foreach (i, value; range.parallel)
{
auto newValue = fun(value);
synchronized (mutex)
{
if (values.length < i + 1) values.length = i + 1;
values[i] = newValue;
}
}
return values;
}
| D |
import a;
import b;
void main()
{
afun();
bfun();
} | D |
module mahjong.util.range;
import std.algorithm;
import std.array;
import std.experimental.logger;
import std.math;
import std.range;
import std.traits;
template max(alias pred, TReturn)
{
auto max(Range)(Range range) if (isInputRange!Range && isNumeric!TReturn)
{
auto myMax = TReturn.init;
foreach (element; range)
{
auto value = pred(element);
if (value > myMax)
{
myMax = value;
}
static if (isFloatingPoint!TReturn)
{
if (myMax.isNaN)
{
myMax = value;
}
}
}
return myMax;
}
}
unittest
{
assert([0, 1, 2, 3, 4, 5].max!(s => s % 5, int) == 4,
"It takes the max of the evaluated expression");
assert([0f, 1f, 2f, 3f, 4f, 5f].max!(s => s % 5, float) == 4, "It should work for floats");
assert([0f, 1f, 2f, 3f, float.nan, 5f].max!(s => s % 5, float) == 3,
"The max function should ignore NaN");
assert([0f, 3f, 2f, float.nan, 1f, 5f].max!(s => s % 5, float) == 3,
"The max function is independent on order");
}
T remove(alias pred, T)(ref T[] array, const T element)
{
foreach (i, e; array)
{
if (pred(e, element))
{
array = array[0 .. i] ~ array[i + 1 .. $];
return e;
}
}
return T.init;
}
unittest
{
}
template without(alias equality = (a, b) => a == b)
{
T[] without(T)(T[] arr, T[] exclusion)
{
return arr.filter!(elem => !exclusion.any!(excl => equality(excl, elem))).array;
}
}
template first(alias pred)
{
auto first(Range)(Range range) if (isInputRange!Range)
{
auto foundRange = range.find!pred;
if (foundRange.empty)
return (ElementType!Range).init;
return foundRange.front;
}
}
size_t indexOf(Range, E)(Range range, E element) if (isInputRange!Range)
{
return range.countUntil!(e => e == element);
}
unittest
{
}
T[] insertAt(T)(T[] collection, T element, size_t index)
{
T[] placeholder;
if (index != 0)
{
placeholder ~= collection[0 .. index];
}
placeholder ~= element;
if (index != collection.length)
{
placeholder ~= collection[index .. $];
}
collection = placeholder;
return placeholder;
}
unittest
{
assert([0, 1, 2] == [1, 2].insertAt(0, 0), "New element should be inserted at 0");
assert([1, 0, 2] == [1, 2].insertAt(0, 1), "New element should be inserted at 1");
assert([1, 2, 0] == [1, 2].insertAt(0, 2), "New element should be inserted at 2");
}
template sum(fun...) if (fun.length >= 1)
{
alias yeOldeSum = std.algorithm.sum;
auto sum(Range)(Range range) if (isInputRange!(Unqual!Range))
{
return yeOldeSum(range.map!fun);
}
}
unittest
{
struct Wrapper
{
int value;
}
auto result = [Wrapper(5), Wrapper(18)].sum!(w => w.value);
assert(result == 23, "The sum should give the sum of the wrapped numbers");
}
template flatMap(alias fun) //if(isInputRange!(ReturnType!fun))
{
auto flatMap(Range)(Range range) if (isInputRange!Range)
{
auto mappedResult = range.map!fun;
static if (is(ElementType!(typeof(mappedResult)) == E[], E))
{
if (mappedResult.empty)
return null;
return fold!((a, b) => a ~ b)(mappedResult);
}
else
{
return joiner(mappedResult);
}
}
}
unittest
{
struct Bubble
{
int[] ints;
}
auto flattened = [Bubble([1, 2]), Bubble([3, 4])].flatMap!(x => x.ints).array;
assert([1, 2, 3, 4].equal(flattened), "The two arrays should be joined");
}
unittest
{
struct Bubble
{
int[] ints;
}
Bubble[] bubbles; // Empty range;
auto flattened = bubbles.flatMap!(x => x.ints).array;
assert(flattened.length == 0,
"Flat-mapping an empty range should return an empty range of the result type");
}
unittest
{
import std.range : iota;
import fluent.asserts;
struct Counter
{
auto oneTwoThree()
{
return iota(1, 4);
}
}
auto counters = [Counter(), Counter(), Counter()].flatMap!(c => c.oneTwoThree);
counters.should.equal([1, 2, 3, 1, 2, 3, 1, 2, 3]);
}
template atLeastOneUntil()
{
auto atLeastOneUntil(Range, Needle)(Range range, Needle needle)
{
static assert(isInputRange!Range,
"An input range should be supplied instead of " ~ Range.stringof);
bool isOnePassed = false;
return range.until!((x, y) {
if (isOnePassed)
return x == y;
isOnePassed = true;
return false;
})(needle);
}
}
unittest
{
import fluent.asserts;
[4, 5, 4].atLeastOneUntil(4).should.equal([4, 5]);
}
import std.typecons : Tuple;
private Tuple!(int, double) __HACK__; | D |
module ui.parse.css.fit_content; | D |
module exampleplugin.plugininfo;
enum id = "exampleplugin";
enum semver = "0.1.0";
enum deps = ["voxelman.eventdispatcher", "0.3.0"];
enum clientdeps = ["voxelman.configplugin", "0.5.0", "voxelman.client", "0.5.0"];
enum serverdeps = ["voxelman.server", "0.5.0"];
| D |
/*
* $Id: input.d,v 1.2 2005/07/03 07:05:23 kenta Exp $
*
* Copyright 2004 Kenta Cho. Some rights reserved.
*/
module abagames.util.sdl.input;
private import derelict.sdl2.sdl;
/**
* Input device interface.
*/
public interface Input {
public void handleEvent(SDL_Event *event);
}
public class MultipleInputDevice: Input {
public:
Input[] inputs;
public void handleEvent(SDL_Event *event) {
foreach (Input i; inputs)
i.handleEvent(event);
}
}
| D |
module dbg_log.ex3;
mixin template DebugLogMixin3(string domain, string file = __FILE__)
{
import log_prefix.ex4 : logPrefix;
import dbg_log.ex3 : dbgLogImpl2, isDebugVersionOn;
pragma (inline, true):
void dbgLog(Args...)(string format, auto ref Args args, int line = __LINE__)
{
static if (isDebugVersionOn!(domain))
{
const prefix = logPrefix!(domain, file)(line);
dbgLogImpl2!true(prefix ~ format, args);
}
}
}
pragma (inline, false)
void dbgLogImpl2(bool newLine, Args...)(string format, Args args)
{
import std.stdio : writef, writefln, stdout;
static if (newLine)
writefln(format, args);
else
{
writef(format, args);
stdout.flush();
}
}
enum isDebugVersionOn(string name) = ()
{
mixin("debug(", name, ") return true; else return false;");
}();
| D |
module twigd.reference.tags;
import std.string : stripLeft, split;
import std.algorithm.searching : startsWith;
version(unittest) {
import std.stdio;
}
import twigd.data;
class Tags {
immutable static string AUTOSCAPE = "autoescape";
immutable static string END_AUTOSCAPE = "endautoescape";
immutable static string WIDH = "with";
immutable static string END_WIDH = "endwith";
immutable static string BLOCK = "block";
immutable static string END_BLOCK = "endblock";
immutable static string IF = "if";
immutable static string ELSEIF = "elseif";
immutable static string ELSE = "else";
immutable static string END_IF = "endif";
immutable static string FOR = "for";
immutable static string END_FOR = "endfor";
immutable static string EMBED = "embed";
immutable static string END_EMBED = "endembed";
immutable static string FILTER = "filter";
immutable static string END_FILTER = "endfilter";
immutable static string MACRO = "macro";
immutable static string END_MACRO = "endmacro";
immutable static string SANDBOX = "sandbox";
immutable static string END_SANDBOX = "endsandbox";
immutable static string SPACELESS = "spaceless";
immutable static string END_SPACELESS = "endspaceless";
immutable static string VERBATIM = "verbatim";
immutable static string END_VERBATIM = "endverbatim";
immutable static string SET = "set";
immutable static string END_SET = "endset";
immutable static string DO = "do";
immutable static string EXTENDS = "extends";
immutable static string FLUSH = "flush";
immutable static string IMPORT = "import";
immutable static string INCLUDE = "include";
enum Type {
AUTOSCAPE,
END_AUTOSCAPE,
WIDH,
END_WIDH,
BLOCK,
END_BLOCK,
IF,
ELSEIF,
ELSE,
END_IF,
FOR,
END_FOR,
EMBED,
END_EMBED,
FILTER,
END_FILTER,
MACRO,
END_MACRO,
SANDBOX,
END_SANDBOX,
SPACELESS,
END_SPACELESS,
VERBATIM,
END_VERBATIM,
SET,
END_SET,
DO,
EXTENDS,
FLUSH,
IMPORT,
INCLUDE,
NULL
}
Type getType(string expression) {
string value = stripLeft(expression).split[0];
if (value == AUTOSCAPE) {
return Type.AUTOSCAPE;
} else if (value == END_AUTOSCAPE) {
return Type.END_AUTOSCAPE;
} else if (value == WIDH) {
return Type.WIDH;
} else if (value == END_WIDH) {
return Type.END_WIDH;
} else if (value == BLOCK) {
return Type.BLOCK;
} else if (value == END_BLOCK) {
return Type.END_BLOCK;
} else if (value == IF) {
return Type.IF;
} else if (value == ELSEIF) {
return Type.ELSEIF;
} else if (value == ELSE) {
return Type.ELSE;
} else if (value == END_IF) {
return Type.END_IF;
} else if (value == FOR) {
return Type.FOR;
} else if (value == END_FOR) {
return Type.END_FOR;
} else if (value == EMBED) {
return Type.EMBED;
} else if (value == END_EMBED) {
return Type.END_EMBED;
} else if (value == FILTER) {
return Type.FILTER;
} else if (value == END_FILTER) {
return Type.END_FILTER;
} else if (value == MACRO) {
return Type.MACRO;
} else if (value == END_MACRO) {
return Type.END_MACRO;
} else if (value == SANDBOX) {
return Type.SANDBOX;
} else if (value == END_SANDBOX) {
return Type.END_SANDBOX;
} else if (value == SPACELESS) {
return Type.SPACELESS;
} else if (value == END_SPACELESS) {
return Type.END_SPACELESS;
} else if (value == VERBATIM) {
return Type.VERBATIM;
} else if (value == END_VERBATIM) {
return Type.END_VERBATIM;
} else if (value == SET) {
return Type.SET;
} else if (value == END_SET) {
return Type.END_SET;
} else if (value == DO) {
return Type.DO;
} else if (value == EXTENDS) {
return Type.EXTENDS;
} else if (value == FLUSH) {
return Type.FLUSH;
} else if (value == IMPORT) {
return Type.IMPORT;
} else if (value == INCLUDE) {
return Type.INCLUDE;
}
return Type.NULL;
}
bool isFunction(string expression) {
return getType(expression) != Type.NULL;
}
bool isSupport(string expression) {
switch(getType(expression)) {
case Type.BLOCK:
case Type.END_BLOCK:
case Type.EXTENDS:
//case Type.IF:
//case Type.ELSEIF:
//case Type.ELSE:
//case Type.END_IF:
case Type.INCLUDE:
return true;
default:
return false;
}
}
string ifTag(string expression, string bodyStd) {
string[] words = split(expression, " ");
string result = "";
foreach (word; words) {
switch(word) {
case "if": {
result ~= word ~ " (";
break;
}
case "==":
case "!=":
case ">":
case "<":
case ">=":
case "<=": {
result ~= " " ~ word ~ " ";
break;
}
case "true":
case "false": {
result ~= word;
break;
}
case "and": {
result ~= " && ";
break;
}
case "or": {
result ~= " || ";
break;
}
default: {
result ~= "data." ~ word;
break;
}
}
}
result ~= ") {\n writeln(\"";
result ~= bodyStd;
result ~= "\")\n}";
return result;
}
string forTag() {
return null;
}
string blockTag() {
return null;
}
string extendsTag() {
return null;
}
string includeTag() {
return null;
}
}
/**
* The if statement in Twig is comparable with the if statements of D.
* In the simplest form you can use it to test if an expression evaluates to true:
*
* {% if online == false %}
* <p>Our website is in maintenance mode. Please, come back later.</p>
* {% endif %}
*/
unittest {
Tags tags = getTags();
Data data;
data.online = false;
string bodyStr = "<p>Our website is in maintenance mode. Please, come back later.</p>";
string ifexpression = tags.ifTag("if online == false", bodyStr);
//writeln(ifexpression);
}
/**
* Test isFunction
*/
unittest {
Tags tags = getTags();
assert(tags.isFunction("if online == false"));
assert(tags.isFunction("ifonline == false") == false);
assert(tags.isFunction("if"));
assert(tags.isFunction("some word") == false);
assert(tags.isFunction("for user in users"));
assert(tags.isFunction(" endfor "));
assert(tags.isFunction(" macro input(name, value, type, size) "));
assert(tags.isFunction("import 'forms.html' as forms"));
assert(tags.isFunction("include 'header.html'"));
assert(tags.isFunction(" set foo = 'bar' "));
}
version(unittest) {
private Tags getTags() {
return new Tags;
}
} | D |
<?xml version="1.0" encoding="ASCII"?>
<di:SashWindowsMngr xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:di="http://www.eclipse.org/papyrus/0.7.0/sashdi">
<pageList>
<availablePage>
<emfPageIdentifier href="_pRWYsA_YEeqjDam8EyRRugf75fa672-9234-4da5-8997-57117fb33659-Activity.notation#_8eBQoBS0Eeq1UbCOhhTSQg"/>
</availablePage>
</pageList>
<sashModel currentSelection="//@sashModel/@windows.0/@children.0">
<windows>
<children xsi:type="di:TabFolder">
<children>
<emfPageIdentifier href="_pRWYsA_YEeqjDam8EyRRugf75fa672-9234-4da5-8997-57117fb33659-Activity.notation#_8eBQoBS0Eeq1UbCOhhTSQg"/>
</children>
</children>
</windows>
</sashModel>
</di:SashWindowsMngr>
| D |
instance KDW_1402_Addon_Nefarius_NW(Npc_Default)
{
name[0] = "Нефариус";
guild = GIL_KDW;
id = 1402;
voice = 5;
flags = NPC_FLAG_IMMORTAL;
npcType = NPCTYPE_MAIN;
aivar[AIV_MagicUser] = MAGIC_ALWAYS;
aivar[AIV_IgnoresFakeGuild] = TRUE;
aivar[AIV_IgnoresArmor] = TRUE;
aivar[AIV_Teeth] = 1;
B_SetAttributesToChapter(self,5);
fight_tactic = FAI_HUMAN_STRONG;
B_CreateAmbientInv(self);
B_SetNpcVisual(self,MALE,"Hum_Head_Psionic",Face_P_NormalBart_Nefarius,BodyTex_P,ITAR_KDW_L_Addon);
Mdl_SetModelFatness(self,0);
Mdl_ApplyOverlayMds(self,"Humans_Mage.mds");
B_GiveNpcTalents(self);
B_SetFightSkills(self,80);
daily_routine = Rtn_Start_1402;
};
func void Rtn_Start_1402()
{
TA_Study_WP(8,0,20,0,"NW_TROLLAREA_PORTAL_09");
TA_Study_WP(20,0,8,0,"NW_TROLLAREA_PORTAL_09");
};
func void Rtn_Ringritual_1402()
{
TA_Circle(8,0,20,0,"NW_TROLLAREA_PORTALTEMPEL_RITUAL_02");
TA_Circle(20,0,8,0,"NW_TROLLAREA_PORTALTEMPEL_RITUAL_02");
};
func void Rtn_PreRingritual_1402()
{
TA_Stand_WP(8,0,20,0,"NW_TROLLAREA_PORTALTEMPEL_42");
TA_Stand_WP(20,0,8,0,"NW_TROLLAREA_PORTALTEMPEL_42");
};
func void Rtn_OpenPortal_1402()
{
TA_Study_WP(8,0,20,0,"NW_TROLLAREA_PORTAL_KDWWAIT_03");
TA_Study_WP(20,0,8,0,"NW_TROLLAREA_PORTAL_KDWWAIT_03");
};
func void Rtn_TOT_1402()
{
TA_Sleep(8,0,20,0,"TOT");
TA_Sleep(20,0,8,0,"TOT");
};
| D |
import std;
alias Rating = long;
void main() {
char[][] state = File("input.txt").byLine.map!"a.dup[0..5]".array;
char[][] next = new char[][](5, 5);
auto pastRatings = new RedBlackTree!Rating;
while (true) {
if (!pastRatings.insert(state.biodiversity)) {
writeln("Repeating rating: ", state.biodiversity);
return;
}
tick(state, next);
swap(state, next);
}
}
void tick(const(char[][]) before, char[][] after) {
alias cell = (i, j) {
if (i < 0 || i >= before.length)
return '.';
const line = before[i];
if (j < 0 || j >= line.length)
return '.';
return line[j];
};
alias neighbours = (i, j) {
static immutable neighbourOffsets = [[-1, 0], [1, 0], [0, -1], [0, 1]];
return neighbourOffsets.map!(o => cell(i + o[0], j + o[1]));
};
foreach (i; 0 .. before.length) {
foreach (j; 0 .. before[i].length) {
const center = before[i][j];
const bugNeighbourCount = neighbours(i, j).filter!(n => n == '#').count;
if (center == '#' && bugNeighbourCount != 1)
after[i][j] = '.';
else if (center == '.' && (bugNeighbourCount == 1 || bugNeighbourCount == 2))
after[i][j] = '#';
else
after[i][j] = center;
}
}
}
Rating biodiversity(char[][] state) {
static immutable cellValue = 25.iota.map!"2.pow(a)".array;
return state.joiner
.enumerate
.filter!"a[1] == '#'"
.map!(en => cellValue[en[0]])
.sum;
}
| D |
/******************************************************************************
Asynchronously/Selector managed DHT GetAllFilter request class
Sends the received key/value pairs to the provided output delegate.
Copyright:
Copyright (c) 2011-2017 dunnhumby Germany GmbH. All rights reserved.
License:
Boost Software License Version 1.0. See LICENSE.txt for details.
******************************************************************************/
module dhtproto.client.legacy.internal.request.GetAllFilterRequest;
/*******************************************************************************
Imports
*******************************************************************************/
import dhtproto.client.legacy.internal.request.model.IBulkGetRequest;
import ocean.io.select.client.FiberSelectEvent;
/*******************************************************************************
GetAllFilterRequest class
*******************************************************************************/
public class GetAllFilterRequest : IBulkGetPairsRequest
{
/**************************************************************************
Constructor
Params:
reader = FiberSelectReader instance to use for read requests
writer = FiberSelectWriter instance to use for write requests
resources = shared resources which might be required by the request
***************************************************************************/
public this ( FiberSelectReader reader, FiberSelectWriter writer,
IDhtRequestResources resources )
{
super(reader, writer, resources);
}
/***************************************************************************
Sends the node any data required by the request.
***************************************************************************/
override protected void sendRequestData__ ( )
{
super.writer.writeArray(super.params.filter);
}
/***************************************************************************
Processes a received record.
Params:
key = record key
value = record value
***************************************************************************/
override protected void processPair ( in char[] key, in char[] value )
{
auto output = params.io_item.get_pair();
output(this.params.context, key, value);
}
}
| D |
/Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/x86_64-apple-macosx/debug/Logging.build/PrintLogger.swift.o : /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/checkouts/console/Sources/Logging/LogLevel.swift /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/checkouts/console/Sources/Logging/Logger.swift /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/checkouts/console/Sources/Logging/PrintLogger.swift /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/checkouts/console/Sources/Logging/Exports.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/ObjectiveC.swiftmodule /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/x86_64-apple-macosx/debug/NIO.swiftmodule /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/x86_64-apple-macosx/debug/Async.swiftmodule /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/x86_64-apple-macosx/debug/Core.swiftmodule /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/x86_64-apple-macosx/debug/Debugging.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Dispatch.swiftmodule /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/x86_64-apple-macosx/debug/COperatingSystem.swiftmodule /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/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/x86_64-apple-macosx/debug/NIOConcurrencyHelpers.swiftmodule /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/x86_64-apple-macosx/debug/Bits.swiftmodule /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/x86_64-apple-macosx/debug/NIOFoundationCompat.swiftmodule /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/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/checkouts/swift-nio/Sources/CNIOAtomics/include/cpp_magic.h /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/checkouts/swift-nio/Sources/CNIOLinux/include/ifaddrs-android.h /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/checkouts/swift-nio/Sources/CNIODarwin/include/CNIODarwin.h /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/checkouts/swift-nio/Sources/CNIOAtomics/include/CNIOAtomics.h /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/checkouts/swift-nio/Sources/CNIOLinux/include/CNIOLinux.h /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/x86_64-apple-macosx/debug/CNIOSHA1.build/module.modulemap /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/x86_64-apple-macosx/debug/CNIOOpenSSL.build/module.modulemap /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/x86_64-apple-macosx/debug/CCryptoOpenSSL.build/module.modulemap /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/x86_64-apple-macosx/debug/CNIOZlib.build/module.modulemap /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/x86_64-apple-macosx/debug/CNIODarwin.build/module.modulemap /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/x86_64-apple-macosx/debug/CNIOHTTPParser.build/module.modulemap /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/x86_64-apple-macosx/debug/CNIOAtomics.build/module.modulemap /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/x86_64-apple-macosx/debug/CNIOLinux.build/module.modulemap /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/checkouts/swift-nio-zlib-support/module.modulemap /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/objc/ObjectiveC.apinotes /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Dispatch.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/Darwin.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/ApplicationServices.framework/Headers/ApplicationServices.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/CoreText.framework/Headers/CoreText.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/Security.framework/Headers/Security.apinotes
/Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/x86_64-apple-macosx/debug/Logging.build/PrintLogger~partial.swiftmodule : /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/checkouts/console/Sources/Logging/LogLevel.swift /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/checkouts/console/Sources/Logging/Logger.swift /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/checkouts/console/Sources/Logging/PrintLogger.swift /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/checkouts/console/Sources/Logging/Exports.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/ObjectiveC.swiftmodule /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/x86_64-apple-macosx/debug/NIO.swiftmodule /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/x86_64-apple-macosx/debug/Async.swiftmodule /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/x86_64-apple-macosx/debug/Core.swiftmodule /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/x86_64-apple-macosx/debug/Debugging.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Dispatch.swiftmodule /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/x86_64-apple-macosx/debug/COperatingSystem.swiftmodule /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/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/x86_64-apple-macosx/debug/NIOConcurrencyHelpers.swiftmodule /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/x86_64-apple-macosx/debug/Bits.swiftmodule /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/x86_64-apple-macosx/debug/NIOFoundationCompat.swiftmodule /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/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/checkouts/swift-nio/Sources/CNIOAtomics/include/cpp_magic.h /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/checkouts/swift-nio/Sources/CNIOLinux/include/ifaddrs-android.h /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/checkouts/swift-nio/Sources/CNIODarwin/include/CNIODarwin.h /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/checkouts/swift-nio/Sources/CNIOAtomics/include/CNIOAtomics.h /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/checkouts/swift-nio/Sources/CNIOLinux/include/CNIOLinux.h /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/x86_64-apple-macosx/debug/CNIOSHA1.build/module.modulemap /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/x86_64-apple-macosx/debug/CNIOOpenSSL.build/module.modulemap /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/x86_64-apple-macosx/debug/CCryptoOpenSSL.build/module.modulemap /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/x86_64-apple-macosx/debug/CNIOZlib.build/module.modulemap /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/x86_64-apple-macosx/debug/CNIODarwin.build/module.modulemap /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/x86_64-apple-macosx/debug/CNIOHTTPParser.build/module.modulemap /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/x86_64-apple-macosx/debug/CNIOAtomics.build/module.modulemap /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/x86_64-apple-macosx/debug/CNIOLinux.build/module.modulemap /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/checkouts/swift-nio-zlib-support/module.modulemap /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/objc/ObjectiveC.apinotes /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Dispatch.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/Darwin.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/ApplicationServices.framework/Headers/ApplicationServices.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/CoreText.framework/Headers/CoreText.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/Security.framework/Headers/Security.apinotes
/Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/x86_64-apple-macosx/debug/Logging.build/PrintLogger~partial.swiftdoc : /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/checkouts/console/Sources/Logging/LogLevel.swift /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/checkouts/console/Sources/Logging/Logger.swift /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/checkouts/console/Sources/Logging/PrintLogger.swift /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/checkouts/console/Sources/Logging/Exports.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/ObjectiveC.swiftmodule /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/x86_64-apple-macosx/debug/NIO.swiftmodule /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/x86_64-apple-macosx/debug/Async.swiftmodule /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/x86_64-apple-macosx/debug/Core.swiftmodule /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/x86_64-apple-macosx/debug/Debugging.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Dispatch.swiftmodule /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/x86_64-apple-macosx/debug/COperatingSystem.swiftmodule /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/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/x86_64-apple-macosx/debug/NIOConcurrencyHelpers.swiftmodule /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/x86_64-apple-macosx/debug/Bits.swiftmodule /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/x86_64-apple-macosx/debug/NIOFoundationCompat.swiftmodule /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/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/checkouts/swift-nio/Sources/CNIOAtomics/include/cpp_magic.h /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/checkouts/swift-nio/Sources/CNIOLinux/include/ifaddrs-android.h /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/checkouts/swift-nio/Sources/CNIODarwin/include/CNIODarwin.h /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/checkouts/swift-nio/Sources/CNIOAtomics/include/CNIOAtomics.h /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/checkouts/swift-nio/Sources/CNIOLinux/include/CNIOLinux.h /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/x86_64-apple-macosx/debug/CNIOSHA1.build/module.modulemap /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/x86_64-apple-macosx/debug/CNIOOpenSSL.build/module.modulemap /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/x86_64-apple-macosx/debug/CCryptoOpenSSL.build/module.modulemap /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/x86_64-apple-macosx/debug/CNIOZlib.build/module.modulemap /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/x86_64-apple-macosx/debug/CNIODarwin.build/module.modulemap /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/x86_64-apple-macosx/debug/CNIOHTTPParser.build/module.modulemap /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/x86_64-apple-macosx/debug/CNIOAtomics.build/module.modulemap /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/x86_64-apple-macosx/debug/CNIOLinux.build/module.modulemap /Users/mhassanin/Developer/CupcakeVapor/CupcakeCorner/.build/checkouts/swift-nio-zlib-support/module.modulemap /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/objc/ObjectiveC.apinotes /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Dispatch.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/Darwin.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/ApplicationServices.framework/Headers/ApplicationServices.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/CoreText.framework/Headers/CoreText.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/Security.framework/Headers/Security.apinotes
| D |
in a lurid manner
| D |
prototype Mst_Default_Addon_Alligator(C_Npc)
{
name[0] = "Аллигатор";
guild = GIL_Alligator;
aivar[AIV_MM_REAL_ID] = ID_Alligator;
level = 12;
attribute[ATR_STRENGTH] = 40;
attribute[ATR_DEXTERITY] = 40;
attribute[ATR_HITPOINTS_MAX] = 80;
attribute[ATR_HITPOINTS] = 80;
attribute[ATR_MANA_MAX] = 0;
attribute[ATR_MANA] = 0;
protection[PROT_BLUNT] = 20;
protection[PROT_EDGE] = 20;
protection[PROT_POINT] = 20;
protection[PROT_FIRE] = 0;
protection[PROT_FLY] = 20;
protection[PROT_MAGIC] = 0;
damagetype = DAM_EDGE;
fight_tactic = FAI_Alligator;
senses = SENSE_HEAR | SENSE_SEE | SENSE_SMELL;
senses_range = PERC_DIST_MONSTER_ACTIVE_MAX;
aivar[AIV_MM_ThreatenBeforeAttack] = TRUE;
aivar[AIV_MM_FollowTime] = FOLLOWTIME_MEDIUM;
aivar[AIV_MM_FollowInWater] = TRUE;
start_aistate = ZS_MM_AllScheduler;
aivar[AIV_MM_RoamStart] = OnlyRoutine;
};
func void B_SetVisuals_Alligator()
{
Mdl_SetVisual(self,"Alligator.mds");
Mdl_SetVisualBody(self,"KRO_BODY",DEFAULT,DEFAULT,"",DEFAULT,DEFAULT,-1);
};
instance Alligator(Mst_Default_Addon_Alligator)
{
B_SetVisuals_Alligator();
Npc_SetToFistMode(self);
};
instance Alligator_PortalDead(Mst_Default_Addon_Alligator)
{
B_SetVisuals_Alligator();
Npc_SetToFistMode(self);
};
| D |
/**
* C's <math.h>
* Authors: Walter Bright, Digital Mars, www.digitalmars.com
* License: Public Domain
* Macros:
* WIKI=Phobos/StdCMath
*/
module mystd.c.math;
public import core.stdc.math; | D |
/*
* All content copyright Terracotta, Inc., unless otherwise indicated. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy
* of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
*/
module hunt.quartz.JobDetail;
import hunt.quartz.JobBuilder;
import hunt.quartz.JobDataMap;
import hunt.quartz.JobKey;
import hunt.util.Common;
/**
* Conveys the detail properties of a given <code>Job</code> instance. JobDetails are
* to be created/defined with {@link JobBuilder}.
*
* <p>
* Quartz does not store an actual instance of a <code>Job</code> class, but
* instead allows you to define an instance of one, through the use of a <code>JobDetail</code>.
* </p>
*
* <p>
* <code>Job</code>s have a name and group associated with them, which
* should uniquely identify them within a single <code>{@link Scheduler}</code>.
* </p>
*
* <p>
* <code>Trigger</code>s are the 'mechanism' by which <code>Job</code>s
* are scheduled. Many <code>Trigger</code>s can point to the same <code>Job</code>,
* but a single <code>Trigger</code> can only point to one <code>Job</code>.
* </p>
*
* @see JobBuilder
* @see Job
* @see JobDataMap
* @see Trigger
*
* @author James House
*/
interface JobDetail : Comparable!(JobDetail) { // : Serializable, Cloneable
JobKey getKey();
/**
* <p>
* Return the description given to the <code>Job</code> instance by its
* creator (if any).
* </p>
*
* @return null if no description was set.
*/
string getDescription();
/**
* <p>
* Get the instance of <code>Job</code> that will be executed.
* </p>
*/
TypeInfo_Class getJobClass();
/**
* <p>
* Get the <code>JobDataMap</code> that is associated with the <code>Job</code>.
* </p>
*/
JobDataMap getJobDataMap();
/**
* <p>
* Whether or not the <code>Job</code> should remain stored after it is
* orphaned (no <code>{@link Trigger}s</code> point to it).
* </p>
*
* <p>
* If not explicitly set, the default value is <code>false</code>.
* </p>
*
* @return <code>true</code> if the Job should remain persisted after
* being orphaned.
*/
bool isDurable();
/**
* @see PersistJobDataAfterExecution
* @return whether the associated Job class carries the {@link PersistJobDataAfterExecution} annotation.
*/
bool isPersistJobDataAfterExecution();
/**
* @see DisallowConcurrentExecution
* @return whether the associated Job class carries the {@link DisallowConcurrentExecution} annotation.
*/
bool isConcurrentExectionDisallowed();
/**
* <p>
* Instructs the <code>Scheduler</code> whether or not the <code>Job</code>
* should be re-executed if a 'recovery' or 'fail-over' situation is
* encountered.
* </p>
*
* <p>
* If not explicitly set, the default value is <code>false</code>.
* </p>
*
* @see JobExecutionContext#isRecovering()
*/
bool requestsRecovery();
Object clone();
/**
* Get a {@link JobBuilder} that is configured to produce a
* <code>JobDetail</code> identical to this one.
*/
JobBuilder getJobBuilder();
} | D |
/**
URL parsing routines.
Copyright: © 2012 rejectedsoftware e.K.
License: Subject to the terms of the MIT license, as written in the included LICENSE.txt file.
Authors: Sönke Ludwig
*/
module dub.internal.vibecompat.inet.url;
public import dub.internal.vibecompat.inet.path;
version (Have_vibe_d) public import vibe.inet.url;
else:
import std.algorithm;
import std.array;
import std.conv;
import std.exception;
import std.string;
import std.uri;
/**
Represents a URL decomposed into its components.
*/
struct URL {
private {
string m_schema;
string m_pathString;
Path m_path;
string m_host;
ushort m_port;
string m_username;
string m_password;
string m_queryString;
string m_anchor;
}
/// Constructs a new URL object from its components.
this(string schema, string host, ushort port, Path path)
{
m_schema = schema;
m_host = host;
m_port = port;
m_path = path;
m_pathString = path.toString();
}
/// ditto
this(string schema, Path path)
{
this(schema, null, 0, path);
}
/** Constructs a URL from its string representation.
TODO: additional validation required (e.g. valid host and user names and port)
*/
this(string url_string)
{
auto str = url_string;
enforce(str.length > 0, "Empty URL.");
if( str[0] != '/' ){
auto idx = str.countUntil(':');
enforce(idx > 0, "No schema in URL:"~str);
m_schema = str[0 .. idx];
str = str[idx+1 .. $];
bool requires_host = false;
switch(m_schema){
case "http":
case "https":
case "ftp":
case "spdy":
case "sftp":
case "file":
// proto://server/path style
enforce(str.startsWith("//"), "URL must start with proto://...");
requires_host = true;
str = str[2 .. $];
goto default;
default:
auto si = str.countUntil('/');
if( si < 0 ) si = str.length;
auto ai = str[0 .. si].countUntil('@');
sizediff_t hs = 0;
if( ai >= 0 ){
hs = ai+1;
auto ci = str[0 .. ai].countUntil(':');
if( ci >= 0 ){
m_username = str[0 .. ci];
m_password = str[ci+1 .. ai];
} else m_username = str[0 .. ai];
enforce(m_username.length > 0, "Empty user name in URL.");
}
m_host = str[hs .. si];
auto pi = m_host.countUntil(':');
if(pi > 0) {
enforce(pi < m_host.length-1, "Empty port in URL.");
m_port = to!ushort(m_host[pi+1..$]);
m_host = m_host[0 .. pi];
}
enforce(!requires_host || m_schema == "file" || m_host.length > 0,
"Empty server name in URL.");
str = str[si .. $];
}
}
this.localURI = str;
}
/// ditto
static URL parse(string url_string)
{
return URL(url_string);
}
/// The schema/protocol part of the URL
@property string schema() const { return m_schema; }
/// ditto
@property void schema(string v) { m_schema = v; }
/// The path part of the URL in the original string form
@property string pathString() const { return m_pathString; }
/// The path part of the URL
@property Path path() const { return m_path; }
/// ditto
@property void path(Path p)
{
m_path = p;
auto pstr = p.toString();
m_pathString = pstr;
}
/// The host part of the URL (depends on the schema)
@property string host() const { return m_host; }
/// ditto
@property void host(string v) { m_host = v; }
/// The port part of the URL (optional)
@property ushort port() const { return m_port; }
/// ditto
@property port(ushort v) { m_port = v; }
/// The user name part of the URL (optional)
@property string username() const { return m_username; }
/// ditto
@property void username(string v) { m_username = v; }
/// The password part of the URL (optional)
@property string password() const { return m_password; }
/// ditto
@property void password(string v) { m_password = v; }
/// The query string part of the URL (optional)
@property string queryString() const { return m_queryString; }
/// ditto
@property void queryString(string v) { m_queryString = v; }
/// The anchor part of the URL (optional)
@property string anchor() const { return m_anchor; }
/// The path part plus query string and anchor
@property string localURI()
const {
auto str = appender!string();
str.reserve(m_pathString.length + 2 + queryString.length + anchor.length);
str.put(encode(path.toString()));
if( queryString.length ) {
str.put("?");
str.put(queryString);
}
if( anchor.length ) {
str.put("#");
str.put(anchor);
}
return str.data;
}
/// ditto
@property void localURI(string str)
{
auto ai = str.countUntil('#');
if( ai >= 0 ){
m_anchor = str[ai+1 .. $];
str = str[0 .. ai];
}
auto qi = str.countUntil('?');
if( qi >= 0 ){
m_queryString = str[qi+1 .. $];
str = str[0 .. qi];
}
m_pathString = str;
m_path = Path(decode(str));
}
/// The URL to the parent path with query string and anchor stripped.
@property URL parentURL() const {
URL ret;
ret.schema = schema;
ret.host = host;
ret.port = port;
ret.username = username;
ret.password = password;
ret.path = path.parentPath;
return ret;
}
/// Converts this URL object to its string representation.
string toString()
const {
import std.format;
auto dst = appender!string();
dst.put(schema);
dst.put(":");
switch(schema){
default: break;
case "file":
case "http":
case "https":
case "ftp":
case "spdy":
case "sftp":
dst.put("//");
break;
}
dst.put(host);
if( m_port > 0 ) formattedWrite(dst, ":%d", m_port);
dst.put(localURI);
return dst.data;
}
bool startsWith(const URL rhs) const {
if( m_schema != rhs.m_schema ) return false;
if( m_host != rhs.m_host ) return false;
// FIXME: also consider user, port, querystring, anchor etc
return path.startsWith(rhs.m_path);
}
URL opBinary(string OP)(Path rhs) const if( OP == "~" ) { return URL(m_schema, m_host, m_port, m_path ~ rhs); }
URL opBinary(string OP)(PathEntry rhs) const if( OP == "~" ) { return URL(m_schema, m_host, m_port, m_path ~ rhs); }
void opOpAssign(string OP)(Path rhs) if( OP == "~" ) { m_path ~= rhs; }
void opOpAssign(string OP)(PathEntry rhs) if( OP == "~" ) { m_path ~= rhs; }
/// Tests two URLs for equality using '=='.
bool opEquals(ref const URL rhs) const {
if( m_schema != rhs.m_schema ) return false;
if( m_host != rhs.m_host ) return false;
if( m_path != rhs.m_path ) return false;
return true;
}
/// ditto
bool opEquals(const URL other) const { return opEquals(other); }
int opCmp(ref const URL rhs) const {
if( m_schema != rhs.m_schema ) return m_schema.cmp(rhs.m_schema);
if( m_host != rhs.m_host ) return m_host.cmp(rhs.m_host);
if( m_path != rhs.m_path ) return m_path.opCmp(rhs.m_path);
return true;
}
}
unittest {
auto url = URL.parse("https://www.example.net/index.html");
assert(url.schema == "https", url.schema);
assert(url.host == "www.example.net", url.host);
assert(url.path == Path("/index.html"), url.path.toString());
url = URL.parse("http://jo.doe:password@sub.www.example.net:4711/sub2/index.html?query#anchor");
assert(url.schema == "http", url.schema);
assert(url.username == "jo.doe", url.username);
assert(url.password == "password", url.password);
assert(url.port == 4711, to!string(url.port));
assert(url.host == "sub.www.example.net", url.host);
assert(url.path.toString() == "/sub2/index.html", url.path.toString());
assert(url.queryString == "query", url.queryString);
assert(url.anchor == "anchor", url.anchor);
}
| D |
// ************************ EXIT **************************
INSTANCE DIA_SLD_709_Cord_Exit (C_INFO)
{
npc = SLD_709_Cord;
nr = 999;
condition = DIA_SLD_709_Cord_Exit_Condition;
information = DIA_SLD_709_Cord_Exit_Info;
important = 0;
permanent = 1;
description = DIALOG_ENDE;
};
FUNC INT DIA_SLD_709_Cord_Exit_Condition()
{
return 1;
};
FUNC VOID DIA_SLD_709_Cord_Exit_Info()
{
AI_StopProcessInfos ( self );
};
//========================================
//-----------------> SZKODNICY
//========================================
INSTANCE DIA_Cord_SZKODNICY (C_INFO)
{
npc = SLD_709_Cord;
nr = 1;
condition = DIA_Cord_SZKODNICY_Condition;
information = DIA_Cord_SZKODNICY_Info;
permanent = FALSE;
Important = TRUE;
};
FUNC INT DIA_Cord_SZKODNICY_Condition()
{
if (Npc_KnowsInfo (hero, DIA_Cronos_KRADZIEZ)) && (MIS_CronosArtifacts == LOG_RUNNING)
{
return TRUE;
};
};
FUNC VOID DIA_Cord_SZKODNICY_Info()
{
AI_Output (self, other ,"DIA_Cord_SZKODNICY_03_01"); //Hej! Podobno pomagasz Cronosowi w poszukiwaniach Szkodników. Bardzo dobrze.
AI_Output (self, other ,"DIA_Cord_SZKODNICY_03_02"); //Mogę ci dać wskazówkę: widziałem dwóch Szkodników na polanie. Myślę, że rozbili tam obóz.
AI_Output (other, self ,"DIA_Cord_SZKODNICY_15_03"); //Dzięki. Rozpocznę tam swoje poszukiwania.
B_LogEntry (CH1_MagicySzkodnicy,"Cord widział dwóch Szkodników na polanie nad Nowym Obozem. Powinienem tam poszukać.");
AI_StopProcessInfos (self);
};
//========================================
//-----------------> ZAJECIE
//========================================
INSTANCE DIA_Cord_ZAJECIE (C_INFO)
{
npc = SLD_709_Cord;
nr = 1;
condition = DIA_Cord_ZAJECIE_Condition;
information = DIA_Cord_ZAJECIE_Info;
permanent = FALSE;
description = "Czym się tutaj zajmujesz poza trenowaniem Najemników?";
};
FUNC INT DIA_Cord_ZAJECIE_Condition()
{
return TRUE;
};
FUNC VOID DIA_Cord_ZAJECIE_Info()
{
AI_Output (other, self ,"DIA_Cord_ZAJECIE_15_01"); //Czym się tutaj zajmujesz poza trenowaniem Najemników?
AI_Output (self, other ,"DIA_Cord_ZAJECIE_03_02"); //Cóż, jestem przywódcą prowizorycznej straży. Zajmujemy się w specjalnymi zadaniami zlecanych przez Lee.
AI_Output (self, other ,"DIA_Cord_ZAJECIE_03_03"); //Poza tym chronię Magów Wody najlepiej jak mogę. Świetnie się dogadujemy i mam nadzieję, że po upadku Bariery pomimo zakończenia umowy między Lee a Magami, będę miał możliwość dla nich pracować.
AI_Output (other, self ,"DIA_Cord_ZAJECIE_15_04"); //Rozumiem.
};
/*------------------------------------------------------------------------
TRAIN ANGEBOT
------------------------------------------------------------------------*/
instance SLD_709_Cord_TRAINOFFER (C_INFO)
{
npc = SLD_709_Cord;
condition = SLD_709_Cord_TRAINOFFER_Condition;
information = SLD_709_Cord_TRAINOFFER_Info;
important = 0;
permanent = 0;
description = "Chciałbym nauczyć się walki jednoręcznym orężem.";
};
FUNC int SLD_709_Cord_TRAINOFFER_Condition()
{
return TRUE;
};
FUNC void SLD_709_Cord_TRAINOFFER_Info()
{
AI_Output (other, self,"SLD_709_Cord_TRAINOFFER_Info_15_01"); //Chciałbym nauczyć się walki jednoręcznym orężem.
AI_Output (self, other,"SLD_709_Cord_TRAINOFFER_Info_14_02"); //Nie ma sprawy. Ale to cię będzie kosztowało 30 bryłek rudy. Może być?
AI_Output (self, other,"SLD_709_Cord_TRAINOFFER_Info_14_03"); //Aha, szkolę tylko NASZYCH ludzi!
Log_CreateTopic (GE_TeacherNC, LOG_NOTE);
B_LogEntry (GE_TeacherNC, "Najemnik Cord może mnie nauczyć walki jednoręcznym orężem o ile dołączę do Nowego Obozu. Za dnia można go znaleźć na kamienistej równinie, przy jeziorze.");
};
// **************************************************
// START_TRAIN
// **************************************************
INSTANCE DIA_Cord_START_TRAIN (C_INFO)
{
npc = SLD_709_Cord;
nr = 10;
condition = DIA_Cord_START_TRAIN_Condition;
information = DIA_Cord_START_TRAIN_Info;
permanent = 1;
description = "Zacznijmy trening.";
};
FUNC INT DIA_Cord_START_TRAIN_Condition()
{
if (Npc_KnowsInfo(hero,SLD_709_Cord_TRAINOFFER)) && ((Npc_GetTrueGuild(hero) == GIL_SLD) || (Npc_GetTrueGuild(hero) == GIL_SFB) || (Npc_GetTrueGuild(hero) == GIL_ORG) || (Npc_GetTrueGuild(hero) == GIL_KDW) || (Npc_GetTrueGuild(hero) == GIL_DMB) || ( (Npc_GetTrueGuild(hero) == GIL_NONE) && (kapitel >= 4) ) )
{
return 1;
};
};
FUNC VOID DIA_Cord_START_TRAIN_Info()
{
AI_Output (other,self,"DIA_Cord_START_TRAIN_15_00"); //Zacznijmy trening.
AI_Output (self,other,"DIA_Cord_START_TRAIN_01_01"); //Do roboty!
Info_ClearChoices (DIA_Cord_START_TRAIN);
Info_AddChoice (DIA_Cord_START_TRAIN,DIALOG_BACK,DIA_Cord_START_TRAINBACK);
if (Npc_GetTalentSkill(hero, NPC_TALENT_1H) == 0)
{
Info_AddChoice (DIA_Cord_START_TRAIN,"Broń jednoręczna, poziom 1, 100 bryłek rudy, 10 PN",Cord_nauka1h1);
};
if (Npc_GetTalentSkill(hero, NPC_TALENT_1H) == 1)
{
Info_AddChoice (DIA_Cord_START_TRAIN,"Broń jednoręczna, poziom 2, 200 bryłek rudy, 10 PN",Cord_nauka1h2);
};
if (Npc_GetTalentSkill(hero, NPC_TALENT_1H) == 2)
{
Info_AddChoice (DIA_Cord_START_TRAIN,"Broń jednoręczna, poziom 3, 300 bryłek rudy, 10 PN",Cord_nauka1h3);
};
if (Npc_GetTalentSkill(hero, NPC_TALENT_1H) == 3)
{
Info_AddChoice (DIA_Cord_START_TRAIN,"Broń jednoręczna, poziom 4, 400 bryłek rudy, 10 PN",Cord_nauka1h4);
};
if (Npc_GetTalentSkill(hero, NPC_TALENT_1H) == 4)
{
Info_AddChoice (DIA_Cord_START_TRAIN,"Broń jednoręczna, poziom 5, 500 bryłek rudy, 10 PN",Cord_nauka1h5);
};
if (Npc_GetTalentSkill(hero, NPC_TALENT_1H) == 5)
{
Info_AddChoice (DIA_Cord_START_TRAIN,"Broń jednoręczna, poziom 6, 600 bryłek rudy, 10 PN",Cord_nauka1h6);
};
if (Npc_GetTalentSkill(hero, NPC_TALENT_1H) == 6)
{
Info_AddChoice (DIA_Cord_START_TRAIN,"Broń jednoręczna, poziom 7, 1000 bryłek rudy, 10 PN",Cord_nauka1h7);
};
if (Npc_GetTalentSkill(hero, NPC_TALENT_1H) == 7)
{
Info_AddChoice (DIA_Cord_START_TRAIN,"Broń jednoręczna, poziom 8, 1500 bryłek rudy, 10 PN",Cord_nauka1h8);
};
if (Npc_GetTalentSkill(hero, NPC_TALENT_1H) == 8)
{
Info_AddChoice (DIA_Cord_START_TRAIN,"Broń jednoręczna, poziom 9, 2000 bryłek rudy, 10 PN",Cord_nauka1h9);
};
if (Npc_GetTalentSkill(hero, NPC_TALENT_1H) == 9)
{
Info_AddChoice (DIA_Cord_START_TRAIN,"Broń jednoręczna, poziom 10, 2500 bryłek rudy, 10 PN",Cord_nauka1h10);
};
};
func void DIA_Cord_START_TRAINBACK ()
{
Info_ClearChoices (DIA_Cord_START_TRAIN);
var int ilosc;
ilosc = Npc_hasitems (self, itminugget);
Npc_RemoveInvItems (self, itminugget, ilosc);
};
FUNC VOID Cord_nauka1h1 ()
{
AI_Output (other,self,"DIA_Cord_TRAIN_1h_15_00"); //Chciałbym nauczyć się walki jednoręcznym orężem.
if (Npc_HasItems(other,itminugget) >= 100)
{
if (B_GiveSkill(other, NPC_TALENT_1H, 1, 10))
{
AI_Output (self,other,"DIA_Cord_TRAIN_1h_npc_01"); //Mądra decyzja. Najbliższe trzy lekcje obejmą podstawy z którymi powinieneś się zapoznać.
AI_Output (self,other,"DIA_Cord_TRAIN_1h_npc_02"); //Bronie jednoręczne są znacznie lżejsze niż dwuręczne, a przez to również znacznie szybsze.
AI_Output (self,other,"DIA_Cord_TRAIN_1h_npc_03"); //Istnieje podział na lekkie bronie jednoręczne i te cięższe. Cięższe wymagają pewniejszego chwytu, ale też więcej siły.
AI_Output (self,other,"DIA_Cord_TRAIN_1h_npc_04"); //Jeśli chcesz płynnie walczyć ciężką jednoręczną, poza techniką będziesz też musiał poznać tajniki balansowania ciałem.
AI_Output (self,other,"DIA_Cord_TRAIN_1h_npc_05"); //O dużej sile w łapie już nawet nie mówię. To oczywiste, że żeby szybko wymachiwać takim ciężarem będziesz musiał posiadać więcej siły niż potrzeba do podniesienia dobrego dwuręcznego miecza.
B_GiveInvItems(other,self,itminugget,100);
};
}
else
{
AI_Output (self, other,"KDF_402_Corristo_HEAVYARMOR_Info_14_03"); //Nie masz wystarczającej ilości rudy!
};
Info_ClearChoices (DIA_Cord_START_TRAIN);
Info_AddChoice (DIA_Cord_START_TRAIN,DIALOG_BACK,DIA_Cord_START_TRAINBACK);
if (Npc_GetTalentSkill(hero, NPC_TALENT_1H) == 0)
{
Info_AddChoice (DIA_Cord_START_TRAIN,"Broń jednoręczna, poziom 1, 100 bryłek rudy, 10 PN",Cord_nauka1h1);
};
if (Npc_GetTalentSkill(hero, NPC_TALENT_1H) == 1)
{
Info_AddChoice (DIA_Cord_START_TRAIN,"Broń jednoręczna, poziom 2, 200 bryłek rudy, 10 PN",Cord_nauka1h2);
};
if (Npc_GetTalentSkill(hero, NPC_TALENT_1H) == 2)
{
Info_AddChoice (DIA_Cord_START_TRAIN,"Broń jednoręczna, poziom 3, 300 bryłek rudy, 10 PN",Cord_nauka1h3);
};
if (Npc_GetTalentSkill(hero, NPC_TALENT_1H) == 3)
{
Info_AddChoice (DIA_Cord_START_TRAIN,"Broń jednoręczna, poziom 4, 400 bryłek rudy, 10 PN",Cord_nauka1h4);
};
if (Npc_GetTalentSkill(hero, NPC_TALENT_1H) == 4)
{
Info_AddChoice (DIA_Cord_START_TRAIN,"Broń jednoręczna, poziom 5, 500 bryłek rudy, 10 PN",Cord_nauka1h5);
};
if (Npc_GetTalentSkill(hero, NPC_TALENT_1H) == 5)
{
Info_AddChoice (DIA_Cord_START_TRAIN,"Broń jednoręczna, poziom 6, 600 bryłek rudy, 10 PN",Cord_nauka1h6);
};
if (Npc_GetTalentSkill(hero, NPC_TALENT_1H) == 6)
{
Info_AddChoice (DIA_Cord_START_TRAIN,"Broń jednoręczna, poziom 7, 1000 bryłek rudy, 10 PN",Cord_nauka1h7);
};
if (Npc_GetTalentSkill(hero, NPC_TALENT_1H) == 7)
{
Info_AddChoice (DIA_Cord_START_TRAIN,"Broń jednoręczna, poziom 8, 1500 bryłek rudy, 10 PN",Cord_nauka1h8);
};
if (Npc_GetTalentSkill(hero, NPC_TALENT_1H) == 8)
{
Info_AddChoice (DIA_Cord_START_TRAIN,"Broń jednoręczna, poziom 9, 2000 bryłek rudy, 10 PN",Cord_nauka1h9);
};
if (Npc_GetTalentSkill(hero, NPC_TALENT_1H) == 9)
{
Info_AddChoice (DIA_Cord_START_TRAIN,"Broń jednoręczna, poziom 10, 2500 bryłek rudy, 10 PN",Cord_nauka1h10);
};
};
FUNC VOID Cord_nauka1h2 ()
{
AI_Output (other, self,"SLD_709_Cord_TRAINAGAIN_Info_15_01"); //Naucz mnie, jak sprawniej posługiwać się jednoręczną bronią.
if (Npc_HasItems(other,itminugget) >= 200)
{
if (B_GiveSkill(other, NPC_TALENT_1H, 2, 10))
{
AI_Output (self,other,"DIA_Cord_TRAIN_1h_npc_06"); //Pokaż mi jak trzymasz miecz.
AI_DrawWeapon (other);
AI_Output (self,other,"DIA_Cord_TRAIN_1h_npc_07"); //Tak jak myślałem. Zadajesz mniejsze obrażenia niż faktycznie mógłbyś zadać przy obecnej sile i założonej broni.
AI_RemoveWeapon (other);
AI_Output (self,other,"DIA_Cord_TRAIN_1h_npc_08"); //Nie atakuj, gdy jesteś zbyt daleko. Jeśli za bardzo się wychylisz do oddalonego przeciwnika, możesz stracić równowagę i się przewrócić.
AI_Output (self,other,"DIA_Cord_TRAIN_1h_npc_09"); //Staraj się atakować z różnych stron, aby zmylić przeciwnika. Pamiętaj, aby blokować uderzenia, jeśli nie będziesz w stanie zrobić uniku.
B_GiveInvItems(other,self,itminugget,200);
};
}
else
{
AI_Output (self, other,"KDF_402_Corristo_HEAVYARMOR_Info_14_03"); //Nie masz wystarczającej ilości rudy!
};
Info_ClearChoices (DIA_Cord_START_TRAIN);
Info_AddChoice (DIA_Cord_START_TRAIN,DIALOG_BACK,DIA_Cord_START_TRAINBACK);
if (Npc_GetTalentSkill(hero, NPC_TALENT_1H) == 0)
{
Info_AddChoice (DIA_Cord_START_TRAIN,"Broń jednoręczna, poziom 1, 100 bryłek rudy, 10 PN",Cord_nauka1h1);
};
if (Npc_GetTalentSkill(hero, NPC_TALENT_1H) == 1)
{
Info_AddChoice (DIA_Cord_START_TRAIN,"Broń jednoręczna, poziom 2, 200 bryłek rudy, 10 PN",Cord_nauka1h2);
};
if (Npc_GetTalentSkill(hero, NPC_TALENT_1H) == 2)
{
Info_AddChoice (DIA_Cord_START_TRAIN,"Broń jednoręczna, poziom 3, 300 bryłek rudy, 10 PN",Cord_nauka1h3);
};
if (Npc_GetTalentSkill(hero, NPC_TALENT_1H) == 3)
{
Info_AddChoice (DIA_Cord_START_TRAIN,"Broń jednoręczna, poziom 4, 400 bryłek rudy, 10 PN",Cord_nauka1h4);
};
if (Npc_GetTalentSkill(hero, NPC_TALENT_1H) == 4)
{
Info_AddChoice (DIA_Cord_START_TRAIN,"Broń jednoręczna, poziom 5, 500 bryłek rudy, 10 PN",Cord_nauka1h5);
};
if (Npc_GetTalentSkill(hero, NPC_TALENT_1H) == 5)
{
Info_AddChoice (DIA_Cord_START_TRAIN,"Broń jednoręczna, poziom 6, 600 bryłek rudy, 10 PN",Cord_nauka1h6);
};
if (Npc_GetTalentSkill(hero, NPC_TALENT_1H) == 6)
{
Info_AddChoice (DIA_Cord_START_TRAIN,"Broń jednoręczna, poziom 7, 1000 bryłek rudy, 10 PN",Cord_nauka1h7);
};
if (Npc_GetTalentSkill(hero, NPC_TALENT_1H) == 7)
{
Info_AddChoice (DIA_Cord_START_TRAIN,"Broń jednoręczna, poziom 8, 1500 bryłek rudy, 10 PN",Cord_nauka1h8);
};
if (Npc_GetTalentSkill(hero, NPC_TALENT_1H) == 8)
{
Info_AddChoice (DIA_Cord_START_TRAIN,"Broń jednoręczna, poziom 9, 2000 bryłek rudy, 10 PN",Cord_nauka1h9);
};
if (Npc_GetTalentSkill(hero, NPC_TALENT_1H) == 9)
{
Info_AddChoice (DIA_Cord_START_TRAIN,"Broń jednoręczna, poziom 10, 2500 bryłek rudy, 10 PN",Cord_nauka1h10);
};
};
FUNC VOID Cord_nauka1h3 ()
{
AI_Output (other, self,"SLD_709_Cord_TRAINAGAIN_Info_15_01"); //Naucz mnie, jak sprawniej posługiwać się jednoręczną bronią.
if (Npc_HasItems(other,itminugget) >= 300)
{
if (B_GiveSkill(other, NPC_TALENT_1H, 3, 10))
{
AI_Output (self,other,"DIA_Cord_TRAIN_1h_npc_10"); //Pamiętasz o balansowaniu ciałem? A o odpowiedniej odległości od przeciwnika?
AI_Output (self,other,"DIA_Cord_TRAIN_1h_npc_11"); //Spróbuj wyczuć ile siły musisz użyć, aby broń uderzała mocno, a przy tym nie poleciała bezładnie przed siebie.
AI_Output (self,other,"DIA_Cord_TRAIN_1h_npc_12"); //Gdy to opanujesz, będziemy mogli pomyśleć nad łączeniem po sobie uderzeń.
AI_Output (self,other,"DIA_Cord_TRAIN_1h_npc_13"); //Pokaż mi jeszcze jak wyciągasz broń. Robisz jakieś postępy?
AI_DrawWeapon (other);
AI_Output (self,other,"DIA_Cord_TRAIN_1h_npc_14"); //Ręce opadają... Nie dwiema, tylko jedną! Omówimy to na następnej lekcji.
AI_RemoveWeapon (other);
B_GiveInvItems(other,self,itminugget,300);
};
}
else
{
AI_Output (self, other,"KDF_402_Corristo_HEAVYARMOR_Info_14_03"); //Nie masz wystarczającej ilości rudy!
};
Info_ClearChoices (DIA_Cord_START_TRAIN);
Info_AddChoice (DIA_Cord_START_TRAIN,DIALOG_BACK,DIA_Cord_START_TRAINBACK);
if (Npc_GetTalentSkill(hero, NPC_TALENT_1H) == 0)
{
Info_AddChoice (DIA_Cord_START_TRAIN,"Broń jednoręczna, poziom 1, 100 bryłek rudy, 10 PN",Cord_nauka1h1);
};
if (Npc_GetTalentSkill(hero, NPC_TALENT_1H) == 1)
{
Info_AddChoice (DIA_Cord_START_TRAIN,"Broń jednoręczna, poziom 2, 200 bryłek rudy, 10 PN",Cord_nauka1h2);
};
if (Npc_GetTalentSkill(hero, NPC_TALENT_1H) == 2)
{
Info_AddChoice (DIA_Cord_START_TRAIN,"Broń jednoręczna, poziom 3, 300 bryłek rudy, 10 PN",Cord_nauka1h3);
};
if (Npc_GetTalentSkill(hero, NPC_TALENT_1H) == 3)
{
Info_AddChoice (DIA_Cord_START_TRAIN,"Broń jednoręczna, poziom 4, 400 bryłek rudy, 10 PN",Cord_nauka1h4);
};
if (Npc_GetTalentSkill(hero, NPC_TALENT_1H) == 4)
{
Info_AddChoice (DIA_Cord_START_TRAIN,"Broń jednoręczna, poziom 5, 500 bryłek rudy, 10 PN",Cord_nauka1h5);
};
if (Npc_GetTalentSkill(hero, NPC_TALENT_1H) == 5)
{
Info_AddChoice (DIA_Cord_START_TRAIN,"Broń jednoręczna, poziom 6, 600 bryłek rudy, 10 PN",Cord_nauka1h6);
};
if (Npc_GetTalentSkill(hero, NPC_TALENT_1H) == 6)
{
Info_AddChoice (DIA_Cord_START_TRAIN,"Broń jednoręczna, poziom 7, 1000 bryłek rudy, 10 PN",Cord_nauka1h7);
};
if (Npc_GetTalentSkill(hero, NPC_TALENT_1H) == 7)
{
Info_AddChoice (DIA_Cord_START_TRAIN,"Broń jednoręczna, poziom 8, 1500 bryłek rudy, 10 PN",Cord_nauka1h8);
};
if (Npc_GetTalentSkill(hero, NPC_TALENT_1H) == 8)
{
Info_AddChoice (DIA_Cord_START_TRAIN,"Broń jednoręczna, poziom 9, 2000 bryłek rudy, 10 PN",Cord_nauka1h9);
};
if (Npc_GetTalentSkill(hero, NPC_TALENT_1H) == 9)
{
Info_AddChoice (DIA_Cord_START_TRAIN,"Broń jednoręczna, poziom 10, 2500 bryłek rudy, 10 PN",Cord_nauka1h10);
};
};
FUNC VOID Cord_nauka1h4 ()
{
AI_Output (other, self,"SLD_709_Cord_TRAINAGAIN_Info_15_01"); //Naucz mnie, jak sprawniej posługiwać się jednoręczną bronią.
if (Npc_HasItems(other,itminugget) >= 400)
{
if (B_GiveSkill(other, NPC_TALENT_1H, 4, 10))
{
AI_Output (self,other,"SLD_709_Cord_TRAIN_14_02"); //Początkujący często łapią zwykły miecz obydwoma rękami. Radziłbym ci się do tego nie przyzwyczajać, to fatalny nawyk.
AI_Output (self,other,"SLD_709_Cord_TRAIN_14_03"); //Trzymaj broń jedną ręką, ostrzem do góry, i zacznij nią machać.
AI_Output (self,other,"SLD_709_Cord_TRAIN_14_04"); //Musisz się nauczyć, jak zgrać twoje ruchy z bezwładnością oręża. Dzięki temu twoje ataki będą szybsze i bardziej zaskakujące.
AI_Output (self,other,"SLD_709_Cord_TRAIN_14_05"); //Zapamiętaj sobie dobrze, co ci powiedziałem, a twój styl walki stanie się o wiele bardziej elegancki i skuteczny.
B_PracticeCombat ("NC_WATERFALL_TOP01");
AI_Output (self,other,"SLD_709_Cord_TRAIN_14_06"); //A, i jeszcze coś! Niektóre ciosy powodują większe obrażenia niż zwykle. Oczywiście, jako początkujący masz raczej niewielkie szanse na zadanie krytycznego uderzenia.
AI_Output (self,other,"SLD_709_Cord_TRAIN_14_07"); //Ale to się zmieni w miarę czynienia przez ciebie postępów.
B_GiveInvItems(other,self,itminugget,400);
};
}
else
{
AI_Output (self, other,"KDF_402_Corristo_HEAVYARMOR_Info_14_03"); //Nie masz wystarczającej ilości rudy!
};
Info_ClearChoices (DIA_Cord_START_TRAIN);
Info_AddChoice (DIA_Cord_START_TRAIN,DIALOG_BACK,DIA_Cord_START_TRAINBACK);
if (Npc_GetTalentSkill(hero, NPC_TALENT_1H) == 0)
{
Info_AddChoice (DIA_Cord_START_TRAIN,"Broń jednoręczna, poziom 1, 100 bryłek rudy, 10 PN",Cord_nauka1h1);
};
if (Npc_GetTalentSkill(hero, NPC_TALENT_1H) == 1)
{
Info_AddChoice (DIA_Cord_START_TRAIN,"Broń jednoręczna, poziom 2, 200 bryłek rudy, 10 PN",Cord_nauka1h2);
};
if (Npc_GetTalentSkill(hero, NPC_TALENT_1H) == 2)
{
Info_AddChoice (DIA_Cord_START_TRAIN,"Broń jednoręczna, poziom 3, 300 bryłek rudy, 10 PN",Cord_nauka1h3);
};
if (Npc_GetTalentSkill(hero, NPC_TALENT_1H) == 3)
{
Info_AddChoice (DIA_Cord_START_TRAIN,"Broń jednoręczna, poziom 4, 400 bryłek rudy, 10 PN",Cord_nauka1h4);
};
if (Npc_GetTalentSkill(hero, NPC_TALENT_1H) == 4)
{
Info_AddChoice (DIA_Cord_START_TRAIN,"Broń jednoręczna, poziom 5, 500 bryłek rudy, 10 PN",Cord_nauka1h5);
};
if (Npc_GetTalentSkill(hero, NPC_TALENT_1H) == 5)
{
Info_AddChoice (DIA_Cord_START_TRAIN,"Broń jednoręczna, poziom 6, 600 bryłek rudy, 10 PN",Cord_nauka1h6);
};
if (Npc_GetTalentSkill(hero, NPC_TALENT_1H) == 6)
{
Info_AddChoice (DIA_Cord_START_TRAIN,"Broń jednoręczna, poziom 7, 1000 bryłek rudy, 10 PN",Cord_nauka1h7);
};
if (Npc_GetTalentSkill(hero, NPC_TALENT_1H) == 7)
{
Info_AddChoice (DIA_Cord_START_TRAIN,"Broń jednoręczna, poziom 8, 1500 bryłek rudy, 10 PN",Cord_nauka1h8);
};
if (Npc_GetTalentSkill(hero, NPC_TALENT_1H) == 8)
{
Info_AddChoice (DIA_Cord_START_TRAIN,"Broń jednoręczna, poziom 9, 2000 bryłek rudy, 10 PN",Cord_nauka1h9);
};
if (Npc_GetTalentSkill(hero, NPC_TALENT_1H) == 9)
{
Info_AddChoice (DIA_Cord_START_TRAIN,"Broń jednoręczna, poziom 10, 2500 bryłek rudy, 10 PN",Cord_nauka1h10);
};
};
FUNC VOID Cord_nauka1h5 ()
{
AI_Output (other, self,"SLD_709_Cord_TRAINAGAIN_Info_15_01"); //Naucz mnie, jak sprawniej posługiwać się jednoręczną bronią.
if (Npc_HasItems(other,itminugget) >= 500)
{
if (B_GiveSkill(other, NPC_TALENT_1H, 5, 10))
{
AI_Output (self,other,"DIA_Cord_TRAIN_1h_npc_15"); //Żeby zadać większe obrażenia musisz trafiać w newralgiczne punkty twojego przeciwnika.
AI_Output (self,other,"DIA_Cord_TRAIN_1h_npc_16"); //Ciężko się tego nauczyć. Wszystko zależy od postury i pancerza. Najlepiej atakować kończyny i głowę.
AI_Output (self,other,"DIA_Cord_TRAIN_1h_npc_17"); //Naturalnie walka z człowiekiem różni się od walki ze zwierzęciem.
B_GiveInvItems(other,self,itminugget,500);
};
}
else
{
AI_Output (self, other,"KDF_402_Corristo_HEAVYARMOR_Info_14_03"); //Nie masz wystarczającej ilości rudy!
};
Info_ClearChoices (DIA_Cord_START_TRAIN);
Info_AddChoice (DIA_Cord_START_TRAIN,DIALOG_BACK,DIA_Cord_START_TRAINBACK);
if (Npc_GetTalentSkill(hero, NPC_TALENT_1H) == 0)
{
Info_AddChoice (DIA_Cord_START_TRAIN,"Broń jednoręczna, poziom 1, 100 bryłek rudy, 10 PN",Cord_nauka1h1);
};
if (Npc_GetTalentSkill(hero, NPC_TALENT_1H) == 1)
{
Info_AddChoice (DIA_Cord_START_TRAIN,"Broń jednoręczna, poziom 2, 200 bryłek rudy, 10 PN",Cord_nauka1h2);
};
if (Npc_GetTalentSkill(hero, NPC_TALENT_1H) == 2)
{
Info_AddChoice (DIA_Cord_START_TRAIN,"Broń jednoręczna, poziom 3, 300 bryłek rudy, 10 PN",Cord_nauka1h3);
};
if (Npc_GetTalentSkill(hero, NPC_TALENT_1H) == 3)
{
Info_AddChoice (DIA_Cord_START_TRAIN,"Broń jednoręczna, poziom 4, 400 bryłek rudy, 10 PN",Cord_nauka1h4);
};
if (Npc_GetTalentSkill(hero, NPC_TALENT_1H) == 4)
{
Info_AddChoice (DIA_Cord_START_TRAIN,"Broń jednoręczna, poziom 5, 500 bryłek rudy, 10 PN",Cord_nauka1h5);
};
if (Npc_GetTalentSkill(hero, NPC_TALENT_1H) == 5)
{
Info_AddChoice (DIA_Cord_START_TRAIN,"Broń jednoręczna, poziom 6, 600 bryłek rudy, 10 PN",Cord_nauka1h6);
};
if (Npc_GetTalentSkill(hero, NPC_TALENT_1H) == 6)
{
Info_AddChoice (DIA_Cord_START_TRAIN,"Broń jednoręczna, poziom 7, 1000 bryłek rudy, 10 PN",Cord_nauka1h7);
};
if (Npc_GetTalentSkill(hero, NPC_TALENT_1H) == 7)
{
Info_AddChoice (DIA_Cord_START_TRAIN,"Broń jednoręczna, poziom 8, 1500 bryłek rudy, 10 PN",Cord_nauka1h8);
};
if (Npc_GetTalentSkill(hero, NPC_TALENT_1H) == 8)
{
Info_AddChoice (DIA_Cord_START_TRAIN,"Broń jednoręczna, poziom 9, 2000 bryłek rudy, 10 PN",Cord_nauka1h9);
};
if (Npc_GetTalentSkill(hero, NPC_TALENT_1H) == 9)
{
Info_AddChoice (DIA_Cord_START_TRAIN,"Broń jednoręczna, poziom 10, 2500 bryłek rudy, 10 PN",Cord_nauka1h10);
};
};
FUNC VOID Cord_nauka1h6 ()
{
AI_Output (other, self,"SLD_709_Cord_TRAINAGAIN_Info_15_01"); //Naucz mnie, jak sprawniej posługiwać się jednoręczną bronią.
if (Npc_HasItems(other,itminugget) >= 600)
{
if (B_GiveSkill(other, NPC_TALENT_1H, 6, 10))
{
AI_Output (self,other,"DIA_Cord_TRAIN_1h_npc_18"); //Pamiętasz jak na pierwszej lekcji omawialiśmy podział na bronie ciężkie i te lżejsze?
AI_Output (self,other,"DIA_Cord_TRAIN_1h_npc_19"); //Myślę, że jesteś już wystarczająco silny, aby walczyć ciężkimi jednoręczniakami.
AI_Output (self,other,"DIA_Cord_TRAIN_1h_npc_20"); //O czym musisz pamiętać? O odpowiednim wyczuciu równowagi ostrza, a także o treningu siłowym, który jest tutaj kluczowy.
B_GiveInvItems(other,self,itminugget,600);
};
}
else
{
AI_Output (self, other,"KDF_402_Corristo_HEAVYARMOR_Info_14_03"); //Nie masz wystarczającej ilości rudy!
};
Info_ClearChoices (DIA_Cord_START_TRAIN);
Info_AddChoice (DIA_Cord_START_TRAIN,DIALOG_BACK,DIA_Cord_START_TRAINBACK);
if (Npc_GetTalentSkill(hero, NPC_TALENT_1H) == 0)
{
Info_AddChoice (DIA_Cord_START_TRAIN,"Broń jednoręczna, poziom 1, 100 bryłek rudy, 10 PN",Cord_nauka1h1);
};
if (Npc_GetTalentSkill(hero, NPC_TALENT_1H) == 1)
{
Info_AddChoice (DIA_Cord_START_TRAIN,"Broń jednoręczna, poziom 2, 200 bryłek rudy, 10 PN",Cord_nauka1h2);
};
if (Npc_GetTalentSkill(hero, NPC_TALENT_1H) == 2)
{
Info_AddChoice (DIA_Cord_START_TRAIN,"Broń jednoręczna, poziom 3, 300 bryłek rudy, 10 PN",Cord_nauka1h3);
};
if (Npc_GetTalentSkill(hero, NPC_TALENT_1H) == 3)
{
Info_AddChoice (DIA_Cord_START_TRAIN,"Broń jednoręczna, poziom 4, 400 bryłek rudy, 10 PN",Cord_nauka1h4);
};
if (Npc_GetTalentSkill(hero, NPC_TALENT_1H) == 4)
{
Info_AddChoice (DIA_Cord_START_TRAIN,"Broń jednoręczna, poziom 5, 500 bryłek rudy, 10 PN",Cord_nauka1h5);
};
if (Npc_GetTalentSkill(hero, NPC_TALENT_1H) == 5)
{
Info_AddChoice (DIA_Cord_START_TRAIN,"Broń jednoręczna, poziom 6, 600 bryłek rudy, 10 PN",Cord_nauka1h6);
};
if (Npc_GetTalentSkill(hero, NPC_TALENT_1H) == 6)
{
Info_AddChoice (DIA_Cord_START_TRAIN,"Broń jednoręczna, poziom 7, 1000 bryłek rudy, 10 PN",Cord_nauka1h7);
};
if (Npc_GetTalentSkill(hero, NPC_TALENT_1H) == 7)
{
Info_AddChoice (DIA_Cord_START_TRAIN,"Broń jednoręczna, poziom 8, 1500 bryłek rudy, 10 PN",Cord_nauka1h8);
};
if (Npc_GetTalentSkill(hero, NPC_TALENT_1H) == 8)
{
Info_AddChoice (DIA_Cord_START_TRAIN,"Broń jednoręczna, poziom 9, 2000 bryłek rudy, 10 PN",Cord_nauka1h9);
};
if (Npc_GetTalentSkill(hero, NPC_TALENT_1H) == 9)
{
Info_AddChoice (DIA_Cord_START_TRAIN,"Broń jednoręczna, poziom 10, 2500 bryłek rudy, 10 PN",Cord_nauka1h10);
};
};
FUNC VOID Cord_nauka1h7 ()
{
AI_Output (other, self,"SLD_709_Cord_TRAINAGAIN_Info_15_01"); //Naucz mnie, jak sprawniej posługiwać się jednoręczną bronią.
if (Npc_HasItems(other,itminugget) >= 1000)
{
if (B_GiveSkill(other, NPC_TALENT_1H, 7, 10))
{
AI_Output (self, other,"DIA_Cord_TRAIN_2h_Info_01_03"); //Musisz wykorzystać siłę bezwładności, pamiętasz? Świetnie. Teraz nauczysz się lepiej balansować ciałem. Po zadaniu dwóch ciosów wykonaj obrót. To powinno zmylić twojego przeciwnika i pozwolić ci wyjść na dobrą pozycję do następnego ataku.
AI_Output (self, other,"DIA_Cord_TRAIN_2h_Info_01_04"); //Wtedy wyprowadź następne cięcie z prawej strony...
AI_Output (self, other,"DIA_Cord_TRAIN_2h_Info_01_05"); //I znowu do przodu. Pamiętaj - trening czyni mistrza, więc najlepiej weź się od razu do roboty!
B_GiveInvItems(other,self,itminugget,1000);
};
}
else
{
AI_Output (self, other,"KDF_402_Corristo_HEAVYARMOR_Info_14_03"); //Nie masz wystarczającej ilości rudy!
};
Info_ClearChoices (DIA_Cord_START_TRAIN);
Info_AddChoice (DIA_Cord_START_TRAIN,DIALOG_BACK,DIA_Cord_START_TRAINBACK);
if (Npc_GetTalentSkill(hero, NPC_TALENT_1H) == 0)
{
Info_AddChoice (DIA_Cord_START_TRAIN,"Broń jednoręczna, poziom 1, 100 bryłek rudy, 10 PN",Cord_nauka1h1);
};
if (Npc_GetTalentSkill(hero, NPC_TALENT_1H) == 1)
{
Info_AddChoice (DIA_Cord_START_TRAIN,"Broń jednoręczna, poziom 2, 200 bryłek rudy, 10 PN",Cord_nauka1h2);
};
if (Npc_GetTalentSkill(hero, NPC_TALENT_1H) == 2)
{
Info_AddChoice (DIA_Cord_START_TRAIN,"Broń jednoręczna, poziom 3, 300 bryłek rudy, 10 PN",Cord_nauka1h3);
};
if (Npc_GetTalentSkill(hero, NPC_TALENT_1H) == 3)
{
Info_AddChoice (DIA_Cord_START_TRAIN,"Broń jednoręczna, poziom 4, 400 bryłek rudy, 10 PN",Cord_nauka1h4);
};
if (Npc_GetTalentSkill(hero, NPC_TALENT_1H) == 4)
{
Info_AddChoice (DIA_Cord_START_TRAIN,"Broń jednoręczna, poziom 5, 500 bryłek rudy, 10 PN",Cord_nauka1h5);
};
if (Npc_GetTalentSkill(hero, NPC_TALENT_1H) == 5)
{
Info_AddChoice (DIA_Cord_START_TRAIN,"Broń jednoręczna, poziom 6, 600 bryłek rudy, 10 PN",Cord_nauka1h6);
};
if (Npc_GetTalentSkill(hero, NPC_TALENT_1H) == 6)
{
Info_AddChoice (DIA_Cord_START_TRAIN,"Broń jednoręczna, poziom 7, 1000 bryłek rudy, 10 PN",Cord_nauka1h7);
};
if (Npc_GetTalentSkill(hero, NPC_TALENT_1H) == 7)
{
Info_AddChoice (DIA_Cord_START_TRAIN,"Broń jednoręczna, poziom 8, 1500 bryłek rudy, 10 PN",Cord_nauka1h8);
};
if (Npc_GetTalentSkill(hero, NPC_TALENT_1H) == 8)
{
Info_AddChoice (DIA_Cord_START_TRAIN,"Broń jednoręczna, poziom 9, 2000 bryłek rudy, 10 PN",Cord_nauka1h9);
};
if (Npc_GetTalentSkill(hero, NPC_TALENT_1H) == 9)
{
Info_AddChoice (DIA_Cord_START_TRAIN,"Broń jednoręczna, poziom 10, 2500 bryłek rudy, 10 PN",Cord_nauka1h10);
};
};
FUNC VOID Cord_nauka1h8 ()
{
AI_Output (other, self,"SLD_709_Cord_TRAINAGAIN_Info_15_01"); //Naucz mnie, jak sprawniej posługiwać się jednoręczną bronią.
if (Npc_HasItems(other,itminugget) >= 1500)
{
if (B_GiveSkill(other, NPC_TALENT_1H, 8, 10))
{
AI_Output (self,other,"DIA_Cord_TRAIN_1h_npc_21"); //Robisz postępy. Skup się na kolejnych ciosach. Łącz je coraz szybciej i pewniej.
B_GiveInvItems(other,self,itminugget,1500);
};
}
else
{
AI_Output (self, other,"KDF_402_Corristo_HEAVYARMOR_Info_14_03"); //Nie masz wystarczającej ilości rudy!
};
Info_ClearChoices (DIA_Cord_START_TRAIN);
Info_AddChoice (DIA_Cord_START_TRAIN,DIALOG_BACK,DIA_Cord_START_TRAINBACK);
if (Npc_GetTalentSkill(hero, NPC_TALENT_1H) == 0)
{
Info_AddChoice (DIA_Cord_START_TRAIN,"Broń jednoręczna, poziom 1, 100 bryłek rudy, 10 PN",Cord_nauka1h1);
};
if (Npc_GetTalentSkill(hero, NPC_TALENT_1H) == 1)
{
Info_AddChoice (DIA_Cord_START_TRAIN,"Broń jednoręczna, poziom 2, 200 bryłek rudy, 10 PN",Cord_nauka1h2);
};
if (Npc_GetTalentSkill(hero, NPC_TALENT_1H) == 2)
{
Info_AddChoice (DIA_Cord_START_TRAIN,"Broń jednoręczna, poziom 3, 300 bryłek rudy, 10 PN",Cord_nauka1h3);
};
if (Npc_GetTalentSkill(hero, NPC_TALENT_1H) == 3)
{
Info_AddChoice (DIA_Cord_START_TRAIN,"Broń jednoręczna, poziom 4, 400 bryłek rudy, 10 PN",Cord_nauka1h4);
};
if (Npc_GetTalentSkill(hero, NPC_TALENT_1H) == 4)
{
Info_AddChoice (DIA_Cord_START_TRAIN,"Broń jednoręczna, poziom 5, 500 bryłek rudy, 10 PN",Cord_nauka1h5);
};
if (Npc_GetTalentSkill(hero, NPC_TALENT_1H) == 5)
{
Info_AddChoice (DIA_Cord_START_TRAIN,"Broń jednoręczna, poziom 6, 600 bryłek rudy, 10 PN",Cord_nauka1h6);
};
if (Npc_GetTalentSkill(hero, NPC_TALENT_1H) == 6)
{
Info_AddChoice (DIA_Cord_START_TRAIN,"Broń jednoręczna, poziom 7, 1000 bryłek rudy, 10 PN",Cord_nauka1h7);
};
if (Npc_GetTalentSkill(hero, NPC_TALENT_1H) == 7)
{
Info_AddChoice (DIA_Cord_START_TRAIN,"Broń jednoręczna, poziom 8, 1500 bryłek rudy, 10 PN",Cord_nauka1h8);
};
if (Npc_GetTalentSkill(hero, NPC_TALENT_1H) == 8)
{
Info_AddChoice (DIA_Cord_START_TRAIN,"Broń jednoręczna, poziom 9, 2000 bryłek rudy, 10 PN",Cord_nauka1h9);
};
if (Npc_GetTalentSkill(hero, NPC_TALENT_1H) == 9)
{
Info_AddChoice (DIA_Cord_START_TRAIN,"Broń jednoręczna, poziom 10, 2500 bryłek rudy, 10 PN",Cord_nauka1h10);
};
};
FUNC VOID Cord_nauka1h9 ()
{
AI_Output (other, self,"SLD_709_Cord_TRAINAGAIN_Info_15_01"); //Naucz mnie, jak sprawniej posługiwać się jednoręczną bronią.
if (Npc_HasItems(other,itminugget) >= 2000)
{
if (B_GiveSkill(other, NPC_TALENT_1H, 9, 10))
{
AI_Output (self,other,"DIA_Cord_TRAIN_1h_npc_22"); //Chcąc najboleśniej zranić przeciwnika musisz dobrze wymierzyć cios. Gdy masz szansę staraj się trafiać w głowę lub barki.
AI_Output (self,other,"DIA_Cord_TRAIN_1h_npc_23"); //Słabe punkty to także łącznia zbroi. Jeśli przeciwnik ma na sobie skórzaną zbroję to po prostu bij w brzuch.
AI_Output (self,other,"DIA_Cord_TRAIN_1h_npc_24"); //Skórzane pancerze łatwo się rozcina.
AI_Output (self,other,"DIA_Cord_TRAIN_1h_npc_25"); //Przypomnij sobie jeszcze raz to wszystko, czego cię nauczyłem i stosuj się do tego.
B_GiveInvItems(other,self,itminugget,2000);
};
}
else
{
AI_Output (self, other,"KDF_402_Corristo_HEAVYARMOR_Info_14_03"); //Nie masz wystarczającej ilości rudy!
};
Info_ClearChoices (DIA_Cord_START_TRAIN);
Info_AddChoice (DIA_Cord_START_TRAIN,DIALOG_BACK,DIA_Cord_START_TRAINBACK);
if (Npc_GetTalentSkill(hero, NPC_TALENT_1H) == 0)
{
Info_AddChoice (DIA_Cord_START_TRAIN,"Broń jednoręczna, poziom 1, 100 bryłek rudy, 10 PN",Cord_nauka1h1);
};
if (Npc_GetTalentSkill(hero, NPC_TALENT_1H) == 1)
{
Info_AddChoice (DIA_Cord_START_TRAIN,"Broń jednoręczna, poziom 2, 200 bryłek rudy, 10 PN",Cord_nauka1h2);
};
if (Npc_GetTalentSkill(hero, NPC_TALENT_1H) == 2)
{
Info_AddChoice (DIA_Cord_START_TRAIN,"Broń jednoręczna, poziom 3, 300 bryłek rudy, 10 PN",Cord_nauka1h3);
};
if (Npc_GetTalentSkill(hero, NPC_TALENT_1H) == 3)
{
Info_AddChoice (DIA_Cord_START_TRAIN,"Broń jednoręczna, poziom 4, 400 bryłek rudy, 10 PN",Cord_nauka1h4);
};
if (Npc_GetTalentSkill(hero, NPC_TALENT_1H) == 4)
{
Info_AddChoice (DIA_Cord_START_TRAIN,"Broń jednoręczna, poziom 5, 500 bryłek rudy, 10 PN",Cord_nauka1h5);
};
if (Npc_GetTalentSkill(hero, NPC_TALENT_1H) == 5)
{
Info_AddChoice (DIA_Cord_START_TRAIN,"Broń jednoręczna, poziom 6, 600 bryłek rudy, 10 PN",Cord_nauka1h6);
};
if (Npc_GetTalentSkill(hero, NPC_TALENT_1H) == 6)
{
Info_AddChoice (DIA_Cord_START_TRAIN,"Broń jednoręczna, poziom 7, 1000 bryłek rudy, 10 PN",Cord_nauka1h7);
};
if (Npc_GetTalentSkill(hero, NPC_TALENT_1H) == 7)
{
Info_AddChoice (DIA_Cord_START_TRAIN,"Broń jednoręczna, poziom 8, 1500 bryłek rudy, 10 PN",Cord_nauka1h8);
};
if (Npc_GetTalentSkill(hero, NPC_TALENT_1H) == 8)
{
Info_AddChoice (DIA_Cord_START_TRAIN,"Broń jednoręczna, poziom 9, 2000 bryłek rudy, 10 PN",Cord_nauka1h9);
};
if (Npc_GetTalentSkill(hero, NPC_TALENT_1H) == 9)
{
Info_AddChoice (DIA_Cord_START_TRAIN,"Broń jednoręczna, poziom 10, 2500 bryłek rudy, 10 PN",Cord_nauka1h10);
};
};
FUNC VOID Cord_nauka1h10 ()
{
AI_Output (other, self,"SLD_709_Cord_TRAINAGAIN_Info_15_01"); //Naucz mnie, jak sprawniej posługiwać się jednoręczną bronią.
if (Npc_HasItems(other,itminugget) >= 2500)
{
if (B_GiveSkill(other, NPC_TALENT_1H, 10, 10))
{
AI_Output (self,other,"DIA_Cord_TRAIN_1h_npc_26"); //To już koniec naszego szkolenia. Szacunek dla ciebie, że dobrnąłeś do końca.
AI_Output (self,other,"DIA_Cord_TRAIN_1h_npc_27"); //Pokażę ci kilka ruchów, którymi trafisz we wrażliwe punkty twojego wroga.
AI_Output (self,other,"DIA_Cord_TRAIN_1h_npc_28"); //Musisz potrafić je dostrzec zanim się do niego zbliżysz.
B_GiveInvItems(other,self,itminugget,2500);
};
}
else
{
AI_Output (self, other,"KDF_402_Corristo_HEAVYARMOR_Info_14_03"); //Nie masz wystarczającej ilości rudy!
};
Info_ClearChoices (DIA_Cord_START_TRAIN);
Info_AddChoice (DIA_Cord_START_TRAIN,DIALOG_BACK,DIA_Cord_START_TRAINBACK);
if (Npc_GetTalentSkill(hero, NPC_TALENT_1H) == 0)
{
Info_AddChoice (DIA_Cord_START_TRAIN,"Broń jednoręczna, poziom 1, 100 bryłek rudy, 10 PN",Cord_nauka1h1);
};
if (Npc_GetTalentSkill(hero, NPC_TALENT_1H) == 1)
{
Info_AddChoice (DIA_Cord_START_TRAIN,"Broń jednoręczna, poziom 2, 200 bryłek rudy, 10 PN",Cord_nauka1h2);
};
if (Npc_GetTalentSkill(hero, NPC_TALENT_1H) == 2)
{
Info_AddChoice (DIA_Cord_START_TRAIN,"Broń jednoręczna, poziom 3, 300 bryłek rudy, 10 PN",Cord_nauka1h3);
};
if (Npc_GetTalentSkill(hero, NPC_TALENT_1H) == 3)
{
Info_AddChoice (DIA_Cord_START_TRAIN,"Broń jednoręczna, poziom 4, 400 bryłek rudy, 10 PN",Cord_nauka1h4);
};
if (Npc_GetTalentSkill(hero, NPC_TALENT_1H) == 4)
{
Info_AddChoice (DIA_Cord_START_TRAIN,"Broń jednoręczna, poziom 5, 500 bryłek rudy, 10 PN",Cord_nauka1h5);
};
if (Npc_GetTalentSkill(hero, NPC_TALENT_1H) == 5)
{
Info_AddChoice (DIA_Cord_START_TRAIN,"Broń jednoręczna, poziom 6, 600 bryłek rudy, 10 PN",Cord_nauka1h6);
};
if (Npc_GetTalentSkill(hero, NPC_TALENT_1H) == 6)
{
Info_AddChoice (DIA_Cord_START_TRAIN,"Broń jednoręczna, poziom 7, 1000 bryłek rudy, 10 PN",Cord_nauka1h7);
};
if (Npc_GetTalentSkill(hero, NPC_TALENT_1H) == 7)
{
Info_AddChoice (DIA_Cord_START_TRAIN,"Broń jednoręczna, poziom 8, 1500 bryłek rudy, 10 PN",Cord_nauka1h8);
};
if (Npc_GetTalentSkill(hero, NPC_TALENT_1H) == 8)
{
Info_AddChoice (DIA_Cord_START_TRAIN,"Broń jednoręczna, poziom 9, 2000 bryłek rudy, 10 PN",Cord_nauka1h9);
};
if (Npc_GetTalentSkill(hero, NPC_TALENT_1H) == 9)
{
Info_AddChoice (DIA_Cord_START_TRAIN,"Broń jednoręczna, poziom 10, 2500 bryłek rudy, 10 PN",Cord_nauka1h10);
};
};
/*------------------------------------------------------------------------
EINHANDKAMPF DIE ERSTE LEHRSTUNDE
------------------------------------------------------------------------*/
/*
instance SLD_709_Cord_TRAIN (C_INFO)
{
npc = SLD_709_Cord;
condition = SLD_709_Cord_TRAIN_Condition;
information = SLD_709_Cord_TRAIN_Info;
important = 0;
permanent = 1;
description = B_BuildLearnString(NAME_Learn1h_1, LPCOST_TALENT_1H_1,30);
};
FUNC int SLD_709_Cord_TRAIN_Condition()
{
if (Npc_KnowsInfo (hero,SLD_709_Cord_TRAINOFFER))
&& (Npc_GetTalentSkill (hero,NPC_TALENT_1H) == 0)
{
return TRUE;
};
};
FUNC void SLD_709_Cord_TRAIN_Info()
{
AI_Output (other, self,"SLD_709_Cord_TRAIN_Info_15_00"); //Chciałbym nauczyć się walki jednoręcznym orężem.
if (hero.attribute[ATR_STRENGTH] >= 30)
{
if (Npc_HasItems (hero,ItMiNugget) >= 30)
{
if B_GiveSkill(hero,NPC_TALENT_1H,1,LPCOST_TALENT_1H_1)
{
AI_Output (self,other,"SLD_709_Cord_TRAIN_14_01"); //Mądra decyzja. Jednak zanim poznasz bardziej zaawansowane techniki, powinieneś nauczyć się prawidłowo trzymać oręż w ręku.
AI_Output (self,other,"SLD_709_Cord_TRAIN_14_02"); //Początkujący często łapią zwykły miecz obydwoma rękami. Radziłbym ci się do tego nie przyzwyczajać, to fatalny nawyk.
AI_Output (self,other,"SLD_709_Cord_TRAIN_14_03"); //Trzymaj broń jedną ręką, ostrzem do góry, i zacznij nią machać.
AI_Output (self,other,"SLD_709_Cord_TRAIN_14_04"); //Musisz się nauczyć, jak zgrać twoje ruchy z bezwładnością oręża. Dzięki temu twoje ataki będą szybsze i bardziej zaskakujące.
AI_Output (self,other,"SLD_709_Cord_TRAIN_14_05"); //Zapamiętaj sobie dobrze, co ci powiedziałem, a twój styl walki stanie się o wiele bardziej elegancki i skuteczny.
B_PracticeCombat ("NC_WATERFALL_TOP01");
AI_Output (self,other,"SLD_709_Cord_TRAIN_14_06"); //A, i jeszcze coś! Niektóre ciosy powodują większe obrażenia niż zwykle. Oczywiście, jako początkujący masz raczej niewielkie szanse na zadanie krytycznego uderzenia.
AI_Output (self,other,"SLD_709_Cord_TRAIN_14_07"); //Ale to się zmieni w miarę czynienia przez ciebie postępów.
B_GiveInvItems (hero, self,ItMiNugget,30);
SLD_709_Cord_TRAIN.permanent = 0;
};
}
else
{
AI_Output (self, other,"KDF_402_Corristo_HEAVYARMOR_Info_14_03"); //Nie masz wystarczającej ilości rudy!
};
}
else
{
AI_Output (self,other,"SLD_709_Cord_NO_ENOUGHT_STR_1"); //Jeżeli chcesz być lepszym wojownikiem, najpierw nieco popracuj nad mięśniami.
PrintScreen ("Warunek: Siła 30", -1,-1,"FONT_OLD_20_WHITE.TGA",2);
};
};
/*------------------------------------------------------------------------
EINHANDKAMPF DIE ZWEITE LEHRSTUNDE
------------------------------------------------------------------------*/
/*
instance SLD_709_Cord_TRAINAGAIN (C_INFO)
{
npc = SLD_709_Cord;
condition = SLD_709_Cord_TRAINAGAIN_Condition;
information = SLD_709_Cord_TRAINAGAIN_Info;
important = 0;
permanent = 1;
description = B_BuildLearnString(NAME_Learn1h_2, LPCOST_TALENT_1H_2,50);
};
FUNC int SLD_709_Cord_TRAINAGAIN_Condition()
{
if (Npc_KnowsInfo (hero,SLD_709_Cord_TRAINOFFER))
&& (Npc_GetTalentSkill (hero,NPC_TALENT_1H) < 2)
{
return TRUE;
};
};
FUNC void SLD_709_Cord_TRAINAGAIN_Info()
{
AI_Output (other, self,"SLD_709_Cord_TRAINAGAIN_Info_15_01"); //Naucz mnie, jak sprawniej posługiwać się jednoręczną bronią.
if (hero.attribute[ATR_STRENGTH] >= 60)
{
if (Npc_HasItems (hero,ItMiNugget) >= 50)
{
if B_GiveSkill(hero,NPC_TALENT_1H,2,LPCOST_TALENT_1H_2)
{
AI_Output (self, other,"SLD_709_Cord_TRAINAGAIN_Info_14_02"); //Dobrze, podstawy już znasz. Nieznaczne opuszczenie broni zwiększy siłę twojego pierwszego ciosu.
AI_Output (self, other,"SLD_709_Cord_TRAINAGAIN_Info_14_03"); //Musisz wykorzystać siłę bezwładności, pamiętasz? Świetnie. Teraz nauczysz się lepiej balansować ciałem. Po zadaniu dwóch ciosów wykonaj obrót.
AI_Output (self, other,"SLD_709_Cord_TRAINAGAIN_Info_14_04"); //To powinno zmylić twojego przeciwnika i pozwolić ci wyjść na dobrą pozycję do następnego ataku.
AI_Output (self, other,"SLD_709_Cord_TRAINAGAIN_Info_14_05"); //Wtedy wyprowadź następne cięcie z prawej strony...
B_PracticeCombat("NC_WATERFALL_TOP01");
AI_Output (self, other,"SLD_709_Cord_TRAINAGAIN_Info_14_06"); //I znowu do przodu. Pamiętaj - trening czyni mistrza, więc najlepiej weź się od razu do roboty!
B_GiveInvItems (hero, self, ItMiNugget, 50);
SLD_709_Cord_TRAINAGAIN.permanent = 0;
};
}
else
{
AI_Output (self, other,"KDF_402_Corristo_HEAVYARMOR_Info_14_03"); //Nie masz wystarczającej ilości rudy!
};
}
else
{
AI_Output (self,other,"SLD_709_Cord_NO_ENOUGHT_STR_1"); //Jeżeli chcesz być lepszym wojownikiem, najpierw nieco popracuj nad mięśniami.
PrintScreen ("Warunek: Siła 60", -1,-1,"FONT_OLD_20_WHITE.TGA",2);
};
};
*/
//========================================
//-----------------> SpottedNearMine
//========================================
INSTANCE DIA_Cord_SpottedNearMine (C_INFO)
{
npc = SLD_709_Cord;
nr = 1;
condition = DIA_Cord_SpottedNearMine_Condition;
information = DIA_Cord_SpottedNearMine_Info;
permanent = FALSE;
Important = TRUE;
};
FUNC INT DIA_Cord_SpottedNearMine_Condition()
{
if (MIS_SupportForQuentin == LOG_RUNNING)
{
return TRUE;
};
};
FUNC VOID DIA_Cord_SpottedNearMine_Info()
{
AI_Output (self, other ,"DIA_Cord_SpottedNearMine_03_01"); //No wreszcie jesteś!
AI_Output (other, self ,"DIA_Cord_SpottedNearMine_15_02"); //Jak sytuacja?
AI_Output (self, other ,"DIA_Cord_SpottedNearMine_03_03"); //Przysłał nas Lee. W okolicy kopalni i na ścieżkach kręciło się sporo Strażników. Pozbyliśmy się ich. Gdy usiedliśmy, by odpocząć pojawili się kolejni Strażnicy i ożywieńcy.
AI_Output (other, self ,"DIA_Cord_SpottedNearMine_15_04"); //Byliście wewnątrz kopalni?
AI_Output (self, other ,"DIA_Cord_SpottedNearMine_03_05"); //Oszalałeś?! Przecież tam roi się od tych piekielnych istot. Nawet Strażnicy zaczęli uciekać. Wpadli w naszą zasadzkę... he he.
AI_Output (other, self ,"DIA_Cord_SpottedNearMine_15_06"); //No, dobra, czyli muszę zejść na dół i zobaczyć, co takiego się tam dzieje.
AI_Output (self, other ,"DIA_Cord_SpottedNearMine_15_07"); //My zostaniemy tutaj i będziemy pilnować wejścia. W każdej chwili mogą się pojawić kolejni Strażnicy. Dopilnujemy, żeby nie zaszli cię od tyłu.
//zadanie - wpis
B_LogEntry (CH4_SupportForQuentin,"Sytuacja nie wygląda za dobrze. W okolicy kopalni kręci się sporo Strażników. Będę musiał zostawić Najemników i Bandytów na straży, a do kopalni zejść sam.");
//exp
B_GiveXP (290);
/* AI_Output (self, other ,"DIA_Cord_SpottedNearMine_03_08"); //Masz ten kamień przy sobie?
if (Npc_HasItems (other, Focus_Corristo) >=1)
{
AI_Output (other, self ,"DIA_Cord_SpottedNearMine_15_09"); //Oczywiście! Znalazłem go na dnie kopalni.
AI_Output (self, other ,"DIA_Cord_SpottedNearMine_03_10"); //Skoro kopalnia jest już bezpieczna można by wznowić wydobycie. Magowie Wody byliby zachwyceni.
AI_Output (self, other ,"DIA_Cord_SpottedNearMine_03_11"); //Przekaż im tą wiadomość.
AI_Output (self, other ,"DIA_Cord_SpottedNearMine_03_12"); //Dobrze.
MIS_NC_Mine = LOG_RUNNING;
Log_CreateTopic (CH4_NC_Mine, LOG_MISSION);
Log_SetTopicStatus (CH4_NC_Mine, LOG_RUNNING);
B_LogEntry (CH4_NC_Mine,"Oczyściłem kopalnię ze złych sił. Cord zaproponował, aby poddać Magom Wody pomysł na wznowienie wydobycia.");
B_GiveXP (500);
}
else
{
AI_Output (other, self ,"DIA_Cord_SpottedNearMine_15_13"); //Nie mam go przy sobie.
AI_Output (self, other ,"DIA_Cord_SpottedNearMine_03_14"); //To wracaj jak najszybciej do kopalni i go przynieś.
AI_Output (self, other ,"DIA_Cord_SpottedNearMine_03_15"); //Ta kopalnia może doprowadzić nas do wolności!
AI_Output (other, self ,"DIA_Cord_SpottedNearMine_15_16"); //No dobrze. Wrócę tam.
AI_Output (other, self ,"DIA_Cord_SpottedNearMine_15_17"); //Pilnujcie wejścia przed Strażnikami i ożywieńcami.
}; */
};
//========================================
//-----------------> IHaveStone
//========================================
INSTANCE DIA_Cord_IHaveStone (C_INFO)
{
npc = SLD_709_Cord;
nr = 2;
condition = DIA_Cord_IHaveStone_Condition;
information = DIA_Cord_IHaveStone_Info;
permanent = FALSE;
description = "Byłem w kopalni.";
};
FUNC INT DIA_Cord_IHaveStone_Condition()
{
if (Npc_KnowsInfo (hero, DIA_Cord_SpottedNearMine))
&& (Npc_HasItems (hero, Focus_Corristo) >=1)
{
return TRUE;
};
};
FUNC VOID DIA_Cord_IHaveStone_Info()
{
AI_Output (other, self ,"DIA_Cord_IHaveStone_15_01"); //Byłem w kopalni.
AI_Output (self, other ,"DIA_Cord_IHaveStone_03_02"); //Co wydarzyło się w środku?
AI_Output (other, self ,"DIA_Cord_IHaveStone_03_03"); //Spotkałem ledwie żywego Kopacza. Opowiedział mi o artefakcie, który rzekomo ma wpływ na ożywieńców.
AI_Output (other, self ,"DIA_Cord_IHaveStone_03_04"); //W posiadaniu artefaktu był pewien nekromanta. Zabiłem go i zabrałem kamień.
AI_Output (self, other ,"DIA_Cord_IHaveStone_03_05"); //Nekromanta? Cholera jasna, udało ci się pokonać tego skurwiela?
AI_Output (self, other ,"DIA_Cord_IHaveStone_03_06"); //Jestem pod wrażeniem. Zawsze trzymam się z dala od mrocznej magii.
AI_Output (other, self ,"DIA_Cord_IHaveStone_03_07"); //Potrzebuję chwili odpoczynku.
AI_Output (self, other ,"DIA_Cord_IHaveStone_03_08"); //Nic dziwnego! Należy ci się jak psu buda! Wracaj do Obozu, a my sprawdzimy czy nie kręci się tu żaden śmieć.
AI_Output (self, other ,"DIA_Cord_IHaveStone_03_09"); //W sumie, skoro kopalnia jest już w miarę bezpiecznym miejscem, to możesz zaproponować Lee, aby wysłał tu paru ludzi.
AI_Output (self, other ,"DIA_Cord_IHaveStone_03_10"); //Kolejne źródło rudy dałoby nam przewagę.
AI_Output (other, self ,"DIA_Cord_IHaveStone_03_11"); //Zobaczę, co da się zrobić.
//nowe zadanie
MIS_NC_Mine = LOG_RUNNING;
Log_CreateTopic (CH4_NC_Mine, LOG_MISSION);
Log_SetTopicStatus (CH4_NC_Mine, LOG_RUNNING);
B_LogEntry (CH4_NC_Mine,"Oczyściłem kopalnię ze złych sił. Cord zaproponował, aby poddać Lee pomysł na wznowienie wydobycia.");
//stare zadanie z kopalnią
MIS_SupportForQuentin = LOG_SUCCESS;
Log_SetTopicStatus (CH4_SupportForQuentin, LOG_SUCCESS);
B_LogEntry (CH4_SupportForQuentin,"Pozbyłem się nekromanty, który przywoływaj ożywieńców w kopalni i opowiedziałem o tym Cordowi. Moje zadanie dobiegło końca. Po kolejne instrukcje powinienem się udać do Lee.");
B_GiveXP (500);
AI_StopProcessInfos (self);
//Npc_ExchangeRoutine (SLD_737_Torlof,"start");
Npc_ExchangeRoutine (SLD_728_Jarvis,"start");
Npc_ExchangeRoutine (SLD_709_Cord,"start");
Npc_ExchangeRoutine (BAN_1605_Rocky,"start");
AI_StopProcessInfos (self);
};
//#####################################################################################
//####### ROZDZIAŁ 5
//####### ZASTĘPSTWO DLA GORNA
//#####################################################################################
//========================================
//-----------------> CALL_OF_DUTY
//========================================
INSTANCE DIA_Cord_CALL_OF_DUTY (C_INFO)
{
npc = SLD_709_Cord;
nr = 1;
condition = DIA_Cord_CALL_OF_DUTY_Condition;
information = DIA_Cord_CALL_OF_DUTY_Info;
permanent = FALSE;
description = "Przysyła mnie Lee. Twoja straż ma zająć się obroną Wolnej Kopalni.";
};
FUNC INT DIA_Cord_CALL_OF_DUTY_Condition()
{
if (Npc_KnowsInfo (hero, DIA_Lee_OBRONA_WK))
{
return TRUE;
};
};
FUNC VOID DIA_Cord_CALL_OF_DUTY_Info()
{
AI_Output (other, self ,"DIA_Cord_CALL_OF_DUTY_15_01"); //Przysyła mnie Lee. Twoja straż ma zająć się obroną Wolnej Kopalni.
AI_Output (self, other ,"DIA_Cord_CALL_OF_DUTY_03_02"); //W porządku i tak mieliśmy się tam udać.
AI_Output (self, other ,"DIA_Cord_CALL_OF_DUTY_03_03"); //Gorn jednak był tak nadgorliwy, że postanowił sam zająć się Strażnikami.
AI_Output (self, other ,"DIA_Cord_CALL_OF_DUTY_03_04"); //Natychmiast go zmienimy.
B_LogEntry (CH5_ObronaWK,"Przekazałem wiadomość od Lee Cordowi.");
B_GiveXP (200);
AI_StopProcessInfos (self);
//Rutyny Najemników idących do Kotła.
Npc_ExchangeRoutine (SLD_709_Cord,"FMDef");
Npc_ExchangeRoutine (SLD_735_Soeldner,"FMDef");
Npc_ExchangeRoutine (SLD_736_Soeldner,"FMDef");
}; | D |
///////////////////////////////////////////////////////////////////////
// Info EXIT
///////////////////////////////////////////////////////////////////////
INSTANCE DIA_Carl_EXIT (C_INFO)
{
npc = VLK_461_Carl;
nr = 999;
condition = DIA_Carl_EXIT_Condition;
information = DIA_Carl_EXIT_Info;
permanent = TRUE;
description = DIALOG_ENDE;
};
FUNC INT DIA_Carl_EXIT_Condition()
{
return TRUE;
};
FUNC VOID DIA_Carl_EXIT_Info()
{
AI_StopProcessInfos (self);
};
///////////////////////////////////////////////////////////////////////
FUNC VOID B_CarlSayHallo ()
{
AI_Output (self, other, "DIA_Carl_Hallo_05_00"); //Wygląda na to, że mamy w mieście kilku złodziei, którzy okradają bogaczy.
AI_Output (self, other, "DIA_Carl_Hallo_05_01"); //Straż miejska przetrząsnęła ostatnio dzielnicę portową, ale nie udało im się niczego znaleźć.
};
// ************************************************************
// PICK POCKET
// ************************************************************
INSTANCE DIA_Carl_PICKPOCKET (C_INFO)
{
npc = VLK_461_Carl;
nr = 900;
condition = DIA_Carl_PICKPOCKET_Condition;
information = DIA_Carl_PICKPOCKET_Info;
permanent = TRUE;
description = Pickpocket_40;
};
FUNC INT DIA_Carl_PICKPOCKET_Condition()
{
C_Beklauen (34, 40);
};
FUNC VOID DIA_Carl_PICKPOCKET_Info()
{
Info_ClearChoices (DIA_Carl_PICKPOCKET);
Info_AddChoice (DIA_Carl_PICKPOCKET, DIALOG_BACK ,DIA_Carl_PICKPOCKET_BACK);
Info_AddChoice (DIA_Carl_PICKPOCKET, DIALOG_PICKPOCKET ,DIA_Carl_PICKPOCKET_DoIt);
};
func void DIA_Carl_PICKPOCKET_DoIt()
{
B_Beklauen ();
Info_ClearChoices (DIA_Carl_PICKPOCKET);
};
func void DIA_Carl_PICKPOCKET_BACK()
{
Info_ClearChoices (DIA_Carl_PICKPOCKET);
};
///////////////////////////////////////////////////////////////////////
// Info Hallo
///////////////////////////////////////////////////////////////////////
INSTANCE DIA_Carl_Hallo (C_INFO)
{
npc = VLK_461_Carl;
nr = 2;
condition = DIA_Carl_Hallo_Condition;
information = DIA_Carl_Hallo_Info;
permanent = FALSE;
Important = TRUE;
};
FUNC INT DIA_Carl_Hallo_Condition()
{
if Npc_IsInState (self, ZS_Talk)
{
return TRUE;
};
};
FUNC VOID DIA_Carl_Hallo_Info()
{
AI_Output (self, other, "DIA_Carl_Hallo_05_02"); //Co cię sprowadza do tej biednej dzielnicy? Czego tu szukasz?
Info_ClearChoices (DIA_Carl_Hallo);
Info_AddChoice (DIA_Carl_Hallo,"Zabłądziłem.",DIA_Carl_Hallo_verlaufen);
Info_AddChoice (DIA_Carl_Hallo,"Tylko się rozglądam.",DIA_Carl_Hallo_umsehen);
};
FUNC VOID DIA_Carl_Hallo_verlaufen()
{
AI_Output (other, self, "DIA_Carl_Hallo_verlaufen_15_00");//Zabłądziłem.
AI_Output (self, other, "DIA_Carl_Hallo_verlaufen_05_01");//Więc lepiej uważaj, żeby cię ktoś nie obrabował.
B_CarlSayHallo();
Info_ClearChoices (DIA_Carl_Hallo);
};
FUNC VOID DIA_Carl_Hallo_umsehen()
{
AI_Output (other, self, "DIA_Carl_Hallo_umsehen_15_00");//Tylko się rozglądam.
AI_Output (self, other, "DIA_Carl_Hallo_umsehen_05_01");//Ha. Więc lepiej, żeby nikt cię nie złapał na tym całym rozglądaniu.
B_CarlSayHallo();
Info_ClearChoices (DIA_Carl_Hallo);
};
///////////////////////////////////////////////////////////////////////
// Info Diebe
///////////////////////////////////////////////////////////////////////
INSTANCE DIA_Carl_Diebe (C_INFO)
{
npc = VLK_461_Carl;
nr = 3;
condition = DIA_Carl_Diebe_Condition;
information = DIA_Carl_Diebe_Info;
permanent = FALSE;
description = "Co chcesz wiedzieć o tych złodziejach?";
};
FUNC INT DIA_Carl_Diebe_Condition()
{
return TRUE;
};
FUNC VOID DIA_Carl_Diebe_Info()
{
AI_Output (other, self, "DIA_Carl_Diebe_15_00");//Co chcesz wiedzieć o tych złodziejach?
AI_Output (self, other, "DIA_Carl_Diebe_05_01");//Nic. Ale wszyscy obywatele są wystraszeni i stali się nieufni - szczególnie względem obcych.
AI_Output (self, other, "DIA_Carl_Diebe_05_02");//Nie daj się złapać w cudzym domu - nikt nie zareaguje na to uprzejmością.
AI_Output (self, other, "DIA_Carl_Diebe_05_03");//Tak, trzeba się bronić przed złodziejami. Najlepiej nadaje się do tego solidna pałka.
};
///////////////////////////////////////////////////////////////////////
// Info Lernen
///////////////////////////////////////////////////////////////////////
INSTANCE DIA_Carl_Lernen (C_INFO)
{
npc = VLK_461_Carl;
nr = 3;
condition = DIA_Carl_Lernen_Condition;
information = DIA_Carl_Lernen_Info;
permanent = FALSE;
description = "Możesz mnie czegoś nauczyć?";
};
FUNC INT DIA_Carl_Lernen_Condition()
{
return TRUE;
};
FUNC VOID DIA_Carl_Lernen_Info()
{
AI_Output (other, self, "DIA_Carl_Lernen_15_00");//Możesz mnie czegoś nauczyć?
AI_Output (self, other, "DIA_Carl_Lernen_05_01");//Och, robię okucia i gwoździe. Naprawiam też metalowe części.
AI_Output (self, other, "DIA_Carl_Lernen_05_02");//Nie znam się jednak na wyrobie broni dostatecznie dobrze, żeby cię uczyć.
AI_Output (self, other, "DIA_Carl_Lernen_05_03");//Jeżeli chcesz się tego nauczyć, to idź do Harada. On na pewno wie, jak się wykuwa broń!
AI_Output (self, other, "DIA_Carl_Lernen_05_04");//Jeśli jednak chcesz popracować trochę nad swoimi mięśniami, to mogę ci w tym pomóc.
Log_CreateTopic (Topic_CityTeacher,LOG_NOTE);
B_LogEntry (Topic_CityTeacher,"Carl, kowal z dzielnicy portowej, może mi pokazać, jak stać się silniejszym.");
};
///////////////////////////////////////////////////////////////////////
// Info Für's lernen bezahlen
///////////////////////////////////////////////////////////////////////
INSTANCE DIA_Carl_Wieviel (C_INFO)
{
npc = VLK_461_Carl;
nr = 3;
condition = DIA_Carl_Wieviel_Condition;
information = DIA_Carl_Wieviel_Info;
permanent = FALSE;
description = "Ile sobie liczysz za trening?";
};
FUNC INT DIA_Carl_Wieviel_Condition()
{
if Npc_KnowsInfo (other, DIA_Carl_Lernen)
{
return TRUE;
};
};
FUNC VOID DIA_Carl_Wieviel_Info()
{
AI_Output (other, self, "DIA_Carl_Wieviel_15_00");//Ile sobie liczysz za trening?
if Npc_KnowsInfo (other,DIA_Edda_Statue)
{
AI_Output (self, other, "DIA_Carl_Wieviel_05_01");//Słyszałem, co zrobiłeś dla Eddy. Wyszkolę cię za darmo.
Carl_TeachSTR = TRUE;
}
else
{
AI_Output (self, other, "DIA_Carl_Wieviel_05_02");//50 sztuk złota i pomogę ci nabrać sił.
};
};
///////////////////////////////////////////////////////////////////////
// Info Gold zahlen
///////////////////////////////////////////////////////////////////////
INSTANCE DIA_Carl_bezahlen (C_INFO)
{
npc = VLK_461_Carl;
nr = 3;
condition = DIA_Carl_bezahlen_Condition;
information = DIA_Carl_bezahlen_Info;
permanent = TRUE;
description = "Chciałbym z tobą trenować (zapłać 50 sztuk złota).";
};
FUNC INT DIA_Carl_bezahlen_Condition()
{
if Npc_KnowsInfo (other, DIA_Carl_Wieviel)
&& (Carl_TeachSTR == FALSE)
{
return TRUE;
};
};
FUNC VOID DIA_Carl_bezahlen_Info()
{
AI_Output (other, self, "DIA_Carl_bezahlen_15_00");//Chcę z tobą ćwiczyć.
if Npc_KnowsInfo (other,DIA_Edda_Statue)
{
AI_Output (self, other, "DIA_Carl_bezahlen_05_01");//Słyszałem, co zrobiłeś dla Eddy. Wyszkolę cię za darmo.
Carl_TeachSTR = TRUE;
}
else
{
if B_GiveInvItems (other, self, ItMi_Gold, 50)
{
AI_Output (self, other, "DIA_Carl_bezahlen_05_02");//Dobrze, możemy zacząć, gdy tylko będziesz gotowy.
Carl_TeachSTR = TRUE;
}
else
{
AI_Output (self, other, "DIA_Carl_bezahlen_05_03");//Zdobądź złoto, wtedy cię wyszkolę.
};
};
};
//*******************************************
// TechPlayer
//*******************************************
INSTANCE DIA_Carl_Teach(C_INFO)
{
npc = VLK_461_Carl;
nr = 7;
condition = DIA_Carl_Teach_Condition;
information = DIA_Carl_Teach_Info;
permanent = TRUE;
description = "Chcę być silniejszy.";
};
FUNC INT DIA_Carl_Teach_Condition()
{
if (Carl_TeachSTR == TRUE)
{
return TRUE;
};
};
FUNC VOID DIA_Carl_Teach_Info()
{
AI_Output (other,self ,"DIA_Carl_Teach_15_00"); //Chcę być silniejszy.
Info_ClearChoices (DIA_Carl_Teach);
Info_AddChoice (DIA_Carl_Teach, DIALOG_BACK, DIA_Carl_Teach_Back);
Info_AddChoice (DIA_Carl_Teach, B_BuildLearnString(PRINT_LearnSTR1 , B_GetLearnCostAttribute(other, ATR_STRENGTH)) ,DIA_Carl_Teach_STR_1);
Info_AddChoice (DIA_Carl_Teach, B_BuildLearnString(PRINT_LearnSTR5 , B_GetLearnCostAttribute(other, ATR_STRENGTH)*5) ,DIA_Carl_Teach_STR_5);
};
FUNC VOID DIA_Carl_Teach_Back ()
{
Info_ClearChoices (DIA_Carl_Teach);
};
FUNC VOID DIA_Carl_Teach_STR_1 ()
{
B_TeachAttributePoints (self, other, ATR_STRENGTH, 1, T_HIGH);
Info_ClearChoices (DIA_Carl_Teach);
Info_AddChoice (DIA_Carl_Teach, DIALOG_BACK, DIA_Carl_Teach_Back);
Info_AddChoice (DIA_Carl_Teach, B_BuildLearnString(PRINT_LearnSTR1 , B_GetLearnCostAttribute(other, ATR_STRENGTH)) ,DIA_Carl_Teach_STR_1);
Info_AddChoice (DIA_Carl_Teach, B_BuildLearnString(PRINT_LearnSTR5 , B_GetLearnCostAttribute(other, ATR_STRENGTH)*5) ,DIA_Carl_Teach_STR_5);
};
FUNC VOID DIA_Carl_Teach_STR_5 ()
{
B_TeachAttributePoints (self, other, ATR_STRENGTH, 5, T_HIGH);
Info_ClearChoices (DIA_Carl_Teach);
Info_AddChoice (DIA_Carl_Teach, DIALOG_BACK, DIA_Carl_Teach_Back);
Info_AddChoice (DIA_Carl_Teach, B_BuildLearnString(PRINT_LearnSTR1 , B_GetLearnCostAttribute(other, ATR_STRENGTH)) ,DIA_Carl_Teach_STR_1);
Info_AddChoice (DIA_Carl_Teach, B_BuildLearnString(PRINT_LearnSTR5 , B_GetLearnCostAttribute(other, ATR_STRENGTH)*5) ,DIA_Carl_Teach_STR_5);
};
| D |
/* Copyright (c) 2007 CSIRO
Copyright (c) 2007-2008 Xiph.Org Foundation
Written by Jean-Marc Valin */
/*
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
- Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
- Neither the name of the Xiph.org Foundation nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
module celt.celt_header;
import celt.celt;
import celt.celt_types;
extern (C) {
/** Header data to be used for Ogg files (or possibly other encapsulation)
@brief Header data
*/
struct CELTHeader {
char codec_id[8]; /**< MUST be "CELT " (four spaces) */
char codec_version[20]; /**< Version used (as string) */
celt_int32 version_id; /**< Version id (negative for until stream is frozen) */
celt_int32 header_size; /**< Size of this header */
celt_int32 sample_rate; /**< Sampling rate of the original audio */
celt_int32 nb_channels; /**< Number of channels */
celt_int32 frame_size; /**< Samples per frame (per channel) */
celt_int32 overlap; /**< Overlapping samples (per channel) */
celt_int32 bytes_per_packet; /**< Number of bytes per compressed packet (0 if unknown) */
celt_int32 extra_headers; /**< Number of additional headers that follow this header */
}
/** Creates a basic header struct */
int celt_header_init(CELTHeader *header, const CELTMode *m, int channels);
int celt_header_to_packet(const CELTHeader *header, ubyte *packet, celt_uint32 size);
int celt_header_from_packet(const ubyte *packet, celt_uint32 size, CELTHeader *header);
}
| D |
instance DIA_Buster_EXIT(C_Info)
{
npc = SLD_802_Buster;
nr = 999;
condition = DIA_Buster_EXIT_Condition;
information = DIA_Buster_EXIT_Info;
permanent = TRUE;
description = Dialog_Ende;
};
func int DIA_Buster_EXIT_Condition()
{
if(Kapitel < 3)
{
return TRUE;
};
};
func void DIA_Buster_EXIT_Info()
{
AI_StopProcessInfos(self);
};
instance DIA_Buster_Hello(C_Info)
{
npc = SLD_802_Buster;
nr = 1;
condition = DIA_Buster_Hello_Condition;
information = DIA_Buster_Hello_Info;
permanent = FALSE;
important = TRUE;
};
func int DIA_Buster_Hello_Condition()
{
if((self.aivar[AIV_LastFightAgainstPlayer] != FIGHT_LOST) && (hero.guild != GIL_SLD) && (hero.guild != GIL_DJG) && (KAPITELORCATC == FALSE))
{
return TRUE;
};
};
func void DIA_Buster_Hello_Info()
{
AI_Output(self,other,"DIA_Buster_Hello_13_00"); //Kohopak to tady máme? Neznám tě odněkud?
Info_ClearChoices(DIA_Buster_Hello);
if(OnarFM == FALSE)
{
Info_AddChoice(DIA_Buster_Hello,"Když myslíš. Jsem na cestě za statkářem Onarem.",DIA_Buster_Hello_GoingToFarm);
};
Info_AddChoice(DIA_Buster_Hello,"Kdo se ptá?",DIA_Buster_Hello_WhoAreYou);
};
func void DIA_Buster_Hello_WhoAreYou()
{
AI_Output(other,self,"DIA_Buster_Hello_WhoAreYou_15_00"); //Kdo se ptá?
AI_Output(self,other,"DIA_Buster_Hello_WhoAreYou_13_01"); //Jsem Buster, jeden z Leeových žoldáků!
AI_Output(self,other,"DIA_Buster_Hello_WhoAreYou_13_02"); //A TY bys ke mně měl být trošku zdvořilejší, nebo toho budeš litovat!
AI_Output(self,other,"DIA_Buster_Hello_WhoAreYou_13_03"); //Dobrá, co tady chceš?
Info_ClearChoices(DIA_Buster_Hello);
Info_AddChoice(DIA_Buster_Hello,"Do toho ti nic není.",DIA_Buster_Hello_NotYourBusiness);
Info_AddChoice(DIA_Buster_Hello,"Leeho znám!",DIA_Buster_Hello_IKnowLee);
if(OnarFM == FALSE)
{
Info_AddChoice(DIA_Buster_Hello,"Jdu za statkářem Onarem.",DIA_Buster_Hello_GoingToFarm);
};
};
func void DIA_Buster_Hello_IKnowLee()
{
AI_Output(other,self,"DIA_Buster_Hello_IKnowLee_15_00"); //Leeho znám!
AI_Output(self,other,"DIA_Buster_Hello_IKnowLee_13_01"); //Leeho zná každý! To nic neznamená, kámo. Zrovna teď mluvíš SE MNOU!
AI_Output(self,other,"DIA_Buster_Hello_IKnowLee_13_02"); //Takže, kam máš namířeno?
Info_ClearChoices(DIA_Buster_Hello);
Info_AddChoice(DIA_Buster_Hello,"Do toho ti nic není.",DIA_Buster_Hello_NotYourBusiness);
if(OnarFM == FALSE)
{
Info_AddChoice(DIA_Buster_Hello,"Jdu za statkářem Onarem.",DIA_Buster_Hello_GoingToFarm);
};
};
func void DIA_Buster_Hello_NotYourBusiness()
{
AI_Output(other,self,"DIA_Buster_Hello_NotYourBusiness_15_00"); //Do toho ti nic není.
AI_Output(self,other,"DIA_Buster_Hello_NotYourBusiness_13_01"); //Takhle se mnou nikdo mluvit nebude, ty červe! Řekl bych, že je čas na pořádnou nakládačku.
AI_StopProcessInfos(self);
B_Attack(self,other,AR_NONE,1);
};
func void DIA_Buster_Hello_GoingToFarm()
{
AI_Output(other,self,"DIA_Buster_Hello_GoingToFarm_15_00"); //Jdu za statkářem Onarem.
AI_Output(self,other,"DIA_Buster_Hello_GoingToFarm_13_01"); //Vážně?... Hm - nepřijdeš mi nějak zvlášť nebezpečný.
Info_ClearChoices(DIA_Buster_Hello);
Info_AddChoice(DIA_Buster_Hello,"Chceš se přesvědčit?",DIA_Buster_Hello_WannaTestIt);
Info_AddChoice(DIA_Buster_Hello,"Jednou nebo dvakrát jsem zabil nějakou příšeru.",DIA_Buster_Hello_SlewBeasts);
Info_AddChoice(DIA_Buster_Hello,"To máš pravdu.",DIA_Buster_Hello_ImNoDanger);
};
func void DIA_Buster_Hello_ImNoDanger()
{
AI_Output(other,self,"DIA_Buster_Hello_ImNoDanger_15_00"); //To máš pravdu
AI_Output(self,other,"DIA_Buster_Hello_ImNoDanger_13_01"); //(samolibě) Jo, za ty roky se naučíš si takových věcí všímat, kámo.
AI_Output(self,other,"DIA_Buster_Hello_ImNoDanger_13_02"); //V jednom kuse tady bojujeme se skřety. Nebo strážemi z města. Teda, jsou to pěkně neodbytní prevíti!
Info_ClearChoices(DIA_Buster_Hello);
Info_AddChoice(DIA_Buster_Hello,"Myslíš SKUTEČNÉ skřety? Ty velké potvory?",DIA_Buster_Hello_RealOrcs);
Info_AddChoice(DIA_Buster_Hello,"Takže?",DIA_Buster_Hello_SoWhat);
Info_AddChoice(DIA_Buster_Hello,"Působivé.",DIA_Buster_Hello_Impressive);
};
func void DIA_Buster_Hello_SlewBeasts()
{
AI_Output(other,self,"DIA_Buster_Hello_SlewBeasts_15_00"); //Jednou nebo dvakrát jsem zabil nějakou příšeru
AI_Output(self,other,"DIA_Buster_Hello_SlewBeasts_13_01"); //Ha! (zasměje se) Nejspíš jsi v poli rozšlápnul pár brouků a vyhnal několik krys z jejich nor.
AI_Output(self,other,"DIA_Buster_Hello_SlewBeasts_13_02"); //Tady nám jdou po krku skřeti! Jo, a ta mizerná městská stráž.
Info_ClearChoices(DIA_Buster_Hello);
Info_AddChoice(DIA_Buster_Hello,"Myslíš SKUTEČNÉ skřety? Ty velké potvory?",DIA_Buster_Hello_RealOrcs);
Info_AddChoice(DIA_Buster_Hello,"Takže?",DIA_Buster_Hello_SoWhat);
Info_AddChoice(DIA_Buster_Hello,"Působivé.",DIA_Buster_Hello_Impressive);
};
func void DIA_Buster_Hello_WannaTestIt()
{
AI_Output(other,self,"DIA_Buster_Hello_WannaTestIt_15_00"); //Chceš se přesvědčit
AI_Output(self,other,"DIA_Buster_Hello_WannaTestIt_13_01"); //Božíčku! Vybral jsem si špatného otloukánka, co?
AI_Output(other,self,"DIA_Buster_Hello_WannaTestIt_15_02"); //Dalo by se to tak říct.
AI_Output(self,other,"DIA_Buster_Hello_WannaTestIt_13_03"); //Tak pojď, ukaž mi, co v tobě je.
AI_StopProcessInfos(self);
B_Attack(self,other,AR_NONE,1);
};
func void DIA_Buster_Hello_Impressive()
{
AI_Output(other,self,"DIA_Buster_Hello_Impressive_15_00"); //Působivé.
AI_Output(self,other,"DIA_Buster_Hello_Impressive_13_01"); //To je naše živnost, chlapče! Dokonce si děláme vlastní zbraně a zbroje!
AI_Output(self,other,"DIA_Buster_Hello_Impressive_13_02"); //Vysmíváme se smrti den co den. Ale o něčem takovém nemá vesnický balík jako ty ani zdání.
Info_ClearChoices(DIA_Buster_Hello);
Info_AddChoice(DIA_Buster_Hello,"Budu ti budu muset ukázat, jak velké ponětí o tom mám!",DIA_Buster_Hello_LetMeShowYou);
Info_AddChoice(DIA_Buster_Hello,"Když to říkáš.",DIA_Buster_Hello_IfYouSaySo);
};
func void DIA_Buster_Hello_IfYouSaySo()
{
AI_Output(other,self,"DIA_Buster_Hello_IfYouSaySo_15_00"); //Když to říkáš.
AI_Output(self,other,"DIA_Buster_Hello_IfYouSaySo_13_01"); //Mazej, strašpytle!
AI_StopProcessInfos(self);
};
func void DIA_Buster_Hello_LetMeShowYou()
{
AI_Output(other,self,"DIA_Buster_Hello_LetMeShowYou_15_00"); //Budu ti budu muset ukázat, jak velké ponětí o tom mám!
AI_Output(self,other,"DIA_Buster_Hello_LetMeShowYou_13_01"); //To má být jednomužné rolnické povstání, nebo co?
AI_Output(self,other,"DIA_Buster_Hello_LetMeShowYou_13_02"); //Tak dobrá, ukaž mi, co v tobě je.
AI_StopProcessInfos(self);
B_Attack(self,other,AR_NONE,1);
};
func void DIA_Buster_Hello_SoWhat()
{
AI_Output(other,self,"DIA_Buster_Hello_SoWhat_15_00"); //Takže?
AI_Output(self,other,"DIA_Buster_Hello_SoWhat_13_01"); //(odfrkne si) Jako bys věděl, o čem to tady mluvím. Myslíš si, bůhvíjak nejsi silný, co?
AI_Output(self,other,"DIA_Buster_Hello_SoWhat_13_02"); //(rozzlobeně) Možná je na čase, aby ti někdo uštědřil lekci!
Info_ClearChoices(DIA_Buster_Hello);
Info_AddChoice(DIA_Buster_Hello,"Kdykoliv!",DIA_Buster_Hello_Whenever);
Info_AddChoice(DIA_Buster_Hello,"Dělám si srandu...",DIA_Buster_Hello_JustJoking);
};
func void DIA_Buster_Hello_RealOrcs()
{
AI_Output(other,self,"DIA_Buster_Hello_RealOrcs_15_00"); //Myslíš SKUTEČNÉ skřety? Ty velké potvory?
AI_Output(self,other,"DIA_Buster_Hello_RealOrcs_13_01"); //(povzdechne si) Já jenom... Počkat! Chceš si ze mě utahovat?
AI_Output(other,self,"DIA_Buster_Hello_RealOrcs_15_02"); //(s úsměvem) To vůbec ne.
AI_Output(self,other,"DIA_Buster_Hello_RealOrcs_13_03"); //Ty červe! (nečekaně agresivně) Nedáš jinak, co?
AI_Output(self,other,"DIA_Buster_Hello_RealOrcs_13_04"); //Tak pojď a ukaž, co v tobě je, ty hrdino!
Info_ClearChoices(DIA_Buster_Hello);
Info_AddChoice(DIA_Buster_Hello,"Kdykoliv!",DIA_Buster_Hello_Whenever);
Info_AddChoice(DIA_Buster_Hello,"Dělám si srandu...",DIA_Buster_Hello_JustJoking);
};
func void DIA_Buster_Hello_Whenever()
{
AI_Output(other,self,"DIA_Buster_Hello_Whenever_15_00"); //Kdykoliv!
AI_Output(self,other,"DIA_Buster_Hello_Whenever_13_01"); //Tak pojď blíž, kámo!
AI_StopProcessInfos(self);
B_Attack(self,other,AR_NONE,1);
};
func void DIA_Buster_Hello_JustJoking()
{
AI_Output(other,self,"DIA_Buster_Hello_JustJoking_15_00"); //Dělám si srandu...
AI_Output(self,other,"DIA_Buster_Hello_JustJoking_13_01"); //No jo, jasně, zastrč drápky! Jdi mi z očí!
AI_StopProcessInfos(self);
};
instance DIA_Buster_FightNone(C_Info)
{
npc = SLD_802_Buster;
nr = 1;
condition = DIA_Buster_FightNone_Condition;
information = DIA_Buster_FightNone_Info;
permanent = FALSE;
important = TRUE;
};
func int DIA_Buster_FightNone_Condition()
{
if(Npc_KnowsInfo(other,DIA_Buster_Hello) && (self.aivar[AIV_LastFightAgainstPlayer] == FIGHT_NONE) && Npc_IsInState(self,ZS_Talk))
{
return TRUE;
};
};
func void DIA_Buster_FightNone_Info()
{
AI_Output(self,other,"DIA_Buster_FightNone_13_00"); //Co chceš, strašpytle?
};
instance DIA_Buster_Duell(C_Info)
{
npc = SLD_802_Buster;
nr = 3;
condition = DIA_Buster_Duell_Condition;
information = DIA_Buster_Duell_Info;
permanent = TRUE;
description = "Vyzývám tě k souboji!";
};
func int DIA_Buster_Duell_Condition()
{
if(self.aivar[AIV_LastFightAgainstPlayer] != FIGHT_LOST)
{
return TRUE;
};
};
func void DIA_Buster_Duell_Info()
{
AI_Output(other,self,"DIA_Buster_Duell_15_00"); //Vyzývám tě k souboji!
if(self.aivar[AIV_LastFightAgainstPlayer] == FIGHT_NONE)
{
AI_Output(self,other,"DIA_Buster_Duell_13_01"); //Ha ha! Nechceš to nechat jen tak, co? Tak dobrá - pojď sem!
}
else
{
AI_Output(self,other,"DIA_Buster_Duell_13_02"); //Chceš to zkusit znovu? Otravo mizernej - dobrá, pojď sem!
if(self.aivar[AIV_LastFightAgainstPlayer] == FIGHT_CANCEL)
{
AI_Output(self,other,"DIA_Buster_Duell_13_03"); //Ale už podruhé neutíkej!
};
};
AI_StopProcessInfos(self);
B_Attack(self,other,AR_NONE,1);
};
instance DIA_Buster_WannaJoin(C_Info)
{
npc = SLD_802_Buster;
nr = 2;
condition = DIA_Buster_WannaJoin_Condition;
information = DIA_Buster_WannaJoin_Info;
permanent = TRUE;
description = "Chci se přidat k žoldákům!";
};
func int DIA_Buster_WannaJoin_Condition()
{
if((other.guild == GIL_NONE) && (Buster_Duell == FALSE))
{
return TRUE;
};
};
func void DIA_Buster_WannaJoin_Info()
{
AI_Output(other,self,"DIA_Buster_WannaJoin_15_00"); //Chci se přidat k žoldákům!
if((self.aivar[AIV_LastFightAgainstPlayer] == FIGHT_WON) || (self.aivar[AIV_LastFightAgainstPlayer] == FIGHT_LOST))
{
if(self.aivar[AIV_LastFightAgainstPlayer] == FIGHT_LOST)
{
AI_Output(self,other,"DIA_Buster_WannaJoin_13_01"); //Každý, kdo má ránu tvrdou jako ty, by tady neměl mít žádné problémy.
}
else
{
AI_Output(self,other,"DIA_Buster_WannaJoin_13_02"); //Nejsi zrovna nejlepší bojovník, ale odvaha ti rozhodně nechybí.
};
Buster_Duell = TRUE;
BUSTERDUELOK = TRUE;
AI_Output(self,other,"DIA_Buster_WannaJoin_13_03"); //Můj hlas tady moc neznamená, protože jsem tady dlouho nebyl, ale až se mě Lee zeptá, budu hlasovat pro tebe.
Log_CreateTopic(TOPIC_SLDRespekt,LOG_MISSION);
Log_SetTopicStatus(TOPIC_SLDRespekt,LOG_Running);
B_LogEntry(TOPIC_SLDRespekt,"Když jsem Bustera porazil, nebude mi už bránit v cestě do řad žoldáků.");
}
else
{
AI_Output(self,other,"DIA_Buster_WannaJoin_13_04"); //Ty? Nevzpomínám si, že by k žoldákům kdy přijali nějakého sraba...
if(self.aivar[AIV_LastFightAgainstPlayer] == FIGHT_CANCEL)
{
AI_Output(self,other,"DIA_Buster_WannaJoin_13_05"); //Utíkat ze souboje - s tím se tady moc daleko nedostaneš!
};
};
};
var int Buster_SentenzaTip;
instance DIA_Buster_OtherSld(C_Info)
{
npc = SLD_802_Buster;
nr = 1;
condition = DIA_Buster_OtherSld_Condition;
information = DIA_Buster_OtherSld_Info;
permanent = FALSE;
description = "Rád bych se dozvěděl něco o žoldácích a zdejším okolí.";
};
func int DIA_Buster_OtherSld_Condition()
{
if((hero.guild != GIL_SLD) && (hero.guild != GIL_DJG))
{
return TRUE;
};
};
func void DIA_Buster_OtherSld_Info()
{
AI_Output(other,self,"DIA_Buster_OtherSld_15_00"); //Rád bych se dozvěděl něco o žoldácích a zdejším okolí.
AI_Output(self,other,"DIA_Buster_OtherSld_13_01"); //O okolí ti toho moc nepovím. Na to by ses měl raději zeptat rolníků.
AI_Output(self,other,"DIA_Buster_OtherSld_13_02"); //A co se týče nás žoldáků - máme jedno velice jednoduché pravidlo: jestli dokážeš neustoupit, můžeš mezi nás.
if(self.aivar[AIV_LastFightAgainstPlayer] == FIGHT_LOST)
{
AI_Output(self,other,"DIA_Buster_OtherSld_13_03"); //Myslím, že jsi přesně z toho materiálu, který potřebujeme.
AI_Output(self,other,"DIA_Buster_OtherSld_13_04"); //Ale ne, aby ti to stouplo do hlavy, že jsi měl v našem posledním souboji štěstí.
AI_Output(self,other,"DIA_Buster_OtherSld_13_05"); //Na farmě je spousta hochů, kteří jsou o chloupek lepší než já...
AI_Output(self,other,"DIA_Buster_OtherSld_13_06"); //Sentenza, například. Hlídá vstup na farmu. Ať se děje co se děje, s ním se do křížku nepouštěj.
Buster_SentenzaTip = TRUE;
}
else if(self.aivar[AIV_LastFightAgainstPlayer] == FIGHT_WON)
{
}
else
{
AI_Output(self,other,"DIA_Buster_OtherSld_13_07"); //Ale proč to vlastně říkám takovému zbabělci?!
AI_StopProcessInfos(self);
};
};
var int Buster_GoldZumBrennen;
var int Buster_Bonus;
instance DIA_Buster_AboutSentenza(C_Info)
{
npc = SLD_802_Buster;
nr = 1;
condition = DIA_Buster_AboutSentenza_Condition;
information = DIA_Buster_AboutSentenza_Info;
permanent = FALSE;
description = "Co s tím Sentenzou?";
};
func int DIA_Buster_AboutSentenza_Condition()
{
if(Buster_SentenzaTip == TRUE)
{
return TRUE;
};
};
func void DIA_Buster_AboutSentenza_Info()
{
AI_Output(other,self,"DIA_Buster_AboutSentenza_15_00"); //Co s tím Sentenzou?
AI_Output(self,other,"DIA_Buster_AboutSentenza_13_01"); //Přijdeš na farmu, pokusí se z tebe vymáčknout nějaké peníze - to dělá všem nováčkům.
AI_Output(self,other,"DIA_Buster_AboutSentenza_13_02"); //A být na tvém místě, tak bych zaplatil. Sám jsem to svého času udělal. Dobré bylo, že mi pak dal svůj hlas.
AI_Output(self,other,"DIA_Buster_AboutSentenza_13_03"); //Říká, že jedna laskavost vyžaduje druhou. Tenkrát jsem tak přišel o všechny své peníze, ale nebylo to vlastně až tak moc. A nakonec jsem byl rád, že to tak dopadlo.
AI_Output(self,other,"DIA_Buster_AboutSentenza_13_04"); //Ve chvíli, když jsem viděl, jak zmlátil maníka, který se rozhodl NEZAPLATIT.
AI_Output(other,self,"DIA_Buster_AboutSentenza_15_05"); //Díky za radu.
AI_Output(self,other,"DIA_Buster_AboutSentenza_13_06"); //Rádo se stalo. Má pro tebe nějakou cenu?
Info_ClearChoices(DIA_Buster_AboutSentenza);
Info_AddChoice(DIA_Buster_AboutSentenza,"Ne.",DIA_Buster_AboutSentenza_No);
if(Npc_HasItems(other,ItMi_Gold) >= 5)
{
Info_AddChoice(DIA_Buster_AboutSentenza,"Tady máš - 5 zlatých.",DIA_Buster_AboutSentenza_Give);
};
};
func void DIA_Buster_AboutSentenza_Give()
{
AI_Output(other,self,"DIA_Buster_AboutSentenza_Give_15_00"); //Tady máš - 5 zlatých.
B_GiveInvItems(other,self,ItMi_Gold,5);
AI_Output(self,other,"DIA_Buster_AboutSentenza_Give_13_01"); //Díky, chlape. Zdá se, že si večer budu moc dát pár korbelů. Na to nezapomenu.
Buster_GoldZumBrennen = TRUE;
Buster_Bonus = 50;
Info_ClearChoices(DIA_Buster_AboutSentenza);
};
func void DIA_Buster_AboutSentenza_No()
{
AI_Output(other,self,"DIA_Buster_AboutSentenza_No_15_00"); //Ne.
AI_Output(self,other,"DIA_Buster_AboutSentenza_No_13_01"); //Myslel jsem si to.
Info_ClearChoices(DIA_Buster_AboutSentenza);
};
instance DIA_Buster_LeeLeader(C_Info)
{
npc = SLD_802_Buster;
nr = 2;
condition = DIA_Buster_LeeLeader_Condition;
information = DIA_Buster_LeeLeader_Info;
permanent = FALSE;
description = "Lee je šéf žoldáků, ne?";
};
func int DIA_Buster_LeeLeader_Condition()
{
if(Buster_Duell == TRUE)
{
return TRUE;
};
};
func void DIA_Buster_LeeLeader_Info()
{
AI_Output(other,self,"DIA_Buster_LeeLeader_15_00"); //Lee je šéf žoldáků, ne?
AI_Output(self,other,"DIA_Buster_LeeLeader_13_01"); //Přesně tak - hej, už jsem si vzpomněl, odkud tě znám! Tys byl také v kolonii.
AI_Output(other,self,"DIA_Buster_LeeLeader_15_02"); //No... (s povzdechem) To jsem byl.
AI_Output(self,other,"DIA_Buster_LeeLeader_13_03"); //Neviděl jsem tě, když došlo k tomu velkému třesku. Ani hodnou chvíli předtím.
AI_Output(other,self,"DIA_Buster_LeeLeader_15_04"); //Měl jsem jiné starosti.
AI_Output(self,other,"DIA_Buster_LeeLeader_13_05"); //Tos o hodně přišel - co jsme byli v lochu, tak se dost věcí změnilo.
};
instance DIA_Buster_WhatHappened(C_Info)
{
npc = SLD_802_Buster;
nr = 2;
condition = DIA_Buster_WhatHappened_Condition;
information = DIA_Buster_WhatHappened_Info;
permanent = FALSE;
description = "Co se stalo se žoldáky v kolonii?";
};
func int DIA_Buster_WhatHappened_Condition()
{
if(Npc_KnowsInfo(other,DIA_Buster_LeeLeader) && ((hero.guild != GIL_SLD) && (hero.guild != GIL_DJG)))
{
return TRUE;
};
};
func void DIA_Buster_WhatHappened_Info()
{
AI_Output(other,self,"DIA_Buster_WhatHappened_15_00"); //Co se stalo se žoldáky v kolonii?
AI_Output(self,other,"DIA_Buster_WhatHappened_13_01"); //Jakmile bariéra padla, vyvedl nás Lee z kolonie. Říkal, že když budeme držet pohromadě, tak se nám nic nestane. A měl pravdu.
AI_Output(self,other,"DIA_Buster_WhatHappened_13_02"); //Netrvalo dlouho a našli jsme si tady hezké místečko. Statkář nám platí, abychom zametali s domobranou z města.
AI_Output(self,other,"DIA_Buster_WhatHappened_13_03"); //A většina z nás by do toho šla dobrovolně i zadarmo.
AI_Output(self,other,"DIA_Buster_WhatHappened_13_04"); //Ale Onar nám dává jídlo a aspoň tak můžeme nějak zabít čas, než se naskytne nějaká příležitost pláchnout z tohohle mizerného ostrova.
};
instance DIA_Buster_KAP3_EXIT(C_Info)
{
npc = SLD_802_Buster;
nr = 999;
condition = DIA_Buster_KAP3_EXIT_Condition;
information = DIA_Buster_KAP3_EXIT_Info;
permanent = TRUE;
description = Dialog_Ende;
};
func int DIA_Buster_KAP3_EXIT_Condition()
{
if(Kapitel == 3)
{
return TRUE;
};
};
func void DIA_Buster_KAP3_EXIT_Info()
{
AI_StopProcessInfos(self);
};
instance DIA_Buster_SHADOWBEASTS(C_Info)
{
npc = SLD_802_Buster;
nr = 30;
condition = DIA_Buster_SHADOWBEASTS_Condition;
information = DIA_Buster_SHADOWBEASTS_Info;
permanent = FALSE;
important = TRUE;
};
func int DIA_Buster_SHADOWBEASTS_Condition()
{
if((Kapitel >= 3) && (BUSTERDUELOK == TRUE))
{
return TRUE;
};
};
func void B_DIA_Buster_SHADOWBEASTS_OK()
{
AI_StopProcessInfos(self);
};
func void DIA_Buster_SHADOWBEASTS_Info()
{
AI_Output(self,other,"DIA_Buster_SHADOWBEASTS_13_00"); //Hej, ty, chlape!
AI_Output(other,self,"DIA_Buster_SHADOWBEASTS_15_01"); //Co chceš?
AI_Output(self,other,"DIA_Buster_SHADOWBEASTS_13_02"); //Posledních pár dní jsem přemýšlel, jak v téhle díře přijít k nějakým snadným penězům.
AI_Output(other,self,"DIA_Buster_SHADOWBEASTS_15_03"); //A?
AI_Output(self,other,"DIA_Buster_SHADOWBEASTS_13_04"); //Myslím, že jsem přišel na to, jak nějaké prachy získat.
AI_Output(self,other,"DIA_Buster_SHADOWBEASTS_13_05"); //Jeden kupec z města vyklopí za jistou věc pěknej balík.
Info_ClearChoices(DIA_Buster_SHADOWBEASTS);
Info_AddChoice(DIA_Buster_SHADOWBEASTS,"Co je to za kupce, o kterém mluvíš?",DIA_Buster_SHADOWBEASTS_wer);
Info_AddChoice(DIA_Buster_SHADOWBEASTS,"O co jde?",DIA_Buster_SHADOWBEASTS_was);
Info_AddChoice(DIA_Buster_SHADOWBEASTS,"Proč mi to říkáš?",DIA_Buster_SHADOWBEASTS_ich);
};
func void DIA_Buster_SHADOWBEASTS_ich()
{
AI_Output(other,self,"DIA_Buster_SHADOWBEASTS_ich_15_00"); //Proč mi to říkáš?
AI_Output(self,other,"DIA_Buster_SHADOWBEASTS_ich_13_01"); //Nemůžu do toho jít sám. Musím zůstat tady a dávat pozor na ty pitomé ovce.
AI_Output(other,self,"DIA_Buster_SHADOWBEASTS_ich_15_02"); //Myslíš rolníky.
AI_Output(self,other,"DIA_Buster_SHADOWBEASTS_ich_13_03"); //Jak říkám.
};
func void DIA_Buster_SHADOWBEASTS_was()
{
AI_Output(other,self,"DIA_Buster_SHADOWBEASTS_was_15_00"); //O co jde?
AI_Output(self,other,"DIA_Buster_SHADOWBEASTS_was_13_01"); //Ten kupec tvrdí, že by mohl na tržišti velice dobře zpeněžit rohy stínové šelmy.
AI_Output(self,other,"DIA_Buster_SHADOWBEASTS_was_13_02"); //Někdo bude muset jít do lesa a ty stvůry pokosit. A to je právě práce pro tebe.
Info_AddChoice(DIA_Buster_SHADOWBEASTS,"Kolik z toho kouká?",DIA_Buster_SHADOWBEASTS_was_wieviel);
};
func void DIA_Buster_SHADOWBEASTS_was_wieviel()
{
AI_Output(other,self,"DIA_Buster_SHADOWBEASTS_was_wieviel_15_00"); //Kolik z toho kouká?
AI_Output(self,other,"DIA_Buster_SHADOWBEASTS_was_wieviel_13_01"); //Balík peněz, to ti povídám. Bude dost pro nás pro oba.
if(Buster_GoldZumBrennen == TRUE)
{
AI_Output(self,other,"DIA_Buster_SHADOWBEASTS_was_wieviel_13_02"); //A protože jsi mi tenkrát přinesl to zlato, udělám ti zvláštní cenu.
};
AI_Output(other,self,"DIA_Buster_SHADOWBEASTS_was_wieviel_15_03"); //To zní dobře! Dám ti vědět, až budu mít nějaké ty rohy.
MIS_Buster_KillShadowbeasts_DJG = LOG_Running;
Log_CreateTopic(TOPIC_Buster_KillShadowbeasts,LOG_MISSION);
Log_SetTopicStatus(TOPIC_Buster_KillShadowbeasts,LOG_Running);
B_LogEntry(TOPIC_Buster_KillShadowbeasts,"Buster mi nabídl dobrou cenu za každý roh stínové šelmy, který mu přinesu.");
Info_ClearChoices(DIA_Buster_SHADOWBEASTS);
};
func void DIA_Buster_SHADOWBEASTS_wer()
{
AI_Output(other,self,"DIA_Buster_SHADOWBEASTS_wer_15_00"); //Co je to za kupce, o kterém mluvíš?
AI_Output(self,other,"DIA_Buster_SHADOWBEASTS_wer_13_01"); //Tak to ne, kámo. Byl bych vážně pitomec, kdybych ti prozradil svůj zdroj. Chceš mě snad podfouknout?
AI_Output(self,other,"DIA_Buster_SHADOWBEASTS_wer_13_02"); //Buď se dohodneš SE MNOU, nebo vůbec. Kapišto?
};
instance DIA_Buster_TeachTrophyShadowbeast(C_Info)
{
npc = SLD_802_Buster;
nr = 2;
condition = DIA_Buster_TeachTrophyShadowbeast_Condition;
information = DIA_Buster_TeachTrophyShadowbeast_Info;
permanent = TRUE;
description = "Jak mám vykuchat stínovou šelmu?";
};
func int DIA_Buster_TeachTrophyShadowbeast_Condition()
{
if((MIS_Buster_KillShadowbeasts_DJG == LOG_Running) && (PLAYER_TALENT_TAKEANIMALTROPHY[TROPHY_ShadowHorn] == FALSE))
{
return TRUE;
};
};
func void DIA_Buster_TeachTrophyShadowbeast_Info()
{
AI_Output(other,self,"DIA_Buster_ANIMALTROPHYSHADOWBEAST_15_03"); //Jak mám vykuchat stínovou šelmu?
AI_Output(self,other,"DIA_Buster_ANIMALTROPHYSHADOWBEAST_13_04"); //Ty to nevíš? Teda chlape, čekal jsem od tebe víc!
Info_ClearChoices(DIA_Buster_TeachTrophyShadowbeast);
Info_AddChoice(DIA_Buster_TeachTrophyShadowbeast,Dialog_Back,DIA_Buster_TeachTrophyShadowbeast_back);
Info_AddChoice(DIA_Buster_TeachTrophyShadowbeast,b_buildlearnstringforsmithhunt("Vyjímání rohů stínových šelem",B_GetLearnCostTalent(other,NPC_TALENT_TAKEANIMALTROPHY,TROPHY_ShadowHorn)),DIA_Buster_TeachTrophyShadowbeast_teach);
};
func void DIA_Buster_TeachTrophyShadowbeast_teach()
{
AI_Output(other,self,"DIA_Buster_BringTrophyShadowbeast_teach_15_00"); //Nauč mě vyjmout roh stínové šelmy.
if(B_TeachPlayerTalentTakeAnimalTrophy(self,other,TROPHY_ShadowHorn))
{
AI_Output(self,other,"DIA_Buster_BringTrophyShadowbeast_teach_13_01"); //Tak poslouchej. Zabiješ stínovou šelmu a pak ji pravou rukou chytíš co nejpevněji za roh.
AI_Output(self,other,"DIA_Buster_BringTrophyShadowbeast_teach_13_02"); //Potom zarazíš nůž do jejího čela a kolem rohu vyřízneš žlábek.
AI_Output(self,other,"DIA_Buster_BringTrophyShadowbeast_teach_13_03"); //Nůž potom použiješ jako páku, roh odlomíš a dáš si ho do kapsy.
AI_Output(self,other,"DIA_Buster_BringTrophyShadowbeast_teach_13_04"); //No. A pak mi ho přineseš. To by pro tebe nemělo být až tak těžké.
};
Info_ClearChoices(DIA_Buster_TeachTrophyShadowbeast);
};
func void DIA_Buster_TeachTrophyShadowbeast_back()
{
Info_ClearChoices(DIA_Buster_TeachTrophyShadowbeast);
};
instance DIA_Buster_BringTrophyShadowbeast(C_Info)
{
npc = SLD_802_Buster;
nr = 2;
condition = DIA_Buster_BringTrophyShadowbeast_Condition;
information = DIA_Buster_BringTrophyShadowbeast_Info;
permanent = TRUE;
description = "K těm rohům stínové šelmy...";
};
func int DIA_Buster_BringTrophyShadowbeast_Condition()
{
if((MIS_Buster_KillShadowbeasts_DJG == LOG_Running) && (Npc_HasItems(other,ItAt_ShadowHorn) >= 1))
{
return TRUE;
};
};
func void DIA_Buster_BringTrophyShadowbeast_Info()
{
var int BusterTrophyShadowbeastCount;
var int XP_BringBusterTrophyShadowbeast;
var int XP_BringBusterTrophyShadowbeasts;
var int BustersBusterTrophyShadowbeastOffer;
var int BusterTrophyShadowbeastGeld;
if(Kapitel >= 5)
{
AI_Output(self,other,"DIA_Buster_BringTrophyShadowbeast_13_00"); //Můj kupec nám dal sbohem.
AI_Output(other,self,"DIA_Buster_BringTrophyShadowbeast_15_01"); //Co to má znamenat?
AI_Output(self,other,"DIA_Buster_BringTrophyShadowbeast_13_02"); //Je mrtvý. Klidně si ty rohy nech. Stejně nevím, co bych s nimi teď dělal!
MIS_Buster_KillShadowbeasts_DJG = LOG_SUCCESS;
B_GivePlayerXP(XP_Ambient);
}
else
{
BusterTrophyShadowbeastCount = Npc_HasItems(other,ItAt_ShadowHorn);
if(BusterTrophyShadowbeastCount == 1)
{
XP_BringBusterTrophyShadowbeast = Shadowbeast.level * XP_PER_VICTORY;
BustersBusterTrophyShadowbeastOffer = Buster_Bonus + 100;
AI_Output(other,self,"DIA_Buster_BringTrophyShadowbeast_15_05"); //Přinesl jsem si roh stínové šelmy.
B_GivePlayerXP(XP_BringBusterTrophyShadowbeast);
B_GiveInvItems(other,self,ItAt_ShadowHorn,1);
Npc_RemoveInvItems(self,ItAt_ShadowHorn,Npc_HasItems(self,ItAt_ShadowHorn));
AI_Output(self,other,"DIA_Buster_BringTrophyShadowbeast_13_07"); //Skvělé. Ukaž. A přines jich víc. Kdo ví, jak dlouho bude ten kupec tyhle věci ještě chtít.
AI_Output(self,other,"DIA_Buster_BringTrophyShadowbeast_13_08"); //Tady je tvůj podíl.
BusterTrophyShadowbeastGeld = BusterTrophyShadowbeastCount * BustersBusterTrophyShadowbeastOffer;
CreateInvItems(self,ItMi_Gold,BusterTrophyShadowbeastGeld);
B_GiveInvItems(self,other,ItMi_Gold,BusterTrophyShadowbeastGeld);
}
else if(BusterTrophyShadowbeastCount > 1)
{
XP_BringBusterTrophyShadowbeast = Shadowbeast.level * XP_PER_VICTORY;
BustersBusterTrophyShadowbeastOffer = Buster_Bonus + 100;
AI_Output(other,self,"DIA_Buster_BringTrophyShadowbeast_15_06"); //Přinesl jsem ti rohy stinové šelmy.
B_GiveInvItems(other,self,ItAt_ShadowHorn,BusterTrophyShadowbeastCount);
Npc_RemoveInvItems(self,ItAt_ShadowHorn,Npc_HasItems(self,ItAt_ShadowHorn));
XP_BringBusterTrophyShadowbeasts = BusterTrophyShadowbeastCount * XP_BringBusterTrophyShadowbeast;
B_GivePlayerXP(XP_BringBusterTrophyShadowbeasts);
AI_Output(self,other,"DIA_Buster_BringTrophyShadowbeast_13_07"); //Skvělé. Ukaž. A přines jich víc. Kdo ví, jak dlouho bude ten kupec tyhle věci ještě chtít.
AI_Output(self,other,"DIA_Buster_BringTrophyShadowbeast_13_08"); //Tady je tvůj podíl.
BusterTrophyShadowbeastGeld = BusterTrophyShadowbeastCount * BustersBusterTrophyShadowbeastOffer;
CreateInvItems(self,ItMi_Gold,BusterTrophyShadowbeastGeld);
B_GiveInvItems(self,other,ItMi_Gold,BusterTrophyShadowbeastGeld);
}
else
{
AI_Output(other,self,"DIA_Buster_BringTrophyShadowbeast_back_15_00"); //Přinesu více.
AI_Output(self,other,"DIA_Buster_BringTrophyShadowbeast_back_13_01"); //Doufám.
};
};
};
instance DIA_Buster_KAP4_EXIT(C_Info)
{
npc = SLD_802_Buster;
nr = 999;
condition = DIA_Buster_KAP4_EXIT_Condition;
information = DIA_Buster_KAP4_EXIT_Info;
permanent = TRUE;
description = Dialog_Ende;
};
func int DIA_Buster_KAP4_EXIT_Condition()
{
if(Kapitel == 4)
{
return TRUE;
};
};
func void DIA_Buster_KAP4_EXIT_Info()
{
AI_StopProcessInfos(self);
};
instance DIA_Buster_Perm4(C_Info)
{
npc = SLD_802_Buster;
nr = 2;
condition = DIA_Buster_Perm4_Condition;
information = DIA_Buster_Perm4_Info;
permanent = TRUE;
description = "Co si myslíš o celé té drakobijecké záležitosti?";
};
func int DIA_Buster_Perm4_Condition()
{
if(Kapitel >= 4)
{
return TRUE;
};
};
func void DIA_Buster_Perm4_Info()
{
AI_Output(other,self,"DIA_Buster_Perm4_15_00"); //Co si myslíš o celé té drakobijecké záležitosti?
AI_Output(self,other,"DIA_Buster_Perm4_13_01"); //Hoši by z toho mohli vytřískat docela dost zlata - pokud dřív nezaklepou bačkorama.
AI_Output(self,other,"DIA_Buster_Perm4_13_02"); //Já osobně se radši držím Leeho.
};
instance DIA_Buster_KAP5_EXIT(C_Info)
{
npc = SLD_802_Buster;
nr = 999;
condition = DIA_Buster_KAP5_EXIT_Condition;
information = DIA_Buster_KAP5_EXIT_Info;
permanent = TRUE;
description = Dialog_Ende;
};
func int DIA_Buster_KAP5_EXIT_Condition()
{
if(Kapitel == 5)
{
return TRUE;
};
};
func void DIA_Buster_KAP5_EXIT_Info()
{
AI_StopProcessInfos(self);
};
instance DIA_Buster_KAP6_EXIT(C_Info)
{
npc = SLD_802_Buster;
nr = 999;
condition = DIA_Buster_KAP6_EXIT_Condition;
information = DIA_Buster_KAP6_EXIT_Info;
permanent = TRUE;
description = Dialog_Ende;
};
func int DIA_Buster_KAP6_EXIT_Condition()
{
if(Kapitel >= 6)
{
return TRUE;
};
};
func void DIA_Buster_KAP6_EXIT_Info()
{
AI_StopProcessInfos(self);
};
instance DIA_Buster_PICKPOCKET(C_Info)
{
npc = SLD_802_Buster;
nr = 900;
condition = DIA_Buster_PICKPOCKET_Condition;
information = DIA_Buster_PICKPOCKET_Info;
permanent = TRUE;
description = PICKPOCKET_COMM;
};
func int DIA_Buster_PICKPOCKET_Condition()
{
return C_Beklauen(34,60);
};
func void DIA_Buster_PICKPOCKET_Info()
{
Info_ClearChoices(DIA_Buster_PICKPOCKET);
Info_AddChoice(DIA_Buster_PICKPOCKET,Dialog_Back,DIA_Buster_PICKPOCKET_BACK);
Info_AddChoice(DIA_Buster_PICKPOCKET,DIALOG_PICKPOCKET,DIA_Buster_PICKPOCKET_DoIt);
};
func void DIA_Buster_PICKPOCKET_DoIt()
{
B_Beklauen();
Info_ClearChoices(DIA_Buster_PICKPOCKET);
};
func void DIA_Buster_PICKPOCKET_BACK()
{
Info_ClearChoices(DIA_Buster_PICKPOCKET);
};
| D |
module app;
private import TestWindow;
private import TestTreeView1;
private import TestTreeView;
private import TestThemes;
private import TestText;
private import TestStock;
private import TestScales;
private import TestImage;
private import TestIdle;
private import TestEntries;
private import TestDrawingArea;
private import TestAspectFrame;
private import TTextView;
//private import TEditableCells;
| D |
/**
* Copyright © 2018 - 2019 Sergei Iurevich Filippov, All Rights Reserved.
*
* 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.
*
* Cuda runtime API types.
*/
module cuda.cudaruntimeapi.types;
immutable uint cudaMemAttachGlobal = 0x01;
immutable uint cudaMemAttachHost = 0x02;
alias cudaStream_t = CUstream_st*;
private struct CUstream_st;
struct dim3
{
uint x = 1;
uint y = 1;
uint z = 1;
this(uint x, uint y, uint z)
{
this.x = x;
this.y = y;
this.z = z;
}
}
enum cudaError_t
{
cudaSuccess = 0,
cudaErrorMissingConfiguration = 1,
cudaErrorMemoryAllocation = 2,
cudaErrorInitializationError = 3,
cudaErrorLaunchFailure = 4,
cudaErrorPriorLaunchFailure = 5,
cudaErrorLaunchTimeout = 6,
cudaErrorLaunchOutOfResources = 7,
cudaErrorInvalidDeviceFunction = 8,
cudaErrorInvalidConfiguration = 9,
cudaErrorInvalidDevice = 10,
cudaErrorInvalidValue = 11,
cudaErrorInvalidPitchValue = 12,
cudaErrorInvalidSymbol = 13,
cudaErrorMapBufferObjectFailed = 14,
cudaErrorUnmapBufferObjectFailed = 15,
cudaErrorInvalidHostPointer = 16,
cudaErrorInvalidDevicePointer = 17,
cudaErrorInvalidTexture = 18,
cudaErrorInvalidTextureBinding = 19,
cudaErrorInvalidChannelDescriptor = 20,
cudaErrorInvalidMemcpyDirection = 21,
cudaErrorAddressOfConstant = 22,
cudaErrorTextureFetchFailed = 23,
cudaErrorTextureNotBound = 24,
cudaErrorSynchronizationError = 25,
cudaErrorInvalidFilterSetting = 26,
cudaErrorInvalidNormSetting = 27,
cudaErrorMixedDeviceExecution = 28,
cudaErrorCudartUnloading = 29,
cudaErrorNotYetImplemented = 31,
cudaErrorMemoryValueTooLarge = 32,
cudaErrorInvalidResourceHandle = 33,
cudaErrorNotReady = 34,
cudaErrorInsufficientDriver = 35,
cudaErrorSetOnActiveProcess = 36,
cudaErrorInvalidSurface = 37,
cudaErrorNoDevice = 38,
cudaErrorECCUncorrectable = 39,
cudaErrorSharedObjectSymbolNotFound = 40,
cudaErrorSharedObjectInitFailed = 41,
cudaErrorUnsupportedLimit = 42,
cudaErrorDuplicateVariableName = 43,
cudaErrorDuplicateTextureName = 44,
cudaErrorDuplicateSurfaceName = 45,
cudaErrorDevicesUnavailable = 46,
cudaErrorInvalidKernelImage = 47,
cudaErrorNoKernelImageForDevice = 48,
cudaErrorIncompatibleDriverContext = 49,
cudaErrorPeerAccessAlreadyEnabled = 50,
cudaErrorPeerAccessNotEnabled = 51,
cudaErrorDeviceAlreadyInUse = 54,
cudaErrorProfilerDisabled = 55,
cudaErrorProfilerNotInitialized = 56,
cudaErrorProfilerAlreadyStarted = 57,
cudaErrorProfilerAlreadyStopped = 58,
cudaErrorAssert = 59,
cudaErrorTooManyPeers = 60,
cudaErrorHostMemoryAlreadyRegistered = 61,
cudaErrorHostMemoryNotRegistered = 62,
cudaErrorOperatingSystem = 63,
cudaErrorPeerAccessUnsupported = 64,
cudaErrorLaunchMaxDepthExceeded = 65,
cudaErrorLaunchFileScopedTex = 66,
cudaErrorLaunchFileScopedSurf = 67,
cudaErrorSyncDepthExceeded = 68,
cudaErrorLaunchPendingCountExceeded = 69,
cudaErrorNotPermitted = 70,
cudaErrorNotSupported = 71,
cudaErrorHardwareStackError = 72,
cudaErrorIllegalInstruction = 73,
cudaErrorMisalignedAddress = 74,
cudaErrorInvalidAddressSpace = 75,
cudaErrorInvalidPc = 76,
cudaErrorIllegalAddress = 77,
cudaErrorInvalidPtx = 78,
cudaErrorInvalidGraphicsContext = 79,
cudaErrorNvlinkUncorrectable = 80,
cudaErrorJitCompilerNotFound = 81,
cudaErrorCooperativeLaunchTooLarge = 82,
cudaErrorStartupFailure = 0x7f,
cudaErrorApiFailureBase = 10000
}
enum cudaMemcpyKind
{
cudaMemcpyHostToHost = 0,
cudaMemcpyHostToDevice = 1,
cudaMemcpyDeviceToHost = 2,
cudaMemcpyDeviceToDevice = 3,
cudaMemcpyDefault = 4
}
| D |
vt$ier (6) --- report error in VTH initialization file 07/11/84
| _C_a_l_l_i_n_g _I_n_f_o_r_m_a_t_i_o_n
integer function vt$ier (msg, name, line, fd)
character msg (ARB), name (ARB), line (ARB)
file_des fd
| Library: vswtlb (standard Subsystem library)
_F_u_n_c_t_i_o_n
'Vt$ier' is used to report an error in the contents of the
terminal characteristics file (=vth=/?*). The file name
'name', a message 'msg' explaining the error, and the line
'line' from the file which caused the error are printed to
ERROUT.
_I_m_p_l_e_m_e_n_t_a_t_i_o_n
'Vt$ier' calls 'print' to output the file name, the error
message, and the erroneous line from the file to ERROUT.
The VTH initialization file indicated by 'fd' is closed, and
the function returns ERR.
_C_a_l_l_s
close, print
_B_u_g_s
Not meant to be called by the normal user.
_S_e_e _A_l_s_o
other vt?* routines (2) and (6)
vt$ier (6) - 1 - vt$ier (6)
| D |
/**
* Forms the symbols available to all D programs. Includes Object, which is
* the root of the class object hierarchy. This module is implicitly
* imported.
* Macros:
* WIKI = Object
*
* 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;
//debug=PRINTF;
private
{
import core.atomic;
import core.stdc.string;
import core.stdc.stdlib;
import core.memory;
import rt.util.hash;
import rt.util.string;
import rt.minfo;
debug(PRINTF) import core.stdc.stdio;
extern (C) void onOutOfMemoryError(void* pretend_sideffect = null) @trusted pure nothrow; /* dmd @@@BUG11461@@@ */
extern (C) Object _d_newclass(const TypeInfo_Class ci);
extern (C) void _d_arrayshrinkfit(const TypeInfo ti, void[] arr) nothrow;
extern (C) size_t _d_arraysetcapacity(const TypeInfo ti, size_t newcapacity, void *arrptr) pure nothrow;
extern (C) void rt_finalize(void *data, bool det=true);
}
version (druntime_unittest)
{
string __unittest_toString(T)(T) { return T.stringof; }
}
// NOTE: For some reason, this declaration method doesn't work
// in this particular file (and this file only). It must
// be a DMD thing.
//alias typeof(int.sizeof) size_t;
//alias typeof(cast(void*)0 - cast(void*)0) ptrdiff_t;
version(D_LP64)
{
alias ulong size_t;
alias long ptrdiff_t;
}
else
{
alias uint size_t;
alias int 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;
/**
* All D class objects inherit from Object.
*/
class Object
{
/**
* Convert Object to a human readable string.
*/
string toString()
{
return typeid(this).name;
}
/**
* Compute hash function for Object.
*/
size_t toHash() @trusted nothrow
{
// BUG: this prevents a compacting GC from working, needs to be fixed
return cast(size_t)cast(void*)this;
}
/**
* Compare with another Object obj.
* Returns:
* $(TABLE
* $(TR $(TD this < obj) $(TD < 0))
* $(TR $(TD this == obj) $(TD 0))
* $(TR $(TD this > obj) $(TD > 0))
* )
*/
int opCmp(Object o)
{
// BUG: this prevents a compacting GC from working, needs to be fixed
//return cast(int)cast(void*)this - cast(int)cast(void*)o;
throw new Exception("need opCmp for class " ~ typeid(this).name);
//return this !is o;
}
/**
* Returns !=0 if this object does have the same contents as obj.
*/
bool opEquals(Object o)
{
return this is o;
}
interface Monitor
{
void lock();
void unlock();
}
/**
* Create instance of class specified by the fully qualified name
* classname.
* The class must either have no constructors or have
* a default constructor.
* Returns:
* null if failed
* Example:
* ---
* module foo.bar;
*
* class C
* {
* this() { x = 10; }
* int x;
* }
*
* void main()
* {
* auto c = cast(C)Object.factory("foo.bar.C");
* assert(c !is null && c.x == 10);
* }
* ---
*/
static Object factory(string classname)
{
auto ci = TypeInfo_Class.find(classname);
if (ci)
{
return ci.create();
}
return null;
}
}
/************************
* Returns true if lhs and rhs are equal.
*/
bool opEquals(const Object lhs, const Object rhs)
{
// A hack for the moment.
return opEquals(cast()lhs, cast()rhs);
}
bool opEquals(Object lhs, Object rhs)
{
// If aliased to the same object or both null => equal
if (lhs is rhs) return true;
// If either is null => non-equal
if (lhs is null || rhs is null) return false;
// If same exact type => one call to method opEquals
if (typeid(lhs) is typeid(rhs) || typeid(lhs).opEquals(typeid(rhs)))
return lhs.opEquals(rhs);
// General case => symmetric calls to method opEquals
return lhs.opEquals(rhs) && rhs.opEquals(lhs);
}
/**
* Information about an interface.
* When an object is accessed via an interface, an Interface* appears as the
* first entry in its vtbl.
*/
struct Interface
{
TypeInfo_Class classinfo; /// .classinfo for this interface (not for containing class)
void*[] vtbl;
size_t offset; /// offset to Interface 'this' from Object 'this'
}
/**
* Runtime type information about a class. Can be retrieved for any class type
* or instance by using the .classinfo property.
* A pointer to this appears as the first entry in the class's vtbl[].
*/
alias TypeInfo_Class Classinfo;
/**
* Array of pairs giving the offset and type information for each
* member in an aggregate.
*/
struct OffsetTypeInfo
{
size_t offset; /// Offset of member from start of object
TypeInfo ti; /// TypeInfo for this member
}
/**
* Runtime type information about a type.
* Can be retrieved for any type using a
* <a href="../expression.html#typeidexpression">TypeidExpression</a>.
*/
class TypeInfo
{
override string toString() const pure @safe nothrow
{
return typeid(this).name;
}
override size_t toHash() @trusted const
{
try
{
auto data = this.toString();
return hashOf(data.ptr, data.length);
}
catch (Throwable)
{
// This should never happen; remove when toString() is made nothrow
// BUG: this prevents a compacting GC from working, needs to be fixed
return cast(size_t)cast(void*)this;
}
}
override int opCmp(Object o)
{
if (this is o)
return 0;
TypeInfo ti = cast(TypeInfo)o;
if (ti is null)
return 1;
return dstrcmp(this.toString(), ti.toString());
}
override bool opEquals(Object o)
{
/* TypeInfo instances are singletons, but duplicates can exist
* across DLL's. Therefore, comparing for a name match is
* sufficient.
*/
if (this is o)
return true;
auto ti = cast(const TypeInfo)o;
return ti && this.toString() == ti.toString();
}
/// Returns a hash of the instance of a type.
size_t getHash(in void* p) @trusted nothrow const { return cast(size_t)p; }
/// Compares two instances for equality.
bool equals(in void* p1, in void* p2) const { return p1 == p2; }
/// Compares two instances for <, ==, or >.
int compare(in void* p1, in void* p2) const { return 0; }
/// Returns size of the type.
@property size_t tsize() nothrow pure const @safe { return 0; }
/// Swaps two instances of the type.
void swap(void* p1, void* p2) const
{
size_t n = tsize;
for (size_t i = 0; i < n; i++)
{
byte t = (cast(byte *)p1)[i];
(cast(byte*)p1)[i] = (cast(byte*)p2)[i];
(cast(byte*)p2)[i] = t;
}
}
/// Get TypeInfo for 'next' type, as defined by what kind of type this is,
/// null if none.
@property inout(TypeInfo) next() nothrow pure inout { return null; }
/// Return default initializer. If the type should be initialized to all zeros,
/// an array with a null ptr and a length equal to the type size will be returned.
// TODO: make this a property, but may need to be renamed to diambiguate with T.init...
const(void)[] init() nothrow pure const @safe { return null; }
/// Get flags for type: 1 means GC should scan for pointers,
/// 2 means arg of this type is passed in XMM register
@property uint flags() nothrow pure const @safe { return 0; }
/// Get type information on the contents of the type; null if not available
const(OffsetTypeInfo)[] offTi() const { return null; }
/// Run the destructor on the object and all its sub-objects
void destroy(void* p) const {}
/// Run the postblit on the object and all its sub-objects
void postblit(void* p) const {}
/// Return alignment of type
@property size_t talign() nothrow pure const @safe { return tsize; }
/** Return internal info on arguments fitting into 8byte.
* See X86-64 ABI 3.2.3
*/
version (X86_64) int argTypes(out TypeInfo arg1, out TypeInfo arg2) @safe nothrow
{
arg1 = this;
return 0;
}
/** Return info used by the garbage collector to do precise collection.
*/
@property immutable(void)* rtInfo() nothrow pure const @safe { return null; }
}
class TypeInfo_Typedef : TypeInfo
{
override string toString() const { return name; }
override bool opEquals(Object o)
{
if (this is o)
return true;
auto c = cast(const TypeInfo_Typedef)o;
return c && this.name == c.name &&
this.base == c.base;
}
override size_t getHash(in void* p) const { return base.getHash(p); }
override bool equals(in void* p1, in void* p2) const { return base.equals(p1, p2); }
override int compare(in void* p1, in void* p2) const { return base.compare(p1, p2); }
override @property size_t tsize() nothrow pure const { return base.tsize; }
override void swap(void* p1, void* p2) const { return base.swap(p1, p2); }
override @property inout(TypeInfo) next() nothrow pure inout { return base.next; }
override @property uint flags() nothrow pure const { return base.flags; }
override const(void)[] init() nothrow pure const @safe { return m_init.length ? m_init : base.init(); }
override @property size_t talign() nothrow pure const { return base.talign; }
version (X86_64) override int argTypes(out TypeInfo arg1, out TypeInfo arg2)
{
return base.argTypes(arg1, arg2);
}
override @property immutable(void)* rtInfo() const { return base.rtInfo; }
TypeInfo base;
string name;
void[] m_init;
}
class TypeInfo_Enum : TypeInfo_Typedef
{
}
class TypeInfo_Pointer : TypeInfo
{
override string toString() const { return m_next.toString() ~ "*"; }
override bool opEquals(Object o)
{
if (this is o)
return true;
auto c = cast(const TypeInfo_Pointer)o;
return c && this.m_next == c.m_next;
}
override size_t getHash(in void* p) @trusted const
{
return cast(size_t)*cast(void**)p;
}
override bool equals(in void* p1, in void* p2) const
{
return *cast(void**)p1 == *cast(void**)p2;
}
override int compare(in void* p1, in void* p2) const
{
if (*cast(void**)p1 < *cast(void**)p2)
return -1;
else if (*cast(void**)p1 > *cast(void**)p2)
return 1;
else
return 0;
}
override @property size_t tsize() nothrow pure const
{
return (void*).sizeof;
}
override void swap(void* p1, void* p2) const
{
void* tmp = *cast(void**)p1;
*cast(void**)p1 = *cast(void**)p2;
*cast(void**)p2 = tmp;
}
override @property inout(TypeInfo) next() nothrow pure inout { return m_next; }
override @property uint flags() nothrow pure const { return 1; }
TypeInfo m_next;
}
class TypeInfo_Array : TypeInfo
{
override string toString() const { return value.toString() ~ "[]"; }
override bool opEquals(Object o)
{
if (this is o)
return true;
auto c = cast(const TypeInfo_Array)o;
return c && this.value == c.value;
}
override size_t getHash(in void* p) @trusted const
{
void[] a = *cast(void[]*)p;
return getArrayHash(value, a.ptr, a.length);
}
override bool equals(in void* p1, in void* p2) const
{
void[] a1 = *cast(void[]*)p1;
void[] a2 = *cast(void[]*)p2;
if (a1.length != a2.length)
return false;
size_t sz = value.tsize;
for (size_t i = 0; i < a1.length; i++)
{
if (!value.equals(a1.ptr + i * sz, a2.ptr + i * sz))
return false;
}
return true;
}
override int compare(in void* p1, in void* p2) const
{
void[] a1 = *cast(void[]*)p1;
void[] a2 = *cast(void[]*)p2;
size_t sz = value.tsize;
size_t len = a1.length;
if (a2.length < len)
len = a2.length;
for (size_t u = 0; u < len; u++)
{
int result = value.compare(a1.ptr + u * sz, a2.ptr + u * sz);
if (result)
return result;
}
return cast(int)a1.length - cast(int)a2.length;
}
override @property size_t tsize() nothrow pure const
{
return (void[]).sizeof;
}
override void swap(void* p1, void* p2) const
{
void[] tmp = *cast(void[]*)p1;
*cast(void[]*)p1 = *cast(void[]*)p2;
*cast(void[]*)p2 = tmp;
}
TypeInfo value;
override @property inout(TypeInfo) next() nothrow pure inout
{
return value;
}
override @property uint flags() nothrow pure const { return 1; }
override @property size_t talign() nothrow pure const
{
return (void[]).alignof;
}
version (X86_64) override int argTypes(out TypeInfo arg1, out TypeInfo arg2)
{
arg1 = typeid(size_t);
arg2 = typeid(void*);
return 0;
}
}
class TypeInfo_StaticArray : TypeInfo
{
override string toString() const
{
SizeStringBuff tmpBuff = void;
return value.toString() ~ "[" ~ len.sizeToTempString(tmpBuff) ~ "]";
}
override bool opEquals(Object o)
{
if (this is o)
return true;
auto c = cast(const TypeInfo_StaticArray)o;
return c && this.len == c.len &&
this.value == c.value;
}
override size_t getHash(in void* p) @trusted const
{
return getArrayHash(value, p, len);
}
override bool equals(in void* p1, in void* p2) const
{
size_t sz = value.tsize;
for (size_t u = 0; u < len; u++)
{
if (!value.equals(p1 + u * sz, p2 + u * sz))
return false;
}
return true;
}
override int compare(in void* p1, in void* p2) const
{
size_t sz = value.tsize;
for (size_t u = 0; u < len; u++)
{
int result = value.compare(p1 + u * sz, p2 + u * sz);
if (result)
return result;
}
return 0;
}
override @property size_t tsize() nothrow pure const
{
return len * value.tsize;
}
override void swap(void* p1, void* p2) const
{
void* tmp;
size_t sz = value.tsize;
ubyte[16] buffer;
void* pbuffer;
if (sz < buffer.sizeof)
tmp = buffer.ptr;
else
tmp = pbuffer = (new void[sz]).ptr;
for (size_t u = 0; u < len; u += sz)
{
size_t o = u * sz;
memcpy(tmp, p1 + o, sz);
memcpy(p1 + o, p2 + o, sz);
memcpy(p2 + o, tmp, sz);
}
if (pbuffer)
GC.free(pbuffer);
}
override const(void)[] init() nothrow pure const { return value.init(); }
override @property inout(TypeInfo) next() nothrow pure inout { return value; }
override @property uint flags() nothrow pure const { return value.flags; }
override void destroy(void* p) const
{
auto sz = value.tsize;
p += sz * len;
foreach (i; 0 .. len)
{
p -= sz;
value.destroy(p);
}
}
override void postblit(void* p) const
{
auto sz = value.tsize;
foreach (i; 0 .. len)
{
value.postblit(p);
p += sz;
}
}
TypeInfo value;
size_t len;
override @property size_t talign() nothrow pure const
{
return value.talign;
}
version (X86_64) override int argTypes(out TypeInfo arg1, out TypeInfo arg2)
{
arg1 = typeid(void*);
return 0;
}
}
class TypeInfo_AssociativeArray : TypeInfo
{
override string toString() const
{
return value.toString() ~ "[" ~ key.toString() ~ "]";
}
override bool opEquals(Object o)
{
if (this is o)
return true;
auto c = cast(const TypeInfo_AssociativeArray)o;
return c && this.key == c.key &&
this.value == c.value;
}
override bool equals(in void* p1, in void* p2) @trusted const
{
return !!_aaEqual(this, *cast(const void**) p1, *cast(const void**) p2);
}
override int compare(in void* p1, in void* p2) const
{
// This is a hack to fix Issue 10380 because AA uses
// `compare` instead of `equals`.
return !equals(p1, p2);
}
override hash_t getHash(in void* p) nothrow @trusted const
{
return _aaGetHash(cast(void*)p, this);
}
// BUG: need to add the rest of the functions
override @property size_t tsize() nothrow pure const
{
return (char[int]).sizeof;
}
override @property inout(TypeInfo) next() nothrow pure inout { return value; }
override @property uint flags() nothrow pure const { return 1; }
TypeInfo value;
TypeInfo key;
override @property size_t talign() nothrow pure const
{
return (char[int]).alignof;
}
version (X86_64) override int argTypes(out TypeInfo arg1, out TypeInfo arg2)
{
arg1 = typeid(void*);
return 0;
}
}
class TypeInfo_Vector : TypeInfo
{
override string toString() const { return "__vector(" ~ base.toString() ~ ")"; }
override bool opEquals(Object o)
{
if (this is o)
return true;
auto c = cast(const TypeInfo_Vector)o;
return c && this.base == c.base;
}
override size_t getHash(in void* p) const { return base.getHash(p); }
override bool equals(in void* p1, in void* p2) const { return base.equals(p1, p2); }
override int compare(in void* p1, in void* p2) const { return base.compare(p1, p2); }
override @property size_t tsize() nothrow pure const { return base.tsize; }
override void swap(void* p1, void* p2) const { return base.swap(p1, p2); }
override @property inout(TypeInfo) next() nothrow pure inout { return base.next; }
override @property uint flags() nothrow pure const { return base.flags; }
override const(void)[] init() nothrow pure const { return base.init(); }
override @property size_t talign() nothrow pure const { return 16; }
version (X86_64) override int argTypes(out TypeInfo arg1, out TypeInfo arg2)
{
return base.argTypes(arg1, arg2);
}
TypeInfo base;
}
class TypeInfo_Function : TypeInfo
{
override string toString() const
{
return cast(string)(next.toString() ~ "()");
}
override bool opEquals(Object o)
{
if (this is o)
return true;
auto c = cast(const TypeInfo_Function)o;
return c && this.deco == c.deco;
}
// BUG: need to add the rest of the functions
override @property size_t tsize() nothrow pure const
{
return 0; // no size for functions
}
TypeInfo next;
string deco;
}
class TypeInfo_Delegate : TypeInfo
{
override string toString() const
{
return cast(string)(next.toString() ~ " delegate()");
}
override bool opEquals(Object o)
{
if (this is o)
return true;
auto c = cast(const TypeInfo_Delegate)o;
return c && this.deco == c.deco;
}
// BUG: need to add the rest of the functions
override @property size_t tsize() nothrow pure const
{
alias int delegate() dg;
return dg.sizeof;
}
override @property uint flags() nothrow pure const { return 1; }
TypeInfo next;
string deco;
override @property size_t talign() nothrow pure const
{
alias int delegate() dg;
return dg.alignof;
}
version (X86_64) override int argTypes(out TypeInfo arg1, out TypeInfo arg2)
{
arg1 = typeid(void*);
arg2 = typeid(void*);
return 0;
}
}
/**
* Runtime type information about a class.
* Can be retrieved from an object instance by using the
* $(LINK2 ../property.html#classinfo, .classinfo) property.
*/
class TypeInfo_Class : TypeInfo
{
override string toString() const { return info.name; }
override bool opEquals(Object o)
{
if (this is o)
return true;
auto c = cast(const TypeInfo_Class)o;
return c && this.info.name == c.info.name;
}
override size_t getHash(in void* p) @trusted const
{
auto o = *cast(Object*)p;
return o ? o.toHash() : 0;
}
override bool equals(in void* p1, in void* p2) const
{
Object o1 = *cast(Object*)p1;
Object o2 = *cast(Object*)p2;
return (o1 is o2) || (o1 && o1.opEquals(o2));
}
override int compare(in void* p1, in void* p2) const
{
Object o1 = *cast(Object*)p1;
Object o2 = *cast(Object*)p2;
int c = 0;
// Regard null references as always being "less than"
if (o1 !is o2)
{
if (o1)
{
if (!o2)
c = 1;
else
c = o1.opCmp(o2);
}
else
c = -1;
}
return c;
}
override @property size_t tsize() nothrow pure const
{
return Object.sizeof;
}
override @property uint flags() nothrow pure const { return 1; }
override @property const(OffsetTypeInfo)[] offTi() nothrow pure const
{
return m_offTi;
}
@property auto info() @safe nothrow pure const { return this; }
@property auto typeinfo() @safe nothrow pure const { return this; }
byte[] init; /** class static initializer
* (init.length gives size in bytes of class)
*/
string name; /// class name
void*[] vtbl; /// virtual function pointer table
Interface[] interfaces; /// interfaces this class implements
TypeInfo_Class base; /// base class
void* destructor;
void function(Object) classInvariant;
enum ClassFlags : uint
{
isCOMclass = 0x1,
noPointers = 0x2,
hasOffTi = 0x4,
hasCtor = 0x8,
hasGetMembers = 0x10,
hasTypeInfo = 0x20,
isAbstract = 0x40,
isCPPclass = 0x80,
}
ClassFlags m_flags;
void* deallocator;
OffsetTypeInfo[] m_offTi;
void function(Object) defaultConstructor; // default Constructor
immutable(void)* m_RTInfo; // data for precise GC
override @property immutable(void)* rtInfo() const { return m_RTInfo; }
/**
* Search all modules for TypeInfo_Class corresponding to classname.
* Returns: null if not found
*/
static const(TypeInfo_Class) find(in char[] classname)
{
foreach (m; ModuleInfo)
{
if (m)
//writefln("module %s, %d", m.name, m.localClasses.length);
foreach (c; m.localClasses)
{
//writefln("\tclass %s", c.name);
if (c.name == classname)
return c;
}
}
return null;
}
/**
* Create instance of Object represented by 'this'.
*/
Object create() const
{
if (m_flags & 8 && !defaultConstructor)
return null;
if (m_flags & 64) // abstract
return null;
Object o = _d_newclass(this);
if (m_flags & 8 && defaultConstructor)
{
defaultConstructor(o);
}
return o;
}
}
alias TypeInfo_Class ClassInfo;
class TypeInfo_Interface : TypeInfo
{
override string toString() const { return info.name; }
override bool opEquals(Object o)
{
if (this is o)
return true;
auto c = cast(const TypeInfo_Interface)o;
return c && this.info.name == typeid(c).name;
}
override size_t getHash(in void* p) @trusted const
{
Interface* pi = **cast(Interface ***)*cast(void**)p;
Object o = cast(Object)(*cast(void**)p - pi.offset);
assert(o);
return o.toHash();
}
override bool equals(in void* p1, in void* p2) const
{
Interface* pi = **cast(Interface ***)*cast(void**)p1;
Object o1 = cast(Object)(*cast(void**)p1 - pi.offset);
pi = **cast(Interface ***)*cast(void**)p2;
Object o2 = cast(Object)(*cast(void**)p2 - pi.offset);
return o1 == o2 || (o1 && o1.opCmp(o2) == 0);
}
override int compare(in void* p1, in void* p2) const
{
Interface* pi = **cast(Interface ***)*cast(void**)p1;
Object o1 = cast(Object)(*cast(void**)p1 - pi.offset);
pi = **cast(Interface ***)*cast(void**)p2;
Object o2 = cast(Object)(*cast(void**)p2 - pi.offset);
int c = 0;
// Regard null references as always being "less than"
if (o1 != o2)
{
if (o1)
{
if (!o2)
c = 1;
else
c = o1.opCmp(o2);
}
else
c = -1;
}
return c;
}
override @property size_t tsize() nothrow pure const
{
return Object.sizeof;
}
override @property uint flags() nothrow pure const { return 1; }
TypeInfo_Class info;
}
class TypeInfo_Struct : TypeInfo
{
override string toString() const { return name; }
override bool opEquals(Object o)
{
if (this is o)
return true;
auto s = cast(const TypeInfo_Struct)o;
return s && this.name == s.name &&
this.init().length == s.init().length;
}
override size_t getHash(in void* p) @safe pure nothrow const
{
assert(p);
if (xtoHash)
{
return (*xtoHash)(p);
}
else
{
return hashOf(p, init().length);
}
}
override bool equals(in void* p1, in void* p2) @trusted pure nothrow const
{
if (!p1 || !p2)
return false;
else if (xopEquals)
return (*xopEquals)(p1, p2);
else if (p1 == p2)
return true;
else
// BUG: relies on the GC not moving objects
return memcmp(p1, p2, init().length) == 0;
}
override int compare(in void* p1, in void* p2) @trusted pure nothrow const
{
// Regard null references as always being "less than"
if (p1 != p2)
{
if (p1)
{
if (!p2)
return true;
else if (xopCmp)
return (*xopCmp)(p2, p1);
else
// BUG: relies on the GC not moving objects
return memcmp(p1, p2, init().length);
}
else
return -1;
}
return 0;
}
override @property size_t tsize() nothrow pure const
{
return init().length;
}
override const(void)[] init() nothrow pure const @safe { return m_init; }
override @property uint flags() nothrow pure const { return m_flags; }
override @property size_t talign() nothrow pure const { return m_align; }
override void destroy(void* p) const
{
if (xdtor)
(*xdtor)(p);
}
override void postblit(void* p) const
{
if (xpostblit)
(*xpostblit)(p);
}
string name;
void[] m_init; // initializer; init.ptr == null if 0 initialize
@safe pure nothrow
{
size_t function(in void*) xtoHash;
bool function(in void*, in void*) xopEquals;
int function(in void*, in void*) xopCmp;
char[] function(in void*) xtoString;
enum StructFlags : uint
{
hasPointers = 0x1,
}
StructFlags m_flags;
}
void function(void*) xdtor;
void function(void*) xpostblit;
uint m_align;
override @property immutable(void)* rtInfo() const { return m_RTInfo; }
version (X86_64)
{
override int argTypes(out TypeInfo arg1, out TypeInfo arg2)
{
arg1 = m_arg1;
arg2 = m_arg2;
return 0;
}
TypeInfo m_arg1;
TypeInfo m_arg2;
}
immutable(void)* m_RTInfo; // data for precise GC
}
unittest
{
struct S
{
const bool opEquals(ref const S rhs)
{
return false;
}
}
S s;
assert(!typeid(S).equals(&s, &s));
}
class TypeInfo_Tuple : TypeInfo
{
TypeInfo[] elements;
override string toString() const
{
string s = "(";
foreach (i, element; elements)
{
if (i)
s ~= ',';
s ~= element.toString();
}
s ~= ")";
return s;
}
override bool opEquals(Object o)
{
if (this is o)
return true;
auto t = cast(const TypeInfo_Tuple)o;
if (t && elements.length == t.elements.length)
{
for (size_t i = 0; i < elements.length; i++)
{
if (elements[i] != t.elements[i])
return false;
}
return true;
}
return false;
}
override size_t getHash(in void* p) const
{
assert(0);
}
override bool equals(in void* p1, in void* p2) const
{
assert(0);
}
override int compare(in void* p1, in void* p2) const
{
assert(0);
}
override @property size_t tsize() nothrow pure const
{
assert(0);
}
override void swap(void* p1, void* p2) const
{
assert(0);
}
override void destroy(void* p) const
{
assert(0);
}
override void postblit(void* p) const
{
assert(0);
}
override @property size_t talign() nothrow pure const
{
assert(0);
}
version (X86_64) override int argTypes(out TypeInfo arg1, out TypeInfo arg2)
{
assert(0);
}
}
class TypeInfo_Const : TypeInfo
{
override string toString() const
{
return cast(string) ("const(" ~ base.toString() ~ ")");
}
//override bool opEquals(Object o) { return base.opEquals(o); }
override bool opEquals(Object o)
{
if (this is o)
return true;
if (typeid(this) != typeid(o))
return false;
auto t = cast(TypeInfo_Const)o;
return base.opEquals(t.base);
}
override size_t getHash(in void *p) const { return base.getHash(p); }
override bool equals(in void *p1, in void *p2) const { return base.equals(p1, p2); }
override int compare(in void *p1, in void *p2) const { return base.compare(p1, p2); }
override @property size_t tsize() nothrow pure const { return base.tsize; }
override void swap(void *p1, void *p2) const { return base.swap(p1, p2); }
override @property inout(TypeInfo) next() nothrow pure inout { return base.next; }
override @property uint flags() nothrow pure const { return base.flags; }
override const(void)[] init() nothrow pure const { return base.init(); }
override @property size_t talign() nothrow pure const { return base.talign; }
version (X86_64) override int argTypes(out TypeInfo arg1, out TypeInfo arg2)
{
return base.argTypes(arg1, arg2);
}
TypeInfo base;
}
class TypeInfo_Invariant : TypeInfo_Const
{
override string toString() const
{
return cast(string) ("immutable(" ~ base.toString() ~ ")");
}
}
class TypeInfo_Shared : TypeInfo_Const
{
override string toString() const
{
return cast(string) ("shared(" ~ base.toString() ~ ")");
}
}
class TypeInfo_Inout : TypeInfo_Const
{
override string toString() const
{
return cast(string) ("inout(" ~ base.toString() ~ ")");
}
}
abstract class MemberInfo
{
@property string name() nothrow pure;
}
class MemberInfo_field : MemberInfo
{
this(string name, TypeInfo ti, size_t offset)
{
m_name = name;
m_typeinfo = ti;
m_offset = offset;
}
override @property string name() nothrow pure { return m_name; }
@property TypeInfo typeInfo() nothrow pure { return m_typeinfo; }
@property size_t offset() nothrow pure { return m_offset; }
string m_name;
TypeInfo m_typeinfo;
size_t m_offset;
}
class MemberInfo_function : MemberInfo
{
this(string name, TypeInfo ti, void* fp, uint flags)
{
m_name = name;
m_typeinfo = ti;
m_fp = fp;
m_flags = flags;
}
override @property string name() nothrow pure { return m_name; }
@property TypeInfo typeInfo() nothrow pure { return m_typeinfo; }
@property void* fp() nothrow pure { return m_fp; }
@property uint flags() nothrow pure { return m_flags; }
string m_name;
TypeInfo m_typeinfo;
void* m_fp;
uint m_flags;
}
///////////////////////////////////////////////////////////////////////////////
// Throwable
///////////////////////////////////////////////////////////////////////////////
/**
* The base class of all thrown objects.
*
* All thrown objects must inherit from Throwable. Class $(D Exception), which
* derives from this class, represents the category of thrown objects that are
* safe to catch and handle. In principle, one should not catch Throwable
* objects that are not derived from $(D Exception), as they represent
* unrecoverable runtime errors. Certain runtime guarantees may fail to hold
* when these errors are thrown, making it unsafe to continue execution after
* catching them.
*/
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; /// A message describing the error.
/**
* The _file name and line number of the D source code corresponding with
* where the error was thrown from.
*/
string file;
size_t line; /// ditto
/**
* The stack trace of where the error happened. This is an opaque object
* that can either be converted to $(D string), or iterated over with $(D
* foreach) to extract the items in the stack trace (as strings).
*/
TraceInfo info;
/**
* A reference to the _next error in the list. This is used when a new
* $(D Throwable) is thrown from inside a $(D catch) block. The originally
* caught $(D Exception) will be chained to the new $(D Throwable) via this
* field.
*/
Throwable next;
@safe pure nothrow this(string msg, Throwable next = null)
{
this.msg = msg;
this.next = next;
//this.info = _d_traceContext();
}
@safe pure nothrow this(string msg, string file, size_t line, Throwable next = null)
{
this(msg, next);
this.file = file;
this.line = line;
//this.info = _d_traceContext();
}
/**
* Overrides $(D Object.toString) and returns the error message.
* Internally this forwards to the $(D toString) overload that
* takes a $(PARAM sink) delegate.
*/
override string toString()
{
string s;
toString((buf) { s ~= buf; });
return s;
}
/**
* The Throwable hierarchy uses a toString overload that takes a
* $(PARAM sink) delegate to avoid GC allocations, which cannot be
* performed in certain error situations. Override this $(D
* toString) method to customize the error message.
*/
void toString(scope void delegate(in char[]) sink) const
{
SizeStringBuff tmpBuff = void;
sink(typeid(this).name);
sink("@"); sink(file);
sink("("); sink(line.sizeToTempString(tmpBuff)); sink(")");
if (msg.length)
{
sink(": "); sink(msg);
}
if (info)
{
try
{
sink("\n----------------");
foreach (t; info)
{
sink("\n"); sink(t);
}
}
catch (Throwable)
{
// ignore more errors
}
}
}
}
alias Throwable.TraceInfo function(void* ptr) TraceHandler;
private __gshared TraceHandler traceHandler = null;
/**
* Overrides the default trace hander with a user-supplied version.
*
* Params:
* h = The new trace handler. Set to null to use the default handler.
*/
extern (C) void rt_setTraceHandler(TraceHandler h)
{
traceHandler = h;
}
/**
* Return the current trace handler
*/
extern (C) TraceHandler rt_getTraceHandler()
{
return traceHandler;
}
/**
* This function will be called when an exception is constructed. The
* user-supplied trace handler will be called if one has been supplied,
* otherwise no trace will be generated.
*
* Params:
* ptr = A pointer to the location from which to generate the trace, or null
* if the trace should be generated from within the trace handler
* itself.
*
* Returns:
* An object describing the current calling context or null if no handler is
* supplied.
*/
extern (C) Throwable.TraceInfo _d_traceContext(void* ptr = null)
{
if (traceHandler is null)
return null;
return traceHandler(ptr);
}
/**
* The base class of all errors that are safe to catch and handle.
*
* In principle, only thrown objects derived from this class are safe to catch
* inside a $(D catch) block. Thrown objects not derived from Exception
* represent runtime errors that should not be caught, as certain runtime
* guarantees may not hold, making it unsafe to continue program execution.
*/
class Exception : Throwable
{
/**
* Creates a new instance of Exception. The next parameter is used
* internally and should always be $(D null) when passed by user code.
* This constructor does not automatically throw the newly-created
* Exception; the $(D throw) statement should be used for that purpose.
*/
@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);
}
}
unittest
{
{
auto e = new Exception("msg");
assert(e.file == __FILE__);
assert(e.line == __LINE__ - 2);
assert(e.next is null);
assert(e.msg == "msg");
}
{
auto e = new Exception("msg", new Exception("It's an Excepton!"), "hello", 42);
assert(e.file == "hello");
assert(e.line == 42);
assert(e.next !is null);
assert(e.msg == "msg");
}
{
auto e = new Exception("msg", "hello", 42, new Exception("It's an Exception!"));
assert(e.file == "hello");
assert(e.line == 42);
assert(e.next !is null);
assert(e.msg == "msg");
}
}
/**
* The base class of all unrecoverable runtime errors.
*
* This represents the category of $(D Throwable) objects that are $(B not)
* safe to catch and handle. In principle, one should not catch Error
* objects, as they represent unrecoverable runtime errors.
* Certain runtime guarantees may fail to hold when these errors are
* thrown, making it unsafe to continue execution after catching them.
*/
class Error : Throwable
{
/**
* Creates a new instance of Error. The next parameter is used
* internally and should always be $(D null) when passed by user code.
* This constructor does not automatically throw the newly-created
* Error; the $(D throw) statement should be used for that purpose.
*/
@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;
}
/// The first $(D Exception) which was bypassed when this Error was thrown,
/// or $(D null) if no $(D Exception)s were pending.
Throwable bypassedException;
}
unittest
{
{
auto e = new Error("msg");
assert(e.file is null);
assert(e.line == 0);
assert(e.next is null);
assert(e.msg == "msg");
assert(e.bypassedException is null);
}
{
auto e = new Error("msg", new Exception("It's an Excepton!"));
assert(e.file is null);
assert(e.line == 0);
assert(e.next !is null);
assert(e.msg == "msg");
assert(e.bypassedException is null);
}
{
auto e = new Error("msg", "hello", 42, new Exception("It's an Exception!"));
assert(e.file == "hello");
assert(e.line == 42);
assert(e.next !is null);
assert(e.msg == "msg");
assert(e.bypassedException is null);
}
}
///////////////////////////////////////////////////////////////////////////////
// ModuleInfo
///////////////////////////////////////////////////////////////////////////////
enum
{
MIctorstart = 0x1, // we've started constructing it
MIctordone = 0x2, // finished construction
MIstandalone = 0x4, // module ctor does not depend on other module
// ctors being done first
MItlsctor = 8,
MItlsdtor = 0x10,
MIctor = 0x20,
MIdtor = 0x40,
MIxgetMembers = 0x80,
MIictor = 0x100,
MIunitTest = 0x200,
MIimportedModules = 0x400,
MIlocalClasses = 0x800,
MIname = 0x1000,
}
struct ModuleInfo
{
const:
uint _flags;
uint _index; // index into _moduleinfo_array[]
private void* addrOf(int flag) nothrow pure
in
{
assert(flag >= MItlsctor && flag <= MIname);
assert(!(flag & (flag - 1)) && !(flag & ~(flag - 1) << 1));
}
body
{
void* p = cast(void*)&this + ModuleInfo.sizeof;
if (flags & MItlsctor)
{
if (flag == MItlsctor) return p;
p += typeof(tlsctor).sizeof;
}
if (flags & MItlsdtor)
{
if (flag == MItlsdtor) return p;
p += typeof(tlsdtor).sizeof;
}
if (flags & MIctor)
{
if (flag == MIctor) return p;
p += typeof(ctor).sizeof;
}
if (flags & MIdtor)
{
if (flag == MIdtor) return p;
p += typeof(dtor).sizeof;
}
if (flags & MIxgetMembers)
{
if (flag == MIxgetMembers) return p;
p += typeof(xgetMembers).sizeof;
}
if (flags & MIictor)
{
if (flag == MIictor) return p;
p += typeof(ictor).sizeof;
}
if (flags & MIunitTest)
{
if (flag == MIunitTest) return p;
p += typeof(unitTest).sizeof;
}
if (flags & MIimportedModules)
{
if (flag == MIimportedModules) return p;
p += size_t.sizeof + *cast(size_t*)p * typeof(importedModules[0]).sizeof;
}
if (flags & MIlocalClasses)
{
if (flag == MIlocalClasses) return p;
p += size_t.sizeof + *cast(size_t*)p * typeof(localClasses[0]).sizeof;
}
if (true || flags & MIname) // always available for now
{
if (flag == MIname) return p;
p += .strlen(cast(immutable char*)p);
}
assert(0);
}
@property uint index() nothrow pure { return _index; }
@property uint flags() nothrow pure { return _flags; }
@property void function() tlsctor() nothrow pure
{
return flags & MItlsctor ? *cast(typeof(return)*)addrOf(MItlsctor) : null;
}
@property void function() tlsdtor() nothrow pure
{
return flags & MItlsdtor ? *cast(typeof(return)*)addrOf(MItlsdtor) : null;
}
@property void* xgetMembers() nothrow pure
{
return flags & MIxgetMembers ? *cast(typeof(return)*)addrOf(MIxgetMembers) : null;
}
@property void function() ctor() nothrow pure
{
return flags & MIctor ? *cast(typeof(return)*)addrOf(MIctor) : null;
}
@property void function() dtor() nothrow pure
{
return flags & MIdtor ? *cast(typeof(return)*)addrOf(MIdtor) : null;
}
@property void function() ictor() nothrow pure
{
return flags & MIictor ? *cast(typeof(return)*)addrOf(MIictor) : null;
}
@property void function() unitTest() nothrow pure
{
return flags & MIunitTest ? *cast(typeof(return)*)addrOf(MIunitTest) : null;
}
@property immutable(ModuleInfo*)[] importedModules() nothrow pure
{
if (flags & MIimportedModules)
{
auto p = cast(size_t*)addrOf(MIimportedModules);
return (cast(immutable(ModuleInfo*)*)(p + 1))[0 .. *p];
}
return null;
}
@property TypeInfo_Class[] localClasses() nothrow pure
{
if (flags & MIlocalClasses)
{
auto p = cast(size_t*)addrOf(MIlocalClasses);
return (cast(TypeInfo_Class*)(p + 1))[0 .. *p];
}
return null;
}
@property string name() nothrow pure
{
if (true || flags & MIname) // always available for now
{
auto p = cast(immutable char*)addrOf(MIname);
return p[0 .. .strlen(p)];
}
// return null;
}
alias int delegate(immutable(ModuleInfo*)) ApplyDg;
static int opApply(scope ApplyDg dg)
{
return rt.minfo.moduleinfos_apply(dg);
}
}
///////////////////////////////////////////////////////////////////////////////
// Monitor
///////////////////////////////////////////////////////////////////////////////
alias Object.Monitor IMonitor;
alias void delegate(Object) DEvent;
// NOTE: The dtor callback feature is only supported for monitors that are not
// supplied by the user. The assumption is that any object with a user-
// supplied monitor may have special storage or lifetime requirements and
// that as a result, storing references to local objects within Monitor
// may not be safe or desirable. Thus, devt is only valid if impl is
// null.
struct Monitor
{
IMonitor impl;
/* internal */
DEvent[] devt;
size_t refs;
/* stuff */
}
Monitor* getMonitor(Object h) pure nothrow
{
return cast(Monitor*) h.__monitor;
}
void setMonitor(Object h, Monitor* m) pure nothrow
{
h.__monitor = m;
}
void setSameMutex(shared Object ownee, shared Object owner) nothrow
in
{
assert(ownee.__monitor is null);
}
body
{
auto m = cast(shared(Monitor)*) owner.__monitor;
if (m is null)
{
_d_monitor_create(cast(Object) owner);
m = cast(shared(Monitor)*) owner.__monitor;
}
auto i = m.impl;
if (i is null)
{
atomicOp!("+=")(m.refs, cast(size_t)1);
ownee.__monitor = owner.__monitor;
return;
}
// If m.impl is set (ie. if this is a user-created monitor), assume
// the monitor is garbage collected and simply copy the reference.
ownee.__monitor = owner.__monitor;
}
extern (C) void _d_monitor_create(Object) nothrow;
extern (C) void _d_monitor_destroy(Object) nothrow;
extern (C) void _d_monitor_lock(Object) nothrow;
extern (C) int _d_monitor_unlock(Object) nothrow;
extern (C) void _d_monitordelete(Object h, bool det)
{
// det is true when the object is being destroyed deterministically (ie.
// when it is explicitly deleted or is a scope object whose time is up).
Monitor* m = getMonitor(h);
if (m !is null)
{
IMonitor i = m.impl;
if (i is null)
{
auto s = cast(shared(Monitor)*) m;
if(!atomicOp!("-=")(s.refs, cast(size_t) 1))
{
_d_monitor_devt(m, h);
_d_monitor_destroy(h);
setMonitor(h, null);
}
return;
}
// NOTE: Since a monitor can be shared via setSameMutex it isn't safe
// to explicitly delete user-created monitors--there's no
// refcount and it may have multiple owners.
/+
if (det && (cast(void*) i) !is (cast(void*) h))
{
destroy(i);
GC.free(cast(void*)i);
}
+/
setMonitor(h, null);
}
}
extern (C) void _d_monitorenter(Object h)
{
Monitor* m = getMonitor(h);
if (m is null)
{
_d_monitor_create(h);
m = getMonitor(h);
}
IMonitor i = m.impl;
if (i is null)
{
_d_monitor_lock(h);
return;
}
i.lock();
}
extern (C) void _d_monitorexit(Object h)
{
Monitor* m = getMonitor(h);
IMonitor i = m.impl;
if (i is null)
{
_d_monitor_unlock(h);
return;
}
i.unlock();
}
extern (C) void _d_monitor_devt(Monitor* m, Object h)
{
if (m.devt.length)
{
DEvent[] devt;
synchronized (h)
{
devt = m.devt;
m.devt = null;
}
foreach (v; devt)
{
if (v)
v(h);
}
free(devt.ptr);
}
}
extern (C) void rt_attachDisposeEvent(Object h, DEvent e)
{
synchronized (h)
{
Monitor* m = getMonitor(h);
assert(m.impl is null);
foreach (ref v; m.devt)
{
if (v is null || v == e)
{
v = e;
return;
}
}
auto len = m.devt.length + 4; // grow by 4 elements
auto pos = m.devt.length; // insert position
auto p = realloc(m.devt.ptr, DEvent.sizeof * len);
if (!p)
onOutOfMemoryError();
m.devt = (cast(DEvent*)p)[0 .. len];
m.devt[pos+1 .. len] = null;
m.devt[pos] = e;
}
}
extern (C) void rt_detachDisposeEvent(Object h, DEvent e)
{
synchronized (h)
{
Monitor* m = getMonitor(h);
assert(m.impl is null);
foreach (p, v; m.devt)
{
if (v == e)
{
memmove(&m.devt[p],
&m.devt[p+1],
(m.devt.length - p - 1) * DEvent.sizeof);
m.devt[$ - 1] = null;
return;
}
}
}
}
extern (C)
{
// from druntime/src/rt/aaA.d
// size_t _aaLen(in void* p) pure nothrow;
// void* _aaGetX(void** pp, const TypeInfo keyti, in size_t valuesize, in void* pkey);
// inout(void)* _aaGetRvalueX(inout void* p, in TypeInfo keyti, in size_t valuesize, in void* pkey);
inout(void)[] _aaValues(inout void* p, in size_t keysize, in size_t valuesize) pure nothrow;
inout(void)[] _aaKeys(inout void* p, in size_t keysize) pure nothrow;
void* _aaRehash(void** pp, in TypeInfo keyti) pure nothrow;
// 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);
private struct AARange { void* impl, current; }
AARange _aaRange(void* aa);
bool _aaRangeEmpty(AARange r);
void* _aaRangeFrontKey(AARange r);
void* _aaRangeFrontValue(AARange r);
void _aaRangePopFront(ref AARange r);
int _aaEqual(in TypeInfo tiRaw, in void* e1, in void* e2);
hash_t _aaGetHash(in void* aa, in TypeInfo tiRaw) nothrow;
}
alias AssociativeArray(Key, Value) = Value[Key];
Value[Key] rehash(T : Value[Key], Value, Key)(auto ref T aa)
{
_aaRehash(cast(void**)&aa, typeid(Value[Key]));
return aa;
}
Value[Key] rehash(T : Value[Key], Value, Key)(T* aa)
{
_aaRehash(cast(void**)aa, typeid(Value[Key]));
return *aa;
}
Value[Key] dup(T : Value[Key], Value, Key)(T aa) if (is(typeof({
ref Value get(); // pseudo lvalue of Value
Value[Key] r; r[Key.init] = get();
// bug 10720 - check whether Value is copyable
})))
{
Value[Key] result;
foreach (k, v; aa)
{
result[k] = v;
}
return result;
}
Value[Key] dup(T : Value[Key], Value, Key)(T* aa) if (is(typeof((*aa).dup)))
{
return (*aa).dup;
}
@disable Value[Key] dup(T : Value[Key], Value, Key)(T aa) if (!is(typeof({
ref Value get(); // pseudo lvalue of Value
Value[Key] r; r[Key.init] = get();
// bug 10720 - check whether Value is copyable
})));
Value[Key] dup(T : Value[Key], Value, Key)(T* aa) if (!is(typeof((*aa).dup)));
auto byKey(T : Value[Key], Value, Key)(T aa)
{
static struct Result
{
AARange r;
@property bool empty() { return _aaRangeEmpty(r); }
@property ref Key front() { return *cast(Key*)_aaRangeFrontKey(r); }
void popFront() { _aaRangePopFront(r); }
Result save() { return this; }
}
return Result(_aaRange(cast(void*)aa));
}
auto byKey(T : Value[Key], Value, Key)(T *aa)
{
return (*aa).byKey();
}
auto byValue(T : Value[Key], Value, Key)(T aa)
{
static struct Result
{
AARange r;
@property bool empty() { return _aaRangeEmpty(r); }
@property ref Value front() { return *cast(Value*)_aaRangeFrontValue(r); }
void popFront() { _aaRangePopFront(r); }
Result save() { return this; }
}
return Result(_aaRange(cast(void*)aa));
}
auto byValue(T : Value[Key], Value, Key)(T *aa)
{
return (*aa).byValue();
}
Key[] keys(T : Value[Key], Value, Key)(T aa) @property
{
auto a = cast(void[])_aaKeys(cast(inout(void)*)aa, Key.sizeof);
return *cast(Key[]*)&a;
}
Key[] keys(T : Value[Key], Value, Key)(T *aa) @property
{
return (*aa).keys;
}
Value[] values(T : Value[Key], Value, Key)(T aa) @property
{
auto a = cast(void[])_aaValues(cast(inout(void)*)aa, Key.sizeof, Value.sizeof);
return *cast(Value[]*)&a;
}
Value[] values(T : Value[Key], Value, Key)(T *aa) @property
{
return (*aa).values;
}
inout(V) get(K, V)(inout(V[K]) aa, K key, lazy inout(V) defaultValue)
{
auto p = key in aa;
return p ? *p : defaultValue;
}
inout(V) get(K, V)(inout(V[K])* aa, K key, lazy inout(V) defaultValue)
{
return (*aa).get(key, defaultValue);
}
unittest
{
int[int] a;
foreach (i; a.byKey)
{
assert(false);
}
foreach (i; a.byValue)
{
assert(false);
}
}
unittest
{
auto a = [ 1:"one", 2:"two", 3:"three" ];
auto b = a.dup;
assert(b == [ 1:"one", 2:"two", 3:"three" ]);
int[] c;
foreach (k; a.byKey)
{
c ~= k;
}
assert(c.length == 3);
c.sort;
assert(c[0] == 1);
assert(c[1] == 2);
assert(c[2] == 3);
}
unittest
{
// test for bug 5925
const a = [4:0];
const b = [4:0];
assert(a == b);
}
unittest
{
// test for bug 9052
static struct Json {
Json[string] aa;
void opAssign(Json) {}
size_t length() const { return aa.length; }
// This length() instantiates AssociativeArray!(string, const(Json)) to call AA.length(), and
// inside ref Slot opAssign(Slot p); (which is automatically generated by compiler in Slot),
// this.value = p.value would actually fail, because both side types of the assignment
// are const(Json).
}
}
unittest
{
// test for bug 8583: ensure Slot and aaA are on the same page wrt value alignment
string[byte] aa0 = [0: "zero"];
string[uint[3]] aa1 = [[1,2,3]: "onetwothree"];
ushort[uint[3]] aa2 = [[9,8,7]: 987];
ushort[uint[4]] aa3 = [[1,2,3,4]: 1234];
string[uint[5]] aa4 = [[1,2,3,4,5]: "onetwothreefourfive"];
assert(aa0.byValue.front == "zero");
assert(aa1.byValue.front == "onetwothree");
assert(aa2.byValue.front == 987);
assert(aa3.byValue.front == 1234);
assert(aa4.byValue.front == "onetwothreefourfive");
}
unittest
{
// test for bug 10720
static struct NC
{
@disable this(this) { }
}
NC[string] aa;
static assert(!is(aa.nonExistingField));
}
unittest
{
// bug 5842
string[string] test = null;
test["test1"] = "test1";
test.remove("test1");
test.rehash;
test["test3"] = "test3"; // causes divide by zero if rehash broke the AA
}
unittest
{
string[] keys = ["a", "b", "c", "d", "e", "f"];
// Test forward range capabilities of byKey
{
int[string] aa;
foreach (key; keys)
aa[key] = 0;
auto keyRange = aa.byKey();
auto savedKeyRange = keyRange.save;
// Consume key range once
size_t keyCount = 0;
while (!keyRange.empty)
{
aa[keyRange.front]++;
keyCount++;
keyRange.popFront();
}
foreach (key; keys)
{
assert(aa[key] == 1);
}
assert(keyCount == keys.length);
// Verify it's possible to iterate the range the second time
keyCount = 0;
while (!savedKeyRange.empty)
{
aa[savedKeyRange.front]++;
keyCount++;
savedKeyRange.popFront();
}
foreach (key; keys)
{
assert(aa[key] == 2);
}
assert(keyCount == keys.length);
}
// Test forward range capabilities of byValue
{
size_t[string] aa;
foreach (i; 0 .. keys.length)
{
aa[keys[i]] = i;
}
auto valRange = aa.byValue();
auto savedValRange = valRange.save;
// Consume value range once
int[] hasSeen;
hasSeen.length = keys.length;
while (!valRange.empty)
{
assert(hasSeen[valRange.front] == 0);
hasSeen[valRange.front]++;
valRange.popFront();
}
foreach (sawValue; hasSeen) { assert(sawValue == 1); }
// Verify it's possible to iterate the range the second time
hasSeen = null;
hasSeen.length = keys.length;
while (!savedValRange.empty)
{
assert(!hasSeen[savedValRange.front]);
hasSeen[savedValRange.front] = true;
savedValRange.popFront();
}
foreach (sawValue; hasSeen) { assert(sawValue); }
}
}
unittest
{
// expanded test for 5842: increase AA size past the point where the AA
// stops using binit, in order to test another code path in rehash.
int[int] aa;
foreach (int i; 0 .. 32)
aa[i] = i;
foreach (int i; 0 .. 32)
aa.remove(i);
aa.rehash;
aa[1] = 1;
}
deprecated("Please use destroy instead of clear.")
alias destroy clear;
/++
Destroys the given object and puts it in an invalid state. It's used to
destroy an object so that any cleanup which its destructor or finalizer
does is done and so that it no longer references any other objects. It does
$(I not) initiate a GC cycle or free any GC memory.
+/
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);
}
version(unittest) unittest
{
interface I { }
{
class A: I { string s = "A"; this() {} }
auto a = new A, b = new A;
a.s = b.s = "asd";
destroy(a);
assert(a.s == "A");
I i = b;
destroy(i);
assert(b.s == "A");
}
{
static bool destroyed = false;
class B: I
{
string s = "B";
this() {}
~this()
{
destroyed = true;
}
}
auto a = new B, b = new B;
a.s = b.s = "asd";
destroy(a);
assert(destroyed);
assert(a.s == "B");
destroyed = false;
I i = b;
destroy(i);
assert(destroyed);
assert(b.s == "B");
}
// this test is invalid now that the default ctor is not run after clearing
version(none)
{
class C
{
string s;
this()
{
s = "C";
}
}
auto a = new C;
a.s = "asd";
destroy(a);
assert(a.s == "C");
}
}
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[];
}
version(unittest) unittest
{
{
struct A { string s = "A"; }
A a;
a.s = "asd";
destroy(a);
assert(a.s == "A");
}
{
static int destroyed = 0;
struct C
{
string s = "C";
~this()
{
destroyed ++;
}
}
struct B
{
C c;
string s = "B";
~this()
{
destroyed ++;
}
}
B a;
a.s = "asd";
a.c.s = "jkl";
destroy(a);
assert(destroyed == 2);
assert(a.s == "B");
assert(a.c.s == "C" );
}
}
void destroy(T : U[n], U, size_t n)(ref T obj) if (!is(T == struct))
{
obj[] = U.init;
}
version(unittest) unittest
{
int[2] a;
a[0] = 1;
a[1] = 2;
destroy(a);
assert(a == [ 0, 0 ]);
}
unittest
{
static struct vec2f {
float[2] values;
alias values this;
}
vec2f v;
destroy!vec2f(v);
}
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;
}
version(unittest) unittest
{
{
int a = 42;
destroy(a);
assert(a == 0);
}
{
float a = 42;
destroy(a);
assert(isnan(a));
}
}
version (unittest)
{
bool isnan(float x)
{
return x != x;
}
}
/**
* (Property) Get the current capacity of a slice. The capacity is the size
* that the slice can grow to before the underlying array must be
* reallocated or extended.
*
* If an append must reallocate a slice with no possibility of extension, then
* 0 is returned. This happens when the slice references a static array, or
* if another slice references elements past the end of the current slice.
*
* Note: The capacity of a slice may be impacted by operations on other slices.
*/
@property size_t capacity(T)(T[] arr) pure nothrow
{
return _d_arraysetcapacity(typeid(T[]), 0, cast(void *)&arr);
}
///
unittest
{
//Static array slice: no capacity
int[4] sarray = [1, 2, 3, 4];
int[] slice = sarray[];
assert(sarray.capacity == 0);
//Appending to slice will reallocate to a new array
slice ~= 5;
assert(slice.capacity >= 5);
//Dynamic array slices
int[] a = [1, 2, 3, 4];
int[] b = a[1 .. $];
int[] c = a[1 .. $ - 1];
assert(a.capacity != 0);
assert(a.capacity == b.capacity + 1); //both a and b share the same tail
assert(c.capacity == 0); //an append to c must relocate c.
}
/**
* Reserves capacity for a slice. The capacity is the size
* that the slice can grow to before the underlying array must be
* reallocated or extended.
*
* The return value is the new capacity of the array (which may be larger than
* the requested capacity).
*/
size_t reserve(T)(ref T[] arr, size_t newcapacity) pure nothrow @trusted
{
return _d_arraysetcapacity(typeid(T[]), newcapacity, cast(void *)&arr);
}
///
unittest
{
//Static array slice: no capacity. Reserve relocates.
int[4] sarray = [1, 2, 3, 4];
int[] slice = sarray[];
auto u = slice.reserve(8);
assert(u >= 8);
assert(sarray.ptr !is slice.ptr);
assert(slice.capacity == u);
//Dynamic array slices
int[] a = [1, 2, 3, 4];
a.reserve(8); //prepare a for appending 4 more items
auto p = a.ptr;
u = a.capacity;
a ~= [5, 6, 7, 8];
assert(p == a.ptr); //a should not have been reallocated
assert(u == a.capacity); //a should not have been extended
}
// Issue 6646: should be possible to use array.reserve from SafeD.
@safe unittest
{
int[] a;
a.reserve(10);
}
/**
* Assume that it is safe to append to this array. Appends made to this array
* after calling this function may append in place, even if the array was a
* slice of a larger array to begin with.
*
* Use this only when it is certain there are no elements in use beyond the
* array in the memory block. If there are, those elements will be
* overwritten by appending to this array.
*
* Calling this function, and then using references to data located after the
* given array results in undefined behavior.
*
* Returns:
* The input is returned.
*/
auto ref inout(T[]) assumeSafeAppend(T)(auto ref inout(T[]) arr) nothrow
{
_d_arrayshrinkfit(typeid(T[]), *(cast(void[]*)&arr));
return arr;
}
///
unittest
{
int[] a = [1, 2, 3, 4];
// Without assumeSafeAppend. Appending relocates.
int[] b = a [0 .. 3];
b ~= 5;
assert(a.ptr != b.ptr);
// With assumeSafeAppend. Appending overwrites.
int[] c = a [0 .. 3];
c.assumeSafeAppend() ~= 5;
assert(a.ptr == c.ptr);
}
unittest
{
int[] arr;
auto newcap = arr.reserve(2000);
assert(newcap >= 2000);
assert(newcap == arr.capacity);
auto ptr = arr.ptr;
foreach(i; 0..2000)
arr ~= i;
assert(ptr == arr.ptr);
arr = arr[0..1];
arr.assumeSafeAppend();
arr ~= 5;
assert(ptr == arr.ptr);
}
unittest
{
int[] arr = [1, 2, 3];
void foo(ref int[] i)
{
i ~= 5;
}
arr = arr[0 .. 2];
foo(assumeSafeAppend(arr)); //pass by ref
assert(arr[]==[1, 2, 5]);
arr = arr[0 .. 1].assumeSafeAppend(); //pass by value
}
//@@@10574@@@
unittest
{
int[] a;
immutable(int[]) b;
auto a2 = &assumeSafeAppend(a);
auto b2 = &assumeSafeAppend(b);
auto a3 = assumeSafeAppend(a[]);
auto b3 = assumeSafeAppend(b[]);
assert(is(typeof(*a2) == int[]));
assert(is(typeof(*b2) == immutable(int[])));
assert(is(typeof(a3) == int[]));
assert(is(typeof(b3) == immutable(int[])));
}
version (none)
{
// enforce() copied from Phobos std.contracts for destroy(), left out until
// we decide whether to use it.
T _enforce(T, string file = __FILE__, int line = __LINE__)
(T value, lazy const(char)[] msg = null)
{
if (!value) bailOut(file, line, msg);
return value;
}
T _enforce(T, string file = __FILE__, int line = __LINE__)
(T value, scope void delegate() dg)
{
if (!value) dg();
return value;
}
T _enforce(T)(T value, lazy Exception ex)
{
if (!value) throw ex();
return value;
}
private void _bailOut(string file, int line, in char[] msg)
{
char[21] buf;
throw new Exception(cast(string)(file ~ "(" ~ ulongToString(buf[], line) ~ "): " ~ (msg ? msg : "Enforcement failed")));
}
}
/***************************************
* Helper function used to see if two containers of different
* types have the same contents in the same sequence.
*/
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*, in void*)
{
throw new Error("TypeInfo.equals is not implemented");
}
bool _xopCmp(in void*, in void*)
{
throw new Error("TypeInfo.compare is not implemented");
}
/******************************************
* Create RTInfo for type T
*/
template RTInfo(T)
{
enum RTInfo = null;
}
// Helper functions
private:
inout(TypeInfo) getElement(inout TypeInfo value) @trusted pure nothrow
{
TypeInfo element = cast() value;
for(;;)
{
if(auto qualified = cast(TypeInfo_Const) element)
element = qualified.base;
else if(auto redefined = cast(TypeInfo_Typedef) element) // typedef & enum
element = redefined.base;
else if(auto staticArray = cast(TypeInfo_StaticArray) element)
element = staticArray.value;
else if(auto vector = cast(TypeInfo_Vector) element)
element = vector.base;
else
break;
}
return cast(inout) element;
}
size_t getArrayHash(in TypeInfo element, in void* ptr, in size_t count) @trusted nothrow
{
if(!count)
return 0;
const size_t elementSize = element.tsize;
if(!elementSize)
return 0;
static bool hasCustomToHash(in TypeInfo value) @trusted pure nothrow
{
const element = getElement(value);
if(const struct_ = cast(const TypeInfo_Struct) element)
return !!struct_.xtoHash;
return cast(const TypeInfo_Array) element
|| cast(const TypeInfo_AssociativeArray) element
|| cast(const ClassInfo) element
|| cast(const TypeInfo_Interface) element;
}
if(!hasCustomToHash(element))
return hashOf(ptr, elementSize * count);
size_t hash = 0;
foreach(size_t i; 0 .. count)
hash += element.getHash(ptr + i * elementSize);
return hash;
}
// @@@BUG5835@@@ tests:
unittest
{
class C
{
int i;
this(in int i) { this.i = i; }
override hash_t toHash() { return 0; }
}
C[] a1 = [new C(11)], a2 = [new C(12)];
assert(typeid(C[]).getHash(&a1) == typeid(C[]).getHash(&a2)); // fails
}
unittest
{
struct S
{
int i;
hash_t toHash() const @safe nothrow { return 0; }
}
S[] a1 = [S(11)], a2 = [S(12)];
assert(typeid(S[]).getHash(&a1) == typeid(S[]).getHash(&a2)); // fails
}
@safe unittest
{
struct S
{
int i;
const @safe nothrow:
hash_t toHash() { return 0; }
bool opEquals(const S) { return true; }
int opCmp(const S) { return 0; }
}
int[S[]] aa = [[S(11)] : 13];
assert(aa[[S(12)]] == 13); // fails
}
public:
/// Provide the .dup array property.
@property auto dup(T)(T[] a)
if (!is(const(T) : T))
{
import core.internal.traits : Unconst;
static assert(is(T : Unconst!T), "Cannot implicitly convert type "~T.stringof~
" to "~Unconst!T.stringof~" in dup.");
// wrap unsafe _dup in @trusted to preserve @safe postblit
static if (__traits(compiles, (T b) @safe { T a = b; }))
return _trustedDup!(T, Unconst!T)(a);
else
return _dup!(T, Unconst!T)(a);
}
/// ditto
// const overload to support implicit conversion to immutable (unique result, see DIP29)
@property T[] dup(T)(const(T)[] a)
if (is(const(T) : T))
{
// wrap unsafe _dup in @trusted to preserve @safe postblit
static if (__traits(compiles, (T b) @safe { T a = b; }))
return _trustedDup!(const(T), T)(a);
else
return _dup!(const(T), T)(a);
}
/// ditto
@property T[] dup(T:void)(const(T)[] a) @trusted
{
if (__ctfe) assert(0, "Cannot dup a void[] array at compile time.");
return cast(T[])_rawDup(a);
}
/// Provide the .idup array property.
@property immutable(T)[] idup(T)(T[] a)
{
static assert(is(T : immutable(T)), "Cannot implicitly convert type "~T.stringof~
" to immutable in idup.");
// wrap unsafe _dup in @trusted to preserve @safe postblit
static if (__traits(compiles, (T b) @safe { T a = b; }))
return _trustedDup!(T, immutable(T))(a);
else
return _dup!(T, immutable(T))(a);
}
/// ditto
@property immutable(T)[] idup(T:void)(const(T)[] a)
{
return a.dup;
}
private U[] _trustedDup(T, U)(T[] a) @trusted
{
return _dup!(T, U)(a);
}
private U[] _dup(T, U)(T[] a) // pure nothrow depends on postblit
{
if (__ctfe)
{
U[] res;
foreach (ref e; a)
res ~= e;
return res;
}
a = _rawDup(a);
auto res = *cast(typeof(return)*)&a;
_doPostblit(res);
return res;
}
private extern (C) void[] _d_newarrayU(const TypeInfo ti, size_t length) pure nothrow;
private inout(T)[] _rawDup(T)(inout(T)[] a)
{
import core.stdc.string : memcpy;
void[] arr = _d_newarrayU(typeid(T[]), a.length);
memcpy(arr.ptr, cast(void*)a.ptr, T.sizeof * a.length);
return *cast(inout(T)[]*)&arr;
}
private void _doPostblit(T)(T[] ary)
{
// infer static postblit type, run postblit if any
static if (is(T == struct))
{
import core.internal.traits : Unqual;
alias PostBlitT = typeof(function(void*){T a = T.init, b = a;});
// use typeid(Unqual!T) here to skip TypeInfo_Const/Shared/...
auto postBlit = cast(PostBlitT)typeid(Unqual!T).xpostblit;
if (postBlit !is null)
{
foreach (ref el; ary)
postBlit(cast(void*)&el);
}
}
else if ((&typeid(T).postblit).funcptr !is &TypeInfo.postblit)
{
alias PostBlitT = typeof(delegate(void*){T a = T.init, b = a;});
auto postBlit = cast(PostBlitT)&typeid(T).postblit;
foreach (ref el; ary)
postBlit(cast(void*)&el);
}
}
unittest
{
static struct S1 { int* p; }
static struct S2 { @disable this(); }
static struct S3 { @disable this(this); }
int dg1() pure nothrow @safe
{
{
char[] m;
string i;
m = m.dup;
i = i.idup;
m = i.dup;
i = m.idup;
}
{
S1[] m;
immutable(S1)[] i;
m = m.dup;
i = i.idup;
static assert(!is(typeof(m.idup)));
static assert(!is(typeof(i.dup)));
}
{
S3[] m;
immutable(S3)[] i;
static assert(!is(typeof(m.dup)));
static assert(!is(typeof(i.idup)));
}
{
shared(S1)[] m;
m = m.dup;
static assert(!is(typeof(m.idup)));
}
{
int[] a = (inout(int)) { inout(const(int))[] a; return a.dup; }(0);
}
return 1;
}
int dg2() pure nothrow @safe
{
{
S2[] m = [S2.init, S2.init];
immutable(S2)[] i = [S2.init, S2.init];
m = m.dup;
m = i.dup;
i = m.idup;
i = i.idup;
}
return 2;
}
enum a = dg1();
enum b = dg2();
assert(dg1() == a);
assert(dg2() == b);
}
unittest
{
static struct Sunpure { this(this) @safe nothrow {} }
static struct Sthrow { this(this) @safe pure {} }
static struct Sunsafe { this(this) @system pure nothrow {} }
static assert( __traits(compiles, () { [].dup!Sunpure; }));
static assert(!__traits(compiles, () pure { [].dup!Sunpure; }));
static assert( __traits(compiles, () { [].dup!Sthrow; }));
static assert(!__traits(compiles, () nothrow { [].dup!Sthrow; }));
static assert( __traits(compiles, () { [].dup!Sunsafe; }));
static assert(!__traits(compiles, () @safe { [].dup!Sunsafe; }));
static assert( __traits(compiles, () { [].idup!Sunpure; }));
static assert(!__traits(compiles, () pure { [].idup!Sunpure; }));
static assert( __traits(compiles, () { [].idup!Sthrow; }));
static assert(!__traits(compiles, () nothrow { [].idup!Sthrow; }));
static assert( __traits(compiles, () { [].idup!Sunsafe; }));
static assert(!__traits(compiles, () @safe { [].idup!Sunsafe; }));
}
unittest
{
static int*[] pureFoo() pure { return null; }
{ char[] s; immutable x = s.dup; }
{ immutable x = (cast(int*[])null).dup; }
{ immutable x = pureFoo(); }
{ immutable x = pureFoo().dup; }
}
unittest
{
auto a = [1, 2, 3];
auto b = a.dup;
assert(b.capacity >= 3);
}
unittest
{
// Bugzilla 12580
void[] m = [0];
shared(void)[] s = [cast(shared)1];
immutable(void)[] i = [cast(immutable)2];
s.dup;
static assert(is(typeof(s.dup) == shared(void)[]));
m = i.dup;
i = m.dup;
i = i.idup;
i = m.idup;
i = s.idup;
i = s.dup;
static assert(!__traits(compiles, m = s.dup));
}
| D |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.